@elderbyte/ngx-starter 13.9.2 → 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.
- package/esm2020/lib/components/select/elder-entity-value-accessor.mjs +5 -4
- package/esm2020/lib/components/select/elder-select/elder-select.component.mjs +1 -1
- package/esm2020/lib/components/select/elder-select-on-tab.directive.mjs +42 -19
- package/fesm2015/elderbyte-ngx-starter.mjs +44 -20
- package/fesm2015/elderbyte-ngx-starter.mjs.map +1 -1
- package/fesm2020/elderbyte-ngx-starter.mjs +44 -20
- package/fesm2020/elderbyte-ngx-starter.mjs.map +1 -1
- package/lib/components/select/elder-entity-value-accessor.d.ts +7 -2
- package/lib/components/select/elder-select/elder-select.component.d.ts +2 -2
- package/lib/components/select/elder-select-on-tab.directive.d.ts +12 -4
- package/package.json +1 -1
|
@@ -20782,11 +20782,12 @@ function isElderEntityValueAccessor(object) {
|
|
|
20782
20782
|
return false;
|
|
20783
20783
|
}
|
|
20784
20784
|
const vac = object;
|
|
20785
|
-
return
|
|
20786
|
-
&&
|
|
20785
|
+
return 'entity' in vac // This might be undefined
|
|
20786
|
+
&& 'entityId' in vac // This might be undefined
|
|
20787
20787
|
&& vac.entityIdChange !== undefined
|
|
20788
20788
|
&& vac.entityChange !== undefined
|
|
20789
|
-
&& vac.updateValueByEntity !== undefined
|
|
20789
|
+
&& vac.updateValueByEntity !== undefined
|
|
20790
|
+
&& vac.entityToValue !== undefined;
|
|
20790
20791
|
}
|
|
20791
20792
|
|
|
20792
20793
|
class ElderSelectOnTabDirective {
|
|
@@ -20820,6 +20821,9 @@ class ElderSelectOnTabDirective {
|
|
|
20820
20821
|
* Event Listener *
|
|
20821
20822
|
* *
|
|
20822
20823
|
**************************************************************************/
|
|
20824
|
+
onOptionSelect() {
|
|
20825
|
+
this.userInput = true;
|
|
20826
|
+
}
|
|
20823
20827
|
onBlur() {
|
|
20824
20828
|
if (!this.panelOpen) {
|
|
20825
20829
|
return;
|
|
@@ -20834,21 +20838,9 @@ class ElderSelectOnTabDirective {
|
|
|
20834
20838
|
const activeOption = this.autoTrigger.activeOption;
|
|
20835
20839
|
if (activeOption) {
|
|
20836
20840
|
const entity = activeOption.value;
|
|
20837
|
-
this.
|
|
20838
|
-
this.autoTrigger.writeValue(entity);
|
|
20839
|
-
this.logger.warn('Wrote option.value to control: ', entity);
|
|
20840
|
-
}
|
|
20841
|
-
}
|
|
20842
|
-
updateValueByEntity(entity) {
|
|
20843
|
-
if (isElderEntityValueAccessor(this.controlValueAccessor)) {
|
|
20844
|
-
// Since elder-select may use the entity id as value (valueAsId),
|
|
20845
|
-
// we can not directly write to the value safely.
|
|
20846
|
-
this.controlValueAccessor.updateValueByEntity(entity);
|
|
20847
|
-
}
|
|
20848
|
-
else {
|
|
20849
|
-
// By default, write the selected option to the control value
|
|
20850
|
-
this.controlValueAccessor.updateValue(entity);
|
|
20841
|
+
this.writeEntity(entity);
|
|
20851
20842
|
}
|
|
20843
|
+
this.reset();
|
|
20852
20844
|
}
|
|
20853
20845
|
/***************************************************************************
|
|
20854
20846
|
* *
|
|
@@ -20859,15 +20851,41 @@ class ElderSelectOnTabDirective {
|
|
|
20859
20851
|
const autocomplete = this.autoTrigger.autocomplete;
|
|
20860
20852
|
merge(autocomplete.opened.pipe(map(() => true)), autocomplete.closed.pipe(map(() => false))).pipe(takeUntil(this.destroy$), delay(0)).subscribe(value => this.panelOpen = value);
|
|
20861
20853
|
this.autoTrigger.optionSelections.pipe(// TODO https://github.com/angular/components/pull/14813
|
|
20862
|
-
takeUntil(this.destroy$), map(opt => opt.isUserInput)).subscribe(isUserInput => this.userInput = isUserInput);
|
|
20854
|
+
takeUntil(this.destroy$), tap(opt => this.logger.debug('[optionSelections] CHANGED ', opt)), map(opt => opt.isUserInput)).subscribe(isUserInput => this.userInput = isUserInput);
|
|
20863
20855
|
}
|
|
20864
20856
|
ngOnDestroy() {
|
|
20865
20857
|
this.destroy$.next();
|
|
20866
20858
|
this.destroy$.complete();
|
|
20867
20859
|
}
|
|
20860
|
+
/***************************************************************************
|
|
20861
|
+
* *
|
|
20862
|
+
* Private methods *
|
|
20863
|
+
* *
|
|
20864
|
+
**************************************************************************/
|
|
20865
|
+
reset() {
|
|
20866
|
+
this.userInput = false;
|
|
20867
|
+
}
|
|
20868
|
+
writeEntity(entity) {
|
|
20869
|
+
const value = this.entityToValue(entity);
|
|
20870
|
+
this.controlValueAccessor.updateValue(value);
|
|
20871
|
+
this.autoTrigger.writeValue(value);
|
|
20872
|
+
this.logger.warn('Wrote entity to control as value: ', value);
|
|
20873
|
+
}
|
|
20874
|
+
entityToValue(entity) {
|
|
20875
|
+
if (isElderEntityValueAccessor(this.controlValueAccessor)) {
|
|
20876
|
+
// Since elder-select may use the entity id as value (valueAsId),
|
|
20877
|
+
// we can not directly write to the value safely.
|
|
20878
|
+
return this.controlValueAccessor.entityToValue(entity);
|
|
20879
|
+
}
|
|
20880
|
+
else {
|
|
20881
|
+
// By default, write the selected option to the control value
|
|
20882
|
+
this.logger.warn('[controlValueAccessor] is not a ElderEntityValueAccessor!: ', this.controlValueAccessor);
|
|
20883
|
+
return entity;
|
|
20884
|
+
}
|
|
20885
|
+
}
|
|
20868
20886
|
}
|
|
20869
20887
|
ElderSelectOnTabDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.10", ngImport: i0, type: ElderSelectOnTabDirective, deps: [{ token: i1$6.MatAutocompleteTrigger }, { token: ELDER_SELECT_BASE, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
20870
|
-
ElderSelectOnTabDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.10", type: ElderSelectOnTabDirective, selector: "[elderSelectOnTab]", host: { listeners: { "keydown.tab": "onBlur()" } }, ngImport: i0 });
|
|
20888
|
+
ElderSelectOnTabDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.10", type: ElderSelectOnTabDirective, selector: "[elderSelectOnTab]", host: { listeners: { "keydown.arrowup": "onOptionSelect()", "keydown.arrowdown": "onOptionSelect()", "keydown.tab": "onBlur()" } }, ngImport: i0 });
|
|
20871
20889
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.10", ngImport: i0, type: ElderSelectOnTabDirective, decorators: [{
|
|
20872
20890
|
type: Directive,
|
|
20873
20891
|
args: [{
|
|
@@ -20878,7 +20896,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.10", ngImpo
|
|
|
20878
20896
|
}, {
|
|
20879
20897
|
type: Inject,
|
|
20880
20898
|
args: [ELDER_SELECT_BASE]
|
|
20881
|
-
}] }]; }, propDecorators: {
|
|
20899
|
+
}] }]; }, propDecorators: { onOptionSelect: [{
|
|
20900
|
+
type: HostListener,
|
|
20901
|
+
args: ['keydown.arrowup']
|
|
20902
|
+
}, {
|
|
20903
|
+
type: HostListener,
|
|
20904
|
+
args: ['keydown.arrowdown']
|
|
20905
|
+
}], onBlur: [{
|
|
20882
20906
|
type: HostListener,
|
|
20883
20907
|
args: ['keydown.tab']
|
|
20884
20908
|
}] } });
|