@datarailsshared/datarailsshared 1.4.53-dragons → 1.4.55
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 +76 -19
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.4.55.tgz +0 -0
- package/datarailsshared-datarailsshared.d.ts +1 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/datarailsshared-datarailsshared.js +2 -1
- package/esm2015/lib/dr-inputs/date-pickers/dr-date-picker-with-timeframe/dr-date-picker-with-timeframe.component.js +11 -9
- package/esm2015/lib/dr-inputs/date-pickers/dr-date-picker_custom-header/dr-date-picker_custom-header.component.js +19 -4
- package/esm2015/lib/dr-inputs/date-pickers/dr-show-timeframe.pipe.js +12 -0
- package/esm2015/lib/dr-inputs/date-pickers/services/dr-date-picker.service.js +19 -3
- package/esm2015/lib/dr-inputs/dr-inputs.module.js +4 -2
- package/esm2015/lib/models/datePicker.js +3 -1
- package/esm2015/lib/utils/dr-shared-utils.js +3 -1
- package/fesm2015/datarailsshared-datarailsshared.js +63 -14
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/dr-inputs/date-pickers/dr-date-picker-with-timeframe/dr-date-picker-with-timeframe.component.d.ts +3 -1
- package/lib/dr-inputs/date-pickers/dr-date-picker_custom-header/dr-date-picker_custom-header.component.d.ts +2 -1
- package/lib/dr-inputs/date-pickers/dr-show-timeframe.pipe.d.ts +6 -0
- package/lib/dr-inputs/date-pickers/services/dr-date-picker.service.d.ts +2 -1
- package/lib/models/datePicker.d.ts +4 -1
- package/package.json +1 -1
- package/datarailsshared-datarailsshared-1.4.53-dragons.tgz +0 -0
|
@@ -2926,6 +2926,7 @@ var DateFromats;
|
|
|
2926
2926
|
DateFromats["YEAR_FORMAT"] = "yyyy";
|
|
2927
2927
|
DateFromats["MONTH_YEAR_FORMAT"] = "MM/yyyy";
|
|
2928
2928
|
DateFromats["QUARTER_FORMAT"] = "Q/yyyy";
|
|
2929
|
+
DateFromats["WEEK_FORMAT"] = "W/yyyy";
|
|
2929
2930
|
})(DateFromats || (DateFromats = {}));
|
|
2930
2931
|
class CustomDateFormat {
|
|
2931
2932
|
constructor() {
|
|
@@ -2973,6 +2974,7 @@ var TimeframeOption;
|
|
|
2973
2974
|
TimeframeOption["DAY"] = "day";
|
|
2974
2975
|
TimeframeOption["MONTH"] = "month";
|
|
2975
2976
|
TimeframeOption["QUARTER"] = "quarter";
|
|
2977
|
+
TimeframeOption["WEEK"] = "week";
|
|
2976
2978
|
TimeframeOption["YEAR"] = "year";
|
|
2977
2979
|
})(TimeframeOption || (TimeframeOption = {}));
|
|
2978
2980
|
var CalendarView;
|
|
@@ -3070,6 +3072,8 @@ class DrSharedUtils {
|
|
|
3070
3072
|
return TimeframeOption.QUARTER;
|
|
3071
3073
|
case lowerCaseFormat.includes('d'):
|
|
3072
3074
|
return TimeframeOption.DAY;
|
|
3075
|
+
case lowerCaseFormat.includes('w'):
|
|
3076
|
+
return TimeframeOption.WEEK;
|
|
3073
3077
|
case lowerCaseFormat.includes('m'):
|
|
3074
3078
|
return TimeframeOption.MONTH;
|
|
3075
3079
|
case lowerCaseFormat.includes('y'):
|
|
@@ -3086,15 +3090,31 @@ class DrDatePickerService {
|
|
|
3086
3090
|
this.timeframe = TimeframeOption.DAY;
|
|
3087
3091
|
this.format$ = new BehaviorSubject(DateFromats.MAT_DEFAULT_DATE_FORMAT);
|
|
3088
3092
|
this.updatedQuarter$ = new Subject();
|
|
3093
|
+
this.availableTimeframes = [
|
|
3094
|
+
TimeframeOption.DAY,
|
|
3095
|
+
TimeframeOption.WEEK,
|
|
3096
|
+
TimeframeOption.MONTH,
|
|
3097
|
+
TimeframeOption.QUARTER,
|
|
3098
|
+
TimeframeOption.YEAR
|
|
3099
|
+
];
|
|
3089
3100
|
this.formatConfig = {
|
|
3090
3101
|
day: DateFromats.MAT_DEFAULT_DATE_FORMAT,
|
|
3091
3102
|
month: DateFromats.MONTH_YEAR_FORMAT,
|
|
3092
3103
|
year: DateFromats.YEAR_FORMAT,
|
|
3093
3104
|
quarter: DateFromats.QUARTER_FORMAT,
|
|
3105
|
+
week: DateFromats.WEEK_FORMAT
|
|
3094
3106
|
};
|
|
3095
3107
|
}
|
|
3096
|
-
|
|
3097
|
-
|
|
3108
|
+
getDisplayPrefix() {
|
|
3109
|
+
const formatCached = this.format$.getValue();
|
|
3110
|
+
switch (true) {
|
|
3111
|
+
case formatCached === null || formatCached === void 0 ? void 0 : formatCached.includes('Q'):
|
|
3112
|
+
return 'Q';
|
|
3113
|
+
case formatCached === null || formatCached === void 0 ? void 0 : formatCached.includes('W'):
|
|
3114
|
+
return 'W';
|
|
3115
|
+
default:
|
|
3116
|
+
return '';
|
|
3117
|
+
}
|
|
3098
3118
|
}
|
|
3099
3119
|
getTimeframe(format) {
|
|
3100
3120
|
return DrSharedUtils.getTimeframeByDateFormat(format);
|
|
@@ -3127,6 +3147,7 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
3127
3147
|
this.quarters = [1, 2, 3, 4];
|
|
3128
3148
|
this.selectedQuarter = 1;
|
|
3129
3149
|
this.timeframeOptions = [{
|
|
3150
|
+
timeframe: TimeframeOption.DAY,
|
|
3130
3151
|
title: 'Day',
|
|
3131
3152
|
value: CalendarView.FOR_DAYS,
|
|
3132
3153
|
format: this.datePickerService.formatConfig.day,
|
|
@@ -3134,16 +3155,27 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
3134
3155
|
.format(this._calendar.activeDate, this._dateFormats.display.monthYearLabel)
|
|
3135
3156
|
.toLocaleUpperCase()
|
|
3136
3157
|
}, {
|
|
3158
|
+
timeframe: TimeframeOption.WEEK,
|
|
3159
|
+
title: 'Week',
|
|
3160
|
+
value: CalendarView.FOR_DAYS,
|
|
3161
|
+
format: this.datePickerService.formatConfig.week,
|
|
3162
|
+
periodLabel: () => this._dateAdapter
|
|
3163
|
+
.format(this._calendar.activeDate, this._dateFormats.display.monthYearLabel)
|
|
3164
|
+
.toLocaleUpperCase()
|
|
3165
|
+
}, {
|
|
3166
|
+
timeframe: TimeframeOption.MONTH,
|
|
3137
3167
|
title: 'Month',
|
|
3138
3168
|
value: CalendarView.FOR_MONTHS,
|
|
3139
3169
|
format: this.datePickerService.formatConfig.month,
|
|
3140
3170
|
periodLabel: () => String(moment$1(this._calendar.activeDate).year())
|
|
3141
3171
|
}, {
|
|
3172
|
+
timeframe: TimeframeOption.QUARTER,
|
|
3142
3173
|
title: 'Quarter',
|
|
3143
3174
|
value: CalendarView.FOR_QUARTERS,
|
|
3144
3175
|
format: this.datePickerService.formatConfig.quarter,
|
|
3145
3176
|
periodLabel: () => String(moment$1(this._calendar.activeDate).year())
|
|
3146
3177
|
}, {
|
|
3178
|
+
timeframe: TimeframeOption.YEAR,
|
|
3147
3179
|
title: 'Year',
|
|
3148
3180
|
value: CalendarView.FOR_YEARS,
|
|
3149
3181
|
format: this.datePickerService.formatConfig.year,
|
|
@@ -3171,6 +3203,9 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
3171
3203
|
this.selectedTimeframe = this.timeframeOptions.filter(option => option.format == value)[0].value;
|
|
3172
3204
|
_calendar.currentView = this.selectedTimeframe;
|
|
3173
3205
|
this.setPeriodLabels();
|
|
3206
|
+
if (this.selectedTimeframe === CalendarView.FOR_QUARTERS) {
|
|
3207
|
+
this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
|
|
3208
|
+
}
|
|
3174
3209
|
});
|
|
3175
3210
|
_calendar.viewChanged.pipe(takeUntil(this._destroyed)).subscribe(() => this.setPeriodLabels());
|
|
3176
3211
|
}
|
|
@@ -3181,7 +3216,7 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
3181
3216
|
setPeriodLabels() {
|
|
3182
3217
|
const currentTimeframeOption = this.timeframeOptions.filter(option => option.value === this._calendar.currentView)[0];
|
|
3183
3218
|
const fullPeriodLabel = currentTimeframeOption.periodLabel();
|
|
3184
|
-
if (this._calendar.currentView ===
|
|
3219
|
+
if (this._calendar.currentView === CalendarView.FOR_DAYS) {
|
|
3185
3220
|
this.periodMonthLabel = fullPeriodLabel.slice(0, 3);
|
|
3186
3221
|
this.periodYearLabel = fullPeriodLabel.slice(4);
|
|
3187
3222
|
}
|
|
@@ -3225,7 +3260,7 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
3225
3260
|
DrDatePickerCustomHeaderComponent.decorators = [
|
|
3226
3261
|
{ type: Component, args: [{
|
|
3227
3262
|
selector: 'dr-date-picker_custom-header.component',
|
|
3228
|
-
template: "<div *ngIf=\"datePickerService.isTimeframeSelectionEnabled\" class=\"dr-datepicker__timeframe-select__wrapper\">\n <dr-select\n class=\"dr-datepicker__timeframe-select\"\n [(ngModel)]=\"selectedTimeframe\"\n [items]=\"timeframeOptions\"\n bindLabel=\"title\"\n bindValue=\"value\"\n (ngModelChange)=\"setTimeframe()\">\n </dr-select>\n</div>\n\n<div class=\"dr-date-paging\">\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(false)\">\n <i class=\"dr-icon-arrow-left presentation_buttons-navigate_input\"></i>\n </div>\n <span class=\"example-header-label\">\n <span (click)=\"switchViewOnClickOnPeriodLabel(calendarView.FOR_MONTHS)\">{{periodMonthLabel + ' '}}</span>\n <span (click)=\"switchViewOnClickOnPeriodLabel(calendarView.FOR_YEARS)\">{{periodYearLabel}}</span>\n </span>\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(true)\">\n <i class=\"dr-icon-arrow-right presentation_buttons-navigate_input\"></i>\n </div>\n</div>\n<div #quarterlyDatePicker class=\"dr-quarterly-datepicker\" *ngIf=\"currentViewIsQuarter\">\n <div *ngFor=\"let quarter of quarters\"\n class=\"quarter-selector\" (click)=\"onSelectQuarter(quarter)\"\n [class]=\"quarter == selectedQuarter ? 'selected' : ''\"\n >Q{{quarter}}</div>\n</div>\n\n",
|
|
3263
|
+
template: "<div *ngIf=\"datePickerService.isTimeframeSelectionEnabled\" class=\"dr-datepicker__timeframe-select__wrapper\">\n <dr-select\n class=\"dr-datepicker__timeframe-select\"\n [(ngModel)]=\"selectedTimeframe\"\n [items]=\"timeframeOptions | drShowTimeframePipe: datePickerService.availableTimeframes\"\n bindLabel=\"title\"\n bindValue=\"value\"\n (ngModelChange)=\"setTimeframe()\">\n </dr-select>\n</div>\n\n<div class=\"dr-date-paging\">\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(false)\">\n <i class=\"dr-icon-arrow-left presentation_buttons-navigate_input\"></i>\n </div>\n <span class=\"example-header-label\">\n <span (click)=\"switchViewOnClickOnPeriodLabel(calendarView.FOR_MONTHS)\">{{periodMonthLabel + ' '}}</span>\n <span (click)=\"switchViewOnClickOnPeriodLabel(calendarView.FOR_YEARS)\">{{periodYearLabel}}</span>\n </span>\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(true)\">\n <i class=\"dr-icon-arrow-right presentation_buttons-navigate_input\"></i>\n </div>\n</div>\n<div #quarterlyDatePicker class=\"dr-quarterly-datepicker\" *ngIf=\"currentViewIsQuarter\">\n <div *ngFor=\"let quarter of quarters\"\n class=\"quarter-selector\" (click)=\"onSelectQuarter(quarter)\"\n [class]=\"quarter == selectedQuarter ? 'selected' : ''\"\n >Q{{quarter}}</div>\n</div>\n\n",
|
|
3229
3264
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3230
3265
|
styles: [":host{height:54px;align-items:center;font-family:\"Poppins\";font-style:normal;font-weight:600;font-size:14px;line-height:22px}.dr-datepicker__timeframe-select__wrapper{background-color:#f9faff;padding:16px 32px;border-radius:18px 18px 0 0}.dr-date-paging{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:16px 8px;grid-gap:4px;gap:4px}.dr-date-paging.flip-page-button{width:20px;height:20px;padding:0;color:#4e566c}.dr-date-paging.flip-page-button:hover{border-radius:50%;background:#F2F2FB;color:#4646ce}.example-header-label{cursor:pointer}.dr-quarterly-datepicker{display:flex;justify-content:space-between;padding:10px}.dr-quarterly-datepicker .quarter-selector{display:block;width:74px;height:40px;text-align:center;border-radius:40px;font-weight:400;padding-top:9px}.dr-quarterly-datepicker .quarter-selector:hover{background:#F2F2FB;color:#4646ce;font-weight:600;cursor:pointer}.dr-quarterly-datepicker .quarter-selector.selected{background-color:#4646ce;color:#f3f7ff;font-weight:600}\n"]
|
|
3231
3266
|
},] }
|
|
@@ -3395,7 +3430,8 @@ class DrDatePickerWithTimeframeComponent extends DrDatePickerComponent {
|
|
|
3395
3430
|
[TimeframeOption.YEAR]: (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
|
|
3396
3431
|
[TimeframeOption.QUARTER]: (forward) => this.pagingDateChange('addCalendarMonths', 3, forward),
|
|
3397
3432
|
[TimeframeOption.MONTH]: (forward) => this.pagingDateChange('addCalendarMonths', 1, forward),
|
|
3398
|
-
[TimeframeOption.DAY]: (forward) => this.pagingDateChange('addCalendarDays', 1, forward)
|
|
3433
|
+
[TimeframeOption.DAY]: (forward) => this.pagingDateChange('addCalendarDays', 1, forward),
|
|
3434
|
+
[TimeframeOption.WEEK]: (forward) => this.pagingDateChange('addCalendarDays', 7, forward)
|
|
3399
3435
|
};
|
|
3400
3436
|
datePickerService.isTimeframeSelectionEnabled = true;
|
|
3401
3437
|
datePickerService.format$
|
|
@@ -3414,19 +3450,19 @@ class DrDatePickerWithTimeframeComponent extends DrDatePickerComponent {
|
|
|
3414
3450
|
this.cdr.markForCheck();
|
|
3415
3451
|
}
|
|
3416
3452
|
}
|
|
3453
|
+
set availableTimeframes(value) {
|
|
3454
|
+
if (value && value.length) {
|
|
3455
|
+
this.datePickerService.availableTimeframes = value;
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3417
3458
|
get displayedFormattedValue() {
|
|
3418
|
-
var _a;
|
|
3419
3459
|
if (!this.value) {
|
|
3420
3460
|
return this.placeholder;
|
|
3421
3461
|
}
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
: this.value.format(this.datePickerService.format$.getValue());
|
|
3462
|
+
const formatCached = this.datePickerService.format$.getValue();
|
|
3463
|
+
return this.datePickerService.getDisplayPrefix() + this.value.format(formatCached);
|
|
3425
3464
|
}
|
|
3426
3465
|
ngOnInit() {
|
|
3427
|
-
if (this.dateFormatConfig) {
|
|
3428
|
-
this.datePickerService.formatConfig = Object.assign(Object.assign({}, this.datePickerService.formatConfig), this.dateFormatConfig);
|
|
3429
|
-
}
|
|
3430
3466
|
this.datePickerService.isTimeframeSelectionEnabled = this.canSelectTimeframe;
|
|
3431
3467
|
this.cdr.markForCheck();
|
|
3432
3468
|
}
|
|
@@ -3461,6 +3497,7 @@ DrDatePickerWithTimeframeComponent.propDecorators = {
|
|
|
3461
3497
|
isDashboardDatepicker: [{ type: Input }],
|
|
3462
3498
|
dateFormatConfig: [{ type: Input }],
|
|
3463
3499
|
canSelectTimeframe: [{ type: Input }],
|
|
3500
|
+
availableTimeframes: [{ type: Input }],
|
|
3464
3501
|
onChangeFormat: [{ type: Output }]
|
|
3465
3502
|
};
|
|
3466
3503
|
|
|
@@ -3506,6 +3543,17 @@ DrDatePickerFormatDirective.propDecorators = {
|
|
|
3506
3543
|
datePickerFormat: [{ type: Input, args: ['drDatePickerFormat',] }]
|
|
3507
3544
|
};
|
|
3508
3545
|
|
|
3546
|
+
class DrShowTimeframePipe {
|
|
3547
|
+
transform(arr, showOptions) {
|
|
3548
|
+
return arr.filter(item => showOptions.includes(item.timeframe));
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
DrShowTimeframePipe.decorators = [
|
|
3552
|
+
{ type: Pipe, args: [{
|
|
3553
|
+
name: 'drShowTimeframePipe'
|
|
3554
|
+
},] }
|
|
3555
|
+
];
|
|
3556
|
+
|
|
3509
3557
|
// !!! Please do not use such approach in other places
|
|
3510
3558
|
// Hard fix for 'none' calendar view selection
|
|
3511
3559
|
MatCalendar.prototype.focusActiveCell = function () {
|
|
@@ -3525,7 +3573,8 @@ const components$1 = [
|
|
|
3525
3573
|
DrDatePickerWithTimeframeComponent,
|
|
3526
3574
|
DrDatePickerFormatDirective,
|
|
3527
3575
|
DrDatePickerCustomHeaderComponent,
|
|
3528
|
-
DrModelDebounceChangeDirective
|
|
3576
|
+
DrModelDebounceChangeDirective,
|
|
3577
|
+
DrShowTimeframePipe
|
|
3529
3578
|
];
|
|
3530
3579
|
class DrInputsModule {
|
|
3531
3580
|
}
|
|
@@ -3687,5 +3736,5 @@ DrAccordionModule.decorators = [
|
|
|
3687
3736
|
* Generated bundle index. Do not edit.
|
|
3688
3737
|
*/
|
|
3689
3738
|
|
|
3690
|
-
export { AnyTagComponent, CalendarView, CheckboxComponent, CustomDateFormat, DateFromats, DatePickerPeriodPosition, DateTagComponent, DateTagModule, DayTagComponent, DrAccordionComponent, DrAccordionItemBodyComponent, DrAccordionItemComponent, DrAccordionItemHeaderComponent, DrAccordionModule, DrAvatarComponent, DrAvatarModule, DrAvatarPipe, DrButtonComponent, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrInputComponent, DrInputsModule, DrModelDebounceChangeDirective, DrPopoverAlignmentDimension, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrPopoverService, DrSelectComponent, DrSharedUtils, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrTabComponent, DrTabsComponent, DrTabsModule, DrTagComponent, DrTagModule, DrToggleButtonComponent, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, ListTagComponent, ListTagModule, MonthTagComponent, QuarterTagComponent, RadioButtonComponent, RadioGroupComponent, SpinnerSize, SpinnerType, TimeframeOption, TooltipComponent, WeekTagComponent, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, DrDatePickerComponent as ɵc, DrDatePickerService as ɵd, DrDatePickerWithTimeframeComponent as ɵe, DrDatePickerFormatDirective as ɵf, DrDatePickerCustomHeaderComponent as ɵg };
|
|
3739
|
+
export { AnyTagComponent, CalendarView, CheckboxComponent, CustomDateFormat, DateFromats, DatePickerPeriodPosition, DateTagComponent, DateTagModule, DayTagComponent, DrAccordionComponent, DrAccordionItemBodyComponent, DrAccordionItemComponent, DrAccordionItemHeaderComponent, DrAccordionModule, DrAvatarComponent, DrAvatarModule, DrAvatarPipe, DrButtonComponent, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrInputComponent, DrInputsModule, DrModelDebounceChangeDirective, DrPopoverAlignmentDimension, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrPopoverService, DrSelectComponent, DrSharedUtils, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrTabComponent, DrTabsComponent, DrTabsModule, DrTagComponent, DrTagModule, DrToggleButtonComponent, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, ListTagComponent, ListTagModule, MonthTagComponent, QuarterTagComponent, RadioButtonComponent, RadioGroupComponent, SpinnerSize, SpinnerType, TimeframeOption, TooltipComponent, WeekTagComponent, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, DrDatePickerComponent as ɵc, DrDatePickerService as ɵd, DrDatePickerWithTimeframeComponent as ɵe, DrDatePickerFormatDirective as ɵf, DrDatePickerCustomHeaderComponent as ɵg, DrShowTimeframePipe as ɵh };
|
|
3691
3740
|
//# sourceMappingURL=datarailsshared-datarailsshared.js.map
|