@elderbyte/ngx-starter 17.10.0 → 17.11.0-beta

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.
Files changed (69) hide show
  1. package/esm2022/lib/common/data/datasource/data-source-base.mjs +1 -1
  2. package/esm2022/lib/common/data/datasource/rest/rest-client.mjs +1 -1
  3. package/esm2022/lib/common/data/filters/filter-commons.mjs +23 -0
  4. package/esm2022/lib/common/data/filters/filter-value.mjs +2 -0
  5. package/esm2022/lib/components/badge/elder-badge.directive.mjs +41 -19
  6. package/esm2022/lib/components/forms/directives/elder-initial-value.directive.mjs +8 -5
  7. package/esm2022/lib/components/forms/search/domain/input/input-value.mjs +2 -0
  8. package/esm2022/lib/components/forms/search/domain/input/search-input-state.mjs +15 -6
  9. package/esm2022/lib/components/forms/search/domain/input/search-input.mjs +1 -1
  10. package/esm2022/lib/components/forms/search/elder-search-context.directive.mjs +36 -25
  11. package/esm2022/lib/components/forms/search/elder-search-input.directive.mjs +55 -15
  12. package/esm2022/lib/components/forms/search/filter/default-input-converter.mjs +32 -0
  13. package/esm2022/lib/components/forms/search/filter/include-exclude-input-converter.mjs +165 -0
  14. package/esm2022/lib/components/forms/search/filter/input-converter.mjs +2 -0
  15. package/esm2022/lib/components/forms/search/search-box/elder-search-box.component.mjs +1 -1
  16. package/esm2022/lib/components/input/autocomplete/elder-autocomplete/elder-autocomplete-option-selected.mjs +1 -1
  17. package/esm2022/lib/components/input/autocomplete/elder-autocomplete/elder-suggestion-panel.component.mjs +231 -0
  18. package/esm2022/lib/components/input/autocomplete/elder-autocomplete-many.directive.mjs +1 -1
  19. package/esm2022/lib/components/input/autocomplete/elder-autocomplete.directive.mjs +4 -1
  20. package/esm2022/lib/components/input/autocomplete/elder-autocomplete.module.mjs +8 -8
  21. package/esm2022/lib/components/select/auto/elder-auto-select-first.directive.mjs +26 -6
  22. package/esm2022/lib/components/select/auto/elder-auto-select-first.service.mjs +38 -0
  23. package/esm2022/lib/components/select/auto/elder-auto-select-suggest-first.directive.mjs +66 -0
  24. package/esm2022/lib/components/select/auto/elder-select-first-util.mjs +4 -14
  25. package/esm2022/lib/components/select/elder-select-base.mjs +6 -6
  26. package/esm2022/lib/components/select/elder-select.module.mjs +31 -6
  27. package/esm2022/lib/components/select/filter/elder-chip-filter-style-resolver.mjs +70 -0
  28. package/esm2022/lib/components/select/filter/elder-chips-filter.directive.mjs +174 -0
  29. package/esm2022/lib/components/select/filter/elder-filter-chip-template/elder-filter-chip-template.component.mjs +58 -0
  30. package/esm2022/lib/components/select/multi/elder-multi-select-chip-options/elder-multi-select-chip-options.component.mjs +12 -5
  31. package/esm2022/lib/components/select/multi/elder-multi-select-chips/elder-multi-select-chips.component.mjs +7 -3
  32. package/esm2022/lib/components/select/multi/elder-search-include-exclude.directive.mjs +83 -0
  33. package/esm2022/lib/components/select/single/elder-select/elder-select.component.mjs +6 -11
  34. package/fesm2022/elderbyte-ngx-starter.mjs +4521 -3692
  35. package/fesm2022/elderbyte-ngx-starter.mjs.map +1 -1
  36. package/lib/common/data/filters/filter-commons.d.ts +12 -0
  37. package/lib/common/data/filters/filter-value.d.ts +1 -0
  38. package/lib/components/badge/elder-badge.directive.d.ts +10 -1
  39. package/lib/components/forms/directives/elder-initial-value.directive.d.ts +4 -2
  40. package/lib/components/forms/search/domain/input/input-value.d.ts +1 -0
  41. package/lib/components/forms/search/domain/input/search-input-state.d.ts +14 -4
  42. package/lib/components/forms/search/domain/input/search-input.d.ts +6 -1
  43. package/lib/components/forms/search/elder-search-context.directive.d.ts +7 -2
  44. package/lib/components/forms/search/elder-search-input.directive.d.ts +23 -7
  45. package/lib/components/forms/search/filter/default-input-converter.d.ts +20 -0
  46. package/lib/components/forms/search/filter/include-exclude-input-converter.d.ts +78 -0
  47. package/lib/components/forms/search/filter/input-converter.d.ts +7 -0
  48. package/lib/components/input/autocomplete/elder-autocomplete/elder-autocomplete-option-selected.d.ts +3 -3
  49. package/lib/components/input/autocomplete/elder-autocomplete/{elder-autocomplete.component.d.ts → elder-suggestion-panel.component.d.ts} +17 -6
  50. package/lib/components/input/autocomplete/elder-autocomplete-many.directive.d.ts +3 -3
  51. package/lib/components/input/autocomplete/elder-autocomplete.directive.d.ts +3 -3
  52. package/lib/components/input/autocomplete/elder-autocomplete.module.d.ts +3 -3
  53. package/lib/components/select/auto/elder-auto-select-first.directive.d.ts +9 -1
  54. package/lib/components/select/auto/elder-auto-select-first.service.d.ts +23 -0
  55. package/lib/components/select/auto/elder-auto-select-suggest-first.directive.d.ts +32 -0
  56. package/lib/components/select/auto/elder-select-first-util.d.ts +2 -2
  57. package/lib/components/select/elder-select-base.d.ts +1 -1
  58. package/lib/components/select/elder-select.module.d.ts +9 -1
  59. package/lib/components/select/filter/elder-chip-filter-style-resolver.d.ts +19 -0
  60. package/lib/components/select/filter/elder-chips-filter.directive.d.ts +68 -0
  61. package/lib/components/select/filter/elder-filter-chip-template/elder-filter-chip-template.component.d.ts +32 -0
  62. package/lib/components/select/multi/elder-multi-select-chip-options/elder-multi-select-chip-options.component.d.ts +5 -1
  63. package/lib/components/select/multi/elder-search-include-exclude.directive.d.ts +39 -0
  64. package/lib/components/select/single/elder-select/elder-select.component.d.ts +0 -1
  65. package/package.json +1 -1
  66. package/src/lib/components/select/filter/elder-filter-chip-template/elder-filter-chip-template.component.scss +95 -0
  67. package/src/lib/components/select/multi/elder-select-include-exclude-chip/elder-select-include-exclude-chip.component.scss +0 -0
  68. package/esm2022/lib/components/input/autocomplete/elder-autocomplete/elder-autocomplete.component.mjs +0 -186
  69. /package/src/lib/components/input/autocomplete/elder-autocomplete/{elder-autocomplete.component.scss → elder-suggestion-panel.component.scss} +0 -0
