@kris701/ez-ui 1.1.15 → 1.1.17

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,7 +1,7 @@
1
1
  import * as i2$1 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { EventEmitter, Output, Input, Component, signal, ViewChild, ContentChild, Directive, inject } from '@angular/core';
4
+ import { EventEmitter, Output, Input, Component, signal, ViewChild, ContentChild, Directive, inject, viewChild } from '@angular/core';
5
5
  import * as i1 from '@angular/forms';
6
6
  import { FormsModule } from '@angular/forms';
7
7
  import * as i3$1 from '@taiga-ui/core';
@@ -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,54 @@ 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
+ constructor(layoutService, router) {
5169
5172
  this.layoutService = layoutService;
5170
- this.layout = layout;
5171
5173
  this.router = router;
5172
- router.events.subscribe((val) => {
5173
- if (val instanceof NavigationEnd)
5174
- this.initialize();
5175
- });
5174
+ }
5175
+ ngOnInit() {
5176
+ this.initialize();
5176
5177
  }
5177
5178
  initialize() {
5178
- this.hideEmptySections(this.layout.sidebarItems());
5179
- this.hideEmptySections(this.layout.sidebarFooterItems());
5179
+ var sidebarItems = [...this.sidebarItems()];
5180
+ var sidebarFooterItems = [...this.sidebarFooterItems()];
5181
+ this.hideEmptySections(sidebarItems);
5182
+ this.hideEmptySections(sidebarFooterItems);
5180
5183
  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());
5184
+ this.gotoFirstPage(sidebarItems);
5185
+ this.setActiveRoute(sidebarItems);
5186
+ this.setActiveRoute(sidebarFooterItems);
5187
+ this.sidebarItems.set(sidebarItems);
5188
+ this.sidebarFooterItems.set(sidebarFooterItems);
5184
5189
  }
5185
5190
  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;
5191
+ for (let item of menu) {
5192
+ if (item.items) {
5193
+ this.hideEmptySections(item.items);
5194
+ if (item.items.every((x) => x.visible == false)) {
5195
+ item.visible = false;
5191
5196
  }
5192
- ;
5193
5197
  }
5194
- });
5198
+ }
5195
5199
  }
5196
5200
  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;
5201
+ for (let item of menu) {
5202
+ if (item.routerLink) {
5203
+ if (item.routerLink == this.router.routerState.snapshot.url) {
5204
+ item.expanded = true;
5201
5205
  if (parent)
5202
5206
  parent.expanded = true;
5203
5207
  }
5204
5208
  }
5205
- if (x.items)
5206
- this.setActiveRoute(x.items, x);
5207
- });
5209
+ if (item.items)
5210
+ this.setActiveRoute(item.items, item);
5211
+ }
5208
5212
  }
5209
5213
  gotoFirstPage(menu) {
5210
5214
  var first = menu.find((x) => x.visible == true);
@@ -5218,19 +5222,19 @@ class EzUISideBar {
5218
5222
  }
5219
5223
  }
5220
5224
  }
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: `
5225
+ 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 });
5226
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.0", type: EzUISideBar, isStandalone: true, selector: "ezui-sidebar", inputs: { sidebarItems: "sidebarItems", sidebarFooterItems: "sidebarFooterItems" }, ngImport: i0, template: `
5223
5227
  <aside
5224
5228
  style="height:100%"
5225
5229
  tuitheme=""
5226
5230
  [tuiNavigationAside]="layoutService.isMenuExpanded()"
5227
5231
  >
