mapa-library-ui 2.13.1 → 2.13.3

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.
Files changed (44) hide show
  1. package/docs/TABLE_EXPORT.md +147 -2
  2. package/fesm2022/mapa-library-ui-src-lib-components-capability.mjs +3 -0
  3. package/fesm2022/mapa-library-ui-src-lib-components-capability.mjs.map +1 -1
  4. package/fesm2022/mapa-library-ui-src-lib-components-chart.mjs +3 -0
  5. package/fesm2022/mapa-library-ui-src-lib-components-chart.mjs.map +1 -1
  6. package/fesm2022/mapa-library-ui-src-lib-components-datepicker.mjs +3 -1
  7. package/fesm2022/mapa-library-ui-src-lib-components-datepicker.mjs.map +1 -1
  8. package/fesm2022/mapa-library-ui-src-lib-components-dropdown-tree.mjs +3 -0
  9. package/fesm2022/mapa-library-ui-src-lib-components-dropdown-tree.mjs.map +1 -1
  10. package/fesm2022/mapa-library-ui-src-lib-components-dropdown.mjs +3 -0
  11. package/fesm2022/mapa-library-ui-src-lib-components-dropdown.mjs.map +1 -1
  12. package/fesm2022/mapa-library-ui-src-lib-components-filters.mjs +3 -0
  13. package/fesm2022/mapa-library-ui-src-lib-components-filters.mjs.map +1 -1
  14. package/fesm2022/mapa-library-ui-src-lib-components-form.mjs +3 -1
  15. package/fesm2022/mapa-library-ui-src-lib-components-form.mjs.map +1 -1
  16. package/fesm2022/mapa-library-ui-src-lib-components-group-report.mjs +3 -1
  17. package/fesm2022/mapa-library-ui-src-lib-components-group-report.mjs.map +1 -1
  18. package/fesm2022/mapa-library-ui-src-lib-components-input.mjs +3 -0
  19. package/fesm2022/mapa-library-ui-src-lib-components-input.mjs.map +1 -1
  20. package/fesm2022/mapa-library-ui-src-lib-components-scale-parameterization.mjs +3 -0
  21. package/fesm2022/mapa-library-ui-src-lib-components-scale-parameterization.mjs.map +1 -1
  22. package/fesm2022/mapa-library-ui-src-lib-components-scale.mjs +3 -0
  23. package/fesm2022/mapa-library-ui-src-lib-components-scale.mjs.map +1 -1
  24. package/fesm2022/mapa-library-ui-src-lib-components-table.mjs +3 -1
  25. package/fesm2022/mapa-library-ui-src-lib-components-table.mjs.map +1 -1
  26. package/fesm2022/mapa-library-ui-src-lib-components-textarea.mjs +3 -0
  27. package/fesm2022/mapa-library-ui-src-lib-components-textarea.mjs.map +1 -1
  28. package/fesm2022/mapa-library-ui-src-lib-components-warning.mjs +3 -0
  29. package/fesm2022/mapa-library-ui-src-lib-components-warning.mjs.map +1 -1
  30. package/fesm2022/mapa-library-ui-src-lib-core-excel-export.mjs +242 -39
  31. package/fesm2022/mapa-library-ui-src-lib-core-excel-export.mjs.map +1 -1
  32. package/fesm2022/mapa-library-ui-src-lib-core-export.mjs +107 -26
  33. package/fesm2022/mapa-library-ui-src-lib-core-export.mjs.map +1 -1
  34. package/fesm2022/mapa-library-ui.mjs +3 -1
  35. package/fesm2022/mapa-library-ui.mjs.map +1 -1
  36. package/index.d.ts +72 -0
  37. package/mapa-library-ui-2.13.3.tgz +0 -0
  38. package/package.json +2 -2
  39. package/src/lib/core/excel-export/index.d.ts +86 -4
  40. package/src/lib/core/export/index.d.ts +215 -3
  41. package/worker/excel-export.runtime.d.ts +2 -2
  42. package/worker/excel-export.runtime.js +23 -23
  43. package/worker/excel-export.worker.js +23 -23
  44. package/mapa-library-ui-2.13.1.tgz +0 -0
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, inject, signal, Injectable, ViewEncapsulation, Component, ChangeDetectionStrategy } from '@angular/core';
3
+ import { MapaI18nService } from 'mapa-library-ui';
3
4
  import { MapaExcelExportService, ExcelExportCancelledError } from 'mapa-library-ui/src/lib/core/excel-export';
4
5
  import * as i2 from '@angular/material/dialog';
5
6
  import { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule, MatDialog } from '@angular/material/dialog';
@@ -13,11 +14,23 @@ import * as i1$1 from '@angular/material/progress-bar';
13
14
  import { MatProgressBarModule } from '@angular/material/progress-bar';
14
15
  import { HttpContextToken } from '@angular/common/http';
15
16
 
17
+ function formatExportText(template, values) {
18
+ return template.replace(/\{(\w+)\}/g, (placeholder, key) => values[key] === undefined ? placeholder : String(values[key]));
19
+ }
20
+ /** Stable codes survive worker transport; default messages preserve the low-level API. */
21
+ class ExcelExportError extends Error {
22
+ constructor(exportCode, message) {
23
+ super(message);
24
+ this.exportCode = exportCode;
25
+ this.name = 'ExcelExportError';
26
+ }
27
+ }
28
+
16
29
  const EXPORT_FILE_ROW_LIMIT = 100_000;
17
30
  /** Encode browser-local calendar fields for timezone-free Excel and CSV cells. */
