@tetacom/ng-components 1.1.16 → 1.1.17

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,20 +1,20 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ChangeDetectionStrategy, HostBinding, Directive, Optional, Inject, ContentChild, Input, Host, HostListener, Injectable, NgModule, forwardRef, EventEmitter, Output, ElementRef, TemplateRef, Injector, ViewChild, Pipe, PLATFORM_ID, InjectionToken, inject, ViewContainerRef, ViewEncapsulation, ChangeDetectorRef, ContentChildren, CUSTOM_ELEMENTS_SCHEMA, SkipSelf } from '@angular/core';
2
+ import { Component, ChangeDetectionStrategy, HostBinding, Directive, Optional, Inject, ContentChild, Input, Host, HostListener, Injectable, NgModule, forwardRef, EventEmitter, Output, PLATFORM_ID, ElementRef, TemplateRef, Injector, Pipe, ViewChild, InjectionToken, inject, ViewContainerRef, ViewEncapsulation, ChangeDetectorRef, ContentChildren, CUSTOM_ELEMENTS_SCHEMA, SkipSelf } from '@angular/core';
3
3
  import * as i1 from '@angular/common';
4
- import { DOCUMENT, CommonModule, DatePipe, isPlatformBrowser } from '@angular/common';
4
+ import { DOCUMENT, CommonModule, isPlatformBrowser, DatePipe } from '@angular/common';
5
5
  import * as i1$1 from '@angular/common/http';
6
6
  import { HttpClient, HttpClientModule } from '@angular/common/http';
7
- import { map, takeWhile as takeWhile$1, throttleTime, filter as filter$1, tap as tap$1, withLatestFrom } from 'rxjs/operators';
7
+ import { map, takeWhile, throttleTime, filter, tap as tap$1, withLatestFrom } from 'rxjs/operators';
8
8
  import * as i3 from '@angular/forms';
9
9
  import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule, UntypedFormControl, UntypedFormGroup, Validators, ControlContainer, NgForm, NgModelGroup, FormGroup } from '@angular/forms';
10
- import dayjs from 'dayjs';
11
- import * as i3$1 from 'rxjs';
12
- import { ReplaySubject, BehaviorSubject, combineLatest, takeWhile, filter, map as map$1, shareReplay, Observable, share, pipe, fromEvent, tap, Subject, merge } from 'rxjs';
13
- import { maskitoDateTimeOptionsGenerator, maskitoDateOptionsGenerator, maskitoDateRangeOptionsGenerator } from '@maskito/kit';
14
10
  import * as i6 from '@maskito/angular';
15
11
  import { MaskitoModule } from '@maskito/angular';
16
- import { trigger, transition, style, animate } from '@angular/animations';
17
12
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
13
+ import { trigger, transition, style, animate } from '@angular/animations';
14
+ import dayjs from 'dayjs';
15
+ import * as i3$1 from 'rxjs';
16
+ import { ReplaySubject, BehaviorSubject, combineLatest, takeWhile as takeWhile$1, filter as filter$1, map as map$1, shareReplay, Observable, share, pipe, fromEvent, tap, Subject, merge } from 'rxjs';
17
+ import { maskitoDateTimeOptionsGenerator, maskitoDateOptionsGenerator, maskitoDateRangeOptionsGenerator } from '@maskito/kit';
18
18
  import * as i1$2 from '@ngneat/transloco';
19
19
  import { TranslocoModule, TRANSLOCO_SCOPE } from '@ngneat/transloco';
20
20
  import * as i6$1 from '@angular/cdk/scrolling';
@@ -713,1024 +713,637 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
713
713
  }]
714
714
  }] });
715
715
 
