@zat-design/sisyphus-react 3.1.5 → 3.2.0
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 +176 -250
- package/es/ProAction/index.js +7 -5
- package/es/ProAction/index.less +3 -2
- package/es/ProConfigProvider/index.d.ts +2 -0
- package/es/ProConfigProvider/index.js +23 -2
- package/es/ProDownload/utils.js +6 -3
- package/es/ProDrawerForm/components/ProDrawer/index.js +6 -4
- package/es/ProDrawerForm/index.js +5 -3
- package/es/ProDrawerForm/style/index.less +15 -11
- package/es/ProEditLabel/style/index.less +2 -2
- package/es/ProEditTable/components/ActionButton/index.js +3 -2
- package/es/ProEditTable/components/RenderField/index.js +2 -1
- package/es/ProEditTable/index.js +7 -6
- package/es/ProEditTable/style/index.less +15 -8
- package/es/ProEditTable/utils/config.d.ts +8 -8
- package/es/ProEditTable/utils/config.js +20 -12
- package/es/ProEditTable/utils/index.js +3 -2
- package/es/ProEnum/hooks/useEnumRequest.js +17 -10
- package/es/ProEnum/index.js +9 -4
- package/es/ProEnum/style/index.less +1 -1
- package/es/ProForm/components/FormFooter/index.js +16 -20
- package/es/ProForm/components/base/Input/index.js +4 -3
- package/es/ProForm/components/base/InputNumber/index.js +4 -3
- package/es/ProForm/components/base/RangePicker/index.js +0 -3
- package/es/ProForm/components/base/Select/index.js +2 -1
- package/es/ProForm/components/base/Switch/index.js +9 -5
- package/es/ProForm/components/base/SwitchCheckbox/index.js +2 -1
- package/es/ProForm/components/base/TextArea/index.js +4 -2
- package/es/ProForm/components/base/TextArea/index.less +1 -1
- package/es/ProForm/components/combination/Container/style/index.less +0 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +13 -17
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -1
- package/es/ProForm/components/combination/FormList/style/index.less +20 -19
- package/es/ProForm/components/combination/Group/index.js +2 -2
- package/es/ProForm/components/combination/ProAddressBar/index.js +83 -63
- package/es/ProForm/components/combination/ProAddressBar/propsType.d.ts +3 -2
- package/es/ProForm/components/combination/ProModalSelect/index.js +76 -15
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +1 -0
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +3 -3
- package/es/ProForm/components/combination/ProNumberRange/index.js +3 -2
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +1 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.js +3 -7
- package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +10 -5
- package/es/ProForm/components/combination/ProTimeLimit/index.js +4 -11
- package/es/ProForm/components/combination/ProTimeLimit/style/index.less +18 -1
- package/es/ProForm/components/old/EnumSelect/style/index.less +7 -8
- package/es/ProForm/components/render/Render.js +4 -2
- package/es/ProForm/components/render/RenderFields.js +10 -6
- package/es/ProForm/components/render/propsType.d.ts +5 -4
- package/es/ProForm/index.js +14 -2
- package/es/ProForm/style/index.less +77 -169
- package/es/ProForm/utils/index.d.ts +1 -1
- package/es/ProForm/utils/index.js +7 -2
- package/es/ProForm/utils/rulesCreator.js +2 -1
- package/es/ProForm/utils/useRules.js +4 -3
- package/es/ProForm/utils/useShouldUpdate.js +16 -16
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +6 -0
- package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +2 -2
- package/es/ProLayout/components/Layout/Notice/index.js +3 -2
- package/es/ProLayout/components/ProCollapse/style/index.less +4 -4
- package/es/ProLayout/components/ProHeader/components/Copy/index.js +2 -1
- package/es/{old → ProLayout/components/ProHeader/components}/ProBackBtn/index.js +2 -1
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +21 -0
- package/es/ProLayout/components/ProHeader/components/index.d.ts +1 -0
- package/es/ProLayout/components/ProHeader/components/index.js +2 -1
- package/es/ProLayout/components/ProHeader/index.js +9 -6
- package/es/ProLayout/components/ProHeader/style/index.less +16 -7
- package/es/ProLayout/utils/index.js +1 -1
- package/es/ProSelect/index.d.ts +3 -3
- package/es/ProSelect/index.js +4 -2
- package/es/ProStep/components/Step/index.js +3 -1
- package/es/ProStep/style/index.less +0 -1
- package/es/ProTable/components/RenderColumn/index.d.ts +5 -5
- package/es/ProTable/components/RenderColumn/index.js +41 -25
- package/es/ProTable/index.js +10 -8
- package/es/ProTable/propsType.d.ts +2 -0
- package/es/ProTable/style/index.less +14 -1
- package/es/ProTable/useAntdTable.d.ts +12 -4
- package/es/ProTable/useAntdTable.js +18 -6
- package/es/ProTable/utils.d.ts +1 -1
- package/es/ProTable/utils.js +258 -201
- package/es/ProTabs/style/index.less +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +1 -1
- package/es/ProThemeTools/component/PrdTools/style/index.less +3 -3
- package/es/ProThemeTools/index.d.ts +2 -2
- package/es/ProThemeTools/index.js +24 -17
- package/es/ProThemeTools/propsType.d.ts +8 -6
- package/es/ProThemeTools/style/index.less +2 -2
- package/es/ProThemeTools/utils/index.d.ts +7 -0
- package/es/ProThemeTools/utils/index.js +19 -1
- package/es/ProTree/components/ProTree.js +6 -5
- package/es/ProTree/components/SearchTitle.d.ts +2 -2
- package/es/ProTree/components/SearchTitle.js +11 -1
- package/es/ProTree/components/Tree.js +9 -2
- package/es/ProTree/style/index.less +193 -141
- package/es/ProTreeModal/components/List.js +0 -14
- package/es/ProTreeModal/components/Trigger.js +9 -3
- package/es/ProTreeModal/index.js +29 -13
- package/es/ProTreeModal/style/index.less +2 -6
- package/es/ProUpload/components/ButtonRender.js +5 -2
- package/es/ProUpload/components/DragRender.js +8 -8
- package/es/ProUpload/components/Example.js +3 -1
- package/es/ProUpload/components/ImageRender.js +8 -6
- package/es/ProUpload/index.js +8 -6
- package/es/ProUpload/style/index.less +41 -39
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/locale/en_US.d.ts +138 -0
- package/es/locale/en_US.js +137 -0
- package/es/locale/index.d.ts +13 -0
- package/es/locale/index.js +32 -0
- package/es/locale/zh_CN.d.ts +137 -0
- package/es/locale/zh_CN.js +136 -0
- package/es/old/ProEditableTable/style/index.less +1 -2
- package/es/style/components.less +0 -1
- package/es/style/core/normalize.less +1 -2
- package/es/style/theme/antd.less +3 -4
- package/es/style/theme/index.less +80 -79
- package/es/style/theme/tokens.less +1 -0
- package/lib/ProAction/index.js +7 -5
- package/lib/ProAction/index.less +3 -2
- package/lib/ProConfigProvider/index.d.ts +2 -0
- package/lib/ProConfigProvider/index.js +22 -2
- package/lib/ProDownload/utils.js +4 -3
- package/lib/ProDrawerForm/components/ProDrawer/index.js +6 -4
- package/lib/ProDrawerForm/index.js +5 -3
- package/lib/ProDrawerForm/style/index.less +15 -11
- package/lib/ProEditLabel/style/index.less +2 -2
- package/lib/ProEditTable/components/ActionButton/index.js +3 -2
- package/lib/ProEditTable/components/RenderField/index.js +4 -1
- package/lib/ProEditTable/index.js +7 -6
- package/lib/ProEditTable/style/index.less +15 -8
- package/lib/ProEditTable/utils/config.d.ts +8 -8
- package/lib/ProEditTable/utils/config.js +20 -12
- package/lib/ProEditTable/utils/index.js +3 -2
- package/lib/ProEnum/hooks/useEnumRequest.js +17 -10
- package/lib/ProEnum/index.js +9 -4
- package/lib/ProEnum/style/index.less +1 -1
- package/lib/ProForm/components/FormFooter/index.js +16 -19
- package/lib/ProForm/components/base/Input/index.js +4 -3
- package/lib/ProForm/components/base/InputNumber/index.js +4 -3
- package/lib/ProForm/components/base/RangePicker/index.js +1 -4
- package/lib/ProForm/components/base/Select/index.js +2 -1
- package/lib/ProForm/components/base/Switch/index.js +8 -5
- package/lib/ProForm/components/base/SwitchCheckbox/index.js +2 -1
- package/lib/ProForm/components/base/TextArea/index.js +4 -2
- package/lib/ProForm/components/base/TextArea/index.less +1 -1
- package/lib/ProForm/components/combination/Container/style/index.less +0 -1
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +13 -17
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -1
- package/lib/ProForm/components/combination/FormList/style/index.less +20 -19
- package/lib/ProForm/components/combination/Group/index.js +2 -2
- package/lib/ProForm/components/combination/ProAddressBar/index.js +78 -60
- package/lib/ProForm/components/combination/ProAddressBar/propsType.d.ts +3 -2
- package/lib/ProForm/components/combination/ProModalSelect/index.js +76 -15
- package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +1 -0
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +3 -3
- package/lib/ProForm/components/combination/ProNumberRange/index.js +3 -2
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +1 -1
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +3 -7
- package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +10 -5
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +4 -11
- package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +18 -1
- package/lib/ProForm/components/old/EnumSelect/style/index.less +7 -8
- package/lib/ProForm/components/old/InputRange/index.js +0 -1
- package/lib/ProForm/components/old/ProCertValidity/index.js +1 -1
- package/lib/ProForm/components/render/Render.js +5 -2
- package/lib/ProForm/components/render/RenderFields.js +9 -5
- package/lib/ProForm/components/render/propsType.d.ts +5 -4
- package/lib/ProForm/index.js +14 -2
- package/lib/ProForm/style/index.less +77 -169
- package/lib/ProForm/utils/index.d.ts +1 -1
- package/lib/ProForm/utils/index.js +7 -2
- package/lib/ProForm/utils/rulesCreator.js +2 -1
- package/lib/ProForm/utils/useRules.js +4 -3
- package/lib/ProForm/utils/useShouldUpdate.js +16 -16
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +6 -0
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +2 -2
- package/lib/ProLayout/components/Layout/Notice/index.js +3 -2
- package/lib/ProLayout/components/ProCollapse/style/index.less +4 -4
- package/lib/ProLayout/components/ProHeader/components/Copy/index.js +2 -1
- package/lib/{old → ProLayout/components/ProHeader/components}/ProBackBtn/index.js +3 -1
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +21 -0
- package/lib/ProLayout/components/ProHeader/components/index.d.ts +1 -0
- package/lib/ProLayout/components/ProHeader/components/index.js +8 -1
- package/lib/ProLayout/components/ProHeader/index.js +9 -6
- package/lib/ProLayout/components/ProHeader/style/index.less +16 -7
- package/lib/ProLayout/utils/index.js +1 -1
- package/lib/ProSelect/index.d.ts +3 -3
- package/lib/ProSelect/index.js +4 -2
- package/lib/ProStep/components/Step/index.js +3 -1
- package/lib/ProStep/style/index.less +0 -1
- package/lib/ProTable/components/RenderColumn/index.d.ts +5 -5
- package/lib/ProTable/components/RenderColumn/index.js +38 -24
- package/lib/ProTable/components/TableResizable/index.js +8 -0
- package/lib/ProTable/index.js +10 -8
- package/lib/ProTable/propsType.d.ts +2 -0
- package/lib/ProTable/style/index.less +14 -1
- package/lib/ProTable/useAntdTable.d.ts +12 -4
- package/lib/ProTable/useAntdTable.js +19 -6
- package/lib/ProTable/utils.d.ts +1 -1
- package/lib/ProTable/utils.js +258 -201
- package/lib/ProTabs/index.js +1 -0
- package/lib/ProTabs/style/index.less +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +1 -1
- package/lib/ProThemeTools/component/PrdTools/style/index.less +3 -3
- package/lib/ProThemeTools/index.d.ts +2 -2
- package/lib/ProThemeTools/index.js +24 -16
- package/lib/ProThemeTools/propsType.d.ts +8 -6
- package/lib/ProThemeTools/style/index.less +2 -2
- package/lib/ProThemeTools/utils/index.d.ts +7 -0
- package/lib/ProThemeTools/utils/index.js +20 -2
- package/lib/ProTree/components/ProTree.js +6 -5
- package/lib/ProTree/components/SearchTitle.d.ts +2 -2
- package/lib/ProTree/components/SearchTitle.js +11 -1
- package/lib/ProTree/components/Tree.js +16 -2
- package/lib/ProTree/index.js +0 -1
- package/lib/ProTree/style/index.less +193 -141
- package/lib/ProTreeModal/components/List.js +0 -14
- package/lib/ProTreeModal/components/Tree.js +1 -0
- package/lib/ProTreeModal/components/Trigger.js +10 -3
- package/lib/ProTreeModal/index.js +29 -13
- package/lib/ProTreeModal/style/index.less +2 -6
- package/lib/ProUpload/components/ButtonRender.js +5 -2
- package/lib/ProUpload/components/DragRender.js +8 -8
- package/lib/ProUpload/components/Example.js +3 -1
- package/lib/ProUpload/components/ImageRender.js +8 -6
- package/lib/ProUpload/index.js +14 -5
- package/lib/ProUpload/style/index.less +41 -39
- package/lib/index.d.ts +2 -1
- package/lib/index.js +13 -1
- package/lib/locale/en_US.d.ts +138 -0
- package/lib/locale/en_US.js +143 -0
- package/lib/locale/index.d.ts +13 -0
- package/lib/locale/index.js +41 -0
- package/lib/locale/zh_CN.d.ts +137 -0
- package/lib/locale/zh_CN.js +142 -0
- package/lib/old/ProCertValidity/index.js +1 -1
- package/lib/old/ProEditableTable/style/index.less +1 -2
- package/lib/style/components.less +0 -1
- package/lib/style/core/normalize.less +1 -2
- package/lib/style/theme/antd.less +3 -4
- package/lib/style/theme/index.less +80 -79
- package/lib/style/theme/tokens.less +1 -0
- package/package.json +1 -1
- package/typings.d.ts +2 -0
- package/es/old/ProBackBtn/style/index.less +0 -19
- package/lib/old/ProBackBtn/style/index.less +0 -19
- /package/es/{old → ProLayout/components/ProHeader/components}/ProBackBtn/index.d.ts +0 -0
- /package/es/{old → ProLayout/components/ProHeader/components}/ProBackBtn/propsType.d.ts +0 -0
- /package/es/{old → ProLayout/components/ProHeader/components}/ProBackBtn/propsType.js +0 -0
- /package/lib/{old → ProLayout/components/ProHeader/components}/ProBackBtn/index.d.ts +0 -0
- /package/lib/{old → ProLayout/components/ProHeader/components}/ProBackBtn/propsType.d.ts +0 -0
- /package/lib/{old → ProLayout/components/ProHeader/components}/ProBackBtn/propsType.js +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "antd/es/input/style";
|
|
2
2
|
import _Input from "antd/es/input";
|
|
3
|
-
import "antd/es/tooltip/style";
|
|
4
|
-
import _Tooltip from "antd/es/tooltip";
|
|
5
3
|
import "antd/es/cascader/style";
|
|
6
4
|
import _Cascader from "antd/es/cascader";
|
|
5
|
+
import "antd/es/tooltip/style";
|
|
6
|
+
import _Tooltip from "antd/es/tooltip";
|
|
7
7
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
@@ -11,14 +11,18 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
11
11
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
12
12
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
13
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
14
|
-
|
|
15
|
-
import
|
|
14
|
+
import "antd/es/typography/style";
|
|
15
|
+
import _Typography from "antd/es/typography";
|
|
16
|
+
var _excluded = ["className", "getPopupContainer", "hasDetail", "detailMaxLength", "fieldNames", "value", "disabled", "dataSource", "onChange", "useRequest", "transformResponse", "level", "isView", "enumCode", "code", "tooltip", "separator"];
|
|
17
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
18
|
import { useEffect, useState, memo, useMemo } from 'react';
|
|
17
19
|
import { useSetState } from 'ahooks';
|
|
18
20
|
import { tools } from '@zat-design/utils';
|
|
19
21
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
20
22
|
import useEnum from '../../../../ProEnum/hooks/useEnum';
|
|
23
|
+
import locale from '../../../../locale';
|
|
21
24
|
var transformDataName = tools.transformDataName;
|
|
25
|
+
var Text = _Typography.Text;
|
|
22
26
|
var filterDataSource = function filterDataSource(dataSource, level) {
|
|
23
27
|
return dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
|
|
24
28
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -44,7 +48,7 @@ var levelMap = {
|
|
|
44
48
|
3: 'county'
|
|
45
49
|
};
|
|
46
50
|
var ProAddressBar = function ProAddressBar(props) {
|
|
47
|
-
var _otherProps$otherProp, _ref11, _ref11$filter;
|
|
51
|
+
var _otherProps$otherProp, _ref11, _ref11$filter, _locale$ProAddressBar, _locale$ProAddressBar2, _locale$ProAddressBar3;
|
|
48
52
|
var _ref = useProConfig('ProAddressBar') || {},
|
|
49
53
|
configUseRequest = _ref.useRequest,
|
|
50
54
|
configTransformResponse = _ref.transformResponse,
|
|
@@ -53,8 +57,8 @@ var ProAddressBar = function ProAddressBar(props) {
|
|
|
53
57
|
configFieldNames = _ref.fieldNames,
|
|
54
58
|
configEnumCode = _ref.enumCode,
|
|
55
59
|
configCode = _ref.code;
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
var className = props.className,
|
|
61
|
+
getPopupContainer = props.getPopupContainer,
|
|
58
62
|
_props$hasDetail = props.hasDetail,
|
|
59
63
|
hasDetail = _props$hasDetail === void 0 ? true : _props$hasDetail,
|
|
60
64
|
_props$detailMaxLengt = props.detailMaxLength,
|
|
@@ -171,7 +175,7 @@ var ProAddressBar = function ProAddressBar(props) {
|
|
|
171
175
|
transFormData = transformDataName(newData, {
|
|
172
176
|
label: fieldNames.label,
|
|
173
177
|
value: fieldNames.value,
|
|
174
|
-
children: 'children'
|
|
178
|
+
children: (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'
|
|
175
179
|
});
|
|
176
180
|
setServiceData(realLevel === 2 ? filterDataSource(transFormData, level) : transFormData);
|
|
177
181
|
}
|
|
@@ -265,19 +269,19 @@ var ProAddressBar = function ProAddressBar(props) {
|
|
|
265
269
|
}, [service]);
|
|
266
270
|
useEffect(function () {
|
|
267
271
|
// 传入useRequest时初始化province展示
|
|
268
|
-
if (service && !fetched && province) {
|
|
272
|
+
if (service && loadData && !fetched && province) {
|
|
269
273
|
initAddressLabel('province', province, provinceOptions);
|
|
270
274
|
}
|
|
271
275
|
}, [province, fetched, provinceOptions]);
|
|
272
276
|
useEffect(function () {
|
|
273
277
|
// 传入useRequest时初始化city展示
|
|
274
|
-
if (service && !fetched && province && city) {
|
|
278
|
+
if (service && loadData && !fetched && province && city) {
|
|
275
279
|
initAddressLabel('city', city, _defineProperty({}, parentKey, province));
|
|
276
280
|
}
|
|
277
281
|
}, [province, city, fetched]);
|
|
278
282
|
useEffect(function () {
|
|
279
283
|
// 传入useRequest时初始化county展示
|
|
280
|
-
if (service && !fetched && city && county) {
|
|
284
|
+
if (service && loadData && !fetched && city && county) {
|
|
281
285
|
initAddressLabel('county', county, _defineProperty({}, parentKey, city));
|
|
282
286
|
}
|
|
283
287
|
}, [city, county, fetched]);
|
|
@@ -287,6 +291,12 @@ var ProAddressBar = function ProAddressBar(props) {
|
|
|
287
291
|
setDefaultLabel(getAddressLabel(realDataSource, value));
|
|
288
292
|
}
|
|
289
293
|
}, [realIsView, value, realDataSource]);
|
|
294
|
+
useEffect(function () {
|
|
295
|
+
// 传入useRequest但loadData为fasle查看时初始化展示
|
|
296
|
+
if (realIsView && value && (serviceData === null || serviceData === void 0 ? void 0 : serviceData.length) > 0) {
|
|
297
|
+
setDefaultLabel(getAddressLabel(serviceData, value));
|
|
298
|
+
}
|
|
299
|
+
}, [realIsView, value, serviceData]);
|
|
290
300
|
var handleLoadData = /*#__PURE__*/function () {
|
|
291
301
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(selectedOptions) {
|
|
292
302
|
var targetOption, data;
|
|
@@ -320,14 +330,14 @@ var ProAddressBar = function ProAddressBar(props) {
|
|
|
320
330
|
return _ref10.apply(this, arguments);
|
|
321
331
|
};
|
|
322
332
|
}();
|
|
323
|
-
var handleChange = function handleChange(changeValue) {
|
|
333
|
+
var handleChange = function handleChange(changeValue, selectedOptions) {
|
|
324
334
|
if (onChange) {
|
|
325
335
|
if (hasDetail && address) {
|
|
326
336
|
var realValue = changeValue || [];
|
|
327
337
|
realValue[realLevel] = address;
|
|
328
|
-
onChange(realValue);
|
|
338
|
+
onChange(realValue, selectedOptions);
|
|
329
339
|
} else {
|
|
330
|
-
onChange(changeValue);
|
|
340
|
+
onChange(changeValue, selectedOptions);
|
|
331
341
|
}
|
|
332
342
|
}
|
|
333
343
|
};
|
|
@@ -362,56 +372,66 @@ var ProAddressBar = function ProAddressBar(props) {
|
|
|
362
372
|
var viewValue = ((_ref11 = [provinceLabel, cityLabel, countyLabel, value === null || value === void 0 ? void 0 : value[realLevel]]) === null || _ref11 === void 0 ? void 0 : (_ref11$filter = _ref11.filter(function (item) {
|
|
363
373
|
return !!item;
|
|
364
374
|
})) === null || _ref11$filter === void 0 ? void 0 : _ref11$filter.join(separator)) || '-';
|
|
365
|
-
return _jsx(
|
|
366
|
-
className:
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
disabled: disabled,
|
|
374
|
-
displayRender: function displayRender(label) {
|
|
375
|
-
return label === null || label === void 0 ? void 0 : label.filter(function (item) {
|
|
376
|
-
return !!item;
|
|
377
|
-
}).join('/');
|
|
378
|
-
},
|
|
379
|
-
showSearch: {
|
|
380
|
-
filter: handlefilter
|
|
381
|
-
},
|
|
382
|
-
onChange: handleChange
|
|
383
|
-
}) : _jsx(_Cascader, {
|
|
384
|
-
className: hasDetail ? '' : 'no-detail',
|
|
385
|
-
placeholder: "\u8BF7\u9009\u62E9",
|
|
386
|
-
value: addressValue,
|
|
387
|
-
loadData: handleLoadData,
|
|
388
|
-
// @ts-ignore
|
|
389
|
-
options: provinces,
|
|
390
|
-
disabled: disabled,
|
|
391
|
-
displayRender: displayRender,
|
|
392
|
-
changeOnSelect: true,
|
|
393
|
-
// @ts-ignore
|
|
394
|
-
onChange: handleChange
|
|
395
|
-
}), hasDetail && (tooltip && disabled && address ? _jsx(_Tooltip, {
|
|
396
|
-
title: address,
|
|
397
|
-
children: _jsx("span", {
|
|
398
|
-
className: "pro-address-detail",
|
|
399
|
-
children: _jsx(_Input, {
|
|
400
|
-
disabled: disabled,
|
|
401
|
-
value: address
|
|
402
|
-
})
|
|
403
|
-
})
|
|
404
|
-
}) : _jsx(_Input, {
|
|
405
|
-
allowClear: true,
|
|
406
|
-
autoComplete: "off",
|
|
407
|
-
disabled: disabled,
|
|
408
|
-
value: address,
|
|
409
|
-
maxLength: detailMaxLength,
|
|
410
|
-
placeholder: "\u8BF7\u8F93\u5165\u8BE6\u7EC6\u5730\u5740",
|
|
411
|
-
// @ts-ignore
|
|
412
|
-
onChange: handleAddressChange
|
|
413
|
-
}))]
|
|
375
|
+
return realIsView ? tooltip ? _jsx(_Tooltip, {
|
|
376
|
+
className: className,
|
|
377
|
+
title: tooltip === true ? viewValue : tooltip,
|
|
378
|
+
children: _jsx(Text, {
|
|
379
|
+
ellipsis: {
|
|
380
|
+
tooltip: false
|
|
381
|
+
},
|
|
382
|
+
children: viewValue
|
|
414
383
|
})
|
|
384
|
+
}) : _jsx("span", {
|
|
385
|
+
className: className,
|
|
386
|
+
children: viewValue
|
|
387
|
+
}) : _jsxs("div", {
|
|
388
|
+
className: "pro-address ".concat(className),
|
|
389
|
+
children: [dataSource || addressCode || !loadData ? _jsx(_Cascader, {
|
|
390
|
+
className: hasDetail ? '' : 'no-detail',
|
|
391
|
+
placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProAddressBar = locale.ProAddressBar) === null || _locale$ProAddressBar === void 0 ? void 0 : _locale$ProAddressBar.placeholder,
|
|
392
|
+
value: addressValue,
|
|
393
|
+
options: !loadData ? serviceData : realDataSource,
|
|
394
|
+
disabled: disabled,
|
|
395
|
+
displayRender: function displayRender(label) {
|
|
396
|
+
return label === null || label === void 0 ? void 0 : label.filter(function (item) {
|
|
397
|
+
return !!item;
|
|
398
|
+
}).join('/');
|
|
399
|
+
},
|
|
400
|
+
showSearch: {
|
|
401
|
+
filter: handlefilter
|
|
402
|
+
},
|
|
403
|
+
onChange: handleChange
|
|
404
|
+
}) : _jsx(_Cascader, {
|
|
405
|
+
className: hasDetail ? '' : 'no-detail',
|
|
406
|
+
placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProAddressBar2 = locale.ProAddressBar) === null || _locale$ProAddressBar2 === void 0 ? void 0 : _locale$ProAddressBar2.placeholder,
|
|
407
|
+
value: addressValue,
|
|
408
|
+
loadData: handleLoadData,
|
|
409
|
+
// @ts-ignore
|
|
410
|
+
options: provinces,
|
|
411
|
+
disabled: disabled,
|
|
412
|
+
displayRender: displayRender,
|
|
413
|
+
changeOnSelect: true,
|
|
414
|
+
// @ts-ignore
|
|
415
|
+
onChange: handleChange
|
|
416
|
+
}), hasDetail && (tooltip && disabled && address ? _jsx(_Tooltip, {
|
|
417
|
+
title: address,
|
|
418
|
+
children: _jsx("span", {
|
|
419
|
+
className: "pro-address-detail",
|
|
420
|
+
children: _jsx(_Input, {
|
|
421
|
+
disabled: disabled,
|
|
422
|
+
value: address
|
|
423
|
+
})
|
|
424
|
+
})
|
|
425
|
+
}) : _jsx(_Input, {
|
|
426
|
+
allowClear: true,
|
|
427
|
+
autoComplete: "off",
|
|
428
|
+
disabled: disabled,
|
|
429
|
+
value: address,
|
|
430
|
+
maxLength: detailMaxLength,
|
|
431
|
+
placeholder: locale === null || locale === void 0 ? void 0 : (_locale$ProAddressBar3 = locale.ProAddressBar) === null || _locale$ProAddressBar3 === void 0 ? void 0 : _locale$ProAddressBar3.detailPlaceholder,
|
|
432
|
+
// @ts-ignore
|
|
433
|
+
onChange: handleAddressChange
|
|
434
|
+
}))]
|
|
415
435
|
});
|
|
416
436
|
};
|
|
417
437
|
// @ts-ignore
|
|
@@ -3,11 +3,12 @@ import { DefaultOptionType } from 'rc-select/lib/Select';
|
|
|
3
3
|
import { Service } from 'ahooks/lib/useRequest/src/types';
|
|
4
4
|
export interface AddressProps {
|
|
5
5
|
getPopupContainer?: () => ReactNode;
|
|
6
|
+
className?: string;
|
|
6
7
|
isView?: boolean;
|
|
7
8
|
value?: string[];
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
hasDetail?: boolean;
|
|
10
|
-
tooltip?: boolean;
|
|
11
|
+
tooltip?: boolean | ReactNode;
|
|
11
12
|
detailMaxLength?: number;
|
|
12
13
|
fieldNames?: {
|
|
13
14
|
label: string;
|
|
@@ -20,7 +21,7 @@ export interface AddressProps {
|
|
|
20
21
|
defaultParams?: any;
|
|
21
22
|
parentKey?: string;
|
|
22
23
|
};
|
|
23
|
-
onChange?: (value: string[]) => void;
|
|
24
|
+
onChange?: (value: string[], selectedOptions?: any[]) => void;
|
|
24
25
|
transformResponse?: (data: any[]) => any[];
|
|
25
26
|
level?: number;
|
|
26
27
|
enumCode?: string;
|
|
@@ -12,7 +12,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
12
12
|
import "antd/es/form/style";
|
|
13
13
|
import _Form from "antd/es/form";
|
|
14
14
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
15
|
-
var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "isTooltip", "otherProps", "searchForm"],
|
|
15
|
+
var _excluded = ["value", "onChange", "disabled", "labelInValue", "fieldNames", "readOnly", "addonAfter", "configOption", "title", "onFormat", "showCodeName", "optionRender", "customRender", "style", "className", "beforeOpen", "isTooltip", "otherProps", "searchForm", "defaultOne"],
|
|
16
16
|
_excluded2 = ["onOk"],
|
|
17
17
|
_excluded3 = ["rowKey", "columns", "rowSelection"];
|
|
18
18
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -25,6 +25,7 @@ import { ProForm, ProDrawerForm, ProTable, useProConfig } from '../../../../inde
|
|
|
25
25
|
import Container from '../../Container';
|
|
26
26
|
import viewSvg from '../../../../assets/view.svg';
|
|
27
27
|
import useRequestList from './hooks/useRequestList';
|
|
28
|
+
import locale from '../../../../locale';
|
|
28
29
|
var ProModalSelect = function ProModalSelect(props, ref) {
|
|
29
30
|
var _formColumns$;
|
|
30
31
|
var value = props.value,
|
|
@@ -48,6 +49,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
48
49
|
isTooltip = props.isTooltip,
|
|
49
50
|
otherProps = props.otherProps,
|
|
50
51
|
searchForm = props.searchForm,
|
|
52
|
+
defaultOne = props.defaultOne,
|
|
51
53
|
restInputProps = _objectWithoutProperties(props, _excluded);
|
|
52
54
|
var contentForm = _Form.useFormInstance();
|
|
53
55
|
if (!configOption || Object.prototype.toString.call(configOption) !== '[object Object]') {
|
|
@@ -125,7 +127,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
125
127
|
transformResponse: transformResponse
|
|
126
128
|
}, _objectSpread({
|
|
127
129
|
manual: true,
|
|
128
|
-
ready: (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || visible
|
|
130
|
+
ready: (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || visible || defaultOne
|
|
129
131
|
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options)),
|
|
130
132
|
data = _useRequestList.data,
|
|
131
133
|
loading = _useRequestList.loading,
|
|
@@ -288,7 +290,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
288
290
|
_context2.next = 4;
|
|
289
291
|
break;
|
|
290
292
|
}
|
|
291
|
-
_message.error(
|
|
293
|
+
_message.error(locale.ProModalSelect.checkMsg);
|
|
292
294
|
return _context2.abrupt("return", false);
|
|
293
295
|
case 4:
|
|
294
296
|
_data = isMultiple ? selectedRows : selectedRows === null || selectedRows === void 0 ? void 0 : selectedRows[0];
|
|
@@ -410,14 +412,14 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
410
412
|
// 初始化回显,当传入initParams时,前端用来回险
|
|
411
413
|
var getInitValues = /*#__PURE__*/function () {
|
|
412
414
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
413
|
-
var _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _list, list, _res$data, _data2, nextSelectRowKeys;
|
|
415
|
+
var _contentForm$getField, _useRequest$options2, _useRequest$options3, queryBean, page, params, res, _list, list, _res$data, _data2, nextSelectRowKeys;
|
|
414
416
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
415
417
|
while (1) switch (_context4.prev = _context4.next) {
|
|
416
418
|
case 0:
|
|
417
419
|
if (typeof (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) === 'function') {
|
|
418
|
-
useRequest.initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm.getFieldsValue());
|
|
420
|
+
useRequest.initParams = useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams(value, contentForm === null || contentForm === void 0 ? void 0 : (_contentForm$getField = contentForm.getFieldsValue) === null || _contentForm$getField === void 0 ? void 0 : _contentForm$getField.call(contentForm));
|
|
419
421
|
}
|
|
420
|
-
if (!(useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams)) {
|
|
422
|
+
if (!((useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || defaultOne)) {
|
|
421
423
|
_context4.next = 13;
|
|
422
424
|
break;
|
|
423
425
|
}
|
|
@@ -431,7 +433,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
431
433
|
});
|
|
432
434
|
return _context4.abrupt("return");
|
|
433
435
|
case 5:
|
|
434
|
-
queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.defaultParams), useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams);
|
|
436
|
+
queryBean = _objectSpread(_objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options2 = useRequest.options) === null || _useRequest$options2 === void 0 ? void 0 : _useRequest$options2.defaultParams), (useRequest === null || useRequest === void 0 ? void 0 : useRequest.initParams) || {});
|
|
435
437
|
page = _objectSpread({
|
|
436
438
|
pageNum: 1,
|
|
437
439
|
pageSize: 10
|
|
@@ -474,6 +476,61 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
474
476
|
return _ref9.apply(this, arguments);
|
|
475
477
|
};
|
|
476
478
|
}();
|
|
479
|
+
// 初始化回显,当传入initParams时,前端用来回险
|
|
480
|
+
var getDefaultOneValues = /*#__PURE__*/function () {
|
|
481
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
482
|
+
var _useRequest$options4, _useRequest$options5;
|
|
483
|
+
var queryBean, page, params, res, _list2, list, _res$data2, _data3, nextSelectRowKeys;
|
|
484
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
485
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
486
|
+
case 0:
|
|
487
|
+
queryBean = _objectSpread({}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options4 = useRequest.options) === null || _useRequest$options4 === void 0 ? void 0 : _useRequest$options4.defaultParams);
|
|
488
|
+
page = _objectSpread({
|
|
489
|
+
pageNum: 1,
|
|
490
|
+
pageSize: 10
|
|
491
|
+
}, useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options5 = useRequest.options) === null || _useRequest$options5 === void 0 ? void 0 : _useRequest$options5.page);
|
|
492
|
+
params = withPagination ? _objectSpread(_objectSpread({}, page), {}, {
|
|
493
|
+
queryBean: queryBean !== null && queryBean !== void 0 ? queryBean : {}
|
|
494
|
+
}) : queryBean;
|
|
495
|
+
params = transformParams ? transformParams(params) : params;
|
|
496
|
+
_context5.next = 6;
|
|
497
|
+
return runAsync(params);
|
|
498
|
+
case 6:
|
|
499
|
+
res = _context5.sent;
|
|
500
|
+
if (res === null || res === void 0 ? void 0 : res.data) {
|
|
501
|
+
list = [];
|
|
502
|
+
if (transformResponse) {
|
|
503
|
+
list = transformResponse(res === null || res === void 0 ? void 0 : res.data);
|
|
504
|
+
} else {
|
|
505
|
+
list = withPagination ? res === null || res === void 0 ? void 0 : (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.list : res === null || res === void 0 ? void 0 : res.data;
|
|
506
|
+
}
|
|
507
|
+
_data3 = isMultiple ? list : (_list2 = list) === null || _list2 === void 0 ? void 0 : _list2[0];
|
|
508
|
+
nextSelectRowKeys = isMultiple ? value : [value];
|
|
509
|
+
if (labelInValue) {
|
|
510
|
+
onChange(_data3);
|
|
511
|
+
} else {
|
|
512
|
+
onChange(isMultiple ? _data3.map(function (item) {
|
|
513
|
+
return item[valueKey];
|
|
514
|
+
}) : _data3[valueKey]);
|
|
515
|
+
}
|
|
516
|
+
// 更新内部展示值
|
|
517
|
+
setState({
|
|
518
|
+
_value: _data3,
|
|
519
|
+
isInit: false,
|
|
520
|
+
selectedRows: list,
|
|
521
|
+
selectedRowKeys: nextSelectRowKeys
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
case 8:
|
|
525
|
+
case "end":
|
|
526
|
+
return _context5.stop();
|
|
527
|
+
}
|
|
528
|
+
}, _callee5);
|
|
529
|
+
}));
|
|
530
|
+
return function getDefaultOneValues() {
|
|
531
|
+
return _ref10.apply(this, arguments);
|
|
532
|
+
};
|
|
533
|
+
}();
|
|
477
534
|
useImperativeHandle(ref, function () {
|
|
478
535
|
return {
|
|
479
536
|
handleClick: handleClick,
|
|
@@ -505,8 +562,8 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
505
562
|
});
|
|
506
563
|
useEffect(function () {
|
|
507
564
|
if (onOff && !visible) {
|
|
508
|
-
var _useRequest$
|
|
509
|
-
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$
|
|
565
|
+
var _useRequest$options6;
|
|
566
|
+
if ((useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options6 = useRequest.options) === null || _useRequest$options6 === void 0 ? void 0 : _useRequest$options6.manual) !== true) {
|
|
510
567
|
onReset();
|
|
511
568
|
}
|
|
512
569
|
var nextState = {
|
|
@@ -538,11 +595,15 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
538
595
|
}, [value, visible, isInit]);
|
|
539
596
|
useEffect(function () {
|
|
540
597
|
if (!value) {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
598
|
+
if (defaultOne) {
|
|
599
|
+
getDefaultOneValues();
|
|
600
|
+
} else {
|
|
601
|
+
setState({
|
|
602
|
+
_value: undefined,
|
|
603
|
+
selectedRowKeys: [],
|
|
604
|
+
selectedRows: []
|
|
605
|
+
});
|
|
606
|
+
}
|
|
546
607
|
}
|
|
547
608
|
if (labelInValue && _value && !isEqual(value, _value)) {
|
|
548
609
|
setState({
|
|
@@ -593,7 +654,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
593
654
|
onChange: handleChangeValue,
|
|
594
655
|
disabled: disabled,
|
|
595
656
|
addonAfter: forceAddonAfterRender(),
|
|
596
|
-
placeholder:
|
|
657
|
+
placeholder: locale.ProModalSelect.select,
|
|
597
658
|
autoComplete: "off"
|
|
598
659
|
}, restInputProps)), _jsx(_Input, {
|
|
599
660
|
type: "hidden",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
> span {
|
|
24
24
|
position: relative;
|
|
25
|
-
font-size: var(--zaui-font-size
|
|
25
|
+
font-size: var(--zaui-font-size, 14px);
|
|
26
26
|
border: none;
|
|
27
27
|
border-radius: 50%;
|
|
28
28
|
}
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
&:hover {
|
|
58
58
|
.ant-input,
|
|
59
59
|
.ant-input-group-addon {
|
|
60
|
-
border-color:
|
|
60
|
+
border-color: @zaui-form-control-line;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.ant-input-group-addon {
|
|
76
|
-
padding: 0px var(--zaui-space-size-
|
|
76
|
+
padding: 0px var(--zaui-space-size-sm, 8px);
|
|
77
77
|
background-color: var(--zaui-base-bg, #ffffff);
|
|
78
78
|
cursor: pointer;
|
|
79
79
|
|
|
@@ -11,6 +11,7 @@ import { isEmpty } from 'lodash';
|
|
|
11
11
|
import classnames from 'classnames';
|
|
12
12
|
import { tools } from '@zat-design/utils';
|
|
13
13
|
import Container from '../../Container';
|
|
14
|
+
import locale from '../../../../locale';
|
|
14
15
|
var formatAmount = tools.formatAmount,
|
|
15
16
|
formatPercent = tools.formatPercent,
|
|
16
17
|
formatPerMill = tools.formatPerMill;
|
|
@@ -155,7 +156,7 @@ var ProNumberRange = function ProNumberRange(props) {
|
|
|
155
156
|
children: [_jsx(_InputNumber, _objectSpread(_objectSpread({
|
|
156
157
|
className: "range-left",
|
|
157
158
|
value: (value === null || value === void 0 ? void 0 : value[0]) || range[0],
|
|
158
|
-
placeholder: "
|
|
159
|
+
placeholder: "".concat(locale.ProForm.inputPlaceholder),
|
|
159
160
|
min: min,
|
|
160
161
|
max: (value === null || value === void 0 ? void 0 : value[1]) || max || range[1],
|
|
161
162
|
precision: precision,
|
|
@@ -174,7 +175,7 @@ var ProNumberRange = function ProNumberRange(props) {
|
|
|
174
175
|
}), _jsx(_InputNumber, _objectSpread(_objectSpread({
|
|
175
176
|
className: "range-right",
|
|
176
177
|
value: (value === null || value === void 0 ? void 0 : value[1]) || range[1],
|
|
177
|
-
placeholder: "
|
|
178
|
+
placeholder: "".concat(locale.ProForm.inputPlaceholder),
|
|
178
179
|
min: (value === null || value === void 0 ? void 0 : value[0]) || min || range[0],
|
|
179
180
|
max: max,
|
|
180
181
|
precision: precision,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RangePickerProps } from 'antd/es/date-picker';
|
|
3
3
|
import { Moment } from 'moment';
|
|
4
|
-
export type Props = Omit<RangePickerProps, 'value' | 'onChange' | 'format' | 'separator'> & {
|
|
4
|
+
export type Props = Omit<RangePickerProps, 'value' | 'onChange' | 'format' | 'separator' | 'mode'> & {
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
foreverText?: string;
|
|
7
7
|
foreverDate?: string;
|
|
@@ -15,6 +15,7 @@ import classNames from 'classnames';
|
|
|
15
15
|
import moment from 'moment';
|
|
16
16
|
import { useProConfig } from '../../../../ProConfigProvider';
|
|
17
17
|
import Container from '../../Container';
|
|
18
|
+
import locale from '../../../../locale';
|
|
18
19
|
var defaultPickerValue = [moment(), moment()];
|
|
19
20
|
var useControlled = function useControlled(props) {
|
|
20
21
|
var _useState = useState(),
|
|
@@ -42,7 +43,7 @@ var RangePicker = _DatePicker.RangePicker;
|
|
|
42
43
|
var ProRangeLimit = function ProRangeLimit(props) {
|
|
43
44
|
var disabled = props.disabled,
|
|
44
45
|
_props$foreverText = props.foreverText,
|
|
45
|
-
foreverText = _props$foreverText === void 0 ?
|
|
46
|
+
foreverText = _props$foreverText === void 0 ? locale.ProTimeLimit.foreverText : _props$foreverText,
|
|
46
47
|
_props$foreverDate = props.foreverDate,
|
|
47
48
|
foreverDate = _props$foreverDate === void 0 ? '9999-01-01' : _props$foreverDate,
|
|
48
49
|
_props$format = props.format,
|
|
@@ -122,12 +123,10 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
122
123
|
};
|
|
123
124
|
return _jsxs(_Input.Group, {
|
|
124
125
|
compact: true,
|
|
126
|
+
className: "pro-range-limit",
|
|
125
127
|
children: [_jsx(RangePicker, _objectSpread(_objectSpread(_objectSpread({
|
|
126
128
|
allowClear: true,
|
|
127
129
|
disabled: [disabled, disabled || _isForever],
|
|
128
|
-
style: {
|
|
129
|
-
width: 'calc(100% - 84px)'
|
|
130
|
-
},
|
|
131
130
|
defaultPickerValue: defaultPickerValue
|
|
132
131
|
}, initialConfig), omit(rest, ['placeholder', 'separator'])), {}, {
|
|
133
132
|
format: format,
|
|
@@ -135,9 +134,6 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
135
134
|
onChange: handleRangeChange
|
|
136
135
|
})), _jsx("div", {
|
|
137
136
|
className: className,
|
|
138
|
-
style: {
|
|
139
|
-
width: '84px'
|
|
140
|
-
},
|
|
141
137
|
children: _jsx(_Checkbox, {
|
|
142
138
|
checked: _isForever,
|
|
143
139
|
disabled: disabled,
|
|
@@ -2,10 +2,11 @@ import { DatePickerProps } from 'antd';
|
|
|
2
2
|
import { Moment } from 'moment';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ProFormOtherProps } from '../../../propsType';
|
|
5
|
+
import { Props as ProRangeLimitProps } from '../ProRangeLimit';
|
|
5
6
|
export type DateType = DatePickerProps['value'];
|
|
6
|
-
export
|
|
7
|
+
export type ProTimeLimitProps = DistributiveOmit<DatePickerProps, 'value' | 'onChange' | 'mode'> & {
|
|
7
8
|
value?: string;
|
|
8
|
-
onChange?: (value:
|
|
9
|
+
onChange?: (value: ProTimeLimitProps['value'] | null, valueData: Moment) => void;
|
|
9
10
|
disabled?: boolean;
|
|
10
11
|
foreverTime?: string;
|
|
11
12
|
foreverText?: string;
|
|
@@ -13,7 +14,11 @@ export interface Props<ValueType extends DateType | string | null = DateType> ex
|
|
|
13
14
|
format?: string;
|
|
14
15
|
valueType?: 'moment' | 'format' | 'ISO';
|
|
15
16
|
otherProps?: ProFormOtherProps;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
declare const
|
|
17
|
+
mode?: 'DatePicker';
|
|
18
|
+
};
|
|
19
|
+
export declare const ProTimeLimit: React.FC<ProTimeLimitProps>;
|
|
20
|
+
export type ProLimitProps = ProTimeLimitProps | (ProRangeLimitProps & {
|
|
21
|
+
mode: 'RangePicker';
|
|
22
|
+
});
|
|
23
|
+
declare const LimitPick: React.FC<ProLimitProps>;
|
|
19
24
|
export default LimitPick;
|
|
@@ -18,6 +18,7 @@ import { useProConfig } from '../../../../ProConfigProvider';
|
|
|
18
18
|
import Container from '../../Container';
|
|
19
19
|
import useControlled from './hooks/useControlled';
|
|
20
20
|
import ProRangeLimit from '../ProRangeLimit';
|
|
21
|
+
import locale from '../../../../locale';
|
|
21
22
|
// 永久有效默认值
|
|
22
23
|
export var ProTimeLimit = function ProTimeLimit(props) {
|
|
23
24
|
var _props$format = props.format,
|
|
@@ -25,7 +26,7 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
25
26
|
disabled = props.disabled,
|
|
26
27
|
foreverTime = props.foreverTime,
|
|
27
28
|
_props$foreverText = props.foreverText,
|
|
28
|
-
foreverText = _props$foreverText === void 0 ?
|
|
29
|
+
foreverText = _props$foreverText === void 0 ? locale.ProTimeLimit.foreverText : _props$foreverText,
|
|
29
30
|
_props$valueType = props.valueType,
|
|
30
31
|
valueType = _props$valueType === void 0 ? 'format' : _props$valueType,
|
|
31
32
|
otherProps = props.otherProps,
|
|
@@ -82,25 +83,17 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
82
83
|
});
|
|
83
84
|
return _jsxs(_Input.Group, {
|
|
84
85
|
compact: true,
|
|
86
|
+
className: "pro-time-limit",
|
|
85
87
|
children: [_jsx(_DatePicker, _objectSpread(_objectSpread(_objectSpread({
|
|
86
|
-
disabled: disabled || isForever
|
|
87
|
-
style: {
|
|
88
|
-
width: 'calc(100% - 84px)'
|
|
89
|
-
}
|
|
88
|
+
disabled: disabled || isForever
|
|
90
89
|
}, initialConfig), omit(rest, ['placeholder'])), {}, {
|
|
91
90
|
value: value,
|
|
92
91
|
onChange: onChange
|
|
93
92
|
})), _jsx("div", {
|
|
94
93
|
className: className,
|
|
95
|
-
style: {
|
|
96
|
-
width: '84px'
|
|
97
|
-
},
|
|
98
94
|
children: _jsx(_Checkbox, {
|
|
99
95
|
checked: isForever,
|
|
100
96
|
disabled: disabled,
|
|
101
|
-
style: {
|
|
102
|
-
width: '60px'
|
|
103
|
-
},
|
|
104
97
|
onChange: foreverChange,
|
|
105
98
|
children: foreverText
|
|
106
99
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.ant-form-item-has-error {
|
|
2
2
|
.ant-picker-status-error
|
|
3
3
|
~ .forever-checkbox:not(.ant-input-disabled):not(.ant-input-borderless).ant-input {
|
|
4
|
-
background:
|
|
4
|
+
background: @zaui-base-bg;
|
|
5
5
|
border-color: var(--ant-error-color);
|
|
6
6
|
}
|
|
7
7
|
.forever-checkbox:not(.ant-input-disabled):not(.ant-input-borderless).ant-input:focus {
|
|
@@ -11,3 +11,20 @@
|
|
|
11
11
|
box-shadow: 0 0 0 2px var(--ant-error-color-outline);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
span.ant-input-group-compact {
|
|
16
|
+
&.pro-time-limit,
|
|
17
|
+
&.pro-range-limit {
|
|
18
|
+
display: flex;
|
|
19
|
+
|
|
20
|
+
.ant-picker {
|
|
21
|
+
flex: 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.forever-checkbox {
|
|
25
|
+
flex: 0;
|
|
26
|
+
min-width: unset;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|