@zzdadelu/schema-builder 1.0.0-alpha.131 → 1.0.0-alpha.133
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/es/createIframe.d.ts +2 -0
- package/es/createIframe.js +0 -7
- package/es/index.d.ts +2 -0
- package/es/main.d.ts +4 -0
- package/es/main.js +77 -14
- package/es/settings/index.d.ts +21 -0
- package/es/settings/index.js +0 -2
- package/es/settings/meta/card.d.ts +2 -0
- package/es/settings/meta/cardList.d.ts +2 -0
- package/es/settings/meta/checkbox.d.ts +2 -0
- package/es/settings/meta/checkboxes.d.ts +2 -0
- package/es/settings/meta/color.d.ts +2 -0
- package/es/settings/meta/date.d.ts +2 -0
- package/es/settings/meta/dateRange.d.ts +2 -0
- package/es/settings/meta/form.d.ts +2 -0
- package/es/settings/meta/imageInput.d.ts +2 -0
- package/es/settings/meta/input.d.ts +2 -0
- package/es/settings/meta/number.d.ts +2 -0
- package/es/settings/meta/radio.d.ts +2 -0
- package/es/settings/meta/rate.d.ts +2 -0
- package/es/settings/meta/select.d.ts +2 -0
- package/es/settings/meta/slider.d.ts +2 -0
- package/es/settings/meta/switch.d.ts +2 -0
- package/es/settings/meta/textarea.d.ts +2 -0
- package/es/settings/meta/time.d.ts +2 -0
- package/es/settings/meta/timeRange.d.ts +2 -0
- package/es/settings/meta/treeSelect.d.ts +2 -0
- package/es/settings/meta/urlInput.d.ts +2 -0
- package/es/settings/utils.d.ts +110 -0
- package/es/type.d.ts +33 -0
- package/es/types.d.ts +1 -0
- package/lib/createIframe.d.ts +2 -0
- package/lib/createIframe.js +0 -9
- package/lib/index.d.ts +2 -0
- package/lib/main.d.ts +4 -0
- package/lib/main.js +78 -15
- package/lib/settings/index.d.ts +21 -0
- package/lib/settings/meta/card.d.ts +2 -0
- package/lib/settings/meta/cardList.d.ts +2 -0
- package/lib/settings/meta/checkbox.d.ts +2 -0
- package/lib/settings/meta/checkboxes.d.ts +2 -0
- package/lib/settings/meta/color.d.ts +2 -0
- package/lib/settings/meta/date.d.ts +2 -0
- package/lib/settings/meta/dateRange.d.ts +2 -0
- package/lib/settings/meta/form.d.ts +2 -0
- package/lib/settings/meta/imageInput.d.ts +2 -0
- package/lib/settings/meta/input.d.ts +2 -0
- package/lib/settings/meta/number.d.ts +2 -0
- package/lib/settings/meta/radio.d.ts +2 -0
- package/lib/settings/meta/rate.d.ts +2 -0
- package/lib/settings/meta/select.d.ts +2 -0
- package/lib/settings/meta/slider.d.ts +2 -0
- package/lib/settings/meta/switch.d.ts +2 -0
- package/lib/settings/meta/textarea.d.ts +2 -0
- package/lib/settings/meta/time.d.ts +2 -0
- package/lib/settings/meta/timeRange.d.ts +2 -0
- package/lib/settings/meta/treeSelect.d.ts +2 -0
- package/lib/settings/meta/urlInput.d.ts +2 -0
- package/lib/settings/utils.d.ts +110 -0
- package/lib/type.d.ts +33 -0
- package/lib/type.js +5 -1
- package/lib/types.d.ts +1 -0
- package/package.json +8 -10
package/es/createIframe.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as defaultSetting from './settings';
|
|
2
1
|
var createIframeContent = function createIframeContent() {
|
|
3
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 ";
|
|
4
3
|
return html;
|
|
@@ -9,11 +8,5 @@ export default (function () {
|
|
|
9
8
|
iframe.height = '100%';
|
|
10
9
|
iframe.frameBorder = '0';
|
|
11
10
|
iframe.srcdoc = createIframeContent();
|
|
12
|
-
// 关键修复:将 material 加载函数注入到设计器 iframe 的 window 中
|
|
13
|
-
if (iframe.contentWindow) {
|
|
14
|
-
iframe.contentWindow.getFormRenderMaterial = function () {
|
|
15
|
-
return defaultSetting;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
11
|
return iframe;
|
|
19
12
|
});
|
package/es/index.d.ts
ADDED
package/es/main.d.ts
ADDED
package/es/main.js
CHANGED
|
@@ -1,21 +1,46 @@
|
|
|
1
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
2
|
var _excluded = ["widgets", "settings"];
|
|
3
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
4
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
3
5
|
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; }
|
|
4
6
|
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; }
|
|
5
7
|
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; }
|
|
6
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
9
|
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); }
|
|
10
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
11
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
8
12
|
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; }
|
|
9
13
|
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; }
|
|
10
14
|
import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
|
|
11
15
|
import createIframe from './createIframe';
|
|
12
16
|
import * as defaultSetting from './settings';
|
|
17
|
+
var MATERIAL_WAIT_TIMEOUT = 10000;
|
|
18
|
+
var MATERIAL_WAIT_INTERVAL = 50;
|
|
13
19
|
var iframe;
|
|
20
|
+
var waitForFormRenderMaterial = function waitForFormRenderMaterial(iframeWindow) {
|
|
21
|
+
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MATERIAL_WAIT_TIMEOUT;
|
|
22
|
+
return new Promise(function (resolve, reject) {
|
|
23
|
+
var startTime = Date.now();
|
|
24
|
+
var _checkMaterialReady = function checkMaterialReady() {
|
|
25
|
+
if (typeof (iframeWindow === null || iframeWindow === void 0 ? void 0 : iframeWindow.getFormRenderMaterial) === 'function') {
|
|
26
|
+
resolve();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (Date.now() - startTime >= timeout) {
|
|
30
|
+
reject(new Error('window.getFormRenderMaterial is not ready'));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
window.setTimeout(_checkMaterialReady, MATERIAL_WAIT_INTERVAL);
|
|
34
|
+
};
|
|
35
|
+
_checkMaterialReady();
|
|
36
|
+
});
|
|
37
|
+
};
|
|
14
38
|
var Design = function Design(props, ref) {
|
|
15
39
|
var widgets = props.widgets,
|
|
16
40
|
settings = props.settings,
|
|
17
41
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
18
42
|
var containerRef = useRef();
|
|
43
|
+
var hasInitializedRef = useRef(false);
|
|
19
44
|
useImperativeHandle(ref, function () {
|
|
20
45
|
return {
|
|
21
46
|
getValue: function getValue() {
|
|
@@ -33,26 +58,64 @@ var Design = function Design(props, ref) {
|
|
|
33
58
|
window.addEventListener('message', engineOnLoad);
|
|
34
59
|
return function () {
|
|
35
60
|
window.removeEventListener('message', engineOnLoad);
|
|
61
|
+
hasInitializedRef.current = false;
|
|
36
62
|
};
|
|
37
63
|
}, []);
|
|
38
64
|
var initIframe = function initIframe() {
|
|
39
65
|
iframe = createIframe();
|
|
66
|
+
hasInitializedRef.current = false;
|
|
40
67
|
containerRef.current.appendChild(iframe);
|
|
41
68
|
};
|
|
42
|
-
var engineOnLoad = function
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
69
|
+
var engineOnLoad = /*#__PURE__*/function () {
|
|
70
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
|
|
71
|
+
var _iframe3;
|
|
72
|
+
var iframeWindow, engine, _t;
|
|
73
|
+
return _regenerator().w(function (_context) {
|
|
74
|
+
while (1) switch (_context.p = _context.n) {
|
|
75
|
+
case 0:
|
|
76
|
+
if (!(event.data.type !== 'engine-load' || hasInitializedRef.current)) {
|
|
77
|
+
_context.n = 1;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
return _context.a(2);
|
|
81
|
+
case 1:
|
|
82
|
+
iframeWindow = (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : _iframe3.contentWindow;
|
|
83
|
+
engine = iframeWindow === null || iframeWindow === void 0 ? void 0 : iframeWindow.__FR_ENGINE__;
|
|
84
|
+
if (!(!iframeWindow || !engine)) {
|
|
85
|
+
_context.n = 2;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
return _context.a(2);
|
|
89
|
+
case 2:
|
|
90
|
+
_context.p = 2;
|
|
91
|
+
_context.n = 3;
|
|
92
|
+
return waitForFormRenderMaterial(iframeWindow);
|
|
93
|
+
case 3:
|
|
94
|
+
hasInitializedRef.current = true;
|
|
95
|
+
engine.init(_objectSpread({
|
|
96
|
+
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
97
|
+
widgets: widgets,
|
|
98
|
+
// recordEnable: true,
|
|
99
|
+
logo: {
|
|
100
|
+
title: 'XRender'
|
|
101
|
+
}
|
|
102
|
+
}, restProps));
|
|
103
|
+
_context.n = 5;
|
|
104
|
+
break;
|
|
105
|
+
case 4:
|
|
106
|
+
_context.p = 4;
|
|
107
|
+
_t = _context.v;
|
|
108
|
+
hasInitializedRef.current = false;
|
|
109
|
+
console.error('[schema-builder] wait for FormRender material failed', _t);
|
|
110
|
+
case 5:
|
|
111
|
+
return _context.a(2);
|
|
112
|
+
}
|
|
113
|
+
}, _callee, null, [[2, 4]]);
|
|
114
|
+
}));
|
|
115
|
+
return function engineOnLoad(_x) {
|
|
116
|
+
return _ref.apply(this, arguments);
|
|
117
|
+
};
|
|
118
|
+
}();
|
|
56
119
|
return /*#__PURE__*/React.createElement("div", {
|
|
57
120
|
ref: containerRef,
|
|
58
121
|
style: {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { default as Input } from './meta/input';
|
|
2
|
+
export { default as Number } from './meta/number';
|
|
3
|
+
export { default as Select } from './meta/select';
|
|
4
|
+
export { default as Radio } from './meta/radio';
|
|
5
|
+
export { default as Checkbox } from './meta/checkbox';
|
|
6
|
+
export { default as Checkboxes } from './meta/checkboxes';
|
|
7
|
+
export { default as Textarea } from './meta/textarea';
|
|
8
|
+
export { default as DatePicker } from './meta/date';
|
|
9
|
+
export { default as DateRange } from './meta/dateRange';
|
|
10
|
+
export { default as TimePicker } from './meta/time';
|
|
11
|
+
export { default as TimeRange } from './meta/timeRange';
|
|
12
|
+
export { default as Rate } from './meta/rate';
|
|
13
|
+
export { default as Switch } from './meta/switch';
|
|
14
|
+
export { default as Slider } from './meta/slider';
|
|
15
|
+
export { default as Color } from './meta/color';
|
|
16
|
+
export { default as ImageInput } from './meta/imageInput';
|
|
17
|
+
export { default as UrlInput } from './meta/urlInput';
|
|
18
|
+
export { default as TreeSelect } from './meta/treeSelect';
|
|
19
|
+
export { default as Form } from './meta/form';
|
|
20
|
+
export { default as card } from './meta/card';
|
|
21
|
+
export { default as CardList } from './meta/cardList';
|
package/es/settings/index.js
CHANGED
|
@@ -13,13 +13,11 @@ export { default as TimeRange } from './meta/timeRange';
|
|
|
13
13
|
export { default as Rate } from './meta/rate';
|
|
14
14
|
export { default as Switch } from './meta/switch';
|
|
15
15
|
export { default as Slider } from './meta/slider';
|
|
16
|
-
|
|
17
16
|
// 其他组件配置
|
|
18
17
|
export { default as Color } from './meta/color';
|
|
19
18
|
export { default as ImageInput } from './meta/imageInput';
|
|
20
19
|
export { default as UrlInput } from './meta/urlInput';
|
|
21
20
|
export { default as TreeSelect } from './meta/treeSelect';
|
|
22
|
-
|
|
23
21
|
// 容器组件配置
|
|
24
22
|
export { default as Form } from './meta/form';
|
|
25
23
|
export { default as card } from './meta/card';
|
|
@@ -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/es/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/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'lodash/cloneDeep';
|
package/lib/createIframe.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
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); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var defaultSetting = _interopRequireWildcard(require("./settings"));
|
|
9
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
10
7
|
var createIframeContent = function createIframeContent() {
|
|
11
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 ";
|
|
12
9
|
return html;
|
|
@@ -17,11 +14,5 @@ var _default = exports.default = function _default() {
|
|
|
17
14
|
iframe.height = '100%';
|
|
18
15
|
iframe.frameBorder = '0';
|
|
19
16
|
iframe.srcdoc = createIframeContent();
|
|
20
|
-
// 关键修复:将 material 加载函数注入到设计器 iframe 的 window 中
|
|
21
|
-
if (iframe.contentWindow) {
|
|
22
|
-
iframe.contentWindow.getFormRenderMaterial = function () {
|
|
23
|
-
return defaultSetting;
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
17
|
return iframe;
|
|
27
18
|
};
|
package/lib/index.d.ts
ADDED
package/lib/main.d.ts
ADDED
package/lib/main.js
CHANGED
|
@@ -10,20 +10,45 @@ var _createIframe = _interopRequireDefault(require("./createIframe"));
|
|
|
10
10
|
var defaultSetting = _interopRequireWildcard(require("./settings"));
|
|
11
11
|
var _excluded = ["widgets", "settings"];
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
14
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
15
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
14
16
|
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; }
|
|
15
17
|
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; }
|
|
16
18
|
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; }
|
|
17
19
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
18
20
|
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); }
|
|
21
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
22
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
19
23
|
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
24
|
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; }
|
|
25
|
+
var MATERIAL_WAIT_TIMEOUT = 10000;
|
|
26
|
+
var MATERIAL_WAIT_INTERVAL = 50;
|
|
21
27
|
var iframe;
|
|
28
|
+
var waitForFormRenderMaterial = function waitForFormRenderMaterial(iframeWindow) {
|
|
29
|
+
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : MATERIAL_WAIT_TIMEOUT;
|
|
30
|
+
return new Promise(function (resolve, reject) {
|
|
31
|
+
var startTime = Date.now();
|
|
32
|
+
var _checkMaterialReady = function checkMaterialReady() {
|
|
33
|
+
if (typeof (iframeWindow === null || iframeWindow === void 0 ? void 0 : iframeWindow.getFormRenderMaterial) === 'function') {
|
|
34
|
+
resolve();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (Date.now() - startTime >= timeout) {
|
|
38
|
+
reject(new Error('window.getFormRenderMaterial is not ready'));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
window.setTimeout(_checkMaterialReady, MATERIAL_WAIT_INTERVAL);
|
|
42
|
+
};
|
|
43
|
+
_checkMaterialReady();
|
|
44
|
+
});
|
|
45
|
+
};
|
|
22
46
|
var Design = function Design(props, ref) {
|
|
23
47
|
var widgets = props.widgets,
|
|
24
48
|
settings = props.settings,
|
|
25
49
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
26
50
|
var containerRef = (0, _react.useRef)();
|
|
51
|
+
var hasInitializedRef = (0, _react.useRef)(false);
|
|
27
52
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
28
53
|
return {
|
|
29
54
|
getValue: function getValue() {
|
|
@@ -41,26 +66,64 @@ var Design = function Design(props, ref) {
|
|
|
41
66
|
window.addEventListener('message', engineOnLoad);
|
|
42
67
|
return function () {
|
|
43
68
|
window.removeEventListener('message', engineOnLoad);
|
|
69
|
+
hasInitializedRef.current = false;
|
|
44
70
|
};
|
|
45
71
|
}, []);
|
|
46
72
|
var initIframe = function initIframe() {
|
|
47
73
|
iframe = (0, _createIframe.default)();
|
|
74
|
+
hasInitializedRef.current = false;
|
|
48
75
|
containerRef.current.appendChild(iframe);
|
|
49
76
|
};
|
|
50
|
-
var engineOnLoad = function
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
var engineOnLoad = /*#__PURE__*/function () {
|
|
78
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(event) {
|
|
79
|
+
var _iframe3;
|
|
80
|
+
var iframeWindow, engine, _t;
|
|
81
|
+
return _regenerator().w(function (_context) {
|
|
82
|
+
while (1) switch (_context.p = _context.n) {
|
|
83
|
+
case 0:
|
|
84
|
+
if (!(event.data.type !== 'engine-load' || hasInitializedRef.current)) {
|
|
85
|
+
_context.n = 1;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
return _context.a(2);
|
|
89
|
+
case 1:
|
|
90
|
+
iframeWindow = (_iframe3 = iframe) === null || _iframe3 === void 0 ? void 0 : _iframe3.contentWindow;
|
|
91
|
+
engine = iframeWindow === null || iframeWindow === void 0 ? void 0 : iframeWindow.__FR_ENGINE__;
|
|
92
|
+
if (!(!iframeWindow || !engine)) {
|
|
93
|
+
_context.n = 2;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
return _context.a(2);
|
|
97
|
+
case 2:
|
|
98
|
+
_context.p = 2;
|
|
99
|
+
_context.n = 3;
|
|
100
|
+
return waitForFormRenderMaterial(iframeWindow);
|
|
101
|
+
case 3:
|
|
102
|
+
hasInitializedRef.current = true;
|
|
103
|
+
engine.init(_objectSpread({
|
|
104
|
+
settings: _objectSpread(_objectSpread({}, defaultSetting), settings),
|
|
105
|
+
widgets: widgets,
|
|
106
|
+
// recordEnable: true,
|
|
107
|
+
logo: {
|
|
108
|
+
title: 'XRender'
|
|
109
|
+
}
|
|
110
|
+
}, restProps));
|
|
111
|
+
_context.n = 5;
|
|
112
|
+
break;
|
|
113
|
+
case 4:
|
|
114
|
+
_context.p = 4;
|
|
115
|
+
_t = _context.v;
|
|
116
|
+
hasInitializedRef.current = false;
|
|
117
|
+
console.error('[schema-builder] wait for FormRender material failed', _t);
|
|
118
|
+
case 5:
|
|
119
|
+
return _context.a(2);
|
|
120
|
+
}
|
|
121
|
+
}, _callee, null, [[2, 4]]);
|
|
122
|
+
}));
|
|
123
|
+
return function engineOnLoad(_x) {
|
|
124
|
+
return _ref.apply(this, arguments);
|
|
125
|
+
};
|
|
126
|
+
}();
|
|
64
127
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
65
128
|
ref: containerRef,
|
|
66
129
|
style: {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { default as Input } from './meta/input';
|
|
2
|
+
export { default as Number } from './meta/number';
|
|
3
|
+
export { default as Select } from './meta/select';
|
|
4
|
+
export { default as Radio } from './meta/radio';
|
|
5
|
+
export { default as Checkbox } from './meta/checkbox';
|
|
6
|
+
export { default as Checkboxes } from './meta/checkboxes';
|
|
7
|
+
export { default as Textarea } from './meta/textarea';
|
|
8
|
+
export { default as DatePicker } from './meta/date';
|
|
9
|
+
export { default as DateRange } from './meta/dateRange';
|
|
10
|
+
export { default as TimePicker } from './meta/time';
|
|
11
|
+
export { default as TimeRange } from './meta/timeRange';
|
|
12
|
+
export { default as Rate } from './meta/rate';
|
|
13
|
+
export { default as Switch } from './meta/switch';
|
|
14
|
+
export { default as Slider } from './meta/slider';
|
|
15
|
+
export { default as Color } from './meta/color';
|
|
16
|
+
export { default as ImageInput } from './meta/imageInput';
|
|
17
|
+
export { default as UrlInput } from './meta/urlInput';
|
|
18
|
+
export { default as TreeSelect } from './meta/treeSelect';
|
|
19
|
+
export { default as Form } from './meta/form';
|
|
20
|
+
export { default as card } from './meta/card';
|
|
21
|
+
export { default as CardList } from './meta/cardList';
|
|
@@ -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/lib/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/lib/type.js
CHANGED
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module 'lodash/cloneDeep';
|
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.133",
|
|
4
4
|
"description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Form",
|
|
@@ -22,11 +22,9 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"main": "lib/index.js",
|
|
24
24
|
"module": "es/index.js",
|
|
25
|
-
"unpkg": "dist/index.min.js",
|
|
26
25
|
"files": [
|
|
27
26
|
"es",
|
|
28
27
|
"lib",
|
|
29
|
-
"dist",
|
|
30
28
|
"package.json"
|
|
31
29
|
],
|
|
32
30
|
"scripts": {
|
|
@@ -59,14 +57,18 @@
|
|
|
59
57
|
"react-sortable-hoc": "^2.0.0"
|
|
60
58
|
},
|
|
61
59
|
"devDependencies": {
|
|
60
|
+
"father-build": "^1.17.2",
|
|
61
|
+
"less": "^3.0.0",
|
|
62
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
63
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
|
64
|
+
"rollup-plugin-copy": "^3.4.0",
|
|
62
65
|
"@alib/build-scripts": "^0.1.18",
|
|
63
66
|
"@alilc/lowcode-engine": "^1.0.0",
|
|
64
67
|
"@alilc/lowcode-engine-ext": "^1.0.0",
|
|
65
68
|
"@alilc/lowcode-types": "^1.0.0",
|
|
66
|
-
"@rollup/plugin-babel": "^6.0.3",
|
|
67
69
|
"@types/events": "^3.0.0",
|
|
68
|
-
"@types/lodash": "^4.
|
|
69
|
-
"@types/minimatch": "^
|
|
70
|
+
"@types/lodash": "^4.14.202",
|
|
71
|
+
"@types/minimatch": "^3.0.5",
|
|
70
72
|
"@types/react": "^16.8.3",
|
|
71
73
|
"@types/react-dom": "^16.8.2",
|
|
72
74
|
"@types/streamsaver": "^2.0.0",
|
|
@@ -74,11 +76,7 @@
|
|
|
74
76
|
"build-plugin-fusion": "^0.1.0",
|
|
75
77
|
"build-plugin-moment-locales": "^0.1.0",
|
|
76
78
|
"build-plugin-react-app": "^1.1.2",
|
|
77
|
-
"father-build": "^1.17.2",
|
|
78
79
|
"fs-extra": "^10.0.1",
|
|
79
|
-
"less": "^3.0.0",
|
|
80
|
-
"rollup-plugin-commonjs": "^10.1.0",
|
|
81
|
-
"rollup-plugin-copy": "^3.4.0",
|
|
82
80
|
"tsconfig-paths-webpack-plugin": "^3.2.0"
|
|
83
81
|
},
|
|
84
82
|
"peerDependencies": {
|