@datarailsshared/datarailsshared 1.4.165-rocket → 1.4.167

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 (42) hide show
  1. package/bundles/datarailsshared-datarailsshared.umd.js +475 -23
  2. package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
  3. package/datarailsshared-datarailsshared-1.4.167.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 +2 -2
  8. package/esm2015/lib/date-tags/month-tag/month-tag.component.js +2 -2
  9. package/esm2015/lib/date-tags/week-tag/week-tag.component.js +2 -2
  10. package/esm2015/lib/date-tags/year-tag/year-tag.component.js +5 -10
  11. package/esm2015/lib/dr-dialog/components/dialog-wrapper/dialog-wrapper.component.js +4 -1
  12. package/esm2015/lib/dr-dialog/services/dialog.service.js +4 -1
  13. package/esm2015/lib/dr-inputs/date-pickers/services/dr-date-picker.service.js +1 -1
  14. package/esm2015/lib/dr-inputs/dr-toggle-button/dr-toggle-button.component.js +6 -6
  15. package/esm2015/lib/dr-inputs/dr-toggle-button/toggle-button-mode.js +6 -0
  16. package/esm2015/lib/dr-scenario/components/dr-scenario-configuration/dr-scenario-configuration.component.js +93 -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 +5 -4
  23. package/esm2015/public-api.js +5 -2
  24. package/fesm2015/datarailsshared-datarailsshared.js +441 -26
  25. package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
  26. package/lib/date-tags/date-tag.module.d.ts +1 -2
  27. package/lib/date-tags/year-tag/year-tag.component.d.ts +1 -3
  28. package/lib/dr-dialog/components/dialog-wrapper/dialog-wrapper.component.d.ts +1 -0
  29. package/lib/dr-dialog/services/dialog.service.d.ts +1 -0
  30. package/lib/dr-inputs/dr-toggle-button/dr-toggle-button.component.d.ts +2 -2
  31. package/lib/dr-inputs/dr-toggle-button/{toggle-button-theme.d.ts → toggle-button-mode.d.ts} +1 -1
  32. package/lib/dr-scenario/components/dr-scenario-configuration/dr-scenario-configuration.component.d.ts +27 -0
  33. package/lib/dr-scenario/components/dr-scenario-tag-configuration/dr-scenario-tag-configuration.component.d.ts +26 -0
  34. package/lib/dr-scenario/consts/scenario-tags-config.d.ts +24 -0
  35. package/lib/dr-scenario/dr-scenario.module.d.ts +2 -0
  36. package/lib/dr-scenario/interfaces/scenario.d.ts +43 -0
  37. package/lib/dr-scenario/services/scenario.service.d.ts +21 -0
  38. package/lib/dr-tags/dr-tag.component.d.ts +2 -2
  39. package/package.json +1 -1
  40. package/public-api.d.ts +4 -1
  41. package/datarailsshared-datarailsshared-1.4.165-rocket.tgz +0 -0
  42. package/esm2015/lib/dr-inputs/dr-toggle-button/toggle-button-theme.js +0 -6
@@ -612,7 +612,7 @@
612
612
  configurable: true
613
613
  });
614
614
  MonthTagComponent.prototype.initDate = function () {
615
- this.date = this.defaultValue || moment$7().unix();
615
+ this.date = this.defaultValue || moment$7().utc().unix();
616
616
  this.dateObj.date = this.date;
617
617
  };
618
618
  MonthTagComponent.prototype.initName = function () {
@@ -817,7 +817,7 @@
817
817
  });
818
818
  WeekTagComponent.prototype.ngOnInit = function () {
819
819
  this.initName();
820
- var timestamp = this.defaultValue || moment$5().unix();
820
+ var timestamp = this.defaultValue || moment$5().utc().unix();
821
821
  this.date = timestamp;
822
822
  this.dateObj.date = timestamp;
823
823
  this.chosenTagHandler(timestamp);
@@ -889,9 +889,8 @@
889
889
  var ɵ0$5 = YEAR_FORMATS;
890
890
  var YearTagComponent = /** @class */ (function (_super) {
891
891
  __extends(YearTagComponent, _super);
892
- function YearTagComponent(cdr) {
892
+ function YearTagComponent() {
893
893
  var _this = _super.call(this) || this;
894
- _this.cdr = cdr;
895
894
  _this.lockedDate = [];
896
895
  return _this;
897
896
  }
@@ -903,12 +902,10 @@
903
902
  configurable: true
904
903
  });
905
904
  YearTagComponent.prototype.initDate = function () {
906
- this.date = this.defaultValue || moment$4().unix();
905
+ this.date = this.defaultValue || moment$4().utc().unix();
907
906
  this.dateObj.date = this.date;
908
- this.cdr.markForCheck();
909
907
  };
910
908
  YearTagComponent.prototype.initName = function () {
911
- console.warn('bla bla bla');
912
909
  if (!this.name) {
913
910
  this.name = 'Year';
914
911
  }
@@ -950,9 +947,7 @@
950
947
  styles: [":host.locked>.tag-wrapper>dr-date-picker{opacity:.4}.tag__label{margin:0 0 4px;color:#0c142b;font-size:14px;font-weight:400;line-height:22px}\n"]
951
948
  },] }
