@byteluck-fe/model-driven-engine 2.3.13 → 2.3.16

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.
@@ -17,11 +17,25 @@ function _createClass(Constructor, protoProps, staticProps) {
17
17
  if (staticProps) _defineProperties(Constructor, staticProps);
18
18
  return Constructor;
19
19
  }
20
- import { log } from '@byteluck-fe/model-driven-shared';
20
+ function _defineProperty(obj, key, value) {
21
+ if (key in obj) {
22
+ Object.defineProperty(obj, key, {
23
+ value: value,
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true
27
+ });
28
+ } else {
29
+ obj[key] = value;
30
+ }
31
+ return obj;
32
+ }
33
+ import { log } from "@byteluck-fe/model-driven-shared";
21
34
  var OkWorker = /*#__PURE__*/ function() {
22
35
  "use strict";
23
36
  function OkWorker() {
24
37
  _classCallCheck(this, OkWorker);
38
+ _defineProperty(this, "worker", void 0);
25
39
  }
26
40
  _createClass(OkWorker, [
27
41
  {
@@ -29,7 +43,7 @@ var OkWorker = /*#__PURE__*/ function() {
29
43
  value: function run(initState) {
30
44
  this.worker = OkWorker.createWorker();
31
45
  this.postMessage({
32
- action: 'init',
46
+ action: "init",
33
47
  payload: initState
34
48
  });
35
49
  }
@@ -37,15 +51,15 @@ var OkWorker = /*#__PURE__*/ function() {
37
51
  {
38
52
  key: "destroy",
39
53
  value: function destroy() {
40
- var ref;
41
- (ref = this.worker) === null || ref === void 0 ? void 0 : ref.terminate();
54
+ var _this_worker;
55
+ (_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.terminate();
42
56
  }
43
57
  },
44
58
  {
45
59
  key: "postMessage",
46
60
  value: function postMessage(message) {
47
- var ref;
48
- (ref = this.worker) === null || ref === void 0 ? void 0 : ref.postMessage(message);
61
+ var _this_worker;
62
+ (_this_worker = this.worker) === null || _this_worker === void 0 ? void 0 : _this_worker.postMessage(message);
49
63
  }
50
64
  }
51
65
  ], [
@@ -71,7 +85,7 @@ var OkWorker = /*#__PURE__*/ function() {
71
85
  set: function set(target, key, value) {
72
86
  if (parentKey) {
73
87
  _self.postMessage({
74
- action: 'update',
88
+ action: "update",
75
89
  key: "".concat(parentKey, ".").concat(key)
76
90
  });
77
91
  }
@@ -79,7 +93,7 @@ var OkWorker = /*#__PURE__*/ function() {
79
93
  }
80
94
  };
81
95
  };
82
- log('‍🚀 worker running');
96
+ log("‍\uD83D\uDE80 worker running");
83
97
  var _self = self;
84
98
  // function createProxy(
85
99
  // obj: Record<string, unknown> | Array<Record<string, unknown>>,
@@ -92,8 +106,8 @@ var OkWorker = /*#__PURE__*/ function() {
92
106
  // }
93
107
  // return new Proxy(obj, createHandler(parentKey))
94
108
  // }
95
- _self.addEventListener('message', function(event) {
96
- var _data = event.data, action = _data.action, payload = _data.payload, fn = _data.fn;
109
+ _self.addEventListener("message", function(event) {
110
+ var _event_data = event.data, action = _event_data.action, payload = _event_data.payload, fn = _event_data.fn;
97
111
  log(action, payload);
98
112
  // 通过proxy进行代理,每次修改的时候,自动向外抛出postMessage
99
113
  // data.key1 = 1
@@ -104,10 +118,10 @@ var OkWorker = /*#__PURE__*/ function() {
104
118
  //
105
119
  // const result = fn(data, schema)
106
120
  _self.postMessage({
107
- action: 'delete',
121
+ action: "delete",
108
122
  payload: {
109
- key: 'key3[0].key1',
110
- value: 'index'
123
+ key: "key3[0].key1",
124
+ value: "index"
111
125
  }
112
126
  });
113
127
  });
@@ -23,6 +23,19 @@ function _createClass(Constructor, protoProps, staticProps) {
23
23
  if (staticProps) _defineProperties(Constructor, staticProps);
24
24
  return Constructor;
25
25
  }
26
+ function _defineProperty(obj, key, value) {
27
+ if (key in obj) {
28
+ Object.defineProperty(obj, key, {
29
+ value: value,
30
+ enumerable: true,
31
+ configurable: true,
32
+ writable: true
33
+ });
34
+ } else {
35
+ obj[key] = value;
36
+ }
37
+ return obj;
38
+ }
26
39
  function _getPrototypeOf(o) {
27
40
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
28
41
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -83,19 +96,21 @@ function _createSuper(Derived) {
83
96
  return _possibleConstructorReturn(this, result);
84
97
  };
85
98
  }
86
- import { RegisterControls } from '@byteluck-fe/model-driven-core';
87
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, loopFormSchema } from '@byteluck-fe/model-driven-shared';
88
- import { hasChildrenControl, loopDataViewControl, loopFormControl } from '../utils/runtimeUtils';
89
- export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
99
+ import { RegisterControls } from "@byteluck-fe/model-driven-core";
100
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, loopFormSchema } from "@byteluck-fe/model-driven-shared";
101
+ import { hasChildrenControl, loopDataViewControl, loopFormControl } from "../utils/runtimeUtils";
102
+ export var Runtime = /*#__PURE__*/ function(RegisterControls) {
90
103
  "use strict";
91
- _inherits(Runtime, RegisterControls1);
104
+ _inherits(Runtime, RegisterControls);
92
105
  var _super = _createSuper(Runtime);
93
106
  function Runtime(props) {
94
107
  _classCallCheck(this, Runtime);
95
108
  var _this;
96
- _this = _super.call(this, 'Runtime');
97
- _this._flatInstances = [];
98
- _this._instanceMap = {};
109
+ _this = _super.call(this, "Runtime");
110
+ _defineProperty(_assertThisInitialized(_this), "_schema", void 0);
111
+ _defineProperty(_assertThisInitialized(_this), "_instance", void 0);
112
+ _defineProperty(_assertThisInitialized(_this), "_flatInstances", []);
113
+ _defineProperty(_assertThisInitialized(_this), "_instanceMap", {});
99
114
  var schema = props.schema;
100
115
  _this._schema = schema;
101
116
  _this._instance = _this.createControl(schema, props.beforeCreateInstance);
@@ -110,7 +125,7 @@ export var Runtime = /*#__PURE__*/ function(RegisterControls1) {
110
125
  var instanceMap = {};
111
126
  loop(this._instance, function(item) {
112
127
  // 3.4.1 避免将subtable-row 放到 _flatInstances 中
113
- if (item.type === 'subtable-row' || item.type === 'subtable-column') {
128
+ if (item.type === "subtable-row" || item.type === "subtable-column") {
114
129
  return;
115
130
  }
116
131
  instances.push(item);
@@ -249,7 +264,7 @@ item) {
249
264
  } else if (item.type === CONTROL_TYPE.SUBTABLE) {
250
265
  data[item.id] = item.rules;
251
266
  var itemRules = {
252
- type: 'array',
267
+ type: "array",
253
268
  fields: {}
254
269
  };
255
270
  item.children.forEach(function(row, index) {
@@ -257,7 +272,7 @@ item) {
257
272
  if (itemRules.fields) {
258
273
  if (!itemRules.fields[index]) {
259
274
  itemRules.fields[index] = {
260
- type: 'object',
275
+ type: "object",
261
276
  required: true,
262
277
  fields: {}
263
278
  };
@@ -32,19 +32,24 @@ function _defineProperty(obj, key, value) {
32
32
  }
33
33
  function _instanceof(left, right) {
34
34
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
35
- return right[Symbol.hasInstance](left);
35
+ return !!right[Symbol.hasInstance](left);
36
36
  } else {
37
37
  return left instanceof right;
38
38
  }
39
39
  }
40
- import { DataBind, ObjectDataBind } from '@byteluck-fe/model-driven-core';
41
- import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from '@byteluck-fe/model-driven-shared';
42
- import { loopDataViewControl, loopFormControl, buildUUID } from '../utils/runtimeUtils';
40
+ import { DataBind, ObjectDataBind } from "@byteluck-fe/model-driven-core";
41
+ import { loopFormSchema, JSONCopy, warn, CONTROL_TYPE, CONTROL_BASE_TYPE } from "@byteluck-fe/model-driven-shared";
42
+ import { loopDataViewControl, loopFormControl, buildUUID } from "../utils/runtimeUtils";
43
43
  var Store = /*#__PURE__*/ function() {
44
44
  "use strict";
45
45
  function Store(props) {
46
46
  _classCallCheck(this, Store);
47
- var ref = init(props.instance), state = ref.state, emptyState = ref.emptyState, databindMapping = ref.databindMapping, controlidMapping = ref.controlidMapping;
47
+ _defineProperty(this, "emptyState", void 0);
48
+ _defineProperty(this, "state", void 0);
49
+ _defineProperty(this, "dataBindMapping", void 0 // 主要提供给二开使用
50
+ );
51
+ _defineProperty(this, "controlIdMapping", void 0);
52
+ var _init = init(props.instance), state = _init.state, emptyState = _init.emptyState, databindMapping = _init.databindMapping, controlidMapping = _init.controlidMapping;
48
53
  this.emptyState = emptyState;
49
54
  this.state = state;
50
55
  this.dataBindMapping = databindMapping;
@@ -58,6 +63,7 @@ var Store = /*#__PURE__*/ function() {
58
63
  * @param value
59
64
  */ key: "setState",
60
65
  value: function setState(controlId, value, rowIndex) {
66
+ var _this = this;
61
67
  var controlInfo = this.controlIdMapping[controlId];
62
68
  if (controlInfo !== undefined) {
63
69
  //qiyu 按照对象赋值,Object.assign会触发多次key的change事件
@@ -72,16 +78,14 @@ var Store = /*#__PURE__*/ function() {
72
78
  // }
73
79
  } else {
74
80
  if (rowIndex !== undefined) {
75
- var _this = this;
76
81
  //TODO 目前只找了一层明细表,没有递归 如果是添加uid
77
82
  Object.keys(this.controlIdMapping).map(function(subtableId) {
78
83
  var dataView = _this.controlIdMapping[subtableId].dataView;
79
84
  var children = _this.controlIdMapping[subtableId].children;
80
85
  if (children !== undefined) {
81
- var _this1 = _this;
82
86
  Object.keys(children).map(function(childControlId) {
83
87
  if (childControlId === controlId) {
84
- _this1.state[dataView][subtableId][rowIndex][controlId] = value;
88
+ _this.state[dataView][subtableId][rowIndex][controlId] = value;
85
89
  }
86
90
  });
87
91
  }
@@ -96,6 +100,7 @@ var Store = /*#__PURE__*/ function() {
96
100
  {
97
101
  key: "getState",
98
102
  value: function getState(controlId, rowIndex) {
103
+ var _this = this;
99
104
  //qiyu 由于header的数据是后补充的,所以从state获取第一层值。
100
105
  // const controlInfo = this.controlIdMapping[controlId]
101
106
  var detection = this.state[controlId];
@@ -107,31 +112,27 @@ var Store = /*#__PURE__*/ function() {
107
112
  return this.state[controlInfo.dataView][controlId];
108
113
  } else {
109
114
  if (rowIndex !== undefined) {
110
- var _this = this;
111
115
  var state;
112
116
  //TODO 目前只找了一层明细表,没有递归
113
117
  Object.keys(this.controlIdMapping).map(function(subtableId) {
114
118
  var dataViewId = _this.controlIdMapping[subtableId].dataView;
115
119
  var children = _this.controlIdMapping[subtableId].children;
116
120
  if (children !== undefined) {
117
- var _this3 = _this;
118
121
  Object.keys(children).map(function(childControlId) {
119
122
  if (childControlId === controlId) {
120
- var ref;
121
- state = (ref = _this3.state[dataViewId][subtableId][rowIndex]) === null || ref === void 0 ? void 0 : ref[controlId];
123
+ var _this_state_dataViewId_subtableId_rowIndex;
124
+ state = (_this_state_dataViewId_subtableId_rowIndex = _this.state[dataViewId][subtableId][rowIndex]) === null || _this_state_dataViewId_subtableId_rowIndex === void 0 ? void 0 : _this_state_dataViewId_subtableId_rowIndex[controlId];
122
125
  }
123
126
  });
124
127
  }
125
128
  });
126
129
  return state;
127
130
  } else {
128
- var _this2 = this;
129
131
  var states = [];
130
132
  Object.keys(this.controlIdMapping).map(function(subtableId) {
131
- var dataViewId = _this2.controlIdMapping[subtableId].dataView;
132
- var children = _this2.controlIdMapping[subtableId].children;
133
+ var dataViewId = _this.controlIdMapping[subtableId].dataView;
134
+ var children = _this.controlIdMapping[subtableId].children;
133
135
  if (children !== undefined) {
134
- var _this = _this2;
135
136
  Object.keys(children).map(function(childControlId) {
136
137
  if (childControlId === controlId) {
137
138
  _this.state[dataViewId][subtableId].map(function(item) {
@@ -150,6 +151,7 @@ var Store = /*#__PURE__*/ function() {
150
151
  {
151
152
  key: "getEmptyState",
152
153
  value: function getEmptyState(controlId) {
154
+ var _this = this;
153
155
  var detection = this.emptyState[controlId];
154
156
  if (detection !== undefined) {
155
157
  return this.emptyState[controlId];
@@ -158,24 +160,22 @@ var Store = /*#__PURE__*/ function() {
158
160
  if (controlInfo !== undefined) {
159
161
  var state = this.emptyState[controlInfo.dataView][controlId];
160
162
  //判断找到的是否是明细表的控件
161
- if ('children' in controlInfo) {
163
+ if ("children" in controlInfo) {
162
164
  Object.assign(state, {
163
- uid: 'new:' + buildUUID('uid')
165
+ uid: "new:" + buildUUID("uid")
164
166
  });
165
167
  }
166
168
  return state;
167
169
  } else {
168
- var _this = this;
169
170
  var state1;
170
171
  //TODO 目前只找了一层明细表,没有递归
171
172
  Object.keys(this.controlIdMapping).map(function(subtableId) {
172
173
  var dataViewId = _this.controlIdMapping[subtableId].dataView;
173
174
  var children = _this.controlIdMapping[subtableId].children;
174
175
  if (children !== undefined) {
175
- var _this4 = _this;
176
176
  Object.keys(children).map(function(childControlId) {
177
177
  if (childControlId === controlId) {
178
- state1 = _this4.emptyState[dataViewId][subtableId][controlId];
178
+ state1 = _this.emptyState[dataViewId][subtableId][controlId];
179
179
  }
180
180
  });
181
181
  }
@@ -251,34 +251,34 @@ item) {
251
251
  loopFormSchema(item.props.headers, function(headerItem) {
252
252
  emptyTemplate[headerItem.id] = JSONCopy(headerItem.props.defaultValue);
253
253
  });
254
- var _defaultRows;
255
- dataViewState[item.id] = new Array((_defaultRows = item.props.defaultRows) !== null && _defaultRows !== void 0 ? _defaultRows : 1).fill(0).map(function() {
254
+ var _item_props_defaultRows;
255
+ dataViewState[item.id] = new Array((_item_props_defaultRows = item.props.defaultRows) !== null && _item_props_defaultRows !== void 0 ? _item_props_defaultRows : 1).fill(0).map(function() {
256
256
  return JSONCopy(emptyTemplate);
257
257
  });
258
258
  emptyDataViewState[item.id] = emptyTemplate;
259
259
  }
260
260
  }
261
261
  function buildDataBindMapping(data, dataViewId, // @ts-ignore
262
- item1) {
262
+ item) {
263
263
  // if (item instanceof RuntimeFormControl) {
264
- if (item1.controlType === CONTROL_BASE_TYPE.FORM) {
265
- var ref, ref1;
266
- if (_instanceof(item1.props.dataBind, ObjectDataBind)) {
264
+ if (item.controlType === CONTROL_BASE_TYPE.FORM) {
265
+ var _item_props, _item_props_dataBind;
266
+ if (_instanceof(item.props.dataBind, ObjectDataBind)) {
267
267
  // 特殊的dataBind,比如:金额是currency+amount两个key组成的,日期区间,继承自ObjectDataBind的需要通过Object.keys拿到多个databind
268
- Object.keys(item1.props.dataBind).map(function(key) {
269
- var dataBind = item1.props.dataBind;
268
+ Object.keys(item.props.dataBind).map(function(key) {
269
+ var dataBind = item.props.dataBind;
270
270
  var dataCode = dataBind[key].dataCode;
271
271
  if (dataCode !== undefined) {
272
272
  if (data[dataCode] === undefined) {
273
273
  data[dataCode] = {
274
- controlId: item1.id,
274
+ controlId: item.id,
275
275
  fields: [],
276
276
  dataViewId: dataViewId
277
277
  };
278
278
  }
279
279
  data[dataCode].fields.push({
280
280
  fieldCode: dataBind[key].fieldCode,
281
- controlId: item1.id,
281
+ controlId: item.id,
282
282
  dataBind: dataBind,
283
283
  dataViewId: [
284
284
  dataViewId
@@ -286,38 +286,38 @@ item1) {
286
286
  });
287
287
  }
288
288
  });
289
- } else if (((ref = item1.props) === null || ref === void 0 ? void 0 : (ref1 = ref.dataBind) === null || ref1 === void 0 ? void 0 : ref1.dataCode) === undefined) {
289
+ } else if (((_item_props = item.props) === null || _item_props === void 0 ? void 0 : (_item_props_dataBind = _item_props.dataBind) === null || _item_props_dataBind === void 0 ? void 0 : _item_props_dataBind.dataCode) === undefined) {
290
290
  //qiyu 2023-2-27 为空跳过。form自定义组件加载失败时,hack的组件props为空。
291
291
  } else {
292
- if (data[item1.props.dataBind.dataCode] === undefined) {
293
- data[item1.props.dataBind.dataCode] = {
292
+ if (data[item.props.dataBind.dataCode] === undefined) {
293
+ data[item.props.dataBind.dataCode] = {
294
294
  controlId: dataViewId,
295
295
  fields: [],
296
296
  dataViewId: dataViewId
297
297
  };
298
298
  }
299
- data[item1.props.dataBind.dataCode].fields.push({
300
- fieldCode: item1.props.dataBind.fieldCode,
301
- controlId: item1.id,
302
- dataBind: item1.props.dataBind,
299
+ data[item.props.dataBind.dataCode].fields.push({
300
+ fieldCode: item.props.dataBind.fieldCode,
301
+ controlId: item.id,
302
+ dataBind: item.props.dataBind,
303
303
  dataViewId: [
304
304
  dataViewId
305
305
  ]
306
306
  });
307
307
  }
308
308
  } else {
309
- if (item1.props.datasourceBind.dataCode === '') {
309
+ if (item.props.datasourceBind.dataCode === "") {
310
310
  //敏捷依赖后端生成dataCode,预览的时候没有
311
- warn("datasourceBind.dataCode is empty! maybe in preview mode, control:".concat(item1.id, " type:").concat(item1.type));
311
+ warn("datasourceBind.dataCode is empty! maybe in preview mode, control:".concat(item.id, " type:").concat(item.type));
312
312
  return;
313
313
  }
314
- data[item1.props.datasourceBind.dataCode] = {
315
- controlId: item1.id,
314
+ data[item.props.datasourceBind.dataCode] = {
315
+ controlId: item.id,
316
316
  fields: [],
317
317
  dataViewId: dataViewId
318
318
  };
319
- var subtableId = item1.id;
320
- loopFormSchema(item1.props.headers, function(item) {
319
+ var subtableId = item.id;
320
+ loopFormSchema(item.props.headers, function(item) {
321
321
  if (_instanceof(item.props.dataBind, ObjectDataBind)) {
322
322
  Object.keys(item.props.dataBind).map(function(key) {
323
323
  var dataBind = item.props.dataBind;
@@ -359,16 +359,16 @@ item) {
359
359
  data[item.id] = {
360
360
  dataBind: new DataBind({
361
361
  dataCode: item.props.datasourceBind.dataCode,
362
- fieldCode: ''
362
+ fieldCode: ""
363
363
  }),
364
364
  dataView: dataViewId,
365
365
  children: {},
366
366
  options: []
367
367
  };
368
368
  loopFormSchema(item.props.headers, function(formControl) {
369
- var ref;
370
- var ref2;
371
- Object.assign((ref2 = (ref = data[item.id]) === null || ref === void 0 ? void 0 : ref.children) !== null && ref2 !== void 0 ? ref2 : {}, _defineProperty({}, formControl.id, {
369
+ var _data_item_id;
370
+ var _data_item_id_children;
371
+ Object.assign((_data_item_id_children = (_data_item_id = data[item.id]) === null || _data_item_id === void 0 ? void 0 : _data_item_id.children) !== null && _data_item_id_children !== void 0 ? _data_item_id_children : {}, _defineProperty({}, formControl.id, {
372
372
  dataBind: formControl.props.dataBind
373
373
  }));
374
374
  });
@@ -65,7 +65,7 @@ function _inherits(subClass, superClass) {
65
65
  }
66
66
  function _instanceof(left, right) {
67
67
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
68
- return right[Symbol.hasInstance](left);
68
+ return !!right[Symbol.hasInstance](left);
69
69
  } else {
70
70
  return left instanceof right;
71
71
  }
@@ -164,9 +164,9 @@ function _createSuper(Derived) {
164
164
  return _possibleConstructorReturn(this, result);
165
165
  };
166
166
  }
167
- import { isArray, isFunction, isString, isJSONArray, isJSONObject, isNumber, isNumberAndEmptyStringArray, isPlainObject, isStringArray, FieldTypes, isObject } from '@byteluck-fe/model-driven-shared';
168
- import { AddressValue, AmountValue, CalcValue, RangeDateValue } from '@byteluck-fe/model-driven-core';
169
- import { camelizeKeys } from 'humps';
167
+ import { isArray, isFunction, isString, isJSONArray, isJSONObject, isNumber, isNumberAndEmptyStringArray, isPlainObject, isStringArray, FieldTypes, isObject } from "@byteluck-fe/model-driven-shared";
168
+ import { AddressValue, AmountValue, CalcValue, RangeDateValue } from "@byteluck-fe/model-driven-core";
169
+ import { camelizeKeys } from "humps";
170
170
  var ValueChecker = function ValueChecker() {
171
171
  "use strict";
172
172
  _classCallCheck(this, ValueChecker);
@@ -190,7 +190,7 @@ var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
190
190
  key: "transform",
191
191
  value: function transform(value) {
192
192
  if (value === null || value === undefined) {
193
- return '';
193
+ return "";
194
194
  }
195
195
  if (!isPlainObject(value) && !isFunction(value)) {
196
196
  return String(value);
@@ -217,14 +217,14 @@ var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
217
217
  // 数字类型允许是空字符串,用于置空数据
218
218
  key: "validate",
219
219
  value: function validate(value) {
220
- return isNumber(value) || value === '';
220
+ return isNumber(value) || value === "";
221
221
  }
222
222
  },
223
223
  {
224
224
  key: "transform",
225
225
  value: function transform(value) {
226
226
  if (value === null || value === undefined) {
227
- return '';
227
+ return "";
228
228
  }
229
229
  var newValue = !isPlainObject(value) && !isFunction(value) ? Number(value) : undefined;
230
230
  if (!Number.isNaN(newValue) && newValue !== undefined) {
@@ -253,28 +253,28 @@ var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
253
253
  },
254
254
  {
255
255
  key: "transform",
256
- value: function transform(value1) {
256
+ value: function transform(value) {
257
257
  var getStringValueArray = function getStringValueArray(value) {
258
258
  return value.map(function(item) {
259
- return !item ? '' : String(item);
259
+ return !item ? "" : String(item);
260
260
  });
261
261
  };
262
- if (value1 === undefined || value1 === null) {
262
+ if (value === undefined || value === null) {
263
263
  return [];
264
264
  }
265
- if (isArray(value1)) {
266
- return getStringValueArray(value1);
265
+ if (isArray(value)) {
266
+ return getStringValueArray(value);
267
267
  }
268
- if (isString(value1) && isJSONArray(value1)) {
268
+ if (isString(value) && isJSONArray(value)) {
269
269
  try {
270
- var newValue = JSON.parse(value1);
270
+ var newValue = JSON.parse(value);
271
271
  if (Array.isArray(newValue)) {
272
272
  return getStringValueArray(newValue);
273
273
  }
274
274
  } catch (e) {}
275
275
  }
276
276
  return [
277
- String(value1)
277
+ String(value)
278
278
  ];
279
279
  }
280
280
  }
@@ -298,31 +298,31 @@ var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
298
298
  },
299
299
  {
300
300
  key: "transform",
301
- value: function transform(value2) {
301
+ value: function transform(value) {
302
302
  var getNumberValueArray = function getNumberValueArray(value) {
303
303
  return value.map(function(item) {
304
- return !item && item !== 0 ? '' : Number(item);
304
+ return !item && item !== 0 ? "" : Number(item);
305
305
  }).filter(function(item) {
306
- return item === '' || !Number.isNaN(item);
306
+ return item === "" || !Number.isNaN(item);
307
307
  });
308
308
  };
309
- if (value2 === undefined || value2 === null) {
309
+ if (value === undefined || value === null) {
310
310
  return [];
311
311
  }
312
- if (isArray(value2)) {
313
- return getNumberValueArray(value2);
312
+ if (isArray(value)) {
313
+ return getNumberValueArray(value);
314
314
  }
315
- if (isString(value2) && isJSONArray(value2)) {
315
+ if (isString(value) && isJSONArray(value)) {
316
316
  try {
317
- var newValue = JSON.parse(value2);
317
+ var newValue = JSON.parse(value);
318
318
  if (isArray(newValue)) {
319
319
  return getNumberValueArray(newValue);
320
320
  }
321
321
  } catch (e) {}
322
322
  }
323
- var newValue1 = Number(value2);
323
+ var newValue1 = Number(value);
324
324
  if (Number.isNaN(newValue1)) {
325
- throw "".concat(value2, " is not a number array");
325
+ throw "".concat(value, " is not a number array");
326
326
  }
327
327
  return [
328
328
  newValue1
@@ -344,13 +344,13 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
344
344
  {
345
345
  key: "validate",
346
346
  value: function validate(value) {
347
- return _instanceof(value, AmountValue) || isPlainObject(value) && 'amount' in value && isNumber(value.amount) && 'currency' in value && isString(value.currency);
347
+ return _instanceof(value, AmountValue) || isPlainObject(value) && "amount" in value && isNumber(value.amount) && "currency" in value && isString(value.currency);
348
348
  }
349
349
  },
350
350
  {
351
351
  key: "transform",
352
352
  value: function transform(value, oldValue) {
353
- if (value === undefined || value === null || value === '') {
353
+ if (value === undefined || value === null || value === "") {
354
354
  return new AmountValue({
355
355
  currency: oldValue === null || oldValue === void 0 ? void 0 : oldValue.currency
356
356
  });
@@ -394,13 +394,13 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
394
394
  {
395
395
  key: "validate",
396
396
  value: function validate(value) {
397
- return _instanceof(value, RangeDateValue) || isPlainObject(value) && 'min' in value && isString(value.min) && 'max' in value && isString(value.max);
397
+ return _instanceof(value, RangeDateValue) || isPlainObject(value) && "min" in value && isString(value.min) && "max" in value && isString(value.max);
398
398
  }
399
399
  },
400
400
  {
401
401
  key: "transform",
402
402
  value: function transform(value, oldValue) {
403
- if (value === undefined || value === null || value === '') {
403
+ if (value === undefined || value === null || value === "") {
404
404
  return new RangeDateValue();
405
405
  }
406
406
  var result;
@@ -441,13 +441,13 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
441
441
  {
442
442
  key: "validate",
443
443
  value: function validate(value) {
444
- return _instanceof(value, CalcValue) || isPlainObject(value) && 'result' in value && isNumber(value.result) && 'unit' in value && isString(value.unit);
444
+ return _instanceof(value, CalcValue) || isPlainObject(value) && "result" in value && isNumber(value.result) && "unit" in value && isString(value.unit);
445
445
  }
446
446
  },
447
447
  {
448
448
  key: "transform",
449
449
  value: function transform(value, oldValue) {
450
- if (value === undefined || value === null || value === '') {
450
+ if (value === undefined || value === null || value === "") {
451
451
  return new CalcValue({
452
452
  unit: oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit
453
453
  });
@@ -497,7 +497,7 @@ var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
497
497
  {
498
498
  key: "transform",
499
499
  value: function transform(value, oldValue) {
500
- if (value === undefined || value === null || value === '') {
500
+ if (value === undefined || value === null || value === "") {
501
501
  return new AddressValue();
502
502
  }
503
503
  var result;
@@ -581,22 +581,22 @@ var ValueCheckerFactory = /*#__PURE__*/ function() {
581
581
  }();
582
582
  function getFieldTypeFromKey(key) {
583
583
  if ([
584
- 'min',
585
- 'max',
586
- 'currency',
587
- 'unit'
584
+ "min",
585
+ "max",
586
+ "currency",
587
+ "unit"
588
588
  ].includes(key)) {
589
589
  return FieldTypes.VARCHAR;
590
590
  } else if ([
591
- 'result',
592
- 'amount'
591
+ "result",
592
+ "amount"
593
593
  ].includes(key)) {
594
594
  return FieldTypes.DECIMAL;
595
595
  }
596
596
  }
597
597
  export function checkerValue(fieldType, key, value, oldValue) {
598
- var ref;
599
- var getCheckerFieldType = (ref = getFieldTypeFromKey(key)) !== null && ref !== void 0 ? ref : fieldType;
598
+ var _getFieldTypeFromKey;
599
+ var getCheckerFieldType = (_getFieldTypeFromKey = getFieldTypeFromKey(key)) !== null && _getFieldTypeFromKey !== void 0 ? _getFieldTypeFromKey : fieldType;
600
600
  var checker = ValueCheckerFactory.getValueChecker(getCheckerFieldType);
601
601
  if (!checker || checker.validate(value)) {
602
602
  return value;
@@ -1,2 +1,2 @@
1
- export * from './Engine';
2
- export * from './Plugin';
1
+ export * from "./Engine";
2
+ export * from "./Plugin";