@mkt-loitd/react-table-grid-custom 1.3.2 → 1.3.5
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/index.d.mts +10 -20
- package/dist/index.d.ts +10 -20
- package/dist/index.js +31 -71
- package/dist/index.mjs +32 -71
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction, Key, ReactNode,
|
|
2
|
-
import { ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
1
|
+
import { Dispatch, SetStateAction, Key, ReactNode, MutableRefObject, JSX, FC } from 'react';
|
|
2
|
+
import { ColumnOrColumnGroup, DataGridProps, DataGridHandle } from 'react-data-grid';
|
|
3
3
|
export { Column, ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
4
4
|
import { PaginationRootProps } from '@mantine/core';
|
|
5
5
|
import { UseMutateFunction } from '@tanstack/react-query';
|
|
@@ -30,44 +30,34 @@ interface useShowHideColumnReturn<T, SR> {
|
|
|
30
30
|
handleFindLocation: (filterColumns: TColumnsTable<T, SR>, locationColumns?: string[]) => TColumnsTable<T, SR>;
|
|
31
31
|
handleChangeLocation?: (arr: string[]) => void;
|
|
32
32
|
}
|
|
33
|
-
interface ICalculatorTotalPage extends IPaginationParams$1 {
|
|
34
|
-
total?: number;
|
|
35
|
-
}
|
|
36
33
|
|
|
37
34
|
declare const useShowHideColumn: <T, SR = unknown>({ nameLocal, columns, ignoreColumns }: useShowHideColumnParameter<T, SR>) => useShowHideColumnReturn<T, SR>;
|
|
38
35
|
|
|
39
|
-
interface
|
|
40
|
-
from?: number;
|
|
41
|
-
to?: number;
|
|
42
|
-
}
|
|
43
|
-
interface IPaginationTextFunc extends IPaginationText, Pick<ICalculatorTotalPage, 'total'> {
|
|
44
|
-
}
|
|
45
|
-
interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key> extends Omit<DataGridProps<T, SR, K>, 'rows' | 'rowKeyGetter'>, ICalculatorTotalPage {
|
|
36
|
+
interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key> extends Omit<DataGridProps<T, SR, K>, 'rows' | 'rowKeyGetter'> {
|
|
46
37
|
classNameWapperTable?: string;
|
|
47
38
|
classNamePaginationTable?: string;
|
|
48
39
|
hiddenPagination?: boolean;
|
|
49
40
|
hiddenSTT?: boolean;
|
|
41
|
+
/** Pagination */
|
|
42
|
+
page?: number;
|
|
43
|
+
pageSize?: number;
|
|
44
|
+
total?: number;
|
|
50
45
|
data?: T[];
|
|
51
|
-
/** Nếu hàm onChange nên dùng useCallback */
|
|
52
46
|
onChange?: Pick<PaginationRootProps, 'onChange'>['onChange'];
|
|
53
47
|
setConfigPagination?: Dispatch<SetStateAction<ISetConfigPagination$1>>;
|
|
54
|
-
|
|
55
|
-
rowKeyGetter?: string | Maybe<(row: NoInfer<T>) => K>;
|
|
48
|
+
rowKeyGetter?: string | ((row: T) => K);
|
|
56
49
|
hiddenPaginationText?: boolean;
|
|
57
|
-
|
|
58
|
-
paginationText?: (obj: IPaginationTextFunc) => ReactNode;
|
|
50
|
+
paginationText?: (obj: any) => ReactNode;
|
|
59
51
|
listPageSize?: string[];
|
|
60
52
|
fetching?: boolean;
|
|
61
53
|
TableLogo?: string;
|
|
62
|
-
[key: string]: any;
|
|
63
54
|
}
|
|
64
55
|
interface refTablePaginationClient extends Required<IPaginationParams> {
|
|
65
56
|
setConfigSearch: Dispatch<SetStateAction<ISetConfigPagination$1>>;
|
|
66
57
|
resetPagition: (conditional?: boolean) => void;
|
|
67
58
|
}
|
|
68
59
|
|
|
69
|
-
|
|
70
|
-
declare const ReactTableGridCustom: ReactTableGridCustomComponent;
|
|
60
|
+
declare const ReactTableGridCustom: <T, SR = unknown, K extends Key = Key>(props: IReactTableGridCustom<T, SR, K> & React.RefAttributes<DataGridHandle>) => React.ReactElement;
|
|
71
61
|
|
|
72
62
|
type ReactTableGridCustomPaginationClientComponent = <T, SR = unknown, K extends Key = Key>(props: ReactTableGridCustomPaginationClientProps<T, SR, K>) => JSX.Element;
|
|
73
63
|
interface ReactTableGridCustomPaginationClientProps<T = unknown, SR = unknown, K extends Key = Key> extends IReactTableGridCustom<T, SR, K> {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction, Key, ReactNode,
|
|
2
|
-
import { ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
1
|
+
import { Dispatch, SetStateAction, Key, ReactNode, MutableRefObject, JSX, FC } from 'react';
|
|
2
|
+
import { ColumnOrColumnGroup, DataGridProps, DataGridHandle } from 'react-data-grid';
|
|
3
3
|
export { Column, ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
4
4
|
import { PaginationRootProps } from '@mantine/core';
|
|
5
5
|
import { UseMutateFunction } from '@tanstack/react-query';
|
|
@@ -30,44 +30,34 @@ interface useShowHideColumnReturn<T, SR> {
|
|
|
30
30
|
handleFindLocation: (filterColumns: TColumnsTable<T, SR>, locationColumns?: string[]) => TColumnsTable<T, SR>;
|
|
31
31
|
handleChangeLocation?: (arr: string[]) => void;
|
|
32
32
|
}
|
|
33
|
-
interface ICalculatorTotalPage extends IPaginationParams$1 {
|
|
34
|
-
total?: number;
|
|
35
|
-
}
|
|
36
33
|
|
|
37
34
|
declare const useShowHideColumn: <T, SR = unknown>({ nameLocal, columns, ignoreColumns }: useShowHideColumnParameter<T, SR>) => useShowHideColumnReturn<T, SR>;
|
|
38
35
|
|
|
39
|
-
interface
|
|
40
|
-
from?: number;
|
|
41
|
-
to?: number;
|
|
42
|
-
}
|
|
43
|
-
interface IPaginationTextFunc extends IPaginationText, Pick<ICalculatorTotalPage, 'total'> {
|
|
44
|
-
}
|
|
45
|
-
interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key> extends Omit<DataGridProps<T, SR, K>, 'rows' | 'rowKeyGetter'>, ICalculatorTotalPage {
|
|
36
|
+
interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key> extends Omit<DataGridProps<T, SR, K>, 'rows' | 'rowKeyGetter'> {
|
|
46
37
|
classNameWapperTable?: string;
|
|
47
38
|
classNamePaginationTable?: string;
|
|
48
39
|
hiddenPagination?: boolean;
|
|
49
40
|
hiddenSTT?: boolean;
|
|
41
|
+
/** Pagination */
|
|
42
|
+
page?: number;
|
|
43
|
+
pageSize?: number;
|
|
44
|
+
total?: number;
|
|
50
45
|
data?: T[];
|
|
51
|
-
/** Nếu hàm onChange nên dùng useCallback */
|
|
52
46
|
onChange?: Pick<PaginationRootProps, 'onChange'>['onChange'];
|
|
53
47
|
setConfigPagination?: Dispatch<SetStateAction<ISetConfigPagination$1>>;
|
|
54
|
-
|
|
55
|
-
rowKeyGetter?: string | Maybe<(row: NoInfer<T>) => K>;
|
|
48
|
+
rowKeyGetter?: string | ((row: T) => K);
|
|
56
49
|
hiddenPaginationText?: boolean;
|
|
57
|
-
|
|
58
|
-
paginationText?: (obj: IPaginationTextFunc) => ReactNode;
|
|
50
|
+
paginationText?: (obj: any) => ReactNode;
|
|
59
51
|
listPageSize?: string[];
|
|
60
52
|
fetching?: boolean;
|
|
61
53
|
TableLogo?: string;
|
|
62
|
-
[key: string]: any;
|
|
63
54
|
}
|
|
64
55
|
interface refTablePaginationClient extends Required<IPaginationParams> {
|
|
65
56
|
setConfigSearch: Dispatch<SetStateAction<ISetConfigPagination$1>>;
|
|
66
57
|
resetPagition: (conditional?: boolean) => void;
|
|
67
58
|
}
|
|
68
59
|
|
|
69
|
-
|
|
70
|
-
declare const ReactTableGridCustom: ReactTableGridCustomComponent;
|
|
60
|
+
declare const ReactTableGridCustom: <T, SR = unknown, K extends Key = Key>(props: IReactTableGridCustom<T, SR, K> & React.RefAttributes<DataGridHandle>) => React.ReactElement;
|
|
71
61
|
|
|
72
62
|
type ReactTableGridCustomPaginationClientComponent = <T, SR = unknown, K extends Key = Key>(props: ReactTableGridCustomPaginationClientProps<T, SR, K>) => JSX.Element;
|
|
73
63
|
interface ReactTableGridCustomPaginationClientProps<T = unknown, SR = unknown, K extends Key = Key> extends IReactTableGridCustom<T, SR, K> {
|
package/dist/index.js
CHANGED
|
@@ -70,10 +70,6 @@ var arrayLocal = (array) => {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
// src/helpers/table.ts
|
|
73
|
-
var calculatorTotalPage = ({ total = 0, pageSize = 0 }) => {
|
|
74
|
-
if (!pageSize || pageSize && pageSize <= 0) return 0;
|
|
75
|
-
return Math.ceil(total / pageSize);
|
|
76
|
-
};
|
|
77
73
|
var STT = (data, index) => {
|
|
78
74
|
let stt = 1;
|
|
79
75
|
let current_page = 0;
|
|
@@ -280,79 +276,46 @@ var RenderSortStatus_default = RenderSortStatus;
|
|
|
280
276
|
|
|
281
277
|
// src/component/ui/Table/ReactTableGridCustom.tsx
|
|
282
278
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
283
|
-
var ReactTableGridCustomInner = ({
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
selectedRows,
|
|
297
|
-
hiddenPaginationText,
|
|
298
|
-
paginationText,
|
|
299
|
-
listPageSize = ["10", "100", "200", "500", "1000", "5000"],
|
|
300
|
-
fetching,
|
|
301
|
-
TableLogo,
|
|
302
|
-
tableRef,
|
|
303
|
-
...spread
|
|
304
|
-
}) => {
|
|
279
|
+
var ReactTableGridCustomInner = (props, ref) => {
|
|
280
|
+
const {
|
|
281
|
+
classNameWapperTable,
|
|
282
|
+
hiddenSTT,
|
|
283
|
+
data = [],
|
|
284
|
+
page,
|
|
285
|
+
pageSize,
|
|
286
|
+
columns,
|
|
287
|
+
rowKeyGetter = "uid",
|
|
288
|
+
selectedRows,
|
|
289
|
+
fetching,
|
|
290
|
+
...spread
|
|
291
|
+
} = props;
|
|
305
292
|
const [isLoading, setIsLoading] = (0, import_react2.useState)(true);
|
|
306
|
-
const [containerWidth, setContainerWidth] = (0, import_react2.useState)(0);
|
|
307
293
|
const [sortColumns, setSortColumns] = (0, import_react2.useState)([]);
|
|
308
294
|
const isSelectRow = selectedRows !== void 0;
|
|
309
|
-
const maxPage = (0, import_react2.useMemo)(
|
|
310
|
-
() => !hiddenPagination ? calculatorTotalPage({ total, pageSize }) : 0,
|
|
311
|
-
[pageSize, total, hiddenPagination]
|
|
312
|
-
);
|
|
313
295
|
const newColumns = (0, import_react2.useMemo)(() => {
|
|
314
|
-
let cols = [
|
|
315
|
-
...columns
|
|
316
|
-
];
|
|
296
|
+
let cols = [...columns];
|
|
317
297
|
cols = cols.map(
|
|
318
|
-
(col) => "key" in col ? {
|
|
319
|
-
...col,
|
|
320
|
-
width: 200,
|
|
321
|
-
maxWidth: void 0
|
|
322
|
-
} : col
|
|
298
|
+
(col) => "key" in col ? { ...col, width: 200, maxWidth: void 0 } : col
|
|
323
299
|
);
|
|
324
300
|
if (isSelectRow) {
|
|
325
301
|
cols.unshift(import_react_data_grid.SelectColumn);
|
|
326
302
|
}
|
|
327
303
|
if (!hiddenSTT) {
|
|
328
|
-
|
|
304
|
+
cols.unshift({
|
|
329
305
|
key: "index",
|
|
330
306
|
name: "STT",
|
|
331
307
|
width: 80,
|
|
332
308
|
renderCell: ({ rowIdx }) => STT({ page, pageSize }, rowIdx)
|
|
333
|
-
};
|
|
334
|
-
cols.unshift(sttColumn);
|
|
309
|
+
});
|
|
335
310
|
}
|
|
336
311
|
return cols;
|
|
337
|
-
}, [
|
|
338
|
-
columns,
|
|
339
|
-
containerWidth,
|
|
340
|
-
hiddenSTT,
|
|
341
|
-
isSelectRow,
|
|
342
|
-
page,
|
|
343
|
-
pageSize
|
|
344
|
-
]);
|
|
312
|
+
}, [columns, hiddenSTT, isSelectRow, page, pageSize]);
|
|
345
313
|
const customRowKeyGetter = (0, import_react2.useCallback)(
|
|
346
314
|
(row) => {
|
|
347
315
|
if (typeof rowKeyGetter === "function") {
|
|
348
316
|
return rowKeyGetter(row);
|
|
349
317
|
}
|
|
350
|
-
|
|
351
|
-
return (0, import_lodash3.get)(row, rowKeyGetter);
|
|
352
|
-
}
|
|
353
|
-
throw new Error(
|
|
354
|
-
"rowKeyGetter must be a string or a function"
|
|
355
|
-
);
|
|
318
|
+
return (0, import_lodash3.get)(row, rowKeyGetter);
|
|
356
319
|
},
|
|
357
320
|
[rowKeyGetter]
|
|
358
321
|
);
|
|
@@ -360,16 +323,14 @@ var ReactTableGridCustomInner = ({
|
|
|
360
323
|
if (!sortColumns.length) return data;
|
|
361
324
|
const { columnKey, direction } = sortColumns[0];
|
|
362
325
|
if (!direction) return data;
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
326
|
+
return (0, import_lodash3.orderBy)(
|
|
327
|
+
data,
|
|
328
|
+
[String(columnKey)],
|
|
329
|
+
[direction === "ASC" ? "asc" : "desc"]
|
|
330
|
+
);
|
|
366
331
|
}, [data, sortColumns]);
|
|
367
332
|
(0, import_react2.useEffect)(() => {
|
|
368
|
-
var _a;
|
|
369
333
|
setIsLoading(false);
|
|
370
|
-
if ((_a = tableRef == null ? void 0 : tableRef.current) == null ? void 0 : _a.element) {
|
|
371
|
-
setContainerWidth(tableRef.current.element.offsetWidth);
|
|
372
|
-
}
|
|
373
334
|
}, []);
|
|
374
335
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
375
336
|
"div",
|
|
@@ -382,7 +343,7 @@ var ReactTableGridCustomInner = ({
|
|
|
382
343
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
383
344
|
import_react_data_grid.DataGrid,
|
|
384
345
|
{
|
|
385
|
-
ref
|
|
346
|
+
ref,
|
|
386
347
|
rows: sortedRows,
|
|
387
348
|
columns: newColumns,
|
|
388
349
|
selectedRows,
|
|
@@ -390,17 +351,16 @@ var ReactTableGridCustomInner = ({
|
|
|
390
351
|
sortColumns,
|
|
391
352
|
onSortColumnsChange: setSortColumns,
|
|
392
353
|
renderers: {
|
|
393
|
-
renderSortStatus: RenderSortStatus_default,
|
|
394
|
-
renderCheckbox({ onChange
|
|
354
|
+
renderSortStatus: (props2) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RenderSortStatus_default, { ...props2 }),
|
|
355
|
+
renderCheckbox({ onChange, checked, ...props2 }) {
|
|
395
356
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
396
357
|
import_core.Checkbox,
|
|
397
358
|
{
|
|
398
|
-
...
|
|
359
|
+
...props2,
|
|
399
360
|
checked: !!checked,
|
|
400
361
|
onChange: (e) => {
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
onChange2(e.target.checked, shiftKey);
|
|
362
|
+
const shiftKey = e.nativeEvent instanceof MouseEvent ? e.nativeEvent.shiftKey : false;
|
|
363
|
+
onChange(e.target.checked, shiftKey);
|
|
404
364
|
}
|
|
405
365
|
}
|
|
406
366
|
);
|
|
@@ -415,7 +375,7 @@ var ReactTableGridCustomInner = ({
|
|
|
415
375
|
);
|
|
416
376
|
};
|
|
417
377
|
var ReactTableGridCustom = (0, import_react2.memo)(
|
|
418
|
-
ReactTableGridCustomInner
|
|
378
|
+
(0, import_react2.forwardRef)(ReactTableGridCustomInner)
|
|
419
379
|
);
|
|
420
380
|
|
|
421
381
|
// src/component/ui/Table/ReactTableGridCustomPaginationClient.tsx
|
package/dist/index.mjs
CHANGED
|
@@ -31,10 +31,6 @@ var arrayLocal = (array) => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
// src/helpers/table.ts
|
|
34
|
-
var calculatorTotalPage = ({ total = 0, pageSize = 0 }) => {
|
|
35
|
-
if (!pageSize || pageSize && pageSize <= 0) return 0;
|
|
36
|
-
return Math.ceil(total / pageSize);
|
|
37
|
-
};
|
|
38
34
|
var STT = (data, index) => {
|
|
39
35
|
let stt = 1;
|
|
40
36
|
let current_page = 0;
|
|
@@ -169,6 +165,7 @@ import { Checkbox } from "@mantine/core";
|
|
|
169
165
|
import { get, orderBy } from "lodash";
|
|
170
166
|
import {
|
|
171
167
|
memo,
|
|
168
|
+
forwardRef,
|
|
172
169
|
useCallback as useCallback2,
|
|
173
170
|
useEffect,
|
|
174
171
|
useMemo as useMemo2,
|
|
@@ -250,79 +247,46 @@ var RenderSortStatus_default = RenderSortStatus;
|
|
|
250
247
|
|
|
251
248
|
// src/component/ui/Table/ReactTableGridCustom.tsx
|
|
252
249
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
253
|
-
var ReactTableGridCustomInner = ({
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
selectedRows,
|
|
267
|
-
hiddenPaginationText,
|
|
268
|
-
paginationText,
|
|
269
|
-
listPageSize = ["10", "100", "200", "500", "1000", "5000"],
|
|
270
|
-
fetching,
|
|
271
|
-
TableLogo,
|
|
272
|
-
tableRef,
|
|
273
|
-
...spread
|
|
274
|
-
}) => {
|
|
250
|
+
var ReactTableGridCustomInner = (props, ref) => {
|
|
251
|
+
const {
|
|
252
|
+
classNameWapperTable,
|
|
253
|
+
hiddenSTT,
|
|
254
|
+
data = [],
|
|
255
|
+
page,
|
|
256
|
+
pageSize,
|
|
257
|
+
columns,
|
|
258
|
+
rowKeyGetter = "uid",
|
|
259
|
+
selectedRows,
|
|
260
|
+
fetching,
|
|
261
|
+
...spread
|
|
262
|
+
} = props;
|
|
275
263
|
const [isLoading, setIsLoading] = useState2(true);
|
|
276
|
-
const [containerWidth, setContainerWidth] = useState2(0);
|
|
277
264
|
const [sortColumns, setSortColumns] = useState2([]);
|
|
278
265
|
const isSelectRow = selectedRows !== void 0;
|
|
279
|
-
const maxPage = useMemo2(
|
|
280
|
-
() => !hiddenPagination ? calculatorTotalPage({ total, pageSize }) : 0,
|
|
281
|
-
[pageSize, total, hiddenPagination]
|
|
282
|
-
);
|
|
283
266
|
const newColumns = useMemo2(() => {
|
|
284
|
-
let cols = [
|
|
285
|
-
...columns
|
|
286
|
-
];
|
|
267
|
+
let cols = [...columns];
|
|
287
268
|
cols = cols.map(
|
|
288
|
-
(col) => "key" in col ? {
|
|
289
|
-
...col,
|
|
290
|
-
width: 200,
|
|
291
|
-
maxWidth: void 0
|
|
292
|
-
} : col
|
|
269
|
+
(col) => "key" in col ? { ...col, width: 200, maxWidth: void 0 } : col
|
|
293
270
|
);
|
|
294
271
|
if (isSelectRow) {
|
|
295
272
|
cols.unshift(SelectColumn);
|
|
296
273
|
}
|
|
297
274
|
if (!hiddenSTT) {
|
|
298
|
-
|
|
275
|
+
cols.unshift({
|
|
299
276
|
key: "index",
|
|
300
277
|
name: "STT",
|
|
301
278
|
width: 80,
|
|
302
279
|
renderCell: ({ rowIdx }) => STT({ page, pageSize }, rowIdx)
|
|
303
|
-
};
|
|
304
|
-
cols.unshift(sttColumn);
|
|
280
|
+
});
|
|
305
281
|
}
|
|
306
282
|
return cols;
|
|
307
|
-
}, [
|
|
308
|
-
columns,
|
|
309
|
-
containerWidth,
|
|
310
|
-
hiddenSTT,
|
|
311
|
-
isSelectRow,
|
|
312
|
-
page,
|
|
313
|
-
pageSize
|
|
314
|
-
]);
|
|
283
|
+
}, [columns, hiddenSTT, isSelectRow, page, pageSize]);
|
|
315
284
|
const customRowKeyGetter = useCallback2(
|
|
316
285
|
(row) => {
|
|
317
286
|
if (typeof rowKeyGetter === "function") {
|
|
318
287
|
return rowKeyGetter(row);
|
|
319
288
|
}
|
|
320
|
-
|
|
321
|
-
return get(row, rowKeyGetter);
|
|
322
|
-
}
|
|
323
|
-
throw new Error(
|
|
324
|
-
"rowKeyGetter must be a string or a function"
|
|
325
|
-
);
|
|
289
|
+
return get(row, rowKeyGetter);
|
|
326
290
|
},
|
|
327
291
|
[rowKeyGetter]
|
|
328
292
|
);
|
|
@@ -330,16 +294,14 @@ var ReactTableGridCustomInner = ({
|
|
|
330
294
|
if (!sortColumns.length) return data;
|
|
331
295
|
const { columnKey, direction } = sortColumns[0];
|
|
332
296
|
if (!direction) return data;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
297
|
+
return orderBy(
|
|
298
|
+
data,
|
|
299
|
+
[String(columnKey)],
|
|
300
|
+
[direction === "ASC" ? "asc" : "desc"]
|
|
301
|
+
);
|
|
336
302
|
}, [data, sortColumns]);
|
|
337
303
|
useEffect(() => {
|
|
338
|
-
var _a;
|
|
339
304
|
setIsLoading(false);
|
|
340
|
-
if ((_a = tableRef == null ? void 0 : tableRef.current) == null ? void 0 : _a.element) {
|
|
341
|
-
setContainerWidth(tableRef.current.element.offsetWidth);
|
|
342
|
-
}
|
|
343
305
|
}, []);
|
|
344
306
|
return /* @__PURE__ */ jsxs2(
|
|
345
307
|
"div",
|
|
@@ -352,7 +314,7 @@ var ReactTableGridCustomInner = ({
|
|
|
352
314
|
/* @__PURE__ */ jsx3(
|
|
353
315
|
DataGrid,
|
|
354
316
|
{
|
|
355
|
-
ref
|
|
317
|
+
ref,
|
|
356
318
|
rows: sortedRows,
|
|
357
319
|
columns: newColumns,
|
|
358
320
|
selectedRows,
|
|
@@ -360,17 +322,16 @@ var ReactTableGridCustomInner = ({
|
|
|
360
322
|
sortColumns,
|
|
361
323
|
onSortColumnsChange: setSortColumns,
|
|
362
324
|
renderers: {
|
|
363
|
-
renderSortStatus: RenderSortStatus_default,
|
|
364
|
-
renderCheckbox({ onChange
|
|
325
|
+
renderSortStatus: (props2) => /* @__PURE__ */ jsx3(RenderSortStatus_default, { ...props2 }),
|
|
326
|
+
renderCheckbox({ onChange, checked, ...props2 }) {
|
|
365
327
|
return /* @__PURE__ */ jsx3(
|
|
366
328
|
Checkbox,
|
|
367
329
|
{
|
|
368
|
-
...
|
|
330
|
+
...props2,
|
|
369
331
|
checked: !!checked,
|
|
370
332
|
onChange: (e) => {
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
onChange2(e.target.checked, shiftKey);
|
|
333
|
+
const shiftKey = e.nativeEvent instanceof MouseEvent ? e.nativeEvent.shiftKey : false;
|
|
334
|
+
onChange(e.target.checked, shiftKey);
|
|
374
335
|
}
|
|
375
336
|
}
|
|
376
337
|
);
|
|
@@ -385,7 +346,7 @@ var ReactTableGridCustomInner = ({
|
|
|
385
346
|
);
|
|
386
347
|
};
|
|
387
348
|
var ReactTableGridCustom = memo(
|
|
388
|
-
ReactTableGridCustomInner
|
|
349
|
+
forwardRef(ReactTableGridCustomInner)
|
|
389
350
|
);
|
|
390
351
|
|
|
391
352
|
// src/component/ui/Table/ReactTableGridCustomPaginationClient.tsx
|