ronds-metadata 1.2.9 → 1.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. package/es/comps/Editable/index.js +2 -1
  2. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +60 -8
  3. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +2 -2
  4. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +1 -1
  5. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +60 -8
  6. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.d.ts +2 -0
  7. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +50 -0
  8. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +16 -6
  9. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +17 -6
  10. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +4 -2
  11. package/es/comps/FormGenerator/comps/Canvas/core/index.js +27 -25
  12. package/es/comps/FormGenerator/comps/Canvas/core/index.less +23 -23
  13. package/es/comps/FormGenerator/comps/Canvas/index.js +4 -2
  14. package/es/comps/FormGenerator/comps/Settings/index.js +2 -2
  15. package/es/comps/FormGenerator/comps/Sidebar/Elements.js +1 -1
  16. package/es/comps/FormGenerator/index.js +3 -2
  17. package/es/comps/FormGenerator/settings/index.d.ts +652 -86
  18. package/es/comps/FormGenerator/settings/index.js +78 -18
  19. package/es/comps/FormGenerator/transformer.js +91 -14
  20. package/es/comps/MetadataForm/DataCell/Array.js +5 -4
  21. package/es/comps/MetadataForm/DataCell/Input.js +5 -6
  22. package/es/comps/MetadataForm/DataCell/Ref.js +3 -2
  23. package/es/comps/MetadataForm/DataCell/Select.js +43 -4
  24. package/es/comps/MetadataForm/DataCell/layout/TableArray.js +4 -4
  25. package/es/comps/MetadataForm/index.less +1 -1
  26. package/package.json +1 -1
@@ -336,7 +336,8 @@ var Editable = function Editable(props) {
336
336
  }
337
337
  }
338
338
  }, /*#__PURE__*/React.createElement(DndProvider, {
339
- backend: HTML5Backend
339
+ backend: HTML5Backend,
340
+ context: window
340
341
  }, /*#__PURE__*/React.createElement("div", {
341
342
  style: {
342
343
  height: "".concat((type === 'multiple' || type === 'freedom') && !readonly && isAddRow && defaultValue ? 'calc(100% - 40px)' : '100%')
@@ -1,17 +1,69 @@
1
- import "antd/es/input/style";
2
- import _Input from "antd/es/input";
3
- import React from "react";
1
+ import "antd/es/row/style";
2
+ import _Row from "antd/es/row";
3
+ import "antd/es/col/style";
4
+ import _Col from "antd/es/col";
5
+ import "antd/es/checkbox/style";
6
+ import _Checkbox from "antd/es/checkbox";
7
+ import React from 'react';
4
8
  import { withFieldCellWrapper } from '../HOC';
9
+ import { deepClone } from '../../../../../../../utils';
5
10
 
6
11
  var Index = function Index(props) {
7
12
  var data = props.data,
8
13
  fgStream = props.fgStream,
9
14
  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
+ var processNormalOptions = React.useCallback(function (opt) {
16
+ var _options = [];
17
+
18
+ var _enum = deepClone(opt);
19
+
20
+ _enum.forEach(function (it) {
21
+ var _it$key;
22
+
23
+ var obj = {
24
+ label: it.value,
25
+ value: (_it$key = it === null || it === void 0 ? void 0 : it.key) !== null && _it$key !== void 0 ? _it$key : it === null || it === void 0 ? void 0 : it.value
26
+ };
27
+
28
+ _options.push(obj);
29
+ });
30
+
31
+ return _options;
32
+ }, []);
33
+ var options = React.useMemo(function () {
34
+ var _setting$enum;
35
+
36
+ if (setting === null || setting === void 0 ? void 0 : (_setting$enum = setting.enum) === null || _setting$enum === void 0 ? void 0 : _setting$enum.value) {
37
+ var _setting$enum2;
38
+
39
+ return processNormalOptions(setting === null || setting === void 0 ? void 0 : (_setting$enum2 = setting.enum) === null || _setting$enum2 === void 0 ? void 0 : _setting$enum2.value);
40
+ }
41
+
42
+ return [{
43
+ label: 'uloveits1',
44
+ value: '1'
45
+ }, {
46
+ label: 'uloveits2',
47
+ value: '2'
48
+ }, {
49
+ label: 'uloveits3',
50
+ value: '3'
51
+ }];
52
+ }, [setting === null || setting === void 0 ? void 0 : setting.enum]);
53
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Checkbox.Group, {
54
+ style: {
55
+ width: '100%'
56
+ }
57
+ }, /*#__PURE__*/React.createElement(_Row, null, options.map(function (it) {
58
+ var _setting$checkbox;
59
+
60
+ return /*#__PURE__*/React.createElement(_Col, {
61
+ key: it.value,
62
+ span: setting === null || setting === void 0 ? void 0 : (_setting$checkbox = setting.checkbox) === null || _setting$checkbox === void 0 ? void 0 : _setting$checkbox.colSpan
63
+ }, /*#__PURE__*/React.createElement(_Checkbox, {
64
+ value: it.value
65
+ }, it.label));
66
+ }))));
15
67
  };
16
68
 
17
69
  export default withFieldCellWrapper(Index);
@@ -8,9 +8,9 @@ var Index = function Index(props) {
8
8
  fgStream = props.fgStream,
9
9
  setting = props.setting;
10
10
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Input, {
11
+ type: "color",
11
12
  disabled: setting === null || setting === void 0 ? void 0 : setting.disabled,
12
- placeholder: setting === null || setting === void 0 ? void 0 : setting.placeholder,
13
- allowClear: true
13
+ placeholder: setting === null || setting === void 0 ? void 0 : setting.placeholder
14
14
  }));
15
15
  };
