@byteluck-fe/model-driven-engine 2.7.0-alpha.15a → 2.7.0-alpha.15c

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.
@@ -1,10 +1,10 @@
1
- function _arrayLikeToArray(arr, len) {
1
+ function _array_like_to_array(arr, len) {
2
2
  if (len == null || len > arr.length) len = arr.length;
3
3
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
4
  return arr2;
5
5
  }
6
- function _arrayWithoutHoles(arr) {
7
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
6
+ function _array_without_holes(arr) {
7
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
8
8
  }
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
10
10
  try {
@@ -20,7 +20,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
20
20
  Promise.resolve(value).then(_next, _throw);
21
21
  }
22
22
  }
23
- function _asyncToGenerator(fn) {
23
+ function _async_to_generator(fn) {
24
24
  return function() {
25
25
  var self = this, args = arguments;
26
26
  return new Promise(function(resolve, reject) {
@@ -35,7 +35,7 @@ function _asyncToGenerator(fn) {
35
35
  });
36
36
  };
37
37
  }
38
- function _classCallCheck(instance, Constructor) {
38
+ function _class_call_check(instance, Constructor) {
39
39
  if (!(instance instanceof Constructor)) {
40
40
  throw new TypeError("Cannot call a class as a function");
41
41
  }
@@ -49,44 +49,151 @@ function _defineProperties(target, props) {
49
49
  Object.defineProperty(target, descriptor.key, descriptor);
50
50
  }
51
51
  }
52
- function _createClass(Constructor, protoProps, staticProps) {
52
+ function _create_class(Constructor, protoProps, staticProps) {
53
53
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
54
54
  if (staticProps) _defineProperties(Constructor, staticProps);
55
55
  return Constructor;
56
56
  }
57
- function _iterableToArray(iter) {
57
+ function _define_property(obj, key, value) {
58
+ if (key in obj) {
59
+ Object.defineProperty(obj, key, {
60
+ value: value,
61
+ enumerable: true,
62
+ configurable: true,
63
+ writable: true
64
+ });
65
+ } else {
66
+ obj[key] = value;
67
+ }
68
+ return obj;
69
+ }
70
+ function _iterable_to_array(iter) {
58
71
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
59
72
  }
60
- function _nonIterableSpread() {
73
+ function _non_iterable_spread() {
61
74
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
62
75
  }
63
- function _toConsumableArray(arr) {
64
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
76
+ function _to_consumable_array(arr) {
77
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
65
78
  }
66
- function _unsupportedIterableToArray(o, minLen) {
79
+ function _unsupported_iterable_to_array(o, minLen) {
67
80
  if (!o) return;
68
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
81
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
69
82
  var n = Object.prototype.toString.call(o).slice(8, -1);
70
83
  if (n === "Object" && o.constructor) n = o.constructor.name;
71
84
  if (n === "Map" || n === "Set") return Array.from(n);
72
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
85
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
86
+ }
87
+ function _ts_generator(thisArg, body) {
88
+ var f, y, t, g, _ = {
89
+ label: 0,
90
+ sent: function() {
91
+ if (t[0] & 1) throw t[1];
92
+ return t[1];
93
+ },
94
+ trys: [],
95
+ ops: []
96
+ };
97
+ return g = {
98
+ next: verb(0),
99
+ "throw": verb(1),
100
+ "return": verb(2)
101
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
102
+ return this;
103
+ }), g;
104
+ function verb(n) {
105
+ return function(v) {
106
+ return step([
107
+ n,
108
+ v
109
+ ]);
110
+ };
111
+ }
112
+ function step(op) {
113
+ if (f) throw new TypeError("Generator is already executing.");
114
+ while(_)try {
115
+ 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;
116
+ if (y = 0, t) op = [
117
+ op[0] & 2,
118
+ t.value
119
+ ];
120
+ switch(op[0]){
121
+ case 0:
122
+ case 1:
123
+ t = op;
124
+ break;
125
+ case 4:
126
+ _.label++;
127
+ return {
128
+ value: op[1],
129
+ done: false
130
+ };
131
+ case 5:
132
+ _.label++;
133
+ y = op[1];
134
+ op = [
135
+ 0
136
+ ];
137
+ continue;
138
+ case 7:
139
+ op = _.ops.pop();
140
+ _.trys.pop();
141
+ continue;
142
+ default:
143
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
144
+ _ = 0;
145
+ continue;
146
+ }
147
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
148
+ _.label = op[1];
149
+ break;
150
+ }
151
+ if (op[0] === 6 && _.label < t[1]) {
152
+ _.label = t[1];
153
+ t = op;
154
+ break;
155
+ }
156
+ if (t && _.label < t[2]) {
157
+ _.label = t[2];
158
+ _.ops.push(op);
159
+ break;
160
+ }
161
+ if (t[2]) _.ops.pop();
162
+ _.trys.pop();
163
+ continue;
164
+ }
165
+ op = body.call(thisArg, _);
166
+ } catch (e) {
167
+ op = [
168
+ 6,
169
+ e
170
+ ];
171
+ y = 0;
172
+ } finally{
173
+ f = t = 0;
174
+ }
175
+ if (op[0] & 5) throw op[1];
176
+ return {
177
+ value: op[0] ? op[1] : void 0,
178
+ done: true
179
+ };
180
+ }
73
181
  }
74
- import regeneratorRuntime from "regenerator-runtime";
75
- import { error, logerror } from '@byteluck-fe/model-driven-shared';
182
+ import { error, logerror } from "@byteluck-fe/model-driven-shared";
76
183
  export var ActionManager = /*#__PURE__*/ function() {
77
184
  "use strict";
78
185
  function ActionManager() {
79
- _classCallCheck(this, ActionManager);
80
- this.actionMap = new Map();
81
- this.buildinActions = {};
186
+ _class_call_check(this, ActionManager);
187
+ _define_property(this, "actionMap", new Map());
188
+ _define_property(this, "buildinActions", {});
82
189
  /**
83
190
  * 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
84
- */ this.actionUtils = {};
191
+ */ _define_property(this, "actionUtils", {});
85
192
  /**
86
193
  * 用于存储es module解析出来的源码,CustomVueControlPlugin
87
- */ this.sources = {};
194
+ */ _define_property(this, "sources", {});
88
195
  }
89
- _createClass(ActionManager, [
196
+ _create_class(ActionManager, [
90
197
  {
91
198
  key: "execAction",
92
199
  value: function execAction(name, context) {
@@ -94,51 +201,60 @@ export var ActionManager = /*#__PURE__*/ function() {
94
201
  args[_key - 2] = arguments[_key];
95
202
  }
96
203
  var _this = this;
97
- return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
98
- var action, _func, result;
99
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
100
- while(1)switch(_ctx.prev = _ctx.next){
204
+ return _async_to_generator(function() {
205
+ var action, _action_func, result, e;
206
+ return _ts_generator(this, function(_state) {
207
+ switch(_state.label){
101
208
  case 0:
102
209
  action = _this.actionMap.get(name);
103
- if (action) {
104
- _ctx.next = 3;
105
- break;
210
+ if (!action) {
211
+ return [
212
+ 2
213
+ ];
106
214
  }
107
- return _ctx.abrupt("return");
215
+ _state.label = 1;
216
+ case 1:
217
+ _state.trys.push([
218
+ 1,
219
+ 3,
220
+ ,
221
+ 4
222
+ ]);
223
+ return [
224
+ 4,
225
+ (_action_func = action.func).call.apply(_action_func, [
226
+ null,
227
+ context
228
+ ].concat(_to_consumable_array(args)))
229
+ ];
230
+ case 2:
231
+ result = _state.sent();
232
+ return [
233
+ 2,
234
+ result
235
+ ];
108
236
  case 3:
109
- _ctx.prev = 3;
110
- ;
111
- _ctx.next = 7;
112
- return (_func = action.func).call.apply(_func, [
113
- null,
114
- context
115
- ].concat(_toConsumableArray(args)));
116
- case 7:
117
- result = _ctx.sent;
118
- return _ctx.abrupt("return", result);
119
- case 11:
120
- _ctx.prev = 11;
121
- _ctx.t0 = _ctx["catch"](3);
237
+ e = _state.sent();
122
238
  // 执行的时候不使用throw error,而是使用console.error,避免阻塞内置代码的执行
123
- logerror("".concat(action.id, " Exception during calling action: ").concat(_ctx.t0));
124
- case 14:
125
- case "end":
126
- return _ctx.stop();
239
+ logerror("".concat(action.id, " Exception during calling action: ").concat(e));
240
+ return [
241
+ 3,
242
+ 4
243
+ ];
244
+ case 4:
245
+ return [
246
+ 2
247
+ ];
127
248
  }
128
- }, _callee, null, [
129
- [
130
- 3,
131
- 11
132
- ]
133
- ]);
134
- }))();
249
+ });
250
+ })();
135
251
  }
136
252
  },
137
253
  {
138
254
  key: "addAction",
139
255
  value: function addAction(name, func) {
140
256
  if (this.actionMap.has(name)) {
141
- error('duplicated action key');
257
+ error("duplicated action key");
142
258
  }
143
259
  var action = new Action(name, func);
144
260
  this.actionMap.set(name, action);
@@ -149,8 +265,9 @@ export var ActionManager = /*#__PURE__*/ function() {
149
265
  }();
150
266
  var Action = function Action(id, func) {
151
267
  "use strict";
152
- _classCallCheck(this, Action);
153
- this.id = '';
268
+ _class_call_check(this, Action);
269
+ _define_property(this, "func", void 0);
270
+ _define_property(this, "id", "");
154
271
  this.id = id;
155
272
  this.func = func;
156
273
  };
@@ -12,7 +12,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
12
12
  Promise.resolve(value).then(_next, _throw);
13
13
  }
14
14
  }
15
- function _asyncToGenerator(fn) {
15
+ function _async_to_generator(fn) {
16
16
  return function() {
17
17
  var self = this, args = arguments;
18
18
  return new Promise(function(resolve, reject) {
@@ -27,7 +27,7 @@ function _asyncToGenerator(fn) {
27
27
  });
28
28
  };
29
29
  }
30
- function _classCallCheck(instance, Constructor) {
30
+ function _class_call_check(instance, Constructor) {
31
31
  if (!(instance instanceof Constructor)) {
32
32
  throw new TypeError("Cannot call a class as a function");
33
33
  }
@@ -41,21 +41,129 @@ function _defineProperties(target, props) {
41
41
  Object.defineProperty(target, descriptor.key, descriptor);
42
42
  }
43
43
  }
44
- function _createClass(Constructor, protoProps, staticProps) {
44
+ function _create_class(Constructor, protoProps, staticProps) {
45
45
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
46
46
  if (staticProps) _defineProperties(Constructor, staticProps);
47
47
  return Constructor;
48
48
  }
49
- import regeneratorRuntime from "regenerator-runtime";
50
- import { JSONCopy, logerror } from '@byteluck-fe/model-driven-shared';
49
+ function _define_property(obj, key, value) {
50
+ if (key in obj) {
51
+ Object.defineProperty(obj, key, {
52
+ value: value,
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true
56
+ });
57
+ } else {
58
+ obj[key] = value;
59
+ }
60
+ return obj;
61
+ }
62
+ function _ts_generator(thisArg, body) {
63
+ var f, y, t, g, _ = {
64
+ label: 0,
65
+ sent: function() {
66
+ if (t[0] & 1) throw t[1];
67
+ return t[1];
68
+ },
69
+ trys: [],
70
+ ops: []
71
+ };
72
+ return g = {
73
+ next: verb(0),
74
+ "throw": verb(1),
75
+ "return": verb(2)
76
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
77
+ return this;
78
+ }), g;
79
+ function verb(n) {
80
+ return function(v) {
81
+ return step([
82
+ n,
83
+ v
84
+ ]);
85
+ };
86
+ }
87
+ function step(op) {
88
+ if (f) throw new TypeError("Generator is already executing.");
89
+ while(_)try {
90
+ 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;
91
+ if (y = 0, t) op = [
92
+ op[0] & 2,
93
+ t.value
94
+ ];
95
+ switch(op[0]){
96
+ case 0:
97
+ case 1:
98
+ t = op;
99
+ break;
100
+ case 4:
101
+ _.label++;
102
+ return {
103
+ value: op[1],
104
+ done: false
105
+ };
106
+ case 5:
107
+ _.label++;
108
+ y = op[1];
109
+ op = [
110
+ 0
111
+ ];
112
+ continue;
113
+ case 7:
114
+ op = _.ops.pop();
115
+ _.trys.pop();
116
+ continue;
117
+ default:
118
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
119
+ _ = 0;
120
+ continue;
121
+ }
122
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
123
+ _.label = op[1];
124
+ break;
125
+ }
126
+ if (op[0] === 6 && _.label < t[1]) {
127
+ _.label = t[1];
128
+ t = op;
129
+ break;
130
+ }
131
+ if (t && _.label < t[2]) {
132
+ _.label = t[2];
133
+ _.ops.push(op);
134
+ break;
135
+ }
136
+ if (t[2]) _.ops.pop();
137
+ _.trys.pop();
138
+ continue;
139
+ }
140
+ op = body.call(thisArg, _);
141
+ } catch (e) {
142
+ op = [
143
+ 6,
144
+ e
145
+ ];
146
+ y = 0;
147
+ } finally{
148
+ f = t = 0;
149
+ }
150
+ if (op[0] & 5) throw op[1];
151
+ return {
152
+ value: op[0] ? op[1] : void 0,
153
+ done: true
154
+ };
155
+ }
156
+ }
157
+ import { JSONCopy, logerror } from "@byteluck-fe/model-driven-shared";
51
158
  export var DataManager = /*#__PURE__*/ function() {
52
159
  "use strict";
53
160
  function DataManager(callbackExecuter) {
54
- _classCallCheck(this, DataManager);
55
- this._dataStore = new Map();
161
+ _class_call_check(this, DataManager);
162
+ _define_property(this, "_dataStore", new Map());
163
+ _define_property(this, "executer", void 0);
56
164
  this.executer = callbackExecuter;
57
165
  }
58
- _createClass(DataManager, [
166
+ _create_class(DataManager, [
59
167
  {
60
168
  key: "add",
61
169
  value: function add(key, data) {
@@ -79,24 +187,25 @@ export var DataManager = /*#__PURE__*/ function() {
79
187
  key: "getRemoteData",
80
188
  value: function getRemoteData(payload) {
81
189
  var _this = this;
82
- return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
83
- return regeneratorRuntime.wrap(function _callee$(_ctx) {
84
- while(1)switch(_ctx.prev = _ctx.next){
85
- case 0:
86
- if (!(_this.executer === undefined)) {
87
- _ctx.next = 5;
88
- break;
89
- }
90
- logerror('未初始化executer');
91
- return _ctx.abrupt("return", []);
92
- case 5:
93
- return _ctx.abrupt("return", _this.executer(payload));
94
- case 6:
95
- case "end":
96
- return _ctx.stop();
190
+ return _async_to_generator(function() {
191
+ return _ts_generator(this, function(_state) {
192
+ if (_this.executer === undefined) {
193
+ logerror("未初始化executer");
194
+ return [
195
+ 2,
196
+ []
197
+ ];
198
+ } else {
199
+ return [
200
+ 2,
201
+ _this.executer(payload)
202
+ ];
97
203
  }
98
- }, _callee);
99
- }))();
204
+ return [
205
+ 2
206
+ ];
207
+ });
208
+ })();
100
209
  }
101
210
  }
102
211
  ]);