@elderbyte/ngx-starter 13.9.0 → 13.9.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.
Files changed (21) hide show
  1. package/esm2020/lib/components/select/elder-entity-value-accessor.mjs +5 -4
  2. package/esm2020/lib/components/select/elder-select/elder-select.component.mjs +14 -5
  3. package/esm2020/lib/components/select/elder-select-base.mjs +1 -1
  4. package/esm2020/lib/components/select/elder-select-chip.directive.mjs +15 -1
  5. package/esm2020/lib/components/select/elder-select-on-tab.directive.mjs +42 -19
  6. package/esm2020/lib/components/select/elder-select.module.mjs +7 -3
  7. package/esm2020/lib/components/select/multi/elder-multi-select-chips/elder-multi-select-chips.component.mjs +37 -15
  8. package/fesm2015/elderbyte-ngx-starter.mjs +112 -35
  9. package/fesm2015/elderbyte-ngx-starter.mjs.map +1 -1
  10. package/fesm2020/elderbyte-ngx-starter.mjs +108 -35
  11. package/fesm2020/elderbyte-ngx-starter.mjs.map +1 -1
  12. package/lib/components/select/elder-entity-value-accessor.d.ts +7 -2
  13. package/lib/components/select/elder-select/elder-select.component.d.ts +7 -4
  14. package/lib/components/select/elder-select-base.d.ts +2 -0
  15. package/lib/components/select/elder-select-chip.directive.d.ts +7 -0
  16. package/lib/components/select/elder-select-on-tab.directive.d.ts +12 -4
  17. package/lib/components/select/elder-select.module.d.ts +2 -2
  18. package/lib/components/select/multi/elder-multi-select-chips/elder-multi-select-chips.component.d.ts +14 -11
  19. package/package.json +1 -1
  20. package/src/lib/components/select/elder-select/elder-select.component.scss +12 -0
  21. package/src/lib/components/select/multi/elder-multi-select-chips/elder-multi-select-chips.component.scss +20 -0
