@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.
@@ -644,12 +644,12 @@
644
644
  var inputFocus = this.focusedInputRef;
645
645
  var icon_1 = this.getIconFromFocusedInput();
646
646
  this.renderer.listen(this.focusedInputRef, "focus", function () {
647
- if (icon_1 && _this.isMatchingTooltip(icon_1)) {
647
+ if (icon_1) {
648
648
  _this.createTootipByFocus(icon_1);
649
649
  }
650
650
  });
651
651
  this.renderer.listen(inputFocus, "blur", function () {
652
- if (icon_1 && _this.isMatchingTooltip(icon_1)) {
652
+ if (icon_1) {
653
653
  _this.removeTooltip(icon_1);
654
654
  _this.destroy();
655
655
  }
@@ -663,15 +663,6 @@
663
663
  TooltipDirective.prototype.getIconFromFocusedInput = function () {
664
664
  return this.elementRef.nativeElement;
665
665
  };
666
- /**
667
- * Verifica se o ícone tem o tooltip correspondente ao atual.
668
- * @param icon O ícone do input em focus.
669
- * @returns true se o tooltip corresponde; caso contrário, false.
670
- */
671
- TooltipDirective.prototype.isMatchingTooltip = function (icon) {
672
- var tooltipText = icon.getAttribute("ng-reflect-tooltip");
673
- return this.tooltip === tooltipText;
674
- };
675
666
  /**
676
667
  * Remove o tooltip associado ao ícone do input em focus.
677
668
  * @param icon O ícone do input em focus.
@@ -768,9 +759,10 @@
768
759
  var tooltip_1 = domElem.querySelector(".tooltip");
769
760
  icon.appendChild(tooltip_1);
770
761
  this.setTooltipComponentProperties();
762
+ this.setTooltipPositionProperty(icon);
771
763
  setTimeout(function () { return tooltip_1.classList.add("tooltip--visible"); }, 0);
772
764
  this.renderer.listen(window, "scroll", function () {
773
- _this.setTooltipPositionProperty();
765
+ _this.setTooltipPositionProperty(icon);
774
766
  });
775
767
  }
776
768
  };
@@ -781,11 +773,11 @@
781
773
  window.addEventListener("mousemove", this.boundOnWindowMouseMoveFunction);
782
774
  }
783
775
  };
784
- TooltipDirective.prototype.setTooltipPositionProperty = function () {
776
+ TooltipDirective.prototype.setTooltipPositionProperty = function (element) {
785
777
  var e_1, _a;
786
778
  var margin = 20;
787
779
  var anchorSize = 5;
788
- var domElem = this.componentRef.hostView.rootNodes[0].querySelector("#tooltip");
780
+ var domElem = element || this.componentRef.hostView.rootNodes[0].querySelector("#tooltip");
789
781
  var _b = domElem.getBoundingClientRect(), height = _b.height, width = _b.width;
790
782
  var _c = this.elementRef.nativeElement.getBoundingClientRect(), left = _c.left, right = _c.right, top = _c.top, bottom = _c.bottom;
791
783
  var positions = [
@@ -810,31 +802,33 @@
810
802
  set: function () { return ({ left: right + margin, top: top + height / 2 - anchorSize }); },
811
803
  },
812
804
  ];
813
- try {
814
- for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
815
- var _d = positions_1_1.value, pos = _d.pos, check = _d.check, set = _d.set;
816
- if (check()) {
817
- this.position = pos;
818
- var _e = set(), left_1 = _e.left, top_1 = _e.top;
819
- this.componentRef.instance.left = Math.round(left_1);
820
- this.componentRef.instance.top = Math.round(top_1);
821
- this.componentRef.instance.position = this.position;
822
- return;
805
+ if (this.componentRef) {
806
+ try {
807
+ for (var positions_1 = __values(positions), positions_1_1 = positions_1.next(); !positions_1_1.done; positions_1_1 = positions_1.next()) {
808
+ var _d = positions_1_1.value, pos = _d.pos, check = _d.check, set = _d.set;
809
+ if (check()) {
810
+ this.position = pos;
811
+ var _e = set(), left_1 = _e.left, top_1 = _e.top;
812
+ this.componentRef.instance.left = Math.round(left_1);
813
+ this.componentRef.instance.top = Math.round(top_1);
814
+ this.componentRef.instance.position = this.position;
815
+ return;
816
+ }
823
817
  }
824
818
  }
825
- }
826
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
827
- finally {
828
- try {
829
- if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1);
819
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
820
+ finally {
821
+ try {
822
+ if (positions_1_1 && !positions_1_1.done && (_a = positions_1.return)) _a.call(positions_1);
823
+ }
824
+ finally { if (e_1) throw e_1.error; }
830
825
  }
831
- finally { if (e_1) throw e_1.error; }
826
+ // Se não conseguir posicionar, mostrar abaixo
827
+ this.position = exports.TooltipPosition.Bottom;
828
+ this.componentRef.instance.left = Math.round(left + (right - left) / 2);
829
+ this.componentRef.instance.top = Math.round(bottom + margin);
830
+ this.componentRef.instance.position = this.position;
832
831
  }
833
- // Se não conseguir posicionar, mostrar abaixo
834
- this.position = exports.TooltipPosition.Bottom;
835
- this.componentRef.instance.left = Math.round(left + (right - left) / 2);
836
- this.componentRef.instance.top = Math.round(bottom + margin);
837
- this.componentRef.instance.position = this.position;
838
832
  };
839
833
  TooltipDirective.prototype.setTooltipComponentProperties = function () {
840
834
  if (this.componentRef !== null) {
@@ -2279,7 +2273,6 @@
2279
2273
  this._tieredMenuService = _tieredMenuService;
2280
2274
  this._tieredMenuGlobalService = _tieredMenuGlobalService;
2281
2275
  this._changeDetectorRef = _changeDetectorRef;
2282
- this.items = [];
2283
2276
  this.focusedItem = undefined;
2284
2277
  this.triggerEvent = "click";
2285
2278
  this._componentRef = null;
@@ -2287,28 +2280,26 @@
2287
2280
  this._isOpen = false;
2288
2281
  this._unsubscribe$ = new rxjs.Subject();
2289
2282
  }
2290
- TieredMenuDirective.prototype.onClick = function (event) {
2291
- if (this.triggerEvent === "click" && !this._isOpen) {
2292
- this._lastActiveElement = document.activeElement;
2293
- this._createMenu();
2294
- event.preventDefault();
2295
- event.stopPropagation();
2296
- }
2297
- };
2298
2283
  TieredMenuDirective.prototype.ngOnInit = function () {
2284
+ var _a;
2285
+ this._itemsAreValid = !!((_a = this.items) === null || _a === void 0 ? void 0 : _a.length);
2286
+ if (!this._itemsAreValid)
2287
+ return;
2299
2288
  this._subscribeEvents();
2300
2289
  };
2301
2290
  TieredMenuDirective.prototype.ngDoCheck = function () {
2302
- if (!this.previousItems) {
2303
- this.previousItems = this._tieredMenuService.cloneItems(this.items);
2291
+ if (!this._itemsAreValid)
2292
+ return;
2293
+ if (!this._previousItems) {
2294
+ this._previousItems = this._tieredMenuService.cloneItems(this.items);
2304
2295
  }
2305
2296
  var hasChanges = false;
2306
- if (this.items.length !== this.previousItems.length) {
2297
+ if (this.items.length !== this._previousItems.length) {
2307
2298
  hasChanges = true;
2308
2299
  }
2309
2300
  else {
2310
2301
  for (var i = 0; i < this.items.length; i++) {
2311
- if (!this._compareItems(this.items[i], this.previousItems[i])) {
2302
+ if (!this._compareItems(this.items[i], this._previousItems[i])) {
2312
2303
  hasChanges = true;
2313
2304
  break;
2314
2305
  }
@@ -2319,13 +2310,25 @@
2319
2310
  this._changeDetectorRef.detectChanges();
2320
2311
  this._rebuildMenu();
2321
2312
  }
2322
- this.previousItems = this._tieredMenuService.cloneItems(this.items);
2313
+ this._previousItems = this._tieredMenuService.cloneItems(this.items);
2323
2314
  };
2324
2315
  TieredMenuDirective.prototype.ngOnDestroy = function () {
2316
+ if (!this._itemsAreValid)
2317
+ return;
2325
2318
  this._unsubscribe$.next();
2326
2319
  this._unsubscribe$.complete();
2327
2320
  this._destroy();
2328
2321
  };
2322
+ TieredMenuDirective.prototype.onClick = function (event) {
2323
+ if (!this._itemsAreValid)
2324
+ return;
2325
+ if (this.triggerEvent === "click" && !this._isOpen) {
2326
+ this._lastActiveElement = document.activeElement;
2327
+ this._createMenu();
2328
+ event.preventDefault();
2329
+ event.stopPropagation();
2330
+ }
2331
+ };
2329
2332
  TieredMenuDirective.prototype._createMenu = function () {
2330
2333
  var _a, _b, _c;
2331
2334
  this._updateServiceItems();
@@ -7071,7 +7074,7 @@
7071
7074
  EmptyStateComponent = EmptyStateComponent_1 = __decorate([
7072
7075
  core.Component({
7073
7076
  selector: "s-empty-state",
7074
- 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>",
7077
+ 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>",
7075
7078
  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%}"]
7076
7079
  })
7077
7080
  ], EmptyStateComponent);