@datarailsshared/datarailsshared 1.4.163-rocket → 1.4.164-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 (35) hide show
  1. package/bundles/datarailsshared-datarailsshared.umd.js +492 -28
  2. package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
  3. package/datarailsshared-datarailsshared-1.4.164-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/dr-toggle-button/dr-toggle-button.component.js +8 -3
  11. package/esm2015/lib/dr-inputs/dr-toggle-button/toggle-button-theme.js +6 -0
  12. package/esm2015/lib/dr-scenario/components/dr-scenario-configuration/dr-scenario-configuration.component.js +87 -0
  13. package/esm2015/lib/dr-scenario/components/dr-scenario-tag-configuration/dr-scenario-tag-configuration.component.js +74 -0
  14. package/esm2015/lib/dr-scenario/consts/scenario-tags-config.js +73 -0
  15. package/esm2015/lib/dr-scenario/dr-scenario.module.js +28 -0
  16. package/esm2015/lib/dr-scenario/interfaces/scenario.js +8 -0
  17. package/esm2015/lib/dr-scenario/services/scenario.service.js +160 -0
  18. package/esm2015/lib/dr-tags/dr-tag.component.js +17 -5
  19. package/esm2015/lib/models/serverTags.js +13 -1
  20. package/esm2015/public-api.js +6 -1
  21. package/fesm2015/datarailsshared-datarailsshared.js +455 -29
  22. package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
  23. package/lib/dr-inputs/dr-toggle-button/dr-toggle-button.component.d.ts +3 -0
  24. package/lib/dr-inputs/dr-toggle-button/toggle-button-theme.d.ts +4 -0
  25. package/lib/dr-scenario/components/dr-scenario-configuration/dr-scenario-configuration.component.d.ts +25 -0
  26. package/lib/dr-scenario/components/dr-scenario-tag-configuration/dr-scenario-tag-configuration.component.d.ts +26 -0
  27. package/lib/dr-scenario/consts/scenario-tags-config.d.ts +24 -0
  28. package/lib/dr-scenario/dr-scenario.module.d.ts +2 -0
  29. package/lib/dr-scenario/interfaces/scenario.d.ts +43 -0
  30. package/lib/dr-scenario/services/scenario.service.d.ts +21 -0
  31. package/lib/dr-tags/dr-tag.component.d.ts +7 -3
  32. package/lib/models/serverTags.d.ts +15 -1
  33. package/package.json +1 -1
  34. package/public-api.d.ts +5 -1
  35. package/datarailsshared-datarailsshared-1.4.163-rocket.tgz +0 -0
@@ -612,13 +612,8 @@
612
612
  configurable: true
613
613
  });
614
614
  MonthTagComponent.prototype.initDate = function () {
615
- if (this.defaultValue) {
616
- this.date = this.defaultValue;
617
- this.dateObj.date = this.date;
618
- }
619
- else {
620
- this.dateObj.date = moment$7().unix();
621
- }
615
+ this.date = this.defaultValue || moment$7().unix();
616
+ this.dateObj.date = this.date;
622
617
  };
623
618
  MonthTagComponent.prototype.initName = function () {
624
619
  if (!this.name) {
@@ -907,13 +902,8 @@
907
902
  configurable: true
908
903
  });
909
904
  YearTagComponent.prototype.initDate = function () {
910
- if (this.defaultValue) {
911
- this.date = this.defaultValue;
912
- this.dateObj.date = this.date;
913
- }
914
- else {
915
- this.dateObj.date = moment$4().unix();
916
- }
905
+ this.date = this.defaultValue || moment$4().unix();
906
+ this.dateObj.date = this.date;
917
907
  };
918
908
  YearTagComponent.prototype.initName = function () {
919
909
  if (!this.name) {
@@ -970,30 +960,52 @@
970
960
  TagTypes["LIST"] = "LIST";
971
961
  TagTypes["DATE"] = "DATE";
972
962
  })(exports.TagTypes || (exports.TagTypes = {}));
963
+ var TagsConfigSubType;
964
+ (function (TagsConfigSubType) {
965
+ TagsConfigSubType["YEAR"] = "year";
966
+ TagsConfigSubType["PLAN"] = "plan";
967
+ TagsConfigSubType["BUDGET_CYCLE"] = "budget cycle";
968
+ TagsConfigSubType["MONTH"] = "month";
969
+ TagsConfigSubType["WEEK"] = "week";
970
+ TagsConfigSubType["DAY"] = "day";
971
+ TagsConfigSubType["FORECAST_NEW"] = "forecast_new";
972
+ TagsConfigSubType["QUARTER"] = "quarter";
973
+ TagsConfigSubType["FILE_STATUS"] = "file_status";
974
+ })(TagsConfigSubType || (TagsConfigSubType = {}));
973
975
 
