cilog-lib 1.13.19 → 1.13.21

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.
@@ -501,19 +501,14 @@ class ExportService {
501
501
  });
502
502
  const activeColumns = columns.filter(col => !col.invisible && (!byFiltre || col.exportable === true));
503
503
  // Génération des colonnes Excel
504
- let cols = [];
505
- activeColumns.forEach(col => {
506
- let colExcel = {
507
- header: col.libelle,
508
- key: col.id,
509
- style: this.getStyleByType(col.type)
510
- };
511
- if (col.width != null && col.width.toString().includes('px')) {
512
- const px = parseInt(col.width.toString().replace('px', '').trim(), 10);
513
- colExcel.width = parseFloat((px / 7).toFixed(2));
514
- }
515
- cols.push(colExcel);
516
- });
504
+ let cols = activeColumns.map(col => ({
505
+ header: col.libelle,
506
+ key: col.id,
507
+ style: this.getStyleByType(col.type),
508
+ width: col.width != null
509
+ ? Math.max(parseFloat((parseInt(col.width.toString().replace('px', ''), 10) / 7.5).toFixed(2)), 12)
510
+ : Math.max(col.libelle ? col.libelle.length + 5 : 12, 12)
511
+ }));
517
512
  ws.columns = cols;
518
513
  const activeRows = byFiltre ? values.filter(row => row.exportable === true) : values;
519
514
  // Traitement des lignes
@@ -643,9 +638,13 @@ class ExportService {
643
638
  case ColType.Switch:
644
639
  return cell.value === true ? 'Oui' : 'Non';
645
640
  case ColType.Date:
646
- // Correction du parsing de date plus propre
647
- const d = new Date(cell.value);
648
- return isNaN(d.getTime()) ? null : d;
641
+ if (!cell.value)
642
+ return null;
643
+ const d = cell.value instanceof Date ? cell.value : new Date(cell.value);
644
+ if (isNaN(d.getTime()))
645
+ return null;
646
+ const safeDate = new Date(d.getTime() + 12 * 60 * 60 * 1000);
647
+ return new Date(safeDate.getFullYear(), safeDate.getMonth() + 1, safeDate.getDate(), 12, 0, 0);
649
648
  default:
650
649
  return cell.value;
651
650
  }
@@ -1858,59 +1857,69 @@ class CilogGridComponent {
1858
1857
  rowsTotal.unshift({});
1859
1858
  indexTotalGeneral = 1;
1860
1859
  }
