@neoprototype/neop-ui-lib 1.1.2 → 1.1.4
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, NgModule, Input, ViewChild, Component, EventEmitter, Output, InjectionToken, Optional, Inject, ElementRef, HostListener, ViewChildren, TemplateRef } from '@angular/core';
|
|
2
|
+
import { Injectable, NgModule, Input, ViewChild, Component, EventEmitter, Output, InjectionToken, Optional, Inject, ElementRef, HostListener, ViewChildren, inject, PLATFORM_ID, afterNextRender, TemplateRef } from '@angular/core';
|
|
3
3
|
import * as i1 from 'ng-zorro-antd/modal';
|
|
4
4
|
import { NzModalModule } from 'ng-zorro-antd/modal';
|
|
5
5
|
import { Subject, debounceTime } from 'rxjs';
|
|
@@ -2547,6 +2547,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.5", ngImpor
|
|
|
2547
2547
|
class NpTabComponent {
|
|
2548
2548
|
_Router;
|
|
2549
2549
|
_ActivatedRoute;
|
|
2550
|
+
platformId = inject(PLATFORM_ID);
|
|
2550
2551
|
headerWrapperRef;
|
|
2551
2552
|
scrollContainerRef;
|
|
2552
2553
|
tabItemRefs;
|
|
@@ -2565,13 +2566,28 @@ class NpTabComponent {
|
|
|
2565
2566
|
constructor(_Router, _ActivatedRoute) {
|
|
2566
2567
|
this._Router = _Router;
|
|
2567
2568
|
this._ActivatedRoute = _ActivatedRoute;
|
|
2569
|
+
afterNextRender(() => {
|
|
2570
|
+
this.initBrowserLogic();
|
|
2571
|
+
});
|
|
2572
|
+
}
|
|
2573
|
+
initBrowserLogic() {
|
|
2574
|
+
const wrapper = this.headerWrapperRef?.nativeElement;
|
|
2575
|
+
if (wrapper) {
|
|
2576
|
+
wrapper.addEventListener('scroll', this.updateScrollButtons);
|
|
2577
|
+
}
|
|
2578
|
+
this.updateScrollButtons();
|
|
2568
2579
|
}
|
|
2569
2580
|
ngOnInit() {
|
|
2570
2581
|
this.setTabActiveDefault();
|
|
2571
2582
|
}
|
|
2572
2583
|
setTabActiveDefault() {
|
|
2573
|
-
if (this.tabActive) {
|
|
2574
|
-
|
|
2584
|
+
if (this.tabActive !== undefined && this.tabActive !== null && this.tabActive !== '') {
|
|
2585
|
+
if (typeof this.tabActive === 'number') {
|
|
2586
|
+
this.indexActive = this.tabActive;
|
|
2587
|
+
}
|
|
2588
|
+
else {
|
|
2589
|
+
this.indexActive = this.tabs?.findIndex((x) => x.key === this.tabActive);
|
|
2590
|
+
}
|
|
2575
2591
|
return;
|
|
2576
2592
|
}
|
|
2577
2593
|
if (!this.isLink) {
|
|
@@ -2630,16 +2646,16 @@ class NpTabComponent {
|
|
|
2630
2646
|
const pageWidth = wrapper.clientWidth;
|
|
2631
2647
|
wrapper.scrollBy({ left: pageWidth, behavior: 'smooth' });
|
|
2632
2648
|
}
|
|
2633
|
-
ngAfterViewInit() {
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
}
|
|
2649
|
+
// ngAfterViewInit(): void {
|
|
2650
|
+
// const wrapper = this.headerWrapperRef?.nativeElement;
|
|
2651
|
+
// if (wrapper) {
|
|
2652
|
+
// wrapper.addEventListener('scroll', this.updateScrollButtons);
|
|
2653
|
+
// }
|
|
2654
|
+
// window.addEventListener('resize', this.updateScrollButtons);
|
|
2655
|
+
// setTimeout(() => {
|
|
2656
|
+
// this.updateScrollButtons();
|
|
2657
|
+
// }, 0);
|
|
2658
|
+
// }
|
|
2643
2659
|
ngOnDestroy() {
|
|
2644
2660
|
const wrapper = this.headerWrapperRef?.nativeElement;
|
|
2645
2661
|
if (wrapper) {
|