@zat-design/sisyphus-react 3.1.5 → 3.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +176 -251
- 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 +7 -8
- 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 +7 -8
- 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
|
@@ -14,11 +14,15 @@ declare function useAntdTable<I, R extends Record<string, any>, S extends Servic
|
|
|
14
14
|
getCheckboxProps: () => {
|
|
15
15
|
className: string;
|
|
16
16
|
};
|
|
17
|
-
selections: boolean | {
|
|
17
|
+
selections: boolean | ({
|
|
18
18
|
key: string;
|
|
19
19
|
text: string;
|
|
20
20
|
onSelect: (changeableRowKeys: Key[]) => void;
|
|
21
|
-
}
|
|
21
|
+
} | {
|
|
22
|
+
key: string;
|
|
23
|
+
text: any;
|
|
24
|
+
onSelect: () => Promise<void>;
|
|
25
|
+
})[];
|
|
22
26
|
};
|
|
23
27
|
searchValues: I;
|
|
24
28
|
allSelected: boolean;
|
|
@@ -56,11 +60,15 @@ declare function useAntdTable<I, R extends Record<string, any>, S extends Servic
|
|
|
56
60
|
getCheckboxProps: () => {
|
|
57
61
|
className: string;
|
|
58
62
|
};
|
|
59
|
-
selections: boolean | {
|
|
63
|
+
selections: boolean | ({
|
|
60
64
|
key: string;
|
|
61
65
|
text: string;
|
|
62
66
|
onSelect: (changeableRowKeys: Key[]) => void;
|
|
63
|
-
}
|
|
67
|
+
} | {
|
|
68
|
+
key: string;
|
|
69
|
+
text: any;
|
|
70
|
+
onSelect: () => Promise<void>;
|
|
71
|
+
})[];
|
|
64
72
|
};
|
|
65
73
|
pagination: {
|
|
66
74
|
current: number;
|
|
@@ -12,6 +12,7 @@ import { useRequest, useSetState, useDeepCompareEffect } from 'ahooks';
|
|
|
12
12
|
import { pickBy } from 'lodash';
|
|
13
13
|
import { defaultPage } from './index';
|
|
14
14
|
import { isListResult } from './utils';
|
|
15
|
+
import locale, { formatMessage } from '../locale';
|
|
15
16
|
var useDefaultOptions = function useDefaultOptions(options) {
|
|
16
17
|
var _useState = useState((options === null || options === void 0 ? void 0 : options.page) || defaultPage),
|
|
17
18
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -24,6 +25,7 @@ var useDefaultOptions = function useDefaultOptions(options) {
|
|
|
24
25
|
});
|
|
25
26
|
};
|
|
26
27
|
function useAntdTable(service, options, useRequestOptions) {
|
|
28
|
+
var _locale$ProTable2, _locale$ProTable3, _locale$ProTable4, _locale$ProTable5;
|
|
27
29
|
var _useSetState = useSetState({
|
|
28
30
|
data: [],
|
|
29
31
|
total: 0,
|
|
@@ -104,7 +106,8 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
|
104
106
|
_ref2$total = _ref2.total,
|
|
105
107
|
total = _ref2$total === void 0 ? 0 : _ref2$total;
|
|
106
108
|
if (list !== null && !Array.isArray(list)) {
|
|
107
|
-
|
|
109
|
+
var _locale$ProTable;
|
|
110
|
+
return _message.error(locale === null || locale === void 0 ? void 0 : (_locale$ProTable = locale.ProTable) === null || _locale$ProTable === void 0 ? void 0 : _locale$ProTable.transformResponseMsg);
|
|
108
111
|
}
|
|
109
112
|
setState({
|
|
110
113
|
total: total,
|
|
@@ -340,7 +343,9 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
|
340
343
|
},
|
|
341
344
|
selections: rowSelections ? [{
|
|
342
345
|
key: 'currentPage',
|
|
343
|
-
text:
|
|
346
|
+
text: formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTable2 = locale.ProTable) === null || _locale$ProTable2 === void 0 ? void 0 : _locale$ProTable2.selectCurPage, {
|
|
347
|
+
total: (data === null || data === void 0 ? void 0 : data.length) || 0
|
|
348
|
+
}),
|
|
344
349
|
onSelect: function onSelect(changeableRowKeys) {
|
|
345
350
|
setState({
|
|
346
351
|
allSelected: false,
|
|
@@ -350,7 +355,9 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
|
350
355
|
}
|
|
351
356
|
}, {
|
|
352
357
|
key: 'all',
|
|
353
|
-
text:
|
|
358
|
+
text: formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTable3 = locale.ProTable) === null || _locale$ProTable3 === void 0 ? void 0 : _locale$ProTable3.selectAll, {
|
|
359
|
+
total: total
|
|
360
|
+
}),
|
|
354
361
|
onSelect: function () {
|
|
355
362
|
var _onSelect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(changeableRowKeys) {
|
|
356
363
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -374,7 +381,7 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
|
374
381
|
}()
|
|
375
382
|
}, {
|
|
376
383
|
key: 'uncheckAll',
|
|
377
|
-
text:
|
|
384
|
+
text: locale === null || locale === void 0 ? void 0 : (_locale$ProTable4 = locale.ProTable) === null || _locale$ProTable4 === void 0 ? void 0 : _locale$ProTable4.deselect,
|
|
378
385
|
onSelect: function () {
|
|
379
386
|
var _onSelect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
380
387
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -398,7 +405,9 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
|
398
405
|
}()
|
|
399
406
|
}] : false
|
|
400
407
|
};
|
|
401
|
-
var selectedTip = allSelected || selectedRowKeys.length ?
|
|
408
|
+
var selectedTip = allSelected || selectedRowKeys.length ? formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTable5 = locale.ProTable) === null || _locale$ProTable5 === void 0 ? void 0 : _locale$ProTable5.selectAll, {
|
|
409
|
+
selectedNum: allSelected ? total : selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length
|
|
410
|
+
}) : null;
|
|
402
411
|
var pagination = {
|
|
403
412
|
current: page.pageNum,
|
|
404
413
|
pageSize: page.pageSize,
|
|
@@ -407,8 +416,11 @@ function useAntdTable(service, options, useRequestOptions) {
|
|
|
407
416
|
onPaginationChange: true,
|
|
408
417
|
total: total,
|
|
409
418
|
showTotal: function showTotal(total) {
|
|
419
|
+
var _locale$ProTable6;
|
|
410
420
|
if (!total) return;
|
|
411
|
-
return
|
|
421
|
+
return formatMessage(locale === null || locale === void 0 ? void 0 : (_locale$ProTable6 = locale.ProTable) === null || _locale$ProTable6 === void 0 ? void 0 : _locale$ProTable6.total, {
|
|
422
|
+
total: total
|
|
423
|
+
});
|
|
412
424
|
},
|
|
413
425
|
onShowSizeChange: handlePageChange,
|
|
414
426
|
onChange: handlePageChange
|
package/es/ProTable/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProTableColumn } from './propsType';
|
|
3
|
-
export declare const formatColumn: (column: ProTableColumn) => void;
|
|
3
|
+
export declare const formatColumn: (column: ProTableColumn, originalDataSource: any[]) => void;
|
|
4
4
|
export declare const getColumnDataIndex: (dataIndex: string | string[]) => string;
|
|
5
5
|
/**
|
|
6
6
|
* 查找最近的父级className
|
package/es/ProTable/utils.js
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import "antd/es/space/style";
|
|
2
2
|
import _Space from "antd/es/space";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
4
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
5
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
5
6
|
import { isValidElement } from 'react';
|
|
6
7
|
import moment from 'moment';
|
|
7
|
-
import { isFunction, isString } from 'lodash';
|
|
8
|
+
import { get, isEqual, isFunction, isString } from 'lodash';
|
|
8
9
|
import { tools } from '@zat-design/utils';
|
|
10
|
+
import classnames from 'classnames';
|
|
9
11
|
import getEnumLabel from '../ProEnum/utils/getEnumLabel';
|
|
10
12
|
import TooltipTitle from './components/TooltipTitle';
|
|
11
13
|
import RenderColumn from './components/RenderColumn';
|
|
14
|
+
import ProForm from '../ProForm';
|
|
12
15
|
/**
|
|
13
16
|
* 获取小数点后的位数
|
|
14
17
|
* @param num 数字
|
|
15
18
|
* @returns 位数
|
|
16
19
|
*/
|
|
17
|
-
var getDecimalDigits = function getDecimalDigits(
|
|
18
|
-
var
|
|
20
|
+
var getDecimalDigits = function getDecimalDigits() {
|
|
21
|
+
var num = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
22
|
+
var match = Number(num).toString().match(/\.(\d+)/);
|
|
19
23
|
return match ? match[1].length : 0;
|
|
20
24
|
};
|
|
21
|
-
export var formatColumn = function formatColumn(column) {
|
|
25
|
+
export var formatColumn = function formatColumn(column, originalDataSource) {
|
|
22
26
|
var title = column.title,
|
|
23
27
|
valueType = column.valueType,
|
|
24
28
|
_column$format = column.format,
|
|
@@ -32,16 +36,10 @@ export var formatColumn = function formatColumn(column) {
|
|
|
32
36
|
tooltip = column.tooltip,
|
|
33
37
|
transform = column.transform,
|
|
34
38
|
prefix = column.prefix,
|
|
35
|
-
suffix = column.suffix
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (tooltip) {
|
|
40
|
-
column.title = _jsx(TooltipTitle, {
|
|
41
|
-
title: title,
|
|
42
|
-
tooltip: tooltip
|
|
43
|
-
});
|
|
44
|
-
}
|
|
39
|
+
suffix = column.suffix,
|
|
40
|
+
dataIndex = column.dataIndex,
|
|
41
|
+
_column$originalTip = column.originalTip,
|
|
42
|
+
originalTip = _column$originalTip === void 0 ? true : _column$originalTip;
|
|
45
43
|
// 前缀处理
|
|
46
44
|
var prefixNode = function prefixNode(value, record, index) {
|
|
47
45
|
if (!prefix) {
|
|
@@ -66,211 +64,270 @@ export var formatColumn = function formatColumn(column) {
|
|
|
66
64
|
return suffix(value, record, index);
|
|
67
65
|
}
|
|
68
66
|
};
|
|
67
|
+
if (column === null || column === void 0 ? void 0 : column.render) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (tooltip) {
|
|
71
|
+
column.title = _jsx(TooltipTitle, {
|
|
72
|
+
title: title,
|
|
73
|
+
tooltip: tooltip
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (ellipsis) {
|
|
77
|
+
column.ellipsis = false;
|
|
78
|
+
}
|
|
69
79
|
var valueTypePrecision = precision;
|
|
70
80
|
if (['percentage', 'permillage', 'thousandth', 'thousandthCNY'].includes(valueType)) {
|
|
71
81
|
valueTypePrecision = precision || 2;
|
|
72
82
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return renderValue;
|
|
85
|
-
}
|
|
86
|
-
return renderValue.toFixed(valueTypePrecision);
|
|
87
|
-
};
|
|
88
|
-
break;
|
|
89
|
-
case 'permillage':
|
|
90
|
-
// 千分比
|
|
91
|
-
column.render = function (value) {
|
|
92
|
-
if (!value && value !== 0) {
|
|
93
|
-
return '-';
|
|
94
|
-
}
|
|
95
|
-
var renderValue = tools.calc(Number(value), '*', 1000);
|
|
96
|
-
// 获取真实数据的小数位数
|
|
97
|
-
var decimalDigits = getDecimalDigits(value);
|
|
98
|
-
if (decimalDigits > valueTypePrecision) {
|
|
99
|
-
return renderValue;
|
|
100
|
-
}
|
|
101
|
-
return renderValue.toFixed(valueTypePrecision);
|
|
102
|
-
};
|
|
103
|
-
break;
|
|
104
|
-
case 'thousandth':
|
|
105
|
-
// 千分位
|
|
106
|
-
column.render = function (value, record, index) {
|
|
107
|
-
if (!value && value !== 0) {
|
|
108
|
-
return '-';
|
|
109
|
-
}
|
|
110
|
-
if (valueTypePrecision) {
|
|
111
|
-
return _jsxs(_Space, {
|
|
112
|
-
size: 8,
|
|
113
|
-
children: [prefixNode(value, record, index), "".concat(Number(value).toFixed(valueTypePrecision)).replace(/\B(?=(\d{3})+(?!\d))/g, ','), suffixNode(value, record, index)]
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
return _jsxs(_Space, {
|
|
117
|
-
size: 8,
|
|
118
|
-
children: [prefixNode(value, record, index), "".concat(value).replace(/\B(?=(\d{3})+(?!\d))/g, ','), suffixNode(value, record, index)]
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
break;
|
|
122
|
-
case 'thousandthCNY':
|
|
123
|
-
// 千分位
|
|
124
|
-
column.render = function (value, record, index) {
|
|
125
|
-
if (!value && value !== 0) {
|
|
126
|
-
return '-';
|
|
127
|
-
}
|
|
128
|
-
if (valueTypePrecision) {
|
|
129
|
-
return _jsxs(_Space, {
|
|
130
|
-
size: 8,
|
|
131
|
-
children: [prefixNode(value, record, index), "".concat(Number(value).toFixed(valueTypePrecision), "\n ").replace(/\B(?=(\d{3})+(?!\d))/g, ','), suffixNode(value, record, index)]
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
return _jsxs(_Space, {
|
|
135
|
-
size: 8,
|
|
136
|
-
children: [prefixNode(value, record, index), "".concat(prefixNode(value, record, index), " ").concat(value).replace(/\B(?=(\d{3})+(?!\d))/g, ','), suffixNode(value, record, index)]
|
|
137
|
-
});
|
|
138
|
-
};
|
|
139
|
-
break;
|
|
140
|
-
case 'datePicker':
|
|
141
|
-
// 日期
|
|
142
|
-
column.render = function (value, record, index) {
|
|
143
|
-
var _moment;
|
|
144
|
-
if (!value) {
|
|
145
|
-
return '-';
|
|
146
|
-
}
|
|
147
|
-
return _jsxs(_Space, {
|
|
148
|
-
size: 8,
|
|
149
|
-
children: [prefixNode(value, record, index), (_moment = moment(value)) === null || _moment === void 0 ? void 0 : _moment.format(format), suffixNode(value, record, index)]
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
break;
|
|
153
|
-
case 'date':
|
|
154
|
-
// 日期:YYYY-MM-DD
|
|
155
|
-
column.render = function (value, record, index) {
|
|
156
|
-
var _moment2;
|
|
157
|
-
if (!value) {
|
|
158
|
-
return '-';
|
|
159
|
-
}
|
|
160
|
-
return _jsxs(_Space, {
|
|
161
|
-
size: 8,
|
|
162
|
-
children: [prefixNode(value, record, index), (_moment2 = moment(value)) === null || _moment2 === void 0 ? void 0 : _moment2.format('YYYY-MM-DD'), suffixNode(value, record, index)]
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
|
-
break;
|
|
166
|
-
case 'dateTime':
|
|
167
|
-
// 日期:YYYY-MM-DD HH:mm:ss
|
|
168
|
-
column.render = function (value, record, index) {
|
|
169
|
-
var _moment3;
|
|
170
|
-
if (!value) {
|
|
171
|
-
return '-';
|
|
172
|
-
}
|
|
173
|
-
return _jsxs(_Space, {
|
|
174
|
-
size: 8,
|
|
175
|
-
children: [prefixNode(value, record, index), (_moment3 = moment(value)) === null || _moment3 === void 0 ? void 0 : _moment3.format('YYYY-MM-DD HH:mm:ss'), suffixNode(value, record, index)]
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
break;
|
|
179
|
-
case 'dateStartTime':
|
|
180
|
-
// 日期:YYYY-MM-DD 00:00:00
|
|
181
|
-
column.render = function (value, record, index) {
|
|
182
|
-
var _moment4;
|
|
183
|
-
if (!value) {
|
|
184
|
-
return '-';
|
|
185
|
-
}
|
|
186
|
-
return _jsxs(_Space, {
|
|
187
|
-
size: 8,
|
|
188
|
-
children: [prefixNode(value, record, index), "".concat((_moment4 = moment(value)) === null || _moment4 === void 0 ? void 0 : _moment4.format('YYYY-MM-DD'), " 00:00:00"), suffixNode(value, record, index)]
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
break;
|
|
192
|
-
case 'dateEndTime':
|
|
193
|
-
// 日期:YYYY-MM-DD 23:59:59
|
|
194
|
-
column.render = function (value, record, index) {
|
|
195
|
-
var _moment5;
|
|
196
|
-
if (!value) {
|
|
197
|
-
return '-';
|
|
198
|
-
}
|
|
199
|
-
return _jsxs(_Space, {
|
|
200
|
-
size: 8,
|
|
201
|
-
children: [prefixNode(value, record, index), "".concat((_moment5 = moment(value)) === null || _moment5 === void 0 ? void 0 : _moment5.format('YYYY-MM-DD'), " 23:59:59"), suffixNode(value, record, index)]
|
|
202
|
-
});
|
|
203
|
-
};
|
|
204
|
-
break;
|
|
205
|
-
case 'dateStartEndTime':
|
|
206
|
-
// 日期:YYYY-MM-DD 00:00:00~YYYY-MM-DD 23:59:59
|
|
207
|
-
column.render = function (value, record, index) {
|
|
208
|
-
var _moment6, _moment7;
|
|
209
|
-
if (!Array.isArray(value)) {
|
|
210
|
-
return '-';
|
|
211
|
-
}
|
|
212
|
-
return _jsxs(_Space, {
|
|
213
|
-
size: 8,
|
|
214
|
-
children: [prefixNode(value, record, index), "".concat((_moment6 = moment(value === null || value === void 0 ? void 0 : value[0])) === null || _moment6 === void 0 ? void 0 : _moment6.format('YYYY-MM-DD'), " 00:00:00~").concat((_moment7 = moment(value === null || value === void 0 ? void 0 : value[1])) === null || _moment7 === void 0 ? void 0 : _moment7.format('YYYY-MM-DD'), " 23:59:59"), suffixNode(value, record, index)]
|
|
215
|
-
});
|
|
216
|
-
};
|
|
217
|
-
break;
|
|
218
|
-
case 'enumName':
|
|
219
|
-
// 枚举-展示name
|
|
220
|
-
column.render = function (value, record, index) {
|
|
221
|
-
return _jsxs(_Space, {
|
|
222
|
-
size: 8,
|
|
223
|
-
children: [prefixNode(value, record, index), getEnumLabel(typeof code === 'function' ? code() : code, value), suffixNode(value, record, index)]
|
|
224
|
-
});
|
|
225
|
-
};
|
|
226
|
-
break;
|
|
227
|
-
case 'enumCodeName':
|
|
228
|
-
// 枚举-展示code-name
|
|
229
|
-
column.render = function (value, record, index) {
|
|
230
|
-
return _jsxs(_Space, {
|
|
231
|
-
size: 8,
|
|
232
|
-
children: [prefixNode(value, record, index), getEnumLabel(typeof code === 'function' ? code() : code, value, true), suffixNode(value, record, index)]
|
|
233
|
-
});
|
|
234
|
-
};
|
|
235
|
-
break;
|
|
236
|
-
default:
|
|
237
|
-
if (precision) {
|
|
238
|
-
column.render = function (value, record, index) {
|
|
239
|
-
return _jsxs(_Space, {
|
|
240
|
-
size: 8,
|
|
241
|
-
children: [prefixNode(value, record, index), typeof value === 'number' ? value.toFixed(precision) : value, suffixNode(value, record, index)]
|
|
242
|
-
});
|
|
243
|
-
};
|
|
83
|
+
// 百分比、千分比
|
|
84
|
+
if (['percentage', 'permillage'].includes(valueType)) {
|
|
85
|
+
column.render = function (value, record, index) {
|
|
86
|
+
var multiple = valueType === 'percentage' ? 100 : 1000;
|
|
87
|
+
var realValue = tools.calc(Number(value), '*', multiple);
|
|
88
|
+
var renderValue = getDecimalDigits(value) > valueTypePrecision ? realValue : realValue.toFixed(valueTypePrecision);
|
|
89
|
+
var originalValue = get(originalDataSource, Array.isArray(dataIndex) ? [index].concat(_toConsumableArray(dataIndex)) : [index, dataIndex]);
|
|
90
|
+
var originalRealValue = tools.calc(Number(originalValue || null), '*', multiple);
|
|
91
|
+
var originalRenderValue = getDecimalDigits(originalValue) > valueTypePrecision ? originalRealValue : originalRealValue.toFixed(valueTypePrecision);
|
|
92
|
+
if (!originalValue && originalValue !== 0) {
|
|
93
|
+
originalRenderValue = '-';
|
|
244
94
|
}
|
|
245
|
-
if (
|
|
246
|
-
|
|
247
|
-
return value ? _jsxs(_Space, {
|
|
248
|
-
size: 8,
|
|
249
|
-
children: [prefixNode(value, record, index), value, suffixNode(value, record, index)]
|
|
250
|
-
}) : '-';
|
|
251
|
-
};
|
|
95
|
+
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
96
|
+
return '-';
|
|
252
97
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
98
|
+
return _jsx(RenderColumn, {
|
|
99
|
+
valueType: valueType,
|
|
100
|
+
originalValue: !originalDataSource || renderValue === originalRenderValue ? undefined : originalRenderValue,
|
|
101
|
+
ellipsis: ellipsis,
|
|
102
|
+
width: width,
|
|
103
|
+
node: renderValue,
|
|
104
|
+
value: value,
|
|
105
|
+
currentValue: renderValue,
|
|
106
|
+
originalTip: originalTip
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
// 千分位, 千分位带CNY前缀
|
|
110
|
+
} else if (['thousandth', 'thousandthCNY'].includes(valueType)) {
|
|
111
|
+
column.render = function (value, record, index) {
|
|
112
|
+
var valueStr = valueTypePrecision ? "".concat(Number(value).toFixed(valueTypePrecision)) : "".concat(value);
|
|
113
|
+
var renderValue = valueStr.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
114
|
+
var originalValue = get(originalDataSource, Array.isArray(dataIndex) ? [index].concat(_toConsumableArray(dataIndex)) : [index, dataIndex]);
|
|
115
|
+
var originalRealValue = valueTypePrecision ? "".concat(Number(originalValue).toFixed(valueTypePrecision)) : "".concat(originalValue);
|
|
116
|
+
var originalRenderValue = originalRealValue.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
117
|
+
if (!originalValue && originalValue !== 0) {
|
|
118
|
+
originalRenderValue = '-';
|
|
119
|
+
}
|
|
120
|
+
var node = _jsxs(_Space, {
|
|
121
|
+
size: 8,
|
|
122
|
+
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
123
|
+
});
|
|
124
|
+
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
125
|
+
return '-';
|
|
126
|
+
}
|
|
127
|
+
return _jsx(RenderColumn, {
|
|
128
|
+
valueType: valueType,
|
|
129
|
+
originalValue: !originalDataSource || renderValue === originalRenderValue ? undefined : originalRenderValue,
|
|
130
|
+
ellipsis: ellipsis,
|
|
131
|
+
width: width,
|
|
132
|
+
node: node,
|
|
133
|
+
value: value,
|
|
134
|
+
currentValue: renderValue,
|
|
135
|
+
originalTip: originalTip
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
} else if (['datePicker', 'date', 'dateTime', 'dateStartTime', 'dateEndTime', 'dateStartEndTime'].includes(valueType)) {
|
|
139
|
+
column.render = function (value, record, index) {
|
|
140
|
+
var _moment, _moment2, _moment3, _moment4, _moment5, _moment6, _moment7, _moment8, _moment9, _moment10, _moment11, _moment12, _moment13, _moment14;
|
|
141
|
+
var renderValue = (_moment = moment(value)) === null || _moment === void 0 ? void 0 : _moment.format(format);
|
|
142
|
+
var originalValue = get(originalDataSource, Array.isArray(dataIndex) ? [index].concat(_toConsumableArray(dataIndex)) : [index, dataIndex]);
|
|
143
|
+
var originalRenderValue = (_moment2 = moment(originalValue)) === null || _moment2 === void 0 ? void 0 : _moment2.format(format);
|
|
144
|
+
switch (valueType) {
|
|
145
|
+
case 'date':
|
|
146
|
+
renderValue = (_moment3 = moment(value)) === null || _moment3 === void 0 ? void 0 : _moment3.format('YYYY-MM-DD');
|
|
147
|
+
originalRenderValue = (_moment4 = moment(originalValue)) === null || _moment4 === void 0 ? void 0 : _moment4.format('YYYY-MM-DD');
|
|
148
|
+
break;
|
|
149
|
+
case 'dateTime':
|
|
150
|
+
renderValue = (_moment5 = moment(value)) === null || _moment5 === void 0 ? void 0 : _moment5.format('YYYY-MM-DD HH:mm:ss');
|
|
151
|
+
originalRenderValue = (_moment6 = moment(originalValue)) === null || _moment6 === void 0 ? void 0 : _moment6.format('YYYY-MM-DD HH:mm:ss');
|
|
152
|
+
break;
|
|
153
|
+
case 'dateStartTime':
|
|
154
|
+
renderValue = "".concat((_moment7 = moment(value)) === null || _moment7 === void 0 ? void 0 : _moment7.format('YYYY-MM-DD'), " 00:00:00");
|
|
155
|
+
originalRenderValue = "".concat((_moment8 = moment(originalValue)) === null || _moment8 === void 0 ? void 0 : _moment8.format('YYYY-MM-DD'), " 00:00:00");
|
|
156
|
+
break;
|
|
157
|
+
case 'dateEndTime':
|
|
158
|
+
renderValue = "".concat((_moment9 = moment(value)) === null || _moment9 === void 0 ? void 0 : _moment9.format('YYYY-MM-DD'), " 23:59:59");
|
|
159
|
+
originalRenderValue = "".concat((_moment10 = moment(originalValue)) === null || _moment10 === void 0 ? void 0 : _moment10.format('YYYY-MM-DD'), " 23:59:59");
|
|
160
|
+
break;
|
|
161
|
+
case 'dateStartEndTime':
|
|
162
|
+
renderValue = "".concat((_moment11 = moment(value === null || value === void 0 ? void 0 : value[0])) === null || _moment11 === void 0 ? void 0 : _moment11.format('YYYY-MM-DD'), " 00:00:00~").concat((_moment12 = moment(value === null || value === void 0 ? void 0 : value[1])) === null || _moment12 === void 0 ? void 0 : _moment12.format('YYYY-MM-DD'), " 23:59:59");
|
|
163
|
+
originalRenderValue = "".concat((_moment13 = moment(originalValue === null || originalValue === void 0 ? void 0 : originalValue[0])) === null || _moment13 === void 0 ? void 0 : _moment13.format('YYYY-MM-DD'), " 00:00:00~").concat((_moment14 = moment(originalValue === null || originalValue === void 0 ? void 0 : originalValue[1])) === null || _moment14 === void 0 ? void 0 : _moment14.format('YYYY-MM-DD'), " 23:59:59");
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
if (!value) {
|
|
167
|
+
renderValue = '-';
|
|
168
|
+
}
|
|
169
|
+
if (!originalValue) {
|
|
170
|
+
originalRenderValue = '-';
|
|
171
|
+
}
|
|
172
|
+
var node = _jsxs(_Space, {
|
|
173
|
+
size: 8,
|
|
174
|
+
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
175
|
+
});
|
|
176
|
+
if (!value && renderValue === originalRenderValue) {
|
|
177
|
+
return '-';
|
|
178
|
+
}
|
|
179
|
+
return _jsx(RenderColumn, {
|
|
180
|
+
valueType: valueType,
|
|
181
|
+
originalValue: !originalDataSource || renderValue === originalRenderValue ? undefined : originalRenderValue,
|
|
182
|
+
ellipsis: ellipsis,
|
|
183
|
+
width: width,
|
|
184
|
+
node: node,
|
|
185
|
+
value: value,
|
|
186
|
+
currentValue: renderValue,
|
|
187
|
+
originalTip: originalTip
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
} else if (['enumName', 'enumCodeName'].includes(valueType)) {
|
|
191
|
+
column.render = function (value, record, index) {
|
|
192
|
+
var realCode = typeof code === 'function' ? code() : code;
|
|
193
|
+
var renderValue = getEnumLabel(realCode, value, valueType === 'enumCodeName');
|
|
194
|
+
var originalValue = get(originalDataSource, Array.isArray(dataIndex) ? [index].concat(_toConsumableArray(dataIndex)) : [index, dataIndex]);
|
|
195
|
+
var originalRenderValue = getEnumLabel(realCode, originalValue, valueType === 'enumCodeName');
|
|
196
|
+
var node = _jsxs(_Space, {
|
|
197
|
+
size: 8,
|
|
198
|
+
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
199
|
+
});
|
|
200
|
+
return _jsx(RenderColumn, {
|
|
201
|
+
valueType: valueType,
|
|
202
|
+
originalValue: !originalDataSource || value === originalValue ? undefined : originalRenderValue,
|
|
203
|
+
ellipsis: ellipsis,
|
|
204
|
+
width: width,
|
|
205
|
+
node: node,
|
|
206
|
+
value: value,
|
|
207
|
+
currentValue: renderValue,
|
|
208
|
+
originalTip: originalTip
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
} else if (precision || prefix || suffix) {
|
|
212
|
+
column.render = function (value, record, index) {
|
|
213
|
+
var renderValue = value === 'number' ? value.toFixed(precision) : value;
|
|
214
|
+
var originalValue = get(originalDataSource, Array.isArray(dataIndex) ? [index].concat(_toConsumableArray(dataIndex)) : [index, dataIndex]);
|
|
215
|
+
var originalRenderValue = originalValue === 'number' ? originalValue.toFixed(precision) : originalValue;
|
|
216
|
+
var node = _jsxs(_Space, {
|
|
217
|
+
size: 8,
|
|
218
|
+
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
219
|
+
});
|
|
220
|
+
if (!originalValue && originalValue !== 0) {
|
|
221
|
+
originalRenderValue = '-';
|
|
222
|
+
}
|
|
223
|
+
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
224
|
+
return '-';
|
|
225
|
+
}
|
|
226
|
+
return _jsx(RenderColumn, {
|
|
227
|
+
valueType: valueType,
|
|
228
|
+
originalValue: !originalDataSource || renderValue === originalRenderValue ? undefined : originalRenderValue,
|
|
229
|
+
ellipsis: ellipsis,
|
|
230
|
+
width: width,
|
|
231
|
+
node: node,
|
|
232
|
+
value: value,
|
|
233
|
+
currentValue: renderValue,
|
|
234
|
+
originalTip: originalTip
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
} else if (valueType === 'address') {
|
|
238
|
+
column.render = function (value, record, index) {
|
|
239
|
+
var _realValue$filter;
|
|
240
|
+
var realValue = transform ? transform(value, record) : value;
|
|
241
|
+
var originalValue = get(originalDataSource, Array.isArray(dataIndex) ? [index].concat(_toConsumableArray(dataIndex)) : [index, dataIndex]);
|
|
242
|
+
var originalRealValue = transform ? transform(originalValue, record) : originalValue;
|
|
243
|
+
var isEmpty = !realValue || Array.isArray(realValue) && (realValue === null || realValue === void 0 ? void 0 : (_realValue$filter = realValue.filter(function (item) {
|
|
244
|
+
return !!item;
|
|
245
|
+
})) === null || _realValue$filter === void 0 ? void 0 : _realValue$filter.length) === 0;
|
|
246
|
+
if (isEqual(value, originalValue) && isEmpty) {
|
|
247
|
+
return '-';
|
|
248
|
+
}
|
|
249
|
+
var className = classnames({
|
|
250
|
+
'varied-cell': originalDataSource && !isEqual(value, originalValue),
|
|
251
|
+
'empty-cell': isEmpty
|
|
252
|
+
});
|
|
253
|
+
var renderValue = _jsx(ProForm.ProAddressBar, {
|
|
254
|
+
isView: true,
|
|
255
|
+
code: code,
|
|
256
|
+
value: realValue
|
|
257
|
+
});
|
|
258
|
+
var originalRenderValue = _jsx(ProForm.ProAddressBar, {
|
|
259
|
+
isView: true,
|
|
260
|
+
code: code,
|
|
261
|
+
value: originalRealValue
|
|
262
|
+
});
|
|
263
|
+
return _jsx(ProForm.ProAddressBar, {
|
|
264
|
+
className: className,
|
|
265
|
+
isView: true,
|
|
266
|
+
code: code,
|
|
267
|
+
value: realValue,
|
|
268
|
+
tooltip: originalDataSource && !isEqual(value, originalValue) ? _jsxs(_Fragment, {
|
|
269
|
+
children: ["\u521D\u59CB\u503C\uFF1A", originalRenderValue, _jsx("br", {}), ellipsis ? _jsxs(_Fragment, {
|
|
270
|
+
children: ["\u5F53\u524D\u503C\uFF1A", renderValue]
|
|
271
|
+
}) : undefined]
|
|
272
|
+
}) : ellipsis
|
|
273
|
+
});
|
|
274
|
+
};
|
|
275
|
+
} else if (copyable) {
|
|
259
276
|
column.render = function (value, record, index) {
|
|
260
277
|
return _jsxs(_Space, {
|
|
261
278
|
size: 8,
|
|
262
279
|
children: [prefixNode(value, record, index), _jsx(RenderColumn, {
|
|
263
280
|
valueType: valueType,
|
|
264
|
-
code: code,
|
|
265
281
|
copyable: copyable,
|
|
266
282
|
ellipsis: ellipsis,
|
|
267
283
|
width: width,
|
|
268
|
-
|
|
284
|
+
node: value,
|
|
285
|
+
value: value,
|
|
286
|
+
currentValue: value
|
|
287
|
+
}), suffixNode(value, record, index)]
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
} else if (ellipsis) {
|
|
291
|
+
column.render = function (value, record, index) {
|
|
292
|
+
var originalValue = get(originalDataSource, Array.isArray(dataIndex) ? [index].concat(_toConsumableArray(dataIndex)) : [index, dataIndex]);
|
|
293
|
+
if (!value && value !== 0 && value === originalValue) {
|
|
294
|
+
return '-';
|
|
295
|
+
}
|
|
296
|
+
return _jsxs(_Space, {
|
|
297
|
+
size: 8,
|
|
298
|
+
children: [prefixNode(value, record, index), _jsx(RenderColumn, {
|
|
299
|
+
valueType: valueType,
|
|
300
|
+
originalValue: !originalDataSource || value === originalValue ? undefined : originalValue || '-',
|
|
301
|
+
ellipsis: ellipsis,
|
|
302
|
+
width: width,
|
|
303
|
+
node: value,
|
|
269
304
|
value: value,
|
|
270
|
-
|
|
305
|
+
currentValue: value || '-',
|
|
306
|
+
originalTip: originalTip
|
|
271
307
|
}), suffixNode(value, record, index)]
|
|
272
308
|
});
|
|
273
309
|
};
|
|
310
|
+
} else {
|
|
311
|
+
column.render = function (value, record, index) {
|
|
312
|
+
var originalValue = get(originalDataSource, Array.isArray(dataIndex) ? [index].concat(_toConsumableArray(dataIndex)) : [index, dataIndex]);
|
|
313
|
+
var node = _jsxs(_Space, {
|
|
314
|
+
size: 8,
|
|
315
|
+
children: [prefixNode(value, record, index), value, suffixNode(value, record, index)]
|
|
316
|
+
});
|
|
317
|
+
if (!value && value !== 0 && value === originalValue) {
|
|
318
|
+
return '-';
|
|
319
|
+
}
|
|
320
|
+
return _jsx(RenderColumn, {
|
|
321
|
+
valueType: valueType,
|
|
322
|
+
originalValue: !originalDataSource || value === originalValue ? undefined : originalValue || '-',
|
|
323
|
+
ellipsis: ellipsis,
|
|
324
|
+
width: width,
|
|
325
|
+
node: node,
|
|
326
|
+
value: value,
|
|
327
|
+
currentValue: value || '-',
|
|
328
|
+
originalTip: originalTip
|
|
329
|
+
});
|
|
330
|
+
};
|
|
274
331
|
}
|
|
275
332
|
};
|
|
276
333
|
export var getColumnDataIndex = function getColumnDataIndex(dataIndex) {
|