@arim-aisdc/public-components 2.2.8-alpha.0 → 2.2.8
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/assets/iconfont/table/iconfont.css +61 -81
- package/dist/assets/iconfont/table/iconfont.ttf +0 -0
- package/dist/components/BaseInfo/BaseInfo.d.ts +1 -1
- package/dist/components/CustomForm/CustomForm.js +1 -1
- package/dist/components/CustomForm/type.d.ts +3 -1
- package/dist/components/TableMax/TableBody/Row.js +3 -1
- package/dist/components/TableMax/TableHeader/Cell.d.ts +1 -2
- package/dist/components/TableMax/TableHeader/Cell.js +16 -17
- package/dist/components/TableMax/TableHeader/index.js +19 -8
- package/dist/components/TableMax/TableHeader/index.less +0 -7
- package/dist/components/TableMax/TableMax.js +4 -6
- package/dist/components/TableMax/components/{ColumnFilterV2/DateRange → ColumnFilter/FilterDateRange}/index.d.ts +1 -1
- package/dist/components/TableMax/components/ColumnFilter/FilterDateRange/index.js +101 -0
- package/dist/components/TableMax/components/{ColumnFilterV2/DateRange → ColumnFilter/FilterDateRange}/index.less +5 -5
- package/dist/components/TableMax/components/{ColumnFilterV2 → ColumnFilter}/MultipleSelect/index.d.ts +1 -3
- package/dist/components/TableMax/components/ColumnFilter/MultipleSelect/index.js +52 -0
- package/dist/components/TableMax/components/ColumnFilter/MultipleSelect/index.less +20 -0
- package/dist/components/TableMax/components/{ColumnFilterV2 → ColumnFilter}/SingleSelect/index.js +10 -15
- package/dist/components/TableMax/components/{ColumnFilterV2 → ColumnFilter}/SingleSelect/index.less +2 -3
- package/dist/components/TableMax/components/{ColumnFilterV2 → ColumnFilter}/customFilterFns.js +1 -1
- package/dist/components/TableMax/components/{ColumnFilterV2 → ColumnFilter}/index.d.ts +1 -14
- package/dist/components/TableMax/components/{ColumnFilterV2/Filter.js → ColumnFilter/index.js} +221 -167
- package/dist/components/TableMax/components/ColumnSetting/index.js +13 -4
- package/dist/components/TableMax/components/ColumnSort/customSortFns.js +8 -43
- package/dist/components/TableMax/components/ColumnSort/index.js +1 -8
- package/dist/components/TableMax/components/ColumnSort/index.less +4 -6
- package/dist/components/TableMax/index.d.ts +2 -2
- package/dist/components/TableMax/index.js +1 -1
- package/dist/components/TableMax/type.d.ts +4 -32
- package/dist/components/TableMax/type.js +1 -21
- package/dist/components/TableMax/utils.d.ts +2 -3
- package/dist/components/TableMax/utils.js +17 -82
- package/dist/utils/request.d.ts +3 -4
- package/dist/utils/request.js +4 -4
- package/package.json +1 -1
- package/dist/components/TableMax/components/ColumnFilterV2/DateRange/index.js +0 -85
- package/dist/components/TableMax/components/ColumnFilterV2/Filter.d.ts +0 -8
- package/dist/components/TableMax/components/ColumnFilterV2/MultipleSelect/index.js +0 -124
- package/dist/components/TableMax/components/ColumnFilterV2/MultipleSelect/index.less +0 -32
- package/dist/components/TableMax/components/ColumnFilterV2/NumberRange/index.d.ts +0 -10
- package/dist/components/TableMax/components/ColumnFilterV2/NumberRange/index.js +0 -98
- package/dist/components/TableMax/components/ColumnFilterV2/NumberRange/index.less +0 -27
- package/dist/components/TableMax/components/ColumnFilterV2/index.js +0 -144
- package/dist/components/TableMax/components/ColumnFilterV2/index.less +0 -23
- /package/dist/components/TableMax/components/{ColumnFilterV2 → ColumnFilter}/SingleSelect/index.d.ts +0 -0
- /package/dist/components/TableMax/components/{ColumnFilterV2 → ColumnFilter}/customFilterFns.d.ts +0 -0
|
@@ -1,81 +1,61 @@
|
|
|
1
|
-
@font-face {
|
|
2
|
-
font-family: "iconfont-table"; /* Project id 4453758 */
|
|
3
|
-
src: url('iconfont.ttf?t=
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.iconfont-table {
|
|
7
|
-
font-family: "iconfont-table" !important;
|
|
8
|
-
font-size: 16px;
|
|
9
|
-
font-style: normal;
|
|
10
|
-
-webkit-font-smoothing: antialiased;
|
|
11
|
-
-moz-osx-font-smoothing: grayscale;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.icon-table-
|
|
15
|
-
content: "\
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.icon-table-
|
|
19
|
-
content: "\
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.icon-table-
|
|
23
|
-
content: "\
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.icon-table-
|
|
27
|
-
content: "\
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.icon-table-
|
|
31
|
-
content: "\
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.icon-table-
|
|
35
|
-
content: "\
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.icon-table-
|
|
39
|
-
content: "\
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.icon-table-
|
|
43
|
-
content: "\
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.icon-table-
|
|
47
|
-
content: "\
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.icon-table-
|
|
51
|
-
content: "\
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.icon-table-
|
|
55
|
-
content: "\
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.icon-table-
|
|
59
|
-
content: "\
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.icon-table-upload:before {
|
|
63
|
-
content: "\e878";
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.icon-table-download:before {
|
|
67
|
-
content: "\e87a";
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.icon-table-shezhi:before {
|
|
71
|
-
content: "\e643";
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.icon-table-zhexian:before {
|
|
75
|
-
content: "\e644";
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.icon-table-biaoge:before {
|
|
79
|
-
content: "\e645";
|
|
80
|
-
}
|
|
81
|
-
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "iconfont-table"; /* Project id 4453758 */
|
|
3
|
+
src: url('./iconfont.ttf?t=1730099737796') format('truetype');
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.iconfont-table {
|
|
7
|
+
font-family: "iconfont-table" !important;
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
font-style: normal;
|
|
10
|
+
-webkit-font-smoothing: antialiased;
|
|
11
|
+
-moz-osx-font-smoothing: grayscale;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.icon-table-a-xinzeng21:before {
|
|
15
|
+
content: "\e62e";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.icon-table-a-download11:before {
|
|
19
|
+
content: "\e62f";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.icon-table-tight:before {
|
|
23
|
+
content: "\e87e";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.icon-table-normal:before {
|
|
27
|
+
content: "\e87f";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.icon-table-shenglvehao:before {
|
|
31
|
+
content: "\e62d";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.icon-table-delete:before {
|
|
35
|
+
content: "\e87c";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.icon-table-shuaxin:before {
|
|
39
|
+
content: "\e87b";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.icon-table-upload:before {
|
|
43
|
+
content: "\e878";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.icon-table-download:before {
|
|
47
|
+
content: "\e87a";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.icon-table-shezhi:before {
|
|
51
|
+
content: "\e643";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.icon-table-zhexian:before {
|
|
55
|
+
content: "\e644";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.icon-table-biaoge:before {
|
|
59
|
+
content: "\e645";
|
|
60
|
+
}
|
|
61
|
+
|
|
Binary file
|
|
@@ -17,7 +17,7 @@ export declare const foramtBaseInfoField: (data: any, dataField: BaseInfoFieldTy
|
|
|
17
17
|
value: any;
|
|
18
18
|
field: string;
|
|
19
19
|
label?: string;
|
|
20
|
-
text: string |
|
|
20
|
+
text: string | Element | JSX.Element;
|
|
21
21
|
units?: string;
|
|
22
22
|
width?: string;
|
|
23
23
|
labelWidth?: string;
|
|
@@ -398,7 +398,7 @@ var CustomForm = function CustomForm(_ref, ref) {
|
|
|
398
398
|
break;
|
|
399
399
|
case CustomFormItemType.DateTime:
|
|
400
400
|
element = /*#__PURE__*/_jsx(DatePicker, {
|
|
401
|
-
showTime: true,
|
|
401
|
+
showTime: (item === null || item === void 0 ? void 0 : item.showTime) === undefined ? true : item === null || item === void 0 ? void 0 : item.showTime,
|
|
402
402
|
picker: (item === null || item === void 0 ? void 0 : item.picker) || 'date',
|
|
403
403
|
style: {
|
|
404
404
|
width: item !== null && item !== void 0 && item.wapperWidth ? item === null || item === void 0 ? void 0 : item.wapperWidth : '100%'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { TimePickerProps, TimeRangePickerProps } from 'antd';
|
|
1
2
|
import { FormProps } from 'antd';
|
|
2
3
|
import { FormLabelAlign } from 'antd/es/form/interface';
|
|
3
4
|
import { MouseEventHandler, ReactNode } from 'react';
|
|
4
|
-
import type { TimeRangePickerProps, TimePickerProps } from 'antd';
|
|
5
5
|
export interface fieldType {
|
|
6
6
|
field: string;
|
|
7
7
|
label?: string;
|
|
@@ -127,6 +127,8 @@ export type CustomSearchFieldType = {
|
|
|
127
127
|
method?: 'POST' | 'PUT' | 'PATCH';
|
|
128
128
|
/**预设常用的日期范围 { label: React.ReactNode, value: Dayjs | (() => Dayjs) | Dayjs[] }[]*/
|
|
129
129
|
presets?: TimeRangePickerProps['presets'] | TimePickerProps['presets'];
|
|
130
|
+
/**是否展示时间(默认为true:展示时间) */
|
|
131
|
+
showTime?: boolean;
|
|
130
132
|
};
|
|
131
133
|
export interface CustomFormProps {
|
|
132
134
|
data: CustomSearchFieldType[];
|
|
@@ -360,7 +360,9 @@ var Row = function Row(_ref) {
|
|
|
360
360
|
},
|
|
361
361
|
children: !!(tableBodyRef !== null && tableBodyRef !== void 0 && (_tableBodyRef$current = tableBodyRef.current) !== null && _tableBodyRef$current !== void 0 && _tableBodyRef$current.clientWidth) && /*#__PURE__*/_jsx("div", {
|
|
362
362
|
id: "".concat(tableId, "_expand-table"),
|
|
363
|
-
className: "subRowWrapper"
|
|
363
|
+
className: "subRowWrapper"
|
|
364
|
+
// 减去10,避免被父表滚动条覆盖
|
|
365
|
+
,
|
|
364
366
|
style: {
|
|
365
367
|
width: "".concat(tableBodyRef === null || tableBodyRef === void 0 || (_tableBodyRef$current2 = tableBodyRef.current) === null || _tableBodyRef$current2 === void 0 ? void 0 : _tableBodyRef$current2.clientWidth, "px")
|
|
366
368
|
},
|
|
@@ -12,7 +12,6 @@ type ICellType = {
|
|
|
12
12
|
columnResizeMode: ColumnResizeMode;
|
|
13
13
|
disableColumnDrag?: boolean;
|
|
14
14
|
headerRowNum: number;
|
|
15
|
-
canFilter?: boolean;
|
|
16
15
|
};
|
|
17
|
-
declare const Cell: ({ tableContentRef, header, table, hasGroup, canSorting, getHeaderCellProps, disableColumnDrag, headerRowNum,
|
|
16
|
+
declare const Cell: ({ tableContentRef, header, table, hasGroup, canSorting, getHeaderCellProps, disableColumnDrag, headerRowNum, }: ICellType) => import("react/jsx-runtime").JSX.Element;
|
|
18
17
|
export default Cell;
|
|
@@ -22,7 +22,6 @@ import { useDrag, useDrop } from 'react-dnd';
|
|
|
22
22
|
import { createPortal } from 'react-dom';
|
|
23
23
|
import { useConfig } from "../../ConfigProvider";
|
|
24
24
|
import { ColumnType } from "../TableMax";
|
|
25
|
-
import { ColumnFilter } from "../components/ColumnFilterV2";
|
|
26
25
|
import Sort from "../components/ColumnSort";
|
|
27
26
|
import "./index.less";
|
|
28
27
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -40,8 +39,7 @@ var Cell = function Cell(_ref) {
|
|
|
40
39
|
canSorting = _ref.canSorting,
|
|
41
40
|
getHeaderCellProps = _ref.getHeaderCellProps,
|
|
42
41
|
disableColumnDrag = _ref.disableColumnDrag,
|
|
43
|
-
headerRowNum = _ref.headerRowNum
|
|
44
|
-
canFilter = _ref.canFilter;
|
|
42
|
+
headerRowNum = _ref.headerRowNum;
|
|
45
43
|
var _useConfig = useConfig(),
|
|
46
44
|
root = _useConfig.root;
|
|
47
45
|
var cannotDragColumn = [ColumnType.Darg, ColumnType.Selection, ColumnType.Expander, ColumnType.PlaceHolder];
|
|
@@ -88,10 +86,7 @@ var Cell = function Cell(_ref) {
|
|
|
88
86
|
initPosition = _useState2[0],
|
|
89
87
|
setInitPosition = _useState2[1];
|
|
90
88
|
return /*#__PURE__*/_jsxs("div", {
|
|
91
|
-
ref:
|
|
92
|
-
dropRef(node);
|
|
93
|
-
dragRef(disableColumnDrag || cannotDragColumn.includes(header.column.id) || header.column.getIsPinned() ? null : node);
|
|
94
|
-
},
|
|
89
|
+
ref: dropRef,
|
|
95
90
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
96
91
|
className: "cell-wapper ".concat(columns ? 'wapper-top-parent' : '', " table-max-header-cell-wrapper"),
|
|
97
92
|
ref: previewRef,
|
|
@@ -107,13 +102,13 @@ var Cell = function Cell(_ref) {
|
|
|
107
102
|
y: y
|
|
108
103
|
});
|
|
109
104
|
},
|
|
110
|
-
children: [/*#__PURE__*/
|
|
105
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
111
106
|
className: "cell-left",
|
|
112
107
|
onClick: header.column.getToggleSortingHandler(),
|
|
113
108
|
style: {
|
|
114
109
|
textAlign: columns ? 'center' : 'left'
|
|
115
110
|
},
|
|
116
|
-
children: !cannotDragColumn.includes(header.column.id) ? /*#__PURE__*/_jsx(Tooltip, {
|
|
111
|
+
children: [!cannotDragColumn.includes(header.column.id) ? /*#__PURE__*/_jsx(Tooltip, {
|
|
117
112
|
placement: "topLeft"
|
|
118
113
|
// @ts-ignore
|
|
119
114
|
,
|
|
@@ -130,15 +125,17 @@ var Cell = function Cell(_ref) {
|
|
|
130
125
|
})
|
|
131
126
|
}) :
|
|
132
127
|
// @ts-ignore
|
|
133
|
-
flexRender(columnDef.header, header.getContext())
|
|
134
|
-
}), !cannotDragColumn.includes(header.column.id) ? /*#__PURE__*/_jsxs("div", {
|
|
135
|
-
className: "cell-right",
|
|
136
|
-
children: [canSorting && header.column.getCanSort() ? /*#__PURE__*/_jsx(Sort, {
|
|
128
|
+
flexRender(columnDef.header, header.getContext()), canSorting ? /*#__PURE__*/_jsx(Sort, {
|
|
137
129
|
sort: header.column.getIsSorted()
|
|
138
|
-
}) : null, canFilter && columnDef.enableColumnFilter !== false ? /*#__PURE__*/_jsx(ColumnFilter, {
|
|
139
|
-
column: header.column
|
|
140
130
|
}) : null]
|
|
141
|
-
})
|
|
131
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
132
|
+
className: "cell-right",
|
|
133
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
134
|
+
children: disableColumnDrag || cannotDragColumn.includes(header.column.id) || header.column.getIsPinned() ? null : /*#__PURE__*/_jsx("i", {
|
|
135
|
+
ref: dragRef,
|
|
136
|
+
className: "icon iconfont-other icon-other-drag drag-handler"
|
|
137
|
+
})
|
|
138
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
142
139
|
className: "cell-resize-handler ".concat(header.column.getIsResizing() ? 'column-is-resizing' : ''),
|
|
143
140
|
onMouseDown: header.getResizeHandler(),
|
|
144
141
|
onTouchStart: header.getResizeHandler()
|
|
@@ -151,7 +148,9 @@ var Cell = function Cell(_ref) {
|
|
|
151
148
|
height: (_tableContentRef$curr = tableContentRef.current) === null || _tableContentRef$curr === void 0 ? void 0 : _tableContentRef$curr.clientHeight,
|
|
152
149
|
transform: "translateX(".concat(table.getState().columnSizingInfo.deltaOffset || 0, "px)")
|
|
153
150
|
}
|
|
154
|
-
}),
|
|
151
|
+
}),
|
|
152
|
+
// document.body,
|
|
153
|
+
root ? document.querySelector(root) : document.body) : null]
|
|
155
154
|
});
|
|
156
155
|
};
|
|
157
156
|
export default Cell;
|
|
@@ -7,15 +7,14 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
7
7
|
// import { Column, flexRender } from '@tanstack/react-table';
|
|
8
8
|
// import { useDrag, useDrop } from 'ahooks';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
import { Filter } from "../components/ColumnFilter";
|
|
12
11
|
import Cell from "./Cell";
|
|
13
12
|
import "./index.less";
|
|
14
13
|
import { getPinningStyle } from "./utils";
|
|
15
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
16
|
var TableHeader = function TableHeader(_ref) {
|
|
18
|
-
var _headerGroups;
|
|
17
|
+
var _headerGroups, _headerGroups2;
|
|
19
18
|
var tableContentRef = _ref.tableContentRef,
|
|
20
19
|
table = _ref.table,
|
|
21
20
|
canFilter = _ref.canFilter,
|
|
@@ -41,8 +40,8 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
41
40
|
width: size
|
|
42
41
|
}, header.id);
|
|
43
42
|
})
|
|
44
|
-
}), /*#__PURE__*/
|
|
45
|
-
children: headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map(function (headerGroup) {
|
|
43
|
+
}), /*#__PURE__*/_jsxs("thead", {
|
|
44
|
+
children: [headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map(function (headerGroup) {
|
|
46
45
|
return /*#__PURE__*/_jsx("tr", {
|
|
47
46
|
className: "table-thead-tr cus-table-thead-tr",
|
|
48
47
|
style: {
|
|
@@ -63,13 +62,25 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
63
62
|
getHeaderCellProps: getHeaderCellProps,
|
|
64
63
|
columnResizeMode: columnResizeMode,
|
|
65
64
|
disableColumnDrag: disableColumnDrag,
|
|
66
|
-
headerRowNum: headerRowNum
|
|
67
|
-
canFilter: canFilter
|
|
65
|
+
headerRowNum: headerRowNum
|
|
68
66
|
}, header.id)
|
|
69
67
|
}, header.id);
|
|
70
68
|
})
|
|
71
69
|
}, headerGroup.id);
|
|
72
|
-
})
|
|
70
|
+
}), canFilter && enableFilters ? /*#__PURE__*/_jsx("tr", {
|
|
71
|
+
className: "table-filter-tr",
|
|
72
|
+
children: headerGroups === null || headerGroups === void 0 || (_headerGroups2 = headerGroups[headerGroups.length - 1]) === null || _headerGroups2 === void 0 || (_headerGroups2 = _headerGroups2.headers) === null || _headerGroups2 === void 0 ? void 0 : _headerGroups2.map(function (header) {
|
|
73
|
+
return /*#__PURE__*/_jsx("th", {
|
|
74
|
+
style: _objectSpread({}, getPinningStyle(header, table)),
|
|
75
|
+
className: "table-filter-th ".concat(header.id === leftLastColumnId ? 'thead-tr-th-cell-fix-left-last' : '', " ").concat(header.id === rightFirstColumnId ? 'thead-tr-th-cell-fix-right-first' : ''),
|
|
76
|
+
children: header.column.getCanFilter() ? /*#__PURE__*/_jsx("div", {
|
|
77
|
+
children: /*#__PURE__*/_jsx(Filter, {
|
|
78
|
+
column: header.column
|
|
79
|
+
})
|
|
80
|
+
}) : null
|
|
81
|
+
}, header.id + '1');
|
|
82
|
+
})
|
|
83
|
+
}, "table-filter-tr") : null]
|
|
73
84
|
})]
|
|
74
85
|
});
|
|
75
86
|
};
|
|
@@ -41,7 +41,6 @@ table {
|
|
|
41
41
|
white-space: nowrap;
|
|
42
42
|
display: flex;
|
|
43
43
|
align-items: center;
|
|
44
|
-
justify-content: space-between;
|
|
45
44
|
|
|
46
45
|
.cell-left-header {
|
|
47
46
|
display: -webkit-box;
|
|
@@ -57,12 +56,6 @@ table {
|
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
.cell-right {
|
|
61
|
-
display: flex;
|
|
62
|
-
gap: 4px;
|
|
63
|
-
align-items: center;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
59
|
.drag-handler {
|
|
67
60
|
color: @tableColor3;
|
|
68
61
|
display: none;
|
|
@@ -29,14 +29,14 @@ import { useConfig } from "../ConfigProvider";
|
|
|
29
29
|
import TableBody from "./TableBody";
|
|
30
30
|
import TableHeader from "./TableHeader";
|
|
31
31
|
import { InputType } from "./components/ColumnEdit";
|
|
32
|
-
import { setDefaultFilterFn } from "./components/
|
|
33
|
-
import customFilterFns from "./components/
|
|
32
|
+
import { setDefaultFilterFn } from "./components/ColumnFilter";
|
|
33
|
+
import customFilterFns from "./components/ColumnFilter/customFilterFns";
|
|
34
34
|
import ColumnSetting from "./components/ColumnSetting";
|
|
35
35
|
import customSortFns, { setDefaultSortFn } from "./components/ColumnSort/customSortFns";
|
|
36
36
|
import PaginationV2 from "./components/PaginationV2";
|
|
37
37
|
import { useColumnWidth } from "./hooks/useColumnWidth";
|
|
38
38
|
import "./tableMax.less";
|
|
39
|
-
import { downloadExcel, getFormatFilters,
|
|
39
|
+
import { downloadExcel, getFormatFilters, getFormatSorting, operationColumnNoTooltips } from "./utils";
|
|
40
40
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
41
41
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
42
42
|
export var ColumnType = /*#__PURE__*/function (ColumnType) {
|
|
@@ -646,7 +646,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
646
646
|
|
|
647
647
|
// 筛选回调
|
|
648
648
|
useEffect(function () {
|
|
649
|
-
console.log('columnFilters :>> ', tableId, columnFilters);
|
|
650
649
|
var filteredRowModel = table.getRowModel();
|
|
651
650
|
var filteredData = filteredRowModel.rows.map(function (item) {
|
|
652
651
|
return item.original;
|
|
@@ -661,8 +660,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
661
660
|
filteredData: filteredData,
|
|
662
661
|
filteredRowModel: filteredRowModel,
|
|
663
662
|
filters: columnFilters,
|
|
664
|
-
formatFilters: getFormatFilters(columns, columnFilters)
|
|
665
|
-
formatFiltersV2: getFormatFiltersV2(columns, columnFilters) // 动态化查询格式:https://arim-jyzx.coding.net/p/infra/wiki/3252
|
|
663
|
+
formatFilters: getFormatFilters(columns, columnFilters)
|
|
666
664
|
});
|
|
667
665
|
}
|
|
668
666
|
}, [JSON.stringify(columnFilters), manualFiltering, tableId]);
|
|
@@ -11,6 +11,6 @@ interface IProps {
|
|
|
11
11
|
} | undefined;
|
|
12
12
|
columnDef: TableMaxColumnType;
|
|
13
13
|
}
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const FilterDateRange: ({ onChange, value, columnDef }: IProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export declare const timeRangeFilter: (row: any, columnId: any, filterValue: any) => boolean;
|
|
16
16
|
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { DatePicker } from 'antd';
|
|
2
|
+
import { TableContext } from "../../../TableMax";
|
|
3
|
+
import { defaultDateFormat } from "../index";
|
|
4
|
+
import "./index.less";
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
import { useContext } from 'react';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export var FilterDateRange = function FilterDateRange(_ref) {
|
|
10
|
+
var _columnDef$filterComP, _columnDef$filterComP2, _columnDef$filterComP3, _columnDef$filterComP4, _columnDef$filterComP5;
|
|
11
|
+
var onChange = _ref.onChange,
|
|
12
|
+
value = _ref.value,
|
|
13
|
+
columnDef = _ref.columnDef;
|
|
14
|
+
var _useContext = useContext(TableContext),
|
|
15
|
+
manualFiltering = _useContext.manualFiltering;
|
|
16
|
+
var format = ((_columnDef$filterComP = columnDef.filterComProps) === null || _columnDef$filterComP === void 0 ? void 0 : _columnDef$filterComP.format) || defaultDateFormat;
|
|
17
|
+
var disabledStartDate = function disabledStartDate(current) {
|
|
18
|
+
if (!(value !== null && value !== void 0 && value.endDate)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return current && current > dayjs(value === null || value === void 0 ? void 0 : value.endDate);
|
|
22
|
+
};
|
|
23
|
+
var disabledEndDate = function disabledEndDate(current) {
|
|
24
|
+
if (!(value !== null && value !== void 0 && value.startDate)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return current && current < dayjs(value === null || value === void 0 ? void 0 : value.startDate);
|
|
28
|
+
};
|
|
29
|
+
var onStartDateChange = function onStartDateChange(date) {
|
|
30
|
+
var newRange = {
|
|
31
|
+
startDate: date ? manualFiltering ? date.format(format) // 后端筛选时,向外传递字符串格式的时间
|
|
32
|
+
: dayjs(date.format(format)).valueOf() // 去掉精确度后面的时间:先格式化为字符串、再转为dayjs、再转为时间戳,
|
|
33
|
+
: null,
|
|
34
|
+
endDate: (value === null || value === void 0 ? void 0 : value.endDate) || null
|
|
35
|
+
};
|
|
36
|
+
if (newRange.startDate === null && newRange.endDate === null) {
|
|
37
|
+
onChange(undefined);
|
|
38
|
+
} else {
|
|
39
|
+
onChange(newRange);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// 计算结束时间,精确度时间后的时间取结束时间,比如精确到小时,那么分钟取59分,秒取59秒,毫秒取999毫秒
|
|
44
|
+
var calEndTime = function calEndTime(endTime) {
|
|
45
|
+
if (format.endsWith('MM')) {
|
|
46
|
+
return endTime.endOf('month');
|
|
47
|
+
} else if (format.endsWith('DD')) {
|
|
48
|
+
return endTime.endOf('day');
|
|
49
|
+
} else if (format.endsWith('HH')) {
|
|
50
|
+
return endTime.endOf('hour');
|
|
51
|
+
} else if (format.endsWith('mm')) {
|
|
52
|
+
return endTime.endOf('minute');
|
|
53
|
+
} else if (format.endsWith('ss')) {
|
|
54
|
+
return endTime.endOf('second');
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var onEndDateChange = function onEndDateChange(date) {
|
|
58
|
+
var newRange = {
|
|
59
|
+
startDate: (value === null || value === void 0 ? void 0 : value.startDate) || null,
|
|
60
|
+
endDate: date ? manualFiltering ? date.format(format) // 后端筛选时,向外传递字符串格式的时间
|
|
61
|
+
: calEndTime(date).valueOf() : null
|
|
62
|
+
};
|
|
63
|
+
if (newRange.startDate === null && newRange.endDate === null) {
|
|
64
|
+
onChange(undefined);
|
|
65
|
+
} else {
|
|
66
|
+
onChange(newRange);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
70
|
+
className: "date-range-filter-wapper",
|
|
71
|
+
children: [/*#__PURE__*/_jsx(DatePicker, {
|
|
72
|
+
value: value !== null && value !== void 0 && value.startDate ? dayjs(value === null || value === void 0 ? void 0 : value.startDate) : undefined,
|
|
73
|
+
disabledDate: disabledStartDate,
|
|
74
|
+
showTime: (_columnDef$filterComP2 = columnDef.filterComProps) === null || _columnDef$filterComP2 === void 0 ? void 0 : _columnDef$filterComP2.showTime,
|
|
75
|
+
format: format,
|
|
76
|
+
placeholder: "\u5F00\u59CB\u65F6\u95F4",
|
|
77
|
+
picker: ((_columnDef$filterComP3 = columnDef.filterComProps) === null || _columnDef$filterComP3 === void 0 ? void 0 : _columnDef$filterComP3.picker) || 'date',
|
|
78
|
+
onChange: onStartDateChange
|
|
79
|
+
}), /*#__PURE__*/_jsx("p", {
|
|
80
|
+
className: "split-wapper",
|
|
81
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
82
|
+
className: "horizontal-line"
|
|
83
|
+
})
|
|
84
|
+
}), /*#__PURE__*/_jsx(DatePicker, {
|
|
85
|
+
value: value !== null && value !== void 0 && value.endDate ? dayjs(value === null || value === void 0 ? void 0 : value.endDate) : undefined,
|
|
86
|
+
disabledDate: disabledEndDate,
|
|
87
|
+
className: "end-time",
|
|
88
|
+
showTime: (_columnDef$filterComP4 = columnDef.filterComProps) === null || _columnDef$filterComP4 === void 0 ? void 0 : _columnDef$filterComP4.showTime,
|
|
89
|
+
format: format,
|
|
90
|
+
placeholder: "\u7ED3\u675F\u65F6\u95F4",
|
|
91
|
+
picker: ((_columnDef$filterComP5 = columnDef.filterComProps) === null || _columnDef$filterComP5 === void 0 ? void 0 : _columnDef$filterComP5.picker) || 'date',
|
|
92
|
+
onChange: onEndDateChange
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// 前端筛选时的过滤函数
|
|
98
|
+
export var timeRangeFilter = function timeRangeFilter(row, columnId, filterValue) {
|
|
99
|
+
var timeMs = new Date(row.getValue(columnId)).getTime() || 0;
|
|
100
|
+
return !(filterValue.startDate && timeMs < filterValue.startDate || filterValue.endDate && timeMs > filterValue.endDate);
|
|
101
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
.date-range-filter-
|
|
2
|
-
padding: 8px 12px;
|
|
1
|
+
.date-range-filter-wapper {
|
|
3
2
|
.split-wapper {
|
|
4
3
|
margin: 5px 0px 0px;
|
|
5
4
|
height: 2px;
|
|
@@ -18,7 +17,8 @@
|
|
|
18
17
|
margin: 5px 0px 0px;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
>
|
|
22
|
-
width: 100
|
|
20
|
+
>div {
|
|
21
|
+
width: 100%
|
|
23
22
|
}
|
|
24
|
-
|
|
23
|
+
|
|
24
|
+
}
|
|
@@ -5,8 +5,6 @@ interface IProps {
|
|
|
5
5
|
onChange: (value: any[]) => void;
|
|
6
6
|
onSearch: (value: string) => void;
|
|
7
7
|
isRemoteSearch: boolean;
|
|
8
|
-
loading: boolean;
|
|
9
|
-
onCloseFilterPanel: () => void;
|
|
10
8
|
}
|
|
11
|
-
declare const MultipleSelect: ({ value, onChange, options, onSearch, isRemoteSearch
|
|
9
|
+
declare const MultipleSelect: ({ value, onChange, options, onSearch, isRemoteSearch }: IProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
10
|
export default MultipleSelect;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { useUpdateEffect } from 'ahooks';
|
|
8
|
+
import { Select } from 'antd';
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { filterOptions } from "../../../utils";
|
|
11
|
+
import "./index.less";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
var MultipleSelect = function MultipleSelect(_ref) {
|
|
14
|
+
var _ref$value = _ref.value,
|
|
15
|
+
value = _ref$value === void 0 ? [] : _ref$value,
|
|
16
|
+
onChange = _ref.onChange,
|
|
17
|
+
options = _ref.options,
|
|
18
|
+
onSearch = _ref.onSearch,
|
|
19
|
+
isRemoteSearch = _ref.isRemoteSearch;
|
|
20
|
+
var _useState = useState(Array.isArray(value) ? value : [value]),
|
|
21
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
22
|
+
innerValue = _useState2[0],
|
|
23
|
+
setInnerValue = _useState2[1];
|
|
24
|
+
var handleChange = function handleChange(changedValue) {
|
|
25
|
+
// console.log('changedValue :>> ', changedValue);
|
|
26
|
+
setInnerValue(changedValue);
|
|
27
|
+
};
|
|
28
|
+
var handleBlur = function handleBlur() {
|
|
29
|
+
onChange(innerValue);
|
|
30
|
+
};
|
|
31
|
+
var handleClear = function handleClear() {
|
|
32
|
+
onChange([]);
|
|
33
|
+
};
|
|
34
|
+
useUpdateEffect(function () {
|
|
35
|
+
// console.log('value :>> ', value);
|
|
36
|
+
setInnerValue(Array.isArray(value) ? value : [value]);
|
|
37
|
+
}, [value.toString()]);
|
|
38
|
+
return /*#__PURE__*/_jsx(Select, {
|
|
39
|
+
mode: "multiple",
|
|
40
|
+
options: options,
|
|
41
|
+
allowClear: true,
|
|
42
|
+
removeIcon: null,
|
|
43
|
+
value: innerValue,
|
|
44
|
+
onBlur: handleBlur,
|
|
45
|
+
onClear: handleClear,
|
|
46
|
+
onChange: handleChange,
|
|
47
|
+
onSearch: onSearch,
|
|
48
|
+
className: "tableMax-filter-multipleSelect",
|
|
49
|
+
filterOption: isRemoteSearch ? false : filterOptions
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export default MultipleSelect;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.tableMax-filter-multipleSelect {
|
|
2
|
+
width: 100%;
|
|
3
|
+
border-radius: 2px;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
|
|
6
|
+
// padding: 0 2px;
|
|
7
|
+
.custom-dark-select-selection-overflow,
|
|
8
|
+
.custom-light-select-selection-overflow {
|
|
9
|
+
min-height: 31px;
|
|
10
|
+
max-height: 67px;
|
|
11
|
+
overflow-y: scroll;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.custom-dark-select-clear,
|
|
15
|
+
.custom-light-select-clear {
|
|
16
|
+
background: transparent;
|
|
17
|
+
right: 15px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}
|
package/dist/components/TableMax/components/{ColumnFilterV2 → ColumnFilter}/SingleSelect/index.js
RENAMED
|
@@ -11,22 +11,17 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
11
11
|
var handleClear = function handleClear() {
|
|
12
12
|
onChange('');
|
|
13
13
|
};
|
|
14
|
-
return /*#__PURE__*/_jsx(
|
|
14
|
+
return /*#__PURE__*/_jsx(Select, {
|
|
15
|
+
showSearch: true,
|
|
16
|
+
allowClear: true,
|
|
17
|
+
value: value,
|
|
18
|
+
suffixIcon: null,
|
|
19
|
+
options: options,
|
|
20
|
+
onChange: onChange,
|
|
21
|
+
onClear: handleClear,
|
|
22
|
+
onSearch: onSearch,
|
|
15
23
|
className: "tableMax-filter-singleSelect",
|
|
16
|
-
|
|
17
|
-
showSearch: true,
|
|
18
|
-
allowClear: true,
|
|
19
|
-
value: value,
|
|
20
|
-
suffixIcon: null,
|
|
21
|
-
options: options,
|
|
22
|
-
onChange: onChange,
|
|
23
|
-
onClear: handleClear,
|
|
24
|
-
onSearch: onSearch,
|
|
25
|
-
style: {
|
|
26
|
-
width: '100%'
|
|
27
|
-
},
|
|
28
|
-
filterOption: isRemoteSearch ? false : filterOptions
|
|
29
|
-
})
|
|
24
|
+
filterOption: isRemoteSearch ? false : filterOptions
|
|
30
25
|
});
|
|
31
26
|
};
|
|
32
27
|
export default SingleSelect;
|