@seniorsistemas/angular-components 17.6.1 → 17.6.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.
@@ -15370,10 +15370,20 @@
15370
15370
  return;
15371
15371
  this.activeItems.clear();
15372
15372
  if (Array.isArray(value)) {
15373
- value.forEach(function (item) { return _this.activeItems.add(item); });
15373
+ value.forEach(function (item) {
15374
+ _this.items.forEach(function (iItem) {
15375
+ if (_this._compareItems(item, iItem)) {
15376
+ _this.activeItems.add(iItem);
15377
+ }
15378
+ });
15379
+ });
15374
15380
  }
15375
15381
  else {
15376
- this.activeItems.add(value);
15382
+ this.items.forEach(function (iItem) {
15383
+ if (_this._compareItems(value, iItem)) {
15384
+ _this.activeItems.add(iItem);
15385
+ }
15386
+ });
15377
15387
  }
15378
15388
  };
15379
15389
  SelectButtonComponent.prototype.registerOnChange = function (onChange) {
@@ -15398,6 +15408,39 @@
15398
15408
  (_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this, __spread(this.activeItems));
15399
15409
  (_b = this.onTouched) === null || _b === void 0 ? void 0 : _b.call(this, __spread(this.activeItems));
15400
15410
  };
15411
+ SelectButtonComponent.prototype._compareItems = function (item1, item2) {
15412
+ var _compare = function (a, b) {
15413
+ var e_1, _a;
15414
+ if (a === b) {
15415
+ return true;
15416
+ }
15417
+ if (typeof a !== "object" || a === null || typeof b !== "object" || b === null) {
15418
+ return false;
15419
+ }
15420
+ var keysA = Object.keys(a);
15421
+ var keysB = Object.keys(b);
15422
+ if (keysA.length !== keysB.length) {
15423
+ return false;
15424
+ }
15425
+ try {
15426
+ for (var keysA_1 = __values(keysA), keysA_1_1 = keysA_1.next(); !keysA_1_1.done; keysA_1_1 = keysA_1.next()) {
15427
+ var key = keysA_1_1.value;
15428
+ if (!keysB.includes(key) || !_compare(a[key], b[key])) {
15429
+ return false;
15430
+ }
15431
+ }
15432
+ }
15433
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
15434
+ finally {
15435
+ try {
15436
+ if (keysA_1_1 && !keysA_1_1.done && (_a = keysA_1.return)) _a.call(keysA_1);
15437
+ }
15438
+ finally { if (e_1) throw e_1.error; }
15439
+ }
15440
+ return true;
15441
+ };
15442
+ return _compare(item1, item2);
15443
+ };
15401
15444
  var SelectButtonComponent_1;
15402
15445
  __decorate([
15403
15446
  core.Input()
@@ -15415,11 +15458,13 @@
15415
15458
  core.Component({
15416
15459
  selector: "s-select-button",
15417
15460
  template: "<div\n class=\"select-button\"\n [ngClass]=\"{ 'select-button--disabled': disabled }\">\n <s-select-button-item\n *ngFor=\"let item of items; index as i\"\n [label]=\"item.label\"\n [active]=\"activeItems?.has(item)\"\n [disabled]=\"disabled || item.disabled\"\n [first]=\"i === 0\"\n [last]=\"i === items.length - 1\"\n (click)=\"onItemSelect(item)\">\n </s-select-button-item>\n</div>",
15418
- providers: [{
15461
+ providers: [
15462
+ {
15419
15463
  provide: forms.NG_VALUE_ACCESSOR,
15420
15464
  useExisting: core.forwardRef(function () { return SelectButtonComponent_1; }),
15421
15465
  multi: true,
15422
- }],
15466
+ },
15467
+ ],
15423
15468
  styles: [".select-button{overflow:hidden}"]
15424
15469
  })
15425
15470
  ], SelectButtonComponent);