@zat-design/sisyphus-react 3.0.13 → 3.0.16-beta.4
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/dist/index.esm.css +2729 -1876
- package/es/ProDownload/DownloadHelper.js +2 -0
- package/es/ProDrawerForm/components/ProDrawer/index.js +5 -3
- package/es/ProDrawerForm/components/ProModal/index.js +15 -5
- package/es/ProDrawerForm/index.js +1 -1
- package/es/ProDrawerForm/propsType.d.ts +4 -0
- package/es/ProDrawerForm/style/index.less +88 -55
- package/es/ProEditLabel/components/RenderProForm.d.ts +4 -0
- package/es/ProEditLabel/components/RenderProForm.js +70 -0
- package/es/ProEditLabel/index.js +104 -141
- package/es/ProEditLabel/propsType.d.ts +7 -4
- package/es/ProEditLabel/style/index.less +33 -2
- package/es/ProEditLabel/utils/index.d.ts +5 -7
- package/es/ProEditLabel/utils/index.js +11 -27
- package/es/ProEditTable/components/ActionButton/index.d.ts +2 -1
- package/es/ProEditTable/components/ActionButton/index.js +20 -4
- package/es/ProEditTable/components/RenderField/index.d.ts +2 -1
- package/es/ProEditTable/components/RenderField/index.js +1 -2
- package/es/ProEditTable/components/RenderToolbar/index.d.ts +2 -1
- package/es/ProEditTable/components/Summary/index.d.ts +2 -1
- package/es/ProEditTable/propsType.d.ts +5 -0
- package/es/ProEditTable/style/index.less +16 -13
- package/es/ProEditTable/utils/config.d.ts +2 -1
- package/es/ProEditTable/utils/config.js +25 -14
- package/es/ProEditTable/utils/index.js +5 -3
- package/es/ProEnum/getEnumLabel.d.ts +2 -1
- package/es/ProEnum/getEnumLabel.js +1 -1
- package/es/ProEnum/index.d.ts +3 -2
- package/es/ProEnum/index.js +1 -1
- package/es/ProEnum/useEnum.js +1 -1
- package/es/ProEnum/useEnumRequest.js +6 -11
- package/es/ProForm/components/FormFooter/index.js +1 -1
- package/es/ProForm/components/base/DatePicker/index.js +2 -2
- package/es/ProForm/components/base/FormList/components/ActionButton.js +4 -5
- package/es/ProForm/components/base/FormList/index.d.ts +1 -0
- package/es/ProForm/components/base/FormList/index.js +10 -5
- package/es/ProForm/components/base/FormList/style/index.less +3 -0
- package/es/ProForm/components/base/Input/index.d.ts +2 -1
- package/es/ProForm/components/base/Input/index.js +1 -1
- package/es/ProForm/components/base/InputNumber/index.js +25 -1
- package/es/ProForm/components/base/RangePicker/index.js +2 -2
- package/es/ProForm/components/base/Select/index.js +1 -1
- package/es/ProForm/components/base/Switch/index.js +1 -1
- package/es/ProForm/components/base/TextArea/index.js +1 -1
- package/es/ProForm/components/combination/ProAddressBar/index.d.ts +1 -1
- package/es/ProForm/components/combination/ProAddressBar/index.js +3 -2
- package/es/ProForm/components/combination/ProCombination/index.js +3 -3
- package/es/ProForm/components/combination/ProModalSelect/index.d.ts +1 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +4 -3
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -6
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +45 -36
- package/es/ProForm/components/combination/ProRangeLimit/index.js +14 -16
- package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +1 -1
- package/es/ProForm/components/index.d.ts +2 -0
- package/es/ProForm/components/index.js +2 -0
- package/es/ProForm/components/old/CertNo/index.d.ts +2 -1
- package/es/ProForm/components/old/EnumSelect/index.js +1 -1
- package/es/ProForm/components/old/InputRange/index.d.ts +2 -1
- package/es/ProForm/components/old/InputWithSuffix/index.d.ts +2 -1
- package/es/ProForm/components/old/ProAddress/index.d.ts +2 -1
- package/es/ProForm/components/old/ProCertValidity/index.js +1 -1
- package/es/ProForm/components/old/ProRangeBox/index.d.ts +2 -1
- package/es/ProForm/components/render/Render.js +6 -22
- package/es/ProForm/components/render/propsType.d.ts +4 -0
- package/es/ProForm/index.js +4 -2
- package/es/ProForm/style/index.less +12 -5
- package/es/ProForm/utils/index.d.ts +5 -2
- package/es/ProForm/utils/index.js +7 -12
- package/es/ProForm/utils/transformValue.js +4 -2
- package/es/ProForm/utils/useShouldUpdate.js +1 -0
- package/es/ProForm/utils/valueType.d.ts +4 -4
- package/es/ProIcon/index.d.ts +1 -0
- package/es/ProIcon/index.js +35 -5
- package/es/ProIcon/propsTypes.d.ts +9 -9
- package/es/ProIcon/symbolIcon.js +43 -0
- package/es/ProLayout/components/Layout/Header/style/index.less +1 -2
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +2 -1
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +1 -1
- package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +3 -0
- package/es/ProLayout/components/ProCollapse/index.d.ts +2 -1
- package/es/ProLayout/components/ProCollapse/style/index.less +1 -0
- package/es/ProLayout/components/ProFooter/index.d.ts +1 -1
- package/es/ProLayout/components/ProHeader/components/Copy/index.d.ts +2 -1
- package/es/ProLayout/components/ProHeader/index.d.ts +1 -1
- package/es/ProLayout/components/ProHeader/index.js +2 -4
- package/es/ProLayout/components/ProHeader/style/index.less +3 -3
- package/es/ProLayout/index.d.ts +4 -4
- package/es/ProLayout/index.js +5 -6
- package/es/ProLayout/propTypes.d.ts +2 -5
- package/es/ProLayout/style/index.less +7 -1
- package/es/ProSelect/index.d.ts +1 -1
- package/es/ProSelect/index.js +2 -2
- package/es/ProSelect/propsType.d.ts +7 -0
- package/es/ProStep/components/Anchor/index.d.ts +2 -1
- package/es/ProStep/components/Item/index.d.ts +2 -1
- package/es/ProStep/components/Step/index.d.ts +2 -1
- package/es/ProStep/components/Step/index.js +12 -10
- package/es/ProStep/index.d.ts +2 -2
- package/es/ProStep/style/index.less +1 -1
- package/es/ProTable/components/ResizableLine/index.d.ts +2 -1
- package/es/ProTable/components/TableResizable/index.d.ts +2 -1
- package/es/ProTable/index.d.ts +1 -1
- package/es/ProTable/index.js +2 -2
- package/es/ProTable/propsType.d.ts +4 -3
- package/es/ProTable/style/index.less +12 -17
- package/es/ProTable/useAntdTable.d.ts +4 -4
- package/es/ProTable/useAntdTable.js +64 -37
- package/es/ProTable/utils.js +25 -6
- package/es/ProTabs/components/Card/index.d.ts +4 -0
- package/es/ProTabs/components/Card/index.js +24 -0
- package/es/ProTabs/components/index.d.ts +1 -0
- package/es/ProTabs/components/index.js +1 -0
- package/es/ProTabs/index.d.ts +4 -0
- package/es/ProTabs/index.js +98 -0
- package/es/ProTabs/propType.d.ts +31 -0
- package/es/ProTabs/propType.js +1 -0
- package/es/ProTabs/style/index.less +68 -0
- package/es/ProThemeTools/component/PrdTools/index.d.ts +4 -0
- package/es/ProThemeTools/component/PrdTools/index.js +219 -0
- package/es/ProThemeTools/component/PrdTools/style/index.less +168 -0
- package/es/ProThemeTools/component/index.d.ts +2 -0
- package/es/ProThemeTools/component/index.js +2 -0
- package/es/ProThemeTools/index.d.ts +14 -0
- package/es/ProThemeTools/index.js +196 -0
- package/es/ProThemeTools/propsType.d.ts +35 -0
- package/es/ProThemeTools/propsType.js +1 -0
- package/es/ProThemeTools/style/index.less +55 -0
- package/es/ProThemeTools/utils/index.d.ts +19 -0
- package/es/ProThemeTools/utils/index.js +72 -0
- package/es/ProTooltip/index.d.ts +2 -1
- package/es/ProTransferModal/components/SortableItem/index.js +2 -2
- package/es/ProTransferModal/style/index.less +9 -1
- package/es/ProTreeModal/components/CloseIcon.d.ts +3 -0
- package/es/ProTreeModal/components/CloseIcon.js +25 -0
- package/es/ProTreeModal/components/List.d.ts +13 -0
- package/es/ProTreeModal/components/List.js +52 -0
- package/es/ProTreeModal/components/SearchTitle.d.ts +7 -0
- package/es/ProTreeModal/components/SearchTitle.js +14 -0
- package/es/ProTreeModal/components/Tree.d.ts +15 -0
- package/es/ProTreeModal/components/Tree.js +149 -0
- package/es/ProTreeModal/components/Trigger.d.ts +10 -0
- package/es/ProTreeModal/components/Trigger.js +32 -0
- package/es/ProTreeModal/components/index.d.ts +5 -0
- package/es/ProTreeModal/components/index.js +5 -0
- package/es/ProTreeModal/data/datasource.d.ts +5 -0
- package/es/ProTreeModal/data/datasource.js +17 -0
- package/es/ProTreeModal/data/mock.d.ts +9 -0
- package/es/ProTreeModal/data/mock.js +39 -0
- package/es/ProTreeModal/index.d.ts +5 -0
- package/es/ProTreeModal/index.js +333 -0
- package/es/ProTreeModal/propsType.d.ts +26 -0
- package/es/ProTreeModal/propsType.js +1 -0
- package/es/ProTreeModal/style/index.less +105 -0
- package/es/ProTreeModal/utils.d.ts +26 -0
- package/es/ProTreeModal/utils.js +136 -0
- package/es/ProTreeSelect/index.d.ts +5 -0
- package/es/ProTreeSelect/index.js +426 -0
- package/es/ProTreeSelect/propsType.d.ts +95 -0
- package/es/ProTreeSelect/propsType.js +1 -0
- package/es/ProTreeSelect/style/index.less +109 -0
- package/es/ProUpload/Example.js +1 -1
- package/es/ProUpload/index.d.ts +0 -1
- package/es/ProUpload/index.js +8 -2
- package/es/ProUpload/style/fileItem.less +3 -1
- package/es/ProUpload/style/index.less +8 -1
- package/es/ProWaterMark/index.js +1 -1
- package/es/assets/close.svg +1 -0
- package/es/index.d.ts +3 -0
- package/es/index.js +4 -8
- package/es/old/ProCertValidity/index.js +1 -1
- package/es/style/components.less +25 -9
- package/es/style/theme/antd.less +60 -29
- package/es/style/theme/index.less +154 -176
- package/es/tokens.js +85 -0
- package/lib/ProDrawerForm/components/ProDrawer/index.js +5 -3
- package/lib/ProDrawerForm/components/ProModal/index.js +13 -5
- package/lib/ProDrawerForm/index.js +1 -1
- package/lib/ProDrawerForm/propsType.d.ts +4 -0
- package/lib/ProDrawerForm/style/index.less +88 -55
- package/lib/ProEditLabel/components/RenderProForm.d.ts +4 -0
- package/lib/ProEditLabel/components/RenderProForm.js +78 -0
- package/lib/ProEditLabel/index.js +102 -137
- package/lib/ProEditLabel/propsType.d.ts +7 -4
- package/lib/ProEditLabel/style/index.less +33 -2
- package/lib/ProEditLabel/utils/index.d.ts +5 -7
- package/lib/ProEditLabel/utils/index.js +14 -31
- package/lib/ProEditTable/components/ActionButton/index.d.ts +2 -1
- package/lib/ProEditTable/components/ActionButton/index.js +20 -4
- package/lib/ProEditTable/components/RenderField/index.d.ts +2 -1
- package/lib/ProEditTable/components/RenderField/index.js +3 -2
- package/lib/ProEditTable/components/RenderToolbar/index.d.ts +2 -1
- package/lib/ProEditTable/components/Summary/index.d.ts +2 -1
- package/lib/ProEditTable/propsType.d.ts +5 -0
- package/lib/ProEditTable/style/index.less +16 -13
- package/lib/ProEditTable/utils/config.d.ts +2 -1
- package/lib/ProEditTable/utils/config.js +24 -13
- package/lib/ProEditTable/utils/index.js +5 -3
- package/lib/ProEnum/getEnumLabel.d.ts +2 -1
- package/lib/ProEnum/getEnumLabel.js +3 -3
- package/lib/ProEnum/index.d.ts +3 -2
- package/lib/ProEnum/index.js +4 -4
- package/lib/ProEnum/useEnum.js +3 -3
- package/lib/ProEnum/useEnumRequest.js +6 -11
- package/lib/ProForm/components/FormFooter/index.js +2 -2
- package/lib/ProForm/components/base/DatePicker/index.js +3 -3
- package/lib/ProForm/components/base/FormList/components/ActionButton.js +4 -5
- package/lib/ProForm/components/base/FormList/index.d.ts +1 -0
- package/lib/ProForm/components/base/FormList/index.js +10 -5
- package/lib/ProForm/components/base/FormList/style/index.less +3 -0
- package/lib/ProForm/components/base/Input/index.d.ts +2 -1
- package/lib/ProForm/components/base/Input/index.js +2 -2
- package/lib/ProForm/components/base/InputNumber/index.js +26 -2
- package/lib/ProForm/components/base/RangePicker/index.js +2 -2
- package/lib/ProForm/components/base/Select/index.js +2 -2
- package/lib/ProForm/components/base/Switch/index.js +2 -2
- package/lib/ProForm/components/base/TextArea/index.js +2 -2
- package/lib/ProForm/components/combination/ProAddressBar/index.d.ts +1 -1
- package/lib/ProForm/components/combination/ProAddressBar/index.js +4 -3
- package/lib/ProForm/components/combination/ProCombination/index.js +3 -3
- package/lib/ProForm/components/combination/ProModalSelect/index.d.ts +1 -1
- package/lib/ProForm/components/combination/ProModalSelect/index.js +8 -7
- package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +7 -6
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +45 -36
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +15 -17
- package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +1 -1
- package/lib/ProForm/components/index.d.ts +2 -0
- package/lib/ProForm/components/index.js +14 -0
- package/lib/ProForm/components/old/CertNo/index.d.ts +2 -1
- package/lib/ProForm/components/old/EnumSelect/index.js +2 -2
- package/lib/ProForm/components/old/InputRange/index.d.ts +2 -1
- package/lib/ProForm/components/old/InputWithSuffix/index.d.ts +2 -1
- package/lib/ProForm/components/old/ProAddress/index.d.ts +2 -1
- package/lib/ProForm/components/old/ProCertValidity/index.js +1 -1
- package/lib/ProForm/components/old/ProRangeBox/index.d.ts +2 -1
- package/lib/ProForm/components/render/Render.js +4 -20
- package/lib/ProForm/components/render/propsType.d.ts +4 -0
- package/lib/ProForm/index.js +4 -2
- package/lib/ProForm/style/index.less +12 -5
- package/lib/ProForm/utils/index.d.ts +5 -2
- package/lib/ProForm/utils/index.js +10 -14
- package/lib/ProForm/utils/transformValue.js +4 -2
- package/lib/ProForm/utils/useShouldUpdate.js +1 -0
- package/lib/ProForm/utils/valueType.d.ts +4 -4
- package/lib/ProIcon/index.d.ts +1 -0
- package/lib/ProIcon/index.js +36 -5
- package/lib/ProIcon/propsTypes.d.ts +9 -9
- package/lib/ProIcon/symbolIcon.js +45 -0
- package/lib/ProLayout/components/Layout/Header/style/index.less +1 -2
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +2 -1
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +1 -1
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +3 -0
- package/lib/ProLayout/components/ProCollapse/index.d.ts +2 -1
- package/lib/ProLayout/components/ProCollapse/style/index.less +1 -0
- package/lib/ProLayout/components/ProFooter/index.d.ts +1 -1
- package/lib/ProLayout/components/ProHeader/components/Copy/index.d.ts +2 -1
- package/lib/ProLayout/components/ProHeader/index.d.ts +1 -1
- package/lib/ProLayout/components/ProHeader/index.js +1 -4
- package/lib/ProLayout/components/ProHeader/style/index.less +3 -3
- package/lib/ProLayout/index.d.ts +4 -4
- package/lib/ProLayout/index.js +5 -6
- package/lib/ProLayout/propTypes.d.ts +2 -5
- package/lib/ProLayout/style/index.less +7 -1
- package/lib/ProSelect/index.d.ts +1 -1
- package/lib/ProSelect/index.js +3 -3
- package/lib/ProSelect/propsType.d.ts +7 -0
- package/lib/ProStep/components/Anchor/index.d.ts +2 -1
- package/lib/ProStep/components/Item/index.d.ts +2 -1
- package/lib/ProStep/components/Step/index.d.ts +2 -1
- package/lib/ProStep/components/Step/index.js +11 -9
- package/lib/ProStep/index.d.ts +2 -2
- package/lib/ProStep/style/index.less +1 -1
- package/lib/ProTable/components/ResizableLine/index.d.ts +2 -1
- package/lib/ProTable/components/TableResizable/index.d.ts +2 -1
- package/lib/ProTable/components/TableResizable/index.js +8 -0
- package/lib/ProTable/index.d.ts +1 -1
- package/lib/ProTable/index.js +5 -5
- package/lib/ProTable/propsType.d.ts +4 -3
- package/lib/ProTable/style/index.less +12 -17
- package/lib/ProTable/useAntdTable.d.ts +4 -4
- package/lib/ProTable/useAntdTable.js +63 -36
- package/lib/ProTable/utils.js +26 -7
- package/lib/ProTabs/components/Card/index.d.ts +4 -0
- package/lib/ProTabs/components/Card/index.js +31 -0
- package/lib/ProTabs/components/index.d.ts +1 -0
- package/lib/ProTabs/components/index.js +13 -0
- package/lib/ProTabs/index.d.ts +4 -0
- package/lib/ProTabs/index.js +106 -0
- package/lib/ProTabs/propType.d.ts +31 -0
- package/lib/ProTabs/propType.js +5 -0
- package/lib/ProTabs/style/index.less +68 -0
- package/lib/ProThemeTools/component/PrdTools/index.d.ts +4 -0
- package/lib/ProThemeTools/component/PrdTools/index.js +221 -0
- package/lib/ProThemeTools/component/PrdTools/style/index.less +168 -0
- package/lib/ProThemeTools/component/index.d.ts +2 -0
- package/lib/ProThemeTools/component/index.js +13 -0
- package/lib/ProThemeTools/index.d.ts +14 -0
- package/lib/ProThemeTools/index.js +202 -0
- package/lib/ProThemeTools/propsType.d.ts +35 -0
- package/lib/ProThemeTools/propsType.js +5 -0
- package/lib/ProThemeTools/style/index.less +55 -0
- package/lib/ProThemeTools/utils/index.d.ts +19 -0
- package/lib/ProThemeTools/utils/index.js +82 -0
- package/lib/ProTooltip/index.d.ts +2 -1
- package/lib/ProTransferModal/components/SortableItem/index.js +2 -2
- package/lib/ProTransferModal/style/index.less +9 -1
- package/lib/ProTreeModal/components/CloseIcon.d.ts +3 -0
- package/lib/ProTreeModal/components/CloseIcon.js +33 -0
- package/lib/ProTreeModal/components/List.d.ts +13 -0
- package/lib/ProTreeModal/components/List.js +59 -0
- package/lib/ProTreeModal/components/SearchTitle.d.ts +7 -0
- package/lib/ProTreeModal/components/SearchTitle.js +22 -0
- package/lib/ProTreeModal/components/Tree.d.ts +15 -0
- package/lib/ProTreeModal/components/Tree.js +157 -0
- package/lib/ProTreeModal/components/Trigger.d.ts +10 -0
- package/lib/ProTreeModal/components/Trigger.js +39 -0
- package/lib/ProTreeModal/components/index.d.ts +5 -0
- package/lib/ProTreeModal/components/index.js +41 -0
- package/lib/ProTreeModal/data/datasource.d.ts +5 -0
- package/lib/ProTreeModal/data/datasource.js +24 -0
- package/lib/ProTreeModal/data/mock.d.ts +9 -0
- package/lib/ProTreeModal/data/mock.js +47 -0
- package/lib/ProTreeModal/index.d.ts +5 -0
- package/lib/ProTreeModal/index.js +340 -0
- package/lib/ProTreeModal/propsType.d.ts +26 -0
- package/lib/ProTreeModal/propsType.js +5 -0
- package/lib/ProTreeModal/style/index.less +105 -0
- package/lib/ProTreeModal/utils.d.ts +26 -0
- package/lib/ProTreeModal/utils.js +148 -0
- package/lib/ProTreeSelect/index.d.ts +5 -0
- package/lib/ProTreeSelect/index.js +433 -0
- package/lib/ProTreeSelect/propsType.d.ts +95 -0
- package/lib/ProTreeSelect/propsType.js +5 -0
- package/lib/ProTreeSelect/style/index.less +109 -0
- package/lib/ProUpload/Example.js +2 -2
- package/lib/ProUpload/index.d.ts +0 -1
- package/lib/ProUpload/index.js +8 -2
- package/lib/ProUpload/style/fileItem.less +3 -1
- package/lib/ProUpload/style/index.less +8 -1
- package/lib/ProWaterMark/index.js +1 -1
- package/lib/assets/close.svg +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +28 -0
- package/lib/old/ProCertValidity/index.js +1 -1
- package/lib/style/components.less +25 -9
- package/lib/style/theme/antd.less +60 -29
- package/lib/style/theme/index.less +154 -176
- package/lib/tokens.js +87 -0
- package/package.json +7 -8
- package/typings.d.ts +6 -2
- package/es/ProEditLabel/components/RenderForm.d.ts +0 -3
- package/es/ProEditLabel/components/RenderForm.js +0 -65
- package/lib/ProEditLabel/components/RenderForm.d.ts +0 -3
- package/lib/ProEditLabel/components/RenderForm.js +0 -75
- package/source-code/package.json +0 -16
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.ProTreeSelect = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
+
var _ahooks = require("ahooks");
|
|
13
|
+
var _antd = require("antd");
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
var _lodash = require("lodash");
|
|
16
|
+
var _sisyphusReact = require("@zat-design/sisyphus-react");
|
|
17
|
+
var _Container = _interopRequireDefault(require("../ProForm/components/Container"));
|
|
18
|
+
var _excluded = ["disabled", "code", "dataSource", "defaultDisableValue", "onChange", "useRequest", "updateDataSource", "transformResponse", "fieldNames", "tooltip", "showSearch", "filterTreeNode", "treeNodeFilterProp", "treeDefaultExpandAll", "treeCheckable", "onSearch", "otherProps", "width", "dropdownStyle", "style", "allowClear", "listHeight", "showCodeName"],
|
|
19
|
+
_excluded2 = ["children"];
|
|
20
|
+
/*
|
|
21
|
+
*@Date: 2023-05-19 13:31:48
|
|
22
|
+
*@LastEditTime: 2023-05-19 13:31:48
|
|
23
|
+
*@Author: liudongliang
|
|
24
|
+
*@Description: 树选择组件
|
|
25
|
+
*/
|
|
26
|
+
var SHOW_PARENT = _antd.TreeSelect.SHOW_PARENT;
|
|
27
|
+
var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
28
|
+
// 全局属性配置在ConfigProvider
|
|
29
|
+
var _ref = (0, _sisyphusReact.useProConfig)('ProTreeSelect') || {},
|
|
30
|
+
_ref$fieldNames = _ref.fieldNames,
|
|
31
|
+
proSelectFieldNames = _ref$fieldNames === void 0 ? {} : _ref$fieldNames;
|
|
32
|
+
var _useProConfig = (0, _sisyphusReact.useProConfig)('ProEnum'),
|
|
33
|
+
_useProConfig$dics = _useProConfig.dics,
|
|
34
|
+
dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
|
|
35
|
+
var label = 'label';
|
|
36
|
+
var code = 'value';
|
|
37
|
+
if (proSelectFieldNames && Object.keys(proSelectFieldNames).length) {
|
|
38
|
+
code = proSelectFieldNames.value;
|
|
39
|
+
label = proSelectFieldNames.label;
|
|
40
|
+
}
|
|
41
|
+
// 配置属性
|
|
42
|
+
var disabled = props.disabled,
|
|
43
|
+
enumCode = props.code,
|
|
44
|
+
dataSource = props.dataSource,
|
|
45
|
+
defaultDisableValue = props.defaultDisableValue,
|
|
46
|
+
onChange = props.onChange,
|
|
47
|
+
useRequest = props.useRequest,
|
|
48
|
+
updateDataSource = props.updateDataSource,
|
|
49
|
+
transformResponse = props.transformResponse,
|
|
50
|
+
fieldNames = props.fieldNames,
|
|
51
|
+
_props$tooltip = props.tooltip,
|
|
52
|
+
tooltip = _props$tooltip === void 0 ? false : _props$tooltip,
|
|
53
|
+
_props$showSearch = props.showSearch,
|
|
54
|
+
showSearch = _props$showSearch === void 0 ? true : _props$showSearch,
|
|
55
|
+
filterTreeNode = props.filterTreeNode,
|
|
56
|
+
_props$treeNodeFilter = props.treeNodeFilterProp,
|
|
57
|
+
treeNodeFilterProp = _props$treeNodeFilter === void 0 ? 'label' : _props$treeNodeFilter,
|
|
58
|
+
_props$treeDefaultExp = props.treeDefaultExpandAll,
|
|
59
|
+
treeDefaultExpandAll = _props$treeDefaultExp === void 0 ? true : _props$treeDefaultExp,
|
|
60
|
+
_props$treeCheckable = props.treeCheckable,
|
|
61
|
+
treeCheckable = _props$treeCheckable === void 0 ? true : _props$treeCheckable,
|
|
62
|
+
_onSearch = props.onSearch,
|
|
63
|
+
otherProps = props.otherProps,
|
|
64
|
+
width = props.width,
|
|
65
|
+
dropdownStyle = props.dropdownStyle,
|
|
66
|
+
style = props.style,
|
|
67
|
+
allowClear = props.allowClear,
|
|
68
|
+
listHeight = props.listHeight,
|
|
69
|
+
showCodeName = props.showCodeName,
|
|
70
|
+
selectProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
71
|
+
var value = props.value;
|
|
72
|
+
var _ref2 = otherProps || {},
|
|
73
|
+
isView = _ref2.isView,
|
|
74
|
+
viewEmpty = _ref2.viewEmpty;
|
|
75
|
+
if (fieldNames && Object.keys(fieldNames).length) {
|
|
76
|
+
code = fieldNames.value || 'value';
|
|
77
|
+
label = fieldNames.label || 'label';
|
|
78
|
+
}
|
|
79
|
+
// 经过处理后的枚举数据,可能来自用户配置的处理函数后返回的结果
|
|
80
|
+
var _useSetState = (0, _ahooks.useSetState)({}),
|
|
81
|
+
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
|
82
|
+
_useSetState2$ = _useSetState2[0],
|
|
83
|
+
_useSetState2$$select = _useSetState2$.selectList,
|
|
84
|
+
selectList = _useSetState2$$select === void 0 ? [] : _useSetState2$$select,
|
|
85
|
+
_useSetState2$$origDa = _useSetState2$.origDataSource,
|
|
86
|
+
origDataSource = _useSetState2$$origDa === void 0 ? [] : _useSetState2$$origDa,
|
|
87
|
+
setState = _useSetState2[1];
|
|
88
|
+
/**
|
|
89
|
+
* 如果数据少于10条那么将数据平铺返回
|
|
90
|
+
* @param dictsEnum 原始数据
|
|
91
|
+
* @returns 平铺或者原始数据
|
|
92
|
+
*/
|
|
93
|
+
var countChild = function countChild(dictsEnum) {
|
|
94
|
+
if (treeCheckable) {
|
|
95
|
+
return dictsEnum;
|
|
96
|
+
}
|
|
97
|
+
var count = 0;
|
|
98
|
+
var result = [];
|
|
99
|
+
var loopCount = function loopCount(data) {
|
|
100
|
+
data.map(function (item) {
|
|
101
|
+
count += 1;
|
|
102
|
+
var children = item.children,
|
|
103
|
+
other = (0, _objectWithoutProperties2.default)(item, _excluded2);
|
|
104
|
+
result.push((0, _objectSpread2.default)({}, other));
|
|
105
|
+
if (item.children) {
|
|
106
|
+
loopCount(item.children);
|
|
107
|
+
}
|
|
108
|
+
return item;
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
if ((dictsEnum === null || dictsEnum === void 0 ? void 0 : dictsEnum.length) > 10) {
|
|
112
|
+
return dictsEnum;
|
|
113
|
+
}
|
|
114
|
+
loopCount(dictsEnum);
|
|
115
|
+
if (count <= 10) {
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
return dictsEnum;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* 如果要展示code-name,那么将源数据的label转为code-name
|
|
122
|
+
* @param dataArr 源数据
|
|
123
|
+
* @param showCodeAndName 是否展示code-name
|
|
124
|
+
* @returns 转换结果
|
|
125
|
+
*/
|
|
126
|
+
var transferDataSource = function transferDataSource(dataArr, showCodeAndName) {
|
|
127
|
+
var copyData = (0, _lodash.cloneDeep)(dataArr);
|
|
128
|
+
var loop = function loop(arr) {
|
|
129
|
+
arr.map(function (item) {
|
|
130
|
+
item[label] = "".concat(item[code], "-").concat(item[label]);
|
|
131
|
+
if (item.children) {
|
|
132
|
+
loop(item.children);
|
|
133
|
+
}
|
|
134
|
+
return item;
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
if (showCodeAndName) {
|
|
138
|
+
loop(copyData);
|
|
139
|
+
}
|
|
140
|
+
return copyData;
|
|
141
|
+
};
|
|
142
|
+
// 配置了异步数据源,拉取枚举数据逻辑 如果有code不掉接口从local里根据code取值
|
|
143
|
+
var fetchFunction = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)({
|
|
144
|
+
manual: true,
|
|
145
|
+
onSuccess: function onSuccess(data) {
|
|
146
|
+
// 用户配置了处理枚举函数
|
|
147
|
+
// console.log('异步加载数据成功', data);
|
|
148
|
+
if (transformResponse && typeof transformResponse === 'function') {
|
|
149
|
+
var responseData = transformResponse(data);
|
|
150
|
+
var resultData = transferDataSource(responseData, showCodeName);
|
|
151
|
+
setState({
|
|
152
|
+
selectList: countChild(resultData),
|
|
153
|
+
origDataSource: resultData
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
debounceWait: 300
|
|
158
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options));
|
|
159
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
160
|
+
return {
|
|
161
|
+
useRequestRef: fetchFunction
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
165
|
+
if (enumCode) {
|
|
166
|
+
var dictEnum = dics[enumCode] || [];
|
|
167
|
+
var resultData = transferDataSource(dictEnum, showCodeName);
|
|
168
|
+
setState({
|
|
169
|
+
selectList: countChild(resultData),
|
|
170
|
+
origDataSource: resultData
|
|
171
|
+
});
|
|
172
|
+
} else if (dataSource) {
|
|
173
|
+
var _resultData = transferDataSource(dataSource, showCodeName);
|
|
174
|
+
setState({
|
|
175
|
+
selectList: countChild(_resultData),
|
|
176
|
+
origDataSource: _resultData
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}, [enumCode, dataSource]);
|
|
180
|
+
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
181
|
+
// code存在,不执行接口请求
|
|
182
|
+
if (enumCode) {
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
// dataSource存在不执行接口请求
|
|
186
|
+
if (dataSource) {
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
// disabled 状态时,不查询接口
|
|
190
|
+
if (defaultDisableValue || !useRequest) {
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
// 如果配置手动加载,不执行请求
|
|
194
|
+
var _ref3 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
|
195
|
+
defaultParams = _ref3.defaultParams;
|
|
196
|
+
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
|
197
|
+
fetchFunction.run(defaultParams);
|
|
198
|
+
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, defaultDisableValue]);
|
|
199
|
+
// disable默认值
|
|
200
|
+
if (defaultDisableValue) {
|
|
201
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
202
|
+
title: defaultDisableValue
|
|
203
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.Input, {
|
|
204
|
+
disabled: true,
|
|
205
|
+
defaultValue: defaultDisableValue,
|
|
206
|
+
style: props === null || props === void 0 ? void 0 : props.style
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* 根据值进行回显
|
|
211
|
+
* @param value 输入值
|
|
212
|
+
* @returns 对应枚举label
|
|
213
|
+
*/
|
|
214
|
+
var transToLabel = function transToLabel(value) {
|
|
215
|
+
if (!Array.isArray(origDataSource) || !origDataSource.length) {
|
|
216
|
+
return viewEmpty;
|
|
217
|
+
}
|
|
218
|
+
var labelResult = [];
|
|
219
|
+
var queryLabel = function queryLabel(dicts) {
|
|
220
|
+
return dicts.map(function (item) {
|
|
221
|
+
if (value.includes(item[code])) {
|
|
222
|
+
var labelText = item[label];
|
|
223
|
+
labelResult.push(labelText);
|
|
224
|
+
}
|
|
225
|
+
if (item.children) {
|
|
226
|
+
queryLabel(item.children);
|
|
227
|
+
}
|
|
228
|
+
return item;
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
queryLabel(origDataSource);
|
|
232
|
+
return labelResult === null || labelResult === void 0 ? void 0 : labelResult.join(',');
|
|
233
|
+
};
|
|
234
|
+
// 纯展示处理
|
|
235
|
+
if (isView || props.isView) {
|
|
236
|
+
if (Array.isArray(value)) {
|
|
237
|
+
return /*#__PURE__*/_react.default.createElement(_Container.default, {
|
|
238
|
+
tooltip: true,
|
|
239
|
+
viewEmpty: viewEmpty
|
|
240
|
+
}, transToLabel(value));
|
|
241
|
+
}
|
|
242
|
+
return /*#__PURE__*/_react.default.createElement(_Container.default, {
|
|
243
|
+
viewEmpty: viewEmpty
|
|
244
|
+
}, value ? transToLabel([value]) : null);
|
|
245
|
+
}
|
|
246
|
+
var Icon = function Icon() {
|
|
247
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
248
|
+
className: "icon",
|
|
249
|
+
viewBox: "0 0 1433 1024",
|
|
250
|
+
version: "1.1",
|
|
251
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
252
|
+
"p-id": "2318",
|
|
253
|
+
width: "1em",
|
|
254
|
+
height: "1em"
|
|
255
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
256
|
+
d: "M209.92 337.2032l362.0864 361.984L1223.68 47.5136l144.7936 144.896-796.4672 796.4672-506.88-506.88z",
|
|
257
|
+
"p-id": "2319",
|
|
258
|
+
fill: "currentColor"
|
|
259
|
+
}));
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* 自定义渲染子树
|
|
263
|
+
* @param node 每个节点数据对象
|
|
264
|
+
* @returns 整个react节点树
|
|
265
|
+
*/
|
|
266
|
+
var renderTreeNode = function renderTreeNode(node, grade) {
|
|
267
|
+
var children = node.children,
|
|
268
|
+
icon = node.icon;
|
|
269
|
+
var labelText = node[label];
|
|
270
|
+
var titleHtml = /*#__PURE__*/_react.default.createElement("span", {
|
|
271
|
+
dangerouslySetInnerHTML: {
|
|
272
|
+
__html: labelText
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
var title = treeCheckable ? titleHtml : /*#__PURE__*/_react.default.createElement("span", {
|
|
276
|
+
className: "check-option-text"
|
|
277
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
278
|
+
className: "check-option-text-content"
|
|
279
|
+
}, titleHtml), /*#__PURE__*/_react.default.createElement("span", {
|
|
280
|
+
className: "check-mark-icon"
|
|
281
|
+
}, /*#__PURE__*/_react.default.createElement(Icon, null)));
|
|
282
|
+
var value = node[code];
|
|
283
|
+
if (!children) {
|
|
284
|
+
return /*#__PURE__*/_react.default.createElement(_antd.TreeSelect.TreeNode, {
|
|
285
|
+
key: value,
|
|
286
|
+
value: value,
|
|
287
|
+
title: title,
|
|
288
|
+
"attr-data": value,
|
|
289
|
+
disabled: node.disabled,
|
|
290
|
+
checkable: node.checkable,
|
|
291
|
+
icon: icon,
|
|
292
|
+
className: "node-val-".concat(value)
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
var sonGrade = grade + 1;
|
|
296
|
+
return /*#__PURE__*/_react.default.createElement(_antd.TreeSelect.TreeNode, {
|
|
297
|
+
key: value,
|
|
298
|
+
value: value,
|
|
299
|
+
title: title,
|
|
300
|
+
"attr-data": value,
|
|
301
|
+
disabled: node.disabled,
|
|
302
|
+
checkable: node.checkable,
|
|
303
|
+
className: "node-val-".concat(value)
|
|
304
|
+
}, children.map(function (child) {
|
|
305
|
+
return renderTreeNode(child, sonGrade);
|
|
306
|
+
}));
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* 从树形数据中找出用户搜索得数据,并且将搜索字符串高亮标识
|
|
310
|
+
* @param data 全量树
|
|
311
|
+
* @param searchStr 搜索字符串
|
|
312
|
+
* @returns 处理后得树
|
|
313
|
+
*/
|
|
314
|
+
function filterTree(sourceList, keyWord) {
|
|
315
|
+
var filterData = function filterData(data) {
|
|
316
|
+
var currentAllNodeChild = []; // 记录当前节点得所有子节点
|
|
317
|
+
// 遍历数组
|
|
318
|
+
for (var i = 0; i < data.length; i++) {
|
|
319
|
+
var _item$children;
|
|
320
|
+
var item = data[i];
|
|
321
|
+
// 一直递归到最后一层子节点
|
|
322
|
+
var currentNodeChild = []; // 记录当前节点下得子节点匹配到的节点个数
|
|
323
|
+
if (item.children && item.children.length > 0) {
|
|
324
|
+
currentNodeChild = filterData(item.children);
|
|
325
|
+
}
|
|
326
|
+
// 迭代完子节点向上回溯,如果有匹配到得子节点,那么加入当前节点得孩子对象上,否则加入得是空数组
|
|
327
|
+
item.children = currentNodeChild;
|
|
328
|
+
var tag = false;
|
|
329
|
+
// 判断节点title是否包含关键字 如果有,那么直接进行下一循环
|
|
330
|
+
if (item[label].indexOf(keyWord) > -1) {
|
|
331
|
+
var regExp = new RegExp(keyWord);
|
|
332
|
+
item[label] = item[label].replace(regExp, "<span class=\"highlight-search-text\">".concat(keyWord, "</span>"));
|
|
333
|
+
tag = true;
|
|
334
|
+
}
|
|
335
|
+
if (tag || (item === null || item === void 0 ? void 0 : (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length)) {
|
|
336
|
+
// 如果子节点有匹配项或者自己匹配了那么都加入结果中
|
|
337
|
+
currentAllNodeChild.push(item);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return currentAllNodeChild;
|
|
341
|
+
};
|
|
342
|
+
sourceList = filterData(sourceList);
|
|
343
|
+
return sourceList;
|
|
344
|
+
}
|
|
345
|
+
var searchTreeEvent = function searchTreeEvent(searchVal) {
|
|
346
|
+
if (!searchVal) {
|
|
347
|
+
setState({
|
|
348
|
+
selectList: (0, _lodash.cloneDeep)(origDataSource || [])
|
|
349
|
+
});
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
var result = filterTree((0, _lodash.cloneDeep)(origDataSource || []), searchVal);
|
|
353
|
+
setState({
|
|
354
|
+
selectList: result || []
|
|
355
|
+
});
|
|
356
|
+
};
|
|
357
|
+
var handleChange = function handleChange(newVal, option) {
|
|
358
|
+
onChange && onChange(newVal, option, null);
|
|
359
|
+
// 重置搜索
|
|
360
|
+
showSearch && searchTreeEvent('');
|
|
361
|
+
};
|
|
362
|
+
/**
|
|
363
|
+
* 全局点击事件, 如果是单选的情况那么点击选中节点后取消勾选
|
|
364
|
+
* @param e 事件源
|
|
365
|
+
*/
|
|
366
|
+
var nodeChangeEvent = function nodeChangeEvent(e) {
|
|
367
|
+
var el = e.target;
|
|
368
|
+
var classStr = el.className;
|
|
369
|
+
if (classStr && !treeCheckable) {
|
|
370
|
+
var _classStr$split = classStr.split(' '),
|
|
371
|
+
_classStr$split2 = (0, _slicedToArray2.default)(_classStr$split, 1),
|
|
372
|
+
valStr = _classStr$split2[0];
|
|
373
|
+
if (valStr && classStr.startsWith('node-val-')) {
|
|
374
|
+
var choiceVal = valStr.replace('node-val-', '');
|
|
375
|
+
if (value === choiceVal) {
|
|
376
|
+
onChange && onChange(undefined, [], null);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
// 如果单选情况下只有10条那么设置class控制样式
|
|
382
|
+
var tenCountClass = '';
|
|
383
|
+
var countTen = function countTen(enums) {
|
|
384
|
+
if (!enums) {
|
|
385
|
+
return '';
|
|
386
|
+
}
|
|
387
|
+
var noneChild = true;
|
|
388
|
+
var loopCount = function loopCount(data) {
|
|
389
|
+
data.map(function (item) {
|
|
390
|
+
var _item$children2;
|
|
391
|
+
if (item === null || item === void 0 ? void 0 : (_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.length) {
|
|
392
|
+
noneChild = false;
|
|
393
|
+
}
|
|
394
|
+
return item;
|
|
395
|
+
});
|
|
396
|
+
};
|
|
397
|
+
loopCount(enums);
|
|
398
|
+
return noneChild ? 'ten-count-tree-node' : '';
|
|
399
|
+
};
|
|
400
|
+
tenCountClass = countTen(selectList);
|
|
401
|
+
var treeProps = (0, _objectSpread2.default)({
|
|
402
|
+
disabled: disabled,
|
|
403
|
+
showSearch: showSearch,
|
|
404
|
+
filterTreeNode: false,
|
|
405
|
+
treeDefaultExpandAll: treeDefaultExpandAll,
|
|
406
|
+
treeCheckable: treeCheckable,
|
|
407
|
+
showCheckedStrategy: SHOW_PARENT,
|
|
408
|
+
value: value,
|
|
409
|
+
onChange: handleChange,
|
|
410
|
+
dropdownStyle: (0, _objectSpread2.default)({
|
|
411
|
+
maxHeight: 320,
|
|
412
|
+
overflow: 'auto',
|
|
413
|
+
width: 'auto!important',
|
|
414
|
+
maxWidth: '580px'
|
|
415
|
+
}, dropdownStyle),
|
|
416
|
+
listHeight: listHeight || 320,
|
|
417
|
+
style: (0, _objectSpread2.default)({
|
|
418
|
+
width: width || '100%'
|
|
419
|
+
}, style),
|
|
420
|
+
popupClassName: treeCheckable ? 'checkable-tree' : "".concat(tenCountClass, " signal-tree"),
|
|
421
|
+
onSearch: searchTreeEvent,
|
|
422
|
+
allowClear: allowClear || true,
|
|
423
|
+
showArrow: true
|
|
424
|
+
}, selectProps);
|
|
425
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
426
|
+
onClick: nodeChangeEvent
|
|
427
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.TreeSelect, (0, _objectSpread2.default)({}, treeProps), selectList.map(function (node) {
|
|
428
|
+
return renderTreeNode(node, 1);
|
|
429
|
+
})));
|
|
430
|
+
};
|
|
431
|
+
exports.ProTreeSelect = ProTreeSelect;
|
|
432
|
+
var _default = /*#__PURE__*/(0, _react.forwardRef)(ProTreeSelect);
|
|
433
|
+
exports.default = _default;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import type { TreeSelectProps } from 'antd';
|
|
3
|
+
import { Service, Options, Result } from 'ahooks/lib/useRequest/src/types';
|
|
4
|
+
import { ProFormOtherProps } from '../ProForm/propsType';
|
|
5
|
+
export interface DataProps {
|
|
6
|
+
label: string;
|
|
7
|
+
value?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
disableCheckbox?: boolean;
|
|
10
|
+
selectable?: boolean;
|
|
11
|
+
checkable?: boolean;
|
|
12
|
+
title?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DataOption {
|
|
15
|
+
label: string;
|
|
16
|
+
value?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
disableCheckbox?: boolean;
|
|
19
|
+
selectable?: boolean;
|
|
20
|
+
checkable?: boolean;
|
|
21
|
+
children?: DataProps[];
|
|
22
|
+
title?: string;
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}
|
|
25
|
+
export interface BaseOptionType {
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
checkable?: boolean;
|
|
28
|
+
disableCheckbox?: boolean;
|
|
29
|
+
children?: BaseOptionType[];
|
|
30
|
+
[name: string]: any;
|
|
31
|
+
}
|
|
32
|
+
export interface DefaultOptionType extends BaseOptionType {
|
|
33
|
+
value?: any;
|
|
34
|
+
title?: React.ReactNode;
|
|
35
|
+
label: React.ReactNode;
|
|
36
|
+
key?: React.Key;
|
|
37
|
+
children?: DefaultOptionType[];
|
|
38
|
+
}
|
|
39
|
+
export interface PropTreeSelectProps extends Omit<TreeSelectProps, 'onSearch'> {
|
|
40
|
+
/** 是否查看模式 */
|
|
41
|
+
isView?: boolean;
|
|
42
|
+
/** 是否根据输入项进行筛选, 默认true */
|
|
43
|
+
filterTreeNode?: boolean;
|
|
44
|
+
/** 输入项过滤对应的 treeNode 属性, 默认label */
|
|
45
|
+
treeNodeFilterProp?: string;
|
|
46
|
+
/** 是否展开所有树 */
|
|
47
|
+
treeDefaultExpandAll?: boolean;
|
|
48
|
+
/** 是否支持复选、多选,默认多选 */
|
|
49
|
+
treeCheckable?: boolean;
|
|
50
|
+
/** 输入框宽度,默认100% */
|
|
51
|
+
width?: any;
|
|
52
|
+
/** 枚举code-从localStorage里面根据次code取枚举值 */
|
|
53
|
+
code?: string;
|
|
54
|
+
/** 数据源 */
|
|
55
|
+
dataSource?: DataOption[];
|
|
56
|
+
/** 兼容 2.0 版本、3.0 使用view 模式 */
|
|
57
|
+
defaultDisableValue?: string;
|
|
58
|
+
/** 兼容 2.0 版本、3.0 使用 transformResponse */
|
|
59
|
+
updateDataSource?: (data: any, setSelectList: any) => void;
|
|
60
|
+
/** 格式化数据 */
|
|
61
|
+
transformResponse?: (data: any) => DataOption[];
|
|
62
|
+
/** 是否展示 tooltip、当 label 特别长的时候使用 */
|
|
63
|
+
tooltip?: boolean;
|
|
64
|
+
/** 是否展示 code-label 形式 */
|
|
65
|
+
showCodeName?: boolean;
|
|
66
|
+
/** 集成表单 form 的属性 */
|
|
67
|
+
otherProps?: ProFormOtherProps;
|
|
68
|
+
onSearch?: (value: string, useRequest: Result<any, any>) => void;
|
|
69
|
+
/** 自定义展示 */
|
|
70
|
+
optionRender?: (value: DataOption) => string | ReactNode;
|
|
71
|
+
/** 远程请求接口 */
|
|
72
|
+
useRequest?: {
|
|
73
|
+
service: Service<any, any>;
|
|
74
|
+
options?: Options<any, any>;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export interface ProSelectAction {
|
|
78
|
+
/** 实例方法、根据 code | code[] 批量获取数据 */
|
|
79
|
+
getValueObject?: (code: string | string[], key?: string) => any;
|
|
80
|
+
/** 获取发生请求的 useRequest 的 ref */
|
|
81
|
+
useRequestRef: Result<any, any>;
|
|
82
|
+
}
|
|
83
|
+
export interface TreeNodeData extends DataOption {
|
|
84
|
+
title: string;
|
|
85
|
+
value: string;
|
|
86
|
+
children?: TreeNodeData[];
|
|
87
|
+
icon?: React.ReactNode;
|
|
88
|
+
}
|
|
89
|
+
export interface TreeSelectFormProps {
|
|
90
|
+
type: string;
|
|
91
|
+
label: string;
|
|
92
|
+
name?: string;
|
|
93
|
+
fieldProps?: PropTreeSelectProps;
|
|
94
|
+
[key: string]: any;
|
|
95
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
|
|
2
|
+
.ant-select-selector{
|
|
3
|
+
// 单选树选择结果框里title不用待后缀
|
|
4
|
+
.check-mark-icon{
|
|
5
|
+
display: none;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
.ant-select.ant-select-single.ant-select-show-arrow{
|
|
9
|
+
&.ant-select-open{
|
|
10
|
+
.ant-select-arrow{
|
|
11
|
+
transition: transform 300ms ease-in-out;
|
|
12
|
+
transform: rotate(180deg);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
.ant-select-dropdown{
|
|
17
|
+
.highlight-search-text{
|
|
18
|
+
color: @zaui-brand;
|
|
19
|
+
}
|
|
20
|
+
.ant-select-tree-list-holder-inner{
|
|
21
|
+
position: relative!important;
|
|
22
|
+
}
|
|
23
|
+
&.ant-tree-select-dropdown{
|
|
24
|
+
width: auto!important;
|
|
25
|
+
padding: 0px;
|
|
26
|
+
}
|
|
27
|
+
&.singal-tree,&.checkable-tree{
|
|
28
|
+
.ant-select-tree{
|
|
29
|
+
.ant-select-tree-treenode{
|
|
30
|
+
padding-top: 5px;
|
|
31
|
+
padding-bottom: 5px;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.highlight{
|
|
35
|
+
color: red;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// 单选
|
|
39
|
+
&.signal-tree{
|
|
40
|
+
.ant-select-tree{
|
|
41
|
+
.ant-select-tree-treenode{
|
|
42
|
+
position: relative;
|
|
43
|
+
padding-right: 50px;
|
|
44
|
+
padding-left: 7px;
|
|
45
|
+
z-index: 1;
|
|
46
|
+
&:after{
|
|
47
|
+
content: '';
|
|
48
|
+
display: none;
|
|
49
|
+
position: absolute;
|
|
50
|
+
z-index: 0;
|
|
51
|
+
left: 0;
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: 100%;
|
|
54
|
+
background-color: @zaui-brand;
|
|
55
|
+
opacity: 0.1;
|
|
56
|
+
}
|
|
57
|
+
&.ant-select-tree-treenode-selected:after{
|
|
58
|
+
display: block;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
.ant-select-tree-node-content-wrapper{
|
|
62
|
+
background-color: transparent;
|
|
63
|
+
&.ant-select-tree-node-selected{
|
|
64
|
+
.check-mark-icon{
|
|
65
|
+
display: block;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
.ant-select-tree-treenode:hover{
|
|
70
|
+
background-color: #f5f5f5;
|
|
71
|
+
}
|
|
72
|
+
.check-option-text{
|
|
73
|
+
.check-mark-icon{
|
|
74
|
+
position: absolute;
|
|
75
|
+
right: -34px;
|
|
76
|
+
top: 2px;
|
|
77
|
+
display: none;
|
|
78
|
+
color: @zaui-list-item-selected-bg;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// 复选
|
|
84
|
+
&.checkable-tree{
|
|
85
|
+
.ant-select-tree{
|
|
86
|
+
.ant-select-tree-treenode{
|
|
87
|
+
padding-left: 7px;
|
|
88
|
+
}
|
|
89
|
+
.ant-select-tree-treenode:hover{
|
|
90
|
+
background-color: #f5f5f5;
|
|
91
|
+
}
|
|
92
|
+
.ant-select-tree-node-content-wrapper{
|
|
93
|
+
padding-right: 16px;
|
|
94
|
+
}
|
|
95
|
+
.ant-select-tree-node-content-wrapper:hover{
|
|
96
|
+
background-color: transparent;
|
|
97
|
+
}
|
|
98
|
+
.ant-select-tree-checkbox{
|
|
99
|
+
margin-top: 0px;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// 数据小于10条
|
|
104
|
+
&.ten-count-tree-node{
|
|
105
|
+
.ant-select-tree-switcher-noop{
|
|
106
|
+
width: 4px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
package/lib/ProUpload/Example.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.Example = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
11
|
+
var _sisyphusReact = require("@zat-design/sisyphus-react");
|
|
12
12
|
/*
|
|
13
13
|
* @Author: wangshengqiang
|
|
14
14
|
* @Date: 2023-02-16 16:32:18
|
|
@@ -34,7 +34,7 @@ var Example = function Example(props) {
|
|
|
34
34
|
className: className
|
|
35
35
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
36
36
|
onClick: handleShowModal
|
|
37
|
-
}, " \u67E5\u770B\u793A\u4F8B"), /*#__PURE__*/_react.default.createElement(
|
|
37
|
+
}, " \u67E5\u770B\u793A\u4F8B"), /*#__PURE__*/_react.default.createElement(_sisyphusReact.ProDrawerForm, {
|
|
38
38
|
title: "\u57FA\u7840\u62BD\u5C49",
|
|
39
39
|
width: "800",
|
|
40
40
|
open: visible,
|
package/lib/ProUpload/index.d.ts
CHANGED
package/lib/ProUpload/index.js
CHANGED
|
@@ -18,8 +18,14 @@ var _Example = require("./Example");
|
|
|
18
18
|
var _look = _interopRequireDefault(require("./style/look.svg"));
|
|
19
19
|
var _delete = _interopRequireDefault(require("./style/delete.svg"));
|
|
20
20
|
var _download = _interopRequireDefault(require("./style/download.svg"));
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
var _excluded = ["value", "size", "action", "maxCount", "headerRender", "footerRender", "disabled", "uploadType", "buttonProps", "accept", "extraTipText", "beforeUpload", "onChange", "onDownload", "onPreview", "onRemove", "method", "className", "dataParams", "showExampleContent", "otherProps", "transformResponse"]; // @ts-noCheck
|
|
22
|
+
/*
|
|
23
|
+
* @Author: wangshengqiang
|
|
24
|
+
* @Date: 2023-02-03 14:18:59
|
|
25
|
+
* @LastEditTime: 2023-04-25 11:57:13
|
|
26
|
+
* @LastEditors: wangshengqiang
|
|
27
|
+
* @Description: 上传控件
|
|
28
|
+
*/
|
|
23
29
|
var validateSize = function validateSize(size, file) {
|
|
24
30
|
if (size !== undefined) {
|
|
25
31
|
return file.size <= size * 1024 * 1024;
|