974
976
  var DrTagComponent = /** @class */ (function () {
975
977
  function DrTagComponent() {
976
978
  this.lockedDate = [];
977
979
  this.dynamicTagValues = {};
978
- this.connectedTags = [];
979
980
  this.tagChange = new i0.EventEmitter(); // Not emit value for dynamic tag
980
981
  this.dynamicTagChange = new i0.EventEmitter();
981
982
  this.dynamicTagAdd = new i0.EventEmitter();
982
983
  this.currentTagConnectedToDynamic = false;
983
984
  this.tagTypes = exports.TagTypes;
984
985
  this.connectedTagsValues = [];
986
+ this._connectedTags = [];
985
987
  this.selectedTag = {
986
988
  id: 0,
987
989
  value: undefined,
988
990
  name: ''
989
991
  };
990
992
  }
993
+ Object.defineProperty(DrTagComponent.prototype, "connectedTags", {
994
+ get: function () {
995
+ return this._connectedTags;
996
+ },
997
+ set: function (tags) {
998
+ this._connectedTags = tags || [];
999
+ },
1000
+ enumerable: false,
1001
+ configurable: true
1002
+ });
1003
+ DrTagComponent.prototype.ngOnChanges = function () {
1004
+ this.calculateDynamicTag();
1005
+ };
991
1006
  DrTagComponent.prototype.ngOnInit = function () {
992
- var _this = this;
993
1007
  var _a, _b;
994
- this.currentTagDynamic = this.tagConfig.options.is_custom;
995
- this.currentTagConnectedToDynamic = _.some(this.tagsConfig, function (tagConfig) { return tagConfig.options.is_custom
996
- && ['year'].includes(_this.tagConfig.options.sub_type); });
1008
+ this.calculateDynamicTag();
997
1009
  this.dateTag = {
998
1010
  type: this.tagConfig.type,
999
1011
  sub_type: this.tagConfig.options.sub_type,
@@ -1108,6 +1120,12 @@
1108
1120
  }
1109
1121
  });
1110
1122
  };
1123
+ DrTagComponent.prototype.calculateDynamicTag = function () {
1124
+ var _this = this;
1125
+ this.currentTagDynamic = this.tagConfig.options.is_custom;
1126
+ this.currentTagConnectedToDynamic = _.some(this.tagsConfig, function (tagConfig) { return tagConfig.options.is_custom
1127
+ && ['year'].includes(_this.tagConfig.options.sub_type); });
1128
+ };
1111
1129
  return DrTagComponent;
1112
1130
  }());
1113
1131
  DrTagComponent.decorators = [
@@ -1201,13 +1219,8 @@
1201
1219
  configurable: true
1202
1220
  });
1203
1221
  DayTagComponent.prototype.initDate = function () {
1204
- if (this.defaultValue) {
1205
- this.date = this.defaultValue;
1206
- this.dateObj.date = this.date;
1207
- }
1208
- else {
1209
- this.dateObj.date = moment$3().unix();
1210
- }
1222
+ this.date = this.defaultValue || moment$3().unix();
1223
+ this.dateObj.date = this.date;
1211
1224
  };
