@memberjunction/ng-container-directives 0.9.119 → 0.9.121
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.
|
@@ -2,6 +2,7 @@ import { ElementRef, OnDestroy, OnInit } from '@angular/core';
|
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export declare class FillContainer implements OnInit, OnDestroy {
|
|
4
4
|
private elementRef;
|
|
5
|
+
private static _instanceCount;
|
|
5
6
|
fillWidth: boolean;
|
|
6
7
|
fillHeight: boolean;
|
|
7
8
|
rightMargin: number;
|
|
@@ -17,6 +18,7 @@ export declare class FillContainer implements OnInit, OnDestroy {
|
|
|
17
18
|
resizeElement(): void;
|
|
18
19
|
protected shouldSkipResize(el: HTMLElement): boolean;
|
|
19
20
|
protected elementBelowHiddenTab(element: HTMLElement): boolean;
|
|
21
|
+
protected elementWithinGrid(element: HTMLElement): boolean;
|
|
20
22
|
static ɵfac: i0.ɵɵFactoryDeclaration<FillContainer, never>;
|
|
21
23
|
static ɵdir: i0.ɵɵDirectiveDeclaration<FillContainer, "[mjFillContainer]", never, { "fillWidth": { "alias": "fillWidth"; "required": false; }; "fillHeight": { "alias": "fillHeight"; "required": false; }; "rightMargin": { "alias": "rightMargin"; "required": false; }; "bottomMargin": { "alias": "bottomMargin"; "required": false; }; }, {}, never, never, false, never>;
|
|
22
24
|
}
|
|
@@ -15,6 +15,8 @@ export class FillContainer {
|
|
|
15
15
|
this._resizeEndDebounceTime = 500;
|
|
16
16
|
this.resizeImmediateSubscription = null;
|
|
17
17
|
this.resizeEndSubscription = null;
|
|
18
|
+
FillContainer._instanceCount++;
|
|
19
|
+
console.log('FillContainer instances: ' + FillContainer._instanceCount);
|
|
18
20
|
}
|
|
19
21
|
ngOnInit() {
|
|
20
22
|
const el = this.elementRef.nativeElement;
|
|
@@ -41,6 +43,8 @@ export class FillContainer {
|
|
|
41
43
|
var _a, _b;
|
|
42
44
|
(_a = this.resizeImmediateSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
43
45
|
(_b = this.resizeEndSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
46
|
+
FillContainer._instanceCount--;
|
|
47
|
+
console.log('FillContainer instances: ' + FillContainer._instanceCount);
|
|
44
48
|
}
|
|
45
49
|
getParent(element) {
|
|
46
50
|
const parent = element.parentElement;
|
|
@@ -68,14 +72,18 @@ export class FillContainer {
|
|
|
68
72
|
resizeElement() {
|
|
69
73
|
const element = this.elementRef.nativeElement;
|
|
70
74
|
try {
|
|
75
|
+
console.log('resizing element (1st check): ' + element.nodeName);
|
|
71
76
|
if (element && element.style && !this.shouldSkipResize(element)) {
|
|
77
|
+
console.log('resizing element (2nd check): ' + element.nodeName);
|
|
72
78
|
const parent = this.getParent(element);
|
|
73
79
|
if (parent && !this.elementBelowHiddenTab(element)) {
|
|
80
|
+
console.log('resizing element (3nd check): ' + element.nodeName);
|
|
74
81
|
let parentStyle = window.getComputedStyle(parent);
|
|
75
82
|
if (parentStyle.visibility === 'hidden' || parentStyle.display === 'none') {
|
|
76
83
|
LogStatus('skipping hidden element: ' + parent.nodeName);
|
|
77
84
|
}
|
|
78
85
|
else {
|
|
86
|
+
console.log('resizing element (4th check): ' + element.nodeName);
|
|
79
87
|
const parentRect = parent.getBoundingClientRect();
|
|
80
88
|
if (parent.nodeName === 'HTML') {
|
|
81
89
|
parentRect.height = window.innerHeight;
|
|
@@ -105,11 +113,11 @@ export class FillContainer {
|
|
|
105
113
|
LogError(err);
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
|
-
// Function to check if element or its parents have the 'mjSkipResize' attribute
|
|
116
|
+
// Function to check if element or its parents have the 'mjSkipResize' attribute or if a parent is within a grid
|
|
109
117
|
shouldSkipResize(el) {
|
|
110
118
|
let cur = el;
|
|
111
119
|
while (cur) {
|
|
112
|
-
if (cur.hasAttribute('mjSkipResize')) {
|
|
120
|
+
if (cur.hasAttribute('mjSkipResize') || cur.role === 'grid') {
|
|
113
121
|
return true;
|
|
114
122
|
}
|
|
115
123
|
cur = cur.parentElement;
|
|
@@ -134,7 +142,21 @@ export class FillContainer {
|
|
|
134
142
|
// not below a tab at all
|
|
135
143
|
return false;
|
|
136
144
|
}
|
|
145
|
+
elementWithinGrid(element) {
|
|
146
|
+
// check if the element is within a kendo grid
|
|
147
|
+
let parent = element.parentElement;
|
|
148
|
+
while (parent) {
|
|
149
|
+
if (parent.role === 'grid') {
|
|
150
|
+
// element is below a grid
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
parent = parent.parentElement;
|
|
154
|
+
}
|
|
155
|
+
// not below a grid
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
137
158
|
}
|
|
159
|
+
FillContainer._instanceCount = 0;
|
|
138
160
|
FillContainer.ɵfac = function FillContainer_Factory(t) { return new (t || FillContainer)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
|
|
139
161
|
FillContainer.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: FillContainer, selectors: [["", "mjFillContainer", ""]], inputs: { fillWidth: "fillWidth", fillHeight: "fillHeight", rightMargin: "rightMargin", bottomMargin: "bottomMargin" } });
|
|
140
162
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FillContainer, [{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-container-directives",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.121",
|
|
4
4
|
"description": "MemberJunction: Angular Container Directives - Fill Container for Auto-Resizing, and plain container just for element identification/binding",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|