ngx-vector-components 6.17.1 → 6.18.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/CHANGELOG.md
CHANGED
|
@@ -4428,6 +4428,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
|
|
|
4428
4428
|
args: [FiltersComponent, { static: true }]
|
|
4429
4429
|
}] } });
|
|
4430
4430
|
|
|
4431
|
+
const INPUT_FILE_ACCEPT_EXTENSIONS = [
|
|
4432
|
+
'PDF',
|
|
4433
|
+
'DOC',
|
|
4434
|
+
'DOCX',
|
|
4435
|
+
'XLS',
|
|
4436
|
+
'XLSX',
|
|
4437
|
+
'PPT',
|
|
4438
|
+
'PPTX',
|
|
4439
|
+
'TXT',
|
|
4440
|
+
'CSV',
|
|
4441
|
+
'RTF',
|
|
4442
|
+
'JPG',
|
|
4443
|
+
'JPEG',
|
|
4444
|
+
'PNG',
|
|
4445
|
+
'GIF',
|
|
4446
|
+
'BMP',
|
|
4447
|
+
'WEBP',
|
|
4448
|
+
'SVG',
|
|
4449
|
+
'ZIP',
|
|
4450
|
+
'RAR',
|
|
4451
|
+
'JSON',
|
|
4452
|
+
'XML',
|
|
4453
|
+
];
|
|
4431
4454
|
const UPLOAD_BUTTON_ATTACH_DEFAULTS = {
|
|
4432
4455
|
label: 'Anexar',
|
|
4433
4456
|
type: 'default-filled',
|
|
@@ -4502,7 +4525,11 @@ class InputFileComponent {
|
|
|
4502
4525
|
this.uploadType = 'single';
|
|
4503
4526
|
/** Formato salvo em `convertedData`: `'base64'` (data URL string) ou `'formData'` (FormData pronto para POST). Default: `'formData'`. */
|
|
4504
4527
|
this.uploadFormat = 'formData';
|
|
4505
|
-
/**
|
|
4528
|
+
/**
|
|
4529
|
+
* Extensões aceitas, ex: `['PDF', 'JPG']` (vira `accept=".pdf,.jpg"`). Arquivos com outra extensão
|
|
4530
|
+
* são bloqueados na seleção, com toast de aviso. Array vazio = aceita qualquer extensão
|
|
4531
|
+
* de {@link INPUT_FILE_ACCEPT_EXTENSIONS}.
|
|
4532
|
+
*/
|
|
4506
4533
|
this.acceptExtensions = [];
|
|
4507
4534
|
/** Tamanho máximo por arquivo em **MB** (ex: `5` = 5MB). `null` = sem limite. Convertido internamente pra bytes. */
|
|
4508
4535
|
this.maxFileSize = null;
|
|
@@ -4592,7 +4619,15 @@ class InputFileComponent {
|
|
|
4592
4619
|
}
|
|
4593
4620
|
// ─── Config conversion ───────────────────────────────────
|
|
4594
4621
|
get acceptString() {
|
|
4595
|
-
return
|
|
4622
|
+
return this.allowedExtensions.map((ext) => `.${ext.toLowerCase()}`).join(',');
|
|
4623
|
+
}
|
|
4624
|
+
/**
|
|
4625
|
+
* Extensões efetivamente aceitas: as configuradas em `acceptExtensions` ou, quando nada
|
|
4626
|
+
* foi configurado, todas as que o componente suporta.
|
|
4627
|
+
*/
|
|
4628
|
+
get allowedExtensions() {
|
|
4629
|
+
const configured = this.acceptExtensions ?? [];
|
|
4630
|
+
return configured.length > 0 ? configured : INPUT_FILE_ACCEPT_EXTENSIONS;
|
|
4596
4631
|
}
|
|
4597
4632
|
get maxFileSizeBytes() {
|
|
4598
4633
|
const mb = this.maxFileSize ?? 0;
|
|
@@ -4666,7 +4701,7 @@ class InputFileComponent {
|
|
|
4666
4701
|
const selected = Array.from(event?.files ?? []);
|
|
4667
4702
|
if (selected.length === 0)
|
|
4668
4703
|
return;
|
|
4669
|
-
const files = this.rejectOversizedFiles(selected);
|
|
4704
|
+
const files = this.rejectOversizedFiles(this.rejectDisallowedExtensions(selected));
|
|
4670
4705
|
if (files.length === 0)
|
|
4671
4706
|
return;
|
|
4672
4707
|
if (this.uploadType === 'single') {
|
|
@@ -4767,6 +4802,31 @@ class InputFileComponent {
|
|
|
4767
4802
|
targetInput.multiple = this.uploadType === 'multiple';
|
|
4768
4803
|
targetInput.click();
|
|
4769
4804
|
}
|
|
4805
|
+
rejectDisallowedExtensions(files) {
|
|
4806
|
+
const allowed = new Set(this.allowedExtensions.map((ext) => ext.toLowerCase()));
|
|
4807
|
+
const rejected = files.filter((file) => !allowed.has(this.normalizedExtension(file.name)));
|
|
4808
|
+
if (rejected.length > 0)
|
|
4809
|
+
this.notifyDisallowedExtensions(rejected);
|
|
4810
|
+
return files.filter((file) => allowed.has(this.normalizedExtension(file.name)));
|
|
4811
|
+
}
|
|
4812
|
+
notifyDisallowedExtensions(files) {
|
|
4813
|
+
const hasConfiguredExtensions = (this.acceptExtensions ?? []).length > 0;
|
|
4814
|
+
const extensions = this.allowedExtensions.join(', ');
|
|
4815
|
+
this.messageService?.add({
|
|
4816
|
+
severity: MessageStatus.WARN,
|
|
4817
|
+
summary: files.length === 1 ? 'Extensão não permitida' : 'Extensões não permitidas',
|
|
4818
|
+
detail: hasConfiguredExtensions
|
|
4819
|
+
? `${this.fileNameList(files)} — ${files.length === 1 ? 'só é aceito' : 'só são aceitos'} ${extensions}.`
|
|
4820
|
+
: `${this.fileNameList(files)} — o componente aceita apenas ${extensions}.`,
|
|
4821
|
+
life: WARNING_TOAST_LIFE_MS,
|
|
4822
|
+
});
|
|
4823
|
+
}
|
|
4824
|
+
fileNameList(files) {
|
|
4825
|
+
return files.map((file) => file.name).join(', ');
|
|
4826
|
+
}
|
|
4827
|
+
normalizedExtension(filename) {
|
|
4828
|
+
return this.extractExtension(filename).replace('.', '').toLowerCase();
|
|
4829
|
+
}
|
|
4770
4830
|
/** Descarta os arquivos que excedem `maxFileSize` e notifica o usuário. */
|
|
4771
4831
|
rejectOversizedFiles(files) {
|
|
4772
4832
|
const maxBytes = this.maxFileSizeBytes;
|
|
@@ -6813,5 +6873,5 @@ const getSelectedCrudItemResolver = (routeSnapshot) => {
|
|
|
6813
6873
|
* Generated bundle index. Do not edit.
|
|
6814
6874
|
*/
|
|
6815
6875
|
|
|
6816
|
-
export { APP_NAME, AppName, AuthService, BadgeComponent, BadgeModule, BooleanType, BreadcrumbComponent, BreadcrumbModule, BreadcrumbService, ButtonComponent, CalendarComponent, CheckboxFieldComponent, CpfCnpjValidator, CrudBaseComponent, CrudBaseService, CrudFooterComponent, CrudHeaderComponent, CrudHeaderModule, CrudHistory, CrudHistoryComponent, CrudHistoryModule, CrudMode, CurrencyBrlPipe, CurrencyFieldComponent, DataTableComponent, DocumentType, DrawerComponent, DrawerModule, DropdownFieldComponent, ENVIRONMENT, EnumService, ErrorMessageService, FieldErrorMessageComponent, FieldType, FieldsModule, FileUtil, FiltersComponent, FooterModule, FormatDocumentPipe, GenericErrorModalComponent, GenericErrorModalModule, GenericModalComponent, GenericModalModule, GeolocationService, HttpInterceptorProvider, InputFileComponent, InputNumberFieldComponent, InputOtpComponent, InputSwitchFieldComponent, LoadingService, MENU_OPTIONS, MaskPipe, MaskUtil, MenuComponent, MenuModule, MenuService, MessageStatus, ModalService, MultiselectFieldComponent, NotHiddenPipe, NotificationsService, ObjectUtil, OnlyActivePipe, PanelComponent, PanelModule, PercentageFieldComponent, PipesModule, ProfileModuleActionType, ProfileModuleType, ProfileService, ProfileTypeEnum, RadioButtonFieldComponent, RangeValueComponent, RemoveLastChildPipe, Role, ScoreComponent, ScoreModule, SearchFieldComponent, SelectButtonFieldComponent, SelectionType, SnackbarComponent, SnackbarModule, Status, StepperComponent, StepperModule, StorageService, StringUtil, SubMenusListComponent, TableColumnType, TextFieldComponent, TextareaFieldComponent, TopBarComponent, TopBarModule, UnreadNotificationsPipe, ValidationUtil, VectorPreset, View, WindowUtil, createUploadMultipleForm, createUploadSingleForm, crudListHasItemsGuard, getSelectedCrudItemResolver, getTokenByGuidGuard, hasPermissionGuard, provideVectorPrimeNG, roleGuard, tokenIsPresentGuard };
|
|
6876
|
+
export { APP_NAME, AppName, AuthService, BadgeComponent, BadgeModule, BooleanType, BreadcrumbComponent, BreadcrumbModule, BreadcrumbService, ButtonComponent, CalendarComponent, CheckboxFieldComponent, CpfCnpjValidator, CrudBaseComponent, CrudBaseService, CrudFooterComponent, CrudHeaderComponent, CrudHeaderModule, CrudHistory, CrudHistoryComponent, CrudHistoryModule, CrudMode, CurrencyBrlPipe, CurrencyFieldComponent, DataTableComponent, DocumentType, DrawerComponent, DrawerModule, DropdownFieldComponent, ENVIRONMENT, EnumService, ErrorMessageService, FieldErrorMessageComponent, FieldType, FieldsModule, FileUtil, FiltersComponent, FooterModule, FormatDocumentPipe, GenericErrorModalComponent, GenericErrorModalModule, GenericModalComponent, GenericModalModule, GeolocationService, HttpInterceptorProvider, INPUT_FILE_ACCEPT_EXTENSIONS, InputFileComponent, InputNumberFieldComponent, InputOtpComponent, InputSwitchFieldComponent, LoadingService, MENU_OPTIONS, MaskPipe, MaskUtil, MenuComponent, MenuModule, MenuService, MessageStatus, ModalService, MultiselectFieldComponent, NotHiddenPipe, NotificationsService, ObjectUtil, OnlyActivePipe, PanelComponent, PanelModule, PercentageFieldComponent, PipesModule, ProfileModuleActionType, ProfileModuleType, ProfileService, ProfileTypeEnum, RadioButtonFieldComponent, RangeValueComponent, RemoveLastChildPipe, Role, ScoreComponent, ScoreModule, SearchFieldComponent, SelectButtonFieldComponent, SelectionType, SnackbarComponent, SnackbarModule, Status, StepperComponent, StepperModule, StorageService, StringUtil, SubMenusListComponent, TableColumnType, TextFieldComponent, TextareaFieldComponent, TopBarComponent, TopBarModule, UnreadNotificationsPipe, ValidationUtil, VectorPreset, View, WindowUtil, createUploadMultipleForm, createUploadSingleForm, crudListHasItemsGuard, getSelectedCrudItemResolver, getTokenByGuidGuard, hasPermissionGuard, provideVectorPrimeNG, roleGuard, tokenIsPresentGuard };
|
|
6817
6877
|
//# sourceMappingURL=ngx-vector-components.mjs.map
|