@byteluck-fe/model-driven-engine 2.7.0-alpha.0 → 2.7.0-alpha.2

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.
@@ -40,20 +40,6 @@ function _classCallCheck(instance, Constructor) {
40
40
  throw new TypeError("Cannot call a class as a function");
41
41
  }
42
42
  }
43
- function _defineProperties(target, props) {
44
- for(var i = 0; i < props.length; i++){
45
- var descriptor = props[i];
46
- descriptor.enumerable = descriptor.enumerable || false;
47
- descriptor.configurable = true;
48
- if ("value" in descriptor) descriptor.writable = true;
49
- Object.defineProperty(target, descriptor.key, descriptor);
50
- }
51
- }
52
- function _createClass(Constructor, protoProps, staticProps) {
53
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
54
- if (staticProps) _defineProperties(Constructor, staticProps);
55
- return Constructor;
56
- }
57
43
  function _iterableToArrayLimit(arr, i) {
58
44
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
59
45
  if (_i == null) return;
@@ -92,12 +78,106 @@ function _unsupportedIterableToArray(o, minLen) {
92
78
  if (n === "Map" || n === "Set") return Array.from(n);
93
79
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
94
80
  }
95
- import regeneratorRuntime from "regenerator-runtime";
81
+ var __generator = this && this.__generator || function(thisArg, body) {
82
+ var f, y, t, g, _ = {
83
+ label: 0,
84
+ sent: function() {
85
+ if (t[0] & 1) throw t[1];
86
+ return t[1];
87
+ },
88
+ trys: [],
89
+ ops: []
90
+ };
91
+ return(g = {
92
+ next: verb(0),
93
+ "throw": verb(1),
94
+ "return": verb(2)
95
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
96
+ return this;
97
+ }), g);
98
+ function verb(n) {
99
+ return function(v) {
100
+ return step([
101
+ n,
102
+ v
103
+ ]);
104
+ };
105
+ }
106
+ function step(op) {
107
+ if (f) throw new TypeError("Generator is already executing.");
108
+ while(_)try {
109
+ 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;
110
+ if (y = 0, t) op = [
111
+ op[0] & 2,
112
+ t.value
113
+ ];
114
+ switch(op[0]){
115
+ case 0:
116
+ case 1:
117
+ t = op;
118
+ break;
119
+ case 4:
120
+ _.label++;
121
+ return {
122
+ value: op[1],
123
+ done: false
124
+ };
125
+ case 5:
126
+ _.label++;
127
+ y = op[1];
128
+ op = [
129
+ 0
130
+ ];
131
+ continue;
132
+ case 7:
133
+ op = _.ops.pop();
134
+ _.trys.pop();
135
+ continue;
136
+ default:
137
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
138
+ _ = 0;
139
+ continue;
140
+ }
141
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
142
+ _.label = op[1];
143
+ break;
144
+ }
145
+ if (op[0] === 6 && _.label < t[1]) {
146
+ _.label = t[1];
147
+ t = op;
148
+ break;
149
+ }
150
+ if (t && _.label < t[2]) {
151
+ _.label = t[2];
152
+ _.ops.push(op);
153
+ break;
154
+ }
155
+ if (t[2]) _.ops.pop();
156
+ _.trys.pop();
157
+ continue;
158
+ }
159
+ op = body.call(thisArg, _);
160
+ } catch (e) {
161
+ op = [
162
+ 6,
163
+ e
164
+ ];
165
+ y = 0;
166
+ } finally{
167
+ f = t = 0;
168
+ }
169
+ if (op[0] & 5) throw op[1];
170
+ return {
171
+ value: op[0] ? op[1] : void 0,
172
+ done: true
173
+ };
174
+ }
175
+ };
96
176
  var LifecycleEventKeyMap = {
97
- 'engine-mounted': 'did_mount',
98
- 'engine-submit': 'will_submit',
99
- 'engine-submit-params': 'do_submit',
100
- 'engine-submitted': 'did_submit'
177
+ "engine-mounted": "did_mount",
178
+ "engine-submit": "will_submit",
179
+ "engine-submit-params": "do_submit",
180
+ "engine-submitted": "did_submit"
101
181
  };
102
182
  export var LifecycleEventPlugin = /*#__PURE__*/ function() {
103
183
  "use strict";
@@ -105,97 +185,100 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
105
185
  _classCallCheck(this, LifecycleEventPlugin);
106
186
  this.config = config;
107
187
  }
