@datarailsshared/datarailsshared 1.4.180 → 1.4.182
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 +25 -28
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.4.182.tgz +0 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/lib/date-tags/forecast-tag/forecast-tag.component.js +26 -29
- package/fesm2015/datarailsshared-datarailsshared.js +25 -28
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/date-tags/forecast-tag/forecast-tag.component.d.ts +1 -0
- package/package.json +1 -1
- package/datarailsshared-datarailsshared-1.4.180.tgz +0 -0
|
@@ -441,17 +441,17 @@
|
|
|
441
441
|
return _this;
|
|
442
442
|
}
|
|
443
443
|
ForecastTagComponent.prototype.initDate = function () {
|
|
444
|
-
var dateVal =
|
|
445
|
-
if (this.defaultValue) {
|
|
446
|
-
dateVal = new Date(this.defaultValue * 1000);
|
|
447
|
-
}
|
|
444
|
+
var dateVal = this.defaultValue ? moment$8.unix(this.defaultValue) : moment$8();
|
|
448
445
|
var fiscal_year_starts_from = this.fiscalYearStartsFrom || 1;
|
|
449
446
|
var fiscal_year_back = this.fiscalYearBack || false;
|
|
450
447
|
this.forecastValue = this.getFiscalMonthFromDate(dateVal, fiscal_year_starts_from) - 1;
|
|
451
448
|
var fiscal_year = this.getFiscalYearFromDate(dateVal, fiscal_year_starts_from, fiscal_year_back);
|
|
452
|
-
this.
|
|
449
|
+
this.updateYear(fiscal_year, this.forecastValue);
|
|
453
450
|
this.updateLockedDate();
|
|
454
451
|
};
|
|
452
|
+
ForecastTagComponent.prototype.updateYear = function (fiscalYear, month) {
|
|
453
|
+
this.dateObj.date = fiscalYear ? moment$8((month || '01') + "/01/" + fiscalYear + " 12:00:00", 'MM/DD/YYYY hh:mm:ss').utc().unix() : moment$8.utc().unix();
|
|
454
|
+
};
|
|
455
455
|
ForecastTagComponent.prototype.updateLockedDate = function () {
|
|
456
456
|
var e_1, _a;
|
|
457
457
|
var year = moment$8.unix(this.dateObj.date).year();
|
|
@@ -478,7 +478,7 @@
|
|
|
478
478
|
};
|
|
479
479
|
ForecastTagComponent.prototype.initName = function () {
|
|
480
480
|
if (!this.name) {
|
|
481
|
-
this.name = 'Forecast';
|
|
481
|
+
this.name = 'Forecast (New)';
|
|
482
482
|
}
|
|
483
483
|
};
|
|
484
484
|
ForecastTagComponent.prototype.getFiscalMonthFromDate = function (dateObj, fiscal_year_starts_from) {
|
|
@@ -489,31 +489,29 @@
|
|
|
489
489
|
for (var i = 1; i < fiscal_year_starts_from; i++) {
|
|
490
490
|
all_months.push(i);
|
|
491
491
|
}
|
|
492
|
-
return all_months.indexOf(dateObj.
|
|
492
|
+
return all_months.indexOf(dateObj.month() + 1) + 1;
|
|
493
493
|
};
|
|
494
494
|
ForecastTagComponent.prototype.getFiscalYearFromDate = function (dateObj, fiscal_year_starts_from, fiscal_year_back) {
|
|
495
|
-
var fiscal_year = dateObj.
|
|
495
|
+
var fiscal_year = dateObj.year();
|
|
496
496
|
if (!fiscal_year_back) {
|
|
497
|
-
if (dateObj.
|
|
497
|
+
if (dateObj.month() + 1 >= fiscal_year_starts_from && fiscal_year_starts_from !== 1) {
|
|
498
498
|
fiscal_year += 1;
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
501
|
else {
|
|
502
|
-
if (dateObj.
|
|
502
|
+
if (dateObj.month() + 1 < fiscal_year_starts_from && fiscal_year_starts_from !== 1) {
|
|
503
503
|
fiscal_year -= 1;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
return fiscal_year;
|
|
507
507
|
};
|
|
508
508
|
ForecastTagComponent.prototype.getForecastLabelFromValue = function (value, fiscal_year_starts_from, fiscal_year_back) {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
}
|
|
516
|
-
return label;
|
|
509
|
+
if (!value)
|
|
510
|
+
return '';
|
|
511
|
+
var dateObj = moment$8.unix(value);
|
|
512
|
+
var fiscal_month = this.getFiscalMonthFromDate(dateObj, fiscal_year_starts_from);
|
|
513
|
+
var fiscal_year = this.getFiscalYearFromDate(dateObj, fiscal_year_starts_from, fiscal_year_back);
|
|
514
|
+
return fiscal_month + "+" + (12 - fiscal_month) + " (" + fiscal_year + ")";
|
|
517
515
|
};
|
|
518
516
|
ForecastTagComponent.prototype.changeTagInputHandler = function (event) {
|
|
519
517
|
this.chosenTagHandler();
|
|
@@ -528,23 +526,22 @@
|
|
|
528
526
|
return;
|
|
529
527
|
var month = this.forecastValue;
|
|
530
528
|
var year = moment$8.unix(this.dateObj.date).year();
|
|
531
|
-
var timeStampVal = 0;
|
|
532
529
|
var label = '';
|
|
533
530
|
if (!Number.isNaN(month) && !Number.isNaN(year)) {
|
|
534
|
-
var date =
|
|
531
|
+
var date = moment$8(month + "/01/" + year + " 12:00:00", 'MM/DD/YYYY hh:mm:ss');
|
|
535
532
|
var fiscal_year_starts_from = this.fiscalYearStartsFrom || 1;
|
|
536
533
|
var fiscal_year_back = this.fiscalYearBack || false;
|
|
537
534
|
if (fiscal_year_starts_from !== 1) {
|
|
538
535
|
if (!fiscal_year_back) {
|
|
539
|
-
date.
|
|
536
|
+
date.set('month', date.month() - 13 + fiscal_year_starts_from);
|
|
540
537
|
}
|
|
541
538
|
else {
|
|
542
|
-
date.
|
|
539
|
+
date.set('month', date.month() - 1 + fiscal_year_starts_from);
|
|
543
540
|
}
|
|
544
541
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
this.
|
|
542
|
+
label = this.getForecastLabelFromValue(date.unix(), fiscal_year_starts_from, fiscal_year_back);
|
|
543
|
+
var fiscal_year = this.getFiscalYearFromDate(date, fiscal_year_starts_from, fiscal_year_back);
|
|
544
|
+
this.updateYear(fiscal_year, month);
|
|
548
545
|
this.isDateEventHappened = true;
|
|
549
546
|
setTimeout(function () {
|
|
550
547
|
_this.isDateEventHappened = false;
|
|
@@ -552,9 +549,9 @@
|
|
|
552
549
|
}
|
|
553
550
|
var resultTag = {
|
|
554
551
|
name: this.name,
|
|
555
|
-
value:
|
|
552
|
+
value: this.dateObj.date,
|
|
556
553
|
label: label,
|
|
557
|
-
locked: !this.dateFilter(moment$8.unix(
|
|
554
|
+
locked: !this.dateFilter(moment$8.unix(this.dateObj.date))
|
|
558
555
|
};
|
|
559
556
|
this.dateChange.emit(resultTag);
|
|
560
557
|
};
|
|
@@ -571,7 +568,7 @@
|
|
|
571
568
|
}(AnyTagComponent));
|
|
572
569
|
ForecastTagComponent.decorators = [
|
|
573
570
|
{ type: i0.Component, args: [{
|
|
574
|
-
template: "<div class=\"forecast-tag__container\">\n <div class=\"forecast-tag__forecast\">\n <p class=\"tag__label\">
|
|
571
|
+
template: "<div class=\"forecast-tag__container\">\n <div class=\"forecast-tag__forecast\">\n <p class=\"tag__label\">Forecast</p>\n <dr-select placeholder=\"Select\"\n [(ngModel)]=\"forecastValue\"\n bindLabel=\"label\"\n bindValue=\"value\"\n [disabled]=\"disabled\"\n [items]=\"forecastTags\"\n (ngModelChange)=\"changeTagInputHandler($event)\"></dr-select>\n </div>\n <div class=\"forecast-tag__year\">\n <p class=\"tag__label\">Year</p>\n <dr-date-picker format=\"year\"\n [(ngModel)]=\"dateObj.date\"\n [datepickerFilter]=\"dateFilter.bind(this)\"\n [disabled]=\"disabled\"\n (ngModelChange)=\"changeYearInputHandler($event)\"></dr-date-picker>\n </div>\n</div>\n",
|
|
575
572
|
selector: 'forecast-tag',
|
|
576
573
|
providers: [
|
|
577
574
|
{
|