1 | import { CommonModule } from '@angular/common';
|
2 | import { Component, ChangeDetectionStrategy, ViewEncapsulation, HostBinding, Directive, Input, EventEmitter, ContentChildren, Output, NgModule } from '@angular/core';
|
3 | import { trigger, state, style, transition, animate } from '@angular/animations';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | class BMContentComponent {
|
10 | }
|
11 | BMContentComponent.decorators = [
|
12 | { type: Component, args: [{
|
13 | selector: 'bm-content-container',
|
14 | template: "<ng-content></ng-content>",
|
15 | changeDetection: ChangeDetectionStrategy.OnPush,
|
16 | encapsulation: ViewEncapsulation.None,
|
17 | styles: ["bm-content-container{flex:1 1 0;overflow-x:auto;height:calc(100% - 48px - 3em);box-sizing:content-box;padding:1em 1.5em}"]
|
18 | }] }
|
19 | ];
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | class BMHeaderComponent {
|
26 | constructor() {
|
27 | this.role = 'heading';
|
28 | }
|
29 | }
|
30 | BMHeaderComponent.decorators = [
|
31 | { type: Component, args: [{
|
32 | selector: 'bm-header',
|
33 | template: "<ng-content></ng-content>",
|
34 | changeDetection: ChangeDetectionStrategy.OnPush,
|
35 | encapsulation: ViewEncapsulation.None,
|
36 | styles: ["bm-header{padding:6px 16px;display:flex;flex-direction:row-reverse;align-items:center;background-color:var(--header-background-color,#3e71ad);color:var(--header-color,#f8f8f8);font-weight:600;font-size:2em;flex:1 1 100%;box-sizing:border-box}"]
|
37 | }] }
|
38 | ];
|
39 | BMHeaderComponent.propDecorators = {
|
40 | role: [{ type: HostBinding, args: ['attr.role',] }]
|
41 | };
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | class BMCollapsableDirective {
|
48 | }
|
49 | BMCollapsableDirective.decorators = [
|
50 | { type: Directive, args: [{
|
51 |
|
52 | selector: '[bmCollapsable]',
|
53 | },] }
|
54 | ];
|
55 | BMCollapsableDirective.propDecorators = {
|
56 | collapse: [{ type: Input }, { type: HostBinding, args: ['attr.collapse',] }]
|
57 | };
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | class BMSidenavContainerComponent {
|
64 | constructor() {
|
65 | this.role = 'navigation';
|
66 | this.openMenu = new EventEmitter();
|
67 | }
|
68 | |
69 |
|
70 |
|
71 |
|
72 | set open(v) {
|
73 | this._isOpen = v;
|
74 | if (this.collapsableChilds) {
|
75 | this.collapsableChilds.forEach(( |
76 |
|
77 |
|
78 |
|
79 | (child) => (child.collapse = v ? null : true)));
|
80 | }
|
81 | }
|
82 | |
83 |
|
84 |
|
85 | get open() {
|
86 | return this._isOpen;
|
87 | }
|
88 | |
89 |
|
90 |
|
91 | toggle() {
|
92 | this.open = !this.open;
|
93 | }
|
94 | |
95 |
|
96 |
|
97 |
|
98 | animationDone(event) {
|
99 | if (event.fromState === 'expand' && event.toState === 'collapse') {
|
100 | this.openMenu.emit(false);
|
101 | }
|
102 | if (event.fromState === 'collapse' && event.toState === 'expand') {
|
103 | this.openMenu.emit(true);
|
104 | }
|
105 | }
|
106 | }
|
107 | BMSidenavContainerComponent.decorators = [
|
108 | { type: Component, args: [{
|
109 | selector: 'bm-sidenav',
|
110 | template: "<div class=\"bm-sidenav__container\" [@stretch]=\"(open ? 'expand' : 'collapse')\" (@stretch.done)=\"animationDone($event)\">\n <div class=\"bm-sidenav__toggle-container\">\n <button class=\"bm-sidenav__toggle-button\" i18n-arial-label aria-label=\"Toggle menu\" i18n-title title=\"Toggle menu\" (click)=\"toggle()\">\n <i class=\"fas fa-chevron-right\" aria-hidden=\"true\" [@rotate]=\"(open ? 'expand' : 'collapse')\"></i>\n </button>\n </div>\n <ng-content></ng-content>\n</div>\n",
|
111 | changeDetection: ChangeDetectionStrategy.OnPush,
|
112 | encapsulation: ViewEncapsulation.None,
|
113 | animations: [
|
114 | trigger('stretch', [
|
115 | state('expand', style({ width: '14rem', 'max-width': '100%' })),
|
116 | state('collapse', style({ width: '4em', 'max-width': 'initial' })),
|
117 | transition('expand => collapse', [
|
118 | style({
|
119 | width: '14rem',
|
120 | 'max-width': '100%',
|
121 | }),
|
122 | animate('0.2s ease-in'),
|
123 | ]),
|
124 | transition('collapse => expand', [
|
125 | style({
|
126 | width: '4em',
|
127 | 'max-width': 'initial',
|
128 | }),
|
129 | animate('0.2s ease-out'),
|
130 | ]),
|
131 | ]),
|
132 | trigger('rotate', [
|
133 | state('expand', style({ transform: 'rotate(0)' })),
|
134 | state('collapse', style({ transform: 'rotate(-180deg)' })),
|
135 | transition('expand => collapse', animate('0.2s ease-in')),
|
136 | transition('collapse => expand', animate('0.2s ease-out')),
|
137 | ]),
|
138 | ],
|
139 | styles: ["bm-sidenav{box-sizing:content-box;height:calc(100% - 48px);position:relative;display:inline-block;color:var(--header-color,#f8f8f8);flex:0 1 auto}.bm-sidenav__container{height:100%;display:flex}.bm-sidenav__toggle-container{position:absolute;right:-1.2em;top:50%}.bm-sidenav__toggle-button{vertical-align:middle;border:none;background:0 0;margin-left:auto;margin-right:0;padding:0;width:.6em;height:1.5em;color:var(--header-background-color,#3e71ad)}.bm-sidenav__sections-container{padding:0;list-style:none;margin:0;height:100%;width:4.3em;background-color:var(--header-background-color,#3e71ad)}.bm-sidenav-section-link{color:#f8f8f8;display:block;font-size:1em;text-align:center;text-decoration:none}.bm-sidenav-section-link__icon{display:inline-block;font-size:1.7em;padding:.5em 0}.bm-sidenav-section-link--selected{background-color:var(--header-color,#f8f8f8);color:var(--header-background-color,#3e71ad)}.bm-sidenav-submenu__container{background-color:var(--header-color,#f8f8f8);height:100%;flex:1 1 auto}.bm-sidenav-product-logo{width:100%;text-align:center;position:relative;display:block;height:5em}.bm-sidenav-product-logo__graphic{position:absolute;top:-.5em;left:.3em;display:inline-block;color:var(--header-background-color,#3e71ad);height:3.2em;width:3.2em}.bm-sidenav-subsection{padding:0 .5em}.bm-sidenav-subsection--first{margin-top:3rem}.bm-sidenav-subsection__separator-line{border:1px solid #d8d8d8}.bm-sidenav-subsection-title{height:14px;width:100%;color:#333;font-size:12px;font-weight:600;line-height:14px;text-transform:uppercase;padding:.5em}.bm-sidenav-subsection-menu{padding:0;list-style:none;margin:0;width:100%;color:var(--header-background-color,#3e71ad)}.bm-sidenav-subsection-menu__item{padding:.5em;display:block}.bm-sidenav-subsection-menu__item--selected{background-color:#eaeaea}"]
|
140 | }] }
|
141 | ];
|
142 | BMSidenavContainerComponent.propDecorators = {
|
143 | collapsableChilds: [{ type: ContentChildren, args: [BMCollapsableDirective,] }],
|
144 | role: [{ type: HostBinding, args: ['attr.role',] }],
|
145 | open: [{ type: HostBinding, args: ['attr.open',] }, { type: Input }],
|
146 | openMenu: [{ type: Output }]
|
147 | };
|
148 |
|
149 |
|
150 |
|
151 |
|
152 |
|
153 | class BMATLayoutModule {
|
154 |
|
155 | |
156 |
|
157 |
|
158 | static forRoot() {
|
159 | return {
|
160 | ngModule: BMATLayoutModule,
|
161 | providers: [],
|
162 | };
|
163 | }
|
164 | }
|
165 | BMATLayoutModule.decorators = [
|
166 | { type: NgModule, args: [{
|
167 | imports: [CommonModule],
|
168 | declarations: [
|
169 | BMCollapsableDirective,
|
170 | BMContentComponent,
|
171 | BMHeaderComponent,
|
172 | BMSidenavContainerComponent,
|
173 | ],
|
174 | exports: [
|
175 | BMCollapsableDirective,
|
176 | BMContentComponent,
|
177 | BMHeaderComponent,
|
178 | BMSidenavContainerComponent,
|
179 | ],
|
180 | providers: [],
|
181 | },] }
|
182 | ];
|
183 |
|
184 | export { BMATLayoutModule, BMCollapsableDirective, BMContentComponent, BMHeaderComponent, BMSidenavContainerComponent };
|
185 |
|