@datarailsshared/datarailsshared 1.3.10 → 1.3.13

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 (31) hide show
  1. package/bundles/datarailsshared-datarailsshared.umd.js +244 -103
  2. package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
  3. package/datarailsshared-datarailsshared-1.3.13.tgz +0 -0
  4. package/datarailsshared-datarailsshared.metadata.json +1 -1
  5. package/esm2015/lib/dr-inputs/button/button.component.js +7 -3
  6. package/esm2015/lib/dr-inputs/dr-input/dr-input.component.js +22 -7
  7. package/esm2015/lib/dr-inputs/radio-button/radio-button.component.js +1 -1
  8. package/esm2015/lib/dr-popover/dr-popover-ref.js +6 -1
  9. package/esm2015/lib/dr-popover/dr-popover.component.js +20 -18
  10. package/esm2015/lib/dr-popover/dr-popover.directive.js +30 -76
  11. package/esm2015/lib/dr-popover/dr-popover.service.js +76 -0
  12. package/esm2015/lib/dr-tabs/dr-tab.component.js +23 -0
  13. package/esm2015/lib/dr-tabs/dr-tabs.component.js +27 -0
  14. package/esm2015/lib/dr-tabs/dr-tabs.module.js +30 -0
  15. package/esm2015/lib/models/popover.js +12 -1
  16. package/esm2015/public-api.js +6 -2
  17. package/fesm2015/datarailsshared-datarailsshared.js +230 -96
  18. package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
  19. package/lib/dr-inputs/button/button.component.d.ts +2 -1
  20. package/lib/dr-inputs/dr-input/dr-input.component.d.ts +6 -2
  21. package/lib/dr-popover/dr-popover-ref.d.ts +5 -1
  22. package/lib/dr-popover/dr-popover.component.d.ts +7 -4
  23. package/lib/dr-popover/dr-popover.directive.d.ts +9 -15
  24. package/lib/dr-popover/dr-popover.service.d.ts +16 -0
  25. package/lib/dr-tabs/dr-tab.component.d.ts +8 -0
  26. package/lib/dr-tabs/dr-tabs.component.d.ts +10 -0
  27. package/lib/dr-tabs/dr-tabs.module.d.ts +2 -0
  28. package/lib/models/popover.d.ts +21 -0
  29. package/package.json +1 -1
  30. package/public-api.d.ts +5 -1
  31. package/datarailsshared-datarailsshared-1.3.10.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, HostBinding, ContentChild, TemplateRef, Directive, HostListener, ComponentFactoryResolver, ViewContainerRef, Inject, ViewChild, Optional, Injector, 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, ContentChildren, 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
+ import { noop as noop$1, Subject } from 'rxjs';
7
8
  import { transition, style, animate, trigger } from '@angular/animations';
9
+ import * as i1 from '@angular/cdk/overlay';
8
10
  import { Overlay, OverlayPositionBuilder, OverlayConfig } from '@angular/cdk/overlay';
9
11
  import { ComponentPortal } from '@angular/cdk/portal';
10
12
  import { DOCUMENT, CommonModule } from '@angular/common';
11
- import { Subject } from 'rxjs';
12
13
  import { first } from 'rxjs/operators';
13
14
  import { MatDatepickerModule } from '@angular/material/datepicker';
14
15
  import { MatFormFieldModule } from '@angular/material/form-field';
@@ -17,6 +18,7 @@ import { MatSelectModule } from '@angular/material/select';
17
18
  import { MatButtonToggleModule } from '@angular/material/button-toggle';
18
19
  import { NgSelectModule } from '@ng-select/ng-select';
19
20
  import { MatTooltipModule } from '@angular/material/tooltip';
21
+ import { MatTabsModule } from '@angular/material/tabs';
20
22
 
21
23
  // import {*} from ""
