@datarailsshared/datarailsshared 1.4.183 → 1.4.185
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 +24 -29
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.4.185.tgz +0 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/lib/date-tags/forecast-tag/forecast-tag.component.js +14 -18
- package/esm2015/lib/dr-dialog/components/dialog-modal-wrapper/dialog-modal-wrapper.component.js +9 -9
- package/fesm2015/datarailsshared-datarailsshared.js +20 -25
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/date-tags/forecast-tag/forecast-tag.component.d.ts +0 -1
- package/package.json +1 -1
- package/datarailsshared-datarailsshared-1.4.183.tgz +0 -0
|
@@ -450,10 +450,13 @@
|
|
|
450
450
|
this.updateLockedDate();
|
|
451
451
|
};
|
|
452
452
|
ForecastTagComponent.prototype.updateYear = function (fiscalYear, month) {
|
|
453
|
-
|
|
453
|
+
var MONTH_DIFF = 1;
|
|
454
|
+
this.dateObj.date = fiscalYear
|
|
455
|
+
? moment$8((month + MONTH_DIFF || '01') + "/01/" + fiscalYear + " 12:00:00", 'MM/DD/YYYY hh:mm:ss').utc().unix()
|
|
456
|
+
: moment$8.utc().unix();
|
|
454
457
|
};
|
|
455
458
|
ForecastTagComponent.prototype.updateLockedDate = function () {
|
|
456
|
-
var e_1,
|
|
459
|
+
var e_1, _b;
|
|
457
460
|
var year = moment$8.unix(this.dateObj.date).year();
|
|
458
461
|
var _loop_1 = function (forecastTag) {
|
|
459
462
|
forecastTag.disabled = this_1.lockedDate.some(function (timestamp) {
|
|
@@ -463,15 +466,15 @@
|
|
|
463
466
|
};
|
|
464
467
|
var this_1 = this;
|
|
465
468
|
try {
|
|
466
|
-
for (var
|
|
467
|
-
var forecastTag =
|
|
469
|
+
for (var _c = __values(this.forecastTags), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
470
|
+
var forecastTag = _d.value;
|
|
468
471
|
_loop_1(forecastTag);
|
|
469
472
|
}
|
|
470
473
|
}
|
|
471
474
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
472
475
|
finally {
|
|
473
476
|
try {
|
|
474
|
-
if (
|
|
477
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
475
478
|
}
|
|
476
479
|
finally { if (e_1) throw e_1.error; }
|
|
477
480
|
}
|
|
@@ -505,14 +508,6 @@
|
|
|
505
508
|
}
|
|
506
509
|
return fiscal_year;
|
|
507
510
|
};
|
|
508
|
-
ForecastTagComponent.prototype.getForecastLabelFromValue = function (value, fiscal_year_starts_from, fiscal_year_back) {
|
|
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 + ")";
|
|
515
|
-
};
|
|
516
511
|
ForecastTagComponent.prototype.changeTagInputHandler = function (event) {
|
|
517
512
|
this.chosenTagHandler();
|
|
518
513
|
};
|
|
@@ -522,26 +517,26 @@
|
|
|
522
517
|
};
|
|
523
518
|
ForecastTagComponent.prototype.chosenTagHandler = function () {
|
|
524
519
|
var _this = this;
|
|
520
|
+
var _a;
|
|
525
521
|
if (this.isDateEventHappened)
|
|
526
522
|
return;
|
|
527
523
|
var month = this.forecastValue;
|
|
528
524
|
var year = moment$8.unix(this.dateObj.date).year();
|
|
529
|
-
var label = '';
|
|
530
525
|
if (!Number.isNaN(month) && !Number.isNaN(year)) {
|
|
531
|
-
var date =
|
|
526
|
+
var date = new Date(year, month, 1, 12, 0, 0, 0);
|
|
532
527
|
var fiscal_year_starts_from = this.fiscalYearStartsFrom || 1;
|
|
533
528
|
var fiscal_year_back = this.fiscalYearBack || false;
|
|
534
529
|
if (fiscal_year_starts_from !== 1) {
|
|
535
530
|
if (!fiscal_year_back) {
|
|
536
|
-
date.
|
|
531
|
+
date.setMonth(date.getMonth() - 13 + fiscal_year_starts_from);
|
|
537
532
|
}
|
|
538
533
|
else {
|
|
539
|
-
date.
|
|
534
|
+
date.setMonth(date.getMonth() - 1 + fiscal_year_starts_from);
|
|
540
535
|
}
|
|
541
536
|
}
|
|
542
|
-
|
|
543
|
-
var fiscal_year = this.getFiscalYearFromDate(
|
|
544
|
-
this.updateYear(fiscal_year,
|
|
537
|
+
var momentDate = moment$8.unix(date.getTime() / 1000);
|
|
538
|
+
var fiscal_year = this.getFiscalYearFromDate(momentDate, fiscal_year_starts_from, fiscal_year_back);
|
|
539
|
+
this.updateYear(fiscal_year, date.getMonth());
|
|
545
540
|
this.isDateEventHappened = true;
|
|
546
541
|
setTimeout(function () {
|
|
547
542
|
_this.isDateEventHappened = false;
|
|
@@ -550,7 +545,7 @@
|
|
|
550
545
|
var resultTag = {
|
|
551
546
|
name: this.name,
|
|
552
547
|
value: this.dateObj.date,
|
|
553
|
-
label: label,
|
|
548
|
+
label: (_a = _.find(this.forecastTags, { value: this.forecastValue })) === null || _a === void 0 ? void 0 : _a.label,
|
|
554
549
|
locked: !this.dateFilter(moment$8.unix(this.dateObj.date))
|
|
555
550
|
};
|
|
556
551
|
this.dateChange.emit(resultTag);
|
|
@@ -3969,13 +3964,13 @@
|
|
|
3969
3964
|
this.class = (_b = (_a = this === null || this === void 0 ? void 0 : this.dialogData) === null || _a === void 0 ? void 0 : _a.theme) === null || _b === void 0 ? void 0 : _b.themeSize;
|
|
3970
3965
|
}
|
|
3971
3966
|
DialogModalWrapperComponent.prototype.ngOnInit = function () {
|
|
3972
|
-
if (this.dialogData.fields)
|
|
3973
|
-
this.
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
}
|
|
3967
|
+
if (!this.dialogData.fields)
|
|
3968
|
+
this.dialogData.fields = [];
|
|
3969
|
+
this.form = new forms.FormGroup(this.dialogData.fields.reduce(function (accumulator, currentValue) {
|
|
3970
|
+
var currentFormControl = {};
|
|
3971
|
+
currentFormControl[currentValue.name] = new forms.FormControl(currentValue.default || null, currentValue.validators || []);
|
|
3972
|
+
return Object.assign(accumulator, currentFormControl);
|
|
3973
|
+
}, {}));
|
|
3979
3974
|
};
|
|
3980
3975
|
DialogModalWrapperComponent.prototype.onAccept = function () {
|
|
3981
3976
|
var _this = this;
|
|
@@ -4008,7 +4003,7 @@
|
|
|
4008
4003
|
{ type: i0.Component, args: [{
|
|
4009
4004
|
selector: 'dr-dialog-modal-wrapper',
|
|
4010
4005
|
template: "<div header class=\"header-dialog\">\n <h1 class=\"title-dialog\" data-test=\"modalTitle\">{{ dialogData.title }}</h1>\n <i mat-icon-button *ngIf=\"!dialogData.hideCloseBtn\" (click)=\"closeDialog()\" class=\"dr-icon-exit icon-close\"\n data-test=\"xBtn\"></i>\n</div>\n<div *ngIf=\"dialogData.content\" class=\"content-dialog\">\n <ng-container>{{ dialogData.content }}</ng-container>\n <span #content class=\"content-anchor\"></span>\n</div>\n<form *ngIf=\"dialogData.fields\" [formGroup]=\"form\" class=\"dr-smart-from\">\n <div class=\"dr-smart-form_wrapper\">\n <div *ngFor=\"let field of dialogData.fields\" class=\"dr-smart-form_group\"\n [ngStyle]=\"{ display: field.isLabelFullWidth ? 'block' : 'flex' }\">\n <label *ngIf=\"field.label && field.type !== dialogFieldType.CHECKBOX\"\n [ngClass]=\"field.isLabelFullWidth ? 'col-md-12 mb-2' : 'col-md-2'\"\n class=\"label p-0 d-flex align-items-center\">{{ field.label }}</label>\n <div class=\"input-group p-0\"\n [ngClass]=\"{ 'col-md-10': field.label && !field.isLabelFullWidth, 'col-md-12': !field.label || field.isLabelFullWidth }\">\n <dr-select *ngIf=\"field.type === dialogFieldType.SELECT\"\n [searchable]=\"dialogData.searchable\"\n [clearable]=\"dialogData.clearable\"\n [formControlName]=\"field.name\"\n [bindLabel]=\"field.bindLabel || null\"\n [bindValue]=\"field.bindValue || null\"\n [selectedItem]=\"field.default\"\n [items]=\"field.items || (field.items$ | async)\"\n [required]=\"true\"\n [placeholder]=\"field.placeholder\">\n <ng-template *ngIf=\"dialogData?.footerTemplateData\" #optionFooterTemplate let-item=\"item\" let-close=\"close\">\n <button (click)=\"footerAction(); close();\" class=\"dr-select-footer__btn\">\n <i *ngIf=\"dialogData.footerTemplateData.icon\"\n class=\"{{ dialogData.footerTemplateData.icon }}\"></i>\n {{ dialogData.footerTemplateData.label }}</button>\n </ng-template>\n </dr-select>\n <dr-input *ngIf=\"field.type === dialogFieldType.INPUT\" data-test=\"modalInput\" class=\"form-control\"\n [formControlName]=\"field.name\" [placeholder]=\"field.placeholder\"></dr-input>\n <dr-date-picker *ngIf=\"field.type === dialogFieldType.DATE_PICKER\"\n [formControlName]=\"field.name\"\n [format]=\"field.datePickerFormat\"\n [placeholder]=\"field.placeholder\"></dr-date-picker>\n <dr-checkbox *ngIf=\"field.type === dialogFieldType.CHECKBOX\" [formControlName]=\"field.name\">\n {{ field.label }}\n </dr-checkbox>\n <label class=\"form-field-error-alert\" *ngIf=\"form.invalid && form.controls[field.name]?.dirty && form.controls[field.name]?.errors\">\n {{ form.controls[field.name].errors.errorString }}\n </label>\n <label class=\"form-error-alert\" *ngIf=\"dialogData.errorMessage && !form.pristine && form.invalid\">\n {{ dialogData.errorMessage }}\n </label>\n <label class=\"form-error-alert\"\n *ngIf=\"form.valid && showServerErrorMessage && dialogData.serverErrorMessage\">\n {{ dialogData.serverErrorMessage }}\n </label>\n </div>\n </div>\n </div>\n</form>\n\n<div footer class=\"footer-dialog\">\n <div class=\"buttons-wrapper\" *ngIf=\"dialogData.cancelButton || dialogData.acceptButton\">\n <dr-button *ngIf=\"dialogData.cancelButton\" data-test=\"modalCloseBtn\" (click)=\"closeDialog()\"\n [theme]=\"'secondary'\">{{ dialogData.cancelButton.label }}</dr-button>\n <dr-button *ngIf=\"dialogData.acceptButton\" data-test=\"modalAddBtn\" (click)=\"onAccept()\" [theme]=\"'primary'\"\n [isLoading]=\"isLoading\" [disabled]=\"form.invalid\">{{ dialogData.acceptButton.label }}</dr-button>\n </div>\n</div>\n",
|
|
4011
|
-
styles: [":host{display:flex;justify-content:space-between;flex-direction:column}:host.small-modal{min-height:188px;max-height:467px;min-width:400px;max-width:400px}:host.medium-modal,.medium-modal-max-height:host{min-height:188px;max-height:467px;min-width:632px;max-width:632px}:host.medium-small-modal{min-height:188px;max-height:345px;min-width:460px;max-width:460px}:host.medium-modal-max-height{max-height:80vh}.header-dialog{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:8px 39px 8px 32px;border-bottom:1px solid #e5e6ea}.title-dialog{color:#151b3f;position:static;font-weight:bold;font-size:18px;line-height:24px}.content-dialog{font-weight:400;font-size:14px;padding:16px 32px 5px}.icon-close{color:#51566f;cursor:pointer}.dr-smart-from{font-size:14px;font-weight:500;line-height:22px;padding:16px 32px 22px}.dr-smart-from dr-checkbox{font-weight:400}.content-dialog{padding:16px 32px 0;font-weight:400;font-size:14px;line-height:22px}.content-anchor{display:none}.footer-dialog{border-top:1px solid #e5e6ea}.buttons-wrapper{display:flex;justify-content:flex-end;padding-top:10px;padding-right:32px;padding-bottom:11px}.buttons-wrapper dr-button:nth-of-type(2){margin-left:12px}.form-field-error-alert{font-size:12px;color:#bf1d30;line-height:20px}.form-error-alert{position:absolute;margin-top:5px;font-size:12px;color:red}.dr-select-footer__btn{background-color:transparent;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}\n"]
|
|
4006
|
+
styles: [":host{display:flex;justify-content:space-between;flex-direction:column}:host.small-modal{min-height:188px;max-height:467px;min-width:400px;max-width:400px}:host.medium-modal,.medium-modal-max-height:host{min-height:188px;max-height:467px;min-width:632px;max-width:632px}:host.medium-small-modal{min-height:188px;max-height:345px;min-width:460px;max-width:460px}:host.medium-modal-max-height{max-height:80vh}.header-dialog{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:8px 39px 8px 32px;border-bottom:1px solid #e5e6ea}.title-dialog{color:#151b3f;position:static;font-weight:bold;font-size:18px;line-height:24px}.content-dialog{font-weight:400;font-size:14px;padding:16px 32px 5px;white-space:pre-line}.icon-close{color:#51566f;cursor:pointer}.dr-smart-from{font-size:14px;font-weight:500;line-height:22px;padding:16px 32px 22px}.dr-smart-from dr-checkbox{font-weight:400}.content-dialog{padding:16px 32px 0;font-weight:400;font-size:14px;line-height:22px}.content-anchor{display:none}.footer-dialog{border-top:1px solid #e5e6ea}.buttons-wrapper{display:flex;justify-content:flex-end;padding-top:10px;padding-right:32px;padding-bottom:11px}.buttons-wrapper dr-button:nth-of-type(2){margin-left:12px}.form-field-error-alert{font-size:12px;color:#bf1d30;line-height:20px}.form-error-alert{position:absolute;margin-top:5px;font-size:12px;color:red}.dr-select-footer__btn{background-color:transparent;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}\n"]
|
|
4012
4007
|
},] }
|
|
4013
4008
|
];
|
|
4014
4009
|
DialogModalWrapperComponent.ctorParameters = function () { return [
|