@mkt-loitd/react-table-grid-custom 1.3.9 → 1.4.1

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 CHANGED
@@ -25,26 +25,19 @@ interface useShowHideColumnReturn<T, SR> {
25
25
  declare const useShowHideColumn: <T, SR = unknown>({ nameLocal, columns, ignoreColumns }: useShowHideColumnParameter<T, SR>) => useShowHideColumnReturn<T, SR>;
26
26
 
27
27
  interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key> {
28
- /** Data */
28
+ classNameWapperTable?: string;
29
+ hiddenSTT?: boolean;
29
30
  data: readonly T[];
30
31
  columns: readonly ColumnOrColumnGroup<T, SR>[];
31
- /** Pagination display */
32
+ rowKeyGetter?: keyof T | ((row: T) => K);
32
33
  page?: number;
33
34
  pageSize?: number;
34
- hiddenSTT?: boolean;
35
- /** Selection */
36
35
  enableSelectRow?: boolean;
37
36
  selectedRows?: ReadonlySet<K>;
38
37
  onSelectedRowsChange?: (rows: ReadonlySet<K>) => void;
39
- /** Sorting */
40
38
  sortColumns?: readonly SortColumn[];
41
39
  onSortColumnsChange?: (sortColumns: readonly SortColumn[]) => void;
42
- /** Row key */
43
- rowKeyGetter?: keyof T | ((row: T) => K);
44
- /** UI */
45
- classNameWapperTable?: string;
46
40
  fetching?: boolean;
47
- /** Events */
48
41
  onRowClick?: (row: T, rowIdx: number) => void;
49
42
  onRowDoubleClick?: (row: T, rowIdx: number) => void;
50
43
  }
package/dist/index.d.ts CHANGED
@@ -25,26 +25,19 @@ interface useShowHideColumnReturn<T, SR> {
25
25
  declare const useShowHideColumn: <T, SR = unknown>({ nameLocal, columns, ignoreColumns }: useShowHideColumnParameter<T, SR>) => useShowHideColumnReturn<T, SR>;
26
26
 
27
27
  interface IReactTableGridCustom<T = unknown, SR = unknown, K extends Key = Key> {
28
- /** Data */
28
+ classNameWapperTable?: string;
29
+ hiddenSTT?: boolean;
29
30
  data: readonly T[];
30
31
  columns: readonly ColumnOrColumnGroup<T, SR>[];
31
- /** Pagination display */
32
+ rowKeyGetter?: keyof T | ((row: T) => K);
32
33
  page?: number;
33
34
  pageSize?: number;
34
- hiddenSTT?: boolean;
35
- /** Selection */
36
35
  enableSelectRow?: boolean;
37
36
  selectedRows?: ReadonlySet<K>;
38
37
  onSelectedRowsChange?: (rows: ReadonlySet<K>) => void;
39
- /** Sorting */
40
38
  sortColumns?: readonly SortColumn[];
41
39
  onSortColumnsChange?: (sortColumns: readonly SortColumn[]) => void;
42
- /** Row key */
43
- rowKeyGetter?: keyof T | ((row: T) => K);
44
- /** UI */
45
- classNameWapperTable?: string;
46
40
  fetching?: boolean;
47
- /** Events */
48
41
  onRowClick?: (row: T, rowIdx: number) => void;
49
42
  onRowDoubleClick?: (row: T, rowIdx: number) => void;
50
43
  }
package/dist/index.js CHANGED
@@ -199,7 +199,6 @@ var useShowHideColumn = ({
199
199
  };
200
200
 
201
201
  // src/component/ui/Table/ReactTableGridCustom.tsx
202
- var import_core = require("@mantine/core");
203
202
  var import_lodash3 = require("lodash");
204
203
  var import_react2 = require("react");
205
204
  var import_react_data_grid = require("react-data-grid");
@@ -229,52 +228,9 @@ var LoadingIcon = ({
229
228
  }
230
229
  );
231
230
  };
232
- var ArrowIcon = ({
233
- h,
234
- w,
235
- size,
236
- className
237
- }) => {
238
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
239
- "svg",
240
- {
241
- className,
242
- stroke: "currentColor",
243
- fill: "currentColor",
244
- strokeWidth: "0",
245
- viewBox: "0 0 16 16",
246
- height: size != null ? size : h,
247
- width: size != null ? size : w,
248
- xmlns: "http://www.w3.org/2000/svg",
249
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
250
- "path",
251
- {
252
- fillRule: "evenodd",
253
- d: "M8 4a.5.5 0 0 1 .5.5v5.793l2.146-2.147a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 1 1 .708-.708L7.5 10.293V4.5A.5.5 0 0 1 8 4"
254
- }
255
- )
256
- }
257
- );
258
- };
259
-
260
- // src/component/RenderSortStatus.tsx
261
- var import_jsx_runtime2 = require("react/jsx-runtime");
262
- var RenderSortStatus = ({ sortDirection, priority }) => {
263
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
264
- sortDirection !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
265
- ArrowIcon,
266
- {
267
- className: cn(sortDirection === "DESC" && "-rotate-180", "transition-transform"),
268
- size: 20
269
- }
270
- ),
271
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: priority })
272
- ] });
273
- };
274
- var RenderSortStatus_default = RenderSortStatus;
275
231
 
