@datarailsshared/datarailsshared 1.4.177 → 1.4.178

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.
@@ -6466,9 +6466,11 @@
6466
6466
  };
6467
6467
 
6468
6468
  var DrChatSuggestionsComponent = /** @class */ (function () {
6469
- function DrChatSuggestionsComponent() {
6469
+ function DrChatSuggestionsComponent(cdr) {
6470
+ this.cdr = cdr;
6470
6471
  this._nonHiddenValues = [];
6471
6472
  this.visibleValues = [];
6473
+ this.isSuggestedMenuOpen = false;
6472
6474
  this.values = [];
6473
6475
  this.fullScreen = false;
6474
6476
  this.buttonMode = false;
@@ -6494,15 +6496,13 @@
6494
6496
  this.filterValues();
6495
6497
  };
6496
6498
  DrChatSuggestionsComponent.prototype.onItemClick = function (item) {
6497
- var _this = this;
6498
6499
  if (this.waitForReply) {
6499
6500
  return;
6500
6501
  }
6502
+ this.isSuggestedMenuOpen = false;
6501
6503
  this.suggestionSelect.emit(item);
6502
6504
  this.hiddenValues = __spreadArray(__spreadArray([], __read(this.hiddenValues)), [item]);
6503
6505
  this.filterValues();
6504
- this.suggestionCardsList.nativeElement.style.visibility = 'hidden';
6505
- setTimeout(function () { return _this.suggestionCardsList.nativeElement.style.visibility = ''; }, 10);
6506
6506
  };
6507
6507
  DrChatSuggestionsComponent.prototype.filterValues = function () {
6508
6508
  var hiddenValues = this.hiddenValues;
@@ -6521,29 +6521,37 @@
6521
6521
  var item = nonHiddenValues.splice(randomIndex, 1)[0];
6522
6522
  this.visibleValues.push(item);
6523
6523
  }
6524
+ this.cdr.markForCheck();
6524
6525
  };
6525
6526
  DrChatSuggestionsComponent.prototype.clearHidden = function () {
6526
6527
  localStorage.setItem('aiChatSuggestions', null);
6527
6528
  this.filterValues();
6528
6529
  };
6530
+ DrChatSuggestionsComponent.prototype.toggleSuggestedMenu = function () {
6531
+ this.isSuggestedMenuOpen = !this.isSuggestedMenuOpen;
6532
+ if (this.isSuggestedMenuOpen) {
6533
+ this.fillVisibleValues();
6534
+ }
6535
+ };
6529
6536
  return DrChatSuggestionsComponent;
6530
6537
  }());
6531
6538
  DrChatSuggestionsComponent.decorators = [
6532
6539
  { type: i0.Component, args: [{
6533
6540
  selector: 'dr-chat-suggestions',
6534
- template: "<div class=\"chat-suggestions\">\n <ng-container *ngIf=\"buttonMode; else suggestionCards\">\n <div class=\"chat-suggestions__container\" (mouseenter)=\"fillVisibleValues()\">\n <dr-button theme=\"ghost\" class=\"chat-suggestions__container__button\">\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\" #suggestionCardsList>\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",
6541
+ 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",
6535
6542
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
6536
- 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:hover{width:100%}:host .chat-suggestions__container:hover .chat-suggestions__container__button::ng-deep button{color:#4646ce;background:#f2f2fb}:host .chat-suggestions__container:hover .chat-suggestions__items,:host .chat-suggestions__container:hover .chat-suggestions__items__background{display:flex}:host .chat-suggestions__container__button::ng-deep button{background:#F2F2FF!important;border-radius:4px}: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__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:white;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:#F2F2FF;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"]
6543
+ 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"]
6537
6544
  },] }
6538
6545
  ];
6539
- DrChatSuggestionsComponent.ctorParameters = function () { return []; };
6546
+ DrChatSuggestionsComponent.ctorParameters = function () { return [
6547
+ { type: i0.ChangeDetectorRef }
6548
+ ]; };
6540
6549
  DrChatSuggestionsComponent.propDecorators = {
6541
6550
  values: [{ type: i0.Input }],
6542
6551
  fullScreen: [{ type: i0.Input }],
6543
6552
  buttonMode: [{ type: i0.Input }],
6544
6553
  waitForReply: [{ type: i0.Input }],
6545
- suggestionSelect: [{ type: i0.Output }],
6546
- suggestionCardsList: [{ type: i0.ViewChild, args: ['suggestionCardsList',] }]
6554
+ suggestionSelect: [{ type: i0.Output }]
6547
6555
  };
6548
6556
 
6549
6557
  var DrChatComponent = /** @class */ (function () {