forlogic-core 2.3.2 → 2.3.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/action-plans/auth/services/AuthService.d.ts +19 -0
- package/dist/action-plans/exports/ui.d.ts +2 -0
- package/dist/action-plans/i18n/LanguageBootstrap.d.ts +14 -0
- package/dist/action-plans/i18n/index.d.ts +1 -0
- package/dist/action-plans/index.d.ts +14 -103
- package/dist/action-plans/index.esm.js +1 -1
- package/dist/action-plans/index.js +1 -1
- package/dist/action-plans/types.d.ts +361 -551
- package/dist/audit-trail/auth/services/AuthService.d.ts +19 -0
- package/dist/audit-trail/exports/ui.d.ts +2 -0
- package/dist/audit-trail/i18n/LanguageBootstrap.d.ts +14 -0
- package/dist/audit-trail/i18n/index.d.ts +1 -0
- package/dist/audit-trail/index.d.ts +8 -103
- package/dist/audit-trail/types.d.ts +173 -567
- package/dist/auth/services/AuthService.d.ts +19 -0
- package/dist/auth/services/TokenService.d.ts +1 -0
- package/dist/auth/utils/authDebug.d.ts +18 -0
- package/dist/components/ui/combobox.d.ts +2 -1
- package/dist/exports/ui.d.ts +2 -0
- package/dist/i18n/LanguageBootstrap.d.ts +14 -0
- package/dist/i18n/index.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/leadership/auth/services/AuthService.d.ts +19 -0
- package/dist/leadership/exports/ui.d.ts +2 -0
- package/dist/leadership/i18n/LanguageBootstrap.d.ts +14 -0
- package/dist/leadership/i18n/index.d.ts +1 -0
- package/dist/leadership/index.d.ts +12 -103
- package/dist/leadership/types.d.ts +13 -593
- package/dist/places/auth/services/AuthService.d.ts +19 -0
- package/dist/places/exports/ui.d.ts +2 -0
- package/dist/places/i18n/LanguageBootstrap.d.ts +14 -0
- package/dist/places/i18n/index.d.ts +1 -0
- package/dist/places/index.d.ts +8 -104
- package/dist/places/types.d.ts +6 -599
- package/dist/qualiex/hooks/useQualiexReady.d.ts +15 -0
- package/dist/qualiex/services/qualiexApiService.d.ts +18 -0
- package/dist/sign/auth/services/AuthService.d.ts +19 -0
- package/dist/sign/exports/ui.d.ts +2 -0
- package/dist/sign/i18n/LanguageBootstrap.d.ts +14 -0
- package/dist/sign/i18n/index.d.ts +1 -0
- package/dist/sign/index.d.ts +8 -104
- package/dist/sign/index.esm.js +1 -1
- package/dist/sign/index.js +1 -1
- package/dist/sign/types.d.ts +46 -596
- package/dist/updates/components/UpdatesBar.d.ts +10 -0
- package/dist/updates/components/UpdatesDialog.d.ts +10 -0
- package/dist/updates/components/UserUpdatesViewer.d.ts +5 -0
- package/dist/updates/hooks/useUserUpdates.d.ts +5 -0
- package/dist/updates/index.d.ts +9 -0
- package/dist/updates/services/userUpdatesApi.d.ts +3 -0
- package/dist/updates/types.d.ts +24 -0
- package/dist/updates/utils/dismissedStore.d.ts +4 -0
- package/package.json +2 -2
|
@@ -1,603 +1,209 @@
|
|
|
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
1
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Reflete os campos obrigatórios de qualquer tabela multi-tenant: `id`, `alias` (tenant),
|
|
10
|
-
* timestamps e flags de soft delete (`is_removed`) e ativação (`is_actived`).
|
|
2
|
+
* Audit Trail Types
|
|
3
|
+
* Ported from Angular v1 (qex-audit-trail-readable) and v2 (flc-audit-trail)
|
|
11
4
|
*
|
|
12
5
|
* @example
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
* const value: AuditTrail = {} as AuditTrail;
|
|
7
|
+
*/
|
|
8
|
+
export interface AuditTrail {
|
|
9
|
+
documentId: string;
|
|
10
|
+
eventName: string;
|
|
11
|
+
entityName: string;
|
|
12
|
+
entityTypeName: string;
|
|
13
|
+
software: string;
|
|
14
|
+
dateTime: string;
|
|
15
|
+
userEmail: string;
|
|
16
|
+
userName: string;
|
|
17
|
+
ip: string;
|
|
18
|
+
isMobileRequest: boolean;
|
|
19
|
+
eventId: number;
|
|
20
|
+
userIdentId: number;
|
|
21
|
+
translatedSoftware?: string;
|
|
22
|
+
user?: string;
|
|
23
|
+
translatedEvent?: string;
|
|
24
|
+
date?: Date;
|
|
25
|
+
eventDescription?: string;
|
|
26
|
+
userPhotoUrl?: string;
|
|
27
|
+
icon?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface AuditTrailDetails {
|
|
30
|
+
software: string;
|
|
31
|
+
dateTime: string;
|
|
32
|
+
userId: string;
|
|
33
|
+
userName: string;
|
|
34
|
+
userEmail: string;
|
|
35
|
+
associationId: string;
|
|
36
|
+
isMobileRequest: boolean;
|
|
37
|
+
commandIsSigned?: boolean;
|
|
38
|
+
method: string;
|
|
39
|
+
urlPath: string;
|
|
40
|
+
eventId: number;
|
|
41
|
+
eventName: string;
|
|
42
|
+
commandName: string;
|
|
43
|
+
ip: string;
|
|
44
|
+
entities: AuditTrailEntity[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Tipo `AuditTrailEntity` exportado pela lib.
|
|
21
48
|
* @example
|
|
22
|
-
*
|
|
23
|
-
* function useEntities<T extends BaseEntity>(table: string) {
|
|
24
|
-
* return useQuery<T[]>(['entities', table], () => fetchAll(table));
|
|
25
|
-
* }
|
|
49
|
+
* const value: AuditTrailEntity = {} as AuditTrailEntity;
|
|
26
50
|
*/
|
|
27
|
-
export interface
|
|
51
|
+
export interface AuditTrailEntity {
|
|
28
52
|
id: string;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
53
|
+
code: string;
|
|
54
|
+
name: string;
|
|
55
|
+
description: string;
|
|
56
|
+
item: string;
|
|
57
|
+
date: Date;
|
|
58
|
+
typeId: number;
|
|
59
|
+
typeName: string;
|
|
60
|
+
extra?: AuditTrailExtraProperty[];
|
|
61
|
+
data: AuditTrailChangedProperty[];
|
|
62
|
+
association?: AuditTrailAssociation[];
|
|
63
|
+
isElectronicSigned?: boolean;
|
|
64
|
+
status?: number;
|
|
65
|
+
statusName?: string;
|
|
66
|
+
situation?: number;
|
|
67
|
+
justification?: string;
|
|
68
|
+
equipmentType?: string;
|
|
34
69
|
}
|
|
35
70
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
71
|
+
* Tipo `AuditTrailChangedProperty` exportado pela lib.
|
|
72
|
+
* @example
|
|
73
|
+
* const value: AuditTrailChangedProperty = {} as AuditTrailChangedProperty;
|
|
38
74
|
*/
|
|
39
|
-
export interface
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
data: T[];
|
|
51
|
-
currentPage: number;
|
|
52
|
-
totalPages: number;
|
|
53
|
-
totalItems: number;
|
|
54
|
-
itemsPerPage: number;
|
|
55
|
-
hasNextPage: boolean;
|
|
56
|
-
hasPreviousPage: boolean;
|
|
57
|
-
}
|
|
58
|
-
export interface SortState {
|
|
59
|
-
field: string;
|
|
60
|
-
direction: SortDirection;
|
|
61
|
-
}
|
|
62
|
-
export interface CrudManager<T extends BaseEntity> {
|
|
63
|
-
entities: T[];
|
|
64
|
-
pagination: PaginatedResponse<T>;
|
|
65
|
-
isLoading: boolean;
|
|
66
|
-
isDeleting: boolean;
|
|
67
|
-
searchTerm: string;
|
|
68
|
-
sortField: string;
|
|
69
|
-
sortDirection: SortDirection;
|
|
70
|
-
currentPage: number;
|
|
71
|
-
itemsPerPage: number;
|
|
72
|
-
handleSearch: (search: string) => void;
|
|
73
|
-
handleSort: (field: string) => void;
|
|
74
|
-
handlePageChange: (page: number) => void;
|
|
75
|
-
handleItemsPerPageChange: (limit: number) => void;
|
|
76
|
-
clearFilters: () => void;
|
|
77
|
-
deleteEntity: (id: string) => void;
|
|
78
|
-
refetch: () => void;
|
|
79
|
-
selectedIds: string[];
|
|
80
|
-
selectItem: (id: string) => void;
|
|
81
|
-
selectAll: () => void;
|
|
82
|
-
clearSelection: () => void;
|
|
83
|
-
isAllSelected: boolean;
|
|
84
|
-
bulkDelete?: (ids: string[]) => Promise<void>;
|
|
85
|
-
isBulkDeleting?: boolean;
|
|
86
|
-
}
|
|
87
|
-
export interface CrudEntity extends BaseEntity {
|
|
75
|
+
export interface AuditTrailChangedProperty {
|
|
76
|
+
property: string;
|
|
77
|
+
propertyCustomName?: string;
|
|
78
|
+
oldValue: any;
|
|
79
|
+
newValue: any;
|
|
80
|
+
children?: AuditTrailChangedProperty[];
|
|
81
|
+
propertyResource?: string;
|
|
82
|
+
state: string;
|
|
83
|
+
tagTranslate?: string;
|
|
84
|
+
oldValueTagTranslate?: string;
|
|
85
|
+
details?: any;
|
|
88
86
|
}
|
|
89
87
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* Suporta tipagem semântica (`type`), ordenação (default `true`), filtros, busca textual,
|
|
93
|
-
* renderização customizada e larguras controladas.
|
|
94
|
-
*
|
|
88
|
+
* Tipo `AuditTrailExtraProperty` exportado pela lib.
|
|
95
89
|
* @example
|
|
96
|
-
* const
|
|
97
|
-
* { key: 'title', header: 'Título', type: 'text', searchable: true, weight: 3 },
|
|
98
|
-
* {
|
|
99
|
-
* key: 'status',
|
|
100
|
-
* header: 'Status',
|
|
101
|
-
* type: 'select',
|
|
102
|
-
* options: [
|
|
103
|
-
* { label: 'Pendente', value: 'pending' },
|
|
104
|
-
* { label: 'Concluído', value: 'completed' },
|
|
105
|
-
* ],
|
|
106
|
-
* filterable: true,
|
|
107
|
-
* render: (row) => <StatusBadge status={row.status} />,
|
|
108
|
-
* },
|
|
109
|
-
* {
|
|
110
|
-
* key: 'created_at',
|
|
111
|
-
* header: 'Criado em',
|
|
112
|
-
* type: 'date',
|
|
113
|
-
* sortable: true,
|
|
114
|
-
* render: (row) => formatDatetime(row.created_at),
|
|
115
|
-
* },
|
|
116
|
-
* { key: 'id_user', header: 'Responsável', minWidth: 180 },
|
|
117
|
-
* ];
|
|
90
|
+
* const value: AuditTrailExtraProperty = {} as AuditTrailExtraProperty;
|
|
118
91
|
*/
|
|
119
|
-
export interface
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
required?: boolean;
|
|
125
|
-
/** Coluna é ordenável. Default: true. Use `false` para desabilitar. */
|
|
126
|
-
sortable?: boolean;
|
|
127
|
-
filterable?: boolean;
|
|
128
|
-
searchable?: boolean;
|
|
129
|
-
options?: Array<{
|
|
130
|
-
label: string;
|
|
131
|
-
value: any;
|
|
132
|
-
}>;
|
|
133
|
-
render?: (item: T) => React.ReactNode;
|
|
134
|
-
validation?: (value: any) => string | undefined;
|
|
135
|
-
className?: string;
|
|
136
|
-
/** Minimum width in pixels (only applied in desktop view) */
|
|
137
|
-
minWidth?: number;
|
|
138
|
-
/** Maximum width in pixels for column resize */
|
|
139
|
-
maxWidth?: number;
|
|
140
|
-
/** Flex weight for distributing remaining space (only applied in desktop view) */
|
|
141
|
-
weight?: number;
|
|
142
|
-
/** Fixed width (overrides minWidth and weight) */
|
|
143
|
-
width?: number;
|
|
144
|
-
/** Whether the column can be resized (default: true when enableColumnResize is enabled) */
|
|
145
|
-
resizable?: boolean;
|
|
146
|
-
/** Whether the column can be hidden via column manager (default: true) */
|
|
147
|
-
hideable?: boolean;
|
|
148
|
-
/** Whether the column can be used for grouping (default: false) */
|
|
149
|
-
groupable?: boolean;
|
|
92
|
+
export interface AuditTrailExtraProperty {
|
|
93
|
+
property: string;
|
|
94
|
+
value: string;
|
|
95
|
+
data?: any;
|
|
96
|
+
translate?: boolean;
|
|
150
97
|
}
|
|
151
98
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* Permite adicionar filtros personalizados (busca, selects, checkboxes, etc)
|
|
155
|
-
* nas páginas CRUD geradas automaticamente.
|
|
156
|
-
*
|
|
157
|
-
* **Tipos de filtro:**
|
|
158
|
-
* - `'search'`: Campo de busca padrão (integrado com `manager.searchTerm`)
|
|
159
|
-
* - `'select'`: Select nativo com opções predefinidas
|
|
160
|
-
* - `'custom'`: Componente React customizado (Select, Checkbox, etc)
|
|
161
|
-
*
|
|
162
|
-
* **Posicionamento:**
|
|
163
|
-
* - Desktop: Filtros aparecem inline na Action Bar (ao lado do botão "Novo")
|
|
164
|
-
* - Mobile: Filtros empilhados verticalmente abaixo do botão "Novo"
|
|
165
|
-
*
|
|
99
|
+
* Tipo `AuditTrailAssociation` exportado pela lib.
|
|
166
100
|
* @example
|
|
167
|
-
*
|
|
168
|
-
* // Filtro de busca padrão
|
|
169
|
-
* const filters: CrudFilter[] = [
|
|
170
|
-
* { type: 'search' }
|
|
171
|
-
* ];
|
|
172
|
-
*
|
|
173
|
-
* // Filtro select nativo
|
|
174
|
-
* const filters: CrudFilter[] = [
|
|
175
|
-
* {
|
|
176
|
-
* type: 'select',
|
|
177
|
-
* placeholder: 'Filtrar por status',
|
|
178
|
-
* options: [
|
|
179
|
-
* { label: 'Todos', value: 'all' },
|
|
180
|
-
* { label: 'Ativos', value: 'active' },
|
|
181
|
-
* { label: 'Inativos', value: 'inactive' }
|
|
182
|
-
* ],
|
|
183
|
-
* value: statusFilter,
|
|
184
|
-
* onChange: setStatusFilter
|
|
185
|
-
* }
|
|
186
|
-
* ];
|
|
187
|
-
*
|
|
188
|
-
* // Filtro customizado com Select
|
|
189
|
-
* import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from 'forlogic-core';
|
|
190
|
-
*
|
|
191
|
-
* const filters: CrudFilter[] = [
|
|
192
|
-
* {
|
|
193
|
-
* type: 'custom',
|
|
194
|
-
* component: ({ value, onChange }) => (
|
|
195
|
-
* <Select value={value} onValueChange={onChange}>
|
|
196
|
-
* <SelectTrigger className="w-[180px]">
|
|
197
|
-
* <SelectValue placeholder="Status" />
|
|
198
|
-
* </SelectTrigger>
|
|
199
|
-
* <SelectContent>
|
|
200
|
-
* <SelectItem value="all">Todos</SelectItem>
|
|
201
|
-
* <SelectItem value="active">Ativos</SelectItem>
|
|
202
|
-
* <SelectItem value="inactive">Inativos</SelectItem>
|
|
203
|
-
* </SelectContent>
|
|
204
|
-
* </Select>
|
|
205
|
-
* ),
|
|
206
|
-
* props: { value: statusFilter, onChange: setStatusFilter }
|
|
207
|
-
* }
|
|
208
|
-
* ];
|
|
209
|
-
* ```
|
|
210
|
-
*
|
|
211
|
-
* @example
|
|
212
|
-
* ```typescript
|
|
213
|
-
* // Múltiplos filtros customizados
|
|
214
|
-
* function ProcessesPage() {
|
|
215
|
-
* const [statusFilter, setStatusFilter] = useState('all');
|
|
216
|
-
* const [typeFilter, setTypeFilter] = useState('all');
|
|
217
|
-
*
|
|
218
|
-
* const filters: CrudFilter[] = [
|
|
219
|
-
* { type: 'search' },
|
|
220
|
-
* {
|
|
221
|
-
* type: 'select',
|
|
222
|
-
* placeholder: 'Status',
|
|
223
|
-
* options: [
|
|
224
|
-
* { label: 'Todos', value: 'all' },
|
|
225
|
-
* { label: 'Ativos', value: 'active' },
|
|
226
|
-
* { label: 'Inativos', value: 'inactive' }
|
|
227
|
-
* ],
|
|
228
|
-
* value: statusFilter,
|
|
229
|
-
* onChange: setStatusFilter
|
|
230
|
-
* },
|
|
231
|
-
* {
|
|
232
|
-
* type: 'custom',
|
|
233
|
-
* component: TypeSelect,
|
|
234
|
-
* props: { value: typeFilter, onChange: setTypeFilter }
|
|
235
|
-
* }
|
|
236
|
-
* ];
|
|
237
|
-
*
|
|
238
|
-
* // Filtrar dados baseado nos filtros customizados
|
|
239
|
-
* const filteredData = useMemo(() => {
|
|
240
|
-
* let data = manager.entities;
|
|
241
|
-
* if (statusFilter !== 'all') {
|
|
242
|
-
* data = data.filter(item => item.status === statusFilter);
|
|
243
|
-
* }
|
|
244
|
-
* if (typeFilter !== 'all') {
|
|
245
|
-
* data = data.filter(item => item.type === typeFilter);
|
|
246
|
-
* }
|
|
247
|
-
* return data;
|
|
248
|
-
* }, [manager.entities, statusFilter, typeFilter]);
|
|
249
|
-
*
|
|
250
|
-
* return <CrudPage manager={{ ...manager, entities: filteredData }} />;
|
|
251
|
-
* }
|
|
252
|
-
* ```
|
|
253
|
-
*
|
|
254
|
-
* @see {@link FilterBar} - Componente que renderiza os filtros
|
|
101
|
+
* const value: AuditTrailAssociation = {} as AuditTrailAssociation;
|
|
255
102
|
*/
|
|
256
|
-
export interface
|
|
257
|
-
/** Tipo do filtro: 'search' para busca padrão, 'select' para select nativo, 'custom' para componente personalizado */
|
|
258
|
-
type: 'search' | 'select' | 'custom';
|
|
259
|
-
/** Placeholder para select (quando type='select') */
|
|
260
|
-
placeholder?: string;
|
|
261
|
-
/** Opções para select (quando type='select') */
|
|
262
|
-
options?: Array<{
|
|
263
|
-
label: string;
|
|
264
|
-
value: string;
|
|
265
|
-
}>;
|
|
266
|
-
/** Valor atual do filtro (quando type='select') */
|
|
267
|
-
value?: string;
|
|
268
|
-
/** Callback quando o valor muda (quando type='select') */
|
|
269
|
-
onChange?: (value: string) => void;
|
|
270
|
-
/** Componente React customizado (obrigatório quando type='custom') */
|
|
271
|
-
component?: React.ComponentType<any>;
|
|
272
|
-
/** Props passadas para o componente customizado (value, onChange, etc) */
|
|
273
|
-
props?: Record<string, any>;
|
|
274
|
-
/** Função para controlar visibilidade do filtro baseado no estado do manager */
|
|
275
|
-
show?: (manager: CrudManager<any>) => boolean;
|
|
276
|
-
}
|
|
277
|
-
export interface BulkAction<T extends BaseEntity> {
|
|
278
|
-
label: string;
|
|
279
|
-
icon?: React.ComponentType<{
|
|
280
|
-
size?: number;
|
|
281
|
-
className?: string;
|
|
282
|
-
}>;
|
|
283
|
-
variant?: 'default' | 'destructive' | 'outline';
|
|
284
|
-
action: (items: T[]) => void | Promise<void>;
|
|
285
|
-
confirmMessage?: string;
|
|
286
|
-
/** Se a ação está desabilitada */
|
|
287
|
-
disabled?: boolean;
|
|
288
|
-
/** Motivo do bloqueio (exibido em tooltip quando disabled=true) */
|
|
289
|
-
disabledReason?: string;
|
|
290
|
-
}
|
|
291
|
-
export interface CrudPageConfig<T extends CrudEntity> {
|
|
292
|
-
entityName: string;
|
|
293
|
-
entityNamePlural: string;
|
|
294
|
-
filters?: CrudFilter[];
|
|
295
|
-
columns: CrudColumn<T>[];
|
|
296
|
-
cardFields?: Array<{
|
|
297
|
-
key: keyof T;
|
|
298
|
-
label: string;
|
|
299
|
-
render?: (value: any, item: T) => React.ReactNode;
|
|
300
|
-
}>;
|
|
301
|
-
onNew?: () => void;
|
|
302
|
-
onEdit?: (entity: T) => void;
|
|
303
|
-
useCustomRouting?: boolean;
|
|
304
|
-
/** @deprecated Use showNewButton={false} instead */
|
|
305
|
-
hideNewButton?: boolean;
|
|
306
|
-
/** Exibir botão "Novo" (default: true) */
|
|
307
|
-
showNewButton?: boolean;
|
|
308
|
-
/** Texto customizado para o botão "Novo" */
|
|
309
|
-
newButtonLabel?: string;
|
|
310
|
-
newButtonText?: string;
|
|
311
|
-
title?: string;
|
|
312
|
-
searchPlaceholder?: string;
|
|
313
|
-
/** Exibir busca integrada na Action Bar (default: false - usa busca global) */
|
|
314
|
-
showSearch?: boolean;
|
|
315
|
-
/** Exibir Action Bar (default: true) */
|
|
316
|
-
showActionBar?: boolean;
|
|
317
|
-
enableBulkActions?: boolean;
|
|
318
|
-
bulkActions?: BulkAction<T>[];
|
|
319
|
-
customActions?: Array<{
|
|
320
|
-
label: string;
|
|
321
|
-
icon?: React.ComponentType<{
|
|
322
|
-
size?: number;
|
|
323
|
-
className?: string;
|
|
324
|
-
}>;
|
|
325
|
-
variant?: 'default' | 'destructive' | 'outline' | 'ghost';
|
|
326
|
-
action: () => void;
|
|
327
|
-
/** Se a ação está desabilitada */
|
|
328
|
-
disabled?: boolean;
|
|
329
|
-
/** Motivo do bloqueio (exibido em tooltip quando disabled=true) */
|
|
330
|
-
disabledReason?: string;
|
|
331
|
-
}>;
|
|
332
|
-
customRowActions?: (item: T) => Array<{
|
|
333
|
-
icon: any;
|
|
334
|
-
label: string;
|
|
335
|
-
onClick: () => void;
|
|
336
|
-
}>;
|
|
337
|
-
customListView?: (items: T[], manager?: CrudManager<T>) => React.ReactNode;
|
|
338
|
-
/** Colunas ocultas por padrão (antes de qualquer interação do usuário). */
|
|
339
|
-
defaultHiddenColumns?: string[];
|
|
340
|
-
}
|
|
341
|
-
export interface EntityWithId {
|
|
342
|
-
id: string | number;
|
|
343
|
-
}
|
|
344
|
-
export type CreateEntityInput<T extends EntityWithId> = Omit<T, 'id' | 'created_at' | 'updated_at'>;
|
|
345
|
-
export type UpdateEntityInput<T extends EntityWithId> = Partial<CreateEntityInput<T>>;
|
|
346
|
-
export interface GeneratedCrudConfig<T extends EntityWithId> {
|
|
347
|
-
title: string;
|
|
348
|
-
columns: CrudColumn<T>[];
|
|
349
|
-
searchPlaceholder?: string;
|
|
350
|
-
itemsPerPage?: number;
|
|
351
|
-
enableCreate?: boolean;
|
|
352
|
-
enableEdit?: boolean;
|
|
353
|
-
enableDelete?: boolean;
|
|
354
|
-
enableSearch?: boolean;
|
|
355
|
-
enableFilters?: boolean;
|
|
356
|
-
customActions?: Array<{
|
|
357
|
-
label: string;
|
|
358
|
-
icon?: React.ComponentType;
|
|
359
|
-
onClick: (item: T) => void;
|
|
360
|
-
variant?: 'default' | 'destructive' | 'outline';
|
|
361
|
-
}>;
|
|
362
|
-
}
|
|
363
|
-
export interface FormField {
|
|
364
|
-
name: string;
|
|
365
|
-
label: string;
|
|
366
|
-
type: 'text' | 'textarea' | 'select' | 'multiselect' | 'date' | 'datetime-local' | 'number' | 'user-select' | 'group' | 'checkbox' | 'switch' | 'email' | 'password' | 'color' | 'color-picker' | 'icon-picker' | 'custom';
|
|
367
|
-
required?: boolean;
|
|
368
|
-
disabled?: boolean;
|
|
369
|
-
options?: {
|
|
370
|
-
label: string;
|
|
371
|
-
value: string | number;
|
|
372
|
-
}[];
|
|
373
|
-
placeholder?: string;
|
|
374
|
-
component?: React.ComponentType<any>;
|
|
375
|
-
componentProps?: Record<string, any>;
|
|
376
|
-
value?: any;
|
|
377
|
-
defaultValue?: any;
|
|
378
|
-
dependsOn?: string;
|
|
379
|
-
computedValue?: (formData: any) => any;
|
|
380
|
-
validation?: {
|
|
381
|
-
custom?: (value: any, formData?: any) => string | undefined;
|
|
382
|
-
} | ((value: any, formData?: any) => string | undefined);
|
|
383
|
-
layout?: 'horizontal' | 'vertical';
|
|
384
|
-
className?: string;
|
|
385
|
-
fields?: FormField[];
|
|
386
|
-
onValueChange?: (value: any) => void;
|
|
387
|
-
step?: number;
|
|
388
|
-
rows?: number;
|
|
389
|
-
mode?: 'single' | 'multiple';
|
|
390
|
-
columns?: number;
|
|
391
|
-
render?: (props: {
|
|
392
|
-
value: any;
|
|
393
|
-
onChange: (value: any) => void;
|
|
394
|
-
error?: string;
|
|
395
|
-
disabled?: boolean;
|
|
396
|
-
}) => React.ReactNode;
|
|
397
|
-
}
|
|
398
|
-
export interface FormSection {
|
|
103
|
+
export interface AuditTrailAssociation {
|
|
399
104
|
id: string;
|
|
400
|
-
|
|
401
|
-
label?: string;
|
|
402
|
-
fields: FormField[];
|
|
403
|
-
component?: React.ComponentType<any>;
|
|
404
|
-
disabled?: boolean;
|
|
405
|
-
condition?: (formData: any) => boolean;
|
|
406
|
-
}
|
|
407
|
-
export interface BaseFormConfig<T> {
|
|
408
|
-
title: string;
|
|
409
|
-
sections: FormSection[];
|
|
410
|
-
initialData?: Partial<T>;
|
|
411
|
-
onSubmit: (data: T) => void;
|
|
412
|
-
onCancel: () => void;
|
|
413
|
-
submitButtonText?: string;
|
|
414
|
-
isMobile?: boolean;
|
|
415
|
-
}
|
|
416
|
-
export interface BaseFormProps<T> extends BaseFormConfig<T> {
|
|
417
|
-
open: boolean;
|
|
418
|
-
}
|
|
419
|
-
export interface GenericQueryConfig<TData, TParams> {
|
|
420
|
-
queryKey: string[];
|
|
421
|
-
queryFn: (params: TParams) => Promise<TData>;
|
|
422
|
-
params: TParams;
|
|
423
|
-
hookName: string;
|
|
424
|
-
enabled?: boolean;
|
|
425
|
-
defaultPagination?: {
|
|
426
|
-
currentPage: number;
|
|
427
|
-
totalPages: number;
|
|
428
|
-
totalItems: number;
|
|
429
|
-
itemsPerPage: number;
|
|
430
|
-
hasNextPage: boolean;
|
|
431
|
-
hasPreviousPage: boolean;
|
|
432
|
-
};
|
|
433
|
-
dataMapper?: (data: TData) => unknown;
|
|
434
|
-
dataExtractor?: (response: TData) => unknown;
|
|
435
|
-
paginationExtractor?: (response: TData) => unknown;
|
|
436
|
-
}
|
|
437
|
-
export interface GenericDataQueryResult<TItem> {
|
|
438
|
-
data: TItem[];
|
|
439
|
-
pagination: unknown;
|
|
440
|
-
isLoading: boolean;
|
|
441
|
-
error: unknown;
|
|
442
|
-
refetch: () => void;
|
|
443
|
-
}
|
|
444
|
-
export interface AuthTokens {
|
|
445
|
-
accessToken: string;
|
|
446
|
-
idToken: string;
|
|
447
|
-
supabaseToken?: string;
|
|
448
|
-
}
|
|
449
|
-
export interface UserInfo {
|
|
450
|
-
id: string;
|
|
451
|
-
email: string;
|
|
452
|
-
name: string;
|
|
453
|
-
identifier: string;
|
|
454
|
-
alias?: string;
|
|
455
|
-
isSysAdmin: boolean;
|
|
456
|
-
}
|
|
457
|
-
export interface Company {
|
|
458
|
-
id: string;
|
|
459
|
-
alias: string;
|
|
105
|
+
code: string;
|
|
460
106
|
name: string;
|
|
107
|
+
status?: number;
|
|
108
|
+
softwareId?: number;
|
|
109
|
+
softwareName?: string;
|
|
110
|
+
type?: number | string;
|
|
111
|
+
association?: AuditTrailAssociation[];
|
|
461
112
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
export interface
|
|
468
|
-
id:
|
|
469
|
-
alias: string;
|
|
113
|
+
/**
|
|
114
|
+
* Tipo `AuditTrailEvent` exportado pela lib.
|
|
115
|
+
* @example
|
|
116
|
+
* const value: AuditTrailEvent = {} as AuditTrailEvent;
|
|
117
|
+
*/
|
|
118
|
+
export interface AuditTrailEvent {
|
|
119
|
+
id: number;
|
|
470
120
|
name: string;
|
|
471
|
-
|
|
121
|
+
translation: string;
|
|
122
|
+
softwareId: number;
|
|
472
123
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
userId: string | null;
|
|
481
|
-
userAlias: string | null;
|
|
482
|
-
placeId: string | null;
|
|
483
|
-
placeName: string | null;
|
|
484
|
-
activePlaceId?: string | null;
|
|
485
|
-
activePlaceName?: string | null;
|
|
486
|
-
}
|
|
487
|
-
export interface IdTokenPayload {
|
|
488
|
-
subNewId: string;
|
|
489
|
-
email: string;
|
|
124
|
+
/**
|
|
125
|
+
* Tipo `AuditTrailSoftware` exportado pela lib.
|
|
126
|
+
* @example
|
|
127
|
+
* const value: AuditTrailSoftware = {} as AuditTrailSoftware;
|
|
128
|
+
*/
|
|
129
|
+
export interface AuditTrailSoftware {
|
|
130
|
+
id: number;
|
|
490
131
|
name: string;
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
[key: string]: any;
|
|
132
|
+
software: string;
|
|
133
|
+
translation: string;
|
|
494
134
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
|
|
135
|
+
/**
|
|
136
|
+
* Tipo `AuditTrailQueryParams` exportado pela lib.
|
|
137
|
+
* @example
|
|
138
|
+
* const value: AuditTrailQueryParams = {} as AuditTrailQueryParams;
|
|
139
|
+
*/
|
|
140
|
+
export interface AuditTrailQueryParams {
|
|
141
|
+
software: string;
|
|
142
|
+
softwareId: number;
|
|
143
|
+
event: string;
|
|
144
|
+
eventId: number;
|
|
145
|
+
startDate: Date;
|
|
146
|
+
endDate: Date;
|
|
147
|
+
limit: number;
|
|
148
|
+
softwares: AuditTrailSoftware[];
|
|
501
149
|
userId?: string;
|
|
502
|
-
|
|
503
|
-
userEmail?: string;
|
|
504
|
-
placeId?: string | null;
|
|
505
|
-
placeName?: string | null;
|
|
506
|
-
roleId?: string;
|
|
507
|
-
roleName?: string;
|
|
508
|
-
companyId?: string;
|
|
509
|
-
companyName?: string;
|
|
510
|
-
/** Indica se o usuário está ativo no Qualiex. Default `true` quando ausente. */
|
|
511
|
-
isActive?: boolean;
|
|
512
|
-
}
|
|
513
|
-
export interface QualiexUserFieldMapping {
|
|
514
|
-
/** Nome do campo de ID de usuário na entidade (ex: "target_user_id") */
|
|
515
|
-
idField: string;
|
|
516
|
-
/** Nome do campo de saída para o nome (ex: "target_user_name"). Default: idField + "_name" */
|
|
517
|
-
nameField?: string;
|
|
518
|
-
/** Nome do campo de saída para o email (ex: "target_user_email"). Default: idField + "_email" */
|
|
519
|
-
emailField?: string;
|
|
520
|
-
/** Nome do campo de saída para o username (ex: "target_user_username"). Default: idField + "_username" */
|
|
521
|
-
usernameField?: string;
|
|
522
|
-
}
|
|
523
|
-
export interface QualiexEnrichmentConfig {
|
|
524
|
-
/** Sufixo padrão para campos de nome (default: "_name") */
|
|
525
|
-
userNameFieldSuffix?: string;
|
|
526
|
-
/** Sufixo padrão para campos de email (default: "_email") */
|
|
527
|
-
userEmailFieldSuffix?: string;
|
|
528
|
-
/** Sufixo padrão para campos de username (default: "_username") */
|
|
529
|
-
userUsernameFieldSuffix?: string;
|
|
150
|
+
entityId?: string;
|
|
530
151
|
}
|
|
531
152
|
/**
|
|
532
|
-
*
|
|
533
|
-
*
|
|
153
|
+
* Tipo `AuditTrailPermissions` exportado pela lib.
|
|
154
|
+
* @example
|
|
155
|
+
* const value: AuditTrailPermissions = {} as AuditTrailPermissions;
|
|
534
156
|
*/
|
|
535
|
-
export interface
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
colorLight: string;
|
|
540
|
-
namePtBr: string;
|
|
541
|
-
nameUs: string;
|
|
542
|
-
nameEs: string;
|
|
157
|
+
export interface AuditTrailPermissions {
|
|
158
|
+
viewAllEvents: boolean;
|
|
159
|
+
viewOnlyMyEvents: boolean;
|
|
160
|
+
download: boolean;
|
|
543
161
|
}
|
|
544
162
|
/**
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
* O array `softwares` contém os IDs dos módulos aos quais o usuário tem acesso.
|
|
549
|
-
* O `roleId` e `roleName` representam o papel do usuário naquela associação.
|
|
163
|
+
* Tipo `AuditTrailUserOption` exportado pela lib.
|
|
164
|
+
* @example
|
|
165
|
+
* const value: AuditTrailUserOption = {} as AuditTrailUserOption;
|
|
550
166
|
*/
|
|
551
|
-
export interface
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
companyName: string;
|
|
557
|
-
companyAlias: string;
|
|
558
|
-
companyPhotoDate?: string;
|
|
559
|
-
language?: string;
|
|
560
|
-
roleId: string;
|
|
561
|
-
roleName: string;
|
|
562
|
-
placeId?: string;
|
|
563
|
-
placeName?: string;
|
|
564
|
-
softwares: number[];
|
|
565
|
-
functionalities: string[];
|
|
566
|
-
isQualitfy?: boolean;
|
|
567
|
-
isMetroex?: boolean;
|
|
167
|
+
export interface AuditTrailUserOption {
|
|
168
|
+
id: string;
|
|
169
|
+
name: string;
|
|
170
|
+
email?: string;
|
|
171
|
+
avatar?: string;
|
|
568
172
|
}
|
|
569
173
|
/**
|
|
570
|
-
*
|
|
174
|
+
* Tipo `AuditTrailDetailRow` exportado pela lib.
|
|
175
|
+
* @example
|
|
176
|
+
* const value: AuditTrailDetailRow = {} as AuditTrailDetailRow;
|
|
571
177
|
*/
|
|
572
|
-
export interface
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
/** Se os dados ainda estão carregando */
|
|
576
|
-
isLoading: boolean;
|
|
577
|
-
/** Role do usuário na associação atual */
|
|
578
|
-
role: {
|
|
579
|
-
id: string;
|
|
580
|
-
name: string;
|
|
581
|
-
} | null;
|
|
582
|
-
/** Associação completa do usuário para a unidade atual */
|
|
583
|
-
association: UserAssociation | null;
|
|
584
|
-
/** Função para verificar acesso a outro(s) módulo(s) */
|
|
585
|
-
hasAccessTo: (alias: string | string[]) => boolean;
|
|
586
|
-
}
|
|
587
|
-
export interface ApiResponse<T = unknown> {
|
|
588
|
-
data: T;
|
|
589
|
-
success: boolean;
|
|
590
|
-
message?: string;
|
|
591
|
-
error?: string;
|
|
592
|
-
}
|
|
593
|
-
export interface ValidationResult {
|
|
594
|
-
isValid: boolean;
|
|
595
|
-
errors: string[];
|
|
596
|
-
warnings?: string[];
|
|
178
|
+
export interface AuditTrailDetailRow {
|
|
179
|
+
name: string;
|
|
180
|
+
value: string;
|
|
597
181
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Tipo `AuditTrailCallbacks` exportado pela lib.
|
|
184
|
+
* @example
|
|
185
|
+
* const value: AuditTrailCallbacks = {} as AuditTrailCallbacks;
|
|
186
|
+
*/
|
|
187
|
+
export interface AuditTrailCallbacks {
|
|
188
|
+
/** Fetch trail list based on query params */
|
|
189
|
+
onFetchTrails: (params: AuditTrailQueryParams) => Promise<{
|
|
190
|
+
data: AuditTrail[];
|
|
191
|
+
totalRows: number;
|
|
192
|
+
}>;
|
|
193
|
+
/** Fetch events for a software */
|
|
194
|
+
onFetchEvents: (softwareId: number) => Promise<AuditTrailEvent[]>;
|
|
195
|
+
/** Fetch trail details by documentId */
|
|
196
|
+
onFetchDetails: (documentId: string) => Promise<AuditTrailDetails>;
|
|
197
|
+
/** Fetch user options for filter */
|
|
198
|
+
onFetchUsers?: () => Promise<AuditTrailUserOption[]>;
|
|
199
|
+
/** Export data (csv, pdf, xlsx) */
|
|
200
|
+
onExport?: (format: 'csv' | 'pdf' | 'xlsx', data: AuditTrail[]) => void;
|
|
201
|
+
/** Translate event name */
|
|
202
|
+
translateEvent?: (eventName: string, softwareName: string) => string;
|
|
203
|
+
/** Translate software name */
|
|
204
|
+
translateSoftware?: (softwareKey: string) => string;
|
|
205
|
+
/** Translate detail property */
|
|
206
|
+
translateProperty?: (eventName: string, propertyResource: string) => string;
|
|
207
|
+
/** Translate detail property value */
|
|
208
|
+
translatePropertyValue?: (eventName: string, propertyResource: string, value: string) => string | null;
|
|
603
209
|
}
|