@tetacom/ng-components 1.5.3 → 1.5.5

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,44 +1,38 @@
1
- import { ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
1
+ import { EventEmitter, OnChanges, OnDestroy, OnInit, AfterViewInit } from '@angular/core';
2
2
  import { ITreeData } from '../../../common/contract/i-tree-data';
3
3
  import { TreeService } from '../tree.service';
4
4
  import { TetaTemplateDirective } from '../../../directive/teta-template/teta-template.directive';
5
5
  import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
6
6
  import * as i0 from "@angular/core";
7
- export declare class TreeComponent implements OnInit, OnChanges, OnDestroy {
8
- private _service;
9
- private _elementRef;
10
- private _cdr;
11
- private _zone;
12
- set data(data: ITreeData[]);
13
- get data(): ITreeData[];
14
- padding: number;
15
- childNodeName: string;
16
- virtual: boolean;
17
- height: number;
18
- set openItems(items: ITreeData[]);
7
+ export declare class TreeComponent implements OnInit, OnChanges, OnDestroy, AfterViewInit {
8
+ private treeService;
9
+ private elementRef;
10
+ private ngZone;
11
+ data: import("@angular/core").InputSignal<ITreeData[]>;
12
+ padding: import("@angular/core").InputSignal<number>;
13
+ childNodeName: import("@angular/core").InputSignal<string>;
14
+ virtual: import("@angular/core").InputSignal<boolean>;
15
+ height: import("@angular/core").InputSignal<number>;
16
+ openItems: import("@angular/core").ModelSignal<ITreeData[]>;
19
17
  service: EventEmitter<TreeService>;
20
- openItemsChange: EventEmitter<any>;
21
18
  viewport: CdkVirtualScrollViewport;
22
19
  template: TetaTemplateDirective;
23
- childPadding: boolean;
24
- displayData: ITreeData[];
25
- private _data;
26
- private _openItems;
20
+ childPadding: import("@angular/core").Signal<boolean>;
21
+ displayData: import("@angular/core").Signal<ITreeData[]>;
27
22
  private _alive;
28
23
  private _obs;
29
- constructor(_service: TreeService, _elementRef: ElementRef, _cdr: ChangeDetectorRef, _zone: NgZone);
24
+ constructor();
30
25
  set compareItems(func: (item: ITreeData) => any);
31
26
  get compareItems(): (item: ITreeData) => any;
32
27
  private readonly treeClass;
33
28
  ngOnInit(): void;
34
- ngOnChanges(changes: SimpleChanges): void;
29
+ ngOnChanges(): void;
35
30
  ngOnDestroy(): void;
36
31
  ngAfterViewInit(): void;
37
32
  trackRow: (index: number, item: ITreeData) => any;
38
- private hasChildren;
39
33
  private getDisplayData;
40
34
  private addResizeObserver;
41
35
  private removeResizeObserver;
42
36
  static ɵfac: i0.ɵɵFactoryDeclaration<TreeComponent, never>;
43
- static ɵcmp: i0.ɵɵComponentDeclaration<TreeComponent, "teta-tree", never, { "data": { "alias": "data"; "required": false; }; "padding": { "alias": "padding"; "required": false; }; "childNodeName": { "alias": "childNodeName"; "required": false; }; "virtual": { "alias": "virtual"; "required": false; }; "height": { "alias": "height"; "required": false; }; "openItems": { "alias": "openItems"; "required": false; }; "compareItems": { "alias": "compareItems"; "required": false; }; }, { "service": "service"; "openItemsChange": "openItemsChange"; }, ["template"], never, true, never>;
37
+ static ɵcmp: i0.ɵɵComponentDeclaration<TreeComponent, "teta-tree", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "padding": { "alias": "padding"; "required": false; "isSignal": true; }; "childNodeName": { "alias": "childNodeName"; "required": false; "isSignal": true; }; "virtual": { "alias": "virtual"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "openItems": { "alias": "openItems"; "required": false; "isSignal": true; }; "compareItems": { "alias": "compareItems"; "required": false; }; }, { "openItems": "openItemsChange"; "service": "service"; }, ["template"], never, true, never>;
44
38
  }
@@ -1,29 +1,25 @@
1
- import { ChangeDetectorRef, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
1
+ import { Signal, TemplateRef } from '@angular/core';
2
2
  import { ITreeData } from '../../../common/contract/i-tree-data';
3
3
  import { TreeService } from '../tree.service';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * TODO: Lazy загрузка дочерних элементов, Output onExpand, шаблон для иконки expand
7
7
  */
8
- export declare class TreeItemComponent implements OnInit, OnChanges, OnDestroy {
9
- service: TreeService;
10
- private _cdr;
11
- item: ITreeData;
12
- depth: number;
13
- padding: number;
14
- childNodeName: string;
15
- template: TemplateRef<any>;
16
- childPadding: boolean;
8
+ export declare class TreeItemComponent {
9
+ treeService: TreeService;
10
+ item: import("@angular/core").InputSignal<ITreeData>;
11
+ depth: import("@angular/core").InputSignal<number>;
12
+ padding: import("@angular/core").InputSignal<number>;
13
+ childNodeName: import("@angular/core").InputSignal<string>;
14
+ template: import("@angular/core").InputSignal<TemplateRef<any>>;
15
+ childPadding: import("@angular/core").InputSignal<boolean>;
16
+ openItems: Signal<ITreeData[]>;
17
17
  private readonly treeItemClass;
18
- itemIsOpen: boolean;
19
- private _alive;
18
+ itemIsOpen: Signal<boolean>;
20
19
  private readonly treeItemInstance;
21
- get computedDepth(): number;
22
- constructor(service: TreeService, _cdr: ChangeDetectorRef);
20
+ computedDepth: Signal<number>;
21
+ constructor();
23
22
  openItem(): void;
24
- ngOnInit(): void;
25
- ngOnChanges(changes: SimpleChanges): void;
26
- ngOnDestroy(): void;
27
23
  static ɵfac: i0.ɵɵFactoryDeclaration<TreeItemComponent, never>;
28
- static ɵcmp: i0.ɵɵComponentDeclaration<TreeItemComponent, "teta-tree-item", never, { "item": { "alias": "item"; "required": false; }; "depth": { "alias": "depth"; "required": false; }; "padding": { "alias": "padding"; "required": false; }; "childNodeName": { "alias": "childNodeName"; "required": false; }; "template": { "alias": "template"; "required": false; }; "childPadding": { "alias": "childPadding"; "required": false; }; }, {}, never, never, true, never>;
24
+ static ɵcmp: i0.ɵɵComponentDeclaration<TreeItemComponent, "teta-tree-item", never, { "item": { "alias": "item"; "required": false; "isSignal": true; }; "depth": { "alias": "depth"; "required": false; "isSignal": true; }; "padding": { "alias": "padding"; "required": false; "isSignal": true; }; "childNodeName": { "alias": "childNodeName"; "required": false; "isSignal": true; }; "template": { "alias": "template"; "required": false; "isSignal": true; }; "childPadding": { "alias": "childPadding"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
29
25
  }
@@ -1,15 +1,13 @@
1
- import { ChangeDetectorRef, OnInit } from '@angular/core';
1
+ import { Signal } from '@angular/core';
2
2
  import { TreeService } from '../tree.service';
3
3
  import { ITreeData } from '../../../common/contract/i-tree-data';
4
- import { Observable } from 'rxjs';
5
4
  import * as i0 from "@angular/core";
6
- export declare class TreeItemToggleComponent implements OnInit {
7
- service: TreeService;
8
- private _cdr;
9
- item: ITreeData;
10
- open: Observable<boolean>;
11
- constructor(service: TreeService, _cdr: ChangeDetectorRef);
12
- ngOnInit(): void;
5
+ export declare class TreeItemToggleComponent {
6
+ treeService: TreeService;
7
+ item: import("@angular/core").InputSignal<ITreeData>;
8
+ open: Signal<boolean>;
9
+ openItems: Signal<ITreeData[]>;
10
+ constructor();
13
11
  static ɵfac: i0.ɵɵFactoryDeclaration<TreeItemToggleComponent, never>;
14
- static ɵcmp: i0.ɵɵComponentDeclaration<TreeItemToggleComponent, "teta-tree-item-toggle", never, { "item": { "alias": "item"; "required": false; }; }, {}, never, never, true, never>;
12
+ static ɵcmp: i0.ɵɵComponentDeclaration<TreeItemToggleComponent, "teta-tree-item-toggle", never, { "item": { "alias": "item"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
15
13
  }
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, HostBinding, Directive, Optional, Inject, ContentChild, Input, Injectable, Host, HostListener, ViewChild, forwardRef, ElementRef, EventEmitter, Output, TemplateRef, Injector, ViewContainerRef, Pipe, ViewEncapsulation, ChangeDetectorRef, inject, NgModule, input, computed, output, contentChildren, effect, ContentChildren, SkipSelf, PLATFORM_ID, InjectionToken } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, HostBinding, Directive, Optional, Inject, ContentChild, Input, Injectable, Host, HostListener, ViewChild, forwardRef, ElementRef, EventEmitter, Output, TemplateRef, Injector, ViewContainerRef, Pipe, ViewEncapsulation, ChangeDetectorRef, inject, NgModule, input, computed, output, contentChildren, effect, NgZone, model, ContentChildren, SkipSelf, PLATFORM_ID, InjectionToken } from '@angular/core';
3
3
  import * as i1$1 from '@angular/common';
4
4
  import { NgTemplateOutlet, DOCUMENT, NgClass, AsyncPipe, DatePipe, CommonModule, isPlatformBrowser } from '@angular/common';
5
5
  import * as i1 from '@angular/common/http';
@@ -20,6 +20,7 @@ import * as i1$2 from '@jsverse/transloco';
20
20
  import { TranslocoModule, TRANSLOCO_SCOPE, TranslocoService } from '@jsverse/transloco';
21
21
  import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf } from '@angular/cdk/scrolling';
22
22
  import objectHash from 'object-hash';
23
+ import { toSignal } from '@angular/core/rxjs-interop';
23
24
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
24
25
  import isLeapYear from 'dayjs/plugin/isLeapYear';
25
26
  import utc from 'dayjs/plugin/utc';
@@ -8599,25 +8600,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
8599
8600
  }], ctorParameters: () => [] });
8600
8601
 
8601
8602
  class TreeItemToggleComponent {
8602
- constructor(service, _cdr) {
8603
- this.service = service;
8604
- this._cdr = _cdr;
8605
- }
8606
- ngOnInit() {
8607
- this.open = this.service.openItems.pipe(map((_) => {
8608
- const found = _?.find((x) => this.service.compareItems(x) === this.service.compareItems(this.item));
8609
- return found != null;
8610
- }));
8603
+ constructor() {
8604
+ this.treeService = inject(TreeService);
8605
+ this.item = input();
8606
+ this.openItems = toSignal(this.treeService.openItems);
8607
+ this.open = computed(() => {
8608
+ const found = this.openItems()?.find((x) => this.treeService.compareItems(x) === this.treeService.compareItems(this.item()));
8609
+ return !!found;
8610
+ });
8611
8611
  }
8612
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: TreeItemToggleComponent, deps: [{ token: TreeService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
8613
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: TreeItemToggleComponent, isStandalone: true, selector: "teta-tree-item-toggle", inputs: { item: "item" }, ngImport: i0, template: "<teta-icon [name]=\"(open | async) ? 'arrowDownKey' : 'arrowRightKey'\" class=\"tree__icon\"></teta-icon>\n", styles: [":host{display:inline-flex;align-items:center}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8612
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: TreeItemToggleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8613
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.5", type: TreeItemToggleComponent, isStandalone: true, selector: "teta-tree-item-toggle", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<teta-icon [name]=\"open() ? 'arrowDownKey' : 'arrowRightKey'\" class=\"tree__icon\"></teta-icon>\n", styles: [":host{display:inline-flex;align-items:center}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8614
8614
  }
8615
8615
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: TreeItemToggleComponent, decorators: [{
8616
8616
  type: Component,
8617
- args: [{ selector: 'teta-tree-item-toggle', changeDetection: ChangeDetectionStrategy.OnPush, imports: [IconComponent, AsyncPipe], template: "<teta-icon [name]=\"(open | async) ? 'arrowDownKey' : 'arrowRightKey'\" class=\"tree__icon\"></teta-icon>\n", styles: [":host{display:inline-flex;align-items:center}\n"] }]
8618
- }], ctorParameters: () => [{ type: TreeService }, { type: i0.ChangeDetectorRef }], propDecorators: { item: [{
8619
- type: Input
8620
- }] } });
8617
+ args: [{ selector: 'teta-tree-item-toggle', changeDetection: ChangeDetectionStrategy.OnPush, imports: [IconComponent], template: "<teta-icon [name]=\"open() ? 'arrowDownKey' : 'arrowRightKey'\" class=\"tree__icon\"></teta-icon>\n", styles: [":host{display:inline-flex;align-items:center}\n"] }]
8618
+ }], ctorParameters: () => [] });
8621
8619
 
8622
8620
  class TetaTemplateDirective {
8623
8621
  constructor(template) {
@@ -8644,36 +8642,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
8644
8642
  * TODO: Lazy загрузка дочерних элементов, Output onExpand, шаблон для иконки expand
8645
8643
  */
8646
8644
  class TreeItemComponent {
8647
- get computedDepth() {
8648
- return this.depth + (this.item[this.childNodeName]?.length > 0 ? 0 : this.childPadding ? 2 : 1);
8649
- }
8650
- constructor(service, _cdr) {
8651
- this.service = service;
8652
- this._cdr = _cdr;
8653
- this.depth = 0;
8654
- this.padding = 16;
8655
- this.childNodeName = 'children';
8645
+ constructor() {
8646
+ this.treeService = inject(TreeService);
8647
+ this.item = input();
8648
+ this.depth = input(0);
8649
+ this.padding = input(16);
8650
+ this.childNodeName = input('children');
8651
+ this.template = input();
8652
+ this.childPadding = input();
8656
8653
  this.treeItemClass = true;
8657
- this.itemIsOpen = false;
8658
- this._alive = true;
8659
8654
  this.treeItemInstance = true;
8660
- }
8661
- openItem() {
8662
- this.service.openItem(this.item);
8663
- }
8664
- ngOnInit() {
8665
- this.service.openItems.pipe(takeWhile((_) => this._alive)).subscribe((_) => {
8666
- const found = _?.find((x) => this.service.compareItems(x) === this.service.compareItems(this.item));
8667
- this.itemIsOpen = found != null;
8668
- this._cdr.markForCheck();
8655
+ this.computedDepth = computed(() => {
8656
+ return this.depth() + (this.item()[this.childNodeName()]?.length > 0 ? 0 : this.childPadding() ? 2 : 1);
8657
+ });
8658
+ this.openItems = toSignal(this.treeService.openItems);
8659
+ this.itemIsOpen = computed(() => {
8660
+ const found = this.openItems()?.find((x) => this.treeService.compareItems(x) === this.treeService.compareItems(this.item()));
8661
+ return !!found;
8669
8662
  });
8670
8663
  }
8671
- ngOnChanges(changes) { }
8672
- ngOnDestroy() {
8673
- this._alive = false;
8664
+ openItem() {
8665
+ this.treeService.openItem(this.item());
8674
8666
  }
8675
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: TreeItemComponent, deps: [{ token: TreeService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
8676
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: TreeItemComponent, isStandalone: true, selector: "teta-tree-item", inputs: { item: "item", depth: "depth", padding: "padding", childNodeName: "childNodeName", template: "template", childPadding: "childPadding" }, host: { properties: { "class.tree__item-container": "this.treeItemClass", "@treeItemInstance": "this.treeItemInstance" } }, usesOnChanges: true, ngImport: i0, template: "<div class=\"tree__item_content\" [ngClass]=\"'tree__item_content-' + computedDepth\" (click)=\"openItem()\">\n <ng-container\n *ngTemplateOutlet=\"\n template;\n context: { $implicit: item, item: item, open: itemIsOpen, service: service, depth: depth }\n \"\n ></ng-container>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], animations: [
8667
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: TreeItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8668
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.0.5", type: TreeItemComponent, isStandalone: true, selector: "teta-tree-item", inputs: { item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: false, transformFunction: null }, depth: { classPropertyName: "depth", publicName: "depth", isSignal: true, isRequired: false, transformFunction: null }, padding: { classPropertyName: "padding", publicName: "padding", isSignal: true, isRequired: false, transformFunction: null }, childNodeName: { classPropertyName: "childNodeName", publicName: "childNodeName", isSignal: true, isRequired: false, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null }, childPadding: { classPropertyName: "childPadding", publicName: "childPadding", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.tree__item-container": "this.treeItemClass", "@treeItemInstance": "this.treeItemInstance" } }, ngImport: i0, template: "<div class=\"tree__item_content\" [ngClass]=\"'tree__item_content-' + computedDepth()\" (click)=\"openItem()\">\n <ng-container\n *ngTemplateOutlet=\"\n template();\n context: { $implicit: item(), item: item(), open: itemIsOpen(), service: treeService, depth: depth() }\n \"\n ></ng-container>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], animations: [
8677
8669
  trigger('treeItemInstance', [
8678
8670
  transition('void => *', [style({ opacity: '0' }), animate(200, style({ opacity: '1' }))]),
8679
8671
  // transition('* => void', [animate(200, style({opacity: '0'}))]),
@@ -8687,20 +8679,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
8687
8679
  transition('void => *', [style({ opacity: '0' }), animate(200, style({ opacity: '1' }))]),
8688
8680
  // transition('* => void', [animate(200, style({opacity: '0'}))]),
8689
8681
  ]),
8690
- ], imports: [NgClass, NgTemplateOutlet], template: "<div class=\"tree__item_content\" [ngClass]=\"'tree__item_content-' + computedDepth\" (click)=\"openItem()\">\n <ng-container\n *ngTemplateOutlet=\"\n template;\n context: { $implicit: item, item: item, open: itemIsOpen, service: service, depth: depth }\n \"\n ></ng-container>\n</div>\n" }]
8691
- }], ctorParameters: () => [{ type: TreeService }, { type: i0.ChangeDetectorRef }], propDecorators: { item: [{
8692
- type: Input
8693
- }], depth: [{
8694
- type: Input
8695
- }], padding: [{
8696
- type: Input
8697
- }], childNodeName: [{
8698
- type: Input
8699
- }], template: [{
8700
- type: Input
8701
- }], childPadding: [{
8702
- type: Input
8703
- }], treeItemClass: [{
8682
+ ], imports: [NgClass, NgTemplateOutlet], template: "<div class=\"tree__item_content\" [ngClass]=\"'tree__item_content-' + computedDepth()\" (click)=\"openItem()\">\n <ng-container\n *ngTemplateOutlet=\"\n template();\n context: { $implicit: item(), item: item(), open: itemIsOpen(), service: treeService, depth: depth() }\n \"\n ></ng-container>\n</div>\n" }]
8683
+ }], ctorParameters: () => [], propDecorators: { treeItemClass: [{
8704
8684
  type: HostBinding,
8705
8685
  args: ['class.tree__item-container']
8706
8686
  }], treeItemInstance: [{
@@ -8709,26 +8689,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
8709
8689
  }] } });
