@archbase/components 3.0.25 → 4.0.1
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/buttons/ArchbaseSpeedDial.d.ts +59 -0
- package/dist/buttons/index.d.ts +2 -0
- package/dist/charts/ArchbaseArcGauge.d.ts +55 -0
- package/dist/charts/ArchbaseGantt.d.ts +70 -0
- package/dist/charts/ArchbaseLinearGauge.d.ts +55 -0
- package/dist/charts/ArchbaseResourceTimeline.d.ts +61 -0
- package/dist/charts/ArchbaseSparkline.d.ts +45 -0
- package/dist/charts/index.d.ts +10 -0
- package/dist/containers/ArchbaseExpansionPanel.d.ts +60 -0
- package/dist/containers/ArchbaseFloatingPanel.d.ts +91 -0
- package/dist/containers/index.d.ts +4 -0
- package/dist/datagrid/export/ArchbaseDataGridExcelExport.d.ts +67 -0
- package/dist/datagrid/export/index.d.ts +2 -0
- package/dist/datagrid/index.d.ts +1 -0
- package/dist/display/ArchbaseAnimationWrapper.d.ts +73 -0
- package/dist/display/ArchbaseBarcodeGenerator.d.ts +50 -0
- package/dist/display/ArchbaseCarousel.d.ts +100 -0
- package/dist/display/ArchbaseCodeViewer.d.ts +63 -0
- package/dist/display/ArchbaseDiffViewer.d.ts +41 -0
- package/dist/display/ArchbaseJsonTree.d.ts +34 -0
- package/dist/display/ArchbaseLightbox.d.ts +89 -0
- package/dist/display/ArchbaseMarquee.d.ts +46 -0
- package/dist/display/ArchbasePhotoAlbum.d.ts +58 -0
- package/dist/display/ArchbaseQRCode.d.ts +44 -0
- package/dist/display/ArchbaseTooltipRich.d.ts +82 -0
- package/dist/display/ArchbaseVirtualList.d.ts +116 -0
- package/dist/display/index.d.ts +24 -0
- package/dist/editors/ArchbaseAIPromptInput.d.ts +69 -0
- package/dist/editors/ArchbaseAsyncMultiSelect.d.ts +1 -1
- package/dist/editors/ArchbaseAsyncSelect.d.ts +1 -1
- package/dist/editors/ArchbaseBarcodeScanner.d.ts +63 -0
- package/dist/editors/ArchbaseCepInput.d.ts +26 -0
- package/dist/editors/ArchbaseColorGradientPicker.d.ts +80 -0
- package/dist/editors/ArchbaseCpfCnpjInput.d.ts +21 -0
- package/dist/editors/ArchbaseCurrencyInput.d.ts +25 -0
- package/dist/editors/ArchbaseDualListbox.d.ts +61 -0
- package/dist/editors/ArchbaseInPlaceEditor.d.ts +67 -0
- package/dist/editors/ArchbaseLightGrid.d.ts +56 -0
- package/dist/editors/ArchbaseMentionInput.d.ts +75 -0
- package/dist/editors/ArchbaseMultiEmail.d.ts +53 -0
- package/dist/editors/ArchbaseMultiViewCalendar.d.ts +47 -0
- package/dist/editors/ArchbaseNumberStepper.d.ts +66 -0
- package/dist/editors/ArchbaseOTPInput.d.ts +27 -0
- package/dist/editors/ArchbasePhoneInput.d.ts +52 -0
- package/dist/editors/ArchbaseRangeSlider.d.ts +22 -0
- package/dist/editors/ArchbaseSignaturePad.d.ts +60 -0
- package/dist/editors/ArchbaseSpeechToTextInput.d.ts +106 -0
- package/dist/editors/ArchbaseSpreadsheet.d.ts +56 -0
- package/dist/editors/ArchbaseTagInput.d.ts +55 -0
- package/dist/editors/index.d.ts +40 -0
- package/dist/feedback/ArchbaseChunkProgressBar.d.ts +35 -0
- package/dist/feedback/ArchbaseRipple.d.ts +43 -0
- package/dist/feedback/ArchbaseSkeleton.d.ts +115 -0
- package/dist/feedback/index.d.ts +6 -0
- package/dist/filters/ArchbaseColumnSelector.d.ts +38 -0
- package/dist/filters/index.d.ts +2 -0
- package/dist/forms/ArchbaseFieldArray.d.ts +80 -0
- package/dist/forms/ArchbaseFormWizard.d.ts +73 -0
- package/dist/forms/ArchbaseStepper.d.ts +51 -0
- package/dist/forms/index.d.ts +8 -0
- package/dist/forms/useArchbaseFormWizard.d.ts +74 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useArchbaseConfirm.d.ts +59 -0
- package/dist/image/editor/index.d.ts +43 -4
- package/dist/image/index.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +22510 -13820
- package/dist/list/ArchbaseTreeList.d.ts +76 -0
- package/dist/list/index.d.ts +2 -0
- package/dist/navigation/ArchbaseActionSheet.d.ts +70 -0
- package/dist/navigation/ArchbaseAppBar.d.ts +63 -0
- package/dist/navigation/ArchbaseBottomNavigation.d.ts +61 -0
- package/dist/navigation/ArchbaseContextMenu.d.ts +76 -0
- package/dist/navigation/ArchbaseKeyboardShortcuts.d.ts +85 -0
- package/dist/navigation/ArchbaseSpotlight.d.ts +69 -0
- package/dist/navigation/index.d.ts +12 -0
- package/dist/notification/ArchbaseNotificationCenter.d.ts +56 -0
- package/dist/notification/index.d.ts +2 -0
- package/dist/onboarding/ArchbaseOnboardingTour.d.ts +27 -76
- package/dist/viewers/ArchbaseDocViewer.d.ts +40 -0
- package/dist/viewers/ArchbasePdfBuilder.d.ts +53 -0
- package/dist/viewers/ArchbaseXmlViewer.d.ts +36 -0
- package/dist/viewers/index.d.ts +6 -0
- package/package.json +41 -18
- package/src/buttons/ArchbaseSpeedDial.tsx +282 -0
- package/src/buttons/index.ts +3 -0
- package/src/charts/ArchbaseArcGauge.tsx +325 -0
- package/src/charts/ArchbaseGantt.tsx +494 -0
- package/src/charts/ArchbaseLinearGauge.tsx +288 -0
- package/src/charts/ArchbaseResourceTimeline.tsx +433 -0
- package/src/charts/ArchbaseSparkline.tsx +193 -0
- package/src/charts/index.ts +20 -1
- package/src/containers/ArchbaseExpansionPanel.tsx +208 -0
- package/src/containers/ArchbaseFloatingPanel.tsx +448 -0
- package/src/containers/index.ts +17 -0
- package/src/datagrid/components/pagination/grid-pagination.tsx +2 -2
- package/src/datagrid/export/ArchbaseDataGridExcelExport.tsx +293 -0
- package/src/datagrid/export/index.ts +8 -0
- package/src/datagrid/index.tsx +2 -0
- package/src/display/ArchbaseAnimationWrapper.tsx +272 -0
- package/src/display/ArchbaseBarcodeGenerator.tsx +303 -0
- package/src/display/ArchbaseCarousel.tsx +679 -0
- package/src/display/ArchbaseCodeViewer.tsx +271 -0
- package/src/display/ArchbaseDiffViewer.tsx +108 -0
- package/src/display/ArchbaseJsonTree.tsx +150 -0
- package/src/display/ArchbaseLightbox.tsx +279 -0
- package/src/display/ArchbaseMarquee.tsx +268 -0
- package/src/display/ArchbasePhotoAlbum.tsx +415 -0
- package/src/display/ArchbaseQRCode.tsx +137 -0
- package/src/display/ArchbaseTooltipRich.tsx +317 -0
- package/src/display/ArchbaseVirtualList.tsx +618 -0
- package/src/display/index.ts +94 -1
- package/src/editors/ArchbaseAIPromptInput.tsx +432 -0
- package/src/editors/ArchbaseBarcodeScanner.tsx +570 -0
- package/src/editors/ArchbaseCepInput.tsx +173 -0
- package/src/editors/ArchbaseColorGradientPicker.tsx +460 -0
- package/src/editors/ArchbaseCpfCnpjInput.tsx +193 -0
- package/src/editors/ArchbaseCurrencyInput.tsx +100 -0
- package/src/editors/ArchbaseDualListbox.tsx +671 -0
- package/src/editors/ArchbaseInPlaceEditor.tsx +406 -0
- package/src/editors/ArchbaseLightGrid.tsx +538 -0
- package/src/editors/ArchbaseMentionInput.tsx +384 -0
- package/src/editors/ArchbaseMultiEmail.tsx +367 -0
- package/src/editors/ArchbaseMultiViewCalendar.tsx +439 -0
- package/src/editors/ArchbaseNumberStepper.tsx +219 -0
- package/src/editors/ArchbaseOTPInput.tsx +133 -0
- package/src/editors/ArchbaseOperationHoursEditor.tsx +1 -1
- package/src/editors/ArchbasePhoneInput.tsx +355 -0
- package/src/editors/ArchbaseRangeSlider.tsx +109 -0
- package/src/editors/ArchbaseSignaturePad.tsx +425 -0
- package/src/editors/ArchbaseSpeechToTextInput.tsx +444 -0
- package/src/editors/ArchbaseSpreadsheet.tsx +388 -0
- package/src/editors/ArchbaseTagInput.tsx +326 -0
- package/src/editors/index.tsx +92 -0
- package/src/feedback/ArchbaseChunkProgressBar.tsx +156 -0
- package/src/feedback/ArchbaseRipple.tsx +278 -0
- package/src/feedback/ArchbaseSkeleton.tsx +419 -0
- package/src/feedback/index.ts +22 -1
- package/src/filters/ArchbaseColumnSelector.tsx +268 -0
- package/src/filters/index.ts +2 -0
- package/src/forms/ArchbaseFieldArray.tsx +305 -0
- package/src/forms/ArchbaseFormWizard.tsx +284 -0
- package/src/forms/ArchbaseStepper.tsx +137 -0
- package/src/forms/index.ts +24 -2
- package/src/forms/useArchbaseFormWizard.ts +283 -0
- package/src/hooks/index.ts +12 -0
- package/src/hooks/useArchbaseConfirm.ts +293 -0
- package/src/image/editor/functions/image-processing.ts +5 -0
- package/src/image/editor/index.tsx +305 -391
- package/src/image/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/list/ArchbaseTreeList.tsx +422 -0
- package/src/list/index.ts +3 -0
- package/src/navigation/ArchbaseActionSheet.tsx +301 -0
- package/src/navigation/ArchbaseAppBar.tsx +233 -0
- package/src/navigation/ArchbaseBottomNavigation.tsx +243 -0
- package/src/navigation/ArchbaseContextMenu.tsx +298 -0
- package/src/navigation/ArchbaseKeyboardShortcuts.tsx +472 -0
- package/src/navigation/ArchbaseSpotlight.tsx +483 -0
- package/src/navigation/index.ts +48 -1
- package/src/notification/ArchbaseNotificationCenter.tsx +502 -0
- package/src/notification/index.ts +2 -0
- package/src/onboarding/ArchbaseOnboardingTour.tsx +229 -102
- package/src/viewers/ArchbaseDocViewer.tsx +584 -0
- package/src/viewers/ArchbasePdfBuilder.tsx +291 -0
- package/src/viewers/ArchbaseXmlViewer.tsx +142 -0
- package/src/viewers/index.ts +12 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { modals } from '@mantine/modals';
|
|
3
|
+
import { MantineColor } from '@mantine/core';
|
|
4
|
+
|
|
5
|
+
// =============================================================================
|
|
6
|
+
// Types
|
|
7
|
+
// =============================================================================
|
|
8
|
+
|
|
9
|
+
export interface ArchbaseConfirmOptions {
|
|
10
|
+
/** Título do modal */
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
/** Mensagem do modal */
|
|
13
|
+
message?: React.ReactNode;
|
|
14
|
+
/** Texto do botão confirmar */
|
|
15
|
+
confirmLabel?: string;
|
|
16
|
+
/** Texto do botão cancelar */
|
|
17
|
+
cancelLabel?: string;
|
|
18
|
+
/** Cor do botão confirmar */
|
|
19
|
+
confirmColor?: MantineColor;
|
|
20
|
+
/** Cor do botão cancelar */
|
|
21
|
+
cancelColor?: MantineColor;
|
|
22
|
+
/** Callback ao confirmar */
|
|
23
|
+
onConfirm?: () => void;
|
|
24
|
+
/** Callback ao cancelar */
|
|
25
|
+
onCancel?: () => void;
|
|
26
|
+
/** Se o modal pode ser fechado clicando fora */
|
|
27
|
+
closeOnClickOutside?: boolean;
|
|
28
|
+
/** Se o modal pode ser fechado com ESC */
|
|
29
|
+
closeOnEscape?: boolean;
|
|
30
|
+
/** Centrar o modal */
|
|
31
|
+
centered?: boolean;
|
|
32
|
+
/** Tamanho do modal */
|
|
33
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
34
|
+
/** Ícone do modal */
|
|
35
|
+
icon?: React.ReactNode;
|
|
36
|
+
/** Agrupar botões */
|
|
37
|
+
groupProps?: Record<string, any>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface ArchbaseDeleteConfirmOptions extends Omit<ArchbaseConfirmOptions, 'confirmColor'> {
|
|
41
|
+
/** Nome do item a ser deletado */
|
|
42
|
+
itemName?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface UseArchbaseConfirmReturn {
|
|
46
|
+
/** Abre um modal de confirmação e retorna Promise<boolean> */
|
|
47
|
+
confirm: (options: ArchbaseConfirmOptions) => Promise<boolean>;
|
|
48
|
+
/** Abre um modal de confirmação de exclusão */
|
|
49
|
+
confirmDelete: (options?: ArchbaseDeleteConfirmOptions) => Promise<boolean>;
|
|
50
|
+
/** Abre um modal de alerta (apenas OK) */
|
|
51
|
+
alert: (options: Omit<ArchbaseConfirmOptions, 'cancelLabel' | 'onCancel'>) => Promise<void>;
|
|
52
|
+
/** Fecha todos os modais */
|
|
53
|
+
closeAll: () => void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// =============================================================================
|
|
57
|
+
// Default Labels (pt-BR)
|
|
58
|
+
// =============================================================================
|
|
59
|
+
|
|
60
|
+
const defaultLabels = {
|
|
61
|
+
confirm: 'Confirmar',
|
|
62
|
+
cancel: 'Cancelar',
|
|
63
|
+
ok: 'OK',
|
|
64
|
+
deleteTitle: 'Confirmar exclusão',
|
|
65
|
+
deleteMessage: 'Tem certeza que deseja excluir este item? Esta ação não pode ser desfeita.',
|
|
66
|
+
deleteConfirm: 'Excluir',
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// =============================================================================
|
|
70
|
+
// useArchbaseConfirm Hook
|
|
71
|
+
// =============================================================================
|
|
72
|
+
|
|
73
|
+
export function useArchbaseConfirm(): UseArchbaseConfirmReturn {
|
|
74
|
+
/**
|
|
75
|
+
* Abre um modal de confirmação genérico
|
|
76
|
+
*/
|
|
77
|
+
const confirm = useCallback((options: ArchbaseConfirmOptions): Promise<boolean> => {
|
|
78
|
+
return new Promise((resolve) => {
|
|
79
|
+
modals.openConfirmModal({
|
|
80
|
+
title: options.title || 'Confirmação',
|
|
81
|
+
children: options.message,
|
|
82
|
+
labels: {
|
|
83
|
+
confirm: options.confirmLabel || defaultLabels.confirm,
|
|
84
|
+
cancel: options.cancelLabel || defaultLabels.cancel,
|
|
85
|
+
},
|
|
86
|
+
confirmProps: {
|
|
87
|
+
color: options.confirmColor || 'blue',
|
|
88
|
+
},
|
|
89
|
+
cancelProps: {
|
|
90
|
+
color: options.cancelColor || 'gray',
|
|
91
|
+
variant: 'outline',
|
|
92
|
+
},
|
|
93
|
+
closeOnClickOutside: options.closeOnClickOutside ?? false,
|
|
94
|
+
closeOnEscape: options.closeOnEscape ?? true,
|
|
95
|
+
centered: options.centered ?? true,
|
|
96
|
+
size: options.size || 'sm',
|
|
97
|
+
groupProps: options.groupProps,
|
|
98
|
+
onConfirm: () => {
|
|
99
|
+
options.onConfirm?.();
|
|
100
|
+
resolve(true);
|
|
101
|
+
},
|
|
102
|
+
onCancel: () => {
|
|
103
|
+
options.onCancel?.();
|
|
104
|
+
resolve(false);
|
|
105
|
+
},
|
|
106
|
+
onClose: () => {
|
|
107
|
+
resolve(false);
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}, []);
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Abre um modal de confirmação de exclusão
|
|
115
|
+
*/
|
|
116
|
+
const confirmDelete = useCallback((options?: ArchbaseDeleteConfirmOptions): Promise<boolean> => {
|
|
117
|
+
const itemName = options?.itemName;
|
|
118
|
+
const message = options?.message || (
|
|
119
|
+
itemName
|
|
120
|
+
? `Tem certeza que deseja excluir "${itemName}"? Esta ação não pode ser desfeita.`
|
|
121
|
+
: defaultLabels.deleteMessage
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
return confirm({
|
|
125
|
+
title: options?.title || defaultLabels.deleteTitle,
|
|
126
|
+
message,
|
|
127
|
+
confirmLabel: options?.confirmLabel || defaultLabels.deleteConfirm,
|
|
128
|
+
cancelLabel: options?.cancelLabel || defaultLabels.cancel,
|
|
129
|
+
confirmColor: 'red',
|
|
130
|
+
cancelColor: options?.cancelColor,
|
|
131
|
+
onConfirm: options?.onConfirm,
|
|
132
|
+
onCancel: options?.onCancel,
|
|
133
|
+
closeOnClickOutside: options?.closeOnClickOutside,
|
|
134
|
+
closeOnEscape: options?.closeOnEscape,
|
|
135
|
+
centered: options?.centered,
|
|
136
|
+
size: options?.size,
|
|
137
|
+
icon: options?.icon,
|
|
138
|
+
});
|
|
139
|
+
}, [confirm]);
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Abre um modal de alerta (apenas OK)
|
|
143
|
+
*/
|
|
144
|
+
const alert = useCallback((options: Omit<ArchbaseConfirmOptions, 'cancelLabel' | 'onCancel'>): Promise<void> => {
|
|
145
|
+
return new Promise((resolve) => {
|
|
146
|
+
modals.openConfirmModal({
|
|
147
|
+
title: options.title || 'Aviso',
|
|
148
|
+
children: options.message,
|
|
149
|
+
labels: {
|
|
150
|
+
confirm: options.confirmLabel || defaultLabels.ok,
|
|
151
|
+
cancel: '', // Hidden
|
|
152
|
+
},
|
|
153
|
+
confirmProps: {
|
|
154
|
+
color: options.confirmColor || 'blue',
|
|
155
|
+
},
|
|
156
|
+
cancelProps: {
|
|
157
|
+
display: 'none',
|
|
158
|
+
},
|
|
159
|
+
closeOnClickOutside: options.closeOnClickOutside ?? true,
|
|
160
|
+
closeOnEscape: options.closeOnEscape ?? true,
|
|
161
|
+
centered: options.centered ?? true,
|
|
162
|
+
size: options.size || 'sm',
|
|
163
|
+
withCloseButton: true,
|
|
164
|
+
onConfirm: () => {
|
|
165
|
+
options.onConfirm?.();
|
|
166
|
+
resolve();
|
|
167
|
+
},
|
|
168
|
+
onClose: () => {
|
|
169
|
+
resolve();
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}, []);
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Fecha todos os modais abertos
|
|
177
|
+
*/
|
|
178
|
+
const closeAll = useCallback(() => {
|
|
179
|
+
modals.closeAll();
|
|
180
|
+
}, []);
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
confirm,
|
|
184
|
+
confirmDelete,
|
|
185
|
+
alert,
|
|
186
|
+
closeAll,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// =============================================================================
|
|
191
|
+
// Standalone Functions (for use without hook)
|
|
192
|
+
// =============================================================================
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Abre um modal de confirmação (uso imperativo sem hook)
|
|
196
|
+
*/
|
|
197
|
+
export function archbaseConfirm(options: ArchbaseConfirmOptions): Promise<boolean> {
|
|
198
|
+
return new Promise((resolve) => {
|
|
199
|
+
modals.openConfirmModal({
|
|
200
|
+
title: options.title || 'Confirmação',
|
|
201
|
+
children: options.message,
|
|
202
|
+
labels: {
|
|
203
|
+
confirm: options.confirmLabel || defaultLabels.confirm,
|
|
204
|
+
cancel: options.cancelLabel || defaultLabels.cancel,
|
|
205
|
+
},
|
|
206
|
+
confirmProps: {
|
|
207
|
+
color: options.confirmColor || 'blue',
|
|
208
|
+
},
|
|
209
|
+
cancelProps: {
|
|
210
|
+
color: options.cancelColor || 'gray',
|
|
211
|
+
variant: 'outline',
|
|
212
|
+
},
|
|
213
|
+
closeOnClickOutside: options.closeOnClickOutside ?? false,
|
|
214
|
+
closeOnEscape: options.closeOnEscape ?? true,
|
|
215
|
+
centered: options.centered ?? true,
|
|
216
|
+
size: options.size || 'sm',
|
|
217
|
+
onConfirm: () => {
|
|
218
|
+
options.onConfirm?.();
|
|
219
|
+
resolve(true);
|
|
220
|
+
},
|
|
221
|
+
onCancel: () => {
|
|
222
|
+
options.onCancel?.();
|
|
223
|
+
resolve(false);
|
|
224
|
+
},
|
|
225
|
+
onClose: () => {
|
|
226
|
+
resolve(false);
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Abre um modal de confirmação de exclusão (uso imperativo)
|
|
234
|
+
*/
|
|
235
|
+
export function archbaseConfirmDelete(options?: ArchbaseDeleteConfirmOptions): Promise<boolean> {
|
|
236
|
+
const itemName = options?.itemName;
|
|
237
|
+
const message = options?.message || (
|
|
238
|
+
itemName
|
|
239
|
+
? `Tem certeza que deseja excluir "${itemName}"? Esta ação não pode ser desfeita.`
|
|
240
|
+
: defaultLabels.deleteMessage
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
return archbaseConfirm({
|
|
244
|
+
title: options?.title || defaultLabels.deleteTitle,
|
|
245
|
+
message,
|
|
246
|
+
confirmLabel: options?.confirmLabel || defaultLabels.deleteConfirm,
|
|
247
|
+
cancelLabel: options?.cancelLabel || defaultLabels.cancel,
|
|
248
|
+
confirmColor: 'red',
|
|
249
|
+
cancelColor: options?.cancelColor,
|
|
250
|
+
onConfirm: options?.onConfirm,
|
|
251
|
+
onCancel: options?.onCancel,
|
|
252
|
+
closeOnClickOutside: options?.closeOnClickOutside,
|
|
253
|
+
closeOnEscape: options?.closeOnEscape,
|
|
254
|
+
centered: options?.centered,
|
|
255
|
+
size: options?.size,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Abre um modal de alerta (uso imperativo)
|
|
261
|
+
*/
|
|
262
|
+
export function archbaseAlert(options: Omit<ArchbaseConfirmOptions, 'cancelLabel' | 'onCancel'>): Promise<void> {
|
|
263
|
+
return new Promise((resolve) => {
|
|
264
|
+
modals.openConfirmModal({
|
|
265
|
+
title: options.title || 'Aviso',
|
|
266
|
+
children: options.message,
|
|
267
|
+
labels: {
|
|
268
|
+
confirm: options.confirmLabel || defaultLabels.ok,
|
|
269
|
+
cancel: '',
|
|
270
|
+
},
|
|
271
|
+
confirmProps: {
|
|
272
|
+
color: options.confirmColor || 'blue',
|
|
273
|
+
},
|
|
274
|
+
cancelProps: {
|
|
275
|
+
display: 'none',
|
|
276
|
+
},
|
|
277
|
+
closeOnClickOutside: options.closeOnClickOutside ?? true,
|
|
278
|
+
closeOnEscape: options.closeOnEscape ?? true,
|
|
279
|
+
centered: options.centered ?? true,
|
|
280
|
+
size: options.size || 'sm',
|
|
281
|
+
withCloseButton: true,
|
|
282
|
+
onConfirm: () => {
|
|
283
|
+
options.onConfirm?.();
|
|
284
|
+
resolve();
|
|
285
|
+
},
|
|
286
|
+
onClose: () => {
|
|
287
|
+
resolve();
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export default useArchbaseConfirm;
|
|
@@ -43,7 +43,12 @@ export const convertImageUsingCanvas = (
|
|
|
43
43
|
ctx.filter = processFilter(state.basicFilters);
|
|
44
44
|
}
|
|
45
45
|
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
46
|
+
// Normalizar formato (jpg -> jpeg) para compatibilidade com canvas.toDataURL
|
|
46
47
|
let type = state.format;
|
|
48
|
+
if (type === 'jpg') {
|
|
49
|
+
type = 'jpeg';
|
|
50
|
+
}
|
|
51
|
+
// Para JPEG e WEBP, usar a qualidade especificada; PNG ignora o parâmetro de qualidade
|
|
47
52
|
var dataURI = canvas.toDataURL(`image/${type}`, quality);
|
|
48
53
|
// console.log("🚀 ~ file: image-processing.ts ~ line 48 ~ returnnewPromise ~ quality", quality)
|
|
49
54
|
resolve({
|