ngx-deebodata 0.4.6 → 0.4.8

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.
package/README.md CHANGED
@@ -6,6 +6,10 @@ Angular v22 data grid with virtual scroll, integrated charts, row grouping, colu
6
6
 
7
7
  - 100k rows - https://deebodata.com/angular-data-grid?data=sales
8
8
 
9
+ ## Changelog
10
+
11
+ - View the Changelog to see the latest updates - https://deebodata.com/changelog
12
+
9
13
 
10
14
  # Licensing
11
15
 
@@ -81,6 +85,12 @@ export class App {
81
85
  | `forceGrouping` | `string[]` | `[]` | array of column names to force grouping - gives dropdown filter & pie graphs for the column |
82
86
  -
83
87
 
88
+ **Component Output API**
89
+ | Output | Type | Description
90
+ |----------|----------|----------|
91
+ | `cellEdit` | `CellEdit` | An object that emits with all necessary cell edit details. See more details further down |
92
+ -
93
+
84
94
 
85
95
  It's best to pass hex or rgb colors to **color1, color2, pieGraphColors, & altRowColor,** but css colors work too
86
96
 
@@ -1,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { signal, Injectable, EventEmitter, ViewChild, Output, Input, ChangeDetectionStrategy, Component, input, HostListener, effect } from '@angular/core';
2
+ import { signal, Injectable, Service, EventEmitter, ViewChild, Output, Input, ChangeDetectionStrategy, Component, input, HostListener, effect } from '@angular/core';
3
3
  import * as i4$1 from '@angular/forms';
4
4
  import { FormsModule } from '@angular/forms';
5
5
  import * as i4 from '@angular/common';
6
6
  import { CommonModule, DecimalPipe } from '@angular/common';
7
7
  import { Subject, timer, Subscription, finalize } from 'rxjs';
8
- import * as i2 from '@angular/common/http';
8
+ import * as i3 from '@angular/common/http';
9
9
 
10
10
  class CommonService {
11
11
  uniSep = "X_";
@@ -356,11 +356,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
356
356
  }]
357
357
  }] });
358
358
 
359
+ class CustomSortService {
360
+ customSort = { asc: {}, desc: {} };
361
+ setCustomSort(sort) {
362
+ this.customSort = { ...sort };
363
+ }
364
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: CustomSortService, deps: [], target: i0.ɵɵFactoryTarget.Service });
365
+ static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.7", ngImport: i0, type: CustomSortService });
366
+ }
367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: CustomSortService, decorators: [{
368
+ type: Service
369
+ }] });
370
+
359
371
  class DataTableService {
360
372
  common;
373
+ customSortService;
361
374
  http;
362
- constructor(common, http) {
375
+ constructor(common, customSortService, http) {
363
376
  this.common = common;
377
+ this.customSortService = customSortService;
364
378
  this.http = http;
365
379
  }
366
380
  sortOrder = [];
@@ -676,18 +690,25 @@ class DataTableService {
676
690
  const len = sortOrder.length;
677
691
  for (var i = (len - 1); i >= 0; i--) {
678
692
  const field = sortOrder[i];
679
- const dir = obj[field]["sort"] === "asc" ? 1 : -1;
680
- sortData = sortData.sort((a, b) => {
681
- if (!a[field] && a[field] !== 0)
682
- return 1;
683
- if (!b[field] && b[field] !== 0)
684
- return -1;
685
- if (a[field] > b[field])
686
- return (1 * dir);
687
- if ((a[field] === b[field]) || (JSON.stringify(a[field]) === JSON.stringify(b[field])))
688
- return 0;
689
- return (-1 * dir);
690
- });
693
+ const sortDir = obj[field]["sort"];
694
+ const dir = sortDir === "asc" ? 1 : -1;
695
+ const custom = this.customSortService.customSort[sortDir][field];
696
+ if (custom && typeof custom === "function") {
697
+ sortData = sortData.sort(custom);
698
+ }
699
+ else {
700
+ sortData = sortData.sort((a, b) => {
701
+ if (!a[field] && a[field] !== 0)
702
+ return 1;
703
+ if (!b[field] && b[field] !== 0)
704
+ return -1;
705
+ if (a[field] > b[field])
706
+ return (1 * dir);
707
+ if ((a[field] === b[field]) || (JSON.stringify(a[field]) === JSON.stringify(b[field])))
708
+ return 0;
709
+ return (-1 * dir);
710
+ });
711
+ }
691
712
  }
692
713
  return sortData;
693
714
  }
@@ -960,7 +981,7 @@ class DataTableService {
960
981
  }
961
982
  return true;
962
983
  }
963
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: DataTableService, deps: [{ token: CommonService }, { token: i2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
984
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: DataTableService, deps: [{ token: CommonService }, { token: CustomSortService }, { token: i3.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
964
985
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: DataTableService, providedIn: 'root' });
965
986
  }
966
987
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: DataTableService, decorators: [{
@@ -968,7 +989,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
968
989
  args: [{
969
990
  providedIn: 'root'
970
991
  }]
971
- }], ctorParameters: () => [{ type: CommonService }, { type: i2.HttpClient }] });
992
+ }], ctorParameters: () => [{ type: CommonService }, { type: CustomSortService }, { type: i3.HttpClient }] });
972
993
 
973
994
  class TableDragService {
974
995
  dataTableService;
@@ -7449,5 +7470,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImpor
7449
7470
  * Generated bundle index. Do not edit.
7450
7471
  */
7451
7472
 
7452
- export { NgxDeebodata };
7473
+ export { CustomSortService, NgxDeebodata };
7453
7474
  //# sourceMappingURL=ngx-deebodata.mjs.map