276
232
  // src/component/ui/Table/ReactTableGridCustom.tsx
277
- var import_jsx_runtime3 = require("react/jsx-runtime");
233
+ var import_jsx_runtime2 = require("react/jsx-runtime");
278
234
  var ReactTableGridCustomInner = (props) => {
279
235
  const {
280
236
  classNameWapperTable,
@@ -295,13 +251,13 @@ var ReactTableGridCustomInner = (props) => {
295
251
  } = props;
296
252
  const isSelectRow = enableSelectRow && selectedRows !== void 0;
297
253
  const newColumns = (0, import_react2.useMemo)(() => {
298
- let cols = [...columns];
254
+ const cols = [...columns];
299
255
  if (isSelectRow) {
300
256
  cols.unshift(import_react_data_grid.SelectColumn);
301
257
  }
302
258
  if (!hiddenSTT) {
303
259
  cols.unshift({
304
- key: "index",
260
+ key: "__index__",
305
261
  name: "STT",
306
262
  width: 80,
307
263
  renderCell: ({ rowIdx }) => STT({ page, pageSize }, rowIdx)
@@ -318,15 +274,15 @@ var ReactTableGridCustomInner = (props) => {
318
274
  },
319
275
  [rowKeyGetter]
320
276
  );
321
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
277
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
322
278
  "div",
323
279
  {
324
280
  className: cn(
325
- "wapper_table flex flex-col h-full min-h-0",
281
+ "wapper_table flex flex-col h-full min-h-0 relative",
326
282
  classNameWapperTable
327
283
  ),
328
284
  children: [
329
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
285
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
330
286
  import_react_data_grid.DataGrid,
331
287
  {
332
288
  rows: data,
@@ -337,26 +293,10 @@ var ReactTableGridCustomInner = (props) => {
337
293
  sortColumns,
338
294
  onSortColumnsChange,
339
295
  onCellClick: ({ row, rowIdx }) => onRowClick == null ? void 0 : onRowClick(row, rowIdx),
340
- onCellDoubleClick: ({ row, rowIdx }) => onRowDoubleClick == null ? void 0 : onRowDoubleClick(row, rowIdx),
341
- renderers: {
342
- renderSortStatus: (props2) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RenderSortStatus_default, { ...props2 }),
343
- renderCheckbox({ onChange, checked, ...props2 }) {
344
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
345
- import_core.Checkbox,
346
- {
347
- ...props2,
348
- checked: Boolean(checked),
349
- onChange: (e) => onChange(
350
- e.currentTarget.checked,
351
- e.nativeEvent instanceof MouseEvent ? e.nativeEvent.shiftKey : false
352
- )
353
- }
354
- );
355
- }
356
- }
296
+ onCellDoubleClick: ({ row, rowIdx }) => onRowDoubleClick == null ? void 0 : onRowDoubleClick(row, rowIdx)
357
297
  }
358
298
  ),
359
- fetching && /* @__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 }) })
299
+ fetching && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "absolute inset-0 flex items-center justify-center bg-white/60 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoadingIcon, { isSpin: true }) })
360
300
  ]
361
301
  }
362
302
  );
@@ -367,7 +307,7 @@ var ReactTableGridCustom = (0, import_react2.memo)(
367
307
 
368
308
  // src/component/ui/Table/TableStyleContextWapper.tsx
369
309
  var import_react3 = require("react");
370
- var import_jsx_runtime4 = require("react/jsx-runtime");
310
+ var import_jsx_runtime3 = require("react/jsx-runtime");
371
311
  var isClient = typeof window !== "undefined";
372
312
  var TableStyleContextWapper = ({
373
313
  children,
@@ -377,10 +317,10 @@ var TableStyleContextWapper = ({
377
317
  idWapper: externalId
378
318
  }) => {
379
319
  if (!isClient) {
380
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
320
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children });
381
321
  }
382
322
  const idWapper = externalId != null ? externalId : "12";
383
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
323
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
384
324
  "div",
385
325
  {
386
326
  id: `wapper_menu_context-${idWapper}`,
package/dist/index.mjs CHANGED
@@ -161,7 +161,6 @@ var useShowHideColumn = ({
161
161
  };
162
162
 
163
163
  // src/component/ui/Table/ReactTableGridCustom.tsx
164
- import { Checkbox } from "@mantine/core";
165
164
  import { get } from "lodash";
166
165
  import {
167
166
  memo,
@@ -198,52 +197,9 @@ var LoadingIcon = ({
198
197
  }
199
198
  );
200
199
  };
201
- var ArrowIcon = ({
202
- h,
203
- w,
204
- size,
205
- className
206
- }) => {
207
- return /* @__PURE__ */ jsx(
208
- "svg",
209
- {
210
- className,
211
- stroke: "currentColor",
212
- fill: "currentColor",
213
- strokeWidth: "0",
214
- viewBox: "0 0 16 16",
215
- height: size != null ? size : h,
216
- width: size != null ? size : w,
217
- xmlns: "http://www.w3.org/2000/svg",
218
- children: /* @__PURE__ */ jsx(
219
- "path",
220
- {
221
- fillRule: "evenodd",
222
- d: "M8 4a.5.5 0 0 1 .5.5v5.793l2.146-2.147a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 1 1 .708-.708L7.5 10.293V4.5A.5.5 0 0 1 8 4"
223
- }
224
- )
225
- }
226
- );
227
- };
228
-
229
- // src/component/RenderSortStatus.tsx
230
- import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
231
- var RenderSortStatus = ({ sortDirection, priority }) => {
232
- return /* @__PURE__ */ jsxs(Fragment, { children: [
233
- sortDirection !== void 0 && /* @__PURE__ */ jsx2(
234
- ArrowIcon,
235
- {
236
- className: cn(sortDirection === "DESC" && "-rotate-180", "transition-transform"),
237
- size: 20
238
- }
239
- ),
240
- /* @__PURE__ */ jsx2("span", { children: priority })
241
- ] });
242
- };
243
- var RenderSortStatus_default = RenderSortStatus;
244
200
 
245
201
  // src/component/ui/Table/ReactTableGridCustom.tsx
246
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
202
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
247
203
  var ReactTableGridCustomInner = (props) => {
248
204
  const {
249
205
  classNameWapperTable,
@@ -264,13 +220,13 @@ var ReactTableGridCustomInner = (props) => {
264
220
  } = props;
265
221
  const isSelectRow = enableSelectRow && selectedRows !== void 0;
266
222
  const newColumns = useMemo2(() => {
267
- let cols = [...columns];
223
+ const cols = [...columns];
268
224
  if (isSelectRow) {
269
225
  cols.unshift(SelectColumn);
270
226
  }
271
227
  if (!hiddenSTT) {
272
228
  cols.unshift({
273
- key: "index",
229
+ key: "__index__",
274
230
  name: "STT",
275
231
  width: 80,
276
232
  renderCell: ({ rowIdx }) => STT({ page, pageSize }, rowIdx)
@@ -287,15 +243,15 @@ var ReactTableGridCustomInner = (props) => {
287
243
  },
288
244
  [rowKeyGetter]
289
245
  );
290
- return /* @__PURE__ */ jsxs2(
246
+ return /* @__PURE__ */ jsxs(
291
247
  "div",
292
248
  {
293
249
  className: cn(
294
- "wapper_table flex flex-col h-full min-h-0",
250
+ "wapper_table flex flex-col h-full min-h-0 relative",
295
251
  classNameWapperTable
296
252
  ),
297
253
  children: [
298
- /* @__PURE__ */ jsx3(
254
+ /* @__PURE__ */ jsx2(
299
255
  DataGrid,
300
256
  {
301
257
  rows: data,
@@ -306,26 +262,10 @@ var ReactTableGridCustomInner = (props) => {
306
262
  sortColumns,
307
263
  onSortColumnsChange,
308
264
  onCellClick: ({ row, rowIdx }) => onRowClick == null ? void 0 : onRowClick(row, rowIdx),
309
- onCellDoubleClick: ({ row, rowIdx }) => onRowDoubleClick == null ? void 0 : onRowDoubleClick(row, rowIdx),
310
- renderers: {
311
- renderSortStatus: (props2) => /* @__PURE__ */ jsx3(RenderSortStatus_default, { ...props2 }),
312
- renderCheckbox({ onChange, checked, ...props2 }) {
313
- return /* @__PURE__ */ jsx3(
314
- Checkbox,
315
- {
316
- ...props2,
317
- checked: Boolean(checked),
318
- onChange: (e) => onChange(
319
- e.currentTarget.checked,
320
- e.nativeEvent instanceof MouseEvent ? e.nativeEvent.shiftKey : false
321
- )
322
- }
323
- );
324
- }
325
- }
265
+ onCellDoubleClick: ({ row, rowIdx }) => onRowDoubleClick == null ? void 0 : onRowDoubleClick(row, rowIdx)
326
266
  }
327
267
  ),
328
- fetching && /* @__PURE__ */ jsx3("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx3(LoadingIcon, { isSpin: true }) })
268
+ fetching && /* @__PURE__ */ jsx2("div", { className: "absolute inset-0 flex items-center justify-center bg-white/60 z-10", children: /* @__PURE__ */ jsx2(LoadingIcon, { isSpin: true }) })
329
269
  ]
330
270
  }
331
271
  );
@@ -336,7 +276,7 @@ var ReactTableGridCustom = memo(
336
276
 
337
277
  // src/component/ui/Table/TableStyleContextWapper.tsx
338
278
  import { memo as memo2 } from "react";
339
- import { Fragment as Fragment2, jsx as jsx4 } from "react/jsx-runtime";
279
+ import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
340
280
  var isClient = typeof window !== "undefined";
341
281
  var TableStyleContextWapper = ({
342
282
  children,
@@ -346,10 +286,10 @@ var TableStyleContextWapper = ({
346
286
  idWapper: externalId
347
287
  }) => {
348
288
  if (!isClient) {
349
- return /* @__PURE__ */ jsx4(Fragment2, { children });
289
+ return /* @__PURE__ */ jsx3(Fragment, { children });
350
290
  }
351
291
  const idWapper = externalId != null ? externalId : "12";
352
- return /* @__PURE__ */ jsx4(
292
+ return /* @__PURE__ */ jsx3(
353
293
  "div",
354
294
  {
355
295
  id: `wapper_menu_context-${idWapper}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkt-loitd/react-table-grid-custom",
3
- "version": "1.3.9",
3
+ "version": "1.4.1",
4
4
  "description": "React Table Grid Custom component",
5
5
  "license": "ISC",
6
6
  "private": false,