@datarailsshared/datarailsshared 1.4.304 → 1.4.308
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 +23 -12
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.4.308.tgz +0 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/lib/date-tags/forecast-tag/forecast-tag.component.js +19 -11
- package/esm2015/lib/date-tags/quarter-tag/quarter-tag.component.js +6 -3
- package/fesm2015/datarailsshared-datarailsshared.js +23 -12
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/date-tags/forecast-tag/forecast-tag.component.d.ts +4 -2
- package/lib/date-tags/quarter-tag/quarter-tag.component.d.ts +2 -2
- package/package.json +1 -1
- package/datarailsshared-datarailsshared-1.4.304.tgz +0 -0
|
@@ -441,15 +441,20 @@
|
|
|
441
441
|
_this.initDateValue = null;
|
|
442
442
|
return _this;
|
|
443
443
|
}
|
|
444
|
-
ForecastTagComponent.prototype.ngOnChanges = function () {
|
|
445
|
-
|
|
446
|
-
|
|
444
|
+
ForecastTagComponent.prototype.ngOnChanges = function (changes) {
|
|
445
|
+
if (changes.lockedDate) {
|
|
446
|
+
this.updateLockedDate();
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
ForecastTagComponent.prototype.isNeedToIncrementYear = function (dateObj, fiscalYearStartsFrom) {
|
|
450
|
+
return dateObj.month() + 1 >= fiscalYearStartsFrom;
|
|
447
451
|
};
|
|
448
452
|
ForecastTagComponent.prototype.initDate = function () {
|
|
449
453
|
var dateVal = this.defaultValue ? moment$8.unix(this.defaultValue) : moment$8();
|
|
450
454
|
var fiscal_year_starts_from = this.fiscalYearStartsFrom || 1;
|
|
451
455
|
var fiscal_year_back = this.fiscalYearBack || false;
|
|
452
456
|
this.forecastValue = this.getFiscalMonthFromDate(dateVal, fiscal_year_starts_from) - 1;
|
|
457
|
+
this.initialForecastValue = this.forecastValue;
|
|
453
458
|
var fiscal_year = this.getFiscalYearFromDate(dateVal, fiscal_year_starts_from, fiscal_year_back);
|
|
454
459
|
this.updateYear(fiscal_year, this.forecastValue);
|
|
455
460
|
this.updateLockedDate();
|
|
@@ -491,15 +496,18 @@
|
|
|
491
496
|
return all_months.indexOf(dateObj.month() + 1) + 1;
|
|
492
497
|
};
|
|
493
498
|
ForecastTagComponent.prototype.getFiscalYearFromDate = function (dateObj, fiscal_year_starts_from, fiscal_year_back) {
|
|
499
|
+
var _a;
|
|
494
500
|
var fiscal_year = dateObj.year();
|
|
495
|
-
if (
|
|
496
|
-
if (
|
|
497
|
-
|
|
501
|
+
if (this.initialForecastValue !== this.forecastValue && !!((_a = this.dateObj) === null || _a === void 0 ? void 0 : _a.date) && dateObj.year() - moment$8.unix(this.defaultValue).year() < 1 && fiscal_year_starts_from !== 1) {
|
|
502
|
+
if (!fiscal_year_back) {
|
|
503
|
+
if (this.isNeedToIncrementYear(dateObj, fiscal_year_starts_from)) {
|
|
504
|
+
fiscal_year += 1;
|
|
505
|
+
}
|
|
498
506
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
507
|
+
else {
|
|
508
|
+
if (!this.isNeedToIncrementYear(dateObj, fiscal_year_starts_from)) {
|
|
509
|
+
fiscal_year -= 1;
|
|
510
|
+
}
|
|
503
511
|
}
|
|
504
512
|
}
|
|
505
513
|
return fiscal_year;
|
|
@@ -683,8 +691,11 @@
|
|
|
683
691
|
enumerable: false,
|
|
684
692
|
configurable: true
|
|
685
693
|
});
|
|
686
|
-
QuarterTagComponent.prototype.ngOnChanges = function () {
|
|
687
|
-
|
|
694
|
+
QuarterTagComponent.prototype.ngOnChanges = function (changes) {
|
|
695
|
+
if (changes.lockedDate) {
|
|
696
|
+
this.initName();
|
|
697
|
+
this.initTags();
|
|
698
|
+
}
|
|
688
699
|
};
|
|
689
700
|
QuarterTagComponent.prototype.ngOnInit = function () {
|
|
690
701
|
this.initName();
|