forlogic-core 2.1.4 → 2.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.
- package/.note/memory/features/import/attachment-idempotency-registry.md +8 -8
- package/.note/memory/features/import/attachment-strategy.md +30 -30
- package/.note/memory/patterns/admin-i18n-policy.md +20 -20
- package/.note/memory/patterns/alias-url-resolution.md +69 -69
- package/.note/memory/patterns/doc-sync-rule.md +35 -35
- package/.note/memory/patterns/documentation-standard.md +17 -17
- package/.note/memory/patterns/dynamic-supabase-config.md +4 -4
- package/.note/memory/patterns/environment-detection-logic.md +35 -35
- package/.note/memory/patterns/i18n-architecture.md +3 -3
- package/README.md +120 -68
- package/dist/action-plans/components/ActionPlanAttachmentsTab.d.ts +3 -0
- package/dist/action-plans/components/ActionPlanCommentsTab.d.ts +3 -0
- package/dist/action-plans/components/ActionPlanCostTab.d.ts +5 -0
- package/dist/action-plans/components/ActionPlanGeneralTab.d.ts +3 -0
- package/dist/action-plans/components/ActionPlanHistoryTab.d.ts +3 -0
- package/dist/action-plans/components/ActionPlanPredecessorsTab.d.ts +5 -0
- package/dist/action-plans/components/ActionPlanProgressDialog.d.ts +3 -0
- package/dist/action-plans/components/ActionPlanProgressTab.d.ts +5 -0
- package/dist/action-plans/components/ActionPlanStatusBadge.d.ts +9 -2
- package/dist/action-plans/constants.d.ts +24 -0
- package/dist/action-plans/hooks/useActionPlan.d.ts +5 -0
- package/dist/action-plans/hooks/useActionPlanProgress.d.ts +5 -0
- package/dist/action-plans/types.d.ts +60 -0
- package/dist/action-plans/utils/formatTime.d.ts +9 -0
- package/dist/audit-trail/components/AuditTrailDetails.d.ts +10 -0
- package/dist/audit-trail/components/AuditTrailFilter.d.ts +10 -0
- package/dist/audit-trail/components/AuditTrailPage.d.ts +10 -0
- package/dist/audit-trail/types.d.ts +58 -0
- package/dist/audit-trail/utils.d.ts +18 -2
- package/dist/auth/components/EditProfileDialog.d.ts +1 -0
- package/dist/auth/components/ProtectedRoute.d.ts +5 -0
- package/dist/auth/contexts/AuthContext.d.ts +5 -0
- package/dist/auth/pages/CallbackPage.d.ts +5 -0
- package/dist/auth/services/AuthService.d.ts +5 -0
- package/dist/auth/services/TokenManager.d.ts +5 -0
- package/dist/auth/services/TokenService.d.ts +10 -0
- package/dist/auth/utils/ErrorInterceptor.d.ts +5 -0
- package/dist/components/dashboards/dashboard-form.d.ts +15 -0
- package/dist/components/dashboards/dashboard-general-view.d.ts +15 -0
- package/dist/components/dashboards/dashboard-grid.d.ts +25 -0
- package/dist/components/dashboards/dashboard-list.d.ts +10 -0
- package/dist/components/dashboards/dashboard-panel-renderer.d.ts +10 -0
- package/dist/components/dashboards/dashboard-view.d.ts +10 -0
- package/dist/components/dashboards/helpers.d.ts +44 -5
- package/dist/components/dashboards/panels/burndown-panel.d.ts +15 -0
- package/dist/components/dashboards/panels/cartesian-panel.d.ts +20 -0
- package/dist/components/dashboards/panels/list-panel.d.ts +15 -0
- package/dist/components/dashboards/panels/matrix-risk-panel.d.ts +25 -0
- package/dist/components/dashboards/panels/numeric-panel.d.ts +10 -0
- package/dist/components/dashboards/panels/panel-error.d.ts +10 -0
- package/dist/components/dashboards/panels/panel-header.d.ts +10 -0
- package/dist/components/dashboards/panels/panel-loader.d.ts +10 -0
- package/dist/components/dashboards/panels/panel-no-data.d.ts +10 -0
- package/dist/components/dashboards/panels/panel-unavailable.d.ts +10 -0
- package/dist/components/dashboards/panels/pareto-panel.d.ts +10 -0
- package/dist/components/dashboards/panels/performance-panel.d.ts +15 -0
- package/dist/components/dashboards/panels/pie-panel.d.ts +10 -0
- package/dist/components/dashboards/panels/text-panel.d.ts +10 -0
- package/dist/components/dashboards/types.d.ts +230 -0
- package/dist/components/modules/AccessDeniedDialog.d.ts +3 -1
- package/dist/components/modules/ModuleAccessGuard.d.ts +3 -1
- package/dist/components/modules/ModulesContent.d.ts +3 -1
- package/dist/components/modules/ModulesDialog.d.ts +1 -1
- package/dist/components/modules/ModulesFooterCards.d.ts +3 -1
- package/dist/components/modules/types.d.ts +2 -0
- package/dist/components/ui/accordion.d.ts +35 -0
- package/dist/components/ui/action-button.d.ts +5 -0
- package/dist/components/ui/alert-dialog.d.ts +82 -0
- package/dist/components/ui/alert.d.ts +32 -0
- package/dist/components/ui/avatar.d.ts +30 -0
- package/dist/components/ui/badge.d.ts +32 -0
- package/dist/components/ui/breadcrumb.d.ts +54 -0
- package/dist/components/ui/button-group.d.ts +15 -0
- package/dist/components/ui/button.d.ts +55 -0
- package/dist/components/ui/calendar.d.ts +16 -0
- package/dist/components/ui/card.d.ts +49 -0
- package/dist/components/ui/chart.d.ts +35 -0
- package/dist/components/ui/checkbox.d.ts +11 -0
- package/dist/components/ui/collapsible.d.ts +15 -0
- package/dist/components/ui/color-picker.d.ts +5 -0
- package/dist/components/ui/combo-tree.d.ts +23 -0
- package/dist/components/ui/combobox.d.ts +28 -0
- package/dist/components/ui/command.d.ts +66 -0
- package/dist/components/ui/context-menu.d.ts +95 -0
- package/dist/components/ui/date-picker.d.ts +10 -0
- package/dist/components/ui/dialog-wizard.d.ts +22 -4
- package/dist/components/ui/dialog.d.ts +181 -0
- package/dist/components/ui/drawer.d.ts +72 -0
- package/dist/components/ui/dropdown-menu.d.ts +153 -0
- package/dist/components/ui/electronic-signature-dialog.d.ts +10 -0
- package/dist/components/ui/export-dialog.d.ts +20 -0
- package/dist/components/ui/form.d.ts +96 -0
- package/dist/components/ui/hover-card.d.ts +15 -0
- package/dist/components/ui/icon-picker.d.ts +5 -0
- package/dist/components/ui/iframe-dialog.d.ts +10 -0
- package/dist/components/ui/input-group.d.ts +16 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/menubar.d.ts +80 -0
- package/dist/components/ui/multiselect-permissions.d.ts +25 -0
- package/dist/components/ui/navigation-menu.d.ts +45 -0
- package/dist/components/ui/onboarding-dialog.d.ts +15 -0
- package/dist/components/ui/online-editor-dialog.d.ts +10 -0
- package/dist/components/ui/pagination.d.ts +53 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/radio-group.d.ts +3 -0
- package/dist/components/ui/report-request-list.d.ts +20 -0
- package/dist/components/ui/resizable.d.ts +15 -0
- package/dist/components/ui/rich-text-editor.d.ts +13 -0
- package/dist/components/ui/scroll-area.d.ts +3 -0
- package/dist/components/ui/select.d.ts +71 -0
- package/dist/components/ui/separator.d.ts +13 -0
- package/dist/components/ui/sheet.d.ts +76 -0
- package/dist/components/ui/sidebar.d.ts +203 -0
- package/dist/components/ui/skeleton-variants.d.ts +25 -0
- package/dist/components/ui/skeleton.d.ts +12 -0
- package/dist/components/ui/slider.d.ts +5 -0
- package/dist/components/ui/sonner.d.ts +5 -0
- package/dist/components/ui/spinner.d.ts +5 -0
- package/dist/components/ui/split-button.d.ts +6 -0
- package/dist/components/ui/stack.d.ts +5 -0
- package/dist/components/ui/status-badge.d.ts +52 -0
- package/dist/components/ui/step-selector.d.ts +5 -0
- package/dist/components/ui/stimulsoft-viewer.d.ts +8 -0
- package/dist/components/ui/switch.d.ts +21 -0
- package/dist/components/ui/tab-page-layout.d.ts +33 -0
- package/dist/components/ui/table-resize-handle.d.ts +10 -3
- package/dist/components/ui/table.d.ts +102 -0
- package/dist/components/ui/tabs.d.ts +59 -0
- package/dist/components/ui/terms-of-use-dialog.d.ts +50 -4
- package/dist/components/ui/textarea.d.ts +27 -0
- package/dist/components/ui/timepicker.d.ts +23 -0
- package/dist/components/ui/toggle-group.d.ts +25 -0
- package/dist/components/ui/toggle.d.ts +21 -0
- package/dist/components/ui/tooltip.d.ts +48 -0
- package/dist/components/ui/truncated-cell.d.ts +13 -0
- package/dist/components/ui/typography.d.ts +119 -0
- package/dist/components/ui/updates-notification.d.ts +33 -0
- package/dist/components/ui/users-groups-selector.d.ts +43 -0
- package/dist/components/ui/viewer-dialog.d.ts +107 -0
- package/dist/crud/components/ActionMenuItems.d.ts +5 -0
- package/dist/crud/components/BaseForm.d.ts +46 -0
- package/dist/crud/components/ColumnSettingsPopover.d.ts +10 -0
- package/dist/crud/components/CrudActionBar.d.ts +20 -0
- package/dist/crud/components/CrudGrid.d.ts +10 -0
- package/dist/crud/components/CrudPagination.d.ts +5 -0
- package/dist/crud/components/CrudTable.d.ts +5 -0
- package/dist/crud/components/TableRowActions.d.ts +5 -0
- package/dist/crud/createCrudPage.d.ts +41 -8
- package/dist/crud/generateCrudConfig.d.ts +13 -8
- package/dist/crud/hooks/useBaseForm.d.ts +39 -0
- package/dist/crud/hooks/useColumnManager.d.ts +25 -0
- package/dist/crud/hooks/useCrud.d.ts +35 -0
- package/dist/crud/primitives/ActionMenu.d.ts +41 -0
- package/dist/crud/primitives/FilterBar.d.ts +45 -0
- package/dist/crud/primitives/Pagination.d.ts +5 -0
- package/dist/crud/primitives/Table.d.ts +6 -1
- package/dist/crud/primitives/TreeTable.d.ts +5 -0
- package/dist/crud/primitives/types.d.ts +63 -0
- package/dist/crud/utils/routingHelpers.d.ts +11 -0
- package/dist/custom-form-fields/components/CustomFormFields.d.ts +3 -0
- package/dist/custom-form-fields/fields/FormDateField.d.ts +3 -0
- package/dist/custom-form-fields/fields/FormMultiSelectionField.d.ts +3 -0
- package/dist/custom-form-fields/fields/FormNumericField.d.ts +3 -0
- package/dist/custom-form-fields/fields/FormQuestionsField.d.ts +3 -0
- package/dist/custom-form-fields/fields/FormSingleSelectionField.d.ts +3 -0
- package/dist/custom-form-fields/fields/FormTextField.d.ts +3 -0
- package/dist/custom-form-fields/fields/FormTimeField.d.ts +3 -0
- package/dist/custom-form-fields/fields/FormUrlField.d.ts +3 -0
- package/dist/custom-form-fields/fields/ReadOnlyTextField.d.ts +3 -0
- package/dist/custom-form-fields/types.d.ts +84 -21
- package/dist/exports/crud.d.ts +5 -0
- package/dist/exports/integrations.d.ts +1 -0
- package/dist/exports/ui.d.ts +1 -0
- package/dist/file-upload/components/SingleFileUpload.d.ts +59 -0
- package/dist/file-upload/types.d.ts +15 -0
- package/dist/file-upload/utils/formatBytes.d.ts +5 -0
- package/dist/file-upload/utils/getFileExtension.d.ts +5 -0
- package/dist/hooks/useColumnResize.d.ts +24 -0
- package/dist/hooks/useRowResize.d.ts +18 -0
- package/dist/hooks/useSidebarResize.d.ts +18 -0
- package/dist/hooks/useUpdatesNotification.d.ts +16 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/clarity/clarityTracking.d.ts +31 -0
- package/dist/integrations/clarity/index.d.ts +3 -0
- package/dist/integrations/clarity/types.d.ts +46 -0
- package/dist/integrations/clarity/useClarity.d.ts +34 -0
- package/dist/integrations/index.d.ts +5 -0
- package/dist/providers/CoreProviders.d.ts +16 -1
- package/dist/qualiex/components/QualiexUserField.d.ts +8 -0
- package/dist/qualiex/hooks/useQualiexUsers.d.ts +16 -26
- package/dist/qualiex/services/qualiexApi.d.ts +38 -2
- package/dist/qualiex/utils/QualiexErrorInterceptor.d.ts +5 -0
- package/dist/supabase/SupabaseSingleton.d.ts +34 -0
- package/dist/types.d.ts +51 -2
- package/dist/utils/color.d.ts +26 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/vite/index.esm.js +4 -1
- package/dist/vite/index.js +4 -1
- package/docs/PUBLISH.md +168 -0
- package/docs/STORAGE_BUCKETS.md +384 -0
- package/docs/WORKSPACE_KNOWLEDGE.md +120 -119
- package/docs/design-system/README.md +1 -1
- package/docs/design-system/buttons-actions.md +130 -130
- package/docs/design-system/charts-dashboards.md +340 -301
- package/docs/design-system/crud.md +174 -114
- package/docs/design-system/data-display.md +108 -103
- package/docs/design-system/dialogs.md +212 -212
- package/docs/design-system/domain.md +317 -317
- package/docs/design-system/examples.md +275 -275
- package/docs/design-system/foundation.md +1 -1
- package/docs/design-system/inputs.md +131 -131
- package/docs/design-system/layout.md +202 -154
- package/docs/design-system/navigation.md +271 -325
- package/docs/design-system/notifications-feedback.md +34 -34
- package/docs/design-system/patterns/README.md +53 -53
- package/docs/design-system/patterns/action-button.md +22 -22
- package/docs/design-system/patterns/alertdialog-deletion.md +46 -46
- package/docs/design-system/patterns/baseform-custom-fields.md +59 -59
- package/docs/design-system/patterns/baseform-usage.md +42 -42
- package/docs/design-system/patterns/body-content-scroll.md +56 -56
- package/docs/design-system/patterns/combo-tree.md +23 -23
- package/docs/design-system/patterns/components-registry.md +17 -17
- package/docs/design-system/patterns/core-providers.md +41 -39
- package/docs/design-system/patterns/crud-bulk-actions.md +12 -12
- package/docs/design-system/patterns/crud-config-props.md +16 -16
- package/docs/design-system/patterns/crud-defaults.md +17 -17
- package/docs/design-system/patterns/crud-toolbar.md +28 -28
- package/docs/design-system/patterns/delete-confirmation.md +40 -40
- package/docs/design-system/patterns/dialog-body-scroll.md +26 -26
- package/docs/design-system/patterns/dialog-structure.md +32 -32
- package/docs/design-system/patterns/dialog-variants.md +41 -41
- package/docs/design-system/patterns/feature-flags.md +24 -20
- package/docs/design-system/patterns/header-metadata.md +57 -57
- package/docs/design-system/patterns/i18n-setup.md +117 -117
- package/docs/design-system/patterns/pagination.md +27 -27
- package/docs/design-system/patterns/single-scroll.md +39 -39
- package/docs/design-system/patterns/vite-tailwind-setup.md +48 -48
- package/docs/design-system/platform.md +18 -18
- package/docs/design-system/selectors.md +240 -236
- package/docs/design-system/tables-grids.md +95 -38
- package/package.json +150 -144
- package/dist/README.md +0 -1079
- package/dist/bin/bootstrap.js +0 -40
- package/dist/bin/pull-docs.js +0 -186
- package/dist/docs/KNOWLEDGE.md +0 -109
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tipos de viewer suportados pelo `ViewerDialog`. Resolvido automaticamente
|
|
3
|
+
* pela extensão do arquivo via `getViewerType`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* if (type === FileViewerType.image) { ... }
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
1
10
|
export declare enum FileViewerType {
|
|
2
11
|
none = 0,
|
|
3
12
|
image = 1,
|
|
@@ -7,17 +16,42 @@ export declare enum FileViewerType {
|
|
|
7
16
|
onlineEditor = 5,
|
|
8
17
|
report = 6
|
|
9
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Modo de impressão para documentos controlados (cópia gerenciada / não gerenciada).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* config.printType = FilePrintType.ManagedCopy;
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
10
27
|
export declare enum FilePrintType {
|
|
11
28
|
SimplePrint = 0,
|
|
12
29
|
ManagedCopy = 1,
|
|
13
30
|
NonManagedCopy = 2
|
|
14
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Descritor de um arquivo a ser visualizado pelo `ViewerDialog`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* const tpl: FileViewerTemplate = { name: 'manual.pdf', extension: '.pdf', url: '/files/123' };
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
15
40
|
export interface FileViewerTemplate {
|
|
16
41
|
code?: string;
|
|
17
42
|
name: string;
|
|
18
43
|
extension?: string;
|
|
19
44
|
url: string;
|
|
20
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Configuração para visualização de documentos controlados (Qualiex).
|
|
48
|
+
* Reúne callbacks para criação de cópia física e marca d'água.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* const cfg: ViewerDocumentControlConfig = { isControlledDocument: true, physicalCopyCode: 'C-001' };
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
21
55
|
export interface ViewerDocumentControlConfig {
|
|
22
56
|
isControlledDocument?: boolean;
|
|
23
57
|
physicalCopyCode?: string | null;
|
|
@@ -32,6 +66,15 @@ export interface ViewerDocumentControlConfig {
|
|
|
32
66
|
isDownload?: boolean;
|
|
33
67
|
}) => Promise<any>;
|
|
34
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Props do `ViewerDialog`. Suporta imagem, vídeo, áudio, PDF/Office (WOPI),
|
|
71
|
+
* editor online (Google Docs) e relatórios (iframe genérico).
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```tsx
|
|
75
|
+
* const props: ViewerDialogProps = { open, onOpenChange, template };
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
35
78
|
export interface ViewerDialogProps {
|
|
36
79
|
open: boolean;
|
|
37
80
|
onOpenChange: (open: boolean) => void;
|
|
@@ -62,9 +105,51 @@ export interface ViewerDialogProps {
|
|
|
62
105
|
/** Custom className for the dialog */
|
|
63
106
|
className?: string;
|
|
64
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Resolve o `FileViewerType` a partir da extensão do arquivo (case-insensitive).
|
|
110
|
+
* Retorna `FileViewerType.none` quando a extensão não é suportada.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```tsx
|
|
114
|
+
* getViewerType('.pdf'); // FileViewerType.wopi
|
|
115
|
+
* getViewerType('.png'); // FileViewerType.image
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
65
118
|
export declare function getViewerType(extension?: string): FileViewerType;
|
|
119
|
+
/**
|
|
120
|
+
* Resolve qual editor online (Google Docs vs Sheets) deve ser usado pela extensão.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```tsx
|
|
124
|
+
* getOnlineViewerType('.gsheets'); // 'spreadsheets'
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
66
127
|
export declare function getOnlineViewerType(extension: string): 'document' | 'spreadsheets';
|
|
128
|
+
/**
|
|
129
|
+
* Resolve a rota WOPI (Office Web Apps) para a extensão informada.
|
|
130
|
+
* Retorna string vazia quando não suportado.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```tsx
|
|
134
|
+
* getWopiViewer('.docx'); // 'wv/wordviewerframe.aspx?'
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
67
137
|
export declare function getWopiViewer(extension: string): string;
|
|
138
|
+
/**
|
|
139
|
+
* Constrói a URL completa do WOPI viewer com query params (`access_token`, `WOPISrc`, `ui`).
|
|
140
|
+
* Retorna `null` se a extensão não tiver viewer WOPI mapeado.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```tsx
|
|
144
|
+
* const url = buildWopiUrl({
|
|
145
|
+
* viewerUrl: 'https://wopi.qualiex.com/',
|
|
146
|
+
* wopiUrl: 'https://api.qualiex.com/wopi/files/',
|
|
147
|
+
* fileId: '42',
|
|
148
|
+
* token: 'abc',
|
|
149
|
+
* extension: '.pdf',
|
|
150
|
+
* });
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
68
153
|
export declare function buildWopiUrl(params: {
|
|
69
154
|
viewerUrl: string;
|
|
70
155
|
wopiUrl: string;
|
|
@@ -73,5 +158,27 @@ export declare function buildWopiUrl(params: {
|
|
|
73
158
|
extension: string;
|
|
74
159
|
language?: string;
|
|
75
160
|
}): string | null;
|
|
161
|
+
/**
|
|
162
|
+
* Dialog full-screen para visualizar arquivos de qualquer tipo. Detecta
|
|
163
|
+
* automaticamente o viewer apropriado pela extensão (`getViewerType`):
|
|
164
|
+
* imagem (`<img>`), vídeo (`<video>`), áudio (`<audio>`), PDF/Office (iframe WOPI),
|
|
165
|
+
* editor online (Google Docs/Sheets) ou relatório (iframe).
|
|
166
|
+
*
|
|
167
|
+
* Recursos do header: botão de download, favoritar e confirmação de leitura
|
|
168
|
+
* (com timer mínimo opcional). Fecha com **ESC** ou clique no X.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```tsx
|
|
172
|
+
* <ViewerDialog
|
|
173
|
+
* open={open}
|
|
174
|
+
* onOpenChange={setOpen}
|
|
175
|
+
* template={{ name: 'Manual.pdf', extension: '.pdf', url: pdfUrl }}
|
|
176
|
+
* enableDownload
|
|
177
|
+
* onDownload={handleDownload}
|
|
178
|
+
* />
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* @see `docs/design-system/dialogs.md`
|
|
182
|
+
*/
|
|
76
183
|
export declare function ViewerDialog({ open, onOpenChange, template, viewerType: viewerTypeProp, isLoading, enableDownload, onDownload, isDownloading, enableFavorite, isFavorite, onFavorite, isFavoriting, enableConfirmReading, readingConfirmationDate, onConfirmReading, isConfirmingReading, readingConfirmationTimeRemaining, onIframeLoad, className, }: ViewerDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
77
184
|
export default ViewerDialog;
|
|
@@ -13,5 +13,10 @@ interface ActionMenuItemsProps {
|
|
|
13
13
|
}>;
|
|
14
14
|
renderAs: 'dropdown' | 'context';
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Componente `ActionMenuItems` da lib.
|
|
18
|
+
* @example
|
|
19
|
+
* <ActionMenuItems />
|
|
20
|
+
*/
|
|
16
21
|
export declare const ActionMenuItems: React.FC<ActionMenuItemsProps>;
|
|
17
22
|
export {};
|
|
@@ -1,4 +1,50 @@
|
|
|
1
1
|
import type { BaseFormProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Formulário modal genérico baseado em configuração declarativa de seções e campos.
|
|
4
|
+
*
|
|
5
|
+
* Renderiza um `Dialog` com navegação por seções (sidebar) quando há 2+ seções, ou um único
|
|
6
|
+
* painel para forms simples. Suporta os tipos: `text`, `number`, `select`, `multiselect`,
|
|
7
|
+
* `textarea`, `switch`, `checkbox`, `color`, `icon`, `qualiex-user` e custom render.
|
|
8
|
+
*
|
|
9
|
+
* Normalmente é renderizado automaticamente por `createCrudPage` — use diretamente apenas
|
|
10
|
+
* para forms standalone (fora do pipeline CRUD).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const sections: FormSection[] = [
|
|
14
|
+
* {
|
|
15
|
+
* id: 'general',
|
|
16
|
+
* title: 'Dados gerais',
|
|
17
|
+
* fields: [
|
|
18
|
+
* { key: 'title', label: 'Título', type: 'text', required: true },
|
|
19
|
+
* { key: 'description', label: 'Descrição', type: 'textarea' },
|
|
20
|
+
* {
|
|
21
|
+
* key: 'status',
|
|
22
|
+
* label: 'Status',
|
|
23
|
+
* type: 'select',
|
|
24
|
+
* options: [
|
|
25
|
+
* { label: 'Ativo', value: 'active' },
|
|
26
|
+
* { label: 'Pausado', value: 'paused' },
|
|
27
|
+
* ],
|
|
28
|
+
* },
|
|
29
|
+
* ],
|
|
30
|
+
* },
|
|
31
|
+
* {
|
|
32
|
+
* id: 'responsible',
|
|
33
|
+
* title: 'Responsável',
|
|
34
|
+
* fields: [{ key: 'id_user', label: 'Usuário', type: 'qualiex-user', required: true }],
|
|
35
|
+
* },
|
|
36
|
+
* ];
|
|
37
|
+
*
|
|
38
|
+
* <BaseForm
|
|
39
|
+
* open={isOpen}
|
|
40
|
+
* title="Novo plano de ação"
|
|
41
|
+
* sections={sections}
|
|
42
|
+
* initialData={editing ?? undefined}
|
|
43
|
+
* isLoading={manager.isCreating || manager.isUpdating}
|
|
44
|
+
* onSubmit={(data) => onSave(data)}
|
|
45
|
+
* onCancel={() => setIsOpen(false)}
|
|
46
|
+
* />
|
|
47
|
+
*/
|
|
2
48
|
declare function BaseForm<T extends Record<string, any>>({ title, sections, initialData, onSubmit, onCancel, open, submitButtonText, isLoading, usersData }: BaseFormProps<T> & {
|
|
3
49
|
usersData?: any[];
|
|
4
50
|
isLoading?: boolean;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { CrudColumn, BaseEntity } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Tipo `ColumnSettingsPopoverProps` exportado pela lib.
|
|
4
|
+
* @example
|
|
5
|
+
* const value: ColumnSettingsPopoverProps = {} as ColumnSettingsPopoverProps;
|
|
6
|
+
*/
|
|
2
7
|
export interface ColumnSettingsPopoverProps<T> {
|
|
3
8
|
columns: CrudColumn<T>[];
|
|
4
9
|
columnOrder: string[];
|
|
@@ -15,4 +20,9 @@ export interface ColumnSettingsPopoverProps<T> {
|
|
|
15
20
|
addGroupByColumn?: (key: string) => void;
|
|
16
21
|
removeGroupByColumn?: (key: string) => void;
|
|
17
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Função utilitária `ColumnSettingsPopover`.
|
|
25
|
+
* @example
|
|
26
|
+
* ColumnSettingsPopover();
|
|
27
|
+
*/
|
|
18
28
|
export declare function ColumnSettingsPopover<T extends BaseEntity>({ columns, columnOrder, isColumnHidden, toggleColumn, showAllColumns, reorderColumns, groupByColumn, setGroupByColumn, groupByColumns, addGroupByColumn, removeGroupByColumn, resetColumns, }: ColumnSettingsPopoverProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { BaseEntity, BulkAction } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Tipo `CustomAction` exportado pela lib.
|
|
5
|
+
* @example
|
|
6
|
+
* const value: CustomAction = {} as CustomAction;
|
|
7
|
+
*/
|
|
3
8
|
export interface CustomAction {
|
|
4
9
|
label: string;
|
|
5
10
|
icon?: React.ComponentType<{
|
|
@@ -11,7 +16,17 @@ export interface CustomAction {
|
|
|
11
16
|
disabled?: boolean;
|
|
12
17
|
disabledReason?: string;
|
|
13
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Tipo `ViewMode` exportado pela lib.
|
|
21
|
+
* @example
|
|
22
|
+
* const value: ViewMode = {} as ViewMode;
|
|
23
|
+
*/
|
|
14
24
|
export type ViewMode = 'table' | 'list' | 'grid';
|
|
25
|
+
/**
|
|
26
|
+
* Tipo `CrudActionBarProps` exportado pela lib.
|
|
27
|
+
* @example
|
|
28
|
+
* const value: CrudActionBarProps = {} as CrudActionBarProps;
|
|
29
|
+
*/
|
|
15
30
|
export interface CrudActionBarProps<T extends BaseEntity = BaseEntity> {
|
|
16
31
|
onNew?: () => void;
|
|
17
32
|
newButtonLabel?: string;
|
|
@@ -35,5 +50,10 @@ export interface CrudActionBarProps<T extends BaseEntity = BaseEntity> {
|
|
|
35
50
|
className?: string;
|
|
36
51
|
}
|
|
37
52
|
declare function CrudActionBarComponent<T extends BaseEntity = BaseEntity>({ onNew, newButtonLabel, showNewButton, showSearch, searchValue, onSearchChange, searchPlaceholder, showBulkActions, selectedCount, bulkActions, onBulkDelete, onClearSelection, customActions, filters, viewMode, onViewModeChange, showViewToggle, availableViewModes, rightSlot, className, }: CrudActionBarProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
/**
|
|
54
|
+
* Componente `CrudActionBar` da lib.
|
|
55
|
+
* @example
|
|
56
|
+
* <CrudActionBar />
|
|
57
|
+
*/
|
|
38
58
|
export declare const CrudActionBar: typeof CrudActionBarComponent;
|
|
39
59
|
export default CrudActionBar;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CrudColumn, CrudManager, BaseEntity, BulkAction } from '../../types';
|
|
3
3
|
import { type CustomAction, type ViewMode } from './CrudActionBar';
|
|
4
|
+
/**
|
|
5
|
+
* Tipo `CrudGridProps` exportado pela lib.
|
|
6
|
+
* @example
|
|
7
|
+
* const value: CrudGridProps = {} as CrudGridProps;
|
|
8
|
+
*/
|
|
4
9
|
export interface CrudGridProps<T extends BaseEntity & {
|
|
5
10
|
is_actived?: boolean;
|
|
6
11
|
}> {
|
|
@@ -39,5 +44,10 @@ export interface CrudGridProps<T extends BaseEntity & {
|
|
|
39
44
|
gridCardRenderer?: (item: T) => React.ReactNode;
|
|
40
45
|
showViewToggle?: boolean;
|
|
41
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Componente `CrudGrid` da lib.
|
|
49
|
+
* @example
|
|
50
|
+
* <CrudGrid />
|
|
51
|
+
*/
|
|
42
52
|
export declare const CrudGrid: <T extends BaseEntity>({ manager, columns, onEdit, onView, onToggleStatus, onDelete, renderActions, customRowActions, enableBulkActions, onNew, newButtonLabel, showNewButton, customActions, hideActionBar, showActionBar, showSearch, searchValue, onSearchChange, searchPlaceholder, bulkActions, onBulkDelete, filters, gridColumns, renderCard, viewMode, onViewModeChange, listCardRenderer, gridCardRenderer, showViewToggle }: CrudGridProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
43
53
|
export default CrudGrid;
|
|
@@ -8,5 +8,10 @@ import type { CrudManager, BaseEntity } from '../../types';
|
|
|
8
8
|
interface CrudPaginationProps<T extends BaseEntity> {
|
|
9
9
|
manager: Pick<CrudManager<T>, 'pagination' | 'handlePageChange' | 'handleItemsPerPageChange'>;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Função utilitária `CrudPagination`.
|
|
13
|
+
* @example
|
|
14
|
+
* CrudPagination();
|
|
15
|
+
*/
|
|
11
16
|
export declare function CrudPagination<T extends BaseEntity>({ manager }: CrudPaginationProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
12
17
|
export { CrudPagination as TableFooter };
|
|
@@ -57,5 +57,10 @@ export interface CrudTableProps<T extends BaseEntity & {
|
|
|
57
57
|
/** Oculta a coluna de ações separada. Útil quando ações são renderizadas dentro de uma coluna customizada. */
|
|
58
58
|
hideActionsColumn?: boolean;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Componente `CrudTable` da lib.
|
|
62
|
+
* @example
|
|
63
|
+
* <CrudTable />
|
|
64
|
+
*/
|
|
60
65
|
export declare const CrudTable: <T extends BaseEntity>({ manager, columns, onEdit, onView, onToggleStatus, onDelete, renderActions, customRowActions, enableBulkActions, rowActionsVariant, onNew, newButtonLabel, showNewButton, customActions, hideActionBar, showActionBar, showSearch, searchValue, onSearchChange, searchPlaceholder, bulkActions, onBulkDelete, filters, viewMode, onViewModeChange, showViewToggle, enableColumnResize, resizeStorageKey, enableColumnManager, columnManagerStorageKey, defaultHiddenColumns, enableGrouping, enableExpandableRows, renderExpandedContent, expandedRowIds: controlledExpandedIds, onToggleExpand: controlledToggleExpand, defaultExpandAll, hideActionsColumn, }: CrudTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
61
66
|
export default CrudTable;
|
|
@@ -57,6 +57,11 @@ interface CrudPageGeneratorConfig<T extends CrudEntity> {
|
|
|
57
57
|
onEdit?: (entity: T) => T | void | Promise<T | void>;
|
|
58
58
|
onToggleStatus?: (item: T) => void;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Função utilitária `CrudPageInternal`.
|
|
62
|
+
* @example
|
|
63
|
+
* CrudPageInternal();
|
|
64
|
+
*/
|
|
60
65
|
declare function CrudPageInternal<T extends CrudEntity>({ manager, config, formSections, onSave, onToggleStatus, defaultSort, }: {
|
|
61
66
|
manager: any;
|
|
62
67
|
config: CrudPageConfig<T>;
|
|
@@ -69,18 +74,46 @@ declare function CrudPageInternal<T extends CrudEntity>({ manager, config, formS
|
|
|
69
74
|
};
|
|
70
75
|
}): import("react/jsx-runtime").JSX.Element;
|
|
71
76
|
/**
|
|
72
|
-
* Gera uma página CRUD completa
|
|
77
|
+
* Gera uma página CRUD completa (toolbar + tabela + paginação + form modal + confirmações).
|
|
73
78
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
79
|
+
* **IMPORTANTE**: a config deve ser memoizada (`useMemo` ou definida fora do componente)
|
|
80
|
+
* para evitar desmontagem e flicker no render — ver
|
|
81
|
+
* `mem://patterns/admin-render-optimization`.
|
|
82
|
+
*
|
|
83
|
+
* @example Pipeline completo
|
|
84
|
+
* ```tsx
|
|
85
|
+
* const employeesService = createSimpleService<Employee>({
|
|
86
|
+
* tableName: 'employees',
|
|
87
|
+
* schema: 'common',
|
|
80
88
|
* });
|
|
89
|
+
*
|
|
90
|
+
* function EmployeesPage() {
|
|
91
|
+
* const manager = useCrudHook(employeesService);
|
|
92
|
+
*
|
|
93
|
+
* const Page = useMemo(() => createCrudPage<Employee>({
|
|
94
|
+
* manager,
|
|
95
|
+
* config: {
|
|
96
|
+
* entityName: 'Funcionário',
|
|
97
|
+
* entityNamePlural: 'Funcionários',
|
|
98
|
+
* columns: [...],
|
|
99
|
+
* formSections: [...],
|
|
100
|
+
* defaultHiddenColumns: ['created_at'], // formato: column.key
|
|
101
|
+
* },
|
|
102
|
+
* onSave: createSimpleSaveHandler(manager, c => c, u => u),
|
|
103
|
+
* }), [manager]);
|
|
104
|
+
*
|
|
105
|
+
* return <Page />;
|
|
106
|
+
* }
|
|
81
107
|
* ```
|
|
82
108
|
*
|
|
83
|
-
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* - `onNew`: handler customizado para o botão "Novo" (abre wizard ao invés do modal padrão).
|
|
111
|
+
* - `useCustomRouting`: desabilita o `BaseForm` interno (use quando o "Novo/Editar" navega para outra rota).
|
|
112
|
+
* - `defaultHiddenColumns`: chaves de coluna escondidas no primeiro acesso (ignorado se houver
|
|
113
|
+
* estado salvo do column manager).
|
|
114
|
+
* - `hideNewButton`: **deprecated** — use `showNewButton={false}`.
|
|
115
|
+
*
|
|
116
|
+
* @see `docs/design-system/crud.md`
|
|
84
117
|
*/
|
|
85
118
|
export declare function createCrudPage<T extends CrudEntity>(generatorConfig: CrudPageGeneratorConfig<T>): React.FC<{
|
|
86
119
|
manager?: any;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { GeneratedCrudConfig, EntityWithId } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Gera automaticamente configuração CRUD a partir de uma interface TypeScript
|
|
3
|
+
* Gera automaticamente configuração CRUD a partir de uma interface TypeScript.
|
|
4
4
|
*
|
|
5
|
-
* **USO AVANÇADO:** Para a maioria dos casos,
|
|
6
|
-
* Esta função é útil para gerar configs
|
|
5
|
+
* **USO AVANÇADO:** Para a maioria dos casos, prefira config manual memoizada com
|
|
6
|
+
* `useMemo` (ver {@link createCrudPage}). Esta função é útil para gerar configs
|
|
7
|
+
* dinamicamente em runtime a partir de uma entidade-amostra.
|
|
7
8
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* A inferência roda em runtime via `Object.keys(sampleEntity)` — campos que não estão
|
|
11
|
+
* presentes em `sampleEntity` (ainda que existam no tipo `T`) **não geram coluna**.
|
|
12
|
+
* Sempre passe um objeto com todas as chaves desejadas, mesmo com valores vazios/zero.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
+
* Heurísticas de tipo:
|
|
15
|
+
* - Nome do campo (ex: "email" → `type: 'email'`, "description" → `type: 'textarea'`).
|
|
16
|
+
* - Tipo do valor (boolean/number/Date).
|
|
17
|
+
*
|
|
18
|
+
* @see {@link createCrudPage} para o fluxo recomendado.
|
|
14
19
|
*
|
|
15
20
|
* @example
|
|
16
21
|
* ```typescript
|
|
@@ -1,4 +1,43 @@
|
|
|
1
1
|
import { FormField } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook que gerencia estado, validação e defaults de um formulário declarativo (FormField[]).
|
|
4
|
+
*
|
|
5
|
+
* É o motor interno do {@link BaseForm} — exporte para reaproveitar o sistema de campos
|
|
6
|
+
* fora do `Dialog` padrão (ex: forms inline, wizards, drawers).
|
|
7
|
+
*
|
|
8
|
+
* Aplica defaults por tipo (`text` → `''`, `switch` → `false`, `multiselect` → `[]`, etc.)
|
|
9
|
+
* e expõe `setField`, `validate` e `reset`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const fields: FormField[] = [
|
|
13
|
+
* { key: 'title', label: 'Título', type: 'text', required: true },
|
|
14
|
+
* { key: 'is_active', label: 'Ativo', type: 'switch', defaultValue: true },
|
|
15
|
+
* ];
|
|
16
|
+
*
|
|
17
|
+
* function MyDrawerForm({ initial, onSave }) {
|
|
18
|
+
* const { formData, errors, setField, validate, reset } = useBaseForm(
|
|
19
|
+
* fields,
|
|
20
|
+
* initial,
|
|
21
|
+
* (data) => console.log('changed', data),
|
|
22
|
+
* true, // open
|
|
23
|
+
* );
|
|
24
|
+
*
|
|
25
|
+
* const handleSubmit = () => {
|
|
26
|
+
* if (validate()) onSave(formData);
|
|
27
|
+
* };
|
|
28
|
+
*
|
|
29
|
+
* return (
|
|
30
|
+
* <>
|
|
31
|
+
* <Input
|
|
32
|
+
* value={formData.title ?? ''}
|
|
33
|
+
* onChange={(e) => setField('title', e.target.value)}
|
|
34
|
+
* error={errors.title}
|
|
35
|
+
* />
|
|
36
|
+
* <Button onClick={handleSubmit}>Salvar</Button>
|
|
37
|
+
* </>
|
|
38
|
+
* );
|
|
39
|
+
* }
|
|
40
|
+
*/
|
|
2
41
|
export declare function useBaseForm<T extends Record<string, any>>(fields: FormField[], initialData?: Partial<T>, onFormDataChange?: (data: T) => void, open?: boolean): {
|
|
3
42
|
formData: T;
|
|
4
43
|
errors: Record<string, string>;
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import type { CrudColumn, BaseEntity } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Tipo `ColumnManagerState` exportado pela lib.
|
|
4
|
+
* @example
|
|
5
|
+
* const value: ColumnManagerState = {} as ColumnManagerState;
|
|
6
|
+
*/
|
|
2
7
|
export interface ColumnManagerState {
|
|
3
8
|
hiddenColumns: Set<string>;
|
|
4
9
|
columnOrder: string[];
|
|
5
10
|
groupByColumns: string[];
|
|
6
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Tipo `UseColumnManagerOptions` exportado pela lib.
|
|
14
|
+
* @example
|
|
15
|
+
* const value: UseColumnManagerOptions = {} as UseColumnManagerOptions;
|
|
16
|
+
*/
|
|
7
17
|
export interface UseColumnManagerOptions<T> {
|
|
8
18
|
columns: CrudColumn<T>[];
|
|
9
19
|
storageKey?: string;
|
|
@@ -11,6 +21,11 @@ export interface UseColumnManagerOptions<T> {
|
|
|
11
21
|
/** Column keys to hide by default (before any user interaction). Only applied when no saved state exists. */
|
|
12
22
|
defaultHiddenColumns?: string[];
|
|
13
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Tipo `UseColumnManagerReturn` exportado pela lib.
|
|
26
|
+
* @example
|
|
27
|
+
* const value: UseColumnManagerReturn = {} as UseColumnManagerReturn;
|
|
28
|
+
*/
|
|
14
29
|
export interface UseColumnManagerReturn<T> {
|
|
15
30
|
/** Columns filtered by visibility and reordered */
|
|
16
31
|
visibleColumns: CrudColumn<T>[];
|
|
@@ -49,6 +64,11 @@ export interface UseColumnManagerReturn<T> {
|
|
|
49
64
|
/** Toggle group collapse */
|
|
50
65
|
toggleGroupCollapse: (groupKey: string) => void;
|
|
51
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Tipo `GroupedData` exportado pela lib.
|
|
69
|
+
* @example
|
|
70
|
+
* const value: GroupedData = {} as GroupedData;
|
|
71
|
+
*/
|
|
52
72
|
export interface GroupedData<T> {
|
|
53
73
|
groupKey: string;
|
|
54
74
|
groupValue: string;
|
|
@@ -57,4 +77,9 @@ export interface GroupedData<T> {
|
|
|
57
77
|
level: number;
|
|
58
78
|
children?: GroupedData<T>[];
|
|
59
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Função utilitária `useColumnManager`.
|
|
82
|
+
* @example
|
|
83
|
+
* useColumnManager();
|
|
84
|
+
*/
|
|
60
85
|
export declare function useColumnManager<T extends BaseEntity>({ columns, storageKey, enabled, defaultHiddenColumns, }: UseColumnManagerOptions<T>): UseColumnManagerReturn<T>;
|
|
@@ -72,6 +72,41 @@ interface CrudConfig<T, TInsert = Partial<T>, TUpdate = Partial<T>> {
|
|
|
72
72
|
additionalFilters?: Record<string, any>;
|
|
73
73
|
onSuccess?: () => void;
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Hook genérico para operações CRUD com React Query (busca, paginação, mutations, bulk).
|
|
77
|
+
*
|
|
78
|
+
* **Uso recomendado**: invoque via `createSimpleService` — ele já configura `queryKey` e `service`.
|
|
79
|
+
* Use diretamente apenas quando precisar de um service customizado (RPC, edge function, etc).
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* // Via createSimpleService (recomendado)
|
|
83
|
+
* const { useCrudHook } = createSimpleService<Employee>({
|
|
84
|
+
* tableName: 'employees',
|
|
85
|
+
* schema: 'central',
|
|
86
|
+
* searchFields: ['name', 'email'],
|
|
87
|
+
* });
|
|
88
|
+
* const manager = useCrudHook();
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* // Uso direto com service customizado
|
|
92
|
+
* const manager = useCrud<Project>({
|
|
93
|
+
* queryKey: 'projects',
|
|
94
|
+
* entityName: 'projeto',
|
|
95
|
+
* service: {
|
|
96
|
+
* getAll: (params) => projectsApi.list(params),
|
|
97
|
+
* create: (data) => projectsApi.create(data),
|
|
98
|
+
* update: (id, data) => projectsApi.update(id, data),
|
|
99
|
+
* delete: (id) => projectsApi.softDelete(id),
|
|
100
|
+
* },
|
|
101
|
+
* additionalFilters: { id_status: 'active' },
|
|
102
|
+
* onSuccess: () => navigate('/projects'),
|
|
103
|
+
* });
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* // Consumindo o manager retornado
|
|
107
|
+
* const { entities, isLoading, createEntity, deleteEntity, pagination, handleSort } = manager;
|
|
108
|
+
* <Button onClick={() => createEntity({ title: 'Novo' })}>Criar</Button>
|
|
109
|
+
*/
|
|
75
110
|
export declare function useCrud<T extends {
|
|
76
111
|
id: string;
|
|
77
112
|
}, TInsert = Partial<T>, TUpdate = Partial<T>>({ queryKey, service, entityName, searchFields, additionalFilters, onSuccess }: CrudConfig<T, TInsert, TUpdate>): {
|
|
@@ -25,4 +25,45 @@
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
import type { ActionMenuProps } from './types';
|
|
28
|
+
/**
|
|
29
|
+
* Menu de ações por linha — renderiza dropdown (`renderAs="dropdown"`) ou botões inline
|
|
30
|
+
* (`renderAs="inline"`). Acoplado às convenções do CRUD (Edit / Delete / Toggle Status)
|
|
31
|
+
* mas extensível via `customActions`.
|
|
32
|
+
*
|
|
33
|
+
* Para tabelas inteiras, prefira a prop `rowActions` do `CrudTable` — só use este primitive
|
|
34
|
+
* quando precisar de um menu fora do contexto de tabela.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* // Dropdown padrão (3 dots) com Edit + Delete
|
|
38
|
+
* <ActionMenu
|
|
39
|
+
* onEdit={() => openEdit(row)}
|
|
40
|
+
* onDelete={() => confirmDelete(row.id)}
|
|
41
|
+
* canDelete={row.id_user === currentUser.id}
|
|
42
|
+
* />
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Inline compacto com ações customizadas + bloqueio condicional
|
|
46
|
+
* <ActionMenu
|
|
47
|
+
* renderAs="inline"
|
|
48
|
+
* variant="compact"
|
|
49
|
+
* onEdit={() => openEdit(row)}
|
|
50
|
+
* customActions={[
|
|
51
|
+
* { label: 'Duplicar', icon: Copy, onClick: () => duplicate(row) },
|
|
52
|
+
* {
|
|
53
|
+
* label: 'Arquivar',
|
|
54
|
+
* icon: Archive,
|
|
55
|
+
* onClick: () => archive(row),
|
|
56
|
+
* disabled: row.status === 'completed',
|
|
57
|
+
* disabledReason: 'Planos concluídos não podem ser arquivados',
|
|
58
|
+
* },
|
|
59
|
+
* ]}
|
|
60
|
+
* />
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Toggle de status (ativar/desativar) com ícone dinâmico
|
|
64
|
+
* <ActionMenu
|
|
65
|
+
* onToggleStatus={() => toggleActive(row.id)}
|
|
66
|
+
* isActive={row.is_actived}
|
|
67
|
+
* />
|
|
68
|
+
*/
|
|
28
69
|
export declare function ActionMenu({ onEdit, onDelete, onToggleStatus, isActive, canEdit, canDelete, customActions, renderAs, variant }: ActionMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -21,4 +21,49 @@
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
import type { FilterBarProps } from './types';
|
|
24
|
+
/**
|
|
25
|
+
* Barra de filtros primitiva: busca textual + slots para filtros customizados (selects,
|
|
26
|
+
* date ranges, etc) + botão "Limpar filtros" automático.
|
|
27
|
+
*
|
|
28
|
+
* Para CRUDs completos, prefira `CrudActionBar` (já integra com o manager). Use este
|
|
29
|
+
* primitive apenas para listas/dashboards fora do pipeline CRUD.
|
|
30
|
+
*
|
|
31
|
+
* Ver `mem://patterns/primitive-search-strategies` para a diferença entre busca local
|
|
32
|
+
* (`DataFilterBar`) e busca global (`AppHeader`).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Busca + 2 filtros customizados horizontais
|
|
36
|
+
* const [search, setSearch] = useState('');
|
|
37
|
+
* const [status, setStatus] = useState('all');
|
|
38
|
+
* const [responsible, setResponsible] = useState<string | null>(null);
|
|
39
|
+
*
|
|
40
|
+
* <FilterBar
|
|
41
|
+
* searchValue={search}
|
|
42
|
+
* onSearchChange={setSearch}
|
|
43
|
+
* customFilters={[
|
|
44
|
+
* <Combobox
|
|
45
|
+
* key="status"
|
|
46
|
+
* options={statusOptions}
|
|
47
|
+
* value={status}
|
|
48
|
+
* onChange={setStatus}
|
|
49
|
+
* placeholder="Status"
|
|
50
|
+
* />,
|
|
51
|
+
* <QualiexUserField
|
|
52
|
+
* key="responsible"
|
|
53
|
+
* value={responsible}
|
|
54
|
+
* onChange={setResponsible}
|
|
55
|
+
* placeholder="Responsável"
|
|
56
|
+
* />,
|
|
57
|
+
* ]}
|
|
58
|
+
* onClearFilters={() => {
|
|
59
|
+
* setSearch('');
|
|
60
|
+
* setStatus('all');
|
|
61
|
+
* setResponsible(null);
|
|
62
|
+
* }}
|
|
63
|
+
* />
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* // Layout vertical (sidebar de filtros)
|
|
67
|
+
* <FilterBar layout="vertical" searchValue={s} onSearchChange={setS} customFilters={[...]} />
|
|
68
|
+
*/
|
|
24
69
|
export declare function FilterBar({ searchValue, onSearchChange, customFilters, onClearFilters, showClearButton, layout }: FilterBarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -21,4 +21,9 @@
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
import type { PaginationProps } from "./types";
|
|
24
|
+
/**
|
|
25
|
+
* Função utilitária `Pagination`.
|
|
26
|
+
* @example
|
|
27
|
+
* Pagination();
|
|
28
|
+
*/
|
|
24
29
|
export declare function Pagination({ currentPage, totalPages, totalItems, itemsPerPage, onPageChange, onItemsPerPageChange, variant, }: PaginationProps): import("react/jsx-runtime").JSX.Element;
|