18
31
  function toExportDate(value) {
19
32
  if (!Number.isFinite(value.getTime()))
20
- throw new Error('Data inválida na exportação.');
33
+ throw new ExcelExportError('errorDate', 'Data inválida na exportação.');
21
34
  return new Date(value.getTime() - value.getTimezoneOffset() * 60_000);
22
35
  }
23
36
  const exportSlug = (value) => value
@@ -33,7 +46,7 @@ function exportFileBase(listing, company, date) {
33
46
  /** Greedy packing preserves dataset order and counts records across all sheets. */
34
47
  function splitExportSheets(sheets, limit = EXPORT_FILE_ROW_LIMIT) {
35
48
  if (!Number.isInteger(limit) || limit < 1)
36
- throw new Error('Limite de registros inválido.');
49
+ throw new ExcelExportError('errorRowCount', 'Limite de registros inválido.');
37
50
  const parts = [[]];
38
51
  let used = 0;
39
52
  for (const sheet of sheets) {
@@ -63,13 +76,13 @@ function encodeExportCsv(sheet, onProgress) {
63
76
  ? input.result
64
77
  : input;
65
78
  if (value instanceof Date && !Number.isFinite(value.getTime()))
66
- throw new Error('Data inválida na exportação.');
79
+ throw new ExcelExportError('errorDate', 'Data inválida na exportação.');
67
80
  if (typeof value === 'number' && !Number.isFinite(value))
68
81
  return '';
69
82
  const text = value == null
70
83
  ? ''
71
84
  : value instanceof Date
72
- ? value.toLocaleString('pt-BR', { timeZone: 'UTC' })
85
+ ? value.toLocaleString(sheet.localization?.locale ?? 'pt-BR', { timeZone: 'UTC' })
73
86
  : String(value);
74
87
  // Quoting alone does not stop spreadsheet apps interpreting user text as a formula.
75
88
  const literal = typeof value === 'string' && /^[=+\-@\t\r]/.test(text)
@@ -108,12 +121,12 @@ async function collectExportPages(options) {
108
121
  (expected !== undefined && expected !== page.totalCount) ||
109
122
  (page.pageIndex !== undefined && page.pageIndex !== pageIndex) ||
110
123
  (pageIndex > 1 && page.pageSize !== pageSize))
111
- throw new Error('Os dados mudaram durante a exportação. Atualize a listagem e tente novamente.');
124
+ throw new ExcelExportError('errorDataChanged', 'Os dados mudaram durante a exportação. Atualize a listagem e tente novamente.');
112
125
  expected = page.totalCount;
113
126
  for (const row of page.data) {
114
127
  const key = options.key(row);
115
128
  if (!key || keys.has(key))
116
- throw new Error('Registros duplicados ou sem identificação na exportação.');
129
+ throw new ExcelExportError('errorDuplicate', 'Registros duplicados ou sem identificação na exportação.');
117
130
  keys.add(key);
118
131
  result.push(row);
119
132
  }
@@ -125,21 +138,43 @@ async function collectExportPages(options) {
125
138
  !Number.isInteger(page.pageSize) ||
126
139
  page.pageSize < 1 ||
127
140
  page.data.length !== page.pageSize)
128
- throw new Error('A API retornou uma exportação incompleta.');
141
+ throw new ExcelExportError('errorIncomplete', 'A API retornou uma exportação incompleta.');
129
142
  pageSize = page.pageSize;
130
143
  pageIndex++;
131
144
  }
132
145
  }
133
146
 
147
+ function exportErrorMessage(error, texts) {
148
+ const code = error && typeof error === 'object' && 'exportCode' in error
149
+ ? error.exportCode
150
+ : undefined;
151
+ if (typeof code === 'string' && code.startsWith('error') && code in texts)
152
+ return texts[code];
153
+ return error instanceof Error ? error.message : texts.errorExport;
154
+ }
155
+
134
156
  const MAPA_EXPORT_WORKER_FACTORY = new InjectionToken('MAPA_EXPORT_WORKER_FACTORY');
135
157
  function snapshotExportRequest(request) {
136
158
  return {
137
159
  ...request,
160
+ localization: request.localization
161
+ ? structuredClone(request.localization)
162
+ : undefined,
138
163
  context: { ...request.context, filters: [...request.context.filters] },
139
164
  datasets: request.datasets.map((dataset) => ({
140
165
  ...dataset,
166
+ style: dataset.style ? structuredClone(dataset.style) : undefined,
167
+ headerStyle: dataset.headerStyle
168
+ ? structuredClone(dataset.headerStyle)
169
+ : undefined,
170
+ autoWidth: dataset.autoWidth ? { ...dataset.autoWidth } : undefined,
141
171
  columns: dataset.columns.map((column) => ({
142
172
  ...column,
173
+ style: column.style ? structuredClone(column.style) : undefined,
174
+ headerStyle: column.headerStyle
175
+ ? structuredClone(column.headerStyle)
176
+ : undefined,
177
+ autoWidth: column.autoWidth ? { ...column.autoWidth } : undefined,
143
178
  status: column.status?.map((status) => ({ ...status })),
144
179
  })),
145
180
  indicators: dataset.indicators?.map((indicator) => ({ ...indicator })),
@@ -152,6 +187,7 @@ function snapshotExportRequest(request) {
152
187
  }
153
188
  class MapaExportJobsService {
154
189
  constructor() {
190
+ this.i18n = inject(MapaI18nService);
155
191
  this.excel = inject(MapaExcelExportService);
156
192
  this.defaultWorker = inject(MAPA_EXPORT_WORKER_FACTORY, {
157
193
  optional: true,
@@ -165,7 +201,10 @@ class MapaExportJobsService {
165
201
  enqueue(request, choices) {
166
202
  const id = crypto.randomUUID();
167
203
  this.pending.set(id, {
168
- request: snapshotExportRequest(request),
204
+ request: snapshotExportRequest({
205
+ ...request,
206
+ localization: request.localization ?? this.i18n.texts.export,
207
+ }),
169
208
  choices: { ...choices, datasetIds: [...choices.datasetIds] },
170
209
  createdAt: new Date(),
171
210
  });
@@ -256,7 +295,7 @@ class MapaExportJobsService {
256
295
  try {
257
296
  const workerFactory = request.workerFactory ?? this.defaultWorker;
258
297
  if (!workerFactory)
259
- throw new Error('O worker de exportação não foi configurado nesta aplicação.');
298
+ throw new Error(this.i18n.texts.export.errorWorker);
260
299
  const loadContext = {
261
300
  signal,
262
301
  generatedAt: createdAt,
@@ -282,13 +321,18 @@ class MapaExportJobsService {
282
321
  columns: dataset.columns.filter((column) => column.exportable !== false &&
283
322
  (!choices.visibleOnly || column.visible !== false)),
284
323
  indicators: dataset.indicators,
324
+ style: dataset.style,
325
+ headerStyle: dataset.headerStyle,
326
+ autoWidth: dataset.autoWidth,
327
+ rowHeight: dataset.rowHeight,
328
+ headerHeight: dataset.headerHeight,
285
329
  });
286
330
  }
287
331
  prepared = { sheets };
288
332
  }
289
333
  signal.throwIfAborted();
290
334
  if (!prepared.sheets.length)
291
- throw new Error('Selecione pelo menos uma tabela.');
335
+ throw new Error(this.i18n.texts.export.errorSelection);
292
336
  this.patch(id, {
293
337
  background: prepared.sheets.reduce((sum, sheet) => sum + sheet.rows.length, 0) >
294
338
  5_000,
@@ -297,7 +341,9 @@ class MapaExportJobsService {
297
341
  const sheets = [];
298
342
  for (const sheet of prepared.sheets) {
299
343
  if (!sheet.columns.length)
300
- throw new Error(`Não há colunas para exportar em ${sheet.sheetName}.`);
344
+ throw new Error(formatExportText(this.i18n.texts.export.errorNoColumns, {
345
+ listing: sheet.sheetName,
346
+ }));
301
347
  const columns = sheet.columns.map((column, index) => ({
302
348
  ...column,
303
349
  key: column.key ?? `column${index}`,
@@ -318,6 +364,7 @@ class MapaExportJobsService {
318
364
  }
319
365
  sheets.push({
320
366
  ...sheet,
367
+ localization: structuredClone(sheet.localization ?? request.localization),
321
368
  columns,
322
369
  rows,
323
370
  context: { ...request.context, generatedAt: createdAt },
@@ -364,6 +411,7 @@ class MapaExportJobsService {
364
411
  sheets: batch,
365
412
  created: createdAt,
366
413
  creator: request.context.user,
414
+ localization: request.localization,
367
415
  extension: index === 0 ? prepared.extension : undefined,
368
416
  };
369
417
  const buffer = choices.format === 'xlsx'
@@ -393,9 +441,7 @@ class MapaExportJobsService {
393
441
  this.patch(id, {
394
442
  state: 'error',
395
443
  files: [],
396
- error: error instanceof Error
397
- ? error.message
398
- : 'Não foi possível exportar.',
444
+ error: exportErrorMessage(error, this.i18n.texts.export),
399
445
  progress: undefined,
400
446
  });
401
447
  }
@@ -416,6 +462,7 @@ class MapaExportDialogComponent {
416
462
  this.request = inject(MAT_DIALOG_DATA);
417
463
  this.dialog = inject((MatDialogRef));
418
464
  this.jobs = inject(MapaExportJobsService);
465
+ this.i18n = inject(MapaI18nService);
419
466
  this.selectable = this.request.datasets.some((dataset) => dataset.selectable);
420
467
  this.selectedCount = this.request.datasets.reduce((sum, dataset) => sum + (dataset.selectedRows?.length ?? 0), 0);
421
468
  this.total = this.request.datasets.reduce((sum, dataset) => sum + dataset.totalCount, 0);
@@ -432,6 +479,23 @@ class MapaExportDialogComponent {
432
479
  };
433
480
  this.error = '';
434
481
  }
482
+ get texts() {
483
+ return this.i18n.texts.export;
484
+ }
485
+ get title() {
486
+ return formatExportText(this.texts.title, {
487
+ listing: this.request.listing,
488
+ });
489
+ }
490
+ get allDescription() {
491
+ return (this.request.allRecordsDescription ||
492
+ `${this.total.toLocaleString(this.texts.locale)} ${this.total === 1 ? this.texts.record : this.texts.records}${this.request.context.filters.length ? ' · ' + this.request.context.filters.join(' · ') : ''}`);
493
+ }
494
+ get selectedDescription() {
495
+ return formatExportText(this.selectedCount === 1
496
+ ? this.texts.selectedRecord
497
+ : this.texts.selectedRecords, { count: this.selectedCount.toLocaleString(this.texts.locale) });
498
+ }
435
499
  get fileName() {
436
500
  return `${exportFileBase(this.request.listing, this.request.context.company, new Date())}.${this.choices.format}`;
437
501
  }
@@ -450,16 +514,16 @@ class MapaExportDialogComponent {
450
514
  catch (error) {
451
515
  this.error =
452
516
  error instanceof Error
453
- ? error.message
454
- : 'Não foi possível iniciar a exportação.';
517
+ ? exportErrorMessage(error, this.texts)
518
+ : this.texts.errorStart;
455
519
  }
456
520
  }
457
521
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: MapaExportDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
458
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.21", type: MapaExportDialogComponent, isStandalone: true, selector: "mapa-export-dialog", ngImport: i0, template: "<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 \u00D7\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 ? \" \u00B7 \" + request.context.filters.join(\" \u00B7 \")\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\u00FAdo 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\u00E7\u00E3o</span\n >\n </mat-radio-button>\n </mat-radio-group>\n </fieldset>\n @if (hasHiddenColumns) {\n <mat-checkbox [(ngModel)]=\"choices.visibleOnly\"\n >Incluir s\u00F3 as colunas vis\u00EDveis 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", styles: [".mapa-export-dialog-panel{--mat-dialog-container-shape: 16px}mapa-export-dialog{display:block;color:#162f42;font-family:inherit}.mapa-export-dialog-panel mapa-export-dialog .mat-mdc-radio-button{--mat-radio-selected-icon-color: #d94021;--mat-radio-selected-hover-icon-color: #d94021}.mapa-export-dialog-panel mapa-export-dialog .mat-mdc-checkbox{--mat-checkbox-selected-icon-color: #d94021;--mat-checkbox-selected-hover-icon-color: #d94021}.mapa-export__header{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:24px 24px 8px}.mapa-export-dialog-panel .mapa-export__header h2{margin:0;padding:0;font-family:inherit;font-size:20px;font-weight:600;line-height:1.3;color:#162f42}.mapa-export__header h2:before{display:none}.mapa-export__header p{margin:6px 0 0;color:#41566a;font-size:14px}.mapa-export__close{background:transparent;border:0;color:inherit;font-size:26px;min-width:36px;min-height:36px;cursor:pointer}.mapa-export__content{display:flex;flex-direction:column;gap:20px;padding:20px 24px;color:inherit}mapa-export-dialog fieldset{border:0;margin:0;padding:0;min-width:0}mapa-export-dialog legend{margin-bottom:10px;font-size:14px;font-weight:600;color:#162f42}mapa-export-dialog mat-radio-group{display:flex;flex-direction:column;gap:8px}.mapa-export__option{display:block;border:1px solid #dce5e8;border-radius:10px;padding:8px;min-width:0}.mapa-export__option--selected{border-color:#ff560b;background:#ffede6}.mapa-export__label,.mapa-export__description{display:block}.mapa-export__label{font-weight:600;color:#162f42}.mapa-export__description{color:#41566a;font-size:13px;line-height:20px}.mapa-export__formats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.mapa-export__filename{background:#eef3f4;border-radius:10px;padding:12px;margin:0;overflow-wrap:anywhere;font:12px/1.5 monospace}.mapa-export__actions{border-top:1px solid #dce5e8;padding:16px 24px 20px;justify-content:flex-end;gap:8px}.mapa-export__button{min-height:44px;border:1px solid #8299a8;border-radius:8px;padding:0 16px;color:#162f42;background:transparent;font:inherit;font-weight:600;cursor:pointer}.mapa-export__button--primary{background:#d94021;border-color:#d94021;color:#fff}.mapa-export__button:disabled{opacity:.5;cursor:default}mapa-export-dialog button:focus-visible{outline:2px solid #162f42;outline-offset:3px}@media(max-width:440px){.mapa-export__formats{grid-template-columns:1fr}}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i3.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "directive", type: i4.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i4.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }], encapsulation: i0.ViewEncapsulation.None }); }
522
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.21", type: MapaExportDialogComponent, isStandalone: true, selector: "mapa-export-dialog", ngImport: i0, template: "<header class=\"mapa-export__header\">\n <div>\n <h2 mat-dialog-title>{{ title }}</h2>\n <p>{{ texts.description }}</p>\n </div>\n <button\n class=\"mapa-export__close\"\n type=\"button\"\n [attr.aria-label]=\"texts.close\"\n (click)=\"dialog.close()\"\n >\n \u00D7\n </button>\n</header>\n<mat-dialog-content class=\"mapa-export__content\">\n <fieldset>\n <legend>{{ texts.scope }}</legend>\n <mat-radio-group\n [(ngModel)]=\"choices.scope\"\n [attr.aria-label]=\"texts.scope\"\n >\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\">{{ texts.allRecords }}</span>\n <span class=\"mapa-export__description\">{{ allDescription }}</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\">{{ texts.selectedOnly }}</span>\n <span class=\"mapa-export__description\">{{\n selectedDescription\n }}</span>\n </mat-radio-button>\n }\n </mat-radio-group>\n </fieldset>\n @if (request.datasets.length > 1) {\n <fieldset>\n <legend>{{ texts.content }}</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>{{ texts.format }}</legend>\n <mat-radio-group\n class=\"mapa-export__formats\"\n [(ngModel)]=\"choices.format\"\n [attr.aria-label]=\"texts.format\"\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\">{{ texts.excel }}</span\n ><span class=\"mapa-export__description\">{{\n texts.excelDescription\n }}</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\">{{ texts.csv }}</span\n ><span class=\"mapa-export__description\">{{\n texts.csvDescription\n }}</span>\n </mat-radio-button>\n </mat-radio-group>\n </fieldset>\n @if (hasHiddenColumns) {\n <mat-checkbox [(ngModel)]=\"choices.visibleOnly\">{{\n texts.visibleOnly\n }}</mat-checkbox>\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 {{ texts.cancel }}\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 {{ texts.generate }}\n </button>\n</mat-dialog-actions>\n", styles: [".mapa-export-dialog-panel{--mat-dialog-container-shape: 16px}mapa-export-dialog{display:block;color:#162f42;font-family:inherit}.mapa-export-dialog-panel mapa-export-dialog .mat-mdc-radio-button{--mat-radio-selected-icon-color: #d94021;--mat-radio-selected-hover-icon-color: #d94021}.mapa-export-dialog-panel mapa-export-dialog .mat-mdc-checkbox{--mat-checkbox-selected-icon-color: #d94021;--mat-checkbox-selected-hover-icon-color: #d94021}.mapa-export__header{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:24px 24px 8px}.mapa-export-dialog-panel .mapa-export__header h2{margin:0;padding:0;font-family:inherit;font-size:20px;font-weight:600;line-height:1.3;color:#162f42}.mapa-export__header h2:before{display:none}.mapa-export__header p{margin:6px 0 0;color:#41566a;font-size:14px}.mapa-export__close{background:transparent;border:0;color:inherit;font-size:26px;min-width:36px;min-height:36px;cursor:pointer}.mapa-export__content{display:flex;flex-direction:column;gap:20px;padding:20px 24px;color:inherit}mapa-export-dialog fieldset{border:0;margin:0;padding:0;min-width:0}mapa-export-dialog legend{margin-bottom:10px;font-size:14px;font-weight:600;color:#162f42}mapa-export-dialog mat-radio-group{display:flex;flex-direction:column;gap:8px}.mapa-export__option{display:block;border:1px solid #dce5e8;border-radius:10px;padding:8px;min-width:0}.mapa-export__option--selected{border-color:#ff560b;background:#ffede6}.mapa-export__label,.mapa-export__description{display:block}.mapa-export__label{font-weight:600;color:#162f42}.mapa-export__description{color:#41566a;font-size:13px;line-height:20px}.mapa-export__formats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.mapa-export__filename{background:#eef3f4;border-radius:10px;padding:12px;margin:0;overflow-wrap:anywhere;font:12px/1.5 monospace}.mapa-export__actions{border-top:1px solid #dce5e8;padding:16px 24px 20px;justify-content:flex-end;gap:8px}.mapa-export__button{min-height:44px;border:1px solid #8299a8;border-radius:8px;padding:0 16px;color:#162f42;background:transparent;font:inherit;font-weight:600;cursor:pointer}.mapa-export__button--primary{background:#d94021;border-color:#d94021;color:#fff}.mapa-export__button:disabled{opacity:.5;cursor:default}mapa-export-dialog button:focus-visible{outline:2px solid #162f42;outline-offset:3px}@media(max-width:440px){.mapa-export__formats{grid-template-columns:1fr}}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i3.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatRadioModule }, { kind: "directive", type: i4.MatRadioGroup, selector: "mat-radio-group", inputs: ["color", "name", "labelPosition", "value", "selected", "disabled", "required", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioGroup"] }, { kind: "component", type: i4.MatRadioButton, selector: "mat-radio-button", inputs: ["id", "name", "aria-label", "aria-labelledby", "aria-describedby", "disableRipple", "tabIndex", "checked", "value", "labelPosition", "disabled", "required", "color", "disabledInteractive"], outputs: ["change"], exportAs: ["matRadioButton"] }], encapsulation: i0.ViewEncapsulation.None }); }
459
523
  }
460
524
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: MapaExportDialogComponent, decorators: [{
461
525
  type: Component,
462
- args: [{ selector: 'mapa-export-dialog', standalone: true, encapsulation: ViewEncapsulation.None, imports: [FormsModule, MatDialogModule, MatCheckboxModule, MatRadioModule], template: "<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 \u00D7\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 ? \" \u00B7 \" + request.context.filters.join(\" \u00B7 \")\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\u00FAdo 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\u00E7\u00E3o</span\n >\n </mat-radio-button>\n </mat-radio-group>\n </fieldset>\n @if (hasHiddenColumns) {\n <mat-checkbox [(ngModel)]=\"choices.visibleOnly\"\n >Incluir s\u00F3 as colunas vis\u00EDveis 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", styles: [".mapa-export-dialog-panel{--mat-dialog-container-shape: 16px}mapa-export-dialog{display:block;color:#162f42;font-family:inherit}.mapa-export-dialog-panel mapa-export-dialog .mat-mdc-radio-button{--mat-radio-selected-icon-color: #d94021;--mat-radio-selected-hover-icon-color: #d94021}.mapa-export-dialog-panel mapa-export-dialog .mat-mdc-checkbox{--mat-checkbox-selected-icon-color: #d94021;--mat-checkbox-selected-hover-icon-color: #d94021}.mapa-export__header{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:24px 24px 8px}.mapa-export-dialog-panel .mapa-export__header h2{margin:0;padding:0;font-family:inherit;font-size:20px;font-weight:600;line-height:1.3;color:#162f42}.mapa-export__header h2:before{display:none}.mapa-export__header p{margin:6px 0 0;color:#41566a;font-size:14px}.mapa-export__close{background:transparent;border:0;color:inherit;font-size:26px;min-width:36px;min-height:36px;cursor:pointer}.mapa-export__content{display:flex;flex-direction:column;gap:20px;padding:20px 24px;color:inherit}mapa-export-dialog fieldset{border:0;margin:0;padding:0;min-width:0}mapa-export-dialog legend{margin-bottom:10px;font-size:14px;font-weight:600;color:#162f42}mapa-export-dialog mat-radio-group{display:flex;flex-direction:column;gap:8px}.mapa-export__option{display:block;border:1px solid #dce5e8;border-radius:10px;padding:8px;min-width:0}.mapa-export__option--selected{border-color:#ff560b;background:#ffede6}.mapa-export__label,.mapa-export__description{display:block}.mapa-export__label{font-weight:600;color:#162f42}.mapa-export__description{color:#41566a;font-size:13px;line-height:20px}.mapa-export__formats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.mapa-export__filename{background:#eef3f4;border-radius:10px;padding:12px;margin:0;overflow-wrap:anywhere;font:12px/1.5 monospace}.mapa-export__actions{border-top:1px solid #dce5e8;padding:16px 24px 20px;justify-content:flex-end;gap:8px}.mapa-export__button{min-height:44px;border:1px solid #8299a8;border-radius:8px;padding:0 16px;color:#162f42;background:transparent;font:inherit;font-weight:600;cursor:pointer}.mapa-export__button--primary{background:#d94021;border-color:#d94021;color:#fff}.mapa-export__button:disabled{opacity:.5;cursor:default}mapa-export-dialog button:focus-visible{outline:2px solid #162f42;outline-offset:3px}@media(max-width:440px){.mapa-export__formats{grid-template-columns:1fr}}\n"] }]
526
+ args: [{ selector: 'mapa-export-dialog', standalone: true, encapsulation: ViewEncapsulation.None, imports: [FormsModule, MatDialogModule, MatCheckboxModule, MatRadioModule], template: "<header class=\"mapa-export__header\">\n <div>\n <h2 mat-dialog-title>{{ title }}</h2>\n <p>{{ texts.description }}</p>\n </div>\n <button\n class=\"mapa-export__close\"\n type=\"button\"\n [attr.aria-label]=\"texts.close\"\n (click)=\"dialog.close()\"\n >\n \u00D7\n </button>\n</header>\n<mat-dialog-content class=\"mapa-export__content\">\n <fieldset>\n <legend>{{ texts.scope }}</legend>\n <mat-radio-group\n [(ngModel)]=\"choices.scope\"\n [attr.aria-label]=\"texts.scope\"\n >\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\">{{ texts.allRecords }}</span>\n <span class=\"mapa-export__description\">{{ allDescription }}</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\">{{ texts.selectedOnly }}</span>\n <span class=\"mapa-export__description\">{{\n selectedDescription\n }}</span>\n </mat-radio-button>\n }\n </mat-radio-group>\n </fieldset>\n @if (request.datasets.length > 1) {\n <fieldset>\n <legend>{{ texts.content }}</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>{{ texts.format }}</legend>\n <mat-radio-group\n class=\"mapa-export__formats\"\n [(ngModel)]=\"choices.format\"\n [attr.aria-label]=\"texts.format\"\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\">{{ texts.excel }}</span\n ><span class=\"mapa-export__description\">{{\n texts.excelDescription\n }}</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\">{{ texts.csv }}</span\n ><span class=\"mapa-export__description\">{{\n texts.csvDescription\n }}</span>\n </mat-radio-button>\n </mat-radio-group>\n </fieldset>\n @if (hasHiddenColumns) {\n <mat-checkbox [(ngModel)]=\"choices.visibleOnly\">{{\n texts.visibleOnly\n }}</mat-checkbox>\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 {{ texts.cancel }}\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 {{ texts.generate }}\n </button>\n</mat-dialog-actions>\n", styles: [".mapa-export-dialog-panel{--mat-dialog-container-shape: 16px}mapa-export-dialog{display:block;color:#162f42;font-family:inherit}.mapa-export-dialog-panel mapa-export-dialog .mat-mdc-radio-button{--mat-radio-selected-icon-color: #d94021;--mat-radio-selected-hover-icon-color: #d94021}.mapa-export-dialog-panel mapa-export-dialog .mat-mdc-checkbox{--mat-checkbox-selected-icon-color: #d94021;--mat-checkbox-selected-hover-icon-color: #d94021}.mapa-export__header{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:24px 24px 8px}.mapa-export-dialog-panel .mapa-export__header h2{margin:0;padding:0;font-family:inherit;font-size:20px;font-weight:600;line-height:1.3;color:#162f42}.mapa-export__header h2:before{display:none}.mapa-export__header p{margin:6px 0 0;color:#41566a;font-size:14px}.mapa-export__close{background:transparent;border:0;color:inherit;font-size:26px;min-width:36px;min-height:36px;cursor:pointer}.mapa-export__content{display:flex;flex-direction:column;gap:20px;padding:20px 24px;color:inherit}mapa-export-dialog fieldset{border:0;margin:0;padding:0;min-width:0}mapa-export-dialog legend{margin-bottom:10px;font-size:14px;font-weight:600;color:#162f42}mapa-export-dialog mat-radio-group{display:flex;flex-direction:column;gap:8px}.mapa-export__option{display:block;border:1px solid #dce5e8;border-radius:10px;padding:8px;min-width:0}.mapa-export__option--selected{border-color:#ff560b;background:#ffede6}.mapa-export__label,.mapa-export__description{display:block}.mapa-export__label{font-weight:600;color:#162f42}.mapa-export__description{color:#41566a;font-size:13px;line-height:20px}.mapa-export__formats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.mapa-export__filename{background:#eef3f4;border-radius:10px;padding:12px;margin:0;overflow-wrap:anywhere;font:12px/1.5 monospace}.mapa-export__actions{border-top:1px solid #dce5e8;padding:16px 24px 20px;justify-content:flex-end;gap:8px}.mapa-export__button{min-height:44px;border:1px solid #8299a8;border-radius:8px;padding:0 16px;color:#162f42;background:transparent;font:inherit;font-weight:600;cursor:pointer}.mapa-export__button--primary{background:#d94021;border-color:#d94021;color:#fff}.mapa-export__button:disabled{opacity:.5;cursor:default}mapa-export-dialog button:focus-visible{outline:2px solid #162f42;outline-offset:3px}@media(max-width:440px){.mapa-export__formats{grid-template-columns:1fr}}\n"] }]
463
527
  }] });
464
528
 
465
529
  class MapaExportDialogService {
@@ -476,7 +540,6 @@ class MapaExportDialogService {
476
540
  maxHeight: 'calc(100dvh - 32px)',
477
541
  autoFocus: 'first-tabbable',
478
542
  restoreFocus: true,
479
- ariaLabel: `Exportar ${request.listing}`,
480
543
  panelClass: 'mapa-export-dialog-panel',
481
544
  });
482
545
  this.ref = ref;
@@ -497,6 +560,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImpo
497
560
  class MapaExportJobsComponent {
498
561
  constructor() {
499
562
  this.jobs = inject(MapaExportJobsService);
563
+ this.i18n = inject(MapaI18nService);
564
+ }
565
+ get texts() {
566
+ return this.i18n.texts.export;
567
+ }
568
+ format(template, values) {
569
+ return formatExportText(template, values);
570
+ }
571
+ ready(task) {
572
+ const count = task.recordCount ?? 0;
573
+ return this.format(this.texts.ready, {
574
+ records: `${count.toLocaleString(this.texts.locale)} ${count === 1 ? this.texts.record : this.texts.records}`,
575
+ files: this.format(task.files.length === 1 ? this.texts.file : this.texts.files, { count: task.files.length.toLocaleString(this.texts.locale) }),
576
+ });
500
577
  }
501
578
  percent(task) {
502
579
  const progress = task.progress;
@@ -506,23 +583,27 @@ class MapaExportJobsComponent {
506
583
  }
507
584
  phase(task) {
508
585
  const text = task.state === 'queued'
509
- ? 'Aguardando na fila…'
586
+ ? this.texts.queued
510
587
  : task.progress?.phase === 'fetching'
511
- ? 'Obtendo os registros…'
588
+ ? this.texts.fetching
512
589
  : task.progress?.phase === 'serializing'
513
- ? 'Compactando arquivo…'
514
- : 'Gerando planilha…';
590
+ ? this.texts.serializing
591
+ : this.texts.building;
515
592
  return (text +
516
593
  (task.progress?.parts && task.progress.parts > 1
517
- ? ` Parte ${task.progress.part} de ${task.progress.parts}`
594
+ ? ' ' +
595
+ this.format(this.texts.part, {
596
+ part: task.progress.part ?? 1,
597
+ parts: task.progress.parts,
598
+ })
518
599
  : ''));
519
600
  }
520
601
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: MapaExportJobsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
521
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.21", type: MapaExportJobsComponent, isStandalone: true, selector: "mapa-export-jobs", ngImport: i0, template: "@if (jobs.tasks().length) {\n <aside class=\"mapa-export-jobs\" aria-label=\"Exporta\u00E7\u00F5es\">\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\u00E7\u00E3o ' + task.title\"\n >\n \u00D7\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\u00EA 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\u00EDvel\"\n : \"arquivos dispon\u00EDveis\"\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\u00E7\u00E3o cancelada.</p>\n }\n </section>\n }\n </aside>\n}\n", styles: [":host{font-family:inherit}.mapa-export-jobs mat-progress-bar{--mat-progress-bar-active-indicator-color: #ff560b;--mat-progress-bar-track-color: #e4eef0}.mapa-export-jobs{position:fixed;z-index:900;right:24px;bottom:24px;width:420px;max-width:calc(100vw - 32px);max-height:55dvh;overflow-y:auto;display:flex;flex-direction:column;gap:12px}.mapa-export-jobs__task{background:#fff;color:#162f42;border:1px solid #dce5e8;border-radius:12px;padding:16px;box-shadow:0 8px 24px #162f4220}header{display:flex;justify-content:space-between;align-items:center;gap:12px}p{margin:12px 0}.mapa-export-jobs__hint{color:#41566a;font-size:13px}.mapa-export-jobs__file{display:flex;align-items:center;gap:12px;margin-top:10px}.mapa-export-jobs__file span{flex:1;min-width:0;overflow-wrap:anywhere;font-size:13px}button{min-height:36px;padding:4px 12px;border:1px solid #8299a8;border-radius:8px;background:transparent;color:inherit;font:inherit;font-weight:600;cursor:pointer}button:focus-visible{outline:2px solid #d94021;outline-offset:2px}@media(max-width:600px){.mapa-export-jobs{right:16px;bottom:16px}}\n"], dependencies: [{ kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i1$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
602
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.21", type: MapaExportJobsComponent, isStandalone: true, selector: "mapa-export-jobs", ngImport: i0, template: "@if (jobs.tasks().length) {\n <aside class=\"mapa-export-jobs\" [attr.aria-label]=\"texts.exports\">\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 {{ texts.cancel }}\n </button>\n } @else {\n <button\n type=\"button\"\n (click)=\"jobs.remove(task.id)\"\n [attr.aria-label]=\"format(texts.remove, { listing: task.title })\"\n >\n \u00D7\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 {{ texts.background }}\n </p>\n }\n } @else if (task.state === 'ready') {\n <p role=\"status\">\n {{ ready(task) }}\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]=\"\n format(texts.downloadFile, { file: file.name })\n \"\n >\n {{ texts.download }}\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 {{ texts.retry }}\n </button>\n } @else {\n <p role=\"status\">{{ texts.cancelled }}</p>\n }\n </section>\n }\n </aside>\n}\n", styles: [":host{font-family:inherit}.mapa-export-jobs mat-progress-bar{--mat-progress-bar-active-indicator-color: #ff560b;--mat-progress-bar-track-color: #e4eef0}.mapa-export-jobs{position:fixed;z-index:900;right:24px;bottom:24px;width:420px;max-width:calc(100vw - 32px);max-height:55dvh;overflow-y:auto;display:flex;flex-direction:column;gap:12px}.mapa-export-jobs__task{background:#fff;color:#162f42;border:1px solid #dce5e8;border-radius:12px;padding:16px;box-shadow:0 8px 24px #162f4220}header{display:flex;justify-content:space-between;align-items:center;gap:12px}p{margin:12px 0}.mapa-export-jobs__hint{color:#41566a;font-size:13px}.mapa-export-jobs__file{display:flex;align-items:center;gap:12px;margin-top:10px}.mapa-export-jobs__file span{flex:1;min-width:0;overflow-wrap:anywhere;font-size:13px}button{min-height:36px;padding:4px 12px;border:1px solid #8299a8;border-radius:8px;background:transparent;color:inherit;font:inherit;font-weight:600;cursor:pointer}button:focus-visible{outline:2px solid #d94021;outline-offset:2px}@media(max-width:600px){.mapa-export-jobs{right:16px;bottom:16px}}\n"], dependencies: [{ kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i1$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
522
603
  }
523
604
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: MapaExportJobsComponent, decorators: [{
524
605
  type: Component,
525
- args: [{ selector: 'mapa-export-jobs', standalone: true, imports: [MatProgressBarModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (jobs.tasks().length) {\n <aside class=\"mapa-export-jobs\" aria-label=\"Exporta\u00E7\u00F5es\">\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\u00E7\u00E3o ' + task.title\"\n >\n \u00D7\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\u00EA 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\u00EDvel\"\n : \"arquivos dispon\u00EDveis\"\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\u00E7\u00E3o cancelada.</p>\n }\n </section>\n }\n </aside>\n}\n", styles: [":host{font-family:inherit}.mapa-export-jobs mat-progress-bar{--mat-progress-bar-active-indicator-color: #ff560b;--mat-progress-bar-track-color: #e4eef0}.mapa-export-jobs{position:fixed;z-index:900;right:24px;bottom:24px;width:420px;max-width:calc(100vw - 32px);max-height:55dvh;overflow-y:auto;display:flex;flex-direction:column;gap:12px}.mapa-export-jobs__task{background:#fff;color:#162f42;border:1px solid #dce5e8;border-radius:12px;padding:16px;box-shadow:0 8px 24px #162f4220}header{display:flex;justify-content:space-between;align-items:center;gap:12px}p{margin:12px 0}.mapa-export-jobs__hint{color:#41566a;font-size:13px}.mapa-export-jobs__file{display:flex;align-items:center;gap:12px;margin-top:10px}.mapa-export-jobs__file span{flex:1;min-width:0;overflow-wrap:anywhere;font-size:13px}button{min-height:36px;padding:4px 12px;border:1px solid #8299a8;border-radius:8px;background:transparent;color:inherit;font:inherit;font-weight:600;cursor:pointer}button:focus-visible{outline:2px solid #d94021;outline-offset:2px}@media(max-width:600px){.mapa-export-jobs{right:16px;bottom:16px}}\n"] }]
606
+ args: [{ selector: 'mapa-export-jobs', standalone: true, imports: [MatProgressBarModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (jobs.tasks().length) {\n <aside class=\"mapa-export-jobs\" [attr.aria-label]=\"texts.exports\">\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 {{ texts.cancel }}\n </button>\n } @else {\n <button\n type=\"button\"\n (click)=\"jobs.remove(task.id)\"\n [attr.aria-label]=\"format(texts.remove, { listing: task.title })\"\n >\n \u00D7\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 {{ texts.background }}\n </p>\n }\n } @else if (task.state === 'ready') {\n <p role=\"status\">\n {{ ready(task) }}\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]=\"\n format(texts.downloadFile, { file: file.name })\n \"\n >\n {{ texts.download }}\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 {{ texts.retry }}\n </button>\n } @else {\n <p role=\"status\">{{ texts.cancelled }}</p>\n }\n </section>\n }\n </aside>\n}\n", styles: [":host{font-family:inherit}.mapa-export-jobs mat-progress-bar{--mat-progress-bar-active-indicator-color: #ff560b;--mat-progress-bar-track-color: #e4eef0}.mapa-export-jobs{position:fixed;z-index:900;right:24px;bottom:24px;width:420px;max-width:calc(100vw - 32px);max-height:55dvh;overflow-y:auto;display:flex;flex-direction:column;gap:12px}.mapa-export-jobs__task{background:#fff;color:#162f42;border:1px solid #dce5e8;border-radius:12px;padding:16px;box-shadow:0 8px 24px #162f4220}header{display:flex;justify-content:space-between;align-items:center;gap:12px}p{margin:12px 0}.mapa-export-jobs__hint{color:#41566a;font-size:13px}.mapa-export-jobs__file{display:flex;align-items:center;gap:12px;margin-top:10px}.mapa-export-jobs__file span{flex:1;min-width:0;overflow-wrap:anywhere;font-size:13px}button{min-height:36px;padding:4px 12px;border:1px solid #8299a8;border-radius:8px;background:transparent;color:inherit;font:inherit;font-weight:600;cursor:pointer}button:focus-visible{outline:2px solid #d94021;outline-offset:2px}@media(max-width:600px){.mapa-export-jobs{right:16px;bottom:16px}}\n"] }]
526
607
  }] });
527
608
 
528
609
  /** Lets a host keep export requests out of its blocking, global loading overlay. */