ronds-metadata 1.2.8 → 1.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Table.d.ts +2 -0
  2. package/es/comps/FormGenerator/comps/Canvas/core/index.less +23 -23
  3. package/es/comps/FormGenerator/index.d.ts +4 -0
  4. package/es/comps/FormGenerator/settings/index.d.ts +668 -49
  5. package/es/comps/JsonEdit/index.d.ts +5 -1
  6. package/es/comps/MetadataForm/index.less +1 -1
  7. package/es/comps/MetadataForm/utils.d.ts +1 -1
  8. package/package.json +1 -1
  9. package/es/api/index.js +0 -249
  10. package/es/comps/DynamicPorts/comps/ContextMenu.js +0 -44
  11. package/es/comps/DynamicPorts/comps/DragNode.js +0 -55
  12. package/es/comps/DynamicPorts/comps/GraphHandler/index.js +0 -51
  13. package/es/comps/DynamicPorts/comps/NodeElement.js +0 -30
  14. package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.js +0 -42
  15. package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.js +0 -40
  16. package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +0 -55
  17. package/es/comps/DynamicPorts/comps/shape/connector.js +0 -19
  18. package/es/comps/DynamicPorts/comps/shape/edge.js +0 -91
  19. package/es/comps/DynamicPorts/comps/shape/node.js +0 -190
  20. package/es/comps/DynamicPorts/constant/index.js +0 -19
  21. package/es/comps/DynamicPorts/graph.js +0 -697
  22. package/es/comps/DynamicPorts/index.js +0 -143
  23. package/es/comps/DynamicPorts/interface.js +0 -6
  24. package/es/comps/DynamicPorts/utils.js +0 -127
  25. package/es/comps/Editable/DataCell/ButtonCell.js +0 -45
  26. package/es/comps/Editable/DataCell/ColorPicker.js +0 -33
  27. package/es/comps/Editable/DataCell/Input.js +0 -54
  28. package/es/comps/Editable/DataCell/Number.js +0 -44
  29. package/es/comps/Editable/DataCell/Select.js +0 -48
  30. package/es/comps/Editable/DataCell/Switch.js +0 -33
  31. package/es/comps/Editable/comps/EditableAction.js +0 -110
  32. package/es/comps/Editable/comps/EditableCell.js +0 -108
  33. package/es/comps/Editable/comps/EditableHeardCell.js +0 -172
  34. package/es/comps/Editable/comps/EditableRow.js +0 -118
  35. package/es/comps/Editable/comps/Texty.js +0 -277
  36. package/es/comps/Editable/index.js +0 -385
  37. package/es/comps/Editable/interface.js +0 -8
  38. package/es/comps/Editable/utils.js +0 -46
  39. package/es/comps/FileView/index.js +0 -198
  40. package/es/comps/FormGenerator/Provider.js +0 -8
  41. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Checkbox.js +0 -17
  42. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Color.js +0 -17
  43. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Date.js +0 -16
  44. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Input.js +0 -17
  45. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/List.js +0 -17
  46. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/MutiSelect.js +0 -55
  47. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Number.js +0 -14
  48. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Obj.js +0 -50
  49. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Password.js +0 -17
  50. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Radio.js +0 -17
  51. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Select.js +0 -55
  52. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Switch.js +0 -13
  53. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/TextArea.js +0 -14
  54. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/Upload.js +0 -17
  55. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/HOC/index.js +0 -250
  56. package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +0 -60
  57. package/es/comps/FormGenerator/comps/Canvas/core/index.js +0 -313
  58. package/es/comps/FormGenerator/comps/Canvas/index.js +0 -216
  59. package/es/comps/FormGenerator/comps/Settings/index.js +0 -150
  60. package/es/comps/FormGenerator/comps/Sidebar/Elements.js +0 -48
  61. package/es/comps/FormGenerator/comps/Sidebar/index.js +0 -37
  62. package/es/comps/FormGenerator/index.js +0 -56
  63. package/es/comps/FormGenerator/settings/index.js +0 -303
  64. package/es/comps/FormGenerator/settings/ruleConfig.js +0 -557
  65. package/es/comps/FormGenerator/transformer.js +0 -214
  66. package/es/comps/Icons/index.js +0 -23
  67. package/es/comps/JsonEdit/constant/index.js +0 -87
  68. package/es/comps/JsonEdit/index.js +0 -217
  69. package/es/comps/JsonView/index.js +0 -109
  70. package/es/comps/MdEdit/index.js +0 -41
  71. package/es/comps/MdNavbar/index.js +0 -180
  72. package/es/comps/MdNavbar/utils.js +0 -34
  73. package/es/comps/MdView/index.js +0 -70
  74. package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +0 -419
  75. package/es/comps/MetadataEdit/components/MetaPropsEdit.js +0 -368
  76. package/es/comps/MetadataEdit/constant/index.js +0 -69
  77. package/es/comps/MetadataEdit/hooks/index.js +0 -43
  78. package/es/comps/MetadataEdit/index.js +0 -255
  79. package/es/comps/MetadataEditV2/components/MetaFieldsEdit.js +0 -237
  80. package/es/comps/MetadataEditV2/components/MetaPropsEdit.js +0 -367
  81. package/es/comps/MetadataEditV2/constant/index.js +0 -69
  82. package/es/comps/MetadataEditV2/hooks/index.js +0 -43
  83. package/es/comps/MetadataEditV2/index.js +0 -298
  84. package/es/comps/MetadataForm/DataCell/Array.js +0 -157
  85. package/es/comps/MetadataForm/DataCell/Input.js +0 -197
  86. package/es/comps/MetadataForm/DataCell/Number.js +0 -130
  87. package/es/comps/MetadataForm/DataCell/Ref.js +0 -323
  88. package/es/comps/MetadataForm/DataCell/Select.js +0 -517
  89. package/es/comps/MetadataForm/DataCell/Switch.js +0 -115
  90. package/es/comps/MetadataForm/DataCell/layout/TableArray.js +0 -359
  91. package/es/comps/MetadataForm/HOC/index.js +0 -111
  92. package/es/comps/MetadataForm/constants.js +0 -11
  93. package/es/comps/MetadataForm/hooks/index.js +0 -128
  94. package/es/comps/MetadataForm/index.js +0 -268
  95. package/es/comps/MetadataForm/interface.js +0 -8
  96. package/es/comps/MetadataForm/utils.js +0 -108
  97. package/es/comps/locales/en-US.js +0 -24
  98. package/es/comps/locales/index.js +0 -8
  99. package/es/comps/locales/zh-CN.js +0 -24
  100. package/es/config.js +0 -50
  101. package/es/framework/graph/index.js +0 -515
  102. package/es/framework/hooks/use-async-memo.js +0 -32
  103. package/es/framework/hooks/use-sync-scroll.js +0 -106
  104. package/es/framework/http/cache.js +0 -137
  105. package/es/framework/http/cancel.js +0 -44
  106. package/es/framework/http/index.js +0 -392
  107. package/es/framework/http/msgpack.js +0 -34
  108. package/es/framework/http/msgpack5/index.js +0 -84
  109. package/es/framework/http/msgpack5/lib/codecs/DateCodec.js +0 -71
  110. package/es/framework/http/msgpack5/lib/decoder.js +0 -287
  111. package/es/framework/http/msgpack5/lib/encoder.js +0 -252
  112. package/es/framework/http/msgpack5/lib/helpers.js +0 -23
  113. package/es/framework/http/msgpack5/lib/streams.js +0 -93
  114. package/es/framework/http/types.js +0 -1
  115. package/es/framework/libs/jquery.min.js +0 -4022
  116. package/es/framework/locale/dil8/di18n.js +0 -132
  117. package/es/framework/locale/dil8/index.js +0 -3
  118. package/es/framework/locale/dil8/translate.js +0 -76
  119. package/es/framework/locale/dil8/util.js +0 -17
  120. package/es/framework/locale/index.js +0 -26
  121. package/es/framework/metadata/MetadataService.js +0 -169
  122. package/es/framework/metadata/index.js +0 -384
  123. package/es/framework/rxjs-hooks/useMemoSubject.js +0 -16
  124. package/es/framework/rxjs-hooks/useObservable.js +0 -22
  125. package/es/framework/rxjs-hooks/useObservableState.js +0 -45
  126. package/es/index.js +0 -27
  127. package/es/utils.js +0 -138
