@tmagic/form 1.0.0-beta.1 → 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/tmagic-form.es.js +19 -17
  2. package/dist/tmagic-form.es.js.map +1 -1
  3. package/dist/tmagic-form.umd.js +17 -15
  4. package/dist/tmagic-form.umd.js.map +1 -1
  5. package/dist/types/src/Form.vue.d.ts +10 -13
  6. package/dist/types/src/FormDialog.vue.d.ts +23 -26
  7. package/dist/types/src/containers/Container.vue.d.ts +1 -1
  8. package/dist/types/src/containers/Fieldset.vue.d.ts +1 -1
  9. package/dist/types/src/containers/GroupList.vue.d.ts +1 -1
  10. package/dist/types/src/containers/GroupListItem.vue.d.ts +1 -1
  11. package/dist/types/src/containers/Panel.vue.d.ts +1 -1
  12. package/dist/types/src/containers/Row.vue.d.ts +1 -1
  13. package/dist/types/src/containers/Step.vue.d.ts +1 -1
  14. package/dist/types/src/containers/Table.vue.d.ts +5 -5
  15. package/dist/types/src/containers/Tabs.vue.d.ts +2 -2
  16. package/dist/types/src/fields/Cascader.vue.d.ts +16 -16
  17. package/dist/types/src/fields/Checkbox.vue.d.ts +2 -2
  18. package/dist/types/src/fields/CheckboxGroup.vue.d.ts +2 -2
  19. package/dist/types/src/fields/Date.vue.d.ts +2 -2
  20. package/dist/types/src/fields/DateTime.vue.d.ts +2 -2
  21. package/dist/types/src/fields/Daterange.vue.d.ts +2 -2
  22. package/dist/types/src/fields/DynamicField.vue.d.ts +2 -2
  23. package/dist/types/src/fields/Link.vue.d.ts +47 -54
  24. package/dist/types/src/fields/Number.vue.d.ts +2 -2
  25. package/dist/types/src/fields/RadioGroup.vue.d.ts +2 -2
  26. package/dist/types/src/fields/Select.vue.d.ts +12 -12
  27. package/dist/types/src/fields/Switch.vue.d.ts +2 -2
  28. package/dist/types/src/fields/Text.vue.d.ts +2 -2
  29. package/dist/types/src/fields/Textarea.vue.d.ts +2 -2
  30. package/dist/types/src/fields/Time.vue.d.ts +2 -2
  31. package/package.json +6 -6
  32. package/src/Form.vue +33 -29
  33. package/src/FormDialog.vue +3 -0
  34. package/src/containers/Tabs.vue +4 -0
@@ -49,6 +49,7 @@ declare const _default: DefineComponent<{
49
49
  default: () => never[];
50
50
  };
51
51
  labelWidth: (StringConstructor | NumberConstructor)[];
