es-grid-template 1.8.55 → 1.8.57
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/es/grid-component/type.d.ts +8 -0
- package/es/table-component/TableContainer.js +15 -0
- package/es/table-component/TableContainerEdit.js +13 -12
- package/es/table-component/body/TableBodyCell.js +24 -62
- package/es/table-component/body/TableBodyCellEdit.js +14 -9
- package/es/table-component/body/TableBodyRow.js +7 -12
- package/es/table-component/footer/TableFooterCell.js +2 -2
- package/es/table-component/footer/TableFooterRow.js +8 -4
- package/es/table-component/header/TableHead.js +4 -1
- package/es/table-component/header/TableHeadCell2.js +7 -48
- package/es/table-component/header/TableHeadGroupCell.js +13 -225
- package/es/table-component/header/TableHeadRow.js +7 -19
- package/es/table-component/hook/useColumns.js +17 -3
- package/es/table-component/hook/utils.js +0 -17
- package/es/table-component/style.scss +270 -15
- package/es/table-component/table/Grid.js +14 -25
- package/es/table-component/type.d.ts +8 -1
- package/es/table-component/useContext.d.ts +4 -1
- package/lib/grid-component/type.d.ts +8 -0
- package/lib/table-component/TableContainer.js +15 -0
- package/lib/table-component/TableContainerEdit.js +13 -12
- package/lib/table-component/body/TableBodyCell.js +24 -62
- package/lib/table-component/body/TableBodyCellEdit.js +14 -9
- package/lib/table-component/body/TableBodyRow.js +7 -12
- package/lib/table-component/footer/TableFooterCell.js +2 -2
- package/lib/table-component/footer/TableFooterRow.js +8 -4
- package/lib/table-component/header/TableHead.js +4 -1
- package/lib/table-component/header/TableHeadCell2.js +7 -48
- package/lib/table-component/header/TableHeadGroupCell.js +11 -223
- package/lib/table-component/header/TableHeadRow.js +7 -20
- package/lib/table-component/hook/useColumns.js +17 -3
- package/lib/table-component/hook/utils.js +0 -17
- package/lib/table-component/style.scss +270 -15
- package/lib/table-component/table/Grid.js +14 -25
- package/lib/table-component/type.d.ts +8 -1
- package/lib/table-component/useContext.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1,28 +1,15 @@
|
|
|
1
|
-
// import { useSortable } from "@dnd-kit/sortable"
|
|
2
|
-
|
|
3
1
|
import { flexRender } from '@tanstack/react-table';
|
|
4
2
|
import React, { useContext } from 'react';
|
|
5
|
-
// import { CSS } from '@dnd-kit/utilities'
|
|
6
|
-
// import type { Virtualizer } from '@tanstack/react-virtual'
|
|
7
|
-
import { Button, Space } from 'antd';
|
|
8
|
-
import { ArrowDown, ArrowUp, FilterFill, SortCancel } from 'becoxy-icons';
|
|
9
3
|
import classNames from 'classnames';
|
|
10
|
-
import { Checkbox
|
|
11
|
-
import {
|
|
12
|
-
import { extendsObject, getCommonPinningStyles2, getDefaultOperator, getTypeFilter } from "../hook/utils";
|
|
4
|
+
import { Checkbox } from 'rc-master-ui';
|
|
5
|
+
import { getCommonPinningStyles2 } from "../hook/utils";
|
|
13
6
|
import { TableContext } from "../useContext";
|
|
14
|
-
import { renderFilter } from "./renderFilter";
|
|
15
7
|
import ReactDOMServer from 'react-dom/server';
|
|
16
|
-
|
|
17
|
-
// import { ColumnTable } from "../type";
|
|
18
|
-
|
|
19
|
-
// import { Tooltip } from 'react-tooltip'
|
|
20
|
-
|
|
21
8
|
const TableHeadGroupCell = props => {
|
|
22
9
|
const {
|
|
23
10
|
column,
|
|
24
11
|
header,
|
|
25
|
-
getPopupContainer,
|
|
12
|
+
// getPopupContainer,
|
|
26
13
|
table,
|
|
27
14
|
depth,
|
|
28
15
|
// t,
|
|
@@ -32,30 +19,21 @@ const TableHeadGroupCell = props => {
|
|
|
32
19
|
rowSpan
|
|
33
20
|
} = props;
|
|
34
21
|
const {
|
|
35
|
-
t,
|
|
22
|
+
// t,
|
|
36
23
|
prefix,
|
|
37
|
-
setSorterChange,
|
|
38
|
-
setFilterChange,
|
|
24
|
+
// setSorterChange,
|
|
25
|
+
// setFilterChange,
|
|
39
26
|
wrapSettings,
|
|
40
27
|
selectionSettings,
|
|
41
28
|
setIsSelectionChange,
|
|
42
|
-
id
|
|
43
|
-
locale
|
|
29
|
+
id
|
|
30
|
+
// locale
|
|
44
31
|
} = useContext(TableContext);
|
|
45
32
|
const isPinned = column.getIsPinned();
|
|
46
33
|
const isLastLeftPinnedColumn = isPinned === 'left' && column.getIsLastColumn('left');
|
|
47
34
|
const isFirstRightPinnedColumn = isPinned === 'right' && column.getIsFirstColumn('right');
|
|
48
|
-
const [selectedKeys, setSelectedKeys] = React.useState([]);
|
|
49
|
-
const [visible, setVisible] = React.useState(false);
|
|
50
|
-
const {
|
|
51
|
-
filterIcon
|
|
52
|
-
} = column.columnDef.meta ?? {};
|
|
53
|
-
|
|
54
|
-
// const column = (column.columnDef ?? {}) as ColumnTable
|
|
55
|
-
// const column = column.columnDef
|
|
56
|
-
|
|
57
35
|
const originalColumn = column.columnDef.meta ?? {};
|
|
58
|
-
const
|
|
36
|
+
const cellStyles = typeof originalColumn.onCellHeaderStyles === 'function' ? originalColumn.onCellHeaderStyles(header) : originalColumn.onCellHeaderStyles;
|
|
59
37
|
const cellContent = flexRender(column.columnDef.header, header.getContext());
|
|
60
38
|
const html = ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, cellContent));
|
|
61
39
|
const hasValue = html.trim().length > 0;
|
|
@@ -68,148 +46,10 @@ const TableHeadGroupCell = props => {
|
|
|
68
46
|
// })
|
|
69
47
|
|
|
70
48
|
const style = {
|
|
71
|
-
// opacity: isDragging ? 0.8 : 1,
|
|
72
|
-
// position: 'relative',
|
|
73
|
-
// transform: CSS.Translate.toString(transform), // translate instead of transform to avoid squishing
|
|
74
49
|
transition: 'width transform 0.2s ease-in-out',
|
|
75
|
-
whiteSpace: 'nowrap'
|
|
76
|
-
|
|
77
|
-
// zIndex: isDragging ? 1 : 0,
|
|
50
|
+
whiteSpace: 'nowrap',
|
|
51
|
+
...cellStyles
|
|
78
52
|
};
|
|
79
|
-
const getDropdownTrigger = () => {
|
|
80
|
-
let iconFilter;
|
|
81
|
-
if (typeof filterIcon === 'function') {
|
|
82
|
-
iconFilter = filterIcon(filtered);
|
|
83
|
-
} else if (filterIcon) {
|
|
84
|
-
iconFilter = filterIcon;
|
|
85
|
-
} else {
|
|
86
|
-
iconFilter = /*#__PURE__*/React.createElement(FilterFill, {
|
|
87
|
-
style: {
|
|
88
|
-
color: filtered ? '#E3165B' : '#283046'
|
|
89
|
-
},
|
|
90
|
-
fontSize: 12
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
94
|
-
role: "button",
|
|
95
|
-
tabIndex: -1,
|
|
96
|
-
className: classNames(`${prefix}-trigger`, {
|
|
97
|
-
active: filtered
|
|
98
|
-
}),
|
|
99
|
-
onClick: e => {
|
|
100
|
-
e.stopPropagation();
|
|
101
|
-
}
|
|
102
|
-
}, iconFilter);
|
|
103
|
-
};
|
|
104
|
-
const triggerVisible = newVisible => {
|
|
105
|
-
setVisible(newVisible);
|
|
106
|
-
};
|
|
107
|
-
const onVisibleChange = (newVisible, info) => {
|
|
108
|
-
if (info.source === 'trigger') {
|
|
109
|
-
if (newVisible) {
|
|
110
|
-
const filterValue = column.getFilterValue() ?? [];
|
|
111
|
-
const operatorValue = column.getFilterOperator() ?? getDefaultOperator(column?.meta ?? {});
|
|
112
|
-
setSelectedKeys(filterValue);
|
|
113
|
-
column.setFilterOperator?.(operatorValue);
|
|
114
|
-
} else {}
|
|
115
|
-
triggerVisible(newVisible);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
const doFilter = type => {
|
|
119
|
-
if (type) {
|
|
120
|
-
column.setFilterValue(!originalColumn.typeFilter || originalColumn.typeFilter === 'Text' ? selectedKeys.length === 0 ? [''] : selectedKeys : selectedKeys);
|
|
121
|
-
} else {
|
|
122
|
-
column.setFilterValue(undefined);
|
|
123
|
-
setSelectedKeys([]);
|
|
124
|
-
}
|
|
125
|
-
setFilterChange(true);
|
|
126
|
-
triggerVisible(false);
|
|
127
|
-
setTimeout(() => {
|
|
128
|
-
setFilterChange(false);
|
|
129
|
-
}, 10);
|
|
130
|
-
};
|
|
131
|
-
const mergedDropdownProps = extendsObject({
|
|
132
|
-
trigger: ['click'],
|
|
133
|
-
placement: 'bottomRight',
|
|
134
|
-
// placement: direction === 'rtl' ? 'bottomLeft' : 'bottomRight',
|
|
135
|
-
children: getDropdownTrigger(),
|
|
136
|
-
getPopupContainer
|
|
137
|
-
}, {
|
|
138
|
-
// ...filterDropdownProps,
|
|
139
|
-
// rootClassName: classNames(rootClassName, filterDropdownProps.rootClassName),
|
|
140
|
-
open: visible,
|
|
141
|
-
onOpenChange: onVisibleChange,
|
|
142
|
-
destroyPopupOnHide: true,
|
|
143
|
-
dropdownRender: () => {
|
|
144
|
-
const type = getTypeFilter(originalColumn);
|
|
145
|
-
const operatorValue = column.getFilterOperator() ?? getDefaultOperator(originalColumn);
|
|
146
|
-
const operatorOptions = ['Checkbox', 'Dropdown', 'DropTree', 'CheckboxDropdown'].includes(type) ? booleanOperator : !type || type === 'Text' ? stringOperator : numberOperator;
|
|
147
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
148
|
-
// className='ui-rc-table-filter-dropdown'
|
|
149
|
-
|
|
150
|
-
className: classNames(`${prefix}-grid-filter-dropdown`, {}),
|
|
151
|
-
style: {}
|
|
152
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
153
|
-
style: {
|
|
154
|
-
minWidth: 275,
|
|
155
|
-
padding: '8px'
|
|
156
|
-
}
|
|
157
|
-
}, /*#__PURE__*/React.createElement("div", null), column.meta?.showOperator !== false && column.meta?.typeFilter !== 'DateRange' && column.meta?.typeFilter !== 'NumberRange' && /*#__PURE__*/React.createElement("div", {
|
|
158
|
-
className: 'mb-1'
|
|
159
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
160
|
-
options: translateOption(operatorOptions, t),
|
|
161
|
-
style: {
|
|
162
|
-
width: '100%',
|
|
163
|
-
marginBottom: 8
|
|
164
|
-
},
|
|
165
|
-
value: operatorValue,
|
|
166
|
-
onChange: val => {
|
|
167
|
-
column.setFilterOperator(val);
|
|
168
|
-
}
|
|
169
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
170
|
-
style: {
|
|
171
|
-
marginBottom: 8
|
|
172
|
-
}
|
|
173
|
-
}, renderFilter({
|
|
174
|
-
column: column,
|
|
175
|
-
selectedKeys,
|
|
176
|
-
setSelectedKeys
|
|
177
|
-
// selectedKeys: (column.getFilterValue() ?? []) as string[],
|
|
178
|
-
// setSelectedKeys: column.setFilterValue,
|
|
179
|
-
})), /*#__PURE__*/React.createElement(Space, {
|
|
180
|
-
style: {
|
|
181
|
-
justifyContent: 'end',
|
|
182
|
-
width: '100%'
|
|
183
|
-
}
|
|
184
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
185
|
-
type: "primary",
|
|
186
|
-
onClick: () => {
|
|
187
|
-
// column.setFilterValue(selectedKeys)
|
|
188
|
-
|
|
189
|
-
doFilter(true);
|
|
190
|
-
},
|
|
191
|
-
size: "small",
|
|
192
|
-
style: {
|
|
193
|
-
width: 90
|
|
194
|
-
}
|
|
195
|
-
}, t ? t('Filter') : 'Filter'), /*#__PURE__*/React.createElement(Button, {
|
|
196
|
-
type: "link",
|
|
197
|
-
size: "small",
|
|
198
|
-
onClick: () => {
|
|
199
|
-
// column.setFilterValue([])
|
|
200
|
-
// column.setFilterOperator('')
|
|
201
|
-
|
|
202
|
-
setSelectedKeys([]);
|
|
203
|
-
doFilter(false);
|
|
204
|
-
}
|
|
205
|
-
}, t ? t('Clear') : 'Clear'))));
|
|
206
|
-
|
|
207
|
-
// if (typeof filterDropdownProps?.dropdownRender === 'function') {
|
|
208
|
-
// return filterDropdownProps.dropdownRender(dropdownContent);
|
|
209
|
-
// }
|
|
210
|
-
// return dropdownContent;
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
53
|
return /*#__PURE__*/React.createElement("div", {
|
|
214
54
|
// ref={setNodeRef}
|
|
215
55
|
className: classNames(`${prefix}-grid-cell`, {
|
|
@@ -219,21 +59,14 @@ const TableHeadGroupCell = props => {
|
|
|
219
59
|
[`${prefix}-grid-cell-fix-right-first`]: isFirstRightPinnedColumn,
|
|
220
60
|
[`${prefix}-grid-cell-text-center`]: (originalColumn?.headerTextAlign ?? originalColumn?.textAlign) === 'center',
|
|
221
61
|
[`${prefix}-grid-cell-text-right`]: (originalColumn?.headerTextAlign ?? originalColumn.textAlign) === 'right'
|
|
222
|
-
})
|
|
223
|
-
// colSpan={colSpan}
|
|
224
|
-
// rowSpan={rowSpan}
|
|
225
|
-
,
|
|
226
|
-
|
|
62
|
+
}),
|
|
227
63
|
"data-col-span": colSpan,
|
|
228
64
|
key: header.id,
|
|
229
65
|
style: {
|
|
230
|
-
// display: 'flex',
|
|
231
|
-
// width: column.getSize(),
|
|
232
66
|
minWidth: column.getSize(),
|
|
233
67
|
flex: 1,
|
|
234
68
|
gridRow: `${depth + 1} / span ${rowSpan}`,
|
|
235
69
|
gridColumn: `span ${colSpan}`,
|
|
236
|
-
// maxWidth: header.getSize(),
|
|
237
70
|
...getCommonPinningStyles2(header),
|
|
238
71
|
width: 'auto',
|
|
239
72
|
...style
|
|
@@ -267,52 +100,7 @@ const TableHeadGroupCell = props => {
|
|
|
267
100
|
[`${prefix}-grid-cell-ellipsis`]: !wrapSettings || !(wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')),
|
|
268
101
|
[`${prefix}-grid-cell-text-wrap`]: wrapSettings && (wrapSettings.wrapMode === 'Both' || wrapSettings.wrapMode === 'Header')
|
|
269
102
|
})
|
|
270
|
-
}, cellContent)),
|
|
271
|
-
className: "ui-rc-header-trigger"
|
|
272
|
-
}, column.getCanSort() && /*#__PURE__*/React.createElement("div", {
|
|
273
|
-
style: {
|
|
274
|
-
marginInlineEnd: 6,
|
|
275
|
-
cursor: 'pointer'
|
|
276
|
-
},
|
|
277
|
-
onClick: e => {
|
|
278
|
-
setSorterChange(true);
|
|
279
|
-
const toggleSortingHandler = column.getToggleSortingHandler();
|
|
280
|
-
if (typeof toggleSortingHandler === 'function') {
|
|
281
|
-
toggleSortingHandler(e);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}, column.getIsSorted() ? column.getIsSorted() === 'asc' ? /*#__PURE__*/React.createElement(ArrowUp, {
|
|
285
|
-
fontSize: 15,
|
|
286
|
-
color: '#000'
|
|
287
|
-
// data-tooltip-id={`${id}-tooltip-header-trigger`}
|
|
288
|
-
,
|
|
289
|
-
"data-tooltip-id": `${id}-tooltip-content`
|
|
290
|
-
// data-tooltip-content='Nhấp để sắp xếp giảm dần'
|
|
291
|
-
,
|
|
292
|
-
"data-tooltip-content": locale?.triggerDesc ?? 'Click to sort descending'
|
|
293
|
-
}) : /*#__PURE__*/React.createElement(ArrowDown, {
|
|
294
|
-
fontSize: 15,
|
|
295
|
-
color: '#000',
|
|
296
|
-
"data-tooltip-id": `${id}-tooltip-content`
|
|
297
|
-
// data-tooltip-id={`${id}-tooltip-header-trigger`}
|
|
298
|
-
// data-tooltip-content='Nhấp để hủy sắp xếp'
|
|
299
|
-
,
|
|
300
|
-
"data-tooltip-content": locale?.cancelSort ?? 'Click to cancel sorting'
|
|
301
|
-
}) : /*#__PURE__*/React.createElement(SortCancel
|
|
302
|
-
// data-tooltip-id={`${id}-tooltip-header-trigger`}
|
|
303
|
-
, {
|
|
304
|
-
"data-tooltip-id": `${id}-tooltip-content`
|
|
305
|
-
// data-tooltip-content='Nhấp để sắp xếp tăng dần'
|
|
306
|
-
,
|
|
307
|
-
"data-tooltip-content": locale?.triggerAsc ?? 'Click to sort ascending',
|
|
308
|
-
fontSize: 15,
|
|
309
|
-
style: {
|
|
310
|
-
display: 'flex'
|
|
311
|
-
},
|
|
312
|
-
className: classNames(`ui-rc-table-column-sorter-cancel`, {
|
|
313
|
-
active: true
|
|
314
|
-
})
|
|
315
|
-
})), column.getCanFilter() && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Dropdown, mergedDropdownProps)))), column.getCanResize() && /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
}, cellContent))), column.getCanResize() && /*#__PURE__*/React.createElement("div", {
|
|
316
104
|
onDoubleClick: () => column.resetSize(),
|
|
317
105
|
onMouseDown: header.getResizeHandler(),
|
|
318
106
|
onTouchStart: header.getResizeHandler(),
|
|
@@ -1,40 +1,30 @@
|
|
|
1
1
|
import { horizontalListSortingStrategy, SortableContext } from '@dnd-kit/sortable';
|
|
2
|
-
// import type { Virtualizer } from '@tanstack/react-virtual'
|
|
3
|
-
// import type { Person } from "../../tanstack-table/makeData"
|
|
4
2
|
import React from 'react';
|
|
5
3
|
import { TableContext } from "../useContext";
|
|
6
4
|
import TableHeadCell from "./TableHeadCell";
|
|
7
|
-
// import { getCommonPinningStyles } from '../hook/utils'
|
|
8
|
-
|
|
9
5
|
const TableHeadRow = ({
|
|
10
6
|
table,
|
|
11
7
|
headerGroup,
|
|
12
8
|
columnVirtualizer
|
|
13
|
-
// virtualPaddingLeft,
|
|
14
|
-
// virtualPaddingRight,
|
|
15
|
-
// fixedLeftColumns,
|
|
16
|
-
// fixedRightColumns
|
|
17
9
|
}) => {
|
|
18
10
|
const {
|
|
19
|
-
prefix
|
|
11
|
+
prefix,
|
|
12
|
+
onRowHeaderStyles
|
|
20
13
|
} = React.useContext(TableContext);
|
|
21
|
-
|
|
22
|
-
// const virtualColumns = columnVirtualizer.getVirtualItems()
|
|
23
|
-
|
|
24
14
|
const columnOrder = table.getState().columnOrder;
|
|
15
|
+
const rowStyles = typeof onRowHeaderStyles === 'function' ? onRowHeaderStyles() : onRowHeaderStyles;
|
|
25
16
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
17
|
key: headerGroup.id
|
|
27
18
|
// ref={el => {
|
|
28
19
|
// if (el) rowHeaderVirtualizer.measureElement(el)
|
|
29
20
|
// }}
|
|
30
|
-
// data-index={rowHeaderVirtual?.index}
|
|
31
21
|
,
|
|
22
|
+
|
|
32
23
|
"data-index": headerGroup.id,
|
|
33
|
-
className: `${prefix}-grid-row`,
|
|
24
|
+
className: `${prefix}-grid-row ${prefix}-grid-header`,
|
|
34
25
|
style: {
|
|
35
|
-
|
|
26
|
+
...rowStyles,
|
|
36
27
|
width: '100%'
|
|
37
|
-
// minHeight: rowHeaderVirtual?.size
|
|
38
28
|
}
|
|
39
29
|
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
40
30
|
items: columnOrder,
|
|
@@ -53,9 +43,7 @@ const TableHeadRow = ({
|
|
|
53
43
|
key: header.id,
|
|
54
44
|
header: header,
|
|
55
45
|
table: table,
|
|
56
|
-
columnVirtualizer: columnVirtualizer
|
|
57
|
-
// rowHeaderVirtualizer={rowHeaderVirtualizer}
|
|
58
|
-
,
|
|
46
|
+
columnVirtualizer: columnVirtualizer,
|
|
59
47
|
colSpan: header.colSpan,
|
|
60
48
|
rowSpan: rowSpan
|
|
61
49
|
});
|
|
@@ -214,6 +214,8 @@ export const toggleRowSelection = props => {
|
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
216
|
if (row.subRows && row.subRows.length > 0) {
|
|
217
|
+
// click vào row cha
|
|
218
|
+
|
|
217
219
|
const allChild = getAllChildren(row);
|
|
218
220
|
toggleRowAndChildren(row, !row.getIsSelected());
|
|
219
221
|
if (row.getIsSelected()) {
|
|
@@ -245,17 +247,29 @@ export const toggleRowSelection = props => {
|
|
|
245
247
|
});
|
|
246
248
|
}
|
|
247
249
|
} else {
|
|
250
|
+
// click vào row không có cha
|
|
251
|
+
|
|
248
252
|
row.getToggleSelectedHandler()(e);
|
|
249
253
|
if (row.getIsSelected()) {
|
|
250
254
|
// đã chọn
|
|
251
255
|
|
|
252
|
-
|
|
253
|
-
const
|
|
256
|
+
const rowParent = row.getParentRow();
|
|
257
|
+
// const rowParent1 = row.getParentRows()
|
|
258
|
+
|
|
259
|
+
let newCheckedRows = [];
|
|
260
|
+
if (rowParent) {}
|
|
261
|
+
if (rowParent && countUnselectedChildren(row) === 1) {
|
|
262
|
+
newCheckedRows = prevSelected.filter(it => it.id !== row.id && it.id !== rowParent.id);
|
|
263
|
+
} else {
|
|
264
|
+
// xóa row ra list selected
|
|
265
|
+
// const newRowsSelected = prevSelected.filter((it) => it.id !== row.id)
|
|
266
|
+
newCheckedRows = prevSelected.filter(it => it.id !== row.id);
|
|
267
|
+
}
|
|
254
268
|
setIsSelectionChange({
|
|
255
269
|
isChange: true,
|
|
256
270
|
type: 'rowSelected',
|
|
257
271
|
rowData: row.original,
|
|
258
|
-
rowsData:
|
|
272
|
+
rowsData: newCheckedRows ?? []
|
|
259
273
|
});
|
|
260
274
|
} else {
|
|
261
275
|
// chưa selected
|
|
@@ -26,25 +26,13 @@ export const convertDateToDayjs = (date, format) => {
|
|
|
26
26
|
};
|
|
27
27
|
export const getCommonPinningStyles = column => {
|
|
28
28
|
const isPinned = column.getIsPinned();
|
|
29
|
-
// const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
|
|
30
|
-
// const isFirstRightPinnedColumn =isPinned === "right" && column.getIsFirstColumn("right");
|
|
31
|
-
|
|
32
29
|
return {
|
|
33
|
-
// boxShadow: isFirstRightPinnedColumn
|
|
34
|
-
// ? "#e0e0e0 2px 0px 1px -1px inset"
|
|
35
|
-
// : undefined,
|
|
36
|
-
|
|
37
30
|
left: isPinned === "left" ? `${column.getStart("left")}px` : undefined,
|
|
38
31
|
right: isPinned === "right" ? `${column.getAfter("right")}px` : undefined,
|
|
39
|
-
// opacity: isPinned ? 0.5 : 1,
|
|
40
32
|
opacity: 1,
|
|
41
33
|
position: isPinned ? "sticky" : "relative",
|
|
42
|
-
// width: column.getSize(),
|
|
43
34
|
width: 'auto',
|
|
44
35
|
zIndex: isPinned ? 2 : 0
|
|
45
|
-
// border: '1px solid #e5e7eb',
|
|
46
|
-
// borderTop: 0,
|
|
47
|
-
// borderBottom: 0
|
|
48
36
|
};
|
|
49
37
|
};
|
|
50
38
|
export const getCommonPinningStyles2 = header => {
|
|
@@ -59,15 +47,10 @@ export const getCommonPinningStyles2 = header => {
|
|
|
59
47
|
|
|
60
48
|
left: isPinned === "left" ? `${header.getStart("left")}px` : undefined,
|
|
61
49
|
right: isPinned === "right" ? `${header.getAfter("right")}px` : undefined,
|
|
62
|
-
// opacity: isPinned ? 0.5 : 1,
|
|
63
50
|
opacity: 1,
|
|
64
51
|
position: isPinned ? "sticky" : "relative",
|
|
65
|
-
// width: column.getSize(),
|
|
66
52
|
width: 'auto',
|
|
67
53
|
zIndex: isPinned ? 2 : 0
|
|
68
|
-
// border: '1px solid #e5e7eb',
|
|
69
|
-
// borderTop: 0,
|
|
70
|
-
// borderBottom: 0
|
|
71
54
|
};
|
|
72
55
|
};
|
|
73
56
|
export const sumSize = items => {
|