@seniorsistemas/angular-components 17.6.0 → 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.
@@ -15368,9 +15368,23 @@
15368
15368
  var _this = this;
15369
15369
  if (!value)
15370
15370
  return;
15371
- value.forEach(function (item) {
15372
- _this.activeItems.add(item);
15373
- });
15371
+ this.activeItems.clear();
15372
+ if (Array.isArray(value)) {
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
+ });
15380
+ }
15381
+ else {
15382
+ this.items.forEach(function (iItem) {
15383
+ if (_this._compareItems(value, iItem)) {
15384
+ _this.activeItems.add(iItem);
15385
+ }
15386
+ });
15387
+ }
15374
15388
  };
15375
15389
  SelectButtonComponent.prototype.registerOnChange = function (onChange) {
15376
15390
  this.onChange = onChange;
@@ -15394,6 +15408,39 @@
15394
15408
  (_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this, __spread(this.activeItems));
15395
15409
  (_b = this.onTouched) === null || _b === void 0 ? void 0 : _b.call(this, __spread(this.activeItems));
15396
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
+ };
15397
15444
  var SelectButtonComponent_1;
15398
15445
  __decorate([
15399
15446
  core.Input()
@@ -15411,11 +15458,13 @@
15411
15458
  core.Component({
15412
15459
  selector: "s-select-button",
15413
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>",
15414
- providers: [{
15461
+ providers: [
15462
+ {
15415
15463
  provide: forms.NG_VALUE_ACCESSOR,
15416
15464
  useExisting: core.forwardRef(function () { return SelectButtonComponent_1; }),
15417
15465
  multi: true,
15418
- }],
15466
+ },
15467
+ ],
15419
15468
  styles: [".select-button{overflow:hidden}"]
15420
15469
  })
15421
15470
  ], SelectButtonComponent);