16
16
 
@@ -7,7 +7,7 @@ var Index = function Index(props) {
7
7
  var data = props.data,
8
8
  fgStream = props.fgStream,
9
9
  setting = props.setting;
10
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Input, {
10
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Input.Password, {
11
11
  disabled: setting === null || setting === void 0 ? void 0 : setting.disabled,
12
12
  placeholder: setting === null || setting === void 0 ? void 0 : setting.placeholder,
13
13
  allowClear: true
@@ -1,17 +1,69 @@
1
- import "antd/es/input/style";
2
- import _Input from "antd/es/input";
3
- import React from "react";
1
+ import "antd/es/row/style";
2
+ import _Row from "antd/es/row";
3
+ import "antd/es/col/style";
4
+ import _Col from "antd/es/col";
5
+ import "antd/es/radio/style";
6
+ import _Radio from "antd/es/radio";
7
+ import React from 'react';
4
8
  import { withFieldCellWrapper } from '../HOC';
9
+ import { deepClone } from '../../../../../../../utils';
5
10
 
6
11
  var Index = function Index(props) {
7
12
  var data = props.data,
8
13
  fgStream = props.fgStream,
9
14
  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
+ var processNormalOptions = React.useCallback(function (opt) {
16
+ var _options = [];
17
+
18
+ var _enum = deepClone(opt);
19
+
20
+ _enum.forEach(function (it) {
21
+ var _it$key;
22
+
23
+ var obj = {
24
+ label: it.value,
25
+ value: (_it$key = it === null || it === void 0 ? void 0 : it.key) !== null && _it$key !== void 0 ? _it$key : it === null || it === void 0 ? void 0 : it.value
26
+ };
27
+
28
+ _options.push(obj);
29
+ });
30
+
31
+ return _options;
32
+ }, []);
33
+ var options = React.useMemo(function () {
34
+ var _setting$enum;
35
+
36
+ if (setting === null || setting === void 0 ? void 0 : (_setting$enum = setting.enum) === null || _setting$enum === void 0 ? void 0 : _setting$enum.value) {
37
+ var _setting$enum2;
38
+
39
+ return processNormalOptions(setting === null || setting === void 0 ? void 0 : (_setting$enum2 = setting.enum) === null || _setting$enum2 === void 0 ? void 0 : _setting$enum2.value);
40
+ }
41
+
42
+ return [{
43
+ label: 'uloveits1',
44
+ value: '1'
45
+ }, {
46
+ label: 'uloveits2',
47
+ value: '2'
48
+ }, {
49
+ label: 'uloveits3',
50
+ value: '3'
51
+ }];
52
+ }, [setting === null || setting === void 0 ? void 0 : setting.enum]);
53
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Radio.Group, {
54
+ style: {
55
+ width: '100%'
56
+ }
57
+ }, /*#__PURE__*/React.createElement(_Row, null, options.map(function (it) {
58
+ var _setting$checkbox;
59
+
60
+ return /*#__PURE__*/React.createElement(_Col, {
61
+ key: it.value,
62
+ span: setting === null || setting === void 0 ? void 0 : (_setting$checkbox = setting.checkbox) === null || _setting$checkbox === void 0 ? void 0 : _setting$checkbox.colSpan
63
+ }, /*#__PURE__*/React.createElement(_Radio, {
64
+ value: it.value
65
+ }, it.label));
66
+ }))));
15
67
  };
16
68
 
17
69
  export default withFieldCellWrapper(Index);
@@ -0,0 +1,2 @@
1
+ declare const _default: (props: any) => JSX.Element;
2
+ export default _default;
@@ -0,0 +1,50 @@
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
+
5
+ /*
6
+ * @Author: uloveits 719310130@qq.com
7
+ * @Date: 2023-02-06 15:05:42
8
+ * @LastEditors: uloveits 719310130@qq.com
9
+ * @LastEditTime: 2023-02-27 10:10:23
10
+ */
11
+ import React from 'react';
12
+ import CanvasCore from '../../index';
13
+ import { withFieldCellWrapper } from '../HOC';
14
+ import { streamEventType } from '../../../../../settings/index';
15
+
16
+ var Index = function Index(props) {
17
+ var data = props.data,
18
+ fgStream = props.fgStream,
19
+ setting = props.setting,
20
+ types = props.types;
21
+
22
+ var _React$useState = React.useState([]),
23
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24
+ nodes = _React$useState2[0],
25
+ setNodes = _React$useState2[1];
26
+
27
+ var nodesRef = React.useRef([]);
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]);
34
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CanvasCore, {
35
+ key: data.id,
36
+ refId: data.id,
37
+ nodes: nodes,
38
+ onChange: function onChange(nodes) {
39
+ fgStream && fgStream.next({
40
+ type: streamEventType.onTypesChange,
41
+ payload: _defineProperty({}, data.id, {
42
+ id: (setting === null || setting === void 0 ? void 0 : setting.id) || data.id,
43
+ nodes: nodes
44
+ })
45
+ });
46
+ }
47
+ }));
48
+ };
49
+
50
+ export default withFieldCellWrapper(Index);
@@ -1,17 +1,27 @@
1
- import "antd/es/input/style";
2
- import _Input from "antd/es/input";
1
+ import "antd/es/upload/style";
2
+ import _Upload from "antd/es/upload";
3
+ import "antd/es/button/style";
4
+ import _Button from "antd/es/button";
3
5
  import React from "react";
