@tmagic/form 1.2.0-beta.2 → 1.2.0-beta.3
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.
- package/dist/tmagic-form.mjs +2081 -2500
- package/dist/tmagic-form.mjs.map +1 -1
- package/dist/tmagic-form.umd.js +2104 -2524
- package/dist/tmagic-form.umd.js.map +1 -1
- package/package.json +3 -4
- package/src/Form.vue +116 -159
- package/src/FormDialog.vue +104 -126
- package/src/containers/Col.vue +22 -38
- package/src/containers/Container.vue +135 -171
- package/src/containers/Fieldset.vue +11 -7
- package/src/containers/GroupList.vue +80 -112
- package/src/containers/GroupListItem.vue +87 -124
- package/src/containers/Panel.vue +26 -49
- package/src/containers/Row.vue +18 -40
- package/src/containers/Step.vue +36 -48
- package/src/containers/Table.vue +437 -478
- package/src/containers/Tabs.vue +89 -118
- package/src/fields/Cascader.vue +88 -136
- package/src/fields/Checkbox.vue +46 -50
- package/src/fields/CheckboxGroup.vue +39 -35
- package/src/fields/ColorPicker.vue +4 -2
- package/src/fields/Date.vue +20 -26
- package/src/fields/DateTime.vue +31 -39
- package/src/fields/Daterange.vue +3 -2
- package/src/fields/DynamicField.vue +63 -77
- package/src/fields/Link.vue +65 -86
- package/src/fields/Number.vue +32 -34
- package/src/fields/RadioGroup.vue +23 -23
- package/src/fields/Select.vue +294 -310
- package/src/fields/SelectOptionGroups.vue +10 -5
- package/src/fields/SelectOptions.vue +4 -2
- package/src/fields/Switch.vue +46 -49
- package/src/fields/Text.vue +99 -107
- package/src/fields/Textarea.vue +32 -44
- package/src/fields/Time.vue +19 -30
- package/src/index.ts +22 -23
- package/src/schema.ts +45 -12
- package/types/Form.vue.d.ts +213 -111
- package/types/FormDialog.vue.d.ts +812 -155
- package/types/containers/Col.vue.d.ts +94 -40
- package/types/containers/Container.vue.d.ts +124 -65
- package/types/containers/GroupList.vue.d.ts +88 -53
- package/types/containers/GroupListItem.vue.d.ts +99 -67
- package/types/containers/Panel.vue.d.ts +92 -39
- package/types/containers/Row.vue.d.ts +94 -39
- package/types/containers/Step.vue.d.ts +104 -42
- package/types/containers/Table.vue.d.ts +157 -130
- package/types/containers/Tabs.vue.d.ts +95 -50
- package/types/fields/Cascader.vue.d.ts +97 -71
- package/types/fields/Checkbox.vue.d.ts +97 -56
- package/types/fields/CheckboxGroup.vue.d.ts +97 -53
- package/types/fields/Date.vue.d.ts +97 -54
- package/types/fields/DateTime.vue.d.ts +97 -54
- package/types/fields/DynamicField.vue.d.ts +97 -64
- package/types/fields/Link.vue.d.ts +62 -657
- package/types/fields/Number.vue.d.ts +101 -56
- package/types/fields/RadioGroup.vue.d.ts +98 -52
- package/types/fields/Select.vue.d.ts +99 -65
- package/types/fields/Switch.vue.d.ts +97 -56
- package/types/fields/Text.vue.d.ts +100 -57
- package/types/fields/Textarea.vue.d.ts +102 -60
- package/types/fields/Time.vue.d.ts +97 -55
- package/types/index.d.ts +0 -1
- package/types/schema.d.ts +37 -9
- package/src/utils/fieldProps.ts +0 -39
- package/types/utils/fieldProps.d.ts +0 -21
|
@@ -1,58 +1,100 @@
|
|
|
1
|
-
import { PropType } from 'vue';
|
|
2
1
|
import { TimeConfig } from '../schema';
|
|
3
|
-
declare const _default:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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<{
|
|
78
|
+
config: TimeConfig;
|
|
79
|
+
model: any;
|
|
80
|
+
initValues?: any;
|
|
81
|
+
values?: any;
|
|
54
82
|
name: string;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
83
|
+
prop: string;
|
|
84
|
+
disabled?: boolean | undefined;
|
|
85
|
+
size: 'mini' | 'small' | 'medium';
|
|
86
|
+
}>>> & {
|
|
87
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
88
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
|
|
89
|
+
$slots: {};
|
|
90
|
+
});
|
|
58
91
|
export default _default;
|
|
92
|
+
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
93
|
+
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
94
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
95
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
96
|
+
} : {
|
|
97
|
+
type: import('vue').PropType<T[K]>;
|
|
98
|
+
required: true;
|
|
99
|
+
};
|
|
100
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import './theme/index.scss';
|
|
|
3
3
|
export * from './schema';
|
|
4
4
|
export * from './utils/form';
|
|
5
5
|
export * from './utils/useAddField';
|
|
6
|
-
export { default as fieldProps } from './utils/fieldProps';
|
|
7
6
|
export { default as MForm } from './Form.vue';
|
|
8
7
|
export { default as MFormDialog } from './FormDialog.vue';
|
|
9
8
|
export { default as MContainer } from './containers/Container.vue';
|
package/types/schema.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export interface ValidateError {
|
|
2
|
+
message: string;
|
|
3
|
+
field: string;
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* 整个表单的数据,会注入到各个组件中去
|
|
3
7
|
*/
|
|
@@ -121,7 +125,7 @@ declare type DefaultValueFunction = (mForm: FormState | undefined) => any;
|
|
|
121
125
|
/**
|
|
122
126
|
* 下拉选择器选项配置
|
|
123
127
|
*/
|
|
124
|
-
export interface
|
|
128
|
+
export interface SelectConfigOption {
|
|
125
129
|
/** 选项的标签 */
|
|
126
130
|
text: string | SelectOptionTextFunction;
|
|
127
131
|
/** 选项的值 */
|
|
@@ -129,10 +133,18 @@ export interface SelectOption {
|
|
|
129
133
|
/** 是否禁用该选项 */
|
|
130
134
|
disabled?: boolean;
|
|
131
135
|
}
|
|
136
|
+
export interface SelectOption {
|
|
137
|
+
/** 选项的标签 */
|
|
138
|
+
text: string;
|
|
139
|
+
/** 选项的值 */
|
|
140
|
+
value: any;
|
|
141
|
+
/** 是否禁用该选项 */
|
|
142
|
+
disabled?: boolean;
|
|
143
|
+
}
|
|
132
144
|
/**
|
|
133
145
|
* 下拉选择器分组选项配置
|
|
134
146
|
*/
|
|
135
|
-
export interface
|
|
147
|
+
export interface SelectConfigGroupOption {
|
|
136
148
|
/** 分组的组名 */
|
|
137
149
|
label: string;
|
|
138
150
|
/** 是否禁用该选项组 */
|
|
@@ -146,6 +158,21 @@ export interface SelectGroupOption {
|
|
|
146
158
|
disabled?: boolean;
|
|
147
159
|
}[];
|
|
148
160
|
}
|
|
161
|
+
export interface SelectGroupOption {
|
|
162
|
+
/** 分组的组名 */
|
|
163
|
+
label: string;
|
|
164
|
+
/** 是否禁用该选项组 */
|
|
165
|
+
disabled: boolean;
|
|
166
|
+
options: {
|
|
167
|
+
/** 选项的标签 */
|
|
168
|
+
label?: string;
|
|
169
|
+
text?: string;
|
|
170
|
+
/** 选项的值 */
|
|
171
|
+
value: any;
|
|
172
|
+
/** 是否禁用该选项 */
|
|
173
|
+
disabled?: boolean;
|
|
174
|
+
}[];
|
|
175
|
+
}
|
|
149
176
|
declare type SelectOptionFunction = (mForm: FormState | undefined, data: {
|
|
150
177
|
model: any;
|
|
151
178
|
prop?: string;
|
|
@@ -165,10 +192,10 @@ declare type RemoteSelectOptionRequestFunction = (mForm: FormState | undefined,
|
|
|
165
192
|
formValues: any;
|
|
166
193
|
config: any;
|
|
167
194
|
}) => any;
|
|
168
|
-
declare type RemoteSelectOptionItemFunction = (optionsData: Record<string, any>) => SelectOption[];
|
|
195
|
+
declare type RemoteSelectOptionItemFunction = (optionsData: Record<string, any>) => SelectOption[] | SelectGroupOption[];
|
|
169
196
|
declare type SelectOptionValueFunction = (item: Record<string, any>) => any;
|
|
170
197
|
declare type SelectOptionTextFunction = (item: Record<string, any>) => string;
|
|
171
|
-
interface CascaderOption {
|
|
198
|
+
export interface CascaderOption {
|
|
172
199
|
/** 指定选项的值为选项对象的某个属性值 */
|
|
173
200
|
value: any;
|
|
174
201
|
/** 指定选项标签为选项对象的某个属性值 */
|
|
@@ -229,7 +256,7 @@ export interface NumberConfig extends FormItem {
|
|
|
229
256
|
min?: number;
|
|
230
257
|
max?: number;
|
|
231
258
|
step?: number;
|
|
232
|
-
placeholder?:
|
|
259
|
+
placeholder?: string;
|
|
233
260
|
}
|
|
234
261
|
/**
|
|
235
262
|
* 隐藏域
|
|
@@ -281,7 +308,7 @@ export interface SwitchConfig extends FormItem {
|
|
|
281
308
|
export interface RadioGroupConfig extends FormItem {
|
|
282
309
|
type: 'radio-group';
|
|
283
310
|
options: {
|
|
284
|
-
|
|
311
|
+
value: string | number | boolean;
|
|
285
312
|
text: string;
|
|
286
313
|
}[];
|
|
287
314
|
}
|
|
@@ -299,7 +326,8 @@ export interface CheckboxGroupConfig extends FormItem {
|
|
|
299
326
|
options: {
|
|
300
327
|
value: any;
|
|
301
328
|
text: string;
|
|
302
|
-
|
|
329
|
+
disabled?: boolean;
|
|
330
|
+
}[] | Function;
|
|
303
331
|
}
|
|
304
332
|
/**
|
|
305
333
|
* 下拉选择器
|
|
@@ -311,7 +339,7 @@ export interface SelectConfig extends FormItem, Input {
|
|
|
311
339
|
valueKey?: string;
|
|
312
340
|
allowCreate?: boolean;
|
|
313
341
|
group?: boolean;
|
|
314
|
-
options:
|
|
342
|
+
options: SelectConfigOption[] | SelectConfigGroupOption[] | SelectOptionFunction;
|
|
315
343
|
remote: true;
|
|
316
344
|
option: {
|
|
317
345
|
url: string;
|
|
@@ -416,7 +444,7 @@ export interface TabPaneConfig {
|
|
|
416
444
|
}
|
|
417
445
|
export interface TabConfig extends FormItem, ContainerCommonConfig {
|
|
418
446
|
type: 'tab' | 'dynamic-tab';
|
|
419
|
-
tabType?:
|
|
447
|
+
tabType?: string;
|
|
420
448
|
editable?: boolean;
|
|
421
449
|
dynamic?: boolean;
|
|
422
450
|
tabPosition?: 'top' | 'right' | 'bottom' | 'left';
|
package/src/utils/fieldProps.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Tencent is pleased to support the open source community by making TMagicEditor available.
|
|
3
|
-
*
|
|
4
|
-
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { PropType } from 'vue';
|
|
20
|
-
|
|
21
|
-
export default {
|
|
22
|
-
model: {
|
|
23
|
-
type: Object,
|
|
24
|
-
required: true,
|
|
25
|
-
default: () => ({}),
|
|
26
|
-
},
|
|
27
|
-
name: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: '',
|
|
30
|
-
},
|
|
31
|
-
disabled: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
default: false,
|
|
34
|
-
},
|
|
35
|
-
size: String as PropType<'mini' | 'small' | 'medium'>,
|
|
36
|
-
prop: String,
|
|
37
|
-
initValues: Object,
|
|
38
|
-
values: Object,
|
|
39
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
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;
|