@elderbyte/ngx-starter 20.7.0 → 20.7.1

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.
@@ -5554,6 +5554,33 @@ class SortUtil {
5554
5554
  }
5555
5555
  }
5556
5556
 
5557
+ class MapUtils {
5558
+ static toDistinctMap(values, keyFn) {
5559
+ return values.reduce((map, value) => {
5560
+ map.set(keyFn(value), value);
5561
+ return map;
5562
+ }, new Map());
5563
+ }
5564
+ static groupByKey(values, keyFn) {
5565
+ const groups = new Map();
5566
+ values.forEach((value) => {
5567
+ const key = keyFn(value);
5568
+ let group = groups.get(key);
5569
+ if (!group) {
5570
+ group = [];
5571
+ groups.set(key, group);
5572
+ }
5573
+ group.push(value);
5574
+ });
5575
+ return groups;
5576
+ }
5577
+ static mapValue(map, valueMapFn) {
5578
+ const newMap = new Map();
5579
+ Array.from(map.entries()).forEach(([key, value]) => newMap.set(key, valueMapFn(value)));
5580
+ return newMap;
5581
+ }
5582
+ }
5583
+
5557
5584
  class LocalListDataSource extends DataSourceBase {
5558
5585
  /***************************************************************************
5559
5586
  * *
@@ -5660,9 +5687,26 @@ class LocalListDataSource extends DataSourceBase {
5660
5687
  }
5661
5688
  }
5662
5689
  saveAll(toSave) {
5663
- toSave.forEach((entity) => this.save(entity));
5690
+ const idDataMap = this.buildIdDataMap(this.data);
5691
+ const createdEntities = [];
5692
+ const modifiedEntities = [];
5693
+ toSave.forEach((entity) => {
5694
+ const id = this.getId(entity);
5695
+ if (!idDataMap.has(id)) {
5696
+ createdEntities.push(entity);
5697
+ }
5698
+ else {
5699
+ modifiedEntities.push(entity);
5700
+ }
5701
+ idDataMap.set(id, entity);
5702
+ });
5703
+ this.silentReplaceData(Array.from(idDataMap.values()));
5704
+ this.publishChanges(createdEntities, modifiedEntities);
5664
5705
  }
5665
5706
  save(entity, index) {
5707
+ this.saveAtIndex(entity, index);
5708
+ }
5709
+ saveAtIndex(entity, index) {
5666
5710
  const id = this.getId(entity);
5667
5711
  const newData = [...this.data];
5668
5712
  const existingIndex = newData.findIndex((entity) => this.getId(entity) === id);
@@ -5687,6 +5731,9 @@ class LocalListDataSource extends DataSourceBase {
5687
5731
  * Private methods *
5688
5732
  * *
5689
5733
  **************************************************************************/
5734
+ buildIdDataMap(data) {
5735
+ return MapUtils.toDistinctMap(data, (value) => this.getId(value));
5736
+ }
5690
5737
  silentReplaceData(newData) {
5691
5738
  this.data$.next(newData);
5692
5739
  }
@@ -5706,6 +5753,14 @@ class LocalListDataSource extends DataSourceBase {
5706
5753
  }
5707
5754
  return null; // Use value as id if scalar
5708
5755
  }
5756
+ publishChanges(createdEntities, modifiedEntities) {
5757
+ if (createdEntities.length > 0) {
5758
+ this.publishChangeEvent(DataSourceChangeEvent.created(createdEntities));
5759
+ }
5760
+ if (modifiedEntities.length > 0) {
5761
+ this.publishChangeEvent(DataSourceChangeEvent.modified(modifiedEntities));
5762
+ }
5763
+ }
5709
5764
  }
5710
5765
 
5711
5766
  class LocalPagedDataSource {
@@ -15531,11 +15586,11 @@ class ElderSelectionMasterCheckboxComponent {
15531
15586
  }
15532
15587
  }
