@seniorsistemas/angular-components 17.2.7 → 17.2.8

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.
@@ -210,9 +210,9 @@
210
210
  this.cache = false;
211
211
  this.panelOpened = new core.EventEmitter();
212
212
  this.panelClosed = new core.EventEmitter();
213
- this._isOpen = false;
214
213
  this.isAnimating = false;
215
214
  this.isContentAnimationDisabled = true;
215
+ this._isOpen = false;
216
216
  }
217
217
  Object.defineProperty(AccordionPanelComponent.prototype, "isOpen", {
218
218
  get: function () {
@@ -224,9 +224,16 @@
224
224
  enumerable: true,
225
225
  configurable: true
226
226
  });
227
- AccordionPanelComponent.prototype.ngOnInit = function () {
228
- if (this.switch) {
229
- this.switchState = this.switch.state;
227
+ AccordionPanelComponent.prototype.ngOnChanges = function (changes) {
228
+ if ("disabled" in changes) {
229
+ if (this.switchControl) {
230
+ changes["disabled"].currentValue
231
+ ? this.switchControl.disable({ emitEvent: false })
232
+ : this.switchControl.enable({ emitEvent: false });
233
+ }
234
+ }
235
+ if ("switch" in changes && "switchControl" in changes) {
236
+ throw new Error("You can't set switch and switchControl together.");
230
237
  }
231
238
  };
232
239
  AccordionPanelComponent.prototype.ngAfterViewInit = function () {
@@ -273,6 +280,9 @@
273
280
  __decorate([
274
281
  core.Input()
275
282
  ], AccordionPanelComponent.prototype, "switch", void 0);
283
+ __decorate([
284
+ core.Input()
285
+ ], AccordionPanelComponent.prototype, "switchControl", void 0);
276
286
  __decorate([
277
287
  core.Input()
278
288
  ], AccordionPanelComponent.prototype, "validationMessage", void 0);
@@ -288,7 +298,7 @@
288
298
  AccordionPanelComponent = __decorate([
289
299
  core.Component({
290
300
  selector: "s-accordion-panel",
291
- template: "<div\n class=\"accordion-panel\"\n [ngClass]=\"{\n 'accordion-panel--open': isOpen,\n 'accordion-panel--disabled': disabled\n }\">\n <div class=\"header\" (click)=\"onTabClick()\">\n <div class=\"header__title\">\n <span class=\"icon\" [ngClass]=\"isOpen ? 'fas fa-minus' : 'fas fa-plus'\"></span>\n <span\n *ngIf=\"validationMessage\"\n class=\"exclamation-icon fas fa-exclamation-circle\"\n [sTooltip]=\"validationMessage\">\n </span>\n <span class=\"title\">{{ header }}</span>\n </div>\n <div class=\"header__controls\">\n <button\n *ngFor=\"let button of buttons\"\n class=\"icon-button\"\n [ngClass]=\"button.icon\"\n (click)=\"onIconButtonsClick($event, button.onClick)\">\n </button>\n <s-switch\n *ngIf=\"switch\"\n class=\"switch\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"switchState\"\n (click)=\"$event.stopPropagation()\"\n (valueChanged)=\"switch.onChange($event)\">\n </s-switch>\n </div>\n </div>\n <ng-container *ngIf=\"cache; then cacheTemplate else cachelessTemplate\"></ng-container>\n</div>\n\n<ng-template #cacheTemplate>\n <div\n class=\"content\"\n [@cacheAnimation]=\"isOpen\"\n [@.disabled]=\"isContentAnimationDisabled\"\n (@cacheAnimation.start)=\"onContentAnimationStart()\"\n (@cacheAnimation.done)=\"onContentAnimationDone()\">\n <div class=\"content-container\">\n <ng-container [ngTemplateOutlet]=\"panelContent\"></ng-container>\n </div>\n </div>\n</ng-template>\n\n<ng-template #cachelessTemplate>\n <div\n *ngIf=\"isOpen\"\n class=\"content\"\n @cachelessAnimation\n [@.disabled]=\"isContentAnimationDisabled\"\n (@cachelessAnimation.start)=\"onContentAnimationStart()\"\n (@cachelessAnimation.done)=\"onContentAnimationDone()\">\n <div class=\"content-container\">\n <ng-container [ngTemplateOutlet]=\"panelContent\"></ng-container>\n </div>\n </div>\n</ng-template>\n\n<ng-template #panelContent>\n <ng-content></ng-content>\n</ng-template>",
301
+ template: "<div\n class=\"accordion-panel\"\n [ngClass]=\"{\n 'accordion-panel--open': isOpen,\n 'accordion-panel--disabled': disabled\n }\">\n <div class=\"header\" (click)=\"onTabClick()\">\n <div class=\"header__title\">\n <span class=\"icon\" [ngClass]=\"isOpen ? 'fas fa-minus' : 'fas fa-plus'\"></span>\n <span\n *ngIf=\"validationMessage\"\n class=\"exclamation-icon fas fa-exclamation-circle\"\n [sTooltip]=\"validationMessage\">\n </span>\n <span class=\"title\">{{ header }}</span>\n </div>\n <div class=\"header__controls\">\n <button\n *ngFor=\"let button of buttons\"\n class=\"icon-button\"\n [ngClass]=\"button.icon\"\n (click)=\"onIconButtonsClick($event, button.onClick)\">\n </button>\n <s-switch\n *ngIf=\"switchControl\"\n class=\"switch\"\n [formControl]=\"switchControl\"\n (click)=\"$event.stopPropagation()\">\n </s-switch>\n <s-switch\n *ngIf=\"!switchControl && switch\"\n class=\"switch\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"switch.state\"\n (click)=\"$event.stopPropagation()\"\n (valueChanged)=\"switch.onChange($event)\">\n </s-switch>\n </div>\n </div>\n <ng-container *ngIf=\"cache; then cacheTemplate else cachelessTemplate\"></ng-container>\n</div>\n\n<ng-template #cacheTemplate>\n <div\n class=\"content\"\n [@cacheAnimation]=\"isOpen\"\n [@.disabled]=\"isContentAnimationDisabled\"\n (@cacheAnimation.start)=\"onContentAnimationStart()\"\n (@cacheAnimation.done)=\"onContentAnimationDone()\">\n <div class=\"content-container\">\n <ng-container [ngTemplateOutlet]=\"panelContent\"></ng-container>\n </div>\n </div>\n</ng-template>\n\n<ng-template #cachelessTemplate>\n <div\n *ngIf=\"isOpen\"\n class=\"content\"\n @cachelessAnimation\n [@.disabled]=\"isContentAnimationDisabled\"\n (@cachelessAnimation.start)=\"onContentAnimationStart()\"\n (@cachelessAnimation.done)=\"onContentAnimationDone()\">\n <div class=\"content-container\">\n <ng-container [ngTemplateOutlet]=\"panelContent\"></ng-container>\n </div>\n </div>\n</ng-template>\n\n<ng-template #panelContent>\n <ng-content></ng-content>\n</ng-template>",
292
302
  animations: [
293
303
  animations.trigger("cachelessAnimation", [
294
304
  animations.transition(":enter", [animations.style({ height: "0" }), animations.animate("200ms linear", animations.style({ height: "*" }))]),
@@ -429,6 +439,9 @@
429
439
  if (this._onChange) {
430
440
  this._onChange(this.value);
431
441
  }
442
+ if (this._onTouched) {
443
+ this._onTouched(this.value);
444
+ }
432
445
  };
433
446
  var SwitchComponent_1;
434
447
  __decorate([
@@ -897,6 +910,7 @@
897
910
  imports: [
898
911
  common.CommonModule,
899
912
  forms.FormsModule,
913
+ forms.ReactiveFormsModule,
900
914
  TooltipModule,
901
915
  SwitchModule,
902
916
  ],