ronds-metadata 1.2.24 → 1.2.26
Sign up to get free protection for your applications and to get access to all the features.
- package/es/comps/DynamicPorts/graph.js +16 -4
- package/es/comps/DynamicPorts/index.js +21 -2
- package/es/comps/DynamicPorts/interface.d.ts +1 -0
- package/es/comps/DynamicPorts/interface.js +1 -1
- package/es/comps/FormGenerator/index.js +16 -1
- package/es/comps/FormGenerator/transformer.d.ts +1 -1
- package/es/comps/FormGenerator/transformer.js +17 -5
- package/es/comps/MdView/index.less +353 -353
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +34 -4
- package/es/framework/fg/index.d.ts +120 -0
- package/es/framework/fg/index.js +301 -0
- package/es/framework/fg/utils.d.ts +14 -0
- package/es/framework/fg/utils.js +44 -0
- package/es/theme.less +1 -1
- package/es/utils.d.ts +7 -0
- package/es/utils.js +43 -1
- package/package.json +3 -2
@@ -1,5 +1,7 @@
|
|
1
1
|
import "antd/es/form/style";
|
2
2
|
import _Form from "antd/es/form";
|
3
|
+
import "antd/es/tag/style";
|
4
|
+
import _Tag from "antd/es/tag";
|
3
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
4
6
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
5
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
@@ -13,7 +15,7 @@ import Editable from '../../../../comps/Editable';
|
|
13
15
|
import useObservable from '../../../../framework/rxjs-hooks/useObservable';
|
14
16
|
import { MetadataFormContext } from '../../interface';
|
15
17
|
import { assign, getLabelByProps } from '../../utils';
|
16
|
-
import { deepClone } from '../../../../utils';
|
18
|
+
import { deepClone, getConstantValue } from '../../../../utils';
|
17
19
|
import { STREAM_EVENT_TYPE } from '../../constants';
|
18
20
|
|
19
21
|
var TableArray = function TableArray(props) {
|
@@ -56,6 +58,13 @@ var TableArray = function TableArray(props) {
|
|
56
58
|
setList = _React$useState10[1];
|
57
59
|
|
58
60
|
var listRef = React.useRef([]);
|
61
|
+
|
62
|
+
var _React$useState11 = React.useState({}),
|
63
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
64
|
+
enumOptions = _React$useState12[0],
|
65
|
+
setEnumOptions = _React$useState12[1];
|
66
|
+
|
67
|
+
var enumOptionsRef = React.useRef({});
|
59
68
|
useObservable(function (p) {
|
60
69
|
if ((p === null || p === void 0 ? void 0 : p.type) === 'setFieldsValue') {
|
61
70
|
if (typeof name === 'string' && p.payload[name]) {
|
@@ -285,6 +294,8 @@ var TableArray = function TableArray(props) {
|
|
285
294
|
_options.push(obj);
|
286
295
|
});
|
287
296
|
|
297
|
+
enumOptionsRef.current[data.id] = _options;
|
298
|
+
setEnumOptions(_objectSpread({}, enumOptionsRef.current));
|
288
299
|
return _options;
|
289
300
|
}, []);
|
290
301
|
var processColumnType = React.useCallback(function (data, _extraInfo) {
|
@@ -301,7 +312,7 @@ var TableArray = function TableArray(props) {
|
|
301
312
|
var processSchemaToColumns = React.useCallback(function (_properties) {
|
302
313
|
var _columns = [];
|
303
314
|
|
304
|
-
|
315
|
+
var _loop = function _loop(i) {
|
305
316
|
var _extraInfo$common, _extraInfo$enum5;
|
306
317
|
|
307
318
|
var it = _properties[i];
|
@@ -314,14 +325,33 @@ var TableArray = function TableArray(props) {
|
|
314
325
|
editable: !(extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$common = extraInfo.common) === null || _extraInfo$common === void 0 ? void 0 : _extraInfo$common.disabled),
|
315
326
|
type: processColumnType(it, extraInfo),
|
316
327
|
enum: it.type === 'enum' ? processEnumData(it, extraInfo) : undefined,
|
317
|
-
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$enum5 = extraInfo.enum) === null || _extraInfo$enum5 === void 0 ? void 0 : _extraInfo$enum5.isMutiple) ? 'multiple' : undefined
|
328
|
+
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$enum5 = extraInfo.enum) === null || _extraInfo$enum5 === void 0 ? void 0 : _extraInfo$enum5.isMutiple) ? 'multiple' : undefined,
|
329
|
+
render: function render(val) {
|
330
|
+
if (it.type = 'enum') {
|
331
|
+
if (Array.isArray(val)) {
|
332
|
+
return val.map(function (v) {
|
333
|
+
return /*#__PURE__*/React.createElement(_Tag, {
|
334
|
+
color: "geekblue"
|
335
|
+
}, getConstantValue(enumOptionsRef.current[it.id], v, 'value', 'label'));
|
336
|
+
});
|
337
|
+
}
|
338
|
+
|
339
|
+
return getConstantValue(enumOptionsRef.current[it.id], val, 'value', 'label');
|
340
|
+
}
|
341
|
+
|
342
|
+
return val;
|
343
|
+
}
|
318
344
|
};
|
319
345
|
|
320
346
|
_columns.push(obj);
|
347
|
+
};
|
348
|
+
|
349
|
+
for (var i = 0; i < _properties.length; i++) {
|
350
|
+
_loop(i);
|
321
351
|
}
|
322
352
|
|
323
353
|
return _columns;
|
324
|
-
}, []);
|
354
|
+
}, [enumOptions]);
|
325
355
|
var columns = React.useMemo(function () {
|
326
356
|
var _columns = [];
|
327
357
|
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import { FG } from '../../comps/FormGenerator/index.d';
|
2
|
+
interface ICreate {
|
3
|
+
create(data: any): ILayoutSetting & IReturnMethod;
|
4
|
+
}
|
5
|
+
interface ILayoutSetting {
|
6
|
+
grid<T>(this: T, _value: 1 | 2 | 3 | 4): Omit<T, 'grid'> & IReturnMethod;
|
7
|
+
labelSpan<T>(this: T, _value: number): Omit<T, 'labelSpan'> & IReturnMethod;
|
8
|
+
}
|
9
|
+
interface IComps {
|
10
|
+
object(data: FG.Node[] | any, _id: string): ICommonSetting & IReturnMethod;
|
11
|
+
input(_id: string): ICommonSetting;
|
12
|
+
textarea(_id: string): ICommonSetting;
|
13
|
+
date(_id: string): ICommonSetting;
|
14
|
+
number(_id: string): ICommonSetting;
|
15
|
+
switch(_id: string): ICommonSetting;
|
16
|
+
select(_id: string): ICommonSetting;
|
17
|
+
mutiSelect(_id: string): ICommonSetting;
|
18
|
+
}
|
19
|
+
interface ICommonSetting {
|
20
|
+
label<T>(this: T, _label: string): Omit<T, 'label'> & IReturnMethod;
|
21
|
+
require<T>(this: T): Omit<T, 'require'> & IReturnMethod;
|
22
|
+
disabled<T>(this: T): Omit<T, 'disabled'> & IReturnMethod;
|
23
|
+
hidden<T>(this: T): Omit<T, 'hidden'> & IReturnMethod;
|
24
|
+
br<T>(this: T): Omit<T, 'br'> & IReturnMethod;
|
25
|
+
color<T>(this: T, _color: string): Omit<T, 'color'> & IReturnMethod;
|
26
|
+
colSpan<T>(this: T, _colSpan: number): Omit<T, 'colSpan'> & IReturnMethod;
|
27
|
+
defaultValue<T>(this: T, _defaultValue: any): Omit<T, 'defaultValue'> & IReturnMethod;
|
28
|
+
help<T>(this: T, _help: string): Omit<T, 'help'> & IReturnMethod;
|
29
|
+
tooltip<T>(this: T, _tooltip: string): Omit<T, 'tooltip'> & IReturnMethod;
|
30
|
+
placeholder<T>(this: T, _placeholder: string): Omit<T, 'placeholder'> & IReturnMethod;
|
31
|
+
}
|
32
|
+
interface IReturnMethod {
|
33
|
+
valueOf(): void;
|
34
|
+
toString(): void;
|
35
|
+
}
|
36
|
+
export declare type IFormRobot = ICreate & IComps;
|
37
|
+
/**
|
38
|
+
* 链式调用 组件元数据表单的机器人
|
39
|
+
*/
|
40
|
+
export declare class FormRobot implements IFormRobot {
|
41
|
+
/**
|
42
|
+
* 构建每个字段的值
|
43
|
+
*/
|
44
|
+
_data: FG.Node | FG.Node[];
|
45
|
+
/**
|
46
|
+
* 用来判断是否已经初始化过数据
|
47
|
+
*/
|
48
|
+
_hasInitData: boolean;
|
49
|
+
constructor(data?: FG.Node | FG.Node[]);
|
50
|
+
/**
|
51
|
+
* 创建表单的入口
|
52
|
+
* @param arr
|
53
|
+
* @returns
|
54
|
+
*/
|
55
|
+
create(arr: FG.Node[]): ILayoutSetting & IReturnMethod;
|
56
|
+
/**
|
57
|
+
* 对象类型 创建表单的入口
|
58
|
+
* @param _id 属性名
|
59
|
+
* @returns
|
60
|
+
*/
|
61
|
+
object(arr: FG.Node[], _id: string): ICommonSetting & IReturnMethod;
|
62
|
+
/**
|
63
|
+
* 输入框
|
64
|
+
* @param _id 属性名
|
65
|
+
* @returns
|
66
|
+
*/
|
67
|
+
input(_id: string): ICommonSetting;
|
68
|
+
/**
|
69
|
+
* 文本框
|
70
|
+
* @param _id
|
71
|
+
* @returns
|
72
|
+
*/
|
73
|
+
textarea(_id: string): ICommonSetting;
|
74
|
+
/**
|
75
|
+
* 日期选择
|
76
|
+
* @param _id
|
77
|
+
* @returns
|
78
|
+
*/
|
79
|
+
date(_id: string): ICommonSetting;
|
80
|
+
/**
|
81
|
+
* 数字框
|
82
|
+
* @param _id
|
83
|
+
* @returns
|
84
|
+
*/
|
85
|
+
number(_id: string): ICommonSetting;
|
86
|
+
/**
|
87
|
+
* 开关
|
88
|
+
* @param _id
|
89
|
+
* @returns
|
90
|
+
*/
|
91
|
+
switch(_id: string): ICommonSetting;
|
92
|
+
/**
|
93
|
+
* 下拉单选
|
94
|
+
* @param _id
|
95
|
+
* @returns
|
96
|
+
*/
|
97
|
+
select(_id: string): ICommonSetting;
|
98
|
+
/**
|
99
|
+
* 下拉多选
|
100
|
+
* @param _id
|
101
|
+
* @returns
|
102
|
+
*/
|
103
|
+
mutiSelect(_id: string): ICommonSetting;
|
104
|
+
label<T>(this: T, _vaule: string): Omit<T, 'label'> & IReturnMethod;
|
105
|
+
require<T>(this: T): Omit<T, 'require'> & IReturnMethod;
|
106
|
+
color<T>(this: T, _vaule: string): Omit<T, 'color'> & IReturnMethod;
|
107
|
+
colSpan<T>(this: T, _vaule: number): Omit<T, 'colSpan'> & IReturnMethod;
|
108
|
+
defaultValue<T>(this: T, _vaule: number | string): Omit<T, 'defaultValue'> & IReturnMethod;
|
109
|
+
help<T>(this: T, _vaule: string): Omit<T, 'help'> & IReturnMethod;
|
110
|
+
tooltip<T>(this: T, _vaule: string): Omit<T, 'tooltip'> & IReturnMethod;
|
111
|
+
placeholder<T>(this: T, _vaule: string): Omit<T, 'placeholder'> & IReturnMethod;
|
112
|
+
disabled<T>(this: T): Omit<T, 'disabled'> & IReturnMethod;
|
113
|
+
br<T>(this: T): Omit<T, 'br'> & IReturnMethod;
|
114
|
+
hidden<T>(this: T): Omit<T, 'hidden'> & IReturnMethod;
|
115
|
+
grid<T>(this: T, _vaule: 1 | 2 | 3 | 4): Omit<T, 'grid'> & IReturnMethod;
|
116
|
+
valueOf(): any;
|
117
|
+
toString(): string;
|
118
|
+
}
|
119
|
+
declare const _default: FormRobot;
|
120
|
+
export default _default;
|
@@ -0,0 +1,301 @@
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
4
|
+
|
5
|
+
/* eslint-disable */
|
6
|
+
import { transFG2Schema } from '@/comps/FormGenerator/transformer';
|
7
|
+
import { renderBasicFormProps, renderLayoutFormProps, renderSetting } from './utils';
|
8
|
+
/**
|
9
|
+
* 链式调用 组件元数据表单的机器人
|
10
|
+
*/
|
11
|
+
|
12
|
+
export var FormRobot = /*#__PURE__*/function () {
|
13
|
+
/**
|
14
|
+
* 构建每个字段的值
|
15
|
+
*/
|
16
|
+
|
17
|
+
/**
|
18
|
+
* 用来判断是否已经初始化过数据
|
19
|
+
*/
|
20
|
+
function FormRobot(data) {
|
21
|
+
_classCallCheck(this, FormRobot);
|
22
|
+
|
23
|
+
this._data = void 0;
|
24
|
+
this._hasInitData = void 0;
|
25
|
+
|
26
|
+
/**
|
27
|
+
* 构造函数 正式判断是够已经初始化数据
|
28
|
+
* data -> 如果存在,则作为初始化数据
|
29
|
+
*/
|
30
|
+
this._hasInitData = true;
|
31
|
+
|
32
|
+
if (data === undefined) {
|
33
|
+
this._data = null;
|
34
|
+
this._hasInitData = false;
|
35
|
+
} else {
|
36
|
+
this._data = data;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
/**
|
40
|
+
* 创建表单的入口
|
41
|
+
* @param arr
|
42
|
+
* @returns
|
43
|
+
*/
|
44
|
+
|
45
|
+
|
46
|
+
_createClass(FormRobot, [{
|
47
|
+
key: "create",
|
48
|
+
value: function create(arr) {
|
49
|
+
var _init = this._hasInitData ? this._data : [];
|
50
|
+
|
51
|
+
var _data = [].concat(_toConsumableArray(_init), _toConsumableArray(arr));
|
52
|
+
|
53
|
+
return new FormRobot(_data);
|
54
|
+
} //*********************************表单基本类型__START************************************//
|
55
|
+
|
56
|
+
/**
|
57
|
+
* 对象类型 创建表单的入口
|
58
|
+
* @param _id 属性名
|
59
|
+
* @returns
|
60
|
+
*/
|
61
|
+
|
62
|
+
}, {
|
63
|
+
key: "object",
|
64
|
+
value: function object(arr, _id) {
|
65
|
+
var _data = renderLayoutFormProps(arr, _id, 'obj');
|
66
|
+
|
67
|
+
return new FormRobot(_data);
|
68
|
+
}
|
69
|
+
/**
|
70
|
+
* 输入框
|
71
|
+
* @param _id 属性名
|
72
|
+
* @returns
|
73
|
+
*/
|
74
|
+
|
75
|
+
}, {
|
76
|
+
key: "input",
|
77
|
+
value: function input(_id) {
|
78
|
+
var _data = renderBasicFormProps(_id, 'input');
|
79
|
+
|
80
|
+
return new FormRobot(_data);
|
81
|
+
}
|
82
|
+
/**
|
83
|
+
* 文本框
|
84
|
+
* @param _id
|
85
|
+
* @returns
|
86
|
+
*/
|
87
|
+
|
88
|
+
}, {
|
89
|
+
key: "textarea",
|
90
|
+
value: function textarea(_id) {
|
91
|
+
var _data = renderBasicFormProps(_id, 'textarea');
|
92
|
+
|
93
|
+
return new FormRobot(_data);
|
94
|
+
}
|
95
|
+
/**
|
96
|
+
* 日期选择
|
97
|
+
* @param _id
|
98
|
+
* @returns
|
99
|
+
*/
|
100
|
+
|
101
|
+
}, {
|
102
|
+
key: "date",
|
103
|
+
value: function date(_id) {
|
104
|
+
var _data = renderBasicFormProps(_id, 'date');
|
105
|
+
|
106
|
+
return new FormRobot(_data);
|
107
|
+
}
|
108
|
+
/**
|
109
|
+
* 数字框
|
110
|
+
* @param _id
|
111
|
+
* @returns
|
112
|
+
*/
|
113
|
+
|
114
|
+
}, {
|
115
|
+
key: "number",
|
116
|
+
value: function number(_id) {
|
117
|
+
var _data = renderBasicFormProps(_id, 'number');
|
118
|
+
|
119
|
+
return new FormRobot(_data);
|
120
|
+
}
|
121
|
+
/**
|
122
|
+
* 开关
|
123
|
+
* @param _id
|
124
|
+
* @returns
|
125
|
+
*/
|
126
|
+
|
127
|
+
}, {
|
128
|
+
key: "switch",
|
129
|
+
value: function _switch(_id) {
|
130
|
+
var _data = renderBasicFormProps(_id, 'switch');
|
131
|
+
|
132
|
+
return new FormRobot(_data);
|
133
|
+
}
|
134
|
+
/**
|
135
|
+
* 下拉单选
|
136
|
+
* @param _id
|
137
|
+
* @returns
|
138
|
+
*/
|
139
|
+
|
140
|
+
}, {
|
141
|
+
key: "select",
|
142
|
+
value: function select(_id) {
|
143
|
+
var _data = renderBasicFormProps(_id, 'select');
|
144
|
+
|
145
|
+
return new FormRobot(_data);
|
146
|
+
}
|
147
|
+
/**
|
148
|
+
* 下拉多选
|
149
|
+
* @param _id
|
150
|
+
* @returns
|
151
|
+
*/
|
152
|
+
|
153
|
+
}, {
|
154
|
+
key: "mutiSelect",
|
155
|
+
value: function mutiSelect(_id) {
|
156
|
+
var _data = renderBasicFormProps(_id, 'mutiSelect');
|
157
|
+
|
158
|
+
return new FormRobot(_data);
|
159
|
+
} //*********************************表单基本类型__END************************************//
|
160
|
+
//*********************************提供的扩展规则完善表单__START************************************//
|
161
|
+
// 标签显示文本
|
162
|
+
|
163
|
+
}, {
|
164
|
+
key: "label",
|
165
|
+
value: function label(_vaule) {
|
166
|
+
var _init = this._hasInitData ? this._data : {};
|
167
|
+
|
168
|
+
var _data = renderSetting(_init, 'label', _vaule);
|
169
|
+
|
170
|
+
return new FormRobot(_data);
|
171
|
+
}
|
172
|
+
}, {
|
173
|
+
key: "require",
|
174
|
+
value: function require() {
|
175
|
+
var _init = this._hasInitData ? this._data : {};
|
176
|
+
|
177
|
+
var _data = renderSetting(_init, 'require', true);
|
178
|
+
|
179
|
+
return new FormRobot(_data);
|
180
|
+
}
|
181
|
+
}, {
|
182
|
+
key: "color",
|
183
|
+
value: function color(_vaule) {
|
184
|
+
var _init = this._hasInitData ? this._data : {};
|
185
|
+
|
186
|
+
var _data = renderSetting(_init, 'color', _vaule);
|
187
|
+
|
188
|
+
return new FormRobot(_data);
|
189
|
+
}
|
190
|
+
}, {
|
191
|
+
key: "colSpan",
|
192
|
+
value: function colSpan(_vaule) {
|
193
|
+
var _init = this._hasInitData ? this._data : {};
|
194
|
+
|
195
|
+
var _data = renderSetting(_init, 'colSpan', _vaule);
|
196
|
+
|
197
|
+
return new FormRobot(_data);
|
198
|
+
}
|
199
|
+
}, {
|
200
|
+
key: "defaultValue",
|
201
|
+
value: function defaultValue(_vaule) {
|
202
|
+
var _init = this._hasInitData ? this._data : {};
|
203
|
+
|
204
|
+
var _data = renderSetting(_init, 'defaultValue', _vaule);
|
205
|
+
|
206
|
+
return new FormRobot(_data);
|
207
|
+
}
|
208
|
+
}, {
|
209
|
+
key: "help",
|
210
|
+
value: function help(_vaule) {
|
211
|
+
var _init = this._hasInitData ? this._data : {};
|
212
|
+
|
213
|
+
var _data = renderSetting(_init, 'help', _vaule);
|
214
|
+
|
215
|
+
return new FormRobot(_data);
|
216
|
+
}
|
217
|
+
}, {
|
218
|
+
key: "tooltip",
|
219
|
+
value: function tooltip(_vaule) {
|
220
|
+
var _init = this._hasInitData ? this._data : {};
|
221
|
+
|
222
|
+
var _data = renderSetting(_init, 'tooltip', _vaule);
|
223
|
+
|
224
|
+
return new FormRobot(_data);
|
225
|
+
}
|
226
|
+
}, {
|
227
|
+
key: "placeholder",
|
228
|
+
value: function placeholder(_vaule) {
|
229
|
+
var _init = this._hasInitData ? this._data : {};
|
230
|
+
|
231
|
+
var _data = renderSetting(_init, 'placeholder', _vaule);
|
232
|
+
|
233
|
+
return new FormRobot(_data);
|
234
|
+
}
|
235
|
+
}, {
|
236
|
+
key: "disabled",
|
237
|
+
value: function disabled() {
|
238
|
+
var _init = this._hasInitData ? this._data : {};
|
239
|
+
|
240
|
+
var _data = renderSetting(_init, 'disabled', true);
|
241
|
+
|
242
|
+
return new FormRobot(_data);
|
243
|
+
}
|
244
|
+
}, {
|
245
|
+
key: "br",
|
246
|
+
value: function br() {
|
247
|
+
var _init = this._hasInitData ? this._data : {};
|
248
|
+
|
249
|
+
var _data = renderSetting(_init, 'br', true);
|
250
|
+
|
251
|
+
return new FormRobot(_data);
|
252
|
+
}
|
253
|
+
}, {
|
254
|
+
key: "hidden",
|
255
|
+
value: function hidden() {
|
256
|
+
var _init = this._hasInitData ? this._data : {};
|
257
|
+
|
258
|
+
var _data = renderSetting(_init, 'hidden', true);
|
259
|
+
|
260
|
+
return new FormRobot(_data);
|
261
|
+
} //*********************************提供的扩展规则完善表单__END************************************//
|
262
|
+
//*********************************表单布局的扩展规则__START************************************//
|
263
|
+
|
264
|
+
}, {
|
265
|
+
key: "grid",
|
266
|
+
value: function grid(_vaule) {
|
267
|
+
var _init = this._hasInitData ? this._data : {};
|
268
|
+
|
269
|
+
var _data = renderSetting(_init, 'colSpan', _vaule);
|
270
|
+
|
271
|
+
return new FormRobot(_data);
|
272
|
+
} //*********************************表单布局的扩展规则__END************************************//
|
273
|
+
//*********************************拿到最终的数据方法__START************************************//
|
274
|
+
|
275
|
+
}, {
|
276
|
+
key: "valueOf",
|
277
|
+
value: function valueOf() {
|
278
|
+
if (Array.isArray(this._data)) {
|
279
|
+
//是数组,说明是create方法,需要转换成元数据
|
280
|
+
return transFG2Schema(this._data);
|
281
|
+
} else {
|
282
|
+
return this._data;
|
283
|
+
}
|
284
|
+
}
|
285
|
+
}, {
|
286
|
+
key: "toString",
|
287
|
+
value: function toString() {
|
288
|
+
return JSON.stringify(this.valueOf());
|
289
|
+
}
|
290
|
+
}]);
|
291
|
+
|
292
|
+
return FormRobot;
|
293
|
+
}();
|
294
|
+
export default new FormRobot();
|
295
|
+
var fr = new FormRobot();
|
296
|
+
/* fr.object([
|
297
|
+
* fr.input('name').label('名称').valueOf(),
|
298
|
+
* fr.object([
|
299
|
+
* fr.input('id').label('主键').valueOf()
|
300
|
+
* ], 'detail')]);
|
301
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { FG } from '../../comps/FormGenerator/index.d';
|
2
|
+
export declare const renderBasicFormProps: (_id: string, _type: string) => {
|
3
|
+
id: string;
|
4
|
+
name: string;
|
5
|
+
type: string;
|
6
|
+
param: FG.NodeParam;
|
7
|
+
};
|
8
|
+
export declare const renderLayoutFormProps: (_arr: FG.Node[], _id: string, _type: string) => {
|
9
|
+
id: string;
|
10
|
+
name: string;
|
11
|
+
type: string;
|
12
|
+
param: FG.NodeParam;
|
13
|
+
};
|
14
|
+
export declare const renderSetting: (_init: FG.Node, _type: string, _value: string | number | boolean) => FG.Node;
|
@@ -0,0 +1,44 @@
|
|
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-03-21 15:44:45
|
7
|
+
* @LastEditTime: 2023-03-22 09:20:34
|
8
|
+
*/
|
9
|
+
import { deepClone } from '../../utils';
|
10
|
+
import { basicComps, layoutComps } from './../../comps/FormGenerator/settings/index';
|
11
|
+
export var renderBasicFormProps = function renderBasicFormProps(_id, _type) {
|
12
|
+
var _basicComps = deepClone(basicComps);
|
13
|
+
|
14
|
+
var _ = _basicComps.find(function (it) {
|
15
|
+
return it.type === _type;
|
16
|
+
}) || {};
|
17
|
+
|
18
|
+
delete _.param.schema;
|
19
|
+
return _objectSpread(_objectSpread({}, _), {}, {
|
20
|
+
id: _id
|
21
|
+
});
|
22
|
+
};
|
23
|
+
export var renderLayoutFormProps = function renderLayoutFormProps(_arr, _id, _type) {
|
24
|
+
var _layoutComps = deepClone(layoutComps);
|
25
|
+
|
26
|
+
var _ = _layoutComps.find(function (it) {
|
27
|
+
return it.type === _type;
|
28
|
+
}) || {};
|
29
|
+
|
30
|
+
delete _.param.schema;
|
31
|
+
_.param.types = _arr;
|
32
|
+
return _objectSpread(_objectSpread({}, _), {}, {
|
33
|
+
id: _id
|
34
|
+
});
|
35
|
+
};
|
36
|
+
export var renderSetting = function renderSetting(_init, _type, _value) {
|
37
|
+
var _ = _objectSpread(_objectSpread({}, _init), {}, {
|
38
|
+
param: _objectSpread(_objectSpread({}, _init === null || _init === void 0 ? void 0 : _init.param), {}, {
|
39
|
+
setting: _objectSpread(_objectSpread({}, _init.param.setting), {}, _defineProperty({}, _type, _value))
|
40
|
+
})
|
41
|
+
});
|
42
|
+
|
43
|
+
return _;
|
44
|
+
};
|
package/es/theme.less
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
--ronds-metadata-color-border-1: #314162;
|
3
3
|
--ronds-metadata-color-border-2: #0d9af3;
|
4
4
|
--ronds-metadata-color-bg-2: #0d1f40;
|
5
|
-
--ronds-metadata-color-bg-3: #
|
5
|
+
--ronds-metadata-color-bg-3: #021125;
|
6
6
|
--ronds-metadata-color-bg-4: #1c3771;
|
7
7
|
--ronds-metadata-color-text-1: #ffffff;
|
8
8
|
--ronds-metadata-color-text-2: #ffffff;
|
package/es/utils.d.ts
CHANGED
@@ -17,3 +17,10 @@ export declare const md5: (data: string, digest?: string) => any;
|
|
17
17
|
export declare function arrayMoveMutable(array: any[], fromIndex: number, toIndex: number): void;
|
18
18
|
export declare function arrayMoveImmutable(array: any[], fromIndex: number, toIndex: number): any[];
|
19
19
|
export declare function arrayInsert(array: any[], index: number, item: any): any[];
|
20
|
+
/**
|
21
|
+
* 调用时不用把参数补全; getValue(array, key) 一样可以调用
|
22
|
+
* @param array 数组
|
23
|
+
* @param key 指定的数值
|
24
|
+
* @returns {string|string|string}
|
25
|
+
*/
|
26
|
+
export declare function getConstantValue(array: any[], key: string | number, strKey?: string, strValue?: string): string;
|
package/es/utils.js
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
1
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
4
|
|
4
5
|
/*
|
5
6
|
* @Author: wangxian
|
6
7
|
* @Date: 2021-09-18 14:15:04
|
7
|
-
* @LastEditTime: 2023-
|
8
|
+
* @LastEditTime: 2023-03-24 09:49:51
|
8
9
|
*/
|
9
10
|
import { useCallback, useEffect, useRef } from 'react';
|
10
11
|
/** 防抖 */
|
@@ -135,4 +136,45 @@ export function arrayMoveImmutable(array, fromIndex, toIndex) {
|
|
135
136
|
export function arrayInsert(array, index, item) {
|
136
137
|
array.splice(index, 0, item);
|
137
138
|
return array;
|
139
|
+
}
|
140
|
+
/**
|
141
|
+
* 调用时不用把参数补全; getValue(array, key) 一样可以调用
|
142
|
+
* @param array 数组
|
143
|
+
* @param key 指定的数值
|
144
|
+
* @returns {string|string|string}
|
145
|
+
*/
|
146
|
+
|
147
|
+
export function getConstantValue(array, key, strKey, strValue) {
|
148
|
+
var result = '';
|
149
|
+
var _strKey = 'id';
|
150
|
+
var _strValue = 'value';
|
151
|
+
|
152
|
+
if (strKey) {
|
153
|
+
_strKey = strKey;
|
154
|
+
}
|
155
|
+
|
156
|
+
if (strValue) {
|
157
|
+
_strValue = strValue;
|
158
|
+
}
|
159
|
+
|
160
|
+
if (array) {
|
161
|
+
var _iterator = _createForOfIteratorHelper(array),
|
162
|
+
_step;
|
163
|
+
|
164
|
+
try {
|
165
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
166
|
+
var item = _step.value;
|
167
|
+
|
168
|
+
if (key === item[_strKey]) {
|
169
|
+
result = item[_strValue];
|
170
|
+
}
|
171
|
+
}
|
172
|
+
} catch (err) {
|
173
|
+
_iterator.e(err);
|
174
|
+
} finally {
|
175
|
+
_iterator.f();
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
return result;
|
138
180
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"public": true,
|
3
3
|
"name": "ronds-metadata",
|
4
|
-
"version": "1.2.
|
4
|
+
"version": "1.2.26",
|
5
5
|
"scripts": {
|
6
6
|
"start": "dumi dev",
|
7
7
|
"docs:build": "dumi build",
|
@@ -45,6 +45,7 @@
|
|
45
45
|
"bl": "^5.0.0",
|
46
46
|
"codemirror": "^5.63.0",
|
47
47
|
"codepage": "^1.15.0",
|
48
|
+
"css-element-queries": "^1.2.3",
|
48
49
|
"github-markdown-css": "^5.1.0",
|
49
50
|
"immer": "^9.0.14",
|
50
51
|
"lodash": "^4.17.21",
|
@@ -91,4 +92,4 @@
|
|
91
92
|
"webpack-cli": "^3.3.12",
|
92
93
|
"yorkie": "^2.0.0"
|
93
94
|
}
|
94
|
-
}
|
95
|
+
}
|