@tmagic/form 1.2.0-beta.9 → 1.2.1

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 (82) hide show
  1. package/dist/style.css +1 -1
  2. package/dist/{tmagic-form.mjs → tmagic-form.js} +313 -129
  3. package/dist/tmagic-form.js.map +1 -0
  4. package/dist/{tmagic-form.umd.js → tmagic-form.umd.cjs} +312 -127
  5. package/dist/tmagic-form.umd.cjs.map +1 -0
  6. package/package.json +10 -8
  7. package/src/Form.vue +2 -2
  8. package/src/FormDialog.vue +3 -1
  9. package/src/containers/Col.vue +3 -1
  10. package/src/containers/Container.vue +6 -3
  11. package/src/containers/Fieldset.vue +4 -1
  12. package/src/containers/GroupList.vue +4 -2
  13. package/src/containers/GroupListItem.vue +8 -5
  14. package/src/containers/Panel.vue +4 -1
  15. package/src/containers/Row.vue +3 -1
  16. package/src/containers/Step.vue +3 -1
  17. package/src/containers/Table.vue +46 -19
  18. package/src/containers/Tabs.vue +9 -4
  19. package/src/fields/Cascader.vue +2 -2
  20. package/src/fields/Checkbox.vue +2 -2
  21. package/src/fields/CheckboxGroup.vue +8 -3
  22. package/src/fields/ColorPicker.vue +2 -2
  23. package/src/fields/Date.vue +3 -3
  24. package/src/fields/DateTime.vue +2 -2
  25. package/src/fields/Daterange.vue +2 -2
  26. package/src/fields/Display.vue +1 -1
  27. package/src/fields/DynamicField.vue +2 -2
  28. package/src/fields/Hidden.vue +1 -1
  29. package/src/fields/Link.vue +2 -2
  30. package/src/fields/Number.vue +2 -2
  31. package/src/fields/RadioGroup.vue +9 -5
  32. package/src/fields/Select.vue +63 -24
  33. package/src/fields/SelectOptionGroups.vue +1 -1
  34. package/src/fields/SelectOptions.vue +1 -1
  35. package/src/fields/Switch.vue +2 -2
  36. package/src/fields/Text.vue +2 -2
  37. package/src/fields/Textarea.vue +2 -2
  38. package/src/fields/Time.vue +4 -2
  39. package/src/index.ts +1 -1
  40. package/src/schema.ts +25 -9
  41. package/src/theme/form.scss +1 -1
  42. package/src/utils/config.ts +1 -1
  43. package/src/utils/containerProps.ts +1 -1
  44. package/src/utils/createForm.ts +1 -1
  45. package/src/utils/form.ts +6 -6
  46. package/src/utils/useAddField.ts +1 -1
  47. package/types/Form.vue.d.ts +32 -170
  48. package/types/FormDialog.vue.d.ts +4 -0
  49. package/types/containers/Col.vue.d.ts +12 -74
  50. package/types/containers/Container.vue.d.ts +17 -95
  51. package/types/containers/Fieldset.vue.d.ts +15 -87
  52. package/types/containers/GroupList.vue.d.ts +11 -71
  53. package/types/containers/GroupListItem.vue.d.ts +12 -80
  54. package/types/containers/Panel.vue.d.ts +4 -0
  55. package/types/containers/Row.vue.d.ts +12 -74
  56. package/types/containers/Step.vue.d.ts +13 -79
  57. package/types/containers/Table.vue.d.ts +10 -0
  58. package/types/containers/Tabs.vue.d.ts +12 -74
  59. package/types/fields/Cascader.vue.d.ts +12 -78
  60. package/types/fields/Checkbox.vue.d.ts +12 -78
  61. package/types/fields/CheckboxGroup.vue.d.ts +12 -78
  62. package/types/fields/ColorPicker.vue.d.ts +12 -78
  63. package/types/fields/Date.vue.d.ts +12 -78
  64. package/types/fields/DateTime.vue.d.ts +12 -78
  65. package/types/fields/Daterange.vue.d.ts +12 -78
  66. package/types/fields/Display.vue.d.ts +9 -65
  67. package/types/fields/DynamicField.vue.d.ts +12 -78
  68. package/types/fields/Hidden.vue.d.ts +9 -65
  69. package/types/fields/Link.vue.d.ts +12 -78
  70. package/types/fields/Number.vue.d.ts +12 -81
  71. package/types/fields/RadioGroup.vue.d.ts +12 -78
  72. package/types/fields/Select.vue.d.ts +12 -79
  73. package/types/fields/SelectOptionGroups.vue.d.ts +4 -50
  74. package/types/fields/SelectOptions.vue.d.ts +5 -53
  75. package/types/fields/Switch.vue.d.ts +12 -78
  76. package/types/fields/Text.vue.d.ts +12 -81
  77. package/types/fields/Textarea.vue.d.ts +12 -81
  78. package/types/fields/Time.vue.d.ts +12 -78
  79. package/types/schema.d.ts +23 -8
  80. package/types/utils/form.d.ts +2 -1
  81. package/dist/tmagic-form.mjs.map +0 -1
  82. package/dist/tmagic-form.umd.js.map +0 -1
