@tmagic/form 1.0.0-beta.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 (94) hide show
  1. package/dist/style.css +161 -0
  2. package/dist/tmagic-form.es.js +3749 -0
  3. package/dist/tmagic-form.es.js.map +1 -0
  4. package/dist/tmagic-form.umd.js +3790 -0
  5. package/dist/tmagic-form.umd.js.map +1 -0
  6. package/dist/types/src/Form.vue.d.ts +304 -0
  7. package/dist/types/src/FormDialog.vue.d.ts +641 -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 +1401 -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 +1365 -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 +51 -0
  43. package/src/Form.vue +188 -0
  44. package/src/FormDialog.vue +163 -0
  45. package/src/containers/Container.vue +263 -0
  46. package/src/containers/Fieldset.vue +138 -0
  47. package/src/containers/GroupList.vue +152 -0
  48. package/src/containers/GroupListItem.vue +159 -0
  49. package/src/containers/Panel.vue +106 -0
  50. package/src/containers/Row.vue +68 -0
  51. package/src/containers/Step.vue +82 -0
  52. package/src/containers/Table.vue +624 -0
  53. package/src/containers/Tabs.vue +176 -0
  54. package/src/fields/Cascader.vue +147 -0
  55. package/src/fields/Checkbox.vue +67 -0
  56. package/src/fields/CheckboxGroup.vue +44 -0
  57. package/src/fields/ColorPicker.vue +38 -0
  58. package/src/fields/Date.vue +51 -0
  59. package/src/fields/DateTime.vue +59 -0
  60. package/src/fields/Daterange.vue +75 -0
  61. package/src/fields/Display.vue +34 -0
  62. package/src/fields/DynamicField.vue +109 -0
  63. package/src/fields/Hidden.vue +29 -0
  64. package/src/fields/Link.vue +112 -0
  65. package/src/fields/Number.vue +53 -0
  66. package/src/fields/RadioGroup.vue +33 -0
  67. package/src/fields/Select.vue +393 -0
  68. package/src/fields/Switch.vue +65 -0
  69. package/src/fields/Text.vue +134 -0
  70. package/src/fields/Textarea.vue +62 -0
  71. package/src/fields/Time.vue +48 -0
  72. package/src/index.ts +127 -0
  73. package/src/schema.ts +638 -0
  74. package/src/shims-vue.d.ts +6 -0
  75. package/src/theme/date-time.scss +7 -0
  76. package/src/theme/fieldset.scss +24 -0
  77. package/src/theme/form-dialog.scss +13 -0
  78. package/src/theme/form.scss +30 -0
  79. package/src/theme/group-list.scss +23 -0
  80. package/src/theme/index.scss +9 -0
  81. package/src/theme/link.scss +3 -0
  82. package/src/theme/panel.scss +18 -0
  83. package/src/theme/select.scss +3 -0
  84. package/src/theme/table.scss +69 -0
  85. package/src/theme/tabs.scss +25 -0
  86. package/src/utils/config.ts +27 -0
  87. package/src/utils/containerProps.ts +50 -0
  88. package/src/utils/createForm.ts +25 -0
  89. package/src/utils/fieldProps.ts +39 -0
  90. package/src/utils/form.ts +266 -0
  91. package/src/utils/useAddField.ts +40 -0
  92. package/src/vite-env.d.ts +1 -0
  93. package/tsconfig.json +9 -0
  94. package/vite.config.ts +27 -0
