ronds-metadata 1.2.38 → 1.2.39

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.
Files changed (134) hide show
  1. package/es/api/index.js +83 -131
  2. package/es/comps/DynamicPorts/comps/ContextMenu.js +3 -11
  3. package/es/comps/DynamicPorts/comps/DragNode.js +2 -7
  4. package/es/comps/DynamicPorts/comps/GraphHandler/index.js +4 -5
  5. package/es/comps/DynamicPorts/comps/NodeElement.js +1 -4
  6. package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +3 -6
  7. package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +3 -7
  8. package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +18 -21
  9. package/es/comps/DynamicPorts/comps/shape/edge.js +5 -18
  10. package/es/comps/DynamicPorts/comps/shape/node.js +4 -17
  11. package/es/comps/DynamicPorts/constant/index.js +2 -5
  12. package/es/comps/DynamicPorts/graph.d.ts +2 -2
  13. package/es/comps/DynamicPorts/graph.js +228 -312
  14. package/es/comps/DynamicPorts/index.js +39 -58
  15. package/es/comps/DynamicPorts/utils.js +21 -25
  16. package/es/comps/Editable/DataCell/ButtonCell.js +4 -10
  17. package/es/comps/Editable/DataCell/ColorPicker.js +2 -7
  18. package/es/comps/Editable/DataCell/Input.js +5 -14
  19. package/es/comps/Editable/DataCell/Number.js +3 -10
  20. package/es/comps/Editable/DataCell/Select.js +7 -14
  21. package/es/comps/Editable/DataCell/Switch.js +2 -7
  22. package/es/comps/Editable/comps/EditableAction.js +8 -12
  23. package/es/comps/Editable/comps/EditableCell.js +16 -26
  24. package/es/comps/Editable/comps/EditableHeardCell.js +21 -34
  25. package/es/comps/Editable/comps/EditableRow.js +49 -59
  26. package/es/comps/Editable/comps/Texty.js +36 -72
  27. package/es/comps/Editable/index.js +67 -112
  28. package/es/comps/Editable/interface.d.ts +1 -1
  29. package/es/comps/Editable/utils.js +0 -1
  30. package/es/comps/FileView/index.js +65 -101
  31. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +8 -13
  32. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +8 -4
  33. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +6 -2
  34. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +8 -4
  35. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +6 -11
  36. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +6 -10
  37. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +6 -2
  38. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +6 -11
  39. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +8 -4
  40. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +8 -13
  41. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +6 -10
  42. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +6 -2
  43. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.js +6 -11
  44. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +6 -3
  45. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +2 -5
  46. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +86 -109
  47. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +3 -7
  48. package/es/comps/FormGenerator/comps/Canvas/core/index.js +54 -91
  49. package/es/comps/FormGenerator/comps/Canvas/core/index.less +23 -23
  50. package/es/comps/FormGenerator/comps/Canvas/index.js +8 -15
  51. package/es/comps/FormGenerator/comps/Settings/index.js +16 -30
  52. package/es/comps/FormGenerator/comps/Sidebar/Elements.js +23 -22
  53. package/es/comps/FormGenerator/comps/Sidebar/index.js +6 -2
  54. package/es/comps/FormGenerator/index.js +3 -9
  55. package/es/comps/FormGenerator/interface.d.ts +1 -1
  56. package/es/comps/FormGenerator/settings/index.js +12 -11
  57. package/es/comps/FormGenerator/settings/ruleConfig.js +0 -1
  58. package/es/comps/FormGenerator/transformer.js +40 -105
  59. package/es/comps/Icons/index.js +4 -7
  60. package/es/comps/JsonEdit/index.js +25 -50
  61. package/es/comps/JsonView/index.js +7 -21
  62. package/es/comps/JsonView/index.less +41 -41
  63. package/es/comps/MdEdit/index.js +7 -10
  64. package/es/comps/MdEdit/index.less +6 -6
  65. package/es/comps/MdEditPro/index.d.ts +10 -0
  66. package/es/comps/MdEditPro/index.js +22 -0
  67. package/es/comps/MdEditPro/index.less +74 -0
  68. package/es/comps/MdNavbar/index.js +17 -40
  69. package/es/comps/MdNavbar/utils.js +0 -4
  70. package/es/comps/MdView/index.js +7 -11
  71. package/es/comps/MdView/index.less +353 -353
  72. package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +129 -183
  73. package/es/comps/MetadataEdit/components/MetaPropsEdit.js +11 -27
  74. package/es/comps/MetadataEdit/hooks/index.js +3 -11
  75. package/es/comps/MetadataEdit/index.js +25 -58
  76. package/es/comps/MetadataEdit/index.less +10 -10
  77. package/es/comps/MetadataEdit/type.d.ts +20 -20
  78. package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +17 -33
  79. package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +15 -29
  80. package/es/comps/MetadataEditV2/hooks/index.js +5 -12
  81. package/es/comps/MetadataEditV2/index.js +30 -65
  82. package/es/comps/MetadataForm/DataCell/Array.js +12 -23
  83. package/es/comps/MetadataForm/DataCell/Input.js +12 -32
  84. package/es/comps/MetadataForm/DataCell/Number.js +10 -21
  85. package/es/comps/MetadataForm/DataCell/Ref.js +87 -121
  86. package/es/comps/MetadataForm/DataCell/Select.js +127 -222
  87. package/es/comps/MetadataForm/DataCell/Switch.js +7 -14
  88. package/es/comps/MetadataForm/DataCell/layout/TableArray.js +93 -164
  89. package/es/comps/MetadataForm/HOC/index.js +20 -37
  90. package/es/comps/MetadataForm/HOC/index.less +41 -41
  91. package/es/comps/MetadataForm/hooks/index.js +12 -38
  92. package/es/comps/MetadataForm/index.js +37 -72
  93. package/es/comps/MetadataForm/interface.d.ts +3 -3
  94. package/es/comps/MetadataForm/utils.js +0 -14
  95. package/es/comps/Split/index.js +20 -22
  96. package/es/config.js +0 -4
  97. package/es/framework/RxStore/demo/index.js +9 -10
  98. package/es/framework/RxStore/hooks.d.ts +9 -9
  99. package/es/framework/RxStore/hooks.js +10 -35
  100. package/es/framework/RxStore/store.d.ts +4 -4
  101. package/es/framework/RxStore/store.js +0 -10
  102. package/es/framework/fg/index.js +18 -80
  103. package/es/framework/fg/interface.d.ts +2 -2
  104. package/es/framework/fg/utils.js +0 -10
  105. package/es/framework/graph/index.d.ts +2 -2
  106. package/es/framework/graph/index.js +55 -110
  107. package/es/framework/hooks/use-async-memo.js +3 -7
  108. package/es/framework/hooks/use-sync-scroll.js +2 -15
  109. package/es/framework/http/cache.js +25 -32
  110. package/es/framework/http/cancel.js +1 -7
  111. package/es/framework/http/index.js +22 -82
  112. package/es/framework/http/msgpack.js +0 -4
  113. package/es/framework/http/msgpack5/index.js +2 -12
  114. package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +1 -13
  115. package/es/framework/http/msgpack5/lib/decoder.js +10 -68
  116. package/es/framework/http/msgpack5/lib/encoder.js +8 -36
  117. package/es/framework/http/msgpack5/lib/helpers.js +3 -2
  118. package/es/framework/http/msgpack5/lib/streams.js +0 -18
  119. package/es/framework/libs/jquery.min.js +1009 -1696
  120. package/es/framework/locale/dil8/di18n.js +4 -15
  121. package/es/framework/locale/dil8/translate.js +0 -14
  122. package/es/framework/locale/dil8/util.js +0 -3
  123. package/es/framework/locale/index.js +2 -3
  124. package/es/framework/metadata/MetadataService.js +39 -78
  125. package/es/framework/metadata/index.js +4 -70
  126. package/es/framework/metadata/types.d.ts +98 -98
  127. package/es/framework/rxjs-hooks/useMemoSubject.js +0 -2
  128. package/es/framework/rxjs-hooks/useObservable.js +2 -4
  129. package/es/framework/rxjs-hooks/useObservableState.js +8 -14
  130. package/es/index.d.ts +1 -0
  131. package/es/index.js +2 -1
  132. package/es/theme.less +79 -79
  133. package/es/utils.js +58 -97
  134. package/package.json +104 -102