6
+
7
+ /*
8
+ * @Author: uloveits 719310130@qq.com
9
+ * @Date: 2023-02-06 15:05:42
10
+ * @LastEditors: Please set LastEditors
11
+ * @LastEditTime: 2023-02-25 11:34:21
12
+ */
13
+ import { UploadOutlined } from '@ant-design/icons';
4
14
  import { withFieldCellWrapper } from '../HOC';
15
+ import { tr } from '../../../../../../../framework/locale';
5
16
 
6
17
  var Index = function Index(props) {
7
18
  var data = props.data,
8
19
  fgStream = props.fgStream,
9
20
  setting = props.setting;
10
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Input, {
21
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Upload, null, /*#__PURE__*/React.createElement(_Button, {
11
22
  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
- }));
23
+ icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
24
+ }, tr('上传'))));
15
25
  };
16
26
 
17
27
  export default withFieldCellWrapper(Index);
@@ -14,6 +14,8 @@ import { dragItemType, streamEventType } from '../../../../../settings';
14
14
  import useObservable from '../../../../../../../framework/rxjs-hooks/useObservable';
15
15
  export function withFieldCellWrapper(WrappedComponent) {
16
16
  return function (props) {
17
+ var _cellSetting$depend, _cellSetting$depend2, _cellSetting$depend3, _cellSetting$depend4;
18
+
17
19
  var data = props.data,
18
20
  refId = props.refId,
19
21
  isShowAction = props.isShowAction;
@@ -154,7 +156,8 @@ export function withFieldCellWrapper(WrappedComponent) {
154
156
  fGCtx.fgStream && fGCtx.fgStream.next({
155
157
  type: streamEventType.onNodeDelete,
156
158
  payload: {
157
- id: data.id
159
+ id: data.id,
160
+ refId: refId
158
161
  }
159
162
  });
160
163
  };
@@ -200,7 +203,15 @@ export function withFieldCellWrapper(WrappedComponent) {
200
203
  style: {
201
204
  color: 'var(--ronds-metadata-color-text-2)'
202
205
  }
203
- }, " [ hidden ] ")), /*#__PURE__*/React.createElement(_Form.Item, {
206
+ }, " [ hidden ] "), (cellSetting === null || cellSetting === void 0 ? void 0 : (_cellSetting$depend = cellSetting.depend) === null || _cellSetting$depend === void 0 ? void 0 : _cellSetting$depend.hidden) && /*#__PURE__*/React.createElement("span", {
207
+ style: {
208
+ color: 'var(--ronds-metadata-color-text-2)'
209
+ }
210
+ }, " [ hidden:", cellSetting === null || cellSetting === void 0 ? void 0 : (_cellSetting$depend2 = cellSetting.depend) === null || _cellSetting$depend2 === void 0 ? void 0 : _cellSetting$depend2.hidden, " ] "), (cellSetting === null || cellSetting === void 0 ? void 0 : (_cellSetting$depend3 = cellSetting.depend) === null || _cellSetting$depend3 === void 0 ? void 0 : _cellSetting$depend3.show) && /*#__PURE__*/React.createElement("span", {
211
+ style: {
212
+ color: 'var(--ronds-metadata-color-text-2)'
213
+ }
214
+ }, " [ show:", cellSetting === null || cellSetting === void 0 ? void 0 : (_cellSetting$depend4 = cellSetting.depend) === null || _cellSetting$depend4 === void 0 ? void 0 : _cellSetting$depend4.show, " ] ")), /*#__PURE__*/React.createElement(_Form.Item, {
204
215
  key: "".concat(cellSetting === null || cellSetting === void 0 ? void 0 : cellSetting.defaultValue),
205
216
  name: (cellSetting === null || cellSetting === void 0 ? void 0 : cellSetting.id) || data.id,
206
217
  label: /*#__PURE__*/React.createElement("span", {
@@ -222,8 +233,8 @@ export function withFieldCellWrapper(WrappedComponent) {
222
233
  ref: drag,
223
234
  style: {
224
235
  position: 'absolute',
225
- top: '-3px',
226
- left: '-3px'
236
+ top: '-1px',
237
+ left: '-1px'
227
238
  }
228
239
  }, /*#__PURE__*/React.createElement(_Button, {
229
240
  size: "small",
@@ -232,8 +243,8 @@ export function withFieldCellWrapper(WrappedComponent) {
232
243
  })), /*#__PURE__*/React.createElement("div", {
233
244
  style: {
234
245
  position: 'absolute',
235
- bottom: '-3px',
236
- right: '-2px'
246
+ bottom: '-1px',
247
+ right: '0px'
237
248
  }
238
249
  }, /*#__PURE__*/React.createElement(_Button, {
239
250
  size: "small",
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author: wangxian
3
3
  * @Date: 2023-02-06 11:35:45
4
- * @LastEditTime: 2023-02-16 14:54:43
4
+ * @LastEditTime: 2023-02-27 10:13:49
5
5
  */
6
6
  import React from 'react';
7
7
  import Input from './Cell/Input';
@@ -18,6 +18,7 @@ import Password from './Cell/Password';
18
18
  import Upload from './Cell/Upload';
19
19
  import Obj from './Cell/Obj';
20
20
  import List from './Cell/List';
21
+ import Table from './Cell/Table';
21
22
 
22
23
  var RenderField = function RenderField(props) {
23
24
  var data = props.data,
@@ -56,5 +57,6 @@ var DataCellMap = {
56
57
  password: Password,
57
58
  upload: Upload,
58
59
  obj: Obj,
59
- list: List
60
+ list: List,
61
+ table: Table
60
62
  };
@@ -10,7 +10,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
10
10
  import React from 'react';
11
11
  import { useDrop } from 'react-dnd';
12
12
  import { FGCtx } from '../../../../../comps/FormGenerator/Provider';
13
- import { dragItemType, streamEventType } from '../../../settings';
13
+ import { dragItemType, formSetting as _formSetting, streamEventType } from '../../../settings';
14
14
  import useObservable from '../../../../../framework/rxjs-hooks/useObservable';
15
15
  import { arrayInsert, arrayMoveImmutable, guid } from '../../../../../utils';
16
16
  import RenderField from './RenderField';
@@ -36,7 +36,7 @@ var CanvasCore = function CanvasCore(props) {
36
36
  curNodeId = _React$useState4[0],
37
37
  setCurNodeId = _React$useState4[1];
38
38
 
39
- var _React$useState5 = React.useState(),
39
+ var _React$useState5 = React.useState(_formSetting.param.defaultValue),
40
40
  _React$useState6 = _slicedToArray(_React$useState5, 2),
41
41
  formSetting = _React$useState6[0],
42
42
  setFormSetting = _React$useState6[1];
@@ -121,7 +121,7 @@ var CanvasCore = function CanvasCore(props) {
121
121
  onChange && onChange(_list);
122
122
  }, []);
123
123
  var processFgStreamData = React.useCallback(function (p) {
124
- var _p$payload, _p$payload$node, _p$payload2, _p$payload3;
124
+ var _p$payload, _p$payload$node, _p$payload2, _p$payload3, _p$payload4;
125
125
 
126
126
  switch (p === null || p === void 0 ? void 0 : p.type) {
127
127
  case streamEventType.onNodeSelect:
@@ -146,42 +146,44 @@ var CanvasCore = function CanvasCore(props) {
146
146
  break;
147
147
 
148
148
  case streamEventType.onNodeDelete:
149
- var _list = listRef.current;
150
- _list = _list.filter(function (it) {
151
- return it.id !== p.payload.id;
152
- });
153
- setList(_toConsumableArray(_list));
154
- listRef.current = _list;
155
- onChange && onChange(_list); // 默认焦点放在第一个
156
-
157
- if (_list.length > 0) {
158
- onSelect(_list[0]);
159
- } else {
160
- fGCtx.fgStream && fGCtx.fgStream.next({
161
- type: streamEventType.onClearCanvas
149
+ if (refId === ((_p$payload3 = p.payload) === null || _p$payload3 === void 0 ? void 0 : _p$payload3.refId)) {
150
+ var _list = listRef.current;
151
+ _list = _list.filter(function (it) {
152
+ return it.id !== p.payload.id;
162
153
  });
154
+ setList(_toConsumableArray(_list));
155
+ listRef.current = _list;
156
+ onChange && onChange(_list); // 默认焦点放在第一个
157
+
158
+ if (_list.length > 0) {
159
+ onSelect(_list[0]);
160
+ } else {
161
+ fGCtx.fgStream && fGCtx.fgStream.next({
162
+ type: streamEventType.onClearCanvas
163
+ });
164
+ }
163
165
  }
164
166
 
165
167
  break;
166
168
 
167
169
  case streamEventType.onSettingValueChange:
168
- if (p === null || p === void 0 ? void 0 : (_p$payload3 = p.payload) === null || _p$payload3 === void 0 ? void 0 : _p$payload3.formSetting) {
169
- var _p$payload4;
170
+ if (p === null || p === void 0 ? void 0 : (_p$payload4 = p.payload) === null || _p$payload4 === void 0 ? void 0 : _p$payload4.formSetting) {
171
+ var _p$payload5;
170
172
 
171
- setFormSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload4 = p.payload) === null || _p$payload4 === void 0 ? void 0 : _p$payload4.formSetting));
173
+ setFormSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload5 = p.payload) === null || _p$payload5 === void 0 ? void 0 : _p$payload5.formSetting));
172
174
  }
173
175
 
174
176
  if ((p === null || p === void 0 ? void 0 : p.payload.refId) === refId) {
175
177
  if (refId) {
176
- var _p$payload5, _p$payload6;
178
+ var _p$payload6, _p$payload7;
177
179
 
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]);
180
+ setAllSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload6 = p.payload) === null || _p$payload6 === void 0 ? void 0 : _p$payload6.allSetting[refId]));
181
+ allSettingRef.current = _objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload7 = p.payload) === null || _p$payload7 === void 0 ? void 0 : _p$payload7.allSetting[refId]);
180
182
  } else {
181
- var _p$payload7, _p$payload8;
183
+ var _p$payload8, _p$payload9;
182
184
 
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);
185
+ setAllSetting(_objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload8 = p.payload) === null || _p$payload8 === void 0 ? void 0 : _p$payload8.allSetting));
186
+ allSettingRef.current = _objectSpread({}, p === null || p === void 0 ? void 0 : (_p$payload9 = p.payload) === null || _p$payload9 === void 0 ? void 0 : _p$payload9.allSetting);
185
187
  }
186
188
  }
