ronds-metadata 1.1.96 → 1.1.97
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/comps/Canvas/core/RenderField/Cell/Obj.js +10 -5
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +15 -3
- package/es/comps/FormGenerator/comps/Canvas/core/index.d.ts +4 -0
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +34 -4
- package/es/comps/FormGenerator/comps/Canvas/index.js +55 -15
- package/es/comps/FormGenerator/comps/Settings/index.js +17 -3
- package/es/comps/FormGenerator/index.js +29 -3
- package/es/comps/FormGenerator/settings/index.d.ts +1 -0
- package/es/comps/FormGenerator/settings/index.js +3 -2
- package/es/comps/FormGenerator/transformer.d.ts +2 -2
- package/es/comps/FormGenerator/transformer.js +109 -7
- package/es/comps/MetadataForm/DataCell/Array.js +5 -14
- package/es/comps/MetadataForm/DataCell/Input.js +5 -14
- package/es/comps/MetadataForm/DataCell/Number.js +3 -12
- package/es/comps/MetadataForm/DataCell/Ref.js +2 -11
- package/es/comps/MetadataForm/DataCell/Select.js +3 -12
- package/es/comps/MetadataForm/DataCell/Switch.js +3 -12
- package/es/comps/MetadataForm/HOC/index.js +40 -8
- package/es/comps/MetadataForm/hooks/index.js +2 -2
- package/es/comps/MetadataForm/index.js +7 -0
- package/es/comps/MetadataForm/interface.d.ts +1 -0
- package/es/comps/MetadataForm/utils.d.ts +1 -1
- package/es/comps/MetadataForm/utils.js +7 -19
- package/package.json +1 -1
@@ -6,7 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
6
|
* @Author: uloveits 719310130@qq.com
|
7
7
|
* @Date: 2023-02-06 15:05:42
|
8
8
|
* @LastEditors: uloveits 719310130@qq.com
|
9
|
-
* @LastEditTime: 2023-02-
|
9
|
+
* @LastEditTime: 2023-02-21 16:32:27
|
10
10
|
*/
|
11
11
|
import React from 'react';
|
12
12
|
import CanvasCore from '../../index';
|
@@ -16,7 +16,8 @@ import { streamEventType } from '../../../../../settings/index';
|
|
16
16
|
var Index = function Index(props) {
|
17
17
|
var data = props.data,
|
18
18
|
fgStream = props.fgStream,
|
19
|
-
setting = props.setting
|
19
|
+
setting = props.setting,
|
20
|
+
types = props.types;
|
20
21
|
|
21
22
|
var _React$useState = React.useState([]),
|
22
23
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
@@ -24,13 +25,17 @@ var Index = function Index(props) {
|
|
24
25
|
setNodes = _React$useState2[1];
|
25
26
|
|
26
27
|
var nodesRef = React.useRef([]);
|
27
|
-
React.useEffect(function () {
|
28
|
+
React.useEffect(function () {
|
29
|
+
if ((types === null || types === void 0 ? void 0 : types.nodes.length) > 0) {
|
30
|
+
setNodes(_toConsumableArray(types.nodes));
|
31
|
+
nodesRef.current = types.nodes;
|
32
|
+
}
|
33
|
+
}, [types]);
|
28
34
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CanvasCore, {
|
29
35
|
key: data.id,
|
30
36
|
refId: data.id,
|
37
|
+
nodes: nodes,
|
31
38
|
onChange: function onChange(nodes) {
|
32
|
-
setNodes(_toConsumableArray(nodes));
|
33
|
-
nodesRef.current = nodes;
|
34
39
|
fgStream && fgStream.next({
|
35
40
|
type: streamEventType.onTypesChange,
|
36
41
|
payload: _defineProperty({}, data.id, {
|
@@ -27,9 +27,20 @@ export function withFieldCellWrapper(WrappedComponent) {
|
|
27
27
|
|
28
28
|
var _React$useState3 = React.useState(),
|
29
29
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
types = _React$useState4[0],
|
31
|
+
setTypes = _React$useState4[1];
|
32
|
+
|
33
|
+
var _React$useState5 = React.useState(),
|
34
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
35
|
+
position = _React$useState6[0],
|
36
|
+
setPosition = _React$useState6[1];
|
37
|
+
|
38
|
+
React.useEffect(function () {
|
39
|
+
if ((fGCtx === null || fGCtx === void 0 ? void 0 : fGCtx.types) && (fGCtx === null || fGCtx === void 0 ? void 0 : fGCtx.types[data.id])) {
|
40
|
+
//
|
41
|
+
setTypes(_objectSpread({}, fGCtx === null || fGCtx === void 0 ? void 0 : fGCtx.types[data.id]));
|
42
|
+
}
|
43
|
+
}, [fGCtx === null || fGCtx === void 0 ? void 0 : fGCtx.types]);
|
33
44
|
var processFgStreamData = React.useCallback(function (p) {
|
34
45
|
switch (p === null || p === void 0 ? void 0 : p.type) {
|
35
46
|
case streamEventType.onSettingValueChange:
|
@@ -205,6 +216,7 @@ export function withFieldCellWrapper(WrappedComponent) {
|
|
205
216
|
}]
|
206
217
|
}, /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, {
|
207
218
|
fgStream: fGCtx.fgStream,
|
219
|
+
types: types,
|
208
220
|
setting: cellSetting
|
209
221
|
}))), isShowAction && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
210
222
|
ref: drag,
|
@@ -4,8 +4,8 @@ import "antd/es/row/style";
|
|
4
4
|
import _Row from "antd/es/row";
|
5
5
|
import "antd/es/col/style";
|
6
6
|
import _Col from "antd/es/col";
|
7
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
8
7
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
8
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
9
9
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
10
10
|
import React from 'react';
|
11
11
|
import { useDrop } from 'react-dnd';
|
@@ -20,6 +20,7 @@ var CanvasCore = function CanvasCore(props) {
|
|
20
20
|
var _formSetting$layout;
|
21
21
|
|
22
22
|
var refId = props.refId,
|
23
|
+
nodes = props.nodes,
|
23
24
|
onChange = props.onChange;
|
24
25
|
var fGCtx = React.useContext(FGCtx) || {};
|
25
26
|
|
@@ -45,6 +46,29 @@ var CanvasCore = function CanvasCore(props) {
|
|
45
46
|
allSetting = _React$useState8[0],
|
46
47
|
setAllSetting = _React$useState8[1];
|
47
48
|
|
49
|
+
var allSettingRef = React.useRef();
|
50
|
+
React.useEffect(function () {
|
51
|
+
if (refId && nodes.length > 0) {
|
52
|
+
setList(_toConsumableArray(nodes));
|
53
|
+
listRef.current = nodes;
|
54
|
+
}
|
55
|
+
}, [refId, nodes]); // 处理默认数据
|
56
|
+
|
57
|
+
var processDefaultValue = React.useCallback(function (data) {
|
58
|
+
if (!refId) {
|
59
|
+
setList(_toConsumableArray(data.nodes));
|
60
|
+
listRef.current = data.nodes;
|
61
|
+
|
62
|
+
if (data.types) {
|
63
|
+
fGCtx.fgStream && fGCtx.fgStream.next({
|
64
|
+
type: streamEventType.onTypesChange,
|
65
|
+
payload: data.types
|
66
|
+
});
|
67
|
+
}
|
68
|
+
|
69
|
+
onChange && onChange(data.nodes);
|
70
|
+
}
|
71
|
+
}, []);
|
48
72
|
var addNewNode = React.useCallback(function (_node, dropId, position) {
|
49
73
|
var _newNode;
|
50
74
|
|
@@ -149,17 +173,23 @@ var CanvasCore = function CanvasCore(props) {
|
|
149
173
|
|
150
174
|
if ((p === null || p === void 0 ? void 0 : p.payload.refId) === refId) {
|
151
175
|
if (refId) {
|
152
|
-
var _p$payload5;
|
176
|
+
var _p$payload5, _p$payload6;
|
153
177
|
|
154
178
|
setAllSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload5 = p.payload) === null || _p$payload5 === void 0 ? void 0 : _p$payload5.allSetting[refId]));
|
179
|
+
allSettingRef.current = _objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload6 = p.payload) === null || _p$payload6 === void 0 ? void 0 : _p$payload6.allSetting[refId]);
|
155
180
|
} else {
|
156
|
-
var _p$
|
181
|
+
var _p$payload7, _p$payload8;
|
157
182
|
|
158
|
-
setAllSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$
|
183
|
+
setAllSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload7 = p.payload) === null || _p$payload7 === void 0 ? void 0 : _p$payload7.allSetting));
|
184
|
+
allSettingRef.current = _objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload8 = p.payload) === null || _p$payload8 === void 0 ? void 0 : _p$payload8.allSetting);
|
159
185
|
}
|
160
186
|
}
|
161
187
|
|
162
188
|
break;
|
189
|
+
|
190
|
+
case streamEventType.onDefaultValue:
|
191
|
+
processDefaultValue(p === null || p === void 0 ? void 0 : p.payload);
|
192
|
+
break;
|
163
193
|
}
|
164
194
|
}, []);
|
165
195
|
useObservable(function (p) {
|
@@ -67,43 +67,79 @@ var Canvas = function Canvas() {
|
|
67
67
|
id: 'FormGenerator',
|
68
68
|
type: 'object',
|
69
69
|
properties: [{
|
70
|
-
id: '
|
71
|
-
type: '
|
70
|
+
id: 'name',
|
71
|
+
type: 'text',
|
72
72
|
fields: [{
|
73
73
|
id: 'com.ronds.schema.default.Rule.Form',
|
74
74
|
type: 'ref',
|
75
75
|
refId: 'com.ronds.schema.default.Rule.Form',
|
76
76
|
value: {
|
77
|
-
|
78
|
-
|
77
|
+
common: {
|
78
|
+
id: 'name',
|
79
|
+
label: '名称',
|
80
|
+
color: '#d13333',
|
81
|
+
colSpan: 1,
|
82
|
+
defaultValue: '1',
|
83
|
+
help: '2',
|
84
|
+
tooltip: '3',
|
85
|
+
placeholder: '4',
|
86
|
+
require: true,
|
87
|
+
disabled: true,
|
88
|
+
rules: []
|
89
|
+
},
|
90
|
+
text: {}
|
79
91
|
}
|
80
|
-
}]
|
81
|
-
refId: 'obj-e5f4_ref'
|
92
|
+
}]
|
82
93
|
}, {
|
83
|
-
id: '
|
84
|
-
type: '
|
94
|
+
id: 'config',
|
95
|
+
type: 'ref',
|
85
96
|
fields: [{
|
86
97
|
id: 'com.ronds.schema.default.Rule.Form',
|
87
98
|
type: 'ref',
|
88
99
|
refId: 'com.ronds.schema.default.Rule.Form',
|
89
100
|
value: {
|
90
|
-
|
91
|
-
|
101
|
+
common: {
|
102
|
+
id: 'config',
|
103
|
+
label: '配置中心',
|
104
|
+
color: '#5671c2',
|
105
|
+
depend: {}
|
106
|
+
},
|
107
|
+
ref: {}
|
92
108
|
}
|
93
|
-
}]
|
109
|
+
}],
|
110
|
+
refId: 'Setting'
|
111
|
+
}],
|
112
|
+
fields: [{
|
113
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
114
|
+
type: 'ref',
|
115
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
116
|
+
value: {
|
117
|
+
colSpan: 24,
|
118
|
+
layout: 'horizontal'
|
119
|
+
}
|
94
120
|
}],
|
95
121
|
types: [{
|
96
|
-
id: '
|
122
|
+
id: 'Setting',
|
97
123
|
type: 'object',
|
98
124
|
properties: [{
|
99
|
-
id: '
|
125
|
+
id: 'ege',
|
100
126
|
type: 'text',
|
101
127
|
fields: [{
|
102
128
|
id: 'com.ronds.schema.default.Rule.Form',
|
103
129
|
type: 'ref',
|
104
130
|
refId: 'com.ronds.schema.default.Rule.Form',
|
105
131
|
value: {
|
106
|
-
|
132
|
+
common: {
|
133
|
+
id: 'ege',
|
134
|
+
label: '年纪',
|
135
|
+
color: '#df8181',
|
136
|
+
defaultValue: '1',
|
137
|
+
help: '4',
|
138
|
+
tooltip: '333',
|
139
|
+
placeholder: '5',
|
140
|
+
rules: [null],
|
141
|
+
depend: {}
|
142
|
+
},
|
107
143
|
text: {
|
108
144
|
type: 'textarea'
|
109
145
|
}
|
@@ -112,7 +148,11 @@ var Canvas = function Canvas() {
|
|
112
148
|
}]
|
113
149
|
}]
|
114
150
|
}];
|
115
|
-
var
|
151
|
+
var defaultValue = transSchema2FG(_schema);
|
152
|
+
fGCtx.fgStream && fGCtx.fgStream.next({
|
153
|
+
type: streamEventType.onDefaultValue,
|
154
|
+
payload: _objectSpread({}, defaultValue)
|
155
|
+
});
|
116
156
|
};
|
117
157
|
|
118
158
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -29,7 +29,18 @@ var Settings = function Settings() {
|
|
29
29
|
var refIdRef = React.useRef();
|
30
30
|
var settingValueRef = React.useRef({
|
31
31
|
formSetting: formSetting.param.defaultValue
|
32
|
-
});
|
32
|
+
}); // 处理默认数据
|
33
|
+
|
34
|
+
var processDefaultValue = React.useCallback(function (data) {
|
35
|
+
settingValueRef.current = data.settings;
|
36
|
+
fGCtx.fgStream && fGCtx.fgStream.next({
|
37
|
+
type: streamEventType.onSettingValueChange,
|
38
|
+
payload: _objectSpread(_objectSpread({}, data.settings), {}, {
|
39
|
+
allSetting: settingValueRef.current,
|
40
|
+
refId: refIdRef.current
|
41
|
+
})
|
42
|
+
});
|
43
|
+
}, []);
|
33
44
|
var processFgStreamData = React.useCallback(function (p) {
|
34
45
|
switch (p === null || p === void 0 ? void 0 : p.type) {
|
35
46
|
case streamEventType.onNodeSelect:
|
@@ -62,6 +73,10 @@ var Settings = function Settings() {
|
|
62
73
|
setCurNode(undefined);
|
63
74
|
setCurTab('formSetting');
|
64
75
|
break;
|
76
|
+
|
77
|
+
case streamEventType.onDefaultValue:
|
78
|
+
processDefaultValue(p === null || p === void 0 ? void 0 : p.payload);
|
79
|
+
break;
|
65
80
|
}
|
66
81
|
}, []);
|
67
82
|
useObservable(function (p) {
|
@@ -109,8 +124,7 @@ var Settings = function Settings() {
|
|
109
124
|
schema: (_curNode$param = curNode.param) === null || _curNode$param === void 0 ? void 0 : _curNode$param.schema,
|
110
125
|
getFormInstance: function getFormInstance(form) {
|
111
126
|
compFormRef.current = form;
|
112
|
-
}
|
113
|
-
,
|
127
|
+
},
|
114
128
|
colSpan: 24,
|
115
129
|
labelSpan: 8,
|
116
130
|
onValuesChange: function onValuesChange(val, allVals) {
|
@@ -1,10 +1,12 @@
|
|
1
|
-
import
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
3
|
|
3
4
|
/*
|
4
5
|
* @Author: wangxian
|
5
6
|
* @Date: 2023-02-04 13:45:31
|
6
|
-
* @LastEditTime: 2023-02-
|
7
|
+
* @LastEditTime: 2023-02-21 15:34:17
|
7
8
|
*/
|
9
|
+
import React from 'react';
|
8
10
|
import { DndProvider } from 'react-dnd';
|
9
11
|
import { HTML5Backend } from 'react-dnd-html5-backend';
|
10
12
|
import Canvas from './comps/Canvas';
|
@@ -13,12 +15,36 @@ import Sidebar from './comps/Sidebar';
|
|
13
15
|
import './index.less';
|
14
16
|
import { FGCtx } from './Provider';
|
15
17
|
import useMemoSubject from '../../framework/rxjs-hooks/useMemoSubject';
|
18
|
+
import useObservable from '../../framework/rxjs-hooks/useObservable';
|
19
|
+
import { streamEventType } from './settings';
|
16
20
|
|
17
21
|
var FormGenerator = function FormGenerator(props) {
|
18
22
|
var FGStream = useMemoSubject();
|
23
|
+
|
24
|
+
var _React$useState = React.useState({}),
|
25
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
26
|
+
types = _React$useState2[0],
|
27
|
+
setTypes = _React$useState2[1];
|
28
|
+
|
29
|
+
var typesRef = React.useRef({});
|
30
|
+
var processFgStreamData = React.useCallback(function (p) {
|
31
|
+
switch (p === null || p === void 0 ? void 0 : p.type) {
|
32
|
+
case streamEventType.onTypesChange:
|
33
|
+
if (p === null || p === void 0 ? void 0 : p.payload) {
|
34
|
+
typesRef.current = _objectSpread(_objectSpread({}, typesRef.current), p === null || p === void 0 ? void 0 : p.payload);
|
35
|
+
setTypes(_objectSpread({}, typesRef.current));
|
36
|
+
}
|
37
|
+
|
38
|
+
break;
|
39
|
+
}
|
40
|
+
}, []);
|
41
|
+
useObservable(function (p) {
|
42
|
+
processFgStreamData(p);
|
43
|
+
}, [FGStream]);
|
19
44
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FGCtx.Provider, {
|
20
45
|
value: {
|
21
|
-
fgStream: FGStream
|
46
|
+
fgStream: FGStream,
|
47
|
+
types: types
|
22
48
|
}
|
23
49
|
}, /*#__PURE__*/React.createElement(DndProvider, {
|
24
50
|
backend: HTML5Backend
|
@@ -3,7 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
3
|
/*
|
4
4
|
* @Author: wangxian
|
5
5
|
* @Date: 2023-02-06 08:24:17
|
6
|
-
* @LastEditTime: 2023-02-
|
6
|
+
* @LastEditTime: 2023-02-21 14:19:44
|
7
7
|
*/
|
8
8
|
import { RefRule, Rule } from './ruleConfig';
|
9
9
|
export var inputSchema = [{
|
@@ -298,5 +298,6 @@ export var streamEventType = {
|
|
298
298
|
onClearCanvas: 'onClearCanvas',
|
299
299
|
onSettingValueChange: 'onSettingValueChange',
|
300
300
|
onTypesChange: 'onTypesChange',
|
301
|
-
onDropOver: 'onDropOver'
|
301
|
+
onDropOver: 'onDropOver',
|
302
|
+
onDefaultValue: 'onDefaultValue'
|
302
303
|
};
|
@@ -2,6 +2,6 @@ import { FG } from '../../comps/FormGenerator/index.d';
|
|
2
2
|
export declare const transFG2Schema: (nodes: FG.Node[], settings: any, _types?: any, schemaId?: string) => any;
|
3
3
|
export declare const transSchema2FG: (schema: any) => {
|
4
4
|
nodes: any[];
|
5
|
-
|
6
|
-
types:
|
5
|
+
settings: {};
|
6
|
+
types: {};
|
7
7
|
};
|
@@ -4,9 +4,10 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
/*
|
5
5
|
* @Author: wangxian
|
6
6
|
* @Date: 2023-02-08 14:45:46
|
7
|
-
* @LastEditTime: 2023-02-
|
7
|
+
* @LastEditTime: 2023-02-21 14:51:10
|
8
8
|
*/
|
9
9
|
import { deepClone } from '../../utils';
|
10
|
+
import { basicComps, layoutComps } from './settings';
|
10
11
|
var EMPTY_OBJ = [{
|
11
12
|
id: 'FormGenerator',
|
12
13
|
type: 'object',
|
@@ -41,9 +42,13 @@ var renderProp = function renderProp(node, setting) {
|
|
41
42
|
_prop.refId = "".concat(_prop.id, "_ref");
|
42
43
|
}
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
var typeValue = _setting[node.param.type];
|
46
|
+
delete _setting[node.param.type];
|
47
|
+
_prop.fields[0].value = _defineProperty({
|
48
|
+
common: _objectSpread(_objectSpread({}, _setting), {}, {
|
49
|
+
label: (_setting === null || _setting === void 0 ? void 0 : _setting.label) || node.name
|
50
|
+
})
|
51
|
+
}, node.param.type, _objectSpread(_objectSpread({}, node.param.rule || {}), typeValue));
|
47
52
|
return _prop;
|
48
53
|
}; // FG配置生成 metedata
|
49
54
|
|
@@ -93,19 +98,116 @@ export var transFG2Schema = function transFG2Schema(nodes, settings, _types, sch
|
|
93
98
|
}
|
94
99
|
};
|
95
100
|
|
96
|
-
var
|
101
|
+
var renderJson = function renderJson(comps, type, id, field) {
|
102
|
+
var _field$common;
|
103
|
+
|
104
|
+
var _comps = deepClone(comps);
|
105
|
+
|
106
|
+
var node = _comps.find(function (it) {
|
107
|
+
return it.type === type;
|
108
|
+
});
|
109
|
+
|
110
|
+
node.id = id;
|
111
|
+
node.name = (field === null || field === void 0 ? void 0 : (_field$common = field.common) === null || _field$common === void 0 ? void 0 : _field$common.label) || node.name;
|
112
|
+
|
113
|
+
var _field = deepClone(field);
|
114
|
+
|
115
|
+
_field = _objectSpread(_objectSpread({}, _field), _field.common);
|
116
|
+
_field.id = id;
|
117
|
+
delete _field.common;
|
118
|
+
|
119
|
+
var setting = _defineProperty({}, id, _objectSpread({}, _field));
|
120
|
+
|
121
|
+
return {
|
122
|
+
node: node,
|
123
|
+
setting: setting
|
124
|
+
};
|
125
|
+
};
|
126
|
+
|
127
|
+
var getTypeJson = function getTypeJson(id, type, field) {
|
128
|
+
var res = {
|
129
|
+
node: {},
|
130
|
+
setting: {}
|
131
|
+
};
|
132
|
+
|
133
|
+
if (type === 'text') {
|
134
|
+
var _field$text, _field$text2;
|
135
|
+
|
136
|
+
// input
|
137
|
+
if (!(field === null || field === void 0 ? void 0 : (_field$text = field.text) === null || _field$text === void 0 ? void 0 : _field$text.type)) {
|
138
|
+
res = renderJson(basicComps, 'input', id, field);
|
139
|
+
} // textarea
|
140
|
+
|
141
|
+
|
142
|
+
if ((field === null || field === void 0 ? void 0 : (_field$text2 = field.text) === null || _field$text2 === void 0 ? void 0 : _field$text2.type) === 'textarea') {
|
143
|
+
var _field$text3;
|
144
|
+
|
145
|
+
field === null || field === void 0 ? true : (_field$text3 = field.text) === null || _field$text3 === void 0 ? true : delete _field$text3.type;
|
146
|
+
res = renderJson(basicComps, 'textarea', id, field);
|
147
|
+
}
|
148
|
+
} // obj
|
149
|
+
|
150
|
+
|
151
|
+
if (type === 'ref') {
|
152
|
+
res = renderJson(layoutComps, 'obj', id, field);
|
153
|
+
}
|
154
|
+
|
155
|
+
return res;
|
156
|
+
};
|
157
|
+
|
158
|
+
var processProps = function processProps(prop) {
|
159
|
+
// 获取是什么类型的组件
|
160
|
+
var obj = getTypeJson(prop.id, prop.type, prop.fields[0].value);
|
161
|
+
return obj;
|
162
|
+
};
|
163
|
+
|
164
|
+
var getTypeParent = function getTypeParent(refId, _props) {
|
165
|
+
var _ = _props.find(function (it) {
|
166
|
+
var _it$items;
|
167
|
+
|
168
|
+
return (it === null || it === void 0 ? void 0 : it.refId) === refId || (it === null || it === void 0 ? void 0 : (_it$items = it.items) === null || _it$items === void 0 ? void 0 : _it$items.refId) === refId;
|
169
|
+
});
|
170
|
+
|
171
|
+
return _;
|
172
|
+
}; // metadata 生成FG配置
|
97
173
|
|
98
174
|
|
99
175
|
export var transSchema2FG = function transSchema2FG(schema) {
|
176
|
+
var _schema$;
|
177
|
+
|
100
178
|
var res = {
|
101
179
|
nodes: [],
|
102
|
-
|
103
|
-
types:
|
180
|
+
settings: {},
|
181
|
+
types: {}
|
104
182
|
};
|
105
183
|
var _props = schema[0].properties; // { id: 'input', name: '输入框', type: 'input', param: inputParam },
|
106
184
|
|
107
185
|
for (var i = 0; i < _props.length; i++) {
|
108
186
|
var obj = processProps(_props[i]);
|
187
|
+
res.nodes.push(obj.node);
|
188
|
+
res.settings = _objectSpread(_objectSpread({}, res.settings), obj.setting);
|
189
|
+
}
|
190
|
+
|
191
|
+
var _types = (_schema$ = schema[0]) === null || _schema$ === void 0 ? void 0 : _schema$.types;
|
192
|
+
|
193
|
+
if (_types && _types.length > 0) {
|
194
|
+
for (var _i2 = 0; _i2 < _types.length; _i2++) {
|
195
|
+
var _parent = getTypeParent(_types[_i2].id, _props);
|
196
|
+
|
197
|
+
if (_parent) {
|
198
|
+
var _schema = deepClone(_types[_i2]);
|
199
|
+
|
200
|
+
_schema.id = "".concat(_parent.id, "_ref");
|
201
|
+
|
202
|
+
var _ = transSchema2FG([_schema]);
|
203
|
+
|
204
|
+
res.types[_parent.id] = {
|
205
|
+
id: _parent.id,
|
206
|
+
nodes: _.nodes
|
207
|
+
};
|
208
|
+
res.settings[_schema.id] = _.settings;
|
209
|
+
}
|
210
|
+
}
|
109
211
|
}
|
110
212
|
|
111
213
|
return res;
|
@@ -12,24 +12,25 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
12
12
|
/*
|
13
13
|
* @Author: wangxian
|
14
14
|
* @Date: 2021-09-18 14:15:04
|
15
|
-
* @LastEditTime: 2023-02-
|
15
|
+
* @LastEditTime: 2023-02-21 19:21:07
|
16
16
|
*/
|
17
17
|
import React from 'react';
|
18
18
|
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
19
19
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
20
|
-
import { useGetExtraInfo
|
20
|
+
import { useGetExtraInfo } from '../hooks';
|
21
21
|
import { getDataCell } from '../utils';
|
22
22
|
import { deepClone } from '../../../utils';
|
23
23
|
import { tr } from '../../../framework/locale';
|
24
24
|
import TableArray from './layout/TableArray';
|
25
25
|
|
26
26
|
function Index(props) {
|
27
|
-
var
|
27
|
+
var _fieldRule$, _fieldRule$$value, _fieldRule$2, _fieldRule$2$value, _extraInfo$disabled;
|
28
28
|
|
29
29
|
var id = props.id,
|
30
30
|
items = props.items,
|
31
31
|
isRefForm = props.isRefForm,
|
32
32
|
fieldRule = props.fields,
|
33
|
+
colSpan = props.colSpan,
|
33
34
|
initEnumValue = props.initEnumValue,
|
34
35
|
name = props.name,
|
35
36
|
disabled = props.disabled;
|
@@ -55,7 +56,6 @@ function Index(props) {
|
|
55
56
|
help = _React$useState2[0],
|
56
57
|
setHelp = _React$useState2[1];
|
57
58
|
|
58
|
-
var depend = useWatchDepend(extraInfo.depend, formContext.stream$);
|
59
59
|
var myName = React.useMemo(function () {
|
60
60
|
var res = [];
|
61
61
|
|
@@ -74,15 +74,6 @@ function Index(props) {
|
|
74
74
|
setHelp(arr[arr.length - 1]);
|
75
75
|
}
|
76
76
|
}, [items]);
|
77
|
-
|
78
|
-
if (depend.hidden) {
|
79
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
80
|
-
}
|
81
|
-
|
82
|
-
if ((extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$depend = extraInfo.depend) === null || _extraInfo$depend === void 0 ? void 0 : _extraInfo$depend.show) && !depend.show) {
|
83
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
84
|
-
}
|
85
|
-
|
86
77
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, null, /*#__PURE__*/React.createElement(_Col, {
|
87
78
|
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
|
88
79
|
}, !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && /*#__PURE__*/React.createElement("div", {
|
@@ -147,7 +138,7 @@ function Index(props) {
|
|
147
138
|
isRefForm: isRefForm,
|
148
139
|
isShowTypeInfo: formContext.isShowTypeInfo,
|
149
140
|
field: field
|
150
|
-
}), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
|
141
|
+
}, colSpan), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
|
151
142
|
style: {
|
152
143
|
marginLeft: '10px'
|
153
144
|
},
|
@@ -17,16 +17,16 @@ import _Input from "antd/es/input";
|
|
17
17
|
/*
|
18
18
|
* @Author: wangxian
|
19
19
|
* @Date: 2021-09-18 14:15:04
|
20
|
-
* @LastEditTime: 2023-02-
|
20
|
+
* @LastEditTime: 2023-02-21 19:15:22
|
21
21
|
*/
|
22
22
|
import React from 'react';
|
23
23
|
import { UploadOutlined } from '@ant-design/icons';
|
24
24
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
25
|
-
import { useGetExtraInfo
|
25
|
+
import { useGetExtraInfo } from '../hooks';
|
26
26
|
var TextArea = _Input.TextArea;
|
27
27
|
|
28
28
|
function Index(props) {
|
29
|
-
var _extraInfo$
|
29
|
+
var _extraInfo$addonAfter6;
|
30
30
|
|
31
31
|
var id = props.id,
|
32
32
|
isRefForm = props.isRefForm,
|
@@ -37,7 +37,6 @@ function Index(props) {
|
|
37
37
|
var formContext = React.useContext(MetadataFormContext) || {};
|
38
38
|
var formRefContext = React.useContext(MetadataRefContext);
|
39
39
|
var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
|
40
|
-
var depend = useWatchDepend(extraInfo.depend, formContext.stream$);
|
41
40
|
|
42
41
|
var _React$useState = React.useState([]),
|
43
42
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
@@ -51,7 +50,7 @@ function Index(props) {
|
|
51
50
|
var _ = _rules.map(function (it) {
|
52
51
|
return {
|
53
52
|
pattern: new RegExp(eval(it === null || it === void 0 ? void 0 : it.regExp), 'g'),
|
54
|
-
message: it.message
|
53
|
+
message: it === null || it === void 0 ? void 0 : it.message
|
55
54
|
};
|
56
55
|
});
|
57
56
|
|
@@ -118,15 +117,7 @@ function Index(props) {
|
|
118
117
|
onChange: onChange
|
119
118
|
});
|
120
119
|
}
|
121
|
-
};
|
122
|
-
|
123
|
-
if (depend.hidden) {
|
124
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
125
|
-
}
|
126
|
-
|
127
|
-
if ((extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$depend = extraInfo.depend) === null || _extraInfo$depend === void 0 ? void 0 : _extraInfo$depend.show) && !depend.show) {
|
128
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
129
|
-
} // ref引用的 应用类型是否展示成表单
|
120
|
+
}; // ref引用的 应用类型是否展示成表单
|
130
121
|
|
131
122
|
|
132
123
|
if (isObj && isRefForm && field) {
|
@@ -9,14 +9,14 @@ 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-21 19:16:02
|
13
13
|
*/
|
14
14
|
import React from 'react';
|
15
15
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
16
|
-
import { useGetExtraInfo
|
16
|
+
import { useGetExtraInfo } from '../hooks';
|
17
17
|
|
18
18
|
function Index(props) {
|
19
|
-
var _extraInfo$
|
19
|
+
var _extraInfo$disabled2, _extraInfo$disabled3;
|
20
20
|
|
21
21
|
var id = props.id,
|
22
22
|
name = props.name,
|
@@ -33,7 +33,6 @@ function Index(props) {
|
|
33
33
|
rules = _React$useState2[0],
|
34
34
|
setRules = _React$useState2[1];
|
35
35
|
|
36
|
-
var depend = useWatchDepend(extraInfo.depend, formContext.stream$);
|
37
36
|
React.useEffect(function () {
|
38
37
|
var _rules = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.rules;
|
39
38
|
|
@@ -49,14 +48,6 @@ function Index(props) {
|
|
49
48
|
}
|
50
49
|
}, [extraInfo]);
|
51
50
|
|
52
|
-
if (depend.hidden) {
|
53
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
54
|
-
}
|
55
|
-
|
56
|
-
if ((extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$depend = extraInfo.depend) === null || _extraInfo$depend === void 0 ? void 0 : _extraInfo$depend.show) && !depend.show) {
|
57
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
58
|
-
}
|
59
|
-
|
60
51
|
if (isObj && isRefForm && field) {
|
61
52
|
var _extraInfo$disabled;
|
62
53
|
|
@@ -18,12 +18,12 @@ import React from 'react';
|
|
18
18
|
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons';
|
19
19
|
import { MetadataService } from '../../../framework/metadata/MetadataService';
|
20
20
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
21
|
-
import { useGetExtraInfo
|
21
|
+
import { useGetExtraInfo } from '../hooks';
|
22
22
|
import { renderForm } from '../utils';
|
23
23
|
import { JsonMetadataProvider } from '../../../framework/metadata';
|
24
24
|
|
25
25
|
function Index(props) {
|
26
|
-
var _extraInfo$
|
26
|
+
var _extraInfo$disabled, _extraInfo$disabled2;
|
27
27
|
|
28
28
|
var id = props.id,
|
29
29
|
refId = props.refId,
|
@@ -63,7 +63,6 @@ function Index(props) {
|
|
63
63
|
help = _React$useState10[0],
|
64
64
|
setHelp = _React$useState10[1];
|
65
65
|
|
66
|
-
var depend = useWatchDepend(extraInfo.depend, formContext.stream$);
|
67
66
|
var onSearch = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
68
67
|
var param, server, res, _options, i, obj;
|
69
68
|
|
@@ -197,14 +196,6 @@ function Index(props) {
|
|
197
196
|
}
|
198
197
|
}, [refId]);
|
199
198
|
|
200
|
-
if (depend.hidden) {
|
201
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
202
|
-
}
|
203
|
-
|
204
|
-
if ((extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$depend = extraInfo.depend) === null || _extraInfo$depend === void 0 ? void 0 : _extraInfo$depend.show) && !depend.show) {
|
205
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
206
|
-
}
|
207
|
-
|
208
199
|
if (isRefForm && !field && schema.length > 0) {
|
209
200
|
var _fieldRule$, _fieldRule$$value, _fieldRule$2, _fieldRule$2$value, _fieldRule$2$value$co;
|
210
201
|
|
@@ -31,11 +31,11 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
31
31
|
/*
|
32
32
|
* @Author:wangxian
|
33
33
|
* @Date: 2021-09-18 14:15:04
|
34
|
-
* @LastEditTime: 2023-02-
|
34
|
+
* @LastEditTime: 2023-02-21 19:19:39
|
35
35
|
*/
|
36
36
|
import React from 'react';
|
37
37
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
38
|
-
import { useGetExtraInfo
|
38
|
+
import { useGetExtraInfo } from '../hooks';
|
39
39
|
import { MetadataService } from '../../../framework/metadata/MetadataService';
|
40
40
|
import { deepClone } from '../../../utils';
|
41
41
|
import { useAsyncMemo } from '../../../framework/hooks/use-async-memo';
|
@@ -44,7 +44,7 @@ import useObservable from '../../../framework/rxjs-hooks/useObservable';
|
|
44
44
|
import { assign } from '../utils';
|
45
45
|
|
46
46
|
function Index(props) {
|
47
|
-
var _extraInfo$
|
47
|
+
var _extraInfo$http6, _extraInfo$http7, _extraInfo$http8, _extraInfo$http9;
|
48
48
|
|
49
49
|
var id = props.id,
|
50
50
|
name = props.name,
|
@@ -73,7 +73,6 @@ function Index(props) {
|
|
73
73
|
var watchValueRef = React.useRef();
|
74
74
|
var pageRef = React.useRef(1);
|
75
75
|
var totalRef = React.useRef();
|
76
|
-
var depend = useWatchDepend(extraInfo.depend, formContext.stream$);
|
77
76
|
|
78
77
|
var onSelect = function onSelect(value) {
|
79
78
|
formContext.stream$ && formContext.stream$.next({
|
@@ -441,14 +440,6 @@ function Index(props) {
|
|
441
440
|
}
|
442
441
|
};
|
443
442
|
|
444
|
-
if (depend.hidden) {
|
445
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
446
|
-
}
|
447
|
-
|
448
|
-
if ((extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$depend = extraInfo.depend) === null || _extraInfo$depend === void 0 ? void 0 : _extraInfo$depend.show) && !depend.show) {
|
449
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
450
|
-
}
|
451
|
-
|
452
443
|
if (isObj && isRefForm && field) {
|
453
444
|
var _extraInfo$http4, _extraInfo$http5;
|
454
445
|
|
@@ -8,14 +8,14 @@ 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-21 19:17:13
|
12
12
|
*/
|
13
13
|
import React from 'react';
|
14
14
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
15
|
-
import { useGetExtraInfo
|
15
|
+
import { useGetExtraInfo } from '../hooks';
|
16
16
|
|
17
17
|
function Index(props) {
|
18
|
-
var _extraInfo$
|
18
|
+
var _extraInfo$disabled2, _extraInfo$disabled3;
|
19
19
|
|
20
20
|
var id = props.id,
|
21
21
|
name = props.name,
|
@@ -26,15 +26,6 @@ function Index(props) {
|
|
26
26
|
var formContext = React.useContext(MetadataFormContext) || {};
|
27
27
|
var formRefContext = React.useContext(MetadataRefContext);
|
28
28
|
var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
|
29
|
-
var depend = useWatchDepend(extraInfo.depend, formContext.stream$);
|
30
|
-
|
31
|
-
if (depend.hidden) {
|
32
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
33
|
-
}
|
34
|
-
|
35
|
-
if ((extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$depend = extraInfo.depend) === null || _extraInfo$depend === void 0 ? void 0 : _extraInfo$depend.show) && !depend.show) {
|
36
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
37
|
-
}
|
38
29
|
|
39
30
|
if (isObj && isRefForm && field) {
|
40
31
|
var _extraInfo$disabled;
|
@@ -1,30 +1,39 @@
|
|
1
|
+
import "antd/es/col/style";
|
2
|
+
import _Col from "antd/es/col";
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
-
|
4
|
-
/*
|
5
|
-
* @Author: wangxian
|
6
|
-
* @Date: 2021-09-18 14:15:04
|
7
|
-
* @LastEditTime: 2022-11-22 15:37:46
|
8
|
-
*/
|
9
5
|
import React from 'react';
|
10
6
|
import { deepClone } from '../../../utils';
|
7
|
+
import { useWatchDepend } from '../hooks';
|
8
|
+
import { MetadataFormContext } from '../interface';
|
11
9
|
import './index.less';
|
12
10
|
export function withAddOnAfter(WrappedComponent) {
|
13
11
|
return function (props) {
|
12
|
+
var _fields$, _fields$$value, _fields$$value$common, _fields$4, _fields$4$value, _fields$4$value$commo, _fields$4$value$commo2;
|
13
|
+
|
14
14
|
var type = props.type,
|
15
15
|
refId = props.refId,
|
16
16
|
isShowTypeInfo = props.isShowTypeInfo,
|
17
|
+
fields = props.fields,
|
18
|
+
colSpan = props.colSpan,
|
17
19
|
field = props.field,
|
18
20
|
id = props.id,
|
19
21
|
_props$name = props.name,
|
20
22
|
name = _props$name === void 0 ? [] : _props$name,
|
21
23
|
isObj = props.isObj;
|
24
|
+
var formContext = React.useContext(MetadataFormContext) || {};
|
25
|
+
var depend = useWatchDepend((_fields$ = fields[0]) === null || _fields$ === void 0 ? void 0 : (_fields$$value = _fields$.value) === null || _fields$$value === void 0 ? void 0 : (_fields$$value$common = _fields$$value.common) === null || _fields$$value$common === void 0 ? void 0 : _fields$$value$common.depend, formContext.stream$);
|
22
26
|
|
23
27
|
var _React$useState = React.useState(),
|
24
28
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
25
29
|
help = _React$useState2[0],
|
26
30
|
setHelp = _React$useState2[1];
|
27
31
|
|
32
|
+
var _React$useState3 = React.useState(),
|
33
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
34
|
+
cellColSpan = _React$useState4[0],
|
35
|
+
setCellColSpan = _React$useState4[1];
|
36
|
+
|
28
37
|
React.useEffect(function () {
|
29
38
|
if (refId) {
|
30
39
|
var arr = refId.split(':');
|
@@ -33,6 +42,18 @@ export function withAddOnAfter(WrappedComponent) {
|
|
33
42
|
|
34
43
|
return function () {};
|
35
44
|
}, [refId]);
|
45
|
+
React.useEffect(function () {
|
46
|
+
var _fields$2, _fields$2$value, _fields$2$value$commo, _fields$3, _fields$3$value;
|
47
|
+
|
48
|
+
var _colSpan = colSpan;
|
49
|
+
var compColSpan = fields && (((_fields$2 = fields[0]) === null || _fields$2 === void 0 ? void 0 : (_fields$2$value = _fields$2.value) === null || _fields$2$value === void 0 ? void 0 : (_fields$2$value$commo = _fields$2$value.common) === null || _fields$2$value$commo === void 0 ? void 0 : _fields$2$value$commo.colSpan) || ((_fields$3 = fields[0]) === null || _fields$3 === void 0 ? void 0 : (_fields$3$value = _fields$3.value) === null || _fields$3$value === void 0 ? void 0 : _fields$3$value.colSpan));
|
50
|
+
|
51
|
+
if (compColSpan) {
|
52
|
+
_colSpan = compColSpan * colSpan <= 24 ? compColSpan * colSpan : 24;
|
53
|
+
}
|
54
|
+
|
55
|
+
setCellColSpan(_colSpan);
|
56
|
+
}, [fields, colSpan]);
|
36
57
|
|
37
58
|
var _name = React.useMemo(function () {
|
38
59
|
if (id && name.length > 0 && !field) {
|
@@ -44,7 +65,18 @@ export function withAddOnAfter(WrappedComponent) {
|
|
44
65
|
return [id];
|
45
66
|
}, [id, name]);
|
46
67
|
|
47
|
-
|
68
|
+
if (depend.hidden) {
|
69
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
70
|
+
}
|
71
|
+
|
72
|
+
if (((_fields$4 = fields[0]) === null || _fields$4 === void 0 ? void 0 : (_fields$4$value = _fields$4.value) === null || _fields$4$value === void 0 ? void 0 : (_fields$4$value$commo = _fields$4$value.common) === null || _fields$4$value$commo === void 0 ? void 0 : (_fields$4$value$commo2 = _fields$4$value$commo.depend) === null || _fields$4$value$commo2 === void 0 ? void 0 : _fields$4$value$commo2.show) && !depend.show) {
|
73
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
74
|
+
}
|
75
|
+
|
76
|
+
return /*#__PURE__*/React.createElement(_Col, {
|
77
|
+
key: id,
|
78
|
+
span: cellColSpan
|
79
|
+
}, /*#__PURE__*/React.createElement("div", {
|
48
80
|
key: "".concat(_name.toString(), "_div"),
|
49
81
|
className: "with-add-on-after"
|
50
82
|
}, /*#__PURE__*/React.createElement(WrappedComponent, _extends({
|
@@ -58,6 +90,6 @@ export function withAddOnAfter(WrappedComponent) {
|
|
58
90
|
isObj: isObj
|
59
91
|
})), isShowTypeInfo && !field && type !== 'number' && type !== 'bool' && /*#__PURE__*/React.createElement("div", {
|
60
92
|
className: "with-add-on-after-extra"
|
61
|
-
}, help !== null && help !== void 0 ? help : type));
|
93
|
+
}, help !== null && help !== void 0 ? help : type)));
|
62
94
|
};
|
63
95
|
}
|
@@ -5,7 +5,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
/*
|
6
6
|
* @Author: your name
|
7
7
|
* @Date: 2021-09-18 14:15:04
|
8
|
-
* @LastEditTime: 2023-02-
|
8
|
+
* @LastEditTime: 2023-02-21 19:11:53
|
9
9
|
*/
|
10
10
|
import { getLocale } from '../../../framework/locale';
|
11
11
|
import moment from 'moment';
|
@@ -107,7 +107,7 @@ var processDependHiddenOrShow = function processDependHiddenOrShow(depend, chang
|
|
107
107
|
|
108
108
|
var _key = key.split('.');
|
109
109
|
|
110
|
-
if (changeData[_key[0]]) {
|
110
|
+
if (changeData[_key[0]] || changeData[_key[0]] === 0) {
|
111
111
|
var r = key === _key[0] ? "'".concat(changeData[_key[0]], "'") : eval("changeData[_key[0]].".concat(_key[1]));
|
112
112
|
expression = expression.replace(key, r);
|
113
113
|
} else {
|
@@ -111,6 +111,13 @@ var MetadataForm = function MetadataForm(props) {
|
|
111
111
|
type: 'setFieldsValue',
|
112
112
|
payload: vals
|
113
113
|
});
|
114
|
+
stream$.next({
|
115
|
+
type: 'onValuesChange',
|
116
|
+
payload: {
|
117
|
+
val: vals,
|
118
|
+
allVals: vals
|
119
|
+
}
|
120
|
+
});
|
114
121
|
};
|
115
122
|
|
116
123
|
form.setFieldsValue = setFieldsValue;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { IFormOptions } from './interface';
|
2
|
-
export declare function getDataCell(item: any, options: IFormOptions): JSX.Element;
|
2
|
+
export declare function getDataCell(item: any, options: IFormOptions, colSpan: any): JSX.Element;
|
3
3
|
/**
|
4
4
|
* 渲染表单
|
5
5
|
* @param schemaRef 元数据的schema
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import "antd/es/row/style";
|
2
2
|
import _Row from "antd/es/row";
|
3
|
-
import "antd/es/col/style";
|
4
|
-
import _Col from "antd/es/col";
|
5
3
|
import "antd/es/spin/style";
|
6
4
|
import _Spin from "antd/es/spin";
|
7
5
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
@@ -9,7 +7,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
9
7
|
/*
|
10
8
|
* @Author: wangxian
|
11
9
|
* @Date: 2021-09-18 14:15:04
|
12
|
-
* @LastEditTime: 2023-02-
|
10
|
+
* @LastEditTime: 2023-02-21 19:35:40
|
13
11
|
*/
|
14
12
|
import React from 'react';
|
15
13
|
import Input from './DataCell/Input';
|
@@ -24,10 +22,10 @@ var DataCellMap = {
|
|
24
22
|
number: withAddOnAfter(Number),
|
25
23
|
enum: withAddOnAfter(Select),
|
26
24
|
bool: withAddOnAfter(Switch),
|
27
|
-
array: Array,
|
25
|
+
array: withAddOnAfter(Array),
|
28
26
|
ref: withAddOnAfter(Ref)
|
29
27
|
};
|
30
|
-
export function getDataCell(item, options) {
|
28
|
+
export function getDataCell(item, options, colSpan) {
|
31
29
|
if (item.type && DataCellMap[item.type]) {
|
32
30
|
var Comm = DataCellMap[item.type];
|
33
31
|
|
@@ -52,7 +50,8 @@ export function getDataCell(item, options) {
|
|
52
50
|
field: options.field,
|
53
51
|
name: options.pName,
|
54
52
|
initEnumValue: options.initEnumValue,
|
55
|
-
isObj: options.isObj
|
53
|
+
isObj: options.isObj,
|
54
|
+
colSpan: colSpan
|
56
55
|
}));
|
57
56
|
}
|
58
57
|
|
@@ -78,19 +77,8 @@ export function renderForm(schemaRef, options) {
|
|
78
77
|
var _form = [];
|
79
78
|
|
80
79
|
for (var i = 0; i < _properties.length; i++) {
|
81
|
-
|
82
|
-
|
83
|
-
var _colSpan = colSpan;
|
84
|
-
var compColSpan = ((_properties$i = _properties[i]) === null || _properties$i === void 0 ? void 0 : _properties$i.fields) && (((_properties$i2 = _properties[i]) === null || _properties$i2 === void 0 ? void 0 : (_properties$i2$fields = _properties$i2.fields[0]) === null || _properties$i2$fields === void 0 ? void 0 : (_properties$i2$fields2 = _properties$i2$fields.value) === null || _properties$i2$fields2 === void 0 ? void 0 : (_properties$i2$fields3 = _properties$i2$fields2.common) === null || _properties$i2$fields3 === void 0 ? void 0 : _properties$i2$fields3.colSpan) || ((_properties$i3 = _properties[i]) === null || _properties$i3 === void 0 ? void 0 : (_properties$i3$fields = _properties$i3.fields[0]) === null || _properties$i3$fields === void 0 ? void 0 : (_properties$i3$fields2 = _properties$i3$fields.value) === null || _properties$i3$fields2 === void 0 ? void 0 : _properties$i3$fields2.colSpan));
|
85
|
-
|
86
|
-
if (compColSpan) {
|
87
|
-
_colSpan = compColSpan * colSpan <= 24 ? compColSpan * colSpan : 24;
|
88
|
-
}
|
89
|
-
|
90
|
-
_form.push( /*#__PURE__*/React.createElement(_Col, {
|
91
|
-
key: _properties[i].id,
|
92
|
-
span: _colSpan
|
93
|
-
}, getDataCell(_properties[i], options)));
|
80
|
+
// const depend = useWatchDepend({});
|
81
|
+
_form.push( /*#__PURE__*/React.createElement(React.Fragment, null, getDataCell(_properties[i], options, colSpan)));
|
94
82
|
}
|
95
83
|
|
96
84
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|