@colijnit/corecomponents_v12 261.20.7 → 261.20.9

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.
@@ -7823,6 +7823,9 @@ class InputTextComponent extends BaseInputComponent {
7823
7823
  event.preventDefault();
7824
7824
  }
7825
7825
  }
7826
+ if (this.type === 'number' && this.model?.length === this.maxLength && /^\d$/.test(key)) {
7827
+ event.preventDefault();
7828
+ }
7826
7829
  }
7827
7830
  convertWeekToDate(weekStr) {
7828
7831
  const match = weekStr.match(/^w0*(\d{1,2})$/i);
@@ -11642,6 +11645,7 @@ class BaseSimpleGridComponent {
11642
11645
  showEdit = false;
11643
11646
  showToolbar = false;
11644
11647
  autoAddRow = false;
11648
+ useCustomExcelExport = false;
11645
11649
  /**
11646
11650
  * Should component emit drag and drop actions instead of handle
11647
11651
  * (update collection) by itself
@@ -11659,6 +11663,7 @@ class BaseSimpleGridComponent {
11659
11663
  addRow = new EventEmitter();
11660
11664
  rowVisible = new EventEmitter();
11661
11665
  paginationPageChange = new EventEmitter();
11666
+ customExcelExport = new EventEmitter();
11662
11667
  handleMouseMove(event) {
11663
11668
  if (this.resizable && event.buttons === 1 && this._columnForResize) {
11664
11669
  // this._columnForResize.width = this._columnForResize.originalWidth - (this._startMousePositionX - event.clientX);
@@ -11772,7 +11777,7 @@ class BaseSimpleGridComponent {
11772
11777
  });
11773
11778
  }
11774
11779
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BaseSimpleGridComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
11775
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: BaseSimpleGridComponent, isStandalone: true, inputs: { data: "data", exportData: "exportData", dragDropEnabled: "dragDropEnabled", resizable: "resizable", inlineEdit: "inlineEdit", showEdit: "showEdit", showToolbar: "showToolbar", autoAddRow: "autoAddRow", emitDragDrop: "emitDragDrop", extraColumns: "extraColumns" }, outputs: { onDrop: "onDrop", selectRow: "selectRow", deselectRow: "deselectRow", dblClickRow: "dblClickRow", saveRow: "saveRow", deleteRow: "deleteRow", addRow: "addRow", rowVisible: "rowVisible", paginationPageChange: "paginationPageChange" }, host: { listeners: { "document:mousemove": "handleMouseMove($event)", "document:mouseup": "handleMouseUp($event)" } }, queries: [{ propertyName: "content", predicate: SimpleGridColumnDirective }], ngImport: i0 });
11780
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.16", type: BaseSimpleGridComponent, isStandalone: true, inputs: { data: "data", exportData: "exportData", dragDropEnabled: "dragDropEnabled", resizable: "resizable", inlineEdit: "inlineEdit", showEdit: "showEdit", showToolbar: "showToolbar", autoAddRow: "autoAddRow", useCustomExcelExport: "useCustomExcelExport", emitDragDrop: "emitDragDrop", extraColumns: "extraColumns" }, outputs: { onDrop: "onDrop", selectRow: "selectRow", deselectRow: "deselectRow", dblClickRow: "dblClickRow", saveRow: "saveRow", deleteRow: "deleteRow", addRow: "addRow", rowVisible: "rowVisible", paginationPageChange: "paginationPageChange", customExcelExport: "customExcelExport" }, host: { listeners: { "document:mousemove": "handleMouseMove($event)", "document:mouseup": "handleMouseUp($event)" } }, queries: [{ propertyName: "content", predicate: SimpleGridColumnDirective }], ngImport: i0 });
11776
11781
  }
11777
11782
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: BaseSimpleGridComponent, decorators: [{
11778
11783
  type: Directive
@@ -11795,6 +11800,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11795
11800
  type: Input
11796
11801
  }], autoAddRow: [{
11797
11802
  type: Input
11803
+ }], useCustomExcelExport: [{
11804
+ type: Input
11798
11805
  }], emitDragDrop: [{
11799
11806
  type: Input
11800
11807
  }], extraColumns: [{
@@ -11817,6 +11824,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
11817
11824
  type: Output
11818
11825
  }], paginationPageChange: [{
11819
11826
  type: Output
11827
+ }], customExcelExport: [{
11828
+ type: Output
11820
11829
  }], handleMouseMove: [{
11821
11830
  type: HostListener,
11822
11831
  args: ['document:mousemove', ['$event']]
@@ -12738,55 +12747,61 @@ class SimpleGridComponent extends BaseSimpleGridComponent {
12738
12747
  header: column.headerText
12739
12748
  });
12740
12749
  });
12741
- const headers = columns.map(col => col.header);
12742
- const rows = exportData.map(row => columns.map(col => {
12743
- const value = row[col.key];
12744
- if (value instanceof Date) {
12745
- const formattedDate = value.toISOString().split('T')[0];
12746
- const [year, month, day] = formattedDate.split('-');
12747
- return `${day}-${month}-${year}`;
12748
- }
12749
- else if (typeof value === 'number') {
12750
- const hasDecimal = (num) => !Number.isInteger(num);
12751
- return hasDecimal(value) ? value.toFixed(2) : value.toFixed(0);
12752
- }
12753
- else if (Array.isArray(value)) {
12754
- return value.join(', ');
12755
- }
12756
- else if (typeof value === 'object' && value !== null) {
12757
- return JSON.stringify(value);
12758
- }
12759
- else if (typeof value === 'boolean') {
12760
- return String(value);
12761
- }
12762
- else {
12763
- if (!value)
12764
- return '';
12765
- if (typeof value === 'string' && value.includes('T00:00:00')) {
12766
- const [year, month, day] = value.replace('T00:00:00', '').split('-');
12750
+ if (this.useCustomExcelExport) {
12751
+ this.customExcelExport.emit({ exportData: exportData, columns: columns });
12752
+ return;
12753
+ }
12754
+ else {
12755
+ const headers = columns.map(col => col.header);
12756
+ const rows = exportData.map(row => columns.map(col => {
12757
+ const value = row[col.key];
12758
+ if (value instanceof Date) {
12759
+ const formattedDate = value.toISOString().split('T')[0];
12760
+ const [year, month, day] = formattedDate.split('-');
12767
12761
  return `${day}-${month}-${year}`;
12768
12762
  }
12769
- return String(value);
12770
- }
12771
- }));
12772
- // const csvContent = [headers, ...rows].map(row =>
12773
- // row.map(cell => `"${cell.replace(/"/g, '""')}"`).join(',')
12774
- // ).join('\r\n');
12775
- const csvContent = [headers, ...rows].map(row => row.map((cell) => `"${String(cell).replace(/"/g, '""')}"`).join(',')).join('\r\n');
12776
- const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
12777
- const link = document.createElement('a');
12778
- const url = URL.createObjectURL(blob);
12779
- link.href = url;
12780
- link.setAttribute('download', 'ExcelSheet');
12781
- document.body.appendChild(link);
12782
- link.click();
12783
- document.body.removeChild(link);
12784
- // this.excelExportService.exportToExcel(
12785
- // this.data,
12786
- // columns,
12787
- // 'ExcelSheet',
12788
- // 'Sheet1'
12789
- // );
12763
+ else if (typeof value === 'number') {
12764
+ const hasDecimal = (num) => !Number.isInteger(num);
12765
+ return hasDecimal(value) ? value.toFixed(2) : value.toFixed(0);
12766
+ }
12767
+ else if (Array.isArray(value)) {
12768
+ return value.join(', ');
12769
+ }
12770
+ else if (typeof value === 'object' && value !== null) {
12771
+ return JSON.stringify(value);
12772
+ }
12773
+ else if (typeof value === 'boolean') {
12774
+ return String(value);
12775
+ }
12776
+ else {
12777
+ if (!value)
12778
+ return '';
12779
+ if (typeof value === 'string' && value.includes('T00:00:00')) {
12780
+ const [year, month, day] = value.replace('T00:00:00', '').split('-');
12781
+ return `${day}-${month}-${year}`;
12782
+ }
12783
+ return String(value);
12784
+ }
12785
+ }));
12786
+ // const csvContent = [headers, ...rows].map(row =>
12787
+ // row.map(cell => `"${cell.replace(/"/g, '""')}"`).join(',')
12788
+ // ).join('\r\n');
12789
+ const csvContent = [headers, ...rows].map(row => row.map((cell) => `"${String(cell).replace(/"/g, '""')}"`).join(',')).join('\r\n');
12790
+ const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
12791
+ const link = document.createElement('a');
12792
+ const url = URL.createObjectURL(blob);
12793
+ link.href = url;
12794
+ link.setAttribute('download', 'ExcelSheet');
12795
+ document.body.appendChild(link);
12796
+ link.click();
12797
+ document.body.removeChild(link);
12798
+ // this.excelExportService.exportToExcel(
12799
+ // this.data,
12800
+ // columns,
12801
+ // 'ExcelSheet',
12802
+ // 'Sheet1'
12803
+ // );
12804
+ }
12790
12805
  }
12791
12806
  goToPreviousPage() {
12792
12807
  this.currentPage -= 1;