8710
8690
 
8711
8691
  class TreeComponent {
8712
- set data(data) {
8713
- this._data = data;
8714
- }
8715
- get data() {
8716
- return this._data;
8717
- }
8718
- set openItems(items) {
8719
- this._openItems = items;
8720
- this._service.setOpenItems(items);
8721
- }
8722
- constructor(_service, _elementRef, _cdr, _zone) {
8723
- this._service = _service;
8724
- this._elementRef = _elementRef;
8725
- this._cdr = _cdr;
8726
- this._zone = _zone;
8727
- this.padding = 8;
8728
- this.childNodeName = 'children';
8729
- this.height = 28;
8692
+ constructor() {
8693
+ this.treeService = inject(TreeService);
8694
+ this.elementRef = inject(ElementRef);
8695
+ this.ngZone = inject(NgZone);
8696
+ this.data = input([]);
8697
+ this.padding = input(8);
8698
+ this.childNodeName = input('children');
8699
+ this.virtual = input(false);
8700
+ this.height = input(28);
8701
+ this.openItems = model([]);
8730
8702
  this.service = new EventEmitter();
8731
- this.openItemsChange = new EventEmitter();
8703
+ this.childPadding = computed(() => {
8704
+ return this.data()?.some((_) => _[this.childNodeName()]?.length > 0);
8705
+ });
8706
+ this.displayData = computed(() => {
8707
+ return this.getDisplayData(this.data(), 0);
8708
+ });
8732
8709
  this._alive = true;
8733
8710
  this.treeClass = true;
8734
8711
  this.trackRow = (index, item) => {
@@ -8737,28 +8714,27 @@ class TreeComponent {
8737
8714
  }
8738
8715
  return index;
8739
8716
  };
8740
- this._service.openItems
8741
- .pipe(takeWhile((_) => this._alive), filter$1((_) => this._openItems !== _))
8717
+ effect(() => {
8718
+ this.treeService.setOpenItems(this.openItems());
8719
+ });
8720
+ this.treeService.openItems
8721
+ .pipe(takeWhile((_) => this._alive), filter$1((_) => this.openItems() !== _))
8742
8722
  .subscribe((_) => {
8743
- this._openItems = _;
8744
- this.displayData = this.getDisplayData(this._data, 0);
8745
- this.openItemsChange.emit(_);
8723
+ this.openItems.set(_);
8746
8724
  this.viewport?.checkViewportSize();
8747
8725
  });
8748
8726
  }
8749
8727
  set compareItems(func) {
8750
- this._service.compareItems = func;
8728
+ this.treeService.compareItems = func;
8751
8729
  }
8752
8730
  get compareItems() {
8753
- return this._service.compareItems;
8731
+ return this.treeService.compareItems;
8754
8732
  }
8755
8733
  ngOnInit() {
8756
- this.service.emit(this._service);
8734
+ this.service.emit(this.treeService);
8757
8735
  this.addResizeObserver();
8758
8736
  }
8759
- ngOnChanges(changes) {
8760
- this.displayData = this.getDisplayData(this._data, 0);
8761
- this.childPadding = this.hasChildren(this._data);
8737
+ ngOnChanges() {
8762
8738
  this.viewport?.checkViewportSize();
8763
8739
  }
8764
8740
  ngOnDestroy() {
@@ -8766,25 +8742,22 @@ class TreeComponent {
8766
8742
  this.removeResizeObserver();
8767
8743
  }
8768
8744
  ngAfterViewInit() {
8769
- this._service.scrollToIndex.pipe(takeWhile(() => this._alive)).subscribe((index) => {
8770
- this._zone.runOutsideAngular(() => {
8745
+ this.treeService.scrollToIndex.pipe(takeWhile(() => this._alive)).subscribe((index) => {
8746
+ this.ngZone.runOutsideAngular(() => {
8771
8747
  setTimeout(() => {
8772
8748
  this.viewport?.scrollToIndex(index, 'smooth');
8773
8749
  });
8774
8750
  });
8775
8751
  });
8776
8752
  }
8777
- hasChildren(data) {
8778
- return data?.some((_) => _[this.childNodeName]?.length > 0);
8779
- }
8780
8753
  getDisplayData(data, level) {
8781
8754
  const result = [];
8782
8755
  data?.forEach((item) => {
8783
8756
  item['level'] = level;
8784
8757
  result.push(item);
8785
- if (item[this.childNodeName]?.length > 0 &&
8786
- this._openItems?.find((openItem) => this.compareItems(openItem) === this.compareItems(item))) {
8787
- result.push(...this.getDisplayData(item[this.childNodeName], level + 1));
8758
+ if (item[this.childNodeName()]?.length > 0 &&
8759
+ this.openItems()?.find((openItem) => this.compareItems(openItem) === this.compareItems(item))) {
8760
+ result.push(...this.getDisplayData(item[this.childNodeName()], level + 1));
8788
8761
  }
8789
8762
  });
8790
8763
  return result;
@@ -8793,14 +8766,14 @@ class TreeComponent {
8793
8766
  this._obs = new ResizeObserver((_) => {
8794
8767
  this.viewport?.checkViewportSize();
8795
8768
  });
8796
- this._obs.observe(this._elementRef.nativeElement);
8769
+ this._obs.observe(this.elementRef.nativeElement);
8797
8770
  }
8798
8771
  removeResizeObserver() {
8799
- this._obs.unobserve(this._elementRef.nativeElement);
8772
+ this._obs.unobserve(this.elementRef.nativeElement);
8800
8773
  this._obs.disconnect();
8801
8774
  }
8802
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: TreeComponent, deps: [{ token: TreeService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
8803
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: TreeComponent, isStandalone: true, selector: "teta-tree", inputs: { data: "data", padding: "padding", childNodeName: "childNodeName", virtual: "virtual", height: "height", openItems: "openItems", compareItems: "compareItems" }, outputs: { service: "service", openItemsChange: "openItemsChange" }, host: { properties: { "class.tree": "this.treeClass" } }, providers: [TreeService], queries: [{ propertyName: "template", first: true, predicate: TetaTemplateDirective, descendants: true, static: true }], viewQueries: [{ propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], usesOnChanges: true, ngImport: i0, template: "@if (virtual) {\n <teta-scrollable class=\"column column_auto\">\n <cdk-virtual-scroll-viewport tetaScrollable class=\"table-body-container\" [itemSize]=\"height\">\n <teta-tree-item\n *cdkVirtualFor=\"let item of displayData; templateCacheSize: 0; trackBy: trackRow\"\n [item]=\"item\"\n [style.height.px]=\"height\"\n [depth]=\"item['level']\"\n [padding]=\"padding\"\n [childNodeName]=\"childNodeName\"\n [childPadding]=\"childPadding\"\n [template]=\"template?.template\"\n ></teta-tree-item>\n </cdk-virtual-scroll-viewport>\n </teta-scrollable>\n} @else {\n <teta-scrollable class=\"column column_auto\" direction=\"column\">\n @for (item of displayData; track trackRow($index, item)) {\n <teta-tree-item\n [item]=\"item\"\n [style.height.px]=\"height\"\n [depth]=\"item['level']\"\n [padding]=\"padding\"\n [childNodeName]=\"childNodeName\"\n [childPadding]=\"childPadding\"\n [template]=\"template?.template\"\n ></teta-tree-item>\n }\n </teta-scrollable>\n}\n", styles: [""], dependencies: [{ kind: "component", type: ScrollableComponent, selector: "teta-scrollable", inputs: ["direction", "showScrollbars", "contentClass"], outputs: ["scroll"] }, { kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: ScrollableDirective, selector: "[tetaScrollable]" }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: TreeItemComponent, selector: "teta-tree-item", inputs: ["item", "depth", "padding", "childNodeName", "template", "childPadding"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8775
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: TreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8776
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: TreeComponent, isStandalone: true, selector: "teta-tree", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, padding: { classPropertyName: "padding", publicName: "padding", isSignal: true, isRequired: false, transformFunction: null }, childNodeName: { classPropertyName: "childNodeName", publicName: "childNodeName", isSignal: true, isRequired: false, transformFunction: null }, virtual: { classPropertyName: "virtual", publicName: "virtual", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, openItems: { classPropertyName: "openItems", publicName: "openItems", isSignal: true, isRequired: false, transformFunction: null }, compareItems: { classPropertyName: "compareItems", publicName: "compareItems", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { openItems: "openItemsChange", service: "service" }, host: { properties: { "class.tree": "this.treeClass" } }, providers: [TreeService], queries: [{ propertyName: "template", first: true, predicate: TetaTemplateDirective, descendants: true, static: true }], viewQueries: [{ propertyName: "viewport", first: true, predicate: CdkVirtualScrollViewport, descendants: true }], usesOnChanges: true, ngImport: i0, template: "@if (virtual()) {\n <teta-scrollable class=\"column column_auto\">\n <cdk-virtual-scroll-viewport tetaScrollable class=\"table-body-container\" [itemSize]=\"height()\">\n <teta-tree-item\n *cdkVirtualFor=\"let item of displayData(); templateCacheSize: 0; trackBy: trackRow\"\n [item]=\"item\"\n [style.height.px]=\"height()\"\n [depth]=\"item['level']\"\n [padding]=\"padding()\"\n [childNodeName]=\"childNodeName()\"\n [childPadding]=\"childPadding()\"\n [template]=\"template?.template\"\n ></teta-tree-item>\n </cdk-virtual-scroll-viewport>\n </teta-scrollable>\n} @else {\n <teta-scrollable class=\"column column_auto\" direction=\"column\">\n @for (item of displayData(); track trackRow($index, item)) {\n <teta-tree-item\n [item]=\"item\"\n [style.height.px]=\"height()\"\n [depth]=\"item['level']\"\n [padding]=\"padding()\"\n [childNodeName]=\"childNodeName()\"\n [childPadding]=\"childPadding()\"\n [template]=\"template?.template\"\n ></teta-tree-item>\n }\n </teta-scrollable>\n}\n", styles: [""], dependencies: [{ kind: "component", type: ScrollableComponent, selector: "teta-scrollable", inputs: ["direction", "showScrollbars", "contentClass"], outputs: ["scroll"] }, { kind: "component", type: CdkVirtualScrollViewport, selector: "cdk-virtual-scroll-viewport", inputs: ["orientation", "appendOnly"], outputs: ["scrolledIndexChange"] }, { kind: "directive", type: CdkFixedSizeVirtualScroll, selector: "cdk-virtual-scroll-viewport[itemSize]", inputs: ["itemSize", "minBufferPx", "maxBufferPx"] }, { kind: "directive", type: ScrollableDirective, selector: "[tetaScrollable]" }, { kind: "directive", type: CdkVirtualForOf, selector: "[cdkVirtualFor][cdkVirtualForOf]", inputs: ["cdkVirtualForOf", "cdkVirtualForTrackBy", "cdkVirtualForTemplate", "cdkVirtualForTemplateCacheSize"] }, { kind: "component", type: TreeItemComponent, selector: "teta-tree-item", inputs: ["item", "depth", "padding", "childNodeName", "template", "childPadding"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8804
8777
  }
8805
8778
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: TreeComponent, decorators: [{
8806
8779
  type: Component,
@@ -8811,22 +8784,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
8811
8784
  ScrollableDirective,
8812
8785
  CdkVirtualForOf,
8813
8786
  TreeItemComponent,
8814
- ], template: "@if (virtual) {\n <teta-scrollable class=\"column column_auto\">\n <cdk-virtual-scroll-viewport tetaScrollable class=\"table-body-container\" [itemSize]=\"height\">\n <teta-tree-item\n *cdkVirtualFor=\"let item of displayData; templateCacheSize: 0; trackBy: trackRow\"\n [item]=\"item\"\n [style.height.px]=\"height\"\n [depth]=\"item['level']\"\n [padding]=\"padding\"\n [childNodeName]=\"childNodeName\"\n [childPadding]=\"childPadding\"\n [template]=\"template?.template\"\n ></teta-tree-item>\n </cdk-virtual-scroll-viewport>\n </teta-scrollable>\n} @else {\n <teta-scrollable class=\"column column_auto\" direction=\"column\">\n @for (item of displayData; track trackRow($index, item)) {\n <teta-tree-item\n [item]=\"item\"\n [style.height.px]=\"height\"\n [depth]=\"item['level']\"\n [padding]=\"padding\"\n [childNodeName]=\"childNodeName\"\n [childPadding]=\"childPadding\"\n [template]=\"template?.template\"\n ></teta-tree-item>\n }\n </teta-scrollable>\n}\n" }]
8815
- }], ctorParameters: () => [{ type: TreeService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }], propDecorators: { data: [{
8816
- type: Input
8817
- }], padding: [{
8818
- type: Input
8819
- }], childNodeName: [{
8820
- type: Input
8821
- }], virtual: [{
8822
- type: Input
8823
- }], height: [{
8824
- type: Input
8825
- }], openItems: [{
8826
- type: Input
8827
- }], service: [{
8828
- type: Output
8829
- }], openItemsChange: [{
8787
+ ], template: "@if (virtual()) {\n <teta-scrollable class=\"column column_auto\">\n <cdk-virtual-scroll-viewport tetaScrollable class=\"table-body-container\" [itemSize]=\"height()\">\n <teta-tree-item\n *cdkVirtualFor=\"let item of displayData(); templateCacheSize: 0; trackBy: trackRow\"\n [item]=\"item\"\n [style.height.px]=\"height()\"\n [depth]=\"item['level']\"\n [padding]=\"padding()\"\n [childNodeName]=\"childNodeName()\"\n [childPadding]=\"childPadding()\"\n [template]=\"template?.template\"\n ></teta-tree-item>\n </cdk-virtual-scroll-viewport>\n </teta-scrollable>\n} @else {\n <teta-scrollable class=\"column column_auto\" direction=\"column\">\n @for (item of displayData(); track trackRow($index, item)) {\n <teta-tree-item\n [item]=\"item\"\n [style.height.px]=\"height()\"\n [depth]=\"item['level']\"\n [padding]=\"padding()\"\n [childNodeName]=\"childNodeName()\"\n [childPadding]=\"childPadding()\"\n [template]=\"template?.template\"\n ></teta-tree-item>\n }\n </teta-scrollable>\n}\n" }]
8788
+ }], ctorParameters: () => [], propDecorators: { service: [{
8830
8789
  type: Output
8831
8790
  }], viewport: [{
8832
8791
  type: ViewChild,
@@ -8948,7 +8907,7 @@ class VisibilityDropdownTabComponent {
8948
8907
  this._alive = false;
8949
8908
  }
8950
8909
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: VisibilityDropdownTabComponent, deps: [{ token: TableService }, { token: TetaConfigService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
8951
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: VisibilityDropdownTabComponent, isStandalone: true, selector: "teta-visibility-dropdown-tab", inputs: { columns: "columns", column: "column", state: "state", data: "data", close: "close" }, ngImport: i0, template: "@if (locale | async; as loc) {\n <div class=\"list-item padding-left-6 padding-top-2\" [class.padding-left-9]=\"childMode\">\n <teta-checkbox\n [binary]=\"true\"\n [allowNull]=\"true\"\n [ngModel]=\"allColumnsVisible()\"\n (ngModelChange)=\"setAllColumns($event)\"\n >\n {{ loc.all }}\n </teta-checkbox>\n </div>\n <div class=\"list-divider\"></div>\n <teta-scrollable class=\"padding-v-2 column column_auto\">\n <teta-tree\n [data]=\"columns\"\n [openItems]=\"openItems\"\n (openItemsChange)=\"openItems = $event\"\n [childNodeName]=\"'columns'\"\n [compareItems]=\"compareItems\"\n >\n <ng-template tetaTemplate let-item>\n <div class=\"tree__item\" style=\"align-items: unset\">\n @if (item.columns?.length > 0) {\n <teta-tree-item-toggle [item]=\"item\"></teta-tree-item-toggle>\n }\n <teta-checkbox\n style=\"flex-grow: 1\"\n [ngModel]=\"!columnIsHidden(item)\"\n (ngModelChange)=\"setColumnVisibility(item, $event)\"\n (click)=\"$event.stopPropagation()\"\n [binary]=\"true\"\n >\n {{ item.caption }}\n </teta-checkbox>\n </div>\n </ng-template>\n </teta-tree>\n </teta-scrollable>\n <teta-toolbar class=\"justify-content-end\">\n <button\n type=\"button\"\n teta-button\n [disabled]=\"allColumnsVisible() === false\"\n [palette]=\"'primary'\"\n (click)=\"setColumnsVisibility()\"\n >\n {{ loc.apply }}\n </button>\n </teta-toolbar>\n}\n", styles: [":host{display:flex;flex-direction:column;flex-grow:1;min-height:0}\n"], dependencies: [{ kind: "component", type: CheckboxComponent, selector: "teta-checkbox", inputs: ["class", "palette", "noLabel", "disabled", "value", "binary", "labelPosition", "allowNull"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ScrollableComponent, selector: "teta-scrollable", inputs: ["direction", "showScrollbars", "contentClass"], outputs: ["scroll"] }, { kind: "component", type: TreeComponent, selector: "teta-tree", inputs: ["data", "padding", "childNodeName", "virtual", "height", "openItems", "compareItems"], outputs: ["service", "openItemsChange"] }, { kind: "directive", type: TetaTemplateDirective, selector: "[tetaTemplate]", inputs: ["tetaTemplate"] }, { kind: "component", type: TreeItemToggleComponent, selector: "teta-tree-item-toggle", inputs: ["item"] }, { kind: "component", type: ToolbarComponent, selector: "teta-toolbar", inputs: ["palette", "class"] }, { kind: "component", type: ButtonComponent, selector: "button[teta-button], teta-button", inputs: ["palette", "class", "view", "square", "viewType", "size"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8910
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: VisibilityDropdownTabComponent, isStandalone: true, selector: "teta-visibility-dropdown-tab", inputs: { columns: "columns", column: "column", state: "state", data: "data", close: "close" }, ngImport: i0, template: "@if (locale | async; as loc) {\n <div class=\"list-item padding-left-6 padding-top-2\" [class.padding-left-9]=\"childMode\">\n <teta-checkbox\n [binary]=\"true\"\n [allowNull]=\"true\"\n [ngModel]=\"allColumnsVisible()\"\n (ngModelChange)=\"setAllColumns($event)\"\n >\n {{ loc.all }}\n </teta-checkbox>\n </div>\n <div class=\"list-divider\"></div>\n <teta-scrollable class=\"padding-v-2 column column_auto\">\n <teta-tree\n [data]=\"columns\"\n [openItems]=\"openItems\"\n (openItemsChange)=\"openItems = $event\"\n [childNodeName]=\"'columns'\"\n [compareItems]=\"compareItems\"\n >\n <ng-template tetaTemplate let-item>\n <div class=\"tree__item\" style=\"align-items: unset\">\n @if (item.columns?.length > 0) {\n <teta-tree-item-toggle [item]=\"item\"></teta-tree-item-toggle>\n }\n <teta-checkbox\n style=\"flex-grow: 1\"\n [ngModel]=\"!columnIsHidden(item)\"\n (ngModelChange)=\"setColumnVisibility(item, $event)\"\n (click)=\"$event.stopPropagation()\"\n [binary]=\"true\"\n >\n {{ item.caption }}\n </teta-checkbox>\n </div>\n </ng-template>\n </teta-tree>\n </teta-scrollable>\n <teta-toolbar class=\"justify-content-end\">\n <button\n type=\"button\"\n teta-button\n [disabled]=\"allColumnsVisible() === false\"\n [palette]=\"'primary'\"\n (click)=\"setColumnsVisibility()\"\n >\n {{ loc.apply }}\n </button>\n </teta-toolbar>\n}\n", styles: [":host{display:flex;flex-direction:column;flex-grow:1;min-height:0}\n"], dependencies: [{ kind: "component", type: CheckboxComponent, selector: "teta-checkbox", inputs: ["class", "palette", "noLabel", "disabled", "value", "binary", "labelPosition", "allowNull"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ScrollableComponent, selector: "teta-scrollable", inputs: ["direction", "showScrollbars", "contentClass"], outputs: ["scroll"] }, { kind: "component", type: TreeComponent, selector: "teta-tree", inputs: ["data", "padding", "childNodeName", "virtual", "height", "openItems", "compareItems"], outputs: ["openItemsChange", "service"] }, { kind: "directive", type: TetaTemplateDirective, selector: "[tetaTemplate]", inputs: ["tetaTemplate"] }, { kind: "component", type: TreeItemToggleComponent, selector: "teta-tree-item-toggle", inputs: ["item"] }, { kind: "component", type: ToolbarComponent, selector: "teta-toolbar", inputs: ["palette", "class"] }, { kind: "component", type: ButtonComponent, selector: "button[teta-button], teta-button", inputs: ["palette", "class", "view", "square", "viewType", "size"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8952
8911
  }
8953
8912
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: VisibilityDropdownTabComponent, decorators: [{
8954
8913
  type: Component,