108
- _createClass(LifecycleEventPlugin, [
109
- {
110
- key: "apply",
111
- value: function apply(engine) {
112
- var _this = this;
113
- this.engine = engine;
114
- Object.entries(LifecycleEventKeyMap).forEach(function(param) {
115
- var _param = _slicedToArray(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
116
- var _this1 = _this;
117
- engine.on(engineKey, function() {
118
- var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(payload) {
119
- var result;
120
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
121
- while(1)switch(_ctx.prev = _ctx.next){
122
- case 0:
123
- _ctx.next = 2;
124
- return _this1.callLifecycleEvent(lifecycleKey, payload);
125
- case 2:
126
- result = _ctx.sent;
127
- if (!result.includes(false)) {
128
- _ctx.next = 7;
129
- break;
130
- }
131
- return _ctx.abrupt("return", false);
132
- case 7:
133
- return _ctx.abrupt("return", result);
134
- case 8:
135
- case "end":
136
- return _ctx.stop();
137
- }
138
- }, _callee);
139
- }));
140
- return function(payload) {
141
- return _ref.apply(this, arguments);
142
- };
143
- }());
144
- });
145
- }
146
- },
147
- {
148
- key: "callLifecycleEvent",
149
- value: function callLifecycleEvent(name, payload) {
150
- var _this = this;
151
- return _asyncToGenerator(regeneratorRuntime.mark(function _callee1() {
152
- var events, result;
153
- return regeneratorRuntime.wrap(function _callee$(_ctx1) {
154
- while(1)switch(_ctx1.prev = _ctx1.next){
188
+ var _proto = LifecycleEventPlugin.prototype;
189
+ _proto.apply = function apply(engine) {
190
+ var _this = this;
191
+ this.engine = engine;
192
+ Object.entries(LifecycleEventKeyMap).forEach(function(param) {
193
+ var _param = _slicedToArray(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
194
+ var _this1 = _this;
195
+ engine.on(engineKey, function() {
196
+ var _ref = _asyncToGenerator(function(payload) {
197
+ var result;
198
+ return __generator(this, function(_state) {
199
+ switch(_state.label){
155
200
  case 0:
156
- events = _this.config;
157
- if (!(!events || !Array.isArray(events[name]))) {
158
- _ctx1.next = 3;
159
- break;
201
+ return [
202
+ 4,
203
+ _this1.callLifecycleEvent(lifecycleKey, payload)
204
+ ];
205
+ case 1:
206
+ result = _state.sent();
207
+ if (result.includes(false)) {
208
+ return [
209
+ 2,
210
+ false
211
+ ];
212
+ } else {
213
+ return [
214
+ 2,
215
+ result
216
+ ];
160
217
  }
161
- return _ctx1.abrupt("return", []);
162
- case 3:
163
- _ctx1.next = 5;
164
- return Promise.all(events[name].map(function() {
165
- var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(eventName) {
166
- var execResult;
167
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
168
- while(1)switch(_ctx.prev = _ctx.next){
169
- case 0:
170
- _ctx.next = 2;
171
- return _this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
218
+ return [
219
+ 2
220
+ ];
221
+ }
222
+ });
223
+ });
224
+ return function(payload) {
225
+ return _ref.apply(this, arguments);
226
+ };
227
+ }());
228
+ });
229
+ };
230
+ _proto.callLifecycleEvent = function callLifecycleEvent(name, payload) {
231
+ var _this = this;
232
+ return _asyncToGenerator(function() {
233
+ var events, result;
234
+ return __generator(this, function(_state) {
235
+ switch(_state.label){
236
+ case 0:
237
+ events = _this.config;
238
+ if (!events || !Array.isArray(events[name])) {
239
+ return [
240
+ 2,
241
+ []
242
+ ];
243
+ }
244
+ return [
245
+ 4,
246
+ Promise.all(events[name].map(function() {
247
+ var _ref = _asyncToGenerator(function(eventName) {
248
+ var execResult;
249
+ return __generator(this, function(_state) {
250
+ switch(_state.label){
251
+ case 0:
252
+ return [
253
+ 4,
254
+ _this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
172
255
  // this.engine,
173
256
  // this.engine.getAction().actionUtils, //以前是params,空的
174
- payload);
175
- case 2:
176
- execResult = _ctx.sent;
177
- return _ctx.abrupt("return", execResult);
178
- case 4:
179
- case "end":
180
- return _ctx.stop();
181
- }
182
- }, _callee);
183
- }));
184
- return function(eventName) {
185
- return _ref.apply(this, arguments);
186
- };
187
- }()));
188
- case 5:
189
- result = _ctx1.sent;
190
- return _ctx1.abrupt("return", result);
191
- case 7:
192
- case "end":
193
- return _ctx1.stop();
194
- }
195
- }, _callee1);
196
- }))();
197
- }
198
- }
199
- ]);
257
+ payload)
258
+ ];
259
+ case 1:
260
+ execResult = _state.sent();
261
+ return [
262
+ 2,
263
+ execResult
264
+ ];
265
+ }
266
+ });
267
+ });
268
+ return function(eventName) {
269
+ return _ref.apply(this, arguments);
270
+ };
271
+ }()))
272
+ ];
273
+ case 1:
274
+ result = _state.sent();
275
+ return [
276
+ 2,
277
+ result
278
+ ];
279
+ }
280
+ });
281
+ })();
282
+ };
200
283
  return LifecycleEventPlugin;