22
24
  class DateTagComponent {
@@ -820,7 +822,7 @@ RadioButtonComponent.decorators = [
820
822
  ],
821
823
  changeDetection: ChangeDetectionStrategy.OnPush,
822
824
  encapsulation: ViewEncapsulation.ShadowDom,
823
- styles: ["label input[type=radio].radiobox+span{vertical-align:middle;line-height:20px}input+span,input+span:after,input+span:before{box-sizing:content-box!important;-webkit-box-sizing:content-box!important;-moz-box-sizing:content-box!important}input{visibility:hidden;position:absolute;width:18px;height:18px}label input+span{position:relative;z-index:19;display:inline-block;margin:0 5px 0 0;line-height:17px;min-height:14px;min-width:14px}label input+span:hover{cursor:pointer}label input+span:before{content:\"\";font-size:14px;border-radius:0;display:inline-block;text-align:center;vertical-align:middle;padding:1px;height:12px;line-height:13px;min-width:12px;margin-right:5px;border:1px solid #C3C4CE;background-color:#fff;font-weight:normal;margin-top:-1px}label input+span:before{border-radius:50%;-moz-border-radius:50%;-webkit-border-radius:50%}label input:checked+span:before,label:hover input:checked+span:before{background:white;border-color:#579bf2;color:#579bf2}label input:checked+span:before,label:hover input:checked+span:before{font-family:\"DataRails\"!important;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\"><circle cx=\"5\" cy=\"5\" r=\"4.5\" fill=\"%23579BF2\"/></svg> ');color:#579bf2}label input:disabled+span:before{border-color:#bcbcbc}label input[disabled]:checked+span:before{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\"><circle cx=\"5\" cy=\"5\" r=\"4.5\" fill=\"%23BCBCBC\"/></svg> ');border-color:#bcbcbc}label span:hover:before{border-color:#85889c}\n"]
825
+ styles: ["label input[type=radio].radiobox+span{vertical-align:middle;line-height:20px}input+span,input+span:after,input+span:before{box-sizing:content-box!important;-webkit-box-sizing:content-box!important;-moz-box-sizing:content-box!important}input{visibility:hidden;position:absolute;width:18px;height:18px}label input+span{position:relative;z-index:19;display:inline-block;margin:0 5px 0 0;line-height:17px;min-height:14px;min-width:14px}label input+span:hover{cursor:pointer}label input+span:before{content:\"\";font-size:14px;border-radius:0;display:inline-block;text-align:center;vertical-align:middle;padding:1px;height:12px;line-height:13px;width:12px;margin-right:5px;border:1px solid #C3C4CE;background-color:#fff;font-weight:normal;margin-top:-1px}label input+span:before{border-radius:50%;-moz-border-radius:50%;-webkit-border-radius:50%}label input:checked+span:before,label:hover input:checked+span:before{background:white;border-color:#579bf2;color:#579bf2}label input:checked+span:before,label:hover input:checked+span:before{font-family:\"DataRails\"!important;background-image: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\"><circle cx=\"5\" cy=\"5\" r=\"4.5\" fill=\"%23579BF2\"/></svg> ');background-repeat:no-repeat;background-position:center;color:#579bf2}label input:disabled+span:before{border-color:#bcbcbc}label input[disabled]:checked+span:before{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\"><circle cx=\"5\" cy=\"5\" r=\"4.5\" fill=\"%23BCBCBC\"/></svg> ');border-color:#bcbcbc}label span:hover:before{border-color:#85889c}\n"]
824
826
  },] }
825
827
  ];
