structra-ui 0.1.78 → 0.1.79

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "structra-ui",
3
- "version": "0.1.78",
3
+ "version": "0.1.79",
4
4
  "description": "Biblioteca de componentes Angular da StructraLab (UI reutilizável).",
5
5
  "homepage": "https://structralab.com/",
6
6
  "license": "MIT",
@@ -4,6 +4,7 @@ import { ControlValueAccessor, AbstractControl, NgControl, ValidatorFn } from '@
4
4
  import { MatDatepicker } from '@angular/material/datepicker';
5
5
  import * as _angular_cdk_overlay from '@angular/cdk/overlay';
6
6
  import { ConnectedPosition, ScrollStrategy, OverlayRef } from '@angular/cdk/overlay';
7
+ import { SafeResourceUrl } from '@angular/platform-browser';
7
8
  import { ICellRendererParams, ColDef, GetRowIdParams, GridReadyEvent } from 'ag-grid-community';
8
9
  import { ICellRendererAngularComp } from 'ag-grid-angular';
9
10
  import { DialogRef } from '@angular/cdk/dialog';
@@ -16,7 +17,12 @@ declare enum BaseButtonVariant {
16
17
  Primary = "primary",
17
18
  Secondary = "secondary",
18
19
  /** Texto/ícone sem caixa — navegação secundária, “link” com aparência de botão acessível. */
19
- Ghost = "ghost"
20
+ Ghost = "ghost",
21
+ /**
22
+ * Ação destrutiva / apagar: tokens de erro do tema
23
+ * (`--app-color-error*`), mesmo padrão em toda a lib.
24
+ */
25
+ Danger = "danger"
20
26
  }
