@luck-design-biz/luckda 0.0.25-6 → 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 +4 -2
- package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +4 -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 +4 -2
- package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +4 -2
- 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
|
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import React, { useRef } from 'react';
|
|
3
3
|
import { useMemoizedFn, useCreation } from 'ahooks';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
|
-
import {
|
|
5
|
+
import { useGet } from "../../../engine/provider/ContextProvider";
|
|
6
6
|
import useCanvasRender from "../../../engine/tools/useCanvasRender";
|
|
7
7
|
import Wrapper from "../Wrapper";
|
|
8
8
|
import { LC_BUILDIN_UNIT_KEY } from "../../../constants";
|
|
@@ -15,12 +15,11 @@ var Div = styled.div.withConfig({
|
|
|
15
15
|
});
|
|
16
16
|
var PageContent = function PageContent() {
|
|
17
17
|
var ref = useRef();
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
headercss = _usePageData2$[2];
|
|
18
|
+
var _useGet = useGet([LC_BUILDIN_UNIT_KEY.PAGE_CONTENT, 'props.enableHeader', "".concat(LC_BUILDIN_UNIT_KEY.PAGE_HEADER, ".props.css")]),
|
|
19
|
+
_useGet2 = _slicedToArray(_useGet, 3),
|
|
20
|
+
pagecontent = _useGet2[0],
|
|
21
|
+
enableHeader = _useGet2[1],
|
|
22
|
+
headercss = _useGet2[2];
|
|
24
23
|
var canvas = useCanvasRender(pagecontent);
|
|
25
24
|
var contentStyle = useCreation(function () {
|
|
26
25
|
if (enableHeader) {
|
|
@@ -40,7 +39,7 @@ var PageContent = function PageContent() {
|
|
|
40
39
|
var getTargetDom = useMemoizedFn(function () {
|
|
41
40
|
return ref.current;
|
|
42
41
|
});
|
|
43
|
-
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
42
|
+
return pagecontent ? /*#__PURE__*/React.createElement(Wrapper, {
|
|
44
43
|
id: LC_BUILDIN_UNIT_KEY.PAGE_CONTENT,
|
|
45
44
|
displayName: "PageContent",
|
|
46
45
|
getTargetDom: getTargetDom
|
|
@@ -48,6 +47,6 @@ var PageContent = function PageContent() {
|
|
|
48
47
|
ref: ref,
|
|
49
48
|
$css: pagecontent.props.css,
|
|
50
49
|
style: contentStyle
|
|
51
|
-
}, canvas));
|
|
50
|
+
}, canvas)) : null;
|
|
52
51
|
};
|
|
53
52
|
export default PageContent;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
1
|
import React, { useRef } from 'react';
|
|
3
2
|
import { useMemoizedFn } from 'ahooks';
|
|
4
3
|
import styled from 'styled-components';
|
|
5
|
-
import {
|
|
4
|
+
import { useGet } from "../../../engine/provider/ContextProvider";
|
|
6
5
|
import useCanvasRender from "../../../engine/tools/useCanvasRender";
|
|
7
6
|
import Wrapper from "../Wrapper";
|
|
8
7
|
import { LC_BUILDIN_UNIT_KEY } from "../../../constants";
|
|
@@ -14,9 +13,7 @@ var Div = styled.div.withConfig({
|
|
|
14
13
|
});
|
|
15
14
|
var PageFooter = function PageFooter() {
|
|
16
15
|
var ref = useRef();
|
|
17
|
-
var
|
|
18
|
-
_usePageData2 = _slicedToArray(_usePageData, 1),
|
|
19
|
-
pagefoot = _usePageData2[0];
|
|
16
|
+
var pagefoot = useGet(LC_BUILDIN_UNIT_KEY.PAGE_FOOTER);
|
|
20
17
|
var canvas = useCanvasRender(pagefoot);
|
|
21
18
|
var getTargetDom = useMemoizedFn(function () {
|
|
22
19
|
return ref.current;
|
|
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import React, { useRef } from 'react';
|
|
3
3
|
import { useMemoizedFn } from 'ahooks';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
|
-
import {
|
|
5
|
+
import { useGet } from "../../../engine/provider/ContextProvider";
|
|
6
6
|
import useCanvasRender from "../../../engine/tools/useCanvasRender";
|
|
7
7
|
import Wrapper from "../Wrapper";
|
|
8
8
|
import { LC_BUILDIN_UNIT_KEY } from "../../../constants";
|
|
@@ -14,11 +14,10 @@ var Div = styled.div.withConfig({
|
|
|
14
14
|
});
|
|
15
15
|
var PageHeader = function PageHeader() {
|
|
16
16
|
var ref = useRef();
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
fixed = _usePageData2$[1];
|
|
17
|
+
var _useGet = useGet([LC_BUILDIN_UNIT_KEY.PAGE_HEADER, 'props.fixedHeader']),
|
|
18
|
+
_useGet2 = _slicedToArray(_useGet, 2),
|
|
19
|
+
pageheader = _useGet2[0],
|
|
20
|
+
fixed = _useGet2[1];
|
|
22
21
|
var canvas = useCanvasRender(pageheader);
|
|
23
22
|
var getTargetDom = useMemoizedFn(function () {
|
|
24
23
|
return ref.current;
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
1
|
import { reduce } from 'lodash';
|
|
3
|
-
import {
|
|
2
|
+
import { useGet } from "../../../engine/provider/ContextProvider";
|
|
4
3
|
import useCanvasRender from "../../../engine/tools/useCanvasRender";
|
|
5
4
|
import { LC_BUILDIN_UNIT_KEY_LIST } from "../../../constants";
|
|
6
5
|
var PageModal = function PageModal() {
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
result.children.push(childId);
|
|
6
|
+
var pagemodal = useGet(function (pagedata) {
|
|
7
|
+
return reduce(pagedata === null || pagedata === void 0 ? void 0 : pagedata.children, function (result, childId) {
|
|
8
|
+
if (!LC_BUILDIN_UNIT_KEY_LIST.includes(childId)) {
|
|
9
|
+
result[childId] = pagedata[childId];
|
|
10
|
+
if (!result.children) {
|
|
11
|
+
result.children = [];
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
result.children.push(childId);
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
}, {});
|
|
17
|
+
});
|
|
21
18
|
return useCanvasRender(pagemodal);
|
|
22
19
|
};
|
|
23
20
|
export default PageModal;
|
|
@@ -1,13 +1,12 @@
|
|
|
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"];
|
|
6
5
|
import React from 'react';
|
|
7
6
|
import Index from "./index";
|
|
8
7
|
import { useCreation } from 'ahooks';
|
|
9
8
|
import { suid } from '@luck-design-biz/base/utils';
|
|
10
|
-
import { useContext,
|
|
9
|
+
import { useContext, addNode } from "../../../engine/provider/ContextProvider";
|
|
11
10
|
import { add } from "../../../engine/tools/dataProcess";
|
|
12
11
|
import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
|
|
13
12
|
var FunctionDesign = function FunctionDesign(_ref) {
|
|
@@ -15,20 +14,15 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
15
14
|
id = _ref.id,
|
|
16
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
17
16
|
var ctx = useContext();
|
|
18
|
-
var _usePageData = usePageData(),
|
|
19
|
-
_usePageData2 = _slicedToArray(_usePageData, 2),
|
|
20
|
-
setPageData = _usePageData2[1].setPageData;
|
|
21
17
|
useCreation(function () {
|
|
22
18
|
if (children !== null && children !== void 0 && children.length) return;
|
|
23
19
|
ctx.$subscriber(ctx.topics.COMPONENT_APPEND).once(function (_ref2) {
|
|
24
|
-
var compId = _ref2.id
|
|
25
|
-
pageData = _ref2.pageData;
|
|
20
|
+
var compId = _ref2.id;
|
|
26
21
|
if (compId !== id) return;
|
|
27
22
|
var boxId = "box_".concat(suid());
|
|
28
|
-
|
|
23
|
+
addNode(id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
|
|
29
24
|
buildIn: true
|
|
30
25
|
}));
|
|
31
|
-
setPageData(pageData);
|
|
32
26
|
}).watch();
|
|
33
27
|
}, []);
|
|
34
28
|
return /*#__PURE__*/React.createElement(Index, _extends({
|
|
@@ -1,14 +1,12 @@
|
|
|
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", "display"];
|
|
6
5
|
import React, { useEffect } from 'react';
|
|
7
6
|
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
8
7
|
import { suid } from '@luck-design-biz/base/utils';
|
|
9
|
-
import { useContext,
|
|
8
|
+
import { useContext, useGet, addNode, deleteNode } from "../../../engine/provider/ContextProvider";
|
|
10
9
|
import Index from "./index";
|
|
11
|
-
import { add, deleteById, findNodeAndParent } from "../../../engine/tools/dataProcess";
|
|
12
10
|
import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
|
|
13
11
|
var FunctionDesign = function FunctionDesign(_ref) {
|
|
14
12
|
var children = _ref.children,
|
|
@@ -16,41 +14,36 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
16
14
|
display = _ref.display,
|
|
17
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
16
|
var ctx = useContext();
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var refreshChild = useMemoizedFn(function (
|
|
23
|
-
var _findNodeAndParent = findNodeAndParent(id, _pageData),
|
|
24
|
-
current = _findNodeAndParent.node;
|
|
17
|
+
var current = useGet({
|
|
18
|
+
id: id
|
|
19
|
+
});
|
|
20
|
+
var refreshChild = useMemoizedFn(function () {
|
|
25
21
|
var ratioArr = display.ratio ? display.ratio.split(':') : new Array(display.type.length);
|
|
26
22
|
drop(current.children, ratioArr.length).forEach(function (boxId) {
|
|
27
|
-
|
|
23
|
+
deleteNode(boxId);
|
|
28
24
|
});
|
|
29
25
|
ratioArr.forEach(function (_, index) {
|
|
30
26
|
var _current$children;
|
|
31
27
|
if (!((_current$children = current.children) !== null && _current$children !== void 0 && _current$children[index])) {
|
|
32
|
-
|
|
28
|
+
addNode(id, "box_".concat(suid()), _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
|
|
33
29
|
buildIn: true
|
|
34
30
|
}));
|
|
35
31
|
}
|
|
36
32
|
});
|
|
37
|
-
setPageData(_pageData);
|
|
38
33
|
});
|
|
39
34
|
useCreation(function () {
|
|
40
35
|
if (children !== null && children !== void 0 && children.length) return;
|
|
41
36
|
ctx.$subscriber(ctx.topics.COMPONENT_APPEND).once(function (_ref2) {
|
|
42
|
-
var compId = _ref2.id
|
|
43
|
-
pageData = _ref2.pageData;
|
|
37
|
+
var compId = _ref2.id;
|
|
44
38
|
if (compId !== id) return;
|
|
45
|
-
refreshChild(
|
|
39
|
+
refreshChild();
|
|
46
40
|
}).watch();
|
|
47
41
|
}, []);
|
|
48
42
|
useEffect(function () {
|
|
49
43
|
var cmid = ctx.$subscriber(ctx.topics.COMPONENT_MODIFY).on(function (_ref3) {
|
|
50
|
-
var compId = _ref3.id
|
|
51
|
-
pageData = _ref3.pageData;
|
|
44
|
+
var compId = _ref3.id;
|
|
52
45
|
if (compId !== id) return;
|
|
53
|
-
refreshChild(
|
|
46
|
+
refreshChild();
|
|
54
47
|
}).watch();
|
|
55
48
|
return function () {
|
|
56
49
|
return ctx.$unsubscriber(ctx.topics.COMPONENT_MODIFY, cmid);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
-
import React, { useRef, forwardRef } from 'react';
|
|
4
|
+
import React, { useRef, useImperativeHandle, forwardRef } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useMemoizedFn, useCreation, useUnmount } from 'ahooks';
|
|
7
7
|
import { isNil, isString, keyBy } from 'lodash';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
|
+
import { Modal, recheck } from '@luck-design-biz/base';
|
|
9
10
|
import { useContext, useRemoteSource } from "../../../engine/provider/ContextProvider";
|
|
10
11
|
import Wrapper from "../Wrapper";
|
|
11
12
|
import { LdGrid, LDActions } from "../../../../index";
|
|
@@ -55,8 +56,16 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
55
56
|
var ctx = useContext();
|
|
56
57
|
var _useRemoteSource = useRemoteSource(),
|
|
57
58
|
module = _useRemoteSource.module;
|
|
59
|
+
var apiRef = useRef();
|
|
58
60
|
var wrapperRef = useRef();
|
|
59
61
|
var instanceRef = useRef();
|
|
62
|
+
useImperativeHandle(apiRef, function () {
|
|
63
|
+
return {
|
|
64
|
+
getInstance: function getInstance() {
|
|
65
|
+
return instanceRef.current;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
});
|
|
60
69
|
var _pagination = useCreation(function () {
|
|
61
70
|
return {
|
|
62
71
|
isFlow: !pagination,
|
|
@@ -89,11 +98,28 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
89
98
|
};
|
|
90
99
|
return action;
|
|
91
100
|
}(function (data, rowIndex, params) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
var doAction = function doAction() {
|
|
102
|
+
ctx.doAction(action.actionPool, {
|
|
103
|
+
data: data,
|
|
104
|
+
rowIndex: rowIndex,
|
|
105
|
+
params: params,
|
|
106
|
+
datasetCode: dataset.code
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
if (action.riskLevel === 'danger') {
|
|
110
|
+
Modal.confirm({
|
|
111
|
+
title: "\u786E\u8BA4\u6267\u884C".concat(action.name, "\u884C\u4E3A\u64CD\u4F5C\u5417\uFF1F"),
|
|
112
|
+
onOk: doAction
|
|
113
|
+
});
|
|
114
|
+
} else if (action.riskLevel === 'destroy') {
|
|
115
|
+
recheck({
|
|
116
|
+
title: "\u786E\u8BA4\u6267\u884C".concat(action.name, "\u884C\u4E3A\u64CD\u4F5C\u5417\uFF1F"),
|
|
117
|
+
checkWords: "\u6267\u884C".concat(action.name),
|
|
118
|
+
onOk: doAction
|
|
119
|
+
});
|
|
120
|
+
} else {
|
|
121
|
+
doAction();
|
|
122
|
+
}
|
|
97
123
|
}),
|
|
98
124
|
resource: action.serial,
|
|
99
125
|
style: action.riskLevel === 'default' ? null : {
|
|
@@ -126,14 +152,16 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
126
152
|
data: data,
|
|
127
153
|
isSelected: isSelected,
|
|
128
154
|
SelectedRows: SelectedRows,
|
|
129
|
-
params: params
|
|
155
|
+
params: params,
|
|
156
|
+
datasetCode: dataset.code
|
|
130
157
|
});
|
|
131
158
|
},
|
|
132
159
|
onChange: function onChange(rows, nodes, params) {
|
|
133
160
|
ctx.doAction(advance.events.onRowSelected, {
|
|
134
161
|
rows: rows,
|
|
135
162
|
nodes: nodes,
|
|
136
|
-
params: params
|
|
163
|
+
params: params,
|
|
164
|
+
datasetCode: dataset.code
|
|
137
165
|
});
|
|
138
166
|
}
|
|
139
167
|
}
|
|
@@ -157,7 +185,8 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
157
185
|
onBatchOperationsClick: function onBatchOperationsClick(key, selectedRows) {
|
|
158
186
|
ctx.doAction(action.actionPool, {
|
|
159
187
|
key: key,
|
|
160
|
-
selectedRows: selectedRows
|
|
188
|
+
selectedRows: selectedRows,
|
|
189
|
+
datasetCode: dataset.code
|
|
161
190
|
});
|
|
162
191
|
}
|
|
163
192
|
};
|
|
@@ -202,7 +231,7 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
202
231
|
return !!(topActionGroup !== null && topActionGroup !== void 0 && (_topActionGroup$todoL = topActionGroup.todoList) !== null && _topActionGroup$todoL !== void 0 && _topActionGroup$todoL.length) ? /*#__PURE__*/React.createElement(LDActions, _extends({}, topActionGroup, {
|
|
203
232
|
doAction: function doAction(action) {
|
|
204
233
|
return ctx.doAction(action, {
|
|
205
|
-
|
|
234
|
+
datasetCode: dataset.code
|
|
206
235
|
});
|
|
207
236
|
}
|
|
208
237
|
})) : null;
|
|
@@ -227,31 +256,32 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
227
256
|
};
|
|
228
257
|
});
|
|
229
258
|
var _readFilter = useMemoizedFn(function (params, filters) {
|
|
230
|
-
return ctx.
|
|
259
|
+
return ctx.setPagePublicResource(_defineProperty({}, id, {
|
|
231
260
|
params: params,
|
|
232
261
|
filters: filters
|
|
233
|
-
});
|
|
262
|
+
}));
|
|
234
263
|
});
|
|
235
264
|
var _handleGridReady = useMemoizedFn(function (params, instance) {
|
|
236
|
-
instanceRef.current = instance;
|
|
237
265
|
onGridReady === null || onGridReady === void 0 || onGridReady(params, instance);
|
|
238
266
|
ctx.doAction(advance.events.onMount, {
|
|
239
267
|
params: params,
|
|
240
|
-
|
|
268
|
+
datasetCode: dataset.code
|
|
241
269
|
});
|
|
242
270
|
});
|
|
243
271
|
var _handleRowClick = useMemoizedFn(function (data, rowIndex, params) {
|
|
244
272
|
ctx.doAction(advance.events.onRowClick, {
|
|
245
273
|
data: data,
|
|
246
274
|
rowIndex: rowIndex,
|
|
247
|
-
params: params
|
|
275
|
+
params: params,
|
|
276
|
+
datasetCode: dataset.code
|
|
248
277
|
});
|
|
249
278
|
});
|
|
250
279
|
var _handleRowDoubleClick = useMemoizedFn(function (data, rowIndex, params) {
|
|
251
280
|
ctx.doAction(advance.events.onRowDoubleClick, {
|
|
252
281
|
data: data,
|
|
253
282
|
rowIndex: rowIndex,
|
|
254
|
-
params: params
|
|
283
|
+
params: params,
|
|
284
|
+
datasetCode: dataset.code
|
|
255
285
|
});
|
|
256
286
|
});
|
|
257
287
|
var _handleRowDragged = useMemoizedFn(function (toId, fromId, params) {
|
|
@@ -259,12 +289,14 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
259
289
|
ctx.doAction(advance.events.onRowDragged, {
|
|
260
290
|
toId: toId,
|
|
261
291
|
fromId: fromId,
|
|
262
|
-
params: params
|
|
292
|
+
params: params,
|
|
293
|
+
datasetCode: dataset.code
|
|
263
294
|
});
|
|
264
295
|
} else {
|
|
265
|
-
|
|
296
|
+
var _actionsPool = [['drag', {
|
|
266
297
|
category: 'page-action',
|
|
267
|
-
code:
|
|
298
|
+
code: "function onRowDragged(toId, fromId, params){return {data: { toId, fromId }};}",
|
|
299
|
+
code1: JSON.stringify({
|
|
268
300
|
moduleCode: module.moduleCode,
|
|
269
301
|
datasetCode: dataset.code,
|
|
270
302
|
data: {
|
|
@@ -272,24 +304,32 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
272
304
|
fromId: fromId
|
|
273
305
|
}
|
|
274
306
|
})
|
|
275
|
-
}]]
|
|
307
|
+
}]];
|
|
308
|
+
ctx.doAction(_actionsPool, {
|
|
309
|
+
toId: toId,
|
|
310
|
+
fromId: fromId,
|
|
311
|
+
params: params,
|
|
312
|
+
datasetCode: dataset.code
|
|
313
|
+
});
|
|
276
314
|
}
|
|
277
315
|
});
|
|
278
316
|
var _afterInit = useMemoizedFn(function (res, dispatch, props) {
|
|
279
317
|
ctx.doAction(advance.events.afterInit, {
|
|
280
318
|
res: res,
|
|
281
319
|
dispatch: dispatch,
|
|
282
|
-
props: props
|
|
320
|
+
props: props,
|
|
321
|
+
datasetCode: dataset.code
|
|
283
322
|
});
|
|
284
323
|
});
|
|
285
324
|
var _afterQuery = useMemoizedFn(function (res) {
|
|
286
325
|
ctx.doAction(advance.events.afterQuery, {
|
|
287
|
-
res: res
|
|
326
|
+
res: res,
|
|
327
|
+
datasetCode: dataset.code
|
|
288
328
|
});
|
|
289
329
|
});
|
|
290
330
|
useUnmount(function () {
|
|
291
331
|
ctx.doAction(advance.events.onUnmount, {
|
|
292
|
-
|
|
332
|
+
datasetCode: dataset.code
|
|
293
333
|
});
|
|
294
334
|
});
|
|
295
335
|
var getTargetDom = useMemoizedFn(function () {
|
|
@@ -298,13 +338,15 @@ var LCTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
298
338
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
299
339
|
id: id,
|
|
300
340
|
displayName: "Table",
|
|
301
|
-
getTargetDom: getTargetDom
|
|
341
|
+
getTargetDom: getTargetDom,
|
|
342
|
+
api: apiRef
|
|
302
343
|
}, /*#__PURE__*/React.createElement(LdGrid, _extends({
|
|
303
|
-
ref: ref,
|
|
344
|
+
ref: ref || instanceRef,
|
|
304
345
|
wrapper: wrapperRef,
|
|
305
346
|
wrapperProps: _wrapperProps,
|
|
306
347
|
width: width,
|
|
307
348
|
height: height,
|
|
349
|
+
_loading: ctx.loading,
|
|
308
350
|
bordered: bordered,
|
|
309
351
|
className: classNames(_defineProperty({}, className, !!className)),
|
|
310
352
|
ldId: id,
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"name": "顶部按钮组",
|
|
62
62
|
"type": "_ActionsEditor",
|
|
63
63
|
"default": { "display": "button", "max": 2, "moreText": "操作", "todoList": [] },
|
|
64
|
-
"defaultCode": "function todo(
|
|
64
|
+
"defaultCode": "function todo() { \n \n}",
|
|
65
65
|
"wrapper": "collapse"
|
|
66
66
|
},
|
|
67
67
|
{
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"name": "表格操作项",
|
|
101
101
|
"type": "_ActionsEditor",
|
|
102
102
|
"default": { "display": "text", "max": 2, "moreText": "更多操作", "todoList": [] },
|
|
103
|
-
"defaultCode": "function onActionClick(data) {\n\n}",
|
|
103
|
+
"defaultCode": "function onActionClick(data, rowIndex, params) {\n\n}",
|
|
104
104
|
"wrapper": "collapse",
|
|
105
105
|
"wrapperProps": { "suppressIcon": true }
|
|
106
106
|
}
|
|
@@ -344,13 +344,13 @@
|
|
|
344
344
|
"key": "onMount",
|
|
345
345
|
"name": "组件首次渲染时",
|
|
346
346
|
"desc": "在组件首次渲染时,执行方法",
|
|
347
|
-
"func": "(params
|
|
347
|
+
"func": "(params)=>{\n\t\n}"
|
|
348
348
|
},
|
|
349
349
|
{
|
|
350
350
|
"key": "onUnmount",
|
|
351
351
|
"name": "组件卸载时",
|
|
352
352
|
"desc": "在组件卸载时,执行方法。",
|
|
353
|
-
"func": "(
|
|
353
|
+
"func": "()=>{\n\t\n}"
|
|
354
354
|
},
|
|
355
355
|
{
|
|
356
356
|
"key": "onRowClick",
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["children", "id", "items"];
|
|
6
6
|
import React, { useEffect } from 'react';
|
|
7
7
|
import Index from "./index";
|
|
8
8
|
import { useCreation } from 'ahooks';
|
|
9
9
|
import { suid } from '@luck-design-biz/base/utils';
|
|
10
|
-
import { useContext,
|
|
11
|
-
import { add, findNodeAndParent } from "../../../engine/tools/dataProcess";
|
|
10
|
+
import { useContext, useGet, addNode } from "../../../engine/provider/ContextProvider";
|
|
12
11
|
import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
|
|
13
12
|
var FunctionDesign = function FunctionDesign(_ref) {
|
|
14
13
|
var children = _ref.children,
|
|
@@ -16,27 +15,24 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
16
15
|
items = _ref.items,
|
|
17
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
17
|
var ctx = useContext();
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
var current = useGet({
|
|
19
|
+
id: id
|
|
20
|
+
});
|
|
22
21
|
useCreation(function () {
|
|
23
22
|
if (children !== null && children !== void 0 && children.length) return;
|
|
24
23
|
ctx.$subscriber(ctx.topics.COMPONENT_APPEND).once(function (_ref2) {
|
|
25
|
-
var compId = _ref2.id
|
|
26
|
-
pageData = _ref2.pageData;
|
|
24
|
+
var compId = _ref2.id;
|
|
27
25
|
if (compId !== id) return;
|
|
28
26
|
var boxId = "box_".concat(suid());
|
|
29
|
-
|
|
27
|
+
addNode(id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
|
|
30
28
|
buildIn: true,
|
|
31
29
|
tabId: items[0].id
|
|
32
30
|
}));
|
|
33
|
-
setPageData(pageData);
|
|
34
31
|
}).watch();
|
|
35
32
|
}, []);
|
|
36
33
|
useEffect(function () {
|
|
37
34
|
var cmid = ctx.$subscriber(ctx.topics.COMPONENT_MODIFY).on(function (_ref3) {
|
|
38
35
|
var compId = _ref3.id,
|
|
39
|
-
pageData = _ref3.pageData,
|
|
40
36
|
newValue = _ref3.newValue,
|
|
41
37
|
oldValue = _ref3.oldValue;
|
|
42
38
|
if (compId !== id || !newValue.hasOwnProperty('items')) return;
|
|
@@ -45,23 +41,19 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
45
41
|
_differenceBy2 = _slicedToArray(_differenceBy, 1),
|
|
46
42
|
newItem = _differenceBy2[0];
|
|
47
43
|
var boxId = "box_".concat(suid());
|
|
48
|
-
|
|
44
|
+
addNode(id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
|
|
49
45
|
buildIn: true,
|
|
50
46
|
tabId: newItem.id
|
|
51
47
|
}));
|
|
52
|
-
setPageData(pageData);
|
|
53
48
|
} else if (newValue.items.length < oldValue.items.length) {
|
|
54
49
|
var _differenceBy3 = differenceBy(oldValue.items, newValue.items, 'id'),
|
|
55
50
|
_differenceBy4 = _slicedToArray(_differenceBy3, 1),
|
|
56
51
|
removeItem = _differenceBy4[0];
|
|
57
|
-
var _findNodeAndParent = findNodeAndParent(id, pageData),
|
|
58
|
-
current = _findNodeAndParent.node;
|
|
59
52
|
var _boxId = current.children.find(function (childId) {
|
|
60
53
|
return current[childId].props.tabId === removeItem.id;
|
|
61
54
|
});
|
|
62
55
|
ctx.$publisher(ctx.topics.COMPONENT_DELETE, {
|
|
63
|
-
id: _boxId
|
|
64
|
-
pageData: pageData
|
|
56
|
+
id: _boxId
|
|
65
57
|
});
|
|
66
58
|
}
|
|
67
59
|
}).watch();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["id", "wrapperRef", "className", "dataset", "width", "height", "showLine", "defaultExpandDeep", "actions", "editable", "showRootAdd", "rootAddSetting", "doubleClickExpand", "onDoubleClick", "treeNodeCheckable", "treeNodeDisableCheckbox", "treeNodeDisable", "onTreeNodeRender", "treeNodeIcon", "advance"];
|
|
4
|
+
var _excluded = ["id", "wrapperRef", "className", "dataset", "width", "height", "showLine", "defaultExpandDeep", "actions", "editable", "showRootAdd", "onlyRoot", "rootAddSetting", "doubleClickExpand", "onDoubleClick", "treeNodeCheckable", "treeNodeDisableCheckbox", "treeNodeDisable", "onTreeNodeRender", "treeNodeIcon", "advance"];
|
|
5
5
|
import React, { useRef, useImperativeHandle, forwardRef } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { useMemoizedFn, useCreation } from 'ahooks';
|
|
@@ -27,6 +27,7 @@ var LCTree = function LCTree(_ref) {
|
|
|
27
27
|
actions = _ref.actions,
|
|
28
28
|
editable = _ref.editable,
|
|
29
29
|
showRootAdd = _ref.showRootAdd,
|
|
30
|
+
onlyRoot = _ref.onlyRoot,
|
|
30
31
|
rootAddSetting = _ref.rootAddSetting,
|
|
31
32
|
doubleClickExpand = _ref.doubleClickExpand,
|
|
32
33
|
onDoubleClick = _ref.onDoubleClick,
|
|
@@ -125,6 +126,7 @@ var LCTree = function LCTree(_ref) {
|
|
|
125
126
|
return ctx.doAction(rootAddSetting.actionPool);
|
|
126
127
|
}
|
|
127
128
|
} : null,
|
|
129
|
+
onlyRoot: onlyRoot,
|
|
128
130
|
rightMenus: function rightMenus() {
|
|
129
131
|
return actions.todoList.map(function (action) {
|
|
130
132
|
return {
|
|
@@ -257,6 +259,11 @@ LCTree.propTypes = {
|
|
|
257
259
|
* @type bool
|
|
258
260
|
*/
|
|
259
261
|
showRootAdd: PropTypes.bool,
|
|
262
|
+
/**
|
|
263
|
+
* @name 是否只有唯一一个根节点
|
|
264
|
+
* @type bool
|
|
265
|
+
*/
|
|
266
|
+
onlyRoot: PropTypes.bool,
|
|
260
267
|
/**
|
|
261
268
|
* @name 根节点配置
|
|
262
269
|
* @type object
|
|
@@ -168,6 +168,13 @@
|
|
|
168
168
|
"type": "switch",
|
|
169
169
|
"default": true
|
|
170
170
|
},
|
|
171
|
+
{
|
|
172
|
+
"key": "onlyRoot",
|
|
173
|
+
"name": "根节点唯一",
|
|
174
|
+
"desc": "树组件仅一个根节点,如数据根节点数大于0,则不允许根节点新增",
|
|
175
|
+
"type": "switch",
|
|
176
|
+
"default": false
|
|
177
|
+
},
|
|
171
178
|
{
|
|
172
179
|
"key": "rootAddSetting",
|
|
173
180
|
"name": "根节点配置",
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
2
|
import React, { useEffect } from 'react';
|
|
4
3
|
import { useLatest, useCreation } from 'ahooks';
|
|
5
4
|
import { omit } from 'lodash';
|
|
6
|
-
import { useContext,
|
|
7
|
-
import { findNodeAndParent, getPathNodesById } from "../../engine/tools/dataProcess";
|
|
5
|
+
import { useContext, useGet, getLevelNodes as _getLevelNodes, getSelfAndParent } from "../../engine/provider/ContextProvider";
|
|
8
6
|
import { LC_COMPONENT_UNIT_KEY, LC_COMPONENT_UNIT, RUNTIME } from "../../constants";
|
|
9
7
|
import DragDropWrapper from "../../painter/components/DragDrop/DragDropWrapper";
|
|
10
8
|
var LCWrapper = function LCWrapper(_ref) {
|
|
@@ -14,23 +12,23 @@ var LCWrapper = function LCWrapper(_ref) {
|
|
|
14
12
|
getTargetDom = _ref.getTargetDom,
|
|
15
13
|
api = _ref.api;
|
|
16
14
|
var ctx = useContext();
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
15
|
+
var selfData = useGet({
|
|
16
|
+
id: id
|
|
17
|
+
});
|
|
18
|
+
var _selfData = useLatest(selfData);
|
|
21
19
|
useCreation(function () {
|
|
22
20
|
var meta = displayName ? require("../../engine/meta/".concat(displayName.toLowerCase(), ".props.json")) : {};
|
|
23
21
|
var _api = {
|
|
24
22
|
self: children,
|
|
25
23
|
getSelfData: function getSelfData() {
|
|
26
|
-
return
|
|
24
|
+
return _selfData.current;
|
|
27
25
|
},
|
|
28
26
|
getSelfDom: getTargetDom,
|
|
29
|
-
|
|
30
|
-
return
|
|
27
|
+
getSelfAndParentData: function getSelfAndParentData() {
|
|
28
|
+
return getSelfAndParent(id);
|
|
31
29
|
},
|
|
32
30
|
getLevelNodes: function getLevelNodes() {
|
|
33
|
-
return
|
|
31
|
+
return _getLevelNodes(id);
|
|
34
32
|
}
|
|
35
33
|
};
|
|
36
34
|
ctx._register(id, new Proxy({
|