@byteluck-fe/model-driven-engine 2.23.0-beta.26-zt → 2.23.0-beta.26-chrome86

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,321 +0,0 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _array_with_holes(arr) {
7
- if (Array.isArray(arr)) return arr;
8
- }
9
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
10
- try {
11
- var info = gen[key](arg);
12
- var value = info.value;
13
- } catch (error) {
14
- reject(error);
15
- return;
16
- }
17
- if (info.done) {
18
- resolve(value);
19
- } else {
20
- Promise.resolve(value).then(_next, _throw);
21
- }
22
- }
23
- function _async_to_generator(fn) {
24
- return function() {
25
- var self = this, args = arguments;
26
- return new Promise(function(resolve, reject) {
27
- var gen = fn.apply(self, args);
28
- function _next(value) {
29
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
30
- }
31
- function _throw(err) {
32
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
33
- }
34
- _next(undefined);
35
- });
36
- };
37
- }
38
- function _class_call_check(instance, Constructor) {
39
- if (!(instance instanceof Constructor)) {
40
- throw new TypeError("Cannot call a class as a function");
41
- }
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 _create_class(Constructor, protoProps, staticProps) {
53
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
54
- if (staticProps) _defineProperties(Constructor, staticProps);
55
- return Constructor;
56
- }
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_limit(arr, i) {
71
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
72
- if (_i == null) return;
73
- var _arr = [];
74
- var _n = true;
75
- var _d = false;
76
- var _s, _e;
77
- try {
78
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
79
- _arr.push(_s.value);
80
- if (i && _arr.length === i) break;
81
- }
82
- } catch (err) {
83
- _d = true;
84
- _e = err;
85
- } finally{
86
- try {
87
- if (!_n && _i["return"] != null) _i["return"]();
88
- } finally{
89
- if (_d) throw _e;
90
- }
91
- }
92
- return _arr;
93
- }
94
- function _non_iterable_rest() {
95
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
96
- }
97
- function _sliced_to_array(arr, i) {
98
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
99
- }
100
- function _unsupported_iterable_to_array(o, minLen) {
101
- if (!o) return;
102
- if (typeof o === "string") return _array_like_to_array(o, minLen);
103
- var n = Object.prototype.toString.call(o).slice(8, -1);
104
- if (n === "Object" && o.constructor) n = o.constructor.name;
105
- if (n === "Map" || n === "Set") return Array.from(n);
106
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
107
- }
108
- function _ts_generator(thisArg, body) {
109
- var f, y, t, g, _ = {
110
- label: 0,
111
- sent: function() {
112
- if (t[0] & 1) throw t[1];
113
- return t[1];
114
- },
115
- trys: [],
116
- ops: []
117
- };
118
- return g = {
119
- next: verb(0),
120
- "throw": verb(1),
121
- "return": verb(2)
122
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
123
- return this;
124
- }), g;
125
- function verb(n) {
126
- return function(v) {
127
- return step([
128
- n,
129
- v
130
- ]);
131
- };
132
- }
133
- function step(op) {
134
- if (f) throw new TypeError("Generator is already executing.");
135
- while(_)try {
136
- 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;
137
- if (y = 0, t) op = [
138
- op[0] & 2,
139
- t.value
140
- ];
141
- switch(op[0]){
142
- case 0:
143
- case 1:
144
- t = op;
145
- break;
146
- case 4:
147
- _.label++;
148
- return {
149
- value: op[1],
150
- done: false
151
- };
152
- case 5:
153
- _.label++;
154
- y = op[1];
155
- op = [
156
- 0
157
- ];
158
- continue;
159
- case 7:
160
- op = _.ops.pop();
161
- _.trys.pop();
162
- continue;
163
- default:
164
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
165
- _ = 0;
166
- continue;
167
- }
168
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
169
- _.label = op[1];
170
- break;
171
- }
172
- if (op[0] === 6 && _.label < t[1]) {
173
- _.label = t[1];
174
- t = op;
175
- break;
176
- }
177
- if (t && _.label < t[2]) {
178
- _.label = t[2];
179
- _.ops.push(op);
180
- break;
181
- }
182
- if (t[2]) _.ops.pop();
183
- _.trys.pop();
184
- continue;
185
- }
186
- op = body.call(thisArg, _);
187
- } catch (e) {
188
- op = [
189
- 6,
190
- e
191
- ];
192
- y = 0;
193
- } finally{
194
- f = t = 0;
195
- }
196
- if (op[0] & 5) throw op[1];
197
- return {
198
- value: op[0] ? op[1] : void 0,
199
- done: true
200
- };
201
- }
202
- }
203
- var LifecycleEventKeyMap = {
204
- 'engine-initialized': 'did_init',
205
- 'engine-mounted': 'did_mount',
206
- 'engine-submit': 'will_submit',
207
- 'engine-submit-params': 'do_submit',
208
- 'engine-submitted': 'did_submit'
209
- };
210
- export var LifecycleEventPlugin = /*#__PURE__*/ function() {
211
- "use strict";
212
- function LifecycleEventPlugin(config) {
213
- _class_call_check(this, LifecycleEventPlugin);
214
- _define_property(this, "config", void 0);
215
- _define_property(this, "engine", void 0);
216
- this.config = config;
217
- }
218
- _create_class(LifecycleEventPlugin, [
219
- {
220
- key: "apply",
221
- value: function apply(engine) {
222
- var _this = this;
223
- this.engine = engine;
224
- Object.entries(LifecycleEventKeyMap).forEach(function(param) {
225
- var _param = _sliced_to_array(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
226
- var _this1 = _this;
227
- engine.on(engineKey, /*#__PURE__*/ function() {
228
- var _ref = _async_to_generator(function(payload) {
229
- var result;
230
- return _ts_generator(this, function(_state) {
231
- switch(_state.label){
232
- case 0:
233
- return [
234
- 4,
235
- _this1.callLifecycleEvent(lifecycleKey, payload)
236
- ];
237
- case 1:
238
- result = _state.sent();
239
- if (result.includes(false)) {
240
- return [
241
- 2,
242
- false
243
- ];
244
- } else {
245
- return [
246
- 2,
247
- result
248
- ];
249
- }
250
- return [
251
- 2
252
- ];
253
- }
254
- });
255
- });
256
- return function(payload) {
257
- return _ref.apply(this, arguments);
258
- };
259
- }());
260
- });
261
- }
262
- },
263
- {
264
- key: "callLifecycleEvent",
265
- value: function callLifecycleEvent(name, payload) {
266
- var _this = this;
267
- return _async_to_generator(function() {
268
- var events, result;
269
- return _ts_generator(this, function(_state) {
270
- switch(_state.label){
271
- case 0:
272
- events = _this.config;
273
- if (!events || !Array.isArray(events[name])) {
274
- return [
275
- 2,
276
- []
277
- ];
278
- }
279
- return [
280
- 4,
281
- Promise.all(events[name].map(/*#__PURE__*/ function() {
282
- var _ref = _async_to_generator(function(eventName) {
283
- var execResult;
284
- return _ts_generator(this, function(_state) {
285
- switch(_state.label){
286
- case 0:
287
- return [
288
- 4,
289
- _this.engine.getAction().execAction(eventName, //qiyu 注释掉的两个参数变为全局参数
290
- // this.engine,
291
- // this.engine.getAction().actionUtils, //以前是params,空的
292
- payload)
293
- ];
294
- case 1:
295
- execResult = _state.sent();
296
- return [
297
- 2,
298
- execResult
299
- ];
300
- }
301
- });
302
- });
303
- return function(eventName) {
304
- return _ref.apply(this, arguments);
305
- };
306
- }()))
307
- ];
308
- case 1:
309
- result = _state.sent();
310
- return [
311
- 2,
312
- result
313
- ];
314
- }
315
- });
316
- })();
317
- }
318
- }
319
- ]);
320
- return LifecycleEventPlugin;
321
- }();
@@ -1,73 +0,0 @@
1
- /*
2
- * @Author: zhaoxiaoyang zhaoxiaoyang@byteluck.com
3
- * @Date: 2022-04-15 14:06:03
4
- * @LastEditors: SuperLuckyqi
5
- * @LastEditTime: 2024-11-08 11:17:53
6
- * @FilePath: /model-driven/packages/engine/src/plugins/StylePlugin.ts
7
- */ function _class_call_check(instance, Constructor) {
8
- if (!(instance instanceof Constructor)) {
9
- throw new TypeError("Cannot call a class as a function");
10
- }
11
- }
12
- function _defineProperties(target, props) {
13
- for(var i = 0; i < props.length; i++){
14
- var descriptor = props[i];
15
- descriptor.enumerable = descriptor.enumerable || false;
16
- descriptor.configurable = true;
17
- if ("value" in descriptor) descriptor.writable = true;
18
- Object.defineProperty(target, descriptor.key, descriptor);
19
- }
20
- }
21
- function _create_class(Constructor, protoProps, staticProps) {
22
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
23
- if (staticProps) _defineProperties(Constructor, staticProps);
24
- return Constructor;
25
- }
26
- function _define_property(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
- }
39
- export var StylePlugin = /*#__PURE__*/ function() {
40
- "use strict";
41
- function StylePlugin(config) {
42
- var isPC = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
43
- _class_call_check(this, StylePlugin);
44
- _define_property(this, "config", void 0);
45
- _define_property(this, "engine", void 0);
46
- _define_property(this, "isPc", void 0);
47
- this.config = config;
48
- this.isPc = isPC;
49
- }
50
- _create_class(StylePlugin, [
51
- {
52
- key: "apply",
53
- value: function apply(engine) {
54
- var _this_config;
55
- this.engine = engine;
56
- var _this_config_source;
57
- 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 : '';
58
- var style = document.createElement('style');
59
- style.className = 'edit-css-' + engine.id;
60
- var dom = document.querySelector('head');
61
- dom === null || dom === void 0 ? void 0 : dom.appendChild(style);
62
- var cssStyleText;
63
- if (this.isPc) {
64
- cssStyleText = ".render-engine-".concat(engine.id, "{ ").concat(compiledStyle, " }");
65
- } else {
66
- cssStyleText = compiledStyle;
67
- }
68
- style.appendChild(document.createTextNode(cssStyleText));
69
- }
70
- }
71
- ]);
72
- return StylePlugin;
73
- }();
@@ -1,5 +0,0 @@
1
- export * from './ES6ModulePlugin';
2
- export * from './LifecycleEventPlugin';
3
- export * from './ControlsEventPlugin';
4
- export * from './CalcPlugin';
5
- export * from './StylePlugin';
@@ -1 +0,0 @@
1
- export * from './runtimeUtils';
@@ -1,45 +0,0 @@
1
- import { CONTROL_BASE_TYPE, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
2
- export function hasChildrenControl(instance) {
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 || instance.controlType === CONTROL_BASE_TYPE.COLUMN && instance.type !== CONTROL_TYPE.OPERATION_COLUMN;
4
- }
5
- export function loopFormControl(control, callback) {
6
- if (Array.isArray(control)) {
7
- control.map(function(item) {
8
- //TODO 此处需要再抽象一层 datagrid/datalist
9
- // if (item.type === CONTROL_TYPE.SUBTABLE) {
10
- if (item.controlType === CONTROL_BASE_TYPE.LIST) {
11
- // @ts-ignore
12
- var children = []//item.getChildrenFormControl() as RuntimeFormControl[]
13
- ;
14
- callback(item, children);
15
- } else if (hasChildrenControl(item)) {
16
- loopFormControl(item === null || item === void 0 ? void 0 : item.children, callback);
17
- // @ts-ignore
18
- } else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
19
- callback(item);
20
- }
21
- });
22
- }
23
- }
24
- export function loopDataViewControl(control, // @ts-ignore
25
- callback) {
26
- if (Array.isArray(control)) {
27
- control.map(function(item) {
28
- if (item.type === CONTROL_TYPE.DATA_VIEW || item.type === CONTROL_TYPE.SIMPLE_SEARCH) {
29
- callback(item);
30
- } else if (hasChildrenControl(item)) {
31
- // @ts-ignore
32
- loopDataViewControl(item === null || item === void 0 ? void 0 : item.children, callback);
33
- }
34
- });
35
- }
36
- }
37
- var unique = 0;
38
- // uuid生成
39
- export function buildUUID() {
40
- var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : '';
41
- var time = Date.now();
42
- var random = Math.floor(Math.random() * 1000000000);
43
- unique++;
44
- return prefix + '_' + random + unique + String(time);
45
- }