forlogic-core 1.15.2 → 1.15.4
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/assets/index.d.ts +6 -0
- package/dist/auth/components/ProtectedRoute.d.ts +6 -0
- package/dist/auth/components/UserInfo.d.ts +10 -0
- package/dist/auth/contexts/AuthContext.d.ts +84 -0
- package/dist/auth/pages/CallbackPage.d.ts +1 -0
- package/dist/auth/pages/LoginPage.d.ts +2 -0
- package/dist/auth/services/AuthService.d.ts +40 -0
- package/dist/auth/services/SupabaseTokenService.d.ts +3 -0
- package/dist/auth/services/TokenManager.d.ts +51 -0
- package/dist/auth/services/TokenRegenerationService.d.ts +12 -0
- package/dist/auth/services/TokenService.d.ts +42 -0
- package/dist/auth/utils/AuthUtils.d.ts +4 -0
- package/dist/auth/utils/ErrorInterceptor.d.ts +15 -0
- package/dist/components/ErrorBoundary.d.ts +19 -0
- package/dist/components/layout/AppHeader.d.ts +63 -0
- package/dist/components/layout/AppLayout.d.ts +10 -0
- package/dist/components/layout/AppSidebar.d.ts +10 -0
- package/dist/components/layout/BodyContent.d.ts +60 -0
- package/dist/components/layout/SidebarActionTrigger.d.ts +34 -0
- package/dist/components/layout/SidebarHeader.d.ts +5 -0
- package/dist/components/layout/sidebar-utils.d.ts +12 -0
- package/dist/components/modules/ModuleGrid.d.ts +9 -0
- package/dist/components/modules/ModulesDialog.d.ts +3 -0
- package/dist/components/modules/icons/ModulesCardIcons.d.ts +19 -0
- package/dist/components/modules/index.d.ts +4 -0
- package/dist/components/modules/modulesData.d.ts +6 -0
- package/dist/components/modules/types.d.ts +35 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/action-button.d.ts +43 -0
- package/dist/components/ui/alert-dialog.d.ts +20 -0
- package/dist/components/ui/alert.d.ts +12 -0
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/breadcrumb.d.ts +19 -0
- package/dist/components/ui/button-group.d.ts +9 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/calendar.d.ts +8 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/chart.d.ts +62 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/color-picker.d.ts +8 -0
- package/dist/components/ui/combobox.d.ts +33 -0
- package/dist/components/ui/command.d.ts +23 -0
- package/dist/components/ui/context-menu.d.ts +27 -0
- package/dist/components/ui/data-list.d.ts +86 -0
- package/dist/components/ui/date-picker.d.ts +9 -0
- package/dist/components/ui/dialog.d.ts +36 -0
- package/dist/components/ui/disabled-menu-item.d.ts +25 -0
- package/dist/components/ui/drawer.d.ts +22 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/empty-state.d.ts +79 -0
- package/dist/components/ui/form.d.ts +23 -0
- package/dist/components/ui/grid.d.ts +53 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/icon-picker.d.ts +8 -0
- package/dist/components/ui/input-group.d.ts +97 -0
- package/dist/components/ui/input.d.ts +37 -0
- package/dist/components/ui/label.d.ts +23 -0
- package/dist/components/ui/loading-state.d.ts +52 -0
- package/dist/components/ui/menubar.d.ts +33 -0
- package/dist/components/ui/navigation-menu.d.ts +12 -0
- package/dist/components/ui/onboarding-dialog.d.ts +43 -0
- package/dist/components/ui/page-breadcrumb.d.ts +77 -0
- package/dist/components/ui/pagination.d.ts +28 -0
- package/dist/components/ui/popover.d.ts +49 -0
- package/dist/components/ui/progress.d.ts +22 -0
- package/dist/components/ui/radio-group.d.ts +63 -0
- package/dist/components/ui/resizable.d.ts +23 -0
- package/dist/components/ui/rich-text-editor.d.ts +45 -0
- package/dist/components/ui/scroll-area.d.ts +37 -0
- package/dist/components/ui/select.d.ts +16 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/sheet.d.ts +32 -0
- package/dist/components/ui/sidebar.d.ts +66 -0
- package/dist/components/ui/skeleton-variants.d.ts +16 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/sonner.d.ts +3 -0
- package/dist/components/ui/spinner.d.ts +6 -0
- package/dist/components/ui/split-button.d.ts +70 -0
- package/dist/components/ui/stack.d.ts +12 -0
- package/dist/components/ui/step-selector.d.ts +39 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/tab-page-layout.d.ts +19 -0
- package/dist/components/ui/table-resize-handle.d.ts +15 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/textarea.d.ts +5 -0
- package/dist/components/ui/toggle-group.d.ts +12 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/truncated-cell.d.ts +7 -0
- package/dist/components/ui/typography.d.ts +16 -0
- package/dist/config/index.d.ts +53 -0
- package/dist/contexts/LocaleContext.d.ts +15 -0
- package/dist/contexts/ModalStateContext.d.ts +57 -0
- package/dist/contexts/NavigationContext.d.ts +13 -0
- package/dist/contexts/PageMetadataContext.d.ts +43 -0
- package/dist/crud/components/ActionMenuItems.d.ts +17 -0
- package/dist/crud/components/BaseForm.d.ts +6 -0
- package/dist/crud/components/ContextMenu.d.ts +21 -0
- package/dist/crud/components/CrudActionBar.d.ts +38 -0
- package/dist/crud/components/CrudGrid.d.ts +43 -0
- package/dist/crud/components/CrudPagination.d.ts +12 -0
- package/dist/crud/components/CrudTable.d.ts +41 -0
- package/dist/crud/components/FilterBar.d.ts +136 -0
- package/dist/crud/components/TableFooter.d.ts +14 -0
- package/dist/crud/components/TableRowActions.d.ts +14 -0
- package/dist/crud/createCrudPage.d.ts +99 -0
- package/dist/crud/createSimpleService.d.ts +85 -0
- package/dist/crud/generateCrudConfig.d.ts +73 -0
- package/dist/crud/hooks/useBaseForm.d.ts +8 -0
- package/dist/crud/hooks/useCrud.d.ts +117 -0
- package/dist/crud/primitives/ActionMenu.d.ts +28 -0
- package/dist/crud/primitives/FilterBar.d.ts +24 -0
- package/dist/crud/primitives/Pagination.d.ts +24 -0
- package/dist/crud/primitives/Table.d.ts +26 -0
- package/dist/crud/primitives/index.d.ts +11 -0
- package/dist/crud/primitives/types.d.ts +76 -0
- package/dist/crud/utils/routingHelpers.d.ts +30 -0
- package/dist/exports/crud.d.ts +21 -0
- package/dist/exports/integrations.d.ts +13 -0
- package/dist/exports/ui.d.ts +73 -0
- package/dist/hooks/useActiveModules.d.ts +45 -0
- package/dist/hooks/useColumnResize.d.ts +21 -0
- package/dist/hooks/useDebounce.d.ts +56 -0
- package/dist/hooks/useI18nFormatters.d.ts +40 -0
- package/dist/hooks/usePageTitle.d.ts +4 -0
- package/dist/hooks/usePermissionQuery.d.ts +49 -0
- package/dist/hooks/useRowResize.d.ts +19 -0
- package/dist/hooks/useSidebarResize.d.ts +19 -0
- package/dist/hooks/useWizard.d.ts +40 -0
- package/dist/i18n/DatabaseBackend.d.ts +9 -0
- package/dist/i18n/components/TranslationLoader.d.ts +10 -0
- package/dist/i18n/config.d.ts +2 -0
- package/dist/i18n/constants.d.ts +126 -0
- package/dist/i18n/index.d.ts +21 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/leadership/components/LeaderRow.d.ts +9 -0
- package/dist/leadership/components/LeadershipDialog.d.ts +10 -0
- package/dist/leadership/components/LeadershipForm.d.ts +8 -0
- package/dist/leadership/components/LeadershipPage.d.ts +1 -0
- package/dist/leadership/hooks/useLeadershipApi.d.ts +2 -0
- package/dist/leadership/hooks/useLeadershipMutations.d.ts +30 -0
- package/dist/leadership/index.d.ts +14 -0
- package/dist/leadership/types.d.ts +17 -0
- package/dist/leadership/utils/leadershipUtils.d.ts +8 -0
- package/dist/media/components/ImageEditor.d.ts +22 -0
- package/dist/media/components/ImageRenderer.d.ts +23 -0
- package/dist/media/components/VideoEditor.d.ts +22 -0
- package/dist/media/components/VideoRenderer.d.ts +8 -0
- package/dist/media/hooks/useMediaUpload.d.ts +20 -0
- package/dist/media/index.d.ts +49 -0
- package/dist/media/types.d.ts +66 -0
- package/dist/media/utils/imageHelpers.d.ts +28 -0
- package/dist/media/utils/videoHelpers.d.ts +35 -0
- package/dist/places/components/ManageAccessModal.d.ts +11 -0
- package/dist/places/components/PlaceCard.d.ts +12 -0
- package/dist/places/components/PlacesList.d.ts +12 -0
- package/dist/places/index.d.ts +8 -0
- package/dist/places/services/PlaceService.d.ts +9 -0
- package/dist/places/types.d.ts +10 -0
- package/dist/providers/CoreProviders.d.ts +66 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/qualiex/components/QualiexUserField.d.ts +125 -0
- package/dist/qualiex/hooks/useQualiexUsers.d.ts +51 -0
- package/dist/qualiex/services/qualiexApi.d.ts +21 -0
- package/dist/qualiex/utils/QualiexErrorInterceptor.d.ts +15 -0
- package/dist/qualiex/utils/userPlaceUtils.d.ts +16 -0
- package/dist/services/BaseService.d.ts +51 -0
- package/dist/services/EmailService.d.ts +110 -0
- package/dist/services/ErrorService.d.ts +19 -0
- package/dist/services/QualiexEnrichmentService.d.ts +65 -0
- package/dist/services/QualiexFieldHelpers.d.ts +17 -0
- package/dist/services/TranslationService.d.ts +20 -0
- package/dist/setup.d.ts +14 -0
- package/dist/sign/components/D4SignWidget.d.ts +2 -0
- package/dist/sign/components/DocumentSigner.d.ts +2 -0
- package/dist/sign/components/SignConfigForm.d.ts +2 -0
- package/dist/sign/components/SignWidget.d.ts +21 -0
- package/dist/sign/hooks/useSignConfig.d.ts +6 -0
- package/dist/sign/index.d.ts +7 -0
- package/dist/sign/services/signService.d.ts +23 -0
- package/dist/sign/types.d.ts +53 -0
- package/dist/supabase/SupabaseSingleton.d.ts +3 -0
- package/dist/supabase/client.d.ts +2 -0
- package/dist/supabase/publicClient.d.ts +2 -0
- package/dist/supabase/types.d.ts +377 -0
- package/dist/types/sidebar.d.ts +49 -0
- package/dist/types.d.ts +499 -0
- package/dist/utils/formatters/currencyFormatters.d.ts +1 -0
- package/dist/utils/formatters/dateFormatters.d.ts +52 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/linkHelpers.d.ts +4 -0
- package/package.json +1 -1
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type LoadingState = 'idle' | 'loading' | 'success' | 'error';
|
|
3
|
+
export type ViewMode = 'table';
|
|
4
|
+
export type SortDirection = 'asc' | 'desc';
|
|
5
|
+
export type ActionType = 'create' | 'update' | 'delete' | 'fetch' | 'export';
|
|
6
|
+
/**
|
|
7
|
+
* BaseEntity - Interface mínima para todas as entidades
|
|
8
|
+
* Contém apenas campos essenciais presentes em todas as tabelas
|
|
9
|
+
*/
|
|
10
|
+
export interface BaseEntity {
|
|
11
|
+
id: string;
|
|
12
|
+
alias: string;
|
|
13
|
+
created_at: string;
|
|
14
|
+
updated_at: string;
|
|
15
|
+
is_removed: boolean;
|
|
16
|
+
is_actived: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* BaseEntityPayload - Payload básico para criação de entidades
|
|
20
|
+
* IMPORTANTE: Customize conforme as propriedades da sua entidade específica
|
|
21
|
+
*/
|
|
22
|
+
export interface BaseEntityPayload {
|
|
23
|
+
alias: string;
|
|
24
|
+
}
|
|
25
|
+
export interface QueryParams {
|
|
26
|
+
page?: number;
|
|
27
|
+
limit?: number;
|
|
28
|
+
search?: string;
|
|
29
|
+
sortField?: string;
|
|
30
|
+
sortDirection?: SortDirection;
|
|
31
|
+
}
|
|
32
|
+
export interface PaginatedResponse<T = unknown> {
|
|
33
|
+
data: T[];
|
|
34
|
+
currentPage: number;
|
|
35
|
+
totalPages: number;
|
|
36
|
+
totalItems: number;
|
|
37
|
+
itemsPerPage: number;
|
|
38
|
+
hasNextPage: boolean;
|
|
39
|
+
hasPreviousPage: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface SortState {
|
|
42
|
+
field: string;
|
|
43
|
+
direction: SortDirection;
|
|
44
|
+
}
|
|
45
|
+
export interface CrudManager<T extends BaseEntity> {
|
|
46
|
+
entities: T[];
|
|
47
|
+
pagination: PaginatedResponse<T>;
|
|
48
|
+
isLoading: boolean;
|
|
49
|
+
isDeleting: boolean;
|
|
50
|
+
searchTerm: string;
|
|
51
|
+
sortField: string;
|
|
52
|
+
sortDirection: SortDirection;
|
|
53
|
+
currentPage: number;
|
|
54
|
+
itemsPerPage: number;
|
|
55
|
+
handleSearch: (search: string) => void;
|
|
56
|
+
handleSort: (field: string) => void;
|
|
57
|
+
handlePageChange: (page: number) => void;
|
|
58
|
+
handleItemsPerPageChange: (limit: number) => void;
|
|
59
|
+
clearFilters: () => void;
|
|
60
|
+
deleteEntity: (id: string) => void;
|
|
61
|
+
refetch: () => void;
|
|
62
|
+
selectedIds: string[];
|
|
63
|
+
selectItem: (id: string) => void;
|
|
64
|
+
selectAll: () => void;
|
|
65
|
+
clearSelection: () => void;
|
|
66
|
+
isAllSelected: boolean;
|
|
67
|
+
bulkDelete?: (ids: string[]) => Promise<void>;
|
|
68
|
+
isBulkDeleting?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface CrudEntity extends BaseEntity {
|
|
71
|
+
}
|
|
72
|
+
export interface CrudColumn<T = any> {
|
|
73
|
+
key: keyof T;
|
|
74
|
+
header: string;
|
|
75
|
+
label?: string;
|
|
76
|
+
type?: 'text' | 'number' | 'date' | 'boolean' | 'select' | 'textarea' | 'email' | 'tel';
|
|
77
|
+
required?: boolean;
|
|
78
|
+
sortable?: boolean;
|
|
79
|
+
filterable?: boolean;
|
|
80
|
+
searchable?: boolean;
|
|
81
|
+
options?: Array<{
|
|
82
|
+
label: string;
|
|
83
|
+
value: any;
|
|
84
|
+
}>;
|
|
85
|
+
render?: (item: T) => React.ReactNode;
|
|
86
|
+
validation?: (value: any) => string | undefined;
|
|
87
|
+
className?: string;
|
|
88
|
+
/** Minimum width in pixels (only applied in desktop view) */
|
|
89
|
+
minWidth?: number;
|
|
90
|
+
/** Maximum width in pixels for column resize */
|
|
91
|
+
maxWidth?: number;
|
|
92
|
+
/** Flex weight for distributing remaining space (only applied in desktop view) */
|
|
93
|
+
weight?: number;
|
|
94
|
+
/** Fixed width (overrides minWidth and weight) */
|
|
95
|
+
width?: number;
|
|
96
|
+
/** Whether the column can be resized (default: true when enableColumnResize is enabled) */
|
|
97
|
+
resizable?: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Filtro customizado para páginas CRUD
|
|
101
|
+
*
|
|
102
|
+
* Permite adicionar filtros personalizados (busca, selects, checkboxes, etc)
|
|
103
|
+
* nas páginas CRUD geradas automaticamente.
|
|
104
|
+
*
|
|
105
|
+
* **Tipos de filtro:**
|
|
106
|
+
* - `'search'`: Campo de busca padrão (integrado com `manager.searchTerm`)
|
|
107
|
+
* - `'select'`: Select nativo com opções predefinidas
|
|
108
|
+
* - `'custom'`: Componente React customizado (Select, Checkbox, etc)
|
|
109
|
+
*
|
|
110
|
+
* **Posicionamento:**
|
|
111
|
+
* - Desktop: Filtros aparecem inline na Action Bar (ao lado do botão "Novo")
|
|
112
|
+
* - Mobile: Filtros empilhados verticalmente abaixo do botão "Novo"
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* // Filtro de busca padrão
|
|
117
|
+
* const filters: CrudFilter[] = [
|
|
118
|
+
* { type: 'search' }
|
|
119
|
+
* ];
|
|
120
|
+
*
|
|
121
|
+
* // Filtro select nativo
|
|
122
|
+
* const filters: CrudFilter[] = [
|
|
123
|
+
* {
|
|
124
|
+
* type: 'select',
|
|
125
|
+
* placeholder: 'Filtrar por status',
|
|
126
|
+
* options: [
|
|
127
|
+
* { label: 'Todos', value: 'all' },
|
|
128
|
+
* { label: 'Ativos', value: 'active' },
|
|
129
|
+
* { label: 'Inativos', value: 'inactive' }
|
|
130
|
+
* ],
|
|
131
|
+
* value: statusFilter,
|
|
132
|
+
* onChange: setStatusFilter
|
|
133
|
+
* }
|
|
134
|
+
* ];
|
|
135
|
+
*
|
|
136
|
+
* // Filtro customizado com Select
|
|
137
|
+
* import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from 'forlogic-core';
|
|
138
|
+
*
|
|
139
|
+
* const filters: CrudFilter[] = [
|
|
140
|
+
* {
|
|
141
|
+
* type: 'custom',
|
|
142
|
+
* component: ({ value, onChange }) => (
|
|
143
|
+
* <Select value={value} onValueChange={onChange}>
|
|
144
|
+
* <SelectTrigger className="w-[180px]">
|
|
145
|
+
* <SelectValue placeholder="Status" />
|
|
146
|
+
* </SelectTrigger>
|
|
147
|
+
* <SelectContent>
|
|
148
|
+
* <SelectItem value="all">Todos</SelectItem>
|
|
149
|
+
* <SelectItem value="active">Ativos</SelectItem>
|
|
150
|
+
* <SelectItem value="inactive">Inativos</SelectItem>
|
|
151
|
+
* </SelectContent>
|
|
152
|
+
* </Select>
|
|
153
|
+
* ),
|
|
154
|
+
* props: { value: statusFilter, onChange: setStatusFilter }
|
|
155
|
+
* }
|
|
156
|
+
* ];
|
|
157
|
+
* ```
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* // Múltiplos filtros customizados
|
|
162
|
+
* function ProcessesPage() {
|
|
163
|
+
* const [statusFilter, setStatusFilter] = useState('all');
|
|
164
|
+
* const [typeFilter, setTypeFilter] = useState('all');
|
|
165
|
+
*
|
|
166
|
+
* const filters: CrudFilter[] = [
|
|
167
|
+
* { type: 'search' },
|
|
168
|
+
* {
|
|
169
|
+
* type: 'select',
|
|
170
|
+
* placeholder: 'Status',
|
|
171
|
+
* options: [
|
|
172
|
+
* { label: 'Todos', value: 'all' },
|
|
173
|
+
* { label: 'Ativos', value: 'active' },
|
|
174
|
+
* { label: 'Inativos', value: 'inactive' }
|
|
175
|
+
* ],
|
|
176
|
+
* value: statusFilter,
|
|
177
|
+
* onChange: setStatusFilter
|
|
178
|
+
* },
|
|
179
|
+
* {
|
|
180
|
+
* type: 'custom',
|
|
181
|
+
* component: TypeSelect,
|
|
182
|
+
* props: { value: typeFilter, onChange: setTypeFilter }
|
|
183
|
+
* }
|
|
184
|
+
* ];
|
|
185
|
+
*
|
|
186
|
+
* // Filtrar dados baseado nos filtros customizados
|
|
187
|
+
* const filteredData = useMemo(() => {
|
|
188
|
+
* let data = manager.entities;
|
|
189
|
+
* if (statusFilter !== 'all') {
|
|
190
|
+
* data = data.filter(item => item.status === statusFilter);
|
|
191
|
+
* }
|
|
192
|
+
* if (typeFilter !== 'all') {
|
|
193
|
+
* data = data.filter(item => item.type === typeFilter);
|
|
194
|
+
* }
|
|
195
|
+
* return data;
|
|
196
|
+
* }, [manager.entities, statusFilter, typeFilter]);
|
|
197
|
+
*
|
|
198
|
+
* return <CrudPage manager={{ ...manager, entities: filteredData }} />;
|
|
199
|
+
* }
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @see {@link FilterBar} - Componente que renderiza os filtros
|
|
203
|
+
*/
|
|
204
|
+
export interface CrudFilter {
|
|
205
|
+
/** Tipo do filtro: 'search' para busca padrão, 'select' para select nativo, 'custom' para componente personalizado */
|
|
206
|
+
type: 'search' | 'select' | 'custom';
|
|
207
|
+
/** Placeholder para select (quando type='select') */
|
|
208
|
+
placeholder?: string;
|
|
209
|
+
/** Opções para select (quando type='select') */
|
|
210
|
+
options?: Array<{
|
|
211
|
+
label: string;
|
|
212
|
+
value: string;
|
|
213
|
+
}>;
|
|
214
|
+
/** Valor atual do filtro (quando type='select') */
|
|
215
|
+
value?: string;
|
|
216
|
+
/** Callback quando o valor muda (quando type='select') */
|
|
217
|
+
onChange?: (value: string) => void;
|
|
218
|
+
/** Componente React customizado (obrigatório quando type='custom') */
|
|
219
|
+
component?: React.ComponentType<any>;
|
|
220
|
+
/** Props passadas para o componente customizado (value, onChange, etc) */
|
|
221
|
+
props?: Record<string, any>;
|
|
222
|
+
/** Função para controlar visibilidade do filtro baseado no estado do manager */
|
|
223
|
+
show?: (manager: CrudManager<any>) => boolean;
|
|
224
|
+
}
|
|
225
|
+
export interface BulkAction<T extends BaseEntity> {
|
|
226
|
+
label: string;
|
|
227
|
+
icon?: React.ComponentType<{
|
|
228
|
+
size?: number;
|
|
229
|
+
className?: string;
|
|
230
|
+
}>;
|
|
231
|
+
variant?: 'default' | 'destructive' | 'outline';
|
|
232
|
+
action: (items: T[]) => void | Promise<void>;
|
|
233
|
+
confirmMessage?: string;
|
|
234
|
+
/** Se a ação está desabilitada */
|
|
235
|
+
disabled?: boolean;
|
|
236
|
+
/** Motivo do bloqueio (exibido em tooltip quando disabled=true) */
|
|
237
|
+
disabledReason?: string;
|
|
238
|
+
}
|
|
239
|
+
export interface CrudPageConfig<T extends CrudEntity> {
|
|
240
|
+
entityName: string;
|
|
241
|
+
entityNamePlural: string;
|
|
242
|
+
filters?: CrudFilter[];
|
|
243
|
+
columns: CrudColumn<T>[];
|
|
244
|
+
cardFields?: Array<{
|
|
245
|
+
key: keyof T;
|
|
246
|
+
label: string;
|
|
247
|
+
render?: (value: any, item: T) => React.ReactNode;
|
|
248
|
+
}>;
|
|
249
|
+
onNew?: () => void;
|
|
250
|
+
onEdit?: (entity: T) => void;
|
|
251
|
+
useCustomRouting?: boolean;
|
|
252
|
+
/** @deprecated Use showNewButton={false} instead */
|
|
253
|
+
hideNewButton?: boolean;
|
|
254
|
+
/** Exibir botão "Novo" (default: true) */
|
|
255
|
+
showNewButton?: boolean;
|
|
256
|
+
/** Texto customizado para o botão "Novo" */
|
|
257
|
+
newButtonLabel?: string;
|
|
258
|
+
newButtonText?: string;
|
|
259
|
+
title?: string;
|
|
260
|
+
searchPlaceholder?: string;
|
|
261
|
+
/** Exibir busca integrada na Action Bar (default: false - usa busca global) */
|
|
262
|
+
showSearch?: boolean;
|
|
263
|
+
/** Exibir Action Bar (default: true) */
|
|
264
|
+
showActionBar?: boolean;
|
|
265
|
+
enableBulkActions?: boolean;
|
|
266
|
+
bulkActions?: BulkAction<T>[];
|
|
267
|
+
customActions?: Array<{
|
|
268
|
+
label: string;
|
|
269
|
+
icon?: React.ComponentType<{
|
|
270
|
+
size?: number;
|
|
271
|
+
className?: string;
|
|
272
|
+
}>;
|
|
273
|
+
variant?: 'default' | 'destructive' | 'outline' | 'ghost';
|
|
274
|
+
action: () => void;
|
|
275
|
+
/** Se a ação está desabilitada */
|
|
276
|
+
disabled?: boolean;
|
|
277
|
+
/** Motivo do bloqueio (exibido em tooltip quando disabled=true) */
|
|
278
|
+
disabledReason?: string;
|
|
279
|
+
}>;
|
|
280
|
+
customRowActions?: (item: T) => Array<{
|
|
281
|
+
icon: any;
|
|
282
|
+
label: string;
|
|
283
|
+
onClick: () => void;
|
|
284
|
+
}>;
|
|
285
|
+
customListView?: (items: T[], manager?: CrudManager<T>) => React.ReactNode;
|
|
286
|
+
}
|
|
287
|
+
export interface EntityWithId {
|
|
288
|
+
id: string | number;
|
|
289
|
+
}
|
|
290
|
+
export type CreateEntityInput<T extends EntityWithId> = Omit<T, 'id' | 'created_at' | 'updated_at'>;
|
|
291
|
+
export type UpdateEntityInput<T extends EntityWithId> = Partial<CreateEntityInput<T>>;
|
|
292
|
+
export interface CrudOperations<T extends EntityWithId> {
|
|
293
|
+
getAll: () => Promise<T[]>;
|
|
294
|
+
getById: (id: string | number) => Promise<T | null>;
|
|
295
|
+
create: (data: CreateEntityInput<T>) => Promise<T>;
|
|
296
|
+
update: (id: string | number, data: UpdateEntityInput<T>) => Promise<T>;
|
|
297
|
+
delete: (id: string | number) => Promise<void>;
|
|
298
|
+
search?: (query: string) => Promise<T[]>;
|
|
299
|
+
}
|
|
300
|
+
export interface CrudConfig<T extends EntityWithId> {
|
|
301
|
+
title: string;
|
|
302
|
+
columns: CrudColumn<T>[];
|
|
303
|
+
searchPlaceholder?: string;
|
|
304
|
+
itemsPerPage?: number;
|
|
305
|
+
enableCreate?: boolean;
|
|
306
|
+
enableEdit?: boolean;
|
|
307
|
+
enableDelete?: boolean;
|
|
308
|
+
enableSearch?: boolean;
|
|
309
|
+
enableFilters?: boolean;
|
|
310
|
+
customActions?: Array<{
|
|
311
|
+
label: string;
|
|
312
|
+
icon?: React.ComponentType;
|
|
313
|
+
onClick: (item: T) => void;
|
|
314
|
+
variant?: 'default' | 'destructive' | 'outline';
|
|
315
|
+
}>;
|
|
316
|
+
}
|
|
317
|
+
export interface FormField {
|
|
318
|
+
name: string;
|
|
319
|
+
label: string;
|
|
320
|
+
type: 'text' | 'textarea' | 'select' | 'multiselect' | 'date' | 'datetime-local' | 'number' | 'user-select' | 'group' | 'checkbox' | 'switch' | 'email' | 'password' | 'color' | 'color-picker' | 'icon-picker' | 'custom';
|
|
321
|
+
required?: boolean;
|
|
322
|
+
disabled?: boolean;
|
|
323
|
+
options?: {
|
|
324
|
+
label: string;
|
|
325
|
+
value: string | number;
|
|
326
|
+
}[];
|
|
327
|
+
placeholder?: string;
|
|
328
|
+
component?: React.ComponentType<any>;
|
|
329
|
+
componentProps?: Record<string, any>;
|
|
330
|
+
value?: any;
|
|
331
|
+
defaultValue?: any;
|
|
332
|
+
dependsOn?: string;
|
|
333
|
+
computedValue?: (formData: any) => any;
|
|
334
|
+
validation?: {
|
|
335
|
+
custom?: (value: any, formData?: any) => string | undefined;
|
|
336
|
+
} | ((value: any, formData?: any) => string | undefined);
|
|
337
|
+
layout?: 'horizontal' | 'vertical';
|
|
338
|
+
className?: string;
|
|
339
|
+
fields?: FormField[];
|
|
340
|
+
onValueChange?: (value: any) => void;
|
|
341
|
+
step?: number;
|
|
342
|
+
rows?: number;
|
|
343
|
+
mode?: 'single' | 'multiple';
|
|
344
|
+
columns?: number;
|
|
345
|
+
render?: (props: {
|
|
346
|
+
value: any;
|
|
347
|
+
onChange: (value: any) => void;
|
|
348
|
+
error?: string;
|
|
349
|
+
disabled?: boolean;
|
|
350
|
+
}) => React.ReactNode;
|
|
351
|
+
}
|
|
352
|
+
export interface FormSection {
|
|
353
|
+
id: string;
|
|
354
|
+
title: string;
|
|
355
|
+
label?: string;
|
|
356
|
+
fields: FormField[];
|
|
357
|
+
component?: React.ComponentType<any>;
|
|
358
|
+
disabled?: boolean;
|
|
359
|
+
condition?: (formData: any) => boolean;
|
|
360
|
+
}
|
|
361
|
+
export interface BaseFormConfig<T> {
|
|
362
|
+
title: string;
|
|
363
|
+
sections: FormSection[];
|
|
364
|
+
initialData?: Partial<T>;
|
|
365
|
+
onSubmit: (data: T) => void;
|
|
366
|
+
onCancel: () => void;
|
|
367
|
+
submitButtonText?: string;
|
|
368
|
+
isMobile?: boolean;
|
|
369
|
+
}
|
|
370
|
+
export interface BaseFormProps<T> extends BaseFormConfig<T> {
|
|
371
|
+
open: boolean;
|
|
372
|
+
}
|
|
373
|
+
export interface GenericQueryConfig<TData, TParams> {
|
|
374
|
+
queryKey: string[];
|
|
375
|
+
queryFn: (params: TParams) => Promise<TData>;
|
|
376
|
+
params: TParams;
|
|
377
|
+
hookName: string;
|
|
378
|
+
enabled?: boolean;
|
|
379
|
+
defaultPagination?: {
|
|
380
|
+
currentPage: number;
|
|
381
|
+
totalPages: number;
|
|
382
|
+
totalItems: number;
|
|
383
|
+
itemsPerPage: number;
|
|
384
|
+
hasNextPage: boolean;
|
|
385
|
+
hasPreviousPage: boolean;
|
|
386
|
+
};
|
|
387
|
+
dataMapper?: (data: TData) => unknown;
|
|
388
|
+
dataExtractor?: (response: TData) => unknown;
|
|
389
|
+
paginationExtractor?: (response: TData) => unknown;
|
|
390
|
+
}
|
|
391
|
+
export interface GenericDataQueryResult<TItem> {
|
|
392
|
+
data: TItem[];
|
|
393
|
+
pagination: unknown;
|
|
394
|
+
isLoading: boolean;
|
|
395
|
+
error: unknown;
|
|
396
|
+
refetch: () => void;
|
|
397
|
+
}
|
|
398
|
+
export interface AuthTokens {
|
|
399
|
+
accessToken: string;
|
|
400
|
+
idToken: string;
|
|
401
|
+
supabaseToken?: string;
|
|
402
|
+
}
|
|
403
|
+
export interface UserInfo {
|
|
404
|
+
id: string;
|
|
405
|
+
email: string;
|
|
406
|
+
name: string;
|
|
407
|
+
identifier: string;
|
|
408
|
+
alias?: string;
|
|
409
|
+
}
|
|
410
|
+
export interface Company {
|
|
411
|
+
id: string;
|
|
412
|
+
alias: string;
|
|
413
|
+
name: string;
|
|
414
|
+
}
|
|
415
|
+
export interface SelectedUnit {
|
|
416
|
+
id: string;
|
|
417
|
+
name: string;
|
|
418
|
+
alias: string;
|
|
419
|
+
}
|
|
420
|
+
export interface CompanyTokenData {
|
|
421
|
+
id: string;
|
|
422
|
+
alias: string;
|
|
423
|
+
name: string;
|
|
424
|
+
payload: any;
|
|
425
|
+
}
|
|
426
|
+
export interface AuthState {
|
|
427
|
+
isAuthenticated: boolean;
|
|
428
|
+
isLoading: boolean;
|
|
429
|
+
user: UserInfo | null;
|
|
430
|
+
alias: string | null;
|
|
431
|
+
companies: Company[];
|
|
432
|
+
selectedUnit: SelectedUnit | null;
|
|
433
|
+
userId: string | null;
|
|
434
|
+
userAlias: string | null;
|
|
435
|
+
placeId: string | null;
|
|
436
|
+
placeName: string | null;
|
|
437
|
+
activePlaceId?: string | null;
|
|
438
|
+
activePlaceName?: string | null;
|
|
439
|
+
}
|
|
440
|
+
export interface IdTokenPayload {
|
|
441
|
+
subNewId: string;
|
|
442
|
+
email: string;
|
|
443
|
+
name: string;
|
|
444
|
+
identifier: string;
|
|
445
|
+
default?: string;
|
|
446
|
+
[key: string]: any;
|
|
447
|
+
}
|
|
448
|
+
export interface AccessTokenPayload {
|
|
449
|
+
default?: string;
|
|
450
|
+
[key: string]: any;
|
|
451
|
+
}
|
|
452
|
+
export interface QualiexUser {
|
|
453
|
+
id?: string;
|
|
454
|
+
userId?: string;
|
|
455
|
+
userName?: string;
|
|
456
|
+
userEmail?: string;
|
|
457
|
+
displayName?: string;
|
|
458
|
+
placeId?: string | null;
|
|
459
|
+
placeName?: string | null;
|
|
460
|
+
roleId?: string;
|
|
461
|
+
roleName?: string;
|
|
462
|
+
companyId?: string;
|
|
463
|
+
companyName?: string;
|
|
464
|
+
}
|
|
465
|
+
export interface QualiexUserFieldMapping {
|
|
466
|
+
/** Nome do campo de ID de usuário na entidade (ex: "target_user_id") */
|
|
467
|
+
idField: string;
|
|
468
|
+
/** Nome do campo de saída para o nome (ex: "target_user_name"). Default: idField + "_name" */
|
|
469
|
+
nameField?: string;
|
|
470
|
+
/** Nome do campo de saída para o email (ex: "target_user_email"). Default: idField + "_email" */
|
|
471
|
+
emailField?: string;
|
|
472
|
+
/** Nome do campo de saída para o username (ex: "target_user_username"). Default: idField + "_username" */
|
|
473
|
+
usernameField?: string;
|
|
474
|
+
}
|
|
475
|
+
export interface QualiexEnrichmentConfig {
|
|
476
|
+
/** Sufixo padrão para campos de nome (default: "_name") */
|
|
477
|
+
userNameFieldSuffix?: string;
|
|
478
|
+
/** Sufixo padrão para campos de email (default: "_email") */
|
|
479
|
+
userEmailFieldSuffix?: string;
|
|
480
|
+
/** Sufixo padrão para campos de username (default: "_username") */
|
|
481
|
+
userUsernameFieldSuffix?: string;
|
|
482
|
+
}
|
|
483
|
+
export interface ApiResponse<T = unknown> {
|
|
484
|
+
data: T;
|
|
485
|
+
success: boolean;
|
|
486
|
+
message?: string;
|
|
487
|
+
error?: string;
|
|
488
|
+
}
|
|
489
|
+
export interface ValidationResult {
|
|
490
|
+
isValid: boolean;
|
|
491
|
+
errors: string[];
|
|
492
|
+
warnings?: string[];
|
|
493
|
+
}
|
|
494
|
+
export interface NotificationConfig {
|
|
495
|
+
title: string;
|
|
496
|
+
description?: string;
|
|
497
|
+
type: 'success' | 'error' | 'warning' | 'info';
|
|
498
|
+
duration?: number;
|
|
499
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatCurrency: (value: number | undefined | null, currency?: string, locale?: string) => string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formata uma string ISO 8601 para o formato de data/hora especificado,
|
|
3
|
+
* convertendo para o timezone do usuário
|
|
4
|
+
*
|
|
5
|
+
* @param dateString - String de data no formato ISO 8601 (ex: "2024-03-15T14:30:00Z")
|
|
6
|
+
* @param datetimeFormat - Máscara de formato date-fns (ex: "dd/MM/yyyy HH:mm")
|
|
7
|
+
* @param timezone - Identificador IANA do fuso horário (ex: "America/Sao_Paulo")
|
|
8
|
+
* @param locale - Código do locale para formatação de nomes de mês/dia
|
|
9
|
+
* @returns String formatada no timezone especificado ou mensagem de erro
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* // Data UTC sendo exibida em Brasília (UTC-3)
|
|
14
|
+
* formatDatetime("2024-03-15T17:30:00Z", "dd/MM/yyyy HH:mm", "America/Sao_Paulo");
|
|
15
|
+
* // "15/03/2024 14:30"
|
|
16
|
+
*
|
|
17
|
+
* // Mesma data em Tokyo (UTC+9)
|
|
18
|
+
* formatDatetime("2024-03-15T17:30:00Z", "dd/MM/yyyy HH:mm", "Asia/Tokyo");
|
|
19
|
+
* // "16/03/2024 02:30"
|
|
20
|
+
*
|
|
21
|
+
* // Com formato americano
|
|
22
|
+
* formatDatetime("2024-03-15T17:30:00Z", "MM/dd/yyyy hh:mm a", "America/New_York", "en-US");
|
|
23
|
+
* // "03/15/2024 01:30 PM"
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const formatDatetime: (dateString: string, datetimeFormat?: string, timezone?: string, locale?: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Formata uma string ISO 8601 para formato de data localizado (sem hora),
|
|
29
|
+
* convertendo para o timezone do usuário
|
|
30
|
+
*
|
|
31
|
+
* Usa o formato 'PP' do date-fns que se adapta automaticamente ao locale:
|
|
32
|
+
* - pt-BR: "15 de mar. de 2024"
|
|
33
|
+
* - en-US: "Mar 15, 2024"
|
|
34
|
+
* - es-ES: "15 mar 2024"
|
|
35
|
+
*
|
|
36
|
+
* @param dateString - String de data no formato ISO 8601
|
|
37
|
+
* @param locale - Código do locale para formatação
|
|
38
|
+
* @param timezone - Identificador IANA do fuso horário (para determinar a data correta)
|
|
39
|
+
* @returns String formatada ou mensagem de erro
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* // Data UTC às 23:00 em Brasília ainda é dia 15
|
|
44
|
+
* formatDate("2024-03-15T23:00:00Z", "pt-BR", "America/Sao_Paulo");
|
|
45
|
+
* // "15 de mar. de 2024"
|
|
46
|
+
*
|
|
47
|
+
* // Mas em Tokyo (UTC+9) já é dia 16
|
|
48
|
+
* formatDate("2024-03-15T23:00:00Z", "en-US", "Asia/Tokyo");
|
|
49
|
+
* // "Mar 16, 2024"
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const formatDate: (dateString: string, locale?: string, timezone?: string) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ClassValue } from "clsx";
|
|
2
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
+
export declare const trimTextFields: (data: any) => any;
|
|
4
|
+
export declare const formatDatetime: (dateString: string) => string;
|
|
5
|
+
export declare const formatCurrency: (value: number | undefined | null) => string;
|
|
6
|
+
export declare const debounce: <T extends (...args: any[]) => any>(func: T, wait: number) => ((...args: Parameters<T>) => void);
|
|
7
|
+
export declare const slugify: (text: string) => string;
|
|
8
|
+
export { handleExternalLink } from './linkHelpers';
|