@zzdadelu/schema-builder 1.0.0-alpha.76 → 1.0.0-alpha.78

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.
@@ -1,105 +1,14 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
1
  var createIframeContent = function createIframeContent() {
8
2
  var html = "\n <html>\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\" />\n <title>XRender</title>\n <link rel=\"icon\" href=\"https://img.alicdn.com/tfs/TB17UtINiLaK1RjSZFxXXamPFXa-606-643.png\">\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css\" rel=\"stylesheet\" />\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css\" rel=\"stylesheet\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/css/engine-core.css\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css\" />\n <link rel=\"stylesheet\" href=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/css/index.css\" />\n\n <script>\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n </script>\n \n <script src=\"https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js\"></script>\n <script src=\"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js\"></script>\n <script src=\"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js\"></script>\n <script src=\"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js\"></script>\n <script src=\"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js\"></script>\n </head>\n\n <body>\n <div id=\"lce-container\"></div>\n <script type=\"text/javascript\" src=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/js/index.js\"></script>\n </body>\n </html>\n ";
9
3
  return html;
10
4
  };
11
5
  export default (function () {
12
6
  var iframe = document.createElement('iframe');
13
- iframe.width = '100%';
14
- iframe.height = '100%';
15
- iframe.frameBorder = '0';
16
- iframe.srcdoc = createIframeContent();
17
-
18
- // 监听iframe加载完成
19
7
  iframe.onload = function () {
20
- console.log('1', iframe.contentWindow);
21
- var win = iframe.contentWindow;
22
- if (!win) return;
23
-
24
- // 拦截低代码引擎的createSimulator函数
25
- patchCreateSimulatorInIframe(win);
26
- console.log('2', iframe.contentWindow);
27
- return iframe;
8
+ iframe.width = '100%';
9
+ iframe.height = '100%';
10
+ iframe.frameBorder = '0';
11
+ iframe.srcdoc = createIframeContent();
28
12
  };
29
- });
30
-
31
- // 在iframe内部修补createSimulator函数
32
- function patchCreateSimulatorInIframe(iframeWindow) {
33
- // 保存原始的createSimulator函数
34
- var originalCreateSimulator = iframeWindow.createSimulator;
35
- console.log('3', originalCreateSimulator);
36
- if (originalCreateSimulator) {
37
- iframeWindow.createSimulator = function (host, iframe, vendors) {
38
- // 处理vendors,给JS URL添加时间戳
39
- var processedVendors = addTimestampToVendors(vendors);
40
- return originalCreateSimulator.call(this, host, iframe, processedVendors);
41
- };
42
- }
43
-
44
- // 工具函数(同上)
45
- function addTimestampToVendors(vendors) {
46
- var timestamp = new Date().getTime();
47
- return vendors.map(function (vendor) {
48
- if (!vendor) return vendor;
49
- if (vendor.type === 'bundle' && Array.isArray(vendor.assets)) {
50
- return _objectSpread(_objectSpread({}, vendor), {}, {
51
- assets: vendor.assets.map(function (asset) {
52
- if (!asset) return asset;
53
-
54
- // 处理字符串URL
55
- if (typeof asset === 'string') {
56
- return addTimestampToUrl(asset, timestamp);
57
- }
58
-
59
- // 处理数组(可能是URL数组)
60
- if (Array.isArray(asset)) {
61
- return asset.map(function (item) {
62
- if (typeof item === 'string') {
63
- return addTimestampToUrl(item, timestamp);
64
- }
65
- // 处理数组中的数组(嵌套情况)
66
- if (Array.isArray(item)) {
67
- return item.map(function (subItem) {
68
- if (typeof subItem === 'string') {
69
- return addTimestampToUrl(subItem, timestamp);
70
- }
71
- return subItem;
72
- });
73
- }
74
- return item;
75
- });
76
- }
77
-
78
- // 处理对象类型
79
- if (_typeof(asset) === 'object') {
80
- if (asset.type === 'jsText' || asset.type === 'cssText') {
81
- // 内联脚本,不需要加时间戳
82
- return asset;
83
- }
84
- if (asset.content && typeof asset.content === 'string') {
85
- return _objectSpread(_objectSpread({}, asset), {}, {
86
- content: addTimestampToUrl(asset.content, timestamp)
87
- });
88
- }
89
- }
90
- return asset;
91
- })
92
- });
93
- }
94
- return vendor;
95
- });
96
- }
97
- function addTimestampToUrl(url, timestamp) {
98
- if (!url || typeof url !== 'string') return url;
99
-
100
- // 跳过已经有时间戳的URL
101
- if (url.includes('t=')) return url;
102
- var separator = url.includes('?') ? '&' : '?';
103
- return "".concat(url).concat(separator, "t=").concat(timestamp);
104
- }
105
- }
13
+ return iframe;
14
+ });
@@ -4,106 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
8
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
11
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
12
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
13
7
  var createIframeContent = function createIframeContent() {
14
8
  var html = "\n <html>\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\" />\n <title>XRender</title>\n <link rel=\"icon\" href=\"https://img.alicdn.com/tfs/TB17UtINiLaK1RjSZFxXXamPFXa-606-643.png\">\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/variables.css\" rel=\"stylesheet\" />\n <link href=\"https://alifd.alicdn.com/npm/@alifd/theme-lowcode-light@0.2.1/dist/next.var.min.css\" rel=\"stylesheet\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/css/engine-core.css\" />\n <link rel=\"stylesheet\" href=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/css/engine-ext.css\" />\n <link rel=\"stylesheet\" href=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/css/index.css\" />\n\n <script>\n window.React = window.parent.React;\n window.ReactDOM = window.parent.ReactDOM;\n </script>\n \n <script src=\"https://g.alicdn.com/code/lib/prop-types/15.7.2/prop-types.js\"></script>\n <script src=\"https://g.alicdn.com/platform/c/react15-polyfill/0.0.1/dist/index.js\"></script>\n <script src=\"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js\"></script>\n <script src=\"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js\"></script>\n <script src=\"https://g.alicdn.com/code/lib/alifd__next/1.23.24/next.min.js\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine/1.2.3/dist/js/engine-core.js\"></script>\n <script crossorigin=\"anonymous\" src=\"https://uipaas-assets.com/prod/npm/@alilc/lowcode-engine-ext/1.0.6/dist/js/engine-ext.js\"></script>\n </head>\n\n <body>\n <div id=\"lce-container\"></div>\n <script type=\"text/javascript\" src=\"https://g.alicdn.com/fone-lowcode/fr-generator/1.1.0/js/index.js\"></script>\n </body>\n </html>\n ";
15
9
  return html;
16
10
  };
