eai-frontend-components 2.0.51 → 2.0.52
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 +13 -13
- package/dist/index.esm.js +27 -26
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +27 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -105,7 +105,7 @@ declare const BreadcrumbEllipsis: {
|
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
declare const buttonVariants: (props?: ({
|
|
108
|
-
variant?: "
|
|
108
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "link" | "ghost" | null | undefined;
|
|
109
109
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
110
110
|
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
111
111
|
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -204,11 +204,11 @@ declare const CollapsibleContent: React$1.ForwardRefExoticComponent<CollapsibleP
|
|
|
204
204
|
|
|
205
205
|
declare const Command: React$1.ForwardRefExoticComponent<Omit<{
|
|
206
206
|
children?: React$1.ReactNode;
|
|
207
|
-
} & Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
207
|
+
} & Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React$1.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
208
208
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
209
209
|
} & {
|
|
210
210
|
asChild?: boolean;
|
|
211
|
-
},
|
|
211
|
+
}, keyof React$1.HTMLAttributes<HTMLDivElement> | "key" | "asChild"> & {
|
|
212
212
|
label?: string;
|
|
213
213
|
shouldFilter?: boolean;
|
|
214
214
|
filter?: (value: string, search: string, keywords?: string[]) => number;
|
|
@@ -230,45 +230,45 @@ declare const CommandInput: React$1.ForwardRefExoticComponent<Omit<Omit<Pick<Pic
|
|
|
230
230
|
} & React$1.RefAttributes<HTMLInputElement>, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
|
|
231
231
|
declare const CommandList: React$1.ForwardRefExoticComponent<Omit<{
|
|
232
232
|
children?: React$1.ReactNode;
|
|
233
|
-
} & Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
233
|
+
} & Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React$1.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
234
234
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
235
235
|
} & {
|
|
236
236
|
asChild?: boolean;
|
|
237
|
-
},
|
|
237
|
+
}, keyof React$1.HTMLAttributes<HTMLDivElement> | "key" | "asChild"> & {
|
|
238
238
|
label?: string;
|
|
239
239
|
} & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
240
240
|
declare const CommandEmpty: React$1.ForwardRefExoticComponent<Omit<{
|
|
241
241
|
children?: React$1.ReactNode;
|
|
242
|
-
} & Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
242
|
+
} & Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React$1.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
243
243
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
244
244
|
} & {
|
|
245
245
|
asChild?: boolean;
|
|
246
|
-
},
|
|
246
|
+
}, keyof React$1.HTMLAttributes<HTMLDivElement> | "key" | "asChild"> & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
247
247
|
declare const CommandGroup: React$1.ForwardRefExoticComponent<Omit<{
|
|
248
248
|
children?: React$1.ReactNode;
|
|
249
|
-
} & Omit<Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
249
|
+
} & Omit<Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React$1.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
250
250
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
251
251
|
} & {
|
|
252
252
|
asChild?: boolean;
|
|
253
|
-
},
|
|
253
|
+
}, keyof React$1.HTMLAttributes<HTMLDivElement> | "key" | "asChild">, "value" | "heading"> & {
|
|
254
254
|
heading?: React$1.ReactNode;
|
|
255
255
|
value?: string;
|
|
256
256
|
forceMount?: boolean;
|
|
257
257
|
} & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
258
|
-
declare const CommandSeparator: React$1.ForwardRefExoticComponent<Omit<Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
258
|
+
declare const CommandSeparator: React$1.ForwardRefExoticComponent<Omit<Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React$1.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
259
259
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
260
260
|
} & {
|
|
261
261
|
asChild?: boolean;
|
|
262
|
-
},
|
|
262
|
+
}, keyof React$1.HTMLAttributes<HTMLDivElement> | "key" | "asChild"> & {
|
|
263
263
|
alwaysRender?: boolean;
|
|
264
264
|
} & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
265
265
|
declare const CommandItem: React$1.ForwardRefExoticComponent<Omit<{
|
|
266
266
|
children?: React$1.ReactNode;
|
|
267
|
-
} & Omit<Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
267
|
+
} & Omit<Pick<Pick<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React$1.HTMLAttributes<HTMLDivElement> | "key"> & {
|
|
268
268
|
ref?: React$1.Ref<HTMLDivElement>;
|
|
269
269
|
} & {
|
|
270
270
|
asChild?: boolean;
|
|
271
|
-
},
|
|
271
|
+
}, keyof React$1.HTMLAttributes<HTMLDivElement> | "key" | "asChild">, "onSelect" | "disabled" | "value"> & {
|
|
272
272
|
disabled?: boolean;
|
|
273
273
|
onSelect?: (value: string) => void;
|
|
274
274
|
value?: string;
|
package/dist/index.esm.js
CHANGED
|
@@ -10326,6 +10326,32 @@ const NavUser = ({ userName, userEmail, userInitials, callbackLogout }) => {
|
|
|
10326
10326
|
} }) }) }), jsxs(DropdownMenuContent, { className: 'w-[250px] rounded-lg', side: isMobile ? 'bottom' : 'right', align: 'end', sideOffset: 4, children: [jsx(DropdownMenuLabel, { className: 'p-0 font-normal', children: jsxs("div", { className: 'flex items-center gap-2 px-1 py-1.5 text-left text-sm', children: [jsxs(Avatar, { className: 'h-8 w-8 rounded-lg', children: [jsx(AvatarImage, { src: userInitials, alt: userName }), jsx(AvatarFallback, { className: 'rounded-lg bg-background-primary text-white', children: userInitials })] }), jsxs("div", { className: 'grid flex-1 text-left text-sm leading-tight', children: [jsx("span", { className: 'truncate font-semibold', children: userName }), jsx("span", { className: 'truncate text-xs', children: userEmail })] })] }) }), jsx(DropdownMenuItem, { className: 'p-0 font-normal cursor-pointer', onClick: () => handleLogout(), children: jsxs("div", { className: 'flex items-center gap-2 px-1 py-1.5 text-left text-sm', children: [jsx("div", { className: 'flex w-8 h-8 p-2 items-center rounded-md', children: jsx(LogOut, { size: 16 }) }), "Log out"] }) })] })] }) }) }));
|
|
10327
10327
|
};
|
|
10328
10328
|
|
|
10329
|
+
const downloadWithServiceWorker = async (urlDownload, fileName) => {
|
|
10330
|
+
try {
|
|
10331
|
+
const response = await fetch(urlDownload);
|
|
10332
|
+
if (!response.ok) {
|
|
10333
|
+
throw new Error('Erro ao fazer o download');
|
|
10334
|
+
}
|
|
10335
|
+
const blob = await response.blob();
|
|
10336
|
+
const url = window.URL.createObjectURL(blob);
|
|
10337
|
+
const a = document.createElement('a');
|
|
10338
|
+
a.href = url;
|
|
10339
|
+
a.download = fileName;
|
|
10340
|
+
document.body.appendChild(a);
|
|
10341
|
+
a.click();
|
|
10342
|
+
document.body.removeChild(a);
|
|
10343
|
+
window.URL.revokeObjectURL(url);
|
|
10344
|
+
}
|
|
10345
|
+
catch (error) {
|
|
10346
|
+
toast({
|
|
10347
|
+
title: 'Erro ao fazer o download',
|
|
10348
|
+
description: error instanceof Error ? error.message : 'Tente novamente mais tarde.',
|
|
10349
|
+
variant: 'destructive',
|
|
10350
|
+
});
|
|
10351
|
+
console.error(error);
|
|
10352
|
+
}
|
|
10353
|
+
};
|
|
10354
|
+
|
|
10329
10355
|
function DataTableExport({ exportData, totalRows }) {
|
|
10330
10356
|
const ExportDataSchema = z.object({
|
|
10331
10357
|
model: z.string(),
|
|
@@ -10348,6 +10374,7 @@ function DataTableExport({ exportData, totalRows }) {
|
|
|
10348
10374
|
}
|
|
10349
10375
|
const params = new URLSearchParams(exportData.params).toString();
|
|
10350
10376
|
window.open(`${exportData.url}?${params}`, '_blank');
|
|
10377
|
+
downloadWithServiceWorker(`${exportData.url}?${params}`, 'data.xlsx');
|
|
10351
10378
|
};
|
|
10352
10379
|
const renderExport = () => {
|
|
10353
10380
|
if (!exportData)
|
|
@@ -10531,32 +10558,6 @@ function DataTable({ columns, data, className, title, rowsPage, actions, actions
|
|
|
10531
10558
|
}, 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 ' })] })), filtersActions && (jsxs(Sheet, { open: filtersActions.filterOpen, onOpenChange: filtersActions.setFilterOpen, children: [jsx(SheetTrigger, { asChild: true, children: jsxs(Button, { variant: 'secondary', type: 'button', children: [jsx(Filter, { size: 20, className: 'h-4 w-4' }), " Filtros", filtersActions.countFilters > 0 && (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 }))] }) }), jsxs(SheetContent, { children: [jsxs(SheetHeader, { children: [jsx(SheetTitle, { children: "Filtros" }), jsx(SheetDescription, {})] }), jsx("div", { className: 'flex flex-col py-6', children: filtersActions.fields })] })] }))] }), customFilters, jsx("div", { className: 'flex space-x-4 content-end', children: actions?.map((action, index) => (jsx("div", { children: 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: [jsx("div", { className: '[&_svg]:size-5', children: action.icon }), action.label] }) }, `action-table-${index}`))) })] })), jsxs("div", { className: `flex-1 flex flex-col rounded-md border ${className}`, children: [jsx("div", { className: 'flex items-center justify-between', children: title && jsx("div", { className: 'text-h4 p-4', children: title }) }), 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: jsxs(Table, { children: [jsx(DataTableHeader, { table: table, canActionsRow: actionsRow && actionsRow.length > 0, enableMultiRowSelection: enableMultiRowSelection }), jsx(TableBody, { className: 'bg-background', children: jsx(DataTableRows, { table: table, columns: columns, isLoading: isLoading, actionsRow: actionsRow, textNoRecords: textNoRecords, enableMultiRowSelection: enableMultiRowSelection }) })] }) })] }), 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 })] }));
|
|
10532
10559
|
}
|
|
10533
10560
|
|
|
10534
|
-
const downloadWithServiceWorker = async (urlDownload, fileName) => {
|
|
10535
|
-
try {
|
|
10536
|
-
const response = await fetch(urlDownload);
|
|
10537
|
-
if (!response.ok) {
|
|
10538
|
-
throw new Error('Erro ao fazer o download');
|
|
10539
|
-
}
|
|
10540
|
-
const blob = await response.blob();
|
|
10541
|
-
const url = window.URL.createObjectURL(blob);
|
|
10542
|
-
const a = document.createElement('a');
|
|
10543
|
-
a.href = url;
|
|
10544
|
-
a.download = fileName;
|
|
10545
|
-
document.body.appendChild(a);
|
|
10546
|
-
a.click();
|
|
10547
|
-
document.body.removeChild(a);
|
|
10548
|
-
window.URL.revokeObjectURL(url);
|
|
10549
|
-
}
|
|
10550
|
-
catch (error) {
|
|
10551
|
-
toast({
|
|
10552
|
-
title: 'Erro ao fazer o download',
|
|
10553
|
-
description: error instanceof Error ? error.message : 'Tente novamente mais tarde.',
|
|
10554
|
-
variant: 'destructive',
|
|
10555
|
-
});
|
|
10556
|
-
console.error(error);
|
|
10557
|
-
}
|
|
10558
|
-
};
|
|
10559
|
-
|
|
10560
10561
|
function isUUIDv4(str) {
|
|
10561
10562
|
const uuidV4Regex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
10562
10563
|
return uuidV4Regex.test(str);
|