1212
1225
  DayTagComponent.prototype.initName = function () {
1213
1226
  if (!this.name) {
@@ -2443,12 +2456,20 @@
2443
2456
  elementClass: [{ type: i0.HostBinding, args: ['class',] }]
2444
2457
  };
2445
2458
 
2459
+ exports.ToggleButtonTheme = void 0;
2460
+ (function (ToggleButtonTheme) {
2461
+ ToggleButtonTheme["DEFAULT"] = "default";
2462
+ ToggleButtonTheme["DOTTED"] = "dotted";
2463
+ })(exports.ToggleButtonTheme || (exports.ToggleButtonTheme = {}));
2464
+
2446
2465
  var DrToggleButtonComponent = /** @class */ (function () {
2447
2466
  function DrToggleButtonComponent(cdr) {
2448
2467
  this.cdr = cdr;
2449
2468
  this._disabled = false;
2450
2469
  this.bindLabel = null;
2451
2470
  this.bindValue = null;
2471
+ this.bindHidden = null;
2472
+ this.theme = exports.ToggleButtonTheme.DEFAULT;
2452
2473
  this.onChange = function () {
2453
2474
  };
2454
2475
  this.onTouched = function () {
@@ -2485,12 +2506,12 @@
2485
2506
  DrToggleButtonComponent.decorators = [
2486
2507
  { type: i0.Component, args: [{
2487
2508
  selector: 'dr-toggle-button',
2488
- 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",
2509
+ 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",
2489
2510
  providers: [
2490
2511
  { provide: forms.NG_VALUE_ACCESSOR, useExisting: i0.forwardRef(function () { return DrToggleButtonComponent; }), multi: true }
2491
2512
  ],
2492
2513
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
2493
- 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"]
2514
+ 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"]
2494
2515
  },] }
2495
2516
  ];
2496
2517
  DrToggleButtonComponent.ctorParameters = function () { return [
@@ -2500,6 +2521,8 @@
2500
2521
  items: [{ type: i0.Input }],
2501
2522
  bindLabel: [{ type: i0.Input }],
2502
2523
  bindValue: [{ type: i0.Input }],
2524
+ bindHidden: [{ type: i0.Input }],
2525
+ theme: [{ type: i0.Input }],
2503
2526
  selectedValue: [{ type: i0.Input }],
2504
2527
  disabled: [{ type: i0.Input }]
2505
2528
  };
@@ -4200,6 +4223,14 @@
4200
4223
  TooltipPosition["LEFT_BOTTOM"] = "left-bottom";
4201
4224
  })(exports.TooltipPosition || (exports.TooltipPosition = {}));
4202
4225
 
4226
+ exports.Scenario = void 0;
4227
+ (function (Scenario) {
4228
+ Scenario["ACTUALS"] = "Actuals";
4229
+ Scenario["FORECAST"] = "Forecast";
4230
+ Scenario["BUDGET"] = "Budget";
4231
+ Scenario["NONE"] = "None";
4232
+ })(exports.Scenario || (exports.Scenario = {}));
4233
+
4203
4234
  var DrModelDebounceChangeDirective = /** @class */ (function () {
4204
4235
  function DrModelDebounceChangeDirective(ngModel) {
4205
4236
  this.ngModel = ngModel;
@@ -4265,6 +4296,248 @@
4265
4296
  return ChatMessage;
4266
4297
  }());
4267
4298
 
4299
+ var _a;
4300
+ var allDateTags = (_a = {},
4301
+ _a[TagsConfigSubType.YEAR] = {
4302
+ name: 'Date',
4303
+ toggle: false,
4304
+ },
4305
+ _a[TagsConfigSubType.QUARTER] = {
4306
+ name: 'Date',
4307
+ toggle: false,
4308
+ },
4309
+ _a[TagsConfigSubType.MONTH] = {
4310
+ name: 'Date',
4311
+ toggle: false,
4312
+ },
4313
+ _a[TagsConfigSubType.DAY] = {
4314
+ name: 'Date',
4315
+ toggle: false,
4316
+ },
4317
+ _a[TagsConfigSubType.WEEK] = {
4318
+ name: 'Date',
4319
+ toggle: false,
4320
+ },
4321
+ _a);
4322
+ function getScenarioTagDataConfig(isMultipleDimension) {
4323
+ var _a, _b, _c, _d, _e;
4324
+ return _a = {},
4325
+ _a[exports.Scenario.ACTUALS] = Object.assign(Object.assign({}, allDateTags), (_b = {}, _b[TagsConfigSubType.MONTH] = {
4326
+ name: 'Date',
4327
+ toggle: true,
4328
+ }, _b[TagsConfigSubType.FILE_STATUS] = {
4329
+ toggle: false,
4330
+ }, _b)),
4331
+ _a[exports.Scenario.BUDGET] = (_c = {},
4332
+ _c[TagsConfigSubType.BUDGET_CYCLE] = {
4333
+ toggle: true,
4334
+ acceptableDateTags: [TagsConfigSubType.YEAR],
4335
+ hidden: !isMultipleDimension,
4336
+ },
4337
+ _c[TagsConfigSubType.PLAN] = {
4338
+ toggle: false,
4339
+ turnOffDateTags: true,
4340
+ hidden: isMultipleDimension,
4341
+ },
4342
+ _c[TagsConfigSubType.YEAR] = {
4343
+ name: 'Date',
4344
+ toggle: true,
4345
+ },
4346
+ _c[TagsConfigSubType.QUARTER] = {
4347
+ name: 'Date',
4348
+ toggle: false,
4349
+ },
4350
+ _c[TagsConfigSubType.FILE_STATUS] = {
4351
+ toggle: false,
4352
+ },
4353
+ _c),
4354
+ _a[exports.Scenario.FORECAST] = (_d = {},
4355
+ _d[TagsConfigSubType.FORECAST_NEW] = {
4356
+ toggle: true,
4357
+ name: 'Date',
4358
+ },
4359
+ _d[TagsConfigSubType.FILE_STATUS] = {
4360
+ toggle: false,
4361
+ },
4362
+ _d),
4363
+ _a[exports.Scenario.NONE] = Object.assign(Object.assign({}, allDateTags), (_e = {}, _e[TagsConfigSubType.MONTH] = {
4364
+ name: 'Date',
4365
+ toggle: true,
4366
+ }, _e[TagsConfigSubType.FILE_STATUS] = {
4367
+ toggle: true,
4368
+ }, _e)),
4369
+ _a;
4370
+ }
4371
+
4372
+ var ScenarioService = /** @class */ (function () {
4373
+ function ScenarioService() {
4374
+ this.DEFAULT_FORECAST_DATE_TAG = 'Month';
4375
+ }
4376
+ Object.defineProperty(ScenarioService.prototype, "scenarios", {
4377
+ get: function () {
4378
+ return _.orderBy(Object.values(exports.Scenario), function (scenario) { return scenario === exports.Scenario.NONE ? 1 : 0; });
4379
+ },
4380
+ enumerable: false,
4381
+ configurable: true
4382
+ });
4383
+ Object.defineProperty(ScenarioService.prototype, "areExistingTagsConfig", {
4384
+ get: function () {
4385
+ return !!this.currentTagsConfig;
4386
+ },
4387
+ enumerable: false,
4388
+ configurable: true
4389
+ });
4390
+ ScenarioService.prototype.initScenarioTags = function (scenario, wholeTagsConfig, currentTagsConfig, isMultipleDimension) {
4391
+ if (isMultipleDimension === void 0) { isMultipleDimension = true; }
4392
+ if (!(wholeTagsConfig === null || wholeTagsConfig === void 0 ? void 0 : wholeTagsConfig.length) || !scenario)
4393
+ return;
4394
+ this.wholeTagsConfig = wholeTagsConfig;
4395
+ this.currentTagsConfig = currentTagsConfig;
4396
+ this.isMultipleDimension = isMultipleDimension;
4397
+ };
4398
+ ScenarioService.prototype.getTagsConfigByScenarioTags = function (scenarioTags, tagsConfig) {
4399
+ var scenarioTagsConfig = _.filter(tagsConfig, function (tagConfig) { return _.some(scenarioTags, function (scenarioTag) { return scenarioTag.toggle && scenarioTag.selectedTagSubType === tagConfig.options.sub_type; }); });
4400
+ return this.sortScenarioTags(scenarioTagsConfig);
4401
+ };
4402
+ ScenarioService.prototype.getScenarioTagsByScenario = function (scenario) {
4403
+ var _this = this;
4404
+ var scenarioTagsConfig = this.getScenarioTagsConfig(scenario, this.wholeTagsConfig);
4405
+ var scenarioTagsUi = [];
4406
+ _.forEach(scenarioTagsConfig, function (scenarioTag) {
4407
+ var isDateTag = scenarioTag.type === exports.TagTypes.DATE;
4408
+ var dateTag = isDateTag && _.find(scenarioTagsUi, { type: exports.TagTypes.DATE });
4409
+ var tag = dateTag || _this.prepareScenarioTag(scenarioTagsConfig, scenarioTag, scenario, isDateTag);
4410
+ if (isDateTag) {
4411
+ _this.updateScenarioDateTag(tag, scenarioTag);
4412
+ }
4413
+ if (dateTag)
4414
+ return;
4415
+ scenarioTagsUi.push(tag);
4416
+ });
4417
+ if (this.areExistingTagsConfig) {
4418
+ this.initExistingTagsConfig(scenario, scenarioTagsUi);
4419
+ }
4420
+ var isTagNotSupportingDates = _.some(scenarioTagsUi, { turnOffDateTags: true, toggle: true });
4421
+ if (isTagNotSupportingDates) {
4422
+ this.turnOffDateTag(scenarioTagsUi);
4423
+ }
4424
+ var tagWithSpecificDateTags = _.find(scenarioTagsUi, function (tag) { var _a; return tag.toggle && !!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length); });
4425
+ if (tagWithSpecificDateTags) {
4426
+ this.hideNotAvailableTags(tagWithSpecificDateTags, scenarioTagsUi);
4427
+ }
4428
+ return this.sortScenarioTags(scenarioTagsUi);
4429
+ };
4430
+ ScenarioService.prototype.sortScenarioTags = function (scenarioTagsUi) {
4431
+ return _.orderBy(scenarioTagsUi, [
4432
+ function (tag) { return (tag.type === exports.TagTypes.DATE ? 0 : 1); },
4433
+ function (tag) { return (tag.name === 'File Status'); }
4434
+ ]);
4435
+ };
4436
+ ScenarioService.prototype.initExistingTagsConfig = function (scenario, scenarioTagsUi) {
4437
+ var _this = this;
4438
+ _.forEach(this.currentTagsConfig, function (tagConfig) {
4439
+ var _a, _b;
4440
+ var tagSubType = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.options) === null || _a === void 0 ? void 0 : _a.sub_type;
4441
+ var scenarioTagDataConfig = getScenarioTagDataConfig(_this.isMultipleDimension);
4442
+ if (!((_b = scenarioTagDataConfig === null || scenarioTagDataConfig === void 0 ? void 0 : scenarioTagDataConfig[scenario]) === null || _b === void 0 ? void 0 : _b[tagSubType]))
4443
+ return;
4444
+ var scenarioTagUi = tagConfig.type === exports.TagTypes.DATE
4445
+ ? _.find(scenarioTagsUi, { type: tagConfig.type })
4446
+ : _.find(scenarioTagsUi, { selectedTagSubType: tagSubType });
4447
+ scenarioTagUi.toggle = true;
4448
+ scenarioTagUi.selectedTagSubType = tagSubType;
4449
+ });
4450
+ };
4451
+ ScenarioService.prototype.prepareScenarioTag = function (scenarioTagsConfig, scenarioTag, scenario, isDateTag) {
4452
+ var toggleStatus = isDateTag
4453
+ ? _.some(scenarioTagsConfig, function (tag) { return tag.type === exports.TagTypes.DATE && tag.scenarioData.toggle; })
4454
+ : scenarioTag.scenarioData.toggle;
4455
+ var selectedTagSubType = isDateTag
4456
+ ? this.getScenarioSelectedDateTag(scenario, scenarioTagsConfig)
4457
+ : scenarioTag.options.sub_type;
4458
+ var tag = {
4459
+ toggle: this.areExistingTagsConfig ? false : toggleStatus,
4460
+ name: scenarioTag.scenarioData.name || scenarioTag.name,
4461
+ description: scenarioTag.scenarioData.description || scenarioTag.description,
4462
+ type: scenarioTag.type,
4463
+ selectedTagSubType: selectedTagSubType,
4464
+ };
4465
+ if (scenarioTag.scenarioData.turnOffDateTags) {
4466
+ tag.turnOffDateTags = scenarioTag.scenarioData.turnOffDateTags;
4467
+ }
4468
+ if (scenarioTag.scenarioData.acceptableDateTags) {
4469
+ tag.acceptableDateTags = scenarioTag.scenarioData.acceptableDateTags;
4470
+ }
4471
+ return tag;
4472
+ };
4473
+ ScenarioService.prototype.updateScenarioDateTag = function (dateTag, scenarioTag) {
4474
+ if (!dateTag.subTags) {
4475
+ dateTag.subTags = [];
4476
+ }
4477
+ var tagSubType = scenarioTag.options.sub_type;
4478
+ dateTag.subTags.push({
4479
+ subType: tagSubType,
4480
+ name: tagSubType === TagsConfigSubType.FORECAST_NEW ? this.DEFAULT_FORECAST_DATE_TAG : scenarioTag.name,
4481
+ });
4482
+ };
4483
+ ScenarioService.prototype.turnOffDateTag = function (scenarioTags) {
4484
+ var dateTag = _.find(scenarioTags, { type: exports.TagTypes.DATE });
4485
+ if (!dateTag)
4486
+ return;
4487
+ dateTag.toggle = false;
4488
+ };
4489
+ ScenarioService.prototype.hideNotAvailableTags = function (tagWithSpecificDateTags, scenarioTags) {
4490
+ var _a;
4491
+ var subTags = (_a = _.find(scenarioTags, { type: exports.TagTypes.DATE })) === null || _a === void 0 ? void 0 : _a.subTags;
4492
+ if (!subTags.length)
4493
+ return;
4494
+ _.forEach(scenarioTags, function (tag) {
4495
+ var _a;
4496
+ if (!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length))
4497
+ return;
4498
+ if (tag !== tagWithSpecificDateTags) {
4499
+ tag.toggle = false;
4500
+ }
4501
+ });
4502
+ _.forEach(subTags, function (subTag) {
4503
+ subTag.hidden = !tagWithSpecificDateTags.acceptableDateTags.includes(subTag.subType);
4504
+ });
4505
+ };
4506
+ ScenarioService.prototype.getScenarioSelectedDateTag = function (scenario, dateTags) {
4507
+ var _c;
4508
+ var _a, _b;
4509
+ 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;
4510
+ var scenarioSelectedDateTag = (_c = {},
4511
+ _c[exports.Scenario.ACTUALS] = function () { return monthSubType; },
4512
+ _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; },
4513
+ _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; },
4514
+ _c[exports.Scenario.NONE] = function () { return monthSubType; },
4515
+ _c);
4516
+ if (!scenarioSelectedDateTag[scenario])
4517
+ return;
4518
+ return scenarioSelectedDateTag[scenario]();
4519
+ };
4520
+ ScenarioService.prototype.getScenarioTagsConfig = function (scenario, tagsConfig) {
4521
+ var _this = this;
4522
+ return _.reduce(tagsConfig, function (acc, tagConfig) {
4523
+ var _a, _b;
4524
+ var tagSubType = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.options) === null || _a === void 0 ? void 0 : _a.sub_type;
4525
+ var scenarioTagDataConfig = getScenarioTagDataConfig(_this.isMultipleDimension);
4526
+ var scenarioTagConfig = (_b = scenarioTagDataConfig === null || scenarioTagDataConfig === void 0 ? void 0 : scenarioTagDataConfig[scenario]) === null || _b === void 0 ? void 0 : _b[tagSubType];
4527
+ if (!scenarioTagConfig || scenarioTagConfig.hidden)
4528
+ return acc;
4529
+ var clonedTagConfig = _.cloneDeep(tagConfig);
4530
+ var scenarioTag = Object.assign(Object.assign({}, clonedTagConfig), { scenarioData: scenarioTagConfig });
4531
+ acc.push(scenarioTag);
4532
+ return acc;
4533
+ }, []);
4534
+ };
4535
+ return ScenarioService;
4536
+ }());
4537
+ ScenarioService.decorators = [
4538
+ { type: i0.Injectable }
4539
+ ];
4540
+
4268
4541
  var DrSharedUtils = /** @class */ (function () {
4269
4542
  function DrSharedUtils() {
4270
4543
  }
@@ -6479,6 +6752,193 @@
6479
6752
  },] }
