@tetacom/ng-components 1.5.1 → 1.5.2

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.
@@ -3,6 +3,7 @@ import { ControlValueAccessor } from '@angular/forms';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class ColorInputComponent implements ControlValueAccessor {
5
5
  private _cdr;
6
+ private elementRef;
6
7
  disabled: boolean;
7
8
  input: ElementRef;
8
9
  value: string;
@@ -1,4 +1,4 @@
1
- import { AfterContentChecked, EventEmitter, OnDestroy, OnInit } from '@angular/core';
1
+ import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
3
  import * as i0 from "@angular/core";
4
4
  type ScrollDimensions = {
@@ -7,7 +7,7 @@ type ScrollDimensions = {
7
7
  scrollHeight: number;
8
8
  scrollWidth: number;
9
9
  };
10
- export declare class ScrollableComponent implements OnInit, OnDestroy, AfterContentChecked {
10
+ export declare class ScrollableComponent implements OnInit, OnDestroy {
11
11
  private _scrollDirective;
12
12
  private _scrollableWrapper;
13
13
  private _scrollbarVertical;
@@ -20,14 +20,14 @@ export declare class ScrollableComponent implements OnInit, OnDestroy, AfterCont
20
20
  scrollSize: Observable<ScrollDimensions>;
21
21
  private _container;
22
22
  private _alive;
23
- private _observer;
23
+ private resizeObserver;
24
+ private mutationObserver;
24
25
  constructor();
25
26
  private _observe;
26
27
  scrollVertical(event: any): void;
27
28
  scrollHorizontal(event: any): void;
28
29
  ngOnInit(): void;
29
30
  ngOnDestroy(): void;
30
- ngAfterContentChecked(): void;
31
31
  static ɵfac: i0.ɵɵFactoryDeclaration<ScrollableComponent, never>;
32
32
  static ɵcmp: i0.ɵɵComponentDeclaration<ScrollableComponent, "teta-scrollable", never, { "direction": { "alias": "direction"; "required": false; }; "showScrollbars": { "alias": "showScrollbars"; "required": false; }; "contentClass": { "alias": "contentClass"; "required": false; }; }, { "scroll": "scroll"; }, ["_scrollDirective"], ["*"], true, never>;
33
33
  }
@@ -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, NgModule, inject, 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, 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';
@@ -7,7 +7,7 @@ import { HttpClient } from '@angular/common/http';
7
7
  import { map, takeWhile, tap, filter as filter$1, throttleTime, withLatestFrom } from 'rxjs/operators';
8
8
  import * as THREE from 'three';
9
9
  import * as d3 from 'd3';
10
- import { BehaviorSubject, ReplaySubject, combineLatest, takeWhile as takeWhile$1, filter, map as map$1, lastValueFrom, take, shareReplay, Subject, animationFrameScheduler, fromEvent, tap as tap$1, merge, Observable, share, pipe } from 'rxjs';
10
+ import { BehaviorSubject, ReplaySubject, combineLatest, takeWhile as takeWhile$1, filter, map as map$1, lastValueFrom, take, shareReplay, Subject, debounceTime, animationFrameScheduler, distinctUntilChanged, fromEvent, tap as tap$1, merge, Observable, share, pipe } from 'rxjs';
11
11
  import { OrbitControls } from 'three-stdlib';
12
12
  import * as i2 from '@angular/forms';
13
13
  import { NG_VALUE_ACCESSOR, FormsModule, UntypedFormControl, UntypedFormGroup, Validators, ControlContainer, FormGroup, NgForm, ReactiveFormsModule } from '@angular/forms';
@@ -3649,18 +3649,25 @@ class ScrollableComponent {
3649
3649
  this._observe = () => {
3650
3650
  this._scrollSize.next();
3651
3651
  };
3652
- this.scrollSize = this._scrollSize.asObservable().pipe(throttleTime(100, animationFrameScheduler), map(() => {
3652
+ this.scrollSize = this._scrollSize.asObservable().pipe(debounceTime(100, animationFrameScheduler), map(() => {
3653
+ const { scrollHeight, clientHeight, scrollWidth, clientWidth } = this._container.nativeElement;
3653
3654
  return {
3654
- scrollHeight: this._container.nativeElement.scrollHeight,
3655
- scrollWidth: this._container.nativeElement.scrollWidth,
3656
- clientHeight: this._container.nativeElement.clientHeight,
3657
- clientWidth: this._container.nativeElement.clientWidth,
3655
+ scrollHeight,
3656
+ clientHeight,
3657
+ scrollWidth,
3658
+ clientWidth,
3658
3659
  };
3660
+ }), distinctUntilChanged((previous, current) => {
3661
+ return (previous.scrollHeight === current.scrollHeight &&
3662
+ previous.clientHeight === current.clientHeight &&
3663
+ previous.scrollWidth === current.scrollWidth &&
3664
+ previous.clientWidth === current.clientWidth);
3659
3665
  }), shareReplay({
3660
3666
  refCount: true,
3661
3667
  bufferSize: 1,
3662
3668
  }));
3663
- this._observer = new ResizeObserver(this._observe);
3669
+ this.resizeObserver = new ResizeObserver(this._observe);
3670
+ this.mutationObserver = new MutationObserver(this._observe);
3664
3671
  }
3665
3672
  scrollVertical(event) {
3666
3673
  this._container.nativeElement.scrollTop = event.target.scrollTop;
@@ -3680,15 +3687,18 @@ class ScrollableComponent {
3680
3687
  this.scroll.emit(event);
3681
3688
  }))
3682
3689
  .subscribe();
3683
- this._observer.observe(this._container.nativeElement);
3690
+ this.resizeObserver.observe(this._container.nativeElement);
3691
+ this.mutationObserver.observe(this._container.nativeElement, {
3692
+ attributes: false,
3693
+ childList: true,
3694
+ subtree: true,
3695
+ });
3684
3696
  }
3685
3697
  ngOnDestroy() {
3686
3698
  this._alive = false;
3687
- this._observer.unobserve(this._container.nativeElement);
3688
- this._observer.disconnect();
3689
- }
3690
- ngAfterContentChecked() {
3691
- this._observe();
3699
+ this.resizeObserver.unobserve(this._container.nativeElement);
3700
+ this.resizeObserver.disconnect();
3701
+ this.mutationObserver.disconnect();
3692
3702
  }
3693
3703
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: ScrollableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3694
3704
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: ScrollableComponent, isStandalone: true, selector: "teta-scrollable", inputs: { direction: "direction", showScrollbars: "showScrollbars", contentClass: "contentClass" }, outputs: { scroll: "scroll" }, host: { properties: { "class.show-scrollbars": "this.showScrollbars" } }, queries: [{ propertyName: "_scrollDirective", first: true, predicate: ScrollableDirective, descendants: true, read: ElementRef, static: true }], viewQueries: [{ propertyName: "_scrollableWrapper", first: true, predicate: ["scrollableWrapper"], descendants: true, static: true }, { propertyName: "_scrollbarVertical", first: true, predicate: ["scrollbarVertical"], descendants: true, static: true }, { propertyName: "_scrollbarHorizontal", first: true, predicate: ["scrollbarHorizontal"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"scroll-controls\" *tetaLet=\"scrollSize | async as scrollSize\">\n <div\n #scrollbarVertical\n [class.display-none]=\"scrollSize?.scrollHeight <= scrollSize?.clientHeight\"\n class=\"scroll-scrollbar scroll-scrollbar-vertical\"\n (scroll)=\"scrollVertical($event)\"\n >\n <div [style.height.px]=\"scrollSize?.scrollHeight\" style=\"width: 1px\"></div>\n </div>\n <div\n #scrollbarHorizontal\n [class.display-none]=\"scrollSize?.scrollWidth <= scrollSize?.clientWidth\"\n class=\"scroll-scrollbar scroll-scrollbar-horizontal\"\n (scroll)=\"scrollHorizontal($event)\"\n >\n <div [style.width.px]=\"scrollSize?.scrollWidth\" style=\"height: 1px\"></div>\n </div>\n</div>\n\n<div #scrollableWrapper class=\"scroll-content-wrapper\" [ngClass]=\"contentClass\" [class.column]=\"direction === 'column'\">\n <ng-content></ng-content>\n</div>\n", styles: [":host{overflow:hidden;position:relative;z-index:0;display:flex}:host:hover .scroll-controls{opacity:1}:host.show-scrollbars .scroll-controls{opacity:1}:host::-webkit-scrollbar{width:0;height:0}.scroll-content-wrapper{display:flex;overflow:auto;flex-grow:1}.scroll-content-wrapper::-webkit-scrollbar{width:0;height:0}.scroll-content{position:relative;z-index:0;flex:1;display:flex;height:auto;min-width:0}.scroll-controls{position:absolute;inset:0;z-index:1;pointer-events:none;opacity:0;transition:opacity .5s linear}.scroll-scrollbar{position:absolute;overflow:auto;pointer-events:auto}.scroll-scrollbar-vertical{right:0;top:0;bottom:12px;width:12px}.scroll-scrollbar-horizontal{right:12px;left:0;bottom:0;height:12px}\n"], dependencies: [{ kind: "directive", type: LetDirective, selector: "[tetaLet]", inputs: ["tetaLet"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
@@ -4708,6 +4718,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
4708
4718
  class ColorInputComponent {
4709
4719
  constructor(_cdr) {
4710
4720
  this._cdr = _cdr;
4721
+ this.elementRef = inject(ElementRef);
4711
4722
  this.disabled = false;
4712
4723
  this.value = '';
4713
4724
  }
@@ -4737,6 +4748,13 @@ class ColorInputComponent {
4737
4748
  onChange(input) { }
4738
4749
  onTouched() { }
4739
4750
  getHexColor(color) {
4751
+ if (color && color.startsWith('var')) {
4752
+ const value = color.substring(color.indexOf('(') + 1, color.lastIndexOf(')'));
4753
+ const varColor = getComputedStyle(this.elementRef.nativeElement).getPropertyValue(value).trim();
4754
+ if (varColor) {
4755
+ color = varColor;
4756
+ }
4757
+ }
4740
4758
  if (color && color.startsWith('rgb')) {
4741
4759
  const value = color.substring(color.indexOf('(') + 1, color.lastIndexOf(')'));
4742
4760
  const colorArray = value.split(',');