@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.
@@ -15223,10 +15223,20 @@ var SelectButtonComponent = /** @class */ (function () {
15223
15223
  return;
15224
15224
  this.activeItems.clear();
15225
15225
  if (Array.isArray(value)) {
15226
- value.forEach(function (item) { return _this.activeItems.add(item); });
15226
+ value.forEach(function (item) {
15227
+ _this.items.forEach(function (iItem) {
15228
+ if (_this._compareItems(item, iItem)) {
15229
+ _this.activeItems.add(iItem);
15230
+ }
15231
+ });
15232
+ });
15227
15233
  }
15228
15234
  else {
15229
- this.activeItems.add(value);
15235
+ this.items.forEach(function (iItem) {
15236
+ if (_this._compareItems(value, iItem)) {
15237
+ _this.activeItems.add(iItem);
15238
+ }
15239
+ });
15230
15240
  }
15231
15241
  };
15232
15242
  SelectButtonComponent.prototype.registerOnChange = function (onChange) {
@@ -15251,6 +15261,39 @@ var SelectButtonComponent = /** @class */ (function () {
15251
15261
  (_a = this.onChange) === null || _a === void 0 ? void 0 : _a.call(this, __spread(this.activeItems));
15252
15262
  (_b = this.onTouched) === null || _b === void 0 ? void 0 : _b.call(this, __spread(this.activeItems));
15253
15263
  };
15264
+ SelectButtonComponent.prototype._compareItems = function (item1, item2) {
15265
+ var _compare = function (a, b) {
15266
+ var e_1, _a;
15267
+ if (a === b) {
15268
+ return true;
15269
+ }
15270
+ if (typeof a !== "object" || a === null || typeof b !== "object" || b === null) {
15271
+ return false;
15272
+ }
15273
+ var keysA = Object.keys(a);
15274
+ var keysB = Object.keys(b);
15275
+ if (keysA.length !== keysB.length) {
15276
+ return false;
15277
+ }
15278
+ try {
15279
+ for (var keysA_1 = __values(keysA), keysA_1_1 = keysA_1.next(); !keysA_1_1.done; keysA_1_1 = keysA_1.next()) {
15280
+ var key = keysA_1_1.value;
15281
+ if (!keysB.includes(key) || !_compare(a[key], b[key])) {
15282
+ return false;
15283
+ }
15284
+ }
15285
+ }
15286
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
15287
+ finally {
15288
+ try {
15289
+ if (keysA_1_1 && !keysA_1_1.done && (_a = keysA_1.return)) _a.call(keysA_1);
15290
+ }
15291
+ finally { if (e_1) throw e_1.error; }
15292
+ }
15293
+ return true;
15294
+ };
15295
+ return _compare(item1, item2);
15296
+ };
15254
15297
  var SelectButtonComponent_1;
15255
15298
  __decorate([
15256
15299
  Input()
@@ -15268,11 +15311,13 @@ var SelectButtonComponent = /** @class */ (function () {
15268
15311
  Component({
15269
15312
  selector: "s-select-button",
15270
15313
  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>",
15271
- providers: [{
15314
+ providers: [
15315
+ {
15272
15316
  provide: NG_VALUE_ACCESSOR,
15273
15317
  useExisting: forwardRef(function () { return SelectButtonComponent_1; }),
15274
15318
  multi: true,
15275
- }],
15319
+ },
15320
+ ],
15276
15321
  styles: [".select-button{overflow:hidden}"]
15277
15322
  })
15278
15323
  ], SelectButtonComponent);