@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.
@@ -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,47 @@ 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 (a === undefined || b === undefined || typeof a !== "object" || a === null || typeof b !== "object" || b === null) {
15271
+ return false;
15272
+ }
15273
+ if (Array.isArray(a) !== Array.isArray(b)) {
15274
+ return false;
15275
+ }
15276
+ var keysA = Object.keys(a);
15277
+ var keysB = Object.keys(b);
15278
+ if (keysA.length !== keysB.length) {
15279
+ return false;
15280
+ }
15281
+ try {
15282
+ for (var keysA_1 = __values(keysA), keysA_1_1 = keysA_1.next(); !keysA_1_1.done; keysA_1_1 = keysA_1.next()) {
15283
+ var key = keysA_1_1.value;
15284
+ if (!keysB.includes(key) || !_compare(a[key], b[key])) {
15285
+ return false;
15286
+ }
15287
+ }
15288
+ }
15289
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
15290
+ finally {
15291
+ try {
15292
+ if (keysA_1_1 && !keysA_1_1.done && (_a = keysA_1.return)) _a.call(keysA_1);
15293
+ }
15294
+ finally { if (e_1) throw e_1.error; }
15295
+ }
15296
+ for (var key in a) {
15297
+ if (a.hasOwnProperty(key) !== b.hasOwnProperty(key)) {
15298
+ return false;
15299
+ }
15300
+ }
15301
+ return true;
15302
+ };
15303
+ return _compare(item1, item2);
15304
+ };
15254
15305
  var SelectButtonComponent_1;
15255
15306
  __decorate([
15256
15307
  Input()
@@ -15268,11 +15319,13 @@ var SelectButtonComponent = /** @class */ (function () {
15268
15319
  Component({
15269
15320
  selector: "s-select-button",
15270
15321
  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: [{
15322
+ providers: [
15323
+ {
15272
15324
  provide: NG_VALUE_ACCESSOR,
15273
15325
  useExisting: forwardRef(function () { return SelectButtonComponent_1; }),
15274
15326
  multi: true,
15275
- }],
15327
+ },
15328
+ ],
15276
15329
  styles: [".select-button{overflow:hidden}"]
15277
15330
  })
15278
15331
  ], SelectButtonComponent);