@datarailsshared/datarailsshared 1.4.292 → 1.4.296

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.
@@ -425,22 +425,26 @@
425
425
  _this.forecastValue = undefined;
426
426
  _this.isDateEventHappened = false;
427
427
  _this.forecastTags = [
428
- { value: 0, label: '0+12' },
429
- { value: 1, label: '1+11' },
430
- { value: 2, label: '2+10' },
431
- { value: 3, label: '3+9' },
432
- { value: 4, label: '4+8' },
433
- { value: 5, label: '5+7' },
434
- { value: 6, label: '6+6' },
435
- { value: 7, label: '7+5' },
436
- { value: 8, label: '8+4' },
437
- { value: 9, label: '9+3' },
438
- { value: 10, label: '10+2' },
439
- { value: 11, label: '11+1' }
428
+ { value: 0, label: '0+12', disabled: false },
429
+ { value: 1, label: '1+11', disabled: false },
430
+ { value: 2, label: '2+10', disabled: false },
431
+ { value: 3, label: '3+9', disabled: false },
432
+ { value: 4, label: '4+8', disabled: false },
433
+ { value: 5, label: '5+7', disabled: false },
434
+ { value: 6, label: '6+6', disabled: false },
435
+ { value: 7, label: '7+5', disabled: false },
436
+ { value: 8, label: '8+4', disabled: false },
437
+ { value: 9, label: '9+3', disabled: false },
438
+ { value: 10, label: '10+2', disabled: false },
439
+ { value: 11, label: '11+1', disabled: false }
440
440
  ];
441
441
  _this.initDateValue = null;
442
442
  return _this;
443
443
  }
444
+ ForecastTagComponent.prototype.ngOnChanges = function () {
445
+ this.updateLockedDate();
446
+ this.chosenTagHandler();
447
+ };
444
448
  ForecastTagComponent.prototype.initDate = function () {
445
449
  var dateVal = this.defaultValue ? moment$8.unix(this.defaultValue) : moment$8();
446
450
  var fiscal_year_starts_from = this.fiscalYearStartsFrom || 1;
@@ -461,28 +465,15 @@
461
465
  : moment$8.utc().unix();
462
466
  };
463
467
  ForecastTagComponent.prototype.updateLockedDate = function () {
464
- var e_1, _b;
468
+ var _this = this;
465
469
  var year = moment$8.unix(this.dateObj.date).year();
466
- var _loop_1 = function (forecastTag) {
467
- forecastTag.disabled = this_1.lockedDate.some(function (timestamp) {
470
+ this.forecastTags = this.forecastTags.map(function (forecastTag) {
471
+ forecastTag.disabled = _this.lockedDate.some(function (timestamp) {
468
472
  var locked = moment$8.unix(timestamp);
469
473
  return locked.month() === forecastTag.value && +locked.year() === +year;
470
474
  });
471
- };
472
- var this_1 = this;
473
- try {
474
- for (var _c = __values(this.forecastTags), _d = _c.next(); !_d.done; _d = _c.next()) {
475
- var forecastTag = _d.value;
476
- _loop_1(forecastTag);
477
- }
478
- }
479
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
480
- finally {
481
- try {
482
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
483
- }
484
- finally { if (e_1) throw e_1.error; }
485
- }
475
+ return forecastTag;
476
+ });
486
477
  };
487
478
  ForecastTagComponent.prototype.initName = function () {
488
479
  if (!this.name) {
@@ -692,14 +683,24 @@
692
683
  enumerable: false,
693
684
  configurable: true
694
685
  });
686
+ QuarterTagComponent.prototype.ngOnChanges = function () {
687
+ this.initTags();
688
+ };
695
689
  QuarterTagComponent.prototype.ngOnInit = function () {
696
- var e_1, _a;
697
690
  this.initName();
691
+ this.initTags();
692
+ };
693
+ QuarterTagComponent.prototype.initName = function () {
694
+ if (!this.name) {
695
+ this.name = 'Quarter';
696
+ }
697
+ };
698
+ QuarterTagComponent.prototype.initTags = function () {
699
+ var e_1, _a;
698
700
  this.quarters = this.getQuarterOptions();
699
701
  try {
700
702
  for (var _b = __values(this.quarters), _c = _b.next(); !_c.done; _c = _b.next()) {
701
703
  var quarter = _c.value;
702
- quarter.disabled = false;
703
704
  if (quarter.isSelected) {
704
705
  this.selectedValue = quarter;
705
706
  this.chosenTagHandler(quarter);
@@ -715,11 +716,6 @@
715
716
  finally { if (e_1) throw e_1.error; }
716
717
  }
717
718
  };
718
- QuarterTagComponent.prototype.initName = function () {
719
- if (!this.name) {
720
- this.name = 'Quarter';
721
- }
722
- };
723
719
  QuarterTagComponent.prototype.chosenTagHandler = function (quarter) {
724
720
  var resultDate = moment$6.unix(quarter.value);
725
721
  var resultTag = {
@@ -754,6 +750,7 @@
754
750
  value: tempValue / 1000,
755
751
  label: this.getQuarterLabel(tempValue),
756
752
  isSelected: (i === 0),
753
+ disabled: false,
757
754
  });
758
755
  }
759
756
  return to_return;
@@ -770,7 +767,7 @@
770
767
  var quarterDate = moment$6.unix(quarter.value);
771
768
  return !this.lockedDate.some(function (timestamp) {
772
769
  var lockDate = moment$6.unix(timestamp);
773
- if (lockDate.year() === quarterDate.year() && lockDate.month() === quarterDate.month()) {
770
+ if (lockDate.year() === quarterDate.year() && lockDate.quarter() === quarterDate.quarter()) {
774
771
  quarter.disabled = true;
775
772
  return true;
776
773
  }