@@ -0,0 +1,495 @@
1
+ /**
2
+ * 整个表单的数据,会注入到各个组件中去
3
+ */
4
+ export declare type FormState = {
5
+ config: FormConfig;
6
+ initValues: FormValue;
7
+ values: FormValue;
8
+ $emit: (event: string, ...args: any[]) => void;
9
+ keyProp?: string;
10
+ parentValues?: FormValue;
11
+ setField: (prop: string, field: any) => void;
12
+ getField: (prop: string) => any;
13
+ deleteField: (prop: string) => any;
14
+ [key: string]: any;
15
+ };
16
+ /**
17
+ * 排序配置
18
+ */
19
+ export interface SortProp {
20
+ /** 跟该值排序 */
21
+ prop: string;
22
+ order: 'ascending' | 'descending';
23
+ }
24
+ export interface FormItem {
25
+ /** vnode的key值,默认是遍历数组时的index */
26
+ __key?: string | number;
27
+ /** 表单域标签的的宽度,例如 '50px'。支持 auto。 */
28
+ labelWidth?: string;
29
+ className?: string;
30
+ /** 表单组件类型 */
31
+ type?: string | TypeFunction;
32
+ /** 字段名 */
33
+ name?: string | number;
34
+ /** 额外的提示信息,和 help 类似,当提示文案同时出现时,可以使用这个。 */
35
+ extra?: string | FilterFunction;
36
+ /** 配置提示信息 */
37
+ tooltip?: string | FilterFunction;
38
+ /** 是否置灰 */
39
+ disabled?: boolean | FilterFunction;
40
+ /** 使用表单中的值作为key,例如配置了text,则使用model.text作为key */
41
+ key?: string;
42
+ /** 是否显示 */
43
+ display?: boolean | 'expand' | FilterFunction;
44
+ /** 值发生改变时调用的方法 */
45
+ onChange?: OnChangeHandler;
46
+ /** label 标签的文本 */
47
+ text?: string;
48
+ /** 右侧感叹号 */
49
+ tip?: string;
50
+ filter?: 'number' | OnChangeHandler;
51
+ /** 是否去除首尾空格 */
52
+ trim?: boolean;
53
+ /** 默认值 */
54
+ defaultValue?: any | DefaultValueFunction;
55
+ /** 表单验证规则 */
56
+ rules?: Rule[];
57
+ extensible?: boolean;
58
+ dynamicKey?: string;
59
+ /** 是否需要显示`展开更多配置` */
60
+ expand?: boolean;
61
+ }
62
+ export interface ContainerCommonConfig {
63
+ items: FormConfig;
64
+ onInitValue?: (mForm: FormState | undefined, data: {
65
+ formValue: FormValue;
66
+ initValue: FormValue;
67
+ }) => FormValue;
68
+ extensible?: boolean;
69
+ }
70
+ export interface Rule {
71
+ message?: string;
72
+ /** 系统提供的验证器类型。有:string,number,boolean,method,regexp,integer,float,array,object,enum,date,url,hex,email,any */
73
+ type: string;
74
+ /** 是否必填 */
75
+ required?: boolean;
76
+ /** 自定义验证器 */
77
+ validator?: (options: {
78
+ rule: string;
79
+ value: any;
80
+ callback: Function;
81
+ source: Object;
82
+ options: {
83
+ messages: string;
84
+ };
85
+ }, data: {
86
+ /** 表单的初始值 */
87
+ values: FormValue;
88
+ /** 当前作用域下的值 */
89
+ model: FormValue;
90
+ parent: FormValue;
91
+ /** 整个表单的值 */
92
+ formValue: FormValue;
93
+ prop: string;
94
+ }, mForm: FormState | undefined) => void;
95
+ }
96
+ export interface Input {
97
+ /** 输入框没有内容时显示的文案 */
98
+ placeholder?: string;
99
+ }
100
+ export declare type TypeFunction = (mForm: FormState | undefined, data: {
101
+ model: Record<any, any>;
102
+ }) => string;
103
+ declare type FilterFunction = (mForm: FormState | undefined, data: {
104
+ model: Record<any, any>;
105
+ values: Record<any, any>;
106
+ parent?: Record<any, any>;
107
+ formValue: Record<any, any>;
108
+ prop: string;
109
+ }) => boolean;
110
+ declare type OnChangeHandler = (mForm: FormState | undefined, value: any, data: {
111
+ model: Record<any, any>;
112
+ values: Record<any, any>;
113
+ parent?: Record<any, any>;
114
+ formValue: Record<any, any>;
115
+ }) => any;
116
+ declare type DefaultValueFunction = (mForm: FormState | undefined) => any;
117
+ /**
118
+ * 下拉选择器选项配置
119
+ */
120
+ export interface SelectOption {
121
+ /** 选项的标签 */
122
+ text: string | SelectOptionTextFunction;
123
+ /** 选项的值 */
124
+ value: any | SelectOptionValueFunction;
125
+ /** 是否禁用该选项 */
126
+ disabled?: boolean;
127
+ }
128
+ /**
129
+ * 下拉选择器分组选项配置
130
+ */
131
+ export interface SelectGroupOption {
132
+ /** 分组的组名 */
133
+ label: string;
134
+ /** 是否禁用该选项组 */
135
+ disabled: boolean;
136
+ options: SelectOption[];
137
+ }
138
+ declare type SelectOptionFunction = (mForm: FormState | undefined, data: {
139
+ model: any;
140
+ formValues: any;
141
+ formValue: any;
142
+ }) => SelectOption[] | SelectGroupOption[];
143
+ declare type RemoteSelectOptionBodyFunction = (mForm: FormState | undefined, data: {
144
+ model: any;
145
+ formValue: any;
146
+ formValues: any;
147
+ }) => Record<string, any>;
148
+ declare type RemoteSelectOptionRequestFunction = (mForm: FormState | undefined, res: any, data: {
149
+ model: any;
150
+ formValue: any;
151
+ formValues: any;
152
+ }) => any;
153
+ declare type RemoteSelectOptionItemFunction = (optionsData: Record<string, any>) => SelectOption[];
154
+ declare type SelectOptionValueFunction = (item: Record<string, any>) => any;
155
+ declare type SelectOptionTextFunction = (item: Record<string, any>) => string;
156
+ interface CascaderOption {
157
+ /** 指定选项的值为选项对象的某个属性值 */
158
+ value: any;
159
+ /** 指定选项标签为选项对象的某个属性值 */
160
+ label: string;
161
+ /** 指定选项的子选项为选项对象的某个属性值 */
162
+ children?: CascaderOption[];
163
+ }
164
+ /**
165
+ * 日期范围
166
+ */
167
+ export interface DaterangeConfig extends FormItem {
168
+ type: 'daterange';
169
+ names?: string[];
170
+ }
171
+ /**
172
+ * html编辑器
173
+ */
174
+ export interface HtmlField extends FormItem {
175
+ type: 'html';
176
+ /** 是否异步加载编辑的内容 */
177
+ asyncLoad?: {
178
+ name: string | number;
179
+ };
180
+ }
181
+ /** 展示文本,不可编辑 */
182
+ export interface DisplayConfig extends FormItem {
183
+ type: 'display';
184
+ initValue?: string | number | boolean;
185
+ }
186
+ /** 文本输入框 */
187
+ export interface TextConfig extends FormItem, Input {
188
+ type?: 'text';
189
+ tooltip?: string;
190
+ /** 后置元素,一般为标签或按钮 */
191
+ append?: string | {
192
+ text: string;
193
+ type: 'button';
194
+ handler: (mForm: FormState | undefined, data: {
195
+ model: any;
196
+ values: any;
197
+ }) => void;
198
+ };
199
+ }
200
+ /**
201
+ * 文本域
202
+ */
203
+ export interface TextareaConfig extends FormItem {
204
+ type: 'textarea';
205
+ placeholder?: string;
206
+ }
207
+ /**
208
+ * 计数器
209
+ */
210
+ export interface NumberConfig extends FormItem {
211
+ type?: 'number';
212
+ tooltip?: string;
213
+ min?: number;
214
+ max?: number;
215
+ step?: number;
216
+ placeholder?: number;
217
+ }
218
+ /**
219
+ * 隐藏域
220
+ */
221
+ export interface HiddenConfig extends FormItem {
222
+ type: 'hidden';
223
+ }
224
+ /**
225
+ * 日期选择器
226
+ */
227
+ export interface DateConfig extends FormItem, Input {
228
+ type: 'date';
229
+ format?: 'YYYY-MM-dd HH:mm:ss' | string;
230
+ }
231
+ /**
232
+ * 日期时间选择器
233
+ */
234
+ export interface DateTimeConfig extends FormItem, Input {
235
+ type: 'datetime';
236
+ format?: 'YYYY-MM-dd HH:mm:ss' | string;
237
+ valueFormat?: 'YYYY-MM-dd HH:mm:ss' | string;
238
+ }
239
+ /**
240
+ * 时间选择器
241
+ */
242
+ export interface TimeConfig extends FormItem, Input {
243
+ type: 'time';
244
+ }
245
+ /**
246
+ * 单个多选框
247
+ */
248
+ export interface CheckboxConfig extends FormItem {
249
+ type: 'checkbox';
250
+ activeValue?: boolean | number | string;
251
+ inactiveValue?: boolean | number | string;
252
+ }
253
+ /**
254
+ * 开关
255
+ */
256
+ export interface SwitchConfig extends FormItem {
257
+ type: 'switch';
258
+ activeValue?: boolean | number | string;
259
+ inactiveValue?: boolean | number | string;
260
+ }
261
+ /**
262
+ * 单选框
263
+ */
264
+ export interface RadioGroupConfig extends FormItem {
265
+ type: 'radio-group';
266
+ options: {
267
+ values: string | number | boolean;
268
+ text: string;
269
+ }[];
270
+ }
271
+ /**
272
+ * 颜色选择器
273
+ */
274
+ export interface ColorPickConfig extends FormItem {
275
+ type: 'colorPicker';
276
+ }
277
+ /**
278
+ * 多选框组
279
+ */
280
+ export interface CheckboxGroupConfig extends FormItem {
281
+ type: 'checkbox-group';
282
+ options: {
283
+ value: any;
284
+ text: string;
285
+ }[];
286
+ }
287
+ /**
288
+ * 下拉选择器
289
+ */
290
+ export interface SelectConfig extends FormItem, Input {
291
+ type: 'select';
292
+ clearable?: boolean;
293
+ multiple?: boolean;
294
+ valueKey?: string;
295
+ allowCreate?: boolean;
296
+ group?: boolean;
297
+ options: SelectOption[] | SelectGroupOption[] | SelectOptionFunction;
298
+ remote: true;
299
+ option: {
300
+ url: string;
301
+ initUrl?: string | ((mForm: FormState | undefined, data: {
302
+ model: any;
303
+ formValue: any;
304
+ }) => string);
305
+ method?: 'jsonp' | string;
306
+ cache?: boolean;
307
+ timeout?: number;
308
+ mode?: string;
309
+ headers?: {
310
+ [key: string]: string;
311
+ };
312
+ json?: false | boolean;
313
+ body?: Record<string, any> | RemoteSelectOptionBodyFunction;
314
+ jsonpCallback?: 'callback' | string;
315
+ afterRequest?: RemoteSelectOptionRequestFunction;
316
+ beforeRequest?: (mForm: FormState | undefined, postOptions: Record<string, any>, data: any) => Record<string, any>;
317
+ root: string;
318
+ item?: RemoteSelectOptionItemFunction;
319
+ value: string | SelectOptionValueFunction;
320
+ text: string | SelectOptionTextFunction;
321
+ };
322
+ }
323
+ /**
324
+ * 链接
325
+ */
326
+ export interface LinkConfig extends FormItem {
327
+ type: 'link';
328
+ href?: string | ((model: Record<string, any>) => string);
329
+ css?: {
330
+ [key: string]: string | number;
331
+ };
332
+ disabledCss?: {
333
+ [key: string]: string | number;
334
+ };
335
+ formTitle?: string;
336
+ formWidth?: number | string;
337
+ displayText?: ((mForm: FormState | undefined, data: {
338
+ model: Record<any, any>;
339
+ }) => string) | string;
340
+ form: FormConfig | ((mForm: FormState | undefined, data: {
341
+ model: Record<any, any>;
342
+ values: Record<any, any>;
343
+ }) => FormConfig);
344
+ fullscreen?: boolean;
345
+ }
346
+ /**
347
+ * 级联选择器
348
+ */
349
+ export interface CascaderConfig extends FormItem, Input {
350
+ type: 'cascader';
351
+ remote?: boolean;
352
+ multiple?: boolean;
353
+ options?: ((mForm: FormState | undefined, data: {
354
+ model: Record<any, any>;
355
+ formValues: Record<any, any>;
356
+ }) => CascaderOption[]) | CascaderOption[];
357
+ option?: {
358
+ url: string;
359
+ cache?: boolean;
360
+ timeout?: number;
361
+ body?: Record<string, any> | RemoteSelectOptionBodyFunction;
362
+ root: 'string';
363
+ item: (optionsData: Record<string, any>) => CascaderOption[];
364
+ };
365
+ add?: {
366
+ action: {
367
+ method: 'post' | 'get';
368
+ body?: Record<string, any>;
369
+ };
370
+ };
371
+ }
372
+ export interface DynamicFieldConfig extends FormItem {
373
+ type: 'dynamic-field';
374
+ returnFields: (config: DynamicFieldConfig, model: Record<any, any>, request: Object) => {
375
+ name: string;
376
+ label: string;
377
+ defaultValue: string;
378
+ }[];
379
+ dynamicKey: string;
380
+ }
381
+ /**
382
+ * 分组容器
383
+ */
384
+ export interface RowConfig extends FormItem, ContainerCommonConfig {
385
+ type: 'row';
386
+ span: number;
387
+ }
388
+ /**
389
+ * 标签页容器
390
+ */
391
+ export interface TabPaneConfig {
392
+ status?: string;
393
+ title: string;
394
+ lazy?: boolean;
395
+ labelWidth?: string;
396
+ items: FormConfig;
397
+ }
398
+ export interface TabConfig extends FormItem, ContainerCommonConfig {
399
+ type: 'tab' | 'dynamic-tab';
400
+ tabType?: 'tab';
401
+ editable?: boolean;
402
+ dynamic?: boolean;
403
+ tabPosition?: 'top' | 'right' | 'bottom' | 'left';
404
+ items: TabPaneConfig[];
405
+ onChange?: (mForm: FormState | undefined, data: any) => void;
406
+ onTabAdd?: (mForm: FormState | undefined, data: any) => void;
407
+ onTabRemove?: (mForm: FormState | undefined, tabName: string, data: any) => void;
408
+ activeChange?: (mForm: FormState | undefined, tabName: string, data: any) => void;
409
+ }
410
+ /**
411
+ * 分组
412
+ */
413
+ export interface FieldsetConfig extends FormItem, ContainerCommonConfig {
414
+ type: 'fieldset';
415
+ checkbox?: boolean;
416
+ expand?: boolean;
417
+ legend?: string;
418
+ schematic?: string;
419
+ }
420
+ /**
421
+ * 面板容器
422
+ */
423
+ export interface PanelConfig extends FormItem, ContainerCommonConfig {
424
+ type: 'panel';
425
+ expand?: boolean;
426
+ title?: string;
427
+ schematic?: string;
428
+ }
429
+ export interface ColumnConfig extends FormItem, ContainerCommonConfig {
430
+ name: string;
431
+ label: string;
432
+ width: string | number;
433
+ sortable: boolean;
434
+ }
435
+ /**
436
+ * 表格容器
437
+ */
438
+ export interface TableConfig extends FormItem {
439
+ type: 'table' | 'groupList' | 'group-list';
440
+ items: ColumnConfig[];
441
+ tableItems?: ColumnConfig[];
442
+ groupItems?: ColumnConfig[];
443
+ enableToggleMode?: boolean;
444
+ max?: number;
445
+ maxHeight?: number | string;
446
+ border?: boolean;
447
+ enum?: any[];
448
+ addable?: (mForm: FormState | undefined, data: any) => boolean | 'undefined' | boolean;
449
+ delete?: (model: any, index: number, values: any) => boolean | boolean;
450
+ importable?: (mForm: FormState | undefined, data: any) => boolean | 'undefined' | boolean;
451
+ selection?: (mForm: FormState | undefined, data: any) => boolean | boolean | 'single';
452
+ defaultAdd?: (mForm: FormState | undefined, data: any) => any;
453
+ onSelect?: (mForm: FormState | undefined, data: any) => any;
454
+ defautSort?: SortProp;
455
+ dropSort?: boolean;
456
+ enableFullscreen?: boolean;
457
+ fixed?: boolean;
458
+ itemExtra?: string | FilterFunction;
459
+ }
460
+ export interface GroupListConfig extends FormItem {
461
+ type: 'table' | 'groupList' | 'group-list';
462
+ span?: number;
463
+ enableToggleMode?: boolean;
464
+ items: FormConfig;
465
+ groupItems?: FormConfig;
466
+ tableItems?: FormConfig;
467
+ titleKey?: string;
468
+ itemExtra?: string | FilterFunction;
469
+ addable?: (mForm: FormState | undefined, data: any) => boolean | 'undefined' | boolean;
470
+ defaultAdd?: (mForm: FormState | undefined, data: any) => any;
471
+ delete?: (model: any, index: number | string | symbol, values: any) => boolean | boolean;
472
+ movable?: (mForm: FormState | undefined, index: number | string | symbol, model: any, groupModel: any) => boolean | boolean;
473
+ [key: string]: any;
474
+ }
475
+ interface StepItemConfig extends FormItem, ContainerCommonConfig {
476
+ title: string;
477
+ }
478
+ export interface StepConfig extends FormItem {
479
+ type: 'step';
480
+ /** 每个 step 的间距,不填写将自适应间距。支持百分比。 */
481
+ space?: string | number;
482
+ items: StepItemConfig[];
483
+ }
484
+ export interface ComponentConfig extends FormItem {
485
+ type: 'component';
486
+ id: string;
487
+ extend: any;
488
+ display: any;
489
+ }
490
+ export declare type ChildConfig = FormItem | TabConfig | RowConfig | FieldsetConfig | PanelConfig | TableConfig | GroupListConfig | StepConfig | DisplayConfig | TextConfig | HiddenConfig | LinkConfig | DaterangeConfig | SelectConfig | CascaderConfig | HtmlField | DateConfig | ColorPickConfig | TimeConfig | DateTimeConfig | CheckboxConfig | SwitchConfig | RadioGroupConfig | TextareaConfig | DynamicFieldConfig | ComponentConfig;
491
+ export declare type FormConfig = (ChildConfig & {
492
+ [key: string]: any;
493
+ })[];
494
+ export declare type FormValue = Record<string | number, any>;
495
+ export {};
@@ -0,0 +1,6 @@
1
+ declare module '*.vue' {
2
+ import { DefineComponent } from 'vue';
3
+
4
+ const component: DefineComponent<{}, {}, any>;
5
+ export default component;
6
+ }
@@ -0,0 +1,3 @@
1
+ declare const setConfig: (option: any) => void;
2
+ declare const getConfig: (key: string) => unknown;
3
+ export { getConfig, setConfig };
@@ -0,0 +1,21 @@
1
+ import { PropType } from 'vue';
2
+ declare const _default: {
3
+ model: {
4
+ type: ObjectConstructor;
5
+ required: boolean;
6
+ default: () => {};
7
+ };
8
+ name: {
9
+ type: StringConstructor;
10
+ default: string;
11
+ };
12
+ disabled: {
13
+ type: BooleanConstructor;
14
+ default: boolean;
15
+ };
16
+ size: PropType<"small" | "mini" | "medium">;
17
+ prop: StringConstructor;
18
+ initValues: ObjectConstructor;
19
+ values: ObjectConstructor;
20
+ };
21
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { FormConfig, FormState, FormValue, Rule } from '../schema';
2
+ export declare const filterFunction: (mForm: FormState | undefined, config: any, props: any) => any;
3
+ export declare const display: (mForm: FormState | undefined, config: any, props: any) => any;
4
+ export declare const getRules: (mForm: FormState | undefined, rules: Rule | Rule[] | undefined, props: any) => Rule[];
5
+ export declare const initValue: (mForm: FormState | undefined, { initValues, config }: {
6
+ initValues: FormValue;
7
+ config: FormConfig;
8
+ }) => Promise<FormValue>;
@@ -0,0 +1 @@
1
+ export declare const useAddField: (prop?: string | undefined) => void;
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "version": "1.0.0-beta.1",
3
+ "name": "@tmagic/form",
4
+ "main": "dist/magic-form.umd.js",
5
+ "module": "dist/magic-form.es.js",
6
+ "style": "dist/style.css",
7
+ "types": "dist/types/src/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/magic-form.es.js",
11
+ "require": "./dist/magic-form.umd.js"
12
+ },
13
+ "./dist/style.css": {
14
+ "import": "./dist/style.css",
15
+ "require": "./dist/style.css"
16
+ }
17
+ },
18
+ "scripts": {
19
+ "build": "vite build"
20
+ },
21
+ "engines": {
22
+ "node": ">=14"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/Tencent/tmagic-editor.git"
27
+ },
28
+ "dependencies": {
29
+ "@element-plus/icons": "0.0.11",
30
+ "@tmagic/utils": "^1.0.0-beta.1",
31
+ "element-plus": "^2.0.2",
32
+ "lodash-es": "^4.17.21",
33
+ "moment": "^2.29.1",
34
+ "sortablejs": "^1.14.0",
35
+ "vue": "^3.2.0"
36
+ },
37
+ "devDependencies": {
38
+ "@types/lodash-es": "^4.17.4",
39
+ "@types/node": "^15.12.4",
40
+ "@types/sortablejs": "^1.10.7",
41
+ "@vitejs/plugin-vue": "^1.2.3",
42
+ "@vitejs/plugin-vue-jsx": "^1.1.6",
43
+ "@vue/compiler-sfc": "^3.2.0",
44
+ "@vue/test-utils": "^2.0.0-rc.12",
45
+ "sass": "^1.35.1",
46
+ "typescript": "^4.3.4",
47
+ "vite": "^2.3.7",
48
+ "vite-plugin-dts": "^0.9.6",
49
+ "vue-tsc": "^0.0.24"
50
+ }
51
+ }