@@ -1,517 +0,0 @@
1
- import "antd/es/form/style";
2
- import _Form from "antd/es/form";
3
- import _extends from "@babel/runtime/helpers/esm/extends";
4
- import "antd/es/radio/style";
5
- import _Radio from "antd/es/radio";
6
- import "antd/es/row/style";
7
- import _Row from "antd/es/row";
8
- import "antd/es/col/style";
9
- import _Col from "antd/es/col";
10
- import "antd/es/checkbox/style";
11
- import _Checkbox from "antd/es/checkbox";
12
- import "antd/es/select/style";
13
- import _Select from "antd/es/select";
14
- import "antd/es/space/style";
15
- import _Space from "antd/es/space";
16
- import "antd/es/pagination/style";
17
- import _Pagination from "antd/es/pagination";
18
- import "antd/es/input/style";
19
- import _Input from "antd/es/input";
20
- import "antd/es/divider/style";
21
- import _Divider from "antd/es/divider";
22
- import "antd/es/cascader/style";
23
- import _Cascader from "antd/es/cascader";
24
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
25
- import _regeneratorRuntime from "@babel/runtime/regenerator";
26
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
27
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
28
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
29
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
30
-
31
- /*
32
- * @Author:wangxian
33
- * @Date: 2021-09-18 14:15:04
34
- * @LastEditTime: 2023-02-23 19:34:06
35
- */
36
- import React from 'react';
37
- import { MetadataFormContext, MetadataRefContext } from '../interface';
38
- import { useGetExtraInfo } from '../hooks';
39
- import { MetadataService } from '../../../framework/metadata/MetadataService';
40
- import { deepClone } from '../../../utils';
41
- import { useAsyncMemo } from '../../../framework/hooks/use-async-memo';
42
- import { tr } from '../../../framework/locale';
43
- import useObservable from '../../../framework/rxjs-hooks/useObservable';
44
- import { assign } from '../utils';
45
-
46
- function Index(props) {
47
- var _extraInfo$http6, _extraInfo$http7, _extraInfo$http8, _extraInfo$http9;
48
-
49
- var id = props.id,
50
- name = props.name,
51
- isRefForm = props.isRefForm,
52
- _props$initEnumValue = props.initEnumValue,
53
- initEnumValue = _props$initEnumValue === void 0 ? {} : _props$initEnumValue,
54
- disabled = props.disabled,
55
- field = props.field,
56
- labelSpan = props.labelSpan,
57
- isObj = props.isObj,
58
- _props$enum = props.enum,
59
- myEnum = _props$enum === void 0 ? [] : _props$enum;
60
- var formContext = React.useContext(MetadataFormContext) || {};
61
- var formRefContext = React.useContext(MetadataRefContext);
62
- var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
63
-
64
- var _React$useState = React.useState([]),
65
- _React$useState2 = _slicedToArray(_React$useState, 2),
66
- cascaderOption = _React$useState2[0],
67
- setCascaderOption = _React$useState2[1];
68
-
69
- var _React$useState3 = React.useState(),
70
- _React$useState4 = _slicedToArray(_React$useState3, 2),
71
- watchValue = _React$useState4[0],
72
- setWatchValue = _React$useState4[1];
73
-
74
- var watchValueRef = React.useRef();
75
- var pageRef = React.useRef(1);
76
- var totalRef = React.useRef();
77
-
78
- var onSelect = function onSelect(value) {
79
- formContext.stream$ && formContext.stream$.next({
80
- type: 'onSelectChange',
81
- payload: _defineProperty({}, id, value)
82
- });
83
- };
84
-
85
- useObservable(function (p) {
86
- var _extraInfo$http;
87
-
88
- // 判断是否有 watch的扩展属性
89
- var _watch = extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http = extraInfo.http) === null || _extraInfo$http === void 0 ? void 0 : _extraInfo$http.watch;
90
-
91
- if (_watch && (p === null || p === void 0 ? void 0 : p.type) === 'onValuesChange') {
92
- try {
93
- var _watchArr = _watch.split(',');
94
-
95
- if (_watchArr.length === 1) {
96
- var evalString = '';
97
-
98
- for (var i = 0; i < name.length; i++) {
99
- if (i < name.length - 1) {
100
- evalString = "".concat(evalString, "[name[").concat(i, "]]");
101
- }
102
- }
103
-
104
- var _value = eval("p?.payload?.allVals".concat(evalString, "[_watchArr[0]]"));
105
-
106
- var _changeData = eval("p?.payload?.val".concat(evalString, "[_watchArr[0]]"));
107
-
108
- if (_value && _changeData) {
109
- if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http.method) === 'post') {
110
- var _wRef = watchValueRef.current || {};
111
-
112
- _wRef[_watchArr[0]] = _value;
113
- watchValueRef.current = _wRef;
114
- setWatchValue(_value);
115
- } else {
116
- setWatchValue(_value.toString());
117
- watchValueRef.current = _value;
118
- }
119
- }
120
-
121
- if (_changeData) {
122
- setTimeout(function () {
123
- var v = {};
124
- assign(name, undefined, v);
125
- formContext.form.setFieldsValue(_objectSpread({}, v));
126
- }, 100);
127
- }
128
- } else {
129
- var b = false;
130
-
131
- for (var _i = 0; _i < _watchArr.length; _i++) {
132
- var w = _watchArr[_i];
133
- var _evalString = '';
134
-
135
- for (var _i2 = 0; _i2 < name.length; _i2++) {
136
- if (_i2 < name.length - 1) {
137
- _evalString = "".concat(_evalString, "[name[").concat(_i2, "]]");
138
- }
139
- }
140
-
141
- var _value2 = eval("p?.payload?.allVals".concat(_evalString, "[w]"));
142
-
143
- if (_value2) {
144
- var _wRef2 = watchValueRef.current || {};
145
-
146
- _wRef2[w] = _value2;
147
- watchValueRef.current = _wRef2;
148
- b = eval("p?.payload?.val".concat(_evalString, "[w]"));
149
- }
150
- }
151
-
152
- if (b) {
153
- setWatchValue(_objectSpread({}, watchValueRef.current));
154
- setTimeout(function () {
155
- var v = {};
156
- assign(name, undefined, v);
157
- formContext.form.setFieldsValue(_objectSpread({}, v));
158
- }, 100);
159
- }
160
- }
161
- } catch (error) {
162
- console.warn('watch:' + error);
163
- }
164
- }
165
- }, [formContext.stream$, extraInfo]);
166
- var getEnumDataByUrl = React.useCallback( /*#__PURE__*/function () {
167
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(http, pid, page) {
168
- var server, _url, res, _res;
169
-
170
- return _regeneratorRuntime.wrap(function _callee$(_context) {
171
- while (1) {
172
- switch (_context.prev = _context.next) {
173
- case 0:
174
- server = new MetadataService();
175
- _url = pid || pid === '' ? http.url.replace('{pid}', pid) : http.url;
176
- _url = page ? http.url.replace('{page}', page) : _url;
177
-
178
- if (watchValueRef.current) {
179
- if (typeof watchValueRef.current === 'string') {
180
- _url = _url.replace('{watch}', watchValueRef.current);
181
- }
182
- }
183
-
184
- _context.next = 6;
185
- 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);
186
-
187
- case 6:
188
- res = _context.sent;
189
- _res = (res === null || res === void 0 ? void 0 : res.total) ? res === null || res === void 0 ? void 0 : res.list : res;
190
- totalRef.current = res === null || res === void 0 ? void 0 : res.total;
191
-
192
- if (!(_res && _res.length > 0)) {
193
- _context.next = 15;
194
- break;
195
- }
196
-
197
- if (!((http === null || http === void 0 ? void 0 : http.isCascader) && http.url.indexOf('{pid}') === -1)) {
198
- _context.next = 12;
199
- break;
200
- }
201
-
202
- return _context.abrupt("return", _res);
203
-
204
- case 12:
205
- return _context.abrupt("return", _res.map(function (it) {
206
- if (http === null || http === void 0 ? void 0 : http.isCascader) {
207
- return {
208
- value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
209
- label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name'],
210
- isLeaf: it['isLeaf'] ? it['isLeaf'] : false
211
- };
212
- } else {
213
- return {
214
- value: it[(http === null || http === void 0 ? void 0 : http.key) || 'id'],
215
- label: it[(http === null || http === void 0 ? void 0 : http.value) || 'name']
216
- };
217
- }
218
- }));
219
-
220
- case 15:
221
- console.warn("".concat(_url, " is not return success result"));
222
- return _context.abrupt("return", []);
223
-
224
- case 17:
225
- case "end":
226
- return _context.stop();
227
- }
228
- }
229
- }, _callee);
230
- }));
231
-
232
- return function (_x, _x2, _x3) {
233
- return _ref.apply(this, arguments);
234
- };
235
- }(), []);
236
-
237
- var processSelectOptionsData = function processSelectOptionsData() {
238
- var _options = [];
239
-
240
- var _enum = deepClone(myEnum || []); // 扩展规则的value
241
-
242
-
243
- if (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.value) {
244
- _enum = deepClone(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.value);
245
- } // 目前是更具那么的id判断的,暂未考虑重名问题
246
-
247
-
248
- if (initEnumValue[id]) {
249
- _enum = deepClone(initEnumValue[id]);
250
- }
251
-
252
- _enum.forEach(function (it) {
253
- var _it$key;
254
-
255
- var obj = {
256
- label: it.value,
257
- 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
258
- };
259
-
260
- _options.push(obj);
261
- });
262
-
263
- return _options;
264
- };
265
-
266
- var options = React.useMemo(function () {
267
- return processSelectOptionsData();
268
- }, [initEnumValue, myEnum, id]);
269
- var httpOptions = useAsyncMemo( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
270
- var _extraInfo$http2, _extraInfo$http3, res;
271
-
272
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
273
- while (1) {
274
- switch (_context2.prev = _context2.next) {
275
- case 0:
276
- if (!((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http.url))) {
277
- _context2.next = 6;
278
- break;
279
- }
280
-
281
- _context2.next = 3;
282
- 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);
283
-
284
- case 3:
285
- res = _context2.sent;
286
-
287
- if (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$http3 = extraInfo.http) === null || _extraInfo$http3 === void 0 ? void 0 : _extraInfo$http3.isCascader) {
288
- setCascaderOption(_toConsumableArray(res));
289
- }
290
-
291
- return _context2.abrupt("return", res);
292
-
293
- case 6:
294
- return _context2.abrupt("return", []);
295
-
296
- case 7:
297
- case "end":
298
- return _context2.stop();
299
- }
300
- }
301
- }, _callee2);
302
- })), [extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http, watchValue]);
303
-
304
- var loadData = /*#__PURE__*/function () {
305
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(selectedOptions) {
306
- var _targetOption$childre;
307
-
308
- var targetOption, _children;
309
-
310
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
311
- while (1) {
312
- switch (_context3.prev = _context3.next) {
313
- case 0:
314
- targetOption = selectedOptions[selectedOptions.length - 1];
315
- targetOption.loading = true;
316
-
317
- 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))) {
318
- _context3.next = 7;
319
- break;
320
- }
321
-
322
- _context3.next = 5;
323
- return getEnumDataByUrl(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http, targetOption.value);
324
-
325
- case 5:
326
- _children = _context3.sent;
327
- setTimeout(function () {
328
- targetOption.loading = false;
329
- targetOption.children = _children;
330
- setCascaderOption(_toConsumableArray(cascaderOption));
331
- }, 500);
332
-
333
- case 7:
334
- case "end":
335
- return _context3.stop();
336
- }
337
- }
338
- }, _callee3);
339
- }));
340
-
341
- return function loadData(_x4) {
342
- return _ref3.apply(this, arguments);
343
- };
344
- }();
345
-
346
- var onSearch = function onSearch(value) {};
347
-
348
- var onPagination = function onPagination(page, pageSize) {};
349
-
350
- var processSelectType = function processSelectType(isCascader, isPagination) {
351
- if (isCascader) {
352
- var _extraInfo$disabled;
353
-
354
- return /*#__PURE__*/React.createElement(_Cascader, {
355
- multiple: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple,
356
- disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
357
- options: cascaderOption,
358
- loadData: loadData,
359
- maxTagCount: 10
360
- });
361
- } else if (isPagination) {
362
- var _extraInfo$disabled2;
363
-
364
- return /*#__PURE__*/React.createElement(_Select, {
365
- mode: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple) ? 'multiple' : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.mode,
366
- onSelect: onSelect,
367
- disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
368
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
369
- options: httpOptions && httpOptions.length > 0 ? httpOptions : options,
370
- dropdownRender: function dropdownRender(menu) {
371
- return /*#__PURE__*/React.createElement(React.Fragment, null, menu, /*#__PURE__*/React.createElement(_Divider, {
372
- style: {
373
- margin: '8px 0'
374
- }
375
- }), /*#__PURE__*/React.createElement(_Space, {
376
- style: {
377
- padding: '0 8px 4px',
378
- width: '100%',
379
- display: 'flex'
380
- }
381
- }, /*#__PURE__*/React.createElement(_Input.Search, {
382
- placeholder: tr('根据名称检索'),
383
- onSearch: onSearch
384
- }), /*#__PURE__*/React.createElement(_Pagination, {
385
- simple: true,
386
- defaultCurrent: pageRef.current,
387
- total: totalRef.current,
388
- pageSize: 30,
389
- onChange: onPagination
390
- })));
391
- },
392
- getPopupContainer: function getPopupContainer(triggerNode) {
393
- return triggerNode.parentNode;
394
- },
395
- allowClear: true
396
- });
397
- } else if (extraInfo.type === 'checkbox') {
398
- return (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple) ? /*#__PURE__*/React.createElement(_Checkbox.Group, {
399
- style: {
400
- width: '100%'
401
- }
402
- }, /*#__PURE__*/React.createElement(_Row, null, (httpOptions && httpOptions.length > 0 ? httpOptions : options).map(function (it) {
403
- var _extraInfo$checkbox;
404
-
405
- return /*#__PURE__*/React.createElement(_Col, {
406
- key: it.value,
407
- span: extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$checkbox = extraInfo.checkbox) === null || _extraInfo$checkbox === void 0 ? void 0 : _extraInfo$checkbox.colSpan
408
- }, /*#__PURE__*/React.createElement(_Checkbox, {
409
- value: it.value
410
- }, it.label));
411
- }))) : /*#__PURE__*/React.createElement(_Radio.Group, {
412
- style: {
413
- width: '100%'
414
- }
415
- }, /*#__PURE__*/React.createElement(_Row, null, (httpOptions && httpOptions.length > 0 ? httpOptions : options).map(function (it) {
416
- var _extraInfo$checkbox2;
417
-
418
- return /*#__PURE__*/React.createElement(_Col, {
419
- key: it.value,
420
- span: extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$checkbox2 = extraInfo.checkbox) === null || _extraInfo$checkbox2 === void 0 ? void 0 : _extraInfo$checkbox2.colSpan
421
- }, /*#__PURE__*/React.createElement(_Radio, {
422
- value: it.value
423
- }, it.label));
424
- })));
425
- } else {
426
- var _extraInfo$disabled3;
427
-
428
- return /*#__PURE__*/React.createElement(_Select, {
429
- mode: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.isMutiple) ? 'multiple' : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.mode,
430
- onSelect: onSelect,
431
- disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
432
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
433
- options: httpOptions && httpOptions.length > 0 ? httpOptions : options,
434
- showSearch: true,
435
- filterOption: function filterOption(input, option) {
436
- var _option$label;
437
-
438
- 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;
439
- },
440
- getPopupContainer: function getPopupContainer(triggerNode) {
441
- return triggerNode.parentNode;
442
- },
443
- allowClear: true
444
- });
445
- }
446
- };
447
-
448
- if (isObj && isRefForm && field) {
449
- var _extraInfo$http4, _extraInfo$http5;
450
-
451
- return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
452
- style: {
453
- flex: 1,
454
- paddingRight: '10px'
455
- },
456
- label: /*#__PURE__*/React.createElement("span", {
457
- style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
458
- color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
459
- } : {}
460
- }, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
461
- labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
462
- flex: "0 0 ".concat(labelSpan * 100 / 24, "%"),
463
- offset: 0
464
- } : undefined,
465
- wrapperCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
466
- flex: "0 0 ".concat((24 - labelSpan) * 100 / 24, "%"),
467
- offset: 0
468
- } : undefined,
469
- name: [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
470
- rules: [{
471
- required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
472
- }],
473
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
474
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
475
- }), processSelectType((_extraInfo$http4 = extraInfo.http) === null || _extraInfo$http4 === void 0 ? void 0 : _extraInfo$http4.isCascader, (_extraInfo$http5 = extraInfo.http) === null || _extraInfo$http5 === void 0 ? void 0 : _extraInfo$http5.isPagination));
476
- }
477
-
478
- return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
479
- key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
480
- initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
481
- style: {
482
- display: "".concat(extraInfo.hidden ? 'none' : '')
483
- },
484
- label: /*#__PURE__*/React.createElement("span", {
485
- style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
486
- color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
487
- } : {}
488
- }, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
489
- labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
490
- flex: "0 0 ".concat(labelSpan * 100 / 24, "%"),
491
- offset: 0
492
- } : undefined,
493
- wrapperCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
494
- flex: "0 0 ".concat((24 - labelSpan) * 100 / 24, "%"),
495
- offset: 0
496
- } : undefined,
497
- name: name,
498
- rules: [{
499
- required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
500
- }],
501
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
502
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
503
- }, processSelectType((_extraInfo$http6 = extraInfo.http) === null || _extraInfo$http6 === void 0 ? void 0 : _extraInfo$http6.isCascader, (_extraInfo$http7 = extraInfo.http) === null || _extraInfo$http7 === void 0 ? void 0 : _extraInfo$http7.isPagination)) : /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
504
- style: {
505
- flex: 1,
506
- paddingRight: '10px'
507
- },
508
- name: [field === null || field === void 0 ? void 0 : field.name],
509
- rules: [{
510
- required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
511
- }],
512
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
513
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
514
- }), processSelectType((_extraInfo$http8 = extraInfo.http) === null || _extraInfo$http8 === void 0 ? void 0 : _extraInfo$http8.isCascader, (_extraInfo$http9 = extraInfo.http) === null || _extraInfo$http9 === void 0 ? void 0 : _extraInfo$http9.isPagination));
515
- }
516
-
517
- export default /*#__PURE__*/React.memo(Index);
@@ -1,115 +0,0 @@
1
- import "antd/es/form/style";
2
- import _Form from "antd/es/form";
3
- import _extends from "@babel/runtime/helpers/esm/extends";
4
- import "antd/es/switch/style";
5
- import _Switch from "antd/es/switch";
6
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
7
-
8
- /*
9
- * @Author: wangxian
10
- * @Date: 2021-09-18 14:15:04
11
- * @LastEditTime: 2023-02-23 19:34:31
12
- */
13
- import React from 'react';
14
- import { MetadataFormContext, MetadataRefContext } from '../interface';
15
- import { useGetExtraInfo } from '../hooks';
16
-
17
- function Index(props) {
18
- var _extraInfo$disabled2, _extraInfo$disabled3;
19
-
20
- var id = props.id,
21
- name = props.name,
22
- isRefForm = props.isRefForm,
23
- disabled = props.disabled,
24
- labelSpan = props.labelSpan,
25
- field = props.field,
26
- isObj = props.isObj;
27
- var formContext = React.useContext(MetadataFormContext) || {};
28
- var formRefContext = React.useContext(MetadataRefContext);
29
- var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
30
-
31
- if (isObj && isRefForm && field) {
32
- var _extraInfo$disabled;
33
-
34
- return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
35
- style: {
36
- flex: 1,
37
- paddingRight: '10px'
38
- },
39
- label: /*#__PURE__*/React.createElement("span", {
40
- style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
41
- color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
42
- } : {}
43
- }, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
44
- labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
45
- span: labelSpan,
46
- offset: 0
47
- } : undefined,
48
- wrapperCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
49
- span: 24 - labelSpan,
50
- offset: 0
51
- } : undefined,
52
- name: [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
53
- valuePropName: "checked",
54
- rules: [{
55
- required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
56
- }],
57
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
58
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
59
- }), /*#__PURE__*/React.createElement(_Switch, {
60
- disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
61
- checkedChildren: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.checkedChildren,
62
- unCheckedChildren: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.unCheckedChildren
63
- }));
64
- }
65
-
66
- return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
67
- label: /*#__PURE__*/React.createElement("span", {
68
- style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
69
- color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
70
- } : {}
71
- }, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
72
- labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
73
- flex: "0 0 ".concat(labelSpan * 100 / 24, "%"),
74
- offset: 0
75
- } : undefined,
76
- wrapperCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
77
- flex: "0 0 ".concat((24 - labelSpan) * 100 / 24, "%"),
78
- offset: 0
79
- } : undefined,
80
- key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
81
- initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
82
- style: {
83
- display: "".concat(extraInfo.hidden ? 'none' : '')
84
- },
85
- name: name,
86
- valuePropName: "checked",
87
- rules: [{
88
- required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
89
- }],
90
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
91
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
92
- }, /*#__PURE__*/React.createElement(_Switch, {
93
- disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
94
- checkedChildren: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.checkedChildren,
95
- unCheckedChildren: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.unCheckedChildren
96
- })) : /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
97
- style: {
98
- flex: 1,
99
- paddingRight: '10px'
100
- },
101
- name: [field === null || field === void 0 ? void 0 : field.name],
102
- valuePropName: "checked",
103
- rules: [{
104
- required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
105
- }],
106
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
107
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
108
- }), /*#__PURE__*/React.createElement(_Switch, {
109
- disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
110
- checkedChildren: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.checkedChildren,
111
- unCheckedChildren: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.unCheckedChildren
112
- }));
113
- }
114
-
115
- export default /*#__PURE__*/React.memo(Index);