@byteluck-fe/model-driven-engine 2.7.0-alpha.15 → 2.7.0-alpha.15b
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/dist/esm/common/ActionManager.js +40 -157
- package/dist/esm/common/DataManager.js +20 -129
- package/dist/esm/common/Engine.js +324 -412
- package/dist/esm/common/OkWorker.js +13 -27
- package/dist/esm/common/Runtime.js +78 -54
- package/dist/esm/common/Store.js +50 -51
- package/dist/esm/common/checkerValue.js +39 -39
- package/dist/esm/common/index.js +2 -2
- package/dist/esm/common/proxyState.js +47 -47
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +59 -67
- package/dist/esm/plugins/ControlsEventPlugin.js +68 -191
- package/dist/esm/plugins/ES6ModulePlugin.js +8 -24
- package/dist/esm/plugins/LifecycleEventPlugin.js +64 -183
- package/dist/esm/plugins/StylePlugin.js +7 -22
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/runtimeUtils.js +7 -5
- package/dist/index.umd.js +10 -10
- package/dist/types/common/Engine.d.ts +10 -9
- package/dist/types/common/Runtime.d.ts +2 -1
- package/dist/types/common/Store.d.ts +5 -5
- package/dist/types/common/proxyState.d.ts +3 -3
- package/dist/types/plugins/ControlsEventPlugin.d.ts +1 -1
- package/dist/types/plugins/ES6ModulePlugin.d.ts +4 -4
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +1 -1
- package/dist/types/plugins/StylePlugin.d.ts +1 -1
- package/package.json +4 -4
|
@@ -25,19 +25,6 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
25
25
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
26
26
|
return Constructor;
|
|
27
27
|
}
|
|
28
|
-
function _defineProperty(obj, key, value) {
|
|
29
|
-
if (key in obj) {
|
|
30
|
-
Object.defineProperty(obj, key, {
|
|
31
|
-
value: value,
|
|
32
|
-
enumerable: true,
|
|
33
|
-
configurable: true,
|
|
34
|
-
writable: true
|
|
35
|
-
});
|
|
36
|
-
} else {
|
|
37
|
-
obj[key] = value;
|
|
38
|
-
}
|
|
39
|
-
return obj;
|
|
40
|
-
}
|
|
41
28
|
function _iterableToArrayLimit(arr, i) {
|
|
42
29
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
43
30
|
if (_i == null) return;
|
|
@@ -76,14 +63,11 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
76
63
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
77
64
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
78
65
|
}
|
|
79
|
-
import { error } from
|
|
66
|
+
import { error } from '@byteluck-fe/model-driven-shared';
|
|
80
67
|
export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
81
68
|
"use strict";
|
|
82
69
|
function ES6ModulePlugin(config, env) {
|
|
83
70
|
_classCallCheck(this, ES6ModulePlugin);
|
|
84
|
-
_defineProperty(this, "config", void 0);
|
|
85
|
-
_defineProperty(this, "engine", void 0);
|
|
86
|
-
_defineProperty(this, "env", void 0);
|
|
87
71
|
this.config = config;
|
|
88
72
|
this.env = env;
|
|
89
73
|
}
|
|
@@ -104,7 +88,7 @@ export var ES6ModulePlugin = /*#__PURE__*/ function() {
|
|
|
104
88
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
105
89
|
try {
|
|
106
90
|
for(var _iterator = Object.entries(res.funcMap)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
107
|
-
var
|
|
91
|
+
var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
|
|
108
92
|
actionManager.addAction(key, value);
|
|
109
93
|
}
|
|
110
94
|
} catch (err) {
|
|
@@ -141,11 +125,11 @@ export function parseModule(action, engine, env) {
|
|
|
141
125
|
}
|
|
142
126
|
};
|
|
143
127
|
try {
|
|
144
|
-
new Function(
|
|
128
|
+
new Function('module', 'exports', compiled).call(module, module, module.exports);
|
|
145
129
|
} catch (e) {
|
|
146
|
-
error(e.message +
|
|
147
|
-
if (process.env.NODE_ENV !==
|
|
148
|
-
error(
|
|
130
|
+
error(e.message + '. fail to parse the module');
|
|
131
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
132
|
+
error('fail to parse the module');
|
|
149
133
|
}
|
|
150
134
|
}
|
|
151
135
|
var funcMap = {};
|
|
@@ -153,8 +137,8 @@ export function parseModule(action, engine, env) {
|
|
|
153
137
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
154
138
|
try {
|
|
155
139
|
for(var _iterator = Object.entries(module.exports)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
156
|
-
var
|
|
157
|
-
if (typeof value ===
|
|
140
|
+
var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
|
|
141
|
+
if (typeof value === 'function') {
|
|
158
142
|
funcMap[key] = value;
|
|
159
143
|
} else {
|
|
160
144
|
variables[key] = value;
|
|
@@ -54,19 +54,6 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
54
54
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
55
55
|
return Constructor;
|
|
56
56
|
}
|
|
57
|
-
function _defineProperty(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
57
|
function _iterableToArrayLimit(arr, i) {
|
|
71
58
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
72
59
|
if (_i == null) return;
|
|
@@ -105,113 +92,17 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
105
92
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
106
93
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
107
94
|
}
|
|
108
|
-
|
|
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
|
-
};
|
|
95
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
203
96
|
var LifecycleEventKeyMap = {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
97
|
+
'engine-mounted': 'did_mount',
|
|
98
|
+
'engine-submit': 'will_submit',
|
|
99
|
+
'engine-submit-params': 'do_submit',
|
|
100
|
+
'engine-submitted': 'did_submit'
|
|
208
101
|
};
|
|
209
102
|
export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
210
103
|
"use strict";
|
|
211
104
|
function LifecycleEventPlugin(config) {
|
|
212
105
|
_classCallCheck(this, LifecycleEventPlugin);
|
|
213
|
-
_defineProperty(this, "config", void 0);
|
|
214
|
-
_defineProperty(this, "engine", void 0);
|
|
215
106
|
this.config = config;
|
|
216
107
|
}
|
|
217
108
|
_createClass(LifecycleEventPlugin, [
|
|
@@ -224,34 +115,28 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
224
115
|
var _param = _slicedToArray(param, 2), engineKey = _param[0], lifecycleKey = _param[1];
|
|
225
116
|
var _this1 = _this;
|
|
226
117
|
engine.on(engineKey, function() {
|
|
227
|
-
var _ref = _asyncToGenerator(function(payload) {
|
|
118
|
+
var _ref = _asyncToGenerator(regeneratorRuntime.mark(function _callee(payload) {
|
|
228
119
|
var result;
|
|
229
|
-
return
|
|
230
|
-
switch(
|
|
120
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
121
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
231
122
|
case 0:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return [
|
|
240
|
-
2,
|
|
241
|
-
false
|
|
242
|
-
];
|
|
243
|
-
} else {
|
|
244
|
-
return [
|
|
245
|
-
2,
|
|
246
|
-
result
|
|
247
|
-
];
|
|
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;
|
|
248
130
|
}
|
|
249
|
-
return
|
|
250
|
-
|
|
251
|
-
|
|
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();
|
|
252
137
|
}
|
|
253
|
-
});
|
|
254
|
-
});
|
|
138
|
+
}, _callee);
|
|
139
|
+
}));
|
|
255
140
|
return function(payload) {
|
|
256
141
|
return _ref.apply(this, arguments);
|
|
257
142
|
};
|
|
@@ -263,56 +148,52 @@ export var LifecycleEventPlugin = /*#__PURE__*/ function() {
|
|
|
263
148
|
key: "callLifecycleEvent",
|
|
264
149
|
value: function callLifecycleEvent(name, payload) {
|
|
265
150
|
var _this = this;
|
|
266
|
-
return _asyncToGenerator(function() {
|
|
151
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee1() {
|
|
267
152
|
var events, result;
|
|
268
|
-
return
|
|
269
|
-
switch(
|
|
153
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx1) {
|
|
154
|
+
while(1)switch(_ctx1.prev = _ctx1.next){
|
|
270
155
|
case 0:
|
|
271
156
|
events = _this.config;
|
|
272
|
-
if (!events || !Array.isArray(events[name])) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
[]
|
|
276
|
-
];
|
|
157
|
+
if (!(!events || !Array.isArray(events[name]))) {
|
|
158
|
+
_ctx1.next = 3;
|
|
159
|
+
break;
|
|
277
160
|
}
|
|
278
|
-
return [
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
return
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
result
|
|
312
|
-
];
|
|
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 注释掉的两个参数变为全局参数
|
|
172
|
+
// this.engine,
|
|
173
|
+
// 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();
|
|
313
194
|
}
|
|
314
|
-
});
|
|
315
|
-
})();
|
|
195
|
+
}, _callee1);
|
|
196
|
+
}))();
|
|
316
197
|
}
|
|
317
198
|
}
|
|
318
199
|
]);
|
|
@@ -17,40 +17,25 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
17
17
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
18
|
return Constructor;
|
|
19
19
|
}
|
|
20
|
-
function _defineProperty(obj, key, value) {
|
|
21
|
-
if (key in obj) {
|
|
22
|
-
Object.defineProperty(obj, key, {
|
|
23
|
-
value: value,
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
obj[key] = value;
|
|
30
|
-
}
|
|
31
|
-
return obj;
|
|
32
|
-
}
|
|
33
20
|
export var StylePlugin = /*#__PURE__*/ function() {
|
|
34
21
|
"use strict";
|
|
35
22
|
function StylePlugin(config) {
|
|
36
23
|
_classCallCheck(this, StylePlugin);
|
|
37
|
-
_defineProperty(this, "config", void 0);
|
|
38
|
-
_defineProperty(this, "engine", void 0);
|
|
39
24
|
this.config = config;
|
|
40
25
|
}
|
|
41
26
|
_createClass(StylePlugin, [
|
|
42
27
|
{
|
|
43
28
|
key: "apply",
|
|
44
29
|
value: function apply(engine) {
|
|
45
|
-
var
|
|
30
|
+
var ref;
|
|
46
31
|
this.engine = engine;
|
|
47
|
-
var
|
|
48
|
-
var compiledStyle = (
|
|
49
|
-
var style = document.createElement(
|
|
50
|
-
style.className =
|
|
51
|
-
style.type =
|
|
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';
|
|
52
37
|
style.innerHTML = compiledStyle;
|
|
53
|
-
var dom = document.querySelector(
|
|
38
|
+
var dom = document.querySelector('head');
|
|
54
39
|
dom.appendChild(style);
|
|
55
40
|
}
|
|
56
41
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from './ES6ModulePlugin';
|
|
2
|
+
export * from './LifecycleEventPlugin';
|
|
3
|
+
export * from './ControlsEventPlugin';
|
|
4
|
+
export * from './CalcPlugin';
|
|
5
|
+
export * from './StylePlugin';
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './runtimeUtils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from
|
|
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
|
}
|
|
@@ -12,7 +12,8 @@ export function loopFormControl(control, callback) {
|
|
|
12
12
|
;
|
|
13
13
|
callback(item, children);
|
|
14
14
|
} else if (hasChildrenControl(item)) {
|
|
15
|
-
|
|
15
|
+
var ref;
|
|
16
|
+
loopFormControl((ref = item) === null || ref === void 0 ? void 0 : ref.children, callback);
|
|
16
17
|
// @ts-ignore
|
|
17
18
|
} else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
18
19
|
callback(item);
|
|
@@ -27,8 +28,9 @@ callback) {
|
|
|
27
28
|
if (item.type === CONTROL_TYPE.DATA_VIEW || item.type === CONTROL_TYPE.SIMPLE_SEARCH) {
|
|
28
29
|
callback(item);
|
|
29
30
|
} else if (hasChildrenControl(item)) {
|
|
31
|
+
var ref;
|
|
30
32
|
// @ts-ignore
|
|
31
|
-
loopDataViewControl(item === null ||
|
|
33
|
+
loopDataViewControl((ref = item) === null || ref === void 0 ? void 0 : ref.children, callback);
|
|
32
34
|
}
|
|
33
35
|
});
|
|
34
36
|
}
|
|
@@ -36,9 +38,9 @@ callback) {
|
|
|
36
38
|
var unique = 0;
|
|
37
39
|
// uuid生成
|
|
38
40
|
export function buildUUID() {
|
|
39
|
-
var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
41
|
+
var prefix = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : '';
|
|
40
42
|
var time = Date.now();
|
|
41
43
|
var random = Math.floor(Math.random() * 1000000000);
|
|
42
44
|
unique++;
|
|
43
|
-
return prefix +
|
|
45
|
+
return prefix + '_' + random + unique + String(time);
|
|
44
46
|
}
|