@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
|
@@ -1,26 +1,35 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
1
|
import { useRef, useCallback } from 'react';
|
|
3
|
-
import {
|
|
2
|
+
import { useHistoryTravel, useUpdateLayoutEffect } from 'ahooks';
|
|
3
|
+
import { isEqual } from 'lodash';
|
|
4
4
|
var usePromiseState = function usePromiseState(initialState) {
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
var _useHistoryTravel = useHistoryTravel(initialState),
|
|
6
|
+
value = _useHistoryTravel.value,
|
|
7
|
+
setValue = _useHistoryTravel.setValue,
|
|
8
|
+
backLength = _useHistoryTravel.backLength,
|
|
9
|
+
forwardLength = _useHistoryTravel.forwardLength,
|
|
10
|
+
back = _useHistoryTravel.back,
|
|
11
|
+
forward = _useHistoryTravel.forward;
|
|
10
12
|
var promiseRef = useRef(null);
|
|
11
|
-
var setStatePromise = useCallback(function (
|
|
13
|
+
var setStatePromise = useCallback(function (_value) {
|
|
12
14
|
return new Promise(function (resolve) {
|
|
13
15
|
promiseRef.current = resolve;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
var _valStr = JSON.stringify(_value);
|
|
17
|
+
if (!isEqual(value, _valStr)) {
|
|
18
|
+
setValue(_valStr);
|
|
19
|
+
}
|
|
16
20
|
});
|
|
17
21
|
}, []);
|
|
18
|
-
|
|
22
|
+
useUpdateLayoutEffect(function () {
|
|
19
23
|
if (promiseRef.current) {
|
|
20
|
-
promiseRef.current(
|
|
24
|
+
promiseRef.current(JSON.parse(value));
|
|
21
25
|
promiseRef.current = null;
|
|
22
26
|
}
|
|
23
|
-
}, [
|
|
24
|
-
return [
|
|
27
|
+
}, [value]);
|
|
28
|
+
return [JSON.parse(value), setStatePromise, {
|
|
29
|
+
backLength: backLength - 1,
|
|
30
|
+
forwardLength: forwardLength,
|
|
31
|
+
back: back,
|
|
32
|
+
forward: forward
|
|
33
|
+
}];
|
|
25
34
|
};
|
|
26
35
|
export default usePromiseState;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import React, { useRef, useState } from 'react';
|
|
3
|
-
import { RawIntlProvider, getLocale, getIntl, localeInfo } from 'umi';
|
|
2
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
3
|
+
import { RawIntlProvider, getLocale, getIntl, localeInfo, history } from 'umi';
|
|
4
4
|
import { useMemoizedFn } from 'ahooks';
|
|
5
5
|
import moment from 'moment';
|
|
6
6
|
import { ConfigProvider } from 'luck-design/antd';
|
|
7
|
+
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
8
|
+
import { useRemoteSource } from "../engine/provider/ContextProvider";
|
|
7
9
|
import DesignToolbar from "./DesignToolbar";
|
|
8
10
|
import DesignOperator from "./DesignOperator";
|
|
9
11
|
import Page from "../view/Page";
|
|
@@ -11,6 +13,7 @@ import styles from "./style/design.less";
|
|
|
11
13
|
var Design = function Design() {
|
|
12
14
|
var _localeInfo$locale;
|
|
13
15
|
var simulatorRef = useRef(null);
|
|
16
|
+
var remoteSource = useRemoteSource();
|
|
14
17
|
var _useState = useState(function () {
|
|
15
18
|
return getLocale();
|
|
16
19
|
}),
|
|
@@ -23,6 +26,35 @@ var Design = function Design() {
|
|
|
23
26
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
27
|
intl = _useState4[0],
|
|
25
28
|
setIntl = _useState4[1];
|
|
29
|
+
var unblock = useMemoizedFn(function () {
|
|
30
|
+
if (remoteSource.backLength > 0) return confirm("".concat(formatMessage({
|
|
31
|
+
id: 'app.base.operate.comfire.leave',
|
|
32
|
+
label: '离开当前页面?'
|
|
33
|
+
}), "\n").concat(formatMessage({
|
|
34
|
+
id: 'app.base.operate.comfire.message.leave',
|
|
35
|
+
label: '系统可能不会保存您所做的更改。'
|
|
36
|
+
})));
|
|
37
|
+
return true;
|
|
38
|
+
});
|
|
39
|
+
var handleBeforeUnload = useMemoizedFn(function (event) {
|
|
40
|
+
if (remoteSource.backLength > 0) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
event.returnValue = null;
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
useEffect(function () {
|
|
47
|
+
window.addEventListener('beforeunload', handleBeforeUnload);
|
|
48
|
+
history.block(function () {
|
|
49
|
+
return unblock();
|
|
50
|
+
});
|
|
51
|
+
return function () {
|
|
52
|
+
window.removeEventListener('beforeunload', handleBeforeUnload);
|
|
53
|
+
history.block(function () {
|
|
54
|
+
return true;
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}, []);
|
|
26
58
|
var handleLangChange = useMemoizedFn(function (_locale) {
|
|
27
59
|
if (moment !== null && moment !== void 0 && moment.locale) {
|
|
28
60
|
var _localeInfo$_locale;
|
|
@@ -3,7 +3,7 @@ import React, { useRef, useEffect, useState } from 'react';
|
|
|
3
3
|
import { last, initial } from 'lodash';
|
|
4
4
|
import { useEventListener, useSetState, useMemoizedFn, useCreation, useSize, useLatest } from 'ahooks';
|
|
5
5
|
import { Icon, Dropdown, message } from 'luck-design/antd';
|
|
6
|
-
import {
|
|
6
|
+
import { reverse } from 'lodash';
|
|
7
7
|
import { suid } from '@luck-design-biz/base/utils';
|
|
8
8
|
import { useContext, usePageData } from "../engine/provider/ContextProvider";
|
|
9
9
|
import { add, deleteById } from "../engine/tools/dataProcess";
|
|
@@ -71,21 +71,20 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
71
71
|
var addComponent = useMemoizedFn(function (data, targetId) {
|
|
72
72
|
var json = require("../engine/meta/".concat(data.component.toLowerCase(), ".props.default.json"));
|
|
73
73
|
var _id = "".concat(data.component.toLowerCase(), "_").concat(suid());
|
|
74
|
-
|
|
75
|
-
add(cloneData, targetId, _id, json);
|
|
74
|
+
add(pageData, targetId, _id, json);
|
|
76
75
|
context.$subscriber(context.topics.COMPONENT_MOUNT).once(function (_ref3) {
|
|
77
76
|
var mountCompId = _ref3.id;
|
|
78
77
|
if (mountCompId === _id) {
|
|
79
78
|
context.$publisher(context.topics.COMPONENT_APPEND, {
|
|
80
79
|
id: _id,
|
|
81
|
-
pageData:
|
|
80
|
+
pageData: pageData
|
|
82
81
|
});
|
|
83
82
|
context.$publisher(context.topics.COMPONENT_ACTIVE, {
|
|
84
83
|
id: _id
|
|
85
84
|
});
|
|
86
85
|
}
|
|
87
86
|
}).watch();
|
|
88
|
-
setPageData(
|
|
87
|
+
setPageData(pageData);
|
|
89
88
|
});
|
|
90
89
|
var acticeProps = useCreation(function () {
|
|
91
90
|
if (!operatorId.selector) return null;
|
|
@@ -231,9 +230,8 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
231
230
|
if (lastSelectorId.current === id) {
|
|
232
231
|
context.$publisher(context.topics.COMPONENT_ACTIVE, null);
|
|
233
232
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
setPageData(cloneData);
|
|
233
|
+
deleteById(pageData, id);
|
|
234
|
+
setPageData(pageData);
|
|
237
235
|
});
|
|
238
236
|
return function () {
|
|
239
237
|
context.$unsubscriber(context.topics.COMPONENT_SETTING_CLICK, csid);
|
|
@@ -1,24 +1,39 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
1
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
6
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
|
+
var _excluded = ["key", "label"];
|
|
3
9
|
import React, { useRef, useEffect, useState } from 'react';
|
|
10
|
+
import { useLocation } from 'umi';
|
|
4
11
|
import classNames from 'classnames';
|
|
5
|
-
import { useMemoizedFn } from 'ahooks';
|
|
6
|
-
import { Select, Button, Icon, Divider, Modal, message } from 'luck-design/antd';
|
|
12
|
+
import { useMemoizedFn, useRequest, useDebounceFn, useCookieState } from 'ahooks';
|
|
13
|
+
import { Select, Button, Icon, Divider, Modal, message, Drawer } from 'luck-design/antd';
|
|
7
14
|
import { showPop, formatMessage } from '@luck-design-biz/base/utils';
|
|
8
15
|
import { useContext, usePageData, useRemoteSource } from "../engine/provider/ContextProvider";
|
|
9
16
|
import JsonEditor from "../painter/components/code-editor/JsonEditor";
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
17
|
+
import Preview from "../preview";
|
|
18
|
+
import { LC_BUILDIN_UNIT_KEY, COOKIE_VIRTUAL_ACCOUNT_KEY } from "../constants";
|
|
12
19
|
import styles from "./style/design.less";
|
|
20
|
+
import { fetchClearCache, fetchUpdatePageData } from "../constants/api-url";
|
|
21
|
+
import { readAllUser } from '@luck-design-biz/base/lib/sys/services';
|
|
13
22
|
var DesignToolbar = function DesignToolbar(_ref) {
|
|
14
23
|
var locale = _ref.locale,
|
|
15
24
|
onLangChange = _ref.onLangChange;
|
|
25
|
+
var location = useLocation();
|
|
16
26
|
var editorRef = useRef();
|
|
17
27
|
var context = useContext();
|
|
18
28
|
var _usePageData = usePageData(),
|
|
19
29
|
_usePageData2 = _slicedToArray(_usePageData, 2),
|
|
20
30
|
pageData = _usePageData2[0],
|
|
21
|
-
|
|
31
|
+
_usePageData2$ = _usePageData2[1],
|
|
32
|
+
setPageData = _usePageData2$.setPageData,
|
|
33
|
+
back = _usePageData2$.back,
|
|
34
|
+
forward = _usePageData2$.forward,
|
|
35
|
+
backLength = _usePageData2$.backLength,
|
|
36
|
+
forwardLength = _usePageData2$.forwardLength;
|
|
22
37
|
var _ref2 = useRemoteSource() || {},
|
|
23
38
|
pageinfo = _ref2.pageinfo;
|
|
24
39
|
var _useState = useState(null),
|
|
@@ -33,6 +48,29 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
33
48
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
34
49
|
show = _useState6[0],
|
|
35
50
|
setShow = _useState6[1];
|
|
51
|
+
var _useState7 = useState(false),
|
|
52
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
53
|
+
showPreview = _useState8[0],
|
|
54
|
+
setShowPreview = _useState8[1];
|
|
55
|
+
var _useState9 = useState([]),
|
|
56
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
57
|
+
userOptions = _useState10[0],
|
|
58
|
+
setUserOptions = _useState10[1];
|
|
59
|
+
var _useCookieState = useCookieState(COOKIE_VIRTUAL_ACCOUNT_KEY),
|
|
60
|
+
_useCookieState2 = _slicedToArray(_useCookieState, 2),
|
|
61
|
+
userId = _useCookieState2[0],
|
|
62
|
+
setUserId = _useCookieState2[1];
|
|
63
|
+
var _useRequest = useRequest(fetchClearCache, {
|
|
64
|
+
manual: true
|
|
65
|
+
}),
|
|
66
|
+
clearCacheLoading = _useRequest.loading,
|
|
67
|
+
runClearCache = _useRequest.run;
|
|
68
|
+
var _useRequest2 = useRequest(fetchUpdatePageData, {
|
|
69
|
+
manual: true,
|
|
70
|
+
debounceWait: 300
|
|
71
|
+
}),
|
|
72
|
+
updatePageDataLoading = _useRequest2.loading,
|
|
73
|
+
runAsync = _useRequest2.runAsync;
|
|
36
74
|
useEffect(function () {
|
|
37
75
|
var topicId = context.$subscriber(context.topics.LANG_SETTING_SELECT).on(function (_ref3) {
|
|
38
76
|
var _langList = _ref3.langList;
|
|
@@ -42,20 +80,57 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
42
80
|
return context.$unsubscriber(context.topics.LANG_SETTING_SELECT, topicId);
|
|
43
81
|
};
|
|
44
82
|
}, []);
|
|
45
|
-
|
|
83
|
+
useEffect(function () {
|
|
84
|
+
if (!showPreview) {
|
|
85
|
+
setUserId(void 0);
|
|
86
|
+
}
|
|
87
|
+
}, [showPreview]);
|
|
88
|
+
var handleSave = useMemoizedFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
46
89
|
var _pageinfo$relationshi;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
90
|
+
var _yield$runAsync, code;
|
|
91
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
92
|
+
while (1) switch (_context.prev = _context.next) {
|
|
93
|
+
case 0:
|
|
94
|
+
_context.next = 2;
|
|
95
|
+
return runAsync({
|
|
96
|
+
pageData: JSON.stringify(pageData),
|
|
97
|
+
pageCode: pageinfo === null || pageinfo === void 0 || (_pageinfo$relationshi = pageinfo.relationship) === null || _pageinfo$relationshi === void 0 ? void 0 : _pageinfo$relationshi.pageCode
|
|
98
|
+
});
|
|
99
|
+
case 2:
|
|
100
|
+
_yield$runAsync = _context.sent;
|
|
101
|
+
code = _yield$runAsync.code;
|
|
102
|
+
if (code === 1) {
|
|
103
|
+
showPop(formatMessage({
|
|
104
|
+
id: 'app.base.tip.operate.success'
|
|
105
|
+
}), null, 'success');
|
|
106
|
+
}
|
|
107
|
+
case 5:
|
|
108
|
+
case "end":
|
|
109
|
+
return _context.stop();
|
|
110
|
+
}
|
|
111
|
+
}, _callee);
|
|
112
|
+
})), []);
|
|
113
|
+
var handleClearCache = useMemoizedFn(function () {
|
|
114
|
+
Modal.confirm({
|
|
115
|
+
title: formatMessage({
|
|
116
|
+
id: 'luckda.lowcode.design.toolbar.clear.tip',
|
|
117
|
+
label: '清除提示'
|
|
118
|
+
}),
|
|
119
|
+
content: formatMessage({
|
|
120
|
+
id: 'luckda.lowcode.design.toolbar.clear',
|
|
121
|
+
label: '确定清除当前页面及模块缓存么?'
|
|
122
|
+
}),
|
|
123
|
+
getContainer: function getContainer() {
|
|
124
|
+
return document.getElementById('lc-design-workspace');
|
|
125
|
+
},
|
|
126
|
+
zIndex: 3000,
|
|
127
|
+
onOk: function onOk() {
|
|
128
|
+
return runClearCache({
|
|
129
|
+
moduleCode: pageinfo.relationship.moduleCode
|
|
130
|
+
});
|
|
56
131
|
}
|
|
57
132
|
});
|
|
58
|
-
}
|
|
133
|
+
});
|
|
59
134
|
var handleOk = useMemoizedFn(function () {
|
|
60
135
|
var code = editorRef.current.editor.getValue();
|
|
61
136
|
try {
|
|
@@ -69,6 +144,43 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
69
144
|
}));
|
|
70
145
|
}
|
|
71
146
|
});
|
|
147
|
+
var _useDebounceFn = useDebounceFn( /*#__PURE__*/function () {
|
|
148
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(value) {
|
|
149
|
+
var _yield$readAllUser, code, list, detail;
|
|
150
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
151
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
152
|
+
case 0:
|
|
153
|
+
_context2.next = 2;
|
|
154
|
+
return readAllUser({
|
|
155
|
+
sname: value
|
|
156
|
+
});
|
|
157
|
+
case 2:
|
|
158
|
+
_yield$readAllUser = _context2.sent;
|
|
159
|
+
code = _yield$readAllUser.code;
|
|
160
|
+
list = _yield$readAllUser.list;
|
|
161
|
+
detail = _yield$readAllUser.detail;
|
|
162
|
+
if (code === 1) {
|
|
163
|
+
setUserOptions(list.map(function (id) {
|
|
164
|
+
var item = detail[id];
|
|
165
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
166
|
+
key: "".concat(item.indocno),
|
|
167
|
+
label: item.sname
|
|
168
|
+
});
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
case 7:
|
|
172
|
+
case "end":
|
|
173
|
+
return _context2.stop();
|
|
174
|
+
}
|
|
175
|
+
}, _callee2);
|
|
176
|
+
}));
|
|
177
|
+
return function (_x) {
|
|
178
|
+
return _ref5.apply(this, arguments);
|
|
179
|
+
};
|
|
180
|
+
}(), {
|
|
181
|
+
wait: 500
|
|
182
|
+
}),
|
|
183
|
+
handleSearch = _useDebounceFn.run;
|
|
72
184
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
73
185
|
className: styles['lc-painter-design-toolbar']
|
|
74
186
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
@@ -100,6 +212,35 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
100
212
|
type: "mobile"
|
|
101
213
|
})), /*#__PURE__*/React.createElement(Divider, {
|
|
102
214
|
type: "vertical"
|
|
215
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
216
|
+
className: classNames(styles['toolbar-item'], _defineProperty({}, styles.disabled, backLength < 1)),
|
|
217
|
+
onClick: function onClick() {
|
|
218
|
+
return backLength > 0 && back();
|
|
219
|
+
}
|
|
220
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
221
|
+
viewBox: "0 0 1024 1024",
|
|
222
|
+
width: "20",
|
|
223
|
+
height: "20",
|
|
224
|
+
fill: "currentColor",
|
|
225
|
+
style: {
|
|
226
|
+
transform: 'rotateY(180deg)'
|
|
227
|
+
}
|
|
228
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
229
|
+
d: "M946.8 420L651.9 125.1c-19.5-19.5-52.7-5.7-52.7 21.8v174c-79.3-1.8-501.8 14.9-532.3 569.6-0.9 17.2 22.1 24.3 30.6 9.3C255 621 396.6 553.3 599.1 561.5v175.2c0 27.5 33.3 41.3 52.8 21.9l294.8-294.9c12.1-12.1 12.1-31.6 0.1-43.7z"
|
|
230
|
+
}))), /*#__PURE__*/React.createElement("span", {
|
|
231
|
+
className: classNames(styles['toolbar-item'], _defineProperty({}, styles.disabled, forwardLength < 1)),
|
|
232
|
+
onClick: function onClick() {
|
|
233
|
+
return forwardLength > 0 && forward();
|
|
234
|
+
}
|
|
235
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
236
|
+
viewBox: "0 0 1024 1024",
|
|
237
|
+
width: "20",
|
|
238
|
+
height: "20",
|
|
239
|
+
fill: "currentColor"
|
|
240
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
241
|
+
d: "M946.8 420L651.9 125.1c-19.5-19.5-52.7-5.7-52.7 21.8v174c-79.3-1.8-501.8 14.9-532.3 569.6-0.9 17.2 22.1 24.3 30.6 9.3C255 621 396.6 553.3 599.1 561.5v175.2c0 27.5 33.3 41.3 52.8 21.9l294.8-294.9c12.1-12.1 12.1-31.6 0.1-43.7z"
|
|
242
|
+
}))), /*#__PURE__*/React.createElement(Divider, {
|
|
243
|
+
type: "vertical"
|
|
103
244
|
}), /*#__PURE__*/React.createElement("span", {
|
|
104
245
|
style: {
|
|
105
246
|
width: 'auto',
|
|
@@ -111,15 +252,35 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
111
252
|
id: LC_BUILDIN_UNIT_KEY.PAGE_ROOT
|
|
112
253
|
});
|
|
113
254
|
}
|
|
114
|
-
},
|
|
255
|
+
}, formatMessage({
|
|
256
|
+
id: 'luckda.lowcode.design.toolbar.pageAttrs',
|
|
257
|
+
label: '页面属性'
|
|
258
|
+
})), /*#__PURE__*/React.createElement(Divider, {
|
|
115
259
|
type: "vertical"
|
|
116
260
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
117
261
|
size: "small",
|
|
118
262
|
style: {
|
|
119
263
|
fontSize: 12,
|
|
120
264
|
margin: '0 4px 0 2px'
|
|
265
|
+
},
|
|
266
|
+
loading: clearCacheLoading,
|
|
267
|
+
onClick: handleClearCache
|
|
268
|
+
}, formatMessage({
|
|
269
|
+
id: 'luckda.lowcode.design.toolbar.clear',
|
|
270
|
+
label: '清除缓存'
|
|
271
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
272
|
+
size: "small",
|
|
273
|
+
style: {
|
|
274
|
+
fontSize: 12,
|
|
275
|
+
margin: '0 4px 0 2px'
|
|
276
|
+
},
|
|
277
|
+
onClick: function onClick() {
|
|
278
|
+
return setShowPreview(true);
|
|
121
279
|
}
|
|
122
|
-
},
|
|
280
|
+
}, formatMessage({
|
|
281
|
+
id: 'luckda.lowcode.design.toolbar.preview',
|
|
282
|
+
label: '预览'
|
|
283
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
|
123
284
|
size: "small",
|
|
124
285
|
type: "primary",
|
|
125
286
|
style: {
|
|
@@ -132,7 +293,10 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
132
293
|
padding: '0 7px'
|
|
133
294
|
},
|
|
134
295
|
onClick: handleSave
|
|
135
|
-
},
|
|
296
|
+
}, formatMessage({
|
|
297
|
+
id: 'luckda.lowcode.design.toolbar.save',
|
|
298
|
+
label: '保存'
|
|
299
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
136
300
|
style: {
|
|
137
301
|
display: 'inline-block'
|
|
138
302
|
},
|
|
@@ -140,7 +304,7 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
140
304
|
return setShow(true);
|
|
141
305
|
}
|
|
142
306
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
143
|
-
type:
|
|
307
|
+
type: updatePageDataLoading ? 'loading' : 'eye'
|
|
144
308
|
})))), /*#__PURE__*/React.createElement(Modal, {
|
|
145
309
|
visible: show,
|
|
146
310
|
width: 1024,
|
|
@@ -157,6 +321,79 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
157
321
|
}
|
|
158
322
|
}, /*#__PURE__*/React.createElement(JsonEditor, {
|
|
159
323
|
ref: editorRef
|
|
160
|
-
}, JSON.stringify(pageData, null, '\t')))
|
|
324
|
+
}, JSON.stringify(pageData, null, '\t'))), /*#__PURE__*/React.createElement(Drawer, {
|
|
325
|
+
title: /*#__PURE__*/React.createElement("div", {
|
|
326
|
+
id: "preview-drawer-header",
|
|
327
|
+
style: {
|
|
328
|
+
display: 'flex',
|
|
329
|
+
height: 54,
|
|
330
|
+
alignItems: 'center',
|
|
331
|
+
justifyContent: 'space-between'
|
|
332
|
+
}
|
|
333
|
+
}, /*#__PURE__*/React.createElement("h3", {
|
|
334
|
+
style: {
|
|
335
|
+
marginBottom: 0
|
|
336
|
+
}
|
|
337
|
+
}, formatMessage({
|
|
338
|
+
id: 'luckda.lowcode.design.toolbar.pagePreview',
|
|
339
|
+
label: '页面预览'
|
|
340
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, {
|
|
341
|
+
placeholder: formatMessage({
|
|
342
|
+
id: 'luckda.lowcode.design.toolbar.selectUser',
|
|
343
|
+
label: '请选择模拟登录人'
|
|
344
|
+
}),
|
|
345
|
+
allowClear: true,
|
|
346
|
+
style: {
|
|
347
|
+
width: 180
|
|
348
|
+
},
|
|
349
|
+
dropdownStyle: {
|
|
350
|
+
zIndex: 3100
|
|
351
|
+
},
|
|
352
|
+
filterOption: false,
|
|
353
|
+
labelInValue: true,
|
|
354
|
+
showSearch: true,
|
|
355
|
+
getPopupContainer: function getPopupContainer() {
|
|
356
|
+
return document.getElementById('preview-drawer-header').closest('.ant-drawer-wrapper-body');
|
|
357
|
+
},
|
|
358
|
+
onSearch: handleSearch,
|
|
359
|
+
onChange: function onChange(_, _opt) {
|
|
360
|
+
if (_opt) {
|
|
361
|
+
setUserId(_opt.props.sloginid);
|
|
362
|
+
} else {
|
|
363
|
+
setUserId(void 0);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}, userOptions.map(function (_ref6) {
|
|
367
|
+
var key = _ref6.key,
|
|
368
|
+
label = _ref6.label,
|
|
369
|
+
rest = _objectWithoutProperties(_ref6, _excluded);
|
|
370
|
+
return /*#__PURE__*/React.createElement(Select.Option, _extends({
|
|
371
|
+
key: key,
|
|
372
|
+
value: key
|
|
373
|
+
}, rest), label);
|
|
374
|
+
})))),
|
|
375
|
+
placement: "bottom",
|
|
376
|
+
height: "94vh",
|
|
377
|
+
footer: false,
|
|
378
|
+
zIndex: 3000,
|
|
379
|
+
headerStyle: {
|
|
380
|
+
padding: '0 48px 0 24px'
|
|
381
|
+
},
|
|
382
|
+
bodyStyle: {
|
|
383
|
+
height: 'calc(100% - 54px)',
|
|
384
|
+
backgroundColor: '#F0F2F5'
|
|
385
|
+
},
|
|
386
|
+
visible: showPreview,
|
|
387
|
+
destroyOnClose: true,
|
|
388
|
+
onClose: function onClose() {
|
|
389
|
+
return setShowPreview(false);
|
|
390
|
+
},
|
|
391
|
+
getContainer: function getContainer() {
|
|
392
|
+
return document.getElementById('lc-design-workspace');
|
|
393
|
+
}
|
|
394
|
+
}, /*#__PURE__*/React.createElement(Preview, {
|
|
395
|
+
code: location.query.code,
|
|
396
|
+
userId: userId || 'no-user'
|
|
397
|
+
})));
|
|
161
398
|
};
|
|
162
399
|
export default DesignToolbar;
|
|
@@ -5,7 +5,7 @@ import React, { useRef, useState, useEffect, useLayoutEffect } from 'react';
|
|
|
5
5
|
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
6
6
|
import { Breadcrumb } from 'luck-design/antd';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import { takeRight,
|
|
8
|
+
import { takeRight, isNil, reduce, get, set } from 'lodash';
|
|
9
9
|
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
10
10
|
import { useContext, usePageData } from "../engine/provider/ContextProvider";
|
|
11
11
|
import AttrsPanel from "./components/AttrsPanel";
|
|
@@ -58,24 +58,23 @@ var Panel = function Panel() {
|
|
|
58
58
|
}
|
|
59
59
|
}, [activeNode]);
|
|
60
60
|
var handleChange = useMemoizedFn(function (field, value, repositioning) {
|
|
61
|
-
var cloneData = cloneDeep(pageData);
|
|
62
61
|
if (field === 'enableHeader') {
|
|
63
62
|
if (value) {
|
|
64
63
|
var headerMeta = require("../engine/meta/pageheader.props.default.json");
|
|
65
|
-
add(
|
|
64
|
+
add(pageData, LC_BUILDIN_UNIT_KEY.PAGE_ROOT, LC_BUILDIN_UNIT_KEY.PAGE_HEADER, _objectSpread(_objectSpread({}, headerMeta), {}, {
|
|
66
65
|
buildIn: true
|
|
67
66
|
}));
|
|
68
67
|
} else {
|
|
69
|
-
deleteById(
|
|
68
|
+
deleteById(pageData, LC_BUILDIN_UNIT_KEY.PAGE_HEADER);
|
|
70
69
|
}
|
|
71
70
|
} else if (field === 'enableFooter') {
|
|
72
71
|
if (value) {
|
|
73
72
|
var footerMeta = require("../engine/meta/pagefooter.props.default.json");
|
|
74
|
-
add(
|
|
73
|
+
add(pageData, LC_BUILDIN_UNIT_KEY.PAGE_ROOT, LC_BUILDIN_UNIT_KEY.PAGE_FOOTER, _objectSpread(_objectSpread({}, footerMeta), {}, {
|
|
75
74
|
buildIn: true
|
|
76
75
|
}));
|
|
77
76
|
} else {
|
|
78
|
-
deleteById(
|
|
77
|
+
deleteById(pageData, LC_BUILDIN_UNIT_KEY.PAGE_FOOTER);
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
var component = context.componentMap.get(activeNode.node.id);
|
|
@@ -83,11 +82,11 @@ var Panel = function Panel() {
|
|
|
83
82
|
node = _component$api$getSel.node;
|
|
84
83
|
var oldValue = _defineProperty({}, field, get(node.props, field));
|
|
85
84
|
var newNodeData = set(node.props, field, value);
|
|
86
|
-
modifyById(
|
|
87
|
-
setPageData(
|
|
85
|
+
modifyById(pageData, activeNode.node.id, newNodeData);
|
|
86
|
+
setPageData(pageData).then(function (newData) {
|
|
88
87
|
context.$publisher(context.topics.COMPONENT_MODIFY, {
|
|
89
88
|
id: activeNode.node.id,
|
|
90
|
-
pageData:
|
|
89
|
+
pageData: newData,
|
|
91
90
|
oldValue: oldValue,
|
|
92
91
|
newValue: _defineProperty({}, field, value)
|
|
93
92
|
});
|
|
@@ -56,7 +56,7 @@ var AttrsPanel = function AttrsPanel(_ref) {
|
|
|
56
56
|
props = _ref2.props,
|
|
57
57
|
wrapper = _ref2.wrapper,
|
|
58
58
|
wrapperProps = _ref2.wrapperProps,
|
|
59
|
-
|
|
59
|
+
next = _ref2.next,
|
|
60
60
|
repositioning = _ref2.repositioning,
|
|
61
61
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
62
62
|
var Comp = factory.current.getPanelItemFor(startsWith(type, '_') ? 'dynamic' : type, type);
|
|
@@ -66,8 +66,8 @@ var AttrsPanel = function AttrsPanel(_ref) {
|
|
|
66
66
|
key: key,
|
|
67
67
|
field: key,
|
|
68
68
|
label: name,
|
|
69
|
-
next:
|
|
70
|
-
return goNext(
|
|
69
|
+
next: next ? function (_dp) {
|
|
70
|
+
return goNext(next, _dp);
|
|
71
71
|
} : null,
|
|
72
72
|
defaultCollapsed: defaultValue,
|
|
73
73
|
desc: desc
|
|
@@ -78,9 +78,9 @@ var AttrsPanel = function AttrsPanel(_ref) {
|
|
|
78
78
|
nodeId: value.id,
|
|
79
79
|
key: key,
|
|
80
80
|
defaultValue: isNil(_originalVal) ? defaultValue : _originalVal,
|
|
81
|
-
next: function
|
|
82
|
-
return goNext(
|
|
83
|
-
},
|
|
81
|
+
next: next !== null && next !== void 0 && next.props ? function (_dp) {
|
|
82
|
+
return goNext(next, _dp);
|
|
83
|
+
} : null,
|
|
84
84
|
onChange: function onChange(val) {
|
|
85
85
|
return handleChange(valueKey || key, val, repositioning);
|
|
86
86
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import { cloneElement, useEffect } from 'react';
|
|
3
|
+
import { useCreation } from 'ahooks';
|
|
3
4
|
import { useDraggable, useDroppable } from '@dnd-kit/core';
|
|
4
5
|
import { useContext } from "../../../engine/provider/ContextProvider";
|
|
5
|
-
import { useCreation } from 'ahooks';
|
|
6
6
|
import { Action } from "./DragDropContext";
|
|
7
7
|
import { NO_DRAGABLE, NO_DROPABLE } from "../../../constants";
|
|
8
8
|
export default function (_ref) {
|
|
@@ -33,6 +33,9 @@ export default function (_ref) {
|
|
|
33
33
|
}
|
|
34
34
|
}),
|
|
35
35
|
setDropRef = _useDroppable.setNodeRef;
|
|
36
|
+
var _memoListeners = useCreation(function () {
|
|
37
|
+
return listeners;
|
|
38
|
+
}, []);
|
|
36
39
|
useEffect(function () {
|
|
37
40
|
var dom = getTargetDom();
|
|
38
41
|
if (dom) {
|
|
@@ -41,7 +44,7 @@ export default function (_ref) {
|
|
|
41
44
|
}
|
|
42
45
|
}, []);
|
|
43
46
|
var comp = useCreation(function () {
|
|
44
|
-
return /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props),
|
|
47
|
+
return /*#__PURE__*/cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), _memoListeners), attributes));
|
|
45
48
|
}, [id, children]);
|
|
46
49
|
return comp;
|
|
47
50
|
}
|
|
@@ -70,7 +70,8 @@ export var ListEditorItem = function ListEditorItem(_ref2) {
|
|
|
70
70
|
_ref2$sortable = _ref2.sortable,
|
|
71
71
|
sortable = _ref2$sortable === void 0 ? true : _ref2$sortable,
|
|
72
72
|
transform = _ref2.transform,
|
|
73
|
-
transition = _ref2.transition
|
|
73
|
+
transition = _ref2.transition,
|
|
74
|
+
onAddLine = _ref2.onAddLine;
|
|
74
75
|
return /*#__PURE__*/React.createElement("div", {
|
|
75
76
|
ref: setNodeRef,
|
|
76
77
|
style: style,
|
|
@@ -94,5 +95,10 @@ export var ListEditorItem = function ListEditorItem(_ref2) {
|
|
|
94
95
|
d: "M0.499972716,6 L1.50002728,6 C1.77615459,6 2,6.22384541 2,6.49997272 C2,6.77610002 1.77615459,6.99994543 1.50002728,6.99994543 L0.499972716,6.99994543 C0.22384541,6.99994543 3.38158422e-17,6.77610002 0,6.49997272 C-3.38158422e-17,6.22384541 0.22384541,6 0.499972716,6 Z M0.499972716,3 L1.50002728,3 C1.77615459,3 2,3.22384541 2,3.49997272 C2,3.77610002 1.77615459,3.99994543 1.50002728,3.99994543 L0.499972716,3.99994543 C0.22384541,3.99994543 3.38158422e-17,3.77610002 0,3.49997272 C-3.38158422e-17,3.22384541 0.22384541,3 0.499972716,3 Z M0.499972716,7.28787148e-18 L1.50002728,5.55666624e-14 C1.77615459,7.07214574e-14 2,0.22384541 2,0.499972716 C2,0.776100022 1.77615459,0.999945432 1.50002728,0.999945432 L0.499972716,0.999945432 C0.22384541,0.999945432 3.38158422e-17,0.776100022 0,0.499972716 C-3.38158422e-17,0.22384541 0.22384541,5.0723721e-17 0.499972716,0 Z M0.5,9.00002729 L1.5,9.00002729 C1.77614237,9.00002729 2,9.22388491 2,9.50002729 C2,9.77616966 1.77614237,10.0000273 1.5,10.0000273 L0.5,10.0000273 C0.223857625,10.0000273 3.38176876e-17,9.77616966 0,9.50002729 C-3.38176876e-17,9.22388491 0.223857625,9.00002729 0.5,9.00002729 Z M0.5,12.0000273 L1.5,12.0000273 C1.77614237,12.0000273 2,12.2238849 2,12.5000273 C2,12.7761697 1.77614237,13.0000273 1.5,13.0000273 L0.5,13.0000273 C0.223857625,13.0000273 3.38176876e-17,12.7761697 0,12.5000273 C-3.38176876e-17,12.2238849 0.223857625,12.0000273 0.5,12.0000273 Z M0.5,15.0000273 L1.5,15.0000273 C1.77614237,15.0000273 2,15.2238849 2,15.5000273 C2,15.7761697 1.77614237,16.0000273 1.5,16.0000273 L0.5,16.0000273 C0.223857625,16.0000273 3.38176876e-17,15.7761697 0,15.5000273 C-3.38176876e-17,15.2238849 0.223857625,15.0000273 0.5,15.0000273 Z M3.49997272,6 L4.50002728,6 C4.77615459,6 5,6.22384541 5,6.49997272 C5,6.77610002 4.77615459,6.99994543 4.50002728,6.99994543 L3.49997272,6.99994543 C3.22384541,6.99994543 3,6.77610002 3,6.49997272 C3,6.22384541 3.22384541,6 3.49997272,6 Z M3.49997272,3 L4.50002728,3 C4.77615459,3 5,3.22384541 5,3.49997272 C5,3.77610002 4.77615459,3.99994543 4.50002728,3.99994543 L3.49997272,3.99994543 C3.22384541,3.99994543 3,3.77610002 3,3.49997272 C3,3.22384541 3.22384541,3 3.49997272,3 Z M3.49997272,7.28787148e-18 L4.50002728,5.55666624e-14 C4.77615459,7.07214574e-14 5,0.22384541 5,0.499972716 C5,0.776100022 4.77615459,0.999945432 4.50002728,0.999945432 L3.49997272,0.999945432 C3.22384541,0.999945432 3,0.776100022 3,0.499972716 C3,0.22384541 3.22384541,5.0723721e-17 3.49997272,0 Z M3.5,9.00002729 L4.5,9.00002729 C4.77614237,9.00002729 5,9.22388491 5,9.50002729 C5,9.77616966 4.77614237,10.0000273 4.5,10.0000273 L3.5,10.0000273 C3.22385763,10.0000273 3,9.77616966 3,9.50002729 C3,9.22388491 3.22385763,9.00002729 3.5,9.00002729 Z M3.5,12.0000273 L4.5,12.0000273 C4.77614237,12.0000273 5,12.2238849 5,12.5000273 C5,12.7761697 4.77614237,13.0000273 4.5,13.0000273 L3.5,13.0000273 C3.22385763,13.0000273 3,12.7761697 3,12.5000273 C3,12.2238849 3.22385763,12.0000273 3.5,12.0000273 Z M3.5,15.0000273 L4.5,15.0000273 C4.77614237,15.0000273 5,15.2238849 5,15.5000273 C5,15.7761697 4.77614237,16.0000273 4.5,16.0000273 L3.5,16.0000273 C3.22385763,16.0000273 3,15.7761697 3,15.5000273 C3,15.2238849 3.22385763,15.0000273 3.5,15.0000273 Z"
|
|
95
96
|
}))), left), /*#__PURE__*/React.createElement("div", {
|
|
96
97
|
className: styles['list-item-right']
|
|
97
|
-
}, right)
|
|
98
|
+
}, right), onAddLine ? /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
className: styles['list-item-bottom-line'],
|
|
100
|
+
onClick: function onClick() {
|
|
101
|
+
return onAddLine(item);
|
|
102
|
+
}
|
|
103
|
+
}) : null);
|
|
98
104
|
};
|