716
- class DayModel {
717
- disabled;
718
- isCurrentMonth;
719
- today;
720
- selected;
721
- date;
722
- weekend;
723
- constructor(options) {
724
- if (options) {
725
- this.disabled = options.disabled;
726
- this.isCurrentMonth = options.isCurrentMonth;
727
- this.today = options.today;
728
- this.selected = options.selected;
729
- this.date = options.date;
730
- this.weekend = options.weekend;
716
+ class DomUtil {
717
+ static clickedInside(target, event) {
718
+ return !!target && event.composedPath().indexOf(target) >= 0;
719
+ }
720
+ static findTransformedParent(node) {
721
+ while (node !== null && node.tagName !== 'BODY') {
722
+ const style = getComputedStyle(node);
723
+ if (style.transform !== 'none') {
724
+ return node;
725
+ }
726
+ node = node.parentNode;
731
727
  }
728
+ return null;
729
+ }
730
+ static isOverflown(element) {
731
+ return (element.scrollHeight > element.clientHeight ||
732
+ element.scrollWidth > element.clientWidth);
732
733
  }
733
734
  }
734
735
 
735
- class BaseCalendar {
736
- _cdr;
737
- currentMonth = new ReplaySubject(1);
738
- minMax = new ReplaySubject(1);
739
- currentYear = new ReplaySubject(1);
740
- selectedPicker = new BehaviorSubject('day');
741
- localeMonths = new Map()
742
- .set('ru', [
743
- 'Январь',
744
- 'Февраль',
745
- 'Март',
746
- 'Апрель',
747
- 'Май',
748
- 'Июнь',
749
- 'Июль',
750
- 'Август',
751
- 'Сентябрь',
752
- 'Октябрь',
753
- 'Ноябрь',
754
- 'Декабрь',
755
- ])
756
- .set('en', [
757
- 'January',
758
- 'February',
759
- 'March',
760
- 'April',
761
- 'May',
762
- 'June',
763
- 'July',
764
- 'August',
765
- 'September',
766
- 'October',
767
- 'November',
768
- 'December',
769
- ]);
770
- alive = true;
771
- constructor(_cdr) {
772
- this._cdr = _cdr;
773
- }
774
- generateCalendar(selectedDate, year, month, minMax) {
775
- const calendarStartDay = selectedDate
776
- .set('year', year)
777
- .set('month', month)
778
- .set('date', 1)
779
- .startOf('week');
780
- const calendar = new Array(42).fill(1).map((v, i) => {
781
- return calendarStartDay.add(i, 'day');
782
- });
783
- return calendar.map(d => {
784
- return new DayModel({
785
- date: new Date(d.toDate()),
786
- isCurrentMonth: month === d.month(),
787
- disabled: !this.isSuitableMinDate(d.toDate(), minMax.min) ||
788
- !this.isSuitableMaxDate(d.toDate(), minMax.max),
789
- selected: this.isSelected(d.toDate(), selectedDate.toDate()),
736
+ class ClickOutsideDirective {
737
+ _elementRef;
738
+ _ngZone;
739
+ clickOutside = new EventEmitter();
740
+ rightClick = false;
741
+ _handleEvents = false;
742
+ set tetaClickOutside(val) {
743
+ this._handleEvents = val;
744
+ if (this._handleEvents) {
745
+ this._ngZone.runOutsideAngular(() => {
746
+ setTimeout(() => {
747
+ this.addListener(this.rightClick);
748
+ });
790
749
  });
791
- });
792
- }
793
- isSuitableMinDate(d, minDate) {
794
- return (dayjs(new Date(minDate)).startOf('date').toDate() <= new Date(d) ||
795
- minDate === null);
750
+ }
751
+ else {
752
+ this.removeListener();
753
+ }
796
754
  }
797
- isSuitableMaxDate(d, maxDate) {
798
- return (new Date(d) < dayjs(new Date(maxDate)).endOf('date').toDate() ||
799
- maxDate === null);
755
+ get tetaClickOutside() {
756
+ return this._handleEvents;
800
757
  }
801
- isSelected(date, selectedDate) {
802
- const isSelectedDate = date.getDate() === selectedDate?.getDate();
803
- const isSelectedYear = date.getFullYear() === selectedDate?.getFullYear();
804
- const isSelectedMonth = date.getMonth() === selectedDate?.getMonth();
805
- return (isSelectedDate && isSelectedMonth && isSelectedYear && !this.isDateNull);
758
+ constructor(_elementRef, _ngZone) {
759
+ this._elementRef = _elementRef;
760
+ this._ngZone = _ngZone;
806
761
  }
807
762
  ngOnDestroy() {
808
- this.alive = false;
809
- }
810
- selectPicker(entity) {
811
- this.selectedPicker.next(entity);
812
- }
813
- selectMonth(month) {
814
- this.currentMonth.next(month);
815
- this.selectPicker('day');
816
- }
817
- selectYear(year) {
818
- this.setYear(year);
819
- this.selectPicker('day');
820
- }
821
- ngOnChanges(changes) {
822
- this.changeCalendarData(this.selectedDate);
823
- }
824
- changeCalendarData(selectedDate) {
825
- const date = new Date(selectedDate || new Date());
826
- this.currentMonth.next(new Date(date).getMonth());
827
- this.currentYear.next(new Date(date).getFullYear());
828
- this.minMax.next({ min: this.min, max: this.max });
763
+ this.removeListener();
829
764
  }
830
- setYear(year) {
831
- this.currentYear.next(year);
765
+ addListener(handleRightClick) {
766
+ window.addEventListener('click', this.listener);
767
+ if (handleRightClick) {
768
+ window.addEventListener('contextmenu', this.listener);
769
+ }
832
770
  }
833
- changeMonth(month, year) {
834
- const { availableYear, availableMonth } = this.getAvailableMonthYear(month, year);
835
- this.currentMonth.next(availableMonth);
836
- this.currentYear.next(availableYear);
771
+ removeListener() {
772
+ window.removeEventListener('click', this.listener);
773
+ window.removeEventListener('contextmenu', this.listener);
837
774
  }
838
- getAvailableMonthYear(month, year) {
839
- if (month > 11) {
840
- return { availableMonth: month - 12, availableYear: year + 1 };
775
+ listener = (click) => {
776
+ if (!this._handleEvents) {
777
+ return;
841
778
  }
842
- if (month < 0) {
843
- return { availableMonth: 12 + month, availableYear: year - 1 };
779
+ const clickedInside = DomUtil.clickedInside(this._elementRef.nativeElement, click);
780
+ if (!clickedInside) {
781
+ this.clickOutside.emit(click);
844
782
  }
845
- return { availableMonth: month, availableYear: year };
846
- }
847
- getMothName(month) {
848
- return this.localeMonths.get(this.locale)[month];
849
- }
850
- selectDate(date) {
851
- this.setDate.emit(date);
852
- }
853
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseCalendar, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
854
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: BaseCalendar, selector: "ng-component", usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
783
+ };
784
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
785
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: ClickOutsideDirective, selector: "[tetaClickOutside]", inputs: { rightClick: "rightClick", tetaClickOutside: "tetaClickOutside" }, outputs: { clickOutside: "clickOutside" }, ngImport: i0 });
855
786
  }
856
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseCalendar, decorators: [{
857
- type: Component,
787
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideDirective, decorators: [{
788
+ type: Directive,
858
789
  args: [{
859
- template: '',
860
- changeDetection: ChangeDetectionStrategy.OnPush,
790
+ selector: '[tetaClickOutside]',
861
791
  }]
862
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
863
-
864
- class DayItemComponent {
865
- day;
866
- ngOnInit() {
867
- }
868
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DayItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
869
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DayItemComponent, selector: "teta-day-item", inputs: { day: "day" }, ngImport: i0, template: "<p>{{day.date.getDate()}}</p>\n\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
870
- }
871
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DayItemComponent, decorators: [{
872
- type: Component,
873
- args: [{ selector: 'teta-day-item', changeDetection: ChangeDetectionStrategy.OnPush, template: "<p>{{day.date.getDate()}}</p>\n\n" }]
874
- }], propDecorators: { day: [{
792
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { clickOutside: [{
793
+ type: Output
794
+ }], rightClick: [{
795
+ type: Input
796
+ }], tetaClickOutside: [{
875
797
  type: Input
876
798
  }] } });
877
799
 
878
- class DayPickerComponent {
879
- date = new Date();
880
- calendar;
881
- viewType;
882
- range;
883
- min;
884
- max;
885
- locale;
886
- hoveredDate;
887
- hoveredDateChange = new EventEmitter();
888
- selectDate = new EventEmitter();
889
- daysOfWeek = new Map().set('ru', ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс']).set('en', ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']);
890
- constructor() {
800
+ class ClickOutsideModule {
801
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
802
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideModule, declarations: [ClickOutsideDirective], imports: [CommonModule], exports: [ClickOutsideDirective] });
803
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideModule, imports: [CommonModule] });
804
+ }
805
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideModule, decorators: [{
806
+ type: NgModule,
807
+ args: [{
808
+ declarations: [ClickOutsideDirective],
809
+ exports: [ClickOutsideDirective],
810
+ imports: [
811
+ CommonModule
812
+ ]
813
+ }]
814
+ }] });
815
+
816
+ class ScrollIntoViewDirective {
817
+ platformId;
818
+ elementRef;
819
+ tetaScrollIntoView;
820
+ behavior = 'smooth';
821
+ block = 'end';
822
+ constructor(platformId, elementRef) {
823
+ this.platformId = platformId;
824
+ this.elementRef = elementRef;
891
825
  }
892
- isInRange(day, from, to) {
893
- const matchesMinDate = dayjs(new Date(from)).startOf('date').toDate() <= day.date;
894
- const matchesMaxDate = day.date < dayjs(new Date(to)).endOf('date').toDate();
895
- return matchesMinDate && matchesMaxDate;
896
- }
897
- isHoveredRange(day) {
898
- if (!this.range?.to && this.range?.from) {
899
- return this.isInRange(day, this.range.from, this.hoveredDate) || this.isInRange(day, this.hoveredDate, this.range.from);
826
+ ngOnChanges(simpleChange) {
827
+ if (isPlatformBrowser(this.platformId)) {
828
+ if (coerceBooleanProperty(this.tetaScrollIntoView)) {
829
+ this.elementRef.nativeElement.scrollIntoView({
830
+ behavior: 'smooth',
831
+ block: 'start'
832
+ });
833
+ }
900
834
  }
901
- return false;
902
835
  }
903
- isActiveRange(day) {
904
- if (this.range?.from && this.range?.to) {
905
- return this.isInRange(day, this.range.from, this.range.to);
836
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewDirective, deps: [{ token: PLATFORM_ID }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
837
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: ScrollIntoViewDirective, selector: "[tetaScrollIntoView]", inputs: { tetaScrollIntoView: "tetaScrollIntoView", behavior: "behavior", block: "block" }, usesOnChanges: true, ngImport: i0 });
838
+ }
839
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewDirective, decorators: [{
840
+ type: Directive,
841
+ args: [{
842
+ selector: '[tetaScrollIntoView]'
843
+ }]
844
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
845
+ type: Inject,
846
+ args: [PLATFORM_ID]
847
+ }] }, { type: i0.ElementRef }]; }, propDecorators: { tetaScrollIntoView: [{
848
+ type: Input
849
+ }], behavior: [{
850
+ type: Input
851
+ }], block: [{
852
+ type: Input
853
+ }] } });
854
+
855
+ class ScrollIntoViewModule {
856
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
857
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewModule, declarations: [ScrollIntoViewDirective], imports: [CommonModule], exports: [ScrollIntoViewDirective] });
858
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewModule, imports: [CommonModule] });
859
+ }
860
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewModule, decorators: [{
861
+ type: NgModule,
862
+ args: [{
863
+ declarations: [
864
+ ScrollIntoViewDirective
865
+ ], exports: [
866
+ ScrollIntoViewDirective
867
+ ],
868
+ imports: [
869
+ CommonModule
870
+ ]
871
+ }]
872
+ }] });
873
+
874
+ var Align;
875
+ (function (Align) {
876
+ Align[Align["left"] = 0] = "left";
877
+ Align[Align["right"] = 1] = "right";
878
+ Align[Align["center"] = 2] = "center";
879
+ Align[Align["auto"] = 3] = "auto";
880
+ Align[Align["fitWidth"] = 4] = "fitWidth";
881
+ Align[Align["minWidth"] = 5] = "minWidth";
882
+ Align[Align["outerLeft"] = 6] = "outerLeft";
883
+ Align[Align["outerRight"] = 7] = "outerRight";
884
+ Align[Align["outerAuto"] = 8] = "outerAuto";
885
+ })(Align || (Align = {}));
886
+
887
+ var VerticalAlign;
888
+ (function (VerticalAlign) {
889
+ VerticalAlign[VerticalAlign["top"] = 0] = "top";
890
+ VerticalAlign[VerticalAlign["bottom"] = 1] = "bottom";
891
+ VerticalAlign[VerticalAlign["center"] = 2] = "center";
892
+ VerticalAlign[VerticalAlign["auto"] = 3] = "auto";
893
+ VerticalAlign[VerticalAlign["innerTop"] = 4] = "innerTop";
894
+ VerticalAlign[VerticalAlign["innerBottom"] = 5] = "innerBottom";
895
+ VerticalAlign[VerticalAlign["innerAuto"] = 6] = "innerAuto";
896
+ })(VerticalAlign || (VerticalAlign = {}));
897
+
898
+ class PositionUtil {
899
+ static getPosition(containerPosition, elementPosition, align, verticalAlign, margin = 0, verticalMargin = 0, transformedParentRect = {
900
+ left: 0,
901
+ right: 0,
902
+ top: 0,
903
+ bottom: 0,
904
+ }) {
905
+ const rect = {};
906
+ const elementWidth = elementPosition.right - elementPosition.left;
907
+ const elementHeight = elementPosition.bottom - elementPosition.top;
908
+ const containerWidth = containerPosition.right - containerPosition.left;
909
+ const containerHeight = containerPosition.bottom - containerPosition.top;
910
+ if (align === Align.auto) {
911
+ align = Align.left;
912
+ if (window.innerWidth < containerPosition.left + elementWidth) {
913
+ align = Align.right;
914
+ }
906
915
  }
907
- return false;
908
- }
909
- pickDate(day) {
910
- if (!day.disabled) {
911
- this.selectDate.emit(day.date);
916
+ if (align === Align.left) {
917
+ rect.left = containerPosition.left + margin;
912
918
  }
913
- }
914
- getRangeActiveClass(d) {
915
- if (this.range && new Date(this.range?.from).getTime() !== new Date(this.range?.to).getTime()) {
916
- if (this.range.to) {
917
- return this.getClassStaticItem(d);
919
+ if (align === Align.right) {
920
+ rect.left = containerPosition.right - elementWidth - margin;
921
+ }
922
+ if (align === Align.center) {
923
+ rect.left =
924
+ (containerPosition.left + containerPosition.right) / 2 -
925
+ elementWidth / 2;
926
+ }
927
+ if (align === Align.outerAuto) {
928
+ align = Align.outerRight;
929
+ if (window.innerWidth < containerPosition.right + elementWidth) {
930
+ align = Align.outerLeft;
931
+ }
932
+ }
933
+ if (align === Align.outerLeft) {
934
+ rect.left = containerPosition.left - elementWidth + margin;
935
+ }
936
+ if (align === Align.outerRight) {
937
+ rect.left = containerPosition.right - margin;
938
+ }
939
+ if (align === Align.fitWidth) {
940
+ rect.left = containerPosition.left + margin;
941
+ rect.right = window.innerWidth - containerPosition.right + margin;
942
+ }
943
+ if (align === Align.minWidth) {
944
+ rect.left = containerPosition.left + margin;
945
+ rect.minWidth = containerWidth;
946
+ }
947
+ if (verticalAlign === VerticalAlign.auto) {
948
+ if (containerPosition.bottom + elementHeight > window.innerHeight &&
949
+ containerPosition.bottom >= window.innerHeight / 2) {
950
+ verticalAlign = VerticalAlign.top;
918
951
  }
919
952
  else {
920
- if (this.hoveredDate.getTime() === d.date.getTime()) {
921
- return this.getClassHoveredItem();
922
- }
923
- else {
924
- return this.getClassSelectedItem(d);
925
- }
953
+ verticalAlign = VerticalAlign.bottom;
926
954
  }
927
955
  }
928
- return '';
929
- }
930
- hover(date) {
931
- if (date?.getTime() !== this.hoveredDate?.getTime()) {
932
- this.hoveredDate = date;
933
- this.hoveredDateChange.emit(date);
956
+ if (verticalAlign === VerticalAlign.innerAuto) {
957
+ if (containerPosition.bottom + elementHeight > window.innerHeight &&
958
+ containerPosition.bottom >= window.innerHeight / 2) {
959
+ verticalAlign = VerticalAlign.innerTop;
960
+ }
961
+ else {
962
+ verticalAlign = VerticalAlign.innerBottom;
963
+ }
934
964
  }
935
- }
936
- getClassStaticItem(d) {
937
- const from = dayjs(new Date(this.range.from)).startOf("day").toDate();
938
- const to = dayjs(new Date(this.range.to)).startOf("day").toDate();
939
- const itemDate = dayjs(new Date(d.date)).startOf("day").toDate();
940
- if (from.getTime() === itemDate.getTime()) {
941
- return 'datepicker-date_active-first';
965
+ if (verticalAlign === VerticalAlign.top) {
966
+ rect.top = containerPosition.top - elementHeight - verticalMargin;
942
967
  }
943
- if (to.getTime() === itemDate.getTime()) {
944
- return 'datepicker-date_active-second';
968
+ if (verticalAlign === VerticalAlign.bottom) {
969
+ rect.top = containerPosition.bottom + verticalMargin;
945
970
  }
946
- return '';
947
- }
948
- getClassHoveredItem() {
949
- if (new Date(this.range.from) > this.hoveredDate) {
950
- return 'datepicker-date_active-first';
971
+ if (verticalAlign === VerticalAlign.innerTop) {
972
+ rect.top = containerPosition.bottom - elementHeight - verticalMargin;
951
973
  }
952
- if (new Date(this.range.from) < this.hoveredDate) {
953
- return 'datepicker-date_active-second';
974
+ if (verticalAlign === VerticalAlign.innerBottom) {
975
+ rect.top = containerPosition.top + verticalMargin;
954
976
  }
955
- }
956
- getClassSelectedItem(d) {
957
- if (d.selected && d.date < this.hoveredDate) {
958
- return 'datepicker-date_active-first';
977
+ if (verticalAlign === VerticalAlign.center) {
978
+ rect.top =
979
+ (containerPosition.top + containerPosition.bottom) / 2 -
980
+ elementHeight / 2;
959
981
  }
960
- if (d.selected && d.date > this.hoveredDate) {
961
- return 'datepicker-date_active-second';
982
+ if (rect.left + elementWidth > window.innerWidth) {
983
+ rect.left = window.innerWidth - elementWidth;
962
984
  }
963
- return '';
985
+ if (rect.left < 0) {
986
+ rect.left = 0;
987
+ }
988
+ if (rect.top + elementHeight > window.innerHeight || rect.bottom < 0) {
989
+ rect.bottom = 0;
990
+ }
991
+ if (rect.top < 0) {
992
+ rect.top = 0;
993
+ }
994
+ if (verticalAlign === VerticalAlign.bottom ||
995
+ verticalAlign === VerticalAlign.center ||
996
+ verticalAlign === VerticalAlign.innerBottom) {
997
+ rect.maxHeight = window.innerHeight - rect.top;
998
+ }
999
+ if (verticalAlign === VerticalAlign.top ||
1000
+ verticalAlign === VerticalAlign.innerTop) {
1001
+ rect.maxHeight = containerPosition.top;
1002
+ }
1003
+ if (!isNaN(rect.left)) {
1004
+ rect.left = rect.left - transformedParentRect.left;
1005
+ }
1006
+ if (!isNaN(rect.right)) {
1007
+ rect.right = rect.right - transformedParentRect.left;
1008
+ }
1009
+ if (!isNaN(rect.top)) {
1010
+ rect.top = rect.top - transformedParentRect.top;
1011
+ }
1012
+ if (!isNaN(rect.bottom)) {
1013
+ rect.bottom = rect.bottom
1014
+ ? rect.bottom - transformedParentRect.bottom
1015
+ : rect.bottom;
1016
+ }
1017
+ return rect;
1018
+ }
1019
+ static setElementPosition(element, rect) {
1020
+ element.style.left = rect.left != null ? `${rect.left}px` : '';
1021
+ element.style.right = rect.right != null ? `${rect.right}px` : '';
1022
+ element.style.top = rect.top != null ? `${rect.top}px` : '';
1023
+ element.style.bottom = rect.bottom != null ? `${rect.bottom}px` : '';
1024
+ element.style.maxHeight =
1025
+ rect.maxHeight != null ? `${rect.maxHeight}px` : '';
1026
+ element.style.minWidth = rect.minWidth != null ? `${rect.minWidth}px` : '';
1027
+ }
1028
+ static getMaxHeight(position) {
1029
+ let maxHeight = null;
1030
+ maxHeight = 1;
1031
+ return maxHeight;
1032
+ }
1033
+ static getMaxWidth(position) {
1034
+ let maxWidth = null;
1035
+ maxWidth = 1;
1036
+ return maxWidth;
964
1037
  }
965
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DayPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
966
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DayPickerComponent, selector: "teta-day-picker", inputs: { date: "date", calendar: "calendar", viewType: "viewType", range: "range", min: "min", max: "max", locale: "locale", hoveredDate: "hoveredDate" }, outputs: { hoveredDateChange: "hoveredDateChange", selectDate: "selectDate" }, ngImport: i0, template: "<div class=\"datepicker-week font-caption\">\n <p class=\"datepicker-day\" *ngFor=\"let day of daysOfWeek.get(locale)\">\n {{day}}\n </p>\n</div>\n<div class=\"datepicker-picker color-text-90 font-body-3\">\n <ng-container *ngFor=\"let day of calendar\">\n <div [class]=\"getRangeActiveClass(day)+' datepicker-date font-body-3 datepicker_'+viewType\"\n (mouseenter)=\"hover(day.date)\"\n (click)=\"pickDate(day)\"\n [ngClass]=\"{'datepicker-date_active':day.selected||(day.date===hoveredDate&&range&&!range.to),'datepicker-date-range_hover':range&&isHoveredRange(day),\n 'datepicker-date_disabled':day.disabled,'color-text-30':day.disabled||(!range&&!day.isCurrentMonth),'datepicker-date-range_disabled':!day.isCurrentMonth&&range,'datepicker-date-range_active':isActiveRange(day)}\">\n <teta-day-item [day]=\"day\"></teta-day-item>\n </div>\n </ng-container>\n</div>\n\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: DayItemComponent, selector: "teta-day-item", inputs: ["day"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
967
1038
  }
968
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DayPickerComponent, decorators: [{
969
- type: Component,
970
- args: [{ selector: 'teta-day-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"datepicker-week font-caption\">\n <p class=\"datepicker-day\" *ngFor=\"let day of daysOfWeek.get(locale)\">\n {{day}}\n </p>\n</div>\n<div class=\"datepicker-picker color-text-90 font-body-3\">\n <ng-container *ngFor=\"let day of calendar\">\n <div [class]=\"getRangeActiveClass(day)+' datepicker-date font-body-3 datepicker_'+viewType\"\n (mouseenter)=\"hover(day.date)\"\n (click)=\"pickDate(day)\"\n [ngClass]=\"{'datepicker-date_active':day.selected||(day.date===hoveredDate&&range&&!range.to),'datepicker-date-range_hover':range&&isHoveredRange(day),\n 'datepicker-date_disabled':day.disabled,'color-text-30':day.disabled||(!range&&!day.isCurrentMonth),'datepicker-date-range_disabled':!day.isCurrentMonth&&range,'datepicker-date-range_active':isActiveRange(day)}\">\n <teta-day-item [day]=\"day\"></teta-day-item>\n </div>\n </ng-container>\n</div>\n\n" }]
971
- }], ctorParameters: function () { return []; }, propDecorators: { date: [{
972
- type: Input
973
- }], calendar: [{
974
- type: Input
975
- }], viewType: [{
976
- type: Input
977
- }], range: [{
978
- type: Input
979
- }], min: [{
980
- type: Input
981
- }], max: [{
982
- type: Input
983
- }], locale: [{
984
- type: Input
985
- }], hoveredDate: [{
986
- type: Input
987
- }], hoveredDateChange: [{
988
- type: Output
989
- }], selectDate: [{
990
- type: Output
991
- }] } });
992
1039
 
993
- class MonthPickerComponent {
994
- locale;
995
- selectedMonth = 1;
996
- viewType;
997
- currentYear;
998
- localeMoths;
999
- selectMonth = new EventEmitter();
1000
- changeYear = new EventEmitter();
1001
- months = [];
1002
- constructor() {
1003
- }
1004
- pickMonth(monthId) {
1005
- this.selectMonth.emit(monthId);
1006
- }
1007
- pickYear(year) {
1008
- this.changeYear.emit(year);
1009
- }
1010
- ngOnInit() {
1011
- this.months = this.localeMoths.get(this.locale).map((m, i) => {
1012
- return {
1013
- id: i,
1014
- name: m,
1015
- isSelected: this.selectedMonth === i
1016
- };
1017
- });
1040
+ class DropdownContentDirective {
1041
+ _elementRef;
1042
+ nativeElement;
1043
+ constructor(_elementRef) {
1044
+ this._elementRef = _elementRef;
1045
+ this.nativeElement = _elementRef.nativeElement;
1018
1046
  }
1019
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MonthPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1020
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: MonthPickerComponent, selector: "teta-month-picker", inputs: { locale: "locale", selectedMonth: "selectedMonth", viewType: "viewType", currentYear: "currentYear", localeMoths: "localeMoths" }, outputs: { selectMonth: "selectMonth", changeYear: "changeYear" }, ngImport: i0, template: "<div class=\"padding-h-3 padding-v-2 gap-8 column datepicker-month-wrapper\">\n <div class=\"row align-center justify-content-between font-button-2\">\n <teta-button [class]=\"'change-month-button datepicker_'+viewType\" [square]=\"true\"\n (click)=\"pickYear(currentYear-1)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowLeftKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n <p>{{currentYear}}</p>\n <teta-button [square]=\"true\" [class]=\"'change-month-button datepicker_'+viewType\"\n (click)=\"pickYear(currentYear+1)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowRightKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n </div>\n <div class=\"datepicker-month font-body-3 color-text-90\"\n style=\"width: 100%\">\n <div *ngFor=\"let month of months\" (click)=\"pickMonth(month.id)\">\n <div [ngClass]=\"{'datepicker-month_item_active':month.isSelected}\"\n [class]=\"'datepicker-month_item column align-center justify-content-center datepicker_'+viewType\">\n <p>\n {{month.name}}\n </p>\n </div>\n </div>\n </div>\n</div>\n\n\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ButtonComponent, selector: "button[teta-button], teta-button", inputs: ["palette", "class", "view", "square", "viewType", "size"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1047
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownContentDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1048
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: DropdownContentDirective, selector: "[tetaDropdownContent]", ngImport: i0 });
1021
1049
  }
1022
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MonthPickerComponent, decorators: [{
1023
- type: Component,
1024
- args: [{ selector: 'teta-month-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"padding-h-3 padding-v-2 gap-8 column datepicker-month-wrapper\">\n <div class=\"row align-center justify-content-between font-button-2\">\n <teta-button [class]=\"'change-month-button datepicker_'+viewType\" [square]=\"true\"\n (click)=\"pickYear(currentYear-1)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowLeftKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n <p>{{currentYear}}</p>\n <teta-button [square]=\"true\" [class]=\"'change-month-button datepicker_'+viewType\"\n (click)=\"pickYear(currentYear+1)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowRightKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n </div>\n <div class=\"datepicker-month font-body-3 color-text-90\"\n style=\"width: 100%\">\n <div *ngFor=\"let month of months\" (click)=\"pickMonth(month.id)\">\n <div [ngClass]=\"{'datepicker-month_item_active':month.isSelected}\"\n [class]=\"'datepicker-month_item column align-center justify-content-center datepicker_'+viewType\">\n <p>\n {{month.name}}\n </p>\n </div>\n </div>\n </div>\n</div>\n\n\n" }]
1025
- }], ctorParameters: function () { return []; }, propDecorators: { locale: [{
1026
- type: Input
1027
- }], selectedMonth: [{
1028
- type: Input
1029
- }], viewType: [{
1030
- type: Input
1031
- }], currentYear: [{
1032
- type: Input
1033
- }], localeMoths: [{
1034
- type: Input
1035
- }], selectMonth: [{
1036
- type: Output
1037
- }], changeYear: [{
1038
- type: Output
1039
- }] } });
1050
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownContentDirective, decorators: [{
1051
+ type: Directive,
1052
+ args: [{
1053
+ selector: '[tetaDropdownContent]'
1054
+ }]
1055
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
1040
1056
 
1041
- class ScrollToSelectedYearDirective {
1042
- el;
1043
- alive = true;
1044
- constructor(el) {
1045
- this.el = el;
1046
- }
1047
- ngOnDestroy() {
1048
- this.alive = false;
1049
- }
1050
- ngAfterViewInit() {
1051
- this.el.nativeElement.scrollIntoView({ inline: "center", block: "center" });
1057
+ class DropdownHeadDirective {
1058
+ template;
1059
+ constructor(template) {
1060
+ this.template = template;
1052
1061
  }
1053
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollToSelectedYearDirective, deps: [{ token: ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1054
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: ScrollToSelectedYearDirective, selector: "[tetaScrollToSelectedYear]", ngImport: i0 });
1062
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownHeadDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
1063
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: DropdownHeadDirective, selector: "[tetaDropdownHead]", ngImport: i0 });
1055
1064
  }
1056
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollToSelectedYearDirective, decorators: [{
1065
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownHeadDirective, decorators: [{
1057
1066
  type: Directive,
1058
1067
  args: [{
1059
- selector: '[tetaScrollToSelectedYear]'
1068
+ selector: '[tetaDropdownHead]'
1060
1069
  }]
1061
- }], ctorParameters: function () { return [{ type: i0.ElementRef, decorators: [{
1062
- type: Inject,
1063
- args: [ElementRef]
1070
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
1071
+ type: Optional
1064
1072
  }] }]; } });
1065
1073
 
1066
- class YearPickerComponent {
1067
- selectedYear;
1068
- viewType;
1069
- minMax;
1070
- locale;
1071
- selectYear = new EventEmitter();
1072
- yearPickerDictionary = new Map().set('ru', 'Выберете год').set('en', 'Select year');
1073
- alive = true;
1074
- years;
1075
- constructor() {
1076
- }
1077
- pickYear(year, disabled) {
1078
- if (!disabled) {
1079
- this.selectYear.emit(year);
1074
+ class DropdownBase {
1075
+ _cdr;
1076
+ _document;
1077
+ _elementRef;
1078
+ _zone;
1079
+ _renderer;
1080
+ align = Align.left;
1081
+ verticalAlign = VerticalAlign.auto;
1082
+ appendToBody;
1083
+ disabled;
1084
+ backdrop = false;
1085
+ className;
1086
+ viewType = 'rounded';
1087
+ set open(val) {
1088
+ if (val != null && val !== this._open && !this.disabled) {
1089
+ if (val) {
1090
+ this.openDropdown();
1091
+ }
1092
+ else {
1093
+ this.closeDropdown();
1094
+ }
1080
1095
  }
1081
1096
  }
1082
- ngOnInit() {
1083
- this.years = new Array(100).fill(1).map((v, i) => {
1084
- const year = new Date().getFullYear() + (i - 50);
1085
- return { id: year, isSelected: year === this.selectedYear, disabled: this.isDisabled(year) };
1086
- });
1097
+ get open() {
1098
+ return this._open;
1087
1099
  }
1088
- isDisabled(year) {
1089
- if (this.minMax) {
1090
- const isSuitableMax = dayjs(new Date().setFullYear(year)).startOf('year').isAfter(new Date(this.minMax.max)) && this.minMax.max !== null;
1091
- const isSuitableMin = dayjs(new Date().setFullYear(year)).endOf('year').isBefore(new Date(this.minMax.min)) && this.minMax.min !== null;
1092
- return isSuitableMax || isSuitableMin;
1093
- }
1094
- return false;
1100
+ get container() {
1101
+ return this.appendToBody
1102
+ ? this._document.body
1103
+ : this._elementRef.nativeElement;
1095
1104
  }
1096
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: YearPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1097
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: YearPickerComponent, selector: "teta-year-picker", inputs: { selectedYear: "selectedYear", viewType: "viewType", minMax: "minMax", locale: "locale" }, outputs: { selectYear: "selectYear" }, ngImport: i0, template: "<div class=\"column\">\n <div class=\"font-title-3 padding-v-4 padding-h-3\">\n <p>{{yearPickerDictionary.get(locale)}}</p>\n </div>\n <div class=\"datepicker-year overflow-y-auto\">\n <div *ngFor=\"let y of years\" class=\"font-button-2\" (click)=\"pickYear(y.id,y.disabled)\">\n <div [ngClass]=\"{'datepicker-year_item_active':y.isSelected,'datepicker-year_item_disabled':y.disabled}\"\n [class]=\"'datepicker-year_item column align-center justify-content-center datepicker_'+viewType\">\n <div *ngIf=\" y.isSelected===true\" tetaScrollToSelectedYear>\n <span>{{y.id}}</span>\n </div>\n <div *ngIf=\"!y.isSelected\">\n <span>{{y.id}} </span>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: ScrollToSelectedYearDirective, selector: "[tetaScrollToSelectedYear]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1098
- }
1099
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: YearPickerComponent, decorators: [{
1100
- type: Component,
1101
- args: [{ selector: 'teta-year-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"column\">\n <div class=\"font-title-3 padding-v-4 padding-h-3\">\n <p>{{yearPickerDictionary.get(locale)}}</p>\n </div>\n <div class=\"datepicker-year overflow-y-auto\">\n <div *ngFor=\"let y of years\" class=\"font-button-2\" (click)=\"pickYear(y.id,y.disabled)\">\n <div [ngClass]=\"{'datepicker-year_item_active':y.isSelected,'datepicker-year_item_disabled':y.disabled}\"\n [class]=\"'datepicker-year_item column align-center justify-content-center datepicker_'+viewType\">\n <div *ngIf=\" y.isSelected===true\" tetaScrollToSelectedYear>\n <span>{{y.id}}</span>\n </div>\n <div *ngIf=\"!y.isSelected\">\n <span>{{y.id}} </span>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n" }]
1102
- }], ctorParameters: function () { return []; }, propDecorators: { selectedYear: [{
1103
- type: Input
1104
- }], viewType: [{
1105
- type: Input
1106
- }], minMax: [{
1107
- type: Input
1108
- }], locale: [{
1109
- type: Input
1110
- }], selectYear: [{
1111
- type: Output
1112
- }] } });
1113
-
1114
- class DateCalendarComponent extends BaseCalendar {
1115
- _cdr;
1116
- selectedDate = new Date();
1117
- locale;
1118
- open;
1119
- viewType;
1120
- min;
1121
- isDateNull;
1122
- max;
1123
- setDate = new EventEmitter();
1124
- calendar = [];
1125
- constructor(_cdr) {
1126
- super(_cdr);
1105
+ openChange = new EventEmitter();
1106
+ autoClose = true;
1107
+ autoCloseIgnore = ['inside'];
1108
+ _head;
1109
+ _content;
1110
+ _body = null;
1111
+ _backdrop = null;
1112
+ _open = false;
1113
+ _alive = true;
1114
+ constructor(_cdr, _document, _elementRef, _zone, _renderer) {
1127
1115
  this._cdr = _cdr;
1128
- dayjs().locale('ru', { weekStart: 1 });
1129
- combineLatest([this.currentYear, this.currentMonth, this.minMax])
1130
- .pipe(takeWhile(() => this.alive), filter(([currentYear, currentMonth]) => currentMonth !== null && currentYear !== null), map$1(([year, month, minMax]) => {
1131
- return this.generateCalendar(dayjs(new Date(this.selectedDate)).locale(this.locale), year, month, minMax);
1132
- }))
1116
+ this._document = _document;
1117
+ this._elementRef = _elementRef;
1118
+ this._zone = _zone;
1119
+ this._renderer = _renderer;
1120
+ this._zone.onStable
1121
+ .pipe(takeWhile(_ => this._alive), throttleTime(10, undefined, { trailing: true }))
1133
1122
  .subscribe(_ => {
1134
- this.calendar = _;
1123
+ if (this._head?.nativeElement && this._body) {
1124
+ setTimeout(() => {
1125
+ if (this._head?.nativeElement && this._body) {
1126
+ this.setPosition(this._head.nativeElement, this._body);
1127
+ }
1128
+ });
1129
+ }
1135
1130
  });
1131
+ this.addScrollListener();
1136
1132
  }
1137
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DateCalendarComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1138
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DateCalendarComponent, selector: "teta-date-calendar", inputs: { selectedDate: "selectedDate", locale: "locale", open: "open", viewType: "viewType", min: "min", isDateNull: "isDateNull", max: "max" }, outputs: { setDate: "setDate" }, usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"{currentMonth:currentMonth|async,currentYear:currentYear|async,selectedPicker:selectedPicker|async} as data\"\n class=\"datepicker-content overflow-y-auto\"\n>\n <ng-container *ngIf=\"data.selectedPicker==='day'\">\n <div class=\"padding-h-3 padding-v-2\">\n <div class=\"row align-center justify-content-between\">\n <teta-button [class]=\"'change-month-button datepicker_'+viewType\" [square]=\"true\"\n (click)=\"changeMonth(data.currentMonth-1,data.currentYear)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowLeftKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n <div class=\"row gap-4 font-button-2 \">\n <button [class]=\"'datepicker_'+viewType \" teta-button view=\"ghost\" palette=\"text\"\n (click)=\"selectPicker('month')\"> {{getMothName(data.currentMonth)}}</button>\n <button [class]=\"'datepicker_'+viewType\" teta-button view=\"ghost\" palette=\"text\"\n (click)=\"selectPicker('year')\">{{data.currentYear}}</button>\n </div>\n <teta-button [square]=\"true\" [class]=\"'change-month-button datepicker_'+viewType\"\n (click)=\"changeMonth(data.currentMonth+1,data.currentYear)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowRightKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n </div>\n <div>\n <teta-day-picker [viewType]=\"viewType\" (selectDate)=\"selectDate($event)\" [locale]=\"locale\"\n [calendar]=\"calendar\"></teta-day-picker>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"data.selectedPicker==='month'\">\n <teta-month-picker [localeMoths]=\"localeMonths\" [currentYear]=\"data.currentYear\" (changeYear)=\"setYear($event)\"\n [selectedMonth]=\"data.currentMonth\" [viewType]=\"viewType\" [locale]=\"locale\"\n (selectMonth)=\"selectMonth($event)\"></teta-month-picker>\n </ng-container>\n <ng-container *ngIf=\"data.selectedPicker==='year'\">\n <teta-year-picker [locale]=\"locale\" [viewType]=\"viewType\" (selectYear)=\"selectYear($event)\"\n [selectedYear]=\"data.currentYear\"></teta-year-picker>\n </ng-container>\n</div>\n\n", styles: [".change-month-button{-webkit-user-select:none;user-select:none}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "button[teta-button], teta-button", inputs: ["palette", "class", "view", "square", "viewType", "size"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "component", type: DayPickerComponent, selector: "teta-day-picker", inputs: ["date", "calendar", "viewType", "range", "min", "max", "locale", "hoveredDate"], outputs: ["hoveredDateChange", "selectDate"] }, { kind: "component", type: MonthPickerComponent, selector: "teta-month-picker", inputs: ["locale", "selectedMonth", "viewType", "currentYear", "localeMoths"], outputs: ["selectMonth", "changeYear"] }, { kind: "component", type: YearPickerComponent, selector: "teta-year-picker", inputs: ["selectedYear", "viewType", "minMax", "locale"], outputs: ["selectYear"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1139
- }
1140
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DateCalendarComponent, decorators: [{
1141
- type: Component,
1142
- args: [{ selector: 'teta-date-calendar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"{currentMonth:currentMonth|async,currentYear:currentYear|async,selectedPicker:selectedPicker|async} as data\"\n class=\"datepicker-content overflow-y-auto\"\n>\n <ng-container *ngIf=\"data.selectedPicker==='day'\">\n <div class=\"padding-h-3 padding-v-2\">\n <div class=\"row align-center justify-content-between\">\n <teta-button [class]=\"'change-month-button datepicker_'+viewType\" [square]=\"true\"\n (click)=\"changeMonth(data.currentMonth-1,data.currentYear)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowLeftKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n <div class=\"row gap-4 font-button-2 \">\n <button [class]=\"'datepicker_'+viewType \" teta-button view=\"ghost\" palette=\"text\"\n (click)=\"selectPicker('month')\"> {{getMothName(data.currentMonth)}}</button>\n <button [class]=\"'datepicker_'+viewType\" teta-button view=\"ghost\" palette=\"text\"\n (click)=\"selectPicker('year')\">{{data.currentYear}}</button>\n </div>\n <teta-button [square]=\"true\" [class]=\"'change-month-button datepicker_'+viewType\"\n (click)=\"changeMonth(data.currentMonth+1,data.currentYear)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowRightKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n </div>\n <div>\n <teta-day-picker [viewType]=\"viewType\" (selectDate)=\"selectDate($event)\" [locale]=\"locale\"\n [calendar]=\"calendar\"></teta-day-picker>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"data.selectedPicker==='month'\">\n <teta-month-picker [localeMoths]=\"localeMonths\" [currentYear]=\"data.currentYear\" (changeYear)=\"setYear($event)\"\n [selectedMonth]=\"data.currentMonth\" [viewType]=\"viewType\" [locale]=\"locale\"\n (selectMonth)=\"selectMonth($event)\"></teta-month-picker>\n </ng-container>\n <ng-container *ngIf=\"data.selectedPicker==='year'\">\n <teta-year-picker [locale]=\"locale\" [viewType]=\"viewType\" (selectYear)=\"selectYear($event)\"\n [selectedYear]=\"data.currentYear\"></teta-year-picker>\n </ng-container>\n</div>\n\n", styles: [".change-month-button{-webkit-user-select:none;user-select:none}\n"] }]
1143
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { selectedDate: [{
1144
- type: Input
1145
- }], locale: [{
1146
- type: Input
1147
- }], open: [{
1148
- type: Input
1149
- }], viewType: [{
1150
- type: Input
1151
- }], min: [{
1152
- type: Input
1153
- }], isDateNull: [{
1154
- type: Input
1155
- }], max: [{
1156
- type: Input
1157
- }], setDate: [{
1158
- type: Output
1159
- }] } });
1160
-
1161
- var Align;
1162
- (function (Align) {
1163
- Align[Align["left"] = 0] = "left";
1164
- Align[Align["right"] = 1] = "right";
1165
- Align[Align["center"] = 2] = "center";
1166
- Align[Align["auto"] = 3] = "auto";
1167
- Align[Align["fitWidth"] = 4] = "fitWidth";
1168
- Align[Align["minWidth"] = 5] = "minWidth";
1169
- Align[Align["outerLeft"] = 6] = "outerLeft";
1170
- Align[Align["outerRight"] = 7] = "outerRight";
1171
- Align[Align["outerAuto"] = 8] = "outerAuto";
1172
- })(Align || (Align = {}));
1173
-
1174
- var VerticalAlign;
1175
- (function (VerticalAlign) {
1176
- VerticalAlign[VerticalAlign["top"] = 0] = "top";
1177
- VerticalAlign[VerticalAlign["bottom"] = 1] = "bottom";
1178
- VerticalAlign[VerticalAlign["center"] = 2] = "center";
1179
- VerticalAlign[VerticalAlign["auto"] = 3] = "auto";
1180
- VerticalAlign[VerticalAlign["innerTop"] = 4] = "innerTop";
1181
- VerticalAlign[VerticalAlign["innerBottom"] = 5] = "innerBottom";
1182
- VerticalAlign[VerticalAlign["innerAuto"] = 6] = "innerAuto";
1183
- })(VerticalAlign || (VerticalAlign = {}));
1184
-
1185
- class BasePicker {
1186
- _elementRef;
1187
- _cdr;
1188
- datePipe;
1189
- open = false;
1190
- placeholder = '';
1191
- inputText;
1192
- maskitoOptions;
1193
- constructor(_elementRef, _cdr, datePipe) {
1194
- this._elementRef = _elementRef;
1195
- this._cdr = _cdr;
1196
- this.datePipe = datePipe;
1197
- this.inputText = this.checkNull();
1198
- }
1199
- changeInput(v) {
1200
- this.changePlaceholder(v);
1201
- }
1202
- changePlaceholder(value) {
1203
- const val = this.mask.split('');
1204
- for (let i = 0; value.length > i; i++) {
1205
- val.splice(i, 1, value[i]);
1206
- }
1207
- this.placeholder = val.join('');
1208
- }
1209
- openChange(e) {
1210
- if (!e) {
1211
- this.onBlur();
1133
+ click(event) {
1134
+ if (this.open) {
1135
+ if (!DomUtil.clickedInside(this._body, event) ||
1136
+ this.autoCloseIgnore.indexOf('inside') < 0) {
1137
+ this.closeDropdown();
1138
+ }
1212
1139
  }
1213
- this.open = e;
1214
- }
1215
- checkNull() {
1216
- if (!this.date && this.allowNull) {
1217
- return null;
1140
+ else {
1141
+ if (DomUtil.clickedInside(this._head.nativeElement, event)) {
1142
+ this.openDropdown();
1143
+ }
1218
1144
  }
1219
- return this.datePipe.transform(new Date(), 'dd.MM.yyyy, HH:mm');
1220
1145
  }
1221
- openPicker = (show) => {
1222
- if (this.disabled) {
1146
+ documentClick(event) {
1147
+ if (!this.open ||
1148
+ !this.autoClose ||
1149
+ event.detail === 0 ||
1150
+ DomUtil.clickedInside(this._head.nativeElement, event)) {
1223
1151
  return;
1224
1152
  }
1225
- this.open = show;
1226
- this._cdr.markForCheck();
1227
- };
1228
- changeSelectedDate(date, selectedDate) {
1229
- this.setDate(date);
1230
- this.emitValue(date);
1231
- this.open = false;
1232
- }
1233
- emitValue(value) {
1234
- if (this.isValueChange(value)) {
1235
- this.date = value;
1236
- this.selectDate.emit(value);
1237
- this.onChange(value);
1238
- }
1239
- }
1240
- isValueChange(value) {
1241
- return new Date(value).getTime() !== new Date(this.date).getTime();
1242
- }
1243
- checkEnter(e) {
1244
- if (e.key === 'Enter') {
1245
- this.inputText = e.target.value;
1246
- this.onBlur();
1247
- }
1248
- if (e.key === '-') {
1249
- e.preventDefault();
1153
+ if (DomUtil.clickedInside(this._body, event)) {
1154
+ if (this.autoCloseIgnore.indexOf('inside') < 0) {
1155
+ this.closeDropdown();
1156
+ }
1250
1157
  }
1251
- this.open = true;
1252
- }
1253
- isAvailableLength(val, length) {
1254
- if (val?.length) {
1255
- return val.length === length;
1158
+ else {
1159
+ if (this.autoCloseIgnore.indexOf('outside') < 0) {
1160
+ this.closeDropdown();
1161
+ }
1256
1162
  }
1257
- return false;
1258
- }
1259
- getDateFromStr(str, separator = '.') {
1260
- const date = str?.split(separator);
1261
- const day = this.isAvailableLength(date?.[0], 2) ? Number(date[0]) : null;
1262
- const month = this.isAvailableLength(date?.[1], 2) ? Number(date[1]) : null;
1263
- const year = this.isAvailableLength(date?.[2], 4) ? Number(date[2]) : null;
1264
- return { day, month, year };
1265
- }
1266
- getTimeFromStr(str, separator = ':') {
1267
- const time = str?.trim().split(separator);
1268
- const hours = this.isAvailableLength(time?.[0], 2) ? Number(time[0]) : null;
1269
- const mins = this.isAvailableLength(time?.[1], 2) ? Number(time[1]) : null;
1270
- return { hours, mins };
1271
1163
  }
1272
- focus() {
1273
- this._elementRef.nativeElement.focus();
1274
- }
1275
- getLocaleString(date) {
1276
- return new Date(date).toLocaleString([], {
1277
- year: 'numeric',
1278
- month: '2-digit',
1279
- day: '2-digit',
1280
- hour: this.showTime ? '2-digit' : undefined,
1281
- minute: this.showTime ? '2-digit' : undefined,
1282
- });
1283
- }
1284
- getAvailableDate(min, max, date) {
1285
- const minDate = dayjs(new Date(min)).startOf('day').toDate();
1286
- const maxDate = dayjs(new Date(max)).endOf('day').toDate();
1287
- if (min && minDate.getTime() >= new Date(date).getTime()) {
1288
- return new Date();
1164
+ keyUp(event) {
1165
+ if (!this.open ||
1166
+ !this.autoClose ||
1167
+ ['esc', 'enter'].every((_) => this.autoCloseIgnore.indexOf(_) >= 0)) {
1168
+ return;
1289
1169
  }
1290
- if (max && maxDate.getTime() <= new Date(date).getTime()) {
1291
- return maxDate;
1170
+ if ((event.code === 'Escape' && this.autoCloseIgnore.indexOf('esc') < 0) ||
1171
+ (event.code === 'Enter' && this.autoCloseIgnore.indexOf('enter') < 0)) {
1172
+ this.closeDropdown();
1292
1173
  }
1293
- return new Date(date);
1294
- }
1295
- }
1296
-
1297
- class DomUtil {
1298
- static clickedInside(target, event) {
1299
- return !!target && event.composedPath().indexOf(target) >= 0;
1300
1174
  }
1301
- static findTransformedParent(node) {
1302
- while (node !== null && node.tagName !== 'BODY') {
1303
- const style = getComputedStyle(node);
1304
- if (style.transform !== 'none') {
1305
- return node;
1306
- }
1307
- node = node.parentNode;
1308
- }
1309
- return null;
1175
+ addScrollListener() {
1176
+ window.addEventListener('scroll', this.scrollListener, true);
1310
1177
  }
1311
- static isOverflown(element) {
1312
- return (element.scrollHeight > element.clientHeight ||
1313
- element.scrollWidth > element.clientWidth);
1178
+ removeScrollListener() {
1179
+ window.removeEventListener('scroll', this.scrollListener, true);
1314
1180
  }
1315
- }
1316
-
1317
- class PositionUtil {
1318
- static getPosition(containerPosition, elementPosition, align, verticalAlign, margin = 0, verticalMargin = 0, transformedParentRect = {
1319
- left: 0,
1320
- right: 0,
1321
- top: 0,
1322
- bottom: 0,
1323
- }) {
1324
- const rect = {};
1325
- const elementWidth = elementPosition.right - elementPosition.left;
1326
- const elementHeight = elementPosition.bottom - elementPosition.top;
1327
- const containerWidth = containerPosition.right - containerPosition.left;
1328
- const containerHeight = containerPosition.bottom - containerPosition.top;
1329
- if (align === Align.auto) {
1330
- align = Align.left;
1331
- if (window.innerWidth < containerPosition.left + elementWidth) {
1332
- align = Align.right;
1333
- }
1334
- }
1335
- if (align === Align.left) {
1336
- rect.left = containerPosition.left + margin;
1337
- }
1338
- if (align === Align.right) {
1339
- rect.left = containerPosition.right - elementWidth - margin;
1340
- }
1341
- if (align === Align.center) {
1342
- rect.left =
1343
- (containerPosition.left + containerPosition.right) / 2 -
1344
- elementWidth / 2;
1181
+ scrollListener = event => {
1182
+ if (this.open &&
1183
+ !this._body.contains(event.target) &&
1184
+ this._body !== event.target) {
1185
+ this.closeDropdown();
1345
1186
  }
1346
- if (align === Align.outerAuto) {
1347
- align = Align.outerRight;
1348
- if (window.innerWidth < containerPosition.right + elementWidth) {
1349
- align = Align.outerLeft;
1187
+ };
1188
+ closeDropdown() {
1189
+ if (this.open && this._body && this.container.contains(this._body)) {
1190
+ this._renderer.removeChild(this.container, this._body);
1191
+ this._open = false;
1192
+ this._body = null;
1193
+ if (this._backdrop) {
1194
+ this._renderer.removeChild(this._document.body, this._backdrop);
1350
1195
  }
1196
+ this.openChange.emit(this.open);
1197
+ this._cdr.detectChanges();
1351
1198
  }
1352
- if (align === Align.outerLeft) {
1353
- rect.left = containerPosition.left - elementWidth + margin;
1354
- }
1355
- if (align === Align.outerRight) {
1356
- rect.left = containerPosition.right - margin;
1357
- }
1358
- if (align === Align.fitWidth) {
1359
- rect.left = containerPosition.left + margin;
1360
- rect.right = window.innerWidth - containerPosition.right + margin;
1199
+ }
1200
+ openDropdown() {
1201
+ if (this._open || !this._content || this.disabled) {
1202
+ return;
1361
1203
  }
1362
- if (align === Align.minWidth) {
1363
- rect.left = containerPosition.left + margin;
1364
- rect.minWidth = containerWidth;
1204
+ this._open = true;
1205
+ this.openChange.emit(this.open);
1206
+ const renderer = this._renderer;
1207
+ const content = this._content.nativeElement;
1208
+ const container = (this._body =
1209
+ this._body || renderer.createElement('div'));
1210
+ renderer.addClass(container, 'dropdown');
1211
+ renderer.addClass(container, 'dropdown_' + this.viewType);
1212
+ if (this.backdrop) {
1213
+ this._backdrop = renderer.createElement('div');
1214
+ renderer.addClass(this._backdrop, 'dropdown-backdrop');
1215
+ renderer.appendChild(this._document.body, this._backdrop);
1365
1216
  }
1366
- if (verticalAlign === VerticalAlign.auto) {
1367
- if (containerPosition.bottom + elementHeight > window.innerHeight &&
1368
- containerPosition.bottom >= window.innerHeight / 2) {
1369
- verticalAlign = VerticalAlign.top;
1217
+ if (this.className != null) {
1218
+ if (this.className instanceof Array && this.className.length > 0) {
1219
+ this.className.forEach(_ => {
1220
+ renderer.addClass(container, _);
1221
+ });
1370
1222
  }
1371
- else {
1372
- verticalAlign = VerticalAlign.bottom;
1223
+ if (typeof this.className === 'string') {
1224
+ renderer.addClass(container, this.className);
1373
1225
  }
1374
1226
  }
1375
- if (verticalAlign === VerticalAlign.innerAuto) {
1376
- if (containerPosition.bottom + elementHeight > window.innerHeight &&
1377
- containerPosition.bottom >= window.innerHeight / 2) {
1378
- verticalAlign = VerticalAlign.innerTop;
1379
- }
1380
- else {
1381
- verticalAlign = VerticalAlign.innerBottom;
1382
- }
1383
- }
1384
- if (verticalAlign === VerticalAlign.top) {
1385
- rect.top = containerPosition.top - elementHeight - verticalMargin;
1386
- }
1387
- if (verticalAlign === VerticalAlign.bottom) {
1388
- rect.top = containerPosition.bottom + verticalMargin;
1389
- }
1390
- if (verticalAlign === VerticalAlign.innerTop) {
1391
- rect.top = containerPosition.bottom - elementHeight - verticalMargin;
1392
- }
1393
- if (verticalAlign === VerticalAlign.innerBottom) {
1394
- rect.top = containerPosition.top + verticalMargin;
1395
- }
1396
- if (verticalAlign === VerticalAlign.center) {
1397
- rect.top =
1398
- (containerPosition.top + containerPosition.bottom) / 2 -
1399
- elementHeight / 2;
1400
- }
1401
- if (rect.left + elementWidth > window.innerWidth) {
1402
- rect.left = window.innerWidth - elementWidth;
1403
- }
1404
- if (rect.left < 0) {
1405
- rect.left = 0;
1406
- }
1407
- if (rect.top + elementHeight > window.innerHeight || rect.bottom < 0) {
1408
- rect.bottom = 0;
1409
- }
1410
- if (rect.top < 0) {
1411
- rect.top = 0;
1412
- }
1413
- if (verticalAlign === VerticalAlign.bottom ||
1414
- verticalAlign === VerticalAlign.center ||
1415
- verticalAlign === VerticalAlign.innerBottom) {
1416
- rect.maxHeight = window.innerHeight - rect.top;
1417
- }
1418
- if (verticalAlign === VerticalAlign.top ||
1419
- verticalAlign === VerticalAlign.innerTop) {
1420
- rect.maxHeight = containerPosition.top;
1421
- }
1422
- if (!isNaN(rect.left)) {
1423
- rect.left = rect.left - transformedParentRect.left;
1424
- }
1425
- if (!isNaN(rect.right)) {
1426
- rect.right = rect.right - transformedParentRect.left;
1427
- }
1428
- if (!isNaN(rect.top)) {
1429
- rect.top = rect.top - transformedParentRect.top;
1430
- }
1431
- if (!isNaN(rect.bottom)) {
1432
- rect.bottom = rect.bottom
1433
- ? rect.bottom - transformedParentRect.bottom
1434
- : rect.bottom;
1435
- }
1436
- return rect;
1437
- }
1438
- static setElementPosition(element, rect) {
1439
- element.style.left = rect.left != null ? `${rect.left}px` : '';
1440
- element.style.right = rect.right != null ? `${rect.right}px` : '';
1441
- element.style.top = rect.top != null ? `${rect.top}px` : '';
1442
- element.style.bottom = rect.bottom != null ? `${rect.bottom}px` : '';
1443
- element.style.maxHeight =
1444
- rect.maxHeight != null ? `${rect.maxHeight}px` : '';
1445
- element.style.minWidth = rect.minWidth != null ? `${rect.minWidth}px` : '';
1446
- }
1447
- static getMaxHeight(position) {
1448
- let maxHeight = null;
1449
- maxHeight = 1;
1450
- return maxHeight;
1227
+ renderer.appendChild(container, content);
1228
+ renderer.appendChild(this.container, container);
1229
+ this.setPosition(this._head.nativeElement, this._body);
1451
1230
  }
1452
- static getMaxWidth(position) {
1453
- let maxWidth = null;
1454
- maxWidth = 1;
1455
- return maxWidth;
1231
+ setPosition(container, target) {
1232
+ const containerPosition = container.getBoundingClientRect();
1233
+ // target.style.maxHeight = null;
1234
+ const targetPosition = target.getBoundingClientRect();
1235
+ const rect = {
1236
+ bottom: containerPosition.bottom,
1237
+ top: containerPosition.top,
1238
+ left: containerPosition.left,
1239
+ right: containerPosition.right,
1240
+ };
1241
+ const targetRect = {
1242
+ bottom: targetPosition.bottom,
1243
+ top: targetPosition.top,
1244
+ left: targetPosition.left,
1245
+ right: targetPosition.right,
1246
+ };
1247
+ const targetTransformedParent = DomUtil.findTransformedParent(target);
1248
+ let parentPosition = {
1249
+ left: 0,
1250
+ right: 0,
1251
+ top: 0,
1252
+ bottom: 0,
1253
+ };
1254
+ if (targetTransformedParent) {
1255
+ parentPosition = targetTransformedParent.getBoundingClientRect();
1256
+ }
1257
+ const position = PositionUtil.getPosition(rect, targetRect, this.align, this.verticalAlign, 0, 0, parentPosition);
1258
+ PositionUtil.setElementPosition(target, position);
1456
1259
  }
1260
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownBase, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
1261
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: DropdownBase, inputs: { align: "align", verticalAlign: "verticalAlign", appendToBody: "appendToBody", disabled: "disabled", backdrop: "backdrop", className: "className", viewType: "viewType", open: "open", autoClose: "autoClose", autoCloseIgnore: "autoCloseIgnore" }, outputs: { openChange: "openChange" }, host: { listeners: { "click": "click($event)", "document:click": "documentClick($event)", "window:keyup": "keyUp($event)" } }, queries: [{ propertyName: "_head", first: true, predicate: DropdownHeadDirective, descendants: true, read: ElementRef }, { propertyName: "_content", first: true, predicate: DropdownContentDirective, descendants: true }], ngImport: i0 });
1457
1262
  }
1263
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownBase, decorators: [{
1264
+ type: Directive
1265
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: undefined }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }]; }, propDecorators: { align: [{
1266
+ type: Input
1267
+ }], verticalAlign: [{
1268
+ type: Input
1269
+ }], appendToBody: [{
1270
+ type: Input
1271
+ }], disabled: [{
1272
+ type: Input
1273
+ }], backdrop: [{
1274
+ type: Input
1275
+ }], className: [{
1276
+ type: Input
1277
+ }], viewType: [{
1278
+ type: Input
1279
+ }], open: [{
1280
+ type: Input
1281
+ }], openChange: [{
1282
+ type: Output
1283
+ }], autoClose: [{
1284
+ type: Input
1285
+ }], autoCloseIgnore: [{
1286
+ type: Input
1287
+ }], _head: [{
1288
+ type: ContentChild,
1289
+ args: [DropdownHeadDirective, {
1290
+ static: false,
1291
+ read: ElementRef,
1292
+ }]
1293
+ }], _content: [{
1294
+ type: ContentChild,
1295
+ args: [DropdownContentDirective, { static: false }]
1296
+ }], click: [{
1297
+ type: HostListener,
1298
+ args: ['click', ['$event']]
1299
+ }], documentClick: [{
1300
+ type: HostListener,
1301
+ args: ['document:click', ['$event']]
1302
+ }], keyUp: [{
1303
+ type: HostListener,
1304
+ args: ['window:keyup', ['$event']]
1305
+ }] } });
1458
1306
 
1459
- class DropdownContentDirective {
1307
+ class DropdownComponent extends DropdownBase {
1308
+ _cdr;
1309
+ _document;
1460
1310
  _elementRef;
1461
- nativeElement;
1462
- constructor(_elementRef) {
1311
+ _zone;
1312
+ _renderer;
1313
+ constructor(_cdr, _document, _elementRef, _zone, _renderer) {
1314
+ super(_cdr, _document, _elementRef, _zone, _renderer);
1315
+ this._cdr = _cdr;
1316
+ this._document = _document;
1463
1317
  this._elementRef = _elementRef;
1464
- this.nativeElement = _elementRef.nativeElement;
1318
+ this._zone = _zone;
1319
+ this._renderer = _renderer;
1465
1320
  }
1466
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownContentDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
1467
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: DropdownContentDirective, selector: "[tetaDropdownContent]", ngImport: i0 });
1468
- }
1469
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownContentDirective, decorators: [{
1470
- type: Directive,
1471
- args: [{
1472
- selector: '[tetaDropdownContent]'
1473
- }]
1474
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
1475
-
1476
- class DropdownHeadDirective {
1477
- template;
1478
- constructor(template) {
1479
- this.template = template;
1321
+ ngOnInit() {
1480
1322
  }
1481
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownHeadDirective, deps: [{ token: i0.TemplateRef, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
1482
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: DropdownHeadDirective, selector: "[tetaDropdownHead]", ngImport: i0 });
1323
+ ngOnDestroy() {
1324
+ this.closeDropdown();
1325
+ this.removeScrollListener();
1326
+ this._alive = false;
1327
+ }
1328
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: DOCUMENT }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
1329
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DropdownComponent, selector: "teta-dropdown", exportAs: ["dropdown"], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"[tetaDropdownHead]\"></ng-content>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1483
1330
  }
1484
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownHeadDirective, decorators: [{
1485
- type: Directive,
1486
- args: [{
1487
- selector: '[tetaDropdownHead]'
1488
- }]
1489
- }], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
1490
- type: Optional
1491
- }] }]; } });
1331
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownComponent, decorators: [{
1332
+ type: Component,
1333
+ args: [{ selector: 'teta-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'dropdown', template: "<ng-content select=\"[tetaDropdownHead]\"></ng-content>\n" }]
1334
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
1335
+ type: Inject,
1336
+ args: [DOCUMENT]
1337
+ }] }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }]; } });
1492
1338
 
1493
- class DropdownBase {
1339
+ class DropdownDirective extends DropdownBase {
1494
1340
  _cdr;
1495
1341
  _document;
1496
1342
  _elementRef;
1497
1343
  _zone;
1498
1344
  _renderer;
1499
- align = Align.left;
1500
- verticalAlign = VerticalAlign.auto;
1501
- appendToBody;
1502
- disabled;
1503
- backdrop = false;
1504
- className;
1505
- viewType = 'rounded';
1506
- set open(val) {
1507
- if (val != null && val !== this._open && !this.disabled) {
1508
- if (val) {
1509
- this.openDropdown();
1510
- }
1511
- else {
1512
- this.closeDropdown();
1513
- }
1514
- }
1515
- }
1516
- get open() {
1517
- return this._open;
1518
- }
1519
- get container() {
1520
- return this.appendToBody
1521
- ? this._document.body
1522
- : this._elementRef.nativeElement;
1523
- }
1524
- openChange = new EventEmitter();
1525
- autoClose = true;
1526
- autoCloseIgnore = ['inside'];
1527
- _head;
1528
- _content;
1529
- _body = null;
1530
- _backdrop = null;
1531
- _open = false;
1532
- _alive = true;
1533
1345
  constructor(_cdr, _document, _elementRef, _zone, _renderer) {
1534
- this._cdr = _cdr;
1535
- this._document = _document;
1536
- this._elementRef = _elementRef;
1537
- this._zone = _zone;
1538
- this._renderer = _renderer;
1539
- this._zone.onStable
1540
- .pipe(takeWhile$1(_ => this._alive), throttleTime(10, undefined, { trailing: true }))
1541
- .subscribe(_ => {
1542
- if (this._head?.nativeElement && this._body) {
1543
- setTimeout(() => {
1544
- if (this._head?.nativeElement && this._body) {
1545
- this.setPosition(this._head.nativeElement, this._body);
1546
- }
1547
- });
1548
- }
1549
- });
1550
- this.addScrollListener();
1551
- }
1552
- click(event) {
1553
- if (this.open) {
1554
- if (!DomUtil.clickedInside(this._body, event) ||
1555
- this.autoCloseIgnore.indexOf('inside') < 0) {
1556
- this.closeDropdown();
1557
- }
1558
- }
1559
- else {
1560
- if (DomUtil.clickedInside(this._head.nativeElement, event)) {
1561
- this.openDropdown();
1562
- }
1563
- }
1564
- }
1565
- documentClick(event) {
1566
- if (!this.open ||
1567
- !this.autoClose ||
1568
- event.detail === 0 ||
1569
- DomUtil.clickedInside(this._head.nativeElement, event)) {
1570
- return;
1571
- }
1572
- if (DomUtil.clickedInside(this._body, event)) {
1573
- if (this.autoCloseIgnore.indexOf('inside') < 0) {
1574
- this.closeDropdown();
1575
- }
1576
- }
1577
- else {
1578
- if (this.autoCloseIgnore.indexOf('outside') < 0) {
1579
- this.closeDropdown();
1580
- }
1581
- }
1582
- }
1583
- keyUp(event) {
1584
- if (!this.open ||
1585
- !this.autoClose ||
1586
- ['esc', 'enter'].every((_) => this.autoCloseIgnore.indexOf(_) >= 0)) {
1587
- return;
1588
- }
1589
- if ((event.code === 'Escape' && this.autoCloseIgnore.indexOf('esc') < 0) ||
1590
- (event.code === 'Enter' && this.autoCloseIgnore.indexOf('enter') < 0)) {
1591
- this.closeDropdown();
1592
- }
1593
- }
1594
- addScrollListener() {
1595
- window.addEventListener('scroll', this.scrollListener, true);
1596
- }
1597
- removeScrollListener() {
1598
- window.removeEventListener('scroll', this.scrollListener, true);
1599
- }
1600
- scrollListener = event => {
1601
- if (this.open &&
1602
- !this._body.contains(event.target) &&
1603
- this._body !== event.target) {
1604
- this.closeDropdown();
1605
- }
1606
- };
1607
- closeDropdown() {
1608
- if (this.open && this._body && this.container.contains(this._body)) {
1609
- this._renderer.removeChild(this.container, this._body);
1610
- this._open = false;
1611
- this._body = null;
1612
- if (this._backdrop) {
1613
- this._renderer.removeChild(this._document.body, this._backdrop);
1614
- }
1615
- this.openChange.emit(this.open);
1616
- this._cdr.detectChanges();
1617
- }
1618
- }
1619
- openDropdown() {
1620
- if (this._open || !this._content || this.disabled) {
1621
- return;
1622
- }
1623
- this._open = true;
1624
- this.openChange.emit(this.open);
1625
- const renderer = this._renderer;
1626
- const content = this._content.nativeElement;
1627
- const container = (this._body =
1628
- this._body || renderer.createElement('div'));
1629
- renderer.addClass(container, 'dropdown');
1630
- renderer.addClass(container, 'dropdown_' + this.viewType);
1631
- if (this.backdrop) {
1632
- this._backdrop = renderer.createElement('div');
1633
- renderer.addClass(this._backdrop, 'dropdown-backdrop');
1634
- renderer.appendChild(this._document.body, this._backdrop);
1635
- }
1636
- if (this.className != null) {
1637
- if (this.className instanceof Array && this.className.length > 0) {
1638
- this.className.forEach(_ => {
1639
- renderer.addClass(container, _);
1640
- });
1641
- }
1642
- if (typeof this.className === 'string') {
1643
- renderer.addClass(container, this.className);
1644
- }
1645
- }
1646
- renderer.appendChild(container, content);
1647
- renderer.appendChild(this.container, container);
1648
- this.setPosition(this._head.nativeElement, this._body);
1649
- }
1650
- setPosition(container, target) {
1651
- const containerPosition = container.getBoundingClientRect();
1652
- target.style.maxHeight = null;
1653
- const targetPosition = target.getBoundingClientRect();
1654
- const rect = {
1655
- bottom: containerPosition.bottom,
1656
- top: containerPosition.top,
1657
- left: containerPosition.left,
1658
- right: containerPosition.right,
1659
- };
1660
- const targetRect = {
1661
- bottom: targetPosition.bottom,
1662
- top: targetPosition.top,
1663
- left: targetPosition.left,
1664
- right: targetPosition.right,
1665
- };
1666
- const targetTransformedParent = DomUtil.findTransformedParent(target);
1667
- let parentPosition = {
1668
- left: 0,
1669
- right: 0,
1670
- top: 0,
1671
- bottom: 0,
1672
- };
1673
- if (targetTransformedParent) {
1674
- parentPosition = targetTransformedParent.getBoundingClientRect();
1675
- }
1676
- const position = PositionUtil.getPosition(rect, targetRect, this.align, this.verticalAlign, 0, 0, parentPosition);
1677
- PositionUtil.setElementPosition(target, position);
1678
- }
1679
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownBase, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
1680
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: DropdownBase, inputs: { align: "align", verticalAlign: "verticalAlign", appendToBody: "appendToBody", disabled: "disabled", backdrop: "backdrop", className: "className", viewType: "viewType", open: "open", autoClose: "autoClose", autoCloseIgnore: "autoCloseIgnore" }, outputs: { openChange: "openChange" }, host: { listeners: { "click": "click($event)", "document:click": "documentClick($event)", "window:keyup": "keyUp($event)" } }, queries: [{ propertyName: "_head", first: true, predicate: DropdownHeadDirective, descendants: true, read: ElementRef }, { propertyName: "_content", first: true, predicate: DropdownContentDirective, descendants: true }], ngImport: i0 });
1681
- }
1682
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownBase, decorators: [{
1683
- type: Directive
1684
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: undefined }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }]; }, propDecorators: { align: [{
1685
- type: Input
1686
- }], verticalAlign: [{
1687
- type: Input
1688
- }], appendToBody: [{
1689
- type: Input
1690
- }], disabled: [{
1691
- type: Input
1692
- }], backdrop: [{
1693
- type: Input
1694
- }], className: [{
1695
- type: Input
1696
- }], viewType: [{
1697
- type: Input
1698
- }], open: [{
1699
- type: Input
1700
- }], openChange: [{
1701
- type: Output
1702
- }], autoClose: [{
1703
- type: Input
1704
- }], autoCloseIgnore: [{
1705
- type: Input
1706
- }], _head: [{
1707
- type: ContentChild,
1708
- args: [DropdownHeadDirective, {
1709
- static: false,
1710
- read: ElementRef,
1711
- }]
1712
- }], _content: [{
1713
- type: ContentChild,
1714
- args: [DropdownContentDirective, { static: false }]
1715
- }], click: [{
1716
- type: HostListener,
1717
- args: ['click', ['$event']]
1718
- }], documentClick: [{
1719
- type: HostListener,
1720
- args: ['document:click', ['$event']]
1721
- }], keyUp: [{
1722
- type: HostListener,
1723
- args: ['window:keyup', ['$event']]
1724
- }] } });
1725
-
1726
- class DropdownComponent extends DropdownBase {
1727
- _cdr;
1728
- _document;
1729
- _elementRef;
1730
- _zone;
1731
- _renderer;
1732
- constructor(_cdr, _document, _elementRef, _zone, _renderer) {
1733
- super(_cdr, _document, _elementRef, _zone, _renderer);
1346
+ super(_cdr, _document, _elementRef, _zone, _renderer);
1734
1347
  this._cdr = _cdr;
1735
1348
  this._document = _document;
1736
1349
  this._elementRef = _elementRef;
@@ -1744,17 +1357,56 @@ class DropdownComponent extends DropdownBase {
1744
1357
  this.removeScrollListener();
1745
1358
  this._alive = false;
1746
1359
  }
1747
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: DOCUMENT }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
1748
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DropdownComponent, selector: "teta-dropdown", exportAs: ["dropdown"], usesInheritance: true, ngImport: i0, template: "<ng-content select=\"[tetaDropdownHead]\"></ng-content>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1360
+ ngAfterViewInit() {
1361
+ if (this._content) {
1362
+ this._renderer.removeChild(this._content.nativeElement.parentNode, this._content.nativeElement);
1363
+ }
1364
+ }
1365
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: DOCUMENT }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
1366
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: DropdownDirective, selector: "[tetaDropdown]", usesInheritance: true, ngImport: i0 });
1749
1367
  }
1750
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownComponent, decorators: [{
1751
- type: Component,
1752
- args: [{ selector: 'teta-dropdown', changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'dropdown', template: "<ng-content select=\"[tetaDropdownHead]\"></ng-content>\n" }]
1368
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownDirective, decorators: [{
1369
+ type: Directive,
1370
+ args: [{
1371
+ selector: '[tetaDropdown]'
1372
+ }]
1753
1373
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
1754
1374
  type: Inject,
1755
1375
  args: [DOCUMENT]
1756
1376
  }] }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }]; } });
1757
1377
 
1378
+ class DropdownModule {
1379
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1380
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: DropdownModule, declarations: [DropdownComponent,
1381
+ DropdownHeadDirective,
1382
+ DropdownContentDirective,
1383
+ DropdownDirective], imports: [CommonModule], exports: [DropdownComponent,
1384
+ DropdownHeadDirective,
1385
+ DropdownContentDirective,
1386
+ DropdownDirective] });
1387
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownModule, imports: [CommonModule] });
1388
+ }
1389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownModule, decorators: [{
1390
+ type: NgModule,
1391
+ args: [{
1392
+ declarations: [
1393
+ DropdownComponent,
1394
+ DropdownHeadDirective,
1395
+ DropdownContentDirective,
1396
+ DropdownDirective
1397
+ ],
1398
+ exports: [
1399
+ DropdownComponent,
1400
+ DropdownHeadDirective,
1401
+ DropdownContentDirective,
1402
+ DropdownDirective
1403
+ ],
1404
+ imports: [
1405
+ CommonModule
1406
+ ]
1407
+ }]
1408
+ }] });
1409
+
1758
1410
  class ArrayUtil {
1759
1411
  static asArray(value) {
1760
1412
  if (value === null || value === undefined) {
@@ -2081,7 +1733,7 @@ class DynamicContentBaseDirective {
2081
1733
  this._zone = _zone;
2082
1734
  this._cdr = _cdr;
2083
1735
  this._zone.onStable
2084
- .pipe(takeWhile$1(_ => this._alive), filter$1(_ => this._open))
1736
+ .pipe(takeWhile(_ => this._alive), filter(_ => this._open))
2085
1737
  .subscribe(_ => {
2086
1738
  this.setPosition();
2087
1739
  });
@@ -2274,273 +1926,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
2274
1926
  args: ['class.column']
2275
1927
  }] } });
2276
1928
 
2277
- const DATE_PICKER_CONTROL_VALUE_ACCESSOR = {
2278
- provide: NG_VALUE_ACCESSOR,
2279
- useExisting: forwardRef(() => DatePickerComponent),
2280
- multi: true,
2281
- };
2282
- class DatePickerComponent extends BasePicker {
2283
- _elementRef;
2284
- _cdr;
2285
- datePipe;
2286
- date = null;
2287
- locale = 'ru';
2288
- showTime = false;
2289
- minDate = null;
2290
- maxDate = null;
2291
- invalid = false;
2292
- disabled = false;
2293
- align = Align.left;
2294
- verticalAlign = VerticalAlign.auto;
2295
- viewType = 'rounded';
2296
- appendToBody;
2297
- backdrop;
2298
- allowNull = true;
2299
- firstDayOfWeek = 1;
2300
- disabledDates;
2301
- disabledPeriods;
2302
- disabledDays;
2303
- minYearDate;
2304
- maxYearDate;
2305
- input;
2306
- selectDate = new EventEmitter();
2307
- selectedDate = new ReplaySubject(1);
2308
- mask = '';
2309
- classDatepicker = true;
2310
- tabindex = 0;
2311
- constructor(_elementRef, _cdr, datePipe) {
2312
- super(_elementRef, _cdr, datePipe);
2313
- this._elementRef = _elementRef;
2314
- this._cdr = _cdr;
2315
- this.datePipe = datePipe;
2316
- }
2317
- ngOnInit() {
2318
- if (!this.date) {
2319
- this.setDate(this.allowNull ? null : new Date());
2320
- this.date = this.allowNull ? null : new Date();
2321
- }
2322
- else {
2323
- this.setDate(new Date(this.date));
2324
- }
2325
- this.prepareInput();
2326
- }
2327
- prepareInput() {
2328
- const str = this.date ? this.getLocaleString(this.date) : '';
2329
- let option;
2330
- const setMinMax = () => {
2331
- if (this.minDate) {
2332
- option.min = dayjs(new Date(this.minDate)).startOf('day');
2333
- }
2334
- if (this.maxDate) {
2335
- option.max = dayjs(new Date(this.maxDate)).endOf('day');
2336
- }
2337
- };
2338
- if (this.showTime) {
2339
- this.mask = 'dd.mm.yyyy, hh:mm';
2340
- option = {
2341
- dateMode: 'dd/mm/yyyy',
2342
- timeMode: 'HH:MM',
2343
- dateSeparator: '.',
2344
- };
2345
- setMinMax();
2346
- this.maskitoOptions = maskitoDateTimeOptionsGenerator(option);
2347
- }
2348
- else {
2349
- this.mask = 'dd.mm.yyyy';
2350
- option = {
2351
- mode: 'dd/mm/yyyy',
2352
- separator: '.',
2353
- };
2354
- setMinMax();
2355
- this.maskitoOptions = maskitoDateOptionsGenerator(option);
2356
- }
2357
- this.changePlaceholder(str);
2358
- }
2359
- onBlur() {
2360
- if (this.allowNull && this.inputText.trim() === '') {
2361
- this.setDate(null);
2362
- this.emitValue(null);
2363
- }
2364
- else {
2365
- const val = this.inputText.split(',');
2366
- const { day, year, month } = this.getDateFromStr(val[0]);
2367
- const { mins, hours } = this.getTimeFromStr(val[1]);
2368
- if (day && year && month) {
2369
- let date = new Date(year, month - 1, day);
2370
- if (this.showTime) {
2371
- date = new Date(date.setHours(hours || 0, mins || 0));
2372
- }
2373
- this.changeSelectedDate(this.getAvailableDate(this.minDate, this.maxDate, date));
2374
- }
2375
- else {
2376
- this.setDate(this.date);
2377
- }
2378
- }
2379
- }
2380
- setDate(date) {
2381
- if (!date && this.allowNull) {
2382
- this.inputText = '';
2383
- this.changePlaceholder('');
2384
- this.selectedDate.next(new Date(this.minDate || new Date()));
2385
- }
2386
- else {
2387
- this.inputText = this.getLocaleString(date);
2388
- this.changePlaceholder(this.getLocaleString(date));
2389
- this.selectedDate.next(date);
2390
- }
2391
- }
2392
- onChange(date) {
2393
- }
2394
- registerOnChange(fn) {
2395
- this.onChange = fn;
2396
- }
2397
- registerOnTouched(fn) {
2398
- }
2399
- writeValue(obj) {
2400
- if (obj) {
2401
- this.date = new Date(obj);
2402
- this.setDate(new Date(this.date));
2403
- }
2404
- else {
2405
- if (this.allowNull) {
2406
- this.date = null;
2407
- this.selectedDate.next(null);
2408
- }
2409
- else {
2410
- this.date = this.minDate || new Date();
2411
- this.selectedDate.next(this.minDate || new Date());
2412
- }
2413
- }
2414
- }
2415
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DatePickerComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.DatePipe }], target: i0.ɵɵFactoryTarget.Component });
2416
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DatePickerComponent, selector: "teta-date-picker", inputs: { date: "date", locale: "locale", showTime: "showTime", minDate: "minDate", maxDate: "maxDate", invalid: "invalid", disabled: "disabled", align: "align", verticalAlign: "verticalAlign", viewType: "viewType", appendToBody: "appendToBody", backdrop: "backdrop", allowNull: "allowNull", firstDayOfWeek: "firstDayOfWeek", disabledDates: "disabledDates", disabledPeriods: "disabledPeriods", disabledDays: "disabledDays", minYearDate: "minYearDate", maxYearDate: "maxYearDate" }, outputs: { selectDate: "selectDate" }, host: { properties: { "class.datepicker": "this.classDatepicker", "tabindex": "this.tabindex" } }, providers: [DATE_PICKER_CONTROL_VALUE_ACCESSOR, DatePipe], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<teta-dropdown *ngIf=\"{selectedDate:selectedDate|async}as data\"\n class=\"row row_auto\"\n [appendToBody]=\"appendToBody\"\n [backdrop]=\"backdrop\"\n [open]=\"open\"\n (openChange)=\"openChange($event)\"\n [viewType]=\"viewType\"\n [disabled]=\"disabled\"\n [verticalAlign]=\"verticalAlign\"\n [align]=\"align\"\n [autoCloseIgnore]=\"['esc', 'inside','enter']\">\n <div tetaDropdownHead\n [class]=\"'datepicker-head font-body-3 gap-8 datepicker_'+viewType\"\n [ngClass]=\"{'datepicker-head_invalid':invalid,'datepicker-head_disabled':disabled}\">\n <teta-input class=\"row row_auto flex\">\n <div [class]=\"'row_auto row datepicker_'+viewType\">\n <div class=\"row row_auto position-relative font-body-3 align-center\">\n <input [ngClass]=\"{'color-text-90':!disabled}\"\n [disabled]=\"disabled\" #input style=\"z-index: 1\"\n class=\"row_auto border-0\"\n (keydown)=\"checkEnter($event)\"\n [(ngModel)]=\"inputText\"\n (ngModelChange)=\"changeInput($event)\"\n [maskito]=\"maskitoOptions\">\n <div (click)=\"input.focus()\" *ngIf=\"data.selectedDate||allowNull\" class=\"position-absolute color-text-10\"\n style=\"top:-0.3px;cursor: text;user-select: none\">{{placeholder}}</div>\n </div>\n <teta-icon [name]=\"'calendar'\" [palette]=\"'text'\"></teta-icon>\n </div>\n </teta-input>\n </div>\n <div tetaDropdownContent class=\"scrollable\" (click)=\"$event.preventDefault()\">\n <ng-container *ngIf=\"open\">\n <teta-date-calendar [isDateNull]=\"date===null\" [open]=\"open\" [max]=\"maxDate\" [min]=\"minDate\"\n (setDate)=\"changeSelectedDate($event)\"\n [selectedDate]=\"data.selectedDate\"\n [viewType]=\"viewType\" [locale]=\"locale\"></teta-date-calendar>\n </ng-container>\n\n </div>\n</teta-dropdown>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DropdownComponent, selector: "teta-dropdown", exportAs: ["dropdown"] }, { kind: "directive", type: DropdownHeadDirective, selector: "[tetaDropdownHead]" }, { kind: "directive", type: DropdownContentDirective, selector: "[tetaDropdownContent]" }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6.MaskitoDirective, selector: "[maskito]", inputs: ["maskito", "maskitoElement"] }, { kind: "directive", type: i6.MaskitoCva, selector: "input[maskito], textarea[maskito]", inputs: ["maskito"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "component", type: InputComponent, selector: "teta-input", inputs: ["label", "hint", "viewType", "horizontal", "required"] }, { kind: "component", type: DateCalendarComponent, selector: "teta-date-calendar", inputs: ["selectedDate", "locale", "open", "viewType", "min", "isDateNull", "max"], outputs: ["setDate"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2417
- }
2418
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DatePickerComponent, decorators: [{
2419
- type: Component,
2420
- args: [{ selector: 'teta-date-picker', changeDetection: ChangeDetectionStrategy.OnPush, providers: [DATE_PICKER_CONTROL_VALUE_ACCESSOR, DatePipe], template: "<teta-dropdown *ngIf=\"{selectedDate:selectedDate|async}as data\"\n class=\"row row_auto\"\n [appendToBody]=\"appendToBody\"\n [backdrop]=\"backdrop\"\n [open]=\"open\"\n (openChange)=\"openChange($event)\"\n [viewType]=\"viewType\"\n [disabled]=\"disabled\"\n [verticalAlign]=\"verticalAlign\"\n [align]=\"align\"\n [autoCloseIgnore]=\"['esc', 'inside','enter']\">\n <div tetaDropdownHead\n [class]=\"'datepicker-head font-body-3 gap-8 datepicker_'+viewType\"\n [ngClass]=\"{'datepicker-head_invalid':invalid,'datepicker-head_disabled':disabled}\">\n <teta-input class=\"row row_auto flex\">\n <div [class]=\"'row_auto row datepicker_'+viewType\">\n <div class=\"row row_auto position-relative font-body-3 align-center\">\n <input [ngClass]=\"{'color-text-90':!disabled}\"\n [disabled]=\"disabled\" #input style=\"z-index: 1\"\n class=\"row_auto border-0\"\n (keydown)=\"checkEnter($event)\"\n [(ngModel)]=\"inputText\"\n (ngModelChange)=\"changeInput($event)\"\n [maskito]=\"maskitoOptions\">\n <div (click)=\"input.focus()\" *ngIf=\"data.selectedDate||allowNull\" class=\"position-absolute color-text-10\"\n style=\"top:-0.3px;cursor: text;user-select: none\">{{placeholder}}</div>\n </div>\n <teta-icon [name]=\"'calendar'\" [palette]=\"'text'\"></teta-icon>\n </div>\n </teta-input>\n </div>\n <div tetaDropdownContent class=\"scrollable\" (click)=\"$event.preventDefault()\">\n <ng-container *ngIf=\"open\">\n <teta-date-calendar [isDateNull]=\"date===null\" [open]=\"open\" [max]=\"maxDate\" [min]=\"minDate\"\n (setDate)=\"changeSelectedDate($event)\"\n [selectedDate]=\"data.selectedDate\"\n [viewType]=\"viewType\" [locale]=\"locale\"></teta-date-calendar>\n </ng-container>\n\n </div>\n</teta-dropdown>\n" }]
2421
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.DatePipe }]; }, propDecorators: { date: [{
2422
- type: Input
2423
- }], locale: [{
2424
- type: Input
2425
- }], showTime: [{
2426
- type: Input
2427
- }], minDate: [{
2428
- type: Input
2429
- }], maxDate: [{
2430
- type: Input
2431
- }], invalid: [{
2432
- type: Input
2433
- }], disabled: [{
2434
- type: Input
2435
- }], align: [{
2436
- type: Input
2437
- }], verticalAlign: [{
2438
- type: Input
2439
- }], viewType: [{
2440
- type: Input
2441
- }], appendToBody: [{
2442
- type: Input
2443
- }], backdrop: [{
2444
- type: Input
2445
- }], allowNull: [{
2446
- type: Input
2447
- }], firstDayOfWeek: [{
2448
- type: Input
2449
- }], disabledDates: [{
2450
- type: Input
2451
- }], disabledPeriods: [{
2452
- type: Input
2453
- }], disabledDays: [{
2454
- type: Input
2455
- }], minYearDate: [{
2456
- type: Input
2457
- }], maxYearDate: [{
2458
- type: Input
2459
- }], input: [{
2460
- type: ViewChild,
2461
- args: ['input']
2462
- }], selectDate: [{
2463
- type: Output
2464
- }], classDatepicker: [{
2465
- type: HostBinding,
2466
- args: ['class.datepicker']
2467
- }], tabindex: [{
2468
- type: HostBinding,
2469
- args: ['tabindex']
2470
- }] } });
2471
-
2472
- class DropdownDirective extends DropdownBase {
2473
- _cdr;
2474
- _document;
2475
- _elementRef;
2476
- _zone;
2477
- _renderer;
2478
- constructor(_cdr, _document, _elementRef, _zone, _renderer) {
2479
- super(_cdr, _document, _elementRef, _zone, _renderer);
2480
- this._cdr = _cdr;
2481
- this._document = _document;
2482
- this._elementRef = _elementRef;
2483
- this._zone = _zone;
2484
- this._renderer = _renderer;
2485
- }
2486
- ngOnInit() {
2487
- }
2488
- ngOnDestroy() {
2489
- this.closeDropdown();
2490
- this.removeScrollListener();
2491
- this._alive = false;
2492
- }
2493
- ngAfterViewInit() {
2494
- if (this._content) {
2495
- this._renderer.removeChild(this._content.nativeElement.parentNode, this._content.nativeElement);
2496
- }
2497
- }
2498
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: DOCUMENT }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
2499
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: DropdownDirective, selector: "[tetaDropdown]", usesInheritance: true, ngImport: i0 });
2500
- }
2501
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownDirective, decorators: [{
2502
- type: Directive,
2503
- args: [{
2504
- selector: '[tetaDropdown]'
2505
- }]
2506
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
2507
- type: Inject,
2508
- args: [DOCUMENT]
2509
- }] }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }]; } });
2510
-
2511
- class DropdownModule {
2512
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2513
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: DropdownModule, declarations: [DropdownComponent,
2514
- DropdownHeadDirective,
2515
- DropdownContentDirective,
2516
- DropdownDirective], imports: [CommonModule], exports: [DropdownComponent,
2517
- DropdownHeadDirective,
2518
- DropdownContentDirective,
2519
- DropdownDirective] });
2520
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownModule, imports: [CommonModule] });
2521
- }
2522
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DropdownModule, decorators: [{
2523
- type: NgModule,
2524
- args: [{
2525
- declarations: [
2526
- DropdownComponent,
2527
- DropdownHeadDirective,
2528
- DropdownContentDirective,
2529
- DropdownDirective
2530
- ],
2531
- exports: [
2532
- DropdownComponent,
2533
- DropdownHeadDirective,
2534
- DropdownContentDirective,
2535
- DropdownDirective
2536
- ],
2537
- imports: [
2538
- CommonModule
2539
- ]
2540
- }]
2541
- }] });
2542
-
2543
- class OnlyNumberDirective {
1929
+ class OnlyNumberDirective {
2544
1930
  _elementRef;
2545
1931
  _control;
2546
1932
  tetaOnlyNumber = true;
@@ -2696,429 +2082,1099 @@ class OnlyNumberDirective {
2696
2082
  if (value === null || value === undefined || value === '') {
2697
2083
  return;
2698
2084
  }
2699
- const valid = new RegExp(regex).test(value.toString());
2700
- if (valid) {
2701
- this._control.control.patchValue(parseFloat(value));
2085
+ const valid = new RegExp(regex).test(value.toString());
2086
+ if (valid) {
2087
+ this._control.control.patchValue(parseFloat(value));
2088
+ }
2089
+ }
2090
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberDirective, deps: [{ token: i0.ElementRef }, { token: i3.NgControl }], target: i0.ɵɵFactoryTarget.Directive });
2091
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: OnlyNumberDirective, selector: "[tetaOnlyNumber]", inputs: { tetaOnlyNumber: "tetaOnlyNumber", allowDecimals: "allowDecimals", allowSign: "allowSign", decimalSeparator: "decimalSeparator", commaSeparator: "commaSeparator" }, host: { listeners: { "change": "onChange($event)", "dblclick": "dblclick($event)", "paste": "onPaste($event)", "keydown": "onKeyDown($event)" } }, ngImport: i0 });
2092
+ }
2093
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberDirective, decorators: [{
2094
+ type: Directive,
2095
+ args: [{
2096
+ selector: '[tetaOnlyNumber]',
2097
+ }]
2098
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i3.NgControl }]; }, propDecorators: { tetaOnlyNumber: [{
2099
+ type: Input
2100
+ }], allowDecimals: [{
2101
+ type: Input
2102
+ }], allowSign: [{
2103
+ type: Input
2104
+ }], decimalSeparator: [{
2105
+ type: Input
2106
+ }], commaSeparator: [{
2107
+ type: Input
2108
+ }], onChange: [{
2109
+ type: HostListener,
2110
+ args: ['change', ['$event']]
2111
+ }], dblclick: [{
2112
+ type: HostListener,
2113
+ args: ['dblclick', ['$event']]
2114
+ }], onPaste: [{
2115
+ type: HostListener,
2116
+ args: ['paste', ['$event']]
2117
+ }], onKeyDown: [{
2118
+ type: HostListener,
2119
+ args: ['keydown', ['$event']]
2120
+ }] } });
2121
+
2122
+ const getPrecision = (a) => {
2123
+ if (!isFinite(a)) {
2124
+ return 0;
2125
+ }
2126
+ let e = 1;
2127
+ let p = 0;
2128
+ while (Math.round(a * e) / e !== a) {
2129
+ e *= 10;
2130
+ p++;
2131
+ }
2132
+ return p;
2133
+ };
2134
+ const formatNumber = (value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength) => {
2135
+ const abs = Math.abs(value);
2136
+ if (0 < abs && 1 > abs) {
2137
+ const firstDigitIndex = Math.floor(Math.abs(Math.log10(abs)));
2138
+ decimalLength += firstDigitIndex;
2139
+ }
2140
+ const precision = Math.min(getPrecision(value), Math.floor(decimalLength));
2141
+ const result = '\\d(?=(\\d{' + chunkLength + '})+' + (precision > 0 ? '\\D' : '$') + ')';
2142
+ const num = value.toFixed(precision);
2143
+ return (decimalDelimiter ? num.replace('.', decimalDelimiter) : num).replace(new RegExp(result, 'g'), '$&' + chunkDelimiter);
2144
+ };
2145
+ const prependZero = (input, length) => ('0'.repeat(length) + input).slice(-length);
2146
+
2147
+ class NumberPipe {
2148
+ transform(value, decimalLength = 2, chunkDelimiter = '', decimalDelimiter = '.', chunkLength = 3) {
2149
+ if (value === null || value === undefined || value === '') {
2150
+ return '';
2151
+ }
2152
+ if (typeof value === 'string' && isNaN(parseFloat(value))) {
2153
+ return value.toString();
2154
+ }
2155
+ if (decimalLength === null) {
2156
+ return value.toString();
2157
+ }
2158
+ value = Number(value);
2159
+ return formatNumber(value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength);
2160
+ }
2161
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2162
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: NumberPipe, name: "tetaNumber" });
2163
+ }
2164
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberPipe, decorators: [{
2165
+ type: Pipe,
2166
+ args: [{
2167
+ name: 'tetaNumber'
2168
+ }]
2169
+ }] });
2170
+
2171
+ class TextFieldComponent {
2172
+ _cdr;
2173
+ placeholder = '';
2174
+ leftIconName;
2175
+ disabled = false;
2176
+ onlyNumber = false;
2177
+ decimalPart;
2178
+ invalid;
2179
+ input;
2180
+ inputFocused;
2181
+ textField = true;
2182
+ value = '';
2183
+ constructor(_cdr) {
2184
+ this._cdr = _cdr;
2185
+ }
2186
+ onFocus() {
2187
+ if (this.disabled) {
2188
+ return;
2189
+ }
2190
+ this.input.nativeElement.focus();
2191
+ }
2192
+ keyPress(event) {
2193
+ if (event.key === 'Enter' || event.keyCode === 13) {
2194
+ this.emitBlur();
2195
+ }
2196
+ }
2197
+ emitBlur() {
2198
+ this.onTouched();
2199
+ }
2200
+ registerOnChange(fn) {
2201
+ this.onChange = fn;
2202
+ }
2203
+ registerOnTouched(fn) {
2204
+ this.onTouched = fn;
2205
+ }
2206
+ setDisabledState(isDisabled) {
2207
+ this.disabled = isDisabled;
2208
+ this._cdr.markForCheck();
2209
+ }
2210
+ writeValue(input) {
2211
+ this.value = input;
2212
+ this._cdr.detectChanges();
2213
+ }
2214
+ onChange(input) { }
2215
+ onTouched() { }
2216
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TextFieldComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2217
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: TextFieldComponent, selector: "teta-text-field", inputs: { placeholder: "placeholder", leftIconName: "leftIconName", disabled: "disabled", onlyNumber: "onlyNumber", decimalPart: "decimalPart", invalid: "invalid" }, host: { listeners: { "click": "onFocus()" }, properties: { "class.text-field_disabled": "this.disabled", "class.text-field_invalid": "this.invalid", "class.text-field": "this.textField" } }, providers: [
2218
+ {
2219
+ provide: NG_VALUE_ACCESSOR,
2220
+ useExisting: forwardRef(() => TextFieldComponent),
2221
+ multi: true,
2222
+ },
2223
+ ], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<teta-icon *ngIf='leftIconName' [name]='leftIconName' [palette]=\"'text'\"></teta-icon>\n<input\n #input\n [ngModel]='value | tetaNumber : !onlyNumber ? null : inputFocused ? 1000 : decimalPart'\n [tetaOnlyNumber]='onlyNumber'\n (ngModelChange)='value = $event; onChange($event);'\n [placeholder]='placeholder'\n [disabled]='disabled'\n [ngClass]=\"{'color-text-40':disabled}\"\n (focus)='inputFocused = true'\n (blur)='inputFocused = false;emitBlur()'\n (keydown)='keyPress($event)'\n type='text'\n/>\n<teta-icon\n *ngIf='value && !disabled'\n class='close-icon'\n [name]=\"'closeCircle'\"\n [palette]=\"'text'\"\n (click)=\"value = ''; onChange('');\"\n></teta-icon>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: OnlyNumberDirective, selector: "[tetaOnlyNumber]", inputs: ["tetaOnlyNumber", "allowDecimals", "allowSign", "decimalSeparator", "commaSeparator"] }, { kind: "pipe", type: NumberPipe, name: "tetaNumber" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2224
+ }
2225
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TextFieldComponent, decorators: [{
2226
+ type: Component,
2227
+ args: [{ selector: 'teta-text-field', providers: [
2228
+ {
2229
+ provide: NG_VALUE_ACCESSOR,
2230
+ useExisting: forwardRef(() => TextFieldComponent),
2231
+ multi: true,
2232
+ },
2233
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<teta-icon *ngIf='leftIconName' [name]='leftIconName' [palette]=\"'text'\"></teta-icon>\n<input\n #input\n [ngModel]='value | tetaNumber : !onlyNumber ? null : inputFocused ? 1000 : decimalPart'\n [tetaOnlyNumber]='onlyNumber'\n (ngModelChange)='value = $event; onChange($event);'\n [placeholder]='placeholder'\n [disabled]='disabled'\n [ngClass]=\"{'color-text-40':disabled}\"\n (focus)='inputFocused = true'\n (blur)='inputFocused = false;emitBlur()'\n (keydown)='keyPress($event)'\n type='text'\n/>\n<teta-icon\n *ngIf='value && !disabled'\n class='close-icon'\n [name]=\"'closeCircle'\"\n [palette]=\"'text'\"\n (click)=\"value = ''; onChange('');\"\n></teta-icon>\n" }]
2234
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { placeholder: [{
2235
+ type: Input
2236
+ }], leftIconName: [{
2237
+ type: Input
2238
+ }], disabled: [{
2239
+ type: HostBinding,
2240
+ args: ['class.text-field_disabled']
2241
+ }, {
2242
+ type: Input
2243
+ }], onlyNumber: [{
2244
+ type: Input
2245
+ }], decimalPart: [{
2246
+ type: Input
2247
+ }], invalid: [{
2248
+ type: HostBinding,
2249
+ args: ['class.text-field_invalid']
2250
+ }, {
2251
+ type: Input
2252
+ }], input: [{
2253
+ type: ViewChild,
2254
+ args: ['input', { static: false }]
2255
+ }], textField: [{
2256
+ type: HostBinding,
2257
+ args: ['class.text-field']
2258
+ }], onFocus: [{
2259
+ type: HostListener,
2260
+ args: ['click']
2261
+ }] } });
2262
+
2263
+ class OnlyNumberModule {
2264
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2265
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberModule, declarations: [OnlyNumberDirective], imports: [CommonModule], exports: [OnlyNumberDirective] });
2266
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberModule, imports: [CommonModule] });
2267
+ }
2268
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberModule, decorators: [{
2269
+ type: NgModule,
2270
+ args: [{
2271
+ declarations: [OnlyNumberDirective],
2272
+ exports: [OnlyNumberDirective],
2273
+ imports: [CommonModule],
2274
+ }]
2275
+ }] });
2276
+
2277
+ class FormGroupTitleComponent {
2278
+ className = true;
2279
+ constructor() { }
2280
+ ngOnInit() { }
2281
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: FormGroupTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2282
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: FormGroupTitleComponent, selector: "teta-form-group-title", host: { properties: { "class.form-group-title": "this.className" } }, ngImport: i0, template: "<div class=\"font-overline form-group-title-text\">\n <ng-content></ng-content>\n</div>\n<div class=\"form-group-title-line\"></div>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2283
+ }
2284
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: FormGroupTitleComponent, decorators: [{
2285
+ type: Component,
2286
+ args: [{ selector: 'teta-form-group-title', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"font-overline form-group-title-text\">\n <ng-content></ng-content>\n</div>\n<div class=\"form-group-title-line\"></div>\n" }]
2287
+ }], ctorParameters: function () { return []; }, propDecorators: { className: [{
2288
+ type: HostBinding,
2289
+ args: ['class.form-group-title']
2290
+ }] } });
2291
+
2292
+ class DynamicComponentModule {
2293
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DynamicComponentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2294
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: DynamicComponentModule, declarations: [PopupContentComponent], imports: [CommonModule], exports: [PopupContentComponent] });
2295
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DynamicComponentModule, imports: [CommonModule] });
2296
+ }
2297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DynamicComponentModule, decorators: [{
2298
+ type: NgModule,
2299
+ args: [{
2300
+ declarations: [PopupContentComponent],
2301
+ exports: [PopupContentComponent],
2302
+ imports: [
2303
+ CommonModule
2304
+ ]
2305
+ }]
2306
+ }] });
2307
+
2308
+ class HintModule {
2309
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: HintModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2310
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: HintModule, declarations: [HintDirective], imports: [CommonModule,
2311
+ DynamicComponentModule], exports: [HintDirective] });
2312
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: HintModule, imports: [CommonModule,
2313
+ DynamicComponentModule] });
2314
+ }
2315
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: HintModule, decorators: [{
2316
+ type: NgModule,
2317
+ args: [{
2318
+ declarations: [HintDirective],
2319
+ exports: [HintDirective],
2320
+ imports: [
2321
+ CommonModule,
2322
+ DynamicComponentModule
2323
+ ]
2324
+ }]
2325
+ }] });
2326
+
2327
+ class ColorInputComponent {
2328
+ _cdr;
2329
+ disabled = false;
2330
+ input;
2331
+ value = '';
2332
+ constructor(_cdr) {
2333
+ this._cdr = _cdr;
2334
+ }
2335
+ onFocus() {
2336
+ if (this.disabled) {
2337
+ return;
2338
+ }
2339
+ this.input.nativeElement.focus();
2340
+ }
2341
+ emitBlur() {
2342
+ this.onTouched();
2343
+ }
2344
+ registerOnChange(fn) {
2345
+ this.onChange = fn;
2346
+ }
2347
+ registerOnTouched(fn) {
2348
+ this.onTouched = fn;
2349
+ }
2350
+ setDisabledState(isDisabled) {
2351
+ this.disabled = isDisabled;
2352
+ this._cdr.markForCheck();
2353
+ }
2354
+ writeValue(input) {
2355
+ this.value = input;
2356
+ this._cdr.detectChanges();
2357
+ }
2358
+ onChange(input) { }
2359
+ onTouched() { }
2360
+ getHexColor(color) {
2361
+ if (color && color.startsWith('rgb')) {
2362
+ const value = color.substring(color.indexOf('(') + 1, color.lastIndexOf(')'));
2363
+ const colorArray = value.split(',');
2364
+ color = `#${('00' + parseInt(colorArray[0], 10).toString(16)).slice(-2)}${('00' + parseInt(colorArray[1], 10).toString(16)).slice(-2)}${('00' + parseInt(colorArray[2], 10).toString(16)).slice(-2)}`;
2365
+ }
2366
+ return color;
2367
+ }
2368
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ColorInputComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2369
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: ColorInputComponent, selector: "teta-color-input", inputs: { disabled: "disabled" }, host: { listeners: { "click": "onFocus()" } }, providers: [
2370
+ {
2371
+ provide: NG_VALUE_ACCESSOR,
2372
+ useExisting: forwardRef(() => ColorInputComponent),
2373
+ multi: true,
2374
+ },
2375
+ ], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<input type='color'\n #input\n [disabled]='disabled'\n (blur)='emitBlur();'\n [ngModel]=\"getHexColor(value)\"\n (ngModelChange)=\"value = $event;onChange($event)\"\n [ngModelOptions]='{updateOn: \"blur\"}'/>\n", styles: [":host{display:inline-flex;align-items:center}input[type=color]{height:12px;width:12px;padding:0;border:0}input[type=color]::-webkit-color-swatch,input[type=color]::-webkit-color-swatch-wrapper{border:0;padding:0}\n"], dependencies: [{ kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2376
+ }
2377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ColorInputComponent, decorators: [{
2378
+ type: Component,
2379
+ args: [{ selector: 'teta-color-input', providers: [
2380
+ {
2381
+ provide: NG_VALUE_ACCESSOR,
2382
+ useExisting: forwardRef(() => ColorInputComponent),
2383
+ multi: true,
2384
+ },
2385
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<input type='color'\n #input\n [disabled]='disabled'\n (blur)='emitBlur();'\n [ngModel]=\"getHexColor(value)\"\n (ngModelChange)=\"value = $event;onChange($event)\"\n [ngModelOptions]='{updateOn: \"blur\"}'/>\n", styles: [":host{display:inline-flex;align-items:center}input[type=color]{height:12px;width:12px;padding:0;border:0}input[type=color]::-webkit-color-swatch,input[type=color]::-webkit-color-swatch-wrapper{border:0;padding:0}\n"] }]
2386
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { disabled: [{
2387
+ type: Input
2388
+ }], input: [{
2389
+ type: ViewChild,
2390
+ args: ['input', { static: false }]
2391
+ }], onFocus: [{
2392
+ type: HostListener,
2393
+ args: ['click']
2394
+ }] } });
2395
+
2396
+ class NumberPipeModule {
2397
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2398
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: NumberPipeModule, declarations: [NumberPipe], imports: [CommonModule], exports: [NumberPipe] });
2399
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberPipeModule, imports: [CommonModule] });
2400
+ }
2401
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberPipeModule, decorators: [{
2402
+ type: NgModule,
2403
+ args: [{
2404
+ declarations: [NumberPipe],
2405
+ exports: [
2406
+ NumberPipe
2407
+ ],
2408
+ imports: [
2409
+ CommonModule
2410
+ ]
2411
+ }]
2412
+ }] });
2413
+
2414
+ class InputModule {
2415
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: InputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2416
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: InputModule, declarations: [InputComponent, TextFieldComponent, FormGroupTitleComponent, ColorInputComponent], imports: [CommonModule, IconModule, FormsModule, OnlyNumberModule, HintModule, NumberPipeModule], exports: [InputComponent, TextFieldComponent, FormGroupTitleComponent, ColorInputComponent] });
2417
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: InputModule, imports: [CommonModule, IconModule, FormsModule, OnlyNumberModule, HintModule, NumberPipeModule] });
2418
+ }
2419
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: InputModule, decorators: [{
2420
+ type: NgModule,
2421
+ args: [{
2422
+ declarations: [InputComponent, TextFieldComponent, FormGroupTitleComponent, ColorInputComponent],
2423
+ exports: [InputComponent, TextFieldComponent, FormGroupTitleComponent, ColorInputComponent],
2424
+ imports: [CommonModule, IconModule, FormsModule, OnlyNumberModule, HintModule, NumberPipeModule],
2425
+ }]
2426
+ }] });
2427
+
2428
+ class DayModel {
2429
+ disabled;
2430
+ isCurrentMonth;
2431
+ today;
2432
+ selected;
2433
+ date;
2434
+ weekend;
2435
+ constructor(options) {
2436
+ if (options) {
2437
+ this.disabled = options.disabled;
2438
+ this.isCurrentMonth = options.isCurrentMonth;
2439
+ this.today = options.today;
2440
+ this.selected = options.selected;
2441
+ this.date = options.date;
2442
+ this.weekend = options.weekend;
2443
+ }
2444
+ }
2445
+ }
2446
+
2447
+ class BaseCalendar {
2448
+ _cdr;
2449
+ currentMonth = new ReplaySubject(1);
2450
+ minMax = new ReplaySubject(1);
2451
+ currentYear = new ReplaySubject(1);
2452
+ selectedPicker = new BehaviorSubject('day');
2453
+ localeMonths = new Map()
2454
+ .set('ru', [
2455
+ 'Январь',
2456
+ 'Февраль',
2457
+ 'Март',
2458
+ 'Апрель',
2459
+ 'Май',
2460
+ 'Июнь',
2461
+ 'Июль',
2462
+ 'Август',
2463
+ 'Сентябрь',
2464
+ 'Октябрь',
2465
+ 'Ноябрь',
2466
+ 'Декабрь',
2467
+ ])
2468
+ .set('en', [
2469
+ 'January',
2470
+ 'February',
2471
+ 'March',
2472
+ 'April',
2473
+ 'May',
2474
+ 'June',
2475
+ 'July',
2476
+ 'August',
2477
+ 'September',
2478
+ 'October',
2479
+ 'November',
2480
+ 'December',
2481
+ ]);
2482
+ alive = true;
2483
+ constructor(_cdr) {
2484
+ this._cdr = _cdr;
2485
+ }
2486
+ generateCalendar(selectedDate, year, month, minMax) {
2487
+ const calendarStartDay = selectedDate
2488
+ .set('year', year)
2489
+ .set('month', month)
2490
+ .set('date', 1)
2491
+ .startOf('week');
2492
+ const calendar = new Array(42).fill(1).map((v, i) => {
2493
+ return calendarStartDay.add(i, 'day');
2494
+ });
2495
+ return calendar.map(d => {
2496
+ return new DayModel({
2497
+ date: new Date(d.toDate()),
2498
+ isCurrentMonth: month === d.month(),
2499
+ disabled: !this.isSuitableMinDate(d.toDate(), minMax.min) ||
2500
+ !this.isSuitableMaxDate(d.toDate(), minMax.max),
2501
+ selected: this.isSelected(d.toDate(), selectedDate.toDate()),
2502
+ });
2503
+ });
2504
+ }
2505
+ isSuitableMinDate(d, minDate) {
2506
+ return (dayjs(new Date(minDate)).startOf('date').toDate() <= new Date(d) ||
2507
+ minDate === null);
2508
+ }
2509
+ isSuitableMaxDate(d, maxDate) {
2510
+ return (new Date(d) < dayjs(new Date(maxDate)).endOf('date').toDate() ||
2511
+ maxDate === null);
2512
+ }
2513
+ isSelected(date, selectedDate) {
2514
+ const isSelectedDate = date.getDate() === selectedDate?.getDate();
2515
+ const isSelectedYear = date.getFullYear() === selectedDate?.getFullYear();
2516
+ const isSelectedMonth = date.getMonth() === selectedDate?.getMonth();
2517
+ return (isSelectedDate && isSelectedMonth && isSelectedYear && !this.isDateNull);
2518
+ }
2519
+ ngOnDestroy() {
2520
+ this.alive = false;
2521
+ }
2522
+ selectPicker(entity) {
2523
+ this.selectedPicker.next(entity);
2524
+ }
2525
+ selectMonth(month) {
2526
+ this.currentMonth.next(month);
2527
+ this.selectPicker('day');
2528
+ }
2529
+ selectYear(year) {
2530
+ this.setYear(year);
2531
+ this.selectPicker('day');
2532
+ }
2533
+ ngOnChanges(changes) {
2534
+ this.changeCalendarData(this.selectedDate);
2535
+ }
2536
+ changeCalendarData(selectedDate) {
2537
+ const date = new Date(selectedDate || new Date());
2538
+ this.currentMonth.next(new Date(date).getMonth());
2539
+ this.currentYear.next(new Date(date).getFullYear());
2540
+ this.minMax.next({ min: this.min, max: this.max });
2541
+ }
2542
+ setYear(year) {
2543
+ this.currentYear.next(year);
2544
+ }
2545
+ changeMonth(month, year) {
2546
+ const { availableYear, availableMonth } = this.getAvailableMonthYear(month, year);
2547
+ this.currentMonth.next(availableMonth);
2548
+ this.currentYear.next(availableYear);
2549
+ }
2550
+ getAvailableMonthYear(month, year) {
2551
+ if (month > 11) {
2552
+ return { availableMonth: month - 12, availableYear: year + 1 };
2553
+ }
2554
+ if (month < 0) {
2555
+ return { availableMonth: 12 + month, availableYear: year - 1 };
2702
2556
  }
2557
+ return { availableMonth: month, availableYear: year };
2703
2558
  }
2704
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberDirective, deps: [{ token: i0.ElementRef }, { token: i3.NgControl }], target: i0.ɵɵFactoryTarget.Directive });
2705
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: OnlyNumberDirective, selector: "[tetaOnlyNumber]", inputs: { tetaOnlyNumber: "tetaOnlyNumber", allowDecimals: "allowDecimals", allowSign: "allowSign", decimalSeparator: "decimalSeparator", commaSeparator: "commaSeparator" }, host: { listeners: { "change": "onChange($event)", "dblclick": "dblclick($event)", "paste": "onPaste($event)", "keydown": "onKeyDown($event)" } }, ngImport: i0 });
2559
+ getMothName(month) {
2560
+ return this.localeMonths.get(this.locale)[month];
2561
+ }
2562
+ selectDate(date) {
2563
+ this.setDate.emit(date);
2564
+ }
2565
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseCalendar, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2566
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: BaseCalendar, selector: "ng-component", usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2706
2567
  }
