@byteluck-fe/model-driven-core-all 2.9.0-beta.1 → 2.9.1-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/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
+ ```
@@ -4,6 +4,10 @@ function _assert_this_initialized(self) {
4
4
  }
5
5
  return self;
6
6
  }
7
+ function _call_super(_this, derived, args) {
8
+ derived = _get_prototype_of(derived);
9
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
10
+ }
7
11
  function _class_call_check(instance, Constructor) {
8
12
  if (!(instance instanceof Constructor)) {
9
13
  throw new TypeError("Cannot call a class as a function");
@@ -73,45 +77,29 @@ function _type_of(obj) {
73
77
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
74
78
  }
75
79
  function _is_native_reflect_construct() {
76
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
77
- if (Reflect.construct.sham) return false;
78
- if (typeof Proxy === "function") return true;
79
80
  try {
80
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
81
- return true;
82
- } catch (e) {
83
- return false;
84
- }
85
- }
86
- function _create_super(Derived) {
87
- var hasNativeReflectConstruct = _is_native_reflect_construct();
88
- return function _createSuperInternal() {
89
- var Super = _get_prototype_of(Derived), result;
90
- if (hasNativeReflectConstruct) {
91
- var NewTarget = _get_prototype_of(this).constructor;
92
- result = Reflect.construct(Super, arguments, NewTarget);
93
- } else {
94
- result = Super.apply(this, arguments);
95
- }
96
- return _possible_constructor_return(this, result);
97
- };
81
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
82
+ } catch (_) {}
83
+ return (_is_native_reflect_construct = function() {
84
+ return !!result;
85
+ })();
98
86
  }
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";
87
+ import { RuntimeControl } from '@byteluck-fe/model-driven-core';
88
+ import { DesignerControl } from '@byteluck-fe/model-driven-core';
89
+ import { Property } from '@byteluck-fe/model-driven-core';
102
90
  export function getHackerControl(comid, type, tipMessage) {
103
91
  var HackerControlClass;
104
92
  // 伪造一个组件
105
- if (type === "runtime") {
93
+ if (type === 'runtime') {
106
94
  HackerControlClass = /*#__PURE__*/ function(RuntimeControl) {
107
95
  "use strict";
108
96
  _inherits(HackerControl, RuntimeControl);
109
- var _super = _create_super(HackerControl);
110
97
  function HackerControl(props) {
111
98
  _class_call_check(this, HackerControl);
112
99
  var _this;
113
- _this = _super.call(this, props);
114
- _define_property(_assert_this_initialized(_this), "props", {});
100
+ _this = _call_super(this, HackerControl, [
101
+ props
102
+ ]), _define_property(_this, "props", {});
115
103
  return _this;
116
104
  }
117
105
  _create_class(HackerControl, null, [
@@ -128,12 +116,12 @@ export function getHackerControl(comid, type, tipMessage) {
128
116
  HackerControlClass = /*#__PURE__*/ function(DesignerControl) {
129
117
  "use strict";
130
118
  _inherits(HackerControl, DesignerControl);
131
- var _super = _create_super(HackerControl);
132
119
  function HackerControl(props) {
133
120
  _class_call_check(this, HackerControl);
134
121
  var _this;
135
- _this = _super.call(this, props);
136
- _define_property(_assert_this_initialized(_this), "props", {});
122
+ _this = _call_super(this, HackerControl, [
123
+ props
124
+ ]), _define_property(_this, "props", {});
137
125
  return _this;
138
126
  }
139
127
  _create_class(HackerControl, null, [
@@ -150,10 +138,9 @@ export function getHackerControl(comid, type, tipMessage) {
150
138
  var HackerPropertyClass = /*#__PURE__*/ function(Property) {
151
139
  "use strict";
152
140
  _inherits(HackerPropertyClass, Property);
153
- var _super = _create_super(HackerPropertyClass);
154
141
  function HackerPropertyClass() {
155
142
  _class_call_check(this, HackerPropertyClass);
156
- return _super.apply(this, arguments);
143
+ return _call_super(this, HackerPropertyClass, arguments);
157
144
  }
158
145
  return HackerPropertyClass;
159
146
  }(Property);
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';
@@ -146,10 +146,10 @@ function hackWindow(globalModules) {
146
146
  }
147
147
  export function loadScriptFromTag(url, globalModules) {
148
148
  var p = new Promise(function(resolve, reject) {
149
- var script = document.createElement("script");
149
+ var script = document.createElement('script');
150
150
  var resetHackWindow = hackWindow(globalModules);
151
151
  script.src = url;
152
- script.type = "text/javascript";
152
+ script.type = 'text/javascript';
153
153
  var loadEnd = function() {
154
154
  document.head.removeChild(script);
155
155
  var index = jobs.findIndex(function(j) {
@@ -175,12 +175,12 @@ export function loadScriptFromTag(url, globalModules) {
175
175
  }
176
176
  export function nativeFetch(url) {
177
177
  return fetch(url, {
178
- mode: "cors",
179
- cache: "no-cache",
180
- credentials: "same-origin"
178
+ mode: 'cors',
179
+ cache: 'no-cache',
180
+ credentials: 'same-origin'
181
181
  }).then(function(response) {
182
182
  if (response.ok === false) {
183
- throw "not found resource:" + url;
183
+ throw 'not found resource:' + url;
184
184
  } else {
185
185
  return response.text();
186
186
  }
@@ -195,7 +195,7 @@ export function loadScriptFromFetch(url, globalModules) {
195
195
  var module = {
196
196
  exports: {}
197
197
  };
198
- new Function("module", "exports", "require", response)(module, module.exports, function(id) {
198
+ new Function('module', 'exports', 'require', response)(module, module.exports, function(id) {
199
199
  return globalModules[id];
200
200
  });
201
201
  resolve(module.exports);
@@ -122,8 +122,8 @@ function _ts_generator(thisArg, body) {
122
122
  };
123
123
  }
124
124
  }
125
- import { getHackerControl } from "./getHackerControl";
126
- import { nativeFetch, loadRemoteControl } from "./loadRemoteScripts";
125
+ import { getHackerControl } from './getHackerControl';
126
+ import { nativeFetch, loadRemoteControl } from './loadRemoteScripts';
127
127
  export function registerByteluckControls(url, payload) {
128
128
  return _registerByteluckControls.apply(this, arguments);
129
129
  }
@@ -134,7 +134,7 @@ function _registerByteluckControls() {
134
134
  switch(_state.label){
135
135
  case 0:
136
136
  version = payload.version;
137
- if (payload.version === "random") {
137
+ if (payload.version === 'random') {
138
138
  version = new Date().valueOf().toString();
139
139
  }
140
140
  byteluckControls = new Map();
@@ -158,14 +158,14 @@ function _registerByteluckControls() {
158
158
  controls = _state.sent();
159
159
  components.map(function(item) {
160
160
  var control = controls.find(function(control) {
161
- if (payload.type === "runtime") {
161
+ if (payload.type === 'runtime') {
162
162
  return control.Runtime.controlType === item.id;
163
163
  } else {
164
164
  return control.Designer.controlType === item.id;
165
165
  }
166
166
  });
167
167
  if (control === undefined) {
168
- control = getHackerControl(item.id, payload.type, "内置组件加载错误");
168
+ control = getHackerControl(item.id, payload.type, '内置组件加载错误');
169
169
  }
170
170
  byteluckControls.set(item.id, {
171
171
  props: item,
@@ -168,9 +168,9 @@ function _ts_generator(thisArg, body) {
168
168
  };
169
169
  }
170
170
  }
171
- import { loadRemoteControl } from "./loadRemoteScripts";
172
- import { warn } from "@byteluck-fe/model-driven-shared";
173
- import { getHackerControl } from "./getHackerControl";
171
+ import { loadRemoteControl } from './loadRemoteScripts';
172
+ import { warn } from '@byteluck-fe/model-driven-shared';
173
+ import { getHackerControl } from './getHackerControl';
174
174
  export function registerCustomControls(componentList, components, refLibs, payload) {
175
175
  return _registerCustomControls.apply(this, arguments);
176
176
  }
@@ -190,7 +190,7 @@ function _registerCustomControls() {
190
190
  //qiyu 2022-4-18 逐个加载自定义组件,只有异常的组件加载为hackerControl
191
191
  return [
192
192
  4,
193
- Promise.all(components.map(function() {
193
+ Promise.all(components.map(/*#__PURE__*/ function() {
194
194
  var _ref = _async_to_generator(function(item) {
195
195
  var isLoaded, control, url, e, link, reg, reg1, styleLink;
196
196
  return _ts_generator(this, function(_state) {
@@ -206,13 +206,13 @@ function _registerCustomControls() {
206
206
  4
207
207
  ]);
208
208
  isLoaded = true;
209
- url = "";
210
- if (payload.type === "runtime") {
209
+ url = '';
210
+ if (payload.type === 'runtime') {
211
211
  url = item.runtime;
212
212
  } else {
213
213
  url = item.designer;
214
214
  }
215
- url += "?v=" + item.version;
215
+ url += '?v=' + item.version;
216
216
  return [
217
217
  4,
218
218
  loadRemoteControl(url, refLibs)
@@ -220,7 +220,7 @@ function _registerCustomControls() {
220
220
  case 2:
221
221
  control = _state.sent();
222
222
  //探测组件是否加载正常
223
- if (payload.type === "runtime") {
223
+ if (payload.type === 'runtime') {
224
224
  control.Runtime.__is_control__ === true;
225
225
  } else {
226
226
  control.Designer.__is_control__ === true;
@@ -232,7 +232,7 @@ function _registerCustomControls() {
232
232
  case 3:
233
233
  e = _state.sent();
234
234
  isLoaded = false;
235
- warn("加载自定义控件异常,会影响到的控件:" + item.id, e);
235
+ warn('加载自定义控件异常,会影响到的控件:' + item.id, e);
236
236
  control = getHackerControl(item.id, payload.type, payload.tipMessage);
237
237
  return [
238
238
  3,
@@ -240,18 +240,18 @@ function _registerCustomControls() {
240
240
  ];
241
241
  case 4:
242
242
  if (isLoaded) {
243
- link = "";
244
- if (payload.type === "runtime" && item.runtimecss !== undefined) {
245
- reg = new RegExp(item.id + "-runtime-.*?$");
243
+ link = '';
244
+ if (payload.type === 'runtime' && item.runtimecss !== undefined) {
245
+ reg = new RegExp(item.id + '-runtime-.*?$');
246
246
  link = item.runtime.replace(reg, item.runtimecss);
247
- } else if (payload.type === "designer" && item.designercss !== undefined) {
248
- reg1 = new RegExp(item.id + "-designer-.*?$");
247
+ } else if (payload.type === 'designer' && item.designercss !== undefined) {
248
+ reg1 = new RegExp(item.id + '-designer-.*?$');
249
249
  link = item.designer.replace(reg1, item.designercss);
250
250
  }
251
- if (link !== "") {
252
- styleLink = document.createElement("link");
251
+ if (link !== '') {
252
+ styleLink = document.createElement('link');
253
253
  styleLink.href = link;
254
- styleLink.rel = "stylesheet";
254
+ styleLink.rel = 'stylesheet';
255
255
  document.head.appendChild(styleLink);
256
256
  }
257
257
  }
@@ -270,17 +270,17 @@ function _registerCustomControls() {
270
270
  case 1:
271
271
  _state.sent();
272
272
  componentList === null || componentList === void 0 ? void 0 : componentList.map(function(comIdWithVersion) {
273
- var _comIdWithVersion_split = _sliced_to_array(comIdWithVersion.split(":"), 2), comid = _comIdWithVersion_split[0], version = _comIdWithVersion_split[1];
273
+ var _comIdWithVersion_split = _sliced_to_array(comIdWithVersion.split(':'), 2), comid = _comIdWithVersion_split[0], version = _comIdWithVersion_split[1];
274
274
  var hasControl = registered.has(comid);
275
275
  if (hasControl === false) {
276
276
  var control = getHackerControl(comid, payload.type, payload.tipMessage);
277
277
  pushControl(payload.type, control, registered, false, {
278
- fieldType: "",
278
+ fieldType: '',
279
279
  id: comid,
280
- name: "",
281
- runtime: "",
282
- designer: "",
283
- type: "",
280
+ name: '',
281
+ runtime: '',
282
+ designer: '',
283
+ type: '',
284
284
  version: version
285
285
  });
286
286
  }
@@ -295,7 +295,7 @@ function _registerCustomControls() {
295
295
  return _registerCustomControls.apply(this, arguments);
296
296
  }
297
297
  function pushControl(type, control, registered, isLoaded, props) {
298
- if (type === "runtime") {
298
+ if (type === 'runtime') {
299
299
  if (registered.has(control.Runtime.controlType)) {
300
300
  warn("repeat register ".concat(control.Runtime.controlType));
301
301
  }
@@ -47,11 +47,11 @@ function _unsupported_iterable_to_array(o, minLen) {
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
- var oldVersion = "";
50
+ var oldVersion = '';
51
51
  componentList === null || componentList === void 0 ? void 0 : componentList.map(function(comIdWithVersion) {
52
- var _comIdWithVersion_split = _sliced_to_array(comIdWithVersion.split(":"), 2), comid = _comIdWithVersion_split[0], version = _comIdWithVersion_split[1];
52
+ var _comIdWithVersion_split = _sliced_to_array(comIdWithVersion.split(':'), 2), comid = _comIdWithVersion_split[0], version = _comIdWithVersion_split[1];
53
53
  if (hasControl.props.id === comid) {
54
- oldVersion = version !== null && version !== void 0 ? version : "";
54
+ oldVersion = version !== null && version !== void 0 ? version : '';
55
55
  }
56
56
  });
57
57
  schema = hasControl.control.upgrade(schema, hasControl.version, oldVersion, payload);