@byteluck-fe/model-driven-engine 6.2.0-beta.9 → 6.2.0-cyj.0

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.
@@ -1,7 +1,5 @@
1
1
  function _assert_this_initialized(self) {
2
- if (self === void 0) {
3
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4
- }
2
+ if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
5
3
  return self;
6
4
  }
7
5
  function _call_super(_this, derived, args) {
@@ -9,9 +7,7 @@ function _call_super(_this, derived, args) {
9
7
  return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
10
8
  }
11
9
  function _class_call_check(instance, Constructor) {
12
- if (!(instance instanceof Constructor)) {
13
- throw new TypeError("Cannot call a class as a function");
14
- }
10
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
15
11
  }
16
12
  function _defineProperties(target, props) {
17
13
  for(var i = 0; i < props.length; i++){
@@ -35,9 +31,7 @@ function _define_property(obj, key, value) {
35
31
  configurable: true,
36
32
  writable: true
37
33
  });
38
- } else {
39
- obj[key] = value;
40
- }
34
+ } else obj[key] = value;
41
35
  return obj;
42
36
  }
43
37
  function _get_prototype_of(o) {
@@ -59,10 +53,16 @@ function _inherits(subClass, superClass) {
59
53
  });
60
54
  if (superClass) _set_prototype_of(subClass, superClass);
61
55
  }
56
+ function _is_native_reflect_construct() {
57
+ try {
58
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
59
+ } catch (_) {}
60
+ return (_is_native_reflect_construct = function() {
61
+ return !!result;
62
+ })();
63
+ }
62
64
  function _possible_constructor_return(self, call) {
63
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
64
- return call;
65
- }
65
+ if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
66
66
  return _assert_this_initialized(self);
67
67
  }
68
68
  function _set_prototype_of(o, p) {
@@ -76,14 +76,6 @@ function _type_of(obj) {
76
76
  "@swc/helpers - typeof";
77
77
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
78
78
  }
79
- function _is_native_reflect_construct() {
80
- try {
81
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
82
- } catch (_) {}
83
- return (_is_native_reflect_construct = function() {
84
- return !!result;
85
- })();
86
- }
87
79
  import { RegisterControls, isDataBind } from '@byteluck-fe/model-driven-core';
88
80
  import { CONTROL_BASE_TYPE, CONTROL_TYPE, JSONCopy, loopFormSchema, isArray } from '@byteluck-fe/model-driven-shared';
89
81
  import { hasChildrenControl, loopDataViewControl, loopFormControl } from '../utils/runtimeUtils';
@@ -1,7 +1,5 @@
1
1
  function _class_call_check(instance, Constructor) {
2
- if (!(instance instanceof Constructor)) {
3
- throw new TypeError("Cannot call a class as a function");
4
- }
2
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
5
3
  }
6
4
  function _defineProperties(target, props) {
7
5
  for(var i = 0; i < props.length; i++){
@@ -25,9 +23,7 @@ function _define_property(obj, key, value) {
25
23
  configurable: true,
26
24
  writable: true
27
25
  });
28
- } else {
29
- obj[key] = value;
30
- }
26
+ } else obj[key] = value;
31
27
  return obj;
32
28
  }
