@datarailsshared/datarailsshared 1.4.176 → 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.
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { EventEmitter, Component, ViewEncapsulation, Input, Output, HostBinding, ChangeDetectionStrategy, ChangeDetectorRef, forwardRef, ElementRef, Inject, PLATFORM_ID, ContentChildren, Renderer2, ViewChild, ContentChild, Pipe, TemplateRef, HostListener, Directive, ComponentFactoryResolver, ViewContainerRef, Injector, Injectable, Host, Optional, NgModule } from '@angular/core';
3
- import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
3
+ import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS, MatNativeDateModule } from '@angular/material/core';
4
4
  import { MomentDateAdapter, MAT_MOMENT_DATE_ADAPTER_OPTIONS } from '@angular/material-moment-adapter';
5
5
  import * as _ from 'lodash';
6
6
  import { find, map, merge, forEach, some, orderBy, cloneDeep, filter as filter$1, indexOf, reduce, isObject, isNil, isNumber, includes } from 'lodash';
@@ -269,10 +269,10 @@ class MonthTagComponent extends AnyTagComponent {
269
269
  this.lockedDate = [];
270
270
  }
271
271
  get isLocked() {
272
- return this.date ? !this.dateFilter(moment$7.unix(this.date).utc()) : false;
272
+ return this.date ? !this.dateFilter(moment$7.unix(this.date)) : false;
273
273
  }
274
274
  initDate() {
275
- this.date = this.defaultValue || moment$7().utc().unix();
275
+ this.date = this.defaultValue || moment$7().unix();
276
276
  this.dateObj.date = this.date;
277
277
  }
278
278
  initName() {
@@ -281,7 +281,7 @@ class MonthTagComponent extends AnyTagComponent {
281
281
  }
282
282
  }