52
+ size: PropType<"small" | "mini" | "medium">;
52
53
  confirmText: {
53
54
  type: StringConstructor;
54
55
  default: string;
@@ -86,6 +87,7 @@ declare const _default: DefineComponent<{
86
87
  default: () => never[];
87
88
  };
88
89
  labelWidth: (StringConstructor | NumberConstructor)[];
90
+ size: PropType<"small" | "mini" | "medium">;
89
91
  confirmText: {
90
92
  type: StringConstructor;
91
93
  default: string;
@@ -100,16 +102,15 @@ declare const _default: DefineComponent<{
100
102
  $: ComponentInternalInstance;
101
103
  $data: {};
102
104
  $props: Partial<{
103
- labelPosition: string;
104
- labelWidth: string;
105
- inline: boolean;
106
- size: string;
107
- disabled: boolean;
108
- config: FormConfig;
109
- stepActive: string | number;
110
105
  initValues: Record<string, any>;
111
106
  parentValues: Record<string, any>;
107
+ config: FormConfig;
108
+ labelWidth: string;
109
+ disabled: boolean;
112
110
  height: string;
111
+ stepActive: string | number;
112
+ inline: boolean;
113
+ labelPosition: string;
113
114
  keyProp: string;
114
115
  }> & Omit<Readonly<ExtractPropTypes<{
115
116
  initValues: {
@@ -144,7 +145,6 @@ declare const _default: DefineComponent<{
144
145
  };
145
146
  size: {
146
147
  type: StringConstructor;
147
- default: string;
148
148
  };
149
149
  inline: {
150
150
  type: BooleanConstructor;
@@ -162,7 +162,7 @@ declare const _default: DefineComponent<{
162
162
  onChange?: ((...args: any[]) => any) | undefined;
163
163
  "onField-input"?: ((...args: any[]) => any) | undefined;
164
164
  "onField-change"?: ((...args: any[]) => any) | undefined;
165
- } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "labelPosition" | "labelWidth" | "inline" | "size" | "disabled" | "config" | "stepActive" | "initValues" | "parentValues" | "height" | "keyProp">;
165
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "initValues" | "parentValues" | "config" | "labelWidth" | "disabled" | "height" | "stepActive" | "inline" | "labelPosition" | "keyProp">;
166
166
  $attrs: {
167
167
  [x: string]: unknown;
168
168
  };
@@ -209,7 +209,6 @@ declare const _default: DefineComponent<{
209
209
  };
210
210
  size: {
211
211
  type: StringConstructor;
212
- default: string;
213
212
  };
214
213
  inline: {
215
214
  type: BooleanConstructor;
@@ -266,7 +265,7 @@ declare const _default: DefineComponent<{
266
265
  type: BooleanConstructor;
267
266
  default: boolean;
268
267
  };
269
- size: PropType<"default" | "small" | "large">;
268
+ size: PropType<"small" | "default" | "large">;
270
269
  disabled: BooleanConstructor;
271
270
  validateOnRuleChange: {
272
271
  type: BooleanConstructor;
@@ -279,7 +278,7 @@ declare const _default: DefineComponent<{
279
278
  scrollToError: BooleanConstructor;
280
279
  }>> & {
281
280
  onValidate?: ((...args: any[]) => any) | undefined;
282
- } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "labelWidth" | "labelSuffix" | "inline" | "inlineMessage" | "statusIcon" | "showMessage" | "disabled" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError">;
281
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "labelWidth" | "disabled" | "inline" | "labelSuffix" | "inlineMessage" | "statusIcon" | "showMessage" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError">;
283
282
  $attrs: {
284
283
  [x: string]: unknown;
285
284
  };
@@ -312,7 +311,7 @@ declare const _default: DefineComponent<{
312
311
  type: BooleanConstructor;
313
312
  default: boolean;
314
313
  };
315
- size: PropType<"default" | "small" | "large">;
314
+ size: PropType<"small" | "default" | "large">;
316
315
  disabled: BooleanConstructor;
317
316
  validateOnRuleChange: {
318
317
  type: BooleanConstructor;
@@ -382,7 +381,7 @@ declare const _default: DefineComponent<{
382
381
  type: BooleanConstructor;
383
382
  default: boolean;
384
383
  };
385
- size: PropType<"default" | "small" | "large">;
384
+ size: PropType<"small" | "default" | "large">;
386
385
  disabled: BooleanConstructor;
387
386
  validateOnRuleChange: {
388
387
  type: BooleanConstructor;
@@ -408,16 +407,15 @@ declare const _default: DefineComponent<{
408
407
  resetForm: () => void | undefined;
409
408
  submitForm: (native?: boolean | undefined) => Promise<any>;
410
409
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("change" | "field-input" | "field-change")[], string, {
411
- labelPosition: string;
412
- labelWidth: string;
413
- inline: boolean;
414
- size: string;
415
- disabled: boolean;
416
- config: FormConfig;
417
- stepActive: string | number;
418
410
  initValues: Record<string, any>;
419
411
  parentValues: Record<string, any>;
412
+ config: FormConfig;
413
+ labelWidth: string;
414
+ disabled: boolean;
420
415
  height: string;
416
+ stepActive: string | number;
417
+ inline: boolean;
418
+ labelPosition: string;
421
419
  keyProp: string;
422
420
  }> & {
423
421
  beforeCreate?: ((() => void) | (() => void)[]) | undefined;
@@ -472,7 +470,6 @@ declare const _default: DefineComponent<{
472
470
  };
473
471
  size: {
474
472
  type: StringConstructor;
475
- default: string;
476
473
  };
477
474
  inline: {
478
475
  type: BooleanConstructor;
@@ -529,7 +526,7 @@ declare const _default: DefineComponent<{
529
526
  type: BooleanConstructor;
530
527
  default: boolean;
531
528
  };
532
- size: PropType<"default" | "small" | "large">;
529
+ size: PropType<"small" | "default" | "large">;
533
530
  disabled: BooleanConstructor;
534
531
  validateOnRuleChange: {
535
532
  type: BooleanConstructor;
@@ -542,7 +539,7 @@ declare const _default: DefineComponent<{
542
539
  scrollToError: BooleanConstructor;
543
540
  }>> & {
544
541
  onValidate?: ((...args: any[]) => any) | undefined;
545
- } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "labelWidth" | "labelSuffix" | "inline" | "inlineMessage" | "statusIcon" | "showMessage" | "disabled" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError">;
542
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "labelWidth" | "disabled" | "inline" | "labelSuffix" | "inlineMessage" | "statusIcon" | "showMessage" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError">;
546
543
  $attrs: {
547
544
  [x: string]: unknown;
548
545
  };
@@ -575,7 +572,7 @@ declare const _default: DefineComponent<{
575
572
  type: BooleanConstructor;
576
573
  default: boolean;
577
574
  };
578
- size: PropType<"default" | "small" | "large">;
575
+ size: PropType<"small" | "default" | "large">;
579
576
  disabled: BooleanConstructor;
580
577
  validateOnRuleChange: {
581
578
  type: BooleanConstructor;
@@ -645,7 +642,7 @@ declare const _default: DefineComponent<{
645
642
  type: BooleanConstructor;
646
643
  default: boolean;
647
644
  };
648
- size: PropType<"default" | "small" | "large">;
645
+ size: PropType<"small" | "default" | "large">;
649
646
  disabled: BooleanConstructor;
650
647
  validateOnRuleChange: {
651
648
  type: BooleanConstructor;
@@ -722,6 +719,7 @@ declare const _default: DefineComponent<{
722
719
  default: () => never[];
723
720
  };
724
721
  labelWidth: (StringConstructor | NumberConstructor)[];
722
+ size: PropType<"small" | "mini" | "medium">;
725
723
  confirmText: {
726
724
  type: StringConstructor;
727
725
  default: string;
@@ -736,16 +734,15 @@ declare const _default: DefineComponent<{
736
734
  $: ComponentInternalInstance;
737
735
  $data: {};
738
736
  $props: Partial<{
739
- labelPosition: string;
740
- labelWidth: string;
741
- inline: boolean;
742
- size: string;
743
- disabled: boolean;
744
- config: FormConfig;
745
- stepActive: string | number;
746
737
  initValues: Record<string, any>;
747
738
  parentValues: Record<string, any>;
739
+ config: FormConfig;
740
+ labelWidth: string;
741
+ disabled: boolean;
748
742
  height: string;
743
+ stepActive: string | number;
744
+ inline: boolean;
745
+ labelPosition: string;
749
746
  keyProp: string;
750
747
  }> & Omit<Readonly<ExtractPropTypes<{
751
748
  initValues: {
@@ -780,7 +777,6 @@ declare const _default: DefineComponent<{
780
777
  };
781
778
  size: {
782
779
  type: StringConstructor;
783
- default: string;
784
780
  };
785
781
  inline: {
786
782
  type: BooleanConstructor;
@@ -798,7 +794,7 @@ declare const _default: DefineComponent<{
798
794
  onChange?: ((...args: any[]) => any) | undefined;
799
795
  "onField-input"?: ((...args: any[]) => any) | undefined;
800
796
  "onField-change"?: ((...args: any[]) => any) | undefined;
801
- } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "labelPosition" | "labelWidth" | "inline" | "size" | "disabled" | "config" | "stepActive" | "initValues" | "parentValues" | "height" | "keyProp">;
797
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "initValues" | "parentValues" | "config" | "labelWidth" | "disabled" | "height" | "stepActive" | "inline" | "labelPosition" | "keyProp">;
802
798
  $attrs: {
803
799
  [x: string]: unknown;
804
800
  };
@@ -845,7 +841,6 @@ declare const _default: DefineComponent<{
845
841
  };
846
842
  size: {
847
843
  type: StringConstructor;
848
- default: string;
849
844
  };
850
845
  inline: {
851
846
  type: BooleanConstructor;
@@ -902,7 +897,7 @@ declare const _default: DefineComponent<{
902
897
  type: BooleanConstructor;
903
898
  default: boolean;
904
899
  };
905
- size: PropType<"default" | "small" | "large">;
900
+ size: PropType<"small" | "default" | "large">;
906
901
  disabled: BooleanConstructor;
907
902
  validateOnRuleChange: {
908
903
  type: BooleanConstructor;
@@ -915,7 +910,7 @@ declare const _default: DefineComponent<{
915
910
  scrollToError: BooleanConstructor;
916
911
  }>> & {
917
912
  onValidate?: ((...args: any[]) => any) | undefined;
918
- } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "labelWidth" | "labelSuffix" | "inline" | "inlineMessage" | "statusIcon" | "showMessage" | "disabled" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError">;
913
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "labelWidth" | "disabled" | "inline" | "labelSuffix" | "inlineMessage" | "statusIcon" | "showMessage" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError">;
919
914
  $attrs: {
920
915
  [x: string]: unknown;
921
916
  };
@@ -948,7 +943,7 @@ declare const _default: DefineComponent<{
948
943
  type: BooleanConstructor;
949
944
  default: boolean;
950
945
  };
951
- size: PropType<"default" | "small" | "large">;
946
+ size: PropType<"small" | "default" | "large">;
952
947
  disabled: BooleanConstructor;
953
948
  validateOnRuleChange: {
954
949
  type: BooleanConstructor;
@@ -1018,7 +1013,7 @@ declare const _default: DefineComponent<{
1018
1013
  type: BooleanConstructor;
1019
1014
  default: boolean;
1020
1015
  };
1021
- size: PropType<"default" | "small" | "large">;
1016
+ size: PropType<"small" | "default" | "large">;
1022
1017
  disabled: BooleanConstructor;
1023
1018
  validateOnRuleChange: {
1024
1019
  type: BooleanConstructor;
@@ -1044,16 +1039,15 @@ declare const _default: DefineComponent<{
1044
1039
  resetForm: () => void | undefined;
1045
1040
  submitForm: (native?: boolean | undefined) => Promise<any>;
1046
1041
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("change" | "field-input" | "field-change")[], string, {
1047
- labelPosition: string;
1048
- labelWidth: string;
1049
- inline: boolean;
1050
- size: string;
1051
- disabled: boolean;
1052
- config: FormConfig;
1053
- stepActive: string | number;
1054
1042
  initValues: Record<string, any>;
1055
1043
  parentValues: Record<string, any>;
1044
+ config: FormConfig;
1045
+ labelWidth: string;
1046
+ disabled: boolean;
1056
1047
  height: string;
1048
+ stepActive: string | number;
1049
+ inline: boolean;
1050
+ labelPosition: string;
1057
1051
  keyProp: string;
1058
1052
  }> & {
1059
1053
  beforeCreate?: ((() => void) | (() => void)[]) | undefined;
@@ -1108,7 +1102,6 @@ declare const _default: DefineComponent<{
1108
1102
  };
1109
1103
  size: {
1110
1104
  type: StringConstructor;
1111
- default: string;
1112
1105
  };
1113
1106
  inline: {
1114
1107
  type: BooleanConstructor;
@@ -1165,7 +1158,7 @@ declare const _default: DefineComponent<{
1165
1158
  type: BooleanConstructor;
1166
1159
  default: boolean;
1167
1160
  };
1168
- size: PropType<"default" | "small" | "large">;
1161
+ size: PropType<"small" | "default" | "large">;
1169
1162
  disabled: BooleanConstructor;
1170
1163
  validateOnRuleChange: {
1171
1164
  type: BooleanConstructor;
@@ -1178,7 +1171,7 @@ declare const _default: DefineComponent<{
1178
1171
  scrollToError: BooleanConstructor;
1179
1172
  }>> & {
1180
1173
  onValidate?: ((...args: any[]) => any) | undefined;
1181
- } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "labelWidth" | "labelSuffix" | "inline" | "inlineMessage" | "statusIcon" | "showMessage" | "disabled" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError">;
1174
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "labelWidth" | "disabled" | "inline" | "labelSuffix" | "inlineMessage" | "statusIcon" | "showMessage" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError">;
1182
1175
  $attrs: {
1183
1176
  [x: string]: unknown;
1184
1177
  };
@@ -1211,7 +1204,7 @@ declare const _default: DefineComponent<{
1211
1204
  type: BooleanConstructor;
1212
1205
  default: boolean;
1213
1206
  };
1214
- size: PropType<"default" | "small" | "large">;
1207
+ size: PropType<"small" | "default" | "large">;
1215
1208
  disabled: BooleanConstructor;
1216
1209
  validateOnRuleChange: {
1217
1210
  type: BooleanConstructor;
@@ -1281,7 +1274,7 @@ declare const _default: DefineComponent<{
1281
1274
  type: BooleanConstructor;
1282
1275
  default: boolean;
1283
1276
  };
1284
- size: PropType<"default" | "small" | "large">;
1277
+ size: PropType<"small" | "default" | "large">;
1285
1278
  disabled: BooleanConstructor;
1286
1279
  validateOnRuleChange: {
1287
1280
  type: BooleanConstructor;
@@ -1358,8 +1351,8 @@ declare const _default: DefineComponent<{
1358
1351
  }>> & {
1359
1352
  onChange?: ((...args: any[]) => any) | undefined;
1360
1353
  }, {
1361
- model: Record<string, any>;
1362
- disabled: boolean;
1363
1354
  name: string;
1355
+ disabled: boolean;
1356
+ model: Record<string, any>;
1364
1357
  }>;
1365
1358
  export default _default;
@@ -52,8 +52,8 @@ declare const _default: DefineComponent<{
52
52
  onChange?: ((...args: any[]) => any) | undefined;
53
53
  onInput?: ((...args: any[]) => any) | undefined;
54
54
  }, {
55
- model: Record<string, any>;
56
- disabled: boolean;
57
55
  name: string;
56
+ disabled: boolean;
57
+ model: Record<string, any>;
58
58
  }>;
59
59
  export default _default;
@@ -48,8 +48,8 @@ declare const _default: DefineComponent<{
48
48
  }>> & {
49
49
  onChange?: ((...args: any[]) => any) | undefined;
50
50
  }, {
51
- model: Record<string, any>;
52
- disabled: boolean;
53
51
  name: string;
52
+ disabled: boolean;
53
+ model: Record<string, any>;
54
54
  }>;
55
55
  export default _default;
@@ -30,7 +30,7 @@ declare const _default: DefineComponent<{
30
30
  name: StringConstructor;
31
31
  id: StringConstructor;
32
32
  modelValue: {
33
- type: (BooleanConstructor | ObjectConstructor | StringConstructor | ArrayConstructor | NumberConstructor)[];
33
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor | BooleanConstructor | NumberConstructor)[];
34
34
  default: undefined;
35
35
  };
36
36
  autocomplete: {
@@ -39,8 +39,8 @@ declare const _default: DefineComponent<{
39
39
  };
40
40
  automaticDropdown: BooleanConstructor;
41
41
  size: {
42
- type: PropType<"default" | "small" | "large">;
43
- validator: (val: string) => val is "" | "default" | "small" | "large";
42
+ type: PropType<"small" | "default" | "large">;
43
+ validator: (val: string) => val is "" | "small" | "default" | "large";
44
44
  };
45
45
  effect: {
46
46
  type: PropType<string>;
@@ -106,10 +106,10 @@ declare const _default: DefineComponent<{
106
106
  }, {
107
107
  tagInMultiLine: Ref<boolean>;
108
108
  prefixWidth: Ref<number>;
109
- selectSize: ComputedRef<"default" | "small" | "large">;
109
+ selectSize: ComputedRef<"small" | "default" | "large">;
110
110
  readonly: ComputedRef<any>;
111
111
  handleResize: () => void;
112
- collapseTagSize: ComputedRef<"default" | "small">;
112
+ collapseTagSize: ComputedRef<"small" | "default">;
113
113
  debouncedOnInputChange: DebouncedFunc<() => void>;
114
114
  debouncedQueryChange: DebouncedFunc<(e: any) => void>;
115
115
  deletePrevTag: (e: any) => void;
@@ -727,7 +727,7 @@ declare const _default: DefineComponent<{
727
727
  name: StringConstructor;
728
728
  id: StringConstructor;
729
729
  modelValue: {
730
- type: (BooleanConstructor | ObjectConstructor | StringConstructor | ArrayConstructor | NumberConstructor)[];
730
+ type: (ObjectConstructor | ArrayConstructor | StringConstructor | BooleanConstructor | NumberConstructor)[];
731
731
  default: undefined;
732
732
  };
733
733
  autocomplete: {
@@ -736,8 +736,8 @@ declare const _default: DefineComponent<{
736
736
  };
737
737
  automaticDropdown: BooleanConstructor;
738
738
  size: {
739
- type: PropType<"default" | "small" | "large">;
740
- validator: (val: string) => val is "" | "default" | "small" | "large";
739
+ type: PropType<"small" | "default" | "large">;
740
+ validator: (val: string) => val is "" | "small" | "default" | "large";
741
741
  };
742
742
  effect: {
743
743
  type: PropType<string>;
@@ -836,7 +836,7 @@ declare const _default: DefineComponent<{
836
836
  Option: DefineComponent<{
837
837
  value: {
838
838
  required: true;
839
- type: (BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
839
+ type: (ObjectConstructor | StringConstructor | BooleanConstructor | NumberConstructor)[];
840
840
  };
841
841
  label: (StringConstructor | NumberConstructor)[];
842
842
  created: BooleanConstructor;
@@ -877,7 +877,7 @@ declare const _default: DefineComponent<{
877
877
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Record<string, any>, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
878
878
  value: {
879
879
  required: true;
880
- type: (BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[];
880
+ type: (ObjectConstructor | StringConstructor | BooleanConstructor | NumberConstructor)[];
881
881
  };
882
882
  label: (StringConstructor | NumberConstructor)[];
883
883
  created: BooleanConstructor;
@@ -968,8 +968,8 @@ declare const _default: DefineComponent<{
968
968
  }>> & {
969
969
  onChange?: ((...args: any[]) => any) | undefined;
970
970
  }, {
971
- model: Record<string, any>;
972
- disabled: boolean;
973
971
  name: string;
972
+ disabled: boolean;
973
+ model: Record<string, any>;
974
974
  }>;
975
975
  export default _default;
@@ -52,8 +52,8 @@ declare const _default: DefineComponent<{
52
52
  }>> & {
53
53
  onChange?: ((...args: any[]) => any) | undefined;
54
54
  }, {
55
- model: Record<string, any>;
56
- disabled: boolean;
57
55
  name: string;
56
+ disabled: boolean;
57
+ model: Record<string, any>;
58
58
  }>;
59
59
  export default _default;
@@ -54,8 +54,8 @@ declare const _default: DefineComponent<{
54
54
  onChange?: ((...args: any[]) => any) | undefined;
55
55
  onInput?: ((...args: any[]) => any) | undefined;
56
56
  }, {
57
- model: Record<string, any>;
58
- disabled: boolean;
59
57
  name: string;
58
+ disabled: boolean;
59
+ model: Record<string, any>;
60
60
  }>;
61
61
  export default _default;
@@ -49,8 +49,8 @@ declare const _default: DefineComponent<{
49
49
  initValues: ObjectConstructor;
50
50
  values: ObjectConstructor;
51
51
  }>>, {
52
- model: Record<string, any>;
53
- disabled: boolean;
54
52
  name: string;
53
+ disabled: boolean;
54
+ model: Record<string, any>;
55
55
  }>;
56
56
  export default _default;
@@ -47,8 +47,8 @@ declare const _default: DefineComponent<{
47
47
  initValues: ObjectConstructor;
48
48
  values: ObjectConstructor;
49
49
  }>>, {
50
- model: Record<string, any>;
51
- disabled: boolean;
52
50
  name: string;
51
+ disabled: boolean;
52
+ model: Record<string, any>;
53
53
  }>;
54
54
  export default _default;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
- "version": "1.0.0-beta.1",
2
+ "version": "1.0.0-beta.2",
3
3
  "name": "@tmagic/form",
4
- "main": "dist/magic-form.umd.js",
5
- "module": "dist/magic-form.es.js",
4
+ "main": "dist/tmagic-form.umd.js",
5
+ "module": "dist/tmagic-form.es.js",
6
6
  "style": "dist/style.css",
7
7
  "types": "dist/types/src/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./dist/magic-form.es.js",
11
- "require": "./dist/magic-form.umd.js"
10
+ "import": "./dist/tmagic-form.es.js",
11
+ "require": "./dist/tmagic-form.umd.js"
12
12
  },
13
13
  "./dist/style.css": {
14
14
  "import": "./dist/style.css",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@element-plus/icons": "0.0.11",
30
- "@tmagic/utils": "^1.0.0-beta.1",
30
+ "@tmagic/utils": "^1.0.0-beta.2",
31
31
  "element-plus": "^2.0.2",
32
32
  "lodash-es": "^4.17.21",
33
33
  "moment": "^2.29.1",
package/src/Form.vue CHANGED
@@ -1,6 +1,5 @@
1
1
  <template>
2
- <ElForm
3
- v-if="initialized && Array.isArray(config)"
2
+ <el-form
4
3
  class="m-form"
5
4
  ref="elForm"
6
5
  :model="values"
@@ -10,25 +9,26 @@
10
9
  :inline="inline"
11
10
  :label-position="labelPosition"
12
11
  >
13
- <MContainer
14
- v-for="(item, index) in config"
15
- :key="item[keyProp] ?? index"
16
- :config="item"
17
- :model="values"
18
- :label-width="item.labelWidth || labelWidth"
19
- :step-active="stepActive"
20
- :size="size"
21
- @change="changeHandler"
22
- ></MContainer>
23
- </ElForm>
12
+ <template v-if="initialized && Array.isArray(config)">
13
+ <m-form-container
14
+ v-for="(item, index) in config"
15
+ :key="item[keyProp] ?? index"
16
+ :config="item"
17
+ :model="values"
18
+ :label-width="item.labelWidth || labelWidth"
19
+ :step-active="stepActive"
20
+ :size="size"
21
+ @change="changeHandler"
22
+ ></m-form-container>
23
+ </template>
24
+ </el-form>
24
25
  </template>
25
26
 
26
27
  <script lang="ts">
27
- import { defineComponent, PropType, provide, reactive, ref, watchEffect } from 'vue';
28
+ import { defineComponent, PropType, provide, reactive, ref, toRaw, watch } from 'vue';
28
29
  import { ElForm } from 'element-plus';
29
- import { cloneDeep } from 'lodash-es';
30
+ import { cloneDeep, isEqual } from 'lodash-es';
30
31
 
31
- import MContainer from './containers/Container.vue';
32
32
  import { getConfig } from './utils/config';
33
33
  import { initValue } from './utils/form';
34
34
  import { FormConfig, FormState, FormValue } from './schema';
@@ -45,8 +45,6 @@ export interface FieldErrorList {
45
45
  export default defineComponent({
46
46
  name: 'm-form',
47
47
 
48
- components: { ElForm, MContainer },
49
-
50
48
  props: {
51
49
  // 表单初始化值
52
50
  initValues: {
@@ -89,7 +87,6 @@ export default defineComponent({
89
87
 
90
88
  size: {
91
89
  type: String,
92
- default: 'small',
93
90
  },
94
91
 
95
92
  inline: {
@@ -141,16 +138,23 @@ export default defineComponent({
141
138
 
142
139
  provide('mForm', formState);
143
140
 
144
- watchEffect(() => {
145
- initialized.value = false;
146
- initValue(formState, {
147
- initValues: props.initValues,
148
- config: props.config,
149
- }).then((value) => {
150
- values.value = value;
151
- initialized.value = true;
152
- });
153
- });
141
+ watch(
142
+ [() => props.config, () => props.initValues],
143
+ ([config], [preConfig]) => {
144
+ if (!isEqual(toRaw(config), toRaw(preConfig))) {
145
+ initialized.value = false;
146
+ }
147
+
148
+ initValue(formState, {
149
+ initValues: props.initValues,
150
+ config: props.config,
151
+ }).then((value) => {
152
+ values.value = value;
153
+ initialized.value = true;
154
+ });
155
+ },
156
+ { immediate: true },
157
+ );
154
158
 
155
159
  return {
156
160
  initialized,
@@ -15,6 +15,7 @@
15
15
  <m-form
16
16
  v-model="stepActive"
17
17
  ref="form"
18
+ :size="size"
18
19
  :config="config"
19
20
  :init-values="values"
20
21
  :label-width="labelWidth"
@@ -77,6 +78,8 @@ export default defineComponent({
77
78
 
78
79
  labelWidth: [Number, String],
79
80
 
81
+ size: String as PropType<'mini' | 'small' | 'medium'>,
82
+
80
83
  confirmText: {
81
84
  type: String,
82
85
  default: '确定',
@@ -54,6 +54,10 @@ const getActive = (mForm: FormState | undefined, props: any, activeTabName: stri
54
54
 
55
55
  const tabClickHandler = (mForm: FormState | undefined, tab: any, props: any) => {
56
56
  const { config, model, prop } = props;
57
+
58
+ // 兼容vue2的element-ui
59
+ tab.name = tab.paneName;
60
+
57
61
  if (typeof config.onTabClick === 'function') {
58
62
  config.onTabClick(mForm, tab, { model, formValue: mForm?.values, prop });
59
63
  }