@@ -29,12 +29,11 @@ import "antd/es/tag/style";
29
29
  import _Tag from "antd/es/tag";
30
30
  import _typeof from "@babel/runtime/helpers/esm/typeof";
31
31
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
32
- import _regeneratorRuntime from "@babel/runtime/regenerator";
33
32
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
34
33
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
35
34
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
36
35
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
37
-
36
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
38
37
  /*
39
38
  * @Author:wangxian
40
39
  * @Date: 2021-09-18 14:15:04
@@ -49,87 +48,68 @@ import { useAsyncMemo } from '../../../framework/hooks/use-async-memo';
49
48
  import { tr } from '../../../framework/locale';
50
49
  import useObservable from '../../../framework/rxjs-hooks/useObservable';
51
50
  import { assignReplace } from '../utils';
52
-
53
51
  function Index(props) {
54
52
  var _extraInfo$http8, _extraInfo$http9, _extraInfo$http10, _extraInfo$http11, _extraInfo$http12, _extraInfo$http13;
55
-
56
53
  var id = props.id,
57
- name = props.name,
58
- isRefForm = props.isRefForm,
59
- _props$initEnumValue = props.initEnumValue,
60
- initEnumValue = _props$initEnumValue === void 0 ? {} : _props$initEnumValue,
61
- disabled = props.disabled,
62
- field = props.field,
63
- notRequire = props.notRequire,
64
- labelSpan = props.labelSpan,
65
- isObj = props.isObj,
66
- _props$enum = props.enum,
67
- myEnum = _props$enum === void 0 ? [] : _props$enum;
54
+ name = props.name,
55
+ isRefForm = props.isRefForm,
56
+ _props$initEnumValue = props.initEnumValue,
57
+ initEnumValue = _props$initEnumValue === void 0 ? {} : _props$initEnumValue,
58
+ disabled = props.disabled,
59
+ field = props.field,
60
+ notRequire = props.notRequire,
61
+ labelSpan = props.labelSpan,
62
+ isObj = props.isObj,
63
+ _props$enum = props.enum,
64
+ myEnum = _props$enum === void 0 ? [] : _props$enum;
68
65
  var formContext = React.useContext(MetadataFormContext) || {};
69
66
  var formRefContext = React.useContext(MetadataRefContext);
70
67
  var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
71
-
72
68
  var _React$useState = React.useState([]),
73
- _React$useState2 = _slicedToArray(_React$useState, 2),
74
- cascaderOption = _React$useState2[0],
75
- setCascaderOption = _React$useState2[1];
76
-
69
+ _React$useState2 = _slicedToArray(_React$useState, 2),
70
+ cascaderOption = _React$useState2[0],
71
+ setCascaderOption = _React$useState2[1];
77
72
  var _React$useState3 = React.useState([]),
78
- _React$useState4 = _slicedToArray(_React$useState3, 2),
79
- treeData = _React$useState4[0],
80
- setTreeData = _React$useState4[1];
81
-
73
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
74
+ treeData = _React$useState4[0],
75
+ setTreeData = _React$useState4[1];
82
76
  var _React$useState5 = React.useState(),
83
- _React$useState6 = _slicedToArray(_React$useState5, 2),
84
- watchValue = _React$useState6[0],
85
- setWatchValue = _React$useState6[1];
86
-
77
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
78
+ watchValue = _React$useState6[0],
79
+ setWatchValue = _React$useState6[1];
87
80
  var watchValueRef = React.useRef();
88
-
89
81
  var _React$useState7 = React.useState([]),
90
- _React$useState8 = _slicedToArray(_React$useState7, 2),
91
- mutiSelect = _React$useState8[0],
92
- setMutiSelect = _React$useState8[1];
93
-
82
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
83
+ mutiSelect = _React$useState8[0],
84
+ setMutiSelect = _React$useState8[1];
94
85
  var pageRef = React.useRef(1);
95
86
  var totalRef = React.useRef();
96
-
97
87
  var onSelect = function onSelect(value) {
98
88
  formContext.stream$ && formContext.stream$.next({
99
89
  type: 'onSelectChange',
100
90
  payload: _defineProperty({}, id, value)
101
91
  });
102
92
  };
103
-
104
93
  useObservable(function (p) {
105
94
  var _extraInfo$http;
106
-
107
95
  // 判断是否有 watch的扩展属性
108
96
  var _watch = extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http = extraInfo.http) === null || _extraInfo$http === void 0 ? void 0 : _extraInfo$http.watch;
109
-
110
97
  if (_watch && (p === null || p === void 0 ? void 0 : p.type) === 'onValuesChange') {
111
98
  try {
112
99
  var _watchArr = _watch.split(',');
113
-
114
100
  if (_watchArr.length === 1) {
115
101
  var _p$payload;
116
-
117
102
  var evalString = '';
118
-
119
103
  for (var i = 0; i < name.length; i++) {
120
104
  if (i < name.length - 1) {
121
105
  evalString = "".concat(evalString, "[name[").concat(i, "]]");
122
106
  }
123
107
  }
124
-
125
108
  var _value = eval("p?.payload?.allVals".concat(evalString, "[_watchArr[0]]"));
126
-
127
109
  var _changeData = eval("p?.payload?.val".concat(evalString, "[_watchArr[0]]"));
128
-
129
110
  if (_value && _changeData) {
130
111
  if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http.method) === 'post') {
131
112
  var _wRef = watchValueRef.current || {};
132
-
133
113
  _wRef[_watchArr[0]] = _value;
134
114
  watchValueRef.current = _wRef;
135
115
  setWatchValue(_value);
@@ -138,7 +118,6 @@ function Index(props) {
138
118
  watchValueRef.current = _value;
139
119
  }
140
120
  }
141
-
142
121
  if (_changeData && !(p === null || p === void 0 ? void 0 : (_p$payload = p.payload) === null || _p$payload === void 0 ? void 0 : _p$payload.trigger)) {
143
122
  setTimeout(function () {
144
123
  var v = {};
@@ -148,30 +127,23 @@ function Index(props) {
148
127
  }
149
128
  } else {
150
129
  var _p$payload2;
151
-
152
130
  var b = false;
153
-
154
131
  for (var _i = 0; _i < _watchArr.length; _i++) {
155
132
  var w = _watchArr[_i];
156
133
  var _evalString = '';
157
-
158
134
  for (var _i2 = 0; _i2 < name.length; _i2++) {
159
135
  if (_i2 < name.length - 1) {
160
136
  _evalString = "".concat(_evalString, "[name[").concat(_i2, "]]");
161
137
  }
162
138
  }
163
-
164
139
  var _value2 = eval("p?.payload?.allVals".concat(_evalString, "[w]"));
165
-
166
140
  if (_value2) {
167
141
  var _wRef2 = watchValueRef.current || {};
168
-
169
142
  _wRef2[w] = _value2;
170
143
  watchValueRef.current = _wRef2;
171
144
  b = eval("p?.payload?.val".concat(_evalString, "[w]"));
172
145
  }
173
146
  }
174
-
175
147
  if (b && !(p === null || p === void 0 ? void 0 : (_p$payload2 = p.payload) === null || _p$payload2 === void 0 ? void 0 : _p$payload2.trigger)) {
176
148
  setWatchValue(_objectSpread({}, watchValueRef.current));
177
149
  setTimeout(function () {
@@ -189,170 +161,131 @@ function Index(props) {
189
161
  var getEnumDataByUrl = React.useCallback( /*#__PURE__*/function () {
190
162
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(http, pid, page) {
191
163
  var server, _url, res, _res;
192
-
193
164
  return _regeneratorRuntime.wrap(function _callee$(_context) {
194
- while (1) {
195
- switch (_context.prev = _context.next) {
196
- case 0:
197
- server = new MetadataService();
198
- _url = pid || pid === '' ? http.url.replace('{pid}', pid) : http.url;
199
- _url = page ? http.url.replace('{page}', page) : _url;
200
-
201
- if (watchValueRef.current) {
202
- if (typeof watchValueRef.current === 'string') {
203
- _url = _url.replace('{watch}', watchValueRef.current);
204
- }
205
- }
206
-
207
- _context.next = 6;
208
- return server.GetEnumDataByUrl(_url, http.method, (http === null || http === void 0 ? void 0 : http.body) && JSON.parse(http === null || http === void 0 ? void 0 : http.body) ? _objectSpread(_objectSpread({}, JSON.parse(http === null || http === void 0 ? void 0 : http.body)), watchValueRef.current || {}) : watchValueRef.current);
209
-
210
- case 6:
211
- res = _context.sent;
212
- _res = (res === null || res === void 0 ? void 0 : res.total) ? res === null || res === void 0 ? void 0 : res.list : res;
213
- totalRef.current = res === null || res === void 0 ? void 0 : res.total;
214
-
215
- if (!(_res && _res.length > 0)) {
216
- _context.next = 19;
217
- break;
218
- }
219
-
220
- if (!((http === null || http === void 0 ? void 0 : http.isCascader) && http.url.indexOf('{pid}') === -1)) {
221
- _context.next = 12;
222
- break;
223
- }
224
-
225
- return _context.abrupt("return", _res);
226
-
227
- case 12:
228
- if (!(http === null || http === void 0 ? void 0 : http.isGroup)) {
229
- _context.next = 14;
230
- break;
165
+ while (1) switch (_context.prev = _context.next) {
166
+ case 0:
167
+ server = new MetadataService();
168
+ _url = pid || pid === '' ? http.url.replace('{pid}', pid) : http.url;
169
+ _url = page ? http.url.replace('{page}', page) : _url;
170
+ if (watchValueRef.current) {
171
+ if (typeof watchValueRef.current === 'string') {
172
+ _url = _url.replace('{watch}', watchValueRef.current);
231
173
  }
232
-
233
- return _context.abrupt("return", _res);
234
-
235
- case 14:
236
- if (!(http === null || http === void 0 ? void 0 : http.isTreeSelect)) {
237
- _context.next = 16;
238
- break;
174
+ }
175
+ _context.next = 6;
176
+ return server.GetEnumDataByUrl(_url, http.method, (http === null || http === void 0 ? void 0 : http.body) && JSON.parse(http === null || http === void 0 ? void 0 : http.body) ? _objectSpread(_objectSpread({}, JSON.parse(http === null || http === void 0 ? void 0 : http.body)), watchValueRef.current || {}) : watchValueRef.current);
177
+ case 6:
178
+ res = _context.sent;
179
+ _res = (res === null || res === void 0 ? void 0 : res.total) ? res === null || res === void 0 ? void 0 : res.list : res;
180
+ totalRef.current = res === null || res === void 0 ? void 0 : res.total;
181
+ if (!(_res && _res.length > 0)) {
182
+ _context.next = 19;
183
+ break;
184
+ }
185
+ if (!((http === null || http === void 0 ? void 0 : http.isCascader) && http.url.indexOf('{pid}') === -1)) {
186
+ _context.next = 12;
187
+ break;
188
+ }
189
+ return _context.abrupt("return", _res);
190
+ case 12:
191
+ if (!(http === null || http === void 0 ? void 0 : http.isGroup)) {
192
+ _context.next = 14;
193
+ break;
194
+ }
195
+ return _context.abrupt("return", _res);
196
+ case 14:
197
+ if (!(http === null || http === void 0 ? void 0 : http.isTreeSelect)) {
198
+ _context.next = 16;
199
+ break;
200
+ }
201
+ return _context.abrupt("return", _res);
202
+ case 16:
203
+ return _context.abrupt("return", _res.map(function (it) {
204
+ if (http === null || http === void 0 ? void 0 : http.isCascader) {
205
+ return {
206
+ value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
207
+ label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
208
+ isLeaf: it['isLeaf'] ? it['isLeaf'] : false
209
+ };
210
+ } else {
211
+ return {
212
+ value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
213
+ label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
214
+ disabled: false
215
+ };
239
216
  }
240
-
241
- return _context.abrupt("return", _res);
242
-
243
- case 16:
244
- return _context.abrupt("return", _res.map(function (it) {
245
- if (http === null || http === void 0 ? void 0 : http.isCascader) {
246
- return {
247
- value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
248
- label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
249
- isLeaf: it['isLeaf'] ? it['isLeaf'] : false
250
- };
251
- } else {
252
- return {
253
- value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
254
- label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
255
- disabled: false
256
- };
257
- }
258
- }));
259
-
260
- case 19:
261
- console.warn("".concat(_url, " is not return success result"));
262
- return _context.abrupt("return", []);
263
-
264
- case 21:
265
- case "end":
266
- return _context.stop();
267
- }
217
+ }));
218
+ case 19:
219
+ console.warn("".concat(_url, " is not return success result"));
220
+ return _context.abrupt("return", []);
221
+ case 21:
222
+ case "end":
223
+ return _context.stop();
268
224
  }
269
225
  }, _callee);
270
226
  }));
271
-
272
227
  return function (_x, _x2, _x3) {
273
228
  return _ref.apply(this, arguments);
274
229
  };
275
230
  }(), []);
