@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
|
@@ -6,14 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _ahooks = require("ahooks");
|
|
13
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
14
|
var _lodash = require("lodash");
|
|
15
15
|
var _luckDesign = require("luck-design");
|
|
16
16
|
var _base = require("@luck-design-biz/base");
|
|
17
|
+
var _utils = require("@luck-design-biz/base/utils");
|
|
17
18
|
var _Wrapper = _interopRequireDefault(require("../Wrapper"));
|
|
18
19
|
var _index = require("../../../../index");
|
|
19
20
|
var _helper = require("../../../engine/tools/helper");
|
|
@@ -22,6 +23,7 @@ var _Form = _interopRequireDefault(require("../../../../upload/Form"));
|
|
|
22
23
|
var _LdRuntimeCom = _interopRequireDefault(require("../../../../components/LdRuntimeCom"));
|
|
23
24
|
var _formPropsDefault = _interopRequireDefault(require("../../../engine/meta/form.props.default.json"));
|
|
24
25
|
var _index2 = _interopRequireDefault(require("./index.less"));
|
|
26
|
+
var _I18N_PREFIX_ = 'lc.form.validator';
|
|
25
27
|
var Header = function Header(_ref) {
|
|
26
28
|
var _ref$header = _ref.header,
|
|
27
29
|
header = _ref$header === void 0 ? 'collapse' : _ref$header,
|
|
@@ -42,6 +44,7 @@ var Header = function Header(_ref) {
|
|
|
42
44
|
}), children);
|
|
43
45
|
};
|
|
44
46
|
var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
47
|
+
var _ctx$pagePublicResour2;
|
|
45
48
|
var id = _ref2.id,
|
|
46
49
|
parentId = _ref2.parentId,
|
|
47
50
|
width = _ref2.width,
|
|
@@ -62,6 +65,10 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
62
65
|
var formRef = (0, _react.useRef)();
|
|
63
66
|
var ctx = (0, _ContextProvider.useContext)();
|
|
64
67
|
var remoteSource = (0, _ContextProvider.useRemoteSource)();
|
|
68
|
+
var _initData = (0, _ahooks.useCreation)(function () {
|
|
69
|
+
return (0, _utils.getPageQuery)();
|
|
70
|
+
}, []); // 获取主界面传递过来的详情页参数
|
|
71
|
+
|
|
65
72
|
var serials = (0, _ahooks.useCreation)(function () {
|
|
66
73
|
var _remoteSource$serials;
|
|
67
74
|
return ((_remoteSource$serials = remoteSource.serials) === null || _remoteSource$serials === void 0 ? void 0 : _remoteSource$serials.map(function (i) {
|
|
@@ -73,15 +80,46 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
73
80
|
instance: (ref || formRef).current
|
|
74
81
|
});
|
|
75
82
|
});
|
|
76
|
-
(0,
|
|
77
|
-
ctx
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
(0, _react.useEffect)(function () {
|
|
84
|
+
var tid = ctx.$subscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED).on(function (_ref3) {
|
|
85
|
+
var resource = _ref3.resource,
|
|
86
|
+
prevResource = _ref3.prevResource;
|
|
87
|
+
ctx.doAction(advance.events.onPagePublicResourceChanged, {
|
|
88
|
+
resource: resource,
|
|
89
|
+
prevResource: prevResource,
|
|
90
|
+
instance: (ref || formRef).current
|
|
91
|
+
});
|
|
92
|
+
}).watch();
|
|
93
|
+
return function () {
|
|
94
|
+
ctx.$unsubscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED, tid);
|
|
95
|
+
ctx.doAction(advance.events.onUnmount, {
|
|
96
|
+
instance: (ref || formRef).current
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
}, []);
|
|
81
100
|
(0, _react.useImperativeHandle)(apiRef, function () {
|
|
82
101
|
return {
|
|
83
|
-
|
|
102
|
+
/**
|
|
103
|
+
* 获取表格实例
|
|
104
|
+
* @method
|
|
105
|
+
*/
|
|
106
|
+
getInstance: function getInstance() {
|
|
84
107
|
return (ref || formRef).current;
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* 提交表格数据
|
|
111
|
+
* @method
|
|
112
|
+
*/
|
|
113
|
+
submit: function submit() {
|
|
114
|
+
var _ctx$pagePublicResour;
|
|
115
|
+
var instance = (ref || formRef).current;
|
|
116
|
+
var _ref4 = ((_ctx$pagePublicResour = ctx.pagePublicResource) === null || _ctx$pagePublicResour === void 0 ? void 0 : _ctx$pagePublicResour[id]) || initData || _initData || {},
|
|
117
|
+
formMode = _ref4.formMode;
|
|
118
|
+
if (formMode === 'add') {
|
|
119
|
+
instance.onAdd();
|
|
120
|
+
} else if (formMode === 'update') {
|
|
121
|
+
instance.onBatchUpdate();
|
|
122
|
+
}
|
|
85
123
|
}
|
|
86
124
|
};
|
|
87
125
|
});
|
|
@@ -94,11 +132,11 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
94
132
|
};
|
|
95
133
|
return (0, _helper.executeCode)(ctx, defaultDataSourceFormat, ['defaultValues'], defaultValues);
|
|
96
134
|
});
|
|
97
|
-
var handleDataSourceFormat = (0, _ahooks.useMemoizedFn)(function (dataSourceFormat,
|
|
98
|
-
var values =
|
|
99
|
-
submitData =
|
|
100
|
-
if ((0, _lodash.isNil)(dataSourceFormat)) return submitData;
|
|
101
|
-
return (0, _helper.executeCode)(ctx, dataSourceFormat, ['values', 'submitData'], values, submitData);
|
|
135
|
+
var handleDataSourceFormat = (0, _ahooks.useMemoizedFn)(function (dataSourceFormat, dataSetKey, _ref5) {
|
|
136
|
+
var values = _ref5.values,
|
|
137
|
+
submitData = _ref5.submitData;
|
|
138
|
+
if ((0, _lodash.isNil)(dataSourceFormat)) return (0, _defineProperty2.default)({}, dataSetKey, submitData);
|
|
139
|
+
return (0, _helper.executeCode)(ctx, dataSourceFormat, ['dataSetKey', 'values', 'submitData'], dataSetKey, values, submitData);
|
|
102
140
|
});
|
|
103
141
|
var handleResetActionsColumn = (0, _ahooks.useMemoizedFn)(function (actionsColumnReset, data, index, actions, params) {
|
|
104
142
|
return (0, _helper.executeCode)(ctx, actionsColumnReset, ['data', 'index', 'actions', 'params'], data, index, actions, params);
|
|
@@ -128,9 +166,61 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
128
166
|
var renderAffix = (0, _ahooks.useMemoizedFn)(function (_render) {
|
|
129
167
|
return _render ? /*#__PURE__*/_react.default.createElement(_LdRuntimeCom.default, null, _render) : null;
|
|
130
168
|
});
|
|
169
|
+
var setVerifyRules = function setVerifyRules(_props, verifyListObj) {
|
|
170
|
+
var _verifyListObj$length, _verifyListObj$min, _verifyListObj$max, _verifyListObj$rules;
|
|
171
|
+
var props = (0, _lodash.cloneDeep)(_props);
|
|
172
|
+
props.config.rules = props.config.rules || [];
|
|
173
|
+
if ((_verifyListObj$length = verifyListObj.length) !== null && _verifyListObj$length !== void 0 && _verifyListObj$length.expression) props.config.rules.push({
|
|
174
|
+
validator: function validator(rule, value, callback) {
|
|
175
|
+
var _current;
|
|
176
|
+
var length = (0, _helper.executeCode)(ctx, verifyListObj.length.expression, ['cValue'], (_current = (ref || formRef).current) === null || _current === void 0 ? void 0 : _current.getCValue());
|
|
177
|
+
if (value.length > length) callback("".concat((0, _utils.formatMessage)({
|
|
178
|
+
id: "".concat(_I18N_PREFIX_, ".maxLength"),
|
|
179
|
+
label: '字数不得超过'
|
|
180
|
+
})).concat(length).concat((0, _utils.formatMessage)({
|
|
181
|
+
id: "".concat(_I18N_PREFIX_, ".textNum"),
|
|
182
|
+
label: '个字符'
|
|
183
|
+
})));
|
|
184
|
+
callback();
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
if ((_verifyListObj$min = verifyListObj.min) !== null && _verifyListObj$min !== void 0 && _verifyListObj$min.expression) props.config.rules.push({
|
|
188
|
+
validator: function validator(rule, value, callback) {
|
|
189
|
+
var _current2;
|
|
190
|
+
var min = (0, _helper.executeCode)(ctx, verifyListObj.min.expression, ['cValue'], (_current2 = (ref || formRef).current) === null || _current2 === void 0 ? void 0 : _current2.getCValue());
|
|
191
|
+
if (value < min) callback((0, _utils.formatMessage)({
|
|
192
|
+
id: "".concat(_I18N_PREFIX_, ".numberBelowMin"),
|
|
193
|
+
label: '低于最小值'
|
|
194
|
+
}));
|
|
195
|
+
callback();
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
if ((_verifyListObj$max = verifyListObj.max) !== null && _verifyListObj$max !== void 0 && _verifyListObj$max.expression) props.config.rules.push({
|
|
199
|
+
validator: function validator(rule, value, callback) {
|
|
200
|
+
var _current3;
|
|
201
|
+
var max = (0, _helper.executeCode)(ctx, verifyListObj.max.expression, ['cValue'], (_current3 = (ref || formRef).current) === null || _current3 === void 0 ? void 0 : _current3.getCValue());
|
|
202
|
+
if (value > max) callback((0, _utils.formatMessage)({
|
|
203
|
+
id: "".concat(_I18N_PREFIX_, ".numberExceedMax"),
|
|
204
|
+
label: '超过最大值'
|
|
205
|
+
}));
|
|
206
|
+
callback();
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
if (verifyListObj.email) props.config.type = 'email';
|
|
210
|
+
if (verifyListObj.idcard) props.config.type = 'idcard';
|
|
211
|
+
if (verifyListObj.mobile) props.config.type = 'mobile';
|
|
212
|
+
if ((_verifyListObj$rules = verifyListObj.rules) !== null && _verifyListObj$rules !== void 0 && _verifyListObj$rules.expression) props.config.rules.push({
|
|
213
|
+
validator: function validator(rule, value, callback) {
|
|
214
|
+
var _current4;
|
|
215
|
+
(0, _helper.executeCode)(ctx, verifyListObj.rules.expression, ['cValue', 'rule', 'value', 'callback'], (_current4 = (ref || formRef).current) === null || _current4 === void 0 ? void 0 : _current4.getCValue(), rule, value, callback);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
return props;
|
|
219
|
+
};
|
|
131
220
|
var renderFormList = (0, _ahooks.useMemoizedFn)(function (formConfig) {
|
|
132
221
|
return (0, _lodash.reduce)(blocks, function (result, item) {
|
|
133
|
-
if ((0, _lodash.includes)(['auto', 'grid', 'writer'], item.type) &&
|
|
222
|
+
if ((0, _lodash.includes)(['auto', 'grid', 'writer'], item.type) && (0, _lodash.includes)(item.mode, formConfig.formMode)) {
|
|
223
|
+
var _item$dataset;
|
|
134
224
|
var data = {
|
|
135
225
|
id: item.id,
|
|
136
226
|
order: item.order,
|
|
@@ -138,15 +228,17 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
138
228
|
readOnly: item.readOnly,
|
|
139
229
|
title: item.name,
|
|
140
230
|
header: item.header,
|
|
141
|
-
dataSetKey: item.dataset.code,
|
|
231
|
+
dataSetKey: (_item$dataset = item.dataset) === null || _item$dataset === void 0 ? void 0 : _item$dataset.code,
|
|
142
232
|
serial: item.serial,
|
|
143
233
|
serialEffect: item.serialEffect,
|
|
234
|
+
fields: item.fields,
|
|
144
235
|
defaultDataSourceFormat: function defaultDataSourceFormat(defaultValues) {
|
|
145
236
|
return handleDefaultDataSourceFormat(item.defaultDataSourceFormat, defaultValues);
|
|
146
237
|
},
|
|
147
238
|
onUpdate: {
|
|
148
239
|
post: function post(data) {
|
|
149
|
-
|
|
240
|
+
var _item$dataset2;
|
|
241
|
+
return handleDataSourceFormat(item.dataSourceFormat, (_item$dataset2 = item.dataset) === null || _item$dataset2 === void 0 ? void 0 : _item$dataset2.code, data);
|
|
150
242
|
}
|
|
151
243
|
}
|
|
152
244
|
};
|
|
@@ -244,7 +336,6 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
244
336
|
});
|
|
245
337
|
resolve(_data);
|
|
246
338
|
}
|
|
247
|
-
;
|
|
248
339
|
});
|
|
249
340
|
});
|
|
250
341
|
var afterSubmit = (0, _ahooks.useMemoizedFn)(function (success, mainKey, res) {
|
|
@@ -283,7 +374,7 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
283
374
|
renderFormList: renderFormList,
|
|
284
375
|
renderFormExtra: renderFormExtra,
|
|
285
376
|
mainFormLdId: "block_main",
|
|
286
|
-
initData: initData,
|
|
377
|
+
initData: ((_ctx$pagePublicResour2 = ctx.pagePublicResource) === null || _ctx$pagePublicResour2 === void 0 ? void 0 : _ctx$pagePublicResour2[id]) || initData || _initData,
|
|
287
378
|
ref: ref || formRef,
|
|
288
379
|
readOnly: readOnly,
|
|
289
380
|
showSaveBtn: showSave,
|
|
@@ -298,7 +389,8 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
298
389
|
beforeSubmit: beforeSubmit,
|
|
299
390
|
afterSubmit: advance.events.onSaveCallback ? afterSubmit : null,
|
|
300
391
|
onValueChange: onValueChange,
|
|
301
|
-
onChildChange: onChildChange
|
|
392
|
+
onChildChange: onChildChange,
|
|
393
|
+
setVerifyRules: setVerifyRules
|
|
302
394
|
})));
|
|
303
395
|
});
|
|
304
396
|
LCForm.defaultProps = (0, _helper.omitBadProps)(_formPropsDefault.default);
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
{
|
|
39
39
|
"key": "saveTitle",
|
|
40
40
|
"name": "保存按钮标题",
|
|
41
|
-
"type": "
|
|
41
|
+
"type": "_I18nInput",
|
|
42
42
|
"default": "保存"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
{
|
|
121
121
|
"key": "name",
|
|
122
122
|
"name": "区块名称",
|
|
123
|
-
"type": "
|
|
123
|
+
"type": "_I18nInput"
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
"key": "serial",
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
"name": "格式化数据",
|
|
245
245
|
"desc": "格式化单表提交数据",
|
|
246
246
|
"type": "_JSEditor",
|
|
247
|
-
"defaultCode": "function dataSourceFormat(values, submitData) { \n return submitData; \n}",
|
|
247
|
+
"defaultCode": "function dataSourceFormat(dataSetKey, values, submitData) { \n return { [dataSetKey]: submitData }; \n}",
|
|
248
248
|
"mustConfirm": true,
|
|
249
249
|
"wrapper": "collapse",
|
|
250
250
|
"wrapperProps": { "suppressIcon": true }
|
|
@@ -501,7 +501,7 @@
|
|
|
501
501
|
{
|
|
502
502
|
"key": "zipName",
|
|
503
503
|
"name": "压缩包命名",
|
|
504
|
-
"type": "
|
|
504
|
+
"type": "_I18nInput"
|
|
505
505
|
},
|
|
506
506
|
{
|
|
507
507
|
"key": "uploadUrl",
|
|
@@ -562,37 +562,43 @@
|
|
|
562
562
|
"key": "onMount",
|
|
563
563
|
"name": "组件首次渲染时",
|
|
564
564
|
"desc": "在组件首次渲染时,执行方法",
|
|
565
|
-
"func": "(instance)
|
|
565
|
+
"func": "function onMount(instance) {\n\t\n}"
|
|
566
566
|
},
|
|
567
567
|
{
|
|
568
568
|
"key": "beforeSave",
|
|
569
569
|
"name": "保存前置事件",
|
|
570
570
|
"desc": "保存前置事件,promise,返回false取消执行",
|
|
571
|
-
"func": "(values, data)
|
|
571
|
+
"func": "function beforeSave(values, data) {\n return values; \n}"
|
|
572
572
|
},
|
|
573
573
|
{
|
|
574
574
|
"key": "onSaveCallback",
|
|
575
575
|
"name": "保存后回调",
|
|
576
576
|
"desc": "保存后回调事件",
|
|
577
|
-
"func": "(success, mainKey, res)
|
|
577
|
+
"func": "function onSaveCallback(success, mainKey, res) {\n\t\n}"
|
|
578
578
|
},
|
|
579
579
|
{
|
|
580
580
|
"key": "onUnmount",
|
|
581
581
|
"name": "组件卸载时",
|
|
582
582
|
"desc": "在组件卸载时,执行方法",
|
|
583
|
-
"func": "(instance)
|
|
583
|
+
"func": "function onUnmount(instance) {\n\t\n}"
|
|
584
584
|
},
|
|
585
585
|
{
|
|
586
586
|
"key": "onValueChange",
|
|
587
587
|
"name": "参数变化的事件",
|
|
588
588
|
"desc": "参数变化时,执行方法",
|
|
589
|
-
"func": "(change, data)
|
|
589
|
+
"func": "function onValueChange(change, data) {\n\t\n}"
|
|
590
590
|
},
|
|
591
591
|
{
|
|
592
592
|
"key": "onChildChange",
|
|
593
593
|
"name": "表单内容发生改变时的回调",
|
|
594
594
|
"desc": "表单内容发生改变时的回调",
|
|
595
|
-
"func": "(instance)
|
|
595
|
+
"func": "function onChildChange(instance) {\n\t\n}"
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
"key": "onPagePublicResourceChanged",
|
|
599
|
+
"name": "页面共享资源变化后",
|
|
600
|
+
"desc": "当页面共享资源发生变化后(pagePublicResourceChanged),执行方法",
|
|
601
|
+
"func": "function onPagePublicResourceChanged(resource, instance) {\n\t\n}"
|
|
596
602
|
}
|
|
597
603
|
]
|
|
598
604
|
}
|
|
@@ -5,13 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _ahooks = require("ahooks");
|
|
10
12
|
var _index = _interopRequireDefault(require("./index"));
|
|
11
|
-
var _excluded = ["
|
|
13
|
+
var _excluded = ["className"];
|
|
12
14
|
var FunctionDesign = function FunctionDesign(_ref) {
|
|
13
|
-
var
|
|
15
|
+
var className = _ref.className,
|
|
14
16
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
15
|
-
|
|
17
|
+
var handleClick = (0, _ahooks.useMemoizedFn)(function () {});
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_index.default, (0, _extends2.default)({
|
|
19
|
+
onClick: handleClick
|
|
20
|
+
}, props));
|
|
16
21
|
};
|
|
17
22
|
var _default = exports.default = FunctionDesign;
|
|
@@ -6,24 +6,273 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
12
|
+
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
13
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
15
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
18
|
var _ahooks = require("ahooks");
|
|
19
|
+
var _antd = require("luck-design/antd");
|
|
20
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
21
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
22
|
+
var _index = _interopRequireDefault(require("./index.less"));
|
|
23
|
+
var _ContextProvider = require("../../../engine/provider/ContextProvider");
|
|
12
24
|
var _Wrapper = _interopRequireDefault(require("../Wrapper"));
|
|
13
|
-
var
|
|
14
|
-
var
|
|
25
|
+
var _LdCom = require("../../../../components/LdCom");
|
|
26
|
+
var _IconFont = _interopRequireDefault(require("../../../../components/IconFont"));
|
|
27
|
+
var _utils = require("@luck-design-biz/base/utils");
|
|
28
|
+
var _helper = require("../../../engine/tools/helper");
|
|
29
|
+
var _apiUrl = require("../../../constants/api-url");
|
|
30
|
+
var _imexPropsDefault = _interopRequireDefault(require("../../../engine/meta/imex.props.default.json"));
|
|
31
|
+
var _excluded = ["id", "title", "type", "size", "iconFont", "block", "ghost", "css", "className", "onClick", "advance", "impexpSetting"];
|
|
32
|
+
var StyledButton = (0, _styledComponents.default)(_LdCom.LdButton).withConfig({
|
|
33
|
+
displayName: "StyledButton",
|
|
34
|
+
componentId: "luckda-6530__sc-mil6cj-0"
|
|
35
|
+
})(["", ""], function (props) {
|
|
36
|
+
return props.$css;
|
|
37
|
+
});
|
|
38
|
+
var LCButton = function LCButton(_ref) {
|
|
15
39
|
var id = _ref.id,
|
|
16
|
-
|
|
40
|
+
title = _ref.title,
|
|
41
|
+
type = _ref.type,
|
|
42
|
+
size = _ref.size,
|
|
43
|
+
iconFont = _ref.iconFont,
|
|
44
|
+
block = _ref.block,
|
|
45
|
+
ghost = _ref.ghost,
|
|
46
|
+
css = _ref.css,
|
|
47
|
+
className = _ref.className,
|
|
48
|
+
onClick = _ref.onClick,
|
|
49
|
+
advance = _ref.advance,
|
|
50
|
+
impexpSetting = _ref.impexpSetting,
|
|
51
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
17
52
|
var ref = (0, _react.useRef)();
|
|
53
|
+
var uploadRef = (0, _react.useRef)();
|
|
54
|
+
var _useRemoteSource = (0, _ContextProvider.useRemoteSource)(),
|
|
55
|
+
module = _useRemoteSource.module,
|
|
56
|
+
moduleCode = _useRemoteSource.moduleCode;
|
|
57
|
+
var _useState = (0, _react.useState)(false),
|
|
58
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
59
|
+
uploadLoading = _useState2[0],
|
|
60
|
+
setUploadLoading = _useState2[1];
|
|
61
|
+
var _useRequest = (0, _ahooks.useRequest)(_apiUrl.exportExcel, {
|
|
62
|
+
manual: true
|
|
63
|
+
}),
|
|
64
|
+
_loading = _useRequest.loading,
|
|
65
|
+
runAsync = _useRequest.runAsync,
|
|
66
|
+
data = _useRequest.data;
|
|
67
|
+
var fecthExcelState = function fecthExcelState(payload, procress, resolve, reject) {
|
|
68
|
+
// 查询进度
|
|
69
|
+
(0, _apiUrl.readExportExcelState)(payload).then(function (ret) {
|
|
70
|
+
var cpage = ret.cpage,
|
|
71
|
+
total = ret.total,
|
|
72
|
+
downloadUrl = ret.downloadUrl;
|
|
73
|
+
if (cpage >= total) {
|
|
74
|
+
resolve("".concat(window.location.origin, "/api").concat(downloadUrl));
|
|
75
|
+
} else {
|
|
76
|
+
procress(cpage / total * 100);
|
|
77
|
+
fecthExcelState(payload, procress, resolve, reject);
|
|
78
|
+
}
|
|
79
|
+
}).catch(function () {
|
|
80
|
+
reject();
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
var handleExportAll = function handleExportAll(procress) {
|
|
84
|
+
return new Promise( /*#__PURE__*/function () {
|
|
85
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(resolve, reject) {
|
|
86
|
+
var joiner, payload;
|
|
87
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
88
|
+
while (1) switch (_context.prev = _context.next) {
|
|
89
|
+
case 0:
|
|
90
|
+
joiner = 'apiUrl'.indexOf('?') !== -1 ? '&' : '?';
|
|
91
|
+
_context.next = 3;
|
|
92
|
+
return runAsync({
|
|
93
|
+
apiUrl: "apiurl".concat(joiner, "token=").concat(window.cookie.get(window.appConfig.authSaveKey)),
|
|
94
|
+
code: impexpSetting.customParam
|
|
95
|
+
});
|
|
96
|
+
case 3:
|
|
97
|
+
payload = _context.sent;
|
|
98
|
+
if (payload && typeof payload === 'string') {
|
|
99
|
+
fecthExcelState(payload, procress, resolve, reject);
|
|
100
|
+
} else {
|
|
101
|
+
reject();
|
|
102
|
+
}
|
|
103
|
+
case 5:
|
|
104
|
+
case "end":
|
|
105
|
+
return _context.stop();
|
|
106
|
+
}
|
|
107
|
+
}, _callee);
|
|
108
|
+
}));
|
|
109
|
+
return function (_x, _x2) {
|
|
110
|
+
return _ref2.apply(this, arguments);
|
|
111
|
+
};
|
|
112
|
+
}());
|
|
113
|
+
};
|
|
114
|
+
var doExportAll = function doExportAll(onExportAll) {
|
|
115
|
+
var key = 'exportAll';
|
|
116
|
+
var notificationConfig = {
|
|
117
|
+
key: key,
|
|
118
|
+
duration: null,
|
|
119
|
+
message: '正在导出数据...',
|
|
120
|
+
placement: 'bottomRight',
|
|
121
|
+
closeIcon: /*#__PURE__*/_react.default.createElement("div", null),
|
|
122
|
+
icon: /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
123
|
+
type: "cloud-download",
|
|
124
|
+
className: _index.default.exportTheme
|
|
125
|
+
})
|
|
126
|
+
};
|
|
127
|
+
var process = function process(i) {
|
|
128
|
+
_antd.notification.open((0, _objectSpread2.default)((0, _objectSpread2.default)({}, notificationConfig), {}, {
|
|
129
|
+
description: /*#__PURE__*/_react.default.createElement(_antd.Progress, {
|
|
130
|
+
percent: i
|
|
131
|
+
})
|
|
132
|
+
}));
|
|
133
|
+
};
|
|
134
|
+
_antd.notification.open((0, _objectSpread2.default)((0, _objectSpread2.default)({}, notificationConfig), {}, {
|
|
135
|
+
description: /*#__PURE__*/_react.default.createElement(_antd.Progress, {
|
|
136
|
+
percent: 0
|
|
137
|
+
})
|
|
138
|
+
}));
|
|
139
|
+
onExportAll(process).then(function (ret) {
|
|
140
|
+
if (ret) {
|
|
141
|
+
window.location.href = ret;
|
|
142
|
+
}
|
|
143
|
+
_antd.notification.close(key);
|
|
144
|
+
}).catch(function () {
|
|
145
|
+
return _antd.notification.open((0, _objectSpread2.default)((0, _objectSpread2.default)({}, notificationConfig), {}, {
|
|
146
|
+
icon: /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
147
|
+
type: "cloud-download",
|
|
148
|
+
className: _index.default.exportErrorTheme
|
|
149
|
+
}),
|
|
150
|
+
message: '导出失败',
|
|
151
|
+
duration: 4
|
|
152
|
+
}));
|
|
153
|
+
});
|
|
154
|
+
};
|
|
18
155
|
var getTargetDom = (0, _ahooks.useMemoizedFn)(function () {
|
|
19
|
-
|
|
156
|
+
var _ref$current;
|
|
157
|
+
return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.buttonNode;
|
|
20
158
|
});
|
|
159
|
+
var getActionUrl = function getActionUrl() {
|
|
160
|
+
var caturl = impexpSetting.customType ? "selectKey=".concat(impexpSetting.customParam) : "inputKey=".concat(impexpSetting.customParam);
|
|
161
|
+
return caturl;
|
|
162
|
+
};
|
|
163
|
+
var formItemProps = {
|
|
164
|
+
action: getActionUrl(),
|
|
165
|
+
// 上传地址
|
|
166
|
+
headers: {
|
|
167
|
+
Authorization: "Bearer ".concat(window.cookie.get(window.appConfig.authSaveKey))
|
|
168
|
+
},
|
|
169
|
+
name: 'files',
|
|
170
|
+
showUploadList: false,
|
|
171
|
+
beforeUpload: function beforeUpload(file, fileList) {
|
|
172
|
+
setUploadLoading(true);
|
|
173
|
+
return file;
|
|
174
|
+
},
|
|
175
|
+
onChange: function onChange(e) {
|
|
176
|
+
setUploadLoading(false);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
var handleClick = (0, _ahooks.useMemoizedFn)( /*#__PURE__*/function () {
|
|
180
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(e) {
|
|
181
|
+
var _uploadRef$current;
|
|
182
|
+
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
183
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
184
|
+
case 0:
|
|
185
|
+
if (!onClick) {
|
|
186
|
+
_context2.next = 3;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
onClick(e);
|
|
190
|
+
return _context2.abrupt("return");
|
|
191
|
+
case 3:
|
|
192
|
+
if (impexpSetting.type === 'export') {
|
|
193
|
+
doExportAll(handleExportAll);
|
|
194
|
+
} else {
|
|
195
|
+
if (uploadRef.current) {
|
|
196
|
+
(_uploadRef$current = uploadRef.current) === null || _uploadRef$current === void 0 || (_uploadRef$current = _uploadRef$current.upload) === null || _uploadRef$current === void 0 || (_uploadRef$current = _uploadRef$current.uploader) === null || _uploadRef$current === void 0 || _uploadRef$current.onClick();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
case 4:
|
|
200
|
+
case "end":
|
|
201
|
+
return _context2.stop();
|
|
202
|
+
}
|
|
203
|
+
}, _callee2);
|
|
204
|
+
}));
|
|
205
|
+
return function (_x3) {
|
|
206
|
+
return _ref3.apply(this, arguments);
|
|
207
|
+
};
|
|
208
|
+
}());
|
|
209
|
+
// console.log(formItemProps, module, moduleCode)
|
|
210
|
+
|
|
21
211
|
return /*#__PURE__*/_react.default.createElement(_Wrapper.default, {
|
|
22
212
|
id: id,
|
|
23
|
-
displayName: "
|
|
213
|
+
displayName: "Imex",
|
|
24
214
|
getTargetDom: getTargetDom
|
|
215
|
+
}, /*#__PURE__*/_react.default.createElement(StyledButton, {
|
|
216
|
+
ref: ref,
|
|
217
|
+
type: type,
|
|
218
|
+
size: size,
|
|
219
|
+
block: block,
|
|
220
|
+
ghost: ghost,
|
|
221
|
+
$css: css,
|
|
222
|
+
className: (0, _classnames.default)((0, _defineProperty2.default)({}, className, !!className)),
|
|
223
|
+
onClick: handleClick,
|
|
224
|
+
loading: !!_loading || !!uploadLoading
|
|
25
225
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
-
|
|
27
|
-
|
|
226
|
+
style: {
|
|
227
|
+
display: 'none'
|
|
228
|
+
}
|
|
229
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Upload, (0, _extends2.default)({}, formItemProps, {
|
|
230
|
+
ref: uploadRef
|
|
231
|
+
}))), iconFont ? /*#__PURE__*/_react.default.createElement(_IconFont.default, {
|
|
232
|
+
type: iconFont
|
|
233
|
+
}) : null, title || (0, _utils.formatMessage)({
|
|
234
|
+
id: 'luckda.lowcode.painter.import',
|
|
235
|
+
label: '导入'
|
|
236
|
+
})));
|
|
237
|
+
};
|
|
238
|
+
LCButton.propTypes = {
|
|
239
|
+
/**
|
|
240
|
+
* @name 唯一标识
|
|
241
|
+
* @type string
|
|
242
|
+
* @disabled true
|
|
243
|
+
*/
|
|
244
|
+
id: _propTypes.default.string.isRequired,
|
|
245
|
+
/**
|
|
246
|
+
* @name 按钮标题
|
|
247
|
+
* @type string
|
|
248
|
+
* @default 12:3:9
|
|
249
|
+
*/
|
|
250
|
+
title: _propTypes.default.string,
|
|
251
|
+
/**
|
|
252
|
+
* @name 按钮类型
|
|
253
|
+
* @type _ButtonType
|
|
254
|
+
* @default 'default'
|
|
255
|
+
*/
|
|
256
|
+
type: _propTypes.default.oneOf(['default', 'primary', 'dashed', 'danger']),
|
|
257
|
+
/**
|
|
258
|
+
* @name impexpSetting
|
|
259
|
+
* @type _ImpExpAlone
|
|
260
|
+
* @default { "customType": false, "customParam": false, "type": "export" }
|
|
261
|
+
*/
|
|
262
|
+
impexpSetting: _propTypes.default.object,
|
|
263
|
+
/**
|
|
264
|
+
* @name 按钮大小
|
|
265
|
+
* @type segmented
|
|
266
|
+
* @options [{ "label": "小", "value": "small"}, { "label": "中", "value": "middle" }, { "label": "大", "value": "large" }]
|
|
267
|
+
* @default 'default'
|
|
268
|
+
*/
|
|
269
|
+
size: _propTypes.default.oneOf(['small', 'default', 'large']),
|
|
270
|
+
/**
|
|
271
|
+
* @name 将按钮宽度调整为其父宽度的选项
|
|
272
|
+
* @type boolean
|
|
273
|
+
* @default false
|
|
274
|
+
*/
|
|
275
|
+
block: _propTypes.default.bool
|
|
28
276
|
};
|
|
29
|
-
|
|
277
|
+
LCButton.defaultProps = (0, _helper.omitBadProps)(_imexPropsDefault.default);
|
|
278
|
+
var _default = exports.default = LCButton;
|