@sdcorejs/angular 21.1.5 → 21.1.6

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.
@@ -2553,11 +2553,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
2553
2553
 
2554
2554
  class TableExportService {
2555
2555
  #excelService = inject(SdExcelService);
2556
+ #i18n = inject(I18nService);
2556
2557
  // ==========================================
2557
2558
  // SIGNAL STATE (Component sẽ bind trực tiếp vào đây)
2558
2559
  // ==========================================
2559
2560
  exporting = signal(false, ...(ngDevMode ? [{ debugName: "exporting" }] : /* istanbul ignore next */ []));
2560
- exportTitle = signal('Export', ...(ngDevMode ? [{ debugName: "exportTitle" }] : /* istanbul ignore next */ []));
2561
+ // Phần trăm tiến độ export; null = đang rảnh (nút hiện nhãn mặc định).
2562
+ #exportPercent = signal(null, ...(ngDevMode ? [{ debugName: "#exportPercent" }] : /* istanbul ignore next */ []));
2563
+ // WHY computed + i18n: trước đây đây là signal('Export') hard-code tiếng Anh nên
2564
+ // app chạy tiếng Việt vẫn hiện "Export". Đọc qua I18nService.t() để nhãn nút bám
2565
+ // theo catalog ngôn ngữ hiện tại.
2566
+ exportTitle = computed(() => {
2567
+ const percent = this.#exportPercent();
2568
+ return percent === null
2569
+ ? this.#i18n.t('core.component.table.export')
2570
+ : this.#i18n.t('core.component.table.exporting', { percent });
2571
+ }, ...(ngDevMode ? [{ debugName: "exportTitle" }] : /* istanbul ignore next */ []));
2572
+ /** Đặt tiến độ export (0-100), hoặc null để trả nút về nhãn mặc định. */
2573
+ setExportProgress = (percent) => {
2574
+ this.#exportPercent.set(percent === null ? null : Math.min(Math.max(percent, 0), 100));
2575
+ };
2561
2576
  // ==========================================
2562
2577
  // PUBLIC METHODS
2563
2578
  // ==========================================
@@ -2622,7 +2637,7 @@ class TableExportService {
2622
2637
  const totalPage = Math.max(1, currentTotal / pageSize);
2623
2638
  const percent = Math.round(((pageNumber - 1) * 100.0) / totalPage);
2624
2639
  // Đảm bảo percent không vượt quá 100
2625
- this.exportTitle.set(`Exporting...${Math.min(percent, 100)}%`);
2640
+ this.setExportProgress(percent);
2626
2641
  const allColumns = this.#allColumns(option);
2627
2642
  const allExportedColumns = this.#allExportedColumns(option);
2628
2643
  for (const item of exportItems) {
@@ -2732,7 +2747,7 @@ class TableExportService {
2732
2747
  }
2733
2748
  finally {
2734
2749
  this.exporting.set(false);
2735
- this.exportTitle.set('Export');
2750
+ this.setExportProgress(null);
2736
2751
  }
2737
2752
  }
2738
2753
  #getExportColumns(context, explicitColumns) {