Skip to content

Commit

Permalink
refactor(form): refining low-frequency widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Oct 21, 2023
1 parent 3d6e016 commit 561064c
Show file tree
Hide file tree
Showing 83 changed files with 615 additions and 379 deletions.
28 changes: 0 additions & 28 deletions packages/form/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,19 @@ import { FormsModule } from '@angular/forms';
import { NzAutocompleteModule } from 'ng-zorro-antd/auto-complete';
import { NzButtonModule } from 'ng-zorro-antd/button';
import { NzCardModule } from 'ng-zorro-antd/card';
import { NzCascaderModule } from 'ng-zorro-antd/cascader';
import { NzCheckboxModule } from 'ng-zorro-antd/checkbox';
import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
import { NzFormModule } from 'ng-zorro-antd/form';
import { NzGridModule } from 'ng-zorro-antd/grid';
import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzInputModule } from 'ng-zorro-antd/input';
import { NzInputNumberModule } from 'ng-zorro-antd/input-number';
import { NzMentionModule } from 'ng-zorro-antd/mention';
import { NzModalModule } from 'ng-zorro-antd/modal';
import { NzRadioModule } from 'ng-zorro-antd/radio';
import { NzRateModule } from 'ng-zorro-antd/rate';
import { NzSelectModule } from 'ng-zorro-antd/select';
import { NzSliderModule } from 'ng-zorro-antd/slider';
import { NzSwitchModule } from 'ng-zorro-antd/switch';
import { NzTagModule } from 'ng-zorro-antd/tag';
import { NzTimePickerModule } from 'ng-zorro-antd/time-picker';
import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
import { NzTransferModule } from 'ng-zorro-antd/transfer';
import { NzTreeSelectModule } from 'ng-zorro-antd/tree-select';
import { NzUploadModule } from 'ng-zorro-antd/upload';

import { DelonLocaleModule } from '@delon/theme';
Expand All @@ -35,26 +28,19 @@ const ZORROS = [
NzAutocompleteModule,
NzButtonModule,
NzCardModule,
NzCascaderModule,
NzCheckboxModule,
NzDatePickerModule,
NzFormModule,
NzGridModule,
NzIconModule,
NzInputModule,
NzInputNumberModule,
NzMentionModule,
NzModalModule,
NzRadioModule,
NzRateModule,
NzSelectModule,
NzSliderModule,
NzSwitchModule,
NzTagModule,
NzTimePickerModule,
NzToolTipModule,
NzTransferModule,
NzTreeSelectModule,
NzUploadModule
];

Expand All @@ -73,25 +59,18 @@ import { WidgetRegistry } from './widget.factory';
import { ArrayWidget } from './widgets/array/array.widget';
import { AutoCompleteWidget } from './widgets/autocomplete/autocomplete.widget';
import { BooleanWidget } from './widgets/boolean/boolean.widget';
import { CascaderWidget } from './widgets/cascader/cascader.widget';
import { CheckboxWidget } from './widgets/checkbox/checkbox.widget';
import { CustomWidget } from './widgets/custom/custom.widget';
import { DateWidget } from './widgets/date/date.widget';
import { MentionWidget } from './widgets/mention/mention.widget';
import { NumberWidget } from './widgets/number/number.widget';
import { NzWidgetRegistry } from './widgets/nz-widget.registry';
import { ObjectWidget } from './widgets/object/object.widget';
import { RadioWidget } from './widgets/radio/radio.widget';
import { RateWidget } from './widgets/rate/rate.widget';
import { SelectWidget } from './widgets/select/select.widget';
import { SliderWidget } from './widgets/slider/slider.widget';
import { StringWidget } from './widgets/string/string.widget';
import { TagWidget } from './widgets/tag/tag.widget';
import { TextWidget } from './widgets/text/text.widget';
import { TextareaWidget } from './widgets/textarea/textarea.widget';
import { TimeWidget } from './widgets/time/time.widget';
import { TransferWidget } from './widgets/transfer/transfer.widget';
import { TreeSelectWidget } from './widgets/tree-select/tree-select.widget';
import { UploadWidget } from './widgets/upload/upload.widget';

