@senior-gestao-relacionamento/angular-components 2.4.0 → 2.5.0-master-5861fa25

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.
@@ -0,0 +1,82 @@
1
+ import { ExportColumnType, ExportFileFormat, ExportFileType, ExportOrientation } from '../enums/export-data.enums';
2
+ /**
3
+ * Configuração de uma coluna para exportação.
4
+ * Espelha o `columnsRecord` do backend (main.sdl).
5
+ */
6
+ export interface ExportColumn {
7
+ /** Nome do campo no registro (suporta paths aninhados: "address.city") */
8
+ columnName: string;
9
+ /** Chave de tradução ou label exibido no cabeçalho */
10
+ translateKey: string;
11
+ /** Tipo do dado — define a máscara aplicada pelo backend */
12
+ columnType: ExportColumnType;
13
+ /** Prefixo da chave de tradução do enum (ex: "statusenum") */
14
+ translationKeyPrefix?: string;
15
+ }
16
+ /**
17
+ * Coluna no formato simplificado (compatível com ColumnConfig do projeto).
18
+ * O componente converte automaticamente para ExportColumn.
19
+ */
20
+ export interface ExportColumnInput {
21
+ /** Nome do campo (ex: "name", "stage.name") */
22
+ field: string;
23
+ /** Label exibido no cabeçalho */
24
+ header: string;
25
+ /** Tipo para exportação: TEXT, NUMBER, ENUM, DATE, DATETIME, CURRENCY */
26
+ exportType?: string;
27
+ /** Prefixo da chave de tradução do enum */
28
+ translationKeyPrefix?: string;
29
+ /** Qualquer outra propriedade (sortable, width, type, etc) é ignorada */
30
+ [key: string]: unknown;
31
+ }
32
+ /**
33
+ * Datasource que identifica de onde buscar os dados no backend.
34
+ */
35
+ export interface ExportDatasource {
36
+ nameDomain: string;
37
+ nameService: string;
38
+ primitive: string;
39
+ }
40
+ /**
41
+ * Payload enviado ao signal `exportSelectedRecordsSignal`.
42
+ */
43
+ export interface ExportSelectedPayload {
44
+ fileType: ExportFileType;
45
+ datasource: ExportDatasource;
46
+ fields: ExportColumn[];
47
+ selectedIds: string[];
48
+ entityName: string;
49
+ orientation?: ExportOrientation;
50
+ fileFormat?: ExportFileFormat;
51
+ }
52
+ /**
53
+ * Payload enviado ao signal `exportAllRecordsSignal`.
54
+ */
55
+ export interface ExportAllPayload {
56
+ fileType: ExportFileType;
57
+ datasource: ExportDatasource;
58
+ fields: ExportColumn[];
59
+ filter: string;
60
+ entityName: string;
61
+ orientation?: ExportOrientation;
62
+ fileFormat?: ExportFileFormat;
63
+ }
64
+ /**
65
+ * Configuração passada ao componente de exportação.
66
+ *
67
+ * Aceita colunas em dois formatos:
68
+ * - `ExportColumn[]` (formato completo com columnName/translateKey/columnType)
69
+ * - `ExportColumnInput[]` (formato simplificado com field/header/exportType — compatível com ColumnConfig)
70
+ *
71
+ * O componente normaliza internamente.
72
+ */
73
+ export interface ExportDataConfig {
74
+ /** Nome da entidade exibido no título do arquivo */
75
+ entityName: string;
76
+ /** Datasource: domínio, serviço e primitiva de listagem */
77
+ datasource: ExportDatasource;
78
+ /** Colunas disponíveis para exportação */
79
+ columns: (ExportColumn | ExportColumnInput)[];
80
+ /** Filtro ativo na listagem (usado quando exporta todos) */
81
+ activeFilter?: string;
82
+ }
@@ -0,0 +1,20 @@
1
+ export declare enum ExportFileType {
2
+ Excel = "EXCEL",
3
+ Pdf = "PDF"
4
+ }
5
+ export declare enum ExportOrientation {
6
+ Portrait = "PORTRAIT",
7
+ Landscape = "LANDSCAPE"
8
+ }
9
+ export declare enum ExportFileFormat {
10
+ A3 = "A3",
11
+ A4 = "A4"
12
+ }
13
+ export declare enum ExportColumnType {
14
+ Text = "TEXT",
15
+ Enum = "ENUM",
16
+ Date = "DATE",
17
+ Datetime = "DATETIME",
18
+ Currency = "CURRENCY",
19
+ Number = "NUMBER"
20
+ }
@@ -0,0 +1,70 @@
1
+ import { OnChanges, OnDestroy } from '@angular/core';
2
+ import { ExportDataConfig, ExportColumn } from './entities/export-data.interface';
3
+ import { ExportFileType, ExportOrientation, ExportFileFormat } from './enums/export-data.enums';
4
+ import * as i0 from "@angular/core";
5
+ export declare class ExportDataComponent implements OnChanges, OnDestroy {
6
+ private readonly exportService;
7
+ private readonly webSocketService;
8
+ private readonly ngZone;
9
+ private wsSubscription;
10
+ private readonly wsConfig;
11
+ visible: import("@angular/core").InputSignal<boolean>;
12
+ visibleChange: import("@angular/core").OutputEmitterRef<boolean>;
13
+ config: import("@angular/core").InputSignal<ExportDataConfig>;
14
+ selectedIds: import("@angular/core").InputSignal<string[]>;
15
+ exported: import("@angular/core").OutputEmitterRef<void>;
16
+ exportError: import("@angular/core").OutputEmitterRef<string>;
17
+ readonly selectedFileType: import("@angular/core").WritableSignal<ExportFileType>;
18
+ readonly selectedOrientation: import("@angular/core").WritableSignal<ExportOrientation>;
19
+ readonly selectedFileFormat: import("@angular/core").WritableSignal<ExportFileFormat>;
20
+ readonly exportScope: import("@angular/core").WritableSignal<"all" | "selected">;
21
+ readonly exporting: import("@angular/core").WritableSignal<boolean>;
22
+ readonly columnSelections: import("@angular/core").WritableSignal<{
23
+ column: ExportColumn;
24
+ selected: boolean;
25
+ }[]>;
26
+ get selectedFileTypeModel(): ExportFileType;
27
+ set selectedFileTypeModel(v: ExportFileType);
28
+ get selectedOrientationModel(): ExportOrientation;
29
+ set selectedOrientationModel(v: ExportOrientation);
30
+ get selectedFileFormatModel(): ExportFileFormat;
31
+ set selectedFileFormatModel(v: ExportFileFormat);
32
+ get exportScopeModel(): string;
33
+ set exportScopeModel(v: string);
34
+ readonly selectedColumnsCount: import("@angular/core").Signal<number>;
35
+ readonly hasSelectedIds: import("@angular/core").Signal<boolean>;
36
+ readonly canExport: import("@angular/core").Signal<boolean>;
37
+ readonly fileTypes: {
38
+ value: ExportFileType;
39
+ label: string;
40
+ icon: string;
41
+ description: string;
42
+ }[];
43
+ readonly orientations: {
44
+ value: ExportOrientation;
45
+ label: string;
46
+ icon: string;
47
+ }[];
48
+ readonly fileFormats: {
49
+ value: ExportFileFormat;
50
+ label: string;
51
+ description: string;
52
+ }[];
53
+ ngOnChanges(): void;
54
+ ngOnDestroy(): void;
55
+ private subscribeToWebSocket;
56
+ private isExportColumn;
57
+ private normalizeColumn;
58
+ selectAllColumns(): void;
59
+ deselectAllColumns(): void;
60
+ toggleColumn(col: {
61
+ column: ExportColumn;
62
+ selected: boolean;
63
+ }): void;
64
+ refreshColumns(): void;
65
+ onDialogHide(): void;
66
+ doExport(): Promise<void>;
67
+ private exportViaBackend;
68
+ static ɵfac: i0.ɵɵFactoryDeclaration<ExportDataComponent, never>;
69
+ static ɵcmp: i0.ɵɵComponentDeclaration<ExportDataComponent, "s-export-data", never, { "visible": { "alias": "visible"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": true; "isSignal": true; }; "selectedIds": { "alias": "selectedIds"; "required": false; "isSignal": true; }; }, { "visibleChange": "visibleChange"; "exported": "exported"; "exportError": "exportError"; }, never, never, true, never>;
70
+ }
@@ -0,0 +1,24 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { ExportAllPayload, ExportSelectedPayload } from '../entities/export-data.interface';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Serviço que dispara os signals de exportação no `crmx-data-export-backend`.
6
+ *
7
+ * Os signals são fire-and-forget: o backend gera o arquivo, faz upload
8
+ * e notifica o usuário via WebSocket/notificação.
9
+ */
10
+ export declare class ExportDataService {
11
+ private readonly http;
12
+ private readonly signalsUrl;
13
+ constructor(http: HttpClient);
14
+ /**
15
+ * Dispara `exportSelectedRecordsSignal` — exporta apenas os IDs informados.
16
+ */
17
+ exportSelectedRecords(payload: ExportSelectedPayload): Promise<void>;
18
+ /**
19
+ * Dispara `exportAllRecordsSignal` — exporta todos os registros com filtro.
20
+ */
21
+ exportAllRecords(payload: ExportAllPayload): Promise<void>;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<ExportDataService, never>;
23
+ static ɵprov: i0.ɵɵInjectableDeclaration<ExportDataService>;
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@senior-gestao-relacionamento/angular-components",
3
- "version": "2.4.0",
3
+ "version": "2.5.0-master-5861fa25",
4
4
  "description": "Biblioteca de componentes reutilizáveis para aplicações Angular do CRM Senior Sistemas",
5
5
  "keywords": [
6
6
  "angular",
@@ -48,4 +48,4 @@
48
48
  "default": "./fesm2022/senior-gestao-relacionamento-angular-components.mjs"
49
49
  }
50
50
  }
51
- }
51
+ }
package/public-api.d.ts CHANGED
@@ -13,3 +13,7 @@ export type { Schedule, ScheduleRecurrenceItem, RecurrenceDatesRecord, ScheduleP
13
13
  export type { ScheduleType } from './lib/components/schedule/entities/schedule-type.interface';
14
14
  export type { ParticipantLookup, ParticipantOrigin, ScheduleSummaryByDate } from './lib/components/schedule/entities/participant-lookup.interface';
15
15
  export { SchedulePriority, ScheduleRecurrence, WeekDay, Month, RepeatWhen, OrdinalWeekDay, ParticipantConfirmation, Status } from './lib/components/schedule/enums/schedule.enums';
16
+ export { ExportDataComponent } from './lib/components/export-data/export-data.component';
17
+ export { ExportDataService } from './lib/components/export-data/services/export-data.service';
18
+ export { ExportFileType, ExportOrientation, ExportFileFormat, ExportColumnType } from './lib/components/export-data/enums/export-data.enums';
19
+ export type { ExportColumn, ExportColumnInput, ExportDatasource, ExportDataConfig, ExportSelectedPayload, ExportAllPayload } from './lib/components/export-data/entities/export-data.interface';