@@ -1,83 +1,5 @@
1
1
  import { TextareaConfig } from '../schema';
2
- declare const _default: {
3
- new (...args: any[]): {
4
- $: import("vue").ComponentInternalInstance;
5
- $data: {};
6
- $props: Partial<{}> & Omit<Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
7
- config: TextareaConfig;
8
- model: any;
9
- initValues?: any;
10
- values?: any;
11
- name: string;
12
- prop: string;
13
- disabled?: boolean | undefined;
14
- size: 'mini' | 'small' | 'medium';
15
- }>>> & {
16
- onChange?: ((...args: any[]) => any) | undefined;
17
- onInput?: ((...args: any[]) => any) | undefined;
18
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
19
- $attrs: {
20
- [x: string]: unknown;
21
- };
22
- $refs: {
23
- [x: string]: unknown;
24
- };
25
- $slots: Readonly<{
26
- [name: string]: import("vue").Slot | undefined;
27
- }>;
28
- $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
29
- $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
30
- $emit: (event: "change" | "input", ...args: any[]) => void;
31
- $el: any;
32
- $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
33
- config: TextareaConfig;
34
- model: any;
35
- initValues?: any;
36
- values?: any;
37
- name: string;
38
- prop: string;
39
- disabled?: boolean | undefined;
40
- size: 'mini' | 'small' | 'medium';
41
- }>>> & {
42
- onChange?: ((...args: any[]) => any) | undefined;
43
- onInput?: ((...args: any[]) => any) | undefined;
44
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "input")[], string, {}> & {
45
- beforeCreate?: ((() => void) | (() => void)[]) | undefined;
46
- created?: ((() => void) | (() => void)[]) | undefined;
47
- beforeMount?: ((() => void) | (() => void)[]) | undefined;
48
- mounted?: ((() => void) | (() => void)[]) | undefined;
49
- beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
50
- updated?: ((() => void) | (() => void)[]) | undefined;
51
- activated?: ((() => void) | (() => void)[]) | undefined;
52
- deactivated?: ((() => void) | (() => void)[]) | undefined;
53
- beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
54
- beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
55
- destroyed?: ((() => void) | (() => void)[]) | undefined;
56
- unmounted?: ((() => void) | (() => void)[]) | undefined;
57
- renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
58
- renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
59
- errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
60
- };
61
- $forceUpdate: () => void;
62
- $nextTick: typeof import("vue").nextTick;
63
- $watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
64
- } & Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
65
- config: TextareaConfig;
66
- model: any;
67
- initValues?: any;
68
- values?: any;
69
- name: string;
70
- prop: string;
71
- disabled?: boolean | undefined;
72
- size: 'mini' | 'small' | 'medium';
73
- }>>> & {
74
- onChange?: ((...args: any[]) => any) | undefined;
75
- onInput?: ((...args: any[]) => any) | undefined;
76
- } & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
77
- __isFragment?: undefined;
78
- __isTeleport?: undefined;
79
- __isSuspense?: undefined;
80
- } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
2
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
81
3
  config: TextareaConfig;
82
4
  model: any;
83
5
  initValues?: any;
@@ -85,11 +7,20 @@ declare const _default: {
85
7
  name: string;
86
8
  prop: string;
87
9
  disabled?: boolean | undefined;
88
- size: 'mini' | 'small' | 'medium';
10
+ size?: "small" | "default" | "large" | undefined;
11
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "input")[], "change" | "input", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
12
+ config: TextareaConfig;
13
+ model: any;
14
+ initValues?: any;
15
+ values?: any;
16
+ name: string;
17
+ prop: string;
18
+ disabled?: boolean | undefined;
19
+ size?: "small" | "default" | "large" | undefined;
89
20
  }>>> & {
90
21
  onChange?: ((...args: any[]) => any) | undefined;
91
22
  onInput?: ((...args: any[]) => any) | undefined;
92
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "input")[], "input" | "change", {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
23
+ }, {}>;
93
24
  export default _default;
