@luck-design-biz/luckda 1.0.0-alpha → 1.0.1
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 +15 -3
- package/es/components/ComplexItem/index.js +65 -49
- package/es/components/LdAutoForm/index.js +4 -3
- package/es/components/LdFormList/index.js +3 -6
- package/es/components/LdGridForm/index.js +2 -1
- package/es/helper/form.js +1 -0
- package/es/helper/ldBuilder.js +8 -3
- package/es/locales/zh-CN.js +38 -4
- package/es/lowcode/constants/event-topics.js +0 -2
- package/es/lowcode/engine/launcher.js +3 -1
- package/es/lowcode/engine/meta/box.props.json +3 -3
- package/es/lowcode/engine/meta/button.props.default.json +1 -1
- package/es/lowcode/engine/meta/button.props.json +2 -2
- package/es/lowcode/engine/meta/dialog.props.json +2 -2
- package/es/lowcode/engine/meta/fieldcomplex.props.default.json +1 -0
- package/es/lowcode/engine/meta/fieldcomplex.props.json +7 -0
- package/es/lowcode/engine/meta/fielddate.props.default.json +2 -0
- package/es/lowcode/engine/meta/fielddate.props.json +4 -2
- package/es/lowcode/engine/meta/fieldnumber.props.default.json +1 -0
- package/es/lowcode/engine/meta/fieldnumber.props.json +3 -2
- package/es/lowcode/engine/meta/fielduser.props.default.json +1 -1
- package/es/lowcode/engine/meta/fielduser.props.json +1 -1
- package/es/lowcode/engine/meta/form.props.default.json +0 -1
- package/es/lowcode/engine/meta/form.props.json +4 -5
- package/es/lowcode/engine/meta/iframe.props.default.json +1 -1
- package/es/lowcode/engine/meta/iframe.props.json +1 -1
- package/es/lowcode/engine/meta/image.props.default.json +1 -1
- package/es/lowcode/engine/meta/image.props.json +1 -1
- package/es/lowcode/engine/meta/imex.props.default.json +2 -1
- package/es/lowcode/engine/meta/imex.props.json +26 -5
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +38 -20
- package/es/lowcode/engine/meta/jsx.props.default.json +1 -1
- package/es/lowcode/engine/meta/jsx.props.json +1 -1
- package/es/lowcode/engine/meta/layout.props.default.json +1 -1
- package/es/lowcode/engine/meta/layout.props.json +5 -5
- package/es/lowcode/engine/meta/link.props.default.json +1 -1
- package/es/lowcode/engine/meta/link.props.json +1 -1
- package/es/lowcode/engine/meta/page.props.json +6 -0
- package/es/lowcode/engine/meta/pagelayout.props.default.json +1 -1
- package/es/lowcode/engine/meta/pagelayout.props.json +1 -1
- package/es/lowcode/engine/meta/section.props.json +2 -1
- package/es/lowcode/engine/meta/split.props.default.json +1 -1
- package/es/lowcode/engine/meta/split.props.json +1 -1
- package/es/lowcode/engine/meta/table.props.json +2 -2
- package/es/lowcode/engine/meta/text.props.default.json +4 -2
- package/es/lowcode/engine/meta/text.props.json +8 -6
- package/es/lowcode/engine/provider/ContextProvider/index.js +63 -46
- package/es/lowcode/engine/provider/ContextProvider/router.js +43 -0
- package/es/lowcode/engine/{tools → provider/ContextProvider}/usePageDataStore.js +9 -7
- package/es/lowcode/engine/provider/ContextProvider/usePageVar.js +38 -15
- package/es/lowcode/engine/{tools → provider/ContextProvider}/useTodo.js +5 -7
- package/es/lowcode/engine/provider/ContextProvider/utils.js +157 -0
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +1 -2
- package/es/lowcode/engine/tools/helper.js +7 -2
- package/es/lowcode/engine/tools/initDS.js +263 -0
- package/es/lowcode/engine/tools/useCombinedRefs.js +3 -2
- package/es/lowcode/painter/DesignOperator.js +10 -1
- package/es/lowcode/painter/Panel.js +2 -2
- package/es/lowcode/painter/components/AdvancePanel.js +3 -3
- package/es/lowcode/painter/components/Collapse.js +5 -2
- package/es/lowcode/painter/components/TipIcon.js +16 -0
- package/es/lowcode/painter/components/VarEditor.js +456 -0
- package/es/lowcode/painter/components/code-editor/FullScreenEditor.js +2 -2
- package/es/lowcode/painter/components/code-editor/JSEditor.js +3 -1
- package/es/lowcode/painter/components/code-editor/VisionEditor.js +81 -0
- package/es/lowcode/painter/components/field-setting/SettingUI.js +17 -3
- package/es/lowcode/painter/components/field-setting/index.js +1 -1
- package/es/lowcode/painter/components/field-setting/meta/frontRules.js +2 -1
- package/es/lowcode/painter/index.js +1 -0
- package/es/lowcode/painter/panel-section/BlockEditor/index.js +20 -6
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +2 -2
- package/es/lowcode/painter/panel-section/ComplexPop.js +242 -0
- package/es/lowcode/painter/panel-section/DataSetSelector.js +8 -0
- package/es/lowcode/painter/panel-section/FieldsSetting.js +29 -3
- package/es/lowcode/painter/panel-section/I18nInput.js +4 -2
- package/es/lowcode/painter/panel-section/Icon.js +9 -4
- package/es/lowcode/painter/panel-section/IconConditionSelector.js +7 -7
- package/es/lowcode/painter/panel-section/IconSelector.js +1 -1
- package/es/lowcode/painter/panel-section/ImpExp.js +1 -27
- package/es/lowcode/painter/panel-section/ImpExpAlone.js +1 -2
- package/es/lowcode/painter/panel-section/LayoutRatio.js +1 -0
- package/es/lowcode/painter/panel-section/PageVars.js +300 -0
- package/es/lowcode/painter/panel-section/StylePanel/StyleContext.js +4 -3
- package/es/lowcode/painter/panel-section/TabItems.js +6 -42
- package/es/lowcode/painter/panel-section/TextContent.js +79 -0
- package/es/lowcode/painter/services/complexPop.js +21 -0
- package/es/lowcode/painter/style/design.less +1 -1
- package/es/lowcode/painter/style/page-vars.less +25 -0
- package/es/lowcode/preview/index.js +1 -0
- package/es/lowcode/view/Canvas.js +24 -22
- package/es/lowcode/view/Loading.js +5 -7
- package/es/lowcode/view/Page.js +37 -15
- package/es/lowcode/view/index.js +1 -0
- package/es/lowcode/view/lc-components/Box/index.js +18 -3
- package/es/lowcode/view/lc-components/Box/meta.json +3 -3
- package/es/lowcode/view/lc-components/Button/index.js +7 -7
- package/es/lowcode/view/lc-components/Button/meta.json +2 -2
- package/es/lowcode/view/lc-components/Dialog/index.js +6 -7
- package/es/lowcode/view/lc-components/Dialog/meta.json +2 -2
- package/es/lowcode/view/lc-components/FieldComplex/meta.json +7 -0
- package/es/lowcode/view/lc-components/FieldDate/meta.json +4 -2
- package/es/lowcode/view/lc-components/FieldNumber/meta.json +3 -2
- package/es/lowcode/view/lc-components/FieldUser/meta.json +1 -1
- package/es/lowcode/view/lc-components/Form/index.js +14 -6
- package/es/lowcode/view/lc-components/Form/meta.json +4 -5
- package/es/lowcode/view/lc-components/Iframe/meta.json +1 -1
- package/es/lowcode/view/lc-components/ImEx/index.js +174 -103
- package/es/lowcode/view/lc-components/ImEx/meta.json +26 -5
- package/es/lowcode/view/lc-components/Image/meta.json +1 -1
- package/es/lowcode/view/lc-components/JSX/meta.json +1 -1
- package/es/lowcode/view/lc-components/Layout/index.js +22 -5
- package/es/lowcode/view/lc-components/Layout/meta.json +5 -5
- package/es/lowcode/view/lc-components/Link/meta.json +1 -1
- package/es/lowcode/view/lc-components/Page/meta.json +6 -0
- package/es/lowcode/view/lc-components/PageLayout/FunctionDesign.js +5 -1
- package/es/lowcode/view/lc-components/PageLayout/meta.json +1 -1
- package/es/lowcode/view/lc-components/Section/index.js +2 -6
- package/es/lowcode/view/lc-components/Section/meta.json +2 -1
- package/es/lowcode/view/lc-components/Split/index.js +19 -4
- package/es/lowcode/view/lc-components/Split/meta.json +1 -1
- package/es/lowcode/view/lc-components/Table/index.js +29 -3
- package/es/lowcode/view/lc-components/Table/meta.json +2 -2
- package/es/lowcode/view/lc-components/Tabs/index.js +19 -16
- package/es/lowcode/view/lc-components/Text/index.js +9 -2
- package/es/lowcode/view/lc-components/Text/meta.json +6 -6
- package/es/lowcode/view/lc-components/Wrapper.js +17 -2
- package/es/lowcode/view/style/loading.less +14 -0
- package/es/services.js +19 -0
- package/es/upload/Form/gridForm.js +17 -7
- package/es/upload/FormItem/index.js +6 -6
- package/es/utils/form.js +4 -4
- package/es/utils/grid.js +2 -1
- package/lib/components/Builder/index.js +13 -1
- package/lib/components/ComplexItem/index.js +62 -47
- package/lib/components/LdAutoForm/index.js +3 -2
- package/lib/components/LdFormList/index.js +5 -8
- package/lib/components/LdGridForm/index.js +2 -1
- package/lib/helper/form.js +1 -0
- package/lib/helper/ldBuilder.js +8 -3
- package/lib/locales/zh-CN.js +38 -4
- package/lib/lowcode/constants/event-topics.js +1 -3
- package/lib/lowcode/engine/launcher.js +3 -1
- package/lib/lowcode/engine/meta/box.props.json +3 -3
- package/lib/lowcode/engine/meta/button.props.default.json +1 -1
- package/lib/lowcode/engine/meta/button.props.json +2 -2
- package/lib/lowcode/engine/meta/dialog.props.json +2 -2
- package/lib/lowcode/engine/meta/fieldcomplex.props.default.json +1 -0
- package/lib/lowcode/engine/meta/fieldcomplex.props.json +7 -0
- package/lib/lowcode/engine/meta/fielddate.props.default.json +2 -0
- package/lib/lowcode/engine/meta/fielddate.props.json +4 -2
- package/lib/lowcode/engine/meta/fieldnumber.props.default.json +1 -0
- package/lib/lowcode/engine/meta/fieldnumber.props.json +3 -2
- package/lib/lowcode/engine/meta/fielduser.props.default.json +1 -1
- package/lib/lowcode/engine/meta/fielduser.props.json +1 -1
- package/lib/lowcode/engine/meta/form.props.default.json +0 -1
- package/lib/lowcode/engine/meta/form.props.json +4 -5
- package/lib/lowcode/engine/meta/iframe.props.default.json +1 -1
- package/lib/lowcode/engine/meta/iframe.props.json +1 -1
- package/lib/lowcode/engine/meta/image.props.default.json +1 -1
- package/lib/lowcode/engine/meta/image.props.json +1 -1
- package/lib/lowcode/engine/meta/imex.props.default.json +2 -1
- package/lib/lowcode/engine/meta/imex.props.json +26 -5
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +38 -20
- package/lib/lowcode/engine/meta/jsx.props.default.json +1 -1
- package/lib/lowcode/engine/meta/jsx.props.json +1 -1
- package/lib/lowcode/engine/meta/layout.props.default.json +1 -1
- package/lib/lowcode/engine/meta/layout.props.json +5 -5
- package/lib/lowcode/engine/meta/link.props.default.json +1 -1
- package/lib/lowcode/engine/meta/link.props.json +1 -1
- package/lib/lowcode/engine/meta/page.props.json +6 -0
- package/lib/lowcode/engine/meta/pagelayout.props.default.json +1 -1
- package/lib/lowcode/engine/meta/pagelayout.props.json +1 -1
- package/lib/lowcode/engine/meta/section.props.json +2 -1
- package/lib/lowcode/engine/meta/split.props.default.json +1 -1
- package/lib/lowcode/engine/meta/split.props.json +1 -1
- package/lib/lowcode/engine/meta/table.props.json +2 -2
- package/lib/lowcode/engine/meta/text.props.default.json +4 -2
- package/lib/lowcode/engine/meta/text.props.json +8 -6
- package/lib/lowcode/engine/provider/ContextProvider/index.js +61 -44
- package/lib/lowcode/engine/provider/ContextProvider/router.js +57 -0
- package/lib/lowcode/engine/{tools → provider/ContextProvider}/usePageDataStore.js +9 -7
- package/lib/lowcode/engine/provider/ContextProvider/usePageVar.js +38 -16
- package/lib/lowcode/engine/{tools → provider/ContextProvider}/useTodo.js +5 -7
- package/lib/lowcode/engine/provider/ContextProvider/utils.js +170 -0
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +2 -3
- package/lib/lowcode/engine/tools/helper.js +7 -2
- package/lib/lowcode/engine/tools/initDS.js +270 -0
- package/lib/lowcode/engine/tools/useCombinedRefs.js +2 -1
- package/lib/lowcode/painter/DesignOperator.js +9 -0
- package/lib/lowcode/painter/Panel.js +2 -2
- package/lib/lowcode/painter/components/AdvancePanel.js +3 -3
- package/lib/lowcode/painter/components/Collapse.js +5 -2
- package/lib/lowcode/painter/components/TipIcon.js +23 -0
- package/lib/lowcode/painter/components/VarEditor.js +463 -0
- package/lib/lowcode/painter/components/code-editor/FullScreenEditor.js +2 -2
- package/lib/lowcode/painter/components/code-editor/JSEditor.js +3 -1
- package/lib/lowcode/painter/components/code-editor/VisionEditor.js +88 -0
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +17 -3
- package/lib/lowcode/painter/components/field-setting/index.js +1 -1
- package/lib/lowcode/painter/components/field-setting/meta/frontRules.js +2 -1
- package/lib/lowcode/painter/index.js +1 -0
- package/lib/lowcode/painter/panel-section/BlockEditor/index.js +19 -5
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +2 -2
- package/lib/lowcode/painter/panel-section/ComplexPop.js +250 -0
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +8 -0
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +29 -3
- package/lib/lowcode/painter/panel-section/I18nInput.js +4 -2
- package/lib/lowcode/painter/panel-section/Icon.js +8 -3
- package/lib/lowcode/painter/panel-section/IconConditionSelector.js +6 -6
- package/lib/lowcode/painter/panel-section/IconSelector.js +1 -1
- package/lib/lowcode/painter/panel-section/ImpExp.js +0 -26
- package/lib/lowcode/painter/panel-section/ImpExpAlone.js +0 -1
- package/lib/lowcode/painter/panel-section/LayoutRatio.js +1 -0
- package/lib/lowcode/painter/panel-section/PageVars.js +308 -0
- package/lib/lowcode/painter/panel-section/StylePanel/StyleContext.js +4 -3
- package/lib/lowcode/painter/panel-section/TabItems.js +6 -42
- package/lib/lowcode/painter/panel-section/TextContent.js +87 -0
- package/lib/lowcode/painter/services/complexPop.js +28 -0
- package/lib/lowcode/painter/style/design.less +1 -1
- package/lib/lowcode/painter/style/page-vars.less +25 -0
- package/lib/lowcode/preview/index.js +1 -0
- package/lib/lowcode/view/Canvas.js +24 -22
- package/lib/lowcode/view/Loading.js +5 -7
- package/lib/lowcode/view/Page.js +35 -13
- package/lib/lowcode/view/index.js +1 -0
- package/lib/lowcode/view/lc-components/Box/index.js +17 -2
- package/lib/lowcode/view/lc-components/Box/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Button/index.js +5 -5
- package/lib/lowcode/view/lc-components/Button/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Dialog/index.js +6 -7
- package/lib/lowcode/view/lc-components/Dialog/meta.json +2 -2
- package/lib/lowcode/view/lc-components/FieldComplex/meta.json +7 -0
- package/lib/lowcode/view/lc-components/FieldDate/meta.json +4 -2
- package/lib/lowcode/view/lc-components/FieldNumber/meta.json +3 -2
- package/lib/lowcode/view/lc-components/FieldUser/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Form/index.js +14 -6
- package/lib/lowcode/view/lc-components/Form/meta.json +4 -5
- package/lib/lowcode/view/lc-components/Iframe/meta.json +1 -1
- package/lib/lowcode/view/lc-components/ImEx/index.js +172 -101
- package/lib/lowcode/view/lc-components/ImEx/meta.json +26 -5
- package/lib/lowcode/view/lc-components/Image/meta.json +1 -1
- package/lib/lowcode/view/lc-components/JSX/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Layout/index.js +21 -4
- package/lib/lowcode/view/lc-components/Layout/meta.json +5 -5
- package/lib/lowcode/view/lc-components/Link/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Page/meta.json +6 -0
- package/lib/lowcode/view/lc-components/PageLayout/FunctionDesign.js +5 -1
- package/lib/lowcode/view/lc-components/PageLayout/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Section/index.js +2 -6
- package/lib/lowcode/view/lc-components/Section/meta.json +2 -1
- package/lib/lowcode/view/lc-components/Split/index.js +18 -3
- package/lib/lowcode/view/lc-components/Split/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Table/index.js +30 -4
- package/lib/lowcode/view/lc-components/Table/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Tabs/index.js +17 -14
- package/lib/lowcode/view/lc-components/Text/index.js +8 -1
- package/lib/lowcode/view/lc-components/Text/meta.json +6 -6
- package/lib/lowcode/view/lc-components/Wrapper.js +16 -1
- package/lib/lowcode/view/style/loading.less +14 -0
- package/lib/services.js +20 -0
- package/lib/upload/Form/gridForm.js +17 -7
- package/lib/upload/FormItem/index.js +6 -6
- package/lib/utils/form.js +3 -3
- package/lib/utils/grid.js +2 -1
- package/package.json +3 -3
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { history } from 'umi';
|
|
2
|
+
import { isNil } from 'lodash';
|
|
3
|
+
export function push(path, params) {
|
|
4
|
+
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'push';
|
|
5
|
+
var blank = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
6
|
+
if (blank) {
|
|
7
|
+
window.openUrl("new:".concat(path));
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (type === 'replace') {
|
|
11
|
+
window.openUrl(path, {
|
|
12
|
+
method: 'replace'
|
|
13
|
+
});
|
|
14
|
+
} else if (type === 'layer') {
|
|
15
|
+
window.openUrl("layer:".concat(path), params);
|
|
16
|
+
} else if (type === 'iframe') {
|
|
17
|
+
window.openUrl("iframe:".concat(path));
|
|
18
|
+
} else if (type === 'sso') {
|
|
19
|
+
window.openUrl("sso:".concat(path));
|
|
20
|
+
} else {
|
|
21
|
+
history[type](path, params);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function replace(path, state) {
|
|
25
|
+
history.replace(path, state);
|
|
26
|
+
}
|
|
27
|
+
export function getQuery(key) {
|
|
28
|
+
var toSearch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
29
|
+
if (toSearch) {
|
|
30
|
+
return history.location.search;
|
|
31
|
+
}
|
|
32
|
+
var query = history.location.query;
|
|
33
|
+
if (isNil(key)) {
|
|
34
|
+
return query;
|
|
35
|
+
}
|
|
36
|
+
return query[key];
|
|
37
|
+
}
|
|
38
|
+
export function stringifyQuery(params) {
|
|
39
|
+
return Object.keys(params).map(function (key) {
|
|
40
|
+
return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(params[key]));
|
|
41
|
+
}).join('&');
|
|
42
|
+
}
|
|
43
|
+
export { history };
|
|
@@ -7,8 +7,8 @@ import { subscribeWithSelector } from 'zustand/middleware';
|
|
|
7
7
|
import { useShallow } from 'zustand/react/shallow';
|
|
8
8
|
import { isObject, isArray, isNil, isFunction, isString, get, set as _set, unset, assign, forOwn, forEach, omit, debounce } from 'lodash';
|
|
9
9
|
import isDeepEqual from 'fast-deep-equal';
|
|
10
|
-
import { getPathNodesById, findNodeAndParent } from "
|
|
11
|
-
import { LC_BUILDIN_UNIT_KEY } from "
|
|
10
|
+
import { getPathNodesById, findNodeAndParent } from "../../tools/dataProcess";
|
|
11
|
+
import { LC_BUILDIN_UNIT_KEY } from "../../../constants";
|
|
12
12
|
var temporalStateCreator = function temporalStateCreator(userSet, userGet, options) {
|
|
13
13
|
var stateCreator = function stateCreator(set, get) {
|
|
14
14
|
return {
|
|
@@ -184,11 +184,13 @@ export default usePageDataStore;
|
|
|
184
184
|
usePageDataStore.subscribe(function (state) {
|
|
185
185
|
return state.pageData;
|
|
186
186
|
}, function (_, prev) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
})
|
|
191
|
-
|
|
187
|
+
usePageDataStore.setState(function (state) {
|
|
188
|
+
if (prev === null) {
|
|
189
|
+
state.needPrompt = false;
|
|
190
|
+
} else if (state.needPrompt === false) {
|
|
191
|
+
state.needPrompt = true;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
192
194
|
});
|
|
193
195
|
export var resetPageData = function resetPageData(data) {
|
|
194
196
|
usePageDataStore.setState(function (state) {
|
|
@@ -1,18 +1,42 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
1
|
import { useRef } from 'react';
|
|
4
|
-
import {
|
|
2
|
+
import { useMemoizedFn } from 'ahooks';
|
|
3
|
+
import { create } from 'zustand';
|
|
4
|
+
import { immer } from 'zustand/middleware/immer';
|
|
5
|
+
import { subscribeWithSelector } from 'zustand/middleware';
|
|
5
6
|
import { forOwn, isNil, isString, isObject } from 'lodash';
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
export var useStateStore = create()(immer(subscribeWithSelector(function (set) {
|
|
8
|
+
return {
|
|
9
|
+
state: {},
|
|
10
|
+
initialize: function initialize(init) {
|
|
11
|
+
return set(function (store) {
|
|
12
|
+
store.state = init;
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
clear: function clear() {
|
|
16
|
+
return set(function (store) {
|
|
17
|
+
store.state = {};
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
})));
|
|
22
|
+
var usePageVar = function usePageVar() {
|
|
23
|
+
var globalRef = useRef(null);
|
|
24
|
+
var state = useStateStore(function (store) {
|
|
25
|
+
return store.state;
|
|
26
|
+
});
|
|
27
|
+
var setState = useMemoizedFn(function (newState) {
|
|
28
|
+
useStateStore.setState(function (store) {
|
|
29
|
+
forOwn(newState, function (_val, _key) {
|
|
30
|
+
if (isNil(_val)) {
|
|
31
|
+
delete store.state[_key];
|
|
32
|
+
} else {
|
|
33
|
+
store.state[_key] = _val;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
var getState = useMemoizedFn(function () {
|
|
39
|
+
return useStateStore.getState().state;
|
|
16
40
|
});
|
|
17
41
|
var setGlobal = useMemoizedFn(function (newGlobal) {
|
|
18
42
|
if (isNil(globalRef.current)) {
|
|
@@ -28,8 +52,7 @@ var usePageVar = function usePageVar(defaultState, defaultGlobal) {
|
|
|
28
52
|
});
|
|
29
53
|
return {
|
|
30
54
|
state: state,
|
|
31
|
-
|
|
32
|
-
setState: setPageState,
|
|
55
|
+
setState: setState,
|
|
33
56
|
getState: getState,
|
|
34
57
|
global: globalRef,
|
|
35
58
|
setGlobal: setGlobal
|
|
@@ -6,9 +6,9 @@ var _excluded = ["datasetCode"];
|
|
|
6
6
|
import { useBoolean, useMemoizedFn } from 'ahooks';
|
|
7
7
|
import { message } from 'luck-design/antd';
|
|
8
8
|
import { keys, isNil, isFunction } from 'lodash';
|
|
9
|
-
import
|
|
10
|
-
import { executeCode } from "
|
|
11
|
-
import { fetchCallBehavior } from "
|
|
9
|
+
import { getModuleData } from "./usePageDataStore";
|
|
10
|
+
import { executeCode } from "../../tools/helper";
|
|
11
|
+
import { fetchCallBehavior } from "../../../constants/api-url";
|
|
12
12
|
var useTodo = function useTodo() {
|
|
13
13
|
var _useBoolean = useBoolean(),
|
|
14
14
|
_useBoolean2 = _slicedToArray(_useBoolean, 2),
|
|
@@ -26,9 +26,6 @@ var useTodo = function useTodo() {
|
|
|
26
26
|
behaviorKey: behaviorKey
|
|
27
27
|
}, params), data);
|
|
28
28
|
});
|
|
29
|
-
var moduleData = usePageDataStore(function (state) {
|
|
30
|
-
return state.moduleData;
|
|
31
|
-
});
|
|
32
29
|
var todo = useMemoizedFn(function (ctx, actionPool) {
|
|
33
30
|
var argsMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
34
31
|
if (isNil(actionPool)) {
|
|
@@ -57,6 +54,7 @@ var useTodo = function useTodo() {
|
|
|
57
54
|
params = _ref4.params,
|
|
58
55
|
data = _ref4.data,
|
|
59
56
|
after = _ref4.after;
|
|
57
|
+
var moduleData = getModuleData();
|
|
60
58
|
var _moduleCode = moduleCode || moduleData.moduleCode;
|
|
61
59
|
var _dscode = datasetCode || dsCode;
|
|
62
60
|
if (!_moduleCode || !_dscode) {
|
|
@@ -83,6 +81,6 @@ var useTodo = function useTodo() {
|
|
|
83
81
|
}
|
|
84
82
|
return Promise.resolve();
|
|
85
83
|
});
|
|
86
|
-
return [todo,
|
|
84
|
+
return [todo, loading];
|
|
87
85
|
};
|
|
88
86
|
export default useTodo;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import { Modal, message } from 'luck-design/antd';
|
|
5
|
+
import { fetchCallBehavior } from "../../../constants/api-url";
|
|
6
|
+
import { getDvaApp } from 'umi';
|
|
7
|
+
var Formatter = /*#__PURE__*/function () {
|
|
8
|
+
function Formatter() {
|
|
9
|
+
_classCallCheck(this, Formatter);
|
|
10
|
+
}
|
|
11
|
+
_createClass(Formatter, null, [{
|
|
12
|
+
key: "formatDate",
|
|
13
|
+
value:
|
|
14
|
+
// 格式化日期
|
|
15
|
+
function formatDate(date, format) {
|
|
16
|
+
var options = {
|
|
17
|
+
'Y+': date.getFullYear().toString(),
|
|
18
|
+
// 年
|
|
19
|
+
'M+': (date.getMonth() + 1).toString().padStart(2, '0'),
|
|
20
|
+
// 月
|
|
21
|
+
'D+': date.getDate().toString().padStart(2, '0'),
|
|
22
|
+
// 日
|
|
23
|
+
'H+': date.getHours().toString().padStart(2, '0'),
|
|
24
|
+
// 时
|
|
25
|
+
'm+': date.getMinutes().toString().padStart(2, '0'),
|
|
26
|
+
// 分
|
|
27
|
+
's+': date.getSeconds().toString().padStart(2, '0') // 秒
|
|
28
|
+
};
|
|
29
|
+
for (var k in options) {
|
|
30
|
+
format = format.replace(new RegExp(k), options[k]);
|
|
31
|
+
}
|
|
32
|
+
return format;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 格式化金额
|
|
36
|
+
}, {
|
|
37
|
+
key: "formatCurrency",
|
|
38
|
+
value: function formatCurrency(amount) {
|
|
39
|
+
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ',';
|
|
40
|
+
amount = parseFloat(amount).toFixed(2);
|
|
41
|
+
var parts = amount.split('.');
|
|
42
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
43
|
+
return "".concat(parts.join('.'));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 格式化手机号
|
|
47
|
+
}, {
|
|
48
|
+
key: "formatPhoneNumber",
|
|
49
|
+
value: function formatPhoneNumber(phone) {
|
|
50
|
+
phone = phone.toString();
|
|
51
|
+
return phone.replace(/(\+?\d{2})(\d{4})(\d{4})(\d{3})/, '$1 $2 $3 $4');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// 格式化银行卡号
|
|
55
|
+
}, {
|
|
56
|
+
key: "formatCardNumber",
|
|
57
|
+
value: function formatCardNumber(cardNumber) {
|
|
58
|
+
cardNumber = cardNumber.toString();
|
|
59
|
+
return cardNumber.replace(/(\d{4})(?=\d)/g, '$1 ');
|
|
60
|
+
}
|
|
61
|
+
}]);
|
|
62
|
+
return Formatter;
|
|
63
|
+
}();
|
|
64
|
+
export function dialog() {
|
|
65
|
+
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'confirm';
|
|
66
|
+
var props = arguments.length > 1 ? arguments[1] : undefined;
|
|
67
|
+
if (!['info', 'success', 'error', 'warning', 'confirm'].includes(type)) return;
|
|
68
|
+
return Modal[type](props);
|
|
69
|
+
}
|
|
70
|
+
export function toast() {
|
|
71
|
+
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'info';
|
|
72
|
+
var props = arguments.length > 1 ? arguments[1] : undefined;
|
|
73
|
+
if (!['info', 'success', 'error', 'warning', 'warn', 'loading'].includes(type)) return;
|
|
74
|
+
return message[type](props);
|
|
75
|
+
}
|
|
76
|
+
export function callBehavior(_ref, params, data) {
|
|
77
|
+
var moduleCode = _ref.moduleCode,
|
|
78
|
+
datasetCode = _ref.datasetCode,
|
|
79
|
+
behaviorKey = _ref.behaviorKey;
|
|
80
|
+
return fetchCallBehavior(_objectSpread({
|
|
81
|
+
moduleCode: moduleCode,
|
|
82
|
+
datasetCode: datasetCode,
|
|
83
|
+
behaviorKey: behaviorKey
|
|
84
|
+
}, params), data);
|
|
85
|
+
}
|
|
86
|
+
export function formatter(type, value, formatOrSeparator) {
|
|
87
|
+
switch (type) {
|
|
88
|
+
case 'date':
|
|
89
|
+
return Formatter.formatDate(value, formatOrSeparator);
|
|
90
|
+
case 'money':
|
|
91
|
+
return Formatter.formatCurrency(value, formatOrSeparator);
|
|
92
|
+
case 'cnmobile':
|
|
93
|
+
return Formatter.formatPhoneNumber(value);
|
|
94
|
+
case 'card':
|
|
95
|
+
return Formatter.formatCardNumber(value);
|
|
96
|
+
default:
|
|
97
|
+
throw new Error("Unsupported format type: ".concat(type));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export function getDateTimeRange() {
|
|
101
|
+
var when = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
|
|
102
|
+
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'day';
|
|
103
|
+
var start = new Date(when);
|
|
104
|
+
var end = new Date(when);
|
|
105
|
+
switch (type) {
|
|
106
|
+
case 'year':
|
|
107
|
+
start.setMonth(0, 1); // 设置到当年的1月1日
|
|
108
|
+
start.setHours(0, 0, 0, 0);
|
|
109
|
+
end.setMonth(11, 31); // 设置到当年的12月31日
|
|
110
|
+
end.setHours(23, 59, 59, 999);
|
|
111
|
+
break;
|
|
112
|
+
case 'month':
|
|
113
|
+
start.setDate(1); // 设置到当月的1日
|
|
114
|
+
start.setHours(0, 0, 0, 0);
|
|
115
|
+
end.setMonth(end.getMonth() + 1); // 设置到下月的1日
|
|
116
|
+
end.setDate(0); // 回到当月的最后一天
|
|
117
|
+
end.setHours(23, 59, 59, 999);
|
|
118
|
+
break;
|
|
119
|
+
case 'week':
|
|
120
|
+
var dayOfWeek = start.getDay(); // 当前日期是本周的第几天
|
|
121
|
+
var diffToMonday = (dayOfWeek + 6) % 7; // 计算到上一个星期一的天数
|
|
122
|
+
start.setDate(start.getDate() - diffToMonday); // 设置到本周的星期一
|
|
123
|
+
start.setHours(0, 0, 0, 0);
|
|
124
|
+
end.setDate(start.getDate() + 6); // 设置到本周的星期天
|
|
125
|
+
end.setHours(23, 59, 59, 999);
|
|
126
|
+
break;
|
|
127
|
+
case 'day':
|
|
128
|
+
case 'date':
|
|
129
|
+
// 'day' 和 'date' 是一样的处理方式
|
|
130
|
+
start.setHours(0, 0, 0, 0);
|
|
131
|
+
end.setHours(23, 59, 59, 999);
|
|
132
|
+
break;
|
|
133
|
+
case 'hour':
|
|
134
|
+
start.setMinutes(0, 0, 0);
|
|
135
|
+
end.setMinutes(59, 59, 999);
|
|
136
|
+
break;
|
|
137
|
+
case 'minute':
|
|
138
|
+
start.setSeconds(0, 0);
|
|
139
|
+
end.setSeconds(59, 999);
|
|
140
|
+
break;
|
|
141
|
+
case 'second':
|
|
142
|
+
start.setMilliseconds(0);
|
|
143
|
+
end.setMilliseconds(999);
|
|
144
|
+
break;
|
|
145
|
+
default:
|
|
146
|
+
throw new Error("Unsupported range type: ".concat(type));
|
|
147
|
+
}
|
|
148
|
+
return [start.getTime(), end.getTime()];
|
|
149
|
+
}
|
|
150
|
+
export function getLoginUser() {
|
|
151
|
+
var _getDvaApp;
|
|
152
|
+
return (_getDvaApp = getDvaApp()) === null || _getDvaApp === void 0 ? void 0 : _getDvaApp._store.getState().user.currentUser;
|
|
153
|
+
}
|
|
154
|
+
export function isMobile() {
|
|
155
|
+
// return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
156
|
+
return USER_RUNTIME === 'MOBILE';
|
|
157
|
+
}
|
|
@@ -9,8 +9,7 @@ import { history } from 'umi';
|
|
|
9
9
|
import launcher from "../launcher";
|
|
10
10
|
import { LuckDaContext } from "../../../components/Builder";
|
|
11
11
|
import { doAction as doActionUtils } from "../../../helper/action";
|
|
12
|
-
import usePageDataStore from "
|
|
13
|
-
import { useTemporalStore } from "../provider/ContextProvider";
|
|
12
|
+
import usePageDataStore, { useTemporalStore } from "./ContextProvider/usePageDataStore";
|
|
14
13
|
import { decompress } from "../tools/dataProcess";
|
|
15
14
|
import { fetchPageData, fetchDesignModlueData, fetchPreviewModlueData, fetchModlueData, fetchAllDataset, fetchAllSerials, fetchAllBehaviorEx } from "../../constants/api-url";
|
|
16
15
|
import { RUNTIME, LC_RUNTIME_KEY, META_TAG_NAME } from "../../constants";
|
|
@@ -120,8 +120,13 @@ export function executeCode(context, code, argsName) {
|
|
|
120
120
|
throw new Error('executeCode参数不匹配');
|
|
121
121
|
}
|
|
122
122
|
var ctx = getCtx(context);
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
try {
|
|
124
|
+
var func = _construct(Function, _toConsumableArray(argsName || []).concat(['ctx', 'window', "\"use strict\"; ".concat(getFuncBody(code))]));
|
|
125
|
+
return func.apply(void 0, args.concat([ctx, _objectSpread(_objectSpread({}, window.proxy), window)]));
|
|
126
|
+
} catch (e) {
|
|
127
|
+
console.error("".concat(code, "\u65E0\u6CD5\u88AB\u6267\u884C"), e);
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
125
130
|
}
|
|
126
131
|
export function parseCSS(cssString) {
|
|
127
132
|
// 创建一个空对象来存储解析后的样式
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import _toArray from "@babel/runtime/helpers/esm/toArray";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
5
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
6
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
7
|
+
import { isNil, reduce, isArray } from 'lodash';
|
|
8
|
+
import { request } from '@luck-design-biz/base/utils';
|
|
9
|
+
import usePageDataStore from "../provider/ContextProvider/usePageDataStore";
|
|
10
|
+
import { useStateStore } from "../provider/ContextProvider/usePageVar";
|
|
11
|
+
import { executeCode } from "./helper";
|
|
12
|
+
var parseVar = function parseVar(ctx, input) {
|
|
13
|
+
if (isNil(input)) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
return executeCode(ctx, "function() {return ".concat(input, "}"));
|
|
18
|
+
} catch (err) {
|
|
19
|
+
return input;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var Task = /*#__PURE__*/function () {
|
|
23
|
+
function Task(ctx, props) {
|
|
24
|
+
_classCallCheck(this, Task);
|
|
25
|
+
this.ctx = ctx;
|
|
26
|
+
this.name = props.name;
|
|
27
|
+
this.props = props;
|
|
28
|
+
}
|
|
29
|
+
_createClass(Task, [{
|
|
30
|
+
key: "run",
|
|
31
|
+
value: function () {
|
|
32
|
+
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_params, _data) {
|
|
33
|
+
var _this = this;
|
|
34
|
+
var _this$props, willFetch, didFetch, onError, _this$props$data, url, params, body, method, defaultValue, vars, config;
|
|
35
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
36
|
+
while (1) switch (_context.prev = _context.next) {
|
|
37
|
+
case 0:
|
|
38
|
+
_this$props = this.props, willFetch = _this$props.willFetch, didFetch = _this$props.didFetch, onError = _this$props.onError;
|
|
39
|
+
_this$props$data = this.props.data, url = _this$props$data.url, params = _this$props$data.params, body = _this$props$data.body, method = _this$props$data.method, defaultValue = _this$props$data.defaultValue;
|
|
40
|
+
vars = {
|
|
41
|
+
params: isNil(params) || params === '' ? {} : parseVar(this.ctx, params),
|
|
42
|
+
data: isNil(body) || body === '' ? {} : parseVar(this.ctx, body)
|
|
43
|
+
};
|
|
44
|
+
config = {
|
|
45
|
+
headers: {}
|
|
46
|
+
};
|
|
47
|
+
if (willFetch) {
|
|
48
|
+
executeCode(this.ctx, willFetch, ['vars', 'config'], vars, config);
|
|
49
|
+
}
|
|
50
|
+
return _context.abrupt("return", request(parseVar(this.ctx, url), _objectSpread({
|
|
51
|
+
params: _objectSpread(_objectSpread({}, vars.params), _params),
|
|
52
|
+
data: _objectSpread(_objectSpread({}, vars.data), _data),
|
|
53
|
+
method: parseVar(this.ctx, method)
|
|
54
|
+
}, config)).then(function (res) {
|
|
55
|
+
if (res.code === 1) {
|
|
56
|
+
var list = res.list,
|
|
57
|
+
detail = res.detail;
|
|
58
|
+
var content;
|
|
59
|
+
if (list.length === 1) {
|
|
60
|
+
content = detail[list[0]];
|
|
61
|
+
} else {
|
|
62
|
+
content = list.map(function (_id) {
|
|
63
|
+
return detail[_id];
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (didFetch) {
|
|
67
|
+
return executeCode(_this.ctx, didFetch, ['content', 'origin'], content, res);
|
|
68
|
+
}
|
|
69
|
+
return content;
|
|
70
|
+
} else if (onError) {
|
|
71
|
+
executeCode(_this.ctx, onError, ['error'], res);
|
|
72
|
+
}
|
|
73
|
+
if (defaultValue) {
|
|
74
|
+
return parseVar(_this.ctx, defaultValue);
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
case 6:
|
|
78
|
+
case "end":
|
|
79
|
+
return _context.stop();
|
|
80
|
+
}
|
|
81
|
+
}, _callee, this);
|
|
82
|
+
}));
|
|
83
|
+
function run(_x, _x2) {
|
|
84
|
+
return _run.apply(this, arguments);
|
|
85
|
+
}
|
|
86
|
+
return run;
|
|
87
|
+
}()
|
|
88
|
+
}, {
|
|
89
|
+
key: "load",
|
|
90
|
+
value: function () {
|
|
91
|
+
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params, data) {
|
|
92
|
+
var _this2 = this;
|
|
93
|
+
var content;
|
|
94
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
95
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
_context2.next = 2;
|
|
98
|
+
return this.run(params, data);
|
|
99
|
+
case 2:
|
|
100
|
+
content = _context2.sent;
|
|
101
|
+
useStateStore.setState(function (store) {
|
|
102
|
+
store.state[_this2.name] = content;
|
|
103
|
+
});
|
|
104
|
+
return _context2.abrupt("return", content);
|
|
105
|
+
case 5:
|
|
106
|
+
case "end":
|
|
107
|
+
return _context2.stop();
|
|
108
|
+
}
|
|
109
|
+
}, _callee2, this);
|
|
110
|
+
}));
|
|
111
|
+
function load(_x3, _x4) {
|
|
112
|
+
return _load.apply(this, arguments);
|
|
113
|
+
}
|
|
114
|
+
return load;
|
|
115
|
+
}()
|
|
116
|
+
}]);
|
|
117
|
+
return Task;
|
|
118
|
+
}();
|
|
119
|
+
var wrapPromise = function wrapPromise(promise) {
|
|
120
|
+
var cache = {
|
|
121
|
+
status: 'pending',
|
|
122
|
+
data: null
|
|
123
|
+
};
|
|
124
|
+
var suspender = promise.then(function (r) {
|
|
125
|
+
cache.status = 'fulfilled';
|
|
126
|
+
cache.data = r;
|
|
127
|
+
}, function (e) {
|
|
128
|
+
cache.status = 'rejected';
|
|
129
|
+
cache.data = e;
|
|
130
|
+
});
|
|
131
|
+
return {
|
|
132
|
+
read: function read() {
|
|
133
|
+
if (cache.status === 'pending') {
|
|
134
|
+
throw suspender;
|
|
135
|
+
} else if (cache.status === 'rejected') {
|
|
136
|
+
throw cache.data;
|
|
137
|
+
} else if (cache.status === 'fulfilled') {
|
|
138
|
+
return cache.data;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
export default function initialize(ctx) {
|
|
144
|
+
var pageVars = usePageDataStore.getState().pageData.props.vars;
|
|
145
|
+
if (isNil(pageVars)) return null;
|
|
146
|
+
var remoteApis = new Map();
|
|
147
|
+
var _reduce = reduce(pageVars, function (ret, val) {
|
|
148
|
+
if (val.type === 'var') {
|
|
149
|
+
ret[0][val.name] = parseVar(ctx, val.data);
|
|
150
|
+
} else if (val.type === 'api') {
|
|
151
|
+
var _val$data = val.data,
|
|
152
|
+
auto = _val$data.auto,
|
|
153
|
+
taskType = _val$data.taskType;
|
|
154
|
+
var task = new Task(ctx, val);
|
|
155
|
+
remoteApis.set(val.name, task);
|
|
156
|
+
if (!auto) return ret;
|
|
157
|
+
if (taskType === 'serial') {
|
|
158
|
+
ret.push(task);
|
|
159
|
+
} else if (taskType === 'parallel') {
|
|
160
|
+
var lastIndex = ret.length - 1;
|
|
161
|
+
if (lastIndex > 0 && isArray(ret[lastIndex])) {
|
|
162
|
+
ret[lastIndex].push(task);
|
|
163
|
+
} else {
|
|
164
|
+
ret.push([task]);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return ret;
|
|
169
|
+
}, [{}]),
|
|
170
|
+
_reduce2 = _toArray(_reduce),
|
|
171
|
+
variables = _reduce2[0],
|
|
172
|
+
autoTasks = _reduce2.slice(1);
|
|
173
|
+
useStateStore.getState().initialize(variables);
|
|
174
|
+
ctx._initRemoteApiMap(remoteApis);
|
|
175
|
+
function run() {
|
|
176
|
+
return _run2.apply(this, arguments);
|
|
177
|
+
}
|
|
178
|
+
function _run2() {
|
|
179
|
+
_run2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
180
|
+
var result, _loop, i;
|
|
181
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context5) {
|
|
182
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
183
|
+
case 0:
|
|
184
|
+
result = {};
|
|
185
|
+
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop(i) {
|
|
186
|
+
var contents, _loop2, j, content;
|
|
187
|
+
return _regeneratorRuntime().wrap(function _loop$(_context4) {
|
|
188
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
189
|
+
case 0:
|
|
190
|
+
if (!isArray(autoTasks[i])) {
|
|
191
|
+
_context4.next = 13;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
_context4.next = 3;
|
|
195
|
+
return Promise.all(autoTasks[i].map(function (t) {
|
|
196
|
+
return t.run();
|
|
197
|
+
}));
|
|
198
|
+
case 3:
|
|
199
|
+
contents = _context4.sent;
|
|
200
|
+
_loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2(j) {
|
|
201
|
+
return _regeneratorRuntime().wrap(function _loop2$(_context3) {
|
|
202
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
203
|
+
case 0:
|
|
204
|
+
useStateStore.setState(function (store) {
|
|
205
|
+
store.state[autoTasks[i][j].name] = contents[j];
|
|
206
|
+
});
|
|
207
|
+
case 1:
|
|
208
|
+
case "end":
|
|
209
|
+
return _context3.stop();
|
|
210
|
+
}
|
|
211
|
+
}, _loop2);
|
|
212
|
+
});
|
|
213
|
+
_context4.t0 = _regeneratorRuntime().keys(autoTasks[i]);
|
|
214
|
+
case 6:
|
|
215
|
+
if ((_context4.t1 = _context4.t0()).done) {
|
|
216
|
+
_context4.next = 11;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
j = _context4.t1.value;
|
|
220
|
+
return _context4.delegateYield(_loop2(j), "t2", 9);
|
|
221
|
+
case 9:
|
|
222
|
+
_context4.next = 6;
|
|
223
|
+
break;
|
|
224
|
+
case 11:
|
|
225
|
+
_context4.next = 17;
|
|
226
|
+
break;
|
|
227
|
+
case 13:
|
|
228
|
+
_context4.next = 15;
|
|
229
|
+
return autoTasks[i].run();
|
|
230
|
+
case 15:
|
|
231
|
+
content = _context4.sent;
|
|
232
|
+
useStateStore.setState(function (store) {
|
|
233
|
+
store.state[autoTasks[i].name] = content;
|
|
234
|
+
});
|
|
235
|
+
case 17:
|
|
236
|
+
case "end":
|
|
237
|
+
return _context4.stop();
|
|
238
|
+
}
|
|
239
|
+
}, _loop);
|
|
240
|
+
});
|
|
241
|
+
_context5.t0 = _regeneratorRuntime().keys(autoTasks);
|
|
242
|
+
case 3:
|
|
243
|
+
if ((_context5.t1 = _context5.t0()).done) {
|
|
244
|
+
_context5.next = 8;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
i = _context5.t1.value;
|
|
248
|
+
return _context5.delegateYield(_loop(i), "t2", 6);
|
|
249
|
+
case 6:
|
|
250
|
+
_context5.next = 3;
|
|
251
|
+
break;
|
|
252
|
+
case 8:
|
|
253
|
+
return _context5.abrupt("return", result);
|
|
254
|
+
case 9:
|
|
255
|
+
case "end":
|
|
256
|
+
return _context5.stop();
|
|
257
|
+
}
|
|
258
|
+
}, _callee3);
|
|
259
|
+
}));
|
|
260
|
+
return _run2.apply(this, arguments);
|
|
261
|
+
}
|
|
262
|
+
return wrapPromise(run());
|
|
263
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { useRef
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { useCreation } from 'ahooks';
|
|
2
3
|
var useCombinedRefs = function useCombinedRefs(forwardedRef) {
|
|
3
4
|
var innerRef = useRef(null);
|
|
4
|
-
|
|
5
|
+
useCreation(function () {
|
|
5
6
|
if (!forwardedRef) return;
|
|
6
7
|
if (typeof forwardedRef === 'function') {
|
|
7
8
|
forwardedRef(innerRef.current);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import React, { useRef, useEffect, useState } from 'react';
|
|
3
3
|
import { last, initial } from 'lodash';
|
|
4
|
-
import { useEventListener, useSetState, useMemoizedFn, useCreation, useSize, useLatest } from 'ahooks';
|
|
4
|
+
import { useEventListener, useSetState, useMemoizedFn, useCreation, useSize, useLatest, useKeyPress } from 'ahooks';
|
|
5
5
|
import { Icon, Dropdown, message } from 'luck-design/antd';
|
|
6
6
|
import { reverse, isString, isNil } from 'lodash';
|
|
7
7
|
import { suid } from '@luck-design-biz/base/utils';
|
|
@@ -114,6 +114,15 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
114
114
|
var _last;
|
|
115
115
|
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;
|
|
116
116
|
}, [operatorId.detector]);
|
|
117
|
+
useKeyPress('backspace', function () {
|
|
118
|
+
if (operatorId.selector && operatorId.deletable) {
|
|
119
|
+
handleDelete({
|
|
120
|
+
id: operatorId.selector
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
target: canvas
|
|
125
|
+
});
|
|
117
126
|
useEventListener('mousemove', function (event) {
|
|
118
127
|
var elem = event.target;
|
|
119
128
|
var targetFormItem = elem.closest("[".concat(LC_COMPONENT_UNIT_KEY, "=\"").concat(LC_FORMITEM_UNIT, "\"]"));
|
|
@@ -190,9 +190,9 @@ var Panel = function Panel() {
|
|
|
190
190
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
191
191
|
className: styles.headerList
|
|
192
192
|
}, reduce(_TAB_LIST_, function (ret, item) {
|
|
193
|
-
if (item.key === 'css' &&
|
|
193
|
+
if (item.key === 'css' && !isNil(meta === null || meta === void 0 ? void 0 : meta.css)) {
|
|
194
194
|
ret.push(item);
|
|
195
|
-
} else if (item.key === 'advance' &&
|
|
195
|
+
} else if (item.key === 'advance' && !isNil(meta === null || meta === void 0 ? void 0 : meta.advance)) {
|
|
196
196
|
ret.push(item);
|
|
197
197
|
} else if (item.key === 'attrs') {
|
|
198
198
|
ret.push(item);
|