ronds-metadata 1.1.24 → 1.1.25

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.
@@ -13,7 +13,7 @@ import Editable from '../../../../comps/Editable';
13
13
  import useObservable from '../../../../framework/rxjs-hooks/useObservable';
14
14
  import { MetadataFormContext } from '../../interface';
15
15
  import { getLabelByProps } from '../../utils';
16
- import { deepClone } from '@/utils';
16
+ import { deepClone } from '../../../../utils';
17
17
 
18
18
  var TableArray = function TableArray(props) {
19
19
  var initValue = props.initValue,
@@ -125,18 +125,18 @@ var TableArray = function TableArray(props) {
125
125
  firstLoadRef.current = false;
126
126
  }
127
127
  }, [initValue, form]);
128
- var processEnumData = React.useCallback(function (data) {
129
- var _data$fields$, _data$fields$$value, _data$fields$$value$e;
128
+ var processEnumData = React.useCallback(function (data, _extraInfo) {
129
+ var _extraInfo$enum;
130
130
 
131
131
  var _options = [];
132
132
 
133
133
  var _enum = deepClone(data.enum || []); // 扩展规则的value
134
134
 
135
135
 
136
- if (data === null || data === void 0 ? void 0 : (_data$fields$ = data.fields[0]) === null || _data$fields$ === void 0 ? void 0 : (_data$fields$$value = _data$fields$.value) === null || _data$fields$$value === void 0 ? void 0 : (_data$fields$$value$e = _data$fields$$value.enum) === null || _data$fields$$value$e === void 0 ? void 0 : _data$fields$$value$e.value) {
137
- var _data$fields$2, _data$fields$2$value, _data$fields$2$value$;
136
+ if (_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$enum = _extraInfo.enum) === null || _extraInfo$enum === void 0 ? void 0 : _extraInfo$enum.value) {
137
+ var _extraInfo$enum2;
138
138
 
139
- _enum = deepClone(data === null || data === void 0 ? void 0 : (_data$fields$2 = data.fields[0]) === null || _data$fields$2 === void 0 ? void 0 : (_data$fields$2$value = _data$fields$2.value) === null || _data$fields$2$value === void 0 ? void 0 : (_data$fields$2$value$ = _data$fields$2$value.enum) === null || _data$fields$2$value$ === void 0 ? void 0 : _data$fields$2$value$.value);
139
+ _enum = deepClone(_extraInfo === null || _extraInfo === void 0 ? void 0 : (_extraInfo$enum2 = _extraInfo.enum) === null || _extraInfo$enum2 === void 0 ? void 0 : _extraInfo$enum2.value);
140
140
  }
141
141
 
142
142
  _enum.forEach(function (it) {
@@ -150,12 +150,21 @@ var TableArray = function TableArray(props) {
150
150
 
151
151
  return _options;
152
152
  }, []);
153
+ var processColumnType = React.useCallback(function (data, _extraInfo) {
154
+ var _extraInfo$text;
155
+
156
+ if (data.type === 'text' && ((_extraInfo$text = _extraInfo.text) === null || _extraInfo$text === void 0 ? void 0 : _extraInfo$text.type)) {
157
+ var _extraInfo$text2;
158
+
159
+ return (_extraInfo$text2 = _extraInfo.text) === null || _extraInfo$text2 === void 0 ? void 0 : _extraInfo$text2.type;
160
+ }
161
+
162
+ return data.type;
163
+ }, []);
153
164
  var processSchemaToColumns = React.useCallback(function (_properties) {
154
165
  var _columns = [];
155
166
 
156
167
  for (var i = 0; i < _properties.length; i++) {
157
- var _extraInfo$text;
158
-
159
168
  var it = _properties[i];
160
169
  var extraInfo = refFieldsRef.current.get(it.id);
161
170
  var obj = {
@@ -164,8 +173,8 @@ var TableArray = function TableArray(props) {
164
173
  dataIndex: it.id,
165
174
  width: 100,
166
175
  editable: true,
167
- type: it.type === 'text' && (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$text = extraInfo.text) === null || _extraInfo$text === void 0 ? void 0 : _extraInfo$text.type) === 'colorPicker' ? 'colorPicker' : it.type,
168
- enum: it.type === 'enum' ? processEnumData(it) : undefined
176
+ type: processColumnType(it, extraInfo),
177
+ enum: it.type === 'enum' ? processEnumData(it, extraInfo) : undefined
169
178
  };
170
179
 
171
180
  _columns.push(obj);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.1.24",
4
+ "version": "1.1.25",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",