5228
- @for(item of layout.sidebarItems(); track item){
5232
+ @for(item of sidebarItems(); track item){
5229
5233
  <ezui-sidebar-item [item]="item"/>
5230
5234
  }
5231
5235
 
5232
5236
  <footer>
5233
- @for(item of layout.sidebarFooterItems(); track item){
5237
+ @for(item of sidebarFooterItems(); track item){
5234
5238
  <ezui-sidebar-item [item]="item"/>
5235
5239
  }
5236
5240
  </footer>
@@ -5249,19 +5253,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
5249
5253
  tuitheme=""
5250
5254
  [tuiNavigationAside]="layoutService.isMenuExpanded()"
5251
5255
  >
5252
- @for(item of layout.sidebarItems(); track item){
5256
+ @for(item of sidebarItems(); track item){
5253
5257
  <ezui-sidebar-item [item]="item"/>
5254
5258
  }
5255
5259
 
5256
5260
  <footer>
5257
- @for(item of layout.sidebarFooterItems(); track item){
5261
+ @for(item of sidebarFooterItems(); track item){
5258
5262
  <ezui-sidebar-item [item]="item"/>
5259
5263
  }
5260
5264
  </footer>
5261
5265
  </aside>
5262
5266
  `
5263
5267
  }]
5264
- }], ctorParameters: () => [{ type: EzUILayoutService }, { type: EzUILayout }, { type: i3$4.Router }] });
5268
+ }], ctorParameters: () => [{ type: EzUILayoutService }, { type: i2$2.Router }], propDecorators: { sidebarItems: [{
5269
+ type: Input
5270
+ }], sidebarFooterItems: [{
5271
+ type: Input
5272
+ }] } });
5265
5273
 
5266
5274
  class EzUITopBar {
5267
5275
  layoutService;
@@ -5336,18 +5344,17 @@ class EzUILayout {
5336
5344
  ...(ngDevMode ? [{ debugName: "sidebarFooterItems" }] : /* istanbul ignore next */ []));
5337
5345
  topbarright;
5338
5346
  topbarlogo;
5339
- sidebar;
5340
- forceLoadSidebar() {
5341
- if (this.sidebar)
5342
- this.sidebar.initialize();
5343
- }
5347
+ sidebar = viewChild("sidebar", /* @ts-ignore */
5348
+ ...(ngDevMode ? [{ debugName: "sidebar" }] : /* istanbul ignore next */ []));
5349
+ topbar = viewChild("topbar", /* @ts-ignore */
5350
+ ...(ngDevMode ? [{ debugName: "topbar" }] : /* istanbul ignore next */ []));
5344
5351
  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: "14.0.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 }, { propertyName: "sidebar", first: true, predicate: ["sidebar"], descendants: true }], ngImport: i0, template: `
5352
+ 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 }, { propertyName: "topbar", first: true, predicate: ["topbar"], descendants: true, isSignal: true }], ngImport: i0, template: `
5346
5353
  <tui-root class="rootContainer">
5347
5354
  <div class="layout-wrapper">
5348
- <ezui-topbar></ezui-topbar>
5355
+ <ezui-topbar #topbar></ezui-topbar>
5349
5356
  <div class="layout-wrapper-split">
5350
- <ezui-sidebar #sidebar></ezui-sidebar>
5357
+ <ezui-sidebar [sidebarItems]="sidebarItems" [sidebarFooterItems]="sidebarFooterItems" #sidebar></ezui-sidebar>
5351
5358
  <div class="layout-main-container">
5352
5359
  <tui-scrollbar class="layout-main">
5353
5360
  <router-outlet></router-outlet>
@@ -5356,16 +5363,16 @@ class EzUILayout {
5356
5363
  </div>
5357
5364
  </div>
5358
5365
  </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" }] });
5366
+ `, 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"] }, { kind: "component", type: TuiScrollbar, selector: "tui-scrollbar" }, { kind: "component", type: TuiRoot, selector: "tui-root" }] });
5360
5367
  }
5361
5368
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImport: i0, type: EzUILayout, decorators: [{
5362
5369
  type: Component,
5363
5370
  args: [{ selector: 'ezui-layout', standalone: true, imports: [CommonModule, RouterModule, EzUITopBar, EzUISideBar, TuiNavigation, TuiScrollbar, TuiRoot], template: `
5364
5371
  <tui-root class="rootContainer">
5365
5372
  <div class="layout-wrapper">
5366
- <ezui-topbar></ezui-topbar>
5373
+ <ezui-topbar #topbar></ezui-topbar>
5367
5374
  <div class="layout-wrapper-split">
5368
- <ezui-sidebar #sidebar></ezui-sidebar>
5375
+ <ezui-sidebar [sidebarItems]="sidebarItems" [sidebarFooterItems]="sidebarFooterItems" #sidebar></ezui-sidebar>
5369
5376
  <div class="layout-main-container">
5370
5377
  <tui-scrollbar class="layout-main">
5371
5378
  <router-outlet></router-outlet>
@@ -5385,10 +5392,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.0", ngImpor
5385
5392
  }], topbarlogo: [{
5386
5393
  type: ContentChild,
5387
5394
  args: ['topbarlogo', { static: false }]
5388
- }], sidebar: [{
5389
- type: ContentChild,
5390
- args: ['sidebar', { static: false }]
5391
- }] } });
5395
+ }], sidebar: [{ type: i0.ViewChild, args: ["sidebar", { isSignal: true }] }], topbar: [{ type: i0.ViewChild, args: ["topbar", { isSignal: true }] }] } });
5392
5396
 
5393
5397
  // Components
5394
5398