@mkt-loitd/react-table-grid-custom 1.2.8 → 1.3.3
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.css +0 -97
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +27 -279
- package/dist/index.mjs +15 -268
- package/package.json +1 -4
package/dist/index.css
CHANGED
|
@@ -55,100 +55,3 @@ div[aria-sort] > span {
|
|
|
55
55
|
position: sticky !important;
|
|
56
56
|
right: 0 !important;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
/* src/component/ui/ContextMenu/ContextMenu.css */
|
|
60
|
-
.shadow-menu {
|
|
61
|
-
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
|
|
62
|
-
animation: open 0.3s;
|
|
63
|
-
transform-origin: top left;
|
|
64
|
-
}
|
|
65
|
-
.shadow-submenu {
|
|
66
|
-
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
|
|
67
|
-
}
|
|
68
|
-
@keyframes open {
|
|
69
|
-
from {
|
|
70
|
-
transform: scale(0);
|
|
71
|
-
}
|
|
72
|
-
to {
|
|
73
|
-
transform: scale(1);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/* node_modules/tippy.js/dist/tippy.css */
|
|
78
|
-
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
79
|
-
opacity: 0;
|
|
80
|
-
}
|
|
81
|
-
[data-tippy-root] {
|
|
82
|
-
max-width: calc(100vw - 10px);
|
|
83
|
-
}
|
|
84
|
-
.tippy-box {
|
|
85
|
-
position: relative;
|
|
86
|
-
background-color: #333;
|
|
87
|
-
color: #fff;
|
|
88
|
-
border-radius: 4px;
|
|
89
|
-
font-size: 14px;
|
|
90
|
-
line-height: 1.4;
|
|
91
|
-
white-space: normal;
|
|
92
|
-
outline: 0;
|
|
93
|
-
transition-property:
|
|
94
|
-
transform,
|
|
95
|
-
visibility,
|
|
96
|
-
opacity;
|
|
97
|
-
}
|
|
98
|
-
.tippy-box[data-placement^=top] > .tippy-arrow {
|
|
99
|
-
bottom: 0;
|
|
100
|
-
}
|
|
101
|
-
.tippy-box[data-placement^=top] > .tippy-arrow:before {
|
|
102
|
-
bottom: -7px;
|
|
103
|
-
left: 0;
|
|
104
|
-
border-width: 8px 8px 0;
|
|
105
|
-
border-top-color: initial;
|
|
106
|
-
transform-origin: center top;
|
|
107
|
-
}
|
|
108
|
-
.tippy-box[data-placement^=bottom] > .tippy-arrow {
|
|
109
|
-
top: 0;
|
|
110
|
-
}
|
|
111
|
-
.tippy-box[data-placement^=bottom] > .tippy-arrow:before {
|
|
112
|
-
top: -7px;
|
|
113
|
-
left: 0;
|
|
114
|
-
border-width: 0 8px 8px;
|
|
115
|
-
border-bottom-color: initial;
|
|
116
|
-
transform-origin: center bottom;
|
|
117
|
-
}
|
|
118
|
-
.tippy-box[data-placement^=left] > .tippy-arrow {
|
|
119
|
-
right: 0;
|
|
120
|
-
}
|
|
121
|
-
.tippy-box[data-placement^=left] > .tippy-arrow:before {
|
|
122
|
-
border-width: 8px 0 8px 8px;
|
|
123
|
-
border-left-color: initial;
|
|
124
|
-
right: -7px;
|
|
125
|
-
transform-origin: center left;
|
|
126
|
-
}
|
|
127
|
-
.tippy-box[data-placement^=right] > .tippy-arrow {
|
|
128
|
-
left: 0;
|
|
129
|
-
}
|
|
130
|
-
.tippy-box[data-placement^=right] > .tippy-arrow:before {
|
|
131
|
-
left: -7px;
|
|
132
|
-
border-width: 8px 8px 8px 0;
|
|
133
|
-
border-right-color: initial;
|
|
134
|
-
transform-origin: center right;
|
|
135
|
-
}
|
|
136
|
-
.tippy-box[data-inertia][data-state=visible] {
|
|
137
|
-
transition-timing-function: cubic-bezier(.54, 1.5, .38, 1.11);
|
|
138
|
-
}
|
|
139
|
-
.tippy-arrow {
|
|
140
|
-
width: 16px;
|
|
141
|
-
height: 16px;
|
|
142
|
-
color: #333;
|
|
143
|
-
}
|
|
144
|
-
.tippy-arrow:before {
|
|
145
|
-
content: "";
|
|
146
|
-
position: absolute;
|
|
147
|
-
border-color: transparent;
|
|
148
|
-
border-style: solid;
|
|
149
|
-
}
|
|
150
|
-
.tippy-content {
|
|
151
|
-
position: relative;
|
|
152
|
-
padding: 5px 9px;
|
|
153
|
-
z-index: 1;
|
|
154
|
-
}
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { Dispatch, SetStateAction, Key, ReactNode, JSX, MutableRefObject, FC } f
|
|
|
2
2
|
import { ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
3
3
|
export { Column, ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
4
4
|
import { PaginationRootProps } from '@mantine/core';
|
|
5
|
-
import { TFunction } from 'i18next';
|
|
6
5
|
import { UseMutateFunction } from '@tanstack/react-query';
|
|
7
6
|
|
|
8
7
|
type TColumnsTable<T = unknown, SR = unknown> = readonly ColumnOrColumnGroup<NoInfer<T>, NoInfer<SR>>[];
|
|
@@ -172,7 +171,7 @@ interface IPayloadService {
|
|
|
172
171
|
type IDispatchState<T> = Dispatch<SetStateAction<T>>;
|
|
173
172
|
|
|
174
173
|
interface IExpandValue extends IPayloadService {
|
|
175
|
-
t?:
|
|
174
|
+
t?: any;
|
|
176
175
|
setConfigSearch?: IDispatchState<ISetConfigPagination>;
|
|
177
176
|
setSelectedRecords?: Dispatch<ReadonlySet<string>>;
|
|
178
177
|
setIsShowEdit?: Dispatch<SetStateAction<boolean>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { Dispatch, SetStateAction, Key, ReactNode, JSX, MutableRefObject, FC } f
|
|
|
2
2
|
import { ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
3
3
|
export { Column, ColumnOrColumnGroup, DataGridProps } from 'react-data-grid';
|
|
4
4
|
import { PaginationRootProps } from '@mantine/core';
|
|
5
|
-
import { TFunction } from 'i18next';
|
|
6
5
|
import { UseMutateFunction } from '@tanstack/react-query';
|
|
7
6
|
|
|
8
7
|
type TColumnsTable<T = unknown, SR = unknown> = readonly ColumnOrColumnGroup<NoInfer<T>, NoInfer<SR>>[];
|
|
@@ -172,7 +171,7 @@ interface IPayloadService {
|
|
|
172
171
|
type IDispatchState<T> = Dispatch<SetStateAction<T>>;
|
|
173
172
|
|
|
174
173
|
interface IExpandValue extends IPayloadService {
|
|
175
|
-
t?:
|
|
174
|
+
t?: any;
|
|
176
175
|
setConfigSearch?: IDispatchState<ISetConfigPagination>;
|
|
177
176
|
setSelectedRecords?: Dispatch<ReadonlySet<string>>;
|
|
178
177
|
setIsShowEdit?: Dispatch<SetStateAction<boolean>>;
|
package/dist/index.js
CHANGED
|
@@ -206,22 +206,9 @@ var useShowHideColumn = ({
|
|
|
206
206
|
// src/component/ui/Table/ReactTableGridCustom.tsx
|
|
207
207
|
var import_core = require("@mantine/core");
|
|
208
208
|
var import_lodash3 = require("lodash");
|
|
209
|
-
var
|
|
209
|
+
var import_react2 = require("react");
|
|
210
210
|
var import_react_data_grid = require("react-data-grid");
|
|
211
211
|
var import_styles = require("react-data-grid/lib/styles.css");
|
|
212
|
-
var import_react_i18next2 = require("react-i18next");
|
|
213
|
-
|
|
214
|
-
// src/hooks/useTranslationTable.ts
|
|
215
|
-
var import_react2 = require("react");
|
|
216
|
-
var import_react_i18next = require("react-i18next");
|
|
217
|
-
var useTranslationTable = (column) => {
|
|
218
|
-
const { i18n, t } = (0, import_react_i18next.useTranslation)();
|
|
219
|
-
const columnTranslation = (0, import_react2.useMemo)(() => {
|
|
220
|
-
return column.map((item) => ({ ...item, name: t(`${item == null ? void 0 : item.name}`) }));
|
|
221
|
-
}, [i18n == null ? void 0 : i18n.language, column]);
|
|
222
|
-
return columnTranslation;
|
|
223
|
-
};
|
|
224
|
-
var useTranslationTable_default = useTranslationTable;
|
|
225
212
|
|
|
226
213
|
// src/component/Icons.tsx
|
|
227
214
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -312,36 +299,21 @@ var ReactTableGridCustomInner = ({
|
|
|
312
299
|
listPageSize = ["10", "100", "200", "500", "1000", "5000"],
|
|
313
300
|
fetching,
|
|
314
301
|
TableLogo,
|
|
302
|
+
tableRef,
|
|
315
303
|
...spread
|
|
316
304
|
}) => {
|
|
317
|
-
const
|
|
318
|
-
const
|
|
319
|
-
const [
|
|
320
|
-
const [containerWidth, setContainerWidth] = (0, import_react3.useState)(0);
|
|
321
|
-
const [sortColumns, setSortColumns] = (0, import_react3.useState)([]);
|
|
305
|
+
const [isLoading, setIsLoading] = (0, import_react2.useState)(true);
|
|
306
|
+
const [containerWidth, setContainerWidth] = (0, import_react2.useState)(0);
|
|
307
|
+
const [sortColumns, setSortColumns] = (0, import_react2.useState)([]);
|
|
322
308
|
const isSelectRow = selectedRows !== void 0;
|
|
323
|
-
const maxPage = (0,
|
|
309
|
+
const maxPage = (0, import_react2.useMemo)(
|
|
324
310
|
() => !hiddenPagination ? calculatorTotalPage({ total, pageSize }) : 0,
|
|
325
311
|
[pageSize, total, hiddenPagination]
|
|
326
312
|
);
|
|
327
|
-
const
|
|
328
|
-
if (!hiddenPaginationText && page && pageSize) {
|
|
329
|
-
const from = STT({ page, pageSize }, 0);
|
|
330
|
-
return {
|
|
331
|
-
from,
|
|
332
|
-
to: maxPage === page ? total != null ? total : 0 : page * pageSize
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
return { from: 0, to: 0 };
|
|
336
|
-
}, [page, pageSize, hiddenPaginationText, maxPage, total]);
|
|
337
|
-
const columnTranslation = useTranslationTable_default(
|
|
338
|
-
columns
|
|
339
|
-
);
|
|
340
|
-
const newColumns = (0, import_react3.useMemo)(() => {
|
|
313
|
+
const newColumns = (0, import_react2.useMemo)(() => {
|
|
341
314
|
let cols = [
|
|
342
|
-
...
|
|
315
|
+
...columns
|
|
343
316
|
];
|
|
344
|
-
const adjustedWidth = containerWidth - 45;
|
|
345
317
|
cols = cols.map(
|
|
346
318
|
(col) => "key" in col ? {
|
|
347
319
|
...col,
|
|
@@ -363,14 +335,14 @@ var ReactTableGridCustomInner = ({
|
|
|
363
335
|
}
|
|
364
336
|
return cols;
|
|
365
337
|
}, [
|
|
366
|
-
|
|
338
|
+
columns,
|
|
367
339
|
containerWidth,
|
|
368
340
|
hiddenSTT,
|
|
369
341
|
isSelectRow,
|
|
370
342
|
page,
|
|
371
343
|
pageSize
|
|
372
344
|
]);
|
|
373
|
-
const customRowKeyGetter = (0,
|
|
345
|
+
const customRowKeyGetter = (0, import_react2.useCallback)(
|
|
374
346
|
(row) => {
|
|
375
347
|
if (typeof rowKeyGetter === "function") {
|
|
376
348
|
return rowKeyGetter(row);
|
|
@@ -384,7 +356,7 @@ var ReactTableGridCustomInner = ({
|
|
|
384
356
|
},
|
|
385
357
|
[rowKeyGetter]
|
|
386
358
|
);
|
|
387
|
-
const sortedRows = (0,
|
|
359
|
+
const sortedRows = (0, import_react2.useMemo)(() => {
|
|
388
360
|
if (!sortColumns.length) return data;
|
|
389
361
|
const { columnKey, direction } = sortColumns[0];
|
|
390
362
|
if (!direction) return data;
|
|
@@ -392,10 +364,10 @@ var ReactTableGridCustomInner = ({
|
|
|
392
364
|
const iteratee = typeof columnKey === "string" ? columnKey : String(columnKey);
|
|
393
365
|
return (0, import_lodash3.orderBy)(data, [iteratee], [order]);
|
|
394
366
|
}, [data, sortColumns]);
|
|
395
|
-
(0,
|
|
367
|
+
(0, import_react2.useEffect)(() => {
|
|
396
368
|
var _a;
|
|
397
369
|
setIsLoading(false);
|
|
398
|
-
if ((_a = tableRef.current) == null ? void 0 : _a.element) {
|
|
370
|
+
if ((_a = tableRef == null ? void 0 : tableRef.current) == null ? void 0 : _a.element) {
|
|
399
371
|
setContainerWidth(tableRef.current.element.offsetWidth);
|
|
400
372
|
}
|
|
401
373
|
}, []);
|
|
@@ -418,7 +390,7 @@ var ReactTableGridCustomInner = ({
|
|
|
418
390
|
sortColumns,
|
|
419
391
|
onSortColumnsChange: setSortColumns,
|
|
420
392
|
renderers: {
|
|
421
|
-
renderSortStatus: RenderSortStatus_default,
|
|
393
|
+
renderSortStatus: (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RenderSortStatus_default, { ...props }),
|
|
422
394
|
renderCheckbox({ onChange: onChange2, checked, ...props }) {
|
|
423
395
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
424
396
|
import_core.Checkbox,
|
|
@@ -442,17 +414,17 @@ var ReactTableGridCustomInner = ({
|
|
|
442
414
|
}
|
|
443
415
|
);
|
|
444
416
|
};
|
|
445
|
-
var ReactTableGridCustom = (0,
|
|
417
|
+
var ReactTableGridCustom = (0, import_react2.memo)(
|
|
446
418
|
ReactTableGridCustomInner
|
|
447
419
|
);
|
|
448
420
|
|
|
449
421
|
// src/component/ui/Table/ReactTableGridCustomPaginationClient.tsx
|
|
450
|
-
var
|
|
422
|
+
var import_react4 = require("react");
|
|
451
423
|
|
|
452
424
|
// src/hooks/useDataPagingClient.ts
|
|
453
|
-
var
|
|
425
|
+
var import_react3 = require("react");
|
|
454
426
|
var useDataPagingClient = ({ data = [], page, pageSize }) => {
|
|
455
|
-
const newData = (0,
|
|
427
|
+
const newData = (0, import_react3.useMemo)(() => {
|
|
456
428
|
if (page && pageSize) {
|
|
457
429
|
const startIndex = (page - 1) * pageSize;
|
|
458
430
|
return data.slice(startIndex, startIndex + pageSize);
|
|
@@ -472,7 +444,7 @@ var ReactTableGridCustomPaginationClientInner = ({
|
|
|
472
444
|
refTable,
|
|
473
445
|
...spread
|
|
474
446
|
}) => {
|
|
475
|
-
const [configSearch, setConfigSearch] = (0,
|
|
447
|
+
const [configSearch, setConfigSearch] = (0, import_react4.useState)({
|
|
476
448
|
page: initPage,
|
|
477
449
|
pageSize: initPageSize
|
|
478
450
|
});
|
|
@@ -481,13 +453,13 @@ var ReactTableGridCustomPaginationClientInner = ({
|
|
|
481
453
|
page: configSearch == null ? void 0 : configSearch.page,
|
|
482
454
|
pageSize: configSearch == null ? void 0 : configSearch.pageSize
|
|
483
455
|
});
|
|
484
|
-
const resetPage = (0,
|
|
456
|
+
const resetPage = (0, import_react4.useCallback)(() => {
|
|
485
457
|
setConfigSearch((prev) => ({
|
|
486
458
|
...prev,
|
|
487
459
|
page: 1
|
|
488
460
|
}));
|
|
489
461
|
}, []);
|
|
490
|
-
(0,
|
|
462
|
+
(0, import_react4.useImperativeHandle)(
|
|
491
463
|
refTable,
|
|
492
464
|
() => {
|
|
493
465
|
var _a, _b;
|
|
@@ -525,227 +497,13 @@ var ReactTableGridCustomPaginationClientInner = ({
|
|
|
525
497
|
}
|
|
526
498
|
);
|
|
527
499
|
};
|
|
528
|
-
var ReactTableGridCustomPaginationClient = (0,
|
|
500
|
+
var ReactTableGridCustomPaginationClient = (0, import_react4.memo)(
|
|
529
501
|
ReactTableGridCustomPaginationClientInner
|
|
530
502
|
);
|
|
531
503
|
|
|
532
504
|
// src/component/ui/Table/TableStyleContextWapper.tsx
|
|
533
|
-
var
|
|
534
|
-
|
|
535
|
-
// src/component/ui/ContextMenu/ContextMenu.tsx
|
|
536
|
-
var import_react6 = require("react");
|
|
537
|
-
var import_react_dom = require("react-dom");
|
|
505
|
+
var import_react5 = require("react");
|
|
538
506
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
539
|
-
var ContextMenu = ({ selector, children, zIndex = 40 }) => {
|
|
540
|
-
const menuRef = (0, import_react6.useRef)(null);
|
|
541
|
-
const [mounted, setMounted] = (0, import_react6.useState)(false);
|
|
542
|
-
(0, import_react6.useEffect)(() => {
|
|
543
|
-
setMounted(true);
|
|
544
|
-
}, []);
|
|
545
|
-
const closeMenu = (0, import_react6.useCallback)(() => {
|
|
546
|
-
if (!mounted || typeof document === "undefined") return;
|
|
547
|
-
const contextMenuElem = menuRef.current;
|
|
548
|
-
const elementParent = document.querySelector(selector);
|
|
549
|
-
if (contextMenuElem == null ? void 0 : contextMenuElem.classList.contains("shadow-menu")) {
|
|
550
|
-
contextMenuElem.classList.remove("shadow-menu");
|
|
551
|
-
contextMenuElem.style.opacity = "0";
|
|
552
|
-
contextMenuElem.style.visibility = "hidden";
|
|
553
|
-
}
|
|
554
|
-
elementParent == null ? void 0 : elementParent.style.removeProperty("overflow");
|
|
555
|
-
}, [mounted, selector]);
|
|
556
|
-
(0, import_react6.useEffect)(() => {
|
|
557
|
-
if (!mounted || typeof document === "undefined" || typeof window === "undefined") return;
|
|
558
|
-
const elementParent = document.querySelector(selector);
|
|
559
|
-
if (!elementParent) return;
|
|
560
|
-
const clickMenu = (e) => {
|
|
561
|
-
e.preventDefault();
|
|
562
|
-
const contextMenuElem = menuRef.current;
|
|
563
|
-
if (!contextMenuElem) return;
|
|
564
|
-
contextMenuElem.style.opacity = "1";
|
|
565
|
-
contextMenuElem.style.visibility = "visible";
|
|
566
|
-
const { width, height } = contextMenuElem.getBoundingClientRect();
|
|
567
|
-
elementParent.style.overflow = "hidden";
|
|
568
|
-
const maxWidth = window.innerWidth;
|
|
569
|
-
const maxHeight = window.innerHeight;
|
|
570
|
-
const isLeft = maxWidth - e.clientX >= width;
|
|
571
|
-
const showTop = height + e.clientY <= maxHeight;
|
|
572
|
-
const showBottom = e.clientY - height >= 0;
|
|
573
|
-
const styleOrigin = { x: "left", y: "top" };
|
|
574
|
-
contextMenuElem.style.left = isLeft ? `${e.clientX}px` : `${e.clientX - width}px`;
|
|
575
|
-
styleOrigin.x = isLeft ? "left" : "right";
|
|
576
|
-
if (showTop) {
|
|
577
|
-
contextMenuElem.style.top = `${e.clientY}px`;
|
|
578
|
-
styleOrigin.y = "top";
|
|
579
|
-
} else if (showBottom) {
|
|
580
|
-
contextMenuElem.style.top = `${e.clientY - height}px`;
|
|
581
|
-
styleOrigin.y = "bottom";
|
|
582
|
-
} else {
|
|
583
|
-
let top = e.clientY - height / 2;
|
|
584
|
-
if (top < 0) top = 0;
|
|
585
|
-
if (top + height > maxHeight) top = maxHeight - height;
|
|
586
|
-
contextMenuElem.style.top = `${top}px`;
|
|
587
|
-
styleOrigin.y = "center";
|
|
588
|
-
}
|
|
589
|
-
contextMenuElem.style.transformOrigin = `${styleOrigin.y} ${styleOrigin.x}`;
|
|
590
|
-
contextMenuElem.classList.add("shadow-menu");
|
|
591
|
-
};
|
|
592
|
-
elementParent.addEventListener("contextmenu", clickMenu);
|
|
593
|
-
window.addEventListener("click", closeMenu);
|
|
594
|
-
return () => {
|
|
595
|
-
elementParent.removeEventListener("contextmenu", clickMenu);
|
|
596
|
-
window.removeEventListener("click", closeMenu);
|
|
597
|
-
};
|
|
598
|
-
}, [mounted, selector, closeMenu]);
|
|
599
|
-
if (!mounted || typeof document === "undefined") return null;
|
|
600
|
-
return (0, import_react_dom.createPortal)(
|
|
601
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
602
|
-
"div",
|
|
603
|
-
{
|
|
604
|
-
ref: menuRef,
|
|
605
|
-
className: "fixed w-fit",
|
|
606
|
-
style: { opacity: 0, visibility: "hidden", zIndex },
|
|
607
|
-
children
|
|
608
|
-
}
|
|
609
|
-
),
|
|
610
|
-
document.body
|
|
611
|
-
);
|
|
612
|
-
};
|
|
613
|
-
var ContextMenu_default = ContextMenu;
|
|
614
|
-
|
|
615
|
-
// src/component/ui/ContextMenu/RenderContextMenu.tsx
|
|
616
|
-
var import_react9 = require("react");
|
|
617
|
-
|
|
618
|
-
// src/component/ui/ContextMenu/ContextMenuItem.tsx
|
|
619
|
-
var import_react_i18next3 = require("react-i18next");
|
|
620
|
-
var import_md = require("react-icons/md");
|
|
621
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
622
|
-
var ContextMenuItem = ({
|
|
623
|
-
currentValue,
|
|
624
|
-
expandValue,
|
|
625
|
-
valueClickItem,
|
|
626
|
-
show,
|
|
627
|
-
isArrow
|
|
628
|
-
}) => {
|
|
629
|
-
const { t } = (0, import_react_i18next3.useTranslation)();
|
|
630
|
-
const Icon = currentValue.Icon;
|
|
631
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
632
|
-
"div",
|
|
633
|
-
{
|
|
634
|
-
className: `cursor-pointer p-2 flex items-center space-x-2 relative ${show ? "bg-[#555] text-white" : "hover:bg-[#555] hover:text-white"}`,
|
|
635
|
-
onClick: () => {
|
|
636
|
-
var _a;
|
|
637
|
-
expandValue && valueClickItem && (currentValue == null ? void 0 : currentValue.onClick) && ((_a = currentValue == null ? void 0 : currentValue.onClick) == null ? void 0 : _a.call(currentValue, valueClickItem, expandValue));
|
|
638
|
-
},
|
|
639
|
-
children: [
|
|
640
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { size: 20 }),
|
|
641
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-sm flex-1", children: t(`${currentValue.action}`) }),
|
|
642
|
-
isArrow && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_md.MdKeyboardArrowRight, { size: 20 })
|
|
643
|
-
]
|
|
644
|
-
}
|
|
645
|
-
);
|
|
646
|
-
};
|
|
647
|
-
var ContextMenuItem_default = ContextMenuItem;
|
|
648
|
-
|
|
649
|
-
// src/component/ui/ContextMenu/DropdownContextChild.tsx
|
|
650
|
-
var import_react7 = __toESM(require("@tippyjs/react"));
|
|
651
|
-
var import_react8 = require("react");
|
|
652
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
653
|
-
var DropdownContextChild = ({ button, children, ...rest }) => {
|
|
654
|
-
const id = (0, import_react8.useId)();
|
|
655
|
-
const instanceRef = (0, import_react8.useRef)(null);
|
|
656
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
657
|
-
import_react7.default,
|
|
658
|
-
{
|
|
659
|
-
theme: "drop-down",
|
|
660
|
-
className: "!bg-transparent !text-inherit !border-r-0 [&>*]:!p-0",
|
|
661
|
-
appendTo: document.body,
|
|
662
|
-
arrow: false,
|
|
663
|
-
placement: "auto",
|
|
664
|
-
interactive: true,
|
|
665
|
-
allowHTML: true,
|
|
666
|
-
content: children,
|
|
667
|
-
...rest,
|
|
668
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
669
|
-
"div",
|
|
670
|
-
{
|
|
671
|
-
id: `div-${id}`,
|
|
672
|
-
onClick: () => {
|
|
673
|
-
var _a;
|
|
674
|
-
(_a = instanceRef == null ? void 0 : instanceRef.current) == null ? void 0 : _a.show();
|
|
675
|
-
},
|
|
676
|
-
children: button
|
|
677
|
-
}
|
|
678
|
-
)
|
|
679
|
-
}
|
|
680
|
-
);
|
|
681
|
-
};
|
|
682
|
-
var DropdownContextChild_default = DropdownContextChild;
|
|
683
|
-
|
|
684
|
-
// src/component/ui/ContextMenu/RenderContextMenu.tsx
|
|
685
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
686
|
-
var ContextMenuItemWrapper = ({
|
|
687
|
-
menuAction,
|
|
688
|
-
valueClickItem,
|
|
689
|
-
expandValue
|
|
690
|
-
}) => {
|
|
691
|
-
const [isShow, setIsShow] = (0, import_react9.useState)(false);
|
|
692
|
-
if (!menuAction.children) {
|
|
693
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
694
|
-
ContextMenuItem_default,
|
|
695
|
-
{
|
|
696
|
-
currentValue: menuAction,
|
|
697
|
-
expandValue,
|
|
698
|
-
valueClickItem
|
|
699
|
-
}
|
|
700
|
-
);
|
|
701
|
-
}
|
|
702
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
703
|
-
DropdownContextChild_default,
|
|
704
|
-
{
|
|
705
|
-
appendTo: "parent",
|
|
706
|
-
placement: "right",
|
|
707
|
-
offset: [0, 5],
|
|
708
|
-
onShow: () => setIsShow(true),
|
|
709
|
-
onHide: () => setIsShow(false),
|
|
710
|
-
button: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
711
|
-
ContextMenuItem_default,
|
|
712
|
-
{
|
|
713
|
-
currentValue: menuAction,
|
|
714
|
-
expandValue,
|
|
715
|
-
valueClickItem,
|
|
716
|
-
show: isShow,
|
|
717
|
-
isArrow: true
|
|
718
|
-
}
|
|
719
|
-
),
|
|
720
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "dropdown-context-child absolute -top-[20px] -left-1", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
721
|
-
RenderContextMenu,
|
|
722
|
-
{
|
|
723
|
-
renderData: menuAction.children,
|
|
724
|
-
expandValue,
|
|
725
|
-
valueClickItem
|
|
726
|
-
}
|
|
727
|
-
) })
|
|
728
|
-
}
|
|
729
|
-
);
|
|
730
|
-
};
|
|
731
|
-
var RenderContextMenu = ({
|
|
732
|
-
renderData,
|
|
733
|
-
valueClickItem,
|
|
734
|
-
expandValue = {}
|
|
735
|
-
}) => {
|
|
736
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "bg-white shadow-submenu p-1 min-w-[250px] border", children: renderData == null ? void 0 : renderData.map((menuAction, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
737
|
-
ContextMenuItemWrapper,
|
|
738
|
-
{
|
|
739
|
-
menuAction,
|
|
740
|
-
expandValue,
|
|
741
|
-
valueClickItem
|
|
742
|
-
}
|
|
743
|
-
) }, index)) });
|
|
744
|
-
};
|
|
745
|
-
var RenderContextMenu_default = RenderContextMenu;
|
|
746
|
-
|
|
747
|
-
// src/component/ui/Table/TableStyleContextWapper.tsx
|
|
748
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
749
507
|
var isClient = typeof window !== "undefined";
|
|
750
508
|
var TableStyleContextWapper = ({
|
|
751
509
|
children,
|
|
@@ -755,29 +513,19 @@ var TableStyleContextWapper = ({
|
|
|
755
513
|
idWapper: externalId
|
|
756
514
|
}) => {
|
|
757
515
|
if (!isClient) {
|
|
758
|
-
return /* @__PURE__ */ (0,
|
|
516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children });
|
|
759
517
|
}
|
|
760
518
|
const idWapper = externalId != null ? externalId : "12";
|
|
761
|
-
return /* @__PURE__ */ (0,
|
|
519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
762
520
|
"div",
|
|
763
521
|
{
|
|
764
522
|
id: `wapper_menu_context-${idWapper}`,
|
|
765
523
|
className: `border border-[#dedede] rounded-xl overflow-hidden bg-white flex-1 h-full flex flex-col min-h-[360px] ${clsTablecustom != null ? clsTablecustom : ""}`,
|
|
766
|
-
children
|
|
767
|
-
(renderContext == null ? void 0 : renderContext.renderData) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
768
|
-
ContextMenu_default,
|
|
769
|
-
{
|
|
770
|
-
selector: `[id="wapper_menu_context-${idWapper}"] .rdg`,
|
|
771
|
-
...contextMenuProps,
|
|
772
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RenderContextMenu_default, { ...renderContext })
|
|
773
|
-
}
|
|
774
|
-
),
|
|
775
|
-
children
|
|
776
|
-
]
|
|
524
|
+
children
|
|
777
525
|
}
|
|
778
526
|
);
|
|
779
527
|
};
|
|
780
|
-
var TableStyleContextMenuWapper = (0,
|
|
528
|
+
var TableStyleContextMenuWapper = (0, import_react5.memo)(
|
|
781
529
|
TableStyleContextWapper
|
|
782
530
|
);
|
|
783
531
|
TableStyleContextMenuWapper.getIdFromOutside = (externalId) => {
|
package/dist/index.mjs
CHANGED
|
@@ -171,8 +171,7 @@ import {
|
|
|
171
171
|
memo,
|
|
172
172
|
useCallback as useCallback2,
|
|
173
173
|
useEffect,
|
|
174
|
-
useMemo as
|
|
175
|
-
useRef,
|
|
174
|
+
useMemo as useMemo2,
|
|
176
175
|
useState as useState2
|
|
177
176
|
} from "react";
|
|
178
177
|
import {
|
|
@@ -180,19 +179,6 @@ import {
|
|
|
180
179
|
SelectColumn
|
|
181
180
|
} from "react-data-grid";
|
|
182
181
|
import "react-data-grid/lib/styles.css";
|
|
183
|
-
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
184
|
-
|
|
185
|
-
// src/hooks/useTranslationTable.ts
|
|
186
|
-
import { useMemo as useMemo2 } from "react";
|
|
187
|
-
import { useTranslation } from "react-i18next";
|
|
188
|
-
var useTranslationTable = (column) => {
|
|
189
|
-
const { i18n, t } = useTranslation();
|
|
190
|
-
const columnTranslation = useMemo2(() => {
|
|
191
|
-
return column.map((item) => ({ ...item, name: t(`${item == null ? void 0 : item.name}`) }));
|
|
192
|
-
}, [i18n == null ? void 0 : i18n.language, column]);
|
|
193
|
-
return columnTranslation;
|
|
194
|
-
};
|
|
195
|
-
var useTranslationTable_default = useTranslationTable;
|
|
196
182
|
|
|
197
183
|
// src/component/Icons.tsx
|
|
198
184
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -283,36 +269,21 @@ var ReactTableGridCustomInner = ({
|
|
|
283
269
|
listPageSize = ["10", "100", "200", "500", "1000", "5000"],
|
|
284
270
|
fetching,
|
|
285
271
|
TableLogo,
|
|
272
|
+
tableRef,
|
|
286
273
|
...spread
|
|
287
274
|
}) => {
|
|
288
|
-
const { t } = useTranslation2();
|
|
289
|
-
const tableRef = useRef(null);
|
|
290
275
|
const [isLoading, setIsLoading] = useState2(true);
|
|
291
276
|
const [containerWidth, setContainerWidth] = useState2(0);
|
|
292
277
|
const [sortColumns, setSortColumns] = useState2([]);
|
|
293
278
|
const isSelectRow = selectedRows !== void 0;
|
|
294
|
-
const maxPage =
|
|
279
|
+
const maxPage = useMemo2(
|
|
295
280
|
() => !hiddenPagination ? calculatorTotalPage({ total, pageSize }) : 0,
|
|
296
281
|
[pageSize, total, hiddenPagination]
|
|
297
282
|
);
|
|
298
|
-
const
|
|
299
|
-
if (!hiddenPaginationText && page && pageSize) {
|
|
300
|
-
const from = STT({ page, pageSize }, 0);
|
|
301
|
-
return {
|
|
302
|
-
from,
|
|
303
|
-
to: maxPage === page ? total != null ? total : 0 : page * pageSize
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
return { from: 0, to: 0 };
|
|
307
|
-
}, [page, pageSize, hiddenPaginationText, maxPage, total]);
|
|
308
|
-
const columnTranslation = useTranslationTable_default(
|
|
309
|
-
columns
|
|
310
|
-
);
|
|
311
|
-
const newColumns = useMemo3(() => {
|
|
283
|
+
const newColumns = useMemo2(() => {
|
|
312
284
|
let cols = [
|
|
313
|
-
...
|
|
285
|
+
...columns
|
|
314
286
|
];
|
|
315
|
-
const adjustedWidth = containerWidth - 45;
|
|
316
287
|
cols = cols.map(
|
|
317
288
|
(col) => "key" in col ? {
|
|
318
289
|
...col,
|
|
@@ -334,7 +305,7 @@ var ReactTableGridCustomInner = ({
|
|
|
334
305
|
}
|
|
335
306
|
return cols;
|
|
336
307
|
}, [
|
|
337
|
-
|
|
308
|
+
columns,
|
|
338
309
|
containerWidth,
|
|
339
310
|
hiddenSTT,
|
|
340
311
|
isSelectRow,
|
|
@@ -355,7 +326,7 @@ var ReactTableGridCustomInner = ({
|
|
|
355
326
|
},
|
|
356
327
|
[rowKeyGetter]
|
|
357
328
|
);
|
|
358
|
-
const sortedRows =
|
|
329
|
+
const sortedRows = useMemo2(() => {
|
|
359
330
|
if (!sortColumns.length) return data;
|
|
360
331
|
const { columnKey, direction } = sortColumns[0];
|
|
361
332
|
if (!direction) return data;
|
|
@@ -366,7 +337,7 @@ var ReactTableGridCustomInner = ({
|
|
|
366
337
|
useEffect(() => {
|
|
367
338
|
var _a;
|
|
368
339
|
setIsLoading(false);
|
|
369
|
-
if ((_a = tableRef.current) == null ? void 0 : _a.element) {
|
|
340
|
+
if ((_a = tableRef == null ? void 0 : tableRef.current) == null ? void 0 : _a.element) {
|
|
370
341
|
setContainerWidth(tableRef.current.element.offsetWidth);
|
|
371
342
|
}
|
|
372
343
|
}, []);
|
|
@@ -389,7 +360,7 @@ var ReactTableGridCustomInner = ({
|
|
|
389
360
|
sortColumns,
|
|
390
361
|
onSortColumnsChange: setSortColumns,
|
|
391
362
|
renderers: {
|
|
392
|
-
renderSortStatus: RenderSortStatus_default,
|
|
363
|
+
renderSortStatus: (props) => /* @__PURE__ */ jsx3(RenderSortStatus_default, { ...props }),
|
|
393
364
|
renderCheckbox({ onChange: onChange2, checked, ...props }) {
|
|
394
365
|
return /* @__PURE__ */ jsx3(
|
|
395
366
|
Checkbox,
|
|
@@ -426,9 +397,9 @@ import {
|
|
|
426
397
|
} from "react";
|
|
427
398
|
|
|
428
399
|
// src/hooks/useDataPagingClient.ts
|
|
429
|
-
import { useMemo as
|
|
400
|
+
import { useMemo as useMemo3 } from "react";
|
|
430
401
|
var useDataPagingClient = ({ data = [], page, pageSize }) => {
|
|
431
|
-
const newData =
|
|
402
|
+
const newData = useMemo3(() => {
|
|
432
403
|
if (page && pageSize) {
|
|
433
404
|
const startIndex = (page - 1) * pageSize;
|
|
434
405
|
return data.slice(startIndex, startIndex + pageSize);
|
|
@@ -507,221 +478,7 @@ var ReactTableGridCustomPaginationClient = memo2(
|
|
|
507
478
|
|
|
508
479
|
// src/component/ui/Table/TableStyleContextWapper.tsx
|
|
509
480
|
import { memo as memo3 } from "react";
|
|
510
|
-
|
|
511
|
-
// src/component/ui/ContextMenu/ContextMenu.tsx
|
|
512
|
-
import { useCallback as useCallback4, useEffect as useEffect2, useRef as useRef2, useState as useState4 } from "react";
|
|
513
|
-
import { createPortal } from "react-dom";
|
|
514
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
515
|
-
var ContextMenu = ({ selector, children, zIndex = 40 }) => {
|
|
516
|
-
const menuRef = useRef2(null);
|
|
517
|
-
const [mounted, setMounted] = useState4(false);
|
|
518
|
-
useEffect2(() => {
|
|
519
|
-
setMounted(true);
|
|
520
|
-
}, []);
|
|
521
|
-
const closeMenu = useCallback4(() => {
|
|
522
|
-
if (!mounted || typeof document === "undefined") return;
|
|
523
|
-
const contextMenuElem = menuRef.current;
|
|
524
|
-
const elementParent = document.querySelector(selector);
|
|
525
|
-
if (contextMenuElem == null ? void 0 : contextMenuElem.classList.contains("shadow-menu")) {
|
|
526
|
-
contextMenuElem.classList.remove("shadow-menu");
|
|
527
|
-
contextMenuElem.style.opacity = "0";
|
|
528
|
-
contextMenuElem.style.visibility = "hidden";
|
|
529
|
-
}
|
|
530
|
-
elementParent == null ? void 0 : elementParent.style.removeProperty("overflow");
|
|
531
|
-
}, [mounted, selector]);
|
|
532
|
-
useEffect2(() => {
|
|
533
|
-
if (!mounted || typeof document === "undefined" || typeof window === "undefined") return;
|
|
534
|
-
const elementParent = document.querySelector(selector);
|
|
535
|
-
if (!elementParent) return;
|
|
536
|
-
const clickMenu = (e) => {
|
|
537
|
-
e.preventDefault();
|
|
538
|
-
const contextMenuElem = menuRef.current;
|
|
539
|
-
if (!contextMenuElem) return;
|
|
540
|
-
contextMenuElem.style.opacity = "1";
|
|
541
|
-
contextMenuElem.style.visibility = "visible";
|
|
542
|
-
const { width, height } = contextMenuElem.getBoundingClientRect();
|
|
543
|
-
elementParent.style.overflow = "hidden";
|
|
544
|
-
const maxWidth = window.innerWidth;
|
|
545
|
-
const maxHeight = window.innerHeight;
|
|
546
|
-
const isLeft = maxWidth - e.clientX >= width;
|
|
547
|
-
const showTop = height + e.clientY <= maxHeight;
|
|
548
|
-
const showBottom = e.clientY - height >= 0;
|
|
549
|
-
const styleOrigin = { x: "left", y: "top" };
|
|
550
|
-
contextMenuElem.style.left = isLeft ? `${e.clientX}px` : `${e.clientX - width}px`;
|
|
551
|
-
styleOrigin.x = isLeft ? "left" : "right";
|
|
552
|
-
if (showTop) {
|
|
553
|
-
contextMenuElem.style.top = `${e.clientY}px`;
|
|
554
|
-
styleOrigin.y = "top";
|
|
555
|
-
} else if (showBottom) {
|
|
556
|
-
contextMenuElem.style.top = `${e.clientY - height}px`;
|
|
557
|
-
styleOrigin.y = "bottom";
|
|
558
|
-
} else {
|
|
559
|
-
let top = e.clientY - height / 2;
|
|
560
|
-
if (top < 0) top = 0;
|
|
561
|
-
if (top + height > maxHeight) top = maxHeight - height;
|
|
562
|
-
contextMenuElem.style.top = `${top}px`;
|
|
563
|
-
styleOrigin.y = "center";
|
|
564
|
-
}
|
|
565
|
-
contextMenuElem.style.transformOrigin = `${styleOrigin.y} ${styleOrigin.x}`;
|
|
566
|
-
contextMenuElem.classList.add("shadow-menu");
|
|
567
|
-
};
|
|
568
|
-
elementParent.addEventListener("contextmenu", clickMenu);
|
|
569
|
-
window.addEventListener("click", closeMenu);
|
|
570
|
-
return () => {
|
|
571
|
-
elementParent.removeEventListener("contextmenu", clickMenu);
|
|
572
|
-
window.removeEventListener("click", closeMenu);
|
|
573
|
-
};
|
|
574
|
-
}, [mounted, selector, closeMenu]);
|
|
575
|
-
if (!mounted || typeof document === "undefined") return null;
|
|
576
|
-
return createPortal(
|
|
577
|
-
/* @__PURE__ */ jsx5(
|
|
578
|
-
"div",
|
|
579
|
-
{
|
|
580
|
-
ref: menuRef,
|
|
581
|
-
className: "fixed w-fit",
|
|
582
|
-
style: { opacity: 0, visibility: "hidden", zIndex },
|
|
583
|
-
children
|
|
584
|
-
}
|
|
585
|
-
),
|
|
586
|
-
document.body
|
|
587
|
-
);
|
|
588
|
-
};
|
|
589
|
-
var ContextMenu_default = ContextMenu;
|
|
590
|
-
|
|
591
|
-
// src/component/ui/ContextMenu/RenderContextMenu.tsx
|
|
592
|
-
import { Fragment as Fragment2, useState as useState5 } from "react";
|
|
593
|
-
|
|
594
|
-
// src/component/ui/ContextMenu/ContextMenuItem.tsx
|
|
595
|
-
import { useTranslation as useTranslation3 } from "react-i18next";
|
|
596
|
-
import { MdKeyboardArrowRight } from "react-icons/md";
|
|
597
|
-
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
598
|
-
var ContextMenuItem = ({
|
|
599
|
-
currentValue,
|
|
600
|
-
expandValue,
|
|
601
|
-
valueClickItem,
|
|
602
|
-
show,
|
|
603
|
-
isArrow
|
|
604
|
-
}) => {
|
|
605
|
-
const { t } = useTranslation3();
|
|
606
|
-
const Icon = currentValue.Icon;
|
|
607
|
-
return /* @__PURE__ */ jsxs3(
|
|
608
|
-
"div",
|
|
609
|
-
{
|
|
610
|
-
className: `cursor-pointer p-2 flex items-center space-x-2 relative ${show ? "bg-[#555] text-white" : "hover:bg-[#555] hover:text-white"}`,
|
|
611
|
-
onClick: () => {
|
|
612
|
-
var _a;
|
|
613
|
-
expandValue && valueClickItem && (currentValue == null ? void 0 : currentValue.onClick) && ((_a = currentValue == null ? void 0 : currentValue.onClick) == null ? void 0 : _a.call(currentValue, valueClickItem, expandValue));
|
|
614
|
-
},
|
|
615
|
-
children: [
|
|
616
|
-
/* @__PURE__ */ jsx6(Icon, { size: 20 }),
|
|
617
|
-
/* @__PURE__ */ jsx6("span", { className: "text-sm flex-1", children: t(`${currentValue.action}`) }),
|
|
618
|
-
isArrow && /* @__PURE__ */ jsx6(MdKeyboardArrowRight, { size: 20 })
|
|
619
|
-
]
|
|
620
|
-
}
|
|
621
|
-
);
|
|
622
|
-
};
|
|
623
|
-
var ContextMenuItem_default = ContextMenuItem;
|
|
624
|
-
|
|
625
|
-
// src/component/ui/ContextMenu/DropdownContextChild.tsx
|
|
626
|
-
import Tippy from "@tippyjs/react";
|
|
627
|
-
import { useId, useRef as useRef3 } from "react";
|
|
628
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
629
|
-
var DropdownContextChild = ({ button, children, ...rest }) => {
|
|
630
|
-
const id = useId();
|
|
631
|
-
const instanceRef = useRef3(null);
|
|
632
|
-
return /* @__PURE__ */ jsx7(
|
|
633
|
-
Tippy,
|
|
634
|
-
{
|
|
635
|
-
theme: "drop-down",
|
|
636
|
-
className: "!bg-transparent !text-inherit !border-r-0 [&>*]:!p-0",
|
|
637
|
-
appendTo: document.body,
|
|
638
|
-
arrow: false,
|
|
639
|
-
placement: "auto",
|
|
640
|
-
interactive: true,
|
|
641
|
-
allowHTML: true,
|
|
642
|
-
content: children,
|
|
643
|
-
...rest,
|
|
644
|
-
children: /* @__PURE__ */ jsx7(
|
|
645
|
-
"div",
|
|
646
|
-
{
|
|
647
|
-
id: `div-${id}`,
|
|
648
|
-
onClick: () => {
|
|
649
|
-
var _a;
|
|
650
|
-
(_a = instanceRef == null ? void 0 : instanceRef.current) == null ? void 0 : _a.show();
|
|
651
|
-
},
|
|
652
|
-
children: button
|
|
653
|
-
}
|
|
654
|
-
)
|
|
655
|
-
}
|
|
656
|
-
);
|
|
657
|
-
};
|
|
658
|
-
var DropdownContextChild_default = DropdownContextChild;
|
|
659
|
-
|
|
660
|
-
// src/component/ui/ContextMenu/RenderContextMenu.tsx
|
|
661
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
662
|
-
var ContextMenuItemWrapper = ({
|
|
663
|
-
menuAction,
|
|
664
|
-
valueClickItem,
|
|
665
|
-
expandValue
|
|
666
|
-
}) => {
|
|
667
|
-
const [isShow, setIsShow] = useState5(false);
|
|
668
|
-
if (!menuAction.children) {
|
|
669
|
-
return /* @__PURE__ */ jsx8(
|
|
670
|
-
ContextMenuItem_default,
|
|
671
|
-
{
|
|
672
|
-
currentValue: menuAction,
|
|
673
|
-
expandValue,
|
|
674
|
-
valueClickItem
|
|
675
|
-
}
|
|
676
|
-
);
|
|
677
|
-
}
|
|
678
|
-
return /* @__PURE__ */ jsx8(
|
|
679
|
-
DropdownContextChild_default,
|
|
680
|
-
{
|
|
681
|
-
appendTo: "parent",
|
|
682
|
-
placement: "right",
|
|
683
|
-
offset: [0, 5],
|
|
684
|
-
onShow: () => setIsShow(true),
|
|
685
|
-
onHide: () => setIsShow(false),
|
|
686
|
-
button: /* @__PURE__ */ jsx8(
|
|
687
|
-
ContextMenuItem_default,
|
|
688
|
-
{
|
|
689
|
-
currentValue: menuAction,
|
|
690
|
-
expandValue,
|
|
691
|
-
valueClickItem,
|
|
692
|
-
show: isShow,
|
|
693
|
-
isArrow: true
|
|
694
|
-
}
|
|
695
|
-
),
|
|
696
|
-
children: /* @__PURE__ */ jsx8("div", { className: "dropdown-context-child absolute -top-[20px] -left-1", children: /* @__PURE__ */ jsx8(
|
|
697
|
-
RenderContextMenu,
|
|
698
|
-
{
|
|
699
|
-
renderData: menuAction.children,
|
|
700
|
-
expandValue,
|
|
701
|
-
valueClickItem
|
|
702
|
-
}
|
|
703
|
-
) })
|
|
704
|
-
}
|
|
705
|
-
);
|
|
706
|
-
};
|
|
707
|
-
var RenderContextMenu = ({
|
|
708
|
-
renderData,
|
|
709
|
-
valueClickItem,
|
|
710
|
-
expandValue = {}
|
|
711
|
-
}) => {
|
|
712
|
-
return /* @__PURE__ */ jsx8("div", { className: "bg-white shadow-submenu p-1 min-w-[250px] border", children: renderData == null ? void 0 : renderData.map((menuAction, index) => /* @__PURE__ */ jsx8(Fragment2, { children: /* @__PURE__ */ jsx8(
|
|
713
|
-
ContextMenuItemWrapper,
|
|
714
|
-
{
|
|
715
|
-
menuAction,
|
|
716
|
-
expandValue,
|
|
717
|
-
valueClickItem
|
|
718
|
-
}
|
|
719
|
-
) }, index)) });
|
|
720
|
-
};
|
|
721
|
-
var RenderContextMenu_default = RenderContextMenu;
|
|
722
|
-
|
|
723
|
-
// src/component/ui/Table/TableStyleContextWapper.tsx
|
|
724
|
-
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
481
|
+
import { Fragment as Fragment2, jsx as jsx5 } from "react/jsx-runtime";
|
|
725
482
|
var isClient = typeof window !== "undefined";
|
|
726
483
|
var TableStyleContextWapper = ({
|
|
727
484
|
children,
|
|
@@ -731,25 +488,15 @@ var TableStyleContextWapper = ({
|
|
|
731
488
|
idWapper: externalId
|
|
732
489
|
}) => {
|
|
733
490
|
if (!isClient) {
|
|
734
|
-
return /* @__PURE__ */
|
|
491
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children });
|
|
735
492
|
}
|
|
736
493
|
const idWapper = externalId != null ? externalId : "12";
|
|
737
|
-
return /* @__PURE__ */
|
|
494
|
+
return /* @__PURE__ */ jsx5(
|
|
738
495
|
"div",
|
|
739
496
|
{
|
|
740
497
|
id: `wapper_menu_context-${idWapper}`,
|
|
741
498
|
className: `border border-[#dedede] rounded-xl overflow-hidden bg-white flex-1 h-full flex flex-col min-h-[360px] ${clsTablecustom != null ? clsTablecustom : ""}`,
|
|
742
|
-
children
|
|
743
|
-
(renderContext == null ? void 0 : renderContext.renderData) && /* @__PURE__ */ jsx9(
|
|
744
|
-
ContextMenu_default,
|
|
745
|
-
{
|
|
746
|
-
selector: `[id="wapper_menu_context-${idWapper}"] .rdg`,
|
|
747
|
-
...contextMenuProps,
|
|
748
|
-
children: /* @__PURE__ */ jsx9(RenderContextMenu_default, { ...renderContext })
|
|
749
|
-
}
|
|
750
|
-
),
|
|
751
|
-
children
|
|
752
|
-
]
|
|
499
|
+
children
|
|
753
500
|
}
|
|
754
501
|
);
|
|
755
502
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkt-loitd/react-table-grid-custom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "React Table Grid Custom component",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"private": false,
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@tanstack/react-query": "^5.0.0",
|
|
33
33
|
"@tanstack/query-core": "^5.0.0",
|
|
34
|
-
"next": ">=13",
|
|
35
34
|
"react": ">=18",
|
|
36
35
|
"react-dom": ">=18"
|
|
37
36
|
},
|
|
@@ -40,12 +39,10 @@
|
|
|
40
39
|
"@tippyjs/react": "^4.2.6",
|
|
41
40
|
"clsx": "^2.1.1",
|
|
42
41
|
"formik": "^2.4.9",
|
|
43
|
-
"i18next": "^25.7.3",
|
|
44
42
|
"idb": "^8.0.3",
|
|
45
43
|
"lodash": "^4.17.21",
|
|
46
44
|
"moment": "^2.30.1",
|
|
47
45
|
"react-data-grid": "^7.0.0-beta.59",
|
|
48
|
-
"react-i18next": "^16.5.0",
|
|
49
46
|
"react-icons": "^5.5.0",
|
|
50
47
|
"react-select": "^5.10.2",
|
|
51
48
|
"tailwind-merge": "^3.4.0",
|