@byteluck-fe/model-driven-core-all 2.7.0-alpha.9 → 2.7.0-beta.1
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/getHackerControl.js +57 -44
- package/dist/esm/index.js +9 -9
- package/dist/esm/loadRemoteScripts.js +123 -27
- package/dist/esm/registerByteluckControls.js +131 -32
- package/dist/esm/registerCustomControls.js +205 -99
- package/dist/esm/upgradeCustomControlSchema.js +14 -13
- package/dist/index.umd.js +1 -1
- package/dist/types/registerCustomControls.d.ts +2 -2
- package/package.json +6 -6
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _assert_this_initialized(self) {
|
|
2
2
|
if (self === void 0) {
|
|
3
3
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
4
|
}
|
|
5
5
|
return self;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function _class_call_check(instance, Constructor) {
|
|
8
8
|
if (!(instance instanceof Constructor)) {
|
|
9
9
|
throw new TypeError("Cannot call a class as a function");
|
|
10
10
|
}
|
|
@@ -18,16 +18,29 @@ function _defineProperties(target, props) {
|
|
|
18
18
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
22
22
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
23
23
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
24
24
|
return Constructor;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
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
|
+
function _get_prototype_of(o) {
|
|
40
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
28
41
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
29
42
|
};
|
|
30
|
-
return
|
|
43
|
+
return _get_prototype_of(o);
|
|
31
44
|
}
|
|
32
45
|
function _inherits(subClass, superClass) {
|
|
33
46
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -40,26 +53,26 @@ function _inherits(subClass, superClass) {
|
|
|
40
53
|
configurable: true
|
|
41
54
|
}
|
|
42
55
|
});
|
|
43
|
-
if (superClass)
|
|
56
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
44
57
|
}
|
|
45
|
-
function
|
|
46
|
-
if (call && (
|
|
58
|
+
function _possible_constructor_return(self, call) {
|
|
59
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
47
60
|
return call;
|
|
48
61
|
}
|
|
49
|
-
return
|
|
62
|
+
return _assert_this_initialized(self);
|
|
50
63
|
}
|
|
51
|
-
function
|
|
52
|
-
|
|
64
|
+
function _set_prototype_of(o, p) {
|
|
65
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
53
66
|
o.__proto__ = p;
|
|
54
67
|
return o;
|
|
55
68
|
};
|
|
56
|
-
return
|
|
69
|
+
return _set_prototype_of(o, p);
|
|
57
70
|
}
|
|
58
|
-
|
|
71
|
+
function _type_of(obj) {
|
|
59
72
|
"@swc/helpers - typeof";
|
|
60
73
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
61
|
-
}
|
|
62
|
-
function
|
|
74
|
+
}
|
|
75
|
+
function _is_native_reflect_construct() {
|
|
63
76
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
64
77
|
if (Reflect.construct.sham) return false;
|
|
65
78
|
if (typeof Proxy === "function") return true;
|
|
@@ -70,38 +83,38 @@ function _isNativeReflectConstruct() {
|
|
|
70
83
|
return false;
|
|
71
84
|
}
|
|
72
85
|
}
|
|
73
|
-
function
|
|
74
|
-
var hasNativeReflectConstruct =
|
|
86
|
+
function _create_super(Derived) {
|
|
87
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
75
88
|
return function _createSuperInternal() {
|
|
76
|
-
var Super =
|
|
89
|
+
var Super = _get_prototype_of(Derived), result;
|
|
77
90
|
if (hasNativeReflectConstruct) {
|
|
78
|
-
var NewTarget =
|
|
91
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
79
92
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
80
93
|
} else {
|
|
81
94
|
result = Super.apply(this, arguments);
|
|
82
95
|
}
|
|
83
|
-
return
|
|
96
|
+
return _possible_constructor_return(this, result);
|
|
84
97
|
};
|
|
85
98
|
}
|
|
86
|
-
import { RuntimeControl } from
|
|
87
|
-
import { DesignerControl } from
|
|
88
|
-
import { Property } from
|
|
99
|
+
import { RuntimeControl } from "@byteluck-fe/model-driven-core";
|
|
100
|
+
import { DesignerControl } from "@byteluck-fe/model-driven-core";
|
|
101
|
+
import { Property } from "@byteluck-fe/model-driven-core";
|
|
89
102
|
export function getHackerControl(comid, type, tipMessage) {
|
|
90
103
|
var HackerControlClass;
|
|
91
104
|
// 伪造一个组件
|
|
92
|
-
if (type ===
|
|
93
|
-
HackerControlClass = /*#__PURE__*/
|
|
105
|
+
if (type === "runtime") {
|
|
106
|
+
HackerControlClass = /*#__PURE__*/ function(RuntimeControl) {
|
|
94
107
|
"use strict";
|
|
95
|
-
_inherits(HackerControl,
|
|
96
|
-
var _super =
|
|
108
|
+
_inherits(HackerControl, RuntimeControl);
|
|
109
|
+
var _super = _create_super(HackerControl);
|
|
97
110
|
function HackerControl(props) {
|
|
98
|
-
|
|
111
|
+
_class_call_check(this, HackerControl);
|
|
99
112
|
var _this;
|
|
100
113
|
_this = _super.call(this, props);
|
|
101
|
-
_this
|
|
114
|
+
_define_property(_assert_this_initialized(_this), "props", {});
|
|
102
115
|
return _this;
|
|
103
116
|
}
|
|
104
|
-
|
|
117
|
+
_create_class(HackerControl, null, [
|
|
105
118
|
{
|
|
106
119
|
key: "controlType",
|
|
107
120
|
get: function get() {
|
|
@@ -110,20 +123,20 @@ export function getHackerControl(comid, type, tipMessage) {
|
|
|
110
123
|
}
|
|
111
124
|
]);
|
|
112
125
|
return HackerControl;
|
|
113
|
-
}
|
|
126
|
+
}(RuntimeControl);
|
|
114
127
|
} else {
|
|
115
|
-
HackerControlClass = /*#__PURE__*/
|
|
128
|
+
HackerControlClass = /*#__PURE__*/ function(DesignerControl) {
|
|
116
129
|
"use strict";
|
|
117
|
-
_inherits(HackerControl,
|
|
118
|
-
var _super =
|
|
130
|
+
_inherits(HackerControl, DesignerControl);
|
|
131
|
+
var _super = _create_super(HackerControl);
|
|
119
132
|
function HackerControl(props) {
|
|
120
|
-
|
|
133
|
+
_class_call_check(this, HackerControl);
|
|
121
134
|
var _this;
|
|
122
135
|
_this = _super.call(this, props);
|
|
123
|
-
_this
|
|
136
|
+
_define_property(_assert_this_initialized(_this), "props", {});
|
|
124
137
|
return _this;
|
|
125
138
|
}
|
|
126
|
-
|
|
139
|
+
_create_class(HackerControl, null, [
|
|
127
140
|
{
|
|
128
141
|
key: "controlType",
|
|
129
142
|
get: function get() {
|
|
@@ -132,19 +145,19 @@ export function getHackerControl(comid, type, tipMessage) {
|
|
|
132
145
|
}
|
|
133
146
|
]);
|
|
134
147
|
return HackerControl;
|
|
135
|
-
}
|
|
148
|
+
}(DesignerControl);
|
|
136
149
|
}
|
|
137
|
-
var HackerPropertyClass = /*#__PURE__*/ function(
|
|
150
|
+
var HackerPropertyClass = /*#__PURE__*/ function(Property) {
|
|
138
151
|
"use strict";
|
|
139
|
-
_inherits(HackerPropertyClass,
|
|
140
|
-
var _super =
|
|
152
|
+
_inherits(HackerPropertyClass, Property);
|
|
153
|
+
var _super = _create_super(HackerPropertyClass);
|
|
141
154
|
function HackerPropertyClass() {
|
|
142
|
-
|
|
155
|
+
_class_call_check(this, HackerPropertyClass);
|
|
143
156
|
return _super.apply(this, arguments);
|
|
144
157
|
}
|
|
145
158
|
return HackerPropertyClass;
|
|
146
159
|
}(Property);
|
|
147
|
-
var template =
|
|
160
|
+
var template = '<div style="background:#fff0ef;color:#ff6459;padding:8px 16px;border-radius:4px;"><i class="low-code iconshibaimian" style="margin-right:4px"></i>'.concat(tipMessage, "</div>");
|
|
148
161
|
var control = {
|
|
149
162
|
Runtime: HackerControlClass,
|
|
150
163
|
Designer: HackerControlClass,
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
1
|
+
export * from "@byteluck-fe/model-driven-core";
|
|
2
|
+
export * from "@byteluck-fe/model-driven-shared";
|
|
3
|
+
export * from "@byteluck-fe/model-driven-controls";
|
|
4
|
+
export * from "@byteluck-fe/model-driven-upgrade";
|
|
5
|
+
export * from "./loadRemoteScripts";
|
|
6
|
+
export * from "./registerCustomControls";
|
|
7
|
+
export * from "./upgradeCustomControlSchema";
|
|
8
|
+
export * from "./registerByteluckControls";
|
|
9
|
+
export * from "./getHackerControl";
|
|
@@ -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
|
|
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,101 @@ function _asyncToGenerator(fn) {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
function _ts_generator(thisArg, body) {
|
|
31
|
+
var f, y, t, g, _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function() {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
};
|
|
40
|
+
return g = {
|
|
41
|
+
next: verb(0),
|
|
42
|
+
"throw": verb(1),
|
|
43
|
+
"return": verb(2)
|
|
44
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
|
+
return this;
|
|
46
|
+
}), g;
|
|
47
|
+
function verb(n) {
|
|
48
|
+
return function(v) {
|
|
49
|
+
return step([
|
|
50
|
+
n,
|
|
51
|
+
v
|
|
52
|
+
]);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function step(op) {
|
|
56
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
+
while(_)try {
|
|
58
|
+
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;
|
|
59
|
+
if (y = 0, t) op = [
|
|
60
|
+
op[0] & 2,
|
|
61
|
+
t.value
|
|
62
|
+
];
|
|
63
|
+
switch(op[0]){
|
|
64
|
+
case 0:
|
|
65
|
+
case 1:
|
|
66
|
+
t = op;
|
|
67
|
+
break;
|
|
68
|
+
case 4:
|
|
69
|
+
_.label++;
|
|
70
|
+
return {
|
|
71
|
+
value: op[1],
|
|
72
|
+
done: false
|
|
73
|
+
};
|
|
74
|
+
case 5:
|
|
75
|
+
_.label++;
|
|
76
|
+
y = op[1];
|
|
77
|
+
op = [
|
|
78
|
+
0
|
|
79
|
+
];
|
|
80
|
+
continue;
|
|
81
|
+
case 7:
|
|
82
|
+
op = _.ops.pop();
|
|
83
|
+
_.trys.pop();
|
|
84
|
+
continue;
|
|
85
|
+
default:
|
|
86
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
87
|
+
_ = 0;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
91
|
+
_.label = op[1];
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
95
|
+
_.label = t[1];
|
|
96
|
+
t = op;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (t && _.label < t[2]) {
|
|
100
|
+
_.label = t[2];
|
|
101
|
+
_.ops.push(op);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (t[2]) _.ops.pop();
|
|
105
|
+
_.trys.pop();
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
op = body.call(thisArg, _);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
op = [
|
|
111
|
+
6,
|
|
112
|
+
e
|
|
113
|
+
];
|
|
114
|
+
y = 0;
|
|
115
|
+
} finally{
|
|
116
|
+
f = t = 0;
|
|
117
|
+
}
|
|
118
|
+
if (op[0] & 5) throw op[1];
|
|
119
|
+
return {
|
|
120
|
+
value: op[0] ? op[1] : void 0,
|
|
121
|
+
done: true
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
31
125
|
var jobs = [];
|
|
32
126
|
var module = {
|
|
33
127
|
exports: {}
|
|
@@ -38,8 +132,8 @@ function hackWindow(globalModules) {
|
|
|
38
132
|
if (!hacked) {
|
|
39
133
|
window.module = module;
|
|
40
134
|
window.exports = module.exports;
|
|
41
|
-
window.require = function(
|
|
42
|
-
return globalModules[
|
|
135
|
+
window.require = function(module) {
|
|
136
|
+
return globalModules[module];
|
|
43
137
|
};
|
|
44
138
|
hacked = true;
|
|
45
139
|
}
|
|
@@ -52,10 +146,10 @@ function hackWindow(globalModules) {
|
|
|
52
146
|
}
|
|
53
147
|
export function loadScriptFromTag(url, globalModules) {
|
|
54
148
|
var p = new Promise(function(resolve, reject) {
|
|
55
|
-
var script = document.createElement(
|
|
149
|
+
var script = document.createElement("script");
|
|
56
150
|
var resetHackWindow = hackWindow(globalModules);
|
|
57
151
|
script.src = url;
|
|
58
|
-
script.type =
|
|
152
|
+
script.type = "text/javascript";
|
|
59
153
|
var loadEnd = function() {
|
|
60
154
|
document.head.removeChild(script);
|
|
61
155
|
var index = jobs.findIndex(function(j) {
|
|
@@ -81,12 +175,12 @@ export function loadScriptFromTag(url, globalModules) {
|
|
|
81
175
|
}
|
|
82
176
|
export function nativeFetch(url) {
|
|
83
177
|
return fetch(url, {
|
|
84
|
-
mode:
|
|
85
|
-
cache:
|
|
86
|
-
credentials:
|
|
178
|
+
mode: "cors",
|
|
179
|
+
cache: "no-cache",
|
|
180
|
+
credentials: "same-origin"
|
|
87
181
|
}).then(function(response) {
|
|
88
182
|
if (response.ok === false) {
|
|
89
|
-
throw
|
|
183
|
+
throw "not found resource:" + url;
|
|
90
184
|
} else {
|
|
91
185
|
return response.text();
|
|
92
186
|
}
|
|
@@ -99,13 +193,13 @@ export function loadScriptFromFetch(url, globalModules) {
|
|
|
99
193
|
return new Promise(function(resolve, reject) {
|
|
100
194
|
// const newUrl = url.replace(/^(https?:)?\/\/.*?\/component/, '/component')
|
|
101
195
|
options.fetch(url).then(function(response) {
|
|
102
|
-
var
|
|
196
|
+
var module = {
|
|
103
197
|
exports: {}
|
|
104
198
|
};
|
|
105
|
-
new Function(
|
|
199
|
+
new Function("module", "exports", "require", response)(module, module.exports, function(id) {
|
|
106
200
|
return globalModules[id];
|
|
107
201
|
});
|
|
108
|
-
resolve(
|
|
202
|
+
resolve(module.exports);
|
|
109
203
|
}).catch(function(e) {
|
|
110
204
|
reject(e);
|
|
111
205
|
});
|
|
@@ -118,21 +212,23 @@ export function loadRemoteControls(urls, globalModules) {
|
|
|
118
212
|
return _loadRemoteControls.apply(this, arguments);
|
|
119
213
|
}
|
|
120
214
|
function _loadRemoteControls() {
|
|
121
|
-
_loadRemoteControls =
|
|
122
|
-
return
|
|
123
|
-
|
|
215
|
+
_loadRemoteControls = _async_to_generator(function(urls, globalModules) {
|
|
216
|
+
return _ts_generator(this, function(_state) {
|
|
217
|
+
switch(_state.label){
|
|
124
218
|
case 0:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
case
|
|
132
|
-
|
|
133
|
-
|
|
219
|
+
return [
|
|
220
|
+
4,
|
|
221
|
+
Promise.all(urls.map(function(url) {
|
|
222
|
+
return loadRemoteControl(url, globalModules);
|
|
223
|
+
}))
|
|
224
|
+
];
|
|
225
|
+
case 1:
|
|
226
|
+
return [
|
|
227
|
+
2,
|
|
228
|
+
_state.sent()
|
|
229
|
+
];
|
|
134
230
|
}
|
|
135
|
-
}
|
|
136
|
-
})
|
|
231
|
+
});
|
|
232
|
+
});
|
|
137
233
|
return _loadRemoteControls.apply(this, arguments);
|
|
138
234
|
}
|
|
@@ -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
|
|
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,62 +27,161 @@ function _asyncToGenerator(fn) {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
function _ts_generator(thisArg, body) {
|
|
31
|
+
var f, y, t, g, _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function() {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
};
|
|
40
|
+
return g = {
|
|
41
|
+
next: verb(0),
|
|
42
|
+
"throw": verb(1),
|
|
43
|
+
"return": verb(2)
|
|
44
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
|
+
return this;
|
|
46
|
+
}), g;
|
|
47
|
+
function verb(n) {
|
|
48
|
+
return function(v) {
|
|
49
|
+
return step([
|
|
50
|
+
n,
|
|
51
|
+
v
|
|
52
|
+
]);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function step(op) {
|
|
56
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
+
while(_)try {
|
|
58
|
+
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;
|
|
59
|
+
if (y = 0, t) op = [
|
|
60
|
+
op[0] & 2,
|
|
61
|
+
t.value
|
|
62
|
+
];
|
|
63
|
+
switch(op[0]){
|
|
64
|
+
case 0:
|
|
65
|
+
case 1:
|
|
66
|
+
t = op;
|
|
67
|
+
break;
|
|
68
|
+
case 4:
|
|
69
|
+
_.label++;
|
|
70
|
+
return {
|
|
71
|
+
value: op[1],
|
|
72
|
+
done: false
|
|
73
|
+
};
|
|
74
|
+
case 5:
|
|
75
|
+
_.label++;
|
|
76
|
+
y = op[1];
|
|
77
|
+
op = [
|
|
78
|
+
0
|
|
79
|
+
];
|
|
80
|
+
continue;
|
|
81
|
+
case 7:
|
|
82
|
+
op = _.ops.pop();
|
|
83
|
+
_.trys.pop();
|
|
84
|
+
continue;
|
|
85
|
+
default:
|
|
86
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
87
|
+
_ = 0;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
91
|
+
_.label = op[1];
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
95
|
+
_.label = t[1];
|
|
96
|
+
t = op;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (t && _.label < t[2]) {
|
|
100
|
+
_.label = t[2];
|
|
101
|
+
_.ops.push(op);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (t[2]) _.ops.pop();
|
|
105
|
+
_.trys.pop();
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
op = body.call(thisArg, _);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
op = [
|
|
111
|
+
6,
|
|
112
|
+
e
|
|
113
|
+
];
|
|
114
|
+
y = 0;
|
|
115
|
+
} finally{
|
|
116
|
+
f = t = 0;
|
|
117
|
+
}
|
|
118
|
+
if (op[0] & 5) throw op[1];
|
|
119
|
+
return {
|
|
120
|
+
value: op[0] ? op[1] : void 0,
|
|
121
|
+
done: true
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
import { getHackerControl } from "./getHackerControl";
|
|
126
|
+
import { nativeFetch, loadRemoteControl } from "./loadRemoteScripts";
|
|
33
127
|
export function registerByteluckControls(url, payload) {
|
|
34
128
|
return _registerByteluckControls.apply(this, arguments);
|
|
35
129
|
}
|
|
36
130
|
function _registerByteluckControls() {
|
|
37
|
-
_registerByteluckControls =
|
|
131
|
+
_registerByteluckControls = _async_to_generator(function(url, payload) {
|
|
38
132
|
var version, byteluckControls, componentsStr, components, controls;
|
|
39
|
-
return
|
|
40
|
-
|
|
133
|
+
return _ts_generator(this, function(_state) {
|
|
134
|
+
switch(_state.label){
|
|
41
135
|
case 0:
|
|
42
136
|
version = payload.version;
|
|
43
|
-
if (payload.version ===
|
|
137
|
+
if (payload.version === "random") {
|
|
44
138
|
version = new Date().valueOf().toString();
|
|
45
139
|
}
|
|
46
140
|
byteluckControls = new Map();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
141
|
+
return [
|
|
142
|
+
4,
|
|
143
|
+
nativeFetch("".concat(url, "/component.json?v=").concat(version))
|
|
144
|
+
];
|
|
145
|
+
case 1:
|
|
146
|
+
componentsStr = _state.sent();
|
|
51
147
|
components = [];
|
|
52
|
-
if (!(componentsStr !== undefined))
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
148
|
+
if (!(componentsStr !== undefined)) return [
|
|
149
|
+
3,
|
|
150
|
+
3
|
|
151
|
+
];
|
|
56
152
|
components = JSON.parse(componentsStr);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
153
|
+
return [
|
|
154
|
+
4,
|
|
155
|
+
loadRemoteControl("".concat(url, "/").concat(payload.type, ".js?v=").concat(version), payload.globalModules)
|
|
156
|
+
];
|
|
157
|
+
case 2:
|
|
158
|
+
controls = _state.sent();
|
|
61
159
|
components.map(function(item) {
|
|
62
|
-
var
|
|
63
|
-
if (payload.type ===
|
|
160
|
+
var control = controls.find(function(control) {
|
|
161
|
+
if (payload.type === "runtime") {
|
|
64
162
|
return control.Runtime.controlType === item.id;
|
|
65
163
|
} else {
|
|
66
164
|
return control.Designer.controlType === item.id;
|
|
67
165
|
}
|
|
68
166
|
});
|
|
69
|
-
if (
|
|
70
|
-
|
|
167
|
+
if (control === undefined) {
|
|
168
|
+
control = getHackerControl(item.id, payload.type, "内置组件加载错误");
|
|
71
169
|
}
|
|
72
170
|
byteluckControls.set(item.id, {
|
|
73
171
|
props: item,
|
|
74
172
|
version: item.version,
|
|
75
173
|
isLoaded: true,
|
|
76
|
-
control:
|
|
174
|
+
control: control
|
|
77
175
|
});
|
|
78
176
|
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
177
|
+
_state.label = 3;
|
|
178
|
+
case 3:
|
|
179
|
+
return [
|
|
180
|
+
2,
|
|
181
|
+
byteluckControls
|
|
182
|
+
];
|
|
84
183
|
}
|
|
85
|
-
}
|
|
86
|
-
})
|
|
184
|
+
});
|
|
185
|
+
});
|
|
87
186
|
return _registerByteluckControls.apply(this, arguments);
|
|
88
187
|
}
|