@datarailsshared/datarailsshared 1.4.112 → 1.4.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/datarailsshared-datarailsshared.umd.js +83 -31
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.4.113.tgz +0 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/lib/dr-dialog/components/dialog-wrapper/dialog-wrapper.component.js +1 -1
- package/esm2015/lib/dr-error/dr-error.component.js +21 -7
- package/esm2015/lib/dr-inputs/date-pickers/dr-date-picker-with-timeframe/dr-date-picker-with-timeframe.component.js +30 -10
- package/esm2015/lib/dr-tooltip/dr-tooltip.directive.js +18 -6
- package/fesm2015/datarailsshared-datarailsshared.js +74 -30
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/dr-error/dr-error.component.d.ts +5 -2
- package/lib/dr-inputs/date-pickers/dr-date-picker-with-timeframe/dr-date-picker-with-timeframe.component.d.ts +8 -8
- package/lib/dr-tooltip/dr-tooltip.directive.d.ts +4 -1
- package/package.json +1 -1
- package/datarailsshared-datarailsshared-1.4.112.tgz +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetectionStrategy, ChangeDetectorRef, forwardRef, ElementRef, Inject, PLATFORM_ID, ContentChildren, Renderer2, HostBinding, ContentChild, Pipe, TemplateRef, HostListener, Directive, ComponentFactoryResolver, ViewContainerRef, ViewChild, Injector, Injectable, Host,
|
|
3
|
-
import { FormControl, NG_VALUE_ACCESSOR, FormGroup, NgModel, FormsModule, ReactiveFormsModule, NgControl } from '@angular/forms';
|
|
2
|
+
import { EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetectionStrategy, ChangeDetectorRef, forwardRef, ElementRef, Inject, PLATFORM_ID, ContentChildren, Renderer2, HostBinding, ContentChild, Pipe, TemplateRef, HostListener, Directive, ComponentFactoryResolver, ViewContainerRef, ViewChild, Injector, Injectable, Host, Optional, NgModule } from '@angular/core';
|
|
3
|
+
import { FormControl, NG_VALUE_ACCESSOR, FormGroupDirective, FormGroup, NgModel, FormsModule, ReactiveFormsModule, NgControl } from '@angular/forms';
|
|
4
4
|
import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS, MatNativeDateModule } from '@angular/material/core';
|
|
5
5
|
import { MomentDateAdapter, MAT_MOMENT_DATE_ADAPTER_OPTIONS, MatMomentDateModule } from '@angular/material-moment-adapter';
|
|
6
6
|
import * as momentImported from 'moment';
|
|
@@ -251,7 +251,7 @@ const MONTH_FORMATS = {
|
|
|
251
251
|
monthYearA11yLabel: 'MMMM YYYY'
|
|
252
252
|
},
|
|
253
253
|
};
|
|
254
|
-
const ɵ0$
|
|
254
|
+
const ɵ0$8 = MONTH_FORMATS;
|
|
255
255
|
class MonthTagComponent extends AnyTagComponent {
|
|
256
256
|
constructor() {
|
|
257
257
|
super();
|
|
@@ -310,7 +310,7 @@ MonthTagComponent.decorators = [
|
|
|
310
310
|
useClass: MomentDateAdapter,
|
|
311
311
|
deps: [MAT_DATE_LOCALE, MAT_MOMENT_DATE_ADAPTER_OPTIONS],
|
|
312
312
|
},
|
|
313
|
-
{ provide: MAT_DATE_FORMATS, useValue: ɵ0$
|
|
313
|
+
{ provide: MAT_DATE_FORMATS, useValue: ɵ0$8 },
|
|
314
314
|
]
|
|
315
315
|
},] }
|
|
316
316
|
];
|
|
@@ -432,7 +432,7 @@ const WEEK_FORMATS = {
|
|
|
432
432
|
monthYearA11yLabel: 'MMMM YYYY'
|
|
433
433
|
},
|
|
434
434
|
};
|
|
435
|
-
const ɵ0$
|
|
435
|
+
const ɵ0$7 = WEEK_FORMATS;
|
|
436
436
|
class WeekTagComponent extends AnyTagComponent {
|
|
437
437
|
constructor() {
|
|
438
438
|
super();
|
|
@@ -528,7 +528,7 @@ WeekTagComponent.decorators = [
|
|
|
528
528
|
useClass: MomentDateAdapter,
|
|
529
529
|
deps: [MAT_DATE_LOCALE, MAT_MOMENT_DATE_ADAPTER_OPTIONS],
|
|
530
530
|
},
|
|
531
|
-
{ provide: MAT_DATE_FORMATS, useValue: ɵ0$
|
|
531
|
+
{ provide: MAT_DATE_FORMATS, useValue: ɵ0$7 },
|
|
532
532
|
]
|
|
533
533
|
},] }
|
|
534
534
|
];
|
|
@@ -550,7 +550,7 @@ const YEAR_FORMATS = {
|
|
|
550
550
|
monthYearA11yLabel: 'MMMM YYYY'
|
|
551
551
|
},
|
|
552
552
|
};
|
|
553
|
-
const ɵ0$
|
|
553
|
+
const ɵ0$6 = YEAR_FORMATS;
|
|
554
554
|
class YearTagComponent extends AnyTagComponent {
|
|
555
555
|
constructor() {
|
|
556
556
|
super();
|
|
@@ -615,7 +615,7 @@ YearTagComponent.decorators = [
|
|
|
615
615
|
useClass: MomentDateAdapter,
|
|
616
616
|
deps: [MAT_DATE_LOCALE, MAT_MOMENT_DATE_ADAPTER_OPTIONS],
|
|
617
617
|
},
|
|
618
|
-
{ provide: MAT_DATE_FORMATS, useValue: ɵ0$
|
|
618
|
+
{ provide: MAT_DATE_FORMATS, useValue: ɵ0$6 },
|
|
619
619
|
]
|
|
620
620
|
},] }
|
|
621
621
|
];
|
|
@@ -729,7 +729,7 @@ const DAY_FORMATS = {
|
|
|
729
729
|
monthYearA11yLabel: 'MMMM YYYY'
|
|
730
730
|
},
|
|
731
731
|
};
|
|
732
|
-
const ɵ0$
|
|
732
|
+
const ɵ0$5 = DAY_FORMATS;
|
|
733
733
|
class DayTagComponent extends AnyTagComponent {
|
|
734
734
|
constructor() {
|
|
735
735
|
super();
|
|
@@ -780,7 +780,7 @@ DayTagComponent.decorators = [
|
|
|
780
780
|
useClass: MomentDateAdapter,
|
|
781
781
|
deps: [MAT_DATE_LOCALE, MAT_MOMENT_DATE_ADAPTER_OPTIONS],
|
|
782
782
|
},
|
|
783
|
-
{ provide: MAT_DATE_FORMATS, useValue: ɵ0$
|
|
783
|
+
{ provide: MAT_DATE_FORMATS, useValue: ɵ0$5 },
|
|
784
784
|
]
|
|
785
785
|
},] }
|
|
786
786
|
];
|
|
@@ -1553,26 +1553,37 @@ TooltipComponent.propDecorators = {
|
|
|
1553
1553
|
unsetMouseOn: [{ type: HostListener, args: ['mouseleave',] }]
|
|
1554
1554
|
};
|
|
1555
1555
|
|
|
1556
|
+
const getOverlayPosition = (position) => (Object.assign({}, POPUP_POSITIONS[position]));
|
|
1557
|
+
const ɵ0$4 = getOverlayPosition;
|
|
1556
1558
|
class DrTooltipDirective {
|
|
1557
1559
|
constructor(overlay, overlayPositionBuilder, elementRef) {
|
|
1558
1560
|
this.overlay = overlay;
|
|
1559
1561
|
this.overlayPositionBuilder = overlayPositionBuilder;
|
|
1560
1562
|
this.elementRef = elementRef;
|
|
1561
1563
|
this.contentContext = {};
|
|
1562
|
-
this.
|
|
1564
|
+
this._position = 'top';
|
|
1563
1565
|
this.class = '';
|
|
1564
1566
|
// is used for preserve tooltip from being hidden for N milliseconds
|
|
1565
1567
|
this.drTooltipMousleaveTimeout = 0;
|
|
1568
|
+
this.overlayPosition = getOverlayPosition(this.position);
|
|
1569
|
+
}
|
|
1570
|
+
get position() {
|
|
1571
|
+
return this._position;
|
|
1572
|
+
}
|
|
1573
|
+
set position(value) {
|
|
1574
|
+
this._position = value;
|
|
1575
|
+
this.overlayPosition = getOverlayPosition(value);
|
|
1566
1576
|
}
|
|
1567
1577
|
set drTooltipOptions(options) {
|
|
1568
1578
|
if (options === null || options === void 0 ? void 0 : options.indent) {
|
|
1569
|
-
const position =
|
|
1570
|
-
if (position.offsetY) {
|
|
1579
|
+
const position = getOverlayPosition(this.position);
|
|
1580
|
+
if (position === null || position === void 0 ? void 0 : position.offsetY) {
|
|
1571
1581
|
position.offsetY = position.offsetY < 0 ? -options.indent : options.indent;
|
|
1572
1582
|
}
|
|
1573
|
-
if (position.offsetX) {
|
|
1583
|
+
if (position === null || position === void 0 ? void 0 : position.offsetX) {
|
|
1574
1584
|
position.offsetX = position.offsetX < 0 ? -options.indent : options.indent;
|
|
1575
1585
|
}
|
|
1586
|
+
this.overlayPosition = position;
|
|
1576
1587
|
}
|
|
1577
1588
|
this.options = options;
|
|
1578
1589
|
}
|
|
@@ -1627,7 +1638,7 @@ class DrTooltipDirective {
|
|
|
1627
1638
|
}
|
|
1628
1639
|
}
|
|
1629
1640
|
createOverlay() {
|
|
1630
|
-
const positionStrategy = this.overlayPositionBuilder.flexibleConnectedTo(this.elementRef).withPositions([
|
|
1641
|
+
const positionStrategy = this.overlayPositionBuilder.flexibleConnectedTo(this.elementRef).withPositions([this.overlayPosition]);
|
|
1631
1642
|
this.overlayRef = this.overlay.create({ positionStrategy });
|
|
1632
1643
|
}
|
|
1633
1644
|
renderTooltip() {
|
|
@@ -2972,10 +2983,12 @@ DrLayoutBodyComponent.decorators = [
|
|
|
2972
2983
|
DrLayoutBodyComponent.ctorParameters = () => [];
|
|
2973
2984
|
|
|
2974
2985
|
class DrErrorComponent {
|
|
2975
|
-
constructor(cdr) {
|
|
2986
|
+
constructor(cdr, formGroupDirective) {
|
|
2976
2987
|
this.cdr = cdr;
|
|
2988
|
+
this.formGroupDirective = formGroupDirective;
|
|
2977
2989
|
this.destroyed$ = new Subject();
|
|
2978
2990
|
this.label = 'Field error';
|
|
2991
|
+
this.noIcon = false;
|
|
2979
2992
|
}
|
|
2980
2993
|
set control(value) {
|
|
2981
2994
|
if (value) {
|
|
@@ -2986,6 +2999,14 @@ class DrErrorComponent {
|
|
|
2986
2999
|
});
|
|
2987
3000
|
}
|
|
2988
3001
|
}
|
|
3002
|
+
set controlName(value) {
|
|
3003
|
+
if (!value || typeof value !== 'string')
|
|
3004
|
+
return;
|
|
3005
|
+
if (!this.formGroupDirective) {
|
|
3006
|
+
throw new Error('You must provide a formGroupDirective to use this input');
|
|
3007
|
+
}
|
|
3008
|
+
this.control = this.formGroupDirective.control.get(value);
|
|
3009
|
+
}
|
|
2989
3010
|
get errorString() {
|
|
2990
3011
|
var _a;
|
|
2991
3012
|
if (this._control.hasError('required')) {
|
|
@@ -3004,18 +3025,21 @@ class DrErrorComponent {
|
|
|
3004
3025
|
}
|
|
3005
3026
|
DrErrorComponent.decorators = [
|
|
3006
3027
|
{ type: Component, args: [{
|
|
3007
|
-
template: "<div *ngIf=\"_control.status === 'INVALID' && !_control.pristine\"\n [drTooltip]=\"errorString\"\n class=\"error-container\"\n [class.warning]=\"isWarning\">\n <i class=\"dr-icon-status-error\"></i>\n <span>{{label}}</span>\n</div>\n",
|
|
3028
|
+
template: "<div *ngIf=\"_control.status === 'INVALID' && !_control.pristine\"\n [drTooltip]=\"errorString\"\n class=\"error-container\"\n [class.warning]=\"isWarning\">\n <i *ngIf=\"!noIcon\" class=\"dr-icon-status-error\"></i>\n <span>{{label}}</span>\n</div>\n",
|
|
3008
3029
|
selector: 'dr-error',
|
|
3009
3030
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3010
|
-
styles: [":host{display:flex;margin-top:8px}:host:empty{display:none}:host .error-container{display:flex;align-items:center;cursor:pointer;width:auto;color:#bf1d30}:host .error-container i{font-size:16px;margin-right:2px}:host .error-container span{font-family:\"Poppins\",sans-serif;font-style:normal;font-weight:400;font-size:11px;line-height:20px}:host .error-container.warning{color:#ffb800}:host .error-container.warning span{color:#9e5f00}\n"]
|
|
3031
|
+
styles: [":host{display:flex;margin-top:8px}:host:empty{display:none}:host .error-container{display:flex;align-items:center;cursor:pointer;width:auto;color:#bf1d30}:host .error-container i{font-size:16px;margin-right:2px}:host .error-container span{font-family:\"Poppins\",sans-serif;font-style:normal;font-weight:400;font-size:11px;line-height:20px}:host .error-container.warning{color:#ffb800}:host .error-container.warning span{color:#9e5f00}:host.no-icon{margin-top:2px}:host.no-icon .error-container span{font-size:12px}\n"]
|
|
3011
3032
|
},] }
|
|
3012
3033
|
];
|
|
3013
3034
|
DrErrorComponent.ctorParameters = () => [
|
|
3014
|
-
{ type: ChangeDetectorRef }
|
|
3035
|
+
{ type: ChangeDetectorRef },
|
|
3036
|
+
{ type: FormGroupDirective, decorators: [{ type: Optional }] }
|
|
3015
3037
|
];
|
|
3016
3038
|
DrErrorComponent.propDecorators = {
|
|
3017
3039
|
control: [{ type: Input }],
|
|
3018
|
-
|
|
3040
|
+
controlName: [{ type: Input }],
|
|
3041
|
+
label: [{ type: Input }],
|
|
3042
|
+
noIcon: [{ type: Input }, { type: HostBinding, args: ['class.no-icon',] }]
|
|
3019
3043
|
};
|
|
3020
3044
|
|
|
3021
3045
|
class DialogWrapperComponent {
|
|
@@ -3086,7 +3110,7 @@ DialogWrapperComponent.decorators = [
|
|
|
3086
3110
|
{ type: Component, args: [{
|
|
3087
3111
|
selector: 'dr-dialog-wrapper',
|
|
3088
3112
|
template: "<div class=\"dialog-wrapper\"\n [class.dialog-wrapper--confirmation-no-title]=\"dialogData.theme?.isConfirmation && !dialogData.title\">\n <i class=\"dr-icon-exit\" data-test=\"close_btn\" (click)=\"closeDialog()\" *ngIf=\"!dialogData?.hideCloseBtn\"></i>\n\n <div header class=\"dialog-wrapper__header\" *ngIf=\"dialogData.title\">\n <h1 class=\"dialog-wrapper__header__title\" data-test=\"dialogTitle\">{{ dialogData.title }}</h1>\n <h1 class=\"dialog-wrapper__header__subtitle\" data-test=\"dialogSubtitle\"\n *ngIf=\"dialogData.subtitle\">{{ dialogData.subtitle }}</h1>\n </div>\n <div class=\"dialog-wrapper__content\"\n [class.dialog-wrapper__content--no-padding]=\"dialogData.theme?.contentNoPadding\"\n [ngClass]=\"{ 'flex-position': dialogData.contentIcon?.class && !childComponent }\">\n <span *ngIf=\"dialogData.contentIcon?.class\" class=\"dialog-wrapper__content__icon\">\n <i [ngClass]=\"dialogData.contentIcon.class\" [style.color]=\"dialogData.contentIcon?.color || 'inherit'\"></i>\n </span>\n <span [innerHTML]=\"dialogData.content\"></span>\n <span #content class=\"dialog-wrapper__content__anchor\"> </span>\n </div>\n <div footer class=\"dialog-wrapper__footer\" *ngIf=\"dialogData.cancelButton || dialogData.acceptButton\">\n <div class=\"dialog-wrapper__footer__buttons\">\n <span *ngIf=\"dialogData.customButton\"\n class=\"dialog-wrapper__footer__button-wrapper\"\n [drTooltip]=\"dialogData.customButton.isDisabled && dialogData.tooltips?.customDisabled\">\n <dr-button (click)=\"onDecline()\"\n [theme]=\"'secondary'\"\n [isLoading]=\"isLoading\"\n data-test=\"declineBtn\"\n [disabled]=\"dialogData.customButton.isDisabled\"\n [drTooltip]=\"dialogData.tooltips?.custom\">{{ dialogData.customButton.label }}</dr-button>\n </span>\n <span *ngIf=\"dialogData.cancelButton\"\n class=\"dialog-wrapper__footer__button-wrapper\"\n [drTooltip]=\"dialogData.cancelButton.isDisabled && dialogData.tooltips?.cancelDisabled\">\n <dr-button (click)=\"closeDialog()\"\n [theme]=\"'secondary'\"\n data-test=\"closeBtn\"\n [disabled]=\"dialogData.cancelButton.isDisabled\"\n [drTooltip]=\"dialogData.tooltips?.cancel\">{{ dialogData.cancelButton.label }}</dr-button>\n </span>\n <span *ngIf=\"dialogData.acceptButton\"\n class=\"dialog-wrapper__footer__button-wrapper\"\n [drTooltip]=\"dialogData.acceptButton.isDisabled && dialogData.tooltips?.acceptDisabled\">\n <dr-button (click)=\"onAcceptDialog()\"\n [theme]=\"dialogData.acceptButton?.theme || 'primary'\"\n [isLoading]=\"isLoading\"\n data-test=\"acceptBtn\"\n [disabled]=\"dialogData.acceptButton.isDisabled\"\n [drTooltip]=\"dialogData.tooltips?.accept\">{{ dialogData.acceptButton.label }}</dr-button>\n </span>\n </div>\n </div>\n</div>\n",
|
|
3089
|
-
styles: [":host.small-modal{min-height:188px;max-height:467px;min-width:400px;max-width:400px}:host.medium-modal{min-height:188px;max-height:467px;min-width:632px;max-width:632px}:host.large-modal{min-width:750px;max-width:750px}:host.medium-large-modal{min-width:669px;max-width:669px}:host.xl-modal{min-height:188px;max-height:800px;min-width:1100px;max-width:1100px}:host.xl-custom-modal{min-height:188px;max-height:800px;min-width:1100px;max-width:100%}::ng-deep .dialog-wrapper{display:flex;justify-content:space-between;flex-direction:column;position:relative}::ng-deep .dialog-wrapper>.dr-icon-exit{z-index:1;position:absolute;right:32px;top:20px;color:#51566f;cursor:pointer}::ng-deep .dialog-wrapper__header{display:flex;flex-direction:column;padding:8px 52px 8px 32px;border-bottom:1px solid #e5e6ea}::ng-deep .dialog-wrapper__header__title{color:#151b3f;position:static;font-weight:600;font-size:18px;line-height:24px}::ng-deep .dialog-wrapper__header__subtitle{font-size:14px;line-height:20px;margin:0}::ng-deep .dialog-wrapper--confirmation-no-title{padding-top:16px;height:100%}::ng-deep .dialog-wrapper__content{overflow-y:inherit;font-size:14px;font-weight:400;line-height:22px;padding:24px 32px 32px}::ng-deep .dialog-wrapper__content__anchor{display:none}::ng-deep .dialog-wrapper__content--no-padding{padding:0}::ng-deep .dialog-wrapper__content__icon{margin-right:10px;top:5px;position:relative}::ng-deep .dialog-wrapper__content.flex-position{display:flex}::ng-deep .dialog-wrapper__footer{border-top:1px solid #e5e6ea}::ng-deep .dialog-wrapper__footer__buttons{display:flex;justify-content:flex-end;padding
|
|
3113
|
+
styles: [":host.small-modal{min-height:188px;max-height:467px;min-width:400px;max-width:400px}:host.medium-modal{min-height:188px;max-height:467px;min-width:632px;max-width:632px}:host.large-modal{min-width:750px;max-width:750px}:host.medium-large-modal{min-width:669px;max-width:669px}:host.xl-modal{min-height:188px;max-height:800px;min-width:1100px;max-width:1100px}:host.xl-custom-modal{min-height:188px;max-height:800px;min-width:1100px;max-width:100%}::ng-deep .dialog-wrapper{display:flex;justify-content:space-between;flex-direction:column;position:relative}::ng-deep .dialog-wrapper>.dr-icon-exit{z-index:1;position:absolute;right:32px;top:20px;color:#51566f;cursor:pointer}::ng-deep .dialog-wrapper__header{display:flex;flex-direction:column;padding:8px 52px 8px 32px;border-bottom:1px solid #e5e6ea}::ng-deep .dialog-wrapper__header__title{color:#151b3f;position:static;font-weight:600;font-size:18px;line-height:24px}::ng-deep .dialog-wrapper__header__subtitle{font-size:14px;line-height:20px;margin:0}::ng-deep .dialog-wrapper--confirmation-no-title{padding-top:16px;height:100%}::ng-deep .dialog-wrapper__content{overflow-y:inherit;font-size:14px;font-weight:400;line-height:22px;padding:24px 32px 32px}::ng-deep .dialog-wrapper__content__anchor{display:none}::ng-deep .dialog-wrapper__content--no-padding{padding:0}::ng-deep .dialog-wrapper__content__icon{margin-right:10px;top:5px;position:relative}::ng-deep .dialog-wrapper__content.flex-position{display:flex}::ng-deep .dialog-wrapper__footer{border-top:1px solid #e5e6ea}::ng-deep .dialog-wrapper__footer__buttons{display:flex;justify-content:flex-end;padding:11px 32px}::ng-deep .dialog-wrapper__footer__buttons>dr-button:nth-child(n+2){margin-left:12px}::ng-deep .dialog-wrapper__footer__button-wrapper:nth-child(n+2){margin-left:12px}\n"]
|
|
3090
3114
|
},] }
|
|
3091
3115
|
];
|
|
3092
3116
|
DialogWrapperComponent.ctorParameters = () => [
|
|
@@ -3983,12 +4007,14 @@ class DrDatePickerWithTimeframeComponent extends DrDatePickerComponent {
|
|
|
3983
4007
|
// eslint-disable-next-line
|
|
3984
4008
|
this.onChangeFormat = new EventEmitter();
|
|
3985
4009
|
this.pagingSetup = {
|
|
3986
|
-
[TimeframeOption.YEAR]: (forward) => this.
|
|
3987
|
-
[TimeframeOption.QUARTER]: (forward) => this.
|
|
3988
|
-
[TimeframeOption.MONTH]: (forward) => this.
|
|
3989
|
-
[TimeframeOption.DAY]: (forward) => this.
|
|
3990
|
-
[TimeframeOption.WEEK]: (forward) => this.
|
|
4010
|
+
[TimeframeOption.YEAR]: (forward) => this.getNextDate('addCalendarYears', 1, forward),
|
|
4011
|
+
[TimeframeOption.QUARTER]: (forward) => this.getNextDate('addCalendarMonths', 3, forward),
|
|
4012
|
+
[TimeframeOption.MONTH]: (forward) => this.getNextDate('addCalendarMonths', 1, forward),
|
|
4013
|
+
[TimeframeOption.DAY]: (forward) => this.getNextDate('addCalendarDays', 1, forward),
|
|
4014
|
+
[TimeframeOption.WEEK]: (forward) => this.getNextDate('addCalendarDays', 7, forward)
|
|
3991
4015
|
};
|
|
4016
|
+
this.isNextDateDisabled = false;
|
|
4017
|
+
this.isPrevDateDisabled = false;
|
|
3992
4018
|
this.onChangeDebounced$ = new Subject();
|
|
3993
4019
|
datePickerService.isTimeframeSelectionEnabled = true;
|
|
3994
4020
|
datePickerService.format$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
|
|
@@ -4032,12 +4058,12 @@ class DrDatePickerWithTimeframeComponent extends DrDatePickerComponent {
|
|
|
4032
4058
|
}
|
|
4033
4059
|
pagingClicked(forward) {
|
|
4034
4060
|
if (this.pagingSetup[this.datePickerService.timeframe]) {
|
|
4035
|
-
this.pagingSetup[this.datePickerService.timeframe](forward);
|
|
4061
|
+
const nextValue = this.pagingSetup[this.datePickerService.timeframe](forward);
|
|
4062
|
+
this.pagingDateChange(nextValue);
|
|
4036
4063
|
}
|
|
4037
4064
|
this.datePicker.close();
|
|
4038
4065
|
}
|
|
4039
|
-
pagingDateChange(
|
|
4040
|
-
const newValue = this.dateAdapter[actionCall](this.innerValue, forward ? amount : -amount);
|
|
4066
|
+
pagingDateChange(newValue) {
|
|
4041
4067
|
if (this.paginationDebounce) {
|
|
4042
4068
|
// this is required for not sending extra requests when user quickly clicking on pagination
|
|
4043
4069
|
// here we do the same as in setValueFromMoment(newValue) with difference
|
|
@@ -4050,11 +4076,29 @@ class DrDatePickerWithTimeframeComponent extends DrDatePickerComponent {
|
|
|
4050
4076
|
this.setValueFromMoment(newValue);
|
|
4051
4077
|
}
|
|
4052
4078
|
}
|
|
4079
|
+
writeValue(value) {
|
|
4080
|
+
super.writeValue(value);
|
|
4081
|
+
if (!value)
|
|
4082
|
+
return;
|
|
4083
|
+
this.restrictPagination();
|
|
4084
|
+
}
|
|
4085
|
+
getNextDate(actionCall, amount, forward) {
|
|
4086
|
+
var _a, _b;
|
|
4087
|
+
return (_b = (_a = this.dateAdapter)[actionCall]) === null || _b === void 0 ? void 0 : _b.call(_a, this.innerValue, forward ? amount : -amount);
|
|
4088
|
+
}
|
|
4089
|
+
restrictPagination() {
|
|
4090
|
+
if (!this._min && !this._max)
|
|
4091
|
+
return;
|
|
4092
|
+
const nextValue = this.pagingSetup[this.datePickerService.timeframe](true);
|
|
4093
|
+
const prevValue = this.pagingSetup[this.datePickerService.timeframe](false);
|
|
4094
|
+
this.isNextDateDisabled = this._max && nextValue && nextValue.unix() > this._max.unix();
|
|
4095
|
+
this.isPrevDateDisabled = this._min && prevValue && prevValue.unix() < this._min.unix();
|
|
4096
|
+
}
|
|
4053
4097
|
}
|
|
4054
4098
|
DrDatePickerWithTimeframeComponent.decorators = [
|
|
4055
4099
|
{ type: Component, args: [{
|
|
4056
4100
|
selector: 'dr-date-picker-with-timeframe',
|
|
4057
|
-
template: "<dr-button theme=\"icon\" icon=\"dr-icon-arrow-left\" (click)=\"pagingClicked(false)\"></dr-button>\n<div class=\"dr-datepicker-input-container\">\n <i *ngIf=\"isDashboardDatepicker\" class=\"dr-icon-date\"></i>\n <div\n class=\"dr-datepicker-input-container__formatted-value-display\"\n (click)=\"datepickerInput.click()\"\n >\n {{ displayedFormattedValue }}\n </div>\n <input\n #datepickerInput\n [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [readonly]=\"readonly\"\n [min]=\"_min\"\n [max]=\"_max\"\n />\n</div>\n<dr-button theme=\"icon\" icon=\"dr-icon-arrow-right\" (click)=\"pagingClicked(true)\"></dr-button>\n<mat-datepicker #datePicker\n class=\"dr-timeframe-datepicker\"\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenPeriodHandler($event, timeframeOption.YEAR)\"\n (monthSelected)=\"chosenPeriodHandler($event, timeframeOption.MONTH)\">\n</mat-datepicker>\n",
|
|
4101
|
+
template: "<dr-button [disabled]=\"isPrevDateDisabled\" theme=\"icon\" icon=\"dr-icon-arrow-left\" (click)=\"pagingClicked(false)\"></dr-button>\n<div class=\"dr-datepicker-input-container\">\n <i *ngIf=\"isDashboardDatepicker\" class=\"dr-icon-date\"></i>\n <div\n class=\"dr-datepicker-input-container__formatted-value-display\"\n (click)=\"datepickerInput.click()\"\n >\n {{ displayedFormattedValue }}\n </div>\n <input\n #datepickerInput\n [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [readonly]=\"readonly\"\n [min]=\"_min\"\n [max]=\"_max\"\n />\n</div>\n<dr-button [disabled]=\"isNextDateDisabled\" theme=\"icon\" icon=\"dr-icon-arrow-right\" (click)=\"pagingClicked(true)\"></dr-button>\n<mat-datepicker #datePicker\n class=\"dr-timeframe-datepicker\"\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenPeriodHandler($event, timeframeOption.YEAR)\"\n (monthSelected)=\"chosenPeriodHandler($event, timeframeOption.MONTH)\">\n</mat-datepicker>\n",
|
|
4058
4102
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
4059
4103
|
providers: [
|
|
4060
4104
|
{ provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerWithTimeframeComponent, multi: true },
|