@telamonjs/ui 1.0.4 → 1.2.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +2 -2
  3. package/dist/components/business/CalendarWithEvents.d.ts +7 -1
  4. package/dist/components/business/CalendarWithEvents.js +8 -9
  5. package/dist/components/cards/stat-card.js +22 -3
  6. package/dist/components/charts/BarChart.d.ts +12 -1
  7. package/dist/components/charts/BarChart.js +11 -2
  8. package/dist/components/crud/crud-field.js +1 -0
  9. package/dist/components/data/DataTableActions.js +45 -77
  10. package/dist/components/data/action-access.d.ts +22 -0
  11. package/dist/components/data/action-access.js +33 -0
  12. package/dist/components/data/report-table.d.ts +3 -1
  13. package/dist/components/data/report-table.js +2 -1
  14. package/dist/components/dialog/DialogHeaderContent.js +1 -1
  15. package/dist/components/dialog/confirm-action-dialog.d.ts +86 -0
  16. package/dist/components/dialog/confirm-action-dialog.js +194 -0
  17. package/dist/components/dialog/crud-view-dialog.d.ts +7 -3
  18. package/dist/components/dialog/crud-view-dialog.js +3 -2
  19. package/dist/components/dialog/view-dialog.d.ts +9 -1
  20. package/dist/components/dialog/view-dialog.js +8 -3
  21. package/dist/components/forms/AdminForm.js +2 -1
  22. package/dist/components/forms/BaseForm.js +4 -3
  23. package/dist/components/forms/WizardForm.js +3 -2
  24. package/dist/components/forms/ZustandForm.js +5 -4
  25. package/dist/components/forms/admin-form/field-group.js +5 -4
  26. package/dist/components/forms/grid-classes.d.ts +4 -0
  27. package/dist/components/forms/grid-classes.js +40 -0
  28. package/dist/components/forms/validators/config-validator.js +2 -1
  29. package/dist/components/toolbar/TabToolbar.d.ts +6 -1
  30. package/dist/components/toolbar/TabToolbar.js +5 -3
  31. package/dist/data/InfiniteList.js +2 -4
  32. package/dist/data/MobileCard.js +4 -1
  33. package/dist/data/VirtualDataTable.js +4 -1
  34. package/dist/data/datatable/TableDesktopView.js +2 -5
  35. package/dist/data/row-click.d.ts +10 -0
  36. package/dist/data/row-click.js +11 -0
  37. package/dist/exports/data-crud.d.ts +1 -1
  38. package/dist/exports/pages-dialogs.d.ts +3 -1
  39. package/dist/exports/pages-dialogs.js +2 -0
  40. package/dist/exports/types-constants.d.ts +2 -2
  41. package/dist/exports/types-constants.js +1 -1
  42. package/dist/field-system/mask-presets.d.ts +5 -0
  43. package/dist/field-system/mask-presets.js +18 -0
  44. package/dist/field-system/renderers/advanced-renderers.js +2 -4
  45. package/dist/field-system/renderers/textarea-renderers.js +1 -1
  46. package/dist/hooks/useCrudMutations.js +28 -16
  47. package/dist/i18n/messages/en/index.d.ts +1 -0
  48. package/dist/i18n/messages/en/list.d.ts +1 -0
  49. package/dist/i18n/messages/en/list.js +1 -0
  50. package/dist/i18n/messages/en/queue.js +1 -1
  51. package/dist/i18n/messages/es/index.d.ts +1 -0
  52. package/dist/i18n/messages/es/list.d.ts +1 -0
  53. package/dist/i18n/messages/es/list.js +1 -0
  54. package/dist/i18n/messages/pt-BR/index.d.ts +8 -7
  55. package/dist/i18n/messages/pt-BR/list.d.ts +1 -0
  56. package/dist/i18n/messages/pt-BR/list.js +1 -0
  57. package/dist/i18n/messages/pt-BR/queue.d.ts +7 -7
  58. package/dist/i18n/messages/pt-BR/queue.js +7 -7
  59. package/dist/i18n/use-t.d.ts +8 -7
  60. package/dist/pages/ListPage.js +23 -14
  61. package/dist/pages/list-page/ListPageDialogs.d.ts +8 -3
  62. package/dist/pages/list-page/ListPageDialogs.js +36 -7
  63. package/dist/pages/list-page/ListPageTable.d.ts +1 -1
  64. package/dist/pages/list-page/ListPageTable.js +1 -1
  65. package/dist/pages/list-page/ListPageToolbar.js +10 -14
  66. package/dist/pages/list-page/apply-crud-permissions.d.ts +21 -0
  67. package/dist/pages/list-page/apply-crud-permissions.js +34 -0
  68. package/dist/pages/list-page/types.d.ts +21 -2
  69. package/dist/pages/list-page/useDialogUrlSync.d.ts +10 -4
  70. package/dist/pages/list-page/useDialogUrlSync.js +7 -11
  71. package/dist/pages/list-page/useListPageData.d.ts +3 -1
  72. package/dist/pages/list-page/useListPageData.js +2 -1
  73. package/dist/pages/list-page/useListPageDialogs.d.ts +1 -0
  74. package/dist/pages/list-page/useListPageDialogs.js +13 -4
  75. package/dist/pages/list-page/useListPageToolbar.d.ts +8 -5
  76. package/dist/pages/list-page/useListPageToolbar.js +14 -10
  77. package/dist/queue/components/DispatchJobModal.js +5 -2
  78. package/dist/queue/components/FailureGroupsModal.js +4 -3
  79. package/dist/queue/components/JobConfigDialog.js +9 -1
  80. package/dist/queue/components/JobDetailModal.js +3 -2
  81. package/dist/queue/components/JobDetailPage.d.ts +8 -0
  82. package/dist/queue/components/JobDetailPage.js +29 -13
  83. package/dist/queue/components/JobEventModal.js +3 -2
  84. package/dist/queue/components/QueueDashboard.js +3 -1
  85. package/dist/queue/components/QueueTabbedDashboard.d.ts +21 -2
  86. package/dist/queue/components/QueueTabbedDashboard.js +3 -2
  87. package/dist/queue/components/QueuesTable.d.ts +3 -2
  88. package/dist/queue/components/QueuesTable.js +357 -286
  89. package/dist/queue/components/job-shared.d.ts +2 -0
  90. package/dist/queue/components/job-shared.js +2 -0
  91. package/dist/queue/components/jobs-history-modal/fullscreen-modal.js +3 -2
  92. package/dist/queue/components/jobs-history-modal/job-detail-modal.js +3 -2
  93. package/dist/queue/components/jobs-list-modal/job-row.js +3 -2
  94. package/dist/queue/components/labels-context.d.ts +39 -0
  95. package/dist/queue/components/labels-context.js +35 -0
  96. package/dist/queue/components/labels-provider.d.ts +11 -0
  97. package/dist/queue/components/labels-provider.js +35 -0
  98. package/dist/queue/components/module-icon.d.ts +9 -0
  99. package/dist/queue/components/module-icon.js +14 -0
  100. package/dist/queue/components/tabs/ConfiguracaoTab.d.ts +2 -1
  101. package/dist/queue/components/tabs/ConfiguracaoTab.js +16 -12
  102. package/dist/queue/components/tabs/HistoricoTab.js +4 -3
  103. package/dist/queue/components/tabs/TempoRealTab.d.ts +3 -2
  104. package/dist/queue/components/tabs/TempoRealTab.js +5 -4
  105. package/dist/queue/components/tabs/historico/history-job-row.js +1 -1
  106. package/dist/queue/lib/action-message.d.ts +3 -2
  107. package/dist/queue/lib/action-message.js +2 -2
  108. package/dist/queue/types.d.ts +3 -0
  109. package/dist/types/actions.d.ts +51 -14
  110. package/dist/types/crud.d.ts +53 -9
  111. package/dist/types/dialog-header.d.ts +2 -2
  112. package/dist/types/forms/admin-form.d.ts +8 -1
  113. package/dist/utils/with-scope.js +5 -3
  114. package/package.json +2 -2
