@byteluck-fe/model-driven-core-all 2.7.0-alpha.30 → 2.7.0-alpha.31b

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/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # `runtime-all`
2
-
3
- > TODO: description
4
-
5
- ## Usage
6
-
7
- ```
8
- const runtimeAll = require('runtime-all');
9
-
10
- // TODO: DEMONSTRATE API
11
- ```
1
+ # `runtime-all`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const runtimeAll = require('runtime-all');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
@@ -1,10 +1,10 @@
1
- function _assert_this_initialized(self) {
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 _class_call_check(instance, Constructor) {
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 _create_class(Constructor, protoProps, staticProps) {
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 _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) {
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 _get_prototype_of(o);
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) _set_prototype_of(subClass, superClass);
43
+ if (superClass) _setPrototypeOf(subClass, superClass);
57
44
  }
58
- function _possible_constructor_return(self, call) {
59
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
45
+ function _possibleConstructorReturn(self, call) {
46
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
60
47
  return call;
61
48
  }
62
- return _assert_this_initialized(self);
49
+ return _assertThisInitialized(self);
63
50
  }
64
- function _set_prototype_of(o, p) {
65
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
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 _set_prototype_of(o, p);
56
+ return _setPrototypeOf(o, p);
70
57
  }
71
- function _type_of(obj) {
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 _is_native_reflect_construct() {
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,38 +70,38 @@ function _is_native_reflect_construct() {
83
70
  return false;
84
71
  }
85
72
  }
86
- function _create_super(Derived) {
87
- var hasNativeReflectConstruct = _is_native_reflect_construct();
73
+ function _createSuper(Derived) {
74
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
88
75
  return function _createSuperInternal() {
89
- var Super = _get_prototype_of(Derived), result;
76
+ var Super = _getPrototypeOf(Derived), result;
90
77
  if (hasNativeReflectConstruct) {
91
- var NewTarget = _get_prototype_of(this).constructor;
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 _possible_constructor_return(this, result);
83
+ return _possibleConstructorReturn(this, result);
97
84
  };
98
85
  }
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";
86
+ import { RuntimeControl } from '@byteluck-fe/model-driven-core';
87
+ import { DesignerControl } from '@byteluck-fe/model-driven-core';
88
+ import { Property } from '@byteluck-fe/model-driven-core';
102
89
  export function getHackerControl(comid, type, tipMessage) {
103
90
  var HackerControlClass;
104
91
  // 伪造一个组件
105
- if (type === "runtime") {
106
- HackerControlClass = /*#__PURE__*/ function(RuntimeControl) {
92
+ if (type === 'runtime') {
93
+ HackerControlClass = /*#__PURE__*/ (function(RuntimeControl1) {
107
94
  "use strict";
108
- _inherits(HackerControl, RuntimeControl);
109
- var _super = _create_super(HackerControl);
95
+ _inherits(HackerControl, RuntimeControl1);
96
+ var _super = _createSuper(HackerControl);
110
97
  function HackerControl(props) {
111
- _class_call_check(this, HackerControl);
98
+ _classCallCheck(this, HackerControl);
112
99
  var _this;
113
100
  _this = _super.call(this, props);
114
- _define_property(_assert_this_initialized(_this), "props", {});
101
+ _this.props = {};
115
102
  return _this;
116
103
  }
117
- _create_class(HackerControl, null, [
104
+ _createClass(HackerControl, null, [
118
105
  {
119
106
  key: "controlType",
120
107
  get: function get() {
@@ -123,20 +110,20 @@ export function getHackerControl(comid, type, tipMessage) {
123
110
  }
124
111
  ]);
125
112
  return HackerControl;
126
- }(RuntimeControl);
113
+ })(RuntimeControl);
127
114
  } else {
128
- HackerControlClass = /*#__PURE__*/ function(DesignerControl) {
115
+ HackerControlClass = /*#__PURE__*/ (function(DesignerControl1) {
129
116
  "use strict";
130
- _inherits(HackerControl, DesignerControl);
131
- var _super = _create_super(HackerControl);
117
+ _inherits(HackerControl, DesignerControl1);
118
+ var _super = _createSuper(HackerControl);
132
119
  function HackerControl(props) {
133
- _class_call_check(this, HackerControl);
120
+ _classCallCheck(this, HackerControl);
134
121
  var _this;
135
122
  _this = _super.call(this, props);
136
- _define_property(_assert_this_initialized(_this), "props", {});
123
+ _this.props = {};
137
124
  return _this;
138
125
  }
139
- _create_class(HackerControl, null, [
126
+ _createClass(HackerControl, null, [
140
127
  {
141
128
  key: "controlType",
142
129
  get: function get() {
@@ -145,19 +132,19 @@ export function getHackerControl(comid, type, tipMessage) {
145
132
  }
146
133
  ]);
147
134
  return HackerControl;
148
- }(DesignerControl);
135
+ })(DesignerControl);
149
136
  }
150
- var HackerPropertyClass = /*#__PURE__*/ function(Property) {
137
+ var HackerPropertyClass = /*#__PURE__*/ function(Property1) {
151
138
  "use strict";
152
- _inherits(HackerPropertyClass, Property);
153
- var _super = _create_super(HackerPropertyClass);
139
+ _inherits(HackerPropertyClass, Property1);
140
+ var _super = _createSuper(HackerPropertyClass);
154
141
  function HackerPropertyClass() {
155
- _class_call_check(this, HackerPropertyClass);
142
+ _classCallCheck(this, HackerPropertyClass);
156
143
  return _super.apply(this, arguments);
157
144
  }
158
145
  return HackerPropertyClass;
159
146
  }(Property);
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>");
147
+ 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>");
161
148
  var control = {
162
149
  Runtime: HackerControlClass,
163
150
  Designer: HackerControlClass,
package/dist/esm/index.js CHANGED
@@ -1,9 +1,9 @@
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";
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 _async_to_generator(fn) {
15
+ function _asyncToGenerator(fn) {
16
16
  return function() {
17
17
  var self = this, args = arguments;
18
18
  return new Promise(function(resolve, reject) {
@@ -27,101 +27,7 @@ function _async_to_generator(fn) {
27
27
  });
28
28
  };
29
29
  }
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
- }
30
+ import regeneratorRuntime from "regenerator-runtime";
125
31
  var jobs = [];
126
32
  var module = {
127
33
  exports: {}
@@ -132,8 +38,8 @@ function hackWindow(globalModules) {
132
38
  if (!hacked) {
133
39
  window.module = module;
134
40
  window.exports = module.exports;
135
- window.require = function(module) {
136
- return globalModules[module];
41
+ window.require = function(module1) {
42
+ return globalModules[module1];
137
43
  };
138
44
  hacked = true;
139
45
  }
@@ -146,10 +52,10 @@ function hackWindow(globalModules) {
146
52
  }
147
53
  export function loadScriptFromTag(url, globalModules) {
148
54
  var p = new Promise(function(resolve, reject) {
149
- var script = document.createElement("script");
55
+ var script = document.createElement('script');
150
56
  var resetHackWindow = hackWindow(globalModules);
151
57
  script.src = url;
152
- script.type = "text/javascript";
58
+ script.type = 'text/javascript';
153
59
  var loadEnd = function() {
154
60
  document.head.removeChild(script);
155
61
  var index = jobs.findIndex(function(j) {
@@ -175,12 +81,12 @@ export function loadScriptFromTag(url, globalModules) {
175
81
  }
176
82
  export function nativeFetch(url) {
177
83
  return fetch(url, {
178
- mode: "cors",
179
- cache: "no-cache",
180
- credentials: "same-origin"
84
+ mode: 'cors',
85
+ cache: 'no-cache',
86
+ credentials: 'same-origin'
181
87
  }).then(function(response) {
182
88
  if (response.ok === false) {
183
- throw "not found resource:" + url;
89
+ throw 'not found resource:' + url;
184
90
  } else {
185
91
  return response.text();
186
92
  }
@@ -193,13 +99,13 @@ export function loadScriptFromFetch(url, globalModules) {
193
99
  return new Promise(function(resolve, reject) {
194
100
  // const newUrl = url.replace(/^(https?:)?\/\/.*?\/component/, '/component')
195
101
  options.fetch(url).then(function(response) {
196
- var module = {
102
+ var module2 = {
197
103
  exports: {}
198
104
  };
199
- new Function("module", "exports", "require", response)(module, module.exports, function(id) {
105
+ new Function('module', 'exports', 'require', response)(module2, module2.exports, function(id) {
200
106
  return globalModules[id];
201
107
  });
202
- resolve(module.exports);
108
+ resolve(module2.exports);
203
109
  }).catch(function(e) {
204
110
  reject(e);
205
111
  });
@@ -212,23 +118,21 @@ export function loadRemoteControls(urls, globalModules) {
212
118
  return _loadRemoteControls.apply(this, arguments);
213
119
  }
214
120
  function _loadRemoteControls() {
215
- _loadRemoteControls = _async_to_generator(function(urls, globalModules) {
216
- return _ts_generator(this, function(_state) {
217
- switch(_state.label){
121
+ _loadRemoteControls = _asyncToGenerator(regeneratorRuntime.mark(function _callee(urls, globalModules) {
122
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
123
+ while(1)switch(_ctx.prev = _ctx.next){
218
124
  case 0:
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
- ];
125
+ _ctx.next = 2;
126
+ return Promise.all(urls.map(function(url) {
127
+ return loadRemoteControl(url, globalModules);
128
+ }));
129
+ case 2:
130
+ return _ctx.abrupt("return", _ctx.sent);
131
+ case 3:
132
+ case "end":
133
+ return _ctx.stop();
230
134
  }
231
- });
232
- });
135
+ }, _callee);
136
+ }));
233
137
  return _loadRemoteControls.apply(this, arguments);
234
138
  }
@@ -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 _async_to_generator(fn) {
15
+ function _asyncToGenerator(fn) {
16
16
  return function() {
17
17
  var self = this, args = arguments;
18
18
  return new Promise(function(resolve, reject) {
@@ -27,161 +27,62 @@ function _async_to_generator(fn) {
27
27
  });
28
28
  };
29
29
  }
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";
30
+ import regeneratorRuntime from "regenerator-runtime";
31
+ import { getHackerControl } from './getHackerControl';
32
+ import { nativeFetch, loadRemoteControl } from './loadRemoteScripts';
127
33
  export function registerByteluckControls(url, payload) {
128
34
  return _registerByteluckControls.apply(this, arguments);
129
35
  }
130
36
  function _registerByteluckControls() {
131
- _registerByteluckControls = _async_to_generator(function(url, payload) {
37
+ _registerByteluckControls = _asyncToGenerator(regeneratorRuntime.mark(function _callee(url, payload) {
132
38
  var version, byteluckControls, componentsStr, components, controls;
133
- return _ts_generator(this, function(_state) {
134
- switch(_state.label){
39
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
40
+ while(1)switch(_ctx.prev = _ctx.next){
135
41
  case 0:
136
42
  version = payload.version;
137
- if (payload.version === "random") {
43
+ if (payload.version === 'random') {
138
44
  version = new Date().valueOf().toString();
139
45
  }
140
46
  byteluckControls = new Map();
141
- return [
142
- 4,
143
- nativeFetch("".concat(url, "/component.json?v=").concat(version))
144
- ];
145
- case 1:
146
- componentsStr = _state.sent();
47
+ _ctx.next = 5;
48
+ return nativeFetch("".concat(url, "/component.json?v=").concat(version));
49
+ case 5:
50
+ componentsStr = _ctx.sent;
147
51
  components = [];
148
- if (!(componentsStr !== undefined)) return [
149
- 3,
150
- 3
151
- ];
52
+ if (!(componentsStr !== undefined)) {
53
+ _ctx.next = 13;
54
+ break;
55
+ }
152
56
  components = JSON.parse(componentsStr);
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();
57
+ _ctx.next = 11;
58
+ return loadRemoteControl("".concat(url, "/").concat(payload.type, ".js?v=").concat(version), payload.globalModules);
59
+ case 11:
60
+ controls = _ctx.sent;
159
61
  components.map(function(item) {
160
- var control = controls.find(function(control) {
161
- if (payload.type === "runtime") {
62
+ var control1 = controls.find(function(control) {
63
+ if (payload.type === 'runtime') {
162
64
  return control.Runtime.controlType === item.id;
163
65
  } else {
164
66
  return control.Designer.controlType === item.id;
165
67
  }
166
68
  });
167
- if (control === undefined) {
168
- control = getHackerControl(item.id, payload.type, "内置组件加载错误");
69
+ if (control1 === undefined) {
70
+ control1 = getHackerControl(item.id, payload.type, '内置组件加载错误');
169
71
  }
170
72
  byteluckControls.set(item.id, {
171
73
  props: item,
172
74
  version: item.version,
173
75
  isLoaded: true,
174
- control: control
76
+ control: control1
175
77
  });
176
78
  });
177
- _state.label = 3;
178
- case 3:
179
- return [
180
- 2,
181
- byteluckControls
182
- ];
79
+ case 13:
80
+ return _ctx.abrupt("return", byteluckControls);
81
+ case 14:
82
+ case "end":
83
+ return _ctx.stop();
183
84
  }
184
- });
185
- });
85
+ }, _callee);
86
+ }));
186
87
  return _registerByteluckControls.apply(this, arguments);
187
88
  }