@datarailsshared/datarailsshared 1.4.166 → 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 (40) hide show
  1. package/bundles/datarailsshared-datarailsshared.umd.js +508 -31
  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 +3 -8
  8. package/esm2015/lib/date-tags/month-tag/month-tag.component.js +3 -8
  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 +3 -8
  11. package/esm2015/lib/dr-inputs/date-pickers/dr-date-picker/dr-date-picker.component.js +2 -2
  12. package/esm2015/lib/dr-inputs/date-pickers/dr-date-picker_custom-header/dr-date-picker_custom-header.component.js +2 -1
  13. package/esm2015/lib/dr-inputs/date-pickers/services/dr-date-picker.service.js +2 -1
  14. package/esm2015/lib/dr-inputs/dr-inputs.module.js +3 -2
  15. package/esm2015/lib/dr-inputs/dr-toggle-button/dr-toggle-button.component.js +8 -3
  16. package/esm2015/lib/dr-inputs/dr-toggle-button/toggle-button-mode.js +6 -0
  17. package/esm2015/lib/dr-scenario/components/dr-scenario-configuration/dr-scenario-configuration.component.js +93 -0
  18. package/esm2015/lib/dr-scenario/components/dr-scenario-tag-configuration/dr-scenario-tag-configuration.component.js +74 -0
  19. package/esm2015/lib/dr-scenario/consts/scenario-tags-config.js +73 -0
  20. package/esm2015/lib/dr-scenario/dr-scenario.module.js +28 -0
  21. package/esm2015/lib/dr-scenario/interfaces/scenario.js +8 -0
  22. package/esm2015/lib/dr-scenario/services/scenario.service.js +160 -0
  23. package/esm2015/lib/dr-tags/dr-tag.component.js +18 -5
  24. package/esm2015/lib/models/serverTags.js +13 -1
  25. package/esm2015/public-api.js +6 -1
  26. package/fesm2015/datarailsshared-datarailsshared.js +468 -32
  27. package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
  28. package/lib/dr-inputs/dr-toggle-button/dr-toggle-button.component.d.ts +3 -0
  29. package/lib/dr-inputs/dr-toggle-button/toggle-button-mode.d.ts +4 -0
  30. package/lib/dr-scenario/components/dr-scenario-configuration/dr-scenario-configuration.component.d.ts +27 -0
  31. package/lib/dr-scenario/components/dr-scenario-tag-configuration/dr-scenario-tag-configuration.component.d.ts +26 -0
  32. package/lib/dr-scenario/consts/scenario-tags-config.d.ts +24 -0
  33. package/lib/dr-scenario/dr-scenario.module.d.ts +2 -0
  34. package/lib/dr-scenario/interfaces/scenario.d.ts +43 -0
  35. package/lib/dr-scenario/services/scenario.service.d.ts +21 -0
  36. package/lib/dr-tags/dr-tag.component.d.ts +7 -3
  37. package/lib/models/serverTags.d.ts +15 -1
  38. package/package.json +1 -1
  39. package/public-api.d.ts +5 -1
  40. package/datarailsshared-datarailsshared-1.4.166.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().utc().unix();
616
+ this.dateObj.date = this.date;
622
617
  };
623
618
  MonthTagComponent.prototype.initName = function () {
624
619
  if (!this.name) {
@@ -822,7 +817,7 @@
822
817
  });
823
818
  WeekTagComponent.prototype.ngOnInit = function () {
824
819
  this.initName();
825
- var timestamp = this.defaultValue || moment$5().unix();
820
+ var timestamp = this.defaultValue || moment$5().utc().unix();
826
821
  this.date = timestamp;
827
822
  this.dateObj.date = timestamp;
828
823
  this.chosenTagHandler(timestamp);
@@ -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().utc().unix();
906
+ this.dateObj.date = this.date;
917
907
  };
918
908
  YearTagComponent.prototype.initName = function () {
919
909
  if (!this.name) {
@@ -970,30 +960,53 @@
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 (simpleChanges) {
1004
+ if (simpleChanges.tagsConfig) {
1005
+ this.calculateDynamicTag();
1006
+ }
1007
+ };
991
1008
  DrTagComponent.prototype.ngOnInit = function () {
992
- var _this = this;
993
1009
  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); });