2707
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberDirective, decorators: [{
2708
- type: Directive,
2568
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseCalendar, decorators: [{
2569
+ type: Component,
2709
2570
  args: [{
2710
- selector: '[tetaOnlyNumber]',
2571
+ template: '',
2572
+ changeDetection: ChangeDetectionStrategy.OnPush,
2711
2573
  }]
2712
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i3.NgControl }]; }, propDecorators: { tetaOnlyNumber: [{
2713
- type: Input
2714
- }], allowDecimals: [{
2715
- type: Input
2716
- }], allowSign: [{
2717
- type: Input
2718
- }], decimalSeparator: [{
2719
- type: Input
2720
- }], commaSeparator: [{
2574
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; } });
2575
+
2576
+ class DayItemComponent {
2577
+ day;
2578
+ ngOnInit() {
2579
+ }
2580
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DayItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2581
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DayItemComponent, selector: "teta-day-item", inputs: { day: "day" }, ngImport: i0, template: "<p>{{day.date.getDate()}}</p>\n\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2582
+ }
2583
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DayItemComponent, decorators: [{
2584
+ type: Component,
2585
+ args: [{ selector: 'teta-day-item', changeDetection: ChangeDetectionStrategy.OnPush, template: "<p>{{day.date.getDate()}}</p>\n\n" }]
2586
+ }], propDecorators: { day: [{
2721
2587
  type: Input
2722
- }], onChange: [{
2723
- type: HostListener,
2724
- args: ['change', ['$event']]
2725
- }], dblclick: [{
2726
- type: HostListener,
2727
- args: ['dblclick', ['$event']]
2728
- }], onPaste: [{
2729
- type: HostListener,
2730
- args: ['paste', ['$event']]
2731
- }], onKeyDown: [{
2732
- type: HostListener,
2733
- args: ['keydown', ['$event']]
2734
2588
  }] } });