const WIDGETS = [
Expand All @@ -106,15 +85,8 @@ const WIDGETS = [
BooleanWidget,
TextareaWidget,
SelectWidget,
TreeSelectWidget,
TagWidget,
UploadWidget,
TransferWidget,
SliderWidget,
RateWidget,
AutoCompleteWidget,
CascaderWidget,
MentionWidget,
CustomWidget,
TextWidget
];
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/array/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: array
subtitle: Array
type: Widgets
order: 2
---

Create array object, it's only valid when `schema.type="array"`.
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/array/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: array
subtitle: 数组
type: Widgets
order: 2
---

创建对象数组,只对 `schema.type="array"` 时有效。
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/boolean/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: boolean
subtitle: Switch
type: Widgets
order: 4
---

Switching Selector.
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/boolean/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: boolean
subtitle: 开关
type: Widgets
order: 4
---

开关选择器
Expand Down
28 changes: 0 additions & 28 deletions packages/form/src/widgets/cascader/cascader.widget.html

This file was deleted.

3 changes: 2 additions & 1 deletion packages/form/src/widgets/checkbox/demo/simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Simplest of usage.

```ts
import { Component } from '@angular/core';
import { SFCascaderWidgetSchema, SFCheckboxWidgetSchema, SFSchema } from '@delon/form';
import { SFCheckboxWidgetSchema, SFSchema } from '@delon/form';
import type { SFCascaderWidgetSchema } from '@delon/form/widgets/cascader';
import { NzMessageService } from 'ng-zorro-antd/message';
import { of, delay } from 'rxjs';

Expand Down
2 changes: 1 addition & 1 deletion packages/form/src/widgets/custom/demo/simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
</div>
</ng-template>
<ng-template sf-template="qr" let-i let-ui="ui" let-schema="schema">
<qr [value]="i.value"></qr>
<nz-qrcode [nzValue]="i.value" />
</ng-template>
</sf>
`
Expand Down
15 changes: 0 additions & 15 deletions packages/form/src/widgets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,14 @@ export * from './radio/schema';
export * from './checkbox/checkbox.widget';
export * from './checkbox/schema';
export * from './boolean/boolean.widget';
export * from './cascader/schema';
export * from './textarea/textarea.widget';
export * from './textarea/schema';
export * from './select/select.widget';
export * from './select/schema';
export * from './tree-select/tree-select.widget';
export * from './tree-select/schema';
export * from './tag/tag.widget';
export * from './tag/schema';
export * from './upload/upload.widget';
export * from './upload/schema';
export * from './transfer/transfer.widget';
export * from './transfer/schema';
export * from './slider/slider.widget';
export * from './slider/schema';
export * from './rate/rate.widget';
export * from './rate/schema';
export * from './autocomplete/autocomplete.widget';
export * from './autocomplete/schema';
export * from './cascader/cascader.widget';
export * from './cascader/schema';
export * from './mention/mention.widget';
export * from './mention/schema';
export * from './text/text.widget';
export * from './text/schema';
export * from './custom/custom.widget';
Expand Down
43 changes: 0 additions & 43 deletions packages/form/src/widgets/mention/mention.widget.html

This file was deleted.

1 change: 1 addition & 0 deletions packages/form/src/widgets/number/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: number
subtitle: Input Number
type: Widgets
order: 5
---

Enter a number within certain range with the mouse or keyboard.
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/number/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: number
subtitle: 数字
type: Widgets
order: 5
---

通过鼠标或键盘,输入范围内的数值
Expand Down
14 changes: 0 additions & 14 deletions packages/form/src/widgets/nz-widget.registry.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
import { ArrayWidget } from './array/array.widget';
import { AutoCompleteWidget } from './autocomplete/autocomplete.widget';
import { BooleanWidget } from './boolean/boolean.widget';
import { CascaderWidget } from './cascader/cascader.widget';
import { CheckboxWidget } from './checkbox/checkbox.widget';
import { CustomWidget } from './custom/custom.widget';
import { DateWidget } from './date/date.widget';
import { MentionWidget } from './mention/mention.widget';
import { NumberWidget } from './number/number.widget';
import { ObjectWidget } from './object/object.widget';
import { RadioWidget } from './radio/radio.widget';
import { RateWidget } from './rate/rate.widget';
import { SelectWidget } from './select/select.widget';
import { SliderWidget } from './slider/slider.widget';
import { StringWidget } from './string/string.widget';
import { TagWidget } from './tag/tag.widget';
import { TextWidget } from './text/text.widget';
import { TextareaWidget } from './textarea/textarea.widget';
import { TimeWidget } from './time/time.widget';
import { TransferWidget } from './transfer/transfer.widget';
import { TreeSelectWidget } from './tree-select/tree-select.widget';
import { UploadWidget } from './upload/upload.widget';
import { WidgetRegistry } from '../widget.factory';

Expand All @@ -40,15 +33,8 @@ export class NzWidgetRegistry extends WidgetRegistry {
this.register('boolean', BooleanWidget);
this.register('textarea', TextareaWidget);
this.register('select', SelectWidget);
this.register('tree-select', TreeSelectWidget);
this.register('tag', TagWidget);
this.register('upload', UploadWidget);
this.register('transfer', TransferWidget);
this.register('slider', SliderWidget);
this.register('rate', RateWidget);
this.register('autocomplete', AutoCompleteWidget);
this.register('cascader', CascaderWidget);
this.register('mention', MentionWidget);
this.register('custom', CustomWidget);

this.setDefault(StringWidget);
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/object/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: object
subtitle: Object
type: Widgets
order: 1
---

Create an object widget, valid only for `schema.type="object"`.
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/object/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: object
subtitle: 对象
type: Widgets
order: 1
---

创建对象,只对 `schema.type="object"` 时有效。
Expand Down
13 changes: 0 additions & 13 deletions packages/form/src/widgets/rate/rate.widget.html

This file was deleted.

1 change: 1 addition & 0 deletions packages/form/src/widgets/select/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: select
subtitle: Select
type: Widgets
order: 6
---

Select.
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/select/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: select
subtitle: 选择器
type: Widgets
order: 6
---

下拉选择器。
Expand Down
17 changes: 0 additions & 17 deletions packages/form/src/widgets/slider/slider.widget.html

This file was deleted.

1 change: 1 addition & 0 deletions packages/form/src/widgets/string/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: string
subtitle: Input
type: Widgets
order: 3
---

Default widget, A basic widget for getting the user input is a text field.
Expand Down
1 change: 1 addition & 0 deletions packages/form/src/widgets/string/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: string
subtitle: 文本框
type: Widgets
order: 3
---

默认小部件,一般用于字符串元素。
Expand Down
Loading

0 comments on commit 561064c

Please sign in to comment.