@seniorsistemas/angular-components 17.10.8 → 17.10.10

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.
@@ -498,12 +498,12 @@ var TooltipDirective = /** @class */ (function () {
498
498
  var inputFocus = this.focusedInputRef;
499
499
  var icon_1 = this.getIconFromFocusedInput();
500
500
  this.renderer.listen(this.focusedInputRef, "focus", function () {
501
- if (icon_1 && _this.isMatchingTooltip(icon_1)) {
501
+ if (icon_1) {
502
502
  _this.createTootipByFocus(icon_1);
503
503
  }
504
504
  });
505
505
  this.renderer.listen(inputFocus, "blur", function () {
506
- if (icon_1 && _this.isMatchingTooltip(icon_1)) {
506
+ if (icon_1) {
507
507
  _this.removeTooltip(icon_1);
508
508
  _this.destroy();
509
509
  }
@@ -517,15 +517,6 @@ var TooltipDirective = /** @class */ (function () {
517
517
  TooltipDirective.prototype.getIconFromFocusedInput = function () {
518
518
  return this.elementRef.nativeElement;
519
519
  };
520
- /**
521
- * Verifica se o ícone tem o tooltip correspondente ao atual.
522
- * @param icon O ícone do input em focus.
523
- * @returns true se o tooltip corresponde; caso contrário, false.
524
- */
525
- TooltipDirective.prototype.isMatchingTooltip = function (icon) {
526
- var tooltipText = icon.getAttribute("ng-reflect-tooltip");
527
- return this.tooltip === tooltipText;
528
- };
529
520
  /**
530
521
  * Remove o tooltip associado ao ícone do input em focus.
531
522
  * @param icon O ícone do input em focus.
@@ -622,9 +613,10 @@ var TooltipDirective = /** @class */ (function () {
622
613
  var tooltip_1 = domElem.querySelector(".tooltip");
623
614
  icon.appendChild(tooltip_1);
624
615
  this.setTooltipComponentProperties();
616
+ this.setTooltipPositionProperty(icon);
625
617
  setTimeout(function () { return tooltip_1.classList.add("tooltip--visible"); }, 0);
626
618
  this.renderer.listen(window, "scroll", function () {
627
- _this.setTooltipPositionProperty();
619
+ _this.setTooltipPositionProperty(icon);
628
620
  });
629
621
  }
630
622
  };
@@ -635,11 +627,11 @@ var TooltipDirective = /** @class */ (function () {
635
627
  window.addEventListener("mousemove", this.boundOnWindowMouseMoveFunction);
636
628
  }
637
629
  };
638
- TooltipDirective.prototype.setTooltipPositionProperty = function () {
630
+ TooltipDirective.prototype.setTooltipPositionProperty = function (element) {
639
631
  var e_1, _a;
640
632
  var margin = 20;
641
633
  var anchorSize = 5;
642
- var domElem = this.componentRef.hostView.rootNodes[0].querySelector("#tooltip");
634
+ var domElem = element || this.componentRef.hostView.rootNodes[0].querySelector("#tooltip");
643
635
  var _b = domElem.getBoundingClientRect(), height = _b.height, width = _b.width;
644
636
  var _c = this.elementRef.nativeElement.getBoundingClientRect(), left = _c.left, right = _c.right, top = _c.top, bottom = _c.bottom;
645
637
  var positions = [
@@ -664,31 +656,33 @@ var TooltipDirective = /** @class */ (function () {
664
656
  set: function () { return ({ left: right + margin, top: top + height / 2 - anchorSize }); },
665
657
  },
666
658
  ];
667
- try {
668
- for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
669
- var _d = positions_1_1.value, pos = _d.pos, check = _d.check, set = _d.set;
670
- if (check()) {
671
- this.position = pos;
672
- var _e = set(), left_1 = _e.left, top_1 = _e.top;
673
- this.componentRef.instance.left = Math.round(left_1);
674
- this.componentRef.instance.top = Math.round(top_1);
675
- this.componentRef.instance.position = this.position;
676
- return;
659
+ if (this.componentRef) {
660
+ try {
661
+ for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
662
+ var _d = positions_1_1.value, pos = _d.pos, check = _d.check, set = _d.set;
663
+ if (check()) {
664
+ this.position = pos;
665
+ var _e = set(), left_1 = _e.left, top_1 = _e.top;
666
+ this.componentRef.instance.left = Math.round(left_1);
667
+ this.componentRef.instance.top = Math.round(top_1);
668
+ this.componentRef.instance.position = this.position;
669
+ return;
670
+ }
677
671
  }
678
672
  }
679
- }
680
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
681
- finally {
682
- try {
683
- if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1);
673
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
674
+ finally {
675
+ try {
676
+ if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1);
677
+ }
678
+ finally { if (e_1) throw e_1.error; }
684
679
  }
685
- finally { if (e_1) throw e_1.error; }
680
+ // Se não conseguir posicionar, mostrar abaixo
681
+ this.position = TooltipPosition.Bottom;
682
+ this.componentRef.instance.left = Math.round(left + (right - left) / 2);
683
+ this.componentRef.instance.top = Math.round(bottom + margin);
684
+ this.componentRef.instance.position = this.position;
686
685
  }
687
- // Se não conseguir posicionar, mostrar abaixo
688
- this.position = TooltipPosition.Bottom;
689
- this.componentRef.instance.left = Math.round(left + (right - left) / 2);
690
- this.componentRef.instance.top = Math.round(bottom + margin);
691
- this.componentRef.instance.position = this.position;
692
686
  };
693
687
  TooltipDirective.prototype.setTooltipComponentProperties = function () {
694
688
  if (this.componentRef !== null) {
@@ -2133,7 +2127,6 @@ var TieredMenuDirective = /** @class */ (function () {
2133
2127
  this._tieredMenuService = _tieredMenuService;
2134
2128
  this._tieredMenuGlobalService = _tieredMenuGlobalService;
2135
2129
  this._changeDetectorRef = _changeDetectorRef;
2136
- this.items = [];
2137
2130
  this.focusedItem = undefined;
2138
2131
  this.triggerEvent = "click";
2139
2132
  this._componentRef = null;
@@ -2141,28 +2134,26 @@ var TieredMenuDirective = /** @class */ (function () {
2141
2134
  this._isOpen = false;
2142
2135
  this._unsubscribe$ = new Subject();
2143
2136
  }
2144
- TieredMenuDirective.prototype.onClick = function (event) {
2145
- if (this.triggerEvent === "click" && !this._isOpen) {
2146
- this._lastActiveElement = document.activeElement;
2147
- this._createMenu();
2148
- event.preventDefault();
2149
- event.stopPropagation();
2150
- }
2151
- };
2152
2137
  TieredMenuDirective.prototype.ngOnInit = function () {
2138
+ var _a;
2139
+ this._itemsAreValid = !!((_a = this.items) === null || _a === void 0 ? void 0 : _a.length);
2140
+ if (!this._itemsAreValid)
2141
+ return;
2153
2142
  this._subscribeEvents();
2154
2143
  };
2155
2144
  TieredMenuDirective.prototype.ngDoCheck = function () {
2156
- if (!this.previousItems) {
2157
- this.previousItems = this._tieredMenuService.cloneItems(this.items);
2145
+ if (!this._itemsAreValid)
2146
+ return;
2147
+ if (!this._previousItems) {
2148
+ this._previousItems = this._tieredMenuService.cloneItems(this.items);
2158
2149
  }
2159
2150
  var hasChanges = false;
2160
- if (this.items.length !== this.previousItems.length) {
2151
+ if (this.items.length !== this._previousItems.length) {
2161
2152
  hasChanges = true;
2162
2153
  }
2163
2154
  else {
2164
2155
  for (var i = 0; i < this.items.length; i++) {
2165
- if (!this._compareItems(this.items[i], this.previousItems[i])) {
2156
+ if (!this._compareItems(this.items[i], this._previousItems[i])) {
2166
2157
  hasChanges = true;
2167
2158
  break;
2168
2159
  }
@@ -2173,13 +2164,25 @@ var TieredMenuDirective = /** @class */ (function () {
2173
2164
  this._changeDetectorRef.detectChanges();
2174
2165
  this._rebuildMenu();
2175
2166
  }
2176
- this.previousItems = this._tieredMenuService.cloneItems(this.items);
2167
+ this._previousItems = this._tieredMenuService.cloneItems(this.items);
2177
2168
  };
2178
2169
  TieredMenuDirective.prototype.ngOnDestroy = function () {
2170
+ if (!this._itemsAreValid)
2171
+ return;
2179
2172
  this._unsubscribe$.next();
2180
2173
  this._unsubscribe$.complete();
2181
2174
  this._destroy();
2182
2175
  };
2176
+ TieredMenuDirective.prototype.onClick = function (event) {
2177
+ if (!this._itemsAreValid)
2178
+ return;
2179
+ if (this.triggerEvent === "click" && !this._isOpen) {
2180
+ this._lastActiveElement = document.activeElement;
2181
+ this._createMenu();
2182
+ event.preventDefault();
2183
+ event.stopPropagation();
2184
+ }
2185
+ };
2183
2186
  TieredMenuDirective.prototype._createMenu = function () {
2184
2187
  var _a, _b, _c;
2185
2188
  this._updateServiceItems();
@@ -6925,7 +6928,7 @@ var EmptyStateComponent = /** @class */ (function () {
6925
6928
  EmptyStateComponent = EmptyStateComponent_1 = __decorate([
6926
6929
  Component({
6927
6930
  selector: "s-empty-state",
6928
- template: "<div [id]=\"id\" class=\"container\">\n <div [id]=\"id + '-icon'\" class=\"icon\">\n <i [attr.class]=\"iconClass ? iconClass : 'fa fa-cogs'\" aria-hidden=\"true\"></i>\n </div>\n <div [id]=\"id + '-title'\" class=\"title\">{{title}}</div>\n <div [id]=\"id + '-description'\" class=\"description\" *ngIf=\"description\">\n <p>{{description}}</p>\n </div>\n <div [id]=\"id + '-actions'\" class=\"actions\" *ngIf=\"showPrimaryAction && primaryActionLabel\">\n <s-button [id]=\"id + '-primary-action'\" type=\"button\" [label]=\"primaryActionLabel\"\n [model]=\"primaryModel\" (click)=\"primaryAction.next()\"></s-button>\n <s-button [id]=\"id + '-secondary-action'\" *ngIf=\"showSecondaryAction && secondaryActionLabel\" id=\"secondaryAction\" type=\"button\"\n [label]=\"secondaryActionLabel\" priority=\"link\" (click)=\"secondaryAction.next()\"></s-button>\n </div>\n</div>",
6931
+ template: "<div [id]=\"id\" class=\"container\">\n <div [id]=\"id + '-icon'\" class=\"icon\">\n <i [attr.class]=\"iconClass ? iconClass : 'fa fa-cogs'\" aria-hidden=\"true\"></i>\n </div>\n <div [id]=\"id + '-title'\" class=\"title\">{{title}}</div>\n <div [id]=\"id + '-description'\" class=\"description\" *ngIf=\"description\">\n <p>{{description}}</p>\n </div>\n <div [id]=\"id + '-actions'\" class=\"actions\" *ngIf=\"showPrimaryAction && primaryActionLabel\">\n <s-button [id]=\"id + '-primary-action'\" type=\"button\" [label]=\"primaryActionLabel\"\n [model]=\"primaryModel\" (onClick)=\"primaryAction.next()\"></s-button>\n <s-button [id]=\"id + '-secondary-action'\" *ngIf=\"showSecondaryAction && secondaryActionLabel\" id=\"secondaryAction\" type=\"button\"\n [label]=\"secondaryActionLabel\" priority=\"link\" (onClick)=\"secondaryAction.next()\"></s-button>\n </div>\n</div>",
6929
6932
  styles: [".container{width:100%;text-align:center}.title{font-weight:700;margin-bottom:10px}.description{margin-bottom:15px;color:#999;padding:0 20px;text-align:center}.description>p{margin:auto;max-width:400px;max-height:80px;overflow:hidden}.icon{color:#d8d8d8;font-size:6em}.actions{text-align:center;width:100%}"]
6930
6933
  })
6931
6934
  ], EmptyStateComponent);