@mozaic-ds/angular 0.24.0-beta.16 → 0.24.0-beta.17
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/adeo/components/datatable/components/selection/moz-datatable-selection.component.d.ts +6 -0
- package/adeo/esm2020/components/datatable/components/selection/moz-datatable-selection.component.mjs +27 -14
- package/adeo/fesm2015/mozaic-ds-angular.mjs +27 -13
- package/adeo/fesm2015/mozaic-ds-angular.mjs.map +1 -1
- package/adeo/fesm2020/mozaic-ds-angular.mjs +26 -13
- package/adeo/fesm2020/mozaic-ds-angular.mjs.map +1 -1
- package/adeo/package.json +1 -1
- package/bricoman/components/datatable/components/selection/moz-datatable-selection.component.d.ts +6 -0
- package/bricoman/esm2020/components/datatable/components/selection/moz-datatable-selection.component.mjs +27 -14
- package/bricoman/fesm2015/mozaic-ds-angular.mjs +27 -13
- package/bricoman/fesm2015/mozaic-ds-angular.mjs.map +1 -1
- package/bricoman/fesm2020/mozaic-ds-angular.mjs +26 -13
- package/bricoman/fesm2020/mozaic-ds-angular.mjs.map +1 -1
- package/bricoman/package.json +1 -1
- package/components/datatable/components/selection/moz-datatable-selection.component.d.ts +6 -0
- package/esm2020/components/datatable/components/selection/moz-datatable-selection.component.mjs +27 -14
- package/fesm2015/mozaic-ds-angular.mjs +27 -13
- package/fesm2015/mozaic-ds-angular.mjs.map +1 -1
- package/fesm2020/mozaic-ds-angular.mjs +26 -13
- package/fesm2020/mozaic-ds-angular.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2454,7 +2454,7 @@ class MozDatatableSelectionComponent {
|
|
|
2454
2454
|
if (row.selected) {
|
|
2455
2455
|
this.selectionSettings.excludedIds = [
|
|
2456
2456
|
...this.selectionSettings.excludedIds.filter((deselectedId) => {
|
|
2457
|
-
return deselectedId !==
|
|
2457
|
+
return deselectedId !== this.getId(row);
|
|
2458
2458
|
}),
|
|
2459
2459
|
];
|
|
2460
2460
|
}
|
|
@@ -2462,12 +2462,12 @@ class MozDatatableSelectionComponent {
|
|
|
2462
2462
|
if (this.paginationEnabled) {
|
|
2463
2463
|
this.selectionSettings.excludedIds = [
|
|
2464
2464
|
...this.selectionSettings.excludedIds,
|
|
2465
|
-
|
|
2465
|
+
this.getId(row),
|
|
2466
2466
|
];
|
|
2467
2467
|
}
|
|
2468
2468
|
else {
|
|
2469
2469
|
this.selectionSettings.selectedIds = [
|
|
2470
|
-
...this.selectionSettings.selectedIds.filter((selectedId) => selectedId !==
|
|
2470
|
+
...this.selectionSettings.selectedIds.filter((selectedId) => selectedId !== this.getId(row)),
|
|
2471
2471
|
];
|
|
2472
2472
|
this.selectionSettings.allSelected = false;
|
|
2473
2473
|
}
|
|
@@ -2482,7 +2482,7 @@ class MozDatatableSelectionComponent {
|
|
|
2482
2482
|
if (row.selected) {
|
|
2483
2483
|
this.selectionSettings.selectedIds = [
|
|
2484
2484
|
...this.selectionSettings.selectedIds,
|
|
2485
|
-
|
|
2485
|
+
this.getId(row),
|
|
2486
2486
|
];
|
|
2487
2487
|
if (this.canSwitchtoAllSelectedMode()) {
|
|
2488
2488
|
this.switchtoAllSelectedMode();
|
|
@@ -2491,7 +2491,7 @@ class MozDatatableSelectionComponent {
|
|
|
2491
2491
|
else {
|
|
2492
2492
|
this.selectionSettings.selectedIds = [
|
|
2493
2493
|
...this.selectionSettings.selectedIds.filter((selectedId) => {
|
|
2494
|
-
return selectedId !==
|
|
2494
|
+
return selectedId !== this.getId(row);
|
|
2495
2495
|
}),
|
|
2496
2496
|
];
|
|
2497
2497
|
}
|
|
@@ -2524,7 +2524,7 @@ class MozDatatableSelectionComponent {
|
|
|
2524
2524
|
.filter((row) => !row.disableSelection)
|
|
2525
2525
|
.forEach((row) => {
|
|
2526
2526
|
if (this.selectionSettings) {
|
|
2527
|
-
const index = this.selectionSettings.excludedIds.indexOf(
|
|
2527
|
+
const index = this.selectionSettings.excludedIds.indexOf(this.getId(row), 0);
|
|
2528
2528
|
if (index > -1) {
|
|
2529
2529
|
this.selectionSettings.excludedIds.splice(index, 1);
|
|
2530
2530
|
this.selectionSettings.excludedIds = [...this.selectionSettings.excludedIds];
|
|
@@ -2545,9 +2545,7 @@ class MozDatatableSelectionComponent {
|
|
|
2545
2545
|
if (this.rowData) {
|
|
2546
2546
|
this.selectionSettings.excludedIds = [
|
|
2547
2547
|
...this.selectionSettings.excludedIds,
|
|
2548
|
-
...this.rowData
|
|
2549
|
-
.filter((row) => !row.disableSelection)
|
|
2550
|
-
.map((row) => '' + row[selectionIdentifierFieldKey]),
|
|
2548
|
+
...this.rowData.filter((row) => !row.disableSelection).map((row) => this.getId(row)),
|
|
2551
2549
|
];
|
|
2552
2550
|
if (this.selectionSettings.excludedIds.length ===
|
|
2553
2551
|
this.selectionSettings.totalSelectableItems) {
|
|
@@ -2572,12 +2570,12 @@ class MozDatatableSelectionComponent {
|
|
|
2572
2570
|
if (allPageRowsSelected && this.rowData) {
|
|
2573
2571
|
this.rowData
|
|
2574
2572
|
.filter((row) => !row.disableSelection)
|
|
2575
|
-
.filter((row) => !(this.selectionSettings?.selectedIds || []).includes(
|
|
2573
|
+
.filter((row) => !(this.selectionSettings?.selectedIds || []).includes(this.getId(row)))
|
|
2576
2574
|
.forEach((row) => {
|
|
2577
2575
|
if (this.selectionSettings) {
|
|
2578
2576
|
this.selectionSettings.selectedIds = [
|
|
2579
2577
|
...this.selectionSettings.selectedIds,
|
|
2580
|
-
|
|
2578
|
+
this.getId(row),
|
|
2581
2579
|
];
|
|
2582
2580
|
}
|
|
2583
2581
|
});
|
|
@@ -2589,10 +2587,10 @@ class MozDatatableSelectionComponent {
|
|
|
2589
2587
|
if (this.rowData) {
|
|
2590
2588
|
const allRowOnPage = this.rowData
|
|
2591
2589
|
.filter((row) => !row.disableSelection)
|
|
2592
|
-
.map((row) =>
|
|
2590
|
+
.map((row) => this.getId(row));
|
|
2593
2591
|
const allRowSelectedOnPage = this.rowData
|
|
2594
2592
|
.filter((row) => !row.disableSelection && row.selected)
|
|
2595
|
-
.map((row) =>
|
|
2593
|
+
.map((row) => this.getId(row));
|
|
2596
2594
|
const rowSelectedOnOtherPages = this.selectionSettings.selectedIds.filter((element) => !allRowOnPage.includes(element));
|
|
2597
2595
|
this.selectionSettings.selectedIds = [
|
|
2598
2596
|
...rowSelectedOnOtherPages,
|
|
@@ -2667,6 +2665,21 @@ class MozDatatableSelectionComponent {
|
|
|
2667
2665
|
}
|
|
2668
2666
|
return false;
|
|
2669
2667
|
}
|
|
2668
|
+
/**
|
|
2669
|
+
* if the value is an object so the resulted id == '[object Object]'
|
|
2670
|
+
* @param row
|
|
2671
|
+
* @private
|
|
2672
|
+
*/
|
|
2673
|
+
getId(row) {
|
|
2674
|
+
if (!this.selectionSettings?.selectionIdentifierFieldKey) {
|
|
2675
|
+
return '';
|
|
2676
|
+
}
|
|
2677
|
+
const rowElement = row[this.selectionSettings?.selectionIdentifierFieldKey];
|
|
2678
|
+
if (typeof rowElement === 'object') {
|
|
2679
|
+
return rowElement;
|
|
2680
|
+
}
|
|
2681
|
+
return '' + rowElement;
|
|
2682
|
+
}
|
|
2670
2683
|
}
|
|
2671
2684
|
MozDatatableSelectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MozDatatableSelectionComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
2672
2685
|
MozDatatableSelectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MozDatatableSelectionComponent, selector: "moz-datatable-selection", inputs: { selectionSettings: "selectionSettings", paginationEnabled: "paginationEnabled", allowAllSelected: "allowAllSelected", rowData: "rowData" }, outputs: { updateSelectionAllEmitter: "updateSelectionAllEmitter" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"mc-datatable__selection\">\n <ng-container *ngIf=\"selectionSettings && selectionSettings.labels && paginationEnabled\">\n <div class=\"mc-datatable__topbar-selection\">\n <ng-container *ngIf=\"selectionSettings.selectedIds.length || selectionSettings.allSelected\">\n <div class=\"center-selection-label\">\n <div *ngIf=\"selectionSettings.allSelected; else notAllSelected\">\n <ng-container *ngIf=\"selectionSettings.excludedIds.length > 0; else exludedIdsEmpty\">\n <span>\n <b\n >{{\n selectionSettings.totalSelectableItems - selectionSettings.excludedIds.length\n }}\n {{ selectionSettings.labels.selectedLabel || 'selected' }}</b\n >\n <ng-container\n *ngIf=\"\n selectionSettings.totalSelectableItems -\n selectionSettings.excludedIds.length ===\n 1;\n else plurialAllSelected\n \"\n >\n {{ selectionSettings.labels.rowOnPageLabel || 'row on the page. ' }}-\n </ng-container>\n <ng-template #plurialAllSelected>\n {{ selectionSettings.labels.rowsOnPageLabel || 'rows on the page. ' }}-\n </ng-template>\n\n {{ selectionSettings.labels.rowsOnPageLabel || 'rows on the page. ' }}-\n <a href=\"/\" (click)=\"selectAll(); $event.preventDefault()\">\n {{ selectionSettings.labels.selectAllLabel || 'Select all' }}\n {{ selectionSettings.totalSelectableItems }}\n {{ selectionSettings.labels.rowsOfTableLabel || 'rows of the table' }}\n </a>\n </span>\n </ng-container>\n <ng-template #exludedIdsEmpty>\n <span>\n {{\n selectionSettings.labels.rowsSelectedLabel ||\n 'All rows are selected in the table.'\n }}\n -\n <a href=\"/\" (click)=\"clearAll(); $event.preventDefault()\">\n {{ selectionSettings.labels.clearSelectionLabel || 'Clear selection' }}\n </a>\n </span>\n </ng-template>\n </div>\n <ng-template #notAllSelected>\n <span>\n <b\n >{{ selectionSettings.selectedIds.length }}\n {{ selectionSettings.labels.selectedLabel || 'selected' }}</b\n >\n <ng-container\n *ngIf=\"selectionSettings.selectedIds && selectionSettings.selectedIds.length > 0\"\n >\n <ng-container\n *ngIf=\"\n selectionSettings.selectedIds && selectionSettings.selectedIds.length === 1;\n else plurialNotAllSelected\n \"\n >\n {{ selectionSettings.labels.rowOnPageLabel || 'row on the page. ' }}-\n </ng-container>\n <ng-template #plurialNotAllSelected>\n {{ selectionSettings.labels.rowsOnPageLabel || 'rows on the page. ' }}-\n </ng-template>\n <a href=\"/\" (click)=\"selectAll(); $event.preventDefault()\">\n {{ selectionSettings.labels.selectAllLabel || 'Select all' }}\n {{ selectionSettings.totalSelectableItems }}\n {{ selectionSettings.labels.rowsOfTableLabel || 'rows of the table' }}\n </a>\n </ng-container>\n </span>\n </ng-template>\n </div>\n </ng-container>\n </div>\n </ng-container>\n</div>\n", styles: [".center-selection-label{margin-bottom:1rem;background-color:#fff;height:34px;text-align:center;align-items:center;display:flex;justify-content:center;border-radius:.25rem}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|