@byteluck-fe/model-driven-core-all 2.5.0-alpha.7 → 2.6.0-alpha.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 +32 -45
- package/dist/esm/loadRemoteScripts.js +2 -2
- package/dist/esm/registerByteluckControls.js +2 -2
- package/dist/esm/registerCustomControls.js +13 -13
- package/dist/esm/upgradeCustomControlSchema.js +10 -10
- package/dist/index.umd.js +1 -1
- package/dist/types/getHackerControl.d.ts +23 -23
- package/dist/types/index.d.ts +9 -9
- package/dist/types/loadRemoteScripts.d.ts +7 -7
- package/dist/types/registerByteluckControls.d.ts +6 -6
- package/dist/types/registerCustomControls.d.ts +22 -22
- package/dist/types/upgradeCustomControlSchema.d.ts +2 -2
- package/package.json +6 -6
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _assertThisInitialized(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 _classCallCheck(instance, Constructor) {
|
|
8
8
|
if (!(instance instanceof Constructor)) {
|
|
9
9
|
throw new TypeError("Cannot call a class as a function");
|
|
10
10
|
}
|
|
@@ -18,29 +18,16 @@ function _defineProperties(target, props) {
|
|
|
18
18
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function _createClass(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
|
-
|
|
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) {
|
|
26
|
+
function _getPrototypeOf(o) {
|
|
27
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
41
28
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
42
29
|
};
|
|
43
|
-
return
|
|
30
|
+
return _getPrototypeOf(o);
|
|
44
31
|
}
|
|
45
32
|
function _inherits(subClass, superClass) {
|
|
46
33
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -53,26 +40,26 @@ function _inherits(subClass, superClass) {
|
|
|
53
40
|
configurable: true
|
|
54
41
|
}
|
|
55
42
|
});
|
|
56
|
-
if (superClass)
|
|
43
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
57
44
|
}
|
|
58
|
-
function
|
|
59
|
-
if (call && (
|
|
45
|
+
function _possibleConstructorReturn(self, call) {
|
|
46
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
60
47
|
return call;
|
|
61
48
|
}
|
|
62
|
-
return
|
|
49
|
+
return _assertThisInitialized(self);
|
|
63
50
|
}
|
|
64
|
-
function
|
|
65
|
-
|
|
51
|
+
function _setPrototypeOf(o, p) {
|
|
52
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
66
53
|
o.__proto__ = p;
|
|
67
54
|
return o;
|
|
68
55
|
};
|
|
69
|
-
return
|
|
56
|
+
return _setPrototypeOf(o, p);
|
|
70
57
|
}
|
|
71
|
-
function
|
|
58
|
+
var _typeof = function(obj) {
|
|
72
59
|
"@swc/helpers - typeof";
|
|
73
60
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
74
|
-
}
|
|
75
|
-
function
|
|
61
|
+
};
|
|
62
|
+
function _isNativeReflectConstruct() {
|
|
76
63
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
77
64
|
if (Reflect.construct.sham) return false;
|
|
78
65
|
if (typeof Proxy === "function") return true;
|
|
@@ -83,17 +70,17 @@ function _is_native_reflect_construct() {
|
|
|
83
70
|
return false;
|
|
84
71
|
}
|
|
85
72
|
}
|
|
86
|
-
function
|
|
87
|
-
var hasNativeReflectConstruct =
|
|
73
|
+
function _createSuper(Derived) {
|
|
74
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
88
75
|
return function _createSuperInternal() {
|
|
89
|
-
var Super =
|
|
76
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
90
77
|
if (hasNativeReflectConstruct) {
|
|
91
|
-
var NewTarget =
|
|
78
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
92
79
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
93
80
|
} else {
|
|
94
81
|
result = Super.apply(this, arguments);
|
|
95
82
|
}
|
|
96
|
-
return
|
|
83
|
+
return _possibleConstructorReturn(this, result);
|
|
97
84
|
};
|
|
98
85
|
}
|
|
99
86
|
import { RuntimeControl } from "@byteluck-fe/model-driven-core";
|
|
@@ -101,20 +88,20 @@ import { DesignerControl } from "@byteluck-fe/model-driven-core";
|
|
|
101
88
|
import { Property } from "@byteluck-fe/model-driven-core";
|
|
102
89
|
export function getHackerControl(comid, type, tipMessage) {
|
|
103
90
|
var HackerControlClass;
|
|
104
|
-
|
|
91
|
+
//伪造一个组件
|
|
105
92
|
if (type === "runtime") {
|
|
106
93
|
HackerControlClass = /*#__PURE__*/ function(RuntimeControl) {
|
|
107
94
|
"use strict";
|
|
108
95
|
_inherits(HackerControl, RuntimeControl);
|
|
109
|
-
var _super =
|
|
96
|
+
var _super = _createSuper(HackerControl);
|
|
110
97
|
function HackerControl(props) {
|
|
111
|
-
|
|
98
|
+
_classCallCheck(this, HackerControl);
|
|
112
99
|
var _this;
|
|
113
100
|
_this = _super.call(this, props);
|
|
114
|
-
|
|
101
|
+
_this.props = {};
|
|
115
102
|
return _this;
|
|
116
103
|
}
|
|
117
|
-
|
|
104
|
+
_createClass(HackerControl, null, [
|
|
118
105
|
{
|
|
119
106
|
key: "controlType",
|
|
120
107
|
get: function get() {
|
|
@@ -128,15 +115,15 @@ export function getHackerControl(comid, type, tipMessage) {
|
|
|
128
115
|
HackerControlClass = /*#__PURE__*/ function(DesignerControl) {
|
|
129
116
|
"use strict";
|
|
130
117
|
_inherits(HackerControl, DesignerControl);
|
|
131
|
-
var _super =
|
|
118
|
+
var _super = _createSuper(HackerControl);
|
|
132
119
|
function HackerControl(props) {
|
|
133
|
-
|
|
120
|
+
_classCallCheck(this, HackerControl);
|
|
134
121
|
var _this;
|
|
135
122
|
_this = _super.call(this, props);
|
|
136
|
-
|
|
123
|
+
_this.props = {};
|
|
137
124
|
return _this;
|
|
138
125
|
}
|
|
139
|
-
|
|
126
|
+
_createClass(HackerControl, null, [
|
|
140
127
|
{
|
|
141
128
|
key: "controlType",
|
|
142
129
|
get: function get() {
|
|
@@ -150,9 +137,9 @@ export function getHackerControl(comid, type, tipMessage) {
|
|
|
150
137
|
var HackerPropertyClass = /*#__PURE__*/ function(Property) {
|
|
151
138
|
"use strict";
|
|
152
139
|
_inherits(HackerPropertyClass, Property);
|
|
153
|
-
var _super =
|
|
140
|
+
var _super = _createSuper(HackerPropertyClass);
|
|
154
141
|
function HackerPropertyClass() {
|
|
155
|
-
|
|
142
|
+
_classCallCheck(this, HackerPropertyClass);
|
|
156
143
|
return _super.apply(this, arguments);
|
|
157
144
|
}
|
|
158
145
|
return HackerPropertyClass;
|
|
@@ -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 _asyncToGenerator(fn) {
|
|
16
16
|
return function() {
|
|
17
17
|
var self = this, args = arguments;
|
|
18
18
|
return new Promise(function(resolve, reject) {
|
|
@@ -212,7 +212,7 @@ export function loadRemoteControls(urls, globalModules) {
|
|
|
212
212
|
return _loadRemoteControls.apply(this, arguments);
|
|
213
213
|
}
|
|
214
214
|
function _loadRemoteControls() {
|
|
215
|
-
_loadRemoteControls =
|
|
215
|
+
_loadRemoteControls = _asyncToGenerator(function(urls, globalModules) {
|
|
216
216
|
return __generator(this, function(_state) {
|
|
217
217
|
switch(_state.label){
|
|
218
218
|
case 0:
|
|
@@ -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 _asyncToGenerator(fn) {
|
|
16
16
|
return function() {
|
|
17
17
|
var self = this, args = arguments;
|
|
18
18
|
return new Promise(function(resolve, reject) {
|
|
@@ -128,7 +128,7 @@ export function registerByteluckControls(url, payload) {
|
|
|
128
128
|
return _registerByteluckControls.apply(this, arguments);
|
|
129
129
|
}
|
|
130
130
|
function _registerByteluckControls() {
|
|
131
|
-
_registerByteluckControls =
|
|
131
|
+
_registerByteluckControls = _asyncToGenerator(function(url, payload) {
|
|
132
132
|
var version, byteluckControls, componentsStr, components, controls;
|
|
133
133
|
return __generator(this, function(_state) {
|
|
134
134
|
switch(_state.label){
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _arrayLikeToArray(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
|
|
6
|
+
function _arrayWithHoles(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
9
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -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
|
|
23
|
+
function _asyncToGenerator(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 _async_to_generator(fn) {
|
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function _iterableToArrayLimit(arr, i) {
|
|
39
39
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
40
40
|
if (_i == null) return;
|
|
41
41
|
var _arr = [];
|
|
@@ -59,19 +59,19 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
59
59
|
}
|
|
60
60
|
return _arr;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function _nonIterableRest() {
|
|
63
63
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
return
|
|
65
|
+
function _slicedToArray(arr, i) {
|
|
66
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
69
69
|
if (!o) return;
|
|
70
|
-
if (typeof o === "string") return
|
|
70
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
71
71
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
72
72
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
73
73
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
74
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
74
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
75
75
|
}
|
|
76
76
|
var __generator = this && this.__generator || function(thisArg, body) {
|
|
77
77
|
var f, y, t, g, _ = {
|
|
@@ -175,7 +175,7 @@ export function registerCustomControls(componentList, components, refLibs, paylo
|
|
|
175
175
|
return _registerCustomControls.apply(this, arguments);
|
|
176
176
|
}
|
|
177
177
|
function _registerCustomControls() {
|
|
178
|
-
_registerCustomControls =
|
|
178
|
+
_registerCustomControls = _asyncToGenerator(function(componentList, components, refLibs, payload) {
|
|
179
179
|
var registered;
|
|
180
180
|
return __generator(this, function(_state) {
|
|
181
181
|
switch(_state.label){
|
|
@@ -191,7 +191,7 @@ function _registerCustomControls() {
|
|
|
191
191
|
return [
|
|
192
192
|
4,
|
|
193
193
|
Promise.all(components.map(function() {
|
|
194
|
-
var _ref =
|
|
194
|
+
var _ref = _asyncToGenerator(function(item) {
|
|
195
195
|
var isLoaded, control, url, e, link, reg, reg1, styleLink;
|
|
196
196
|
return __generator(this, function(_state) {
|
|
197
197
|
switch(_state.label){
|
|
@@ -264,7 +264,7 @@ function _registerCustomControls() {
|
|
|
264
264
|
case 1:
|
|
265
265
|
_state.sent();
|
|
266
266
|
componentList === null || componentList === void 0 ? void 0 : componentList.map(function(comIdWithVersion) {
|
|
267
|
-
var _comIdWithVersion_split =
|
|
267
|
+
var _comIdWithVersion_split = _slicedToArray(comIdWithVersion.split(":"), 2), comid = _comIdWithVersion_split[0], version = _comIdWithVersion_split[1];
|
|
268
268
|
var hasControl = registered.has(comid);
|
|
269
269
|
if (hasControl === false) {
|
|
270
270
|
var control = getHackerControl(comid, payload.type, payload.tipMessage);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _arrayLikeToArray(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
|
|
6
|
+
function _arrayWithHoles(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function _iterableToArrayLimit(arr, i) {
|
|
10
10
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
11
11
|
if (_i == null) return;
|
|
12
12
|
var _arr = [];
|
|
@@ -30,26 +30,26 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
30
30
|
}
|
|
31
31
|
return _arr;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function _nonIterableRest() {
|
|
34
34
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
36
|
+
function _slicedToArray(arr, i) {
|
|
37
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
40
40
|
if (!o) return;
|
|
41
|
-
if (typeof o === "string") return
|
|
41
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
42
42
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
43
43
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
44
44
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
45
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
45
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
46
46
|
}
|
|
47
47
|
export function upgradeCustomControlSchema(schema, registered, componentList, payload) {
|
|
48
48
|
var hasControl = registered.get(schema.type);
|
|
49
49
|
if (hasControl && hasControl.control.upgrade) {
|
|
50
50
|
var oldVersion = "";
|
|
51
51
|
componentList === null || componentList === void 0 ? void 0 : componentList.map(function(comIdWithVersion) {
|
|
52
|
-
var _comIdWithVersion_split =
|
|
52
|
+
var _comIdWithVersion_split = _slicedToArray(comIdWithVersion.split(":"), 2), comid = _comIdWithVersion_split[0], version = _comIdWithVersion_split[1];
|
|
53
53
|
if (hasControl.props.id === comid) {
|
|
54
54
|
oldVersion = version !== null && version !== void 0 ? version : "";
|
|
55
55
|
}
|