@datarailsshared/datarailsshared 1.4.123 → 1.4.124
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 +39 -1
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.4.124.tgz +0 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/lib/dr-popover/dr-popover.component.js +31 -2
- package/esm2015/lib/dr-popover/dr-popover.directive.js +8 -1
- package/esm2015/lib/dr-popover/dr-popover.service.js +3 -2
- package/esm2015/lib/models/popover.js +1 -1
- package/fesm2015/datarailsshared-datarailsshared.js +38 -1
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/dr-popover/dr-popover.component.d.ts +11 -1
- package/lib/dr-popover/dr-popover.directive.d.ts +2 -0
- package/lib/models/popover.d.ts +1 -0
- package/package.json +1 -1
- package/datarailsshared-datarailsshared-1.4.123.tgz +0 -0
|
@@ -2660,6 +2660,7 @@
|
|
|
2660
2660
|
this.viewContainerRef = viewContainerRef;
|
|
2661
2661
|
this.elementRef = elementRef;
|
|
2662
2662
|
this.popoverRef = popoverRef;
|
|
2663
|
+
this.popoverOpened = new i0.EventEmitter();
|
|
2663
2664
|
this.class = '';
|
|
2664
2665
|
this.isContentTemplate = false;
|
|
2665
2666
|
this.popover = true;
|
|
@@ -2689,8 +2690,35 @@
|
|
|
2689
2690
|
if (this.alignment === 'host') {
|
|
2690
2691
|
this[getAlignmentDimension(this.position)] = '100%';
|
|
2691
2692
|
}
|
|
2693
|
+
this.popoverOpened.emit();
|
|
2694
|
+
this.repositionToNewContainerAndFreeze();
|
|
2692
2695
|
this.cdr.detectChanges();
|
|
2693
2696
|
};
|
|
2697
|
+
/**
|
|
2698
|
+
* Removing popover element from cdk-overlay and attach to provided container after element is positioned
|
|
2699
|
+
* is required for specific case of preserving popover at same position on document while scroll (not fixed)
|
|
2700
|
+
*
|
|
2701
|
+
* TODO: implement more neat, transparent and Angular way solution: i.e. create another service (or extend existiong one)
|
|
2702
|
+
* without attaching component to cdk Overlay and instead positioning it to element passed in directive input parameter
|
|
2703
|
+
*/
|
|
2704
|
+
DrPopoverComponent.prototype.repositionToNewContainerAndFreeze = function () {
|
|
2705
|
+
var _this = this;
|
|
2706
|
+
var newContainer = !!this.freezeToContainerSelector && document.querySelector(this.freezeToContainerSelector);
|
|
2707
|
+
if (newContainer) {
|
|
2708
|
+
// waiting until element is positioned on overlay
|
|
2709
|
+
setTimeout(function () {
|
|
2710
|
+
var element = _this.elementRef.nativeElement;
|
|
2711
|
+
if (!element.closest('.cdk-overlay-container'))
|
|
2712
|
+
return;
|
|
2713
|
+
var position = element.getBoundingClientRect();
|
|
2714
|
+
var newContainerPosition = newContainer.getBoundingClientRect();
|
|
2715
|
+
element.style.position = 'absolute';
|
|
2716
|
+
element.style.top = newContainer.scrollTop + position.top - newContainerPosition.top + "px";
|
|
2717
|
+
element.style.left = newContainerPosition.left + position.left + "px";
|
|
2718
|
+
newContainer.appendChild(element);
|
|
2719
|
+
});
|
|
2720
|
+
}
|
|
2721
|
+
};
|
|
2694
2722
|
return DrPopoverComponent;
|
|
2695
2723
|
}());
|
|
2696
2724
|
DrPopoverComponent.decorators = [
|
|
@@ -2712,6 +2740,7 @@
|
|
|
2712
2740
|
{ type: DrPopoverRef }
|
|
2713
2741
|
]; };
|
|
2714
2742
|
DrPopoverComponent.propDecorators = {
|
|
2743
|
+
popoverOpened: [{ type: i0.Output }],
|
|
2715
2744
|
content: [{ type: i0.Input }],
|
|
2716
2745
|
contentContext: [{ type: i0.Input }],
|
|
2717
2746
|
class: [{ type: i0.Input }],
|
|
@@ -2719,6 +2748,7 @@
|
|
|
2719
2748
|
manualClosing: [{ type: i0.Input }],
|
|
2720
2749
|
alignment: [{ type: i0.Input }],
|
|
2721
2750
|
position: [{ type: i0.Input }],
|
|
2751
|
+
freezeToContainerSelector: [{ type: i0.Input }],
|
|
2722
2752
|
popoverContainer: [{ type: i0.ViewChild, args: ['popoverContainer', { read: i0.ElementRef, static: true },] }],
|
|
2723
2753
|
width: [{ type: i0.HostBinding, args: ['style.width',] }],
|
|
2724
2754
|
height: [{ type: i0.HostBinding, args: ['style.height',] }],
|
|
@@ -2743,7 +2773,7 @@
|
|
|
2743
2773
|
return popoverRef;
|
|
2744
2774
|
};
|
|
2745
2775
|
DrPopoverService.prototype.attachOverlayContainer = function (content, _a, overlayRef, popoverRef) {
|
|
2746
|
-
var contentContext = _a.contentContext, position = _a.position, elementClass = _a.class, manualClosing = _a.manualClosing, hostRef = _a.hostRef, alignment = _a.alignment;
|
|
2776
|
+
var contentContext = _a.contentContext, position = _a.position, elementClass = _a.class, manualClosing = _a.manualClosing, hostRef = _a.hostRef, alignment = _a.alignment, freezeToContainerSelector = _a.freezeToContainerSelector;
|
|
2747
2777
|
var componentPortal = new portal.ComponentPortal(DrPopoverComponent, null, this.createInjector(popoverRef));
|
|
2748
2778
|
var contentRef = overlayRef.attach(componentPortal);
|
|
2749
2779
|
popoverRef.componentRef = contentRef;
|
|
@@ -2754,6 +2784,7 @@
|
|
|
2754
2784
|
contentRef.instance.hostRef = hostRef;
|
|
2755
2785
|
contentRef.instance.alignment = alignment;
|
|
2756
2786
|
contentRef.instance.position = position;
|
|
2787
|
+
contentRef.instance.freezeToContainerSelector = freezeToContainerSelector;
|
|
2757
2788
|
};
|
|
2758
2789
|
DrPopoverService.prototype.createOverlay = function (popoverModel) {
|
|
2759
2790
|
var overlayConfig = this.getOverlayConfig(popoverModel);
|
|
@@ -2837,6 +2868,7 @@
|
|
|
2837
2868
|
this.manualClosing = { enabled: false };
|
|
2838
2869
|
// eslint-disable-next-line
|
|
2839
2870
|
this.popoverClose = new i0.EventEmitter();
|
|
2871
|
+
this.popoverOpened = new i0.EventEmitter();
|
|
2840
2872
|
// eslint-disable-next-line
|
|
2841
2873
|
this.showStateChange = new i0.EventEmitter();
|
|
2842
2874
|
}
|
|
@@ -2867,12 +2899,16 @@
|
|
|
2867
2899
|
position: this.position,
|
|
2868
2900
|
contentContext: this.contentContext,
|
|
2869
2901
|
alignment: this.alignment,
|
|
2902
|
+
freezeToContainerSelector: this.freezeToContainerSelector
|
|
2870
2903
|
});
|
|
2871
2904
|
popoverRef.onClose.pipe(operators.first()).subscribe(function (res) {
|
|
2872
2905
|
_this.closePopover();
|
|
2873
2906
|
_this.popoverClose.emit(res);
|
|
2874
2907
|
_this.showStateChange.emit({ isShown: !!_this.popoverRef });
|
|
2875
2908
|
});
|
|
2909
|
+
popoverRef.componentRef.instance.popoverOpened.pipe(operators.first()).subscribe(function () {
|
|
2910
|
+
_this.popoverOpened.emit();
|
|
2911
|
+
});
|
|
2876
2912
|
};
|
|
2877
2913
|
DrPopoverDirective.prototype.ngOnDestroy = function () {
|
|
2878
2914
|
this.closePopover();
|
|
@@ -2897,7 +2933,9 @@
|
|
|
2897
2933
|
manualClosing: [{ type: i0.Input, args: ['drPopoverManualClosing',] }],
|
|
2898
2934
|
alignment: [{ type: i0.Input, args: ['drPopoverAlignment',] }],
|
|
2899
2935
|
disabled: [{ type: i0.Input, args: ['drPopoverDisabled',] }],
|
|
2936
|
+
freezeToContainerSelector: [{ type: i0.Input, args: ['drPopoverFreezeToContainerSelector',] }],
|
|
2900
2937
|
popoverClose: [{ type: i0.Output, args: ['drPopoverClose',] }],
|
|
2938
|
+
popoverOpened: [{ type: i0.Output, args: ['drPopoverOpened',] }],
|
|
2901
2939
|
showStateChange: [{ type: i0.Output, args: ['drPopoverShowStateChange',] }],
|
|
2902
2940
|
togglePopover: [{ type: i0.HostListener, args: ['click',] }]
|
|
2903
2941
|
};
|