952
949
  ];
953
- YearTagComponent.ctorParameters = function () { return [
954
- { type: i0.ChangeDetectorRef }
955
- ]; };
950
+ YearTagComponent.ctorParameters = function () { return []; };
956
951
  YearTagComponent.propDecorators = {
957
952
  isLocked: [{ type: i0.HostBinding, args: ['class.locked',] }],
958
953
  lockedDate: [{ type: i0.Input }]
@@ -1005,12 +1000,13 @@
1005
1000
  enumerable: false,
1006
1001
  configurable: true
1007
1002
  });
1008
- DrTagComponent.prototype.ngOnChanges = function () {
1009
- this.calculateDynamicTag();
1003
+ DrTagComponent.prototype.ngOnChanges = function (simpleChanges) {
1004
+ if (simpleChanges.tagsConfig) {
1005
+ this.calculateDynamicTag();
1006
+ }
1010
1007
  };
1011
1008
  DrTagComponent.prototype.ngOnInit = function () {
1012
1009
  var _a, _b;
1013
- this.calculateDynamicTag();
1014
1010
  this.dateTag = {
1015
1011
  type: this.tagConfig.type,
1016
1012
  sub_type: this.tagConfig.options.sub_type,
@@ -1224,7 +1220,7 @@
1224
1220
  configurable: true
1225
1221
  });
1226
1222
  DayTagComponent.prototype.initDate = function () {
1227
- this.date = this.defaultValue || moment$3().unix();
1223
+ this.date = this.defaultValue || moment$3().utc().unix();
1228
1224
  this.dateObj.date = this.date;
1229
1225
  };
1230
1226
  DayTagComponent.prototype.initName = function () {
@@ -2461,11 +2457,11 @@
2461
2457
  elementClass: [{ type: i0.HostBinding, args: ['class',] }]
2462
2458
  };
2463
2459
 
2464
- exports.ToggleButtonTheme = void 0;
2465
- (function (ToggleButtonTheme) {
2466
- ToggleButtonTheme["DEFAULT"] = "default";
2467
- ToggleButtonTheme["DOTTED"] = "dotted";
2468
- })(exports.ToggleButtonTheme || (exports.ToggleButtonTheme = {}));
2460
+ exports.ToggleButtonMode = void 0;
2461
+ (function (ToggleButtonMode) {
2462
+ ToggleButtonMode["DEFAULT"] = "default";
2463
+ ToggleButtonMode["DOTTED"] = "dotted";
2464
+ })(exports.ToggleButtonMode || (exports.ToggleButtonMode = {}));
2469
2465
 
2470
2466
  var DrToggleButtonComponent = /** @class */ (function () {
2471
2467
  function DrToggleButtonComponent(cdr) {
@@ -2474,7 +2470,7 @@
2474
2470
  this.bindLabel = null;
2475
2471
  this.bindValue = null;
2476
2472
  this.bindHidden = null;
2477
- this.theme = exports.ToggleButtonTheme.DEFAULT;
2473
+ this.mode = exports.ToggleButtonMode.DEFAULT;
2478
2474
  this.onChange = function () {
2479
2475
  };
2480
2476
  this.onTouched = function () {
@@ -2511,12 +2507,12 @@
2511
2507
  DrToggleButtonComponent.decorators = [
2512
2508
  { type: i0.Component, args: [{
2513
2509
  selector: 'dr-toggle-button',
2514
- 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",
2510
+ template: "<div class=\"toggle-container\"\n [class.disabled]=\"_disabled\"\n [attr.mode]=\"mode\">\n <ng-container *ngFor=\"let item of items\">\n <div *ngIf=\"!item?.[bindHidden]\"\n class=\"toggle-container__item\"\n [class.selected]=\"item[bindValue] === selectedValue || item === selectedValue\"\n [class.disabled]=\"item.disabled\"\n (click)=\"setValue(item)\">{{ item[bindLabel] || item.name || item }}</div>\n </ng-container>\n</div>\n",
2515
2511
  providers: [
2516
2512
  { provide: forms.NG_VALUE_ACCESSOR, useExisting: i0.forwardRef(function () { return DrToggleButtonComponent; }), multi: true }
2517
2513
  ],
2518
2514
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
2519
- 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"]
2515
+ 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[mode~=default]{background:#f6f7f8;border:1px solid #c3c4ce}.toggle-container[mode~=dotted] .toggle-container__item{padding:2px 8px;border:1px solid #9ea1aa;border-radius:18px;margin-left:4px;color:#0c142b}.toggle-container[mode~=dotted] .toggle-container__item:hover{background:#f0f1f4}.toggle-container[mode~=dotted] .toggle-container__item:hover .toggle-container[mode~=dotted] .toggle-container__item.selected{background:unset}.toggle-container[mode~=dotted] .toggle-container__item:first-child{margin-left:0}\n"]
2520
2516
  },] }
2521
2517
  ];
2522
2518
  DrToggleButtonComponent.ctorParameters = function () { return [
@@ -2527,7 +2523,7 @@
2527
2523
  bindLabel: [{ type: i0.Input }],
2528
2524
  bindValue: [{ type: i0.Input }],
2529
2525
  bindHidden: [{ type: i0.Input }],
2530
- theme: [{ type: i0.Input }],
2526
+ mode: [{ type: i0.Input }],
2531
2527
  selectedValue: [{ type: i0.Input }],
2532
2528
  disabled: [{ type: i0.Input }]
2533
2529
  };
@@ -3929,6 +3925,9 @@
3929
3925
  DialogWrapperComponent.prototype.closeDialog = function (data) {
3930
3926
  this.dialogRef.close(data || false);
3931
3927
  };
3928
+ DialogWrapperComponent.prototype.enableAcceptButton = function () {
3929
+ this.dialogData.acceptButton.isDisabled = false;
3930
+ };
3932
3931
  DialogWrapperComponent.prototype.onDecline = function () {
3933
3932
  this.dialogRef.close(undefined);
3934
3933
  };
@@ -4117,6 +4116,9 @@
4117
4116
  DialogService.prototype.close = function (params) {
4118
4117
  this.wrapperComponent.close(params);
4119
4118
  };
4119
+ DialogService.prototype.enableAcceptButton = function () {
4120
+ this.wrapperComponent.componentInstance.enableAcceptButton();
4121
+ };
4120
4122
  DialogService.prototype.changeDialogThemeSize = function (theme) {
4121
4123
  this.wrapperComponent.componentInstance.class = theme;
4122
4124
  };
@@ -4228,6 +4230,14 @@
4228
4230
  TooltipPosition["LEFT_BOTTOM"] = "left-bottom";
4229
4231
  })(exports.TooltipPosition || (exports.TooltipPosition = {}));
4230
4232
 
4233
+ exports.Scenario = void 0;
4234
+ (function (Scenario) {
4235
+ Scenario["ACTUALS"] = "Actuals";
4236
+ Scenario["FORECAST"] = "Forecast";
4237
+ Scenario["BUDGET"] = "Budget";
4238
+ Scenario["NONE"] = "None";
4239
+ })(exports.Scenario || (exports.Scenario = {}));
4240
+
4231
4241
  var DrModelDebounceChangeDirective = /** @class */ (function () {
4232
4242
  function DrModelDebounceChangeDirective(ngModel) {
4233
4243
  this.ngModel = ngModel;
@@ -4293,6 +4303,247 @@
4293
4303
  return ChatMessage;
4294
4304
  }());
4295
4305
 
4306
+ var _a;
4307
+ var allDateTags = (_a = {},
4308
+ _a[TagsConfigSubType.YEAR] = {
4309
+ name: 'Date',
4310
+ toggle: false,
4311
+ },
4312
+ _a[TagsConfigSubType.QUARTER] = {
4313
+ name: 'Date',
4314
+ toggle: false,
4315
+ },
4316
+ _a[TagsConfigSubType.MONTH] = {
4317
+ name: 'Date',
4318
+ toggle: false,
4319
+ },
4320
+ _a[TagsConfigSubType.DAY] = {
4321
+ name: 'Date',
4322
+ toggle: false,
4323
+ },
4324
+ _a[TagsConfigSubType.WEEK] = {
4325
+ name: 'Date',
4326
+ toggle: false,
4327
+ },
4328
+ _a);
4329
+ function getScenarioTagDataConfig(isMultipleDimension) {
4330
+ var _a, _b, _c, _d, _e;
4331
+ return _a = {},
4332
+ _a[exports.Scenario.ACTUALS] = Object.assign(Object.assign({}, allDateTags), (_b = {}, _b[TagsConfigSubType.MONTH] = {
4333
+ name: 'Date',
4334
+ toggle: true,
4335
+ }, _b[TagsConfigSubType.FILE_STATUS] = {
4336
+ toggle: false,
4337
+ }, _b)),
4338
+ _a[exports.Scenario.BUDGET] = (_c = {},
4339
+ _c[TagsConfigSubType.BUDGET_CYCLE] = {
4340
+ toggle: true,
4341
+ acceptableDateTags: [TagsConfigSubType.YEAR],
4342
+ hidden: !isMultipleDimension,
4343
+ },
4344
+ _c[TagsConfigSubType.PLAN] = {
4345
+ toggle: false,
4346
+ turnOffDateTags: true,
4347
+ hidden: isMultipleDimension,
4348
+ },
4349
+ _c[TagsConfigSubType.YEAR] = {
4350
+ name: 'Date',
4351
+ toggle: true,
4352
+ },
4353
+ _c[TagsConfigSubType.QUARTER] = {
4354
+ name: 'Date',
4355
+ toggle: false,
4356
+ },
4357
+ _c[TagsConfigSubType.FILE_STATUS] = {
4358
+ toggle: false,
4359
+ },
4360
+ _c),
4361
+ _a[exports.Scenario.FORECAST] = (_d = {},
4362
+ _d[TagsConfigSubType.FORECAST_NEW] = {
4363
+ toggle: true,
4364
+ name: 'Date',
4365
+ },
4366
+ _d[TagsConfigSubType.FILE_STATUS] = {
4367
+ toggle: false,
4368
+ },
4369
+ _d),
4370
+ _a[exports.Scenario.NONE] = Object.assign(Object.assign({}, allDateTags), (_e = {}, _e[TagsConfigSubType.MONTH] = {
4371
+ name: 'Date',
4372
+ toggle: true,
4373
+ }, _e[TagsConfigSubType.FILE_STATUS] = {
4374
+ toggle: true,
4375
+ }, _e)),
4376
+ _a;
4377
+ }
4378
+
4379
+ var ScenarioService = /** @class */ (function () {
4380
+ function ScenarioService() {
4381
+ this.DEFAULT_FORECAST_DATE_TAG = 'Month';
4382
+ }
4383
+ Object.defineProperty(ScenarioService.prototype, "scenarios", {
4384
+ get: function () {
4385
+ return _.orderBy(Object.values(exports.Scenario), function (scenario) { return scenario === exports.Scenario.NONE ? 1 : 0; });
4386
+ },
4387
+ enumerable: false,
4388
+ configurable: true
4389
+ });
4390
+ Object.defineProperty(ScenarioService.prototype, "areExistingTagsConfig", {
4391
+ get: function () {
4392
+ return !!this.currentTagsConfig;
4393
+ },
4394
+ enumerable: false,
4395
+ configurable: true
4396
+ });
4397
+ ScenarioService.prototype.initScenarioTags = function (scenario, wholeTagsConfig, currentTagsConfig, isMultipleDimension) {
4398
+ if (!(wholeTagsConfig === null || wholeTagsConfig === void 0 ? void 0 : wholeTagsConfig.length) || !scenario)
4399
+ return;
4400
+ this.wholeTagsConfig = wholeTagsConfig;
4401
+ this.currentTagsConfig = currentTagsConfig;
4402
+ this.isMultipleDimension = isMultipleDimension;
4403
+ };
4404
+ ScenarioService.prototype.getTagsConfigByScenarioTags = function (scenarioTags, tagsConfig) {
4405
+ var scenarioTagsConfig = _.filter(tagsConfig, function (tagConfig) { return _.some(scenarioTags, function (scenarioTag) { return scenarioTag.toggle && scenarioTag.selectedTagSubType === tagConfig.options.sub_type; }); });
4406
+ return this.sortScenarioTags(scenarioTagsConfig);
4407
+ };
4408
+ ScenarioService.prototype.getScenarioTagsByScenario = function (scenario) {
4409
+ var _this = this;
4410
+ var scenarioTagsConfig = this.getScenarioTagsConfig(scenario, this.wholeTagsConfig);
4411
+ var scenarioTagsUi = [];
4412
+ _.forEach(scenarioTagsConfig, function (scenarioTag) {
4413
+ var isDateTag = scenarioTag.type === exports.TagTypes.DATE;
4414
+ var dateTag = isDateTag && _.find(scenarioTagsUi, { type: exports.TagTypes.DATE });
4415
+ var tag = dateTag || _this.prepareScenarioTag(scenarioTagsConfig, scenarioTag, scenario, isDateTag);
4416
+ if (isDateTag) {
4417
+ _this.updateScenarioDateTag(tag, scenarioTag);
4418
+ }
4419
+ if (dateTag)
4420
+ return;
4421
+ scenarioTagsUi.push(tag);
4422
+ });
4423
+ if (this.areExistingTagsConfig) {
4424
+ this.initExistingTagsConfig(scenario, scenarioTagsUi);
4425
+ }
4426
+ var isTagNotSupportingDates = _.some(scenarioTagsUi, { turnOffDateTags: true, toggle: true });
4427
+ if (isTagNotSupportingDates) {
4428
+ this.turnOffDateTag(scenarioTagsUi);
4429
+ }
4430
+ var tagWithSpecificDateTags = _.find(scenarioTagsUi, function (tag) { var _a; return tag.toggle && !!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length); });
4431
+ if (tagWithSpecificDateTags) {
4432
+ this.hideNotAvailableTags(tagWithSpecificDateTags, scenarioTagsUi);
4433
+ }
4434
+ return this.sortScenarioTags(scenarioTagsUi);
4435
+ };
4436
+ ScenarioService.prototype.sortScenarioTags = function (scenarioTagsUi) {
4437
+ return _.orderBy(scenarioTagsUi, [
4438
+ function (tag) { return (tag.type === exports.TagTypes.DATE ? 0 : 1); },
4439
+ function (tag) { return (tag.name === 'File Status'); }
4440
+ ]);
4441
+ };
4442
+ ScenarioService.prototype.initExistingTagsConfig = function (scenario, scenarioTagsUi) {
4443
+ var _this = this;
4444
+ _.forEach(this.currentTagsConfig, function (tagConfig) {
4445
+ var _a, _b;
4446
+ var tagSubType = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.options) === null || _a === void 0 ? void 0 : _a.sub_type;
4447
+ var scenarioTagDataConfig = getScenarioTagDataConfig(_this.isMultipleDimension);
4448
+ if (!((_b = scenarioTagDataConfig === null || scenarioTagDataConfig === void 0 ? void 0 : scenarioTagDataConfig[scenario]) === null || _b === void 0 ? void 0 : _b[tagSubType]))
4449
+ return;
4450
+ var scenarioTagUi = tagConfig.type === exports.TagTypes.DATE
4451
+ ? _.find(scenarioTagsUi, { type: tagConfig.type })
4452
+ : _.find(scenarioTagsUi, { selectedTagSubType: tagSubType });
4453
+ scenarioTagUi.toggle = true;
4454
+ scenarioTagUi.selectedTagSubType = tagSubType;
4455
+ });
4456
+ };
4457
+ ScenarioService.prototype.prepareScenarioTag = function (scenarioTagsConfig, scenarioTag, scenario, isDateTag) {
4458
+ var toggleStatus = isDateTag
4459
+ ? _.some(scenarioTagsConfig, function (tag) { return tag.type === exports.TagTypes.DATE && tag.scenarioData.toggle; })
4460
+ : scenarioTag.scenarioData.toggle;
4461
+ var selectedTagSubType = isDateTag
4462
+ ? this.getScenarioSelectedDateTag(scenario, scenarioTagsConfig)
4463
+ : scenarioTag.options.sub_type;
4464
+ var tag = {
4465
+ toggle: this.areExistingTagsConfig ? false : toggleStatus,
4466
+ name: scenarioTag.scenarioData.name || scenarioTag.name,
4467
+ description: scenarioTag.scenarioData.description || scenarioTag.description,
4468
+ type: scenarioTag.type,
4469
+ selectedTagSubType: selectedTagSubType,
4470
+ };
4471
+ if (scenarioTag.scenarioData.turnOffDateTags) {
4472
+ tag.turnOffDateTags = scenarioTag.scenarioData.turnOffDateTags;
4473
+ }
4474
+ if (scenarioTag.scenarioData.acceptableDateTags) {
4475
+ tag.acceptableDateTags = scenarioTag.scenarioData.acceptableDateTags;
4476
+ }
4477
+ return tag;
4478
+ };
4479
+ ScenarioService.prototype.updateScenarioDateTag = function (dateTag, scenarioTag) {
4480
+ if (!dateTag.subTags) {
4481
+ dateTag.subTags = [];
4482
+ }
4483
+ var tagSubType = scenarioTag.options.sub_type;
4484
+ dateTag.subTags.push({
4485
+ subType: tagSubType,
4486
+ name: tagSubType === TagsConfigSubType.FORECAST_NEW ? this.DEFAULT_FORECAST_DATE_TAG : scenarioTag.name,
4487
+ });
4488
+ };
4489
+ ScenarioService.prototype.turnOffDateTag = function (scenarioTags) {
4490
+ var dateTag = _.find(scenarioTags, { type: exports.TagTypes.DATE });
4491
+ if (!dateTag)
4492
+ return;
4493
+ dateTag.toggle = false;
4494
+ };
4495
+ ScenarioService.prototype.hideNotAvailableTags = function (tagWithSpecificDateTags, scenarioTags) {
4496
+ var _a;
4497
+ var subTags = (_a = _.find(scenarioTags, { type: exports.TagTypes.DATE })) === null || _a === void 0 ? void 0 : _a.subTags;
4498
+ if (!subTags.length)
4499
+ return;
4500
+ _.forEach(scenarioTags, function (tag) {
4501
+ var _a;
4502
+ if (!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length))
4503
+ return;
4504
+ if (tag !== tagWithSpecificDateTags) {
4505
+ tag.toggle = false;
4506
+ }
4507
+ });
4508
+ _.forEach(subTags, function (subTag) {
4509
+ subTag.hidden = !tagWithSpecificDateTags.acceptableDateTags.includes(subTag.subType);
4510
+ });
4511
+ };
4512
+ ScenarioService.prototype.getScenarioSelectedDateTag = function (scenario, dateTags) {
4513
+ var _c;
4514
+ var _a, _b;
4515
+ var monthSubType = (_b = (_a = _.find(dateTags, function (tag) { return tag.options.sub_type === TagsConfigSubType.MONTH; })) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type;
4516
+ var scenarioSelectedDateTag = (_c = {},
4517
+ _c[exports.Scenario.ACTUALS] = function () { return monthSubType; },
4518
+ _c[exports.Scenario.BUDGET] = function () { var _a, _b; return (_b = (_a = _.find(dateTags, function (tag) { return tag.options.sub_type === TagsConfigSubType.YEAR; })) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type; },
4519
+ _c[exports.Scenario.FORECAST] = function () { var _a, _b; return (_b = (_a = _.find(dateTags, function (tag) { return tag.options.sub_type === TagsConfigSubType.FORECAST_NEW; })) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type; },
4520
+ _c[exports.Scenario.NONE] = function () { return monthSubType; },
4521
+ _c);
4522
+ if (!scenarioSelectedDateTag[scenario])
4523
+ return;
4524
+ return scenarioSelectedDateTag[scenario]();
4525
+ };
4526
+ ScenarioService.prototype.getScenarioTagsConfig = function (scenario, tagsConfig) {
4527
+ var _this = this;
4528
+ return _.reduce(tagsConfig, function (acc, tagConfig) {
4529
+ var _a, _b;
4530
+ var tagSubType = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.options) === null || _a === void 0 ? void 0 : _a.sub_type;
4531
+ var scenarioTagDataConfig = getScenarioTagDataConfig(_this.isMultipleDimension);
4532
+ var scenarioTagConfig = (_b = scenarioTagDataConfig === null || scenarioTagDataConfig === void 0 ? void 0 : scenarioTagDataConfig[scenario]) === null || _b === void 0 ? void 0 : _b[tagSubType];
4533
+ if (!scenarioTagConfig || scenarioTagConfig.hidden)
4534
+ return acc;
4535
+ var clonedTagConfig = _.cloneDeep(tagConfig);
4536
+ var scenarioTag = Object.assign(Object.assign({}, clonedTagConfig), { scenarioData: scenarioTagConfig });
4537
+ acc.push(scenarioTag);
4538
+ return acc;
4539
+ }, []);
4540
+ };
4541
+ return ScenarioService;
4542
+ }());
4543
+ ScenarioService.decorators = [
4544
+ { type: i0.Injectable }
4545
+ ];
4546
+
4296
4547
  var DrSharedUtils = /** @class */ (function () {
4297
4548
  function DrSharedUtils() {
4298
4549
  }
@@ -6509,6 +6760,203 @@
6509
6760
  },] }
6510
6761
  ];
6511
6762
 
6763
+ var DrScenarioConfigurationComponent = /** @class */ (function () {
6764
+ function DrScenarioConfigurationComponent(scenarioService) {
6765
+ this.scenarioService = scenarioService;
6766
+ this.toggleButtonMode = exports.ToggleButtonMode;
6767
+ this._scenarioTags = [];
6768
+ this.wholeTagsConfig = [];
6769
+ this.selectedScenario = exports.Scenario.ACTUALS;
6770
+ this.isMultipleDimension = false;
6771
+ this.scenarioDataChanged = new i0.EventEmitter();
6772
+ }
6773
+ Object.defineProperty(DrScenarioConfigurationComponent.prototype, "scenarioTags", {
6774
+ get: function () {
6775
+ return this._scenarioTags;
6776
+ },
6777
+ set: function (tags) {
6778
+ this._scenarioTags = tags;
6779
+ this.tagNotSupportingDates = _.find(tags, { turnOffDateTags: true });
6780
+ },
6781
+ enumerable: false,
6782
+ configurable: true
6783
+ });
6784
+ Object.defineProperty(DrScenarioConfigurationComponent.prototype, "dateTag", {
6785
+ get: function () {
6786
+ return _.find(this.scenarioTags, { type: exports.TagTypes.DATE });
6787
+ },
6788
+ enumerable: false,
6789
+ configurable: true
6790
+ });
6791
+ DrScenarioConfigurationComponent.prototype.ngOnInit = function () {
6792
+ this.scenarios = this.scenarioService.scenarios;
6793
+ this.scenarioService.initScenarioTags(this.selectedScenario, this.wholeTagsConfig, this.currentTagsConfig, this.isMultipleDimension);
6794
+ this.scenarioTags = this.scenarioService.getScenarioTagsByScenario(this.selectedScenario);
6795
+ };
6796
+ DrScenarioConfigurationComponent.prototype.onScenarioChange = function (scenario) {
6797
+ this.scenarioTags = this.scenarioService.getScenarioTagsByScenario(scenario);
6798
+ this.onScenarioDataChange();
6799
+ };
6800
+ DrScenarioConfigurationComponent.prototype.onScenarioTagToggle = function (tag) {
6801
+ this.tagNotSupportingDatesHandler(tag);
6802
+ this.tagAcceptableDateHandler(tag);
6803
+ this.onScenarioDataChange();
6804
+ };
6805
+ DrScenarioConfigurationComponent.prototype.onScenarioDataChange = function () {
6806
+ this.scenarioDataChanged.emit({
6807
+ scenario: this.selectedScenario,
6808
+ tagsConfig: this.scenarioService.getTagsConfigByScenarioTags(this.scenarioTags, this.wholeTagsConfig),
6809
+ });
6810
+ };
6811
+ DrScenarioConfigurationComponent.prototype.tagNotSupportingDatesHandler = function (tag) {
6812
+ if (!this.tagNotSupportingDates || !tag.toggle)
6813
+ return;
6814
+ if (tag.type === exports.TagTypes.DATE) {
6815
+ this.tagNotSupportingDates.toggle = false;
6816
+ }
6817
+ if (tag === this.tagNotSupportingDates) {
6818
+ var dateTag = this.dateTag;
6819
+ if (dateTag) {
6820
+ dateTag.toggle = false;
6821
+ }
6822
+ }
6823
+ };
6824
+ DrScenarioConfigurationComponent.prototype.tagAcceptableDateHandler = function (tag) {
6825
+ var _a;
6826
+ if (!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length))
6827
+ return;
6828
+ var dateTag = this.dateTag;
6829
+ if (!dateTag)
6830
+ return;
6831
+ dateTag.subTags = _.map(dateTag.subTags, function (subTag) {
6832
+ subTag.hidden = tag.toggle && !_.includes(tag.acceptableDateTags, subTag.subType);
6833
+ return subTag;
6834
+ });
6835
+ dateTag.selectedTagSubType = tag.acceptableDateTags[0];
6836
+ };
6837
+ return DrScenarioConfigurationComponent;
6838
+ }());
6839
+ DrScenarioConfigurationComponent.decorators = [
6840
+ { type: i0.Component, args: [{
6841
+ selector: 'dr-scenario-configuration',
6842
+ 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 [mode]=\"toggleButtonMode.DOTTED\"\n (ngModelChange)=\"onScenarioDataChange()\"></dr-toggle-button>\n </div>\n </div>\n </div>\n </div>\n</div>\n",
6843
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
6844
+ providers: [ScenarioService],
6845
+ 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"]
6846
+ },] }
6847
+ ];
6848
+ DrScenarioConfigurationComponent.ctorParameters = function () { return [
6849
+ { type: ScenarioService }
6850
+ ]; };
6851
+ DrScenarioConfigurationComponent.propDecorators = {
6852
+ currentTagsConfig: [{ type: i0.Input }],
6853
+ wholeTagsConfig: [{ type: i0.Input }],
6854
+ selectedScenario: [{ type: i0.Input }],
6855
+ isMultipleDimension: [{ type: i0.Input }],
6856
+ scenarioDataChanged: [{ type: i0.Output }]
6857
+ };
6858
+
6859
+ var DrScenarioTagConfigurationComponent = /** @class */ (function () {
6860
+ function DrScenarioTagConfigurationComponent() {
6861
+ this.connectedTags = {};
6862
+ this.dynamicTagValues = {};
6863
+ this.lockedDates = [];
6864
+ this.scenarioTagDataChanged = new i0.EventEmitter();
6865
+ this.currentTagsMap = {};
6866
+ this._currentTags = [];
6867
+ this.dynamicTagsToSave = [];
6868
+ this.tagsToSave = [];
6869
+ }
6870
+ Object.defineProperty(DrScenarioTagConfigurationComponent.prototype, "currentTags", {
6871
+ get: function () {
6872
+ return this._currentTags;
6873
+ },
6874
+ set: function (tags) {
6875
+ var _this = this;
6876
+ this._currentTags = tags;
6877
+ this.currentTagsMap = _.reduce(tags, function (acc, curr) {
6878
+ var _a;
6879
+ var tagId = (_a = _.find(_this.tagsConfig, { name: curr.name })) === null || _a === void 0 ? void 0 : _a.id;
6880
+ if (isNaN(tagId))
6881
+ return acc;
6882
+ acc[tagId] = curr;
6883
+ return acc;
6884
+ }, {});
6885
+ },
6886
+ enumerable: false,
6887
+ configurable: true
6888
+ });
6889
+ DrScenarioTagConfigurationComponent.prototype.ngOnChanges = function (simpleChanges) {
6890
+ this.currentTags = this.currentTags;
6891
+ };
6892
+ DrScenarioTagConfigurationComponent.prototype.onTagChange = function ($event) {
6893
+ var savedTag = _.find(this.tagsToSave, { id: $event.id });
6894
+ if (savedTag) {
6895
+ _.merge(savedTag, $event);
6896
+ }
6897
+ else {
6898
+ this.tagsToSave.push($event);
6899
+ }
6900
+ this.onScenarioTagDataChanged();
6901
+ };
6902
+ DrScenarioTagConfigurationComponent.prototype.onDynamicTagsChange = function ($event) {
6903
+ this.dynamicTagsToSave = $event;
6904
+ this.onScenarioTagDataChanged();
6905
+ };
6906
+ DrScenarioTagConfigurationComponent.prototype.onScenarioTagDataChanged = function () {
6907
+ var tags = __spreadArray(__spreadArray([], __read(this.dynamicTagsToSave)), __read(this.tagsToSave));
6908
+ this.scenarioTagDataChanged.emit({
6909
+ scenario: this.scenario,
6910
+ tagsConfig: this.tagsConfig,
6911
+ tags: tags,
6912
+ });
6913
+ };
6914
+ return DrScenarioTagConfigurationComponent;
6915
+ }());
6916
+ DrScenarioTagConfigurationComponent.decorators = [
6917
+ { type: i0.Component, args: [{
6918
+ selector: 'dr-scenario-tag-configuration',
6919
+ 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",
6920
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
6921
+ styles: [".scenario-tag-configuration{margin-bottom:24px}.scenario-tag-configuration:last-child{margin-bottom:0}\n"]
6922
+ },] }
6923
+ ];
6924
+ DrScenarioTagConfigurationComponent.propDecorators = {
6925
+ tagsConfig: [{ type: i0.Input }],
6926
+ currentTags: [{ type: i0.Input }],
6927
+ scenario: [{ type: i0.Input }],
6928
+ connectedTags: [{ type: i0.Input }],
6929
+ dynamicTagValues: [{ type: i0.Input }],
6930
+ lockedDates: [{ type: i0.Input }],
6931
+ fiscalYearStartsFrom: [{ type: i0.Input }],
6932
+ fiscalYearBack: [{ type: i0.Input }],
6933
+ isDynamicAddEnabled: [{ type: i0.Input }],
6934
+ scenarioTagDataChanged: [{ type: i0.Output }]
6935
+ };
6936
+
6937
+ var COMPONENTS = [
6938
+ DrScenarioConfigurationComponent,
6939
+ DrScenarioTagConfigurationComponent,
6940
+ ];
6941
+ var DrScenarioModule = /** @class */ (function () {
6942
+ function DrScenarioModule() {
6943
+ }
6944
+ return DrScenarioModule;
6945
+ }());
6946
+ DrScenarioModule.decorators = [
6947
+ { type: i0.NgModule, args: [{
6948
+ declarations: __spreadArray([], __read(COMPONENTS)),
6949
+ providers: [ScenarioService],
6950
+ imports: [
6951
+ common.CommonModule,
6952
+ DrInputsModule,
6953
+ forms.FormsModule,
6954
+ DrTagModule
6955
+ ],
6956
+ exports: __spreadArray([], __read(COMPONENTS)),
6957
+ },] }
6958
+ ];
6959
+
6512
6960
  /* components */
6513
6961
 
6514
6962
  /**
@@ -6556,6 +7004,7 @@
6556
7004
  exports.DrPopoverModule = DrPopoverModule;
6557
7005
  exports.DrPopoverRef = DrPopoverRef;
6558
7006
  exports.DrPopoverService = DrPopoverService;
7007
+ exports.DrScenarioModule = DrScenarioModule;
6559
7008
  exports.DrSelectComponent = DrSelectComponent;
6560
7009
  exports.DrSharedUtils = DrSharedUtils;
6561
7010
  exports.DrSpinnerComponent = DrSpinnerComponent;
@@ -6579,11 +7028,14 @@
6579
7028
  exports.QuarterTagComponent = QuarterTagComponent;
6580
7029
  exports.RadioButtonComponent = RadioButtonComponent;
6581
7030
  exports.RadioGroupComponent = RadioGroupComponent;
7031
+ exports.ScenarioService = ScenarioService;
6582
7032
  exports.TooltipComponent = TooltipComponent;
6583
7033
  exports.WeekTagComponent = WeekTagComponent;
6584
7034
  exports.YearTagComponent = YearTagComponent;
6585
7035
  exports["ɵa"] = components$2;
6586
7036
  exports["ɵb"] = POPUP_ANIMATION;
7037
+ exports["ɵba"] = DrScenarioConfigurationComponent;
7038
+ exports["ɵbb"] = DrScenarioTagConfigurationComponent;
6587
7039
  exports["ɵc"] = DrDatePickerComponent;
6588
7040
  exports["ɵd"] = DrDatePickerService;
6589
7041
  exports["ɵe"] = DrDatePickerWithTimeframeComponent;