@byteluck-fe/model-driven-driven 2.5.0-alpha.9 → 2.5.0-beta.1

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.
@@ -3,137 +3,97 @@ function _classCallCheck(instance, Constructor) {
3
3
  throw new TypeError("Cannot call a class as a function");
4
4
  }
5
5
  }
6
- function _defineProperties(target, props) {
7
- for(var i = 0; i < props.length; i++){
8
- var descriptor = props[i];
9
- descriptor.enumerable = descriptor.enumerable || false;
10
- descriptor.configurable = true;
11
- if ("value" in descriptor) descriptor.writable = true;
12
- Object.defineProperty(target, descriptor.key, descriptor);
13
- }
14
- }
15
- function _createClass(Constructor, protoProps, staticProps) {
16
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17
- if (staticProps) _defineProperties(Constructor, staticProps);
18
- return Constructor;
19
- }
20
- function _defineProperty(obj, key, value) {
21
- if (key in obj) {
22
- Object.defineProperty(obj, key, {
23
- value: value,
24
- enumerable: true,
25
- configurable: true,
26
- writable: true
27
- });
28
- } else {
29
- obj[key] = value;
30
- }
31
- return obj;
32
- }
33
6
  import Designer from "./Designer";
34
7
  import { CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
35
8
  export var Builder = /*#__PURE__*/ function() {
36
9
  "use strict";
37
10
  function Builder() {
38
11
  _classCallCheck(this, Builder);
39
- _defineProperty(this, "designer", new Designer());
12
+ this.designer = new Designer();
40
13
  }
41
- _createClass(Builder, [
42
- {
43
- key: "ListPageBuilder",
44
- value: // @ts-ignore
45
- function ListPageBuilder() {
46
- var listview = this.designer.createControlInstance(// @ts-ignore
47
- CONTROL_TYPE.LIST_VIEW);
48
- var simpleSearch = this.designer.createControlInstance(// @ts-ignore
49
- CONTROL_TYPE.SIMPLE_SEARCH);
50
- var gridTable = this.designer.createControlInstance(// @ts-ignore
51
- CONTROL_TYPE.GRID_TABLE);
52
- var createBtn = this.designer.createControlInstance(// @ts-ignore
53
- CONTROL_TYPE.CREATE_FORM_LIST_BUTTON);
54
- var importBtn = this.designer.createControlInstance(// @ts-ignore
55
- CONTROL_TYPE.IMPORT_RECORD_LIST_BUTTON);
56
- var exportBtn = this.designer.createControlInstance(// @ts-ignore
57
- CONTROL_TYPE.EXPORT_LIST_BUTTON);
58
- var exportRecordBtn = this.designer.createControlInstance(// @ts-ignore
59
- CONTROL_TYPE.EXPORT_RECORD_LIST_BUTTON);
60
- // @ts-ignore
61
- gridTable.children.push(createBtn);
62
- // @ts-ignore
63
- gridTable.children.push(importBtn);
64
- // @ts-ignore
65
- gridTable.children.push(exportBtn);
66
- // @ts-ignore
67
- gridTable.children.push(exportRecordBtn);
68
- // @ts-ignore
69
- listview.children.push(simpleSearch);
70
- // @ts-ignore
71
- listview.children.push(gridTable);
72
- return listview;
73
- }
74
- },
75
- {
76
- key: "ProListPageBuilder",
77
- value: // @ts-ignore
78
- function ProListPageBuilder() {
79
- // @ts-ignore
80
- var listview = this.designer.createControlInstance(// @ts-ignore
81
- CONTROL_TYPE.LIST_VIEW);
82
- listview.props.countType = "async";
83
- var simpleSearch = this.designer.createControlInstance(// @ts-ignore
84
- CONTROL_TYPE.SIMPLE_SEARCH);
85
- var gridTable = this.designer.createControlInstance(// @ts-ignore
86
- CONTROL_TYPE.GRID_TABLE);
87
- // @ts-ignore
88
- var exportBtn = this.designer.createControlInstance(// @ts-ignore
89
- CONTROL_TYPE.EXPORT_LIST_BUTTON);
90
- var exportRecordBtn = this.designer.createControlInstance(// @ts-ignore
91
- CONTROL_TYPE.EXPORT_RECORD_LIST_BUTTON);
92
- // @ts-ignore
93
- gridTable.children.push(exportBtn);
94
- // @ts-ignore
95
- gridTable.children.push(exportRecordBtn);
96
- // @ts-ignore
97
- listview.children.push(simpleSearch);
98
- // @ts-ignore
99
- listview.children.push(gridTable);
100
- return listview;
101
- }
102
- },
103
- {
104
- key: "FormPageBuilder",
105
- value: // @ts-ignore
106
- function FormPageBuilder() {
107
- var dataView = this.designer.createControlInstance(// @ts-ignore
108
- CONTROL_TYPE.DATA_VIEW);
109
- // @ts-ignore
110
- var title = this.designer.createControlInstance(CONTROL_TYPE.TITLE);
111
- // @ts-ignore
112
- var grid = this.designer.createControlInstance(CONTROL_TYPE.GRID);
113
- // @ts-ignore
114
- dataView.children.push(title);
115
- // @ts-ignore
116
- dataView.children.push(grid);
117
- return dataView;
118
- }
119
- },
120
- {
121
- key: "VuePageBuilder",
122
- value: // @ts-ignore
123
- function VuePageBuilder() {
124
- var grid = this.designer.createControlInstance(// @ts-ignore
125
- CONTROL_TYPE.GRID);
126
- var vueFormItem = this.designer.createControlInstance(// @ts-ignore
127
- CONTROL_TYPE.VUE_FORM_ITEM);
128
- // @ts-ignore
129
- vueFormItem.props.isHideCaption = true;
130
- // @ts-ignore
131
- vueFormItem.props.controlExportName = "VuePage";
132
- // @ts-ignore
133
- grid.children.push(vueFormItem);
134
- return grid;
135
- }
136
- }
137
- ]);
14
+ var _proto = Builder.prototype;
15
+ // @ts-ignore
16
+ _proto.ListPageBuilder = function ListPageBuilder() {
17
+ var listview = this.designer.createControlInstance(// @ts-ignore
18
+ CONTROL_TYPE.LIST_VIEW);
19
+ var simpleSearch = this.designer.createControlInstance(// @ts-ignore
20
+ CONTROL_TYPE.SIMPLE_SEARCH);
21
+ var gridTable = this.designer.createControlInstance(// @ts-ignore
22
+ CONTROL_TYPE.GRID_TABLE);
23
+ var createBtn = this.designer.createControlInstance(// @ts-ignore
24
+ CONTROL_TYPE.CREATE_FORM_LIST_BUTTON);
25
+ var importBtn = this.designer.createControlInstance(// @ts-ignore
26
+ CONTROL_TYPE.IMPORT_RECORD_LIST_BUTTON);
27
+ var exportBtn = this.designer.createControlInstance(// @ts-ignore
28
+ CONTROL_TYPE.EXPORT_LIST_BUTTON);
29
+ var exportRecordBtn = this.designer.createControlInstance(// @ts-ignore
30
+ CONTROL_TYPE.EXPORT_RECORD_LIST_BUTTON);
31
+ // @ts-ignore
32
+ gridTable.children.push(createBtn);
33
+ // @ts-ignore
34
+ gridTable.children.push(importBtn);
35
+ // @ts-ignore
36
+ gridTable.children.push(exportBtn);
37
+ // @ts-ignore
38
+ gridTable.children.push(exportRecordBtn);
39
+ // @ts-ignore
40
+ listview.children.push(simpleSearch);
41
+ // @ts-ignore
42
+ listview.children.push(gridTable);
43
+ return listview;
44
+ };
45
+ // @ts-ignore
46
+ _proto.ProListPageBuilder = function ProListPageBuilder() {
47
+ // @ts-ignore
48
+ var listview = this.designer.createControlInstance(// @ts-ignore
49
+ CONTROL_TYPE.LIST_VIEW);
50
+ listview.props.countType = "async";
51
+ var simpleSearch = this.designer.createControlInstance(// @ts-ignore
52
+ CONTROL_TYPE.SIMPLE_SEARCH);
53
+ var gridTable = this.designer.createControlInstance(// @ts-ignore
54
+ CONTROL_TYPE.GRID_TABLE);
55
+ // @ts-ignore
56
+ var exportBtn = this.designer.createControlInstance(// @ts-ignore
57
+ CONTROL_TYPE.EXPORT_LIST_BUTTON);
58
+ var exportRecordBtn = this.designer.createControlInstance(// @ts-ignore
59
+ CONTROL_TYPE.EXPORT_RECORD_LIST_BUTTON);
60
+ // @ts-ignore
61
+ gridTable.children.push(exportBtn);
62
+ // @ts-ignore
63
+ gridTable.children.push(exportRecordBtn);
64
+ // @ts-ignore
65
+ listview.children.push(simpleSearch);
66
+ // @ts-ignore
67
+ listview.children.push(gridTable);
68
+ return listview;
69
+ };
70
+ // @ts-ignore
71
+ _proto.FormPageBuilder = function FormPageBuilder() {
72
+ var dataView = this.designer.createControlInstance(// @ts-ignore
73
+ CONTROL_TYPE.DATA_VIEW);
74
+ // @ts-ignore
75
+ var title = this.designer.createControlInstance(CONTROL_TYPE.TITLE);
76
+ // @ts-ignore
77
+ var grid = this.designer.createControlInstance(CONTROL_TYPE.GRID);
78
+ // @ts-ignore
79
+ dataView.children.push(title);
80
+ // @ts-ignore
81
+ dataView.children.push(grid);
82
+ return dataView;
83
+ };
84
+ // @ts-ignore
85
+ _proto.VuePageBuilder = function VuePageBuilder() {
86
+ var grid = this.designer.createControlInstance(// @ts-ignore
87
+ CONTROL_TYPE.GRID);
88
+ var vueFormItem = this.designer.createControlInstance(// @ts-ignore
89
+ CONTROL_TYPE.VUE_FORM_ITEM);
90
+ // @ts-ignore
91
+ vueFormItem.props.isHideCaption = true;
92
+ // @ts-ignore
93
+ vueFormItem.props.controlExportName = "VuePage";
94
+ // @ts-ignore
95
+ grid.children.push(vueFormItem);
96
+ return grid;
97
+ };
138
98
  return Builder;
139
99
  }();
@@ -46,33 +46,6 @@ 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
- }
63
- function _defineProperty(obj, key, value) {
64
- if (key in obj) {
65
- Object.defineProperty(obj, key, {
66
- value: value,
67
- enumerable: true,
68
- configurable: true,
69
- writable: true
70
- });
71
- } else {
72
- obj[key] = value;
73
- }
74
- return obj;
75
- }
76
49
  function _getPrototypeOf(o) {
77
50
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
78
51
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -264,115 +237,87 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
264
237
  _classCallCheck(this, Designer);
265
238
  var _this;
266
239
  _this = _super.call(this, "Designer");
267
- _defineProperty(_assertThisInitialized(_this), "toolbox", []);
268
- _defineProperty(_assertThisInitialized(_this), "services", {});
269
- _defineProperty(_assertThisInitialized(_this), "eventLogic", new EventLogic());
270
- _defineProperty(_assertThisInitialized(_this), "fieldTypes", FieldTypes);
271
- _defineProperty(_assertThisInitialized(_this), "controlSettingMap", new Map());
240
+ _this.toolbox = [];
241
+ _this.services = {};
242
+ _this.eventLogic = new EventLogic();
243
+ _this.fieldTypes = FieldTypes;
244
+ _this.controlSettingMap = new Map();
272
245
  (_instanceof(this, Designer) ? this.constructor : void 0).staticControls.forEach(function(control) {
273
246
  var _$Designer = control.Designer, Setting = control.Setting;
274
247
  _this.controlSettingMap.set(_$Designer.controlType, Setting);
275
248
  });
276
249
  return _this;
277
250
  }
