@tmagic/form 1.0.0-beta.3 → 1.0.0-beta.6

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 (42) hide show
  1. package/dist/style.css +160 -0
  2. package/dist/tmagic-form.es.js +3753 -0
  3. package/dist/tmagic-form.es.js.map +1 -0
  4. package/dist/tmagic-form.umd.js +3794 -0
  5. package/dist/tmagic-form.umd.js.map +1 -0
  6. package/dist/types/src/Form.vue.d.ts +301 -0
  7. package/dist/types/src/FormDialog.vue.d.ts +638 -0
  8. package/dist/types/src/containers/Container.vue.d.ts +69 -0
  9. package/dist/types/src/containers/Fieldset.vue.d.ts +56 -0
  10. package/dist/types/src/containers/GroupList.vue.d.ts +56 -0
  11. package/dist/types/src/containers/GroupListItem.vue.d.ts +72 -0
  12. package/dist/types/src/containers/Panel.vue.d.ts +41 -0
  13. package/dist/types/src/containers/Row.vue.d.ts +42 -0
  14. package/dist/types/src/containers/Step.vue.d.ts +45 -0
  15. package/dist/types/src/containers/Table.vue.d.ts +1403 -0
  16. package/dist/types/src/containers/Tabs.vue.d.ts +45 -0
  17. package/dist/types/src/fields/Cascader.vue.d.ts +1748 -0
  18. package/dist/types/src/fields/Checkbox.vue.d.ts +59 -0
  19. package/dist/types/src/fields/CheckboxGroup.vue.d.ts +56 -0
  20. package/dist/types/src/fields/Date.vue.d.ts +58 -0
  21. package/dist/types/src/fields/DateTime.vue.d.ts +57 -0
  22. package/dist/types/src/fields/Daterange.vue.d.ts +57 -0
  23. package/dist/types/src/fields/Display.vue.d.ts +3 -0
  24. package/dist/types/src/fields/DynamicField.vue.d.ts +76 -0
  25. package/dist/types/src/fields/Hidden.vue.d.ts +3 -0
  26. package/dist/types/src/fields/Link.vue.d.ts +1358 -0
  27. package/dist/types/src/fields/Number.vue.d.ts +59 -0
  28. package/dist/types/src/fields/RadioGroup.vue.d.ts +55 -0
  29. package/dist/types/src/fields/Select.vue.d.ts +975 -0
  30. package/dist/types/src/fields/Switch.vue.d.ts +59 -0
  31. package/dist/types/src/fields/Text.vue.d.ts +61 -0
  32. package/dist/types/src/fields/Textarea.vue.d.ts +56 -0
  33. package/dist/types/src/fields/Time.vue.d.ts +54 -0
  34. package/dist/types/src/index.d.ts +36 -0
  35. package/dist/types/src/schema.d.ts +495 -0
  36. package/dist/types/src/shims-vue.d.ts +6 -0
  37. package/dist/types/src/utils/config.d.ts +3 -0
  38. package/dist/types/src/utils/fieldProps.d.ts +21 -0
  39. package/dist/types/src/utils/form.d.ts +8 -0
  40. package/dist/types/src/utils/useAddField.d.ts +1 -0
  41. package/dist/types/src/vite-env.d.ts +1 -0
  42. package/package.json +2 -2
