@tetacom/ng-components 1.0.88 → 1.0.90
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/component/select/select/select.component.d.ts +4 -1
- package/esm2020/component/select/select/select.component.mjs +30 -16
- package/fesm2015/tetacom-ng-components.mjs +30 -16
- package/fesm2015/tetacom-ng-components.mjs.map +1 -1
- package/fesm2020/tetacom-ng-components.mjs +29 -15
- package/fesm2020/tetacom-ng-components.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -4902,6 +4902,15 @@ class SelectComponent {
|
|
|
4902
4902
|
};
|
|
4903
4903
|
this.locale = this._config.locale;
|
|
4904
4904
|
}
|
|
4905
|
+
set options(options) {
|
|
4906
|
+
this._options = options;
|
|
4907
|
+
if (this._internalValue !== null && this._internalValue !== undefined && this.options) {
|
|
4908
|
+
this.getSelectedValue(this._internalValue);
|
|
4909
|
+
}
|
|
4910
|
+
}
|
|
4911
|
+
get options() {
|
|
4912
|
+
return this._options;
|
|
4913
|
+
}
|
|
4905
4914
|
get tabindex() {
|
|
4906
4915
|
return this.disabled ? null : 0;
|
|
4907
4916
|
}
|
|
@@ -4941,11 +4950,13 @@ class SelectComponent {
|
|
|
4941
4950
|
else {
|
|
4942
4951
|
this.value = [...this.value, option];
|
|
4943
4952
|
}
|
|
4944
|
-
this.
|
|
4953
|
+
this._internalValue = this.value.map((_) => this.getValue(_));
|
|
4954
|
+
this.onChange(this._internalValue);
|
|
4945
4955
|
}
|
|
4946
4956
|
else {
|
|
4947
4957
|
this.value = option;
|
|
4948
|
-
this.
|
|
4958
|
+
this._internalValue = this.getValue(this.value);
|
|
4959
|
+
this.onChange(this._internalValue);
|
|
4949
4960
|
this.open = false;
|
|
4950
4961
|
}
|
|
4951
4962
|
this._cdr.markForCheck();
|
|
@@ -4962,7 +4973,8 @@ class SelectComponent {
|
|
|
4962
4973
|
removeItemClick(option, event) {
|
|
4963
4974
|
event.stopPropagation();
|
|
4964
4975
|
this.removeItem(option);
|
|
4965
|
-
this.
|
|
4976
|
+
this._internalValue = this.value.map((_) => this.getValue(_));
|
|
4977
|
+
this.onChange(this._internalValue);
|
|
4966
4978
|
}
|
|
4967
4979
|
removeItem(option) {
|
|
4968
4980
|
this.value = this.value.filter((_) => _ !== option);
|
|
@@ -5009,17 +5021,8 @@ class SelectComponent {
|
|
|
5009
5021
|
ngOnInit() {
|
|
5010
5022
|
}
|
|
5011
5023
|
writeValue(value) {
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
value && this.options
|
|
5015
|
-
? this.options.filter((option) => value.indexOf(this.getValue(option)) > -1)
|
|
5016
|
-
: [];
|
|
5017
|
-
}
|
|
5018
|
-
else {
|
|
5019
|
-
this.value =
|
|
5020
|
-
this.options &&
|
|
5021
|
-
this.options?.find((option) => this.getValue(option) === value);
|
|
5022
|
-
}
|
|
5024
|
+
this._internalValue = value;
|
|
5025
|
+
this.getSelectedValue(value);
|
|
5023
5026
|
this._cdr.detectChanges();
|
|
5024
5027
|
}
|
|
5025
5028
|
registerOnChange(fn) {
|
|
@@ -5032,7 +5035,18 @@ class SelectComponent {
|
|
|
5032
5035
|
this.disabled = isDisabled;
|
|
5033
5036
|
this._cdr.markForCheck();
|
|
5034
5037
|
}
|
|
5035
|
-
getSelectedValue() {
|
|
5038
|
+
getSelectedValue(value) {
|
|
5039
|
+
if (this.multiple) {
|
|
5040
|
+
this.value =
|
|
5041
|
+
value && this.options
|
|
5042
|
+
? this.options.filter((option) => value.indexOf(this.getValue(option)) > -1)
|
|
5043
|
+
: [];
|
|
5044
|
+
}
|
|
5045
|
+
else {
|
|
5046
|
+
this.value =
|
|
5047
|
+
this.options &&
|
|
5048
|
+
this.options?.find((option) => this.getValue(option) === value);
|
|
5049
|
+
}
|
|
5036
5050
|
}
|
|
5037
5051
|
}
|
|
5038
5052
|
SelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.2", ngImport: i0, type: SelectComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: TetaConfigService }], target: i0.ɵɵFactoryTarget.Component });
|