2735
2589
 
2736
- const getPrecision = (a) => {
2737
- if (!isFinite(a)) {
2738
- return 0;
2590
+ class DayPickerComponent {
2591
+ date = new Date();
2592
+ calendar;
2593
+ viewType;
2594
+ range;
2595
+ min;
2596
+ max;
2597
+ locale;
2598
+ hoveredDate;
2599
+ hoveredDateChange = new EventEmitter();
2600
+ selectDate = new EventEmitter();
2601
+ daysOfWeek = new Map().set('ru', ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс']).set('en', ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']);
2602
+ constructor() {
2739
2603
  }
2740
- let e = 1;
2741
- let p = 0;
2742
- while (Math.round(a * e) / e !== a) {
2743
- e *= 10;
2744
- p++;
2604
+ isInRange(day, from, to) {
2605
+ const matchesMinDate = dayjs(new Date(from)).startOf('date').toDate() <= day.date;
2606
+ const matchesMaxDate = day.date < dayjs(new Date(to)).endOf('date').toDate();
2607
+ return matchesMinDate && matchesMaxDate;
2745
2608
  }
2746
- return p;
2747
- };
2748
- const formatNumber = (value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength) => {
2749
- const abs = Math.abs(value);
2750
- if (0 < abs && 1 > abs) {
2751
- const firstDigitIndex = Math.floor(Math.abs(Math.log10(abs)));
2752
- decimalLength += firstDigitIndex;
2609
+ isHoveredRange(day) {
2610
+ if (!this.range?.to && this.range?.from) {
2611
+ return this.isInRange(day, this.range.from, this.hoveredDate) || this.isInRange(day, this.hoveredDate, this.range.from);
2612
+ }
2613
+ return false;
2753
2614
  }
2754
- const precision = Math.min(getPrecision(value), Math.floor(decimalLength));
2755
- const result = '\\d(?=(\\d{' + chunkLength + '})+' + (precision > 0 ? '\\D' : '$') + ')';
2756
- const num = value.toFixed(precision);
2757
- return (decimalDelimiter ? num.replace('.', decimalDelimiter) : num).replace(new RegExp(result, 'g'), '$&' + chunkDelimiter);
2758
- };
2759
- const prependZero = (input, length) => ('0'.repeat(length) + input).slice(-length);
2760
-
2761
- class NumberPipe {
2762
- transform(value, decimalLength = 2, chunkDelimiter = '', decimalDelimiter = '.', chunkLength = 3) {
2763
- if (value === null || value === undefined || value === '') {
2764
- return '';
2615
+ isActiveRange(day) {
2616
+ if (this.range?.from && this.range?.to) {
2617
+ return this.isInRange(day, this.range.from, this.range.to);
2765
2618
  }
2766
- if (typeof value === 'string' && isNaN(parseFloat(value))) {
2767
- return value.toString();
2619
+ return false;
2620
+ }
2621
+ pickDate(day) {
2622
+ if (!day.disabled) {
2623
+ this.selectDate.emit(day.date);
2768
2624
  }
2769
- if (decimalLength === null) {
2770
- return value.toString();
2625
+ }
2626
+ getRangeActiveClass(d) {
2627
+ if (this.range && new Date(this.range?.from).getTime() !== new Date(this.range?.to).getTime()) {
2628
+ if (this.range.to) {
2629
+ return this.getClassStaticItem(d);
2630
+ }
2631
+ else {
2632
+ if (this.hoveredDate.getTime() === d.date.getTime()) {
2633
+ return this.getClassHoveredItem();
2634
+ }
2635
+ else {
2636
+ return this.getClassSelectedItem(d);
2637
+ }
2638
+ }
2771
2639
  }
2772
- value = Number(value);
2773
- return formatNumber(value, decimalLength, chunkDelimiter, decimalDelimiter, chunkLength);
2640
+ return '';
2774
2641
  }
2775
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
2776
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: NumberPipe, name: "tetaNumber" });
2777
- }
2778
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberPipe, decorators: [{
2779
- type: Pipe,
2780
- args: [{
2781
- name: 'tetaNumber'
2782
- }]
2783
- }] });
2784
-
2785
- class TextFieldComponent {
2786
- _cdr;
2787
- placeholder = '';
2788
- leftIconName;
2789
- disabled = false;
2790
- onlyNumber = false;
2791
- decimalPart;
2792
- invalid;
2793
- input;
2794
- inputFocused;
2795
- textField = true;
2796
- value = '';
2797
- constructor(_cdr) {
2798
- this._cdr = _cdr;
2642
+ hover(date) {
2643
+ if (date?.getTime() !== this.hoveredDate?.getTime()) {
2644
+ this.hoveredDate = date;
2645
+ this.hoveredDateChange.emit(date);
2646
+ }
2799
2647
  }
2800
- onFocus() {
2801
- if (this.disabled) {
2802
- return;
2648
+ getClassStaticItem(d) {
2649
+ const from = dayjs(new Date(this.range.from)).startOf("day").toDate();
2650
+ const to = dayjs(new Date(this.range.to)).startOf("day").toDate();
2651
+ const itemDate = dayjs(new Date(d.date)).startOf("day").toDate();
2652
+ if (from.getTime() === itemDate.getTime()) {
2653
+ return 'datepicker-date_active-first';
2803
2654
  }
2804
- this.input.nativeElement.focus();
2655
+ if (to.getTime() === itemDate.getTime()) {
2656
+ return 'datepicker-date_active-second';
2657
+ }
2658
+ return '';
2805
2659
  }
2806
- keyPress(event) {
2807
- if (event.key === 'Enter' || event.keyCode === 13) {
2808
- this.emitBlur();
2660
+ getClassHoveredItem() {
2661
+ if (new Date(this.range.from) > this.hoveredDate) {
2662
+ return 'datepicker-date_active-first';
2663
+ }
2664
+ if (new Date(this.range.from) < this.hoveredDate) {
2665
+ return 'datepicker-date_active-second';
2809
2666
  }
2810
2667
  }
2811
- emitBlur() {
2812
- this.onTouched();
2668
+ getClassSelectedItem(d) {
2669
+ if (d.selected && d.date < this.hoveredDate) {
2670
+ return 'datepicker-date_active-first';
2671
+ }
2672
+ if (d.selected && d.date > this.hoveredDate) {
2673
+ return 'datepicker-date_active-second';
2674
+ }
2675
+ return '';
2813
2676
  }
2814
- registerOnChange(fn) {
2815
- this.onChange = fn;
2677
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DayPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2678
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DayPickerComponent, selector: "teta-day-picker", inputs: { date: "date", calendar: "calendar", viewType: "viewType", range: "range", min: "min", max: "max", locale: "locale", hoveredDate: "hoveredDate" }, outputs: { hoveredDateChange: "hoveredDateChange", selectDate: "selectDate" }, ngImport: i0, template: "<div class=\"datepicker-week font-caption\">\n <p class=\"datepicker-day\" *ngFor=\"let day of daysOfWeek.get(locale)\">\n {{day}}\n </p>\n</div>\n<div class=\"datepicker-picker color-text-90 font-body-3\">\n <ng-container *ngFor=\"let day of calendar\">\n <div [class]=\"getRangeActiveClass(day)+' datepicker-date font-body-3 datepicker_'+viewType\"\n (mouseenter)=\"hover(day.date)\"\n (click)=\"pickDate(day)\"\n [ngClass]=\"{'datepicker-date_active':day.selected||(day.date===hoveredDate&&range&&!range.to),'datepicker-date-range_hover':range&&isHoveredRange(day),\n 'datepicker-date_disabled':day.disabled,'color-text-30':day.disabled||(!range&&!day.isCurrentMonth),'datepicker-date-range_disabled':!day.isCurrentMonth&&range,'datepicker-date-range_active':isActiveRange(day)}\">\n <teta-day-item [day]=\"day\"></teta-day-item>\n </div>\n </ng-container>\n</div>\n\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: DayItemComponent, selector: "teta-day-item", inputs: ["day"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2679
+ }
2680
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DayPickerComponent, decorators: [{
2681
+ type: Component,
2682
+ args: [{ selector: 'teta-day-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"datepicker-week font-caption\">\n <p class=\"datepicker-day\" *ngFor=\"let day of daysOfWeek.get(locale)\">\n {{day}}\n </p>\n</div>\n<div class=\"datepicker-picker color-text-90 font-body-3\">\n <ng-container *ngFor=\"let day of calendar\">\n <div [class]=\"getRangeActiveClass(day)+' datepicker-date font-body-3 datepicker_'+viewType\"\n (mouseenter)=\"hover(day.date)\"\n (click)=\"pickDate(day)\"\n [ngClass]=\"{'datepicker-date_active':day.selected||(day.date===hoveredDate&&range&&!range.to),'datepicker-date-range_hover':range&&isHoveredRange(day),\n 'datepicker-date_disabled':day.disabled,'color-text-30':day.disabled||(!range&&!day.isCurrentMonth),'datepicker-date-range_disabled':!day.isCurrentMonth&&range,'datepicker-date-range_active':isActiveRange(day)}\">\n <teta-day-item [day]=\"day\"></teta-day-item>\n </div>\n </ng-container>\n</div>\n\n" }]
2683
+ }], ctorParameters: function () { return []; }, propDecorators: { date: [{
2684
+ type: Input
2685
+ }], calendar: [{
2686
+ type: Input
2687
+ }], viewType: [{
2688
+ type: Input
2689
+ }], range: [{
2690
+ type: Input
2691
+ }], min: [{
2692
+ type: Input
2693
+ }], max: [{
2694
+ type: Input
2695
+ }], locale: [{
2696
+ type: Input
2697
+ }], hoveredDate: [{
2698
+ type: Input
2699
+ }], hoveredDateChange: [{
2700
+ type: Output
2701
+ }], selectDate: [{
2702
+ type: Output
2703
+ }] } });
2704
+
2705
+ class MonthPickerComponent {
2706
+ locale;
2707
+ selectedMonth = 1;
2708
+ viewType;
2709
+ currentYear;
2710
+ localeMoths;
2711
+ selectMonth = new EventEmitter();
2712
+ changeYear = new EventEmitter();
2713
+ months = [];
2714
+ constructor() {
2816
2715
  }
2817
- registerOnTouched(fn) {
2818
- this.onTouched = fn;
2716
+ pickMonth(monthId) {
2717
+ this.selectMonth.emit(monthId);
2819
2718
  }
2820
- setDisabledState(isDisabled) {
2821
- this.disabled = isDisabled;
2822
- this._cdr.markForCheck();
2719
+ pickYear(year) {
2720
+ this.changeYear.emit(year);
2823
2721
  }
2824
- writeValue(input) {
2825
- this.value = input;
2826
- this._cdr.detectChanges();
2722
+ ngOnInit() {
2723
+ this.months = this.localeMoths.get(this.locale).map((m, i) => {
2724
+ return {
2725
+ id: i,
2726
+ name: m,
2727
+ isSelected: this.selectedMonth === i
2728
+ };
2729
+ });
2827
2730
  }
2828
- onChange(input) { }
2829
- onTouched() { }
2830
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TextFieldComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2831
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: TextFieldComponent, selector: "teta-text-field", inputs: { placeholder: "placeholder", leftIconName: "leftIconName", disabled: "disabled", onlyNumber: "onlyNumber", decimalPart: "decimalPart", invalid: "invalid" }, host: { listeners: { "click": "onFocus()" }, properties: { "class.text-field_disabled": "this.disabled", "class.text-field_invalid": "this.invalid", "class.text-field": "this.textField" } }, providers: [
2832
- {
2833
- provide: NG_VALUE_ACCESSOR,
2834
- useExisting: forwardRef(() => TextFieldComponent),
2835
- multi: true,
2836
- },
2837
- ], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<teta-icon *ngIf='leftIconName' [name]='leftIconName' [palette]=\"'text'\"></teta-icon>\n<input\n #input\n [ngModel]='value | tetaNumber : !onlyNumber ? null : inputFocused ? 1000 : decimalPart'\n [tetaOnlyNumber]='onlyNumber'\n (ngModelChange)='value = $event; onChange($event);'\n [placeholder]='placeholder'\n [disabled]='disabled'\n [ngClass]=\"{'color-text-40':disabled}\"\n (focus)='inputFocused = true'\n (blur)='inputFocused = false;emitBlur()'\n (keydown)='keyPress($event)'\n type='text'\n/>\n<teta-icon\n *ngIf='value && !disabled'\n class='close-icon'\n [name]=\"'closeCircle'\"\n [palette]=\"'text'\"\n (click)=\"value = ''; onChange('');\"\n></teta-icon>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: OnlyNumberDirective, selector: "[tetaOnlyNumber]", inputs: ["tetaOnlyNumber", "allowDecimals", "allowSign", "decimalSeparator", "commaSeparator"] }, { kind: "pipe", type: NumberPipe, name: "tetaNumber" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2731
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MonthPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2732
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: MonthPickerComponent, selector: "teta-month-picker", inputs: { locale: "locale", selectedMonth: "selectedMonth", viewType: "viewType", currentYear: "currentYear", localeMoths: "localeMoths" }, outputs: { selectMonth: "selectMonth", changeYear: "changeYear" }, ngImport: i0, template: "<div class=\"padding-h-3 padding-v-2 gap-8 column datepicker-month-wrapper\">\n <div class=\"row align-center justify-content-between font-button-2\">\n <teta-button [class]=\"'change-month-button datepicker_'+viewType\" [square]=\"true\"\n (click)=\"pickYear(currentYear-1)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowLeftKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n <p>{{currentYear}}</p>\n <teta-button [square]=\"true\" [class]=\"'change-month-button datepicker_'+viewType\"\n (click)=\"pickYear(currentYear+1)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowRightKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n </div>\n <div class=\"datepicker-month font-body-3 color-text-90\"\n style=\"width: 100%\">\n <div *ngFor=\"let month of months\" (click)=\"pickMonth(month.id)\">\n <div [ngClass]=\"{'datepicker-month_item_active':month.isSelected}\"\n [class]=\"'datepicker-month_item column align-center justify-content-center datepicker_'+viewType\">\n <p>\n {{month.name}}\n </p>\n </div>\n </div>\n </div>\n</div>\n\n\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ButtonComponent, selector: "button[teta-button], teta-button", inputs: ["palette", "class", "view", "square", "viewType", "size"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2838
2733
  }
2839
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TextFieldComponent, decorators: [{
2734
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: MonthPickerComponent, decorators: [{
2840
2735
  type: Component,
2841
- args: [{ selector: 'teta-text-field', providers: [
2842
- {
2843
- provide: NG_VALUE_ACCESSOR,
2844
- useExisting: forwardRef(() => TextFieldComponent),
2845
- multi: true,
2846
- },
2847
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<teta-icon *ngIf='leftIconName' [name]='leftIconName' [palette]=\"'text'\"></teta-icon>\n<input\n #input\n [ngModel]='value | tetaNumber : !onlyNumber ? null : inputFocused ? 1000 : decimalPart'\n [tetaOnlyNumber]='onlyNumber'\n (ngModelChange)='value = $event; onChange($event);'\n [placeholder]='placeholder'\n [disabled]='disabled'\n [ngClass]=\"{'color-text-40':disabled}\"\n (focus)='inputFocused = true'\n (blur)='inputFocused = false;emitBlur()'\n (keydown)='keyPress($event)'\n type='text'\n/>\n<teta-icon\n *ngIf='value && !disabled'\n class='close-icon'\n [name]=\"'closeCircle'\"\n [palette]=\"'text'\"\n (click)=\"value = ''; onChange('');\"\n></teta-icon>\n" }]
2848
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { placeholder: [{
2849
- type: Input
2850
- }], leftIconName: [{
2736
+ args: [{ selector: 'teta-month-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"padding-h-3 padding-v-2 gap-8 column datepicker-month-wrapper\">\n <div class=\"row align-center justify-content-between font-button-2\">\n <teta-button [class]=\"'change-month-button datepicker_'+viewType\" [square]=\"true\"\n (click)=\"pickYear(currentYear-1)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowLeftKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n <p>{{currentYear}}</p>\n <teta-button [square]=\"true\" [class]=\"'change-month-button datepicker_'+viewType\"\n (click)=\"pickYear(currentYear+1)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowRightKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n </div>\n <div class=\"datepicker-month font-body-3 color-text-90\"\n style=\"width: 100%\">\n <div *ngFor=\"let month of months\" (click)=\"pickMonth(month.id)\">\n <div [ngClass]=\"{'datepicker-month_item_active':month.isSelected}\"\n [class]=\"'datepicker-month_item column align-center justify-content-center datepicker_'+viewType\">\n <p>\n {{month.name}}\n </p>\n </div>\n </div>\n </div>\n</div>\n\n\n" }]
2737
+ }], ctorParameters: function () { return []; }, propDecorators: { locale: [{
2851
2738
  type: Input
2852
- }], disabled: [{
2853
- type: HostBinding,
2854
- args: ['class.text-field_disabled']
2855
- }, {
2739
+ }], selectedMonth: [{
2856
2740
  type: Input
2857
- }], onlyNumber: [{
2741
+ }], viewType: [{
2858
2742
  type: Input
2859
- }], decimalPart: [{
2743
+ }], currentYear: [{
2860
2744
  type: Input
2861
- }], invalid: [{
2862
- type: HostBinding,
2863
- args: ['class.text-field_invalid']
2864
- }, {
2745
+ }], localeMoths: [{
2865
2746
  type: Input
2866
- }], input: [{
2867
- type: ViewChild,
2868
- args: ['input', { static: false }]
2869
- }], textField: [{
2870
- type: HostBinding,
2871
- args: ['class.text-field']
2872
- }], onFocus: [{
2873
- type: HostListener,
2874
- args: ['click']
2747
+ }], selectMonth: [{
2748
+ type: Output
2749
+ }], changeYear: [{
2750
+ type: Output
2875
2751
  }] } });
2876
2752
 
2877
- class OnlyNumberModule {
2878
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2879
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberModule, declarations: [OnlyNumberDirective], imports: [CommonModule], exports: [OnlyNumberDirective] });
2880
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberModule, imports: [CommonModule] });
2753
+ class ScrollToSelectedYearDirective {
2754
+ el;
2755
+ alive = true;
2756
+ constructor(el) {
2757
+ this.el = el;
2758
+ }
2759
+ ngOnDestroy() {
2760
+ this.alive = false;
2761
+ }
2762
+ ngAfterViewInit() {
2763
+ this.el.nativeElement.scrollIntoView({ inline: "center", block: "center" });
2764
+ }
2765
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollToSelectedYearDirective, deps: [{ token: ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
2766
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: ScrollToSelectedYearDirective, selector: "[tetaScrollToSelectedYear]", ngImport: i0 });
2881
2767
  }
2882
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: OnlyNumberModule, decorators: [{
2883
- type: NgModule,
2768
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollToSelectedYearDirective, decorators: [{
2769
+ type: Directive,
2884
2770
  args: [{
2885
- declarations: [OnlyNumberDirective],
2886
- exports: [OnlyNumberDirective],
2887
- imports: [CommonModule],
2771
+ selector: '[tetaScrollToSelectedYear]'
2888
2772
  }]
2889
- }] });
2773
+ }], ctorParameters: function () { return [{ type: i0.ElementRef, decorators: [{
2774
+ type: Inject,
2775
+ args: [ElementRef]
2776
+ }] }]; } });
2890
2777
 
2891
- class FormGroupTitleComponent {
2892
- className = true;
2893
- constructor() { }
2894
- ngOnInit() { }
2895
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: FormGroupTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2896
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: FormGroupTitleComponent, selector: "teta-form-group-title", host: { properties: { "class.form-group-title": "this.className" } }, ngImport: i0, template: "<div class=\"font-overline form-group-title-text\">\n <ng-content></ng-content>\n</div>\n<div class=\"form-group-title-line\"></div>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2778
+ class YearPickerComponent {
2779
+ selectedYear;
2780
+ viewType;
2781
+ minMax;
2782
+ locale;
2783
+ selectYear = new EventEmitter();
2784
+ yearPickerDictionary = new Map().set('ru', 'Выберете год').set('en', 'Select year');
2785
+ alive = true;
2786
+ years;
2787
+ constructor() {
2788
+ }
2789
+ pickYear(year, disabled) {
2790
+ if (!disabled) {
2791
+ this.selectYear.emit(year);
2792
+ }
2793
+ }
2794
+ ngOnInit() {
2795
+ this.years = new Array(100).fill(1).map((v, i) => {
2796
+ const year = new Date().getFullYear() + (i - 50);
2797
+ return { id: year, isSelected: year === this.selectedYear, disabled: this.isDisabled(year) };
2798
+ });
2799
+ }
2800
+ isDisabled(year) {
2801
+ if (this.minMax) {
2802
+ const isSuitableMax = dayjs(new Date().setFullYear(year)).startOf('year').isAfter(new Date(this.minMax.max)) && this.minMax.max !== null;
2803
+ const isSuitableMin = dayjs(new Date().setFullYear(year)).endOf('year').isBefore(new Date(this.minMax.min)) && this.minMax.min !== null;
2804
+ return isSuitableMax || isSuitableMin;
2805
+ }
2806
+ return false;
2807
+ }
2808
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: YearPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2809
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: YearPickerComponent, selector: "teta-year-picker", inputs: { selectedYear: "selectedYear", viewType: "viewType", minMax: "minMax", locale: "locale" }, outputs: { selectYear: "selectYear" }, ngImport: i0, template: "<div class=\"column\">\n <div class=\"font-title-3 padding-v-4 padding-h-3\">\n <p>{{yearPickerDictionary.get(locale)}}</p>\n </div>\n <div class=\"datepicker-year overflow-y-auto\">\n <div *ngFor=\"let y of years\" class=\"font-button-2\" (click)=\"pickYear(y.id,y.disabled)\">\n <div [ngClass]=\"{'datepicker-year_item_active':y.isSelected,'datepicker-year_item_disabled':y.disabled}\"\n [class]=\"'datepicker-year_item column align-center justify-content-center datepicker_'+viewType\">\n <div *ngIf=\" y.isSelected===true\" tetaScrollToSelectedYear>\n <span>{{y.id}}</span>\n </div>\n <div *ngIf=\"!y.isSelected\">\n <span>{{y.id}} </span>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: ScrollToSelectedYearDirective, selector: "[tetaScrollToSelectedYear]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2897
2810
  }
2898
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: FormGroupTitleComponent, decorators: [{
2811
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: YearPickerComponent, decorators: [{
2899
2812
  type: Component,
2900
- args: [{ selector: 'teta-form-group-title', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"font-overline form-group-title-text\">\n <ng-content></ng-content>\n</div>\n<div class=\"form-group-title-line\"></div>\n" }]
2901
- }], ctorParameters: function () { return []; }, propDecorators: { className: [{
2902
- type: HostBinding,
2903
- args: ['class.form-group-title']
2813
+ args: [{ selector: 'teta-year-picker', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"column\">\n <div class=\"font-title-3 padding-v-4 padding-h-3\">\n <p>{{yearPickerDictionary.get(locale)}}</p>\n </div>\n <div class=\"datepicker-year overflow-y-auto\">\n <div *ngFor=\"let y of years\" class=\"font-button-2\" (click)=\"pickYear(y.id,y.disabled)\">\n <div [ngClass]=\"{'datepicker-year_item_active':y.isSelected,'datepicker-year_item_disabled':y.disabled}\"\n [class]=\"'datepicker-year_item column align-center justify-content-center datepicker_'+viewType\">\n <div *ngIf=\" y.isSelected===true\" tetaScrollToSelectedYear>\n <span>{{y.id}}</span>\n </div>\n <div *ngIf=\"!y.isSelected\">\n <span>{{y.id}} </span>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n" }]
2814
+ }], ctorParameters: function () { return []; }, propDecorators: { selectedYear: [{
2815
+ type: Input
2816
+ }], viewType: [{
2817
+ type: Input
2818
+ }], minMax: [{
2819
+ type: Input
2820
+ }], locale: [{
2821
+ type: Input
2822
+ }], selectYear: [{
2823
+ type: Output
2904
2824
  }] } });
2905
2825
 
2906
- class DynamicComponentModule {
2907
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DynamicComponentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2908
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: DynamicComponentModule, declarations: [PopupContentComponent], imports: [CommonModule], exports: [PopupContentComponent] });
2909
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DynamicComponentModule, imports: [CommonModule] });
2910
- }
2911
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DynamicComponentModule, decorators: [{
2912
- type: NgModule,
2913
- args: [{
2914
- declarations: [PopupContentComponent],
2915
- exports: [PopupContentComponent],
2916
- imports: [
2917
- CommonModule
2918
- ]
2919
- }]
2920
- }] });
2921
-
2922
- class HintModule {
2923
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: HintModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2924
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: HintModule, declarations: [HintDirective], imports: [CommonModule,
2925
- DynamicComponentModule], exports: [HintDirective] });
2926
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: HintModule, imports: [CommonModule,
2927
- DynamicComponentModule] });
2826
+ class DateCalendarComponent extends BaseCalendar {
2827
+ _cdr;
2828
+ selectedDate = new Date();
2829
+ locale;
2830
+ open;
2831
+ viewType;
2832
+ min;
2833
+ isDateNull;
2834
+ max;
2835
+ setDate = new EventEmitter();
2836
+ calendar = [];
2837
+ constructor(_cdr) {
2838
+ super(_cdr);
2839
+ this._cdr = _cdr;
2840
+ dayjs().locale('ru', { weekStart: 1 });
2841
+ combineLatest([this.currentYear, this.currentMonth, this.minMax])
2842
+ .pipe(takeWhile$1(() => this.alive), filter$1(([currentYear, currentMonth]) => currentMonth !== null && currentYear !== null), map$1(([year, month, minMax]) => {
2843
+ return this.generateCalendar(dayjs(new Date(this.selectedDate)).locale(this.locale), year, month, minMax);
2844
+ }))
2845
+ .subscribe(_ => {
2846
+ this.calendar = _;
2847
+ });
2848
+ }
2849
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DateCalendarComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2850
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DateCalendarComponent, selector: "teta-date-calendar", inputs: { selectedDate: "selectedDate", locale: "locale", open: "open", viewType: "viewType", min: "min", isDateNull: "isDateNull", max: "max" }, outputs: { setDate: "setDate" }, usesInheritance: true, ngImport: i0, template: "<div *ngIf=\"{currentMonth:currentMonth|async,currentYear:currentYear|async,selectedPicker:selectedPicker|async} as data\"\n class=\"datepicker-content overflow-y-auto\"\n>\n <ng-container *ngIf=\"data.selectedPicker==='day'\">\n <div class=\"padding-h-3 padding-v-2\">\n <div class=\"row align-center justify-content-between\">\n <teta-button [class]=\"'change-month-button datepicker_'+viewType\" [square]=\"true\"\n (click)=\"changeMonth(data.currentMonth-1,data.currentYear)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowLeftKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n <div class=\"row gap-4 font-button-2 \">\n <button [class]=\"'datepicker_'+viewType \" teta-button view=\"ghost\" palette=\"text\"\n (click)=\"selectPicker('month')\"> {{getMothName(data.currentMonth)}}</button>\n <button [class]=\"'datepicker_'+viewType\" teta-button view=\"ghost\" palette=\"text\"\n (click)=\"selectPicker('year')\">{{data.currentYear}}</button>\n </div>\n <teta-button [square]=\"true\" [class]=\"'change-month-button datepicker_'+viewType\"\n (click)=\"changeMonth(data.currentMonth+1,data.currentYear)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowRightKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n </div>\n <div>\n <teta-day-picker [viewType]=\"viewType\" (selectDate)=\"selectDate($event)\" [locale]=\"locale\"\n [calendar]=\"calendar\"></teta-day-picker>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"data.selectedPicker==='month'\">\n <teta-month-picker [localeMoths]=\"localeMonths\" [currentYear]=\"data.currentYear\" (changeYear)=\"setYear($event)\"\n [selectedMonth]=\"data.currentMonth\" [viewType]=\"viewType\" [locale]=\"locale\"\n (selectMonth)=\"selectMonth($event)\"></teta-month-picker>\n </ng-container>\n <ng-container *ngIf=\"data.selectedPicker==='year'\">\n <teta-year-picker [locale]=\"locale\" [viewType]=\"viewType\" (selectYear)=\"selectYear($event)\"\n [selectedYear]=\"data.currentYear\"></teta-year-picker>\n </ng-container>\n</div>\n\n", styles: [".change-month-button{-webkit-user-select:none;user-select:none}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "button[teta-button], teta-button", inputs: ["palette", "class", "view", "square", "viewType", "size"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "component", type: DayPickerComponent, selector: "teta-day-picker", inputs: ["date", "calendar", "viewType", "range", "min", "max", "locale", "hoveredDate"], outputs: ["hoveredDateChange", "selectDate"] }, { kind: "component", type: MonthPickerComponent, selector: "teta-month-picker", inputs: ["locale", "selectedMonth", "viewType", "currentYear", "localeMoths"], outputs: ["selectMonth", "changeYear"] }, { kind: "component", type: YearPickerComponent, selector: "teta-year-picker", inputs: ["selectedYear", "viewType", "minMax", "locale"], outputs: ["selectYear"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2928
2851
  }
2929
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: HintModule, decorators: [{
2930
- type: NgModule,
2931
- args: [{
2932
- declarations: [HintDirective],
2933
- exports: [HintDirective],
2934
- imports: [
2935
- CommonModule,
2936
- DynamicComponentModule
2937
- ]
2938
- }]
2939
- }] });
2852
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DateCalendarComponent, decorators: [{
2853
+ type: Component,
2854
+ args: [{ selector: 'teta-date-calendar', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"{currentMonth:currentMonth|async,currentYear:currentYear|async,selectedPicker:selectedPicker|async} as data\"\n class=\"datepicker-content overflow-y-auto\"\n>\n <ng-container *ngIf=\"data.selectedPicker==='day'\">\n <div class=\"padding-h-3 padding-v-2\">\n <div class=\"row align-center justify-content-between\">\n <teta-button [class]=\"'change-month-button datepicker_'+viewType\" [square]=\"true\"\n (click)=\"changeMonth(data.currentMonth-1,data.currentYear)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowLeftKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n <div class=\"row gap-4 font-button-2 \">\n <button [class]=\"'datepicker_'+viewType \" teta-button view=\"ghost\" palette=\"text\"\n (click)=\"selectPicker('month')\"> {{getMothName(data.currentMonth)}}</button>\n <button [class]=\"'datepicker_'+viewType\" teta-button view=\"ghost\" palette=\"text\"\n (click)=\"selectPicker('year')\">{{data.currentYear}}</button>\n </div>\n <teta-button [square]=\"true\" [class]=\"'change-month-button datepicker_'+viewType\"\n (click)=\"changeMonth(data.currentMonth+1,data.currentYear)\"\n palette=\"text\"\n view=\"ghost\">\n <teta-icon name=\"arrowRightKey\" [palette]=\"'text'\"></teta-icon>\n </teta-button>\n </div>\n <div>\n <teta-day-picker [viewType]=\"viewType\" (selectDate)=\"selectDate($event)\" [locale]=\"locale\"\n [calendar]=\"calendar\"></teta-day-picker>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"data.selectedPicker==='month'\">\n <teta-month-picker [localeMoths]=\"localeMonths\" [currentYear]=\"data.currentYear\" (changeYear)=\"setYear($event)\"\n [selectedMonth]=\"data.currentMonth\" [viewType]=\"viewType\" [locale]=\"locale\"\n (selectMonth)=\"selectMonth($event)\"></teta-month-picker>\n </ng-container>\n <ng-container *ngIf=\"data.selectedPicker==='year'\">\n <teta-year-picker [locale]=\"locale\" [viewType]=\"viewType\" (selectYear)=\"selectYear($event)\"\n [selectedYear]=\"data.currentYear\"></teta-year-picker>\n </ng-container>\n</div>\n\n", styles: [".change-month-button{-webkit-user-select:none;user-select:none}\n"] }]
2855
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { selectedDate: [{
2856
+ type: Input
2857
+ }], locale: [{
2858
+ type: Input
2859
+ }], open: [{
2860
+ type: Input
2861
+ }], viewType: [{
2862
+ type: Input
2863
+ }], min: [{
2864
+ type: Input
2865
+ }], isDateNull: [{
2866
+ type: Input
2867
+ }], max: [{
2868
+ type: Input
2869
+ }], setDate: [{
2870
+ type: Output
2871
+ }] } });
2940
2872
 
2941
- class ColorInputComponent {
2873
+ class BasePicker {
2874
+ _elementRef;
2942
2875
  _cdr;
2943
- disabled = false;
2944
- input;
2945
- value = '';
2946
- constructor(_cdr) {
2876
+ datePipe;
2877
+ open = false;
2878
+ placeholder = '';
2879
+ inputText;
2880
+ maskitoOptions;
2881
+ constructor(_elementRef, _cdr, datePipe) {
2882
+ this._elementRef = _elementRef;
2947
2883
  this._cdr = _cdr;
2884
+ this.datePipe = datePipe;
2885
+ this.inputText = this.checkNull();
2948
2886
  }
2949
- onFocus() {
2887
+ changeInput(v) {
2888
+ this.changePlaceholder(v);
2889
+ }
2890
+ changePlaceholder(value) {
2891
+ const val = this.mask.split('');
2892
+ for (let i = 0; value.length > i; i++) {
2893
+ val.splice(i, 1, value[i]);
2894
+ }
2895
+ this.placeholder = val.join('');
2896
+ }
2897
+ openChange(e) {
2898
+ if (!e) {
2899
+ this.onBlur();
2900
+ }
2901
+ this.open = e;
2902
+ }
2903
+ checkNull() {
2904
+ if (!this.date && this.allowNull) {
2905
+ return null;
2906
+ }
2907
+ return this.datePipe.transform(new Date(), 'dd.MM.yyyy, HH:mm');
2908
+ }
2909
+ openPicker = (show) => {
2950
2910
  if (this.disabled) {
2951
2911
  return;
2952
2912
  }
2953
- this.input.nativeElement.focus();
2913
+ this.open = show;
2914
+ this._cdr.markForCheck();
2915
+ };
2916
+ changeSelectedDate(date, selectedDate) {
2917
+ this.setDate(date);
2918
+ this.emitValue(date);
2919
+ this.open = false;
2954
2920
  }
2955
- emitBlur() {
2956
- this.onTouched();
2921
+ emitValue(value) {
2922
+ if (this.isValueChange(value)) {
2923
+ this.date = value;
2924
+ this.selectDate.emit(value);
2925
+ this.onChange(value);
2926
+ }
2957
2927
  }
2958
- registerOnChange(fn) {
2959
- this.onChange = fn;
2928
+ isValueChange(value) {
2929
+ return new Date(value).getTime() !== new Date(this.date).getTime();
2960
2930
  }
2961
- registerOnTouched(fn) {
2962
- this.onTouched = fn;
2931
+ checkEnter(e) {
2932
+ if (e.key === 'Enter') {
2933
+ this.inputText = e.target.value;
2934
+ this.onBlur();
2935
+ }
2936
+ if (e.key === '-') {
2937
+ e.preventDefault();
2938
+ }
2939
+ this.open = true;
2963
2940
  }
2964
- setDisabledState(isDisabled) {
2965
- this.disabled = isDisabled;
2966
- this._cdr.markForCheck();
2941
+ isAvailableLength(val, length) {
2942
+ if (val?.length) {
2943
+ return val.length === length;
2944
+ }
2945
+ return false;
2967
2946
  }
2968
- writeValue(input) {
2969
- this.value = input;
2970
- this._cdr.detectChanges();
2947
+ getDateFromStr(str, separator = '.') {
2948
+ const date = str?.split(separator);
2949
+ const day = this.isAvailableLength(date?.[0], 2) ? Number(date[0]) : null;
2950
+ const month = this.isAvailableLength(date?.[1], 2) ? Number(date[1]) : null;
2951
+ const year = this.isAvailableLength(date?.[2], 4) ? Number(date[2]) : null;
2952
+ return { day, month, year };
2971
2953
  }
2972
- onChange(input) { }
2973
- onTouched() { }
2974
- getHexColor(color) {
2975
- if (color && color.startsWith('rgb')) {
2976
- const value = color.substring(color.indexOf('(') + 1, color.lastIndexOf(')'));
2977
- const colorArray = value.split(',');
2978
- color = `#${('00' + parseInt(colorArray[0], 10).toString(16)).slice(-2)}${('00' + parseInt(colorArray[1], 10).toString(16)).slice(-2)}${('00' + parseInt(colorArray[2], 10).toString(16)).slice(-2)}`;
2954
+ getTimeFromStr(str, separator = ':') {
2955
+ const time = str?.trim().split(separator);
2956
+ const hours = this.isAvailableLength(time?.[0], 2) ? Number(time[0]) : null;
2957
+ const mins = this.isAvailableLength(time?.[1], 2) ? Number(time[1]) : null;
2958
+ return { hours, mins };
2959
+ }
2960
+ focus() {
2961
+ this._elementRef.nativeElement.focus();
2962
+ }
2963
+ getLocaleString(date) {
2964
+ return new Date(date).toLocaleString([], {
2965
+ year: 'numeric',
2966
+ month: '2-digit',
2967
+ day: '2-digit',
2968
+ hour: this.showTime ? '2-digit' : undefined,
2969
+ minute: this.showTime ? '2-digit' : undefined,
2970
+ });
2971
+ }
2972
+ getAvailableDate(min, max, date) {
2973
+ const minDate = dayjs(new Date(min)).startOf('day').toDate();
2974
+ const maxDate = dayjs(new Date(max)).endOf('day').toDate();
2975
+ if (min && minDate.getTime() >= new Date(date).getTime()) {
2976
+ return new Date();
2979
2977
  }
2980
- return color;
2978
+ if (max && maxDate.getTime() <= new Date(date).getTime()) {
2979
+ return maxDate;
2980
+ }
2981
+ return new Date(date);
2981
2982
  }
2982
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ColorInputComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2983
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: ColorInputComponent, selector: "teta-color-input", inputs: { disabled: "disabled" }, host: { listeners: { "click": "onFocus()" } }, providers: [
2984
- {
2985
- provide: NG_VALUE_ACCESSOR,
2986
- useExisting: forwardRef(() => ColorInputComponent),
2987
- multi: true,
2988
- },
2989
- ], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], ngImport: i0, template: "<input type='color'\n #input\n [disabled]='disabled'\n (blur)='emitBlur();'\n [ngModel]=\"getHexColor(value)\"\n (ngModelChange)=\"value = $event;onChange($event)\"\n [ngModelOptions]='{updateOn: \"blur\"}'/>\n", styles: [":host{display:inline-flex;align-items:center}input[type=color]{height:12px;width:12px;padding:0;border:0}input[type=color]::-webkit-color-swatch,input[type=color]::-webkit-color-swatch-wrapper{border:0;padding:0}\n"], dependencies: [{ kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2990
- }
2991
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ColorInputComponent, decorators: [{
2992
- type: Component,
2993
- args: [{ selector: 'teta-color-input', providers: [
2994
- {
2995
- provide: NG_VALUE_ACCESSOR,
2996
- useExisting: forwardRef(() => ColorInputComponent),
2997
- multi: true,
2998
- },
2999
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<input type='color'\n #input\n [disabled]='disabled'\n (blur)='emitBlur();'\n [ngModel]=\"getHexColor(value)\"\n (ngModelChange)=\"value = $event;onChange($event)\"\n [ngModelOptions]='{updateOn: \"blur\"}'/>\n", styles: [":host{display:inline-flex;align-items:center}input[type=color]{height:12px;width:12px;padding:0;border:0}input[type=color]::-webkit-color-swatch,input[type=color]::-webkit-color-swatch-wrapper{border:0;padding:0}\n"] }]
3000
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { disabled: [{
3001
- type: Input
3002
- }], input: [{
3003
- type: ViewChild,
3004
- args: ['input', { static: false }]
3005
- }], onFocus: [{
3006
- type: HostListener,
3007
- args: ['click']
3008
- }] } });
3009
-
3010
- class NumberPipeModule {
3011
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3012
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: NumberPipeModule, declarations: [NumberPipe], imports: [CommonModule], exports: [NumberPipe] });
3013
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberPipeModule, imports: [CommonModule] });
3014
- }
3015
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: NumberPipeModule, decorators: [{
3016
- type: NgModule,
3017
- args: [{
3018
- declarations: [NumberPipe],
3019
- exports: [
3020
- NumberPipe
3021
- ],
3022
- imports: [
3023
- CommonModule
3024
- ]
3025
- }]
3026
- }] });
3027
-
3028
- class InputModule {
3029
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: InputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3030
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: InputModule, declarations: [InputComponent, TextFieldComponent, FormGroupTitleComponent, ColorInputComponent], imports: [CommonModule, IconModule, FormsModule, OnlyNumberModule, HintModule, NumberPipeModule], exports: [InputComponent, TextFieldComponent, FormGroupTitleComponent, ColorInputComponent] });
3031
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: InputModule, imports: [CommonModule, IconModule, FormsModule, OnlyNumberModule, HintModule, NumberPipeModule] });
3032
2983
  }
3033
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: InputModule, decorators: [{
3034
- type: NgModule,
3035
- args: [{
3036
- declarations: [InputComponent, TextFieldComponent, FormGroupTitleComponent, ColorInputComponent],
3037
- exports: [InputComponent, TextFieldComponent, FormGroupTitleComponent, ColorInputComponent],
3038
- imports: [CommonModule, IconModule, FormsModule, OnlyNumberModule, HintModule, NumberPipeModule],
3039
- }]
3040
- }] });
3041
2984
 
3042
- class ClickOutsideDirective {
2985
+ const DATE_PICKER_CONTROL_VALUE_ACCESSOR = {
2986
+ provide: NG_VALUE_ACCESSOR,
2987
+ useExisting: forwardRef(() => DatePickerComponent),
2988
+ multi: true,
2989
+ };
2990
+ class DatePickerComponent extends BasePicker {
3043
2991
  _elementRef;
3044
- _ngZone;
3045
- clickOutside = new EventEmitter();
3046
- rightClick = false;
3047
- _handleEvents = false;
3048
- set tetaClickOutside(val) {
3049
- this._handleEvents = val;
3050
- if (this._handleEvents) {
3051
- this._ngZone.runOutsideAngular(() => {
3052
- setTimeout(() => {
3053
- this.addListener(this.rightClick);
3054
- });
3055
- });
2992
+ _cdr;
2993
+ datePipe;
2994
+ date = null;
2995
+ locale = 'ru';
2996
+ showTime = false;
2997
+ minDate = null;
2998
+ maxDate = null;
2999
+ invalid = false;
3000
+ disabled = false;
3001
+ align = Align.left;
3002
+ verticalAlign = VerticalAlign.auto;
3003
+ viewType = 'rounded';
3004
+ appendToBody;
3005
+ backdrop = false;
3006
+ allowNull = true;
3007
+ firstDayOfWeek = 1;
3008
+ disabledDates;
3009
+ disabledPeriods;
3010
+ disabledDays;
3011
+ minYearDate;
3012
+ maxYearDate;
3013
+ input;
3014
+ selectDate = new EventEmitter();
3015
+ selectedDate = new ReplaySubject(1);
3016
+ mask = '';
3017
+ classDatepicker = true;
3018
+ tabindex = 0;
3019
+ constructor(_elementRef, _cdr, datePipe) {
3020
+ super(_elementRef, _cdr, datePipe);
3021
+ this._elementRef = _elementRef;
3022
+ this._cdr = _cdr;
3023
+ this.datePipe = datePipe;
3024
+ }
3025
+ ngOnInit() {
3026
+ if (!this.date) {
3027
+ this.setDate(this.allowNull ? null : new Date());
3028
+ this.date = this.allowNull ? null : new Date();
3029
+ }
3030
+ else {
3031
+ this.setDate(new Date(this.date));
3032
+ }
3033
+ this.prepareInput();
3034
+ }
3035
+ prepareInput() {
3036
+ const str = this.date ? this.getLocaleString(this.date) : '';
3037
+ let option;
3038
+ const setMinMax = () => {
3039
+ if (this.minDate) {
3040
+ option.min = dayjs(new Date(this.minDate)).startOf('day');
3041
+ }
3042
+ if (this.maxDate) {
3043
+ option.max = dayjs(new Date(this.maxDate)).endOf('day');
3044
+ }
3045
+ };
3046
+ if (this.showTime) {
3047
+ this.mask = 'dd.mm.yyyy, hh:mm';
3048
+ option = {
3049
+ dateMode: 'dd/mm/yyyy',
3050
+ timeMode: 'HH:MM',
3051
+ dateSeparator: '.',
3052
+ };
3053
+ setMinMax();
3054
+ this.maskitoOptions = maskitoDateTimeOptionsGenerator(option);
3056
3055
  }
3057
3056
  else {
3058
- this.removeListener();
3057
+ this.mask = 'dd.mm.yyyy';
3058
+ option = {
3059
+ mode: 'dd/mm/yyyy',
3060
+ separator: '.',
3061
+ };
3062
+ setMinMax();
3063
+ this.maskitoOptions = maskitoDateOptionsGenerator(option);
3059
3064
  }
3065
+ this.changePlaceholder(str);
3060
3066
  }
3061
- get tetaClickOutside() {
3062
- return this._handleEvents;
3063
- }
3064
- constructor(_elementRef, _ngZone) {
3065
- this._elementRef = _elementRef;
3066
- this._ngZone = _ngZone;
3067
- }
3068
- ngOnDestroy() {
3069
- this.removeListener();
3067
+ onBlur() {
3068
+ if (this.allowNull && this.inputText.trim() === '') {
3069
+ this.setDate(null);
3070
+ this.emitValue(null);
3071
+ }
3072
+ else {
3073
+ const val = this.inputText.split(',');
3074
+ const { day, year, month } = this.getDateFromStr(val[0]);
3075
+ const { mins, hours } = this.getTimeFromStr(val[1]);
3076
+ if (day && year && month) {
3077
+ let date = new Date(year, month - 1, day);
3078
+ if (this.showTime) {
3079
+ date = new Date(date.setHours(hours || 0, mins || 0));
3080
+ }
3081
+ this.changeSelectedDate(this.getAvailableDate(this.minDate, this.maxDate, date));
3082
+ }
3083
+ else {
3084
+ this.setDate(this.date);
3085
+ }
3086
+ }
3070
3087
  }
3071
- addListener(handleRightClick) {
3072
- window.addEventListener('click', this.listener);
3073
- if (handleRightClick) {
3074
- window.addEventListener('contextmenu', this.listener);
3088
+ setDate(date) {
3089
+ if (!date && this.allowNull) {
3090
+ this.inputText = '';
3091
+ this.changePlaceholder('');
3092
+ this.selectedDate.next(new Date(this.minDate || new Date()));
3093
+ }
3094
+ else {
3095
+ this.inputText = this.getLocaleString(date);
3096
+ this.changePlaceholder(this.getLocaleString(date));
3097
+ this.selectedDate.next(date);
3075
3098
  }
3076
3099
  }
3077
- removeListener() {
3078
- window.removeEventListener('click', this.listener);
3079
- window.removeEventListener('contextmenu', this.listener);
3100
+ onChange(date) { }
3101
+ registerOnChange(fn) {
3102
+ this.onChange = fn;
3080
3103
  }
3081
- listener = (click) => {
3082
- if (!this._handleEvents) {
3083
- return;
3104
+ registerOnTouched(fn) { }
3105
+ writeValue(obj) {
3106
+ if (obj) {
3107
+ this.date = new Date(obj);
3108
+ this.setDate(new Date(this.date));
3084
3109
  }
3085
- const clickedInside = DomUtil.clickedInside(this._elementRef.nativeElement, click);
3086
- if (!clickedInside) {
3087
- this.clickOutside.emit(click);
3110
+ else {
3111
+ if (this.allowNull) {
3112
+ this.date = null;
3113
+ this.selectedDate.next(null);
3114
+ }
3115
+ else {
3116
+ this.date = this.minDate || new Date();
3117
+ this.selectedDate.next(this.minDate || new Date());
3118
+ }
3088
3119
  }
3089
- };
3090
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
3091
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: ClickOutsideDirective, selector: "[tetaClickOutside]", inputs: { rightClick: "rightClick", tetaClickOutside: "tetaClickOutside" }, outputs: { clickOutside: "clickOutside" }, ngImport: i0 });
3120
+ }
3121
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DatePickerComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.DatePipe }], target: i0.ɵɵFactoryTarget.Component });
3122
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DatePickerComponent, selector: "teta-date-picker", inputs: { date: "date", locale: "locale", showTime: "showTime", minDate: "minDate", maxDate: "maxDate", invalid: "invalid", disabled: "disabled", align: "align", verticalAlign: "verticalAlign", viewType: "viewType", appendToBody: "appendToBody", backdrop: "backdrop", allowNull: "allowNull", firstDayOfWeek: "firstDayOfWeek", disabledDates: "disabledDates", disabledPeriods: "disabledPeriods", disabledDays: "disabledDays", minYearDate: "minYearDate", maxYearDate: "maxYearDate" }, outputs: { selectDate: "selectDate" }, host: { properties: { "class.datepicker": "this.classDatepicker", "tabindex": "this.tabindex" } }, providers: [DATE_PICKER_CONTROL_VALUE_ACCESSOR, DatePipe], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<teta-dropdown *ngIf='{\n selectedDate:selectedDate | async\n } as data'\n class='row row_auto'\n [appendToBody]='appendToBody'\n [backdrop]='backdrop'\n [open]='open'\n (openChange)='openChange($event)'\n [viewType]='viewType'\n [disabled]='disabled'\n [verticalAlign]='verticalAlign'\n [align]='align'\n [autoCloseIgnore]=\"['esc', 'inside','enter']\">\n <div tetaDropdownHead\n [class]=\"'datepicker-head font-body-3 gap-8 datepicker_'+viewType\"\n [ngClass]=\"{'datepicker-head_invalid':invalid,'datepicker-head_disabled':disabled}\">\n <teta-input class='row row_auto flex'>\n <div [class]=\"'row_auto row datepicker_'+viewType\">\n <div class='row row_auto position-relative font-body-3 align-center'>\n <input [ngClass]=\"{'color-text-90':!disabled}\"\n [disabled]='disabled' #input style='z-index: 1'\n class='row_auto border-0'\n (keydown)='checkEnter($event)'\n [(ngModel)]='inputText'\n (ngModelChange)='changeInput($event)'\n [maskito]='maskitoOptions'>\n <div (click)='input.focus()' *ngIf='data.selectedDate||allowNull' class='position-absolute color-text-10'\n style='top:-0.3px;cursor: text;user-select: none'>{{placeholder}}</div>\n </div>\n <teta-icon [name]=\"'calendar'\" [palette]=\"'text'\"></teta-icon>\n </div>\n </teta-input>\n </div>\n <div tetaDropdownContent\n (click)='$event.preventDefault()'>\n <!-- <ng-container *ngIf='open'>-->\n <teta-date-calendar [isDateNull]='date===null'\n [open]='open'\n [max]='maxDate'\n [min]='minDate'\n (setDate)='changeSelectedDate($event)'\n [selectedDate]='data.selectedDate'\n [viewType]='viewType' [locale]='locale'></teta-date-calendar>\n <!-- </ng-container>-->\n </div>\n</teta-dropdown>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DropdownComponent, selector: "teta-dropdown", exportAs: ["dropdown"] }, { kind: "directive", type: DropdownHeadDirective, selector: "[tetaDropdownHead]" }, { kind: "directive", type: DropdownContentDirective, selector: "[tetaDropdownContent]" }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6.MaskitoDirective, selector: "[maskito]", inputs: ["maskito", "maskitoElement"] }, { kind: "directive", type: i6.MaskitoCva, selector: "input[maskito], textarea[maskito]", inputs: ["maskito"] }, { kind: "component", type: IconComponent, selector: "teta-icon", inputs: ["name", "size", "palette", "class"] }, { kind: "component", type: InputComponent, selector: "teta-input", inputs: ["label", "hint", "viewType", "horizontal", "required"] }, { kind: "component", type: DateCalendarComponent, selector: "teta-date-calendar", inputs: ["selectedDate", "locale", "open", "viewType", "min", "isDateNull", "max"], outputs: ["setDate"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3092
3123
  }
3093
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideDirective, decorators: [{
3094
- type: Directive,
3095
- args: [{
3096
- selector: '[tetaClickOutside]',
3097
- }]
3098
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { clickOutside: [{
3099
- type: Output
3100
- }], rightClick: [{
3124
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DatePickerComponent, decorators: [{
3125
+ type: Component,
3126
+ args: [{ selector: 'teta-date-picker', changeDetection: ChangeDetectionStrategy.OnPush, providers: [DATE_PICKER_CONTROL_VALUE_ACCESSOR, DatePipe], template: "<teta-dropdown *ngIf='{\n selectedDate:selectedDate | async\n } as data'\n class='row row_auto'\n [appendToBody]='appendToBody'\n [backdrop]='backdrop'\n [open]='open'\n (openChange)='openChange($event)'\n [viewType]='viewType'\n [disabled]='disabled'\n [verticalAlign]='verticalAlign'\n [align]='align'\n [autoCloseIgnore]=\"['esc', 'inside','enter']\">\n <div tetaDropdownHead\n [class]=\"'datepicker-head font-body-3 gap-8 datepicker_'+viewType\"\n [ngClass]=\"{'datepicker-head_invalid':invalid,'datepicker-head_disabled':disabled}\">\n <teta-input class='row row_auto flex'>\n <div [class]=\"'row_auto row datepicker_'+viewType\">\n <div class='row row_auto position-relative font-body-3 align-center'>\n <input [ngClass]=\"{'color-text-90':!disabled}\"\n [disabled]='disabled' #input style='z-index: 1'\n class='row_auto border-0'\n (keydown)='checkEnter($event)'\n [(ngModel)]='inputText'\n (ngModelChange)='changeInput($event)'\n [maskito]='maskitoOptions'>\n <div (click)='input.focus()' *ngIf='data.selectedDate||allowNull' class='position-absolute color-text-10'\n style='top:-0.3px;cursor: text;user-select: none'>{{placeholder}}</div>\n </div>\n <teta-icon [name]=\"'calendar'\" [palette]=\"'text'\"></teta-icon>\n </div>\n </teta-input>\n </div>\n <div tetaDropdownContent\n (click)='$event.preventDefault()'>\n <!-- <ng-container *ngIf='open'>-->\n <teta-date-calendar [isDateNull]='date===null'\n [open]='open'\n [max]='maxDate'\n [min]='minDate'\n (setDate)='changeSelectedDate($event)'\n [selectedDate]='data.selectedDate'\n [viewType]='viewType' [locale]='locale'></teta-date-calendar>\n <!-- </ng-container>-->\n </div>\n</teta-dropdown>\n" }]
3127
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.DatePipe }]; }, propDecorators: { date: [{
3101
3128
  type: Input
3102
- }], tetaClickOutside: [{
3129
+ }], locale: [{
3130
+ type: Input
3131
+ }], showTime: [{
3132
+ type: Input
3133
+ }], minDate: [{
3134
+ type: Input
3135
+ }], maxDate: [{
3136
+ type: Input
3137
+ }], invalid: [{
3138
+ type: Input
3139
+ }], disabled: [{
3140
+ type: Input
3141
+ }], align: [{
3142
+ type: Input
3143
+ }], verticalAlign: [{
3103
3144
  type: Input
3145
+ }], viewType: [{
3146
+ type: Input
3147
+ }], appendToBody: [{
3148
+ type: Input
3149
+ }], backdrop: [{
3150
+ type: Input
3151
+ }], allowNull: [{
3152
+ type: Input
3153
+ }], firstDayOfWeek: [{
3154
+ type: Input
3155
+ }], disabledDates: [{
3156
+ type: Input
3157
+ }], disabledPeriods: [{
3158
+ type: Input
3159
+ }], disabledDays: [{
3160
+ type: Input
3161
+ }], minYearDate: [{
3162
+ type: Input
3163
+ }], maxYearDate: [{
3164
+ type: Input
3165
+ }], input: [{
3166
+ type: ViewChild,
3167
+ args: ['input']
3168
+ }], selectDate: [{
3169
+ type: Output
3170
+ }], classDatepicker: [{
3171
+ type: HostBinding,
3172
+ args: ['class.datepicker']
3173
+ }], tabindex: [{
3174
+ type: HostBinding,
3175
+ args: ['tabindex']
3104
3176
  }] } });
3105
3177
 
3106
- class ClickOutsideModule {
3107
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3108
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideModule, declarations: [ClickOutsideDirective], imports: [CommonModule], exports: [ClickOutsideDirective] });
3109
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideModule, imports: [CommonModule] });
3110
- }
3111
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ClickOutsideModule, decorators: [{
3112
- type: NgModule,
3113
- args: [{
3114
- declarations: [ClickOutsideDirective],
3115
- exports: [ClickOutsideDirective],
3116
- imports: [
3117
- CommonModule
3118
- ]
3119
- }]
3120
- }] });
3121
-
3122
3178
  class RangeCalendarComponent extends BaseCalendar {
3123
3179
  _cdr;
3124
3180
  locale;
@@ -3146,7 +3202,7 @@ class RangeCalendarComponent extends BaseCalendar {
3146
3202
  this._cdr = _cdr;
3147
3203
  dayjs().locale('ru', { weekStart: 1 });
3148
3204
  combineLatest([this.currentYear, this.currentMonth, this.minMax])
3149
- .pipe(takeWhile(() => this.alive), shareReplay({ bufferSize: 1, refCount: false }), filter(([currentYear, currentMonth]) => currentMonth !== null && currentYear !== null), map$1(([year, month, minMax]) => {
3205
+ .pipe(takeWhile$1(() => this.alive), shareReplay({ bufferSize: 1, refCount: false }), filter$1(([currentYear, currentMonth]) => currentMonth !== null && currentYear !== null), map$1(([year, month, minMax]) => {
3150
3206
  const { availableYear, availableMonth } = this.getAvailableMonthYear(month + 1, year);
3151
3207
  return {
3152
3208
  currentMonth: this.generateCalendar(dayjs(new Date(this.selectedDate.from || new Date())).locale(this.locale), year, month, minMax),
@@ -3439,64 +3495,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
3439
3495
  type: Output
3440
3496
  }] } });
3441
3497
 
3442
- class ScrollIntoViewDirective {
3443
- platformId;
3444
- elementRef;
3445
- tetaScrollIntoView;
3446
- behavior = 'smooth';
3447
- block = 'end';
3448
- constructor(platformId, elementRef) {
3449
- this.platformId = platformId;
3450
- this.elementRef = elementRef;
3451
- }
3452
- ngOnChanges(simpleChange) {
3453
- if (isPlatformBrowser(this.platformId)) {
3454
- if (coerceBooleanProperty(this.tetaScrollIntoView)) {
3455
- this.elementRef.nativeElement.scrollIntoView({
3456
- behavior: 'smooth',
3457
- block: 'start'
3458
- });
3459
- }
3460
- }
3461
- }
3462
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewDirective, deps: [{ token: PLATFORM_ID }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
3463
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: ScrollIntoViewDirective, selector: "[tetaScrollIntoView]", inputs: { tetaScrollIntoView: "tetaScrollIntoView", behavior: "behavior", block: "block" }, usesOnChanges: true, ngImport: i0 });
3464
- }
3465
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewDirective, decorators: [{
3466
- type: Directive,
3467
- args: [{
3468
- selector: '[tetaScrollIntoView]'
3469
- }]
3470
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
3471
- type: Inject,
3472
- args: [PLATFORM_ID]
3473
- }] }, { type: i0.ElementRef }]; }, propDecorators: { tetaScrollIntoView: [{
3474
- type: Input
3475
- }], behavior: [{
3476
- type: Input
3477
- }], block: [{
3478
- type: Input
3479
- }] } });
3480
-
3481
- class ScrollIntoViewModule {
3482
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3483
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewModule, declarations: [ScrollIntoViewDirective], imports: [CommonModule], exports: [ScrollIntoViewDirective] });
3484
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewModule, imports: [CommonModule] });
3485
- }
3486
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: ScrollIntoViewModule, decorators: [{
3487
- type: NgModule,
3488
- args: [{
3489
- declarations: [
3490
- ScrollIntoViewDirective
3491
- ], exports: [
3492
- ScrollIntoViewDirective
3493
- ],
3494
- imports: [
3495
- CommonModule
3496
- ]
3497
- }]
3498
- }] });
3499
-
3500
3498
  class DatePickerModule {
3501
3499
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DatePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3502
3500
  static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: DatePickerModule, declarations: [DateCalendarComponent,
@@ -3510,12 +3508,27 @@ class DatePickerModule {
3510
3508
  ScrollToSelectedYearDirective,
3511
3509
  DateRangeComponent], imports: [CommonModule,
3512
3510
  DropdownModule,
3513
- ButtonModule, FormsModule, MaskitoModule,
3514
- IconModule, InputModule, ScrollIntoViewModule, ClickOutsideModule, ReactiveFormsModule], exports: [DatePickerComponent, DateCalendarComponent, RangeCalendarComponent, DateRangeComponent] });
3511
+ ButtonModule,
3512
+ FormsModule,
3513
+ MaskitoModule,
3514
+ IconModule,
3515
+ InputModule,
3516
+ ScrollIntoViewModule,
3517
+ ClickOutsideModule,
3518
+ ReactiveFormsModule], exports: [DatePickerComponent,
3519
+ DateCalendarComponent,
3520
+ RangeCalendarComponent,
3521
+ DateRangeComponent] });
3515
3522
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DatePickerModule, imports: [CommonModule,
3516
3523
  DropdownModule,
3517
- ButtonModule, FormsModule, MaskitoModule,
3518
- IconModule, InputModule, ScrollIntoViewModule, ClickOutsideModule, ReactiveFormsModule] });
3524
+ ButtonModule,
3525
+ FormsModule,
3526
+ MaskitoModule,
3527
+ IconModule,
3528
+ InputModule,
3529
+ ScrollIntoViewModule,
3530
+ ClickOutsideModule,
3531
+ ReactiveFormsModule] });
3519
3532
  }