1861
- this.columns().forEach(col => {
1862
- let total = 0;
1863
- this.values().forEach(val => {
1864
- if (!val.exclusionTotal && !val[col.id].exclusionTotal) {
1865
- if (this.options().modeSelection != null) {
1866
- if (this.options().modeSelection == ModeSelection.Checkbox && this.options().totalBySelection == true) {
1867
- // if (this.selectedRows != null && this.selectedRows.find(row => row.id == val.id) != null) {
1868
- // total += (val[col.id].value != null ? val[col.id].value : 0);
1869
- // }
1860
+ this.columns().forEach((col, i) => {
1861
+ if (i == 0) {
1862
+ rowsTotal[indexTotalGeneral][col.id] = { value: 'TOTAL GÉNÉRAL' };
1863
+ if (this.options().filterable) {
1864
+ rowsTotal[0][col.id] = { value: 'TOTAL FILTRÉ' };
1865
+ }
1866
+ }
1867
+ else {
1868
+ let total = 0;
1869
+ this.values().forEach(val => {
1870
+ if (!val.exclusionTotal && !val[col.id].exclusionTotal) {
1871
+ if (this.options().modeSelection != null) {
1872
+ if (this.options().modeSelection == ModeSelection.Checkbox && this.options().totalBySelection == true) {
1873
+ // if (this.selectedRows != null && this.selectedRows.find(row => row.id == val.id) != null) {
1874
+ // total += (val[col.id].value != null ? val[col.id].value : 0);
1875
+ // }
1876
+ }
1877
+ else {
1878
+ total += (val[col.id].value != null ? val[col.id].value : 0);
1879
+ }
1870
1880
  }
1871
1881
  else {
1872
1882
  total += (val[col.id].value != null ? val[col.id].value : 0);
1873
1883
  }
1874
1884
  }
1875
- else {
1876
- total += (val[col.id].value != null ? val[col.id].value : 0);
1877
- }
1878
- }
1879
- });
1880
- rowsTotal[indexTotalGeneral][col.id] = { value: col.displayTotal ? total : null };
1881
- if (this.options().filterable) {
1882
- let totalFiltre = 0;
1883
- if (this.gridApi() != null) {
1884
- this.gridApi().forEachNodeAfterFilter(node => {
1885
- let val = node.data;
1886
- if (!val.exclusionTotal && !val[col.id].exclusionTotal) {
1887
- if (this.options().modeSelection != null) {
1888
- if (this.options().modeSelection == ModeSelection.Checkbox && this.options().totalBySelection == true) {
1889
- // if (this.selectedRows != null && this.selectedRows.find(row => row.id == val.id) != null) {
1890
- // totalFiltre += (val[col.id].value != null ? val[col.id].value : 0);
1891
- // }
1885
+ });
1886
+ rowsTotal[indexTotalGeneral][col.id] = { value: col.displayTotal ? total : null };
1887
+ if (this.options().filterable) {
1888
+ let totalFiltre = 0;
1889
+ if (this.gridApi() != null) {
1890
+ this.gridApi().forEachNodeAfterFilter(node => {
1891
+ let val = node.data;
1892
+ if (!val.exclusionTotal && !val[col.id].exclusionTotal) {
1893
+ if (this.options().modeSelection != null) {
1894
+ if (this.options().modeSelection == ModeSelection.Checkbox && this.options().totalBySelection == true) {
1895
+ // if (this.selectedRows != null && this.selectedRows.find(row => row.id == val.id) != null) {
1896
+ // totalFiltre += (val[col.id].value != null ? val[col.id].value : 0);
1897
+ // }
1898
+ }
1899
+ else {
1900
+ totalFiltre += (val[col.id].value != null ? val[col.id].value : 0);
1901
+ }
1892
1902
  }
1893
1903
  else {
1894
1904
  totalFiltre += (val[col.id].value != null ? val[col.id].value : 0);
1895
1905
  }
1896
1906
  }
1897
- else {
1898
- totalFiltre += (val[col.id].value != null ? val[col.id].value : 0);
1899
- }
1900
- }
1901
- });
1907
+ });
1908
+ }
1909
+ rowsTotal[0][col.id] = { value: col.displayTotal ? totalFiltre : null };
1902
1910
  }
1903
- rowsTotal[0][col.id] = { value: col.displayTotal ? totalFiltre : null };
1904
1911
  }
1905
1912
  });
1906
1913
  return rowsTotal;
1907
1914
  }, ...(ngDevMode ? [{ debugName: "totalRowData" }] : /* istanbul ignore next */ []));
1908
1915
  getRowStyle = (params) => {
1909
1916
  if (params.node.rowPinned === 'bottom') {
1917
+ const pinnedBottomCount = params.api.getPinnedBottomRowCount();
1918
+ const isFirstPinnedRow = params.node.rowIndex === 0;
1910
1919
  return {
1911
1920
  backgroundColor: '#f1f5f9',
1912
1921
  fontWeight: 'bold',
1913
- color: '#1e293b',
1922
+ color: pinnedBottomCount === 2 && isFirstPinnedRow ? '#7D745A' : '#1e293b',
1914
1923
  borderTop: '2px solid #cbd5e1',
1915
1924
  boxShadow: 'inset 0 1px 0 #cbd5e1'
1916
1925
  };