@datarailsshared/datarailsshared 1.3.44 → 1.3.47
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 +71 -60
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.3.47.tgz +0 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/lib/dr-inputs/dr-date-picker/dr-date-picker.component.js +14 -6
- package/esm2015/lib/dr-inputs/dr-date-picker/dr-date-picker.service.js +2 -2
- package/esm2015/lib/dr-inputs/dr-date-picker/dr-date-picker_custom-header/dr-date-picker_custom-header.component.js +3 -3
- package/fesm2015/datarailsshared-datarailsshared.js +69 -58
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/dr-inputs/dr-date-picker/dr-date-picker.component.d.ts +2 -0
- package/package.json +1 -1
- package/datarailsshared-datarailsshared-1.3.44.tgz +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/material/core'), require('@angular/material-moment-adapter'), require('moment'), require('@angular/common'), require('rxjs'), require('rxjs/operators'), require('@angular/animations'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/button-toggle'), require('@ng-select/ng-select'), require('@angular/material/tooltip'), require('@angular/material/tabs')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@datarailsshared/datarailsshared', ['exports', '@angular/core', '@angular/forms', '@angular/material/core', '@angular/material-moment-adapter', 'moment', '@angular/common', 'rxjs', 'rxjs/operators', '@angular/animations', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/button-toggle', '@ng-select/ng-select', '@angular/material/tooltip', '@angular/material/tabs'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.datarailsshared = global.datarailsshared || {}, global.datarailsshared.datarailsshared = {}), global.ng.core, global.ng.forms, global.ng.material.core, global.ng.materialMomentAdapter, global.
|
|
5
|
-
}(this, (function (exports, i0, forms, core, materialMomentAdapter,
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.datarailsshared = global.datarailsshared || {}, global.datarailsshared.datarailsshared = {}), global.ng.core, global.ng.forms, global.ng.material.core, global.ng.materialMomentAdapter, global.momentImported, global.ng.common, global.rxjs, global.rxjs.operators, global.ng.animations, global.ng.cdk.overlay, global.ng.cdk.portal, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.buttonToggle, global.ngSelect, global.ng.material.tooltip, global.ng.material.tabs));
|
|
5
|
+
}(this, (function (exports, i0, forms, core, materialMomentAdapter, momentImported, common, rxjs, operators, animations, i1, portal, datepicker, formField, input, select, buttonToggle, ngSelect, tooltip, tabs) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
|
-
var
|
|
28
|
+
var momentImported__namespace = /*#__PURE__*/_interopNamespace(momentImported);
|
|
29
29
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
30
30
|
|
|
31
31
|
// import {*} from ""
|
|
@@ -419,7 +419,7 @@
|
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
// @ts-ignore
|
|
422
|
-
var moment$
|
|
422
|
+
var moment$9 = require("moment");
|
|
423
423
|
var ForecastTagComponent = /** @class */ (function (_super) {
|
|
424
424
|
__extends(ForecastTagComponent, _super);
|
|
425
425
|
function ForecastTagComponent() {
|
|
@@ -441,10 +441,10 @@
|
|
|
441
441
|
{ "value": 11, "label": "11+1" }
|
|
442
442
|
];
|
|
443
443
|
_this.dateFilter = function (date) {
|
|
444
|
-
var forecastDate = moment$
|
|
444
|
+
var forecastDate = moment$9.unix(date);
|
|
445
445
|
var status = true;
|
|
446
446
|
_this.lockedDate.forEach(function (timestamp) {
|
|
447
|
-
var locked = moment$
|
|
447
|
+
var locked = moment$9.unix(timestamp);
|
|
448
448
|
return status = !(locked.month() === forecastDate.month() && locked.year() === forecastDate.year());
|
|
449
449
|
});
|
|
450
450
|
return status;
|
|
@@ -461,7 +461,7 @@
|
|
|
461
461
|
this.forecastValue = this.getFiscalMonthFromDate(dateVal, fiscal_year_starts_from) - 1;
|
|
462
462
|
var fiscal_year = this.getFiscalYearFromDate(dateVal, fiscal_year_starts_from, fiscal_year_back);
|
|
463
463
|
console.log("test", dateVal, fiscal_year_starts_from, this.forecastValue, fiscal_year);
|
|
464
|
-
this.dateObj.date = moment$
|
|
464
|
+
this.dateObj.date = moment$9(new Date(fiscal_year, 0, 1)).format("YYYY");
|
|
465
465
|
this.updateLockedDate();
|
|
466
466
|
};
|
|
467
467
|
ForecastTagComponent.prototype.updateLockedDate = function () {
|
|
@@ -470,7 +470,7 @@
|
|
|
470
470
|
var _loop_1 = function (forecastTag) {
|
|
471
471
|
forecastTag.disable = false;
|
|
472
472
|
this_1.lockedDate.forEach(function (timestamp) {
|
|
473
|
-
var locked = moment$
|
|
473
|
+
var locked = moment$9.unix(timestamp);
|
|
474
474
|
if (locked.month() - 1 === forecastTag.value && +locked.year() + 1 === +_this.dateObj.date) {
|
|
475
475
|
forecastTag.disable = true;
|
|
476
476
|
}
|
|
@@ -579,7 +579,7 @@
|
|
|
579
579
|
};
|
|
580
580
|
|
|
581
581
|
// @ts-ignore
|
|
582
|
-
var moment$
|
|
582
|
+
var moment$8 = require("moment");
|
|
583
583
|
var MONTH_FORMATS = {
|
|
584
584
|
parse: {
|
|
585
585
|
dateInput: "DD-MM-YYYY",
|
|
@@ -597,12 +597,12 @@
|
|
|
597
597
|
function MonthTagComponent() {
|
|
598
598
|
var _this = _super.call(this) || this;
|
|
599
599
|
_this.lockedDate = [];
|
|
600
|
-
_this.date = new forms.FormControl(moment$
|
|
600
|
+
_this.date = new forms.FormControl(moment$8());
|
|
601
601
|
_this.dateFilter = function (date) {
|
|
602
|
-
var calendarDate = moment$
|
|
602
|
+
var calendarDate = moment$8(date);
|
|
603
603
|
var status = true;
|
|
604
604
|
_this.lockedDate.forEach(function (timestamp) {
|
|
605
|
-
var lockDate = moment$
|
|
605
|
+
var lockDate = moment$8.unix(timestamp);
|
|
606
606
|
return status = !(lockDate.year() === calendarDate.year() && lockDate.month() === calendarDate.month());
|
|
607
607
|
});
|
|
608
608
|
return status;
|
|
@@ -611,11 +611,11 @@
|
|
|
611
611
|
}
|
|
612
612
|
MonthTagComponent.prototype.initDate = function () {
|
|
613
613
|
if (this.defaultValue) {
|
|
614
|
-
this.dateObj.date = moment$
|
|
615
|
-
this.date = new forms.FormControl(moment$
|
|
614
|
+
this.dateObj.date = moment$8(this.defaultValue * 1000).utc().format("YYYY-MM");
|
|
615
|
+
this.date = new forms.FormControl(moment$8(this.defaultValue * 1000));
|
|
616
616
|
}
|
|
617
617
|
else {
|
|
618
|
-
this.dateObj.date = moment$
|
|
618
|
+
this.dateObj.date = moment$8(new Date()).format("YYYY-MM");
|
|
619
619
|
}
|
|
620
620
|
};
|
|
621
621
|
MonthTagComponent.prototype.initName = function () {
|
|
@@ -624,7 +624,7 @@
|
|
|
624
624
|
}
|
|
625
625
|
};
|
|
626
626
|
MonthTagComponent.prototype.chosenTagHandler = function (value) {
|
|
627
|
-
var resultDate = moment$
|
|
627
|
+
var resultDate = moment$8.utc(value);
|
|
628
628
|
resultDate.hour(12);
|
|
629
629
|
var resultTag = {
|
|
630
630
|
name: this.name,
|
|
@@ -663,7 +663,7 @@
|
|
|
663
663
|
};
|
|
664
664
|
|
|
665
665
|
// @ts-ignore
|
|
666
|
-
var moment$
|
|
666
|
+
var moment$7 = require("moment");
|
|
667
667
|
var QuarterTagComponent = /** @class */ (function (_super) {
|
|
668
668
|
__extends(QuarterTagComponent, _super);
|
|
669
669
|
function QuarterTagComponent() {
|
|
@@ -674,8 +674,8 @@
|
|
|
674
674
|
_this.dateFilter = function (date) {
|
|
675
675
|
var status = true;
|
|
676
676
|
_this.lockedDate.forEach(function (timestamp) {
|
|
677
|
-
var lockDate = moment$
|
|
678
|
-
var quarterDate = moment$
|
|
677
|
+
var lockDate = moment$7.unix(timestamp);
|
|
678
|
+
var quarterDate = moment$7.unix(date.value);
|
|
679
679
|
if (lockDate.year() === quarterDate.year() && lockDate.month() === quarterDate.month()) {
|
|
680
680
|
date.disable = true;
|
|
681
681
|
status = false;
|
|
@@ -718,7 +718,7 @@
|
|
|
718
718
|
};
|
|
719
719
|
QuarterTagComponent.prototype.chosenTagHandler = function (value) {
|
|
720
720
|
var date = new Date(value * 1000);
|
|
721
|
-
var resultDate = moment$
|
|
721
|
+
var resultDate = moment$7.utc(date);
|
|
722
722
|
var resultTag = {
|
|
723
723
|
name: this.name,
|
|
724
724
|
value: parseInt(resultDate.format("X"), 10),
|
|
@@ -776,7 +776,7 @@
|
|
|
776
776
|
};
|
|
777
777
|
|
|
778
778
|
// @ts-ignore
|
|
779
|
-
var moment$
|
|
779
|
+
var moment$6 = require("moment");
|
|
780
780
|
var WEEK_FORMATS = {
|
|
781
781
|
parse: {
|
|
782
782
|
dateInput: "WW-YYYY",
|
|
@@ -794,13 +794,13 @@
|
|
|
794
794
|
function WeekTagComponent() {
|
|
795
795
|
var _this = _super.call(this) || this;
|
|
796
796
|
_this.lockedDate = [];
|
|
797
|
-
_this.date = new forms.FormControl(moment$
|
|
797
|
+
_this.date = new forms.FormControl(moment$6());
|
|
798
798
|
_this.selectedValue = "";
|
|
799
799
|
_this.dateFilter = function (date) {
|
|
800
|
-
var calendarDate = moment$
|
|
800
|
+
var calendarDate = moment$6(date);
|
|
801
801
|
var status = true;
|
|
802
802
|
_this.lockedDate.forEach(function (timestamp) {
|
|
803
|
-
var lockDate = moment$
|
|
803
|
+
var lockDate = moment$6.unix(timestamp);
|
|
804
804
|
return status = !(lockDate.week() === calendarDate.week() && lockDate.year() === calendarDate.year());
|
|
805
805
|
});
|
|
806
806
|
return status;
|
|
@@ -831,7 +831,7 @@
|
|
|
831
831
|
}
|
|
832
832
|
};
|
|
833
833
|
WeekTagComponent.prototype.chosenDateHandler = function (normalizedDay) {
|
|
834
|
-
var date = moment$
|
|
834
|
+
var date = moment$6(normalizedDay).unix();
|
|
835
835
|
this.chosenTagHandler(date);
|
|
836
836
|
};
|
|
837
837
|
WeekTagComponent.prototype.chosenTagHandler = function (value) {
|
|
@@ -843,7 +843,7 @@
|
|
|
843
843
|
else {
|
|
844
844
|
date = new Date(value * 1000);
|
|
845
845
|
}
|
|
846
|
-
var resultDate = moment$
|
|
846
|
+
var resultDate = moment$6(date);
|
|
847
847
|
var resultTag = {
|
|
848
848
|
name: this.name,
|
|
849
849
|
value: parseInt(resultDate.format("X"), 10),
|
|
@@ -854,8 +854,8 @@
|
|
|
854
854
|
this.dateChange.emit(resultTag);
|
|
855
855
|
};
|
|
856
856
|
WeekTagComponent.prototype.getWeekLabel = function (date) {
|
|
857
|
-
return "W" + this.pad(moment$
|
|
858
|
-
" " + moment$
|
|
857
|
+
return "W" + this.pad(moment$6(date).isoWeek(), 2) +
|
|
858
|
+
" " + moment$6(date).year();
|
|
859
859
|
};
|
|
860
860
|
WeekTagComponent.prototype.getUTCTimestamp = function (date) {
|
|
861
861
|
return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), 12, 0, 0, 0);
|
|
@@ -868,7 +868,7 @@
|
|
|
868
868
|
return date;
|
|
869
869
|
};
|
|
870
870
|
WeekTagComponent.prototype.getWeekNumberByDate = function (date) {
|
|
871
|
-
return this.pad(moment$
|
|
871
|
+
return this.pad(moment$6(date).isoWeek(), 2);
|
|
872
872
|
};
|
|
873
873
|
WeekTagComponent.prototype.pad = function (n, width, z) {
|
|
874
874
|
if (z === void 0) { z = "0"; }
|
|
@@ -898,7 +898,7 @@
|
|
|
898
898
|
};
|
|
899
899
|
|
|
900
900
|
// @ts-ignore
|
|
901
|
-
var moment$
|
|
901
|
+
var moment$5 = require("moment");
|
|
902
902
|
var YEAR_FORMATS = {
|
|
903
903
|
parse: {
|
|
904
904
|
dateInput: "YYYY",
|
|
@@ -916,12 +916,12 @@
|
|
|
916
916
|
function YearTagComponent() {
|
|
917
917
|
var _this = _super.call(this) || this;
|
|
918
918
|
_this.lockedDate = [];
|
|
919
|
-
_this.date = new forms.FormControl(moment$
|
|
919
|
+
_this.date = new forms.FormControl(moment$5());
|
|
920
920
|
_this.dateFilter = function (date) {
|
|
921
|
-
var calendarDateYear = moment$
|
|
921
|
+
var calendarDateYear = moment$5(date).year();
|
|
922
922
|
var status = true;
|
|
923
923
|
_this.lockedDate.forEach(function (timestamp) {
|
|
924
|
-
var lockDate = moment$
|
|
924
|
+
var lockDate = moment$5.unix(timestamp);
|
|
925
925
|
return status = !(lockDate.year() === calendarDateYear);
|
|
926
926
|
});
|
|
927
927
|
return status;
|
|
@@ -930,11 +930,11 @@
|
|
|
930
930
|
}
|
|
931
931
|
YearTagComponent.prototype.initDate = function () {
|
|
932
932
|
if (this.defaultValue) {
|
|
933
|
-
this.dateObj.date = moment$
|
|
934
|
-
this.date = new forms.FormControl(moment$
|
|
933
|
+
this.dateObj.date = moment$5(new Date(this.defaultValue * 1000)).utc().format("YYYY");
|
|
934
|
+
this.date = new forms.FormControl(moment$5(this.defaultValue * 1000));
|
|
935
935
|
}
|
|
936
936
|
else {
|
|
937
|
-
this.dateObj.date = moment$
|
|
937
|
+
this.dateObj.date = moment$5(new Date()).format("YYYY");
|
|
938
938
|
}
|
|
939
939
|
};
|
|
940
940
|
YearTagComponent.prototype.initName = function () {
|
|
@@ -944,10 +944,10 @@
|
|
|
944
944
|
};
|
|
945
945
|
YearTagComponent.prototype.chosenTagHandler = function (value) {
|
|
946
946
|
var date = new Date();
|
|
947
|
-
var year = moment$
|
|
947
|
+
var year = moment$5(value).year();
|
|
948
948
|
date.setTime(0);
|
|
949
949
|
date.setFullYear(year, 0, 1);
|
|
950
|
-
var resultDate = moment$
|
|
950
|
+
var resultDate = moment$5.utc(date);
|
|
951
951
|
resultDate.hour(12);
|
|
952
952
|
var resultTag = {
|
|
953
953
|
name: this.name,
|
|
@@ -1041,7 +1041,7 @@
|
|
|
1041
1041
|
tagChange: [{ type: i0.Output }]
|
|
1042
1042
|
};
|
|
1043
1043
|
|
|
1044
|
-
var moment$
|
|
1044
|
+
var moment$4 = momentImported__namespace;
|
|
1045
1045
|
var ListTagComponent = /** @class */ (function () {
|
|
1046
1046
|
function ListTagComponent() {
|
|
1047
1047
|
this.defaultValue = "";
|
|
@@ -1082,7 +1082,7 @@
|
|
|
1082
1082
|
};
|
|
1083
1083
|
|
|
1084
1084
|
// @ts-ignore
|
|
1085
|
-
var moment = require("moment");
|
|
1085
|
+
var moment$3 = require("moment");
|
|
1086
1086
|
var DAY_FORMATS = {
|
|
1087
1087
|
parse: {
|
|
1088
1088
|
dateInput: "DD-MM-YYYY",
|
|
@@ -1100,9 +1100,9 @@
|
|
|
1100
1100
|
function DayTagComponent() {
|
|
1101
1101
|
var _this = _super.call(this) || this;
|
|
1102
1102
|
_this.lockedDate = [];
|
|
1103
|
-
_this.date = new forms.FormControl(moment());
|
|
1103
|
+
_this.date = new forms.FormControl(moment$3());
|
|
1104
1104
|
_this.dateFilter = function (date) {
|
|
1105
|
-
var calendarDate = moment(date).unix();
|
|
1105
|
+
var calendarDate = moment$3(date).unix();
|
|
1106
1106
|
var status = true;
|
|
1107
1107
|
_this.lockedDate.forEach(function (timestamp) {
|
|
1108
1108
|
return status = !(timestamp === calendarDate);
|
|
@@ -1112,10 +1112,10 @@
|
|
|
1112
1112
|
return _this;
|
|
1113
1113
|
}
|
|
1114
1114
|
DayTagComponent.prototype.initDate = function () {
|
|
1115
|
-
var utcOffsetInMilliseconds = moment().utcOffset() * 60 * 1000;
|
|
1116
|
-
this.dateObj.date = moment(moment().valueOf() + utcOffsetInMilliseconds);
|
|
1115
|
+
var utcOffsetInMilliseconds = moment$3().utcOffset() * 60 * 1000;
|
|
1116
|
+
this.dateObj.date = moment$3(moment$3().valueOf() + utcOffsetInMilliseconds);
|
|
1117
1117
|
if (this.defaultValue) {
|
|
1118
|
-
this.dateObj.date = moment(new Date(this.defaultValue * 1000)).utc();
|
|
1118
|
+
this.dateObj.date = moment$3(new Date(this.defaultValue * 1000)).utc();
|
|
1119
1119
|
this.date.setValue(this.dateObj.date);
|
|
1120
1120
|
}
|
|
1121
1121
|
};
|
|
@@ -1125,11 +1125,11 @@
|
|
|
1125
1125
|
}
|
|
1126
1126
|
};
|
|
1127
1127
|
DayTagComponent.prototype.chosenTagHandler = function (value) {
|
|
1128
|
-
var date = moment(value).unix();
|
|
1128
|
+
var date = moment$3(value).unix();
|
|
1129
1129
|
var resultTag = {
|
|
1130
1130
|
name: this.name,
|
|
1131
1131
|
value: date,
|
|
1132
|
-
label: moment.unix(date).format("MM/DD/YYYY"),
|
|
1132
|
+
label: moment$3.unix(date).format("MM/DD/YYYY"),
|
|
1133
1133
|
locked: !this.dateFilter(value)
|
|
1134
1134
|
};
|
|
1135
1135
|
console.log("resultTag", resultTag);
|
|
@@ -2427,6 +2427,7 @@
|
|
|
2427
2427
|
return CustomDateFormat;
|
|
2428
2428
|
}());
|
|
2429
2429
|
|
|
2430
|
+
var moment$2 = require('moment');
|
|
2430
2431
|
var DrDatePickerService = /** @class */ (function () {
|
|
2431
2432
|
function DrDatePickerService() {
|
|
2432
2433
|
this.timeframe = 'day';
|
|
@@ -2434,7 +2435,7 @@
|
|
|
2434
2435
|
this.updatedQuater = new rxjs.Subject();
|
|
2435
2436
|
}
|
|
2436
2437
|
DrDatePickerService.prototype.getQuarterDisplay = function (value, format) {
|
|
2437
|
-
return 'Q' +
|
|
2438
|
+
return 'Q' + moment$2(value).quarter() + format.charAt(1) + moment$2(value).year();
|
|
2438
2439
|
};
|
|
2439
2440
|
DrDatePickerService.prototype.setTimeframe = function (format) {
|
|
2440
2441
|
var lowerCaseFormat = format.toLowerCase();
|
|
@@ -2464,6 +2465,7 @@
|
|
|
2464
2465
|
},] }
|
|
2465
2466
|
];
|
|
2466
2467
|
|
|
2468
|
+
var moment$1 = require('moment');
|
|
2467
2469
|
var DrDatePickerCustomHeaderComponent = /** @class */ (function () {
|
|
2468
2470
|
function DrDatePickerCustomHeaderComponent(_calendar, _dateAdapter, _dateFormats, cdr, datePickerService) {
|
|
2469
2471
|
var _this = this;
|
|
@@ -2486,18 +2488,18 @@
|
|
|
2486
2488
|
title: 'Month',
|
|
2487
2489
|
value: 'year',
|
|
2488
2490
|
format: MONTH_YEAR_FORMAT,
|
|
2489
|
-
periodLabel: function () { return String(
|
|
2491
|
+
periodLabel: function () { return String(moment$1(_this._calendar.activeDate).year()); }
|
|
2490
2492
|
}, {
|
|
2491
2493
|
title: 'Quarter',
|
|
2492
2494
|
value: 'none',
|
|
2493
2495
|
format: QUARTER_FORMAT,
|
|
2494
|
-
periodLabel: function () { return String(
|
|
2496
|
+
periodLabel: function () { return String(moment$1(_this._calendar.activeDate).year()); }
|
|
2495
2497
|
}, {
|
|
2496
2498
|
title: 'Year',
|
|
2497
2499
|
value: 'multi-year',
|
|
2498
2500
|
format: YEAR_FORMAT,
|
|
2499
2501
|
periodLabel: function () {
|
|
2500
|
-
var currentYear =
|
|
2502
|
+
var currentYear = moment$1(_this._calendar.activeDate).year();
|
|
2501
2503
|
var startPeriod = Math.floor(currentYear / 24) * 24;
|
|
2502
2504
|
return startPeriod + '-' + (startPeriod + 23);
|
|
2503
2505
|
}
|
|
@@ -2544,8 +2546,8 @@
|
|
|
2544
2546
|
this.setPeriodLabels(chosenTimeframeOption);
|
|
2545
2547
|
this.datePickerService.format.next(chosenTimeframeOption.format);
|
|
2546
2548
|
this.datePickerService.setTimeframe(chosenTimeframeOption.format);
|
|
2547
|
-
if (this.selectedTimeframe ==
|
|
2548
|
-
this.selectedQuarter =
|
|
2549
|
+
if (this.selectedTimeframe == 'none') {
|
|
2550
|
+
this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
|
|
2549
2551
|
}
|
|
2550
2552
|
};
|
|
2551
2553
|
Object.defineProperty(DrDatePickerCustomHeaderComponent.prototype, "currentViewIsQuater", {
|
|
@@ -2560,10 +2562,10 @@
|
|
|
2560
2562
|
};
|
|
2561
2563
|
DrDatePickerCustomHeaderComponent.prototype.onSelectQuater = function (quarterNumber) {
|
|
2562
2564
|
var monthsInQuarter = 3;
|
|
2563
|
-
this.selectedQuarter =
|
|
2565
|
+
this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
|
|
2564
2566
|
var unadaptedDate = this._dateAdapter.addCalendarMonths(this._calendar.activeDate, monthsInQuarter * (quarterNumber - this.selectedQuarter));
|
|
2565
2567
|
this._calendar.activeDate = unadaptedDate;
|
|
2566
|
-
this.datePickerService.updatedQuater.next(
|
|
2568
|
+
this.datePickerService.updatedQuater.next(moment$1(unadaptedDate));
|
|
2567
2569
|
this.datePickerService.calendarInstance.close();
|
|
2568
2570
|
};
|
|
2569
2571
|
DrDatePickerCustomHeaderComponent.prototype.pagingClicked = function (forward) {
|
|
@@ -2593,6 +2595,7 @@
|
|
|
2593
2595
|
{ type: DrDatePickerService }
|
|
2594
2596
|
]; };
|
|
2595
2597
|
|
|
2598
|
+
var moment = require('moment');
|
|
2596
2599
|
var noop = function () { };
|
|
2597
2600
|
var ɵ0$1 = noop;
|
|
2598
2601
|
var DrDatePickerComponent = /** @class */ (function () {
|
|
@@ -2607,6 +2610,7 @@
|
|
|
2607
2610
|
this.customHeader = DrDatePickerCustomHeaderComponent;
|
|
2608
2611
|
this.onChangeFormat = new i0.EventEmitter();
|
|
2609
2612
|
this.timeframeSelection = false;
|
|
2613
|
+
this.takeEndOfPeriod = false;
|
|
2610
2614
|
this.placeholder = 'Select';
|
|
2611
2615
|
this.min = null;
|
|
2612
2616
|
this.max = null;
|
|
@@ -2635,7 +2639,9 @@
|
|
|
2635
2639
|
datePickerService.updatedQuater
|
|
2636
2640
|
.pipe(operators.takeUntil(this._destroyed))
|
|
2637
2641
|
.subscribe(function (value) {
|
|
2642
|
+
_this.tryToNormalaizeTimeframe(value, 'quarter');
|
|
2638
2643
|
_this.writeValue(value);
|
|
2644
|
+
_this.onChangeCallback(value);
|
|
2639
2645
|
});
|
|
2640
2646
|
}
|
|
2641
2647
|
Object.defineProperty(DrDatePickerComponent.prototype, "format", {
|
|
@@ -2665,6 +2671,11 @@
|
|
|
2665
2671
|
};
|
|
2666
2672
|
}, 1000);
|
|
2667
2673
|
};
|
|
2674
|
+
DrDatePickerComponent.prototype.tryToNormalaizeTimeframe = function (normalizedRef, timeframe) {
|
|
2675
|
+
if (this.takeEndOfPeriod) {
|
|
2676
|
+
normalizedRef.endOf(timeframe);
|
|
2677
|
+
}
|
|
2678
|
+
};
|
|
2668
2679
|
Object.defineProperty(DrDatePickerComponent.prototype, "value", {
|
|
2669
2680
|
get: function () {
|
|
2670
2681
|
return this.innerValue;
|
|
@@ -2672,7 +2683,6 @@
|
|
|
2672
2683
|
set: function (v) {
|
|
2673
2684
|
if (v !== this.innerValue) {
|
|
2674
2685
|
this.innerValue = v;
|
|
2675
|
-
this.onChangeCallback(v);
|
|
2676
2686
|
}
|
|
2677
2687
|
this.cdr.markForCheck();
|
|
2678
2688
|
},
|
|
@@ -2688,14 +2698,12 @@
|
|
|
2688
2698
|
DrDatePickerComponent.prototype.writeValue = function (value) {
|
|
2689
2699
|
if (value !== this.innerValue) {
|
|
2690
2700
|
if (value && typeof value === 'number') {
|
|
2691
|
-
this.innerValue =
|
|
2701
|
+
this.innerValue = moment.unix(value);
|
|
2692
2702
|
}
|
|
2693
2703
|
else {
|
|
2694
2704
|
this.innerValue = value;
|
|
2695
2705
|
}
|
|
2696
|
-
|
|
2697
|
-
moment__namespace(value).endOf(this.datePickerService.timeframe);
|
|
2698
|
-
}
|
|
2706
|
+
this.tryToNormalaizeTimeframe(this.innerValue, this.datePickerService.timeframe);
|
|
2699
2707
|
this.cdr.markForCheck();
|
|
2700
2708
|
}
|
|
2701
2709
|
};
|
|
@@ -2717,6 +2725,7 @@
|
|
|
2717
2725
|
};
|
|
2718
2726
|
DrDatePickerComponent.prototype.chosenMonthHandler = function (normalizedMonth, datepicker) {
|
|
2719
2727
|
if (this.datePickerService.timeframe == 'month') {
|
|
2728
|
+
this.tryToNormalaizeTimeframe(normalizedMonth, 'month');
|
|
2720
2729
|
this.writeValue(normalizedMonth);
|
|
2721
2730
|
this.onChangeCallback(normalizedMonth);
|
|
2722
2731
|
datepicker.close();
|
|
@@ -2724,6 +2733,7 @@
|
|
|
2724
2733
|
};
|
|
2725
2734
|
DrDatePickerComponent.prototype.chosenYearHandler = function (normalizedYear, datepicker) {
|
|
2726
2735
|
if (this.datePickerService.timeframe == 'year') {
|
|
2736
|
+
this.tryToNormalaizeTimeframe(normalizedYear, 'year');
|
|
2727
2737
|
this.writeValue(normalizedYear);
|
|
2728
2738
|
this.onChangeCallback(normalizedYear);
|
|
2729
2739
|
datepicker.close();
|
|
@@ -2769,6 +2779,7 @@
|
|
|
2769
2779
|
onChangeFormat: [{ type: i0.Output }],
|
|
2770
2780
|
format: [{ type: i0.Input }],
|
|
2771
2781
|
timeframeSelection: [{ type: i0.Input }],
|
|
2782
|
+
takeEndOfPeriod: [{ type: i0.Input }],
|
|
2772
2783
|
placeholder: [{ type: i0.Input }],
|
|
2773
2784
|
min: [{ type: i0.Input }],
|
|
2774
2785
|
max: [{ type: i0.Input }],
|