997
1010
  this.dateTag = {
998
1011
  type: this.tagConfig.type,
999
1012
  sub_type: this.tagConfig.options.sub_type,
@@ -1108,6 +1121,12 @@
1108
1121
  }
1109
1122
  });
1110
1123
  };
1124
+ DrTagComponent.prototype.calculateDynamicTag = function () {
1125
+ var _this = this;
1126
+ this.currentTagDynamic = this.tagConfig.options.is_custom;
1127
+ this.currentTagConnectedToDynamic = _.some(this.tagsConfig, function (tagConfig) { return tagConfig.options.is_custom
1128
+ && ['year'].includes(_this.tagConfig.options.sub_type); });
1129
+ };
1111
1130
  return DrTagComponent;
1112
1131
  }());
1113
1132
  DrTagComponent.decorators = [
@@ -1201,13 +1220,8 @@
1201
1220
  configurable: true
1202
1221
  });
1203
1222
  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
- }
1223
+ this.date = this.defaultValue || moment$3().utc().unix();
1224
+ this.dateObj.date = this.date;
1211
1225
  };
1212
1226
  DayTagComponent.prototype.initName = function () {
1213
1227
  if (!this.name) {
@@ -2443,12 +2457,20 @@
2443
2457
  elementClass: [{ type: i0.HostBinding, args: ['class',] }]
2444
2458
  };
2445
2459
 
2460
+ exports.ToggleButtonMode = void 0;
2461
+ (function (ToggleButtonMode) {
2462
+ ToggleButtonMode["DEFAULT"] = "default";
2463
+ ToggleButtonMode["DOTTED"] = "dotted";
2464
+ })(exports.ToggleButtonMode || (exports.ToggleButtonMode = {}));
2465
+
2446
2466
  var DrToggleButtonComponent = /** @class */ (function () {
2447
2467
  function DrToggleButtonComponent(cdr) {
2448
2468
  this.cdr = cdr;
2449
2469
  this._disabled = false;
2450
2470
  this.bindLabel = null;
2451
2471
  this.bindValue = null;
2472
+ this.bindHidden = null;
2473
+ this.mode = exports.ToggleButtonMode.DEFAULT;
2452
2474
  this.onChange = function () {
2453
2475
  };
2454
2476
  this.onTouched = function () {
@@ -2485,12 +2507,12 @@
2485
2507
  DrToggleButtonComponent.decorators = [
2486
2508
  { type: i0.Component, args: [{
2487
2509
  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",
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",
2489
2511
  providers: [
2490
2512
  { provide: forms.NG_VALUE_ACCESSOR, useExisting: i0.forwardRef(function () { return DrToggleButtonComponent; }), multi: true }
2491
2513
  ],
2492
2514
  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"]
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"]
2494
2516
  },] }
2495
2517
  ];
2496
2518
  DrToggleButtonComponent.ctorParameters = function () { return [
@@ -2500,6 +2522,8 @@
2500
2522
  items: [{ type: i0.Input }],
2501
2523
  bindLabel: [{ type: i0.Input }],
2502
2524
  bindValue: [{ type: i0.Input }],
2525
+ bindHidden: [{ type: i0.Input }],
2526
+ mode: [{ type: i0.Input }],
2503
2527
  selectedValue: [{ type: i0.Input }],
2504
2528
  disabled: [{ type: i0.Input }]
2505
2529
  };
@@ -4206,6 +4230,14 @@
4206
4230
  TooltipPosition["LEFT_BOTTOM"] = "left-bottom";
4207
4231
  })(exports.TooltipPosition || (exports.TooltipPosition = {}));
4208
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
+
4209
4241
  var DrModelDebounceChangeDirective = /** @class */ (function () {
4210
4242
  function DrModelDebounceChangeDirective(ngModel) {
4211
4243
  this.ngModel = ngModel;
@@ -4271,6 +4303,247 @@
4271
4303
  return ChatMessage;
4272
4304
  }());
4273
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
+
4274
4547
  var DrSharedUtils = /** @class */ (function () {
4275
4548
  function DrSharedUtils() {
4276
4549
  }
@@ -4319,6 +4592,7 @@
4319
4592
  return DrSharedUtils;
4320
4593
  }());
4321
4594
 
4595
+ // @ts-ignore
4322
4596
  var moment$2 = require('moment');
4323
4597
  var DrDatePickerService = /** @class */ (function () {
4324
4598
  function DrDatePickerService() {
@@ -4509,6 +4783,7 @@
4509
4783
  { type: i0.Injectable }
4510
4784
  ];
4511
4785
 
4786
+ // @ts-ignore
4512
4787
  var moment$1 = require('moment');
4513
4788
  var DrDatePickerCustomHeaderComponent = /** @class */ (function () {
4514
4789
  function DrDatePickerCustomHeaderComponent(_calendar, _dateAdapter, _dateFormats, cdr, datePickerService) {
@@ -4896,7 +5171,7 @@
4896
5171
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
4897
5172
  providers: [
4898
5173
  { provide: forms.NG_VALUE_ACCESSOR, useExisting: DrDatePickerComponent, multi: true },
4899
- { provide: DrDatePickerService }
5174
+ DrDatePickerService
4900
5175
  ],
4901
5176
  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:#4646ce!important;color:#151b3f}:host.disabled{pointer-events:none;border:1px solid #aeabac;background:#f0f1f4}:host.disabled:after{color:#aeabac}: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:\"\\e9b6\";font-family:DataRails;font-size:24px;color:#6d6e6f;top:0;bottom:0;right:8px;position:absolute;display:flex;align-items:center;justify-content:center}: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:#aeabac;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"]
4902
5177
  },] }
@@ -5402,7 +5677,8 @@
5402
5677
  datepicker.MatDatepickerModule,
5403
5678
  tooltip.MatTooltipModule,
5404
5679
  DrTooltipModule
5405
- ]
5680
+ ],
5681
+ entryComponents: [DrDatePickerCustomHeaderComponent]
5406
5682
  },] }
5407
5683
  ];
5408
5684
 
@@ -6484,6 +6760,203 @@
6484
6760
  },] }