15533
15588
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ElderSelectionMasterCheckboxComponent, deps: [{ token: DataContextSelectionDirective }], target: i0.ɵɵFactoryTarget.Component }); }
15534
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: ElderSelectionMasterCheckboxComponent, isStandalone: true, selector: "elder-selection-master-checkbox", ngImport: i0, template: "@if (selectionState(); as selectionState) {\n @if (selectionState.isMultiSelection) {\n <div class=\"layout-row place-start-center\">\n <mat-checkbox\n (change)=\"onCheckboxChange($event)\"\n [checked]=\"selectionState.allSelected\"\n [indeterminate]=\"selectionState.someSelected\"\n [matBadgeHidden]=\"selectionState.count === 0\"\n [matBadge]=\"selectionState.count + ''\"\n [matBadgeColor]=\"'accent'\"\n [matBadgePosition]=\"'above before'\"\n [matBadgeOverlap]=\"true\"\n [matBadgeSize]=\"'small'\"\n elderBadge\n >\n </mat-checkbox>\n </div>\n }\n}\n", styles: [".mat-badge-small.mat-badge-above .mat-badge-content{top:-6px}\n"], dependencies: [{ kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "directive", type: MatBadge, selector: "[matBadge]", inputs: ["matBadgeColor", "matBadgeOverlap", "matBadgeDisabled", "matBadgePosition", "matBadge", "matBadgeDescription", "matBadgeSize", "matBadgeHidden"] }, { kind: "directive", type: ElderBadgeDirective, selector: "[elderBadge]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
15589
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: ElderSelectionMasterCheckboxComponent, isStandalone: true, selector: "elder-selection-master-checkbox", ngImport: i0, template: "@if (selectionState(); as selectionState) {\n @if (selectionState.isMultiSelection) {\n <div class=\"layout-row place-start-center\">\n <mat-checkbox\n (change)=\"onCheckboxChange($event)\"\n [checked]=\"selectionState.allSelected\"\n [indeterminate]=\"selectionState.someSelected\"\n aria-label=\"Toggle all items\"\n [matBadgeHidden]=\"selectionState.count === 0\"\n [matBadge]=\"selectionState.count + ''\"\n [matBadgeColor]=\"'accent'\"\n [matBadgePosition]=\"'above before'\"\n [matBadgeOverlap]=\"true\"\n [matBadgeSize]=\"'small'\"\n elderBadge\n >\n </mat-checkbox>\n </div>\n }\n}\n", styles: [".mat-badge-small.mat-badge-above .mat-badge-content{top:-6px}\n"], dependencies: [{ kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "directive", type: MatBadge, selector: "[matBadge]", inputs: ["matBadgeColor", "matBadgeOverlap", "matBadgeDisabled", "matBadgePosition", "matBadge", "matBadgeDescription", "matBadgeSize", "matBadgeHidden"] }, { kind: "directive", type: ElderBadgeDirective, selector: "[elderBadge]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
15535
15590
  }
15536
15591
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ElderSelectionMasterCheckboxComponent, decorators: [{
15537
15592
  type: Component,
15538
- args: [{ selector: 'elder-selection-master-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatCheckbox, MatBadge, ElderBadgeDirective], template: "@if (selectionState(); as selectionState) {\n @if (selectionState.isMultiSelection) {\n <div class=\"layout-row place-start-center\">\n <mat-checkbox\n (change)=\"onCheckboxChange($event)\"\n [checked]=\"selectionState.allSelected\"\n [indeterminate]=\"selectionState.someSelected\"\n [matBadgeHidden]=\"selectionState.count === 0\"\n [matBadge]=\"selectionState.count + ''\"\n [matBadgeColor]=\"'accent'\"\n [matBadgePosition]=\"'above before'\"\n [matBadgeOverlap]=\"true\"\n [matBadgeSize]=\"'small'\"\n elderBadge\n >\n </mat-checkbox>\n </div>\n }\n}\n", styles: [".mat-badge-small.mat-badge-above .mat-badge-content{top:-6px}\n"] }]
15593
+ args: [{ selector: 'elder-selection-master-checkbox', changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatCheckbox, MatBadge, ElderBadgeDirective], template: "@if (selectionState(); as selectionState) {\n @if (selectionState.isMultiSelection) {\n <div class=\"layout-row place-start-center\">\n <mat-checkbox\n (change)=\"onCheckboxChange($event)\"\n [checked]=\"selectionState.allSelected\"\n [indeterminate]=\"selectionState.someSelected\"\n aria-label=\"Toggle all items\"\n [matBadgeHidden]=\"selectionState.count === 0\"\n [matBadge]=\"selectionState.count + ''\"\n [matBadgeColor]=\"'accent'\"\n [matBadgePosition]=\"'above before'\"\n [matBadgeOverlap]=\"true\"\n [matBadgeSize]=\"'small'\"\n elderBadge\n >\n </mat-checkbox>\n </div>\n }\n}\n", styles: [".mat-badge-small.mat-badge-above .mat-badge-content{top:-6px}\n"] }]
15539
15594
  }], ctorParameters: () => [{ type: DataContextSelectionDirective }] });
15540
15595
 
15541
15596
  class DataContextStateIndicatorComponent {
@@ -16724,11 +16779,11 @@ class ElderContinuatorComponent {
16724
16779
  }
16725
16780
  }
16726
16781
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ElderContinuatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
16727
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: ElderContinuatorComponent, isStandalone: true, selector: "elder-continuator", inputs: { loadedCount: { classPropertyName: "loadedCount", publicName: "loadedCount", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, canLoadMore: { classPropertyName: "canLoadMore", publicName: "canLoadMore", isSignal: true, isRequired: false, transformFunction: null }, chunkSizeOptions: { classPropertyName: "chunkSizeOptions", publicName: "chunkSizeOptions", isSignal: true, isRequired: false, transformFunction: null }, chunkSize: { classPropertyName: "chunkSize", publicName: "chunkSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { loadMoreRequested: "loadMoreRequested", chunkSizeChange: "chunkSizeChange" }, ngImport: i0, template: "<div class=\"layout-row place-end-center gap-md flex-none\">\n <mat-form-field class=\"elder-chunk-size-select\" subscriptSizing=\"dynamic\">\n <mat-select\n [value]=\"chunkSize()\"\n [placeholder]=\"chunkSize() + ''\"\n [disabled]=\"!canModifyChunkSize()\"\n (valueChange)=\"onChunkSizeChange($event)\"\n >\n @for (sizeOption of chunkSizeOptions(); track sizeOption) {\n <mat-option [value]=\"sizeOption\">{{ sizeOption }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <span class=\"mat-caption noselect loaded-info-text\"> {{ loadedCount() }} / {{ total() }} </span>\n\n <button\n mat-icon-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"!canLoadMore()\"\n (click)=\"loadMoreRequested.emit()\"\n >\n <mat-icon>keyboard_arrow_down</mat-icon>\n </button>\n</div>\n", styles: [".loaded-info-text{color:var(--md-sys-color-outline)}.elder-chunk-size-select.mat-mdc-form-field{width:84px;--mat-form-field-container-height: 36px;--mat-form-field-filled-label-display: none;--mat-form-field-container-vertical-padding: 6px;--mat-form-field-filled-with-label-container-padding-top: 6px;--mat-form-field-filled-with-label-container-padding-bottom: 6px}.elder-chunk-size-select.mat-mdc-form-field .mat-mdc-select{--mat-select-trigger-text-size: var( --mat-paginator-container-text-size, var(--mat-sys-body-small-size) )}\n"], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: MatOption$1, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
16782
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.1", type: ElderContinuatorComponent, isStandalone: true, selector: "elder-continuator", inputs: { loadedCount: { classPropertyName: "loadedCount", publicName: "loadedCount", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, canLoadMore: { classPropertyName: "canLoadMore", publicName: "canLoadMore", isSignal: true, isRequired: false, transformFunction: null }, chunkSizeOptions: { classPropertyName: "chunkSizeOptions", publicName: "chunkSizeOptions", isSignal: true, isRequired: false, transformFunction: null }, chunkSize: { classPropertyName: "chunkSize", publicName: "chunkSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { loadMoreRequested: "loadMoreRequested", chunkSizeChange: "chunkSizeChange" }, ngImport: i0, template: "<div class=\"layout-row place-end-center gap-md flex-none\">\n <mat-form-field class=\"elder-chunk-size-select\" subscriptSizing=\"dynamic\">\n <mat-select\n [value]=\"chunkSize()\"\n [placeholder]=\"chunkSize() + ''\"\n [disabled]=\"!canModifyChunkSize()\"\n (valueChange)=\"onChunkSizeChange($event)\"\n aria-label=\"Select chunk size\"\n >\n @for (sizeOption of chunkSizeOptions(); track sizeOption) {\n <mat-option [value]=\"sizeOption\">{{ sizeOption }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <span class=\"mat-caption noselect loaded-info-text\"> {{ loadedCount() }} / {{ total() }} </span>\n\n <button\n mat-icon-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"!canLoadMore()\"\n (click)=\"loadMoreRequested.emit()\"\n >\n <mat-icon>keyboard_arrow_down</mat-icon>\n </button>\n</div>\n", styles: [".loaded-info-text{color:var(--md-sys-color-outline)}.elder-chunk-size-select.mat-mdc-form-field{width:84px;--mat-form-field-container-height: 36px;--mat-form-field-filled-label-display: none;--mat-form-field-container-vertical-padding: 6px;--mat-form-field-filled-with-label-container-padding-top: 6px;--mat-form-field-filled-with-label-container-padding-bottom: 6px}.elder-chunk-size-select.mat-mdc-form-field .mat-mdc-select{--mat-select-trigger-text-size: var( --mat-paginator-container-text-size, var(--mat-sys-body-small-size) )}\n"], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: MatOption$1, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
16728
16783
  }
16729
16784
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImport: i0, type: ElderContinuatorComponent, decorators: [{
16730
16785
  type: Component,
16731
- args: [{ selector: 'elder-continuator', imports: [MatFormField, MatIcon, MatIconButton, MatSelect, MatOption$1], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"layout-row place-end-center gap-md flex-none\">\n <mat-form-field class=\"elder-chunk-size-select\" subscriptSizing=\"dynamic\">\n <mat-select\n [value]=\"chunkSize()\"\n [placeholder]=\"chunkSize() + ''\"\n [disabled]=\"!canModifyChunkSize()\"\n (valueChange)=\"onChunkSizeChange($event)\"\n >\n @for (sizeOption of chunkSizeOptions(); track sizeOption) {\n <mat-option [value]=\"sizeOption\">{{ sizeOption }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <span class=\"mat-caption noselect loaded-info-text\"> {{ loadedCount() }} / {{ total() }} </span>\n\n <button\n mat-icon-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"!canLoadMore()\"\n (click)=\"loadMoreRequested.emit()\"\n >\n <mat-icon>keyboard_arrow_down</mat-icon>\n </button>\n</div>\n", styles: [".loaded-info-text{color:var(--md-sys-color-outline)}.elder-chunk-size-select.mat-mdc-form-field{width:84px;--mat-form-field-container-height: 36px;--mat-form-field-filled-label-display: none;--mat-form-field-container-vertical-padding: 6px;--mat-form-field-filled-with-label-container-padding-top: 6px;--mat-form-field-filled-with-label-container-padding-bottom: 6px}.elder-chunk-size-select.mat-mdc-form-field .mat-mdc-select{--mat-select-trigger-text-size: var( --mat-paginator-container-text-size, var(--mat-sys-body-small-size) )}\n"] }]
16786
+ args: [{ selector: 'elder-continuator', imports: [MatFormField, MatIcon, MatIconButton, MatSelect, MatOption$1], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"layout-row place-end-center gap-md flex-none\">\n <mat-form-field class=\"elder-chunk-size-select\" subscriptSizing=\"dynamic\">\n <mat-select\n [value]=\"chunkSize()\"\n [placeholder]=\"chunkSize() + ''\"\n [disabled]=\"!canModifyChunkSize()\"\n (valueChange)=\"onChunkSizeChange($event)\"\n aria-label=\"Select chunk size\"\n >\n @for (sizeOption of chunkSizeOptions(); track sizeOption) {\n <mat-option [value]=\"sizeOption\">{{ sizeOption }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <span class=\"mat-caption noselect loaded-info-text\"> {{ loadedCount() }} / {{ total() }} </span>\n\n <button\n mat-icon-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"!canLoadMore()\"\n (click)=\"loadMoreRequested.emit()\"\n >\n <mat-icon>keyboard_arrow_down</mat-icon>\n </button>\n</div>\n", styles: [".loaded-info-text{color:var(--md-sys-color-outline)}.elder-chunk-size-select.mat-mdc-form-field{width:84px;--mat-form-field-container-height: 36px;--mat-form-field-filled-label-display: none;--mat-form-field-container-vertical-padding: 6px;--mat-form-field-filled-with-label-container-padding-top: 6px;--mat-form-field-filled-with-label-container-padding-bottom: 6px}.elder-chunk-size-select.mat-mdc-form-field .mat-mdc-select{--mat-select-trigger-text-size: var( --mat-paginator-container-text-size, var(--mat-sys-body-small-size) )}\n"] }]
16732
16787
  }] });
16733
16788
 
16734
16789
  class ElderTableRowDirective {