278
- _createClass(Designer, [
279
- {
280
- key: "registerControl",
281
- value: function registerControl(control) {
282
- this.constructor.register(control);
283
- var DesignerClass = control.Designer, Setting = control.Setting;
284
- this.register(DesignerClass);
285
- this.registeredControlTypes.add(DesignerClass.controlType);
286
- this.controlSettingMap.set(DesignerClass.controlType, Setting);
287
- }
288
- },
289
- {
290
- key: "getControlSetting",
291
- value: function getControlSetting(type) {
292
- var setting = this.controlSettingMap.get(type);
293
- if (!setting) {
294
- return null;
295
- }
296
- return setting;
297
- }
298
- },
299
- {
300
- key: "setInstance",
301
- value: function setInstance(instance, props, value) {
302
- try {
303
- if (!instance) {
304
- return;
305
- }
306
- // @ts-ignore
307
- instance.updateProps(props, value);
308
- } catch (e) {
309
- throw e;
310
- }
311
- }
312
- },
313
- {
314
- key: "eachControls",
315
- value: function eachControls(callback) {
316
- this.getControls().forEach(callback);
251
+ var _proto = Designer.prototype;
252
+ _proto.registerControl = function registerControl(control) {
253
+ this.constructor.register(control);
254
+ var DesignerClass = control.Designer, Setting = control.Setting;
255
+ this.register(DesignerClass);
256
+ this.registeredControlTypes.add(DesignerClass.controlType);
257
+ this.controlSettingMap.set(DesignerClass.controlType, Setting);
258
+ };
259
+ _proto.getControlSetting = function getControlSetting(type) {
260
+ var setting = this.controlSettingMap.get(type);
261
+ if (!setting) {
262
+ return null;
263
+ }
264
+ return setting;
265
+ };
266
+ _proto.setInstance = function setInstance(instance, props, value) {
267
+ try {
268
+ if (!instance) {
269
+ return;
317
270
  }
318
- },
319
- {
320
- key: "getInitControl",
321
- value: // 获取初始化的数据模型
322
- function getInitControl() {
323
- // @ts-ignore
271
+ // @ts-ignore
272
+ instance.updateProps(props, value);
273
+ } catch (e) {
274
+ throw e;
275
+ }
276
+ };
277
+ _proto.eachControls = function eachControls(callback) {
278
+ this.getControls().forEach(callback);
279
+ };
280
+ // 获取初始化的数据模型
281
+ _proto.getInitControl = function getInitControl() {
282
+ // @ts-ignore
283
+ return [
284
+ this.createControlInstance("grid")
285
+ ];
286
+ };
287
+ _proto.checkSchema = function checkSchema1() {
288
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
289
+ args[_key] = arguments[_key];
290
+ }
291
+ return _asyncToGenerator(function() {
292
+ return __generator(this, function(_state) {
324
293
  return [
325
- this.createControlInstance("grid")
294
+ 2,
295
+ checkSchema.apply(void 0, _toConsumableArray(args))
326
296
  ];
327
- }
328
- },
329
- {
330
- key: "checkSchema",
331
- value: function checkSchema1() {
332
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
333
- args[_key] = arguments[_key];
334
- }
335
- return _asyncToGenerator(function() {
336
- return __generator(this, function(_state) {
337
- return [
338
- 2,
339
- checkSchema.apply(void 0, _toConsumableArray(args))
340
- ];
341
- });
342
- })();
343
- }
344
- },
345
- {
346
- key: "getModelBindInfoList",
347
- value: function getModelBindInfoList1() {
348
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
349
- args[_key] = arguments[_key];
350
- }
351
- return getModelBindInfoList.apply(void 0, _toConsumableArray(args));
352
- }
353
- },
354
- {
355
- key: "getSchema",
356
- value: function getSchema() {
357
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
358
- args[_key] = arguments[_key];
359
- }
360
- return toSchema.apply(void 0, _toConsumableArray(args));
361
- }
362
- },
363
- {
364
- key: "listenControlHook",
365
- value: function listenControlHook() {
366
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
367
- args[_key] = arguments[_key];
368
- }
369
- var _controlHooksEmitter;
370
- return (_controlHooksEmitter = controlHooksEmitter).on.apply(_controlHooksEmitter, _toConsumableArray(args));
371
- }
297
+ });
298
+ })();
299
+ };
300
+ _proto.getModelBindInfoList = function getModelBindInfoList1() {
301
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
302
+ args[_key] = arguments[_key];
372
303
  }
373
- ]);
304
+ return getModelBindInfoList.apply(void 0, _toConsumableArray(args));
305
+ };
306
+ _proto.getSchema = function getSchema() {
307
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
308
+ args[_key] = arguments[_key];
309
+ }
310
+ return toSchema.apply(void 0, _toConsumableArray(args));
311
+ };
312
+ _proto.listenControlHook = function listenControlHook() {
313
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
314
+ args[_key] = arguments[_key];
315
+ }
316
+ var _controlHooksEmitter;
317
+ return (_controlHooksEmitter = controlHooksEmitter).on.apply(_controlHooksEmitter, _toConsumableArray(args));
318
+ };
374
319
  return Designer;
375
320
  }(RegisterControls);
376
- _defineProperty(Designer, "EventLogic", EventLogic);
321
+ Designer.EventLogic = EventLogic;
377
322
  export { Designer as default };
378
323
  export { Designer };