erp-pos-ecommerce-shared 0.1.3 → 0.1.4
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/components.d.ts +85 -4
- package/dist/components.js +174 -136
- package/dist/components.js.map +1 -1
- package/dist/index.js +174 -136
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/components.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { UseMutationResult, UseQueryOptions } from '@tanstack/react-query';
|
|
|
5
5
|
import { s as TblProductsImage, o as ITableFilterConfig, g as IFilterSelectOption } from './filters.interface-Cx-AXMPz.js';
|
|
6
6
|
import * as z from 'zod';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
|
-
import { ColumnDef,
|
|
8
|
+
import { ColumnDef, useReactTable, Row } from '@tanstack/react-table';
|
|
9
9
|
import { D as DataTableConfig, S as ServerTableState } from './datatable.interface-DFSQWdXd.js';
|
|
10
10
|
import { T as TableQueryParams } from './types-CiX8AkJA.js';
|
|
11
11
|
|
|
@@ -152,8 +152,18 @@ interface DataTableProps$1<TData> {
|
|
|
152
152
|
onClick: () => void;
|
|
153
153
|
Icon?: React.ElementType;
|
|
154
154
|
}[];
|
|
155
|
+
/** Called when a row is clicked */
|
|
156
|
+
onRowClick?: (row: TData) => void;
|
|
157
|
+
/** Called when a row is hovered */
|
|
158
|
+
onRowHover?: (row: TData) => void;
|
|
159
|
+
/** Empty state to display when no data is available */
|
|
160
|
+
emptyState?: React.ReactNode;
|
|
161
|
+
/** Table instance */
|
|
162
|
+
table?: ReturnType<typeof useReactTable<TData>>;
|
|
163
|
+
/** Custom Header component */
|
|
164
|
+
CustomHeader?: React.ReactNode;
|
|
155
165
|
}
|
|
156
|
-
declare const DataTable: <TData>({ data, columns, config, filters, totalRowCount, onStateChange, loading, enableRowCheck: canCheck, onSelectionChange, headerBgColor, columnActions, listMenuActions, }: DataTableProps$1<TData>) => react_jsx_runtime.JSX.Element;
|
|
166
|
+
declare const DataTable: <TData>({ data, columns, config, filters, totalRowCount, onStateChange, loading, enableRowCheck: canCheck, onSelectionChange, headerBgColor, columnActions, listMenuActions, onRowClick, onRowHover, emptyState, table: ExternalTable, CustomHeader, }: DataTableProps$1<TData>) => react_jsx_runtime.JSX.Element;
|
|
157
167
|
|
|
158
168
|
interface EmptyStateProps {
|
|
159
169
|
title?: string;
|
|
@@ -242,8 +252,18 @@ interface DataTableProps<TData> {
|
|
|
242
252
|
}[];
|
|
243
253
|
/** Header background color. Use light-dark(light, dark) for theme-aware colors */
|
|
244
254
|
headerBgColor?: string;
|
|
255
|
+
/** Whether the table is loading (shows skeleton rows instead of data) */
|
|
256
|
+
loading?: boolean;
|
|
257
|
+
/** Number of skeleton rows to show when loading */
|
|
258
|
+
skeletonRowCount?: number;
|
|
259
|
+
/** Called when a row is clicked */
|
|
260
|
+
onRowClick?: (row: TData) => void;
|
|
261
|
+
/** Called when a row is hovered */
|
|
262
|
+
onRowHover?: (row: TData) => void;
|
|
263
|
+
/** Empty state to display when no data is available */
|
|
264
|
+
emptyState?: React$1.ReactNode;
|
|
245
265
|
}
|
|
246
|
-
declare const SimpleDataTable: <TData>({ table, withBorder, borderRadius, SortIcon, SortIconAsc, SortIconDesc,
|
|
266
|
+
declare const SimpleDataTable: <TData>({ table, withBorder, borderRadius, SortIcon, SortIconAsc, SortIconDesc, canCheck, columnActions, listMenuActions, headerBgColor, loading, skeletonRowCount, onRowClick, onRowHover, emptyState, }: DataTableProps<TData>) => react_jsx_runtime.JSX.Element;
|
|
247
267
|
|
|
248
268
|
interface TableSkeletonProps {
|
|
249
269
|
/** Number of skeleton rows to show */
|
|
@@ -272,10 +292,71 @@ interface TablePageProps<TRow> {
|
|
|
272
292
|
* the query options. Called every time the table state changes.
|
|
273
293
|
*/
|
|
274
294
|
getQueryOptions: (params: TableQueryParams) => UseQueryOptions<PaginatedResponse<TRow>>;
|
|
295
|
+
/**
|
|
296
|
+
* Title of the table
|
|
297
|
+
*/
|
|
275
298
|
title: string;
|
|
299
|
+
/**
|
|
300
|
+
* Columns of the table
|
|
301
|
+
*/
|
|
276
302
|
columns: ColumnDef<TRow>[];
|
|
303
|
+
/**
|
|
304
|
+
* Filters of the table
|
|
305
|
+
*/
|
|
277
306
|
filters?: ITableFilterConfig[];
|
|
307
|
+
/**
|
|
308
|
+
* Whether the table is loading externally
|
|
309
|
+
*/
|
|
310
|
+
isLoadingExternal?: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Called when a row is clicked
|
|
313
|
+
*/
|
|
314
|
+
onRowClick?: (row: TRow) => void;
|
|
315
|
+
/**
|
|
316
|
+
* Called when a row is hovered
|
|
317
|
+
*/
|
|
318
|
+
onRowHover?: (row: TRow) => void;
|
|
319
|
+
/**
|
|
320
|
+
* Empty state of the table
|
|
321
|
+
*/
|
|
322
|
+
emptyState?: React.ReactNode;
|
|
323
|
+
/**
|
|
324
|
+
* Table instance
|
|
325
|
+
*/
|
|
326
|
+
table?: ReturnType<typeof useReactTable<TRow>>;
|
|
327
|
+
/**
|
|
328
|
+
* Whether to enable row selection
|
|
329
|
+
*/
|
|
330
|
+
enableRowSelection?: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* Header background color
|
|
333
|
+
*/
|
|
334
|
+
headerBgColor?: string;
|
|
335
|
+
/**
|
|
336
|
+
* Column actions to display per row
|
|
337
|
+
*/
|
|
338
|
+
columnActions?: (row: TRow) => React.ReactNode;
|
|
339
|
+
/**
|
|
340
|
+
* List menu actions to display per row
|
|
341
|
+
*/
|
|
342
|
+
listMenuActions?: (row: TRow) => {
|
|
343
|
+
label: string;
|
|
344
|
+
onClick: () => void;
|
|
345
|
+
Icon?: React.ElementType;
|
|
346
|
+
}[];
|
|
347
|
+
/**
|
|
348
|
+
* Called when row selection changes
|
|
349
|
+
*/
|
|
350
|
+
onSelectionChange?: (selectedRows: TRow[]) => void;
|
|
351
|
+
/**
|
|
352
|
+
* Configuration for the table
|
|
353
|
+
*/
|
|
354
|
+
config?: Partial<DataTableConfig>;
|
|
355
|
+
/**
|
|
356
|
+
* Custom Header component
|
|
357
|
+
*/
|
|
358
|
+
CustomHeader?: React.ReactNode;
|
|
278
359
|
}
|
|
279
|
-
declare const TablePage: <TRow>({ getQueryOptions, title, columns, filters, }: TablePageProps<TRow>) => react_jsx_runtime.JSX.Element;
|
|
360
|
+
declare const TablePage: <TRow>({ getQueryOptions, title, columns, filters, isLoadingExternal, onRowClick, onRowHover, emptyState, table, enableRowSelection, headerBgColor, columnActions, listMenuActions, onSelectionChange, config, CustomHeader, }: TablePageProps<TRow>) => react_jsx_runtime.JSX.Element;
|
|
280
361
|
|
|
281
362
|
export { BottomPagination, CreateEditForm, DataTable, EmptyState, FilterDate, type FilterDateProps, FilterSelect, type FilterSelectProps, FormGenerator, type FormInstance, type FormValues, ImageForm, type PaginatedResponse, SearchInput, SimpleDataTable, TablePage, TableSkeleton, configureImageFormIcons, dateGteFilterFn, fieldGenerator, generateFormSchema };
|
package/dist/components.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { Text, Group, Box, rem, Button, ScrollArea, Image, ActionIcon, TagsInput, Switch, MultiSelect, Select, NumberInput, PasswordInput, TextInput, LoadingOverlay, Stepper, Flex, Container, Title, Card, Pagination, Stack, Paper, Table, Menu, Popover,
|
|
2
|
+
import { Text, Group, Box, rem, Button, ScrollArea, Image, ActionIcon, TagsInput, Switch, MultiSelect, Select, NumberInput, PasswordInput, TextInput, LoadingOverlay, Stepper, Flex, Container, Title, Card, Pagination, Stack, Paper, Table, Skeleton, Menu, Popover, Checkbox, UnstyledButton } from '@mantine/core';
|
|
3
3
|
import { useForm } from '@tanstack/react-form';
|
|
4
4
|
import axios, { isAxiosError } from 'axios';
|
|
5
5
|
import { useRef, useMemo, useState, useEffect, useCallback } from 'react';
|
|
@@ -1363,60 +1363,77 @@ var TableBody = ({
|
|
|
1363
1363
|
canCheck = false,
|
|
1364
1364
|
columnActions,
|
|
1365
1365
|
MenuIcon = MoreVertical,
|
|
1366
|
-
listMenuActions
|
|
1366
|
+
listMenuActions,
|
|
1367
|
+
onRowClick,
|
|
1368
|
+
onRowHover
|
|
1367
1369
|
}) => {
|
|
1368
|
-
return /* @__PURE__ */ jsx(Table.Tbody, { children: table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxs(
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
{
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
},
|
|
1377
|
-
children: /* @__PURE__ */ jsx(
|
|
1378
|
-
Checkbox,
|
|
1370
|
+
return /* @__PURE__ */ jsx(Table.Tbody, { children: table.getRowModel().rows.map((row) => /* @__PURE__ */ jsxs(
|
|
1371
|
+
Table.Tr,
|
|
1372
|
+
{
|
|
1373
|
+
style: onRowClick ? { cursor: "pointer" } : void 0,
|
|
1374
|
+
onMouseEnter: () => onRowHover?.(row.original),
|
|
1375
|
+
children: [
|
|
1376
|
+
canCheck && /* @__PURE__ */ jsx(
|
|
1377
|
+
Table.Td,
|
|
1379
1378
|
{
|
|
1380
|
-
size: "xs",
|
|
1381
1379
|
styles: {
|
|
1382
|
-
|
|
1383
|
-
|
|
1380
|
+
td: {
|
|
1381
|
+
padding: "0 0 0 6px"
|
|
1384
1382
|
}
|
|
1385
1383
|
},
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1384
|
+
children: /* @__PURE__ */ jsx(
|
|
1385
|
+
Checkbox,
|
|
1386
|
+
{
|
|
1387
|
+
size: "xs",
|
|
1388
|
+
styles: {
|
|
1389
|
+
root: {
|
|
1390
|
+
width: 5
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
checked: row.getIsSelected(),
|
|
1394
|
+
onChange: row.getToggleSelectedHandler(),
|
|
1395
|
+
disabled: !row.getCanSelect(),
|
|
1396
|
+
"aria-label": "Select row"
|
|
1397
|
+
}
|
|
1398
|
+
)
|
|
1390
1399
|
}
|
|
1391
|
-
)
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsx(
|
|
1395
|
-
Text,
|
|
1396
|
-
{
|
|
1397
|
-
size: "sm",
|
|
1398
|
-
style: {
|
|
1399
|
-
color: "light-dark(var(--mantine-color-dark-7), var(--mantine-color-gray-1))"
|
|
1400
|
-
},
|
|
1401
|
-
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
1402
|
-
}
|
|
1403
|
-
) }, cell.id)),
|
|
1404
|
-
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Flex, { justify: "flex-end", align: "center", gap: "sm", children: [
|
|
1405
|
-
columnActions?.(row.original),
|
|
1406
|
-
listMenuActions && /* @__PURE__ */ jsxs(Menu, { variant: "subtle", children: [
|
|
1407
|
-
/* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", color: "gray", size: "sm", children: /* @__PURE__ */ jsx(MenuIcon, { size: 16 }) }) }),
|
|
1408
|
-
/* @__PURE__ */ jsx(Menu.Dropdown, { children: listMenuActions(row.original).map((action) => /* @__PURE__ */ jsx(
|
|
1409
|
-
Menu.Item,
|
|
1400
|
+
),
|
|
1401
|
+
row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(
|
|
1402
|
+
Table.Td,
|
|
1410
1403
|
{
|
|
1411
|
-
onClick:
|
|
1412
|
-
|
|
1413
|
-
|
|
1404
|
+
onClick: () => onRowClick?.(row.original),
|
|
1405
|
+
children: /* @__PURE__ */ jsx(
|
|
1406
|
+
Text,
|
|
1407
|
+
{
|
|
1408
|
+
size: "sm",
|
|
1409
|
+
style: {
|
|
1410
|
+
color: "light-dark(var(--mantine-color-dark-7), var(--mantine-color-gray-1))"
|
|
1411
|
+
},
|
|
1412
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
1413
|
+
}
|
|
1414
|
+
)
|
|
1414
1415
|
},
|
|
1415
|
-
|
|
1416
|
-
))
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1416
|
+
cell.id
|
|
1417
|
+
)),
|
|
1418
|
+
/* @__PURE__ */ jsx(Table.Td, { children: /* @__PURE__ */ jsxs(Flex, { justify: "flex-end", align: "center", gap: "sm", children: [
|
|
1419
|
+
columnActions?.(row.original),
|
|
1420
|
+
listMenuActions && /* @__PURE__ */ jsxs(Menu, { variant: "subtle", children: [
|
|
1421
|
+
/* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", color: "gray", size: "sm", children: /* @__PURE__ */ jsx(MenuIcon, { size: 16 }) }) }),
|
|
1422
|
+
/* @__PURE__ */ jsx(Menu.Dropdown, { children: listMenuActions(row.original).map((action) => /* @__PURE__ */ jsx(
|
|
1423
|
+
Menu.Item,
|
|
1424
|
+
{
|
|
1425
|
+
onClick: action.onClick,
|
|
1426
|
+
rightSection: action.Icon && /* @__PURE__ */ jsx(action.Icon, {}),
|
|
1427
|
+
children: action.label
|
|
1428
|
+
},
|
|
1429
|
+
action.label
|
|
1430
|
+
)) })
|
|
1431
|
+
] })
|
|
1432
|
+
] }) })
|
|
1433
|
+
]
|
|
1434
|
+
},
|
|
1435
|
+
row.id
|
|
1436
|
+
)) });
|
|
1420
1437
|
};
|
|
1421
1438
|
var EmptyState = ({
|
|
1422
1439
|
title = "No hay datos disponibles",
|
|
@@ -1505,14 +1522,25 @@ var SimpleDataTable = ({
|
|
|
1505
1522
|
SortIcon = ArrowUpDown,
|
|
1506
1523
|
SortIconAsc = ArrowUp,
|
|
1507
1524
|
SortIconDesc = ArrowDown,
|
|
1508
|
-
EmptyStateIcon = FileX,
|
|
1509
|
-
EmptyStateTitle = "No data found",
|
|
1510
|
-
EmptyStateDescription = "No data found",
|
|
1511
1525
|
canCheck = false,
|
|
1512
1526
|
columnActions,
|
|
1513
1527
|
listMenuActions,
|
|
1514
|
-
headerBgColor
|
|
1528
|
+
headerBgColor,
|
|
1529
|
+
loading = false,
|
|
1530
|
+
skeletonRowCount = 10,
|
|
1531
|
+
onRowClick,
|
|
1532
|
+
onRowHover,
|
|
1533
|
+
emptyState = /* @__PURE__ */ jsx(
|
|
1534
|
+
EmptyState,
|
|
1535
|
+
{
|
|
1536
|
+
title: "No data found",
|
|
1537
|
+
description: "No data found",
|
|
1538
|
+
icon: /* @__PURE__ */ jsx(FileX, { size: 32, color: "var(--mantine-color-gray-6)" })
|
|
1539
|
+
}
|
|
1540
|
+
)
|
|
1515
1541
|
}) => {
|
|
1542
|
+
const dataColumnsCount = table.getAllLeafColumns().length;
|
|
1543
|
+
const hasActionsColumn = !!(columnActions || listMenuActions);
|
|
1516
1544
|
return /* @__PURE__ */ jsx(Paper, { withBorder, radius: borderRadius, children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
1517
1545
|
/* @__PURE__ */ jsx(
|
|
1518
1546
|
TableHeader,
|
|
@@ -1522,13 +1550,33 @@ var SimpleDataTable = ({
|
|
|
1522
1550
|
SortIcon,
|
|
1523
1551
|
SortIconAsc,
|
|
1524
1552
|
SortIconDesc,
|
|
1525
|
-
hasActionsColumn
|
|
1553
|
+
hasActionsColumn,
|
|
1526
1554
|
headerBgColor
|
|
1527
1555
|
}
|
|
1528
1556
|
),
|
|
1529
|
-
|
|
1557
|
+
loading ? /* @__PURE__ */ jsx(Table.Tbody, { children: Array.from({ length: skeletonRowCount }).map((_, rowIdx) => /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
1558
|
+
canCheck && /* @__PURE__ */ jsx(Table.Td, { style: { minHeight: 40, verticalAlign: "middle" }, children: /* @__PURE__ */ jsx(Skeleton, { height: 16, width: 18, radius: "sm" }) }),
|
|
1559
|
+
Array.from({ length: dataColumnsCount }).map((_2, colIdx) => /* @__PURE__ */ jsx(
|
|
1560
|
+
Table.Td,
|
|
1561
|
+
{
|
|
1562
|
+
style: { minHeight: 40, verticalAlign: "middle" },
|
|
1563
|
+
children: /* @__PURE__ */ jsx(
|
|
1564
|
+
Skeleton,
|
|
1565
|
+
{
|
|
1566
|
+
height: 16,
|
|
1567
|
+
width: colIdx === dataColumnsCount - 1 ? 40 : `${60 + colIdx % 2 * 15}%`,
|
|
1568
|
+
radius: "sm"
|
|
1569
|
+
}
|
|
1570
|
+
)
|
|
1571
|
+
},
|
|
1572
|
+
colIdx
|
|
1573
|
+
)),
|
|
1574
|
+
hasActionsColumn && /* @__PURE__ */ jsx(Table.Td, { style: { minHeight: 40, verticalAlign: "middle" }, children: /* @__PURE__ */ jsx(Skeleton, { height: 16, width: 32, radius: "sm" }) })
|
|
1575
|
+
] }, rowIdx)) }) : table.getRowCount() > 0 ? /* @__PURE__ */ jsx(
|
|
1530
1576
|
TableBody,
|
|
1531
1577
|
{
|
|
1578
|
+
onRowClick,
|
|
1579
|
+
onRowHover,
|
|
1532
1580
|
table,
|
|
1533
1581
|
canCheck,
|
|
1534
1582
|
columnActions,
|
|
@@ -1544,20 +1592,7 @@ var SimpleDataTable = ({
|
|
|
1544
1592
|
justify: "center",
|
|
1545
1593
|
align: "center",
|
|
1546
1594
|
style: { minHeight: 200 },
|
|
1547
|
-
children:
|
|
1548
|
-
EmptyState,
|
|
1549
|
-
{
|
|
1550
|
-
title: EmptyStateTitle,
|
|
1551
|
-
description: EmptyStateDescription,
|
|
1552
|
-
icon: /* @__PURE__ */ jsx(
|
|
1553
|
-
EmptyStateIcon,
|
|
1554
|
-
{
|
|
1555
|
-
size: 32,
|
|
1556
|
-
color: "var(--mantine-color-gray-6)"
|
|
1557
|
-
}
|
|
1558
|
-
)
|
|
1559
|
-
}
|
|
1560
|
-
)
|
|
1595
|
+
children: emptyState
|
|
1561
1596
|
}
|
|
1562
1597
|
)
|
|
1563
1598
|
}
|
|
@@ -1788,10 +1823,15 @@ var DataTable = ({
|
|
|
1788
1823
|
onSelectionChange,
|
|
1789
1824
|
headerBgColor,
|
|
1790
1825
|
columnActions,
|
|
1791
|
-
listMenuActions
|
|
1826
|
+
listMenuActions,
|
|
1827
|
+
onRowClick,
|
|
1828
|
+
onRowHover,
|
|
1829
|
+
emptyState,
|
|
1830
|
+
table: ExternalTable,
|
|
1831
|
+
CustomHeader
|
|
1792
1832
|
}) => {
|
|
1793
1833
|
const {
|
|
1794
|
-
table,
|
|
1834
|
+
table: internalTable,
|
|
1795
1835
|
globalFilter,
|
|
1796
1836
|
setGlobalFilter,
|
|
1797
1837
|
columnFilters,
|
|
@@ -1806,6 +1846,7 @@ var DataTable = ({
|
|
|
1806
1846
|
totalRowCount,
|
|
1807
1847
|
onStateChange
|
|
1808
1848
|
});
|
|
1849
|
+
const table = ExternalTable ?? internalTable;
|
|
1809
1850
|
useEffect(() => {
|
|
1810
1851
|
if (canCheck && onSelectionChange) {
|
|
1811
1852
|
onSelectionChange(selectedRows);
|
|
@@ -1813,80 +1854,54 @@ var DataTable = ({
|
|
|
1813
1854
|
}, [canCheck, onSelectionChange, selectedRows]);
|
|
1814
1855
|
const getFilterValue = (columnId) => columnFilters.find((f) => f.id === columnId)?.value ?? null;
|
|
1815
1856
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "md", children: [
|
|
1816
|
-
/* @__PURE__ */ jsxs(
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
value: globalFilter,
|
|
1821
|
-
onChange: setGlobalFilter,
|
|
1822
|
-
placeholder: mergedConfig.searchPlaceholder
|
|
1823
|
-
}
|
|
1824
|
-
),
|
|
1825
|
-
filters?.map(
|
|
1826
|
-
(f) => f.type === "date" ? /* @__PURE__ */ jsx(
|
|
1827
|
-
FilterDate,
|
|
1857
|
+
/* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", children: [
|
|
1858
|
+
/* @__PURE__ */ jsxs(Group, { gap: "md", wrap: "wrap", children: [
|
|
1859
|
+
mergedConfig.enableGlobalFilter && /* @__PURE__ */ jsx(
|
|
1860
|
+
SearchInput,
|
|
1828
1861
|
{
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
{
|
|
1838
|
-
columnId: f.columnId,
|
|
1839
|
-
options: f.options ?? [],
|
|
1840
|
-
onChange: setColumnFilter,
|
|
1841
|
-
placeholder: f.placeholder ?? "Todos"
|
|
1842
|
-
},
|
|
1843
|
-
f.columnId
|
|
1844
|
-
)
|
|
1845
|
-
)
|
|
1846
|
-
] }),
|
|
1847
|
-
loading ? /* @__PURE__ */ jsx(Paper, { withBorder: true, radius: "md", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
1848
|
-
/* @__PURE__ */ jsx(
|
|
1849
|
-
TableHeader,
|
|
1850
|
-
{
|
|
1851
|
-
table,
|
|
1852
|
-
canCheck,
|
|
1853
|
-
SortIcon: ArrowUpDown,
|
|
1854
|
-
SortIconAsc: ArrowUp,
|
|
1855
|
-
SortIconDesc: ArrowDown,
|
|
1856
|
-
hasActionsColumn: !!(columnActions || listMenuActions),
|
|
1857
|
-
headerBgColor
|
|
1858
|
-
}
|
|
1859
|
-
),
|
|
1860
|
-
/* @__PURE__ */ jsx(Table.Tbody, { children: Array.from({ length: mergedConfig.defaultPageSize }).map(
|
|
1861
|
-
(_, rowIdx) => /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
1862
|
-
canCheck && /* @__PURE__ */ jsx(Table.Td, { style: { minHeight: 40, verticalAlign: "middle" }, children: /* @__PURE__ */ jsx(Skeleton, { height: 16, width: 18, radius: "sm" }) }),
|
|
1863
|
-
Array.from({ length: columns.length }).map((_2, colIdx) => /* @__PURE__ */ jsx(
|
|
1864
|
-
Table.Td,
|
|
1862
|
+
value: globalFilter,
|
|
1863
|
+
onChange: setGlobalFilter,
|
|
1864
|
+
placeholder: mergedConfig.searchPlaceholder
|
|
1865
|
+
}
|
|
1866
|
+
),
|
|
1867
|
+
filters?.map(
|
|
1868
|
+
(f) => f.type === "date" ? /* @__PURE__ */ jsx(
|
|
1869
|
+
FilterDate,
|
|
1865
1870
|
{
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
height: 16,
|
|
1871
|
-
width: colIdx === columns.length - 1 ? 40 : `${60 + colIdx % 2 * 15}%`,
|
|
1872
|
-
radius: "sm"
|
|
1873
|
-
}
|
|
1874
|
-
)
|
|
1871
|
+
columnId: f.columnId,
|
|
1872
|
+
value: getFilterValue(f.columnId),
|
|
1873
|
+
onChange: setColumnFilter,
|
|
1874
|
+
placeholder: f.placeholder
|
|
1875
1875
|
},
|
|
1876
|
-
|
|
1877
|
-
)
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1876
|
+
f.columnId
|
|
1877
|
+
) : /* @__PURE__ */ jsx(
|
|
1878
|
+
FilterSelect,
|
|
1879
|
+
{
|
|
1880
|
+
columnId: f.columnId,
|
|
1881
|
+
options: f.options ?? [],
|
|
1882
|
+
onChange: setColumnFilter,
|
|
1883
|
+
placeholder: f.placeholder ?? "Todos"
|
|
1884
|
+
},
|
|
1885
|
+
f.columnId
|
|
1886
|
+
)
|
|
1887
|
+
)
|
|
1888
|
+
] }),
|
|
1889
|
+
CustomHeader
|
|
1890
|
+
] }),
|
|
1891
|
+
/* @__PURE__ */ jsxs(Paper, { withBorder: true, radius: "md", style: { overflow: "hidden" }, children: [
|
|
1882
1892
|
/* @__PURE__ */ jsx(
|
|
1883
1893
|
SimpleDataTable,
|
|
1884
1894
|
{
|
|
1895
|
+
onRowClick,
|
|
1896
|
+
onRowHover,
|
|
1885
1897
|
table,
|
|
1886
1898
|
canCheck,
|
|
1887
1899
|
columnActions,
|
|
1888
1900
|
listMenuActions,
|
|
1889
|
-
headerBgColor
|
|
1901
|
+
headerBgColor,
|
|
1902
|
+
loading,
|
|
1903
|
+
skeletonRowCount: mergedConfig.defaultPageSize,
|
|
1904
|
+
emptyState
|
|
1890
1905
|
}
|
|
1891
1906
|
),
|
|
1892
1907
|
/* @__PURE__ */ jsx(
|
|
@@ -1930,7 +1945,19 @@ var TablePage = ({
|
|
|
1930
1945
|
getQueryOptions,
|
|
1931
1946
|
title,
|
|
1932
1947
|
columns,
|
|
1933
|
-
filters
|
|
1948
|
+
filters,
|
|
1949
|
+
isLoadingExternal,
|
|
1950
|
+
onRowClick,
|
|
1951
|
+
onRowHover,
|
|
1952
|
+
emptyState,
|
|
1953
|
+
table,
|
|
1954
|
+
enableRowSelection,
|
|
1955
|
+
headerBgColor,
|
|
1956
|
+
columnActions,
|
|
1957
|
+
listMenuActions,
|
|
1958
|
+
onSelectionChange,
|
|
1959
|
+
config,
|
|
1960
|
+
CustomHeader
|
|
1934
1961
|
}) => {
|
|
1935
1962
|
const [tableParams, setTableParams] = useState({
|
|
1936
1963
|
skip: 0,
|
|
@@ -1951,12 +1978,23 @@ var TablePage = ({
|
|
|
1951
1978
|
/* @__PURE__ */ jsx(
|
|
1952
1979
|
DataTable,
|
|
1953
1980
|
{
|
|
1981
|
+
emptyState,
|
|
1982
|
+
table,
|
|
1983
|
+
onRowClick: (row) => onRowClick?.(row),
|
|
1984
|
+
onRowHover: (row) => onRowHover?.(row),
|
|
1954
1985
|
totalRowCount: data?.total,
|
|
1955
1986
|
data: data?.data ?? [],
|
|
1956
|
-
loading: isLoading,
|
|
1987
|
+
loading: isLoading || isLoadingExternal,
|
|
1957
1988
|
columns,
|
|
1958
1989
|
filters,
|
|
1959
|
-
onStateChange: handleStateChange
|
|
1990
|
+
onStateChange: handleStateChange,
|
|
1991
|
+
enableRowCheck: enableRowSelection,
|
|
1992
|
+
headerBgColor,
|
|
1993
|
+
columnActions,
|
|
1994
|
+
listMenuActions,
|
|
1995
|
+
onSelectionChange,
|
|
1996
|
+
config,
|
|
1997
|
+
CustomHeader
|
|
1960
1998
|
}
|
|
1961
1999
|
)
|
|
1962
2000
|
] });
|