mapa-library-ui 2.12.0 → 2.13.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapa-library-ui-src-lib-core-export.mjs","sources":["../../../projects/mapa-library-ui/src/lib/core/excel-export-core/report-export.utils.ts","../../../projects/mapa-library-ui/src/lib/core/export/export-jobs.service.ts","../../../projects/mapa-library-ui/src/lib/core/export/export-dialog.component.ts","../../../projects/mapa-library-ui/src/lib/core/export/export-dialog.component.html","../../../projects/mapa-library-ui/src/lib/core/export/export-dialog.service.ts","../../../projects/mapa-library-ui/src/lib/core/export/export-jobs.component.ts","../../../projects/mapa-library-ui/src/lib/core/export/export-jobs.component.html","../../../projects/mapa-library-ui/src/lib/core/export/export-http.ts","../../../projects/mapa-library-ui/src/mapa-library-ui-src-lib-core-export.ts"],"sourcesContent":["import type {\n ExcelSheetRequest,\n ExcelValue,\n} from '../excel-export-core/excel-export.models';\ntype ExportRow = Record<string, ExcelValue>;\n\nexport const EXPORT_FILE_ROW_LIMIT = 100_000;\n\n/** Encode browser-local calendar fields for timezone-free Excel and CSV cells. */\nexport function toExportDate(value: Date): Date {\n if (!Number.isFinite(value.getTime()))\n throw new Error('Data inválida na exportação.');\n return new Date(value.getTime() - value.getTimezoneOffset() * 60_000);\n}\n\nexport const exportSlug = (value: string): string =>\n value\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-|-$/g, '') || 'exportacao';\n\nexport function exportFileBase(\n listing: string,\n company: string,\n date: Date,\n): string {\n const pad = (value: number) => String(value).padStart(2, '0');\n return `mapahds_${exportSlug(listing)}_${exportSlug(company)}_${date.getFullYear()}${pad(date.getMonth() + 1)}${pad(date.getDate())}-${pad(date.getHours())}${pad(date.getMinutes())}`;\n}\n\n/** Greedy packing preserves dataset order and counts records across all sheets. */\nexport function splitExportSheets(\n sheets: readonly ExcelSheetRequest<ExportRow>[],\n limit = EXPORT_FILE_ROW_LIMIT,\n): ExcelSheetRequest<ExportRow>[][] {\n if (!Number.isInteger(limit) || limit < 1)\n throw new Error('Limite de registros inválido.');\n const parts: ExcelSheetRequest<ExportRow>[][] = [[]];\n let used = 0;\n for (const sheet of sheets) {\n if (!sheet.rows.length) {\n parts[parts.length - 1].push({ ...sheet, rows: [] });\n continue;\n }\n for (let offset = 0; offset < sheet.rows.length;) {\n if (used === limit) {\n parts.push([]);\n used = 0;\n }\n const length = Math.min(limit - used, sheet.rows.length - offset);\n parts[parts.length - 1].push({\n ...sheet,\n rows: sheet.rows.slice(offset, offset + length),\n });\n offset += length;\n used += length;\n }\n }\n return parts;\n}\n\nexport function encodeExportCsv(\n sheet: ExcelSheetRequest<ExportRow>,\n onProgress?: (completed: number, total: number) => void,\n): ArrayBuffer {\n const encode = (input: ExcelValue): string => {\n const value =\n input && typeof input === 'object' && 'formula' in input\n ? input.result\n : input;\n if (value instanceof Date && !Number.isFinite(value.getTime()))\n throw new Error('Data inválida na exportação.');\n if (typeof value === 'number' && !Number.isFinite(value)) return '';\n const text =\n value == null\n ? ''\n : value instanceof Date\n ? value.toLocaleString('pt-BR', { timeZone: 'UTC' })\n : String(value);\n // Quoting alone does not stop spreadsheet apps interpreting user text as a formula.\n const literal =\n typeof value === 'string' && /^[=+\\-@\\t\\r]/.test(text)\n ? `'${text}`\n : text;\n return /[;\"\\r\\n]/.test(literal)\n ? `\"${literal.replace(/\"/g, '\"\"')}\"`\n : literal;\n };\n const lines = [sheet.columns.map((column) => encode(column.label)).join(';')];\n sheet.rows.forEach((row, index) => {\n lines.push(\n sheet.columns\n .map((column) =>\n encode(column.value ? column.value(row, index) : row[column.key!]),\n )\n .join(';'),\n );\n if (index % 5_000 === 4_999) onProgress?.(index + 1, sheet.rows.length);\n });\n onProgress?.(sheet.rows.length, sheet.rows.length);\n return new TextEncoder().encode('\\uFEFF' + lines.join('\\r\\n') + '\\r\\n')\n .buffer;\n}\n\nexport interface ExportPage<TRow> {\n data: readonly TRow[];\n totalCount: number;\n pageSize: number;\n pageIndex?: number;\n}\n\n/** HTTP and domain adaptation remain in load; this helper verifies completeness. */\nexport async function collectExportPages<TRow>(options: {\n totalCount: number;\n load: (\n pageIndex: number,\n pageSize: number,\n signal: AbortSignal,\n ) => Promise<ExportPage<TRow>>;\n key: (row: TRow) => string;\n signal: AbortSignal;\n onProgress?: (completed: number, total: number) => void;\n}): Promise<TRow[]> {\n const result: TRow[] = [];\n const keys = new Set<string>();\n let pageIndex = 1;\n let pageSize = Math.max(1, options.totalCount);\n let expected: number | undefined;\n while (true) {\n options.signal.throwIfAborted();\n const page = await options.load(pageIndex, pageSize, options.signal);\n options.signal.throwIfAborted();\n if (\n !Number.isInteger(page.totalCount) ||\n page.totalCount < 0 ||\n page.totalCount !== options.totalCount ||\n (expected !== undefined && expected !== page.totalCount) ||\n (page.pageIndex !== undefined && page.pageIndex !== pageIndex) ||\n (pageIndex > 1 && page.pageSize !== pageSize)\n )\n throw new Error(\n 'Os dados mudaram durante a exportação. Atualize a listagem e tente novamente.',\n );\n expected = page.totalCount;\n for (const row of page.data) {\n const key = options.key(row);\n if (!key || keys.has(key))\n throw new Error(\n 'Registros duplicados ou sem identificação na exportação.',\n );\n keys.add(key);\n result.push(row);\n }\n options.onProgress?.(result.length, expected);\n if (result.length === expected) return result;\n if (\n !page.data.length ||\n result.length > expected ||\n !Number.isInteger(page.pageSize) ||\n page.pageSize < 1 ||\n page.data.length !== page.pageSize\n )\n throw new Error('A API retornou uma exportação incompleta.');\n pageSize = page.pageSize;\n pageIndex++;\n }\n}\n","import { Injectable, InjectionToken, inject, signal } from '@angular/core';\nimport {\n MapaExcelExportService,\n ExcelExportCancelledError,\n} from 'mapa-library-ui/src/lib/core/excel-export';\nimport type { ExcelSheetRequest } from '../excel-export-core/excel-export.models';\nimport { exportFileBase, splitExportSheets } from './export.utils';\nimport type {\n ExportChoices,\n ExportFile,\n ExportLoadContext,\n ExportPreparedContent,\n ExportRequest,\n ExportRow,\n ExportTask,\n} from './export.models';\n\nexport const MAPA_EXPORT_WORKER_FACTORY = new InjectionToken<() => Worker>(\n 'MAPA_EXPORT_WORKER_FACTORY',\n);\n\nexport function snapshotExportRequest(request: ExportRequest): ExportRequest {\n return {\n ...request,\n context: { ...request.context, filters: [...request.context.filters] },\n datasets: request.datasets.map((dataset) => ({\n ...dataset,\n columns: dataset.columns.map((column) => ({\n ...column,\n status: column.status?.map((status) => ({ ...status })),\n })),\n indicators: dataset.indicators?.map((indicator) => ({ ...indicator })),\n rows: dataset.rows ? structuredClone(dataset.rows) : undefined,\n selectedRows: dataset.selectedRows\n ? structuredClone(dataset.selectedRows)\n : undefined,\n })),\n };\n}\n\n@Injectable({ providedIn: 'root' })\nexport class MapaExportJobsService {\n private readonly excel = inject(MapaExcelExportService);\n private readonly defaultWorker = inject(MAPA_EXPORT_WORKER_FACTORY, {\n optional: true,\n });\n private readonly state = signal<readonly ExportTask[]>([]);\n readonly tasks = this.state.asReadonly();\n private readonly pending = new Map<\n string,\n { request: ExportRequest; choices: ExportChoices; createdAt: Date }\n >();\n private readonly controllers = new Map<string, AbortController>();\n private draining = false;\n\n enqueue(request: ExportRequest, choices: ExportChoices): string {\n const id = crypto.randomUUID();\n this.pending.set(id, {\n request: snapshotExportRequest(request),\n choices: { ...choices, datasetIds: [...choices.datasetIds] },\n createdAt: new Date(),\n });\n this.state.update((tasks) => [\n ...tasks,\n {\n id,\n title: request.listing,\n state: 'queued',\n files: [],\n background:\n request.datasets\n .filter((dataset) => choices.datasetIds.includes(dataset.id))\n .reduce(\n (sum, dataset) =>\n sum +\n (choices.scope === 'selected'\n ? (dataset.selectedRows?.length ?? 0)\n : dataset.totalCount),\n 0,\n ) > 5_000,\n },\n ]);\n void this.drain();\n return id;\n }\n\n cancel(id: string): void {\n this.controllers.get(id)?.abort();\n this.patch(id, { state: 'cancelled', files: [], progress: undefined });\n this.pending.delete(id);\n }\n\n remove(id: string): void {\n this.cancel(id);\n this.state.update((tasks) => tasks.filter((task) => task.id !== id));\n }\n\n clear(): void {\n for (const controller of this.controllers.values()) controller.abort();\n this.pending.clear();\n this.state.set([]);\n }\n\n retry(id: string): void {\n if (\n !this.pending.has(id) ||\n this.tasks().find((task) => task.id === id)?.state !== 'error'\n )\n return;\n this.patch(id, {\n state: 'queued',\n error: undefined,\n progress: undefined,\n files: [],\n });\n void this.drain();\n }\n\n download(file: ExportFile): void {\n const url = URL.createObjectURL(\n new Blob([file.buffer], { type: file.mime }),\n );\n const link = document.createElement('a');\n try {\n link.href = url;\n link.download = file.name;\n document.body.appendChild(link);\n link.click();\n } finally {\n link.remove();\n URL.revokeObjectURL(url);\n }\n }\n\n private patch(id: string, patch: Partial<ExportTask>): void {\n this.state.update((tasks) =>\n tasks.map((task) => (task.id === id ? { ...task, ...patch } : task)),\n );\n }\n\n private async drain(): Promise<void> {\n if (this.draining) return;\n this.draining = true;\n try {\n let task: ExportTask | undefined;\n while ((task = this.tasks().find((item) => item.state === 'queued')))\n await this.run(task.id);\n } finally {\n this.draining = false;\n }\n }\n\n private async run(id: string): Promise<void> {\n const pending = this.pending.get(id);\n if (!pending) return;\n const { request, choices, createdAt } = pending;\n const controller = new AbortController();\n const signal = controller.signal;\n this.controllers.set(id, controller);\n this.patch(id, { state: 'running', progress: { phase: 'fetching' } });\n try {\n const workerFactory = request.workerFactory ?? this.defaultWorker;\n if (!workerFactory)\n throw new Error(\n 'O worker de exportação não foi configurado nesta aplicação.',\n );\n const loadContext: ExportLoadContext = {\n signal,\n generatedAt: createdAt,\n scope: choices.scope,\n onProgress: (completed, total) =>\n this.patch(id, { progress: { phase: 'fetching', completed, total } }),\n };\n let prepared: ExportPreparedContent;\n if (request.prepare)\n prepared = await request.prepare(choices, loadContext);\n else {\n const sheets: ExcelSheetRequest<ExportRow>[] = [];\n for (const dataset of request.datasets.filter((dataset) =>\n choices.datasetIds.includes(dataset.id),\n )) {\n signal.throwIfAborted();\n const rows =\n choices.scope === 'selected'\n ? (dataset.selectedRows ?? [])\n : dataset.load\n ? await dataset.load(loadContext)\n : (dataset.rows ?? []);\n sheets.push({\n sheetName: dataset.sheetName ?? dataset.label,\n title: dataset.label,\n rows,\n columns: dataset.columns.filter(\n (column) =>\n column.exportable !== false &&\n (!choices.visibleOnly || column.visible !== false),\n ),\n indicators: dataset.indicators,\n });\n }\n prepared = { sheets };\n }\n signal.throwIfAborted();\n if (!prepared.sheets.length)\n throw new Error('Selecione pelo menos uma tabela.');\n this.patch(id, {\n background:\n prepared.sheets.reduce((sum, sheet) => sum + sheet.rows.length, 0) >\n 5_000,\n });\n // Resolve consumer functions before structured cloning the worker payload.\n const sheets: ExcelSheetRequest<ExportRow>[] = [];\n for (const sheet of prepared.sheets) {\n if (!sheet.columns.length)\n throw new Error(\n `Não há colunas para exportar em ${sheet.sheetName}.`,\n );\n const columns = sheet.columns.map((column, index) => ({\n ...column,\n key: column.key ?? `column${index}`,\n value: undefined,\n }));\n const rows: ExportRow[] = [];\n for (let index = 0; index < sheet.rows.length; index++) {\n if (index % 1_000 === 0) {\n await new Promise<void>((resolve) => setTimeout(resolve, 0));\n signal.throwIfAborted();\n }\n rows.push(\n Object.fromEntries(\n sheet.columns.map((column, col) => [\n columns[col].key,\n column.value\n ? column.value(sheet.rows[index], index)\n : sheet.rows[index][column.key!],\n ]),\n ),\n );\n }\n sheets.push({\n ...sheet,\n columns,\n rows,\n context: { ...request.context, generatedAt: createdAt },\n });\n }\n const base = exportFileBase(\n request.listing,\n request.context.company,\n createdAt,\n );\n const batches =\n choices.format === 'xlsx'\n ? splitExportSheets(sheets)\n : sheets.flatMap((sheet) =>\n splitExportSheets([sheet]).map((part) => part),\n );\n const files: ExportFile[] = [];\n const csvOccurrences = new Map<string, number>();\n const csvTotals = new Map<string, number>();\n batches.forEach((batch) => {\n const key = batch[0].sheetName;\n csvTotals.set(key, (csvTotals.get(key) ?? 0) + 1);\n });\n for (const [index, batch] of batches.entries()) {\n signal.throwIfAborted();\n const options = {\n workerFactory,\n isCancelled: () => signal.aborted,\n onProgress: (progress: ExportTask['progress']) =>\n this.patch(id, {\n progress: {\n ...progress!,\n part: index + 1,\n parts: batches.length,\n },\n }),\n };\n let name = base;\n if (choices.format === 'csv') {\n const key = batch[0].sheetName;\n const occurrence = (csvOccurrences.get(key) ?? 0) + 1;\n csvOccurrences.set(key, occurrence);\n if (sheets.length > 1)\n name = exportFileBase(\n `${request.listing}-${key}`,\n request.context.company,\n createdAt,\n );\n if (csvTotals.get(key)! > 1) name += `_parte${occurrence}`;\n } else if (batches.length > 1) name += `_parte${index + 1}`;\n const workbook = {\n fileName: name,\n sheets: batch,\n created: createdAt,\n creator: request.context.user,\n extension: index === 0 ? prepared.extension : undefined,\n };\n const buffer =\n choices.format === 'xlsx'\n ? await this.excel.generateWorkbook(workbook, options)\n : await this.excel.generateCsv(workbook, options);\n signal.throwIfAborted();\n files.push({\n name: `${name}.${choices.format}`,\n buffer,\n mime:\n choices.format === 'xlsx'\n ? 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n : 'text/csv;charset=utf-8',\n });\n }\n this.patch(id, {\n state: 'ready',\n files,\n recordCount: sheets.reduce((sum, sheet) => sum + sheet.rows.length, 0),\n progress: undefined,\n });\n this.pending.delete(id);\n } catch (error) {\n if (signal.aborted || error instanceof ExcelExportCancelledError)\n this.patch(id, { state: 'cancelled', files: [], progress: undefined });\n else\n this.patch(id, {\n state: 'error',\n files: [],\n error:\n error instanceof Error\n ? error.message\n : 'Não foi possível exportar.',\n progress: undefined,\n });\n } finally {\n this.controllers.delete(id);\n }\n }\n}\n","import { Component, ViewEncapsulation, inject } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport {\n MAT_DIALOG_DATA,\n MatDialogModule,\n MatDialogRef,\n} from '@angular/material/dialog';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatRadioModule } from '@angular/material/radio';\nimport { MapaExportJobsService } from './export-jobs.service';\nimport type { ExportChoices, ExportRequest } from './export.models';\nimport { exportFileBase } from './export.utils';\n\n@Component({\n selector: 'mapa-export-dialog',\n standalone: true,\n encapsulation: ViewEncapsulation.None,\n imports: [FormsModule, MatDialogModule, MatCheckboxModule, MatRadioModule],\n templateUrl: './export-dialog.component.html',\n styleUrl: './export-dialog.component.scss',\n})\nexport class MapaExportDialogComponent {\n readonly request = inject<ExportRequest>(MAT_DIALOG_DATA);\n readonly dialog = inject(MatDialogRef<MapaExportDialogComponent, string>);\n private readonly jobs = inject(MapaExportJobsService);\n readonly selectable = this.request.datasets.some(\n (dataset) => dataset.selectable,\n );\n readonly selectedCount = this.request.datasets.reduce(\n (sum, dataset) => sum + (dataset.selectedRows?.length ?? 0),\n 0,\n );\n readonly total = this.request.datasets.reduce(\n (sum, dataset) => sum + dataset.totalCount,\n 0,\n );\n readonly hasHiddenColumns = this.request.datasets.some((dataset) =>\n dataset.columns.some(\n (column) => column.exportable !== false && column.visible === false,\n ),\n );\n readonly choices: ExportChoices = {\n format: 'xlsx',\n visibleOnly: true,\n scope:\n this.selectable &&\n this.selectedCount &&\n this.request.initialScope === 'selected'\n ? 'selected'\n : 'all',\n datasetIds: this.request.datasets.map((dataset) => dataset.id),\n };\n error = '';\n get fileName(): string {\n return `${exportFileBase(this.request.listing, this.request.context.company, new Date())}.${this.choices.format}`;\n }\n toggleDataset(id: string, checked: boolean): void {\n this.choices.datasetIds = checked\n ? [...this.choices.datasetIds, id]\n : this.choices.datasetIds.filter((value) => value !== id);\n }\n generate(): void {\n if (\n !this.choices.datasetIds.length ||\n (this.choices.scope === 'selected' && !this.selectedCount)\n )\n return;\n try {\n this.dialog.close(this.jobs.enqueue(this.request, this.choices));\n } catch (error) {\n this.error =\n error instanceof Error\n ? error.message\n : 'Não foi possível iniciar a exportação.';\n }\n }\n}\n","<header class=\"mapa-export__header\">\n <div>\n <h2 mat-dialog-title>Exportar {{ request.listing }}</h2>\n <p>A planilha segue os filtros aplicados na tela.</p>\n </div>\n <button\n class=\"mapa-export__close\"\n type=\"button\"\n aria-label=\"Fechar\"\n (click)=\"dialog.close()\"\n >\n ×\n </button>\n</header>\n<mat-dialog-content class=\"mapa-export__content\">\n <fieldset>\n <legend>O que exportar</legend>\n <mat-radio-group [(ngModel)]=\"choices.scope\" aria-label=\"O que exportar\">\n <mat-radio-button\n value=\"all\"\n class=\"mapa-export__option\"\n [class.mapa-export__option--selected]=\"choices.scope === 'all'\"\n >\n <span class=\"mapa-export__label\">Todos os registros filtrados</span>\n <span class=\"mapa-export__description\">{{\n request.allRecordsDescription ||\n total.toLocaleString(\"pt-BR\") +\n \" registros\" +\n (request.context.filters.length\n ? \" · \" + request.context.filters.join(\" · \")\n : \"\")\n }}</span>\n </mat-radio-button>\n @if (selectable) {\n <mat-radio-button\n value=\"selected\"\n [disabled]=\"!selectedCount\"\n class=\"mapa-export__option\"\n [class.mapa-export__option--selected]=\"choices.scope === 'selected'\"\n >\n <span class=\"mapa-export__label\">Somente os selecionados</span>\n <span class=\"mapa-export__description\"\n >{{ selectedCount }} registros marcados na lista</span\n >\n </mat-radio-button>\n }\n </mat-radio-group>\n </fieldset>\n @if (request.datasets.length > 1) {\n <fieldset>\n <legend>Conteúdo do arquivo</legend>\n @for (dataset of request.datasets; track dataset.id) {\n <mat-checkbox\n [checked]=\"choices.datasetIds.includes(dataset.id)\"\n (change)=\"toggleDataset(dataset.id, $event.checked)\"\n >{{ dataset.label }}</mat-checkbox\n >\n }\n </fieldset>\n }\n <fieldset>\n <legend>Formato</legend>\n <mat-radio-group\n class=\"mapa-export__formats\"\n [(ngModel)]=\"choices.format\"\n aria-label=\"Formato\"\n >\n <mat-radio-button\n value=\"xlsx\"\n class=\"mapa-export__option\"\n [class.mapa-export__option--selected]=\"choices.format === 'xlsx'\"\n >\n <span class=\"mapa-export__label\">Excel (.xlsx)</span\n ><span class=\"mapa-export__description\">Com o layout da marca</span>\n </mat-radio-button>\n <mat-radio-button\n value=\"csv\"\n class=\"mapa-export__option\"\n [class.mapa-export__option--selected]=\"choices.format === 'csv'\"\n >\n <span class=\"mapa-export__label\">CSV</span\n ><span class=\"mapa-export__description\"\n >Dados puros, sem formatação</span\n >\n </mat-radio-button>\n </mat-radio-group>\n </fieldset>\n @if (hasHiddenColumns) {\n <mat-checkbox [(ngModel)]=\"choices.visibleOnly\"\n >Incluir só as colunas visíveis na tabela</mat-checkbox\n >\n }\n <p class=\"mapa-export__filename\">{{ fileName }}</p>\n @if (error) {\n <p role=\"alert\">{{ error }}</p>\n }\n</mat-dialog-content>\n<mat-dialog-actions class=\"mapa-export__actions\">\n <button class=\"mapa-export__button\" type=\"button\" (click)=\"dialog.close()\">\n Cancelar\n </button>\n <button\n class=\"mapa-export__button mapa-export__button--primary\"\n type=\"button\"\n [disabled]=\"!choices.datasetIds.length\"\n (click)=\"generate()\"\n >\n Gerar planilha\n </button>\n</mat-dialog-actions>\n","import { Injectable, inject } from '@angular/core';\nimport { MatDialog, MatDialogRef } from '@angular/material/dialog';\nimport type { ExportRequest } from './export.models';\nimport { MapaExportDialogComponent } from './export-dialog.component';\nimport { snapshotExportRequest } from './export-jobs.service';\n\n@Injectable({ providedIn: 'root' })\nexport class MapaExportDialogService {\n private readonly dialog = inject(MatDialog);\n private ref?: MatDialogRef<MapaExportDialogComponent, string>;\n\n open(\n request: ExportRequest,\n ): MatDialogRef<MapaExportDialogComponent, string> {\n if (this.ref) return this.ref;\n const ref = this.dialog.open<\n MapaExportDialogComponent,\n ExportRequest,\n string\n >(MapaExportDialogComponent, {\n data: snapshotExportRequest(request),\n width: '560px',\n maxWidth: 'calc(100vw - 32px)',\n maxHeight: 'calc(100dvh - 32px)',\n autoFocus: 'first-tabbable',\n restoreFocus: true,\n ariaLabel: `Exportar ${request.listing}`,\n panelClass: 'mapa-export-dialog-panel',\n });\n this.ref = ref;\n ref.afterClosed().subscribe(() => {\n if (this.ref === ref) this.ref = undefined;\n });\n return ref;\n }\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MapaExportJobsService } from './export-jobs.service';\nimport type { ExportTask } from './export.models';\n\n@Component({\n selector: 'mapa-export-jobs',\n standalone: true,\n imports: [MatProgressBarModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './export-jobs.component.html',\n styleUrl: './export-jobs.component.scss',\n})\nexport class MapaExportJobsComponent {\n readonly jobs = inject(MapaExportJobsService);\n percent(task: ExportTask): number | null {\n const progress = task.progress;\n return progress?.total && progress.completed !== undefined\n ? Math.min(100, Math.round((progress.completed / progress.total) * 100))\n : null;\n }\n phase(task: ExportTask): string {\n const text =\n task.state === 'queued'\n ? 'Aguardando na fila…'\n : task.progress?.phase === 'fetching'\n ? 'Obtendo os registros…'\n : task.progress?.phase === 'serializing'\n ? 'Compactando arquivo…'\n : 'Gerando planilha…';\n return (\n text +\n (task.progress?.parts && task.progress.parts > 1\n ? ` Parte ${task.progress.part} de ${task.progress.parts}`\n : '')\n );\n }\n}\n","@if (jobs.tasks().length) {\n <aside class=\"mapa-export-jobs\" aria-label=\"Exportações\">\n @for (task of jobs.tasks(); track task.id) {\n <section class=\"mapa-export-jobs__task\" [attr.aria-label]=\"task.title\">\n <header>\n <strong>{{ task.title }}</strong>\n @if (task.state === \"running\" || task.state === \"queued\") {\n <button type=\"button\" (click)=\"jobs.cancel(task.id)\">\n Cancelar\n </button>\n } @else {\n <button\n type=\"button\"\n (click)=\"jobs.remove(task.id)\"\n [attr.aria-label]=\"'Remover exportação ' + task.title\"\n >\n ×\n </button>\n }\n </header>\n @if (task.state === \"running\" || task.state === \"queued\") {\n <p role=\"status\">\n {{ phase(task) }}\n @if (percent(task) !== null) {\n {{ percent(task) }}%\n }\n </p>\n <mat-progress-bar\n [mode]=\"percent(task) === null ? 'indeterminate' : 'determinate'\"\n [value]=\"percent(task) ?? 0\"\n [attr.aria-label]=\"phase(task)\"\n />\n @if (task.background) {\n <p class=\"mapa-export-jobs__hint\">\n Gerando em segundo plano. Você pode continuar usando a plataforma.\n </p>\n }\n } @else if (task.state === \"ready\") {\n <p role=\"status\">\n Planilha pronta: {{ task.recordCount?.toLocaleString(\"pt-BR\") }}\n {{ task.recordCount === 1 ? \"registro\" : \"registros\" }}.\n {{ task.files.length }}\n {{\n task.files.length === 1\n ? \"arquivo disponível\"\n : \"arquivos disponíveis\"\n }}.\n </p>\n @for (file of task.files; track file.name) {\n <div class=\"mapa-export-jobs__file\">\n <span>{{ file.name }}</span\n ><button\n type=\"button\"\n (click)=\"jobs.download(file)\"\n [attr.aria-label]=\"'Baixar ' + file.name\"\n >\n Baixar\n </button>\n </div>\n }\n } @else if (task.state === \"error\") {\n <p role=\"alert\">{{ task.error }}</p>\n <button type=\"button\" (click)=\"jobs.retry(task.id)\">\n Tentar novamente\n </button>\n } @else {\n <p role=\"status\">Exportação cancelada.</p>\n }\n </section>\n }\n </aside>\n}\n","import { HttpContextToken } from '@angular/common/http';\n\n/** Lets a host keep export requests out of its blocking, global loading overlay. */\nexport const MAPA_EXPORT_BACKGROUND_REQUEST = new HttpContextToken<boolean>(\n () => false,\n);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './export';\n"],"names":["i1"],"mappings":";;;;;;;;;;;;;;;AAMO,MAAM,qBAAqB,GAAG;AAErC;AACM,SAAU,YAAY,CAAC,KAAW,EAAA;IACtC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;AACnC,QAAA,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC;AACjD,IAAA,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,iBAAiB,EAAE,GAAG,MAAM,CAAC;AACvE;MAEa,UAAU,GAAG,CAAC,KAAa,KACtC;KACG,SAAS,CAAC,KAAK;AACf,KAAA,OAAO,CAAC,kBAAkB,EAAE,EAAE;AAC9B,KAAA,WAAW;AACX,KAAA,OAAO,CAAC,aAAa,EAAE,GAAG;AAC1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PjD;AACO,MAAM,8BAA8B,GAAG,IAAI,gBAAgB,CAChE,MAAM,KAAK;;ACJb;;AAEG;;;;"}
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapa-library-ui",
3
- "version": "2.12.0",
3
+ "version": "2.13.1",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^20.3.0",
6
6
  "@angular/cdk": "^20.2.0",
@@ -17,7 +17,9 @@
17
17
  "ngx-mat-select-search": "^8.0.4",
18
18
  "ngxsmk-datepicker": "^3.0.0",
19
19
  "rxjs": "^7.8.2",
20
- "ts-md5": "^1.3.1"
20
+ "ts-md5": "^1.3.1",
21
+ "exceljs": "^4.4.0",
22
+ "@types/node": ">=20"
21
23
  },
22
24
  "dependencies": {
23
25
  "tslib": "^2.3.0"
@@ -204,6 +206,14 @@
204
206
  "types": "./src/lib/components/warning/index.d.ts",
205
207
  "default": "./fesm2022/mapa-library-ui-src-lib-components-warning.mjs"
206
208
  },
209
+ "./excel-export": {
210
+ "types": "./src/lib/core/excel-export/index.d.ts",
211
+ "default": "./fesm2022/mapa-library-ui-src-lib-core-excel-export.mjs"
212
+ },
213
+ "./export": {
214
+ "types": "./src/lib/core/export/index.d.ts",
215
+ "default": "./fesm2022/mapa-library-ui-src-lib-core-export.mjs"
216
+ },
207
217
  "./package.json": {
208
218
  "default": "./package.json"
209
219
  },
@@ -331,6 +341,14 @@
331
341
  "types": "./src/lib/components/warning/index.d.ts",
332
342
  "default": "./fesm2022/mapa-library-ui-src-lib-components-warning.mjs"
333
343
  },
