@arsedizioni/ars-utils 19.0.16 → 19.0.18

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.
@@ -2218,11 +2218,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
2218
2218
  class ChipsSelectorComponent {
2219
2219
  set value(value) {
2220
2220
  this._value = value;
2221
- this.propagateChange(this._value);
2222
- this.stateChanges.next();
2223
- if (this.changesEnabled) {
2224
- this.changed.emit(this._value);
2225
- }
2226
2221
  this.selection = [];
2227
2222
  this.singleSelection = null;
2228
2223
  if (this._value) {
@@ -2235,6 +2230,11 @@ class ChipsSelectorComponent {
2235
2230
  this.singleSelection = this.selection[0];
2236
2231
  }
2237
2232
  }
2233
+ this.propagateChange(this._value);
2234
+ this.stateChanges.next();
2235
+ if (this.changesEnabled) {
2236
+ this.changed.emit(this._value);
2237
+ }
2238
2238
  }
2239
2239
  get value() {
2240
2240
  return this._value;
@@ -2361,7 +2361,7 @@ class ChipsSelectorComponent {
2361
2361
  setTimeout(() => {
2362
2362
  const value = !this.multiple() && this.collapsed() && this.collapsedDisplayMode() === "button"
2363
2363
  ? this.singleSelection
2364
- : this.selection;
2364
+ : this.selection ?? [];
2365
2365
  const isArray = Array.isArray(value);
2366
2366
  if (isArray) {
2367
2367
  this.writeValue(value);
@@ -2375,8 +2375,9 @@ class ChipsSelectorComponent {
2375
2375
  * Check if a item is selectable
2376
2376
  */
2377
2377
  isSelectable(item) {
2378
- return (this.selection.findIndex(x => x.value === item.value) !== -1 || this.singleSelection?.value === item.value)
2379
- && this.mustSelect();
2378
+ return (!this.multiple() && this.collapsed() && this.collapsedDisplayMode() === "button"
2379
+ ? this.singleSelection?.value === item.value
2380
+ : this.selection?.findIndex(x => x.value === item.value) !== -1);
2380
2381
  }
2381
2382
  writeValue(value) {
2382
2383
  if (this.value !== value) {