283
283
  chosenTagHandler(value) {
284
- const resultDate = moment$7.unix(value).utc();
284
+ const resultDate = moment$7.unix(value);
285
285
  resultDate.hour(12);
286
286
  const resultTag = {
287
287
  name: this.name,
@@ -335,7 +335,7 @@ class QuarterTagComponent extends AnyTagComponent {
335
335
  }
336
336
  get isLocked() {
337
337
  return this.quarters
338
- ? this.quarters.some((quarter) => !this.dateFilter(moment$6.unix(quarter.value).utc()))
338
+ ? this.quarters.some((quarter) => !this.dateFilter(moment$6.unix(quarter.value)))
339
339
  : false;
340
340
  }
341
341
  ngOnInit() {
@@ -356,7 +356,7 @@ class QuarterTagComponent extends AnyTagComponent {
356
356
  }
357
357
  }
358
358
  chosenTagHandler(quarter) {
359
- const resultDate = moment$6.unix(quarter.value).utc();
359
+ const resultDate = moment$6.unix(quarter.value);
360
360
  const resultTag = {
361
361
  name: this.name,
362
362
  value: resultDate.unix(),
@@ -447,11 +447,11 @@ class WeekTagComponent extends AnyTagComponent {
447
447
  this.lockedDate = [];
448
448
  }
449
449
  get isLocked() {
450
- return this.date ? !this.dateFilter(moment$5.unix(this.date).utc()) : false;
450
+ return this.date ? !this.dateFilter(moment$5.unix(this.date)) : false;
451
451
  }
452
452
  ngOnInit() {
453
453
  this.initName();
454
- const timestamp = this.defaultValue || moment$5().utc().unix();
454
+ const timestamp = this.defaultValue || moment$5().unix();
455
455
  this.date = timestamp;
456
456
  this.dateObj.date = timestamp;
457
457
  this.chosenTagHandler(timestamp);
@@ -471,7 +471,7 @@ class WeekTagComponent extends AnyTagComponent {
471
471
  }
472
472
  ;
473
473
  chosenTagHandler(value) {
474
- const resultDate = moment$5.unix(value).utc();
474
+ const resultDate = moment$5.unix(value);
475
475
  const resultTag = {
476
476
  name: this.name,
477
477
  value: resultDate.unix(),
@@ -526,10 +526,10 @@ class YearTagComponent extends AnyTagComponent {
526
526
  this.lockedDate = [];
527
527
  }
528
528
  get isLocked() {
529
- return this.date ? !this.dateFilter(moment$4.unix(this.date).utc()) : false;
529
+ return this.date ? !this.dateFilter(moment$4.unix(this.date)) : false;
530
530
  }
531
531
  initDate() {
532
- this.date = this.defaultValue || moment$4().utc().unix();
532
+ this.date = this.defaultValue || moment$4().unix();
533
533
  this.dateObj.date = this.date;
534
534
  }
535
535
  initName() {
@@ -538,7 +538,7 @@ class YearTagComponent extends AnyTagComponent {
538
538
  }
539
539
  }
540
540
  chosenTagHandler(value) {
541
- const resultDate = moment$4.unix(value).utc();
541
+ const resultDate = moment$4.unix(value);
542
542
  resultDate.hour(12);
543
543
  const resultTag = {
544
544
  name: this.name,
@@ -829,10 +829,10 @@ class DayTagComponent extends AnyTagComponent {
829
829
  this.lockedDate = [];
830
830
  }
831
831
  get isLocked() {
832
- return this.date ? !this.dateFilter(moment$3.unix(this.date).utc()) : false;
832
+ return this.date ? !this.dateFilter(moment$3.unix(this.date)) : false;
833
833
  }
834
834
  initDate() {
835
- this.date = this.defaultValue || moment$3().utc().unix();
835
+ this.date = this.defaultValue || moment$3().unix();
836
836
  this.dateObj.date = this.date;
837
837
  }
838
838
  initName() {
@@ -841,7 +841,7 @@ class DayTagComponent extends AnyTagComponent {
841
841
  }
842
842
  }
843
843
  chosenTagHandler(value) {
844
- const date = moment$3.unix(value).utc();
844
+ const date = moment$3.unix(value);
845
845
  const resultTag = {
846
846
  name: this.name,
847
847
  value: date.unix(),
@@ -4981,6 +4981,7 @@ DrInputsModule.decorators = [
4981
4981
  ReactiveFormsModule,
4982
4982
  CommonModule,
4983
4983
  NgSelectModule,
4984
+ MatNativeDateModule,
4984
4985
  MatDatepickerModule,
4985
4986
  MatTooltipModule,
4986
4987
  DrTooltipModule
@@ -5660,9 +5661,11 @@ DrChatMessageComponent.propDecorators = {
5660
5661
  };
5661
5662
 
5662
5663
  class DrChatSuggestionsComponent {
5663
- constructor() {
5664
+ constructor(cdr) {
5665
+ this.cdr = cdr;
5664
5666
  this._nonHiddenValues = [];
5665
5667
  this.visibleValues = [];
5668
+ this.isSuggestedMenuOpen = false;
5666
5669
  this.values = [];
5667
5670
  this.fullScreen = false;
5668
5671
  this.buttonMode = false;
@@ -5687,11 +5690,10 @@ class DrChatSuggestionsComponent {
5687
5690
  if (this.waitForReply) {
5688
5691
  return;
5689
5692
  }
5693
+ this.isSuggestedMenuOpen = false;
5690
5694
  this.suggestionSelect.emit(item);
5691
5695
  this.hiddenValues = [...this.hiddenValues, item];
5692
5696
  this.filterValues();
5693
- this.suggestionCardsList.nativeElement.style.visibility = 'hidden';
5694
- setTimeout(() => this.suggestionCardsList.nativeElement.style.visibility = '', 10);
5695
5697
  }
5696
5698
  filterValues() {
5697
5699
  const hiddenValues = this.hiddenValues;
@@ -5710,28 +5712,36 @@ class DrChatSuggestionsComponent {
5710
5712
  const item = nonHiddenValues.splice(randomIndex, 1)[0];
5711
5713
  this.visibleValues.push(item);
5712
5714
  }
5715
+ this.cdr.markForCheck();
5713
5716
  }
5714
5717
  clearHidden() {
5715
5718
  localStorage.setItem('aiChatSuggestions', null);
5716
5719
  this.filterValues();
5717
5720
  }
5721
+ toggleSuggestedMenu() {
5722
+ this.isSuggestedMenuOpen = !this.isSuggestedMenuOpen;
5723
+ if (this.isSuggestedMenuOpen) {
5724
+ this.fillVisibleValues();
5725
+ }
5726
+ }
5718
5727
  }
5719
5728
  DrChatSuggestionsComponent.decorators = [
5720
5729
  { type: Component, args: [{
5721
5730
  selector: 'dr-chat-suggestions',
5722
- 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",
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",
5723
5732
  changeDetection: ChangeDetectionStrategy.OnPush,
5724
- 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"]
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"]
5725
5734
  },] }
5726
5735
  ];
5727
- DrChatSuggestionsComponent.ctorParameters = () => [];
5736
+ DrChatSuggestionsComponent.ctorParameters = () => [
5737
+ { type: ChangeDetectorRef }
5738
+ ];
5728
5739
  DrChatSuggestionsComponent.propDecorators = {
5729
5740
  values: [{ type: Input }],
5730
5741
  fullScreen: [{ type: Input }],
5731
5742
  buttonMode: [{ type: Input }],
5732
5743
  waitForReply: [{ type: Input }],
5733
- suggestionSelect: [{ type: Output }],
5734
- suggestionCardsList: [{ type: ViewChild, args: ['suggestionCardsList',] }]
5744
+ suggestionSelect: [{ type: Output }]
5735
5745
  };
5736
5746
 
5737
5747
  class DrChatComponent {