@elderbyte/ngx-starter 14.2.3 → 14.3.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.
@@ -1,4 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
+ export declare type KeyGetterFn<T> = ((item: T) => any);
2
3
  /**
3
4
  * Provides a model of a selection.
4
5
  * Supports single and multi selection.
@@ -15,8 +16,9 @@ export declare class SelectionModel<T> {
15
16
  private _multiple;
16
17
  private readonly _selectionMap;
17
18
  private readonly _selection;
18
- private readonly _keyGetterFn;
19
+ private _keyGetterFn;
19
20
  private _selectableEvaluatorFn;
21
+ static readonly FallbackKeyGetterFn: (a: any) => any;
20
22
  /***************************************************************************
21
23
  * *
22
24
  * Constructor *
@@ -30,7 +32,7 @@ export declare class SelectionModel<T> {
30
32
  * @param keyGetter value identity - default to value object equality
31
33
  * @param selectableEvaluatorFn function to evaluate if the element in question is selectable
32
34
  */
33
- constructor(multiple?: boolean, initial?: T[], keyGetter?: ((item: T) => any), selectableEvaluatorFn?: ((item: T) => boolean));
35
+ constructor(multiple?: boolean, initial?: T[], keyGetter?: KeyGetterFn<T>, selectableEvaluatorFn?: ((item: T) => boolean));
34
36
  /***************************************************************************
35
37
  * *
36
38
  * Properties *
@@ -40,6 +42,7 @@ export declare class SelectionModel<T> {
40
42
  get selection(): Observable<T[]>;
41
43
  get selectionSnapshot(): T[];
42
44
  set selectableEvaluatorFn(fn: (item: T) => boolean);
45
+ set keyGetterFn(fn: KeyGetterFn<T>);
43
46
  /***************************************************************************
44
47
  * *
45
48
  * Public API *
@@ -36,6 +36,7 @@ export declare class ElderDataViewBaseComponent implements IElderDataView {
36
36
  */
37
37
  private _embedded;
38
38
  private readonly _itemClickSubject;
39
+ private readonly EntityIdKeyFn;
39
40
  /***************************************************************************
40
41
  * *
41
42
  * Constructor *
@@ -1,7 +1,7 @@
1
1
  import { OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
2
2
  import { MatDialog } from '@angular/material/dialog';
3
3
  import { Observable } from 'rxjs';
4
- import { SelectionModel } from '../../../common/selection/selection-model';
4
+ import { KeyGetterFn, SelectionModel } from '../../../common/selection/selection-model';
5
5
  import { Sort } from '../../../common/data/sort';
6
6
  import { Filter } from '../../../common/data/filter';
7
7
  import * as i0 from "@angular/core";
@@ -21,6 +21,7 @@ export declare class SelectionModelPopupDirective implements OnInit, OnDestroy {
21
21
  private readonly viewContainer;
22
22
  private readonly dialog;
23
23
  private readonly dataViewSelectionMode;
24
+ private readonly selectionModel;
24
25
  /***************************************************************************
25
26
  * *
26
27
  * Fields *
@@ -34,7 +35,7 @@ export declare class SelectionModelPopupDirective implements OnInit, OnDestroy {
34
35
  * Constructor *
35
36
  * *
36
37
  **************************************************************************/
37
- constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, dialog: MatDialog, dataViewSelectionMode: ElderDataViewSelectionMode);
38
+ constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, dialog: MatDialog, dataViewSelectionMode: ElderDataViewSelectionMode, selectionModel: SelectionModel<any>);
38
39
  /***************************************************************************
39
40
  * *
40
41
  * Host Listeners *
@@ -55,7 +56,7 @@ export declare class SelectionModelPopupDirective implements OnInit, OnDestroy {
55
56
  /**
56
57
  * Let the user choose some entities and return the selection.
57
58
  */
58
- choose(filters?: Filter[], sorts?: Sort[], multi?: boolean): Observable<any[]>;
59
+ choose(keyGetter: KeyGetterFn<any>, currentSelection: any[], filters?: Filter[], sorts?: Sort[], multi?: boolean): Observable<any[]>;
59
60
  /***************************************************************************
60
61
  * *
61
62
  * Private methods *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elderbyte/ngx-starter",
3
- "version": "14.2.3",
3
+ "version": "14.3.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.0.1",
6
6
  "@angular/core": "^14.0.1",