@tetacom/ng-components 1.2.5 → 1.2.6

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,15 +1,18 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, HostBinding, Directive, Optional, Inject, ContentChild, Input, Injectable, Host, HostListener, forwardRef, ElementRef, EventEmitter, Output, TemplateRef, Injector, ViewChild, ViewContainerRef, Pipe, ViewEncapsulation, ChangeDetectorRef, NgModule, ContentChildren, inject, 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, NgModule, ContentChildren, inject, 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';
6
6
  import { HttpClient } from '@angular/common/http';
7
- import { map, takeWhile as takeWhile$1, filter as filter$1, throttleTime, tap as tap$1, withLatestFrom } from 'rxjs/operators';
7
+ import { map, takeWhile, tap, filter as filter$1, throttleTime, withLatestFrom } from 'rxjs/operators';
8
+ import * as THREE from 'three';
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';
11
+ import { OrbitControls } from 'three-stdlib';
8
12
  import * as i2 from '@angular/forms';
9
13
  import { NG_VALUE_ACCESSOR, FormsModule, UntypedFormControl, UntypedFormGroup, Validators, ControlContainer, NgForm, NgModelGroup, FormGroup, ReactiveFormsModule } from '@angular/forms';
10
14
  import { maskitoDateTimeOptionsGenerator, maskitoDateOptionsGenerator, maskitoDateRangeOptionsGenerator } from '@maskito/kit';
11
15
  import dayjs from 'dayjs';
12
- import { BehaviorSubject, ReplaySubject, combineLatest, takeWhile, filter, map as map$1, lastValueFrom, take, shareReplay, Subject, animationFrameScheduler, fromEvent, tap, merge, Observable, share, pipe } from 'rxjs';
13
16
  import * as i4 from '@maskito/angular';
14
17
  import { MaskitoModule } from '@maskito/angular';
15
18
  import { trigger, transition, style, animate } from '@angular/animations';
@@ -17,9 +20,6 @@ import * as i1$2 from '@ngneat/transloco';
17
20
  import { TranslocoModule, TRANSLOCO_SCOPE } from '@ngneat/transloco';
18
21
  import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf } from '@angular/cdk/scrolling';
19
22
  import objectHash from 'object-hash';
20
- import * as THREE from 'three';
21
- import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
22
- import * as d3 from 'd3';
23
23
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
24
24
  import isLeapYear from 'dayjs/plugin/isLeapYear';
25
25
  import utc from 'dayjs/plugin/utc';
@@ -416,119 +416,402 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImpor
416
416
  args: ['class']
417
417
  }] } });
418
418
 
