@xiaohaih/json-form-vant 0.0.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.
- package/CHANGELOG.md +9 -0
- package/README.md +807 -0
- package/TODO.md +36 -0
- package/components/area/index.ts +6 -0
- package/components/area/index.vue +120 -0
- package/components/area/types.ts +84 -0
- package/components/cascader/index.ts +6 -0
- package/components/cascader/index.vue +146 -0
- package/components/cascader/types.ts +75 -0
- package/components/checkbox/index.ts +6 -0
- package/components/checkbox/index.vue +59 -0
- package/components/checkbox/types.ts +54 -0
- package/components/checkbox-group/index.ts +6 -0
- package/components/checkbox-group/index.vue +67 -0
- package/components/checkbox-group/types.ts +63 -0
- package/components/component-definition/components.ts +29 -0
- package/components/component-definition/definition.ts +25 -0
- package/components/component-definition/index.ts +4 -0
- package/components/custom-render/index.ts +6 -0
- package/components/custom-render/index.vue +66 -0
- package/components/custom-render/types.ts +43 -0
- package/components/date-picker/index.ts +6 -0
- package/components/date-picker/index.vue +130 -0
- package/components/date-picker/types.ts +91 -0
- package/components/date-time-picker-group/index.ts +6 -0
- package/components/date-time-picker-group/index.vue +158 -0
- package/components/date-time-picker-group/types.ts +115 -0
- package/components/datetime-picker/index.ts +6 -0
- package/components/datetime-picker/index.vue +128 -0
- package/components/datetime-picker/types.ts +78 -0
- package/components/dynamic-group/index.ts +10 -0
- package/components/dynamic-group/index.vue +140 -0
- package/components/dynamic-group/types.ts +68 -0
- package/components/group/assist.ts +99 -0
- package/components/group/index.ts +7 -0
- package/components/group/index.vue +117 -0
- package/components/group/types.ts +57 -0
- package/components/group/virtual-group.vue +38 -0
- package/components/index.ts +10 -0
- package/components/input/index.ts +6 -0
- package/components/input/index.vue +83 -0
- package/components/input/types.ts +43 -0
- package/components/input-slot/index.ts +6 -0
- package/components/input-slot/index.vue +148 -0
- package/components/input-slot/types.ts +34 -0
- package/components/number-keyboard/index.ts +6 -0
- package/components/number-keyboard/index.vue +81 -0
- package/components/number-keyboard/types.ts +57 -0
- package/components/password-input/index.ts +6 -0
- package/components/password-input/index.vue +103 -0
- package/components/password-input/types.ts +64 -0
- package/components/picker/index.ts +6 -0
- package/components/picker/index.vue +136 -0
- package/components/picker/types.ts +94 -0
- package/components/radio/index.ts +6 -0
- package/components/radio/index.vue +68 -0
- package/components/radio/types.ts +58 -0
- package/components/radio-group/index.ts +6 -0
- package/components/radio-group/index.vue +74 -0
- package/components/radio-group/types.ts +65 -0
- package/components/rate/index.ts +6 -0
- package/components/rate/index.vue +63 -0
- package/components/rate/types.ts +47 -0
- package/components/share.ts +78 -0
- package/components/signature/index.ts +6 -0
- package/components/signature/index.vue +65 -0
- package/components/signature/instance.vue +161 -0
- package/components/signature/types.ts +79 -0
- package/components/slider/index.ts +6 -0
- package/components/slider/index.vue +63 -0
- package/components/slider/types.ts +53 -0
- package/components/stepper/index.ts +6 -0
- package/components/stepper/index.vue +62 -0
- package/components/stepper/types.ts +47 -0
- package/components/switch/index.ts +6 -0
- package/components/switch/index.vue +61 -0
- package/components/switch/types.ts +51 -0
- package/components/time-picker/index.ts +6 -0
- package/components/time-picker/index.vue +130 -0
- package/components/time-picker/types.ts +91 -0
- package/components/tree-select/index.ts +6 -0
- package/components/tree-select/index.vue +160 -0
- package/components/tree-select/types.ts +77 -0
- package/components/upload/index.ts +6 -0
- package/components/upload/index.vue +109 -0
- package/components/upload/types.ts +85 -0
- package/components/use.ts +45 -0
- package/components/utils.ts +52 -0
- package/components/wrapper/index.ts +6 -0
- package/components/wrapper/index.vue +117 -0
- package/components/wrapper/types.ts +94 -0
- package/dist/components/area/index.d.ts +5 -0
- package/dist/components/area/index.vue.d.ts +1843 -0
- package/dist/components/area/types.d.ts +1434 -0
- package/dist/components/cascader/index.d.ts +5 -0
- package/dist/components/cascader/index.vue.d.ts +2467 -0
- package/dist/components/cascader/types.d.ts +1419 -0
- package/dist/components/checkbox/index.d.ts +5 -0
- package/dist/components/checkbox/index.vue.d.ts +1550 -0
- package/dist/components/checkbox/types.d.ts +1313 -0
- package/dist/components/checkbox-group/index.d.ts +5 -0
- package/dist/components/checkbox-group/index.vue.d.ts +1643 -0
- package/dist/components/checkbox-group/types.d.ts +1372 -0
- package/dist/components/component-definition/components.d.ts +30 -0
- package/dist/components/component-definition/index.d.ts +4 -0
- package/dist/components/custom-render/index.d.ts +5 -0
- package/dist/components/custom-render/index.vue.d.ts +1473 -0
- package/dist/components/custom-render/types.d.ts +1175 -0
- package/dist/components/date-picker/index.d.ts +5 -0
- package/dist/components/date-picker/index.vue.d.ts +1888 -0
- package/dist/components/date-picker/types.d.ts +1458 -0
- package/dist/components/date-time-picker-group/index.d.ts +5 -0
- package/dist/components/date-time-picker-group/index.vue.d.ts +2181 -0
- package/dist/components/date-time-picker-group/types.d.ts +1549 -0
- package/dist/components/dynamic-group/index.d.ts +5 -0
- package/dist/components/dynamic-group/index.vue.d.ts +457 -0
- package/dist/components/dynamic-group/types.d.ts +403 -0
- package/dist/components/group/assist.d.ts +58 -0
- package/dist/components/group/index.d.ts +6 -0
- package/dist/components/group/index.vue.d.ts +139 -0
- package/dist/components/group/types.d.ts +189 -0
- package/dist/components/group/virtual-group.vue.d.ts +42 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/input/index.d.ts +5 -0
- package/dist/components/input/index.vue.d.ts +2229 -0
- package/dist/components/input/types.d.ts +1258 -0
- package/dist/components/input-slot/index.d.ts +5 -0
- package/dist/components/input-slot/index.vue.d.ts +626 -0
- package/dist/components/input-slot/types.d.ts +311 -0
- package/dist/components/number-keyboard/index.d.ts +5 -0
- package/dist/components/number-keyboard/index.vue.d.ts +1643 -0
- package/dist/components/number-keyboard/types.d.ts +1324 -0
- package/dist/components/password-input/index.d.ts +5 -0
- package/dist/components/password-input/index.vue.d.ts +1715 -0
- package/dist/components/password-input/types.d.ts +1357 -0
- package/dist/components/picker/index.d.ts +5 -0
- package/dist/components/picker/index.vue.d.ts +1868 -0
- package/dist/components/picker/types.d.ts +1466 -0
- package/dist/components/radio/index.d.ts +5 -0
- package/dist/components/radio/index.vue.d.ts +1563 -0
- package/dist/components/radio/types.d.ts +1327 -0
- package/dist/components/radio-group/index.d.ts +5 -0
- package/dist/components/radio-group/index.vue.d.ts +1617 -0
- package/dist/components/radio-group/types.d.ts +1383 -0
- package/dist/components/rate/index.d.ts +5 -0
- package/dist/components/rate/index.vue.d.ts +1557 -0
- package/dist/components/rate/types.d.ts +1281 -0
- package/dist/components/share.d.ts +679 -0
- package/dist/components/signature/index.d.ts +5 -0
- package/dist/components/signature/index.vue.d.ts +3017 -0
- package/dist/components/signature/instance.vue.d.ts +1614 -0
- package/dist/components/signature/types.d.ts +1369 -0
- package/dist/components/slider/index.d.ts +5 -0
- package/dist/components/slider/index.vue.d.ts +1563 -0
- package/dist/components/slider/types.d.ts +1302 -0
- package/dist/components/stepper/index.d.ts +5 -0
- package/dist/components/stepper/index.vue.d.ts +1620 -0
- package/dist/components/stepper/types.d.ts +1281 -0
- package/dist/components/switch/index.d.ts +5 -0
- package/dist/components/switch/index.vue.d.ts +1529 -0
- package/dist/components/switch/types.d.ts +1296 -0
- package/dist/components/time-picker/index.d.ts +5 -0
- package/dist/components/time-picker/index.vue.d.ts +1936 -0
- package/dist/components/time-picker/types.d.ts +1458 -0
- package/dist/components/tree-select/index.d.ts +5 -0
- package/dist/components/tree-select/index.vue.d.ts +1802 -0
- package/dist/components/tree-select/types.d.ts +1411 -0
- package/dist/components/upload/index.d.ts +5 -0
- package/dist/components/upload/index.vue.d.ts +1697 -0
- package/dist/components/upload/types.d.ts +1376 -0
- package/dist/components/use.d.ts +53 -0
- package/dist/components/utils.d.ts +15 -0
- package/dist/components/wrapper/index.d.ts +5 -0
- package/dist/components/wrapper/index.vue.d.ts +1085 -0
- package/dist/components/wrapper/types.d.ts +541 -0
- package/dist/docs/.vitepress/config.d.ts +3 -0
- package/dist/docs/.vitepress/theme/index.d.ts +2 -0
- package/dist/index.cjs.js +5459 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.cjs.min.js +3568 -0
- package/dist/index.cjs.min.js.map +1 -0
- package/dist/index.esm.js +5264 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.esm.min.js +3559 -0
- package/dist/index.esm.min.js.map +1 -0
- package/dist/index.umd.js +5465 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/index.umd.min.js +3573 -0
- package/dist/index.umd.min.js.map +1 -0
- package/dist/src/assist.d.ts +32 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/interface.d.ts +129 -0
- package/dist/src/utils.d.ts +9 -0
- package/dist/src/version.d.ts +2 -0
- package/docs/.vitepress/config.ts +99 -0
- package/docs/.vitepress/theme/index.ts +5 -0
- package/docs/README.md +20 -0
- package/docs/index.md +25 -0
- package/env.d.ts +8 -0
- package/package.json +71 -0
- package/scripts/generate-version.mjs +26 -0
- package/scripts/postinstall.cjs +13 -0
- package/scripts/utils.cjs +67 -0
- package/src/assist.ts +40 -0
- package/src/index.ts +5 -0
- package/src/interface.ts +293 -0
- package/src/utils.ts +22 -0
- package/src/version.ts +2 -0
- package/tsconfig.app.json +41 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +24 -0
- package/tsdown.config.ts +12 -0
- package/vite.config.ts +93 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { usePlain } from '@xiaohaih/json-form-core';
|
|
2
|
+
import { ExtractPublicPropTypes, PropType } from 'vue';
|
|
3
|
+
import { ComponentType } from '../share';
|
|
4
|
+
/** 组件传参 - 私有 */
|
|
5
|
+
export declare function dynamicGroupPropsGeneric<Query extends Record<string, any>, OptionQuery extends Record<string, any>>(): {
|
|
6
|
+
/** 当前组件类型(防止被继承, 主动声明) */
|
|
7
|
+
readonly t: {
|
|
8
|
+
readonly type: StringConstructor;
|
|
9
|
+
};
|
|
10
|
+
/** 渲染的标签 */
|
|
11
|
+
readonly tag: {
|
|
12
|
+
readonly type: PropType<any>;
|
|
13
|
+
readonly default: "div";
|
|
14
|
+
};
|
|
15
|
+
/** 渲染的子条件 */
|
|
16
|
+
readonly config: {
|
|
17
|
+
readonly type: PropType<any>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* 如果是组件是存在于数组中的, 需要传递一个唯一键, 读取当前对象中的某个值
|
|
21
|
+
* 防止依赖本数组其它下标中的值时, 如果前一项被删除, 导致依赖误触发
|
|
22
|
+
* 也是作为循环时唯一 key
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ``` ts
|
|
26
|
+
* // 当表单项根据 query.users 动态生成时, 想保证某些情况下依赖不会产生错误
|
|
27
|
+
* // 可传递 uniqueKey: 'id', 此时依赖判断会以条件项的 user[].id 的值做唯一值判断
|
|
28
|
+
* const query = { users: [{ id: '1', name: '', value: '' }, { id: '2', name: '', value: '' }, ...] }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
readonly uniqueKey: {
|
|
32
|
+
readonly type: StringConstructor;
|
|
33
|
+
};
|
|
34
|
+
/** 传递给每行表单项 DOM 节点的属性 */
|
|
35
|
+
readonly contentProps: {
|
|
36
|
+
readonly type: PropType<Partial<Record<"class" | "style", string | Record<string, any> | any[]>>>;
|
|
37
|
+
};
|
|
38
|
+
/** 传递给组件的插槽 - 重写声明 */
|
|
39
|
+
readonly slots: {
|
|
40
|
+
readonly type: PropType<DynamicGroupSlots<Query, OptionQuery>>;
|
|
41
|
+
};
|
|
42
|
+
/** 传递给动态渲染组件的插槽 */
|
|
43
|
+
readonly itemSlots: {
|
|
44
|
+
readonly type: PropType<{
|
|
45
|
+
/** 在动态表单项前渲染 */
|
|
46
|
+
prepend?: ComponentType<{
|
|
47
|
+
query: Query;
|
|
48
|
+
checked: any[];
|
|
49
|
+
index: number;
|
|
50
|
+
plain: ReturnType<typeof usePlain>;
|
|
51
|
+
}>;
|
|
52
|
+
/** 在动态表单项后渲染 */
|
|
53
|
+
append?: ComponentType<{
|
|
54
|
+
query: Query;
|
|
55
|
+
checked: any[];
|
|
56
|
+
index: number;
|
|
57
|
+
plain: ReturnType<typeof usePlain>;
|
|
58
|
+
}>;
|
|
59
|
+
}>;
|
|
60
|
+
readonly default: () => {};
|
|
61
|
+
};
|
|
62
|
+
readonly field: Omit<{
|
|
63
|
+
readonly type: PropType<string>;
|
|
64
|
+
readonly required: true;
|
|
65
|
+
}, "required">;
|
|
66
|
+
readonly fields: {
|
|
67
|
+
readonly type: PropType<string[]>;
|
|
68
|
+
};
|
|
69
|
+
readonly query: {
|
|
70
|
+
readonly type: PropType<Query>;
|
|
71
|
+
readonly required: true;
|
|
72
|
+
};
|
|
73
|
+
readonly parentQuery: {
|
|
74
|
+
readonly type: PropType<Record<string, any>>;
|
|
75
|
+
};
|
|
76
|
+
readonly depend: {
|
|
77
|
+
readonly type: PropType<boolean>;
|
|
78
|
+
readonly default: undefined;
|
|
79
|
+
};
|
|
80
|
+
readonly resetByDependValueChange: {
|
|
81
|
+
readonly type: PropType<boolean | ((query: Query) => boolean)>;
|
|
82
|
+
readonly default: true;
|
|
83
|
+
};
|
|
84
|
+
readonly dependFields: {
|
|
85
|
+
readonly type: PropType<string | string[]>;
|
|
86
|
+
};
|
|
87
|
+
readonly dependWatchOption: {
|
|
88
|
+
readonly type: PropType<import('vue').WatchOptions>;
|
|
89
|
+
};
|
|
90
|
+
readonly optionsDepend: {
|
|
91
|
+
readonly type: PropType<boolean>;
|
|
92
|
+
};
|
|
93
|
+
readonly optionsDependFields: {
|
|
94
|
+
readonly type: PropType<string | string[]>;
|
|
95
|
+
};
|
|
96
|
+
readonly validator: {
|
|
97
|
+
readonly type: PropType<(query: Query) => any | Promise<any>>;
|
|
98
|
+
};
|
|
99
|
+
readonly initialValue: {
|
|
100
|
+
readonly type: PropType<((option: {
|
|
101
|
+
query: Query_1;
|
|
102
|
+
}) => any) | any>;
|
|
103
|
+
readonly default: undefined;
|
|
104
|
+
};
|
|
105
|
+
readonly defaultValue: {
|
|
106
|
+
readonly type: PropType<((option: {
|
|
107
|
+
query: Query_1;
|
|
108
|
+
}) => any) | any>;
|
|
109
|
+
readonly default: undefined;
|
|
110
|
+
};
|
|
111
|
+
readonly defaultValueConflictCallback: {
|
|
112
|
+
readonly type: PropType<(value: any, checked: import('vue').Ref<any>) => void>;
|
|
113
|
+
readonly default: typeof import('@xiaohaih/json-form-core').noop;
|
|
114
|
+
};
|
|
115
|
+
readonly options: {
|
|
116
|
+
readonly type: PropType<any>;
|
|
117
|
+
readonly default: () => never[];
|
|
118
|
+
};
|
|
119
|
+
readonly getOptions: {
|
|
120
|
+
readonly type: PropType<import('@xiaohaih/json-form-core').GetOptions<Query, OptionQuery>>;
|
|
121
|
+
};
|
|
122
|
+
readonly uniqueValue: {
|
|
123
|
+
readonly type: PropType<string | number>;
|
|
124
|
+
};
|
|
125
|
+
readonly hooks: {
|
|
126
|
+
readonly type: PropType<import('@xiaohaih/json-form-core').HookOption<Query, OptionQuery>>;
|
|
127
|
+
readonly default: undefined;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
/** 组件传参 - 私有 */
|
|
131
|
+
export declare const dynamicGroupPropsPrivate: {
|
|
132
|
+
/** 当前组件类型(防止被继承, 主动声明) */
|
|
133
|
+
readonly t: {
|
|
134
|
+
readonly type: StringConstructor;
|
|
135
|
+
};
|
|
136
|
+
/** 渲染的标签 */
|
|
137
|
+
readonly tag: {
|
|
138
|
+
readonly type: PropType<any>;
|
|
139
|
+
readonly default: "div";
|
|
140
|
+
};
|
|
141
|
+
/** 渲染的子条件 */
|
|
142
|
+
readonly config: {
|
|
143
|
+
readonly type: PropType<any>;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* 如果是组件是存在于数组中的, 需要传递一个唯一键, 读取当前对象中的某个值
|
|
147
|
+
* 防止依赖本数组其它下标中的值时, 如果前一项被删除, 导致依赖误触发
|
|
148
|
+
* 也是作为循环时唯一 key
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ``` ts
|
|
152
|
+
* // 当表单项根据 query.users 动态生成时, 想保证某些情况下依赖不会产生错误
|
|
153
|
+
* // 可传递 uniqueKey: 'id', 此时依赖判断会以条件项的 user[].id 的值做唯一值判断
|
|
154
|
+
* const query = { users: [{ id: '1', name: '', value: '' }, { id: '2', name: '', value: '' }, ...] }
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
readonly uniqueKey: {
|
|
158
|
+
readonly type: StringConstructor;
|
|
159
|
+
};
|
|
160
|
+
/** 传递给每行表单项 DOM 节点的属性 */
|
|
161
|
+
readonly contentProps: {
|
|
162
|
+
readonly type: PropType<Partial<Record<"class" | "style", string | Record<string, any> | any[]>>>;
|
|
163
|
+
};
|
|
164
|
+
/** 传递给组件的插槽 - 重写声明 */
|
|
165
|
+
readonly slots: {
|
|
166
|
+
readonly type: PropType<DynamicGroupSlots<Record<string, any>, Record<string, any>>>;
|
|
167
|
+
};
|
|
168
|
+
/** 传递给动态渲染组件的插槽 */
|
|
169
|
+
readonly itemSlots: {
|
|
170
|
+
readonly type: PropType<{
|
|
171
|
+
/** 在动态表单项前渲染 */
|
|
172
|
+
prepend?: ComponentType<{
|
|
173
|
+
query: Record<string, any>;
|
|
174
|
+
checked: any[];
|
|
175
|
+
index: number;
|
|
176
|
+
plain: ReturnType<typeof usePlain>;
|
|
177
|
+
}> | undefined;
|
|
178
|
+
/** 在动态表单项后渲染 */
|
|
179
|
+
append?: ComponentType<{
|
|
180
|
+
query: Record<string, any>;
|
|
181
|
+
checked: any[];
|
|
182
|
+
index: number;
|
|
183
|
+
plain: ReturnType<typeof usePlain>;
|
|
184
|
+
}> | undefined;
|
|
185
|
+
}>;
|
|
186
|
+
readonly default: () => {};
|
|
187
|
+
};
|
|
188
|
+
readonly field: Omit<{
|
|
189
|
+
readonly type: PropType<string>;
|
|
190
|
+
readonly required: true;
|
|
191
|
+
}, "required">;
|
|
192
|
+
readonly fields: {
|
|
193
|
+
readonly type: PropType<string[]>;
|
|
194
|
+
};
|
|
195
|
+
readonly query: {
|
|
196
|
+
readonly type: PropType<Record<string, any>>;
|
|
197
|
+
readonly required: true;
|
|
198
|
+
};
|
|
199
|
+
readonly parentQuery: {
|
|
200
|
+
readonly type: PropType<Record<string, any>>;
|
|
201
|
+
};
|
|
202
|
+
readonly depend: {
|
|
203
|
+
readonly type: PropType<boolean>;
|
|
204
|
+
readonly default: undefined;
|
|
205
|
+
};
|
|
206
|
+
readonly resetByDependValueChange: {
|
|
207
|
+
readonly type: PropType<boolean | ((query: Record<string, any>) => boolean)>;
|
|
208
|
+
readonly default: true;
|
|
209
|
+
};
|
|
210
|
+
readonly dependFields: {
|
|
211
|
+
readonly type: PropType<string | string[]>;
|
|
212
|
+
};
|
|
213
|
+
readonly dependWatchOption: {
|
|
214
|
+
readonly type: PropType<import('vue').WatchOptions>;
|
|
215
|
+
};
|
|
216
|
+
readonly optionsDepend: {
|
|
217
|
+
readonly type: PropType<boolean>;
|
|
218
|
+
};
|
|
219
|
+
readonly optionsDependFields: {
|
|
220
|
+
readonly type: PropType<string | string[]>;
|
|
221
|
+
};
|
|
222
|
+
readonly validator: {
|
|
223
|
+
readonly type: PropType<(query: Record<string, any>) => any | Promise<any>>;
|
|
224
|
+
};
|
|
225
|
+
readonly initialValue: {
|
|
226
|
+
readonly type: PropType<((option: {
|
|
227
|
+
query: Query;
|
|
228
|
+
}) => any) | any>;
|
|
229
|
+
readonly default: undefined;
|
|
230
|
+
};
|
|
231
|
+
readonly defaultValue: {
|
|
232
|
+
readonly type: PropType<((option: {
|
|
233
|
+
query: Query;
|
|
234
|
+
}) => any) | any>;
|
|
235
|
+
readonly default: undefined;
|
|
236
|
+
};
|
|
237
|
+
readonly defaultValueConflictCallback: {
|
|
238
|
+
readonly type: PropType<(value: any, checked: import('vue').Ref<any>) => void>;
|
|
239
|
+
readonly default: typeof import('@xiaohaih/json-form-core').noop;
|
|
240
|
+
};
|
|
241
|
+
readonly options: {
|
|
242
|
+
readonly type: PropType<any>;
|
|
243
|
+
readonly default: () => never[];
|
|
244
|
+
};
|
|
245
|
+
readonly getOptions: {
|
|
246
|
+
readonly type: PropType<import('@xiaohaih/json-form-core').GetOptions<Record<string, any>, Record<string, any>>>;
|
|
247
|
+
};
|
|
248
|
+
readonly uniqueValue: {
|
|
249
|
+
readonly type: PropType<string | number>;
|
|
250
|
+
};
|
|
251
|
+
readonly hooks: {
|
|
252
|
+
readonly type: PropType<import('@xiaohaih/json-form-core').HookOption<Record<string, any>, Record<string, any>>>;
|
|
253
|
+
readonly default: undefined;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
/** 组件传参 - 外部调用 */
|
|
257
|
+
export declare const dynamicGroupProps: {
|
|
258
|
+
/** 当前组件类型(防止被继承, 主动声明) */
|
|
259
|
+
readonly t: {
|
|
260
|
+
readonly type: StringConstructor;
|
|
261
|
+
};
|
|
262
|
+
/** 渲染的标签 */
|
|
263
|
+
readonly tag: {
|
|
264
|
+
readonly type: PropType<any>;
|
|
265
|
+
readonly default: "div";
|
|
266
|
+
};
|
|
267
|
+
/** 渲染的子条件 */
|
|
268
|
+
readonly config: {
|
|
269
|
+
readonly type: PropType<any>;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* 如果是组件是存在于数组中的, 需要传递一个唯一键, 读取当前对象中的某个值
|
|
273
|
+
* 防止依赖本数组其它下标中的值时, 如果前一项被删除, 导致依赖误触发
|
|
274
|
+
* 也是作为循环时唯一 key
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ``` ts
|
|
278
|
+
* // 当表单项根据 query.users 动态生成时, 想保证某些情况下依赖不会产生错误
|
|
279
|
+
* // 可传递 uniqueKey: 'id', 此时依赖判断会以条件项的 user[].id 的值做唯一值判断
|
|
280
|
+
* const query = { users: [{ id: '1', name: '', value: '' }, { id: '2', name: '', value: '' }, ...] }
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
readonly uniqueKey: {
|
|
284
|
+
readonly type: StringConstructor;
|
|
285
|
+
};
|
|
286
|
+
/** 传递给每行表单项 DOM 节点的属性 */
|
|
287
|
+
readonly contentProps: {
|
|
288
|
+
readonly type: PropType<Partial<Record<"class" | "style", string | Record<string, any> | any[]>>>;
|
|
289
|
+
};
|
|
290
|
+
/** 传递给组件的插槽 - 重写声明 */
|
|
291
|
+
readonly slots: {
|
|
292
|
+
readonly type: PropType<DynamicGroupSlots<Record<string, any>, Record<string, any>>>;
|
|
293
|
+
};
|
|
294
|
+
/** 传递给动态渲染组件的插槽 */
|
|
295
|
+
readonly itemSlots: {
|
|
296
|
+
readonly type: PropType<{
|
|
297
|
+
/** 在动态表单项前渲染 */
|
|
298
|
+
prepend?: ComponentType<{
|
|
299
|
+
query: Record<string, any>;
|
|
300
|
+
checked: any[];
|
|
301
|
+
index: number;
|
|
302
|
+
plain: ReturnType<typeof usePlain>;
|
|
303
|
+
}> | undefined;
|
|
304
|
+
/** 在动态表单项后渲染 */
|
|
305
|
+
append?: ComponentType<{
|
|
306
|
+
query: Record<string, any>;
|
|
307
|
+
checked: any[];
|
|
308
|
+
index: number;
|
|
309
|
+
plain: ReturnType<typeof usePlain>;
|
|
310
|
+
}> | undefined;
|
|
311
|
+
}>;
|
|
312
|
+
readonly default: () => {};
|
|
313
|
+
};
|
|
314
|
+
readonly field: Omit<{
|
|
315
|
+
readonly type: PropType<string>;
|
|
316
|
+
readonly required: true;
|
|
317
|
+
}, "required">;
|
|
318
|
+
readonly fields: {
|
|
319
|
+
readonly type: PropType<string[]>;
|
|
320
|
+
};
|
|
321
|
+
readonly query: {
|
|
322
|
+
readonly type: PropType<Record<string, any>>;
|
|
323
|
+
readonly required: true;
|
|
324
|
+
};
|
|
325
|
+
readonly parentQuery: {
|
|
326
|
+
readonly type: PropType<Record<string, any>>;
|
|
327
|
+
};
|
|
328
|
+
readonly depend: {
|
|
329
|
+
readonly type: PropType<boolean>;
|
|
330
|
+
readonly default: undefined;
|
|
331
|
+
};
|
|
332
|
+
readonly resetByDependValueChange: {
|
|
333
|
+
readonly type: PropType<boolean | ((query: Record<string, any>) => boolean)>;
|
|
334
|
+
readonly default: true;
|
|
335
|
+
};
|
|
336
|
+
readonly dependFields: {
|
|
337
|
+
readonly type: PropType<string | string[]>;
|
|
338
|
+
};
|
|
339
|
+
readonly dependWatchOption: {
|
|
340
|
+
readonly type: PropType<import('vue').WatchOptions>;
|
|
341
|
+
};
|
|
342
|
+
readonly optionsDepend: {
|
|
343
|
+
readonly type: PropType<boolean>;
|
|
344
|
+
};
|
|
345
|
+
readonly optionsDependFields: {
|
|
346
|
+
readonly type: PropType<string | string[]>;
|
|
347
|
+
};
|
|
348
|
+
readonly validator: {
|
|
349
|
+
readonly type: PropType<(query: Record<string, any>) => any | Promise<any>>;
|
|
350
|
+
};
|
|
351
|
+
readonly initialValue: {
|
|
352
|
+
readonly type: PropType<((option: {
|
|
353
|
+
query: Query;
|
|
354
|
+
}) => any) | any>;
|
|
355
|
+
readonly default: undefined;
|
|
356
|
+
};
|
|
357
|
+
readonly defaultValue: {
|
|
358
|
+
readonly type: PropType<((option: {
|
|
359
|
+
query: Query;
|
|
360
|
+
}) => any) | any>;
|
|
361
|
+
readonly default: undefined;
|
|
362
|
+
};
|
|
363
|
+
readonly defaultValueConflictCallback: {
|
|
364
|
+
readonly type: PropType<(value: any, checked: import('vue').Ref<any>) => void>;
|
|
365
|
+
readonly default: typeof import('@xiaohaih/json-form-core').noop;
|
|
366
|
+
};
|
|
367
|
+
readonly options: {
|
|
368
|
+
readonly type: PropType<any>;
|
|
369
|
+
readonly default: () => never[];
|
|
370
|
+
};
|
|
371
|
+
readonly getOptions: {
|
|
372
|
+
readonly type: PropType<import('@xiaohaih/json-form-core').GetOptions<Record<string, any>, Record<string, any>>>;
|
|
373
|
+
};
|
|
374
|
+
readonly uniqueValue: {
|
|
375
|
+
readonly type: PropType<string | number>;
|
|
376
|
+
};
|
|
377
|
+
readonly hooks: {
|
|
378
|
+
readonly type: PropType<import('@xiaohaih/json-form-core').HookOption<Record<string, any>, Record<string, any>>>;
|
|
379
|
+
readonly default: undefined;
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
export type DynamicGroupProps<Query extends Record<string, any>, OptionQuery extends Record<string, any>> = ExtractPublicPropTypes<ReturnType<typeof dynamicGroupPropsGeneric<Query, OptionQuery>>>;
|
|
383
|
+
/** 组件事件 - 私有 */
|
|
384
|
+
export declare function dynamicGroupEmitsGeneric<T>(): {};
|
|
385
|
+
/** 组件事件 - 私有 */
|
|
386
|
+
export declare const dynamicGroupEmitsPrivate: {};
|
|
387
|
+
/** 组件事件 - 外部调用 */
|
|
388
|
+
export declare const dynamicGroupEmits: {};
|
|
389
|
+
export type DynamicGroupEmits<T> = ReturnType<typeof dynamicGroupEmitsGeneric<T>>;
|
|
390
|
+
export interface DynamicGroupSlots<Query extends Record<string, any> = any, OptionQuery extends Record<string, any> = any> {
|
|
391
|
+
/** 在表单项前渲染 */
|
|
392
|
+
prepend?: ComponentType<{
|
|
393
|
+
query: Query;
|
|
394
|
+
checked: any[];
|
|
395
|
+
plain: ReturnType<typeof usePlain>;
|
|
396
|
+
}>;
|
|
397
|
+
/** 在表单项后渲染 */
|
|
398
|
+
append?: ComponentType<{
|
|
399
|
+
query: Query;
|
|
400
|
+
checked: any[];
|
|
401
|
+
plain: ReturnType<typeof usePlain>;
|
|
402
|
+
}>;
|
|
403
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { HArea, HCascader, HCheckbox, HCheckboxGroup, HCustomRender, HDatePicker, HDatetimePicker, HDateTimePickerGroup, HInput, HNumberKeyboard, HPasswordInput, HPicker, HRadio, HRadioGroup, HRate, HSignature, HSlider, HStepper, HSwitch, HTimePicker, HTreeSelect, HUpload } from '../component-definition/components';
|
|
2
|
+
declare const compMap: {
|
|
3
|
+
area: typeof HArea;
|
|
4
|
+
cascader: typeof HCascader;
|
|
5
|
+
checkbox: typeof HCheckbox;
|
|
6
|
+
'checkbox-group': typeof HCheckboxGroup;
|
|
7
|
+
'custom-render': typeof HCustomRender;
|
|
8
|
+
datepicker: typeof HDatePicker;
|
|
9
|
+
'date-picker': typeof HDatePicker;
|
|
10
|
+
'date-time-picker-group': typeof HDateTimePickerGroup;
|
|
11
|
+
'datetime-picker': typeof HDatetimePicker;
|
|
12
|
+
input: typeof HInput;
|
|
13
|
+
'number-keyboard': typeof HNumberKeyboard;
|
|
14
|
+
'password-input': typeof HPasswordInput;
|
|
15
|
+
picker: typeof HPicker;
|
|
16
|
+
select: typeof HPicker;
|
|
17
|
+
radio: typeof HRadio;
|
|
18
|
+
'radio-group': typeof HRadioGroup;
|
|
19
|
+
rate: typeof HRate;
|
|
20
|
+
signature: typeof HSignature;
|
|
21
|
+
slider: typeof HSlider;
|
|
22
|
+
stepper: typeof HStepper;
|
|
23
|
+
switch: typeof HSwitch;
|
|
24
|
+
'time-picker': typeof HTimePicker;
|
|
25
|
+
timepicker: typeof HTimePicker;
|
|
26
|
+
'tree-select': typeof HTreeSelect;
|
|
27
|
+
upload: typeof HUpload;
|
|
28
|
+
};
|
|
29
|
+
/** 默认定义组件的类型 */
|
|
30
|
+
export type ComponentTypeDef = (typeof compMap)[keyof typeof compMap];
|
|
31
|
+
/**
|
|
32
|
+
* 注册自定义组件
|
|
33
|
+
* @param {string} name 类型
|
|
34
|
+
* @param {} comp 可渲染的组件
|
|
35
|
+
*/
|
|
36
|
+
export declare function registerComponent(name: string, comp: any): void;
|
|
37
|
+
/**
|
|
38
|
+
* 删除自定义组件
|
|
39
|
+
* @param {string} name 定义的类型
|
|
40
|
+
*/
|
|
41
|
+
export declare function unregisterComponent(name: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* 获取指定组件
|
|
44
|
+
* 根据组件类型名称获取对应的组件实例,优先从用户自定义组件中查找
|
|
45
|
+
*
|
|
46
|
+
* @param {string} name - 组件类型名称
|
|
47
|
+
* @returns {ComponentTypeDef | null} - 返回指定的组件
|
|
48
|
+
*/
|
|
49
|
+
export declare function getComponent(name: string): ComponentTypeDef | null;
|
|
50
|
+
/**
|
|
51
|
+
* 获取指定类型/所有组件
|
|
52
|
+
*
|
|
53
|
+
* @param {string} [type] 内置组件(builtIn)
|
|
54
|
+
*
|
|
55
|
+
* @returns {Record<string, ComponentTypeDef>} - 返回指定的组件或所有组件的映射表
|
|
56
|
+
*/
|
|
57
|
+
export declare function getAllComponent(type?: 'builtIn' | 'user'): Record<string, ComponentTypeDef>;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { getNode, getProvideValue } from '@xiaohaih/json-form-core';
|
|
2
|
+
import { SlotsType } from 'vue';
|
|
3
|
+
import { GroupSlots } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* @file 自定义组件 - 支持多列渲染
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
10
|
+
readonly t: {
|
|
11
|
+
readonly type: StringConstructor;
|
|
12
|
+
};
|
|
13
|
+
readonly field: {
|
|
14
|
+
readonly type: StringConstructor;
|
|
15
|
+
};
|
|
16
|
+
readonly query: {
|
|
17
|
+
readonly type: import('vue').PropType<Record<string, any>>;
|
|
18
|
+
readonly required: true;
|
|
19
|
+
};
|
|
20
|
+
readonly tag: {
|
|
21
|
+
readonly type: import('vue').PropType<any>;
|
|
22
|
+
readonly default: "div";
|
|
23
|
+
};
|
|
24
|
+
readonly tagSlots: {
|
|
25
|
+
readonly type: import('vue').PropType<Record<string, import('..').ComponentType<{
|
|
26
|
+
query: Record<string, any>;
|
|
27
|
+
wrapper: ReturnType<typeof getProvideValue>;
|
|
28
|
+
}>>>;
|
|
29
|
+
};
|
|
30
|
+
readonly config: {
|
|
31
|
+
readonly type: import('vue').PropType<any>;
|
|
32
|
+
};
|
|
33
|
+
readonly slots: {
|
|
34
|
+
readonly type: import('vue').PropType<GroupSlots<Record<string, any>, Record<string, any>>>;
|
|
35
|
+
};
|
|
36
|
+
readonly hooks: {
|
|
37
|
+
readonly type: import('vue').PropType<import('./types').GroupHookOption>;
|
|
38
|
+
readonly default: undefined;
|
|
39
|
+
};
|
|
40
|
+
readonly getFormRef: {
|
|
41
|
+
readonly type: import('vue').PropType<() => any>;
|
|
42
|
+
};
|
|
43
|
+
readonly class: {
|
|
44
|
+
type: import('vue').PropType<string | Record<string, any> | any[]>;
|
|
45
|
+
};
|
|
46
|
+
readonly style: {
|
|
47
|
+
type: import('vue').PropType<string | Record<string, any> | any[]>;
|
|
48
|
+
};
|
|
49
|
+
}>, {
|
|
50
|
+
hyphenate: <T extends string>(str: T) => import('@xiaohaih/json-form-core').Hyphenate<T>;
|
|
51
|
+
getNode: typeof getNode;
|
|
52
|
+
REWRITE_FIELD_KEY: "__field__";
|
|
53
|
+
virtualGroupRef: import('vue').Ref<Record<string, any> | undefined, Record<string, any> | undefined>;
|
|
54
|
+
virtualTag: import('vue').ComputedRef<any>;
|
|
55
|
+
virtualSlots: import('vue').ComputedRef<Record<string, any> | undefined>;
|
|
56
|
+
tagRef: import('vue').ComputedRef<any>;
|
|
57
|
+
wrapper: import('@xiaohaih/json-form-core').ProvideValue<Record<string, any>, Record<string, any>, any> | undefined;
|
|
58
|
+
finalConfig: import('vue').ComputedRef<any[]>;
|
|
59
|
+
getComponent2: (name: string) => import('./assist').ComponentTypeDef | "HGroup" | null;
|
|
60
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
61
|
+
readonly t: {
|
|
62
|
+
readonly type: StringConstructor;
|
|
63
|
+
};
|
|
64
|
+
readonly field: {
|
|
65
|
+
readonly type: StringConstructor;
|
|
66
|
+
};
|
|
67
|
+
readonly query: {
|
|
68
|
+
readonly type: import('vue').PropType<Record<string, any>>;
|
|
69
|
+
readonly required: true;
|
|
70
|
+
};
|
|
71
|
+
readonly tag: {
|
|
72
|
+
readonly type: import('vue').PropType<any>;
|
|
73
|
+
readonly default: "div";
|
|
74
|
+
};
|
|
75
|
+
readonly tagSlots: {
|
|
76
|
+
readonly type: import('vue').PropType<Record<string, import('..').ComponentType<{
|
|
77
|
+
query: Record<string, any>;
|
|
78
|
+
wrapper: ReturnType<typeof getProvideValue>;
|
|
79
|
+
}>>>;
|
|
80
|
+
};
|
|
81
|
+
readonly config: {
|
|
82
|
+
readonly type: import('vue').PropType<any>;
|
|
83
|
+
};
|
|
84
|
+
readonly slots: {
|
|
85
|
+
readonly type: import('vue').PropType<GroupSlots<Record<string, any>, Record<string, any>>>;
|
|
86
|
+
};
|
|
87
|
+
readonly hooks: {
|
|
88
|
+
readonly type: import('vue').PropType<import('./types').GroupHookOption>;
|
|
89
|
+
readonly default: undefined;
|
|
90
|
+
};
|
|
91
|
+
readonly getFormRef: {
|
|
92
|
+
readonly type: import('vue').PropType<() => any>;
|
|
93
|
+
};
|
|
94
|
+
readonly class: {
|
|
95
|
+
type: import('vue').PropType<string | Record<string, any> | any[]>;
|
|
96
|
+
};
|
|
97
|
+
readonly style: {
|
|
98
|
+
type: import('vue').PropType<string | Record<string, any> | any[]>;
|
|
99
|
+
};
|
|
100
|
+
}>> & Readonly<{}>, {
|
|
101
|
+
readonly hooks: import('./types').GroupHookOption;
|
|
102
|
+
readonly tag: any;
|
|
103
|
+
}, SlotsType<GroupSlots<any, any>>, {
|
|
104
|
+
VirtualGroup: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
105
|
+
tag: {
|
|
106
|
+
type: import('vue').PropType<any>;
|
|
107
|
+
default: string;
|
|
108
|
+
};
|
|
109
|
+
slots: {
|
|
110
|
+
type: import('vue').PropType<Record<string, any>>;
|
|
111
|
+
};
|
|
112
|
+
wrapper: {
|
|
113
|
+
type: import('vue').PropType<Record<string, any>>;
|
|
114
|
+
};
|
|
115
|
+
query: {
|
|
116
|
+
type: import('vue').PropType<Record<string, any>>;
|
|
117
|
+
};
|
|
118
|
+
}>, {
|
|
119
|
+
getNode: typeof getNode;
|
|
120
|
+
tagRef: import('vue').Ref<Record<string, any> | undefined, Record<string, any> | undefined>;
|
|
121
|
+
events: import('vue').ComputedRef<any>;
|
|
122
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
123
|
+
tag: {
|
|
124
|
+
type: import('vue').PropType<any>;
|
|
125
|
+
default: string;
|
|
126
|
+
};
|
|
127
|
+
slots: {
|
|
128
|
+
type: import('vue').PropType<Record<string, any>>;
|
|
129
|
+
};
|
|
130
|
+
wrapper: {
|
|
131
|
+
type: import('vue').PropType<Record<string, any>>;
|
|
132
|
+
};
|
|
133
|
+
query: {
|
|
134
|
+
type: import('vue').PropType<Record<string, any>>;
|
|
135
|
+
};
|
|
136
|
+
}>> & Readonly<{}>, {
|
|
137
|
+
tag: any;
|
|
138
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
139
|
+
}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|