@elderbyte/ngx-starter 13.6.0 → 13.7.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.
@@ -31,4 +31,5 @@ export declare class CollectionUtil {
31
31
  * @param bSet
32
32
  */
33
33
  static equalSetDeep<T>(aSet: Set<T>, bSet: Set<T>): boolean;
34
+ static hasElements(list: any[]): boolean;
34
35
  }
@@ -1,7 +1,7 @@
1
1
  import { NgZone } from '@angular/core';
2
2
  import { ElderSelectBase } from '../elder-select-base';
3
3
  import { IDataContext } from '../../../common/data/data-context/data-context';
4
- import { Observable } from 'rxjs';
4
+ import { BehaviorSubject, Observable } from 'rxjs';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
7
7
  * Base component implementation of elder-multi-select.
@@ -12,15 +12,15 @@ import * as i0 from "@angular/core";
12
12
  * - The backing Value is a list of the current selected entities. T[]
13
13
  *
14
14
  */
15
- export declare abstract class ElderMultiSelectBase<TId, T> extends ElderSelectBase<TId, T, T[]> {
15
+ export declare abstract class ElderMultiSelectBase<TId, TEntity, TValue> extends ElderSelectBase<TId, TEntity, TValue[]> {
16
16
  /***************************************************************************
17
17
  * *
18
18
  * Fields *
19
19
  * *
20
20
  **************************************************************************/
21
21
  private readonly logger;
22
- private _valueIds;
23
- readonly valueIdsChange: Observable<TId[]>;
22
+ protected readonly entities$: BehaviorSubject<TEntity[]>;
23
+ readonly entityIdsChange: Observable<TId[]>;
24
24
  /***************************************************************************
25
25
  * *
26
26
  * Constructor *
@@ -32,28 +32,42 @@ export declare abstract class ElderMultiSelectBase<TId, T> extends ElderSelectBa
32
32
  * Properties *
33
33
  * *
34
34
  **************************************************************************/
35
- /**
36
- * Select the value with the given id.
37
- * @param ids
38
- */
39
- set valueIds(ids: TId[]);
40
- get valueIds(): TId[];
35
+ set entities(entities: TEntity[]);
36
+ get entities(): TEntity[];
37
+ set entityIds(ids: TId[]);
38
+ get entityIds(): TId[];
39
+ /***************************************************************************
40
+ * *
41
+ * Public API *
42
+ * *
43
+ **************************************************************************/
44
+ updateValueByEntities(entities: TEntity[]): void;
41
45
  /***************************************************************************
42
46
  * *
43
47
  * Internal Methods *
44
48
  * *
45
49
  **************************************************************************/
46
- protected onSuggestionsDcChanged(data: IDataContext<T>): void;
50
+ protected onSuggestionsDcChanged(data: IDataContext<TEntity>): void;
51
+ /**
52
+ * This method is invoked after a value has been written to this control.
53
+ *
54
+ */
55
+ protected writeToControl(value: TValue[]): void;
47
56
  /***************************************************************************
48
57
  * *
49
58
  * Private Methods *
50
59
  * *
51
60
  **************************************************************************/
52
- private getValueIds;
61
+ private entityIdsFromValues;
62
+ private entityIdFromValue;
63
+ private entitiesToValues;
64
+ private entityToValue;
65
+ private getEntityIds;
53
66
  private equalIds;
54
- private selectValuesByIds;
67
+ private equalEntities;
68
+ private selectEntitiesByIds;
55
69
  private loadEntityByIds;
56
70
  private findInDataContext;
57
- static ɵfac: i0.ɵɵFactoryDeclaration<ElderMultiSelectBase<any, any>, never>;
58
- static ɵdir: i0.ɵɵDirectiveDeclaration<ElderMultiSelectBase<any, any>, never, never, { "valueIds": "valueIds"; }, { "valueIdsChange": "valueIdsChange"; }, never>;
71
+ static ɵfac: i0.ɵɵFactoryDeclaration<ElderMultiSelectBase<any, any, any>, never>;
72
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ElderMultiSelectBase<any, any, any>, never, never, { "entities": "entities"; "entityIds": "entityIds"; }, { "entityIdsChange": "entityIdsChange"; }, never>;
59
73
  }
@@ -3,21 +3,21 @@ import { ElderMultiSelectBase } from '../elder-multi-select-base';
3
3
  import { Observable } from 'rxjs';
4
4
  import { ThemePalette } from '@angular/material/core/common-behaviors/color';
5
5
  import * as i0 from "@angular/core";
6
- declare class ValueChip<T> {
6
+ declare class SelectChip<T> {
7
7
  readonly value: T;
8
8
  readonly displayText: string;
9
9
  readonly color: ThemePalette;
10
10
  readonly removeable: boolean;
11
11
  constructor(value: T, displayText: string, color: ThemePalette, removeable: boolean);
12
12
  }
13
- export declare class ElderMultiSelectChipsComponent<TId, T> extends ElderMultiSelectBase<TId, T> implements OnInit {
13
+ export declare class ElderMultiSelectChipsComponent<TId = any, TEntity = any, TValue = any> extends ElderMultiSelectBase<TId, TEntity, TValue> implements OnInit {
14
14
  /***************************************************************************
15
15
  * *
16
16
  * Fields *
17
17
  * *
18
18
  **************************************************************************/
19
19
  private readonly log;
20
- readonly valuesWrapped$: Observable<ValueChip<T>[]>;
20
+ readonly selectChips$: Observable<SelectChip<TEntity>[]>;
21
21
  private readonly chipColorResolver$;
22
22
  selectable: boolean;
23
23
  allowRemove: boolean;
@@ -47,18 +47,18 @@ export declare class ElderMultiSelectChipsComponent<TId, T> extends ElderMultiSe
47
47
  * A function which returns the color of a given label object.
48
48
  */
49
49
  set chipColorResolver(fn: (o1: any) => ThemePalette);
50
- get isOptionDisabledInternalFn(): (option: T) => boolean;
51
- get isOptionHiddenInternalFn(): (option: T) => boolean;
50
+ get isOptionDisabledInternalFn(): (option: TEntity) => boolean;
51
+ get isOptionHiddenInternalFn(): (option: TEntity) => boolean;
52
52
  /***************************************************************************
53
53
  * *
54
54
  * Public API *
55
55
  * *
56
56
  **************************************************************************/
57
- onOptionSelected(selectedValue: T): void;
58
- addLabels(labels: T[]): void;
57
+ onOptionSelected(selectedValue: TEntity): void;
58
+ addLabels(labels: TEntity[]): void;
59
59
  addLabel(label: any): void;
60
- removeLabel(toRemove: T): void;
61
- replaceWith(labels: T[]): void;
60
+ removeLabel(toRemove: TEntity): void;
61
+ replaceWith(entities: TEntity[]): void;
62
62
  /***************************************************************************
63
63
  * *
64
64
  * Private methods *
@@ -66,7 +66,7 @@ export declare class ElderMultiSelectChipsComponent<TId, T> extends ElderMultiSe
66
66
  **************************************************************************/
67
67
  private isAlreadyPresent;
68
68
  private resetInput;
69
- static ɵfac: i0.ɵɵFactoryDeclaration<ElderMultiSelectChipsComponent<any, any>, never>;
70
- static ɵcmp: i0.ɵɵComponentDeclaration<ElderMultiSelectChipsComponent<any, any>, "elder-multi-select-chips", never, { "allowRemove": "allowRemove"; "chipTemplate": "chipTemplate"; "chipColorResolver": "chipColorResolver"; }, {}, ["chipTemplateQuery"], never>;
69
+ static ɵfac: i0.ɵɵFactoryDeclaration<ElderMultiSelectChipsComponent<any, any, any>, never>;
70
+ static ɵcmp: i0.ɵɵComponentDeclaration<ElderMultiSelectChipsComponent<any, any, any>, "elder-multi-select-chips", never, { "allowRemove": "allowRemove"; "chipTemplate": "chipTemplate"; "chipColorResolver": "chipColorResolver"; }, {}, ["chipTemplateQuery"], never>;
71
71
  }
72
72
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elderbyte/ngx-starter",
3
- "version": "13.6.0",
3
+ "version": "13.7.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^13.0.0",
6
6
  "@angular/core": "^13.0.0",