@eherve/angular-material-datatable 19.23.5 → 19.25.0
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 +29 -41
- package/fesm2022/{eherve-angular-material-datatable-cell-checkbox-value.component-PHY0X0wz.mjs → eherve-angular-material-datatable-cell-checkbox-value.component-E5dQ-SJb.mjs} +2 -2
- package/fesm2022/{eherve-angular-material-datatable-cell-checkbox-value.component-PHY0X0wz.mjs.map → eherve-angular-material-datatable-cell-checkbox-value.component-E5dQ-SJb.mjs.map} +1 -1
- package/fesm2022/{eherve-angular-material-datatable-cell-date-value.component-DYO_rIFt.mjs → eherve-angular-material-datatable-cell-date-value.component-CXh9rWrt.mjs} +32 -12
- package/fesm2022/eherve-angular-material-datatable-cell-date-value.component-CXh9rWrt.mjs.map +1 -0
- package/fesm2022/{eherve-angular-material-datatable-cell-duration-value.component-BbHM4MxI.mjs → eherve-angular-material-datatable-cell-duration-value.component-Br8ga1qE.mjs} +2 -2
- package/fesm2022/{eherve-angular-material-datatable-cell-duration-value.component-BbHM4MxI.mjs.map → eherve-angular-material-datatable-cell-duration-value.component-Br8ga1qE.mjs.map} +1 -1
- package/fesm2022/{eherve-angular-material-datatable-cell-number-value.component-Ip_V5vNB.mjs → eherve-angular-material-datatable-cell-number-value.component-BGmWTDbF.mjs} +2 -2
- package/fesm2022/{eherve-angular-material-datatable-cell-number-value.component-Ip_V5vNB.mjs.map → eherve-angular-material-datatable-cell-number-value.component-BGmWTDbF.mjs.map} +1 -1
- package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-_CDm5Nid.mjs +45 -0
- package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-_CDm5Nid.mjs.map +1 -0
- package/fesm2022/{eherve-angular-material-datatable-eherve-angular-material-datatable-B9NS2F1a.mjs → eherve-angular-material-datatable-eherve-angular-material-datatable-oKhIjmQe.mjs} +486 -296
- package/fesm2022/eherve-angular-material-datatable-eherve-angular-material-datatable-oKhIjmQe.mjs.map +1 -0
- package/fesm2022/{eherve-angular-material-datatable-get.pipe-CFZSdKSW.mjs → eherve-angular-material-datatable-get.pipe-OPM3WlAY.mjs} +2 -2
- package/fesm2022/{eherve-angular-material-datatable-get.pipe-CFZSdKSW.mjs.map → eherve-angular-material-datatable-get.pipe-OPM3WlAY.mjs.map} +1 -1
- package/fesm2022/eherve-angular-material-datatable.mjs +1 -1
- package/lib/components/cell-date-value/cell-date-value.component.d.ts +2 -1
- package/lib/components/cell-select-value/cell-select-value.component.d.ts +2 -3
- package/lib/components/header-autocomplete-filter/header-autocomplete-filter.component.d.ts +2 -0
- package/lib/components/header-date-filter/header-date-filter.component.d.ts +2 -0
- package/lib/components/header-duration-filter/header-duration-filter.component.d.ts +2 -0
- package/lib/components/header-number-filter/header-number-filter.component.d.ts +2 -0
- package/lib/components/header-select-filter/header-select-filter.component.d.ts +3 -0
- package/lib/components/header-text-filter/header-text-filter.component.d.ts +2 -0
- package/lib/datasource.d.ts +4 -1
- package/lib/datatable.component.d.ts +3 -13
- package/lib/datatable.intl.d.ts +11 -0
- package/lib/date-refresh.service.d.ts +8 -0
- package/lib/select-options-cache.service.d.ts +9 -0
- package/lib/tools/datasource-request.tool.d.ts +9 -0
- package/lib/tools/datatable-export.tool.d.ts +21 -0
- package/lib/tools/strip-html.tool.d.ts +1 -1
- package/lib/types/action.type.d.ts +1 -0
- package/lib/types/datasource-service.type.d.ts +5 -2
- package/package.json +7 -3
- package/public-api.d.ts +2 -1
- package/fesm2022/eherve-angular-material-datatable-cell-date-value.component-DYO_rIFt.mjs.map +0 -1
- package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-C5TwovoH.mjs +0 -44
- package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-C5TwovoH.mjs.map +0 -1
- package/fesm2022/eherve-angular-material-datatable-eherve-angular-material-datatable-B9NS2F1a.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,63 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @eherve/angular-material-datatable
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Angular Material datatable library with server-side filtering, sorting, pagination, facets, configurable columns and XLSX export.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Workspace
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The library lives in `projects/datatable` inside the `angular-material-extended` workspace. Build and test it from the workspace root.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
npm run test:datatable
|
|
11
|
+
npm run build:datatable
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
Publishing is intentionally separate and should only be run when a new package version is ready:
|
|
14
15
|
|
|
15
16
|
```bash
|
|
16
|
-
|
|
17
|
+
npm run publish:datatable
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
##
|
|
20
|
+
## Datasource contract
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
A datatable receives a `NgxMatDatasourceService<Record>` and sends `NgxMatDatasourceRequestOptions` containing the visible/requested columns, ordering, pagination, search and optional facets.
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
ng build datatable
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
24
|
+
The main request fields are:
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
- `draw`: request identifier echoed by the datasource response;
|
|
27
|
+
- `columns`: requested properties and optional projection/search metadata;
|
|
28
|
+
- `order`: indexes into `columns` with `asc` / `desc` direction;
|
|
29
|
+
- `start`: page index, not a row offset;
|
|
30
|
+
- `length`: page size;
|
|
31
|
+
- `search`: optional global search;
|
|
32
|
+
- `facets`: optional indicator aggregations.
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
The companion `mongoose-datatable` backend converts pagination to a MongoDB offset using `start * length`.
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
cd dist/datatable
|
|
36
|
-
```
|
|
36
|
+
A datasource response contains `draw`, `recordsFiltered`, `data`, optional `facets`, and may also provide unfiltered total information when supported by the datasource.
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm publish
|
|
41
|
-
```
|
|
38
|
+
## Projection expressions
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
`projection` accepts datasource-specific projection values. With `mongoose-datatable`, MongoDB aggregation expressions are supported, for example:
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
```ts
|
|
43
|
+
{
|
|
44
|
+
data: 'itemCount',
|
|
45
|
+
projection: { $size: { $ifNull: ['$items', []] } },
|
|
46
|
+
}
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
##
|
|
52
|
-
|
|
53
|
-
For end-to-end (e2e) testing, run:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
ng e2e
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
-
|
|
61
|
-
## Additional Resources
|
|
49
|
+
## Runtime dependencies
|
|
62
50
|
|
|
63
|
-
|
|
51
|
+
Angular framework packages and the external libraries used directly by this package are declared as peer dependencies so the consuming Angular application keeps a single compatible runtime instance.
|
|
@@ -3,7 +3,7 @@ import * as i0 from '@angular/core';
|
|
|
3
3
|
import { Component, Input } from '@angular/core';
|
|
4
4
|
import * as i5 from '@angular/material/icon';
|
|
5
5
|
import { MatIconModule } from '@angular/material/icon';
|
|
6
|
-
import { GetPipe } from './eherve-angular-material-datatable-get.pipe-
|
|
6
|
+
import { GetPipe } from './eherve-angular-material-datatable-get.pipe-OPM3WlAY.mjs';
|
|
7
7
|
import { TransformPipe } from './eherve-angular-material-datatable-transform.pipe-BOmcXXZU.mjs';
|
|
8
8
|
|
|
9
9
|
/** @format */
|
|
@@ -23,4 +23,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
23
23
|
}] } });
|
|
24
24
|
|
|
25
25
|
export { CellCheckboxValueComponent };
|
|
26
|
-
//# sourceMappingURL=eherve-angular-material-datatable-cell-checkbox-value.component-
|
|
26
|
+
//# sourceMappingURL=eherve-angular-material-datatable-cell-checkbox-value.component-E5dQ-SJb.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eherve-angular-material-datatable-cell-checkbox-value.component-
|
|
1
|
+
{"version":3,"file":"eherve-angular-material-datatable-cell-checkbox-value.component-E5dQ-SJb.mjs","sources":["../../../projects/datatable/src/lib/components/cell-checkbox-value/cell-checkbox-value.component.ts","../../../projects/datatable/src/lib/components/cell-checkbox-value/cell-checkbox-value.component.html"],"sourcesContent":["/** @format */\n\nimport { CommonModule } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { GetPipe } from '../../pipes/get.pipe';\nimport { TransformPipe } from '../../pipes/transform.pipe';\nimport { DatatableCheckboxColumn } from '../../types/datatable-column.type';\n\n@Component({\n selector: 'lib-cell-checkbox-value',\n imports: [CommonModule, GetPipe, MatIconModule, TransformPipe],\n templateUrl: './cell-checkbox-value.component.html',\n styleUrl: './cell-checkbox-value.component.scss',\n})\nexport class CellCheckboxValueComponent<Record> {\n @Input()\n column!: DatatableCheckboxColumn<Record>;\n\n @Input()\n row: any;\n}\n","<!-- @format -->\n\n@let value = row | get: column.property | transform: row : column;\n@if (value === false) {\n <mat-icon>check_box_outline_blank</mat-icon>\n} @else if (value === true) {\n <mat-icon>check_box</mat-icon>\n}\n"],"names":["i1"],"mappings":";;;;;;;;AAAA;MAea,0BAA0B,CAAA;AAErC,IAAA,MAAM;AAGN,IAAA,GAAG;uGALQ,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAA1B,0BAA0B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,yBAAA,EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,GAAA,EAAA,KAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECfvC,uOAQA,EDGY,MAAA,EAAA,CAAA,mEAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,YAAY,0BAAE,OAAO,EAAA,IAAA,EAAA,KAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAE,aAAa,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,SAAA,EAAA,SAAA,EAAA,UAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAE,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,CAAA;;2FAIlD,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBANtC,SAAS;+BACE,yBAAyB,EAAA,OAAA,EAC1B,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,CAAC,EAAA,QAAA,EAAA,uOAAA,EAAA,MAAA,EAAA,CAAA,mEAAA,CAAA,EAAA;8BAM9D,MAAM,EAAA,CAAA;sBADL;gBAID,GAAG,EAAA,CAAA;sBADF;;;;;"}
|
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
import { CommonModule } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { Pipe, inject, ChangeDetectorRef, Component, Input } from '@angular/core';
|
|
3
|
+
import { Injectable, Pipe, inject, ChangeDetectorRef, Component, Input } from '@angular/core';
|
|
4
4
|
import { MatIconModule } from '@angular/material/icon';
|
|
5
|
+
import { interval, share } from 'rxjs';
|
|
5
6
|
import moment from 'moment';
|
|
6
|
-
import { g as get, d as duration } from './eherve-angular-material-datatable-eherve-angular-material-datatable-
|
|
7
|
+
import { g as get, d as duration } from './eherve-angular-material-datatable-eherve-angular-material-datatable-oKhIjmQe.mjs';
|
|
8
|
+
|
|
9
|
+
/** @format */
|
|
10
|
+
class DateRefreshService {
|
|
11
|
+
intervals = new Map();
|
|
12
|
+
forInterval(refreshTime) {
|
|
13
|
+
let ticks = this.intervals.get(refreshTime);
|
|
14
|
+
if (!ticks) {
|
|
15
|
+
ticks = interval(refreshTime).pipe(share());
|
|
16
|
+
this.intervals.set(refreshTime, ticks);
|
|
17
|
+
}
|
|
18
|
+
return ticks;
|
|
19
|
+
}
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DateRefreshService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
21
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DateRefreshService, providedIn: 'root' });
|
|
22
|
+
}
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: DateRefreshService, decorators: [{
|
|
24
|
+
type: Injectable,
|
|
25
|
+
args: [{ providedIn: 'root' }]
|
|
26
|
+
}] });
|
|
7
27
|
|
|
8
28
|
/** @format */
|
|
9
29
|
class MomentFormatPipe {
|
|
@@ -41,6 +61,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
41
61
|
/** @format */
|
|
42
62
|
class CellDateValueComponent {
|
|
43
63
|
changeDetectorRef = inject(ChangeDetectorRef);
|
|
64
|
+
dateRefreshService = inject(DateRefreshService);
|
|
44
65
|
column;
|
|
45
66
|
set setRow(row) {
|
|
46
67
|
this.row = row;
|
|
@@ -53,18 +74,17 @@ class CellDateValueComponent {
|
|
|
53
74
|
row;
|
|
54
75
|
value;
|
|
55
76
|
duration;
|
|
56
|
-
|
|
77
|
+
refreshSubscription;
|
|
57
78
|
ngOnInit() {
|
|
58
|
-
if (this.column.durationRefreshTime)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
79
|
+
if (!this.column.withDuration || !this.column.durationRefreshTime)
|
|
80
|
+
return;
|
|
81
|
+
this.refreshSubscription = this.dateRefreshService.forInterval(this.column.durationRefreshTime).subscribe(() => {
|
|
82
|
+
this.duration = duration(this.value, this.column);
|
|
83
|
+
this.changeDetectorRef.detectChanges();
|
|
84
|
+
});
|
|
64
85
|
}
|
|
65
86
|
ngOnDestroy() {
|
|
66
|
-
|
|
67
|
-
clearInterval(this.refreshInterval);
|
|
87
|
+
this.refreshSubscription?.unsubscribe();
|
|
68
88
|
}
|
|
69
89
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellDateValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
70
90
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: CellDateValueComponent, isStandalone: true, selector: "lib-cell-date-value", inputs: { column: "column", setRow: ["row", "setRow"] }, ngImport: i0, template: "<!-- @format -->\n\n@if (value) {\n <span class=\"date\"> {{ value | momentFormat: column }} </span>\n @if (column.withDuration) {\n <span class=\"duration\"> ({{ duration }}) </span>\n }\n}\n", styles: [".date,.duration{white-space:nowrap}.duration{margin-left:4px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "pipe", type: MomentFormatPipe, name: "momentFormat" }] });
|
|
@@ -80,4 +100,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
80
100
|
}] } });
|
|
81
101
|
|
|
82
102
|
export { CellDateValueComponent };
|
|
83
|
-
//# sourceMappingURL=eherve-angular-material-datatable-cell-date-value.component-
|
|
103
|
+
//# sourceMappingURL=eherve-angular-material-datatable-cell-date-value.component-CXh9rWrt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eherve-angular-material-datatable-cell-date-value.component-CXh9rWrt.mjs","sources":["../../../projects/datatable/src/lib/date-refresh.service.ts","../../../projects/datatable/src/lib/pipes/moment-format.pipe.ts","../../../projects/datatable/src/lib/components/cell-date-value/cell-date-value.component.ts","../../../projects/datatable/src/lib/components/cell-date-value/cell-date-value.component.html"],"sourcesContent":["/** @format */\n\nimport { Injectable } from '@angular/core';\nimport { interval, Observable, share } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class DateRefreshService {\n private readonly intervals = new Map<number, Observable<number>>();\n\n forInterval(refreshTime: number): Observable<number> {\n let ticks = this.intervals.get(refreshTime);\n if (!ticks) {\n ticks = interval(refreshTime).pipe(share());\n this.intervals.set(refreshTime, ticks);\n }\n return ticks;\n }\n}\n","/** @format */\n\nimport { Pipe, PipeTransform } from '@angular/core';\nimport moment, { Moment } from 'moment';\n\n@Pipe({ name: 'momentFormat' })\nexport class MomentFormatPipe implements PipeTransform {\n transform(data: any, options: { format?: string; locale?: string }): string {\n const date = this.getMoment(data);\n if (!date) return '';\n const format = options?.format || 'LLL';\n return options?.locale ? date.locale(options.locale).format(format) : date.format(format);\n }\n\n private getMoment(data: any): Moment | null {\n if (typeof data === 'string') return moment(data);\n if (typeof data === 'number') return moment(data);\n if (data instanceof Date) return moment(data);\n if (moment.isMoment(data)) return data.clone();\n if (typeof data?.valueOf === 'function') {\n const value = data.valueOf();\n if (typeof value === 'number') return moment(data);\n }\n return null;\n }\n}\n","/** @format */\n\nimport { CommonModule } from '@angular/common';\nimport { ChangeDetectorRef, Component, inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { Subscription } from 'rxjs';\nimport { DateRefreshService } from '../../date-refresh.service';\nimport { MomentFormatPipe } from '../../pipes/moment-format.pipe';\nimport { duration } from '../../tools/duration.tool';\nimport { get } from '../../tools/get.tool';\nimport { DatatableDateColumn, DatatableValueColumn } from '../../types/datatable-column.type';\n\n@Component({\n selector: 'lib-cell-date-value',\n imports: [CommonModule, MatIconModule, MomentFormatPipe],\n templateUrl: './cell-date-value.component.html',\n styleUrl: './cell-date-value.component.scss',\n})\nexport class CellDateValueComponent<Record> implements OnInit, OnDestroy {\n private changeDetectorRef = inject(ChangeDetectorRef);\n private dateRefreshService = inject(DateRefreshService);\n\n @Input()\n column!: DatatableDateColumn<Record>;\n\n @Input('row')\n set setRow(row: any) {\n this.row = row;\n this.value = get(this.row, this.column.property);\n if (typeof (this.column as DatatableValueColumn<Record>).transform === 'function') {\n this.value = (this.column as DatatableValueColumn<Record>).transform!(this.value, this.row);\n }\n this.duration = duration(this.value, this.column);\n }\n row: any;\n\n value?: any;\n duration?: string | null;\n\n private refreshSubscription?: Subscription;\n\n ngOnInit(): void {\n if (!this.column.withDuration || !this.column.durationRefreshTime) return;\n this.refreshSubscription = this.dateRefreshService.forInterval(this.column.durationRefreshTime).subscribe(() => {\n this.duration = duration(this.value, this.column);\n this.changeDetectorRef.detectChanges();\n });\n }\n\n ngOnDestroy(): void {\n this.refreshSubscription?.unsubscribe();\n }\n}\n","<!-- @format -->\n\n@if (value) {\n <span class=\"date\"> {{ value | momentFormat: column }} </span>\n @if (column.withDuration) {\n <span class=\"duration\"> ({{ duration }}) </span>\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;MAMa,kBAAkB,CAAA;AACZ,IAAA,SAAS,GAAG,IAAI,GAAG,EAA8B;AAElE,IAAA,WAAW,CAAC,WAAmB,EAAA;QAC7B,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC;QAC3C,IAAI,CAAC,KAAK,EAAE;YACV,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3C,IAAI,CAA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AAA,CAAA;sBADT,KAAK;uBAAC,KAAK;;;;;"}
|
|
@@ -2,7 +2,7 @@ import { CommonModule } from '@angular/common';
|
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { Component, Input } from '@angular/core';
|
|
4
4
|
import { MatIconModule } from '@angular/material/icon';
|
|
5
|
-
import { g as get, d as duration } from './eherve-angular-material-datatable-eherve-angular-material-datatable-
|
|
5
|
+
import { g as get, d as duration } from './eherve-angular-material-datatable-eherve-angular-material-datatable-oKhIjmQe.mjs';
|
|
6
6
|
|
|
7
7
|
/** @format */
|
|
8
8
|
class CellDurationValueComponent {
|
|
@@ -32,4 +32,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
32
32
|
}] } });
|
|
33
33
|
|
|
34
34
|
export { CellDurationValueComponent };
|
|
35
|
-
//# sourceMappingURL=eherve-angular-material-datatable-cell-duration-value.component-
|
|
35
|
+
//# sourceMappingURL=eherve-angular-material-datatable-cell-duration-value.component-Br8ga1qE.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eherve-angular-material-datatable-cell-duration-value.component-
|
|
1
|
+
{"version":3,"file":"eherve-angular-material-datatable-cell-duration-value.component-Br8ga1qE.mjs","sources":["../../../projects/datatable/src/lib/components/cell-duration-value/cell-duration-value.component.ts","../../../projects/datatable/src/lib/components/cell-duration-value/cell-duration-value.component.html"],"sourcesContent":["/** @format */\n\nimport { CommonModule } from '@angular/common';\nimport { ChangeDetectorRef, Component, inject, Input } from '@angular/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { duration } from '../../tools/duration.tool';\nimport { get } from '../../tools/get.tool';\nimport { DatatableDurationColumn, DatatableValueColumn } from '../../types/datatable-column.type';\n\n@Component({\n selector: 'lib-cell-duration-value',\n imports: [CommonModule, MatIconModule],\n templateUrl: './cell-duration-value.component.html',\n styleUrl: './cell-duration-value.component.scss',\n})\nexport class CellDurationValueComponent<Record> {\n @Input()\n column!: DatatableDurationColumn<Record>;\n\n @Input('row')\n set setRow(row: any) {\n this.row = row;\n this.value = get(this.row, this.column.property);\n if (typeof (this.column as DatatableValueColumn<Record>).transform === 'function') {\n this.value = (this.column as DatatableValueColumn<Record>).transform!(this.value, this.row);\n }\n this.duration = duration(this.value, this.column);\n }\n row: any;\n\n value?: any;\n duration?: string | null;\n}\n","<!-- @format -->\n\n@if (duration !== null) {\n {{ duration }}\n}\n"],"names":[],"mappings":";;;;;;AAAA;MAea,0BAA0B,CAAA;AAErC,IAAA,MAAM;IAEN,IACI,MAAM,CAAC,GAAQ,EAAA;AACjB,QAAA,IAAI,CAAC,GAAG,GAAG,GAAG;AACd,QAAA,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChD,IAAI,OAAQ,IAAI,CAAC,MAAuC,CAAC,SAAS,KAAK,UAAU,EAAE;AACjF,YAAA,IAAI,CAAC,KAAK,GAAI,IAAI,CAAC,MAAuC,CAAC,SAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC;;AAE7F,QAAA,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;;AAEnD,IAAA,GAAG;AAEH,IAAA,KAAK;AACL,IAAA,QAAQ;uGAhBG,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAA1B,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,0BAA0B,ECfvC,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,yBAAA,EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,CAAA,KAAA,EAAA,QAAA,CAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAAA,sEAKA,EDMY,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,YAAY,8BAAE,aAAa,EAAA,CAAA,EAAA,CAAA;;2FAI1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBANtC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,yBAAyB,EAC1B,OAAA,EAAA,CAAC,YAAY,EAAE,aAAa,CAAC,EAAA,QAAA,EAAA,sEAAA,EAAA;8BAMtC,MAAM,EAAA,CAAA;sBADL;gBAIG,MAAM,EAAA,CAAA;sBADT,KAAK;uBAAC,KAAK;;;;;"}
|
|
@@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
|
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { Component, Input } from '@angular/core';
|
|
5
5
|
import { MatIconModule } from '@angular/material/icon';
|
|
6
|
-
import { GetPipe } from './eherve-angular-material-datatable-get.pipe-
|
|
6
|
+
import { GetPipe } from './eherve-angular-material-datatable-get.pipe-OPM3WlAY.mjs';
|
|
7
7
|
import { TransformPipe } from './eherve-angular-material-datatable-transform.pipe-BOmcXXZU.mjs';
|
|
8
8
|
|
|
9
9
|
/** @format */
|
|
@@ -23,4 +23,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImpor
|
|
|
23
23
|
}] } });
|
|
24
24
|
|
|
25
25
|
export { CellNumberValueComponent };
|
|
26
|
-
//# sourceMappingURL=eherve-angular-material-datatable-cell-number-value.component-
|
|
26
|
+
//# sourceMappingURL=eherve-angular-material-datatable-cell-number-value.component-BGmWTDbF.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eherve-angular-material-datatable-cell-number-value.component-
|
|
1
|
+
{"version":3,"file":"eherve-angular-material-datatable-cell-number-value.component-BGmWTDbF.mjs","sources":["../../../projects/datatable/src/lib/components/cell-number-value/cell-number-value.component.ts","../../../projects/datatable/src/lib/components/cell-number-value/cell-number-value.component.html"],"sourcesContent":["/** @format */\n\nimport { CommonModule } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { GetPipe } from '../../pipes/get.pipe';\nimport { TransformPipe } from '../../pipes/transform.pipe';\nimport { DatatableNumberColumn } from '../../types/datatable-column.type';\n\n@Component({\n selector: 'lib-cell-number-value',\n imports: [CommonModule, GetPipe, MatIconModule, TransformPipe],\n templateUrl: './cell-number-value.component.html',\n styleUrl: './cell-number-value.component.scss',\n})\nexport class CellNumberValueComponent<Record> {\n @Input()\n column!: DatatableNumberColumn<Record>;\n\n @Input()\n row: any;\n}\n","<!-- @format -->\n\n@let value = row | get: column.property;\n{{ value | transform: row : column | number: column.format : column.locale }}\n"],"names":[],"mappings":";;;;;;;;AAAA;MAea,wBAAwB,CAAA;AAEnC,IAAA,MAAM;AAGN,IAAA,GAAG;uGALQ,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAxB,wBAAwB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,uBAAA,EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,GAAA,EAAA,KAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECfrC,+IAIA,EDOY,MAAA,EAAA,CAAA,yBAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,YAAY,kFAAE,OAAO,EAAA,IAAA,EAAA,KAAA,EAAA,EAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAE,aAAa,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAE,aAAa,EAAA,IAAA,EAAA,WAAA,EAAA,CAAA,EAAA,CAAA;;2FAIlD,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBANpC,SAAS;+BACE,uBAAuB,EAAA,OAAA,EACxB,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,CAAC,EAAA,QAAA,EAAA,+IAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,CAAA,EAAA;8BAM9D,MAAM,EAAA,CAAA;sBADL;gBAID,GAAG,EAAA,CAAA;sBADF;;;;;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as i1 from '@angular/common';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, Component, Input } from '@angular/core';
|
|
5
|
+
import { MatLabel } from '@angular/material/form-field';
|
|
6
|
+
import * as i5 from '@angular/material/icon';
|
|
7
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
8
|
+
import { GetPipe } from './eherve-angular-material-datatable-get.pipe-OPM3WlAY.mjs';
|
|
9
|
+
import { S as SelectOptionsCacheService, a as SelectOptionPipe, I as IsArrayPipe, b as SafeHtmlPipe } from './eherve-angular-material-datatable-eherve-angular-material-datatable-oKhIjmQe.mjs';
|
|
10
|
+
import { TransformPipe } from './eherve-angular-material-datatable-transform.pipe-BOmcXXZU.mjs';
|
|
11
|
+
import { Subscription } from 'rxjs';
|
|
12
|
+
|
|
13
|
+
/** @format */
|
|
14
|
+
class CellSelectValueComponent {
|
|
15
|
+
column;
|
|
16
|
+
row;
|
|
17
|
+
options = [];
|
|
18
|
+
selectOptionsCache = inject(SelectOptionsCacheService);
|
|
19
|
+
subsink = new Subscription();
|
|
20
|
+
ngOnInit() {
|
|
21
|
+
if (Array.isArray(this.column.options))
|
|
22
|
+
this.options = this.column.options;
|
|
23
|
+
else {
|
|
24
|
+
this.subsink.add(this.selectOptionsCache.resolve(this.column.options).subscribe(options => {
|
|
25
|
+
this.options = options;
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
ngOnDestroy() {
|
|
30
|
+
this.subsink.unsubscribe();
|
|
31
|
+
}
|
|
32
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellSelectValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
33
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.4", type: CellSelectValueComponent, isStandalone: true, selector: "lib-cell-select-value", inputs: { column: "column", row: "row" }, ngImport: i0, template: "<!-- @format -->\n\n@let value = row | get: column.property | transform: row : column;\n\n@if (column.isArrayValue && value | isArray) {\n <div class=\"options\">\n @for (v of value; track v) {\n <ng-container *ngTemplateOutlet=\"optionTmpl; context: { value: v }\"></ng-container>\n }\n </div>\n} @else {\n <ng-container *ngTemplateOutlet=\"optionTmpl; context: { value }\"></ng-container>\n}\n\n<ng-template #optionTmpl let-value=\"value\">\n @let option = value | selectOption: options;\n @if (option) {\n <div class=\"option\">\n @if (option.icon) {\n @switch (option.iconSrc) {\n @case ('svg') {\n <mat-icon [svgIcon]=\"option.icon\" [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\"></mat-icon>\n }\n @default {\n <mat-icon [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\">\n {{ option.icon }}\n </mat-icon>\n }\n }\n }\n <mat-label *ngIf=\"!column.iconOnly\" [style.color]=\"option.color\" [innerHTML]=\"option.name | safeHtml\"></mat-label>\n </div>\n } @else {\n {{ value }}\n }\n</ng-template>\n", styles: [".option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row;padding:4px}mat-icon,mat-label{color:currentColor}:host-context(tr.has-click:hover) mat-icon,:host-context(tr.has-click:hover) mat-label{color:var(--datatable-hover-color, var(--mat-sys-on-primary))!important}.options{display:flex;box-sizing:border-box;place-content:start start;align-items:center;flex-direction:row;flex-wrap:wrap}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: SelectOptionPipe, name: "selectOption" }, { kind: "pipe", type: GetPipe, name: "get" }, { kind: "pipe", type: IsArrayPipe, name: "isArray" }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "pipe", type: TransformPipe, name: "transform" }, { kind: "pipe", type: SafeHtmlPipe, name: "safeHtml" }] });
|
|
34
|
+
}
|
|
35
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: CellSelectValueComponent, decorators: [{
|
|
36
|
+
type: Component,
|
|
37
|
+
args: [{ selector: 'lib-cell-select-value', imports: [CommonModule, SelectOptionPipe, GetPipe, IsArrayPipe, MatIconModule, MatLabel, TransformPipe, SafeHtmlPipe], template: "<!-- @format -->\n\n@let value = row | get: column.property | transform: row : column;\n\n@if (column.isArrayValue && value | isArray) {\n <div class=\"options\">\n @for (v of value; track v) {\n <ng-container *ngTemplateOutlet=\"optionTmpl; context: { value: v }\"></ng-container>\n }\n </div>\n} @else {\n <ng-container *ngTemplateOutlet=\"optionTmpl; context: { value }\"></ng-container>\n}\n\n<ng-template #optionTmpl let-value=\"value\">\n @let option = value | selectOption: options;\n @if (option) {\n <div class=\"option\">\n @if (option.icon) {\n @switch (option.iconSrc) {\n @case ('svg') {\n <mat-icon [svgIcon]=\"option.icon\" [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\"></mat-icon>\n }\n @default {\n <mat-icon [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\">\n {{ option.icon }}\n </mat-icon>\n }\n }\n }\n <mat-label *ngIf=\"!column.iconOnly\" [style.color]=\"option.color\" [innerHTML]=\"option.name | safeHtml\"></mat-label>\n </div>\n } @else {\n {{ value }}\n }\n</ng-template>\n", styles: [".option{display:flex;box-sizing:border-box;place-content:center start;align-items:center;flex-direction:row;padding:4px}mat-icon,mat-label{color:currentColor}:host-context(tr.has-click:hover) mat-icon,:host-context(tr.has-click:hover) mat-label{color:var(--datatable-hover-color, var(--mat-sys-on-primary))!important}.options{display:flex;box-sizing:border-box;place-content:start start;align-items:center;flex-direction:row;flex-wrap:wrap}\n"] }]
|
|
38
|
+
}], propDecorators: { column: [{
|
|
39
|
+
type: Input
|
|
40
|
+
}], row: [{
|
|
41
|
+
type: Input
|
|
42
|
+
}] } });
|
|
43
|
+
|
|
44
|
+
export { CellSelectValueComponent };
|
|
45
|
+
//# sourceMappingURL=eherve-angular-material-datatable-cell-select-value.component-_CDm5Nid.mjs.map
|
package/fesm2022/eherve-angular-material-datatable-cell-select-value.component-_CDm5Nid.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eherve-angular-material-datatable-cell-select-value.component-_CDm5Nid.mjs","sources":["../../../projects/datatable/src/lib/components/cell-select-value/cell-select-value.component.ts","../../../projects/datatable/src/lib/components/cell-select-value/cell-select-value.component.html"],"sourcesContent":["/** @format */\n\nimport { CommonModule } from '@angular/common';\nimport { Component, inject, Input, OnDestroy, OnInit } from '@angular/core';\nimport { MatLabel } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { GetPipe } from '../../pipes/get.pipe';\nimport { SafeHtmlPipe } from '../../pipes/safe-html.pipe';\nimport { SelectOptionPipe } from '../../pipes/select-option.pipe';\nimport { TransformPipe } from '../../pipes/transform.pipe';\nimport { DatatableSearchListOption, DatatableSelectColumn } from '../../types/datatable-column.type';\nimport { IsArrayPipe } from '../../pipes/is-array.pipe';\nimport { Subscription } from 'rxjs';\nimport { SelectOptionsCacheService } from '../../select-options-cache.service';\n\n@Component({\n selector: 'lib-cell-select-value',\n imports: [CommonModule, SelectOptionPipe, GetPipe, IsArrayPipe, MatIconModule, MatLabel, TransformPipe, SafeHtmlPipe],\n templateUrl: './cell-select-value.component.html',\n styleUrl: './cell-select-value.component.scss',\n})\nexport class CellSelectValueComponent<Record> implements OnInit, OnDestroy {\n @Input()\n column!: DatatableSelectColumn<Record>;\n\n @Input()\n row: any;\n\n options: DatatableSearchListOption[] = [];\n\n private selectOptionsCache = inject(SelectOptionsCacheService);\n private subsink = new Subscription();\n\n ngOnInit(): void {\n if (Array.isArray(this.column.options)) this.options = this.column.options;\n else {\n this.subsink.add(\n this.selectOptionsCache.resolve(this.column.options).subscribe(options => {\n this.options = options;\n }),\n );\n }\n }\n\n ngOnDestroy(): void {\n this.subsink.unsubscribe();\n }\n}\n","<!-- @format -->\n\n@let value = row | get: column.property | transform: row : column;\n\n@if (column.isArrayValue && value | isArray) {\n <div class=\"options\">\n @for (v of value; track v) {\n <ng-container *ngTemplateOutlet=\"optionTmpl; context: { value: v }\"></ng-container>\n }\n </div>\n} @else {\n <ng-container *ngTemplateOutlet=\"optionTmpl; context: { value }\"></ng-container>\n}\n\n<ng-template #optionTmpl let-value=\"value\">\n @let option = value | selectOption: options;\n @if (option) {\n <div class=\"option\">\n @if (option.icon) {\n @switch (option.iconSrc) {\n @case ('svg') {\n <mat-icon [svgIcon]=\"option.icon\" [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\"></mat-icon>\n }\n @default {\n <mat-icon [style.color]=\"option.iconColor ?? option.color\" [style.margin-right.px]=\"8\">\n {{ option.icon }}\n </mat-icon>\n }\n }\n }\n <mat-label *ngIf=\"!column.iconOnly\" [style.color]=\"option.color\" [innerHTML]=\"option.name | safeHtml\"></mat-label>\n </div>\n } @else {\n {{ value }}\n }\n</ng-template>\n"],"names":["i2"],"mappings":";;;;;;;;;;;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