6480
6753
  ];
6481
6754
 
6755
+ var DrScenarioConfigurationComponent = /** @class */ (function () {
6756
+ function DrScenarioConfigurationComponent(scenarioService) {
6757
+ this.scenarioService = scenarioService;
6758
+ this.toggleButtonTheme = exports.ToggleButtonTheme;
6759
+ this._scenarioTags = [];
6760
+ this.wholeTagsConfig = [];
6761
+ this.selectedScenario = exports.Scenario.ACTUALS;
6762
+ this.scenarioDataChanged = new i0.EventEmitter();
6763
+ }
6764
+ Object.defineProperty(DrScenarioConfigurationComponent.prototype, "scenarioTags", {
6765
+ get: function () {
6766
+ return this._scenarioTags;
6767
+ },
6768
+ set: function (tags) {
6769
+ this._scenarioTags = tags;
6770
+ this.tagNotSupportingDates = _.find(tags, { turnOffDateTags: true });
6771
+ },
6772
+ enumerable: false,
6773
+ configurable: true
6774
+ });
6775
+ DrScenarioConfigurationComponent.prototype.ngOnInit = function () {
6776
+ this.scenarios = this.scenarioService.scenarios;
6777
+ this.scenarioService.initScenarioTags(this.selectedScenario, this.wholeTagsConfig, this.currentTagsConfig);
6778
+ this.scenarioTags = this.scenarioService.getScenarioTagsByScenario(this.selectedScenario);
6779
+ };
6780
+ DrScenarioConfigurationComponent.prototype.onScenarioChange = function (scenario) {
6781
+ this.scenarioTags = this.scenarioService.getScenarioTagsByScenario(scenario);
6782
+ this.onScenarioDataChange();
6783
+ };
6784
+ DrScenarioConfigurationComponent.prototype.onScenarioTagToggle = function (tag) {
6785
+ this.tagNotSupportingDatesHandler(tag);
6786
+ this.tagAcceptableDateHandler(tag);
6787
+ this.onScenarioDataChange();
6788
+ };
6789
+ DrScenarioConfigurationComponent.prototype.onScenarioDataChange = function () {
6790
+ this.scenarioDataChanged.emit({
6791
+ scenario: this.selectedScenario,
6792
+ tagsConfig: this.scenarioService.getTagsConfigByScenarioTags(this.scenarioTags, this.wholeTagsConfig),
6793
+ });
6794
+ };
6795
+ DrScenarioConfigurationComponent.prototype.tagNotSupportingDatesHandler = function (tag) {
6796
+ if (!this.tagNotSupportingDates || !tag.toggle)
6797
+ return;
6798
+ if (tag.type === exports.TagTypes.DATE) {
6799
+ this.tagNotSupportingDates.toggle = false;
6800
+ }
6801
+ if (tag === this.tagNotSupportingDates) {
6802
+ var dateTag = _.find(this.scenarioTags, { type: exports.TagTypes.DATE });
6803
+ if (dateTag) {
6804
+ dateTag.toggle = false;
6805
+ }
6806
+ }
6807
+ };
6808
+ DrScenarioConfigurationComponent.prototype.tagAcceptableDateHandler = function (tag) {
6809
+ var _a;
6810
+ if (!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length))
6811
+ return;
6812
+ var dateTag = _.find(this.scenarioTags, { type: exports.TagTypes.DATE });
6813
+ if (!dateTag)
6814
+ return;
6815
+ dateTag.subTags = _.map(dateTag.subTags, function (subTag) {
6816
+ subTag.hidden = tag.toggle && !_.includes(tag.acceptableDateTags, subTag.subType);
6817
+ return subTag;
6818
+ });
6819
+ dateTag.selectedTagSubType = tag.acceptableDateTags[0];
6820
+ };
6821
+ return DrScenarioConfigurationComponent;
6822
+ }());
6823
+ DrScenarioConfigurationComponent.decorators = [
6824
+ { type: i0.Component, args: [{
6825
+ selector: 'dr-scenario-configuration',
6826
+ 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",
6827
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
6828
+ 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"]
6829
+ },] }
6830
+ ];
6831
+ DrScenarioConfigurationComponent.ctorParameters = function () { return [
6832
+ { type: ScenarioService }
6833
+ ]; };
6834
+ DrScenarioConfigurationComponent.propDecorators = {
6835
+ currentTagsConfig: [{ type: i0.Input }],
6836
+ wholeTagsConfig: [{ type: i0.Input }],
6837
+ selectedScenario: [{ type: i0.Input }],
6838
+ scenarioDataChanged: [{ type: i0.Output }]
6839
+ };
6840
+
6841
+ var DrScenarioTagConfigurationComponent = /** @class */ (function () {
6842
+ function DrScenarioTagConfigurationComponent() {
6843
+ this.connectedTags = {};
6844
+ this.dynamicTagValues = {};
6845
+ this.lockedDates = [];
6846
+ this.scenarioTagDataChanged = new i0.EventEmitter();
6847
+ this.currentTagsMap = {};
6848
+ this._currentTags = [];
6849
+ this.dynamicTagsToSave = [];
6850
+ this.tagsToSave = [];
6851
+ }
6852
+ Object.defineProperty(DrScenarioTagConfigurationComponent.prototype, "currentTags", {
6853
+ get: function () {
6854
+ return this._currentTags;
6855
+ },
6856
+ set: function (tags) {
6857
+ var _this = this;
6858
+ this._currentTags = tags;
6859
+ this.currentTagsMap = _.reduce(tags, function (acc, curr) {
6860
+ var _a;
6861
+ var tagId = (_a = _.find(_this.tagsConfig, { name: curr.name })) === null || _a === void 0 ? void 0 : _a.id;
6862
+ if (isNaN(tagId))
6863
+ return acc;
6864
+ acc[tagId] = curr;
6865
+ return acc;
6866
+ }, {});
6867
+ },
6868
+ enumerable: false,
6869
+ configurable: true
6870
+ });
6871
+ DrScenarioTagConfigurationComponent.prototype.ngOnChanges = function (simpleChanges) {
6872
+ this.currentTags = this.currentTags;
6873
+ };
6874
+ DrScenarioTagConfigurationComponent.prototype.onTagChange = function ($event) {
6875
+ var savedTag = _.find(this.tagsToSave, { id: $event.id });
6876
+ if (savedTag) {
6877
+ _.merge(savedTag, $event);
6878
+ }
6879
+ else {
6880
+ this.tagsToSave.push($event);
6881
+ }
6882
+ this.onScenarioTagDataChanged();
6883
+ };
6884
+ DrScenarioTagConfigurationComponent.prototype.onDynamicTagsChange = function ($event) {
6885
+ this.dynamicTagsToSave = $event;
6886
+ this.onScenarioTagDataChanged();
6887
+ };
6888
+ DrScenarioTagConfigurationComponent.prototype.onScenarioTagDataChanged = function () {
6889
+ var tags = __spreadArray(__spreadArray([], __read(this.dynamicTagsToSave)), __read(this.tagsToSave));
6890
+ this.scenarioTagDataChanged.emit({
6891
+ scenario: this.scenario,
6892
+ tagsConfig: this.tagsConfig,
6893
+ tags: tags,
6894
+ });
6895
+ };
6896
+ return DrScenarioTagConfigurationComponent;
6897
+ }());
6898
+ DrScenarioTagConfigurationComponent.decorators = [
6899
+ { type: i0.Component, args: [{
6900
+ selector: 'dr-scenario-tag-configuration',
6901
+ 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",
6902
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
6903
+ 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"]
6904
+ },] }
6905
+ ];
6906
+ DrScenarioTagConfigurationComponent.propDecorators = {
6907
+ tagsConfig: [{ type: i0.Input }],
6908
+ currentTags: [{ type: i0.Input }],
6909
+ scenario: [{ type: i0.Input }],
6910
+ connectedTags: [{ type: i0.Input }],
6911
+ dynamicTagValues: [{ type: i0.Input }],
6912
+ lockedDates: [{ type: i0.Input }],
6913
+ fiscalYearStartsFrom: [{ type: i0.Input }],
6914
+ fiscalYearBack: [{ type: i0.Input }],
6915
+ isDynamicAddEnabled: [{ type: i0.Input }],
6916
+ scenarioTagDataChanged: [{ type: i0.Output }]
6917
+ };
6918
+
6919
+ var COMPONENTS = [
6920
+ DrScenarioConfigurationComponent,
6921
+ DrScenarioTagConfigurationComponent,
6922
+ ];
6923
+ var DrScenarioModule = /** @class */ (function () {
6924
+ function DrScenarioModule() {
6925
+ }
6926
+ return DrScenarioModule;
6927
+ }());
6928
+ DrScenarioModule.decorators = [
6929
+ { type: i0.NgModule, args: [{
6930
+ declarations: __spreadArray([], __read(COMPONENTS)),
6931
+ providers: [ScenarioService],
6932
+ imports: [
6933
+ common.CommonModule,
6934
+ DrInputsModule,
6935
+ forms.FormsModule,
6936
+ DrTagModule
6937
+ ],
6938
+ exports: __spreadArray([], __read(COMPONENTS)),
6939
+ },] }
6940
+ ];
6941
+
6482
6942
  /* components */
