lecom-ui 4.8.2 → 4.8.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.
|
@@ -17,6 +17,7 @@ function DataTable({
|
|
|
17
17
|
className,
|
|
18
18
|
noScroll,
|
|
19
19
|
size = "middle",
|
|
20
|
+
skeleton,
|
|
20
21
|
onIsSelected
|
|
21
22
|
}) {
|
|
22
23
|
const [sorting, setSorting] = React.useState([]);
|
|
@@ -101,7 +102,8 @@ function DataTable({
|
|
|
101
102
|
noResults,
|
|
102
103
|
onIsSelected,
|
|
103
104
|
isLoading,
|
|
104
|
-
size
|
|
105
|
+
size,
|
|
106
|
+
skeleton
|
|
105
107
|
}
|
|
106
108
|
);
|
|
107
109
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
@@ -49,7 +49,7 @@ function buildColumns({
|
|
|
49
49
|
if (!externalColumn.title) {
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
|
-
const hasSort = !!externalColumn.onSort;
|
|
52
|
+
const hasSort = !!externalColumn.onSort || !!externalColumn.onSortClient;
|
|
53
53
|
const title = typeof externalColumn.title === "function" ? externalColumn.title({ table, column }) : externalColumn.title;
|
|
54
54
|
return /* @__PURE__ */ React.createElement(
|
|
55
55
|
"div",
|
|
@@ -110,6 +110,13 @@ function buildColumns({
|
|
|
110
110
|
width: externalColumn.width,
|
|
111
111
|
fixed: externalColumn.fixed,
|
|
112
112
|
truncate: !!externalColumn.truncate
|
|
113
|
+
},
|
|
114
|
+
sortingFn: (rowA, rowB, columnId) => {
|
|
115
|
+
if (externalColumn.onSortClient) {
|
|
116
|
+
return externalColumn.onSortClient({ rowA, rowB, columnId });
|
|
117
|
+
} else {
|
|
118
|
+
return 0;
|
|
119
|
+
}
|
|
113
120
|
}
|
|
114
121
|
}));
|
|
115
122
|
return mappedColumns;
|
|
@@ -9,6 +9,7 @@ function Table({
|
|
|
9
9
|
columns,
|
|
10
10
|
noResults,
|
|
11
11
|
size = "middle",
|
|
12
|
+
skeleton,
|
|
12
13
|
onIsSelected
|
|
13
14
|
}) {
|
|
14
15
|
const styleColumn = (meta, elem) => {
|
|
@@ -26,8 +27,11 @@ function Table({
|
|
|
26
27
|
};
|
|
27
28
|
};
|
|
28
29
|
const getFixed = (meta) => meta.fixed;
|
|
29
|
-
const arrSkeleton = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
|
|
30
30
|
if (isLoading) {
|
|
31
|
+
if (skeleton) {
|
|
32
|
+
return skeleton;
|
|
33
|
+
}
|
|
34
|
+
const arrSkeleton = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
|
|
31
35
|
return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-4" }, arrSkeleton.map((id) => /* @__PURE__ */ React.createElement(
|
|
32
36
|
Skeleton,
|
|
33
37
|
{
|
|
@@ -46,7 +50,8 @@ function Table({
|
|
|
46
50
|
),
|
|
47
51
|
"data-header": header.id,
|
|
48
52
|
"data-fixed": getFixed(header.column.columnDef.meta),
|
|
49
|
-
style: styleColumn(header.column.columnDef.meta, "th")
|
|
53
|
+
style: styleColumn(header.column.columnDef.meta, "th"),
|
|
54
|
+
onClick: header.column.getToggleSortingHandler()
|
|
50
55
|
},
|
|
51
56
|
header.isPlaceholder ? null : flexRender(
|
|
52
57
|
header.column.columnDef.header,
|
package/dist/index.d.ts
CHANGED
|
@@ -331,6 +331,11 @@ interface ColumnSort<TData, TValue> {
|
|
|
331
331
|
table: Table<TData>;
|
|
332
332
|
column: Column$1<TData, TValue>;
|
|
333
333
|
}
|
|
334
|
+
interface ColumnSortClient<TData> {
|
|
335
|
+
rowA: Row<TData>['row'];
|
|
336
|
+
rowB: Row<TData>['row'];
|
|
337
|
+
columnId: string;
|
|
338
|
+
}
|
|
334
339
|
type ColumnTitle<TData, TValue> = ColumnSort<TData, TValue>;
|
|
335
340
|
interface CheckedHeader<TData, TValue> {
|
|
336
341
|
table: Table<TData>;
|
|
@@ -357,6 +362,7 @@ interface Column<TData, TValue> {
|
|
|
357
362
|
truncate?: boolean;
|
|
358
363
|
render?: (({ value, row }: ColumnRender<TData, TValue>) => React.ReactNode) | React.ReactNode;
|
|
359
364
|
onSort?: ({ table, column }: ColumnSort<TData, TValue>) => void;
|
|
365
|
+
onSortClient?: ({ rowA, rowB, columnId }: ColumnSortClient<TData>) => number;
|
|
360
366
|
checkedHeader?: ({ table, column }: CheckedHeader<TData, TValue>) => boolean;
|
|
361
367
|
checkedCell?: ({ row }: CheckedCell<TData>) => boolean;
|
|
362
368
|
onCheckedHeaderChange?: ({ table, column, value, }: CheckedHeaderChange<TData, TValue>) => void;
|
|
@@ -373,6 +379,7 @@ interface DataTableProps<TData, TValue> {
|
|
|
373
379
|
className?: string;
|
|
374
380
|
noScroll?: boolean;
|
|
375
381
|
size?: 'small' | 'middle';
|
|
382
|
+
skeleton?: React.ReactNode;
|
|
376
383
|
onIsSelected?: (row: Row$1<TData>) => boolean;
|
|
377
384
|
}
|
|
378
385
|
interface Row<TData> {
|
|
@@ -404,10 +411,11 @@ interface TableProps<TData, TValue> {
|
|
|
404
411
|
columns: Column<TData, TValue>[];
|
|
405
412
|
noResults?: React.ReactNode;
|
|
406
413
|
size?: 'small' | 'middle';
|
|
414
|
+
skeleton?: React.ReactNode;
|
|
407
415
|
onIsSelected?: (row: Row$1<TData>) => boolean;
|
|
408
416
|
}
|
|
409
417
|
|
|
410
|
-
declare function DataTable<TData, TValue>({ isLoading, columns, data, noResults, pagination, vwDiff, vhDiff, className, noScroll, size, onIsSelected, }: DataTableProps<TData, TValue>): React$1.JSX.Element;
|
|
418
|
+
declare function DataTable<TData, TValue>({ isLoading, columns, data, noResults, pagination, vwDiff, vhDiff, className, noScroll, size, skeleton, onIsSelected, }: DataTableProps<TData, TValue>): React$1.JSX.Element;
|
|
411
419
|
declare namespace DataTable {
|
|
412
420
|
var displayName: string;
|
|
413
421
|
}
|
|
@@ -822,4 +830,4 @@ declare const fonts: {
|
|
|
822
830
|
};
|
|
823
831
|
|
|
824
832
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Button, CadastroFacil, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogScroll, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ErrorEmptyDisplay, Input, Layout, LogoLecom, LogoLecomBrand, ModoTeste, Notification, Pagination, PaginationContent, PaginationEllipsis, PaginationFirst, PaginationIndex, PaginationItem, PaginationLast, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, Rpa, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Skeleton, Spin, Switch, TOAST_REMOVE_DELAY, Tag, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, Translations, TypeMessageNotification, Typography, Upload, accordionVariants, buttonVariants, colors, fonts, getPositionClass, initializeI18n, inputVariants, notificationVariants, reducer, tagVariants, toast, typographyVariants, useIsMobile, useNotificationToast, usePagination, useSidebar };
|
|
825
|
-
export type { BgColor, BuildCellSelect, BuildColumns, BuildHeaderSelect, ButtonProps, CadastroFacilProps, CalloutNotificationProps, CheckboxProps, CheckedCell, CheckedCellChange, CheckedHeader, CheckedHeaderChange, Color, ColorToken, Column, ColumnRender, ColumnSort, ColumnTitle, CustomStyles$1 as CustomStyles, DataTableProps, ErrorEmptyDisplayProps, File, FillColor, Fonts, Header, HeaderProps, InlineNotificationProps, InputProps, LayoutProps, LogoLecomBrandProps, LogoLecomProps, Meta, ModoTesteProps, NotificationProps, PaginationProps, Row, RpaProps, SideBarProps, SpinProps, TableProps, TagProps, TextColor, ToastNotificationProps, ToasterToast, TooltipContentProps, TypographyProps, UploadProps, UsePaginationItem };
|
|
833
|
+
export type { BgColor, BuildCellSelect, BuildColumns, BuildHeaderSelect, ButtonProps, CadastroFacilProps, CalloutNotificationProps, CheckboxProps, CheckedCell, CheckedCellChange, CheckedHeader, CheckedHeaderChange, Color, ColorToken, Column, ColumnRender, ColumnSort, ColumnSortClient, ColumnTitle, CustomStyles$1 as CustomStyles, DataTableProps, ErrorEmptyDisplayProps, File, FillColor, Fonts, Header, HeaderProps, InlineNotificationProps, InputProps, LayoutProps, LogoLecomBrandProps, LogoLecomProps, Meta, ModoTesteProps, NotificationProps, PaginationProps, Row, RpaProps, SideBarProps, SpinProps, TableProps, TagProps, TextColor, ToastNotificationProps, ToasterToast, TooltipContentProps, TypographyProps, UploadProps, UsePaginationItem };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lecom-ui",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@radix-ui/react-slot": "^1.1.1",
|
|
37
37
|
"@radix-ui/react-switch": "^1.1.2",
|
|
38
38
|
"@radix-ui/react-tooltip": "^1.1.6",
|
|
39
|
-
"@tanstack/react-table": "^8.
|
|
39
|
+
"@tanstack/react-table": "^8.21.2",
|
|
40
40
|
"class-variance-authority": "^0.7.1",
|
|
41
41
|
"clsx": "^2.1.1",
|
|
42
42
|
"hex-color-opacity": "^0.4.2",
|