276
-
277
231
  var processSelectOptionsData = function processSelectOptionsData() {
278
232
  var _options = [];
279
-
280
- var _enum = deepClone(myEnum || []); // 扩展规则的value
281
-
282
-
233
+ var _enum = deepClone(myEnum || []);
234
+ // 扩展规则的value
283
235
  if (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.value) {
284
236
  _enum = deepClone(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.value);
285
- } // 目前是更具那么的id判断的,暂未考虑重名问题
286
-
287
-
237
+ }
238
+ // 目前是更具那么的id判断的,暂未考虑重名问题
288
239
  if (initEnumValue[id]) {
289
240
  _enum = deepClone(initEnumValue[id]);
290
241
  }
291
-
292
242
  _enum.forEach(function (it) {
293
243
  var _it$key;
294
-
295
244
  var obj = {
296
245
  label: it.value,
297
246
  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
298
247
  };
299
-
300
248
  _options.push(obj);
301
249
  });
302
-
303
250
  return _options;
304
251
  };
305
-
306
252
  var options = React.useMemo(function () {
307
253
  return processSelectOptionsData();
308
254
  }, [initEnumValue, myEnum, id, extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxSelect]);
309
255
  var httpOptions = useAsyncMemo( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
310
256
  var _extraInfo$http2, _extraInfo$http3, _extraInfo$http4, res;
311
-
312
257
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
313
- while (1) {
314
- switch (_context2.prev = _context2.next) {
315
- case 0:
316
- if (!((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http.url))) {
317
- _context2.next = 7;
318
- break;
319
- }
320
-
321
- _context2.next = 3;
322
- return getEnumDataByUrl(deepClone(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http), '', (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http2 = extraInfo.http) === null || _extraInfo$http2 === void 0 ? void 0 : _extraInfo$http2.isPagination) && pageRef.current);
323
-
324
- case 3:
325
- res = _context2.sent;
326
-
327
- if (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http3 = extraInfo.http) === null || _extraInfo$http3 === void 0 ? void 0 : _extraInfo$http3.isCascader) {
328
- setCascaderOption(_toConsumableArray(res));
329
- }
330
-
331
- if (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http4 = extraInfo.http) === null || _extraInfo$http4 === void 0 ? void 0 : _extraInfo$http4.isTreeSelect) {
332
- setTreeData(_toConsumableArray(res));
333
- }
334
-
335
- return _context2.abrupt("return", res);
336
-
337
- case 7:
338
- return _context2.abrupt("return", []);
339
-
340
- case 8:
341
- case "end":
342
- return _context2.stop();
343
- }
258
+ while (1) switch (_context2.prev = _context2.next) {
259
+ case 0:
260
+ if (!((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http.url))) {
261
+ _context2.next = 7;
262
+ break;
263
+ }
264
+ _context2.next = 3;
265
+ return getEnumDataByUrl(deepClone(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http), '', (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http2 = extraInfo.http) === null || _extraInfo$http2 === void 0 ? void 0 : _extraInfo$http2.isPagination) && pageRef.current);
266
+ case 3:
267
+ res = _context2.sent;
268
+ if (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http3 = extraInfo.http) === null || _extraInfo$http3 === void 0 ? void 0 : _extraInfo$http3.isCascader) {
269
+ setCascaderOption(_toConsumableArray(res));
270
+ }
271
+ if (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http4 = extraInfo.http) === null || _extraInfo$http4 === void 0 ? void 0 : _extraInfo$http4.isTreeSelect) {
272
+ setTreeData(_toConsumableArray(res));
273
+ }
274
+ return _context2.abrupt("return", res);
275
+ case 7:
276
+ return _context2.abrupt("return", []);
277
+ case 8:
278
+ case "end":
279
+ return _context2.stop();
344
280
  }
