@elderbyte/ngx-starter 14.3.2 → 14.4.0-beta.3
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/_index.scss +4 -0
- package/esm2020/lib/common/forms/elder-entity-value-accessor.mjs +22 -0
- package/esm2020/lib/common/forms/elder-form-field-control-base.directive.mjs +169 -0
- package/esm2020/lib/common/forms/elder-from-field-base.mjs +94 -0
- package/esm2020/lib/common/forms/elder-from-field-entity-base.mjs +39 -0
- package/esm2020/lib/common/forms/elder-from-field-multi-entity-base.mjs +39 -0
- package/esm2020/lib/common/forms/elder-multi-entity-value-accessor.mjs +22 -0
- package/esm2020/lib/common/forms/public_api.mjs +7 -1
- package/esm2020/lib/components/forms/directives/elder-forms-directives.module.mjs +7 -1
- package/esm2020/lib/components/input/autocomplete/elder-autocomplete.directive.mjs +4 -4
- package/esm2020/lib/components/measures/directives/elder-unit-select.directive.mjs +2 -2
- package/esm2020/lib/components/select/auto/elder-auto-select-first.directive.mjs +2 -2
- package/esm2020/lib/components/select/auto/elder-select-first-util.mjs +3 -3
- package/esm2020/lib/components/select/elder-select-base.mjs +38 -27
- package/esm2020/lib/components/select/elder-select-chip.directive.mjs +19 -5
- package/esm2020/lib/components/select/elder-select-on-tab.directive.mjs +2 -2
- package/esm2020/lib/components/select/elder-select.module.mjs +23 -12
- package/esm2020/lib/components/select/multi/elder-multi-select-base.mjs +78 -39
- package/esm2020/lib/components/select/multi/elder-multi-select-chips/elder-multi-select-chips.component.mjs +115 -83
- package/esm2020/lib/components/select/multi/elder-multi-select-form-field.mjs +61 -0
- package/esm2020/lib/components/select/popup/selection-model-popup.directive.mjs +9 -4
- package/esm2020/lib/components/select/public_api.mjs +4 -1
- package/esm2020/lib/components/select/single/elder-clear-select.directive.mjs +57 -0
- package/esm2020/lib/components/select/single/elder-select/elder-select.component.mjs +455 -0
- package/esm2020/lib/components/select/single/elder-select-form-field.mjs +45 -0
- package/fesm2015/elderbyte-ngx-starter.mjs +1019 -377
- package/fesm2015/elderbyte-ngx-starter.mjs.map +1 -1
- package/fesm2020/elderbyte-ngx-starter.mjs +1012 -375
- package/fesm2020/elderbyte-ngx-starter.mjs.map +1 -1
- package/lib/{components/select → common/forms}/elder-entity-value-accessor.d.ts +10 -0
- package/lib/common/forms/elder-form-field-control-base.directive.d.ts +101 -0
- package/lib/common/forms/elder-from-field-base.d.ts +52 -0
- package/lib/common/forms/elder-from-field-entity-base.d.ts +31 -0
- package/lib/common/forms/elder-from-field-multi-entity-base.d.ts +31 -0
- package/lib/common/forms/elder-multi-entity-value-accessor.d.ts +42 -0
- package/lib/common/forms/public_api.d.ts +6 -0
- package/lib/components/input/autocomplete/elder-autocomplete.directive.d.ts +1 -1
- package/lib/components/measures/directives/elder-unit-select.directive.d.ts +1 -1
- package/lib/components/select/auto/elder-auto-select-first.directive.d.ts +1 -1
- package/lib/components/select/auto/elder-select-first-util.d.ts +1 -1
- package/lib/components/select/elder-select-base.d.ts +21 -15
- package/lib/components/select/elder-select-chip.directive.d.ts +9 -2
- package/lib/components/select/elder-select.module.d.ts +27 -24
- package/lib/components/select/multi/elder-multi-select-base.d.ts +19 -14
- package/lib/components/select/multi/elder-multi-select-chips/elder-multi-select-chips.component.d.ts +27 -12
- package/lib/components/select/multi/elder-multi-select-form-field.d.ts +33 -0
- package/lib/components/select/popup/selection-model-popup.directive.d.ts +3 -2
- package/lib/components/select/public_api.d.ts +3 -0
- package/lib/components/select/single/elder-clear-select.directive.d.ts +34 -0
- package/lib/components/select/{elder-select → single/elder-select}/elder-select.component.d.ts +24 -12
- package/lib/components/select/single/elder-select-form-field.d.ts +30 -0
- package/package.json +1 -1
- package/src/lib/components/select/multi/elder-multi-select-chips/elder-multi-select-chips.component.scss +54 -11
- package/src/lib/components/select/single/elder-select/elder-select.component.scss +114 -0
- package/theming/_elder-common.scss +48 -0
- package/esm2020/lib/components/select/elder-entity-value-accessor.mjs +0 -13
- package/esm2020/lib/components/select/elder-select/elder-select.component.mjs +0 -419
- package/src/lib/components/select/elder-select/elder-select.component.scss +0 -61
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { NgZone } from '@angular/core';
|
|
1
|
+
import { ElementRef, 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 {
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import { NgControl } from '@angular/forms';
|
|
6
|
+
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
7
|
+
import { IElderMultiEntityValueAccessor } from '../../../common/forms/elder-multi-entity-value-accessor';
|
|
5
8
|
import * as i0 from "@angular/core";
|
|
6
9
|
/**
|
|
7
10
|
* Base component implementation of elder-multi-select.
|
|
@@ -12,15 +15,17 @@ import * as i0 from "@angular/core";
|
|
|
12
15
|
* - The backing Value is a list of the current selected entities. T[]
|
|
13
16
|
*
|
|
14
17
|
*/
|
|
15
|
-
export declare abstract class ElderMultiSelectBase<TId, TEntity, TValue> extends ElderSelectBase<TId, TEntity, TValue[]> {
|
|
18
|
+
export declare abstract class ElderMultiSelectBase<TId, TEntity, TValue> extends ElderSelectBase<TId, TEntity, TValue[]> implements IElderMultiEntityValueAccessor<TEntity, TId, TValue> {
|
|
16
19
|
/***************************************************************************
|
|
17
20
|
* *
|
|
18
21
|
* Fields *
|
|
19
22
|
* *
|
|
20
23
|
**************************************************************************/
|
|
21
24
|
private readonly logger;
|
|
22
|
-
|
|
25
|
+
private readonly _entityIds$;
|
|
26
|
+
private readonly _entities$;
|
|
23
27
|
readonly entityIdsChange: Observable<TId[]>;
|
|
28
|
+
readonly entitiesChange: Observable<TEntity[]>;
|
|
24
29
|
/**
|
|
25
30
|
* Similar to entity-id change, but emits only when the user
|
|
26
31
|
* has updated the value.
|
|
@@ -36,38 +41,38 @@ export declare abstract class ElderMultiSelectBase<TId, TEntity, TValue> extends
|
|
|
36
41
|
* Constructor *
|
|
37
42
|
* *
|
|
38
43
|
**************************************************************************/
|
|
39
|
-
protected constructor(zone: NgZone);
|
|
44
|
+
protected constructor(zone: NgZone, hostRef: ElementRef, controlType: string, focusMonitor: FocusMonitor, ngControl?: NgControl);
|
|
40
45
|
private awaitEntitiesWithId;
|
|
41
46
|
/***************************************************************************
|
|
42
47
|
* *
|
|
43
48
|
* Properties *
|
|
44
49
|
* *
|
|
45
50
|
**************************************************************************/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* *
|
|
49
|
-
* Properties *
|
|
50
|
-
* *
|
|
51
|
-
**************************************************************************/
|
|
51
|
+
get entities$(): Observable<TEntity[]>;
|
|
52
|
+
get entityIds$(): Observable<TId[]>;
|
|
52
53
|
set entities(entities: TEntity[]);
|
|
53
54
|
get entities(): TEntity[];
|
|
54
55
|
set entityIds(ids: TId[]);
|
|
55
56
|
get entityIds(): TId[];
|
|
57
|
+
get isOptionDisabledInternalFn(): (option: TEntity) => boolean;
|
|
58
|
+
get isOptionHiddenInternalFn(): (option: TEntity) => boolean;
|
|
56
59
|
/***************************************************************************
|
|
57
60
|
* *
|
|
58
61
|
* Public API *
|
|
59
62
|
* *
|
|
60
63
|
**************************************************************************/
|
|
64
|
+
updateValueByEntities(entities: TEntity[]): void;
|
|
61
65
|
appendEntities(newEntities: TEntity[]): void;
|
|
62
66
|
appendEntity(newEntity: any): void;
|
|
63
67
|
removeEntity(toRemove: TEntity): void;
|
|
64
68
|
openSelectionPopup(event: Event): void;
|
|
69
|
+
entityToValue(entity: TEntity): TValue;
|
|
65
70
|
/***************************************************************************
|
|
66
71
|
* *
|
|
67
72
|
* Internal Methods *
|
|
68
73
|
* *
|
|
69
74
|
**************************************************************************/
|
|
70
|
-
protected
|
|
75
|
+
protected onDataContextChanged(data: IDataContext<TEntity>): void;
|
|
71
76
|
/**
|
|
72
77
|
* This method is invoked after a value has been written to this control.
|
|
73
78
|
*
|
|
@@ -78,10 +83,10 @@ export declare abstract class ElderMultiSelectBase<TId, TEntity, TValue> extends
|
|
|
78
83
|
* Private Methods *
|
|
79
84
|
* *
|
|
80
85
|
**************************************************************************/
|
|
86
|
+
private isAlreadyPresent;
|
|
81
87
|
private entityIdsFromValues;
|
|
82
88
|
private entityIdFromValue;
|
|
83
89
|
private entitiesToValues;
|
|
84
|
-
private entityToValue;
|
|
85
90
|
private getEntityIds;
|
|
86
91
|
private equalIds;
|
|
87
92
|
private equalEntities;
|
|
@@ -89,5 +94,5 @@ export declare abstract class ElderMultiSelectBase<TId, TEntity, TValue> extends
|
|
|
89
94
|
private loadEntityByIds;
|
|
90
95
|
private findInDataContext;
|
|
91
96
|
static ɵfac: i0.ɵɵFactoryDeclaration<ElderMultiSelectBase<any, any, any>, never>;
|
|
92
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ElderMultiSelectBase<any, any, any>, never, never, { "entities": "entities"; "entityIds": "entityIds"; }, { "entityIdsChange": "entityIdsChange"; "entityIdsUpdated": "entityIdsUpdated"; "entitiesUpdated": "entitiesUpdated"; }, never, never, false>;
|
|
97
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ElderMultiSelectBase<any, any, any>, never, never, { "entities": "entities"; "entityIds": "entityIds"; }, { "entityIdsChange": "entityIdsChange"; "entitiesChange": "entitiesChange"; "entityIdsUpdated": "entityIdsUpdated"; "entitiesUpdated": "entitiesUpdated"; }, never, never, false>;
|
|
93
98
|
}
|
package/lib/components/select/multi/elder-multi-select-chips/elder-multi-select-chips.component.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { NgZone, TemplateRef } from '@angular/core';
|
|
1
|
+
import { NgZone, ElementRef, TemplateRef } from '@angular/core';
|
|
2
2
|
import { ElderMultiSelectBase } from '../elder-multi-select-base';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { ThemePalette } from '@angular/material/core';
|
|
5
|
+
import { NgControl } from '@angular/forms';
|
|
6
|
+
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
5
7
|
import * as i0 from "@angular/core";
|
|
6
8
|
declare class ChipModel<T> {
|
|
7
9
|
readonly value: T;
|
|
@@ -11,6 +13,7 @@ declare class ChipModel<T> {
|
|
|
11
13
|
constructor(value: T, displayText: string, color: ThemePalette, removeable: boolean);
|
|
12
14
|
}
|
|
13
15
|
export declare class ElderMultiSelectChipsComponent<TId = any, TEntity = any, TValue = any> extends ElderMultiSelectBase<TId, TEntity, TValue> {
|
|
16
|
+
ngControl: NgControl;
|
|
14
17
|
/***************************************************************************
|
|
15
18
|
* *
|
|
16
19
|
* Fields *
|
|
@@ -21,18 +24,29 @@ export declare class ElderMultiSelectChipsComponent<TId = any, TEntity = any, TV
|
|
|
21
24
|
private readonly chipColorResolver$;
|
|
22
25
|
selectable: boolean;
|
|
23
26
|
allowRemove: boolean;
|
|
24
|
-
chipColorEnabled: boolean;
|
|
25
|
-
private inputControl;
|
|
26
27
|
chipTemplateQuery: TemplateRef<any>;
|
|
27
28
|
private _chipTemplate;
|
|
28
29
|
chipAvatarTemplateQuery: TemplateRef<any>;
|
|
29
30
|
private _chipAvatarTemplate;
|
|
31
|
+
customInputTemplateQuery: TemplateRef<any>;
|
|
32
|
+
private _customInputTemplate;
|
|
33
|
+
private _chipColorEnabled;
|
|
30
34
|
/***************************************************************************
|
|
31
35
|
* *
|
|
32
36
|
* Constructor *
|
|
33
37
|
* *
|
|
34
38
|
**************************************************************************/
|
|
35
|
-
constructor(zone: NgZone);
|
|
39
|
+
constructor(hostRef: ElementRef, zone: NgZone, focusMonitor: FocusMonitor, ngControl: NgControl);
|
|
40
|
+
/***************************************************************************
|
|
41
|
+
* *
|
|
42
|
+
* Host Bindings *
|
|
43
|
+
* *
|
|
44
|
+
**************************************************************************/
|
|
45
|
+
get hostClass(): string;
|
|
46
|
+
get disabledClass(): boolean;
|
|
47
|
+
get errorStateClass(): boolean;
|
|
48
|
+
get requiredClass(): boolean;
|
|
49
|
+
get emptyClass(): boolean;
|
|
36
50
|
/***************************************************************************
|
|
37
51
|
* *
|
|
38
52
|
* Properties *
|
|
@@ -42,20 +56,20 @@ export declare class ElderMultiSelectChipsComponent<TId = any, TEntity = any, TV
|
|
|
42
56
|
get chipTemplate(): TemplateRef<any>;
|
|
43
57
|
set chipAvatarTemplate(template: TemplateRef<any>);
|
|
44
58
|
get chipAvatarTemplate(): TemplateRef<any>;
|
|
59
|
+
set customInputTemplate(template: TemplateRef<any>);
|
|
60
|
+
get customInputTemplate(): TemplateRef<any>;
|
|
61
|
+
set chipColorEnabled(enabled: boolean);
|
|
62
|
+
get chipColorEnabled(): boolean;
|
|
45
63
|
/**
|
|
46
64
|
* A function which returns the color of a given label object.
|
|
47
65
|
*/
|
|
48
66
|
set chipColorResolver(fn: (o1: any) => ThemePalette);
|
|
49
|
-
get isOptionDisabledInternalFn(): (option: TEntity) => boolean;
|
|
50
|
-
get isOptionHiddenInternalFn(): (option: TEntity) => boolean;
|
|
51
67
|
/***************************************************************************
|
|
52
68
|
* *
|
|
53
69
|
* Public API *
|
|
54
70
|
* *
|
|
55
71
|
**************************************************************************/
|
|
56
|
-
onOptionSelected(selectedValue: TEntity): void;
|
|
57
72
|
resolveChipValue(e1: TEntity): any;
|
|
58
|
-
get compareWithFn(): (e1: TEntity, e2: TEntity) => boolean;
|
|
59
73
|
focus(options?: FocusOptions): void;
|
|
60
74
|
blur(): void;
|
|
61
75
|
/***************************************************************************
|
|
@@ -63,9 +77,10 @@ export declare class ElderMultiSelectChipsComponent<TId = any, TEntity = any, TV
|
|
|
63
77
|
* Private methods *
|
|
64
78
|
* *
|
|
65
79
|
**************************************************************************/
|
|
66
|
-
private
|
|
67
|
-
private
|
|
68
|
-
|
|
69
|
-
static
|
|
80
|
+
private buildChipModelsOrFallback;
|
|
81
|
+
private buildChipFallbackModels;
|
|
82
|
+
private buildChipModels;
|
|
83
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ElderMultiSelectChipsComponent<any, any, any>, [null, null, null, { optional: true; self: true; }]>;
|
|
84
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ElderMultiSelectChipsComponent<any, any, any>, "elder-multi-select-chips", never, { "allowRemove": "allowRemove"; "chipTemplate": "chipTemplate"; "chipAvatarTemplate": "chipAvatarTemplate"; "customInputTemplate": "customInputTemplate"; "chipColorEnabled": "chipColorEnabled"; "chipColorResolver": "chipColorResolver"; }, {}, ["chipTemplateQuery", "chipAvatarTemplateQuery", "customInputTemplateQuery"], never, false>;
|
|
70
85
|
}
|
|
71
86
|
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AfterViewInit } from '@angular/core';
|
|
2
|
+
import { ElderSelectValueDirective } from '../elder-select-value.directive';
|
|
3
|
+
import { ElderApplyControlFn } from '../../../common/forms/elder-from-field-base';
|
|
4
|
+
import { ElderMultiSelectBase } from './elder-multi-select-base';
|
|
5
|
+
import { ElderFromFieldMultiEntityBase } from '../../../common/forms/elder-from-field-multi-entity-base';
|
|
6
|
+
import { ElderSelectChipAvatarDirective, ElderSelectChipDirective } from '../elder-select-chip.directive';
|
|
7
|
+
import { SelectionModelPopupDirective } from '../popup/selection-model-popup.directive';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
export declare abstract class ElderMultiSelectFormField<TEntity, TId, TValue = TEntity | TId> extends ElderFromFieldMultiEntityBase<TEntity, TId, TValue, ElderMultiSelectBase<TId, TEntity, TValue>> implements AfterViewInit {
|
|
10
|
+
/***************************************************************************
|
|
11
|
+
* *
|
|
12
|
+
* Fields *
|
|
13
|
+
* *
|
|
14
|
+
**************************************************************************/
|
|
15
|
+
selectValueTemplate: ElderSelectValueDirective;
|
|
16
|
+
selectionModelPopupDirective: SelectionModelPopupDirective;
|
|
17
|
+
selectChipDirective: ElderSelectChipDirective;
|
|
18
|
+
selectChipAvatarDirective: ElderSelectChipAvatarDirective;
|
|
19
|
+
/***************************************************************************
|
|
20
|
+
* *
|
|
21
|
+
* Constructor *
|
|
22
|
+
* *
|
|
23
|
+
**************************************************************************/
|
|
24
|
+
protected constructor(initSelectFn: ElderApplyControlFn<ElderMultiSelectBase<TId, TEntity, TValue>>);
|
|
25
|
+
/***************************************************************************
|
|
26
|
+
* *
|
|
27
|
+
* Life Cycle *
|
|
28
|
+
* *
|
|
29
|
+
**************************************************************************/
|
|
30
|
+
ngAfterViewInit(): void;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ElderMultiSelectFormField<any, any, any>, never>;
|
|
32
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ElderMultiSelectFormField<any, any, any>, never, never, {}, {}, never, never, false>;
|
|
33
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
1
|
+
import { ChangeDetectorRef, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
|
|
2
2
|
import { MatDialog } from '@angular/material/dialog';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { KeyGetterFn, SelectionModel } from '../../../common/selection/selection-model';
|
|
@@ -22,6 +22,7 @@ export declare class SelectionModelPopupDirective implements OnInit, OnDestroy {
|
|
|
22
22
|
private readonly dialog;
|
|
23
23
|
private readonly dataViewSelectionMode;
|
|
24
24
|
private readonly selectionModel;
|
|
25
|
+
private readonly changeDetectorRef;
|
|
25
26
|
/***************************************************************************
|
|
26
27
|
* *
|
|
27
28
|
* Fields *
|
|
@@ -35,7 +36,7 @@ export declare class SelectionModelPopupDirective implements OnInit, OnDestroy {
|
|
|
35
36
|
* Constructor *
|
|
36
37
|
* *
|
|
37
38
|
**************************************************************************/
|
|
38
|
-
constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, dialog: MatDialog, dataViewSelectionMode: ElderDataViewSelectionMode, selectionModel: SelectionModel<any
|
|
39
|
+
constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, dialog: MatDialog, dataViewSelectionMode: ElderDataViewSelectionMode, selectionModel: SelectionModel<any>, changeDetectorRef: ChangeDetectorRef);
|
|
39
40
|
/***************************************************************************
|
|
40
41
|
* *
|
|
41
42
|
* Host Listeners *
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { ElderSelectComponent } from './elder-select/elder-select.component';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class ElderClearSelectDirective implements OnInit, OnDestroy {
|
|
5
|
+
private readonly select;
|
|
6
|
+
/***************************************************************************
|
|
7
|
+
* *
|
|
8
|
+
* Fields *
|
|
9
|
+
* *
|
|
10
|
+
**************************************************************************/
|
|
11
|
+
private readonly log;
|
|
12
|
+
private readonly destroy$;
|
|
13
|
+
/***************************************************************************
|
|
14
|
+
* *
|
|
15
|
+
* Constructor *
|
|
16
|
+
* *
|
|
17
|
+
**************************************************************************/
|
|
18
|
+
constructor(select: ElderSelectComponent);
|
|
19
|
+
/***************************************************************************
|
|
20
|
+
* *
|
|
21
|
+
* Life Cycle *
|
|
22
|
+
* *
|
|
23
|
+
**************************************************************************/
|
|
24
|
+
ngOnInit(): void;
|
|
25
|
+
ngOnDestroy(): void;
|
|
26
|
+
/***************************************************************************
|
|
27
|
+
* *
|
|
28
|
+
* Private methods *
|
|
29
|
+
* *
|
|
30
|
+
**************************************************************************/
|
|
31
|
+
private clearSelect;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ElderClearSelectDirective, [{ host: true; }]>;
|
|
33
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ElderClearSelectDirective, "[elderClearSelect]", never, {}, {}, never, never, false>;
|
|
34
|
+
}
|
package/lib/components/select/{elder-select → single/elder-select}/elder-select.component.d.ts
RENAMED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { ElementRef, NgZone
|
|
2
|
-
import { IDataContext } from '
|
|
1
|
+
import { ElementRef, NgZone } from '@angular/core';
|
|
2
|
+
import { IDataContext } from '../../../../common/data/data-context/data-context';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
|
+
import { BooleanInput } from '@angular/cdk/coercion';
|
|
4
5
|
import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
|
|
5
|
-
import { ElderSelectBase, TextResolverFn } from '
|
|
6
|
-
import { IElderEntityValueAccessor } from '
|
|
6
|
+
import { ElderSelectBase, TextResolverFn } from '../../elder-select-base';
|
|
7
|
+
import { IElderEntityValueAccessor } from '../../../../common/forms/elder-entity-value-accessor';
|
|
8
|
+
import { NgControl } from '@angular/forms';
|
|
9
|
+
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
7
10
|
import * as i0 from "@angular/core";
|
|
8
11
|
declare class EntityContext<T> {
|
|
9
12
|
readonly value: T;
|
|
@@ -21,7 +24,8 @@ declare class EntityContext<T> {
|
|
|
21
24
|
* - Support entity id handling, input / output is the entity id vs full value.
|
|
22
25
|
*
|
|
23
26
|
*/
|
|
24
|
-
export declare class ElderSelectComponent<TEntity = any, TId = any, TValue = TEntity | TId> extends ElderSelectBase<TId, TEntity, TValue> implements IElderEntityValueAccessor<TEntity, TId, TValue
|
|
27
|
+
export declare class ElderSelectComponent<TEntity = any, TId = any, TValue = TEntity | TId> extends ElderSelectBase<TId, TEntity, TValue> implements IElderEntityValueAccessor<TEntity, TId, TValue> {
|
|
28
|
+
ngControl: NgControl;
|
|
25
29
|
/***************************************************************************
|
|
26
30
|
* *
|
|
27
31
|
* Fields *
|
|
@@ -50,7 +54,6 @@ export declare class ElderSelectComponent<TEntity = any, TId = any, TValue = TEn
|
|
|
50
54
|
private readonly _entity$;
|
|
51
55
|
private _autocomplete;
|
|
52
56
|
readonly entityWrapped$: Observable<EntityContext<TEntity>>;
|
|
53
|
-
private readonly unsubscribe$;
|
|
54
57
|
readonly inputText$: Observable<string>;
|
|
55
58
|
private entityContext;
|
|
56
59
|
/***************************************************************************
|
|
@@ -58,25 +61,34 @@ export declare class ElderSelectComponent<TEntity = any, TId = any, TValue = TEn
|
|
|
58
61
|
* Constructor *
|
|
59
62
|
* *
|
|
60
63
|
**************************************************************************/
|
|
61
|
-
constructor(zone: NgZone);
|
|
64
|
+
constructor(hostRef: ElementRef, zone: NgZone, focusMonitor: FocusMonitor, ngControl: NgControl);
|
|
62
65
|
/***************************************************************************
|
|
63
66
|
* *
|
|
64
67
|
* Life Cycle *
|
|
65
68
|
* *
|
|
66
69
|
**************************************************************************/
|
|
67
|
-
ngOnInit(): void;
|
|
68
70
|
ngOnDestroy(): void;
|
|
71
|
+
/***************************************************************************
|
|
72
|
+
* *
|
|
73
|
+
* Host Bindings *
|
|
74
|
+
* *
|
|
75
|
+
**************************************************************************/
|
|
76
|
+
get hostClass(): string;
|
|
77
|
+
get disabledClass(): boolean;
|
|
78
|
+
get errorStateClass(): boolean;
|
|
79
|
+
get requiredClass(): boolean;
|
|
80
|
+
get emptyClass(): boolean;
|
|
69
81
|
/***************************************************************************
|
|
70
82
|
* *
|
|
71
83
|
* Behaviour Properties *
|
|
72
84
|
* *
|
|
73
85
|
**************************************************************************/
|
|
74
|
-
set autocomplete(value:
|
|
86
|
+
set autocomplete(value: BooleanInput);
|
|
75
87
|
get autocomplete(): boolean;
|
|
76
88
|
/**
|
|
77
89
|
* Allows the user to select 'nothing' / null.
|
|
78
90
|
*/
|
|
79
|
-
set allowNull(val:
|
|
91
|
+
set allowNull(val: BooleanInput);
|
|
80
92
|
get allowNull(): boolean;
|
|
81
93
|
/***************************************************************************
|
|
82
94
|
* *
|
|
@@ -120,7 +132,7 @@ export declare class ElderSelectComponent<TEntity = any, TId = any, TValue = TEn
|
|
|
120
132
|
/**
|
|
121
133
|
* Occurs when the suggestions data-context has changed
|
|
122
134
|
*/
|
|
123
|
-
protected
|
|
135
|
+
protected onDataContextChanged(data: IDataContext<TEntity>): void;
|
|
124
136
|
/***************************************************************************
|
|
125
137
|
* *
|
|
126
138
|
* Private Methods *
|
|
@@ -139,7 +151,7 @@ export declare class ElderSelectComponent<TEntity = any, TId = any, TValue = TEn
|
|
|
139
151
|
*
|
|
140
152
|
*/
|
|
141
153
|
protected writeToControl(value: TValue): void;
|
|
142
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ElderSelectComponent<any, any, any>,
|
|
154
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ElderSelectComponent<any, any, any>, [null, null, null, { optional: true; self: true; }]>;
|
|
143
155
|
static ɵcmp: i0.ɵɵComponentDeclaration<ElderSelectComponent<any, any, any>, "elder-select", never, { "nullDisplay": "nullDisplay"; "autocomplete": "autocomplete"; "allowNull": "allowNull"; "entity": "entity"; "entityId": "entityId"; "hintProperty": "hintProperty"; "hintPropertyResolver": "hintPropertyResolver"; }, { "entityIdChange": "entityIdChange"; "entityIdUpdated": "entityIdUpdated"; "entityChange": "entityChange"; "entityUpdated": "entityUpdated"; }, never, never, false>;
|
|
144
156
|
}
|
|
145
157
|
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ElderFromFieldEntityBase } from '../../../common/forms/elder-from-field-entity-base';
|
|
2
|
+
import { AfterViewInit } from '@angular/core';
|
|
3
|
+
import { ElderSelectComponent } from './elder-select/elder-select.component';
|
|
4
|
+
import { ElderSelectValueDirective } from '../elder-select-value.directive';
|
|
5
|
+
import { ElderApplyControlFn } from '../../../common/forms/elder-from-field-base';
|
|
6
|
+
import { SelectionModelPopupDirective } from '../popup/selection-model-popup.directive';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare abstract class ElderSelectFormField<TEntity, TId> extends ElderFromFieldEntityBase<TEntity, TId, ElderSelectComponent<TEntity, TId>> implements AfterViewInit {
|
|
9
|
+
/***************************************************************************
|
|
10
|
+
* *
|
|
11
|
+
* Fields *
|
|
12
|
+
* *
|
|
13
|
+
**************************************************************************/
|
|
14
|
+
selectValueTemplate: ElderSelectValueDirective;
|
|
15
|
+
selectionModelPopupDirective: SelectionModelPopupDirective;
|
|
16
|
+
/***************************************************************************
|
|
17
|
+
* *
|
|
18
|
+
* Constructor *
|
|
19
|
+
* *
|
|
20
|
+
**************************************************************************/
|
|
21
|
+
protected constructor(initSelectFn: ElderApplyControlFn<ElderSelectComponent<TEntity, TId>>);
|
|
22
|
+
/***************************************************************************
|
|
23
|
+
* *
|
|
24
|
+
* Life Cycle *
|
|
25
|
+
* *
|
|
26
|
+
**************************************************************************/
|
|
27
|
+
ngAfterViewInit(): void;
|
|
28
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ElderSelectFormField<any, any>, never>;
|
|
29
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ElderSelectFormField<any, any>, never, never, {}, {}, never, never, false>;
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,54 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '@angular/material' as mat;
|
|
1
3
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
@mixin theme($config-or-theme) {
|
|
5
|
+
$config: mat.get-color-config($config-or-theme);
|
|
6
|
+
$foreground: map.get($config, foreground);
|
|
7
|
+
$background: map.get($config, background);
|
|
8
|
+
$primary: map.get($config, primary);
|
|
9
|
+
$accent: map.get($config, accent);
|
|
10
|
+
$warn: map.get($config, warn);
|
|
11
|
+
|
|
12
|
+
.elder-select-value {
|
|
13
|
+
color: mat.get-color-from-palette($foreground, text);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.elder-select-disabled .elder-select-value {
|
|
17
|
+
color: mat.get-color-from-palette($foreground, disabled-text);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.elder-select-icon {
|
|
21
|
+
color: mat.get-color-from-palette($foreground, secondary-text);
|
|
22
|
+
}
|
|
5
23
|
|
|
6
|
-
.leading-icon {
|
|
7
|
-
font-size: 16px;
|
|
8
|
-
width: 16px;
|
|
9
|
-
height: 16px;
|
|
10
|
-
}
|
|
11
24
|
|
|
12
|
-
.
|
|
13
|
-
|
|
14
|
-
|
|
25
|
+
.mat-form-field {
|
|
26
|
+
&.mat-focused {
|
|
27
|
+
&.mat-primary .elder-select-icon {
|
|
28
|
+
color: mat.get-color-from-palette($primary, text);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.mat-accent .elder-select-icon {
|
|
32
|
+
color: mat.get-color-from-palette($accent, text);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.mat-warn .elder-select-icon {
|
|
36
|
+
color: mat.get-color-from-palette($warn, text);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.mat-form-field-invalid .elder-multi-select {
|
|
41
|
+
.elder-select-icon {
|
|
42
|
+
color: mat.get-color-from-palette($warn, text);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.mat-form-field-disabled .elder-multi-select {
|
|
47
|
+
.elder-select-icon {
|
|
48
|
+
color: mat.get-color-from-palette($foreground, disabled-text);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
15
52
|
}
|
|
16
53
|
|
|
17
54
|
.small-icon-button {
|
|
@@ -32,3 +69,9 @@
|
|
|
32
69
|
.clickable-chip {
|
|
33
70
|
cursor: pointer;
|
|
34
71
|
}
|
|
72
|
+
|
|
73
|
+
.elder-chip-text {
|
|
74
|
+
overflow: hidden;
|
|
75
|
+
text-overflow: ellipsis;
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '@angular/material' as mat;
|
|
3
|
+
|
|
4
|
+
@mixin theme($config-or-theme) {
|
|
5
|
+
$config: mat.get-color-config($config-or-theme);
|
|
6
|
+
$foreground: map.get($config, foreground);
|
|
7
|
+
$background: map.get($config, background);
|
|
8
|
+
$primary: map.get($config, primary);
|
|
9
|
+
$accent: map.get($config, accent);
|
|
10
|
+
$warn: map.get($config, warn);
|
|
11
|
+
|
|
12
|
+
.elder-select-value {
|
|
13
|
+
color: mat.get-color-from-palette($foreground, text);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.elder-select-disabled .elder-select-value {
|
|
17
|
+
color: mat.get-color-from-palette($foreground, disabled-text);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.elder-select-icon {
|
|
21
|
+
color: mat.get-color-from-palette($foreground, secondary-text);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
.mat-form-field {
|
|
26
|
+
&.mat-focused {
|
|
27
|
+
&.mat-primary .elder-select-icon {
|
|
28
|
+
color: mat.get-color-from-palette($primary, text);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.mat-accent .elder-select-icon {
|
|
32
|
+
color: mat.get-color-from-palette($accent, text);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.mat-warn .elder-select-icon {
|
|
36
|
+
color: mat.get-color-from-palette($warn, text);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.mat-form-field-invalid .elder-select {
|
|
41
|
+
.elder-select-icon {
|
|
42
|
+
color: mat.get-color-from-palette($warn, text);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&.mat-form-field-disabled .elder-select {
|
|
47
|
+
.elder-select-icon {
|
|
48
|
+
color: mat.get-color-from-palette($foreground, disabled-text);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
.prefix-container {
|
|
56
|
+
width: 24px;
|
|
57
|
+
height: 16px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@keyframes shrink {
|
|
61
|
+
0% {
|
|
62
|
+
transform: scale(1.0);
|
|
63
|
+
}
|
|
64
|
+
100% {
|
|
65
|
+
transform: scale(0.75);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.loading {
|
|
70
|
+
animation: shrink 0.3s ease-in-out infinite alternate;
|
|
71
|
+
-webkit-animation: shrink 0.3s ease-in-out infinite alternate;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.prefix-padding {
|
|
75
|
+
padding-right: 4px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.leading-icon {
|
|
79
|
+
font-size: 16px;
|
|
80
|
+
width: 16px;
|
|
81
|
+
height: 16px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.suffix-icon {
|
|
85
|
+
font-size: 16px;
|
|
86
|
+
width: 16px;
|
|
87
|
+
height: 16px;
|
|
88
|
+
// padding-left: 4px;
|
|
89
|
+
.mat-icon {
|
|
90
|
+
font-size: 16px;
|
|
91
|
+
width: 16px;
|
|
92
|
+
height: 16px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.clickable-icon {
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.full-width {
|
|
101
|
+
width: 100%;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.elder-select-dropdown-input {
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
// width: 162px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.elder-select-arrow {
|
|
110
|
+
font-size: 18px;
|
|
111
|
+
width: 18px;
|
|
112
|
+
height: 18px;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
}
|