826
828
  RadioButtonComponent.ctorParameters = () => [
@@ -891,7 +893,7 @@ class DrInputComponent {
891
893
  this.readonly = false;
892
894
  this.clearable = false;
893
895
  this.blur = new EventEmitter();
894
- this.value = null;
896
+ this.innerValue = null;
895
897
  this._disabled = null;
896
898
  this._elementClass = [];
897
899
  this._buttonOptions = {
@@ -904,6 +906,8 @@ class DrInputComponent {
904
906
  this.searchHandler = new EventEmitter();
905
907
  this.buttonHandler = new EventEmitter();
906
908
  this.tabindex = -1;
909
+ this.onChangeCallback = noop$1;
910
+ this.onTouchedCallback = noop$1;
907
911
  this.onChange = () => { };
908
912
  this.onTouched = () => { };
909
913
  }
@@ -939,6 +943,16 @@ class DrInputComponent {
939
943
  set(val) {
940
944
  this._elementClass = val.split(' ');
941
945
  }
946
+ get value() {
947
+ return this.innerValue;
948
+ }
949
+ set value(v) {
950
+ if (v !== this.innerValue) {
951
+ this.innerValue = v;
952
+ this.onChangeCallback(v);
953
+ }
954
+ this.cdr.markForCheck();
955
+ }
942
956
  ngAfterViewInit() {
943
957
  if (this.clearable) {
944
958
  this._elementClass.push('clearable');
@@ -954,15 +968,17 @@ class DrInputComponent {
954
968
  }
955
969
  }
956
970
  registerOnChange(fn) {
957
- this.onChange = fn;
971
+ this.onChangeCallback = fn;
958
972
  }
959
973
  registerOnTouched(fn) {
960
- this.onTouched = fn;
974
+ this.onTouchedCallback = fn;
961
975
  }
962
976
  writeValue(value) {
963
- this.value = value;
964
- this.updateChanges();
965
- this.cdr.markForCheck();
977
+ if (value !== this.innerValue) {
978
+ this.innerValue = value;
979
+ this.updateChanges();
980
+ this.cdr.markForCheck();
981
+ }
966
982
  }
967
983
  updateChanges() {
968
984
  this.onChange(this.value);
@@ -1494,14 +1510,16 @@ class DrButtonComponent {
1494
1510
  this.click = new EventEmitter();
1495
1511
  }
1496
1512
  onClick($event) {
1513
+ $event.preventDefault();
1514
+ $event.stopPropagation();
1497
1515
  this.click.emit($event);
1498
1516
  }
1499
1517
  }
1500
1518
  DrButtonComponent.decorators = [
1501
1519
  { type: Component, args: [{
1502
1520
  selector: 'dr-button',
1503
- template: "<button (click)=\"onClick($event)\" [attr.disabled]=\"disabled\" [attr.is-loading]=\"isLoading\" [attr.bold]=\"isBold\"\r\n [attr.icon]=\"icon ? true : false\" [attr.theme]=\"theme\">\r\n <ng-container *ngIf=\"!isLoading\">\r\n <i *ngIf=\"icon\" class=\"dr\" [ngClass]=\"icon\"></i>\r\n <ng-content></ng-content>\r\n </ng-container>\r\n <i *ngIf=\"isLoading\" class=\"dr dr-spinner\"></i>\r\n</button>",
1504
- styles: [":host{display:inline-block}:host button[theme]{cursor:pointer;border-radius:16px;padding:5px 16px;font-family:\"Poppins\";font-style:normal;font-weight:400;font-size:14px;line-height:22px;color:#4e566c;border:1px solid #7F7FDD;display:flex;justify-content:space-between;align-items:center;height:32px}:host button[theme] .dr{padding:0;margin-left:5.35px;margin-right:8.64px}:host button[theme] .dr-spinner{animation-name:rotate;animation-iteration-count:infinite;animation-duration:1s}@keyframes rotate{0%{transform:rotate()}to{transform:rotate(360deg)}}:host button[theme][theme~=secondary]{padding:5px 16px;background:#FFFFFF;border-radius:16px;min-width:90px}:host button[theme][theme~=secondary]:hover:not([disabled=\"true\"]){color:#4e566c;transition:.2ms ease-in all;background:#F2F2FB;box-shadow:0 4px 14px #0000001a;border:1px solid #4646CE;border-radius:16px}:host button[theme][theme~=secondary]:active{box-shadow:none;background:#F2F2FB}:host button[theme][theme~=secondary][disabled=true]{background:#F0F1F4;color:#727583;border:none}:host button[theme][theme~=secondary][is-loading=true]{justify-content:center;padding:5px 16px}:host button[theme][theme~=primary]{background:#4646CE;color:#fff;border:none;min-width:90px}:host button[theme][theme~=primary]:hover:not([disabled=\"true\"]){transition:.2ms ease-in all;background:linear-gradient(96.89deg,#25258C 0%,#4646CE 100%);box-shadow:0 4px 14px #0000001a;border-radius:16px;border:none}:host button[theme][theme~=primary]:hover[disabled=false]{border:none}:host button[theme][theme~=primary]:active{background:#25258C}:host button[theme][theme~=primary][disabled=true]{background:#F0F1F4;color:#727583;border:none}:host button[theme][theme~=primary][is-loading=true]{justify-content:center;padding:5px 16px}:host button[theme][theme~=ghost]{background:none;border:none;color:#151b3f;padding:4px 8px}:host button[theme][theme~=ghost] .dr{margin-left:4.5px;margin-right:12.5px}:host button[theme][theme~=ghost]:hover:not([disabled=\"true\"]){color:#4646ce;background:#F2F2FB;border-radius:4px}:host button[theme][theme~=ghost][disabled=true]{color:#727583}:host button[theme][theme~=text-link]{background:none;border:none;color:#0b5af9;text-decoration:underline}:host button[theme][theme~=text-link][disabled=true]{color:#727583}:host button[theme][theme~=primary-icon]{padding:8px;width:28px;height:28px;justify-content:center;color:#fff;background:#4646CE;border:none}:host button[theme][theme~=primary-icon]:hover,:host button[theme][theme~=primary-icon]:active{background:linear-gradient(96.89deg,#131318 0%,#4646CE 100%)}:host button[theme][theme~=primary-icon][disabled=true]{color:#bcbcbc;background:#E5E6EA}:host button[theme][theme~=primary-icon] .dr{margin:0}:host button[theme][theme~=secondary-icon]{background:white;padding:8px;width:28px;height:28px;justify-content:center;color:#4e566c;border:1px solid #7F7FDD}:host button[theme][theme~=secondary-icon]:hover,:host button[theme][theme~=secondary-icon]:active{color:#4646ce;background:#F2F2FB}:host button[theme][theme~=secondary-icon][disabled=true]{color:#bcbcbc;background:#E5E6EA;border:none}:host button[theme][theme~=secondary-icon] .dr{margin:0}:host button[theme][theme~=icon]{background:none;padding:8px;width:28px;height:28px;justify-content:center;color:#4e566c;border:none}:host button[theme][theme~=icon]:hover,:host button[theme][theme~=icon]:active{background:#F0F3FC;color:#4646ce}:host button[theme][theme~=icon][disabled=true]{color:#bcbcbc;border:none}:host button[theme][theme~=icon][disabled=true]:hover,:host button[theme][theme~=icon][disabled=true]:active{background:none}:host button[theme][theme~=icon] .dr{margin:0}:host button[theme][bold=true]{font-weight:600}:host button[theme][icon=true]{padding-left:8px}:host button[theme][icon=false]{justify-content:center}\n"]
1521
+ template: "<button (click)=\"onClick($event)\" [disabled]=\"disabled\" [attr.is-loading]=\"isLoading\" [attr.bold]=\"isBold\"\r\n [attr.icon]=\"icon ? true : false\" [attr.theme]=\"theme\">\r\n <ng-container *ngIf=\"!isLoading\">\r\n <i *ngIf=\"icon\" class=\"dr\" [ngClass]=\"icon\" [style.color]=\"iconColor || 'inherit'\"></i>\r\n <ng-content></ng-content>\r\n </ng-container>\r\n <i *ngIf=\"isLoading\" class=\"dr dr-spinner\"></i>\r\n</button>",
1522
+ styles: [":host{display:inline-block}:host button[theme]{cursor:pointer;border-radius:16px;padding:5px 16px;font-family:\"Poppins\";font-style:normal;font-weight:400;font-size:14px;line-height:22px;color:#4e566c;border:1px solid #7F7FDD;display:flex;justify-content:space-between;align-items:center;height:32px}:host button[theme] .dr{padding:0;margin-left:5.35px;margin-right:8.64px}:host button[theme] .dr-spinner{animation-name:rotate;animation-iteration-count:infinite;animation-duration:1s}@keyframes rotate{0%{transform:rotate()}to{transform:rotate(360deg)}}:host button[theme][theme~=secondary]{padding:5px 16px;background:#FFFFFF;border-radius:16px;min-width:90px}:host button[theme][theme~=secondary]:hover:not([disabled=\"true\"]){color:#4e566c;transition:.2ms ease-in all;background:#F2F2FB;box-shadow:0 4px 14px #0000001a;border:1px solid #4646CE;border-radius:16px}:host button[theme][theme~=secondary]:active{box-shadow:none;background:#F2F2FB}:host button[theme][theme~=secondary][disabled=true]{background:#F0F1F4;color:#727583;border:none}:host button[theme][theme~=secondary][is-loading=true]{justify-content:center;padding:5px 16px}:host button[theme][theme~=primary]{background:#4646CE;color:#fff;border:none;min-width:90px}:host button[theme][theme~=primary]:hover:not([disabled=\"true\"]){transition:.2ms ease-in all;background:linear-gradient(96.89deg,#25258C 0%,#4646CE 100%);box-shadow:0 4px 14px #0000001a;border-radius:16px;border:none}:host button[theme][theme~=primary]:hover[disabled=false]{border:none}:host button[theme][theme~=primary]:active{background:#25258C}:host button[theme][theme~=primary][disabled=true]{background:#F0F1F4;color:#727583;border:none}:host button[theme][theme~=primary][is-loading=true]{justify-content:center;padding:5px 16px}:host button[theme][theme~=danger]{background:#BF1D30;color:#fff;border:none;min-width:90px}:host button[theme][theme~=danger]:hover:not([disabled=\"true\"]){transition:.2ms ease-in all;background:linear-gradient(96.89deg,#740e1a 0%,#BF1D30 100%);box-shadow:0 4px 14px #0000001a;border-radius:16px;border:none}:host button[theme][theme~=danger]:hover[disabled=false]{border:none}:host button[theme][theme~=danger]:active{background:#740e1a}:host button[theme][theme~=danger][disabled=true]{background:#F0F1F4;color:#727583;border:none}:host button[theme][theme~=danger][is-loading=true]{justify-content:center;padding:5px 16px}:host button[theme][theme~=ghost]{background:none;border:none;color:#151b3f;padding:4px 8px}:host button[theme][theme~=ghost] .dr{margin-left:4.5px;margin-right:12.5px}:host button[theme][theme~=ghost]:hover:not([disabled=\"true\"]){color:#4646ce;background:#F2F2FB;border-radius:4px}:host button[theme][theme~=ghost][disabled=true]{color:#727583}:host button[theme][theme~=text-link]{background:none;border:none;color:#0b5af9;text-decoration:underline}:host button[theme][theme~=text-link][disabled=true]{color:#727583}:host button[theme][theme~=primary-icon]{padding:8px;width:28px;height:28px;justify-content:center;color:#fff;background:#4646CE;border:none}:host button[theme][theme~=primary-icon]:hover,:host button[theme][theme~=primary-icon]:active{background:linear-gradient(96.89deg,#131318 0%,#4646CE 100%)}:host button[theme][theme~=primary-icon][disabled=true]{color:#bcbcbc;background:#E5E6EA}:host button[theme][theme~=primary-icon] .dr{margin:0}:host button[theme][theme~=secondary-icon]{background:white;padding:8px;width:28px;height:28px;justify-content:center;color:#4e566c;border:1px solid #7F7FDD}:host button[theme][theme~=secondary-icon]:hover,:host button[theme][theme~=secondary-icon]:active{color:#4646ce;background:#F2F2FB}:host button[theme][theme~=secondary-icon][disabled=true]{color:#bcbcbc;background:#E5E6EA;border:none}:host button[theme][theme~=secondary-icon] .dr{margin:0}:host button[theme][theme~=icon]{background:none;padding:8px;width:28px;height:28px;justify-content:center;color:#4e566c;border:none}:host button[theme][theme~=icon]:hover,:host button[theme][theme~=icon]:active{background:#F0F3FC;color:#4646ce}:host button[theme][theme~=icon][disabled=true]{color:#bcbcbc;border:none}:host button[theme][theme~=icon][disabled=true]:hover,:host button[theme][theme~=icon][disabled=true]:active{background:none}:host button[theme][theme~=icon] .dr{margin:0}:host button[theme][bold=true]{font-weight:600}:host button[theme][icon=true]{padding-left:8px}:host button[theme][icon=false]{justify-content:center}\n"]
1505
1523
  },] }
1506
1524
  ];
1507
1525
  DrButtonComponent.ctorParameters = () => [];
@@ -1512,6 +1530,7 @@ DrButtonComponent.propDecorators = {
1512
1530
  icon: [{ type: Input }],
1513
1531
  isBold: [{ type: Input }],
1514
1532
  isLoading: [{ type: Input }],
1533
+ iconColor: [{ type: Input }],
1515
1534
  click: [{ type: Output }]
1516
1535
  };
1517
1536
  // Examples:
@@ -1519,6 +1538,7 @@ DrButtonComponent.propDecorators = {
1519
1538
  <dr-button [icon]="'dr-icon-arrow-down'">hello</dr-button>
1520
1539
  <dr-button [icon]="'dr-icon-refresh'" [theme]="'primary-icon'"></dr-button>
1521
1540
  <dr-button [icon]="'dr-icon-refresh'" [isDisabled]="true" [theme]="'primary-icon'"></dr-button>
1541
+ <dr-button [theme]="'secondary'" [icon]="'dr-icon-excel'" [iconColor]="'#03A678'"></dr-button>
1522
1542
 
1523
1543
  <dr-button [icon]="'dr-icon-refresh'" [theme]="'secondary-icon'"></dr-button>
1524
1544
  <dr-button [icon]="'dr-icon-share'" [isDisabled]="true" [theme]="'secondary-icon'"></dr-button>
@@ -1731,7 +1751,12 @@ class DrPopoverRef {
1731
1751
  constructor(overlayRef) {
1732
1752
  this.overlayRef = overlayRef;
1733
1753
  this.onClose$ = new Subject();
1754
+ // FIXME: this decision was made because of the incompatible rxjs version
1755
+ /**
1756
+ * Correct type is @type {Observable<any>}
1757
+ */
1734
1758
  this.onClose = this.onClose$.asObservable();
1759
+ this.onBackdropClick = this.overlayRef.backdropClick();
1735
1760
  }
1736
1761
  close(res) {
1737
1762
  this.overlayRef.detach();
@@ -1751,30 +1776,30 @@ class DrPopoverComponent {
1751
1776
  this.class = '';
1752
1777
  this.isContentTemplate = false;
1753
1778
  }
1754
- set popoverContainer(template) {
1755
- this.isContentTemplate = this.content instanceof TemplateRef;
1756
- if (!this.isContentTemplate) {
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);
1760
- }
1761
- else {
1762
- this.contentContext.closePopover = this.popoverRef.close.bind(this.popoverRef);
1763
- }
1764
- this.cdr.detectChanges();
1765
- }
1766
1779
  clickOutside(e) {
1767
- const isTargetHost = this.hostRef.nativeElement === e.target || this.hostRef.nativeElement.contains(e.target);
1780
+ const isTargetHost = this.hostRef instanceof ElementRef && (this.hostRef.nativeElement === e.target || this.hostRef.nativeElement.contains(e.target));
1768
1781
  const isTargetInPopover = this.elementRef.nativeElement.contains(e.target);
1769
1782
  const isTargetInDatepicker = e.target.closest('mat-datepicker-popup');
1770
1783
  const isTargetInSelect = e.target.closest('ng-dropdown-panel');
1784
+ const isTargetInDatepickerContent = e.target.closest('mat-datepicker-content');
1771
1785
  if (!isTargetHost
1772
1786
  && !isTargetInPopover
1773
1787
  && !isTargetInDatepicker
1774
- && !isTargetInSelect) {
1788
+ && !isTargetInSelect
1789
+ && !isTargetInDatepickerContent
1790
+ && !this.manualClosing) {
1775
1791
  this.popoverRef.close();
1776
1792
  }
1777
1793
  }
1794
+ ngOnInit() {
1795
+ this.isContentTemplate = this.content instanceof TemplateRef;
1796
+ if (!this.isContentTemplate) {
1797
+ this.componentRef = this.viewContainerRef.createComponent(this.componentFactoryResolver.resolveComponentFactory(this.content));
1798
+ Object.assign(this.componentRef.instance, this.contentContext);
1799
+ this.popoverContainer.nativeElement.appendChild(this.componentRef.location.nativeElement);
1800
+ }
1801
+ this.cdr.detectChanges();
1802
+ }
1778
1803
  }
1779
1804
  DrPopoverComponent.decorators = [
1780
1805
  { type: Component, args: [{
@@ -1783,7 +1808,8 @@ DrPopoverComponent.decorators = [
1783
1808
  animations: [
1784
1809
  trigger('popover', POPUP_ANIMATION),
1785
1810
  ],
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"]
1811
+ changeDetection: ChangeDetectionStrategy.OnPush,
1812
+ 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}::ng-deep .dr-popover-transparent-backdrop{background-color:transparent}\n"]
1787
1813
  },] }
1788
1814
  ];
1789
1815
  DrPopoverComponent.ctorParameters = () => [
@@ -1798,16 +1824,94 @@ DrPopoverComponent.propDecorators = {
1798
1824
  contentContext: [{ type: Input }],
1799
1825
  class: [{ type: Input }],
1800
1826
  hostRef: [{ type: Input }],
1801
- popoverContainer: [{ type: ViewChild, args: ['popoverContainer', { read: ElementRef },] }],
1827
+ manualClosing: [{ type: Input }],
1828
+ popoverContainer: [{ type: ViewChild, args: ['popoverContainer', { read: ElementRef, static: true },] }],
1802
1829
  clickOutside: [{ type: HostListener, args: ['document:mouseup', ['$event'],] }]
1803
1830
  };
1804
1831
 
1805
- class DrPopoverDirective {
1806
- constructor(overlay, overlayPositionBuilder, elementRef, injector) {
1832
+ const DEFAULT_CONFIG = {
1833
+ hasBackdrop: false,
1834
+ closeOnBackdropClick: false,
1835
+ backdropClass: 'dr-popover-transparent-backdrop',
1836
+ };
1837
+ const DEFAULT_MODEL = {
1838
+ position: 'bottom',
1839
+ class: '',
1840
+ overlayConfig: {},
1841
+ manualClosing: false,
1842
+ };
1843
+
1844
+ class DrPopoverService {
1845
+ constructor(overlay, overlayPositionBuilder, injector) {
1807
1846
  this.overlay = overlay;
1808
1847
  this.overlayPositionBuilder = overlayPositionBuilder;
1809
- this.elementRef = elementRef;
1810
1848
  this.injector = injector;
1849
+ }
1850
+ open(content, popoverModel) {
1851
+ if (!content)
1852
+ return;
1853
+ const model = Object.assign(Object.assign({}, DEFAULT_MODEL), popoverModel);
1854
+ const overlayRef = this.createOverlay(model);
1855
+ const popoverRef = new DrPopoverRef(overlayRef);
1856
+ this.attachOverlayContainer(content, model, overlayRef, popoverRef);
1857
+ this.registerCloseListeners(model, overlayRef, popoverRef);
1858
+ return popoverRef;
1859
+ }
1860
+ attachOverlayContainer(content, { contentContext, position, class: elementClass, manualClosing, hostRef }, overlayRef, popoverRef) {
1861
+ const componentPortal = new ComponentPortal(DrPopoverComponent, null, this.createInjector(popoverRef));
1862
+ const contentRef = overlayRef.attach(componentPortal);
1863
+ popoverRef.componentRef = contentRef;
1864
+ contentRef.instance.content = content;
1865
+ contentRef.instance.contentContext = Object.assign(Object.assign({}, contentContext), { closePopover: popoverRef.close.bind(popoverRef) });
1866
+ contentRef.instance.class = elementClass + ' ' + position;
1867
+ contentRef.instance.manualClosing = manualClosing;
1868
+ contentRef.instance.hostRef = hostRef;
1869
+ }
1870
+ createOverlay(popoverModel) {
1871
+ const overlayConfig = this.getOverlayConfig(popoverModel);
1872
+ return this.overlay.create(overlayConfig);
1873
+ }
1874
+ getOverlayConfig(popoverModel) {
1875
+ const config = Object.assign(Object.assign({}, DEFAULT_CONFIG), popoverModel.overlayConfig || {});
1876
+ const positionStrategy = this.overlayPositionBuilder
1877
+ .flexibleConnectedTo(popoverModel.hostRef)
1878
+ .withPositions([POPUP_POSITIONS[popoverModel.position]]);
1879
+ const overlayConfig = new OverlayConfig(Object.assign({ scrollStrategy: this.overlay.scrollStrategies.noop(), positionStrategy }, config));
1880
+ return overlayConfig;
1881
+ }
1882
+ createInjector(popoverRef) {
1883
+ const injectionTokens = [
1884
+ { provide: DrPopoverRef, useValue: popoverRef },
1885
+ ];
1886
+ return Injector.create({ providers: injectionTokens, parent: this.injector });
1887
+ }
1888
+ registerCloseListeners(popoverModel, overlayRef, popoverRef) {
1889
+ const config = popoverModel.overlayConfig || {};
1890
+ const targetElement = popoverModel.targetElement;
1891
+ if ((config === null || config === void 0 ? void 0 : config.closeOnBackdropClick) && (config === null || config === void 0 ? void 0 : config.hasBackdrop)) {
1892
+ overlayRef.backdropClick().subscribe(() => popoverRef.close());
1893
+ }
1894
+ if (targetElement) {
1895
+ targetElement.addEventListener('mouseup', () => popoverRef.close(), { once: true });
1896
+ }
1897
+ }
1898
+ }
1899
+ DrPopoverService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DrPopoverService_Factory() { return new DrPopoverService(i0.ɵɵinject(i1.Overlay), i0.ɵɵinject(i1.OverlayPositionBuilder), i0.ɵɵinject(i0.INJECTOR)); }, token: DrPopoverService, providedIn: "root" });
1900
+ DrPopoverService.decorators = [
1901
+ { type: Injectable, args: [{
1902
+ providedIn: 'root',
1903
+ },] }
1904
+ ];
1905
+ DrPopoverService.ctorParameters = () => [
1906
+ { type: Overlay },
1907
+ { type: OverlayPositionBuilder },
1908
+ { type: Injector }
1909
+ ];
1910
+
1911
+ class DrPopoverDirective {
1912
+ constructor(elementRef, drPopoverService) {
1913
+ this.elementRef = elementRef;
1914
+ this.drPopoverService = drPopoverService;
1811
1915
  this.contentContext = {};
1812
1916
  this.position = 'bottom';
1813
1917
  this.class = '';
@@ -1815,77 +1919,38 @@ class DrPopoverDirective {
1815
1919
  this.popoverClose = new EventEmitter();
1816
1920
  this.showStateChange = new EventEmitter();
1817
1921
  }
1818
- show() {
1819
- var _a;
1820
- if (this.overlayRef) {
1821
- this.destroyPopover();
1922
+ togglePopover() {
1923
+ if (this.popoverRef) {
1924
+ this.closePopover();
1822
1925
  }
1823
1926
  else {
1824
1927
  this.renderPopover();
1825
- this.showStateChange.emit({ isShown: (_a = this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached() });
1928
+ this.showStateChange.emit({ isShown: !!this.popoverRef });
1826
1929
  }
1827
1930
  }
1828
- renderPopover() {
1829
- var _a;
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();
1841
- }
1842
- destroyPopover() {
1843
- if (this.overlayRef) {
1844
- this.overlayRef.dispose();
1845
- this.overlayRef = null;
1846
- }
1847
- if (this.contentRef) {
1848
- this.contentRef.destroy();
1849
- this.contentRef = null;
1850
- }
1851
- if (this.drPopoverRef) {
1852
- this.drPopoverRef.close();
1853
- this.drPopoverRef = null;
1931
+ closePopover(res) {
1932
+ if (this.popoverRef) {
1933
+ this.popoverRef.close(res);
1934
+ this.popoverRef = null;
1854
1935
  }
1855
1936
  }
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,
1937
+ renderPopover() {
1938
+ const popoverRef = this.popoverRef = this.drPopoverService.open(this.content, {
1939
+ hostRef: this.elementRef,
1940
+ overlayConfig: this.overlayConfig,
1941
+ class: this.class,
1942
+ manualClosing: this.manualClosing,
1943
+ position: this.position,
1944
+ contentContext: this.contentContext,
1945
+ });
1946
+ popoverRef.onClose.pipe(first()).subscribe((res) => {
1947
+ this.closePopover();
1948
+ this.popoverClose.emit(res);
1949
+ this.showStateChange.emit({ isShown: !!this.popoverRef });
1878
1950
  });
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 });
1886
1951
  }
1887
1952
  ngOnDestroy() {
1888
- this.destroyPopover();
1953
+ this.closePopover();
1889
1954
  }
1890
1955
  }
1891
1956
  DrPopoverDirective.decorators = [
@@ -1894,10 +1959,8 @@ DrPopoverDirective.decorators = [
1894
1959
  },] }
1895
1960
  ];
1896
1961
  DrPopoverDirective.ctorParameters = () => [
1897
- { type: Overlay },
1898
- { type: OverlayPositionBuilder },
1899
1962
  { type: ElementRef },
1900
- { type: Injector }
1963
+ { type: DrPopoverService }
1901
1964
  ];
1902
1965
  DrPopoverDirective.propDecorators = {
1903
1966
  content: [{ type: Input, args: ['drPopover',] }],
@@ -1905,9 +1968,10 @@ DrPopoverDirective.propDecorators = {
1905
1968
  position: [{ type: Input, args: ['drPopoverPosition',] }],
1906
1969
  class: [{ type: Input, args: ['drPopoverClass',] }],
1907
1970
  overlayConfig: [{ type: Input, args: ['drPopoverOverlayConfig',] }],
1971
+ manualClosing: [{ type: Input, args: ['drPopoverManualClosing',] }],
1908
1972
  popoverClose: [{ type: Output, args: ['drPopoverClose',] }],
1909
1973
  showStateChange: [{ type: Output, args: ['drPopoverShowStateChange',] }],
1910
- show: [{ type: HostListener, args: ['click',] }]
1974
+ togglePopover: [{ type: HostListener, args: ['click',] }]
1911
1975
  };
1912
1976
 
1913
1977
  class DrDropdownService {
@@ -2180,6 +2244,53 @@ DrDropdownItemShowPipe.decorators = [
2180
2244
  },] }
2181
2245
  ];
2182
2246
 
2247
+ class DrTabComponent {
2248
+ constructor() { }
2249
+ ngOnInit() {
2250
+ }
2251
+ }
2252
+ DrTabComponent.decorators = [
2253
+ { type: Component, args: [{
2254
+ selector: 'dr-tab',
2255
+ template: `
2256
+ <ng-template>
2257
+ <ng-content></ng-content>
2258
+ </ng-template>
2259
+ `
2260
+ },] }
2261
+ ];
2262
+ DrTabComponent.ctorParameters = () => [];
2263
+ DrTabComponent.propDecorators = {
2264
+ label: [{ type: Input }],
2265
+ disabled: [{ type: Input }],
2266
+ contentTemplate: [{ type: ViewChild, args: [TemplateRef,] }]
2267
+ };
2268
+
2269
+ class DrTabsComponent {
2270
+ constructor() {
2271
+ this.selectedTab = 0;
2272
+ this.selectedTabChange = new EventEmitter();
2273
+ }
2274
+ selectedIndexChange($event) {
2275
+ this.selectedTab = $event;
2276
+ this.selectedTabChange.emit($event);
2277
+ }
2278
+ }
2279
+ DrTabsComponent.decorators = [
2280
+ { type: Component, args: [{
2281
+ selector: 'dr-tabs',
2282
+ template: "<mat-tab-group disableRipple [selectedIndex]=\"selectedTab\"\r\n (selectedIndexChange)=\"selectedIndexChange($event)\"\r\n [class.with-radio]=\"withRadio\">\r\n <mat-tab *ngFor=\"let tab of tabsContentList; let index = index\" label=\"{{tab.label}}\" [disabled]=\"tab.disabled\" >\r\n <ng-container *ngIf=\"withRadio\">\r\n <ng-template mat-tab-label>\r\n <dr-radio-button [value]=\"index\"\r\n [(ngModel)]=\"selectedTab\">\r\n </dr-radio-button>\r\n {{tab.label}}\r\n </ng-template>\r\n </ng-container>\r\n\r\n <ng-container *ngTemplateOutlet=\"tab.contentTemplate\" ></ng-container>\r\n </mat-tab>\r\n</mat-tab-group>\r\n",
2283
+ styles: [":host{width:100%}:host ::ng-deep .mat-tab-group,:host ::ng-deep .mat-tab-body-wrapper{height:100%}:host ::ng-deep .mat-tab-nav-bar,:host ::ng-deep .mat-tab-header{border-bottom:1px solid #D5DAE5}:host ::ng-deep .mat-tab-labels{padding:0 17px}:host ::ng-deep .mat-tab-label{padding:0 8px;min-width:0;height:38px;opacity:1}:host ::ng-deep .mat-tab-label:not(:last-child){margin-right:21px}:host ::ng-deep .mat-tab-label-active .mat-tab-label-content{color:#579bf2;font-weight:700}:host ::ng-deep .mat-tab-label-content{font-weight:400;font-size:14px;line-height:22px;color:#51566f;font-family:\"Nunito Sans\",sans-serif}:host ::ng-deep .mat-ink-bar{height:3px;border-radius:5px;background-color:#579bf2!important}:host ::ng-deep .with-radio .mat-tab-labels{padding:0;margin-bottom:8px}:host ::ng-deep .with-radio .mat-tab-label{padding:8px 16px;min-width:0;flex-grow:1;justify-content:start;height:38px;opacity:1}:host ::ng-deep .with-radio .mat-tab-label:not(:last-child){margin-right:8px}:host ::ng-deep .with-radio .mat-tab-label-active{background:#F6F7F8;border-radius:3px}:host ::ng-deep .with-radio .mat-tab-label-active .mat-tab-label-content{color:#0c142b;font-weight:600}:host ::ng-deep .with-radio .mat-ink-bar{display:none!important}\n"]
2284
+ },] }
2285
+ ];
2286
+ DrTabsComponent.ctorParameters = () => [];
2287
+ DrTabsComponent.propDecorators = {
2288
+ selectedTab: [{ type: Input }],
2289
+ withRadio: [{ type: Input }],
2290
+ selectedTabChange: [{ type: Output }],
2291
+ tabsContentList: [{ type: ContentChildren, args: [DrTabComponent,] }]
2292
+ };
2293
+
2183
2294
  const components$2 = [DateTagComponent,
2184
2295
  DayTagComponent,
2185
2296
  WeekTagComponent,
@@ -2366,11 +2477,34 @@ DrDropdownModule.decorators = [
2366
2477
  },] }
2367
2478
  ];
2368
2479
 
2480
+ class DrTabsModule {
2481
+ }
2482
+ DrTabsModule.decorators = [
2483
+ { type: NgModule, args: [{
2484
+ imports: [
2485
+ CommonModule,
2486
+ MatTabsModule,
2487
+ FormsModule,
2488
+ ReactiveFormsModule,
2489
+ DrInputsModule
2490
+ ],
2491
+ exports: [
2492
+ DrTabsComponent,
2493
+ DrTabComponent
2494
+ ],
2495
+ providers: [],
2496
+ declarations: [
2497
+ DrTabsComponent,
2498
+ DrTabComponent
2499
+ ],
2500
+ },] }
2501
+ ];
2502
+
2369
2503
  /* components */
2370
2504
 
2371
2505
  /**
2372
2506
  * Generated bundle index. Do not edit.
2373
2507
  */
2374
2508
 
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 };
2509
+ export { AnyTagComponent, CheckboxComponent, DateTagComponent, DateTagModule, DayTagComponent, DrAvatarComponent, DrAvatarModule, DrButtonComponent, DrDatePickerComponent, DrDatePickerFormatDirective, DrDropdownComponent, DrDropdownDirective, DrDropdownItemShowPipe, DrDropdownModule, DrDropdownPositionDirective, DrDropdownService, DrInputComponent, DrInputsModule, DrPopoverComponent, DrPopoverDirective, DrPopoverModule, DrPopoverRef, DrPopoverService, DrSelectComponent, DrSpinnerComponent, DrSpinnerDirective, DrSpinnerModule, DrTabComponent, DrTabsComponent, DrTabsModule, 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 };
2376
2510
  //# sourceMappingURL=datarailsshared-datarailsshared.js.map