419
- const CHECKBOX_CONTROL_VALUE_ACCESSOR = {
420
- provide: NG_VALUE_ACCESSOR,
421
- useExisting: forwardRef(() => CheckboxComponent),
422
- multi: true,
423
- };
424
- class CheckboxComponent {
425
- get getClass() {
426
- const result = [this.class, 'checkbox'];
427
- if (this.palette) {
428
- result.push(`checkbox-${this.palette}`);
419
+ class Chart3dOptions {
420
+ constructor(options) {
421
+ this.axes = { ...options?.axes };
422
+ this.series = options?.series || [];
423
+ }
424
+ }
425
+
426
+ class ThemeSwitchService {
427
+ constructor() {
428
+ const value = this.restoreTheme();
429
+ this.theme$ = new BehaviorSubject(value);
430
+ this.theme = this.theme$.asObservable();
431
+ }
432
+ switchTheme() {
433
+ const value = !this.theme$.value;
434
+ this.saveTheme(value);
435
+ this.theme$.next(value);
436
+ }
437
+ saveTheme(value) {
438
+ localStorage.setItem('theme', value.toString());
439
+ }
440
+ restoreTheme() {
441
+ const theme = localStorage.getItem('theme');
442
+ if (theme) {
443
+ return JSON.parse(theme);
429
444
  }
430
- return result.join(' ');
445
+ return true;
431
446
  }
432
- get model() {
433
- return this.model$;
447
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ThemeSwitchService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
448
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ThemeSwitchService, providedIn: 'root' }); }
449
+ }
450
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ThemeSwitchService, decorators: [{
451
+ type: Injectable,
452
+ args: [{
453
+ providedIn: 'root',
454
+ }]
455
+ }], ctorParameters: () => [] });
456
+
457
+ class Chart3dComponent {
458
+ constructor(_elementRef, _themeService) {
459
+ this._elementRef = _elementRef;
460
+ this._themeService = _themeService;
461
+ this.SIDE_SIZE = 100;
462
+ this._alive = true;
434
463
  }
435
- set model(v) {
436
- if (v !== this.model$) {
437
- this.model$ = v;
438
- this.onChange(v);
464
+ set config(config) {
465
+ if (config) {
466
+ this._config = config;
467
+ this.init();
439
468
  }
440
469
  }
441
- constructor(cdr) {
442
- this.cdr = cdr;
443
- this.tabindex = 0;
444
- this.palette = 'primary';
445
- this.labelPosition = 'right';
446
- /**
447
- * Значение
448
- */
449
- this.model$ = null;
470
+ get config() {
471
+ return this._config;
450
472
  }
451
- changeValue() {
452
- if (this.disabled) {
473
+ get canvas() {
474
+ return this.canvasRef.nativeElement;
475
+ }
476
+ ngOnInit() {
477
+ this._themeService.theme
478
+ .pipe(takeWhile(_ => this._alive), tap(_ => {
479
+ this.gridColor = _ ? '#5d6a73' : '#bdbdc6';
480
+ this.axesColor = _ ? '#8e8f9d' : '#7d8f9a';
481
+ this.init();
482
+ }))
483
+ .subscribe();
484
+ }
485
+ ngAfterViewInit() {
486
+ this.addResizeObserver();
487
+ this.createScene();
488
+ this.startRenderingLoop();
489
+ this.init();
490
+ }
491
+ ngOnDestroy() {
492
+ this._alive = false;
493
+ this.removeResizeObserver();
494
+ }
495
+ init() {
496
+ if (!this._scene) {
453
497
  return;
454
498
  }
455
- if (this.binary) {
456
- this.model = !this.model;
457
- }
458
- else {
459
- if (!this.isChecked()) {
460
- this.addValue();
461
- }
462
- else {
463
- this.removeValue();
464
- }
465
- }
466
- this.checked = this.isChecked();
467
- }
468
- writeValue(model) {
469
- if (this.binary) {
470
- this.model$ = model;
499
+ while (this._scene.children.length > 0) {
500
+ this._scene.remove(this._scene.children[0]);
471
501
  }
472
- else {
473
- if (model && model instanceof Array) {
474
- this.model$ = model;
475
- }
476
- else {
477
- this.model$ = [];
502
+ const { x, y, z } = this.getScales(this._config.series);
503
+ this.config.series.forEach((data, idx) => {
504
+ if (!data.points?.length) {
505
+ return;
478
506
  }
507
+ const points = data.points.map(_ => new THREE.Vector3(x(_.x), y(_.y), z(_.z)));
508
+ const color = d3.scaleOrdinal(d3.schemeTableau10);
509
+ const material = new THREE.LineBasicMaterial({
510
+ color: data?.color ?? color(idx.toString()),
511
+ });
512
+ const tubeGeometry = new THREE.TubeGeometry(new THREE.CatmullRomCurve3(points), 1024, 0.5, 20, false);
513
+ let tube = new THREE.Line(tubeGeometry, material);
514
+ this._scene.add(tube);
515
+ });
516
+ const circles = x.ticks(this.SIDE_SIZE / 10);
517
+ const material = new THREE.LineBasicMaterial({ color: this.axesColor });
518
+ const pointsLines = [];
519
+ pointsLines.push(new THREE.Vector3(0, 0, 0));
520
+ pointsLines.push(new THREE.Vector3(0, 0, z(-z.domain()[1])));
521
+ pointsLines.push(new THREE.Vector3(0, 0, 0));
522
+ pointsLines.push(new THREE.Vector3(x(-x.domain()[1]), 0, 0));
523
+ const geometryLines = new THREE.BufferGeometry().setFromPoints(pointsLines);
524
+ const line = new THREE.Line(geometryLines, material);
525
+ this._scene.add(line);
526
+ circles.forEach(r => {
527
+ const material = new THREE.LineDashedMaterial({
528
+ color: this.gridColor,
529
+ dashSize: 1,
530
+ gapSize: 3,
531
+ });
532
+ const circleGeometry = new THREE.BufferGeometry().setFromPoints(new THREE.Path()
533
+ .absarc(0, 0, x(r), 0, Math.PI * 2, false)
534
+ .getSpacedPoints(100));
535
+ const circle = new THREE.LineSegments(circleGeometry, material);
536
+ circle.geometry.rotateX(-Math.PI / 2);
537
+ this._scene.add(circle);
538
+ });
539
+ this.drawTicks(x, y, z);
540
+ if (!this._controls) {
541
+ this._controls = new OrbitControls(this._camera, this._renderer.domElement);
542
+ this._controls.enableDamping = true;
543
+ this._controls.enablePan = true;
544
+ this._controls.dampingFactor = 0.25;
545
+ this._controls.screenSpacePanning = true;
546
+ this._controls.minDistance = 0;
547
+ this._controls.maxDistance = 10000;
548
+ this._controls.maxPolarAngle = Math.PI / 2;
549
+ this._controls.enableZoom = true;
479
550
  }
480
- this.checked = this.isChecked();
481
- this.cdr.detectChanges();
482
551
  }
483
- isChecked() {
484
- if (this.binary) {
485
- return this.allowNull ? this.model : !!this.model;
486
- }
487
- else {
488
- return this.model && this.model.indexOf(this.value) >= 0;
489
- }
552
+ createScene() {
553
+ this._scene = new THREE.Scene();
554
+ const aspectRatio = this._elementRef.nativeElement.clientWidth /
555
+ this._elementRef.nativeElement.clientHeight;
556
+ const fieldOfView = 10;
557
+ const nearClippingPane = 1;
558
+ const farClippingPane = 10000;
559
+ this._camera = new THREE.PerspectiveCamera(fieldOfView, aspectRatio, nearClippingPane, farClippingPane);
560
+ this._camera.position.set(1300, 1300, 1300).setLength(1300);
561
+ this._scene.add(this._camera);
490
562
  }
491
- removeValue() {
492
- this.model = this.model.filter((val) => val !== this.value);
563
+ setSize(width, height) {
564
+ this._camera.aspect = width / height;
565
+ this._renderer.setSize(width, height);
566
+ this._camera.updateProjectionMatrix();
493
567
  }
494
- addValue() {
495
- if (this.model) {
496
- this.model = [...this.model, this.value];
497
- }
498
- else {
499
- this.model = [this.value];
500
- }
568
+ render() {
569
+ this._renderer.render(this._scene, this._camera);
501
570
  }
502
- ngOnInit() { }
503
- onChange(_) { }
504
- onTouched() { }
505
- registerOnChange(fn) {
506
- this.onChange = fn;
571
+ startRenderingLoop() {
572
+ this._renderer = new THREE.WebGLRenderer({
573
+ antialias: true,
574
+ canvas: this.canvas,
575
+ alpha: true,
576
+ preserveDrawingBuffer: true,
577
+ });
578
+ const animate = () => {
579
+ requestAnimationFrame(animate);
580
+ this._controls?.update();
581
+ this.render();
582
+ };
583
+ animate();
507
584
  }
508
- registerOnTouched(fn) {
509
- this.onTouched = fn;
585
+ addResizeObserver() {
586
+ this._obs = new ResizeObserver(_ => {
587
+ this.setSize(_[0]?.contentRect.width, _[0]?.contentRect.height);
588
+ });
589
+ this._obs.observe(this._elementRef.nativeElement);
510
590
  }
511
- setDisabledState(isDisabled) {
512
- this.disabled = isDisabled;
513
- this.cdr.detectChanges();
591
+ removeResizeObserver() {
592
+ this._obs.unobserve(this._elementRef.nativeElement);
593
+ this._obs.disconnect();
514
594
  }
515
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: CheckboxComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
516
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: CheckboxComponent, isStandalone: true, selector: "teta-checkbox", inputs: { class: "class", palette: "palette", noLabel: "noLabel", disabled: "disabled", value: "value", binary: "binary", labelPosition: "labelPosition", allowNull: "allowNull" }, host: { listeners: { "click": "changeValue()" }, properties: { "attr.tabindex": "this.tabindex", "class": "this.getClass", "class.checkbox_disabled": "this.disabled" } }, providers: [CHECKBOX_CONTROL_VALUE_ACCESSOR], ngImport: i0, template: "@if (labelPosition==='right') {\n <div class=\"checkbox__tick\" [class.checkbox__tick_active]=\"checked != false\">\n <teta-icon [name]=\"checked ? 'tick' : checked === false ? '' : 'dash'\"></teta-icon>\n </div>\n @if (!noLabel) {\n <span class=\"font-body-3\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </span>\n }\n}\n@if (labelPosition==='left') {\n @if (!noLabel) {\n <span class=\"font-body-3\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </span>\n }\n <div class=\"checkbox__tick\" [class.checkbox__tick_active]=\"checked != false\">\n <teta-icon [name]=\"checked ? 'tick' : checked === false ? '' : 'dash'\"></teta-icon>\n </div>\n}\n<ng-template #content><ng-content></ng-content></ng-template>\n", styles: [""], dependencies: [{ kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
517
- }
518
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: CheckboxComponent, decorators: [{
519
- type: Component,
520
- args: [{ selector: 'teta-checkbox', providers: [CHECKBOX_CONTROL_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [IconComponent, NgTemplateOutlet], template: "@if (labelPosition==='right') {\n <div class=\"checkbox__tick\" [class.checkbox__tick_active]=\"checked != false\">\n <teta-icon [name]=\"checked ? 'tick' : checked === false ? '' : 'dash'\"></teta-icon>\n </div>\n @if (!noLabel) {\n <span class=\"font-body-3\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </span>\n }\n}\n@if (labelPosition==='left') {\n @if (!noLabel) {\n <span class=\"font-body-3\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </span>\n }\n <div class=\"checkbox__tick\" [class.checkbox__tick_active]=\"checked != false\">\n <teta-icon [name]=\"checked ? 'tick' : checked === false ? '' : 'dash'\"></teta-icon>\n </div>\n}\n<ng-template #content><ng-content></ng-content></ng-template>\n" }]
521
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { tabindex: [{
522
- type: HostBinding,
523
- args: ['attr.tabindex']
524
- }], class: [{
525
- type: Input
526
- }], getClass: [{
527
- type: HostBinding,
528
- args: ['class']
529
- }], palette: [{
530
- type: Input
531
- }], noLabel: [{
595
+ makeSprite(text, opts) {
596
+ const fontSize = 20;
597
+ const canvas = document.createElement('canvas');
598
+ const ctx = canvas.getContext('2d');
599
+ const textWidth = text.length * 50;
600
+ canvas.height = 50;
601
+ canvas.width = 50;
602
+ if (ctx) {
603
+ ctx.font = `${fontSize}px Arial`;
604
+ ctx.textAlign = 'center';
605
+ ctx.textBaseline = 'middle';
606
+ ctx.fillStyle = '#A0A0A0';
607
+ ctx.fillText(text, 25, 25);
608
+ }
609
+ const texture = new THREE.Texture(canvas);
610
+ texture.minFilter = THREE.LinearFilter;
611
+ texture.needsUpdate = true;
612
+ const spriteMaterial = new THREE.SpriteMaterial({
613
+ map: texture,
614
+ });
615
+ const sprite = new THREE.Sprite(spriteMaterial);
616
+ sprite.scale.set(0.4 * fontSize, 0.4 * fontSize, 0.4 * fontSize);
617
+ return sprite;
618
+ }
619
+ drawTicks(x, y, z) {
620
+ const ticks = new THREE.Object3D();
621
+ const scalesExtrems = [];
622
+ [x, y, z].forEach((scale, idx) => {
623
+ const generatedTicks = scale.ticks(this.SIDE_SIZE / 10);
624
+ scalesExtrems.push(d3.max(generatedTicks));
625
+ generatedTicks.forEach((_) => {
626
+ const sprite = this.makeSprite(_);
627
+ if (idx === 0) {
628
+ sprite.position.set(x(_), y(y.domain()[1]), 0);
629
+ }
630
+ if (idx === 1) {
631
+ sprite.position.set(-10, y(_), 0);
632
+ }
633
+ if (idx === 2) {
634
+ sprite.position.set(0, y(y.domain()[1]), z(_));
635
+ }
636
+ ticks.add(sprite);
637
+ });
638
+ });
639
+ const northLabel = this.makeSprite('X', { fontSize: 28 });
640
+ const westLabel = this.makeSprite('Y', { fontSize: 28 });
641
+ const tvdLabel = this.makeSprite('TVD', { fontSize: 28 });
642
+ northLabel.position.set(x(x.domain()[1]) + 5, 0, 0);
643
+ westLabel.position.set(0, 0, y(y.domain()[0]) + 5);
644
+ tvdLabel.position.set(0, z(z.domain()[1]) + 5, 0);
645
+ ticks.add(northLabel, westLabel, tvdLabel);
646
+ const axesHelper = new THREE.AxesHelper(this.SIDE_SIZE);
647
+ axesHelper.setColors(this.axesColor, this.axesColor, this.axesColor);
648
+ this._scene.add(axesHelper);
649
+ this._scene.add(ticks);
650
+ }
651
+ getScales(series) {
652
+ const extrems = series.map(_ => ({
653
+ x: d3.extent(_.points, (p) => p.x),
654
+ y: d3.extent(_.points, (p) => p.y),
655
+ z: d3.extent(_.points, (p) => p.z),
656
+ }));
657
+ const flattenExtrems = extrems.reduce((acc, _) => {
658
+ acc.x = acc.x.concat(_.x);
659
+ acc.y = acc.y.concat(_.y);
660
+ acc.z = acc.z.concat(_.z);
661
+ return acc;
662
+ }, { x: [], y: [], z: [] });
663
+ const x = d3
664
+ .scaleLinear()
665
+ .domain([
666
+ 0,
667
+ this._config?.axes?.max == null
668
+ ? parseInt(d3.max(flattenExtrems.x))
669
+ : this._config.axes.max,
670
+ ])
671
+ .range([0, this.SIDE_SIZE])
672
+ .nice();
673
+ const y = d3
674
+ .scaleLinear()
675
+ .domain([0, parseInt(d3.max(flattenExtrems.y), 10)])
676
+ .range([this.SIDE_SIZE, 0]);
677
+ const z = d3
678
+ .scaleLinear()
679
+ .domain([
680
+ 0,
681
+ this._config?.axes?.max == null
682
+ ? parseInt(d3.max(flattenExtrems.z))
683
+ : this._config.axes.max,
684
+ ])
685
+ .range([0, this.SIDE_SIZE])
686
+ .nice();
687
+ return { x, y, z };
688
+ }
689
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: Chart3dComponent, deps: [{ token: i0.ElementRef }, { token: ThemeSwitchService }], target: i0.ɵɵFactoryTarget.Component }); }
690
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: Chart3dComponent, isStandalone: true, selector: "teta-chart3d", inputs: { config: "config" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["canvas"], descendants: true }], ngImport: i0, template: "<canvas #canvas></canvas>\n", styles: [":host{display:flex;width:100%;height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
691
+ }
692
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: Chart3dComponent, decorators: [{
693
+ type: Component,
694
+ args: [{ selector: 'teta-chart3d', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<canvas #canvas></canvas>\n", styles: [":host{display:flex;width:100%;height:100%}\n"] }]
695
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ThemeSwitchService }], propDecorators: { canvasRef: [{
696
+ type: ViewChild,
697
+ args: ['canvas']
698
+ }], config: [{
699
+ type: Input
700
+ }] } });
701
+
702
+ const CHECKBOX_CONTROL_VALUE_ACCESSOR = {
703
+ provide: NG_VALUE_ACCESSOR,
704
+ useExisting: forwardRef(() => CheckboxComponent),
705
+ multi: true,
706
+ };
707
+ class CheckboxComponent {
708
+ get getClass() {
709
+ const result = [this.class, 'checkbox'];
710
+ if (this.palette) {
711
+ result.push(`checkbox-${this.palette}`);
712
+ }
713
+ return result.join(' ');
714
+ }
715
+ get model() {
716
+ return this.model$;
717
+ }
718
+ set model(v) {
719
+ if (v !== this.model$) {
720
+ this.model$ = v;
721
+ this.onChange(v);
722
+ }
723
+ }
724
+ constructor(cdr) {
725
+ this.cdr = cdr;
726
+ this.tabindex = 0;
727
+ this.palette = 'primary';
728
+ this.labelPosition = 'right';
729
+ /**
730
+ * Значение
731
+ */
732
+ this.model$ = null;
733
+ }
734
+ changeValue() {
735
+ if (this.disabled) {
736
+ return;
737
+ }
738
+ if (this.binary) {
739
+ this.model = !this.model;
740
+ }
741
+ else {
742
+ if (!this.isChecked()) {
743
+ this.addValue();
744
+ }
745
+ else {
746
+ this.removeValue();
747
+ }
748
+ }
749
+ this.checked = this.isChecked();
750
+ }
751
+ writeValue(model) {
752
+ if (this.binary) {
753
+ this.model$ = model;
754
+ }
755
+ else {
756
+ if (model && model instanceof Array) {
757
+ this.model$ = model;
758
+ }
759
+ else {
760
+ this.model$ = [];
761
+ }
762
+ }
763
+ this.checked = this.isChecked();
764
+ this.cdr.detectChanges();
765
+ }
766
+ isChecked() {
767
+ if (this.binary) {
768
+ return this.allowNull ? this.model : !!this.model;
769
+ }
770
+ else {
771
+ return this.model && this.model.indexOf(this.value) >= 0;
772
+ }
773
+ }
774
+ removeValue() {
775
+ this.model = this.model.filter((val) => val !== this.value);
776
+ }
777
+ addValue() {
778
+ if (this.model) {
779
+ this.model = [...this.model, this.value];
780
+ }
781
+ else {
782
+ this.model = [this.value];
783
+ }
784
+ }
785
+ ngOnInit() { }
786
+ onChange(_) { }
787
+ onTouched() { }
788
+ registerOnChange(fn) {
789
+ this.onChange = fn;
790
+ }
791
+ registerOnTouched(fn) {
792
+ this.onTouched = fn;
793
+ }
794
+ setDisabledState(isDisabled) {
795
+ this.disabled = isDisabled;
796
+ this.cdr.detectChanges();
797
+ }
798
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: CheckboxComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
799
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.5", type: CheckboxComponent, isStandalone: true, selector: "teta-checkbox", inputs: { class: "class", palette: "palette", noLabel: "noLabel", disabled: "disabled", value: "value", binary: "binary", labelPosition: "labelPosition", allowNull: "allowNull" }, host: { listeners: { "click": "changeValue()" }, properties: { "attr.tabindex": "this.tabindex", "class": "this.getClass", "class.checkbox_disabled": "this.disabled" } }, providers: [CHECKBOX_CONTROL_VALUE_ACCESSOR], ngImport: i0, template: "@if (labelPosition==='right') {\n <div class=\"checkbox__tick\" [class.checkbox__tick_active]=\"checked != false\">\n <teta-icon [name]=\"checked ? 'tick' : checked === false ? '' : 'dash'\"></teta-icon>\n </div>\n @if (!noLabel) {\n <span class=\"font-body-3\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </span>\n }\n}\n@if (labelPosition==='left') {\n @if (!noLabel) {\n <span class=\"font-body-3\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </span>\n }\n <div class=\"checkbox__tick\" [class.checkbox__tick_active]=\"checked != false\">\n <teta-icon [name]=\"checked ? 'tick' : checked === false ? '' : 'dash'\"></teta-icon>\n </div>\n}\n<ng-template #content><ng-content></ng-content></ng-template>\n", styles: [""], dependencies: [{ kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
800
+ }
801
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: CheckboxComponent, decorators: [{
802
+ type: Component,
803
+ args: [{ selector: 'teta-checkbox', providers: [CHECKBOX_CONTROL_VALUE_ACCESSOR], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [IconComponent, NgTemplateOutlet], template: "@if (labelPosition==='right') {\n <div class=\"checkbox__tick\" [class.checkbox__tick_active]=\"checked != false\">\n <teta-icon [name]=\"checked ? 'tick' : checked === false ? '' : 'dash'\"></teta-icon>\n </div>\n @if (!noLabel) {\n <span class=\"font-body-3\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </span>\n }\n}\n@if (labelPosition==='left') {\n @if (!noLabel) {\n <span class=\"font-body-3\">\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n </span>\n }\n <div class=\"checkbox__tick\" [class.checkbox__tick_active]=\"checked != false\">\n <teta-icon [name]=\"checked ? 'tick' : checked === false ? '' : 'dash'\"></teta-icon>\n </div>\n}\n<ng-template #content><ng-content></ng-content></ng-template>\n" }]
804
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { tabindex: [{
805
+ type: HostBinding,
806
+ args: ['attr.tabindex']
807
+ }], class: [{
808
+ type: Input
809
+ }], getClass: [{
810
+ type: HostBinding,
811
+ args: ['class']
812
+ }], palette: [{
813
+ type: Input
814
+ }], noLabel: [{
532
815
  type: Input
533
816
  }], disabled: [{
534
817
  type: HostBinding,
@@ -1139,7 +1422,7 @@ class DateCalendarComponent extends BaseCalendar {
1139
1422
  this.setDate = new EventEmitter();
1140
1423
  this.calendar = [];
1141
1424
  combineLatest([this.currentYear, this.currentMonth, this.minMax])
1142
- .pipe(takeWhile(() => this.alive), filter(([currentYear, currentMonth]) => currentMonth !== null && currentYear !== null), map$1(([year, month, minMax]) => {
1425
+ .pipe(takeWhile$1(() => this.alive), filter(([currentYear, currentMonth]) => currentMonth !== null && currentYear !== null), map$1(([year, month, minMax]) => {
1143
1426
  return this.generateCalendar(dayjs(new Date(this.selectedDate)).locale('ru', { weekStart: 1 }), year, month, minMax);
1144
1427
  }))
1145
1428
  .subscribe(_ => {
@@ -1664,7 +1947,7 @@ class DynamicContentBaseDirective {
1664
1947
  this._alive = true;
1665
1948
  this._open = false;
1666
1949
  this._zone.onStable
1667
- .pipe(takeWhile$1(_ => this._alive), filter$1(_ => this._open))
1950
+ .pipe(takeWhile(_ => this._alive), filter$1(_ => this._open))
1668
1951
  .subscribe(_ => {
1669
1952
  this.setPosition();
1670
1953
  });
@@ -1907,7 +2190,7 @@ class DropdownBase {
1907
2190
  }
1908
2191
  };
1909
2192
  this._zone.onStable
1910
- .pipe(takeWhile$1(_ => this._alive), throttleTime(10, undefined, { trailing: true }))
2193
+ .pipe(takeWhile(_ => this._alive), throttleTime(10, undefined, { trailing: true }))
1911
2194
  .subscribe(_ => {
1912
2195
  if (this._head?.nativeElement && this._body) {
1913
2196
  setTimeout(() => {
@@ -2336,7 +2619,7 @@ class RangeCalendarComponent extends BaseCalendar {
2336
2619
  this.setDate = new EventEmitter();
2337
2620
  this._hoveredDate = null;
2338
2621
  combineLatest([this.currentYear, this.currentMonth, this.minMax])
2339
- .pipe(takeWhile(() => this.alive), shareReplay({ bufferSize: 1, refCount: false }), filter(([currentYear, currentMonth]) => currentMonth !== null && currentYear !== null), map$1(([year, month, minMax]) => {
2622
+ .pipe(takeWhile$1(() => this.alive), shareReplay({ bufferSize: 1, refCount: false }), filter(([currentYear, currentMonth]) => currentMonth !== null && currentYear !== null), map$1(([year, month, minMax]) => {
2340
2623
  const { availableYear, availableMonth } = this.getAvailableMonthYear(month + 1, year);
2341
2624
  return {
2342
2625
  currentMonth: this.generateCalendar(dayjs(new Date(this.selectedDate.from || new Date())).locale('ru', { weekStart: 1 }), year, month, minMax),
@@ -3455,7 +3738,7 @@ class ScrollableComponent {
3455
3738
  this._container = this._scrollDirective;
3456
3739
  }
3457
3740
  fromEvent(this._container.nativeElement, 'scroll')
3458
- .pipe(takeWhile$1(() => this._alive), tap((event) => {
3741
+ .pipe(takeWhile(() => this._alive), tap$1((event) => {
3459
3742
  this._scrollbarHorizontal.nativeElement.scrollLeft =
3460
3743
  event.target.scrollLeft;
3461
3744
  this._scrollbarVertical.nativeElement.scrollTop =
@@ -4478,7 +4761,7 @@ class FilterHostComponent {
4478
4761
  this._componentRef.injector.get(ChangeDetectorRef).detectChanges();
4479
4762
  this._init = true;
4480
4763
  this._componentRef.instance.filterChanged
4481
- .pipe(takeWhile$1((_) => this._alive))
4764
+ .pipe(takeWhile((_) => this._alive))
4482
4765
  .subscribe((filter) => {
4483
4766
  this.filterChanged.emit(filter);
4484
4767
  });
@@ -4772,7 +5055,7 @@ class MessageHostComponent {
4772
5055
  }
4773
5056
  ngOnInit() {
4774
5057
  this._svc.message
4775
- .pipe(takeWhile$1((_) => this._alive))
5058
+ .pipe(takeWhile((_) => this._alive))
4776
5059
  .subscribe((messages) => {
4777
5060
  if (messages) {
4778
5061
  if (!this.messages) {
@@ -4783,7 +5066,7 @@ class MessageHostComponent {
4783
5066
  this._cdr.markForCheck();
4784
5067
  });
4785
5068
  this._svc.clear
4786
- .pipe(takeWhile$1((_) => this._alive))
5069
+ .pipe(takeWhile((_) => this._alive))
4787
5070
  .subscribe((x) => {
4788
5071
  if (!x) {
4789
5072
  this.messages = [];
@@ -6091,7 +6374,7 @@ class PropertyGridItemComponent {
6091
6374
  this.formGroup.registerControl(this.column.name, FormsUtil.initControlFromColumn(this.column, this.item));
6092
6375
  this._formSub?.unsubscribe();
6093
6376
  this._formSub = this.formGroup?.controls[this.column.name]?.valueChanges
6094
- .pipe(takeWhile$1(() => this._alive))
6377
+ .pipe(takeWhile(() => this._alive))
6095
6378
  .subscribe(_ => {
6096
6379
  this.controlValueChange.emit({
6097
6380
  id: _,
@@ -6417,7 +6700,7 @@ class SwitchComponent {
6417
6700
  this.switchClass = true;
6418
6701
  this._alive = true;
6419
6702
  this.svc.value
6420
- .pipe(takeWhile$1((_) => this._alive), filter$1((_) => _ !== this._value))
6703
+ .pipe(takeWhile((_) => this._alive), filter$1((_) => _ !== this._value))
6421
6704
  .subscribe((_) => {
6422
6705
  this.onChange(_);
6423
6706
  this._value = _;
@@ -6472,7 +6755,7 @@ class SwitchButtonComponent {
6472
6755
  this.svc = svc;
6473
6756
  this.cdr = cdr;
6474
6757
  this._alive = true;
6475
- this.svc.value.pipe(takeWhile$1((_) => this._alive)).subscribe((_) => {
6758
+ this.svc.value.pipe(takeWhile((_) => this._alive)).subscribe((_) => {
6476
6759
  this.svcValue = _;
6477
6760
  this.cdr.markForCheck();
6478
6761
  });
@@ -7650,7 +7933,7 @@ class CellComponentBase {
7650
7933
  ngOnInit() {
7651
7934
  this.init();
7652
7935
  this.formGroup?.controls[this.column.name]?.valueChanges
7653
- .pipe(takeWhile$1(() => this._alive))
7936
+ .pipe(takeWhile(() => this._alive))
7654
7937
  .subscribe(value => {
7655
7938
  this.formGroup.updateValueAndValidity();
7656
7939
  this.row.valid = this.formGroup?.valid;
@@ -7663,7 +7946,7 @@ class CellComponentBase {
7663
7946
  }
7664
7947
  init() {
7665
7948
  this.svc.editRowStart
7666
- .pipe(takeWhile$1(_ => this._alive))
7949
+ .pipe(takeWhile(_ => this._alive))
7667
7950
  .subscribe((cell) => {
7668
7951
  if (this.index === cell?.row && !this._edit) {
7669
7952
  this.start(cell, 'row');
@@ -7673,7 +7956,7 @@ class CellComponentBase {
7673
7956
  }
7674
7957
  });
7675
7958
  this.svc.editCellStart
7676
- .pipe(takeWhile$1(_ => this._alive))
7959
+ .pipe(takeWhile(_ => this._alive))
7677
7960
  .subscribe((cell) => {
7678
7961
  if (this.index === cell?.row &&
7679
7962
  this.column.name === cell?.column &&
@@ -7686,7 +7969,7 @@ class CellComponentBase {
7686
7969
  }
7687
7970
  });
7688
7971
  this.svc.valueSet
7689
- .pipe(takeWhile$1(_ => this._alive))
7972
+ .pipe(takeWhile(_ => this._alive))
7690
7973
  .subscribe((cellValue) => {
7691
7974
  if (this.index === cellValue.row &&
7692
7975
  this.column.name === cellValue.column) {
@@ -8046,7 +8329,7 @@ class SelectionCellComponent {
8046
8329
  }
8047
8330
  ngOnInit() {
8048
8331
  this._svc.selectedRows
8049
- .pipe(takeWhile$1((_) => this._alive))
8332
+ .pipe(takeWhile((_) => this._alive))
8050
8333
  .subscribe((_) => {
8051
8334
  this.selectedRows = _;
8052
8335
  this._cdr.markForCheck();
@@ -8115,24 +8398,24 @@ class TableBodyComponent {
8115
8398
  ngOnInit() {
8116
8399
  this.locale = this._config.locale;
8117
8400
  combineLatest([this._svc.columns, this._svc.hiddenColumns])
8118
- .pipe(takeWhile$1(_ => this._alive))
8401
+ .pipe(takeWhile(_ => this._alive))
8119
8402
  .subscribe((values) => {
8120
8403
  const [columns, hiddenColumns] = values;
8121
8404
  this._hiddenColumns = hiddenColumns;
8122
8405
  this.columns = ArrayUtil.flatten(columns, 'columns', true).filter(_ => this._hiddenColumns.indexOf(_.name) < 0);
8123
8406
  this._cdr.markForCheck();
8124
8407
  });
8125
- this._svc.displayData.pipe(takeWhile$1(_ => this._alive)).subscribe(_ => {
8408
+ this._svc.displayData.pipe(takeWhile(_ => this._alive)).subscribe(_ => {
8126
8409
  this.data = _;
8127
8410
  this._cdr.markForCheck();
8128
8411
  this.viewport?.checkViewportSize();
8129
8412
  });
8130
- this._svc.dict.pipe(takeWhile$1(_ => this._alive)).subscribe(_ => {
8413
+ this._svc.dict.pipe(takeWhile(_ => this._alive)).subscribe(_ => {
8131
8414
  this.dict = _;
8132
8415
  this._cdr.markForCheck();
8133
8416
  });
8134
8417
  this._svc.scrollIndex
8135
- .pipe(takeWhile$1(() => this._alive))
8418
+ .pipe(takeWhile(() => this._alive))
8136
8419
  .subscribe(async (index) => {
8137
8420
  if (this.viewport) {
8138
8421
  this.viewport.scrollToIndex(index, 'auto');
@@ -8143,7 +8426,7 @@ class TableBodyComponent {
8143
8426
  }
8144
8427
  this._cdr.markForCheck();
8145
8428
  });
8146
- this._svc.activeRow.pipe(takeWhile$1(_ => this._alive)).subscribe(async (_) => {
8429
+ this._svc.activeRow.pipe(takeWhile(_ => this._alive)).subscribe(async (_) => {
8147
8430
  this.activeRow = _;
8148
8431
  this._cdr.markForCheck();
8149
8432
  });
@@ -8626,7 +8909,7 @@ class TreeItemComponent {
8626
8909
  }
8627
8910
  ngOnInit() {
8628
8911
  this.service.openItems
8629
- .pipe(takeWhile$1((_) => this._alive))
8912
+ .pipe(takeWhile((_) => this._alive))
8630
8913
  .subscribe((_) => {
8631
8914
  const found = _?.find((x) => this.service.compareItems(x) ===
8632
8915
  this.service.compareItems(this.item));
@@ -8711,7 +8994,7 @@ class TreeComponent {
8711
8994
  return index;
8712
8995
  };
8713
8996
  this._service.openItems
8714
- .pipe(takeWhile$1((_) => this._alive), filter$1((_) => this._openItems !== _))
8997
+ .pipe(takeWhile((_) => this._alive), filter$1((_) => this._openItems !== _))
8715
8998
  .subscribe((_) => {
8716
8999
  this._openItems = _;
8717
9000
  this.displayData = this.getDisplayData(this._data, 0);
@@ -8739,7 +9022,7 @@ class TreeComponent {
8739
9022
  this.removeResizeObserver();
8740
9023
  }
8741
9024
  ngAfterViewInit() {
8742
- this._service.scrollToIndex.pipe(takeWhile$1(() => this._alive)).subscribe((index) => {
9025
+ this._service.scrollToIndex.pipe(takeWhile(() => this._alive)).subscribe((index) => {
8743
9026
  this._zone.runOutsideAngular(() => {
8744
9027
  setTimeout(() => {
8745
9028
  this.viewport?.scrollToIndex(index, 'smooth');
@@ -8857,7 +9140,7 @@ class VisibilityDropdownTabComponent {
8857
9140
  };
8858
9141
  this.locale = this._config.locale;
8859
9142
  this._svc.hiddenColumns
8860
- .pipe(takeWhile$1(_ => this._alive), map(_ => [..._]))
9143
+ .pipe(takeWhile(_ => this._alive), map(_ => [..._]))
8861
9144
  .subscribe(_ => {
8862
9145
  this.hiddenColumns = _;
8863
9146
  });
@@ -9651,7 +9934,7 @@ class TableHeadGroupComponent {
9651
9934
  this._cdr = _cdr;
9652
9935
  this._alive = true;
9653
9936
  this._svc.hiddenColumns
9654
- .pipe(takeWhile$1((_) => this._alive))
9937
+ .pipe(takeWhile((_) => this._alive))
9655
9938
  .subscribe((_) => {
9656
9939
  this._hiddenColumns = _;
9657
9940
  this._cdr.markForCheck();
@@ -9708,7 +9991,7 @@ class SelectionHeadCellComponent {
9708
9991
  }
9709
9992
  ngOnInit() {
9710
9993
  this._svc.selectedRows
9711
- .pipe(takeWhile$1((_) => this._alive))
9994
+ .pipe(takeWhile((_) => this._alive))
9712
9995
  .subscribe((_) => {
9713
9996
  this._cdr.markForCheck();
9714
9997
  });
@@ -9755,7 +10038,7 @@ class TableHeadComponent {
9755
10038
  }
9756
10039
  ngOnInit() {
9757
10040
  combineLatest([this._svc.columns, this._svc.hiddenColumns])
9758
- .pipe(takeWhile$1(_ => this._alive))
10041
+ .pipe(takeWhile(_ => this._alive))
9759
10042
  .subscribe((values) => {
9760
10043
  const [columns, hiddenColumns] = values;
9761
10044
  this._hiddenColumns = hiddenColumns;
@@ -9766,11 +10049,11 @@ class TableHeadComponent {
9766
10049
  this.lockedWidth = locked.reduce((prev, curr) => prev + curr.width, startWidth);
9767
10050
  this._cdr.markForCheck();
9768
10051
  });
9769
- this._svc.state.pipe(takeWhile$1(_ => this._alive)).subscribe(_ => {
10052
+ this._svc.state.pipe(takeWhile(_ => this._alive)).subscribe(_ => {
9770
10053
  this.state = _;
9771
10054
  this._cdr.markForCheck();
9772
10055
  });
9773
- this._svc.displayData.pipe(takeWhile$1(_ => this._alive)).subscribe(_ => {
10056
+ this._svc.displayData.pipe(takeWhile(_ => this._alive)).subscribe(_ => {
9774
10057
  this.data = _.map(_ => _.data);
9775
10058
  this._cdr.markForCheck();
9776
10059
  });
@@ -9842,34 +10125,34 @@ class TableComponent {
9842
10125
  this._headElement.scrollLeft = event.target.scrollLeft;
9843
10126
  };
9844
10127
  this._svc.state
9845
- .pipe(takeWhile$1(() => this._alive), filter$1(state => state !== this._state))
10128
+ .pipe(takeWhile(() => this._alive), filter$1(state => state !== this._state))
9846
10129
  .subscribe((state) => this.stateChange.next(state));
9847
10130
  this._svc.editCellStart
9848
- .pipe(takeWhile$1(() => this._alive))
10131
+ .pipe(takeWhile(() => this._alive))
9849
10132
  .subscribe((item) => this.cellEditStart.emit(this._svc.getCellInstance(item)));
9850
10133
  this._svc.editCellStop
9851
- .pipe(takeWhile$1(() => this._alive))
10134
+ .pipe(takeWhile(() => this._alive))
9852
10135
  .subscribe((item) => this.cellEditEnd.emit(this._svc.getCellInstance(item)));
9853
10136
  this._svc.editRowStart
9854
- .pipe(takeWhile$1(() => this._alive))
10137
+ .pipe(takeWhile(() => this._alive))
9855
10138
  .subscribe((item) => this.rowEditStart.emit(this._svc.getCellInstance(item)));
9856
10139
  this._svc.editRowStop
9857
- .pipe(takeWhile$1(() => this._alive))
10140
+ .pipe(takeWhile(() => this._alive))
9858
10141
  .subscribe((item) => this.rowEditEnd.emit(this._svc.getRowByIndex(item?.row)));
9859
10142
  this._svc.selectedRows
9860
- .pipe(takeWhile$1(() => this._alive))
10143
+ .pipe(takeWhile(() => this._alive))
9861
10144
  .subscribe((items) => {
9862
10145
  this.selectedRowsList = items;
9863
10146
  this.selectedRowsChange.emit(items);
9864
10147
  });
9865
10148
  this._svc.activeRow
9866
- .pipe(takeWhile$1(() => this._alive))
10149
+ .pipe(takeWhile(() => this._alive))
9867
10150
  .subscribe((item) => {
9868
10151
  this.activeRow = item;
9869
10152
  this.activeRowChange.emit(item);
9870
10153
  });
9871
10154
  this._svc.valueChanged
9872
- .pipe(takeWhile$1(() => this._alive))
10155
+ .pipe(takeWhile(() => this._alive))
9873
10156
  .subscribe((coordinates) => {
9874
10157
  this.valueChange.emit(this._svc.getCellInstance(coordinates));
9875
10158
  });
@@ -10306,37 +10589,6 @@ class DetailComponentBase {
10306
10589
  * Components
10307
10590
  */
10308
10591
 
10309
- class ThemeSwitchService {
10310
- constructor() {
10311
- const value = this.restoreTheme();
10312
- this.theme$ = new BehaviorSubject(value);
10313
- this.theme = this.theme$.asObservable();
10314
- }
10315
- switchTheme() {
10316
- const value = !this.theme$.value;
10317
- this.saveTheme(value);
10318
- this.theme$.next(value);
10319
- }
10320
- saveTheme(value) {
10321
- localStorage.setItem('theme', value.toString());
10322
- }
10323
- restoreTheme() {
10324
- const theme = localStorage.getItem('theme');
10325
- if (theme) {
10326
- return JSON.parse(theme);
10327
- }
10328
- return true;
10329
- }
10330
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ThemeSwitchService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
10331
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ThemeSwitchService, providedIn: 'root' }); }
10332
- }
10333
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: ThemeSwitchService, decorators: [{
10334
- type: Injectable,
10335
- args: [{
10336
- providedIn: 'root',
10337
- }]
10338
- }], ctorParameters: () => [] });
10339
-
10340
10592
  class ThemeSwitchComponent {
10341
10593
  constructor(_svc) {
10342
10594
  this._svc = _svc;
@@ -10364,258 +10616,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImpor
10364
10616
  * Components
10365
10617
  */
10366
10618
 
10367
- class Chart3dOptions {
10368
- constructor(options) {
10369
- this.axes = { ...options?.axes };
10370
- this.series = options?.series || [];
10371
- }
10372
- }
10373
-
10374
- class Chart3dComponent {
10375
- constructor(_elementRef, _themeService) {
10376
- this._elementRef = _elementRef;
10377
- this._themeService = _themeService;
10378
- this.SIDE_SIZE = 100;
10379
- this._alive = true;
10380
- }
10381
- set config(config) {
10382
- if (config) {
10383
- this._config = config;
10384
- this.init();
10385
- }
10386
- }
10387
- get config() {
10388
- return this._config;
10389
- }
10390
- get canvas() {
10391
- return this.canvasRef.nativeElement;
10392
- }
10393
- ngOnInit() {
10394
- this._themeService.theme
10395
- .pipe(takeWhile$1(_ => this._alive), tap$1(_ => {
10396
- this.gridColor = _ ? '#5d6a73' : '#bdbdc6';
10397
- this.axesColor = _ ? '#8e8f9d' : '#7d8f9a';
10398
- this.init();
10399
- }))
10400
- .subscribe();
10401
- }
10402
- ngAfterViewInit() {
10403
- this.addResizeObserver();
10404
- this.createScene();
10405
- this.startRenderingLoop();
10406
- this.init();
10407
- }
10408
- ngOnDestroy() {
10409
- this._alive = false;
10410
- this.removeResizeObserver();
10411
- }
10412
- init() {
10413
- if (!this._scene) {
10414
- return;
10415
- }
10416
- while (this._scene.children.length > 0) {
10417
- this._scene.remove(this._scene.children[0]);
10418
- }
10419
- const { x, y, z } = this.getScales(this._config.series);
10420
- this.config.series.forEach((data, idx) => {
10421
- if (!data.points?.length) {
10422
- return;
10423
- }
10424
- const points = data.points.map(_ => new THREE.Vector3(x(_.x), y(_.y), z(_.z)));
10425
- const color = d3.scaleOrdinal(d3.schemeTableau10);
10426
- const material = new THREE.LineBasicMaterial({
10427
- color: data?.color ?? color(idx.toString()),
10428
- });
10429
- const tubeGeometry = new THREE.TubeGeometry(new THREE.CatmullRomCurve3(points), 1024, 0.5, 20, false);
10430
- let tube = new THREE.Line(tubeGeometry, material);
10431
- this._scene.add(tube);
10432
- });
10433
- const circles = x.ticks(this.SIDE_SIZE / 10);
10434
- const material = new THREE.LineBasicMaterial({ color: this.axesColor });
10435
- const pointsLines = [];
10436
- pointsLines.push(new THREE.Vector3(0, 0, 0));
10437
- pointsLines.push(new THREE.Vector3(0, 0, z(-z.domain()[1])));
10438
- pointsLines.push(new THREE.Vector3(0, 0, 0));
10439
- pointsLines.push(new THREE.Vector3(x(-x.domain()[1]), 0, 0));
10440
- const geometryLines = new THREE.BufferGeometry().setFromPoints(pointsLines);
10441
- const line = new THREE.Line(geometryLines, material);
10442
- this._scene.add(line);
10443
- circles.forEach(r => {
10444
- const material = new THREE.LineDashedMaterial({
10445
- color: this.gridColor,
10446
- dashSize: 1,
10447
- gapSize: 3,
10448
- });
10449
- const circleGeometry = new THREE.BufferGeometry().setFromPoints(new THREE.Path()
10450
- .absarc(0, 0, x(r), 0, Math.PI * 2, false)
10451
- .getSpacedPoints(100));
10452
- const circle = new THREE.LineSegments(circleGeometry, material);
10453
- circle.geometry.rotateX(-Math.PI / 2);
10454
- this._scene.add(circle);
10455
- });
10456
- this.drawTicks(x, y, z);
10457
- if (!this._controls) {
10458
- this._controls = new OrbitControls(this._camera, this._renderer.domElement);
10459
- this._controls.enableDamping = true;
10460
- this._controls.enablePan = true;
10461
- this._controls.dampingFactor = 0.25;
10462
- this._controls.screenSpacePanning = true;
10463
- this._controls.minDistance = 0;
10464
- this._controls.maxDistance = 10000;
10465
- this._controls.maxPolarAngle = Math.PI / 2;
10466
- this._controls.enableZoom = true;
10467
- }
10468
- }
10469
- createScene() {
10470
- this._scene = new THREE.Scene();
10471
- const aspectRatio = this._elementRef.nativeElement.clientWidth /
10472
- this._elementRef.nativeElement.clientHeight;
10473
- const fieldOfView = 10;
10474
- const nearClippingPane = 1;
10475
- const farClippingPane = 10000;
10476
- this._camera = new THREE.PerspectiveCamera(fieldOfView, aspectRatio, nearClippingPane, farClippingPane);
10477
- this._camera.position.set(1300, 1300, 1300).setLength(1300);
10478
- this._scene.add(this._camera);
10479
- }
10480
- setSize(width, height) {
10481
- this._camera.aspect = width / height;
10482
- this._renderer.setSize(width, height);
10483
- this._camera.updateProjectionMatrix();
10484
- }
10485
- render() {
10486
- this._renderer.render(this._scene, this._camera);
10487
- }
10488
- startRenderingLoop() {
10489
- this._renderer = new THREE.WebGLRenderer({
10490
- antialias: true,
10491
- canvas: this.canvas,
10492
- alpha: true,
10493
- preserveDrawingBuffer: true,
10494
- });
10495
- const animate = () => {
10496
- requestAnimationFrame(animate);
10497
- this._controls?.update();
10498
- this.render();
10499
- };
10500
- animate();
10501
- }
10502
- addResizeObserver() {
10503
- this._obs = new ResizeObserver(_ => {
10504
- this.setSize(_[0]?.contentRect.width, _[0]?.contentRect.height);
10505
- });
10506
- this._obs.observe(this._elementRef.nativeElement);
10507
- }
10508
- removeResizeObserver() {
10509
- this._obs.unobserve(this._elementRef.nativeElement);
10510
- this._obs.disconnect();
10511
- }
10512
- makeSprite(text, opts) {
10513
- const fontSize = 20;
10514
- const canvas = document.createElement('canvas');
10515
- const ctx = canvas.getContext('2d');
10516
- const textWidth = text.length * 50;
10517
- canvas.height = 50;
10518
- canvas.width = 50;
10519
- if (ctx) {
10520
- ctx.font = `${fontSize}px Arial`;
10521
- ctx.textAlign = 'center';
10522
- ctx.textBaseline = 'middle';
10523
- ctx.fillStyle = '#A0A0A0';
10524
- ctx.fillText(text, 25, 25);
10525
- }
10526
- const texture = new THREE.Texture(canvas);
10527
- texture.minFilter = THREE.LinearFilter;
10528
- texture.needsUpdate = true;
10529
- const spriteMaterial = new THREE.SpriteMaterial({
10530
- map: texture,
10531
- });
10532
- const sprite = new THREE.Sprite(spriteMaterial);
10533
- sprite.scale.set(0.4 * fontSize, 0.4 * fontSize, 0.4 * fontSize);
10534
- return sprite;
10535
- }
10536
- drawTicks(x, y, z) {
10537
- const ticks = new THREE.Object3D();
10538
- const scalesExtrems = [];
10539
- [x, y, z].forEach((scale, idx) => {
10540
- const generatedTicks = scale.ticks(this.SIDE_SIZE / 10);
10541
- scalesExtrems.push(d3.max(generatedTicks));
10542
- generatedTicks.forEach((_) => {
10543
- const sprite = this.makeSprite(_);
10544
- if (idx === 0) {
10545
- sprite.position.set(x(_), y(y.domain()[1]), 0);
10546
- }
10547
- if (idx === 1) {
10548
- sprite.position.set(-10, y(_), 0);
10549
- }
10550
- if (idx === 2) {
10551
- sprite.position.set(0, y(y.domain()[1]), z(_));
10552
- }
10553
- ticks.add(sprite);
10554
- });
10555
- });
10556
- const northLabel = this.makeSprite('X', { fontSize: 28 });
10557
- const westLabel = this.makeSprite('Y', { fontSize: 28 });
10558
- const tvdLabel = this.makeSprite('TVD', { fontSize: 28 });
10559
- northLabel.position.set(x(x.domain()[1]) + 5, 0, 0);
10560
- westLabel.position.set(0, 0, y(y.domain()[0]) + 5);
10561
- tvdLabel.position.set(0, z(z.domain()[1]) + 5, 0);
10562
- ticks.add(northLabel, westLabel, tvdLabel);
10563
- const axesHelper = new THREE.AxesHelper(this.SIDE_SIZE);
10564
- axesHelper.setColors(this.axesColor, this.axesColor, this.axesColor);
10565
- this._scene.add(axesHelper);
10566
- this._scene.add(ticks);
10567
- }
10568
- getScales(series) {
10569
- const extrems = series.map(_ => ({
10570
- x: d3.extent(_.points, (p) => p.x),
10571
- y: d3.extent(_.points, (p) => p.y),
10572
- z: d3.extent(_.points, (p) => p.z),
10573
- }));
10574
- const flattenExtrems = extrems.reduce((acc, _) => {
10575
- acc.x = acc.x.concat(_.x);
10576
- acc.y = acc.y.concat(_.y);
10577
- acc.z = acc.z.concat(_.z);
10578
- return acc;
10579
- }, { x: [], y: [], z: [] });
10580
- const x = d3
10581
- .scaleLinear()
10582
- .domain([
10583
- 0,
10584
- this._config?.axes?.max == null
10585
- ? parseInt(d3.max(flattenExtrems.x))
10586
- : this._config.axes.max,
10587
- ])
10588
- .range([0, this.SIDE_SIZE])
10589
- .nice();
10590
- const y = d3
10591
- .scaleLinear()
10592
- .domain([0, parseInt(d3.max(flattenExtrems.y), 10)])
10593
- .range([this.SIDE_SIZE, 0]);
10594
- const z = d3
10595
- .scaleLinear()
10596
- .domain([
10597
- 0,
10598
- this._config?.axes?.max == null
10599
- ? parseInt(d3.max(flattenExtrems.z))
10600
- : this._config.axes.max,
10601
- ])
10602
- .range([0, this.SIDE_SIZE])
10603
- .nice();
10604
- return { x, y, z };
10605
- }
10606
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: Chart3dComponent, deps: [{ token: i0.ElementRef }, { token: ThemeSwitchService }], target: i0.ɵɵFactoryTarget.Component }); }
10607
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.5", type: Chart3dComponent, isStandalone: true, selector: "teta-chart3d", inputs: { config: "config" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["canvas"], descendants: true }], ngImport: i0, template: "<canvas #canvas></canvas>\n", styles: [":host{display:flex;width:100%;height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
10608
- }
10609
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.5", ngImport: i0, type: Chart3dComponent, decorators: [{
10610
- type: Component,
10611
- args: [{ selector: 'teta-chart3d', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<canvas #canvas></canvas>\n", styles: [":host{display:flex;width:100%;height:100%}\n"] }]
10612
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: ThemeSwitchService }], propDecorators: { canvasRef: [{
10613
- type: ViewChild,
10614
- args: ['canvas']
10615
- }], config: [{
10616
- type: Input
10617
- }] } });
10618
-
10619
10619
  class DividerComponent {
10620
10620
  constructor() { }
10621
10621
  ngOnInit() { }
@@ -10809,7 +10809,7 @@ class AutoPositionDirective {
10809
10809
  }
10810
10810
  ngAfterViewInit() {
10811
10811
  this.setPosition();
10812
- this._zone.onStable.pipe(takeWhile$1(() => this._alive)).subscribe(() => {
10812
+ this._zone.onStable.pipe(takeWhile(() => this._alive)).subscribe(() => {
10813
10813
  this.setPosition();
10814
10814
  });
10815
10815
  }
@@ -11147,12 +11147,12 @@ class DragContainerDirective {
11147
11147
  previewTemplate: this._previewTemplate?.templateRef,
11148
11148
  viewContainer: this._viewContainerRef
11149
11149
  });
11150
- this._dragService.dropTarget.pipe(takeWhile$1(() => this._alive))
11150
+ this._dragService.dropTarget.pipe(takeWhile(() => this._alive))
11151
11151
  .subscribe((target) => {
11152
11152
  this.dropTarget = target;
11153
11153
  this._cdr.detectChanges();
11154
11154
  });
11155
- this._dragService.dropped.pipe(takeWhile$1(() => this._alive))
11155
+ this._dragService.dropped.pipe(takeWhile(() => this._alive))
11156
11156
  .subscribe((event) => {
11157
11157
  this.tetaDrop.emit(event);
11158
11158
  });
@@ -11259,7 +11259,7 @@ class DragDirective {
11259
11259
  data: this.data,
11260
11260
  });
11261
11261
  this._dragService.dropTarget
11262
- .pipe(takeWhile$1(() => this._alive))
11262
+ .pipe(takeWhile(() => this._alive))
11263
11263
  .subscribe(target => {
11264
11264
  this.dropTarget = target;
11265
11265
  if (target === this.instance) {
@@ -11269,7 +11269,7 @@ class DragDirective {
11269
11269
  this._cdr.markForCheck();
11270
11270
  });
11271
11271
  this._dragService.dropped
11272
- .pipe(takeWhile$1(() => this._alive))
11272
+ .pipe(takeWhile(() => this._alive))
11273
11273
  .pipe(filter$1((event) => {
11274
11274
  return event.target === this.instance;
11275
11275
  }))
@@ -11550,7 +11550,7 @@ class LoaderDirective {
11550
11550
  this._alive = true;
11551
11551
  this._loading = false;
11552
11552
  this._element = this._elementRef.nativeElement;
11553
- this._zone.onStable.pipe(takeWhile$1(_ => this._alive)).subscribe(_ => {
11553
+ this._zone.onStable.pipe(takeWhile(_ => this._alive)).subscribe(_ => {
11554
11554
  if (this._loading && this._loader) {
11555
11555
  this.setPosition();
11556
11556
  }
@@ -11634,7 +11634,7 @@ class TooltipDirective extends DynamicContentBaseDirective {
11634
11634
  }
11635
11635
  ngOnInit() {
11636
11636
  merge(this._click.click, this._click.contextMenu)
11637
- .pipe(takeWhile$1(() => this._alive), filter$1(() => this._open), filter$1(() => this._componentRef != null), filter$1((event) => !DomUtil.clickedInside(this._elementRef.nativeElement, event)), filter$1((event) => !DomUtil.clickedInside(this._componentRef?.location.nativeElement, event)), tap$1(_ => this.destroyContentRef()))
11637
+ .pipe(takeWhile(() => this._alive), filter$1(() => this._open), filter$1(() => this._componentRef != null), filter$1((event) => !DomUtil.clickedInside(this._elementRef.nativeElement, event)), filter$1((event) => !DomUtil.clickedInside(this._componentRef?.location.nativeElement, event)), tap(_ => this.destroyContentRef()))
11638
11638
  .subscribe();
11639
11639
  }
11640
11640
  setPosition() {