@luck-design-biz/luckda 1.0.0-alpha → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/Builder/index.js +15 -3
- package/es/components/ComplexItem/index.js +65 -49
- package/es/components/LdAutoForm/index.js +4 -3
- package/es/components/LdFormList/index.js +3 -6
- package/es/components/LdGridForm/index.js +2 -1
- package/es/helper/form.js +1 -0
- package/es/helper/ldBuilder.js +8 -3
- package/es/locales/zh-CN.js +38 -4
- package/es/lowcode/constants/event-topics.js +0 -2
- package/es/lowcode/engine/launcher.js +3 -1
- package/es/lowcode/engine/meta/box.props.json +3 -3
- package/es/lowcode/engine/meta/button.props.default.json +1 -1
- package/es/lowcode/engine/meta/button.props.json +2 -2
- package/es/lowcode/engine/meta/dialog.props.json +2 -2
- package/es/lowcode/engine/meta/fieldcomplex.props.default.json +1 -0
- package/es/lowcode/engine/meta/fieldcomplex.props.json +7 -0
- package/es/lowcode/engine/meta/fielddate.props.default.json +2 -0
- package/es/lowcode/engine/meta/fielddate.props.json +4 -2
- package/es/lowcode/engine/meta/fieldnumber.props.default.json +1 -0
- package/es/lowcode/engine/meta/fieldnumber.props.json +3 -2
- package/es/lowcode/engine/meta/fielduser.props.default.json +1 -1
- package/es/lowcode/engine/meta/fielduser.props.json +1 -1
- package/es/lowcode/engine/meta/form.props.default.json +0 -1
- package/es/lowcode/engine/meta/form.props.json +4 -5
- package/es/lowcode/engine/meta/iframe.props.default.json +1 -1
- package/es/lowcode/engine/meta/iframe.props.json +1 -1
- package/es/lowcode/engine/meta/image.props.default.json +1 -1
- package/es/lowcode/engine/meta/image.props.json +1 -1
- package/es/lowcode/engine/meta/imex.props.default.json +2 -1
- package/es/lowcode/engine/meta/imex.props.json +26 -5
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +38 -20
- package/es/lowcode/engine/meta/jsx.props.default.json +1 -1
- package/es/lowcode/engine/meta/jsx.props.json +1 -1
- package/es/lowcode/engine/meta/layout.props.default.json +1 -1
- package/es/lowcode/engine/meta/layout.props.json +5 -5
- package/es/lowcode/engine/meta/link.props.default.json +1 -1
- package/es/lowcode/engine/meta/link.props.json +1 -1
- package/es/lowcode/engine/meta/page.props.json +6 -0
- package/es/lowcode/engine/meta/pagelayout.props.default.json +1 -1
- package/es/lowcode/engine/meta/pagelayout.props.json +1 -1
- package/es/lowcode/engine/meta/section.props.json +2 -1
- package/es/lowcode/engine/meta/split.props.default.json +1 -1
- package/es/lowcode/engine/meta/split.props.json +1 -1
- package/es/lowcode/engine/meta/table.props.json +2 -2
- package/es/lowcode/engine/meta/text.props.default.json +4 -2
- package/es/lowcode/engine/meta/text.props.json +8 -6
- package/es/lowcode/engine/provider/ContextProvider/index.js +63 -46
- package/es/lowcode/engine/provider/ContextProvider/router.js +43 -0
- package/es/lowcode/engine/{tools → provider/ContextProvider}/usePageDataStore.js +9 -7
- package/es/lowcode/engine/provider/ContextProvider/usePageVar.js +38 -15
- package/es/lowcode/engine/{tools → provider/ContextProvider}/useTodo.js +5 -7
- package/es/lowcode/engine/provider/ContextProvider/utils.js +157 -0
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +1 -2
- package/es/lowcode/engine/tools/helper.js +7 -2
- package/es/lowcode/engine/tools/initDS.js +263 -0
- package/es/lowcode/engine/tools/useCombinedRefs.js +3 -2
- package/es/lowcode/painter/DesignOperator.js +10 -1
- package/es/lowcode/painter/Panel.js +2 -2
- package/es/lowcode/painter/components/AdvancePanel.js +3 -3
- package/es/lowcode/painter/components/Collapse.js +5 -2
- package/es/lowcode/painter/components/TipIcon.js +16 -0
- package/es/lowcode/painter/components/VarEditor.js +456 -0
- package/es/lowcode/painter/components/code-editor/FullScreenEditor.js +2 -2
- package/es/lowcode/painter/components/code-editor/JSEditor.js +3 -1
- package/es/lowcode/painter/components/code-editor/VisionEditor.js +81 -0
- package/es/lowcode/painter/components/field-setting/SettingUI.js +17 -3
- package/es/lowcode/painter/components/field-setting/index.js +1 -1
- package/es/lowcode/painter/components/field-setting/meta/frontRules.js +2 -1
- package/es/lowcode/painter/index.js +1 -0
- package/es/lowcode/painter/panel-section/BlockEditor/index.js +20 -6
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +2 -2
- package/es/lowcode/painter/panel-section/ComplexPop.js +242 -0
- package/es/lowcode/painter/panel-section/DataSetSelector.js +8 -0
- package/es/lowcode/painter/panel-section/FieldsSetting.js +29 -3
- package/es/lowcode/painter/panel-section/I18nInput.js +4 -2
- package/es/lowcode/painter/panel-section/Icon.js +9 -4
- package/es/lowcode/painter/panel-section/IconConditionSelector.js +7 -7
- package/es/lowcode/painter/panel-section/IconSelector.js +1 -1
- package/es/lowcode/painter/panel-section/ImpExp.js +1 -27
- package/es/lowcode/painter/panel-section/ImpExpAlone.js +1 -2
- package/es/lowcode/painter/panel-section/LayoutRatio.js +1 -0
- package/es/lowcode/painter/panel-section/PageVars.js +300 -0
- package/es/lowcode/painter/panel-section/StylePanel/StyleContext.js +4 -3
- package/es/lowcode/painter/panel-section/TabItems.js +6 -42
- package/es/lowcode/painter/panel-section/TextContent.js +79 -0
- package/es/lowcode/painter/services/complexPop.js +21 -0
- package/es/lowcode/painter/style/design.less +1 -1
- package/es/lowcode/painter/style/page-vars.less +25 -0
- package/es/lowcode/preview/index.js +1 -0
- package/es/lowcode/view/Canvas.js +24 -22
- package/es/lowcode/view/Loading.js +5 -7
- package/es/lowcode/view/Page.js +37 -15
- package/es/lowcode/view/index.js +1 -0
- package/es/lowcode/view/lc-components/Box/index.js +18 -3
- package/es/lowcode/view/lc-components/Box/meta.json +3 -3
- package/es/lowcode/view/lc-components/Button/index.js +7 -7
- package/es/lowcode/view/lc-components/Button/meta.json +2 -2
- package/es/lowcode/view/lc-components/Dialog/index.js +6 -7
- package/es/lowcode/view/lc-components/Dialog/meta.json +2 -2
- package/es/lowcode/view/lc-components/FieldComplex/meta.json +7 -0
- package/es/lowcode/view/lc-components/FieldDate/meta.json +4 -2
- package/es/lowcode/view/lc-components/FieldNumber/meta.json +3 -2
- package/es/lowcode/view/lc-components/FieldUser/meta.json +1 -1
- package/es/lowcode/view/lc-components/Form/index.js +14 -6
- package/es/lowcode/view/lc-components/Form/meta.json +4 -5
- package/es/lowcode/view/lc-components/Iframe/meta.json +1 -1
- package/es/lowcode/view/lc-components/ImEx/index.js +174 -103
- package/es/lowcode/view/lc-components/ImEx/meta.json +26 -5
- package/es/lowcode/view/lc-components/Image/meta.json +1 -1
- package/es/lowcode/view/lc-components/JSX/meta.json +1 -1
- package/es/lowcode/view/lc-components/Layout/index.js +22 -5
- package/es/lowcode/view/lc-components/Layout/meta.json +5 -5
- package/es/lowcode/view/lc-components/Link/meta.json +1 -1
- package/es/lowcode/view/lc-components/Page/meta.json +6 -0
- package/es/lowcode/view/lc-components/PageLayout/FunctionDesign.js +5 -1
- package/es/lowcode/view/lc-components/PageLayout/meta.json +1 -1
- package/es/lowcode/view/lc-components/Section/index.js +2 -6
- package/es/lowcode/view/lc-components/Section/meta.json +2 -1
- package/es/lowcode/view/lc-components/Split/index.js +19 -4
- package/es/lowcode/view/lc-components/Split/meta.json +1 -1
- package/es/lowcode/view/lc-components/Table/index.js +29 -3
- package/es/lowcode/view/lc-components/Table/meta.json +2 -2
- package/es/lowcode/view/lc-components/Tabs/index.js +19 -16
- package/es/lowcode/view/lc-components/Text/index.js +9 -2
- package/es/lowcode/view/lc-components/Text/meta.json +6 -6
- package/es/lowcode/view/lc-components/Wrapper.js +17 -2
- package/es/lowcode/view/style/loading.less +14 -0
- package/es/services.js +19 -0
- package/es/upload/Form/gridForm.js +17 -7
- package/es/upload/FormItem/index.js +6 -6
- package/es/utils/form.js +4 -4
- package/es/utils/grid.js +2 -1
- package/lib/components/Builder/index.js +13 -1
- package/lib/components/ComplexItem/index.js +62 -47
- package/lib/components/LdAutoForm/index.js +3 -2
- package/lib/components/LdFormList/index.js +5 -8
- package/lib/components/LdGridForm/index.js +2 -1
- package/lib/helper/form.js +1 -0
- package/lib/helper/ldBuilder.js +8 -3
- package/lib/locales/zh-CN.js +38 -4
- package/lib/lowcode/constants/event-topics.js +1 -3
- package/lib/lowcode/engine/launcher.js +3 -1
- package/lib/lowcode/engine/meta/box.props.json +3 -3
- package/lib/lowcode/engine/meta/button.props.default.json +1 -1
- package/lib/lowcode/engine/meta/button.props.json +2 -2
- package/lib/lowcode/engine/meta/dialog.props.json +2 -2
- package/lib/lowcode/engine/meta/fieldcomplex.props.default.json +1 -0
- package/lib/lowcode/engine/meta/fieldcomplex.props.json +7 -0
- package/lib/lowcode/engine/meta/fielddate.props.default.json +2 -0
- package/lib/lowcode/engine/meta/fielddate.props.json +4 -2
- package/lib/lowcode/engine/meta/fieldnumber.props.default.json +1 -0
- package/lib/lowcode/engine/meta/fieldnumber.props.json +3 -2
- package/lib/lowcode/engine/meta/fielduser.props.default.json +1 -1
- package/lib/lowcode/engine/meta/fielduser.props.json +1 -1
- package/lib/lowcode/engine/meta/form.props.default.json +0 -1
- package/lib/lowcode/engine/meta/form.props.json +4 -5
- package/lib/lowcode/engine/meta/iframe.props.default.json +1 -1
- package/lib/lowcode/engine/meta/iframe.props.json +1 -1
- package/lib/lowcode/engine/meta/image.props.default.json +1 -1
- package/lib/lowcode/engine/meta/image.props.json +1 -1
- package/lib/lowcode/engine/meta/imex.props.default.json +2 -1
- package/lib/lowcode/engine/meta/imex.props.json +26 -5
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +38 -20
- package/lib/lowcode/engine/meta/jsx.props.default.json +1 -1
- package/lib/lowcode/engine/meta/jsx.props.json +1 -1
- package/lib/lowcode/engine/meta/layout.props.default.json +1 -1
- package/lib/lowcode/engine/meta/layout.props.json +5 -5
- package/lib/lowcode/engine/meta/link.props.default.json +1 -1
- package/lib/lowcode/engine/meta/link.props.json +1 -1
- package/lib/lowcode/engine/meta/page.props.json +6 -0
- package/lib/lowcode/engine/meta/pagelayout.props.default.json +1 -1
- package/lib/lowcode/engine/meta/pagelayout.props.json +1 -1
- package/lib/lowcode/engine/meta/section.props.json +2 -1
- package/lib/lowcode/engine/meta/split.props.default.json +1 -1
- package/lib/lowcode/engine/meta/split.props.json +1 -1
- package/lib/lowcode/engine/meta/table.props.json +2 -2
- package/lib/lowcode/engine/meta/text.props.default.json +4 -2
- package/lib/lowcode/engine/meta/text.props.json +8 -6
- package/lib/lowcode/engine/provider/ContextProvider/index.js +61 -44
- package/lib/lowcode/engine/provider/ContextProvider/router.js +57 -0
- package/lib/lowcode/engine/{tools → provider/ContextProvider}/usePageDataStore.js +9 -7
- package/lib/lowcode/engine/provider/ContextProvider/usePageVar.js +38 -16
- package/lib/lowcode/engine/{tools → provider/ContextProvider}/useTodo.js +5 -7
- package/lib/lowcode/engine/provider/ContextProvider/utils.js +170 -0
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +2 -3
- package/lib/lowcode/engine/tools/helper.js +7 -2
- package/lib/lowcode/engine/tools/initDS.js +270 -0
- package/lib/lowcode/engine/tools/useCombinedRefs.js +2 -1
- package/lib/lowcode/painter/DesignOperator.js +9 -0
- package/lib/lowcode/painter/Panel.js +2 -2
- package/lib/lowcode/painter/components/AdvancePanel.js +3 -3
- package/lib/lowcode/painter/components/Collapse.js +5 -2
- package/lib/lowcode/painter/components/TipIcon.js +23 -0
- package/lib/lowcode/painter/components/VarEditor.js +463 -0
- package/lib/lowcode/painter/components/code-editor/FullScreenEditor.js +2 -2
- package/lib/lowcode/painter/components/code-editor/JSEditor.js +3 -1
- package/lib/lowcode/painter/components/code-editor/VisionEditor.js +88 -0
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +17 -3
- package/lib/lowcode/painter/components/field-setting/index.js +1 -1
- package/lib/lowcode/painter/components/field-setting/meta/frontRules.js +2 -1
- package/lib/lowcode/painter/index.js +1 -0
- package/lib/lowcode/painter/panel-section/BlockEditor/index.js +19 -5
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +2 -2
- package/lib/lowcode/painter/panel-section/ComplexPop.js +250 -0
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +8 -0
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +29 -3
- package/lib/lowcode/painter/panel-section/I18nInput.js +4 -2
- package/lib/lowcode/painter/panel-section/Icon.js +8 -3
- package/lib/lowcode/painter/panel-section/IconConditionSelector.js +6 -6
- package/lib/lowcode/painter/panel-section/IconSelector.js +1 -1
- package/lib/lowcode/painter/panel-section/ImpExp.js +0 -26
- package/lib/lowcode/painter/panel-section/ImpExpAlone.js +0 -1
- package/lib/lowcode/painter/panel-section/LayoutRatio.js +1 -0
- package/lib/lowcode/painter/panel-section/PageVars.js +308 -0
- package/lib/lowcode/painter/panel-section/StylePanel/StyleContext.js +4 -3
- package/lib/lowcode/painter/panel-section/TabItems.js +6 -42
- package/lib/lowcode/painter/panel-section/TextContent.js +87 -0
- package/lib/lowcode/painter/services/complexPop.js +28 -0
- package/lib/lowcode/painter/style/design.less +1 -1
- package/lib/lowcode/painter/style/page-vars.less +25 -0
- package/lib/lowcode/preview/index.js +1 -0
- package/lib/lowcode/view/Canvas.js +24 -22
- package/lib/lowcode/view/Loading.js +5 -7
- package/lib/lowcode/view/Page.js +35 -13
- package/lib/lowcode/view/index.js +1 -0
- package/lib/lowcode/view/lc-components/Box/index.js +17 -2
- package/lib/lowcode/view/lc-components/Box/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Button/index.js +5 -5
- package/lib/lowcode/view/lc-components/Button/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Dialog/index.js +6 -7
- package/lib/lowcode/view/lc-components/Dialog/meta.json +2 -2
- package/lib/lowcode/view/lc-components/FieldComplex/meta.json +7 -0
- package/lib/lowcode/view/lc-components/FieldDate/meta.json +4 -2
- package/lib/lowcode/view/lc-components/FieldNumber/meta.json +3 -2
- package/lib/lowcode/view/lc-components/FieldUser/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Form/index.js +14 -6
- package/lib/lowcode/view/lc-components/Form/meta.json +4 -5
- package/lib/lowcode/view/lc-components/Iframe/meta.json +1 -1
- package/lib/lowcode/view/lc-components/ImEx/index.js +172 -101
- package/lib/lowcode/view/lc-components/ImEx/meta.json +26 -5
- package/lib/lowcode/view/lc-components/Image/meta.json +1 -1
- package/lib/lowcode/view/lc-components/JSX/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Layout/index.js +21 -4
- package/lib/lowcode/view/lc-components/Layout/meta.json +5 -5
- package/lib/lowcode/view/lc-components/Link/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Page/meta.json +6 -0
- package/lib/lowcode/view/lc-components/PageLayout/FunctionDesign.js +5 -1
- package/lib/lowcode/view/lc-components/PageLayout/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Section/index.js +2 -6
- package/lib/lowcode/view/lc-components/Section/meta.json +2 -1
- package/lib/lowcode/view/lc-components/Split/index.js +18 -3
- package/lib/lowcode/view/lc-components/Split/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Table/index.js +30 -4
- package/lib/lowcode/view/lc-components/Table/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Tabs/index.js +17 -14
- package/lib/lowcode/view/lc-components/Text/index.js +8 -1
- package/lib/lowcode/view/lc-components/Text/meta.json +6 -6
- package/lib/lowcode/view/lc-components/Wrapper.js +16 -1
- package/lib/lowcode/view/style/loading.less +14 -0
- package/lib/services.js +20 -0
- package/lib/upload/Form/gridForm.js +17 -7
- package/lib/upload/FormItem/index.js +6 -6
- package/lib/utils/form.js +3 -3
- package/lib/utils/grid.js +2 -1
- package/package.json +3 -3
package/es/lowcode/view/Page.js
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
5
|
var _excluded = ["className"];
|
|
5
|
-
import React, { useRef,
|
|
6
|
-
import { useMemoizedFn } from 'ahooks';
|
|
6
|
+
import React, { forwardRef, useRef, Suspense } from 'react';
|
|
7
|
+
import { useMemoizedFn, useCreation, useBoolean } from 'ahooks';
|
|
8
|
+
import { Skeleton } from 'luck-design/antd';
|
|
7
9
|
import classNames from 'classnames';
|
|
8
|
-
import styled from 'styled-components';
|
|
9
10
|
import { useRemoteSource, useContext } from "../engine/provider/ContextProvider";
|
|
11
|
+
import initDS from "../engine/tools/initDS";
|
|
10
12
|
import Loading from "./Loading";
|
|
11
13
|
import Wrapper from "./lc-components/Wrapper";
|
|
12
14
|
import Canvas from "./Canvas";
|
|
13
15
|
import { LC_BUILDIN_UNIT_KEY } from "../constants";
|
|
16
|
+
import useCombinedRefs from "../engine/tools/useCombinedRefs";
|
|
14
17
|
import ErrorBoundary from "./errorBoundary";
|
|
15
18
|
import styles from "./style/page.less";
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
var className = _ref2.className,
|
|
22
|
-
props = _objectWithoutProperties(_ref2, _excluded);
|
|
23
|
-
var _ref = useRef(null);
|
|
24
|
-
var _rootRef = ref || _ref;
|
|
19
|
+
var LCPage = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
20
|
+
var className = _ref.className,
|
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
var _rootRef = useCombinedRefs(ref);
|
|
23
|
+
var _dsRef = useRef();
|
|
25
24
|
var _useRemoteSource = useRemoteSource(),
|
|
26
25
|
loading = _useRemoteSource.loading;
|
|
27
|
-
var
|
|
26
|
+
var _useBoolean = useBoolean(false),
|
|
27
|
+
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
28
|
+
loadMount = _useBoolean2[0],
|
|
29
|
+
setTrue = _useBoolean2[1].setTrue;
|
|
30
|
+
var ctx = useContext();
|
|
31
|
+
var handlePageLoadMount = useMemoizedFn(function () {
|
|
32
|
+
_dsRef.current = initDS(ctx);
|
|
33
|
+
setTrue();
|
|
34
|
+
});
|
|
35
|
+
useCreation(function () {
|
|
36
|
+
ctx.$subscriber(ctx.topics.PAGE_LOAD_MOUNT).once(handlePageLoadMount).watch();
|
|
37
|
+
}, []);
|
|
28
38
|
var getTargetDom = useMemoizedFn(function () {
|
|
29
39
|
return _rootRef.current;
|
|
30
40
|
});
|
|
31
41
|
var handleClear = useMemoizedFn(function () {
|
|
32
|
-
|
|
42
|
+
ctx.$publisher(ctx.topics.COMPONENT_ACTIVE, null);
|
|
33
43
|
});
|
|
34
44
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
35
45
|
onClear: handleClear
|
|
@@ -39,6 +49,18 @@ var LCPage = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
39
49
|
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
40
50
|
ref: _rootRef,
|
|
41
51
|
className: classNames(styles['lc-view-page'], _defineProperty(_defineProperty({}, styles.isloading, loading), className, !!className))
|
|
42
|
-
}, props), /*#__PURE__*/React.createElement(
|
|
52
|
+
}, props), /*#__PURE__*/React.createElement(Suspense, {
|
|
53
|
+
fallback: /*#__PURE__*/React.createElement(Skeleton, {
|
|
54
|
+
active: true,
|
|
55
|
+
title: {
|
|
56
|
+
width: '70%'
|
|
57
|
+
},
|
|
58
|
+
paragraph: {
|
|
59
|
+
rows: 9
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
}, loadMount ? /*#__PURE__*/React.createElement(Canvas, {
|
|
63
|
+
dsRef: _dsRef
|
|
64
|
+
}) : null))), loading ? /*#__PURE__*/React.createElement(Loading, null) : null);
|
|
43
65
|
});
|
|
44
66
|
export default LCPage;
|
package/es/lowcode/view/index.js
CHANGED
|
@@ -9,6 +9,7 @@ var View = function View(_ref) {
|
|
|
9
9
|
var code = _ref.code,
|
|
10
10
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
11
11
|
return /*#__PURE__*/React.createElement(EventBusProvider, {
|
|
12
|
+
key: code,
|
|
12
13
|
runtime: RUNTIME.LIVE
|
|
13
14
|
}, /*#__PURE__*/React.createElement(ContextProvider, {
|
|
14
15
|
code: code
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import React, { useRef } from 'react';
|
|
2
|
+
import React, { useRef, useEffect } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { useMemoizedFn } from 'ahooks';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
|
+
import { useContext } from "../../../engine/provider/ContextProvider";
|
|
7
8
|
import Wrapper from "../Wrapper";
|
|
8
9
|
import styles from "./index.less";
|
|
9
10
|
import { omitBadProps } from "../../../engine/tools/helper";
|
|
@@ -19,8 +20,21 @@ var LCBox = function LCBox(_ref) {
|
|
|
19
20
|
children = _ref.children,
|
|
20
21
|
className = _ref.className,
|
|
21
22
|
css = _ref.css,
|
|
22
|
-
style = _ref.style
|
|
23
|
+
style = _ref.style,
|
|
24
|
+
advance = _ref.advance;
|
|
23
25
|
var ref = useRef();
|
|
26
|
+
var ctx = useContext();
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
ctx.doAction(advance.events.onMount);
|
|
29
|
+
return function () {
|
|
30
|
+
return ctx.doAction(advance.events.onUnmount);
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
var handleClick = useMemoizedFn(function (e) {
|
|
34
|
+
ctx.doAction(advance.events.onClick, {
|
|
35
|
+
e: e
|
|
36
|
+
});
|
|
37
|
+
});
|
|
24
38
|
var getTargetDom = useMemoizedFn(function () {
|
|
25
39
|
return ref.current;
|
|
26
40
|
});
|
|
@@ -32,7 +46,8 @@ var LCBox = function LCBox(_ref) {
|
|
|
32
46
|
ref: ref,
|
|
33
47
|
className: classNames(styles['lc-component-box'], _defineProperty({}, className, !!className)),
|
|
34
48
|
style: style,
|
|
35
|
-
$css: css
|
|
49
|
+
$css: css,
|
|
50
|
+
onClick: handleClick
|
|
36
51
|
}, children));
|
|
37
52
|
};
|
|
38
53
|
LCBox.propTypes = {
|
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
"key": "onMount",
|
|
22
22
|
"name": "组件首次渲染时",
|
|
23
23
|
"desc": "在组件首次渲染时,执行方法",
|
|
24
|
-
"func": "function onMount(
|
|
24
|
+
"func": "function onMount() {\n\t\n}"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"key": "onUnmount",
|
|
28
28
|
"name": "组件卸载时",
|
|
29
29
|
"desc": "在组件卸载时,执行方法。",
|
|
30
|
-
"func": "function onUnmount(
|
|
30
|
+
"func": "function onUnmount() {\n\t\n}"
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"key": "onClick",
|
|
34
34
|
"name": "点击事件",
|
|
35
|
-
"desc": "
|
|
35
|
+
"desc": "点击组件时,执行方法",
|
|
36
36
|
"func": "function onClick(e) {\n\t\n}"
|
|
37
37
|
}
|
|
38
38
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import React, { useRef } from 'react';
|
|
2
|
+
import React, { useRef, useEffect } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { useMemoizedFn
|
|
4
|
+
import { useMemoizedFn } from 'ahooks';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { useContext } from "../../../engine/provider/ContextProvider";
|
|
@@ -32,12 +32,12 @@ var LCButton = function LCButton(_ref) {
|
|
|
32
32
|
advance = _ref.advance;
|
|
33
33
|
var ref = useRef();
|
|
34
34
|
var ctx = useContext();
|
|
35
|
-
|
|
35
|
+
useEffect(function () {
|
|
36
36
|
ctx.doAction(advance.events.onMount);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
37
|
+
return function () {
|
|
38
|
+
return ctx.doAction(advance.events.onUnmount);
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
41
|
var handleClick = useMemoizedFn(function (e) {
|
|
42
42
|
if (onClick) {
|
|
43
43
|
onClick(e);
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"default": "hidden"
|
|
102
102
|
}
|
|
103
103
|
],
|
|
104
|
-
"css":
|
|
104
|
+
"css": "",
|
|
105
105
|
"advance": {
|
|
106
106
|
"events": [
|
|
107
107
|
{
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
{
|
|
120
120
|
"key": "onClick",
|
|
121
121
|
"name": "点击事件",
|
|
122
|
-
"desc": "
|
|
122
|
+
"desc": "点击按钮时,执行方法",
|
|
123
123
|
"func": "function onClick(e) {\n\t\n}"
|
|
124
124
|
}
|
|
125
125
|
]
|
|
@@ -8,6 +8,7 @@ import { useMemoizedFn, useUpdateEffect, useCreation } from 'ahooks';
|
|
|
8
8
|
import { Modal, Button } from 'luck-design/antd';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import styled from 'styled-components';
|
|
11
|
+
import { isNil } from 'lodash';
|
|
11
12
|
import { LDActions } from "../../../../index";
|
|
12
13
|
import { useContext } from "../../../engine/provider/ContextProvider";
|
|
13
14
|
import { omitBadProps } from "../../../engine/tools/helper";
|
|
@@ -86,13 +87,9 @@ var LCDialog = function LCDialog(_ref) {
|
|
|
86
87
|
}, _callee);
|
|
87
88
|
})));
|
|
88
89
|
var _footer = useCreation(function () {
|
|
89
|
-
var _btnGroup$todoList;
|
|
90
90
|
if (!footer) return {
|
|
91
91
|
footer: null
|
|
92
92
|
};
|
|
93
|
-
if (!(btnGroup !== null && btnGroup !== void 0 && (_btnGroup$todoList = btnGroup.todoList) !== null && _btnGroup$todoList !== void 0 && _btnGroup$todoList.length)) return {
|
|
94
|
-
confirmLoading: loading
|
|
95
|
-
};
|
|
96
93
|
return {
|
|
97
94
|
footer: /*#__PURE__*/React.createElement(Footer, null, /*#__PURE__*/React.createElement(LDActions, _extends({}, btnGroup, {
|
|
98
95
|
doAction: function doAction(action) {
|
|
@@ -111,7 +108,7 @@ var LCDialog = function LCDialog(_ref) {
|
|
|
111
108
|
onClick: handleOk
|
|
112
109
|
}, okText))
|
|
113
110
|
};
|
|
114
|
-
}, [footer, btnGroup, loading]);
|
|
111
|
+
}, [footer, btnGroup, loading, cancelText, okText]);
|
|
115
112
|
var getTargetDom = useMemoizedFn(function () {
|
|
116
113
|
var _domRef$current;
|
|
117
114
|
return (_domRef$current = domRef.current) === null || _domRef$current === void 0 ? void 0 : _domRef$current.closest('.ant-modal-content');
|
|
@@ -155,7 +152,6 @@ var LCDialog = function LCDialog(_ref) {
|
|
|
155
152
|
}, /*#__PURE__*/React.createElement(Modal, _extends({
|
|
156
153
|
title: _title,
|
|
157
154
|
visible: open,
|
|
158
|
-
getContainer: getContainer,
|
|
159
155
|
width: width,
|
|
160
156
|
mask: mask,
|
|
161
157
|
maskStyle: maskStyle,
|
|
@@ -164,7 +160,10 @@ var LCDialog = function LCDialog(_ref) {
|
|
|
164
160
|
overflowY: 'auto',
|
|
165
161
|
marginTop: 0
|
|
166
162
|
},
|
|
167
|
-
wrapClassName: classNames(styles['lc-component-dialog-wrapper'], _defineProperty({}, wrapClassName, !!wrapClassName))
|
|
163
|
+
wrapClassName: classNames(styles['lc-component-dialog-wrapper'], _defineProperty({}, wrapClassName, !!wrapClassName)),
|
|
164
|
+
getContainer: isNil(getContainer) ? function () {
|
|
165
|
+
return document.getElementById('root') || document.getElementById('react-content') || document.body;
|
|
166
|
+
} : getContainer
|
|
168
167
|
}, _footer, {
|
|
169
168
|
onOk: handleOk,
|
|
170
169
|
onCancel: function onCancel() {
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
{
|
|
107
107
|
"key": "btnGroup",
|
|
108
108
|
"name": "按钮组",
|
|
109
|
-
"desc": "
|
|
109
|
+
"desc": "底部按钮区域的按钮组",
|
|
110
110
|
"type": "_ActionsEditor",
|
|
111
111
|
"default": { "display": "button", "max": 2, "moreText": "操作", "todoList": [] },
|
|
112
112
|
"wrapper": "collapse",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
{
|
|
137
137
|
"key": "onClose",
|
|
138
138
|
"name": "对话框关闭时",
|
|
139
|
-
"desc": "
|
|
139
|
+
"desc": "在对话框关闭时,执行方法",
|
|
140
140
|
"func": "function onClose() {\n\t\n}"
|
|
141
141
|
},
|
|
142
142
|
{
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
{
|
|
16
16
|
"key": "showTime",
|
|
17
17
|
"name": "时间选择",
|
|
18
|
-
"type": "switch"
|
|
18
|
+
"type": "switch",
|
|
19
|
+
"default": false
|
|
19
20
|
},
|
|
20
21
|
{
|
|
21
22
|
"key": "allowClear",
|
|
22
23
|
"name": "允许清除",
|
|
23
|
-
"type": "switch"
|
|
24
|
+
"type": "switch",
|
|
25
|
+
"default": true
|
|
24
26
|
},
|
|
25
27
|
{
|
|
26
28
|
"key": "format",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
{
|
|
16
16
|
"key": "step",
|
|
17
17
|
"name": "步数",
|
|
18
|
-
"type": "number"
|
|
18
|
+
"type": "number",
|
|
19
|
+
"default": 1
|
|
19
20
|
},
|
|
20
21
|
{
|
|
21
22
|
"key": "min",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
{
|
|
26
27
|
"key": "max",
|
|
27
28
|
"name": "最大值",
|
|
28
|
-
"type": "
|
|
29
|
+
"type": "number"
|
|
29
30
|
},
|
|
30
31
|
{
|
|
31
32
|
"key": "addonBefore",
|
|
@@ -3,7 +3,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
-
var _excluded = ["advance", "state"];
|
|
6
|
+
var _excluded = ["advance", "state", "render"];
|
|
7
7
|
import React, { useRef, forwardRef, Fragment, useImperativeHandle } from 'react';
|
|
8
8
|
import { useMemoizedFn, useCreation, useUnmount } from 'ahooks';
|
|
9
9
|
import classNames from 'classnames';
|
|
@@ -56,7 +56,7 @@ var getMthodParams = function getMthodParams(methodStr) {
|
|
|
56
56
|
return [];
|
|
57
57
|
};
|
|
58
58
|
var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
59
|
-
var _ctx$state2;
|
|
59
|
+
var _ctx$state2, _promiseRef$current2;
|
|
60
60
|
var id = _ref3.id,
|
|
61
61
|
className = _ref3.className,
|
|
62
62
|
blocks = _ref3.blocks,
|
|
@@ -228,9 +228,7 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
228
228
|
return wrapperRef.current;
|
|
229
229
|
});
|
|
230
230
|
var handleDefaultDataSourceFormat = useMemoizedFn(function (defaultDataSourceFormat, defaultValues) {
|
|
231
|
-
if (isNil(defaultDataSourceFormat)) return function () {
|
|
232
|
-
return defaultValues;
|
|
233
|
-
};
|
|
231
|
+
if (isNil(defaultDataSourceFormat)) return function () {};
|
|
234
232
|
return executeCode(ctx, defaultDataSourceFormat, ['defaultValues'], defaultValues);
|
|
235
233
|
});
|
|
236
234
|
var handleDataSourceFormat = useMemoizedFn(function (type, dataSourceFormat, dataSetKey, _ref6) {
|
|
@@ -323,6 +321,7 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
323
321
|
return reduce(fields, function (result, setting) {
|
|
324
322
|
var advance = setting.advance,
|
|
325
323
|
_state = setting.state,
|
|
324
|
+
render = setting.render,
|
|
326
325
|
rest = _objectWithoutProperties(setting, _excluded);
|
|
327
326
|
var isShow = true;
|
|
328
327
|
if (ctx.runtime !== RUNTIME.DESIGN && _state) {
|
|
@@ -355,6 +354,14 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
355
354
|
};
|
|
356
355
|
}
|
|
357
356
|
result.push(_objectSpread(_objectSpread({}, _props), {}, {
|
|
357
|
+
render: render ? function (v, d, i, p) {
|
|
358
|
+
return /*#__PURE__*/React.createElement(RuntimeComp, {
|
|
359
|
+
value: v,
|
|
360
|
+
data: d,
|
|
361
|
+
rowIndex: i,
|
|
362
|
+
params: p
|
|
363
|
+
}, render.replace(/(function\s*\w*\s*)\([^)]*\)(\s*{)/, '$1()$2'));
|
|
364
|
+
} : null,
|
|
358
365
|
events: advance !== null && advance !== void 0 && advance.events ? reduce(advance.events, function (result, value, key) {
|
|
359
366
|
//处理事件
|
|
360
367
|
result[key] = function () {
|
|
@@ -577,7 +584,8 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
577
584
|
}
|
|
578
585
|
return (_promiseRef$current = promiseRef.current) === null || _promiseRef$current === void 0 ? void 0 : _promiseRef$current.call.apply(_promiseRef$current, [promiseRef].concat(rest));
|
|
579
586
|
},
|
|
580
|
-
afterInit: afterInit
|
|
587
|
+
afterInit: afterInit,
|
|
588
|
+
validateErrorCallback: (_promiseRef$current2 = promiseRef.current) === null || _promiseRef$current2 === void 0 ? void 0 : _promiseRef$current2.call(promiseRef)
|
|
581
589
|
}));
|
|
582
590
|
});
|
|
583
591
|
LCForm.defaultProps = omitBadProps(defaultMeta);
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
{
|
|
115
115
|
"key": "dataset",
|
|
116
116
|
"name": "数据集",
|
|
117
|
-
"desc": "
|
|
117
|
+
"desc": "选择系统中的可用数据集",
|
|
118
118
|
"type": "_DataSetSelector",
|
|
119
119
|
"component": "form",
|
|
120
120
|
"next": {
|
|
@@ -209,7 +209,6 @@
|
|
|
209
209
|
"suppressPreset": false,
|
|
210
210
|
"height": "100%",
|
|
211
211
|
"bordered": false,
|
|
212
|
-
"popTitleKey": "title",
|
|
213
212
|
"draggable": false,
|
|
214
213
|
"orderByAdd": "asc",
|
|
215
214
|
"suppressActions": false,
|
|
@@ -245,7 +244,7 @@
|
|
|
245
244
|
"name": "格式化默认数据",
|
|
246
245
|
"desc": "格式化新增时默认数据",
|
|
247
246
|
"type": "_JSEditor",
|
|
248
|
-
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return
|
|
247
|
+
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return {}; \n}",
|
|
249
248
|
"mustConfirm": true,
|
|
250
249
|
"wrapper": "collapse",
|
|
251
250
|
"wrapperProps": { "suppressIcon": true }
|
|
@@ -336,7 +335,7 @@
|
|
|
336
335
|
"name": "格式化默认数据",
|
|
337
336
|
"desc": "格式化新增时默认数据",
|
|
338
337
|
"type": "_JSEditor",
|
|
339
|
-
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return
|
|
338
|
+
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return {}; \n}",
|
|
340
339
|
"mustConfirm": true,
|
|
341
340
|
"wrapper": "collapse",
|
|
342
341
|
"wrapperProps": { "suppressIcon": true }
|
|
@@ -447,7 +446,7 @@
|
|
|
447
446
|
"name": "格式化默认数据",
|
|
448
447
|
"desc": "格式化新增时默认数据",
|
|
449
448
|
"type": "_JSEditor",
|
|
450
|
-
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return
|
|
449
|
+
"defaultCode": "function defaultDataSourceFormat(defaultValues) { \n return {}; \n}",
|
|
451
450
|
"mustConfirm": true,
|
|
452
451
|
"wrapper": "collapse",
|
|
453
452
|
"wrapperProps": { "suppressIcon": true }
|