@pisell/materials 1.0.463 → 1.0.465
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +19 -2
- package/build/lowcode/preview.js +7 -7
- package/build/lowcode/render/default/view.js +21 -21
- package/build/lowcode/view.js +21 -21
- package/es/components/dataSourceComponents/dataSourceForm/formItem.js +3 -1
- package/es/components/dataSourceComponents/dataSourceForm/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/provider/hooks/useJsonPrefixPath.d.ts +4 -1
- package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperContext.d.ts +4 -1
- package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperContext.js +4 -1
- package/es/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +21 -4
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +15 -10
- package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +9 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +49 -2
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +8 -7
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDesignMode.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDesignMode.js +5 -4
- package/es/components/dataSourceComponents/dataSourceTable/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +2 -1
- package/es/components/dataSourceComponents/dataSourceWrapper/index.d.ts +6 -0
- package/es/components/dataSourceComponents/dataSourceWrapper/index.js +6 -0
- package/es/components/dataSourceComponents/fields/Checkbox/index.js +10 -2
- package/es/components/dataSourceComponents/fields/Radio/index.js +10 -2
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +9 -2
- package/es/components/dataSourceComponents/fields/Select/index.js +11 -3
- package/es/components/dataSourceComponents/fields/index.d.ts +8 -1
- package/es/components/dataSourceComponents/hooks/useActions.d.ts +1 -1
- package/es/components/dataSourceComponents/hooks/useActions.js +2 -5
- package/es/components/dataSourceComponents/hooks/useDataSource.d.ts +1 -1
- package/es/components/dataSourceComponents/hooks/useDataSource.js +1 -1
- package/es/components/dataSourceComponents/provider/variables/VariablesContext.d.ts +2 -0
- package/es/components/dataSourceComponents/provider/variables/VariablesContext.js +2 -0
- package/es/components/dataSourceComponents/provider/variables/VariablesProvider.js +19 -4
- package/es/components/dataSourceComponents/provider/variables/utils.d.ts +10 -0
- package/es/components/dataSourceComponents/provider/variables/utils.js +19 -0
- package/es/components/productCard/components/Packages/components/collapsibleList/index.js +2 -2
- package/es/components/productCard/locales.d.ts +6 -0
- package/es/components/productCard/locales.js +9 -3
- package/es/components/table/Actions/component/ExportImport/utils/index.d.ts +9 -0
- package/es/components/table/Actions/component/ExportImport/utils/index.js +11 -0
- package/lib/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/provider/hooks/useJsonPrefixPath.d.ts +4 -1
- package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperContext.d.ts +4 -1
- package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperContext.js +4 -1
- package/lib/components/dataSourceComponents/dataSourceForm/provider/jsonWrapper/JsonWrapperProvider.js +6 -2
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +8 -6
- package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +9 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +45 -3
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +7 -6
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDesignMode.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDesignMode.js +11 -5
- package/lib/components/dataSourceComponents/dataSourceTable/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +2 -1
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.d.ts +6 -0
- package/lib/components/dataSourceComponents/dataSourceWrapper/index.js +40 -0
- package/lib/components/dataSourceComponents/fields/Checkbox/index.js +3 -1
- package/lib/components/dataSourceComponents/fields/Radio/index.js +3 -1
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +9 -2
- package/lib/components/dataSourceComponents/fields/Select/index.js +4 -2
- package/lib/components/dataSourceComponents/fields/index.d.ts +8 -1
- package/lib/components/dataSourceComponents/hooks/useActions.d.ts +1 -1
- package/lib/components/dataSourceComponents/hooks/useActions.js +1 -4
- package/lib/components/dataSourceComponents/hooks/useDataSource.d.ts +1 -1
- package/lib/components/dataSourceComponents/hooks/useDataSource.js +1 -1
- package/lib/components/dataSourceComponents/provider/{fields → dataSource}/DataSourceContext.js +1 -1
- package/lib/components/dataSourceComponents/provider/{fields → dataSource}/DataSourceProvider.js +1 -1
- package/lib/components/dataSourceComponents/provider/variables/VariablesContext.d.ts +2 -0
- package/lib/components/dataSourceComponents/provider/variables/VariablesContext.js +4 -0
- package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.js +24 -3
- package/lib/components/dataSourceComponents/provider/variables/utils.d.ts +10 -0
- package/lib/components/dataSourceComponents/provider/variables/utils.js +48 -0
- package/lib/components/productCard/components/Packages/components/collapsibleList/index.js +2 -2
- package/lib/components/productCard/locales.d.ts +6 -0
- package/lib/components/productCard/locales.js +9 -3
- package/lib/components/table/Actions/component/ExportImport/utils/index.d.ts +9 -0
- package/lib/components/table/Actions/component/ExportImport/utils/index.js +31 -0
- package/lowcode/_utils/defaultSchema.ts +674 -6
- package/lowcode/_utils/utils.ts +9 -0
- package/lowcode/data-source-form/meta.ts +10 -3
- package/lowcode/data-source-form/utils.ts +65 -6
- package/lowcode/data-source-table/meta.ts +18 -6
- package/lowcode/data-source-table/utils.tsx +5 -0
- package/lowcode/date-picker.range-picker/meta.ts +20 -0
- package/lowcode/form-group/meta.ts +2 -3
- package/lowcode/form-item-checkbox/snippets.ts +2 -0
- package/lowcode/form-item-checkbox.group/meta.ts +47 -22
- package/lowcode/form-item-color-picker/meta.ts +27 -14
- package/lowcode/form-item-input/meta.ts +23 -2
- package/lowcode/form-item-radio/snippets.ts +6 -3
- package/lowcode/form-item-radio.group/meta.ts +20 -2
- package/lowcode/form-item-select/meta.ts +64 -33
- package/lowcode/form-item-select/snippets.ts +1 -0
- package/package.json +3 -3
- /package/es/components/dataSourceComponents/provider/{fields → dataSource}/DataSourceContext.d.ts +0 -0
- /package/es/components/dataSourceComponents/provider/{fields → dataSource}/DataSourceContext.js +0 -0
- /package/es/components/dataSourceComponents/provider/{fields → dataSource}/DataSourceProvider.d.ts +0 -0
- /package/es/components/dataSourceComponents/provider/{fields → dataSource}/DataSourceProvider.js +0 -0
- /package/lib/components/dataSourceComponents/provider/{fields → dataSource}/DataSourceContext.d.ts +0 -0
- /package/lib/components/dataSourceComponents/provider/{fields → dataSource}/DataSourceProvider.d.ts +0 -0
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getVariable,
|
|
3
|
+
getDataSourceValue,
|
|
4
|
+
setBatchVariables,
|
|
5
|
+
} from '../data-source-form/utils';
|
|
6
|
+
|
|
2
7
|
// 获取表单容器组件
|
|
3
8
|
const getParentForm = (target: any) => {
|
|
4
9
|
let parent = target.node.parent;
|
|
@@ -6,13 +11,13 @@ const getParentForm = (target: any) => {
|
|
|
6
11
|
parent = parent.parent;
|
|
7
12
|
}
|
|
8
13
|
return parent;
|
|
9
|
-
}
|
|
14
|
+
};
|
|
10
15
|
|
|
11
16
|
// 获取dataSourceform 中使用的字段
|
|
12
17
|
const getDataSourceFormFields = (target: any) => {
|
|
13
18
|
const getFormItemFields = (node) => {
|
|
14
19
|
let fields = [];
|
|
15
|
-
node.children.forEach(child => {
|
|
20
|
+
node.children.forEach((child) => {
|
|
16
21
|
if (child.componentName.startsWith('FormItem')) {
|
|
17
22
|
fields.push(child.getProps().getPropValue('name'));
|
|
18
23
|
} else if (child.children) {
|
|
@@ -25,8 +30,671 @@ const getDataSourceFormFields = (target: any) => {
|
|
|
25
30
|
const parentForm = getParentForm(target);
|
|
26
31
|
const fieldsInUse = getFormItemFields(parentForm);
|
|
27
32
|
return fieldsInUse;
|
|
28
|
-
}
|
|
29
|
-
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const generalItemMap = {
|
|
36
|
+
label: {
|
|
37
|
+
name: 'label',
|
|
38
|
+
title: {
|
|
39
|
+
label: {
|
|
40
|
+
type: 'i18n',
|
|
41
|
+
'en-US': 'Title',
|
|
42
|
+
'zh-CN': '标题',
|
|
43
|
+
},
|
|
44
|
+
tip: '用于显示在表单项的标签文本,对应Label。',
|
|
45
|
+
},
|
|
46
|
+
propType: 'string',
|
|
47
|
+
setter: 'PisellI18nSetter',
|
|
48
|
+
},
|
|
49
|
+
name: {
|
|
50
|
+
name: 'name',
|
|
51
|
+
title: {
|
|
52
|
+
label: {
|
|
53
|
+
type: 'i18n',
|
|
54
|
+
'en-US': 'Field',
|
|
55
|
+
'zh-CN': '字段',
|
|
56
|
+
},
|
|
57
|
+
tip: '字段名',
|
|
58
|
+
},
|
|
59
|
+
isRequired: true,
|
|
60
|
+
propType: 'string',
|
|
61
|
+
setter: [
|
|
62
|
+
{
|
|
63
|
+
componentName: 'SelectSetter',
|
|
64
|
+
condition: (target) => {
|
|
65
|
+
// 获取表单容器组件的currentFields
|
|
66
|
+
const fields = getVariable(getParentForm(target), 'currentFields');
|
|
67
|
+
// 如果fields存在且长度大于0,则显示选择器
|
|
68
|
+
return fields && fields.length > 0;
|
|
69
|
+
},
|
|
70
|
+
props: (target) => {
|
|
71
|
+
// 获取表单容器组件的currentFields
|
|
72
|
+
const fields = getVariable(getParentForm(target), 'currentFields');
|
|
73
|
+
// 已有字段key
|
|
74
|
+
const usedFields = getDataSourceFormFields(target);
|
|
75
|
+
|
|
76
|
+
const options = fields?.map?.((item) => ({
|
|
77
|
+
title: item.uiSchema.title,
|
|
78
|
+
value: item.name,
|
|
79
|
+
disabled: usedFields.includes(item.name),
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
mode: 'single',
|
|
84
|
+
options: options || [],
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
'StringSetter',
|
|
89
|
+
],
|
|
90
|
+
extraProps: {
|
|
91
|
+
setValue(target: any, value: string | any) {
|
|
92
|
+
// 获取表单容器组件的currentFields
|
|
93
|
+
const fields = getVariable(getParentForm(target), 'currentFields');
|
|
94
|
+
// 根据value值找到对应的label
|
|
95
|
+
const field = fields.find((item: any) => item.name === value);
|
|
96
|
+
// 设置label
|
|
97
|
+
if (field) {
|
|
98
|
+
target.getProps().setPropValue('label', field.uiSchema.title);
|
|
99
|
+
// target.node.children.importSchema([createFormItemChildren(field)])
|
|
100
|
+
// 插入schema后 有概率不生效,所以这里手动rerender
|
|
101
|
+
// setTimeout(() => {
|
|
102
|
+
// target.document.project.simulatorHost.rerender();
|
|
103
|
+
// });
|
|
104
|
+
}
|
|
105
|
+
return target.getProps().setPropValue('name', value);
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
supportVariable: true,
|
|
109
|
+
},
|
|
110
|
+
tooltip: {
|
|
111
|
+
name: 'tooltip',
|
|
112
|
+
title: {
|
|
113
|
+
label: {
|
|
114
|
+
type: 'i18n',
|
|
115
|
+
'en-US': 'Tooltip',
|
|
116
|
+
'zh-CN': '提示',
|
|
117
|
+
},
|
|
118
|
+
tip: '标签提示信息,当需要对标签进行解释时,可以使用这个。',
|
|
119
|
+
},
|
|
120
|
+
propType: { type: 'oneOfType', value: ['string', 'node'] },
|
|
121
|
+
setter: ['PisellI18nSetter', 'SlotSetter'],
|
|
122
|
+
},
|
|
123
|
+
noStyle: {
|
|
124
|
+
name: 'noStyle',
|
|
125
|
+
title: {
|
|
126
|
+
label: {
|
|
127
|
+
type: 'i18n',
|
|
128
|
+
'en-US': 'Show title area',
|
|
129
|
+
'zh-CN': '隐藏标题区域',
|
|
130
|
+
},
|
|
131
|
+
tip: '是否隐藏组件的Label,包括title和tooltip,但是不包括helper text。',
|
|
132
|
+
},
|
|
133
|
+
propType: 'bool',
|
|
134
|
+
defaultValue: false,
|
|
135
|
+
setter: 'BoolSetter',
|
|
136
|
+
supportVariable: true,
|
|
137
|
+
},
|
|
138
|
+
extra: {
|
|
139
|
+
name: 'extra',
|
|
140
|
+
title: {
|
|
141
|
+
label: {
|
|
142
|
+
type: 'i18n',
|
|
143
|
+
'en-US': 'Helper text',
|
|
144
|
+
'zh-CN': '辅助说明',
|
|
145
|
+
},
|
|
146
|
+
tip: '在组件下方或上方显示的辅助说明文本。',
|
|
147
|
+
},
|
|
148
|
+
propType: { type: 'oneOfType', value: ['string', 'node'] },
|
|
149
|
+
setter: ['PisellI18nSetter', 'SlotSetter'],
|
|
150
|
+
},
|
|
151
|
+
placeholder: {
|
|
152
|
+
name: 'placeholder',
|
|
153
|
+
title: {
|
|
154
|
+
label: {
|
|
155
|
+
type: 'i18n',
|
|
156
|
+
'en-US': 'Placeholder',
|
|
157
|
+
'zh-CN': '占位提示',
|
|
158
|
+
},
|
|
159
|
+
tip: '输入框为空时显示的提示文本。',
|
|
160
|
+
},
|
|
161
|
+
propType: 'string',
|
|
162
|
+
setter: 'PisellI18nSetter',
|
|
163
|
+
},
|
|
164
|
+
mode: {
|
|
165
|
+
name: 'mode',
|
|
166
|
+
title: {
|
|
167
|
+
label: {
|
|
168
|
+
type: 'i18n',
|
|
169
|
+
'en-US': 'Status',
|
|
170
|
+
'zh-CN': '状态',
|
|
171
|
+
},
|
|
172
|
+
tip: '设置表单项的状态。',
|
|
173
|
+
},
|
|
174
|
+
setter: {
|
|
175
|
+
componentName: 'RadioGroupSetter',
|
|
176
|
+
props: {
|
|
177
|
+
options: [
|
|
178
|
+
{
|
|
179
|
+
title: '普通',
|
|
180
|
+
value: 'edit',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
title: '禁用',
|
|
184
|
+
value: 'disabled',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
title: '只读',
|
|
188
|
+
value: 'view',
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
title: '隐藏',
|
|
192
|
+
value: 'hidden',
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
},
|
|
196
|
+
initialValue: 'edit',
|
|
197
|
+
},
|
|
198
|
+
propType: {
|
|
199
|
+
type: 'oneOf',
|
|
200
|
+
value: ['edit', 'disabled', 'view', 'hidden'],
|
|
201
|
+
},
|
|
202
|
+
defaultValue: 'edit',
|
|
203
|
+
},
|
|
204
|
+
defaultValue: {
|
|
205
|
+
name: 'defaultValue',
|
|
206
|
+
title: {
|
|
207
|
+
label: {
|
|
208
|
+
type: 'i18n',
|
|
209
|
+
'en-US': 'Default value',
|
|
210
|
+
'zh-CN': '默认值',
|
|
211
|
+
},
|
|
212
|
+
tip: '默认内容',
|
|
213
|
+
},
|
|
214
|
+
propType: 'string',
|
|
215
|
+
setter: 'StringSetter',
|
|
216
|
+
},
|
|
217
|
+
requiredobj: {
|
|
218
|
+
name: 'requiredobj',
|
|
219
|
+
title: { label: '必填', tip: '必填' },
|
|
220
|
+
setter: {
|
|
221
|
+
componentName: 'ObjectSetter',
|
|
222
|
+
props: {
|
|
223
|
+
config: {
|
|
224
|
+
items: [
|
|
225
|
+
{
|
|
226
|
+
name: 'required',
|
|
227
|
+
title: '是否必填',
|
|
228
|
+
propType: 'bool',
|
|
229
|
+
setter: 'BoolSetter',
|
|
230
|
+
isRequired: true,
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: 'message',
|
|
234
|
+
title: '错误信息提示',
|
|
235
|
+
propType: 'string',
|
|
236
|
+
setter: 'PisellI18nSetter',
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
columns: 1,
|
|
241
|
+
forceInline: 1,
|
|
242
|
+
mode: 'popup',
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
minLengthobj: {
|
|
247
|
+
name: 'minLengthobj',
|
|
248
|
+
title: { label: '最小长度', tip: '最小长度' },
|
|
249
|
+
setter: {
|
|
250
|
+
componentName: 'ObjectSetter',
|
|
251
|
+
props: {
|
|
252
|
+
config: {
|
|
253
|
+
items: [
|
|
254
|
+
{
|
|
255
|
+
name: 'enabled',
|
|
256
|
+
title: '是否启用',
|
|
257
|
+
propType: 'bool',
|
|
258
|
+
setter: 'BoolSetter',
|
|
259
|
+
isRequired: true,
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: 'min',
|
|
263
|
+
title: '最小长度',
|
|
264
|
+
propType: 'number',
|
|
265
|
+
setter: 'NumberSetter',
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: 'message',
|
|
269
|
+
title: '错误信息提示',
|
|
270
|
+
propType: 'string',
|
|
271
|
+
setter: 'PisellI18nSetter',
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
},
|
|
275
|
+
columns: 1,
|
|
276
|
+
forceInline: 1,
|
|
277
|
+
mode: 'popup',
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
maxLengthobj: {
|
|
282
|
+
name: 'maxLengthobj',
|
|
283
|
+
title: { label: '最大长度', tip: '最大长度' },
|
|
284
|
+
setter: {
|
|
285
|
+
componentName: 'ObjectSetter',
|
|
286
|
+
props: {
|
|
287
|
+
config: {
|
|
288
|
+
items: [
|
|
289
|
+
{
|
|
290
|
+
name: 'enabled',
|
|
291
|
+
title: '是否启用',
|
|
292
|
+
propType: 'bool',
|
|
293
|
+
setter: 'BoolSetter',
|
|
294
|
+
isRequired: true,
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
name: 'max',
|
|
298
|
+
title: '最大长度',
|
|
299
|
+
propType: 'number',
|
|
300
|
+
setter: 'NumberSetter',
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
name: 'message',
|
|
304
|
+
title: '错误信息提示',
|
|
305
|
+
propType: 'string',
|
|
306
|
+
setter: 'PisellI18nSetter',
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
},
|
|
310
|
+
columns: 1,
|
|
311
|
+
forceInline: 1,
|
|
312
|
+
mode: 'popup',
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
typeobj: {
|
|
317
|
+
name: 'typeobj',
|
|
318
|
+
title: { label: '类型校验', tip: '类型校验' },
|
|
319
|
+
setter: {
|
|
320
|
+
componentName: 'ObjectSetter',
|
|
321
|
+
props: {
|
|
322
|
+
config: {
|
|
323
|
+
items: [
|
|
324
|
+
{
|
|
325
|
+
name: 'enabled',
|
|
326
|
+
title: '是否启用',
|
|
327
|
+
propType: 'bool',
|
|
328
|
+
setter: 'BoolSetter',
|
|
329
|
+
isRequired: true,
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
name: 'type',
|
|
333
|
+
title: '类型',
|
|
334
|
+
propType: 'string',
|
|
335
|
+
setter: {
|
|
336
|
+
componentName: 'SelectSetter',
|
|
337
|
+
props: {
|
|
338
|
+
options: [
|
|
339
|
+
{ title: '字符串', value: 'string' },
|
|
340
|
+
{ title: '邮箱', value: 'email' },
|
|
341
|
+
{ title: '网址', value: 'url' },
|
|
342
|
+
],
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: 'message',
|
|
348
|
+
title: '错误信息提示',
|
|
349
|
+
propType: 'string',
|
|
350
|
+
setter: 'PisellI18nSetter',
|
|
351
|
+
},
|
|
352
|
+
],
|
|
353
|
+
},
|
|
354
|
+
columns: 1,
|
|
355
|
+
forceInline: 1,
|
|
356
|
+
mode: 'popup',
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
maxobj: {
|
|
361
|
+
name: 'maxobj',
|
|
362
|
+
title: { label: '最大值校验设置', tip: '最大值校验设置' },
|
|
363
|
+
setter: {
|
|
364
|
+
componentName: 'ObjectSetter',
|
|
365
|
+
props: {
|
|
366
|
+
config: {
|
|
367
|
+
items: [
|
|
368
|
+
{
|
|
369
|
+
name: 'enabled',
|
|
370
|
+
title: '是否启用',
|
|
371
|
+
propType: 'bool',
|
|
372
|
+
setter: 'BoolSetter',
|
|
373
|
+
isRequired: true,
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
name: 'max',
|
|
377
|
+
title: '最大值',
|
|
378
|
+
propType: 'number',
|
|
379
|
+
setter: 'NumberSetter',
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
name: 'message',
|
|
383
|
+
title: '错误信息提示',
|
|
384
|
+
propType: 'string',
|
|
385
|
+
setter: 'PisellI18nSetter',
|
|
386
|
+
},
|
|
387
|
+
],
|
|
388
|
+
},
|
|
389
|
+
columns: 1,
|
|
390
|
+
forceInline: 1,
|
|
391
|
+
mode: 'popup',
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
minobj: {
|
|
396
|
+
name: 'minobj',
|
|
397
|
+
title: { label: '最小值校验设置', tip: '最小值校验设置' },
|
|
398
|
+
setter: {
|
|
399
|
+
componentName: 'ObjectSetter',
|
|
400
|
+
props: {
|
|
401
|
+
config: {
|
|
402
|
+
items: [
|
|
403
|
+
{
|
|
404
|
+
name: 'enabled',
|
|
405
|
+
title: '是否启用',
|
|
406
|
+
propType: 'bool',
|
|
407
|
+
setter: 'BoolSetter',
|
|
408
|
+
isRequired: true,
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
name: 'min',
|
|
412
|
+
title: '最小值',
|
|
413
|
+
propType: 'number',
|
|
414
|
+
setter: 'NumberSetter',
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
name: 'message',
|
|
418
|
+
title: '错误信息提示',
|
|
419
|
+
propType: 'string',
|
|
420
|
+
setter: 'PisellI18nSetter',
|
|
421
|
+
},
|
|
422
|
+
],
|
|
423
|
+
},
|
|
424
|
+
columns: 1,
|
|
425
|
+
forceInline: 1,
|
|
426
|
+
mode: 'popup',
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
direction: {
|
|
431
|
+
name: 'direction',
|
|
432
|
+
title: {
|
|
433
|
+
type: 'i18n',
|
|
434
|
+
'en-US': 'Direction',
|
|
435
|
+
'zh-CN': '排布方向',
|
|
436
|
+
},
|
|
437
|
+
setter: {
|
|
438
|
+
componentName: 'RadioGroupSetter',
|
|
439
|
+
props: {
|
|
440
|
+
options: [
|
|
441
|
+
{ title: '水平', value: 'horizontal' },
|
|
442
|
+
{ title: '垂直', value: 'vertical' },
|
|
443
|
+
],
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
export const formItemGeneralDataGroup = {
|
|
450
|
+
type: 'group',
|
|
451
|
+
title: {
|
|
452
|
+
type: 'i18n',
|
|
453
|
+
'en-US': 'Data',
|
|
454
|
+
'zh-CN': '数据',
|
|
455
|
+
},
|
|
456
|
+
display: 'accordion',
|
|
457
|
+
items: [
|
|
458
|
+
{
|
|
459
|
+
name: 'dataSource',
|
|
460
|
+
title: {
|
|
461
|
+
type: 'i18n',
|
|
462
|
+
'en-US': 'Source',
|
|
463
|
+
'zh-CN': '数据源',
|
|
464
|
+
},
|
|
465
|
+
extraProps: {
|
|
466
|
+
getValue(target: any) {
|
|
467
|
+
return getDataSourceValue(target);
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
setter: {
|
|
471
|
+
componentName: 'PisellDataSourceSetter',
|
|
472
|
+
props: {
|
|
473
|
+
disabled: true,
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
generalItemMap['name'],
|
|
478
|
+
],
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
export const formItemGeneralOptionTypeGroup = {
|
|
482
|
+
type: 'group',
|
|
483
|
+
title: {
|
|
484
|
+
type: 'i18n',
|
|
485
|
+
'en-US': 'Option type',
|
|
486
|
+
'zh-CN': '选项类型',
|
|
487
|
+
},
|
|
488
|
+
display: 'accordion',
|
|
489
|
+
items: [
|
|
490
|
+
{
|
|
491
|
+
name: 'optionSourceType',
|
|
492
|
+
title: {
|
|
493
|
+
type: 'i18n',
|
|
494
|
+
'en-US': 'Type',
|
|
495
|
+
'zh-CN': '类型',
|
|
496
|
+
},
|
|
497
|
+
setter: {
|
|
498
|
+
componentName: 'SelectSetter',
|
|
499
|
+
props: {
|
|
500
|
+
options: [
|
|
501
|
+
{ title: '默认', value: 'default' },
|
|
502
|
+
{ title: '自定义', value: 'custom' },
|
|
503
|
+
{ title: 'API', value: 'api' },
|
|
504
|
+
],
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
name: 'dataSource',
|
|
510
|
+
condition: (target) => {
|
|
511
|
+
const optionType = target.getProps().getPropValue('optionSourceType');
|
|
512
|
+
return optionType === 'api';
|
|
513
|
+
},
|
|
514
|
+
title: {
|
|
515
|
+
type: 'i18n',
|
|
516
|
+
'en-US': 'Data Source',
|
|
517
|
+
'zh-CN': '数据源',
|
|
518
|
+
},
|
|
519
|
+
extraProps: {
|
|
520
|
+
setValue(target: any, value: any) {
|
|
521
|
+
if (!value.item) {
|
|
522
|
+
target.getProps().setPropValue('currentFields', []);
|
|
523
|
+
return target.getProps().setPropValue('dataSource', null);
|
|
524
|
+
}
|
|
525
|
+
if (value.isSelect) {
|
|
526
|
+
target.getProps().setPropValue('currentFields', []);
|
|
527
|
+
}
|
|
528
|
+
setBatchVariables(target, [
|
|
529
|
+
{
|
|
530
|
+
label: 'currentFields',
|
|
531
|
+
value: value.item.fields,
|
|
532
|
+
},
|
|
533
|
+
]);
|
|
534
|
+
return target.getProps().setPropValue('dataSource', value.item);
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
setter: {
|
|
538
|
+
componentName: 'PisellDataSourceSetter',
|
|
539
|
+
props: {
|
|
540
|
+
mode: 'list',
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
name: 'labelField',
|
|
546
|
+
condition: (target) => {
|
|
547
|
+
const optionSourceType = target
|
|
548
|
+
.getProps()
|
|
549
|
+
.getPropValue('optionSourceType');
|
|
550
|
+
return optionSourceType === 'api';
|
|
551
|
+
},
|
|
552
|
+
title: {
|
|
553
|
+
type: 'i18n',
|
|
554
|
+
'en-US': 'Label Field',
|
|
555
|
+
'zh-CN': '选项文本字段',
|
|
556
|
+
},
|
|
557
|
+
setter: {
|
|
558
|
+
componentName: 'SelectSetter',
|
|
559
|
+
props: (target) => {
|
|
560
|
+
const fields = getVariable(target, 'currentFields');
|
|
561
|
+
return {
|
|
562
|
+
options: fields?.map?.((item) => ({
|
|
563
|
+
title: item.uiSchema.title,
|
|
564
|
+
value: item.name,
|
|
565
|
+
})),
|
|
566
|
+
};
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
name: 'valueField',
|
|
572
|
+
condition: (target) => {
|
|
573
|
+
const optionSourceType = target
|
|
574
|
+
.getProps()
|
|
575
|
+
.getPropValue('optionSourceType');
|
|
576
|
+
return optionSourceType === 'api';
|
|
577
|
+
},
|
|
578
|
+
title: {
|
|
579
|
+
type: 'i18n',
|
|
580
|
+
'en-US': 'Value Field',
|
|
581
|
+
'zh-CN': '选项值字段',
|
|
582
|
+
},
|
|
583
|
+
setter: {
|
|
584
|
+
componentName: 'SelectSetter',
|
|
585
|
+
props: (target) => {
|
|
586
|
+
// 获取表单容器组件的currentFields
|
|
587
|
+
const fields = getVariable(target, 'currentFields');
|
|
588
|
+
|
|
589
|
+
const options = fields?.map?.((item) => ({
|
|
590
|
+
title: item.uiSchema.title,
|
|
591
|
+
value: item.name,
|
|
592
|
+
}));
|
|
593
|
+
|
|
594
|
+
return {
|
|
595
|
+
mode: 'single',
|
|
596
|
+
options: options || [],
|
|
597
|
+
};
|
|
598
|
+
},
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
name: 'options',
|
|
603
|
+
condition: (target) => {
|
|
604
|
+
const optionSourceType = target
|
|
605
|
+
.getProps()
|
|
606
|
+
.getPropValue('optionSourceType');
|
|
607
|
+
return ['custom', 'default'].includes(optionSourceType);
|
|
608
|
+
},
|
|
609
|
+
title: {
|
|
610
|
+
type: 'i18n',
|
|
611
|
+
'en-US': 'Options',
|
|
612
|
+
'zh-CN': '选项',
|
|
613
|
+
},
|
|
614
|
+
setter: {
|
|
615
|
+
componentName: 'ArraySetter',
|
|
616
|
+
props: (target) => {
|
|
617
|
+
const optionSourceType = target
|
|
618
|
+
.getProps()
|
|
619
|
+
.getPropValue('optionSourceType');
|
|
620
|
+
const optionsLength = target
|
|
621
|
+
.getProps()
|
|
622
|
+
.getPropValue('options')?.length;
|
|
623
|
+
return {
|
|
624
|
+
itemMaxLength:
|
|
625
|
+
optionSourceType === 'default' ? optionsLength : 1000,
|
|
626
|
+
itemSetter: {
|
|
627
|
+
componentName: 'ObjectSetter',
|
|
628
|
+
props: {
|
|
629
|
+
config: {
|
|
630
|
+
items: [
|
|
631
|
+
{
|
|
632
|
+
name: 'label',
|
|
633
|
+
title: '选项文本',
|
|
634
|
+
propType: 'string',
|
|
635
|
+
setter: 'PisellI18nSetter',
|
|
636
|
+
isRequired: true,
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
name: 'value',
|
|
640
|
+
title: '选项值',
|
|
641
|
+
propType: 'string',
|
|
642
|
+
setter: 'StringSetter',
|
|
643
|
+
disabled: true,
|
|
644
|
+
isRequired: true,
|
|
645
|
+
},
|
|
646
|
+
],
|
|
647
|
+
},
|
|
648
|
+
},
|
|
649
|
+
},
|
|
650
|
+
};
|
|
651
|
+
},
|
|
652
|
+
},
|
|
653
|
+
},
|
|
654
|
+
],
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
// 信息分组
|
|
658
|
+
export const getFormItemGeneralInfoGroup = (children: any) => {
|
|
659
|
+
return {
|
|
660
|
+
type: 'group',
|
|
661
|
+
title: {
|
|
662
|
+
type: 'i18n',
|
|
663
|
+
'en-US': 'Info',
|
|
664
|
+
'zh-CN': '信息',
|
|
665
|
+
},
|
|
666
|
+
display: 'accordion',
|
|
667
|
+
items: children,
|
|
668
|
+
};
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
// 校验分组
|
|
672
|
+
export const getFormItemValidateGroup = (children: any) => {
|
|
673
|
+
return {
|
|
674
|
+
type: 'group',
|
|
675
|
+
title: {
|
|
676
|
+
type: 'i18n',
|
|
677
|
+
'en-US': 'Validation',
|
|
678
|
+
'zh-CN': '校验',
|
|
679
|
+
},
|
|
680
|
+
display: 'accordion',
|
|
681
|
+
items: children,
|
|
682
|
+
};
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
// 外观分组
|
|
686
|
+
export const getFormItemGeneralAppearanceGroup = (children: any) => {
|
|
687
|
+
return {
|
|
688
|
+
type: 'group',
|
|
689
|
+
title: {
|
|
690
|
+
type: 'i18n',
|
|
691
|
+
'en-US': 'Appearance',
|
|
692
|
+
'zh-CN': '外观',
|
|
693
|
+
},
|
|
694
|
+
display: 'accordion',
|
|
695
|
+
items: children,
|
|
696
|
+
};
|
|
697
|
+
};
|
|
30
698
|
|
|
31
699
|
export const formItemGeneralProps = [
|
|
32
700
|
{
|
|
@@ -70,7 +738,7 @@ export const formItemGeneralProps = [
|
|
|
70
738
|
|
|
71
739
|
return {
|
|
72
740
|
mode: 'single',
|
|
73
|
-
options:options || [],
|
|
741
|
+
options: options || [],
|
|
74
742
|
};
|
|
75
743
|
},
|
|
76
744
|
},
|
package/lowcode/_utils/utils.ts
CHANGED
|
@@ -4,3 +4,12 @@ export { get, set, has } from 'lodash';
|
|
|
4
4
|
export function uuid() {
|
|
5
5
|
return ((Math.random() * 1e6) >> 0).toString(36);
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
export const omit = (obj: Record<string, any>, keys: string[]) => {
|
|
9
|
+
const shallowCopy = Object.assign({}, obj);
|
|
10
|
+
for (let i = 0; i < keys.length; i += 1) {
|
|
11
|
+
const key = keys[i];
|
|
12
|
+
delete shallowCopy[key];
|
|
13
|
+
}
|
|
14
|
+
return shallowCopy;
|
|
15
|
+
};
|