@@ -272,9 +272,11 @@ function TabToolbarFilterButtons({
272
272
  options,
273
273
  value,
274
274
  onChange,
275
- className
275
+ className,
276
+ allValue
276
277
  }) {
277
- const toggleOptions = options.slice(1);
278
+ const resetValue = allValue ?? options[0]?.value ?? "";
279
+ const toggleOptions = allValue === void 0 ? options.slice(1) : options.filter((o) => o.value !== allValue);
278
280
  if (toggleOptions.length === 0) return null;
279
281
  return /* @__PURE__ */ jsx(
280
282
  "div",
@@ -290,7 +292,7 @@ function TabToolbarFilterButtons({
290
292
  {
291
293
  variant: "outline",
292
294
  size: "sm",
293
- onClick: () => onChange(isActive ? options[0].value : opt.value),
295
+ onClick: () => onChange(isActive ? resetValue : opt.value),
294
296
  className: cn(
295
297
  "h-8 rounded-none gap-1.5",
296
298
  isFirst && "rounded-l-md",
@@ -29,6 +29,7 @@ import {
29
29
  } from "lucide-react";
30
30
  import { Button } from "../ui/button.js";
31
31
  import { cn } from "../utils/index.js";
32
+ import { isOwnRowClick } from "./row-click.js";
32
33
  import { useTranslations } from "next-intl";
33
34
  import { useTelamonjsT, useText } from "../i18n/use-t.js";
34
35
  import { isMessageRef, msg } from "../i18n/msg.js";
@@ -266,10 +267,7 @@ function InfiniteList({
266
267
  onRowClick && "cursor-pointer"
267
268
  ),
268
269
  onClick: (e) => {
269
- const target = e.target;
270
- if (target.closest('input[type="checkbox"]') || target.closest("button"))
271
- return;
272
- onRowClick?.(row.original);
270
+ if (isOwnRowClick(e)) onRowClick?.(row.original);
273
271
  },
274
272
  children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(
275
273
  TableCell,
@@ -15,6 +15,7 @@ import {
15
15
  import { flexRender } from "@tanstack/react-table";
16
16
  import { useTelamonjsT } from "../i18n/use-t.js";
17
17
  import { getColumnLabel } from "./column-label.js";
18
+ import { isOwnRowClick } from "./row-click.js";
18
19
  import { jsx, jsxs } from "react/jsx-runtime";
19
20
  function MobileCardImpl({
20
21
  data,
@@ -59,7 +60,9 @@ function MobileCardImpl({
59
60
  Card,
60
61
  {
61
62
  className: `relative transition-all hover:shadow-md cursor-pointer ${isSelected ? "ring-2 ring-primary" : ""}`,
62
- onClick: () => onSelect?.(data),
63
+ onClick: (e) => {
64
+ if (isOwnRowClick(e)) onSelect?.(data);
65
+ },
63
66
  children: [
64
67
  /* @__PURE__ */ jsx(CardHeader, { className: "pb-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
65
68
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
@@ -19,6 +19,7 @@ import {
19
19
  TableRow
20
20
  } from "../ui/table.js";
21
21
  import { cn } from "../utils/index.js";
22
+ import { isOwnRowClick } from "./row-click.js";
22
23
  import { jsx, jsxs } from "react/jsx-runtime";
23
24
  function VirtualDataTable({
24
25
  data,
@@ -89,7 +90,9 @@ function VirtualDataTable({
89
90
  "border-b transition-colors hover:bg-muted/50",
90
91
  onRowClick && "cursor-pointer"
91
92
  ),
92
- onClick: () => onRowClick?.(row.original),
93
+ onClick: (e) => {
94
+ if (isOwnRowClick(e)) onRowClick?.(row.original);
95
+ },
93
96
  children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell, { className: "py-2", children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))
94
97
  },
95
98
  row.id
@@ -19,6 +19,7 @@ import { Badge } from "../../ui/badge.js";
19
19
  import { cn } from "../../utils/index.js";
20
20
  import { SkeletonTable } from "../../components/skeletons/SkeletonTable.js";
21
21
  import { getDensityStyles } from "./density.js";
22
+ import { isOwnRowClick } from "../row-click.js";
22
23
  import { jsx, jsxs } from "react/jsx-runtime";
23
24
  function TableDesktopView({
24
25
  table,
@@ -97,11 +98,7 @@ function TableDesktopView({
97
98
  ),
98
99
  "data-state": row.getIsSelected() && "selected",
99
100
  onClick: (e) => {
100
- const target = e.target;
101
- if (target.closest('input[type="checkbox"]') || target.closest("button")) {
102
- return;
103
- }
104
- handleRowClick(row.original);
101
+ if (isOwnRowClick(e)) handleRowClick(row.original);
105
102
  },
106
103
  children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(
107
104
  TableCell,
@@ -0,0 +1,10 @@
1
+ import type { MouseEvent } from 'react';
2
+ /**
3
+ * Whether a click on a clickable row (or card) is a click on the row itself.
4
+ *
5
+ * React bubbles synthetic events through the component tree, not the DOM:
6
+ * a click inside content a cell renders in a portal (a row action's confirm
7
+ * dialog, the "..." menu, a popover) still reaches the row's `onClick`. Only
8
+ * targets inside the row's own DOM count, minus interactive elements.
9
+ */
10
+ export declare function isOwnRowClick(event: MouseEvent<Element>): boolean;
@@ -0,0 +1,11 @@
1
+ // src/data/row-click.ts
2
+ var INTERACTIVE = "button, a[href], input, textarea, select";
3
+ function isOwnRowClick(event) {
4
+ const target = event.target;
5
+ if (!(target instanceof Element)) return false;
6
+ if (!event.currentTarget.contains(target)) return false;
7
+ return !target.closest(INTERACTIVE);
8
+ }
9
+ export {
10
+ isOwnRowClick
11
+ };
@@ -12,7 +12,7 @@ export { ExportMenu } from '../data/ExportMenu';
12
12
  export type { ExportMenuProps } from '../data/ExportMenu';
13
13
  export { exportToExcel, exportToCSV, exportToPDF, exportTableData, } from '../data/exportUtils';
14
14
  export type { ExportOptions, PDFExportOptions } from '../data/exportUtils';
15
- export type { DataTableActionsConfig, ActionConfig, CustomAction, StandardActionsConfig, ActionsDisplayConfig, ConfirmDialogConfig, TooltipConfig, ButtonVariant, BadgeVariant, } from '../types/actions';
15
+ export type { DataTableActionsConfig, ActionConfig, CustomAction, StandardActionsConfig, ActionsDisplayConfig, ConfirmDialogConfig, ConfirmDialogInput, ActionContext, TooltipConfig, ButtonVariant, BadgeVariant, } from '../types/actions';
16
16
  export { VirtualDataTable } from '../data/VirtualDataTable';
17
17
  export { withScope } from '../utils/with-scope';
18
18
  export type { CrudScope } from '../utils/with-scope';
@@ -2,7 +2,7 @@ export { BaseFormPage } from '../pages/BaseFormPage';
2
2
  export type { BaseFormPageProps } from '../pages/BaseFormPage';
3
3
  export { DetailPage } from '../pages/DetailPage';
4
4
  export { ListPage } from '../pages/ListPage';
5
- export type { ActiveFilterChip } from '../pages/list-page/types';
5
+ export type { ActiveFilterChip, ListQueryState } from '../pages/list-page/types';
6
6
  export { EditPage } from '../pages/EditPage';
7
7
  export type { EditPageProps } from '../pages/EditPage';
8
8
  export { CreatePage } from '../pages/CreatePage';
@@ -15,6 +15,8 @@ export { CreateDialog } from '../components/dialog/create-dialog';
15
15
  export type { CreateDialogProps } from '../components/dialog/create-dialog';
16
16
  export { ViewPortalDialog } from '../components/dialog/view-portal-dialog';
17
17
  export { CrudViewDialog } from '../components/dialog/crud-view-dialog';
18
+ export { ConfirmActionDialog } from '../components/dialog/confirm-action-dialog';
19
+ export type { ConfirmActionDialogProps } from '../components/dialog/confirm-action-dialog';
18
20
  export type { CrudViewDialogProps } from '../components/dialog/crud-view-dialog';
19
21
  export type { ViewPortalDialogProps, ViewPortalSection, PortalSectionEdit, } from '../components/dialog/view-portal-dialog';
20
22
  export { DialogHeaderContent } from '../components/dialog';
@@ -9,6 +9,7 @@ import { ViewDialog } from "../components/dialog/view-dialog.js";
9
9
  import { CreateDialog } from "../components/dialog/create-dialog.js";
10
10
  import { ViewPortalDialog } from "../components/dialog/view-portal-dialog.js";
11
11
  import { CrudViewDialog } from "../components/dialog/crud-view-dialog.js";
12
+ import { ConfirmActionDialog } from "../components/dialog/confirm-action-dialog.js";
12
13
  import { DialogHeaderContent } from "../components/dialog/index.js";
13
14
  import { StatsGrid } from "../components/dialog/index.js";
14
15
  import { DialogFrame } from "../components/dialog/index.js";
@@ -16,6 +17,7 @@ import { SplitDialogFrame } from "../components/dialog/index.js";
16
17
  import { PageContent } from "../layouts/PageContent.js";
17
18
  export {
18
19
  BaseFormPage,
20
+ ConfirmActionDialog,
19
21
  CreateDialog,
20
22
  CreatePage,
21
23
  CrudViewDialog,
@@ -3,8 +3,8 @@ export type { IconName } from '../utils/icon';
3
3
  export type { PaginationParams, PaginatedResponse, SortField, } from '../types/pagination';
4
4
  export { createPaginatedResponse, asQueryFn } from '../types/pagination';
5
5
  export type { FilterOption, ColumnFilterConfig } from '../types/filters';
6
- export type { ModuleMetadata, ListConfig, CrudColumnDef, FormConfig, QueryConfig, MutationConfig, MutationsConfig, DialogConfig, DialogsConfig, PagesConfig, CrudConfig, CrudConfigWithAnyForm, ToolbarFilterOption, ToolbarFilterConfig, ToolbarConfig, } from '../types/crud';
6
+ export type { ModuleMetadata, ListConfig, CrudColumnDef, FormConfig, QueryConfig, MutationConfig, MutationsConfig, DialogConfig, DialogsConfig, PagesConfig, CrudConfig, CrudConfigWithAnyForm, CrudPermissions, ToolbarFilterOption, ToolbarFilterConfig, ToolbarConfig, } from '../types/crud';
7
7
  export type { ColorPreset, StatItem, HeaderBadgeConfig, HeaderStatsConfig, DialogHeaderConfig, DialogHeaderProps, StatsGridProps, } from '../types/dialog-header';
8
8
  export type { MenuItem, SingleMenuItem, GroupMenuItem, SeparatorMenuItem, MenuItemType, MenuVariant, IconComponent, } from '../types/menu';
9
9
  export type { Density, GapSize, DialogSize, DialogHeight, FieldLayout, CardFieldLayout, } from '../utils/spacing';
10
- export declare const version = "1.0.4";
10
+ export declare const version = "1.2.0";
@@ -1,6 +1,6 @@
1
1
  // src/exports/types-constants.ts
2
2
  import { createPaginatedResponse, asQueryFn } from "../types/pagination.js";
3
- var version = "1.0.4";
3
+ var version = "1.2.0";
4
4
  export {
5
5
  asQueryFn,
6
6
  createPaginatedResponse,
@@ -0,0 +1,5 @@
1
+ /** Built-in masks for `maskType` (`_` = one digit). */
2
+ export type MaskPreset = 'tel' | 'cpf' | 'cnpj' | 'cep';
3
+ export declare function isMaskPreset(maskType: unknown): maskType is MaskPreset;
4
+ /** Mask for `digitCount` raw digits: the `maskType` preset when there is one, else `mask`. */
5
+ export declare function resolveMask(maskType: string | undefined, mask: string | undefined, digitCount: number): string;
@@ -0,0 +1,18 @@
1
+ // src/field-system/mask-presets.ts
2
+ var telMaskFor = (digitCount) => digitCount > 10 ? "(__) _____-____" : "(__) ____-____";
3
+ var MASK_PRESETS = {
4
+ tel: telMaskFor,
5
+ cpf: () => "___.___.___-__",
6
+ cnpj: () => "__.___.___/____-__",
7
+ cep: () => "_____-___"
8
+ };
9
+ function isMaskPreset(maskType) {
10
+ return typeof maskType === "string" && Object.hasOwn(MASK_PRESETS, maskType);
11
+ }
12
+ function resolveMask(maskType, mask, digitCount) {
13
+ return isMaskPreset(maskType) ? MASK_PRESETS[maskType](digitCount) : mask || "";
14
+ }
15
+ export {
16
+ isMaskPreset,
17
+ resolveMask
18
+ };
@@ -11,6 +11,7 @@ import {
11
11
  import { TimePicker } from "../../components/forms/TimePicker.js";
12
12
  import { WizardForm } from "../../components/forms/WizardForm.js";
13
13
  import { getFieldAccessibilityAttrs } from "../../utils/test-ids.js";
14
+ import { resolveMask } from "../mask-presets.js";
14
15
  import { jsx, jsxs } from "react/jsx-runtime";
15
16
  var RichTextRenderer = {
16
17
  render: ({ field, t }) => {
@@ -183,11 +184,8 @@ var RangeRenderer = {
183
184
  ] });
184
185
  }
185
186
  };
186
- var TEL_MASK_LANDLINE = "(__) ____-____";
187
- var TEL_MASK_MOBILE = "(__) _____-____";
188
187
  var MASK_REPLACEMENT = { _: /\d/ };
189
188
  var digitsOf = (raw) => raw.replace(/\D/g, "");
190
- var telMaskFor = (digitCount) => digitCount > 10 ? TEL_MASK_MOBILE : TEL_MASK_LANDLINE;
191
189
  function caretAfterDigit(text, n) {
192
190
  if (n <= 0) return 0;
193
191
  let seen = 0;
@@ -247,7 +245,7 @@ var MaskedRenderer = {
247
245
  error: field.error,
248
246
  description: field.description
249
247
  });
250
- const maskFor = (digits) => field.maskType === "tel" ? telMaskFor(digits.length) : field.mask || "";
248
+ const maskFor = (digits) => resolveMask(field.maskType, field.mask, digits.length);
251
249
  const value = String(field.value ?? "");
252
250
  return /* @__PURE__ */ jsx(
253
251
  MaskedInput,
@@ -23,7 +23,7 @@ var TextareaRenderer = {
23
23
  onBlur: field.onBlur,
24
24
  ref: field.ref,
25
25
  placeholder: field.placeholder || t("form.enterText", { label: field.label.toLowerCase() }),
26
- rows: 4,
26
+ rows: field.rows ?? 4,
27
27
  readOnly: field.readOnly,
28
28
  autoFocus: field.focus,
29
29
  required: field.required
@@ -20,11 +20,26 @@ function useCrudMutations({
20
20
  );
21
21
  }
22
22
  const invalidateQueries = (invalidates, id) => {
23
- const invalidationPromises = invalidates.map((keyOrFn) => {
24
- const key = typeof keyOrFn === "function" ? keyOrFn(id) : keyOrFn;
25
- return queryClient.invalidateQueries({ queryKey: key });
23
+ const keys = invalidates.map(
24
+ (keyOrFn) => typeof keyOrFn === "function" ? keyOrFn(id) : keyOrFn
25
+ );
26
+ for (const key of keys) {
27
+ void queryClient.invalidateQueries({ queryKey: key }).catch(() => void 0);
28
+ }
29
+ const cache = queryClient.getQueryCache();
30
+ const firstAttemptPending = () => keys.some(
31
+ (key) => cache.findAll({ queryKey: key }).some(
32
+ (q) => q.state.fetchStatus === "fetching" && q.state.fetchFailureCount === 0
33
+ )
34
+ );
35
+ if (!firstAttemptPending()) return Promise.resolve();
36
+ return new Promise((resolve) => {
37
+ const unsubscribe = cache.subscribe(() => {
38
+ if (firstAttemptPending()) return;
39
+ unsubscribe();
40
+ resolve();
41
+ });
26
42
  });
27
- void Promise.all(invalidationPromises).catch(() => void 0);
28
43
  };
29
44
  const createMutation = useMutation({
30
45
  meta: LIB_QUERY_META,
@@ -34,14 +49,13 @@ function useCrudMutations({
34
49
  }
35
50
  return await mutations.create.mutationFn(data);
36
51
  },
37
- onSuccess: (result, variables) => {
38
- if (mutations.create?.invalidates) {
39
- invalidateQueries(mutations.create.invalidates);
40
- }
52
+ onSuccess: async (result, variables) => {
53
+ const listRefetched = mutations.create?.invalidates ? invalidateQueries(mutations.create.invalidates) : void 0;
41
54
  mutations.create?.onSuccess?.(result, variables);
42
55
  if (result?.success && result?.message) {
43
56
  toast.success(result.message);
44
57
  }
58
+ await listRefetched;
45
59
  },
46
60
  onError: (error, variables) => {
47
61
  mutations.create?.onError?.(error, variables);
@@ -57,14 +71,13 @@ function useCrudMutations({
57
71
  }
58
72
  return await mutations.update.mutationFn(variables);
59
73
  },
60
- onSuccess: (result, variables) => {
61
- if (mutations.update?.invalidates) {
62
- invalidateQueries(mutations.update.invalidates, variables.id);
63
- }
74
+ onSuccess: async (result, variables) => {
75
+ const listRefetched = mutations.update?.invalidates ? invalidateQueries(mutations.update.invalidates, variables.id) : void 0;
64
76
  mutations.update?.onSuccess?.(result, variables);
65
77
  if (result?.success && result?.message) {
66
78
  toast.success(result.message);
67
79
  }
80
+ await listRefetched;
68
81
  },
69
82
  onError: (error, variables) => {
70
83
  mutations.update?.onError?.(error, variables);
@@ -80,14 +93,13 @@ function useCrudMutations({
80
93
  }
81
94
  return await mutations.delete.mutationFn(variables);
82
95
  },
83
- onSuccess: (result, variables) => {
84
- if (mutations.delete?.invalidates) {
85
- invalidateQueries(mutations.delete.invalidates, variables.id);
86
- }
96
+ onSuccess: async (result, variables) => {
97
+ const listRefetched = mutations.delete?.invalidates ? invalidateQueries(mutations.delete.invalidates, variables.id) : void 0;
87
98
  mutations.delete?.onSuccess?.(result, variables);
88
99
  if (result?.success && result?.message) {
89
100
  toast.success(result.message);
90
101
  }
102
+ await listRefetched;
91
103
  },
92
104
  onError: (error, variables) => {
93
105
  mutations.delete?.onError?.(error, variables);
@@ -51,6 +51,7 @@ export declare const en: {
51
51
  empty: string;
52
52
  emptyDescription: string;
53
53
  emptyDescriptionNewItem: string;
54
+ emptyDescriptionNoCreate: string;
54
55
  noResults: string;
55
56
  noResultsDescription: string;
56
57
  selectAll: string;
@@ -3,6 +3,7 @@ export declare const list: {
3
3
  empty: string;
4
4
  emptyDescription: string;
5
5
  emptyDescriptionNewItem: string;
6
+ emptyDescriptionNoCreate: string;
6
7
  noResults: string;
7
8
  noResultsDescription: string;
8
9
  selectAll: string;
@@ -4,6 +4,7 @@ var list = {
4
4
  empty: "No items found",
5
5
  emptyDescription: "Try adjusting the filters or add new items.",
6
6
  emptyDescriptionNewItem: "Start by adding a new item.",
7
+ emptyDescriptionNoCreate: "There are no items to show yet.",
7
8
  noResults: "No results found",
8
9
  noResultsDescription: "Try adjusting the search or the filters.",
9
10
  selectAll: "Select all",
@@ -210,7 +210,7 @@ var queue = {
210
210
  produtoId: "Product ID",
211
211
  tipo: "Query type",
212
212
  smsId: "Scheduled SMS ID",
213
- dataHora: "Specific date/time to process (ISO format). If not informed, processes the previous hour."
213
+ dataHora: "Specific date/time to process (ISO format). If omitted, processes the previous hour."
214
214
  }
215
215
  },
216
216
  jobConfigDialog: {
@@ -51,6 +51,7 @@ export declare const es: {
51
51
  empty: string;
52
52
  emptyDescription: string;
53
53
  emptyDescriptionNewItem: string;
54
+ emptyDescriptionNoCreate: string;
54
55
  noResults: string;
55
56
  noResultsDescription: string;
56
57
  selectAll: string;
@@ -3,6 +3,7 @@ export declare const list: {
3
3
  empty: string;
4
4
  emptyDescription: string;
5
5
  emptyDescriptionNewItem: string;
6
+ emptyDescriptionNoCreate: string;
6
7
  noResults: string;
7
8
  noResultsDescription: string;
8
9
  selectAll: string;
@@ -4,6 +4,7 @@ var list = {
4
4
  empty: "Ning\xFAn elemento encontrado",
5
5
  emptyDescription: "Intente ajustar los filtros o agregue nuevos elementos.",
6
6
  emptyDescriptionNewItem: "Comience agregando un nuevo elemento.",
7
+ emptyDescriptionNoCreate: "Todav\xEDa no hay elementos para mostrar.",
7
8
  noResults: "No se encontraron resultados",
8
9
  noResultsDescription: "Intente ajustar la b\xFAsqueda o los filtros.",
9
10
  selectAll: "Seleccionar todos",
@@ -51,6 +51,7 @@ export declare const ptBR: {
51
51
  readonly empty: "Nenhum item encontrado";
52
52
  readonly emptyDescription: "Tente ajustar os filtros ou adicione novos itens.";
53
53
  readonly emptyDescriptionNewItem: "Comece adicionando um novo item.";
54
+ readonly emptyDescriptionNoCreate: "Ainda não há itens para exibir.";
54
55
  readonly noResults: "Nenhum resultado encontrado";
55
56
  readonly noResultsDescription: "Tente ajustar a busca ou os filtros.";
56
57
  readonly selectAll: "Selecionar todos";
@@ -767,9 +768,9 @@ export declare const ptBR: {
767
768
  };
768
769
  readonly dispatch: {
769
770
  readonly invalidJson: "JSON inválido";
770
- readonly notDispatchable: "Este job nao pode ser disparado manualmente";
771
- readonly requiredFields: "Campos obrigatorios: {fields}";
772
- readonly dispatched: "Job {name} adicionado a fila";
771
+ readonly notDispatchable: "Este job não pode ser disparado manualmente";
772
+ readonly requiredFields: "Campos obrigatórios: {fields}";
773
+ readonly dispatched: "Job {name} adicionado à fila";
773
774
  readonly dispatchedId: "ID: {id}";
774
775
  readonly dispatchError: "Erro ao disparar job";
775
776
  readonly unknownError: "Erro desconhecido";
@@ -777,16 +778,16 @@ export declare const ptBR: {
777
778
  readonly subtitle: "Disparo manual";
778
779
  readonly close: "Fechar";
779
780
  readonly queueLabel: "Queue: {name}";
780
- readonly notDispatchableInfo: "Este job nao pode ser disparado manualmente. Ele e executado automaticamente pelo sistema (cron, eventos, etc.).";
781
+ readonly notDispatchableInfo: "Este job não pode ser disparado manualmente. Ele é executado automaticamente pelo sistema (cron, eventos, etc.).";
781
782
  readonly inputDataTitle: "Dados de Entrada";
782
- readonly formMode: "Formulario";
783
+ readonly formMode: "Formulário";
783
784
  readonly jsonMode: "JSON";
784
- readonly noInputNeeded: "Este job nao requer dados de entrada. Clique em \"Executar Agora\" para disparar.";
785
+ readonly noInputNeeded: "Este job não requer dados de entrada. Clique em \"Executar Agora\" para disparar.";
785
786
  readonly executeNow: "Executar Agora";
786
787
  readonly defaultFields: {
787
788
  readonly rotaId: "ID da rota a processar";
788
789
  readonly ids: "Array de IDs para processar";
789
- readonly relatorioId: "ID do relatorio";
790
+ readonly relatorioId: "ID do relatório";
790
791
  readonly produtoId: "ID do produto";
791
792
  readonly tipo: "Tipo de consulta";
792
793
  readonly smsId: "ID do SMS agendado";
@@ -3,6 +3,7 @@ export declare const list: {
3
3
  readonly empty: "Nenhum item encontrado";
4
4
  readonly emptyDescription: "Tente ajustar os filtros ou adicione novos itens.";
5
5
  readonly emptyDescriptionNewItem: "Comece adicionando um novo item.";
6
+ readonly emptyDescriptionNoCreate: "Ainda não há itens para exibir.";
6
7
  readonly noResults: "Nenhum resultado encontrado";
7
8
  readonly noResultsDescription: "Tente ajustar a busca ou os filtros.";
8
9
  readonly selectAll: "Selecionar todos";
@@ -4,6 +4,7 @@ var list = {
4
4
  empty: "Nenhum item encontrado",
5
5
  emptyDescription: "Tente ajustar os filtros ou adicione novos itens.",
6
6
  emptyDescriptionNewItem: "Comece adicionando um novo item.",
7
+ emptyDescriptionNoCreate: "Ainda n\xE3o h\xE1 itens para exibir.",
7
8
  noResults: "Nenhum resultado encontrado",
8
9
  noResultsDescription: "Tente ajustar a busca ou os filtros.",
9
10
  selectAll: "Selecionar todos",
@@ -186,9 +186,9 @@ export declare const queue: {
186
186
  };
187
187
  readonly dispatch: {
188
188
  readonly invalidJson: "JSON inválido";
189
- readonly notDispatchable: "Este job nao pode ser disparado manualmente";
190
- readonly requiredFields: "Campos obrigatorios: {fields}";
191
- readonly dispatched: "Job {name} adicionado a fila";
189
+ readonly notDispatchable: "Este job não pode ser disparado manualmente";
190
+ readonly requiredFields: "Campos obrigatórios: {fields}";
191
+ readonly dispatched: "Job {name} adicionado à fila";
192
192
  readonly dispatchedId: "ID: {id}";
193
193
  readonly dispatchError: "Erro ao disparar job";
194
194
  readonly unknownError: "Erro desconhecido";
@@ -196,16 +196,16 @@ export declare const queue: {
196
196
  readonly subtitle: "Disparo manual";
197
197
  readonly close: "Fechar";
198
198
  readonly queueLabel: "Queue: {name}";
199
- readonly notDispatchableInfo: "Este job nao pode ser disparado manualmente. Ele e executado automaticamente pelo sistema (cron, eventos, etc.).";
199
+ readonly notDispatchableInfo: "Este job não pode ser disparado manualmente. Ele é executado automaticamente pelo sistema (cron, eventos, etc.).";
200
200
  readonly inputDataTitle: "Dados de Entrada";
201
- readonly formMode: "Formulario";
201
+ readonly formMode: "Formulário";
202
202
  readonly jsonMode: "JSON";
203
- readonly noInputNeeded: "Este job nao requer dados de entrada. Clique em \"Executar Agora\" para disparar.";
203
+ readonly noInputNeeded: "Este job não requer dados de entrada. Clique em \"Executar Agora\" para disparar.";
204
204
  readonly executeNow: "Executar Agora";
205
205
  readonly defaultFields: {
206
206
  readonly rotaId: "ID da rota a processar";
207
207
  readonly ids: "Array de IDs para processar";
208
- readonly relatorioId: "ID do relatorio";
208
+ readonly relatorioId: "ID do relatório";
209
209
  readonly produtoId: "ID do produto";
210
210
  readonly tipo: "Tipo de consulta";
211
211
  readonly smsId: "ID do SMS agendado";
@@ -187,9 +187,9 @@ var queue = {
187
187
  },
188
188
  dispatch: {
189
189
  invalidJson: "JSON inv\xE1lido",
190
- notDispatchable: "Este job nao pode ser disparado manualmente",
191
- requiredFields: "Campos obrigatorios: {fields}",
192
- dispatched: "Job {name} adicionado a fila",
190
+ notDispatchable: "Este job n\xE3o pode ser disparado manualmente",
191
+ requiredFields: "Campos obrigat\xF3rios: {fields}",
192
+ dispatched: "Job {name} adicionado \xE0 fila",
193
193
  dispatchedId: "ID: {id}",
194
194
  dispatchError: "Erro ao disparar job",
195
195
  unknownError: "Erro desconhecido",
@@ -197,16 +197,16 @@ var queue = {
197
197
  subtitle: "Disparo manual",
198
198
  close: "Fechar",
199
199
  queueLabel: "Queue: {name}",
200
- notDispatchableInfo: "Este job nao pode ser disparado manualmente. Ele e executado automaticamente pelo sistema (cron, eventos, etc.).",
200
+ notDispatchableInfo: "Este job n\xE3o pode ser disparado manualmente. Ele \xE9 executado automaticamente pelo sistema (cron, eventos, etc.).",
201
201
  inputDataTitle: "Dados de Entrada",
202
- formMode: "Formulario",
202
+ formMode: "Formul\xE1rio",
203
203
  jsonMode: "JSON",
204
- noInputNeeded: 'Este job nao requer dados de entrada. Clique em "Executar Agora" para disparar.',
204
+ noInputNeeded: 'Este job n\xE3o requer dados de entrada. Clique em "Executar Agora" para disparar.',
205
205
  executeNow: "Executar Agora",
206
206
  defaultFields: {
207
207
  rotaId: "ID da rota a processar",
208
208
  ids: "Array de IDs para processar",
209
- relatorioId: "ID do relatorio",
209
+ relatorioId: "ID do relat\xF3rio",
210
210
  produtoId: "ID do produto",
211
211
  tipo: "Tipo de consulta",
212
212
  smsId: "ID do SMS agendado",
@@ -53,6 +53,7 @@ export declare function useTelamonjsT(): import("next-intl")._Translator<import(
53
53
  readonly empty: "Nenhum item encontrado";
54
54
  readonly emptyDescription: "Tente ajustar os filtros ou adicione novos itens.";
55
55
  readonly emptyDescriptionNewItem: "Comece adicionando um novo item.";
56
+ readonly emptyDescriptionNoCreate: "Ainda não há itens para exibir.";
56
57
  readonly noResults: "Nenhum resultado encontrado";
57
58
  readonly noResultsDescription: "Tente ajustar a busca ou os filtros.";
58
59
  readonly selectAll: "Selecionar todos";
@@ -769,9 +770,9 @@ export declare function useTelamonjsT(): import("next-intl")._Translator<import(
769
770
  };
770
771
  readonly dispatch: {
771
772
  readonly invalidJson: "JSON inválido";
772
- readonly notDispatchable: "Este job nao pode ser disparado manualmente";
773
- readonly requiredFields: "Campos obrigatorios: {fields}";
774
- readonly dispatched: "Job {name} adicionado a fila";
773
+ readonly notDispatchable: "Este job não pode ser disparado manualmente";
774
+ readonly requiredFields: "Campos obrigatórios: {fields}";
775
+ readonly dispatched: "Job {name} adicionado à fila";
775
776
  readonly dispatchedId: "ID: {id}";
776
777
  readonly dispatchError: "Erro ao disparar job";
777
778
  readonly unknownError: "Erro desconhecido";
@@ -779,16 +780,16 @@ export declare function useTelamonjsT(): import("next-intl")._Translator<import(
779
780
  readonly subtitle: "Disparo manual";
780
781
  readonly close: "Fechar";
781
782
  readonly queueLabel: "Queue: {name}";
782
- readonly notDispatchableInfo: "Este job nao pode ser disparado manualmente. Ele e executado automaticamente pelo sistema (cron, eventos, etc.).";
783
+ readonly notDispatchableInfo: "Este job não pode ser disparado manualmente. Ele é executado automaticamente pelo sistema (cron, eventos, etc.).";
783
784
  readonly inputDataTitle: "Dados de Entrada";
784
- readonly formMode: "Formulario";
785
+ readonly formMode: "Formulário";
785
786
  readonly jsonMode: "JSON";
786
- readonly noInputNeeded: "Este job nao requer dados de entrada. Clique em \"Executar Agora\" para disparar.";
787
+ readonly noInputNeeded: "Este job não requer dados de entrada. Clique em \"Executar Agora\" para disparar.";
787
788
  readonly executeNow: "Executar Agora";
788
789
  readonly defaultFields: {
789
790
  readonly rotaId: "ID da rota a processar";
790
791
  readonly ids: "Array de IDs para processar";
791
- readonly relatorioId: "ID do relatorio";
792
+ readonly relatorioId: "ID do relatório";
792
793
  readonly produtoId: "ID do produto";
793
794
  readonly tipo: "Tipo de consulta";
794
795
  readonly smsId: "ID do SMS agendado";