345
281
  }, _callee2);
346
282
  })), [extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http, watchValue]);
347
283
  var myOptions = React.useMemo(function () {
348
284
  var _options = options;
349
-
350
285
  if (httpOptions && httpOptions.length > 0) {
351
286
  _options = httpOptions;
352
287
  }
353
-
354
288
  var _maxSelect = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxSelect;
355
-
356
289
  if (_maxSelect && mutiSelect.length > 0) {
357
290
  if (mutiSelect.length === _maxSelect) {
358
291
  _options = _options.map(function (it) {
@@ -365,62 +298,47 @@ function Index(props) {
365
298
  });
366
299
  }
367
300
  }
368
-
369
301
  return _options;
370
302
  }, [options, httpOptions, mutiSelect, extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxSelect]);
371
-
372
303
  var loadData = /*#__PURE__*/function () {
373
304
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(selectedOptions) {
374
305
  var _targetOption$childre;
375
-
376
306
  var targetOption, _children;
377
-
378
307
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
379
- while (1) {
380
- switch (_context3.prev = _context3.next) {
381
- case 0:
382
- targetOption = selectedOptions[selectedOptions.length - 1];
383
- targetOption.loading = true;
384
-
385
- if (!(!targetOption.isLeaf && (!(targetOption === null || targetOption === void 0 ? void 0 : targetOption.children) || ((_targetOption$childre = targetOption.children) === null || _targetOption$childre === void 0 ? void 0 : _targetOption$childre.length) === 0))) {
386
- _context3.next = 7;
387
- break;
388
- }
389
-
390
- _context3.next = 5;
391
- return getEnumDataByUrl(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http, targetOption.value);
392
-
393
- case 5:
394
- _children = _context3.sent;
395
- setTimeout(function () {
396
- targetOption.loading = false;
397
- targetOption.children = _children;
398
- setCascaderOption(_toConsumableArray(cascaderOption));
399
- }, 500);
400
-
401
- case 7:
402
- case "end":
403
- return _context3.stop();
404
- }
308
+ while (1) switch (_context3.prev = _context3.next) {
309
+ case 0:
310
+ targetOption = selectedOptions[selectedOptions.length - 1];
311
+ targetOption.loading = true;
312
+ if (!(!targetOption.isLeaf && (!(targetOption === null || targetOption === void 0 ? void 0 : targetOption.children) || ((_targetOption$childre = targetOption.children) === null || _targetOption$childre === void 0 ? void 0 : _targetOption$childre.length) === 0))) {
313
+ _context3.next = 7;
314
+ break;
315
+ }
316
+ _context3.next = 5;
317
+ return getEnumDataByUrl(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http, targetOption.value);
318
+ case 5:
319
+ _children = _context3.sent;
320
+ setTimeout(function () {
321
+ targetOption.loading = false;
322
+ targetOption.children = _children;
323
+ setCascaderOption(_toConsumableArray(cascaderOption));
324
+ }, 500);
325
+ case 7:
326
+ case "end":
327
+ return _context3.stop();
405
328
  }
406
329
  }, _callee3);
407
330
  }));
