@memberjunction/ng-container-directives 2.32.1 → 2.33.0
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/README.md +131 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# @memberjunction/ng-container-directives
|
|
2
|
+
|
|
3
|
+
Angular directives for container management in MemberJunction applications, providing flexible and responsive layout utilities.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- `mjContainer` directive for view container management
|
|
8
|
+
- `mjFillContainer` directive for responsive filling of parent containers
|
|
9
|
+
- Automatic resizing on window resize events
|
|
10
|
+
- Manual resize event handling
|
|
11
|
+
- Customizable margin and dimension settings
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @memberjunction/ng-container-directives
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
Import the module in your application:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';
|
|
25
|
+
|
|
26
|
+
@NgModule({
|
|
27
|
+
imports: [
|
|
28
|
+
// ...
|
|
29
|
+
ContainerDirectivesModule
|
|
30
|
+
]
|
|
31
|
+
})
|
|
32
|
+
export class YourModule { }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### mjContainer
|
|
36
|
+
|
|
37
|
+
Use the `mjContainer` directive to reference a ViewContainerRef for dynamic component loading:
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<div mjContainer></div>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
In your component:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { Container } from '@memberjunction/ng-container-directives';
|
|
47
|
+
|
|
48
|
+
@Component({
|
|
49
|
+
// ...
|
|
50
|
+
})
|
|
51
|
+
export class YourComponent {
|
|
52
|
+
@ViewChild(Container, { static: true }) container!: Container;
|
|
53
|
+
|
|
54
|
+
// Now you can use this.container.viewContainerRef for dynamic component creation
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### mjFillContainer
|
|
59
|
+
|
|
60
|
+
Use the `mjFillContainer` directive to make an element fill its parent container:
|
|
61
|
+
|
|
62
|
+
```html
|
|
63
|
+
<!-- Basic usage (fills both width and height) -->
|
|
64
|
+
<div mjFillContainer>Content</div>
|
|
65
|
+
|
|
66
|
+
<!-- With custom settings -->
|
|
67
|
+
<div
|
|
68
|
+
mjFillContainer
|
|
69
|
+
[fillWidth]="true"
|
|
70
|
+
[fillHeight]="true"
|
|
71
|
+
[rightMargin]="10"
|
|
72
|
+
[bottomMargin]="20">
|
|
73
|
+
Content with margins
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<!-- Fill only width -->
|
|
77
|
+
<div
|
|
78
|
+
mjFillContainer
|
|
79
|
+
[fillWidth]="true"
|
|
80
|
+
[fillHeight]="false">
|
|
81
|
+
Content that fills width only
|
|
82
|
+
</div>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Skip Resize
|
|
86
|
+
|
|
87
|
+
If you need to prevent the resize behavior for certain elements:
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<!-- This element will not be resized by the directive -->
|
|
91
|
+
<div mjSkipResize>Content</div>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Manual Resize Triggering
|
|
95
|
+
|
|
96
|
+
You can trigger manual resizing using the MemberJunction global events:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { MJGlobal, MJEventType } from '@memberjunction/global';
|
|
100
|
+
|
|
101
|
+
// Trigger resize
|
|
102
|
+
MJGlobal.Instance.RaiseEvent({
|
|
103
|
+
event: MJEventType.ManualResizeRequest,
|
|
104
|
+
args: null
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Configuration
|
|
109
|
+
|
|
110
|
+
The `mjFillContainer` directive has several configuration options:
|
|
111
|
+
|
|
112
|
+
| Property | Type | Default | Description |
|
|
113
|
+
|----------|------|---------|-------------|
|
|
114
|
+
| fillWidth | boolean | true | Whether to fill the parent's width |
|
|
115
|
+
| fillHeight | boolean | true | Whether to fill the parent's height |
|
|
116
|
+
| rightMargin | number | 0 | Right margin in pixels |
|
|
117
|
+
| bottomMargin | number | 0 | Bottom margin in pixels |
|
|
118
|
+
|
|
119
|
+
## Advanced Controls
|
|
120
|
+
|
|
121
|
+
For debugging or special cases, there are static properties on the FillContainer class:
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
import { FillContainer } from '@memberjunction/ng-container-directives';
|
|
125
|
+
|
|
126
|
+
// Disable resize globally (for all instances)
|
|
127
|
+
FillContainer.DisableResize = true;
|
|
128
|
+
|
|
129
|
+
// Enable resize debugging
|
|
130
|
+
FillContainer.OutputDebugInfo = true;
|
|
131
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-container-directives",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.33.0",
|
|
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",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"@angular/router": "18.0.2"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@memberjunction/core": "2.
|
|
33
|
-
"@memberjunction/global": "2.
|
|
32
|
+
"@memberjunction/core": "2.33.0",
|
|
33
|
+
"@memberjunction/global": "2.33.0",
|
|
34
34
|
"tslib": "^2.3.0"
|
|
35
35
|
},
|
|
36
36
|
"sideEffects": false
|