17
11
  var _default = exports.default = function _default() {
18
12
  var iframe = document.createElement('iframe');
19
- iframe.width = '100%';
20
- iframe.height = '100%';
21
- iframe.frameBorder = '0';
22
- iframe.srcdoc = createIframeContent();
23
-
24
- // 监听iframe加载完成
25
13
  iframe.onload = function () {
26
- console.log('1', iframe.contentWindow);
27
- var win = iframe.contentWindow;
28
- if (!win) return;
29
-
30
- // 拦截低代码引擎的createSimulator函数
31
- patchCreateSimulatorInIframe(win);
32
- console.log('2', iframe.contentWindow);
33
- return iframe;
14
+ iframe.width = '100%';
15
+ iframe.height = '100%';
16
+ iframe.frameBorder = '0';
17
+ iframe.srcdoc = createIframeContent();
34
18
  };
35
- }; // 在iframe内部修补createSimulator函数
36
- function patchCreateSimulatorInIframe(iframeWindow) {
37
- // 保存原始的createSimulator函数
38
- var originalCreateSimulator = iframeWindow.createSimulator;
39
- console.log('3', originalCreateSimulator);
40
- if (originalCreateSimulator) {
41
- iframeWindow.createSimulator = function (host, iframe, vendors) {
42
- // 处理vendors,给JS URL添加时间戳
43
- var processedVendors = addTimestampToVendors(vendors);
44
- return originalCreateSimulator.call(this, host, iframe, processedVendors);
45
- };
46
- }
47
-
48
- // 工具函数(同上)
49
- function addTimestampToVendors(vendors) {
50
- var timestamp = new Date().getTime();
51
- return vendors.map(function (vendor) {
52
- if (!vendor) return vendor;
53
- if (vendor.type === 'bundle' && Array.isArray(vendor.assets)) {
54
- return _objectSpread(_objectSpread({}, vendor), {}, {
55
- assets: vendor.assets.map(function (asset) {
56
- if (!asset) return asset;
57
-
58
- // 处理字符串URL
59
- if (typeof asset === 'string') {
60
- return addTimestampToUrl(asset, timestamp);
61
- }
62
-
63
- // 处理数组(可能是URL数组)
64
- if (Array.isArray(asset)) {
65
- return asset.map(function (item) {
66
- if (typeof item === 'string') {
67
- return addTimestampToUrl(item, timestamp);
68
- }
69
- // 处理数组中的数组(嵌套情况)
70
- if (Array.isArray(item)) {
71
- return item.map(function (subItem) {
72
- if (typeof subItem === 'string') {
73
- return addTimestampToUrl(subItem, timestamp);
74
- }
75
- return subItem;
76
- });
77
- }
78
- return item;
79
- });
80
- }
81
-
82
- // 处理对象类型
83
- if (_typeof(asset) === 'object') {
84
- if (asset.type === 'jsText' || asset.type === 'cssText') {
85
- // 内联脚本,不需要加时间戳
86
- return asset;
87
- }
88
- if (asset.content && typeof asset.content === 'string') {
89
- return _objectSpread(_objectSpread({}, asset), {}, {
90
- content: addTimestampToUrl(asset.content, timestamp)
91
- });
92
- }
93
- }
94
- return asset;
95
- })
96
- });
97
- }
98
- return vendor;
99
- });
100
- }
101
- function addTimestampToUrl(url, timestamp) {
102
- if (!url || typeof url !== 'string') return url;
103
-
104
- // 跳过已经有时间戳的URL
105
- if (url.includes('t=')) return url;
106
- var separator = url.includes('?') ? '&' : '?';
107
- return "".concat(url).concat(separator, "t=").concat(timestamp);
108
- }
109
- }
19
+ return iframe;
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zzdadelu/schema-builder",
3
- "version": "1.0.0-alpha.76",
3
+ "version": "1.0.0-alpha.78",
4
4
  "description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
5
5
  "keywords": [
6
6
  "Form",