@@ -0,0 +1,301 @@
1
+ import type { ValidateFieldCallback } from 'element-plus';
2
+ import type { Callback } from 'element-plus/es/components/form/src/form.vue';
3
+ import type { FormItemRule } from 'element-plus/es/components/form/src/form.type';
4
+ import type { DefineComponent, Ref, ComponentInternalInstance, ExtractPropTypes, VNodeProps, AllowedComponentProps, ComponentCustomProps, Slot, ComponentPublicInstance, ComponentOptionsBase, ComputedRef, ComponentOptionsMixin, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, PropType } from 'vue';
5
+ import { FormConfig, FormState } from './schema';
6
+ export interface ValidateError {
7
+ message: string;
8
+ field: string;
9
+ }
10
+ export interface FieldErrorList {
11
+ [field: string]: ValidateError[];
12
+ }
13
+ declare const _default: DefineComponent<{
14
+ initValues: {
15
+ type: ObjectConstructor;
16
+ required: true;
17
+ default: () => {};
18
+ };
19
+ parentValues: {
20
+ type: ObjectConstructor;
21
+ default: () => {};
22
+ };
23
+ config: {
24
+ type: PropType<FormConfig>;
25
+ required: true;
26
+ default: () => never[];
27
+ };
28
+ labelWidth: {
29
+ type: StringConstructor;
30
+ default: () => string;
31
+ };
32
+ disabled: {
33
+ type: BooleanConstructor;
34
+ default: () => boolean;
35
+ };
36
+ height: {
37
+ type: StringConstructor;
38
+ default: () => string;
39
+ };
40
+ stepActive: {
41
+ type: (StringConstructor | NumberConstructor)[];
42
+ default: () => number;
43
+ };
44
+ size: {
45
+ type: StringConstructor;
46
+ };
47
+ inline: {
48
+ type: BooleanConstructor;
49
+ default: boolean;
50
+ };
51
+ labelPosition: {
52
+ type: StringConstructor;
53
+ default: string;
54
+ };
55
+ keyProp: {
56
+ type: StringConstructor;
57
+ default: string;
58
+ };
59
+ }, {
60
+ initialized: Ref<boolean>;
61
+ values: Ref<{
62
+ [x: string]: any;
63
+ [x: number]: any;
64
+ }>;
65
+ elForm: Ref<({
66
+ $: ComponentInternalInstance;
67
+ $data: {};
68
+ $props: Partial<{
69
+ disabled: boolean;
70
+ inline: boolean;
71
+ labelWidth: string | number;
72
+ labelSuffix: string;
73
+ inlineMessage: boolean;
74
+ statusIcon: boolean;
75
+ showMessage: boolean;
76
+ validateOnRuleChange: boolean;
77
+ hideRequiredAsterisk: boolean;
78
+ scrollToError: boolean;
79
+ }> & Omit<Readonly<ExtractPropTypes<{
80
+ model: ObjectConstructor;
81
+ rules: PropType<Partial<Record<string, FormItemRule | FormItemRule[]>>>;
82
+ labelPosition: StringConstructor;
83
+ labelWidth: {
84
+ type: (StringConstructor | NumberConstructor)[];
85
+ default: string;
86
+ };
87
+ labelSuffix: {
88
+ type: StringConstructor;
89
+ default: string;
90
+ };
91
+ inline: BooleanConstructor;
92
+ inlineMessage: BooleanConstructor;
93
+ statusIcon: BooleanConstructor;
94
+ showMessage: {
95
+ type: BooleanConstructor;
96
+ default: boolean;
97
+ };
98
+ size: PropType<"small" | "default" | "large">;
99
+ disabled: BooleanConstructor;
100
+ validateOnRuleChange: {
101
+ type: BooleanConstructor;
102
+ default: boolean;
103
+ };
104
+ hideRequiredAsterisk: {
105
+ type: BooleanConstructor;
106
+ default: boolean;
107
+ };
108
+ scrollToError: BooleanConstructor;
109
+ }>> & {
110
+ onValidate?: ((...args: any[]) => any) | undefined;
111
+ } & VNodeProps & AllowedComponentProps & ComponentCustomProps, "labelWidth" | "disabled" | "inline" | "labelSuffix" | "inlineMessage" | "statusIcon" | "showMessage" | "validateOnRuleChange" | "hideRequiredAsterisk" | "scrollToError">;
112
+ $attrs: {
113
+ [x: string]: unknown;
114
+ };
115
+ $refs: {
116
+ [x: string]: unknown;
117
+ };
118
+ $slots: Readonly<{
119
+ [name: string]: Slot | undefined;
120
+ }>;
121
+ $root: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
122
+ $parent: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
123
+ $emit: (event: "validate", ...args: any[]) => void;
124
+ $el: any;
125
+ $options: ComponentOptionsBase<Readonly<ExtractPropTypes<{
126
+ model: ObjectConstructor;
127
+ rules: PropType<Partial<Record<string, FormItemRule | FormItemRule[]>>>;
128
+ labelPosition: StringConstructor;
129
+ labelWidth: {
130
+ type: (StringConstructor | NumberConstructor)[];
131
+ default: string;
132
+ };
133
+ labelSuffix: {
134
+ type: StringConstructor;
135
+ default: string;
136
+ };
137
+ inline: BooleanConstructor;
138
+ inlineMessage: BooleanConstructor;
139
+ statusIcon: BooleanConstructor;
140
+ showMessage: {
141
+ type: BooleanConstructor;
142
+ default: boolean;
143
+ };
144
+ size: PropType<"small" | "default" | "large">;
145
+ disabled: BooleanConstructor;
146
+ validateOnRuleChange: {
147
+ type: BooleanConstructor;
148
+ default: boolean;
149
+ };
150
+ hideRequiredAsterisk: {
151
+ type: BooleanConstructor;
152
+ default: boolean;
153
+ };
154
+ scrollToError: BooleanConstructor;
155
+ }>> & {
156
+ onValidate?: ((...args: any[]) => any) | undefined;
157
+ }, {
158
+ formKls: ComputedRef<string[]>;
159
+ validate: (callback?: Callback | undefined) => Promise<boolean> | undefined;
160
+ resetFields: () => void;
161
+ clearValidate: (props?: string | string[] | undefined) => void;
162
+ validateField: (props: string | string[], cb: ValidateFieldCallback) => void;
163
+ scrollToField: (prop: string) => void;
164
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, "validate"[], string, {
165
+ disabled: boolean;
166
+ inline: boolean;
167
+ labelWidth: string | number;
168
+ labelSuffix: string;
169
+ inlineMessage: boolean;
170
+ statusIcon: boolean;
171
+ showMessage: boolean;
172
+ validateOnRuleChange: boolean;
173
+ hideRequiredAsterisk: boolean;
174
+ scrollToError: boolean;
175
+ }> & {
176
+ beforeCreate?: ((() => void) | (() => void)[]) | undefined;
177
+ created?: ((() => void) | (() => void)[]) | undefined;
178
+ beforeMount?: ((() => void) | (() => void)[]) | undefined;
179
+ mounted?: ((() => void) | (() => void)[]) | undefined;
180
+ beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
181
+ updated?: ((() => void) | (() => void)[]) | undefined;
182
+ activated?: ((() => void) | (() => void)[]) | undefined;
183
+ deactivated?: ((() => void) | (() => void)[]) | undefined;
184
+ beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
185
+ beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
186
+ destroyed?: ((() => void) | (() => void)[]) | undefined;
187
+ unmounted?: ((() => void) | (() => void)[]) | undefined;
188
+ renderTracked?: (((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[]) | undefined;
189
+ renderTriggered?: (((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[]) | undefined;
190
+ errorCaptured?: (((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
191
+ };
192
+ $forceUpdate: () => void;
193
+ $nextTick: typeof nextTick;
194
+ $watch(source: string | Function, cb: Function, options?: WatchOptions<boolean> | undefined): WatchStopHandle;
195
+ } & Readonly<ExtractPropTypes<{
196
+ model: ObjectConstructor;
197
+ rules: PropType<Partial<Record<string, FormItemRule | FormItemRule[]>>>;
198
+ labelPosition: StringConstructor;
199
+ labelWidth: {
200
+ type: (StringConstructor | NumberConstructor)[];
201
+ default: string;
202
+ };
203
+ labelSuffix: {
204
+ type: StringConstructor;
205
+ default: string;
206
+ };
207
+ inline: BooleanConstructor;
208
+ inlineMessage: BooleanConstructor;
209
+ statusIcon: BooleanConstructor;
210
+ showMessage: {
211
+ type: BooleanConstructor;
212
+ default: boolean;
213
+ };
214
+ size: PropType<"small" | "default" | "large">;
215
+ disabled: BooleanConstructor;
216
+ validateOnRuleChange: {
217
+ type: BooleanConstructor;
218
+ default: boolean;
219
+ };
220
+ hideRequiredAsterisk: {
221
+ type: BooleanConstructor;
222
+ default: boolean;
223
+ };
224
+ scrollToError: BooleanConstructor;
225
+ }>> & {
226
+ onValidate?: ((...args: any[]) => any) | undefined;
227
+ } & ShallowUnwrapRef<{
228
+ formKls: ComputedRef<string[]>;
229
+ validate: (callback?: Callback | undefined) => Promise<boolean> | undefined;
230
+ resetFields: () => void;
231
+ clearValidate: (props?: string | string[] | undefined) => void;
232
+ validateField: (props: string | string[], cb: ValidateFieldCallback) => void;
233
+ scrollToField: (prop: string) => void;
234
+ }> & {} & {} & ComponentCustomProperties) | undefined>;
235
+ formState: FormState;
236
+ changeHandler: () => void;
237
+ resetForm: () => void | undefined;
238
+ submitForm: (native?: boolean | undefined) => Promise<any>;
239
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("change" | "field-input" | "field-change")[], "change" | "field-input" | "field-change", VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes<{
240
+ initValues: {
241
+ type: ObjectConstructor;
242
+ required: true;
243
+ default: () => {};
244
+ };
245
+ parentValues: {
246
+ type: ObjectConstructor;
247
+ default: () => {};
248
+ };
249
+ config: {
250
+ type: PropType<FormConfig>;
251
+ required: true;
252
+ default: () => never[];
253
+ };
254
+ labelWidth: {
255
+ type: StringConstructor;
256
+ default: () => string;
257
+ };
258
+ disabled: {
259
+ type: BooleanConstructor;
260
+ default: () => boolean;
261
+ };
262
+ height: {
263
+ type: StringConstructor;
264
+ default: () => string;
265
+ };
266
+ stepActive: {
267
+ type: (StringConstructor | NumberConstructor)[];
268
+ default: () => number;
269
+ };
270
+ size: {
271
+ type: StringConstructor;
272
+ };
273
+ inline: {
274
+ type: BooleanConstructor;
275
+ default: boolean;
276
+ };
277
+ labelPosition: {
278
+ type: StringConstructor;
279
+ default: string;
280
+ };
281
+ keyProp: {
282
+ type: StringConstructor;
283
+ default: string;
284
+ };
285
+ }>> & {
286
+ onChange?: ((...args: any[]) => any) | undefined;
287
+ "onField-input"?: ((...args: any[]) => any) | undefined;
288
+ "onField-change"?: ((...args: any[]) => any) | undefined;
289
+ }, {
290
+ initValues: Record<string, any>;
291
+ parentValues: Record<string, any>;
292
+ config: FormConfig;
293
+ labelWidth: string;
294
+ disabled: boolean;
295
+ height: string;
296
+ stepActive: string | number;
297
+ inline: boolean;
298
+ labelPosition: string;
299
+ keyProp: string;
300
+ }>;
301
+ export default _default;