@luck-design-biz/luckda 1.0.2-2 → 1.0.2-20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/Builder/index.js +13 -10
- package/es/components/ComplexItem/index.js +5 -3
- package/es/components/ComplexItem/service.js +6 -3
- package/es/components/LDActions/index.js +1 -0
- package/es/components/LdAutoForm/index.js +5 -4
- package/es/components/LdCard/index.js +10 -8
- package/es/components/LdCom/index.js +3 -2
- package/es/components/LdFormList/index.js +10 -7
- package/es/components/LdGrid/index.js +11 -12
- package/es/components/LdGridForm/index.js +5 -4
- package/es/helper/FromItems.js +64 -5
- package/es/helper/action.js +2 -0
- package/es/helper/ldBuilder.js +5 -4
- package/es/helper/ldComBuild.js +16 -11
- package/es/locales/zh-CN.js +61 -6
- package/es/lowcode/constants/api-url.js +359 -190
- package/es/lowcode/constants/event-topics.js +4 -0
- package/es/lowcode/constants/index.js +5 -4
- 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/cardlist.props.json +3 -5
- package/es/lowcode/engine/meta/components-list.json +6 -0
- package/es/lowcode/engine/meta/dialog.props.default.json +4 -1
- package/es/lowcode/engine/meta/dialog.props.json +24 -4
- package/es/lowcode/engine/meta/drawer.props.json +1 -1
- package/es/lowcode/engine/meta/fielddate.props.default.json +1 -0
- package/es/lowcode/engine/meta/fielddate.props.json +48 -1
- package/es/lowcode/engine/meta/fieldeditor.props.json +0 -1
- package/es/lowcode/engine/meta/fieldgroup.props.json +0 -1
- package/es/lowcode/engine/meta/fieldyear.props.json +0 -1
- package/es/lowcode/engine/meta/form.props.json +3 -19
- package/es/lowcode/engine/meta/grouptree.props.json +0 -1
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +5 -0
- package/es/lowcode/engine/meta/jsx.props.default.json +1 -2
- package/es/lowcode/engine/meta/jsx.props.json +4 -3
- package/es/lowcode/engine/meta/layout.props.default.json +1 -1
- package/es/lowcode/engine/meta/layout.props.json +1 -1
- package/es/lowcode/engine/meta/proxy.props.default.json +15 -0
- package/es/lowcode/engine/meta/proxy.props.json +66 -0
- package/es/lowcode/engine/meta/section.props.json +2 -2
- package/es/lowcode/engine/meta/table.props.json +0 -7
- package/es/lowcode/engine/meta/tabs.props.json +1 -1
- package/es/lowcode/engine/meta/tree.props.json +1 -5
- package/es/lowcode/engine/provider/ContextProvider/index.js +45 -9
- package/es/lowcode/engine/provider/ContextProvider/router.js +21 -1
- package/es/lowcode/engine/provider/ContextProvider/usePageDataStore.js +36 -30
- package/es/lowcode/engine/provider/ContextProvider/usePageVar.js +11 -5
- package/es/lowcode/engine/provider/ContextProvider/useTodo.js +2 -4
- package/es/lowcode/engine/provider/EventBusProvider.js +14 -4
- package/es/lowcode/engine/provider/PageProxyProvider.js +95 -0
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +10 -12
- package/es/lowcode/engine/tools/helper.js +25 -1
- package/es/lowcode/engine/tools/initDS.js +4 -4
- package/es/lowcode/painter/Design.js +1 -0
- package/es/lowcode/painter/DesignOperator.js +135 -27
- package/es/lowcode/painter/DesignToolbar.js +102 -188
- package/es/lowcode/painter/History.js +300 -0
- package/es/lowcode/painter/Panel.js +1 -1
- package/es/lowcode/painter/Ribbon.js +37 -1
- package/es/lowcode/painter/components/AdvancePanel.js +55 -51
- package/es/lowcode/painter/components/DragDrop/DragDropContext.js +10 -3
- package/es/lowcode/painter/components/TipIcon.js +12 -4
- package/es/lowcode/painter/components/TreeEditor.js +76 -8
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +10 -6
- package/es/lowcode/painter/components/code-editor/DiffEditor.js +41 -0
- package/es/lowcode/painter/components/field-setting/FieldAttrs.js +2 -2
- package/es/lowcode/painter/components/field-setting/SettingUI.js +56 -5
- package/es/lowcode/painter/components/field-setting/index.js +24 -1
- package/es/lowcode/painter/components/shortcut-modal/KeyIcon.js +11 -0
- package/es/lowcode/painter/components/shortcut-modal/index.js +208 -0
- package/es/lowcode/painter/panel-section/BlockEditor/index.js +10 -19
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +4 -1
- package/es/lowcode/painter/panel-section/ConditionCheck.js +70 -0
- package/es/lowcode/painter/panel-section/DataSetSelector.js +6 -3
- package/es/lowcode/painter/panel-section/DialogSize.js +76 -0
- package/es/lowcode/painter/panel-section/DialogWidthHeight.js +60 -0
- package/es/lowcode/painter/panel-section/FieldsSetting.js +1 -1
- package/es/lowcode/painter/panel-section/IconConditionSelector.js +2 -2
- package/es/lowcode/painter/panel-section/JSEditor/ToolBar.js +174 -0
- package/es/lowcode/painter/panel-section/JSEditor/index.js +181 -0
- package/es/lowcode/painter/panel-section/JSEditor/index.less +4 -0
- package/es/lowcode/painter/panel-section/PageLayoutDisplay.js +7 -2
- package/es/lowcode/painter/panel-section/ProxyLinker.js +137 -0
- package/es/lowcode/painter/panel-section/ProxyParams.js +28 -0
- package/es/lowcode/painter/panel-section/ProxyParamsSetter.js +240 -0
- package/es/lowcode/painter/panel-section/StylePanel/MainPanel.js +37 -26
- package/es/lowcode/painter/style/action-bind-modal.less +1 -1
- package/es/lowcode/painter/style/components.less +1 -1
- package/es/lowcode/painter/style/history.less +46 -0
- package/es/lowcode/painter/style/outline.less +1 -1
- package/es/lowcode/painter/style/panel-item.less +1 -0
- package/es/lowcode/preview/DebugTool.js +78 -0
- package/es/lowcode/preview/DebugToolDetail.js +103 -0
- package/es/lowcode/preview/index.js +10 -17
- package/es/lowcode/preview/useDebugSettings.js +62 -0
- package/es/lowcode/view/Canvas.js +5 -1
- package/es/lowcode/view/ErrorBoundary.js +80 -0
- package/es/lowcode/view/Page.js +11 -6
- package/es/lowcode/view/lc-components/Box/FunctionDesign.js +4 -2
- package/es/lowcode/view/lc-components/Box/index.less +2 -2
- package/es/lowcode/view/lc-components/Box/meta.json +1 -1
- package/es/lowcode/view/lc-components/CardList/index.js +3 -0
- package/es/lowcode/view/lc-components/CardList/meta.json +3 -5
- package/es/lowcode/view/lc-components/Dialog/index.js +13 -5
- package/es/lowcode/view/lc-components/Dialog/meta.json +24 -4
- package/es/lowcode/view/lc-components/Drawer/index.js +5 -3
- package/es/lowcode/view/lc-components/Drawer/meta.json +1 -1
- package/es/lowcode/view/lc-components/FieldDate/meta.json +48 -1
- package/es/lowcode/view/lc-components/FieldEditor/meta.json +0 -1
- package/es/lowcode/view/lc-components/FieldGroup/meta.json +0 -1
- package/es/lowcode/view/lc-components/FieldYear/meta.json +0 -1
- package/es/lowcode/view/lc-components/Form/index.js +15 -19
- package/es/lowcode/view/lc-components/Form/meta.json +3 -19
- package/es/lowcode/view/lc-components/GroupTree/meta.json +0 -1
- package/es/lowcode/view/lc-components/JSX/RuntimeComp.js +32 -16
- package/es/lowcode/view/lc-components/JSX/meta.json +4 -3
- package/es/lowcode/view/lc-components/Layout/meta.json +1 -1
- package/es/lowcode/view/lc-components/PageLayout/index.js +1 -1
- package/es/lowcode/view/lc-components/Proxy/FunctionDesign.js +17 -0
- package/es/lowcode/view/lc-components/Proxy/FunctionLive.js +23 -0
- package/es/lowcode/view/lc-components/Proxy/FunctionPreview.js +23 -0
- package/es/lowcode/view/lc-components/Proxy/index.js +42 -0
- package/es/lowcode/view/lc-components/Proxy/index.less +5 -0
- package/es/lowcode/view/lc-components/Proxy/meta.json +66 -0
- package/es/lowcode/view/lc-components/Section/meta.json +2 -2
- package/es/lowcode/view/lc-components/Table/components/TopImex.js +16 -13
- package/es/lowcode/view/lc-components/Table/index.js +11 -3
- package/es/lowcode/view/lc-components/Table/meta.json +0 -7
- package/es/lowcode/view/lc-components/Tabs/index.js +6 -2
- package/es/lowcode/view/lc-components/Tabs/meta.json +1 -1
- package/es/lowcode/view/lc-components/Tree/index.js +3 -0
- package/es/lowcode/view/lc-components/Tree/meta.json +1 -5
- package/es/lowcode/view/lc-components/Wrapper.js +9 -1
- package/es/upload/FilesWall/index.js +16 -6
- package/es/upload/Form/gridForm.js +16 -6
- package/es/upload/FormItem/index.js +16 -4
- package/es/utils/action.js +3 -2
- package/es/utils/form.js +4 -3
- package/es/utils/grid.js +10 -2
- package/lib/components/Builder/index.js +13 -10
- package/lib/components/ComplexItem/index.js +5 -3
- package/lib/components/ComplexItem/service.js +6 -3
- package/lib/components/LDActions/index.js +1 -0
- package/lib/components/LdAutoForm/index.js +3 -2
- package/lib/components/LdCard/index.js +10 -8
- package/lib/components/LdCom/index.js +3 -2
- package/lib/components/LdFormList/index.js +9 -6
- package/lib/components/LdGrid/index.js +11 -12
- package/lib/components/LdGridForm/index.js +3 -2
- package/lib/helper/FromItems.js +64 -5
- package/lib/helper/action.js +2 -0
- package/lib/helper/ldBuilder.js +4 -4
- package/lib/helper/ldComBuild.js +14 -9
- package/lib/locales/zh-CN.js +61 -6
- package/lib/lowcode/constants/api-url.js +360 -190
- package/lib/lowcode/constants/event-topics.js +5 -1
- package/lib/lowcode/constants/index.js +6 -5
- 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/cardlist.props.json +3 -5
- package/lib/lowcode/engine/meta/components-list.json +6 -0
- package/lib/lowcode/engine/meta/dialog.props.default.json +4 -1
- package/lib/lowcode/engine/meta/dialog.props.json +24 -4
- package/lib/lowcode/engine/meta/drawer.props.json +1 -1
- package/lib/lowcode/engine/meta/fielddate.props.default.json +1 -0
- package/lib/lowcode/engine/meta/fielddate.props.json +48 -1
- package/lib/lowcode/engine/meta/fieldeditor.props.json +0 -1
- package/lib/lowcode/engine/meta/fieldgroup.props.json +0 -1
- package/lib/lowcode/engine/meta/fieldyear.props.json +0 -1
- package/lib/lowcode/engine/meta/form.props.json +3 -19
- package/lib/lowcode/engine/meta/grouptree.props.json +0 -1
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +5 -0
- package/lib/lowcode/engine/meta/jsx.props.default.json +1 -2
- package/lib/lowcode/engine/meta/jsx.props.json +4 -3
- package/lib/lowcode/engine/meta/layout.props.default.json +1 -1
- package/lib/lowcode/engine/meta/layout.props.json +1 -1
- package/lib/lowcode/engine/meta/proxy.props.default.json +15 -0
- package/lib/lowcode/engine/meta/proxy.props.json +66 -0
- package/lib/lowcode/engine/meta/section.props.json +2 -2
- package/lib/lowcode/engine/meta/table.props.json +0 -7
- package/lib/lowcode/engine/meta/tabs.props.json +1 -1
- package/lib/lowcode/engine/meta/tree.props.json +1 -5
- package/lib/lowcode/engine/provider/ContextProvider/index.js +50 -13
- package/lib/lowcode/engine/provider/ContextProvider/router.js +22 -1
- package/lib/lowcode/engine/provider/ContextProvider/usePageDataStore.js +37 -31
- package/lib/lowcode/engine/provider/ContextProvider/usePageVar.js +10 -4
- package/lib/lowcode/engine/provider/ContextProvider/useTodo.js +1 -3
- package/lib/lowcode/engine/provider/EventBusProvider.js +14 -4
- package/lib/lowcode/engine/provider/PageProxyProvider.js +103 -0
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +10 -12
- package/lib/lowcode/engine/tools/helper.js +25 -0
- package/lib/lowcode/engine/tools/initDS.js +4 -4
- package/lib/lowcode/painter/Design.js +1 -0
- package/lib/lowcode/painter/DesignOperator.js +132 -24
- package/lib/lowcode/painter/DesignToolbar.js +98 -184
- package/lib/lowcode/painter/History.js +308 -0
- package/lib/lowcode/painter/Panel.js +1 -1
- package/lib/lowcode/painter/Ribbon.js +37 -1
- package/lib/lowcode/painter/components/AdvancePanel.js +53 -49
- package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +10 -3
- package/lib/lowcode/painter/components/TipIcon.js +12 -4
- package/lib/lowcode/painter/components/TreeEditor.js +76 -8
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +10 -6
- package/lib/lowcode/painter/components/code-editor/DiffEditor.js +49 -0
- package/lib/lowcode/painter/components/field-setting/FieldAttrs.js +2 -2
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +55 -4
- package/lib/lowcode/painter/components/field-setting/index.js +24 -1
- package/lib/lowcode/painter/components/shortcut-modal/KeyIcon.js +18 -0
- package/lib/lowcode/painter/components/shortcut-modal/index.js +215 -0
- package/lib/lowcode/painter/panel-section/BlockEditor/index.js +9 -18
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +4 -1
- package/lib/lowcode/painter/panel-section/ConditionCheck.js +78 -0
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +6 -3
- package/lib/lowcode/painter/panel-section/DialogSize.js +83 -0
- package/lib/lowcode/painter/panel-section/DialogWidthHeight.js +67 -0
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +1 -1
- package/lib/lowcode/painter/panel-section/IconConditionSelector.js +2 -2
- package/lib/lowcode/painter/panel-section/JSEditor/ToolBar.js +181 -0
- package/lib/lowcode/painter/panel-section/JSEditor/index.js +189 -0
- package/lib/lowcode/painter/panel-section/JSEditor/index.less +4 -0
- package/lib/lowcode/painter/panel-section/PageLayoutDisplay.js +7 -2
- package/lib/lowcode/painter/panel-section/ProxyLinker.js +145 -0
- package/lib/lowcode/painter/panel-section/ProxyParams.js +35 -0
- package/lib/lowcode/painter/panel-section/ProxyParamsSetter.js +248 -0
- package/lib/lowcode/painter/panel-section/StylePanel/MainPanel.js +37 -26
- package/lib/lowcode/painter/style/action-bind-modal.less +1 -1
- package/lib/lowcode/painter/style/components.less +1 -1
- package/lib/lowcode/painter/style/history.less +46 -0
- package/lib/lowcode/painter/style/outline.less +1 -1
- package/lib/lowcode/painter/style/panel-item.less +1 -0
- package/lib/lowcode/preview/DebugTool.js +86 -0
- package/lib/lowcode/preview/DebugToolDetail.js +111 -0
- package/lib/lowcode/preview/index.js +10 -18
- package/lib/lowcode/preview/useDebugSettings.js +69 -0
- package/lib/lowcode/view/Canvas.js +5 -1
- package/lib/lowcode/view/ErrorBoundary.js +88 -0
- package/lib/lowcode/view/Page.js +12 -7
- package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +4 -2
- package/lib/lowcode/view/lc-components/Box/index.less +2 -2
- package/lib/lowcode/view/lc-components/Box/meta.json +1 -1
- package/lib/lowcode/view/lc-components/CardList/index.js +3 -0
- package/lib/lowcode/view/lc-components/CardList/meta.json +3 -5
- package/lib/lowcode/view/lc-components/Dialog/index.js +11 -3
- package/lib/lowcode/view/lc-components/Dialog/meta.json +24 -4
- package/lib/lowcode/view/lc-components/Drawer/index.js +3 -1
- package/lib/lowcode/view/lc-components/Drawer/meta.json +1 -1
- package/lib/lowcode/view/lc-components/FieldDate/meta.json +48 -1
- package/lib/lowcode/view/lc-components/FieldEditor/meta.json +0 -1
- package/lib/lowcode/view/lc-components/FieldGroup/meta.json +0 -1
- package/lib/lowcode/view/lc-components/FieldYear/meta.json +0 -1
- package/lib/lowcode/view/lc-components/Form/index.js +15 -19
- package/lib/lowcode/view/lc-components/Form/meta.json +3 -19
- package/lib/lowcode/view/lc-components/GroupTree/meta.json +0 -1
- package/lib/lowcode/view/lc-components/JSX/RuntimeComp.js +33 -16
- package/lib/lowcode/view/lc-components/JSX/meta.json +4 -3
- package/lib/lowcode/view/lc-components/Layout/meta.json +1 -1
- package/lib/lowcode/view/lc-components/PageLayout/index.js +1 -1
- package/lib/lowcode/view/lc-components/Proxy/FunctionDesign.js +24 -0
- package/lib/lowcode/view/lc-components/Proxy/FunctionLive.js +30 -0
- package/lib/lowcode/view/lc-components/Proxy/FunctionPreview.js +30 -0
- package/lib/lowcode/view/lc-components/Proxy/index.js +50 -0
- package/lib/lowcode/view/lc-components/Proxy/index.less +5 -0
- package/lib/lowcode/view/lc-components/Proxy/meta.json +66 -0
- package/lib/lowcode/view/lc-components/Section/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Table/components/TopImex.js +16 -13
- package/lib/lowcode/view/lc-components/Table/index.js +11 -3
- package/lib/lowcode/view/lc-components/Table/meta.json +0 -7
- package/lib/lowcode/view/lc-components/Tabs/index.js +5 -1
- package/lib/lowcode/view/lc-components/Tabs/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Tree/index.js +3 -0
- package/lib/lowcode/view/lc-components/Tree/meta.json +1 -5
- package/lib/lowcode/view/lc-components/Wrapper.js +8 -0
- package/lib/upload/FilesWall/index.js +13 -3
- package/lib/upload/Form/gridForm.js +13 -3
- package/lib/upload/FormItem/index.js +15 -3
- package/lib/utils/action.js +6 -0
- package/lib/utils/form.js +3 -2
- package/lib/utils/grid.js +11 -3
- package/package.json +1 -2
- package/es/lowcode/painter/panel-section/JSEditor.js +0 -49
- package/es/lowcode/view/errorBoundary.js +0 -61
- package/lib/lowcode/painter/panel-section/JSEditor.js +0 -57
- package/lib/lowcode/view/errorBoundary.js +0 -69
|
@@ -140,8 +140,8 @@ var wrapPromise = function wrapPromise(promise) {
|
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
};
|
|
143
|
-
export default function initialize(ctx) {
|
|
144
|
-
var pageVars = usePageDataStore.getState()
|
|
143
|
+
export default function initialize(ctx, proxyCode) {
|
|
144
|
+
var pageVars = usePageDataStore.getState()[proxyCode || 'pageData'].props.vars;
|
|
145
145
|
if (isNil(pageVars)) return null;
|
|
146
146
|
var remoteApis = new Map();
|
|
147
147
|
var _reduce = reduce(pageVars, function (ret, val) {
|
|
@@ -170,8 +170,8 @@ export default function initialize(ctx) {
|
|
|
170
170
|
_reduce2 = _toArray(_reduce),
|
|
171
171
|
variables = _reduce2[0],
|
|
172
172
|
autoTasks = _reduce2.slice(1);
|
|
173
|
-
useStateStore.getState().initialize(variables);
|
|
174
|
-
ctx._initRemoteApiMap(remoteApis);
|
|
173
|
+
useStateStore.getState().initialize(variables, !!proxyCode);
|
|
174
|
+
ctx._initRemoteApiMap(remoteApis, !!proxyCode);
|
|
175
175
|
function run() {
|
|
176
176
|
return _run2.apply(this, arguments);
|
|
177
177
|
}
|
|
@@ -65,6 +65,7 @@ var Design = function Design() {
|
|
|
65
65
|
return /*#__PURE__*/React.createElement("div", {
|
|
66
66
|
className: styles['lc-painter-design']
|
|
67
67
|
}, /*#__PURE__*/React.createElement(DesignToolbar, {
|
|
68
|
+
canvas: simulatorRef,
|
|
68
69
|
locale: locale,
|
|
69
70
|
onLangChange: handleLangChange
|
|
70
71
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import React, { useRef, useEffect, useState } from 'react';
|
|
3
|
+
import { getCreateHistoryOptions } from 'umi';
|
|
3
4
|
import { last, initial } from 'lodash';
|
|
4
|
-
import { useEventListener, useSetState, useMemoizedFn, useCreation, useSize, useLatest
|
|
5
|
+
import { useEventListener, useSetState, useMemoizedFn, useCreation, useSize, useLatest } from 'ahooks';
|
|
5
6
|
import { Icon, Dropdown, message } from 'luck-design/antd';
|
|
6
|
-
import { reverse, isString, isNil } from 'lodash';
|
|
7
|
+
import { reverse, isString, isNil, omit } from 'lodash';
|
|
7
8
|
import classNames from 'classnames';
|
|
8
9
|
import { suid } from '@luck-design-biz/base/utils';
|
|
9
|
-
import { useContext, addNode, deleteNode } from "../engine/provider/ContextProvider";
|
|
10
|
+
import { useContext, addNode, deleteNode, moveNode, useTemporalStore } from "../engine/provider/ContextProvider";
|
|
10
11
|
import { LC_BUILDIN_UNIT_KEY, LC_COMPONENT_UNIT_KEY, LC_COMPONENT_UNIT, LC_FORMITEM_UNIT, CONTAINER_UNITS } from "../constants";
|
|
11
12
|
import styles from "./style/design.less";
|
|
12
13
|
var _MODAL_COMPONENT_ = ['Dialog', 'Drawer'];
|
|
@@ -43,6 +44,18 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
43
44
|
setOperatorId = _useSetState2[1];
|
|
44
45
|
var lastSelectorId = useLatest(operatorId.selector);
|
|
45
46
|
var currentModal = useRef(null);
|
|
47
|
+
var _useTemporalStore = useTemporalStore(function (state) {
|
|
48
|
+
return {
|
|
49
|
+
undo: state.undo,
|
|
50
|
+
redo: state.redo,
|
|
51
|
+
pastStates: state.pastStates,
|
|
52
|
+
futureStates: state.futureStates
|
|
53
|
+
};
|
|
54
|
+
}),
|
|
55
|
+
canUndo = _useTemporalStore.canUndo,
|
|
56
|
+
canRedo = _useTemporalStore.canRedo,
|
|
57
|
+
undo = _useTemporalStore.undo,
|
|
58
|
+
redo = _useTemporalStore.redo;
|
|
46
59
|
var getElement = useMemoizedFn(function (_target) {
|
|
47
60
|
var _context$componentMap;
|
|
48
61
|
return isString(_target) ? (_context$componentMap = context.componentMap.get(_target)) === null || _context$componentMap === void 0 ? void 0 : _context$componentMap.api.getSelfDom() : _target;
|
|
@@ -63,9 +76,109 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
63
76
|
id: id
|
|
64
77
|
});
|
|
65
78
|
});
|
|
79
|
+
var handleShortcutEmit = useMemoizedFn(function (_ref3) {
|
|
80
|
+
var key = _ref3.key;
|
|
81
|
+
switch (key) {
|
|
82
|
+
case 'meta.s':
|
|
83
|
+
case 'ctrl.s':
|
|
84
|
+
context.$publisher(context.topics.DESIGN_OPERATE_SAVE);
|
|
85
|
+
break;
|
|
86
|
+
case 'meta.p':
|
|
87
|
+
case 'ctrl.p':
|
|
88
|
+
{
|
|
89
|
+
var _getCreateHistoryOpti = getCreateHistoryOptions(),
|
|
90
|
+
basename = _getCreateHistoryOpti.basename;
|
|
91
|
+
var previewUrl = "".concat(basename === '/' ? '' : basename, "/byteman/preview/").concat(context.router.getQuery('code'));
|
|
92
|
+
window.open(previewUrl, '_blank');
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
case 'meta.z':
|
|
96
|
+
case 'ctrl.z':
|
|
97
|
+
canUndo && undo();
|
|
98
|
+
break;
|
|
99
|
+
case 'meta.shift.z':
|
|
100
|
+
case 'ctrl.shift.z':
|
|
101
|
+
canRedo && redo();
|
|
102
|
+
break;
|
|
103
|
+
case 'meta.c':
|
|
104
|
+
case 'ctrl.c':
|
|
105
|
+
if (operatorId.selector) {
|
|
106
|
+
var _context$$$api$getSel = context.$(operatorId.selector).api.getSelfAndParentData(),
|
|
107
|
+
node = _context$$$api$getSel.node,
|
|
108
|
+
parent = _context$$$api$getSel.parent;
|
|
109
|
+
if (CONTAINER_UNITS.includes(parent === null || parent === void 0 ? void 0 : parent.props.component)) {
|
|
110
|
+
addComponent(omit(node.props), parent.props.id);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
break;
|
|
114
|
+
case 'backspace':
|
|
115
|
+
if (operatorId.selector && operatorId.deletable) {
|
|
116
|
+
handleDelete({
|
|
117
|
+
id: operatorId.selector
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
break;
|
|
121
|
+
case 'uparrow':
|
|
122
|
+
if (operatorId.selector) {
|
|
123
|
+
var _context$$$api$getSel2 = context.$(operatorId.selector).api.getSelfAndParentData(),
|
|
124
|
+
_parent = _context$$$api$getSel2.parent;
|
|
125
|
+
if (_parent) {
|
|
126
|
+
handleSelect(_parent.props.id);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
case 'downarrow':
|
|
131
|
+
if (operatorId.selector) {
|
|
132
|
+
var _node$children;
|
|
133
|
+
var _node = context.$(operatorId.selector).api.getSelfData();
|
|
134
|
+
if (_node !== null && _node !== void 0 && (_node$children = _node.children) !== null && _node$children !== void 0 && _node$children.length) {
|
|
135
|
+
handleSelect(_node.children[0]);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
case 'leftarrow':
|
|
140
|
+
case 'rightarrow':
|
|
141
|
+
if (operatorId.selector) {
|
|
142
|
+
var _parent2$children;
|
|
143
|
+
var _context$$$api$getSel3 = context.$(operatorId.selector).api.getSelfAndParentData(),
|
|
144
|
+
_parent2 = _context$$$api$getSel3.parent;
|
|
145
|
+
if (_parent2 !== null && _parent2 !== void 0 && (_parent2$children = _parent2.children) !== null && _parent2$children !== void 0 && _parent2$children.length) {
|
|
146
|
+
var index = _parent2.children.findIndex(function (c) {
|
|
147
|
+
return c === operatorId.selector;
|
|
148
|
+
});
|
|
149
|
+
if (key === 'leftarrow' && index > 0) {
|
|
150
|
+
handleSelect(_parent2.children[index - 1]);
|
|
151
|
+
} else if (key === 'rightarrow' && index < _parent2.children.length - 1) {
|
|
152
|
+
handleSelect(_parent2.children[index + 1]);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
case 'alt.leftarrow':
|
|
158
|
+
case 'alt.rightarrow':
|
|
159
|
+
if (operatorId.selector) {
|
|
160
|
+
var _parent3$children;
|
|
161
|
+
var _context$$$api$getSel4 = context.$(operatorId.selector).api.getSelfAndParentData(),
|
|
162
|
+
_parent3 = _context$$$api$getSel4.parent;
|
|
163
|
+
if (_parent3 !== null && _parent3 !== void 0 && (_parent3$children = _parent3.children) !== null && _parent3$children !== void 0 && _parent3$children.length) {
|
|
164
|
+
var _index = _parent3.children.findIndex(function (c) {
|
|
165
|
+
return c === operatorId.selector;
|
|
166
|
+
});
|
|
167
|
+
if (key === 'alt.leftarrow' && _index > 0) {
|
|
168
|
+
moveNode(_parent3.children[_index], _parent3.children[_index - 1], 'left');
|
|
169
|
+
} else if (key === 'alt.rightarrow' && _index < _parent3.children.length - 1) {
|
|
170
|
+
moveNode(_parent3.children[_index], _parent3.children[_index + 1], 'right');
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
break;
|
|
175
|
+
default:
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
66
179
|
var addComponent = useMemoizedFn(function (data, targetId) {
|
|
67
|
-
context.$subscriber(context.topics.COMPONENT_MOUNT).once(function (
|
|
68
|
-
var mountCompId =
|
|
180
|
+
context.$subscriber(context.topics.COMPONENT_MOUNT).once(function (_ref4) {
|
|
181
|
+
var mountCompId = _ref4.id;
|
|
69
182
|
if (mountCompId === _id) {
|
|
70
183
|
context.$publisher(context.topics.COMPONENT_APPEND, {
|
|
71
184
|
id: _id
|
|
@@ -114,10 +227,10 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
114
227
|
};
|
|
115
228
|
}, [operatorId.selector]);
|
|
116
229
|
var activeDomPosition = useCreation(function () {
|
|
117
|
-
var _getElement;
|
|
230
|
+
var _getElement, _canvas$current;
|
|
118
231
|
if (!operatorId.selector && !operatorId.selectorTarget) return null;
|
|
119
232
|
var targetTop = (_getElement = getElement(isNil(operatorId.selectorTarget) ? operatorId.selector : operatorId.selectorTarget.element)) === null || _getElement === void 0 ? void 0 : _getElement.getBoundingClientRect().top;
|
|
120
|
-
var delat = targetTop - canvas.current.getBoundingClientRect().top;
|
|
233
|
+
var delat = targetTop - (((_canvas$current = canvas.current) === null || _canvas$current === void 0 ? void 0 : _canvas$current.getBoundingClientRect().top) || 0);
|
|
121
234
|
return {
|
|
122
235
|
top: delat > 24 ? -24 : 0
|
|
123
236
|
};
|
|
@@ -126,15 +239,6 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
126
239
|
var _last;
|
|
127
240
|
return operatorId.detector && isString(operatorId.detector) ? (_last = last(context.componentMap.get(operatorId.detector).api.getLevelNodes())) === null || _last === void 0 ? void 0 : _last.name : void 0;
|
|
128
241
|
}, [operatorId.detector]);
|
|
129
|
-
useKeyPress('backspace', function () {
|
|
130
|
-
if (operatorId.selector && operatorId.deletable) {
|
|
131
|
-
handleDelete({
|
|
132
|
-
id: operatorId.selector
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}, {
|
|
136
|
-
target: canvas
|
|
137
|
-
});
|
|
138
242
|
useEventListener('mousemove', function (event) {
|
|
139
243
|
var elem = event.target;
|
|
140
244
|
var targetFormItem = elem.closest("[".concat(LC_COMPONENT_UNIT_KEY, "=\"").concat(LC_FORMITEM_UNIT, "\"]"));
|
|
@@ -197,11 +301,11 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
197
301
|
target: canvas
|
|
198
302
|
});
|
|
199
303
|
useEffect(function () {
|
|
200
|
-
var csid = context.$subscriber(context.topics.COMPONENT_SETTING_CLICK).on(function (
|
|
201
|
-
var data =
|
|
304
|
+
var csid = context.$subscriber(context.topics.COMPONENT_SETTING_CLICK).on(function (_ref5) {
|
|
305
|
+
var data = _ref5.data;
|
|
202
306
|
if (_MODAL_COMPONENT_.includes(data.component)) {
|
|
203
|
-
context.$subscriber(context.topics.COMPONENT_APPEND).once(function (
|
|
204
|
-
var compId =
|
|
307
|
+
context.$subscriber(context.topics.COMPONENT_APPEND).once(function (_ref6) {
|
|
308
|
+
var compId = _ref6.id;
|
|
205
309
|
context.$publisher(context.topics.COMPONENT_MODAL_TOGGLE, {
|
|
206
310
|
toggle: true,
|
|
207
311
|
id: compId
|
|
@@ -257,18 +361,20 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
257
361
|
});
|
|
258
362
|
}
|
|
259
363
|
}).watch();
|
|
260
|
-
var cmtid = context.$subscriber(context.topics.COMPONENT_MODAL_TOGGLE).on(function (
|
|
261
|
-
var toggle =
|
|
262
|
-
id =
|
|
364
|
+
var cmtid = context.$subscriber(context.topics.COMPONENT_MODAL_TOGGLE).on(function (_ref7) {
|
|
365
|
+
var toggle = _ref7.toggle,
|
|
366
|
+
id = _ref7.id;
|
|
263
367
|
if (toggle && id !== currentModal.current) {
|
|
264
|
-
|
|
368
|
+
var _canvas$current2;
|
|
369
|
+
(_canvas$current2 = canvas.current) === null || _canvas$current2 === void 0 || _canvas$current2.style.setProperty('overflow', 'hidden');
|
|
265
370
|
var _modal = context.componentMap.get(id);
|
|
266
371
|
var _prevModal = currentModal.current ? context.componentMap.get(currentModal.current) : null;
|
|
267
372
|
_prevModal === null || _prevModal === void 0 || _prevModal.api.doClose();
|
|
268
373
|
_modal.api.doOpen();
|
|
269
374
|
currentModal.current = id;
|
|
270
375
|
} else if (!toggle) {
|
|
271
|
-
|
|
376
|
+
var _canvas$current3;
|
|
377
|
+
(_canvas$current3 = canvas.current) === null || _canvas$current3 === void 0 || _canvas$current3.style.removeProperty('overflow');
|
|
272
378
|
var _id = id || currentModal.current;
|
|
273
379
|
if (_id) {
|
|
274
380
|
var _modal2 = context.componentMap.get(_id);
|
|
@@ -277,19 +383,21 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
277
383
|
}
|
|
278
384
|
}
|
|
279
385
|
}).watch();
|
|
280
|
-
var cdid = context.$subscriber(context.topics.COMPONENT_DELETE).on(function (
|
|
281
|
-
var id =
|
|
386
|
+
var cdid = context.$subscriber(context.topics.COMPONENT_DELETE).on(function (_ref8) {
|
|
387
|
+
var id = _ref8.id;
|
|
282
388
|
if (lastSelectorId.current === id) {
|
|
283
389
|
handleSelect();
|
|
284
390
|
}
|
|
285
391
|
deleteNode(id);
|
|
286
392
|
});
|
|
393
|
+
var dseid = context.$subscriber(context.topics.DESIGN_SHORTCUT_EMIT).on(handleShortcutEmit);
|
|
287
394
|
return function () {
|
|
288
395
|
context.$unsubscriber(context.topics.COMPONENT_SETTING_CLICK, csid);
|
|
289
396
|
context.$unsubscriber(context.topics.COMPONENT_HOVER, hcid);
|
|
290
397
|
context.$unsubscriber(context.topics.COMPONENT_ACTIVE, acid);
|
|
291
398
|
context.$unsubscriber(context.topics.MODAL_OPEN, cmtid);
|
|
292
399
|
context.$unsubscriber(context.topics.COMPONENT_DELETE, cdid);
|
|
400
|
+
context.$unsubscriber(context.topics.COMPONENT_DELETE, dseid);
|
|
293
401
|
};
|
|
294
402
|
}, []);
|
|
295
403
|
useEffect(function () {
|
|
@@ -1,39 +1,60 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
2
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
6
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
|
-
var _excluded = ["key", "label"];
|
|
9
5
|
import React, { useRef, useEffect, useState } from 'react';
|
|
10
|
-
import { useLocation } from 'umi';
|
|
6
|
+
import { useLocation, getCreateHistoryOptions } from 'umi';
|
|
11
7
|
import classNames from 'classnames';
|
|
12
|
-
import { useMemoizedFn, useRequest
|
|
13
|
-
import { Select,
|
|
8
|
+
import { useMemoizedFn, useRequest } from 'ahooks';
|
|
9
|
+
import { Select, Icon, Divider, Modal, message } from 'luck-design/antd';
|
|
14
10
|
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
15
11
|
import { useContext, useGet, resetPageData, setNeedPrompt, getNeedPrompt, useTemporalStore } from "../engine/provider/ContextProvider";
|
|
16
12
|
import JsonEditor from "../painter/components/code-editor/JsonEditor";
|
|
17
|
-
import
|
|
18
|
-
import { LC_BUILDIN_UNIT_KEY, COOKIE_VIRTUAL_ACCOUNT_KEY } from "../constants";
|
|
13
|
+
import { LC_BUILDIN_UNIT_KEY } from "../constants";
|
|
19
14
|
import styles from "./style/design.less";
|
|
20
|
-
import { fetchClearCache, fetchUpdatePageData
|
|
15
|
+
import { fetchClearCache, fetchUpdatePageData } from "../constants/api-url";
|
|
21
16
|
import { getLDMetaAttr } from "../engine/tools/helper";
|
|
22
17
|
import TipIcon from "./components/TipIcon";
|
|
18
|
+
import ShortcutModal from "./components/shortcut-modal";
|
|
23
19
|
var CodeSvg = function CodeSvg() {
|
|
24
20
|
return /*#__PURE__*/React.createElement("svg", {
|
|
25
21
|
width: "18",
|
|
26
22
|
height: "18",
|
|
27
23
|
viewBox: "0 0 18 18",
|
|
28
|
-
fill: "none"
|
|
29
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
24
|
+
fill: "none"
|
|
30
25
|
}, /*#__PURE__*/React.createElement("path", {
|
|
31
26
|
d: "M2.4749 9.0916L5.45264 6.20703L5.45439 5.93457V4.69707L0.91748 9.0916L5.45439 13.4844V12.2469L5.45264 11.9744L2.4749 9.0916ZM15.2067 9.00723L12.229 6.12441L12.2272 5.85195V4.61445L16.7642 9.00723L12.2272 13.4018V12.1625L12.229 11.89L15.2067 9.00723ZM8.12451 15.0295H6.76045L9.55713 2.80566H10.9212L8.12451 15.0295Z",
|
|
32
27
|
fill: "currentColor"
|
|
33
28
|
}));
|
|
34
29
|
};
|
|
30
|
+
var KeyboardSvg = function KeyboardSvg() {
|
|
31
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
32
|
+
fill: "none",
|
|
33
|
+
width: "18",
|
|
34
|
+
height: "18",
|
|
35
|
+
viewBox: "0 0 1024 1024"
|
|
36
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
37
|
+
fill: "currentColor",
|
|
38
|
+
d: "M800 544h-96a32 32 0 0 1 0-64h64v-128a32 32 0 0 1 64 0v160a32 32 0 0 1-32 32zM128 192h768a64 64 0 0 1 64 64v512a64 64 0 0 1-64 64H128a64 64 0 0 1-64-64V256a64 64 0 0 1 64-64z m32 64a32 32 0 0 0-32 32v448a32 32 0 0 0 32 32h704a32 32 0 0 0 32-32V288a32 32 0 0 0-32-32H160z m64 64h64a32 32 0 1 1 0 64H224a32 32 0 1 1 0-64z m192 0h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64z m192 0h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zM224 480h32a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64z m160 0h32a32 32 0 0 1 0 64h-32a32 32 0 0 1 0-64z m160 0h32a32 32 0 0 1 0 64h-32a32 32 0 0 1 0-64zM224 640h32a32 32 0 0 1 0 64H224a32 32 0 0 1 0-64z m160 0h256a32 32 0 0 1 0 64h-256a32 32 0 0 1 0-64z m384 0h32a32 32 0 0 1 0 64h-32a32 32 0 0 1 0-64z"
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
var clearSvg = function clearSvg() {
|
|
42
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
43
|
+
fill: "none",
|
|
44
|
+
viewBox: "0 0 1024 1024",
|
|
45
|
+
width: "18",
|
|
46
|
+
height: "18"
|
|
47
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
48
|
+
d: "M837.818182 915.549091h-131.956364c-12.8 0-23.272727-10.472727-23.272727-23.272727v-58.181819c0-4.189091-8.843636-11.636364-23.272727-11.636363s-23.272727 7.447273-23.272728 11.636363v58.181819c0 12.8-10.472727 23.272727-23.272727 23.272727H465.454545c-12.8 0-23.272727-10.472727-23.272727-23.272727s10.472727-23.272727 23.272727-23.272728h124.043637v-34.909091c0-32.581818 30.72-58.181818 69.818182-58.181818s69.818182 25.6 69.818181 58.181818v34.909091H814.545455v-232.727272H209.454545v232.727272h93.789091c12.8 0 23.272727 10.472727 23.272728 23.272728s-10.472727 23.272727-23.272728 23.272727H186.181818c-12.8 0-23.272727-10.472727-23.272727-23.272727v-279.272728c0-12.8 10.472727-23.272727 23.272727-23.272727h651.636364c12.8 0 23.272727 10.472727 23.272727 23.272727v279.272728c0 12.8-10.472727 23.272727-23.272727 23.272727z",
|
|
49
|
+
fill: "currentColor"
|
|
50
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
51
|
+
d: "M837.818182 636.276364H186.181818c-12.8 0-23.272727-10.472727-23.272727-23.272728v-69.818181c0-11.403636 8.145455-20.945455 19.316364-22.807273l244.596363-43.054546V124.276364c0-26.065455 23.970909-46.545455 54.225455-46.545455h62.138182c30.487273 0 54.225455 20.48 54.225454 46.545455V477.090909l244.596364 43.054546c11.170909 1.861818 19.316364 11.636364 19.316363 22.807272v69.818182A23.738182 23.738182 0 0 1 837.818182 636.276364z m-628.363637-46.545455h605.09091v-26.996364l-244.596364-43.054545a23.202909 23.202909 0 0 1-19.316364-22.807273V126.138182a13.172364 13.172364 0 0 0-7.68-2.094546h-62.138182c-3.723636 0-6.516364 1.163636-7.68 2.094546v370.269091c0 11.403636-8.145455 20.945455-19.316363 22.807272L209.454545 562.734545v26.996364z",
|
|
52
|
+
fill: "currentColor"
|
|
53
|
+
}));
|
|
54
|
+
};
|
|
35
55
|
var DesignToolbar = function DesignToolbar(_ref) {
|
|
36
|
-
var
|
|
56
|
+
var canvas = _ref.canvas,
|
|
57
|
+
locale = _ref.locale,
|
|
37
58
|
onLangChange = _ref.onLangChange;
|
|
38
59
|
var location = useLocation();
|
|
39
60
|
var editorRef = useRef();
|
|
@@ -53,12 +74,8 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
53
74
|
setShow = _useState6[1];
|
|
54
75
|
var _useState7 = useState(false),
|
|
55
76
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var _useState9 = useState([]),
|
|
59
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
60
|
-
userOptions = _useState10[0],
|
|
61
|
-
setUserOptions = _useState10[1];
|
|
77
|
+
showShortcut = _useState8[0],
|
|
78
|
+
setShowShortcut = _useState8[1];
|
|
62
79
|
var _useTemporalStore = useTemporalStore(function (state) {
|
|
63
80
|
return {
|
|
64
81
|
undo: state.undo,
|
|
@@ -71,10 +88,6 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
71
88
|
canRedo = _useTemporalStore.canRedo,
|
|
72
89
|
undo = _useTemporalStore.undo,
|
|
73
90
|
redo = _useTemporalStore.redo;
|
|
74
|
-
var _useCookieState = useCookieState(COOKIE_VIRTUAL_ACCOUNT_KEY),
|
|
75
|
-
_useCookieState2 = _slicedToArray(_useCookieState, 2),
|
|
76
|
-
userId = _useCookieState2[0],
|
|
77
|
-
setUserId = _useCookieState2[1];
|
|
78
91
|
var _useRequest = useRequest(fetchClearCache, {
|
|
79
92
|
manual: true
|
|
80
93
|
}),
|
|
@@ -86,20 +99,6 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
86
99
|
}),
|
|
87
100
|
updatePageDataLoading = _useRequest2.loading,
|
|
88
101
|
runAsync = _useRequest2.runAsync;
|
|
89
|
-
useEffect(function () {
|
|
90
|
-
var topicId = context.$subscriber(context.topics.LANG_SETTING_SELECT).on(function (_ref2) {
|
|
91
|
-
var _langList = _ref2.langList;
|
|
92
|
-
return setLangList(_langList);
|
|
93
|
-
}).watch();
|
|
94
|
-
return function () {
|
|
95
|
-
return context.$unsubscriber(context.topics.LANG_SETTING_SELECT, topicId);
|
|
96
|
-
};
|
|
97
|
-
}, []);
|
|
98
|
-
useEffect(function () {
|
|
99
|
-
if (!showPreview) {
|
|
100
|
-
setUserId(void 0);
|
|
101
|
-
}
|
|
102
|
-
}, [showPreview]);
|
|
103
102
|
var handleSave = useMemoizedFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
104
103
|
var _yield$runAsync, code;
|
|
105
104
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -144,6 +143,17 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
144
143
|
}
|
|
145
144
|
}, _callee);
|
|
146
145
|
})), []);
|
|
146
|
+
useEffect(function () {
|
|
147
|
+
var lssid = context.$subscriber(context.topics.LANG_SETTING_SELECT).on(function (_ref3) {
|
|
148
|
+
var _langList = _ref3.langList;
|
|
149
|
+
setLangList(_langList);
|
|
150
|
+
}).watch();
|
|
151
|
+
var dasid = context.$subscriber(context.topics.DESIGN_OPERATE_SAVE).on(handleSave).watch();
|
|
152
|
+
return function () {
|
|
153
|
+
context.$unsubscriber(context.topics.LANG_SETTING_SELECT, lssid);
|
|
154
|
+
context.$unsubscriber(context.topics.DESIGN_OPERATE_SAVE, dasid);
|
|
155
|
+
};
|
|
156
|
+
}, []);
|
|
147
157
|
var handleClearCache = useMemoizedFn(function () {
|
|
148
158
|
Modal.confirm({
|
|
149
159
|
title: formatMessage({
|
|
@@ -178,43 +188,6 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
178
188
|
}));
|
|
179
189
|
}
|
|
180
190
|
});
|
|
181
|
-
var _useDebounceFn = useDebounceFn( /*#__PURE__*/function () {
|
|
182
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(value) {
|
|
183
|
-
var _yield$fetchSearchUse, code, list, detail;
|
|
184
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
185
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
186
|
-
case 0:
|
|
187
|
-
_context2.next = 2;
|
|
188
|
-
return fetchSearchUser({
|
|
189
|
-
sname: value
|
|
190
|
-
});
|
|
191
|
-
case 2:
|
|
192
|
-
_yield$fetchSearchUse = _context2.sent;
|
|
193
|
-
code = _yield$fetchSearchUse.code;
|
|
194
|
-
list = _yield$fetchSearchUse.list;
|
|
195
|
-
detail = _yield$fetchSearchUse.detail;
|
|
196
|
-
if (code === 1) {
|
|
197
|
-
setUserOptions(list.map(function (id) {
|
|
198
|
-
var item = detail[id];
|
|
199
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
200
|
-
key: "".concat(item.indocno),
|
|
201
|
-
label: item.sname
|
|
202
|
-
});
|
|
203
|
-
}));
|
|
204
|
-
}
|
|
205
|
-
case 7:
|
|
206
|
-
case "end":
|
|
207
|
-
return _context2.stop();
|
|
208
|
-
}
|
|
209
|
-
}, _callee2);
|
|
210
|
-
}));
|
|
211
|
-
return function (_x) {
|
|
212
|
-
return _ref4.apply(this, arguments);
|
|
213
|
-
};
|
|
214
|
-
}(), {
|
|
215
|
-
wait: 500
|
|
216
|
-
}),
|
|
217
|
-
handleSearch = _useDebounceFn.run;
|
|
218
191
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
219
192
|
className: styles['lc-painter-design-toolbar']
|
|
220
193
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
@@ -299,18 +272,37 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
299
272
|
label: '页面属性'
|
|
300
273
|
})), /*#__PURE__*/React.createElement(Divider, {
|
|
301
274
|
type: "vertical"
|
|
302
|
-
}), /*#__PURE__*/React.createElement(
|
|
303
|
-
|
|
275
|
+
}), /*#__PURE__*/React.createElement(TipIcon, {
|
|
276
|
+
title: formatMessage({
|
|
277
|
+
id: 'luckda.lowcode.design.toolbar.shortcut',
|
|
278
|
+
label: '快捷键'
|
|
279
|
+
}),
|
|
280
|
+
component: KeyboardSvg,
|
|
281
|
+
className: styles.hoverPrimary,
|
|
304
282
|
style: {
|
|
305
283
|
fontSize: 14,
|
|
306
|
-
margin: '0
|
|
284
|
+
margin: '0 8px 0 6px'
|
|
307
285
|
},
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
286
|
+
onClick: function onClick() {
|
|
287
|
+
return setShowShortcut(true);
|
|
288
|
+
}
|
|
289
|
+
}), /*#__PURE__*/React.createElement(TipIcon, {
|
|
290
|
+
title: formatMessage({
|
|
291
|
+
id: 'luckda.lowcode.design.toolbar.code',
|
|
292
|
+
label: 'Schema面板'
|
|
293
|
+
}),
|
|
294
|
+
component: CodeSvg,
|
|
295
|
+
className: styles.hoverPrimary,
|
|
296
|
+
style: {
|
|
297
|
+
fontSize: 14,
|
|
298
|
+
margin: '0 8px 0 6px'
|
|
299
|
+
},
|
|
300
|
+
onClick: function onClick() {
|
|
301
|
+
if (!updatePageDataLoading) setShow(true);
|
|
302
|
+
}
|
|
303
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
304
|
+
type: "vertical"
|
|
305
|
+
}), /*#__PURE__*/React.createElement(TipIcon, {
|
|
314
306
|
title: formatMessage({
|
|
315
307
|
id: 'luckda.lowcode.design.toolbar.debug',
|
|
316
308
|
label: '调试'
|
|
@@ -321,51 +313,34 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
321
313
|
margin: '0 8px 0 6px'
|
|
322
314
|
},
|
|
323
315
|
className: styles.hoverPrimary,
|
|
324
|
-
onClick:
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
_context3.next = 4;
|
|
337
|
-
return handleSave();
|
|
338
|
-
case 4:
|
|
339
|
-
context.$publisher(context.topics.COMPONENT_ACTIVE, null);
|
|
340
|
-
setShowPreview(true);
|
|
341
|
-
case 6:
|
|
342
|
-
case "end":
|
|
343
|
-
return _context3.stop();
|
|
316
|
+
onClick: function onClick() {
|
|
317
|
+
if (!updatePageDataLoading) {
|
|
318
|
+
var _getCreateHistoryOpti = getCreateHistoryOptions(),
|
|
319
|
+
basename = _getCreateHistoryOpti.basename;
|
|
320
|
+
var previewUrl = "".concat(basename === '/' ? '' : basename, "/byteman/preview/").concat(location.query.code);
|
|
321
|
+
if (getNeedPrompt()) {
|
|
322
|
+
context.$publisherOnce(context.topics.DESIGN_OPERATE_SAVE).then(function () {
|
|
323
|
+
window.open(previewUrl, '_blank');
|
|
324
|
+
});
|
|
325
|
+
} else {
|
|
326
|
+
window.open(previewUrl, '_blank');
|
|
344
327
|
}
|
|
345
|
-
|
|
346
|
-
|
|
328
|
+
context.$publisher(context.topics.COMPONENT_ACTIVE, null);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
347
331
|
}), /*#__PURE__*/React.createElement(TipIcon, {
|
|
348
332
|
title: formatMessage({
|
|
349
|
-
id: 'luckda.lowcode.design.toolbar.
|
|
350
|
-
label: '
|
|
333
|
+
id: 'luckda.lowcode.design.toolbar.clear',
|
|
334
|
+
label: '清除缓存'
|
|
351
335
|
}),
|
|
352
|
-
component:
|
|
336
|
+
component: clearSvg,
|
|
353
337
|
className: styles.hoverPrimary,
|
|
338
|
+
loading: clearCacheLoading,
|
|
354
339
|
style: {
|
|
355
340
|
fontSize: 14,
|
|
356
341
|
margin: '0 8px 0 6px'
|
|
357
342
|
},
|
|
358
|
-
onClick:
|
|
359
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
360
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
361
|
-
case 0:
|
|
362
|
-
if (!updatePageDataLoading) setShow(true);
|
|
363
|
-
case 1:
|
|
364
|
-
case "end":
|
|
365
|
-
return _context4.stop();
|
|
366
|
-
}
|
|
367
|
-
}, _callee4);
|
|
368
|
-
}))
|
|
343
|
+
onClick: handleClearCache
|
|
369
344
|
}), /*#__PURE__*/React.createElement(TipIcon, {
|
|
370
345
|
title: formatMessage({
|
|
371
346
|
id: 'luckda.lowcode.design.toolbar.save',
|
|
@@ -377,7 +352,9 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
377
352
|
fontSize: 14,
|
|
378
353
|
margin: '0 11px 0 5px'
|
|
379
354
|
},
|
|
380
|
-
onClick:
|
|
355
|
+
onClick: function onClick() {
|
|
356
|
+
return context.$publisher(context.topics.DESIGN_OPERATE_SAVE);
|
|
357
|
+
}
|
|
381
358
|
})), /*#__PURE__*/React.createElement(Modal, {
|
|
382
359
|
visible: show,
|
|
383
360
|
width: 1024,
|
|
@@ -393,75 +370,12 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
393
370
|
style: {
|
|
394
371
|
height: '70vh'
|
|
395
372
|
}
|
|
396
|
-
}, JSON.stringify(pageData, null, '\t'))), /*#__PURE__*/React.createElement(
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
style: {
|
|
400
|
-
display: 'flex',
|
|
401
|
-
height: 54,
|
|
402
|
-
alignItems: 'center',
|
|
403
|
-
justifyContent: 'space-between'
|
|
404
|
-
}
|
|
405
|
-
}, /*#__PURE__*/React.createElement("h3", {
|
|
406
|
-
style: {
|
|
407
|
-
marginBottom: 0
|
|
408
|
-
}
|
|
409
|
-
}, formatMessage({
|
|
410
|
-
id: 'luckda.lowcode.design.toolbar.pagePreview',
|
|
411
|
-
label: '页面预览'
|
|
412
|
-
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Select, {
|
|
413
|
-
placeholder: formatMessage({
|
|
414
|
-
id: 'luckda.lowcode.design.toolbar.selectUser',
|
|
415
|
-
label: '请选择模拟登录人'
|
|
416
|
-
}),
|
|
417
|
-
allowClear: true,
|
|
418
|
-
style: {
|
|
419
|
-
width: 180
|
|
420
|
-
},
|
|
421
|
-
filterOption: false,
|
|
422
|
-
labelInValue: true,
|
|
423
|
-
showSearch: true,
|
|
424
|
-
getPopupContainer: function getPopupContainer() {
|
|
425
|
-
return document.getElementById('preview-drawer-header').closest('.ant-drawer-wrapper-body');
|
|
426
|
-
},
|
|
427
|
-
onSearch: handleSearch,
|
|
428
|
-
onChange: function onChange(_, _opt) {
|
|
429
|
-
if (_opt) {
|
|
430
|
-
setUserId(_opt.props.sloginid);
|
|
431
|
-
} else {
|
|
432
|
-
setUserId(void 0);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}, userOptions.map(function (_ref7) {
|
|
436
|
-
var key = _ref7.key,
|
|
437
|
-
label = _ref7.label,
|
|
438
|
-
rest = _objectWithoutProperties(_ref7, _excluded);
|
|
439
|
-
return /*#__PURE__*/React.createElement(Select.Option, _extends({
|
|
440
|
-
key: key,
|
|
441
|
-
value: key
|
|
442
|
-
}, rest), label);
|
|
443
|
-
})))),
|
|
444
|
-
placement: "bottom",
|
|
445
|
-
height: "94vh",
|
|
446
|
-
footer: false,
|
|
447
|
-
headerStyle: {
|
|
448
|
-
padding: '0 48px 0 24px'
|
|
449
|
-
},
|
|
450
|
-
bodyStyle: {
|
|
451
|
-
height: 'calc(100% - 54px)',
|
|
452
|
-
backgroundColor: 'var(--ant-component-background,#F0F2F5)'
|
|
453
|
-
},
|
|
454
|
-
visible: showPreview,
|
|
455
|
-
destroyOnClose: true,
|
|
373
|
+
}, JSON.stringify(pageData, null, '\t'))), /*#__PURE__*/React.createElement(ShortcutModal, {
|
|
374
|
+
target: canvas,
|
|
375
|
+
show: showShortcut,
|
|
456
376
|
onClose: function onClose() {
|
|
457
|
-
return
|
|
458
|
-
},
|
|
459
|
-
getContainer: function getContainer() {
|
|
460
|
-
return document.getElementById('lc-design-workspace');
|
|
377
|
+
return setShowShortcut(false);
|
|
461
378
|
}
|
|
462
|
-
}
|
|
463
|
-
code: location.query.code,
|
|
464
|
-
userId: userId
|
|
465
|
-
})));
|
|
379
|
+
}));
|
|
466
380
|
};
|
|
467
381
|
export default DesignToolbar;
|