@datarailsshared/datarailsshared 1.4.54 → 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 +103 -25
- 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-dropdown/dr-dropdown.component.js +6 -2
- package/esm2015/lib/dr-dropdown/dr-dropdown.directive.js +21 -5
- 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 +88 -19
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/dr-dropdown/dr-dropdown.component.d.ts +2 -0
- package/lib/dr-dropdown/dr-dropdown.directive.d.ts +2 -0
- 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.54.tgz +0 -0
|
@@ -15,6 +15,8 @@ export class DrSharedUtils {
|
|
|
15
15
|
return TimeframeOption.QUARTER;
|
|
16
16
|
case lowerCaseFormat.includes('d'):
|
|
17
17
|
return TimeframeOption.DAY;
|
|
18
|
+
case lowerCaseFormat.includes('w'):
|
|
19
|
+
return TimeframeOption.WEEK;
|
|
18
20
|
case lowerCaseFormat.includes('m'):
|
|
19
21
|
return TimeframeOption.MONTH;
|
|
20
22
|
case lowerCaseFormat.includes('y'):
|
|
@@ -24,4 +26,4 @@ export class DrSharedUtils {
|
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
29
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHItc2hhcmVkLXV0aWxzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvZGF0YXJhaWxzc2hhcmVkL3NyYy9saWIvdXRpbHMvZHItc2hhcmVkLXV0aWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUV2RCxNQUFNLE9BQU8sYUFBYTtJQUN4Qjs7O09BR0c7SUFDSSxNQUFNLENBQUMsd0JBQXdCLENBQUMsTUFBYztRQUNuRCxNQUFNLFlBQVksR0FBRyxlQUFlLENBQUMsR0FBRyxDQUFDO1FBRXpDLElBQUksQ0FBQyxNQUFNLEVBQUU7WUFDWCxPQUFPLFlBQVksQ0FBQztTQUNyQjtRQUVELE1BQU0sZUFBZSxHQUFHLE1BQU0sQ0FBQyxXQUFXLEVBQUUsQ0FBQztRQUM3QyxRQUFRLElBQUksRUFBRTtZQUNaLEtBQUssZUFBZSxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUM7Z0JBQ2hDLE9BQU8sZUFBZSxDQUFDLE9BQU8sQ0FBQztZQUNqQyxLQUFLLGVBQWUsQ0FBQyxRQUFRLENBQUMsR0FBRyxDQUFDO2dCQUNoQyxPQUFPLGVBQWUsQ0FBQyxHQUFHLENBQUM7WUFDN0IsS0FBSyxlQUFlLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQztnQkFDaEMsT0FBTyxlQUFlLENBQUMsSUFBSSxDQUFDO1lBQzlCLEtBQUssZUFBZSxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUM7Z0JBQ2hDLE9BQU8sZUFBZSxDQUFDLEtBQUssQ0FBQztZQUMvQixLQUFLLGVBQWUsQ0FBQyxRQUFRLENBQUMsR0FBRyxDQUFDO2dCQUNoQyxPQUFPLGVBQWUsQ0FBQyxJQUFJLENBQUM7WUFDOUI7Z0JBQ0UsT0FBTyxZQUFZLENBQUM7U0FDdkI7SUFDSCxDQUFDO0NBQ0YiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBUaW1lZnJhbWVPcHRpb24gfSBmcm9tICcuLi9tb2RlbHMvZGF0ZVBpY2tlcic7XG5cbmV4cG9ydCBjbGFzcyBEclNoYXJlZFV0aWxzIHtcbiAgLyoqXG4gICAqIEdldCB0aW1lZnJhbWUgKGRheSwgeWVhciwgbW9udGgsIHF1YXJ0ZXIpIGJhc2VkIG9uIHBhc3NlZCBmb3JtYXRcbiAgICogQHBhcmFtIGZvcm1hdCAtIGRhdGUgZm9ybWF0IHN0cmluZy4gRXhhbXBsZXM6IE1NL0REL1lZWVksIFEvWVlZWVxuICAgKi9cbiAgcHVibGljIHN0YXRpYyBnZXRUaW1lZnJhbWVCeURhdGVGb3JtYXQoZm9ybWF0OiBzdHJpbmcpOiBUaW1lZnJhbWVPcHRpb24ge1xuICAgIGNvbnN0IGRlZmF1bHRGcmFtZSA9IFRpbWVmcmFtZU9wdGlvbi5EQVk7XG5cbiAgICBpZiAoIWZvcm1hdCkge1xuICAgICAgcmV0dXJuIGRlZmF1bHRGcmFtZTtcbiAgICB9XG5cbiAgICBjb25zdCBsb3dlckNhc2VGb3JtYXQgPSBmb3JtYXQudG9Mb3dlckNhc2UoKTtcbiAgICBzd2l0Y2ggKHRydWUpIHtcbiAgICAgIGNhc2UgbG93ZXJDYXNlRm9ybWF0LmluY2x1ZGVzKCdxJyk6XG4gICAgICAgIHJldHVybiBUaW1lZnJhbWVPcHRpb24uUVVBUlRFUjtcbiAgICAgIGNhc2UgbG93ZXJDYXNlRm9ybWF0LmluY2x1ZGVzKCdkJyk6XG4gICAgICAgIHJldHVybiBUaW1lZnJhbWVPcHRpb24uREFZO1xuICAgICAgY2FzZSBsb3dlckNhc2VGb3JtYXQuaW5jbHVkZXMoJ3cnKTpcbiAgICAgICAgcmV0dXJuIFRpbWVmcmFtZU9wdGlvbi5XRUVLO1xuICAgICAgY2FzZSBsb3dlckNhc2VGb3JtYXQuaW5jbHVkZXMoJ20nKTpcbiAgICAgICAgcmV0dXJuIFRpbWVmcmFtZU9wdGlvbi5NT05USDtcbiAgICAgIGNhc2UgbG93ZXJDYXNlRm9ybWF0LmluY2x1ZGVzKCd5Jyk6XG4gICAgICAgIHJldHVybiBUaW1lZnJhbWVPcHRpb24uWUVBUjtcbiAgICAgIGRlZmF1bHQ6XG4gICAgICAgIHJldHVybiBkZWZhdWx0RnJhbWU7XG4gICAgfVxuICB9XG59XG4iXX0=
|
|
@@ -2235,6 +2235,7 @@ class DrDropdownComponent {
|
|
|
2235
2235
|
this.menuService = menuService;
|
|
2236
2236
|
this.cdr = cdr;
|
|
2237
2237
|
this.position = 'left';
|
|
2238
|
+
this.wasHovered = false;
|
|
2238
2239
|
}
|
|
2239
2240
|
set options(data) {
|
|
2240
2241
|
if (data) {
|
|
@@ -2256,6 +2257,9 @@ class DrDropdownComponent {
|
|
|
2256
2257
|
this.cdr.markForCheck();
|
|
2257
2258
|
}
|
|
2258
2259
|
}
|
|
2260
|
+
onMouseEnter() {
|
|
2261
|
+
this.wasHovered = true;
|
|
2262
|
+
}
|
|
2259
2263
|
onMouseLeave() {
|
|
2260
2264
|
if (this.drDropdownInHover)
|
|
2261
2265
|
this.menuService.destroy();
|
|
@@ -2323,7 +2327,7 @@ class DrDropdownComponent {
|
|
|
2323
2327
|
DrDropdownComponent.decorators = [
|
|
2324
2328
|
{ type: Component, args: [{
|
|
2325
2329
|
selector: 'dr-dropdown',
|
|
2326
|
-
template: "<div #menuContainer\n (mouseleave)=\"onMouseLeave()\"\n (clickOutside)=\"onClickedOutside()\"\n [drDropdownPosition]=\"option\"\n #dropdownPosition=\"dropdownPosition\"\n [position]=\"position\"\n [class]=\"containerClass\"\n class=\"dr-dropdown\">\n <div class=\"dr-dropdown__container\">\n <div *ngFor=\"let act of list | drDropdownItemShowPipe\"\n (click)=\"action(act)\"\n [drTooltip]=\"tooltipToShow(act)\"\n [drTooltipPosition]=\"tooltipPosition(dropdownPosition.widthMoreRight)\"\n [drTooltipOptions]=\"{ withoutArrow: true }\"\n [drTooltipClass]=\"'dr-dropdown__tooltip'\"\n class=\"dr-dropdown__container__item\"\n [class.item-disabled]=\"disabled(act)\"\n [class.item-selected]=\"selected(act)\"\n [class.separate-line]=\"act.separateLine\">\n <i *ngIf=\"act.icon\" [class]=\"act.icon\"></i>\n <span class=\"dr-dropdown__container__item__text\">{{act.title}}</span>\n <i *ngFor=\"let actionIcon of act.actionIcons\"\n [class]=\"actionIcon.icon\"\n [class.showOnHover]=\"actionIcon.showOnHover\"\n (click)=\"onActionIconClick($event, actionIcon, act.data)\"></i>\n <i *ngIf=\"act.children?.length\" class=\"dr-icon-arrow-right\"></i>\n <dr-dropdown *ngIf=\"act.children?.length\" [options]=\"act.childOptions\"></dr-dropdown>\n </div>\n </div>\n</div>\n",
|
|
2330
|
+
template: "<div #menuContainer\n (mouseleave)=\"onMouseLeave()\"\n (mouseenter)=\"onMouseEnter()\"\n (clickOutside)=\"onClickedOutside()\"\n [drDropdownPosition]=\"option\"\n #dropdownPosition=\"dropdownPosition\"\n [position]=\"position\"\n [class]=\"containerClass\"\n class=\"dr-dropdown\">\n <div class=\"dr-dropdown__container\">\n <div *ngFor=\"let act of list | drDropdownItemShowPipe\"\n (click)=\"action(act)\"\n [drTooltip]=\"tooltipToShow(act)\"\n [drTooltipPosition]=\"tooltipPosition(dropdownPosition.widthMoreRight)\"\n [drTooltipOptions]=\"{ withoutArrow: true }\"\n [drTooltipClass]=\"'dr-dropdown__tooltip'\"\n class=\"dr-dropdown__container__item\"\n [class.item-disabled]=\"disabled(act)\"\n [class.item-selected]=\"selected(act)\"\n [class.separate-line]=\"act.separateLine\">\n <i *ngIf=\"act.icon\" [class]=\"act.icon\"></i>\n <span class=\"dr-dropdown__container__item__text\">{{act.title}}</span>\n <i *ngFor=\"let actionIcon of act.actionIcons\"\n [class]=\"actionIcon.icon\"\n [class.showOnHover]=\"actionIcon.showOnHover\"\n (click)=\"onActionIconClick($event, actionIcon, act.data)\"></i>\n <i *ngIf=\"act.children?.length\" class=\"dr-icon-arrow-right\"></i>\n <dr-dropdown *ngIf=\"act.children?.length\" [options]=\"act.childOptions\"></dr-dropdown>\n </div>\n </div>\n</div>\n",
|
|
2327
2331
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2328
2332
|
styles: ["::ng-deep .dr-dropdown__container__item .dr-dropdown{visibility:hidden;transition-delay:.2s}::ng-deep .dr-dropdown__container__item:hover>*>.dr-dropdown{visibility:visible;transition-delay:0s}::ng-deep .dr-dropdown__tooltip>.default-content{max-width:300px;white-space:normal!important}.dr-dropdown{position:absolute;z-index:-1;top:0;left:0;width:auto}.dr-dropdown__container{display:flex;flex-direction:column;background:#fff;border-radius:4px;box-shadow:0 4px 8px 1px #00000040;padding:8px 0;overflow-y:auto;max-height:60vh}.dr-dropdown__container__item{display:flex;align-items:center;justify-content:flex-start;cursor:pointer;min-width:15rem;font-style:normal;font-weight:400;font-size:14px;line-height:24px;clear:both;width:100%;white-space:nowrap;padding:0 12px;height:36px;flex-shrink:0}.dr-dropdown__container__item.separate-line{border-top:1px solid #BCBCBC}.dr-dropdown__container__item:hover{background-color:#f9faff}.dr-dropdown__container__item:hover .showOnHover{visibility:visible}.dr-dropdown__container__item.item-selected{background:#F3F7FF}.dr-dropdown__container__item.item-disabled,.dr-dropdown__container__item.item-disabled i,.dr-dropdown__container__item.item-disabled .dr-dropdown__container__item__text{color:#bcbcbc}.dr-dropdown__container__item i:first-child{margin-right:8px}.dr-dropdown__container__item__text{margin-right:auto;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.dr-dropdown__container__item i,.dr-dropdown__container__item__text{color:#151b3f}.dr-dropdown__container__item i{color:#4e566c}.dr-dropdown__container__item i:hover{color:#4646ce}.dr-dropdown__container__item .showOnHover{visibility:hidden}.dr-dropdown.content-top{transform:translate(-50%,-100%)}.dr-dropdown.content-top-left{transform:translate(-100%,-100%)}.dr-dropdown.content-bottom{transform:translate(-50%,50%)}.dr-dropdown.content-bottom-left{transform:translate(-90%,35%)}.dr-dropdown.content-bottom-right{transform:translateY(15%)}.dr-dropdown.content-left{transform:translate(-100%)}.dr-dropdown.content-left-center{transform:translate(-100%,-50%)}.dr-dropdown.content-right{transform:translate(5%)}\n"]
|
|
2329
2333
|
},] }
|
|
@@ -2346,6 +2350,7 @@ class DrDropdownDirective {
|
|
|
2346
2350
|
this.el = el;
|
|
2347
2351
|
this._document = _document;
|
|
2348
2352
|
this.position = 'left';
|
|
2353
|
+
this.mouseleaveTimeout = 200;
|
|
2349
2354
|
}
|
|
2350
2355
|
elementHover() {
|
|
2351
2356
|
if (!this.drDropdownInHover)
|
|
@@ -2355,6 +2360,16 @@ class DrDropdownDirective {
|
|
|
2355
2360
|
elementClick() {
|
|
2356
2361
|
this.openDropdown();
|
|
2357
2362
|
}
|
|
2363
|
+
leaveDropdownTriggerElement() {
|
|
2364
|
+
if (this.drDropdownInHover) {
|
|
2365
|
+
setTimeout(_ => {
|
|
2366
|
+
if (this.contentCmpRef && !this.contentCmpRef.instance.wasHovered) {
|
|
2367
|
+
this.contentCmpRef.destroy();
|
|
2368
|
+
this.contentCmpRef = null;
|
|
2369
|
+
}
|
|
2370
|
+
}, this.mouseleaveTimeout);
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2358
2373
|
documentClick(e) {
|
|
2359
2374
|
this.closeDropdown(e);
|
|
2360
2375
|
}
|
|
@@ -2377,12 +2392,16 @@ class DrDropdownDirective {
|
|
|
2377
2392
|
}
|
|
2378
2393
|
}
|
|
2379
2394
|
closeDropdown(e) {
|
|
2380
|
-
|
|
2381
|
-
if (menuItem.contains('dr-dropdown__container__item') || menuItem.contains('dr-dropdown__container__item__text')) {
|
|
2395
|
+
if (!this.contentCmpRef) {
|
|
2382
2396
|
return;
|
|
2383
2397
|
}
|
|
2384
|
-
const
|
|
2385
|
-
|
|
2398
|
+
const clickTarget = e.target;
|
|
2399
|
+
const triggerElement = this.el.nativeElement;
|
|
2400
|
+
const dropdownElement = this.contentCmpRef.location.nativeElement;
|
|
2401
|
+
const isClickTriggerElement = triggerElement.contains(clickTarget) || triggerElement === clickTarget;
|
|
2402
|
+
const isClickDropdownContents = dropdownElement.contains(clickTarget);
|
|
2403
|
+
if (!isClickTriggerElement && !isClickDropdownContents) {
|
|
2404
|
+
const elems = this._document.querySelectorAll('dr-dropdown');
|
|
2386
2405
|
setTimeout(() => elems.forEach(item => item.remove()), 100);
|
|
2387
2406
|
}
|
|
2388
2407
|
}
|
|
@@ -2420,6 +2439,7 @@ DrDropdownDirective.propDecorators = {
|
|
|
2420
2439
|
contentCmpRef: [{ type: ViewChild, args: [DrDropdownComponent, { static: true, read: ViewContainerRef },] }],
|
|
2421
2440
|
elementHover: [{ type: HostListener, args: ['mouseenter',] }],
|
|
2422
2441
|
elementClick: [{ type: HostListener, args: ['click',] }],
|
|
2442
|
+
leaveDropdownTriggerElement: [{ type: HostListener, args: ['mouseleave',] }],
|
|
2423
2443
|
documentClick: [{ type: HostListener, args: ['document:mouseup', ['$event'],] }]
|
|
2424
2444
|
};
|
|
2425
2445
|
|
|
@@ -2906,6 +2926,7 @@ var DateFromats;
|
|
|
2906
2926
|
DateFromats["YEAR_FORMAT"] = "yyyy";
|
|
2907
2927
|
DateFromats["MONTH_YEAR_FORMAT"] = "MM/yyyy";
|
|
2908
2928
|
DateFromats["QUARTER_FORMAT"] = "Q/yyyy";
|
|
2929
|
+
DateFromats["WEEK_FORMAT"] = "W/yyyy";
|
|
2909
2930
|
})(DateFromats || (DateFromats = {}));
|
|
2910
2931
|
class CustomDateFormat {
|
|
2911
2932
|
constructor() {
|
|
@@ -2953,6 +2974,7 @@ var TimeframeOption;
|
|
|
2953
2974
|
TimeframeOption["DAY"] = "day";
|
|
2954
2975
|
TimeframeOption["MONTH"] = "month";
|
|
2955
2976
|
TimeframeOption["QUARTER"] = "quarter";
|
|
2977
|
+
TimeframeOption["WEEK"] = "week";
|
|
2956
2978
|
TimeframeOption["YEAR"] = "year";
|
|
2957
2979
|
})(TimeframeOption || (TimeframeOption = {}));
|
|
2958
2980
|
var CalendarView;
|
|
@@ -3050,6 +3072,8 @@ class DrSharedUtils {
|
|
|
3050
3072
|
return TimeframeOption.QUARTER;
|
|
3051
3073
|
case lowerCaseFormat.includes('d'):
|
|
3052
3074
|
return TimeframeOption.DAY;
|
|
3075
|
+
case lowerCaseFormat.includes('w'):
|
|
3076
|
+
return TimeframeOption.WEEK;
|
|
3053
3077
|
case lowerCaseFormat.includes('m'):
|
|
3054
3078
|
return TimeframeOption.MONTH;
|
|
3055
3079
|
case lowerCaseFormat.includes('y'):
|
|
@@ -3066,15 +3090,31 @@ class DrDatePickerService {
|
|
|
3066
3090
|
this.timeframe = TimeframeOption.DAY;
|
|
3067
3091
|
this.format$ = new BehaviorSubject(DateFromats.MAT_DEFAULT_DATE_FORMAT);
|
|
3068
3092
|
this.updatedQuarter$ = new Subject();
|
|
3093
|
+
this.availableTimeframes = [
|
|
3094
|
+
TimeframeOption.DAY,
|
|
3095
|
+
TimeframeOption.WEEK,
|
|
3096
|
+
TimeframeOption.MONTH,
|
|
3097
|
+
TimeframeOption.QUARTER,
|
|
3098
|
+
TimeframeOption.YEAR
|
|
3099
|
+
];
|
|
3069
3100
|
this.formatConfig = {
|
|
3070
3101
|
day: DateFromats.MAT_DEFAULT_DATE_FORMAT,
|
|
3071
3102
|
month: DateFromats.MONTH_YEAR_FORMAT,
|
|
3072
3103
|
year: DateFromats.YEAR_FORMAT,
|
|
3073
3104
|
quarter: DateFromats.QUARTER_FORMAT,
|
|
3105
|
+
week: DateFromats.WEEK_FORMAT
|
|
3074
3106
|
};
|
|
3075
3107
|
}
|
|
3076
|
-
|
|
3077
|
-
|
|
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
|
+
}
|
|
3078
3118
|
}
|
|
3079
3119
|
getTimeframe(format) {
|
|
3080
3120
|
return DrSharedUtils.getTimeframeByDateFormat(format);
|
|
@@ -3107,6 +3147,7 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
3107
3147
|
this.quarters = [1, 2, 3, 4];
|
|
3108
3148
|
this.selectedQuarter = 1;
|
|
3109
3149
|
this.timeframeOptions = [{
|
|
3150
|
+
timeframe: TimeframeOption.DAY,
|
|
3110
3151
|
title: 'Day',
|
|
3111
3152
|
value: CalendarView.FOR_DAYS,
|
|
3112
3153
|
format: this.datePickerService.formatConfig.day,
|
|
@@ -3114,16 +3155,27 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
3114
3155
|
.format(this._calendar.activeDate, this._dateFormats.display.monthYearLabel)
|
|
3115
3156
|
.toLocaleUpperCase()
|
|
3116
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,
|
|
3117
3167
|
title: 'Month',
|
|
3118
3168
|
value: CalendarView.FOR_MONTHS,
|
|
3119
3169
|
format: this.datePickerService.formatConfig.month,
|
|
3120
3170
|
periodLabel: () => String(moment$1(this._calendar.activeDate).year())
|
|
3121
3171
|
}, {
|
|
3172
|
+
timeframe: TimeframeOption.QUARTER,
|
|
3122
3173
|
title: 'Quarter',
|
|
3123
3174
|
value: CalendarView.FOR_QUARTERS,
|
|
3124
3175
|
format: this.datePickerService.formatConfig.quarter,
|
|
3125
3176
|
periodLabel: () => String(moment$1(this._calendar.activeDate).year())
|
|
3126
3177
|
}, {
|
|
3178
|
+
timeframe: TimeframeOption.YEAR,
|
|
3127
3179
|
title: 'Year',
|
|
3128
3180
|
value: CalendarView.FOR_YEARS,
|
|
3129
3181
|
format: this.datePickerService.formatConfig.year,
|
|
@@ -3151,6 +3203,9 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
3151
3203
|
this.selectedTimeframe = this.timeframeOptions.filter(option => option.format == value)[0].value;
|
|
3152
3204
|
_calendar.currentView = this.selectedTimeframe;
|
|
3153
3205
|
this.setPeriodLabels();
|
|
3206
|
+
if (this.selectedTimeframe === CalendarView.FOR_QUARTERS) {
|
|
3207
|
+
this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
|
|
3208
|
+
}
|
|
3154
3209
|
});
|
|
3155
3210
|
_calendar.viewChanged.pipe(takeUntil(this._destroyed)).subscribe(() => this.setPeriodLabels());
|
|
3156
3211
|
}
|
|
@@ -3161,7 +3216,7 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
3161
3216
|
setPeriodLabels() {
|
|
3162
3217
|
const currentTimeframeOption = this.timeframeOptions.filter(option => option.value === this._calendar.currentView)[0];
|
|
3163
3218
|
const fullPeriodLabel = currentTimeframeOption.periodLabel();
|
|
3164
|
-
if (this._calendar.currentView ===
|
|
3219
|
+
if (this._calendar.currentView === CalendarView.FOR_DAYS) {
|
|
3165
3220
|
this.periodMonthLabel = fullPeriodLabel.slice(0, 3);
|
|
3166
3221
|
this.periodYearLabel = fullPeriodLabel.slice(4);
|
|
3167
3222
|
}
|
|
@@ -3205,7 +3260,7 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
3205
3260
|
DrDatePickerCustomHeaderComponent.decorators = [
|
|
3206
3261
|
{ type: Component, args: [{
|
|
3207
3262
|
selector: 'dr-date-picker_custom-header.component',
|
|
3208
|
-
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",
|
|
3209
3264
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
3210
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"]
|
|
3211
3266
|
},] }
|
|
@@ -3375,7 +3430,8 @@ class DrDatePickerWithTimeframeComponent extends DrDatePickerComponent {
|
|
|
3375
3430
|
[TimeframeOption.YEAR]: (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
|
|
3376
3431
|
[TimeframeOption.QUARTER]: (forward) => this.pagingDateChange('addCalendarMonths', 3, forward),
|
|
3377
3432
|
[TimeframeOption.MONTH]: (forward) => this.pagingDateChange('addCalendarMonths', 1, forward),
|
|
3378
|
-
[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)
|
|
3379
3435
|
};
|
|
3380
3436
|
datePickerService.isTimeframeSelectionEnabled = true;
|
|
3381
3437
|
datePickerService.format$
|
|
@@ -3394,19 +3450,19 @@ class DrDatePickerWithTimeframeComponent extends DrDatePickerComponent {
|
|
|
3394
3450
|
this.cdr.markForCheck();
|
|
3395
3451
|
}
|
|
3396
3452
|
}
|
|
3453
|
+
set availableTimeframes(value) {
|
|
3454
|
+
if (value && value.length) {
|
|
3455
|
+
this.datePickerService.availableTimeframes = value;
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3397
3458
|
get displayedFormattedValue() {
|
|
3398
|
-
var _a;
|
|
3399
3459
|
if (!this.value) {
|
|
3400
3460
|
return this.placeholder;
|
|
3401
3461
|
}
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
: this.value.format(this.datePickerService.format$.getValue());
|
|
3462
|
+
const formatCached = this.datePickerService.format$.getValue();
|
|
3463
|
+
return this.datePickerService.getDisplayPrefix() + this.value.format(formatCached);
|
|
3405
3464
|
}
|
|
3406
3465
|
ngOnInit() {
|
|
3407
|
-
if (this.dateFormatConfig) {
|
|
3408
|
-
this.datePickerService.formatConfig = Object.assign(Object.assign({}, this.datePickerService.formatConfig), this.dateFormatConfig);
|
|
3409
|
-
}
|
|
3410
3466
|
this.datePickerService.isTimeframeSelectionEnabled = this.canSelectTimeframe;
|
|
3411
3467
|
this.cdr.markForCheck();
|
|
3412
3468
|
}
|
|
@@ -3441,6 +3497,7 @@ DrDatePickerWithTimeframeComponent.propDecorators = {
|
|
|
3441
3497
|
isDashboardDatepicker: [{ type: Input }],
|
|
3442
3498
|
dateFormatConfig: [{ type: Input }],
|
|
3443
3499
|
canSelectTimeframe: [{ type: Input }],
|
|
3500
|
+
availableTimeframes: [{ type: Input }],
|
|
3444
3501
|
onChangeFormat: [{ type: Output }]
|
|
3445
3502
|
};
|
|
3446
3503
|
|
|
@@ -3486,6 +3543,17 @@ DrDatePickerFormatDirective.propDecorators = {
|
|
|
3486
3543
|
datePickerFormat: [{ type: Input, args: ['drDatePickerFormat',] }]
|
|
3487
3544
|
};
|
|
3488
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
|
+
|
|
3489
3557
|
// !!! Please do not use such approach in other places
|
|
3490
3558
|
// Hard fix for 'none' calendar view selection
|
|
3491
3559
|
MatCalendar.prototype.focusActiveCell = function () {
|
|
@@ -3505,7 +3573,8 @@ const components$1 = [
|
|
|
3505
3573
|
DrDatePickerWithTimeframeComponent,
|
|
3506
3574
|
DrDatePickerFormatDirective,
|
|
3507
3575
|
DrDatePickerCustomHeaderComponent,
|
|
3508
|
-
DrModelDebounceChangeDirective
|
|
3576
|
+
DrModelDebounceChangeDirective,
|
|
3577
|
+
DrShowTimeframePipe
|
|
3509
3578
|
];
|
|
3510
3579
|
class DrInputsModule {
|
|
3511
3580
|
}
|
|
@@ -3667,5 +3736,5 @@ DrAccordionModule.decorators = [
|
|
|
3667
3736
|
* Generated bundle index. Do not edit.
|
|
3668
3737
|
*/
|
|
3669
3738
|
|
|
3670
|
-
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 };
|
|
3671
3740
|
//# sourceMappingURL=datarailsshared-datarailsshared.js.map
|