ronds-metadata 1.1.93 → 1.1.95
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/Checkbox.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +23 -2
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.d.ts +2 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +17 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +8 -4
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.d.ts +4 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +13 -1
- package/es/comps/FormGenerator/comps/Canvas/core/index.d.ts +3 -2
- package/es/comps/FormGenerator/comps/Canvas/core/index.js +40 -16
- package/es/comps/FormGenerator/comps/Canvas/index.js +71 -4
- package/es/comps/FormGenerator/comps/Settings/index.js +31 -11
- package/es/comps/FormGenerator/settings/index.d.ts +170 -2
- package/es/comps/FormGenerator/settings/index.js +46 -4
- package/es/comps/FormGenerator/settings/ruleConfig.js +1 -3
- package/es/comps/FormGenerator/transformer.d.ts +5 -11
- package/es/comps/FormGenerator/transformer.js +62 -16
- package/es/comps/JsonView/index.less +41 -41
- package/es/comps/MetadataEdit/index.less +10 -10
- package/es/comps/MetadataEdit/type.d.ts +20 -20
- package/es/comps/MetadataForm/DataCell/Select.js +30 -14
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +8 -0
- package/es/comps/MetadataForm/utils.js +3 -3
- package/es/framework/metadata/types.d.ts +98 -98
- package/es/theme.less +77 -77
- package/package.json +94 -94
@@ -0,0 +1,17 @@
|
|
1
|
+
import "antd/es/input/style";
|
2
|
+
import _Input from "antd/es/input";
|
3
|
+
import React from "react";
|
4
|
+
import { withFieldCellWrapper } from '../HOC';
|
5
|
+
|
6
|
+
var Index = function Index(props) {
|
7
|
+
var data = props.data,
|
8
|
+
fgStream = props.fgStream,
|
9
|
+
setting = props.setting;
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Input, {
|
11
|
+
disabled: setting === null || setting === void 0 ? void 0 : setting.disabled,
|
12
|
+
placeholder: setting === null || setting === void 0 ? void 0 : setting.placeholder,
|
13
|
+
allowClear: true
|
14
|
+
}));
|
15
|
+
};
|
16
|
+
|
17
|
+
export default withFieldCellWrapper(Index);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import "antd/es/input/style";
|
2
|
+
import _Input from "antd/es/input";
|
3
|
+
import React from "react";
|
4
|
+
import { withFieldCellWrapper } from '../HOC';
|
5
|
+
|
6
|
+
var Index = function Index(props) {
|
7
|
+
var data = props.data,
|
8
|
+
fgStream = props.fgStream,
|
9
|
+
setting = props.setting;
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Input, {
|
11
|
+
disabled: setting === null || setting === void 0 ? void 0 : setting.disabled,
|
12
|
+
placeholder: setting === null || setting === void 0 ? void 0 : setting.placeholder,
|
13
|
+
allowClear: true
|
14
|
+
}));
|
15
|
+
};
|
16
|
+
|
17
|
+
export default withFieldCellWrapper(Index);
|
@@ -1,22 +1,43 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
|
+
|
1
5
|
/*
|
2
6
|
* @Author: uloveits 719310130@qq.com
|
3
7
|
* @Date: 2023-02-06 15:05:42
|
4
8
|
* @LastEditors: uloveits 719310130@qq.com
|
5
|
-
* @LastEditTime: 2023-02-
|
9
|
+
* @LastEditTime: 2023-02-17 14:54:47
|
6
10
|
*/
|
11
|
+
import React from 'react';
|
7
12
|
import CanvasCore from '../../index';
|
8
13
|
import { withFieldCellWrapper } from '../HOC';
|
9
|
-
import
|
14
|
+
import { streamEventType } from '../../../../../settings/index';
|
10
15
|
|
11
16
|
var Index = function Index(props) {
|
12
17
|
var data = props.data,
|
13
18
|
fgStream = props.fgStream,
|
14
19
|
setting = props.setting;
|
20
|
+
|
21
|
+
var _React$useState = React.useState([]),
|
22
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
23
|
+
nodes = _React$useState2[0],
|
24
|
+
setNodes = _React$useState2[1];
|
25
|
+
|
15
26
|
var nodesRef = React.useRef([]);
|
27
|
+
React.useEffect(function () {}, [setting]);
|
16
28
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CanvasCore, {
|
29
|
+
key: data.id,
|
17
30
|
refId: data.id,
|
18
31
|
onChange: function onChange(nodes) {
|
32
|
+
setNodes(_toConsumableArray(nodes));
|
19
33
|
nodesRef.current = nodes;
|
34
|
+
fgStream && fgStream.next({
|
35
|
+
type: streamEventType.onTypesChange,
|
36
|
+
payload: _defineProperty({}, data.id, {
|
37
|
+
id: (setting === null || setting === void 0 ? void 0 : setting.id) || data.id,
|
38
|
+
nodes: nodes
|
39
|
+
})
|
40
|
+
});
|
20
41
|
}
|
21
42
|
}));
|
22
43
|
};
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import "antd/es/input/style";
|
2
|
+
import _Input from "antd/es/input";
|
3
|
+
import React from "react";
|
4
|
+
import { withFieldCellWrapper } from '../HOC';
|
5
|
+
|
6
|
+
var Index = function Index(props) {
|
7
|
+
var data = props.data,
|
8
|
+
fgStream = props.fgStream,
|
9
|
+
setting = props.setting;
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Input, {
|
11
|
+
disabled: setting === null || setting === void 0 ? void 0 : setting.disabled,
|
12
|
+
placeholder: setting === null || setting === void 0 ? void 0 : setting.placeholder,
|
13
|
+
allowClear: true
|
14
|
+
}));
|
15
|
+
};
|
16
|
+
|
17
|
+
export default withFieldCellWrapper(Index);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import "antd/es/input/style";
|
2
|
+
import _Input from "antd/es/input";
|
3
|
+
import React from "react";
|
4
|
+
import { withFieldCellWrapper } from '../HOC';
|
5
|
+
|
6
|
+
var Index = function Index(props) {
|
7
|
+
var data = props.data,
|
8
|
+
fgStream = props.fgStream,
|
9
|
+
setting = props.setting;
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Input, {
|
11
|
+
disabled: setting === null || setting === void 0 ? void 0 : setting.disabled,
|
12
|
+
placeholder: setting === null || setting === void 0 ? void 0 : setting.placeholder,
|
13
|
+
allowClear: true
|
14
|
+
}));
|
15
|
+
};
|
16
|
+
|
17
|
+
export default withFieldCellWrapper(Index);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import "antd/es/input/style";
|
2
|
+
import _Input from "antd/es/input";
|
3
|
+
import React from "react";
|
4
|
+
import { withFieldCellWrapper } from '../HOC';
|
5
|
+
|
6
|
+
var Index = function Index(props) {
|
7
|
+
var data = props.data,
|
8
|
+
fgStream = props.fgStream,
|
9
|
+
setting = props.setting;
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Input, {
|
11
|
+
disabled: setting === null || setting === void 0 ? void 0 : setting.disabled,
|
12
|
+
placeholder: setting === null || setting === void 0 ? void 0 : setting.placeholder,
|
13
|
+
allowClear: true
|
14
|
+
}));
|
15
|
+
};
|
16
|
+
|
17
|
+
export default withFieldCellWrapper(Index);
|
@@ -7,14 +7,15 @@ import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestruct
|
|
7
7
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
8
8
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
9
9
|
import React from 'react';
|
10
|
+
import { useDrag, useDrop } from 'react-dnd';
|
10
11
|
import { DragOutlined, SnippetsOutlined, DeleteOutlined } from '@ant-design/icons';
|
11
12
|
import { FGCtx } from '../../../../../Provider';
|
12
13
|
import { dragItemType, streamEventType } from '../../../../../settings';
|
13
14
|
import useObservable from '../../../../../../../framework/rxjs-hooks/useObservable';
|
14
|
-
import { useDrag, useDrop } from 'react-dnd';
|
15
15
|
export function withFieldCellWrapper(WrappedComponent) {
|
16
16
|
return function (props) {
|
17
17
|
var data = props.data,
|
18
|
+
refId = props.refId,
|
18
19
|
isShowAction = props.isShowAction;
|
19
20
|
var fGCtx = React.useContext(FGCtx) || {};
|
20
21
|
var boxRef = React.useRef(null);
|
@@ -32,8 +33,10 @@ export function withFieldCellWrapper(WrappedComponent) {
|
|
32
33
|
var processFgStreamData = React.useCallback(function (p) {
|
33
34
|
switch (p === null || p === void 0 ? void 0 : p.type) {
|
34
35
|
case streamEventType.onSettingValueChange:
|
35
|
-
if (p === null || p === void 0 ? void 0 : p.payload
|
36
|
-
|
36
|
+
if ((p === null || p === void 0 ? void 0 : p.payload.refId) === refId) {
|
37
|
+
if (p === null || p === void 0 ? void 0 : p.payload[data.id]) {
|
38
|
+
setCellSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : p.payload[data.id]));
|
39
|
+
}
|
37
40
|
}
|
38
41
|
|
39
42
|
break;
|
@@ -81,7 +84,8 @@ export function withFieldCellWrapper(WrappedComponent) {
|
|
81
84
|
payload: {
|
82
85
|
dragItem: item.dragItem,
|
83
86
|
dropId: data.id,
|
84
|
-
position: position
|
87
|
+
position: position,
|
88
|
+
refId: refId
|
85
89
|
}
|
86
90
|
});
|
87
91
|
},
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*
|
2
2
|
* @Author: wangxian
|
3
3
|
* @Date: 2023-02-06 11:35:45
|
4
|
-
* @LastEditTime: 2023-02-
|
4
|
+
* @LastEditTime: 2023-02-16 14:54:43
|
5
5
|
*/
|
6
6
|
import React from 'react';
|
7
7
|
import Input from './Cell/Input';
|
@@ -11,11 +11,17 @@ import Number from './Cell/Number';
|
|
11
11
|
import Switch from './Cell/Switch';
|
12
12
|
import Select from './Cell/Select';
|
13
13
|
import MutiSelect from './Cell/MutiSelect';
|
14
|
+
import Color from './Cell/Color';
|
15
|
+
import Checkbox from './Cell/Checkbox';
|
16
|
+
import Radio from './Cell/Radio';
|
17
|
+
import Password from './Cell/Password';
|
18
|
+
import Upload from './Cell/Upload';
|
14
19
|
import Obj from './Cell/Obj';
|
15
20
|
import List from './Cell/List';
|
16
21
|
|
17
22
|
var RenderField = function RenderField(props) {
|
18
23
|
var data = props.data,
|
24
|
+
refId = props.refId,
|
19
25
|
_props$isShowAction = props.isShowAction,
|
20
26
|
isShowAction = _props$isShowAction === void 0 ? false : _props$isShowAction;
|
21
27
|
var FieldContent = React.useMemo(function () {
|
@@ -25,6 +31,7 @@ var RenderField = function RenderField(props) {
|
|
25
31
|
var Comm = DataCellMap[data.type];
|
26
32
|
return /*#__PURE__*/React.createElement(Comm, {
|
27
33
|
data: data,
|
34
|
+
refId: refId,
|
28
35
|
isShowAction: isShowAction
|
29
36
|
});
|
30
37
|
}
|
@@ -43,6 +50,11 @@ var DataCellMap = {
|
|
43
50
|
switch: Switch,
|
44
51
|
select: Select,
|
45
52
|
mutiSelect: MutiSelect,
|
53
|
+
color: Color,
|
54
|
+
checkbox: Checkbox,
|
55
|
+
radio: Radio,
|
56
|
+
password: Password,
|
57
|
+
upload: Upload,
|
46
58
|
obj: Obj,
|
47
59
|
list: List
|
48
60
|
};
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
import { FG } from '../../../../../comps/FormGenerator/index.d';
|
2
3
|
import './index.less';
|
3
4
|
interface ICanvasCoreProps {
|
@@ -12,5 +13,5 @@ interface ICanvasCoreProps {
|
|
12
13
|
*/
|
13
14
|
onChange?: (nodes: FG.Node[]) => void;
|
14
15
|
}
|
15
|
-
declare const
|
16
|
-
export default
|
16
|
+
declare const _default: React.MemoExoticComponent<(props: ICanvasCoreProps) => JSX.Element>;
|
17
|
+
export default _default;
|
@@ -45,9 +45,6 @@ var CanvasCore = function CanvasCore(props) {
|
|
45
45
|
allSetting = _React$useState8[0],
|
46
46
|
setAllSetting = _React$useState8[1];
|
47
47
|
|
48
|
-
React.useEffect(function () {
|
49
|
-
onChange && onChange(list);
|
50
|
-
}, [list]);
|
51
48
|
var addNewNode = React.useCallback(function (_node, dropId, position) {
|
52
49
|
var _newNode;
|
53
50
|
|
@@ -86,27 +83,38 @@ var CanvasCore = function CanvasCore(props) {
|
|
86
83
|
}
|
87
84
|
|
88
85
|
if ((_newNode = newNode) === null || _newNode === void 0 ? void 0 : _newNode.id) {
|
89
|
-
setCurNodeId(newNode.id);
|
90
86
|
fGCtx.fgStream && fGCtx.fgStream.next({
|
91
87
|
type: streamEventType.onNodeSelect,
|
92
|
-
payload:
|
88
|
+
payload: {
|
89
|
+
node: newNode,
|
90
|
+
refId: refId
|
91
|
+
}
|
93
92
|
});
|
94
93
|
}
|
95
94
|
|
96
95
|
setList(_toConsumableArray(_list));
|
97
96
|
listRef.current = _list;
|
97
|
+
onChange && onChange(_list);
|
98
98
|
}, []);
|
99
99
|
var processFgStreamData = React.useCallback(function (p) {
|
100
|
-
var _p$payload, _p$payload3;
|
100
|
+
var _p$payload, _p$payload$node, _p$payload2, _p$payload3;
|
101
101
|
|
102
102
|
switch (p === null || p === void 0 ? void 0 : p.type) {
|
103
|
+
case streamEventType.onNodeSelect:
|
104
|
+
setCurNodeId(p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : (_p$payload$node = _p$payload.node) === null || _p$payload$node === void 0 ? void 0 : _p$payload$node.id);
|
105
|
+
break;
|
106
|
+
|
103
107
|
case streamEventType.onClearCanvas:
|
104
108
|
setList([]);
|
105
109
|
listRef.current = [];
|
110
|
+
onChange && onChange([]);
|
106
111
|
break;
|
107
112
|
|
108
113
|
case streamEventType.onDropOver:
|
109
|
-
|
114
|
+
if (refId === ((_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.refId)) {
|
115
|
+
addNewNode(p.payload.dragItem, p.payload.dropId, p.payload.position);
|
116
|
+
}
|
117
|
+
|
110
118
|
break;
|
111
119
|
|
112
120
|
case streamEventType.onNodeCopy:
|
@@ -119,7 +127,8 @@ var CanvasCore = function CanvasCore(props) {
|
|
119
127
|
return it.id !== p.payload.id;
|
120
128
|
});
|
121
129
|
setList(_toConsumableArray(_list));
|
122
|
-
listRef.current = _list;
|
130
|
+
listRef.current = _list;
|
131
|
+
onChange && onChange(_list); // 默认焦点放在第一个
|
123
132
|
|
124
133
|
if (_list.length > 0) {
|
125
134
|
onSelect(_list[0]);
|
@@ -132,13 +141,24 @@ var CanvasCore = function CanvasCore(props) {
|
|
132
141
|
break;
|
133
142
|
|
134
143
|
case streamEventType.onSettingValueChange:
|
135
|
-
if (p === null || p === void 0 ? void 0 : (_p$
|
136
|
-
var _p$
|
144
|
+
if (p === null || p === void 0 ? void 0 : (_p$payload3 = p.payload) === null || _p$payload3 === void 0 ? void 0 : _p$payload3.formSetting) {
|
145
|
+
var _p$payload4;
|
137
146
|
|
138
|
-
setFormSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$
|
147
|
+
setFormSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload4 = p.payload) === null || _p$payload4 === void 0 ? void 0 : _p$payload4.formSetting));
|
148
|
+
}
|
149
|
+
|
150
|
+
if ((p === null || p === void 0 ? void 0 : p.payload.refId) === refId) {
|
151
|
+
if (refId) {
|
152
|
+
var _p$payload5;
|
153
|
+
|
154
|
+
setAllSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload5 = p.payload) === null || _p$payload5 === void 0 ? void 0 : _p$payload5.allSetting[refId]));
|
155
|
+
} else {
|
156
|
+
var _p$payload6;
|
157
|
+
|
158
|
+
setAllSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload6 = p.payload) === null || _p$payload6 === void 0 ? void 0 : _p$payload6.allSetting));
|
159
|
+
}
|
139
160
|
}
|
140
161
|
|
141
|
-
setAllSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload3 = p.payload) === null || _p$payload3 === void 0 ? void 0 : _p$payload3.allSetting));
|
142
162
|
break;
|
143
163
|
}
|
144
164
|
}, []);
|
@@ -182,10 +202,12 @@ var CanvasCore = function CanvasCore(props) {
|
|
182
202
|
dropRef = _useDrop2[1];
|
183
203
|
|
184
204
|
var onSelect = function onSelect(it) {
|
185
|
-
setCurNodeId(it.id);
|
186
205
|
fGCtx.fgStream && fGCtx.fgStream.next({
|
187
206
|
type: streamEventType.onNodeSelect,
|
188
|
-
payload:
|
207
|
+
payload: {
|
208
|
+
node: it,
|
209
|
+
refId: refId
|
210
|
+
}
|
189
211
|
});
|
190
212
|
};
|
191
213
|
|
@@ -238,10 +260,12 @@ var CanvasCore = function CanvasCore(props) {
|
|
238
260
|
}, /*#__PURE__*/React.createElement("div", {
|
239
261
|
key: it.id,
|
240
262
|
className: "drag-item ".concat(curNodeId === it.id ? 'drag-item-selected' : ''),
|
241
|
-
onClick: function onClick() {
|
263
|
+
onClick: function onClick(e) {
|
264
|
+
e.stopPropagation();
|
242
265
|
onSelect(it);
|
243
266
|
}
|
244
267
|
}, /*#__PURE__*/React.createElement(RenderField, {
|
268
|
+
refId: refId,
|
245
269
|
data: it,
|
246
270
|
isShowAction: curNodeId === it.id
|
247
271
|
})));
|
@@ -256,4 +280,4 @@ var CanvasCore = function CanvasCore(props) {
|
|
256
280
|
}, "\u62D6\u62FD\u5DE6\u4FA7\u680F\u7684\u7EC4\u4EF6\u8FDB\u884C\u6DFB\u52A0")))));
|
257
281
|
};
|
258
282
|
|
259
|
-
export default CanvasCore;
|
283
|
+
export default /*#__PURE__*/React.memo(CanvasCore);
|
@@ -3,12 +3,13 @@ import _message from "antd/es/message";
|
|
3
3
|
import "antd/es/button/style";
|
4
4
|
import _Button from "antd/es/button";
|
5
5
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
6
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
6
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
7
8
|
import React from 'react';
|
8
9
|
import copy from 'copy-to-clipboard';
|
9
10
|
import { FGCtx } from '../../Provider';
|
10
11
|
import { streamEventType } from '../../settings';
|
11
|
-
import { transFG2Schema } from '../../transformer';
|
12
|
+
import { transFG2Schema, transSchema2FG } from '../../transformer';
|
12
13
|
import CanvasCore from './core';
|
13
14
|
import MetadataForm from '../../../../comps/MetadataForm';
|
14
15
|
import useObservable from '../../../../framework/rxjs-hooks/useObservable';
|
@@ -16,6 +17,7 @@ import useObservable from '../../../../framework/rxjs-hooks/useObservable';
|
|
16
17
|
var Canvas = function Canvas() {
|
17
18
|
var nodesRef = React.useRef([]);
|
18
19
|
var settingRef = React.useRef({});
|
20
|
+
var typesRef = React.useRef({});
|
19
21
|
|
20
22
|
var _React$useState = React.useState([]),
|
21
23
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
@@ -30,6 +32,13 @@ var Canvas = function Canvas() {
|
|
30
32
|
settingRef.current = p.payload.allSetting;
|
31
33
|
}
|
32
34
|
|
35
|
+
break;
|
36
|
+
|
37
|
+
case streamEventType.onTypesChange:
|
38
|
+
if (p === null || p === void 0 ? void 0 : p.payload) {
|
39
|
+
typesRef.current = _objectSpread(_objectSpread({}, typesRef.current), p === null || p === void 0 ? void 0 : p.payload);
|
40
|
+
}
|
41
|
+
|
33
42
|
break;
|
34
43
|
}
|
35
44
|
}, []);
|
@@ -45,14 +54,67 @@ var Canvas = function Canvas() {
|
|
45
54
|
|
46
55
|
var onPreview = function onPreview() {
|
47
56
|
if (schema.length === 0) {
|
48
|
-
var _schema = transFG2Schema(nodesRef.current, settingRef.current);
|
57
|
+
var _schema = transFG2Schema(nodesRef.current, settingRef.current, typesRef.current);
|
49
58
|
|
50
|
-
setSchema(_toConsumableArray(_schema));
|
59
|
+
setSchema(_toConsumableArray(_schema || []));
|
51
60
|
} else {
|
52
61
|
setSchema([]);
|
53
62
|
}
|
54
63
|
};
|
55
64
|
|
65
|
+
var onImport = function onImport() {
|
66
|
+
var _schema = [{
|
67
|
+
id: 'FormGenerator',
|
68
|
+
type: 'object',
|
69
|
+
properties: [{
|
70
|
+
id: 'obj-e5f4',
|
71
|
+
type: 'ref',
|
72
|
+
fields: [{
|
73
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
74
|
+
type: 'ref',
|
75
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
76
|
+
value: {
|
77
|
+
label: '对象',
|
78
|
+
ref: {}
|
79
|
+
}
|
80
|
+
}],
|
81
|
+
refId: 'obj-e5f4_ref'
|
82
|
+
}, {
|
83
|
+
id: 'input-d4d3',
|
84
|
+
type: 'text',
|
85
|
+
fields: [{
|
86
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
87
|
+
type: 'ref',
|
88
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
89
|
+
value: {
|
90
|
+
label: '输入框',
|
91
|
+
text: {}
|
92
|
+
}
|
93
|
+
}]
|
94
|
+
}],
|
95
|
+
types: [{
|
96
|
+
id: 'obj-e5f4_ref',
|
97
|
+
type: 'object',
|
98
|
+
properties: [{
|
99
|
+
id: 'textarea-eb7d',
|
100
|
+
type: 'text',
|
101
|
+
fields: [{
|
102
|
+
id: 'com.ronds.schema.default.Rule.Form',
|
103
|
+
type: 'ref',
|
104
|
+
refId: 'com.ronds.schema.default.Rule.Form',
|
105
|
+
value: {
|
106
|
+
label: '文本框',
|
107
|
+
text: {
|
108
|
+
type: 'textarea'
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}]
|
112
|
+
}]
|
113
|
+
}]
|
114
|
+
}];
|
115
|
+
var a = transSchema2FG(_schema);
|
116
|
+
};
|
117
|
+
|
56
118
|
return /*#__PURE__*/React.createElement("div", {
|
57
119
|
style: {
|
58
120
|
height: '100%',
|
@@ -74,9 +136,14 @@ var Canvas = function Canvas() {
|
|
74
136
|
},
|
75
137
|
onClick: onClearCanvas
|
76
138
|
}, "\u6E05\u7A7A"), /*#__PURE__*/React.createElement(_Button, {
|
139
|
+
style: {
|
140
|
+
marginRight: '8px'
|
141
|
+
},
|
142
|
+
onClick: onImport
|
143
|
+
}, "\u5BFC\u5165"), /*#__PURE__*/React.createElement(_Button, {
|
77
144
|
type: "primary",
|
78
145
|
onClick: function onClick() {
|
79
|
-
var _schema = transFG2Schema(nodesRef.current, settingRef.current);
|
146
|
+
var _schema = transFG2Schema(nodesRef.current, settingRef.current, typesRef.current);
|
80
147
|
|
81
148
|
if (copy(JSON.stringify(_schema))) {
|
82
149
|
_message.success("\u5DF2\u590D\u5236\u5230\u526A\u5207\u677F");
|
@@ -26,23 +26,34 @@ var Settings = function Settings() {
|
|
26
26
|
curTab = _React$useState4[0],
|
27
27
|
setCurTab = _React$useState4[1];
|
28
28
|
|
29
|
+
var refIdRef = React.useRef();
|
29
30
|
var settingValueRef = React.useRef({
|
30
31
|
formSetting: formSetting.param.defaultValue
|
31
32
|
});
|
32
33
|
var processFgStreamData = React.useCallback(function (p) {
|
33
|
-
var _p$payload, _p$payload2;
|
34
|
-
|
35
34
|
switch (p === null || p === void 0 ? void 0 : p.type) {
|
36
35
|
case streamEventType.onNodeSelect:
|
37
|
-
|
38
|
-
|
36
|
+
refIdRef.current = p === null || p === void 0 ? void 0 : p.payload.refId;
|
37
|
+
|
38
|
+
var _node = p === null || p === void 0 ? void 0 : p.payload.node;
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
var _p$payload3;
|
40
|
+
setCurNode(_objectSpread({}, _node));
|
41
|
+
setCurTab(_node.id); // 赋值
|
43
42
|
|
44
|
-
|
45
|
-
|
43
|
+
if (refIdRef.current) {
|
44
|
+
var _key = "".concat(refIdRef.current, "_ref");
|
45
|
+
|
46
|
+
if (settingValueRef.current[_key] && settingValueRef.current[_key][_node.id]) {
|
47
|
+
setTimeout(function () {
|
48
|
+
compFormRef.current && compFormRef.current.setFieldsValue(_objectSpread({}, settingValueRef.current[_key][_node.id]));
|
49
|
+
}, 100);
|
50
|
+
}
|
51
|
+
} else {
|
52
|
+
if (settingValueRef.current[_node.id]) {
|
53
|
+
setTimeout(function () {
|
54
|
+
compFormRef.current && compFormRef.current.setFieldsValue(_objectSpread({}, settingValueRef.current[_node.id]));
|
55
|
+
}, 100);
|
56
|
+
}
|
46
57
|
}
|
47
58
|
|
48
59
|
break;
|
@@ -65,11 +76,20 @@ var Settings = function Settings() {
|
|
65
76
|
var _payload;
|
66
77
|
|
67
78
|
var _settingValue = settingValueRef.current;
|
68
|
-
|
79
|
+
|
80
|
+
if (refIdRef.current) {
|
81
|
+
var _key = "".concat(refIdRef.current, "_ref");
|
82
|
+
|
83
|
+
_settingValue = settingValueRef.current[_key] ? settingValueRef.current : _objectSpread(_objectSpread({}, settingValueRef.current), {}, _defineProperty({}, _key, {}));
|
84
|
+
_settingValue[_key][id] = allVals;
|
85
|
+
} else {
|
86
|
+
_settingValue[id] = allVals;
|
87
|
+
}
|
88
|
+
|
69
89
|
settingValueRef.current = _settingValue;
|
70
90
|
fGCtx.fgStream && fGCtx.fgStream.next({
|
71
91
|
type: streamEventType.onSettingValueChange,
|
72
|
-
payload: (_payload = {}, _defineProperty(_payload, id, allVals), _defineProperty(_payload, "allSetting", settingValueRef.current), _payload)
|
92
|
+
payload: (_payload = {}, _defineProperty(_payload, id, allVals), _defineProperty(_payload, "allSetting", settingValueRef.current), _defineProperty(_payload, "refId", refIdRef.current), _payload)
|
73
93
|
});
|
74
94
|
};
|
75
95
|
|