@byteluck-fe/model-driven-engine 2.3.1-beta.23 → 2.3.1-beta.25
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.
- package/package.json +2 -2
- package/dist/esm/common/ActionManager.js +0 -238
- package/dist/esm/common/DataManager.js +0 -172
- package/dist/esm/common/Engine.js +0 -1401
- package/dist/esm/common/OkWorker.js +0 -89
- package/dist/esm/common/Plugin.js +0 -10
- package/dist/esm/common/Runtime.js +0 -289
- package/dist/esm/common/Store.js +0 -345
- package/dist/esm/common/checkerValue.js +0 -547
- package/dist/esm/common/index.js +0 -2
- package/dist/esm/common/proxyState.js +0 -315
- package/dist/esm/index.js +0 -3
- package/dist/esm/plugins/CalcPlugin.js +0 -398
- package/dist/esm/plugins/ControlsEventPlugin.js +0 -276
- package/dist/esm/plugins/ES6ModulePlugin.js +0 -147
- package/dist/esm/plugins/LifecycleEventPlugin.js +0 -284
- package/dist/esm/plugins/StylePlugin.js +0 -26
- package/dist/esm/plugins/index.js +0 -5
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/runtimeUtils.js +0 -43
- package/dist/index.umd.js +0 -28
- package/dist/types/common/ActionManager.d.ts +0 -14
- package/dist/types/common/DataManager.d.ts +0 -10
- package/dist/types/common/Engine.d.ts +0 -180
- package/dist/types/common/OkWorker.d.ts +0 -13
- package/dist/types/common/Plugin.d.ts +0 -6
- package/dist/types/common/Runtime.d.ts +0 -25
- package/dist/types/common/Store.d.ts +0 -49
- package/dist/types/common/checkerValue.d.ts +0 -3
- package/dist/types/common/index.d.ts +0 -2
- package/dist/types/common/proxyState.d.ts +0 -30
- package/dist/types/index.d.ts +0 -3
- package/dist/types/plugins/CalcPlugin.d.ts +0 -121
- package/dist/types/plugins/ControlsEventPlugin.d.ts +0 -15
- package/dist/types/plugins/ES6ModulePlugin.d.ts +0 -26
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +0 -14
- package/dist/types/plugins/StylePlugin.d.ts +0 -12
- package/dist/types/plugins/index.d.ts +0 -5
- package/dist/types/utils/index.d.ts +0 -1
- package/dist/types/utils/runtimeUtils.d.ts +0 -5
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
function _arrayLikeToArray(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 _arrayWithHoles(arr) {
|
|
7
|
-
if (Array.isArray(arr)) return arr;
|
|
8
|
-
}
|
|
9
|
-
function _classCallCheck(instance, Constructor) {
|
|
10
|
-
if (!(instance instanceof Constructor)) {
|
|
11
|
-
throw new TypeError("Cannot call a class as a function");
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
function _iterableToArrayLimit(arr, i) {
|
|
15
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
16
|
-
if (_i == null) return;
|
|
17
|
-
var _arr = [];
|
|
18
|
-
var _n = true;
|
|
19
|
-
var _d = false;
|
|
20
|
-
var _s, _e;
|
|
21
|
-
try {
|
|
22
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
23
|
-
_arr.push(_s.value);
|
|
24
|
-
if (i && _arr.length === i) break;
|
|
25
|
-
}
|
|
26
|
-
} catch (err) {
|
|
27
|
-
_d = true;
|
|
28
|
-
_e = err;
|
|
29
|
-
} finally{
|
|
30
|
-
try {
|
|
31
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
32
|
-
} finally{
|
|
33
|
-
if (_d) throw _e;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return _arr;
|
|
37
|
-
}
|
|
38
|
-
function _nonIterableRest() {
|
|
39
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
40
|
-
}
|
|
41
|
-
function _slicedToArray(arr, i) {
|
|
42
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
43
|
-
}
|
|
44
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
45
|
-
if (!o) return;
|
|
46
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
47
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
48
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
49
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
50
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
51
|
-
}
|
|
52
|
-
import { error } from "@byteluck-fe/model-driven-shared";
|
|
53
|
-
export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
54
|
-
"use strict";
|
|
55
|
-
function ES6ModulePlugin(config, env) {
|
|
56
|
-
_classCallCheck(this, ES6ModulePlugin);
|
|
57
|
-
this.config = config;
|
|
58
|
-
this.env = env;
|
|
59
|
-
}
|
|
60
|
-
var _proto = ES6ModulePlugin.prototype;
|
|
61
|
-
_proto.apply = function apply(engine) {
|
|
62
|
-
this.engine = engine;
|
|
63
|
-
var action = this.config;
|
|
64
|
-
if (!action) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
var res = parseModule(action, engine, this.env);
|
|
68
|
-
if (!res) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
var actionManager = engine.getAction();
|
|
72
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
73
|
-
try {
|
|
74
|
-
for(var _iterator = Object.entries(res.funcMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
75
|
-
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
76
|
-
actionManager.addAction(key, value);
|
|
77
|
-
}
|
|
78
|
-
} catch (err) {
|
|
79
|
-
_didIteratorError = true;
|
|
80
|
-
_iteratorError = err;
|
|
81
|
-
} finally{
|
|
82
|
-
try {
|
|
83
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
84
|
-
_iterator.return();
|
|
85
|
-
}
|
|
86
|
-
} finally{
|
|
87
|
-
if (_didIteratorError) {
|
|
88
|
-
throw _iteratorError;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
//qiyu state会proxy,将过深的变量存储会导致崩溃
|
|
93
|
-
// engine.setState('variables', res.variables)
|
|
94
|
-
};
|
|
95
|
-
return ES6ModulePlugin;
|
|
96
|
-
}();
|
|
97
|
-
export function parseModule(action, engine, env) {
|
|
98
|
-
if (!action.module || !action.module.compiled) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
var compiled = action.module.compiled;
|
|
102
|
-
var module = {
|
|
103
|
-
exports: {
|
|
104
|
-
ctx: engine,
|
|
105
|
-
utils: engine.getAction().actionUtils,
|
|
106
|
-
env: env
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
try {
|
|
110
|
-
new Function("module", "exports", compiled).call(module, module, module.exports);
|
|
111
|
-
} catch (e) {
|
|
112
|
-
error(e.message + ". fail to parse the module");
|
|
113
|
-
if (process.env.NODE_ENV !== "production") {
|
|
114
|
-
error("fail to parse the module");
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
var funcMap = {};
|
|
118
|
-
var variables = {};
|
|
119
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
120
|
-
try {
|
|
121
|
-
for(var _iterator = Object.entries(module.exports)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
122
|
-
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
123
|
-
if (typeof value === "function") {
|
|
124
|
-
funcMap[key] = value;
|
|
125
|
-
} else {
|
|
126
|
-
variables[key] = value;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
} catch (err) {
|
|
130
|
-
_didIteratorError = true;
|
|
131
|
-
_iteratorError = err;
|
|
132
|
-
} finally{
|
|
133
|
-
try {
|
|
134
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
135
|
-
_iterator.return();
|
|
136
|
-
}
|
|
137
|
-
} finally{
|
|
138
|
-
if (_didIteratorError) {
|
|
139
|
-
throw _iteratorError;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
funcMap: funcMap,
|
|
145
|
-
variables: variables
|
|
146
|
-
};
|
|
147
|
-
}
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
function _arrayLikeToArray(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 _arrayWithHoles(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 _asyncToGenerator(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 _classCallCheck(instance, Constructor) {
|
|
39
|
-
if (!(instance instanceof Constructor)) {
|
|
40
|
-
throw new TypeError("Cannot call a class as a function");
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function _iterableToArrayLimit(arr, i) {
|
|
44
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
45
|
-
if (_i == null) return;
|
|
46
|
-
var _arr = [];
|
|
47
|
-
var _n = true;
|
|
48
|
-
var _d = false;
|
|
49
|
-
var _s, _e;
|
|
50
|
-
try {
|
|
51
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
52
|
-
_arr.push(_s.value);
|
|
53
|
-
if (i && _arr.length === i) break;
|
|
54
|
-
}
|
|
55
|
-
} catch (err) {
|
|
56
|
-
_d = true;
|
|
57
|
-
_e = err;
|
|
58
|
-
} finally{
|
|
59
|
-
try {
|
|
60
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
61
|
-
} finally{
|
|
62
|
-
if (_d) throw _e;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return _arr;
|
|
66
|
-
}
|
|
67
|
-
function _nonIterableRest() {
|
|
68
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
69
|
-
}
|
|
70
|
-
function _slicedToArray(arr, i) {
|
|
71
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
72
|
-
}
|
|
73
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
74
|
-
if (!o) return;
|
|
75
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
76
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
77
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
78
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
79
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
80
|
-
}
|
|
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
|
-
};
|
|
176
|
-
var LifecycleEventKeyMap = {
|
|
177
|
-
"engine-mounted": "did_mount",
|
|
178
|
-
"engine-submit": "will_submit",
|
|
179
|
-
"engine-submit-params": "do_submit",
|
|
180
|
-
"engine-submitted": "did_submit"
|
|
181
|
-
};
|
|
182
|
-
export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
183
|
-
"use strict";
|
|
184
|
-
function LifecycleEventPlugin(config) {
|
|
185
|
-
_classCallCheck(this, LifecycleEventPlugin);
|
|
186
|
-
this.config = config;
|
|
187
|
-
}
|
|
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){
|
|
200
|
-
case 0:
|
|
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
|
-
];
|
|
217
|
-
}
|
|
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 注释掉的两个参数变为全局参数
|
|
255
|
-
// this.engine,
|
|
256
|
-
// this.engine.getAction().actionUtils, //以前是params,空的
|
|
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
|
-
};
|
|
283
|
-
return LifecycleEventPlugin;
|
|
284
|
-
}();
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
function _classCallCheck(instance, Constructor) {
|
|
2
|
-
if (!(instance instanceof Constructor)) {
|
|
3
|
-
throw new TypeError("Cannot call a class as a function");
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
export var StylePlugin = /*#__PURE__*/ function() {
|
|
7
|
-
"use strict";
|
|
8
|
-
function StylePlugin(config) {
|
|
9
|
-
_classCallCheck(this, StylePlugin);
|
|
10
|
-
this.config = config;
|
|
11
|
-
}
|
|
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
|
-
};
|
|
25
|
-
return StylePlugin;
|
|
26
|
-
}();
|
package/dist/esm/utils/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./runtimeUtils";
|
|
@@ -1,43 +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;
|
|
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
|
-
// @ts-ignore
|
|
11
|
-
var children = item.getChildrenFormControl();
|
|
12
|
-
callback(item, children);
|
|
13
|
-
} else if (hasChildrenControl(item)) {
|
|
14
|
-
loopFormControl(item === null || item === void 0 ? void 0 : item.children, callback);
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
} else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
17
|
-
callback(item);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export function loopDataViewControl(control, // @ts-ignore
|
|
23
|
-
callback) {
|
|
24
|
-
if (Array.isArray(control)) {
|
|
25
|
-
control.map(function(item) {
|
|
26
|
-
if (item.type === CONTROL_TYPE.DATA_VIEW || item.type === CONTROL_TYPE.SIMPLE_SEARCH) {
|
|
27
|
-
callback(item);
|
|
28
|
-
} else if (hasChildrenControl(item)) {
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
loopDataViewControl(item === null || item === void 0 ? void 0 : item.children, callback);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
var unique = 0;
|
|
36
|
-
// uuid生成
|
|
37
|
-
export function buildUUID() {
|
|
38
|
-
var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
39
|
-
var time = Date.now();
|
|
40
|
-
var random = Math.floor(Math.random() * 1000000000);
|
|
41
|
-
unique++;
|
|
42
|
-
return prefix + "_" + random + unique + String(time);
|
|
43
|
-
}
|