@arim-aisdc/public-components 2.2.6 → 2.2.8-alpha.0
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 +81 -61
- package/dist/assets/iconfont/table/iconfont.ttf +0 -0
- package/dist/components/SplitterPane/SplitterPane.js +26 -1
- package/dist/components/TableMax/TableBody/Row.js +1 -3
- package/dist/components/TableMax/TableHeader/Cell.d.ts +2 -1
- package/dist/components/TableMax/TableHeader/Cell.js +17 -16
- package/dist/components/TableMax/TableHeader/index.js +8 -19
- package/dist/components/TableMax/TableHeader/index.less +7 -0
- package/dist/components/TableMax/TableMax.js +6 -4
- package/dist/components/TableMax/components/{ColumnFilter/FilterDateRange → ColumnFilterV2/DateRange}/index.d.ts +1 -1
- package/dist/components/TableMax/components/ColumnFilterV2/DateRange/index.js +85 -0
- package/dist/components/TableMax/components/{ColumnFilter/FilterDateRange → ColumnFilterV2/DateRange}/index.less +5 -5
- package/dist/components/TableMax/components/ColumnFilterV2/Filter.d.ts +8 -0
- package/dist/components/TableMax/components/{ColumnFilter/index.js → ColumnFilterV2/Filter.js} +167 -221
- package/dist/components/TableMax/components/{ColumnFilter → ColumnFilterV2}/MultipleSelect/index.d.ts +3 -1
- package/dist/components/TableMax/components/ColumnFilterV2/MultipleSelect/index.js +124 -0
- package/dist/components/TableMax/components/ColumnFilterV2/MultipleSelect/index.less +32 -0
- package/dist/components/TableMax/components/ColumnFilterV2/NumberRange/index.d.ts +10 -0
- package/dist/components/TableMax/components/ColumnFilterV2/NumberRange/index.js +98 -0
- package/dist/components/TableMax/components/ColumnFilterV2/NumberRange/index.less +27 -0
- package/dist/components/TableMax/components/{ColumnFilter → ColumnFilterV2}/SingleSelect/index.js +15 -10
- package/dist/components/TableMax/components/{ColumnFilter → ColumnFilterV2}/SingleSelect/index.less +3 -2
- package/dist/components/TableMax/components/{ColumnFilter → ColumnFilterV2}/customFilterFns.js +1 -1
- package/dist/components/TableMax/components/{ColumnFilter → ColumnFilterV2}/index.d.ts +14 -1
- package/dist/components/TableMax/components/ColumnFilterV2/index.js +144 -0
- package/dist/components/TableMax/components/ColumnFilterV2/index.less +23 -0
- package/dist/components/TableMax/components/ColumnSetting/index.js +4 -13
- package/dist/components/TableMax/components/ColumnSort/customSortFns.js +43 -8
- package/dist/components/TableMax/components/ColumnSort/index.js +8 -1
- package/dist/components/TableMax/components/ColumnSort/index.less +6 -4
- package/dist/components/TableMax/index.d.ts +2 -2
- package/dist/components/TableMax/index.js +1 -1
- package/dist/components/TableMax/type.d.ts +32 -4
- package/dist/components/TableMax/type.js +21 -1
- package/dist/components/TableMax/utils.d.ts +3 -2
- package/dist/components/TableMax/utils.js +82 -17
- package/dist/themes/variables.less +6 -0
- package/dist/themes/variablesConfig.js +12 -2
- package/dist/utils/request.d.ts +4 -3
- package/dist/utils/request.js +4 -4
- package/package.json +1 -1
- package/dist/components/TableMax/components/ColumnFilter/FilterDateRange/index.js +0 -101
- package/dist/components/TableMax/components/ColumnFilter/MultipleSelect/index.js +0 -52
- package/dist/components/TableMax/components/ColumnFilter/MultipleSelect/index.less +0 -20
- /package/dist/components/TableMax/components/{ColumnFilter → ColumnFilterV2}/SingleSelect/index.d.ts +0 -0
- /package/dist/components/TableMax/components/{ColumnFilter → ColumnFilterV2}/customFilterFns.d.ts +0 -0
|
@@ -1,61 +1,81 @@
|
|
|
1
|
-
@font-face {
|
|
2
|
-
font-family: "iconfont-table"; /* Project id 4453758 */
|
|
3
|
-
src: url('
|
|
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
|
-
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "iconfont-table"; /* Project id 4453758 */
|
|
3
|
+
src: url('iconfont.ttf?t=1740568199599') 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-sort:before {
|
|
15
|
+
content: "\e890";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.icon-table-filter:before {
|
|
19
|
+
content: "\e88e";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.icon-table-shengji:before {
|
|
23
|
+
content: "\e64a";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.icon-table-calendar:before {
|
|
27
|
+
content: "\e888";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.icon-table-edit:before {
|
|
31
|
+
content: "\e887";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.icon-table-pin:before {
|
|
35
|
+
content: "\e889";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.icon-table-drag:before {
|
|
39
|
+
content: "\e88d";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.icon-table-down:before {
|
|
43
|
+
content: "\e88f";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.icon-table-tight:before {
|
|
47
|
+
content: "\e87e";
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.icon-table-normal:before {
|
|
51
|
+
content: "\e87f";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.icon-table-delete:before {
|
|
55
|
+
content: "\e87c";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.icon-table-shuaxin:before {
|
|
59
|
+
content: "\e87b";
|
|
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
|
+
|
|
Binary file
|
|
@@ -1,3 +1,9 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
1
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
8
|
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
9
|
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); }
|
|
@@ -74,7 +80,26 @@ var SplitterPane = function SplitterPane(_ref) {
|
|
|
74
80
|
style: {
|
|
75
81
|
overflow: 'hidden'
|
|
76
82
|
},
|
|
77
|
-
children:
|
|
83
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
84
|
+
style: _objectSpread({}, layout === 'horizontal' ? index == 0 ? {
|
|
85
|
+
width: 'var(--global-splitter-panel-left-width, 100%)',
|
|
86
|
+
height: 'var(--global-splitter-panel-bottom-height, 100%)',
|
|
87
|
+
marginRight: 'var(--global-splitter-panel-margin, 0)'
|
|
88
|
+
} : {
|
|
89
|
+
width: 'var(--global-splitter-panel-right-width, 100%)',
|
|
90
|
+
height: 'var(--global-splitter-panel-bottom-height, 100%)',
|
|
91
|
+
marginLeft: 'var(--global-splitter-panel-margin, 0)'
|
|
92
|
+
} : index == 0 ? {
|
|
93
|
+
width: 'var(--global-splitter-panel-right-width, 100%)',
|
|
94
|
+
height: 'var(--global-splitter-panel-top-height, 100%)',
|
|
95
|
+
marginBottom: 'var(--global-splitter-panel-margin, 0)'
|
|
96
|
+
} : {
|
|
97
|
+
width: 'var(--global-splitter-panel-right-width, 100%)',
|
|
98
|
+
height: 'var(--global-splitter-panel-bottom-height, 100%)',
|
|
99
|
+
marginTop: 'var(--global-splitter-panel-margin, 0)'
|
|
100
|
+
}),
|
|
101
|
+
children: pane.children
|
|
102
|
+
})
|
|
78
103
|
}, index);
|
|
79
104
|
})
|
|
80
105
|
});
|
|
@@ -360,9 +360,7 @@ 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"
|
|
364
|
-
// 减去10,避免被父表滚动条覆盖
|
|
365
|
-
,
|
|
363
|
+
className: "subRowWrapper",
|
|
366
364
|
style: {
|
|
367
365
|
width: "".concat(tableBodyRef === null || tableBodyRef === void 0 || (_tableBodyRef$current2 = tableBodyRef.current) === null || _tableBodyRef$current2 === void 0 ? void 0 : _tableBodyRef$current2.clientWidth, "px")
|
|
368
366
|
},
|
|
@@ -12,6 +12,7 @@ type ICellType = {
|
|
|
12
12
|
columnResizeMode: ColumnResizeMode;
|
|
13
13
|
disableColumnDrag?: boolean;
|
|
14
14
|
headerRowNum: number;
|
|
15
|
+
canFilter?: boolean;
|
|
15
16
|
};
|
|
16
|
-
declare const Cell: ({ tableContentRef, header, table, hasGroup, canSorting, getHeaderCellProps, disableColumnDrag, headerRowNum, }: ICellType) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare const Cell: ({ tableContentRef, header, table, hasGroup, canSorting, getHeaderCellProps, disableColumnDrag, headerRowNum, canFilter, }: ICellType) => import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export default Cell;
|
|
@@ -22,6 +22,7 @@ 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";
|
|
25
26
|
import Sort from "../components/ColumnSort";
|
|
26
27
|
import "./index.less";
|
|
27
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -39,7 +40,8 @@ var Cell = function Cell(_ref) {
|
|
|
39
40
|
canSorting = _ref.canSorting,
|
|
40
41
|
getHeaderCellProps = _ref.getHeaderCellProps,
|
|
41
42
|
disableColumnDrag = _ref.disableColumnDrag,
|
|
42
|
-
headerRowNum = _ref.headerRowNum
|
|
43
|
+
headerRowNum = _ref.headerRowNum,
|
|
44
|
+
canFilter = _ref.canFilter;
|
|
43
45
|
var _useConfig = useConfig(),
|
|
44
46
|
root = _useConfig.root;
|
|
45
47
|
var cannotDragColumn = [ColumnType.Darg, ColumnType.Selection, ColumnType.Expander, ColumnType.PlaceHolder];
|
|
@@ -86,7 +88,10 @@ var Cell = function Cell(_ref) {
|
|
|
86
88
|
initPosition = _useState2[0],
|
|
87
89
|
setInitPosition = _useState2[1];
|
|
88
90
|
return /*#__PURE__*/_jsxs("div", {
|
|
89
|
-
ref:
|
|
91
|
+
ref: function ref(node) {
|
|
92
|
+
dropRef(node);
|
|
93
|
+
dragRef(disableColumnDrag || cannotDragColumn.includes(header.column.id) || header.column.getIsPinned() ? null : node);
|
|
94
|
+
},
|
|
90
95
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
91
96
|
className: "cell-wapper ".concat(columns ? 'wapper-top-parent' : '', " table-max-header-cell-wrapper"),
|
|
92
97
|
ref: previewRef,
|
|
@@ -102,13 +107,13 @@ var Cell = function Cell(_ref) {
|
|
|
102
107
|
y: y
|
|
103
108
|
});
|
|
104
109
|
},
|
|
105
|
-
children: [/*#__PURE__*/
|
|
110
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
106
111
|
className: "cell-left",
|
|
107
112
|
onClick: header.column.getToggleSortingHandler(),
|
|
108
113
|
style: {
|
|
109
114
|
textAlign: columns ? 'center' : 'left'
|
|
110
115
|
},
|
|
111
|
-
children:
|
|
116
|
+
children: !cannotDragColumn.includes(header.column.id) ? /*#__PURE__*/_jsx(Tooltip, {
|
|
112
117
|
placement: "topLeft"
|
|
113
118
|
// @ts-ignore
|
|
114
119
|
,
|
|
@@ -125,17 +130,15 @@ var Cell = function Cell(_ref) {
|
|
|
125
130
|
})
|
|
126
131
|
}) :
|
|
127
132
|
// @ts-ignore
|
|
128
|
-
flexRender(columnDef.header, header.getContext())
|
|
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, {
|
|
129
137
|
sort: header.column.getIsSorted()
|
|
138
|
+
}) : null, canFilter && columnDef.enableColumnFilter !== false ? /*#__PURE__*/_jsx(ColumnFilter, {
|
|
139
|
+
column: header.column
|
|
130
140
|
}) : null]
|
|
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", {
|
|
141
|
+
}) : null, /*#__PURE__*/_jsx("div", {
|
|
139
142
|
className: "cell-resize-handler ".concat(header.column.getIsResizing() ? 'column-is-resizing' : ''),
|
|
140
143
|
onMouseDown: header.getResizeHandler(),
|
|
141
144
|
onTouchStart: header.getResizeHandler()
|
|
@@ -148,9 +151,7 @@ var Cell = function Cell(_ref) {
|
|
|
148
151
|
height: (_tableContentRef$curr = tableContentRef.current) === null || _tableContentRef$curr === void 0 ? void 0 : _tableContentRef$curr.clientHeight,
|
|
149
152
|
transform: "translateX(".concat(table.getState().columnSizingInfo.deltaOffset || 0, "px)")
|
|
150
153
|
}
|
|
151
|
-
}),
|
|
152
|
-
// document.body,
|
|
153
|
-
root ? document.querySelector(root) : document.body) : null]
|
|
154
|
+
}), root ? document.querySelector(root) : document.body) : null]
|
|
154
155
|
});
|
|
155
156
|
};
|
|
156
157
|
export default Cell;
|
|
@@ -7,14 +7,15 @@ 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
|
-
import { Filter } from
|
|
10
|
+
// import { Filter } from '../components/ColumnFilter';
|
|
11
|
+
|
|
11
12
|
import Cell from "./Cell";
|
|
12
13
|
import "./index.less";
|
|
13
14
|
import { getPinningStyle } from "./utils";
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
var TableHeader = function TableHeader(_ref) {
|
|
17
|
-
var _headerGroups
|
|
18
|
+
var _headerGroups;
|
|
18
19
|
var tableContentRef = _ref.tableContentRef,
|
|
19
20
|
table = _ref.table,
|
|
20
21
|
canFilter = _ref.canFilter,
|
|
@@ -40,8 +41,8 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
40
41
|
width: size
|
|
41
42
|
}, header.id);
|
|
42
43
|
})
|
|
43
|
-
}), /*#__PURE__*/
|
|
44
|
-
children:
|
|
44
|
+
}), /*#__PURE__*/_jsx("thead", {
|
|
45
|
+
children: headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map(function (headerGroup) {
|
|
45
46
|
return /*#__PURE__*/_jsx("tr", {
|
|
46
47
|
className: "table-thead-tr cus-table-thead-tr",
|
|
47
48
|
style: {
|
|
@@ -62,25 +63,13 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
62
63
|
getHeaderCellProps: getHeaderCellProps,
|
|
63
64
|
columnResizeMode: columnResizeMode,
|
|
64
65
|
disableColumnDrag: disableColumnDrag,
|
|
65
|
-
headerRowNum: headerRowNum
|
|
66
|
+
headerRowNum: headerRowNum,
|
|
67
|
+
canFilter: canFilter
|
|
66
68
|
}, header.id)
|
|
67
69
|
}, header.id);
|
|
68
70
|
})
|
|
69
71
|
}, headerGroup.id);
|
|
70
|
-
})
|
|
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]
|
|
72
|
+
})
|
|
84
73
|
})]
|
|
85
74
|
});
|
|
86
75
|
};
|
|
@@ -41,6 +41,7 @@ table {
|
|
|
41
41
|
white-space: nowrap;
|
|
42
42
|
display: flex;
|
|
43
43
|
align-items: center;
|
|
44
|
+
justify-content: space-between;
|
|
44
45
|
|
|
45
46
|
.cell-left-header {
|
|
46
47
|
display: -webkit-box;
|
|
@@ -56,6 +57,12 @@ table {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
.cell-right {
|
|
61
|
+
display: flex;
|
|
62
|
+
gap: 4px;
|
|
63
|
+
align-items: center;
|
|
64
|
+
}
|
|
65
|
+
|
|
59
66
|
.drag-handler {
|
|
60
67
|
color: @tableColor3;
|
|
61
68
|
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/ColumnFilterV2";
|
|
33
|
+
import customFilterFns from "./components/ColumnFilterV2/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, getFormatSorting, operationColumnNoTooltips } from "./utils";
|
|
39
|
+
import { downloadExcel, getFormatFilters, getFormatFiltersV2, 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,6 +646,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
646
646
|
|
|
647
647
|
// 筛选回调
|
|
648
648
|
useEffect(function () {
|
|
649
|
+
console.log('columnFilters :>> ', tableId, columnFilters);
|
|
649
650
|
var filteredRowModel = table.getRowModel();
|
|
650
651
|
var filteredData = filteredRowModel.rows.map(function (item) {
|
|
651
652
|
return item.original;
|
|
@@ -660,7 +661,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
660
661
|
filteredData: filteredData,
|
|
661
662
|
filteredRowModel: filteredRowModel,
|
|
662
663
|
filters: columnFilters,
|
|
663
|
-
formatFilters: getFormatFilters(columns, columnFilters)
|
|
664
|
+
formatFilters: getFormatFilters(columns, columnFilters),
|
|
665
|
+
formatFiltersV2: getFormatFiltersV2(columns, columnFilters) // 动态化查询格式:https://arim-jyzx.coding.net/p/infra/wiki/3252
|
|
664
666
|
});
|
|
665
667
|
}
|
|
666
668
|
}, [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 DateRange: ({ 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,85 @@
|
|
|
1
|
+
import { DatePicker } from 'antd';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import { useContext } from 'react';
|
|
4
|
+
import { TableContext } from "../../../TableMax";
|
|
5
|
+
import { defaultDateFormat } from "../index";
|
|
6
|
+
import "./index.less";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
var defaultRangePresets = [{
|
|
9
|
+
label: '最近7天',
|
|
10
|
+
value: [dayjs().add(-7, 'd'), dayjs()]
|
|
11
|
+
}, {
|
|
12
|
+
label: '最近一个月',
|
|
13
|
+
value: [dayjs().add(-1, 'M'), dayjs()]
|
|
14
|
+
}, {
|
|
15
|
+
label: '最近三个月',
|
|
16
|
+
value: [dayjs().add(-3, 'M'), dayjs()]
|
|
17
|
+
}, {
|
|
18
|
+
label: '最近半年',
|
|
19
|
+
value: [dayjs().add(-6, 'M'), dayjs()]
|
|
20
|
+
}, {
|
|
21
|
+
label: '最近一年',
|
|
22
|
+
value: [dayjs().add(-1, 'y'), dayjs()]
|
|
23
|
+
}];
|
|
24
|
+
export var DateRange = function DateRange(_ref) {
|
|
25
|
+
var _columnDef$filterComP, _columnDef$filterComP2, _columnDef$filterComP3, _columnDef$filterComP4;
|
|
26
|
+
var onChange = _ref.onChange,
|
|
27
|
+
value = _ref.value,
|
|
28
|
+
columnDef = _ref.columnDef;
|
|
29
|
+
var _useContext = useContext(TableContext),
|
|
30
|
+
manualFiltering = _useContext.manualFiltering;
|
|
31
|
+
var format = ((_columnDef$filterComP = columnDef.filterComProps) === null || _columnDef$filterComP === void 0 ? void 0 : _columnDef$filterComP.format) || defaultDateFormat;
|
|
32
|
+
var rangePresets = ((_columnDef$filterComP2 = columnDef.filterComProps) === null || _columnDef$filterComP2 === void 0 ? void 0 : _columnDef$filterComP2.rangePresets) || defaultRangePresets;
|
|
33
|
+
|
|
34
|
+
// 计算结束时间,精确度时间后的时间取结束时间,比如精确到小时,那么分钟取59分,秒取59秒,毫秒取999毫秒
|
|
35
|
+
var calEndTime = function calEndTime(endTime) {
|
|
36
|
+
if (format.endsWith('MM')) {
|
|
37
|
+
return endTime.endOf('month');
|
|
38
|
+
} else if (format.endsWith('DD')) {
|
|
39
|
+
return endTime.endOf('day');
|
|
40
|
+
} else if (format.endsWith('HH')) {
|
|
41
|
+
return endTime.endOf('hour');
|
|
42
|
+
} else if (format.endsWith('mm')) {
|
|
43
|
+
return endTime.endOf('minute');
|
|
44
|
+
} else if (format.endsWith('ss')) {
|
|
45
|
+
return endTime.endOf('second');
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var onChangeDateRange = function onChangeDateRange(dates, dateStrings) {
|
|
49
|
+
console.log('dates :>> ', dates, dateStrings);
|
|
50
|
+
var newRange = {
|
|
51
|
+
startDate: dates && dates[0] ? manualFiltering ? dateStrings[0] // 后端筛选时,向外传递字符串格式的时间
|
|
52
|
+
: dayjs(dateStrings[0]).valueOf() // 去掉精确度后面的时间:把字符串转为dayjs、再转为时间戳,
|
|
53
|
+
: null,
|
|
54
|
+
endDate: dates && dates[1] ? manualFiltering ? dateStrings[1] // 后端筛选时,向外传递字符串格式的时间
|
|
55
|
+
: calEndTime(dates[1]).valueOf() : null
|
|
56
|
+
};
|
|
57
|
+
if (newRange.startDate === null && newRange.endDate === null) {
|
|
58
|
+
onChange(undefined);
|
|
59
|
+
} else {
|
|
60
|
+
onChange(newRange);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/_jsx("div", {
|
|
64
|
+
className: "date-range-filter-wrapper",
|
|
65
|
+
children: /*#__PURE__*/_jsx(DatePicker.RangePicker, {
|
|
66
|
+
presets: rangePresets && rangePresets.length > 0 ? rangePresets : undefined,
|
|
67
|
+
defaultValue: [value !== null && value !== void 0 && value.startDate ? dayjs(value === null || value === void 0 ? void 0 : value.startDate) : undefined, value !== null && value !== void 0 && value.endDate ? dayjs(value === null || value === void 0 ? void 0 : value.endDate) : undefined],
|
|
68
|
+
showTime: (_columnDef$filterComP3 = columnDef.filterComProps) === null || _columnDef$filterComP3 === void 0 ? void 0 : _columnDef$filterComP3.showTime,
|
|
69
|
+
format: format,
|
|
70
|
+
placeholder: ['开始时间', '结束时间'],
|
|
71
|
+
picker: ((_columnDef$filterComP4 = columnDef.filterComProps) === null || _columnDef$filterComP4 === void 0 ? void 0 : _columnDef$filterComP4.picker) || 'date',
|
|
72
|
+
onChange: onChangeDateRange,
|
|
73
|
+
allowEmpty: [true, true],
|
|
74
|
+
style: {
|
|
75
|
+
width: 320
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// 前端筛选时的过滤函数
|
|
82
|
+
export var timeRangeFilter = function timeRangeFilter(row, columnId, filterValue) {
|
|
83
|
+
var timeMs = new Date(row.getValue(columnId)).getTime() || 0;
|
|
84
|
+
return !(filterValue.startDate && timeMs < filterValue.startDate || filterValue.endDate && timeMs > filterValue.endDate);
|
|
85
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
.date-range-filter-
|
|
1
|
+
.date-range-filter-wrapper {
|
|
2
|
+
padding: 8px 12px;
|
|
2
3
|
.split-wapper {
|
|
3
4
|
margin: 5px 0px 0px;
|
|
4
5
|
height: 2px;
|
|
@@ -17,8 +18,7 @@
|
|
|
17
18
|
margin: 5px 0px 0px;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
>div {
|
|
21
|
-
width: 100
|
|
21
|
+
> div {
|
|
22
|
+
width: 100%;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
}
|
|
24
|
+
}
|