@kris701/ez-ui 1.1.16 → 1.1.18

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.
@@ -25,8 +25,8 @@ import { TuiBlockStatus, TuiNavigation, TuiAsideGroupComponent } from '@taiga-ui
25
25
  import { v4 } from 'uuid';
26
26
  import { firstValueFrom, switchMap } from 'rxjs';
27
27
  import * as i1$1 from '@angular/common/http';
28
- import * as i3$4 from '@angular/router';
29
- import { RouterLink, NavigationEnd, RouterModule } from '@angular/router';
28
+ import * as i2$2 from '@angular/router';
29
+ import { RouterLink, RouterModule } from '@angular/router';
30
30
 
31
31
  class EzUIBooleanInput {
32
32
  icon = '';
@@ -5161,50 +5161,56 @@ class EzUILayoutService {
5161
5161
 
5162
5162
  class EzUISideBar {
5163
5163
  layoutService;
5164
- layout;
5165
5164
  router;
5165
+ sidebarItems = signal([], /* @ts-ignore */
5166
+ ...(ngDevMode ? [{ debugName: "sidebarItems" }] : /* istanbul ignore next */ []));
5167
+ sidebarFooterItems = signal([], /* @ts-ignore */
5168
+ ...(ngDevMode ? [{ debugName: "sidebarFooterItems" }] : /* istanbul ignore next */ []));
5166
5169
  haveMoved = signal(false, /* @ts-ignore */
5167
5170
  ...(ngDevMode ? [{ debugName: "haveMoved" }] : /* istanbul ignore next */ []));
5168
- constructor(layoutService, layout, router) {
5171
+ baseRoute = signal("/", /* @ts-ignore */
5172
+ ...(ngDevMode ? [{ debugName: "baseRoute" }] : /* istanbul ignore next */ []));
5173
+ constructor(layoutService, router) {
5169
5174
  this.layoutService = layoutService;
5170
- this.layout = layout;
5171
5175
  this.router = router;
5172
- router.events.subscribe((val) => {
5173
- if (val instanceof NavigationEnd)
5174
- this.initialize();
5175
- });
5176
+ }
5177
+ ngOnInit() {
5178
+ this.initialize();
5176
5179
  }
5177
5180
  initialize() {
5178
- this.hideEmptySections(this.layout.sidebarItems());
5179
- this.hideEmptySections(this.layout.sidebarFooterItems());
5180
- if (!this.haveMoved() && this.router.routerState.snapshot.url == '/')
5181
- this.gotoFirstPage(this.layout.sidebarItems());
5182
- this.setActiveRoute(this.layout.sidebarItems());
5183
- this.setActiveRoute(this.layout.sidebarFooterItems());
5181
+ var sidebarItems = [...this.sidebarItems()];
5182
+ var sidebarFooterItems = [...this.sidebarFooterItems()];
5183
+ this.hideEmptySections(sidebarItems);
5184
+ this.hideEmptySections(sidebarFooterItems);
5185
+ if (!this.haveMoved() && this.router.routerState.snapshot.url == this.baseRoute())
5186
+ this.gotoFirstPage(sidebarItems);
5187
+ this.setActiveRoute(sidebarItems);
5188
+ this.setActiveRoute(sidebarFooterItems);
5189
+ this.sidebarItems.set(sidebarItems);
5190
+ this.sidebarFooterItems.set(sidebarFooterItems);
5184
5191
  }
5185
5192
  hideEmptySections(menu) {
5186
- menu.forEach((x) => {
5187
- if (x.items) {
5188
- this.hideEmptySections(x.items);
5189
- if (x.items.every((x) => x.visible == false)) {
5190
- x.visible = false;
5193
+ for (let item of menu) {
5194
+ if (item.items) {
5195
+ this.hideEmptySections(item.items);
5196
+ if (item.items.every((x) => x.visible == false)) {
5197
+ item.visible = false;
5191
5198
  }
5192
- ;
5193
5199
  }
5194
- });
5200
+ }
5195
5201
  }
5196
5202
  setActiveRoute(menu, parent = null) {
5197
- menu.forEach((x) => {
5198
- if (x.routerLink) {
5199
- if (x.routerLink == this.router.routerState.snapshot.url) {
5200
- x.expanded = true;
5203
+ for (let item of menu) {
5204
+ if (item.routerLink) {
5205
+ if (item.routerLink == this.router.routerState.snapshot.url) {
5206
+ item.expanded = true;
5201
5207
  if (parent)
5202
5208
  parent.expanded = true;
5203
5209
  }
5204
5210
  }
5205
- if (x.items)
5206
- this.setActiveRoute(x.items, x);
5207
- });
5211
+ if (item.items)
5212
+ this.setActiveRoute(item.items, item);
5213
+ }
5208
5214
  }
5209
5215
  gotoFirstPage(menu) {
5210
5216
  var first = menu.find((x) => x.visible == true);
@@ -5218,19 +5224,19 @@ class EzUISideBar {
5218
5224
  }
5219
5225
  }
5220
5226
  }
5221
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUISideBar, deps: [{ token: EzUILayoutService }, { token: EzUILayout }, { token: i3$4.Router }], target: i0.ɵɵFactoryTarget.Component });
5222
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EzUISideBar, isStandalone: true, selector: "ezui-sidebar", ngImport: i0, template: `
5227
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUISideBar, deps: [{ token: EzUILayoutService }, { token: i2$2.Router }], target: i0.ɵɵFactoryTarget.Component });
5228
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EzUISideBar, isStandalone: true, selector: "ezui-sidebar", inputs: { sidebarItems: "sidebarItems", sidebarFooterItems: "sidebarFooterItems", baseRoute: "baseRoute" }, ngImport: i0, template: `
5223
5229
  <aside
5224
5230
  style="height:100%"
5225
5231
  tuitheme=""
5226
5232
  [tuiNavigationAside]="layoutService.isMenuExpanded()"
5227
5233
  >
5228
- @for(item of layout.sidebarItems(); track item){
5234
+ @for(item of sidebarItems(); track item){
5229
5235
  <ezui-sidebar-item [item]="item"/>
5230
5236
  }
5231
5237
 
5232
5238
  <footer>
5233
- @for(item of layout.sidebarFooterItems(); track item){
5239
+ @for(item of sidebarFooterItems(); track item){
5234
5240
  <ezui-sidebar-item [item]="item"/>
5235
5241
  }
5236
5242
  </footer>
@@ -5249,19 +5255,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
5249
5255
  tuitheme=""
5250
5256
  [tuiNavigationAside]="layoutService.isMenuExpanded()"
5251
5257
  >
5252
- @for(item of layout.sidebarItems(); track item){
5258
+ @for(item of sidebarItems(); track item){
5253
5259
  <ezui-sidebar-item [item]="item"/>
5254
5260
  }
5255
5261
 
5256
5262
  <footer>
5257
- @for(item of layout.sidebarFooterItems(); track item){
5263
+ @for(item of sidebarFooterItems(); track item){
5258
5264
  <ezui-sidebar-item [item]="item"/>
5259
5265
  }
5260
5266
  </footer>
5261
5267
  </aside>
5262
5268
  `
5263
5269
  }]
5264
- }], ctorParameters: () => [{ type: EzUILayoutService }, { type: EzUILayout }, { type: i3$4.Router }] });
5270
+ }], ctorParameters: () => [{ type: EzUILayoutService }, { type: i2$2.Router }], propDecorators: { sidebarItems: [{
5271
+ type: Input
5272
+ }], sidebarFooterItems: [{
5273
+ type: Input
5274
+ }], baseRoute: [{
5275
+ type: Input
5276
+ }] } });
5265
5277
 
5266
5278
  class EzUITopBar {
5267
5279
  layoutService;
@@ -5334,20 +5346,21 @@ class EzUILayout {
5334
5346
  ...(ngDevMode ? [{ debugName: "sidebarItems" }] : /* istanbul ignore next */ []));
5335
5347
  sidebarFooterItems = signal([], /* @ts-ignore */
5336
5348
  ...(ngDevMode ? [{ debugName: "sidebarFooterItems" }] : /* istanbul ignore next */ []));
5349
+ baseRoute = signal("/", /* @ts-ignore */
5350
+ ...(ngDevMode ? [{ debugName: "baseRoute" }] : /* istanbul ignore next */ []));
5337
5351
  topbarright;
5338
5352
  topbarlogo;
5339
5353
  sidebar = viewChild("sidebar", /* @ts-ignore */
5340
5354
  ...(ngDevMode ? [{ debugName: "sidebar" }] : /* istanbul ignore next */ []));
5341
- forceLoadSidebar() {
5342
- this.sidebar()?.initialize();
5343
- }
5355
+ topbar = viewChild("topbar", /* @ts-ignore */
5356
+ ...(ngDevMode ? [{ debugName: "topbar" }] : /* istanbul ignore next */ []));
5344
5357
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUILayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
5345
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: EzUILayout, isStandalone: true, selector: "ezui-layout", inputs: { sidebarItems: "sidebarItems", sidebarFooterItems: "sidebarFooterItems" }, queries: [{ propertyName: "topbarright", first: true, predicate: ["topbarright"], descendants: true }, { propertyName: "topbarlogo", first: true, predicate: ["topbarlogo"], descendants: true }], viewQueries: [{ propertyName: "sidebar", first: true, predicate: ["sidebar"], descendants: true, isSignal: true }], ngImport: i0, template: `
5358
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.0", type: EzUILayout, isStandalone: true, selector: "ezui-layout", inputs: { sidebarItems: "sidebarItems", sidebarFooterItems: "sidebarFooterItems", baseRoute: "baseRoute" }, queries: [{ propertyName: "topbarright", first: true, predicate: ["topbarright"], descendants: true }, { propertyName: "topbarlogo", first: true, predicate: ["topbarlogo"], descendants: true }], viewQueries: [{ propertyName: "sidebar", first: true, predicate: ["sidebar"], descendants: true, isSignal: true }, { propertyName: "topbar", first: true, predicate: ["topbar"], descendants: true, isSignal: true }], ngImport: i0, template: `
5346
5359
  <tui-root class="rootContainer">
5347
5360
  <div class="layout-wrapper">
5348
- <ezui-topbar></ezui-topbar>
5361
+ <ezui-topbar #topbar></ezui-topbar>
5349
5362
  <div class="layout-wrapper-split">
5350
- <ezui-sidebar #sidebar></ezui-sidebar>
5363
+ <ezui-sidebar [sidebarItems]="sidebarItems" [sidebarFooterItems]="sidebarFooterItems" [baseRoute]="baseRoute" #sidebar></ezui-sidebar>
5351
5364
  <div class="layout-main-container">
5352
5365
  <tui-scrollbar class="layout-main">
5353
5366
  <router-outlet></router-outlet>
@@ -5356,16 +5369,16 @@ class EzUILayout {
5356
5369
  </div>
5357
5370
  </div>
5358
5371
  </tui-root>
5359
- `, isInline: true, styles: ["::ng-deep .rootContainer .t-root-content{display:flex;height:100vh;width:100vw}.layout-wrapper{display:flex;flex-direction:column;height:100vh;min-height:100vh;max-height:100vh}.layout-wrapper-split{display:flex;flex-direction:row;width:100%;height:100%;overflow:hidden;max-width:100vw}.layout-main-container{display:flex;flex-direction:column;min-height:inherit;max-height:inherit;width:100%;justify-content:space-between;overflow:hidden}.layout-main{flex:1 1 auto;display:flex}::ng-deep .layout-main>.t-content{padding:1rem;display:flex;block-size:auto!important;box-sizing:border-box}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i3$4.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: EzUITopBar, selector: "ezui-topbar" }, { kind: "component", type: EzUISideBar, selector: "ezui-sidebar" }, { kind: "component", type: TuiScrollbar, selector: "tui-scrollbar" }, { kind: "component", type: TuiRoot, selector: "tui-root" }] });
5372
+ `, isInline: true, styles: ["::ng-deep .rootContainer .t-root-content{display:flex;height:100vh;width:100vw}.layout-wrapper{display:flex;flex-direction:column;height:100vh;min-height:100vh;max-height:100vh}.layout-wrapper-split{display:flex;flex-direction:row;width:100%;height:100%;overflow:hidden;max-width:100vw}.layout-main-container{display:flex;flex-direction:column;min-height:inherit;max-height:inherit;width:100%;justify-content:space-between;overflow:hidden}.layout-main{flex:1 1 auto;display:flex}::ng-deep .layout-main>.t-content{padding:1rem;display:flex;block-size:auto!important;box-sizing:border-box}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i2$2.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: EzUITopBar, selector: "ezui-topbar" }, { kind: "component", type: EzUISideBar, selector: "ezui-sidebar", inputs: ["sidebarItems", "sidebarFooterItems", "baseRoute"] }, { kind: "component", type: TuiScrollbar, selector: "tui-scrollbar" }, { kind: "component", type: TuiRoot, selector: "tui-root" }] });
5360
5373
  }
5361
5374
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUILayout, decorators: [{
5362
5375
  type: Component,
5363
5376
  args: [{ selector: 'ezui-layout', standalone: true, imports: [CommonModule, RouterModule, EzUITopBar, EzUISideBar, TuiNavigation, TuiScrollbar, TuiRoot], template: `
5364
5377
  <tui-root class="rootContainer">
5365
5378
  <div class="layout-wrapper">
5366
- <ezui-topbar></ezui-topbar>
5379
+ <ezui-topbar #topbar></ezui-topbar>
5367
5380
  <div class="layout-wrapper-split">
5368
- <ezui-sidebar #sidebar></ezui-sidebar>
5381
+ <ezui-sidebar [sidebarItems]="sidebarItems" [sidebarFooterItems]="sidebarFooterItems" [baseRoute]="baseRoute" #sidebar></ezui-sidebar>
5369
5382
  <div class="layout-main-container">
5370
5383
  <tui-scrollbar class="layout-main">
5371
5384
  <router-outlet></router-outlet>
@@ -5379,13 +5392,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
5379
5392
  type: Input
5380
5393
  }], sidebarFooterItems: [{
5381
5394
  type: Input
5395
+ }], baseRoute: [{
5396
+ type: Input
5382
5397
  }], topbarright: [{
5383
5398
  type: ContentChild,
5384
5399
  args: ['topbarright', { static: false }]
5385
5400
  }], topbarlogo: [{
5386
5401
  type: ContentChild,
5387
5402
  args: ['topbarlogo', { static: false }]
5388
- }], sidebar: [{ type: i0.ViewChild, args: ["sidebar", { isSignal: true }] }] } });
5403
+ }], sidebar: [{ type: i0.ViewChild, args: ["sidebar", { isSignal: true }] }], topbar: [{ type: i0.ViewChild, args: ["topbar", { isSignal: true }] }] } });
5389
5404
 
5390
5405
  // Components
5391
5406