@seniorsistemas/angular-components 17.10.8 → 17.10.9

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.
@@ -2279,7 +2279,6 @@
2279
2279
  this._tieredMenuService = _tieredMenuService;
2280
2280
  this._tieredMenuGlobalService = _tieredMenuGlobalService;
2281
2281
  this._changeDetectorRef = _changeDetectorRef;
2282
- this.items = [];
2283
2282
  this.focusedItem = undefined;
2284
2283
  this.triggerEvent = "click";
2285
2284
  this._componentRef = null;
@@ -2287,28 +2286,26 @@
2287
2286
  this._isOpen = false;
2288
2287
  this._unsubscribe$ = new rxjs.Subject();
2289
2288
  }
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
2289
  TieredMenuDirective.prototype.ngOnInit = function () {
2290
+ var _a;
2291
+ this._itemsAreValid = !!((_a = this.items) === null || _a === void 0 ? void 0 : _a.length);
2292
+ if (!this._itemsAreValid)
2293
+ return;
2299
2294
  this._subscribeEvents();
2300
2295
  };
2301
2296
  TieredMenuDirective.prototype.ngDoCheck = function () {
2302
- if (!this.previousItems) {
2303
- this.previousItems = this._tieredMenuService.cloneItems(this.items);
2297
+ if (!this._itemsAreValid)
2298
+ return;
2299
+ if (!this._previousItems) {
2300
+ this._previousItems = this._tieredMenuService.cloneItems(this.items);
2304
2301
  }
2305
2302
  var hasChanges = false;
2306
- if (this.items.length !== this.previousItems.length) {
2303
+ if (this.items.length !== this._previousItems.length) {
2307
2304
  hasChanges = true;
2308
2305
  }
2309
2306
  else {
2310
2307
  for (var i = 0; i < this.items.length; i++) {
2311
- if (!this._compareItems(this.items[i], this.previousItems[i])) {
2308
+ if (!this._compareItems(this.items[i], this._previousItems[i])) {
2312
2309
  hasChanges = true;
2313
2310
  break;
2314
2311
  }
@@ -2319,13 +2316,25 @@
2319
2316
  this._changeDetectorRef.detectChanges();
2320
2317
  this._rebuildMenu();
2321
2318
  }
2322
- this.previousItems = this._tieredMenuService.cloneItems(this.items);
2319
+ this._previousItems = this._tieredMenuService.cloneItems(this.items);
2323
2320
  };
2324
2321
  TieredMenuDirective.prototype.ngOnDestroy = function () {
2322
+ if (!this._itemsAreValid)
2323
+ return;
2325
2324
  this._unsubscribe$.next();
2326
2325
  this._unsubscribe$.complete();
2327
2326
  this._destroy();
2328
2327
  };
2328
+ TieredMenuDirective.prototype.onClick = function (event) {
2329
+ if (!this._itemsAreValid)
2330
+ return;
2331
+ if (this.triggerEvent === "click" && !this._isOpen) {
2332
+ this._lastActiveElement = document.activeElement;
2333
+ this._createMenu();
2334
+ event.preventDefault();
2335
+ event.stopPropagation();
2336
+ }
2337
+ };
2329
2338
  TieredMenuDirective.prototype._createMenu = function () {
2330
2339
  var _a, _b, _c;
2331
2340
  this._updateServiceItems();