@intellegens/cornerstone-client-angular-material 0.0.9999-alpha-3 → 0.0.9999-alpha-4
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.
|
@@ -69,16 +69,17 @@ class MatTableSortDirective {
|
|
|
69
69
|
// tell MatSort our starting sort direction
|
|
70
70
|
const adapter = this.adapter();
|
|
71
71
|
if (adapter) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this._matSort.
|
|
72
|
+
// TODO: handle multiple columns - for now it only supports ordering by one column
|
|
73
|
+
const initialSort = adapter.getCurrentOrdering()[0];
|
|
74
|
+
this._matSort.active = (initialSort.orderByPath && initialSort.orderByPath[0]) || '';
|
|
75
|
+
this._matSort.direction = initialSort.orderDirection === ReadSelectedOrderingDirection.Ascending ? 'desc' : 'asc'; // show reverse arrows
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
_subscription = this._matSort.sortChange.subscribe((event) => {
|
|
78
79
|
const adapter = this.adapter();
|
|
79
80
|
if (adapter && event?.active) {
|
|
80
81
|
const newDirection = event.direction == 'desc' ? ReadSelectedOrderingDirection.Ascending : ReadSelectedOrderingDirection.Descending; // show reverse arrows
|
|
81
|
-
adapter.
|
|
82
|
+
adapter.setOrdering([event.active], newDirection);
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
ngOnDestroy() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intellegens-cornerstone-client-angular-material.mjs","sources":["../../../../projects/intellegens/cornerstone-client-angular-material/src/lib/overrides/MatPaginatorIntlOverrides/index.ts","../../../../projects/intellegens/cornerstone-client-angular-material/src/lib/directives/MatTablePaginationDirective/index.ts","../../../../projects/intellegens/cornerstone-client-angular-material/src/lib/directives/MatTableSortDirective/index.ts","../../../../projects/intellegens/cornerstone-client-angular-material/src/public-api.ts","../../../../projects/intellegens/cornerstone-client-angular-material/src/intellegens-cornerstone-client-angular-material.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { MatPaginatorIntl } from '@angular/material/paginator';\n\n/**\n * Custom paginator service to adjust the label for the paginator.\n */\n@Injectable()\nexport class MatPaginatorIntlOverrides extends MatPaginatorIntl {\n override getRangeLabel = (page: number, pageSize: number, length: number) => {\n if (length === 0) {\n return 'Page 1 of 1';\n }\n const isLengthValid = length && length !== -1;\n return isLengthValid ? `Page ${page + 1} of ${Math.ceil(length / pageSize)}` : `Page ${page + 1}`;\n };\n}\n","import { Directive, InputSignal, inject, input } from '@angular/core';\nimport { MatPaginator, MatPaginatorIntl, PageEvent } from '@angular/material/paginator';\nimport { MatPaginatorIntlOverrides } from '../../overrides'; // using path alias results in `Could not resolve \"@overrides\"` in app\nimport { Subscription } from 'rxjs';\nimport { CollectionViewAdapter } from '@intellegens/cornerstone-client-angular';\n\n/**\n * Directive used to pass data to the `CollectionViewAdapter`, uses `MatPaginatorIntlOverrides` to change pagination UI.\n */\n@Directive({\n selector: 'mat-paginator',\n providers: [{ provide: MatPaginatorIntl, useClass: MatPaginatorIntlOverrides }],\n standalone: true,\n})\nexport class MatTablePaginationDirective {\n private _matPaginator = inject(MatPaginator);\n public adapter: InputSignal<CollectionViewAdapter<any, any> | undefined> = input();\n private _subscription?: Subscription;\n ngOnInit() {\n this._subscription = this._matPaginator.page.subscribe((event: PageEvent) => {\n const adapter = this.adapter();\n if (!adapter) return;\n const targetPage = event.pageIndex + 1;\n if (event.pageSize !== adapter.pageSize) {\n adapter.setPageSize(event.pageSize);\n } else if (targetPage !== adapter.currentPage) {\n adapter.jumpToPage(targetPage);\n }\n });\n }\n ngOnDestroy() {\n this._subscription?.unsubscribe();\n }\n}\n","import { Directive, inject, input, InputSignal } from '@angular/core';\nimport { MatSort, Sort } from '@angular/material/sort';\nimport { CollectionViewAdapter, ReadSelectedOrderingDirection } from '@intellegens/cornerstone-client-angular';\n\n/**\n * Directive used to pass data to the `CollectionViewAdapter` and reverse the default direction of shown table header sorting arrows\n */\n@Directive({\n selector: 'mat-table[matSort], table[mat-table][matSort]',\n standalone: true,\n})\nexport class MatTableSortDirective {\n private _matSort = inject(MatSort);\n public adapter: InputSignal<CollectionViewAdapter<any, any> | undefined> = input();\n ngOnInit() {\n this._matSort.disableClear = true; // removes \"unsorted\" option, syncs column header arrows with actual current sort direction\n // tell MatSort our starting sort direction\n const adapter = this.adapter();\n if (adapter) {\n const initialSort = adapter.
|
|
1
|
+
{"version":3,"file":"intellegens-cornerstone-client-angular-material.mjs","sources":["../../../../projects/intellegens/cornerstone-client-angular-material/src/lib/overrides/MatPaginatorIntlOverrides/index.ts","../../../../projects/intellegens/cornerstone-client-angular-material/src/lib/directives/MatTablePaginationDirective/index.ts","../../../../projects/intellegens/cornerstone-client-angular-material/src/lib/directives/MatTableSortDirective/index.ts","../../../../projects/intellegens/cornerstone-client-angular-material/src/public-api.ts","../../../../projects/intellegens/cornerstone-client-angular-material/src/intellegens-cornerstone-client-angular-material.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { MatPaginatorIntl } from '@angular/material/paginator';\n\n/**\n * Custom paginator service to adjust the label for the paginator.\n */\n@Injectable()\nexport class MatPaginatorIntlOverrides extends MatPaginatorIntl {\n override getRangeLabel = (page: number, pageSize: number, length: number) => {\n if (length === 0) {\n return 'Page 1 of 1';\n }\n const isLengthValid = length && length !== -1;\n return isLengthValid ? `Page ${page + 1} of ${Math.ceil(length / pageSize)}` : `Page ${page + 1}`;\n };\n}\n","import { Directive, InputSignal, inject, input } from '@angular/core';\nimport { MatPaginator, MatPaginatorIntl, PageEvent } from '@angular/material/paginator';\nimport { MatPaginatorIntlOverrides } from '../../overrides'; // using path alias results in `Could not resolve \"@overrides\"` in app\nimport { Subscription } from 'rxjs';\nimport { CollectionViewAdapter } from '@intellegens/cornerstone-client-angular';\n\n/**\n * Directive used to pass data to the `CollectionViewAdapter`, uses `MatPaginatorIntlOverrides` to change pagination UI.\n */\n@Directive({\n selector: 'mat-paginator',\n providers: [{ provide: MatPaginatorIntl, useClass: MatPaginatorIntlOverrides }],\n standalone: true,\n})\nexport class MatTablePaginationDirective {\n private _matPaginator = inject(MatPaginator);\n public adapter: InputSignal<CollectionViewAdapter<any, any> | undefined> = input();\n private _subscription?: Subscription;\n ngOnInit() {\n this._subscription = this._matPaginator.page.subscribe((event: PageEvent) => {\n const adapter = this.adapter();\n if (!adapter) return;\n const targetPage = event.pageIndex + 1;\n if (event.pageSize !== adapter.pageSize) {\n adapter.setPageSize(event.pageSize);\n } else if (targetPage !== adapter.currentPage) {\n adapter.jumpToPage(targetPage);\n }\n });\n }\n ngOnDestroy() {\n this._subscription?.unsubscribe();\n }\n}\n","import { Directive, inject, input, InputSignal } from '@angular/core';\nimport { MatSort, Sort } from '@angular/material/sort';\nimport { CollectionViewAdapter, ReadSelectedOrderingDirection } from '@intellegens/cornerstone-client-angular';\n\n/**\n * Directive used to pass data to the `CollectionViewAdapter` and reverse the default direction of shown table header sorting arrows\n */\n@Directive({\n selector: 'mat-table[matSort], table[mat-table][matSort]',\n standalone: true,\n})\nexport class MatTableSortDirective {\n private _matSort = inject(MatSort);\n public adapter: InputSignal<CollectionViewAdapter<any, any> | undefined> = input();\n ngOnInit() {\n this._matSort.disableClear = true; // removes \"unsorted\" option, syncs column header arrows with actual current sort direction\n // tell MatSort our starting sort direction\n const adapter = this.adapter();\n if (adapter) {\n // TODO: handle multiple columns - for now it only supports ordering by one column\n const initialSort = adapter.getCurrentOrdering()[0];\n this._matSort.active = (initialSort.orderByPath && initialSort.orderByPath[0]) || '';\n this._matSort.direction = initialSort.orderDirection === ReadSelectedOrderingDirection.Ascending ? 'desc' : 'asc'; // show reverse arrows\n }\n }\n private _subscription = this._matSort.sortChange.subscribe((event: Sort) => {\n const adapter = this.adapter();\n if (adapter && event?.active) {\n const newDirection = event.direction == 'desc' ? ReadSelectedOrderingDirection.Ascending : ReadSelectedOrderingDirection.Descending; // show reverse arrows\n adapter.setOrdering([event.active], newDirection);\n }\n });\n ngOnDestroy() {\n this._subscription.unsubscribe();\n }\n}\n","/*\n * Public API Surface of cornerstone-client-angular-material\n */\n\nexport * from './lib/';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAGA;;AAEG;AAEG,MAAO,yBAA0B,SAAQ,gBAAgB,CAAA;IACpD,aAAa,GAAG,CAAC,IAAY,EAAE,QAAgB,EAAE,MAAc,KAAI;AAC1E,QAAA,IAAI,MAAM,KAAK,CAAC,EAAE;AAChB,YAAA,OAAO,aAAa;QACtB;QACA,MAAM,aAAa,GAAG,MAAM,IAAI,MAAM,KAAK,CAAC,CAAC;QAC7C,OAAO,aAAa,GAAG,CAAA,KAAA,EAAQ,IAAI,GAAG,CAAC,CAAA,IAAA,EAAO,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAA,CAAE,GAAG,CAAA,KAAA,EAAQ,IAAI,GAAG,CAAC,CAAA,CAAE;AACnG,IAAA,CAAC;uGAPU,yBAAyB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;2GAAzB,yBAAyB,EAAA,CAAA;;2FAAzB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBADrC;;;ACAD;;AAEG;MAMU,2BAA2B,CAAA;AAC9B,IAAA,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC;IACrC,OAAO,GAA6D,KAAK,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAE;AAC1E,IAAA,aAAa;IACrB,QAAQ,GAAA;AACN,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAgB,KAAI;AAC1E,YAAA,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE;AAC9B,YAAA,IAAI,CAAC,OAAO;gBAAE;AACd,YAAA,MAAM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AA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAJjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,+CAA+C;AACzD,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACVD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intellegens/cornerstone-client-angular-material",
|
|
3
|
-
"version": "0.0.9999-alpha-
|
|
3
|
+
"version": "0.0.9999-alpha-4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishable": true,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@angular/material": "^20.2.5",
|
|
14
14
|
"@angular/router": "^20.0.0",
|
|
15
15
|
"rxjs": "~7.8.0",
|
|
16
|
-
"@intellegens/cornerstone-client-angular": "0.0.9999-alpha-
|
|
16
|
+
"@intellegens/cornerstone-client-angular": "0.0.9999-alpha-4"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"tslib": "^2.3.0"
|