@xbeeant/form-engine-designer 0.0.3 → 0.0.4
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/es/Canvas.js +42 -47
- package/dist/es/Canvas.js.map +1 -1
- package/dist/es/Designer.js +121 -98
- package/dist/es/Designer.js.map +1 -1
- package/dist/es/DesignerContext.js +86 -73
- package/dist/es/DesignerContext.js.map +1 -1
- package/dist/es/Palette.js +3 -3
- package/dist/es/Palette.js.map +1 -1
- package/dist/es/PropertyPanel.js +99 -100
- package/dist/es/PropertyPanel.js.map +1 -1
- package/dist/es/catalog.js +17 -10
- package/dist/es/catalog.js.map +1 -1
- package/dist/es/designer-context.js +110 -0
- package/dist/es/designer-context.js.map +1 -0
- package/dist/es/history.js +73 -0
- package/dist/es/history.js.map +1 -0
- package/dist/es/index.css +1 -1
- package/dist/es/index.js +3 -3
- package/dist/es/property/basic-property.js +6 -0
- package/dist/es/property/basic-property.js.map +1 -1
- package/dist/es/property-panel.js +294 -0
- package/dist/es/property-panel.js.map +1 -0
- package/dist/es/resizable-panel.js +103 -0
- package/dist/es/resizable-panel.js.map +1 -0
- package/dist/es/schema-utils.js +286 -0
- package/dist/es/schema-utils.js.map +1 -0
- package/dist/es/widgets/BindEditor.js +60 -49
- package/dist/es/widgets/BindEditor.js.map +1 -1
- package/dist/es/widgets/CodeEditor.js +41 -49
- package/dist/es/widgets/CodeEditor.js.map +1 -1
- package/dist/es/widgets/DefaultEditor.js +25 -30
- package/dist/es/widgets/DefaultEditor.js.map +1 -1
- package/dist/es/widgets/DependenciesEditor.js +21 -21
- package/dist/es/widgets/DependenciesEditor.js.map +1 -1
- package/dist/es/widgets/EnumEditor.js +25 -31
- package/dist/es/widgets/EnumEditor.js.map +1 -1
- package/dist/es/widgets/ExpressionSwitch.js +32 -30
- package/dist/es/widgets/ExpressionSwitch.js.map +1 -1
- package/dist/es/widgets/ReactionsEditor.js +103 -103
- package/dist/es/widgets/ReactionsEditor.js.map +1 -1
- package/dist/es/widgets/RemoteDataEditor.js +63 -63
- package/dist/es/widgets/RemoteDataEditor.js.map +1 -1
- package/dist/es/widgets/ValidateEditor.js +49 -49
- package/dist/es/widgets/ValidateEditor.js.map +1 -1
- package/dist/es/widgets/bind-editor.js +78 -0
- package/dist/es/widgets/bind-editor.js.map +1 -0
- package/dist/es/widgets/code-editor.js +76 -0
- package/dist/es/widgets/code-editor.js.map +1 -0
- package/dist/es/widgets/default-editor.js +50 -0
- package/dist/es/widgets/default-editor.js.map +1 -0
- package/dist/es/widgets/dependencies-editor.js +36 -0
- package/dist/es/widgets/dependencies-editor.js.map +1 -0
- package/dist/es/widgets/enum-editor.js +43 -0
- package/dist/es/widgets/enum-editor.js.map +1 -0
- package/dist/es/widgets/expression-builder.js +367 -0
- package/dist/es/widgets/expression-builder.js.map +1 -0
- package/dist/es/widgets/expression-model.js +340 -0
- package/dist/es/widgets/expression-model.js.map +1 -0
- package/dist/es/widgets/expression-switch.js +49 -0
- package/dist/es/widgets/expression-switch.js.map +1 -0
- package/dist/es/widgets/index.js +13 -13
- package/dist/es/widgets/index.js.map +1 -1
- package/dist/es/widgets/options-editor.js +102 -0
- package/dist/es/widgets/options-editor.js.map +1 -0
- package/dist/es/widgets/reactions-editor.js +401 -0
- package/dist/es/widgets/reactions-editor.js.map +1 -0
- package/dist/es/widgets/reactions-model.js +107 -0
- package/dist/es/widgets/reactions-model.js.map +1 -0
- package/dist/es/widgets/remote-data-editor.js +314 -0
- package/dist/es/widgets/remote-data-editor.js.map +1 -0
- package/dist/es/widgets/use-form-data-fields.js +16 -0
- package/dist/es/widgets/use-form-data-fields.js.map +1 -0
- package/dist/es/widgets/validate-editor.js +118 -0
- package/dist/es/widgets/validate-editor.js.map +1 -0
- package/package.json +4 -5
- package/dist/es/react/src/components/FormController.js +0 -160
- package/dist/es/react/src/components/FormController.js.map +0 -1
- package/dist/es/react/src/components/NexusField.js +0 -98
- package/dist/es/react/src/components/NexusField.js.map +0 -1
- package/dist/es/react/src/components/NexusForm.js +0 -128
- package/dist/es/react/src/components/NexusForm.js.map +0 -1
- package/dist/es/react/src/components/NexusFormProvider.js +0 -19
- package/dist/es/react/src/components/NexusFormProvider.js.map +0 -1
- package/dist/es/react/src/components/NexusLayout.js +0 -49
- package/dist/es/react/src/components/NexusLayout.js.map +0 -1
- package/dist/es/react/src/components/NexusObject.js +0 -65
- package/dist/es/react/src/components/NexusObject.js.map +0 -1
- package/dist/es/react/src/contexts/FieldInheritContext.js +0 -6
- package/dist/es/react/src/contexts/FieldInheritContext.js.map +0 -1
- package/dist/es/react/src/contexts/GridContext.js +0 -6
- package/dist/es/react/src/contexts/GridContext.js.map +0 -1
- package/dist/es/react/src/contexts/LayoutConfigContext.js +0 -6
- package/dist/es/react/src/contexts/LayoutConfigContext.js.map +0 -1
- package/dist/es/react/src/contexts/NexusContext.js +0 -13
- package/dist/es/react/src/contexts/NexusContext.js.map +0 -1
- package/dist/es/react/src/hooks/useForm.js +0 -13
- package/dist/es/react/src/hooks/useForm.js.map +0 -1
- package/dist/es/react/src/utils/renderTreeNode.js +0 -18
- package/dist/es/react/src/utils/renderTreeNode.js.map +0 -1
- package/dist/es/react/src/utils/resolveColSpan.js +0 -10
- package/dist/es/react/src/utils/resolveColSpan.js.map +0 -1
- package/src/Canvas.tsx +0 -1111
- package/src/Designer.css +0 -206
- package/src/Designer.tsx +0 -254
- package/src/DesignerContext.tsx +0 -192
- package/src/Palette.tsx +0 -261
- package/src/PropertyPanel.tsx +0 -486
- package/src/ResizablePanel.tsx +0 -210
- package/src/catalog.ts +0 -527
- package/src/index.ts +0 -25
- package/src/property/basic-property.ts +0 -126
- package/src/schemaUtils.test.ts +0 -261
- package/src/schemaUtils.ts +0 -627
- package/src/types.ts +0 -38
- package/src/vite-env.d.ts +0 -1
- package/src/widgets/BindEditor.tsx +0 -105
- package/src/widgets/CodeEditor.tsx +0 -114
- package/src/widgets/DefaultEditor.tsx +0 -73
- package/src/widgets/DependenciesEditor.tsx +0 -56
- package/src/widgets/EnumEditor.tsx +0 -66
- package/src/widgets/ExpressionBuilder.tsx +0 -509
- package/src/widgets/ExpressionSwitch.tsx +0 -62
- package/src/widgets/OptionsEditor.tsx +0 -141
- package/src/widgets/ReactionsEditor.tsx +0 -532
- package/src/widgets/RemoteDataEditor.tsx +0 -382
- package/src/widgets/ValidateEditor.tsx +0 -162
- package/src/widgets/expressionModel.test.ts +0 -262
- package/src/widgets/expressionModel.ts +0 -573
- package/src/widgets/index.ts +0 -45
- package/src/widgets/reactionsModel.ts +0 -190
- package/src/widgets/useFormDataFields.ts +0 -21
package/src/catalog.ts
DELETED
|
@@ -1,527 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// @xbeeant/form-engine-designer — 组件目录
|
|
3
|
-
// ============================================================================
|
|
4
|
-
|
|
5
|
-
import type { CatalogItem } from './types';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* 表单组件目录
|
|
9
|
-
* 每个项创建一个 DataFieldSchema 节点
|
|
10
|
-
* widget 名对齐 @xbeeant/form-engine-ui 中 antdWidgets 实际注册的 key
|
|
11
|
-
*/
|
|
12
|
-
export const widgetCatalog: CatalogItem[] = [
|
|
13
|
-
{
|
|
14
|
-
label: '输入框',
|
|
15
|
-
icon: '📝',
|
|
16
|
-
category: 'widget',
|
|
17
|
-
widget: 'input',
|
|
18
|
-
createNode: () => ({ type: 'string', widget: 'input', title: '输入框' }),
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
label: '密码框',
|
|
22
|
-
icon: '🔑',
|
|
23
|
-
category: 'widget',
|
|
24
|
-
widget: 'password',
|
|
25
|
-
createNode: () => ({ type: 'string', widget: 'password', title: '密码框' }),
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: '数字输入',
|
|
29
|
-
icon: '🔢',
|
|
30
|
-
category: 'widget',
|
|
31
|
-
widget: 'number',
|
|
32
|
-
createNode: () => ({ type: 'number', widget: 'number', title: '数字输入' }),
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: '文本域',
|
|
36
|
-
icon: '📄',
|
|
37
|
-
category: 'widget',
|
|
38
|
-
widget: 'textarea',
|
|
39
|
-
createNode: () => ({ type: 'string', widget: 'textarea', title: '文本域' }),
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: '下拉选择',
|
|
43
|
-
icon: '📋',
|
|
44
|
-
category: 'widget',
|
|
45
|
-
widget: 'select',
|
|
46
|
-
createNode: () => ({
|
|
47
|
-
type: 'string',
|
|
48
|
-
widget: 'select',
|
|
49
|
-
title: '下拉选择',
|
|
50
|
-
enum: ['option1', 'option2'],
|
|
51
|
-
enumNames: ['选项1', '选项2'],
|
|
52
|
-
}),
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
label: '下拉选择(远程)',
|
|
56
|
-
icon: '📡',
|
|
57
|
-
category: 'widget',
|
|
58
|
-
widget: 'selectWithRemote',
|
|
59
|
-
createNode: () => ({
|
|
60
|
-
type: 'string',
|
|
61
|
-
widget: 'selectWithRemote',
|
|
62
|
-
title: '下拉选择(远程)',
|
|
63
|
-
remoteData: {
|
|
64
|
-
url: '/api/options',
|
|
65
|
-
method: 'GET',
|
|
66
|
-
responseField: { data: 'data.list', value: 'id', label: 'name' },
|
|
67
|
-
params: { page: 1, pageSize: 50 },
|
|
68
|
-
},
|
|
69
|
-
}),
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
label: '单选',
|
|
73
|
-
icon: '🔘',
|
|
74
|
-
category: 'widget',
|
|
75
|
-
widget: 'radio',
|
|
76
|
-
createNode: () => ({
|
|
77
|
-
type: 'string',
|
|
78
|
-
widget: 'radio',
|
|
79
|
-
title: '单选',
|
|
80
|
-
enum: ['a', 'b'],
|
|
81
|
-
enumNames: ['选项A', '选项B'],
|
|
82
|
-
}),
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
label: '复选框',
|
|
86
|
-
icon: '☑️',
|
|
87
|
-
category: 'widget',
|
|
88
|
-
widget: 'checkbox',
|
|
89
|
-
createNode: () => ({
|
|
90
|
-
type: 'boolean',
|
|
91
|
-
widget: 'checkbox',
|
|
92
|
-
title: '复选框',
|
|
93
|
-
}),
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
label: '多选',
|
|
97
|
-
icon: '☒',
|
|
98
|
-
category: 'widget',
|
|
99
|
-
widget: 'checkboxes',
|
|
100
|
-
createNode: () => ({
|
|
101
|
-
type: 'array',
|
|
102
|
-
widget: 'checkboxes',
|
|
103
|
-
title: '多选',
|
|
104
|
-
enum: ['a', 'b'],
|
|
105
|
-
enumNames: ['选项A', '选项B'],
|
|
106
|
-
}),
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
label: '多选下拉',
|
|
110
|
-
icon: '📊',
|
|
111
|
-
category: 'widget',
|
|
112
|
-
widget: 'multiSelect',
|
|
113
|
-
createNode: () => ({
|
|
114
|
-
type: 'array',
|
|
115
|
-
widget: 'multiSelect',
|
|
116
|
-
title: '多选下拉',
|
|
117
|
-
enum: ['a', 'b'],
|
|
118
|
-
enumNames: ['选项A', '选项B'],
|
|
119
|
-
}),
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
label: '多选下拉(远程)',
|
|
123
|
-
icon: '📡',
|
|
124
|
-
category: 'widget',
|
|
125
|
-
widget: 'multiSelectWithRemote',
|
|
126
|
-
createNode: () => ({
|
|
127
|
-
type: 'array',
|
|
128
|
-
widget: 'multiSelectWithRemote',
|
|
129
|
-
title: '多选下拉(远程)',
|
|
130
|
-
remoteData: {
|
|
131
|
-
url: '/api/multi-options',
|
|
132
|
-
method: 'GET',
|
|
133
|
-
responseField: { data: 'data.list', value: 'id', label: 'name' },
|
|
134
|
-
params: { page: 1, pageSize: 50 },
|
|
135
|
-
},
|
|
136
|
-
}),
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
label: '开关',
|
|
140
|
-
icon: '🔀',
|
|
141
|
-
category: 'widget',
|
|
142
|
-
widget: 'switch',
|
|
143
|
-
createNode: () => ({ type: 'boolean', widget: 'switch', title: '开关' }),
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
label: '日期选择',
|
|
147
|
-
icon: '📅',
|
|
148
|
-
category: 'widget',
|
|
149
|
-
widget: 'date',
|
|
150
|
-
createNode: () => ({ type: 'string', widget: 'date', title: '日期选择' }),
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
label: '日期范围',
|
|
154
|
-
icon: '📅',
|
|
155
|
-
category: 'widget',
|
|
156
|
-
widget: 'dateRange',
|
|
157
|
-
createNode: () => ({
|
|
158
|
-
type: 'string',
|
|
159
|
-
widget: 'dateRange',
|
|
160
|
-
title: '日期范围',
|
|
161
|
-
}),
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
label: '时间选择',
|
|
165
|
-
icon: '⏰',
|
|
166
|
-
category: 'widget',
|
|
167
|
-
widget: 'time',
|
|
168
|
-
createNode: () => ({ type: 'string', widget: 'time', title: '时间选择' }),
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
label: '时间范围',
|
|
172
|
-
icon: '⏰',
|
|
173
|
-
category: 'widget',
|
|
174
|
-
widget: 'timeRange',
|
|
175
|
-
createNode: () => ({
|
|
176
|
-
type: 'string',
|
|
177
|
-
widget: 'timeRange',
|
|
178
|
-
title: '时间范围',
|
|
179
|
-
}),
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
label: '滑块',
|
|
183
|
-
icon: '🎚️',
|
|
184
|
-
category: 'widget',
|
|
185
|
-
widget: 'slider',
|
|
186
|
-
createNode: () => ({ type: 'number', widget: 'slider', title: '滑块' }),
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
label: '颜色选择',
|
|
190
|
-
icon: '🎨',
|
|
191
|
-
category: 'widget',
|
|
192
|
-
widget: 'color',
|
|
193
|
-
createNode: () => ({ type: 'string', widget: 'color', title: '颜色选择' }),
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
label: 'URL输入',
|
|
197
|
-
icon: '🔗',
|
|
198
|
-
category: 'widget',
|
|
199
|
-
widget: 'urlInput',
|
|
200
|
-
createNode: () => ({
|
|
201
|
-
type: 'string',
|
|
202
|
-
widget: 'urlInput',
|
|
203
|
-
title: 'URL输入',
|
|
204
|
-
}),
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
label: '图片上传',
|
|
208
|
-
icon: '🖼️',
|
|
209
|
-
category: 'widget',
|
|
210
|
-
widget: 'image',
|
|
211
|
-
createNode: () => ({ type: 'string', widget: 'image', title: '图片上传' }),
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
label: 'HTML展示',
|
|
215
|
-
icon: '📄',
|
|
216
|
-
category: 'widget',
|
|
217
|
-
widget: 'html',
|
|
218
|
-
createNode: () => ({ type: 'string', widget: 'html', title: 'HTML展示' }),
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
label: '标题文字',
|
|
222
|
-
icon: '🏷️',
|
|
223
|
-
category: 'widget',
|
|
224
|
-
widget: 'voidTitle',
|
|
225
|
-
createNode: () => ({
|
|
226
|
-
type: 'string',
|
|
227
|
-
widget: 'voidTitle',
|
|
228
|
-
title: '标题文字',
|
|
229
|
-
label: false,
|
|
230
|
-
}),
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
label: '树选择',
|
|
234
|
-
icon: '🌲',
|
|
235
|
-
category: 'widget',
|
|
236
|
-
widget: 'treeSelect',
|
|
237
|
-
createNode: () => ({
|
|
238
|
-
type: 'string',
|
|
239
|
-
widget: 'treeSelect',
|
|
240
|
-
title: '树选择',
|
|
241
|
-
}),
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
label: '自动完成',
|
|
245
|
-
icon: '🔎',
|
|
246
|
-
category: 'widget',
|
|
247
|
-
widget: 'autoComplete',
|
|
248
|
-
createNode: () => ({
|
|
249
|
-
type: 'string',
|
|
250
|
-
widget: 'autoComplete',
|
|
251
|
-
title: '自动完成',
|
|
252
|
-
enum: ['option1', 'option2'],
|
|
253
|
-
enumNames: ['选项1', '选项2'],
|
|
254
|
-
}),
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
label: '自动完成(远程)',
|
|
258
|
-
icon: '📡',
|
|
259
|
-
category: 'widget',
|
|
260
|
-
widget: 'autoCompleteWithRemote',
|
|
261
|
-
createNode: () => ({
|
|
262
|
-
type: 'string',
|
|
263
|
-
widget: 'autoCompleteWithRemote',
|
|
264
|
-
title: '自动完成(远程)',
|
|
265
|
-
remoteData: {
|
|
266
|
-
url: '/api/suggestions',
|
|
267
|
-
method: 'GET',
|
|
268
|
-
responseField: { data: 'data.suggestions', value: 'id', label: 'name' },
|
|
269
|
-
params: { keyword: '' },
|
|
270
|
-
},
|
|
271
|
-
}),
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
label: '级联选择',
|
|
275
|
-
icon: '🌳',
|
|
276
|
-
category: 'widget',
|
|
277
|
-
widget: 'cascader',
|
|
278
|
-
createNode: () => ({
|
|
279
|
-
type: 'array',
|
|
280
|
-
widget: 'cascader',
|
|
281
|
-
title: '级联选择',
|
|
282
|
-
enum: ['a', 'b'],
|
|
283
|
-
enumNames: ['选项A', '选项B'],
|
|
284
|
-
}),
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
label: '级联选择(远程)',
|
|
288
|
-
icon: '📡',
|
|
289
|
-
category: 'widget',
|
|
290
|
-
widget: 'cascaderWithRemote',
|
|
291
|
-
createNode: () => ({
|
|
292
|
-
type: 'array',
|
|
293
|
-
widget: 'cascaderWithRemote',
|
|
294
|
-
title: '级联选择(远程)',
|
|
295
|
-
remoteData: {
|
|
296
|
-
url: '/api/cascader/nodes',
|
|
297
|
-
method: 'GET',
|
|
298
|
-
responseField: {
|
|
299
|
-
data: 'data.children',
|
|
300
|
-
value: 'id',
|
|
301
|
-
label: 'name',
|
|
302
|
-
parentIdKey: 'parentId',
|
|
303
|
-
},
|
|
304
|
-
params: { parentId: null },
|
|
305
|
-
},
|
|
306
|
-
}),
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
label: '提及',
|
|
310
|
-
icon: '💬',
|
|
311
|
-
category: 'widget',
|
|
312
|
-
widget: 'mentions',
|
|
313
|
-
createNode: () => ({
|
|
314
|
-
type: 'string',
|
|
315
|
-
widget: 'mentions',
|
|
316
|
-
title: '提及',
|
|
317
|
-
enum: ['alice', 'bob'],
|
|
318
|
-
enumNames: ['Alice', 'Bob'],
|
|
319
|
-
}),
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
label: '提及(远程)',
|
|
323
|
-
icon: '📡',
|
|
324
|
-
category: 'widget',
|
|
325
|
-
widget: 'mentionsWithRemote',
|
|
326
|
-
createNode: () => ({
|
|
327
|
-
type: 'string',
|
|
328
|
-
widget: 'mentionsWithRemote',
|
|
329
|
-
title: '提及(远程)',
|
|
330
|
-
remoteData: {
|
|
331
|
-
url: '/api/users/suggestions',
|
|
332
|
-
method: 'GET',
|
|
333
|
-
responseField: { data: 'data.users', value: 'id', label: 'name' },
|
|
334
|
-
params: { keyword: '' },
|
|
335
|
-
},
|
|
336
|
-
}),
|
|
337
|
-
},
|
|
338
|
-
{
|
|
339
|
-
label: '分段控制器',
|
|
340
|
-
icon: '🎚️',
|
|
341
|
-
category: 'widget',
|
|
342
|
-
widget: 'segmented',
|
|
343
|
-
createNode: () => ({
|
|
344
|
-
type: 'string',
|
|
345
|
-
widget: 'segmented',
|
|
346
|
-
title: '分段控制器',
|
|
347
|
-
enum: ['a', 'b'],
|
|
348
|
-
enumNames: ['选项A', '选项B'],
|
|
349
|
-
}),
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
label: '穿梭框',
|
|
353
|
-
icon: '⇄',
|
|
354
|
-
category: 'widget',
|
|
355
|
-
widget: 'transfer',
|
|
356
|
-
createNode: () => ({
|
|
357
|
-
type: 'array',
|
|
358
|
-
widget: 'transfer',
|
|
359
|
-
title: '穿梭框',
|
|
360
|
-
}),
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
label: '文件上传',
|
|
364
|
-
icon: '📎',
|
|
365
|
-
category: 'widget',
|
|
366
|
-
widget: 'file',
|
|
367
|
-
createNode: () => ({ type: 'array', widget: 'file', title: '文件上传' }),
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
label: '数据对象',
|
|
371
|
-
icon: '🗂️',
|
|
372
|
-
category: 'widget',
|
|
373
|
-
widget: 'object',
|
|
374
|
-
createNode: () => ({ type: 'object', title: '数据对象', properties: {} }),
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
label: '常规列表',
|
|
378
|
-
icon: '📋',
|
|
379
|
-
category: 'widget',
|
|
380
|
-
widget: 'list',
|
|
381
|
-
createNode: () => ({
|
|
382
|
-
type: 'array',
|
|
383
|
-
widget: 'list',
|
|
384
|
-
title: '常规列表',
|
|
385
|
-
items: {
|
|
386
|
-
type: 'object',
|
|
387
|
-
properties: {},
|
|
388
|
-
},
|
|
389
|
-
}),
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
label: '简单列表',
|
|
393
|
-
icon: '📃',
|
|
394
|
-
category: 'widget',
|
|
395
|
-
widget: 'simpleList',
|
|
396
|
-
createNode: () => ({
|
|
397
|
-
type: 'array',
|
|
398
|
-
widget: 'simpleList',
|
|
399
|
-
title: '简单列表',
|
|
400
|
-
items: {
|
|
401
|
-
type: 'object',
|
|
402
|
-
properties: {},
|
|
403
|
-
},
|
|
404
|
-
}),
|
|
405
|
-
},
|
|
406
|
-
{
|
|
407
|
-
label: '表格列表',
|
|
408
|
-
icon: '📊',
|
|
409
|
-
category: 'widget',
|
|
410
|
-
widget: 'tableList',
|
|
411
|
-
createNode: () => ({
|
|
412
|
-
type: 'array',
|
|
413
|
-
widget: 'tableList',
|
|
414
|
-
title: '表格列表',
|
|
415
|
-
items: {
|
|
416
|
-
type: 'object',
|
|
417
|
-
properties: {},
|
|
418
|
-
},
|
|
419
|
-
}),
|
|
420
|
-
},
|
|
421
|
-
];
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* 布局组件目录
|
|
425
|
-
* 每个项创建一个 LayoutContainerSchema 节点
|
|
426
|
-
*/
|
|
427
|
-
export const layoutCatalog: CatalogItem[] = [
|
|
428
|
-
{
|
|
429
|
-
label: '卡片',
|
|
430
|
-
icon: '📦',
|
|
431
|
-
category: 'layout',
|
|
432
|
-
layoutType: 'card',
|
|
433
|
-
createNode: () => ({ type: 'card', title: '卡片', properties: {} }),
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
label: '栅格',
|
|
437
|
-
icon: '🔲',
|
|
438
|
-
category: 'layout',
|
|
439
|
-
layoutType: 'grid',
|
|
440
|
-
createNode: () => ({ type: 'grid', column: 2, properties: {} }),
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
label: '标签页',
|
|
444
|
-
icon: '📑',
|
|
445
|
-
category: 'layout',
|
|
446
|
-
layoutType: 'tabs',
|
|
447
|
-
createNode: () => ({
|
|
448
|
-
type: 'tabs',
|
|
449
|
-
title: '标签页',
|
|
450
|
-
properties: {
|
|
451
|
-
pane1: { type: 'tabPane', title: '标签页签 1', properties: {} },
|
|
452
|
-
},
|
|
453
|
-
}),
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
label: '标签页签',
|
|
457
|
-
icon: '📑',
|
|
458
|
-
category: 'layout',
|
|
459
|
-
layoutType: 'tabPane',
|
|
460
|
-
createNode: () => ({ type: 'tabPane', title: '标签页签', properties: {} }),
|
|
461
|
-
},
|
|
462
|
-
{
|
|
463
|
-
label: '折叠面板',
|
|
464
|
-
icon: '📂',
|
|
465
|
-
category: 'layout',
|
|
466
|
-
layoutType: 'collapse',
|
|
467
|
-
createNode: () => ({
|
|
468
|
-
type: 'collapse',
|
|
469
|
-
title: '折叠面板',
|
|
470
|
-
properties: {
|
|
471
|
-
panel1: { type: 'collapsePanel', title: '折叠面板 1', properties: {} },
|
|
472
|
-
},
|
|
473
|
-
}),
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
label: '折叠面板项',
|
|
477
|
-
icon: '📂',
|
|
478
|
-
category: 'layout',
|
|
479
|
-
layoutType: 'collapsePanel',
|
|
480
|
-
createNode: () => ({
|
|
481
|
-
type: 'collapsePanel',
|
|
482
|
-
title: '折叠面板项',
|
|
483
|
-
properties: {},
|
|
484
|
-
}),
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
label: '步骤条',
|
|
488
|
-
icon: '📝',
|
|
489
|
-
category: 'layout',
|
|
490
|
-
layoutType: 'steps',
|
|
491
|
-
createNode: () => ({
|
|
492
|
-
type: 'steps',
|
|
493
|
-
title: '步骤条',
|
|
494
|
-
properties: {
|
|
495
|
-
step1: { type: 'step', title: '步骤 1', properties: {} },
|
|
496
|
-
},
|
|
497
|
-
}),
|
|
498
|
-
},
|
|
499
|
-
{
|
|
500
|
-
label: '步骤项',
|
|
501
|
-
icon: '📝',
|
|
502
|
-
category: 'layout',
|
|
503
|
-
layoutType: 'step',
|
|
504
|
-
createNode: () => ({ type: 'step', title: '步骤项', properties: {} }),
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
label: '分割线',
|
|
508
|
-
icon: '➖',
|
|
509
|
-
category: 'layout',
|
|
510
|
-
layoutType: 'divider',
|
|
511
|
-
createNode: () => ({ type: 'divider', properties: {} }),
|
|
512
|
-
},
|
|
513
|
-
{
|
|
514
|
-
label: '弹性布局',
|
|
515
|
-
icon: '📐',
|
|
516
|
-
category: 'layout',
|
|
517
|
-
layoutType: 'flex',
|
|
518
|
-
createNode: () => ({ type: 'flex', properties: {} }),
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
label: '间距布局',
|
|
522
|
-
icon: '↔️',
|
|
523
|
-
category: 'layout',
|
|
524
|
-
layoutType: 'space',
|
|
525
|
-
createNode: () => ({ type: 'space', properties: {} }),
|
|
526
|
-
},
|
|
527
|
-
];
|
package/src/index.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// @xbeeant/form-engine-designer — 公共 API
|
|
3
|
-
// ============================================================================
|
|
4
|
-
|
|
5
|
-
export { layoutCatalog, widgetCatalog } from './catalog';
|
|
6
|
-
export type { DesignerProps } from './Designer';
|
|
7
|
-
export { Designer } from './Designer';
|
|
8
|
-
export type { DesignerContextValue } from './DesignerContext';
|
|
9
|
-
export { DesignerProvider, useDesigner } from './DesignerContext';
|
|
10
|
-
export {
|
|
11
|
-
addChildToSchema,
|
|
12
|
-
collectDataFieldOptions,
|
|
13
|
-
collectDataFieldPaths,
|
|
14
|
-
flattenNodeForPropertyEditor,
|
|
15
|
-
getNodeAtProperties,
|
|
16
|
-
removeNodeFromSchema,
|
|
17
|
-
updateNodeInSchema,
|
|
18
|
-
updateNodeWithNesting,
|
|
19
|
-
} from './schemaUtils';
|
|
20
|
-
export type {
|
|
21
|
-
CatalogItem,
|
|
22
|
-
DesignerMode,
|
|
23
|
-
FieldDef,
|
|
24
|
-
SchemaPath,
|
|
25
|
-
} from './types';
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import type { SchemaNode } from '@xbeeant/form-engine';
|
|
2
|
-
|
|
3
|
-
// ============================================================================
|
|
4
|
-
// 属性面板各分组的字段定义(扁平结构,由 PropertyPanel 包裹进 collapse 分组)
|
|
5
|
-
// ============================================================================
|
|
6
|
-
|
|
7
|
-
// ── 通用属性 ──────────────────────────────────────────────────────────────
|
|
8
|
-
export const commonPropertyFields: Record<string, SchemaNode> = {
|
|
9
|
-
title: {
|
|
10
|
-
widget: 'input',
|
|
11
|
-
type: 'string',
|
|
12
|
-
title: '标题(title)',
|
|
13
|
-
},
|
|
14
|
-
description: {
|
|
15
|
-
widget: 'textarea',
|
|
16
|
-
type: 'string',
|
|
17
|
-
title: '描述(description)',
|
|
18
|
-
},
|
|
19
|
-
placeholder: {
|
|
20
|
-
widget: 'input',
|
|
21
|
-
type: 'string',
|
|
22
|
-
title: '占位提示(placeholder)',
|
|
23
|
-
},
|
|
24
|
-
default: {
|
|
25
|
-
widget: 'input',
|
|
26
|
-
type: 'string',
|
|
27
|
-
title: '默认值(default)',
|
|
28
|
-
},
|
|
29
|
-
extra: {
|
|
30
|
-
widget: 'input',
|
|
31
|
-
type: 'string',
|
|
32
|
-
title: '额外说明(extra)',
|
|
33
|
-
},
|
|
34
|
-
// ── 状态控制 ────────────────────────────────────────────────────────────
|
|
35
|
-
disabled: {
|
|
36
|
-
widget: 'propertyExpr',
|
|
37
|
-
type: 'string',
|
|
38
|
-
title: '禁用(disabled)',
|
|
39
|
-
},
|
|
40
|
-
readOnly: {
|
|
41
|
-
widget: 'propertyExpr',
|
|
42
|
-
type: 'string',
|
|
43
|
-
title: '只读(readOnly)',
|
|
44
|
-
},
|
|
45
|
-
readOnlyWidget: {
|
|
46
|
-
widget: 'input',
|
|
47
|
-
type: 'string',
|
|
48
|
-
title: '只读渲染组件(readOnlyWidget)',
|
|
49
|
-
placeholder: '如 html,未配置时沿用只读文本渲染',
|
|
50
|
-
},
|
|
51
|
-
hidden: {
|
|
52
|
-
widget: 'propertyExpr',
|
|
53
|
-
type: 'string',
|
|
54
|
-
title: '隐藏(hidden)',
|
|
55
|
-
},
|
|
56
|
-
// ── 布局尺寸(x-render 对齐)──────────────────────────────────────────
|
|
57
|
-
width: {
|
|
58
|
-
widget: 'input',
|
|
59
|
-
type: 'string',
|
|
60
|
-
title: '单元素宽度(width)',
|
|
61
|
-
placeholder: '如 20%',
|
|
62
|
-
},
|
|
63
|
-
colSpan: {
|
|
64
|
-
widget: 'number',
|
|
65
|
-
type: 'number',
|
|
66
|
-
title: '栅格跨度(colSpan)',
|
|
67
|
-
placeholder: 'grid 列数的整数倍',
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
// ── 校验配置 ──────────────────────────────────────────────────────────────
|
|
72
|
-
// 字段级约束(pattern/min/max)由 SchemaParser 自动转换为 ValidationRule;
|
|
73
|
-
// 完整的 rules 数组可通过「Schema」标签页直接编辑 JSON。
|
|
74
|
-
export const validationPropertyFields: Record<string, SchemaNode> = {
|
|
75
|
-
required: {
|
|
76
|
-
widget: 'propertyExpr',
|
|
77
|
-
type: 'string',
|
|
78
|
-
title: '必填(required)',
|
|
79
|
-
},
|
|
80
|
-
pattern: {
|
|
81
|
-
widget: 'input',
|
|
82
|
-
type: 'string',
|
|
83
|
-
title: '正则校验(pattern)',
|
|
84
|
-
placeholder: '如 ^1[3-9]\\d{9}$',
|
|
85
|
-
},
|
|
86
|
-
min: {
|
|
87
|
-
widget: 'number',
|
|
88
|
-
type: 'number',
|
|
89
|
-
title: '最小值/最小长度(min)',
|
|
90
|
-
placeholder: 'number→数值 / string→长度 / array→项数',
|
|
91
|
-
},
|
|
92
|
-
max: {
|
|
93
|
-
widget: 'number',
|
|
94
|
-
type: 'number',
|
|
95
|
-
title: '最大值/最大长度(max)',
|
|
96
|
-
placeholder: 'number→数值 / string→长度 / array→项数',
|
|
97
|
-
},
|
|
98
|
-
validate: {
|
|
99
|
-
widget: 'propertyValidate',
|
|
100
|
-
type: 'string',
|
|
101
|
-
title: '跨字段校验(validate)',
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
// ── 依赖配置 ──────────────────────────────────────────────────────────────
|
|
106
|
-
export const dependencyPropertyFields: Record<string, SchemaNode> = {
|
|
107
|
-
bind: {
|
|
108
|
-
widget: 'propertyBind',
|
|
109
|
-
type: 'string',
|
|
110
|
-
title: '数据绑定(bind)',
|
|
111
|
-
},
|
|
112
|
-
dependencies: {
|
|
113
|
-
widget: 'propertyDependencies',
|
|
114
|
-
type: 'string',
|
|
115
|
-
title: '依赖字段(dependencies)',
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
// ── 联动配置 ──────────────────────────────────────────────────────────────
|
|
120
|
-
export const reactionPropertyFields: Record<string, SchemaNode> = {
|
|
121
|
-
reactions: {
|
|
122
|
-
widget: 'propertyReactions',
|
|
123
|
-
type: 'string',
|
|
124
|
-
title: '联动规则(reactions)',
|
|
125
|
-
},
|
|
126
|
-
};
|