@byteluck-fe/model-driven-core-all 2.21.0-beta.5 → 2.21.0-beta.8

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.
@@ -96,13 +96,13 @@ function _create_super(Derived) {
96
96
  return _possible_constructor_return(this, result);
97
97
  };
98
98
  }
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";
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';
102
102
  export function getHackerControl(comid, type, tipMessage) {
103
103
  var HackerControlClass;
104
104
  // 伪造一个组件
105
- if (type === "runtime") {
105
+ if (type === 'runtime') {
106
106
  HackerControlClass = /*#__PURE__*/ function(RuntimeControl) {
107
107
  "use strict";
108
108
  _inherits(HackerControl, RuntimeControl);
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
  }
@@ -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)
@@ -226,7 +226,7 @@ function _registerCustomControls() {
226
226
  case 3:
227
227
  e = _state.sent();
228
228
  isLoaded = false;
229
- warn("加载自定义控件异常,会影响到的控件:" + item.id, e);
229
+ warn('加载自定义控件异常,会影响到的控件:' + item.id, e);
230
230
  control = getHackerControl(item.id, payload.type, payload.tipMessage);
231
231
  return [
232
232
  3,
@@ -234,18 +234,18 @@ function _registerCustomControls() {
234
234
  ];
235
235
  case 4:
236
236
  if (isLoaded) {
237
- link = "";
238
- if (payload.type === "runtime" && item.runtimecss !== undefined) {
239
- reg = new RegExp(item.id + "-runtime-.*?$");
237
+ link = '';
238
+ if (payload.type === 'runtime' && item.runtimecss !== undefined) {
239
+ reg = new RegExp(item.id + '-runtime-.*?$');
240
240
  link = item.runtime.replace(reg, item.runtimecss);
241
- } else if (payload.type === "designer" && item.designercss !== undefined) {
242
- reg1 = new RegExp(item.id + "-designer-.*?$");
241
+ } else if (payload.type === 'designer' && item.designercss !== undefined) {
242
+ reg1 = new RegExp(item.id + '-designer-.*?$');
243
243
  link = item.designer.replace(reg1, item.designercss);
244
244
  }
245
- if (link !== "") {
246
- styleLink = document.createElement("link");
245
+ if (link !== '') {
246
+ styleLink = document.createElement('link');
247
247
  styleLink.href = link;
248
- styleLink.rel = "stylesheet";
248
+ styleLink.rel = 'stylesheet';
249
249
  document.head.appendChild(styleLink);
250
250
  }
251
251
  }
@@ -264,17 +264,17 @@ 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 = _sliced_to_array(comIdWithVersion.split(":"), 2), comid = _comIdWithVersion_split[0], version = _comIdWithVersion_split[1];
267
+ var _comIdWithVersion_split = _sliced_to_array(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);
271
271
  pushControl(payload.type, control, registered, false, {
272
- fieldType: "",
272
+ fieldType: '',
273
273
  id: comid,
274
- name: "",
275
- runtime: "",
276
- designer: "",
277
- type: "",
274
+ name: '',
275
+ runtime: '',
276
+ designer: '',
277
+ type: '',
278
278
  version: version
279
279
  });
280
280
  }
@@ -289,7 +289,7 @@ function _registerCustomControls() {
289
289
  return _registerCustomControls.apply(this, arguments);
290
290
  }
291
291
  function pushControl(type, control, registered, isLoaded, props) {
292
- if (type === "runtime") {
292
+ if (type === 'runtime') {
293
293
  if (registered.has(control.Runtime.controlType)) {
294
294
  warn("repeat register ".concat(control.Runtime.controlType));
295
295
  }
@@ -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);