@datarailsshared/datarailsshared 1.4.152 → 1.4.153-rocket

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.
Files changed (41) hide show
  1. package/bundles/datarailsshared-datarailsshared.umd.js +516 -40
  2. package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
  3. package/datarailsshared-datarailsshared-1.4.153-rocket.tgz +0 -0
  4. package/datarailsshared-datarailsshared.d.ts +2 -0
  5. package/datarailsshared-datarailsshared.metadata.json +1 -1
  6. package/esm2015/datarailsshared-datarailsshared.js +3 -1
  7. package/esm2015/lib/date-tags/day-tag/day-tag.component.js +3 -8
  8. package/esm2015/lib/date-tags/month-tag/month-tag.component.js +3 -8
  9. package/esm2015/lib/date-tags/year-tag/year-tag.component.js +3 -8
  10. package/esm2015/lib/dr-inputs/date-pickers/dr-date-picker/dr-date-picker.component.js +17 -9
  11. package/esm2015/lib/dr-inputs/date-pickers/dr-date-picker-with-timeframe/dr-date-picker-with-timeframe.component.js +3 -3
  12. package/esm2015/lib/dr-inputs/date-pickers/services/dr-date-picker.service.js +5 -2
  13. package/esm2015/lib/dr-inputs/dr-inputs.module.js +3 -2
  14. package/esm2015/lib/dr-inputs/dr-toggle-button/dr-toggle-button.component.js +8 -3
  15. package/esm2015/lib/dr-inputs/dr-toggle-button/toggle-button-theme.js +6 -0
  16. package/esm2015/lib/dr-scenario/components/dr-scenario-configuration/dr-scenario-configuration.component.js +87 -0
  17. package/esm2015/lib/dr-scenario/components/dr-scenario-tag-configuration/dr-scenario-tag-configuration.component.js +74 -0
  18. package/esm2015/lib/dr-scenario/consts/scenario-tags-config.js +73 -0
  19. package/esm2015/lib/dr-scenario/dr-scenario.module.js +28 -0
  20. package/esm2015/lib/dr-scenario/interfaces/scenario.js +8 -0
  21. package/esm2015/lib/dr-scenario/services/scenario.service.js +160 -0
  22. package/esm2015/lib/dr-tags/dr-tag.component.js +17 -5
  23. package/esm2015/lib/models/serverTags.js +13 -1
  24. package/esm2015/public-api.js +6 -1
  25. package/fesm2015/datarailsshared-datarailsshared.js +478 -41
  26. package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
  27. package/lib/dr-inputs/date-pickers/dr-date-picker/dr-date-picker.component.d.ts +12 -12
  28. package/lib/dr-inputs/date-pickers/services/dr-date-picker.service.d.ts +11 -12
  29. package/lib/dr-inputs/dr-toggle-button/dr-toggle-button.component.d.ts +3 -0
  30. package/lib/dr-inputs/dr-toggle-button/toggle-button-theme.d.ts +4 -0
  31. package/lib/dr-scenario/components/dr-scenario-configuration/dr-scenario-configuration.component.d.ts +25 -0
  32. package/lib/dr-scenario/components/dr-scenario-tag-configuration/dr-scenario-tag-configuration.component.d.ts +26 -0
  33. package/lib/dr-scenario/consts/scenario-tags-config.d.ts +24 -0
  34. package/lib/dr-scenario/dr-scenario.module.d.ts +2 -0
  35. package/lib/dr-scenario/interfaces/scenario.d.ts +43 -0
  36. package/lib/dr-scenario/services/scenario.service.d.ts +21 -0
  37. package/lib/dr-tags/dr-tag.component.d.ts +7 -3
  38. package/lib/models/serverTags.d.ts +15 -1
  39. package/package.json +1 -1
  40. package/public-api.d.ts +5 -1
  41. package/datarailsshared-datarailsshared-1.4.152.tgz +0 -0
