@luck-design-biz/luckda 0.0.25-1 → 0.0.25-3
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/locales/zh-CN.js +9 -0
- package/es/lowcode/constants/api-url.js +184 -100
- package/es/lowcode/constants/index.js +2 -1
- package/es/lowcode/engine/meta/box.props.default.json +1 -1
- package/es/lowcode/engine/meta/box.props.json +1 -1
- package/es/lowcode/engine/meta/button.props.json +1 -1
- package/es/lowcode/engine/meta/cardlist.props.json +1 -1
- package/es/lowcode/engine/meta/components-list.json +1 -1
- package/es/lowcode/engine/meta/dialog.props.json +1 -1
- package/es/lowcode/engine/meta/drawer.props.json +1 -1
- package/es/lowcode/engine/meta/form.props.default.json +4 -5
- package/es/lowcode/engine/meta/form.props.json +33 -30
- package/es/lowcode/engine/meta/image.props.json +2 -2
- package/es/lowcode/engine/meta/imex.props.json +1 -1
- package/es/lowcode/engine/meta/link.props.json +1 -1
- package/es/lowcode/engine/meta/section.props.default.json +4 -6
- package/es/lowcode/engine/meta/section.props.json +52 -49
- package/es/lowcode/engine/meta/text.props.json +2 -2
- package/es/lowcode/engine/meta/tree.props.json +2 -2
- package/es/lowcode/engine/provider/ContextProvider/index.js +10 -2
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +28 -15
- package/es/lowcode/engine/tools/helper.js +23 -21
- package/es/lowcode/engine/tools/useCanvasRender.js +5 -7
- package/es/lowcode/engine/tools/usePromiseState.js +23 -14
- package/es/lowcode/painter/Design.js +34 -2
- package/es/lowcode/painter/DesignOperator.js +6 -8
- package/es/lowcode/painter/DesignToolbar.js +258 -21
- package/es/lowcode/painter/Panel.js +8 -9
- package/es/lowcode/painter/components/AttrsPanel.js +6 -6
- package/es/lowcode/painter/components/DragDrop/DragDropWrapper.js +5 -2
- package/es/lowcode/painter/components/ListEditor.js +8 -2
- package/es/lowcode/painter/components/field-setting/BatchSetting.js +13 -3
- package/es/lowcode/painter/components/field-setting/SettingUI.js +26 -7
- package/es/lowcode/painter/components/field-setting/index.js +18 -8
- package/es/lowcode/painter/index.js +1 -28
- package/es/lowcode/painter/panel-section/ActionsColumnWidth.js +25 -0
- package/es/lowcode/painter/panel-section/BlockEditor/index.js +7 -4
- package/es/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +4 -3
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +48 -15
- package/es/lowcode/painter/panel-section/FieldsSetting.js +48 -27
- package/es/lowcode/painter/panel-section/I18nInput.js +20 -0
- package/es/lowcode/painter/style/design.less +6 -2
- package/es/lowcode/painter/style/list-editor.less +36 -0
- package/es/lowcode/preview/index.js +17 -4
- package/es/lowcode/view/lc-components/Box/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Box/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Box/meta.json +1 -1
- package/es/lowcode/view/lc-components/Button/meta.json +1 -1
- package/es/lowcode/view/lc-components/CardList/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/CardList/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/CardList/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/CardList/meta.json +1 -1
- package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -4
- package/es/lowcode/view/lc-components/Dialog/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Dialog/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Dialog/meta.json +1 -1
- package/es/lowcode/view/lc-components/Drawer/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Drawer/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Drawer/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Drawer/meta.json +1 -1
- package/es/lowcode/view/lc-components/Form/FunctionDesign.js +66 -4
- package/es/lowcode/view/lc-components/Form/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Form/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Form/index.js +232 -61
- package/es/lowcode/view/lc-components/Form/meta.json +33 -30
- package/es/lowcode/view/lc-components/Iframe/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Iframe/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Iframe/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/ImEx/meta.json +1 -1
- package/es/lowcode/view/lc-components/Image/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Image/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Image/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Image/meta.json +2 -2
- package/es/lowcode/view/lc-components/JSX/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/JSX/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/JSX/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +6 -7
- package/es/lowcode/view/lc-components/Layout/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Link/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Link/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Link/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Link/meta.json +1 -1
- package/es/lowcode/view/lc-components/Section/FunctionDesign.js +31 -2
- package/es/lowcode/view/lc-components/Section/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Section/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Section/index.js +114 -24
- package/es/lowcode/view/lc-components/Section/index.less +7 -0
- package/es/lowcode/view/lc-components/Section/meta.json +48 -49
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +4 -6
- package/es/lowcode/view/lc-components/Split/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Split/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Split/index.js +4 -4
- package/es/lowcode/view/lc-components/Table/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Table/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Table/index.js +7 -6
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +2 -4
- package/es/lowcode/view/lc-components/Text/FunctionDesign.js +1 -0
- package/es/lowcode/view/lc-components/Text/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Text/FunctionPreview.js +1 -0
- package/es/lowcode/view/lc-components/Text/meta.json +2 -2
- package/es/lowcode/view/lc-components/Tree/FunctionLive.js +1 -0
- package/es/lowcode/view/lc-components/Tree/meta.json +2 -2
- package/es/upload/Form/gridForm.js +7 -3
- package/lib/locales/zh-CN.js +9 -0
- package/lib/lowcode/constants/api-url.js +183 -100
- package/lib/lowcode/constants/index.js +3 -2
- package/lib/lowcode/engine/meta/box.props.default.json +1 -1
- package/lib/lowcode/engine/meta/box.props.json +1 -1
- package/lib/lowcode/engine/meta/button.props.json +1 -1
- package/lib/lowcode/engine/meta/cardlist.props.json +1 -1
- package/lib/lowcode/engine/meta/components-list.json +1 -1
- package/lib/lowcode/engine/meta/dialog.props.json +1 -1
- package/lib/lowcode/engine/meta/drawer.props.json +1 -1
- package/lib/lowcode/engine/meta/form.props.default.json +4 -5
- package/lib/lowcode/engine/meta/form.props.json +33 -30
- package/lib/lowcode/engine/meta/image.props.json +2 -2
- package/lib/lowcode/engine/meta/imex.props.json +1 -1
- package/lib/lowcode/engine/meta/link.props.json +1 -1
- package/lib/lowcode/engine/meta/section.props.default.json +4 -6
- package/lib/lowcode/engine/meta/section.props.json +52 -49
- package/lib/lowcode/engine/meta/text.props.json +2 -2
- package/lib/lowcode/engine/meta/tree.props.json +2 -2
- package/lib/lowcode/engine/provider/ContextProvider/index.js +10 -2
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +24 -11
- package/lib/lowcode/engine/tools/helper.js +23 -21
- package/lib/lowcode/engine/tools/useCanvasRender.js +3 -5
- package/lib/lowcode/engine/tools/usePromiseState.js +22 -14
- package/lib/lowcode/painter/Design.js +32 -0
- package/lib/lowcode/painter/DesignOperator.js +5 -7
- package/lib/lowcode/painter/DesignToolbar.js +256 -19
- package/lib/lowcode/painter/Panel.js +7 -8
- package/lib/lowcode/painter/components/AttrsPanel.js +6 -6
- package/lib/lowcode/painter/components/DragDrop/DragDropWrapper.js +5 -2
- package/lib/lowcode/painter/components/ListEditor.js +8 -2
- package/lib/lowcode/painter/components/field-setting/BatchSetting.js +13 -3
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +26 -7
- package/lib/lowcode/painter/components/field-setting/index.js +18 -8
- package/lib/lowcode/painter/index.js +1 -30
- package/lib/lowcode/painter/panel-section/ActionsColumnWidth.js +32 -0
- package/lib/lowcode/painter/panel-section/BlockEditor/index.js +7 -4
- package/lib/lowcode/painter/panel-section/BlocksEditor/BlockEditorItem.js +4 -3
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +47 -13
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +46 -25
- package/lib/lowcode/painter/panel-section/I18nInput.js +27 -0
- package/lib/lowcode/painter/style/design.less +6 -2
- package/lib/lowcode/painter/style/list-editor.less +36 -0
- package/lib/lowcode/preview/index.js +18 -4
- package/lib/lowcode/view/lc-components/Box/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Box/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Box/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Button/meta.json +1 -1
- package/lib/lowcode/view/lc-components/CardList/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/CardList/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/CardList/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/CardList/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -4
- package/lib/lowcode/view/lc-components/Dialog/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Dialog/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Dialog/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Drawer/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Drawer/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Drawer/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Drawer/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +64 -2
- package/lib/lowcode/view/lc-components/Form/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Form/index.js +230 -59
- package/lib/lowcode/view/lc-components/Form/meta.json +33 -30
- package/lib/lowcode/view/lc-components/Iframe/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Iframe/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Iframe/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/ImEx/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/ImEx/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/ImEx/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Image/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Image/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Image/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Image/meta.json +2 -2
- package/lib/lowcode/view/lc-components/JSX/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/JSX/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/JSX/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +5 -6
- package/lib/lowcode/view/lc-components/Layout/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Link/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Link/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Link/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Link/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +31 -2
- package/lib/lowcode/view/lc-components/Section/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Section/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Section/index.js +113 -23
- package/lib/lowcode/view/lc-components/Section/index.less +7 -0
- package/lib/lowcode/view/lc-components/Section/meta.json +48 -49
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +5 -7
- package/lib/lowcode/view/lc-components/Split/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Split/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Split/index.js +4 -4
- package/lib/lowcode/view/lc-components/Table/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Table/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Table/index.js +7 -6
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +4 -6
- package/lib/lowcode/view/lc-components/Text/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Text/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Text/FunctionPreview.js +2 -1
- package/lib/lowcode/view/lc-components/Text/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Tree/FunctionLive.js +2 -1
- package/lib/lowcode/view/lc-components/Tree/meta.json +2 -2
- package/lib/upload/Form/gridForm.js +7 -3
- package/package.json +1 -1
- package/es/lowcode/painter/services/toolbar.js +0 -25
- package/lib/lowcode/painter/services/toolbar.js +0 -32
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
width: 100%;
|
|
8
8
|
.list-item {
|
|
9
9
|
height: 28px;
|
|
10
|
+
position: relative;
|
|
10
11
|
background: #fff;
|
|
11
12
|
border: 1px solid #e5e6e8;
|
|
12
13
|
border-radius: 6px;
|
|
@@ -37,6 +38,41 @@
|
|
|
37
38
|
cursor: pointer;
|
|
38
39
|
}
|
|
39
40
|
}
|
|
41
|
+
|
|
42
|
+
.list-item-bottom-line {
|
|
43
|
+
width: 100%;
|
|
44
|
+
height: 8px;
|
|
45
|
+
border-bottom: solid 1px var(--ant-primary-color);
|
|
46
|
+
position: absolute;
|
|
47
|
+
left: 0;
|
|
48
|
+
bottom: -6px;
|
|
49
|
+
padding-top: 4px;
|
|
50
|
+
display: none;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
z-index: 10;
|
|
55
|
+
}
|
|
56
|
+
.list-item-bottom-line::after {
|
|
57
|
+
content: "+";
|
|
58
|
+
height: 12px;
|
|
59
|
+
margin-top: 4px;
|
|
60
|
+
color: var(--ant-primary-color);
|
|
61
|
+
border: solid 1px var(--ant-primary-color);
|
|
62
|
+
border-radius: 10px;
|
|
63
|
+
font-weight: bold;
|
|
64
|
+
font-size: 14px;
|
|
65
|
+
background-color: white;
|
|
66
|
+
padding: 0 8px;
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
}
|
|
71
|
+
&:hover {
|
|
72
|
+
.list-item-bottom-line {
|
|
73
|
+
display: flex;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
40
76
|
}
|
|
41
77
|
}
|
|
42
78
|
|
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { useUpdateEffect } from 'ahooks';
|
|
2
4
|
import EventBusProvider from "../engine/provider/EventBusProvider";
|
|
3
5
|
import ContextProvider from "../engine/provider/ContextProvider";
|
|
4
6
|
import Page from "../view/Page";
|
|
5
7
|
import { RUNTIME } from "../constants/index";
|
|
6
8
|
var Preview = function Preview(_ref) {
|
|
7
|
-
var code = _ref.code
|
|
8
|
-
|
|
9
|
+
var code = _ref.code,
|
|
10
|
+
userId = _ref.userId;
|
|
11
|
+
var _useState = useState(userId),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
currentKey = _useState2[0],
|
|
14
|
+
setCurrentKey = _useState2[1];
|
|
15
|
+
useUpdateEffect(function () {
|
|
16
|
+
setCurrentKey(void 0);
|
|
17
|
+
setTimeout(function () {
|
|
18
|
+
setCurrentKey(userId);
|
|
19
|
+
});
|
|
20
|
+
}, [userId]);
|
|
21
|
+
return code && currentKey ? /*#__PURE__*/React.createElement(EventBusProvider, {
|
|
9
22
|
runtime: RUNTIME.PREVIEW
|
|
10
23
|
}, /*#__PURE__*/React.createElement(ContextProvider, {
|
|
11
24
|
code: code
|
|
12
|
-
}, /*#__PURE__*/React.createElement(Page, null)));
|
|
25
|
+
}, /*#__PURE__*/React.createElement(Page, null))) : null;
|
|
13
26
|
};
|
|
14
27
|
export default Preview;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["children"];
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import Index from "./index";
|
|
4
5
|
var FunctionPreview = function FunctionPreview(_ref) {
|
|
5
6
|
var children = _ref.children,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["children"];
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import Index from "./index";
|
|
4
5
|
var FunctionPreview = function FunctionPreview(_ref) {
|
|
5
6
|
var children = _ref.children,
|
|
@@ -6,7 +6,6 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
6
6
|
var _excluded = ["id", "children", "className"];
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { useCreation } from 'ahooks';
|
|
9
|
-
import { cloneDeep } from 'lodash';
|
|
10
9
|
import Index from "./index";
|
|
11
10
|
import { suid } from '@luck-design-biz/base/utils';
|
|
12
11
|
import { useContext, usePageData } from "../../../engine/provider/ContextProvider";
|
|
@@ -29,11 +28,10 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
29
28
|
var compId = _ref2.id,
|
|
30
29
|
pageData = _ref2.pageData;
|
|
31
30
|
if (compId !== id) return;
|
|
32
|
-
|
|
33
|
-
add(cloneData, id, "box_".concat(suid()), _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
|
|
31
|
+
add(pageData, id, "box_".concat(suid()), _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
|
|
34
32
|
buildIn: true
|
|
35
33
|
}));
|
|
36
|
-
setPageData(
|
|
34
|
+
setPageData(pageData);
|
|
37
35
|
}).watch();
|
|
38
36
|
}, []);
|
|
39
37
|
return /*#__PURE__*/React.createElement(Index, _extends({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["children"];
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import Index from "./index";
|
|
4
5
|
var FunctionPreview = function FunctionPreview(_ref) {
|
|
5
6
|
var children = _ref.children,
|
|
@@ -2,6 +2,7 @@ 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
4
|
var _excluded = ["children", "className", "show"];
|
|
5
|
+
import React from 'react';
|
|
5
6
|
import Index from "./index";
|
|
6
7
|
import classNames from 'classnames';
|
|
7
8
|
import styles from "./index.less";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["children"];
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import Index from "./index";
|
|
4
5
|
var FunctionPreview = function FunctionPreview(_ref) {
|
|
5
6
|
var children = _ref.children,
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
6
|
var _excluded = ["children", "blocks", "id"];
|
|
5
|
-
import React, { useRef,
|
|
7
|
+
import React, { useRef, useEffect } from 'react';
|
|
6
8
|
import { usePrevious, useUpdateLayoutEffect } from 'ahooks';
|
|
7
|
-
import { isEqual, differenceWith, cloneDeep } from 'lodash';
|
|
9
|
+
import { isEqual, differenceWith, cloneDeep, differenceBy } from 'lodash';
|
|
10
|
+
import { suid } from '@luck-design-biz/base/utils';
|
|
11
|
+
import { useContext, usePageData } from "../../../engine/provider/ContextProvider";
|
|
12
|
+
import { add, findNodeAndParent } from "../../../engine/tools/dataProcess";
|
|
13
|
+
import boxDefaultMeta from "../../../engine/meta/box.props.default.json";
|
|
8
14
|
import Index from "./index";
|
|
9
15
|
var FunctionDesign = function FunctionDesign(_ref) {
|
|
10
16
|
var children = _ref.children,
|
|
@@ -12,19 +18,75 @@ var FunctionDesign = function FunctionDesign(_ref) {
|
|
|
12
18
|
id = _ref.id,
|
|
13
19
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
14
20
|
var ref = useRef(null);
|
|
21
|
+
var ctx = useContext();
|
|
22
|
+
var _usePageData = usePageData(),
|
|
23
|
+
_usePageData2 = _slicedToArray(_usePageData, 2),
|
|
24
|
+
setPageData = _usePageData2[1].setPageData;
|
|
15
25
|
var previousBlocks = usePrevious(cloneDeep(blocks), function (prev, next) {
|
|
16
26
|
return !isEqual(prev, next);
|
|
17
27
|
});
|
|
18
28
|
useUpdateLayoutEffect(function () {
|
|
19
|
-
var
|
|
29
|
+
var diffDataset = differenceWith(blocks, previousBlocks, function (arrVal, othVal) {
|
|
20
30
|
var _arrVal$dataset, _othVal$dataset;
|
|
21
31
|
return arrVal.id === othVal.id && ((_arrVal$dataset = arrVal.dataset) === null || _arrVal$dataset === void 0 ? void 0 : _arrVal$dataset.code) === ((_othVal$dataset = othVal.dataset) === null || _othVal$dataset === void 0 ? void 0 : _othVal$dataset.code);
|
|
22
32
|
});
|
|
23
|
-
|
|
33
|
+
diffDataset.forEach(function (df) {
|
|
24
34
|
var _df$dataset;
|
|
25
35
|
((_df$dataset = df.dataset) === null || _df$dataset === void 0 ? void 0 : _df$dataset.code) && ref.current.doQueryOne(df.id);
|
|
26
36
|
});
|
|
37
|
+
var diffColReset = differenceWith(blocks, previousBlocks, function (arrVal, othVal) {
|
|
38
|
+
return arrVal.id === othVal.id && arrVal.actionsColumnReset === othVal.actionsColumnReset;
|
|
39
|
+
});
|
|
40
|
+
diffColReset.forEach(function (df) {
|
|
41
|
+
var _ctx$componentMap$get2;
|
|
42
|
+
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(df.id).formRef.current,
|
|
43
|
+
gridApi = _ctx$componentMap$get.gridApi;
|
|
44
|
+
gridApi.api.refreshCells({
|
|
45
|
+
columns: ['luck-actions'],
|
|
46
|
+
force: true
|
|
47
|
+
});
|
|
48
|
+
});
|
|
27
49
|
}, [JSON.stringify(blocks)]);
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
var cmid = ctx.$subscriber(ctx.topics.COMPONENT_MODIFY).on(function (_ref2) {
|
|
52
|
+
var compId = _ref2.id,
|
|
53
|
+
pageData = _ref2.pageData,
|
|
54
|
+
newValue = _ref2.newValue,
|
|
55
|
+
oldValue = _ref2.oldValue;
|
|
56
|
+
if (compId !== id || !newValue.hasOwnProperty('blocks')) return;
|
|
57
|
+
if (newValue.blocks.length > oldValue.blocks.length) {
|
|
58
|
+
var _differenceBy = differenceBy(newValue.blocks, oldValue.blocks, 'id'),
|
|
59
|
+
_differenceBy2 = _slicedToArray(_differenceBy, 1),
|
|
60
|
+
newItem = _differenceBy2[0];
|
|
61
|
+
if (newItem.type === 'blank') {
|
|
62
|
+
var boxId = "box_".concat(suid());
|
|
63
|
+
add(pageData, id, boxId, _objectSpread(_objectSpread({}, boxDefaultMeta), {}, {
|
|
64
|
+
buildIn: true,
|
|
65
|
+
formBoxId: newItem.id
|
|
66
|
+
}));
|
|
67
|
+
setPageData(pageData);
|
|
68
|
+
}
|
|
69
|
+
} else if (newValue.blocks.length < oldValue.blocks.length) {
|
|
70
|
+
var _differenceBy3 = differenceBy(oldValue.blocks, newValue.blocks, 'id'),
|
|
71
|
+
_differenceBy4 = _slicedToArray(_differenceBy3, 1),
|
|
72
|
+
removeItem = _differenceBy4[0];
|
|
73
|
+
if (removeItem.type === 'blank') {
|
|
74
|
+
var _findNodeAndParent = findNodeAndParent(id, pageData),
|
|
75
|
+
current = _findNodeAndParent.node;
|
|
76
|
+
var _boxId = current.children.find(function (childId) {
|
|
77
|
+
return current[childId].props.tabId === removeItem.id;
|
|
78
|
+
});
|
|
79
|
+
ctx.$publisher(ctx.topics.COMPONENT_DELETE, {
|
|
80
|
+
id: _boxId,
|
|
81
|
+
pageData: pageData
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}).watch();
|
|
86
|
+
return function () {
|
|
87
|
+
return ctx.$unsubscriber(ctx.topics.COMPONENT_MODIFY, cmid);
|
|
88
|
+
};
|
|
89
|
+
}, []);
|
|
28
90
|
return /*#__PURE__*/React.createElement(Index, _extends({}, props, {
|
|
29
91
|
id: id,
|
|
30
92
|
blocks: blocks,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
var _excluded = ["children"];
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import Index from "./index";
|
|
4
5
|
var FunctionPreview = function FunctionPreview(_ref) {
|
|
5
6
|
var children = _ref.children,
|