@datarailsshared/datarailsshared 1.3.7 → 1.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/_datarailsshared.styles.css +4 -0
  2. package/assets/styles/_styles.scss +2 -0
  3. package/bundles/datarailsshared-datarailsshared.umd.js +141 -70
  4. package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
  5. package/datarailsshared-datarailsshared-1.3.10.tgz +0 -0
  6. package/datarailsshared-datarailsshared.metadata.json +1 -1
  7. package/esm2015/lib/date-tags/day-tag/day-tag.component.js +3 -2
  8. package/esm2015/lib/dr-avatar/dr-avatar.component.js +17 -10
  9. package/esm2015/lib/dr-dropdown/dr-dropdown.component.js +5 -3
  10. package/esm2015/lib/dr-inputs/dr-date-picker/dr-date-picker.component.js +2 -2
  11. package/esm2015/lib/dr-inputs/dr-input/dr-input.component.js +17 -21
  12. package/esm2015/lib/dr-inputs/dr-toggle/dr-toggle.component.js +2 -2
  13. package/esm2015/lib/dr-popover/dr-popover-ref.js +15 -0
  14. package/esm2015/lib/dr-popover/dr-popover.component.js +22 -18
  15. package/esm2015/lib/dr-popover/dr-popover.directive.js +63 -20
  16. package/esm2015/lib/dr-popover/dr-popover.module.js +4 -4
  17. package/esm2015/lib/models/popover.js +2 -0
  18. package/esm2015/public-api.js +2 -1
  19. package/fesm2015/datarailsshared-datarailsshared.js +135 -70
  20. package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
  21. package/lib/dr-avatar/dr-avatar.component.d.ts +4 -2
  22. package/lib/dr-inputs/dr-input/dr-input.component.d.ts +11 -13
  23. package/lib/dr-inputs/dr-toggle/dr-toggle.component.d.ts +1 -1
  24. package/lib/dr-popover/dr-popover-ref.d.ts +12 -0
  25. package/lib/dr-popover/dr-popover.component.d.ts +7 -5
  26. package/lib/dr-popover/dr-popover.directive.d.ts +19 -9
  27. package/lib/models/popover.d.ts +1 -0
  28. package/package.json +1 -1
  29. package/public-api.d.ts +1 -0
  30. package/datarailsshared-datarailsshared-1.3.7.tgz +0 -0
@@ -1,14 +1,15 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetectionStrategy, ChangeDetectorRef, forwardRef, ElementRef, Renderer2, ContentChild, HostBinding, TemplateRef, Directive, HostListener, ComponentFactoryResolver, ViewContainerRef, Inject, ViewChild, Optional, Injectable, Pipe, NgModule } from '@angular/core';
2
+ import { EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetectionStrategy, ChangeDetectorRef, forwardRef, ElementRef, Renderer2, HostBinding, ContentChild, TemplateRef, Directive, HostListener, ComponentFactoryResolver, ViewContainerRef, Inject, ViewChild, Optional, Injector, Injectable, Pipe, NgModule } from '@angular/core';
3
3
  import { FormControl, NG_VALUE_ACCESSOR, NgControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
4
4
  import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS, MatNativeDateModule } from '@angular/material/core';
5
5
  import { MomentDateAdapter, MAT_MOMENT_DATE_ADAPTER_OPTIONS, MatMomentDateModule } from '@angular/material-moment-adapter';
6
6
  import * as momentImported from 'moment';
7
7
  import { transition, style, animate, trigger } from '@angular/animations';
8
- import { Overlay, OverlayPositionBuilder } from '@angular/cdk/overlay';
8
+ import { Overlay, OverlayPositionBuilder, OverlayConfig } from '@angular/cdk/overlay';
9
9
  import { ComponentPortal } from '@angular/cdk/portal';
10
10
  import { DOCUMENT, CommonModule } from '@angular/common';
11
11
  import { Subject } from 'rxjs';
12
+ import { first } from 'rxjs/operators';
12
13
  import { MatDatepickerModule } from '@angular/material/datepicker';
13
14
  import { MatFormFieldModule } from '@angular/material/form-field';
14
15
  import { MatInputModule } from '@angular/material/input';
@@ -735,7 +736,8 @@ class DayTagComponent extends AnyTagComponent {
735
736
  const utcOffsetInMilliseconds = moment().utcOffset() * 60 * 1000;
736
737
  this.dateObj.date = moment(moment().valueOf() + utcOffsetInMilliseconds);
737
738
  if (this.defaultValue) {
738
- this.dateObj.date = moment(new Date(this.defaultValue * 1000)).utc().format("YYYY-MM-DD");
739
+ this.dateObj.date = moment(new Date(this.defaultValue * 1000)).utc();
740
+ this.date.setValue(this.dateObj.date);
739
741
  }
740
742
  }
