@arim-aisdc/public-components 2.3.34 → 2.3.36
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/components/TableMax/TableBody/Row.js +0 -1
- package/dist/components/TableMax/TableBody/index.js +24 -2
- package/dist/components/TableMax/TableMax.js +0 -7
- package/dist/components/TableMax/components/ColumnFilterV2/Filter.js +7 -10
- package/dist/components/TableMax/components/ColumnFilterV2/MultipleSelect/index.d.ts +5 -2
- package/dist/components/TableMax/components/ColumnFilterV2/MultipleSelect/index.js +63 -19
- package/dist/components/TableMax/components/ColumnFilterV2/SingleSelect/index.js +4 -2
- package/dist/components/TableMax/components/ColumnFilterV2/customFilterFns.d.ts +1 -0
- package/dist/components/TableMax/components/ColumnFilterV2/customFilterFns.js +14 -2
- package/dist/components/TableMax/components/ColumnFilterV2/index.d.ts +1 -0
- package/dist/components/TableMax/components/ColumnFilterV2/index.js +6 -1
- package/dist/components/TableMax/components/ColumnSort/customSortFns.d.ts +8 -8
- package/dist/components/TableMax/utils.js +2 -2
- package/package.json +1 -1
|
@@ -328,7 +328,6 @@ var Row = function Row(_ref) {
|
|
|
328
328
|
|
|
329
329
|
// 优化:将行渲染逻辑提取为useMemo
|
|
330
330
|
var rowComMemo = useMemo(function () {
|
|
331
|
-
console.log(row.getIsSelected(), row.renderValue(), 'row.getIsSelected()');
|
|
332
331
|
var renderCell = function renderCell(cell) {
|
|
333
332
|
var _cellClassName;
|
|
334
333
|
var _cell$column$columnDe = cell.column.columnDef,
|
|
@@ -18,7 +18,7 @@ import { CustomDragLayer } from "../components/CustomDragerLayer";
|
|
|
18
18
|
// import RowContent from "../components/RowContent";
|
|
19
19
|
import { DropSide } from "../type";
|
|
20
20
|
import { events, useEventBus } from "../../..";
|
|
21
|
-
import React, { useCallback, useMemo, useState } from 'react';
|
|
21
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
22
22
|
import { createPortal } from 'react-dom';
|
|
23
23
|
import { useConfig } from "../../ConfigProvider";
|
|
24
24
|
import Empty from "../../Empty";
|
|
@@ -181,6 +181,9 @@ var TableBody = function TableBody(_ref) {
|
|
|
181
181
|
visible: false
|
|
182
182
|
}));
|
|
183
183
|
}, []);
|
|
184
|
+
useEffect(function () {
|
|
185
|
+
console.log("emptyTheme-tableMax", theme);
|
|
186
|
+
}, [theme]);
|
|
184
187
|
|
|
185
188
|
// useEffect(() => {
|
|
186
189
|
// if (tbodyRef.current) {
|
|
@@ -307,6 +310,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
307
310
|
_useDrop4 = _slicedToArray(_useDrop3, 2),
|
|
308
311
|
dropTableEmptyRef = _useDrop4[1];
|
|
309
312
|
var LoadingAndEmptyContent = function LoadingAndEmptyContent() {
|
|
313
|
+
console.log('emptyTheme0');
|
|
310
314
|
return /*#__PURE__*/_jsx("div", {
|
|
311
315
|
className: "empty-container",
|
|
312
316
|
style: {
|
|
@@ -485,7 +489,25 @@ var TableBody = function TableBody(_ref) {
|
|
|
485
489
|
})]
|
|
486
490
|
})]
|
|
487
491
|
})
|
|
488
|
-
}) :
|
|
492
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
493
|
+
className: "empty-container",
|
|
494
|
+
style: {
|
|
495
|
+
width: table.getTotalSize()
|
|
496
|
+
},
|
|
497
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
498
|
+
className: "empty-wrapper",
|
|
499
|
+
style: {
|
|
500
|
+
width: "".concat(tableContainerWidth - 10, "px")
|
|
501
|
+
},
|
|
502
|
+
children: loading ? /*#__PURE__*/_jsx(Spin, {}) : /*#__PURE__*/_jsx("span", {
|
|
503
|
+
className: "empty-content",
|
|
504
|
+
ref: dropEmptyRef,
|
|
505
|
+
children: /*#__PURE__*/_jsx(Empty, {})
|
|
506
|
+
})
|
|
507
|
+
})
|
|
508
|
+
})
|
|
509
|
+
// LoadingAndEmptyContent()
|
|
510
|
+
, /*#__PURE__*/_jsx(ContextMenu, _objectSpread(_objectSpread({}, contextMenuData), {}, {
|
|
489
511
|
onClickContextMenu: onClickContextMenu,
|
|
490
512
|
closeContextMenu: closeContextMenu
|
|
491
513
|
}))]
|
|
@@ -553,10 +553,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
553
553
|
}
|
|
554
554
|
setColumnOrder(arr);
|
|
555
555
|
};
|
|
556
|
-
var _useState39 = useState(0),
|
|
557
|
-
_useState40 = _slicedToArray(_useState39, 2),
|
|
558
|
-
checkboxRender = _useState40[0],
|
|
559
|
-
setCheckboxRender = _useState40[1];
|
|
560
556
|
var setColumnsByProps = useCallback(function () {
|
|
561
557
|
var extraColumns = [];
|
|
562
558
|
if (getRowCanExpand() && columns.findIndex(function (column) {
|
|
@@ -620,9 +616,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
620
616
|
}
|
|
621
617
|
return item.getIsSelected();
|
|
622
618
|
});
|
|
623
|
-
setCheckboxRender(function (prev) {
|
|
624
|
-
return prev + 1;
|
|
625
|
-
});
|
|
626
619
|
onRowCheckboxClick === null || onRowCheckboxClick === void 0 || onRowCheckboxClick(row, row.original, !row.getIsSelected(), curSelectedRows);
|
|
627
620
|
// 阻止点击事件冒泡,监听行双击事件时,点击这里会有问题
|
|
628
621
|
e.stopPropagation();
|
|
@@ -13,7 +13,7 @@ import { AutoComplete, DatePicker, Input, InputNumber } from 'antd';
|
|
|
13
13
|
import dayjs from 'dayjs';
|
|
14
14
|
import { debounce } from 'lodash';
|
|
15
15
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
16
|
-
import { FilterType, defaultDateFormat } from '.';
|
|
16
|
+
import { FilterType, defaultDateFormat, isEmpty } from '.';
|
|
17
17
|
import { DateRange } from "./DateRange";
|
|
18
18
|
import MultipleSelect from "./MultipleSelect";
|
|
19
19
|
import NumberRange from "./NumberRange";
|
|
@@ -57,19 +57,19 @@ var Filter = function Filter(_ref) {
|
|
|
57
57
|
setColumnFilterValue(newValue);
|
|
58
58
|
column.setFilterValue(newValue);
|
|
59
59
|
};
|
|
60
|
-
// 修改表格SingleSelect 筛选参数
|
|
60
|
+
// 修改表格SingleSelect MutiSelect 筛选参数
|
|
61
61
|
var handleChangeSelectFilterValue = function handleChangeSelectFilterValue(value, inputSearchValue) {
|
|
62
62
|
var newValue = value;
|
|
63
|
-
if (value === null || Array.isArray(value) && value.length === 0) {
|
|
63
|
+
if (value === null || value === undefined || Array.isArray(value) && value.length === 0) {
|
|
64
64
|
// 值为null或空数组时,清除过滤条件。
|
|
65
65
|
newValue = undefined;
|
|
66
66
|
}
|
|
67
67
|
// console.log('handleChangeFilterValue :>> ', newValue);
|
|
68
|
-
setColumnFilterValue(
|
|
68
|
+
setColumnFilterValue(isEmpty(newValue) ? undefined : {
|
|
69
69
|
filterValue: newValue,
|
|
70
70
|
optionsParam: inputSearchValue
|
|
71
71
|
});
|
|
72
|
-
column.setFilterValue(
|
|
72
|
+
column.setFilterValue(isEmpty(newValue) ? undefined : {
|
|
73
73
|
filterValue: newValue,
|
|
74
74
|
optionsParam: inputSearchValue
|
|
75
75
|
});
|
|
@@ -163,10 +163,7 @@ var Filter = function Filter(_ref) {
|
|
|
163
163
|
fetchOptions(value);
|
|
164
164
|
}, 500), [fetchOptions]);
|
|
165
165
|
useEffect(function () {
|
|
166
|
-
if ([FilterType.MultiSelect].includes(filterType)) {
|
|
167
|
-
// 打开后自动获取可选值
|
|
168
|
-
fetchOptions(columnFilterValue);
|
|
169
|
-
} else if ([FilterType.SingleSelect].includes(filterType)) {
|
|
166
|
+
if ([FilterType.SingleSelect, FilterType.MultiSelect].includes(filterType)) {
|
|
170
167
|
// 打开后自动获取可选值
|
|
171
168
|
var _ref3 = columnFilterValue || {},
|
|
172
169
|
optionsParam = _ref3.optionsParam;
|
|
@@ -285,7 +282,7 @@ var Filter = function Filter(_ref) {
|
|
|
285
282
|
default:
|
|
286
283
|
return /*#__PURE__*/_jsx(MultipleSelect, {
|
|
287
284
|
value: columnFilterValue,
|
|
288
|
-
onChange:
|
|
285
|
+
onChange: handleChangeSelectFilterValue,
|
|
289
286
|
onSearch: onSearch,
|
|
290
287
|
options: options,
|
|
291
288
|
loading: apiLoading,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import './index.less';
|
|
2
2
|
interface IProps {
|
|
3
|
-
value:
|
|
3
|
+
value: {
|
|
4
|
+
filterValue?: any[];
|
|
5
|
+
optionsParam?: string;
|
|
6
|
+
} | undefined;
|
|
4
7
|
options: any[];
|
|
5
|
-
onChange: (value: any[]) => void;
|
|
8
|
+
onChange: (value: any[], inputValue?: string) => void;
|
|
6
9
|
onSearch: (value: string) => void;
|
|
7
10
|
isFrontSearch: boolean;
|
|
8
11
|
loading: boolean;
|
|
@@ -15,7 +15,10 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
15
15
|
var CheckboxGroup = Checkbox.Group;
|
|
16
16
|
var MultipleSelect = function MultipleSelect(_ref) {
|
|
17
17
|
var _ref$value = _ref.value,
|
|
18
|
-
value = _ref$value === void 0 ?
|
|
18
|
+
value = _ref$value === void 0 ? {
|
|
19
|
+
filterValue: [],
|
|
20
|
+
optionsParam: ''
|
|
21
|
+
} : _ref$value,
|
|
19
22
|
onChange = _ref.onChange,
|
|
20
23
|
options = _ref.options,
|
|
21
24
|
onSearch = _ref.onSearch,
|
|
@@ -23,37 +26,55 @@ var MultipleSelect = function MultipleSelect(_ref) {
|
|
|
23
26
|
loading = _ref.loading,
|
|
24
27
|
onCloseFilterPanel = _ref.onCloseFilterPanel;
|
|
25
28
|
// 内部state
|
|
26
|
-
|
|
27
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
-
innerValue = _useState2[0],
|
|
29
|
-
setInnerValue = _useState2[1];
|
|
29
|
+
// const [innerValue, setInnerValue] = useState(Array.isArray(value) ? value : [value]);
|
|
30
30
|
var _useTranslation = useTranslation(),
|
|
31
31
|
_useTranslation2 = _slicedToArray(_useTranslation, 1),
|
|
32
32
|
t = _useTranslation2[0];
|
|
33
|
+
var _ref2 = value || {},
|
|
34
|
+
filterValue = _ref2.filterValue,
|
|
35
|
+
optionsParam = _ref2.optionsParam;
|
|
33
36
|
|
|
34
|
-
//
|
|
35
|
-
var
|
|
37
|
+
// 列筛选 最终筛选值
|
|
38
|
+
var _useState = useState(Array.isArray(filterValue) ? filterValue : filterValue ? [filterValue] : []),
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
innerValue = _useState2[0],
|
|
41
|
+
setInnerValue = _useState2[1];
|
|
42
|
+
// 列筛选可选值列表的筛选参数
|
|
43
|
+
var _useState3 = useState(optionsParam),
|
|
36
44
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
inputSearchValue = _useState4[0],
|
|
46
|
+
setInputSearchValue = _useState4[1];
|
|
47
|
+
// 列筛选-前端筛选可选值列表
|
|
48
|
+
var _useState5 = useState([]),
|
|
49
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
50
|
+
frontendOptions = _useState6[0],
|
|
51
|
+
setFrontendOptions = _useState6[1];
|
|
39
52
|
var checkAll = options.length === innerValue.length;
|
|
40
53
|
var indeterminate = innerValue.length > 0 && innerValue.length < options.length;
|
|
41
54
|
var handleCheckBoxChange = function handleCheckBoxChange(changedValue) {
|
|
42
55
|
console.log('changedValue :>> ', changedValue);
|
|
43
56
|
setInnerValue(changedValue);
|
|
44
57
|
};
|
|
58
|
+
|
|
59
|
+
// const handleConfirm = () => {
|
|
60
|
+
// onChange(innerValue);
|
|
61
|
+
// onCloseFilterPanel();
|
|
62
|
+
// };
|
|
63
|
+
|
|
64
|
+
// const handleReset = () => {
|
|
65
|
+
// setInnerValue([]);
|
|
66
|
+
// onChange([]);
|
|
67
|
+
// };
|
|
68
|
+
|
|
45
69
|
var handleConfirm = function handleConfirm() {
|
|
46
|
-
onChange(innerValue);
|
|
70
|
+
onChange(innerValue, inputSearchValue);
|
|
47
71
|
onCloseFilterPanel();
|
|
48
72
|
};
|
|
49
73
|
var handleReset = function handleReset() {
|
|
50
74
|
setInnerValue([]);
|
|
51
|
-
|
|
75
|
+
setInputSearchValue(undefined);
|
|
76
|
+
onChange([], undefined);
|
|
52
77
|
};
|
|
53
|
-
useUpdateEffect(function () {
|
|
54
|
-
// console.log('value :>> ', value);
|
|
55
|
-
setInnerValue(Array.isArray(value) ? value : [value]);
|
|
56
|
-
}, [value.toString()]);
|
|
57
78
|
var onCheckAllChange = function onCheckAllChange(e) {
|
|
58
79
|
console.log('checkAll :>> ', e.target.checked);
|
|
59
80
|
var checkAll = e.target.checked;
|
|
@@ -65,12 +86,20 @@ var MultipleSelect = function MultipleSelect(_ref) {
|
|
|
65
86
|
setInnerValue([]);
|
|
66
87
|
}
|
|
67
88
|
};
|
|
89
|
+
useUpdateEffect(function () {
|
|
90
|
+
var _ref3 = value || {},
|
|
91
|
+
_ref3$filterValue = _ref3.filterValue,
|
|
92
|
+
filterValue = _ref3$filterValue === void 0 ? [] : _ref3$filterValue,
|
|
93
|
+
optionsParam = _ref3.optionsParam;
|
|
94
|
+
setInnerValue(Array.isArray(filterValue) ? filterValue : filterValue ? [filterValue] : []);
|
|
95
|
+
console.log('value :>> ', value);
|
|
96
|
+
setInputSearchValue(optionsParam);
|
|
97
|
+
}, [JSON.stringify(filterValue), optionsParam]);
|
|
68
98
|
var handleInputChange = function handleInputChange(e) {
|
|
69
99
|
var value = e.target.value;
|
|
100
|
+
setInputSearchValue(value);
|
|
70
101
|
if (!isFrontSearch) {
|
|
71
102
|
onSearch(value);
|
|
72
|
-
} else {
|
|
73
|
-
setFrontendSearchValue(value);
|
|
74
103
|
}
|
|
75
104
|
};
|
|
76
105
|
|
|
@@ -79,18 +108,33 @@ var MultipleSelect = function MultipleSelect(_ref) {
|
|
|
79
108
|
if (!isFrontSearch) {
|
|
80
109
|
return options;
|
|
81
110
|
}
|
|
82
|
-
var input = (
|
|
111
|
+
var input = (inputSearchValue !== null && inputSearchValue !== void 0 ? inputSearchValue : '').toUpperCase().trim();
|
|
83
112
|
return options.filter(function (option) {
|
|
84
113
|
var _option$label;
|
|
85
114
|
var optionFilterString = ('' + ((_option$label = option.label) !== null && _option$label !== void 0 ? _option$label : option.children)).toUpperCase().trim();
|
|
86
115
|
return optionFilterString.indexOf(input) !== -1;
|
|
87
116
|
});
|
|
88
|
-
}, [options,
|
|
117
|
+
}, [options, inputSearchValue]);
|
|
118
|
+
|
|
119
|
+
// // 最终的可选值
|
|
120
|
+
// const finalOptions = useMemo(() => {
|
|
121
|
+
// if (!isFrontSearch) {
|
|
122
|
+
// return options;
|
|
123
|
+
// }
|
|
124
|
+
// const input = (frontendSearchValue ?? '').toUpperCase().trim();
|
|
125
|
+
// return options.filter(option => {
|
|
126
|
+
// const optionFilterString = ('' + (option.label ?? option.children)).toUpperCase().trim();
|
|
127
|
+
// return optionFilterString.indexOf(input) !== -1;
|
|
128
|
+
// });
|
|
129
|
+
// }, [options, frontendSearchValue]);
|
|
130
|
+
|
|
89
131
|
return /*#__PURE__*/_jsxs("div", {
|
|
90
132
|
className: "tableMax-filter-multipleSelect",
|
|
91
133
|
children: [/*#__PURE__*/_jsx("div", {
|
|
92
134
|
className: "tableMax-filter-multipleSelect-header",
|
|
93
135
|
children: /*#__PURE__*/_jsx(Input, {
|
|
136
|
+
defaultValue: inputSearchValue,
|
|
137
|
+
value: inputSearchValue,
|
|
94
138
|
placeholder: t('global.placeholder.input'),
|
|
95
139
|
onChange: handleInputChange,
|
|
96
140
|
allowClear: true
|
|
@@ -5,9 +5,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
5
|
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; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { useTranslation } from "../../../../../hooks/useTranslation";
|
|
8
|
+
import { useUpdateEffect } from 'ahooks';
|
|
8
9
|
import { Button, Input, Spin } from 'antd';
|
|
9
10
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
10
11
|
import "./index.less";
|
|
12
|
+
import { isEmpty } from '..';
|
|
11
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
15
|
var SingleSelect = function SingleSelect(_ref) {
|
|
@@ -54,7 +56,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
54
56
|
setInputSearchValue(undefined);
|
|
55
57
|
onChange(undefined, undefined);
|
|
56
58
|
};
|
|
57
|
-
|
|
59
|
+
useUpdateEffect(function () {
|
|
58
60
|
console.log('value :>> ', value);
|
|
59
61
|
var _ref3 = value || {},
|
|
60
62
|
filterValue = _ref3.filterValue,
|
|
@@ -75,7 +77,7 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
75
77
|
};
|
|
76
78
|
// 首次加载,已选item滚动到可视区
|
|
77
79
|
useEffect(function () {
|
|
78
|
-
if (
|
|
80
|
+
if (isEmpty(value) || isEmpty(value === null || value === void 0 ? void 0 : value.filterValue) || Array.isArray(options) && options.length === 0 || !isFirstScroll.current) return;
|
|
79
81
|
// 滚动到选中的项目
|
|
80
82
|
function scrollToSelectedItem() {
|
|
81
83
|
var selectedElement = document.querySelector(".item[data-id=".concat(value.filterValue, "]"));
|
|
@@ -3,5 +3,6 @@ declare const customFilterFns: {
|
|
|
3
3
|
fuzzyFilter: (row: any, columnId: any, filterValue: any) => boolean;
|
|
4
4
|
multiSelectFilter: (row: any, columnId: any, filterValue: any) => any;
|
|
5
5
|
numberRangeFilter: (row: any, columnId: any, filterValue: any) => boolean;
|
|
6
|
+
singleSelectFilter: (row: any, columnId: any, filterValue: any) => boolean;
|
|
6
7
|
};
|
|
7
8
|
export default customFilterFns;
|
|
@@ -15,10 +15,21 @@ var fuzzyFilter = function fuzzyFilter(row, columnId, filterValue) {
|
|
|
15
15
|
return rowStringValue.toUpperCase().indexOf(filterStringValue.toUpperCase().trim()) !== -1;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
// singleSelect使用的模糊筛选
|
|
19
|
+
var singleSelectFilter = function singleSelectFilter(row, columnId, filterValue) {
|
|
20
|
+
var _row$getValue2;
|
|
21
|
+
var value = filterValue.filterValue;
|
|
22
|
+
var filterStringValue = (value !== null && value !== void 0 ? value : '') + '';
|
|
23
|
+
var rowStringValue = ((_row$getValue2 = row.getValue(columnId)) !== null && _row$getValue2 !== void 0 ? _row$getValue2 : '') + '';
|
|
24
|
+
// console.log('object :>> ', rowStringValue, filterStringValue);
|
|
25
|
+
return rowStringValue.toUpperCase().indexOf(filterStringValue.toUpperCase().trim()) !== -1;
|
|
26
|
+
};
|
|
27
|
+
|
|
18
28
|
// 多选筛选
|
|
19
29
|
var multiSelectFilter = function multiSelectFilter(row, columnId, filterValue) {
|
|
30
|
+
var value = filterValue.filterValue;
|
|
20
31
|
var rowValue = row.getValue(columnId);
|
|
21
|
-
return
|
|
32
|
+
return value === null || value === void 0 ? void 0 : value.includes(rowValue + '');
|
|
22
33
|
};
|
|
23
34
|
|
|
24
35
|
// 数字范围筛选
|
|
@@ -49,6 +60,7 @@ var customFilterFns = {
|
|
|
49
60
|
timeRangeFilter: timeRangeFilter,
|
|
50
61
|
fuzzyFilter: fuzzyFilter,
|
|
51
62
|
multiSelectFilter: multiSelectFilter,
|
|
52
|
-
numberRangeFilter: numberRangeFilter
|
|
63
|
+
numberRangeFilter: numberRangeFilter,
|
|
64
|
+
singleSelectFilter: singleSelectFilter
|
|
53
65
|
};
|
|
54
66
|
export default customFilterFns;
|
|
@@ -36,7 +36,7 @@ export var FilterType = /*#__PURE__*/function (FilterType) {
|
|
|
36
36
|
return FilterType;
|
|
37
37
|
}({}); // 输入框
|
|
38
38
|
// 不同筛选类型需要特定的过滤函数
|
|
39
|
-
var FILTER_FN_ENUM = (_FILTER_FN_ENUM = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_FILTER_FN_ENUM, FilterType.Date, 'timeRangeFilter'), FilterType.DateRange, 'timeRangeFilter'), FilterType.SingleDate, 'fuzzyFilter'), FilterType.MultiSelect, 'multiSelectFilter'), FilterType.Integer, 'numberRangeFilter'), FilterType.NumberRange, 'numberRangeFilter'), FilterType.SingleInteger, 'fuzzyFilter'), FilterType.SingleNumber, 'fuzzyFilter'), FilterType.SingleSelect, '
|
|
39
|
+
var FILTER_FN_ENUM = (_FILTER_FN_ENUM = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_FILTER_FN_ENUM, FilterType.Date, 'timeRangeFilter'), FilterType.DateRange, 'timeRangeFilter'), FilterType.SingleDate, 'fuzzyFilter'), FilterType.MultiSelect, 'multiSelectFilter'), FilterType.Integer, 'numberRangeFilter'), FilterType.NumberRange, 'numberRangeFilter'), FilterType.SingleInteger, 'fuzzyFilter'), FilterType.SingleNumber, 'fuzzyFilter'), FilterType.SingleSelect, 'singleSelectFilter'), FilterType.AutoComplete, 'fuzzyFilter'), _defineProperty(_FILTER_FN_ENUM, FilterType.Input, 'fuzzyFilter'));
|
|
40
40
|
|
|
41
41
|
// 给columns配置填充默认的过滤函数
|
|
42
42
|
export function setDefaultFilterFn(columns) {
|
|
@@ -155,4 +155,9 @@ export function ColumnFilter(_ref) {
|
|
|
155
155
|
})
|
|
156
156
|
}), root ? document.querySelector(root) : document.body) : null]
|
|
157
157
|
});
|
|
158
|
+
}
|
|
159
|
+
export function isEmpty(value) {
|
|
160
|
+
if (value) return false;
|
|
161
|
+
if (value === false || value === 0) return false;
|
|
162
|
+
return true;
|
|
158
163
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { TableMaxColumnType } from "../../type";
|
|
2
|
-
export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
3
|
-
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
4
|
-
export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
5
|
-
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
2
|
+
export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
3
|
+
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
4
|
+
export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
5
|
+
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
6
6
|
declare const customSortFns: {
|
|
7
|
-
numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
8
|
-
stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
9
|
-
timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
10
|
-
numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
7
|
+
numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
8
|
+
stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
9
|
+
timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
10
|
+
numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
11
11
|
};
|
|
12
12
|
export default customSortFns;
|
|
13
13
|
export type SortFnType = keyof typeof customSortFns | undefined;
|
|
@@ -124,7 +124,7 @@ export var getFormatFilters = function getFormatFilters(columns, originFilters)
|
|
|
124
124
|
formatFilters["".concat(formatKey, "To")] = value === null || value === void 0 ? void 0 : value[1];
|
|
125
125
|
} else if (filterType === FilterType.MultiSelect || !filterType) {
|
|
126
126
|
// 多选组件
|
|
127
|
-
formatFilters["".concat(formatKey, "List")] = value;
|
|
127
|
+
formatFilters["".concat(formatKey, "List")] = value.filterValue;
|
|
128
128
|
// formatFilters[formatKey] = value;
|
|
129
129
|
} else if (filterType === FilterType.SingleSelect) {
|
|
130
130
|
// 单选组件
|
|
@@ -196,7 +196,7 @@ export var getFormatFiltersV2 = function getFormatFiltersV2(columns, originFilte
|
|
|
196
196
|
} else if (filterType === FilterType.MultiSelect || !filterType) {
|
|
197
197
|
// 多选组件
|
|
198
198
|
res.operator = FilterOperator.In;
|
|
199
|
-
res.value = value;
|
|
199
|
+
res.value = value.filterValue;
|
|
200
200
|
} else if (filterType === FilterType.Input || filterType === FilterType.AutoComplete) {
|
|
201
201
|
// Input组件
|
|
202
202
|
res.operator = FilterOperator.Contains;
|