@datarailsshared/datarailsshared 1.5.526 → 1.5.531
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/datarailsshared-datarailsshared-1.5.531.tgz +0 -0
- package/esm2022/lib/date-tags/forecast-tag/forecast-tag.component.mjs +16 -23
- package/esm2022/lib/date-tags/forecast-tag/forecast-tag.service.mjs +18 -14
- package/esm2022/lib/dr-tags/dr-tag.component.mjs +1 -2
- package/esm2022/lib/models/serverTags.mjs +1 -1
- package/fesm2022/datarailsshared-datarailsshared.mjs +32 -36
- package/fesm2022/datarailsshared-datarailsshared.mjs.map +1 -1
- package/lib/date-tags/forecast-tag/forecast-tag.component.d.ts +2 -1
- package/lib/date-tags/forecast-tag/forecast-tag.service.d.ts +2 -1
- package/lib/models/serverTags.d.ts +0 -2
- package/package.json +1 -1
- package/datarailsshared-datarailsshared-1.5.526.tgz +0 -0
|
@@ -2440,7 +2440,7 @@ function ForecastTagComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
2440
2440
|
i0.ɵɵtext(8, "Year");
|
|
2441
2441
|
i0.ɵɵelementEnd();
|
|
2442
2442
|
i0.ɵɵelementStart(9, "dr-date-picker", 7);
|
|
2443
|
-
i0.ɵɵlistener("ngModelChange", function ForecastTagComponent_ng_container_0_Template_dr_date_picker_ngModelChange_9_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r6 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r6.
|
|
2443
|
+
i0.ɵɵlistener("ngModelChange", function ForecastTagComponent_ng_container_0_Template_dr_date_picker_ngModelChange_9_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r6 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r6.forecastYear = $event); })("ngModelChange", function ForecastTagComponent_ng_container_0_Template_dr_date_picker_ngModelChange_9_listener() { i0.ɵɵrestoreView(_r4); const ctx_r7 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r7.changeYearInputHandler()); });
|
|
2444
2444
|
i0.ɵɵelementEnd()()();
|
|
2445
2445
|
i0.ɵɵelementContainerEnd();
|
|
2446
2446
|
} if (rf & 2) {
|
|
@@ -2448,7 +2448,7 @@ function ForecastTagComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) {
|
|
|
2448
2448
|
i0.ɵɵadvance(5);
|
|
2449
2449
|
i0.ɵɵproperty("ngModel", ctx_r0.forecastValue)("disabled", ctx_r0.disabled)("items", ctx_r0.forecastTags);
|
|
2450
2450
|
i0.ɵɵadvance(4);
|
|
2451
|
-
i0.ɵɵproperty("ngModel", ctx_r0.
|
|
2451
|
+
i0.ɵɵproperty("ngModel", ctx_r0.forecastYear)("datepickerFilter", ctx_r0.dateFilter.bind(ctx_r0))("disabled", ctx_r0.disabled);
|
|
2452
2452
|
} }
|
|
2453
2453
|
function ForecastTagComponent_ng_template_1_Template(rf, ctx) { if (rf & 1) {
|
|
2454
2454
|
const _r9 = i0.ɵɵgetCurrentView();
|
|
@@ -2456,7 +2456,7 @@ function ForecastTagComponent_ng_template_1_Template(rf, ctx) { if (rf & 1) {
|
|
|
2456
2456
|
i0.ɵɵtext(2, "Period");
|
|
2457
2457
|
i0.ɵɵelementEnd();
|
|
2458
2458
|
i0.ɵɵelementStart(3, "div", 9)(4, "dr-date-picker", 10);
|
|
2459
|
-
i0.ɵɵlistener("ngModelChange", function ForecastTagComponent_ng_template_1_Template_dr_date_picker_ngModelChange_4_listener($event) { i0.ɵɵrestoreView(_r9); const ctx_r8 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r8.
|
|
2459
|
+
i0.ɵɵlistener("ngModelChange", function ForecastTagComponent_ng_template_1_Template_dr_date_picker_ngModelChange_4_listener($event) { i0.ɵɵrestoreView(_r9); const ctx_r8 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r8.forecastYear = $event); })("ngModelChange", function ForecastTagComponent_ng_template_1_Template_dr_date_picker_ngModelChange_4_listener() { i0.ɵɵrestoreView(_r9); const ctx_r10 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r10.changeYearInputHandler()); });
|
|
2460
2460
|
i0.ɵɵelementEnd();
|
|
2461
2461
|
i0.ɵɵelementStart(5, "dr-select", 11);
|
|
2462
2462
|
i0.ɵɵlistener("ngModelChange", function ForecastTagComponent_ng_template_1_Template_dr_select_ngModelChange_5_listener($event) { i0.ɵɵrestoreView(_r9); const ctx_r11 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r11.forecastValue = $event); })("ngModelChange", function ForecastTagComponent_ng_template_1_Template_dr_select_ngModelChange_5_listener() { i0.ɵɵrestoreView(_r9); const ctx_r12 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r12.changeTagInputHandler()); });
|
|
@@ -2464,11 +2464,12 @@ function ForecastTagComponent_ng_template_1_Template(rf, ctx) { if (rf & 1) {
|
|
|
2464
2464
|
} if (rf & 2) {
|
|
2465
2465
|
const ctx_r2 = i0.ɵɵnextContext();
|
|
2466
2466
|
i0.ɵɵadvance(4);
|
|
2467
|
-
i0.ɵɵproperty("ngModel", ctx_r2.
|
|
2467
|
+
i0.ɵɵproperty("ngModel", ctx_r2.forecastYear)("datepickerFilter", ctx_r2.dateFilter.bind(ctx_r2))("disabled", ctx_r2.disabled);
|
|
2468
2468
|
i0.ɵɵadvance(1);
|
|
2469
2469
|
i0.ɵɵproperty("ngModel", ctx_r2.forecastValue)("disabled", ctx_r2.disabled)("items", ctx_r2.forecastTags);
|
|
2470
2470
|
} }
|
|
2471
2471
|
/* BEFORE MERGE INTO MASTER YOU MUST CONSULT WITH ARTEM LAZIUK !!!*/
|
|
2472
|
+
const FORECAST_DEFAULT_DATE_FORMAT = 'MM/DD/yyyy';
|
|
2472
2473
|
class ForecastTagComponent extends AnyTagComponent {
|
|
2473
2474
|
constructor() {
|
|
2474
2475
|
super();
|
|
@@ -2491,6 +2492,7 @@ class ForecastTagComponent extends AnyTagComponent {
|
|
|
2491
2492
|
{ value: 11, label: '11+1', disabled: false },
|
|
2492
2493
|
];
|
|
2493
2494
|
this.initDateValue = null;
|
|
2495
|
+
this.firstDayMonthOfYear = '01';
|
|
2494
2496
|
}
|
|
2495
2497
|
ngOnChanges(changes) {
|
|
2496
2498
|
if (changes.lockedDate) {
|
|
@@ -2501,21 +2503,16 @@ class ForecastTagComponent extends AnyTagComponent {
|
|
|
2501
2503
|
const dateVal = this.defaultValue ? moment.unix(this.defaultValue) : moment();
|
|
2502
2504
|
const fiscal_year_starts_from = this.fiscalYearStartsFrom || 1;
|
|
2503
2505
|
this.forecastValue = this.getFiscalMonthFromDate(dateVal, fiscal_year_starts_from) - 1;
|
|
2504
|
-
this.
|
|
2506
|
+
this.forecastYear = moment
|
|
2507
|
+
.utc(`${this.firstDayMonthOfYear}/${this.firstDayMonthOfYear}/${this.getFiscalYearFromDate(dateVal, fiscal_year_starts_from, this.fiscalYearBack)}`, FORECAST_DEFAULT_DATE_FORMAT)
|
|
2508
|
+
.unix();
|
|
2505
2509
|
this.updateLockedDate();
|
|
2506
2510
|
if (!this.initDateValue) {
|
|
2507
2511
|
this.initDateValue = cloneDeep(this.dateObj.date);
|
|
2508
2512
|
}
|
|
2509
2513
|
}
|
|
2510
|
-
updateYear(fiscalYear, month) {
|
|
2511
|
-
const DATE_TIME = '12:00:00';
|
|
2512
|
-
const MONTH_DIFF = 1;
|
|
2513
|
-
this.dateObj.date = fiscalYear
|
|
2514
|
-
? moment.utc(`${month + MONTH_DIFF || '01'}/01/${fiscalYear} ${DATE_TIME}`, 'MM/DD/YYYY hh:mm:ss').unix()
|
|
2515
|
-
: moment.utc().unix();
|
|
2516
|
-
}
|
|
2517
2514
|
updateLockedDate() {
|
|
2518
|
-
const year = moment.unix(this.
|
|
2515
|
+
const year = moment.unix(this.forecastYear).year();
|
|
2519
2516
|
this.forecastTags = this.forecastTags.map((forecastTag) => {
|
|
2520
2517
|
forecastTag.disabled = this.lockedDate.some((timestamp) => {
|
|
2521
2518
|
const locked = moment.unix(timestamp);
|
|
@@ -2565,11 +2562,11 @@ class ForecastTagComponent extends AnyTagComponent {
|
|
|
2565
2562
|
if (this.isDateEventHappened)
|
|
2566
2563
|
return;
|
|
2567
2564
|
const month = this.forecastValue;
|
|
2568
|
-
const year = moment.unix(this.
|
|
2565
|
+
const year = moment.unix(this.forecastYear);
|
|
2569
2566
|
const fiscal_year_starts_from = this.fiscalYearStartsFrom || 1;
|
|
2570
2567
|
const fiscal_year_back = this.fiscalYearBack || false;
|
|
2571
2568
|
if (!Number.isNaN(month) && !Number.isNaN(year)) {
|
|
2572
|
-
const date = new Date(year, month, 1, 12, 0, 0, 0);
|
|
2569
|
+
const date = new Date(year.year(), month, 1, 12, 0, 0, 0);
|
|
2573
2570
|
if (fiscal_year_starts_from !== 1) {
|
|
2574
2571
|
if (!fiscal_year_back) {
|
|
2575
2572
|
date.setMonth(date.getMonth() - 13 + fiscal_year_starts_from);
|
|
@@ -2578,20 +2575,16 @@ class ForecastTagComponent extends AnyTagComponent {
|
|
|
2578
2575
|
date.setMonth(date.getMonth() - 1 + fiscal_year_starts_from);
|
|
2579
2576
|
}
|
|
2580
2577
|
}
|
|
2581
|
-
this.
|
|
2578
|
+
this.dateObj.date = moment(date).unix();
|
|
2582
2579
|
this.isDateEventHappened = true;
|
|
2583
2580
|
setTimeout(() => {
|
|
2584
2581
|
this.isDateEventHappened = false;
|
|
2585
2582
|
});
|
|
2586
2583
|
}
|
|
2587
|
-
const calculatedDate = moment
|
|
2588
|
-
.unix(this.dateObj.date)
|
|
2589
|
-
.year(this.getFiscalYearFromDate(moment.unix(this.dateObj.date), fiscal_year_starts_from, fiscal_year_back));
|
|
2590
2584
|
const resultTag = {
|
|
2591
2585
|
name: this.name,
|
|
2592
2586
|
value: this.dateObj.date,
|
|
2593
|
-
|
|
2594
|
-
label: `${find(this.forecastTags, { value: this.forecastValue })?.label} (${year})`,
|
|
2587
|
+
label: `${find(this.forecastTags, { value: this.forecastValue })?.label} (${year.year()})`,
|
|
2595
2588
|
locked: !this.dateFilter(moment.unix(this.dateObj.date)),
|
|
2596
2589
|
};
|
|
2597
2590
|
this.dateChange.emit(resultTag);
|
|
@@ -2627,7 +2620,7 @@ class ForecastTagComponent extends AnyTagComponent {
|
|
|
2627
2620
|
useClass: MomentDateAdapter,
|
|
2628
2621
|
deps: [MAT_DATE_LOCALE, MAT_MOMENT_DATE_ADAPTER_OPTIONS],
|
|
2629
2622
|
},
|
|
2630
|
-
], template: "<ng-container *ngIf=\"!tagAdditionalSettings?.showSplitInputs; else splitInputsTpl\">\n <div class=\"forecast-tag__container\">\n <div class=\"forecast-tag__forecast\">\n <p class=\"tag__label\">Forecast</p>\n <dr-select\n placeholder=\"Select\"\n [(ngModel)]=\"forecastValue\"\n bindLabel=\"label\"\n bindValue=\"value\"\n [disabled]=\"disabled\"\n [items]=\"forecastTags\"\n (ngModelChange)=\"changeTagInputHandler()\"></dr-select>\n </div>\n <div class=\"forecast-tag__year\">\n <p class=\"tag__label\">Year</p>\n <dr-date-picker\n format=\"year\"\n [(ngModel)]=\"
|
|
2623
|
+
], template: "<ng-container *ngIf=\"!tagAdditionalSettings?.showSplitInputs; else splitInputsTpl\">\n <div class=\"forecast-tag__container\">\n <div class=\"forecast-tag__forecast\">\n <p class=\"tag__label\">Forecast</p>\n <dr-select\n placeholder=\"Select\"\n [(ngModel)]=\"forecastValue\"\n bindLabel=\"label\"\n bindValue=\"value\"\n [disabled]=\"disabled\"\n [items]=\"forecastTags\"\n (ngModelChange)=\"changeTagInputHandler()\"></dr-select>\n </div>\n <div class=\"forecast-tag__year\">\n <p class=\"tag__label\">Year</p>\n <dr-date-picker\n format=\"year\"\n [(ngModel)]=\"forecastYear\"\n [datepickerFilter]=\"dateFilter.bind(this)\"\n [disabled]=\"disabled\"\n (ngModelChange)=\"changeYearInputHandler()\"></dr-date-picker>\n </div>\n </div>\n</ng-container>\n\n<ng-template #splitInputsTpl>\n <div class=\"forecast-tag__split-container\">\n <p class=\"tag__label\">Period</p>\n <div class=\"forecast-tag__split-dropdowns\">\n <dr-date-picker\n format=\"year\"\n [(ngModel)]=\"forecastYear\"\n [datepickerFilter]=\"dateFilter.bind(this)\"\n [disabled]=\"disabled\"\n class=\"no-right-border-radius no-right-border\"\n (ngModelChange)=\"changeYearInputHandler()\"></dr-date-picker>\n <dr-select\n placeholder=\"Select\"\n [(ngModel)]=\"forecastValue\"\n bindLabel=\"label\"\n bindValue=\"value\"\n [disabled]=\"disabled\"\n [items]=\"forecastTags\"\n no-left-border-radius\n (ngModelChange)=\"changeTagInputHandler()\"></dr-select>\n </div>\n </div>\n</ng-template>\n", styles: [".tag__label{margin:0 0 4px;color:#0c142b;font-size:14px;font-weight:400;line-height:22px}.forecast-tag__container{display:flex;align-items:center}.forecast-tag__split-container{display:flex;flex-direction:column}.forecast-tag__split-dropdowns{display:flex;flex-direction:row}.forecast-tag__year{width:50%;margin-left:24px}.forecast-tag__forecast{width:50%}dr-date-picker.no-right-border-radius ::ng-deep{border-bottom-right-radius:0!important;border-top-right-radius:0!important}dr-date-picker.no-right-border ::ng-deep{border-right:none!important}\n"] }]
|
|
2631
2624
|
}], function () { return []; }, { fiscalYearStartsFrom: [{
|
|
2632
2625
|
type: Input
|
|
2633
2626
|
}], fiscalYearBack: [{
|
|
@@ -2758,19 +2751,22 @@ class DateTagComponent {
|
|
|
2758
2751
|
class ForecastTagService {
|
|
2759
2752
|
static { this.MONTH_DIFF = 1; }
|
|
2760
2753
|
static { this.forecastByMonth = {
|
|
2761
|
-
0: '0+12',
|
|
2762
|
-
1: '1+11',
|
|
2763
|
-
2: '2+10',
|
|
2764
|
-
3: '3+9',
|
|
2765
|
-
4: '4+8',
|
|
2766
|
-
5: '5+7',
|
|
2767
|
-
6: '6+6',
|
|
2768
|
-
7: '7+5',
|
|
2769
|
-
8: '8+4',
|
|
2770
|
-
9: '9+3',
|
|
2771
|
-
10: '10+2',
|
|
2772
|
-
11: '11+1',
|
|
2754
|
+
'0': '0+12',
|
|
2755
|
+
'1': '1+11',
|
|
2756
|
+
'2': '2+10',
|
|
2757
|
+
'3': '3+9',
|
|
2758
|
+
'4': '4+8',
|
|
2759
|
+
'5': '5+7',
|
|
2760
|
+
'6': '6+6',
|
|
2761
|
+
'7': '7+5',
|
|
2762
|
+
'8': '8+4',
|
|
2763
|
+
'9': '9+3',
|
|
2764
|
+
'10': '10+2',
|
|
2765
|
+
'11': '11+1',
|
|
2773
2766
|
}; }
|
|
2767
|
+
static getForecastMonthTemplates() {
|
|
2768
|
+
return Array.from(Object.values(ForecastTagService.forecastByMonth));
|
|
2769
|
+
}
|
|
2774
2770
|
static getFiscalMonthFromDate(date, fiscalYearStartsFrom) {
|
|
2775
2771
|
const all_months = [];
|
|
2776
2772
|
for (let i = fiscalYearStartsFrom; i < 13; i++) {
|
|
@@ -2797,7 +2793,8 @@ class ForecastTagService {
|
|
|
2797
2793
|
return fiscal_year;
|
|
2798
2794
|
}
|
|
2799
2795
|
static getForecastLabel(month) {
|
|
2800
|
-
|
|
2796
|
+
const index = month - ForecastTagService.MONTH_DIFF;
|
|
2797
|
+
return ForecastTagService.forecastByMonth[index];
|
|
2801
2798
|
}
|
|
2802
2799
|
static getCalendarDateFromMonthAndFiscalYear(chosenMoment, monthLabel, fiscalYearStartsFrom, fiscalYearBack) {
|
|
2803
2800
|
const yearWithMonth = ForecastTagService.addMonthsWithoutYearChange(chosenMoment, monthLabel, fiscalYearStartsFrom);
|
|
@@ -3892,7 +3889,6 @@ class DrTagComponent {
|
|
|
3892
3889
|
id: this.tagConfig.id,
|
|
3893
3890
|
name: event.name,
|
|
3894
3891
|
value: event.value,
|
|
3895
|
-
calculatedValue: event.calculatedValue,
|
|
3896
3892
|
label: event.label,
|
|
3897
3893
|
locked: event.locked,
|
|
3898
3894
|
};
|