@apipass/inputs 0.2.1-alpha.14 → 0.2.1-alpha.15

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.
@@ -1264,15 +1264,7 @@
1264
1264
  event.stopPropagation();
1265
1265
  };
1266
1266
  SelectBoxComponent.prototype.onSelectionChange = function (event) {
1267
- var _this = this;
1268
- var _a, _b;
1269
- if (this.selectProperty) {
1270
- this.selectedItem = (_a = this.data) === null || _a === void 0 ? void 0 : _a.find(function (el) { return el[_this.bindKey] === _this.value; });
1271
- }
1272
- else {
1273
- this.selectedItem = (_b = this.data) === null || _b === void 0 ? void 0 : _b.find(function (el) { return el[_this.bindKey] === _this.value[_this.bindKey]; });
1274
- console.log('else -> ', this.selectedItem);
1275
- }
1267
+ this.findSelectedItem(this.value);
1276
1268
  this.onSelectChange.emit(this.selectedItem);
1277
1269
  };
1278
1270
  SelectBoxComponent.prototype.openSelectBox = function ($event) {
@@ -1298,6 +1290,22 @@
1298
1290
  }
1299
1291
  this.onAddNewItemClick.next();
1300
1292
  };
1293
+ SelectBoxComponent.prototype.writeValue = function (value) {
1294
+ _super.prototype.writeValue.call(this, value);
1295
+ if (value) {
1296
+ this.findSelectedItem(value);
1297
+ }
1298
+ };
1299
+ SelectBoxComponent.prototype.findSelectedItem = function (value) {
1300
+ var _this = this;
1301
+ var _a, _b;
1302
+ if (this.selectProperty) {
1303
+ this.selectedItem = (_a = this.data) === null || _a === void 0 ? void 0 : _a.find(function (el) { return el[_this.bindKey] === value; });
1304
+ }
1305
+ else {
1306
+ this.selectedItem = (_b = this.data) === null || _b === void 0 ? void 0 : _b.find(function (el) { return el[_this.bindKey] === value[_this.bindKey]; });
1307
+ }
1308
+ };
1301
1309
  return SelectBoxComponent;
1302
1310
  }(ValueAccessorBase));
1303
1311
  SelectBoxComponent.ɵfac = function SelectBoxComponent_Factory(t) { return ɵSelectBoxComponent_BaseFactory(t || SelectBoxComponent); };