344
+ "./src/lib/core/excel-export": {
345
+ "types": "./src/lib/core/excel-export/index.d.ts",
346
+ "default": "./fesm2022/mapa-library-ui-src-lib-core-excel-export.mjs"
347
+ },
348
+ "./src/lib/core/export": {
349
+ "types": "./src/lib/core/export/index.d.ts",
350
+ "default": "./fesm2022/mapa-library-ui-src-lib-core-export.mjs"
351
+ },
334
352
  "./src/lib/core/guards/authorize-guard": {
335
353
  "types": "./src/lib/core/guards/authorize-guard/index.d.ts",
336
354
  "default": "./fesm2022/mapa-library-ui-src-lib-core-guards-authorize-guard.mjs"
@@ -344,6 +362,24 @@
344
362
  "default": "./fesm2022/mapa-library-ui-src-lib-core-utils.mjs"
345
363
  }
346
364
  },
365
+ "peerDependenciesMeta": {
366
+ "exceljs": {
367
+ "optional": true
368
+ },
369
+ "@types/node": {
370
+ "optional": true
371
+ }
372
+ },
373
+ "typesVersions": {
374
+ "*": {
375
+ "excel-export": [
376
+ "src/lib/core/excel-export/index.d.ts"
377
+ ],
378
+ "export": [
379
+ "src/lib/core/export/index.d.ts"
380
+ ]
381
+ }
382
+ },
347
383
  "module": "fesm2022/mapa-library-ui.mjs",