3520
3533
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DatePickerModule, decorators: [{
3521
3534
  type: NgModule,
@@ -3530,15 +3543,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImpor
3530
3543
  ScrollToSelectedYearDirective,
3531
3544
  YearPickerComponent,
3532
3545
  ScrollToSelectedYearDirective,
3533
- DateRangeComponent
3546
+ DateRangeComponent,
3534
3547
  ],
3535
3548
  imports: [
3536
3549
  CommonModule,
3537
3550
  DropdownModule,
3538
- ButtonModule, FormsModule, MaskitoModule,
3539
- IconModule, InputModule, ScrollIntoViewModule, ClickOutsideModule, ReactiveFormsModule,
3551
+ ButtonModule,
3552
+ FormsModule,
3553
+ MaskitoModule,
3554
+ IconModule,
3555
+ InputModule,
3556
+ ScrollIntoViewModule,
3557
+ ClickOutsideModule,
3558
+ ReactiveFormsModule,
3559
+ ],
3560
+ exports: [
3561
+ DatePickerComponent,
3562
+ DateCalendarComponent,
3563
+ RangeCalendarComponent,
3564
+ DateRangeComponent,
3540
3565
  ],
3541
- exports: [DatePickerComponent, DateCalendarComponent, RangeCalendarComponent, DateRangeComponent]
3542
3566
  }]