33
29
  function _object_spread(target) {
@@ -135,10 +131,10 @@ var Store = /*#__PURE__*/ function() {
135
131
  } else {
136
132
  var controlInfo = this.controlIdMapping[controlId];
137
133
  if (controlInfo !== undefined) {
134
+ var _ref;
138
135
  var data = this.state[controlInfo.dataView][controlId];
139
- var _controlInfo_children;
140
136
  // 只有明细表key,再通过rowIndex获取行数据
141
- if (rowIndex !== undefined && Object.keys((_controlInfo_children = controlInfo === null || controlInfo === void 0 ? void 0 : controlInfo.children) !== null && _controlInfo_children !== void 0 ? _controlInfo_children : {}).length > 0) {
137
+ if (rowIndex !== undefined && Object.keys((_ref = controlInfo === null || controlInfo === void 0 ? void 0 : controlInfo.children) !== null && _ref !== void 0 ? _ref : {}).length > 0) {
142
138
  return data[rowIndex];
143
139
  } else {
144
140
  return data;
@@ -287,11 +283,11 @@ item) {
287
283
  dataViewState[item.id] = JSONCopy(item.props.defaultValue);
288
284
  emptyDataViewState[item.id] = JSONCopy(item.props.defaultValue);
289
285
  } else {
286
+ var _fill_map, _item_props_defaultRows;
290
287
  var emptyTemplate = {};
291
288
  loopFormSchema(item.props.headers, function(headerItem) {
292
289
  emptyTemplate[headerItem.id] = JSONCopy(headerItem.props.defaultValue);
293
290
  });
294
- var _item_props_defaultRows, _fill_map;
295
291
  dataViewState[item.id] = (_fill_map = new Array((_item_props_defaultRows = item.props.defaultRows) !== null && _item_props_defaultRows !== void 0 ? _item_props_defaultRows : 1).fill(0).map(function() {
296
292
  return _object_spread({
297
293
  uid: 'new:' + buildUUID('uid')
@@ -419,9 +415,9 @@ item) {
419
415
  options: []
420
416
  };
421
417
  loopFormSchema(item.props.headers, function(formControl) {
418
+ var _ref;
422
419
  var _data_item_id;
423
- var _data_item_id_children;
424
- 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 : {}, _define_property({}, formControl.id, {
420
+ Object.assign((_ref = (_data_item_id = data[item.id]) === null || _data_item_id === void 0 ? void 0 : _data_item_id.children) !== null && _ref !== void 0 ? _ref : {}, _define_property({}, formControl.id, {
425
421
  dataBind: formControl.props.dataBind
426
422
  }));
427
423
  });
@@ -7,9 +7,7 @@ function _array_with_holes(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
9
  function _assert_this_initialized(self) {
10
- if (self === void 0) {
11
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12
- }
10
+ if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13
11
  return self;
14
12
  }
15
13
  function _call_super(_this, derived, args) {
@@ -17,9 +15,7 @@ function _call_super(_this, derived, args) {
17
15
  return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
18
16
  }
19
17
  function _class_call_check(instance, Constructor) {
20
- if (!(instance instanceof Constructor)) {
21
- throw new TypeError("Cannot call a class as a function");
22
- }
18
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
23
19
  }
24
20
  function _defineProperties(target, props) {
25
21
  for(var i = 0; i < props.length; i++){
@@ -43,9 +39,7 @@ function _define_property(obj, key, value) {
43
39
  configurable: true,
44
40
  writable: true
45
41
  });
46
- } else {
47
- obj[key] = value;
48
- }
42
+ } else obj[key] = value;
49
43
  return obj;
50
44
  }
51
45
  function _get_prototype_of(o) {
@@ -67,6 +61,14 @@ function _inherits(subClass, superClass) {
67
61
  });
68
62
  if (superClass) _set_prototype_of(subClass, superClass);
69
63
  }
64
+ function _is_native_reflect_construct() {
65
+ try {
66
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
67
+ } catch (_) {}
68
+ return (_is_native_reflect_construct = function() {
69
+ return !!result;
70
+ })();
71
+ }
70
72
  function _iterable_to_array_limit(arr, i) {
71
73
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
72
74
  if (_i == null) return;
@@ -92,7 +94,7 @@ function _iterable_to_array_limit(arr, i) {
92
94
  return _arr;
93
95
  }
94
96
  function _non_iterable_rest() {
95
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
97
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
96
98
  }
97
99
  function _object_spread(target) {
98
100
  for(var i = 1; i < arguments.length; i++){
@@ -110,9 +112,7 @@ function _object_spread(target) {
110
112
  return target;
111
113
  }
112
114
  function _possible_constructor_return(self, call) {
113
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
114
- return call;
115
- }
115
+ if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
116
116
  return _assert_this_initialized(self);
117
117
  }
118
118
  function _set_prototype_of(o, p) {
@@ -137,14 +137,6 @@ function _unsupported_iterable_to_array(o, minLen) {
137
137
  if (n === "Map" || n === "Set") return Array.from(n);
138
138
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
139
139
  }
140
- function _is_native_reflect_construct() {
141
- try {
142
- var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
143
- } catch (_) {}
144
- return (_is_native_reflect_construct = function() {
145
- return !!result;
146
- })();
147
- }
148
140
  import { isArray, isFunction, isString, isJSONArray, isJSONObject, isNumber, isNumberAndEmptyStringArray, isPlainObject, isStringArray, FieldTypes, isObject } from '@byteluck-fe/model-driven-shared';
149
141
  import { AddressValue, AmountValue, CalcValue, RangeDateValue } from '@byteluck-fe/model-driven-core';
150
142
  import { camelizeKeys } from 'humps';
@@ -249,7 +241,7 @@ var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
249
241
  if (Array.isArray(newValue)) {
250
242
  return getStringValueArray(newValue);
251
243
  }
252
- } catch (e) {}
244
+ } catch (unused) {}
253
245
  }
254
246
  return [
255
247
  String(value)
@@ -295,7 +287,7 @@ var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
295
287
  if (isArray(newValue)) {
296
288
  return getNumberValueArray(newValue);
297
289
  }
298
- } catch (e) {}
290
+ } catch (unused) {}
299
291
  }
300
292
  var newValue1 = Number(value);
301
293
  if (Number.isNaN(newValue1)) {
@@ -340,7 +332,7 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
340
332
  try {
341
333
  var newValue = JSON.parse(value);
342
334
  result = new AmountValue(_object_spread({}, oldValue, newValue));
343
- } catch (e) {}
335
+ } catch (unused) {}
344
336
  }
345
337
  if (result) {
346
338
  var numberChecker = new NumberValueChecker();
@@ -388,7 +380,7 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
388
380
  try {
389
381
  var newValue = JSON.parse(value);
390
382
  result = new RangeDateValue(_object_spread({}, oldValue, newValue));
391
- } catch (e) {}
383
+ } catch (unused) {}
392
384
  }
393
385
  if (result) {
394
386
  var stringChecker = new StringValueChecker();
@@ -437,7 +429,7 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
437
429
  try {
438
430
  var newValue = JSON.parse(value);
439
431
  result = new CalcValue(_object_spread({}, oldValue, newValue));
440
- } catch (e) {}
432
+ } catch (unused) {}
441
433
  }
442
434
  if (result) {
443
435
  var numberChecker = new NumberValueChecker();
@@ -495,7 +487,7 @@ var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
495
487
  try {
496
488
  var newValue = JSON.parse(value);
497
489
  result = new AddressValue(_object_spread({}, oldValue, camelizeKeys(newValue)));
498
- } catch (e) {}
490
+ } catch (unused) {}
499
491
  }
500
492
  if (result) {
501
493
  var stringChecker = new StringValueChecker();
@@ -7,10 +7,12 @@ function _array_without_holes(arr) {
7
7
  if (Array.isArray(arr)) return _array_like_to_array(arr);
8
8
  }
9
9
  function _iterable_to_array(iter) {
10
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
10
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
11
+ return Array.from(iter);
12
+ }
11
13
  }
12
14
  function _non_iterable_spread() {
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.");
15
+ 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
16
  }
15
17
  function _to_consumable_array(arr) {
16
18
  return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
@@ -129,6 +131,7 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
129
131
  return Reflect.get(target, propertyKey, receiver);
130
132
  },
131
133
  set: function set(target, propertyKey, value, receiver) {
134
+ var _reProxyState;
132
135
  var newValue = JSONCopy(value);
133
136
  // @ts-ignore
134
137
  var oldValue = target[propertyKey];
@@ -145,7 +148,6 @@ function ArrayHandler(target, propertyKey, value, thisKey, callback) {
145
148
  }
146
149
  }
147
150
  }
148
- var _reProxyState;
149
151
  newValue = (_reProxyState = reProxyState(newValue)) !== null && _reProxyState !== void 0 ? _reProxyState : newValue;
150
152
  // 先设置值,然后再进行触发回调,确保回调内拿到的是最新的值
151
153
  var setResult;
@@ -248,10 +250,10 @@ function flatInstanceForChildren(controls) {
248
250
  // 最后一个key可能是值对象上边的key,比如金额的amount和currency,计算公式的result和unit,所以需要判断前一个控件是不是一个表单控件,是的话就返回最后一个表单控件
249
251
  return findEndItem ? findEndItem : prevItem.controlType === CONTROL_BASE_TYPE.FORM ? prevItem : undefined;
250
252
  } else {
253
+ var _ref;
251
254
  var _prevItem_children;
252
- var _prevItem_children_index;
253
255
  // 如果有children,则取children中对应的下标,没有的话一直返回prevItem
254
- return (_prevItem_children_index = prevItem === null || prevItem === void 0 ? void 0 : (_prevItem_children = prevItem.children) === null || _prevItem_children === void 0 ? void 0 : _prevItem_children[index]) !== null && _prevItem_children_index !== void 0 ? _prevItem_children_index : prevItem;
256
+ return (_ref = prevItem === null || prevItem === void 0 ? void 0 : (_prevItem_children = prevItem.children) === null || _prevItem_children === void 0 ? void 0 : _prevItem_children[index]) !== null && _ref !== void 0 ? _ref : prevItem;
255
257
  }
256
258
  }, initInstance);
257
259
  }