94
25
  declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
95
26
  declare type __VLS_TypePropsToRuntimeProps<T> = {
@@ -1,80 +1,5 @@
1
1
  import { TimeConfig } from '../schema';
2
- declare const _default: {
3
- new (...args: any[]): {
4
- $: import("vue").ComponentInternalInstance;
5
- $data: {};
6
- $props: Partial<{}> & Omit<Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
7
- config: TimeConfig;
8
- model: any;
9
- initValues?: any;
10
- values?: any;
11
- name: string;
12
- prop: string;
13
- disabled?: boolean | undefined;
14
- size: 'mini' | 'small' | 'medium';
15
- }>>> & {
16
- onChange?: ((...args: any[]) => any) | undefined;
17
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
18
- $attrs: {
19
- [x: string]: unknown;
20
- };
21
- $refs: {
22
- [x: string]: unknown;
23
- };
24
- $slots: Readonly<{
25
- [name: string]: import("vue").Slot | undefined;
26
- }>;
27
- $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
28
- $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
29
- $emit: (event: "change", ...args: any[]) => void;
30
- $el: any;
31
- $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
32
- config: TimeConfig;
33
- model: any;
34
- initValues?: any;
35
- values?: any;
36
- name: string;
37
- prop: string;
38
- disabled?: boolean | undefined;
39
- size: 'mini' | 'small' | 'medium';
40
- }>>> & {
41
- onChange?: ((...args: any[]) => any) | undefined;
42
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], string, {}> & {
43
- beforeCreate?: ((() => void) | (() => void)[]) | undefined;
44
- created?: ((() => void) | (() => void)[]) | undefined;
45
- beforeMount?: ((() => void) | (() => void)[]) | undefined;
46
- mounted?: ((() => void) | (() => void)[]) | undefined;
47
- beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
48
- updated?: ((() => void) | (() => void)[]) | undefined;
49
- activated?: ((() => void) | (() => void)[]) | undefined;
50
- deactivated?: ((() => void) | (() => void)[]) | undefined;
51
- beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
52
- beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
53
- destroyed?: ((() => void) | (() => void)[]) | undefined;
54
- unmounted?: ((() => void) | (() => void)[]) | undefined;
55
- renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
56
- renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
57
- errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
58
- };
59
- $forceUpdate: () => void;
60
- $nextTick: typeof import("vue").nextTick;
61
- $watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
62
- } & Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
63
- config: TimeConfig;
64
- model: any;
65
- initValues?: any;
66
- values?: any;
67
- name: string;
68
- prop: string;
69
- disabled?: boolean | undefined;
70
- size: 'mini' | 'small' | 'medium';
71
- }>>> & {
72
- onChange?: ((...args: any[]) => any) | undefined;
73
- } & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
74
- __isFragment?: undefined;
75
- __isTeleport?: undefined;
76
- __isSuspense?: undefined;
77
- } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
2
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
78
3
  config: TimeConfig;
79
4
  model: any;
80
5
  initValues?: any;
@@ -82,10 +7,19 @@ declare const _default: {
82
7
  name: string;
83
8
  prop: string;
84
9
  disabled?: boolean | undefined;
85
- size: 'mini' | 'small' | 'medium';
10
+ size?: "small" | "default" | "large" | undefined;
11
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
12
+ config: TimeConfig;
13
+ model: any;
14
+ initValues?: any;
15
+ values?: any;
16
+ name: string;
17
+ prop: string;
18
+ disabled?: boolean | undefined;
19
+ size?: "small" | "default" | "large" | undefined;
86
20
  }>>> & {
87
21
  onChange?: ((...args: any[]) => any) | undefined;
88
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
22
+ }, {}>;
89
23
  export default _default;
90
24
  declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