21
27
  declare enum BaseButtonType {
22
28
  Button = "button",
@@ -1237,6 +1243,187 @@ interface DropdownListBindings<T = unknown> {
1237
1243
  compareWith: (a: unknown, b: unknown) => boolean;
1238
1244
  }
1239
1245
 
1246
+ declare class FileUploadFieldComponent implements OnChanges, OnDestroy {
1247
+ private readonly cdr;
1248
+ private readonly confirmDialog;
1249
+ label?: string | undefined;
1250
+ hint?: string | undefined;
1251
+ accept?: string | undefined;
1252
+ /** Se definido, mostra-se no drop zone em vez do texto formatado a partir de `accept`. */
1253
+ acceptLabel?: string | undefined;
1254
+ maxSizeMb: number;
1255
+ /**
1256
+ * Limite de arquivos no total (só aplica com `multiple`).
1257
+ * `0` = sem limite; ao exceder, o excedente é rejeitado e emite `fileRejected`.
1258
+ */
1259
+ maxFiles: number;
1260
+ disabled: boolean;
1261
+ multiple: boolean;
1262
+ value: File | File[] | null;
1263
+ /**
1264
+ * `false` desativa o `pointer` e a emissão de `fileItemClick` na linha, mesmo com o
1265
+ * evento ligado (ex. lista só com um ficheiro). Omissão = `true`.
1266
+ */
1267
+ fileItemRowClickable: boolean;
1268
+ /**
1269
+ * Botão «Download» em cada linha. Omissão = `true`. Use `false` para esconder (ex.: anexos no form exemplo).
1270
+ */
1271
+ showFileDownload: boolean;
1272
+ readonly valueChange: EventEmitter<File | File[] | null>;
1273
+ readonly fileRejected: EventEmitter<{
1274
+ file: File;
1275
+ reason: string;
1276
+ }>;
1277
+ /**
1278
+ * Clique na linha da lista (ficheiro). Só aplica `cursor: pointer` com subscrição
1279
+ * a este evento e `fileItemRowClickable !== false`.
1280
+ */
1281
+ readonly fileItemClick: EventEmitter<File>;
1282
+ private fileInputRef?;
1283
+ readonly fieldId: string;
1284
+ isDragging: boolean;
1285
+ hasHover: boolean;
1286
+ private internalError;
1287
+ /** `URL.createObjectURL` por `File` ativo; revogado ao trocar valor ou destruir. */
1288
+ private readonly filePreviewObjectUrls;
1289
+ ngOnChanges(c: SimpleChanges): void;
1290
+ ngOnDestroy(): void;
1291
+ get errorMessage(): string | null;
1292
+ /** Texto de formatos na zona: `acceptLabel` (opcional) ou `formatAcceptForDisplay(accept)`. */
1293
+ get acceptDisplayText(): string;
1294
+ /**
1295
+ * Linha clicável para o painel externo (ex. pré-visualização) quando a app liga
1296
+ * `(fileItemClick)`; desligado, sem apontador nem emissão.
1297
+ */
1298
+ get fileItemClickActive(): boolean;
1299
+ private get hasFileItemClickListeners();
1300
+ onFileItemRowClick(event: MouseEvent, file: File): void;
1301
+ /** `src` da miniatura, ou `null` se não for imagem / ainda sem URL. */
1302
+ imageListPreviewUrl(file: File): string | null;
1303
+ get filesList(): {
1304
+ file: File;
1305
+ name: string;
1306
+ sizeLabel: string;
1307
+ typeLabel: string;
1308
+ }[];
1309
+ get hasValue(): boolean;
1310
+ /**
1311
+ * «Limpar tudo» só com mais do que um ficheiro; com um só, basta «Remover» na linha.
1312
+ */
1313
+ get showClearAllButton(): boolean;
1314
+ private get selectedFileCountForClearConfirm();
1315
+ private resetInputValue;
1316
+ openSelector(ev?: Event): void;
1317
+ onZoneEnter(): void;
1318
+ onZoneLeave(): void;
1319
+ onZoneKeydown(ev: KeyboardEvent): void;
1320
+ onDragOver(ev: DragEvent): void;
1321
+ onDragLeave(ev: DragEvent): void;
1322
+ onDrop(ev: DragEvent): void;
1323
+ onNativeChange(ev: Event): void;
1324
+ onRemoveFile(index: number, ev: Event): void;
1325
+ onDownloadFile(file: File, event: Event): void;
1326
+ clearAll(ev: Event): Promise<void>;
1327
+ private clearInternal;
1328
+ private msgAfterRejections;
1329
+ private processPickedArray;
1330
+ private allFilesInValue;
1331
+ private syncFilePreviewObjectUrls;
1332
+ private releaseAllFilePreviewObjectUrls;
1333
+ static ɵfac: i0.ɵɵFactoryDeclaration<FileUploadFieldComponent, never>;
1334
+ static ɵcmp: i0.ɵɵComponentDeclaration<FileUploadFieldComponent, "app-file-upload-field", never, { "label": { "alias": "label"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; "accept": { "alias": "accept"; "required": false; }; "acceptLabel": { "alias": "acceptLabel"; "required": false; }; "maxSizeMb": { "alias": "maxSizeMb"; "required": false; }; "maxFiles": { "alias": "maxFiles"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "value": { "alias": "value"; "required": false; }; "fileItemRowClickable": { "alias": "fileItemRowClickable"; "required": false; }; "showFileDownload": { "alias": "showFileDownload"; "required": false; }; }, { "valueChange": "valueChange"; "fileRejected": "fileRejected"; "fileItemClick": "fileItemClick"; }, never, never, true, never>;
1335
+ static ngAcceptInputType_maxSizeMb: unknown;
1336
+ static ngAcceptInputType_maxFiles: unknown;
1337
+ static ngAcceptInputType_disabled: unknown;
1338
+ static ngAcceptInputType_multiple: unknown;
1339
+ static ngAcceptInputType_fileItemRowClickable: unknown;
1340
+ }
1341
+
1342
+ /**
1343
+ * Valida se um arquivo corresponde a um atributo `accept` (HTML) simples.
1344
+ * Ex.: `image/*`, `image/png`, `.pdf`, `image/*,.pdf`
1345
+ */
1346
+ declare function fileMatchesAccept(file: File, accept: string | undefined | null): boolean;
1347
+ /**
1348
+ * Diz se o ficheiro deve ser tratado como imagem (miniatura no upload).
1349
+ * Usa `type` e, se vazio, a extensão (útil com MIME vazio nalguns browsers / SO).
1350
+ */
1351
+ declare function fileIsLikelyImage(file: File): boolean;
1352
+ /** Indica o tipo de pré-visualização possível no painel a partir de um `File` local. */
1353
+ type FilePreviewKind = 'image' | 'pdf' | 'unsupported';
1354
+ declare const FILE_PREVIEW_UNAVAILABLE_MESSAGE = "N\u00E3o foi poss\u00EDvel abrir a pr\u00E9-visualiza\u00E7\u00E3o.";
1355
+ /**
1356
+ * Fragmento URL para o leitor de PDF do browser em `<iframe>` (p.ex. blob:).
1357
+ * Esconde o painel lateral (miniaturas), mantém a barra de cima e ajusta a área principal à largura
1358
+ * (parâmetros de abertura alinhados ao leitor do Chromium; outros browsers podem interpretar de forma aproximada).
1359
+ */
1360
+ declare const PDF_IFRAME_VIEWER_HASH = "navpanes=0&toolbar=1&view=FitH";
1361
+ /**
1362
+ * Anexa ao fim de uma URL de recurso PDF o fragmento que pedia pré-visualização só com a área principal
1363
+ * (sem barra lateral). Se já existir `#`, devolve a URL inalterada.
1364
+ */
1365
+ declare function appendPdfIframeViewerParams(resourceUrl: string): string;
1366
+ declare function getFilePreviewKind(file: File): FilePreviewKind;
1367
+ declare function formatFileSizeBytes(bytes: number): string;
1368
+ /**
1369
+ * Converte o valor do atributo `accept` (vírgulas, MIME, extensões) numa linha legível
1370
+ * (ex.: «Imagens · PDF · Word»), usada no rótulo de formatos do drop zone.
1371
+ */
1372
+ declare function formatAcceptForDisplay(accept: string | null | undefined): string;
1373
+
1374
+ /**
1375
+ * Painel reutilizável de pré-visualização (imagem, PDF com blob, URL remota, vazio
1376
+ * ou aviso único se não for possível pré-visualizar).
1377
+ */
1378
+ declare class ImagePreviewPanelComponent implements OnChanges, OnDestroy {
1379
+ private readonly cdr;
1380
+ private readonly sanitizer;
1381
+ title?: string | undefined;
1382
+ subtitle?: string | undefined;
1383
+ imageUrl?: string | null;
1384
+ file?: File | null;
1385
+ emptyText?: string | undefined;
1386
+ loading: boolean;
1387
+ rounded: boolean;
1388
+ showImageActions: boolean;
1389
+ objectFit: 'cover' | 'contain';
1390
+ readonly remove: EventEmitter<void>;
1391
+ readonly change: EventEmitter<void>;
1392
+ readonly BaseButtonType: typeof BaseButtonType;
1393
+ readonly BaseButtonVariant: typeof BaseButtonVariant;
1394
+ /** Mensagem reutilizada: falha de carga, tipo não suportado, etc. */
1395
+ readonly previewUnavailableMessage = "N\u00E3o foi poss\u00EDvel abrir a pr\u00E9-visualiza\u00E7\u00E3o.";
1396
+ /** `blob:` a revogar ao trocar ou destruir. */
1397
+ private fileObjectUrl;
1398
+ /** Só `image` local ou `imageUrl` remota. */
1399
+ displaySrc: string | null;
1400
+ imageLoadError: boolean;
1401
+ /** PDF a partir de `File` (URL sanitizada). */
1402
+ safePdfUrl: SafeResourceUrl | null;
1403
+ pdfLoadError: boolean;
1404
+ /** `file` local: imagem, PDF ou não suportado; remoto vindo de `imageUrl` só. */
1405
+ fileKind: FilePreviewKind | 'remote';
1406
+ ngOnChanges(c: SimpleChanges): void;
1407
+ ngOnDestroy(): void;
1408
+ onImgError(): void;
1409
+ onImgLoad(): void;
1410
+ onPdfFrameError(): void;
1411
+ onTrocar(): void;
1412
+ onRemover(): void;
1413
+ get showImage(): boolean;
1414
+ get showPdf(): boolean;
1415
+ get showPreviewFallback(): boolean;
1416
+ get showEmpty(): boolean;
1417
+ get showActions(): boolean;
1418
+ private updateDisplaySource;
1419
+ private revokeFileObjectUrl;
1420
+ static ɵfac: i0.ɵɵFactoryDeclaration<ImagePreviewPanelComponent, never>;
1421
+ static ɵcmp: i0.ɵɵComponentDeclaration<ImagePreviewPanelComponent, "app-image-preview-panel", never, { "title": { "alias": "title"; "required": false; }; "subtitle": { "alias": "subtitle"; "required": false; }; "imageUrl": { "alias": "imageUrl"; "required": false; }; "file": { "alias": "file"; "required": false; }; "emptyText": { "alias": "emptyText"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "rounded": { "alias": "rounded"; "required": false; }; "showImageActions": { "alias": "showImageActions"; "required": false; }; "objectFit": { "alias": "objectFit"; "required": false; }; }, { "remove": "remove"; "change": "change"; }, never, never, true, never>;
1422
+ static ngAcceptInputType_loading: unknown;
1423
+ static ngAcceptInputType_rounded: unknown;
1424
+ static ngAcceptInputType_showImageActions: unknown;
1425
+ }
1426
+
1240
1427
  /** Espaçamento entre itens da linha ou da pilha dentro de uma coluna. */
1241
1428
  declare enum FormLayoutGap {
1242
1429
  Xs = "xs",
@@ -3130,5 +3317,5 @@ declare class AppBreadcrumbComponent {
3130
3317
  static ɵcmp: i0.ɵɵComponentDeclaration<AppBreadcrumbComponent, "app-breadcrumb", never, { "items": { "alias": "items"; "required": true; }; }, {}, never, never, true, never>;
3131
3318
  }
3132
3319
 
3133
- export { ADAPTIVE_DATA_VIEW_MOBILE_QUERY, APP_SIDEBAR_LABEL_REVEAL_LAG_MS, APP_SIDEBAR_LAYOUT_DURATION_MS, APP_SIDEBAR_NAV_REVEAL_TOTAL_MS, APP_THEME_IDS, ActionMenuComponent, AdaptiveDataViewComponent, AnchoredOverlayComponent, AppBreadcrumbComponent, AppDialogComponent, AppLibLightBlockScrollStrategy, AppShellComponent, AppShellSidebarTemplateDirective, AppShellSidebarToggleComponent, AppSidebarComponent, AppSidebarToolbarDirective, AppTheme, AppThemeService, AppTopbarComponent, AppUserMenuComponent, BR_ESTADOS_NOME_SIGLA, BaseButtonType, BaseButtonVariant, BaseFieldComponent, BaseFieldDirective, BooleanFieldDirective, ButtonComponent, CardListComponent, CepFieldComponent, CheckboxFieldComponent, ConfirmDialogComponent, ConfirmDialogService, ContextMenuComponent, CpfCnpjFieldComponent, DashboardSectionComponent, DataCardComponent, DataGridComponent, DataListComponent, DataToolbarComponent, DateFieldComponent, DecimalFieldComponent, DetailsFieldComponent, DetailsViewComponent, DialogFooterDirective, DrawerComponent, DrawerSide, DrawerSize, DropdownBaseComponent, DropdownMenuComponent, DropdownMultiOptionFieldBase, DropdownOptionFieldBase, DropdownSearchFieldComponent, EmptyStateComponent, FormActionsAlign, FormActionsComponent, FormColComponent, FormGroupComponent, FormGroupVariant, FormLayoutGap, FormRowAlign, FormRowComponent, FormRowJustify, FormSectionComponent, FormTabComponent, FormTabsComponent, InputMaskFieldComponent, IntegerFieldComponent, LAYOUT_STACK_SIDE_BY_SIDE, LAYOUT_STACK_STACKED, LayoutStackAlign, LayoutStackComponent, LayoutStackDirection, LayoutStackItemAlign, LibDialogSize, ListItemComponent, LoadingDialogComponent, LoadingDialogService, MaskedTextFieldBase, MenuDividerComponent, MenuDropdownPlacement, MenuGroupComponent, MenuListComponent, MultiselectFieldComponent, NgControlFieldDirective, OverlayPlacement, PasswordFieldComponent, PhoneFieldComponent, PopoverBodyTemplateDirective, PopoverComponent, PopoverFooterTemplateDirective, PopoverTriggerDirective, STRUCTRA_UI, SelectFieldComponent, SkeletonBlockComponent, SkeletonCardComponent, SkeletonFieldShellComponent, SkeletonListComponent, SkeletonTableComponent, SkeletonTextComponent, StatCardComponent, StatusBadgeComponent, SwitchFieldComponent, TableEmptyStateComponent, TableToolbarComponent, TextFieldComponent, TextareaFieldComponent, ToastHostComponent, ToastService, TooltipComponent, TooltipPanelTemplateDirective, ValidationSummaryComponent, anchoredOverlayPositions, applyPickedCalendarDate, buildDecimalBrDisplay, buildDecimalBrParseString, buildEmptyStateOverlayHtml, caretIndexFromIntegerDigitCount, caretIndexFromSemantic, cepMaskCompleteValidator, cpfCnpjMaskCompleteValidator, escapeHtml, extractDecimalBrParts, fixedDigitsMaskCompleteValidator, formatDateTimePtBr, formatDecimalBr, formatIntegerThousandsBr, formatMaskDigits, formatUiFieldDateValue, libDialogPanelClasses, mapEstadosToOptions, maskDigitCount, normalizeFormDateValue, parseDecimalBr, parseIntegerString, parseUiFieldDateValue, phoneBrMaskCompleteValidator, resolveControlAtPath, sanitizeDecimalBrInput, sanitizeIntegerDigits, sectionHasVisibleInvalid, semanticCaretAt, semanticIntegerDigitCountLeft, stripToDigits, subscribeMarkForCheckOnInvalidUiRefresh, subtreeHasVisibleInvalid };
3134
- export type { AdaptiveDataViewMode, AppThemeId, AppThemeOption, BreadcrumbItem, CardItemView, CardListDataMode, CardListMapFn, ConfirmDialogData, ConfirmDialogVariant, DataGridColumn, DataGridPaginationChangeEvent, DetailsViewItem, DropdownListBindings, DropdownSearchPageRequested, FieldCommonInputs, FormTabsVariant, LoadingDialogData, MenuItemAction, MenuItemDivider, MenuItemGroup, MenuItemKind, MenuItemSubmenu, MenuLeafItem, MenuNodeItem, SelectPageRequested, SkeletonFieldShellVariant, StatCardDeltaTone, StatusBadgeSize, StatusBadgeVariant, ToastInstance, ToastShowOptions, ToastType, ToastVerticalPosition, UiSelectOption, ValidationSummaryItem, ValidationSummaryVariant };
3320
+ export { ADAPTIVE_DATA_VIEW_MOBILE_QUERY, APP_SIDEBAR_LABEL_REVEAL_LAG_MS, APP_SIDEBAR_LAYOUT_DURATION_MS, APP_SIDEBAR_NAV_REVEAL_TOTAL_MS, APP_THEME_IDS, ActionMenuComponent, AdaptiveDataViewComponent, AnchoredOverlayComponent, AppBreadcrumbComponent, AppDialogComponent, AppLibLightBlockScrollStrategy, AppShellComponent, AppShellSidebarTemplateDirective, AppShellSidebarToggleComponent, AppSidebarComponent, AppSidebarToolbarDirective, AppTheme, AppThemeService, AppTopbarComponent, AppUserMenuComponent, BR_ESTADOS_NOME_SIGLA, BaseButtonType, BaseButtonVariant, BaseFieldComponent, BaseFieldDirective, BooleanFieldDirective, ButtonComponent, CardListComponent, CepFieldComponent, CheckboxFieldComponent, ConfirmDialogComponent, ConfirmDialogService, ContextMenuComponent, CpfCnpjFieldComponent, DashboardSectionComponent, DataCardComponent, DataGridComponent, DataListComponent, DataToolbarComponent, DateFieldComponent, DecimalFieldComponent, DetailsFieldComponent, DetailsViewComponent, DialogFooterDirective, DrawerComponent, DrawerSide, DrawerSize, DropdownBaseComponent, DropdownMenuComponent, DropdownMultiOptionFieldBase, DropdownOptionFieldBase, DropdownSearchFieldComponent, EmptyStateComponent, FILE_PREVIEW_UNAVAILABLE_MESSAGE, FileUploadFieldComponent, FormActionsAlign, FormActionsComponent, FormColComponent, FormGroupComponent, FormGroupVariant, FormLayoutGap, FormRowAlign, FormRowComponent, FormRowJustify, FormSectionComponent, FormTabComponent, FormTabsComponent, ImagePreviewPanelComponent, InputMaskFieldComponent, IntegerFieldComponent, LAYOUT_STACK_SIDE_BY_SIDE, LAYOUT_STACK_STACKED, LayoutStackAlign, LayoutStackComponent, LayoutStackDirection, LayoutStackItemAlign, LibDialogSize, ListItemComponent, LoadingDialogComponent, LoadingDialogService, MaskedTextFieldBase, MenuDividerComponent, MenuDropdownPlacement, MenuGroupComponent, MenuListComponent, MultiselectFieldComponent, NgControlFieldDirective, OverlayPlacement, PDF_IFRAME_VIEWER_HASH, PasswordFieldComponent, PhoneFieldComponent, PopoverBodyTemplateDirective, PopoverComponent, PopoverFooterTemplateDirective, PopoverTriggerDirective, STRUCTRA_UI, SelectFieldComponent, SkeletonBlockComponent, SkeletonCardComponent, SkeletonFieldShellComponent, SkeletonListComponent, SkeletonTableComponent, SkeletonTextComponent, StatCardComponent, StatusBadgeComponent, SwitchFieldComponent, TableEmptyStateComponent, TableToolbarComponent, TextFieldComponent, TextareaFieldComponent, ToastHostComponent, ToastService, TooltipComponent, TooltipPanelTemplateDirective, ValidationSummaryComponent, anchoredOverlayPositions, appendPdfIframeViewerParams, applyPickedCalendarDate, buildDecimalBrDisplay, buildDecimalBrParseString, buildEmptyStateOverlayHtml, caretIndexFromIntegerDigitCount, caretIndexFromSemantic, cepMaskCompleteValidator, cpfCnpjMaskCompleteValidator, escapeHtml, extractDecimalBrParts, fileIsLikelyImage, fileMatchesAccept, fixedDigitsMaskCompleteValidator, formatAcceptForDisplay, formatDateTimePtBr, formatDecimalBr, formatFileSizeBytes, formatIntegerThousandsBr, formatMaskDigits, formatUiFieldDateValue, getFilePreviewKind, libDialogPanelClasses, mapEstadosToOptions, maskDigitCount, normalizeFormDateValue, parseDecimalBr, parseIntegerString, parseUiFieldDateValue, phoneBrMaskCompleteValidator, resolveControlAtPath, sanitizeDecimalBrInput, sanitizeIntegerDigits, sectionHasVisibleInvalid, semanticCaretAt, semanticIntegerDigitCountLeft, stripToDigits, subscribeMarkForCheckOnInvalidUiRefresh, subtreeHasVisibleInvalid };
3321
+ export type { AdaptiveDataViewMode, AppThemeId, AppThemeOption, BreadcrumbItem, CardItemView, CardListDataMode, CardListMapFn, ConfirmDialogData, ConfirmDialogVariant, DataGridColumn, DataGridPaginationChangeEvent, DetailsViewItem, DropdownListBindings, DropdownSearchPageRequested, FieldCommonInputs, FilePreviewKind, FormTabsVariant, LoadingDialogData, MenuItemAction, MenuItemDivider, MenuItemGroup, MenuItemKind, MenuItemSubmenu, MenuLeafItem, MenuNodeItem, SelectPageRequested, SkeletonFieldShellVariant, StatCardDeltaTone, StatusBadgeSize, StatusBadgeVariant, ToastInstance, ToastShowOptions, ToastType, ToastVerticalPosition, UiSelectOption, ValidationSummaryItem, ValidationSummaryVariant };