@arim-aisdc/public-components 2.3.67 → 2.3.69
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/OriginalRow.js +3 -3
- package/dist/components/TableMax/TableMax.js +27 -11
- package/dist/components/TableMax/components/ColumnFilterV2/Filter.js +39 -6
- package/dist/components/TableMax/components/ColumnFilterV2/MultipleSelect/index.js +15 -1
- package/dist/components/TableMax/components/ColumnFilterV2/SingleSelect/index.js +27 -10
- package/dist/components/TableMax/components/ColumnFilterV2/customFilterFns.js +25 -2
- package/dist/components/TableMax/components/ColumnFilterV2/index.less +7 -0
- package/dist/components/TableMax/components/ColumnSort/customSortFns.d.ts +8 -8
- package/dist/components/TableMax/hooks/useColumnWidth.js +1 -24
- package/dist/components/TableMax/hooks/useHoverDetection.d.ts +1 -0
- package/dist/components/TableMax/hooks/useHoverDetection.js +69 -0
- package/dist/components/TableMax/utils.js +9 -4
- package/dist/themes/variablesConfig.js +1 -1
- package/package.json +1 -1
|
@@ -477,10 +477,10 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
477
477
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
478
478
|
children: [!!getRowHoverTipConfig ? /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipConfig), {}, {
|
|
479
479
|
onOpenChange: onOpenChange,
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
destroyOnHidden: false,
|
|
481
|
+
classNames: {
|
|
482
|
+
root: 'table-max-row-tooltip-wrapper'
|
|
482
483
|
},
|
|
483
|
-
overlayClassName: "table-max-row-tooltip-wrapper",
|
|
484
484
|
getPopupContainer: function getPopupContainer() {
|
|
485
485
|
return tableBodyRef.current || document.body;
|
|
486
486
|
},
|
|
@@ -39,6 +39,7 @@ import { downloadExcel, getFormatFilters, getFormatFiltersV2, getFormatSorting,
|
|
|
39
39
|
import { useTableScrollShadow } from "./hooks/useTableScrollShadow";
|
|
40
40
|
import { ExportTableData } from "./components/Export";
|
|
41
41
|
import UnifiedTable from "./UnifiedTable";
|
|
42
|
+
import { useHoverDetection } from "./hooks/useHoverDetection";
|
|
42
43
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
43
44
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
44
45
|
export var ColumnType = /*#__PURE__*/function (ColumnType) {
|
|
@@ -415,6 +416,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
415
416
|
});
|
|
416
417
|
}
|
|
417
418
|
};
|
|
419
|
+
console.log(tableDatas, 'tableDatas');
|
|
418
420
|
|
|
419
421
|
// table
|
|
420
422
|
var table = useReactTable({
|
|
@@ -1062,6 +1064,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
1062
1064
|
getDynamicFilterOptionsFn: getDynamicFilterOptionsFn,
|
|
1063
1065
|
tableHeaderRef: tableHeaderRef
|
|
1064
1066
|
};
|
|
1067
|
+
console.log(table.getRowModel().rows, 'table.getRowModel().rows');
|
|
1065
1068
|
var tableBodyProps = {
|
|
1066
1069
|
tableContentRef: tableContentRef,
|
|
1067
1070
|
tableBodyRef: tableBodyRef,
|
|
@@ -1130,6 +1133,19 @@ var TableMax = function TableMax(_ref) {
|
|
|
1130
1133
|
setCompactMode(compactMode);
|
|
1131
1134
|
setRowHeight(newHeight);
|
|
1132
1135
|
};
|
|
1136
|
+
|
|
1137
|
+
// 在你的组件中使用
|
|
1138
|
+
// const tableBodyRef = useRef(null);
|
|
1139
|
+
var isHovered = useHoverDetection(tableBodyRef);
|
|
1140
|
+
useEffect(function () {
|
|
1141
|
+
if (tableBodyRef.current) {
|
|
1142
|
+
if (isHovered) {
|
|
1143
|
+
tableBodyRef.current.classList.add('hover-active');
|
|
1144
|
+
} else {
|
|
1145
|
+
tableBodyRef.current.classList.remove('hover-active');
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
}, [isHovered]);
|
|
1133
1149
|
return /*#__PURE__*/_jsx(Form, {
|
|
1134
1150
|
form: form,
|
|
1135
1151
|
component: false,
|
|
@@ -1304,17 +1320,17 @@ var TableMax = function TableMax(_ref) {
|
|
|
1304
1320
|
className: "table-body",
|
|
1305
1321
|
style: {
|
|
1306
1322
|
width: "100%"
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1323
|
+
}
|
|
1324
|
+
// onMouseEnter={() => {
|
|
1325
|
+
// // 给当前元素添加hover类
|
|
1326
|
+
// tableBodyRef.current?.classList.add('hover-active');
|
|
1327
|
+
|
|
1328
|
+
// }}
|
|
1329
|
+
// onMouseLeave={() => {
|
|
1330
|
+
// // 移除当前元素的hover类
|
|
1331
|
+
// tableBodyRef.current?.classList.remove('hover-active');
|
|
1332
|
+
// }}
|
|
1333
|
+
,
|
|
1318
1334
|
children: /*#__PURE__*/_jsx(UnifiedTable, {
|
|
1319
1335
|
tableId: tableId,
|
|
1320
1336
|
table: table,
|
|
@@ -20,6 +20,7 @@ import MultipleSelect from "./MultipleSelect";
|
|
|
20
20
|
import NumberRange from "./NumberRange";
|
|
21
21
|
import SingleSelect from "./SingleSelect";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
24
|
var Filter = function Filter(_ref) {
|
|
24
25
|
var getDynamicFilterOptionsFn = _ref.getDynamicFilterOptionsFn,
|
|
25
26
|
column = _ref.column,
|
|
@@ -295,9 +296,9 @@ var Filter = function Filter(_ref) {
|
|
|
295
296
|
})
|
|
296
297
|
});
|
|
297
298
|
case FilterType.AutoComplete:
|
|
298
|
-
return /*#__PURE__*/
|
|
299
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
299
300
|
className: "single-com-wrapper",
|
|
300
|
-
children: /*#__PURE__*/_jsx(AutoComplete, {
|
|
301
|
+
children: [/*#__PURE__*/_jsx(AutoComplete, {
|
|
301
302
|
options: options,
|
|
302
303
|
placeholder: "",
|
|
303
304
|
filterOption: !!getFilterOptionsFn ? false : function (inputValue, option) {
|
|
@@ -314,12 +315,28 @@ var Filter = function Filter(_ref) {
|
|
|
314
315
|
},
|
|
315
316
|
allowClear: true,
|
|
316
317
|
value: columnFilterValue
|
|
317
|
-
})
|
|
318
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
319
|
+
className: "quickly-input",
|
|
320
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
321
|
+
className: "quickly-input-title",
|
|
322
|
+
children: "\u5FEB\u6377\u8F93\u5165"
|
|
323
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
324
|
+
onClick: function onClick() {
|
|
325
|
+
handleChangeFilterValueWithDebounce('NULL');
|
|
326
|
+
},
|
|
327
|
+
children: "\u7A7A\u503C(NULL)"
|
|
328
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
329
|
+
onClick: function onClick() {
|
|
330
|
+
handleChangeFilterValueWithDebounce('NOT NULL');
|
|
331
|
+
},
|
|
332
|
+
children: "\u975E\u7A7A\u503C(NOT NULL)"
|
|
333
|
+
})]
|
|
334
|
+
})]
|
|
318
335
|
});
|
|
319
336
|
case FilterType.Input:
|
|
320
|
-
return /*#__PURE__*/
|
|
337
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
321
338
|
className: "single-com-wrapper",
|
|
322
|
-
children: /*#__PURE__*/_jsx(Input, {
|
|
339
|
+
children: [/*#__PURE__*/_jsx(Input, {
|
|
323
340
|
onChange: function onChange(e) {
|
|
324
341
|
return handleChangeFilterValueWithDebounce(e.target.value);
|
|
325
342
|
},
|
|
@@ -329,7 +346,23 @@ var Filter = function Filter(_ref) {
|
|
|
329
346
|
allowClear: true,
|
|
330
347
|
value: columnFilterValue,
|
|
331
348
|
placeholder: t('global.placeholder.input')
|
|
332
|
-
})
|
|
349
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
350
|
+
className: "quickly-input",
|
|
351
|
+
children: [/*#__PURE__*/_jsx("p", {
|
|
352
|
+
className: "quickly-input-title",
|
|
353
|
+
children: "\u5FEB\u6377\u8F93\u5165"
|
|
354
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
355
|
+
onClick: function onClick() {
|
|
356
|
+
handleChangeFilterValueWithDebounce('NULL');
|
|
357
|
+
},
|
|
358
|
+
children: "\u7A7A\u503C(NULL)"
|
|
359
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
360
|
+
onClick: function onClick() {
|
|
361
|
+
handleChangeFilterValueWithDebounce('NOT NULL');
|
|
362
|
+
},
|
|
363
|
+
children: "\u975E\u7A7A\u503C(NOT NULL)"
|
|
364
|
+
})]
|
|
365
|
+
})]
|
|
333
366
|
});
|
|
334
367
|
case FilterType.SingleSelect:
|
|
335
368
|
return /*#__PURE__*/_jsx(SingleSelect, {
|
|
@@ -50,7 +50,9 @@ var MultipleSelect = function MultipleSelect(_ref) {
|
|
|
50
50
|
frontendOptions = _useState6[0],
|
|
51
51
|
setFrontendOptions = _useState6[1];
|
|
52
52
|
var checkAll = options.length === innerValue.length;
|
|
53
|
-
var indeterminate =
|
|
53
|
+
var indeterminate = useMemo(function () {
|
|
54
|
+
return innerValue.length > 0 && innerValue.length < options.length && JSON.stringify(innerValue) !== '["NULL"]';
|
|
55
|
+
}, [innerValue]);
|
|
54
56
|
var handleCheckBoxChange = function handleCheckBoxChange(changedValue) {
|
|
55
57
|
console.log('changedValue :>> ', changedValue);
|
|
56
58
|
setInnerValue(changedValue);
|
|
@@ -146,6 +148,18 @@ var MultipleSelect = function MultipleSelect(_ref) {
|
|
|
146
148
|
children: /*#__PURE__*/_jsx(Spin, {})
|
|
147
149
|
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
148
150
|
children: [/*#__PURE__*/_jsx(Checkbox, {
|
|
151
|
+
checked: JSON.stringify(innerValue) === '["NULL"]',
|
|
152
|
+
onChange: function onChange(e) {
|
|
153
|
+
var _e$target;
|
|
154
|
+
console.log(innerValue);
|
|
155
|
+
if (e !== null && e !== void 0 && (_e$target = e.target) !== null && _e$target !== void 0 && _e$target.checked) {
|
|
156
|
+
setInnerValue(['NULL']);
|
|
157
|
+
} else {
|
|
158
|
+
setInnerValue([]);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
children: "\u7A7A\u503C(NULL)"
|
|
162
|
+
}), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx(Checkbox, {
|
|
149
163
|
indeterminate: indeterminate,
|
|
150
164
|
onChange: onCheckAllChange,
|
|
151
165
|
checked: checkAll,
|
|
@@ -80,14 +80,21 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
80
80
|
if (isEmpty(value) || isEmpty(value === null || value === void 0 ? void 0 : value.filterValue) || Array.isArray(options) && options.length === 0 || !isFirstScroll.current) return;
|
|
81
81
|
// 滚动到选中的项目
|
|
82
82
|
function scrollToSelectedItem() {
|
|
83
|
-
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
83
|
+
// 确保 value.filterValue 存在且不是 undefined/null
|
|
84
|
+
if ((value === null || value === void 0 ? void 0 : value.filterValue) == null) return;
|
|
85
|
+
|
|
86
|
+
// 转换为字符串并转义特殊字符
|
|
87
|
+
var id = String(value.filterValue);
|
|
88
|
+
var selector = ".item[data-id=\"".concat(CSS.escape(id), "\"]");
|
|
89
|
+
var selectedElement = document.querySelector(selector);
|
|
90
|
+
if (!selectedElement) {
|
|
91
|
+
console.warn("Element with data-id=\"".concat(id, "\" not found"));
|
|
92
|
+
return;
|
|
90
93
|
}
|
|
94
|
+
selectedElement.scrollIntoView({
|
|
95
|
+
behavior: 'smooth',
|
|
96
|
+
block: 'center'
|
|
97
|
+
});
|
|
91
98
|
}
|
|
92
99
|
var timer = setTimeout(function () {
|
|
93
100
|
return scrollToSelectedItem();
|
|
@@ -99,16 +106,26 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
99
106
|
|
|
100
107
|
// 最终的可选值
|
|
101
108
|
var finalOptions = useMemo(function () {
|
|
109
|
+
var nullValueOptions = [{
|
|
110
|
+
label: '空值(NULL)',
|
|
111
|
+
value: 'NULL',
|
|
112
|
+
children: []
|
|
113
|
+
}, {
|
|
114
|
+
label: '非空值(NOT NULL)',
|
|
115
|
+
value: 'NOT NULL',
|
|
116
|
+
children: []
|
|
117
|
+
}].concat(options);
|
|
102
118
|
if (!isFrontSearch) {
|
|
103
|
-
return
|
|
119
|
+
return nullValueOptions;
|
|
104
120
|
}
|
|
105
121
|
var input = (inputSearchValue !== null && inputSearchValue !== void 0 ? inputSearchValue : '').toUpperCase().trim();
|
|
106
|
-
return
|
|
122
|
+
return nullValueOptions.filter(function (option) {
|
|
107
123
|
var _option$label;
|
|
108
|
-
var optionFilterString = ('' + ((_option$label = option.label) !== null && _option$label !== void 0 ? _option$label : option.children)).toUpperCase().trim();
|
|
124
|
+
var optionFilterString = ('' + ((_option$label = option.label) !== null && _option$label !== void 0 ? _option$label : option === null || option === void 0 ? void 0 : option.children)).toUpperCase().trim();
|
|
109
125
|
return optionFilterString.indexOf(input) !== -1;
|
|
110
126
|
});
|
|
111
127
|
}, [options, inputSearchValue]);
|
|
128
|
+
console.log(finalOptions, 'finalOptions');
|
|
112
129
|
return /*#__PURE__*/_jsxs("div", {
|
|
113
130
|
className: "tableMax-filter-singleSelect",
|
|
114
131
|
children: [/*#__PURE__*/_jsx("div", {
|
|
@@ -12,6 +12,16 @@ var fuzzyFilter = function fuzzyFilter(row, columnId, filterValue) {
|
|
|
12
12
|
var filterStringValue = (filterValue !== null && filterValue !== void 0 ? filterValue : '') + '';
|
|
13
13
|
var rowStringValue = ((_row$getValue = row.getValue(columnId)) !== null && _row$getValue !== void 0 ? _row$getValue : '') + '';
|
|
14
14
|
// console.log('object :>> ', rowStringValue, filterStringValue);
|
|
15
|
+
// 处理 null 搜索
|
|
16
|
+
var filterUpper = filterStringValue.toUpperCase().trim();
|
|
17
|
+
if (filterUpper === 'NULL') {
|
|
18
|
+
return rowStringValue === ''; // 空值包括 null, undefined, 空字符串等
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// 处理 not null 搜索
|
|
22
|
+
if (filterUpper === 'NOT NULL' || filterUpper === 'NOTNULL') {
|
|
23
|
+
return rowStringValue !== ''; // 非空值
|
|
24
|
+
}
|
|
15
25
|
return rowStringValue.toUpperCase().indexOf(filterStringValue.toUpperCase().trim()) !== -1;
|
|
16
26
|
};
|
|
17
27
|
|
|
@@ -22,14 +32,27 @@ var singleSelectFilter = function singleSelectFilter(row, columnId, filterValue)
|
|
|
22
32
|
var filterStringValue = (value !== null && value !== void 0 ? value : '') + '';
|
|
23
33
|
var rowStringValue = ((_row$getValue2 = row.getValue(columnId)) !== null && _row$getValue2 !== void 0 ? _row$getValue2 : '') + '';
|
|
24
34
|
// console.log('object :>> ', rowStringValue, filterStringValue);
|
|
35
|
+
var filterUpper = filterStringValue.toUpperCase().trim();
|
|
36
|
+
if (filterUpper === 'NULL') {
|
|
37
|
+
return rowStringValue === ''; // 空值包括 null, undefined, 空字符串等
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// 处理 not null 搜索
|
|
41
|
+
if (filterUpper === 'NOT NULL') {
|
|
42
|
+
return rowStringValue !== ''; // 非空值
|
|
43
|
+
}
|
|
25
44
|
return rowStringValue.toUpperCase().indexOf(filterStringValue.toUpperCase().trim()) !== -1;
|
|
26
45
|
};
|
|
27
46
|
|
|
28
47
|
// 多选筛选
|
|
29
48
|
var multiSelectFilter = function multiSelectFilter(row, columnId, filterValue) {
|
|
49
|
+
var _row$getValue3;
|
|
30
50
|
var value = filterValue.filterValue;
|
|
31
|
-
var
|
|
32
|
-
|
|
51
|
+
var rowStringValue = ((_row$getValue3 = row.getValue(columnId)) !== null && _row$getValue3 !== void 0 ? _row$getValue3 : '') + '';
|
|
52
|
+
if (JSON.stringify(value) === '["NULL"]') {
|
|
53
|
+
return rowStringValue === ''; // 空值包括 null, undefined, 空字符串等
|
|
54
|
+
}
|
|
55
|
+
return value === null || value === void 0 ? void 0 : value.includes(rowStringValue + '');
|
|
33
56
|
};
|
|
34
57
|
|
|
35
58
|
// 数字范围筛选
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { TableMaxColumnType } from "../../type";
|
|
2
|
-
export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
3
|
-
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
4
|
-
export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
5
|
-
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
2
|
+
export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
3
|
+
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
4
|
+
export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
5
|
+
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
6
6
|
declare const customSortFns: {
|
|
7
|
-
numberSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
8
|
-
stringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
9
|
-
timeSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
10
|
-
numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
7
|
+
numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
8
|
+
stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
9
|
+
timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
10
|
+
numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
11
11
|
};
|
|
12
12
|
export default customSortFns;
|
|
13
13
|
export type SortFnType = keyof typeof customSortFns | undefined;
|
|
@@ -19,7 +19,7 @@ import { getSizeInfo } from "../utils";
|
|
|
19
19
|
var DEFAULT_MIN_SIZE = 120;
|
|
20
20
|
var DEFAULT_MAX_SIZE = 2000;
|
|
21
21
|
var DEFAULT_RESIZE_DEBOUNCE = 200;
|
|
22
|
-
var DEFAULT_TABLE_PADDING =
|
|
22
|
+
var DEFAULT_TABLE_PADDING = 12;
|
|
23
23
|
// const DEFAULT_TABLE_PADDING = 0;
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -163,7 +163,6 @@ export var useColumnWidth = function useColumnWidth(_ref) {
|
|
|
163
163
|
*/
|
|
164
164
|
var calculateColumnSizing = useCallback(function (columnsSizeMap, allColumnCount, containerWidth) {
|
|
165
165
|
var currentWidth = containerWidth || state.tableContainerWidth || getTableWidth();
|
|
166
|
-
console.log(containerWidth, tableContentRef.current.clientWidth, state.tableContainerWidth, getTableWidth());
|
|
167
166
|
if (!currentWidth) return columnsSizeMap;
|
|
168
167
|
var result = _objectSpread({}, columnsSizeMap);
|
|
169
168
|
var adjustableColumns = getAdjustableColumns(result);
|
|
@@ -198,18 +197,6 @@ export var useColumnWidth = function useColumnWidth(_ref) {
|
|
|
198
197
|
result[key] = Math.min(result[key] + averageExtra, DEFAULT_MAX_SIZE);
|
|
199
198
|
});
|
|
200
199
|
}
|
|
201
|
-
|
|
202
|
-
// console.log({
|
|
203
|
-
// currentWidth,
|
|
204
|
-
// columnsSizeMap,
|
|
205
|
-
// adjustableColumns,
|
|
206
|
-
// hasWidthColumns,
|
|
207
|
-
// noWidthColumns,
|
|
208
|
-
// totalWidth,
|
|
209
|
-
// remainWidth,
|
|
210
|
-
// result
|
|
211
|
-
// }, 'hasWidthColumns')
|
|
212
|
-
|
|
213
200
|
return result;
|
|
214
201
|
}, [getAdjustableColumns, getTableWidth, state.tableContainerWidth]);
|
|
215
202
|
|
|
@@ -262,16 +249,6 @@ export var useColumnWidth = function useColumnWidth(_ref) {
|
|
|
262
249
|
});
|
|
263
250
|
}
|
|
264
251
|
|
|
265
|
-
// console.log({
|
|
266
|
-
// prevState,
|
|
267
|
-
// initColumnsSizeMap,
|
|
268
|
-
// visibleColumnsSizeMap,
|
|
269
|
-
// cache,
|
|
270
|
-
// cacheMaxAge,
|
|
271
|
-
// tableContentRef: tableContentRef.current
|
|
272
|
-
|
|
273
|
-
// }, 'columnSizeMap123')
|
|
274
|
-
|
|
275
252
|
// 计算可见列数
|
|
276
253
|
var visibleCount = allCount - Object.keys(columnVisibleConfig).filter(function (key) {
|
|
277
254
|
return !columnVisibleConfig[key];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useHoverDetection: (ref: any) => boolean;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
|
|
9
|
+
// useHoverDetection.js
|
|
10
|
+
export var useHoverDetection = function useHoverDetection(ref) {
|
|
11
|
+
var _useState = useState(false),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
isHovered = _useState2[0],
|
|
14
|
+
setIsHovered = _useState2[1];
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
var element = ref.current;
|
|
17
|
+
if (!element) return;
|
|
18
|
+
var isInside = false;
|
|
19
|
+
var timeoutId = null;
|
|
20
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
21
|
+
clearTimeout(timeoutId);
|
|
22
|
+
if (!isInside) {
|
|
23
|
+
isInside = true;
|
|
24
|
+
setIsHovered(true);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
28
|
+
timeoutId = setTimeout(function () {
|
|
29
|
+
isInside = false;
|
|
30
|
+
setIsHovered(false);
|
|
31
|
+
}, 100); // 防抖延迟
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// 使用 document 级别的监听,避免事件冒泡问题
|
|
35
|
+
var handleDocumentMouseMove = function handleDocumentMouseMove(e) {
|
|
36
|
+
if (!element) return;
|
|
37
|
+
var rect = element.getBoundingClientRect();
|
|
38
|
+
var isMouseInside = e.clientX >= rect.left && e.clientX <= rect.right && e.clientY >= rect.top && e.clientY <= rect.bottom;
|
|
39
|
+
if (isMouseInside && !isInside) {
|
|
40
|
+
handleMouseEnter();
|
|
41
|
+
} else if (!isMouseInside && isInside) {
|
|
42
|
+
handleMouseLeave();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// 初始检查
|
|
47
|
+
var handleInitialCheck = function handleInitialCheck() {
|
|
48
|
+
// 触发一次鼠标移动检查
|
|
49
|
+
document.dispatchEvent(new MouseEvent('mousemove'));
|
|
50
|
+
};
|
|
51
|
+
document.addEventListener('mousemove', handleDocumentMouseMove);
|
|
52
|
+
window.addEventListener('load', handleInitialCheck);
|
|
53
|
+
|
|
54
|
+
// 页面显示时重新检查
|
|
55
|
+
var handleVisibilityChange = function handleVisibilityChange() {
|
|
56
|
+
if (!document.hidden) {
|
|
57
|
+
setTimeout(handleInitialCheck, 100);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
61
|
+
return function () {
|
|
62
|
+
document.removeEventListener('mousemove', handleDocumentMouseMove);
|
|
63
|
+
window.removeEventListener('load', handleInitialCheck);
|
|
64
|
+
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
65
|
+
clearTimeout(timeoutId);
|
|
66
|
+
};
|
|
67
|
+
}, [ref]);
|
|
68
|
+
return isHovered;
|
|
69
|
+
};
|
|
@@ -197,15 +197,20 @@ export var getFormatFiltersV2 = function getFormatFiltersV2(columns, originFilte
|
|
|
197
197
|
}
|
|
198
198
|
} else if (filterType === FilterType.MultiSelect || !filterType) {
|
|
199
199
|
// 多选组件
|
|
200
|
-
res.operator = FilterOperator.In;
|
|
201
200
|
res.value = value.filterValue;
|
|
201
|
+
res.operator = JSON.stringify(res.value) === '["NULL"]' ? FilterOperator.IsNull : FilterOperator.In;
|
|
202
202
|
} else if (filterType === FilterType.Input || filterType === FilterType.AutoComplete) {
|
|
203
|
+
var _value$toUpperCase;
|
|
203
204
|
// Input组件
|
|
204
|
-
|
|
205
|
-
res.
|
|
205
|
+
var upperValue = value === null || value === void 0 || (_value$toUpperCase = value.toUpperCase()) === null || _value$toUpperCase === void 0 ? void 0 : _value$toUpperCase.trim();
|
|
206
|
+
res.value = splitString(value + '');
|
|
207
|
+
res.operator = upperValue === 'NULL' ? FilterOperator.IsNull : upperValue === 'NOT NULL' || upperValue === 'NOTNULL' ? FilterOperator.IsNotNull : typeof res.value === 'string' ? FilterOperator.Contains : FilterOperator.In;
|
|
206
208
|
} else if (filterType === FilterType.SingleSelect) {
|
|
207
|
-
|
|
209
|
+
var _res$value;
|
|
210
|
+
// 单选组件
|
|
208
211
|
res.value = value.filterValue;
|
|
212
|
+
var _upperValue = typeof res.value === 'string' ? (_res$value = res.value) === null || _res$value === void 0 ? void 0 : _res$value.toUpperCase() : res.value;
|
|
213
|
+
res.operator = _upperValue === 'NULL' ? FilterOperator.IsNull : _upperValue === 'NOT NULL' ? FilterOperator.IsNotNull : FilterOperator.Eq;
|
|
209
214
|
} else {
|
|
210
215
|
// 其他组件: SingleDate/SingleNumber
|
|
211
216
|
res.operator = FilterOperator.Eq;
|
|
@@ -141,7 +141,7 @@ export var PublicThemeVariablesConfig = {
|
|
|
141
141
|
'--global-messageTip-background-color': '#0c1b3b',
|
|
142
142
|
'--global-messageTip-text-color': '#eaeaea',
|
|
143
143
|
'--global-messageTip-box-shadow': '0px 5px 12px 4px rgba(3,5,33,0.45)',
|
|
144
|
-
'--global-sort-flag-color': '#
|
|
144
|
+
'--global-sort-flag-color': '#242A30'
|
|
145
145
|
}),
|
|
146
146
|
dark: _objectSpread(_objectSpread({
|
|
147
147
|
'--global-curd-input-background-color': '#494c5dff',
|