@zzdadelu/schema-builder 1.0.0-alpha.13 → 1.0.0-alpha.130
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/createIframe.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4208 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/dist/main.d.ts +4 -0
- package/dist/settings/index.d.ts +21 -0
- package/dist/settings/meta/card.d.ts +2 -0
- package/dist/settings/meta/cardList.d.ts +2 -0
- package/dist/settings/meta/checkbox.d.ts +2 -0
- package/dist/settings/meta/checkboxes.d.ts +2 -0
- package/dist/settings/meta/color.d.ts +2 -0
- package/dist/settings/meta/date.d.ts +2 -0
- package/dist/settings/meta/dateRange.d.ts +2 -0
- package/dist/settings/meta/form.d.ts +2 -0
- package/dist/settings/meta/imageInput.d.ts +2 -0
- package/dist/settings/meta/input.d.ts +2 -0
- package/dist/settings/meta/number.d.ts +2 -0
- package/dist/settings/meta/radio.d.ts +2 -0
- package/dist/settings/meta/rate.d.ts +2 -0
- package/dist/settings/meta/select.d.ts +2 -0
- package/dist/settings/meta/slider.d.ts +2 -0
- package/dist/settings/meta/switch.d.ts +2 -0
- package/dist/settings/meta/textarea.d.ts +2 -0
- package/dist/settings/meta/time.d.ts +2 -0
- package/dist/settings/meta/timeRange.d.ts +2 -0
- package/dist/settings/meta/treeSelect.d.ts +2 -0
- package/dist/settings/meta/urlInput.d.ts +2 -0
- package/dist/settings/utils.d.ts +110 -0
- package/dist/type.d.ts +33 -0
- package/es/createIframe.js +1 -1
- package/es/main.js +21 -12
- package/lib/createIframe.js +1 -1
- package/lib/main.js +21 -12
- package/package.json +3 -1
- package/CHANGELOG.md +0 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export declare const inputPropsBasic: ({
|
|
2
|
+
name: string;
|
|
3
|
+
title: {
|
|
4
|
+
label: string;
|
|
5
|
+
tip: string;
|
|
6
|
+
};
|
|
7
|
+
setter: string;
|
|
8
|
+
condition?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
name: string;
|
|
11
|
+
title: {
|
|
12
|
+
label: string;
|
|
13
|
+
tip: string;
|
|
14
|
+
};
|
|
15
|
+
setter: string;
|
|
16
|
+
condition: (target: any) => boolean;
|
|
17
|
+
})[];
|
|
18
|
+
export declare const notInputPropsBasic: ({
|
|
19
|
+
name: string;
|
|
20
|
+
title: {
|
|
21
|
+
label: string;
|
|
22
|
+
tip: string;
|
|
23
|
+
};
|
|
24
|
+
setter: string;
|
|
25
|
+
condition?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
name: string;
|
|
28
|
+
title: {
|
|
29
|
+
label: string;
|
|
30
|
+
tip: string;
|
|
31
|
+
};
|
|
32
|
+
setter: string;
|
|
33
|
+
condition: (target: any) => boolean;
|
|
34
|
+
})[];
|
|
35
|
+
export declare const optionsProp: {
|
|
36
|
+
display: string;
|
|
37
|
+
name: string;
|
|
38
|
+
title: {
|
|
39
|
+
label: string;
|
|
40
|
+
tip: string;
|
|
41
|
+
};
|
|
42
|
+
setter: {
|
|
43
|
+
componentName: string;
|
|
44
|
+
props: {
|
|
45
|
+
itemSetter: {
|
|
46
|
+
componentName: string;
|
|
47
|
+
initialValue: () => {
|
|
48
|
+
label: string;
|
|
49
|
+
value: string;
|
|
50
|
+
};
|
|
51
|
+
props: {
|
|
52
|
+
config: {
|
|
53
|
+
items: ({
|
|
54
|
+
name: string;
|
|
55
|
+
title: string;
|
|
56
|
+
important: boolean;
|
|
57
|
+
setter: string;
|
|
58
|
+
} | {
|
|
59
|
+
name: string;
|
|
60
|
+
title: string;
|
|
61
|
+
setter: string[];
|
|
62
|
+
important: boolean;
|
|
63
|
+
} | {
|
|
64
|
+
name: string;
|
|
65
|
+
title: string;
|
|
66
|
+
setter: string;
|
|
67
|
+
important?: undefined;
|
|
68
|
+
})[];
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export declare const getInputPropsBasic: (defaultValueProp: any, placeholder?: any) => ({
|
|
76
|
+
name: string;
|
|
77
|
+
title: {
|
|
78
|
+
label: string;
|
|
79
|
+
tip: string;
|
|
80
|
+
};
|
|
81
|
+
setter: string;
|
|
82
|
+
condition?: undefined;
|
|
83
|
+
} | {
|
|
84
|
+
name: string;
|
|
85
|
+
title: {
|
|
86
|
+
label: string;
|
|
87
|
+
tip: string;
|
|
88
|
+
};
|
|
89
|
+
setter: string;
|
|
90
|
+
condition: (target: any) => boolean;
|
|
91
|
+
})[];
|
|
92
|
+
export declare const getNotInputPropsBasic: (defaultValueProp: any) => ({
|
|
93
|
+
name: string;
|
|
94
|
+
title: {
|
|
95
|
+
label: string;
|
|
96
|
+
tip: string;
|
|
97
|
+
};
|
|
98
|
+
setter: string;
|
|
99
|
+
condition?: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
name: string;
|
|
102
|
+
title: {
|
|
103
|
+
label: string;
|
|
104
|
+
tip: string;
|
|
105
|
+
};
|
|
106
|
+
setter: string;
|
|
107
|
+
condition: (target: any) => boolean;
|
|
108
|
+
})[];
|
|
109
|
+
export declare const uuid: () => string;
|
|
110
|
+
export declare const createMeta: (componentName: string, params: any) => any;
|
package/dist/type.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
interface TProperties {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}
|
|
4
|
+
interface TLogo {
|
|
5
|
+
title?: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
}
|
|
9
|
+
interface TSchema {
|
|
10
|
+
"type": "object";
|
|
11
|
+
"properties": TProperties;
|
|
12
|
+
}
|
|
13
|
+
interface TToolBtn {
|
|
14
|
+
text: string;
|
|
15
|
+
order: number;
|
|
16
|
+
onClick: (schema: TSchema) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface TSchemaBuilder {
|
|
19
|
+
logo?: TLogo;
|
|
20
|
+
importBtn?: boolean;
|
|
21
|
+
exportBtn?: boolean;
|
|
22
|
+
clearBtn?: boolean | TToolBtn;
|
|
23
|
+
saveBtn?: boolean | TToolBtn;
|
|
24
|
+
pubBtn?: boolean | TToolBtn;
|
|
25
|
+
extraBtns?: TToolBtn[];
|
|
26
|
+
defaultValue?: TSchema;
|
|
27
|
+
widgets?: any;
|
|
28
|
+
settings?: any;
|
|
29
|
+
editorWidgets?: any;
|
|
30
|
+
onMount?: () => void;
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
package/es/createIframe.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var createIframeContent = function createIframeContent() {
|
|
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
|
|
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 ";
|
|
3
3
|
return html;
|
|
4
4
|
};
|
|
5
5
|
export default (function () {
|
package/es/main.js
CHANGED
|
@@ -10,23 +10,27 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
|
|
11
11
|
import createIframe from './createIframe';
|
|
12
12
|
import * as defaultSetting from './settings';
|
|
13
|
-
|
|
13
|
+
if (typeof window !== 'undefined') {
|
|
14
|
+
console.log('设置全局方法 getFormRenderMaterial', window);
|
|
15
|
+
window.getFormRenderMaterial = function () {
|
|
16
|
+
return defaultSetting;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
14
19
|
var Design = function Design(props, ref) {
|
|
15
20
|
var widgets = props.widgets,
|
|
16
21
|
settings = props.settings,
|
|
17
22
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
18
23
|
var containerRef = useRef();
|
|
24
|
+
var iframeRef = useRef(null);
|
|
19
25
|
useImperativeHandle(ref, function () {
|
|
20
26
|
return {
|
|
21
27
|
getValue: function getValue() {
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
console.log("__FR_ENGINE__", (_iframe2 = iframe) === null || _iframe2 === void 0 ? void 0 : (_iframe2$contentWindo = _iframe2.contentWindow) === null || _iframe2$contentWindo === void 0 ? void 0 : _iframe2$contentWindo.__FR_ENGINE__);
|
|
25
|
-
return (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : (_iframe3$contentWindo = _iframe3.contentWindow) === null || _iframe3$contentWindo === void 0 ? void 0 : (_iframe3$contentWindo2 = _iframe3$contentWindo.__FR_ENGINE__) === null || _iframe3$contentWindo2 === void 0 ? void 0 : (_iframe3$contentWindo3 = _iframe3$contentWindo2.exportSchema) === null || _iframe3$contentWindo3 === void 0 ? void 0 : _iframe3$contentWindo3.call(_iframe3$contentWindo2);
|
|
28
|
+
var _iframeRef$current, _iframeRef$current$co, _iframeRef$current$co2, _iframeRef$current$co3;
|
|
29
|
+
return (_iframeRef$current = iframeRef.current) === null || _iframeRef$current === void 0 ? void 0 : (_iframeRef$current$co = _iframeRef$current.contentWindow) === null || _iframeRef$current$co === void 0 ? void 0 : (_iframeRef$current$co2 = _iframeRef$current$co.__FR_ENGINE__) === null || _iframeRef$current$co2 === void 0 ? void 0 : (_iframeRef$current$co3 = _iframeRef$current$co2.exportSchema) === null || _iframeRef$current$co3 === void 0 ? void 0 : _iframeRef$current$co3.call(_iframeRef$current$co2);
|
|
26
30
|
},
|
|
27
31
|
setValue: function setValue(schema) {
|
|
28
|
-
var
|
|
29
|
-
return (
|
|
32
|
+
var _iframeRef$current2, _iframeRef$current2$c, _iframeRef$current2$c2, _iframeRef$current2$c3;
|
|
33
|
+
return (_iframeRef$current2 = iframeRef.current) === null || _iframeRef$current2 === void 0 ? void 0 : (_iframeRef$current2$c = _iframeRef$current2.contentWindow) === null || _iframeRef$current2$c === void 0 ? void 0 : (_iframeRef$current2$c2 = _iframeRef$current2$c.__FR_ENGINE__) === null || _iframeRef$current2$c2 === void 0 ? void 0 : (_iframeRef$current2$c3 = _iframeRef$current2$c2.importSchema) === null || _iframeRef$current2$c3 === void 0 ? void 0 : _iframeRef$current2$c3.call(_iframeRef$current2$c2, schema);
|
|
30
34
|
}
|
|
31
35
|
};
|
|
32
36
|
});
|
|
@@ -38,17 +42,22 @@ var Design = function Design(props, ref) {
|
|
|
38
42
|
};
|
|
39
43
|
}, []);
|
|
40
44
|
var initIframe = function initIframe() {
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
var iframe = createIframe();
|
|
46
|
+
iframeRef.current = iframe;
|
|
43
47
|
containerRef.current.appendChild(iframe);
|
|
48
|
+
// 关键修复:将 material 加载函数注入到设计器 iframe 的 window 中
|
|
49
|
+
if (iframe.contentWindow) {
|
|
50
|
+
iframe.contentWindow.getFormRenderMaterial = function () {
|
|
51
|
+
return defaultSetting;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
44
54
|
};
|
|
45
55
|
var engineOnLoad = function engineOnLoad(event) {
|
|
46
|
-
var
|
|
56
|
+
var _iframeRef$current3, _iframeRef$current3$c, _iframeRef$current3$c2;
|
|
47
57
|
if (event.data.type !== 'engine-load') {
|
|
48
58
|
return;
|
|
49
59
|
}
|
|
50
|
-
|
|
51
|
-
(_iframe5 = iframe) === null || _iframe5 === void 0 ? void 0 : (_iframe5$contentWindo = _iframe5.contentWindow) === null || _iframe5$contentWindo === void 0 ? void 0 : (_iframe5$contentWindo2 = _iframe5$contentWindo.__FR_ENGINE__) === null || _iframe5$contentWindo2 === void 0 ? void 0 : _iframe5$contentWindo2.init(_objectSpread({
|
|
60
|
+
(_iframeRef$current3 = iframeRef.current) === null || _iframeRef$current3 === void 0 ? void 0 : (_iframeRef$current3$c = _iframeRef$current3.contentWindow) === null || _iframeRef$current3$c === void 0 ? void 0 : (_iframeRef$current3$c2 = _iframeRef$current3$c.__FR_ENGINE__) === null || _iframeRef$current3$c2 === void 0 ? void 0 : _iframeRef$current3$c2.init(_objectSpread({
|
|
52
61
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
53
62
|
widgets: widgets,
|
|
54
63
|
// recordEnable: true,
|
package/lib/createIframe.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var createIframeContent = function createIframeContent() {
|
|
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
|
|
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 ";
|
|
9
9
|
return html;
|
|
10
10
|
};
|
|
11
11
|
var _default = exports.default = function _default() {
|
package/lib/main.js
CHANGED
|
@@ -18,23 +18,27 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
18
18
|
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); }
|
|
19
19
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
20
20
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
21
|
-
|
|
21
|
+
if (typeof window !== 'undefined') {
|
|
22
|
+
console.log('设置全局方法 getFormRenderMaterial', window);
|
|
23
|
+
window.getFormRenderMaterial = function () {
|
|
24
|
+
return defaultSetting;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
22
27
|
var Design = function Design(props, ref) {
|
|
23
28
|
var widgets = props.widgets,
|
|
24
29
|
settings = props.settings,
|
|
25
30
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
26
31
|
var containerRef = (0, _react.useRef)();
|
|
32
|
+
var iframeRef = (0, _react.useRef)(null);
|
|
27
33
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
28
34
|
return {
|
|
29
35
|
getValue: function getValue() {
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
console.log("__FR_ENGINE__", (_iframe2 = iframe) === null || _iframe2 === void 0 ? void 0 : (_iframe2$contentWindo = _iframe2.contentWindow) === null || _iframe2$contentWindo === void 0 ? void 0 : _iframe2$contentWindo.__FR_ENGINE__);
|
|
33
|
-
return (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : (_iframe3$contentWindo = _iframe3.contentWindow) === null || _iframe3$contentWindo === void 0 ? void 0 : (_iframe3$contentWindo2 = _iframe3$contentWindo.__FR_ENGINE__) === null || _iframe3$contentWindo2 === void 0 ? void 0 : (_iframe3$contentWindo3 = _iframe3$contentWindo2.exportSchema) === null || _iframe3$contentWindo3 === void 0 ? void 0 : _iframe3$contentWindo3.call(_iframe3$contentWindo2);
|
|
36
|
+
var _iframeRef$current, _iframeRef$current$co, _iframeRef$current$co2, _iframeRef$current$co3;
|
|
37
|
+
return (_iframeRef$current = iframeRef.current) === null || _iframeRef$current === void 0 ? void 0 : (_iframeRef$current$co = _iframeRef$current.contentWindow) === null || _iframeRef$current$co === void 0 ? void 0 : (_iframeRef$current$co2 = _iframeRef$current$co.__FR_ENGINE__) === null || _iframeRef$current$co2 === void 0 ? void 0 : (_iframeRef$current$co3 = _iframeRef$current$co2.exportSchema) === null || _iframeRef$current$co3 === void 0 ? void 0 : _iframeRef$current$co3.call(_iframeRef$current$co2);
|
|
34
38
|
},
|
|
35
39
|
setValue: function setValue(schema) {
|
|
36
|
-
var
|
|
37
|
-
return (
|
|
40
|
+
var _iframeRef$current2, _iframeRef$current2$c, _iframeRef$current2$c2, _iframeRef$current2$c3;
|
|
41
|
+
return (_iframeRef$current2 = iframeRef.current) === null || _iframeRef$current2 === void 0 ? void 0 : (_iframeRef$current2$c = _iframeRef$current2.contentWindow) === null || _iframeRef$current2$c === void 0 ? void 0 : (_iframeRef$current2$c2 = _iframeRef$current2$c.__FR_ENGINE__) === null || _iframeRef$current2$c2 === void 0 ? void 0 : (_iframeRef$current2$c3 = _iframeRef$current2$c2.importSchema) === null || _iframeRef$current2$c3 === void 0 ? void 0 : _iframeRef$current2$c3.call(_iframeRef$current2$c2, schema);
|
|
38
42
|
}
|
|
39
43
|
};
|
|
40
44
|
});
|
|
@@ -46,17 +50,22 @@ var Design = function Design(props, ref) {
|
|
|
46
50
|
};
|
|
47
51
|
}, []);
|
|
48
52
|
var initIframe = function initIframe() {
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
var iframe = (0, _createIframe.default)();
|
|
54
|
+
iframeRef.current = iframe;
|
|
51
55
|
containerRef.current.appendChild(iframe);
|
|
56
|
+
// 关键修复:将 material 加载函数注入到设计器 iframe 的 window 中
|
|
57
|
+
if (iframe.contentWindow) {
|
|
58
|
+
iframe.contentWindow.getFormRenderMaterial = function () {
|
|
59
|
+
return defaultSetting;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
52
62
|
};
|
|
53
63
|
var engineOnLoad = function engineOnLoad(event) {
|
|
54
|
-
var
|
|
64
|
+
var _iframeRef$current3, _iframeRef$current3$c, _iframeRef$current3$c2;
|
|
55
65
|
if (event.data.type !== 'engine-load') {
|
|
56
66
|
return;
|
|
57
67
|
}
|
|
58
|
-
|
|
59
|
-
(_iframe5 = iframe) === null || _iframe5 === void 0 ? void 0 : (_iframe5$contentWindo = _iframe5.contentWindow) === null || _iframe5$contentWindo === void 0 ? void 0 : (_iframe5$contentWindo2 = _iframe5$contentWindo.__FR_ENGINE__) === null || _iframe5$contentWindo2 === void 0 ? void 0 : _iframe5$contentWindo2.init(_objectSpread({
|
|
68
|
+
(_iframeRef$current3 = iframeRef.current) === null || _iframeRef$current3 === void 0 ? void 0 : (_iframeRef$current3$c = _iframeRef$current3.contentWindow) === null || _iframeRef$current3$c === void 0 ? void 0 : (_iframeRef$current3$c2 = _iframeRef$current3$c.__FR_ENGINE__) === null || _iframeRef$current3$c2 === void 0 ? void 0 : _iframeRef$current3$c2.init(_objectSpread({
|
|
60
69
|
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
61
70
|
widgets: widgets,
|
|
62
71
|
// recordEnable: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zzdadelu/schema-builder",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.130",
|
|
4
4
|
"description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Form",
|
|
@@ -22,9 +22,11 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"main": "lib/index.js",
|
|
24
24
|
"module": "es/index.js",
|
|
25
|
+
"unpkg": "dist/index.min.js",
|
|
25
26
|
"files": [
|
|
26
27
|
"es",
|
|
27
28
|
"lib",
|
|
29
|
+
"dist",
|
|
28
30
|
"package.json"
|
|
29
31
|
],
|
|
30
32
|
"scripts": {
|
package/CHANGELOG.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Change Log
|