ngx-deebodata 0.4.7 → 0.4.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.
- package/README.md +8 -1
- package/fesm2022/ngx-deebodata.mjs +39 -18
- package/fesm2022/ngx-deebodata.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngx-deebodata.d.ts +16 -3
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
|
|
|
@@ -87,7 +91,6 @@ export class App {
|
|
|
87
91
|
| `cellEdit` | `CellEdit` | An object that emits with all necessary cell edit details. See more details further down |
|
|
88
92
|
-
|
|
89
93
|
|
|
90
|
-
|
|
91
94
|
It's best to pass hex or rgb colors to **color1, color2, pieGraphColors, & altRowColor,** but css colors work too
|
|
92
95
|
|
|
93
96
|
Always pass a **px** string value to defRowHgt like '50px'
|
|
@@ -153,6 +156,10 @@ handleCellEdit(event: CellEdit) {//executes on cell edit if editable isn't false
|
|
|
153
156
|
></ngx-deebodata>
|
|
154
157
|
```
|
|
155
158
|
|
|
159
|
+
**Custom Sort Logic for a column**
|
|
160
|
+
|
|
161
|
+
Visit https://deebodata.com/angular-docs#customSort to learn how to set custom sort logic for a column for ascending and descending order
|
|
162
|
+
|
|
156
163
|
**To pass Column Value Colors for Charts**
|
|
157
164
|
|
|
158
165
|
For a given column with limited distinct values (qualifies for grouping), give each value it's own color in the charts (pie, bar, line)
|
|
@@ -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
|
|
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
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
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:
|
|
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:
|
|
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
|