6485
6761
  ];
6486
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
+
6487
6960
  /* components */
6488
6961
 
6489
6962
  /**
@@ -6531,6 +7004,7 @@
6531
7004
  exports.DrPopoverModule = DrPopoverModule;
6532
7005
  exports.DrPopoverRef = DrPopoverRef;
6533
7006
  exports.DrPopoverService = DrPopoverService;
7007
+ exports.DrScenarioModule = DrScenarioModule;
6534
7008
  exports.DrSelectComponent = DrSelectComponent;
6535
7009
  exports.DrSharedUtils = DrSharedUtils;
6536
7010
  exports.DrSpinnerComponent = DrSpinnerComponent;
@@ -6554,11 +7028,14 @@
6554
7028
  exports.QuarterTagComponent = QuarterTagComponent;
6555
7029
  exports.RadioButtonComponent = RadioButtonComponent;
6556
7030
  exports.RadioGroupComponent = RadioGroupComponent;
7031
+ exports.ScenarioService = ScenarioService;
6557
7032
  exports.TooltipComponent = TooltipComponent;
6558
7033
  exports.WeekTagComponent = WeekTagComponent;
6559
7034
  exports.YearTagComponent = YearTagComponent;
6560
7035
  exports["ɵa"] = components$2;
6561
7036
  exports["ɵb"] = POPUP_ANIMATION;
7037
+ exports["ɵba"] = DrScenarioConfigurationComponent;
7038
+ exports["ɵbb"] = DrScenarioTagConfigurationComponent;
6562
7039
  exports["ɵc"] = DrDatePickerComponent;
6563
7040
  exports["ɵd"] = DrDatePickerService;
6564
7041
  exports["ɵe"] = DrDatePickerWithTimeframeComponent;