741
743
  initName() {
@@ -884,6 +886,11 @@ class DrInputComponent {
884
886
  this.elementRef = elementRef;
885
887
  this.renderer = renderer;
886
888
  this.cdr = cdr;
889
+ this.type = 'string';
890
+ this.placeholder = '';
891
+ this.readonly = false;
892
+ this.clearable = false;
893
+ this.blur = new EventEmitter();
887
894
  this.value = null;
888
895
  this._disabled = null;
889
896
  this._elementClass = [];
@@ -891,25 +898,18 @@ class DrInputComponent {
891
898
  show: false,
892
899
  showOnFocus: false,
893
900
  focusSet: false,
894
- checkFocusOut: (target, element) => { return true; },
901
+ checkFocusOut: (target, element) => true,
895
902
  text: 'Save'
896
903
  };
897
- this.onChange = () => { };
898
- this.onTouched = () => { };
899
- this.type = 'string';
900
- this.placeholder = '';
901
- this.readonly = false;
902
- this.clearable = false;
903
- this.min = null;
904
- this.max = null;
905
904
  this.searchHandler = new EventEmitter();
906
905
  this.buttonHandler = new EventEmitter();
907
906
  this.tabindex = -1;
907
+ this.onChange = () => { };
908
+ this.onTouched = () => { };
908
909
  }
909
910
  set disabled(value) {
910
911
  this.setDisabledState(value);
911
912
  }
912
- ;
913
913
  set buttonOptions(value) {
914
914
  var _a, _b;
915
915
  if (value) {
@@ -933,7 +933,6 @@ class DrInputComponent {
933
933
  }
934
934
  this.cdr.markForCheck();
935
935
  }
936
- ;
937
936
  get elementClass() {
938
937
  return this._elementClass.join(' ');
939
938
  }
@@ -996,14 +995,14 @@ class DrInputComponent {
996
995
  DrInputComponent.decorators = [
997
996
  { type: Component, args: [{
998
997
  selector: 'dr-input',
999
- template: "<ng-content select=\"[prefixIcon]\"></ng-content>\r\n<input [(ngModel)]=\"value\"\r\n (ngModelChange)=\"updateChanges()\"\r\n (blur)=\"onTouched()\"\r\n [disabled]=\"_disabled\"\r\n [readonly]=\"readonly\"\r\n [type]=\"type\"\r\n [placeholder]=\"placeholder\"\r\n [matDatepicker]=\"matDatePicker\"\r\n [min]=\"min\"\r\n [max]=\"max\"\r\n>\r\n<span class=\"clear-icon\" (click)=\"writeValue(null)\"></span>\r\n<span *ngIf=\"type === 'search'\" class=\"search-icon\" (click)=\"onSearchClicked($event)\"></span>\r\n<ng-content select=\"[suffixIcon]\"></ng-content>\r\n<button *ngIf=\"_buttonOptions.show || (_buttonOptions.showOnFocus && _buttonOptions.focusSet)\"\r\n (click)=\"onButtonClicked($event)\">\r\n {{_buttonOptions.text}}\r\n</button>\r\n",
998
+ template: "<ng-content select=\"[prefixIcon]\"></ng-content>\r\n<input [(ngModel)]=\"value\"\r\n (ngModelChange)=\"updateChanges()\"\r\n (blur)=\"blur.emit(value); onTouched()\"\r\n [disabled]=\"_disabled\"\r\n [readonly]=\"readonly\"\r\n [type]=\"type\"\r\n [placeholder]=\"placeholder\"\r\n [name]=\"name\"\r\n>\r\n<span class=\"clear-icon\" (click)=\"writeValue(null)\"></span>\r\n<span *ngIf=\"type === 'search'\" class=\"search-icon\" (click)=\"onSearchClicked($event)\"></span>\r\n<ng-content select=\"[suffixIcon]\"></ng-content>\r\n<button *ngIf=\"_buttonOptions.show || (_buttonOptions.showOnFocus && _buttonOptions.focusSet)\"\r\n (click)=\"onButtonClicked($event)\">\r\n {{_buttonOptions.text}}\r\n</button>\r\n",
1000
999
  providers: [{
1001
1000
  provide: NG_VALUE_ACCESSOR,
1002
1001
  useExisting: forwardRef(() => DrInputComponent),
1003
1002
  multi: true
1004
1003
  }],
1005
1004
  changeDetection: ChangeDetectionStrategy.OnPush,
1006
- styles: [":host{position:relative;width:100%;display:flex;flex-direction:row;min-height:32px;height:32px;font-size:14px;font-family:\"Nunito Sans\",sans-serif;border:1px solid #C3C4CE;border-radius:6px;color:#85889c;padding:0 8px;overflow:hidden}:host:hover{border-color:#85889c}:host:focus-within{border-color:#21b8f1!important;color:#151b3f}:host.disabled{pointer-events:none;border:none;color:#85889c;background:#E5E6EA}:host.ng-valid.ng-dirty{border-color:#03a678}:host.ng-invalid.ng-dirty:not(:focus-within){border-color:#de2833!important}:host.ng-untouched.ng-valid{border-color:#c3c4ce}:host input{display:flex;flex-grow:1;height:100%;border:none;padding:4px 0;text-align:left}:host input:disabled{border:none;color:#85889c;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}:host .clear-icon{visibility:hidden}:host.clearable .clear-icon,:host.ng-touched.ng-invalid .clear-icon{visibility:visible;content:url('data:image/svg+xml; utf8, <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5.91783 5.00001L9.03353 1.88395C9.11924 1.79818 9.16651 1.68374 9.16665 1.56171C9.16665 1.43962 9.11937 1.32504 9.03353 1.2394L8.76047 0.966415C8.67463 0.880433 8.56023 0.833344 8.43808 0.833344C8.31612 0.833344 8.20166 0.880433 8.11582 0.966415L5.00013 4.08227L1.88428 0.966415C1.79858 0.880433 1.68404 0.833344 1.56196 0.833344C1.44001 0.833344 1.32556 0.880433 1.23985 0.966415L0.966646 1.2394C0.788869 1.41719 0.788869 1.70637 0.966646 1.88395L4.08242 5.00001L0.966646 8.11593C0.880873 8.20184 0.833677 8.31628 0.833677 8.43831C0.833677 8.56034 0.880873 8.67478 0.966646 8.76062L1.23978 9.03361C1.32548 9.11952 1.44 9.16668 1.56188 9.16668C1.68397 9.16668 1.7985 9.11952 1.88421 9.03361L5.00005 5.91769L8.11575 9.03361C8.20159 9.11952 8.31605 9.16668 8.438 9.16668H8.43815C8.56017 9.16668 8.67456 9.11952 8.7604 9.03361L9.03346 8.76062C9.11916 8.67484 9.16643 8.56034 9.16643 8.43831C9.16643 8.31628 9.11916 8.20184 9.03346 8.116L5.91783 5.00001Z\" fill=\"%2351566F\"/></svg> ');margin:auto 8px;cursor:pointer}:host span+span,:host span+img{margin-left:0}:host.search-type{padding:0 16px;border-radius:16px}:host.search-type.ng-valid{border-color:#c3c4ce}:host.search-type .search-icon{content:url('data:image/svg+xml; utf8, <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11.5816 10.2097C11.4878 10.1157 11.3605 10.0629 11.2277 10.0629H10.8175C10.7473 10.0629 10.6799 10.035 10.6303 9.98534C10.5322 9.88724 10.527 9.73044 10.6132 9.62178C11.4154 8.6112 11.8925 7.33534 11.8925 5.94625C11.8925 2.66209 9.23042 0 5.94625 0C2.66209 0 0 2.66209 0 5.94625C0 9.23042 2.66209 11.8925 5.94625 11.8925C7.33523 11.8925 8.611 11.4155 9.62155 10.6172C9.7304 10.5312 9.88711 10.5366 9.9852 10.6347C10.0349 10.6845 10.0629 10.7519 10.0629 10.8223V11.2277C10.0629 11.3605 10.1157 11.4878 10.2097 11.5816L14.2834 15.6472C14.4787 15.8421 14.795 15.8419 14.9901 15.6468L15.6468 14.9901C15.8419 14.795 15.8421 14.4787 15.6472 14.2834L11.5816 10.2097ZM5.94625 10.0629C3.67296 10.0629 1.82962 8.21955 1.82962 5.94625C1.82962 3.67296 3.67296 1.82962 5.94625 1.82962C8.21955 1.82962 10.0629 3.67296 10.0629 5.94625C10.0629 8.21955 8.21955 10.0629 5.94625 10.0629Z\" fill=\"%23BCBCBC\"/></svg> ');margin:auto 0 auto 8px;cursor:pointer}:host.with-button{padding-right:0}:host.with-button button{color:#0061ff;background:#F6F7F8;height:100%;width:auto;padding:0 8px;display:flex;align-items:center;border:none;border-left:1px solid #C3C4CE}:host ::ng-deep img[prefixIcon],:host ::ng-deep img[suffixIcon],:host ::ng-deep i[prefixIcon],:host ::ng-deep i[suffixIcon]{position:relative;margin:auto 8px}:host ::ng-deep img[prefixIcon],:host ::ng-deep i[prefixIcon]{margin-left:0}:host ::ng-deep img[suffixIcon],:host ::ng-deep i[suffixIcon]{margin-right:0}\n"]
1005
+ styles: [":host{position:relative;width:100%;display:flex;flex-direction:row;min-height:32px;height:32px;font-size:14px;font-family:\"Nunito Sans\",sans-serif;border:1px solid #C3C4CE;border-radius:6px;color:#85889c;padding:0 8px;overflow:hidden;outline:none}:host:hover{border-color:#85889c}:host:focus-within{border-color:#21b8f1!important;color:#151b3f}:host.disabled{pointer-events:none;border:none;color:#85889c;background:#E5E6EA}:host.ng-valid.ng-dirty{border-color:#03a678}:host.ng-invalid.ng-dirty:not(:focus-within){border-color:#de2833!important}:host.ng-untouched.ng-valid{border-color:#c3c4ce}:host input{display:flex;flex-grow:1;height:100%;border:none;padding:4px 0;text-align:left}:host input:disabled{border:none;color:#85889c;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}:host .clear-icon{visibility:hidden}:host.clearable .clear-icon,:host.ng-touched.ng-invalid .clear-icon{visibility:visible;content:url('data:image/svg+xml; utf8, <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M5.91783 5.00001L9.03353 1.88395C9.11924 1.79818 9.16651 1.68374 9.16665 1.56171C9.16665 1.43962 9.11937 1.32504 9.03353 1.2394L8.76047 0.966415C8.67463 0.880433 8.56023 0.833344 8.43808 0.833344C8.31612 0.833344 8.20166 0.880433 8.11582 0.966415L5.00013 4.08227L1.88428 0.966415C1.79858 0.880433 1.68404 0.833344 1.56196 0.833344C1.44001 0.833344 1.32556 0.880433 1.23985 0.966415L0.966646 1.2394C0.788869 1.41719 0.788869 1.70637 0.966646 1.88395L4.08242 5.00001L0.966646 8.11593C0.880873 8.20184 0.833677 8.31628 0.833677 8.43831C0.833677 8.56034 0.880873 8.67478 0.966646 8.76062L1.23978 9.03361C1.32548 9.11952 1.44 9.16668 1.56188 9.16668C1.68397 9.16668 1.7985 9.11952 1.88421 9.03361L5.00005 5.91769L8.11575 9.03361C8.20159 9.11952 8.31605 9.16668 8.438 9.16668H8.43815C8.56017 9.16668 8.67456 9.11952 8.7604 9.03361L9.03346 8.76062C9.11916 8.67484 9.16643 8.56034 9.16643 8.43831C9.16643 8.31628 9.11916 8.20184 9.03346 8.116L5.91783 5.00001Z\" fill=\"%2351566F\"/></svg> ');margin:auto 8px;cursor:pointer}:host span+span,:host span+img{margin-left:0}:host.search-type{padding:0 16px;border-radius:16px}:host.search-type.ng-valid{border-color:#c3c4ce}:host.search-type .search-icon{content:url('data:image/svg+xml; utf8, <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M11.5816 10.2097C11.4878 10.1157 11.3605 10.0629 11.2277 10.0629H10.8175C10.7473 10.0629 10.6799 10.035 10.6303 9.98534C10.5322 9.88724 10.527 9.73044 10.6132 9.62178C11.4154 8.6112 11.8925 7.33534 11.8925 5.94625C11.8925 2.66209 9.23042 0 5.94625 0C2.66209 0 0 2.66209 0 5.94625C0 9.23042 2.66209 11.8925 5.94625 11.8925C7.33523 11.8925 8.611 11.4155 9.62155 10.6172C9.7304 10.5312 9.88711 10.5366 9.9852 10.6347C10.0349 10.6845 10.0629 10.7519 10.0629 10.8223V11.2277C10.0629 11.3605 10.1157 11.4878 10.2097 11.5816L14.2834 15.6472C14.4787 15.8421 14.795 15.8419 14.9901 15.6468L15.6468 14.9901C15.8419 14.795 15.8421 14.4787 15.6472 14.2834L11.5816 10.2097ZM5.94625 10.0629C3.67296 10.0629 1.82962 8.21955 1.82962 5.94625C1.82962 3.67296 3.67296 1.82962 5.94625 1.82962C8.21955 1.82962 10.0629 3.67296 10.0629 5.94625C10.0629 8.21955 8.21955 10.0629 5.94625 10.0629Z\" fill=\"%23BCBCBC\"/></svg> ');margin:auto 0 auto 8px;cursor:pointer}:host.with-button{padding-right:0}:host.with-button button{color:#0061ff;background:#F6F7F8;height:100%;width:auto;padding:0 8px;display:flex;align-items:center;border:none;border-left:1px solid #C3C4CE}:host ::ng-deep img[prefixIcon],:host ::ng-deep img[suffixIcon],:host ::ng-deep i[prefixIcon],:host ::ng-deep i[suffixIcon]{position:relative;margin:auto 8px}:host ::ng-deep img[prefixIcon],:host ::ng-deep i[prefixIcon]{margin-left:0}:host ::ng-deep img[suffixIcon],:host ::ng-deep i[suffixIcon]{margin-right:0}\n"]
1007
1006
  },] }
1008
1007
  ];
1009
1008
  DrInputComponent.ctorParameters = () => [
@@ -1012,21 +1011,20 @@ DrInputComponent.ctorParameters = () => [
1012
1011
  { type: ChangeDetectorRef }
1013
1012
  ];
1014
1013
  DrInputComponent.propDecorators = {
1014
+ disabled: [{ type: Input }],
1015
+ buttonOptions: [{ type: Input }],
1015
1016
  type: [{ type: Input }],
1017
+ name: [{ type: Input }],
1016
1018
  placeholder: [{ type: Input }],
1017
1019
  readonly: [{ type: Input }],
1018
1020
  clearable: [{ type: Input }],
1019
- min: [{ type: Input }],
1020
- max: [{ type: Input }],
1021
- matDatePicker: [{ type: Input }],
1022
- disabled: [{ type: Input }],
1023
- buttonOptions: [{ type: Input }],
1021
+ blur: [{ type: Output }],
1022
+ elementClass: [{ type: HostBinding, args: ['class',] }],
1024
1023
  searchHandler: [{ type: Output }],
1025
1024
  buttonHandler: [{ type: Output }],
1026
1025
  prefixIcon: [{ type: ContentChild, args: ['prefix', { static: false },] }],
1027
1026
  suffixIcon: [{ type: ContentChild, args: ['suffix', { static: false },] }],
1028
- tabindex: [{ type: HostBinding, args: ['tabindex',] }],
1029
- elementClass: [{ type: HostBinding, args: ['class',] }]
1027
+ tabindex: [{ type: HostBinding, args: ['tabindex',] }]
1030
1028
  };
1031
1029
 
1032
1030
  class DrSelectComponent {
@@ -1093,22 +1091,29 @@ DrSelectComponent.propDecorators = {
1093
1091
 
1094
1092
  class DrAvatarComponent {
1095
1093
  constructor() {
1096
- this.users = [];
1097
1094
  this.userClicked = new EventEmitter();
1095
+ this.parsedUsers = [];
1096
+ }
1097
+ set users(user) {
1098
+ if (user) {
1099
+ this.parsedUsers = this.parseUsers(user);
1100
+ }
1098
1101
  }
1099
1102
  ngOnChanges(changes) {
1100
- var _a;
1101
- if (changes.users && ((_a = changes.users.currentValue) === null || _a === void 0 ? void 0 : _a.length)) {
1102
- this.getFirstUsers().forEach((user, index) => user.class = `icon-${index}`);
1103
+ if (changes.users) {
1104
+ this.getFirstUsers().forEach((user) => user.class = `icon-${this.getRandomValue(5)}`);
1103
1105
  this.getLastUsers().forEach((user) => user.class = `icon-${this.getRandomValue(5)}`);
1104
1106
  }
1105
1107
  }
1108
+ parseUsers(value) {
1109
+ return Array.isArray(value) ? value : Array.of(value);
1110
+ }
1106
1111
  getFirstUsers() {
1107
- return this.users.slice(0, 2);
1112
+ return this.parsedUsers.slice(0, 2);
1108
1113
  }
1109
1114
  getLastUsers() {
1110
- if (this.users.length > 2) {
1111
- return this.users.slice(2, this.users.length - 1);
1115
+ if (this.parsedUsers.length > 2) {
1116
+ return this.parsedUsers.slice(2, this.parsedUsers.length - 1);
1112
1117
  }
1113
1118
  return [];
1114
1119
  }
@@ -1119,7 +1124,7 @@ class DrAvatarComponent {
1119
1124
  DrAvatarComponent.decorators = [
1120
1125
  { type: Component, args: [{
1121
1126
  selector: 'dr-avatar',
1122
- template: "<div class=\"users-section\">\r\n <div class=\"users-section__user\"\r\n [class]=\"user.class\"\r\n *ngFor=\"let user of getFirstUsers()\"\r\n (click)=\"userClicked.emit()\"\r\n [matTooltip]=\"user.first_name + ' ' + user.last_name\"\r\n [matTooltipPosition]=\"'below'\">\r\n {{user.first_name[0] + user.last_name[0]}}\r\n </div>\r\n\r\n <div class=\"users-section__user icon-2\" *ngIf=\"users.length > 2\"\r\n [drTooltip]=\"usersTemplate\"\r\n [drTooltipPosition]=\"'bottom'\">\r\n {{getLastUsers().length}}\r\n </div>\r\n</div>\r\n\r\n<ng-template #usersTemplate>\r\n <div *ngFor=\"let user of getLastUsers()\" class=\"users-popover-item\">\r\n <div class=\"users-section__user\"\r\n (click)=\"userClicked.emit()\"\r\n [class]=\"user.class\">\r\n {{user.first_name[0] + user.last_name[0]}}\r\n </div>\r\n <span class=\"username\">\r\n {{user.first_name + ' ' + user.last_name}}\r\n </span>\r\n </div>\r\n</ng-template>\r\n",
1127
+ template: "<div class=\"users-section\">\r\n <div class=\"users-section__user\"\r\n [class]=\"user.class\"\r\n *ngFor=\"let user of getFirstUsers()\"\r\n (click)=\"userClicked.emit()\"\r\n [matTooltip]=\"user.first_name + ' ' + user.last_name\"\r\n [matTooltipPosition]=\"'below'\">\r\n {{user.first_name[0] + user.last_name[0]}}\r\n </div>\r\n\r\n <div class=\"users-section__user icon-2\" *ngIf=\"parsedUsers.length > 2\"\r\n [drTooltip]=\"usersTemplate\"\r\n [drTooltipPosition]=\"'bottom'\">\r\n {{getLastUsers().length}}\r\n </div>\r\n</div>\r\n\r\n<ng-template #usersTemplate>\r\n <div *ngFor=\"let user of getLastUsers()\" class=\"users-popover-item\">\r\n <div class=\"users-section__user\"\r\n (click)=\"userClicked.emit()\"\r\n [class]=\"user.class\">\r\n {{user.first_name[0] + user.last_name[0]}}\r\n </div>\r\n <span class=\"username\">\r\n {{user.first_name + ' ' + user.last_name}}\r\n </span>\r\n </div>\r\n</ng-template>\r\n",
1123
1128
  changeDetection: ChangeDetectionStrategy.OnPush,
1124
1129
  styles: [":host{width:auto}.users-section{display:flex;position:absolute;height:28px;top:5px}.users-popover-item{display:flex;align-items:center;margin:12px}.users-popover-item .username{color:#51566f;font-size:14px}.users-popover-item .users-section__user{margin-right:8px}.users-section__user{display:flex;justify-content:center;align-items:center;height:28px;width:28px;border-radius:14px;background:red;color:#fff;font-size:12px}.users-section__user.icon-0{background-color:#7b61ff}.users-section__user.icon-1{background-color:#21b8f1}.users-section__user.icon-2{background-color:#2969b0}.users-section__user.icon-3{background-color:#51566f}.users-section__user.icon-4{background-color:#0061ff}.users-section__user:hover{cursor:pointer}.users-section__user:not(:first-child){margin-left:4px}\n"]
1125
1130
  },] }
@@ -1389,7 +1394,7 @@ DrToggleComponent.decorators = [
1389
1394
  { provide: NG_VALUE_ACCESSOR, useExisting: DrToggleComponent, multi: true }
1390
1395
  ],
1391
1396
  changeDetection: ChangeDetectionStrategy.OnPush,
1392
- styles: [":host{display:flex;justify-content:space-between;align-items:center}:host .toggle-container.disabled{pointer-events:none}:host .toggle-container.disabled .toggle-body{background-color:#8f9bb329!important}:host .toggle-container.disabled .toggle-body i{background:rgba(143,155,179,.24)!important}:host .toggle-container.success input:checked+span.toggle-body{background-color:#03a678}:host .toggle-container input{display:none}:host .toggle-container input:checked+span.toggle-body>i,:host .toggle-container input:checked+span.toggle-body:active>i{margin-left:16px}:host .toggle-container input:checked+span.toggle-body{background-color:#579bf2}:host .toggle-container .toggle-body{cursor:pointer;display:block;width:30px;height:16px;margin:7px auto;border-radius:15px;transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;background-color:#aeb5bb}:host .toggle-container .toggle-body:active{background-color:#a6b9cb}:host .toggle-container .toggle-body-wrapper{display:flex;flex-direction:column}:host .toggle-container .toggle-body i{height:12px;width:12px;background:#fff;display:inline-block;border-radius:100px;margin-top:2px;margin-left:1.5px;transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;pointer-events:none}\n"]
1397
+ styles: [":host{display:flex;justify-content:space-between;align-items:center}:host .toggle-container.disabled{pointer-events:none}:host .toggle-container.disabled .toggle-body{background-color:#8f9bb329!important}:host .toggle-container.disabled .toggle-body i{background:rgba(143,155,179,.24)!important}:host .toggle-container.success input:checked+span.toggle-body{background-color:#03a678}:host .toggle-container input{display:none}:host .toggle-container input:checked+span.toggle-body>i,:host .toggle-container input:checked+span.toggle-body:active>i{margin-left:16px}:host .toggle-container input:checked+span.toggle-body{background-color:#579bf2}:host .toggle-container .toggle-body{cursor:pointer;display:block;width:30px;height:16px;margin:7px auto;border-radius:15px;transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;background-color:#aeb5bb;line-height:1}:host .toggle-container .toggle-body:active{background-color:#a6b9cb}:host .toggle-container .toggle-body-wrapper{display:flex;flex-direction:column}:host .toggle-container .toggle-body i{height:12px;width:12px;background:#fff;display:inline-block;border-radius:100px;margin-top:2px;margin-left:1.5px;transition:all .2s ease-in-out;-webkit-transition:all .2s ease-in-out;pointer-events:none}\n"]
1393
1398
  },] }
1394
1399
  ];
1395
1400
  DrToggleComponent.ctorParameters = () => [
@@ -1660,7 +1665,7 @@ class DrDatePickerComponent {
1660
1665
  DrDatePickerComponent.decorators = [
1661
1666
  { type: Component, args: [{
1662
1667
  selector: 'new-dr-date-picker',
1663
- template: " <dr-input\r\n (click)=\"datePicker.open()\"\r\n [(ngModel)]=\"value\"\r\n [min]=\"min\"\r\n [max]=\"max\"\r\n [placeholder]=\"placeholder\"\r\n [matDatePicker]=\"datePicker\"\r\n [drDatePickerFormat]=\"_format\"\r\n [readonly]=\"readonly\"\r\n ></dr-input>\r\n <mat-datepicker\r\n #datePicker startView=\"{{_lastView}}\"\r\n (yearSelected)=\"chosenYearHandler($event, datePicker)\"\r\n (monthSelected)=\"chosenMonthHandler($event, datePicker)\">\r\n </mat-datepicker>\r\n\r\n",
1668
+ template: " <dr-input\r\n (click)=\"datePicker.open()\"\r\n [(ngModel)]=\"value\"\r\n [placeholder]=\"placeholder\"\r\n [drDatePickerFormat]=\"_format\"\r\n [readonly]=\"readonly\"\r\n ></dr-input>\r\n <mat-datepicker\r\n #datePicker startView=\"{{_lastView}}\"\r\n (yearSelected)=\"chosenYearHandler($event, datePicker)\"\r\n (monthSelected)=\"chosenMonthHandler($event, datePicker)\">\r\n </mat-datepicker>\r\n\r\n",
1664
1669
  changeDetection: ChangeDetectionStrategy.OnPush,
1665
1670
  providers: [
1666
1671
  { provide: NG_VALUE_ACCESSOR, useExisting: DrDatePickerComponent, multi: true }
@@ -1722,36 +1727,52 @@ DrDatePickerFormatDirective.propDecorators = {
1722
1727
  datePickerFormat: [{ type: Input, args: ['drDatePickerFormat',] }]
1723
1728
  };
1724
1729
 
1730
+ class DrPopoverRef {
1731
+ constructor(overlayRef) {
1732
+ this.overlayRef = overlayRef;
1733
+ this.onClose$ = new Subject();
1734
+ this.onClose = this.onClose$.asObservable();
1735
+ }
1736
+ close(res) {
1737
+ this.overlayRef.detach();
1738
+ this.overlayRef.dispose();
1739
+ this.onClose$.next(res);
1740
+ this.onClose$.complete();
1741
+ }
1742
+ }
1743
+
1725
1744
  class DrPopoverComponent {
1726
- constructor(cdr, componentFactoryResolver, elementRef) {
1745
+ constructor(cdr, componentFactoryResolver, viewContainerRef, elementRef, popoverRef) {
1727
1746
  this.cdr = cdr;
1728
1747
  this.componentFactoryResolver = componentFactoryResolver;
1748
+ this.viewContainerRef = viewContainerRef;
1729
1749
  this.elementRef = elementRef;
1750
+ this.popoverRef = popoverRef;
1730
1751
  this.class = '';
1731
1752
  this.isContentTemplate = false;
1732
1753
  }
1733
1754
  set popoverContainer(template) {
1734
1755
  this.isContentTemplate = this.content instanceof TemplateRef;
1735
1756
  if (!this.isContentTemplate) {
1736
- this.componentRef = template.createComponent(this.componentFactoryResolver.resolveComponentFactory(this.content));
1737
- this.componentRef.instance['closePopover'] = this.closePopover;
1738
- for (let key in this.contentContext) {
1739
- this.componentRef.instance[key] = this.contentContext[key];
1740
- }
1757
+ this.componentRef = this.viewContainerRef.createComponent(this.componentFactoryResolver.resolveComponentFactory(this.content));
1758
+ Object.assign(this.componentRef.instance, this.contentContext);
1759
+ template.nativeElement.appendChild(this.componentRef.location.nativeElement);
1741
1760
  }
1742
1761
  else {
1743
- this.contentContext.closePopover = this.closePopover;
1762
+ this.contentContext.closePopover = this.popoverRef.close.bind(this.popoverRef);
1744
1763
  }
1745
1764
  this.cdr.detectChanges();
1746
1765
  }
1747
- ;
1748
- removeOutside(e) {
1749
- const isTargetHost = this.hostRef.nativeElement === e.target;
1766
+ clickOutside(e) {
1767
+ const isTargetHost = this.hostRef.nativeElement === e.target || this.hostRef.nativeElement.contains(e.target);
1750
1768
  const isTargetInPopover = this.elementRef.nativeElement.contains(e.target);
1751
1769
  const isTargetInDatepicker = e.target.closest('mat-datepicker-popup');
1752
1770
  const isTargetInSelect = e.target.closest('ng-dropdown-panel');
1753
- if (!isTargetHost && !isTargetInPopover && !isTargetInDatepicker && !isTargetInSelect) {
1754
- this.closePopover();
1771
+ if (!isTargetHost
1772
+ && !isTargetInPopover
1773
+ && !isTargetInDatepicker
1774
+ && !isTargetInSelect) {
1775
+ this.popoverRef.close();
1755
1776
  }
1756
1777
  }
1757
1778
  }
@@ -1762,56 +1783,61 @@ DrPopoverComponent.decorators = [
1762
1783
  animations: [
1763
1784
  trigger('popover', POPUP_ANIMATION),
1764
1785
  ],
1765
- styles: [".dr-popover{display:flex;background:#fff;border:1px solid #E5E5E5;border-radius:5px;box-sizing:border-box;box-shadow:0 4px 14px #0003;font-size:12px;color:#545a6b;max-height:100vh;max-width:100vw}\n"]
1786
+ styles: [".dr-popover{display:flex;background:#fff;border:1px solid #E5E5E5;border-radius:5px;box-sizing:border-box;box-shadow:0 4px 14px #0003;font-size:12px;color:#545a6b;max-height:100vh;max-width:100vw;overflow:auto}\n"]
1766
1787
  },] }
1767
1788
  ];
1768
1789
  DrPopoverComponent.ctorParameters = () => [
1769
1790
  { type: ChangeDetectorRef },
1770
1791
  { type: ComponentFactoryResolver },
1771
- { type: ElementRef }
1792
+ { type: ViewContainerRef },
1793
+ { type: ElementRef },
1794
+ { type: DrPopoverRef }
1772
1795
  ];
1773
1796
  DrPopoverComponent.propDecorators = {
1774
1797
  content: [{ type: Input }],
1775
1798
  contentContext: [{ type: Input }],
1776
1799
  class: [{ type: Input }],
1777
1800
  hostRef: [{ type: Input }],
1778
- closePopover: [{ type: Input }],
1779
- popoverContainer: [{ type: ViewChild, args: ['popoverContainer', { read: ViewContainerRef },] }],
1780
- removeOutside: [{ type: HostListener, args: ['document:mouseup', ['$event'],] }]
1801
+ popoverContainer: [{ type: ViewChild, args: ['popoverContainer', { read: ElementRef },] }],
1802
+ clickOutside: [{ type: HostListener, args: ['document:mouseup', ['$event'],] }]
1781
1803
  };
1782
1804
 
1783
1805
  class DrPopoverDirective {
1784
- constructor(overlay, vcRef, resolver, overlayPositionBuilder, elementRef) {
1806
+ constructor(overlay, overlayPositionBuilder, elementRef, injector) {
1785
1807
  this.overlay = overlay;
1786
- this.vcRef = vcRef;
1787
- this.resolver = resolver;
1788
1808
  this.overlayPositionBuilder = overlayPositionBuilder;
1789
1809
  this.elementRef = elementRef;
1810
+ this.injector = injector;
1790
1811
  this.contentContext = {};
1791
1812
  this.position = 'bottom';
1792
1813
  this.class = '';
1814
+ this.overlayConfig = {};
1815
+ this.popoverClose = new EventEmitter();
1816
+ this.showStateChange = new EventEmitter();
1793
1817
  }
1794
1818
  show() {
1819
+ var _a;
1795
1820
  if (this.overlayRef) {
1796
1821
  this.destroyPopover();
1797
1822
  }
1798
1823
  else {
1799
1824
  this.renderPopover();
1825
+ this.showStateChange.emit({ isShown: (_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached() });
1800
1826
  }
1801
1827
  }
1802
1828
  renderPopover() {
1803
1829
  var _a;
1804
- const positionStrategy = this.overlayPositionBuilder.flexibleConnectedTo(this.elementRef)
1805
- .withPositions([POPUP_POSITIONS[this.position]]);
1806
- this.overlayRef = this.overlay.create({ positionStrategy });
1807
- if (!((_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached()) && this.content) {
1808
- this.contentRef = this.overlayRef.attach(new ComponentPortal(DrPopoverComponent));
1809
- this.contentRef.instance.content = this.content;
1810
- this.contentRef.instance.contentContext = this.contentContext;
1811
- this.contentRef.instance.class = this.class + ' ' + this.position;
1812
- this.contentRef.instance.hostRef = this.elementRef;
1813
- this.contentRef.instance.closePopover = this.destroyPopover.bind(this);
1814
- }
1830
+ if (((_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached()) || !this.content)
1831
+ return;
1832
+ this.overlayRef = this.createOverlay(this.overlayConfig || {});
1833
+ this.drPopoverRef = new DrPopoverRef(this.overlayRef);
1834
+ this.drPopoverRef.onClose.pipe(first()).subscribe((res) => {
1835
+ var _a;
1836
+ this.destroyPopover();
1837
+ this.popoverClose.emit(res);
1838
+ this.showStateChange.emit({ isShown: !!((_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached()) });
1839
+ });
1840
+ this.attachOverlayContainer();
1815
1841
  }
1816
1842
  destroyPopover() {
1817
1843
  if (this.overlayRef) {
@@ -1822,6 +1848,41 @@ class DrPopoverDirective {
1822
1848
  this.contentRef.destroy();
1823
1849
  this.contentRef = null;
1824
1850
  }
1851
+ if (this.drPopoverRef) {
1852
+ this.drPopoverRef.close();
1853
+ this.drPopoverRef = null;
1854
+ }
1855
+ }
1856
+ attachOverlayContainer() {
1857
+ const componentPortal = new ComponentPortal(DrPopoverComponent, null, this.createInjector(this.drPopoverRef));
1858
+ this.contentRef = this.overlayRef.attach(componentPortal);
1859
+ this.drPopoverRef.componentRef = this.contentRef;
1860
+ this.contentRef.instance.content = this.content;
1861
+ this.contentRef.instance.contentContext = this.contentContext;
1862
+ this.contentRef.instance.class = this.class + ' ' + this.position;
1863
+ this.contentRef.instance.hostRef = this.elementRef;
1864
+ }
1865
+ createOverlay(config) {
1866
+ const overlayConfig = this.getOverlayConfig(config);
1867
+ return this.overlay.create(overlayConfig);
1868
+ }
1869
+ getOverlayConfig(config) {
1870
+ const positionStrategy = this.overlayPositionBuilder
1871
+ .flexibleConnectedTo(this.elementRef)
1872
+ .withPositions([POPUP_POSITIONS[this.position]]);
1873
+ const overlayConfig = new OverlayConfig({
1874
+ hasBackdrop: false,
1875
+ panelClass: config === null || config === void 0 ? void 0 : config.panelClass,
1876
+ scrollStrategy: this.overlay.scrollStrategies.noop(),
1877
+ positionStrategy,
1878
+ });
1879
+ return overlayConfig;
1880
+ }
1881
+ createInjector(previewOverlayRef) {
1882
+ const injectionTokens = [
1883
+ { provide: DrPopoverRef, useValue: previewOverlayRef },
1884
+ ];
1885
+ return Injector.create({ providers: injectionTokens, parent: this.injector });
1825
1886
  }
1826
1887
  ngOnDestroy() {
1827
1888
  this.destroyPopover();
@@ -1834,16 +1895,18 @@ DrPopoverDirective.decorators = [
1834
1895
  ];
1835
1896
  DrPopoverDirective.ctorParameters = () => [
1836
1897
  { type: Overlay },
1837
- { type: ViewContainerRef },
1838
- { type: ComponentFactoryResolver },
1839
1898
  { type: OverlayPositionBuilder },
1840
- { type: ElementRef }
1899
+ { type: ElementRef },
1900
+ { type: Injector }
1841
1901
  ];
1842
1902
  DrPopoverDirective.propDecorators = {
1843
1903
  content: [{ type: Input, args: ['drPopover',] }],
1844
1904
  contentContext: [{ type: Input, args: ['drPopoverContext',] }],
1845
1905
  position: [{ type: Input, args: ['drPopoverPosition',] }],
1846
1906
  class: [{ type: Input, args: ['drPopoverClass',] }],
1907
+ overlayConfig: [{ type: Input, args: ['drPopoverOverlayConfig',] }],
1908
+ popoverClose: [{ type: Output, args: ['drPopoverClose',] }],
1909
+ showStateChange: [{ type: Output, args: ['drPopoverShowStateChange',] }],
1847
1910
  show: [{ type: HostListener, args: ['click',] }]
1848
1911
  };
1849
1912
 
@@ -1914,8 +1977,10 @@ class DrDropdownComponent {
1914
1977
  }
1915
1978
  }
1916
1979
  tooltipToShow(act) {
1917
- return act.toolTipIfDisabled && this.disabled(act) && act.toolTip
1918
- || act.toolTip && !act.toolTipIfDisabled ? act.toolTip : act.title;
1980
+ if (act.toolTipIfDisabled || this.disabled(act) || !act.toolTip) {
1981
+ return '';
1982
+ }
1983
+ return act.toolTip ? act.toolTip : act.title;
1919
1984
  }
1920
1985
  action(act) {
1921
1986
  if (!this.disabled(act)) {
@@ -2307,5 +2372,5 @@ DrDropdownModule.decorators = [
2307
2372
  * Generated bundle index. Do not edit.
2308
2373
  */
2309
2374
 
2310
- export { AnyTagComponent, CheckboxComponent, DateTagComponent, DateTagModule, DayTagComponent, DrAvatarComponent, DrAvatarModule, DrButtonComponent, DrDatePickerComponent, DrDatePickerFormatDirective, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrInputComponent, DrInputsModule, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrSelectComponent, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrTagComponent, DrTagModule, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, ISpinnerOptions, ListTagComponent, ListTagModule, MonthTagComponent, QuarterTagComponent, RadioButtonComponent, TooltipComponent, WeekTagComponent, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, CustomDateFormat as ɵc };
2375
+ export { AnyTagComponent, CheckboxComponent, DateTagComponent, DateTagModule, DayTagComponent, DrAvatarComponent, DrAvatarModule, DrButtonComponent, DrDatePickerComponent, DrDatePickerFormatDirective, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrInputComponent, DrInputsModule, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrSelectComponent, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrTagComponent, DrTagModule, DrToggleComponent, DrTooltipDirective, DrTooltipModule, ForecastTagComponent, ISpinnerOptions, ListTagComponent, ListTagModule, MonthTagComponent, QuarterTagComponent, RadioButtonComponent, TooltipComponent, WeekTagComponent, YearTagComponent, components$2 as ɵa, POPUP_ANIMATION as ɵb, CustomDateFormat as ɵc };
2311
2376
  //# sourceMappingURL=datarailsshared-datarailsshared.js.map