@datarailsshared/datarailsshared 1.3.11 → 1.3.12
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.
- package/bundles/datarailsshared-datarailsshared.umd.js +164 -99
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.3.12.tgz +0 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/lib/dr-inputs/button/button.component.js +6 -2
- package/esm2015/lib/dr-inputs/dr-input/dr-input.component.js +22 -7
- package/esm2015/lib/dr-inputs/radio-button/radio-button.component.js +1 -1
- package/esm2015/lib/dr-popover/dr-popover-ref.js +6 -1
- package/esm2015/lib/dr-popover/dr-popover.component.js +17 -14
- package/esm2015/lib/dr-popover/dr-popover.directive.js +29 -77
- package/esm2015/lib/dr-popover/dr-popover.service.js +76 -0
- package/esm2015/lib/models/popover.js +12 -1
- package/esm2015/public-api.js +3 -2
- package/fesm2015/datarailsshared-datarailsshared.js +153 -91
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/dr-inputs/button/button.component.d.ts +1 -0
- package/lib/dr-inputs/dr-input/dr-input.component.d.ts +6 -2
- package/lib/dr-popover/dr-popover-ref.d.ts +5 -1
- package/lib/dr-popover/dr-popover.component.d.ts +6 -4
- package/lib/dr-popover/dr-popover.directive.d.ts +8 -15
- package/lib/dr-popover/dr-popover.service.d.ts +16 -0
- package/lib/models/popover.d.ts +21 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -1
- package/datarailsshared-datarailsshared-1.3.11.tgz +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/material/core'), require('@angular/material-moment-adapter'), require('moment'), require('@angular/animations'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/common'), require('rxjs
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@datarailsshared/datarailsshared', ['exports', '@angular/core', '@angular/forms', '@angular/material/core', '@angular/material-moment-adapter', 'moment', '@angular/animations', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/common', 'rxjs
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.datarailsshared = global.datarailsshared || {}, global.datarailsshared.datarailsshared = {}), global.ng.core, global.ng.forms, global.ng.material.core, global.ng.materialMomentAdapter, global.momentImported, global.ng.animations, global.ng.cdk.overlay, global.ng.cdk.portal, global.ng.common, global.rxjs
|
|
5
|
-
}(this, (function (exports, i0, forms, core, materialMomentAdapter, momentImported, animations,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('@angular/material/core'), require('@angular/material-moment-adapter'), require('moment'), require('rxjs'), require('@angular/animations'), require('@angular/cdk/overlay'), require('@angular/cdk/portal'), require('@angular/common'), require('rxjs/operators'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/button-toggle'), require('@ng-select/ng-select'), require('@angular/material/tooltip'), require('@angular/material/tabs')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@datarailsshared/datarailsshared', ['exports', '@angular/core', '@angular/forms', '@angular/material/core', '@angular/material-moment-adapter', 'moment', 'rxjs', '@angular/animations', '@angular/cdk/overlay', '@angular/cdk/portal', '@angular/common', 'rxjs/operators', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/button-toggle', '@ng-select/ng-select', '@angular/material/tooltip', '@angular/material/tabs'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.datarailsshared = global.datarailsshared || {}, global.datarailsshared.datarailsshared = {}), global.ng.core, global.ng.forms, global.ng.material.core, global.ng.materialMomentAdapter, global.momentImported, global.rxjs, global.ng.animations, global.ng.cdk.overlay, global.ng.cdk.portal, global.ng.common, global.rxjs.operators, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.buttonToggle, global.ngSelect, global.ng.material.tooltip, global.ng.material.tabs));
|
|
5
|
+
}(this, (function (exports, i0, forms, core, materialMomentAdapter, momentImported, rxjs, animations, i1, portal, common, operators, datepicker, formField, input, select, buttonToggle, ngSelect, tooltip, tabs) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
28
28
|
var momentImported__namespace = /*#__PURE__*/_interopNamespace(momentImported);
|
|
29
|
+
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
29
30
|
|
|
30
31
|
// import {*} from ""
|
|
31
32
|
var DateTagComponent = /** @class */ (function () {
|
|
@@ -1203,7 +1204,7 @@
|
|
|
1203
1204
|
],
|
|
1204
1205
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1205
1206
|
encapsulation: i0.ViewEncapsulation.ShadowDom,
|
|
1206
|
-
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;
|
|
1207
|
+
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"]
|
|
1207
1208
|
},] }
|
|
1208
1209
|
];
|
|
1209
1210
|
RadioButtonComponent.ctorParameters = function () { return [
|
|
@@ -1275,7 +1276,7 @@
|
|
|
1275
1276
|
this.readonly = false;
|
|
1276
1277
|
this.clearable = false;
|
|
1277
1278
|
this.blur = new i0.EventEmitter();
|
|
1278
|
-
this.
|
|
1279
|
+
this.innerValue = null;
|
|
1279
1280
|
this._disabled = null;
|
|
1280
1281
|
this._elementClass = [];
|
|
1281
1282
|
this._buttonOptions = {
|
|
@@ -1288,6 +1289,8 @@
|
|
|
1288
1289
|
this.searchHandler = new i0.EventEmitter();
|
|
1289
1290
|
this.buttonHandler = new i0.EventEmitter();
|
|
1290
1291
|
this.tabindex = -1;
|
|
1292
|
+
this.onChangeCallback = rxjs.noop;
|
|
1293
|
+
this.onTouchedCallback = rxjs.noop;
|
|
1291
1294
|
this.onChange = function () { };
|
|
1292
1295
|
this.onTouched = function () { };
|
|
1293
1296
|
}
|
|
@@ -1336,6 +1339,20 @@
|
|
|
1336
1339
|
DrInputComponent.prototype.set = function (val) {
|
|
1337
1340
|
this._elementClass = val.split(' ');
|
|
1338
1341
|
};
|
|
1342
|
+
Object.defineProperty(DrInputComponent.prototype, "value", {
|
|
1343
|
+
get: function () {
|
|
1344
|
+
return this.innerValue;
|
|
1345
|
+
},
|
|
1346
|
+
set: function (v) {
|
|
1347
|
+
if (v !== this.innerValue) {
|
|
1348
|
+
this.innerValue = v;
|
|
1349
|
+
this.onChangeCallback(v);
|
|
1350
|
+
}
|
|
1351
|
+
this.cdr.markForCheck();
|
|
1352
|
+
},
|
|
1353
|
+
enumerable: false,
|
|
1354
|
+
configurable: true
|
|
1355
|
+
});
|
|
1339
1356
|
DrInputComponent.prototype.ngAfterViewInit = function () {
|
|
1340
1357
|
if (this.clearable) {
|
|
1341
1358
|
this._elementClass.push('clearable');
|
|
@@ -1351,15 +1368,17 @@
|
|
|
1351
1368
|
}
|
|
1352
1369
|
};
|
|
1353
1370
|
DrInputComponent.prototype.registerOnChange = function (fn) {
|
|
1354
|
-
this.
|
|
1371
|
+
this.onChangeCallback = fn;
|
|
1355
1372
|
};
|
|
1356
1373
|
DrInputComponent.prototype.registerOnTouched = function (fn) {
|
|
1357
|
-
this.
|
|
1374
|
+
this.onTouchedCallback = fn;
|
|
1358
1375
|
};
|
|
1359
1376
|
DrInputComponent.prototype.writeValue = function (value) {
|
|
1360
|
-
this.
|
|
1361
|
-
|
|
1362
|
-
|
|
1377
|
+
if (value !== this.innerValue) {
|
|
1378
|
+
this.innerValue = value;
|
|
1379
|
+
this.updateChanges();
|
|
1380
|
+
this.cdr.markForCheck();
|
|
1381
|
+
}
|
|
1363
1382
|
};
|
|
1364
1383
|
DrInputComponent.prototype.updateChanges = function () {
|
|
1365
1384
|
this.onChange(this.value);
|
|
@@ -1755,8 +1774,8 @@
|
|
|
1755
1774
|
},] }
|
|
1756
1775
|
];
|
|
1757
1776
|
DrTooltipDirective.ctorParameters = function () { return [
|
|
1758
|
-
{ type:
|
|
1759
|
-
{ type:
|
|
1777
|
+
{ type: i1.Overlay },
|
|
1778
|
+
{ type: i1.OverlayPositionBuilder },
|
|
1760
1779
|
{ type: i0.ElementRef }
|
|
1761
1780
|
]; };
|
|
1762
1781
|
DrTooltipDirective.propDecorators = {
|
|
@@ -1925,6 +1944,8 @@
|
|
|
1925
1944
|
this.click = new i0.EventEmitter();
|
|
1926
1945
|
}
|
|
1927
1946
|
DrButtonComponent.prototype.onClick = function ($event) {
|
|
1947
|
+
$event.preventDefault();
|
|
1948
|
+
$event.stopPropagation();
|
|
1928
1949
|
this.click.emit($event);
|
|
1929
1950
|
};
|
|
1930
1951
|
return DrButtonComponent;
|
|
@@ -1932,7 +1953,7 @@
|
|
|
1932
1953
|
DrButtonComponent.decorators = [
|
|
1933
1954
|
{ type: i0.Component, args: [{
|
|
1934
1955
|
selector: 'dr-button',
|
|
1935
|
-
template: "<button (click)=\"onClick($event)\" [
|
|
1956
|
+
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>",
|
|
1936
1957
|
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"]
|
|
1937
1958
|
},] }
|
|
1938
1959
|
];
|
|
@@ -1944,6 +1965,7 @@
|
|
|
1944
1965
|
icon: [{ type: i0.Input }],
|
|
1945
1966
|
isBold: [{ type: i0.Input }],
|
|
1946
1967
|
isLoading: [{ type: i0.Input }],
|
|
1968
|
+
iconColor: [{ type: i0.Input }],
|
|
1947
1969
|
click: [{ type: i0.Output }]
|
|
1948
1970
|
};
|
|
1949
1971
|
// Examples:
|
|
@@ -1951,6 +1973,7 @@
|
|
|
1951
1973
|
<dr-button [icon]="'dr-icon-arrow-down'">hello</dr-button>
|
|
1952
1974
|
<dr-button [icon]="'dr-icon-refresh'" [theme]="'primary-icon'"></dr-button>
|
|
1953
1975
|
<dr-button [icon]="'dr-icon-refresh'" [isDisabled]="true" [theme]="'primary-icon'"></dr-button>
|
|
1976
|
+
<dr-button [theme]="'secondary'" [icon]="'dr-icon-excel'" [iconColor]="'#03A678'"></dr-button>
|
|
1954
1977
|
|
|
1955
1978
|
<dr-button [icon]="'dr-icon-refresh'" [theme]="'secondary-icon'"></dr-button>
|
|
1956
1979
|
<dr-button [icon]="'dr-icon-share'" [isDisabled]="true" [theme]="'secondary-icon'"></dr-button>
|
|
@@ -2191,7 +2214,12 @@
|
|
|
2191
2214
|
function DrPopoverRef(overlayRef) {
|
|
2192
2215
|
this.overlayRef = overlayRef;
|
|
2193
2216
|
this.onClose$ = new rxjs.Subject();
|
|
2217
|
+
// FIXME: this decision was made because of the incompatible rxjs version
|
|
2218
|
+
/**
|
|
2219
|
+
* Correct type is @type {Observable<any>}
|
|
2220
|
+
*/
|
|
2194
2221
|
this.onClose = this.onClose$.asObservable();
|
|
2222
|
+
this.onBackdropClick = this.overlayRef.backdropClick();
|
|
2195
2223
|
}
|
|
2196
2224
|
DrPopoverRef.prototype.close = function (res) {
|
|
2197
2225
|
this.overlayRef.detach();
|
|
@@ -2212,32 +2240,30 @@
|
|
|
2212
2240
|
this.class = '';
|
|
2213
2241
|
this.isContentTemplate = false;
|
|
2214
2242
|
}
|
|
2215
|
-
Object.defineProperty(DrPopoverComponent.prototype, "popoverContainer", {
|
|
2216
|
-
set: function (template) {
|
|
2217
|
-
this.isContentTemplate = this.content instanceof i0.TemplateRef;
|
|
2218
|
-
if (!this.isContentTemplate) {
|
|
2219
|
-
this.componentRef = this.viewContainerRef.createComponent(this.componentFactoryResolver.resolveComponentFactory(this.content));
|
|
2220
|
-
Object.assign(this.componentRef.instance, this.contentContext);
|
|
2221
|
-
template.nativeElement.appendChild(this.componentRef.location.nativeElement);
|
|
2222
|
-
}
|
|
2223
|
-
this.cdr.detectChanges();
|
|
2224
|
-
},
|
|
2225
|
-
enumerable: false,
|
|
2226
|
-
configurable: true
|
|
2227
|
-
});
|
|
2228
2243
|
DrPopoverComponent.prototype.clickOutside = function (e) {
|
|
2229
|
-
var isTargetHost = this.hostRef.nativeElement === e.target || this.hostRef.nativeElement.contains(e.target);
|
|
2244
|
+
var isTargetHost = this.hostRef instanceof i0.ElementRef && (this.hostRef.nativeElement === e.target || this.hostRef.nativeElement.contains(e.target));
|
|
2230
2245
|
var isTargetInPopover = this.elementRef.nativeElement.contains(e.target);
|
|
2231
2246
|
var isTargetInDatepicker = e.target.closest('mat-datepicker-popup');
|
|
2232
2247
|
var isTargetInSelect = e.target.closest('ng-dropdown-panel');
|
|
2248
|
+
var isTargetInDatepickerContent = e.target.closest('mat-datepicker-content');
|
|
2233
2249
|
if (!isTargetHost
|
|
2234
2250
|
&& !isTargetInPopover
|
|
2235
2251
|
&& !isTargetInDatepicker
|
|
2236
2252
|
&& !isTargetInSelect
|
|
2253
|
+
&& !isTargetInDatepickerContent
|
|
2237
2254
|
&& !this.manualClosing) {
|
|
2238
2255
|
this.popoverRef.close();
|
|
2239
2256
|
}
|
|
2240
2257
|
};
|
|
2258
|
+
DrPopoverComponent.prototype.ngOnInit = function () {
|
|
2259
|
+
this.isContentTemplate = this.content instanceof i0.TemplateRef;
|
|
2260
|
+
if (!this.isContentTemplate) {
|
|
2261
|
+
this.componentRef = this.viewContainerRef.createComponent(this.componentFactoryResolver.resolveComponentFactory(this.content));
|
|
2262
|
+
Object.assign(this.componentRef.instance, this.contentContext);
|
|
2263
|
+
this.popoverContainer.nativeElement.appendChild(this.componentRef.location.nativeElement);
|
|
2264
|
+
}
|
|
2265
|
+
this.cdr.detectChanges();
|
|
2266
|
+
};
|
|
2241
2267
|
return DrPopoverComponent;
|
|
2242
2268
|
}());
|
|
2243
2269
|
DrPopoverComponent.decorators = [
|
|
@@ -2247,7 +2273,8 @@
|
|
|
2247
2273
|
animations: [
|
|
2248
2274
|
animations.trigger('popover', POPUP_ANIMATION),
|
|
2249
2275
|
],
|
|
2250
|
-
|
|
2276
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
2277
|
+
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"]
|
|
2251
2278
|
},] }
|
|
2252
2279
|
];
|
|
2253
2280
|
DrPopoverComponent.ctorParameters = function () { return [
|
|
@@ -2263,16 +2290,95 @@
|
|
|
2263
2290
|
class: [{ type: i0.Input }],
|
|
2264
2291
|
hostRef: [{ type: i0.Input }],
|
|
2265
2292
|
manualClosing: [{ type: i0.Input }],
|
|
2266
|
-
popoverContainer: [{ type: i0.ViewChild, args: ['popoverContainer', { read: i0.ElementRef },] }],
|
|
2293
|
+
popoverContainer: [{ type: i0.ViewChild, args: ['popoverContainer', { read: i0.ElementRef, static: true },] }],
|
|
2267
2294
|
clickOutside: [{ type: i0.HostListener, args: ['document:mouseup', ['$event'],] }]
|
|
2268
2295
|
};
|
|
2269
2296
|
|
|
2270
|
-
var
|
|
2271
|
-
|
|
2297
|
+
var DEFAULT_CONFIG = {
|
|
2298
|
+
hasBackdrop: false,
|
|
2299
|
+
closeOnBackdropClick: false,
|
|
2300
|
+
backdropClass: 'dr-popover-transparent-backdrop',
|
|
2301
|
+
};
|
|
2302
|
+
var DEFAULT_MODEL = {
|
|
2303
|
+
position: 'bottom',
|
|
2304
|
+
class: '',
|
|
2305
|
+
overlayConfig: {},
|
|
2306
|
+
manualClosing: false,
|
|
2307
|
+
};
|
|
2308
|
+
|
|
2309
|
+
var DrPopoverService = /** @class */ (function () {
|
|
2310
|
+
function DrPopoverService(overlay, overlayPositionBuilder, injector) {
|
|
2272
2311
|
this.overlay = overlay;
|
|
2273
2312
|
this.overlayPositionBuilder = overlayPositionBuilder;
|
|
2274
|
-
this.elementRef = elementRef;
|
|
2275
2313
|
this.injector = injector;
|
|
2314
|
+
}
|
|
2315
|
+
DrPopoverService.prototype.open = function (content, popoverModel) {
|
|
2316
|
+
if (!content)
|
|
2317
|
+
return;
|
|
2318
|
+
var model = Object.assign(Object.assign({}, DEFAULT_MODEL), popoverModel);
|
|
2319
|
+
var overlayRef = this.createOverlay(model);
|
|
2320
|
+
var popoverRef = new DrPopoverRef(overlayRef);
|
|
2321
|
+
this.attachOverlayContainer(content, model, overlayRef, popoverRef);
|
|
2322
|
+
this.registerCloseListeners(model, overlayRef, popoverRef);
|
|
2323
|
+
return popoverRef;
|
|
2324
|
+
};
|
|
2325
|
+
DrPopoverService.prototype.attachOverlayContainer = function (content, _a, overlayRef, popoverRef) {
|
|
2326
|
+
var contentContext = _a.contentContext, position = _a.position, elementClass = _a.class, manualClosing = _a.manualClosing, hostRef = _a.hostRef;
|
|
2327
|
+
var componentPortal = new portal.ComponentPortal(DrPopoverComponent, null, this.createInjector(popoverRef));
|
|
2328
|
+
var contentRef = overlayRef.attach(componentPortal);
|
|
2329
|
+
popoverRef.componentRef = contentRef;
|
|
2330
|
+
contentRef.instance.content = content;
|
|
2331
|
+
contentRef.instance.contentContext = Object.assign(Object.assign({}, contentContext), { closePopover: popoverRef.close.bind(popoverRef) });
|
|
2332
|
+
contentRef.instance.class = elementClass + ' ' + position;
|
|
2333
|
+
contentRef.instance.manualClosing = manualClosing;
|
|
2334
|
+
contentRef.instance.hostRef = hostRef;
|
|
2335
|
+
};
|
|
2336
|
+
DrPopoverService.prototype.createOverlay = function (popoverModel) {
|
|
2337
|
+
var overlayConfig = this.getOverlayConfig(popoverModel);
|
|
2338
|
+
return this.overlay.create(overlayConfig);
|
|
2339
|
+
};
|
|
2340
|
+
DrPopoverService.prototype.getOverlayConfig = function (popoverModel) {
|
|
2341
|
+
var config = Object.assign(Object.assign({}, DEFAULT_CONFIG), popoverModel.overlayConfig || {});
|
|
2342
|
+
var positionStrategy = this.overlayPositionBuilder
|
|
2343
|
+
.flexibleConnectedTo(popoverModel.hostRef)
|
|
2344
|
+
.withPositions([POPUP_POSITIONS[popoverModel.position]]);
|
|
2345
|
+
var overlayConfig = new i1.OverlayConfig(Object.assign({ scrollStrategy: this.overlay.scrollStrategies.noop(), positionStrategy: positionStrategy }, config));
|
|
2346
|
+
return overlayConfig;
|
|
2347
|
+
};
|
|
2348
|
+
DrPopoverService.prototype.createInjector = function (popoverRef) {
|
|
2349
|
+
var injectionTokens = [
|
|
2350
|
+
{ provide: DrPopoverRef, useValue: popoverRef },
|
|
2351
|
+
];
|
|
2352
|
+
return i0.Injector.create({ providers: injectionTokens, parent: this.injector });
|
|
2353
|
+
};
|
|
2354
|
+
DrPopoverService.prototype.registerCloseListeners = function (popoverModel, overlayRef, popoverRef) {
|
|
2355
|
+
var config = popoverModel.overlayConfig || {};
|
|
2356
|
+
var targetElement = popoverModel.targetElement;
|
|
2357
|
+
if ((config === null || config === void 0 ? void 0 : config.closeOnBackdropClick) && (config === null || config === void 0 ? void 0 : config.hasBackdrop)) {
|
|
2358
|
+
overlayRef.backdropClick().subscribe(function () { return popoverRef.close(); });
|
|
2359
|
+
}
|
|
2360
|
+
if (targetElement) {
|
|
2361
|
+
targetElement.addEventListener('mouseup', function () { return popoverRef.close(); }, { once: true });
|
|
2362
|
+
}
|
|
2363
|
+
};
|
|
2364
|
+
return DrPopoverService;
|
|
2365
|
+
}());
|
|
2366
|
+
DrPopoverService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function DrPopoverService_Factory() { return new DrPopoverService(i0__namespace.ɵɵinject(i1__namespace.Overlay), i0__namespace.ɵɵinject(i1__namespace.OverlayPositionBuilder), i0__namespace.ɵɵinject(i0__namespace.INJECTOR)); }, token: DrPopoverService, providedIn: "root" });
|
|
2367
|
+
DrPopoverService.decorators = [
|
|
2368
|
+
{ type: i0.Injectable, args: [{
|
|
2369
|
+
providedIn: 'root',
|
|
2370
|
+
},] }
|
|
2371
|
+
];
|
|
2372
|
+
DrPopoverService.ctorParameters = function () { return [
|
|
2373
|
+
{ type: i1.Overlay },
|
|
2374
|
+
{ type: i1.OverlayPositionBuilder },
|
|
2375
|
+
{ type: i0.Injector }
|
|
2376
|
+
]; };
|
|
2377
|
+
|
|
2378
|
+
var DrPopoverDirective = /** @class */ (function () {
|
|
2379
|
+
function DrPopoverDirective(elementRef, drPopoverService) {
|
|
2380
|
+
this.elementRef = elementRef;
|
|
2381
|
+
this.drPopoverService = drPopoverService;
|
|
2276
2382
|
this.contentContext = {};
|
|
2277
2383
|
this.position = 'bottom';
|
|
2278
2384
|
this.class = '';
|
|
@@ -2280,79 +2386,39 @@
|
|
|
2280
2386
|
this.popoverClose = new i0.EventEmitter();
|
|
2281
2387
|
this.showStateChange = new i0.EventEmitter();
|
|
2282
2388
|
}
|
|
2283
|
-
DrPopoverDirective.prototype.
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
this.destroyPopover();
|
|
2389
|
+
DrPopoverDirective.prototype.togglePopover = function () {
|
|
2390
|
+
if (this.popoverRef) {
|
|
2391
|
+
this.closePopover();
|
|
2287
2392
|
}
|
|
2288
2393
|
else {
|
|
2289
2394
|
this.renderPopover();
|
|
2290
|
-
this.showStateChange.emit({ isShown:
|
|
2395
|
+
this.showStateChange.emit({ isShown: !!this.popoverRef });
|
|
2396
|
+
}
|
|
2397
|
+
};
|
|
2398
|
+
DrPopoverDirective.prototype.closePopover = function (res) {
|
|
2399
|
+
if (this.popoverRef) {
|
|
2400
|
+
this.popoverRef.close(res);
|
|
2401
|
+
this.popoverRef = null;
|
|
2291
2402
|
}
|
|
2292
2403
|
};
|
|
2293
2404
|
DrPopoverDirective.prototype.renderPopover = function () {
|
|
2294
2405
|
var _this = this;
|
|
2295
|
-
var
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
_this.destroyPopover();
|
|
2303
|
-
_this.popoverClose.emit(res);
|
|
2304
|
-
_this.showStateChange.emit({ isShown: !!((_a = _this.overlayRef) === null || _a === void 0 ? void 0 : _a.hasAttached()) });
|
|
2406
|
+
var popoverRef = this.popoverRef = this.drPopoverService.open(this.content, {
|
|
2407
|
+
hostRef: this.elementRef,
|
|
2408
|
+
overlayConfig: this.overlayConfig,
|
|
2409
|
+
class: this.class,
|
|
2410
|
+
manualClosing: this.manualClosing,
|
|
2411
|
+
position: this.position,
|
|
2412
|
+
contentContext: this.contentContext,
|
|
2305
2413
|
});
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
this.overlayRef.dispose();
|
|
2311
|
-
this.overlayRef = null;
|
|
2312
|
-
}
|
|
2313
|
-
if (this.contentRef) {
|
|
2314
|
-
this.contentRef.destroy();
|
|
2315
|
-
this.contentRef = null;
|
|
2316
|
-
}
|
|
2317
|
-
if (this.drPopoverRef) {
|
|
2318
|
-
this.drPopoverRef.close();
|
|
2319
|
-
this.drPopoverRef = null;
|
|
2320
|
-
}
|
|
2321
|
-
};
|
|
2322
|
-
DrPopoverDirective.prototype.attachOverlayContainer = function () {
|
|
2323
|
-
var componentPortal = new portal.ComponentPortal(DrPopoverComponent, null, this.createInjector(this.drPopoverRef));
|
|
2324
|
-
this.contentRef = this.overlayRef.attach(componentPortal);
|
|
2325
|
-
this.drPopoverRef.componentRef = this.contentRef;
|
|
2326
|
-
this.contentRef.instance.content = this.content;
|
|
2327
|
-
this.contentRef.instance.contentContext = Object.assign(Object.assign({}, this.contentContext), { closePopover: this.destroyPopover.bind(this) });
|
|
2328
|
-
this.contentRef.instance.class = this.class + ' ' + this.position;
|
|
2329
|
-
this.contentRef.instance.manualClosing = this.manualClosing;
|
|
2330
|
-
this.contentRef.instance.hostRef = this.elementRef;
|
|
2331
|
-
};
|
|
2332
|
-
DrPopoverDirective.prototype.createOverlay = function (config) {
|
|
2333
|
-
var overlayConfig = this.getOverlayConfig(config);
|
|
2334
|
-
return this.overlay.create(overlayConfig);
|
|
2335
|
-
};
|
|
2336
|
-
DrPopoverDirective.prototype.getOverlayConfig = function (config) {
|
|
2337
|
-
var positionStrategy = this.overlayPositionBuilder
|
|
2338
|
-
.flexibleConnectedTo(this.elementRef)
|
|
2339
|
-
.withPositions([POPUP_POSITIONS[this.position]]);
|
|
2340
|
-
var overlayConfig = new overlay.OverlayConfig({
|
|
2341
|
-
hasBackdrop: false,
|
|
2342
|
-
panelClass: config === null || config === void 0 ? void 0 : config.panelClass,
|
|
2343
|
-
scrollStrategy: this.overlay.scrollStrategies.noop(),
|
|
2344
|
-
positionStrategy: positionStrategy,
|
|
2414
|
+
popoverRef.onClose.pipe(operators.first()).subscribe(function (res) {
|
|
2415
|
+
_this.closePopover();
|
|
2416
|
+
_this.popoverClose.emit(res);
|
|
2417
|
+
_this.showStateChange.emit({ isShown: !!_this.popoverRef });
|
|
2345
2418
|
});
|
|
2346
|
-
return overlayConfig;
|
|
2347
|
-
};
|
|
2348
|
-
DrPopoverDirective.prototype.createInjector = function (previewOverlayRef) {
|
|
2349
|
-
var injectionTokens = [
|
|
2350
|
-
{ provide: DrPopoverRef, useValue: previewOverlayRef },
|
|
2351
|
-
];
|
|
2352
|
-
return i0.Injector.create({ providers: injectionTokens, parent: this.injector });
|
|
2353
2419
|
};
|
|
2354
2420
|
DrPopoverDirective.prototype.ngOnDestroy = function () {
|
|
2355
|
-
this.
|
|
2421
|
+
this.closePopover();
|
|
2356
2422
|
};
|
|
2357
2423
|
return DrPopoverDirective;
|
|
2358
2424
|
}());
|
|
@@ -2362,10 +2428,8 @@
|
|
|
2362
2428
|
},] }
|
|
2363
2429
|
];
|
|
2364
2430
|
DrPopoverDirective.ctorParameters = function () { return [
|
|
2365
|
-
{ type: overlay.Overlay },
|
|
2366
|
-
{ type: overlay.OverlayPositionBuilder },
|
|
2367
2431
|
{ type: i0.ElementRef },
|
|
2368
|
-
{ type:
|
|
2432
|
+
{ type: DrPopoverService }
|
|
2369
2433
|
]; };
|
|
2370
2434
|
DrPopoverDirective.propDecorators = {
|
|
2371
2435
|
content: [{ type: i0.Input, args: ['drPopover',] }],
|
|
@@ -2376,7 +2440,7 @@
|
|
|
2376
2440
|
manualClosing: [{ type: i0.Input, args: ['drPopoverManualClosing',] }],
|
|
2377
2441
|
popoverClose: [{ type: i0.Output, args: ['drPopoverClose',] }],
|
|
2378
2442
|
showStateChange: [{ type: i0.Output, args: ['drPopoverShowStateChange',] }],
|
|
2379
|
-
|
|
2443
|
+
togglePopover: [{ type: i0.HostListener, args: ['click',] }]
|
|
2380
2444
|
};
|
|
2381
2445
|
|
|
2382
2446
|
var DrDropdownService = /** @class */ (function () {
|
|
@@ -2977,6 +3041,7 @@
|
|
|
2977
3041
|
exports.DrPopoverDirective = DrPopoverDirective;
|
|
2978
3042
|
exports.DrPopoverModule = DrPopoverModule;
|
|
2979
3043
|
exports.DrPopoverRef = DrPopoverRef;
|
|
3044
|
+
exports.DrPopoverService = DrPopoverService;
|
|
2980
3045
|
exports.DrSelectComponent = DrSelectComponent;
|
|
2981
3046
|
exports.DrSpinnerComponent = DrSpinnerComponent;
|
|
2982
3047
|
exports.DrSpinnerDirective = DrSpinnerDirective;
|