187
189
 
@@ -1,23 +1,23 @@
1
- .canvas-wrapper {
2
- .drag-item {
3
- position: relative;
4
- border: 1px dashed var(--ronds-metadata-color-border-1);
5
- background: var(--ronds-metadata-color-bg-4);
6
- margin-bottom: 8px;
7
- }
8
-
9
- .drag-item-selected {
10
- border: 3px dashed var(--ronds-metadata-color-border-2);
11
- }
12
-
13
- .ant-form-item {
14
- margin-bottom: '4px' !important;
15
- }
16
- .ant-form-item-label {
17
- padding: 0%;
18
- }
19
- .ant-input-number,
20
- .ant-picker {
21
- width: 100%;
22
- }
23
- }
1
+ .canvas-wrapper {
2
+ .drag-item {
3
+ position: relative;
4
+ border: 1px dashed var(--ronds-metadata-color-border-1);
5
+ background: var(--ronds-metadata-color-bg-4);
6
+ margin-bottom: 8px;
7
+ }
8
+
9
+ .drag-item-selected {
10
+ border: 1px solid var(--ronds-metadata-color-border-2);
11
+ }
12
+
13
+ .ant-form-item {
14
+ margin-bottom: '4px' !important;
15
+ }
16
+ .ant-form-item-label {
17
+ padding: 0 0 2px !important;
18
+ }
19
+ .ant-input-number,
20
+ .ant-picker {
21
+ width: 100%;
22
+ }
23
+ }
@@ -8,7 +8,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
8
8
  import React from 'react';