201
284
  }();
@@ -3,42 +3,24 @@ 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
6
  export var StylePlugin = /*#__PURE__*/ function() {
21
7
  "use strict";
22
8
  function StylePlugin(config) {
23
9
  _classCallCheck(this, StylePlugin);
24
10
  this.config = config;
25
11
  }
26
- _createClass(StylePlugin, [
27
- {
28
- key: "apply",
29
- value: function apply(engine) {
30
- var ref;
31
- this.engine = engine;
32
- var ref1;
33
- var compiledStyle = (ref1 = (ref = this.config) === null || ref === void 0 ? void 0 : ref.source) !== null && ref1 !== void 0 ? ref1 : '';
34
- var style = document.createElement('style');
35
- style.className = 'edit-css';
36
- style.type = 'text/css';
37
- style.innerHTML = compiledStyle;
38
- var dom = document.querySelector('head');
39
- dom.appendChild(style);
40
- }
41
- }
42
- ]);
12
+ var _proto = StylePlugin.prototype;
13
+ _proto.apply = function apply(engine) {
14
+ var _this_config;
15
+ this.engine = engine;
16
+ var _this_config_source;
17
+ var compiledStyle = (_this_config_source = (_this_config = this.config) === null || _this_config === void 0 ? void 0 : _this_config.source) !== null && _this_config_source !== void 0 ? _this_config_source : "";
18
+ var style = document.createElement("style");
19
+ style.className = "edit-css";
20
+ style.type = "text/css";
21
+ style.innerHTML = compiledStyle;
22
+ var dom = document.querySelector("head");
23
+ dom.appendChild(style);
24
+ };
43
25
  return StylePlugin;
44
26
  }();
@@ -1,5 +1,5 @@
1
- export * from './ES6ModulePlugin';
2
- export * from './LifecycleEventPlugin';
3
- export * from './ControlsEventPlugin';
4
- export * from './CalcPlugin';
5
- export * from './StylePlugin';
1
+ export * from "./ES6ModulePlugin";
2
+ export * from "./LifecycleEventPlugin";
3
+ export * from "./ControlsEventPlugin";
4
+ export * from "./CalcPlugin";
5
+ export * from "./StylePlugin";
@@ -1 +1 @@
1
- export * from './runtimeUtils';
1
+ export * from "./runtimeUtils";
@@ -1,4 +1,4 @@
1
- import { CONTROL_BASE_TYPE, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
1
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
2
2
  export function hasChildrenControl(instance) {
3
3
  return instance.controlType === CONTROL_BASE_TYPE.LAYOUT || instance.controlType === CONTROL_BASE_TYPE.WRAP || instance.controlType === CONTROL_BASE_TYPE.LIST || instance.controlType === CONTROL_BASE_TYPE.SEARCH;
4
4
  }
@@ -11,8 +11,7 @@ export function loopFormControl(control, callback) {
11
11
  var children = item.getChildrenFormControl();
12
12
  callback(item, children);
13
13
  } else if (hasChildrenControl(item)) {
14
- var ref;
15
- loopFormControl((ref = item) === null || ref === void 0 ? void 0 : ref.children, callback);
14
+ loopFormControl(item === null || item === void 0 ? void 0 : item.children, callback);
16
15
  // @ts-ignore
17
16
  } else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
18
17
  callback(item);
@@ -27,9 +26,8 @@ callback) {
27
26
  if (item.type === CONTROL_TYPE.DATA_VIEW || item.type === CONTROL_TYPE.SIMPLE_SEARCH) {
28
27
  callback(item);
29
28
  } else if (hasChildrenControl(item)) {
30
- var ref;
31
29
  // @ts-ignore
32
- loopDataViewControl((ref = item) === null || ref === void 0 ? void 0 : ref.children, callback);
30
+ loopDataViewControl(item === null || item === void 0 ? void 0 : item.children, callback);
33
31
  }
34
32
  });
35
33
  }
@@ -37,9 +35,9 @@ callback) {
37
35
  var unique = 0;
38
36
  // uuid生成
39
37
  export function buildUUID() {
40
- var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : '';
38
+ var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
41
39
  var time = Date.now();
42
40
  var random = Math.floor(Math.random() * 1000000000);
43
41
  unique++;
44
- return prefix + '_' + random + unique + String(time);
42
+ return prefix + "_" + random + unique + String(time);
45
43
  }