@datarailsshared/datarailsshared 1.4.178 → 1.4.180

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.
@@ -15,11 +15,11 @@ import { Overlay, OverlayPositionBuilder, OverlayConfig } from '@angular/cdk/ove
15
15
  import { ComponentPortal } from '@angular/cdk/portal';
16
16
  import * as i1$1 from '@angular/material/dialog';
17
17
  import { MatDialogRef, MAT_DIALOG_DATA, MatDialog, MatDialogModule } from '@angular/material/dialog';
18
+ import { DomSanitizer } from '@angular/platform-browser';
18
19
  import { MatCalendar, MatDatepickerModule } from '@angular/material/datepicker';
19
20
  import * as moment$9 from 'moment';
20
21
  import { MatTooltipModule } from '@angular/material/tooltip';
21
22
  import { MatTabsModule } from '@angular/material/tabs';
22
- import { DomSanitizer } from '@angular/platform-browser';
23
23
 
24
24
  // import {*} from ""
25
25
  class DateTagComponent {
@@ -3593,56 +3593,6 @@ DrDetailsListComponent.propDecorators = {
3593
3593
  collapse: [{ type: Input }]
3594
3594
  };
3595
3595
 
3596
- var TooltipPosition;
3597
- (function (TooltipPosition) {
3598
- TooltipPosition["TOP"] = "top";
3599
- TooltipPosition["BOTTOM"] = "bottom";
3600
- TooltipPosition["LEFT"] = "left";
3601
- TooltipPosition["RIGHT"] = "right";
3602
- TooltipPosition["TOP_RIGHT"] = "top-right";
3603
- TooltipPosition["TOP_LEFT"] = "top-left";
3604
- TooltipPosition["BOTTOM_RIGHT"] = "bottom-right";
3605
- TooltipPosition["BOTTOM_LEFT"] = "bottom-left";
3606
- TooltipPosition["RIGHT_TOP"] = "right-top";
3607
- TooltipPosition["RIGHT_BOTTOM"] = "right-bottom";
3608
- TooltipPosition["LEFT_TOP"] = "left-top";
3609
- TooltipPosition["LEFT_BOTTOM"] = "left-bottom";
3610
- })(TooltipPosition || (TooltipPosition = {}));
3611
-
3612
- var Scenario;
3613
- (function (Scenario) {
3614
- Scenario["ACTUALS"] = "Actuals";
3615
- Scenario["FORECAST"] = "Forecast";
3616
- Scenario["BUDGET"] = "Budget";
3617
- Scenario["NONE"] = "None";
3618
- })(Scenario || (Scenario = {}));
3619
-
3620
- class DrModelDebounceChangeDirective {
3621
- constructor(ngModel) {
3622
- this.ngModel = ngModel;
3623
- this.debounce = 200;
3624
- this.ngModelDebounceChange = new EventEmitter();
3625
- }
3626
- ngOnInit() {
3627
- this.subscription = this.ngModel.control.valueChanges.pipe(skip(1), debounceTime(this.debounce), distinctUntilChanged()).subscribe(value => this.ngModelDebounceChange.emit(value));
3628
- }
3629
- ngOnDestroy() {
3630
- this.subscription.unsubscribe();
3631
- }
3632
- }
3633
- DrModelDebounceChangeDirective.decorators = [
3634
- { type: Directive, args: [{
3635
- selector: '[ngModelDebounceChange]'
3636
- },] }
3637
- ];
3638
- DrModelDebounceChangeDirective.ctorParameters = () => [
3639
- { type: NgModel }
3640
- ];
3641
- DrModelDebounceChangeDirective.propDecorators = {
3642
- debounce: [{ type: Input }],
3643
- ngModelDebounceChange: [{ type: Output }]
3644
- };
3645
-
3646
3596
  const IMAGE_TYPES = ['image/png', 'image/jpeg', 'image/gif'];
3647
3597
  var CHAT_MESSAGE_TYPE;
3648
3598
  (function (CHAT_MESSAGE_TYPE) {
@@ -3679,2178 +3629,2234 @@ class ChatMessage {
3679
3629
  }
3680
3630
  }
3681
3631
 
3682
- var BadgeStatus;
3683
- (function (BadgeStatus) {
3684
- BadgeStatus["INFO"] = "info";
3685
- BadgeStatus["ERROR"] = "error";
3686
- BadgeStatus["WARNING"] = "warning";
3687
- BadgeStatus["SUCCESS"] = "success";
3688
- BadgeStatus["REGULAR"] = "regular";
3689
- BadgeStatus["PROGRESS"] = "progress";
3690
- BadgeStatus["DOTTED"] = "dotted";
3691
- })(BadgeStatus || (BadgeStatus = {}));
3692
-
3693
- const allDateTags = {
3694
- [TagsConfigSubType.YEAR]: {
3695
- name: 'Date',
3696
- toggle: false,
3697
- },
3698
- [TagsConfigSubType.QUARTER]: {
3699
- name: 'Date',
3700
- toggle: false,
3701
- },
3702
- [TagsConfigSubType.MONTH]: {
3703
- name: 'Date',
3704
- toggle: false,
3705
- },
3706
- [TagsConfigSubType.DAY]: {
3707
- name: 'Date',
3708
- toggle: false,
3709
- },
3710
- [TagsConfigSubType.WEEK]: {
3711
- name: 'Date',
3712
- toggle: false,
3632
+ class DrChatFormComponent {
3633
+ constructor(cdr, domSanitizer) {
3634
+ this.cdr = cdr;
3635
+ this.domSanitizer = domSanitizer;
3636
+ this._textareaInitialHeight = true;
3637
+ this.inputFocus = false;
3638
+ this.inputHover = false;
3639
+ this.droppedFiles = [];
3640
+ /**
3641
+ * Predefined message text
3642
+ *
3643
+ * @type {string}
3644
+ */
3645
+ this.message = '';
3646
+ /**
3647
+ * Message placeholder text
3648
+ *
3649
+ * @type {string}
3650
+ */
3651
+ this.messagePlaceholder = 'Type a message';
3652
+ /**
3653
+ * Show send button
3654
+ *
3655
+ * @type {boolean}
3656
+ */
3657
+ this.dropFiles = false;
3658
+ /**
3659
+ * File drop placeholder text
3660
+ *
3661
+ * @type {string}
3662
+ */
3663
+ this.dropFilePlaceholder = 'Drop file to send';
3664
+ /**
3665
+ * Parameter to check is send message function available
3666
+ *
3667
+ * @type {boolean}
3668
+ */
3669
+ this.waitForReply = false;
3670
+ /**
3671
+ *
3672
+ * @type {EventEmitter<{ message: string, files: File[] }>}
3673
+ */
3674
+ this.send = new EventEmitter();
3675
+ this.abort = new EventEmitter();
3676
+ /**
3677
+ * Emits when message input value has been changed
3678
+ *
3679
+ * @type {EventEmitter<string>}
3680
+ */
3681
+ this.inputChange = new EventEmitter();
3682
+ this.fileOver = false;
3713
3683
  }
3714
- };
3715
- function getScenarioTagDataConfig(isMultipleDimension) {
3716
- return {
3717
- [Scenario.ACTUALS]: Object.assign(Object.assign({}, allDateTags), { [TagsConfigSubType.MONTH]: {
3718
- name: 'Date',
3719
- toggle: true,
3720
- }, [TagsConfigSubType.FILE_STATUS]: {
3721
- toggle: false,
3722
- } }),
3723
- [Scenario.BUDGET]: {
3724
- [TagsConfigSubType.BUDGET_CYCLE]: {
3725
- toggle: true,
3726
- acceptableDateTags: [TagsConfigSubType.YEAR],
3727
- hidden: !isMultipleDimension,
3728
- },
3729
- [TagsConfigSubType.PLAN]: {
3730
- toggle: false,
3731
- turnOffDateTags: true,
3732
- hidden: isMultipleDimension,
3733
- },
3734
- [TagsConfigSubType.YEAR]: {
3735
- name: 'Date',
3736
- toggle: true,
3737
- },
3738
- [TagsConfigSubType.QUARTER]: {
3739
- name: 'Date',
3740
- toggle: false,
3741
- },
3742
- [TagsConfigSubType.FILE_STATUS]: {
3743
- toggle: false,
3744
- },
3745
- },
3746
- [Scenario.FORECAST]: {
3747
- [TagsConfigSubType.FORECAST_NEW]: {
3748
- toggle: true,
3749
- name: 'Date',
3750
- },
3751
- [TagsConfigSubType.FILE_STATUS]: {
3752
- toggle: false,
3753
- },
3754
- },
3755
- [Scenario.NONE]: Object.assign(Object.assign({}, allDateTags), { [TagsConfigSubType.MONTH]: {
3756
- name: 'Date',
3757
- toggle: true,
3758
- }, [TagsConfigSubType.FILE_STATUS]: {
3759
- toggle: true,
3760
- } }),
3761
- };
3762
- }
3763
-
3764
- class ScenarioService {
3765
- constructor() {
3766
- this.DEFAULT_FORECAST_DATE_TAG = 'Month';
3684
+ onDrop(event) {
3685
+ var _a;
3686
+ if (this.dropFiles) {
3687
+ event.preventDefault();
3688
+ event.stopPropagation();
3689
+ this.fileOver = false;
3690
+ if ((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) {
3691
+ for (const file of event.dataTransfer.files) {
3692
+ const res = file;
3693
+ if (IMAGE_TYPES.includes(file.type)) {
3694
+ const fr = new FileReader();
3695
+ fr.onload = (e) => {
3696
+ res.src = e.target.result;
3697
+ res.urlStyle = this.domSanitizer.bypassSecurityTrustStyle(`url(${res.src})`);
3698
+ this.cdr.detectChanges();
3699
+ };
3700
+ fr.readAsDataURL(file);
3701
+ }
3702
+ this.droppedFiles.push(res);
3703
+ }
3704
+ }
3705
+ }
3767
3706
  }
3768
- get scenarios() {
3769
- return orderBy(Object.values(Scenario), (scenario) => scenario === Scenario.NONE ? 1 : 0);
3707
+ removeFile(file) {
3708
+ const index = this.droppedFiles.indexOf(file);
3709
+ if (index >= 0) {
3710
+ this.droppedFiles.splice(index, 1);
3711
+ }
3770
3712
  }
3771
- get areExistingTagsConfig() {
3772
- return !!this.currentTagsConfig;
3713
+ onDragOver(event) {
3714
+ event.preventDefault();
3715
+ event.stopPropagation();
3716
+ if (this.dropFiles) {
3717
+ this.fileOver = true;
3718
+ }
3773
3719
  }
3774
- initScenarioTags(wholeTagsConfig, currentTagsConfig, isMultipleDimension) {
3775
- if (!(wholeTagsConfig === null || wholeTagsConfig === void 0 ? void 0 : wholeTagsConfig.length))
3720
+ onDragLeave(event) {
3721
+ event.preventDefault();
3722
+ event.stopPropagation();
3723
+ if (this.dropFiles) {
3724
+ this.fileOver = false;
3725
+ }
3726
+ }
3727
+ sendMessage() {
3728
+ if (this.waitForReply) {
3776
3729
  return;
3777
- this.wholeTagsConfig = cloneDeep(wholeTagsConfig);
3778
- this.currentTagsConfig = currentTagsConfig;
3779
- this.isMultipleDimension = isMultipleDimension;
3730
+ }
3731
+ if (this.droppedFiles.length || String(this.message).trim().length) {
3732
+ this._textareaInitialHeight = true;
3733
+ this.send.emit({ message: this.message, files: this.droppedFiles });
3734
+ this.message = '';
3735
+ this.droppedFiles = [];
3736
+ this.cdr.markForCheck();
3737
+ }
3780
3738
  }
3781
- getTagsConfigByScenarioTags(scenarioTags, tagsConfig) {
3782
- const scenarioTagsConfig = filter$1(tagsConfig, (tagConfig) => some(scenarioTags, (scenarioTag) => scenarioTag.toggle && scenarioTag.selectedTagSubType === tagConfig.options.sub_type));
3783
- return this.sortScenarioTags(scenarioTagsConfig);
3739
+ abortMessage() {
3740
+ this.abort.emit();
3784
3741
  }
3785
- getScenarioTagsByScenario(scenario) {
3786
- const scenarioTagsConfig = this.getScenarioTagsConfig(scenario, this.wholeTagsConfig);
3787
- const scenarioTagsUi = [];
3788
- forEach(scenarioTagsConfig, (scenarioTag) => {
3789
- const isTagWithSubTags = scenarioTag.type === TagTypes.DATE;
3790
- const tagWithSubTags = isTagWithSubTags && find(scenarioTagsUi, { type: scenarioTag.type });
3791
- const tag = tagWithSubTags || this.prepareScenarioTag(scenarioTagsConfig, scenarioTag, scenario, isTagWithSubTags);
3792
- if (isTagWithSubTags) {
3793
- this.updateScenarioSubTags(tag, scenarioTag);
3794
- tag.subTags = this.sortedScenarioSubTags(tag);
3795
- }
3796
- if (tagWithSubTags)
3797
- return;
3798
- scenarioTagsUi.push(tag);
3799
- });
3800
- if (this.areExistingTagsConfig) {
3801
- this.initExistingTagsConfig(scenario, scenarioTagsUi);
3802
- }
3803
- const isTagNotSupportingDates = some(scenarioTagsUi, { turnOffDateTags: true, toggle: true });
3804
- if (isTagNotSupportingDates) {
3805
- this.turnOffDateTag(scenarioTagsUi);
3806
- }
3807
- const tagWithSpecificDateTags = find(scenarioTagsUi, (tag) => { var _a; return tag.toggle && !!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length); });
3808
- if (tagWithSpecificDateTags) {
3809
- this.hideNotAvailableTags(tagWithSpecificDateTags, scenarioTagsUi);
3810
- }
3811
- return this.sortScenarioTags(scenarioTagsUi);
3812
- }
3813
- sortScenarioTags(scenarioTagsUi) {
3814
- return orderBy(scenarioTagsUi, [
3815
- (tag) => (tag.type === TagTypes.DATE ? 0 : 1),
3816
- (tag) => (tag.name === 'File Status')
3817
- ]);
3818
- }
3819
- initExistingTagsConfig(scenario, scenarioTagsUi) {
3820
- forEach(this.currentTagsConfig, (tagConfig) => {
3821
- var _a;
3822
- const tagSubType = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.options) === null || _a === void 0 ? void 0 : _a.sub_type;
3823
- const scenarioTagDataConfig = getScenarioTagDataConfig(this.isMultipleDimension);
3824
- if (!scenarioTagDataConfig || !scenarioTagDataConfig[scenario] || !scenarioTagDataConfig[scenario][tagSubType]) {
3825
- return;
3826
- }
3827
- const scenarioTagUi = tagConfig.type === TagTypes.DATE
3828
- ? find(scenarioTagsUi, { type: tagConfig.type })
3829
- : find(scenarioTagsUi, { selectedTagSubType: tagSubType });
3830
- scenarioTagUi.toggle = true;
3831
- scenarioTagUi.selectedTagSubType = tagSubType;
3832
- });
3742
+ onModelChange(value) {
3743
+ this._textareaInitialHeight = false;
3744
+ this.inputChange.emit(value);
3833
3745
  }
3834
- prepareScenarioTag(scenarioTagsConfig, scenarioTag, scenario, isDateTag) {
3835
- const toggleStatus = isDateTag
3836
- ? some(scenarioTagsConfig, (tag) => tag.type === TagTypes.DATE && tag.scenarioData.toggle)
3837
- : scenarioTag.scenarioData.toggle;
3838
- const selectedTagSubType = isDateTag
3839
- ? this.getScenarioSelectedDateTag(scenario, scenarioTagsConfig)
3840
- : scenarioTag.options.sub_type;
3841
- const tag = {
3842
- toggle: this.areExistingTagsConfig ? false : toggleStatus,
3843
- name: scenarioTag.scenarioData.name || scenarioTag.name,
3844
- description: scenarioTag.scenarioData.description || scenarioTag.description,
3845
- type: scenarioTag.type,
3846
- selectedTagSubType,
3847
- };
3848
- if (scenarioTag.scenarioData.turnOffDateTags) {
3849
- tag.turnOffDateTags = scenarioTag.scenarioData.turnOffDateTags;
3850
- }
3851
- if (scenarioTag.scenarioData.acceptableDateTags) {
3852
- tag.acceptableDateTags = scenarioTag.scenarioData.acceptableDateTags;
3746
+ getTextAreaHeight(textAreaElement) {
3747
+ let height;
3748
+ if (this._textareaInitialHeight) {
3749
+ height = 50;
3853
3750
  }
3854
- return tag;
3855
- }
3856
- sortedScenarioSubTags(tag) {
3857
- const SUB_TAGS_ORDER = [TagsConfigSubType.DAY, TagsConfigSubType.WEEK, TagsConfigSubType.MONTH, TagsConfigSubType.QUARTER, TagsConfigSubType.YEAR];
3858
- return orderBy(tag.subTags, (subTag) => indexOf(SUB_TAGS_ORDER, subTag.subType));
3859
- }
3860
- updateScenarioSubTags(tag, scenarioTag) {
3861
- if (!tag.subTags) {
3862
- tag.subTags = [];
3751
+ else {
3752
+ height = textAreaElement.scrollHeight + 2;
3863
3753
  }
3864
- const tagSubType = scenarioTag.options.sub_type;
3865
- tag.subTags.push({
3866
- subType: tagSubType,
3867
- name: tagSubType === TagsConfigSubType.FORECAST_NEW ? this.DEFAULT_FORECAST_DATE_TAG : scenarioTag.name,
3868
- });
3754
+ return `height: ${height}px;`;
3869
3755
  }
3870
- turnOffDateTag(scenarioTags) {
3871
- const dateTag = find(scenarioTags, { type: TagTypes.DATE });
3872
- if (!dateTag)
3873
- return;
3874
- dateTag.toggle = false;
3756
+ }
3757
+ DrChatFormComponent.decorators = [
3758
+ { type: Component, args: [{
3759
+ selector: 'dr-chat-form',
3760
+ template: "<div class=\"dropped-files\" *ngIf=\"droppedFiles?.length\">\n <div class=\"dropped-files__item\" *ngFor=\"let file of droppedFiles\">\n <div class=\"dropped-files__item__preview\" [style.background-image]=\"file.urlStyle || 'none'\">\n <i class=\"dr-icon-file\" *ngIf=\"!file.urlStyle\"></i>\n </div>\n <div class=\"dropped-files__item__name\">{{ file.name }}</div>\n <i class=\"dropped-files__item__remove dr-icon-exit\" (click)=\"removeFile(file)\"></i>\n </div>\n</div>\n<div class=\"message-row\">\n <div class=\"message-row__input\">\n <textarea #textAreaElement\n (focus)=\"inputFocus = true\"\n (blur)=\"inputFocus = false\"\n (mouseenter)=\"inputHover = true\"\n (mouseleave)=\"inputHover = false\"\n [(ngModel)]=\"message\"\n [rows]=\"1\"\n [style]=\"getTextAreaHeight(textAreaElement)\"\n (ngModelChange)=\"onModelChange($event)\"\n type=\"text\"\n placeholder=\"{{ fileOver ? dropFilePlaceholder : messagePlaceholder }}\"\n (keyup.enter)=\"sendMessage()\">\n </textarea>\n <i *ngIf=\"!waitForReply\" (click)=\"sendMessage()\" class=\"dr-icon-notify send-button\"></i>\n <dr-dot-flashing *ngIf=\"waitForReply\" class=\"wait-reply-dot-flashing\"></dr-dot-flashing>\n <dr-button *ngIf=\"waitForReply\" (click)=\"abortMessage()\" theme=\"ghost\" class=\"abort-button\">Stop generating</dr-button>\n </div>\n</div>\n",
3761
+ changeDetection: ChangeDetectionStrategy.OnPush,
3762
+ styles: [":host{display:flex;flex-direction:column;align-items:center;padding:0 24px;margin-top:12px}:host .message-row{display:flex;justify-content:center;width:100%;padding:0 0 21px;max-width:970px}:host .message-row__input{position:relative;display:flex;align-items:center;flex-grow:1;flex-direction:row;height:auto;overflow:visible;min-width:265px}:host .message-row__input textarea{font-size:14px;line-height:22px;max-height:100%;flex-grow:1;resize:none;padding:14px 40px 12px 23px;margin:auto;border:1px solid #DFE0E3;border-radius:12px;min-height:50px}:host .message-row__input textarea:focus{border:1px solid #7F7FDD}:host .message-row__input textarea::placeholder{color:#9ea1aa}:host .message-row__input .send-button{position:absolute;right:14px;cursor:pointer;color:#dfe0e3;font-size:28px}:host .message-row__input .wait-reply-dot-flashing{position:absolute;right:20px}:host .message-row__input textarea:focus+.send-button,:host .message-row__input .send-button:hover{color:#25258c}:host .message-row__input .abort-button{position:absolute;right:0;top:-44px}:host .message-row__input .abort-button::ng-deep button{background:#F2F2FF!important;border-radius:4px}:host input{flex:1}:host input.with-button{border-bottom-right-radius:0;border-top-right-radius:0}:host .dropped-files{display:flex;flex-direction:row;margin-bottom:.5rem;flex-wrap:wrap}:host .dropped-files__item{display:flex;flex-direction:column;justify-content:center;margin:0 10px 10px 0;position:relative}:host .dropped-files__item__preview{background-size:cover;background-position:center;width:64px;height:64px;border-radius:8px;border:1px solid #ccc}:host .dropped-files__item__preview i{font-size:62px}:host .dropped-files__item__name{white-space:nowrap;font-size:12px;color:#8f929e;margin-top:4px;max-width:64px;overflow:hidden;text-overflow:ellipsis}:host .dropped-files__item__remove{position:absolute;right:-4px;top:-4px;cursor:pointer;background:white;border-radius:12px;color:#8f929e;border:1px solid #8f929e;font-size:14px}\n"]
3763
+ },] }
3764
+ ];
3765
+ DrChatFormComponent.ctorParameters = () => [
3766
+ { type: ChangeDetectorRef },
3767
+ { type: DomSanitizer }
3768
+ ];
3769
+ DrChatFormComponent.propDecorators = {
3770
+ message: [{ type: Input }],
3771
+ messagePlaceholder: [{ type: Input }],
3772
+ dropFiles: [{ type: Input }],
3773
+ dropFilePlaceholder: [{ type: Input }],
3774
+ waitForReply: [{ type: Input }],
3775
+ send: [{ type: Output }],
3776
+ abort: [{ type: Output }],
3777
+ inputChange: [{ type: Output }],
3778
+ fileOver: [{ type: HostBinding, args: ['class.file-over',] }],
3779
+ onDrop: [{ type: HostListener, args: ['drop', ['$event'],] }],
3780
+ onDragOver: [{ type: HostListener, args: ['dragover', ['$event'],] }],
3781
+ onDragLeave: [{ type: HostListener, args: ['dragleave', ['$event'],] }]
3782
+ };
3783
+
3784
+ /**
3785
+ * `DrCustomMessageService` is used to store instances of `DrChatCustomMessageDirective`s which
3786
+ * were provided in the chat component.
3787
+ */
3788
+ class DrChatCustomMessageService {
3789
+ constructor() {
3790
+ this.customMessages = new Map();
3875
3791
  }
3876
- hideNotAvailableTags(tagWithSpecificDateTags, scenarioTags) {
3877
- var _a;
3878
- const subTags = (_a = find(scenarioTags, { type: TagTypes.DATE })) === null || _a === void 0 ? void 0 : _a.subTags;
3879
- if (!subTags.length)
3880
- return;
3881
- forEach(scenarioTags, (tag) => {
3882
- var _a;
3883
- if (!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length))
3884
- return;
3885
- if (tag !== tagWithSpecificDateTags) {
3886
- tag.toggle = false;
3887
- }
3888
- });
3889
- forEach(subTags, (subTag) => {
3890
- subTag.hidden = !tagWithSpecificDateTags.acceptableDateTags.includes(subTag.subType);
3891
- });
3792
+ register(type, instance) {
3793
+ this.customMessages.set(type, instance);
3892
3794
  }
3893
- getScenarioSelectedDateTag(scenario, dateTags) {
3894
- var _a, _b;
3895
- const monthSubType = (_b = (_a = find(dateTags, (tag) => tag.options.sub_type === TagsConfigSubType.MONTH)) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type;
3896
- const scenarioSelectedDateTag = {
3897
- [Scenario.ACTUALS]: () => monthSubType,
3898
- [Scenario.BUDGET]: () => { var _a, _b; return (_b = (_a = find(dateTags, (tag) => tag.options.sub_type === TagsConfigSubType.YEAR)) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type; },
3899
- [Scenario.FORECAST]: () => { var _a, _b; return (_b = (_a = find(dateTags, (tag) => tag.options.sub_type === TagsConfigSubType.FORECAST_NEW)) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type; },
3900
- [Scenario.NONE]: () => monthSubType,
3901
- };
3902
- if (!scenarioSelectedDateTag[scenario])
3903
- return;
3904
- return scenarioSelectedDateTag[scenario]();
3795
+ unregister(type) {
3796
+ return this.customMessages.delete(type);
3905
3797
  }
3906
- getScenarioTagsConfig(scenario, tagsConfig) {
3907
- return reduce(tagsConfig, (acc, tagConfig) => {
3908
- var _a;
3909
- const tagSubType = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.options) === null || _a === void 0 ? void 0 : _a.sub_type;
3910
- const scenarioTagDataConfig = getScenarioTagDataConfig(this.isMultipleDimension);
3911
- const scenarioTagConfig = scenarioTagDataConfig && scenarioTagDataConfig[scenario] ?
3912
- scenarioTagDataConfig[scenario][tagSubType] : null;
3913
- if (!scenarioTagConfig || scenarioTagConfig.hidden)
3914
- return acc;
3915
- const clonedTagConfig = cloneDeep(tagConfig);
3916
- const scenarioTag = Object.assign(Object.assign({}, clonedTagConfig), { scenarioData: scenarioTagConfig });
3917
- acc.push(scenarioTag);
3918
- return acc;
3919
- }, []);
3798
+ getInstance(type) {
3799
+ return this.customMessages.get(type);
3920
3800
  }
3921
3801
  }
3922
- ScenarioService.decorators = [
3802
+ DrChatCustomMessageService.decorators = [
3923
3803
  { type: Injectable }
3924
3804
  ];
3925
3805
 
3926
- class DrSharedUtils {
3806
+ class DrChatMessageComponent {
3807
+ constructor(customMessageService) {
3808
+ this.customMessageService = customMessageService;
3809
+ this.MESSAGE_TYPE = CHAT_MESSAGE_TYPE;
3810
+ this._reply = false;
3811
+ }
3812
+ get flyInOut() {
3813
+ return true;
3814
+ }
3815
+ get notReply() {
3816
+ return !this.reply;
3817
+ }
3927
3818
  /**
3928
- * Get timeframe (day, year, month, quarter) based on passed format
3929
- *
3930
- * @param format - date format string. Examples: MM/DD/YYYY, Q/YYYY
3819
+ * Determines if a message is a reply
3931
3820
  */
3932
- static getTimeframeByDateFormat(format) {
3933
- const defaultFrame = TimeframeOption.DAY;
3934
- if (!format) {
3935
- return defaultFrame;
3936
- }
3937
- const lowerCaseFormat = format.toLowerCase();
3938
- switch (true) {
3939
- case lowerCaseFormat.includes('q'):
3940
- return TimeframeOption.QUARTER;
3941
- case lowerCaseFormat.includes('d'):
3942
- return TimeframeOption.DAY;
3943
- case lowerCaseFormat.includes('w'):
3944
- return TimeframeOption.WEEK;
3945
- case lowerCaseFormat.includes('m'):
3946
- return TimeframeOption.MONTH;
3947
- case lowerCaseFormat.includes('y'):
3948
- return TimeframeOption.YEAR;
3949
- default:
3950
- return defaultFrame;
3951
- }
3821
+ get reply() {
3822
+ return this._reply;
3952
3823
  }
3953
- static getDateByTag(tag) {
3954
- const todayDate = moment$9().utc().endOf('day');
3955
- switch (tag) {
3956
- case DateTags.TODAY:
3957
- return todayDate;
3958
- case DateTags.YESTERDAY:
3959
- todayDate.subtract(1, 'days');
3960
- return todayDate;
3961
- case DateTags.THIS_MONTH:
3962
- todayDate.endOf('month');
3963
- return todayDate;
3964
- case DateTags.PREV_MONTH:
3965
- todayDate.subtract(1, 'months').endOf('month');
3966
- return todayDate;
3824
+ set reply(value) {
3825
+ this._reply = !!value;
3826
+ }
3827
+ getTemplate() {
3828
+ this.customMessage = true;
3829
+ const customMessage = this.getCustomMessage(this.type);
3830
+ return customMessage.templateRef;
3831
+ }
3832
+ getTemplateContext() {
3833
+ return { $implicit: this.customMessageData, isReply: this.reply };
3834
+ }
3835
+ getCustomMessage(type) {
3836
+ const customMessageDirective = this.customMessageService.getInstance(type);
3837
+ if (!customMessageDirective) {
3838
+ throw new Error(`dr-chat: Can't find template for custom type '${type}'. ` +
3839
+ `Make sure you provide it in the chat component with *drCustomMessage='${type}'.`);
3967
3840
  }
3841
+ return customMessageDirective;
3968
3842
  }
3969
3843
  }
3970
-
3971
- // @ts-ignore
3972
- const moment$2 = require('moment');
3973
- class DrDatePickerService {
3974
- constructor() {
3975
- this.isTimeframeSelectionEnabled = false;
3976
- this.timeframe = TimeframeOption.DAY;
3977
- this.format$ = new BehaviorSubject(DateFromats.MAT_DEFAULT_DATE_FORMAT);
3978
- this.updatedQuarter$ = new Subject();
3979
- this.updatedDateAndClose$ = new Subject();
3980
- this.presetTag$ = new BehaviorSubject('');
3981
- this.onSameDaySelectedInCalendar$ = new Subject();
3982
- this.keepPresetTag = false;
3983
- this.isValueUpdating = false;
3984
- this.availableTimeframes = [
3985
- TimeframeOption.DAY,
3986
- TimeframeOption.WEEK,
3987
- TimeframeOption.MONTH,
3988
- TimeframeOption.QUARTER,
3989
- TimeframeOption.YEAR
3990
- ];
3991
- this.formatConfig = {
3992
- day: DateFromats.MAT_DEFAULT_DATE_FORMAT,
3993
- month: DateFromats.MONTH_YEAR_FORMAT,
3994
- year: DateFromats.YEAR_FORMAT,
3995
- quarter: DateFromats.QUARTER_FORMAT,
3996
- week: DateFromats.WEEK_FORMAT
3997
- };
3998
- this.fiscalYearMonthsModifier = 0;
3844
+ DrChatMessageComponent.decorators = [
3845
+ { type: Component, args: [{
3846
+ selector: 'dr-chat-message',
3847
+ template: "<ng-container *ngIf=\"message.avatarUrl; else userAvatar\">\n <div class=\"avatar\" [style.background-image]=\"'url(' + message.avatarUrl + ')'\"></div>\n</ng-container>\n<ng-template #userAvatar>\n <dr-avatar *ngIf=\"message.user\" [users]=\"message.user\"></dr-avatar>\n</ng-template>\n<div class=\"message\" [class.message--custom]=\"customMessage\">\n <ng-container [ngSwitch]=\"message.kind\">\n <dr-chat-message-text *ngSwitchCase=\"MESSAGE_TYPE.TEXT\" [message]=\"message\"></dr-chat-message-text>\n <dr-chat-message-file *ngSwitchCase=\"MESSAGE_TYPE.DOWNLOAD_FILE\" [message]=\"message\"></dr-chat-message-file>\n <ng-container *ngSwitchDefault>\n <ng-container [ngTemplateOutlet]=\"getTemplate()\" [ngTemplateOutletContext]=\"getTemplateContext()\"></ng-container>\n </ng-container>\n </ng-container>\n <div class=\"message__actions\" *ngIf=\"drChatMessageActions;\">\n <ng-container [ngTemplateOutlet]=\"drChatMessageActions\"></ng-container>\n </div>\n</div>\n",
3848
+ animations: [
3849
+ trigger('flyInOut', [
3850
+ state('in', style({ transform: 'translateX(0)' })),
3851
+ transition('void => *', [style({ transform: 'translateX(-100%)' }), animate(80)]),
3852
+ transition('* => void', [animate(80, style({ transform: 'translateX(100%)' }))]),
3853
+ ]),
3854
+ ],
3855
+ changeDetection: ChangeDetectionStrategy.OnPush,
3856
+ styles: [":host{position:relative;display:flex;flex-direction:row;width:100%;background:rgba(249,250,255,.7);border-top:1px solid #E5E5E5;padding:16px 24px}:host:first-child{border:none}:host:last-child{border-bottom:1px solid #E5E5E5}.reply+:host.reply,.not-reply+:host.not-reply{border-top:none;padding-top:0;padding-left:75px}.reply+:host.reply .avatar,.reply+:host.reply dr-avatar,.not-reply+:host.not-reply .avatar,.not-reply+:host.not-reply dr-avatar{display:none}:host.not-reply{background-color:#fff}:host .avatar{display:flex;width:28px;height:28px;background-color:#fff;border-radius:16px;flex-shrink:0;box-shadow:0 1px 3px 1px #0003;background-image:url(\"data:image/svg+xml,%3C%3Fxml version%3D%221.0%22 encoding%3D%22UTF-8%22%3F%3E%3Csvg id%3D%22Layer_1%22 data-name%3D%22Layer 1%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22 viewBox%3D%220 0 74 65%22%3E %3Cdefs%3E %3Cstyle%3E .cls-1%2C .cls-2%2C .cls-3 %7B fill%3A none%3B %7D .cls-4 %7B fill%3A url(%23linear-gradient)%3B %7D .cls-5 %7B fill%3A %234eb7df%3B %7D .cls-2 %7B stroke%3A %23a6a8aa%3B stroke-miterlimit%3A 10%3B stroke-width%3A .37px%3B %7D .cls-6 %7B fill%3A url(%23linear-gradient-3)%3B %7D .cls-7 %7B fill%3A url(%23linear-gradient-2)%3B %7D .cls-3 %7B clip-path%3A url(%23clippath)%3B %7D %3C%2Fstyle%3E %3CclipPath id%3D%22clippath%22%3E %3Crect class%3D%22cls-1%22 width%3D%2274%22 height%3D%2265%22%2F%3E %3C%2FclipPath%3E %3ClinearGradient id%3D%22linear-gradient%22 x1%3D%2224.26%22 y1%3D%22-3.79%22 x2%3D%2295.63%22 y2%3D%2288.82%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%220%22 stop-color%3D%22%237676ff%22%2F%3E %3Cstop offset%3D%22.18%22 stop-color%3D%22%235959ff%22%2F%3E %3Cstop offset%3D%22.35%22 stop-color%3D%22%235757e0%22%2F%3E %3Cstop offset%3D%22.61%22 stop-color%3D%22%234646ce%22%2F%3E %3Cstop offset%3D%22.84%22 stop-color%3D%22%234b4be4%22%2F%3E %3Cstop offset%3D%221%22 stop-color%3D%22%234444eb%22%2F%3E %3C%2FlinearGradient%3E %3ClinearGradient id%3D%22linear-gradient-2%22 x1%3D%2212.05%22 y1%3D%2277.06%22 x2%3D%2210.77%22 y2%3D%2213.85%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%22.45%22 stop-color%3D%22%232f92b8%22%2F%3E %3Cstop offset%3D%22.84%22 stop-color%3D%22%234eb7df%22%2F%3E %3Cstop offset%3D%221%22 stop-color%3D%22%234eb7df%22%2F%3E %3C%2FlinearGradient%3E %3ClinearGradient id%3D%22linear-gradient-3%22 x1%3D%2262.26%22 y1%3D%22-2.54%22 x2%3D%2261.76%22 y2%3D%2285.91%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%220%22 stop-color%3D%22%2336369b%22%2F%3E %3Cstop offset%3D%22.52%22 stop-color%3D%22%234848d0%22%2F%3E %3C%2FlinearGradient%3E %3C%2Fdefs%3E %3Cg class%3D%22cls-3%22%3E %3Cg%3E %3Cpath class%3D%22cls-4%22 d%3D%22m73.32%2C24.79v15.73c0%2C13.12-9.87%2C23.79-22%2C23.79h-21.32c-3.46-.06-6.25-3.11-6.25-6.87s2.79-6.81%2C6.25-6.87h21.32c5.13%2C0%2C9.29-4.51%2C9.29-10.05v-15.73c0-5.54-4.17-10.05-9.29-10.05h-7.46c3.51%2C0%2C6.35-3.08%2C6.35-6.88s-2.79-6.8-6.25-6.87h7.35c12.12%2C0%2C22%2C10.67%2C22%2C23.79h0Z%22%2F%3E %3Cpath class%3D%22cls-5%22 d%3D%22m50.26%2C7.82c0%2C3.8-2.9%2C6.93-6.41%2C6.93h-21.86c-5.13%2C0-9.29%2C4.51-9.29%2C10.05v15.73c0%2C5.54%2C4.17%2C10.05%2C9.29%2C10.05h8.01c-3.46.06-6.25%2C3.11-6.25%2C6.87s2.79%2C6.81%2C6.25%2C6.87h-8.01c-12.12%2C0-22-10.67-22-23.79v-15.73C0%2C11.68%2C9.87%2C1%2C21.99%2C1h21.97c3.46.06%2C6.3%2C3.06%2C6.3%2C6.82Z%22%2F%3E %3Cpath class%3D%22cls-2%22 d%3D%22m66.45%2C1h-.22.22%2C0Z%22%2F%3E %3Cpath class%3D%22cls-2%22 d%3D%22m36.05%2C50.58h-.22.22%2C0Z%22%2F%3E %3Cpath class%3D%22cls-7%22 d%3D%22m0%2C33.78v-2.76C0%2C12.9%2C13.62%2C14.48%2C13.62%2C14.48h8.38c-5.5.46-9.5%2C4.71-9.5%2C9.96l.02%2C15.8c0%2C5.54%2C4.44%2C10.59%2C9.48%2C10.59l-8-.5S0%2C51.88%2C0%2C33.77h0Z%22%2F%3E %3Cpath class%3D%22cls-6%22 d%3D%22m73%2C31.51v2.76c0%2C18.12-13.62%2C16.53-13.62%2C16.53h-7.99c5.61-.85%2C9.09-4.76%2C9.09-10.02l.02-16.33c0-5.54-4.46-10-9.5-10h8s13.99-1.05%2C13.99%2C17.07h0Z%22%2F%3E %3C%2Fg%3E %3C%2Fg%3E%3C%2Fsvg%3E\");background-size:20px 22px;background-repeat:no-repeat;background-position-x:4px;background-position-y:3px}:host .avatar,:host dr-avatar{margin:0 23px 0 0}:host .message{display:flex;align-items:center;flex-grow:1}:host .message__actions{display:flex;align-items:center;margin-left:24px;flex-grow:1;justify-content:flex-end}:host .message__actions::ng-deep button:not(:hover) i[class*=dr-icon]{color:#b9b9ec!important}\n"]
3857
+ },] }
3858
+ ];
3859
+ DrChatMessageComponent.ctorParameters = () => [
3860
+ { type: DrChatCustomMessageService }
3861
+ ];
3862
+ DrChatMessageComponent.propDecorators = {
3863
+ flyInOut: [{ type: HostBinding, args: ['@flyInOut',] }],
3864
+ notReply: [{ type: HostBinding, args: ['class.not-reply',] }],
3865
+ reply: [{ type: Input }, { type: HostBinding, args: ['class.reply',] }],
3866
+ type: [{ type: Input }],
3867
+ message: [{ type: Input }],
3868
+ customMessageData: [{ type: Input }],
3869
+ user: [{ type: Input }],
3870
+ drChatMessageActions: [{ type: ContentChild, args: ['drChatMessageActions',] }]
3871
+ };
3872
+
3873
+ class DrChatSuggestionsComponent {
3874
+ constructor(cdr) {
3875
+ this.cdr = cdr;
3876
+ this._nonHiddenValues = [];
3877
+ this.visibleValues = [];
3878
+ this.isSuggestedMenuOpen = false;
3879
+ this.values = [];
3880
+ this.fullScreen = false;
3881
+ this.buttonMode = false;
3882
+ /**
3883
+ * Parameter to check is send message function available
3884
+ *
3885
+ * @type {boolean}
3886
+ */
3887
+ this.waitForReply = false;
3888
+ this.suggestionSelect = new EventEmitter();
3999
3889
  }
4000
- getDisplayPrefix() {
4001
- const formatCached = this.format$.getValue();
4002
- switch (true) {
4003
- case formatCached === null || formatCached === void 0 ? void 0 : formatCached.includes('Q'):
4004
- return 'Q';
4005
- case formatCached === null || formatCached === void 0 ? void 0 : formatCached.includes('W'):
4006
- return 'W';
4007
- default:
4008
- return '';
4009
- }
3890
+ get hiddenValues() {
3891
+ return JSON.parse(localStorage.getItem('aiChatSuggestions')) || [];
4010
3892
  }
4011
- getTimeframe(format) {
4012
- return DrSharedUtils.getTimeframeByDateFormat(format);
3893
+ set hiddenValues(values) {
3894
+ localStorage.setItem('aiChatSuggestions', JSON.stringify(values));
4013
3895
  }
4014
- getConfiguredFormat(timeframe) {
4015
- return this.formatConfig[timeframe];
3896
+ ngOnInit() {
3897
+ this.filterValues();
4016
3898
  }
4017
- updateTimeframeAndFormat(format) {
4018
- const normalizedFormat = this.normalizeValue(format || this.format$.getValue());
4019
- this.timeframe = this.getTimeframe(normalizedFormat);
4020
- this.format$.next(this.getConfiguredFormat(this.timeframe));
3899
+ onItemClick(item) {
3900
+ if (this.waitForReply) {
3901
+ return;
3902
+ }
3903
+ this.isSuggestedMenuOpen = false;
3904
+ this.suggestionSelect.emit(item);
3905
+ this.hiddenValues = [...this.hiddenValues, item];
3906
+ this.filterValues();
4021
3907
  }
4022
- normalizeValue(value) {
4023
- return value.replace(/d/g, 'D');
3908
+ filterValues() {
3909
+ const hiddenValues = this.hiddenValues;
3910
+ this._nonHiddenValues = _.filter(this.values, val => !hiddenValues.includes(val));
3911
+ this.fillVisibleValues();
4024
3912
  }
4025
- /**
4026
- * Get quarter number for date according to fiscal year
4027
- *
4028
- * @param date
4029
- */
4030
- getQuarterAccordingToFiscalYear(date) {
4031
- let fiscalMonth = this.fiscalYearMonthsModifier;
4032
- const dateMonth = date.month();
4033
- if (dateMonth < fiscalMonth) {
4034
- fiscalMonth -= 12;
3913
+ fillVisibleValues() {
3914
+ const maxItemsCount = this.fullScreen ? 6 : 4;
3915
+ const nonHiddenValues = _.clone(this._nonHiddenValues);
3916
+ this.visibleValues.length = 0;
3917
+ for (let i = 0; i < maxItemsCount; i++) {
3918
+ if (!nonHiddenValues.length) {
3919
+ break;
3920
+ }
3921
+ const randomIndex = Math.floor(Math.random() * nonHiddenValues.length);
3922
+ const item = nonHiddenValues.splice(randomIndex, 1)[0];
3923
+ this.visibleValues.push(item);
4035
3924
  }
4036
- return Math.trunc((date.month() - fiscalMonth) / 3) + 1;
3925
+ this.cdr.markForCheck();
4037
3926
  }
4038
- /**
4039
- * Sets date to end of quarter in FY by passed quarter number
4040
- *
4041
- * @param date
4042
- * @param quarterNumber
4043
- */
4044
- setEndOfQuarter(date, quarterNumber) {
4045
- date
4046
- .subtract(this.fiscalYearMonthsModifier, 'M')
4047
- .startOf('year')
4048
- .add(this.fiscalYearMonthsModifier + quarterNumber * 3 - 1, 'M')
4049
- .endOf('month');
3927
+ clearHidden() {
3928
+ localStorage.setItem('aiChatSuggestions', null);
3929
+ this.filterValues();
4050
3930
  }
4051
- /**
4052
- * Sets date to start of quarter in FY by passed quarter number
4053
- *
4054
- * @param date
4055
- * @param quarterNumber
4056
- */
4057
- setStartOfQuarter(date, quarterNumber) {
4058
- date
4059
- .subtract(this.fiscalYearMonthsModifier, 'M')
4060
- .startOf('year')
4061
- .add(this.fiscalYearMonthsModifier + (quarterNumber - 1) * 3, 'M');
3931
+ toggleSuggestedMenu() {
3932
+ this.isSuggestedMenuOpen = !this.isSuggestedMenuOpen;
3933
+ if (this.isSuggestedMenuOpen) {
3934
+ this.fillVisibleValues();
3935
+ }
3936
+ this.cdr.markForCheck();
4062
3937
  }
4063
- /**
4064
- * Sets date to end of current quarter (in which date is located) according to FY
4065
- *
4066
- * @param date
4067
- */
4068
- setEndOfCurrentQuarter(date) {
4069
- this.setEndOfQuarter(date, this.getQuarterAccordingToFiscalYear(date));
3938
+ }
3939
+ DrChatSuggestionsComponent.decorators = [
3940
+ { type: Component, args: [{
3941
+ selector: 'dr-chat-suggestions',
3942
+ template: "<div class=\"chat-suggestions\">\n <ng-container *ngIf=\"buttonMode; else suggestionCards\">\n <div class=\"chat-suggestions__container\"\n [class.chat-suggestions__container--opened]=\"isSuggestedMenuOpen\"\n *ngIf=\"visibleValues.length\">\n <dr-button theme=\"ghost\" class=\"chat-suggestions__container__button\" (click)=\"toggleSuggestedMenu()\">\n Suggested chats\n </dr-button>\n <ng-container *ngTemplateOutlet=\"suggestionCards\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n<ng-template #suggestionCards>\n <div class=\"chat-suggestions__items\">\n <div class=\"chat-suggestions__items__background\"></div>\n <div *ngFor=\"let item of visibleValues\"\n class=\"chat-suggestions__items__item\" (click)=\"onItemClick(item)\">\n {{ item }}\n </div>\n </div>\n</ng-template>\n",
3943
+ changeDetection: ChangeDetectionStrategy.OnPush,
3944
+ styles: [":host{display:flex;align-items:flex-start;justify-content:center}:host .chat-suggestions{display:flex;width:100%;max-width:970px}:host .chat-suggestions__container{display:flex;position:relative;width:auto;margin-top:12px;padding:0 24px}:host .chat-suggestions__container__button{z-index:3}:host .chat-suggestions__container__button::ng-deep button{background:#F2F2FB!important;border-radius:4px;cursor:pointer}:host .chat-suggestions__container .chat-suggestions__items{display:none;position:absolute;width:100%;bottom:0;left:0;padding-bottom:32px;z-index:2}:host .chat-suggestions__container--opened{width:100%}:host .chat-suggestions__container--opened .chat-suggestions__container__button::ng-deep button{color:#4646ce;background:#F2F2FB}:host .chat-suggestions__container--opened .chat-suggestions__items,:host .chat-suggestions__container--opened .chat-suggestions__items__background{display:flex}:host .chat-suggestions__items{display:flex;flex-wrap:wrap;width:100%;justify-content:space-between;padding:0 24px}:host .chat-suggestions__items__background{display:none;position:absolute;top:-32px;right:0;bottom:32px;left:0;background:#FFFFFF;opacity:.7;z-index:-1}:host .chat-suggestions__items__item{margin:0 0 20px;display:inline-flex;height:76px;width:275px;padding:16px;border-radius:8px;background:#F2F2FB;box-shadow:0 1px 2px #00000026;font-size:14px;line-height:24px;color:#25258c}:host .chat-suggestions__items__item:hover{cursor:pointer;background:#EAEAFF}\n"]
3945
+ },] }
3946
+ ];
3947
+ DrChatSuggestionsComponent.ctorParameters = () => [
3948
+ { type: ChangeDetectorRef }
3949
+ ];
3950
+ DrChatSuggestionsComponent.propDecorators = {
3951
+ values: [{ type: Input }],
3952
+ fullScreen: [{ type: Input }],
3953
+ buttonMode: [{ type: Input }],
3954
+ waitForReply: [{ type: Input }],
3955
+ suggestionSelect: [{ type: Output }]
3956
+ };
3957
+
3958
+ class DrChatComponent {
3959
+ constructor(cdr) {
3960
+ this.cdr = cdr;
3961
+ this.destroy$ = new Subject();
3962
+ this.showClearButton = true;
3963
+ this.noMessagesPlaceholder = 'No messages yet.';
3964
+ this._scrollBottom = true;
3965
+ this.suggestions = [];
3966
+ /**
3967
+ * Parameter to check is send message function available
3968
+ *
3969
+ * @type {boolean}
3970
+ */
3971
+ this.waitForReply = false;
3972
+ this.clear = new EventEmitter();
3973
+ this.close = new EventEmitter();
3974
+ this.suggestionSelect = new EventEmitter();
4070
3975
  }
4071
- /**
4072
- * Sets date to start of current quarter (in which date is located) according to FY
4073
- *
4074
- * @param date
4075
- */
4076
- setStartOfCurrentQuarter(date) {
4077
- this.setStartOfQuarter(date, this.getQuarterAccordingToFiscalYear(date));
3976
+ set contentUpdateSubject(value) {
3977
+ if (value) {
3978
+ value.pipe(takeUntil(this.destroy$)).subscribe(() => {
3979
+ this.updateView();
3980
+ });
3981
+ }
4078
3982
  }
3983
+ ;
4079
3984
  /**
4080
- * If date selection on this timeframe depends on Fiscal Year
4081
- *
4082
- * @param timeframe
3985
+ * Scroll chat to the bottom of the list when a new message arrives
4083
3986
  */
4084
- isTimeframeDependingOnFY(timeframe) {
4085
- return _.includes([TimeframeOption.QUARTER, TimeframeOption.YEAR], timeframe);
3987
+ get scrollBottom() {
3988
+ return this._scrollBottom;
4086
3989
  }
4087
- /**
4088
- * Subtract from date fiscal year shift months count
4089
- *
4090
- * @param date
4091
- */
4092
- subtractFiscalYearMonthsFromDate(date) {
4093
- return this.getDateModifiedByFiscalMonths(date, true);
3990
+ set scrollBottom(value) {
3991
+ this._scrollBottom = !!value;
4094
3992
  }
4095
- /**
4096
- * Add to date fiscal year shift months count
4097
- *
4098
- * @param date
4099
- */
4100
- addFiscalYearMonthsToDate(date) {
4101
- return this.getDateModifiedByFiscalMonths(date);
3993
+ get messagesContainerWithScroll() {
3994
+ return this.messagesContainer && this.messagesContainer.nativeElement.scrollHeight > this.messagesContainer.nativeElement.offsetHeight;
4102
3995
  }
4103
- /**
4104
- * Add or subtract depending on isRevert paremeter Fiscal year month shift
4105
- *
4106
- * @param date
4107
- * @param isSubtract
4108
- */
4109
- getDateModifiedByFiscalMonths(date, isSubtract = false) {
4110
- return date ? _.cloneDeep(date)[isSubtract ? 'subtract' : 'add'](this.fiscalYearMonthsModifier, 'month') : date;
3996
+ ;
3997
+ ngAfterViewInit() {
3998
+ this.messages.changes.subscribe(messages => {
3999
+ this.messages = messages;
4000
+ this.updateView();
4001
+ });
4002
+ this.updateView();
4111
4003
  }
4112
- updateDatePickerByPreset(tag, calender) {
4113
- this.keepPresetTag = true;
4114
- let date = null;
4115
- if (tag) {
4116
- date = DrSharedUtils.getDateByTag(tag);
4117
- switch (tag) {
4118
- case DateTags.TODAY:
4119
- this.updateTimeframeAndFormat(DateFromats.MAT_DEFAULT_DATE_FORMAT);
4120
- break;
4121
- case DateTags.YESTERDAY:
4122
- this.updateTimeframeAndFormat(DateFromats.MAT_DEFAULT_DATE_FORMAT);
4123
- break;
4124
- case DateTags.THIS_MONTH:
4125
- this.updateTimeframeAndFormat(DateFromats.MONTH_YEAR_FORMAT);
4126
- this.selectDateInCalendarMonthView(date, calender);
4127
- break;
4128
- case DateTags.PREV_MONTH:
4129
- this.updateTimeframeAndFormat(DateFromats.MONTH_YEAR_FORMAT);
4130
- this.selectDateInCalendarMonthView(date, calender);
4131
- break;
4132
- }
4004
+ updateView() {
4005
+ if (this.scrollBottom) {
4006
+ this.scrollListBottom();
4133
4007
  }
4134
- this.presetTag$.next(tag);
4135
- this.updatedDateAndClose$.next(date);
4136
4008
  }
4137
- selectDateInCalendarMonthView(date, calender) {
4009
+ scrollListBottom() {
4138
4010
  setTimeout(() => {
4139
- const monthView = calender.monthView;
4140
- if (monthView) {
4141
- monthView._activeDate = date;
4142
- monthView._selected = date;
4143
- monthView._init();
4144
- }
4145
- });
4146
- }
4147
- resetPresetTag() {
4148
- if (!this.keepPresetTag) {
4149
- this.presetTag$.next(null);
4150
- }
4151
- else {
4152
- this.keepPresetTag = false;
4153
- }
4154
- }
4155
- }
4156
- DrDatePickerService.decorators = [
4157
- { type: Injectable }
4158
- ];
4159
-
4160
- // @ts-ignore
4161
- const moment$1 = require('moment');
4162
- class DrDatePickerCustomHeaderComponent {
4163
- constructor(_calendar, _dateAdapter, _dateFormats, cdr, datePickerService) {
4164
- this._calendar = _calendar;
4165
- this._dateAdapter = _dateAdapter;
4166
- this._dateFormats = _dateFormats;
4167
- this.cdr = cdr;
4168
- this.datePickerService = datePickerService;
4169
- this._destroyed = new Subject();
4170
- this.quarters = [1, 2, 3, 4];
4171
- this.selectedQuarter = 1;
4172
- this.timeframeOptions = [{
4173
- timeframe: TimeframeOption.DAY,
4174
- title: 'Day',
4175
- value: CalendarView.FOR_DAYS,
4176
- format: this.datePickerService.formatConfig.day,
4177
- periodLabel: () => this._dateAdapter.format(this._calendar.activeDate, this._dateFormats.display.monthYearLabel).toLocaleUpperCase()
4178
- }, {
4179
- timeframe: TimeframeOption.WEEK,
4180
- title: 'Week',
4181
- value: CalendarView.FOR_DAYS,
4182
- format: this.datePickerService.formatConfig.week,
4183
- periodLabel: () => this._dateAdapter.format(this._calendar.activeDate, this._dateFormats.display.monthYearLabel).toLocaleUpperCase()
4184
- }, {
4185
- timeframe: TimeframeOption.MONTH,
4186
- title: 'Month',
4187
- value: CalendarView.FOR_MONTHS,
4188
- format: this.datePickerService.formatConfig.month,
4189
- periodLabel: () => String(moment$1(this._calendar.activeDate).utc().year())
4190
- }, {
4191
- timeframe: TimeframeOption.QUARTER,
4192
- title: 'Quarter',
4193
- value: CalendarView.FOR_QUARTERS,
4194
- format: this.datePickerService.formatConfig.quarter,
4195
- periodLabel: () => String(moment$1(this.datePickerService.subtractFiscalYearMonthsFromDate(this._calendar.activeDate)).utc().year())
4196
- }, {
4197
- timeframe: TimeframeOption.YEAR,
4198
- title: 'Year',
4199
- value: CalendarView.FOR_YEARS,
4200
- format: this.datePickerService.formatConfig.year,
4201
- periodLabel: () => {
4202
- const currentYear = moment$1(this.datePickerService.subtractFiscalYearMonthsFromDate(this._calendar.activeDate)).utc().year();
4203
- const startPeriod = Math.floor(currentYear / 24) * 24;
4204
- return startPeriod + '-' + (startPeriod + 23);
4011
+ if (this.messagesContainer) {
4012
+ const scrollToOptions = {
4013
+ top: this.messagesContainer.nativeElement.scrollHeight,
4014
+ };
4015
+ if (!this.reopen) {
4016
+ scrollToOptions.behavior = 'smooth';
4205
4017
  }
4206
- }];
4207
- this.pagingSetup = {
4208
- [CalendarView.FOR_MONTHS]: (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
4209
- [CalendarView.FOR_QUARTERS]: (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
4210
- [CalendarView.FOR_DAYS]: (forward) => this.pagingDateChange('addCalendarMonths', 1, forward),
4211
- [CalendarView.FOR_YEARS]: (forward) => this.pagingDateChange('addCalendarYears', 24, forward)
4212
- };
4213
- this.selectedTimeframe = CalendarView.FOR_DAYS;
4214
- this.timeframeSelection = false;
4215
- this.periodMonthLabel = '';
4216
- this.periodYearLabel = '';
4217
- this.presetTagList = PRESET_TAGS_LIST;
4218
- this.calendarView = CalendarView;
4219
- _calendar.stateChanges.pipe(takeUntil(this._destroyed)).subscribe(() => this.setPeriodLabels());
4220
- this.datePickerService.format$.pipe(takeUntil(this._destroyed)).subscribe(value => {
4221
- this.selectedTimeframe = this.timeframeOptions.filter(option => option.format === value)[0].value;
4222
- _calendar.currentView = this.selectedTimeframe;
4223
- this.setPeriodLabels();
4224
- if (this.selectedTimeframe === CalendarView.FOR_QUARTERS) {
4225
- this.selectedQuarter = this.datePickerService.getQuarterAccordingToFiscalYear(this._calendar.activeDate);
4226
- }
4227
- });
4228
- _calendar.viewChanged.pipe(takeUntil(this._destroyed)).subscribe(() => {
4229
- this.setPeriodLabels();
4230
- if (_calendar.multiYearView) {
4231
- this.transformDateInMultiyearViewAccordingToFY();
4232
- }
4233
- });
4234
- _calendar._userSelection.subscribe(date => {
4235
- if (!this.datePickerService.isValueUpdating) {
4236
- this.datePickerService.onSameDaySelectedInCalendar$.next(date.value);
4237
- }
4238
- });
4239
- this.datePickerService.calendarInstance = _calendar;
4240
- }
4241
- get selectedPresetTag() {
4242
- return this.datePickerService.presetTag$.getValue();
4243
- }
4244
- ;
4245
- ngOnInit() {
4246
- setTimeout(() => {
4247
- if (this._calendar.multiYearView) {
4248
- this.transformDateInMultiyearViewAccordingToFY();
4018
+ this.messagesContainer.nativeElement.scrollTo(scrollToOptions);
4019
+ this.cdr.markForCheck();
4249
4020
  }
4250
4021
  });
4251
4022
  }
4252
4023
  ngOnDestroy() {
4253
- this._destroyed.next();
4254
- this._destroyed.complete();
4255
- }
4256
- setPeriodLabels() {
4257
- const currentTimeframeOption = this.timeframeOptions.filter(option => option.value === this._calendar.currentView)[0];
4258
- const fullPeriodLabel = currentTimeframeOption.periodLabel();
4259
- if (this._calendar.currentView === CalendarView.FOR_DAYS) {
4260
- this.periodMonthLabel = fullPeriodLabel.slice(0, 3);
4261
- this.periodYearLabel = fullPeriodLabel.slice(4);
4262
- }
4263
- else {
4264
- this.periodMonthLabel = '';
4265
- this.periodYearLabel = fullPeriodLabel;
4266
- }
4267
- this.cdr.markForCheck();
4268
- }
4269
- setTimeframe(value) {
4270
- if (value !== this.selectedTimeframe) {
4271
- this.datePickerService.resetPresetTag();
4272
- }
4273
- this.selectedTimeframe = value;
4274
- this.timeframeSelection = false;
4275
- this._calendar.currentView = this.selectedTimeframe;
4276
- const chosenTimeframeOption = this.timeframeOptions.filter(option => option.value === this.selectedTimeframe)[0];
4277
- this.datePickerService.updateTimeframeAndFormat(chosenTimeframeOption.format);
4278
- if (this.selectedTimeframe === CalendarView.FOR_QUARTERS) {
4279
- this.selectedQuarter = this.datePickerService.getQuarterAccordingToFiscalYear(this._calendar.activeDate);
4280
- }
4281
- }
4282
- get currentViewIsQuarter() {
4283
- return ![CalendarView.FOR_DAYS, CalendarView.FOR_MONTHS, CalendarView.FOR_YEARS].includes(this._calendar.currentView);
4284
- }
4285
- switchViewOnClickOnPeriodLabel(view) {
4286
- this._calendar.currentView = view;
4287
- }
4288
- onSelectQuarter(quarterNumber) {
4289
- this.selectedQuarter = quarterNumber;
4290
- this.datePickerService.setEndOfQuarter(this._calendar.activeDate, quarterNumber);
4291
- this.datePickerService.updatedQuarter$.next(this._calendar.activeDate);
4292
- this.datePickerService.datePickerInstance.close();
4024
+ this.destroy$.next();
4025
+ this.destroy$.complete();
4293
4026
  }
4294
- pagingClicked(forward) {
4295
- if (this.pagingSetup[this._calendar.currentView]) {
4296
- this.pagingSetup[this._calendar.currentView](forward);
4027
+ onClearClick($event) {
4028
+ this.clear.emit($event);
4029
+ if (this._chatSuggestions) {
4030
+ this._chatSuggestions.clearHidden();
4297
4031
  }
4298
4032
  }
4299
- pagingDateChange(actionCall, amount, forward) {
4300
- this._calendar.activeDate = this._dateAdapter[actionCall](this._calendar.activeDate, forward ? amount : -amount);
4301
- this.setPeriodLabels();
4302
- }
4303
- transformDateInMultiyearViewAccordingToFY() {
4304
- const multuYearView = this._calendar.multiYearView;
4305
- multuYearView._activeDate = this.datePickerService.subtractFiscalYearMonthsFromDate(multuYearView._activeDate);
4306
- multuYearView._selectedYear = multuYearView._activeDate.year();
4307
- multuYearView._init();
4308
- }
4309
- onSelectPresetTag(tag) {
4310
- if (tag.key === this.selectedPresetTag) {
4311
- this.datePickerService.presetTag$.next(null);
4312
- }
4313
- else {
4314
- this.datePickerService.presetTag$.next(tag.key);
4033
+ hideSuggestions() {
4034
+ if (this._chatSuggestions.isSuggestedMenuOpen) {
4035
+ this._chatSuggestions.toggleSuggestedMenu();
4315
4036
  }
4316
- this.datePickerService.updateDatePickerByPreset(this.selectedPresetTag, this._calendar);
4317
4037
  }
4318
4038
  }
4319
- DrDatePickerCustomHeaderComponent.decorators = [
4039
+ DrChatComponent.decorators = [
4320
4040
  { type: Component, args: [{
4321
- selector: 'dr-date-picker_custom-header.component',
4322
- template: "<div *ngIf=\"datePickerService.isTimeframeSelectionEnabled\" class=\"dr-datepicker__timeframe-select__wrapper\">\n\n <div *ngIf=\"datePickerService.isUsingDateTagPresets\" class=\"dr-datepicker-preset-date\">\n <div class=\"dr-datepicker-preset-date__tags\">\n <div *ngFor=\"let tag of presetTagList\" \n id=\"preset_tag\" \n class=\"dr-datepicker-preset-date__tags__tag\" \n (click)=\"onSelectPresetTag(tag)\" \n [ngClass]=\"{'dr-datepicker-preset-date__tags__tag--selected': tag.key === selectedPresetTag}\"\n [drTooltip]=\"selectedPresetTag === tag.key? 'Unselect preset' : ''\"\n [drTooltipPosition]=\"'top'\">\n {{ tag.label }}\n </div>\n </div>\n </div>\n <dr-select\n class=\"dr-datepicker__timeframe-select\"\n [ngModel]=\"selectedTimeframe\"\n [items]=\"timeframeOptions | drShowTimeframePipe: datePickerService.availableTimeframes\"\n bindLabel=\"title\"\n bindValue=\"value\"\n (ngModelChange)=\"setTimeframe($event)\">\n </dr-select>\n</div>\n\n<div class=\"dr-date-paging\">\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(false)\">\n <i class=\"dr-icon-arrow-left presentation_buttons-navigate_input\"></i>\n </div>\n <span class=\"example-header-label\">\n <span (click)=\"switchViewOnClickOnPeriodLabel(calendarView.FOR_MONTHS)\">{{ periodMonthLabel + ' ' }}</span>\n <span (click)=\"switchViewOnClickOnPeriodLabel(calendarView.FOR_YEARS)\">{{ periodYearLabel }}</span>\n </span>\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(true)\">\n <i class=\"dr-icon-arrow-right presentation_buttons-navigate_input\"></i>\n </div>\n</div>\n<div #quarterlyDatePicker class=\"dr-quarterly-datepicker\" *ngIf=\"currentViewIsQuarter\">\n <div *ngFor=\"let quarter of quarters\"\n class=\"quarter-selector\" (click)=\"onSelectQuarter(quarter)\"\n [class]=\"quarter === selectedQuarter ? 'selected' : ''\"\n >Q{{quarter}}</div>\n</div>\n\n",
4323
- changeDetection: ChangeDetectionStrategy.OnPush,
4324
- styles: [":host{height:54px;align-items:center;font-family:\"Poppins\";font-style:normal;font-weight:600;font-size:14px;line-height:22px}.dr-datepicker__timeframe-select__wrapper{background-color:#f9faff;padding:16px 32px;border-radius:18px 18px 0 0}.dr-datepicker-preset-date{display:flex;flex-direction:column}.dr-datepicker-preset-date__tags{display:flex;padding-bottom:21px;padding-top:10px;font-size:12px}.dr-datepicker-preset-date__tags__tag{cursor:pointer;font-weight:400;line-height:20px!important;padding:2px 8px;border:1px solid #9EA1AA;border-radius:18px;background:#FFFFFF;margin-right:4px}.dr-datepicker-preset-date__tags__tag--selected{color:#4646ce;background:#F2F2FB;border:1px solid #4646CE}.dr-date-paging{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:16px 32px;grid-gap:4px;gap:4px}.dr-date-paging.flip-page-button{width:20px;height:20px;padding:0;color:#4e566c}.dr-date-paging.flip-page-button:hover{border-radius:50%;background:#f2f2fb;color:#4646ce}.example-header-label{cursor:pointer}.dr-quarterly-datepicker{display:flex;justify-content:space-between;padding:10px}.dr-quarterly-datepicker .quarter-selector{display:block;width:74px;height:40px;text-align:center;border-radius:40px;font-weight:400;padding-top:9px}.dr-quarterly-datepicker .quarter-selector:hover{background:#f2f2fb;color:#4646ce;font-weight:600;cursor:pointer}.dr-quarterly-datepicker .quarter-selector.selected{background-color:#4646ce;color:#f3f7ff;font-weight:600}\n"]
4041
+ selector: 'dr-chat',
4042
+ template: "<div class=\"chat\" [class.chat--in-full-screen]=\"fullScreen\">\n <div class=\"chat__header\">\n <div class=\"chat__header__logo\"></div>\n\n <div class=\"chat__header__text\">\n <div class=\"chat__header__text__title\">{{ title }}</div>\n <div *ngIf=\"subtitle\" class=\"chat__header__text__subtitle\">{{ subtitle }}</div>\n </div>\n\n <dr-button *ngIf=\"showClearButton\"\n (click)=\"onClearClick($event)\"\n theme=\"icon\"\n icon=\"dr-icon-clear\"\n class=\"ml-auto\"\n drTooltip=\"Clear chat\">\n </dr-button>\n\n <dr-button *ngIf=\"!fullScreen\"\n (click)=\"close.emit($event)\"\n theme=\"icon\"\n icon=\"dr-icon-exit\"\n class=\"ml-4\"\n drTooltip=\"Close\">\n </dr-button>\n </div>\n\n <div *ngIf=\"!messages?.length\" class=\"chat__empty-state\">\n <span class=\"chat__empty-state__text\">{{ noMessagesPlaceholder }}</span>\n </div>\n\n <div *ngIf=\"messages?.length\" class=\"chat__messages\">\n <div #messagesContainer class=\"chat__messages__container\"\n [class.chat__messages__container--scroll]=\"messagesContainerWithScroll\">\n <ng-content select=\"dr-chat-message\"></ng-content>\n </div>\n </div>\n\n <dr-chat-suggestions *ngIf=\"suggestions?.length\"\n [values]=\"suggestions\"\n [fullScreen]=\"fullScreen\"\n [waitForReply]=\"waitForReply\"\n class=\"chat__suggestions\"\n [class.chat__suggestions--full-height]=\"fullScreen && !messages?.length\"\n [buttonMode]=\"!!messages?.length\"\n (suggestionSelect)=\"suggestionSelect.emit($event)\">\n </dr-chat-suggestions>\n\n <div class=\"form\">\n <ng-content select=\"dr-chat-form\"></ng-content>\n </div>\n</div>\n",
4043
+ providers: [DrChatCustomMessageService],
4044
+ styles: [":host{height:100%;width:100%;display:flex;flex-direction:column}.chat{position:relative;display:flex;flex-grow:1;flex-direction:column;height:100%;background-color:#fff;color:#4e566c;font-family:\"Poppins\",sans-serif;font-size:14px;font-weight:400;line-height:22px}.chat__header{display:flex;align-items:center;background-color:#f2f2ff;color:#25258c;padding:15px 24px;font-weight:400;font-size:20px;line-height:28px;box-shadow:0 1px 3px #0003;z-index:1}.chat__header__logo{display:flex;width:43px;height:38px;background:url(\"data:image/svg+xml,%3C%3Fxml version%3D%221.0%22 encoding%3D%22UTF-8%22%3F%3E%3Csvg id%3D%22Layer_1%22 data-name%3D%22Layer 1%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22 viewBox%3D%220 0 74 65%22%3E %3Cdefs%3E %3Cstyle%3E .cls-1%2C .cls-2%2C .cls-3 %7B fill%3A none%3B %7D .cls-4 %7B fill%3A url(%23linear-gradient)%3B %7D .cls-5 %7B fill%3A %234eb7df%3B %7D .cls-2 %7B stroke%3A %23a6a8aa%3B stroke-miterlimit%3A 10%3B stroke-width%3A .37px%3B %7D .cls-6 %7B fill%3A url(%23linear-gradient-3)%3B %7D .cls-7 %7B fill%3A url(%23linear-gradient-2)%3B %7D .cls-3 %7B clip-path%3A url(%23clippath)%3B %7D %3C%2Fstyle%3E %3CclipPath id%3D%22clippath%22%3E %3Crect class%3D%22cls-1%22 width%3D%2274%22 height%3D%2265%22%2F%3E %3C%2FclipPath%3E %3ClinearGradient id%3D%22linear-gradient%22 x1%3D%2224.26%22 y1%3D%22-3.79%22 x2%3D%2295.63%22 y2%3D%2288.82%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%220%22 stop-color%3D%22%237676ff%22%2F%3E %3Cstop offset%3D%22.18%22 stop-color%3D%22%235959ff%22%2F%3E %3Cstop offset%3D%22.35%22 stop-color%3D%22%235757e0%22%2F%3E %3Cstop offset%3D%22.61%22 stop-color%3D%22%234646ce%22%2F%3E %3Cstop offset%3D%22.84%22 stop-color%3D%22%234b4be4%22%2F%3E %3Cstop offset%3D%221%22 stop-color%3D%22%234444eb%22%2F%3E %3C%2FlinearGradient%3E %3ClinearGradient id%3D%22linear-gradient-2%22 x1%3D%2212.05%22 y1%3D%2277.06%22 x2%3D%2210.77%22 y2%3D%2213.85%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%22.45%22 stop-color%3D%22%232f92b8%22%2F%3E %3Cstop offset%3D%22.84%22 stop-color%3D%22%234eb7df%22%2F%3E %3Cstop offset%3D%221%22 stop-color%3D%22%234eb7df%22%2F%3E %3C%2FlinearGradient%3E %3ClinearGradient id%3D%22linear-gradient-3%22 x1%3D%2262.26%22 y1%3D%22-2.54%22 x2%3D%2261.76%22 y2%3D%2285.91%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%220%22 stop-color%3D%22%2336369b%22%2F%3E %3Cstop offset%3D%22.52%22 stop-color%3D%22%234848d0%22%2F%3E %3C%2FlinearGradient%3E %3C%2Fdefs%3E %3Cg class%3D%22cls-3%22%3E %3Cg%3E %3Cpath class%3D%22cls-4%22 d%3D%22m73.32%2C24.79v15.73c0%2C13.12-9.87%2C23.79-22%2C23.79h-21.32c-3.46-.06-6.25-3.11-6.25-6.87s2.79-6.81%2C6.25-6.87h21.32c5.13%2C0%2C9.29-4.51%2C9.29-10.05v-15.73c0-5.54-4.17-10.05-9.29-10.05h-7.46c3.51%2C0%2C6.35-3.08%2C6.35-6.88s-2.79-6.8-6.25-6.87h7.35c12.12%2C0%2C22%2C10.67%2C22%2C23.79h0Z%22%2F%3E %3Cpath class%3D%22cls-5%22 d%3D%22m50.26%2C7.82c0%2C3.8-2.9%2C6.93-6.41%2C6.93h-21.86c-5.13%2C0-9.29%2C4.51-9.29%2C10.05v15.73c0%2C5.54%2C4.17%2C10.05%2C9.29%2C10.05h8.01c-3.46.06-6.25%2C3.11-6.25%2C6.87s2.79%2C6.81%2C6.25%2C6.87h-8.01c-12.12%2C0-22-10.67-22-23.79v-15.73C0%2C11.68%2C9.87%2C1%2C21.99%2C1h21.97c3.46.06%2C6.3%2C3.06%2C6.3%2C6.82Z%22%2F%3E %3Cpath class%3D%22cls-2%22 d%3D%22m66.45%2C1h-.22.22%2C0Z%22%2F%3E %3Cpath class%3D%22cls-2%22 d%3D%22m36.05%2C50.58h-.22.22%2C0Z%22%2F%3E %3Cpath class%3D%22cls-7%22 d%3D%22m0%2C33.78v-2.76C0%2C12.9%2C13.62%2C14.48%2C13.62%2C14.48h8.38c-5.5.46-9.5%2C4.71-9.5%2C9.96l.02%2C15.8c0%2C5.54%2C4.44%2C10.59%2C9.48%2C10.59l-8-.5S0%2C51.88%2C0%2C33.77h0Z%22%2F%3E %3Cpath class%3D%22cls-6%22 d%3D%22m73%2C31.51v2.76c0%2C18.12-13.62%2C16.53-13.62%2C16.53h-7.99c5.61-.85%2C9.09-4.76%2C9.09-10.02l.02-16.33c0-5.54-4.46-10-9.5-10h8s13.99-1.05%2C13.99%2C17.07h0Z%22%2F%3E %3C%2Fg%3E %3C%2Fg%3E%3C%2Fsvg%3E\") no-repeat;background-size:100% 100%}.chat__header__text{display:flex;flex-direction:column;flex-grow:1;margin-left:20px}.chat__header__text__title{display:flex;align-items:center}.chat__header__text__title:after{content:\"BETA\";display:inline-flex;padding:2px 10px;background:#25258C;color:#f4f4f3;font-weight:600;font-size:10px;line-height:14px;border-radius:8px;margin-left:12px;font-family:\"Nunito Sans\",sans-serif}.chat__header__text__subtitle{font-size:14px;line-height:22px}.chat__header dr-button::ng-deep button:not(:hover){color:#25258c}.chat__empty-state{display:flex;justify-content:center}.chat__empty-state__text{padding:20px 0;font-family:Poppins,sans-serif;font-size:20px;font-weight:300;line-height:30px;text-align:center;max-width:440px;color:#4646ce}.chat__messages{display:flex;flex-grow:1;overflow-x:hidden;overflow-y:auto;height:100%;width:100%}.chat__messages__container{overflow-y:auto;overflow-x:hidden;display:flex;flex-shrink:0;flex-direction:column;width:100%;padding-bottom:1px}.chat__messages__container--scroll::ng-deep dr-chat-message{padding-right:16px}.chat__suggestions--full-height{flex-grow:1;height:1px;overflow:auto}.chat--in-full-screen .chat__header{padding-left:48px;padding-right:48px}.chat--in-full-screen .chat__empty-state__text{padding:77px 0;font-size:28px;line-height:46px;max-width:570px}.chat--in-full-screen .chat__messages::ng-deep dr-chat-message{justify-content:center}.chat--in-full-screen .chat__messages::ng-deep .message{max-width:919px}.chat--in-full-screen .chat__suggestions::ng-deep .chat-suggestions__items{padding-left:0;padding-right:0}.chat--in-full-screen .chat__suggestions::ng-deep .chat-suggestions__items__item{margin:0 0 26px;height:80px;width:310px;font-size:16px}.chat--in-full-screen .chat__suggestions::ng-deep .chat-suggestions__container{padding:0}\n"]
4325
4045
  },] }
4326
4046
  ];
4327
- DrDatePickerCustomHeaderComponent.ctorParameters = () => [
4328
- { type: MatCalendar },
4329
- { type: DateAdapter },
4330
- { type: CustomDateFormat, decorators: [{ type: Inject, args: [MAT_DATE_FORMATS,] }] },
4331
- { type: ChangeDetectorRef },
4332
- { type: DrDatePickerService }
4047
+ DrChatComponent.ctorParameters = () => [
4048
+ { type: ChangeDetectorRef }
4333
4049
  ];
4334
-
4335
- // @ts-ignore
4336
- const moment = require('moment');
4337
- const noop = () => {
4050
+ DrChatComponent.propDecorators = {
4051
+ fullScreen: [{ type: Input }],
4052
+ title: [{ type: Input }],
4053
+ subtitle: [{ type: Input }],
4054
+ showClearButton: [{ type: Input }],
4055
+ noMessagesPlaceholder: [{ type: Input }],
4056
+ contentUpdateSubject: [{ type: Input }],
4057
+ scrollBottom: [{ type: Input }],
4058
+ suggestions: [{ type: Input }],
4059
+ reopen: [{ type: Input }],
4060
+ waitForReply: [{ type: Input }],
4061
+ messagesContainer: [{ type: ViewChild, args: ['messagesContainer',] }],
4062
+ messages: [{ type: ContentChildren, args: [DrChatMessageComponent,] }],
4063
+ chatForm: [{ type: ContentChild, args: [DrChatFormComponent,] }],
4064
+ clear: [{ type: Output }],
4065
+ close: [{ type: Output }],
4066
+ suggestionSelect: [{ type: Output }],
4067
+ _chatSuggestions: [{ type: ViewChild, args: [DrChatSuggestionsComponent,] }]
4338
4068
  };
4339
- const ɵ0$2 = noop;
4340
- class DrDatePickerComponent {
4341
- constructor(cdr, dateAdapter, datePickerService) {
4342
- this.cdr = cdr;
4343
- this.dateAdapter = dateAdapter;
4344
- this.datePickerService = datePickerService;
4345
- // Whether to transform date, taking end, start, middle of preiod (i.e. set middle of month if timeframe='month')
4346
- this.periodPosition = DatePickerPeriodPosition.DEFAULT;
4347
- this.placeholder = 'Select...';
4348
- this.fiscalYearMonthsModifier = 0;
4349
- this.calendarViewsTimeframeMapping = {
4350
- year: 'multi-year',
4351
- month: 'year',
4352
- quarter: 'none',
4353
- day: 'month',
4354
- };
4355
- this.customHeader = DrDatePickerCustomHeaderComponent;
4356
- this.readonly = true;
4357
- this.timeframeOption = TimeframeOption;
4358
- this.innerValue = null;
4359
- this.destroyed$ = new Subject();
4360
- this.onTouchedCallback = noop;
4361
- this.onChangeCallback = noop;
4362
- // Should be as arrow function to avoid lose scope
4363
- this.dateFilter = (moment) => {
4364
- if (this.datepickerFilter && moment) {
4365
- return this.datepickerFilter(moment);
4366
- }
4367
- return true;
4368
- };
4369
- datePickerService.updatedQuarter$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
4370
- this.setValueFromMoment(value);
4371
- });
4372
- }
4373
- set format(value) {
4374
- this.datePickerService.updateTimeframeAndFormat(value);
4375
- }
4376
- set min(minDate) {
4377
- this._min = moment.unix(minDate).utc();
4378
- }
4379
- set max(maxDate) {
4380
- this._max = moment.unix(maxDate).utc();
4381
- }
4382
- get value() {
4383
- return this.innerValue;
4384
- }
4385
- set value(v) {
4386
- if (v !== this.innerValue) {
4387
- this.setValueFromMoment(v);
4388
- }
4389
- this.cdr.markForCheck();
4069
+
4070
+ var TooltipPosition;
4071
+ (function (TooltipPosition) {
4072
+ TooltipPosition["TOP"] = "top";
4073
+ TooltipPosition["BOTTOM"] = "bottom";
4074
+ TooltipPosition["LEFT"] = "left";
4075
+ TooltipPosition["RIGHT"] = "right";
4076
+ TooltipPosition["TOP_RIGHT"] = "top-right";
4077
+ TooltipPosition["TOP_LEFT"] = "top-left";
4078
+ TooltipPosition["BOTTOM_RIGHT"] = "bottom-right";
4079
+ TooltipPosition["BOTTOM_LEFT"] = "bottom-left";
4080
+ TooltipPosition["RIGHT_TOP"] = "right-top";
4081
+ TooltipPosition["RIGHT_BOTTOM"] = "right-bottom";
4082
+ TooltipPosition["LEFT_TOP"] = "left-top";
4083
+ TooltipPosition["LEFT_BOTTOM"] = "left-bottom";
4084
+ })(TooltipPosition || (TooltipPosition = {}));
4085
+
4086
+ var Scenario;
4087
+ (function (Scenario) {
4088
+ Scenario["ACTUALS"] = "Actuals";
4089
+ Scenario["FORECAST"] = "Forecast";
4090
+ Scenario["BUDGET"] = "Budget";
4091
+ Scenario["NONE"] = "None";
4092
+ })(Scenario || (Scenario = {}));
4093
+
4094
+ class DrModelDebounceChangeDirective {
4095
+ constructor(ngModel) {
4096
+ this.ngModel = ngModel;
4097
+ this.debounce = 200;
4098
+ this.ngModelDebounceChange = new EventEmitter();
4390
4099
  }
4391
- ngAfterViewInit() {
4392
- this.datePickerService.fiscalYearMonthsModifier = this.fiscalYearMonthsModifier;
4393
- this.datePickerService.datePickerInstance = this.datePicker;
4394
- this.datePicker.startView = this.calendarViewsTimeframeMapping[this.datePickerService.timeframe];
4100
+ ngOnInit() {
4101
+ this.subscription = this.ngModel.control.valueChanges.pipe(skip(1), debounceTime(this.debounce), distinctUntilChanged()).subscribe(value => this.ngModelDebounceChange.emit(value));
4395
4102
  }
4396
4103
  ngOnDestroy() {
4397
- this.destroyed$.next();
4398
- this.destroyed$.complete();
4399
- }
4400
- /**
4401
- * Updating component inner value according to datepicker timeframe (day, month etc.)
4402
- * and date position in period (start, end, middle)
4403
- */
4404
- tryToNormalaizeTimeframe() {
4405
- const timeframe = this.datePickerService.timeframe;
4406
- switch (this.periodPosition) {
4407
- case DatePickerPeriodPosition.START_OF_PERIOD:
4408
- if (this.datePickerService.timeframe === TimeframeOption.QUARTER) {
4409
- this.datePickerService.setStartOfCurrentQuarter(this.innerValue);
4410
- }
4411
- else if (this.datePickerService.timeframe === TimeframeOption.YEAR) {
4412
- this.datePickerService.setStartOfQuarter(this.innerValue, 1);
4413
- }
4414
- else {
4415
- this.innerValue.startOf(timeframe);
4416
- }
4417
- break;
4418
- case DatePickerPeriodPosition.END_OF_PERIOD:
4419
- if (this.datePickerService.timeframe === TimeframeOption.QUARTER) {
4420
- this.datePickerService.setEndOfCurrentQuarter(this.innerValue);
4421
- }
4422
- else if (this.datePickerService.timeframe === TimeframeOption.YEAR) {
4423
- this.datePickerService.setEndOfQuarter(this.innerValue, 4);
4424
- }
4425
- else {
4426
- this.innerValue.endOf(timeframe);
4427
- }
4428
- break;
4429
- case DatePickerPeriodPosition.MIDDLE_OF_PERIOD:
4430
- let endOfPeriod;
4431
- if (this.datePickerService.timeframe === TimeframeOption.QUARTER) {
4432
- endOfPeriod = this.innerValue.clone();
4433
- this.datePickerService.setStartOfCurrentQuarter(this.innerValue);
4434
- this.datePickerService.setEndOfCurrentQuarter(endOfPeriod);
4435
- }
4436
- else if (this.datePickerService.timeframe === TimeframeOption.YEAR) {
4437
- endOfPeriod = this.innerValue.clone();
4438
- this.datePickerService.setStartOfQuarter(this.innerValue, 1);
4439
- this.datePickerService.setEndOfQuarter(endOfPeriod, 4);
4440
- }
4441
- else {
4442
- this.innerValue.startOf(timeframe);
4443
- endOfPeriod = this.innerValue.clone().endOf(timeframe);
4444
- }
4445
- const diff = endOfPeriod.diff(this.innerValue, 'seconds');
4446
- this.innerValue.add(diff / 2 + 1, 'seconds');
4447
- break;
4448
- default:
4449
- this.innerValue.startOf(timeframe);
4450
- break;
4451
- }
4452
- }
4453
- chosenPeriodHandler(chosenDate, timeframe) {
4454
- if (timeframe === TimeframeOption.YEAR) {
4455
- chosenDate = this.datePickerService.addFiscalYearMonthsToDate(chosenDate);
4456
- }
4457
- if (this.datePickerService.timeframe === TimeframeOption.QUARTER && timeframe === TimeframeOption.YEAR) {
4458
- this.datePickerService.calendarInstance.currentView = CalendarView.FOR_QUARTERS;
4459
- this.datePickerService.calendarInstance.activeDate = chosenDate;
4460
- this.cdr.detectChanges();
4461
- }
4462
- else if (this.datePickerService.timeframe === timeframe) {
4463
- this.setValueFromMoment(chosenDate);
4464
- this.datePicker.close();
4465
- }
4466
- }
4467
- /**
4468
- * Setting value from outside of component via ngModel or formControl updates
4469
- */
4470
- writeValue(value) {
4471
- /*
4472
- * We need keep local timestamp for Electron Application
4473
- * Issue in electron: when we select date, date select with -1 (if we're choosing 2023, output will be 2022)
4474
- */
4475
- const convertedValue = document.is_electron ? moment.unix(value) : moment.unix(value).utc();
4476
- this.innerValue = value ? convertedValue : value;
4477
- if (this.innerValue) {
4478
- this.tryToNormalaizeTimeframe();
4479
- }
4480
- this.cdr.markForCheck();
4481
- }
4482
- registerOnChange(fn) {
4483
- this.onChangeCallback = fn;
4484
- }
4485
- registerOnTouched(fn) {
4486
- this.onTouchedCallback = fn;
4487
- }
4488
- /**
4489
- * Set inner value from Moment and propagate
4490
- *
4491
- * @param momentDate
4492
- */
4493
- setValueFromMoment(momentDate) {
4494
- this.setValue(momentDate.unix());
4495
- }
4496
- /**
4497
- * Set inner value from timestamp and propagate
4498
- *
4499
- * @param timestamp
4500
- */
4501
- setValue(timestamp) {
4502
- // isValueUpdating is required for manage clicks on same dates: if isValueUpdating - true then
4503
- // days are different and subscription on calendar day click action won't trigger Accessor ngModel update
4504
- // one more time
4505
- this.datePickerService.isValueUpdating = true;
4506
- this.writeValue(timestamp);
4507
- this.onChangeCallback(this.innerValue.unix());
4508
- setTimeout(() => {
4509
- this.datePickerService.isValueUpdating = false;
4510
- });
4104
+ this.subscription.unsubscribe();
4511
4105
  }
4512
4106
  }
4513
- DrDatePickerComponent.decorators = [
4514
- { type: Component, args: [{
4515
- selector: 'dr-date-picker',
4516
- template: "<i class=\"dr-icon-date\"></i>\n<input [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [matDatepickerFilter]=\"dateFilter\"\n [disabled]=\"disabled\"\n [placeholder]=\"placeholder\"\n [drDatePickerFormat]=\"datePickerService.format$ | async\"\n [readonly]=\"readonly\"\n [min]=\"_min\"\n [max]=\"_max\"/>\n<mat-datepicker #datePicker\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenPeriodHandler($event, timeframeOption.YEAR)\"\n (monthSelected)=\"chosenPeriodHandler($event, timeframeOption.MONTH)\">\n</mat-datepicker>\n",
4517
- changeDetection: ChangeDetectionStrategy.OnPush,
4518
- providers: [
4519
- { provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerComponent, multi: true },
4520
- DrDatePickerService
4521
- ],
4522
- 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 #9EA1AA;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:#9ea1aa}: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{display:flex;align-items:center;position:absolute;color:#999;left:8px;top:0;bottom:0}: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"]
4107
+ DrModelDebounceChangeDirective.decorators = [
4108
+ { type: Directive, args: [{
4109
+ selector: '[ngModelDebounceChange]'
4523
4110
  },] }
4524
4111
  ];
4525
- DrDatePickerComponent.ctorParameters = () => [
4526
- { type: ChangeDetectorRef },
4527
- { type: DateAdapter },
4528
- { type: DrDatePickerService }
4112
+ DrModelDebounceChangeDirective.ctorParameters = () => [
4113
+ { type: NgModel }
4529
4114
  ];
4530
- DrDatePickerComponent.propDecorators = {
4531
- format: [{ type: Input }],
4532
- min: [{ type: Input }],
4533
- max: [{ type: Input }],
4534
- periodPosition: [{ type: Input }],
4535
- placeholder: [{ type: Input }],
4536
- disabled: [{ type: Input }, { type: HostBinding, args: ['class.disabled',] }],
4537
- fiscalYearMonthsModifier: [{ type: Input }],
4538
- datepickerFilter: [{ type: Input }],
4539
- datePicker: [{ type: ViewChild, args: ['datePicker',] }]
4115
+ DrModelDebounceChangeDirective.propDecorators = {
4116
+ debounce: [{ type: Input }],
4117
+ ngModelDebounceChange: [{ type: Output }]
4540
4118
  };
4541
4119
 
4542
- class DrDatePickerWithTimeframeComponent extends DrDatePickerComponent {
4543
- constructor(cdr, dateAdapter, datePickerService) {
4544
- super(cdr, dateAdapter, datePickerService);
4545
- this.cdr = cdr;
4546
- this.dateAdapter = dateAdapter;
4547
- this.datePickerService = datePickerService;
4548
- this.isDashboardDatepicker = false;
4549
- this.canSelectTimeframe = true;
4550
- // eslint-disable-next-line
4551
- this.onChangeFormat = new EventEmitter();
4552
- this.onChangePresetTag = new EventEmitter();
4553
- this.pagingSetup = {
4554
- [TimeframeOption.YEAR]: (forward) => this.getNextDate('addCalendarYears', 1, forward),
4555
- [TimeframeOption.QUARTER]: (forward) => this.getNextDate('addCalendarMonths', 3, forward),
4556
- [TimeframeOption.MONTH]: (forward) => this.getNextDate('addCalendarMonths', 1, forward),
4557
- [TimeframeOption.DAY]: (forward) => this.getNextDate('addCalendarDays', 1, forward),
4558
- [TimeframeOption.WEEK]: (forward) => this.getNextDate('addCalendarDays', 7, forward)
4559
- };
4560
- this.isNextDateDisabled = false;
4561
- this.isPrevDateDisabled = false;
4562
- this.onChangeDebounced$ = new Subject();
4563
- datePickerService.isTimeframeSelectionEnabled = true;
4564
- datePickerService.format$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
4565
- this.onChangeFormat.emit(datePickerService.normalizeValue(value));
4566
- });
4567
- datePickerService.presetTag$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
4568
- let tagObj = PRESET_TAGS_LIST.find((val) => (val === null || val === void 0 ? void 0 : val.key) === value);
4569
- this.presetTagSelected = tagObj === null || tagObj === void 0 ? void 0 : tagObj.label;
4570
- this.onChangePresetTag.emit(value);
4571
- });
4572
- this.datePickerService.onSameDaySelectedInCalendar$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
4573
- this.setValueFromMoment(value);
4574
- });
4575
- datePickerService.updatedDateAndClose$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
4576
- if (value) {
4577
- this.setValueFromMoment(value);
4578
- }
4579
- else {
4580
- this.onChangeCallback(this.innerValue.unix());
4581
- }
4582
- this.datePicker.close();
4583
- });
4584
- }
4585
- get isDashboardClassDisplayed() {
4586
- return this.isDashboardDatepicker;
4587
- }
4588
- ;
4589
- set dateFormatConfig(value) {
4590
- if (value) {
4591
- this.datePickerService.formatConfig = Object.assign(Object.assign({}, this.datePickerService.formatConfig), value);
4592
- this.cdr.markForCheck();
4593
- }
4120
+ var BadgeStatus;
4121
+ (function (BadgeStatus) {
4122
+ BadgeStatus["INFO"] = "info";
4123
+ BadgeStatus["ERROR"] = "error";
4124
+ BadgeStatus["WARNING"] = "warning";
4125
+ BadgeStatus["SUCCESS"] = "success";
4126
+ BadgeStatus["REGULAR"] = "regular";
4127
+ BadgeStatus["PROGRESS"] = "progress";
4128
+ BadgeStatus["DOTTED"] = "dotted";
4129
+ })(BadgeStatus || (BadgeStatus = {}));
4130
+
4131
+ const allDateTags = {
4132
+ [TagsConfigSubType.YEAR]: {
4133
+ name: 'Date',
4134
+ toggle: false,
4135
+ },
4136
+ [TagsConfigSubType.QUARTER]: {
4137
+ name: 'Date',
4138
+ toggle: false,
4139
+ },
4140
+ [TagsConfigSubType.MONTH]: {
4141
+ name: 'Date',
4142
+ toggle: false,
4143
+ },
4144
+ [TagsConfigSubType.DAY]: {
4145
+ name: 'Date',
4146
+ toggle: false,
4147
+ },
4148
+ [TagsConfigSubType.WEEK]: {
4149
+ name: 'Date',
4150
+ toggle: false,
4594
4151
  }
4595
- set availableTimeframes(value) {
4596
- if (value && value.length) {
4597
- this.datePickerService.availableTimeframes = value;
4598
- }
4152
+ };
4153
+ function getScenarioTagDataConfig(isMultipleDimension) {
4154
+ return {
4155
+ [Scenario.ACTUALS]: Object.assign(Object.assign({}, allDateTags), { [TagsConfigSubType.MONTH]: {
4156
+ name: 'Date',
4157
+ toggle: true,
4158
+ }, [TagsConfigSubType.FILE_STATUS]: {
4159
+ toggle: false,
4160
+ } }),
4161
+ [Scenario.BUDGET]: {
4162
+ [TagsConfigSubType.BUDGET_CYCLE]: {
4163
+ toggle: true,
4164
+ acceptableDateTags: [TagsConfigSubType.YEAR],
4165
+ hidden: !isMultipleDimension,
4166
+ },
4167
+ [TagsConfigSubType.PLAN]: {
4168
+ toggle: false,
4169
+ turnOffDateTags: true,
4170
+ hidden: isMultipleDimension,
4171
+ },
4172
+ [TagsConfigSubType.YEAR]: {
4173
+ name: 'Date',
4174
+ toggle: true,
4175
+ },
4176
+ [TagsConfigSubType.QUARTER]: {
4177
+ name: 'Date',
4178
+ toggle: false,
4179
+ },
4180
+ [TagsConfigSubType.FILE_STATUS]: {
4181
+ toggle: false,
4182
+ },
4183
+ },
4184
+ [Scenario.FORECAST]: {
4185
+ [TagsConfigSubType.FORECAST_NEW]: {
4186
+ toggle: true,
4187
+ name: 'Date',
4188
+ },
4189
+ [TagsConfigSubType.FILE_STATUS]: {
4190
+ toggle: false,
4191
+ },
4192
+ },
4193
+ [Scenario.NONE]: Object.assign(Object.assign({}, allDateTags), { [TagsConfigSubType.MONTH]: {
4194
+ name: 'Date',
4195
+ toggle: true,
4196
+ }, [TagsConfigSubType.FILE_STATUS]: {
4197
+ toggle: true,
4198
+ } }),
4199
+ };
4200
+ }
4201
+
4202
+ class ScenarioService {
4203
+ constructor() {
4204
+ this.DEFAULT_FORECAST_DATE_TAG = 'Month';
4599
4205
  }
4600
- set isUsingDateTagPresets(flag) {
4601
- this.datePickerService.isUsingDateTagPresets = flag;
4206
+ get scenarios() {
4207
+ return orderBy(Object.values(Scenario), (scenario) => scenario === Scenario.NONE ? 1 : 0);
4602
4208
  }
4603
- set presetTag(tag) {
4604
- this.datePickerService.presetTag$.next(tag);
4209
+ get areExistingTagsConfig() {
4210
+ return !!this.currentTagsConfig;
4605
4211
  }
4606
- get value() {
4607
- return this.innerValue;
4212
+ initScenarioTags(wholeTagsConfig, currentTagsConfig, isMultipleDimension) {
4213
+ if (!(wholeTagsConfig === null || wholeTagsConfig === void 0 ? void 0 : wholeTagsConfig.length))
4214
+ return;
4215
+ this.wholeTagsConfig = cloneDeep(wholeTagsConfig);
4216
+ this.currentTagsConfig = currentTagsConfig;
4217
+ this.isMultipleDimension = isMultipleDimension;
4608
4218
  }
4609
- set value(v) {
4610
- this.setValueFromMoment(v);
4611
- this.cdr.markForCheck();
4219
+ getTagsConfigByScenarioTags(scenarioTags, tagsConfig) {
4220
+ const scenarioTagsConfig = filter$1(tagsConfig, (tagConfig) => some(scenarioTags, (scenarioTag) => scenarioTag.toggle && scenarioTag.selectedTagSubType === tagConfig.options.sub_type));
4221
+ return this.sortScenarioTags(scenarioTagsConfig);
4612
4222
  }
4613
- get displayedFormattedValue() {
4614
- if (!this.value) {
4615
- return this.placeholder;
4223
+ getScenarioTagsByScenario(scenario) {
4224
+ const scenarioTagsConfig = this.getScenarioTagsConfig(scenario, this.wholeTagsConfig);
4225
+ const scenarioTagsUi = [];
4226
+ forEach(scenarioTagsConfig, (scenarioTag) => {
4227
+ const isTagWithSubTags = scenarioTag.type === TagTypes.DATE;
4228
+ const tagWithSubTags = isTagWithSubTags && find(scenarioTagsUi, { type: scenarioTag.type });
4229
+ const tag = tagWithSubTags || this.prepareScenarioTag(scenarioTagsConfig, scenarioTag, scenario, isTagWithSubTags);
4230
+ if (isTagWithSubTags) {
4231
+ this.updateScenarioSubTags(tag, scenarioTag);
4232
+ tag.subTags = this.sortedScenarioSubTags(tag);
4233
+ }
4234
+ if (tagWithSubTags)
4235
+ return;
4236
+ scenarioTagsUi.push(tag);
4237
+ });
4238
+ if (this.areExistingTagsConfig) {
4239
+ this.initExistingTagsConfig(scenario, scenarioTagsUi);
4616
4240
  }
4617
- let displayValue = _.cloneDeep(this.value);
4618
- if (this.datePickerService.isTimeframeDependingOnFY(this.datePickerService.timeframe)) {
4619
- displayValue = this.datePickerService.subtractFiscalYearMonthsFromDate(displayValue);
4241
+ const isTagNotSupportingDates = some(scenarioTagsUi, { turnOffDateTags: true, toggle: true });
4242
+ if (isTagNotSupportingDates) {
4243
+ this.turnOffDateTag(scenarioTagsUi);
4620
4244
  }
4621
- const formatCached = this.datePickerService.format$.getValue();
4622
- return this.datePickerService.getDisplayPrefix() + displayValue.format(formatCached);
4623
- }
4624
- ngOnInit() {
4625
- this.datePickerService.isTimeframeSelectionEnabled = this.canSelectTimeframe;
4626
- this.cdr.markForCheck();
4627
- if (this.paginationDebounce) {
4628
- this.onChangeDebounced$.pipe(takeUntil(this.destroyed$), debounceTime(this.paginationDebounce)).subscribe((value) => {
4629
- this.onChangeCallback(value);
4630
- });
4245
+ const tagWithSpecificDateTags = find(scenarioTagsUi, (tag) => { var _a; return tag.toggle && !!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length); });
4246
+ if (tagWithSpecificDateTags) {
4247
+ this.hideNotAvailableTags(tagWithSpecificDateTags, scenarioTagsUi);
4631
4248
  }
4249
+ return this.sortScenarioTags(scenarioTagsUi);
4632
4250
  }
4633
- pagingClicked(forward) {
4634
- if (this.pagingSetup[this.datePickerService.timeframe]) {
4635
- const nextValue = this.pagingSetup[this.datePickerService.timeframe](forward);
4636
- this.pagingDateChange(nextValue);
4637
- }
4638
- this.datePicker.close();
4251
+ sortScenarioTags(scenarioTagsUi) {
4252
+ return orderBy(scenarioTagsUi, [
4253
+ (tag) => (tag.type === TagTypes.DATE ? 0 : 1),
4254
+ (tag) => (tag.name === 'File Status')
4255
+ ]);
4639
4256
  }
4640
- pagingDateChange(newValue) {
4641
- if (this.paginationDebounce) {
4642
- // this is required for not sending extra requests when user quickly clicking on pagination
4643
- // here we do the same as in setValueFromMoment(newValue) with difference
4644
- // that updating of ngModel/formControl is debounced
4645
- this.datePickerService.resetPresetTag();
4646
- const timestamp = newValue.unix();
4647
- this.writeValue(timestamp);
4648
- this.onChangeDebounced$.next(this.innerValue.unix());
4257
+ initExistingTagsConfig(scenario, scenarioTagsUi) {
4258
+ forEach(this.currentTagsConfig, (tagConfig) => {
4259
+ var _a;
4260
+ const tagSubType = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.options) === null || _a === void 0 ? void 0 : _a.sub_type;
4261
+ const scenarioTagDataConfig = getScenarioTagDataConfig(this.isMultipleDimension);
4262
+ if (!scenarioTagDataConfig || !scenarioTagDataConfig[scenario] || !scenarioTagDataConfig[scenario][tagSubType]) {
4263
+ return;
4264
+ }
4265
+ const scenarioTagUi = tagConfig.type === TagTypes.DATE
4266
+ ? find(scenarioTagsUi, { type: tagConfig.type })
4267
+ : find(scenarioTagsUi, { selectedTagSubType: tagSubType });
4268
+ scenarioTagUi.toggle = true;
4269
+ scenarioTagUi.selectedTagSubType = tagSubType;
4270
+ });
4271
+ }
4272
+ prepareScenarioTag(scenarioTagsConfig, scenarioTag, scenario, isDateTag) {
4273
+ const toggleStatus = isDateTag
4274
+ ? some(scenarioTagsConfig, (tag) => tag.type === TagTypes.DATE && tag.scenarioData.toggle)
4275
+ : scenarioTag.scenarioData.toggle;
4276
+ const selectedTagSubType = isDateTag
4277
+ ? this.getScenarioSelectedDateTag(scenario, scenarioTagsConfig)
4278
+ : scenarioTag.options.sub_type;
4279
+ const tag = {
4280
+ toggle: this.areExistingTagsConfig ? false : toggleStatus,
4281
+ name: scenarioTag.scenarioData.name || scenarioTag.name,
4282
+ description: scenarioTag.scenarioData.description || scenarioTag.description,
4283
+ type: scenarioTag.type,
4284
+ selectedTagSubType,
4285
+ };
4286
+ if (scenarioTag.scenarioData.turnOffDateTags) {
4287
+ tag.turnOffDateTags = scenarioTag.scenarioData.turnOffDateTags;
4649
4288
  }
4650
- else {
4651
- this.setValueFromMoment(newValue);
4289
+ if (scenarioTag.scenarioData.acceptableDateTags) {
4290
+ tag.acceptableDateTags = scenarioTag.scenarioData.acceptableDateTags;
4652
4291
  }
4292
+ return tag;
4653
4293
  }
4654
- /**
4655
- * Set inner value from timestamp and propagate
4656
- *
4657
- * @param timestamp
4658
- */
4659
- setValue(timestamp) {
4660
- this.datePickerService.resetPresetTag();
4661
- super.setValue(timestamp);
4294
+ sortedScenarioSubTags(tag) {
4295
+ const SUB_TAGS_ORDER = [TagsConfigSubType.DAY, TagsConfigSubType.WEEK, TagsConfigSubType.MONTH, TagsConfigSubType.QUARTER, TagsConfigSubType.YEAR];
4296
+ return orderBy(tag.subTags, (subTag) => indexOf(SUB_TAGS_ORDER, subTag.subType));
4662
4297
  }
4663
- writeValue(value) {
4664
- super.writeValue(value);
4665
- if (!value)
4666
- return;
4667
- this.restrictPagination();
4298
+ updateScenarioSubTags(tag, scenarioTag) {
4299
+ if (!tag.subTags) {
4300
+ tag.subTags = [];
4301
+ }
4302
+ const tagSubType = scenarioTag.options.sub_type;
4303
+ tag.subTags.push({
4304
+ subType: tagSubType,
4305
+ name: tagSubType === TagsConfigSubType.FORECAST_NEW ? this.DEFAULT_FORECAST_DATE_TAG : scenarioTag.name,
4306
+ });
4668
4307
  }
4669
- getNextDate(actionCall, amount, forward) {
4670
- var _a, _b;
4671
- return (_b = (_a = this.dateAdapter)[actionCall]) === null || _b === void 0 ? void 0 : _b.call(_a, this.innerValue, forward ? amount : -amount);
4308
+ turnOffDateTag(scenarioTags) {
4309
+ const dateTag = find(scenarioTags, { type: TagTypes.DATE });
4310
+ if (!dateTag)
4311
+ return;
4312
+ dateTag.toggle = false;
4672
4313
  }
4673
- restrictPagination() {
4674
- if (!this._min && !this._max)
4314
+ hideNotAvailableTags(tagWithSpecificDateTags, scenarioTags) {
4315
+ var _a;
4316
+ const subTags = (_a = find(scenarioTags, { type: TagTypes.DATE })) === null || _a === void 0 ? void 0 : _a.subTags;
4317
+ if (!subTags.length)
4675
4318
  return;
4676
- const nextValue = this.pagingSetup[this.datePickerService.timeframe](true);
4677
- const prevValue = this.pagingSetup[this.datePickerService.timeframe](false);
4678
- this.isNextDateDisabled = this._max && nextValue && nextValue.unix() > this._max.unix();
4679
- this.isPrevDateDisabled = this._min && prevValue && prevValue.unix() < this._min.unix();
4319
+ forEach(scenarioTags, (tag) => {
4320
+ var _a;
4321
+ if (!((_a = tag.acceptableDateTags) === null || _a === void 0 ? void 0 : _a.length))
4322
+ return;
4323
+ if (tag !== tagWithSpecificDateTags) {
4324
+ tag.toggle = false;
4325
+ }
4326
+ });
4327
+ forEach(subTags, (subTag) => {
4328
+ subTag.hidden = !tagWithSpecificDateTags.acceptableDateTags.includes(subTag.subType);
4329
+ });
4330
+ }
4331
+ getScenarioSelectedDateTag(scenario, dateTags) {
4332
+ var _a, _b;
4333
+ const monthSubType = (_b = (_a = find(dateTags, (tag) => tag.options.sub_type === TagsConfigSubType.MONTH)) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type;
4334
+ const scenarioSelectedDateTag = {
4335
+ [Scenario.ACTUALS]: () => monthSubType,
4336
+ [Scenario.BUDGET]: () => { var _a, _b; return (_b = (_a = find(dateTags, (tag) => tag.options.sub_type === TagsConfigSubType.YEAR)) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type; },
4337
+ [Scenario.FORECAST]: () => { var _a, _b; return (_b = (_a = find(dateTags, (tag) => tag.options.sub_type === TagsConfigSubType.FORECAST_NEW)) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.sub_type; },
4338
+ [Scenario.NONE]: () => monthSubType,
4339
+ };
4340
+ if (!scenarioSelectedDateTag[scenario])
4341
+ return;
4342
+ return scenarioSelectedDateTag[scenario]();
4343
+ }
4344
+ getScenarioTagsConfig(scenario, tagsConfig) {
4345
+ return reduce(tagsConfig, (acc, tagConfig) => {
4346
+ var _a;
4347
+ const tagSubType = (_a = tagConfig === null || tagConfig === void 0 ? void 0 : tagConfig.options) === null || _a === void 0 ? void 0 : _a.sub_type;
4348
+ const scenarioTagDataConfig = getScenarioTagDataConfig(this.isMultipleDimension);
4349
+ const scenarioTagConfig = scenarioTagDataConfig && scenarioTagDataConfig[scenario] ?
4350
+ scenarioTagDataConfig[scenario][tagSubType] : null;
4351
+ if (!scenarioTagConfig || scenarioTagConfig.hidden)
4352
+ return acc;
4353
+ const clonedTagConfig = cloneDeep(tagConfig);
4354
+ const scenarioTag = Object.assign(Object.assign({}, clonedTagConfig), { scenarioData: scenarioTagConfig });
4355
+ acc.push(scenarioTag);
4356
+ return acc;
4357
+ }, []);
4680
4358
  }
4681
4359
  }
4682
- DrDatePickerWithTimeframeComponent.decorators = [
4683
- { type: Component, args: [{
4684
- selector: 'dr-date-picker-with-timeframe',
4685
- template: "<dr-button [disabled]=\"isPrevDateDisabled\" *ngIf=\"!disabled\" theme=\"icon\" icon=\"dr-icon-arrow-left\" (click)=\"pagingClicked(false)\"></dr-button>\n<div class=\"dr-datepicker-input-container\">\n <i *ngIf=\"isDashboardDatepicker\" class=\"dr-icon-date\"></i>\n\n <div class=\"dr-datepicker-input-container__formatted-value-display\" (click)=\"datepickerInput.click()\">\n <span *ngIf=\"presetTagSelected && datePickerService.isUsingDateTagPresets\"> {{ presetTagSelected }} </span>\n <span>{{ presetTagSelected && datePickerService.isUsingDateTagPresets ? '(' + displayedFormattedValue + ')' : displayedFormattedValue }}</span>\n </div>\n <input\n #datepickerInput\n [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [readonly]=\"readonly\"\n [min]=\"_min\"\n [max]=\"_max\"\n />\n</div>\n<dr-button [disabled]=\"isNextDateDisabled\" *ngIf=\"!disabled\" theme=\"icon\" icon=\"dr-icon-arrow-right\" (click)=\"pagingClicked(true)\"></dr-button>\n<mat-datepicker #datePicker\n class=\"dr-timeframe-datepicker\"\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenPeriodHandler($event, timeframeOption.YEAR)\"\n (monthSelected)=\"chosenPeriodHandler($event, timeframeOption.MONTH)\"\n [panelClass]=\"datePickerService.isUsingDateTagPresets ? 'date-picker-preset-tag' : 'dr-timeframe-datepicker'\"\n >\n</mat-datepicker>\n",
4686
- changeDetection: ChangeDetectionStrategy.OnPush,
4687
- providers: [
4688
- { provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerWithTimeframeComponent, multi: true },
4689
- { provide: DrDatePickerService }
4690
- ],
4691
- 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 #9EA1AA;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:#9ea1aa}: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{display:flex;align-items:center;position:absolute;color:#999;left:8px;top:0;bottom:0}: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}:host{border:none;display:flex;align-items:center}:host.disabled{background:transparent;color:inherit}:host.disabled.dr-date-picker-on-dashboard .dr-datepicker-input-container__formatted-value-display{text-decoration:none;color:#6d6e6f;font-weight:normal}:host.dr-date-picker-on-dashboard{width:-moz-fit-content;width:fit-content;justify-content:space-between}:host.dr-date-picker-on-dashboard mat-datepicker{position:absolute}:host.dr-date-picker-on-dashboard:after{visibility:hidden}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container{display:flex;flex-direction:row;justify-content:center;align-items:center;margin-left:-10px}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container__formatted-value-display{font-weight:600;width:auto;margin-left:5px}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container .dr-icon-date{display:block;position:relative;top:0;margin-right:8px;color:#4e566c}:host .dr-datepicker-input-container input{visibility:hidden;position:absolute;width:100%}:host .dr-datepicker-input-container__formatted-value-display{width:90px;height:22px;padding-left:0;text-align:center;line-height:22px;color:#0c142b;-webkit-text-decoration-line:underline;text-decoration-line:underline}:host .dr-datepicker-input-container__formatted-value-display:hover{background-color:#f2f2fb;border-radius:5px;cursor:pointer;-webkit-text-decoration-line:underline;text-decoration-line:underline;color:#4646ce}::ng-deep .date-picker-preset-tag{width:386px!important}::ng-deep .date-picker-preset-tag .mat-calendar-content{padding-left:32px!important;padding-right:32px!important}\n"]
4692
- },] }
4693
- ];
4694
- DrDatePickerWithTimeframeComponent.ctorParameters = () => [
4695
- { type: ChangeDetectorRef },
4696
- { type: DateAdapter },
4697
- { type: DrDatePickerService }
4360
+ ScenarioService.decorators = [
4361
+ { type: Injectable }
4698
4362
  ];
4699
- DrDatePickerWithTimeframeComponent.propDecorators = {
4700
- isDashboardClassDisplayed: [{ type: HostBinding, args: ['class.dr-date-picker-on-dashboard',] }],
4701
- isDashboardDatepicker: [{ type: Input }],
4702
- dateFormatConfig: [{ type: Input }],
4703
- canSelectTimeframe: [{ type: Input }],
4704
- availableTimeframes: [{ type: Input }],
4705
- paginationDebounce: [{ type: Input }],
4706
- isUsingDateTagPresets: [{ type: Input }],
4707
- presetTag: [{ type: Input }],
4708
- onChangeFormat: [{ type: Output }],
4709
- onChangePresetTag: [{ type: Output }]
4710
- };
4711
4363
 
4712
- class DrDatePickerFormatDirective {
4713
- constructor(matDateFormat, ngControl) {
4714
- this.matDateFormat = matDateFormat;
4715
- this.ngControl = ngControl;
4716
- }
4717
- set datePickerFormat(format) {
4718
- var _a;
4719
- if (this.configDateParse) {
4720
- this.matDateFormat.updateDateFormat(this.configDateParse, this.configDateDisplay);
4364
+ class DrSharedUtils {
4365
+ /**
4366
+ * Get timeframe (day, year, month, quarter) based on passed format
4367
+ *
4368
+ * @param format - date format string. Examples: MM/DD/YYYY, Q/YYYY
4369
+ */
4370
+ static getTimeframeByDateFormat(format) {
4371
+ const defaultFrame = TimeframeOption.DAY;
4372
+ if (!format) {
4373
+ return defaultFrame;
4721
4374
  }
4722
- else {
4723
- this.matDateFormat.updateDateFormat({ dateInput: format });
4375
+ const lowerCaseFormat = format.toLowerCase();
4376
+ switch (true) {
4377
+ case lowerCaseFormat.includes('q'):
4378
+ return TimeframeOption.QUARTER;
4379
+ case lowerCaseFormat.includes('d'):
4380
+ return TimeframeOption.DAY;
4381
+ case lowerCaseFormat.includes('w'):
4382
+ return TimeframeOption.WEEK;
4383
+ case lowerCaseFormat.includes('m'):
4384
+ return TimeframeOption.MONTH;
4385
+ case lowerCaseFormat.includes('y'):
4386
+ return TimeframeOption.YEAR;
4387
+ default:
4388
+ return defaultFrame;
4724
4389
  }
4725
- const value = this.ngControl.value;
4726
- (_a = this.ngControl.valueAccessor) === null || _a === void 0 ? void 0 : _a.writeValue(value);
4727
4390
  }
4728
- }
4729
- DrDatePickerFormatDirective.decorators = [
4730
- { type: Directive, args: [{
4731
- selector: '[drDatePickerFormat]',
4732
- providers: [
4733
- {
4734
- provide: DateAdapter,
4735
- useClass: MomentDateAdapter
4736
- },
4737
- {
4738
- provide: MAT_DATE_FORMATS,
4739
- useClass: CustomDateFormat
4740
- }
4741
- ]
4742
- },] }
4743
- ];
4744
- DrDatePickerFormatDirective.ctorParameters = () => [
4745
- { type: CustomDateFormat, decorators: [{ type: Inject, args: [MAT_DATE_FORMATS,] }] },
4746
- { type: NgControl, decorators: [{ type: Optional }] }
4747
- ];
4748
- DrDatePickerFormatDirective.propDecorators = {
4749
- configDateParse: [{ type: Input }],
4750
- configDateDisplay: [{ type: Input }],
4751
- datePickerFormat: [{ type: Input, args: ['drDatePickerFormat',] }]
4752
- };
4753
-
4754
- class DrShowTimeframePipe {
4755
- transform(arr, showOptions) {
4756
- return arr.filter(item => showOptions.includes(item.timeframe));
4391
+ static getDateByTag(tag) {
4392
+ const todayDate = moment$9().utc().endOf('day');
4393
+ switch (tag) {
4394
+ case DateTags.TODAY:
4395
+ return todayDate;
4396
+ case DateTags.YESTERDAY:
4397
+ todayDate.subtract(1, 'days');
4398
+ return todayDate;
4399
+ case DateTags.THIS_MONTH:
4400
+ todayDate.endOf('month');
4401
+ return todayDate;
4402
+ case DateTags.PREV_MONTH:
4403
+ todayDate.subtract(1, 'months').endOf('month');
4404
+ return todayDate;
4405
+ }
4757
4406
  }
4758
4407
  }
4759
- DrShowTimeframePipe.decorators = [
4760
- { type: Pipe, args: [{
4761
- name: 'drShowTimeframePipe'
4762
- },] }
4763
- ];
4764
4408
 
4765
- class DrSelectAddItemComponent {
4766
- constructor(drSelect) {
4767
- this.drSelect = drSelect;
4768
- this.currentValues = [];
4769
- this.dynamicAddLabel = 'Add new';
4770
- this.values = [];
4771
- this.dynamicValueAdded = new EventEmitter();
4772
- }
4773
- set inputRef(input) {
4774
- if (!input)
4775
- return;
4776
- input.focus();
4409
+ // @ts-ignore
4410
+ const moment$2 = require('moment');
4411
+ class DrDatePickerService {
4412
+ constructor() {
4413
+ this.isTimeframeSelectionEnabled = false;
4414
+ this.timeframe = TimeframeOption.DAY;
4415
+ this.format$ = new BehaviorSubject(DateFromats.MAT_DEFAULT_DATE_FORMAT);
4416
+ this.updatedQuarter$ = new Subject();
4417
+ this.updatedDateAndClose$ = new Subject();
4418
+ this.presetTag$ = new BehaviorSubject('');
4419
+ this.onSameDaySelectedInCalendar$ = new Subject();
4420
+ this.keepPresetTag = false;
4421
+ this.isValueUpdating = false;
4422
+ this.availableTimeframes = [
4423
+ TimeframeOption.DAY,
4424
+ TimeframeOption.WEEK,
4425
+ TimeframeOption.MONTH,
4426
+ TimeframeOption.QUARTER,
4427
+ TimeframeOption.YEAR
4428
+ ];
4429
+ this.formatConfig = {
4430
+ day: DateFromats.MAT_DEFAULT_DATE_FORMAT,
4431
+ month: DateFromats.MONTH_YEAR_FORMAT,
4432
+ year: DateFromats.YEAR_FORMAT,
4433
+ quarter: DateFromats.QUARTER_FORMAT,
4434
+ week: DateFromats.WEEK_FORMAT
4435
+ };
4436
+ this.fiscalYearMonthsModifier = 0;
4777
4437
  }
4778
- ngOnChanges(changes) {
4779
- this.calculateCurrentValues();
4438
+ getDisplayPrefix() {
4439
+ const formatCached = this.format$.getValue();
4440
+ switch (true) {
4441
+ case formatCached === null || formatCached === void 0 ? void 0 : formatCached.includes('Q'):
4442
+ return 'Q';
4443
+ case formatCached === null || formatCached === void 0 ? void 0 : formatCached.includes('W'):
4444
+ return 'W';
4445
+ default:
4446
+ return '';
4447
+ }
4780
4448
  }
4781
- ngOnInit() {
4782
- this.calculateCurrentValues();
4449
+ getTimeframe(format) {
4450
+ return DrSharedUtils.getTimeframeByDateFormat(format);
4783
4451
  }
4784
- onDynamicAdding() {
4785
- this.isDynamicAdding = true;
4452
+ getConfiguredFormat(timeframe) {
4453
+ return this.formatConfig[timeframe];
4786
4454
  }
4787
- onDynamicAddingClose() {
4788
- this.isDynamicAdding = false;
4789
- this.dynamicValue = '';
4455
+ updateTimeframeAndFormat(format) {
4456
+ const normalizedFormat = this.normalizeValue(format || this.format$.getValue());
4457
+ this.timeframe = this.getTimeframe(normalizedFormat);
4458
+ this.format$.next(this.getConfiguredFormat(this.timeframe));
4790
4459
  }
4791
- isDynamicValueValid() {
4792
- var _a;
4793
- const trimmedValue = (_a = this.dynamicValue) === null || _a === void 0 ? void 0 : _a.trim();
4794
- if (!trimmedValue)
4795
- return false;
4796
- return !this.currentValues.includes(trimmedValue);
4460
+ normalizeValue(value) {
4461
+ return value.replace(/d/g, 'D');
4797
4462
  }
4798
- onDynamicAdd(value, keydownEvent) {
4799
- this.isDirty = true;
4800
- if (!this.isDynamicValueValid())
4801
- return;
4802
- if (keydownEvent && keydownEvent.key !== 'Enter')
4803
- return;
4804
- this.onDynamicAddingClose();
4805
- this.drSelect.close();
4806
- this.dynamicValueAdded.emit(value === null || value === void 0 ? void 0 : value.trim());
4463
+ /**
4464
+ * Get quarter number for date according to fiscal year
4465
+ *
4466
+ * @param date
4467
+ */
4468
+ getQuarterAccordingToFiscalYear(date) {
4469
+ let fiscalMonth = this.fiscalYearMonthsModifier;
4470
+ const dateMonth = date.month();
4471
+ if (dateMonth < fiscalMonth) {
4472
+ fiscalMonth -= 12;
4473
+ }
4474
+ return Math.trunc((date.month() - fiscalMonth) / 3) + 1;
4807
4475
  }
4808
- calculateCurrentValues() {
4809
- this.currentValues = this.bindValue
4810
- ? reduce(this.values, (acc, curr) => {
4811
- acc.push(curr[this.bindValue]);
4812
- return acc;
4813
- }, [])
4814
- : this.values;
4476
+ /**
4477
+ * Sets date to end of quarter in FY by passed quarter number
4478
+ *
4479
+ * @param date
4480
+ * @param quarterNumber
4481
+ */
4482
+ setEndOfQuarter(date, quarterNumber) {
4483
+ date
4484
+ .subtract(this.fiscalYearMonthsModifier, 'M')
4485
+ .startOf('year')
4486
+ .add(this.fiscalYearMonthsModifier + quarterNumber * 3 - 1, 'M')
4487
+ .endOf('month');
4815
4488
  }
4816
- }
4817
- DrSelectAddItemComponent.decorators = [
4818
- { type: Component, args: [{
4819
- selector: 'dr-select-add-item',
4820
- template: "<div class=\"dr-select__dynamic-add dynamic-add\">\n <div class=\"dynamic-add__add-item\" (click)=\"onDynamicAdding()\">\n <i class=\"dr-icon-add\"></i>\n <p class=\"dynamic-add__add-item__text\">{{ dynamicAddLabel }}</p>\n </div>\n <div *ngIf=\"isDynamicAdding\" class=\"dynamic-add__field\">\n <dr-input #dynamicInputRef\n class=\"dynamic-add__field__input\"\n [class.dynamic-add__field__input--error]=\"!isDynamicValueValid() && isDirty\"\n [(ngModel)]=\"dynamicValue\"\n (keydown)=\"onDynamicAdd(dynamicValue, $event)\"\n placeholder=\"Type...\"></dr-input>\n <div class=\"dynamic-add__field__buttons\">\n <dr-button *ngIf=\"dynamicValue && isDynamicValueValid()\"\n theme=\"icon\"\n icon=\"dr-icon-approve\"\n iconSize=\"18px\"\n (click)=\"onDynamicAdd(dynamicValue)\"></dr-button>\n <dr-button theme=\"icon\"\n icon=\"dr-icon-exit\"\n iconSize=\"18px\"\n (click)=\"onDynamicAddingClose()\"></dr-button>\n </div>\n </div>\n</div>\n",
4821
- changeDetection: ChangeDetectionStrategy.OnPush,
4822
- styles: [".dynamic-add__add-item{cursor:pointer;display:flex;align-items:center;border-bottom:1px solid #dfe0e3;padding:6px}.dynamic-add__add-item:hover{background:#f9f7ff}.dynamic-add__add-item__text{font-size:14px;line-height:22px;margin:0}.dynamic-add__field{position:relative}.dynamic-add__field__buttons{position:absolute;top:0;right:0;bottom:0;display:flex;align-items:center}::ng-deep .ng-dropdown-panel .ng-dropdown-header:has(.dynamic-add){padding:0;border:none}::ng-deep .dynamic-add__field__input{padding-left:12px!important;height:36px!important;border:none!important;background:#f9f7ff!important;border-radius:0!important}::ng-deep .dynamic-add__field__input>input{background:#f9f7ff}::ng-deep .dynamic-add__field__input>input::placeholder{line-height:22px;font-size:14px;font-weight:400;color:#9ea1aa}::ng-deep .dynamic-add__field__input--error{background:#ffdfe4!important}::ng-deep .dynamic-add__field__input--error>input{background:#ffdfe4}\n"]
4823
- },] }
4824
- ];
4825
- DrSelectAddItemComponent.ctorParameters = () => [
4826
- { type: DrSelectComponent }
4827
- ];
4828
- DrSelectAddItemComponent.propDecorators = {
4829
- dynamicAddLabel: [{ type: Input }],
4830
- bindValue: [{ type: Input }],
4831
- values: [{ type: Input }],
4832
- dynamicValueAdded: [{ type: Output }],
4833
- inputRef: [{ type: ViewChild, args: ['dynamicInputRef',] }]
4834
- };
4835
-
4836
- class TooltipInfoComponent {
4837
- constructor() {
4489
+ /**
4490
+ * Sets date to start of quarter in FY by passed quarter number
4491
+ *
4492
+ * @param date
4493
+ * @param quarterNumber
4494
+ */
4495
+ setStartOfQuarter(date, quarterNumber) {
4496
+ date
4497
+ .subtract(this.fiscalYearMonthsModifier, 'M')
4498
+ .startOf('year')
4499
+ .add(this.fiscalYearMonthsModifier + (quarterNumber - 1) * 3, 'M');
4838
4500
  }
4839
- }
4840
- TooltipInfoComponent.decorators = [
4841
- { type: Component, args: [{
4842
- selector: 'dr-tooltip-info',
4843
- template: "<div class=\"tooltip-info\">\n <i *ngIf=\"data?.icon else defaultIcon\" class=\"fa\" [class]=\"data.icon\" [style.fontSize.px]=\"14\"\n [style.margin.px]=\"12\" [style.color]=\"data?.iconColor || '#7B61FF'\"></i>\n <div class=\"tooltip-info-content-wrapper\">\n <div *ngIf=\"data?.title\" class=\"tooltip-info_header\">\n <span>{{data.title}}</span>\n </div>\n <div *ngIf=\"data?.description\" class=\"tooltip-info_description\"\n [class.tooltip-info_description-no-border]=\"!data.title\">\n <ng-container *ngIf=\"!data.title\"></ng-container>\n <span *ngIf=\"!useDescriptionAsHTML\">{{data.description}}</span>\n <div *ngIf=\"useDescriptionAsHTML\" [innerHTML]=\"data.description\"></div>\n </div>\n </div>\n</div>\n\n<ng-template #defaultIcon>\n <ng-container *ngIf=\"!data.icon\">\n <div class=\"default-icon\"></div>\n </ng-container>\n</ng-template>\n",
4844
- changeDetection: ChangeDetectionStrategy.OnPush,
4845
- styles: [".tooltip-info{width:316px;display:flex}.tooltip-info-content-wrapper{display:flex;flex-direction:column;padding-top:10px}.tooltip-info_header{padding:0 16px 6px 0;font-weight:bold;font-size:14px;line-height:16px;letter-spacing:.25px;display:flex;justify-content:flex-start}.tooltip-info_header>i{margin-right:10px}.tooltip-info-content-wrapper{padding-top:10px}.tooltip-info_description{display:flex;align-items:flex-start;border-top:1px solid #aeb5bb;padding:12px 10px 10px 0;text-align:left;font-weight:normal;font-size:14px;line-height:22px}.tooltip-info_description-no-border{padding-top:0;border-top:none}.tooltip-info_description>i{margin-right:10px}:host.tooltip-info-medium .tooltip-info{max-width:272px}:host.tooltip-info-medium .tooltip-info-content-wrapper{padding-top:10px}:host.tooltip-info-medium .tooltip-info_header,:host.tooltip-info-medium .tooltip-info_description{min-height:unset;border-top:none;font-size:14px;line-height:22px}:host.tooltip-info-medium .tooltip-info_header{padding:10px 10px 0 0}:host.tooltip-info-medium .tooltip-info_description{padding:10px 12px 10px 0}:host.tooltip-info-medium .tooltip-info .default-icon:before{background:url(\"data:image/svg+xml,%3Csvg width%3D%2216%22 height%3D%2216%22 viewBox%3D%220 0 16 16%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cpath d%3D%22M8.00008 2.66669C5.05341 2.66669 2.66675 5.05335 2.66675 8.00002C2.66675 10.9467 5.05341 13.3334 8.00008 13.3334C10.9467 13.3334 13.3334 10.9467 13.3334 8.00002C13.3334 5.05335 10.9467 2.66669 8.00008 2.66669ZM8.53341 10.6667H7.46675V7.46669H8.53341V10.6667ZM8.53341 6.40002H7.46675V5.33335H8.53341V6.40002Z%22 fill%3D%22%237B61FF%22%2F%3E%3C%2Fsvg%3E\") no-repeat;background-size:100% 100%;display:inline-block;height:20px;width:20px;content:\"\"}:host.tooltip-info-small .tooltip-info{width:auto}:host.tooltip-info-small .tooltip-info-content-wrapper{padding-top:10px}:host.tooltip-info-small .tooltip-info_header,:host.tooltip-info-small .tooltip-info_description{min-height:unset;border-top:none;font-size:14px;line-height:22px}:host.tooltip-info-small .tooltip-info_header{padding:0 10px 0 0}:host.tooltip-info-small .tooltip-info_description{padding:0 12px 10px 0}:host.tooltip-info-small .tooltip-info .default-icon:before{background:url(\"data:image/svg+xml,%3Csvg width%3D%2216%22 height%3D%2216%22 viewBox%3D%220 0 16 16%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cpath d%3D%22M8.00008 2.66669C5.05341 2.66669 2.66675 5.05335 2.66675 8.00002C2.66675 10.9467 5.05341 13.3334 8.00008 13.3334C10.9467 13.3334 13.3334 10.9467 13.3334 8.00002C13.3334 5.05335 10.9467 2.66669 8.00008 2.66669ZM8.53341 10.6667H7.46675V7.46669H8.53341V10.6667ZM8.53341 6.40002H7.46675V5.33335H8.53341V6.40002Z%22 fill%3D%22%237B61FF%22%2F%3E%3C%2Fsvg%3E\") no-repeat;background-size:100% 100%;display:inline-block;height:20px;width:20px;content:\"\"}.default-icon{position:relative;width:18px;height:18px;margin:10px}.default-icon:before{background:url(\"data:image/svg+xml,%3Csvg width%3D%2216%22 height%3D%2216%22 viewBox%3D%220 0 16 16%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cpath d%3D%22M8.00008 2.66669C5.05341 2.66669 2.66675 5.05335 2.66675 8.00002C2.66675 10.9467 5.05341 13.3334 8.00008 13.3334C10.9467 13.3334 13.3334 10.9467 13.3334 8.00002C13.3334 5.05335 10.9467 2.66669 8.00008 2.66669ZM8.53341 10.6667H7.46675V7.46669H8.53341V10.6667ZM8.53341 6.40002H7.46675V5.33335H8.53341V6.40002Z%22 fill%3D%22%237B61FF%22%2F%3E%3C%2Fsvg%3E\") no-repeat;background-size:100% 100%;display:inline-block;height:18px;width:18px;content:\"\"}\n"]
4846
- },] }
4847
- ];
4848
- TooltipInfoComponent.ctorParameters = () => [];
4849
- TooltipInfoComponent.propDecorators = {
4850
- data: [{ type: Input }],
4851
- useDescriptionAsHTML: [{ type: Input }]
4852
- };
4853
-
4854
- class TooltipInfoSimpleComponent {
4855
- constructor() {
4501
+ /**
4502
+ * Sets date to end of current quarter (in which date is located) according to FY
4503
+ *
4504
+ * @param date
4505
+ */
4506
+ setEndOfCurrentQuarter(date) {
4507
+ this.setEndOfQuarter(date, this.getQuarterAccordingToFiscalYear(date));
4856
4508
  }
4857
- }
4858
- TooltipInfoSimpleComponent.decorators = [
4859
- { type: Component, args: [{
4860
- selector: 'dr-tooltip-info-simple',
4861
- template: "<div class=\"tooltip-info-simple\">\n <div *ngIf=\"context?.title\" class=\"tooltip-info-simple__title\">{{context?.title}}</div>\n <div *ngIf=\"context?.description\" class=\"tooltip-info-simple__description\">{{context?.description}}</div>\n</div>\n",
4862
- changeDetection: ChangeDetectionStrategy.OnPush,
4863
- styles: [".tooltip-info-simple{max-width:250px;font-size:14px;line-height:22px;padding:10px 12px;color:#0c142b}.tooltip-info-simple__title{font-weight:600;overflow:hidden;text-overflow:ellipsis}\n"]
4864
- },] }
4865
- ];
4866
- TooltipInfoSimpleComponent.ctorParameters = () => [];
4867
- TooltipInfoSimpleComponent.propDecorators = {
4868
- context: [{ type: Input }]
4869
- };
4870
-
4871
- class TooltipNoBodyComponent {
4872
- constructor() {
4509
+ /**
4510
+ * Sets date to start of current quarter (in which date is located) according to FY
4511
+ *
4512
+ * @param date
4513
+ */
4514
+ setStartOfCurrentQuarter(date) {
4515
+ this.setStartOfQuarter(date, this.getQuarterAccordingToFiscalYear(date));
4873
4516
  }
4874
- ngOnInit() {
4517
+ /**
4518
+ * If date selection on this timeframe depends on Fiscal Year
4519
+ *
4520
+ * @param timeframe
4521
+ */
4522
+ isTimeframeDependingOnFY(timeframe) {
4523
+ return _.includes([TimeframeOption.QUARTER, TimeframeOption.YEAR], timeframe);
4875
4524
  }
4876
- }
4877
- TooltipNoBodyComponent.decorators = [
4878
- { type: Component, args: [{
4879
- selector: 'dr-tooltip-no-body',
4880
- template: "<div class=\"tooltip-bold\" [ngClass]=\"{'tooltip-bold--icon': context?.icon}\">\n <div class=\"tooltip-bold__title\">\n <i *ngIf=\"context?.icon\" [class]=\"context?.icon\" [style.color]=\"context?.iconColor || 'black'\"></i>\n {{ context.title }}\n </div>\n <div class=\"tooltip-bold-text\">\n {{ context.text }}\n </div>\n</div>",
4881
- changeDetection: ChangeDetectionStrategy.OnPush,
4882
- styles: [".tooltip-bold{position:relative;box-shadow:0 4px 8px 1px #00000040;border:1px solid #c3c4ce;border-radius:8px;font-size:14px;line-height:22px;padding:10px 12px;background-color:#fff}.tooltip-bold--icon{padding-left:44px}.tooltip-bold__title{font-weight:bold}.tooltip-bold__title>i{position:absolute;width:16px;height:16px;left:10px}\n"]
4883
- },] }
4884
- ];
4885
- TooltipNoBodyComponent.ctorParameters = () => [];
4886
- TooltipNoBodyComponent.propDecorators = {
4887
- context: [{ type: Input }]
4888
- };
4889
-
4890
- class TooltipProcessDefaultComponent {
4891
- constructor() {
4525
+ /**
4526
+ * Subtract from date fiscal year shift months count
4527
+ *
4528
+ * @param date
4529
+ */
4530
+ subtractFiscalYearMonthsFromDate(date) {
4531
+ return this.getDateModifiedByFiscalMonths(date, true);
4892
4532
  }
4893
- }
4894
- TooltipProcessDefaultComponent.decorators = [
4895
- { type: Component, args: [{
4896
- selector: 'dr-tooltip-process-default',
4897
- template: `
4898
- <div class="container" [innerHTML]="text"></div>
4899
- `,
4900
- changeDetection: ChangeDetectionStrategy.OnPush,
4901
- styles: [`
4902
- .container {
4903
- width: auto;
4904
- max-width: 388px;
4905
- text-align: start;
4906
- font-size: 14px;
4907
- line-height: 22px;
4908
- padding: 10px 12px;
4909
- color: #151B3F;
4910
- background-color: #FFF;
4911
- border-radius: 8px;
4912
- box-shadow: 0px 4px 8px 1px rgba(0, 0, 0, 0.25);
4913
- border: 1px solid #C3C4CE;
4533
+ /**
4534
+ * Add to date fiscal year shift months count
4535
+ *
4536
+ * @param date
4537
+ */
4538
+ addFiscalYearMonthsToDate(date) {
4539
+ return this.getDateModifiedByFiscalMonths(date);
4540
+ }
4541
+ /**
4542
+ * Add or subtract depending on isRevert paremeter Fiscal year month shift
4543
+ *
4544
+ * @param date
4545
+ * @param isSubtract
4546
+ */
4547
+ getDateModifiedByFiscalMonths(date, isSubtract = false) {
4548
+ return date ? _.cloneDeep(date)[isSubtract ? 'subtract' : 'add'](this.fiscalYearMonthsModifier, 'month') : date;
4549
+ }
4550
+ updateDatePickerByPreset(tag, calender) {
4551
+ this.keepPresetTag = true;
4552
+ let date = null;
4553
+ if (tag) {
4554
+ date = DrSharedUtils.getDateByTag(tag);
4555
+ switch (tag) {
4556
+ case DateTags.TODAY:
4557
+ this.updateTimeframeAndFormat(DateFromats.MAT_DEFAULT_DATE_FORMAT);
4558
+ break;
4559
+ case DateTags.YESTERDAY:
4560
+ this.updateTimeframeAndFormat(DateFromats.MAT_DEFAULT_DATE_FORMAT);
4561
+ break;
4562
+ case DateTags.THIS_MONTH:
4563
+ this.updateTimeframeAndFormat(DateFromats.MONTH_YEAR_FORMAT);
4564
+ this.selectDateInCalendarMonthView(date, calender);
4565
+ break;
4566
+ case DateTags.PREV_MONTH:
4567
+ this.updateTimeframeAndFormat(DateFromats.MONTH_YEAR_FORMAT);
4568
+ this.selectDateInCalendarMonthView(date, calender);
4569
+ break;
4570
+ }
4914
4571
  }
4915
- `]
4916
- },] }
4572
+ this.presetTag$.next(tag);
4573
+ this.updatedDateAndClose$.next(date);
4574
+ }
4575
+ selectDateInCalendarMonthView(date, calender) {
4576
+ setTimeout(() => {
4577
+ const monthView = calender.monthView;
4578
+ if (monthView) {
4579
+ monthView._activeDate = date;
4580
+ monthView._selected = date;
4581
+ monthView._init();
4582
+ }
4583
+ });
4584
+ }
4585
+ resetPresetTag() {
4586
+ if (!this.keepPresetTag) {
4587
+ this.presetTag$.next(null);
4588
+ }
4589
+ else {
4590
+ this.keepPresetTag = false;
4591
+ }
4592
+ }
4593
+ }
4594
+ DrDatePickerService.decorators = [
4595
+ { type: Injectable }
4917
4596
  ];
4918
- TooltipProcessDefaultComponent.ctorParameters = () => [];
4919
- TooltipProcessDefaultComponent.propDecorators = {
4920
- text: [{ type: Input }]
4921
- };
4922
4597
 
4923
- const TOOLTIP_COMPONENTS = [
4924
- TooltipInfoComponent,
4925
- TooltipInfoSimpleComponent,
4926
- TooltipNoBodyComponent,
4927
- TooltipProcessDefaultComponent
4928
- ];
4929
- class DrTooltipModule {
4930
- }
4931
- DrTooltipModule.decorators = [
4932
- { type: NgModule, args: [{
4933
- imports: [
4934
- CommonModule
4935
- ],
4936
- exports: [
4937
- TooltipComponent,
4938
- DrTooltipDirective,
4939
- ...TOOLTIP_COMPONENTS
4940
- ],
4941
- providers: [],
4942
- declarations: [
4943
- TooltipComponent,
4944
- DrTooltipDirective,
4945
- ...TOOLTIP_COMPONENTS
4946
- ],
4947
- },] }
4948
- ];
4949
-
4950
- // !!! Please do not use such approach in other places
4951
- // Hard fix for 'none' calendar view selection
4952
- MatCalendar.prototype.focusActiveCell = function () {
4953
- var _a;
4954
- (_a = this._getCurrentViewComponent()) === null || _a === void 0 ? void 0 : _a._focusActiveCell(false);
4955
- };
4956
- const components$3 = [
4957
- DrButtonComponent,
4958
- RadioButtonComponent,
4959
- RadioGroupComponent,
4960
- CheckboxComponent,
4961
- DrInputComponent,
4962
- DrSelectComponent,
4963
- DrToggleComponent,
4964
- DrToggleButtonComponent,
4965
- DrDatePickerComponent,
4966
- DrDatePickerWithTimeframeComponent,
4967
- DrDatePickerFormatDirective,
4968
- DrDatePickerCustomHeaderComponent,
4969
- DrModelDebounceChangeDirective,
4970
- DrShowTimeframePipe,
4971
- DrSelectAddItemComponent
4972
- ];
4973
- class DrInputsModule {
4598
+ // @ts-ignore
4599
+ const moment$1 = require('moment');
4600
+ class DrDatePickerCustomHeaderComponent {
4601
+ constructor(_calendar, _dateAdapter, _dateFormats, cdr, datePickerService) {
4602
+ this._calendar = _calendar;
4603
+ this._dateAdapter = _dateAdapter;
4604
+ this._dateFormats = _dateFormats;
4605
+ this.cdr = cdr;
4606
+ this.datePickerService = datePickerService;
4607
+ this._destroyed = new Subject();
4608
+ this.quarters = [1, 2, 3, 4];
4609
+ this.selectedQuarter = 1;
4610
+ this.timeframeOptions = [{
4611
+ timeframe: TimeframeOption.DAY,
4612
+ title: 'Day',
4613
+ value: CalendarView.FOR_DAYS,
4614
+ format: this.datePickerService.formatConfig.day,
4615
+ periodLabel: () => this._dateAdapter.format(this._calendar.activeDate, this._dateFormats.display.monthYearLabel).toLocaleUpperCase()
4616
+ }, {
4617
+ timeframe: TimeframeOption.WEEK,
4618
+ title: 'Week',
4619
+ value: CalendarView.FOR_DAYS,
4620
+ format: this.datePickerService.formatConfig.week,
4621
+ periodLabel: () => this._dateAdapter.format(this._calendar.activeDate, this._dateFormats.display.monthYearLabel).toLocaleUpperCase()
4622
+ }, {
4623
+ timeframe: TimeframeOption.MONTH,
4624
+ title: 'Month',
4625
+ value: CalendarView.FOR_MONTHS,
4626
+ format: this.datePickerService.formatConfig.month,
4627
+ periodLabel: () => String(moment$1(this._calendar.activeDate).utc().year())
4628
+ }, {
4629
+ timeframe: TimeframeOption.QUARTER,
4630
+ title: 'Quarter',
4631
+ value: CalendarView.FOR_QUARTERS,
4632
+ format: this.datePickerService.formatConfig.quarter,
4633
+ periodLabel: () => String(moment$1(this.datePickerService.subtractFiscalYearMonthsFromDate(this._calendar.activeDate)).utc().year())
4634
+ }, {
4635
+ timeframe: TimeframeOption.YEAR,
4636
+ title: 'Year',
4637
+ value: CalendarView.FOR_YEARS,
4638
+ format: this.datePickerService.formatConfig.year,
4639
+ periodLabel: () => {
4640
+ const currentYear = moment$1(this.datePickerService.subtractFiscalYearMonthsFromDate(this._calendar.activeDate)).utc().year();
4641
+ const startPeriod = Math.floor(currentYear / 24) * 24;
4642
+ return startPeriod + '-' + (startPeriod + 23);
4643
+ }
4644
+ }];
4645
+ this.pagingSetup = {
4646
+ [CalendarView.FOR_MONTHS]: (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
4647
+ [CalendarView.FOR_QUARTERS]: (forward) => this.pagingDateChange('addCalendarYears', 1, forward),
4648
+ [CalendarView.FOR_DAYS]: (forward) => this.pagingDateChange('addCalendarMonths', 1, forward),
4649
+ [CalendarView.FOR_YEARS]: (forward) => this.pagingDateChange('addCalendarYears', 24, forward)
4650
+ };
4651
+ this.selectedTimeframe = CalendarView.FOR_DAYS;
4652
+ this.timeframeSelection = false;
4653
+ this.periodMonthLabel = '';
4654
+ this.periodYearLabel = '';
4655
+ this.presetTagList = PRESET_TAGS_LIST;
4656
+ this.calendarView = CalendarView;
4657
+ _calendar.stateChanges.pipe(takeUntil(this._destroyed)).subscribe(() => this.setPeriodLabels());
4658
+ this.datePickerService.format$.pipe(takeUntil(this._destroyed)).subscribe(value => {
4659
+ this.selectedTimeframe = this.timeframeOptions.filter(option => option.format === value)[0].value;
4660
+ _calendar.currentView = this.selectedTimeframe;
4661
+ this.setPeriodLabels();
4662
+ if (this.selectedTimeframe === CalendarView.FOR_QUARTERS) {
4663
+ this.selectedQuarter = this.datePickerService.getQuarterAccordingToFiscalYear(this._calendar.activeDate);
4664
+ }
4665
+ });
4666
+ _calendar.viewChanged.pipe(takeUntil(this._destroyed)).subscribe(() => {
4667
+ this.setPeriodLabels();
4668
+ if (_calendar.multiYearView) {
4669
+ this.transformDateInMultiyearViewAccordingToFY();
4670
+ }
4671
+ });
4672
+ _calendar._userSelection.subscribe(date => {
4673
+ if (!this.datePickerService.isValueUpdating) {
4674
+ this.datePickerService.onSameDaySelectedInCalendar$.next(date.value);
4675
+ }
4676
+ });
4677
+ this.datePickerService.calendarInstance = _calendar;
4678
+ }
4679
+ get selectedPresetTag() {
4680
+ return this.datePickerService.presetTag$.getValue();
4681
+ }
4682
+ ;
4683
+ ngOnInit() {
4684
+ setTimeout(() => {
4685
+ if (this._calendar.multiYearView) {
4686
+ this.transformDateInMultiyearViewAccordingToFY();
4687
+ }
4688
+ });
4689
+ }
4690
+ ngOnDestroy() {
4691
+ this._destroyed.next();
4692
+ this._destroyed.complete();
4693
+ }
4694
+ setPeriodLabels() {
4695
+ const currentTimeframeOption = this.timeframeOptions.filter(option => option.value === this._calendar.currentView)[0];
4696
+ const fullPeriodLabel = currentTimeframeOption.periodLabel();
4697
+ if (this._calendar.currentView === CalendarView.FOR_DAYS) {
4698
+ this.periodMonthLabel = fullPeriodLabel.slice(0, 3);
4699
+ this.periodYearLabel = fullPeriodLabel.slice(4);
4700
+ }
4701
+ else {
4702
+ this.periodMonthLabel = '';
4703
+ this.periodYearLabel = fullPeriodLabel;
4704
+ }
4705
+ this.cdr.markForCheck();
4706
+ }
4707
+ setTimeframe(value) {
4708
+ if (value !== this.selectedTimeframe) {
4709
+ this.datePickerService.resetPresetTag();
4710
+ }
4711
+ this.selectedTimeframe = value;
4712
+ this.timeframeSelection = false;
4713
+ this._calendar.currentView = this.selectedTimeframe;
4714
+ const chosenTimeframeOption = this.timeframeOptions.filter(option => option.value === this.selectedTimeframe)[0];
4715
+ this.datePickerService.updateTimeframeAndFormat(chosenTimeframeOption.format);
4716
+ if (this.selectedTimeframe === CalendarView.FOR_QUARTERS) {
4717
+ this.selectedQuarter = this.datePickerService.getQuarterAccordingToFiscalYear(this._calendar.activeDate);
4718
+ }
4719
+ }
4720
+ get currentViewIsQuarter() {
4721
+ return ![CalendarView.FOR_DAYS, CalendarView.FOR_MONTHS, CalendarView.FOR_YEARS].includes(this._calendar.currentView);
4722
+ }
4723
+ switchViewOnClickOnPeriodLabel(view) {
4724
+ this._calendar.currentView = view;
4725
+ }
4726
+ onSelectQuarter(quarterNumber) {
4727
+ this.selectedQuarter = quarterNumber;
4728
+ this.datePickerService.setEndOfQuarter(this._calendar.activeDate, quarterNumber);
4729
+ this.datePickerService.updatedQuarter$.next(this._calendar.activeDate);
4730
+ this.datePickerService.datePickerInstance.close();
4731
+ }
4732
+ pagingClicked(forward) {
4733
+ if (this.pagingSetup[this._calendar.currentView]) {
4734
+ this.pagingSetup[this._calendar.currentView](forward);
4735
+ }
4736
+ }
4737
+ pagingDateChange(actionCall, amount, forward) {
4738
+ this._calendar.activeDate = this._dateAdapter[actionCall](this._calendar.activeDate, forward ? amount : -amount);
4739
+ this.setPeriodLabels();
4740
+ }
4741
+ transformDateInMultiyearViewAccordingToFY() {
4742
+ const multuYearView = this._calendar.multiYearView;
4743
+ multuYearView._activeDate = this.datePickerService.subtractFiscalYearMonthsFromDate(multuYearView._activeDate);
4744
+ multuYearView._selectedYear = multuYearView._activeDate.year();
4745
+ multuYearView._init();
4746
+ }
4747
+ onSelectPresetTag(tag) {
4748
+ if (tag.key === this.selectedPresetTag) {
4749
+ this.datePickerService.presetTag$.next(null);
4750
+ }
4751
+ else {
4752
+ this.datePickerService.presetTag$.next(tag.key);
4753
+ }
4754
+ this.datePickerService.updateDatePickerByPreset(this.selectedPresetTag, this._calendar);
4755
+ }
4974
4756
  }
4975
- DrInputsModule.decorators = [
4976
- { type: NgModule, args: [{
4977
- declarations: components$3,
4978
- exports: components$3,
4979
- imports: [
4980
- FormsModule,
4981
- ReactiveFormsModule,
4982
- CommonModule,
4983
- NgSelectModule,
4984
- MatNativeDateModule,
4985
- MatDatepickerModule,
4986
- MatTooltipModule,
4987
- DrTooltipModule
4988
- ],
4989
- entryComponents: [DrDatePickerCustomHeaderComponent]
4757
+ DrDatePickerCustomHeaderComponent.decorators = [
4758
+ { type: Component, args: [{
4759
+ selector: 'dr-date-picker_custom-header.component',
4760
+ template: "<div *ngIf=\"datePickerService.isTimeframeSelectionEnabled\" class=\"dr-datepicker__timeframe-select__wrapper\">\n\n <div *ngIf=\"datePickerService.isUsingDateTagPresets\" class=\"dr-datepicker-preset-date\">\n <div class=\"dr-datepicker-preset-date__tags\">\n <div *ngFor=\"let tag of presetTagList\" \n id=\"preset_tag\" \n class=\"dr-datepicker-preset-date__tags__tag\" \n (click)=\"onSelectPresetTag(tag)\" \n [ngClass]=\"{'dr-datepicker-preset-date__tags__tag--selected': tag.key === selectedPresetTag}\"\n [drTooltip]=\"selectedPresetTag === tag.key? 'Unselect preset' : ''\"\n [drTooltipPosition]=\"'top'\">\n {{ tag.label }}\n </div>\n </div>\n </div>\n <dr-select\n class=\"dr-datepicker__timeframe-select\"\n [ngModel]=\"selectedTimeframe\"\n [items]=\"timeframeOptions | drShowTimeframePipe: datePickerService.availableTimeframes\"\n bindLabel=\"title\"\n bindValue=\"value\"\n (ngModelChange)=\"setTimeframe($event)\">\n </dr-select>\n</div>\n\n<div class=\"dr-date-paging\">\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(false)\">\n <i class=\"dr-icon-arrow-left presentation_buttons-navigate_input\"></i>\n </div>\n <span class=\"example-header-label\">\n <span (click)=\"switchViewOnClickOnPeriodLabel(calendarView.FOR_MONTHS)\">{{ periodMonthLabel + ' ' }}</span>\n <span (click)=\"switchViewOnClickOnPeriodLabel(calendarView.FOR_YEARS)\">{{ periodYearLabel }}</span>\n </span>\n <div class=\"dr-date-paging flip-page-button\"\n (click)=\"pagingClicked(true)\">\n <i class=\"dr-icon-arrow-right presentation_buttons-navigate_input\"></i>\n </div>\n</div>\n<div #quarterlyDatePicker class=\"dr-quarterly-datepicker\" *ngIf=\"currentViewIsQuarter\">\n <div *ngFor=\"let quarter of quarters\"\n class=\"quarter-selector\" (click)=\"onSelectQuarter(quarter)\"\n [class]=\"quarter === selectedQuarter ? 'selected' : ''\"\n >Q{{quarter}}</div>\n</div>\n\n",
4761
+ changeDetection: ChangeDetectionStrategy.OnPush,
4762
+ styles: [":host{height:54px;align-items:center;font-family:\"Poppins\";font-style:normal;font-weight:600;font-size:14px;line-height:22px}.dr-datepicker__timeframe-select__wrapper{background-color:#f9faff;padding:16px 32px;border-radius:18px 18px 0 0}.dr-datepicker-preset-date{display:flex;flex-direction:column}.dr-datepicker-preset-date__tags{display:flex;padding-bottom:21px;padding-top:10px;font-size:12px}.dr-datepicker-preset-date__tags__tag{cursor:pointer;font-weight:400;line-height:20px!important;padding:2px 8px;border:1px solid #9EA1AA;border-radius:18px;background:#FFFFFF;margin-right:4px}.dr-datepicker-preset-date__tags__tag--selected{color:#4646ce;background:#F2F2FB;border:1px solid #4646CE}.dr-date-paging{display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:16px 32px;grid-gap:4px;gap:4px}.dr-date-paging.flip-page-button{width:20px;height:20px;padding:0;color:#4e566c}.dr-date-paging.flip-page-button:hover{border-radius:50%;background:#f2f2fb;color:#4646ce}.example-header-label{cursor:pointer}.dr-quarterly-datepicker{display:flex;justify-content:space-between;padding:10px}.dr-quarterly-datepicker .quarter-selector{display:block;width:74px;height:40px;text-align:center;border-radius:40px;font-weight:400;padding-top:9px}.dr-quarterly-datepicker .quarter-selector:hover{background:#f2f2fb;color:#4646ce;font-weight:600;cursor:pointer}.dr-quarterly-datepicker .quarter-selector.selected{background-color:#4646ce;color:#f3f7ff;font-weight:600}\n"]
4990
4763
  },] }
4991
4764
  ];
4765
+ DrDatePickerCustomHeaderComponent.ctorParameters = () => [
4766
+ { type: MatCalendar },
4767
+ { type: DateAdapter },
4768
+ { type: CustomDateFormat, decorators: [{ type: Inject, args: [MAT_DATE_FORMATS,] }] },
4769
+ { type: ChangeDetectorRef },
4770
+ { type: DrDatePickerService }
4771
+ ];
4992
4772
 
4993
- const components$2 = [DateTagComponent,
4994
- DayTagComponent,
4995
- WeekTagComponent,
4996
- MonthTagComponent,
4997
- QuarterTagComponent,
4998
- AnyTagComponent,
4999
- YearTagComponent,
5000
- ForecastTagComponent];
5001
- class DateTagModule {
4773
+ // @ts-ignore
4774
+ const moment = require('moment');
4775
+ const noop = () => {
4776
+ };
4777
+ const ɵ0$2 = noop;
4778
+ class DrDatePickerComponent {
4779
+ constructor(cdr, dateAdapter, datePickerService) {
4780
+ this.cdr = cdr;
4781
+ this.dateAdapter = dateAdapter;
4782
+ this.datePickerService = datePickerService;
4783
+ // Whether to transform date, taking end, start, middle of preiod (i.e. set middle of month if timeframe='month')
4784
+ this.periodPosition = DatePickerPeriodPosition.DEFAULT;
4785
+ this.placeholder = 'Select...';
4786
+ this.fiscalYearMonthsModifier = 0;
4787
+ this.calendarViewsTimeframeMapping = {
4788
+ year: 'multi-year',
4789
+ month: 'year',
4790
+ quarter: 'none',
4791
+ day: 'month',
4792
+ };
4793
+ this.customHeader = DrDatePickerCustomHeaderComponent;
4794
+ this.readonly = true;
4795
+ this.timeframeOption = TimeframeOption;
4796
+ this.innerValue = null;
4797
+ this.destroyed$ = new Subject();
4798
+ this.onTouchedCallback = noop;
4799
+ this.onChangeCallback = noop;
4800
+ // Should be as arrow function to avoid lose scope
4801
+ this.dateFilter = (moment) => {
4802
+ if (this.datepickerFilter && moment) {
4803
+ return this.datepickerFilter(moment);
4804
+ }
4805
+ return true;
4806
+ };
4807
+ datePickerService.updatedQuarter$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
4808
+ this.setValueFromMoment(value);
4809
+ });
4810
+ }
4811
+ set format(value) {
4812
+ this.datePickerService.updateTimeframeAndFormat(value);
4813
+ }
4814
+ set min(minDate) {
4815
+ this._min = moment.unix(minDate).utc();
4816
+ }
4817
+ set max(maxDate) {
4818
+ this._max = moment.unix(maxDate).utc();
4819
+ }
4820
+ get value() {
4821
+ return this.innerValue;
4822
+ }
4823
+ set value(v) {
4824
+ if (v !== this.innerValue) {
4825
+ this.setValueFromMoment(v);
4826
+ }
4827
+ this.cdr.markForCheck();
4828
+ }
4829
+ ngAfterViewInit() {
4830
+ this.datePickerService.fiscalYearMonthsModifier = this.fiscalYearMonthsModifier;
4831
+ this.datePickerService.datePickerInstance = this.datePicker;
4832
+ this.datePicker.startView = this.calendarViewsTimeframeMapping[this.datePickerService.timeframe];
4833
+ }
4834
+ ngOnDestroy() {
4835
+ this.destroyed$.next();
4836
+ this.destroyed$.complete();
4837
+ }
4838
+ /**
4839
+ * Updating component inner value according to datepicker timeframe (day, month etc.)
4840
+ * and date position in period (start, end, middle)
4841
+ */
4842
+ tryToNormalaizeTimeframe() {
4843
+ const timeframe = this.datePickerService.timeframe;
4844
+ switch (this.periodPosition) {
4845
+ case DatePickerPeriodPosition.START_OF_PERIOD:
4846
+ if (this.datePickerService.timeframe === TimeframeOption.QUARTER) {
4847
+ this.datePickerService.setStartOfCurrentQuarter(this.innerValue);
4848
+ }
4849
+ else if (this.datePickerService.timeframe === TimeframeOption.YEAR) {
4850
+ this.datePickerService.setStartOfQuarter(this.innerValue, 1);
4851
+ }
4852
+ else {
4853
+ this.innerValue.startOf(timeframe);
4854
+ }
4855
+ break;
4856
+ case DatePickerPeriodPosition.END_OF_PERIOD:
4857
+ if (this.datePickerService.timeframe === TimeframeOption.QUARTER) {
4858
+ this.datePickerService.setEndOfCurrentQuarter(this.innerValue);
4859
+ }
4860
+ else if (this.datePickerService.timeframe === TimeframeOption.YEAR) {
4861
+ this.datePickerService.setEndOfQuarter(this.innerValue, 4);
4862
+ }
4863
+ else {
4864
+ this.innerValue.endOf(timeframe);
4865
+ }
4866
+ break;
4867
+ case DatePickerPeriodPosition.MIDDLE_OF_PERIOD:
4868
+ let endOfPeriod;
4869
+ if (this.datePickerService.timeframe === TimeframeOption.QUARTER) {
4870
+ endOfPeriod = this.innerValue.clone();
4871
+ this.datePickerService.setStartOfCurrentQuarter(this.innerValue);
4872
+ this.datePickerService.setEndOfCurrentQuarter(endOfPeriod);
4873
+ }
4874
+ else if (this.datePickerService.timeframe === TimeframeOption.YEAR) {
4875
+ endOfPeriod = this.innerValue.clone();
4876
+ this.datePickerService.setStartOfQuarter(this.innerValue, 1);
4877
+ this.datePickerService.setEndOfQuarter(endOfPeriod, 4);
4878
+ }
4879
+ else {
4880
+ this.innerValue.startOf(timeframe);
4881
+ endOfPeriod = this.innerValue.clone().endOf(timeframe);
4882
+ }
4883
+ const diff = endOfPeriod.diff(this.innerValue, 'seconds');
4884
+ this.innerValue.add(diff / 2 + 1, 'seconds');
4885
+ break;
4886
+ default:
4887
+ this.innerValue.startOf(timeframe);
4888
+ break;
4889
+ }
4890
+ }
4891
+ chosenPeriodHandler(chosenDate, timeframe) {
4892
+ if (timeframe === TimeframeOption.YEAR) {
4893
+ chosenDate = this.datePickerService.addFiscalYearMonthsToDate(chosenDate);
4894
+ }
4895
+ if (this.datePickerService.timeframe === TimeframeOption.QUARTER && timeframe === TimeframeOption.YEAR) {
4896
+ this.datePickerService.calendarInstance.currentView = CalendarView.FOR_QUARTERS;
4897
+ this.datePickerService.calendarInstance.activeDate = chosenDate;
4898
+ this.cdr.detectChanges();
4899
+ }
4900
+ else if (this.datePickerService.timeframe === timeframe) {
4901
+ this.setValueFromMoment(chosenDate);
4902
+ this.datePicker.close();
4903
+ }
4904
+ }
4905
+ /**
4906
+ * Setting value from outside of component via ngModel or formControl updates
4907
+ */
4908
+ writeValue(value) {
4909
+ /*
4910
+ * We need keep local timestamp for Electron Application
4911
+ * Issue in electron: when we select date, date select with -1 (if we're choosing 2023, output will be 2022)
4912
+ */
4913
+ const convertedValue = document.is_electron ? moment.unix(value) : moment.unix(value).utc();
4914
+ this.innerValue = value ? convertedValue : value;
4915
+ if (this.innerValue) {
4916
+ this.tryToNormalaizeTimeframe();
4917
+ }
4918
+ this.cdr.markForCheck();
4919
+ }
4920
+ registerOnChange(fn) {
4921
+ this.onChangeCallback = fn;
4922
+ }
4923
+ registerOnTouched(fn) {
4924
+ this.onTouchedCallback = fn;
4925
+ }
4926
+ /**
4927
+ * Set inner value from Moment and propagate
4928
+ *
4929
+ * @param momentDate
4930
+ */
4931
+ setValueFromMoment(momentDate) {
4932
+ this.setValue(momentDate.unix());
4933
+ }
4934
+ /**
4935
+ * Set inner value from timestamp and propagate
4936
+ *
4937
+ * @param timestamp
4938
+ */
4939
+ setValue(timestamp) {
4940
+ // isValueUpdating is required for manage clicks on same dates: if isValueUpdating - true then
4941
+ // days are different and subscription on calendar day click action won't trigger Accessor ngModel update
4942
+ // one more time
4943
+ this.datePickerService.isValueUpdating = true;
4944
+ this.writeValue(timestamp);
4945
+ this.onChangeCallback(this.innerValue.unix());
4946
+ setTimeout(() => {
4947
+ this.datePickerService.isValueUpdating = false;
4948
+ });
4949
+ }
5002
4950
  }
5003
- DateTagModule.decorators = [
5004
- { type: NgModule, args: [{
5005
- imports: [
5006
- CommonModule,
5007
- FormsModule,
5008
- ReactiveFormsModule,
5009
- DrInputsModule,
5010
- NgSelectModule
4951
+ DrDatePickerComponent.decorators = [
4952
+ { type: Component, args: [{
4953
+ selector: 'dr-date-picker',
4954
+ template: "<i class=\"dr-icon-date\"></i>\n<input [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [matDatepickerFilter]=\"dateFilter\"\n [disabled]=\"disabled\"\n [placeholder]=\"placeholder\"\n [drDatePickerFormat]=\"datePickerService.format$ | async\"\n [readonly]=\"readonly\"\n [min]=\"_min\"\n [max]=\"_max\"/>\n<mat-datepicker #datePicker\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenPeriodHandler($event, timeframeOption.YEAR)\"\n (monthSelected)=\"chosenPeriodHandler($event, timeframeOption.MONTH)\">\n</mat-datepicker>\n",
4955
+ changeDetection: ChangeDetectionStrategy.OnPush,
4956
+ providers: [
4957
+ { provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerComponent, multi: true },
4958
+ DrDatePickerService
5011
4959
  ],
5012
- exports: components$2,
5013
- declarations: components$2,
4960
+ 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 #9EA1AA;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:#9ea1aa}: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{display:flex;align-items:center;position:absolute;color:#999;left:8px;top:0;bottom:0}: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"]
5014
4961
  },] }
5015
4962
  ];
5016
-
5017
- class ListTagModule {
5018
- }
5019
- ListTagModule.decorators = [
5020
- { type: NgModule, args: [{
5021
- imports: [
5022
- CommonModule,
5023
- FormsModule,
5024
- ReactiveFormsModule,
5025
- DrInputsModule,
5026
- ],
5027
- exports: [ListTagComponent],
5028
- providers: [],
5029
- declarations: [
5030
- ListTagComponent
5031
- ],
5032
- },] }
4963
+ DrDatePickerComponent.ctorParameters = () => [
4964
+ { type: ChangeDetectorRef },
4965
+ { type: DateAdapter },
4966
+ { type: DrDatePickerService }
5033
4967
  ];
4968
+ DrDatePickerComponent.propDecorators = {
4969
+ format: [{ type: Input }],
4970
+ min: [{ type: Input }],
4971
+ max: [{ type: Input }],
4972
+ periodPosition: [{ type: Input }],
4973
+ placeholder: [{ type: Input }],
4974
+ disabled: [{ type: Input }, { type: HostBinding, args: ['class.disabled',] }],
4975
+ fiscalYearMonthsModifier: [{ type: Input }],
4976
+ datepickerFilter: [{ type: Input }],
4977
+ datePicker: [{ type: ViewChild, args: ['datePicker',] }]
4978
+ };
5034
4979
 
5035
- class DrDynamicTagComponent {
5036
- constructor() {
5037
- this.lockedTags = [];
5038
- this.tagChange = new EventEmitter();
5039
- this.tagAdd = new EventEmitter();
5040
- }
5041
- get isPrimitiveDataSource() {
5042
- const values = Object.values(this.values) || [];
5043
- return !isObject(values[0]);
4980
+ class DrDatePickerWithTimeframeComponent extends DrDatePickerComponent {
4981
+ constructor(cdr, dateAdapter, datePickerService) {
4982
+ super(cdr, dateAdapter, datePickerService);
4983
+ this.cdr = cdr;
4984
+ this.dateAdapter = dateAdapter;
4985
+ this.datePickerService = datePickerService;
4986
+ this.isDashboardDatepicker = false;
4987
+ this.canSelectTimeframe = true;
4988
+ // eslint-disable-next-line
4989
+ this.onChangeFormat = new EventEmitter();
4990
+ this.onChangePresetTag = new EventEmitter();
4991
+ this.pagingSetup = {
4992
+ [TimeframeOption.YEAR]: (forward) => this.getNextDate('addCalendarYears', 1, forward),
4993
+ [TimeframeOption.QUARTER]: (forward) => this.getNextDate('addCalendarMonths', 3, forward),
4994
+ [TimeframeOption.MONTH]: (forward) => this.getNextDate('addCalendarMonths', 1, forward),
4995
+ [TimeframeOption.DAY]: (forward) => this.getNextDate('addCalendarDays', 1, forward),
4996
+ [TimeframeOption.WEEK]: (forward) => this.getNextDate('addCalendarDays', 7, forward)
4997
+ };
4998
+ this.isNextDateDisabled = false;
4999
+ this.isPrevDateDisabled = false;
5000
+ this.onChangeDebounced$ = new Subject();
5001
+ datePickerService.isTimeframeSelectionEnabled = true;
5002
+ datePickerService.format$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
5003
+ this.onChangeFormat.emit(datePickerService.normalizeValue(value));
5004
+ });
5005
+ datePickerService.presetTag$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
5006
+ let tagObj = PRESET_TAGS_LIST.find((val) => (val === null || val === void 0 ? void 0 : val.key) === value);
5007
+ this.presetTagSelected = tagObj === null || tagObj === void 0 ? void 0 : tagObj.label;
5008
+ this.onChangePresetTag.emit(value);
5009
+ });
5010
+ this.datePickerService.onSameDaySelectedInCalendar$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
5011
+ this.setValueFromMoment(value);
5012
+ });
5013
+ datePickerService.updatedDateAndClose$.pipe(takeUntil(this.destroyed$)).subscribe((value) => {
5014
+ if (value) {
5015
+ this.setValueFromMoment(value);
5016
+ }
5017
+ else {
5018
+ this.onChangeCallback(this.innerValue.unix());
5019
+ }
5020
+ this.datePicker.close();
5021
+ });
5044
5022
  }
5045
- ngOnChanges(changes) {
5046
- this.updateDynamicTagValues();
5023
+ get isDashboardClassDisplayed() {
5024
+ return this.isDashboardDatepicker;
5047
5025
  }
5048
- onTagChanged($event) {
5049
- var _a, _b;
5050
- const resultEvent = {
5051
- id: this.tagConfig.id,
5052
- name: this.tagConfig.name,
5053
- value: $event,
5054
- locked: this.lockedTags.includes($event)
5055
- };
5056
- if (!isNil((_a = this.selectedTag) === null || _a === void 0 ? void 0 : _a.locked)) {
5057
- resultEvent.locked = this.selectedTag.locked;
5058
- }
5059
- if (!isNil((_b = this.selectedTag) === null || _b === void 0 ? void 0 : _b.label)) {
5060
- resultEvent.label = this.selectedTag.label;
5026
+ ;
5027
+ set dateFormatConfig(value) {
5028
+ if (value) {
5029
+ this.datePickerService.formatConfig = Object.assign(Object.assign({}, this.datePickerService.formatConfig), value);
5030
+ this.cdr.markForCheck();
5061
5031
  }
5062
- this.isLockedTagSelected = resultEvent.locked;
5063
- this.tagChange.emit(resultEvent);
5064
5032
  }
5065
- onOptionClick($event, tagValue) {
5066
- if (this.lockedTags.includes(tagValue)) {
5067
- $event.stopImmediatePropagation();
5033
+ set availableTimeframes(value) {
5034
+ if (value && value.length) {
5035
+ this.datePickerService.availableTimeframes = value;
5068
5036
  }
5069
5037
  }
5070
- onDynamicValueAdd($event) {
5071
- const parentValueKey = this.getParentValueKey();
5072
- const parentValues = this.values[parentValueKey] || [];
5073
- if (this.isPrimitiveDataSource) {
5074
- this.values[parentValueKey] = [$event, ...parentValues];
5038
+ set isUsingDateTagPresets(flag) {
5039
+ this.datePickerService.isUsingDateTagPresets = flag;
5040
+ }
5041
+ set presetTag(tag) {
5042
+ this.datePickerService.presetTag$.next(tag);
5043
+ }
5044
+ get value() {
5045
+ return this.innerValue;
5046
+ }
5047
+ set value(v) {
5048
+ this.setValueFromMoment(v);
5049
+ this.cdr.markForCheck();
5050
+ }
5051
+ get displayedFormattedValue() {
5052
+ if (!this.value) {
5053
+ return this.placeholder;
5075
5054
  }
5076
- else {
5077
- this.values[parentValueKey] = [{ value: $event }, ...parentValues];
5055
+ let displayValue = _.cloneDeep(this.value);
5056
+ if (this.datePickerService.isTimeframeDependingOnFY(this.datePickerService.timeframe)) {
5057
+ displayValue = this.datePickerService.subtractFiscalYearMonthsFromDate(displayValue);
5078
5058
  }
5079
- this.selectedDynamicTag = $event;
5080
- this.currentValues = this.values[parentValueKey];
5081
- this.onTagChanged($event);
5082
- this.tagAdd.emit($event);
5059
+ const formatCached = this.datePickerService.format$.getValue();
5060
+ return this.datePickerService.getDisplayPrefix() + displayValue.format(formatCached);
5083
5061
  }
5084
- updateDynamicTagValues() {
5085
- var _a;
5086
- const parentValueKey = this.getParentValueKey();
5087
- this.currentValues = this.values[parentValueKey];
5088
- this.selectedDynamicTag = this.getSelectedDynamicTag(this.currentValues, (_a = this.selectedTag) === null || _a === void 0 ? void 0 : _a.value);
5089
- this.onTagChanged(this.selectedDynamicTag);
5062
+ ngOnInit() {
5063
+ this.datePickerService.isTimeframeSelectionEnabled = this.canSelectTimeframe;
5064
+ this.cdr.markForCheck();
5065
+ if (this.paginationDebounce) {
5066
+ this.onChangeDebounced$.pipe(takeUntil(this.destroyed$), debounceTime(this.paginationDebounce)).subscribe((value) => {
5067
+ this.onChangeCallback(value);
5068
+ });
5069
+ }
5090
5070
  }
5091
- getSelectedDynamicTag(currentValues, selectedValue) {
5092
- if (!(currentValues === null || currentValues === void 0 ? void 0 : currentValues.length))
5093
- return null;
5094
- if (isObject(currentValues[0])) {
5095
- const valueFromConfig = find(currentValues, { value: selectedValue });
5096
- const favoriteValue = find(currentValues, { is_favorite: true });
5097
- return (valueFromConfig || favoriteValue || currentValues[0]).value;
5071
+ pagingClicked(forward) {
5072
+ if (this.pagingSetup[this.datePickerService.timeframe]) {
5073
+ const nextValue = this.pagingSetup[this.datePickerService.timeframe](forward);
5074
+ this.pagingDateChange(nextValue);
5075
+ }
5076
+ this.datePicker.close();
5077
+ }
5078
+ pagingDateChange(newValue) {
5079
+ if (this.paginationDebounce) {
5080
+ // this is required for not sending extra requests when user quickly clicking on pagination
5081
+ // here we do the same as in setValueFromMoment(newValue) with difference
5082
+ // that updating of ngModel/formControl is debounced
5083
+ this.datePickerService.resetPresetTag();
5084
+ const timestamp = newValue.unix();
5085
+ this.writeValue(timestamp);
5086
+ this.onChangeDebounced$.next(this.innerValue.unix());
5087
+ }
5088
+ else {
5089
+ this.setValueFromMoment(newValue);
5098
5090
  }
5099
- const valueFromConfig = find(currentValues, (value) => value === selectedValue);
5100
- return (valueFromConfig || currentValues[0]);
5101
5091
  }
5102
- getParentValueKey() {
5103
- return map(this.connectedTags, this.tryToParseParentValue).join('__');
5092
+ /**
5093
+ * Set inner value from timestamp and propagate
5094
+ *
5095
+ * @param timestamp
5096
+ */
5097
+ setValue(timestamp) {
5098
+ this.datePickerService.resetPresetTag();
5099
+ super.setValue(timestamp);
5104
5100
  }
5105
- tryToParseParentValue(connectedTags) {
5106
- if (isNumber(connectedTags.value)) {
5107
- const momentData = moment$9.unix(connectedTags.value);
5108
- const convertedParentValue = momentData.get('year'); // TODO: add input prop (selectedTimeDimension) or Format
5109
- if (momentData.isValid() && convertedParentValue) {
5110
- return convertedParentValue;
5111
- }
5112
- }
5113
- return connectedTags.value;
5101
+ writeValue(value) {
5102
+ super.writeValue(value);
5103
+ if (!value)
5104
+ return;
5105
+ this.restrictPagination();
5106
+ }
5107
+ getNextDate(actionCall, amount, forward) {
5108
+ var _a, _b;
5109
+ return (_b = (_a = this.dateAdapter)[actionCall]) === null || _b === void 0 ? void 0 : _b.call(_a, this.innerValue, forward ? amount : -amount);
5110
+ }
5111
+ restrictPagination() {
5112
+ if (!this._min && !this._max)
5113
+ return;
5114
+ const nextValue = this.pagingSetup[this.datePickerService.timeframe](true);
5115
+ const prevValue = this.pagingSetup[this.datePickerService.timeframe](false);
5116
+ this.isNextDateDisabled = this._max && nextValue && nextValue.unix() > this._max.unix();
5117
+ this.isPrevDateDisabled = this._min && prevValue && prevValue.unix() < this._min.unix();
5114
5118
  }
5115
5119
  }
5116
- DrDynamicTagComponent.decorators = [
5120
+ DrDatePickerWithTimeframeComponent.decorators = [
5117
5121
  { type: Component, args: [{
5118
- selector: 'dr-dynamic-tag',
5119
- template: "<p class=\"dynamic-tag__label\">{{ tagConfig.name }}</p>\n<dr-select [(ngModel)]=\"selectedDynamicTag\"\n [class.dynamic-tag__locked]=\"isLockedTagSelected\"\n bindLabel=\"value\"\n bindValue=\"value\"\n [items]=\"currentValues\"\n [disabled]=\"disabled\"\n dropdownClass=\"dynamic-tag__select dr-tag__select\"\n (ngModelChange)=\"onTagChanged($event)\">\n <ng-template #optionHeaderTemplate *ngIf=\"isDynamicTagAddEnabled\">\n <dr-select-add-item bindValue=\"value\"\n [values]=\"currentValues\"\n [dynamicAddLabel]=\"' Add new ' + tagConfig.name\"\n (dynamicValueAdded)=\"onDynamicValueAdd($event)\"></dr-select-add-item>\n </ng-template>\n <ng-template #labelTemplate let-item=\"item\">\n <div class=\"dynamic-tag__field--label\">\n <p class=\"dynamic-tag__field__text\">{{ item?.value || item }}</p>\n <i *ngIf=\"item?.is_favorite\" class=\"dynamic-tag__field__icon dr-icon-star-fill\"></i>\n </div>\n </ng-template>\n <ng-template #optionTemplate let-item=\"item\">\n <div class=\"dynamic-tag__field--option\"\n [class.disabled]=\"lockedTags.includes(item?.value || item)\"\n (click)=\"onOptionClick($event, item?.value || item)\">\n <p class=\"dynamic-tag__field__text\">{{ item?.value || item }}</p>\n <i *ngIf=\"item?.is_favorite\" class=\"dynamic-tag__field__icon dr-icon-star-fill\"></i>\n </div>\n </ng-template>\n</dr-select>\n",
5120
- styles: [".dynamic-tag__label{margin:0 0 4px;color:#0c142b;font-size:14px;font-weight:400;line-height:22px}.dynamic-tag__field,.dynamic-tag__field--option,.dynamic-tag__field--label{cursor:pointer;height:24px}.dynamic-tag__field--option{padding:8px 12px;width:100%;display:flex;justify-content:space-between;align-items:center}.dynamic-tag__field--option.disabled{opacity:.5;box-sizing:content-box}.dynamic-tag__field--label{display:flex;align-items:center}.dynamic-tag__field--label>.dynamic-tag__field__icon{position:absolute;right:25px}.dynamic-tag__field--label>dynamic-tag__field__text{margin:0}.dr-icon-star-fill{color:#f0bc57}::ng-deep dr-select.dynamic-tag__locked>ng-select>.ng-select-container{opacity:.4}::ng-deep .ng-option:has(.dynamic-tag__field--option){padding:0!important}\n"]
5121
- },] }
5122
- ];
5123
- DrDynamicTagComponent.propDecorators = {
5124
- values: [{ type: Input }],
5125
- tagConfig: [{ type: Input }],
5126
- selectedTag: [{ type: Input }],
5127
- lockedTags: [{ type: Input }],
5128
- connectedTags: [{ type: Input }],
5129
- isDynamicTagAddEnabled: [{ type: Input }],
5130
- disabled: [{ type: Input }],
5131
- tagChange: [{ type: Output }],
5132
- tagAdd: [{ type: Output }]
5133
- };
5134
-
5135
- class DrDynamicTagModule {
5136
- }
5137
- DrDynamicTagModule.decorators = [
5138
- { type: NgModule, args: [{
5139
- declarations: [DrDynamicTagComponent],
5140
- imports: [
5141
- CommonModule,
5142
- DrInputsModule,
5143
- FormsModule,
5122
+ selector: 'dr-date-picker-with-timeframe',
5123
+ template: "<dr-button [disabled]=\"isPrevDateDisabled\" *ngIf=\"!disabled\" theme=\"icon\" icon=\"dr-icon-arrow-left\" (click)=\"pagingClicked(false)\"></dr-button>\n<div class=\"dr-datepicker-input-container\">\n <i *ngIf=\"isDashboardDatepicker\" class=\"dr-icon-date\"></i>\n\n <div class=\"dr-datepicker-input-container__formatted-value-display\" (click)=\"datepickerInput.click()\">\n <span *ngIf=\"presetTagSelected && datePickerService.isUsingDateTagPresets\"> {{ presetTagSelected }} </span>\n <span>{{ presetTagSelected && datePickerService.isUsingDateTagPresets ? '(' + displayedFormattedValue + ')' : displayedFormattedValue }}</span>\n </div>\n <input\n #datepickerInput\n [(ngModel)]=\"value\"\n (click)=\"datePicker.open()\"\n [matDatepicker]=\"datePicker\"\n [readonly]=\"readonly\"\n [min]=\"_min\"\n [max]=\"_max\"\n />\n</div>\n<dr-button [disabled]=\"isNextDateDisabled\" *ngIf=\"!disabled\" theme=\"icon\" icon=\"dr-icon-arrow-right\" (click)=\"pagingClicked(true)\"></dr-button>\n<mat-datepicker #datePicker\n class=\"dr-timeframe-datepicker\"\n [calendarHeaderComponent]=\"customHeader\"\n (yearSelected)=\"chosenPeriodHandler($event, timeframeOption.YEAR)\"\n (monthSelected)=\"chosenPeriodHandler($event, timeframeOption.MONTH)\"\n [panelClass]=\"datePickerService.isUsingDateTagPresets ? 'date-picker-preset-tag' : 'dr-timeframe-datepicker'\"\n >\n</mat-datepicker>\n",
5124
+ changeDetection: ChangeDetectionStrategy.OnPush,
5125
+ providers: [
5126
+ { provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerWithTimeframeComponent, multi: true },
5127
+ { provide: DrDatePickerService }
5144
5128
  ],
5145
- exports: [DrDynamicTagComponent]
5129
+ 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 #9EA1AA;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:#9ea1aa}: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{display:flex;align-items:center;position:absolute;color:#999;left:8px;top:0;bottom:0}: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}:host{border:none;display:flex;align-items:center}:host.disabled{background:transparent;color:inherit}:host.disabled.dr-date-picker-on-dashboard .dr-datepicker-input-container__formatted-value-display{text-decoration:none;color:#6d6e6f;font-weight:normal}:host.dr-date-picker-on-dashboard{width:-moz-fit-content;width:fit-content;justify-content:space-between}:host.dr-date-picker-on-dashboard mat-datepicker{position:absolute}:host.dr-date-picker-on-dashboard:after{visibility:hidden}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container{display:flex;flex-direction:row;justify-content:center;align-items:center;margin-left:-10px}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container__formatted-value-display{font-weight:600;width:auto;margin-left:5px}:host.dr-date-picker-on-dashboard .dr-datepicker-input-container .dr-icon-date{display:block;position:relative;top:0;margin-right:8px;color:#4e566c}:host .dr-datepicker-input-container input{visibility:hidden;position:absolute;width:100%}:host .dr-datepicker-input-container__formatted-value-display{width:90px;height:22px;padding-left:0;text-align:center;line-height:22px;color:#0c142b;-webkit-text-decoration-line:underline;text-decoration-line:underline}:host .dr-datepicker-input-container__formatted-value-display:hover{background-color:#f2f2fb;border-radius:5px;cursor:pointer;-webkit-text-decoration-line:underline;text-decoration-line:underline;color:#4646ce}::ng-deep .date-picker-preset-tag{width:386px!important}::ng-deep .date-picker-preset-tag .mat-calendar-content{padding-left:32px!important;padding-right:32px!important}\n"]
5146
5130
  },] }
5147
5131
  ];
5148
-
5149
- class DrTagModule {
5150
- }
5151
- DrTagModule.decorators = [
5152
- { type: NgModule, args: [{
5153
- imports: [
5154
- CommonModule,
5155
- DateTagModule,
5156
- ListTagModule,
5157
- DrDynamicTagModule
5158
- ],
5159
- exports: [DrTagComponent],
5160
- providers: [],
5161
- declarations: [
5162
- DrTagComponent
5163
- ],
5164
- },] }
5132
+ DrDatePickerWithTimeframeComponent.ctorParameters = () => [
5133
+ { type: ChangeDetectorRef },
5134
+ { type: DateAdapter },
5135
+ { type: DrDatePickerService }
5165
5136
  ];
5137
+ DrDatePickerWithTimeframeComponent.propDecorators = {
5138
+ isDashboardClassDisplayed: [{ type: HostBinding, args: ['class.dr-date-picker-on-dashboard',] }],
5139
+ isDashboardDatepicker: [{ type: Input }],
5140
+ dateFormatConfig: [{ type: Input }],
5141
+ canSelectTimeframe: [{ type: Input }],
5142
+ availableTimeframes: [{ type: Input }],
5143
+ paginationDebounce: [{ type: Input }],
5144
+ isUsingDateTagPresets: [{ type: Input }],
5145
+ presetTag: [{ type: Input }],
5146
+ onChangeFormat: [{ type: Output }],
5147
+ onChangePresetTag: [{ type: Output }]
5148
+ };
5166
5149
 
5167
- class DrAvatarModule {
5150
+ class DrDatePickerFormatDirective {
5151
+ constructor(matDateFormat, ngControl) {
5152
+ this.matDateFormat = matDateFormat;
5153
+ this.ngControl = ngControl;
5154
+ }
5155
+ set datePickerFormat(format) {
5156
+ var _a;
5157
+ if (this.configDateParse) {
5158
+ this.matDateFormat.updateDateFormat(this.configDateParse, this.configDateDisplay);
5159
+ }
5160
+ else {
5161
+ this.matDateFormat.updateDateFormat({ dateInput: format });
5162
+ }
5163
+ const value = this.ngControl.value;
5164
+ (_a = this.ngControl.valueAccessor) === null || _a === void 0 ? void 0 : _a.writeValue(value);
5165
+ }
5168
5166
  }
5169
- DrAvatarModule.decorators = [
5170
- { type: NgModule, args: [{
5171
- declarations: [
5172
- DrAvatarComponent,
5173
- DrAvatarPipe
5174
- ],
5175
- exports: [
5176
- DrAvatarComponent,
5177
- DrAvatarPipe
5178
- ],
5179
- imports: [
5180
- MatTooltipModule,
5181
- DrTooltipModule,
5182
- CommonModule
5167
+ DrDatePickerFormatDirective.decorators = [
5168
+ { type: Directive, args: [{
5169
+ selector: '[drDatePickerFormat]',
5170
+ providers: [
5171
+ {
5172
+ provide: DateAdapter,
5173
+ useClass: MomentDateAdapter
5174
+ },
5175
+ {
5176
+ provide: MAT_DATE_FORMATS,
5177
+ useClass: CustomDateFormat
5178
+ }
5183
5179
  ]
5184
5180
  },] }
5185
5181
  ];
5182
+ DrDatePickerFormatDirective.ctorParameters = () => [
5183
+ { type: CustomDateFormat, decorators: [{ type: Inject, args: [MAT_DATE_FORMATS,] }] },
5184
+ { type: NgControl, decorators: [{ type: Optional }] }
5185
+ ];
5186
+ DrDatePickerFormatDirective.propDecorators = {
5187
+ configDateParse: [{ type: Input }],
5188
+ configDateDisplay: [{ type: Input }],
5189
+ datePickerFormat: [{ type: Input, args: ['drDatePickerFormat',] }]
5190
+ };
5186
5191
 
5187
- const components$1 = [DrSpinnerComponent];
5188
- const directives = [DrSpinnerDirective];
5189
- class DrSpinnerModule {
5192
+ class DrShowTimeframePipe {
5193
+ transform(arr, showOptions) {
5194
+ return arr.filter(item => showOptions.includes(item.timeframe));
5195
+ }
5190
5196
  }
5191
- DrSpinnerModule.decorators = [
5192
- { type: NgModule, args: [{
5193
- imports: [
5194
- CommonModule,
5195
- ],
5196
- exports: [...components$1, ...directives],
5197
- declarations: [...components$1, ...directives]
5197
+ DrShowTimeframePipe.decorators = [
5198
+ { type: Pipe, args: [{
5199
+ name: 'drShowTimeframePipe'
5198
5200
  },] }
5199
5201
  ];
5200
5202
 
5201
- class DrPopoverModule {
5203
+ class DrSelectAddItemComponent {
5204
+ constructor(drSelect) {
5205
+ this.drSelect = drSelect;
5206
+ this.currentValues = [];
5207
+ this.dynamicAddLabel = 'Add new';
5208
+ this.values = [];
5209
+ this.dynamicValueAdded = new EventEmitter();
5210
+ }
5211
+ set inputRef(input) {
5212
+ if (!input)
5213
+ return;
5214
+ input.focus();
5215
+ }
5216
+ ngOnChanges(changes) {
5217
+ this.calculateCurrentValues();
5218
+ }
5219
+ ngOnInit() {
5220
+ this.calculateCurrentValues();
5221
+ }
5222
+ onDynamicAdding() {
5223
+ this.isDynamicAdding = true;
5224
+ }
5225
+ onDynamicAddingClose() {
5226
+ this.isDynamicAdding = false;
5227
+ this.dynamicValue = '';
5228
+ }
5229
+ isDynamicValueValid() {
5230
+ var _a;
5231
+ const trimmedValue = (_a = this.dynamicValue) === null || _a === void 0 ? void 0 : _a.trim();
5232
+ if (!trimmedValue)
5233
+ return false;
5234
+ return !this.currentValues.includes(trimmedValue);
5235
+ }
5236
+ onDynamicAdd(value, keydownEvent) {
5237
+ this.isDirty = true;
5238
+ if (!this.isDynamicValueValid())
5239
+ return;
5240
+ if (keydownEvent && keydownEvent.key !== 'Enter')
5241
+ return;
5242
+ this.onDynamicAddingClose();
5243
+ this.drSelect.close();
5244
+ this.dynamicValueAdded.emit(value === null || value === void 0 ? void 0 : value.trim());
5245
+ }
5246
+ calculateCurrentValues() {
5247
+ this.currentValues = this.bindValue
5248
+ ? reduce(this.values, (acc, curr) => {
5249
+ acc.push(curr[this.bindValue]);
5250
+ return acc;
5251
+ }, [])
5252
+ : this.values;
5253
+ }
5202
5254
  }
5203
- DrPopoverModule.decorators = [
5204
- { type: NgModule, args: [{
5205
- imports: [
5206
- CommonModule,
5207
- ],
5208
- exports: [
5209
- DrPopoverDirective,
5210
- DrPopoverComponent,
5211
- ],
5212
- providers: [],
5213
- declarations: [
5214
- DrPopoverDirective,
5215
- DrPopoverComponent,
5216
- ],
5255
+ DrSelectAddItemComponent.decorators = [
5256
+ { type: Component, args: [{
5257
+ selector: 'dr-select-add-item',
5258
+ template: "<div class=\"dr-select__dynamic-add dynamic-add\">\n <div class=\"dynamic-add__add-item\" (click)=\"onDynamicAdding()\">\n <i class=\"dr-icon-add\"></i>\n <p class=\"dynamic-add__add-item__text\">{{ dynamicAddLabel }}</p>\n </div>\n <div *ngIf=\"isDynamicAdding\" class=\"dynamic-add__field\">\n <dr-input #dynamicInputRef\n class=\"dynamic-add__field__input\"\n [class.dynamic-add__field__input--error]=\"!isDynamicValueValid() && isDirty\"\n [(ngModel)]=\"dynamicValue\"\n (keydown)=\"onDynamicAdd(dynamicValue, $event)\"\n placeholder=\"Type...\"></dr-input>\n <div class=\"dynamic-add__field__buttons\">\n <dr-button *ngIf=\"dynamicValue && isDynamicValueValid()\"\n theme=\"icon\"\n icon=\"dr-icon-approve\"\n iconSize=\"18px\"\n (click)=\"onDynamicAdd(dynamicValue)\"></dr-button>\n <dr-button theme=\"icon\"\n icon=\"dr-icon-exit\"\n iconSize=\"18px\"\n (click)=\"onDynamicAddingClose()\"></dr-button>\n </div>\n </div>\n</div>\n",
5259
+ changeDetection: ChangeDetectionStrategy.OnPush,
5260
+ styles: [".dynamic-add__add-item{cursor:pointer;display:flex;align-items:center;border-bottom:1px solid #dfe0e3;padding:6px}.dynamic-add__add-item:hover{background:#f9f7ff}.dynamic-add__add-item__text{font-size:14px;line-height:22px;margin:0}.dynamic-add__field{position:relative}.dynamic-add__field__buttons{position:absolute;top:0;right:0;bottom:0;display:flex;align-items:center}::ng-deep .ng-dropdown-panel .ng-dropdown-header:has(.dynamic-add){padding:0;border:none}::ng-deep .dynamic-add__field__input{padding-left:12px!important;height:36px!important;border:none!important;background:#f9f7ff!important;border-radius:0!important}::ng-deep .dynamic-add__field__input>input{background:#f9f7ff}::ng-deep .dynamic-add__field__input>input::placeholder{line-height:22px;font-size:14px;font-weight:400;color:#9ea1aa}::ng-deep .dynamic-add__field__input--error{background:#ffdfe4!important}::ng-deep .dynamic-add__field__input--error>input{background:#ffdfe4}\n"]
5217
5261
  },] }
5218
5262
  ];
5263
+ DrSelectAddItemComponent.ctorParameters = () => [
5264
+ { type: DrSelectComponent }
5265
+ ];
5266
+ DrSelectAddItemComponent.propDecorators = {
5267
+ dynamicAddLabel: [{ type: Input }],
5268
+ bindValue: [{ type: Input }],
5269
+ values: [{ type: Input }],
5270
+ dynamicValueAdded: [{ type: Output }],
5271
+ inputRef: [{ type: ViewChild, args: ['dynamicInputRef',] }]
5272
+ };
5219
5273
 
5220
- class DrDropdownModule {
5274
+ class TooltipInfoComponent {
5275
+ constructor() {
5276
+ }
5221
5277
  }
5222
- DrDropdownModule.decorators = [
5223
- { type: NgModule, args: [{
5224
- imports: [
5225
- CommonModule,
5226
- DrTooltipModule,
5227
- ],
5228
- declarations: [
5229
- DrDropdownDirective,
5230
- DrDropdownPositionDirective,
5231
- DrDropdownComponent,
5232
- DrDropdownItemShowPipe,
5233
- ],
5234
- exports: [
5235
- DrDropdownDirective,
5236
- DrDropdownPositionDirective,
5237
- DrDropdownComponent,
5238
- DrDropdownItemShowPipe,
5239
- ],
5240
- providers: [
5241
- DrDropdownService,
5242
- ],
5278
+ TooltipInfoComponent.decorators = [
5279
+ { type: Component, args: [{
5280
+ selector: 'dr-tooltip-info',
5281
+ template: "<div class=\"tooltip-info\">\n <i *ngIf=\"data?.icon else defaultIcon\" class=\"fa\" [class]=\"data.icon\" [style.fontSize.px]=\"14\"\n [style.margin.px]=\"12\" [style.color]=\"data?.iconColor || '#7B61FF'\"></i>\n <div class=\"tooltip-info-content-wrapper\">\n <div *ngIf=\"data?.title\" class=\"tooltip-info_header\">\n <span>{{data.title}}</span>\n </div>\n <div *ngIf=\"data?.description\" class=\"tooltip-info_description\"\n [class.tooltip-info_description-no-border]=\"!data.title\">\n <ng-container *ngIf=\"!data.title\"></ng-container>\n <span *ngIf=\"!useDescriptionAsHTML\">{{data.description}}</span>\n <div *ngIf=\"useDescriptionAsHTML\" [innerHTML]=\"data.description\"></div>\n </div>\n </div>\n</div>\n\n<ng-template #defaultIcon>\n <ng-container *ngIf=\"!data.icon\">\n <div class=\"default-icon\"></div>\n </ng-container>\n</ng-template>\n",
5282
+ changeDetection: ChangeDetectionStrategy.OnPush,
5283
+ styles: [".tooltip-info{width:316px;display:flex}.tooltip-info-content-wrapper{display:flex;flex-direction:column;padding-top:10px}.tooltip-info_header{padding:0 16px 6px 0;font-weight:bold;font-size:14px;line-height:16px;letter-spacing:.25px;display:flex;justify-content:flex-start}.tooltip-info_header>i{margin-right:10px}.tooltip-info-content-wrapper{padding-top:10px}.tooltip-info_description{display:flex;align-items:flex-start;border-top:1px solid #aeb5bb;padding:12px 10px 10px 0;text-align:left;font-weight:normal;font-size:14px;line-height:22px}.tooltip-info_description-no-border{padding-top:0;border-top:none}.tooltip-info_description>i{margin-right:10px}:host.tooltip-info-medium .tooltip-info{max-width:272px}:host.tooltip-info-medium .tooltip-info-content-wrapper{padding-top:10px}:host.tooltip-info-medium .tooltip-info_header,:host.tooltip-info-medium .tooltip-info_description{min-height:unset;border-top:none;font-size:14px;line-height:22px}:host.tooltip-info-medium .tooltip-info_header{padding:10px 10px 0 0}:host.tooltip-info-medium .tooltip-info_description{padding:10px 12px 10px 0}:host.tooltip-info-medium .tooltip-info .default-icon:before{background:url(\"data:image/svg+xml,%3Csvg width%3D%2216%22 height%3D%2216%22 viewBox%3D%220 0 16 16%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cpath d%3D%22M8.00008 2.66669C5.05341 2.66669 2.66675 5.05335 2.66675 8.00002C2.66675 10.9467 5.05341 13.3334 8.00008 13.3334C10.9467 13.3334 13.3334 10.9467 13.3334 8.00002C13.3334 5.05335 10.9467 2.66669 8.00008 2.66669ZM8.53341 10.6667H7.46675V7.46669H8.53341V10.6667ZM8.53341 6.40002H7.46675V5.33335H8.53341V6.40002Z%22 fill%3D%22%237B61FF%22%2F%3E%3C%2Fsvg%3E\") no-repeat;background-size:100% 100%;display:inline-block;height:20px;width:20px;content:\"\"}:host.tooltip-info-small .tooltip-info{width:auto}:host.tooltip-info-small .tooltip-info-content-wrapper{padding-top:10px}:host.tooltip-info-small .tooltip-info_header,:host.tooltip-info-small .tooltip-info_description{min-height:unset;border-top:none;font-size:14px;line-height:22px}:host.tooltip-info-small .tooltip-info_header{padding:0 10px 0 0}:host.tooltip-info-small .tooltip-info_description{padding:0 12px 10px 0}:host.tooltip-info-small .tooltip-info .default-icon:before{background:url(\"data:image/svg+xml,%3Csvg width%3D%2216%22 height%3D%2216%22 viewBox%3D%220 0 16 16%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cpath d%3D%22M8.00008 2.66669C5.05341 2.66669 2.66675 5.05335 2.66675 8.00002C2.66675 10.9467 5.05341 13.3334 8.00008 13.3334C10.9467 13.3334 13.3334 10.9467 13.3334 8.00002C13.3334 5.05335 10.9467 2.66669 8.00008 2.66669ZM8.53341 10.6667H7.46675V7.46669H8.53341V10.6667ZM8.53341 6.40002H7.46675V5.33335H8.53341V6.40002Z%22 fill%3D%22%237B61FF%22%2F%3E%3C%2Fsvg%3E\") no-repeat;background-size:100% 100%;display:inline-block;height:20px;width:20px;content:\"\"}.default-icon{position:relative;width:18px;height:18px;margin:10px}.default-icon:before{background:url(\"data:image/svg+xml,%3Csvg width%3D%2216%22 height%3D%2216%22 viewBox%3D%220 0 16 16%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cpath d%3D%22M8.00008 2.66669C5.05341 2.66669 2.66675 5.05335 2.66675 8.00002C2.66675 10.9467 5.05341 13.3334 8.00008 13.3334C10.9467 13.3334 13.3334 10.9467 13.3334 8.00002C13.3334 5.05335 10.9467 2.66669 8.00008 2.66669ZM8.53341 10.6667H7.46675V7.46669H8.53341V10.6667ZM8.53341 6.40002H7.46675V5.33335H8.53341V6.40002Z%22 fill%3D%22%237B61FF%22%2F%3E%3C%2Fsvg%3E\") no-repeat;background-size:100% 100%;display:inline-block;height:18px;width:18px;content:\"\"}\n"]
5243
5284
  },] }
5244
5285
  ];
5286
+ TooltipInfoComponent.ctorParameters = () => [];
5287
+ TooltipInfoComponent.propDecorators = {
5288
+ data: [{ type: Input }],
5289
+ useDescriptionAsHTML: [{ type: Input }]
5290
+ };
5245
5291
 
5246
- class DrTabsModule {
5292
+ class TooltipInfoSimpleComponent {
5293
+ constructor() {
5294
+ }
5247
5295
  }
5248
- DrTabsModule.decorators = [
5249
- { type: NgModule, args: [{
5250
- imports: [
5251
- CommonModule,
5252
- MatTabsModule,
5253
- FormsModule,
5254
- ReactiveFormsModule,
5255
- DrInputsModule,
5256
- DrTooltipModule
5257
- ],
5258
- exports: [
5259
- DrTabsComponent,
5260
- DrTabComponent
5261
- ],
5262
- providers: [],
5263
- declarations: [
5264
- DrTabsComponent,
5265
- DrTabComponent
5266
- ],
5296
+ TooltipInfoSimpleComponent.decorators = [
5297
+ { type: Component, args: [{
5298
+ selector: 'dr-tooltip-info-simple',
5299
+ template: "<div class=\"tooltip-info-simple\">\n <div *ngIf=\"context?.title\" class=\"tooltip-info-simple__title\">{{context?.title}}</div>\n <div *ngIf=\"context?.description\" class=\"tooltip-info-simple__description\">{{context?.description}}</div>\n</div>\n",
5300
+ changeDetection: ChangeDetectionStrategy.OnPush,
5301
+ styles: [".tooltip-info-simple{max-width:250px;font-size:14px;line-height:22px;padding:10px 12px;color:#0c142b}.tooltip-info-simple__title{font-weight:600;overflow:hidden;text-overflow:ellipsis}\n"]
5267
5302
  },] }
5268
5303
  ];
5304
+ TooltipInfoSimpleComponent.ctorParameters = () => [];
5305
+ TooltipInfoSimpleComponent.propDecorators = {
5306
+ context: [{ type: Input }]
5307
+ };
5269
5308
 
5270
- const DR_ACCORDION_COMPONENTS = [
5271
- DrAccordionComponent,
5272
- DrAccordionItemComponent,
5273
- DrAccordionItemHeaderComponent,
5274
- DrAccordionItemBodyComponent,
5275
- ];
5276
- class DrAccordionModule {
5309
+ class TooltipNoBodyComponent {
5310
+ constructor() {
5311
+ }
5312
+ ngOnInit() {
5313
+ }
5277
5314
  }
5278
- DrAccordionModule.decorators = [
5279
- { type: NgModule, args: [{
5280
- imports: [CommonModule],
5281
- exports: [...DR_ACCORDION_COMPONENTS],
5282
- declarations: [...DR_ACCORDION_COMPONENTS],
5283
- providers: [],
5315
+ TooltipNoBodyComponent.decorators = [
5316
+ { type: Component, args: [{
5317
+ selector: 'dr-tooltip-no-body',
5318
+ template: "<div class=\"tooltip-bold\" [ngClass]=\"{'tooltip-bold--icon': context?.icon}\">\n <div class=\"tooltip-bold__title\">\n <i *ngIf=\"context?.icon\" [class]=\"context?.icon\" [style.color]=\"context?.iconColor || 'black'\"></i>\n {{ context.title }}\n </div>\n <div class=\"tooltip-bold-text\">\n {{ context.text }}\n </div>\n</div>",
5319
+ changeDetection: ChangeDetectionStrategy.OnPush,
5320
+ styles: [".tooltip-bold{position:relative;box-shadow:0 4px 8px 1px #00000040;border:1px solid #c3c4ce;border-radius:8px;font-size:14px;line-height:22px;padding:10px 12px;background-color:#fff}.tooltip-bold--icon{padding-left:44px}.tooltip-bold__title{font-weight:bold}.tooltip-bold__title>i{position:absolute;width:16px;height:16px;left:10px}\n"]
5284
5321
  },] }
5285
5322
  ];
5323
+ TooltipNoBodyComponent.ctorParameters = () => [];
5324
+ TooltipNoBodyComponent.propDecorators = {
5325
+ context: [{ type: Input }]
5326
+ };
5286
5327
 
5287
- const components = [
5288
- DrLayoutComponent,
5289
- DrLayoutHeaderComponent,
5290
- DrLayoutBodyComponent
5291
- ];
5292
- class DrLayoutModule {
5328
+ class TooltipProcessDefaultComponent {
5329
+ constructor() {
5330
+ }
5293
5331
  }
5294
- DrLayoutModule.decorators = [
5295
- { type: NgModule, args: [{
5296
- imports: [CommonModule],
5297
- exports: [...components],
5298
- declarations: [...components],
5332
+ TooltipProcessDefaultComponent.decorators = [
5333
+ { type: Component, args: [{
5334
+ selector: 'dr-tooltip-process-default',
5335
+ template: `
5336
+ <div class="container" [innerHTML]="text"></div>
5337
+ `,
5338
+ changeDetection: ChangeDetectionStrategy.OnPush,
5339
+ styles: [`
5340
+ .container {
5341
+ width: auto;
5342
+ max-width: 388px;
5343
+ text-align: start;
5344
+ font-size: 14px;
5345
+ line-height: 22px;
5346
+ padding: 10px 12px;
5347
+ color: #151B3F;
5348
+ background-color: #FFF;
5349
+ border-radius: 8px;
5350
+ box-shadow: 0px 4px 8px 1px rgba(0, 0, 0, 0.25);
5351
+ border: 1px solid #C3C4CE;
5352
+ }
5353
+ `]
5299
5354
  },] }
5300
5355
  ];
5356
+ TooltipProcessDefaultComponent.ctorParameters = () => [];
5357
+ TooltipProcessDefaultComponent.propDecorators = {
5358
+ text: [{ type: Input }]
5359
+ };
5301
5360
 
5302
- class DrErrorModule {
5361
+ const TOOLTIP_COMPONENTS = [
5362
+ TooltipInfoComponent,
5363
+ TooltipInfoSimpleComponent,
5364
+ TooltipNoBodyComponent,
5365
+ TooltipProcessDefaultComponent
5366
+ ];
5367
+ class DrTooltipModule {
5303
5368
  }
5304
- DrErrorModule.decorators = [
5369
+ DrTooltipModule.decorators = [
5305
5370
  { type: NgModule, args: [{
5306
5371
  imports: [
5307
- CommonModule,
5308
- FormsModule,
5309
- DrTooltipModule
5372
+ CommonModule
5373
+ ],
5374
+ exports: [
5375
+ TooltipComponent,
5376
+ DrTooltipDirective,
5377
+ ...TOOLTIP_COMPONENTS
5310
5378
  ],
5311
- exports: [DrErrorComponent],
5312
5379
  providers: [],
5313
5380
  declarations: [
5314
- DrErrorComponent
5381
+ TooltipComponent,
5382
+ DrTooltipDirective,
5383
+ ...TOOLTIP_COMPONENTS
5315
5384
  ],
5316
5385
  },] }
5317
5386
  ];
5318
5387
 
5319
- class StepperComponent {
5320
- constructor() {
5321
- this.withoutConnectors = false;
5322
- this.hiddenNames = false;
5323
- this.inlineLabels = false;
5324
- this.disabled = false;
5325
- this.hiddenIndex = false;
5326
- this.stepChange = new EventEmitter();
5327
- }
5328
- selectStep(step) {
5329
- if (step !== this.currentStep && !this.disabled) {
5330
- this.stepChange.emit(step);
5331
- }
5332
- }
5333
- getWidth(step) {
5334
- if (this.withoutConnectors)
5335
- return '0%';
5336
- if (step.completed)
5337
- return '100%';
5338
- if (step.index === 0 || this.steps[step.index - 1].completed)
5339
- return `${((step === null || step === void 0 ? void 0 : step.completedTasks) / (step === null || step === void 0 ? void 0 : step.requiredTasks) * 100) || 0}%`;
5340
- return '0%';
5341
- }
5342
- scrollLeft() {
5343
- this.stepper.nativeElement.scrollLeft -= 80;
5344
- }
5345
- scrollRight() {
5346
- this.stepper.nativeElement.scrollLeft += 80;
5347
- }
5348
- roundWidth(width) {
5349
- return Math.round(width);
5350
- }
5351
- }
5352
- StepperComponent.decorators = [
5353
- { type: Component, args: [{
5354
- selector: 'dr-stepper',
5355
- template: "<div class=\"scroll-section\" *ngIf=\"stepper?.scrollLeft !== 0\" (click)=\"scrollLeft()\">\n <i class=\"dr-icon-arrow-right\"></i>\n</div>\n<div #stepper class=\"stepper\" [ngClass]=\"{'stepper--disabled': disabled}\">\n <ng-container *ngFor=\"let step of steps; let index = index; last as isLast; first as isFirst\">\n <div *ngIf=\"!step.hide\" class=\"step\" (click)=\"selectStep(step)\"\n [class.step-setup]=\"inlineLabels\">\n <div class=\"step-wrapper\" [drTooltip]=\"step.description && tooltip\"\n [drTooltipContext]=\"{ step: step }\"\n [drTooltipPosition]=\"'bottom'\">\n <div data-test=\"step_point\" class=\"step-point\" [class.active]=\"currentStep === step\" [class.completed]=\"step.completed\">\n <div *ngIf=\"step === currentStep;\" class=\"ellipse\"></div>\n <ng-container [ngSwitch]=\"step.completed\">\n <ng-template [ngSwitchCase]=\"true\">\n <div class=\"pointer blue\">\n <i class=\"dr-icon-approve\"></i>\n </div>\n </ng-template>\n <ng-template [ngSwitchCase]=\"false\">\n <div class=\"pointer\" [class.gray]=\"step !== currentStep\"\n [ngClass]=\"{'blue with-ellipse': step === currentStep}\">\n <div [hidden]=\"step === currentStep || hiddenIndex\" class=\"text\">{{index + 1}}</div>\n </div>\n </ng-template>\n </ng-container>\n </div>\n <div data-test=\"step_label_name\" class=\"step-label\" [class.active]=\"currentStep === step\"\n [ngClass]=\"step.completed ? 'completed' : 'uncompleted'\">\n <span [hidden]=\"hiddenNames\">{{step.name}}</span>\n </div>\n <ng-container *ngIf=\"inlineLabels\" [ngTemplateOutlet]=\"connector\"\n [ngTemplateOutletContext]=\"{ index, isLast, step }\">\n </ng-container>\n <span *ngIf=\"step.showProgress\"\n data-test=\"step_progress\"\n class=\"step-progress\">\n {{(step.requiredTasks ? step.completedTasks : step.requiredTasks) + '/' + step.requiredTasks}}\n </span>\n </div>\n <ng-container *ngIf=\"!inlineLabels\" [ngTemplateOutlet]=\"connector\"\n [ngTemplateOutletContext]=\"{ index, isLast, step }\">\n </ng-container>\n </div>\n </ng-container>\n</div>\n<div (click)=\"scrollRight()\" class=\"scroll-section\"\n *ngIf=\"stepper?.scrollWidth > stepper?.clientWidth && roundWidth(stepper?.scrollLeft + stepper?.clientWidth) < stepper?.scrollWidth\">\n <i class=\"dr-icon-arrow-right\"></i>\n</div>\n\n<ng-template #tooltip let-step=\"step\">\n <div class=\"step-tooltip\">\n <div class=\"step-tooltip_name\">{{step.name}}</div>\n <div class=\"step-tooltip_description\">{{step.description}}</div>\n </div>\n</ng-template>\n\n<ng-template #connector let-step=\"step\" let-isLast=\"isLast\" let-index=\"index\">\n <div class=\"step-connector\" [class.only-one-step]=\"steps.length === 1\"\n [class]=\"'step-connector--' + (!inlineLabels ? 'absolute' : 'inline')\"\n *ngIf=\"steps.length === 1 || !isLast\"\n [style.visibility]=\"withoutConnectors || steps[step.index + 1]?.hide ? 'hidden' : 'unset'\"\n [class.connector-grand]=\"!inlineLabels && (index === 0 || index === steps.length - 2)\">\n <div class=\"progress\" [style.width]=\"getWidth(step)\"></div>\n </div>\n</ng-template>\n",
5356
- changeDetection: ChangeDetectionStrategy.Default,
5357
- styles: [":host{font-family:\"Poppins\",sans-serif;display:flex;justify-content:center;height:100%;position:relative}:host .scroll-section{position:absolute;top:0;height:100%;width:108px;display:flex;align-items:center;z-index:10}:host .scroll-section i{font-size:24px;color:#2969b0;background:#f3f7ff;border-radius:24px}:host .scroll-section i:hover{background:#cde1fb;cursor:pointer}:host .scroll-section:first-child{left:0;padding-left:16px;background:linear-gradient(90deg,#ffffff 36.08%,rgba(255,255,255,0) 87.17%)}:host .scroll-section:first-child i{transform:rotate(180deg)}:host .scroll-section:last-child{right:0;padding-right:16px;background:linear-gradient(270deg,#ffffff 36.08%,rgba(255,255,255,0) 87.17%);justify-content:flex-end}:host .stepper{display:flex;align-items:center;height:100%;width:100%;overflow:auto;scroll-behavior:smooth}:host .stepper::-webkit-scrollbar{display:none}:host .stepper--disabled .step:hover{cursor:default}:host .stepper--disabled .step-point .ellipse{border-color:#bcbcbc}:host .stepper--disabled .step-point .pointer{color:#fff;background-color:#bcbcbc;cursor:default}:host .stepper--disabled .step-label{color:#bcbcbc}:host .stepper--disabled .step-connector{background-color:#bcbcbc}:host .stepper--disabled .step-connector .progress{background-color:#bcbcbc}:host .step{position:relative;display:flex;flex-direction:column;width:120px;align-items:center;flex-shrink:0;flex-grow:1}:host .step:hover{cursor:pointer}:host .step:not(.step-setup) .step-wrapper{width:100%}:host .step:not(.step-setup):first-child .step-wrapper,:host .step:not(.step-setup):first-child .step-point,:host .step:not(.step-setup):first-child .step-label,:host .step:not(.step-setup):first-child .step-progress{margin-left:8px}:host .step:not(.step-setup):first-child .only-one-step{left:0!important;margin-left:25px}:host .step-point{display:flex;justify-content:center;width:100%;height:28px;position:relative;align-items:center}:host .step-point .ellipse{width:28px;height:28px;position:absolute;border-radius:50px;border-color:#4646ce;border-style:solid;border-width:2px;background:white;display:flex;justify-content:center;align-items:center;z-index:2}:host .step-point .pointer{width:24px;height:24px;position:absolute;z-index:4;border-radius:20px;display:flex;align-items:center;justify-content:center;font-weight:bold;font-size:16px;line-height:1.4;color:#51566f;transition:box-shadow .2s ease-in-out}:host .step-point .pointer i{color:#fff;font-size:22px}:host .step-point .pointer.blue{background:#4646ce}:host .step-point .pointer.gray{background:#e5e6ea}:host .step-point .pointer.gray:hover{box-shadow:0 0 4px 2px #00000026}:host .step-point.completed :host .step-point.active{background:#4646ce}:host .step-point.active .ellipse{width:28px;height:28px}:host .step-point.active .pointer{width:20px;height:20px}:host .step-label{font-weight:normal;font-size:14px;line-height:22px;line-height:1.5;color:#6d6e6f;display:flex;justify-content:center;overflow:hidden;margin-top:8px}:host .step-label span{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}:host .step-label.active{font-weight:600;color:#333}:host .step-label:last-child{margin-bottom:23px}:host .step-progress{margin-top:3px;font-style:normal;font-weight:normal;font-size:12px;line-height:1.4;display:flex;justify-content:center}:host .step-connector{background-color:#e5e5e5;height:2px}:host .step-connector.connector-grand{width:calc(100% - 25px)}:host .step-connector.connector-grand.only-one-step{width:calc(100% - 50px)}:host .step-connector .progress{background-color:#4646ce;height:2px;width:0}:host .step-connector--absolute{position:absolute;top:calc(28px / 2);width:100%;left:calc(100% / 2 + 12px)}:host .step-connector--inline{width:50px;margin-left:32px;margin-right:32px}:host .step-setup{width:auto}:host .step-setup .step-wrapper{display:flex;flex-direction:row;align-items:center;width:auto}:host .step-setup+.step-setup{margin-left:0}:host .step-setup .step-progress{display:none}:host .step-setup .step-label{position:relative;transform:none;align-items:center;justify-content:start;margin:0 0 0 8px;font-size:16px}:host .step-setup .step-point{width:28px;height:28px}:host .step-setup .step-point .pointer i{font-size:22px}:host .step-setup .step-point .pointer .text{font-size:16px}::ng-deep .step-tooltip{max-width:250px;font-size:14px;line-height:22px;padding:10px 12px}::ng-deep .step-tooltip_name{font-weight:700;overflow:hidden;text-overflow:ellipsis}@media screen and (min-width: 1367px){.stepper .step-label{font-size:14px}}\n"]
5358
- },] }
5359
- ];
5360
- StepperComponent.ctorParameters = () => [];
5361
- StepperComponent.propDecorators = {
5362
- steps: [{ type: Input }],
5363
- currentStep: [{ type: Input }],
5364
- withoutConnectors: [{ type: Input }],
5365
- hiddenNames: [{ type: Input }],
5366
- inlineLabels: [{ type: Input }],
5367
- disabled: [{ type: Input }],
5368
- hiddenIndex: [{ type: Input }],
5369
- stepChange: [{ type: Output }],
5370
- stepper: [{ type: ViewChild, args: ['stepper', { read: ElementRef },] }]
5388
+ // !!! Please do not use such approach in other places
5389
+ // Hard fix for 'none' calendar view selection
5390
+ MatCalendar.prototype.focusActiveCell = function () {
5391
+ var _a;
5392
+ (_a = this._getCurrentViewComponent()) === null || _a === void 0 ? void 0 : _a._focusActiveCell(false);
5371
5393
  };
5372
-
5373
- class DrStepperModule {
5394
+ const components$3 = [
5395
+ DrButtonComponent,
5396
+ RadioButtonComponent,
5397
+ RadioGroupComponent,
5398
+ CheckboxComponent,
5399
+ DrInputComponent,
5400
+ DrSelectComponent,
5401
+ DrToggleComponent,
5402
+ DrToggleButtonComponent,
5403
+ DrDatePickerComponent,
5404
+ DrDatePickerWithTimeframeComponent,
5405
+ DrDatePickerFormatDirective,
5406
+ DrDatePickerCustomHeaderComponent,
5407
+ DrModelDebounceChangeDirective,
5408
+ DrShowTimeframePipe,
5409
+ DrSelectAddItemComponent
5410
+ ];
5411
+ class DrInputsModule {
5374
5412
  }
5375
- DrStepperModule.decorators = [
5413
+ DrInputsModule.decorators = [
5376
5414
  { type: NgModule, args: [{
5377
- declarations: [StepperComponent],
5415
+ declarations: components$3,
5416
+ exports: components$3,
5378
5417
  imports: [
5418
+ FormsModule,
5419
+ ReactiveFormsModule,
5379
5420
  CommonModule,
5421
+ NgSelectModule,
5422
+ MatNativeDateModule,
5423
+ MatDatepickerModule,
5424
+ MatTooltipModule,
5380
5425
  DrTooltipModule
5381
5426
  ],
5382
- exports: [StepperComponent]
5427
+ entryComponents: [DrDatePickerCustomHeaderComponent]
5383
5428
  },] }
5384
5429
  ];
5385
5430
 
5386
- class DrDetailsListModule {
5431
+ const components$2 = [DateTagComponent,
5432
+ DayTagComponent,
5433
+ WeekTagComponent,
5434
+ MonthTagComponent,
5435
+ QuarterTagComponent,
5436
+ AnyTagComponent,
5437
+ YearTagComponent,
5438
+ ForecastTagComponent];
5439
+ class DateTagModule {
5387
5440
  }
5388
- DrDetailsListModule.decorators = [
5441
+ DateTagModule.decorators = [
5389
5442
  { type: NgModule, args: [{
5390
5443
  imports: [
5391
5444
  CommonModule,
5445
+ FormsModule,
5446
+ ReactiveFormsModule,
5447
+ DrInputsModule,
5448
+ NgSelectModule
5392
5449
  ],
5393
- exports: [DrDetailsListComponent],
5394
- providers: [],
5395
- declarations: [DrDetailsListComponent],
5450
+ exports: components$2,
5451
+ declarations: components$2,
5396
5452
  },] }
5397
5453
  ];
5398
5454
 
5399
- const ɵ0$1 = {}, ɵ1 = {};
5400
- class DrDialogModule {
5455
+ class ListTagModule {
5401
5456
  }
5402
- DrDialogModule.decorators = [
5457
+ ListTagModule.decorators = [
5403
5458
  { type: NgModule, args: [{
5404
- declarations: [DialogWrapperComponent, DialogModalWrapperComponent],
5405
5459
  imports: [
5406
5460
  CommonModule,
5407
- MatDialogModule,
5408
- DrInputsModule,
5461
+ FormsModule,
5409
5462
  ReactiveFormsModule,
5410
- DrTooltipModule,
5411
- DrDetailsListModule
5463
+ DrInputsModule,
5464
+ ],
5465
+ exports: [ListTagComponent],
5466
+ providers: [],
5467
+ declarations: [
5468
+ ListTagComponent
5412
5469
  ],
5413
- exports: [DialogWrapperComponent, DialogModalWrapperComponent],
5414
- providers: [
5415
- { provide: MatDialogRef, useValue: ɵ0$1 },
5416
- { provide: MAT_DIALOG_DATA, useValue: ɵ1 },
5417
- DialogService
5418
- ]
5419
5470
  },] }
5420
5471
  ];
5421
5472
 
5422
- class DrChatFormComponent {
5423
- constructor(cdr, domSanitizer) {
5424
- this.cdr = cdr;
5425
- this.domSanitizer = domSanitizer;
5426
- this._textareaInitialHeight = true;
5427
- this.inputFocus = false;
5428
- this.inputHover = false;
5429
- this.droppedFiles = [];
5430
- /**
5431
- * Predefined message text
5432
- *
5433
- * @type {string}
5434
- */
5435
- this.message = '';
5436
- /**
5437
- * Message placeholder text
5438
- *
5439
- * @type {string}
5440
- */
5441
- this.messagePlaceholder = 'Type a message';
5442
- /**
5443
- * Show send button
5444
- *
5445
- * @type {boolean}
5446
- */
5447
- this.dropFiles = false;
5448
- /**
5449
- * File drop placeholder text
5450
- *
5451
- * @type {string}
5452
- */
5453
- this.dropFilePlaceholder = 'Drop file to send';
5454
- /**
5455
- * Parameter to check is send message function available
5456
- *
5457
- * @type {boolean}
5458
- */
5459
- this.waitForReply = false;
5460
- /**
5461
- *
5462
- * @type {EventEmitter<{ message: string, files: File[] }>}
5463
- */
5464
- this.send = new EventEmitter();
5465
- this.abort = new EventEmitter();
5466
- /**
5467
- * Emits when message input value has been changed
5468
- *
5469
- * @type {EventEmitter<string>}
5470
- */
5471
- this.inputChange = new EventEmitter();
5472
- this.fileOver = false;
5473
+ class DrDynamicTagComponent {
5474
+ constructor() {
5475
+ this.lockedTags = [];
5476
+ this.tagChange = new EventEmitter();
5477
+ this.tagAdd = new EventEmitter();
5473
5478
  }
5474
- onDrop(event) {
5475
- var _a;
5476
- if (this.dropFiles) {
5477
- event.preventDefault();
5478
- event.stopPropagation();
5479
- this.fileOver = false;
5480
- if ((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) {
5481
- for (const file of event.dataTransfer.files) {
5482
- const res = file;
5483
- if (IMAGE_TYPES.includes(file.type)) {
5484
- const fr = new FileReader();
5485
- fr.onload = (e) => {
5486
- res.src = e.target.result;
5487
- res.urlStyle = this.domSanitizer.bypassSecurityTrustStyle(`url(${res.src})`);
5488
- this.cdr.detectChanges();
5489
- };
5490
- fr.readAsDataURL(file);
5491
- }
5492
- this.droppedFiles.push(res);
5493
- }
5494
- }
5495
- }
5479
+ get isPrimitiveDataSource() {
5480
+ const values = Object.values(this.values) || [];
5481
+ return !isObject(values[0]);
5496
5482
  }
5497
- removeFile(file) {
5498
- const index = this.droppedFiles.indexOf(file);
5499
- if (index >= 0) {
5500
- this.droppedFiles.splice(index, 1);
5501
- }
5483
+ ngOnChanges(changes) {
5484
+ this.updateDynamicTagValues();
5502
5485
  }
5503
- onDragOver(event) {
5504
- event.preventDefault();
5505
- event.stopPropagation();
5506
- if (this.dropFiles) {
5507
- this.fileOver = true;
5486
+ onTagChanged($event) {
5487
+ var _a, _b;
5488
+ const resultEvent = {
5489
+ id: this.tagConfig.id,
5490
+ name: this.tagConfig.name,
5491
+ value: $event,
5492
+ locked: this.lockedTags.includes($event)
5493
+ };
5494
+ if (!isNil((_a = this.selectedTag) === null || _a === void 0 ? void 0 : _a.locked)) {
5495
+ resultEvent.locked = this.selectedTag.locked;
5496
+ }
5497
+ if (!isNil((_b = this.selectedTag) === null || _b === void 0 ? void 0 : _b.label)) {
5498
+ resultEvent.label = this.selectedTag.label;
5508
5499
  }
5500
+ this.isLockedTagSelected = resultEvent.locked;
5501
+ this.tagChange.emit(resultEvent);
5509
5502
  }
5510
- onDragLeave(event) {
5511
- event.preventDefault();
5512
- event.stopPropagation();
5513
- if (this.dropFiles) {
5514
- this.fileOver = false;
5503
+ onOptionClick($event, tagValue) {
5504
+ if (this.lockedTags.includes(tagValue)) {
5505
+ $event.stopImmediatePropagation();
5515
5506
  }
5516
5507
  }
5517
- sendMessage() {
5518
- if (this.waitForReply) {
5519
- return;
5508
+ onDynamicValueAdd($event) {
5509
+ const parentValueKey = this.getParentValueKey();
5510
+ const parentValues = this.values[parentValueKey] || [];
5511
+ if (this.isPrimitiveDataSource) {
5512
+ this.values[parentValueKey] = [$event, ...parentValues];
5520
5513
  }
5521
- if (this.droppedFiles.length || String(this.message).trim().length) {
5522
- this._textareaInitialHeight = true;
5523
- this.send.emit({ message: this.message, files: this.droppedFiles });
5524
- this.message = '';
5525
- this.droppedFiles = [];
5526
- this.cdr.markForCheck();
5514
+ else {
5515
+ this.values[parentValueKey] = [{ value: $event }, ...parentValues];
5527
5516
  }
5517
+ this.selectedDynamicTag = $event;
5518
+ this.currentValues = this.values[parentValueKey];
5519
+ this.onTagChanged($event);
5520
+ this.tagAdd.emit($event);
5528
5521
  }
5529
- abortMessage() {
5530
- this.abort.emit();
5531
- }
5532
- onModelChange(value) {
5533
- this._textareaInitialHeight = false;
5534
- this.inputChange.emit(value);
5522
+ updateDynamicTagValues() {
5523
+ var _a;
5524
+ const parentValueKey = this.getParentValueKey();
5525
+ this.currentValues = this.values[parentValueKey];
5526
+ this.selectedDynamicTag = this.getSelectedDynamicTag(this.currentValues, (_a = this.selectedTag) === null || _a === void 0 ? void 0 : _a.value);
5527
+ this.onTagChanged(this.selectedDynamicTag);
5535
5528
  }
5536
- getTextAreaHeight(textAreaElement) {
5537
- let height;
5538
- if (this._textareaInitialHeight) {
5539
- height = 50;
5529
+ getSelectedDynamicTag(currentValues, selectedValue) {
5530
+ if (!(currentValues === null || currentValues === void 0 ? void 0 : currentValues.length))
5531
+ return null;
5532
+ if (isObject(currentValues[0])) {
5533
+ const valueFromConfig = find(currentValues, { value: selectedValue });
5534
+ const favoriteValue = find(currentValues, { is_favorite: true });
5535
+ return (valueFromConfig || favoriteValue || currentValues[0]).value;
5540
5536
  }
5541
- else {
5542
- height = textAreaElement.scrollHeight + 2;
5537
+ const valueFromConfig = find(currentValues, (value) => value === selectedValue);
5538
+ return (valueFromConfig || currentValues[0]);
5539
+ }
5540
+ getParentValueKey() {
5541
+ return map(this.connectedTags, this.tryToParseParentValue).join('__');
5542
+ }
5543
+ tryToParseParentValue(connectedTags) {
5544
+ if (isNumber(connectedTags.value)) {
5545
+ const momentData = moment$9.unix(connectedTags.value);
5546
+ const convertedParentValue = momentData.get('year'); // TODO: add input prop (selectedTimeDimension) or Format
5547
+ if (momentData.isValid() && convertedParentValue) {
5548
+ return convertedParentValue;
5549
+ }
5543
5550
  }
5544
- return `height: ${height}px;`;
5551
+ return connectedTags.value;
5545
5552
  }
5546
5553
  }
5547
- DrChatFormComponent.decorators = [
5554
+ DrDynamicTagComponent.decorators = [
5548
5555
  { type: Component, args: [{
5549
- selector: 'dr-chat-form',
5550
- template: "<div class=\"dropped-files\" *ngIf=\"droppedFiles?.length\">\n <div class=\"dropped-files__item\" *ngFor=\"let file of droppedFiles\">\n <div class=\"dropped-files__item__preview\" [style.background-image]=\"file.urlStyle || 'none'\">\n <i class=\"dr-icon-file\" *ngIf=\"!file.urlStyle\"></i>\n </div>\n <div class=\"dropped-files__item__name\">{{ file.name }}</div>\n <i class=\"dropped-files__item__remove dr-icon-exit\" (click)=\"removeFile(file)\"></i>\n </div>\n</div>\n<div class=\"message-row\">\n <div class=\"message-row__input\">\n <textarea #textAreaElement\n (focus)=\"inputFocus = true\"\n (blur)=\"inputFocus = false\"\n (mouseenter)=\"inputHover = true\"\n (mouseleave)=\"inputHover = false\"\n [(ngModel)]=\"message\"\n [rows]=\"1\"\n [style]=\"getTextAreaHeight(textAreaElement)\"\n (ngModelChange)=\"onModelChange($event)\"\n type=\"text\"\n placeholder=\"{{ fileOver ? dropFilePlaceholder : messagePlaceholder }}\"\n (keyup.enter)=\"sendMessage()\">\n </textarea>\n <i *ngIf=\"!waitForReply\" (click)=\"sendMessage()\" class=\"dr-icon-notify send-button\"></i>\n <dr-dot-flashing *ngIf=\"waitForReply\" class=\"wait-reply-dot-flashing\"></dr-dot-flashing>\n <dr-button *ngIf=\"waitForReply\" (click)=\"abortMessage()\" theme=\"ghost\" class=\"abort-button\">Stop generating</dr-button>\n </div>\n</div>\n",
5551
- changeDetection: ChangeDetectionStrategy.OnPush,
5552
- styles: [":host{display:flex;flex-direction:column;align-items:center;padding:0 24px;margin-top:12px}:host .message-row{display:flex;justify-content:center;width:100%;padding:0 0 21px;max-width:970px}:host .message-row__input{position:relative;display:flex;align-items:center;flex-grow:1;flex-direction:row;height:auto;overflow:visible;min-width:265px}:host .message-row__input textarea{font-size:14px;line-height:22px;max-height:100%;flex-grow:1;resize:none;padding:14px 40px 12px 23px;margin:auto;border:1px solid #DFE0E3;border-radius:12px;min-height:50px}:host .message-row__input textarea:focus{border:1px solid #7F7FDD}:host .message-row__input textarea::placeholder{color:#9ea1aa}:host .message-row__input .send-button{position:absolute;right:14px;cursor:pointer;color:#dfe0e3;font-size:28px}:host .message-row__input .wait-reply-dot-flashing{position:absolute;right:20px}:host .message-row__input textarea:focus+.send-button,:host .message-row__input .send-button:hover{color:#25258c}:host .message-row__input .abort-button{position:absolute;right:0;top:-44px}:host .message-row__input .abort-button::ng-deep button{background:#F2F2FF!important;border-radius:4px}:host input{flex:1}:host input.with-button{border-bottom-right-radius:0;border-top-right-radius:0}:host .dropped-files{display:flex;flex-direction:row;margin-bottom:.5rem;flex-wrap:wrap}:host .dropped-files__item{display:flex;flex-direction:column;justify-content:center;margin:0 10px 10px 0;position:relative}:host .dropped-files__item__preview{background-size:cover;background-position:center;width:64px;height:64px;border-radius:8px;border:1px solid #ccc}:host .dropped-files__item__preview i{font-size:62px}:host .dropped-files__item__name{white-space:nowrap;font-size:12px;color:#8f929e;margin-top:4px;max-width:64px;overflow:hidden;text-overflow:ellipsis}:host .dropped-files__item__remove{position:absolute;right:-4px;top:-4px;cursor:pointer;background:white;border-radius:12px;color:#8f929e;border:1px solid #8f929e;font-size:14px}\n"]
5556
+ selector: 'dr-dynamic-tag',
5557
+ template: "<p class=\"dynamic-tag__label\">{{ tagConfig.name }}</p>\n<dr-select [(ngModel)]=\"selectedDynamicTag\"\n [class.dynamic-tag__locked]=\"isLockedTagSelected\"\n bindLabel=\"value\"\n bindValue=\"value\"\n [items]=\"currentValues\"\n [disabled]=\"disabled\"\n dropdownClass=\"dynamic-tag__select dr-tag__select\"\n (ngModelChange)=\"onTagChanged($event)\">\n <ng-template #optionHeaderTemplate *ngIf=\"isDynamicTagAddEnabled\">\n <dr-select-add-item bindValue=\"value\"\n [values]=\"currentValues\"\n [dynamicAddLabel]=\"' Add new ' + tagConfig.name\"\n (dynamicValueAdded)=\"onDynamicValueAdd($event)\"></dr-select-add-item>\n </ng-template>\n <ng-template #labelTemplate let-item=\"item\">\n <div class=\"dynamic-tag__field--label\">\n <p class=\"dynamic-tag__field__text\">{{ item?.value || item }}</p>\n <i *ngIf=\"item?.is_favorite\" class=\"dynamic-tag__field__icon dr-icon-star-fill\"></i>\n </div>\n </ng-template>\n <ng-template #optionTemplate let-item=\"item\">\n <div class=\"dynamic-tag__field--option\"\n [class.disabled]=\"lockedTags.includes(item?.value || item)\"\n (click)=\"onOptionClick($event, item?.value || item)\">\n <p class=\"dynamic-tag__field__text\">{{ item?.value || item }}</p>\n <i *ngIf=\"item?.is_favorite\" class=\"dynamic-tag__field__icon dr-icon-star-fill\"></i>\n </div>\n </ng-template>\n</dr-select>\n",
5558
+ styles: [".dynamic-tag__label{margin:0 0 4px;color:#0c142b;font-size:14px;font-weight:400;line-height:22px}.dynamic-tag__field,.dynamic-tag__field--option,.dynamic-tag__field--label{cursor:pointer;height:24px}.dynamic-tag__field--option{padding:8px 12px;width:100%;display:flex;justify-content:space-between;align-items:center}.dynamic-tag__field--option.disabled{opacity:.5;box-sizing:content-box}.dynamic-tag__field--label{display:flex;align-items:center}.dynamic-tag__field--label>.dynamic-tag__field__icon{position:absolute;right:25px}.dynamic-tag__field--label>dynamic-tag__field__text{margin:0}.dr-icon-star-fill{color:#f0bc57}::ng-deep dr-select.dynamic-tag__locked>ng-select>.ng-select-container{opacity:.4}::ng-deep .ng-option:has(.dynamic-tag__field--option){padding:0!important}\n"]
5559
+ },] }
5560
+ ];
5561
+ DrDynamicTagComponent.propDecorators = {
5562
+ values: [{ type: Input }],
5563
+ tagConfig: [{ type: Input }],
5564
+ selectedTag: [{ type: Input }],
5565
+ lockedTags: [{ type: Input }],
5566
+ connectedTags: [{ type: Input }],
5567
+ isDynamicTagAddEnabled: [{ type: Input }],
5568
+ disabled: [{ type: Input }],
5569
+ tagChange: [{ type: Output }],
5570
+ tagAdd: [{ type: Output }]
5571
+ };
5572
+
5573
+ class DrDynamicTagModule {
5574
+ }
5575
+ DrDynamicTagModule.decorators = [
5576
+ { type: NgModule, args: [{
5577
+ declarations: [DrDynamicTagComponent],
5578
+ imports: [
5579
+ CommonModule,
5580
+ DrInputsModule,
5581
+ FormsModule,
5582
+ ],
5583
+ exports: [DrDynamicTagComponent]
5584
+ },] }
5585
+ ];
5586
+
5587
+ class DrTagModule {
5588
+ }
5589
+ DrTagModule.decorators = [
5590
+ { type: NgModule, args: [{
5591
+ imports: [
5592
+ CommonModule,
5593
+ DateTagModule,
5594
+ ListTagModule,
5595
+ DrDynamicTagModule
5596
+ ],
5597
+ exports: [DrTagComponent],
5598
+ providers: [],
5599
+ declarations: [
5600
+ DrTagComponent
5601
+ ],
5553
5602
  },] }
5554
5603
  ];
5555
- DrChatFormComponent.ctorParameters = () => [
5556
- { type: ChangeDetectorRef },
5557
- { type: DomSanitizer }
5604
+
5605
+ class DrAvatarModule {
5606
+ }
5607
+ DrAvatarModule.decorators = [
5608
+ { type: NgModule, args: [{
5609
+ declarations: [
5610
+ DrAvatarComponent,
5611
+ DrAvatarPipe
5612
+ ],
5613
+ exports: [
5614
+ DrAvatarComponent,
5615
+ DrAvatarPipe
5616
+ ],
5617
+ imports: [
5618
+ MatTooltipModule,
5619
+ DrTooltipModule,
5620
+ CommonModule
5621
+ ]
5622
+ },] }
5558
5623
  ];
5559
- DrChatFormComponent.propDecorators = {
5560
- message: [{ type: Input }],
5561
- messagePlaceholder: [{ type: Input }],
5562
- dropFiles: [{ type: Input }],
5563
- dropFilePlaceholder: [{ type: Input }],
5564
- waitForReply: [{ type: Input }],
5565
- send: [{ type: Output }],
5566
- abort: [{ type: Output }],
5567
- inputChange: [{ type: Output }],
5568
- fileOver: [{ type: HostBinding, args: ['class.file-over',] }],
5569
- onDrop: [{ type: HostListener, args: ['drop', ['$event'],] }],
5570
- onDragOver: [{ type: HostListener, args: ['dragover', ['$event'],] }],
5571
- onDragLeave: [{ type: HostListener, args: ['dragleave', ['$event'],] }]
5572
- };
5573
5624
 
5574
- /**
5575
- * `DrCustomMessageService` is used to store instances of `DrChatCustomMessageDirective`s which
5576
- * were provided in the chat component.
5577
- */
5578
- class DrChatCustomMessageService {
5579
- constructor() {
5580
- this.customMessages = new Map();
5581
- }
5582
- register(type, instance) {
5583
- this.customMessages.set(type, instance);
5584
- }
5585
- unregister(type) {
5586
- return this.customMessages.delete(type);
5587
- }
5588
- getInstance(type) {
5589
- return this.customMessages.get(type);
5590
- }
5625
+ const components$1 = [DrSpinnerComponent];
5626
+ const directives = [DrSpinnerDirective];
5627
+ class DrSpinnerModule {
5591
5628
  }
5592
- DrChatCustomMessageService.decorators = [
5593
- { type: Injectable }
5629
+ DrSpinnerModule.decorators = [
5630
+ { type: NgModule, args: [{
5631
+ imports: [
5632
+ CommonModule,
5633
+ ],
5634
+ exports: [...components$1, ...directives],
5635
+ declarations: [...components$1, ...directives]
5636
+ },] }
5594
5637
  ];
5595
5638
 
5596
- class DrChatMessageComponent {
5597
- constructor(customMessageService) {
5598
- this.customMessageService = customMessageService;
5599
- this.MESSAGE_TYPE = CHAT_MESSAGE_TYPE;
5600
- this._reply = false;
5601
- }
5602
- get flyInOut() {
5603
- return true;
5604
- }
5605
- get notReply() {
5606
- return !this.reply;
5607
- }
5608
- /**
5609
- * Determines if a message is a reply
5610
- */
5611
- get reply() {
5612
- return this._reply;
5613
- }
5614
- set reply(value) {
5615
- this._reply = !!value;
5616
- }
5617
- getTemplate() {
5618
- this.customMessage = true;
5619
- const customMessage = this.getCustomMessage(this.type);
5620
- return customMessage.templateRef;
5621
- }
5622
- getTemplateContext() {
5623
- return { $implicit: this.customMessageData, isReply: this.reply };
5624
- }
5625
- getCustomMessage(type) {
5626
- const customMessageDirective = this.customMessageService.getInstance(type);
5627
- if (!customMessageDirective) {
5628
- throw new Error(`dr-chat: Can't find template for custom type '${type}'. ` +
5629
- `Make sure you provide it in the chat component with *drCustomMessage='${type}'.`);
5630
- }
5631
- return customMessageDirective;
5632
- }
5639
+ class DrPopoverModule {
5633
5640
  }
5634
- DrChatMessageComponent.decorators = [
5635
- { type: Component, args: [{
5636
- selector: 'dr-chat-message',
5637
- template: "<ng-container *ngIf=\"message.avatarUrl; else userAvatar\">\n <div class=\"avatar\" [style.background-image]=\"'url(' + message.avatarUrl + ')'\"></div>\n</ng-container>\n<ng-template #userAvatar>\n <dr-avatar *ngIf=\"message.user\" [users]=\"message.user\"></dr-avatar>\n</ng-template>\n<div class=\"message\" [class.message--custom]=\"customMessage\">\n <ng-container [ngSwitch]=\"message.kind\">\n <dr-chat-message-text *ngSwitchCase=\"MESSAGE_TYPE.TEXT\" [message]=\"message\"></dr-chat-message-text>\n <dr-chat-message-file *ngSwitchCase=\"MESSAGE_TYPE.DOWNLOAD_FILE\" [message]=\"message\"></dr-chat-message-file>\n <ng-container *ngSwitchDefault>\n <ng-container [ngTemplateOutlet]=\"getTemplate()\" [ngTemplateOutletContext]=\"getTemplateContext()\"></ng-container>\n </ng-container>\n </ng-container>\n <div class=\"message__actions\" *ngIf=\"drChatMessageActions;\">\n <ng-container [ngTemplateOutlet]=\"drChatMessageActions\"></ng-container>\n </div>\n</div>\n",
5638
- animations: [
5639
- trigger('flyInOut', [
5640
- state('in', style({ transform: 'translateX(0)' })),
5641
- transition('void => *', [style({ transform: 'translateX(-100%)' }), animate(80)]),
5642
- transition('* => void', [animate(80, style({ transform: 'translateX(100%)' }))]),
5643
- ]),
5641
+ DrPopoverModule.decorators = [
5642
+ { type: NgModule, args: [{
5643
+ imports: [
5644
+ CommonModule,
5645
+ ],
5646
+ exports: [
5647
+ DrPopoverDirective,
5648
+ DrPopoverComponent,
5649
+ ],
5650
+ providers: [],
5651
+ declarations: [
5652
+ DrPopoverDirective,
5653
+ DrPopoverComponent,
5644
5654
  ],
5645
- changeDetection: ChangeDetectionStrategy.OnPush,
5646
- styles: [":host{position:relative;display:flex;flex-direction:row;width:100%;background:rgba(249,250,255,.7);border-top:1px solid #E5E5E5;padding:16px 24px}:host:first-child{border:none}:host:last-child{border-bottom:1px solid #E5E5E5}.reply+:host.reply,.not-reply+:host.not-reply{border-top:none;padding-top:0;padding-left:75px}.reply+:host.reply .avatar,.reply+:host.reply dr-avatar,.not-reply+:host.not-reply .avatar,.not-reply+:host.not-reply dr-avatar{display:none}:host.not-reply{background-color:#fff}:host .avatar{display:flex;width:28px;height:28px;background-color:#fff;border-radius:16px;flex-shrink:0;box-shadow:0 1px 3px 1px #0003;background-image:url(\"data:image/svg+xml,%3C%3Fxml version%3D%221.0%22 encoding%3D%22UTF-8%22%3F%3E%3Csvg id%3D%22Layer_1%22 data-name%3D%22Layer 1%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22 viewBox%3D%220 0 74 65%22%3E %3Cdefs%3E %3Cstyle%3E .cls-1%2C .cls-2%2C .cls-3 %7B fill%3A none%3B %7D .cls-4 %7B fill%3A url(%23linear-gradient)%3B %7D .cls-5 %7B fill%3A %234eb7df%3B %7D .cls-2 %7B stroke%3A %23a6a8aa%3B stroke-miterlimit%3A 10%3B stroke-width%3A .37px%3B %7D .cls-6 %7B fill%3A url(%23linear-gradient-3)%3B %7D .cls-7 %7B fill%3A url(%23linear-gradient-2)%3B %7D .cls-3 %7B clip-path%3A url(%23clippath)%3B %7D %3C%2Fstyle%3E %3CclipPath id%3D%22clippath%22%3E %3Crect class%3D%22cls-1%22 width%3D%2274%22 height%3D%2265%22%2F%3E %3C%2FclipPath%3E %3ClinearGradient id%3D%22linear-gradient%22 x1%3D%2224.26%22 y1%3D%22-3.79%22 x2%3D%2295.63%22 y2%3D%2288.82%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%220%22 stop-color%3D%22%237676ff%22%2F%3E %3Cstop offset%3D%22.18%22 stop-color%3D%22%235959ff%22%2F%3E %3Cstop offset%3D%22.35%22 stop-color%3D%22%235757e0%22%2F%3E %3Cstop offset%3D%22.61%22 stop-color%3D%22%234646ce%22%2F%3E %3Cstop offset%3D%22.84%22 stop-color%3D%22%234b4be4%22%2F%3E %3Cstop offset%3D%221%22 stop-color%3D%22%234444eb%22%2F%3E %3C%2FlinearGradient%3E %3ClinearGradient id%3D%22linear-gradient-2%22 x1%3D%2212.05%22 y1%3D%2277.06%22 x2%3D%2210.77%22 y2%3D%2213.85%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%22.45%22 stop-color%3D%22%232f92b8%22%2F%3E %3Cstop offset%3D%22.84%22 stop-color%3D%22%234eb7df%22%2F%3E %3Cstop offset%3D%221%22 stop-color%3D%22%234eb7df%22%2F%3E %3C%2FlinearGradient%3E %3ClinearGradient id%3D%22linear-gradient-3%22 x1%3D%2262.26%22 y1%3D%22-2.54%22 x2%3D%2261.76%22 y2%3D%2285.91%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%220%22 stop-color%3D%22%2336369b%22%2F%3E %3Cstop offset%3D%22.52%22 stop-color%3D%22%234848d0%22%2F%3E %3C%2FlinearGradient%3E %3C%2Fdefs%3E %3Cg class%3D%22cls-3%22%3E %3Cg%3E %3Cpath class%3D%22cls-4%22 d%3D%22m73.32%2C24.79v15.73c0%2C13.12-9.87%2C23.79-22%2C23.79h-21.32c-3.46-.06-6.25-3.11-6.25-6.87s2.79-6.81%2C6.25-6.87h21.32c5.13%2C0%2C9.29-4.51%2C9.29-10.05v-15.73c0-5.54-4.17-10.05-9.29-10.05h-7.46c3.51%2C0%2C6.35-3.08%2C6.35-6.88s-2.79-6.8-6.25-6.87h7.35c12.12%2C0%2C22%2C10.67%2C22%2C23.79h0Z%22%2F%3E %3Cpath class%3D%22cls-5%22 d%3D%22m50.26%2C7.82c0%2C3.8-2.9%2C6.93-6.41%2C6.93h-21.86c-5.13%2C0-9.29%2C4.51-9.29%2C10.05v15.73c0%2C5.54%2C4.17%2C10.05%2C9.29%2C10.05h8.01c-3.46.06-6.25%2C3.11-6.25%2C6.87s2.79%2C6.81%2C6.25%2C6.87h-8.01c-12.12%2C0-22-10.67-22-23.79v-15.73C0%2C11.68%2C9.87%2C1%2C21.99%2C1h21.97c3.46.06%2C6.3%2C3.06%2C6.3%2C6.82Z%22%2F%3E %3Cpath class%3D%22cls-2%22 d%3D%22m66.45%2C1h-.22.22%2C0Z%22%2F%3E %3Cpath class%3D%22cls-2%22 d%3D%22m36.05%2C50.58h-.22.22%2C0Z%22%2F%3E %3Cpath class%3D%22cls-7%22 d%3D%22m0%2C33.78v-2.76C0%2C12.9%2C13.62%2C14.48%2C13.62%2C14.48h8.38c-5.5.46-9.5%2C4.71-9.5%2C9.96l.02%2C15.8c0%2C5.54%2C4.44%2C10.59%2C9.48%2C10.59l-8-.5S0%2C51.88%2C0%2C33.77h0Z%22%2F%3E %3Cpath class%3D%22cls-6%22 d%3D%22m73%2C31.51v2.76c0%2C18.12-13.62%2C16.53-13.62%2C16.53h-7.99c5.61-.85%2C9.09-4.76%2C9.09-10.02l.02-16.33c0-5.54-4.46-10-9.5-10h8s13.99-1.05%2C13.99%2C17.07h0Z%22%2F%3E %3C%2Fg%3E %3C%2Fg%3E%3C%2Fsvg%3E\");background-size:20px 22px;background-repeat:no-repeat;background-position-x:4px;background-position-y:3px}:host .avatar,:host dr-avatar{margin:0 23px 0 0}:host .message{display:flex;align-items:center;flex-grow:1}:host .message__actions{display:flex;align-items:center;margin-left:24px;flex-grow:1;justify-content:flex-end}:host .message__actions::ng-deep button:not(:hover) i[class*=dr-icon]{color:#b9b9ec!important}\n"]
5647
5655
  },] }
5648
5656
  ];
5649
- DrChatMessageComponent.ctorParameters = () => [
5650
- { type: DrChatCustomMessageService }
5657
+
5658
+ class DrDropdownModule {
5659
+ }
5660
+ DrDropdownModule.decorators = [
5661
+ { type: NgModule, args: [{
5662
+ imports: [
5663
+ CommonModule,
5664
+ DrTooltipModule,
5665
+ ],
5666
+ declarations: [
5667
+ DrDropdownDirective,
5668
+ DrDropdownPositionDirective,
5669
+ DrDropdownComponent,
5670
+ DrDropdownItemShowPipe,
5671
+ ],
5672
+ exports: [
5673
+ DrDropdownDirective,
5674
+ DrDropdownPositionDirective,
5675
+ DrDropdownComponent,
5676
+ DrDropdownItemShowPipe,
5677
+ ],
5678
+ providers: [
5679
+ DrDropdownService,
5680
+ ],
5681
+ },] }
5651
5682
  ];
5652
- DrChatMessageComponent.propDecorators = {
5653
- flyInOut: [{ type: HostBinding, args: ['@flyInOut',] }],
5654
- notReply: [{ type: HostBinding, args: ['class.not-reply',] }],
5655
- reply: [{ type: Input }, { type: HostBinding, args: ['class.reply',] }],
5656
- type: [{ type: Input }],
5657
- message: [{ type: Input }],
5658
- customMessageData: [{ type: Input }],
5659
- user: [{ type: Input }],
5660
- drChatMessageActions: [{ type: ContentChild, args: ['drChatMessageActions',] }]
5661
- };
5662
5683
 
5663
- class DrChatSuggestionsComponent {
5664
- constructor(cdr) {
5665
- this.cdr = cdr;
5666
- this._nonHiddenValues = [];
5667
- this.visibleValues = [];
5668
- this.isSuggestedMenuOpen = false;
5669
- this.values = [];
5670
- this.fullScreen = false;
5671
- this.buttonMode = false;
5672
- /**
5673
- * Parameter to check is send message function available
5674
- *
5675
- * @type {boolean}
5676
- */
5677
- this.waitForReply = false;
5678
- this.suggestionSelect = new EventEmitter();
5679
- }
5680
- get hiddenValues() {
5681
- return JSON.parse(localStorage.getItem('aiChatSuggestions')) || [];
5682
- }
5683
- set hiddenValues(values) {
5684
- localStorage.setItem('aiChatSuggestions', JSON.stringify(values));
5685
- }
5686
- ngOnInit() {
5687
- this.filterValues();
5688
- }
5689
- onItemClick(item) {
5690
- if (this.waitForReply) {
5691
- return;
5692
- }
5693
- this.isSuggestedMenuOpen = false;
5694
- this.suggestionSelect.emit(item);
5695
- this.hiddenValues = [...this.hiddenValues, item];
5696
- this.filterValues();
5697
- }
5698
- filterValues() {
5699
- const hiddenValues = this.hiddenValues;
5700
- this._nonHiddenValues = _.filter(this.values, val => !hiddenValues.includes(val));
5701
- this.fillVisibleValues();
5702
- }
5703
- fillVisibleValues() {
5704
- const maxItemsCount = this.fullScreen ? 6 : 4;
5705
- const nonHiddenValues = _.clone(this._nonHiddenValues);
5706
- this.visibleValues.length = 0;
5707
- for (let i = 0; i < maxItemsCount; i++) {
5708
- if (!nonHiddenValues.length) {
5709
- break;
5710
- }
5711
- const randomIndex = Math.floor(Math.random() * nonHiddenValues.length);
5712
- const item = nonHiddenValues.splice(randomIndex, 1)[0];
5713
- this.visibleValues.push(item);
5714
- }
5715
- this.cdr.markForCheck();
5716
- }
5717
- clearHidden() {
5718
- localStorage.setItem('aiChatSuggestions', null);
5719
- this.filterValues();
5720
- }
5721
- toggleSuggestedMenu() {
5722
- this.isSuggestedMenuOpen = !this.isSuggestedMenuOpen;
5723
- if (this.isSuggestedMenuOpen) {
5724
- this.fillVisibleValues();
5725
- }
5726
- }
5684
+ class DrTabsModule {
5685
+ }
5686
+ DrTabsModule.decorators = [
5687
+ { type: NgModule, args: [{
5688
+ imports: [
5689
+ CommonModule,
5690
+ MatTabsModule,
5691
+ FormsModule,
5692
+ ReactiveFormsModule,
5693
+ DrInputsModule,
5694
+ DrTooltipModule
5695
+ ],
5696
+ exports: [
5697
+ DrTabsComponent,
5698
+ DrTabComponent
5699
+ ],
5700
+ providers: [],
5701
+ declarations: [
5702
+ DrTabsComponent,
5703
+ DrTabComponent
5704
+ ],
5705
+ },] }
5706
+ ];
5707
+
5708
+ const DR_ACCORDION_COMPONENTS = [
5709
+ DrAccordionComponent,
5710
+ DrAccordionItemComponent,
5711
+ DrAccordionItemHeaderComponent,
5712
+ DrAccordionItemBodyComponent,
5713
+ ];
5714
+ class DrAccordionModule {
5727
5715
  }
5728
- DrChatSuggestionsComponent.decorators = [
5729
- { type: Component, args: [{
5730
- selector: 'dr-chat-suggestions',
5731
- template: "<div class=\"chat-suggestions\">\n <ng-container *ngIf=\"buttonMode; else suggestionCards\">\n <div class=\"chat-suggestions__container\"\n [class.chat-suggestions__container--opened]=\"isSuggestedMenuOpen\"\n *ngIf=\"visibleValues.length\">\n <dr-button theme=\"ghost\" class=\"chat-suggestions__container__button\" (click)=\"toggleSuggestedMenu()\">\n Suggested chats\n </dr-button>\n <ng-container *ngTemplateOutlet=\"suggestionCards\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n<ng-template #suggestionCards>\n <div class=\"chat-suggestions__items\">\n <div class=\"chat-suggestions__items__background\"></div>\n <div *ngFor=\"let item of visibleValues\"\n class=\"chat-suggestions__items__item\" (click)=\"onItemClick(item)\">\n {{ item }}\n </div>\n </div>\n</ng-template>\n",
5732
- changeDetection: ChangeDetectionStrategy.OnPush,
5733
- styles: [":host{display:flex;align-items:flex-start;justify-content:center}:host .chat-suggestions{display:flex;width:100%;max-width:970px}:host .chat-suggestions__container{display:flex;position:relative;width:auto;margin-top:12px;padding:0 24px}:host .chat-suggestions__container__button{z-index:3}:host .chat-suggestions__container__button::ng-deep button{background:#F2F2FB!important;border-radius:4px;cursor:pointer}:host .chat-suggestions__container .chat-suggestions__items{display:none;position:absolute;width:100%;bottom:0;left:0;padding-bottom:32px;z-index:2}:host .chat-suggestions__container--opened{width:100%}:host .chat-suggestions__container--opened .chat-suggestions__container__button::ng-deep button{color:#4646ce;background:#F2F2FB}:host .chat-suggestions__container--opened .chat-suggestions__items,:host .chat-suggestions__container--opened .chat-suggestions__items__background{display:flex}:host .chat-suggestions__items{display:flex;flex-wrap:wrap;width:100%;justify-content:space-between;padding:0 24px}:host .chat-suggestions__items__background{display:none;position:absolute;top:-32px;right:0;bottom:32px;left:0;background:#FFFFFF;opacity:.7;z-index:-1}:host .chat-suggestions__items__item{margin:0 0 20px;display:inline-flex;height:76px;width:275px;padding:16px;border-radius:8px;background:#F2F2FB;box-shadow:0 1px 2px #00000026;font-size:14px;line-height:24px;color:#25258c}:host .chat-suggestions__items__item:hover{cursor:pointer;background:#EAEAFF}\n"]
5716
+ DrAccordionModule.decorators = [
5717
+ { type: NgModule, args: [{
5718
+ imports: [CommonModule],
5719
+ exports: [...DR_ACCORDION_COMPONENTS],
5720
+ declarations: [...DR_ACCORDION_COMPONENTS],
5721
+ providers: [],
5734
5722
  },] }
5735
5723
  ];
5736
- DrChatSuggestionsComponent.ctorParameters = () => [
5737
- { type: ChangeDetectorRef }
5724
+
5725
+ const components = [
5726
+ DrLayoutComponent,
5727
+ DrLayoutHeaderComponent,
5728
+ DrLayoutBodyComponent
5729
+ ];
5730
+ class DrLayoutModule {
5731
+ }
5732
+ DrLayoutModule.decorators = [
5733
+ { type: NgModule, args: [{
5734
+ imports: [CommonModule],
5735
+ exports: [...components],
5736
+ declarations: [...components],
5737
+ },] }
5738
5738
  ];
5739
- DrChatSuggestionsComponent.propDecorators = {
5740
- values: [{ type: Input }],
5741
- fullScreen: [{ type: Input }],
5742
- buttonMode: [{ type: Input }],
5743
- waitForReply: [{ type: Input }],
5744
- suggestionSelect: [{ type: Output }]
5745
- };
5746
5739
 
5747
- class DrChatComponent {
5748
- constructor(cdr) {
5749
- this.cdr = cdr;
5750
- this.destroy$ = new Subject();
5751
- this.showClearButton = true;
5752
- this.noMessagesPlaceholder = 'No messages yet.';
5753
- this._scrollBottom = true;
5754
- this.suggestions = [];
5755
- /**
5756
- * Parameter to check is send message function available
5757
- *
5758
- * @type {boolean}
5759
- */
5760
- this.waitForReply = false;
5761
- this.clear = new EventEmitter();
5762
- this.close = new EventEmitter();
5763
- this.suggestionSelect = new EventEmitter();
5740
+ class DrErrorModule {
5741
+ }
5742
+ DrErrorModule.decorators = [
5743
+ { type: NgModule, args: [{
5744
+ imports: [
5745
+ CommonModule,
5746
+ FormsModule,
5747
+ DrTooltipModule
5748
+ ],
5749
+ exports: [DrErrorComponent],
5750
+ providers: [],
5751
+ declarations: [
5752
+ DrErrorComponent
5753
+ ],
5754
+ },] }
5755
+ ];
5756
+
5757
+ class StepperComponent {
5758
+ constructor() {
5759
+ this.withoutConnectors = false;
5760
+ this.hiddenNames = false;
5761
+ this.inlineLabels = false;
5762
+ this.disabled = false;
5763
+ this.hiddenIndex = false;
5764
+ this.stepChange = new EventEmitter();
5764
5765
  }
5765
- set contentUpdateSubject(value) {
5766
- if (value) {
5767
- value.pipe(takeUntil(this.destroy$)).subscribe(() => {
5768
- this.updateView();
5769
- });
5766
+ selectStep(step) {
5767
+ if (step !== this.currentStep && !this.disabled) {
5768
+ this.stepChange.emit(step);
5770
5769
  }
5771
5770
  }
5772
- ;
5773
- /**
5774
- * Scroll chat to the bottom of the list when a new message arrives
5775
- */
5776
- get scrollBottom() {
5777
- return this._scrollBottom;
5778
- }
5779
- set scrollBottom(value) {
5780
- this._scrollBottom = !!value;
5781
- }
5782
- get messagesContainerWithScroll() {
5783
- return this.messagesContainer && this.messagesContainer.nativeElement.scrollHeight > this.messagesContainer.nativeElement.offsetHeight;
5784
- }
5785
- ;
5786
- ngAfterViewInit() {
5787
- this.messages.changes.subscribe(messages => {
5788
- this.messages = messages;
5789
- this.updateView();
5790
- });
5791
- this.updateView();
5792
- }
5793
- updateView() {
5794
- if (this.scrollBottom) {
5795
- this.scrollListBottom();
5796
- }
5771
+ getWidth(step) {
5772
+ if (this.withoutConnectors)
5773
+ return '0%';
5774
+ if (step.completed)
5775
+ return '100%';
5776
+ if (step.index === 0 || this.steps[step.index - 1].completed)
5777
+ return `${((step === null || step === void 0 ? void 0 : step.completedTasks) / (step === null || step === void 0 ? void 0 : step.requiredTasks) * 100) || 0}%`;
5778
+ return '0%';
5797
5779
  }
5798
- scrollListBottom() {
5799
- setTimeout(() => {
5800
- if (this.messagesContainer) {
5801
- const scrollToOptions = {
5802
- top: this.messagesContainer.nativeElement.scrollHeight,
5803
- };
5804
- if (!this.reopen) {
5805
- scrollToOptions.behavior = 'smooth';
5806
- }
5807
- this.messagesContainer.nativeElement.scrollTo(scrollToOptions);
5808
- this.cdr.markForCheck();
5809
- }
5810
- });
5780
+ scrollLeft() {
5781
+ this.stepper.nativeElement.scrollLeft -= 80;
5811
5782
  }
5812
- ngOnDestroy() {
5813
- this.destroy$.next();
5814
- this.destroy$.complete();
5783
+ scrollRight() {
5784
+ this.stepper.nativeElement.scrollLeft += 80;
5815
5785
  }
5816
- onClearClick($event) {
5817
- this.clear.emit($event);
5818
- if (this._chatSuggestions) {
5819
- this._chatSuggestions.clearHidden();
5820
- }
5786
+ roundWidth(width) {
5787
+ return Math.round(width);
5821
5788
  }
5822
5789
  }
5823
- DrChatComponent.decorators = [
5790
+ StepperComponent.decorators = [
5824
5791
  { type: Component, args: [{
5825
- selector: 'dr-chat',
5826
- template: "<div class=\"chat\" [class.chat--in-full-screen]=\"fullScreen\">\n <div class=\"chat__header\">\n <div class=\"chat__header__logo\"></div>\n\n <div class=\"chat__header__text\">\n <div class=\"chat__header__text__title\">{{ title }}</div>\n <div *ngIf=\"subtitle\" class=\"chat__header__text__subtitle\">{{ subtitle }}</div>\n </div>\n\n <dr-button *ngIf=\"showClearButton\"\n (click)=\"onClearClick($event)\"\n theme=\"icon\"\n icon=\"dr-icon-clear\"\n class=\"ml-auto\"\n drTooltip=\"Clear chat\">\n </dr-button>\n\n <dr-button *ngIf=\"!fullScreen\"\n (click)=\"close.emit($event)\"\n theme=\"icon\"\n icon=\"dr-icon-exit\"\n class=\"ml-4\"\n drTooltip=\"Close\">\n </dr-button>\n </div>\n\n <div *ngIf=\"!messages?.length\" class=\"chat__empty-state\">\n <span class=\"chat__empty-state__text\">{{ noMessagesPlaceholder }}</span>\n </div>\n\n <div *ngIf=\"messages?.length\" class=\"chat__messages\">\n <div #messagesContainer class=\"chat__messages__container\"\n [class.chat__messages__container--scroll]=\"messagesContainerWithScroll\">\n <ng-content select=\"dr-chat-message\"></ng-content>\n </div>\n </div>\n\n <dr-chat-suggestions *ngIf=\"suggestions?.length\"\n [values]=\"suggestions\"\n [fullScreen]=\"fullScreen\"\n [waitForReply]=\"waitForReply\"\n class=\"chat__suggestions\"\n [class.chat__suggestions--full-height]=\"fullScreen && !messages?.length\"\n [buttonMode]=\"!!messages?.length\"\n (suggestionSelect)=\"suggestionSelect.emit($event)\">\n </dr-chat-suggestions>\n\n <div class=\"form\">\n <ng-content select=\"dr-chat-form\"></ng-content>\n </div>\n</div>\n",
5827
- providers: [DrChatCustomMessageService],
5828
- styles: [":host{height:100%;width:100%;display:flex;flex-direction:column}.chat{position:relative;display:flex;flex-grow:1;flex-direction:column;height:100%;background-color:#fff;color:#4e566c;font-family:\"Poppins\",sans-serif;font-size:14px;font-weight:400;line-height:22px}.chat__header{display:flex;align-items:center;background-color:#f2f2ff;color:#25258c;padding:15px 24px;font-weight:400;font-size:20px;line-height:28px;box-shadow:0 1px 3px #0003;z-index:1}.chat__header__logo{display:flex;width:43px;height:38px;background:url(\"data:image/svg+xml,%3C%3Fxml version%3D%221.0%22 encoding%3D%22UTF-8%22%3F%3E%3Csvg id%3D%22Layer_1%22 data-name%3D%22Layer 1%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22 viewBox%3D%220 0 74 65%22%3E %3Cdefs%3E %3Cstyle%3E .cls-1%2C .cls-2%2C .cls-3 %7B fill%3A none%3B %7D .cls-4 %7B fill%3A url(%23linear-gradient)%3B %7D .cls-5 %7B fill%3A %234eb7df%3B %7D .cls-2 %7B stroke%3A %23a6a8aa%3B stroke-miterlimit%3A 10%3B stroke-width%3A .37px%3B %7D .cls-6 %7B fill%3A url(%23linear-gradient-3)%3B %7D .cls-7 %7B fill%3A url(%23linear-gradient-2)%3B %7D .cls-3 %7B clip-path%3A url(%23clippath)%3B %7D %3C%2Fstyle%3E %3CclipPath id%3D%22clippath%22%3E %3Crect class%3D%22cls-1%22 width%3D%2274%22 height%3D%2265%22%2F%3E %3C%2FclipPath%3E %3ClinearGradient id%3D%22linear-gradient%22 x1%3D%2224.26%22 y1%3D%22-3.79%22 x2%3D%2295.63%22 y2%3D%2288.82%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%220%22 stop-color%3D%22%237676ff%22%2F%3E %3Cstop offset%3D%22.18%22 stop-color%3D%22%235959ff%22%2F%3E %3Cstop offset%3D%22.35%22 stop-color%3D%22%235757e0%22%2F%3E %3Cstop offset%3D%22.61%22 stop-color%3D%22%234646ce%22%2F%3E %3Cstop offset%3D%22.84%22 stop-color%3D%22%234b4be4%22%2F%3E %3Cstop offset%3D%221%22 stop-color%3D%22%234444eb%22%2F%3E %3C%2FlinearGradient%3E %3ClinearGradient id%3D%22linear-gradient-2%22 x1%3D%2212.05%22 y1%3D%2277.06%22 x2%3D%2210.77%22 y2%3D%2213.85%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%22.45%22 stop-color%3D%22%232f92b8%22%2F%3E %3Cstop offset%3D%22.84%22 stop-color%3D%22%234eb7df%22%2F%3E %3Cstop offset%3D%221%22 stop-color%3D%22%234eb7df%22%2F%3E %3C%2FlinearGradient%3E %3ClinearGradient id%3D%22linear-gradient-3%22 x1%3D%2262.26%22 y1%3D%22-2.54%22 x2%3D%2261.76%22 y2%3D%2285.91%22 gradientTransform%3D%22translate(0 65.89) scale(1 -1)%22 gradientUnits%3D%22userSpaceOnUse%22%3E %3Cstop offset%3D%220%22 stop-color%3D%22%2336369b%22%2F%3E %3Cstop offset%3D%22.52%22 stop-color%3D%22%234848d0%22%2F%3E %3C%2FlinearGradient%3E %3C%2Fdefs%3E %3Cg class%3D%22cls-3%22%3E %3Cg%3E %3Cpath class%3D%22cls-4%22 d%3D%22m73.32%2C24.79v15.73c0%2C13.12-9.87%2C23.79-22%2C23.79h-21.32c-3.46-.06-6.25-3.11-6.25-6.87s2.79-6.81%2C6.25-6.87h21.32c5.13%2C0%2C9.29-4.51%2C9.29-10.05v-15.73c0-5.54-4.17-10.05-9.29-10.05h-7.46c3.51%2C0%2C6.35-3.08%2C6.35-6.88s-2.79-6.8-6.25-6.87h7.35c12.12%2C0%2C22%2C10.67%2C22%2C23.79h0Z%22%2F%3E %3Cpath class%3D%22cls-5%22 d%3D%22m50.26%2C7.82c0%2C3.8-2.9%2C6.93-6.41%2C6.93h-21.86c-5.13%2C0-9.29%2C4.51-9.29%2C10.05v15.73c0%2C5.54%2C4.17%2C10.05%2C9.29%2C10.05h8.01c-3.46.06-6.25%2C3.11-6.25%2C6.87s2.79%2C6.81%2C6.25%2C6.87h-8.01c-12.12%2C0-22-10.67-22-23.79v-15.73C0%2C11.68%2C9.87%2C1%2C21.99%2C1h21.97c3.46.06%2C6.3%2C3.06%2C6.3%2C6.82Z%22%2F%3E %3Cpath class%3D%22cls-2%22 d%3D%22m66.45%2C1h-.22.22%2C0Z%22%2F%3E %3Cpath class%3D%22cls-2%22 d%3D%22m36.05%2C50.58h-.22.22%2C0Z%22%2F%3E %3Cpath class%3D%22cls-7%22 d%3D%22m0%2C33.78v-2.76C0%2C12.9%2C13.62%2C14.48%2C13.62%2C14.48h8.38c-5.5.46-9.5%2C4.71-9.5%2C9.96l.02%2C15.8c0%2C5.54%2C4.44%2C10.59%2C9.48%2C10.59l-8-.5S0%2C51.88%2C0%2C33.77h0Z%22%2F%3E %3Cpath class%3D%22cls-6%22 d%3D%22m73%2C31.51v2.76c0%2C18.12-13.62%2C16.53-13.62%2C16.53h-7.99c5.61-.85%2C9.09-4.76%2C9.09-10.02l.02-16.33c0-5.54-4.46-10-9.5-10h8s13.99-1.05%2C13.99%2C17.07h0Z%22%2F%3E %3C%2Fg%3E %3C%2Fg%3E%3C%2Fsvg%3E\") no-repeat;background-size:100% 100%}.chat__header__text{display:flex;flex-direction:column;flex-grow:1;margin-left:20px}.chat__header__text__title{display:flex;align-items:center}.chat__header__text__title:after{content:\"BETA\";display:inline-flex;padding:2px 10px;background:#25258C;color:#f4f4f3;font-weight:600;font-size:10px;line-height:14px;border-radius:8px;margin-left:12px;font-family:\"Nunito Sans\",sans-serif}.chat__header__text__subtitle{font-size:14px;line-height:22px}.chat__header dr-button::ng-deep button:not(:hover){color:#25258c}.chat__empty-state{display:flex;justify-content:center}.chat__empty-state__text{padding:20px 0;font-family:Poppins,sans-serif;font-size:20px;font-weight:300;line-height:30px;text-align:center;max-width:440px;color:#4646ce}.chat__messages{display:flex;flex-grow:1;overflow-x:hidden;overflow-y:auto;height:100%;width:100%}.chat__messages__container{overflow-y:auto;overflow-x:hidden;display:flex;flex-shrink:0;flex-direction:column;width:100%;padding-bottom:1px}.chat__messages__container--scroll::ng-deep dr-chat-message{padding-right:16px}.chat__suggestions--full-height{flex-grow:1;height:1px;overflow:auto}.chat--in-full-screen .chat__header{padding-left:48px;padding-right:48px}.chat--in-full-screen .chat__empty-state__text{padding:77px 0;font-size:28px;line-height:46px;max-width:570px}.chat--in-full-screen .chat__messages::ng-deep dr-chat-message{justify-content:center}.chat--in-full-screen .chat__messages::ng-deep .message{max-width:919px}.chat--in-full-screen .chat__suggestions::ng-deep .chat-suggestions__items{padding-left:0;padding-right:0}.chat--in-full-screen .chat__suggestions::ng-deep .chat-suggestions__items__item{margin:0 0 26px;height:80px;width:310px;font-size:16px}.chat--in-full-screen .chat__suggestions::ng-deep .chat-suggestions__container{padding:0}\n"]
5792
+ selector: 'dr-stepper',
5793
+ template: "<div class=\"scroll-section\" *ngIf=\"stepper?.scrollLeft !== 0\" (click)=\"scrollLeft()\">\n <i class=\"dr-icon-arrow-right\"></i>\n</div>\n<div #stepper class=\"stepper\" [ngClass]=\"{'stepper--disabled': disabled}\">\n <ng-container *ngFor=\"let step of steps; let index = index; last as isLast; first as isFirst\">\n <div *ngIf=\"!step.hide\" class=\"step\" (click)=\"selectStep(step)\"\n [class.step-setup]=\"inlineLabels\">\n <div class=\"step-wrapper\" [drTooltip]=\"step.description && tooltip\"\n [drTooltipContext]=\"{ step: step }\"\n [drTooltipPosition]=\"'bottom'\">\n <div data-test=\"step_point\" class=\"step-point\" [class.active]=\"currentStep === step\" [class.completed]=\"step.completed\">\n <div *ngIf=\"step === currentStep;\" class=\"ellipse\"></div>\n <ng-container [ngSwitch]=\"step.completed\">\n <ng-template [ngSwitchCase]=\"true\">\n <div class=\"pointer blue\">\n <i class=\"dr-icon-approve\"></i>\n </div>\n </ng-template>\n <ng-template [ngSwitchCase]=\"false\">\n <div class=\"pointer\" [class.gray]=\"step !== currentStep\"\n [ngClass]=\"{'blue with-ellipse': step === currentStep}\">\n <div [hidden]=\"step === currentStep || hiddenIndex\" class=\"text\">{{index + 1}}</div>\n </div>\n </ng-template>\n </ng-container>\n </div>\n <div data-test=\"step_label_name\" class=\"step-label\" [class.active]=\"currentStep === step\"\n [ngClass]=\"step.completed ? 'completed' : 'uncompleted'\">\n <span [hidden]=\"hiddenNames\">{{step.name}}</span>\n </div>\n <ng-container *ngIf=\"inlineLabels\" [ngTemplateOutlet]=\"connector\"\n [ngTemplateOutletContext]=\"{ index, isLast, step }\">\n </ng-container>\n <span *ngIf=\"step.showProgress\"\n data-test=\"step_progress\"\n class=\"step-progress\">\n {{(step.requiredTasks ? step.completedTasks : step.requiredTasks) + '/' + step.requiredTasks}}\n </span>\n </div>\n <ng-container *ngIf=\"!inlineLabels\" [ngTemplateOutlet]=\"connector\"\n [ngTemplateOutletContext]=\"{ index, isLast, step }\">\n </ng-container>\n </div>\n </ng-container>\n</div>\n<div (click)=\"scrollRight()\" class=\"scroll-section\"\n *ngIf=\"stepper?.scrollWidth > stepper?.clientWidth && roundWidth(stepper?.scrollLeft + stepper?.clientWidth) < stepper?.scrollWidth\">\n <i class=\"dr-icon-arrow-right\"></i>\n</div>\n\n<ng-template #tooltip let-step=\"step\">\n <div class=\"step-tooltip\">\n <div class=\"step-tooltip_name\">{{step.name}}</div>\n <div class=\"step-tooltip_description\">{{step.description}}</div>\n </div>\n</ng-template>\n\n<ng-template #connector let-step=\"step\" let-isLast=\"isLast\" let-index=\"index\">\n <div class=\"step-connector\" [class.only-one-step]=\"steps.length === 1\"\n [class]=\"'step-connector--' + (!inlineLabels ? 'absolute' : 'inline')\"\n *ngIf=\"steps.length === 1 || !isLast\"\n [style.visibility]=\"withoutConnectors || steps[step.index + 1]?.hide ? 'hidden' : 'unset'\"\n [class.connector-grand]=\"!inlineLabels && (index === 0 || index === steps.length - 2)\">\n <div class=\"progress\" [style.width]=\"getWidth(step)\"></div>\n </div>\n</ng-template>\n",
5794
+ changeDetection: ChangeDetectionStrategy.Default,
5795
+ styles: [":host{font-family:\"Poppins\",sans-serif;display:flex;justify-content:center;height:100%;position:relative}:host .scroll-section{position:absolute;top:0;height:100%;width:108px;display:flex;align-items:center;z-index:10}:host .scroll-section i{font-size:24px;color:#2969b0;background:#f3f7ff;border-radius:24px}:host .scroll-section i:hover{background:#cde1fb;cursor:pointer}:host .scroll-section:first-child{left:0;padding-left:16px;background:linear-gradient(90deg,#ffffff 36.08%,rgba(255,255,255,0) 87.17%)}:host .scroll-section:first-child i{transform:rotate(180deg)}:host .scroll-section:last-child{right:0;padding-right:16px;background:linear-gradient(270deg,#ffffff 36.08%,rgba(255,255,255,0) 87.17%);justify-content:flex-end}:host .stepper{display:flex;align-items:center;height:100%;width:100%;overflow:auto;scroll-behavior:smooth}:host .stepper::-webkit-scrollbar{display:none}:host .stepper--disabled .step:hover{cursor:default}:host .stepper--disabled .step-point .ellipse{border-color:#bcbcbc}:host .stepper--disabled .step-point .pointer{color:#fff;background-color:#bcbcbc;cursor:default}:host .stepper--disabled .step-label{color:#bcbcbc}:host .stepper--disabled .step-connector{background-color:#bcbcbc}:host .stepper--disabled .step-connector .progress{background-color:#bcbcbc}:host .step{position:relative;display:flex;flex-direction:column;width:120px;align-items:center;flex-shrink:0;flex-grow:1}:host .step:hover{cursor:pointer}:host .step:not(.step-setup) .step-wrapper{width:100%}:host .step:not(.step-setup):first-child .step-wrapper,:host .step:not(.step-setup):first-child .step-point,:host .step:not(.step-setup):first-child .step-label,:host .step:not(.step-setup):first-child .step-progress{margin-left:8px}:host .step:not(.step-setup):first-child .only-one-step{left:0!important;margin-left:25px}:host .step-point{display:flex;justify-content:center;width:100%;height:28px;position:relative;align-items:center}:host .step-point .ellipse{width:28px;height:28px;position:absolute;border-radius:50px;border-color:#4646ce;border-style:solid;border-width:2px;background:white;display:flex;justify-content:center;align-items:center;z-index:2}:host .step-point .pointer{width:24px;height:24px;position:absolute;z-index:4;border-radius:20px;display:flex;align-items:center;justify-content:center;font-weight:bold;font-size:16px;line-height:1.4;color:#51566f;transition:box-shadow .2s ease-in-out}:host .step-point .pointer i{color:#fff;font-size:22px}:host .step-point .pointer.blue{background:#4646ce}:host .step-point .pointer.gray{background:#e5e6ea}:host .step-point .pointer.gray:hover{box-shadow:0 0 4px 2px #00000026}:host .step-point.completed :host .step-point.active{background:#4646ce}:host .step-point.active .ellipse{width:28px;height:28px}:host .step-point.active .pointer{width:20px;height:20px}:host .step-label{font-weight:normal;font-size:14px;line-height:22px;line-height:1.5;color:#6d6e6f;display:flex;justify-content:center;overflow:hidden;margin-top:8px}:host .step-label span{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}:host .step-label.active{font-weight:600;color:#333}:host .step-label:last-child{margin-bottom:23px}:host .step-progress{margin-top:3px;font-style:normal;font-weight:normal;font-size:12px;line-height:1.4;display:flex;justify-content:center}:host .step-connector{background-color:#e5e5e5;height:2px}:host .step-connector.connector-grand{width:calc(100% - 25px)}:host .step-connector.connector-grand.only-one-step{width:calc(100% - 50px)}:host .step-connector .progress{background-color:#4646ce;height:2px;width:0}:host .step-connector--absolute{position:absolute;top:calc(28px / 2);width:100%;left:calc(100% / 2 + 12px)}:host .step-connector--inline{width:50px;margin-left:32px;margin-right:32px}:host .step-setup{width:auto}:host .step-setup .step-wrapper{display:flex;flex-direction:row;align-items:center;width:auto}:host .step-setup+.step-setup{margin-left:0}:host .step-setup .step-progress{display:none}:host .step-setup .step-label{position:relative;transform:none;align-items:center;justify-content:start;margin:0 0 0 8px;font-size:16px}:host .step-setup .step-point{width:28px;height:28px}:host .step-setup .step-point .pointer i{font-size:22px}:host .step-setup .step-point .pointer .text{font-size:16px}::ng-deep .step-tooltip{max-width:250px;font-size:14px;line-height:22px;padding:10px 12px}::ng-deep .step-tooltip_name{font-weight:700;overflow:hidden;text-overflow:ellipsis}@media screen and (min-width: 1367px){.stepper .step-label{font-size:14px}}\n"]
5829
5796
  },] }
5830
5797
  ];
5831
- DrChatComponent.ctorParameters = () => [
5832
- { type: ChangeDetectorRef }
5833
- ];
5834
- DrChatComponent.propDecorators = {
5835
- fullScreen: [{ type: Input }],
5836
- title: [{ type: Input }],
5837
- subtitle: [{ type: Input }],
5838
- showClearButton: [{ type: Input }],
5839
- noMessagesPlaceholder: [{ type: Input }],
5840
- contentUpdateSubject: [{ type: Input }],
5841
- scrollBottom: [{ type: Input }],
5842
- suggestions: [{ type: Input }],
5843
- reopen: [{ type: Input }],
5844
- waitForReply: [{ type: Input }],
5845
- messagesContainer: [{ type: ViewChild, args: ['messagesContainer',] }],
5846
- messages: [{ type: ContentChildren, args: [DrChatMessageComponent,] }],
5847
- chatForm: [{ type: ContentChild, args: [DrChatFormComponent,] }],
5848
- clear: [{ type: Output }],
5849
- close: [{ type: Output }],
5850
- suggestionSelect: [{ type: Output }],
5851
- _chatSuggestions: [{ type: ViewChild, args: [DrChatSuggestionsComponent,] }]
5798
+ StepperComponent.ctorParameters = () => [];
5799
+ StepperComponent.propDecorators = {
5800
+ steps: [{ type: Input }],
5801
+ currentStep: [{ type: Input }],
5802
+ withoutConnectors: [{ type: Input }],
5803
+ hiddenNames: [{ type: Input }],
5804
+ inlineLabels: [{ type: Input }],
5805
+ disabled: [{ type: Input }],
5806
+ hiddenIndex: [{ type: Input }],
5807
+ stepChange: [{ type: Output }],
5808
+ stepper: [{ type: ViewChild, args: ['stepper', { read: ElementRef },] }]
5852
5809
  };
5853
5810
 
5811
+ class DrStepperModule {
5812
+ }
5813
+ DrStepperModule.decorators = [
5814
+ { type: NgModule, args: [{
5815
+ declarations: [StepperComponent],
5816
+ imports: [
5817
+ CommonModule,
5818
+ DrTooltipModule
5819
+ ],
5820
+ exports: [StepperComponent]
5821
+ },] }
5822
+ ];
5823
+
5824
+ class DrDetailsListModule {
5825
+ }
5826
+ DrDetailsListModule.decorators = [
5827
+ { type: NgModule, args: [{
5828
+ imports: [
5829
+ CommonModule,
5830
+ ],
5831
+ exports: [DrDetailsListComponent],
5832
+ providers: [],
5833
+ declarations: [DrDetailsListComponent],
5834
+ },] }
5835
+ ];
5836
+
5837
+ const ɵ0$1 = {}, ɵ1 = {};
5838
+ class DrDialogModule {
5839
+ }
5840
+ DrDialogModule.decorators = [
5841
+ { type: NgModule, args: [{
5842
+ declarations: [DialogWrapperComponent, DialogModalWrapperComponent],
5843
+ imports: [
5844
+ CommonModule,
5845
+ MatDialogModule,
5846
+ DrInputsModule,
5847
+ ReactiveFormsModule,
5848
+ DrTooltipModule,
5849
+ DrDetailsListModule
5850
+ ],
5851
+ exports: [DialogWrapperComponent, DialogModalWrapperComponent],
5852
+ providers: [
5853
+ { provide: MatDialogRef, useValue: ɵ0$1 },
5854
+ { provide: MAT_DIALOG_DATA, useValue: ɵ1 },
5855
+ DialogService
5856
+ ]
5857
+ },] }
5858
+ ];
5859
+
5854
5860
  /**
5855
5861
  * Chat text message component.
5856
5862
  */
@@ -6199,7 +6205,7 @@ DrBadgeStatusComponent.decorators = [
6199
6205
  template: "<div class=\"badge-status\" [drTooltip]=\"tooltip\"\n [ngClass]=\"'badge-status--' + theme\">\n <i *ngIf=\"icon\" class=\"{{ icon }}\"></i>\n <span *ngIf=\"label\">{{ label }}</span>\n</div>\n",
6200
6206
  selector: 'dr-badge-status',
6201
6207
  encapsulation: ViewEncapsulation.None,
6202
- styles: [".badge-status{display:flex;align-items:center;font-family:\"Poppins\",sans-serif;font-style:normal;font-size:\"Poppins\",sans-serif;font-weight:12px;line-height:20px;font-weight:600;height:24px;padding:2px 8px 2px 4px;border-radius:4px;cursor:pointer}.badge-status i{font-size:20px;margin-right:4px}.badge-status--info{color:#0b5af9;background:#E6EFFF}.badge-status--error{color:#bf1d30;background:#F7D9DC}.badge-status--warning{color:#ffb800;background:#FFEDBF}.badge-status--success{color:#03a678;background:#DBF5E6}.badge-status--regular{color:#7e828e;background:#F0F1F4}.badge-status--progress{color:#4646ce;background:#F2F2FB}.badge-status--dotted{color:#7e828e;background:transparent}.badge-status--dotted i{display:none}\n"]
6208
+ styles: [".badge-status{display:flex;align-items:center;font-family:\"Poppins\",sans-serif;font-style:normal;font-size:\"Poppins\",sans-serif;font-weight:12px;line-height:20px;font-weight:600;height:24px;padding:2px 8px 2px 4px;border-radius:4px;cursor:pointer}.badge-status i{font-size:20px;margin-right:4px}.badge-status--info{color:#0b5af9;background:#E6EFFF}.badge-status--error{color:#bf1d30;background:#F7D9DC}.badge-status--warning{color:#ffb800;background:#FFEDBF}.badge-status--success{color:#037c5a;background:#DBF5E6}.badge-status--regular{color:#7e828e;background:#F0F1F4}.badge-status--progress{color:#4646ce;background:#F2F2FB}.badge-status--dotted{color:#7e828e;background:transparent}.badge-status--dotted i{display:none}\n"]
6203
6209
  },] }
6204
6210
  ];
6205
6211
  DrBadgeStatusComponent.ctorParameters = () => [];
@@ -6232,5 +6238,5 @@ DrBadgeStatusModule.decorators = [
6232
6238
  * Generated bundle index. Do not edit.
6233
6239
  */
6234
6240
 
6235
- export { AnyTagComponent, BadgeStatus, CHAT_MESSAGE_TYPE, CalendarView, ChatMessage, ChatRole, CheckboxComponent, CustomDateFormat, DIALOG_BUTTON_LABEL, DIALOG_FIELD_TYPE, DIALOG_SIZE, DateFromats, DatePickerPeriodPosition, DateTagComponent, DateTagModule, DateTags, DayTagComponent, DialogService, DrAccordionComponent, DrAccordionItemBodyComponent, DrAccordionItemComponent, DrAccordionItemHeaderComponent, DrAccordionModule, DrAvatarComponent, DrAvatarModule, DrAvatarPipe, DrBadgeStatusModule, DrButtonComponent, DrChatModule, DrDetailsListComponent, DrDetailsListModule, DrDialogModule, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrErrorComponent, DrErrorModule, DrInputComponent, DrInputsModule, DrLayoutBodyComponent, DrLayoutComponent, DrLayoutHeaderComponent, DrLayoutModule, DrModelDebounceChangeDirective, DrPopoverAlignmentDimension, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrPopoverService, DrScenarioModule, DrSelectComponent, DrSharedUtils, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrStepperModule, DrTabComponent, DrTabsComponent, DrTabsModule, DrTagComponent, DrTagModule, DrToggleButtonComponent, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, IMAGE_TYPES, ListTagComponent, ListTagModule, MonthTagComponent, QuarterTagComponent, RadioButtonComponent, RadioGroupComponent, Scenario, ScenarioService, SpinnerSize, SpinnerType, TagTypes, TimeframeOption, ToggleButtonMode, TooltipComponent, TooltipPosition, WeekTagComponent, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, DrChatCustomMessageDirective as ɵba, DrScenarioConfigurationComponent as ɵbb, DrScenarioTagConfigurationComponent as ɵbc, DrBadgeStatusComponent as ɵbd, DrDatePickerComponent as ɵc, DrDatePickerService as ɵd, DrDatePickerWithTimeframeComponent as ɵe, DrDatePickerFormatDirective as ɵf, DrDatePickerCustomHeaderComponent as ɵg, DrShowTimeframePipe as ɵh, DrSelectAddItemComponent as ɵi, TooltipInfoComponent as ɵj, TooltipInfoSimpleComponent as ɵk, TooltipNoBodyComponent as ɵl, TooltipProcessDefaultComponent as ɵm, DrDynamicTagModule as ɵn, DrDynamicTagComponent as ɵo, StepperComponent as ɵp, DialogWrapperComponent as ɵq, DialogModalWrapperComponent as ɵr, DrChatComponent as ɵs, DrChatCustomMessageService as ɵt, DrChatMessageComponent as ɵu, DrChatFormComponent as ɵv, DrChatSuggestionsComponent as ɵw, DrChatMessageTextComponent as ɵx, DrChatMessageFileComponent as ɵy, DrDotFlashingComponent as ɵz };
6241
+ export { AnyTagComponent, BadgeStatus, CHAT_MESSAGE_TYPE, CalendarView, ChatMessage, ChatRole, CheckboxComponent, CustomDateFormat, DIALOG_BUTTON_LABEL, DIALOG_FIELD_TYPE, DIALOG_SIZE, DateFromats, DatePickerPeriodPosition, DateTagComponent, DateTagModule, DateTags, DayTagComponent, DialogService, DrAccordionComponent, DrAccordionItemBodyComponent, DrAccordionItemComponent, DrAccordionItemHeaderComponent, DrAccordionModule, DrAvatarComponent, DrAvatarModule, DrAvatarPipe, DrBadgeStatusModule, DrButtonComponent, DrChatComponent, DrChatModule, DrDetailsListComponent, DrDetailsListModule, DrDialogModule, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrErrorComponent, DrErrorModule, DrInputComponent, DrInputsModule, DrLayoutBodyComponent, DrLayoutComponent, DrLayoutHeaderComponent, DrLayoutModule, DrModelDebounceChangeDirective, DrPopoverAlignmentDimension, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrPopoverService, DrScenarioModule, DrSelectComponent, DrSharedUtils, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrStepperModule, DrTabComponent, DrTabsComponent, DrTabsModule, DrTagComponent, DrTagModule, DrToggleButtonComponent, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, IMAGE_TYPES, ListTagComponent, ListTagModule, MonthTagComponent, QuarterTagComponent, RadioButtonComponent, RadioGroupComponent, Scenario, ScenarioService, SpinnerSize, SpinnerType, TagTypes, TimeframeOption, ToggleButtonMode, TooltipComponent, TooltipPosition, WeekTagComponent, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, DrScenarioConfigurationComponent as ɵba, DrScenarioTagConfigurationComponent as ɵbb, DrBadgeStatusComponent as ɵbc, DrChatCustomMessageService as ɵc, DrChatMessageComponent as ɵd, DrChatFormComponent as ɵe, DrChatSuggestionsComponent as ɵf, DrDatePickerComponent as ɵg, DrDatePickerService as ɵh, DrDatePickerWithTimeframeComponent as ɵi, DrDatePickerFormatDirective as ɵj, DrDatePickerCustomHeaderComponent as ɵk, DrShowTimeframePipe as ɵl, DrSelectAddItemComponent as ɵm, TooltipInfoComponent as ɵn, TooltipInfoSimpleComponent as ɵo, TooltipNoBodyComponent as ɵp, TooltipProcessDefaultComponent as ɵq, DrDynamicTagModule as ɵr, DrDynamicTagComponent as ɵs, StepperComponent as ɵt, DialogWrapperComponent as ɵu, DialogModalWrapperComponent as ɵv, DrChatMessageTextComponent as ɵw, DrChatMessageFileComponent as ɵx, DrDotFlashingComponent as ɵy, DrChatCustomMessageDirective as ɵz };
6236
6242
  //# sourceMappingURL=datarailsshared-datarailsshared.js.map