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,298 +0,0 @@
1
- import "antd/es/drawer/style";
2
- import _Drawer from "antd/es/drawer";
3
- import "antd/es/button/style";
4
- import _Button from "antd/es/button";
5
- import "antd/es/select/style";
6
- import _Select from "antd/es/select";
7
- import "antd/es/input/style";
8
- import _Input from "antd/es/input";
9
- import "antd/es/message/style";
10
- import _message from "antd/es/message";
11
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
12
- import "antd/es/form/style";
13
- import _Form from "antd/es/form";
14
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
15
- import React from 'react';
16
- import './index.less';
17
- import MetaFieldsEdit from './components/MetaFieldsEdit';
18
- import MetaPropsEdit from './components/MetaPropsEdit';
19
- import { OUTERMOST_TYPES_OPTIONS } from './constant';
20
-
21
- var MetadataEditV2 = function MetadataEditV2(props) {
22
- var initialValues = props.initialValues,
23
- isNameDisabled = props.isNameDisabled,
24
- metadataTag = props.metadataTag,
25
- onFinish = props.onFinish,
26
- onNewRefClick = props.onNewRefClick;
27
-
28
- var _Form$useForm = _Form.useForm(),
29
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
30
- form = _Form$useForm2[0];
31
-
32
- var _React$useState = React.useState('object'),
33
- _React$useState2 = _slicedToArray(_React$useState, 2),
34
- outerType = _React$useState2[0],
35
- setOutType = _React$useState2[1];
36
-
37
- var _React$useState3 = React.useState({
38
- id: '',
39
- type: 'object'
40
- }),
41
- _React$useState4 = _slicedToArray(_React$useState3, 2),
42
- metaSchema = _React$useState4[0],
43
- setMetaSchema = _React$useState4[1];
44
-
45
- var metaSchemaRef = React.useRef({
46
- id: '',
47
- type: 'object'
48
- });
49
- var firstLoadRef = React.useRef(true);
50
-
51
- var _React$useState5 = React.useState(false),
52
- _React$useState6 = _slicedToArray(_React$useState5, 2),
53
- isFields = _React$useState6[0],
54
- setIsFields = _React$useState6[1];
55
-
56
- var _React$useState7 = React.useState({}),
57
- _React$useState8 = _slicedToArray(_React$useState7, 2),
58
- fields = _React$useState8[0],
59
- setFields = _React$useState8[1];
60
-
61
- var _React$useState9 = React.useState({}),
62
- _React$useState10 = _slicedToArray(_React$useState9, 2),
63
- curFields = _React$useState10[0],
64
- setCurFields = _React$useState10[1];
65
-
66
- React.useEffect(function () {
67
- form.setFieldsValue({
68
- id: 'Test'
69
- });
70
- form.setFieldsValue({
71
- type: 'object'
72
- });
73
- }, [form]);
74
- React.useEffect(function () {
75
- if (initialValues && firstLoadRef.current) {
76
- form.setFieldsValue(_objectSpread({}, initialValues));
77
- setMetaSchema(_objectSpread({}, initialValues));
78
- metaSchemaRef.current = initialValues;
79
- processFileds(initialValues);
80
- firstLoadRef.current = false;
81
- }
82
- }, [form, initialValues]);
83
-
84
- var onMyFinish = function onMyFinish(values) {
85
- // console.log('values:', values, JSON.stringify(values));
86
- // console.log('values:', values);
87
- var _metaSchema = metaSchemaRef.current;
88
- _metaSchema.id = values.id;
89
- _metaSchema.type = values.type;
90
-
91
- if (values === null || values === void 0 ? void 0 : values.properties) {
92
- _metaSchema.properties = values.properties;
93
-
94
- var _loop = function _loop(i) {
95
- var ele = _metaSchema.properties[i];
96
- var curFields = fields[_metaSchema.properties[i].id];
97
-
98
- if (curFields) {
99
- _metaSchema.properties[i].fields = curFields;
100
- }
101
-
102
- var propKeys = Object.keys(ele);
103
- var needOptKeys = ['name', 'code', 'desc'];
104
-
105
- if (ele.fields) {
106
- propKeys.forEach(function (propKey) {
107
- if (needOptKeys.indexOf(propKey) > -1) {
108
- ele.fields.forEach(function (field, index) {
109
- if (index === 0) {
110
- if (propKey === 'name') {
111
- field.value[propKey] = ele[propKey];
112
- field.value.label = ele[propKey];
113
- } else {
114
- field.value[propKey] = ele[propKey];
115
- }
116
- }
117
- });
118
- delete ele[propKey];
119
- }
120
- });
121
- } else {
122
- ele.fields = [{
123
- type: 'ref',
124
- refId: 'Rule.Form',
125
- id: 'Rule.Form',
126
- value: {
127
- label: '',
128
- name: '',
129
- code: '',
130
- desc: ''
131
- }
132
- }];
133
- propKeys.forEach(function (propKey) {
134
- if (needOptKeys.indexOf(propKey) > -1) {
135
- ele.fields.forEach(function (field, index) {
136
- if (index === 0) {
137
- if (propKey === 'name') {
138
- field.value[propKey] = ele[propKey];
139
- field.value.label = ele[propKey];
140
- } else {
141
- field.value[propKey] = ele[propKey];
142
- }
143
- }
144
- });
145
- delete ele[propKey];
146
- }
147
- });
148
- }
149
- };
150
-
151
- for (var i = 0; i < _metaSchema.properties.length; i++) {
152
- _loop(i);
153
- }
154
- }
155
-
156
- if (fields[values.id]) {
157
- _metaSchema.fields = fields[values.id];
158
- }
159
-
160
- setMetaSchema(_objectSpread({}, _metaSchema));
161
- metaSchemaRef.current = _metaSchema;
162
- onFinish && onFinish(JSON.stringify(_metaSchema));
163
- };
164
-
165
- var onAddFields = function onAddFields(index) {
166
- if (index === -1) {
167
- var _id = form.getFieldValue('id');
168
-
169
- if (_id) {
170
- setIsFields(true);
171
- setCurFields({
172
- id: _id
173
- });
174
- } else {
175
- _message.warn('请填写元数据名称');
176
- }
177
-
178
- return;
179
- } // console.log('========1========', form.getFieldValue('properties'));
180
-
181
-
182
- var _properties_from = form.getFieldValue('properties') || [];
183
-
184
- var _properties_ref = metaSchemaRef.current.properties || [];
185
-
186
- var _properties = _properties_from.length <= _properties_ref.length ? _properties_ref : _properties_from; // console.log('properties', _properties);
187
-
188
-
189
- var _curFields = _properties[index];
190
-
191
- if (_curFields && _curFields.id) {
192
- setIsFields(true);
193
- var idx = ((metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields) || []).findIndex(function (v) {
194
- return v.id === _curFields.id;
195
- });
196
-
197
- if ((metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields) && idx >= 0) {
198
- setCurFields(_objectSpread({}, metaSchema === null || metaSchema === void 0 ? void 0 : metaSchema.fields[idx]));
199
- } else {
200
- // console.log('_curFields', _curFields);
201
- setCurFields(_objectSpread({}, _curFields));
202
- }
203
- } else {
204
- _message.warn('请填写属性名称');
205
- }
206
- };
207
-
208
- var onFieldsChange = function onFieldsChange(values) {
209
- var _fields = fields;
210
- _fields[curFields.id] = values;
211
- setFields(_objectSpread({}, _fields));
212
- setIsFields(false);
213
- };
214
-
215
- var onOuterTypeChange = function onOuterTypeChange(value) {
216
- setOutType(value);
217
- };
218
-
219
- var processFileds = function processFileds(schema) {
220
- var _properties = schema.properties;
221
- var _fields = fields;
222
-
223
- if (_properties) {
224
- for (var i = 0; i < _properties.length; i++) {
225
- if (_properties[i].fields) {
226
- _fields[_properties[i].id] = _properties[i].fields;
227
- }
228
- }
229
- }
230
-
231
- if (schema.fields) {
232
- _fields[schema.id] = schema.fields;
233
- }
234
-
235
- setFields(_objectSpread({}, _fields));
236
- };
237
-
238
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Form, {
239
- className: "metadata-edit",
240
- initialValues: initialValues,
241
- form: form,
242
- name: "control-hooks",
243
- onFinish: onMyFinish
244
- }, /*#__PURE__*/React.createElement(_Form.Item, {
245
- label: "\u540D\u79F0",
246
- name: "id",
247
- style: {
248
- marginBottom: '15px'
249
- },
250
- rules: [{
251
- required: true
252
- }]
253
- }, /*#__PURE__*/React.createElement(_Input, {
254
- disabled: isNameDisabled
255
- })), /*#__PURE__*/React.createElement(_Form.Item, {
256
- label: "\u7C7B\u578B",
257
- name: "type",
258
- style: {
259
- marginBottom: '15px'
260
- },
261
- rules: [{
262
- required: true
263
- }]
264
- }, /*#__PURE__*/React.createElement(_Select, {
265
- options: OUTERMOST_TYPES_OPTIONS,
266
- onChange: onOuterTypeChange
267
- })), outerType === 'object' && /*#__PURE__*/React.createElement(MetaPropsEdit, {
268
- form: form,
269
- metadataTag: metadataTag,
270
- name: "properties",
271
- onAddFields: onAddFields,
272
- onNewRefClick: onNewRefClick
273
- }), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
274
- type: "primary",
275
- block: true,
276
- htmlType: "submit"
277
- }, "\u786E\u5B9A"))), /*#__PURE__*/React.createElement(_Drawer, {
278
- title: (curFields === null || curFields === void 0 ? void 0 : curFields.id) || 'fields',
279
- width: 450,
280
- bodyStyle: {
281
- padding: 0
282
- },
283
- placement: "right",
284
- onClose: function onClose() {
285
- setIsFields(false);
286
- },
287
- mask: false,
288
- push: false,
289
- visible: isFields,
290
- destroyOnClose: true
291
- }, /*#__PURE__*/React.createElement(MetaFieldsEdit, {
292
- key: curFields === null || curFields === void 0 ? void 0 : curFields.id,
293
- defaultValues: fields[curFields.id],
294
- onChange: onFieldsChange
295
- })));
296
- };
297
-
298
- export default MetadataEditV2;
@@ -1,157 +0,0 @@
1
- import "antd/es/row/style";
2
- import _Row from "antd/es/row";
3
- import "antd/es/form/style";
4
- import _Form from "antd/es/form";
5
- import "antd/es/button/style";
6
- import _Button from "antd/es/button";
7
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
8
- import "antd/es/col/style";
9
- import _Col from "antd/es/col";
10
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
11
-
12
- /*
13
- * @Author: wangxian
14
- * @Date: 2021-09-18 14:15:04
15
- * @LastEditTime: 2023-02-23 15:42:40
16
- */
17
- import React from 'react';
18
- import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
19
- import { MetadataFormContext, MetadataRefContext } from '../interface';
20
- import { useGetExtraInfo } from '../hooks';
21
- import { getDataCell } from '../utils';
22
- import { tr } from '../../../framework/locale';
23
- import TableArray from './layout/TableArray';
24
-
25
- function Index(props) {
26
- var _fieldRule$, _fieldRule$$value, _fieldRule$2, _fieldRule$2$value, _extraInfo$disabled;
27
-
28
- var id = props.id,
29
- items = props.items,
30
- isRefForm = props.isRefForm,
31
- fieldRule = props.fields,
32
- colSpan = props.colSpan,
33
- labelSpan = props.labelSpan,
34
- initEnumValue = props.initEnumValue,
35
- name = props.name,
36
- disabled = props.disabled;
37
- var formContext = React.useContext(MetadataFormContext) || {};
38
- var refContext = React.useContext(MetadataRefContext) || {};
39
-
40
- var _fileds = React.useMemo(function () {
41
- var ff = formContext === null || formContext === void 0 ? void 0 : formContext.fields;
42
-
43
- if (refContext === null || refContext === void 0 ? void 0 : refContext.fields) {
44
- refContext === null || refContext === void 0 ? void 0 : refContext.fields.forEach(function (v, k) {
45
- ff.set(k, v);
46
- });
47
- }
48
-
49
- return ff;
50
- }, [formContext === null || formContext === void 0 ? void 0 : formContext.fields, refContext === null || refContext === void 0 ? void 0 : refContext.fields]);
51
-
52
- var extraInfo = useGetExtraInfo(formContext === null || formContext === void 0 ? void 0 : formContext.fields, id, formContext.form, props.type);
53
-
54
- var _React$useState = React.useState(),
55
- _React$useState2 = _slicedToArray(_React$useState, 2),
56
- help = _React$useState2[0],
57
- setHelp = _React$useState2[1];
58
-
59
- // const myName = React.useMemo(() => {
60
- // let res = [];
61
- // if (name && name.length > 0) {
62
- // res = deepClone(name);
63
- // res.push(id);
64
- // } else {
65
- // return id;
66
- // }
67
- // return res;
68
- // }, [name, id]);
69
- React.useEffect(function () {
70
- if (items && items.refId) {
71
- var arr = items.refId.split('.');
72
- setHelp(arr[arr.length - 1]);
73
- }
74
- }, [items]);
75
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, null, /*#__PURE__*/React.createElement(_Col, {
76
- span: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? labelSpan : 24
77
- }, !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && /*#__PURE__*/React.createElement("div", {
78
- style: {
79
- position: 'relative',
80
- width: '100%',
81
- textAlign: "".concat(labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? 'right' : 'left')
82
- }
83
- }, /*#__PURE__*/React.createElement("div", {
84
- className: "ant-form-item-label ant-form-item-label-wrap mt-1 "
85
- }, /*#__PURE__*/React.createElement("label", {
86
- className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
87
- }, extraInfo.label || fieldRule && ((_fieldRule$ = fieldRule[0]) === null || _fieldRule$ === void 0 ? void 0 : (_fieldRule$$value = _fieldRule$.value) === null || _fieldRule$$value === void 0 ? void 0 : _fieldRule$$value.label) || fieldRule && ((_fieldRule$2 = fieldRule[0]) === null || _fieldRule$2 === void 0 ? void 0 : (_fieldRule$2$value = _fieldRule$2.value) === null || _fieldRule$2$value === void 0 ? void 0 : _fieldRule$2$value.common.label) || id)), formContext.isShowTypeInfo && /*#__PURE__*/React.createElement("div", {
88
- style: {
89
- padding: '0 6px',
90
- position: 'absolute',
91
- right: '20px',
92
- top: '19px',
93
- background: '#fff'
94
- }
95
- }, help || (items === null || items === void 0 ? void 0 : items.type)))), /*#__PURE__*/React.createElement(_Col, {
96
- span: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? 24 - labelSpan : 24
97
- }, extraInfo.layout === 'table' && items.type === 'ref' ? /*#__PURE__*/React.createElement(TableArray, {
98
- initValue: formContext.initialValues,
99
- initEnumValue: initEnumValue,
100
- readonly: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
101
- addButtonHidden: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.addButtonHidden,
102
- rowNumber: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.rowNumber) || 10,
103
- refId: items.refId,
104
- form: formContext.form,
105
- name: name
106
- }) : /*#__PURE__*/React.createElement("div", {
107
- style: {
108
- padding: '10px',
109
- border: '1px solid var(--ronds-metadata-color-border-1)',
110
- width: '100%',
111
- borderRadius: '4px',
112
- margin: '0 0 8px'
113
- }
114
- }, /*#__PURE__*/React.createElement(_Form.List, {
115
- name: name,
116
- key: id
117
- }, function (fields, _ref) {
118
- var add = _ref.add,
119
- remove = _ref.remove;
120
- return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, idx) {
121
- var _extraInfo$disabled2;
122
-
123
- return /*#__PURE__*/React.createElement("div", {
124
- key: field.key,
125
- style: {
126
- display: 'flex',
127
- width: '100%',
128
- marginBottom: '10px'
129
- }
130
- }, /*#__PURE__*/React.createElement(React.Fragment, null, getDataCell(_objectSpread(_objectSpread({}, items), {}, {
131
- idx: idx,
132
- id: id
133
- }), {
134
- disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
135
- initEnumValue: initEnumValue,
136
- isRefForm: isRefForm,
137
- isShowTypeInfo: formContext.isShowTypeInfo,
138
- field: field
139
- }, 23), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
140
- style: {
141
- marginLeft: '10px'
142
- },
143
- onClick: function onClick() {
144
- return remove(field.name);
145
- }
146
- })));
147
- }), /*#__PURE__*/React.createElement(_Form.Item, null, /*#__PURE__*/React.createElement(_Button, {
148
- type: "dashed",
149
- onClick: function onClick() {
150
- return add();
151
- },
152
- icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
153
- }, tr('添加'))));
154
- })))));
155
- }
156
-
157
- export default /*#__PURE__*/React.memo(Index);
@@ -1,197 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import "antd/es/form/style";
3
- import _Form from "antd/es/form";
4
- import "antd/es/select/style";
5
- import _Select from "antd/es/select";
6
- import "antd/es/upload/style";
7
- import _Upload from "antd/es/upload";
8
- import "antd/es/button/style";
9
- import _Button from "antd/es/button";
10
- import "antd/es/date-picker/style";
11
- import _DatePicker from "antd/es/date-picker";
12
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
13
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
14
- import "antd/es/input/style";
15
- import _Input from "antd/es/input";
16
-
17
- /*
18
- * @Author: wangxian
19
- * @Date: 2021-09-18 14:15:04
20
- * @LastEditTime: 2023-02-23 19:32:47
21
- */
22
- import React from 'react';
23
- import { UploadOutlined } from '@ant-design/icons';
24
- import { MetadataFormContext, MetadataRefContext } from '../interface';
25
- import { useGetExtraInfo } from '../hooks';
26
- var TextArea = _Input.TextArea;
27
-
28
- function Index(props) {
29
- var _extraInfo$addonAfter6;
30
-
31
- var id = props.id,
32
- isRefForm = props.isRefForm,
33
- disabled = props.disabled,
34
- field = props.field,
35
- labelSpan = props.labelSpan,
36
- name = props.name,
37
- isObj = props.isObj;
38
- var formContext = React.useContext(MetadataFormContext) || {};
39
- var formRefContext = React.useContext(MetadataRefContext);
40
- var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
41
-
42
- var _React$useState = React.useState([]),
43
- _React$useState2 = _slicedToArray(_React$useState, 2),
44
- rules = _React$useState2[0],
45
- setRules = _React$useState2[1];
46
-
47
- React.useEffect(function () {
48
- var _rules = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.rules;
49
-
50
- if (_rules) {
51
- var _ = _rules.map(function (it) {
52
- return {
53
- pattern: new RegExp(eval(it === null || it === void 0 ? void 0 : it.regExp), 'g'),
54
- message: it === null || it === void 0 ? void 0 : it.message
55
- };
56
- });
57
-
58
- setRules(_toConsumableArray(_));
59
- }
60
- }, [extraInfo]);
61
-
62
- var onChange = function onChange(e) {};
63
-
64
- var processInputType = function processInputType(_type) {
65
- var _extraInfo$disabled, _extraInfo$disabled2, _extraInfo$disabled3, _extraInfo$disabled4, _extraInfo$addonAfter, _extraInfo$addonAfter2, _extraInfo$addonAfter3, _extraInfo$addonAfter4, _extraInfo$disabled5;
66
-
67
- switch (_type) {
68
- case 'password':
69
- return /*#__PURE__*/React.createElement(_Input.Password, {
70
- disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
71
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
72
- });
73
-
74
- case 'textarea':
75
- return /*#__PURE__*/React.createElement(TextArea, {
76
- rows: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.textareaRows) || 4,
77
- disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
78
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
79
- });
80
-
81
- case 'colorPicker':
82
- return /*#__PURE__*/React.createElement(_Input, {
83
- type: "color",
84
- disabled: (_extraInfo$disabled3 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled3 !== void 0 ? _extraInfo$disabled3 : disabled,
85
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
86
- });
87
-
88
- case 'datePicker':
89
- return /*#__PURE__*/React.createElement(_DatePicker, {
90
- showTime: true,
91
- format: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.format) || DEFAULT_DATE_FORMAT,
92
- disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
93
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
94
- });
95
-
96
- case 'upload':
97
- return /*#__PURE__*/React.createElement(_Upload, {
98
- name: "logo"
99
- }, /*#__PURE__*/React.createElement(_Button, {
100
- icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
101
- }, "\u4E0A\u4F20"));
102
-
103
- default:
104
- return /*#__PURE__*/React.createElement(_Input, {
105
- addonAfter: ((_extraInfo$addonAfter = extraInfo.addonAfter) === null || _extraInfo$addonAfter === void 0 ? void 0 : _extraInfo$addonAfter.key) ? /*#__PURE__*/React.createElement(_Form.Item, {
106
- name: [].concat(_toConsumableArray(name), [(_extraInfo$addonAfter2 = extraInfo.addonAfter) === null || _extraInfo$addonAfter2 === void 0 ? void 0 : _extraInfo$addonAfter2.key]),
107
- noStyle: true,
108
- initialValue: (_extraInfo$addonAfter3 = extraInfo.addonAfter) === null || _extraInfo$addonAfter3 === void 0 ? void 0 : _extraInfo$addonAfter3.defaultValue
109
- }, /*#__PURE__*/React.createElement(_Select, null, (((_extraInfo$addonAfter4 = extraInfo.addonAfter) === null || _extraInfo$addonAfter4 === void 0 ? void 0 : _extraInfo$addonAfter4.value) || []).map(function (v) {
110
- return /*#__PURE__*/React.createElement(_Select.Option, {
111
- key: v,
112
- value: v
113
- }, v);
114
- }))) : undefined,
115
- disabled: (_extraInfo$disabled5 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled5 !== void 0 ? _extraInfo$disabled5 : disabled,
116
- placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
117
- allowClear: true,
118
- onChange: onChange
119
- });
120
- }
121
- }; // ref引用的 应用类型是否展示成表单
122
-
123
-
124
- if (isObj && isRefForm && field) {
125
- var _extraInfo$addonAfter5;
126
-
127
- return /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
128
- style: {
129
- flex: 1,
130
- paddingRight: '10px'
131
- },
132
- label: /*#__PURE__*/React.createElement("span", {
133
- style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
134
- color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
135
- } : {}
136
- }, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
137
- labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
138
- flex: "0 0 ".concat(labelSpan * 100 / 24, "%"),
139
- offset: 0
140
- } : undefined,
141
- wrapperCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
142
- flex: "0 0 ".concat((24 - labelSpan) * 100 / 24, "%"),
143
- offset: 0
144
- } : undefined,
145
- name: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$addonAfter5 = extraInfo.addonAfter) === null || _extraInfo$addonAfter5 === void 0 ? void 0 : _extraInfo$addonAfter5.key) ? [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name), ['value']) : [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
146
- rules: [{
147
- required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
148
- }].concat(_toConsumableArray(rules)),
149
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
150
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
151
- }), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
152
- }
153
-
154
- return !field ?
155
- /*#__PURE__*/
156
- // 不是引用的
157
- React.createElement(_Form.Item, {
158
- key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
159
- initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
160
- style: {
161
- display: "".concat(extraInfo.hidden ? 'none' : '')
162
- },
163
- label: /*#__PURE__*/React.createElement("span", {
164
- style: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color) ? {
165
- color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
166
- } : {}
167
- }, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
168
- labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
169
- flex: "0 0 ".concat(labelSpan * 100 / 24, "%"),
170
- offset: 0
171
- } : undefined,
172
- wrapperCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
173
- flex: "0 0 ".concat((24 - labelSpan) * 100 / 24, "%"),
174
- offset: 0
175
- } : undefined,
176
- name: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$addonAfter6 = extraInfo.addonAfter) === null || _extraInfo$addonAfter6 === void 0 ? void 0 : _extraInfo$addonAfter6.key) ? [].concat(_toConsumableArray(name), ['value']) : name,
177
- rules: [{
178
- required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
179
- }].concat(_toConsumableArray(rules)),
180
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
181
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
182
- }, processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || '')) : /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
183
- style: {
184
- flex: 1,
185
- paddingRight: '10px'
186
- },
187
- name: [field === null || field === void 0 ? void 0 : field.name],
188
- rules: [{
189
- required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
190
- }].concat(_toConsumableArray(rules)),
191
- help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
192
- tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
193
- }), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
194
- }
195
-
196
- export default /*#__PURE__*/React.memo(Index);
197
- export var DEFAULT_DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss';