@cnc-ti/layout-basic 8.7.0 → 8.8.0

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.mts CHANGED
@@ -1262,11 +1262,18 @@ interface AlertasProps {
1262
1262
  */
1263
1263
  baseUrl?: string;
1264
1264
  fetchFn?: typeof fetch;
1265
+ /** Atalho pra `filtros: { eventoId }` — mantido pro gestao-eventos. */
1265
1266
  eventoId?: number | string;
1267
+ /**
1268
+ * Filtro livre por metadado, ex.: `{ demandaId: "123" }`. Use quando a
1269
+ * entidade que vincula o alerta não se chama "evento" — a chave precisa
1270
+ * bater com o que foi salvo em `metadados` na criação do alerta.
1271
+ */
1272
+ filtros?: Record<string, string | number>;
1266
1273
  /** Falha ao buscar a lista (GET) ou ao salvar/concluir/excluir (erro relançado por onCriar/onAtualizar/onConcluir/onExcluir). */
1267
1274
  onErro?: (erro: Error) => void;
1268
1275
  }
1269
- declare function Alertas({ alertas: alertasProps, isLoading, isSaving, isRemovendo, podeCriar, onCriar, onAtualizar, onConcluir, onExcluir, baseUrl, sistema, email, fetchFn, eventoId, onErro, }: AlertasProps): react_jsx_runtime.JSX.Element;
1276
+ declare function Alertas({ alertas: alertasProps, isLoading, isSaving, isRemovendo, podeCriar, onCriar, onAtualizar, onConcluir, onExcluir, baseUrl, sistema, email, fetchFn, eventoId, filtros, onErro, }: AlertasProps): react_jsx_runtime.JSX.Element;
1270
1277
 
1271
1278
  interface FormularioAlertaProps {
1272
1279
  alertaEmEdicao?: Alerta | null;
@@ -1299,11 +1306,19 @@ interface ParametrosBuscaAlertas {
1299
1306
  baseUrl: string;
1300
1307
  sistema: string;
1301
1308
  email: string;
1309
+ /** Atalho pra `filtros: { eventoId }` — existe pelo nome, mantido pro gestao-eventos. */
1302
1310
  eventoId?: number | string;
1311
+ /**
1312
+ * Filtro livre por metadado, ex.: `{ demandaId: "123" }`. Vira query string
1313
+ * direto (a API trata qualquer chave solta fora de sistema/email/status/
1314
+ * statusLeitura como filtro de `metadados`). Use quando a entidade que
1315
+ * vincula o alerta não se chama "evento".
1316
+ */
1317
+ filtros?: Record<string, string | number>;
1303
1318
  fetchFn?: typeof fetch;
1304
1319
  signal?: AbortSignal;
1305
1320
  }
1306
- declare function buscarAlertas({ baseUrl, sistema, email, fetchFn, signal, eventoId, }: ParametrosBuscaAlertas): Promise<Alerta[]>;
1321
+ declare function buscarAlertas({ baseUrl, sistema, email, fetchFn, signal, eventoId, filtros, }: ParametrosBuscaAlertas): Promise<Alerta[]>;
1307
1322
 
1308
1323
  /**
1309
1324
  * Só busca a lista de alertas (GET), direto na API de notificações. Criar,
@@ -1316,6 +1331,8 @@ interface OpcoesUsarAlertas {
1316
1331
  email?: string;
1317
1332
  fetchFn?: typeof fetch;
1318
1333
  eventoId?: number | string;
1334
+ /** Filtro livre por metadado, ex.: `{ demandaId: "123" }`. Ver `buscarAlertas`. */
1335
+ filtros?: Record<string, string | number>;
1319
1336
  habilitado?: boolean;
1320
1337
  onErro?: (erro: Error) => void;
1321
1338
  }
@@ -1324,6 +1341,6 @@ interface RetornoUsarAlertas {
1324
1341
  carregando: boolean;
1325
1342
  atualizar: () => void;
1326
1343
  }
1327
- declare function usarAlertas({ baseUrl, sistema, email, fetchFn, eventoId, habilitado, onErro, }: OpcoesUsarAlertas): RetornoUsarAlertas;
1344
+ declare function usarAlertas({ baseUrl, sistema, email, fetchFn, eventoId, filtros, habilitado, onErro, }: OpcoesUsarAlertas): RetornoUsarAlertas;
1328
1345
 
1329
1346
  export { type Alerta, type AlertaFormValues, AlertaItem, type AlertaItemProps, Alertas, type AlertasProps, AplicationsHeader, type AppInput, type AppItem, AppsMenu, type AppsMenuProps, type AtualizarAlertaInput, Avatar, type AvatarProps, Badge, type BadgeSize, type BadgeVariant, Button, type ButtonProps, Card, CardContent, CardFooter, CardFooterItem, CardHeader, CardList, type CardListProps, Checkbox, type CheckboxProps, Collapsible, AnimatedCollapsibleContent as CollapsibleContent, CollapsibleTrigger, Combobox, type ComboboxFooterAction, type ComboboxFooterRenderContext, type ComboboxProps, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmDialog, type ConfirmDialogProps, type CriarAlertaInput, DIAS_SEMANA_PT_BR, DateTimeRangeList, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, type DrawerContentProps, DrawerContext, type DrawerContextValue, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerProvider, type DrawerProviderProps, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, ErroAlertas, ErroNotificacoes, FileList, type FileListItem, type FileListProps, type FileRejection, type FileRejectionReason, FileUpload, type FileUploadProps, Filter, type FilterField, type FilterFieldType, type FilterProps, type FilterValues, FormularioAlerta, type FormularioAlertaProps, Header, HeaderContainer, type HeaderNotificationItem, HeaderNotifications, type HeaderNotificationsBaseProps, type HeaderNotificationsConectadoProps, type HeaderNotificationsControladoProps, type HeaderNotificationsProps, HeaderProfileHeader, HeaderProfileItem, type HeaderProps, Input, type InputProps, type ItemOption, LabelValue, type LabelValueProps, MESES_PT_BR, MESES_PT_BR_ABREV, MiniMonthCalendar, type MiniMonthCalendarDay, type MiniMonthCalendarProps, Modal, ModalEntidade, ModalMudancaEntidade, type ModalProps, type MonthDay, MonthYearPicker, type MonthYearPickerProps, MultiSelect, type MultiSelectOption, type MultiSelectProps, type Notificacao, type OpcoesUsarAlertas, PageHeader, PageHeaderActionsContainer, PageHeaderTitle, PageHeaderTitleContent, type ParametrosBuscaAlertas, type PeriodRange, type PeriodRangeInputType, PeriodRangeList, type PeriodRangeListLabels, type PeriodRangeListProps, type PeriodRangeListValidateOptions, Popover, PopoverContent, PopoverTrigger, ResultMetadata, type ResultMetadataGender, type ResultMetadataProps, type RetornoUsarAlertas, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectPortal, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectViewport, Sidebar, SidebarContainer, type SidebarContainerProps, SidebarImageBrand, type SidebarImageBrandProps, SidebarNavCollapse, type SidebarNavCollapseProps, SidebarNavLink, type SidebarNavLinkProps, type SidebarProps, type StatusAlerta, type StatusLeitura, type StatusNotificacao, Switch, type SwitchProps, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Title, Tooltip, type TooltipProps, URL_PADRAO_NOTIFICACOES, type ValidateFilesOptions, availableApps, buildMonthDays, buscarAlertas, buttonVariants, formatDayAriaLabel, formatFileSize, formatMonthYear, isSameDay, isToday, normalizarBaseUrl, toDateKey, toLocalNoon, usarAlertas, useDrawer, validateFiles };
package/dist/index.d.ts CHANGED
@@ -1262,11 +1262,18 @@ interface AlertasProps {
1262
1262
  */
1263
1263
  baseUrl?: string;
1264
1264
  fetchFn?: typeof fetch;
1265
+ /** Atalho pra `filtros: { eventoId }` — mantido pro gestao-eventos. */
1265
1266
  eventoId?: number | string;
1267
+ /**
1268
+ * Filtro livre por metadado, ex.: `{ demandaId: "123" }`. Use quando a
1269
+ * entidade que vincula o alerta não se chama "evento" — a chave precisa
1270
+ * bater com o que foi salvo em `metadados` na criação do alerta.
1271
+ */
1272
+ filtros?: Record<string, string | number>;
1266
1273
  /** Falha ao buscar a lista (GET) ou ao salvar/concluir/excluir (erro relançado por onCriar/onAtualizar/onConcluir/onExcluir). */
1267
1274
  onErro?: (erro: Error) => void;
1268
1275
  }
1269
- declare function Alertas({ alertas: alertasProps, isLoading, isSaving, isRemovendo, podeCriar, onCriar, onAtualizar, onConcluir, onExcluir, baseUrl, sistema, email, fetchFn, eventoId, onErro, }: AlertasProps): react_jsx_runtime.JSX.Element;
1276
+ declare function Alertas({ alertas: alertasProps, isLoading, isSaving, isRemovendo, podeCriar, onCriar, onAtualizar, onConcluir, onExcluir, baseUrl, sistema, email, fetchFn, eventoId, filtros, onErro, }: AlertasProps): react_jsx_runtime.JSX.Element;
1270
1277
 
1271
1278
  interface FormularioAlertaProps {
1272
1279
  alertaEmEdicao?: Alerta | null;
@@ -1299,11 +1306,19 @@ interface ParametrosBuscaAlertas {
1299
1306
  baseUrl: string;
1300
1307
  sistema: string;
1301
1308
  email: string;
1309
+ /** Atalho pra `filtros: { eventoId }` — existe pelo nome, mantido pro gestao-eventos. */
1302
1310
  eventoId?: number | string;
1311
+ /**
1312
+ * Filtro livre por metadado, ex.: `{ demandaId: "123" }`. Vira query string
1313
+ * direto (a API trata qualquer chave solta fora de sistema/email/status/
1314
+ * statusLeitura como filtro de `metadados`). Use quando a entidade que
1315
+ * vincula o alerta não se chama "evento".
1316
+ */
1317
+ filtros?: Record<string, string | number>;
1303
1318
  fetchFn?: typeof fetch;
1304
1319
  signal?: AbortSignal;
1305
1320
  }
1306
- declare function buscarAlertas({ baseUrl, sistema, email, fetchFn, signal, eventoId, }: ParametrosBuscaAlertas): Promise<Alerta[]>;
1321
+ declare function buscarAlertas({ baseUrl, sistema, email, fetchFn, signal, eventoId, filtros, }: ParametrosBuscaAlertas): Promise<Alerta[]>;
1307
1322
 
1308
1323
  /**
1309
1324
  * Só busca a lista de alertas (GET), direto na API de notificações. Criar,
@@ -1316,6 +1331,8 @@ interface OpcoesUsarAlertas {
1316
1331
  email?: string;
1317
1332
  fetchFn?: typeof fetch;
1318
1333
  eventoId?: number | string;
1334
+ /** Filtro livre por metadado, ex.: `{ demandaId: "123" }`. Ver `buscarAlertas`. */
1335
+ filtros?: Record<string, string | number>;
1319
1336
  habilitado?: boolean;
1320
1337
  onErro?: (erro: Error) => void;
1321
1338
  }
@@ -1324,6 +1341,6 @@ interface RetornoUsarAlertas {
1324
1341
  carregando: boolean;
1325
1342
  atualizar: () => void;
1326
1343
  }
1327
- declare function usarAlertas({ baseUrl, sistema, email, fetchFn, eventoId, habilitado, onErro, }: OpcoesUsarAlertas): RetornoUsarAlertas;
1344
+ declare function usarAlertas({ baseUrl, sistema, email, fetchFn, eventoId, filtros, habilitado, onErro, }: OpcoesUsarAlertas): RetornoUsarAlertas;
1328
1345
 
1329
1346
  export { type Alerta, type AlertaFormValues, AlertaItem, type AlertaItemProps, Alertas, type AlertasProps, AplicationsHeader, type AppInput, type AppItem, AppsMenu, type AppsMenuProps, type AtualizarAlertaInput, Avatar, type AvatarProps, Badge, type BadgeSize, type BadgeVariant, Button, type ButtonProps, Card, CardContent, CardFooter, CardFooterItem, CardHeader, CardList, type CardListProps, Checkbox, type CheckboxProps, Collapsible, AnimatedCollapsibleContent as CollapsibleContent, CollapsibleTrigger, Combobox, type ComboboxFooterAction, type ComboboxFooterRenderContext, type ComboboxProps, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ConfirmDialog, type ConfirmDialogProps, type CriarAlertaInput, DIAS_SEMANA_PT_BR, DateTimeRangeList, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, type DrawerContentProps, DrawerContext, type DrawerContextValue, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerProvider, type DrawerProviderProps, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, ErroAlertas, ErroNotificacoes, FileList, type FileListItem, type FileListProps, type FileRejection, type FileRejectionReason, FileUpload, type FileUploadProps, Filter, type FilterField, type FilterFieldType, type FilterProps, type FilterValues, FormularioAlerta, type FormularioAlertaProps, Header, HeaderContainer, type HeaderNotificationItem, HeaderNotifications, type HeaderNotificationsBaseProps, type HeaderNotificationsConectadoProps, type HeaderNotificationsControladoProps, type HeaderNotificationsProps, HeaderProfileHeader, HeaderProfileItem, type HeaderProps, Input, type InputProps, type ItemOption, LabelValue, type LabelValueProps, MESES_PT_BR, MESES_PT_BR_ABREV, MiniMonthCalendar, type MiniMonthCalendarDay, type MiniMonthCalendarProps, Modal, ModalEntidade, ModalMudancaEntidade, type ModalProps, type MonthDay, MonthYearPicker, type MonthYearPickerProps, MultiSelect, type MultiSelectOption, type MultiSelectProps, type Notificacao, type OpcoesUsarAlertas, PageHeader, PageHeaderActionsContainer, PageHeaderTitle, PageHeaderTitleContent, type ParametrosBuscaAlertas, type PeriodRange, type PeriodRangeInputType, PeriodRangeList, type PeriodRangeListLabels, type PeriodRangeListProps, type PeriodRangeListValidateOptions, Popover, PopoverContent, PopoverTrigger, ResultMetadata, type ResultMetadataGender, type ResultMetadataProps, type RetornoUsarAlertas, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectPortal, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectViewport, Sidebar, SidebarContainer, type SidebarContainerProps, SidebarImageBrand, type SidebarImageBrandProps, SidebarNavCollapse, type SidebarNavCollapseProps, SidebarNavLink, type SidebarNavLinkProps, type SidebarProps, type StatusAlerta, type StatusLeitura, type StatusNotificacao, Switch, type SwitchProps, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, Title, Tooltip, type TooltipProps, URL_PADRAO_NOTIFICACOES, type ValidateFilesOptions, availableApps, buildMonthDays, buscarAlertas, buttonVariants, formatDayAriaLabel, formatFileSize, formatMonthYear, isSameDay, isToday, normalizarBaseUrl, toDateKey, toLocalNoon, usarAlertas, useDrawer, validateFiles };
package/dist/index.js CHANGED
@@ -7495,10 +7495,14 @@ async function buscarAlertas({
7495
7495
  email,
7496
7496
  fetchFn = fetch,
7497
7497
  signal,
7498
- eventoId
7498
+ eventoId,
7499
+ filtros
7499
7500
  }) {
7500
7501
  const params = new URLSearchParams({ sistema, email });
7501
7502
  if (eventoId !== void 0) params.set("eventoId", String(eventoId));
7503
+ for (const [chave, valor] of Object.entries(filtros ?? {})) {
7504
+ if (valor !== void 0 && valor !== null && valor !== "") params.set(chave, String(valor));
7505
+ }
7502
7506
  const url = `${normalizarBaseUrl(baseUrl)}/notificacoes?${params.toString()}`;
7503
7507
  const resposta = await fetchFn(url, {
7504
7508
  method: "GET",
@@ -7521,6 +7525,7 @@ function usarAlertas({
7521
7525
  email,
7522
7526
  fetchFn,
7523
7527
  eventoId,
7528
+ filtros,
7524
7529
  habilitado = true,
7525
7530
  onErro
7526
7531
  }) {
@@ -7530,13 +7535,18 @@ function usarAlertas({
7530
7535
  const jaCarregouRef = React31.useRef(false);
7531
7536
  const onErroRef = React31.useRef(onErro);
7532
7537
  const fetchFnRef = React31.useRef(fetchFn);
7538
+ const filtrosRef = React31.useRef(filtros);
7533
7539
  React31.useEffect(() => {
7534
7540
  onErroRef.current = onErro;
7535
7541
  }, [onErro]);
7536
7542
  React31.useEffect(() => {
7537
7543
  fetchFnRef.current = fetchFn;
7538
7544
  }, [fetchFn]);
7545
+ React31.useEffect(() => {
7546
+ filtrosRef.current = filtros;
7547
+ }, [filtros]);
7539
7548
  const pronto = baseUrl !== void 0 && sistema !== void 0 && email !== void 0;
7549
+ const filtrosChave = filtros ? JSON.stringify(filtros) : "";
7540
7550
  const atualizar = React31.useCallback(() => {
7541
7551
  if (!habilitado || !pronto) return;
7542
7552
  controladorRef.current?.abort();
@@ -7550,6 +7560,7 @@ function usarAlertas({
7550
7560
  email,
7551
7561
  fetchFn: fetchFnRef.current,
7552
7562
  eventoId,
7563
+ filtros: filtrosRef.current,
7553
7564
  signal: controlador.signal
7554
7565
  });
7555
7566
  if (controlador.signal.aborted) return;
@@ -7564,7 +7575,7 @@ function usarAlertas({
7564
7575
  }
7565
7576
  }
7566
7577
  })();
7567
- }, [baseUrl, sistema, email, eventoId, habilitado, pronto]);
7578
+ }, [baseUrl, sistema, email, eventoId, filtrosChave, habilitado, pronto]);
7568
7579
  React31.useEffect(() => {
7569
7580
  if (!habilitado || !pronto) {
7570
7581
  setCarregando(false);
@@ -7598,6 +7609,7 @@ function Alertas({
7598
7609
  email,
7599
7610
  fetchFn,
7600
7611
  eventoId,
7612
+ filtros,
7601
7613
  onErro
7602
7614
  }) {
7603
7615
  const [formAberto, setFormAberto] = React32.useState(false);
@@ -7611,6 +7623,7 @@ function Alertas({
7611
7623
  email,
7612
7624
  fetchFn,
7613
7625
  eventoId,
7626
+ filtros,
7614
7627
  habilitado: conectado,
7615
7628
  onErro
7616
7629
  });