@luck-design-biz/luckda 0.0.25-4 → 0.0.25-7
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/LDActions/index.less +1 -1
- package/es/components/LdAutoForm/index.js +24 -8
- package/es/components/LdFormList/index.js +25 -18
- package/es/components/LdGrid/index.js +3 -2
- package/es/components/LdGridForm/index.js +16 -6
- package/es/components/LdTree/index.js +3 -2
- package/es/helper/form.js +6 -3
- package/es/locales/zh-CN.js +1 -0
- package/es/lowcode/constants/api-url.js +13 -11
- package/es/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +5 -2
- package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +5 -2
- package/es/lowcode/engine/meta/dialog.props.default.json +10 -5
- package/es/lowcode/engine/meta/dialog.props.json +72 -42
- package/es/lowcode/engine/meta/form.props.json +3 -3
- package/es/lowcode/engine/meta/table.props.json +4 -4
- package/es/lowcode/engine/meta/tree.props.default.json +1 -0
- package/es/lowcode/engine/meta/tree.props.json +7 -0
- package/es/lowcode/engine/provider/ContextProvider/index.js +8 -40
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +16 -20
- package/es/lowcode/engine/tools/helper.js +2 -3
- package/es/lowcode/engine/tools/useCanvasRender.js +3 -2
- package/es/lowcode/engine/tools/usePageDataStore.js +174 -0
- package/es/lowcode/engine/tools/usePromiseState.js +12 -23
- package/es/lowcode/engine/tools/useTodo.js +20 -10
- package/es/lowcode/painter/DesignOperator.js +11 -22
- package/es/lowcode/painter/DesignToolbar.js +8 -44
- package/es/lowcode/painter/Outline.js +2 -4
- package/es/lowcode/painter/Panel.js +26 -25
- package/es/lowcode/painter/components/ActionBindModal.js +5 -11
- package/es/lowcode/painter/components/AttrsPanel.js +26 -19
- package/es/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
- package/es/lowcode/painter/components/field-setting/SettingUI.js +7 -7
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +11 -11
- package/es/lowcode/painter/panel-section/ButtonType.js +4 -2
- package/es/lowcode/painter/panel-section/DataSetSelector.js +4 -1
- package/es/lowcode/painter/panel-section/FieldsSetting.js +5 -1
- package/es/lowcode/painter/panel-section/SerialsSelector.js +4 -2
- package/es/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
- package/es/lowcode/painter/style/design.less +1 -1
- package/es/lowcode/painter/style/panel-item.less +1 -1
- package/es/lowcode/view/Canvas.js +6 -7
- package/es/lowcode/view/Page.js +2 -3
- package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +3 -10
- package/es/lowcode/view/lc-components/Dialog/index.js +89 -19
- package/es/lowcode/view/lc-components/Dialog/meta.json +65 -42
- package/es/lowcode/view/lc-components/Form/FunctionDesign.js +23 -33
- package/es/lowcode/view/lc-components/Form/index.js +20 -6
- package/es/lowcode/view/lc-components/Form/meta.json +3 -3
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +12 -19
- package/es/lowcode/view/lc-components/PageContent/index.js +8 -9
- package/es/lowcode/view/lc-components/PageFooter/index.js +2 -5
- package/es/lowcode/view/lc-components/PageHeader/index.js +5 -6
- package/es/lowcode/view/lc-components/PageModal/index.js +12 -15
- package/es/lowcode/view/lc-components/Section/FunctionDesign.js +3 -9
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +11 -18
- package/es/lowcode/view/lc-components/Table/index.js +67 -25
- package/es/lowcode/view/lc-components/Table/meta.json +4 -4
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +9 -17
- package/es/lowcode/view/lc-components/Tree/index.js +8 -1
- package/es/lowcode/view/lc-components/Tree/meta.json +7 -0
- package/es/lowcode/view/lc-components/Wrapper.js +9 -11
- package/es/services.js +0 -24
- package/es/upload/FilesWall/file.png +0 -0
- package/es/upload/FilesWall/index.js +422 -0
- package/es/upload/FilesWall/index.less +74 -0
- package/es/upload/Form/index.js +2 -1
- package/es/upload/FormItem/index.js +2 -1
- package/es/upload/index.js +2 -1
- package/es/utils/action.js +2 -2
- package/lib/components/LDActions/index.less +1 -1
- package/lib/components/LdAutoForm/index.js +23 -7
- package/lib/components/LdFormList/index.js +25 -18
- package/lib/components/LdGrid/index.js +3 -2
- package/lib/components/LdGridForm/index.js +14 -4
- package/lib/components/LdTree/index.js +3 -2
- package/lib/helper/form.js +6 -3
- package/lib/locales/zh-CN.js +1 -0
- package/lib/lowcode/constants/api-url.js +14 -10
- package/lib/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +7 -4
- package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +6 -3
- package/lib/lowcode/engine/meta/dialog.props.default.json +10 -5
- package/lib/lowcode/engine/meta/dialog.props.json +72 -42
- package/lib/lowcode/engine/meta/form.props.json +3 -3
- package/lib/lowcode/engine/meta/table.props.json +4 -4
- package/lib/lowcode/engine/meta/tree.props.default.json +1 -0
- package/lib/lowcode/engine/meta/tree.props.json +7 -0
- package/lib/lowcode/engine/provider/ContextProvider/index.js +25 -41
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +16 -20
- package/lib/lowcode/engine/tools/helper.js +2 -3
- package/lib/lowcode/engine/tools/useCanvasRender.js +3 -2
- package/lib/lowcode/engine/tools/usePageDataStore.js +181 -0
- package/lib/lowcode/engine/tools/usePromiseState.js +11 -21
- package/lib/lowcode/engine/tools/useTodo.js +19 -9
- package/lib/lowcode/painter/DesignOperator.js +10 -21
- package/lib/lowcode/painter/DesignToolbar.js +7 -43
- package/lib/lowcode/painter/Outline.js +1 -3
- package/lib/lowcode/painter/Panel.js +25 -24
- package/lib/lowcode/painter/components/ActionBindModal.js +5 -11
- package/lib/lowcode/painter/components/AttrsPanel.js +26 -19
- package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +7 -7
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +10 -10
- package/lib/lowcode/painter/panel-section/ButtonType.js +4 -2
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +4 -1
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +5 -1
- package/lib/lowcode/painter/panel-section/SerialsSelector.js +4 -2
- package/lib/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
- package/lib/lowcode/painter/style/design.less +1 -1
- package/lib/lowcode/painter/style/panel-item.less +1 -1
- package/lib/lowcode/view/Canvas.js +5 -6
- package/lib/lowcode/view/Page.js +2 -3
- package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -9
- package/lib/lowcode/view/lc-components/Dialog/index.js +89 -19
- package/lib/lowcode/view/lc-components/Dialog/meta.json +65 -42
- package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +20 -31
- package/lib/lowcode/view/lc-components/Form/index.js +20 -6
- package/lib/lowcode/view/lc-components/Form/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +11 -18
- package/lib/lowcode/view/lc-components/PageContent/index.js +7 -8
- package/lib/lowcode/view/lc-components/PageFooter/index.js +2 -5
- package/lib/lowcode/view/lc-components/PageHeader/index.js +4 -5
- package/lib/lowcode/view/lc-components/PageModal/index.js +11 -14
- package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +2 -8
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +10 -17
- package/lib/lowcode/view/lc-components/Table/index.js +66 -24
- package/lib/lowcode/view/lc-components/Table/meta.json +4 -4
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +8 -16
- package/lib/lowcode/view/lc-components/Tree/index.js +8 -1
- package/lib/lowcode/view/lc-components/Tree/meta.json +7 -0
- package/lib/lowcode/view/lc-components/Wrapper.js +8 -10
- package/lib/services.js +0 -25
- package/lib/upload/FilesWall/file.png +0 -0
- package/lib/upload/FilesWall/index.js +429 -0
- package/lib/upload/FilesWall/index.less +74 -0
- package/lib/upload/Form/index.js +2 -1
- package/lib/upload/FormItem/index.js +2 -1
- package/lib/upload/index.js +8 -1
- package/lib/utils/action.js +2 -2
- package/package.json +4 -3
package/es/lowcode/view/Page.js
CHANGED
|
@@ -23,8 +23,7 @@ var LCPage = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
23
23
|
var _ref = useRef(null);
|
|
24
24
|
var _rootRef = ref || _ref;
|
|
25
25
|
var _useRemoteSource = useRemoteSource(),
|
|
26
|
-
loading = _useRemoteSource.loading
|
|
27
|
-
pageData = _useRemoteSource.pageData;
|
|
26
|
+
loading = _useRemoteSource.loading;
|
|
28
27
|
var getTargetDom = useMemoizedFn(function () {
|
|
29
28
|
return _rootRef.current;
|
|
30
29
|
});
|
|
@@ -34,6 +33,6 @@ var LCPage = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
34
33
|
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
35
34
|
ref: _rootRef,
|
|
36
35
|
className: classNames(styles['lc-view-page'], _defineProperty(_defineProperty({}, styles.isloading, loading), className, !!className))
|
|
37
|
-
}, props),
|
|
36
|
+
}, props), /*#__PURE__*/React.createElement(Canvas, null), loading ? /*#__PURE__*/React.createElement(Masker, null, /*#__PURE__*/React.createElement(Loading, null)) : null));
|
|
38
37
|
});
|
|
39
38
|
export default LCPage;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
5
|
var _excluded = ["id", "children", "className"];
|
|
7
6
|
import React from 'react';
|
|
8
7
|
import { useCreation } from 'ahooks';
|
|
9
8
|
import Index from "./index";
|
|
10
9
|
import { suid } from '@luck-design-biz/base/utils';
|
|
11
|
-
import { useContext,
|
|
12
|
-
import { add } from "../../../engine/tools/dataProcess";
|
|
10
|
+
import { useContext, addNode } from "../../../engine/provider/ContextProvider";
|
|
13
11
|
import classNames from 'classnames';
|
|
14
12
|
import styles from "./index.less";
|
|
15
13
|
import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
|
|
@@ -19,19 +17,14 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
19
17
|
className = _ref.className,
|
|
20
18
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
21
19
|
var ctx = useContext();
|
|
22
|
-
var _usePageData = usePageData(),
|
|
23
|
-
_usePageData2 = _slicedToArray(_usePageData, 2),
|
|
24
|
-
setPageData = _usePageData2[1].setPageData;
|
|
25
20
|
useCreation(function () {
|
|
26
21
|
if (children !== null && children !== void 0 && children.length) return;
|
|
27
22
|
ctx.$subscriber(ctx.topics.COMPONENT_APPEND).once(function (_ref2) {
|
|
28
|
-
var compId = _ref2.id
|
|
29
|
-
pageData = _ref2.pageData;
|
|
23
|
+
var compId = _ref2.id;
|
|
30
24
|
if (compId !== id) return;
|
|
31
|
-
|
|
25
|
+
addNode(id, "box_".concat(suid()), _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
|
|
32
26
|
buildIn: true
|
|
33
27
|
}));
|
|
34
|
-
setPageData(pageData);
|
|
35
28
|
}).watch();
|
|
36
29
|
}, []);
|
|
37
30
|
return /*#__PURE__*/React.createElement(Index, _extends({
|
|
@@ -1,29 +1,83 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import { useMemoizedFn, useBoolean } from 'ahooks';
|
|
7
|
-
import { Modal } from 'luck-design/antd';
|
|
4
|
+
import React, { useRef, useEffect, useImperativeHandle } from 'react';
|
|
5
|
+
import { useMemoizedFn, useUpdateEffect, useCreation } from 'ahooks';
|
|
6
|
+
import { Modal, Button } from 'luck-design/antd';
|
|
8
7
|
import classNames from 'classnames';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { LDActions } from "../../../../index";
|
|
10
|
+
import { useContext } from "../../../engine/provider/ContextProvider";
|
|
11
|
+
import usePromiseState from "../../../engine/tools/usePromiseState";
|
|
9
12
|
import Wrapper from "../Wrapper";
|
|
10
13
|
import styles from "./index.less";
|
|
14
|
+
var Footer = styled.div.withConfig({
|
|
15
|
+
displayName: "Footer",
|
|
16
|
+
componentId: "luckda-6530__sc-1aeozvd-0"
|
|
17
|
+
})(["width:100%;display:flex;justify-content:flex-end;"]);
|
|
11
18
|
var LCDialog = function LCDialog(_ref) {
|
|
12
19
|
var id = _ref.id,
|
|
13
20
|
children = _ref.children,
|
|
21
|
+
title = _ref.title,
|
|
22
|
+
width = _ref.width,
|
|
23
|
+
height = _ref.height,
|
|
14
24
|
getContainer = _ref.getContainer,
|
|
15
25
|
wrapClassName = _ref.wrapClassName,
|
|
16
26
|
maskStyle = _ref.maskStyle,
|
|
17
|
-
|
|
27
|
+
defaultOpen = _ref.defaultOpen,
|
|
28
|
+
mask = _ref.mask,
|
|
29
|
+
okText = _ref.okText,
|
|
30
|
+
cancelText = _ref.cancelText,
|
|
31
|
+
footer = _ref.footer,
|
|
32
|
+
btnGroup = _ref.btnGroup,
|
|
33
|
+
advance = _ref.advance;
|
|
34
|
+
var ctx = useContext();
|
|
18
35
|
var apiRef = useRef();
|
|
19
36
|
var domRef = useRef();
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
open =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
var _usePromiseState = usePromiseState(defaultOpen),
|
|
38
|
+
_usePromiseState2 = _slicedToArray(_usePromiseState, 2),
|
|
39
|
+
open = _usePromiseState2[0],
|
|
40
|
+
setOpen = _usePromiseState2[1];
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
ctx.doAction(advance.events.onMount);
|
|
43
|
+
return function () {
|
|
44
|
+
return ctx.doAction(advance.events.onUnmount);
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
47
|
+
useUpdateEffect(function () {
|
|
48
|
+
if (open) {
|
|
49
|
+
ctx.doAction(advance.events.onOpen);
|
|
50
|
+
} else {
|
|
51
|
+
ctx.doAction(advance.events.onClose);
|
|
52
|
+
}
|
|
53
|
+
}, [open]);
|
|
54
|
+
var handleOk = useMemoizedFn(function () {
|
|
55
|
+
ctx.doAction(advance.events.onOk);
|
|
56
|
+
});
|
|
57
|
+
var _footer = useCreation(function () {
|
|
58
|
+
var _btnGroup$todoList;
|
|
59
|
+
if (!footer) return {
|
|
60
|
+
footer: null
|
|
61
|
+
};
|
|
62
|
+
if (!(btnGroup !== null && btnGroup !== void 0 && (_btnGroup$todoList = btnGroup.todoList) !== null && _btnGroup$todoList !== void 0 && _btnGroup$todoList.length)) return {};
|
|
63
|
+
return {
|
|
64
|
+
footer: /*#__PURE__*/React.createElement(Footer, null, /*#__PURE__*/React.createElement(LDActions, _extends({}, btnGroup, {
|
|
65
|
+
doAction: function doAction(action) {
|
|
66
|
+
return ctx.doAction(action);
|
|
67
|
+
}
|
|
68
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
69
|
+
onClick: function onClick() {
|
|
70
|
+
return setOpen(false);
|
|
71
|
+
},
|
|
72
|
+
style: {
|
|
73
|
+
marginLeft: 8
|
|
74
|
+
}
|
|
75
|
+
}, cancelText), /*#__PURE__*/React.createElement(Button, {
|
|
76
|
+
type: "primary",
|
|
77
|
+
onClick: handleOk
|
|
78
|
+
}, okText))
|
|
79
|
+
};
|
|
80
|
+
}, [footer, btnGroup]);
|
|
27
81
|
var getTargetDom = useMemoizedFn(function () {
|
|
28
82
|
var _domRef$current;
|
|
29
83
|
return (_domRef$current = domRef.current) === null || _domRef$current === void 0 ? void 0 : _domRef$current.closest('.ant-modal-content');
|
|
@@ -31,22 +85,38 @@ var LCDialog = function LCDialog(_ref) {
|
|
|
31
85
|
useImperativeHandle(apiRef, function () {
|
|
32
86
|
return {
|
|
33
87
|
open: open,
|
|
34
|
-
doOpen:
|
|
35
|
-
|
|
36
|
-
|
|
88
|
+
doOpen: function doOpen() {
|
|
89
|
+
return setOpen(true);
|
|
90
|
+
},
|
|
91
|
+
doClose: function doClose() {
|
|
92
|
+
return setOpen(false);
|
|
93
|
+
}
|
|
37
94
|
};
|
|
38
|
-
});
|
|
95
|
+
}, []);
|
|
39
96
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
40
97
|
id: id,
|
|
41
98
|
displayName: "Dialog",
|
|
42
99
|
getTargetDom: getTargetDom,
|
|
43
100
|
api: apiRef
|
|
44
|
-
}, /*#__PURE__*/React.createElement(Modal, {
|
|
101
|
+
}, /*#__PURE__*/React.createElement(Modal, _extends({
|
|
102
|
+
title: title,
|
|
45
103
|
visible: open,
|
|
46
104
|
getContainer: getContainer,
|
|
105
|
+
width: width,
|
|
106
|
+
mask: mask,
|
|
47
107
|
maskStyle: maskStyle,
|
|
108
|
+
bodyStyle: {
|
|
109
|
+
height: height,
|
|
110
|
+
overflowY: 'auto',
|
|
111
|
+
marginTop: 0
|
|
112
|
+
},
|
|
48
113
|
wrapClassName: classNames(styles['lc-component-dialog-wrapper'], _defineProperty({}, wrapClassName, !!wrapClassName))
|
|
49
|
-
},
|
|
114
|
+
}, _footer, {
|
|
115
|
+
onOk: handleOk,
|
|
116
|
+
onCancel: function onCancel() {
|
|
117
|
+
return setOpen(false);
|
|
118
|
+
}
|
|
119
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
50
120
|
style: {
|
|
51
121
|
height: 0,
|
|
52
122
|
width: 0,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"props": [
|
|
10
10
|
{
|
|
11
11
|
"key": "id",
|
|
12
|
-
"
|
|
12
|
+
"name": "唯一标识",
|
|
13
13
|
"type": "string",
|
|
14
14
|
"disabled": true
|
|
15
15
|
},
|
|
@@ -22,65 +22,88 @@
|
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
"key": "width",
|
|
25
|
-
"name": "
|
|
26
|
-
"
|
|
27
|
-
"
|
|
25
|
+
"name": "对话框宽度",
|
|
26
|
+
"type": "_WidthHeight",
|
|
27
|
+
"options": [
|
|
28
|
+
{
|
|
29
|
+
"label": "px",
|
|
30
|
+
"value": "px"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"label": "%",
|
|
34
|
+
"value": "%"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"label": "vw",
|
|
38
|
+
"value": "vw"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"label": "A",
|
|
42
|
+
"value": "auto"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
28
45
|
"default": "700px"
|
|
29
46
|
},
|
|
30
47
|
{
|
|
31
48
|
"key": "height",
|
|
32
|
-
"name": "
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"default": true
|
|
49
|
+
"name": "内容区高度",
|
|
50
|
+
"type": "_WidthHeight",
|
|
51
|
+
"options": [
|
|
52
|
+
{
|
|
53
|
+
"label": "px",
|
|
54
|
+
"value": "px"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"label": "vh",
|
|
58
|
+
"value": "vh"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"label": "A",
|
|
62
|
+
"value": "auto"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"default": "50vh"
|
|
50
66
|
},
|
|
51
67
|
{
|
|
52
68
|
"key": "defaultOpen",
|
|
53
69
|
"name": "默认显示",
|
|
54
70
|
"desc": "默认是否显示",
|
|
55
|
-
"type": "
|
|
71
|
+
"type": "switch",
|
|
56
72
|
"default": false
|
|
57
73
|
},
|
|
58
74
|
{
|
|
59
75
|
"key": "mask",
|
|
60
76
|
"name": "显示遮罩",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"default": false
|
|
77
|
+
"type": "switch",
|
|
78
|
+
"default": true
|
|
64
79
|
},
|
|
65
80
|
{
|
|
66
|
-
"key": "
|
|
67
|
-
"name": "
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
81
|
+
"key": "okText",
|
|
82
|
+
"name": "确认文字",
|
|
83
|
+
"type": "_I18nInput",
|
|
84
|
+
"default": "确定"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"key": "cancelText",
|
|
88
|
+
"name": "取消文字",
|
|
89
|
+
"type": "_I18nInput",
|
|
90
|
+
"default": "取消"
|
|
71
91
|
},
|
|
72
92
|
{
|
|
73
93
|
"key": "footer",
|
|
74
|
-
"name": "
|
|
94
|
+
"name": "显示footer",
|
|
75
95
|
"desc": "是否显示底部按钮区域",
|
|
76
|
-
"type": "
|
|
96
|
+
"type": "switch",
|
|
77
97
|
"default": true
|
|
78
98
|
},
|
|
79
99
|
{
|
|
80
100
|
"key": "btnGroup",
|
|
81
101
|
"name": "按钮组",
|
|
82
102
|
"desc": "底部按钮区域的按钮组(参考按钮配置)",
|
|
83
|
-
"type": "
|
|
103
|
+
"type": "_ActionsEditor",
|
|
104
|
+
"default": { "display": "button", "max": 2, "moreText": "操作", "todoList": [] },
|
|
105
|
+
"wrapper": "collapse",
|
|
106
|
+
"wrapperProps": { "suppressIcon": true }
|
|
84
107
|
}
|
|
85
108
|
],
|
|
86
109
|
"advance": {
|
|
@@ -89,31 +112,31 @@
|
|
|
89
112
|
"key": "onMount",
|
|
90
113
|
"name": "组件首次渲染时",
|
|
91
114
|
"desc": "在组件首次渲染时,执行方法",
|
|
92
|
-
"func": "(
|
|
115
|
+
"func": "()=>{\n\t\n}"
|
|
93
116
|
},
|
|
94
117
|
{
|
|
95
118
|
"key": "onUnmount",
|
|
96
119
|
"name": "组件卸载时",
|
|
97
120
|
"desc": "在组件卸载时,执行方法。",
|
|
98
|
-
"func": "(
|
|
121
|
+
"func": "()=>{\n\t\n}"
|
|
99
122
|
},
|
|
100
123
|
{
|
|
101
124
|
"key": "onOpen",
|
|
102
125
|
"name": "对话框打开时",
|
|
103
126
|
"desc": "在对话框打开时,执行方法",
|
|
104
|
-
"func": "(
|
|
127
|
+
"func": "()=>{\n\t\n}"
|
|
105
128
|
},
|
|
106
129
|
{
|
|
107
130
|
"key": "onClose",
|
|
108
131
|
"name": "对话框关闭时",
|
|
109
132
|
"desc": "在对话框打开时,执行方法,promise反馈false无法截断关闭",
|
|
110
|
-
"func": "(
|
|
133
|
+
"func": "()=>{\n\t\n}"
|
|
111
134
|
},
|
|
112
135
|
{
|
|
113
|
-
"key": "
|
|
114
|
-
"name": "
|
|
115
|
-
"desc": "
|
|
116
|
-
"func": "(
|
|
136
|
+
"key": "onOk",
|
|
137
|
+
"name": "确定按钮点击",
|
|
138
|
+
"desc": "点击确定按钮时,执行方法",
|
|
139
|
+
"func": "()=>{\n\t\n}"
|
|
117
140
|
}
|
|
118
141
|
]
|
|
119
142
|
}
|
|
@@ -6,12 +6,12 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
6
6
|
var _excluded = ["children", "blocks", "id"];
|
|
7
7
|
import React, { useRef, useEffect } from 'react';
|
|
8
8
|
import { usePrevious, useUpdateLayoutEffect } from 'ahooks';
|
|
9
|
-
import { isEqual,
|
|
9
|
+
import { isEqual, cloneDeep, differenceBy } from 'lodash';
|
|
10
10
|
import { suid } from '@luck-design-biz/base/utils';
|
|
11
|
-
import { useContext,
|
|
12
|
-
import { add, findNodeAndParent } from "../../../engine/tools/dataProcess";
|
|
11
|
+
import { useContext, useGet, addNode } from "../../../engine/provider/ContextProvider";
|
|
13
12
|
import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
|
|
14
13
|
import Index from "./index";
|
|
14
|
+
import { keyBy, forEach } from 'lodash';
|
|
15
15
|
var FunctionDesign = function FunctionDesign(_ref) {
|
|
16
16
|
var children = _ref.children,
|
|
17
17
|
blocks = _ref.blocks,
|
|
@@ -19,38 +19,32 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
19
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
20
|
var ref = useRef(null);
|
|
21
21
|
var ctx = useContext();
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
var current = useGet({
|
|
23
|
+
id: id
|
|
24
|
+
});
|
|
25
25
|
var previousBlocks = usePrevious(cloneDeep(blocks), function (prev, next) {
|
|
26
26
|
return !isEqual(prev, next);
|
|
27
27
|
});
|
|
28
28
|
useUpdateLayoutEffect(function () {
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
gridApi = _ctx$componentMap$get.gridApi;
|
|
44
|
-
gridApi.api.refreshCells({
|
|
45
|
-
columns: ['luck-actions'],
|
|
46
|
-
force: true
|
|
47
|
-
});
|
|
29
|
+
var blocksObj = keyBy(blocks, 'id');
|
|
30
|
+
var previousBlocksObj = keyBy(previousBlocks, 'id');
|
|
31
|
+
forEach(blocksObj, function (value, key) {
|
|
32
|
+
var _value$dataset, _previousBlocksObj$ke, _value$dataset2, _previousBlocksObj$ke2;
|
|
33
|
+
if (((_value$dataset = value.dataset) === null || _value$dataset === void 0 ? void 0 : _value$dataset.code) !== ((_previousBlocksObj$ke = previousBlocksObj[key]) === null || _previousBlocksObj$ke === void 0 || (_previousBlocksObj$ke = _previousBlocksObj$ke.dataset) === null || _previousBlocksObj$ke === void 0 ? void 0 : _previousBlocksObj$ke.code)) ((_value$dataset2 = value.dataset) === null || _value$dataset2 === void 0 ? void 0 : _value$dataset2.code) && ref.current.doQueryOne(key);
|
|
34
|
+
if (value.actionsColumnReset !== ((_previousBlocksObj$ke2 = previousBlocksObj[key]) === null || _previousBlocksObj$ke2 === void 0 ? void 0 : _previousBlocksObj$ke2.actionsColumnReset)) {
|
|
35
|
+
var _ctx$componentMap$get2;
|
|
36
|
+
var _ctx$componentMap$get = (_ctx$componentMap$get2 = ctx.componentMap.get(id)) === null || _ctx$componentMap$get2 === void 0 ? void 0 : _ctx$componentMap$get2.api.getForm().getFormRef(key).formRef.current,
|
|
37
|
+
gridApi = _ctx$componentMap$get.gridApi;
|
|
38
|
+
gridApi.api.refreshCells({
|
|
39
|
+
columns: ['luck-actions'],
|
|
40
|
+
force: true
|
|
41
|
+
});
|
|
42
|
+
}
|
|
48
43
|
});
|
|
49
44
|
}, [JSON.stringify(blocks)]);
|
|
50
45
|
useEffect(function () {
|
|
51
46
|
var cmid = ctx.$subscriber(ctx.topics.COMPONENT_MODIFY).on(function (_ref2) {
|
|
52
47
|
var compId = _ref2.id,
|
|
53
|
-
pageData = _ref2.pageData,
|
|
54
48
|
newValue = _ref2.newValue,
|
|
55
49
|
oldValue = _ref2.oldValue;
|
|
56
50
|
if (compId !== id || !newValue.hasOwnProperty('blocks')) return;
|
|
@@ -60,25 +54,21 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
60
54
|
newItem = _differenceBy2[0];
|
|
61
55
|
if (newItem.type === 'blank') {
|
|
62
56
|
var boxId = "box_".concat(suid());
|
|
63
|
-
|
|
57
|
+
addNode(id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
|
|
64
58
|
buildIn: true,
|
|
65
59
|
formBoxId: newItem.id
|
|
66
60
|
}));
|
|
67
|
-
setPageData(pageData);
|
|
68
61
|
}
|
|
69
62
|
} else if (newValue.blocks.length < oldValue.blocks.length) {
|
|
70
63
|
var _differenceBy3 = differenceBy(oldValue.blocks, newValue.blocks, 'id'),
|
|
71
64
|
_differenceBy4 = _slicedToArray(_differenceBy3, 1),
|
|
72
65
|
removeItem = _differenceBy4[0];
|
|
73
66
|
if (removeItem.type === 'blank') {
|
|
74
|
-
var _findNodeAndParent = findNodeAndParent(id, pageData),
|
|
75
|
-
current = _findNodeAndParent.node;
|
|
76
67
|
var _boxId = current.children.find(function (childId) {
|
|
77
|
-
return current[childId].props.
|
|
68
|
+
return current[childId].props.formBoxId === removeItem.id;
|
|
78
69
|
});
|
|
79
70
|
ctx.$publisher(ctx.topics.COMPONENT_DELETE, {
|
|
80
|
-
id: _boxId
|
|
81
|
-
pageData: pageData
|
|
71
|
+
id: _boxId
|
|
82
72
|
});
|
|
83
73
|
}
|
|
84
74
|
}
|
|
@@ -34,6 +34,7 @@ var Header = function Header(_ref) {
|
|
|
34
34
|
}), children);
|
|
35
35
|
};
|
|
36
36
|
var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
37
|
+
var _ctx$pagePublicResour2;
|
|
37
38
|
var id = _ref2.id,
|
|
38
39
|
parentId = _ref2.parentId,
|
|
39
40
|
width = _ref2.width,
|
|
@@ -74,6 +75,17 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
74
75
|
return {
|
|
75
76
|
getForm: function getForm() {
|
|
76
77
|
return (ref || formRef).current;
|
|
78
|
+
},
|
|
79
|
+
submit: function submit() {
|
|
80
|
+
var _ctx$pagePublicResour;
|
|
81
|
+
var instance = (ref || formRef).current;
|
|
82
|
+
var _ref3 = ((_ctx$pagePublicResour = ctx.pagePublicResource) === null || _ctx$pagePublicResour === void 0 ? void 0 : _ctx$pagePublicResour[id]) || initData || {},
|
|
83
|
+
formMode = _ref3.formMode;
|
|
84
|
+
if (formMode === 'add') {
|
|
85
|
+
instance.onAdd();
|
|
86
|
+
} else if (formMode === 'update') {
|
|
87
|
+
instance.onBatchUpdate();
|
|
88
|
+
}
|
|
77
89
|
}
|
|
78
90
|
};
|
|
79
91
|
});
|
|
@@ -86,9 +98,9 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
86
98
|
};
|
|
87
99
|
return executeCode(ctx, defaultDataSourceFormat, ['defaultValues'], defaultValues);
|
|
88
100
|
});
|
|
89
|
-
var handleDataSourceFormat = useMemoizedFn(function (dataSourceFormat,
|
|
90
|
-
var values =
|
|
91
|
-
submitData =
|
|
101
|
+
var handleDataSourceFormat = useMemoizedFn(function (dataSourceFormat, _ref4) {
|
|
102
|
+
var values = _ref4.values,
|
|
103
|
+
submitData = _ref4.submitData;
|
|
92
104
|
if (isNil(dataSourceFormat)) return submitData;
|
|
93
105
|
return executeCode(ctx, dataSourceFormat, ['values', 'submitData'], values, submitData);
|
|
94
106
|
});
|
|
@@ -122,7 +134,8 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
122
134
|
});
|
|
123
135
|
var renderFormList = useMemoizedFn(function (formConfig) {
|
|
124
136
|
return reduce(blocks, function (result, item) {
|
|
125
|
-
if (includes(['auto', 'grid', 'writer'], item.type) &&
|
|
137
|
+
if (includes(['auto', 'grid', 'writer'], item.type) && includes(item.mode, formConfig.formMode)) {
|
|
138
|
+
var _item$dataset;
|
|
126
139
|
var data = {
|
|
127
140
|
id: item.id,
|
|
128
141
|
order: item.order,
|
|
@@ -130,9 +143,10 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
130
143
|
readOnly: item.readOnly,
|
|
131
144
|
title: item.name,
|
|
132
145
|
header: item.header,
|
|
133
|
-
dataSetKey: item.dataset.code,
|
|
146
|
+
dataSetKey: (_item$dataset = item.dataset) === null || _item$dataset === void 0 ? void 0 : _item$dataset.code,
|
|
134
147
|
serial: item.serial,
|
|
135
148
|
serialEffect: item.serialEffect,
|
|
149
|
+
fields: item.fields,
|
|
136
150
|
defaultDataSourceFormat: function defaultDataSourceFormat(defaultValues) {
|
|
137
151
|
return handleDefaultDataSourceFormat(item.defaultDataSourceFormat, defaultValues);
|
|
138
152
|
},
|
|
@@ -275,7 +289,7 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
275
289
|
renderFormList: renderFormList,
|
|
276
290
|
renderFormExtra: renderFormExtra,
|
|
277
291
|
mainFormLdId: "block_main",
|
|
278
|
-
initData: initData,
|
|
292
|
+
initData: ((_ctx$pagePublicResour2 = ctx.pagePublicResource) === null || _ctx$pagePublicResour2 === void 0 ? void 0 : _ctx$pagePublicResour2[id]) || initData,
|
|
279
293
|
ref: ref || formRef,
|
|
280
294
|
readOnly: readOnly,
|
|
281
295
|
showSaveBtn: showSave,
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
{
|
|
39
39
|
"key": "saveTitle",
|
|
40
40
|
"name": "保存按钮标题",
|
|
41
|
-
"type": "
|
|
41
|
+
"type": "_I18nInput",
|
|
42
42
|
"default": "保存"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
{
|
|
121
121
|
"key": "name",
|
|
122
122
|
"name": "区块名称",
|
|
123
|
-
"type": "
|
|
123
|
+
"type": "_I18nInput"
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
"key": "serial",
|
|
@@ -501,7 +501,7 @@
|
|
|
501
501
|
{
|
|
502
502
|
"key": "zipName",
|
|
503
503
|
"name": "压缩包命名",
|
|
504
|
-
"type": "
|
|
504
|
+
"type": "_I18nInput"
|
|
505
505
|
},
|
|
506
506
|
{
|
|
507
507
|
"key": "uploadUrl",
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
4
|
var _excluded = ["children", "id", "columnRatio"];
|
|
6
5
|
import React, { useEffect } from 'react';
|
|
7
6
|
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
8
7
|
import { drop } from 'lodash';
|
|
9
8
|
import { suid } from '@luck-design-biz/base/utils';
|
|
10
|
-
import { useContext,
|
|
9
|
+
import { useContext, useGet, addNode, deleteNode, modifyNode } from "../../../engine/provider/ContextProvider";
|
|
11
10
|
import Index from "./index";
|
|
12
|
-
import { add, modifyById, deleteById, findNodeAndParent } from "../../../engine/tools/dataProcess";
|
|
13
11
|
import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
|
|
14
12
|
var LayoutFunctionDesign = function LayoutFunctionDesign(_ref) {
|
|
15
13
|
var children = _ref.children,
|
|
@@ -17,29 +15,27 @@ var LayoutFunctionDesign = function LayoutFunctionDesign(_ref) {
|
|
|
17
15
|
columnRatio = _ref.columnRatio,
|
|
18
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
17
|
var ctx = useContext();
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var refreshChild = useMemoizedFn(function (
|
|
24
|
-
var _findNodeAndParent = findNodeAndParent(id, _pageData),
|
|
25
|
-
current = _findNodeAndParent.node;
|
|
18
|
+
var current = useGet({
|
|
19
|
+
id: id
|
|
20
|
+
});
|
|
21
|
+
var refreshChild = useMemoizedFn(function () {
|
|
26
22
|
var ratioArr = columnRatio.split(':');
|
|
27
23
|
drop(current.children, ratioArr.length).forEach(function (boxId) {
|
|
28
|
-
|
|
24
|
+
deleteNode(boxId);
|
|
29
25
|
});
|
|
30
26
|
ratioArr.forEach(function (item, index) {
|
|
31
27
|
var _current$children;
|
|
32
28
|
var ratio = parseInt(item, 10);
|
|
33
29
|
var boxId = (_current$children = current.children) === null || _current$children === void 0 ? void 0 : _current$children[index];
|
|
34
30
|
if (boxId) {
|
|
35
|
-
|
|
31
|
+
modifyNode(current.children[index], _objectSpread(_objectSpread({}, current[boxId].props), {}, {
|
|
36
32
|
style: {
|
|
37
33
|
gridColumn: 'span ' + ratio
|
|
38
34
|
}
|
|
39
35
|
}));
|
|
40
36
|
} else {
|
|
41
37
|
boxId = "box_".concat(suid());
|
|
42
|
-
|
|
38
|
+
addNode(id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
|
|
43
39
|
buildIn: true,
|
|
44
40
|
style: {
|
|
45
41
|
gridColumn: 'span ' + ratio
|
|
@@ -47,23 +43,20 @@ var LayoutFunctionDesign = function LayoutFunctionDesign(_ref) {
|
|
|
47
43
|
}));
|
|
48
44
|
}
|
|
49
45
|
});
|
|
50
|
-
setPageData(_pageData);
|
|
51
46
|
});
|
|
52
47
|
useCreation(function () {
|
|
53
48
|
if (children !== null && children !== void 0 && children.length) return;
|
|
54
49
|
ctx.$subscriber(ctx.topics.COMPONENT_APPEND).once(function (_ref2) {
|
|
55
|
-
var compId = _ref2.id
|
|
56
|
-
pageData = _ref2.pageData;
|
|
50
|
+
var compId = _ref2.id;
|
|
57
51
|
if (compId !== id) return;
|
|
58
|
-
refreshChild(
|
|
52
|
+
refreshChild();
|
|
59
53
|
}).watch();
|
|
60
54
|
}, []);
|
|
61
55
|
useEffect(function () {
|
|
62
56
|
var cmid = ctx.$subscriber(ctx.topics.COMPONENT_MODIFY).on(function (_ref3) {
|
|
63
|
-
var compId = _ref3.id
|
|
64
|
-
pageData = _ref3.pageData;
|
|
57
|
+
var compId = _ref3.id;
|
|
65
58
|
if (compId !== id) return;
|
|
66
|
-
refreshChild(
|
|
59
|
+
refreshChild();
|
|
67
60
|
}).watch();
|
|
68
61
|
return function () {
|
|
69
62
|
return ctx.$unsubscriber(ctx.topics.COMPONENT_MODIFY, cmid);
|