@posiwise/shared-components 0.0.150 → 0.0.152

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.
@@ -29,8 +29,8 @@ import * as i5$2 from 'primeng/select';
29
29
  import { SelectModule } from 'primeng/select';
30
30
  import * as i6 from 'primeng/table';
31
31
  import { TableModule } from 'primeng/table';
32
- import * as i2$2 from 'primeng/tabmenu';
33
- import { TabMenuModule } from 'primeng/tabmenu';
32
+ import * as i2$2 from 'primeng/tabs';
33
+ import { TabsModule } from 'primeng/tabs';
34
34
  import * as i3$2 from '@ng-bootstrap/ng-bootstrap';
35
35
  import { NgbTooltipModule, NgbNavModule, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
36
36
  import { AppBaseComponent } from '@posiwise/app-base-component';
@@ -1367,6 +1367,10 @@ class PwTabsComponent extends AppBaseComponent {
1367
1367
  super(injector);
1368
1368
  this.items = [];
1369
1369
  this.withSubscription = false;
1370
+ /** Arrow function so trackBy is called with correct `this` from template */
1371
+ this.trackByItem = (_index, item) => {
1372
+ return this.getItemValue(item);
1373
+ };
1370
1374
  }
1371
1375
  ngOnInit() {
1372
1376
  if (this.withSubscription) {
@@ -1394,43 +1398,45 @@ class PwTabsComponent extends AppBaseComponent {
1394
1398
  }
1395
1399
  });
1396
1400
  }
1401
+ getItemValue(item) {
1402
+ if (!item.routerLink) {
1403
+ return item.id ?? item.label ?? '';
1404
+ }
1405
+ const routePath = Array.isArray(item.routerLink) ? item.routerLink[0] : item.routerLink;
1406
+ return String(routePath);
1407
+ }
1408
+ onTabChange(value) {
1409
+ const item = this.items.find(i => this.getItemValue(i) === value);
1410
+ if (item?.routerLink) {
1411
+ const routePath = Array.isArray(item.routerLink) ? item.routerLink : [item.routerLink];
1412
+ this.router.navigate(routePath);
1413
+ }
1414
+ }
1397
1415
  updateActiveTab() {
1398
- if (!this.tabInstance || !this.items.length) {
1416
+ if (!this.items.length) {
1399
1417
  return;
1400
1418
  }
1401
1419
  const currentUrl = this.router.url.split('?')[0];
1402
1420
  const matchedItem = this.items.find(item => {
1403
- if (!item.routerLink || !item.visible) {
1421
+ if (!item.routerLink || item.visible === false) {
1404
1422
  return false;
1405
1423
  }
1406
1424
  const routePath = Array.isArray(item.routerLink) ? item.routerLink[0] : item.routerLink;
1407
1425
  return routePath === currentUrl;
1408
1426
  });
1409
- if (matchedItem) {
1410
- // Clear previous activeItem first to ensure only one tab is active
1411
- this.tabInstance.activeItem = null;
1412
- // Then set the new activeItem
1413
- this.tabInstance.activeItem = matchedItem;
1414
- }
1415
- else {
1416
- // Clear activeItem if no match found
1417
- this.tabInstance.activeItem = null;
1418
- }
1427
+ this.activeTabValue = matchedItem ? this.getItemValue(matchedItem) : undefined;
1419
1428
  }
1420
1429
  ngOnDestroy() {
1421
1430
  this.routeEventSubscription.unsubscribe();
1422
1431
  }
1423
1432
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: PwTabsComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component }); }
1424
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: PwTabsComponent, isStandalone: false, selector: "pw-tabs", inputs: { items: "items", withSubscription: "withSubscription" }, viewQueries: [{ propertyName: "tabInstance", first: true, predicate: ["tabMenu"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"container-fluid pw-tab overflow-hidden\">\n <p-tabMenu [model]=\"items\"\n #tabMenu></p-tabMenu>\n <div class=\"dashboard\">\n <div class=\"dashboard-body\">\n <router-outlet></router-outlet>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i5.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: i2$2.TabMenu, selector: "p-tabMenu, p-tabmenu", inputs: ["model", "activeItem", "scrollable", "popup", "style", "styleClass", "ariaLabel", "ariaLabelledBy"], outputs: ["activeItemChange"] }] }); }
1433
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.18", type: PwTabsComponent, isStandalone: false, selector: "pw-tabs", inputs: { items: "items", withSubscription: "withSubscription" }, usesInheritance: true, ngImport: i0, template: "<div class=\"container-fluid pw-tab overflow-hidden\">\n <p-tabs [value]=\"activeTabValue\" (valueChange)=\"onTabChange($event)\">\n <p-tablist>\n <ng-container *ngFor=\"let item of items; trackBy: trackByItem\">\n <p-tab *ngIf=\"item.visible !== false\" [value]=\"getItemValue(item)\">\n <i *ngIf=\"item.icon\" [class]=\"item.icon\" aria-hidden=\"true\"></i>\n <span>{{ item.label }}</span>\n </p-tab>\n </ng-container>\n </p-tablist>\n </p-tabs>\n <div class=\"dashboard\">\n <div class=\"dashboard-body\">\n <router-outlet></router-outlet>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i5.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: i2$2.Tabs, selector: "p-tabs", inputs: ["value", "scrollable", "lazy", "selectOnFocus", "showNavigators", "tabindex"], outputs: ["valueChange"] }, { kind: "component", type: i2$2.TabList, selector: "p-tablist" }, { kind: "component", type: i2$2.Tab, selector: "p-tab", inputs: ["value", "disabled"], outputs: ["valueChange"] }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
1425
1434
  }
1426
1435
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: PwTabsComponent, decorators: [{
1427
1436
  type: Component,
1428
- args: [{ selector: 'pw-tabs', standalone: false, template: "<div class=\"container-fluid pw-tab overflow-hidden\">\n <p-tabMenu [model]=\"items\"\n #tabMenu></p-tabMenu>\n <div class=\"dashboard\">\n <div class=\"dashboard-body\">\n <router-outlet></router-outlet>\n </div>\n </div>\n</div>\n" }]
1437
+ args: [{ selector: 'pw-tabs', standalone: false, template: "<div class=\"container-fluid pw-tab overflow-hidden\">\n <p-tabs [value]=\"activeTabValue\" (valueChange)=\"onTabChange($event)\">\n <p-tablist>\n <ng-container *ngFor=\"let item of items; trackBy: trackByItem\">\n <p-tab *ngIf=\"item.visible !== false\" [value]=\"getItemValue(item)\">\n <i *ngIf=\"item.icon\" [class]=\"item.icon\" aria-hidden=\"true\"></i>\n <span>{{ item.label }}</span>\n </p-tab>\n </ng-container>\n </p-tablist>\n </p-tabs>\n <div class=\"dashboard\">\n <div class=\"dashboard-body\">\n <router-outlet></router-outlet>\n </div>\n </div>\n</div>\n" }]
1429
1438
  }], ctorParameters: () => [{ type: i0.Injector }], propDecorators: { items: [{
1430
1439
  type: Input
1431
- }], tabInstance: [{
1432
- type: ViewChild,
1433
- args: ['tabMenu', { static: false }]
1434
1440
  }], withSubscription: [{
1435
1441
  type: Input
1436
1442
  }] } });