348
384
  "typings": "index.d.ts"
349
385
  }
@@ -0,0 +1,192 @@
1
+ /// <reference types="node" />
2
+ import { Worksheet, Workbook, Alignment } from 'exceljs';
3
+ import * as i0 from '@angular/core';
4
+
5
+ /** Cell dates use UTC calendar fields; normalize local UI instants with toExportDate. */
6
+ type ExcelScalar = string | number | boolean | Date | null | undefined;
7
+ type ExcelValue = ExcelScalar | {
8
+ formula: string;
9
+ result: ExcelScalar;
10
+ };
11
+ type ExcelStatusTone = 'ok' | 'info' | 'warning' | 'neutral' | 'danger';
12
+ type ExcelStatusRule = {
13
+ value: string;
14
+ tone: ExcelStatusTone;
15
+ backgroundColor?: never;
16
+ textColor?: never;
17
+ } | {
18
+ value: string;
19
+ tone?: never;
20
+ backgroundColor: string;
21
+ textColor?: string;
22
+ };
23
+ interface ExcelContext {
24
+ module: string;
25
+ company: string;
26
+ user: string;
27
+ generatedAt: Date;
28
+ filters: readonly string[];
29
+ }
30
+ interface ExcelIndicator {
31
+ key: string;
32
+ label: string;
33
+ operation: 'sum' | 'countIf' | 'sumIf';
34
+ criteria?: string | number;
35
+ numFmt?: string;
36
+ absolute?: boolean;
37
+ }
38
+ interface ExcelProgress {
39
+ phase: 'building' | 'serializing';
40
+ completed?: number;
41
+ total?: number;
42
+ }
43
+ interface ExcelColumn<TRow = Record<string, ExcelValue>> {
44
+ key?: string;
45
+ value?: (row: TRow, index: number) => ExcelValue;
46
+ label: string;
47
+ width?: number;
48
+ numFmt?: string;
49
+ total?: 'sum';
50
+ status?: readonly ExcelStatusRule[];
51
+ }
52
+ interface ExcelSheetRequest<TRow = Record<string, ExcelValue>> {
53
+ sheetName: string;
54
+ title?: string;
55
+ columns: readonly ExcelColumn<TRow>[];
56
+ rows: readonly TRow[];
57
+ /** Already translated metadata. At most three lines above the table. */
58
+ metadata?: readonly string[];
59
+ context?: ExcelContext;
60
+ indicators?: readonly ExcelIndicator[];
61
+ mode?: 'mapa' | 'plain';
62
+ rowHeight?: number;
63
+ /** Called on the main thread after building this sheet. */
64
+ customize?: (sheet: Worksheet) => void | Promise<void>;
65
+ }
66
+ interface ExcelWorkbookRequest<TRow = Record<string, ExcelValue>> {
67
+ fileName: string;
68
+ sheets: readonly ExcelSheetRequest<TRow>[];
69
+ creator?: string;
70
+ created?: Date;
71
+ customize?: (workbook: Workbook) => void | Promise<void>;
72
+ /** Cloneable extension interpreted by a consumer-owned worker. */
73
+ extension?: unknown;
74
+ }
75
+ interface ExcelExportOptions {
76
+ isCancelled?: () => boolean;
77
+ /** Angular consumers supply a worker compiled by their application builder. */
78
+ workerFactory?: () => Worker;
79
+ onProgress?: (progress: ExcelProgress) => void;
80
+ }
81
+ interface ExcelWorkerRequest {
82
+ request: ExcelWorkbookRequest;
83
+ format?: 'xlsx' | 'csv';
84
+ }
85
+ type ExcelWorkerResponse = {
86
+ buffer: ArrayBuffer;
87
+ } | {
88
+ error: string;
89
+ } | {
90
+ progress: ExcelProgress;
91
+ };
92
+ declare class ExcelExportCancelledError extends Error {
93
+ constructor();
94
+ }
95
+
96
+ declare function excelFileName(value: string): string;
97
+ declare function excelFileNameWithDate(name: string, reference?: Date): string;
98
+ declare function fitExcelSheetTitle(title: string, maxLength: number): string;
99
+ declare function excelSheetName(value: string): string;
100
+ declare function uniqueExcelSheetNames(values: readonly string[]): string[];
101
+
102
+ declare const MAPA_EXCEL_COLORS: {
103
+ readonly orange: "FFFF560B";
104
+ readonly darkOrange: "FFD94021";
105
+ readonly pale: "FFFFEDE6";
106
+ readonly accent: "FFA8321A";
107
+ readonly ink: "FF162F42";
108
+ readonly text: "FF41566A";
109
+ readonly border: "FFDCE5E8";
110
+ readonly green: "FF065156";
111
+ readonly red: "FFB3341B";
112
+ };
113
+ declare const MAPA_EXCEL_STATUS_COLORS: {
114
+ readonly ok: {
115
+ readonly background: "FFDDF1F2";
116
+ readonly text: "FF065156";
117
+ };
118
+ readonly info: {
119
+ readonly background: "FFE4EEF0";
120
+ readonly text: "FF162F42";
121
+ };
122
+ readonly warning: {
123
+ readonly background: "FFFFF4C7";
124
+ readonly text: "FF6E4A00";
125
+ };
126
+ readonly neutral: {
127
+ readonly background: "FFEEF1F3";
128
+ readonly text: "FF4F5F6B";
129
+ };
130
+ readonly danger: {
131
+ readonly background: "FFFDE9E4";
132
+ readonly text: "FFB3341B";
133
+ };
134
+ };
135
+ declare function fillExcelCell(sheet: Worksheet, row: number, col: number, color: string): void;
136
+ /** The two banner geometries used by the original MF reports. */
137
+ declare function applyMapaExcelBanner(sheet: Worksheet, options: {
138
+ columnCount: number;
139
+ logoId: number;
140
+ title: string;
141
+ titleEndColumn?: number;
142
+ rowHeights?: readonly number[];
143
+ titleAlignment?: Partial<Alignment>;
144
+ absoluteLogo?: boolean;
145
+ }): void;
146
+ declare function styleMapaExcelHeaderCell(sheet: Worksheet, row: number, col: number, headerRow?: number): void;
147
+
148
+ declare function resolveWorkbookConstructor(module: {
149
+ Workbook?: typeof Workbook;
150
+ default?: {
151
+ Workbook?: typeof Workbook;
152
+ };
153
+ }): typeof Workbook;
154
+ declare function createExcelWorkbook(): Promise<Workbook>;
155
+ declare function addMapaExcelLogo(book: Workbook): Promise<number>;
156
+ /** Adds a table to an existing workbook; no domain or HTTP dependencies. */
157
+ declare function addExcelTable<TRow>(book: Workbook, request: ExcelSheetRequest<TRow>, options?: {
158
+ logoId?: number;
159
+ isCancelled?: () => boolean;
160
+ onProgress?: (progress: ExcelProgress) => void;
161
+ }): Promise<Worksheet>;
162
+ declare function buildExcelWorkbook<TRow>(request: ExcelWorkbookRequest<TRow>, isCancelled?: () => boolean, onProgress?: (progress: ExcelProgress) => void): Promise<Workbook>;
163
+ declare function serializeExcelWorkbook(book: Workbook): Promise<ArrayBuffer>;
164
+ /** May be called from a consumer-owned module worker. Functions cannot be cloned. */
165
+ declare function serializeExcelRequest(request: ExcelWorkbookRequest, onProgress?: (progress: ExcelProgress) => void): Promise<ArrayBuffer>;
166
+
167
+ declare class MapaExcelExportService {
168
+ createWorkbook(): Promise<Workbook>;
169
+ buildWorkbook<TRow>(request: ExcelWorkbookRequest<TRow>, isCancelled?: () => boolean): Promise<Workbook>;
170
+ serialize(book: Workbook): Promise<ArrayBuffer>;
171
+ exportTable<TRow>(request: ExcelSheetRequest<TRow> & {
172
+ fileName: string;
173
+ }, options?: ExcelExportOptions): Promise<void>;
174
+ exportWorkbook<TRow>(request: ExcelWorkbookRequest<TRow>, options?: ExcelExportOptions): Promise<void>;
175
+ generateWorkbook<TRow>(request: ExcelWorkbookRequest<TRow>, options?: ExcelExportOptions): Promise<ArrayBuffer>;
176
+ generateCsv(request: ExcelWorkbookRequest, options: ExcelExportOptions): Promise<ArrayBuffer>;
177
+ save(book: Workbook, fileName: string, isCancelled?: () => boolean): Promise<void>;
178
+ download(buffer: ArrayBuffer, fileName: string): void;
179
+ private serializeInWorker;
180
+ static ɵfac: i0.ɵɵFactoryDeclaration<MapaExcelExportService, never>;
181
+ static ɵprov: i0.ɵɵInjectableDeclaration<MapaExcelExportService>;
182
+ }
183
+
184
+ /**
185
+ * A remote's worker URL can have a different origin from the shell. Bootstrap
186
+ * through a local blob, then import the self-contained module with normal CORS.
187
+ * Keep the local name `Worker` at the call site so Angular recognizes the URL.
188
+ */
189
+ declare function getExcelWorkerConstructor(): typeof Worker;
190
+
191
+ export { ExcelExportCancelledError, MAPA_EXCEL_COLORS, MAPA_EXCEL_STATUS_COLORS, MapaExcelExportService, addExcelTable, addMapaExcelLogo, applyMapaExcelBanner, buildExcelWorkbook, createExcelWorkbook, excelFileName, excelFileNameWithDate, excelSheetName, fillExcelCell, fitExcelSheetTitle, getExcelWorkerConstructor, resolveWorkbookConstructor, serializeExcelRequest, serializeExcelWorkbook, styleMapaExcelHeaderCell, uniqueExcelSheetNames };
192
+ export type { ExcelColumn, ExcelContext, ExcelExportOptions, ExcelIndicator, ExcelProgress, ExcelScalar, ExcelSheetRequest, ExcelStatusRule, ExcelStatusTone, ExcelValue, ExcelWorkbookRequest, ExcelWorkerRequest, ExcelWorkerResponse };
@@ -0,0 +1,219 @@
1
+ /// <reference types="node" />
2
+ import { Worksheet } from 'exceljs';
3
+ import * as i0 from '@angular/core';
4
+ import { InjectionToken } from '@angular/core';
5
+ import { MatDialogRef } from '@angular/material/dialog';
6
+ import { HttpContextToken } from '@angular/common/http';
7
+
8
+ /** Cell dates use UTC calendar fields; normalize local UI instants with toExportDate. */
9
+ type ExcelScalar = string | number | boolean | Date | null | undefined;
10
+ type ExcelValue = ExcelScalar | {
11
+ formula: string;
12
+ result: ExcelScalar;
13
+ };
14
+ type ExcelStatusTone = 'ok' | 'info' | 'warning' | 'neutral' | 'danger';
15
+ type ExcelStatusRule = {
16
+ value: string;
17
+ tone: ExcelStatusTone;
18
+ backgroundColor?: never;
19
+ textColor?: never;
20
+ } | {
21
+ value: string;
22
+ tone?: never;
23
+ backgroundColor: string;
24
+ textColor?: string;
25
+ };
26
+ interface ExcelContext {
27
+ module: string;
28
+ company: string;
29
+ user: string;
30
+ generatedAt: Date;
31
+ filters: readonly string[];
32
+ }
33
+ interface ExcelIndicator {
34
+ key: string;
35
+ label: string;
36
+ operation: 'sum' | 'countIf' | 'sumIf';
37
+ criteria?: string | number;
38
+ numFmt?: string;
39
+ absolute?: boolean;
40
+ }
41
+ interface ExcelColumn<TRow = Record<string, ExcelValue>> {
42
+ key?: string;
43
+ value?: (row: TRow, index: number) => ExcelValue;
44
+ label: string;
45
+ width?: number;
46
+ numFmt?: string;
47
+ total?: 'sum';
48
+ status?: readonly ExcelStatusRule[];
49
+ }
50
+ interface ExcelSheetRequest<TRow = Record<string, ExcelValue>> {
51
+ sheetName: string;
52
+ title?: string;
53
+ columns: readonly ExcelColumn<TRow>[];
54
+ rows: readonly TRow[];
55
+ /** Already translated metadata. At most three lines above the table. */
56
+ metadata?: readonly string[];
57
+ context?: ExcelContext;
58
+ indicators?: readonly ExcelIndicator[];
59
+ mode?: 'mapa' | 'plain';
60
+ rowHeight?: number;
61
+ /** Called on the main thread after building this sheet. */
62
+ customize?: (sheet: Worksheet) => void | Promise<void>;
63
+ }
64
+
65
+ type ExportRow$1 = Record<string, ExcelValue>;
66
+ type ExportFormat = 'xlsx' | 'csv';
67
+ type ExportScope = 'all' | 'selected';
68
+ interface ExportColumn extends ExcelColumn<ExportRow$1> {
69
+ key: string;
70
+ visible?: boolean;
71
+ exportable?: boolean;
72
+ }
73
+ interface ExportLoadContext {
74
+ signal: AbortSignal;
75
+ generatedAt?: Date;
76
+ scope: ExportScope;
77
+ onProgress: (completed: number, total?: number) => void;
78
+ }
79
+ interface ExportDataset {
80
+ id: string;
81
+ label: string;
82
+ sheetName?: string;
83
+ columns: readonly ExportColumn[];
84
+ totalCount: number;
85
+ rows?: readonly ExportRow$1[];
86
+ selectedRows?: readonly ExportRow$1[];
87
+ selectable?: boolean;
88
+ indicators?: readonly ExcelIndicator[];
89
+ load?: (context: ExportLoadContext) => Promise<readonly ExportRow$1[]>;
90
+ }
91
+ interface ExportChoices {
92
+ format: ExportFormat;
93
+ scope: ExportScope;
94
+ visibleOnly: boolean;
95
+ datasetIds: readonly string[];
96
+ }
97
+ interface ExportPreparedContent {
98
+ sheets: ExcelSheetRequest<ExportRow$1>[];
99
+ /** Cloneable payload interpreted exclusively by a consumer-owned worker. */
100
+ extension?: unknown;
101
+ }
102
+ interface ExportRequest {
103
+ listing: string;
104
+ allRecordsDescription?: string;
105
+ context: Omit<ExcelContext, 'generatedAt'>;
106
+ datasets: readonly ExportDataset[];
107
+ initialScope?: ExportScope;
108
+ workerFactory?: () => Worker;
109
+ /** For domain reports that prepare several related sheets atomically. */
110
+ prepare?: (choices: ExportChoices, context: ExportLoadContext) => Promise<ExportPreparedContent>;
111
+ }
112
+ interface ExportProgress {
113
+ phase: 'fetching' | 'building' | 'serializing';
114
+ completed?: number;
115
+ total?: number;
116
+ part?: number;
117
+ parts?: number;
118
+ }
119
+ interface ExportFile {
120
+ name: string;
121
+ mime: string;
122
+ buffer: ArrayBuffer;
123
+ }
124
+ interface ExportTask {
125
+ id: string;
126
+ title: string;
127
+ state: 'queued' | 'running' | 'ready' | 'cancelled' | 'error';
128
+ progress?: ExportProgress;
129
+ background: boolean;
130
+ files: readonly ExportFile[];
131
+ recordCount?: number;
132
+ error?: string;
133
+ }
134
+
135
+ type ExportRow = Record<string, ExcelValue>;
136
+ declare const EXPORT_FILE_ROW_LIMIT = 100000;
137
+ /** Encode browser-local calendar fields for timezone-free Excel and CSV cells. */
138
+ declare function toExportDate(value: Date): Date;
139
+ declare const exportSlug: (value: string) => string;
140
+ declare function exportFileBase(listing: string, company: string, date: Date): string;
141
+ /** Greedy packing preserves dataset order and counts records across all sheets. */
142
+ declare function splitExportSheets(sheets: readonly ExcelSheetRequest<ExportRow>[], limit?: number): ExcelSheetRequest<ExportRow>[][];
143
+ declare function encodeExportCsv(sheet: ExcelSheetRequest<ExportRow>, onProgress?: (completed: number, total: number) => void): ArrayBuffer;
144
+ interface ExportPage<TRow> {
145
+ data: readonly TRow[];
146
+ totalCount: number;
147
+ pageSize: number;
148
+ pageIndex?: number;
149
+ }
150
+ /** HTTP and domain adaptation remain in load; this helper verifies completeness. */
151
+ declare function collectExportPages<TRow>(options: {
152
+ totalCount: number;
153
+ load: (pageIndex: number, pageSize: number, signal: AbortSignal) => Promise<ExportPage<TRow>>;
154
+ key: (row: TRow) => string;
155
+ signal: AbortSignal;
156
+ onProgress?: (completed: number, total: number) => void;
157
+ }): Promise<TRow[]>;
158
+
159
+ declare const MAPA_EXPORT_WORKER_FACTORY: InjectionToken<() => Worker>;
160
+ declare function snapshotExportRequest(request: ExportRequest): ExportRequest;
161
+ declare class MapaExportJobsService {
162
+ private readonly excel;
163
+ private readonly defaultWorker;
164
+ private readonly state;
165
+ readonly tasks: i0.Signal<readonly ExportTask[]>;
166
+ private readonly pending;
167
+ private readonly controllers;
168
+ private draining;
169
+ enqueue(request: ExportRequest, choices: ExportChoices): string;
170
+ cancel(id: string): void;
171
+ remove(id: string): void;
172
+ clear(): void;
173
+ retry(id: string): void;
174
+ download(file: ExportFile): void;
175
+ private patch;
176
+ private drain;
177
+ private run;
178
+ static ɵfac: i0.ɵɵFactoryDeclaration<MapaExportJobsService, never>;
179
+ static ɵprov: i0.ɵɵInjectableDeclaration<MapaExportJobsService>;
180
+ }
181
+
182
+ declare class MapaExportDialogComponent {
183
+ readonly request: ExportRequest;
184
+ readonly dialog: MatDialogRef<any, any>;
185
+ private readonly jobs;
186
+ readonly selectable: boolean;
187
+ readonly selectedCount: number;
188
+ readonly total: number;
189
+ readonly hasHiddenColumns: boolean;
190
+ readonly choices: ExportChoices;
191
+ error: string;
192
+ get fileName(): string;
193
+ toggleDataset(id: string, checked: boolean): void;
194
+ generate(): void;
195
+ static ɵfac: i0.ɵɵFactoryDeclaration<MapaExportDialogComponent, never>;
196
+ static ɵcmp: i0.ɵɵComponentDeclaration<MapaExportDialogComponent, "mapa-export-dialog", never, {}, {}, never, never, true, never>;
197
+ }
198
+
199
+ declare class MapaExportDialogService {
200
+ private readonly dialog;
201
+ private ref?;
202
+ open(request: ExportRequest): MatDialogRef<MapaExportDialogComponent, string>;
203
+ static ɵfac: i0.ɵɵFactoryDeclaration<MapaExportDialogService, never>;
204
+ static ɵprov: i0.ɵɵInjectableDeclaration<MapaExportDialogService>;
205
+ }
206
+
207
+ declare class MapaExportJobsComponent {
208
+ readonly jobs: MapaExportJobsService;
209
+ percent(task: ExportTask): number | null;
210
+ phase(task: ExportTask): string;
211
+ static ɵfac: i0.ɵɵFactoryDeclaration<MapaExportJobsComponent, never>;
212
+ static ɵcmp: i0.ɵɵComponentDeclaration<MapaExportJobsComponent, "mapa-export-jobs", never, {}, {}, never, never, true, never>;
213
+ }
214
+
215
+ /** Lets a host keep export requests out of its blocking, global loading overlay. */
216
+ declare const MAPA_EXPORT_BACKGROUND_REQUEST: HttpContextToken<boolean>;
217
+
218
+ export { EXPORT_FILE_ROW_LIMIT, MAPA_EXPORT_BACKGROUND_REQUEST, MAPA_EXPORT_WORKER_FACTORY, MapaExportDialogService, MapaExportJobsComponent, MapaExportJobsService, collectExportPages, encodeExportCsv, exportFileBase, exportSlug, snapshotExportRequest, splitExportSheets, toExportDate };
219
+ export type { ExportChoices, ExportColumn, ExportDataset, ExportFile, ExportFormat, ExportLoadContext, ExportPage, ExportPreparedContent, ExportProgress, ExportRequest, ExportRow$1 as ExportRow, ExportScope, ExportTask };
@@ -0,0 +1,4 @@
1
+ export { createExcelWorkbook, buildExcelWorkbook, addExcelTable, addMapaExcelLogo, serializeExcelWorkbook, serializeExcelRequest, resolveWorkbookConstructor, applyMapaExcelBanner, fillExcelCell, styleMapaExcelHeaderCell, MAPA_EXCEL_COLORS, MAPA_EXCEL_STATUS_COLORS, excelFileName, excelFileNameWithDate, excelSheetName, fitExcelSheetTitle, uniqueExcelSheetNames, ExcelExportCancelledError } from '../src/lib/core/excel-export/index';
2
+ export type { ExcelWorkbookRequest, ExcelSheetRequest, ExcelColumn, ExcelContext, ExcelIndicator, ExcelValue, ExcelProgress, ExcelWorkerRequest, ExcelWorkerResponse } from '../src/lib/core/excel-export/index';
3
+ export declare function encodeExportCsv(sheet: import('../src/lib/core/excel-export/index').ExcelSheetRequest): ArrayBuffer;
4
+ export declare function registerExcelExportWorker(compose?: (book: import('exceljs').Workbook, request: import('../src/lib/core/excel-export/index').ExcelWorkbookRequest, progress: (progress: import('../src/lib/core/excel-export/index').ExcelProgress) => void) => Promise<void> | void): void;