@seniorsistemas/angular-components 17.6.1 → 17.6.3

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,47 @@
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 (a === undefined || b === undefined || typeof a !== "object" || a === null || typeof b !== "object" || b === null) {
15418
+ return false;
15419
+ }
15420
+ if (Array.isArray(a) !== Array.isArray(b)) {
15421
+ return false;
15422
+ }
15423
+ var keysA = Object.keys(a);
15424
+ var keysB = Object.keys(b);
15425
+ if (keysA.length !== keysB.length) {
15426
+ return false;
15427
+ }
15428
+ try {
15429
+ for (var keysA_1 = __values(keysA), keysA_1_1 = keysA_1.next(); !keysA_1_1.done; keysA_1_1 = keysA_1.next()) {
15430
+ var key = keysA_1_1.value;
15431
+ if (!keysB.includes(key) || !_compare(a[key], b[key])) {
15432
+ return false;
15433
+ }
15434
+ }
15435
+ }
15436
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
15437
+ finally {
15438
+ try {
15439
+ if (keysA_1_1 && !keysA_1_1.done && (_a = keysA_1.return)) _a.call(keysA_1);
15440
+ }
15441
+ finally { if (e_1) throw e_1.error; }
15442
+ }
15443
+ for (var key in a) {
15444
+ if (a.hasOwnProperty(key) !== b.hasOwnProperty(key)) {
15445
+ return false;
15446
+ }
15447
+ }
15448
+ return true;
15449
+ };
15450
+ return _compare(item1, item2);
15451
+ };
15401
15452
  var SelectButtonComponent_1;
15402
15453
  __decorate([
15403
15454
  core.Input()
@@ -15415,11 +15466,13 @@
15415
15466
  core.Component({
15416
15467
  selector: "s-select-button",
15417
15468
  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: [{
15469
+ providers: [
15470
+ {
15419
15471
  provide: forms.NG_VALUE_ACCESSOR,
15420
15472
  useExisting: core.forwardRef(function () { return SelectButtonComponent_1; }),
15421
15473
  multi: true,
15422
- }],
15474
+ },
15475
+ ],
15423
15476
  styles: [".select-button{overflow:hidden}"]
15424
15477
  })
15425
15478
  ], SelectButtonComponent);