@byteluck-fe/model-driven-engine 2.5.1 → 2.5.2
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.
- package/dist/esm/common/ActionManager.js +28 -28
- package/dist/esm/common/DataManager.js +12 -12
- package/dist/esm/common/Engine.js +121 -137
- package/dist/esm/common/OkWorker.js +10 -10
- package/dist/esm/common/Plugin.js +2 -2
- package/dist/esm/common/Runtime.js +29 -29
- package/dist/esm/common/Store.js +34 -16
- package/dist/esm/common/checkerValue.js +77 -77
- package/dist/esm/common/proxyState.js +18 -18
- package/dist/esm/plugins/CalcPlugin.js +29 -29
- package/dist/esm/plugins/ControlsEventPlugin.js +18 -18
- package/dist/esm/plugins/ES6ModulePlugin.js +19 -19
- package/dist/esm/plugins/LifecycleEventPlugin.js +28 -28
- package/dist/esm/plugins/StylePlugin.js +7 -7
- package/dist/index.umd.js +8 -9
- package/dist/types/common/Engine.d.ts +2 -1
- package/dist/types/common/Store.d.ts +5 -1
- package/package.json +2 -2
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function _assert_this_initialized(self) {
|
|
10
10
|
if (self === void 0) {
|
|
11
11
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
12
12
|
}
|
|
13
13
|
return self;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _class_call_check(instance, Constructor) {
|
|
16
16
|
if (!(instance instanceof Constructor)) {
|
|
17
17
|
throw new TypeError("Cannot call a class as a function");
|
|
18
18
|
}
|
|
@@ -26,12 +26,12 @@ function _defineProperties(target, props) {
|
|
|
26
26
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
30
30
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
31
31
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
32
32
|
return Constructor;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function _define_property(obj, key, value) {
|
|
35
35
|
if (key in obj) {
|
|
36
36
|
Object.defineProperty(obj, key, {
|
|
37
37
|
value: value,
|
|
@@ -44,11 +44,11 @@ function _defineProperty(obj, key, value) {
|
|
|
44
44
|
}
|
|
45
45
|
return obj;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
47
|
+
function _get_prototype_of(o) {
|
|
48
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
49
49
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
50
50
|
};
|
|
51
|
-
return
|
|
51
|
+
return _get_prototype_of(o);
|
|
52
52
|
}
|
|
53
53
|
function _inherits(subClass, superClass) {
|
|
54
54
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -61,7 +61,7 @@ function _inherits(subClass, superClass) {
|
|
|
61
61
|
configurable: true
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
if (superClass)
|
|
64
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
65
65
|
}
|
|
66
66
|
function _instanceof(left, right) {
|
|
67
67
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
@@ -70,7 +70,7 @@ function _instanceof(left, right) {
|
|
|
70
70
|
return left instanceof right;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function _iterable_to_array_limit(arr, i) {
|
|
74
74
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
75
75
|
if (_i == null) return;
|
|
76
76
|
var _arr = [];
|
|
@@ -94,10 +94,10 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
94
94
|
}
|
|
95
95
|
return _arr;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function _non_iterable_rest() {
|
|
98
98
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function _object_spread(target) {
|
|
101
101
|
for(var i = 1; i < arguments.length; i++){
|
|
102
102
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
103
103
|
var ownKeys = Object.keys(source);
|
|
@@ -107,40 +107,40 @@ function _objectSpread(target) {
|
|
|
107
107
|
}));
|
|
108
108
|
}
|
|
109
109
|
ownKeys.forEach(function(key) {
|
|
110
|
-
|
|
110
|
+
_define_property(target, key, source[key]);
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
return target;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
if (call && (
|
|
115
|
+
function _possible_constructor_return(self, call) {
|
|
116
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
117
117
|
return call;
|
|
118
118
|
}
|
|
119
|
-
return
|
|
119
|
+
return _assert_this_initialized(self);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
121
|
+
function _set_prototype_of(o, p) {
|
|
122
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
123
123
|
o.__proto__ = p;
|
|
124
124
|
return o;
|
|
125
125
|
};
|
|
126
|
-
return
|
|
126
|
+
return _set_prototype_of(o, p);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
return
|
|
128
|
+
function _sliced_to_array(arr, i) {
|
|
129
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
function _type_of(obj) {
|
|
132
132
|
"@swc/helpers - typeof";
|
|
133
133
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
134
|
-
}
|
|
135
|
-
function
|
|
134
|
+
}
|
|
135
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
136
136
|
if (!o) return;
|
|
137
|
-
if (typeof o === "string") return
|
|
137
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
138
138
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
139
139
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
140
140
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
141
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
141
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function _is_native_reflect_construct() {
|
|
144
144
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
145
145
|
if (Reflect.construct.sham) return false;
|
|
146
146
|
if (typeof Proxy === "function") return true;
|
|
@@ -151,17 +151,17 @@ function _isNativeReflectConstruct() {
|
|
|
151
151
|
return false;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
var hasNativeReflectConstruct =
|
|
154
|
+
function _create_super(Derived) {
|
|
155
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
156
156
|
return function _createSuperInternal() {
|
|
157
|
-
var Super =
|
|
157
|
+
var Super = _get_prototype_of(Derived), result;
|
|
158
158
|
if (hasNativeReflectConstruct) {
|
|
159
|
-
var NewTarget =
|
|
159
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
160
160
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
161
161
|
} else {
|
|
162
162
|
result = Super.apply(this, arguments);
|
|
163
163
|
}
|
|
164
|
-
return
|
|
164
|
+
return _possible_constructor_return(this, result);
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
import { isArray, isFunction, isString, isJSONArray, isJSONObject, isNumber, isNumberAndEmptyStringArray, isPlainObject, isStringArray, FieldTypes, isObject } from "@byteluck-fe/model-driven-shared";
|
|
@@ -169,17 +169,17 @@ import { AddressValue, AmountValue, CalcValue, RangeDateValue } from "@byteluck-
|
|
|
169
169
|
import { camelizeKeys } from "humps";
|
|
170
170
|
var ValueChecker = function ValueChecker() {
|
|
171
171
|
"use strict";
|
|
172
|
-
|
|
172
|
+
_class_call_check(this, ValueChecker);
|
|
173
173
|
};
|
|
174
174
|
var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
175
175
|
"use strict";
|
|
176
176
|
_inherits(StringValueChecker, ValueChecker);
|
|
177
|
-
var _super =
|
|
177
|
+
var _super = _create_super(StringValueChecker);
|
|
178
178
|
function StringValueChecker() {
|
|
179
|
-
|
|
179
|
+
_class_call_check(this, StringValueChecker);
|
|
180
180
|
return _super.apply(this, arguments);
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
_create_class(StringValueChecker, [
|
|
183
183
|
{
|
|
184
184
|
key: "validate",
|
|
185
185
|
value: function validate(value) {
|
|
@@ -207,12 +207,12 @@ var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
207
207
|
var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
208
208
|
"use strict";
|
|
209
209
|
_inherits(NumberValueChecker, ValueChecker);
|
|
210
|
-
var _super =
|
|
210
|
+
var _super = _create_super(NumberValueChecker);
|
|
211
211
|
function NumberValueChecker() {
|
|
212
|
-
|
|
212
|
+
_class_call_check(this, NumberValueChecker);
|
|
213
213
|
return _super.apply(this, arguments);
|
|
214
214
|
}
|
|
215
|
-
|
|
215
|
+
_create_class(NumberValueChecker, [
|
|
216
216
|
{
|
|
217
217
|
// 数字类型允许是空字符串,用于置空数据
|
|
218
218
|
key: "validate",
|
|
@@ -239,12 +239,12 @@ var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
239
239
|
var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
240
240
|
"use strict";
|
|
241
241
|
_inherits(StringArrayValueChecker, ValueChecker);
|
|
242
|
-
var _super =
|
|
242
|
+
var _super = _create_super(StringArrayValueChecker);
|
|
243
243
|
function StringArrayValueChecker() {
|
|
244
|
-
|
|
244
|
+
_class_call_check(this, StringArrayValueChecker);
|
|
245
245
|
return _super.apply(this, arguments);
|
|
246
246
|
}
|
|
247
|
-
|
|
247
|
+
_create_class(StringArrayValueChecker, [
|
|
248
248
|
{
|
|
249
249
|
key: "validate",
|
|
250
250
|
value: function validate(value) {
|
|
@@ -254,13 +254,13 @@ var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
254
254
|
{
|
|
255
255
|
key: "transform",
|
|
256
256
|
value: function transform(value) {
|
|
257
|
-
|
|
257
|
+
if (value === undefined || value === null) {
|
|
258
|
+
return [];
|
|
259
|
+
}
|
|
260
|
+
function getStringValueArray(value) {
|
|
258
261
|
return value.map(function(item) {
|
|
259
262
|
return !item ? "" : String(item);
|
|
260
263
|
});
|
|
261
|
-
};
|
|
262
|
-
if (value === undefined || value === null) {
|
|
263
|
-
return [];
|
|
264
264
|
}
|
|
265
265
|
if (isArray(value)) {
|
|
266
266
|
return getStringValueArray(value);
|
|
@@ -284,12 +284,12 @@ var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
284
284
|
var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
285
285
|
"use strict";
|
|
286
286
|
_inherits(NumberArrayValueChecker, ValueChecker);
|
|
287
|
-
var _super =
|
|
287
|
+
var _super = _create_super(NumberArrayValueChecker);
|
|
288
288
|
function NumberArrayValueChecker() {
|
|
289
|
-
|
|
289
|
+
_class_call_check(this, NumberArrayValueChecker);
|
|
290
290
|
return _super.apply(this, arguments);
|
|
291
291
|
}
|
|
292
|
-
|
|
292
|
+
_create_class(NumberArrayValueChecker, [
|
|
293
293
|
{
|
|
294
294
|
key: "validate",
|
|
295
295
|
value: function validate(value) {
|
|
@@ -299,15 +299,15 @@ var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
299
299
|
{
|
|
300
300
|
key: "transform",
|
|
301
301
|
value: function transform(value) {
|
|
302
|
-
|
|
302
|
+
if (value === undefined || value === null) {
|
|
303
|
+
return [];
|
|
304
|
+
}
|
|
305
|
+
function getNumberValueArray(value) {
|
|
303
306
|
return value.map(function(item) {
|
|
304
307
|
return !item && item !== 0 ? "" : Number(item);
|
|
305
308
|
}).filter(function(item) {
|
|
306
309
|
return item === "" || !Number.isNaN(item);
|
|
307
310
|
});
|
|
308
|
-
};
|
|
309
|
-
if (value === undefined || value === null) {
|
|
310
|
-
return [];
|
|
311
311
|
}
|
|
312
312
|
if (isArray(value)) {
|
|
313
313
|
return getNumberValueArray(value);
|
|
@@ -335,12 +335,12 @@ var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
335
335
|
var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
336
336
|
"use strict";
|
|
337
337
|
_inherits(MoneyValueChecker, ValueChecker);
|
|
338
|
-
var _super =
|
|
338
|
+
var _super = _create_super(MoneyValueChecker);
|
|
339
339
|
function MoneyValueChecker() {
|
|
340
|
-
|
|
340
|
+
_class_call_check(this, MoneyValueChecker);
|
|
341
341
|
return _super.apply(this, arguments);
|
|
342
342
|
}
|
|
343
|
-
|
|
343
|
+
_create_class(MoneyValueChecker, [
|
|
344
344
|
{
|
|
345
345
|
key: "validate",
|
|
346
346
|
value: function validate(value) {
|
|
@@ -357,12 +357,12 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
357
357
|
}
|
|
358
358
|
var result;
|
|
359
359
|
if (isPlainObject(value)) {
|
|
360
|
-
result = new AmountValue(
|
|
360
|
+
result = new AmountValue(_object_spread({}, oldValue, value));
|
|
361
361
|
}
|
|
362
362
|
if (isString(value) && isJSONObject(value)) {
|
|
363
363
|
try {
|
|
364
364
|
var newValue = JSON.parse(value);
|
|
365
|
-
result = new AmountValue(
|
|
365
|
+
result = new AmountValue(_object_spread({}, oldValue, newValue));
|
|
366
366
|
} catch (e) {}
|
|
367
367
|
}
|
|
368
368
|
if (result) {
|
|
@@ -385,12 +385,12 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
385
385
|
var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
386
386
|
"use strict";
|
|
387
387
|
_inherits(TimeScopeValueChecker, ValueChecker);
|
|
388
|
-
var _super =
|
|
388
|
+
var _super = _create_super(TimeScopeValueChecker);
|
|
389
389
|
function TimeScopeValueChecker() {
|
|
390
|
-
|
|
390
|
+
_class_call_check(this, TimeScopeValueChecker);
|
|
391
391
|
return _super.apply(this, arguments);
|
|
392
392
|
}
|
|
393
|
-
|
|
393
|
+
_create_class(TimeScopeValueChecker, [
|
|
394
394
|
{
|
|
395
395
|
key: "validate",
|
|
396
396
|
value: function validate(value) {
|
|
@@ -405,12 +405,12 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
405
405
|
}
|
|
406
406
|
var result;
|
|
407
407
|
if (isPlainObject(value)) {
|
|
408
|
-
result = new RangeDateValue(
|
|
408
|
+
result = new RangeDateValue(_object_spread({}, oldValue, value));
|
|
409
409
|
}
|
|
410
410
|
if (isString(value) && isJSONObject(value)) {
|
|
411
411
|
try {
|
|
412
412
|
var newValue = JSON.parse(value);
|
|
413
|
-
result = new RangeDateValue(
|
|
413
|
+
result = new RangeDateValue(_object_spread({}, oldValue, newValue));
|
|
414
414
|
} catch (e) {}
|
|
415
415
|
}
|
|
416
416
|
if (result) {
|
|
@@ -432,12 +432,12 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
432
432
|
var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
433
433
|
"use strict";
|
|
434
434
|
_inherits(CalcValueChecker, ValueChecker);
|
|
435
|
-
var _super =
|
|
435
|
+
var _super = _create_super(CalcValueChecker);
|
|
436
436
|
function CalcValueChecker() {
|
|
437
|
-
|
|
437
|
+
_class_call_check(this, CalcValueChecker);
|
|
438
438
|
return _super.apply(this, arguments);
|
|
439
439
|
}
|
|
440
|
-
|
|
440
|
+
_create_class(CalcValueChecker, [
|
|
441
441
|
{
|
|
442
442
|
key: "validate",
|
|
443
443
|
value: function validate(value) {
|
|
@@ -454,12 +454,12 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
454
454
|
}
|
|
455
455
|
var result;
|
|
456
456
|
if (isPlainObject(value)) {
|
|
457
|
-
result = new CalcValue(
|
|
457
|
+
result = new CalcValue(_object_spread({}, oldValue, value));
|
|
458
458
|
}
|
|
459
459
|
if (isString(value) && isJSONObject(value)) {
|
|
460
460
|
try {
|
|
461
461
|
var newValue = JSON.parse(value);
|
|
462
|
-
result = new CalcValue(
|
|
462
|
+
result = new CalcValue(_object_spread({}, oldValue, newValue));
|
|
463
463
|
} catch (e) {}
|
|
464
464
|
}
|
|
465
465
|
if (result) {
|
|
@@ -482,12 +482,12 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
482
482
|
var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
483
483
|
"use strict";
|
|
484
484
|
_inherits(AddressValueChecker, ValueChecker);
|
|
485
|
-
var _super =
|
|
485
|
+
var _super = _create_super(AddressValueChecker);
|
|
486
486
|
function AddressValueChecker() {
|
|
487
|
-
|
|
487
|
+
_class_call_check(this, AddressValueChecker);
|
|
488
488
|
return _super.apply(this, arguments);
|
|
489
489
|
}
|
|
490
|
-
|
|
490
|
+
_create_class(AddressValueChecker, [
|
|
491
491
|
{
|
|
492
492
|
key: "validate",
|
|
493
493
|
value: function validate(value) {
|
|
@@ -502,12 +502,12 @@ var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
502
502
|
}
|
|
503
503
|
var result;
|
|
504
504
|
if (isPlainObject(value)) {
|
|
505
|
-
result = new AddressValue(
|
|
505
|
+
result = new AddressValue(_object_spread({}, oldValue, camelizeKeys(value)));
|
|
506
506
|
}
|
|
507
507
|
if (isString(value) && isJSONObject(value)) {
|
|
508
508
|
try {
|
|
509
509
|
var newValue = JSON.parse(value);
|
|
510
|
-
result = new AddressValue(
|
|
510
|
+
result = new AddressValue(_object_spread({}, oldValue, camelizeKeys(newValue)));
|
|
511
511
|
} catch (e) {}
|
|
512
512
|
}
|
|
513
513
|
if (result) {
|
|
@@ -532,9 +532,9 @@ var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
|
|
|
532
532
|
var ValueCheckerFactory = /*#__PURE__*/ function() {
|
|
533
533
|
"use strict";
|
|
534
534
|
function ValueCheckerFactory() {
|
|
535
|
-
|
|
535
|
+
_class_call_check(this, ValueCheckerFactory);
|
|
536
536
|
}
|
|
537
|
-
|
|
537
|
+
_create_class(ValueCheckerFactory, null, [
|
|
538
538
|
{
|
|
539
539
|
key: "getValueChecker",
|
|
540
540
|
value: function getValueChecker(fieldType) {
|
|
@@ -614,7 +614,7 @@ export function checkerValue(fieldType, key, value, oldValue) {
|
|
|
614
614
|
}
|
|
615
615
|
export function checkerSubtableValue(fieldTypeMap, value, emptyValue) {
|
|
616
616
|
return Object.entries(fieldTypeMap).reduce(function(result, param) {
|
|
617
|
-
var _param =
|
|
617
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], fieldType = _param[1];
|
|
618
618
|
var nowValue = value[key];
|
|
619
619
|
result[key] = checkerValue(fieldType, key, nowValue, emptyValue[key]);
|
|
620
620
|
return result;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
if (Array.isArray(arr)) return
|
|
6
|
+
function _array_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function _iterable_to_array(iter) {
|
|
10
10
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function _non_iterable_spread() {
|
|
13
13
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
15
|
+
function _to_consumable_array(arr) {
|
|
16
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
19
19
|
if (!o) return;
|
|
20
|
-
if (typeof o === "string") return
|
|
20
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
21
21
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
22
22
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
23
23
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
24
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
24
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
25
25
|
}
|
|
26
26
|
var cc = console;
|
|
27
27
|
import { CONTROL_BASE_TYPE, error, logerror, JSONCopy } from "@byteluck-fe/model-driven-shared";
|
|
@@ -125,7 +125,11 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
|
|
|
125
125
|
return Reflect.get(target, propertyKey, receiver);
|
|
126
126
|
},
|
|
127
127
|
set: function set(target, propertyKey, value, receiver) {
|
|
128
|
-
var
|
|
128
|
+
var newValue = JSONCopy(value);
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
var oldValue = target[propertyKey];
|
|
131
|
+
var concatKey = thisKey === "" ? propertyKey : thisKey + "." + propertyKey;
|
|
132
|
+
function reProxyState(value) {
|
|
129
133
|
if (typeof value === "object" && value !== null) {
|
|
130
134
|
// @ts-ignore
|
|
131
135
|
if (value[engineProxyFlag] !== true) {
|
|
@@ -136,11 +140,7 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
|
|
|
136
140
|
value[engineTargetKey], callback, beforeSetCallback, concatKey);
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
|
-
}
|
|
140
|
-
var newValue = JSONCopy(value);
|
|
141
|
-
// @ts-ignore
|
|
142
|
-
var oldValue = target[propertyKey];
|
|
143
|
-
var concatKey = thisKey === "" ? propertyKey : thisKey + "." + propertyKey;
|
|
143
|
+
}
|
|
144
144
|
var _reProxyState;
|
|
145
145
|
newValue = (_reProxyState = reProxyState(newValue)) !== null && _reProxyState !== void 0 ? _reProxyState : newValue;
|
|
146
146
|
// 先设置值,然后再进行触发回调,确保回调内拿到的是最新的值
|
|
@@ -207,7 +207,7 @@ function flatInstanceForChildren(controls) {
|
|
|
207
207
|
result.push(item);
|
|
208
208
|
if (item.controlType === "layout") {
|
|
209
209
|
var _result;
|
|
210
|
-
(_result = result).push.apply(_result,
|
|
210
|
+
(_result = result).push.apply(_result, _to_consumable_array(flatInstanceForChildren(item.children)));
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
213
|
return result;
|
|
@@ -287,7 +287,7 @@ function getArrayNewArgs(type, args, value) {
|
|
|
287
287
|
var result;
|
|
288
288
|
var addValue = getArrayNewValue(key, args);
|
|
289
289
|
if (addValue.length) {
|
|
290
|
-
var
|
|
290
|
+
var _this_engineArrayBeforeSetCallbackFlag, _this;
|
|
291
291
|
// @ts-ignore
|
|
292
292
|
var newValue = (_this_engineArrayBeforeSetCallbackFlag = (_this = this)[engineArrayBeforeSetCallbackFlag]) === null || _this_engineArrayBeforeSetCallbackFlag === void 0 ? void 0 : _this_engineArrayBeforeSetCallbackFlag.call(_this, // @ts-ignore
|
|
293
293
|
this[engineTargetKey], // @ts-ignore
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
if (Array.isArray(arr)) return
|
|
6
|
+
function _array_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function _class_call_check(instance, Constructor) {
|
|
10
10
|
if (!(instance instanceof Constructor)) {
|
|
11
11
|
throw new TypeError("Cannot call a class as a function");
|
|
12
12
|
}
|
|
@@ -20,12 +20,12 @@ function _defineProperties(target, props) {
|
|
|
20
20
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
24
24
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
25
25
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
26
26
|
return Constructor;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function _define_property(obj, key, value) {
|
|
29
29
|
if (key in obj) {
|
|
30
30
|
Object.defineProperty(obj, key, {
|
|
31
31
|
value: value,
|
|
@@ -38,58 +38,58 @@ function _defineProperty(obj, key, value) {
|
|
|
38
38
|
}
|
|
39
39
|
return obj;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function _iterable_to_array(iter) {
|
|
42
42
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function _non_iterable_spread() {
|
|
45
45
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
47
|
+
function _to_consumable_array(arr) {
|
|
48
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
51
51
|
if (!o) return;
|
|
52
|
-
if (typeof o === "string") return
|
|
52
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
53
53
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
54
54
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
55
55
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
56
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
56
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
57
57
|
}
|
|
58
58
|
import { CONTROL_TYPE, CALC_TOKEN_TYPE, CALC_AGGREGATE_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
59
59
|
import { format } from "mathjs";
|
|
60
60
|
var DisplayType;
|
|
61
61
|
(function(DisplayType) {
|
|
62
|
-
|
|
62
|
+
/**
|
|
63
63
|
* 完全等于
|
|
64
|
-
*/ "EQ"] = "EQ";
|
|
65
|
-
|
|
64
|
+
*/ DisplayType["EQ"] = "EQ";
|
|
65
|
+
/**
|
|
66
66
|
* 包含
|
|
67
|
-
* */ "IN"] = "IN";
|
|
67
|
+
* */ DisplayType["IN"] = "IN";
|
|
68
68
|
})(DisplayType || (DisplayType = {}));
|
|
69
69
|
export var CalcPlugin = /*#__PURE__*/ function() {
|
|
70
70
|
"use strict";
|
|
71
71
|
function CalcPlugin(options) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
_class_call_check(this, CalcPlugin);
|
|
73
|
+
_define_property(this, "engine", void 0);
|
|
74
|
+
_define_property(this, "options", void 0);
|
|
75
75
|
/**
|
|
76
76
|
* 所有的计算公式控件
|
|
77
77
|
* */ // @ts-ignore
|
|
78
|
-
|
|
78
|
+
_define_property(this, "calcControls", []);
|
|
79
79
|
/**
|
|
80
80
|
* key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
|
|
81
81
|
* 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
|
|
82
|
-
* */
|
|
82
|
+
* */ _define_property(this, "dependenciesTriggerMap", new Map());
|
|
83
83
|
/**
|
|
84
84
|
* 隐藏以后需要被计算的控件
|
|
85
|
-
* */
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
* */ _define_property(this, "hideNotRememberControlIds", []);
|
|
86
|
+
_define_property(this, "dontHasPermissionControlIds", []);
|
|
87
|
+
_define_property(this, "cacheComputedResult", {});
|
|
88
88
|
this.options = options;
|
|
89
89
|
this.getDontHasPermissionControlIds();
|
|
90
90
|
this.getNeedHideRememberControlIds();
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
_create_class(CalcPlugin, [
|
|
93
93
|
{
|
|
94
94
|
key: "getNeedHideRememberControlIds",
|
|
95
95
|
value: /**
|
|
@@ -102,7 +102,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
102
102
|
this.hideNotRememberControlIds = this.options.displayBoList.reduce(function(result, current) {
|
|
103
103
|
if (!current.is_remember) {
|
|
104
104
|
var _result;
|
|
105
|
-
(_result = result).push.apply(_result,
|
|
105
|
+
(_result = result).push.apply(_result, _to_consumable_array(current.hide_controls));
|
|
106
106
|
}
|
|
107
107
|
return result;
|
|
108
108
|
}, []);
|
|
@@ -466,10 +466,10 @@ export var CalcPlugin = /*#__PURE__*/ function() {
|
|
|
466
466
|
switch(type){
|
|
467
467
|
case CALC_AGGREGATE_TYPE.MAX:
|
|
468
468
|
var _Math;
|
|
469
|
-
return (_Math = Math).max.apply(_Math,
|
|
469
|
+
return (_Math = Math).max.apply(_Math, _to_consumable_array(values));
|
|
470
470
|
case CALC_AGGREGATE_TYPE.MIN:
|
|
471
471
|
var _Math1;
|
|
472
|
-
return (_Math1 = Math).min.apply(_Math1,
|
|
472
|
+
return (_Math1 = Math).min.apply(_Math1, _to_consumable_array(values));
|
|
473
473
|
case CALC_AGGREGATE_TYPE.SUM:
|
|
474
474
|
return values.reduce(function(a, b) {
|
|
475
475
|
return a + b;
|