@coolon/angular-ui-powerups 14.38.1 → 14.38.2

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.
@@ -2059,8 +2059,10 @@ class MultipleSelectInputComponent extends AbstractListInputComponent {
2059
2059
  const lookup = chain(this.options$).indexUsing(this.options$.identityOf);
2060
2060
  const self = this;
2061
2061
  this.registerDisposable(new Binding(this.componentList$, this.ids$, {
2062
- toLeft(rightValue, currentLeftValue) {
2063
- return rightValue ? rightValue.map(it => lookup.get(it)) : [];
2062
+ toLeft(selectedItems, currentLeftValue) {
2063
+ const newValues = selectedItems.map(it => lookup.get(it)).filter(it => !it);
2064
+ // if our lookup didn't find anything then we return the previous values so we don't clobber selections when the options go empty
2065
+ return newValues.length < 1 && selectedItems.length > 0 ? currentLeftValue : newValues;
2064
2066
  },
2065
2067
  leftDependsOn: lookup,
2066
2068
  toRight(leftValue, currentRightValue) {
@@ -2165,10 +2167,9 @@ class SelectInputComponent extends AbstractValueInputComponent {
2165
2167
  const lookup = chain(this.options$).indexUsing(this.options$.identityOf);
2166
2168
  const self = this;
2167
2169
  this.registerDisposable(new Binding(this.componentValue$, this.id$, {
2168
- toLeft(rightValue, currentLeftValue) {
2169
- const value = lookup.get(rightValue);
2170
- console.log("currentValue", { id: rightValue, value });
2171
- return value;
2170
+ toLeft(currentId, currentValue) {
2171
+ const newValue = lookup.get(currentId); // the list is empty or we're missing form it so don't touch the real value.
2172
+ return isNil(newValue) ? currentValue : newValue;
2172
2173
  },
2173
2174
  leftDependsOn: lookup,
2174
2175
  toRight(leftValue, currentRightValue) {