3543
3567
  }] });
3544
3568
 
@@ -4449,7 +4473,7 @@ class ScrollableComponent {
4449
4473
  this._container = this._scrollDirective;
4450
4474
  }
4451
4475
  fromEvent(this._container.nativeElement, 'scroll')
4452
- .pipe(takeWhile$1(() => this._alive), tap((event) => {
4476
+ .pipe(takeWhile(() => this._alive), tap((event) => {
4453
4477
  this._scrollbarHorizontal.nativeElement.scrollLeft = event.target.scrollLeft;
4454
4478
  this._scrollbarVertical.nativeElement.scrollTop = event.target.scrollTop;
4455
4479
  // this._elementRef.nativeElement.dispatchEvent(event);
@@ -5129,7 +5153,7 @@ class FilterHostComponent {
5129
5153
  this._componentRef.injector.get(ChangeDetectorRef).detectChanges();
5130
5154
  this._init = true;
5131
5155
  this._componentRef.instance.filterChanged
5132
- .pipe(takeWhile$1((_) => this._alive))
5156
+ .pipe(takeWhile((_) => this._alive))
5133
5157
  .subscribe((filter) => {
5134
5158
  this.filterChanged.emit(filter);
5135
5159
  });
@@ -6128,7 +6152,7 @@ class MessageHostComponent {
6128
6152
  }
6129
6153
  ngOnInit() {
6130
6154
  this._svc.message
6131
- .pipe(takeWhile$1((_) => this._alive))
6155
+ .pipe(takeWhile((_) => this._alive))
6132
6156
  .subscribe((messages) => {
6133
6157
  if (messages) {
6134
6158
  if (!this.messages) {
@@ -6139,7 +6163,7 @@ class MessageHostComponent {
6139
6163
  this._cdr.markForCheck();
6140
6164
  });
6141
6165
  this._svc.clear
6142
- .pipe(takeWhile$1((_) => this._alive))
6166
+ .pipe(takeWhile((_) => this._alive))
6143
6167
  .subscribe((x) => {
6144
6168
  if (!x) {
6145
6169
  this.messages = [];
@@ -7185,7 +7209,7 @@ class PropertyGridItemComponent {
7185
7209
  this.formGroup.registerControl(this.column.name, FormsUtil.initControlFromColumn(this.column, this.item));
7186
7210
  this._formSub?.unsubscribe();
7187
7211
  this._formSub = this.formGroup?.controls[this.column.name]?.valueChanges
7188
- .pipe(takeWhile$1(() => this._alive))
7212
+ .pipe(takeWhile(() => this._alive))
7189
7213
  .subscribe((_) => {
7190
7214
  this.controlValueChange.emit({
7191
7215
  id: _,
@@ -7556,7 +7580,7 @@ class SwitchComponent {
7556
7580
  this.svc = svc;
7557
7581
  this.cdr = cdr;
7558
7582
  this.svc.value
7559
- .pipe(takeWhile$1((_) => this._alive), filter$1((_) => _ !== this._value))
7583
+ .pipe(takeWhile((_) => this._alive), filter((_) => _ !== this._value))
7560
7584
  .subscribe((_) => {
7561
7585
  this.onChange(_);
7562
7586
  this._value = _;
@@ -7616,7 +7640,7 @@ class SwitchButtonComponent {
7616
7640
  constructor(svc, cdr) {
7617
7641
  this.svc = svc;
7618
7642
  this.cdr = cdr;
7619
- this.svc.value.pipe(takeWhile$1((_) => this._alive)).subscribe((_) => {
7643
+ this.svc.value.pipe(takeWhile((_) => this._alive)).subscribe((_) => {
7620
7644
  this.svcValue = _;
7621
7645
  this.cdr.markForCheck();
7622
7646
  });
@@ -9804,7 +9828,7 @@ class TreeItemComponent {
9804
9828
  }
9805
9829
  ngOnInit() {
9806
9830
  this.service.openItems
9807
- .pipe(takeWhile$1((_) => this._alive))
9831
+ .pipe(takeWhile((_) => this._alive))
9808
9832
  .subscribe((_) => {
9809
9833
  const found = _?.find((x) => this.service.compareItems(x) ===
9810
9834
  this.service.compareItems(this.item));
@@ -9894,7 +9918,7 @@ class TreeComponent {
9894
9918
  this._cdr = _cdr;
9895
9919
  this._zone = _zone;
9896
9920
  this._service.openItems
9897
- .pipe(takeWhile$1((_) => this._alive), filter$1((_) => this._openItems !== _))
9921
+ .pipe(takeWhile((_) => this._alive), filter((_) => this._openItems !== _))
9898
9922
  .subscribe((_) => {
9899
9923
  this._openItems = _;
9900
9924
  this.displayData = this.getDisplayData(this._data, 0);
@@ -9923,7 +9947,7 @@ class TreeComponent {
9923
9947
  this.removeResizeObserver();
9924
9948
  }
9925
9949
  ngAfterViewInit() {
9926
- this._service.scrollToIndex.pipe(takeWhile$1(() => this._alive)).subscribe((index) => {
9950
+ this._service.scrollToIndex.pipe(takeWhile(() => this._alive)).subscribe((index) => {
9927
9951
  this._zone.runOutsideAngular(() => {
9928
9952
  setTimeout(() => {
9929
9953
  this.viewport?.scrollToIndex(index, 'smooth');
@@ -10056,7 +10080,7 @@ class VisibilityDropdownTabComponent {
10056
10080
  this._cdr = _cdr;
10057
10081
  this.locale = this._config.locale;
10058
10082
  this._svc.hiddenColumns
10059
- .pipe(takeWhile$1((_) => this._alive), map((_) => [..._]))
10083
+ .pipe(takeWhile((_) => this._alive), map((_) => [..._]))
10060
10084
  .subscribe((_) => {
10061
10085
  this.hiddenColumns = _;
10062
10086
  });
@@ -10385,7 +10409,7 @@ class TableHeadGroupComponent {
10385
10409
  this._svc = _svc;
10386
10410
  this._cdr = _cdr;
10387
10411
  this._svc.hiddenColumns
10388
- .pipe(takeWhile$1((_) => this._alive))
10412
+ .pipe(takeWhile((_) => this._alive))
10389
10413
  .subscribe((_) => {
10390
10414
  this._hiddenColumns = _;
10391
10415
  this._cdr.markForCheck();
@@ -10444,7 +10468,7 @@ class SelectionHeadCellComponent {
10444
10468
  }
10445
10469
  ngOnInit() {
10446
10470
  this._svc.selectedRows
10447
- .pipe(takeWhile$1((_) => this._alive))
10471
+ .pipe(takeWhile((_) => this._alive))
10448
10472
  .subscribe((_) => {
10449
10473
  this._cdr.markForCheck();
10450
10474
  });
@@ -10499,7 +10523,7 @@ class TableHeadComponent {
10499
10523
  }
10500
10524
  ngOnInit() {
10501
10525
  combineLatest([this._svc.columns, this._svc.hiddenColumns])
10502
- .pipe(takeWhile$1(_ => this._alive))
10526
+ .pipe(takeWhile(_ => this._alive))
10503
10527
  .subscribe((values) => {
10504
10528
  const [columns, hiddenColumns] = values;
10505
10529
  this._hiddenColumns = hiddenColumns;
@@ -10510,11 +10534,11 @@ class TableHeadComponent {
10510
10534
  this.lockedWidth = locked.reduce((prev, curr) => prev + curr.width, startWidth);
10511
10535
  this._cdr.markForCheck();
10512
10536
  });
10513
- this._svc.state.pipe(takeWhile$1(_ => this._alive)).subscribe(_ => {
10537
+ this._svc.state.pipe(takeWhile(_ => this._alive)).subscribe(_ => {
10514
10538
  this.state = _;
10515
10539
  this._cdr.markForCheck();
10516
10540
  });
10517
- this._svc.displayData.pipe(takeWhile$1(_ => this._alive)).subscribe(_ => {
10541
+ this._svc.displayData.pipe(takeWhile(_ => this._alive)).subscribe(_ => {
10518
10542
  this.data = _.map(_ => _.data);
10519
10543
  this._cdr.markForCheck();
10520
10544
  });
@@ -10615,7 +10639,7 @@ class CellComponentBase {
10615
10639
  ngOnInit() {
10616
10640
  this.init();
10617
10641
  this.formGroup?.controls[this.column.name]?.valueChanges
10618
- .pipe(takeWhile$1(() => this._alive))
10642
+ .pipe(takeWhile(() => this._alive))
10619
10643
  .subscribe(value => {
10620
10644
  this.formGroup.updateValueAndValidity();
10621
10645
  this.row.valid = this.formGroup?.valid;
@@ -10628,7 +10652,7 @@ class CellComponentBase {
10628
10652
  }
10629
10653
  init() {
10630
10654
  this.svc.editRowStart
10631
- .pipe(takeWhile$1(_ => this._alive))
10655
+ .pipe(takeWhile(_ => this._alive))
10632
10656
  .subscribe((cell) => {
10633
10657
  if (this.index === cell?.row && !this._edit) {
10634
10658
  this.start(cell, 'row');
@@ -10638,7 +10662,7 @@ class CellComponentBase {
10638
10662
  }
10639
10663
  });
10640
10664
  this.svc.editCellStart
10641
- .pipe(takeWhile$1(_ => this._alive))
10665
+ .pipe(takeWhile(_ => this._alive))
10642
10666
  .subscribe((cell) => {
10643
10667
  if (this.index === cell?.row &&
10644
10668
  this.column.name === cell?.column &&
@@ -10651,7 +10675,7 @@ class CellComponentBase {
10651
10675
  }
10652
10676
  });
10653
10677
  this.svc.valueSet
10654
- .pipe(takeWhile$1(_ => this._alive))
10678
+ .pipe(takeWhile(_ => this._alive))
10655
10679
  .subscribe((cellValue) => {
10656
10680
  if (this.index === cellValue.row &&
10657
10681
  this.column.name === cellValue.column) {
@@ -11003,7 +11027,7 @@ class SelectionCellComponent {
11003
11027
  }
11004
11028
  ngOnInit() {
11005
11029
  this._svc.selectedRows
11006
- .pipe(takeWhile$1((_) => this._alive))
11030
+ .pipe(takeWhile((_) => this._alive))
11007
11031
  .subscribe((_) => {
11008
11032
  this.selectedRows = _;
11009
11033
  this._cdr.markForCheck();
@@ -11090,24 +11114,24 @@ class TableBodyComponent {
11090
11114
  ngOnInit() {
11091
11115
  this.locale = this._config.locale;
11092
11116
  combineLatest([this._svc.columns, this._svc.hiddenColumns])
11093
- .pipe(takeWhile$1(_ => this._alive))
11117
+ .pipe(takeWhile(_ => this._alive))
11094
11118
  .subscribe((values) => {
11095
11119
  const [columns, hiddenColumns] = values;
11096
11120
  this._hiddenColumns = hiddenColumns;
11097
11121
  this.columns = ArrayUtil.flatten(columns, 'columns', true).filter(_ => this._hiddenColumns.indexOf(_.name) < 0);
11098
11122
  this._cdr.markForCheck();
11099
11123
  });
11100
- this._svc.displayData.pipe(takeWhile$1(_ => this._alive)).subscribe(_ => {
11124
+ this._svc.displayData.pipe(takeWhile(_ => this._alive)).subscribe(_ => {
11101
11125
  this.data = _;
11102
11126
  this._cdr.markForCheck();
11103
11127
  this.viewport?.checkViewportSize();
11104
11128
  });
11105
- this._svc.dict.pipe(takeWhile$1(_ => this._alive)).subscribe(_ => {
11129
+ this._svc.dict.pipe(takeWhile(_ => this._alive)).subscribe(_ => {
11106
11130
  this.dict = _;
11107
11131
  this._cdr.markForCheck();
11108
11132
  });
11109
11133
  this._svc.scrollIndex
11110
- .pipe(takeWhile$1(() => this._alive))
11134
+ .pipe(takeWhile(() => this._alive))
11111
11135
  .subscribe(async (index) => {
11112
11136
  if (this.viewport) {
11113
11137
  this.viewport.scrollToIndex(index, 'auto');
@@ -11118,7 +11142,7 @@ class TableBodyComponent {
11118
11142
  }
11119
11143
  this._cdr.markForCheck();
11120
11144
  });
11121
- this._svc.activeRow.pipe(takeWhile$1(_ => this._alive)).subscribe(async (_) => {
11145
+ this._svc.activeRow.pipe(takeWhile(_ => this._alive)).subscribe(async (_) => {
11122
11146
  this.activeRow = _;
11123
11147
  this._cdr.markForCheck();
11124
11148
  });
@@ -11288,34 +11312,34 @@ class TableComponent {
11288
11312
  this._svc = _svc;
11289
11313
  this._elementRef = _elementRef;
11290
11314
  this._svc.state
11291
- .pipe(takeWhile$1(() => this._alive), filter$1(state => state !== this._state))
11315
+ .pipe(takeWhile(() => this._alive), filter(state => state !== this._state))
11292
11316
  .subscribe((state) => this.stateChange.next(state));
11293
11317
  this._svc.editCellStart
11294
- .pipe(takeWhile$1(() => this._alive))
11318
+ .pipe(takeWhile(() => this._alive))
11295
11319
  .subscribe((item) => this.cellEditStart.emit(this._svc.getCellInstance(item)));
11296
11320
  this._svc.editCellStop
11297
- .pipe(takeWhile$1(() => this._alive))
11321
+ .pipe(takeWhile(() => this._alive))
11298
11322
  .subscribe((item) => this.cellEditEnd.emit(this._svc.getCellInstance(item)));
11299
11323
  this._svc.editRowStart
11300
- .pipe(takeWhile$1(() => this._alive))
11324
+ .pipe(takeWhile(() => this._alive))
11301
11325
  .subscribe((item) => this.rowEditStart.emit(this._svc.getCellInstance(item)));
11302
11326
  this._svc.editRowStop
11303
- .pipe(takeWhile$1(() => this._alive))
11327
+ .pipe(takeWhile(() => this._alive))
11304
11328
  .subscribe((item) => this.rowEditEnd.emit(this._svc.getRowByIndex(item?.row)));
11305
11329
  this._svc.selectedRows
11306
- .pipe(takeWhile$1(() => this._alive))
11330
+ .pipe(takeWhile(() => this._alive))
11307
11331
  .subscribe((items) => {
11308
11332
  this.selectedRowsList = items;
11309
11333
  this.selectedRowsChange.emit(items);
11310
11334
  });
11311
11335
  this._svc.activeRow
11312
- .pipe(takeWhile$1(() => this._alive))
11336
+ .pipe(takeWhile(() => this._alive))
11313
11337
  .subscribe((item) => {
11314
11338
  this.activeRow = item;
11315
11339
  this.activeRowChange.emit(item);
11316
11340
  });
11317
11341
  this._svc.valueChanged
11318
- .pipe(takeWhile$1(() => this._alive))
11342
+ .pipe(takeWhile(() => this._alive))
11319
11343
  .subscribe((coordinates) => {
11320
11344
  this.valueChange.emit(this._svc.getCellInstance(coordinates));
11321
11345
  });
@@ -11794,11 +11818,11 @@ class DateTimeCellComponent extends CellComponentBase {
11794
11818
  this.cdr.markForCheck();
11795
11819
  }
11796
11820
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DateTimeCellComponent, deps: [{ token: TableService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
11797
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DateTimeCellComponent, selector: "teta-date-time-cell", viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<span [style.display]=\"edit ? 'none' : 'block'\"\n class='cell-text'\n [class.cell-text_disabled]='!editable'>\n {{control?.value | date : 'dd.MM.yyyy HH:mm:ss'}}\n</span>\n<teta-date-picker class='datepicker-table' #input\n *ngIf='edit'\n [appendToBody]='true'\n [showTime]='true'\n [formControl]='control'\n></teta-date-picker>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: DatePickerComponent, selector: "teta-date-picker", inputs: ["date", "locale", "showTime", "minDate", "maxDate", "invalid", "disabled", "align", "verticalAlign", "viewType", "appendToBody", "backdrop", "allowNull", "firstDayOfWeek", "disabledDates", "disabledPeriods", "disabledDays", "minYearDate", "maxYearDate"], outputs: ["selectDate"] }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: i1.DatePipe, name: "date" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
11821
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: DateTimeCellComponent, selector: "teta-date-time-cell", viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<span [style.display]=\"edit ? 'none' : 'block'\"\n class='cell-text'\n [class.cell-text_disabled]='!editable'>\n {{control?.value | date : 'dd.MM.yyyy HH:mm:ss'}}\n</span>\n<teta-date-picker class='datepicker-table'\n #input\n *ngIf='edit'\n [appendToBody]='true'\n [showTime]='true'\n [formControl]='control'\n></teta-date-picker>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "component", type: DatePickerComponent, selector: "teta-date-picker", inputs: ["date", "locale", "showTime", "minDate", "maxDate", "invalid", "disabled", "align", "verticalAlign", "viewType", "appendToBody", "backdrop", "allowNull", "firstDayOfWeek", "disabledDates", "disabledPeriods", "disabledDays", "minYearDate", "maxYearDate"], outputs: ["selectDate"] }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: i1.DatePipe, name: "date" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
11798
11822
  }
11799
11823
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DateTimeCellComponent, decorators: [{
11800
11824
  type: Component,
11801
- args: [{ selector: 'teta-date-time-cell', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span [style.display]=\"edit ? 'none' : 'block'\"\n class='cell-text'\n [class.cell-text_disabled]='!editable'>\n {{control?.value | date : 'dd.MM.yyyy HH:mm:ss'}}\n</span>\n<teta-date-picker class='datepicker-table' #input\n *ngIf='edit'\n [appendToBody]='true'\n [showTime]='true'\n [formControl]='control'\n></teta-date-picker>\n" }]
11825
+ args: [{ selector: 'teta-date-time-cell', changeDetection: ChangeDetectionStrategy.OnPush, template: "<span [style.display]=\"edit ? 'none' : 'block'\"\n class='cell-text'\n [class.cell-text_disabled]='!editable'>\n {{control?.value | date : 'dd.MM.yyyy HH:mm:ss'}}\n</span>\n<teta-date-picker class='datepicker-table'\n #input\n *ngIf='edit'\n [appendToBody]='true'\n [showTime]='true'\n [formControl]='control'\n></teta-date-picker>\n" }]
11802
11826
  }], ctorParameters: function () { return [{ type: TableService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { input: [{
11803
11827
  type: ViewChild,
11804
11828
  args: ['input', { static: false }]
@@ -12253,7 +12277,7 @@ class Axes3dComponent {
12253
12277
  this.axes = combineLatest([
12254
12278
  this.chartService.scales,
12255
12279
  this.chartService.minMax,
12256
- ]).pipe(takeWhile(() => this._alive), map$1(([scales, minMax]) => {
12280
+ ]).pipe(takeWhile$1(() => this._alive), map$1(([scales, minMax]) => {
12257
12281
  return this.createAxes(scales, minMax);
12258
12282
  }));
12259
12283
  }
@@ -12281,11 +12305,11 @@ class Axes3dComponent {
12281
12305
  this._alive = false;
12282
12306
  }
12283
12307
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: Axes3dComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
12284
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: Axes3dComponent, isStandalone: true, selector: "teta-axes-3d", inputs: { rotation: "rotation" }, ngImport: i0, template: "<ng-container *ngIf=\"{axes:axes|async}as data\">\n<ngts-text *ngFor=\"let tick of data.axes?.y;let i=index\" [text]=\"tick.value+'-'\"\n [color]=\"'var(--color-text-90)'\"\n [rotation]=\"rotation\"\n [fontSize]=\"2.5\"\n [position]=\"[0,tick.position,50]\"\n [anchorX]=\"'right'\"\n [anchorY]=\"'middle'\"\n [textAlign]=\"'right'\"\n></ngts-text>\n<ngts-text *ngFor=\"let tick of data.axes?.z;let i=index\" [text]=\"tick.value\"\n [color]=\"'var(--color-text-90)'\"\n [rotation]=\"rotation\"\n [fontSize]=\"2.5\"\n [position]=\"[25,-50,tick.position]\"\n ></ngts-text>\n</ng-container>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "component", type: NgtsText, selector: "ngts-text[text]", inputs: ["textRef", "text", "characters", "font", "anchorX", "anchorY"], outputs: ["sync"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
12308
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: Axes3dComponent, isStandalone: true, selector: "teta-axes-3d", inputs: { rotation: "rotation" }, ngImport: i0, template: "<ng-container *ngIf=\"{axes:axes|async}as data\">\n <ngts-text *ngFor='let tick of data.axes?.y;let i=index'\n [text]=\"tick.value+'-'\"\n [color]=\"'var(--color-text-90)'\"\n [rotation]='rotation'\n [fontSize]='2.5'\n [position]='[0,tick.position,50]'\n [anchorX]=\"'right'\"\n [anchorY]=\"'middle'\"\n [textAlign]=\"'right'\"\n ></ngts-text>\n <ngts-text *ngFor='let tick of data.axes?.z;let i=index'\n [text]='tick.value'\n [color]=\"'var(--color-text-90)'\"\n [rotation]='rotation'\n [fontSize]='2.5'\n [position]='[25,-50,tick.position]'\n ></ngts-text>\n</ng-container>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "component", type: NgtsText, selector: "ngts-text[text]", inputs: ["textRef", "text", "characters", "font", "anchorX", "anchorY"], outputs: ["sync"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
12285
12309
  }
12286
12310
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: Axes3dComponent, decorators: [{
12287
12311
  type: Component,
12288
- args: [{ selector: 'teta-axes-3d', standalone: true, imports: [CommonModule, NgtsText], schemas: [CUSTOM_ELEMENTS_SCHEMA], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{axes:axes|async}as data\">\n<ngts-text *ngFor=\"let tick of data.axes?.y;let i=index\" [text]=\"tick.value+'-'\"\n [color]=\"'var(--color-text-90)'\"\n [rotation]=\"rotation\"\n [fontSize]=\"2.5\"\n [position]=\"[0,tick.position,50]\"\n [anchorX]=\"'right'\"\n [anchorY]=\"'middle'\"\n [textAlign]=\"'right'\"\n></ngts-text>\n<ngts-text *ngFor=\"let tick of data.axes?.z;let i=index\" [text]=\"tick.value\"\n [color]=\"'var(--color-text-90)'\"\n [rotation]=\"rotation\"\n [fontSize]=\"2.5\"\n [position]=\"[25,-50,tick.position]\"\n ></ngts-text>\n</ng-container>\n" }]
12312
+ args: [{ selector: 'teta-axes-3d', standalone: true, imports: [CommonModule, NgtsText], schemas: [CUSTOM_ELEMENTS_SCHEMA], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"{axes:axes|async}as data\">\n <ngts-text *ngFor='let tick of data.axes?.y;let i=index'\n [text]=\"tick.value+'-'\"\n [color]=\"'var(--color-text-90)'\"\n [rotation]='rotation'\n [fontSize]='2.5'\n [position]='[0,tick.position,50]'\n [anchorX]=\"'right'\"\n [anchorY]=\"'middle'\"\n [textAlign]=\"'right'\"\n ></ngts-text>\n <ngts-text *ngFor='let tick of data.axes?.z;let i=index'\n [text]='tick.value'\n [color]=\"'var(--color-text-90)'\"\n [rotation]='rotation'\n [fontSize]='2.5'\n [position]='[25,-50,tick.position]'\n ></ngts-text>\n</ng-container>\n" }]
12289
12313
  }], ctorParameters: function () { return []; }, propDecorators: { rotation: [{
12290
12314
  type: Input
12291
12315
  }] } });
@@ -12301,7 +12325,7 @@ class Block3dComponent extends Base3dSeriesComponent {
12301
12325
  super(svc, ngtStore);
12302
12326
  this.svc = svc;
12303
12327
  this.ngtStore = ngtStore;
12304
- this.blocks = this.svc.scales.pipe(takeWhile(() => this._alive), map$1(scales => {
12328
+ this.blocks = this.svc.scales.pipe(takeWhile$1(() => this._alive), map$1(scales => {
12305
12329
  return this.series?.data?.map(_ => {
12306
12330
  return this.createSVGTexture(scales.y(_?.y), scales.y(_?.y1), _?.iconId);
12307
12331
  });
@@ -12367,7 +12391,7 @@ class Line3dComponent extends Base3dSeriesComponent {
12367
12391
  super(svc, ngtStore);
12368
12392
  this.svc = svc;
12369
12393
  this.ngtStore = ngtStore;
12370
- this.points = this.svc.scales.pipe(takeWhile(() => this._alive), map$1(scales => {
12394
+ this.points = this.svc.scales.pipe(takeWhile$1(() => this._alive), map$1(scales => {
12371
12395
  return this.getPoints(scales);
12372
12396
  }));
12373
12397
  }
@@ -12530,7 +12554,7 @@ class Chart3dComponent {
12530
12554
  }
12531
12555
  ngOnInit() {
12532
12556
  this._themeService.theme
12533
- .pipe(takeWhile$1((_) => this._alive), tap$1((_) => {
12557
+ .pipe(takeWhile((_) => this._alive), tap$1((_) => {
12534
12558
  this.gridColor = _ ? '#5d6a73' : '#bdbdc6';
12535
12559
  this.axesColor = _ ? '#8e8f9d' : '#7d8f9a';
12536
12560
  this.init();
@@ -13001,7 +13025,7 @@ class AutoPositionDirective {
13001
13025
  }
13002
13026
  ngAfterViewInit() {
13003
13027
  this.setPosition();
13004
- this._zone.onStable.pipe(takeWhile$1(() => this._alive)).subscribe(() => {
13028
+ this._zone.onStable.pipe(takeWhile(() => this._alive)).subscribe(() => {
13005
13029
  this.setPosition();
13006
13030
  });
13007
13031
  }
@@ -13165,7 +13189,7 @@ class DragDropService {
13165
13189
  this._renderer = this._rendererFactory.createRenderer(null, null);
13166
13190
  this.dropTarget = this.dropTarget$.asObservable();
13167
13191
  this.dropped = this.dropped$.asObservable();
13168
- merge(fromEvent(this._document, 'mousemove'), fromEvent(this._document, 'touchmove')).pipe(filter$1(() => {
13192
+ merge(fromEvent(this._document, 'mousemove'), fromEvent(this._document, 'touchmove')).pipe(filter(() => {
13169
13193
  return this.startPosition != null;
13170
13194
  })).subscribe((event) => {
13171
13195
  if (!this.dragProcess && this.getDelta(event) > this._delta) {
@@ -13334,12 +13358,12 @@ class DragContainerDirective {
13334
13358
  previewTemplate: this._previewTemplate?.templateRef,
13335
13359
  viewContainer: this._viewContainerRef
13336
13360
  });
13337
- this._dragService.dropTarget.pipe(takeWhile$1(() => this._alive))
13361
+ this._dragService.dropTarget.pipe(takeWhile(() => this._alive))
13338
13362
  .subscribe((target) => {
13339
13363
  this.dropTarget = target;
13340
13364
  this._cdr.detectChanges();
13341
13365
  });
13342
- this._dragService.dropped.pipe(takeWhile$1(() => this._alive))
13366
+ this._dragService.dropped.pipe(takeWhile(() => this._alive))
13343
13367
  .subscribe((event) => {
13344
13368
  this.tetaDrop.emit(event);
13345
13369
  });
@@ -13455,7 +13479,7 @@ class DragDirective {
13455
13479
  data: this.data,
13456
13480
  });
13457
13481
  this._dragService.dropTarget
13458
- .pipe(takeWhile$1(() => this._alive))
13482
+ .pipe(takeWhile(() => this._alive))
13459
13483
  .subscribe(target => {
13460
13484
  this.dropTarget = target;
13461
13485
  if (target === this.instance) {
@@ -13465,8 +13489,8 @@ class DragDirective {
13465
13489
  this._cdr.markForCheck();
13466
13490
  });
13467
13491
  this._dragService.dropped
13468
- .pipe(takeWhile$1(() => this._alive))
13469
- .pipe(filter$1((event) => {
13492
+ .pipe(takeWhile(() => this._alive))
13493
+ .pipe(filter((event) => {
13470
13494
  return event.target === this.instance;
13471
13495
  }))
13472
13496
  .subscribe(event => {
@@ -13800,7 +13824,7 @@ class LoaderDirective {
13800
13824
  this._document = _document;
13801
13825
  this._zone = _zone;
13802
13826
  this._element = this._elementRef.nativeElement;
13803
- this._zone.onStable.pipe(takeWhile$1(_ => this._alive)).subscribe(_ => {
13827
+ this._zone.onStable.pipe(takeWhile(_ => this._alive)).subscribe(_ => {
13804
13828
  if (this._loading && this._loader) {
13805
13829
  this.setPosition();
13806
13830
  }
@@ -13907,7 +13931,7 @@ class TooltipDirective extends DynamicContentBaseDirective {
13907
13931
  }
13908
13932
  ngOnInit() {
13909
13933
  merge(this._click.click, this._click.contextMenu)
13910
- .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()))
13934
+ .pipe(takeWhile(() => this._alive), filter(() => this._open), filter(() => this._componentRef != null), filter((event) => !DomUtil.clickedInside(this._elementRef.nativeElement, event)), filter((event) => !DomUtil.clickedInside(this._componentRef?.location.nativeElement, event)), tap$1(_ => this.destroyContentRef()))
13911
13935
  .subscribe();
13912
13936
  }
13913
13937
  setPosition() {