@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.
- package/component/tree/tree/tree.component.d.ts +16 -22
- package/component/tree/tree-item/tree-item.component.d.ts +14 -18
- package/component/tree/tree-item-toggle/tree-item-toggle.component.d.ts +8 -10
- package/fesm2022/tetacom-ng-components.mjs +73 -114
- package/fesm2022/tetacom-ng-components.mjs.map +1 -1
- package/package.json +1 -1
- package/style/skeleton.scss +1 -1
|
@@ -1,44 +1,38 @@
|
|
|
1
|
-
import {
|
|
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
|
|
9
|
-
private
|
|
10
|
-
private
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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(
|
|
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(
|
|
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; }; }, { "
|
|
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 {
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
22
|
-
constructor(
|
|
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 {
|
|
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
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
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(
|
|
8603
|
-
this.
|
|
8604
|
-
this.
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
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: [
|
|
8613
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
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
|
|
8618
|
-
}], ctorParameters: () => [
|
|
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
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
this.
|
|
8652
|
-
this.
|
|
8653
|
-
this.
|
|
8654
|
-
this.
|
|
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
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
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
|
-
|
|
8672
|
-
|
|
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: [
|
|
8676
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
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:
|
|
8691
|
-
}], ctorParameters: () => [
|
|
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
|
-
|
|
8713
|
-
this.
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
this.
|
|
8720
|
-
this.
|
|
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.
|
|
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
|
-
|
|
8741
|
-
.
|
|
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.
|
|
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.
|
|
8728
|
+
this.treeService.compareItems = func;
|
|
8751
8729
|
}
|
|
8752
8730
|
get compareItems() {
|
|
8753
|
-
return this.
|
|
8731
|
+
return this.treeService.compareItems;
|
|
8754
8732
|
}
|
|
8755
8733
|
ngOnInit() {
|
|
8756
|
-
this.service.emit(this.
|
|
8734
|
+
this.service.emit(this.treeService);
|
|
8757
8735
|
this.addResizeObserver();
|
|
8758
8736
|
}
|
|
8759
|
-
ngOnChanges(
|
|
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.
|
|
8770
|
-
this.
|
|
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.
|
|
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.
|
|
8769
|
+
this._obs.observe(this.elementRef.nativeElement);
|
|
8797
8770
|
}
|
|
8798
8771
|
removeResizeObserver() {
|
|
8799
|
-
this._obs.unobserve(this.
|
|
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: [
|
|
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: {
|
|
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: () => [
|
|
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: ["
|
|
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,
|