@posiwise/shared-components 0.0.150 → 0.0.153

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,46 @@ 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
- return routePath === currentUrl;
1425
+ const pathStr = String(routePath);
1426
+ return currentUrl === pathStr || currentUrl.startsWith(pathStr + '/');
1408
1427
  });
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
- }
1428
+ this.activeTabValue = matchedItem ? this.getItemValue(matchedItem) : undefined;
1419
1429
  }
1420
1430
  ngOnDestroy() {
1421
1431
  this.routeEventSubscription.unsubscribe();
1422
1432
  }
1423
1433
  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"] }] }); }
1434
+ 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
1435
  }
1426
1436
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: PwTabsComponent, decorators: [{
1427
1437
  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" }]
1438
+ 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
1439
  }], ctorParameters: () => [{ type: i0.Injector }], propDecorators: { items: [{
1430
1440
  type: Input
1431
- }], tabInstance: [{
1432
- type: ViewChild,
1433
- args: ['tabMenu', { static: false }]
1434
1441
  }], withSubscription: [{
1435
1442
  type: Input
1436
1443
  }] } });
@@ -1498,12 +1505,6 @@ class InputContainerComponent {
1498
1505
  }
1499
1506
  }
1500
1507
  }
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
1508
  }
1508
1509
  }
1509
1510
  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 +1564,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
1563
1564
  }] } });
1564
1565
 
1565
1566
  class ResourceSharedComponentsModule {
1566
- constructor() {
1567
- console.log('🚀 RESOURCE SHARED COMPONENTS MODULE LOADED! - Minimal shared components for resource module');
1568
- }
1569
1567
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ResourceSharedComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1570
1568
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: ResourceSharedComponentsModule, declarations: [NoDataComponent, InputContainerComponent], imports: [CommonModule,
1571
1569
  FormsModule,
@@ -1650,7 +1648,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
1650
1648
  FieldErrorDisplayModule
1651
1649
  ]
1652
1650
  }]
1653
- }], ctorParameters: () => [] });
1651
+ }] });
1654
1652
 
1655
1653
  class SplashComponent {
1656
1654
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SplashComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -1693,7 +1691,7 @@ const allModules = [
1693
1691
  NgbNavModule,
1694
1692
  NgbModalModule,
1695
1693
  TableModule,
1696
- TabMenuModule,
1694
+ TabsModule,
1697
1695
  ButtonModule,
1698
1696
  SelectModule,
1699
1697
  MultiSelectModule,
@@ -1704,9 +1702,6 @@ const allModules = [
1704
1702
  NgxDaterangepickerMd.forRoot()
1705
1703
  ];
1706
1704
  class SharedComponentsModule {
1707
- constructor() {
1708
- console.log('🚀 SHARED COMPONENTS MODULE LOADED! - Shared UI components');
1709
- }
1710
1705
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SharedComponentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1711
1706
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: SharedComponentsModule, declarations: [PasswordValidationComponent,
1712
1707
  PwTabsComponent,
@@ -1733,7 +1728,7 @@ class SharedComponentsModule {
1733
1728
  NgbNavModule,
1734
1729
  NgbModalModule,
1735
1730
  TableModule,
1736
- TabMenuModule,
1731
+ TabsModule,
1737
1732
  ButtonModule,
1738
1733
  SelectModule,
1739
1734
  MultiSelectModule,
@@ -1750,7 +1745,7 @@ class SharedComponentsModule {
1750
1745
  NgbNavModule,
1751
1746
  NgbModalModule,
1752
1747
  TableModule,
1753
- TabMenuModule,
1748
+ TabsModule,
1754
1749
  ButtonModule,
1755
1750
  SelectModule,
1756
1751
  MultiSelectModule,
@@ -1787,7 +1782,7 @@ class SharedComponentsModule {
1787
1782
  NgbNavModule,
1788
1783
  NgbModalModule,
1789
1784
  TableModule,
1790
- TabMenuModule,
1785
+ TabsModule,
1791
1786
  ButtonModule,
1792
1787
  SelectModule,
1793
1788
  MultiSelectModule,
@@ -1856,7 +1851,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImpo
1856
1851
  ResourceSharedComponentsModule
1857
1852
  ]
1858
1853
  }]
1859
- }], ctorParameters: () => [] });
1854
+ }] });
1860
1855
 
1861
1856
  /**
1862
1857
  * Generated bundle index. Do not edit.