@vtx/components 4.0.0-beta.9 → 4.0.0-beta.90
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/README.md +19 -19
- package/es/index.js +3 -0
- package/es/utils/components/LabelIconTip/index.js +7 -7
- package/es/utils/conversionMomentValue/index.js +25 -25
- package/es/utils/filterSpecialCharacters.js +6 -6
- package/es/utils/genCopyable/index.js +6 -6
- package/es/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/es/utils/hooks/useDebounceFn/index.js +4 -4
- package/es/utils/hooks/useDebounceValue/index.js +6 -6
- package/es/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/es/utils/hooks/useLatest/index.js +2 -2
- package/es/utils/hooks/useRefCallback/index.js +5 -5
- package/es/utils/index.js +1 -2
- package/es/utils/isBrowser/index.js +7 -7
- package/es/utils/isUrl/index.js +4 -4
- package/es/utils/merge/index.js +4 -4
- package/es/utils/nanoid/index.js +4 -4
- package/es/utils/omitBoolean/index.js +4 -4
- package/es/utils/parseValueToMoment/index.js +4 -4
- package/es/utils/proFieldParsingText/index.js +10 -10
- package/es/utils/transformKeySubmitValue/index.js +57 -57
- package/es/utils/useEditableArray/index.js +46 -46
- package/es/utils/useEditableMap/index.js +22 -22
- package/es/utils/useMediaQuery/index.js +5 -5
- package/es/vtx-combogrid/Combogrid.js +5 -4
- package/es/vtx-combogrid/index.js +7 -4
- package/es/vtx-datagrid/Store/Provide.js +109 -140
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/es/vtx-datagrid/ToolBar/index.js +2 -1
- package/es/vtx-datagrid/ToolBar/style.js +6 -3
- package/es/vtx-datagrid/columnState.js +91 -0
- package/es/vtx-datagrid/index.js +134 -37
- package/es/vtx-datagrid/mergeComponents.js +15 -0
- package/es/vtx-datagrid/renderColumnButtons.js +30 -11
- package/es/vtx-datagrid/style/index.js +108 -18
- package/es/vtx-datagrid/style/index.less +242 -242
- package/es/vtx-date-picker/QdatePicker.js +1 -1
- package/es/vtx-date-picker/style/index.less +39 -39
- package/es/vtx-descriptions/Descriptions.js +29 -0
- package/es/vtx-descriptions/index.js +3 -0
- package/es/vtx-descriptions/style/index.js +19 -0
- package/es/vtx-ellipsis-text/index.js +2 -2
- package/es/vtx-ellipsis-text/style/index.js +3 -1
- package/es/vtx-export/index.js +33 -38
- package/es/vtx-export-async/History.js +15 -7
- package/es/vtx-export-async/index.js +18 -8
- package/es/vtx-export-async/util.js +16 -5
- package/es/vtx-form-layout/FormItem.js +16 -16
- package/es/vtx-form-layout/style/index.js +6 -4
- package/es/vtx-icon/index.js +54 -45
- package/es/vtx-icon/index.js1 +90 -0
- package/es/vtx-image/style/index.js +0 -1
- package/es/vtx-import/index.js +143 -42
- package/es/vtx-import/result.js +28 -26
- package/es/vtx-import/style/index.js +16 -1
- package/es/vtx-import2/Content.js +2 -1
- package/es/vtx-import2/index.js +29 -19
- package/es/vtx-import2/style/index.js +59 -8
- package/es/vtx-modal/index.js +11 -6
- package/es/vtx-modal/style/index.js +5 -2
- package/es/vtx-page-layout/Basic.js +2 -2
- package/es/vtx-page-layout/TabLayout.js +6 -6
- package/es/vtx-page-layout/TableLayout.js +10 -10
- package/es/vtx-page-layout/TreeLayout.js +6 -6
- package/es/vtx-page-layout/container.js +2 -2
- package/es/vtx-page-layout/style/index.js +4 -2
- package/es/vtx-provider/index.js +33 -31
- package/es/vtx-provider/intl.js +9 -9
- package/es/vtx-provider/locale/en_GB.js +1 -1
- package/es/vtx-provider/locale/en_US.js +58 -4
- package/es/vtx-provider/locale/zh_CN.js +57 -3
- package/es/vtx-provider/useStyle/index.js +17 -17
- package/es/vtx-search/index.js +30 -12
- package/es/vtx-search/style/index.js +6 -3
- package/es/vtx-select/index.js +123 -40
- package/es/vtx-select/style/index.js +11 -56
- package/es/vtx-split-pane/Resizer.js +0 -1
- package/es/vtx-split-pane/SplitPane.js +42 -34
- package/es/vtx-split-pane/style/index.js +8 -112
- package/es/vtx-time-picker/index.js +27 -1
- package/es/vtx-transfer/Transfer.js +29 -0
- package/es/vtx-transfer/index.js +3 -0
- package/es/vtx-transfer/style/index.js +19 -0
- package/es/vtx-transfer-select/TransferSelect.js +143 -0
- package/es/vtx-transfer-select/index.js +3 -0
- package/es/vtx-transfer-select/style/index.js +19 -0
- package/es/vtx-tree/index.js +27 -9
- package/es/vtx-tree-select/index.js +81 -110
- package/es/vtx-tree-select/style/index.js +9 -3
- package/es/vtx-upload/FilePreview.js +2 -1
- package/es/vtx-wang-editor/index.js +41 -32
- package/es/vtx-wang-editor/style/index.less +12 -12
- package/lib/index.js +36 -0
- package/lib/utils/components/LabelIconTip/index.js +7 -7
- package/lib/utils/conversionMomentValue/index.js +25 -25
- package/lib/utils/filterSpecialCharacters.js +6 -6
- package/lib/utils/genCopyable/index.js +6 -6
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +7 -7
- package/lib/utils/hooks/useDebounceFn/index.js +4 -4
- package/lib/utils/hooks/useDebounceValue/index.js +6 -6
- package/lib/utils/hooks/useDeepCompareMemo/index.js +7 -7
- package/lib/utils/hooks/useLatest/index.js +2 -2
- package/lib/utils/hooks/useRefCallback/index.js +5 -5
- package/lib/utils/index.js +0 -7
- package/lib/utils/isBrowser/index.js +7 -7
- package/lib/utils/isUrl/index.js +4 -4
- package/lib/utils/merge/index.js +4 -4
- package/lib/utils/nanoid/index.js +4 -4
- package/lib/utils/omitBoolean/index.js +4 -4
- package/lib/utils/parseValueToMoment/index.js +4 -4
- package/lib/utils/proFieldParsingText/index.js +10 -10
- package/lib/utils/transformKeySubmitValue/index.js +57 -57
- package/lib/utils/useEditableArray/index.js +46 -46
- package/lib/utils/useEditableMap/index.js +22 -22
- package/lib/utils/useMediaQuery/index.js +5 -5
- package/lib/vtx-combogrid/Combogrid.js +5 -4
- package/lib/vtx-combogrid/index.js +7 -4
- package/lib/vtx-datagrid/Store/Provide.js +112 -142
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +7 -6
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +5 -2
- package/lib/vtx-datagrid/ToolBar/index.js +2 -1
- package/lib/vtx-datagrid/ToolBar/style.js +6 -3
- package/lib/vtx-datagrid/columnState.js +100 -0
- package/lib/vtx-datagrid/index.js +134 -37
- package/lib/vtx-datagrid/mergeComponents.js +21 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +30 -11
- package/lib/vtx-datagrid/style/index.js +108 -18
- package/lib/vtx-datagrid/style/index.less +242 -242
- package/lib/vtx-date-picker/QdatePicker.js +1 -1
- package/lib/vtx-date-picker/style/index.less +39 -39
- package/lib/vtx-descriptions/Descriptions.js +38 -0
- package/lib/vtx-descriptions/index.js +15 -0
- package/lib/vtx-descriptions/style/index.js +25 -0
- package/lib/vtx-ellipsis-text/index.js +2 -2
- package/lib/vtx-ellipsis-text/style/index.js +3 -1
- package/lib/vtx-export/index.js +34 -39
- package/lib/vtx-export-async/History.js +14 -8
- package/lib/vtx-export-async/index.js +18 -8
- package/lib/vtx-export-async/util.js +16 -5
- package/lib/vtx-form-layout/FormItem.js +16 -16
- package/lib/vtx-form-layout/style/index.js +6 -4
- package/lib/vtx-icon/index.js +54 -52
- package/lib/vtx-icon/index.js1 +90 -0
- package/lib/vtx-image/style/index.js +0 -1
- package/lib/vtx-import/index.js +141 -43
- package/lib/vtx-import/result.js +29 -27
- package/lib/vtx-import/style/index.js +16 -1
- package/lib/vtx-import2/Content.js +2 -1
- package/lib/vtx-import2/index.js +29 -19
- package/lib/vtx-import2/style/index.js +59 -8
- package/lib/vtx-modal/index.js +11 -6
- package/lib/vtx-modal/style/index.js +5 -2
- package/lib/vtx-page-layout/Basic.js +2 -2
- package/lib/vtx-page-layout/TabLayout.js +6 -6
- package/lib/vtx-page-layout/TableLayout.js +10 -10
- package/lib/vtx-page-layout/TreeLayout.js +6 -6
- package/lib/vtx-page-layout/container.js +2 -2
- package/lib/vtx-page-layout/style/index.js +4 -2
- package/lib/vtx-provider/index.js +33 -31
- package/lib/vtx-provider/intl.js +9 -9
- package/lib/vtx-provider/locale/en_GB.js +1 -1
- package/lib/vtx-provider/locale/en_US.js +58 -4
- package/lib/vtx-provider/locale/zh_CN.js +57 -3
- package/lib/vtx-provider/useStyle/index.js +17 -17
- package/lib/vtx-search/index.js +32 -12
- package/lib/vtx-search/style/index.js +6 -3
- package/lib/vtx-select/index.js +125 -42
- package/lib/vtx-select/style/index.js +11 -56
- package/lib/vtx-split-pane/Resizer.js +0 -1
- package/lib/vtx-split-pane/SplitPane.js +40 -31
- package/lib/vtx-split-pane/style/index.js +8 -112
- package/lib/vtx-time-picker/index.js +27 -1
- package/lib/vtx-transfer/Transfer.js +38 -0
- package/lib/vtx-transfer/index.js +15 -0
- package/lib/vtx-transfer/style/index.js +25 -0
- package/lib/vtx-transfer-select/TransferSelect.js +151 -0
- package/lib/vtx-transfer-select/index.js +15 -0
- package/lib/vtx-transfer-select/style/index.js +25 -0
- package/lib/vtx-tree/index.js +27 -9
- package/lib/vtx-tree-select/index.js +81 -112
- package/lib/vtx-tree-select/style/index.js +9 -3
- package/lib/vtx-upload/FilePreview.js +2 -1
- package/lib/vtx-wang-editor/index.js +39 -30
- package/lib/vtx-wang-editor/style/index.less +12 -12
- package/package.json +239 -238
- package/es/utils/hooks/useFetchData/index.js +0 -82
- package/lib/utils/hooks/useFetchData/index.js +0 -89
|
@@ -40,9 +40,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
40
40
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
41
41
|
var noteOnce = rcWarning.noteOnce;
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
* 显示警告信息
|
|
45
|
-
* @param messageStr
|
|
43
|
+
/**
|
|
44
|
+
* 显示警告信息
|
|
45
|
+
* @param messageStr
|
|
46
46
|
*/
|
|
47
47
|
var warning = function warning(messageStr) {
|
|
48
48
|
return message.warning(messageStr);
|
|
@@ -52,11 +52,11 @@ export var recordKeyToString = function recordKeyToString(rowKey) {
|
|
|
52
52
|
return rowKey;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* 使用map 来删除数据,性能一般 但是准确率比较高
|
|
57
|
-
*
|
|
58
|
-
* @param keyProps
|
|
59
|
-
* @param action
|
|
55
|
+
/**
|
|
56
|
+
* 使用map 来删除数据,性能一般 但是准确率比较高
|
|
57
|
+
*
|
|
58
|
+
* @param keyProps
|
|
59
|
+
* @param action
|
|
60
60
|
*/
|
|
61
61
|
export function editableRowByKey(keyProps, action) {
|
|
62
62
|
var _recordKeyToString;
|
|
@@ -68,11 +68,11 @@ export function editableRowByKey(keyProps, action) {
|
|
|
68
68
|
var key = (_recordKeyToString = recordKeyToString(keyProps.key)) === null || _recordKeyToString === void 0 ? void 0 : _recordKeyToString.toString();
|
|
69
69
|
var kvMap = new Map();
|
|
70
70
|
|
|
71
|
-
/**
|
|
72
|
-
* 打平这个数组
|
|
73
|
-
*
|
|
74
|
-
* @param records
|
|
75
|
-
* @param parentKey
|
|
71
|
+
/**
|
|
72
|
+
* 打平这个数组
|
|
73
|
+
*
|
|
74
|
+
* @param records
|
|
75
|
+
* @param parentKey
|
|
76
76
|
*/
|
|
77
77
|
function dig(records, map_row_parentKey, map_row_index) {
|
|
78
78
|
records.forEach(function (record, index) {
|
|
@@ -157,10 +157,10 @@ export function editableRowByKey(keyProps, action) {
|
|
|
157
157
|
return fill(kvMap);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
/**
|
|
161
|
-
* 保存按钮的dom
|
|
162
|
-
*
|
|
163
|
-
* @param ActionRenderConfig
|
|
160
|
+
/**
|
|
161
|
+
* 保存按钮的dom
|
|
162
|
+
*
|
|
163
|
+
* @param ActionRenderConfig
|
|
164
164
|
*/
|
|
165
165
|
export function SaveEditableAction(_ref, ref) {
|
|
166
166
|
var recordKey = _ref.recordKey,
|
|
@@ -263,10 +263,10 @@ export function SaveEditableAction(_ref, ref) {
|
|
|
263
263
|
}, "save");
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
/**
|
|
267
|
-
* 删除按钮 dom
|
|
268
|
-
*
|
|
269
|
-
* @param ActionRenderConfig
|
|
266
|
+
/**
|
|
267
|
+
* 删除按钮 dom
|
|
268
|
+
*
|
|
269
|
+
* @param ActionRenderConfig
|
|
270
270
|
*/
|
|
271
271
|
export var DeleteEditableAction = function DeleteEditableAction(_ref4) {
|
|
272
272
|
var recordKey = _ref4.recordKey,
|
|
@@ -406,17 +406,17 @@ export function defaultActionRender(row, config) {
|
|
|
406
406
|
};
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
-
/**
|
|
410
|
-
* 一个方便的hooks 用于维护编辑的状态
|
|
411
|
-
*
|
|
412
|
-
* @param props
|
|
409
|
+
/**
|
|
410
|
+
* 一个方便的hooks 用于维护编辑的状态
|
|
411
|
+
*
|
|
412
|
+
* @param props
|
|
413
413
|
*/
|
|
414
414
|
export function useEditableArray(props) {
|
|
415
415
|
// Internationalization
|
|
416
416
|
var intl = useIntl();
|
|
417
417
|
|
|
418
|
-
/**
|
|
419
|
-
* 点击开始编辑之前的保存数据用的
|
|
418
|
+
/**
|
|
419
|
+
* 点击开始编辑之前的保存数据用的
|
|
420
420
|
*/
|
|
421
421
|
var preEditRowRef = useRef(null);
|
|
422
422
|
var _useState = useState(undefined),
|
|
@@ -504,10 +504,10 @@ export function useEditableArray(props) {
|
|
|
504
504
|
};
|
|
505
505
|
});
|
|
506
506
|
|
|
507
|
-
/**
|
|
508
|
-
* 进入编辑状态
|
|
509
|
-
*
|
|
510
|
-
* @param recordKey
|
|
507
|
+
/**
|
|
508
|
+
* 进入编辑状态
|
|
509
|
+
*
|
|
510
|
+
* @param recordKey
|
|
511
511
|
*/
|
|
512
512
|
var startEditable = useRefFunction(function (recordKey, record) {
|
|
513
513
|
var _ref7, _props$dataSource;
|
|
@@ -526,10 +526,10 @@ export function useEditableArray(props) {
|
|
|
526
526
|
return true;
|
|
527
527
|
});
|
|
528
528
|
|
|
529
|
-
/**
|
|
530
|
-
* 退出编辑状态
|
|
531
|
-
*
|
|
532
|
-
* @param recordKey
|
|
529
|
+
/**
|
|
530
|
+
* 退出编辑状态
|
|
531
|
+
*
|
|
532
|
+
* @param recordKey
|
|
533
533
|
*/
|
|
534
534
|
var cancelEditable = useRefFunction( /*#__PURE__*/function () {
|
|
535
535
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(recordKey, needReTry) {
|
|
@@ -635,11 +635,11 @@ export function useEditableArray(props) {
|
|
|
635
635
|
}
|
|
636
636
|
});
|
|
637
637
|
}, [saveRefsMap, editableKeysSet]);
|
|
638
|
-
/**
|
|
639
|
-
* 保存编辑行
|
|
640
|
-
*
|
|
641
|
-
* @param recordKey
|
|
642
|
-
* @param needReTry
|
|
638
|
+
/**
|
|
639
|
+
* 保存编辑行
|
|
640
|
+
*
|
|
641
|
+
* @param recordKey
|
|
642
|
+
* @param needReTry
|
|
643
643
|
*/
|
|
644
644
|
var saveEditable = useRefFunction( /*#__PURE__*/function () {
|
|
645
645
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(recordKey, needReTry) {
|
|
@@ -686,12 +686,12 @@ export function useEditableArray(props) {
|
|
|
686
686
|
};
|
|
687
687
|
}());
|
|
688
688
|
|
|
689
|
-
/**
|
|
690
|
-
* 同时只能支持一行,取消之后数据消息,不会触发 dataSource
|
|
691
|
-
*
|
|
692
|
-
* @param row
|
|
693
|
-
* @param options
|
|
694
|
-
* @name 增加新的行
|
|
689
|
+
/**
|
|
690
|
+
* 同时只能支持一行,取消之后数据消息,不会触发 dataSource
|
|
691
|
+
*
|
|
692
|
+
* @param row
|
|
693
|
+
* @param options
|
|
694
|
+
* @name 增加新的行
|
|
695
695
|
*/
|
|
696
696
|
var addEditRecord = useRefFunction(function (row, options) {
|
|
697
697
|
if (options !== null && options !== void 0 && options.parentKey && !dataSourceKeyIndexMapRef.current.has(recordKeyToString(options === null || options === void 0 ? void 0 : options.parentKey).toString())) {
|
|
@@ -20,19 +20,19 @@ import { useCallback, useMemo, useRef } from 'react';
|
|
|
20
20
|
import { useIntl } from "../../vtx-provider";
|
|
21
21
|
import { defaultActionRender, recordKeyToString } from "../useEditableArray";
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* 显示警告信息
|
|
25
|
-
* @param messageStr
|
|
23
|
+
/**
|
|
24
|
+
* 显示警告信息
|
|
25
|
+
* @param messageStr
|
|
26
26
|
*/
|
|
27
27
|
var warning = function warning(messageStr) {
|
|
28
28
|
return message.warning(messageStr);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* 使用map 来删除数据,性能一般 但是准确率比较高
|
|
33
|
-
*
|
|
34
|
-
* @param params
|
|
35
|
-
* @param action
|
|
31
|
+
/**
|
|
32
|
+
* 使用map 来删除数据,性能一般 但是准确率比较高
|
|
33
|
+
*
|
|
34
|
+
* @param params
|
|
35
|
+
* @param action
|
|
36
36
|
*/
|
|
37
37
|
function editableRowByKey(_ref) {
|
|
38
38
|
var data = _ref.data,
|
|
@@ -40,14 +40,14 @@ function editableRowByKey(_ref) {
|
|
|
40
40
|
return _objectSpread(_objectSpread({}, data), row);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
* 一个方便的hooks 用于维护编辑的状态
|
|
45
|
-
*
|
|
46
|
-
* @param props
|
|
43
|
+
/**
|
|
44
|
+
* 一个方便的hooks 用于维护编辑的状态
|
|
45
|
+
*
|
|
46
|
+
* @param props
|
|
47
47
|
*/
|
|
48
48
|
export function useEditableMap(props) {
|
|
49
|
-
/**
|
|
50
|
-
* 点击开始编辑之前的保存数据用的
|
|
49
|
+
/**
|
|
50
|
+
* 点击开始编辑之前的保存数据用的
|
|
51
51
|
*/
|
|
52
52
|
var preEditRowRef = useRef(null);
|
|
53
53
|
var editableType = props.type || 'single';
|
|
@@ -79,10 +79,10 @@ export function useEditableMap(props) {
|
|
|
79
79
|
return false;
|
|
80
80
|
}, [(editableKeys || []).join(',')]);
|
|
81
81
|
|
|
82
|
-
/**
|
|
83
|
-
* 进入编辑状态
|
|
84
|
-
*
|
|
85
|
-
* @param recordKey
|
|
82
|
+
/**
|
|
83
|
+
* 进入编辑状态
|
|
84
|
+
*
|
|
85
|
+
* @param recordKey
|
|
86
86
|
*/
|
|
87
87
|
var startEditable = function startEditable(recordKey, recordValue) {
|
|
88
88
|
var _ref2;
|
|
@@ -97,10 +97,10 @@ export function useEditableMap(props) {
|
|
|
97
97
|
return true;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
/**
|
|
101
|
-
* 退出编辑状态
|
|
102
|
-
*
|
|
103
|
-
* @param recordKey
|
|
100
|
+
/**
|
|
101
|
+
* 退出编辑状态
|
|
102
|
+
*
|
|
103
|
+
* @param recordKey
|
|
104
104
|
*/
|
|
105
105
|
var cancelEditable = function cancelEditable(recordKey) {
|
|
106
106
|
// 防止多次渲染
|
|
@@ -37,11 +37,11 @@ export var MediaQueryEnum = {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
* loop query screen className
|
|
42
|
-
* Array.find will throw a error
|
|
43
|
-
* `Rendered more hooks than during the previous render.`
|
|
44
|
-
* So should use Array.forEach
|
|
40
|
+
/**
|
|
41
|
+
* loop query screen className
|
|
42
|
+
* Array.find will throw a error
|
|
43
|
+
* `Rendered more hooks than during the previous render.`
|
|
44
|
+
* So should use Array.forEach
|
|
45
45
|
*/
|
|
46
46
|
export var getScreenClassName = function getScreenClassName() {
|
|
47
47
|
var queryKey = undefined;
|
|
@@ -43,7 +43,8 @@ function VtxCombogrid(props, ref) {
|
|
|
43
43
|
searchForms = _props$searchForms === void 0 ? [] : _props$searchForms,
|
|
44
44
|
selectedRowKeys = props.selectedRowKeys,
|
|
45
45
|
setSelectedRowKeys = props.setSelectedRowKeys,
|
|
46
|
-
spread = props.spread,
|
|
46
|
+
_props$spread = props.spread,
|
|
47
|
+
spread = _props$spread === void 0 ? false : _props$spread,
|
|
47
48
|
defaultPageSize = props.defaultPageSize,
|
|
48
49
|
_props$customEnumText = props.customEnumText,
|
|
49
50
|
customEnumText = _props$customEnumText === void 0 ? {} : _props$customEnumText,
|
|
@@ -130,16 +131,16 @@ function VtxCombogrid(props, ref) {
|
|
|
130
131
|
});
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
//
|
|
134
|
+
// 重置会清空 selectedRowKeys,因此也需清空文本中的 value 值
|
|
134
135
|
var query = function query() {
|
|
135
136
|
submit();
|
|
136
|
-
if (multiple && selectedRowKeys.length) {
|
|
137
|
+
if (!spread && multiple && selectedRowKeys.length) {
|
|
137
138
|
clearSelectedRow();
|
|
138
139
|
}
|
|
139
140
|
};
|
|
140
141
|
var clear = function clear() {
|
|
141
142
|
reset();
|
|
142
|
-
if (multiple && selectedRowKeys.length) {
|
|
143
|
+
if (!spread && multiple && selectedRowKeys.length) {
|
|
143
144
|
clearSelectedRow();
|
|
144
145
|
}
|
|
145
146
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["className", "style", "placeholder", "prefixCls", "value", "allowClear", "selectedRowKeys", "popoverProps", "inputProps", "content", "disabled"];
|
|
2
|
+
var _excluded = ["className", "style", "placeholder", "prefixCls", "value", "allowClear", "selectedRowKeys", "popoverProps", "inputProps", "content", "disabled", "spread"];
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -48,6 +48,8 @@ var VtxCombogrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
48
48
|
content = _props$content === void 0 ? null : _props$content,
|
|
49
49
|
_props$disabled = props.disabled,
|
|
50
50
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
51
|
+
_props$spread = props.spread,
|
|
52
|
+
spread = _props$spread === void 0 ? false : _props$spread,
|
|
51
53
|
rest = _objectWithoutProperties(props, _excluded);
|
|
52
54
|
useEffect(function () {
|
|
53
55
|
setSelectedRowKeys(defaultSelectedRowKeys);
|
|
@@ -71,11 +73,12 @@ var VtxCombogrid = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
71
73
|
defaultSelectedRowKeys: defaultSelectedRowKeys,
|
|
72
74
|
setSelectedRowKeys: setSelectedRowKeys,
|
|
73
75
|
setPopoverVisible: setVisible,
|
|
76
|
+
spread: spread,
|
|
74
77
|
ref: comboRef
|
|
75
78
|
})),
|
|
76
79
|
trigger: "click",
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
open: disabled ? false : visible,
|
|
81
|
+
onOpenChange: function onOpenChange(visible) {
|
|
79
82
|
return setVisible(visible);
|
|
80
83
|
},
|
|
81
84
|
classNames: {
|
|
@@ -109,7 +112,7 @@ export { VtxCombogrid };
|
|
|
109
112
|
VtxCombogrid.propTypes = {
|
|
110
113
|
prefixCls: PropTypes.string,
|
|
111
114
|
placeholder: PropTypes.string,
|
|
112
|
-
value: PropTypes.string,
|
|
115
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
113
116
|
allowClear: PropTypes.bool,
|
|
114
117
|
disabled: PropTypes.bool,
|
|
115
118
|
className: PropTypes.string,
|
|
@@ -3,35 +3,83 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
|
|
|
3
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
5
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
12
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
14
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
15
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
11
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
16
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
17
|
import { useMergedState } from '@rc-component/util';
|
|
18
|
-
import { request } from '@vtx/utils';
|
|
19
18
|
import getSignature from '@vtx/utils/lib/getSignature';
|
|
20
|
-
import
|
|
21
|
-
import
|
|
19
|
+
import request from '@vtx/utils/lib/request';
|
|
20
|
+
import VtxEllipsisText from "../../vtx-ellipsis-text";
|
|
21
|
+
import { getVtxToken } from '@vtx/utils';
|
|
22
22
|
import { message } from 'antd';
|
|
23
|
-
import {
|
|
23
|
+
import { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
24
|
+
import { isFunction, useDeepCompareEffectDebounce } from "../../utils";
|
|
25
|
+
import { useIntl } from "../../vtx-provider";
|
|
26
|
+
import { buildColumnKeyMap, buildSortKeyColumns, getVisibleColumnKeysFromMap } from "../columnState";
|
|
24
27
|
import renderColumnButtons from "../renderColumnButtons";
|
|
25
|
-
import { getVtxToken } from '@vtx/utils';
|
|
26
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
29
|
export var indexColumnKey = '_serialNum';
|
|
30
|
+
function useMergedState1(defaultValue, option) {
|
|
31
|
+
var _ref = option || {},
|
|
32
|
+
controlledValue = _ref.value,
|
|
33
|
+
onChange = _ref.onChange,
|
|
34
|
+
id = _ref.id;
|
|
35
|
+
|
|
36
|
+
// 1. 初始化内部非受控状态
|
|
37
|
+
var _useState = useState(defaultValue),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
innerValue = _useState2[0],
|
|
40
|
+
setInnerValue = _useState2[1];
|
|
41
|
+
// 记录上一次的值,用于 onChange 回调传参
|
|
42
|
+
var prevValueRef = useRef(controlledValue !== null && controlledValue !== void 0 ? controlledValue : innerValue);
|
|
43
|
+
// 2. 受控模式下,同步更新 prevValueRef
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
if (controlledValue !== undefined) {
|
|
46
|
+
prevValueRef.current = controlledValue;
|
|
47
|
+
}
|
|
48
|
+
}, [controlledValue]);
|
|
49
|
+
// 3. 统一的取值逻辑:优先用受控值,否则用内部值
|
|
50
|
+
var mergedValue = controlledValue !== undefined ? controlledValue : innerValue;
|
|
51
|
+
// 4. 统一的更新方法
|
|
52
|
+
var setValue = useCallback(function (value) {
|
|
53
|
+
var prevValue = mergedValue;
|
|
54
|
+
// 处理函数式更新(和 useState 保持一致)
|
|
55
|
+
var nextValue = typeof value === 'function' ? value(prevValue) : value;
|
|
56
|
+
|
|
57
|
+
// 受控模式:调用 onChange,不更新内部 state
|
|
58
|
+
if (controlledValue !== undefined) {
|
|
59
|
+
onChange === null || onChange === void 0 || onChange(nextValue, prevValue);
|
|
60
|
+
}
|
|
61
|
+
// 非受控模式:更新内部 state,同时触发 onChange
|
|
62
|
+
else {
|
|
63
|
+
setInnerValue(nextValue);
|
|
64
|
+
onChange === null || onChange === void 0 || onChange(nextValue, prevValue);
|
|
65
|
+
}
|
|
66
|
+
// 更新上一次值的缓存
|
|
67
|
+
prevValueRef.current = nextValue;
|
|
68
|
+
}, [controlledValue, mergedValue, onChange]);
|
|
69
|
+
// 5. 重置方法:恢复到初始默认值
|
|
70
|
+
var reset = useCallback(function () {
|
|
71
|
+
var resetValue = typeof defaultValue === 'function' ? defaultValue() : defaultValue;
|
|
72
|
+
setValue(resetValue);
|
|
73
|
+
}, [defaultValue, setValue]);
|
|
74
|
+
return [mergedValue, setValue, reset];
|
|
75
|
+
}
|
|
28
76
|
function useContainer() {
|
|
29
77
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
userId =
|
|
33
|
-
|
|
34
|
-
tenantId =
|
|
78
|
+
var _ref2 = getVtxToken() || {},
|
|
79
|
+
_ref2$userId = _ref2.userId,
|
|
80
|
+
userId = _ref2$userId === void 0 ? '' : _ref2$userId,
|
|
81
|
+
_ref2$tenantId = _ref2.tenantId,
|
|
82
|
+
tenantId = _ref2$tenantId === void 0 ? '' : _ref2$tenantId;
|
|
35
83
|
var intl = useIntl();
|
|
36
84
|
var _props$indexColumn = props.indexColumn,
|
|
37
85
|
indexColumn = _props$indexColumn === void 0 ? true : _props$indexColumn,
|
|
@@ -87,24 +135,24 @@ function useContainer() {
|
|
|
87
135
|
var columnsMapRef = useRef({});
|
|
88
136
|
// 是否可拖拽, 除非columns 至少需要一项不设置 width 让其自适应。
|
|
89
137
|
var isDragRef = useRef(false);
|
|
90
|
-
var
|
|
91
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
92
|
-
columnsMap = _useState2[0],
|
|
93
|
-
setColumnsMap = _useState2[1];
|
|
94
|
-
var _useState3 = useState(false),
|
|
138
|
+
var _useState3 = useState({}),
|
|
95
139
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var _useState5 = useState(
|
|
140
|
+
columnsMap = _useState4[0],
|
|
141
|
+
setColumnsMap = _useState4[1];
|
|
142
|
+
var _useState5 = useState(false),
|
|
99
143
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var _useState7 = useState(
|
|
144
|
+
showTable = _useState6[0],
|
|
145
|
+
setShowTable = _useState6[1];
|
|
146
|
+
var _useState7 = useState(''),
|
|
103
147
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
104
|
-
|
|
105
|
-
|
|
148
|
+
keyWords = _useState8[0],
|
|
149
|
+
_setKeyWords = _useState8[1];
|
|
150
|
+
var _useState9 = useState({}),
|
|
151
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
152
|
+
tableConfig = _useState10[0],
|
|
153
|
+
setTableConfig = _useState10[1];
|
|
106
154
|
var _useMergedState = useMergedState(function () {
|
|
107
|
-
return props.size || props.defaultSize || '
|
|
155
|
+
return props.size || props.defaultSize || 'small';
|
|
108
156
|
}, {
|
|
109
157
|
value: props.size,
|
|
110
158
|
onChange: props.onSizeChange
|
|
@@ -113,7 +161,7 @@ function useContainer() {
|
|
|
113
161
|
tableSize = _useMergedState2[0],
|
|
114
162
|
setTableSize = _useMergedState2[1];
|
|
115
163
|
var _useMergedState3 = useMergedState(function () {
|
|
116
|
-
return props.tableStyles || ['striped', 'header-background', 'border'];
|
|
164
|
+
return props.tableStyles || props.defaultTableStyles || ['striped', 'header-background', 'border'];
|
|
117
165
|
}, {
|
|
118
166
|
value: props.tableStyles,
|
|
119
167
|
onChange: props.onChangeTableStyles
|
|
@@ -122,7 +170,7 @@ function useContainer() {
|
|
|
122
170
|
tableStyles = _useMergedState4[0],
|
|
123
171
|
setTableStyles = _useMergedState4[1];
|
|
124
172
|
var _useMergedState5 = useMergedState(function () {
|
|
125
|
-
return props.visibleColumnKeys || undefined;
|
|
173
|
+
return props.visibleColumnKeys || props.defaultVisibleColumnKeys || undefined;
|
|
126
174
|
}, {
|
|
127
175
|
value: props.visibleColumnKeys,
|
|
128
176
|
onChange: props.onVisibleColumnsChange
|
|
@@ -131,7 +179,7 @@ function useContainer() {
|
|
|
131
179
|
visibleColumnKeys = _useMergedState6[0],
|
|
132
180
|
setVisibleColumnKeys = _useMergedState6[1];
|
|
133
181
|
var _useMergedState7 = useMergedState(function () {
|
|
134
|
-
return props.uniqueKey || undefined;
|
|
182
|
+
return props.uniqueKey || props.defaultUniqueKey || undefined;
|
|
135
183
|
}, {
|
|
136
184
|
value: props.uniqueKey,
|
|
137
185
|
onChange: props.onChangesUniqueKey
|
|
@@ -170,16 +218,24 @@ function useContainer() {
|
|
|
170
218
|
key: newColumn.key || newColumn.dataIndex,
|
|
171
219
|
disable: disabledColumnKeys === null || disabledColumnKeys === void 0 ? void 0 : disabledColumnKeys.includes(column.dataIndex || column.key),
|
|
172
220
|
render: isFunction(column.renderButtons) ? function (text, record, index) {
|
|
173
|
-
return
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
221
|
+
return /*#__PURE__*/_jsx("div", {
|
|
222
|
+
style: {
|
|
223
|
+
whiteSpace: 'nowrap'
|
|
224
|
+
},
|
|
225
|
+
children: renderColumnButtons({
|
|
226
|
+
renderButtons: column.renderButtons,
|
|
227
|
+
visible: column.renderButtonsVisibleNum,
|
|
228
|
+
text: text,
|
|
229
|
+
record: record,
|
|
230
|
+
index: index,
|
|
231
|
+
TextEnum: TextEnum
|
|
232
|
+
})
|
|
180
233
|
});
|
|
181
234
|
} : 'render' in column ? column.render : function (text) {
|
|
182
|
-
return ['', null, undefined].includes(text) ? '-' : text
|
|
235
|
+
return ['', null, undefined].includes(text) ? '-' : column.ellipse && typeof text === 'string' ? /*#__PURE__*/_jsx(VtxEllipsisText, {
|
|
236
|
+
text: text,
|
|
237
|
+
lineClamp: 2
|
|
238
|
+
}) : text;
|
|
183
239
|
}
|
|
184
240
|
});
|
|
185
241
|
});
|
|
@@ -188,121 +244,34 @@ function useContainer() {
|
|
|
188
244
|
|
|
189
245
|
// 默认值 可以从接口里获取
|
|
190
246
|
var defaultColumnKeyMap = useMemo(function () {
|
|
191
|
-
var columnKeyMap = {};
|
|
192
247
|
if (tableConfig.columnsMap && tableConfig.sortKeyColumns) {
|
|
193
248
|
setColumnsMap(tableConfig.columnsMap);
|
|
194
249
|
sortKeyColumns.current = tableConfig.sortKeyColumns;
|
|
195
250
|
return tableConfig.columnsMap;
|
|
196
|
-
} else if (Array.isArray(props.defaultVisibleColumnKeys)) {
|
|
197
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref2, index) {
|
|
198
|
-
var _ref3;
|
|
199
|
-
var key = _ref2.key,
|
|
200
|
-
dataIndex = _ref2.dataIndex,
|
|
201
|
-
fixed = _ref2.fixed,
|
|
202
|
-
disable = _ref2.disable,
|
|
203
|
-
width = _ref2.width;
|
|
204
|
-
var columnKey = genColumnKey(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
205
|
-
columnKeyMap[columnKey] = {
|
|
206
|
-
show: indexColumn && indexColumnKey == columnKey ? true : (_ref3 = _toConsumableArray(props.defaultVisibleColumnKeys)) === null || _ref3 === void 0 ? void 0 : _ref3.includes(columnKey),
|
|
207
|
-
fixed: fixed,
|
|
208
|
-
disable: disable,
|
|
209
|
-
width: width
|
|
210
|
-
};
|
|
211
|
-
});
|
|
212
|
-
} else {
|
|
213
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref4, index) {
|
|
214
|
-
var key = _ref4.key,
|
|
215
|
-
dataIndex = _ref4.dataIndex,
|
|
216
|
-
fixed = _ref4.fixed,
|
|
217
|
-
disable = _ref4.disable,
|
|
218
|
-
width = _ref4.width;
|
|
219
|
-
var columnKey = genColumnKey(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
220
|
-
columnKeyMap[columnKey] = {
|
|
221
|
-
show: true,
|
|
222
|
-
fixed: fixed,
|
|
223
|
-
disable: disable,
|
|
224
|
-
width: width
|
|
225
|
-
};
|
|
226
|
-
});
|
|
227
251
|
}
|
|
228
|
-
return
|
|
252
|
+
return buildColumnKeyMap(tableColumn, {
|
|
253
|
+
defaultVisibleColumnKeys: props.defaultVisibleColumnKeys,
|
|
254
|
+
indexColumn: indexColumn
|
|
255
|
+
});
|
|
229
256
|
}, [tableColumn, props.defaultVisibleColumnKeys, tableConfig, uniqueKey]);
|
|
230
257
|
|
|
231
258
|
// 深度比较 + 防抖 + 忽略这render函数引用变化
|
|
232
259
|
useDeepCompareEffectDebounce(function () {
|
|
233
|
-
var columnKeyMap = {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
dataIndex = _ref5.dataIndex,
|
|
239
|
-
fixed = _ref5.fixed,
|
|
240
|
-
disable = _ref5.disable,
|
|
241
|
-
width = _ref5.width;
|
|
242
|
-
var columnKey = genColumnKey(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
243
|
-
columnKeyMap[columnKey] = {
|
|
244
|
-
show: isFirst.current && indexColumn && indexColumnKey == columnKey ? true : (_ref6 = _toConsumableArray(visibleColumnKeys)) === null || _ref6 === void 0 ? void 0 : _ref6.includes(columnKey),
|
|
245
|
-
fixed: fixed,
|
|
246
|
-
disable: disable,
|
|
247
|
-
width: width
|
|
248
|
-
};
|
|
249
|
-
});
|
|
250
|
-
} else if (Array.isArray(props.defaultVisibleColumnKeys)) {
|
|
251
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref7, index) {
|
|
252
|
-
var _ref8;
|
|
253
|
-
var key = _ref7.key,
|
|
254
|
-
dataIndex = _ref7.dataIndex,
|
|
255
|
-
fixed = _ref7.fixed,
|
|
256
|
-
disable = _ref7.disable,
|
|
257
|
-
width = _ref7.width;
|
|
258
|
-
var columnKey = genColumnKey(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
259
|
-
columnKeyMap[columnKey] = {
|
|
260
|
-
show: isFirst.current && indexColumn && indexColumnKey == columnKey ? true : (_ref8 = _toConsumableArray(props.defaultVisibleColumnKeys)) === null || _ref8 === void 0 ? void 0 : _ref8.includes(columnKey),
|
|
261
|
-
fixed: fixed,
|
|
262
|
-
disable: disable,
|
|
263
|
-
width: width
|
|
264
|
-
};
|
|
265
|
-
});
|
|
266
|
-
} else {
|
|
267
|
-
tableColumn === null || tableColumn === void 0 || tableColumn.forEach(function (_ref9, index) {
|
|
268
|
-
var key = _ref9.key,
|
|
269
|
-
dataIndex = _ref9.dataIndex,
|
|
270
|
-
fixed = _ref9.fixed,
|
|
271
|
-
disable = _ref9.disable,
|
|
272
|
-
width = _ref9.width;
|
|
273
|
-
var columnKey = genColumnKey(key !== null && key !== void 0 ? key : dataIndex, index);
|
|
274
|
-
columnKeyMap[columnKey] = {
|
|
275
|
-
show: true,
|
|
276
|
-
fixed: fixed,
|
|
277
|
-
disable: disable,
|
|
278
|
-
width: width
|
|
279
|
-
};
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
var sortKeys = visibleColumnKeys || props.defaultVisibleColumnKeys || [];
|
|
283
|
-
sortKeyColumns.current = Object.entries(columnKeyMap).map(function (_ref10) {
|
|
284
|
-
var _ref11 = _slicedToArray(_ref10, 1),
|
|
285
|
-
key = _ref11[0];
|
|
286
|
-
return key;
|
|
260
|
+
var columnKeyMap = buildColumnKeyMap(tableColumn, {
|
|
261
|
+
visibleColumnKeys: visibleColumnKeys,
|
|
262
|
+
defaultVisibleColumnKeys: props.defaultVisibleColumnKeys,
|
|
263
|
+
previousColumnsMap: columnsMapRef.current,
|
|
264
|
+
indexColumn: indexColumn
|
|
287
265
|
});
|
|
288
|
-
|
|
289
|
-
sortKeyColumns.current = sortByGivenOrder(sortKeyColumns.current, sortKeys);
|
|
290
|
-
}
|
|
266
|
+
sortKeyColumns.current = buildSortKeyColumns(columnKeyMap, visibleColumnKeys, props.defaultVisibleColumnKeys);
|
|
291
267
|
setColumnsMap(columnKeyMap);
|
|
292
268
|
if (isFirst.current) {
|
|
293
269
|
isFirst.current = false;
|
|
294
270
|
}
|
|
295
|
-
}, [visibleColumnKeys], ['render'], 100);
|
|
271
|
+
}, [visibleColumnKeys, props.defaultVisibleColumnKeys, tableColumn], ['render'], 100);
|
|
296
272
|
useDeepCompareEffectDebounce(function () {
|
|
297
|
-
var
|
|
298
|
-
|
|
299
|
-
(_sortKeyColumns$curre = sortKeyColumns.current) === null || _sortKeyColumns$curre === void 0 || _sortKeyColumns$curre.map(function (columnKey) {
|
|
300
|
-
var config = columnsMap[columnKey];
|
|
301
|
-
if (config !== null && config !== void 0 && config.show) {
|
|
302
|
-
visibleColumnKeys.push(columnKey);
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
(_props$onVisibleColum = props.onVisibleColumnsChange) === null || _props$onVisibleColum === void 0 || _props$onVisibleColum.call(props, visibleColumnKeys);
|
|
273
|
+
var _props$onVisibleColum;
|
|
274
|
+
(_props$onVisibleColum = props.onVisibleColumnsChange) === null || _props$onVisibleColum === void 0 || _props$onVisibleColum.call(props, getVisibleColumnKeysFromMap(columnsMap, sortKeyColumns.current));
|
|
306
275
|
}, [JSON.stringify(columnsMap), sortKeyColumns.current], ['render'], 200);
|
|
307
276
|
var show = function show() {
|
|
308
277
|
setTimeout(function () {
|