lecom-ui 5.2.14 → 5.2.16
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.
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
const SairModoTeste = ({
|
|
4
|
+
color = "currentColor",
|
|
5
|
+
strokeWidth = 1.5,
|
|
6
|
+
width = 20,
|
|
7
|
+
height = 20,
|
|
8
|
+
...props
|
|
9
|
+
}) => /* @__PURE__ */ React.createElement(
|
|
10
|
+
"svg",
|
|
11
|
+
{
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
width,
|
|
14
|
+
height,
|
|
15
|
+
fill: "none",
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
...props
|
|
18
|
+
},
|
|
19
|
+
/* @__PURE__ */ React.createElement(
|
|
20
|
+
"path",
|
|
21
|
+
{
|
|
22
|
+
stroke: color,
|
|
23
|
+
strokeLinecap: "round",
|
|
24
|
+
strokeLinejoin: "round",
|
|
25
|
+
strokeWidth,
|
|
26
|
+
d: "M4.75 2h7.875L17 6.5v.9h-3.5c-.464 0-.91-.19-1.237-.527A1.83 1.83 0 0 1 11.75 5.6V2M3 7.5v10.7c0 .477.184.935.513 1.273.328.337.773.527 1.237.527h6.75M8 11.9H6.5m4.5 3.6H6.5M19 10v6m-5-6v1m-1-1h7m-6 8v3.375c0 .91 1.1 1.625 2.5 1.625.567 0 1.085-.117 1.5-.317.259-.125.478-.281.644-.462M1 2l11 10.5L23 23"
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export { SairModoTeste };
|
|
@@ -21,6 +21,13 @@ function DataTable({
|
|
|
21
21
|
onIsSelected
|
|
22
22
|
}) {
|
|
23
23
|
const [sorting, setSorting] = React.useState([]);
|
|
24
|
+
const dataTableContainerStyle = React.useMemo(
|
|
25
|
+
() => ({
|
|
26
|
+
width: vwDiff ? `calc(100vw - ${vwDiff}px)` : "100%",
|
|
27
|
+
height: vhDiff ? `calc(100vh - ${vhDiff}px)` : "100%"
|
|
28
|
+
}),
|
|
29
|
+
[vwDiff, vhDiff]
|
|
30
|
+
);
|
|
24
31
|
const table = useReactTable({
|
|
25
32
|
data,
|
|
26
33
|
columns: buildColumns({ columns, size }),
|
|
@@ -31,19 +38,27 @@ function DataTable({
|
|
|
31
38
|
sorting
|
|
32
39
|
}
|
|
33
40
|
});
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
height: vhDiff ? `calc(100vh - ${vhDiff}px)` : "100%"
|
|
37
|
-
});
|
|
41
|
+
const scrollAreaRef = React.useRef(null);
|
|
42
|
+
const fixedElementsCache = React.useRef({ elements: [], separators: [], lastUpdate: 0 });
|
|
38
43
|
const hasPagination = () => {
|
|
39
44
|
if (!pagination) {
|
|
40
45
|
return null;
|
|
41
46
|
}
|
|
42
47
|
return /* @__PURE__ */ React.createElement(Pagination, { ...pagination });
|
|
43
48
|
};
|
|
44
|
-
React.
|
|
45
|
-
if (
|
|
46
|
-
|
|
49
|
+
const setupFixedElements = React.useCallback(() => {
|
|
50
|
+
if (isLoading) return;
|
|
51
|
+
const tableElement = document.querySelector(
|
|
52
|
+
"table#data-table"
|
|
53
|
+
);
|
|
54
|
+
if (!tableElement) return;
|
|
55
|
+
const now = Date.now();
|
|
56
|
+
const cacheValidTime = 1e3;
|
|
57
|
+
if (now - fixedElementsCache.current.lastUpdate < cacheValidTime) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const listRows = tableElement.querySelectorAll("tr");
|
|
61
|
+
requestAnimationFrame(() => {
|
|
47
62
|
listRows.forEach((listRow, listRowIndex) => {
|
|
48
63
|
const rowsElem = listRow.querySelectorAll("[data-fixed]");
|
|
49
64
|
rowsElem.forEach((rowElem, rowElemIndex) => {
|
|
@@ -56,44 +71,54 @@ function DataTable({
|
|
|
56
71
|
const currentElemIsTh = currentElem.tagName === "TH";
|
|
57
72
|
const boxShadowWidth = currentElemIsTh ? "-1.5px" : "-0.5px";
|
|
58
73
|
const boxShadow = `#c9c9c9 0px ${lastRow ? "0px" : boxShadowWidth} 0px inset`;
|
|
59
|
-
currentElem.style
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
Object.assign(currentElem.style, {
|
|
75
|
+
position: "sticky",
|
|
76
|
+
left: `${beforeElemWidth + beforeElemLeft}px`,
|
|
77
|
+
boxShadow
|
|
78
|
+
});
|
|
62
79
|
if (lastColumnFixed) {
|
|
63
80
|
currentElem.setAttribute("data-separator-fixed", "true");
|
|
64
81
|
}
|
|
65
82
|
});
|
|
66
83
|
});
|
|
67
|
-
|
|
84
|
+
fixedElementsCache.current = {
|
|
85
|
+
elements: Array.from(tableElement.querySelectorAll("[data-fixed]")),
|
|
86
|
+
separators: Array.from(
|
|
87
|
+
tableElement.querySelectorAll("[data-separator-fixed]")
|
|
88
|
+
),
|
|
89
|
+
lastUpdate: now
|
|
90
|
+
};
|
|
91
|
+
});
|
|
68
92
|
}, [isLoading]);
|
|
69
|
-
|
|
93
|
+
React.useEffect(() => {
|
|
94
|
+
setupFixedElements();
|
|
95
|
+
}, [setupFixedElements, data.length]);
|
|
96
|
+
const onScroll = React.useCallback((e) => {
|
|
70
97
|
const target = e.target;
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
98
|
+
const { separators } = fixedElementsCache.current;
|
|
99
|
+
if (separators.length === 0) return;
|
|
100
|
+
requestAnimationFrame(() => {
|
|
101
|
+
const countSeparator = separators.length - 1;
|
|
102
|
+
const isScrolledRight = target.scrollLeft > 0;
|
|
103
|
+
separators.forEach((separator, i) => {
|
|
104
|
+
const isLastSeparator = countSeparator === i;
|
|
105
|
+
const isFirstSeparator = i === 0;
|
|
106
|
+
if (isScrolledRight) {
|
|
107
|
+
separator.style.boxShadow = isLastSeparator ? "#c9c9c9 -0.5px 0px 0px inset" : `#c9c9c9 -0.5px ${isFirstSeparator ? "-1.5px" : "-0.5px"} 0px inset`;
|
|
78
108
|
} else {
|
|
79
|
-
separator.style.boxShadow =
|
|
109
|
+
separator.style.boxShadow = isFirstSeparator ? "#c9c9c9 0px -1.5px 0px inset" : `#c9c9c9 0px ${isLastSeparator ? "0px" : "-0.5px"} 0px inset`;
|
|
80
110
|
}
|
|
81
111
|
});
|
|
82
|
-
}
|
|
83
|
-
elemSeparator.forEach((elem, i) => {
|
|
84
|
-
const separator = elem;
|
|
85
|
-
if (i === 0) {
|
|
86
|
-
separator.style.boxShadow = "#c9c9c9 0px -1.5px 0px inset";
|
|
87
|
-
} else {
|
|
88
|
-
separator.style.boxShadow = `#c9c9c9 0px ${countSeparator === i ? "0px" : "-0.5px"} 0px inset`;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
React.useEffect(() => {
|
|
94
|
-
document.querySelector("[data-radix-scroll-area-viewport]")?.addEventListener("scroll", onScroll);
|
|
95
|
-
return () => document.querySelector("[data-radix-scroll-area-viewport]")?.removeEventListener("scroll", onScroll);
|
|
112
|
+
});
|
|
96
113
|
}, []);
|
|
114
|
+
React.useEffect(() => {
|
|
115
|
+
const scrollElement = scrollAreaRef.current?.querySelector(
|
|
116
|
+
"[data-radix-scroll-area-viewport]"
|
|
117
|
+
);
|
|
118
|
+
if (!scrollElement) return;
|
|
119
|
+
scrollElement.addEventListener("scroll", onScroll, { passive: true });
|
|
120
|
+
return () => scrollElement.removeEventListener("scroll", onScroll);
|
|
121
|
+
}, [onScroll]);
|
|
97
122
|
const renderTable = () => /* @__PURE__ */ React.createElement(
|
|
98
123
|
Table,
|
|
99
124
|
{
|
|
@@ -113,13 +138,13 @@ function DataTable({
|
|
|
113
138
|
"bg-white rounded-[8px] p-2 transition-all duration-500",
|
|
114
139
|
className
|
|
115
140
|
),
|
|
116
|
-
style: noScroll ? void 0 : { width:
|
|
141
|
+
style: noScroll ? void 0 : { width: dataTableContainerStyle.width }
|
|
117
142
|
},
|
|
118
|
-
noScroll ? renderTable() : /* @__PURE__ */ React.createElement(ScrollArea, { type: "always", className: "p-2" }, /* @__PURE__ */ React.createElement(
|
|
143
|
+
noScroll ? renderTable() : /* @__PURE__ */ React.createElement(ScrollArea, { ref: scrollAreaRef, type: "always", className: "p-2" }, /* @__PURE__ */ React.createElement(
|
|
119
144
|
"div",
|
|
120
145
|
{
|
|
121
146
|
className: "transition-all duration-500",
|
|
122
|
-
style: { maxHeight:
|
|
147
|
+
style: { maxHeight: dataTableContainerStyle.height }
|
|
123
148
|
},
|
|
124
149
|
renderTable()
|
|
125
150
|
), /* @__PURE__ */ React.createElement(ScrollBar, { orientation: "horizontal" }))
|
package/dist/index.d.ts
CHANGED
|
@@ -348,6 +348,8 @@ interface LogoLecomBrandProps extends React$1.SVGAttributes<SVGSVGElement> {
|
|
|
348
348
|
}
|
|
349
349
|
declare const LogoLecomBrand: React$1.ForwardRefExoticComponent<LogoLecomBrandProps & React$1.RefAttributes<SVGSVGElement>>;
|
|
350
350
|
|
|
351
|
+
declare const SairModoTeste: ({ color, strokeWidth, width, height, ...props }: React$1.SVGProps<SVGSVGElement>) => React$1.JSX.Element;
|
|
352
|
+
|
|
351
353
|
type UsePaginationProps = {
|
|
352
354
|
count?: number;
|
|
353
355
|
defaultPage?: number;
|
|
@@ -522,6 +524,18 @@ interface TableProps<TData, TValue> {
|
|
|
522
524
|
onIsSelected?: (row: Row$1<TData>) => boolean;
|
|
523
525
|
}
|
|
524
526
|
|
|
527
|
+
/**
|
|
528
|
+
* DataTable Component - Versão Otimizada para Performance
|
|
529
|
+
*
|
|
530
|
+
* Otimizações implementadas:
|
|
531
|
+
* 1. Memoização de estilos para evitar recálculos em resize
|
|
532
|
+
* 2. Cache de elementos DOM para reduzir queries repetitivas
|
|
533
|
+
* 3. requestAnimationFrame para operações DOM não bloqueantes
|
|
534
|
+
* 4. Event listeners com passive: true para melhor scroll performance
|
|
535
|
+
* 5. Batch de operações DOM para reduzir reflows/repaints
|
|
536
|
+
* 6. Sistema de cache com timestamp para evitar recálculos desnecessários
|
|
537
|
+
*/
|
|
538
|
+
|
|
525
539
|
declare function DataTable<TData, TValue>({ isLoading, columns, data, noResults, pagination, vwDiff, vhDiff, className, noScroll, size, skeleton, onIsSelected, }: DataTableProps<TData, TValue>): React$1.JSX.Element;
|
|
526
540
|
declare namespace DataTable {
|
|
527
541
|
var displayName: string;
|
|
@@ -1050,5 +1064,5 @@ declare const DrawerFooter: {
|
|
|
1050
1064
|
declare const DrawerTitle: React$1.ForwardRefExoticComponent<React$1.ComponentPropsWithoutRef<typeof Drawer$1.Title> & React$1.RefAttributes<React$1.ElementRef<typeof Drawer$1.Title>>>;
|
|
1051
1065
|
declare const DrawerDescription: React$1.ForwardRefExoticComponent<React$1.ComponentPropsWithoutRef<typeof Drawer$1.Description> & React$1.RefAttributes<React$1.ElementRef<typeof Drawer$1.Description>>>;
|
|
1052
1066
|
|
|
1053
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, CadastroFacil, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogScroll, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ErrorEmptyDisplay, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Layout, LogoLecom, LogoLecomBrand, ModoTeste, MultiSelect, Notification, Pagination, PaginationContent, PaginationEllipsis, PaginationFirst, PaginationIndex, PaginationItem, PaginationLast, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, Rpa, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Skeleton, Spin, Switch, TOAST_REMOVE_DELAY, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Textarea, ToggleGroup, ToggleGroupItem, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, Translations, TypeMessageNotification, Typography, Upload, accordionVariants, buttonVariants, colors, fonts, initializeI18n, inputVariants, notificationVariants, reducer, tagVariants, textareaVariants, toast, typographyVariants, useFormField, useIsMobile, useNotificationToast, usePagination, useSidebar };
|
|
1067
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, CadastroFacil, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogScroll, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ErrorEmptyDisplay, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Layout, LogoLecom, LogoLecomBrand, ModoTeste, MultiSelect, Notification, Pagination, PaginationContent, PaginationEllipsis, PaginationFirst, PaginationIndex, PaginationItem, PaginationLast, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, Rpa, SairModoTeste, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Skeleton, Spin, Switch, TOAST_REMOVE_DELAY, Tabs, TabsContent, TabsList, TabsTrigger, Tag, Textarea, ToggleGroup, ToggleGroupItem, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, Translations, TypeMessageNotification, Typography, Upload, accordionVariants, buttonVariants, colors, fonts, initializeI18n, inputVariants, notificationVariants, reducer, tagVariants, textareaVariants, toast, typographyVariants, useFormField, useIsMobile, useNotificationToast, usePagination, useSidebar };
|
|
1054
1068
|
export type { BgColor, BuildCellSelect, BuildColumns, BuildHeaderSelect, ButtonProps, CadastroFacilProps, CalloutNotificationProps, ChartConfig, CheckboxProps, CheckedCell, CheckedCellChange, CheckedHeader, CheckedHeaderChange, Color, ColorToken, Column, ColumnRender, ColumnSort, ColumnSortClient, ColumnTitle, CustomStyles$1 as CustomStyles, DataTableProps, DialogContentProps, ErrorEmptyDisplayProps, File, FillColor, Fonts, Header, HeaderProps, InlineNotificationProps, InputProps, LayoutProps, LogoLecomBrandProps, LogoLecomProps, Meta, ModoTesteProps, NotificationProps, PaginationProps, Row, RpaProps, SideBarProps, SpinProps, TableProps, TagProps, TextColor, TextareaProps, ToastNotificationProps, ToasterToast, TooltipContentProps, TypographyProps, UploadProps, UsePaginationItem };
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export { LogoLecom } from './components/CustomIcon/Icons/LogoLecom.js';
|
|
|
9
9
|
export { ModoTeste } from './components/CustomIcon/Icons/ModoTeste.js';
|
|
10
10
|
export { Rpa } from './components/CustomIcon/Icons/Rpa.js';
|
|
11
11
|
export { LogoLecomBrand } from './components/CustomIcon/Icons/LogoLecomBrand.js';
|
|
12
|
+
export { SairModoTeste } from './components/CustomIcon/Icons/SairModoTeste.js';
|
|
12
13
|
export { DataTable } from './components/DataTable/DataTable.js';
|
|
13
14
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogScroll, DialogTitle, DialogTrigger } from './components/Dialog/Dialog.js';
|
|
14
15
|
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from './components/DropdownMenu/DropdownMenu.js';
|