@@ -7,9 +7,7 @@ function _array_without_holes(arr) {
7
7
  if (Array.isArray(arr)) return _array_like_to_array(arr);
8
8
  }
9
9
  function _class_call_check(instance, Constructor) {
10
- if (!(instance instanceof Constructor)) {
11
- throw new TypeError("Cannot call a class as a function");
12
- }
10
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
13
11
  }
14
12
  function _defineProperties(target, props) {
15
13
  for(var i = 0; i < props.length; i++){
@@ -33,16 +31,16 @@ function _define_property(obj, key, value) {
33
31
  configurable: true,
34
32
  writable: true
35
33
  });
36
- } else {
37
- obj[key] = value;
38
- }
34
+ } else obj[key] = value;
39
35
  return obj;
40
36
  }
41
37
  function _iterable_to_array(iter) {
42
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
38
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
39
+ return Array.from(iter);
40
+ }
43
41
  }
44
42
  function _non_iterable_spread() {
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.");
43
+ 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
44
  }
47
45
  function _to_consumable_array(arr) {
48
46
  return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
@@ -296,19 +294,18 @@ export var CalcPlugin = /*#__PURE__*/ function() {
296
294
  * */ function watchSubtableChange() {
297
295
  var _this = this;
298
296
  this.engine.on('list-change', function(payload) {
297
+ var _ref, _this_dependenciesTriggerMap_get;
299
298
  var _payload_options;
300
299
  // 初始化前是批量操作。不做处理
301
300
  if (_this.engine.isMounted === false) return;
302
301
  _this.resetDependencies();
303
- var _payload_options_changed;
304
- var changedRows = (_payload_options_changed = (_payload_options = payload.options) === null || _payload_options === void 0 ? void 0 : _payload_options.changed) !== null && _payload_options_changed !== void 0 ? _payload_options_changed : [];
302
+ var changedRows = (_ref = (_payload_options = payload.options) === null || _payload_options === void 0 ? void 0 : _payload_options.changed) !== null && _ref !== void 0 ? _ref : [];
305
303
  // 对发生改变的行进行重新计算
306
304
  var changedCalc = _this.getCalcControlsFromSubtableRows(changedRows);
307
305
  // @ts-ignore
308
306
  changedCalc.forEach(function(calcControl) {
309
307
  _this.computedCalcValue(calcControl);
310
308
  });
311
- var _this_dependenciesTriggerMap_get;
312
309
  var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(payload.instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
313
310
  // @ts-ignore
314
311
  calcControls.forEach(function(calcControl) {
@@ -324,13 +321,13 @@ export var CalcPlugin = /*#__PURE__*/ function() {
324
321
  * */ function watchControlChange() {
325
322
  var _this = this;
326
323
  this.engine.on('change', function(payload) {
324
+ var _this_dependenciesTriggerMap_get;
327
325
  // 初始化前是批量操作。不做处理
328
326
  if (_this.engine.isMounted === false) return;
329
327
  var instance = payload.instance;
330
328
  if (!_this.dependenciesTriggerMap.has(instance.id)) {
331
329
  return;
332
330
  }
333
- var _this_dependenciesTriggerMap_get;
334
331
  var calcControls = (_this_dependenciesTriggerMap_get = _this.dependenciesTriggerMap.get(instance.id)) !== null && _this_dependenciesTriggerMap_get !== void 0 ? _this_dependenciesTriggerMap_get : [];
335
332
  // 在明细子表中的控件,如果计算公式也在明细子表,那只触发同一行的计算公式的计算
336
333
  if (payload.rowIndex !== undefined && payload.rowIndex > -1) {
@@ -369,6 +366,7 @@ export var CalcPlugin = /*#__PURE__*/ function() {
369
366
  * */ // @ts-ignore
370
367
  function computedCalcValue(control) {
371
368
  var _this = this;
369
+ var _ref;
372
370
  var scriptEcho = control.props.scriptEcho;
373
371
  if (!scriptEcho || scriptEcho.length === 0) {
374
372
  return;
@@ -446,10 +444,9 @@ export var CalcPlugin = /*#__PURE__*/ function() {
446
444
  if (result === (oldValue === null || oldValue === void 0 ? void 0 : oldValue.result)) {
447
445
  return;
448
446
  }
449
- var _oldValue_unit;
450
447
  this.engine.setState(control.id, {
451
448
  result: result,
452
- unit: (_oldValue_unit = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && _oldValue_unit !== void 0 ? _oldValue_unit : ''
449
+ unit: (_ref = oldValue === null || oldValue === void 0 ? void 0 : oldValue.unit) !== null && _ref !== void 0 ? _ref : ''
453
450
  }, rowIndex);
454
451
  }
455
452
  },
@@ -6,11 +6,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
6
6
  reject(error);
7
7
  return;
8
8
  }
9
- if (info.done) {
10
- resolve(value);
11
- } else {
12
- Promise.resolve(value).then(_next, _throw);
13
- }
9
+ if (info.done) resolve(value);
10
+ else Promise.resolve(value).then(_next, _throw);
14
11
  }
15
12
  function _async_to_generator(fn) {
16
13
  return function() {
@@ -28,9 +25,7 @@ function _async_to_generator(fn) {
28
25
  };
29
26
  }
30
27
  function _class_call_check(instance, Constructor) {
31
- if (!(instance instanceof Constructor)) {
32
- throw new TypeError("Cannot call a class as a function");
33
- }
28
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
34
29
  }
35
30
  function _defineProperties(target, props) {
36
31
  for(var i = 0; i < props.length; i++){
@@ -54,9 +49,7 @@ function _define_property(obj, key, value) {
54
49
  configurable: true,
55
50
  writable: true
56
51
  });
57
- } else {
58
- obj[key] = value;
59
- }
52
+ } else obj[key] = value;
60
53
  return obj;
61
54
  }
62
55
  function _ts_generator(thisArg, body) {
@@ -68,9 +61,17 @@ function _ts_generator(thisArg, body) {
68
61
  },
69
62
  trys: [],
70
63
  ops: []
71
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
72
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
73
- return this;
64
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
65
+ return d(g, "next", {
66
+ value: verb(0)
67
+ }), d(g, "throw", {
68
+ value: verb(1)
69
+ }), d(g, "return", {
70
+ value: verb(2)
71
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
72
+ value: function() {
73
+ return this;
74
+ }
74
75
  }), g;
75
76
  function verb(n) {
76
77
  return function(v) {
@@ -7,9 +7,7 @@ function _array_with_holes(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
9
  function _class_call_check(instance, Constructor) {
10
- if (!(instance instanceof Constructor)) {
11
- throw new TypeError("Cannot call a class as a function");
12
- }
10
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
13
11
  }
14
12
  function _defineProperties(target, props) {
15
13
  for(var i = 0; i < props.length; i++){
@@ -33,9 +31,7 @@ function _define_property(obj, key, value) {
33
31
  configurable: true,
34
32
  writable: true
35
33
  });
36
- } else {
37
- obj[key] = value;
38
- }
34
+ } else obj[key] = value;
39
35
  return obj;
40
36
  }
41
37
  function _iterable_to_array_limit(arr, i) {
@@ -63,7 +59,7 @@ function _iterable_to_array_limit(arr, i) {
63
59
  return _arr;
64
60
  }
65
61
  function _non_iterable_rest() {
66
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
62
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
67
63
  }
68
64
  function _sliced_to_array(arr, i) {
69
65
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
@@ -14,11 +14,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
14
14
  reject(error);
15
15
  return;
16
16
  }
17
- if (info.done) {
18
- resolve(value);
19
- } else {
20
- Promise.resolve(value).then(_next, _throw);
21
- }
17
+ if (info.done) resolve(value);
18
+ else Promise.resolve(value).then(_next, _throw);
22
19
  }
23
20
  function _async_to_generator(fn) {
24
21
  return function() {
@@ -36,9 +33,7 @@ function _async_to_generator(fn) {
36
33
  };
37
34
  }
38
35
  function _class_call_check(instance, Constructor) {
39
- if (!(instance instanceof Constructor)) {
40
- throw new TypeError("Cannot call a class as a function");
41
- }
36
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
42
37
  }
43
38
  function _defineProperties(target, props) {
44
39
  for(var i = 0; i < props.length; i++){
@@ -62,9 +57,7 @@ function _define_property(obj, key, value) {
62
57
  configurable: true,
63
58
  writable: true
64
59
  });
65
- } else {
66
- obj[key] = value;
67
- }
60
+ } else obj[key] = value;
68
61
  return obj;
69
62
  }
70
63
  function _iterable_to_array_limit(arr, i) {
@@ -92,19 +85,11 @@ function _iterable_to_array_limit(arr, i) {
92
85
  return _arr;
93
86
  }
94
87
  function _non_iterable_rest() {
95
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
88
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
96
89
  }
97
90
  function _sliced_to_array(arr, i) {
98
91
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
99
92
  }
100
- function _unsupported_iterable_to_array(o, minLen) {
101
- if (!o) return;
102
- if (typeof o === "string") return _array_like_to_array(o, minLen);
103
- var n = Object.prototype.toString.call(o).slice(8, -1);
104
- if (n === "Object" && o.constructor) n = o.constructor.name;
105
- if (n === "Map" || n === "Set") return Array.from(n);
106
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
107
- }
108
93
  function _ts_generator(thisArg, body) {
109
94
  var f, y, t, _ = {
110
95
  label: 0,
@@ -114,9 +99,17 @@ function _ts_generator(thisArg, body) {
114
99
  },
115
100
  trys: [],
116
101
  ops: []
117
- }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
118
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
119
- return this;
102
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
103
+ return d(g, "next", {
104
+ value: verb(0)
105
+ }), d(g, "throw", {
106
+ value: verb(1)
107
+ }), d(g, "return", {
108
+ value: verb(2)
109
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
110
+ value: function() {
111
+ return this;
112
+ }
120
113
  }), g;
121
114
  function verb(n) {
122
115
  return function(v) {
@@ -196,6 +189,14 @@ function _ts_generator(thisArg, body) {
196
189
  };
197
190
  }
198
191
  }
192
+ function _unsupported_iterable_to_array(o, minLen) {
193
+ if (!o) return;
194
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
195
+ var n = Object.prototype.toString.call(o).slice(8, -1);
196
+ if (n === "Object" && o.constructor) n = o.constructor.name;
197
+ if (n === "Map" || n === "Set") return Array.from(n);
198
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
199
+ }
199
200
  var LifecycleEventKeyMap = {
200
201
  'engine-initialized': 'did_init',
201
202
  'engine-mounted': 'did_mount',
@@ -5,9 +5,7 @@
5
5
  * @LastEditTime: 2024-11-08 11:17:53
6
6
  * @FilePath: /model-driven/packages/engine/src/plugins/StylePlugin.ts
7
7
  */ function _class_call_check(instance, Constructor) {
8
- if (!(instance instanceof Constructor)) {
9
- throw new TypeError("Cannot call a class as a function");
10
- }
8
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
11
9
  }
12
10
  function _defineProperties(target, props) {
13
11
  for(var i = 0; i < props.length; i++){
@@ -31,9 +29,7 @@ function _define_property(obj, key, value) {
31
29
  configurable: true,
32
30
  writable: true
33
31
  });
34
- } else {
35
- obj[key] = value;
36
- }
32
+ } else obj[key] = value;
37
33
  return obj;
38
34
  }
39
35
  import postcss from 'postcss';
@@ -54,10 +50,10 @@ export var StylePlugin = /*#__PURE__*/ function() {
54
50
  {
55
51
  key: "apply",
56
52
  value: function apply(engine) {
53
+ var _ref;
57
54
  var _this_config;
58
55
  this.engine = engine;
59
- var _this_config_source;
60
- var compiledStyle = (_this_config_source = (_this_config = this.config) === null || _this_config === void 0 ? void 0 : _this_config.source) !== null && _this_config_source !== void 0 ? _this_config_source : '';
56
+ var compiledStyle = (_ref = (_this_config = this.config) === null || _this_config === void 0 ? void 0 : _this_config.source) !== null && _ref !== void 0 ? _ref : '';
61
57
  var style = document.createElement('style');
62
58
  style.className = 'edit-css-' + engine.id;
63
59
  var dom = document.querySelector('head');