@byteluck-fe/model-driven-core 2.7.0-alpha.2 → 2.7.0-alpha.3

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.
@@ -46,6 +46,20 @@ function _classCallCheck(instance, Constructor) {
46
46
  throw new TypeError("Cannot call a class as a function");
47
47
  }
48
48
  }
49
+ function _defineProperties(target, props) {
50
+ for(var i = 0; i < props.length; i++){
51
+ var descriptor = props[i];
52
+ descriptor.enumerable = descriptor.enumerable || false;
53
+ descriptor.configurable = true;
54
+ if ("value" in descriptor) descriptor.writable = true;
55
+ Object.defineProperty(target, descriptor.key, descriptor);
56
+ }
57
+ }
58
+ function _createClass(Constructor, protoProps, staticProps) {
59
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
60
+ if (staticProps) _defineProperties(Constructor, staticProps);
61
+ return Constructor;
62
+ }
49
63
  function _defineProperty(obj, key, value) {
50
64
  if (key in obj) {
51
65
  Object.defineProperty(obj, key, {
@@ -304,73 +318,84 @@ var ListControl = /*#__PURE__*/ function(DesignerControl) {
304
318
  _classCallCheck(this, ListControl);
305
319
  var _this;
306
320
  _this = _super.call(this, props);
307
- _this.controlType = "list";
321
+ _defineProperty(_assertThisInitialized(_this), "controlType", "list");
322
+ _defineProperty(_assertThisInitialized(_this), "props", void 0);
308
323
  _this.props = new ListControlProperty(_assertThisInitialized(_this), props === null || props === void 0 ? void 0 : props.props);
309
324
  return _this;
310
325
  }
311
- var _proto = ListControl.prototype;
312
- _proto.validate = function validate(messages, ignore) {
313
- var _this = this;
314
- var _this1 = this, _superprop_get_validate = function() {
315
- return _get(_getPrototypeOf(ListControl.prototype), "validate", _this);
316
- };
317
- return _asyncToGenerator(function() {
318
- return __generator(this, function(_state) {
319
- switch(_state.label){
320
- case 0:
321
- return [
322
- 4,
323
- _superprop_get_validate().call(_this1, messages)
324
- ];
325
- case 1:
326
- _state.sent();
327
- return [
328
- 4,
329
- Promise.all(_this1.props.headers.map(function(child) {
330
- return child.validate(messages, ignore);
331
- }))
332
- ];
333
- case 2:
334
- _state.sent();
335
- return [
336
- 2,
337
- true
338
- ];
339
- }
340
- });
341
- })();
342
- };
343
- _proto.toDataBindModel = function toDataBindModel() {
344
- var listModel = _get(_getPrototypeOf(ListControl.prototype), "toDataBindModel", this).call(this);
345
- var result = listModel ? [
346
- listModel
347
- ] : [];
348
- var parentId = this.id;
349
- return this.props.headers.reduce(function(arr, current) {
350
- var model = current.toDataBindModel(parentId);
351
- if (Array.isArray(model)) {
352
- var filteredModel = model.filter(function(item) {
353
- return !!item;
326
+ _createClass(ListControl, [
327
+ {
328
+ key: "validate",
329
+ value: function validate(messages, ignore) {
330
+ var _this = this;
331
+ var _this1 = this, _superprop_get_validate = function() {
332
+ return _get(_getPrototypeOf(ListControl.prototype), "validate", _this);
333
+ };
334
+ return _asyncToGenerator(function() {
335
+ return __generator(this, function(_state) {
336
+ switch(_state.label){
337
+ case 0:
338
+ return [
339
+ 4,
340
+ _superprop_get_validate().call(_this1, messages)
341
+ ];
342
+ case 1:
343
+ _state.sent();
344
+ return [
345
+ 4,
346
+ Promise.all(_this1.props.headers.map(function(child) {
347
+ return child.validate(messages, ignore);
348
+ }))
349
+ ];
350
+ case 2:
351
+ _state.sent();
352
+ return [
353
+ 2,
354
+ true
355
+ ];
356
+ }
357
+ });
358
+ })();
359
+ }
360
+ },
361
+ {
362
+ key: "toDataBindModel",
363
+ value: function toDataBindModel() {
364
+ var listModel = _get(_getPrototypeOf(ListControl.prototype), "toDataBindModel", this).call(this);
365
+ var result = listModel ? [
366
+ listModel
367
+ ] : [];
368
+ var parentId = this.id;
369
+ return this.props.headers.reduce(function(arr, current) {
370
+ var model = current.toDataBindModel(parentId);
371
+ if (Array.isArray(model)) {
372
+ var filteredModel = model.filter(function(item) {
373
+ return !!item;
374
+ });
375
+ return _toConsumableArray(arr).concat(_toConsumableArray(filteredModel));
376
+ }
377
+ model && arr.push(model);
378
+ return arr;
379
+ }, result);
380
+ }
381
+ },
382
+ {
383
+ key: "toSchema",
384
+ value: function toSchema() {
385
+ var superSchema = _get(_getPrototypeOf(ListControl.prototype), "toSchema", this).call(this);
386
+ var headers = this.props.headers.map(function(item) {
387
+ return item.toSchema();
388
+ });
389
+ return _objectSpreadProps(_objectSpread({}, superSchema), {
390
+ props: _objectSpreadProps(_objectSpread({}, this.props), {
391
+ headers: headers
392
+ })
354
393
  });
355
- return _toConsumableArray(arr).concat(_toConsumableArray(filteredModel));
356
394
  }
357
- model && arr.push(model);
358
- return arr;
359
- }, result);
360
- };
361
- _proto.toSchema = function toSchema() {
362
- var superSchema = _get(_getPrototypeOf(ListControl.prototype), "toSchema", this).call(this);
363
- var headers = this.props.headers.map(function(item) {
364
- return item.toSchema();
365
- });
366
- return _objectSpreadProps(_objectSpread({}, superSchema), {
367
- props: _objectSpreadProps(_objectSpread({}, this.props), {
368
- headers: headers
369
- })
370
- });
371
- };
395
+ }
396
+ ]);
372
397
  return ListControl;
373
398
  }(DesignerControl);
374
- ListControl.controlFieldType = FieldTypes.LIST;
399
+ _defineProperty(ListControl, "controlFieldType", FieldTypes.LIST);
375
400
  export default ListControl;
376
401
  export { ListControl as DesignerListControl };
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
+ function _defineProperty(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
12
25
  function _getPrototypeOf(o) {
13
26
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
14
27
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -79,6 +92,7 @@ var ListControlProperty = /*#__PURE__*/ function(Property) {
79
92
  _classCallCheck(this, ListControlProperty);
80
93
  var _this;
81
94
  _this = _super.call(this, props);
95
+ _defineProperty(_assertThisInitialized(_this), "headers", void 0);
82
96
  defineControlArrayToProperty(_assertThisInitialized(_this), "headers", props === null || props === void 0 ? void 0 : props.headers, parent);
83
97
  return _this;
84
98
  }
@@ -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);
@@ -94,7 +107,9 @@ var ListControl = /*#__PURE__*/ function(RuntimeControl) {
94
107
  _classCallCheck(this, ListControl);
95
108
  var _this;
96
109
  _this = _super.call(this, props);
97
- _this.controlType = "list";
110
+ _defineProperty(_assertThisInitialized(_this), "controlType", "list");
111
+ _defineProperty(_assertThisInitialized(_this), "children", void 0);
112
+ _defineProperty(_assertThisInitialized(_this), "props", void 0);
98
113
  _this.props = new ListControlProperty(_assertThisInitialized(_this), props === null || props === void 0 ? void 0 : props.props);
99
114
  defineControlArrayToProperty(_assertThisInitialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
100
115
  return _this;
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
+ function _defineProperty(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
12
25
  function _getPrototypeOf(o) {
13
26
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
14
27
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -79,7 +92,8 @@ var SearchControl = /*#__PURE__*/ function(DesignerLayoutControl) {
79
92
  _classCallCheck(this, SearchControl);
80
93
  var _this;
81
94
  _this = _super.call(this, props);
82
- _this.controlType = "search";
95
+ _defineProperty(_assertThisInitialized(_this), "controlType", "search");
96
+ _defineProperty(_assertThisInitialized(_this), "props", void 0);
83
97
  _this.props = new SearchControlProperty(props === null || props === void 0 ? void 0 : props.props);
84
98
  return _this;
85
99
  }
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
+ function _defineProperty(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
12
25
  function _getPrototypeOf(o) {
13
26
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
14
27
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -79,6 +92,7 @@ var SearchControlProperty = /*#__PURE__*/ function(LayoutControlProperty) {
79
92
  _classCallCheck(this, SearchControlProperty);
80
93
  var _this;
81
94
  _this = _super.call(this, props);
95
+ _defineProperty(_assertThisInitialized(_this), "dataBind", void 0);
82
96
  _this.dataBind = new DataBind(props === null || props === void 0 ? void 0 : props.dataBind);
83
97
  return _this;
84
98
  }
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
+ function _defineProperty(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
12
25
  function _getPrototypeOf(o) {
13
26
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
14
27
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -79,7 +92,8 @@ var SearchControl = /*#__PURE__*/ function(RuntimeLayoutControl) {
79
92
  _classCallCheck(this, SearchControl);
80
93
  var _this;
81
94
  _this = _super.call(this, props);
82
- _this.controlType = "search";
95
+ _defineProperty(_assertThisInitialized(_this), "controlType", "search");
96
+ _defineProperty(_assertThisInitialized(_this), "props", void 0);
83
97
  _this.props = new SearchControlProperty(props === null || props === void 0 ? void 0 : props.props);
84
98
  return _this;
85
99
  }
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
+ function _defineProperty(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
12
25
  function _getPrototypeOf(o) {
13
26
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
14
27
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -79,7 +92,8 @@ var WrapControl = /*#__PURE__*/ function(DesignerLayoutControl) {
79
92
  _classCallCheck(this, WrapControl);
80
93
  var _this;
81
94
  _this = _super.call(this, props);
82
- _this.controlType = "wrap";
95
+ _defineProperty(_assertThisInitialized(_this), "controlType", "wrap");
96
+ _defineProperty(_assertThisInitialized(_this), "props", void 0);
83
97
  _this.props = new WrapControlProperty(props === null || props === void 0 ? void 0 : props.props);
84
98
  return _this;
85
99
  }
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
+ function _defineProperty(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
12
25
  function _getPrototypeOf(o) {
13
26
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
14
27
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -79,7 +92,8 @@ var WrapControl = /*#__PURE__*/ function(RuntimeLayoutControl) {
79
92
  _classCallCheck(this, WrapControl);
80
93
  var _this;
81
94
  _this = _super.call(this, props);
82
- _this.controlType = "wrap";
95
+ _defineProperty(_assertThisInitialized(_this), "controlType", "wrap");
96
+ _defineProperty(_assertThisInitialized(_this), "props", void 0);
83
97
  _this.props = new WrapControlProperty(props === null || props === void 0 ? void 0 : props.props);
84
98
  return _this;
85
99
  }