@@ -3,7 +3,7 @@ import { EventEmitter, Component, ViewEncapsulation, Input, Output, HostBinding,
3
3
  import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
4
4
  import { MomentDateAdapter, MAT_MOMENT_DATE_ADAPTER_OPTIONS } from '@angular/material-moment-adapter';
5
5
  import * as _ from 'lodash';
6
- import { some, find, map, merge, forEach, reduce, isObject, isNil, isNumber } from 'lodash';
6
+ import { find, map, merge, forEach, some, orderBy, filter as filter$1, reduce, cloneDeep, isObject, isNil, isNumber, includes } from 'lodash';
7
7
  import { NG_VALUE_ACCESSOR, FormGroupDirective, FormGroup, FormControl, NgModel, NgControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
8
8
  import { isPlatformBrowser, DOCUMENT, CommonModule } from '@angular/common';
9
9
  import { Subject, from, merge as merge$1, fromEvent, noop as noop$1, BehaviorSubject } from 'rxjs';
@@ -265,13 +265,8 @@ class MonthTagComponent extends AnyTagComponent {
265
265
  return this.date ? !this.dateFilter(moment$7.unix(this.date).utc()) : false;
266
266
  }
267
267
  initDate() {
268
- if (this.defaultValue) {
269
- this.date = this.defaultValue;
270
- this.dateObj.date = this.date;
271
- }
272
- else {
273
- this.dateObj.date = moment$7().unix();
274
- }
268
+ this.date = this.defaultValue || moment$7().unix();
269
+ this.dateObj.date = this.date;
275
270
  }
276
271
  initName() {
277
272
  if (!this.name) {
@@ -527,13 +522,8 @@ class YearTagComponent extends AnyTagComponent {
527
522
  return this.date ? !this.dateFilter(moment$4.unix(this.date).utc()) : false;
528
523
  }
529
524
  initDate() {
530
- if (this.defaultValue) {
531
- this.date = this.defaultValue;
532
- this.dateObj.date = this.date;
533
- }
534
- else {
535
- this.dateObj.date = moment$4().unix();
536
- }
525
+ this.date = this.defaultValue || moment$4().unix();
526
+ this.dateObj.date = this.date;
537
527
  }
538
528
  initName() {
539
529
  if (!this.name) {
@@ -589,29 +579,48 @@ var TagTypes;
589
579
  TagTypes["LIST"] = "LIST";
590
580
  TagTypes["DATE"] = "DATE";
591
581
  })(TagTypes || (TagTypes = {}));
582
+ var TagsConfigSubType;
583
+ (function (TagsConfigSubType) {
584
+ TagsConfigSubType["YEAR"] = "year";
585
+ TagsConfigSubType["PLAN"] = "plan";
586
+ TagsConfigSubType["BUDGET_CYCLE"] = "budget cycle";
587
+ TagsConfigSubType["MONTH"] = "month";
588
+ TagsConfigSubType["WEEK"] = "week";
589
+ TagsConfigSubType["DAY"] = "day";
590
+ TagsConfigSubType["FORECAST_NEW"] = "forecast_new";
591
+ TagsConfigSubType["QUARTER"] = "quarter";
592
+ TagsConfigSubType["FILE_STATUS"] = "file_status";
593
+ })(TagsConfigSubType || (TagsConfigSubType = {}));
592
594
 
593
595
  class DrTagComponent {
594
596
  constructor() {
595
597
  this.lockedDate = [];
596
598
  this.dynamicTagValues = {};
597
- this.connectedTags = [];
598
599
  this.tagChange = new EventEmitter(); // Not emit value for dynamic tag
599
600
  this.dynamicTagChange = new EventEmitter();
600
601
  this.dynamicTagAdd = new EventEmitter();
601
602
  this.currentTagConnectedToDynamic = false;
602
603
  this.tagTypes = TagTypes;
603
604
  this.connectedTagsValues = [];
605
+ this._connectedTags = [];
604
606
  this.selectedTag = {
605
607
  id: 0,
606
608
  value: undefined,
607
609
  name: ''
608
610
  };
609
611
  }
612
+ set connectedTags(tags) {
613
+ this._connectedTags = tags || [];
614
+ }
615
+ get connectedTags() {
616
+ return this._connectedTags;
617
+ }
618
+ ngOnChanges() {
619
+ this.calculateDynamicTag();
620
+ }
610
621
  ngOnInit() {
611
622
  var _a, _b;
612
- this.currentTagDynamic = this.tagConfig.options.is_custom;
613
- this.currentTagConnectedToDynamic = some(this.tagsConfig, (tagConfig) => tagConfig.options.is_custom
614
- && ['year'].includes(this.tagConfig.options.sub_type));
623
+ this.calculateDynamicTag();
615
624
  this.dateTag = {
616
625
  type: this.tagConfig.type,
617
626
  sub_type: this.tagConfig.options.sub_type,
@@ -725,6 +734,11 @@ class DrTagComponent {
725
734
  }
726
735
  });
727
736
  }
737
+ calculateDynamicTag() {
738
+ this.currentTagDynamic = this.tagConfig.options.is_custom;
739
+ this.currentTagConnectedToDynamic = some(this.tagsConfig, (tagConfig) => tagConfig.options.is_custom
740
+ && ['year'].includes(this.tagConfig.options.sub_type));
741
+ }
728
742
  }
729
743
  DrTagComponent.decorators = [
730
744
  { type: Component, args: [{
@@ -810,13 +824,8 @@ class DayTagComponent extends AnyTagComponent {
810
824
  return this.date ? !this.dateFilter(moment$3.unix(this.date).utc()) : false;
811
825
  }
812
826
  initDate() {
813
- if (this.defaultValue) {
814
- this.date = this.defaultValue;
815
- this.dateObj.date = this.date;
816
- }
817
- else {
818
- this.dateObj.date = moment$3().unix();
819
- }
827
+ this.date = this.defaultValue || moment$3().unix();
828
+ this.dateObj.date = this.date;
820
829
  }
821
830
  initName() {
822
831
  if (!this.name) {
@@ -1931,12 +1940,20 @@ DrToggleComponent.propDecorators = {
1931
1940
  elementClass: [{ type: HostBinding, args: ['class',] }]
1932
1941
  };
1933
1942
 
1943
+ var ToggleButtonTheme;
1944
+ (function (ToggleButtonTheme) {
1945
+ ToggleButtonTheme["DEFAULT"] = "default";
1946
+ ToggleButtonTheme["DOTTED"] = "dotted";
1947
+ })(ToggleButtonTheme || (ToggleButtonTheme = {}));
1948
+
1934
1949
  class DrToggleButtonComponent {
1935
1950
  constructor(cdr) {
1936
1951
  this.cdr = cdr;
1937
1952
  this._disabled = false;
1938
1953
  this.bindLabel = null;
1939
1954
  this.bindValue = null;
1955
+ this.bindHidden = null;
1956
+ this.theme = ToggleButtonTheme.DEFAULT;
1940
1957
  this.onChange = () => {
1941
1958
  };
1942
1959
  this.onTouched = () => {
@@ -1968,12 +1985,12 @@ class DrToggleButtonComponent {
1968
1985
  DrToggleButtonComponent.decorators = [
1969
1986
  { type: Component, args: [{
1970
1987
  selector: 'dr-toggle-button',
1971
- template: "<div class=\"toggle-container\" [class.disabled]=\"_disabled\">\n <div\n *ngFor=\"let item of items\"\n (click)=\"setValue(item)\"\n [class.selected]=\"item[bindValue] === selectedValue || item === selectedValue\"\n [class.disabled]=\"item.disabled\"\n class=\"toggle-container__item\"\n >\n {{ item[bindLabel] || item.name || item }}\n </div>\n</div>\n",
1988
+ template: "<div class=\"toggle-container\"\n [class.disabled]=\"_disabled\"\n [attr.theme]=\"theme\">\n <ng-container *ngFor=\"let item of items\">\n <div *ngIf=\"!item?.[bindHidden]\"\n [class.selected]=\"item[bindValue] === selectedValue || item === selectedValue\"\n [class.disabled]=\"item.disabled\"\n class=\"toggle-container__item\">{{ item[bindLabel] || item.name || item }}</div>\n </ng-container>\n</div>\n",
1972
1989
  providers: [
1973
1990
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => DrToggleButtonComponent), multi: true }
1974
1991
  ],
1975
1992
  changeDetection: ChangeDetectionStrategy.OnPush,
1976
- styles: [".toggle-container{display:flex;flex-wrap:nowrap;background:#f6f7f8;border:1px solid #c3c4ce;box-sizing:border-box;border-radius:20px;height:28px}.toggle-container.disabled{pointer-events:none}.toggle-container__item{height:28px;display:flex;align-items:center;justify-content:center;padding:4px 16px;border-radius:20px;margin:-1px;cursor:pointer;font-weight:400;font-size:12px;line-height:20px;white-space:nowrap;color:#4e566c}.toggle-container__item.selected{font-weight:400;background:#f2f2fb;border:1px solid #7f7fdd;color:#25258c}.toggle-container__item.disabled{pointer-events:none;cursor:default;background:#f0f1f4;color:#9ea1aa;border:1px solid #c3c4ce}\n"]
1993
+ styles: [".toggle-container{display:flex;flex-wrap:nowrap;box-sizing:border-box;border-radius:20px;height:28px}.toggle-container.disabled{pointer-events:none}.toggle-container__item{height:28px;display:flex;align-items:center;justify-content:center;padding:4px 16px;border-radius:20px;margin:-1px;cursor:pointer;font-weight:400;font-size:12px;line-height:20px;white-space:nowrap;color:#4e566c}.toggle-container__item.selected{background:#f2f2fb!important;border:1px solid #7f7fdd!important;color:#25258c!important}.toggle-container__item.disabled{pointer-events:none;cursor:default;background:#f0f1f4;color:#9ea1aa;border:1px solid #c3c4ce}.toggle-container[theme~=default]{background:#f6f7f8;border:1px solid #c3c4ce}.toggle-container[theme~=dotted] .toggle-container__item{border:1px solid #9ea1aa;border-radius:18px;margin-left:5px;color:#0c142b}.toggle-container[theme~=dotted] .toggle-container__item:hover{background:#f0f1f4}.toggle-container[theme~=dotted] .toggle-container__item:hover .toggle-container[theme~=dotted] .toggle-container__item.selected{background:unset}.toggle-container[theme~=dotted] .toggle-container__item:first-child{margin-left:0}\n"]
1977
1994
  },] }
1978
1995
  ];
1979
1996
  DrToggleButtonComponent.ctorParameters = () => [
@@ -1983,6 +2000,8 @@ DrToggleButtonComponent.propDecorators = {
1983
2000
  items: [{ type: Input }],
1984
2001
  bindLabel: [{ type: Input }],
1985
2002
  bindValue: [{ type: Input }],
2003
+ bindHidden: [{ type: Input }],
2004
+ theme: [{ type: Input }],
1986
2005
  selectedValue: [{ type: Input }],
1987
2006
  disabled: [{ type: Input }]
1988
2007
  };
@@ -3515,6 +3534,14 @@ var TooltipPosition;
3515
3534
  TooltipPosition["LEFT_BOTTOM"] = "left-bottom";
3516
3535
  })(TooltipPosition || (TooltipPosition = {}));
3517
3536
 
3537
+ var Scenario;
3538
+ (function (Scenario) {
3539
+ Scenario["ACTUALS"] = "Actuals";
3540
+ Scenario["FORECAST"] = "Forecast";
3541
+ Scenario["BUDGET"] = "Budget";
3542
+ Scenario["NONE"] = "None";
3543
+ })(Scenario || (Scenario = {}));
3544
+
3518
3545
  class DrModelDebounceChangeDirective {
3519
3546
  constructor(ngModel) {
3520
3547
  this.ngModel = ngModel;
@@ -3577,6 +3604,232 @@ class ChatMessage {
3577
3604
  }
3578
3605
  }
3579
3606
 
3607
+ const allDateTags = {
3608
+ [TagsConfigSubType.YEAR]: {
3609
+ name: 'Date',
3610
+ toggle: false,
3611
+ },
3612
+ [TagsConfigSubType.QUARTER]: {
3613
+ name: 'Date',
3614
+ toggle: false,
3615
+ },
3616
+ [TagsConfigSubType.MONTH]: {
3617
+ name: 'Date',
3618
+ toggle: false,
3619
+ },
3620
+ [TagsConfigSubType.DAY]: {
3621
+ name: 'Date',
3622
+ toggle: false,
3623
+ },
3624
+ [TagsConfigSubType.WEEK]: {
3625
+ name: 'Date',
3626
+ toggle: false,
3627
+ }
3628
+ };
3629
+ function getScenarioTagDataConfig(isMultipleDimension) {
3630
+ return {
3631
+ [Scenario.ACTUALS]: Object.assign(Object.assign({}, allDateTags), { [TagsConfigSubType.MONTH]: {
3632
+ name: 'Date',
3633
+ toggle: true,
3634
+ }, [TagsConfigSubType.FILE_STATUS]: {
3635
+ toggle: false,
3636
+ } }),
3637
+ [Scenario.BUDGET]: {
3638
+ [TagsConfigSubType.BUDGET_CYCLE]: {
3639
+ toggle: true,
3640
+ acceptableDateTags: [TagsConfigSubType.YEAR],
3641
+ hidden: !isMultipleDimension,
3642
+ },
3643
+ [TagsConfigSubType.PLAN]: {
3644
+ toggle: false,
3645
+ turnOffDateTags: true,
3646
+ hidden: isMultipleDimension,
3647
+ },
3648
+ [TagsConfigSubType.YEAR]: {
3649
+ name: 'Date',
3650
+ toggle: true,
3651
+ },
3652
+ [TagsConfigSubType.QUARTER]: {
3653
+ name: 'Date',
3654
+ toggle: false,
3655
+ },
3656
+ [TagsConfigSubType.FILE_STATUS]: {
3657
+ toggle: false,
3658
+ },
3659
+ },
3660
+ [Scenario.FORECAST]: {
3661
+ [TagsConfigSubType.FORECAST_NEW]: {
3662
+ toggle: true,
3663
+ name: 'Date',
3664
+ },
3665
+ [TagsConfigSubType.FILE_STATUS]: {
3666
+ toggle: false,
3667
+ },
3668
+ },
3669
+ [Scenario.NONE]: Object.assign(Object.assign({}, allDateTags), { [TagsConfigSubType.MONTH]: {
3670
+ name: 'Date',
3671
+ toggle: true,
3672
+ }, [TagsConfigSubType.FILE_STATUS]: {
3673
+ toggle: true,
3674
+ } }),
3675
+ };
3676
+ }
3677
+
3678
+ class ScenarioService {
3679
+ constructor() {
3680
+ this.DEFAULT_FORECAST_DATE_TAG = 'Month';
3681
+ }
3682
+ get scenarios() {
3683
+ return orderBy(Object.values(Scenario), (scenario) => scenario === Scenario.NONE ? 1 : 0);
3684
+ }
3685
+ get areExistingTagsConfig() {
3686
+ return !!this.currentTagsConfig;
3687
+ }
3688
+ initScenarioTags(scenario, wholeTagsConfig, currentTagsConfig, isMultipleDimension = true) {
3689
+ if (!(wholeTagsConfig === null || wholeTagsConfig === void 0 ? void 0 : wholeTagsConfig.length) || !scenario)
3690
+ return;
3691
+ this.wholeTagsConfig = wholeTagsConfig;
3692
+ this.currentTagsConfig = currentTagsConfig;
3693
+ this.isMultipleDimension = isMultipleDimension;
3694
+ }
3695
+ getTagsConfigByScenarioTags(scenarioTags, tagsConfig) {
3696
+ const scenarioTagsConfig = filter$1(tagsConfig, (tagConfig) => some(scenarioTags, (scenarioTag) => scenarioTag.toggle && scenarioTag.selectedTagSubType === tagConfig.options.sub_type));
3697
+ return this.sortScenarioTags(scenarioTagsConfig);
3698
+ }
3699
+ getScenarioTagsByScenario(scenario) {
3700
+ const scenarioTagsConfig = this.getScenarioTagsConfig(scenario, this.wholeTagsConfig);
3701
+ const scenarioTagsUi = [];
3702
+ forEach(scenarioTagsConfig, (scenarioTag) => {
3703
+ const isDateTag = scenarioTag.type === TagTypes.DATE;
3704
+ const dateTag = isDateTag && find(scenarioTagsUi, { type: TagTypes.DATE });
3705
+ const tag = dateTag || this.prepareScenarioTag(scenarioTagsConfig, scenarioTag, scenario, isDateTag);
3706
+ if (isDateTag) {
3707
+ this.updateScenarioDateTag(tag, scenarioTag);
3708
+ }
3709
+ if (dateTag)
3710
+ return;
3711
+ scenarioTagsUi.push(tag);
3712
+ });
3713
+ if (this.areExistingTagsConfig) {
3714
+ this.initExistingTagsConfig(scenario, scenarioTagsUi);
3715
+ }
3716
+ const isTagNotSupportingDates = some(scenarioTagsUi, { turnOffDateTags: true, toggle: true });
3717
+ if (isTagNotSupportingDates) {
3718
+ this.turnOffDateTag(scenarioTagsUi);
3719
+ }
3720
+ const tagWithSpecificDateTags = find(scenarioTagsUi, (tag) => { var _a; return tag.toggle && !!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length); });
3721
+ if (tagWithSpecificDateTags) {
3722
+ this.hideNotAvailableTags(tagWithSpecificDateTags, scenarioTagsUi);
3723
+ }
3724
+ return this.sortScenarioTags(scenarioTagsUi);
3725
+ }
3726
+ sortScenarioTags(scenarioTagsUi) {
3727
+ return orderBy(scenarioTagsUi, [
3728
+ (tag) => (tag.type === TagTypes.DATE ? 0 : 1),
3729
+ (tag) => (tag.name === 'File Status')
3730
+ ]);
3731
+ }
3732
+ initExistingTagsConfig(scenario, scenarioTagsUi) {
3733
+ forEach(this.currentTagsConfig, (tagConfig) => {
3734
+ var _a, _b;
3735
+ const tagSubType = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.options) === null || _a === void 0 ? void 0 : _a.sub_type;
3736
+ const scenarioTagDataConfig = getScenarioTagDataConfig(this.isMultipleDimension);
3737
+ if (!((_b = scenarioTagDataConfig === null || scenarioTagDataConfig === void 0 ? void 0 : scenarioTagDataConfig[scenario]) === null || _b === void 0 ? void 0 : _b[tagSubType]))
3738
+ return;
3739
+ const scenarioTagUi = tagConfig.type === TagTypes.DATE
3740
+ ? find(scenarioTagsUi, { type: tagConfig.type })
3741
+ : find(scenarioTagsUi, { selectedTagSubType: tagSubType });
3742
+ scenarioTagUi.toggle = true;
3743
+ scenarioTagUi.selectedTagSubType = tagSubType;
3744
+ });
3745
+ }
3746
+ prepareScenarioTag(scenarioTagsConfig, scenarioTag, scenario, isDateTag) {
3747
+ const toggleStatus = isDateTag
3748
+ ? some(scenarioTagsConfig, (tag) => tag.type === TagTypes.DATE && tag.scenarioData.toggle)
3749
+ : scenarioTag.scenarioData.toggle;
3750
+ const selectedTagSubType = isDateTag
3751
+ ? this.getScenarioSelectedDateTag(scenario, scenarioTagsConfig)
3752
+ : scenarioTag.options.sub_type;
3753
+ const tag = {
3754
+ toggle: this.areExistingTagsConfig ? false : toggleStatus,
3755
+ name: scenarioTag.scenarioData.name || scenarioTag.name,
3756
+ description: scenarioTag.scenarioData.description || scenarioTag.description,
3757
+ type: scenarioTag.type,
3758
+ selectedTagSubType,
3759
+ };
3760
+ if (scenarioTag.scenarioData.turnOffDateTags) {
3761
+ tag.turnOffDateTags = scenarioTag.scenarioData.turnOffDateTags;
3762
+ }
3763
+ if (scenarioTag.scenarioData.acceptableDateTags) {
3764
+ tag.acceptableDateTags = scenarioTag.scenarioData.acceptableDateTags;
3765
+ }
3766
+ return tag;
3767
+ }
3768
+ updateScenarioDateTag(dateTag, scenarioTag) {
3769
+ if (!dateTag.subTags) {
3770
+ dateTag.subTags = [];
3771
+ }
3772
+ const tagSubType = scenarioTag.options.sub_type;
3773
+ dateTag.subTags.push({
3774
+ subType: tagSubType,
3775
+ name: tagSubType === TagsConfigSubType.FORECAST_NEW ? this.DEFAULT_FORECAST_DATE_TAG : scenarioTag.name,
3776
+ });
3777
+ }
3778
+ turnOffDateTag(scenarioTags) {
3779
+ const dateTag = find(scenarioTags, { type: TagTypes.DATE });
3780
+ if (!dateTag)
3781
+ return;
3782
+ dateTag.toggle = false;
3783
+ }
3784
+ hideNotAvailableTags(tagWithSpecificDateTags, scenarioTags) {
3785
+ var _a;
3786
+ const subTags = (_a = find(scenarioTags, { type: TagTypes.DATE })) === null || _a === void 0 ? void 0 : _a.subTags;
3787
+ if (!subTags.length)
3788
+ return;
3789
+ forEach(scenarioTags, (tag) => {
3790
+ var _a;
3791
+ if (!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length))
3792
+ return;
3793
+ if (tag !== tagWithSpecificDateTags) {
3794
+ tag.toggle = false;
3795
+ }
3796
+ });
3797
+ forEach(subTags, (subTag) => {
3798
+ subTag.hidden = !tagWithSpecificDateTags.acceptableDateTags.includes(subTag.subType);
3799
+ });
3800
+ }
3801
+ getScenarioSelectedDateTag(scenario, dateTags) {
3802
+ var _a, _b;
3803
+ const monthSubType = (_b = (_a = find(dateTags, (tag) => tag.options.sub_type === TagsConfigSubType.MONTH)) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type;
3804
+ const scenarioSelectedDateTag = {
3805
+ [Scenario.ACTUALS]: () => monthSubType,
3806
+ [Scenario.BUDGET]: () => { var _a, _b; return (_b = (_a = find(dateTags, (tag) => tag.options.sub_type === TagsConfigSubType.YEAR)) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type; },
3807
+ [Scenario.FORECAST]: () => { var _a, _b; return (_b = (_a = find(dateTags, (tag) => tag.options.sub_type === TagsConfigSubType.FORECAST_NEW)) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type; },
3808
+ [Scenario.NONE]: () => monthSubType,
3809
+ };
3810
+ if (!scenarioSelectedDateTag[scenario])
3811
+ return;
3812
+ return scenarioSelectedDateTag[scenario]();
3813
+ }
3814
+ getScenarioTagsConfig(scenario, tagsConfig) {
3815
+ return reduce(tagsConfig, (acc, tagConfig) => {
3816
+ var _a, _b;
3817
+ const tagSubType = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.options) === null || _a === void 0 ? void 0 : _a.sub_type;
3818
+ const scenarioTagDataConfig = getScenarioTagDataConfig(this.isMultipleDimension);
3819
+ const scenarioTagConfig = (_b = scenarioTagDataConfig === null || scenarioTagDataConfig === void 0 ? void 0 : scenarioTagDataConfig[scenario]) === null || _b === void 0 ? void 0 : _b[tagSubType];
3820
+ if (!scenarioTagConfig || scenarioTagConfig.hidden)
3821
+ return acc;
3822
+ const clonedTagConfig = cloneDeep(tagConfig);
3823
+ const scenarioTag = Object.assign(Object.assign({}, clonedTagConfig), { scenarioData: scenarioTagConfig });
3824
+ acc.push(scenarioTag);
3825
+ return acc;
3826
+ }, []);
3827
+ }
3828
+ }
3829
+ ScenarioService.decorators = [
3830
+ { type: Injectable }
3831
+ ];
3832
+
3580
3833
  class DrSharedUtils {
3581
3834
  /**
3582
3835
  * Get timeframe (day, year, month, quarter) based on passed format
@@ -3622,6 +3875,7 @@ class DrSharedUtils {
3622
3875
  }
3623
3876
  }
3624
3877
 
3878
+ // @ts-ignore
3625
3879
  const moment$2 = require('moment');
3626
3880
  class DrDatePickerService {
3627
3881
  constructor() {
@@ -3806,8 +4060,9 @@ class DrDatePickerService {
3806
4060
  }
3807
4061
  }
3808
4062
  }
4063
+ DrDatePickerService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DrDatePickerService_Factory() { return new DrDatePickerService(); }, token: DrDatePickerService, providedIn: "root" });
3809
4064
  DrDatePickerService.decorators = [
3810
- { type: Injectable }
4065
+ { type: Injectable, args: [{ providedIn: 'root' },] }
3811
4066
  ];
3812
4067
 
3813
4068
  const moment$1 = require('moment');
@@ -4018,12 +4273,16 @@ class DrDatePickerComponent {
4018
4273
  }
4019
4274
  return true;
4020
4275
  };
4021
- datePickerService.updatedQuarter$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
4022
- this.setValueFromMoment(value);
4023
- });
4276
+ if (datePickerService && datePickerService.updatedQuarter$) {
4277
+ datePickerService.updatedQuarter$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
4278
+ this.setValueFromMoment(value);
4279
+ });
4280
+ }
4024
4281
  }
4025
4282
  set format(value) {
4026
- this.datePickerService.updateTimeframeAndFormat(value);
4283
+ if (this.datePickerService) {
4284
+ this.datePickerService.updateTimeframeAndFormat(value);
4285
+ }
4027
4286
  }
4028
4287
  set min(minDate) {
4029
4288
  this._min = moment.unix(minDate).utc();
@@ -4040,6 +4299,13 @@ class DrDatePickerComponent {
4040
4299
  }
4041
4300
  this.cdr.markForCheck();
4042
4301
  }
4302
+ ngOnInit() {
4303
+ if (this.datePickerService && this.datePickerService.updatedQuarter$) {
4304
+ this.datePickerService.updatedQuarter$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
4305
+ this.setValueFromMoment(value);
4306
+ });
4307
+ }
4308
+ }
4043
4309
  ngAfterViewInit() {
4044
4310
  this.datePickerService.fiscalYearMonthsModifier = this.fiscalYearMonthsModifier;
4045
4311
  this.datePickerService.datePickerInstance = this.datePicker;
@@ -4162,10 +4428,7 @@ DrDatePickerComponent.decorators = [
4162
4428
  selector: 'dr-date-picker',
4163
4429
  template: "<i class=\"dr-icon-schedule\"></i>\n<input [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [matDatepickerFilter]=\"dateFilter\"\n [disabled]=\"disabled\"\n [placeholder]=\"placeholder\"\n [drDatePickerFormat]=\"datePickerService.format$ | async\"\n [readonly]=\"readonly\"\n [min]=\"_min\"\n [max]=\"_max\"/>\n<mat-datepicker #datePicker\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenPeriodHandler($event, timeframeOption.YEAR)\"\n (monthSelected)=\"chosenPeriodHandler($event, timeframeOption.MONTH)\">\n</mat-datepicker>\n",
4164
4430
  changeDetection: ChangeDetectionStrategy.OnPush,
4165
- providers: [
4166
- { provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerComponent, multi: true },
4167
- { provide: DrDatePickerService }
4168
- ],
4431
+ providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerComponent, multi: true }],
4169
4432
  styles: [":host{position:relative;width:100%;display:flex;flex-direction:row;min-height:32px;height:32px;font-size:14px;font-family:\"Poppins\",sans-serif;background-color:#fff;border:1px solid #c3c4ce;border-radius:6px;color:#85889c;overflow:hidden;outline:none;cursor:pointer}:host:hover{border-color:#85889c}:host:focus-within{border-color:#21b8f1!important;color:#151b3f}:host.disabled{pointer-events:none;border:none;color:#85889c;background:#e5e6ea}:host.ng-valid.ng-dirty{border-color:#03a678}:host.ng-invalid.ng-dirty:not(:focus-within){border-color:#de2833!important}:host.ng-untouched.ng-valid{border-color:#c3c4ce}:host:after,:host:before{position:absolute;display:flex;border-color:#999999 transparent transparent;color:#999}:host:after{content:\"\";height:0;width:0;border-style:solid;border-width:5px 5px 2.5px;right:11px;top:13px}:host i{position:absolute;color:#999;left:8px;top:3px}:host input{display:flex;flex-grow:1;height:100%;border:none;text-align:left;padding-left:35px;padding-right:25px;cursor:pointer!important;outline:none}:host input.when-quarter{position:absolute;visibility:hidden}:host input:disabled{border:none;color:#85889c;background:transparent}:host input::-webkit-search-decoration,:host input::-webkit-search-cancel-button,:host input::-webkit-search-results-button,:host input::-webkit-search-results-decoration{-webkit-appearance:none}::ng-deep .mat-datepicker-content{margin:7px 0;box-shadow:0 4px 8px 1px #00000040;border-radius:12px!important}::ng-deep .mat-datepicker-content button[disabled]{border:inherit;color:inherit;background-color:inherit}::ng-deep .mat-datepicker-content button[disabled]:hover{border:inherit}::ng-deep .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){background:#f2f2fb;color:#4646ce;font-weight:600}::ng-deep .mat-calendar-body-selected{background-color:#4646ce;color:#f2f2fb;font-weight:600}::ng-deep .mat-calendar-body-today.mat-calendar-body-selected{box-shadow:none}::ng-deep .mat-button-focus-overlay{background:#f3f7ff}::ng-deep .mat-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:1!important;background:#f3f7ff;transition:opacity .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-controls .mat-calendar-period-button:hover{background:#f3f7ff;transition:background .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-table-header th{font-size:14px;font-weight:600;color:#19181a}::ng-deep .mat-calendar-table-header-divider{display:none}::ng-deep .mat-calendar-body-label{color:#fff;padding:0}\n"]
4170
4433
  },] }
4171
4434
  ];
@@ -4329,13 +4592,13 @@ class DrDatePickerWithTimeframeComponent extends DrDatePickerComponent {
4329
4592
  DrDatePickerWithTimeframeComponent.decorators = [
4330
4593
  { type: Component, args: [{
4331
4594
  selector: 'dr-date-picker-with-timeframe',
4332
- template: "<dr-button [disabled]=\"isPrevDateDisabled\" *ngIf=\"!disabled\" theme=\"icon\" icon=\"dr-icon-arrow-left\" (click)=\"pagingClicked(false)\"></dr-button>\n<div class=\"dr-datepicker-input-container\">\n <i *ngIf=\"isDashboardDatepicker\" class=\"dr-icon-date\"></i>\n\n <div class=\"dr-datepicker-input-container__formatted-value-display\" (click)=\"datepickerInput.click()\">\n <span *ngIf=\"presetTagSelected && datePickerService.isUsingDateTagPresets\"> {{ presetTagSelected }} </span>\n <span>{{ presetTagSelected && datePickerService.isUsingDateTagPresets ? '(' + displayedFormattedValue + ')' : displayedFormattedValue }}</span>\n </div>\n <input\n #datepickerInput\n [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [readonly]=\"readonly\"\n [min]=\"_min\"\n [max]=\"_max\"\n />\n</div>\n<dr-button [disabled]=\"isNextDateDisabled\" *ngIf=\"!disabled\" theme=\"icon\" icon=\"dr-icon-arrow-right\" (click)=\"pagingClicked(true)\"></dr-button>\n<mat-datepicker #datePicker\n class=\"dr-timeframe-datepicker\"\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenPeriodHandler($event, timeframeOption.YEAR)\"\n (monthSelected)=\"chosenPeriodHandler($event, timeframeOption.MONTH)\"\n [panelClass]=\"datePickerService.isUsingDateTagPresets ? 'date-picker-preset-tag' : 'dr-timeframe-datepicker'\"\n >\n</mat-datepicker>\n",
4595
+ template: "<dr-button [disabled]=\"isPrevDateDisabled\" theme=\"icon\" icon=\"dr-icon-arrow-left\" (click)=\"pagingClicked(false)\"></dr-button>\n<div class=\"dr-datepicker-input-container\">\n <i *ngIf=\"isDashboardDatepicker\" class=\"dr-icon-date\"></i>\n \n <div class=\"dr-datepicker-input-container__formatted-value-display\" (click)=\"datepickerInput.click()\">\n <span *ngIf=\"presetTagSelected && datePickerService.isUsingDateTagPresets\"> {{ presetTagSelected }} </span>\n <span>{{ presetTagSelected && datePickerService.isUsingDateTagPresets ? '(' + displayedFormattedValue + ')' : displayedFormattedValue }}</span>\n </div>\n <input\n #datepickerInput\n [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [readonly]=\"readonly\"\n [min]=\"_min\"\n [max]=\"_max\"\n />\n</div>\n<dr-button [disabled]=\"isNextDateDisabled\" theme=\"icon\" icon=\"dr-icon-arrow-right\" (click)=\"pagingClicked(true)\"></dr-button>\n<mat-datepicker #datePicker\n class=\"dr-timeframe-datepicker\"\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenPeriodHandler($event, timeframeOption.YEAR)\"\n (monthSelected)=\"chosenPeriodHandler($event, timeframeOption.MONTH)\"\n [panelClass]=\"datePickerService.isUsingDateTagPresets ? 'date-picker-preset-tag' : 'dr-timeframe-datepicker'\"\n >\n</mat-datepicker>\n",
4333
4596
  changeDetection: ChangeDetectionStrategy.OnPush,
4334
4597
  providers: [
4335
4598
  { provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerWithTimeframeComponent, multi: true },
4336
4599
  { provide: DrDatePickerService }
4337
4600
  ],
4338
- styles: [":host{position:relative;width:100%;display:flex;flex-direction:row;min-height:32px;height:32px;font-size:14px;font-family:\"Poppins\",sans-serif;background-color:#fff;border:1px solid #c3c4ce;border-radius:6px;color:#85889c;overflow:hidden;outline:none;cursor:pointer}:host:hover{border-color:#85889c}:host:focus-within{border-color:#21b8f1!important;color:#151b3f}:host.disabled{pointer-events:none;border:none;color:#85889c;background:#e5e6ea}:host.ng-valid.ng-dirty{border-color:#03a678}:host.ng-invalid.ng-dirty:not(:focus-within){border-color:#de2833!important}:host.ng-untouched.ng-valid{border-color:#c3c4ce}:host:after,:host:before{position:absolute;display:flex;border-color:#999999 transparent transparent;color:#999}:host:after{content:\"\";height:0;width:0;border-style:solid;border-width:5px 5px 2.5px;right:11px;top:13px}:host i{position:absolute;color:#999;left:8px;top:3px}:host input{display:flex;flex-grow:1;height:100%;border:none;text-align:left;padding-left:35px;padding-right:25px;cursor:pointer!important;outline:none}:host input.when-quarter{position:absolute;visibility:hidden}:host input:disabled{border:none;color:#85889c;background:transparent}:host input::-webkit-search-decoration,:host input::-webkit-search-cancel-button,:host input::-webkit-search-results-button,:host input::-webkit-search-results-decoration{-webkit-appearance:none}::ng-deep .mat-datepicker-content{margin:7px 0;box-shadow:0 4px 8px 1px #00000040;border-radius:12px!important}::ng-deep .mat-datepicker-content button[disabled]{border:inherit;color:inherit;background-color:inherit}::ng-deep .mat-datepicker-content button[disabled]:hover{border:inherit}::ng-deep .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){background:#f2f2fb;color:#4646ce;font-weight:600}::ng-deep .mat-calendar-body-selected{background-color:#4646ce;color:#f2f2fb;font-weight:600}::ng-deep .mat-calendar-body-today.mat-calendar-body-selected{box-shadow:none}::ng-deep .mat-button-focus-overlay{background:#f3f7ff}::ng-deep .mat-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:1!important;background:#f3f7ff;transition:opacity .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-controls .mat-calendar-period-button:hover{background:#f3f7ff;transition:background .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-table-header th{font-size:14px;font-weight:600;color:#19181a}::ng-deep .mat-calendar-table-header-divider{display:none}::ng-deep .mat-calendar-body-label{color:#fff;padding:0}:host{border:none;display:flex;align-items:center}:host.disabled{background:transparent;color:inherit}:host.disabled.dr-date-picker-on-dashboard .dr-datepicker-input-container__formatted-value-display{text-decoration:none;color:#6d6e6f;font-weight:normal}:host.dr-date-picker-on-dashboard{width:-moz-fit-content;width:fit-content;justify-content:space-between}:host.dr-date-picker-on-dashboard mat-datepicker{position:absolute}:host.dr-date-picker-on-dashboard:after{visibility:hidden}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container{display:flex;flex-direction:row;justify-content:center;align-items:center;margin-left:-10px}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container__formatted-value-display{font-weight:600;width:auto;margin-left:5px}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container .dr-icon-date{display:block;position:relative;top:0;margin-right:8px;color:#4e566c}:host .dr-datepicker-input-container input{visibility:hidden;position:absolute;width:100%}:host .dr-datepicker-input-container__formatted-value-display{width:90px;height:22px;padding-left:0;text-align:center;line-height:22px;color:#0c142b;-webkit-text-decoration-line:underline;text-decoration-line:underline}:host .dr-datepicker-input-container__formatted-value-display:hover{background-color:#f2f2fb;border-radius:5px;cursor:pointer;-webkit-text-decoration-line:underline;text-decoration-line:underline;color:#4646ce}::ng-deep .date-picker-preset-tag{width:386px!important}::ng-deep .date-picker-preset-tag .mat-calendar-content{padding-left:32px!important;padding-right:32px!important}\n"]
4601
+ styles: [":host{position:relative;width:100%;display:flex;flex-direction:row;min-height:32px;height:32px;font-size:14px;font-family:\"Poppins\",sans-serif;background-color:#fff;border:1px solid #c3c4ce;border-radius:6px;color:#85889c;overflow:hidden;outline:none;cursor:pointer}:host:hover{border-color:#85889c}:host:focus-within{border-color:#21b8f1!important;color:#151b3f}:host.disabled{pointer-events:none;border:none;color:#85889c;background:#e5e6ea}:host.ng-valid.ng-dirty{border-color:#03a678}:host.ng-invalid.ng-dirty:not(:focus-within){border-color:#de2833!important}:host.ng-untouched.ng-valid{border-color:#c3c4ce}:host:after,:host:before{position:absolute;display:flex;border-color:#999999 transparent transparent;color:#999}:host:after{content:\"\";height:0;width:0;border-style:solid;border-width:5px 5px 2.5px;right:11px;top:13px}:host i{position:absolute;color:#999;left:8px;top:3px}:host input{display:flex;flex-grow:1;height:100%;border:none;text-align:left;padding-left:35px;padding-right:25px;cursor:pointer!important;outline:none}:host input.when-quarter{position:absolute;visibility:hidden}:host input:disabled{border:none;color:#85889c;background:transparent}:host input::-webkit-search-decoration,:host input::-webkit-search-cancel-button,:host input::-webkit-search-results-button,:host input::-webkit-search-results-decoration{-webkit-appearance:none}::ng-deep .mat-datepicker-content{margin:7px 0;box-shadow:0 4px 8px 1px #00000040;border-radius:12px!important}::ng-deep .mat-datepicker-content button[disabled]{border:inherit;color:inherit;background-color:inherit}::ng-deep .mat-datepicker-content button[disabled]:hover{border:inherit}::ng-deep .mat-calendar-body-cell:not(.mat-calendar-body-disabled):hover>.mat-calendar-body-cell-content:not(.mat-calendar-body-selected):not(.mat-calendar-body-comparison-identical){background:#f2f2fb;color:#4646ce;font-weight:600}::ng-deep .mat-calendar-body-selected{background-color:#4646ce;color:#f2f2fb;font-weight:600}::ng-deep .mat-calendar-body-today.mat-calendar-body-selected{box-shadow:none}::ng-deep .mat-button-focus-overlay{background:#f3f7ff}::ng-deep .mat-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:1!important;background:#f3f7ff;transition:opacity .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-controls .mat-calendar-period-button:hover{background:#f3f7ff;transition:background .2s cubic-bezier(.35,0,.25,1)}::ng-deep .mat-calendar-table-header th{font-size:14px;font-weight:600;color:#19181a}::ng-deep .mat-calendar-table-header-divider{display:none}::ng-deep .mat-calendar-body-label{color:#fff;padding:0}:host{border:none;display:flex;align-items:center}:host.dr-date-picker-on-dashboard{width:-moz-fit-content;width:fit-content;justify-content:space-between}:host.dr-date-picker-on-dashboard mat-datepicker{position:absolute}:host.dr-date-picker-on-dashboard:after{visibility:hidden}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container{display:flex;flex-direction:row;justify-content:center;align-items:center;margin-left:-10px}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container__formatted-value-display{font-weight:600;width:auto;margin-left:5px}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container .dr-icon-date{display:block;position:relative;top:0;margin-right:8px;color:#4e566c}:host .dr-datepicker-input-container input{visibility:hidden;position:absolute;width:100%}:host .dr-datepicker-input-container__formatted-value-display{width:90px;height:22px;padding-left:0;text-align:center;line-height:22px;color:#0c142b;-webkit-text-decoration-line:underline;text-decoration-line:underline}:host .dr-datepicker-input-container__formatted-value-display:hover{background-color:#f2f2fb;border-radius:5px;cursor:pointer;-webkit-text-decoration-line:underline;text-decoration-line:underline;color:#4646ce}::ng-deep .date-picker-preset-tag{width:386px!important}::ng-deep .date-picker-preset-tag .mat-calendar-content{padding-left:32px!important;padding-right:32px!important}\n"]
4339
4602
  },] }
4340
4603
  ];
4341
4604
  DrDatePickerWithTimeframeComponent.ctorParameters = () => [
@@ -4631,7 +4894,8 @@ DrInputsModule.decorators = [
4631
4894
  MatDatepickerModule,
4632
4895
  MatTooltipModule,
4633
4896
  DrTooltipModule
4634
- ]
4897
+ ],
4898
+ entryComponents: [DrDatePickerCustomHeaderComponent]
4635
4899
  },] }
4636
4900
  ];
4637
4901
 
@@ -5574,11 +5838,184 @@ DrChatModule.decorators = [
5574
5838
  },] }
5575
5839
  ];
5576
5840
 
5841
+ class DrScenarioConfigurationComponent {
5842
+ constructor(scenarioService) {
5843
+ this.scenarioService = scenarioService;
5844
+ this.toggleButtonTheme = ToggleButtonTheme;
5845
+ this._scenarioTags = [];
5846
+ this.wholeTagsConfig = [];
5847
+ this.selectedScenario = Scenario.ACTUALS;
5848
+ this.scenarioDataChanged = new EventEmitter();
5849
+ }
5850
+ get scenarioTags() {
5851
+ return this._scenarioTags;
5852
+ }
5853
+ set scenarioTags(tags) {
5854
+ this._scenarioTags = tags;
5855
+ this.tagNotSupportingDates = find(tags, { turnOffDateTags: true });
5856
+ }
5857
+ ngOnInit() {
5858
+ this.scenarios = this.scenarioService.scenarios;
5859
+ this.scenarioService.initScenarioTags(this.selectedScenario, this.wholeTagsConfig, this.currentTagsConfig);
5860
+ this.scenarioTags = this.scenarioService.getScenarioTagsByScenario(this.selectedScenario);
5861
+ }
5862
+ onScenarioChange(scenario) {
5863
+ this.scenarioTags = this.scenarioService.getScenarioTagsByScenario(scenario);
5864
+ this.onScenarioDataChange();
5865
+ }
5866
+ onScenarioTagToggle(tag) {
5867
+ this.tagNotSupportingDatesHandler(tag);
5868
+ this.tagAcceptableDateHandler(tag);
5869
+ this.onScenarioDataChange();
5870
+ }
5871
+ onScenarioDataChange() {
5872
+ this.scenarioDataChanged.emit({
5873
+ scenario: this.selectedScenario,
5874
+ tagsConfig: this.scenarioService.getTagsConfigByScenarioTags(this.scenarioTags, this.wholeTagsConfig),
5875
+ });
5876
+ }
5877
+ tagNotSupportingDatesHandler(tag) {
5878
+ if (!this.tagNotSupportingDates || !tag.toggle)
5879
+ return;
5880
+ if (tag.type === TagTypes.DATE) {
5881
+ this.tagNotSupportingDates.toggle = false;
5882
+ }
5883
+ if (tag === this.tagNotSupportingDates) {
5884
+ const dateTag = find(this.scenarioTags, { type: TagTypes.DATE });
5885
+ if (dateTag) {
5886
+ dateTag.toggle = false;
5887
+ }
5888
+ }
5889
+ }
5890
+ tagAcceptableDateHandler(tag) {
5891
+ var _a;
5892
+ if (!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length))
5893
+ return;
5894
+ const dateTag = find(this.scenarioTags, { type: TagTypes.DATE });
5895
+ if (!dateTag)
5896
+ return;
5897
+ dateTag.subTags = map(dateTag.subTags, (subTag) => {
5898
+ subTag.hidden = tag.toggle && !includes(tag.acceptableDateTags, subTag.subType);
5899
+ return subTag;
5900
+ });
5901
+ dateTag.selectedTagSubType = tag.acceptableDateTags[0];
5902
+ }
5903
+ }
5904
+ DrScenarioConfigurationComponent.decorators = [
5905
+ { type: Component, args: [{
5906
+ selector: 'dr-scenario-configuration',
5907
+ template: "<div class=\"scenario\">\n <div class=\"scenario__list\">\n <p class=\"scenario__title scenario__title-list\">Scenario</p>\n <dr-select [(ngModel)]=\"selectedScenario\"\n placeholder=\"select\"\n [items]=\"scenarios\"\n (ngModelChange)=\"onScenarioChange($event)\"></dr-select>\n </div>\n <div class=\"scenario__tags\">\n <p class=\"scenario__title--extra scenario__tags__title\">Tags</p>\n <div class=\"scenario__tag\" *ngFor=\"let tag of scenarioTags\">\n <div class=\"scenario__tag__header\">\n <p class=\"scenario__title\">{{ tag.name }}</p>\n <dr-toggle [(ngModel)]=\"tag.toggle\"\n (ngModelChange)=\"onScenarioTagToggle(tag)\"></dr-toggle>\n </div>\n <div class=\"scenario__tag__description\">\n <p class=\"scenario__text\">{{ tag.description }}</p>\n </div>\n <div *ngIf=\"tag.toggle\" class=\"scenario__tag__body\">\n <div *ngIf=\"tag.subTags?.length\" class=\"scenario__sub-tag\">\n <dr-toggle-button [(ngModel)]=\"tag.selectedTagSubType\"\n bindHidden=\"hidden\"\n bindLabel=\"name\"\n bindValue=\"subType\"\n [items]=\"tag.subTags\"\n [theme]=\"toggleButtonTheme.DOTTED\"\n (ngModelChange)=\"onScenarioDataChange()\"></dr-toggle-button>\n </div>\n </div>\n </div>\n </div>\n</div>\n",
5908
+ changeDetection: ChangeDetectionStrategy.OnPush,
5909
+ styles: [".scenario__text,.scenario__title,.scenario__title--extra{padding:0;margin:0;color:#0c142b;font-weight:400;font-size:14px;line-height:22px}.scenario__title{font-weight:600}.scenario__title--extra{font-weight:700}.scenario__tags{margin-top:24px}.scenario__tags__title{margin-bottom:16px}.scenario__title-list{margin-bottom:4px}.scenario__tag{margin-bottom:24px;padding-top:16px;border-top:1px solid #dfe0e3}.scenario__tag__description{margin-top:5px}.scenario__tag__header{display:flex;justify-content:space-between}.scenario__sub-tag{margin-top:8px}:host::ng-deep .toggle-container__item{padding:2px 8px!important}\n"]
5910
+ },] }
5911
+ ];
5912
+ DrScenarioConfigurationComponent.ctorParameters = () => [
5913
+ { type: ScenarioService }
5914
+ ];
5915
+ DrScenarioConfigurationComponent.propDecorators = {
5916
+ currentTagsConfig: [{ type: Input }],
5917
+ wholeTagsConfig: [{ type: Input }],
5918
+ selectedScenario: [{ type: Input }],
5919
+ scenarioDataChanged: [{ type: Output }]
5920
+ };
5921
+
5922
+ class DrScenarioTagConfigurationComponent {
5923
+ constructor() {
5924
+ this.connectedTags = {};
5925
+ this.dynamicTagValues = {};
5926
+ this.lockedDates = [];
5927
+ this.scenarioTagDataChanged = new EventEmitter();
5928
+ this.currentTagsMap = {};
5929
+ this._currentTags = [];
5930
+ this.dynamicTagsToSave = [];
5931
+ this.tagsToSave = [];
5932
+ }
5933
+ set currentTags(tags) {
5934
+ this._currentTags = tags;
5935
+ this.currentTagsMap = reduce(tags, (acc, curr) => {
5936
+ var _a;
5937
+ const tagId = (_a = find(this.tagsConfig, { name: curr.name })) === null || _a === void 0 ? void 0 : _a.id;
5938
+ if (isNaN(tagId))
5939
+ return acc;
5940
+ acc[tagId] = curr;
5941
+ return acc;
5942
+ }, {});
5943
+ }
5944
+ get currentTags() {
5945
+ return this._currentTags;
5946
+ }
5947
+ ngOnChanges(simpleChanges) {
5948
+ this.currentTags = this.currentTags;
5949
+ }
5950
+ onTagChange($event) {
5951
+ const savedTag = find(this.tagsToSave, { id: $event.id });
5952
+ if (savedTag) {
5953
+ merge(savedTag, $event);
5954
+ }
5955
+ else {
5956
+ this.tagsToSave.push($event);
5957
+ }
5958
+ this.onScenarioTagDataChanged();
5959
+ }
5960
+ onDynamicTagsChange($event) {
5961
+ this.dynamicTagsToSave = $event;
5962
+ this.onScenarioTagDataChanged();
5963
+ }
5964
+ onScenarioTagDataChanged() {
5965
+ const tags = [...this.dynamicTagsToSave, ...this.tagsToSave];
5966
+ this.scenarioTagDataChanged.emit({
5967
+ scenario: this.scenario,
5968
+ tagsConfig: this.tagsConfig,
5969
+ tags,
5970
+ });
5971
+ }
5972
+ }
5973
+ DrScenarioTagConfigurationComponent.decorators = [
5974
+ { type: Component, args: [{
5975
+ selector: 'dr-scenario-tag-configuration',
5976
+ template: "<div class=\"scenario-tag-configuration\"\n *ngFor=\"let tagConfig of tagsConfig\">\n <dr-tag [tagConfig]=\"tagConfig\"\n [selectedTag]=\"currentTagsMap[tagConfig.id]\"\n [lockedDate]=\"lockedDates\"\n [fiscalYearStartsFrom]=\"fiscalYearStartsFrom\"\n [fiscalYearBack]=\"fiscalYearBack\"\n [tagsConfig]=\"tagsConfig\"\n [dynamicTagValues]=\"dynamicTagValues\"\n [connectedTags]=\"connectedTags[tagConfig.id]\"\n [isDynamicTagAddEnabled]=\"isDynamicAddEnabled\"\n (tagChange)=\"onTagChange($event)\"\n (dynamicTagChange)=\"onDynamicTagsChange($event)\"></dr-tag>\n</div>\n",
5977
+ changeDetection: ChangeDetectionStrategy.OnPush,
5978
+ styles: [".scenario-tag-configuration{margin-bottom:24px}.scenario-tag-configuration:last-child{margin-bottom:0}:host::ng-deep .tag__label,:host::ng-deep .dynamic-tag__label{font-weight:600!important}\n"]
5979
+ },] }
5980
+ ];
5981
+ DrScenarioTagConfigurationComponent.propDecorators = {
5982
+ tagsConfig: [{ type: Input }],
5983
+ currentTags: [{ type: Input }],
5984
+ scenario: [{ type: Input }],
5985
+ connectedTags: [{ type: Input }],
5986
+ dynamicTagValues: [{ type: Input }],
5987
+ lockedDates: [{ type: Input }],
5988
+ fiscalYearStartsFrom: [{ type: Input }],
5989
+ fiscalYearBack: [{ type: Input }],
5990
+ isDynamicAddEnabled: [{ type: Input }],
5991
+ scenarioTagDataChanged: [{ type: Output }]
5992
+ };
5993
+
5994
+ const COMPONENTS = [
5995
+ DrScenarioConfigurationComponent,
5996
+ DrScenarioTagConfigurationComponent,
5997
+ ];
5998
+ class DrScenarioModule {
5999
+ }
6000
+ DrScenarioModule.decorators = [
6001
+ { type: NgModule, args: [{
6002
+ declarations: [...COMPONENTS],
6003
+ providers: [ScenarioService],
6004
+ imports: [
6005
+ CommonModule,
6006
+ DrInputsModule,
6007
+ FormsModule,
6008
+ DrTagModule
6009
+ ],
6010
+ exports: [...COMPONENTS],
6011
+ },] }
6012
+ ];
6013
+
5577
6014
  /* components */
5578
6015
 
5579
6016
  /**
5580
6017
  * Generated bundle index. Do not edit.
5581
6018
  */
5582
6019
 
5583
- export { AnyTagComponent, CHAT_MESSAGE_TYPE, CalendarView, ChatMessage, ChatRole, CheckboxComponent, CustomDateFormat, DIALOG_BUTTON_LABEL, DIALOG_FIELD_TYPE, DIALOG_SIZE, DateFromats, DatePickerPeriodPosition, DateTagComponent, DateTagModule, DateTags, DayTagComponent, DialogService, DrAccordionComponent, DrAccordionItemBodyComponent, DrAccordionItemComponent, DrAccordionItemHeaderComponent, DrAccordionModule, DrAvatarComponent, DrAvatarModule, DrAvatarPipe, DrButtonComponent, DrChatModule, DrDialogModule, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrErrorComponent, DrErrorModule, DrInputComponent, DrInputsModule, DrLayoutBodyComponent, DrLayoutComponent, DrLayoutHeaderComponent, DrLayoutModule, DrModelDebounceChangeDirective, DrPopoverAlignmentDimension, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrPopoverService, DrSelectComponent, DrSharedUtils, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrStepperModule, DrTabComponent, DrTabsComponent, DrTabsModule, DrTagComponent, DrTagModule, DrToggleButtonComponent, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, IMAGE_TYPES, ListTagComponent, ListTagModule, MonthTagComponent, QuarterTagComponent, RadioButtonComponent, RadioGroupComponent, SpinnerSize, SpinnerType, TagTypes, TimeframeOption, TooltipComponent, TooltipPosition, WeekTagComponent, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, DrDatePickerComponent as ɵc, DrDatePickerService as ɵd, DrDatePickerWithTimeframeComponent as ɵe, DrDatePickerFormatDirective as ɵf, DrDatePickerCustomHeaderComponent as ɵg, DrShowTimeframePipe as ɵh, DrSelectAddItemComponent as ɵi, TooltipInfoComponent as ɵj, TooltipInfoSimpleComponent as ɵk, TooltipNoBodyComponent as ɵl, TooltipProcessDefaultComponent as ɵm, DrDynamicTagModule as ɵn, DrDynamicTagComponent as ɵo, StepperComponent as ɵp, DialogWrapperComponent as ɵq, DialogModalWrapperComponent as ɵr, DrChatComponent as ɵs, DrChatCustomMessageService as ɵt, DrChatMessageComponent as ɵu, DrChatFormComponent as ɵv, DrChatSuggestionsComponent as ɵw, DrChatMessageTextComponent as ɵx, DrChatMessageFileComponent as ɵy, DrChatCustomMessageDirective as ɵz };
6020
+ export { AnyTagComponent, CHAT_MESSAGE_TYPE, CalendarView, ChatMessage, ChatRole, CheckboxComponent, CustomDateFormat, DIALOG_BUTTON_LABEL, DIALOG_FIELD_TYPE, DIALOG_SIZE, DateFromats, DatePickerPeriodPosition, DateTagComponent, DateTagModule, DateTags, DayTagComponent, DialogService, DrAccordionComponent, DrAccordionItemBodyComponent, DrAccordionItemComponent, DrAccordionItemHeaderComponent, DrAccordionModule, DrAvatarComponent, DrAvatarModule, DrAvatarPipe, DrButtonComponent, DrChatModule, DrDialogModule, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrErrorComponent, DrErrorModule, DrInputComponent, DrInputsModule, DrLayoutBodyComponent, DrLayoutComponent, DrLayoutHeaderComponent, DrLayoutModule, DrModelDebounceChangeDirective, DrPopoverAlignmentDimension, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrPopoverService, DrScenarioModule, DrSelectComponent, DrSharedUtils, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrStepperModule, DrTabComponent, DrTabsComponent, DrTabsModule, DrTagComponent, DrTagModule, DrToggleButtonComponent, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, IMAGE_TYPES, ListTagComponent, ListTagModule, MonthTagComponent, QuarterTagComponent, RadioButtonComponent, RadioGroupComponent, Scenario, ScenarioService, SpinnerSize, SpinnerType, TagTypes, TimeframeOption, ToggleButtonTheme, TooltipComponent, TooltipPosition, WeekTagComponent, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, DrScenarioConfigurationComponent as ɵba, DrScenarioTagConfigurationComponent as ɵbb, DrDatePickerComponent as ɵc, DrDatePickerService as ɵd, DrDatePickerWithTimeframeComponent as ɵe, DrDatePickerFormatDirective as ɵf, DrDatePickerCustomHeaderComponent as ɵg, DrShowTimeframePipe as ɵh, DrSelectAddItemComponent as ɵi, TooltipInfoComponent as ɵj, TooltipInfoSimpleComponent as ɵk, TooltipNoBodyComponent as ɵl, TooltipProcessDefaultComponent as ɵm, DrDynamicTagModule as ɵn, DrDynamicTagComponent as ɵo, StepperComponent as ɵp, DialogWrapperComponent as ɵq, DialogModalWrapperComponent as ɵr, DrChatComponent as ɵs, DrChatCustomMessageService as ɵt, DrChatMessageComponent as ɵu, DrChatFormComponent as ɵv, DrChatSuggestionsComponent as ɵw, DrChatMessageTextComponent as ɵx, DrChatMessageFileComponent as ɵy, DrChatCustomMessageDirective as ɵz };
5584
6021
  //# sourceMappingURL=datarailsshared-datarailsshared.js.map