eai-frontend-components 2.0.79 → 2.0.81
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.ts +12 -11
- package/dist/index.esm.js +27 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10144,6 +10144,24 @@ const Header = ({ splittedPath, modules, pages, isLoading, combobox, }) => {
|
|
|
10144
10144
|
return (jsxRuntime.jsxs("header", { className: 'flex flex-col justify-between items-center w-full', children: [jsxRuntime.jsxs("div", { className: 'flex justify-between items-center py-3 px-5 w-full', children: [jsxRuntime.jsxs("div", { className: 'flex items-center gap-x-2 h-[40px]', children: [jsxRuntime.jsx(SidebarTrigger, { className: 'p-5' }), jsxRuntime.jsx("div", { className: 'p-2', children: jsxRuntime.jsx(Breadcrumb, { children: jsxRuntime.jsx(BreadcrumbList, { children: renderBreadcrumbItens() }) }) })] }), jsxRuntime.jsx("div", { className: 'flex items-center', children: combobox })] }), jsxRuntime.jsx(LoadingBar, { ref: refProgressLoading, color: getColorLoadingBar(), height: 7 })] }));
|
|
10145
10145
|
};
|
|
10146
10146
|
|
|
10147
|
+
const TruncatedText = ({ text }) => {
|
|
10148
|
+
const ref = React$1.useRef(null);
|
|
10149
|
+
const [isTruncated, setIsTruncated] = React$1.useState(false);
|
|
10150
|
+
React$1.useLayoutEffect(() => {
|
|
10151
|
+
const el = ref.current;
|
|
10152
|
+
if (!el)
|
|
10153
|
+
return;
|
|
10154
|
+
const check = () => setIsTruncated(el.scrollWidth > el.clientWidth);
|
|
10155
|
+
check();
|
|
10156
|
+
const observer = new ResizeObserver(check);
|
|
10157
|
+
observer.observe(el);
|
|
10158
|
+
return () => observer.disconnect();
|
|
10159
|
+
}, [text]);
|
|
10160
|
+
const inner = (jsxRuntime.jsx("div", { ref: ref, className: 'text-zinc-500 truncate', children: text }));
|
|
10161
|
+
if (!isTruncated)
|
|
10162
|
+
return inner;
|
|
10163
|
+
return (jsxRuntime.jsx(TooltipProvider, { children: jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: inner }), jsxRuntime.jsx(TooltipContent, { children: text })] }) }));
|
|
10164
|
+
};
|
|
10147
10165
|
const LabelWithTitle = ({ title, value, value2, required, showCopyIcon = false, className, isLoading, hoverAction, }) => {
|
|
10148
10166
|
const handleCopy = () => {
|
|
10149
10167
|
if (showCopyIcon && value) {
|
|
@@ -10154,7 +10172,7 @@ const LabelWithTitle = ({ title, value, value2, required, showCopyIcon = false,
|
|
|
10154
10172
|
});
|
|
10155
10173
|
}
|
|
10156
10174
|
};
|
|
10157
|
-
return (jsxRuntime.jsx("div", { className: cn('flex group', className), children: jsxRuntime.jsx("div", { className: cn('flex flex-col text-sm w-full', showCopyIcon || hoverAction ? 'p-1 rounded-md transition-colors group-hover:bg-sidebar-accent' : 'p-1'), children: jsxRuntime.jsxs("div", { className: 'relative', children: [jsxRuntime.jsxs("div", { className: 'flex items-center text-sm font-medium gap-0.5', children: [jsxRuntime.jsx("span", { className: 'text-default truncate', children: title }), required && jsxRuntime.jsx("div", { className: 'text-red-500 truncate', children: "*" })] }), jsxRuntime.jsx("div", { className: 'grid flex-1 items-center pt-1', children: isLoading ? jsxRuntime.jsx(Skeleton, { className: 'h-5 w-full rounded-lg' }) : jsxRuntime.jsx(
|
|
10175
|
+
return (jsxRuntime.jsx("div", { className: cn('flex group', className), children: jsxRuntime.jsx("div", { className: cn('flex flex-col text-sm w-full', showCopyIcon || hoverAction ? 'p-1 rounded-md transition-colors group-hover:bg-sidebar-accent' : 'p-1'), children: jsxRuntime.jsxs("div", { className: 'relative', children: [jsxRuntime.jsxs("div", { className: 'flex items-center text-sm font-medium gap-0.5', children: [jsxRuntime.jsx("span", { className: 'text-default truncate', children: title }), required && jsxRuntime.jsx("div", { className: 'text-red-500 truncate', children: "*" })] }), jsxRuntime.jsx("div", { className: 'grid flex-1 items-center pt-1', children: isLoading ? jsxRuntime.jsx(Skeleton, { className: 'h-5 w-full rounded-lg' }) : jsxRuntime.jsx(TruncatedText, { text: value }) }), value2 && (jsxRuntime.jsx("div", { className: 'grid flex-1 items-center pt-1', children: isLoading ? jsxRuntime.jsx(Skeleton, { className: 'h-5 w-full rounded-lg' }) : jsxRuntime.jsx(TruncatedText, { text: value2 }) })), showCopyIcon && (jsxRuntime.jsx("div", { className: cn('absolute top-1/2 right-0 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100'), children: jsxRuntime.jsx(TooltipProvider, { children: jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(Button, { variant: 'ghost', type: 'button', className: cn('p-1 h-10 w-8 bg-sidebar-accent'), onClick: handleCopy, children: jsxRuntime.jsx(lucideReact.Copy, { size: 16 }) }) }), jsxRuntime.jsx(TooltipContent, { children: "Copiar" })] }) }) })), hoverAction && (jsxRuntime.jsx("div", { className: cn('absolute top-1/2 right-0 -translate-y-1/2 opacity-0 transition-opacity group-hover:opacity-100'), children: jsxRuntime.jsx(TooltipProvider, { children: jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsx(Button, { variant: 'ghost', type: 'button', className: cn('p-1 h-10 w-8 bg-sidebar-accent'), onClick: hoverAction.onClick, children: hoverAction.icon }) }), jsxRuntime.jsx(TooltipContent, { children: hoverAction.tooltip })] }) }) }))] }) }) }));
|
|
10158
10176
|
};
|
|
10159
10177
|
|
|
10160
10178
|
const NotFound = () => {
|
|
@@ -10527,7 +10545,7 @@ function DataTableRows({ table, isLoading, columns, actionsRow, textNoRecords, e
|
|
|
10527
10545
|
return isLoading ? renderLoadingRows() : rows.length ? renderRows() : renderEmptyRows();
|
|
10528
10546
|
}
|
|
10529
10547
|
|
|
10530
|
-
function DataTable({ columns, data, className, title, rowsPage, actions, actionsRow, customFilters, setSearch, pageChanged, pageSizeChanged, totalRows, filtersActions, exportData, textNoRecords, heightRemainingScroll, hideFilterField, multiRowSelection, hidePagination, disablePagination, isLoading, fixedHeight, }) {
|
|
10548
|
+
function DataTable({ columns, data, className, title, rowsPage, actions, actionsRow, customFilters, setSearch, pageChanged, pageSizeChanged, totalRows, filtersActions, exportData, textNoRecords, heightRemainingScroll, hideFilterField, defaultSearch, multiRowSelection, hidePagination, disablePagination, isLoading, fixedHeight, }) {
|
|
10531
10549
|
const [sorting, setSorting] = React$1.useState([]);
|
|
10532
10550
|
const [pagination, setPagination] = React$1.useState({
|
|
10533
10551
|
pageIndex: 0,
|
|
@@ -10569,6 +10587,11 @@ function DataTable({ columns, data, className, title, rowsPage, actions, actions
|
|
|
10569
10587
|
setPagination({ ...pagination, pageIndex: 0 });
|
|
10570
10588
|
}
|
|
10571
10589
|
}, [data]);
|
|
10590
|
+
React$1.useEffect(() => {
|
|
10591
|
+
if (defaultSearch) {
|
|
10592
|
+
setSearch?.(defaultSearch);
|
|
10593
|
+
}
|
|
10594
|
+
}, []);
|
|
10572
10595
|
React$1.useEffect(() => {
|
|
10573
10596
|
handleResize();
|
|
10574
10597
|
window.addEventListener('resize', handleResize);
|
|
@@ -10611,7 +10634,7 @@ function DataTable({ columns, data, className, title, rowsPage, actions, actions
|
|
|
10611
10634
|
setPagination({ ...pagination, pageIndex: index });
|
|
10612
10635
|
}
|
|
10613
10636
|
};
|
|
10614
|
-
return (jsxRuntime.jsxs("div", { className: 'flex flex-col flex-1', children: [(!hideFilterField || filtersActions || customFilters || actions) && (jsxRuntime.jsxs("div", { className: 'flex items-end justify-between mb-4 space-x-6', children: [jsxRuntime.jsxs("div", { className: 'flex items-center gap-x-4', children: [(!hideFilterField || customFilters) && (jsxRuntime.jsxs("div", { className: 'flex gap-x-4', children: [!hideFilterField && (jsxRuntime.jsxs("div", { className: 'flex bg-background items-center border border-slate-300 rounded-sm w-[350px] overflow-hidden focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 group', children: [jsxRuntime.jsx("div", { className: 'pl-3.5 transform transition-transform duration-300 group-hover:-translate-x-1', children: jsxRuntime.jsx(lucideReact.Search, { size: 18, className: 'w-5 h-5 stroke-zinc-500 dark:stroke-default' }) }), jsxRuntime.jsx("input", { placeholder: 'Buscar', onChange: (event) => {
|
|
10637
|
+
return (jsxRuntime.jsxs("div", { className: 'flex flex-col flex-1', children: [(!hideFilterField || filtersActions || customFilters || actions) && (jsxRuntime.jsxs("div", { className: 'flex items-end justify-between mb-4 space-x-6', children: [jsxRuntime.jsxs("div", { className: 'flex items-center gap-x-4', children: [(!hideFilterField || customFilters) && (jsxRuntime.jsxs("div", { className: 'flex gap-x-4', children: [!hideFilterField && (jsxRuntime.jsxs("div", { className: 'flex bg-background items-center border border-slate-300 rounded-sm w-[350px] overflow-hidden focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 group', children: [jsxRuntime.jsx("div", { className: 'pl-3.5 transform transition-transform duration-300 group-hover:-translate-x-1', children: jsxRuntime.jsx(lucideReact.Search, { size: 18, className: 'w-5 h-5 stroke-zinc-500 dark:stroke-default' }) }), jsxRuntime.jsx("input", { placeholder: 'Buscar', defaultValue: defaultSearch, onChange: (event) => {
|
|
10615
10638
|
handleSearchChange(event);
|
|
10616
10639
|
}, className: 'w-full bg-background text-default border-none focus:ring-0 focus:outline-none px-3 py-2 transform transition-transform duration-300 group-hover:-translate-x-1 ' })] })), customFilters] })), filtersActions && (jsxRuntime.jsxs(Sheet, { open: filtersActions.filterOpen, onOpenChange: filtersActions.setFilterOpen, children: [jsxRuntime.jsx(SheetTrigger, { asChild: true, children: jsxRuntime.jsxs(Button, { variant: 'secondary', type: 'button', children: [jsxRuntime.jsx(lucideReact.Filter, { size: 20, className: 'h-4 w-4' }), " Filtros", filtersActions.countFilters > 0 && (jsxRuntime.jsx("div", { className: 'bg-background-primary text-white rounded-full h-5 w-5 flex items-center justify-center text-sm placeholder:text-muted-foreground', children: filtersActions.countFilters }))] }) }), jsxRuntime.jsxs(SheetContent, { children: [jsxRuntime.jsxs(SheetHeader, { children: [jsxRuntime.jsx(SheetTitle, { children: "Filtros" }), jsxRuntime.jsx(SheetDescription, {})] }), jsxRuntime.jsx("div", { className: 'flex flex-col py-6', children: filtersActions.fields })] })] }))] }), jsxRuntime.jsx("div", { className: 'flex space-x-4 content-end', children: actions?.map((action, index) => (jsxRuntime.jsx("div", { children: jsxRuntime.jsxs(Button, { type: 'button', onClick: () => action.onClick?.(selectedIds, selectedRows), className: cn(action.className, action.hideUnselectedRows && selectedRows.length === 0 ? 'hidden' : ''), variant: action.variant || 'default', disabled: action.disabled, children: [jsxRuntime.jsx("div", { className: '[&_svg]:size-5', children: action.icon }), action.label] }) }, `action-table-${index}`))) })] })), jsxRuntime.jsxs("div", { className: `flex-1 flex flex-col rounded-md border ${className}`, children: [jsxRuntime.jsx("div", { className: 'flex items-center justify-between', children: title && jsxRuntime.jsx("div", { className: 'text-h4 p-4', children: title }) }), jsxRuntime.jsx("div", { id: 'data-table', ref: tableContainerRef, style: fixedHeight ? { height: fixedHeight } : { height: tableHeight }, className: 'flex flex-col justify-between rounded-md overflow-x-auto overflow-y-auto', children: jsxRuntime.jsxs(Table, { children: [jsxRuntime.jsx(DataTableHeader, { table: table, canActionsRow: actionsRow && actionsRow.length > 0, enableMultiRowSelection: enableMultiRowSelection }), jsxRuntime.jsx(TableBody, { className: 'bg-background', children: jsxRuntime.jsx(DataTableRows, { table: table, columns: columns, isLoading: isLoading, actionsRow: actionsRow, textNoRecords: textNoRecords, enableMultiRowSelection: enableMultiRowSelection }) })] }) })] }), jsxRuntime.jsx(DataTableFooter, { hidePagination: hidePagination, disablePagination: disablePagination, isLoading: isLoading, totalRows: totalRows, totalPages: totalPages, currentPage: currentPage, pagination: pagination, handlePageSize: handlePageSize, handlePage: handlePage, previousPage: { action: () => table.previousPage(), disabled: !table.getCanPreviousPage() }, nextPage: { action: () => table.nextPage(), disabled: !table.getCanNextPage() }, exportData: exportData })] }));
|
|
10617
10640
|
}
|