9
9
  import copy from 'copy-to-clipboard';
10
10
  import { FGCtx } from '../../Provider';
11
- import { streamEventType } from '../../settings';
11
+ import { formSetting, streamEventType } from '../../settings';
12
12
  import { transFG2Schema } from '../../transformer';
13
13
  import CanvasCore from './core';
14
14
  import MetadataForm from '../../../../comps/MetadataForm';
@@ -16,7 +16,9 @@ import useObservable from '../../../../framework/rxjs-hooks/useObservable';
16
16
 
17
17
  var Canvas = function Canvas() {
18
18
  var nodesRef = React.useRef([]);
19
- var settingRef = React.useRef({});
19
+ var settingRef = React.useRef({
20
+ formSetting: formSetting.param.defaultValue
21
+ });
20
22
  var typesRef = React.useRef({});
21
23
 
22
24
  var _React$useState = React.useState([]),
@@ -92,7 +92,7 @@ var Settings = function Settings() {
92
92
 
93
93
  var _settingValue = settingValueRef.current;
94
94
 
95
- if (refIdRef.current) {
95
+ if (refIdRef.current && id !== formSetting.id) {
96
96
  var _key = "".concat(refIdRef.current, "_ref");
97
97
 
98
98
  _settingValue = settingValueRef.current[_key] ? settingValueRef.current : _objectSpread(_objectSpread({}, settingValueRef.current), {}, _defineProperty({}, _key, {}));
@@ -140,7 +140,7 @@ var Settings = function Settings() {
140
140
  formRef.current = form;
141
141
  },
142
142
  colSpan: 24,
143
- labelSpan: 6,
143
+ layout: "vertical",
144
144
  onValuesChange: function onValuesChange(val, allVals) {
145
145
  _onValuesChange(formSetting.id, val, allVals);
146
146
  }
@@ -38,7 +38,7 @@ var Elements = function Elements(props) {
38
38
  padding: '4px',
39
39
  textAlign: 'center',
40
40
  border: '1px solid var(--ronds-metadata-color-border-1)',
41
- borderRadius: '4px',
41
+ borderRadius: '3px',
42
42
  cursor: 'pointer',
43
43
  opacity: opacity
44
44
  }
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
4
  /*
5
5
  * @Author: wangxian
6
6
  * @Date: 2023-02-04 13:45:31
7
- * @LastEditTime: 2023-02-24 16:33:24
7
+ * @LastEditTime: 2023-02-25 10:53:17
8
8
  */
9
9
  import React from 'react';
10
10
  import { DndProvider } from 'react-dnd';
@@ -58,7 +58,8 @@ var FormGenerator = function FormGenerator(props) {
58
58
  types: types
59
59
  }
60
60
  }, /*#__PURE__*/React.createElement(DndProvider, {
61
- backend: HTML5Backend
61
+ backend: HTML5Backend,
62
+ context: window
62
63
  }, /*#__PURE__*/React.createElement("div", {
63
64
  className: "form-generator-container"
64
65
  }, /*#__PURE__*/React.createElement(Sidebar, null), /*#__PURE__*/React.createElement(Canvas, null), /*#__PURE__*/React.createElement(Settings, null)))));