408
-
409
331
  return function loadData(_x4) {
410
332
  return _ref3.apply(this, arguments);
411
333
  };
412
334
  }();
413
-
414
335
  var onSearch = function onSearch(value) {};
415
-
416
336
  var onPagination = function onPagination(page, pageSize) {};
417
-
418
337
  var onSelectChange = function onSelectChange(v) {
419
338
  if (_typeof(v) === 'object') {
420
339
  setMutiSelect(_toConsumableArray(v));
421
340
  }
422
341
  };
423
-
424
342
  var maxTagPlaceholder = function maxTagPlaceholder(omittedValues) {
425
343
  if (omittedValues) {
426
344
  return /*#__PURE__*/React.createElement(_Tooltip, {
@@ -437,11 +355,9 @@ function Index(props) {
437
355
  return '...';
438
356
  }
439
357
  };
440
-
441
358
  var processSelectType = function processSelectType(isCascader, isTreeSelect, isPagination) {
442
359
  if (isCascader) {
443
360
  var _extraInfo$disabled;
444
-
445
361
  return /*#__PURE__*/React.createElement(_Cascader, {
446
362
  multiple: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple,
447
363
  disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
@@ -451,12 +367,10 @@ function Index(props) {
451
367
  });
452
368
  } else if (isTreeSelect) {
453
369
  var _extraInfo$disabled2;
454
-
455
370
  return /*#__PURE__*/React.createElement(_TreeSelect, {
456
371
  showSearch: true,
457
372
  filterTreeNode: function filterTreeNode(input, treeNode) {
458
373
  var _treeNode$label;
459
-
460
374
  return (treeNode === null || treeNode === void 0 ? void 0 : (_treeNode$label = treeNode.label) === null || _treeNode$label === void 0 ? void 0 : _treeNode$label.toString().indexOf(input)) >= 0;
461
375
  },
462
376
  treeNodeLabelProp: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.treeNodeLabelProp,
@@ -481,7 +395,6 @@ function Index(props) {
481
395
  });
482
396
  } else if (isPagination) {
483
397
  var _extraInfo$disabled3;
484
-
485
398
  return /*#__PURE__*/React.createElement(_Select, {
486
399
  mode: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple) ? 'multiple' : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.mode,
487
400
  onSelect: onSelect,
@@ -522,7 +435,6 @@ function Index(props) {
522
435
  }
523
436
  }, /*#__PURE__*/React.createElement(_Row, null, (httpOptions && httpOptions.length > 0 ? httpOptions : options).map(function (it) {
524
437
  var _extraInfo$checkbox;
525
-
526
438
  return /*#__PURE__*/React.createElement(_Col, {
527
439
  key: it.value,
528
440
  span: extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$checkbox = extraInfo.checkbox) === null || _extraInfo$checkbox === void 0 ? void 0 : _extraInfo$checkbox.colSpan
@@ -535,7 +447,6 @@ function Index(props) {
535
447
  }
536
448
  }, /*#__PURE__*/React.createElement(_Row, null, (httpOptions && httpOptions.length > 0 ? httpOptions : options).map(function (it) {
537
449
  var _extraInfo$checkbox2;
538
-
539
450
  return /*#__PURE__*/React.createElement(_Col, {
540
451
  key: it.value,
541
452
  span: extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$checkbox2 = extraInfo.checkbox) === null || _extraInfo$checkbox2 === void 0 ? void 0 : _extraInfo$checkbox2.colSpan
@@ -545,7 +456,6 @@ function Index(props) {
545
456
  })));
546
457
  } else {
547
458
  var _extraInfo$disabled4;
548
-
549
459
  return /*#__PURE__*/React.createElement(_Select, {
550
460
  mode: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple) ? 'multiple' : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.mode,
551
461
  onSelect: onSelect,
@@ -555,7 +465,6 @@ function Index(props) {
555
465
  showSearch: true,
556
466
  filterOption: function filterOption(input, option) {
557
467
  var _option$label;
558
-
559
468
  return (option === null || option === void 0 ? void 0 : (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.toString().indexOf(input)) >= 0;
560
469
  },
561
470
  getPopupContainer: function getPopupContainer(triggerNode) {
@@ -569,10 +478,8 @@ function Index(props) {
569
478
  });
570
479
  }
571
480
  };
572
-
573
481
  if (isObj && isRefForm && field) {
574
482
  var _extraInfo$http5, _extraInfo$http6, _extraInfo$http7;
575
-
576
483
  return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
577
484
  style: {
578
485
  flex: 1,
@@ -602,7 +509,6 @@ function Index(props) {
602
509
  tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
603
510
  }), processSelectType((_extraInfo$http5 = extraInfo.http) === null || _extraInfo$http5 === void 0 ? void 0 : _extraInfo$http5.isCascader, (_extraInfo$http6 = extraInfo.http) === null || _extraInfo$http6 === void 0 ? void 0 : _extraInfo$http6.isTreeSelect, (_extraInfo$http7 = extraInfo.http) === null || _extraInfo$http7 === void 0 ? void 0 : _extraInfo$http7.isPagination));
604
511
  }
605
-
606
512
  return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
607
513
  key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
608
514
  initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
@@ -644,5 +550,4 @@ function Index(props) {
644
550
  tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
645
551
  }), processSelectType((_extraInfo$http11 = extraInfo.http) === null || _extraInfo$http11 === void 0 ? void 0 : _extraInfo$http11.isCascader, (_extraInfo$http12 = extraInfo.http) === null || _extraInfo$http12 === void 0 ? void 0 : _extraInfo$http12.isTreeSelect, (_extraInfo$http13 = extraInfo.http) === null || _extraInfo$http13 === void 0 ? void 0 : _extraInfo$http13.isPagination));
646
552
  }
647
-
648
553
  export default /*#__PURE__*/React.memo(Index);
@@ -4,7 +4,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import "antd/es/switch/style";
5
5
  import _Switch from "antd/es/switch";
6
6
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
7
-
8
7
  /*
9
8
  * @Author: wangxian
10
9
  * @Date: 2021-09-18 14:15:04
@@ -13,25 +12,21 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
13
12
  import React from 'react';
14
13
  import { MetadataFormContext, MetadataRefContext } from '../interface';
15
14
  import { useGetExtraInfo } from '../hooks';
16
-
17
15
  function Index(props) {
18
16
  var _extraInfo$disabled2, _extraInfo$disabled3;
19
-
20
17
  var id = props.id,
21
- name = props.name,
22
- isRefForm = props.isRefForm,
23
- disabled = props.disabled,
24
- notRequire = props.notRequire,
25
- labelSpan = props.labelSpan,
26
- field = props.field,
27
- isObj = props.isObj;
18
+ name = props.name,
19
+ isRefForm = props.isRefForm,
20
+ disabled = props.disabled,
21
+ notRequire = props.notRequire,
22
+ labelSpan = props.labelSpan,
23
+ field = props.field,
24
+ isObj = props.isObj;
28
25
  var formContext = React.useContext(MetadataFormContext) || {};
29
26
  var formRefContext = React.useContext(MetadataRefContext);
30
27
  var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
31
-
32
28
  if (isObj && isRefForm && field) {
33
29
  var _extraInfo$disabled;
34
-
35
30
  return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
36
31
  style: {
37
32
  flex: 1,
@@ -66,7 +61,6 @@ function Index(props) {
66
61
  unCheckedChildren: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.unCheckedChildren
67
62
  }));
68
63
  }
69
-
70
64
  return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
71
65
  label: /*#__PURE__*/React.createElement("span", {
72
66
  style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
@@ -118,5 +112,4 @@ function Index(props) {
118
112
  unCheckedChildren: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.unCheckedChildren
119
113
  }));
120
114
  }
121
-
122
115
  export default /*#__PURE__*/React.memo(Index);