@@ -1,5 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
- export interface IElderEntityValueAccessor<TEntity, TId> {
2
+ export interface IElderEntityValueAccessor<TEntity, TId, TValue> {
3
3
  /**
4
4
  * Gets or sets the entity
5
5
  */
@@ -23,5 +23,10 @@ export interface IElderEntityValueAccessor<TEntity, TId> {
23
23
  * @param entity
24
24
  */
25
25
  updateValueByEntity(entity: TEntity): void;
26
+ /**
27
+ * Convert an entity to a value for this control.
28
+ * @param entity
29
+ */
30
+ entityToValue(entity: TEntity): TValue;
26
31
  }
27
- export declare function isElderEntityValueAccessor(object: any): object is IElderEntityValueAccessor<any, any>;
32
+ export declare function isElderEntityValueAccessor(object: any): object is IElderEntityValueAccessor<any, any, any>;
@@ -1,4 +1,4 @@
1
- import { NgZone, OnDestroy, OnInit } from '@angular/core';
1
+ import { ElementRef, NgZone, OnDestroy, OnInit } from '@angular/core';
2
2
  import { IDataContext } from '../../../common/data/data-context/data-context';
3
3
  import { Observable } from 'rxjs';
4
4
  import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
@@ -21,7 +21,7 @@ declare class EntityContext<T> {
21
21
  * - Support entity id handling, input / output is the entity id vs full value.
22
22
  *
23
23
  */
24
- export declare class ElderSelectComponent<TEntity = any, TId = any, TValue = TEntity | TId> extends ElderSelectBase<TId, TEntity, TValue> implements IElderEntityValueAccessor<TEntity, TId>, OnInit, OnDestroy {
24
+ export declare class ElderSelectComponent<TEntity = any, TId = any, TValue = TEntity | TId> extends ElderSelectBase<TId, TEntity, TValue> implements IElderEntityValueAccessor<TEntity, TId, TValue>, OnInit, OnDestroy {
25
25
  /***************************************************************************
26
26
  * *
27
27
  * Fields *
@@ -30,6 +30,7 @@ export declare class ElderSelectComponent<TEntity = any, TId = any, TValue = TEn
30
30
  private readonly logger;
31
31
  private readonly hintPropertyResolver$;
32
32
  private _allowNull;
33
+ inputRef: ElementRef<HTMLInputElement>;
33
34
  /**
34
35
  * String to display for the 'nothing' / null value.
35
36
  */
@@ -104,9 +105,11 @@ export declare class ElderSelectComponent<TEntity = any, TId = any, TValue = TEn
104
105
  onInputClicked(autoTrigger: MatAutocompleteTrigger): void;
105
106
  onOptionSelected(selectedValue: TEntity): void;
106
107
  openSelectionPopup(event: Event): void;
107
- clear(event: Event): void;
108
+ clear(event?: Event): void;
108
109
  forceReloadFirst(): void;
109
110
  updateValueByEntity(entity: TEntity): void;
111
+ focus(options?: FocusOptions): void;
112
+ blur(): void;
110
113
  /***************************************************************************
111
114
  * *
112
115
  * Abstract Implementation *
@@ -128,7 +131,7 @@ export declare class ElderSelectComponent<TEntity = any, TId = any, TValue = TEn
128
131
  private selectEntityById;
129
132
  private loadEntityById;
130
133
  private findInDataContext;
131
- private entityToValue;
134
+ entityToValue(entity: TEntity): TValue;
132
135
  /**
133
136
  * This method is invoked after a value has been written to this control.
134
137
  *
@@ -122,6 +122,8 @@ export declare abstract class ElderSelectBase<TId, TEntity, TValue> extends Form
122
122
  * Occurs when the suggestions data-context has changed
123
123
  */
124
124
  protected abstract onSuggestionsDcChanged(data: IDataContext<TEntity>): void;
125
+ abstract focus(options?: FocusOptions): void;
126
+ abstract blur(): void;
125
127
  /***************************************************************************
126
128
  * *
127
129
  * Internal API *
@@ -7,3 +7,10 @@ export declare class ElderSelectChipDirective {
7
7
  static ɵfac: i0.ɵɵFactoryDeclaration<ElderSelectChipDirective, never>;
8
8
  static ɵdir: i0.ɵɵDirectiveDeclaration<ElderSelectChipDirective, "[elderElderSelectChip]", never, {}, {}, never>;
9
9
  }
10
+ export declare class ElderSelectChipAvatarDirective {
11
+ templateRef: TemplateRef<any>;
12
+ viewContainer: ViewContainerRef;
13
+ constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef);
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<ElderSelectChipAvatarDirective, never>;
15
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ElderSelectChipAvatarDirective, "[elderElderSelectChipAvatar]", never, {}, {}, never>;
16
+ }
@@ -2,7 +2,7 @@ import { AfterViewInit, OnDestroy } from '@angular/core';
2
2
  import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
3
3
  import { ElderSelectBase } from './elder-select-base';
4
4
  import * as i0 from "@angular/core";
5
- export declare class ElderSelectOnTabDirective<TEntity = any, TId = any> implements AfterViewInit, OnDestroy {
5
+ export declare class ElderSelectOnTabDirective<TEntity = any, TId = any, TValue = TEntity | TId> implements AfterViewInit, OnDestroy {
6
6
  private readonly autoTrigger;
7
7
  /***************************************************************************
8
8
  * *
@@ -32,8 +32,8 @@ export declare class ElderSelectOnTabDirective<TEntity = any, TId = any> impleme
32
32
  * Event Listener *
33
33
  * *
34
34
  **************************************************************************/
35
+ onOptionSelect(): void;
35
36
  onBlur(): void;
36
- private updateValueByEntity;
37
37
  /***************************************************************************
38
38
  * *
39
39
  * Life Cycle *
@@ -41,6 +41,14 @@ export declare class ElderSelectOnTabDirective<TEntity = any, TId = any> impleme
41
41
  **************************************************************************/
42
42
  ngAfterViewInit(): void;
43
43
  ngOnDestroy(): void;
44
- static ɵfac: i0.ɵɵFactoryDeclaration<ElderSelectOnTabDirective<any, any>, [null, { skipSelf: true; }]>;
45
- static ɵdir: i0.ɵɵDirectiveDeclaration<ElderSelectOnTabDirective<any, any>, "[elderSelectOnTab]", never, {}, {}, never>;
44
+ /***************************************************************************
45
+ * *
46
+ * Private methods *
47
+ * *
48
+ **************************************************************************/
49
+ private reset;
50
+ private writeEntity;
51
+ private entityToValue;
52
+ static ɵfac: i0.ɵɵFactoryDeclaration<ElderSelectOnTabDirective<any, any, any>, [null, { skipSelf: true; }]>;
53
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ElderSelectOnTabDirective<any, any, any>, "[elderSelectOnTab]", never, {}, {}, never>;
46
54
  }
@@ -28,7 +28,7 @@ import * as i26 from "../input/autocomplete/elder-autocomplete.module";
28
28
  import * as i27 from "@angular/material/chips";
29
29
  import * as i28 from "../../pipes/elder-pipes.module";
30
30
  export { ElderSelectValueDirective } from './elder-select-value.directive';
31
- export { ElderSelectChipDirective } from './elder-select-chip.directive';
31
+ export { ElderSelectChipDirective, ElderSelectChipAvatarDirective } from './elder-select-chip.directive';
32
32
  export { ElderSelectOnTabDirective } from './elder-select-on-tab.directive';
33
33
  export { ElderSelectComponent } from './elder-select/elder-select.component';
34
34
  export { TemplatedSelectionDialogComponent, ISelectionModelDialogOptions } from './popup/templated-selection-dialog/templated-selection-dialog.component';
@@ -38,6 +38,6 @@ export { ElderMultiSelectChipsComponent } from './multi/elder-multi-select-chips
38
38
  export { ElderAutoSelectFirstDirective } from './auto/elder-auto-select-first.directive';
39
39
  export declare class ElderSelectModule {
40
40
  static ɵfac: i0.ɵɵFactoryDeclaration<ElderSelectModule, never>;
41
- static ɵmod: i0.ɵɵNgModuleDeclaration<ElderSelectModule, [typeof i1.ElderSelectComponent, typeof i2.ElderSelectValueDirective, typeof i3.TemplatedSelectionDialogComponent, typeof i4.SelectionModelPopupDirective, typeof i5.ElderSelectOnTabDirective, typeof i6.ElderMultiSelectChipsComponent, typeof i7.ElderSelectChipDirective, typeof i8.ElderAutoSelectFirstDirective], [typeof i9.CommonModule, typeof i10.FormsModule, typeof i10.ReactiveFormsModule, typeof i11.MatFormFieldModule, typeof i12.MatIconModule, typeof i13.MatSelectModule, typeof i14.MatDialogModule, typeof i15.MatButtonModule, typeof i16.MatInputModule, typeof i17.MatAutocompleteModule, typeof i18.MatToolbarModule, typeof i19.MatProgressBarModule, typeof i20.MatProgressSpinnerModule, typeof i21.FlexModule, typeof i22.TranslateModule, typeof i23.ElderFormsDirectivesModule, typeof i24.ElderTableModule, typeof i25.ElderInfiniteScrollModule, typeof i26.ElderAutocompleteModule, typeof i27.MatChipsModule, typeof i28.ElderPipesModule], [typeof i1.ElderSelectComponent, typeof i2.ElderSelectValueDirective, typeof i3.TemplatedSelectionDialogComponent, typeof i4.SelectionModelPopupDirective, typeof i6.ElderMultiSelectChipsComponent, typeof i7.ElderSelectChipDirective, typeof i8.ElderAutoSelectFirstDirective]>;
41
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ElderSelectModule, [typeof i1.ElderSelectComponent, typeof i2.ElderSelectValueDirective, typeof i3.TemplatedSelectionDialogComponent, typeof i4.SelectionModelPopupDirective, typeof i5.ElderSelectOnTabDirective, typeof i6.ElderMultiSelectChipsComponent, typeof i7.ElderSelectChipDirective, typeof i7.ElderSelectChipAvatarDirective, typeof i8.ElderAutoSelectFirstDirective], [typeof i9.CommonModule, typeof i10.FormsModule, typeof i10.ReactiveFormsModule, typeof i11.MatFormFieldModule, typeof i12.MatIconModule, typeof i13.MatSelectModule, typeof i14.MatDialogModule, typeof i15.MatButtonModule, typeof i16.MatInputModule, typeof i17.MatAutocompleteModule, typeof i18.MatToolbarModule, typeof i19.MatProgressBarModule, typeof i20.MatProgressSpinnerModule, typeof i21.FlexModule, typeof i22.TranslateModule, typeof i23.ElderFormsDirectivesModule, typeof i24.ElderTableModule, typeof i25.ElderInfiniteScrollModule, typeof i26.ElderAutocompleteModule, typeof i27.MatChipsModule, typeof i28.ElderPipesModule], [typeof i1.ElderSelectComponent, typeof i2.ElderSelectValueDirective, typeof i3.TemplatedSelectionDialogComponent, typeof i4.SelectionModelPopupDirective, typeof i6.ElderMultiSelectChipsComponent, typeof i7.ElderSelectChipDirective, typeof i7.ElderSelectChipAvatarDirective, typeof i8.ElderAutoSelectFirstDirective]>;
42
42
  static ɵinj: i0.ɵɵInjectorDeclaration<ElderSelectModule>;
43
43
  }
@@ -1,41 +1,38 @@
1
- import { OnInit, NgZone, TemplateRef } from '@angular/core';
1
+ import { NgZone, 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/common-behaviors/color';
5
5
  import * as i0 from "@angular/core";
6
- declare class SelectChip<T> {
6
+ declare class ChipModel<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 = any, TEntity = any, TValue = any> extends ElderMultiSelectBase<TId, TEntity, TValue> implements OnInit {
13
+ export declare class ElderMultiSelectChipsComponent<TId = any, TEntity = any, TValue = any> extends ElderMultiSelectBase<TId, TEntity, TValue> {
14
14
  /***************************************************************************
15
15
  * *
16
16
  * Fields *
17
17
  * *
18
18
  **************************************************************************/
19
19
  private readonly log;
20
- readonly selectChips$: Observable<SelectChip<TEntity>[]>;
20
+ readonly selectChips$: Observable<ChipModel<TEntity>[]>;
21
21
  private readonly chipColorResolver$;
22
22
  selectable: boolean;
23
23
  allowRemove: boolean;
24
+ chipColorEnabled: boolean;
24
25
  private inputControl;
25
26
  chipTemplateQuery: TemplateRef<any>;
26
27
  private _chipTemplate;
28
+ chipAvatarTemplateQuery: TemplateRef<any>;
29
+ private _chipAvatarTemplate;
27
30
  /***************************************************************************
28
31
  * *
29
32
  * Constructor *
30
33
  * *
31
34
  **************************************************************************/
32
35
  constructor(zone: NgZone);
33
- /***************************************************************************
34
- * *
35
- * Life Cycle *
36
- * *
37
- **************************************************************************/
38
- ngOnInit(): void;
39
36
  /***************************************************************************
40
37
  * *
41
38
  * Properties *
@@ -43,6 +40,8 @@ export declare class ElderMultiSelectChipsComponent<TId = any, TEntity = any, TV
43
40
  **************************************************************************/
44
41
  set chipTemplate(template: TemplateRef<any>);
45
42
  get chipTemplate(): TemplateRef<any>;
43
+ set chipAvatarTemplate(template: TemplateRef<any>);
44
+ get chipAvatarTemplate(): TemplateRef<any>;
46
45
  /**
47
46
  * A function which returns the color of a given label object.
48
47
  */
@@ -55,6 +54,10 @@ export declare class ElderMultiSelectChipsComponent<TId = any, TEntity = any, TV
55
54
  * *
56
55
  **************************************************************************/
57
56
  onOptionSelected(selectedValue: TEntity): void;
57
+ resolveChipValue(e1: TEntity): any;
58
+ get compareWithFn(): (e1: TEntity, e2: TEntity) => boolean;
59
+ focus(options?: FocusOptions): void;
60
+ blur(): void;
58
61
  /***************************************************************************
59
62
  * *
60
63
  * Private methods *
@@ -63,6 +66,6 @@ export declare class ElderMultiSelectChipsComponent<TId = any, TEntity = any, TV
63
66
  private isAlreadyPresent;
64
67
  private resetInput;
65
68
  static ɵfac: i0.ɵɵFactoryDeclaration<ElderMultiSelectChipsComponent<any, any, any>, never>;
66
- static ɵcmp: i0.ɵɵComponentDeclaration<ElderMultiSelectChipsComponent<any, any, any>, "elder-multi-select-chips", never, { "allowRemove": "allowRemove"; "chipTemplate": "chipTemplate"; "chipColorResolver": "chipColorResolver"; }, {}, ["chipTemplateQuery"], never>;
69
+ static ɵcmp: i0.ɵɵComponentDeclaration<ElderMultiSelectChipsComponent<any, any, any>, "elder-multi-select-chips", never, { "allowRemove": "allowRemove"; "chipColorEnabled": "chipColorEnabled"; "chipTemplate": "chipTemplate"; "chipColorResolver": "chipColorResolver"; }, {}, ["chipTemplateQuery", "chipAvatarTemplateQuery"], never>;
67
70
  }
68
71
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elderbyte/ngx-starter",
3
- "version": "13.9.0",
3
+ "version": "13.9.3",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^13.0.0",
6
6
  "@angular/core": "^13.0.0",
@@ -28,6 +28,18 @@
28
28
  height: 16px;
29
29
  }
30
30
 
31
+ .suffix-icon {
32
+ font-size: 16px;
33
+ width: 16px;
34
+ height: 16px;
35
+ // padding-left: 4px;
36
+ .mat-icon {
37
+ font-size: 16px;
38
+ width: 16px;
39
+ height: 16px;
40
+ }
41
+ }
42
+
31
43
  .clickable-icon {
32
44
  cursor: pointer;
33
45
  }
@@ -9,6 +9,26 @@
9
9
  height: 16px;
10
10
  }
11
11
 
12
+ .elder-chip-input {
13
+ width: 120px!important;
14
+ max-width: 120px!important;
15
+ }
16
+
17
+ .small-icon-button {
18
+ width: 24px !important;
19
+ height: 24px !important;
20
+ line-height: 24px !important;
21
+
22
+ .mat-icon {
23
+ width: 16px !important;
24
+ height: 16px !important;
25
+ line-height: 16px !important;
26
+ }
27
+ .material-icons {
28
+ font-size: 16px !important;
29
+ }
30
+ }
31
+
12
32
  .clickable-chip {
13
33
  cursor: pointer;
14
34
  }