91
25
  declare type __VLS_TypePropsToRuntimeProps<T> = {
package/types/schema.d.ts CHANGED
@@ -270,6 +270,7 @@ export interface HiddenConfig extends FormItem {
270
270
  export interface DateConfig extends FormItem, Input {
271
271
  type: 'date';
272
272
  format?: 'YYYY-MM-dd HH:mm:ss' | string;
273
+ valueFormat?: 'YYYY-MM-dd HH:mm:ss' | string;
273
274
  }
274
275
  /**
275
276
  * 日期时间选择器
@@ -285,6 +286,8 @@ export interface DateTimeConfig extends FormItem, Input {
285
286
  */
286
287
  export interface TimeConfig extends FormItem, Input {
287
288
  type: 'time';
289
+ format?: 'HH:mm:ss' | string;
290
+ valueFormat?: 'HH:mm:ss' | string;
288
291
  }
289
292
  /**
290
293
  * 单个多选框
@@ -342,7 +345,10 @@ export interface SelectConfig extends FormItem, Input {
342
345
  options: SelectConfigOption[] | SelectConfigGroupOption[] | SelectOptionFunction;
343
346
  remote: true;
344
347
  option: {
345
- url: string;
348
+ url: string | ((mForm: FormState | undefined, data: {
349
+ model: any;
350
+ formValue: any;
351
+ }) => string);
346
352
  initUrl?: string | ((mForm: FormState | undefined, data: {
347
353
  model: any;
348
354
  formValue: any;
@@ -356,13 +362,18 @@ export interface SelectConfig extends FormItem, Input {
356
362
  };
357
363
  json?: false | boolean;
358
364
  body?: Record<string, any> | RemoteSelectOptionBodyFunction;
365
+ initBody?: Record<string, any> | RemoteSelectOptionBodyFunction;
359
366
  jsonpCallback?: 'callback' | string;
360
367
  afterRequest?: RemoteSelectOptionRequestFunction;
368
+ afterInitRequest?: RemoteSelectOptionRequestFunction;
361
369
  beforeRequest?: (mForm: FormState | undefined, postOptions: Record<string, any>, data: any) => Record<string, any>;
362
- root: string;
370
+ beforeInitRequest?: (mForm: FormState | undefined, postOptions: Record<string, any>, data: any) => Record<string, any>;
371
+ root?: string;
372
+ totalKey?: string;
373
+ initRoot?: string;
363
374
  item?: RemoteSelectOptionItemFunction;
364
- value: string | SelectOptionValueFunction;
365
- text: string | SelectOptionTextFunction;
375
+ value?: string | SelectOptionValueFunction;
376
+ text?: string | SelectOptionTextFunction;
366
377
  };
367
378
  }
368
379
  /**
@@ -474,11 +485,11 @@ export interface PanelConfig extends FormItem, ContainerCommonConfig {
474
485
  title?: string;
475
486
  schematic?: string;
476
487
  }
477
- export interface ColumnConfig extends FormItem, ContainerCommonConfig {
478
- name: string;
488
+ export interface ColumnConfig extends FormItem {
489
+ name?: string;
479
490
  label: string;
480
- width: string | number;
481
- sortable: boolean;
491
+ width?: string | number;
492
+ sortable?: boolean;
482
493
  [key: string]: any;
483
494
  }
484
495
  /**
@@ -497,6 +508,9 @@ export interface TableConfig extends FormItem {
497
508
  border?: boolean;
498
509
  /** 显示行号 */
499
510
  showIndex?: boolean;
511
+ /** 操作栏宽度 */
512
+ operateColWidth?: number | string;
513
+ pagination?: boolean;
500
514
  enum?: any[];
501
515
  /** 是否显示添加按钮 */
502
516
  addable?: (mForm: FormState | undefined, data: any) => boolean | 'undefined' | boolean;
@@ -516,6 +530,7 @@ export interface TableConfig extends FormItem {
516
530
  enableFullscreen?: boolean;
517
531
  fixed?: boolean;
518
532
  itemExtra?: string | FilterFunction;
533
+ rowKey?: string;
519
534
  }
520
535
  export interface GroupListConfig extends FormItem {
521
536
  type: 'table' | 'groupList' | 'group-list';
@@ -1,4 +1,5 @@
1
- import { FormConfig, FormState, FormValue, Rule } from '../schema';
1
+ import { FormConfig, FormState, FormValue, Rule, TabPaneConfig } from '../schema';
2
+ export declare const createValues: (mForm: FormState | undefined, config?: FormConfig | TabPaneConfig[], initValue?: FormValue, value?: FormValue) => FormValue;
2
3
  export declare const filterFunction: (mForm: FormState | undefined, config: any, props: any) => any;
3
4
  export declare const display: (mForm: FormState | undefined, config: any, props: any) => any;
4
5
  export declare const getRules: (mForm: FormState | undefined, rules: Rule | Rule[] | undefined, props: any) => Rule[];