@byteluck-fe/model-driven-engine 2.22.1-beta.6 → 2.22.1-beta.8

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.
@@ -44,6 +44,10 @@ function _async_to_generator(fn) {
44
44
  });
45
45
  };
46
46
  }
47
+ function _call_super(_this, derived, args) {
48
+ derived = _get_prototype_of(derived);
49
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
50
+ }
47
51
  function _class_call_check(instance, Constructor) {
48
52
  if (!(instance instanceof Constructor)) {
49
53
  throw new TypeError("Cannot call a class as a function");
@@ -222,28 +226,12 @@ function _unsupported_iterable_to_array(o, minLen) {
222
226
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
223
227
  }
224
228
  function _is_native_reflect_construct() {
225
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
226
- if (Reflect.construct.sham) return false;
227
- if (typeof Proxy === "function") return true;
228
229
  try {
229
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
230
- return true;
231
- } catch (e) {
232
- return false;
233
- }
234
- }
235
- function _create_super(Derived) {
236
- var hasNativeReflectConstruct = _is_native_reflect_construct();
237
- return function _createSuperInternal() {
238
- var Super = _get_prototype_of(Derived), result;
239
- if (hasNativeReflectConstruct) {
240
- var NewTarget = _get_prototype_of(this).constructor;
241
- result = Reflect.construct(Super, arguments, NewTarget);
242
- } else {
243
- result = Super.apply(this, arguments);
244
- }
245
- return _possible_constructor_return(this, result);
246
- };
230
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
231
+ } catch (_) {}
232
+ return (_is_native_reflect_construct = function() {
233
+ return !!result;
234
+ })();
247
235
  }
248
236
  function _ts_generator(thisArg, body) {
249
237
  var f, y, t, g, _ = {
@@ -361,29 +349,14 @@ var applyingPluginName = '';
361
349
  var Engine = /*#__PURE__*/ function(Watcher) {
362
350
  "use strict";
363
351
  _inherits(Engine, Watcher);
364
- var _super = _create_super(Engine);
365
352
  function Engine(props) {
366
353
  _class_call_check(this, Engine);
367
354
  var _this;
368
- _this = _super.call(this);
369
- _define_property(_assert_this_initialized(_this), "store", void 0);
370
- _define_property(_assert_this_initialized(_this), "rawStore", {});
371
- _define_property(_assert_this_initialized(_this), "parent", void 0);
372
- // 提供注册运行态控件以及实例化控件的能力
373
- _define_property(_assert_this_initialized(_this), "runtime", void 0);
374
- // 提供子线程处理脚本以及修改数据的能力
355
+ _this = _call_super(this, Engine), _define_property(_this, "store", void 0), _define_property(_this, "rawStore", {}), _define_property(_this, "parent", void 0), // 提供注册运行态控件以及实例化控件的能力
356
+ _define_property(_this, "runtime", void 0), // 提供子线程处理脚本以及修改数据的能力
375
357
  // public worker: OkWorker
376
- _define_property(_assert_this_initialized(_this), "isMounted", false);
377
- _define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
378
- _define_property(_assert_this_initialized(_this), "externalParams", void 0);
379
- // 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
380
- _define_property(_assert_this_initialized(_this), "__plugins", void 0);
381
- _define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
382
- _define_property(_assert_this_initialized(_this), "$options", void 0);
383
- _define_property(_assert_this_initialized(_this), "actionManager", new ActionManager());
384
- _define_property(_assert_this_initialized(_this), "dataManager", void 0);
385
- _define_property(_assert_this_initialized(_this), "_jobTasks", []);
386
- _define_property(_assert_this_initialized(_this), "createControlInstance", _this.createInstance);
358
+ _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), _define_property(_this, "externalParams", void 0), // 提供外部注册插件,在不同的hooks触发时执行固定函数的能力
359
+ _define_property(_this, "__plugins", void 0), _define_property(_this, "__pluginsApplied", false), _define_property(_this, "$options", void 0), _define_property(_this, "actionManager", new ActionManager()), _define_property(_this, "dataManager", void 0), _define_property(_this, "_jobTasks", []), _define_property(_this, "createControlInstance", _this.createInstance);
387
360
  _this.$options = Object.freeze(props);
388
361
  var _this_$options = _this.$options, _this_$options_autoMount = _this_$options.autoMount, autoMount = _this_$options_autoMount === void 0 ? true : _this_$options_autoMount, schema = _this_$options.schema, beforeCreateInstance = _this_$options.beforeCreateInstance, externalParams = _this_$options.externalParams, _this_$options_language = _this_$options.// fieldModel,
389
362
  language, language = _this_$options_language === void 0 ? DEFAULT_LOCALE : _this_$options_language, _this_$options_debug = _this_$options.debug, debug = _this_$options_debug === void 0 ? false : _this_$options_debug;
@@ -602,12 +575,18 @@ var Engine = /*#__PURE__*/ function(Watcher) {
602
575
  var subtableData = this.getState(subtable.id);
603
576
  this._handlerSubtableUpdateUid(subtableData);
604
577
  this.runtime.getFlatInstances();
578
+ var rowIndexs = createdNewRows.map(function(item) {
579
+ var _item_children_, _item_children;
580
+ var subControl = item === null || item === void 0 ? void 0 : (_item_children = item.children) === null || _item_children === void 0 ? void 0 : (_item_children_ = _item_children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.children[0];
581
+ return _this.getInstanceRowIndex(subControl);
582
+ });
605
583
  this.emit('list-change', {
606
584
  instance: subtable,
607
585
  value: subtableData,
608
586
  options: Object.assign({}, options, {
609
587
  changed: createdNewRows,
610
588
  data: createdNewRowsData,
589
+ rowIndexs: rowIndexs,
611
590
  deleted: deleted !== null && deleted !== void 0 ? deleted : [],
612
591
  jsonValue: JSON.stringify(subtableData),
613
592
  isDeleteLastOne: isDeleteLastOne,
@@ -623,6 +602,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
623
602
  {
624
603
  key: "_handlerSubtableUpdateUid",
625
604
  value: function _handlerSubtableUpdateUid(subtableData) {
605
+ ;
626
606
  subtableData.forEach(function(item) {
627
607
  if (!item.uid) {
628
608
  Object.assign(item, {
@@ -635,6 +615,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
635
615
  {
636
616
  key: "_handlerObjectUpdate",
637
617
  value: function _handlerObjectUpdate(state, key, value, oldValue) {
618
+ var _this = this;
638
619
  var instance = findItem(this.runtime.flatInstances, key, this.runtime.instanceMap);
639
620
  if (!instance) {
640
621
  return;
@@ -666,6 +647,11 @@ var Engine = /*#__PURE__*/ function(Watcher) {
666
647
  this.runtime.getFlatInstances();
667
648
  }
668
649
  this._handlerSubtableUpdateUid(newValue);
650
+ var rowIndexs = newRows.map(function(item) {
651
+ var _item_children_, _item_children;
652
+ var subControl = item === null || item === void 0 ? void 0 : (_item_children = item.children) === null || _item_children === void 0 ? void 0 : (_item_children_ = _item_children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.children[0];
653
+ return _this.getInstanceRowIndex(subControl);
654
+ });
669
655
  this.emit('list-change', {
670
656
  instance: instance,
671
657
  value: value,
@@ -673,6 +659,7 @@ var Engine = /*#__PURE__*/ function(Watcher) {
673
659
  // @ts-ignore
674
660
  changed: newRows,
675
661
  data: newValue,
662
+ rowIndexs: rowIndexs,
676
663
  deleted: deleted,
677
664
  // deleted: oldValue ?? [],
678
665
  type: 'push',
@@ -4,6 +4,10 @@ function _assert_this_initialized(self) {
4
4
  }
5
5
  return self;
6
6
  }
7
+ function _call_super(_this, derived, args) {
8
+ derived = _get_prototype_of(derived);
9
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
10
+ }
7
11
  function _class_call_check(instance, Constructor) {
8
12
  if (!(instance instanceof Constructor)) {
9
13
  throw new TypeError("Cannot call a class as a function");
@@ -73,28 +77,12 @@ function _type_of(obj) {
73
77
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
74
78
  }
75
79
  function _is_native_reflect_construct() {
76
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
77
- if (Reflect.construct.sham) return false;
78
- if (typeof Proxy === "function") return true;
79
80
  try {
80
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
81
- return true;
82
- } catch (e) {
83
- return false;
84
- }
85
- }
86
- function _create_super(Derived) {
87
- var hasNativeReflectConstruct = _is_native_reflect_construct();
88
- return function _createSuperInternal() {
89
- var Super = _get_prototype_of(Derived), result;
90
- if (hasNativeReflectConstruct) {
91
- var NewTarget = _get_prototype_of(this).constructor;
92
- result = Reflect.construct(Super, arguments, NewTarget);
93
- } else {
94
- result = Super.apply(this, arguments);
95
- }
96
- return _possible_constructor_return(this, result);
97
- };
81
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
82
+ } catch (_) {}
83
+ return (_is_native_reflect_construct = function() {
84
+ return !!result;
85
+ })();
98
86
  }
99
87
  import { RegisterControls, isDataBind } from '@byteluck-fe/model-driven-core';
100
88
  import { CONTROL_BASE_TYPE, CONTROL_TYPE, JSONCopy, loopFormSchema, isArray } from '@byteluck-fe/model-driven-shared';
@@ -102,16 +90,12 @@ import { hasChildrenControl, loopDataViewControl, loopFormControl } from '../uti
102
90
  export var Runtime = /*#__PURE__*/ function(RegisterControls) {
103
91
  "use strict";
104
92
  _inherits(Runtime, RegisterControls);
105
- var _super = _create_super(Runtime);
106
93
  function Runtime(props) {
107
94
  _class_call_check(this, Runtime);
108
95
  var _this;
109
- _this = _super.call(this, 'Runtime');
110
- _define_property(_assert_this_initialized(_this), "_schema", void 0);
111
- _define_property(_assert_this_initialized(_this), "_instance", void 0);
112
- _define_property(_assert_this_initialized(_this), "_flatInstances", []);
113
- _define_property(_assert_this_initialized(_this), "_instanceMap", {});
114
- _define_property(_assert_this_initialized(_this), "_controlParentIdMap", {});
96
+ _this = _call_super(this, Runtime, [
97
+ 'Runtime'
98
+ ]), _define_property(_this, "_schema", void 0), _define_property(_this, "_instance", void 0), _define_property(_this, "_flatInstances", []), _define_property(_this, "_instanceMap", {}), _define_property(_this, "_controlParentIdMap", {});
115
99
  var schema = props.schema;
116
100
  _this._schema = schema;
117
101
  _this._instance = _this.createControl(schema, props.beforeCreateInstance);
@@ -81,6 +81,7 @@ var Store = /*#__PURE__*/ function() {
81
81
  if (controlInfo !== undefined) {
82
82
  //明细表
83
83
  if (controlInfo.children) {
84
+ ;
84
85
  value.forEach(function(item) {
85
86
  if (!item.uid) {
86
87
  Object.assign(item, {
@@ -109,6 +110,7 @@ var Store = /*#__PURE__*/ function() {
109
110
  Object.keys(children).map(function(childControlId) {
110
111
  if (childControlId === controlId) {
111
112
  if (_this.state[dataView][subtableId][rowIndex]) {
113
+ ;
112
114
  _this.state[dataView][subtableId][rowIndex][controlId] = noProxyValue;
113
115
  }
114
116
  }
@@ -167,6 +169,7 @@ var Store = /*#__PURE__*/ function() {
167
169
  if (children !== undefined) {
168
170
  Object.keys(children).map(function(childControlId) {
169
171
  if (childControlId === controlId) {
172
+ ;
170
173
  _this.state[dataViewId][subtableId].map(function(item) {
171
174
  states.push(item[controlId]);
172
175
  });
@@ -364,15 +367,17 @@ item) {
364
367
  Object.keys(item.props.dataBind).map(function(key) {
365
368
  var dataBind = item.props.dataBind;
366
369
  var dataCode = dataBind[key].dataCode;
367
- data[dataCode].fields.push({
368
- fieldCode: dataBind[key].fieldCode,
369
- controlId: item.id,
370
- dataBind: dataBind,
371
- dataViewId: [
372
- dataViewId,
373
- subtableId
374
- ]
375
- });
370
+ if (dataBind[key].fieldCode !== '') {
371
+ data[dataCode].fields.push({
372
+ fieldCode: dataBind[key].fieldCode,
373
+ controlId: item.id,
374
+ dataBind: dataBind,
375
+ dataViewId: [
376
+ dataViewId,
377
+ subtableId
378
+ ]
379
+ });
380
+ }
376
381
  });
377
382
  } else {
378
383
  if (data[item.props.dataBind.dataCode] === undefined) {
@@ -12,6 +12,10 @@ function _assert_this_initialized(self) {
12
12
  }
13
13
  return self;
14
14
  }
15
+ function _call_super(_this, derived, args) {
16
+ derived = _get_prototype_of(derived);
17
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
18
+ }
15
19
  function _class_call_check(instance, Constructor) {
16
20
  if (!(instance instanceof Constructor)) {
17
21
  throw new TypeError("Cannot call a class as a function");
@@ -134,28 +138,12 @@ function _unsupported_iterable_to_array(o, minLen) {
134
138
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
135
139
  }
136
140
  function _is_native_reflect_construct() {
137
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
138
- if (Reflect.construct.sham) return false;
139
- if (typeof Proxy === "function") return true;
140
141
  try {
141
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
142
- return true;
143
- } catch (e) {
144
- return false;
145
- }
146
- }
147
- function _create_super(Derived) {
148
- var hasNativeReflectConstruct = _is_native_reflect_construct();
149
- return function _createSuperInternal() {
150
- var Super = _get_prototype_of(Derived), result;
151
- if (hasNativeReflectConstruct) {
152
- var NewTarget = _get_prototype_of(this).constructor;
153
- result = Reflect.construct(Super, arguments, NewTarget);
154
- } else {
155
- result = Super.apply(this, arguments);
156
- }
157
- return _possible_constructor_return(this, result);
158
- };
142
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
143
+ } catch (_) {}
144
+ return (_is_native_reflect_construct = function() {
145
+ return !!result;
146
+ })();
159
147
  }
160
148
  import { isArray, isFunction, isString, isJSONArray, isJSONObject, isNumber, isNumberAndEmptyStringArray, isPlainObject, isStringArray, FieldTypes, isObject } from '@byteluck-fe/model-driven-shared';
161
149
  import { AddressValue, AmountValue, CalcValue, RangeDateValue } from '@byteluck-fe/model-driven-core';
@@ -167,10 +155,9 @@ var ValueChecker = function ValueChecker() {
167
155
  var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
168
156
  "use strict";
169
157
  _inherits(StringValueChecker, ValueChecker);
170
- var _super = _create_super(StringValueChecker);
171
158
  function StringValueChecker() {
172
159
  _class_call_check(this, StringValueChecker);
173
- return _super.apply(this, arguments);
160
+ return _call_super(this, StringValueChecker, arguments);
174
161
  }
175
162
  _create_class(StringValueChecker, [
176
163
  {
@@ -200,10 +187,9 @@ var StringValueChecker = /*#__PURE__*/ function(ValueChecker) {
200
187
  var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
201
188
  "use strict";
202
189
  _inherits(NumberValueChecker, ValueChecker);
203
- var _super = _create_super(NumberValueChecker);
204
190
  function NumberValueChecker() {
205
191
  _class_call_check(this, NumberValueChecker);
206
- return _super.apply(this, arguments);
192
+ return _call_super(this, NumberValueChecker, arguments);
207
193
  }
208
194
  _create_class(NumberValueChecker, [
209
195
  {
@@ -232,10 +218,9 @@ var NumberValueChecker = /*#__PURE__*/ function(ValueChecker) {
232
218
  var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
233
219
  "use strict";
234
220
  _inherits(StringArrayValueChecker, ValueChecker);
235
- var _super = _create_super(StringArrayValueChecker);
236
221
  function StringArrayValueChecker() {
237
222
  _class_call_check(this, StringArrayValueChecker);
238
- return _super.apply(this, arguments);
223
+ return _call_super(this, StringArrayValueChecker, arguments);
239
224
  }
240
225
  _create_class(StringArrayValueChecker, [
241
226
  {
@@ -277,10 +262,9 @@ var StringArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
277
262
  var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
278
263
  "use strict";
279
264
  _inherits(NumberArrayValueChecker, ValueChecker);
280
- var _super = _create_super(NumberArrayValueChecker);
281
265
  function NumberArrayValueChecker() {
282
266
  _class_call_check(this, NumberArrayValueChecker);
283
- return _super.apply(this, arguments);
267
+ return _call_super(this, NumberArrayValueChecker, arguments);
284
268
  }
285
269
  _create_class(NumberArrayValueChecker, [
286
270
  {
@@ -328,10 +312,9 @@ var NumberArrayValueChecker = /*#__PURE__*/ function(ValueChecker) {
328
312
  var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
329
313
  "use strict";
330
314
  _inherits(MoneyValueChecker, ValueChecker);
331
- var _super = _create_super(MoneyValueChecker);
332
315
  function MoneyValueChecker() {
333
316
  _class_call_check(this, MoneyValueChecker);
334
- return _super.apply(this, arguments);
317
+ return _call_super(this, MoneyValueChecker, arguments);
335
318
  }
336
319
  _create_class(MoneyValueChecker, [
337
320
  {
@@ -379,10 +362,9 @@ var MoneyValueChecker = /*#__PURE__*/ function(ValueChecker) {
379
362
  var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
380
363
  "use strict";
381
364
  _inherits(TimeScopeValueChecker, ValueChecker);
382
- var _super = _create_super(TimeScopeValueChecker);
383
365
  function TimeScopeValueChecker() {
384
366
  _class_call_check(this, TimeScopeValueChecker);
385
- return _super.apply(this, arguments);
367
+ return _call_super(this, TimeScopeValueChecker, arguments);
386
368
  }
387
369
  _create_class(TimeScopeValueChecker, [
388
370
  {
@@ -427,10 +409,9 @@ var TimeScopeValueChecker = /*#__PURE__*/ function(ValueChecker) {
427
409
  var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
428
410
  "use strict";
429
411
  _inherits(CalcValueChecker, ValueChecker);
430
- var _super = _create_super(CalcValueChecker);
431
412
  function CalcValueChecker() {
432
413
  _class_call_check(this, CalcValueChecker);
433
- return _super.apply(this, arguments);
414
+ return _call_super(this, CalcValueChecker, arguments);
434
415
  }
435
416
  _create_class(CalcValueChecker, [
436
417
  {
@@ -478,10 +459,9 @@ var CalcValueChecker = /*#__PURE__*/ function(ValueChecker) {
478
459
  var AddressValueChecker = /*#__PURE__*/ function(ValueChecker) {
479
460
  "use strict";
480
461
  _inherits(AddressValueChecker, ValueChecker);
481
- var _super = _create_super(AddressValueChecker);
482
462
  function AddressValueChecker() {
483
463
  _class_call_check(this, AddressValueChecker);
484
- return _super.apply(this, arguments);
464
+ return _call_super(this, AddressValueChecker, arguments);
485
465
  }
486
466
  _create_class(AddressValueChecker, [
487
467
  {
@@ -217,7 +217,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
217
217
  key: "engineAddEventListener",
218
218
  value: function engineAddEventListener(eventKey, controlEventKey) {
219
219
  var _this = this;
220
- this.engine.on(eventKey, function() {
220
+ this.engine.on(eventKey, /*#__PURE__*/ function() {
221
221
  var _ref = _async_to_generator(function(payload) {
222
222
  return _ts_generator(this, function(_state) {
223
223
  switch(_state.label){
@@ -272,7 +272,7 @@ export var ControlsEventPlugin = /*#__PURE__*/ function() {
272
272
  }
273
273
  return [
274
274
  4,
275
- Promise.all(events[name].map(function() {
275
+ Promise.all(events[name].map(/*#__PURE__*/ function() {
276
276
  var _ref = _async_to_generator(function(eventName) {
277
277
  var execResult;
278
278
  return _ts_generator(this, function(_state) {
@@ -224,7 +224,7 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
224
224
  Object.entries(LifecycleEventKeyMap).forEach(function(param) {
225
225
  var _param = _sliced_to_array(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
226
226
  var _this1 = _this;
227
- engine.on(engineKey, function() {
227
+ engine.on(engineKey, /*#__PURE__*/ function() {
228
228
  var _ref = _async_to_generator(function(payload) {
229
229
  var result;
230
230
  return _ts_generator(this, function(_state) {
@@ -278,7 +278,7 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
278
278
  }
279
279
  return [
280
280
  4,
281
- Promise.all(events[name].map(function() {
281
+ Promise.all(events[name].map(/*#__PURE__*/ function() {
282
282
  var _ref = _async_to_generator(function(eventName) {
283
283
  var execResult;
284
284
  return _ts_generator(this, function(_state) {