6483
6943
 
6484
6944
  /**
@@ -6526,6 +6986,7 @@
6526
6986
  exports.DrPopoverModule = DrPopoverModule;
6527
6987
  exports.DrPopoverRef = DrPopoverRef;
6528
6988
  exports.DrPopoverService = DrPopoverService;
6989
+ exports.DrScenarioModule = DrScenarioModule;
6529
6990
  exports.DrSelectComponent = DrSelectComponent;
6530
6991
  exports.DrSharedUtils = DrSharedUtils;
6531
6992
  exports.DrSpinnerComponent = DrSpinnerComponent;
@@ -6549,11 +7010,14 @@
6549
7010
  exports.QuarterTagComponent = QuarterTagComponent;
6550
7011
  exports.RadioButtonComponent = RadioButtonComponent;
6551
7012
  exports.RadioGroupComponent = RadioGroupComponent;
7013
+ exports.ScenarioService = ScenarioService;
6552
7014
  exports.TooltipComponent = TooltipComponent;
6553
7015
  exports.WeekTagComponent = WeekTagComponent;
6554
7016
  exports.YearTagComponent = YearTagComponent;
6555
7017
  exports["ɵa"] = components$2;
6556
7018
  exports["ɵb"] = POPUP_ANIMATION;
7019
+ exports["ɵba"] = DrScenarioConfigurationComponent;
7020
+ exports["ɵbb"] = DrScenarioTagConfigurationComponent;
6557
7021
  exports["ɵc"] = DrDatePickerComponent;
6558
7022
  exports["ɵd"] = DrDatePickerService;
6559
7023
  exports["ɵe"] = DrDatePickerWithTimeframeComponent;