@luck-design-biz/luckda 0.0.25-6 → 0.0.25-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/LDActions/index.js +8 -10
- package/es/components/LDActions/index.less +7 -4
- package/es/components/LdAutoForm/index.js +26 -8
- package/es/components/LdFormList/index.js +37 -22
- package/es/components/LdGrid/index.js +14 -7
- package/es/components/LdGridForm/index.js +18 -6
- package/es/components/LdTree/index.js +33 -15
- package/es/helper/form.js +15 -8
- package/es/locales/zh-CN.js +16 -10
- package/es/lowcode/constants/api-url.js +120 -32
- package/es/lowcode/constants/event-topics.js +2 -0
- package/es/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +4 -2
- package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +4 -2
- package/es/lowcode/engine/meta/box.props.json +3 -3
- package/es/lowcode/engine/meta/button.props.json +3 -3
- package/es/lowcode/engine/meta/components-list.json +6 -0
- package/es/lowcode/engine/meta/dialog.props.default.json +10 -5
- package/es/lowcode/engine/meta/dialog.props.json +72 -42
- package/es/lowcode/engine/meta/drawer.props.json +8 -20
- package/es/lowcode/engine/meta/form.props.json +16 -10
- package/es/lowcode/engine/meta/imex.props.default.json +8 -1
- package/es/lowcode/engine/meta/imex.props.json +54 -22
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
- package/es/lowcode/engine/meta/layout.props.json +2 -2
- package/es/lowcode/engine/meta/page.props.json +2 -2
- package/es/lowcode/engine/meta/pagelayout.props.default.json +14 -0
- package/es/lowcode/engine/meta/pagelayout.props.json +47 -0
- package/es/lowcode/engine/meta/section.props.json +2 -2
- package/es/lowcode/engine/meta/split.props.default.json +1 -1
- package/es/lowcode/engine/meta/split.props.json +4 -4
- package/es/lowcode/engine/meta/table.props.json +17 -11
- package/es/lowcode/engine/meta/tabs.props.json +3 -3
- package/es/lowcode/engine/meta/tree.props.default.json +2 -0
- package/es/lowcode/engine/meta/tree.props.json +62 -6
- package/es/lowcode/engine/provider/ContextProvider/index.js +20 -43
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +69 -24
- package/es/lowcode/engine/tools/dataProcess.js +4 -0
- package/es/lowcode/engine/tools/helper.js +2 -3
- package/es/lowcode/engine/tools/useCanvasRender.js +3 -2
- package/es/lowcode/engine/tools/usePageDataStore.js +176 -0
- package/es/lowcode/engine/tools/usePromiseState.js +12 -23
- package/es/lowcode/engine/tools/useTodo.js +20 -10
- package/es/lowcode/painter/DesignOperator.js +12 -23
- package/es/lowcode/painter/DesignToolbar.js +10 -45
- package/es/lowcode/painter/Outline.js +2 -4
- package/es/lowcode/painter/Panel.js +29 -28
- package/es/lowcode/painter/components/ActionBindModal.js +30 -24
- package/es/lowcode/painter/components/AdvancePanel.js +6 -1
- package/es/lowcode/painter/components/AttrsPanel.js +38 -29
- package/es/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
- package/es/lowcode/painter/components/field-setting/CheckFrontRules.js +108 -0
- package/es/lowcode/painter/components/field-setting/CheckRules.js +1 -26
- package/es/lowcode/painter/components/field-setting/FieldRulesModal.js +33 -13
- package/es/lowcode/painter/components/field-setting/SettingUI.js +162 -30
- package/es/lowcode/painter/components/field-setting/index.js +32 -63
- package/es/lowcode/painter/components/field-setting/meta/frontRules.js +53 -0
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +14 -17
- package/es/lowcode/painter/panel-section/ButtonType.js +4 -2
- package/es/lowcode/painter/panel-section/DataSetSelector.js +4 -1
- package/es/lowcode/painter/panel-section/FieldsSetting.js +53 -8
- package/es/lowcode/painter/panel-section/ImpExp.js +93 -6
- package/es/lowcode/painter/panel-section/ImpExpAlone.js +109 -0
- package/es/lowcode/painter/panel-section/PageLayoutDisplay.js +95 -0
- package/es/lowcode/painter/panel-section/SerialsSelector.js +4 -2
- package/es/lowcode/painter/panel-section/SplitDisplay.js +25 -110
- package/es/lowcode/painter/panel-section/StylePanel/index.js +10 -4
- package/es/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
- package/es/lowcode/painter/style/action-bind-modal.less +3 -3
- package/es/lowcode/painter/style/design.less +1 -1
- package/es/lowcode/painter/style/page-layout-display.less +28 -0
- package/es/lowcode/painter/style/panel-item.less +1 -1
- package/es/lowcode/painter/style/split-display.less +0 -9
- package/es/lowcode/preview/index.js +4 -2
- package/es/lowcode/view/Canvas.js +6 -7
- package/es/lowcode/view/Page.js +2 -3
- package/es/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
- package/es/lowcode/view/lc-components/Box/meta.json +3 -3
- package/es/lowcode/view/lc-components/Button/index.js +2 -6
- package/es/lowcode/view/lc-components/Button/meta.json +3 -3
- package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +3 -10
- package/es/lowcode/view/lc-components/Dialog/index.js +114 -19
- package/es/lowcode/view/lc-components/Dialog/meta.json +65 -42
- package/es/lowcode/view/lc-components/Drawer/meta.json +8 -20
- package/es/lowcode/view/lc-components/Form/FunctionDesign.js +23 -33
- package/es/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
- package/es/lowcode/view/lc-components/Form/index.js +113 -21
- package/es/lowcode/view/lc-components/Form/meta.json +16 -10
- package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
- package/es/lowcode/view/lc-components/ImEx/index.js +260 -10
- package/es/lowcode/view/lc-components/ImEx/index.less +7 -0
- package/es/lowcode/view/lc-components/ImEx/meta.json +55 -23
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +12 -19
- package/es/lowcode/view/lc-components/Layout/meta.json +2 -2
- package/es/lowcode/view/lc-components/Page/meta.json +2 -2
- package/es/lowcode/view/lc-components/PageContent/index.js +8 -9
- package/es/lowcode/view/lc-components/PageFooter/index.js +2 -5
- package/es/lowcode/view/lc-components/PageHeader/index.js +5 -6
- package/es/lowcode/view/lc-components/PageLayout/FunctionDesign.js +63 -0
- package/es/lowcode/view/lc-components/PageLayout/FunctionLive.js +10 -0
- package/es/lowcode/view/lc-components/PageLayout/FunctionPreview.js +10 -0
- package/es/lowcode/view/lc-components/PageLayout/index.js +32 -0
- package/es/lowcode/view/lc-components/PageLayout/meta.json +47 -0
- package/es/lowcode/view/lc-components/PageModal/index.js +12 -15
- package/es/lowcode/view/lc-components/Section/FunctionDesign.js +3 -9
- package/es/lowcode/view/lc-components/Section/meta.json +2 -2
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +19 -20
- package/es/lowcode/view/lc-components/Split/index.js +5 -9
- package/es/lowcode/view/lc-components/Split/meta.json +4 -4
- package/es/lowcode/view/lc-components/Table/components/TopImex.js +138 -0
- package/es/lowcode/view/lc-components/Table/index.js +124 -39
- package/es/lowcode/view/lc-components/Table/meta.json +17 -11
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +10 -17
- package/es/lowcode/view/lc-components/Tabs/index.js +3 -1
- package/es/lowcode/view/lc-components/Tabs/meta.json +3 -3
- package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
- package/es/lowcode/view/lc-components/Tree/index.js +67 -18
- package/es/lowcode/view/lc-components/Tree/meta.json +62 -7
- package/es/lowcode/view/lc-components/Wrapper.js +9 -11
- package/es/services.js +0 -24
- package/es/upload/FilesWall/file.png +0 -0
- package/es/upload/FilesWall/index.js +422 -0
- package/es/upload/FilesWall/index.less +74 -0
- package/es/upload/Form/index.js +2 -1
- package/es/upload/FormItem/index.js +3 -5
- package/es/upload/index.js +2 -1
- package/es/utils/action.js +2 -2
- package/lib/components/LDActions/index.js +7 -9
- package/lib/components/LDActions/index.less +7 -4
- package/lib/components/LdAutoForm/index.js +25 -7
- package/lib/components/LdFormList/index.js +36 -21
- package/lib/components/LdGrid/index.js +14 -7
- package/lib/components/LdGridForm/index.js +16 -4
- package/lib/components/LdTree/index.js +33 -15
- package/lib/helper/form.js +14 -7
- package/lib/locales/zh-CN.js +16 -10
- package/lib/lowcode/constants/api-url.js +123 -32
- package/lib/lowcode/constants/event-topics.js +3 -1
- package/lib/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +4 -2
- package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +4 -2
- package/lib/lowcode/engine/meta/box.props.json +3 -3
- package/lib/lowcode/engine/meta/button.props.json +3 -3
- package/lib/lowcode/engine/meta/components-list.json +6 -0
- package/lib/lowcode/engine/meta/dialog.props.default.json +10 -5
- package/lib/lowcode/engine/meta/dialog.props.json +72 -42
- package/lib/lowcode/engine/meta/drawer.props.json +8 -20
- package/lib/lowcode/engine/meta/form.props.json +16 -10
- package/lib/lowcode/engine/meta/imex.props.default.json +8 -1
- package/lib/lowcode/engine/meta/imex.props.json +54 -22
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
- package/lib/lowcode/engine/meta/layout.props.json +2 -2
- package/lib/lowcode/engine/meta/page.props.json +2 -2
- package/lib/lowcode/engine/meta/pagelayout.props.default.json +14 -0
- package/lib/lowcode/engine/meta/pagelayout.props.json +47 -0
- package/lib/lowcode/engine/meta/section.props.json +2 -2
- package/lib/lowcode/engine/meta/split.props.default.json +1 -1
- package/lib/lowcode/engine/meta/split.props.json +4 -4
- package/lib/lowcode/engine/meta/table.props.json +17 -11
- package/lib/lowcode/engine/meta/tabs.props.json +3 -3
- package/lib/lowcode/engine/meta/tree.props.default.json +2 -0
- package/lib/lowcode/engine/meta/tree.props.json +62 -6
- package/lib/lowcode/engine/provider/ContextProvider/index.js +36 -43
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +68 -23
- package/lib/lowcode/engine/tools/dataProcess.js +4 -0
- package/lib/lowcode/engine/tools/helper.js +2 -3
- package/lib/lowcode/engine/tools/useCanvasRender.js +3 -2
- package/lib/lowcode/engine/tools/usePageDataStore.js +183 -0
- package/lib/lowcode/engine/tools/usePromiseState.js +11 -21
- package/lib/lowcode/engine/tools/useTodo.js +19 -9
- package/lib/lowcode/painter/DesignOperator.js +11 -22
- package/lib/lowcode/painter/DesignToolbar.js +9 -44
- package/lib/lowcode/painter/Outline.js +1 -3
- package/lib/lowcode/painter/Panel.js +28 -27
- package/lib/lowcode/painter/components/ActionBindModal.js +28 -22
- package/lib/lowcode/painter/components/AdvancePanel.js +6 -1
- package/lib/lowcode/painter/components/AttrsPanel.js +37 -28
- package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
- package/lib/lowcode/painter/components/field-setting/CheckFrontRules.js +116 -0
- package/lib/lowcode/painter/components/field-setting/CheckRules.js +1 -26
- package/lib/lowcode/painter/components/field-setting/FieldRulesModal.js +34 -13
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +159 -27
- package/lib/lowcode/painter/components/field-setting/index.js +32 -63
- package/lib/lowcode/painter/components/field-setting/meta/frontRules.js +59 -0
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +13 -16
- package/lib/lowcode/painter/panel-section/ButtonType.js +4 -2
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +4 -1
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +53 -8
- package/lib/lowcode/painter/panel-section/ImpExp.js +92 -5
- package/lib/lowcode/painter/panel-section/ImpExpAlone.js +115 -0
- package/lib/lowcode/painter/panel-section/PageLayoutDisplay.js +103 -0
- package/lib/lowcode/painter/panel-section/SerialsSelector.js +4 -2
- package/lib/lowcode/painter/panel-section/SplitDisplay.js +24 -109
- package/lib/lowcode/painter/panel-section/StylePanel/index.js +10 -4
- package/lib/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
- package/lib/lowcode/painter/style/action-bind-modal.less +3 -3
- package/lib/lowcode/painter/style/design.less +1 -1
- package/lib/lowcode/painter/style/page-layout-display.less +28 -0
- package/lib/lowcode/painter/style/panel-item.less +1 -1
- package/lib/lowcode/painter/style/split-display.less +0 -9
- package/lib/lowcode/preview/index.js +4 -2
- package/lib/lowcode/view/Canvas.js +5 -6
- package/lib/lowcode/view/Page.js +2 -3
- package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
- package/lib/lowcode/view/lc-components/Box/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Button/index.js +2 -6
- package/lib/lowcode/view/lc-components/Button/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -9
- package/lib/lowcode/view/lc-components/Dialog/index.js +114 -19
- package/lib/lowcode/view/lc-components/Dialog/meta.json +65 -42
- package/lib/lowcode/view/lc-components/Drawer/meta.json +8 -20
- package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +20 -31
- package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
- package/lib/lowcode/view/lc-components/Form/index.js +110 -18
- package/lib/lowcode/view/lc-components/Form/meta.json +16 -10
- package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
- package/lib/lowcode/view/lc-components/ImEx/index.js +257 -8
- package/lib/lowcode/view/lc-components/ImEx/index.less +7 -0
- package/lib/lowcode/view/lc-components/ImEx/meta.json +55 -23
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +11 -18
- package/lib/lowcode/view/lc-components/Layout/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Page/meta.json +2 -2
- package/lib/lowcode/view/lc-components/PageContent/index.js +7 -8
- package/lib/lowcode/view/lc-components/PageFooter/index.js +2 -5
- package/lib/lowcode/view/lc-components/PageHeader/index.js +4 -5
- package/lib/lowcode/view/lc-components/PageLayout/FunctionDesign.js +71 -0
- package/lib/lowcode/view/lc-components/PageLayout/FunctionLive.js +17 -0
- package/lib/lowcode/view/lc-components/PageLayout/FunctionPreview.js +17 -0
- package/lib/lowcode/view/lc-components/PageLayout/index.js +40 -0
- package/lib/lowcode/view/lc-components/PageLayout/meta.json +47 -0
- package/lib/lowcode/view/lc-components/PageModal/index.js +11 -14
- package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +2 -8
- package/lib/lowcode/view/lc-components/Section/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +19 -20
- package/lib/lowcode/view/lc-components/Split/index.js +2 -6
- package/lib/lowcode/view/lc-components/Split/meta.json +4 -4
- package/lib/lowcode/view/lc-components/Table/components/TopImex.js +145 -0
- package/lib/lowcode/view/lc-components/Table/index.js +123 -38
- package/lib/lowcode/view/lc-components/Table/meta.json +17 -11
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +11 -18
- package/lib/lowcode/view/lc-components/Tabs/index.js +3 -1
- package/lib/lowcode/view/lc-components/Tabs/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Tree/index.js +65 -16
- package/lib/lowcode/view/lc-components/Tree/meta.json +62 -7
- package/lib/lowcode/view/lc-components/Wrapper.js +8 -10
- package/lib/services.js +0 -25
- package/lib/upload/FilesWall/file.png +0 -0
- package/lib/upload/FilesWall/index.js +429 -0
- package/lib/upload/FilesWall/index.less +74 -0
- package/lib/upload/Form/index.js +2 -1
- package/lib/upload/FormItem/index.js +3 -5
- package/lib/upload/index.js +8 -1
- package/lib/utils/action.js +2 -2
- package/package.json +5 -4
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
@@ -10,7 +9,7 @@ import { useCreation, useMemoizedFn } from 'ahooks';
|
|
|
10
9
|
import { Modal, recheck } from '@luck-design-biz/base';
|
|
11
10
|
import { Button, Menu, Dropdown, Icon, Divider } from 'luck-design/antd';
|
|
12
11
|
import classNames from 'classnames';
|
|
13
|
-
import { reduce } from 'lodash';
|
|
12
|
+
import { reduce, isNil } from 'lodash';
|
|
14
13
|
import { getResources } from "../../helper/ldComBuild";
|
|
15
14
|
import styles from "./index.less";
|
|
16
15
|
var DisplayComp = function DisplayComp(_ref) {
|
|
@@ -64,22 +63,21 @@ var LDActions = function LDActions(_ref2) {
|
|
|
64
63
|
});
|
|
65
64
|
var actionMap = useCreation(function () {
|
|
66
65
|
return reduce(todoList, function (ret, action, index) {
|
|
67
|
-
ret[action.serial]
|
|
68
|
-
|
|
69
|
-
}
|
|
66
|
+
if (!isNil(action.serial) && !ret[action.serial]) {
|
|
67
|
+
ret[action.serial] = Math.pow(2, index);
|
|
68
|
+
}
|
|
70
69
|
return ret;
|
|
71
70
|
}, {});
|
|
72
71
|
}, [todoList]);
|
|
73
72
|
var mySerialsValue = useCreation(function () {
|
|
74
73
|
return reduce(resources, function (ret, resKey) {
|
|
75
|
-
|
|
76
|
-
ret |= ((_actionMap$resKey = actionMap[resKey]) === null || _actionMap$resKey === void 0 ? void 0 : _actionMap$resKey.serialValue) || 0;
|
|
74
|
+
ret |= actionMap[resKey] || 0;
|
|
77
75
|
return ret;
|
|
78
76
|
}, 0);
|
|
79
77
|
}, [resources, actionMap]);
|
|
80
78
|
var _useCreation = useCreation(function () {
|
|
81
|
-
var approvedActions = reduce(
|
|
82
|
-
if (mySerialsValue & action.
|
|
79
|
+
var approvedActions = reduce(todoList, function (ret, action) {
|
|
80
|
+
if (isNil(action.serial) || mySerialsValue & actionMap[action.serial]) {
|
|
83
81
|
ret.push(action);
|
|
84
82
|
} else if (action.serialEffect === 'disable') {
|
|
85
83
|
ret.push(action);
|
|
@@ -89,7 +87,7 @@ var LDActions = function LDActions(_ref2) {
|
|
|
89
87
|
var _length = approvedActions.length;
|
|
90
88
|
var _permanent = approvedActions.splice(0, max >= _length ? _length : max - 1);
|
|
91
89
|
return [_permanent, approvedActions];
|
|
92
|
-
}, [max, mySerialsValue, actionMap]),
|
|
90
|
+
}, [max, mySerialsValue, actionMap, todoList]),
|
|
93
91
|
_useCreation2 = _slicedToArray(_useCreation, 2),
|
|
94
92
|
permanent = _useCreation2[0],
|
|
95
93
|
more = _useCreation2[1];
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
@spanDefault: #262626;
|
|
2
|
-
@spanPrimary: var(--
|
|
2
|
+
@spanPrimary: var(--ant-primary-color);
|
|
3
3
|
@spanDanger: #ff4d4f;
|
|
4
4
|
@spanDestroy: #820014;
|
|
5
5
|
|
|
6
6
|
.ldActions {
|
|
7
7
|
|
|
8
8
|
button:not(:last-child) {
|
|
9
|
-
margin-right:
|
|
9
|
+
margin-right: 4px;
|
|
10
|
+
}
|
|
11
|
+
button:not(:first-child) {
|
|
12
|
+
margin-left: 4px;
|
|
10
13
|
}
|
|
11
14
|
span {
|
|
12
15
|
cursor: pointer;
|
|
@@ -20,8 +23,8 @@
|
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
button.primary {
|
|
23
|
-
background-color: var(--
|
|
24
|
-
border-color: var(--
|
|
26
|
+
background-color: var(--ant-primary-color);
|
|
27
|
+
border-color: var(--ant-primary-color);
|
|
25
28
|
color: white;
|
|
26
29
|
}
|
|
27
30
|
span.primary {
|
|
@@ -2,9 +2,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["columns", "resources", "actions", "doAction", "ldId", "dataSetKey", "filedsRewrite", "mainFormLdId", "mainDataSetKey", "onValueChange", "onQuery", "onAdd", "onUpdate", "moduleCode", "defaultDataSourceFormat", "ticketData", "relationKey"];
|
|
5
|
+
var _excluded = ["columns", "resources", "actions", "doAction", "ldId", "dataSetKey", "filedsRewrite", "mainFormLdId", "mainDataSetKey", "onValueChange", "onQuery", "onAdd", "onUpdate", "moduleCode", "defaultDataSourceFormat", "ticketData", "relationKey", "fields", "setVerifyRules"];
|
|
6
6
|
import React, { createRef, useContext } from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { reduce, keyBy, isEmpty, pick, union } from 'lodash';
|
|
8
|
+
import { BasicDivider } from 'luck-design';
|
|
8
9
|
import { AutoForm } from '@luck-design-biz/base/FormList';
|
|
9
10
|
import ldBuilder from "../../helper/ldBuilder";
|
|
10
11
|
import { getFormItem, formItemDataFormat, dataFormat, behaviorCall } from "../../utils";
|
|
@@ -41,20 +42,35 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
|
|
|
41
42
|
ticketData = _ref$ticketData === void 0 ? {} : _ref$ticketData,
|
|
42
43
|
_ref$relationKey = _ref.relationKey,
|
|
43
44
|
relationKey = _ref$relationKey === void 0 ? window.appConfig.constraintKeys.PRIMARY : _ref$relationKey,
|
|
45
|
+
fields = _ref.fields,
|
|
46
|
+
setVerifyRules = _ref.setVerifyRules,
|
|
44
47
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
45
48
|
var _ref2 = useContext(LuckDaContext) || {},
|
|
46
49
|
setFieldProps = _ref2.setFieldProps;
|
|
47
|
-
var defaultValues = /*#__PURE__*/createRef();
|
|
50
|
+
var defaultValues = /*#__PURE__*/createRef({});
|
|
48
51
|
var isMain = ldId === mainFormLdId;
|
|
49
52
|
var basicItems = function () {
|
|
53
|
+
var fieldsObj = keyBy(fields, 'field');
|
|
54
|
+
var columnsObj = keyBy(columns, 'field');
|
|
55
|
+
var keys = isEmpty(fields) ? Object.keys(columnsObj) : union(Object.keys(fieldsObj), Object.keys(columnsObj));
|
|
50
56
|
var _defaultValues = {};
|
|
51
|
-
var _nodes =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
var _nodes = reduce(keys, function (result, key) {
|
|
58
|
+
var setting = fieldsObj[key];
|
|
59
|
+
var col = columnsObj[key];
|
|
60
|
+
if ((setting === null || setting === void 0 ? void 0 : setting._type) === 'divider') {
|
|
61
|
+
result.push( /*#__PURE__*/React.createElement(BasicDivider, {
|
|
62
|
+
title: setting === null || setting === void 0 ? void 0 : setting.aliasName
|
|
63
|
+
}));
|
|
64
|
+
} else if (col !== null && col !== void 0 && col.isShowInForm) {
|
|
65
|
+
var customFiled = filedsRewrite.find(function (_field) {
|
|
66
|
+
return _field.name === col.aliaName;
|
|
55
67
|
}) || {};
|
|
56
68
|
_defaultValues = _objectSpread(_objectSpread({}, _defaultValues), {}, _defineProperty(_defineProperty({}, col.aliaName, col['optDefaultValue']), "".concat(col.aliaName, "_virtual"), col['optDefaultValueCvt']));
|
|
57
|
-
|
|
69
|
+
var newCol = _objectSpread(_objectSpread({}, col), {}, {
|
|
70
|
+
setVerifyRules: setVerifyRules,
|
|
71
|
+
fieldName: (setting === null || setting === void 0 ? void 0 : setting.aliasName) || col.fieldName
|
|
72
|
+
}, pick(setting, ['col', 'row', 'note', 'tip', 'placeholder']));
|
|
73
|
+
result.push(getFormItem(newCol, _objectSpread(_objectSpread({
|
|
58
74
|
formId: ldId,
|
|
59
75
|
moduleCode: moduleCode
|
|
60
76
|
}, customFiled), {}, {
|
|
@@ -63,6 +79,8 @@ var buildLdAutoForm = function buildLdAutoForm(_ref) {
|
|
|
63
79
|
}
|
|
64
80
|
})));
|
|
65
81
|
}
|
|
82
|
+
;
|
|
83
|
+
return result;
|
|
66
84
|
}, []);
|
|
67
85
|
defaultValues.current = _defaultValues;
|
|
68
86
|
setFieldProps && setFieldProps(_defineProperty({}, ldId, _nodes.map(function (i) {
|
|
@@ -6,11 +6,11 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
9
|
-
var _excluded = ["namespace", "formState", "formMode", "formOperates", "loading", "wrapperRef", "readOnly", "mainFormLdId", "renderFormList", "renderAffixLeft", "renderAffixRight", "beforeSubmit", "showSaveBtn", "saveBtnTitle", "affixLayout", "onValueChange", "afterSubmit", "renderFormExtra", "bpmButtonProps"],
|
|
9
|
+
var _excluded = ["namespace", "formState", "formMode", "formOperates", "loading", "wrapperRef", "readOnly", "mainFormLdId", "renderFormList", "renderAffixLeft", "renderAffixRight", "beforeSubmit", "showSaveBtn", "saveBtnTitle", "affixLayout", "onValueChange", "afterSubmit", "renderFormExtra", "bpmButtonProps", "setVerifyRules"],
|
|
10
10
|
_excluded2 = ["dataSets", "doAction", "resources"],
|
|
11
11
|
_excluded3 = ["id", "header", "title", "readOnly", "extraConfig", "renderTopLeft", "serial"],
|
|
12
12
|
_excluded4 = ["ldId", "initData", "overModel"];
|
|
13
|
-
import React, { useContext, useRef, forwardRef, Fragment, useImperativeHandle, useState } from 'react';
|
|
13
|
+
import React, { useContext, useRef, forwardRef, Fragment, useImperativeHandle, useState, useEffect } from 'react';
|
|
14
14
|
import { connect, getDvaApp, useRouteMatch } from 'umi';
|
|
15
15
|
import PropTypes from 'prop-types';
|
|
16
16
|
import { isArray, sortBy, mapValues, reduce, includes } from 'lodash';
|
|
@@ -26,7 +26,7 @@ import { LuckDaContext } from "../Builder";
|
|
|
26
26
|
import { LuckDaPopContext } from "../LdPop";
|
|
27
27
|
import createModel from "./model";
|
|
28
28
|
import { onBatchSubmitAction } from "../../helper/action";
|
|
29
|
-
import
|
|
29
|
+
import useTodo from "../../lowcode/engine/tools/useTodo";
|
|
30
30
|
|
|
31
31
|
// 组件
|
|
32
32
|
var LdFormList = function LdFormList(_ref) {
|
|
@@ -55,8 +55,10 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
55
55
|
} : _ref$renderFormExtra,
|
|
56
56
|
_ref$bpmButtonProps = _ref.bpmButtonProps,
|
|
57
57
|
bpmButtonProps = _ref$bpmButtonProps === void 0 ? {} : _ref$bpmButtonProps,
|
|
58
|
+
setVerifyRules = _ref.setVerifyRules,
|
|
58
59
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
59
60
|
var PRIMARY = window.appConfig.constraintKeys.PRIMARY;
|
|
61
|
+
var currentValueRef = useRef(null);
|
|
60
62
|
var _useState = useState(false),
|
|
61
63
|
_useState2 = _slicedToArray(_useState, 2),
|
|
62
64
|
submitLoading = _useState2[0],
|
|
@@ -69,6 +71,10 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
69
71
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
70
72
|
bizData = _useState6[0],
|
|
71
73
|
setBizData = _useState6[1];
|
|
74
|
+
var _useTodo = useTodo(),
|
|
75
|
+
_useTodo2 = _slicedToArray(_useTodo, 2),
|
|
76
|
+
_ = _useTodo2[0],
|
|
77
|
+
callBehavior = _useTodo2[1];
|
|
72
78
|
var luckTheme = useCreation(function () {
|
|
73
79
|
return document.body.getAttribute('luck-theme');
|
|
74
80
|
}, []);
|
|
@@ -82,6 +88,9 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
82
88
|
var formListRef = useRef(null);
|
|
83
89
|
useImperativeHandle(wrapperRef, function () {
|
|
84
90
|
return _objectSpread(_objectSpread({}, formListRef.current), {}, {
|
|
91
|
+
getCValue: function getCValue() {
|
|
92
|
+
return currentValueRef.current || props.formData;
|
|
93
|
+
},
|
|
85
94
|
onLdQuery: function onLdQuery() {
|
|
86
95
|
var _params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
87
96
|
if (props.formMode !== 'add') {
|
|
@@ -105,6 +114,7 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
105
114
|
var getValue = ((_formRefs$key = formRefs[key]) !== null && _formRefs$key !== void 0 && (_formRefs$key = _formRefs$key.formRef) !== null && _formRefs$key !== void 0 && _formRefs$key.current ? formRefs[key].getData : null) || ((_formRefs$key$current = formRefs[key].current) === null || _formRefs$key$current === void 0 ? void 0 : _formRefs$key$current.getFieldsValue);
|
|
106
115
|
return _defineProperty({}, key, getValue && getValue());
|
|
107
116
|
});
|
|
117
|
+
currentValueRef.current = data;
|
|
108
118
|
onValueChange(change, data);
|
|
109
119
|
});
|
|
110
120
|
var renderExtra = useMemoizedFn(function (formId, extraConfig, type) {
|
|
@@ -124,7 +134,7 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
124
134
|
}, bpmButtonProps)));
|
|
125
135
|
};
|
|
126
136
|
useAsyncEffect( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
127
|
-
var _props$formData$mainF, _params, response, _yield$
|
|
137
|
+
var _props$formData$mainF, _params, response, _yield$callBehavior, code, data, _props$formData$mainF2, _props$formData$mainF3, bpmInfoObj, tempObj;
|
|
128
138
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
129
139
|
while (1) switch (_context.prev = _context.next) {
|
|
130
140
|
case 0:
|
|
@@ -134,13 +144,14 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
134
144
|
}
|
|
135
145
|
_params = {
|
|
136
146
|
indocno: (_props$formData$mainF = props.formData[mainFormLdId]) === null || _props$formData$mainF === void 0 ? void 0 : _props$formData$mainF[PRIMARY],
|
|
147
|
+
mainDataSetKey: mainDataSetKey
|
|
148
|
+
}; // 请求是否有工作流服务
|
|
149
|
+
_context.next = 4;
|
|
150
|
+
return callBehavior({
|
|
137
151
|
moduleCode: rest.moduleCode,
|
|
138
152
|
datasetCode: mainDataSetKey,
|
|
139
|
-
mainDataSetKey: mainDataSetKey,
|
|
140
153
|
behaviorKey: 'readBpmDeploy'
|
|
141
|
-
};
|
|
142
|
-
_context.next = 4;
|
|
143
|
-
return readBehaviorCall(_params);
|
|
154
|
+
}, _params);
|
|
144
155
|
case 4:
|
|
145
156
|
response = _context.sent;
|
|
146
157
|
if (!(response.code === 1 && response.data)) {
|
|
@@ -148,13 +159,15 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
148
159
|
break;
|
|
149
160
|
}
|
|
150
161
|
_context.next = 8;
|
|
151
|
-
return
|
|
162
|
+
return callBehavior({
|
|
163
|
+
moduleCode: rest.moduleCode,
|
|
164
|
+
datasetCode: mainDataSetKey,
|
|
152
165
|
behaviorKey: 'readBpm'
|
|
153
|
-
})
|
|
166
|
+
}, _params);
|
|
154
167
|
case 8:
|
|
155
|
-
_yield$
|
|
156
|
-
code = _yield$
|
|
157
|
-
data = _yield$
|
|
168
|
+
_yield$callBehavior = _context.sent;
|
|
169
|
+
code = _yield$callBehavior.code;
|
|
170
|
+
data = _yield$callBehavior.data;
|
|
158
171
|
if (code == 1 && data) {
|
|
159
172
|
bpmInfoObj = data.bpmInfo;
|
|
160
173
|
tempObj = _objectSpread(_objectSpread({}, props.formData[mainFormLdId]), {}, {
|
|
@@ -261,7 +274,9 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
261
274
|
var _o$props;
|
|
262
275
|
return o.order || ((_o$props = o.props) === null || _o$props === void 0 ? void 0 : _o$props.order);
|
|
263
276
|
}).map(function (formProps) {
|
|
264
|
-
|
|
277
|
+
var _formProps$type = formProps.type,
|
|
278
|
+
type = _formProps$type === void 0 ? 'auto' : _formProps$type;
|
|
279
|
+
if (includes(['auto', 'writer', 'grid'], type)) {
|
|
265
280
|
var _ref8 = formProps || {},
|
|
266
281
|
ldId = _ref8.id,
|
|
267
282
|
_ref8$header = _ref8.header,
|
|
@@ -276,17 +291,15 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
276
291
|
} : _ref8$renderTopLeft,
|
|
277
292
|
serial = _ref8.serial,
|
|
278
293
|
_props = _objectWithoutProperties(_ref8, _excluded3);
|
|
279
|
-
var _props$type = _props.type,
|
|
280
|
-
type = _props$type === void 0 ? 'auto' : _props$type;
|
|
281
294
|
var renderForm = type === 'auto' ? buildLdAutoForm : buildLdGridForm;
|
|
282
295
|
var _readOnly = selfReadOnly || serial && !includes(resources, serial);
|
|
283
296
|
if (header === 'collapse' || header === 'collapseFollow') return /*#__PURE__*/React.createElement(Collapse, {
|
|
284
297
|
title: title || ldId,
|
|
285
|
-
extra: type === 'auto' && renderExtra(ldId, extraConfig, luckTheme === 'base' ? 'text' : 'graphic'),
|
|
298
|
+
extra: type === 'auto' && formProps.dataSetKey && renderExtra(ldId, extraConfig, luckTheme === 'base' ? 'text' : 'graphic'),
|
|
286
299
|
id: ldId,
|
|
287
300
|
key: ldId,
|
|
288
301
|
mode: header === 'collapse' && ldId !== mainFormLdId && 'tab'
|
|
289
|
-
}, renderForm(_objectSpread(_objectSpread({}, _props), {}, {
|
|
302
|
+
}, formProps.dataSetKey && renderForm(_objectSpread(_objectSpread({}, _props), {}, {
|
|
290
303
|
ldId: ldId,
|
|
291
304
|
mainFormLdId: mainFormLdId,
|
|
292
305
|
mainDataSetKey: mainDataSetKey,
|
|
@@ -295,18 +308,19 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
295
308
|
ticketData: props.ticketData,
|
|
296
309
|
renderTopLeft: function renderTopLeft() {
|
|
297
310
|
return type === 'auto' ? _renderTopLeft() : [renderExtra(ldId, extraConfig, 'text'), _renderTopLeft()];
|
|
298
|
-
}
|
|
311
|
+
},
|
|
312
|
+
setVerifyRules: setVerifyRules
|
|
299
313
|
})));
|
|
300
314
|
return /*#__PURE__*/React.createElement(Fragment, {
|
|
301
315
|
key: ldId
|
|
302
316
|
}, header === 'divider' && /*#__PURE__*/React.createElement(BasicDivider, {
|
|
303
317
|
title: title || ldId,
|
|
304
318
|
id: ldId
|
|
305
|
-
}), type === 'auto' && /*#__PURE__*/React.createElement("div", {
|
|
319
|
+
}), type === 'auto' && formProps.dataSetKey && /*#__PURE__*/React.createElement("div", {
|
|
306
320
|
style: {
|
|
307
321
|
textAlign: 'right'
|
|
308
322
|
}
|
|
309
|
-
}, renderExtra(ldId, extraConfig, luckTheme === 'base' ? 'text' : 'graphic')), renderForm(_objectSpread(_objectSpread({}, _props), {}, {
|
|
323
|
+
}, renderExtra(ldId, extraConfig, luckTheme === 'base' ? 'text' : 'graphic')), formProps.dataSetKey && renderForm(_objectSpread(_objectSpread({}, _props), {}, {
|
|
310
324
|
ldId: ldId,
|
|
311
325
|
mainFormLdId: mainFormLdId,
|
|
312
326
|
mainDataSetKey: mainDataSetKey,
|
|
@@ -315,7 +329,8 @@ var LdFormList = function LdFormList(_ref) {
|
|
|
315
329
|
ticketData: props.ticketData,
|
|
316
330
|
renderTopLeft: function renderTopLeft() {
|
|
317
331
|
return type === 'auto' ? _renderTopLeft() : [renderExtra(ldId, extraConfig, luckTheme === 'base' ? 'text' : 'graphic'), _renderTopLeft()];
|
|
318
|
-
}
|
|
332
|
+
},
|
|
333
|
+
setVerifyRules: setVerifyRules
|
|
319
334
|
})));
|
|
320
335
|
}
|
|
321
336
|
return ChildrenUtil.deepMap(formProps, function (child) {
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["columns", "resources", "actions", "doAction", "afterInit", "namespace", "wrapperRef", "list", "detail", "params", "filters", "loading", "unclosableSet", "onQuery", "doQuery", "pagination", "pageno", "pagesize", "totalCount", "columnsRewrite", "columnsReset", "batchOperations", "formatDataSource", "resultSet", "actionsColumn", "readFilter", "isFlow", "isTreeGrid", "writable"],
|
|
5
|
+
var _excluded = ["columns", "resources", "actions", "doAction", "afterInit", "namespace", "wrapperRef", "list", "detail", "params", "filters", "_loading", "loading", "unclosableSet", "onQuery", "doQuery", "pagination", "pageno", "pagesize", "totalCount", "columnsRewrite", "columnsReset", "batchOperations", "formatDataSource", "resultSet", "actionsColumn", "readFilter", "isFlow", "isTreeGrid", "writable"],
|
|
6
6
|
_excluded2 = ["ldId", "moduleCode", "suppressInit", "overModel", "afterQuery", "isTreeGrid"];
|
|
7
7
|
import React, { forwardRef, useImperativeHandle, useRef, useEffect } from 'react';
|
|
8
8
|
import { getDvaApp } from 'umi';
|
|
@@ -26,6 +26,7 @@ var LdGrid = function LdGrid(_ref) {
|
|
|
26
26
|
detail = _ref.detail,
|
|
27
27
|
params = _ref.params,
|
|
28
28
|
filters = _ref.filters,
|
|
29
|
+
_loading = _ref._loading,
|
|
29
30
|
loading = _ref.loading,
|
|
30
31
|
unclosableSet = _ref.unclosableSet,
|
|
31
32
|
onQuery = _ref.onQuery,
|
|
@@ -66,6 +67,12 @@ var LdGrid = function LdGrid(_ref) {
|
|
|
66
67
|
}, [params, filters]);
|
|
67
68
|
useImperativeHandle(wrapperRef, function () {
|
|
68
69
|
return _objectSpread(_objectSpread({}, gridRef.current), {}, {
|
|
70
|
+
getProps: function getProps() {
|
|
71
|
+
var _getDvaApp;
|
|
72
|
+
return {
|
|
73
|
+
apiUrl: (_getDvaApp = getDvaApp()) === null || _getDvaApp === void 0 || (_getDvaApp = _getDvaApp._store.getState()[namespace]) === null || _getDvaApp === void 0 ? void 0 : _getDvaApp.apiUrl
|
|
74
|
+
};
|
|
75
|
+
},
|
|
69
76
|
onLdQuery: function onLdQuery() {
|
|
70
77
|
var _params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
71
78
|
doQuery({
|
|
@@ -142,7 +149,7 @@ var LdGrid = function LdGrid(_ref) {
|
|
|
142
149
|
,
|
|
143
150
|
actionsColumn: _actionsColumn,
|
|
144
151
|
batchOperations: _batchOperations,
|
|
145
|
-
loading: loading,
|
|
152
|
+
loading: _loading || loading,
|
|
146
153
|
pagination: isFlow ? false : _objectSpread({
|
|
147
154
|
total: total,
|
|
148
155
|
current: current,
|
|
@@ -173,11 +180,11 @@ var LdIndex = function LdIndex(_ref2) {
|
|
|
173
180
|
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
174
181
|
var isTreeGrid = isNil(_isTreeGrid) ? includes(props.isTree, props.dataSetKey) : _isTreeGrid;
|
|
175
182
|
var Component = useCreation(function () {
|
|
176
|
-
var
|
|
177
|
-
(
|
|
178
|
-
if (!((
|
|
179
|
-
var
|
|
180
|
-
(
|
|
183
|
+
var _getDvaApp2, _getDvaApp3;
|
|
184
|
+
(_getDvaApp2 = getDvaApp()) === null || _getDvaApp2 === void 0 || _getDvaApp2.unmodel(namespace);
|
|
185
|
+
if (!((_getDvaApp3 = getDvaApp()) !== null && _getDvaApp3 !== void 0 && _getDvaApp3._store.getState()[namespace])) {
|
|
186
|
+
var _getDvaApp4;
|
|
187
|
+
(_getDvaApp4 = getDvaApp()) === null || _getDvaApp4 === void 0 || _getDvaApp4.model(createModel(namespace, _objectSpread(_objectSpread({
|
|
181
188
|
behaviorKey: isTreeGrid ? 'readTree' : 'readGrid'
|
|
182
189
|
}, overModel), {}, {
|
|
183
190
|
isFlow: isTreeGrid || !!props.isFlow,
|
|
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["columns", "resources", "actions", "doAction", "ldId", "dataSetKey", "columnsRewrite", "columnsReset", "onQuery", "onAdd", "onUpdate", "onDelete", "mainFormLdId", "mainDataSetKey", "onValueChange", "type", "afterOperate", "moduleCode", "defaultDataSourceFormat", "ticketData", "className", "formRef", "formMode"];
|
|
6
|
-
import React, { createRef, useContext
|
|
7
|
-
import {
|
|
5
|
+
var _excluded = ["columns", "resources", "actions", "doAction", "ldId", "dataSetKey", "columnsRewrite", "columnsReset", "onQuery", "onAdd", "onUpdate", "onDelete", "mainFormLdId", "mainDataSetKey", "onValueChange", "type", "afterOperate", "moduleCode", "defaultDataSourceFormat", "ticketData", "className", "formRef", "formMode", "fields", "setVerifyRules"];
|
|
6
|
+
import React, { createRef, useContext } from 'react';
|
|
7
|
+
import { reduce, keyBy, isEmpty, pick } from 'lodash';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import ldBuilder from "../../helper/ldBuilder";
|
|
10
10
|
import { GridForm } from '@luck-design-biz/base/FormList';
|
|
@@ -51,10 +51,12 @@ var buildLdGridForm = function buildLdGridForm(_ref) {
|
|
|
51
51
|
className = _ref.className,
|
|
52
52
|
formRef = _ref.formRef,
|
|
53
53
|
formMode = _ref.formMode,
|
|
54
|
+
fields = _ref.fields,
|
|
55
|
+
setVerifyRules = _ref.setVerifyRules,
|
|
54
56
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
55
57
|
var _ref2 = useContext(LuckDaContext) || {},
|
|
56
58
|
setFieldProps = _ref2.setFieldProps;
|
|
57
|
-
var defaultValues = /*#__PURE__*/createRef();
|
|
59
|
+
var defaultValues = /*#__PURE__*/createRef({});
|
|
58
60
|
var isMain = ldId === mainFormLdId;
|
|
59
61
|
var gridColumns = columns.map(function (col) {
|
|
60
62
|
if ((col.comName || defaultComName[col.property]) === 'radio') return _objectSpread(_objectSpread({}, col), {}, {
|
|
@@ -63,8 +65,13 @@ var buildLdGridForm = function buildLdGridForm(_ref) {
|
|
|
63
65
|
return col;
|
|
64
66
|
});
|
|
65
67
|
var _columns = function () {
|
|
68
|
+
var fieldsObj = keyBy(fields, 'field');
|
|
69
|
+
var columnsObj = keyBy(gridColumns, 'field');
|
|
70
|
+
var keys = isEmpty(fields) ? Object.keys(columnsObj) : Object.keys(fieldsObj);
|
|
66
71
|
var _defaultValues = {};
|
|
67
|
-
var _nodes =
|
|
72
|
+
var _nodes = reduce(keys, function (result, key) {
|
|
73
|
+
var setting = fieldsObj[key];
|
|
74
|
+
var col = columnsObj[key];
|
|
68
75
|
if (col.isShowInForm) {
|
|
69
76
|
var _customColumn;
|
|
70
77
|
var customColumn = columnsRewrite.find(function (column) {
|
|
@@ -75,7 +82,11 @@ var buildLdGridForm = function buildLdGridForm(_ref) {
|
|
|
75
82
|
mode: 'grid'
|
|
76
83
|
});
|
|
77
84
|
_defaultValues = _objectSpread(_objectSpread({}, _defaultValues), {}, _defineProperty(_defineProperty({}, col.aliaName, col['optDefaultValue']), "".concat(col.aliaName, "_virtual"), col['optDefaultValueCvt']));
|
|
78
|
-
|
|
85
|
+
var newCol = _objectSpread(_objectSpread({}, col), {}, {
|
|
86
|
+
setVerifyRules: setVerifyRules,
|
|
87
|
+
fieldName: (setting === null || setting === void 0 ? void 0 : setting.aliasName) || col.fieldName
|
|
88
|
+
});
|
|
89
|
+
result.push(getFormColumn(type, newCol, _objectSpread(_objectSpread(_objectSpread({}, pick(setting, ['width', 'align', 'headerAlign', 'pinned', 'tip'])), customColumn), {}, {
|
|
79
90
|
formItemRewrite: _objectSpread(_objectSpread({}, (_customColumn = customColumn) === null || _customColumn === void 0 ? void 0 : _customColumn.formItemRewrite), {}, {
|
|
80
91
|
moduleCode: moduleCode,
|
|
81
92
|
formRef: formRef,
|
|
@@ -83,6 +94,7 @@ var buildLdGridForm = function buildLdGridForm(_ref) {
|
|
|
83
94
|
})
|
|
84
95
|
})));
|
|
85
96
|
}
|
|
97
|
+
return result;
|
|
86
98
|
}, []);
|
|
87
99
|
defaultValues.current = _defaultValues;
|
|
88
100
|
setFieldProps && setFieldProps(_defineProperty({}, ldId, _nodes.map(function (col) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["columns", "resources", "actions", "doAction", "wrapperRef", "ldId", "dataSetKey", "defaultParmas", "moduleCode", "readOnly", "title", "rowKey", "treeNodeTitle", "unselectableNodes", "rightMenus", "defaultExpandDeep", "draggable", "onDrop", "className", "treeClassName", "rootAdd", "suppressInit", "afterQuery", "afterInit", "isTree", "service", "dataToTreeFormat", "boxRef", "doubleClickExpand", "onNodeDoubleClick", "width", "height", "treeNodeCheckable", "treeNodeDisableCheckbox", "treeNodeDisable", "treeNodeIcon", "asyncLoad", "parentKey", "onMount", "onUnmount", "onDataSetChange", "onTreeNodeRender"],
|
|
7
|
+
var _excluded = ["columns", "resources", "actions", "doAction", "wrapperRef", "ldId", "dataSetKey", "defaultParmas", "moduleCode", "readOnly", "title", "rowKey", "treeNodeTitle", "unselectableNodes", "rightMenus", "defaultExpandDeep", "draggable", "onDrop", "className", "treeClassName", "rootAdd", "suppressInit", "afterQuery", "afterInit", "isTree", "service", "dataToTreeFormat", "boxRef", "doubleClickExpand", "onNodeDoubleClick", "width", "height", "treeNodeCheckable", "treeNodeDisableCheckbox", "treeNodeDisable", "treeNodeIcon", "asyncLoad", "parentKey", "onMount", "onUnmount", "onDataSetChange", "onTreeNodeRender", "onlyRoot"],
|
|
7
8
|
_excluded2 = ["onClick"];
|
|
8
9
|
import React, { useState, useRef, useImperativeHandle, forwardRef, useLayoutEffect } from 'react';
|
|
9
10
|
import { isFunction, isNumber, transform, includes, remove, cloneDeep, isNil } from 'lodash';
|
|
@@ -61,6 +62,7 @@ var LdTree = function LdTree(_ref) {
|
|
|
61
62
|
onUnmount = _ref.onUnmount,
|
|
62
63
|
onDataSetChange = _ref.onDataSetChange,
|
|
63
64
|
onTreeNodeRender = _ref.onTreeNodeRender,
|
|
65
|
+
onlyRoot = _ref.onlyRoot,
|
|
64
66
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
65
67
|
if (!includes(isTree, dataSetKey)) return formatMessage({
|
|
66
68
|
id: 'luckda.ldTree.notTrees',
|
|
@@ -75,6 +77,7 @@ var LdTree = function LdTree(_ref) {
|
|
|
75
77
|
defaultExpandedProps = _useState4[0],
|
|
76
78
|
setDefaultExpandedProps = _useState4[1];
|
|
77
79
|
var treeRef = useRef(null);
|
|
80
|
+
var onceRef = useRef(true);
|
|
78
81
|
var defaultParams = useCreation(function () {
|
|
79
82
|
var _params = [_objectSpread({
|
|
80
83
|
moduleCode: moduleCode,
|
|
@@ -112,7 +115,8 @@ var LdTree = function LdTree(_ref) {
|
|
|
112
115
|
}
|
|
113
116
|
var treeData = dataToTreeFormat ? dataToTreeFormat(data) : dataToTree(data, null, window.appConfig.constraintKeys.PRIMARY, window.appConfig.constraintKeys.PARENT);
|
|
114
117
|
setDataSource(treeData);
|
|
115
|
-
afterInit && afterInit(treeData);
|
|
118
|
+
onceRef.current && afterInit && afterInit(treeData, data);
|
|
119
|
+
onceRef.current = false;
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
122
|
}),
|
|
@@ -218,10 +222,25 @@ var LdTree = function LdTree(_ref) {
|
|
|
218
222
|
});
|
|
219
223
|
var handleDrop = useMemoizedFn(function (info) {
|
|
220
224
|
var dragInfo = dragTreeData(info, dataSource);
|
|
221
|
-
onDrop
|
|
225
|
+
if (onDrop) onDrop(info, dragInfo);else if (dragInfo !== false) {
|
|
226
|
+
doAction('drag', {
|
|
227
|
+
get: {
|
|
228
|
+
datasetCode: dataSetKey
|
|
229
|
+
},
|
|
230
|
+
post: {
|
|
231
|
+
fromId: info.dragNode.props.dataRef[PRIMARY],
|
|
232
|
+
toId: info.node.props.dataRef[PRIMARY]
|
|
233
|
+
}
|
|
234
|
+
}, {
|
|
235
|
+
showConfirm: false,
|
|
236
|
+
callback: function callback(success) {
|
|
237
|
+
return success && onLdQuery();
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
222
241
|
});
|
|
223
242
|
var onAdd = useCreation(function () {
|
|
224
|
-
return !(readOnly || !rootAdd || rootAdd.resource && !includes(resources, rootAdd.resource)) ? function () {
|
|
243
|
+
return !(readOnly || !rootAdd || rootAdd.resource && !includes(resources, rootAdd.resource) || onlyRoot && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0) ? function () {
|
|
225
244
|
return handleMenuClick(rootAdd);
|
|
226
245
|
} : null;
|
|
227
246
|
}, [readOnly, rootAdd, resources]);
|
|
@@ -233,18 +252,17 @@ var LdTree = function LdTree(_ref) {
|
|
|
233
252
|
return;
|
|
234
253
|
}
|
|
235
254
|
(service || behaviorCall)(_objectSpread(_objectSpread({}, params[0]), {}, _defineProperty({}, parentKey, treeNode.props.dataRef[window.appConfig.constraintKeys.PRIMARY]))).then(function (res) {
|
|
236
|
-
|
|
255
|
+
var code = res.code,
|
|
256
|
+
list = res.list,
|
|
257
|
+
detail = res.detail;
|
|
258
|
+
if (code === 1) {
|
|
259
|
+
treeNode.props.dataRef.children = list.map(function (i) {
|
|
260
|
+
return detail[i];
|
|
261
|
+
});
|
|
262
|
+
setDataSource(_toConsumableArray(dataSource));
|
|
263
|
+
resolve();
|
|
264
|
+
}
|
|
237
265
|
});
|
|
238
|
-
// setTimeout(() => {
|
|
239
|
-
// treeNode.props.dataRef.children = [
|
|
240
|
-
// { title: 'Child Node', key: `${treeNode.props.eventKey}-0` },
|
|
241
|
-
// { title: 'Child Node', key: `${treeNode.props.eventKey}-1` },
|
|
242
|
-
// ];
|
|
243
|
-
// this.setState({
|
|
244
|
-
// treeData: [...this.state.treeData],
|
|
245
|
-
// });
|
|
246
|
-
// resolve();
|
|
247
|
-
// }, 1000);
|
|
248
266
|
});
|
|
249
267
|
});
|
|
250
268
|
var asyncLoadData = useCreation(function () {
|
package/es/helper/form.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["extra"];
|
|
4
|
-
import { isNil } from 'lodash';
|
|
3
|
+
var _excluded = ["extra", "verifyList", "setVerifyRules"];
|
|
4
|
+
import { isNil, keyBy } from 'lodash';
|
|
5
5
|
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
6
6
|
|
|
7
7
|
// 属性类型=》控件
|
|
@@ -55,6 +55,8 @@ export var splitStrToObj = function splitStrToObj(keyStr, labelStr) {
|
|
|
55
55
|
export function translator() {
|
|
56
56
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
57
57
|
extra = _ref.extra,
|
|
58
|
+
verifyList = _ref.verifyList,
|
|
59
|
+
setVerifyRules = _ref.setVerifyRules,
|
|
58
60
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
59
61
|
var allConfig = _objectSpread(_objectSpread({}, props), JSON.parse(extra || '{}'));
|
|
60
62
|
var _props = {
|
|
@@ -64,15 +66,19 @@ export function translator() {
|
|
|
64
66
|
required: !!allConfig.isNotNull,
|
|
65
67
|
disabled: !!allConfig.isReadOnly
|
|
66
68
|
},
|
|
67
|
-
layout: 'block'
|
|
69
|
+
layout: 'block',
|
|
70
|
+
col: allConfig.col || 1,
|
|
71
|
+
row: allConfig.row || 1
|
|
68
72
|
};
|
|
69
73
|
if (!isNil(allConfig['dataFormat'])) _props.dataFormat = allConfig['dataFormat'];
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
if (allConfig.placeholder) _props.config.placeholder = allConfig.placeholder;
|
|
75
|
+
if (allConfig.note) _props.extra = allConfig.note;
|
|
76
|
+
if (allConfig.tip) _props.tip = allConfig.tip;
|
|
72
77
|
/* *********************************** extra ******************************* */
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
if (!isNil(allConfig['
|
|
78
|
+
var verifyListObj = keyBy(verifyList, 'verifyType');
|
|
79
|
+
if (allConfig['opt_length'] && !verifyListObj.length) _props.config.length = allConfig['opt_length'];
|
|
80
|
+
if (!isNil(allConfig['opt_number_min']) && !verifyListObj.min) _props.config.min = allConfig['opt_number_min'];
|
|
81
|
+
if (!isNil(allConfig['opt_number_max']) && !verifyListObj.max) _props.config.max = allConfig['opt_number_max'];
|
|
76
82
|
if (!isNil(allConfig['opt_decimal'])) _props.config.precision = allConfig['opt_decimal'];
|
|
77
83
|
// 兼容部分组件多选移至props
|
|
78
84
|
if (!isNil(allConfig['opt_multiple'])) _props.multiple = !!allConfig['opt_multiple'];
|
|
@@ -87,6 +93,7 @@ export function translator() {
|
|
|
87
93
|
})
|
|
88
94
|
}];
|
|
89
95
|
if (allConfig['desensitized']) _props.desensitized = allConfig['desensitized']; // 脱敏
|
|
96
|
+
if ((verifyList === null || verifyList === void 0 ? void 0 : verifyList.length) > 0 && setVerifyRules) return setVerifyRules(_props, verifyListObj);
|
|
90
97
|
return _props;
|
|
91
98
|
}
|
|
92
99
|
|