@mkt-loitd/react-table-grid-custom 1.0.2 → 1.0.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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +116 -231
- package/dist/index.mjs +121 -226
- package/package.json +6 -4
package/dist/index.d.mts
CHANGED
|
@@ -38,8 +38,8 @@ interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key>
|
|
|
38
38
|
TableLogo?: string;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
declare const ReactTableGridCustom:
|
|
41
|
+
type ReactTableGridCustomComponent = <T, SR = unknown, K extends Key = Key>(props: IReactTableGridCustom<T, SR, K>) => JSX.Element;
|
|
42
|
+
declare const ReactTableGridCustom: ReactTableGridCustomComponent;
|
|
43
43
|
|
|
44
44
|
interface IPaginationParams {
|
|
45
45
|
pageSize?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -38,8 +38,8 @@ interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key>
|
|
|
38
38
|
TableLogo?: string;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
declare const ReactTableGridCustom:
|
|
41
|
+
type ReactTableGridCustomComponent = <T, SR = unknown, K extends Key = Key>(props: IReactTableGridCustom<T, SR, K>) => JSX.Element;
|
|
42
|
+
declare const ReactTableGridCustom: ReactTableGridCustomComponent;
|
|
43
43
|
|
|
44
44
|
interface IPaginationParams {
|
|
45
45
|
pageSize?: number;
|
package/dist/index.js
CHANGED
|
@@ -25,7 +25,12 @@ __export(index_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(index_exports);
|
|
26
26
|
|
|
27
27
|
// src/ReactTableGridCustom.tsx
|
|
28
|
-
var
|
|
28
|
+
var import_core = require("@mantine/core");
|
|
29
|
+
var import_lodash = require("lodash");
|
|
30
|
+
var import_react2 = require("react");
|
|
31
|
+
var import_react_data_grid = require("react-data-grid");
|
|
32
|
+
var import_styles = require("react-data-grid/lib/styles.css");
|
|
33
|
+
var import_react_i18next2 = require("react-i18next");
|
|
29
34
|
|
|
30
35
|
// src/helpers/table.ts
|
|
31
36
|
var calculatorTotalPage = ({ total = 0, pageSize = 0 }) => {
|
|
@@ -53,65 +58,20 @@ function cn(...inputs) {
|
|
|
53
58
|
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
54
59
|
}
|
|
55
60
|
|
|
56
|
-
// src/
|
|
57
|
-
var import_lodash = require("lodash");
|
|
58
|
-
var import_react3 = require("react");
|
|
59
|
-
var import_react_data_grid = require("react-data-grid");
|
|
60
|
-
var import_styles = require("react-data-grid/lib/styles.css");
|
|
61
|
-
var import_react_i18next2 = require("react-i18next");
|
|
62
|
-
|
|
63
|
-
// src/component/ComboboxCustom.tsx
|
|
64
|
-
var import_core = require("@mantine/core");
|
|
61
|
+
// src/hooks/useTranslationTable.ts
|
|
65
62
|
var import_react = require("react");
|
|
66
|
-
var
|
|
67
|
-
var
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
import_core.Combobox.Option,
|
|
74
|
-
{
|
|
75
|
-
className: "page_size-table",
|
|
76
|
-
value: item,
|
|
77
|
-
disabled: item === value,
|
|
78
|
-
children: item
|
|
79
|
-
},
|
|
80
|
-
item
|
|
81
|
-
));
|
|
82
|
-
}, [options, value]);
|
|
83
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
84
|
-
import_core.Combobox,
|
|
85
|
-
{
|
|
86
|
-
size: "sm",
|
|
87
|
-
store: combobox,
|
|
88
|
-
onOptionSubmit: (val) => {
|
|
89
|
-
onChange && onChange(val);
|
|
90
|
-
combobox.closeDropdown();
|
|
91
|
-
},
|
|
92
|
-
children: [
|
|
93
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Combobox.Target, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
-
import_core.InputBase,
|
|
95
|
-
{
|
|
96
|
-
component: "button",
|
|
97
|
-
type: "button",
|
|
98
|
-
pointer: true,
|
|
99
|
-
rightSectionPointerEvents: "none",
|
|
100
|
-
onClick: () => combobox.toggleDropdown(),
|
|
101
|
-
className: "w-[70px]",
|
|
102
|
-
classNames: { input: "custom_input_table" },
|
|
103
|
-
children: value || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Input.Placeholder, { children: "Pick value" })
|
|
104
|
-
}
|
|
105
|
-
) }),
|
|
106
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Combobox.Dropdown, { className: "w-[70px]", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Combobox.Options, { children: newOptions }) })
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
);
|
|
63
|
+
var import_react_i18next = require("react-i18next");
|
|
64
|
+
var useTranslationTable = (column) => {
|
|
65
|
+
const { i18n, t } = (0, import_react_i18next.useTranslation)();
|
|
66
|
+
const columnTranslation = (0, import_react.useMemo)(() => {
|
|
67
|
+
return column.map((item) => ({ ...item, name: t(`${item == null ? void 0 : item.name}`) }));
|
|
68
|
+
}, [i18n == null ? void 0 : i18n.language, column]);
|
|
69
|
+
return columnTranslation;
|
|
110
70
|
};
|
|
111
|
-
var
|
|
71
|
+
var useTranslationTable_default = useTranslationTable;
|
|
112
72
|
|
|
113
73
|
// src/component/Icons.tsx
|
|
114
|
-
var
|
|
74
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
115
75
|
var LoadingIcon = ({
|
|
116
76
|
isSpin = false,
|
|
117
77
|
h = 30,
|
|
@@ -119,7 +79,7 @@ var LoadingIcon = ({
|
|
|
119
79
|
size = 30,
|
|
120
80
|
className
|
|
121
81
|
}) => {
|
|
122
|
-
return /* @__PURE__ */ (0,
|
|
82
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
123
83
|
"svg",
|
|
124
84
|
{
|
|
125
85
|
className: `${isSpin ? "animate-spin" : ""} ${className != null ? className : ""}`,
|
|
@@ -130,7 +90,7 @@ var LoadingIcon = ({
|
|
|
130
90
|
height: size || h,
|
|
131
91
|
fill: "currentColor",
|
|
132
92
|
"aria-hidden": "true",
|
|
133
|
-
children: /* @__PURE__ */ (0,
|
|
93
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" })
|
|
134
94
|
}
|
|
135
95
|
);
|
|
136
96
|
};
|
|
@@ -140,7 +100,7 @@ var ArrowIcon = ({
|
|
|
140
100
|
size,
|
|
141
101
|
className
|
|
142
102
|
}) => {
|
|
143
|
-
return /* @__PURE__ */ (0,
|
|
103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
104
|
"svg",
|
|
145
105
|
{
|
|
146
106
|
className,
|
|
@@ -151,7 +111,7 @@ var ArrowIcon = ({
|
|
|
151
111
|
height: size != null ? size : h,
|
|
152
112
|
width: size != null ? size : w,
|
|
153
113
|
xmlns: "http://www.w3.org/2000/svg",
|
|
154
|
-
children: /* @__PURE__ */ (0,
|
|
114
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
155
115
|
"path",
|
|
156
116
|
{
|
|
157
117
|
fillRule: "evenodd",
|
|
@@ -163,35 +123,23 @@ var ArrowIcon = ({
|
|
|
163
123
|
};
|
|
164
124
|
|
|
165
125
|
// src/component/RenderSortStatus.tsx
|
|
166
|
-
var
|
|
126
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
167
127
|
var RenderSortStatus = ({ sortDirection, priority }) => {
|
|
168
|
-
return /* @__PURE__ */ (0,
|
|
169
|
-
sortDirection !== void 0 && /* @__PURE__ */ (0,
|
|
128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
129
|
+
sortDirection !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
170
130
|
ArrowIcon,
|
|
171
131
|
{
|
|
172
132
|
className: cn(sortDirection === "DESC" && "-rotate-180", "transition-transform"),
|
|
173
133
|
size: 20
|
|
174
134
|
}
|
|
175
135
|
),
|
|
176
|
-
/* @__PURE__ */ (0,
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: priority })
|
|
177
137
|
] });
|
|
178
138
|
};
|
|
179
139
|
var RenderSortStatus_default = RenderSortStatus;
|
|
180
140
|
|
|
181
|
-
// src/hooks/useTranslationTable.ts
|
|
182
|
-
var import_react2 = require("react");
|
|
183
|
-
var import_react_i18next = require("react-i18next");
|
|
184
|
-
var useTranslationTable = (column) => {
|
|
185
|
-
const { i18n, t } = (0, import_react_i18next.useTranslation)();
|
|
186
|
-
const columnTranslation = (0, import_react2.useMemo)(() => {
|
|
187
|
-
return column.map((item) => ({ ...item, name: t(`${item == null ? void 0 : item.name}`) }));
|
|
188
|
-
}, [i18n == null ? void 0 : i18n.language, column]);
|
|
189
|
-
return columnTranslation;
|
|
190
|
-
};
|
|
191
|
-
var useTranslationTable_default = useTranslationTable;
|
|
192
|
-
|
|
193
141
|
// src/ReactTableGridCustom.tsx
|
|
194
|
-
var
|
|
142
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
195
143
|
var ReactTableGridCustomInner = ({
|
|
196
144
|
classNamePaginationTable,
|
|
197
145
|
classNameWapperTable,
|
|
@@ -214,197 +162,134 @@ var ReactTableGridCustomInner = ({
|
|
|
214
162
|
...spread
|
|
215
163
|
}) => {
|
|
216
164
|
const { t } = (0, import_react_i18next2.useTranslation)();
|
|
217
|
-
const
|
|
218
|
-
const
|
|
219
|
-
const [containerWidth, setContainerWidth] = (0,
|
|
220
|
-
const [sortColumns, setSortColumns] = (0,
|
|
165
|
+
const tableRef = (0, import_react2.useRef)(null);
|
|
166
|
+
const [isLoading, setIsLoading] = (0, import_react2.useState)(true);
|
|
167
|
+
const [containerWidth, setContainerWidth] = (0, import_react2.useState)(0);
|
|
168
|
+
const [sortColumns, setSortColumns] = (0, import_react2.useState)([]);
|
|
221
169
|
const isSelectRow = selectedRows !== void 0;
|
|
222
|
-
const maxPage = (0,
|
|
223
|
-
() => !hiddenPagination ? calculatorTotalPage({
|
|
224
|
-
total,
|
|
225
|
-
pageSize
|
|
226
|
-
}) : 0,
|
|
170
|
+
const maxPage = (0, import_react2.useMemo)(
|
|
171
|
+
() => !hiddenPagination ? calculatorTotalPage({ total, pageSize }) : 0,
|
|
227
172
|
[pageSize, total, hiddenPagination]
|
|
228
173
|
);
|
|
229
|
-
const toInPagination = (0,
|
|
230
|
-
|
|
231
|
-
from
|
|
232
|
-
to: 0
|
|
233
|
-
};
|
|
234
|
-
if (!hiddenPaginationText && pageSize && page) {
|
|
235
|
-
const from = STT(
|
|
236
|
-
{
|
|
237
|
-
page,
|
|
238
|
-
pageSize
|
|
239
|
-
},
|
|
240
|
-
0
|
|
241
|
-
);
|
|
174
|
+
const toInPagination = (0, import_react2.useMemo)(() => {
|
|
175
|
+
if (!hiddenPaginationText && page && pageSize) {
|
|
176
|
+
const from = STT({ page, pageSize }, 0);
|
|
242
177
|
return {
|
|
243
178
|
from,
|
|
244
|
-
to: maxPage === page ? total : page * pageSize
|
|
179
|
+
to: maxPage === page ? total != null ? total : 0 : page * pageSize
|
|
245
180
|
};
|
|
246
181
|
}
|
|
247
|
-
return
|
|
248
|
-
}, [
|
|
249
|
-
const columnTranslation = useTranslationTable_default(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
newCol.width = 200;
|
|
265
|
-
return newCol;
|
|
266
|
-
});
|
|
267
|
-
const totalMaxWidth = columnsCustom.reduce((sum, col) => {
|
|
268
|
-
var _a;
|
|
269
|
-
return sum + ("width" in col ? Number((_a = col == null ? void 0 : col.width) != null ? _a : 200) : 0);
|
|
270
|
-
}, 0);
|
|
271
|
-
if (totalMaxWidth < adjustedContainerWidth && columnsCustom.length > 0) {
|
|
272
|
-
const evenWidth = Math.floor(adjustedContainerWidth / columnsCustom.length);
|
|
273
|
-
columnsCustom = columnsCustom.map((col) => {
|
|
274
|
-
const newCol = { ...col };
|
|
275
|
-
delete newCol.maxWidth;
|
|
276
|
-
newCol.width = evenWidth;
|
|
277
|
-
return newCol;
|
|
278
|
-
});
|
|
279
|
-
}
|
|
182
|
+
return { from: 0, to: 0 };
|
|
183
|
+
}, [page, pageSize, hiddenPaginationText, maxPage, total]);
|
|
184
|
+
const columnTranslation = useTranslationTable_default(
|
|
185
|
+
columns
|
|
186
|
+
);
|
|
187
|
+
const newColumns = (0, import_react2.useMemo)(() => {
|
|
188
|
+
let cols = [
|
|
189
|
+
...columnTranslation
|
|
190
|
+
];
|
|
191
|
+
const adjustedWidth = containerWidth - 45;
|
|
192
|
+
cols = cols.map(
|
|
193
|
+
(col) => "key" in col ? {
|
|
194
|
+
...col,
|
|
195
|
+
width: 200,
|
|
196
|
+
maxWidth: void 0
|
|
197
|
+
} : col
|
|
198
|
+
);
|
|
280
199
|
if (isSelectRow) {
|
|
281
|
-
|
|
200
|
+
cols.unshift(import_react_data_grid.SelectColumn);
|
|
282
201
|
}
|
|
283
|
-
if (!hiddenSTT
|
|
284
|
-
|
|
202
|
+
if (!hiddenSTT) {
|
|
203
|
+
const sttColumn = {
|
|
285
204
|
key: "index",
|
|
286
205
|
name: "STT",
|
|
287
206
|
width: 80,
|
|
288
207
|
renderCell: ({ rowIdx }) => STT({ page, pageSize }, rowIdx)
|
|
289
|
-
}
|
|
208
|
+
};
|
|
209
|
+
cols.unshift(sttColumn);
|
|
290
210
|
}
|
|
291
|
-
return
|
|
292
|
-
}, [
|
|
293
|
-
|
|
294
|
-
|
|
211
|
+
return cols;
|
|
212
|
+
}, [
|
|
213
|
+
columnTranslation,
|
|
214
|
+
containerWidth,
|
|
215
|
+
hiddenSTT,
|
|
216
|
+
isSelectRow,
|
|
217
|
+
page,
|
|
218
|
+
pageSize
|
|
219
|
+
]);
|
|
220
|
+
const customRowKeyGetter = (0, import_react2.useCallback)(
|
|
221
|
+
(row) => {
|
|
295
222
|
if (typeof rowKeyGetter === "function") {
|
|
296
223
|
return rowKeyGetter(row);
|
|
297
224
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}, [rowKeyGetter]);
|
|
301
|
-
const handlePageChange = (0, import_react3.useCallback)(
|
|
302
|
-
(page2) => {
|
|
303
|
-
if (onChange) {
|
|
304
|
-
onChange(page2);
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
if (setConfigPagination) {
|
|
308
|
-
setConfigPagination((prev) => ({ ...prev, page: page2 }));
|
|
225
|
+
if (typeof rowKeyGetter === "string") {
|
|
226
|
+
return (0, import_lodash.get)(row, rowKeyGetter);
|
|
309
227
|
}
|
|
228
|
+
throw new Error(
|
|
229
|
+
"rowKeyGetter must be a string or a function"
|
|
230
|
+
);
|
|
310
231
|
},
|
|
311
|
-
[
|
|
232
|
+
[rowKeyGetter]
|
|
312
233
|
);
|
|
313
|
-
const sortedRows = (0,
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
const
|
|
318
|
-
|
|
234
|
+
const sortedRows = (0, import_react2.useMemo)(() => {
|
|
235
|
+
if (!sortColumns.length) return data;
|
|
236
|
+
const { columnKey, direction } = sortColumns[0];
|
|
237
|
+
if (!direction) return data;
|
|
238
|
+
const order = direction === "ASC" ? "asc" : "desc";
|
|
239
|
+
const iteratee = typeof columnKey === "string" ? columnKey : String(columnKey);
|
|
240
|
+
return (0, import_lodash.orderBy)(data, [iteratee], [order]);
|
|
319
241
|
}, [data, sortColumns]);
|
|
320
|
-
(0,
|
|
321
|
-
|
|
322
|
-
|
|
242
|
+
(0, import_react2.useEffect)(() => {
|
|
243
|
+
var _a;
|
|
244
|
+
setIsLoading(false);
|
|
245
|
+
if ((_a = tableRef.current) == null ? void 0 : _a.element) {
|
|
246
|
+
setContainerWidth(tableRef.current.element.offsetWidth);
|
|
323
247
|
}
|
|
324
|
-
}, [
|
|
325
|
-
return /* @__PURE__ */ (0,
|
|
248
|
+
}, []);
|
|
249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
326
250
|
"div",
|
|
327
251
|
{
|
|
328
252
|
className: cn(
|
|
329
|
-
"wapper_table flex
|
|
253
|
+
"wapper_table flex flex-col h-full min-h-0",
|
|
330
254
|
classNameWapperTable
|
|
331
255
|
),
|
|
332
256
|
children: [
|
|
333
|
-
/* @__PURE__ */ (0,
|
|
334
|
-
|
|
335
|
-
import_react_data_grid.DataGrid,
|
|
336
|
-
{
|
|
337
|
-
ref: tableRef,
|
|
338
|
-
"aria-rowcount": sortedRows == null ? void 0 : sortedRows.length,
|
|
339
|
-
selectedRows,
|
|
340
|
-
rows: sortedRows,
|
|
341
|
-
rowKeyGetter: rowKeyGetter && isSelectRow ? customRowKeyGetter : void 0,
|
|
342
|
-
columns: newColumns,
|
|
343
|
-
renderers: {
|
|
344
|
-
renderSortStatus: RenderSortStatus_default,
|
|
345
|
-
renderCheckbox({ onChange: onChange2, checked, ...spread2 }) {
|
|
346
|
-
const handleChange = (e) => {
|
|
347
|
-
onChange2(e.target.checked, e.nativeEvent.shiftKey);
|
|
348
|
-
};
|
|
349
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core2.Checkbox, { color: "indigo", checked: !!checked, onChange: handleChange, ...spread2 });
|
|
350
|
-
}
|
|
351
|
-
},
|
|
352
|
-
className: "fill-grid flex-1 h-full min-h-0",
|
|
353
|
-
defaultColumnOptions: {
|
|
354
|
-
// minWidth: 200,
|
|
355
|
-
// maxWidth: 200,
|
|
356
|
-
renderCell: ({ column, row }) => {
|
|
357
|
-
const value = (0, import_lodash.get)(row, column.key);
|
|
358
|
-
return [null, void 0, ""].includes(value) ? "-" : value;
|
|
359
|
-
}
|
|
360
|
-
},
|
|
361
|
-
sortColumns,
|
|
362
|
-
onSortColumnsChange: setSortColumns,
|
|
363
|
-
...spread
|
|
364
|
-
}
|
|
365
|
-
),
|
|
366
|
-
total === 0 && TableLogo && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "no_result absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 select-none", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex flex-col justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("img", { src: TableLogo, alt: "", className: "size-32" }) }) })
|
|
367
|
-
] }),
|
|
368
|
-
!hiddenPagination && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
369
|
-
"div",
|
|
257
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
258
|
+
import_react_data_grid.DataGrid,
|
|
370
259
|
{
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
260
|
+
ref: tableRef,
|
|
261
|
+
rows: sortedRows,
|
|
262
|
+
columns: newColumns,
|
|
263
|
+
selectedRows,
|
|
264
|
+
rowKeyGetter: isSelectRow ? customRowKeyGetter : void 0,
|
|
265
|
+
sortColumns,
|
|
266
|
+
onSortColumnsChange: setSortColumns,
|
|
267
|
+
renderers: {
|
|
268
|
+
renderSortStatus: RenderSortStatus_default,
|
|
269
|
+
renderCheckbox({ onChange: onChange2, checked, ...props }) {
|
|
270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
271
|
+
import_core.Checkbox,
|
|
272
|
+
{
|
|
273
|
+
...props,
|
|
274
|
+
checked: !!checked,
|
|
275
|
+
onChange: (e) => {
|
|
276
|
+
const nativeEvent = e.nativeEvent;
|
|
277
|
+
const shiftKey = nativeEvent instanceof MouseEvent ? nativeEvent.shiftKey : false;
|
|
278
|
+
onChange2(e.target.checked, shiftKey);
|
|
385
279
|
}
|
|
386
280
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
{
|
|
392
|
-
color: "indigo",
|
|
393
|
-
total: maxPage,
|
|
394
|
-
size: "sm",
|
|
395
|
-
value: page,
|
|
396
|
-
onChange: handlePageChange
|
|
397
|
-
}
|
|
398
|
-
)
|
|
399
|
-
]
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
...spread
|
|
400
285
|
}
|
|
401
286
|
),
|
|
402
|
-
(fetching || isLoading) && /* @__PURE__ */ (0,
|
|
287
|
+
(fetching || isLoading) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LoadingIcon, { isSpin: true }) })
|
|
403
288
|
]
|
|
404
289
|
}
|
|
405
290
|
);
|
|
406
291
|
};
|
|
407
|
-
var ReactTableGridCustom = (0,
|
|
292
|
+
var ReactTableGridCustom = (0, import_react2.memo)(
|
|
408
293
|
ReactTableGridCustomInner
|
|
409
294
|
);
|
|
410
295
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
// src/ReactTableGridCustom.tsx
|
|
2
|
-
import { Checkbox
|
|
2
|
+
import { Checkbox } from "@mantine/core";
|
|
3
|
+
import { get, orderBy } from "lodash";
|
|
4
|
+
import {
|
|
5
|
+
memo,
|
|
6
|
+
useCallback,
|
|
7
|
+
useEffect,
|
|
8
|
+
useMemo as useMemo2,
|
|
9
|
+
useRef,
|
|
10
|
+
useState
|
|
11
|
+
} from "react";
|
|
12
|
+
import {
|
|
13
|
+
DataGrid,
|
|
14
|
+
SelectColumn
|
|
15
|
+
} from "react-data-grid";
|
|
16
|
+
import "react-data-grid/lib/styles.css";
|
|
17
|
+
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
3
18
|
|
|
4
19
|
// src/helpers/table.ts
|
|
5
20
|
var calculatorTotalPage = ({ total = 0, pageSize = 0 }) => {
|
|
@@ -27,65 +42,20 @@ function cn(...inputs) {
|
|
|
27
42
|
return twMerge(clsx(inputs));
|
|
28
43
|
}
|
|
29
44
|
|
|
30
|
-
// src/
|
|
31
|
-
import { get, orderBy } from "lodash";
|
|
32
|
-
import { memo, useCallback, useEffect, useMemo as useMemo3, useRef, useState } from "react";
|
|
33
|
-
import { DataGrid, SelectColumn } from "react-data-grid";
|
|
34
|
-
import "react-data-grid/lib/styles.css";
|
|
35
|
-
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
36
|
-
|
|
37
|
-
// src/component/ComboboxCustom.tsx
|
|
38
|
-
import { Combobox, Input, InputBase, useCombobox } from "@mantine/core";
|
|
45
|
+
// src/hooks/useTranslationTable.ts
|
|
39
46
|
import { useMemo } from "react";
|
|
40
|
-
import {
|
|
41
|
-
var
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Combobox.Option,
|
|
48
|
-
{
|
|
49
|
-
className: "page_size-table",
|
|
50
|
-
value: item,
|
|
51
|
-
disabled: item === value,
|
|
52
|
-
children: item
|
|
53
|
-
},
|
|
54
|
-
item
|
|
55
|
-
));
|
|
56
|
-
}, [options, value]);
|
|
57
|
-
return /* @__PURE__ */ jsxs(
|
|
58
|
-
Combobox,
|
|
59
|
-
{
|
|
60
|
-
size: "sm",
|
|
61
|
-
store: combobox,
|
|
62
|
-
onOptionSubmit: (val) => {
|
|
63
|
-
onChange && onChange(val);
|
|
64
|
-
combobox.closeDropdown();
|
|
65
|
-
},
|
|
66
|
-
children: [
|
|
67
|
-
/* @__PURE__ */ jsx(Combobox.Target, { children: /* @__PURE__ */ jsx(
|
|
68
|
-
InputBase,
|
|
69
|
-
{
|
|
70
|
-
component: "button",
|
|
71
|
-
type: "button",
|
|
72
|
-
pointer: true,
|
|
73
|
-
rightSectionPointerEvents: "none",
|
|
74
|
-
onClick: () => combobox.toggleDropdown(),
|
|
75
|
-
className: "w-[70px]",
|
|
76
|
-
classNames: { input: "custom_input_table" },
|
|
77
|
-
children: value || /* @__PURE__ */ jsx(Input.Placeholder, { children: "Pick value" })
|
|
78
|
-
}
|
|
79
|
-
) }),
|
|
80
|
-
/* @__PURE__ */ jsx(Combobox.Dropdown, { className: "w-[70px]", children: /* @__PURE__ */ jsx(Combobox.Options, { children: newOptions }) })
|
|
81
|
-
]
|
|
82
|
-
}
|
|
83
|
-
);
|
|
47
|
+
import { useTranslation } from "react-i18next";
|
|
48
|
+
var useTranslationTable = (column) => {
|
|
49
|
+
const { i18n, t } = useTranslation();
|
|
50
|
+
const columnTranslation = useMemo(() => {
|
|
51
|
+
return column.map((item) => ({ ...item, name: t(`${item == null ? void 0 : item.name}`) }));
|
|
52
|
+
}, [i18n == null ? void 0 : i18n.language, column]);
|
|
53
|
+
return columnTranslation;
|
|
84
54
|
};
|
|
85
|
-
var
|
|
55
|
+
var useTranslationTable_default = useTranslationTable;
|
|
86
56
|
|
|
87
57
|
// src/component/Icons.tsx
|
|
88
|
-
import { jsx
|
|
58
|
+
import { jsx } from "react/jsx-runtime";
|
|
89
59
|
var LoadingIcon = ({
|
|
90
60
|
isSpin = false,
|
|
91
61
|
h = 30,
|
|
@@ -93,7 +63,7 @@ var LoadingIcon = ({
|
|
|
93
63
|
size = 30,
|
|
94
64
|
className
|
|
95
65
|
}) => {
|
|
96
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ jsx(
|
|
97
67
|
"svg",
|
|
98
68
|
{
|
|
99
69
|
className: `${isSpin ? "animate-spin" : ""} ${className != null ? className : ""}`,
|
|
@@ -104,7 +74,7 @@ var LoadingIcon = ({
|
|
|
104
74
|
height: size || h,
|
|
105
75
|
fill: "currentColor",
|
|
106
76
|
"aria-hidden": "true",
|
|
107
|
-
children: /* @__PURE__ */
|
|
77
|
+
children: /* @__PURE__ */ jsx("path", { d: "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" })
|
|
108
78
|
}
|
|
109
79
|
);
|
|
110
80
|
};
|
|
@@ -114,7 +84,7 @@ var ArrowIcon = ({
|
|
|
114
84
|
size,
|
|
115
85
|
className
|
|
116
86
|
}) => {
|
|
117
|
-
return /* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ jsx(
|
|
118
88
|
"svg",
|
|
119
89
|
{
|
|
120
90
|
className,
|
|
@@ -125,7 +95,7 @@ var ArrowIcon = ({
|
|
|
125
95
|
height: size != null ? size : h,
|
|
126
96
|
width: size != null ? size : w,
|
|
127
97
|
xmlns: "http://www.w3.org/2000/svg",
|
|
128
|
-
children: /* @__PURE__ */
|
|
98
|
+
children: /* @__PURE__ */ jsx(
|
|
129
99
|
"path",
|
|
130
100
|
{
|
|
131
101
|
fillRule: "evenodd",
|
|
@@ -137,35 +107,23 @@ var ArrowIcon = ({
|
|
|
137
107
|
};
|
|
138
108
|
|
|
139
109
|
// src/component/RenderSortStatus.tsx
|
|
140
|
-
import { Fragment, jsx as
|
|
110
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
141
111
|
var RenderSortStatus = ({ sortDirection, priority }) => {
|
|
142
|
-
return /* @__PURE__ */
|
|
143
|
-
sortDirection !== void 0 && /* @__PURE__ */
|
|
112
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
113
|
+
sortDirection !== void 0 && /* @__PURE__ */ jsx2(
|
|
144
114
|
ArrowIcon,
|
|
145
115
|
{
|
|
146
116
|
className: cn(sortDirection === "DESC" && "-rotate-180", "transition-transform"),
|
|
147
117
|
size: 20
|
|
148
118
|
}
|
|
149
119
|
),
|
|
150
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ jsx2("span", { children: priority })
|
|
151
121
|
] });
|
|
152
122
|
};
|
|
153
123
|
var RenderSortStatus_default = RenderSortStatus;
|
|
154
124
|
|
|
155
|
-
// src/hooks/useTranslationTable.ts
|
|
156
|
-
import { useMemo as useMemo2 } from "react";
|
|
157
|
-
import { useTranslation } from "react-i18next";
|
|
158
|
-
var useTranslationTable = (column) => {
|
|
159
|
-
const { i18n, t } = useTranslation();
|
|
160
|
-
const columnTranslation = useMemo2(() => {
|
|
161
|
-
return column.map((item) => ({ ...item, name: t(`${item == null ? void 0 : item.name}`) }));
|
|
162
|
-
}, [i18n == null ? void 0 : i18n.language, column]);
|
|
163
|
-
return columnTranslation;
|
|
164
|
-
};
|
|
165
|
-
var useTranslationTable_default = useTranslationTable;
|
|
166
|
-
|
|
167
125
|
// src/ReactTableGridCustom.tsx
|
|
168
|
-
import { jsx as
|
|
126
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
169
127
|
var ReactTableGridCustomInner = ({
|
|
170
128
|
classNamePaginationTable,
|
|
171
129
|
classNameWapperTable,
|
|
@@ -188,192 +146,129 @@ var ReactTableGridCustomInner = ({
|
|
|
188
146
|
...spread
|
|
189
147
|
}) => {
|
|
190
148
|
const { t } = useTranslation2();
|
|
191
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
192
149
|
const tableRef = useRef(null);
|
|
150
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
193
151
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
194
152
|
const [sortColumns, setSortColumns] = useState([]);
|
|
195
153
|
const isSelectRow = selectedRows !== void 0;
|
|
196
|
-
const maxPage =
|
|
197
|
-
() => !hiddenPagination ? calculatorTotalPage({
|
|
198
|
-
total,
|
|
199
|
-
pageSize
|
|
200
|
-
}) : 0,
|
|
154
|
+
const maxPage = useMemo2(
|
|
155
|
+
() => !hiddenPagination ? calculatorTotalPage({ total, pageSize }) : 0,
|
|
201
156
|
[pageSize, total, hiddenPagination]
|
|
202
157
|
);
|
|
203
|
-
const toInPagination =
|
|
204
|
-
|
|
205
|
-
from
|
|
206
|
-
to: 0
|
|
207
|
-
};
|
|
208
|
-
if (!hiddenPaginationText && pageSize && page) {
|
|
209
|
-
const from = STT(
|
|
210
|
-
{
|
|
211
|
-
page,
|
|
212
|
-
pageSize
|
|
213
|
-
},
|
|
214
|
-
0
|
|
215
|
-
);
|
|
158
|
+
const toInPagination = useMemo2(() => {
|
|
159
|
+
if (!hiddenPaginationText && page && pageSize) {
|
|
160
|
+
const from = STT({ page, pageSize }, 0);
|
|
216
161
|
return {
|
|
217
162
|
from,
|
|
218
|
-
to: maxPage === page ? total : page * pageSize
|
|
163
|
+
to: maxPage === page ? total != null ? total : 0 : page * pageSize
|
|
219
164
|
};
|
|
220
165
|
}
|
|
221
|
-
return
|
|
222
|
-
}, [
|
|
223
|
-
const columnTranslation = useTranslationTable_default(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
newCol.width = 200;
|
|
239
|
-
return newCol;
|
|
240
|
-
});
|
|
241
|
-
const totalMaxWidth = columnsCustom.reduce((sum, col) => {
|
|
242
|
-
var _a;
|
|
243
|
-
return sum + ("width" in col ? Number((_a = col == null ? void 0 : col.width) != null ? _a : 200) : 0);
|
|
244
|
-
}, 0);
|
|
245
|
-
if (totalMaxWidth < adjustedContainerWidth && columnsCustom.length > 0) {
|
|
246
|
-
const evenWidth = Math.floor(adjustedContainerWidth / columnsCustom.length);
|
|
247
|
-
columnsCustom = columnsCustom.map((col) => {
|
|
248
|
-
const newCol = { ...col };
|
|
249
|
-
delete newCol.maxWidth;
|
|
250
|
-
newCol.width = evenWidth;
|
|
251
|
-
return newCol;
|
|
252
|
-
});
|
|
253
|
-
}
|
|
166
|
+
return { from: 0, to: 0 };
|
|
167
|
+
}, [page, pageSize, hiddenPaginationText, maxPage, total]);
|
|
168
|
+
const columnTranslation = useTranslationTable_default(
|
|
169
|
+
columns
|
|
170
|
+
);
|
|
171
|
+
const newColumns = useMemo2(() => {
|
|
172
|
+
let cols = [
|
|
173
|
+
...columnTranslation
|
|
174
|
+
];
|
|
175
|
+
const adjustedWidth = containerWidth - 45;
|
|
176
|
+
cols = cols.map(
|
|
177
|
+
(col) => "key" in col ? {
|
|
178
|
+
...col,
|
|
179
|
+
width: 200,
|
|
180
|
+
maxWidth: void 0
|
|
181
|
+
} : col
|
|
182
|
+
);
|
|
254
183
|
if (isSelectRow) {
|
|
255
|
-
|
|
184
|
+
cols.unshift(SelectColumn);
|
|
256
185
|
}
|
|
257
|
-
if (!hiddenSTT
|
|
258
|
-
|
|
186
|
+
if (!hiddenSTT) {
|
|
187
|
+
const sttColumn = {
|
|
259
188
|
key: "index",
|
|
260
189
|
name: "STT",
|
|
261
190
|
width: 80,
|
|
262
191
|
renderCell: ({ rowIdx }) => STT({ page, pageSize }, rowIdx)
|
|
263
|
-
}
|
|
192
|
+
};
|
|
193
|
+
cols.unshift(sttColumn);
|
|
264
194
|
}
|
|
265
|
-
return
|
|
266
|
-
}, [
|
|
267
|
-
|
|
268
|
-
|
|
195
|
+
return cols;
|
|
196
|
+
}, [
|
|
197
|
+
columnTranslation,
|
|
198
|
+
containerWidth,
|
|
199
|
+
hiddenSTT,
|
|
200
|
+
isSelectRow,
|
|
201
|
+
page,
|
|
202
|
+
pageSize
|
|
203
|
+
]);
|
|
204
|
+
const customRowKeyGetter = useCallback(
|
|
205
|
+
(row) => {
|
|
269
206
|
if (typeof rowKeyGetter === "function") {
|
|
270
207
|
return rowKeyGetter(row);
|
|
271
208
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}, [rowKeyGetter]);
|
|
275
|
-
const handlePageChange = useCallback(
|
|
276
|
-
(page2) => {
|
|
277
|
-
if (onChange) {
|
|
278
|
-
onChange(page2);
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
if (setConfigPagination) {
|
|
282
|
-
setConfigPagination((prev) => ({ ...prev, page: page2 }));
|
|
209
|
+
if (typeof rowKeyGetter === "string") {
|
|
210
|
+
return get(row, rowKeyGetter);
|
|
283
211
|
}
|
|
212
|
+
throw new Error(
|
|
213
|
+
"rowKeyGetter must be a string or a function"
|
|
214
|
+
);
|
|
284
215
|
},
|
|
285
|
-
[
|
|
216
|
+
[rowKeyGetter]
|
|
286
217
|
);
|
|
287
|
-
const sortedRows =
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
const
|
|
292
|
-
|
|
218
|
+
const sortedRows = useMemo2(() => {
|
|
219
|
+
if (!sortColumns.length) return data;
|
|
220
|
+
const { columnKey, direction } = sortColumns[0];
|
|
221
|
+
if (!direction) return data;
|
|
222
|
+
const order = direction === "ASC" ? "asc" : "desc";
|
|
223
|
+
const iteratee = typeof columnKey === "string" ? columnKey : String(columnKey);
|
|
224
|
+
return orderBy(data, [iteratee], [order]);
|
|
293
225
|
}, [data, sortColumns]);
|
|
294
226
|
useEffect(() => {
|
|
295
|
-
|
|
296
|
-
|
|
227
|
+
var _a;
|
|
228
|
+
setIsLoading(false);
|
|
229
|
+
if ((_a = tableRef.current) == null ? void 0 : _a.element) {
|
|
230
|
+
setContainerWidth(tableRef.current.element.offsetWidth);
|
|
297
231
|
}
|
|
298
|
-
}, [
|
|
299
|
-
return /* @__PURE__ */
|
|
232
|
+
}, []);
|
|
233
|
+
return /* @__PURE__ */ jsxs2(
|
|
300
234
|
"div",
|
|
301
235
|
{
|
|
302
236
|
className: cn(
|
|
303
|
-
"wapper_table flex
|
|
237
|
+
"wapper_table flex flex-col h-full min-h-0",
|
|
304
238
|
classNameWapperTable
|
|
305
239
|
),
|
|
306
240
|
children: [
|
|
307
|
-
/* @__PURE__ */
|
|
308
|
-
|
|
309
|
-
DataGrid,
|
|
310
|
-
{
|
|
311
|
-
ref: tableRef,
|
|
312
|
-
"aria-rowcount": sortedRows == null ? void 0 : sortedRows.length,
|
|
313
|
-
selectedRows,
|
|
314
|
-
rows: sortedRows,
|
|
315
|
-
rowKeyGetter: rowKeyGetter && isSelectRow ? customRowKeyGetter : void 0,
|
|
316
|
-
columns: newColumns,
|
|
317
|
-
renderers: {
|
|
318
|
-
renderSortStatus: RenderSortStatus_default,
|
|
319
|
-
renderCheckbox({ onChange: onChange2, checked, ...spread2 }) {
|
|
320
|
-
const handleChange = (e) => {
|
|
321
|
-
onChange2(e.target.checked, e.nativeEvent.shiftKey);
|
|
322
|
-
};
|
|
323
|
-
return /* @__PURE__ */ jsx4(Checkbox, { color: "indigo", checked: !!checked, onChange: handleChange, ...spread2 });
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
className: "fill-grid flex-1 h-full min-h-0",
|
|
327
|
-
defaultColumnOptions: {
|
|
328
|
-
// minWidth: 200,
|
|
329
|
-
// maxWidth: 200,
|
|
330
|
-
renderCell: ({ column, row }) => {
|
|
331
|
-
const value = get(row, column.key);
|
|
332
|
-
return [null, void 0, ""].includes(value) ? "-" : value;
|
|
333
|
-
}
|
|
334
|
-
},
|
|
335
|
-
sortColumns,
|
|
336
|
-
onSortColumnsChange: setSortColumns,
|
|
337
|
-
...spread
|
|
338
|
-
}
|
|
339
|
-
),
|
|
340
|
-
total === 0 && TableLogo && /* @__PURE__ */ jsx4("div", { className: "no_result absolute left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 select-none", children: /* @__PURE__ */ jsx4("div", { className: "flex flex-col justify-center", children: /* @__PURE__ */ jsx4("img", { src: TableLogo, alt: "", className: "size-32" }) }) })
|
|
341
|
-
] }),
|
|
342
|
-
!hiddenPagination && /* @__PURE__ */ jsxs3(
|
|
343
|
-
"div",
|
|
241
|
+
/* @__PURE__ */ jsx3(
|
|
242
|
+
DataGrid,
|
|
344
243
|
{
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
244
|
+
ref: tableRef,
|
|
245
|
+
rows: sortedRows,
|
|
246
|
+
columns: newColumns,
|
|
247
|
+
selectedRows,
|
|
248
|
+
rowKeyGetter: isSelectRow ? customRowKeyGetter : void 0,
|
|
249
|
+
sortColumns,
|
|
250
|
+
onSortColumnsChange: setSortColumns,
|
|
251
|
+
renderers: {
|
|
252
|
+
renderSortStatus: RenderSortStatus_default,
|
|
253
|
+
renderCheckbox({ onChange: onChange2, checked, ...props }) {
|
|
254
|
+
return /* @__PURE__ */ jsx3(
|
|
255
|
+
Checkbox,
|
|
256
|
+
{
|
|
257
|
+
...props,
|
|
258
|
+
checked: !!checked,
|
|
259
|
+
onChange: (e) => {
|
|
260
|
+
const nativeEvent = e.nativeEvent;
|
|
261
|
+
const shiftKey = nativeEvent instanceof MouseEvent ? nativeEvent.shiftKey : false;
|
|
262
|
+
onChange2(e.target.checked, shiftKey);
|
|
359
263
|
}
|
|
360
264
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
{
|
|
366
|
-
color: "indigo",
|
|
367
|
-
total: maxPage,
|
|
368
|
-
size: "sm",
|
|
369
|
-
value: page,
|
|
370
|
-
onChange: handlePageChange
|
|
371
|
-
}
|
|
372
|
-
)
|
|
373
|
-
]
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
...spread
|
|
374
269
|
}
|
|
375
270
|
),
|
|
376
|
-
(fetching || isLoading) && /* @__PURE__ */
|
|
271
|
+
(fetching || isLoading) && /* @__PURE__ */ jsx3("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx3(LoadingIcon, { isSpin: true }) })
|
|
377
272
|
]
|
|
378
273
|
}
|
|
379
274
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkt-loitd/react-table-grid-custom",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "React Table Grid Custom component",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"private": false,
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"types": "dist/index.d.ts",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
15
16
|
"import": "./dist/index.js",
|
|
16
17
|
"require": "./dist/index.cjs"
|
|
17
18
|
}
|
|
@@ -28,9 +29,9 @@
|
|
|
28
29
|
"release:patch": "npm version patch --no-git-tag-version"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
32
|
+
"next": ">=13",
|
|
31
33
|
"react": ">=18",
|
|
32
|
-
"react-dom": ">=18"
|
|
33
|
-
"next": ">=13"
|
|
34
|
+
"react-dom": ">=18"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"@mantine/core": "^8.3.10",
|
|
@@ -49,7 +50,8 @@
|
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@types/lodash": "^4.17.21",
|
|
52
|
-
"@types/react": "
|
|
53
|
+
"@types/react": ">=18",
|
|
54
|
+
"@types/react-dom": ">=18",
|
|
53
55
|
"tslib": "^2.8.1",
|
|
54
56
|
"tsup": "^8.5.1",
|
|
55
57
|
"typescript": "^5.9.3"
|