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

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.
Files changed (29) hide show
  1. package/dist/esm/common/BaseControl/designer.js +229 -191
  2. package/dist/esm/common/BaseControl/property.js +29 -4
  3. package/dist/esm/common/BaseControl/runtime.js +26 -5
  4. package/dist/esm/common/ColumnControl/designer.js +15 -1
  5. package/dist/esm/common/ColumnControl/property.js +59 -11
  6. package/dist/esm/common/ColumnControl/runtime.js +15 -1
  7. package/dist/esm/common/FormControl/designer.js +18 -3
  8. package/dist/esm/common/FormControl/property.js +89 -29
  9. package/dist/esm/common/FormControl/runtime.js +16 -1
  10. package/dist/esm/common/LayoutControl/designer.js +104 -70
  11. package/dist/esm/common/LayoutControl/runtime.js +16 -1
  12. package/dist/esm/common/ListControl/designer.js +95 -61
  13. package/dist/esm/common/ListControl/property.js +16 -0
  14. package/dist/esm/common/ListControl/runtime.js +16 -1
  15. package/dist/esm/common/SearchViewControl/designer.js +15 -1
  16. package/dist/esm/common/SearchViewControl/property.js +14 -0
  17. package/dist/esm/common/SearchViewControl/runtime.js +15 -1
  18. package/dist/esm/common/WrapControl/designer.js +15 -1
  19. package/dist/esm/common/WrapControl/runtime.js +15 -1
  20. package/dist/esm/framework/RegisterControls.js +213 -128
  21. package/dist/esm/framework/index.js +444 -18
  22. package/dist/esm/framework/isDataBind.js +7 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/index.umd.js +1 -1
  25. package/dist/types/common/ListControl/property.d.ts +2 -0
  26. package/dist/types/framework/index.d.ts +3 -2
  27. package/dist/types/framework/isDataBind.d.ts +2 -0
  28. package/dist/types/index.d.ts +1 -0
  29. package/package.json +3 -3
@@ -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,93 @@ 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 _this_props, _this_props_footers;
386
+ var superSchema = _get(_getPrototypeOf(ListControl.prototype), "toSchema", this).call(this);
387
+ var headers = this.props.headers.map(function(item) {
388
+ return item.toSchema();
389
+ });
390
+ var footers = (_this_props = this.props) === null || _this_props === void 0 ? void 0 : (_this_props_footers = _this_props.footers) === null || _this_props_footers === void 0 ? void 0 : _this_props_footers.map(function(item) {
391
+ if (item) {
392
+ return item.toSchema();
393
+ } else {
394
+ return undefined;
395
+ }
396
+ });
397
+ return _objectSpreadProps(_objectSpread({}, superSchema), {
398
+ props: _objectSpreadProps(_objectSpread({}, this.props), {
399
+ headers: headers,
400
+ footers: footers
401
+ })
354
402
  });
355
- return _toConsumableArray(arr).concat(_toConsumableArray(filteredModel));
356
403
  }
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
- };
404
+ }
405
+ ]);
372
406
  return ListControl;
373
407
  }(DesignerControl);
374
- ListControl.controlFieldType = FieldTypes.LIST;
408
+ _defineProperty(ListControl, "controlFieldType", FieldTypes.LIST);
375
409
  export default ListControl;
376
410
  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,7 +92,10 @@ 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);
96
+ _defineProperty(_assertThisInitialized(_this), "footers", void 0);
82
97
  defineControlArrayToProperty(_assertThisInitialized(_this), "headers", props === null || props === void 0 ? void 0 : props.headers, parent);
98
+ defineControlArrayToProperty(_assertThisInitialized(_this), "footers", props === null || props === void 0 ? void 0 : props.footers, parent);
83
99
  return _this;
84
100
  }
85
101
  return ListControlProperty;
@@ -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
  }