@@ -1498,12 +1504,6 @@ class InputContainerComponent {
1498
1504
  }
1499
1505
  }
1500
1506
  }
1501
- else {
1502
- window.console.warn('Missing FormControlName directive from host element of the component');
1503
- }
1504
- }
1505
- else {
1506
- window.console.warn("Can't find parent FormGroup directive");
1507
1507
  }
1508
1508
  }
1509
1509
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: InputContainerComponent, deps: [{ token: i2.ControlContainer, host: true, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Component }); }
@@ -1563,9 +1563,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
1563
1563
  }] } });
1564
1564
 
1565
1565
  class ResourceSharedComponentsModule {
1566
- constructor() {
1567
- console.log('🚀 RESOURCE SHARED COMPONENTS MODULE LOADED! - Minimal shared components for resource module');
1568
- }
1569
1566
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ResourceSharedComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1570
1567
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: ResourceSharedComponentsModule, declarations: [NoDataComponent, InputContainerComponent], imports: [CommonModule,
1571
1568
  FormsModule,
@@ -1650,7 +1647,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
1650
1647
  FieldErrorDisplayModule
1651
1648
  ]
1652
1649
  }]
1653
- }], ctorParameters: () => [] });
1650
+ }] });
1654
1651
 
1655
1652
  class SplashComponent {
1656
1653
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SplashComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -1693,7 +1690,7 @@ const allModules = [
1693
1690
  NgbNavModule,
1694
1691
  NgbModalModule,
1695
1692
  TableModule,
1696
- TabMenuModule,
1693
+ TabsModule,
1697
1694
  ButtonModule,
1698
1695
  SelectModule,
1699
1696
  MultiSelectModule,
@@ -1704,9 +1701,6 @@ const allModules = [
1704
1701
  NgxDaterangepickerMd.forRoot()
1705
1702
  ];
1706
1703
  class SharedComponentsModule {
1707
- constructor() {
1708
- console.log('🚀 SHARED COMPONENTS MODULE LOADED! - Shared UI components');
1709
- }
1710
1704
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SharedComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1711
1705
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: SharedComponentsModule, declarations: [PasswordValidationComponent,
1712
1706
  PwTabsComponent,
@@ -1733,7 +1727,7 @@ class SharedComponentsModule {
1733
1727
  NgbNavModule,
1734
1728
  NgbModalModule,
1735
1729
  TableModule,
1736
- TabMenuModule,
1730
+ TabsModule,
1737
1731
  ButtonModule,
1738
1732
  SelectModule,
1739
1733
  MultiSelectModule,
@@ -1750,7 +1744,7 @@ class SharedComponentsModule {
1750
1744
  NgbNavModule,
1751
1745
  NgbModalModule,
1752
1746
  TableModule,
1753
- TabMenuModule,
1747
+ TabsModule,
1754
1748
  ButtonModule,
1755
1749
  SelectModule,
1756
1750
  MultiSelectModule,
@@ -1787,7 +1781,7 @@ class SharedComponentsModule {
1787
1781
  NgbNavModule,
1788
1782
  NgbModalModule,
1789
1783
  TableModule,
1790
- TabMenuModule,
1784
+ TabsModule,
1791
1785
  ButtonModule,
1792
1786
  SelectModule,
1793
1787
  MultiSelectModule,
@@ -1856,7 +1850,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
1856
1850
  ResourceSharedComponentsModule
1857
1851
  ]
1858
1852
  }]
1859
- }], ctorParameters: () => [] });
1853
+ }] });
1860
1854
 
1861
1855
  /**
1862
1856
  * Generated bundle index. Do not edit.