@@ -0,0 +1,12 @@
1
+ import { FilterValue } from './filter-value';
2
+ /***************************************************************************
3
+ * *
4
+ * Common functions *
5
+ * *
6
+ **************************************************************************/
7
+ export default class FilterCommons {
8
+ static isArrayAndNotEmpty(value: FilterValue): boolean;
9
+ static isArray(value: FilterValue): boolean;
10
+ static isNotEmptyArray(value: FilterValue): boolean;
11
+ static getValuesIfArrayElseEmpty(value: FilterValue): string[];
12
+ }
@@ -0,0 +1 @@
1
+ export type FilterValue = string | string[] | null;
@@ -1,4 +1,4 @@
1
- import { ViewContainerRef, OnInit, DestroyRef } from '@angular/core';
1
+ import { DestroyRef, OnInit, ViewContainerRef } from '@angular/core';
2
2
  import { BadgeAvatarSpec, BadgeColorSpec } from './elder-badge/elder-badge.component';
3
3
  import { DomSanitizer, SafeStyle } from '@angular/platform-browser';
4
4
  import { MatBadge } from '@angular/material/badge';
@@ -14,6 +14,7 @@ export declare class ElderBadgeDirective implements OnInit {
14
14
  * Fields *
15
15
  * *
16
16
  **************************************************************************/
17
+ private readonly log;
17
18
  private readonly value$;
18
19
  private readonly colorSpec$;
19
20
  private readonly avatarSpec$;
@@ -45,6 +46,14 @@ export declare class ElderBadgeDirective implements OnInit {
45
46
  set elderBadge(value: any);
46
47
  set colorSpec(spec: BadgeColorSpec);
47
48
  set avatarSpec(spec: BadgeAvatarSpec);
49
+ /***************************************************************************
50
+ * *
51
+ * Private methods *
52
+ * *
53
+ **************************************************************************/
54
+ private bindToElderBadge;
55
+ private replaceMatBadgeWithElderBadge;
56
+ private createElderBadgeComponent;
48
57
  static ɵfac: i0.ɵɵFactoryDeclaration<ElderBadgeDirective, never>;
49
58
  static ɵdir: i0.ɵɵDirectiveDeclaration<ElderBadgeDirective, "[elderBadge]", never, { "badgeColor": { "alias": "badgeColor"; "required": false; }; "badgeIcon": { "alias": "badgeIcon"; "required": false; }; "elderBadge": { "alias": "elderBadge"; "required": false; }; "colorSpec": { "alias": "colorSpec"; "required": false; }; "avatarSpec": { "alias": "avatarSpec"; "required": false; }; }, {}, never, never, true, never>;
50
59
  }
@@ -1,5 +1,6 @@
1
1
  import { OnDestroy } from '@angular/core';
2
2
  import { NgModel } from '@angular/forms';
3
+ import { Observable } from 'rxjs';
3
4
  import * as i0 from "@angular/core";
4
5
  /**
5
6
  * Search name adapter for input controls.
@@ -14,7 +15,7 @@ export declare class ElderInitialValueDirective implements OnDestroy {
14
15
  private readonly log;
15
16
  private initialValue$;
16
17
  private readonly destroy$;
17
- private readonly initialDone$;
18
+ private readonly _initialDone$;
18
19
  /***************************************************************************
19
20
  * *
20
21
  * Constructor *
@@ -31,7 +32,8 @@ export declare class ElderInitialValueDirective implements OnDestroy {
31
32
  * Properties *
32
33
  * *
33
34
  **************************************************************************/
34
- get valueChanges$(): import("rxjs").Observable<any>;
35
+ get initialDone$(): Observable<void>;
36
+ get valueChanges$(): Observable<any>;
35
37
  setValue(value: any): void;
36
38
  ngOnDestroy(): void;
37
39
  static ɵfac: i0.ɵɵFactoryDeclaration<ElderInitialValueDirective, [{ host: true; }]>;
@@ -0,0 +1 @@
1
+ export type InputValue = string[] | string | null;
@@ -1,3 +1,4 @@
1
+ import { Filter } from '../../../../../common/data/filters/filter';
1
2
  /**
2
3
  * Immutable representation of the state of an search input
3
4
  */
@@ -6,14 +7,18 @@ export declare class SearchInputState {
6
7
  * attribute The name name
7
8
  */
8
9
  readonly attribute: string;
10
+ /**
11
+ * queryKey The query key
12
+ */
13
+ readonly queryKey: string;
9
14
  /**
10
15
  * queryValue The query value as string. Supports multi string value.
11
16
  */
12
17
  readonly queryValue: string | string[] | null;
13
18
  /**
14
- * queryKey The query key
19
+ * value of the input
15
20
  */
16
- readonly queryKey: string;
21
+ readonly filters: Filter[];
17
22
  /**
18
23
  * pristine Has the user touched this?
19
24
  */
@@ -22,6 +27,7 @@ export declare class SearchInputState {
22
27
  * Was the input changed by a user interaction
23
28
  */
24
29
  readonly userEvent: boolean;
30
+ static of(attribute: string, queryKey: string, queryValue: string | string[] | null, filters: Filter[], pristine: boolean, userEvent: boolean): SearchInputState;
25
31
  static unknown(): SearchInputState;
26
32
  /***************************************************************************
27
33
  * *
@@ -33,14 +39,18 @@ export declare class SearchInputState {
33
39
  * attribute The name name
34
40
  */
35
41
  attribute: string,
42
+ /**
43
+ * queryKey The query key
44
+ */
45
+ queryKey: string,
36
46
  /**
37
47
  * queryValue The query value as string. Supports multi string value.
38
48
  */
39
49
  queryValue: string | string[] | null,
40
50
  /**
41
- * queryKey The query key
51
+ * value of the input
42
52
  */
43
- queryKey: string,
53
+ filters: Filter[],
44
54
  /**
45
55
  * pristine Has the user touched this?
46
56
  */
@@ -1,5 +1,6 @@
1
1
  import { Observable } from 'rxjs/internal/Observable';
2
2
  import { SearchInputState } from './search-input-state';
3
+ import { Filter } from '../../../../../common/data/filters/filter';
3
4
  /**
4
5
  * Represents a single search control.
5
6
  */
@@ -8,6 +9,10 @@ export interface SearchInput {
8
9
  * The search input name
9
10
  */
10
11
  readonly name: string;
12
+ /**
13
+ * The search input name query key
14
+ */
15
+ readonly queryKey?: string;
11
16
  readonly state$: Observable<SearchInputState>;
12
17
  /**
13
18
  * States if the search name is cannot be changed.
@@ -17,5 +22,5 @@ export interface SearchInput {
17
22
  * Reset the name value
18
23
  */
19
24
  reset(): void;
20
- setValue(value: string | string[] | null): void;
25
+ applyFilters(filters: Filter[]): void;
21
26
  }
@@ -22,12 +22,13 @@ export declare class ElderSearchContextDirective implements OnInit, AfterViewIni
22
22
  * *
23
23
  **************************************************************************/
24
24
  private readonly log;
25
- private readonly filtersToApplyAtRegistration;
25
+ private readonly initialFilters;
26
+ private initialFiltersRegistered;
26
27
  private readonly _searchInputs$;
27
28
  private readonly _searchStates$;
28
29
  private readonly _filterContext$;
29
30
  private readonly _searchContext$;
30
- private readonly searchContextId$;
31
+ private readonly _searchContextId$;
31
32
  /***************************************************************************
32
33
  * *
33
34
  * Constructor *
@@ -48,6 +49,7 @@ export declare class ElderSearchContextDirective implements OnInit, AfterViewIni
48
49
  **************************************************************************/
49
50
  set searchContextId(contextId: string);
50
51
  get searchContextId(): string;
52
+ get searchContextId$(): Observable<string>;
51
53
  get searchContext$(): Observable<SearchContext>;
52
54
  get searchContext(): SearchContext;
53
55
  set filterContext(value: FilterContext | '');
@@ -83,6 +85,7 @@ export declare class ElderSearchContextDirective implements OnInit, AfterViewIni
83
85
  * Private *
84
86
  * *
85
87
  **************************************************************************/
88
+ searchInputs(): SearchInput[];
86
89
  private applyDefaultFiltersToSearchContext;
87
90
  private applyAsDefaultsUntilUserAction;
88
91
  private syncSearchInputsToSearchContext;
@@ -90,6 +93,8 @@ export declare class ElderSearchContextDirective implements OnInit, AfterViewIni
90
93
  private applyToBoundFilterContext;
91
94
  private applySearchContextToInputs;
92
95
  private applyFiltersToInputs;
96
+ private saveInitialFitlers;
97
+ private buildFilterValueMap;
93
98
  private searchInputsByName;
94
99
  private convertToFilters;
95
100
  static ɵfac: i0.ɵɵFactoryDeclaration<ElderSearchContextDirective, never>;
@@ -6,6 +6,8 @@ import { SearchInput } from './domain/input/search-input';
6
6
  import { SearchInputState } from './domain/input/search-input-state';
7
7
  import { LocalPagedDataSource } from '../../../common/data/datasource/local/local-paged-data-source';
8
8
  import { BooleanInput } from '@angular/cdk/coercion';
9
+ import { InputConverter } from './filter/input-converter';
10
+ import { Filter } from '../../../common/data/filters/filter';
9
11
  import * as i0 from "@angular/core";
10
12
  /**
11
13
  * Search name adapter for input controls.
@@ -13,16 +15,13 @@ import * as i0 from "@angular/core";
13
15
  export declare class ElderSearchInputDirective implements SearchInput, OnInit, AfterViewInit, OnDestroy {
14
16
  private searchContext;
15
17
  private ngModel;
16
- private readonly initialValueDirective;
18
+ private readonly _initialValueDirective;
17
19
  /***************************************************************************
18
20
  * *
19
21
  * Fields *
20
22
  * *
21
23
  **************************************************************************/
22
- /**
23
- * (Optional) Usually the control name is used, this allows a custom query key
24
- */
25
- queryKey: string;
24
+ private _queryKey$;
26
25
  /**
27
26
  * (Optional) Function which transforms the value object to a query param value
28
27
  */
@@ -38,10 +37,24 @@ export declare class ElderSearchInputDirective implements SearchInput, OnInit, A
38
37
  */
39
38
  fallbackValue: string | string[];
40
39
  valueAsId: BooleanInput;
40
+ private _inputConverter;
41
41
  private readonly _state$;
42
+ private readonly _name$;
42
43
  private _extractedName;
43
44
  private readonly destroy$;
44
45
  private readonly log;
46
+ /***************************************************************************
47
+ * *
48
+ * Properties *
49
+ * *
50
+ **************************************************************************/
51
+ /**
52
+ * (Optional) Usually the control name is used, this allows a custom query key
53
+ */
54
+ set queryKey(value: string);
55
+ get queryKey(): string;
56
+ get queryKey$(): Observable<string>;
57
+ set filterSplitterMeger(inputConverter: InputConverter);
45
58
  /***************************************************************************
46
59
  * *
47
60
  * Constructor *
@@ -61,8 +74,10 @@ export declare class ElderSearchInputDirective implements SearchInput, OnInit, A
61
74
  * Properties *
62
75
  * *
63
76
  **************************************************************************/
77
+ get initialDone$(): Observable<void>;
64
78
  get state$(): Observable<SearchInputState>;
65
79
  get name(): string;
80
+ get name$(): Observable<string>;
66
81
  get value(): any;
67
82
  get readonly(): boolean;
68
83
  private get hasFallback();
@@ -71,13 +86,14 @@ export declare class ElderSearchInputDirective implements SearchInput, OnInit, A
71
86
  * Public API *
72
87
  * *
73
88
  **************************************************************************/
74
- setValue(queryString: string | string[] | null): void;
89
+ applyFilters(filters: Filter[]): void;
75
90
  reset(): void;
76
91
  /***************************************************************************
77
92
  * *
78
93
  * Private methods *
79
94
  * *
80
95
  **************************************************************************/
96
+ private setInputValue;
81
97
  private get valueChanges$();
82
98
  private buildInputStateObservable;
83
99
  private buildInputState;
@@ -92,5 +108,5 @@ export declare class ElderSearchInputDirective implements SearchInput, OnInit, A
92
108
  private extractName;
93
109
  private concatIfNecessary;
94
110
  static ɵfac: i0.ɵɵFactoryDeclaration<ElderSearchInputDirective, [null, { host: true; }]>;
95
- static ɵdir: i0.ɵɵDirectiveDeclaration<ElderSearchInputDirective, "[elderSearchInput]", ["elderSearchInput"], { "queryKey": { "alias": "elderSearchInputKey"; "required": false; }; "valueTransform": { "alias": "elderSearchInputTransform"; "required": false; }; "resolvePath": { "alias": "elderSearchInput"; "required": false; }; "dataSource": { "alias": "dataSource"; "required": false; }; "fallbackValue": { "alias": "elderSearchInputFallback"; "required": false; }; "valueAsId": { "alias": "valueAsId"; "required": false; }; }, {}, never, never, true, never>;
111
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ElderSearchInputDirective, "[elderSearchInput]", ["elderSearchInput"], { "valueTransform": { "alias": "elderSearchInputTransform"; "required": false; }; "resolvePath": { "alias": "elderSearchInput"; "required": false; }; "dataSource": { "alias": "dataSource"; "required": false; }; "fallbackValue": { "alias": "elderSearchInputFallback"; "required": false; }; "valueAsId": { "alias": "valueAsId"; "required": false; }; "queryKey": { "alias": "elderSearchInputKey"; "required": false; }; }, {}, never, never, true, never>;
96
112
  }
@@ -0,0 +1,20 @@
1
+ import { InputConverter } from './input-converter';
2
+ import { InputValue } from '../domain/input/input-value';
3
+ import { Filter } from '../../../../common/data/filters/filter';
4
+ export default class DefaultInputConverter implements InputConverter {
5
+ readonly queryKey: string;
6
+ /***************************************************************************
7
+ * *
8
+ * Static Builders *
9
+ * *
10
+ **************************************************************************/
11
+ static of(queryKey: string): DefaultInputConverter;
12
+ /***************************************************************************
13
+ * *
14
+ * Constructors *
15
+ * *
16
+ **************************************************************************/
17
+ private constructor();
18
+ convertToFilters(inputValue: InputValue): Filter[];
19
+ convertToValue(filters: Filter[]): InputValue;
20
+ }
@@ -0,0 +1,78 @@
1
+ import { InputConverter } from './input-converter';
2
+ import { Filter } from '../../../../common/data/filters/filter';
3
+ import { InputValue } from '../domain/input/input-value';
4
+ import { Observable } from 'rxjs';
5
+ import { ElderChipFilterEntity } from '../../../select/filter/elder-chips-filter.directive';
6
+ export default class IncludeExcludeInputConverter implements InputConverter {
7
+ readonly queryKey: string;
8
+ private includeSuffix;
9
+ private excludeSuffix;
10
+ /***************************************************************************
11
+ * *
12
+ * Fields *
13
+ * *
14
+ **************************************************************************/
15
+ private readonly selections$;
16
+ private readonly _mergedSelections$;
17
+ /***************************************************************************
18
+ * *
19
+ * Static Builders *
20
+ * *
21
+ **************************************************************************/
22
+ static from(queryKey: string, includeSuffix: string, excludeSuffix: string): IncludeExcludeInputConverter;
23
+ /***************************************************************************
24
+ * *
25
+ * Constructors *
26
+ * *
27
+ **************************************************************************/
28
+ private constructor();
29
+ /***************************************************************************
30
+ * *
31
+ * Public API *
32
+ * *
33
+ **************************************************************************/
34
+ convertToValue(filters: Filter[]): InputValue;
35
+ convertToFilters(inputValue: InputValue): Filter[];
36
+ /***************************************************************************
37
+ * *
38
+ * Properties *
39
+ * *
40
+ **************************************************************************/
41
+ set selection(selection: Map<string, ElderChipFilterEntity>);
42
+ get mergedSelections$(): Observable<Map<string, ElderChipFilterEntity>>;
43
+ get includeQueryKey(): string;
44
+ get excludeQueryKey(): string;
45
+ /***************************************************************************
46
+ * *
47
+ * Private Methods *
48
+ * *
49
+ **************************************************************************/
50
+ private findValueOrDefault;
51
+ private convertFiltersToMap;
52
+ private flattenFilterValues;
53
+ private replaceEmptyArrayWithNull;
54
+ private validateArrayAndReturn;
55
+ private isIncluded;
56
+ private isExcluded;
57
+ private addAllSelections;
58
+ /***************************************************************************
59
+ * *
60
+ * Split *
61
+ * *
62
+ **************************************************************************/
63
+ /**
64
+ * If the filter before split is an empty array, include will be set to empty and exclude to null
65
+ * Else, an empty array will always be set to null
66
+ */
67
+ private buildFilters;
68
+ private buildSplitIncludeValues;
69
+ private buildSplitExcludeValues;
70
+ /***************************************************************************
71
+ * *
72
+ * Merge *
73
+ * *
74
+ **************************************************************************/
75
+ private mergeValues;
76
+ private buildMergeIncludeValues;
77
+ private buildMergeExcludeValues;
78
+ }
@@ -0,0 +1,7 @@
1
+ import { Filter } from '../../../../common/data/filters/filter';
2
+ import { InputValue } from '../domain/input/input-value';
3
+ export interface InputConverter {
4
+ queryKey: string;
5
+ convertToFilters(inputValue: InputValue): Filter[];
6
+ convertToValue(filter: Filter[]): InputValue;
7
+ }
@@ -1,8 +1,8 @@
1
- import { ElderAutocompleteComponent } from './elder-autocomplete.component';
1
+ import { ElderSuggestionPanelComponent } from './elder-suggestion-panel.component';
2
2
  export declare class ElderAutocompleteOptionSelected<T = any, TId = any> {
3
- readonly source: ElderAutocompleteComponent<T, TId>;
3
+ readonly source: ElderSuggestionPanelComponent<T, TId>;
4
4
  readonly entityId: TId;
5
5
  readonly entity: T;
6
6
  readonly optionValue: any;
7
- constructor(source: ElderAutocompleteComponent<T, TId>, entityId: TId, entity: T, optionValue: any);
7
+ constructor(source: ElderSuggestionPanelComponent<T, TId>, entityId: TId, entity: T, optionValue: any);
8
8
  }
@@ -1,19 +1,23 @@
1
- import { NgZone, TemplateRef } from '@angular/core';
1
+ import { DestroyRef, NgZone, TemplateRef } from '@angular/core';
2
2
  import { BehaviorSubject, Observable, Subject } from 'rxjs';
3
3
  import { IDataContext } from '../../../../common/data/data-context/data-context';
4
+ import { BooleanInput } from '@angular/cdk/coercion';
4
5
  import { DataContextStatus } from '../../../../common/data/data-context/data-context-status';
5
6
  import { MatAutocomplete, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
6
7
  import { ElderAutocompleteOptionSelected } from './elder-autocomplete-option-selected';
8
+ import { IDataSource } from '../../../../common/data/datasource/data-source';
7
9
  import * as i0 from "@angular/core";
8
10
  type TextResolverFn = (value: any) => string;
9
- export declare class ElderAutocompleteComponent<T = any, TId = any> {
11
+ export declare class ElderSuggestionPanelComponent<T = any, TId = any> {
10
12
  private readonly zone;
13
+ private destroyRef;
11
14
  /***************************************************************************
12
15
  * *
13
16
  * Fields *
14
17
  * *
15
18
  **************************************************************************/
16
19
  private readonly logger;
20
+ private readonly PAGE_SIZE;
17
21
  /**
18
22
  * Is this auto-complete enabled?
19
23
  */
@@ -35,28 +39,32 @@ export declare class ElderAutocompleteComponent<T = any, TId = any> {
35
39
  * The DataContext which holds the autocomplete suggestions.
36
40
  */
37
41
  readonly dataContext$: BehaviorSubject<IDataContext<T>>;
42
+ readonly dataSource$: BehaviorSubject<IDataSource<T>>;
38
43
  readonly triggerReload$: Subject<any>;
39
44
  readonly displayPropertyResolver$: BehaviorSubject<TextResolverFn>;
40
45
  readonly dataState$: Observable<DataContextStatus>;
41
46
  readonly availableSuggestions$: Observable<T[]>;
42
47
  readonly optionSelected: Subject<ElderAutocompleteOptionSelected<any, any>>;
48
+ private readonly hiddenOptionsCount$;
43
49
  /***************************************************************************
44
50
  * *
45
51
  * Constructor *
46
52
  * *
47
53
  **************************************************************************/
48
- constructor(zone: NgZone);
54
+ constructor(zone: NgZone, destroyRef: DestroyRef);
49
55
  /***************************************************************************
50
56
  * *
51
57
  * Properties *
52
58
  * *
53
59
  **************************************************************************/
54
- set enabled(value: boolean);
60
+ set enabled(value: BooleanInput);
55
61
  get enabled(): boolean;
56
62
  set valueTemplate(template: TemplateRef<any>);
57
63
  get valueTemplate(): TemplateRef<any>;
58
64
  set dataContext(data: IDataContext<T>);
59
65
  get dataContext(): IDataContext<T>;
66
+ set dataSource(dataSource: IDataSource<T>);
67
+ get dataSource(): IDataSource<T>;
60
68
  set displayPropertyResolver(resolver: TextResolverFn);
61
69
  /***************************************************************************
62
70
  * *
@@ -71,6 +79,7 @@ export declare class ElderAutocompleteComponent<T = any, TId = any> {
71
79
  getId(value: T): TId;
72
80
  isOptionAvailable(option: T): boolean;
73
81
  isOptionVisible(option: T): boolean;
82
+ isOptionHidden(option: T): boolean;
74
83
  toOptionValue(option: T): any;
75
84
  /***************************************************************************
76
85
  * *
@@ -81,7 +90,9 @@ export declare class ElderAutocompleteComponent<T = any, TId = any> {
81
90
  * TODO Duplicate in elder-select
82
91
  */
83
92
  private propertyStringValue;
84
- static ɵfac: i0.ɵɵFactoryDeclaration<ElderAutocompleteComponent<any, any>, never>;
85
- static ɵcmp: i0.ɵɵComponentDeclaration<ElderAutocompleteComponent<any, any>, "elder-autocomplete", ["elderAutocomplete"], { "isOptionDisabledFn": { "alias": "isOptionDisabledFn"; "required": false; }; "isOptionHiddenFn": { "alias": "isOptionHiddenFn"; "required": false; }; "optionValueConverterFn": { "alias": "optionValueConverterFn"; "required": false; }; "enabled": { "alias": "enabled"; "required": false; }; "valueTemplate": { "alias": "valueTemplate"; "required": false; }; "dataContext": { "alias": "dataContext"; "required": false; }; "displayPropertyResolver": { "alias": "displayPropertyResolver"; "required": false; }; }, { "optionSelected": "optionSelected"; }, ["valueTemplateQuery"], never, true, never>;
93
+ private buildDataContextWithPageSize;
94
+ private calculatePageSize;
95
+ static ɵfac: i0.ɵɵFactoryDeclaration<ElderSuggestionPanelComponent<any, any>, never>;
96
+ static ɵcmp: i0.ɵɵComponentDeclaration<ElderSuggestionPanelComponent<any, any>, "elder-suggestion-panel", ["elderSuggestionPanel"], { "isOptionDisabledFn": { "alias": "isOptionDisabledFn"; "required": false; }; "isOptionHiddenFn": { "alias": "isOptionHiddenFn"; "required": false; }; "optionValueConverterFn": { "alias": "optionValueConverterFn"; "required": false; }; "enabled": { "alias": "enabled"; "required": false; }; "valueTemplate": { "alias": "valueTemplate"; "required": false; }; "dataContext": { "alias": "dataContext"; "required": false; }; "dataSource": { "alias": "dataSource"; "required": false; }; "displayPropertyResolver": { "alias": "displayPropertyResolver"; "required": false; }; }, { "optionSelected": "optionSelected"; }, ["valueTemplateQuery"], never, true, never>;
86
97
  }
87
98
  export {};
@@ -1,6 +1,6 @@
1
1
  import { ElementRef, OnDestroy, OnInit } from '@angular/core';
2
2
  import { Subject } from 'rxjs';
3
- import { ElderAutocompleteComponent } from './elder-autocomplete/elder-autocomplete.component';
3
+ import { ElderSuggestionPanelComponent } from './elder-autocomplete/elder-suggestion-panel.component';
4
4
  import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
5
5
  import { Filter } from '../../../common/data/filters/filter';
6
6
  import { Sort } from '../../../common/data/sort';
@@ -41,8 +41,8 @@ export declare class ElderAutocompleteManyDirective<T> implements OnInit, OnDest
41
41
  * Properties *
42
42
  * *
43
43
  **************************************************************************/
44
- set autocomplete(auto: ElderAutocompleteComponent);
45
- get autocomplete(): ElderAutocompleteComponent;
44
+ set autocomplete(auto: ElderSuggestionPanelComponent);
45
+ get autocomplete(): ElderSuggestionPanelComponent;
46
46
  private get cursorPosition();
47
47
  private set cursorPosition(value);
48
48
  private get dataContext();
@@ -1,6 +1,6 @@
1
1
  import { OnDestroy, OnInit } from '@angular/core';
2
2
  import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
3
- import { ElderAutocompleteComponent } from './elder-autocomplete/elder-autocomplete.component';
3
+ import { ElderSuggestionPanelComponent } from './elder-autocomplete/elder-suggestion-panel.component';
4
4
  import { Subject } from 'rxjs';
5
5
  import { Filter } from '../../../common/data/filters/filter';
6
6
  import { IDataContext } from '../../../common/data/data-context/data-context';
@@ -46,8 +46,8 @@ export declare class ElderAutocompleteDirective implements OnInit, OnDestroy {
46
46
  * Properties *
47
47
  * *
48
48
  **************************************************************************/
49
- set autocomplete(auto: ElderAutocompleteComponent);
50
- get autocomplete(): ElderAutocompleteComponent;
49
+ set autocomplete(auto: ElderSuggestionPanelComponent);
50
+ get autocomplete(): ElderSuggestionPanelComponent;
51
51
  get dataContext(): IDataContext<any>;
52
52
  /***************************************************************************
53
53
  * *
@@ -6,14 +6,14 @@ import * as i4 from "@angular/material/autocomplete";
6
6
  import * as i5 from "../../infinitescroll/elder-infinite-scroll.module";
7
7
  import * as i6 from "@angular/material/icon";
8
8
  import * as i7 from "@angular/material/progress-bar";
9
- import * as i8 from "./elder-autocomplete/elder-autocomplete.component";
9
+ import * as i8 from "./elder-autocomplete/elder-suggestion-panel.component";
10
10
  import * as i9 from "./elder-autocomplete.directive";
11
11
  import * as i10 from "./elder-autocomplete-many.directive";
12
- export { ElderAutocompleteComponent } from './elder-autocomplete/elder-autocomplete.component';
12
+ export { ElderSuggestionPanelComponent } from './elder-autocomplete/elder-suggestion-panel.component';
13
13
  export { ElderAutocompleteManyDirective } from './elder-autocomplete-many.directive';
14
14
  export { ElderAutocompleteDirective } from './elder-autocomplete.directive';
15
15
  export declare class ElderAutocompleteModule {
16
16
  static ɵfac: i0.ɵɵFactoryDeclaration<ElderAutocompleteModule, never>;
17
- static ɵmod: i0.ɵɵNgModuleDeclaration<ElderAutocompleteModule, never, [typeof i1.CommonModule, typeof i2.ReactiveFormsModule, typeof i3.MatInputModule, typeof i4.MatAutocompleteModule, typeof i5.ElderInfiniteScrollModule, typeof i6.MatIconModule, typeof i7.MatProgressBarModule, typeof i8.ElderAutocompleteComponent, typeof i9.ElderAutocompleteDirective, typeof i10.ElderAutocompleteManyDirective], [typeof i8.ElderAutocompleteComponent, typeof i9.ElderAutocompleteDirective, typeof i10.ElderAutocompleteManyDirective]>;
17
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ElderAutocompleteModule, never, [typeof i1.CommonModule, typeof i2.ReactiveFormsModule, typeof i3.MatInputModule, typeof i4.MatAutocompleteModule, typeof i5.ElderInfiniteScrollModule, typeof i6.MatIconModule, typeof i7.MatProgressBarModule, typeof i8.ElderSuggestionPanelComponent, typeof i9.ElderAutocompleteDirective, typeof i10.ElderAutocompleteManyDirective], [typeof i8.ElderSuggestionPanelComponent, typeof i9.ElderAutocompleteDirective, typeof i10.ElderAutocompleteManyDirective]>;
18
18
  static ɵinj: i0.ɵɵInjectorDeclaration<ElderAutocompleteModule>;
19
19
  }
@@ -1,8 +1,10 @@
1
1
  import { AfterViewInit } from '@angular/core';
2
2
  import { ElderSelectComponent } from '../single/elder-select/elder-select.component';
3
+ import { ElderAutoSelectFirstService } from './elder-auto-select-first.service';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class ElderAutoSelectFirstDirective<TEntity = any, TId = any> implements AfterViewInit {
5
6
  readonly elderSelect: ElderSelectComponent<TEntity, TId, any>;
7
+ private readonly autoSelectFirstService;
6
8
  /***************************************************************************
7
9
  * *
8
10
  * Fields *
@@ -15,7 +17,7 @@ export declare class ElderAutoSelectFirstDirective<TEntity = any, TId = any> imp
15
17
  * Constructor *
16
18
  * *
17
19
  **************************************************************************/
18
- constructor(elderSelect: ElderSelectComponent<TEntity, TId, any>);
20
+ constructor(elderSelect: ElderSelectComponent<TEntity, TId, any>, autoSelectFirstService: ElderAutoSelectFirstService<TEntity>);
19
21
  /***************************************************************************
20
22
  * *
21
23
  * Life Cycle *
@@ -34,6 +36,12 @@ export declare class ElderAutoSelectFirstDirective<TEntity = any, TId = any> imp
34
36
  set autoSelectFirstEnabled(val: boolean | string);
35
37
  set enabled(val: boolean);
36
38
  get enabled(): boolean;
39
+ /***************************************************************************
40
+ * *
41
+ * Public API *
42
+ * *
43
+ **************************************************************************/
44
+ forceReloadFirst(): void;
37
45
  /***************************************************************************
38
46
  * *
39
47
  * Private methods *
@@ -0,0 +1,23 @@
1
+ import { BehaviorSubject } from 'rxjs';
2
+ import * as i0 from "@angular/core";
3
+ export declare class ElderAutoSelectFirstService<TEntity> {
4
+ private readonly _firstItem$;
5
+ private readonly _enabled$;
6
+ constructor();
7
+ /***************************************************************************
8
+ * *
9
+ * Public API *
10
+ * *
11
+ **************************************************************************/
12
+ suggestFirstItem(entity: TEntity): void;
13
+ /***************************************************************************
14
+ * *
15
+ * Properties *
16
+ * *
17
+ **************************************************************************/
18
+ set enabled(enabled: boolean);
19
+ get enabled$(): import("rxjs").Observable<boolean>;
20
+ get firstItem$(): BehaviorSubject<TEntity>;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<ElderAutoSelectFirstService<any>, never>;
22
+ static ɵprov: i0.ɵɵInjectableDeclaration<ElderAutoSelectFirstService<any>>;
23
+ }