ronds-metadata 1.1.85 → 1.1.87
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/es/comps/FormGenerator/Provider.d.ts +3 -0
- package/es/comps/FormGenerator/Provider.js +8 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +15 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +13 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +11 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +11 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +11 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +11 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.d.ts +1 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +114 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.d.ts +7 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +44 -0
- package/es/comps/FormGenerator/comps/Canvas/core/index.d.ts +7 -0
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +170 -0
- package/es/comps/FormGenerator/comps/Canvas/core/index.less +24 -0
- package/es/comps/FormGenerator/comps/Canvas/index.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/index.js +109 -0
- package/es/comps/FormGenerator/comps/Settings/index.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Settings/index.js +116 -0
- package/es/comps/FormGenerator/comps/Sidebar/Elements.d.ts +6 -0
- package/es/comps/FormGenerator/comps/Sidebar/Elements.js +48 -0
- package/es/comps/FormGenerator/comps/Sidebar/index.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Sidebar/index.js +37 -0
- package/es/comps/FormGenerator/index.d.ts +5 -0
- package/es/comps/FormGenerator/index.js +30 -0
- package/es/comps/FormGenerator/index.less +21 -0
- package/es/comps/FormGenerator/settings/index.d.ts +702 -0
- package/es/comps/FormGenerator/settings/index.js +206 -0
- package/es/comps/FormGenerator/settings/ruleConfig.d.ts +364 -0
- package/es/comps/FormGenerator/settings/ruleConfig.js +346 -0
- package/es/comps/FormGenerator/transformer.d.ts +13 -0
- package/es/comps/FormGenerator/transformer.js +66 -0
- package/es/comps/MetadataForm/DataCell/Input.js +11 -3
- package/es/comps/MetadataForm/DataCell/Number.js +11 -4
- package/es/comps/MetadataForm/DataCell/Ref.js +3 -3
- package/es/comps/MetadataForm/DataCell/Select.js +11 -3
- package/es/comps/MetadataForm/DataCell/Switch.js +11 -3
- package/es/comps/MetadataForm/index.js +10 -4
- package/es/config.js +2 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/theme.less +4 -0
- package/package.json +1 -1
@@ -0,0 +1,346 @@
|
|
1
|
+
/*
|
2
|
+
* @Author: wangxian
|
3
|
+
* @Date: 2023-02-08 10:36:25
|
4
|
+
* @LastEditTime: 2023-02-09 14:08:23
|
5
|
+
*/
|
6
|
+
import { DEFAULT_DATE_FORMAT } from '../../../comps/MetadataForm/DataCell/Input';
|
7
|
+
export var Rule = {
|
8
|
+
common: {
|
9
|
+
id: {
|
10
|
+
id: 'id',
|
11
|
+
type: 'text',
|
12
|
+
fields: [{
|
13
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
14
|
+
type: 'ref',
|
15
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
16
|
+
value: {
|
17
|
+
label: 'ID',
|
18
|
+
tooltip: '字段名称(仅支持英文)'
|
19
|
+
}
|
20
|
+
}]
|
21
|
+
},
|
22
|
+
label: {
|
23
|
+
id: 'label',
|
24
|
+
type: 'text',
|
25
|
+
fields: [{
|
26
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
27
|
+
type: 'ref',
|
28
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
29
|
+
value: {
|
30
|
+
label: '标题'
|
31
|
+
}
|
32
|
+
}]
|
33
|
+
},
|
34
|
+
color: {
|
35
|
+
id: 'color',
|
36
|
+
type: 'text',
|
37
|
+
fields: [{
|
38
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
39
|
+
type: 'ref',
|
40
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
41
|
+
value: {
|
42
|
+
label: '标题颜色',
|
43
|
+
type: 'colorPicker'
|
44
|
+
}
|
45
|
+
}]
|
46
|
+
},
|
47
|
+
defaultValue: {
|
48
|
+
id: 'defaultValue',
|
49
|
+
type: 'text',
|
50
|
+
fields: [{
|
51
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
52
|
+
type: 'ref',
|
53
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
54
|
+
value: {
|
55
|
+
label: '默认值'
|
56
|
+
}
|
57
|
+
}]
|
58
|
+
},
|
59
|
+
help: {
|
60
|
+
id: 'help',
|
61
|
+
type: 'text',
|
62
|
+
fields: [{
|
63
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
64
|
+
type: 'ref',
|
65
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
66
|
+
value: {
|
67
|
+
label: '帮助说明'
|
68
|
+
}
|
69
|
+
}]
|
70
|
+
},
|
71
|
+
tooltip: {
|
72
|
+
id: 'tooltip',
|
73
|
+
type: 'text',
|
74
|
+
fields: [{
|
75
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
76
|
+
type: 'ref',
|
77
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
78
|
+
value: {
|
79
|
+
label: '提示说明'
|
80
|
+
}
|
81
|
+
}]
|
82
|
+
},
|
83
|
+
placeholder: {
|
84
|
+
id: 'placeholder',
|
85
|
+
type: 'text',
|
86
|
+
fields: [{
|
87
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
88
|
+
type: 'ref',
|
89
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
90
|
+
value: {
|
91
|
+
label: '默认文本'
|
92
|
+
}
|
93
|
+
}]
|
94
|
+
},
|
95
|
+
require: {
|
96
|
+
id: 'require',
|
97
|
+
type: 'bool',
|
98
|
+
fields: [{
|
99
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
100
|
+
type: 'ref',
|
101
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
102
|
+
value: {
|
103
|
+
label: '是否必填'
|
104
|
+
}
|
105
|
+
}]
|
106
|
+
},
|
107
|
+
disabled: {
|
108
|
+
id: 'disabled',
|
109
|
+
type: 'bool',
|
110
|
+
fields: [{
|
111
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
112
|
+
type: 'ref',
|
113
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
114
|
+
value: {
|
115
|
+
label: '是否禁用'
|
116
|
+
}
|
117
|
+
}]
|
118
|
+
},
|
119
|
+
hidden: {
|
120
|
+
id: 'hidden',
|
121
|
+
type: 'bool',
|
122
|
+
fields: [{
|
123
|
+
id: 'Rule.Form',
|
124
|
+
type: 'ref',
|
125
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
126
|
+
value: {
|
127
|
+
common: {
|
128
|
+
label: '是否隐藏'
|
129
|
+
},
|
130
|
+
'common-en-US': {}
|
131
|
+
}
|
132
|
+
}]
|
133
|
+
}
|
134
|
+
},
|
135
|
+
depend: {
|
136
|
+
hidden: {
|
137
|
+
id: 'hidden',
|
138
|
+
type: 'text',
|
139
|
+
fields: [{
|
140
|
+
id: 'Rule.Form',
|
141
|
+
type: 'ref',
|
142
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
143
|
+
value: {
|
144
|
+
text: {},
|
145
|
+
common: {
|
146
|
+
label: '隐藏'
|
147
|
+
},
|
148
|
+
'common-en-US': {}
|
149
|
+
}
|
150
|
+
}]
|
151
|
+
},
|
152
|
+
show: {
|
153
|
+
id: 'show',
|
154
|
+
type: 'text',
|
155
|
+
fields: [{
|
156
|
+
id: 'Rule.Form',
|
157
|
+
type: 'ref',
|
158
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
159
|
+
value: {
|
160
|
+
text: {},
|
161
|
+
common: {
|
162
|
+
label: '显示',
|
163
|
+
depend: {}
|
164
|
+
},
|
165
|
+
'common-en-US': {}
|
166
|
+
}
|
167
|
+
}]
|
168
|
+
}
|
169
|
+
},
|
170
|
+
text: {
|
171
|
+
type: {
|
172
|
+
id: 'type',
|
173
|
+
enum: [{
|
174
|
+
value: 'colorPicker'
|
175
|
+
}, {
|
176
|
+
value: 'datePicker'
|
177
|
+
}, {
|
178
|
+
value: 'password'
|
179
|
+
}, {
|
180
|
+
value: 'textarea'
|
181
|
+
}, {
|
182
|
+
value: 'upload'
|
183
|
+
}, {
|
184
|
+
value: 'buttonCell'
|
185
|
+
}],
|
186
|
+
type: 'enum',
|
187
|
+
fields: [{
|
188
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
189
|
+
type: 'ref',
|
190
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
191
|
+
value: {
|
192
|
+
enum: {
|
193
|
+
value: [{
|
194
|
+
key: 'textarea',
|
195
|
+
value: '文本框'
|
196
|
+
}, {
|
197
|
+
key: 'password',
|
198
|
+
value: '密码框'
|
199
|
+
}, {
|
200
|
+
key: 'datePicker',
|
201
|
+
value: '日期选择框'
|
202
|
+
}, {
|
203
|
+
key: 'colorPicker',
|
204
|
+
value: '颜色选择框'
|
205
|
+
}, {
|
206
|
+
key: 'upload',
|
207
|
+
value: '上传'
|
208
|
+
}]
|
209
|
+
},
|
210
|
+
text: {},
|
211
|
+
common: {
|
212
|
+
label: '类型'
|
213
|
+
}
|
214
|
+
}
|
215
|
+
}]
|
216
|
+
},
|
217
|
+
format: {
|
218
|
+
id: 'format',
|
219
|
+
type: 'text',
|
220
|
+
fields: [{
|
221
|
+
id: 'Rule.Form',
|
222
|
+
type: 'ref',
|
223
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
224
|
+
value: {
|
225
|
+
text: {},
|
226
|
+
common: {
|
227
|
+
label: '格式化',
|
228
|
+
help: "".concat(DEFAULT_DATE_FORMAT)
|
229
|
+
},
|
230
|
+
'common-en-US': {}
|
231
|
+
}
|
232
|
+
}]
|
233
|
+
}
|
234
|
+
},
|
235
|
+
rules: {
|
236
|
+
regExp: {
|
237
|
+
id: 'regExp',
|
238
|
+
type: 'text',
|
239
|
+
fields: [{
|
240
|
+
id: 'Rule.Form',
|
241
|
+
type: 'ref',
|
242
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
243
|
+
value: {
|
244
|
+
text: {},
|
245
|
+
common: {
|
246
|
+
label: '正则表达式'
|
247
|
+
},
|
248
|
+
'common-en-US': {}
|
249
|
+
}
|
250
|
+
}]
|
251
|
+
},
|
252
|
+
message: {
|
253
|
+
id: 'message',
|
254
|
+
type: 'text',
|
255
|
+
fields: [{
|
256
|
+
id: 'Rule.Form',
|
257
|
+
type: 'ref',
|
258
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
259
|
+
value: {
|
260
|
+
text: {},
|
261
|
+
common: {
|
262
|
+
label: '提示信息'
|
263
|
+
},
|
264
|
+
'common-en-US': {}
|
265
|
+
}
|
266
|
+
}]
|
267
|
+
}
|
268
|
+
}
|
269
|
+
};
|
270
|
+
export var RefRule = {
|
271
|
+
common: {
|
272
|
+
depend: {
|
273
|
+
props: {
|
274
|
+
id: 'depend',
|
275
|
+
type: 'ref',
|
276
|
+
refId: 'dependRule',
|
277
|
+
fields: [{
|
278
|
+
id: 'Rule.Form',
|
279
|
+
type: 'ref',
|
280
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
281
|
+
value: {
|
282
|
+
common: {
|
283
|
+
label: '列表联动'
|
284
|
+
},
|
285
|
+
'common-en-US': {}
|
286
|
+
}
|
287
|
+
}]
|
288
|
+
},
|
289
|
+
types: {
|
290
|
+
id: 'dependRule',
|
291
|
+
type: 'object',
|
292
|
+
properties: [Rule.depend.show, Rule.depend.hidden]
|
293
|
+
}
|
294
|
+
},
|
295
|
+
rules: {
|
296
|
+
props: {
|
297
|
+
id: 'rules',
|
298
|
+
type: 'array',
|
299
|
+
items: {
|
300
|
+
type: 'ref',
|
301
|
+
refId: 'Rule.Form.Common'
|
302
|
+
},
|
303
|
+
fields: [{
|
304
|
+
id: 'Rule.Form',
|
305
|
+
type: 'ref',
|
306
|
+
refId: 'rulesRule',
|
307
|
+
value: {
|
308
|
+
array: {},
|
309
|
+
common: {
|
310
|
+
label: '校验规则'
|
311
|
+
},
|
312
|
+
'common-en-US': {}
|
313
|
+
}
|
314
|
+
}]
|
315
|
+
},
|
316
|
+
types: {
|
317
|
+
id: 'rulesRule',
|
318
|
+
type: 'object',
|
319
|
+
properties: [Rule.rules.regExp, Rule.rules.message]
|
320
|
+
}
|
321
|
+
}
|
322
|
+
},
|
323
|
+
text: {
|
324
|
+
props: {
|
325
|
+
id: 'text',
|
326
|
+
type: 'ref',
|
327
|
+
refId: 'textRule',
|
328
|
+
fields: [{
|
329
|
+
id: 'Rule.Form',
|
330
|
+
type: 'ref',
|
331
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
332
|
+
value: {
|
333
|
+
common: {
|
334
|
+
label: '高级设置'
|
335
|
+
},
|
336
|
+
'common-en-US': {}
|
337
|
+
}
|
338
|
+
}]
|
339
|
+
},
|
340
|
+
types: {
|
341
|
+
id: 'textRule',
|
342
|
+
type: 'object',
|
343
|
+
properties: [Rule.text.format]
|
344
|
+
}
|
345
|
+
}
|
346
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { FG } from '../../comps/FormGenerator/index.d';
|
2
|
+
export declare const transFG2Schema: (nodes: FG.Node[], settings: any) => {
|
3
|
+
id: string;
|
4
|
+
type: string;
|
5
|
+
properties: any[];
|
6
|
+
fields: {
|
7
|
+
id: string;
|
8
|
+
type: string;
|
9
|
+
refId: string;
|
10
|
+
value: {};
|
11
|
+
}[];
|
12
|
+
types: any[];
|
13
|
+
}[];
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
+
|
4
|
+
/*
|
5
|
+
* @Author: wangxian
|
6
|
+
* @Date: 2023-02-08 14:45:46
|
7
|
+
* @LastEditTime: 2023-02-09 14:50:08
|
8
|
+
*/
|
9
|
+
import { deepClone } from '../../utils';
|
10
|
+
var EMPTY_OBJ = [{
|
11
|
+
id: 'FormGenerator',
|
12
|
+
type: 'object',
|
13
|
+
properties: [],
|
14
|
+
fields: [{
|
15
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
16
|
+
type: 'ref',
|
17
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
18
|
+
value: {}
|
19
|
+
}],
|
20
|
+
types: []
|
21
|
+
}];
|
22
|
+
var EMPTY_PROP = {
|
23
|
+
id: '',
|
24
|
+
type: '',
|
25
|
+
fields: [{
|
26
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
27
|
+
type: 'ref',
|
28
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
29
|
+
value: {}
|
30
|
+
}]
|
31
|
+
};
|
32
|
+
|
33
|
+
var renderProp = function renderProp(node, setting) {
|
34
|
+
var _prop = deepClone(EMPTY_PROP);
|
35
|
+
|
36
|
+
var _setting = setting && deepClone(setting) || {};
|
37
|
+
|
38
|
+
_prop.id = (_setting === null || _setting === void 0 ? void 0 : _setting.id) || node.id;
|
39
|
+
_prop.type = node.param.type;
|
40
|
+
_prop.fields[0].value = _objectSpread(_objectSpread({}, _setting), {}, _defineProperty({
|
41
|
+
label: (_setting === null || _setting === void 0 ? void 0 : _setting.label) || node.name
|
42
|
+
}, node.param.type, _objectSpread({}, node.param.rule || {})));
|
43
|
+
return _prop;
|
44
|
+
}; // FG配置生成 metedata
|
45
|
+
|
46
|
+
|
47
|
+
export var transFG2Schema = function transFG2Schema(nodes, settings) {
|
48
|
+
var schema = deepClone(EMPTY_OBJ);
|
49
|
+
var props = [];
|
50
|
+
|
51
|
+
for (var i = 0; i < nodes.length; i++) {
|
52
|
+
var _prop = renderProp(nodes[i], settings[nodes[i].id]);
|
53
|
+
|
54
|
+
props.push(_prop);
|
55
|
+
}
|
56
|
+
|
57
|
+
schema[0].properties = [].concat(props);
|
58
|
+
|
59
|
+
if (settings.formSetting) {
|
60
|
+
schema[0].fields[0].value = deepClone(settings.formSetting);
|
61
|
+
} else {
|
62
|
+
delete schema[0].fields;
|
63
|
+
}
|
64
|
+
|
65
|
+
return schema;
|
66
|
+
};
|
@@ -15,7 +15,7 @@ import _Input from "antd/es/input";
|
|
15
15
|
/*
|
16
16
|
* @Author: wangxian
|
17
17
|
* @Date: 2021-09-18 14:15:04
|
18
|
-
* @LastEditTime: 2023-02-
|
18
|
+
* @LastEditTime: 2023-02-09 14:22:54
|
19
19
|
*/
|
20
20
|
import React from 'react';
|
21
21
|
import { UploadOutlined } from '@ant-design/icons';
|
@@ -119,7 +119,11 @@ function Index(props) {
|
|
119
119
|
flex: 1,
|
120
120
|
paddingRight: '10px'
|
121
121
|
},
|
122
|
-
label: (
|
122
|
+
label: /*#__PURE__*/React.createElement("span", {
|
123
|
+
style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
|
124
|
+
color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
|
125
|
+
} : {}
|
126
|
+
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
|
123
127
|
name: [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
|
124
128
|
rules: [{
|
125
129
|
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
@@ -135,7 +139,11 @@ function Index(props) {
|
|
135
139
|
style: {
|
136
140
|
display: "".concat(extraInfo.hidden ? 'none' : '')
|
137
141
|
},
|
138
|
-
label: (
|
142
|
+
label: /*#__PURE__*/React.createElement("span", {
|
143
|
+
style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
|
144
|
+
color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
|
145
|
+
} : {}
|
146
|
+
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
|
139
147
|
name: name,
|
140
148
|
rules: [{
|
141
149
|
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
@@ -9,7 +9,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
9
9
|
/*
|
10
10
|
* @Author: wangxian
|
11
11
|
* @Date: 2021-09-18 14:15:04
|
12
|
-
* @LastEditTime: 2023-02-
|
12
|
+
* @LastEditTime: 2023-02-09 14:23:44
|
13
13
|
*/
|
14
14
|
import React from 'react';
|
15
15
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
@@ -66,8 +66,11 @@ function Index(props) {
|
|
66
66
|
paddingRight: '10px'
|
67
67
|
},
|
68
68
|
name: [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
|
69
|
-
label: (
|
70
|
-
|
69
|
+
label: /*#__PURE__*/React.createElement("span", {
|
70
|
+
style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
|
71
|
+
color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
|
72
|
+
} : {}
|
73
|
+
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
|
71
74
|
rules: [{
|
72
75
|
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
73
76
|
}].concat(_toConsumableArray(rules)),
|
@@ -85,7 +88,11 @@ function Index(props) {
|
|
85
88
|
style: {
|
86
89
|
display: "".concat(extraInfo.hidden ? 'none' : '')
|
87
90
|
},
|
88
|
-
label: (
|
91
|
+
label: /*#__PURE__*/React.createElement("span", {
|
92
|
+
style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
|
93
|
+
color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
|
94
|
+
} : {}
|
95
|
+
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
|
89
96
|
name: name,
|
90
97
|
rules: [{
|
91
98
|
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
@@ -209,7 +209,7 @@ function Index(props) {
|
|
209
209
|
var _fieldRule$, _fieldRule$$value, _fieldRule$2, _fieldRule$2$value, _fieldRule$2$value$co;
|
210
210
|
|
211
211
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, null, !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && /*#__PURE__*/React.createElement(_Col, {
|
212
|
-
span: 24
|
212
|
+
span: (formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan) && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan : 24
|
213
213
|
}, /*#__PURE__*/React.createElement("div", {
|
214
214
|
style: {
|
215
215
|
display: 'flex',
|
@@ -224,7 +224,7 @@ function Index(props) {
|
|
224
224
|
className: "ant-form-item-label",
|
225
225
|
style: {
|
226
226
|
width: '100%',
|
227
|
-
textAlign: 'left',
|
227
|
+
textAlign: "".concat((formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan) && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? 'right' : 'left'),
|
228
228
|
flex: '1'
|
229
229
|
}
|
230
230
|
}, /*#__PURE__*/React.createElement("label", {
|
@@ -236,7 +236,7 @@ function Index(props) {
|
|
236
236
|
},
|
237
237
|
icon: isFold ? /*#__PURE__*/React.createElement(CaretDownOutlined, null) : /*#__PURE__*/React.createElement(CaretUpOutlined, null)
|
238
238
|
})))), /*#__PURE__*/React.createElement(_Col, {
|
239
|
-
span: 24
|
239
|
+
span: (formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan) && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? 24 - (formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan) : 24
|
240
240
|
}, /*#__PURE__*/React.createElement("div", {
|
241
241
|
style: {
|
242
242
|
padding: '10px',
|
@@ -26,7 +26,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
26
26
|
/*
|
27
27
|
* @Author:wangxian
|
28
28
|
* @Date: 2021-09-18 14:15:04
|
29
|
-
* @LastEditTime: 2023-02-
|
29
|
+
* @LastEditTime: 2023-02-09 14:24:16
|
30
30
|
*/
|
31
31
|
import React from 'react';
|
32
32
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
@@ -378,7 +378,11 @@ function Index(props) {
|
|
378
378
|
flex: 1,
|
379
379
|
paddingRight: '10px'
|
380
380
|
},
|
381
|
-
label: (
|
381
|
+
label: /*#__PURE__*/React.createElement("span", {
|
382
|
+
style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
|
383
|
+
color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
|
384
|
+
} : {}
|
385
|
+
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
|
382
386
|
name: [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
|
383
387
|
rules: [{
|
384
388
|
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
@@ -394,7 +398,11 @@ function Index(props) {
|
|
394
398
|
style: {
|
395
399
|
display: "".concat(extraInfo.hidden ? 'none' : '')
|
396
400
|
},
|
397
|
-
label: (
|
401
|
+
label: /*#__PURE__*/React.createElement("span", {
|
402
|
+
style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
|
403
|
+
color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
|
404
|
+
} : {}
|
405
|
+
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
|
398
406
|
name: name,
|
399
407
|
rules: [{
|
400
408
|
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
@@ -8,7 +8,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
8
8
|
/*
|
9
9
|
* @Author: wangxian
|
10
10
|
* @Date: 2021-09-18 14:15:04
|
11
|
-
* @LastEditTime: 2023-02-
|
11
|
+
* @LastEditTime: 2023-02-09 14:24:29
|
12
12
|
*/
|
13
13
|
import React from 'react';
|
14
14
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
@@ -44,7 +44,11 @@ function Index(props) {
|
|
44
44
|
flex: 1,
|
45
45
|
paddingRight: '10px'
|
46
46
|
},
|
47
|
-
label: (
|
47
|
+
label: /*#__PURE__*/React.createElement("span", {
|
48
|
+
style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
|
49
|
+
color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
|
50
|
+
} : {}
|
51
|
+
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
|
48
52
|
name: [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
|
49
53
|
valuePropName: "checked",
|
50
54
|
rules: [{
|
@@ -60,7 +64,11 @@ function Index(props) {
|
|
60
64
|
}
|
61
65
|
|
62
66
|
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
63
|
-
label: (
|
67
|
+
label: /*#__PURE__*/React.createElement("span", {
|
68
|
+
style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
|
69
|
+
color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
|
70
|
+
} : {}
|
71
|
+
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
|
64
72
|
key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
65
73
|
initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
66
74
|
style: {
|
@@ -60,6 +60,11 @@ var MetadataForm = function MetadataForm(props) {
|
|
60
60
|
fields = _React$useState6[0],
|
61
61
|
setFields = _React$useState6[1];
|
62
62
|
|
63
|
+
var _React$useState7 = React.useState(),
|
64
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
65
|
+
formFieldValue = _React$useState8[0],
|
66
|
+
setFormFieldValue = _React$useState8[1];
|
67
|
+
|
63
68
|
var firstLoadRef = React.useRef(true);
|
64
69
|
var firstLoadForm = React.useRef(true);
|
65
70
|
var stream$ = useMemoSubject();
|
@@ -131,7 +136,7 @@ var MetadataForm = function MetadataForm(props) {
|
|
131
136
|
}, [refId]);
|
132
137
|
React.useEffect(function () {
|
133
138
|
if (mySchma && mySchma.length > 0) {
|
134
|
-
var _mySchma$;
|
139
|
+
var _mySchma$, _mySchma$2, _mySchma$3, _mySchma$3$fields$;
|
135
140
|
|
136
141
|
var provider = new JsonMetadataProvider();
|
137
142
|
provider.add_types(mySchma);
|
@@ -140,6 +145,7 @@ var MetadataForm = function MetadataForm(props) {
|
|
140
145
|
var _fields = formCls.__type__.__fields__;
|
141
146
|
setFields(_fields);
|
142
147
|
setInnerSchemas(((_mySchma$ = mySchma[0]) === null || _mySchma$ === void 0 ? void 0 : _mySchma$.types) || []);
|
148
|
+
setFormFieldValue(((_mySchma$2 = mySchma[0]) === null || _mySchma$2 === void 0 ? void 0 : _mySchma$2.fields) && ((_mySchma$3 = mySchma[0]) === null || _mySchma$3 === void 0 ? void 0 : (_mySchma$3$fields$ = _mySchma$3.fields[0]) === null || _mySchma$3$fields$ === void 0 ? void 0 : _mySchma$3$fields$.value));
|
143
149
|
return function () {
|
144
150
|
provider = null;
|
145
151
|
};
|
@@ -214,7 +220,7 @@ var MetadataForm = function MetadataForm(props) {
|
|
214
220
|
fields: fields,
|
215
221
|
colSpan: colSpan,
|
216
222
|
labelSpan: labelSpan,
|
217
|
-
layout: layout,
|
223
|
+
layout: (formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.layout) || layout,
|
218
224
|
form: form,
|
219
225
|
stream$: stream$,
|
220
226
|
initialValues: initialValues,
|
@@ -233,12 +239,12 @@ var MetadataForm = function MetadataForm(props) {
|
|
233
239
|
offset: 0
|
234
240
|
} : undefined,
|
235
241
|
labelWrap: labelWrap,
|
236
|
-
layout: layout,
|
242
|
+
layout: (formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.layout) || layout,
|
237
243
|
form: form,
|
238
244
|
name: "control-hooks",
|
239
245
|
onFinish: onMyFinish,
|
240
246
|
onValuesChange: onMyValuesChange
|
241
|
-
}, renderForm(mySchma, options, colSpan))));
|
247
|
+
}, renderForm(mySchma, options, (formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.colSpan) || colSpan))));
|
242
248
|
};
|
243
249
|
|
244
250
|
export default MetadataForm;
|
package/es/config.js
CHANGED
@@ -3,7 +3,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
/*
|
4
4
|
* @Author: wangxian
|
5
5
|
* @Date: 2021-09-18 14:15:04
|
6
|
-
* @LastEditTime:
|
6
|
+
* @LastEditTime: 2023-02-06 18:45:24
|
7
7
|
*/
|
8
8
|
import { BehaviorSubject, map, distinctUntilChanged } from 'rxjs';
|
9
9
|
import { setLocale } from './comps/locales/index';
|
@@ -30,6 +30,7 @@ globalSettingStream.pipe(map(function (p) {
|
|
30
30
|
window.jQuery('body').removeClass("".concat(cssPrefix, "-dark"));
|
31
31
|
window.jQuery('body').removeClass("".concat(cssPrefix, "-normal"));
|
32
32
|
window.jQuery('body').addClass("".concat(cssPrefix, "-").concat(p));
|
33
|
+
window.jQuery('html').removeAttr('data-prefers-color');
|
33
34
|
});
|
34
35
|
var config = defaultConfig;
|
35
36
|
/** 设置配置 */
|
package/es/index.d.ts
CHANGED
@@ -9,6 +9,7 @@ export { default as MdEditor } from './comps/MdEdit';
|
|
9
9
|
export { default as MdView } from './comps/MdView';
|
10
10
|
export { default as FileView } from './comps/FileView';
|
11
11
|
export { default as Editable } from './comps/Editable';
|
12
|
+
export { default as FormGenerator } from './comps/FormGenerator';
|
12
13
|
export { default as DynamicPorts } from './comps/DynamicPorts';
|
13
14
|
export { default as DragNode } from './comps/DynamicPorts/comps/DragNode';
|
14
15
|
export { default as Icon } from './comps/Icons';
|
package/es/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* @Author:wangxian
|
3
3
|
* @Date: 2021-09-18 14:15:04
|
4
|
-
* @LastEditTime:
|
4
|
+
* @LastEditTime: 2023-02-04 13:52:49
|
5
5
|
*/
|
6
6
|
import './theme.less';
|
7
7
|
export { default as MetadataEdit } from './comps/MetadataEdit';
|
@@ -14,6 +14,7 @@ export { default as MdEditor } from './comps/MdEdit';
|
|
14
14
|
export { default as MdView } from './comps/MdView';
|
15
15
|
export { default as FileView } from './comps/FileView';
|
16
16
|
export { default as Editable } from './comps/Editable';
|
17
|
+
export { default as FormGenerator } from './comps/FormGenerator';
|
17
18
|
export { default as DynamicPorts } from './comps/DynamicPorts';
|
18
19
|
export { default as DragNode } from './comps/DynamicPorts/comps/DragNode';
|
19
20
|
export { default as Icon } from './comps/Icons';
|