@tetacom/ng-components 1.5.0 → 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.
- package/component/input/color-input/color-input.component.d.ts +1 -0
- package/directive/only-number/only-number.directive.d.ts +1 -0
- package/directive/scrollable/scrollable/scrollable.component.d.ts +4 -4
- package/fesm2022/tetacom-ng-components.mjs +54 -26
- package/fesm2022/tetacom-ng-components.mjs.map +1 -1
- package/package.json +1 -1
- package/style/accordion.scss +8 -4
|
@@ -18,6 +18,7 @@ export declare class OnlyNumberDirective {
|
|
|
18
18
|
private readonly _minusSign;
|
|
19
19
|
constructor(_elementRef: ElementRef<HTMLInputElement>, _control: NgControl);
|
|
20
20
|
onChange(e: any): void;
|
|
21
|
+
onBlur(e: any): void;
|
|
21
22
|
dblclick(e: any): void;
|
|
22
23
|
onPaste(e: any): void;
|
|
23
24
|
onKeyDown(e: KeyboardEvent): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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
|
|
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,
|
|
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(
|
|
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
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
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.
|
|
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.
|
|
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.
|
|
3688
|
-
this.
|
|
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 }); }
|
|
@@ -3801,7 +3811,18 @@ class OnlyNumberDirective {
|
|
|
3801
3811
|
if (this.tetaOnlyNumber === false) {
|
|
3802
3812
|
return;
|
|
3803
3813
|
}
|
|
3804
|
-
|
|
3814
|
+
e.preventDefault();
|
|
3815
|
+
e.stopPropagation();
|
|
3816
|
+
// this.validateValue(this._elementRef.nativeElement.value);
|
|
3817
|
+
}
|
|
3818
|
+
onBlur(e) {
|
|
3819
|
+
e.preventDefault();
|
|
3820
|
+
e.stopPropagation();
|
|
3821
|
+
const value = this._elementRef.nativeElement.value;
|
|
3822
|
+
if (value.endsWith('.')) {
|
|
3823
|
+
this._elementRef.nativeElement.value = value.replace('.', '');
|
|
3824
|
+
this._elementRef.nativeElement.dispatchEvent(new Event('input'));
|
|
3825
|
+
}
|
|
3805
3826
|
}
|
|
3806
3827
|
dblclick(e) {
|
|
3807
3828
|
if (this.tetaOnlyNumber === false) {
|
|
@@ -3828,11 +3849,7 @@ class OnlyNumberDirective {
|
|
|
3828
3849
|
const allowedKeys = ['Backspace', 'ArrowLeft', 'ArrowRight', 'Delete', 'Escape', 'Tab', 'Home', 'End'];
|
|
3829
3850
|
const separatorIsCloseToSign = signExists && cursorPosition <= 1;
|
|
3830
3851
|
if (this.allowDecimals && !separatorIsCloseToSign && !separatorExists) {
|
|
3831
|
-
// if (this.decimalSeparator === '.') {
|
|
3832
3852
|
allowedKeys.push('.');
|
|
3833
|
-
// } else {
|
|
3834
|
-
// allowedKeys.push(',');
|
|
3835
|
-
// }
|
|
3836
3853
|
}
|
|
3837
3854
|
const firstCharacterIsSeparator = originalValue.charAt(0) !== this.decimalSeparator;
|
|
3838
3855
|
if (this.allowSign && !signExists && firstCharacterIsSeparator && cursorPosition === 0 && !this.onlyPositive) {
|
|
@@ -3853,11 +3870,8 @@ class OnlyNumberDirective {
|
|
|
3853
3870
|
}
|
|
3854
3871
|
else {
|
|
3855
3872
|
if (e.key === ',' && originalValue.indexOf('.') < 0) {
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
this._control.control.patchValue(`${originalValue.slice(0, cursorPosition)}.${originalValue.slice(cursorPosition)}`, {
|
|
3859
|
-
emitEvent: false,
|
|
3860
|
-
});
|
|
3873
|
+
this._elementRef.nativeElement.value = `${originalValue.slice(0, cursorPosition)}.${originalValue.slice(cursorPosition)}`;
|
|
3874
|
+
this._elementRef.nativeElement.dispatchEvent(new Event('input'));
|
|
3861
3875
|
if (this._elementRef.nativeElement.setSelectionRange) {
|
|
3862
3876
|
this._elementRef.nativeElement.setSelectionRange(cursorPosition + 1, cursorPosition + 1);
|
|
3863
3877
|
}
|
|
@@ -3928,9 +3942,12 @@ class OnlyNumberDirective {
|
|
|
3928
3942
|
emitEvent: false,
|
|
3929
3943
|
});
|
|
3930
3944
|
}
|
|
3945
|
+
else {
|
|
3946
|
+
console.error('INVALID VALUE');
|
|
3947
|
+
}
|
|
3931
3948
|
}
|
|
3932
3949
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: OnlyNumberDirective, deps: [{ token: i0.ElementRef }, { token: i2.NgControl }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3933
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: OnlyNumberDirective, isStandalone: true, selector: "[tetaOnlyNumber]", inputs: { tetaOnlyNumber: "tetaOnlyNumber", allowDecimals: "allowDecimals", allowSign: "allowSign", decimalSeparator: "decimalSeparator", commaSeparator: "commaSeparator", onlyPositive: "onlyPositive" }, host: { listeners: { "
|
|
3950
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: OnlyNumberDirective, isStandalone: true, selector: "[tetaOnlyNumber]", inputs: { tetaOnlyNumber: "tetaOnlyNumber", allowDecimals: "allowDecimals", allowSign: "allowSign", decimalSeparator: "decimalSeparator", commaSeparator: "commaSeparator", onlyPositive: "onlyPositive" }, host: { listeners: { "input": "onChange($event)", "blur": "onBlur($event)", "dblclick": "dblclick($event)", "paste": "onPaste($event)", "keydown": "onKeyDown($event)" } }, ngImport: i0 }); }
|
|
3934
3951
|
}
|
|
3935
3952
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: OnlyNumberDirective, decorators: [{
|
|
3936
3953
|
type: Directive,
|
|
@@ -3952,7 +3969,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
3952
3969
|
type: Input
|
|
3953
3970
|
}], onChange: [{
|
|
3954
3971
|
type: HostListener,
|
|
3955
|
-
args: ['
|
|
3972
|
+
args: ['input', ['$event']]
|
|
3973
|
+
}], onBlur: [{
|
|
3974
|
+
type: HostListener,
|
|
3975
|
+
args: ['blur', ['$event']]
|
|
3956
3976
|
}], dblclick: [{
|
|
3957
3977
|
type: HostListener,
|
|
3958
3978
|
args: ['dblclick', ['$event']]
|
|
@@ -4698,6 +4718,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
|
4698
4718
|
class ColorInputComponent {
|
|
4699
4719
|
constructor(_cdr) {
|
|
4700
4720
|
this._cdr = _cdr;
|
|
4721
|
+
this.elementRef = inject(ElementRef);
|
|
4701
4722
|
this.disabled = false;
|
|
4702
4723
|
this.value = '';
|
|
4703
4724
|
}
|
|
@@ -4727,6 +4748,13 @@ class ColorInputComponent {
|
|
|
4727
4748
|
onChange(input) { }
|
|
4728
4749
|
onTouched() { }
|
|
4729
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
|
+
}
|
|
4730
4758
|
if (color && color.startsWith('rgb')) {
|
|
4731
4759
|
const value = color.substring(color.indexOf('(') + 1, color.lastIndexOf(')'));
|
|
4732
4760
|
const colorArray = value.split(',');
|