@byteluck-fe/model-driven-driven 2.7.0-alpha.1 → 2.7.0-alpha.11

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,97 +3,124 @@ function _classCallCheck(instance, Constructor) {
3
3
  throw new TypeError("Cannot call a class as a function");
4
4
  }
5
5
  }
6
- import Designer from "./Designer";
7
- import { CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
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
+ import Designer from './Designer';
21
+ import { CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
8
22
  export var Builder = /*#__PURE__*/ function() {
9
23
  "use strict";
10
24
  function Builder() {
11
25
  _classCallCheck(this, Builder);
12
26
  this.designer = new Designer();
13
27
  }
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
- };
28
+ _createClass(Builder, [
29
+ {
30
+ key: "ListPageBuilder",
31
+ value: // @ts-ignore
32
+ function ListPageBuilder() {
33
+ var listview = this.designer.createControlInstance(// @ts-ignore
34
+ CONTROL_TYPE.LIST_VIEW);
35
+ var simpleSearch = this.designer.createControlInstance(// @ts-ignore
36
+ CONTROL_TYPE.SIMPLE_SEARCH);
37
+ var gridTable = this.designer.createControlInstance(// @ts-ignore
38
+ CONTROL_TYPE.GRID_TABLE);
39
+ var createBtn = this.designer.createControlInstance(// @ts-ignore
40
+ CONTROL_TYPE.CREATE_FORM_LIST_BUTTON);
41
+ var importBtn = this.designer.createControlInstance(// @ts-ignore
42
+ CONTROL_TYPE.IMPORT_RECORD_LIST_BUTTON);
43
+ var exportBtn = this.designer.createControlInstance(// @ts-ignore
44
+ CONTROL_TYPE.EXPORT_LIST_BUTTON);
45
+ var exportRecordBtn = this.designer.createControlInstance(// @ts-ignore
46
+ CONTROL_TYPE.EXPORT_RECORD_LIST_BUTTON);
47
+ // @ts-ignore
48
+ gridTable.children.push(createBtn);
49
+ // @ts-ignore
50
+ gridTable.children.push(importBtn);
51
+ // @ts-ignore
52
+ gridTable.children.push(exportBtn);
53
+ // @ts-ignore
54
+ gridTable.children.push(exportRecordBtn);
55
+ // @ts-ignore
56
+ listview.children.push(simpleSearch);
57
+ // @ts-ignore
58
+ listview.children.push(gridTable);
59
+ return listview;
60
+ }
61
+ },
62
+ {
63
+ key: "ProListPageBuilder",
64
+ value: // @ts-ignore
65
+ function ProListPageBuilder() {
66
+ // @ts-ignore
67
+ var listview = this.designer.createControlInstance(// @ts-ignore
68
+ CONTROL_TYPE.LIST_VIEW);
69
+ listview.props.countType = 'async';
70
+ var simpleSearch = this.designer.createControlInstance(// @ts-ignore
71
+ CONTROL_TYPE.SIMPLE_SEARCH);
72
+ var gridTable = this.designer.createControlInstance(// @ts-ignore
73
+ CONTROL_TYPE.GRID_TABLE);
74
+ // @ts-ignore
75
+ var exportBtn = this.designer.createControlInstance(// @ts-ignore
76
+ CONTROL_TYPE.EXPORT_LIST_BUTTON);
77
+ var exportRecordBtn = this.designer.createControlInstance(// @ts-ignore
78
+ CONTROL_TYPE.EXPORT_RECORD_LIST_BUTTON);
79
+ // @ts-ignore
80
+ gridTable.children.push(exportBtn);
81
+ // @ts-ignore
82
+ gridTable.children.push(exportRecordBtn);
83
+ // @ts-ignore
84
+ listview.children.push(simpleSearch);
85
+ // @ts-ignore
86
+ listview.children.push(gridTable);
87
+ return listview;
88
+ }
89
+ },
90
+ {
91
+ key: "FormPageBuilder",
92
+ value: // @ts-ignore
93
+ function FormPageBuilder() {
94
+ var dataView = this.designer.createControlInstance(// @ts-ignore
95
+ CONTROL_TYPE.DATA_VIEW);
96
+ // @ts-ignore
97
+ var title = this.designer.createControlInstance(CONTROL_TYPE.TITLE);
98
+ // @ts-ignore
99
+ var grid = this.designer.createControlInstance(CONTROL_TYPE.GRID);
100
+ // @ts-ignore
101
+ dataView.children.push(title);
102
+ // @ts-ignore
103
+ dataView.children.push(grid);
104
+ return dataView;
105
+ }
106
+ },
107
+ {
108
+ key: "VuePageBuilder",
109
+ value: // @ts-ignore
110
+ function VuePageBuilder() {
111
+ var grid = this.designer.createControlInstance(// @ts-ignore
112
+ CONTROL_TYPE.GRID);
113
+ var vueFormItem = this.designer.createControlInstance(// @ts-ignore
114
+ CONTROL_TYPE.VUE_FORM_ITEM);
115
+ // @ts-ignore
116
+ vueFormItem.props.isHideCaption = true;
117
+ // @ts-ignore
118
+ vueFormItem.props.controlExportName = 'VuePage';
119
+ // @ts-ignore
120
+ grid.children.push(vueFormItem);
121
+ return grid;
122
+ }
123
+ }
124
+ ]);
98
125
  return Builder;
99
126
  }();
@@ -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 _getPrototypeOf(o) {
50
64
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
51
65
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -67,7 +81,7 @@ function _inherits(subClass, superClass) {
67
81
  }
68
82
  function _instanceof(left, right) {
69
83
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
70
- return !!right[Symbol.hasInstance](left);
84
+ return right[Symbol.hasInstance](left);
71
85
  } else {
72
86
  return left instanceof right;
73
87
  }
@@ -130,194 +144,131 @@ function _createSuper(Derived) {
130
144
  return _possibleConstructorReturn(this, result);
131
145
  };
132
146
  }
133
- var __generator = this && this.__generator || function(thisArg, body) {
134
- var f, y, t, g, _ = {
135
- label: 0,
136
- sent: function() {
137
- if (t[0] & 1) throw t[1];
138
- return t[1];
139
- },
140
- trys: [],
141
- ops: []
142
- };
143
- return g = {
144
- next: verb(0),
145
- "throw": verb(1),
146
- "return": verb(2)
147
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
148
- return this;
149
- }), g;
150
- function verb(n) {
151
- return function(v) {
152
- return step([
153
- n,
154
- v
155
- ]);
156
- };
157
- }
158
- function step(op) {
159
- if (f) throw new TypeError("Generator is already executing.");
160
- while(_)try {
161
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
162
- if (y = 0, t) op = [
163
- op[0] & 2,
164
- t.value
165
- ];
166
- switch(op[0]){
167
- case 0:
168
- case 1:
169
- t = op;
170
- break;
171
- case 4:
172
- _.label++;
173
- return {
174
- value: op[1],
175
- done: false
176
- };
177
- case 5:
178
- _.label++;
179
- y = op[1];
180
- op = [
181
- 0
182
- ];
183
- continue;
184
- case 7:
185
- op = _.ops.pop();
186
- _.trys.pop();
187
- continue;
188
- default:
189
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
190
- _ = 0;
191
- continue;
192
- }
193
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
194
- _.label = op[1];
195
- break;
196
- }
197
- if (op[0] === 6 && _.label < t[1]) {
198
- _.label = t[1];
199
- t = op;
200
- break;
201
- }
202
- if (t && _.label < t[2]) {
203
- _.label = t[2];
204
- _.ops.push(op);
205
- break;
206
- }
207
- if (t[2]) _.ops.pop();
208
- _.trys.pop();
209
- continue;
210
- }
211
- op = body.call(thisArg, _);
212
- } catch (e) {
213
- op = [
214
- 6,
215
- e
216
- ];
217
- y = 0;
218
- } finally{
219
- f = t = 0;
220
- }
221
- if (op[0] & 5) throw op[1];
222
- return {
223
- value: op[0] ? op[1] : void 0,
224
- done: true
225
- };
226
- }
227
- };
228
- import { RegisterControls, controlHooksEmitter } from "@byteluck-fe/model-driven-core";
229
- import EventLogic from "./EventLogic";
230
- import { FieldTypes } from "@byteluck-fe/model-driven-shared";
231
- import { toSchema, getModelBindInfoList, checkSchema } from "./utils";
232
- var Designer = /*#__PURE__*/ function _target(RegisterControls) {
147
+ import regeneratorRuntime from "regenerator-runtime";
148
+ import { RegisterControls, controlHooksEmitter } from '@byteluck-fe/model-driven-core';
149
+ import EventLogic from './EventLogic';
150
+ import { FieldTypes } from '@byteluck-fe/model-driven-shared';
151
+ import { toSchema, getModelBindInfoList, checkSchema } from './utils';
152
+ var Designer1 = /*#__PURE__*/ function _target(RegisterControls1) {
233
153
  "use strict";
234
- _inherits(Designer, RegisterControls);
235
- var _super = _createSuper(Designer);
236
- function Designer() {
237
- _classCallCheck(this, Designer);
154
+ _inherits(Designer1, RegisterControls1);
155
+ var _super = _createSuper(Designer1);
156
+ function Designer1() {
157
+ _classCallCheck(this, Designer1);
238
158
  var _this;
239
- _this = _super.call(this, "Designer");
159
+ _this = _super.call(this, 'Designer');
240
160
  _this.toolbox = [];
241
161
  _this.services = {};
242
162
  _this.eventLogic = new EventLogic();
243
163
  _this.fieldTypes = FieldTypes;
244
164
  _this.controlSettingMap = new Map();
245
- (_instanceof(this, Designer) ? this.constructor : void 0).staticControls.forEach(function(control) {
246
- var _$Designer = control.Designer, Setting = control.Setting;
247
- _this.controlSettingMap.set(_$Designer.controlType, Setting);
165
+ (_instanceof(this, Designer1) ? this.constructor : void 0).staticControls.forEach(function(control) {
166
+ var Designer2 = control.Designer, Setting = control.Setting;
167
+ _this.controlSettingMap.set(Designer2.controlType, Setting);
248
168
  });
249
169
  return _this;
250
170
  }
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;
171
+ _createClass(Designer1, [
172
+ {
173
+ key: "registerControl",
174
+ value: function registerControl(control) {
175
+ this.constructor.register(control);
176
+ var DesignerClass = control.Designer, Setting = control.Setting;
177
+ this.register(DesignerClass);
178
+ this.registeredControlTypes.add(DesignerClass.controlType);
179
+ this.controlSettingMap.set(DesignerClass.controlType, Setting);
270
180
  }
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) {
181
+ },
182
+ {
183
+ key: "getControlSetting",
184
+ value: function getControlSetting(type) {
185
+ var setting = this.controlSettingMap.get(type);
186
+ if (!setting) {
187
+ return null;
188
+ }
189
+ return setting;
190
+ }
191
+ },
192
+ {
193
+ key: "setInstance",
194
+ value: function setInstance(instance, props, value) {
195
+ try {
196
+ if (!instance) {
197
+ return;
198
+ }
199
+ // @ts-ignore
200
+ instance.updateProps(props, value);
201
+ } catch (e) {
202
+ throw e;
203
+ }
204
+ }
205
+ },
206
+ {
207
+ key: "eachControls",
208
+ value: function eachControls(callback) {
209
+ this.getControls().forEach(callback);
210
+ }
211
+ },
212
+ {
213
+ key: "getInitControl",
214
+ value: // 获取初始化的数据模型
215
+ function getInitControl() {
216
+ // @ts-ignore
293
217
  return [
294
- 2,
295
- checkSchema.apply(void 0, _toConsumableArray(args))
218
+ this.createControlInstance('grid')
296
219
  ];
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];
303
- }
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];
220
+ }
221
+ },
222
+ {
223
+ key: "checkSchema",
224
+ value: function checkSchema1() {
225
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
226
+ args[_key] = arguments[_key];
227
+ }
228
+ return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
229
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
230
+ while(1)switch(_ctx.prev = _ctx.next){
231
+ case 0:
232
+ return _ctx.abrupt("return", checkSchema.apply(void 0, _toConsumableArray(args)));
233
+ case 1:
234
+ case "end":
235
+ return _ctx.stop();
236
+ }
237
+ }, _callee);
238
+ }))();
239
+ }
240
+ },
241
+ {
242
+ key: "getModelBindInfoList",
243
+ value: function getModelBindInfoList1() {
244
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
245
+ args[_key] = arguments[_key];
246
+ }
247
+ return getModelBindInfoList.apply(void 0, _toConsumableArray(args));
248
+ }
249
+ },
250
+ {
251
+ key: "getSchema",
252
+ value: function getSchema() {
253
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
254
+ args[_key] = arguments[_key];
255
+ }
256
+ return toSchema.apply(void 0, _toConsumableArray(args));
257
+ }
258
+ },
259
+ {
260
+ key: "listenControlHook",
261
+ value: function listenControlHook() {
262
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
263
+ args[_key] = arguments[_key];
264
+ }
265
+ var _controlHooksEmitter;
266
+ return (_controlHooksEmitter = controlHooksEmitter).on.apply(_controlHooksEmitter, _toConsumableArray(args));
267
+ }
315
268
  }
316
- var _controlHooksEmitter;
317
- return (_controlHooksEmitter = controlHooksEmitter).on.apply(_controlHooksEmitter, _toConsumableArray(args));
318
- };
319
- return Designer;
269
+ ]);
270
+ return Designer1;
320
271
  }(RegisterControls);
321
- Designer.EventLogic = EventLogic;
322
- export { Designer as default };
323
- export { Designer };
272
+ Designer1.EventLogic = EventLogic;
273
+ export { Designer1 as default };
274
+ export { Designer1 as Designer };