Skip to content

Commit 8ffcb90

Browse files
committed
Release 1.5.1
1 parent 547bb9f commit 8ffcb90

File tree

15 files changed

+211
-305
lines changed

15 files changed

+211
-305
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
## 1.5.1 (22.11.2021)
2+
3+
### Fixes and improvements
4+
5+
- Toast/Alert - resolved problem with stacking and close animation,
6+
- Modal - resolved problem with closing when mouseup event is detected outside the component,
7+
- Sidenav - setting `hidden` input to `false` will no longer trigger component animation,
8+
- Sidenav - resolved problem with arrow rotation update when `[collapsed]="false"` is used,
9+
- Sidenav - removed focus trap in side and push modes,
10+
- Sidenav - default position will be now correctly set to `fixed`,
11+
- Input - resolved problem with border top gap recalculation when used inside a dynamically loaded component (such as tabs),
12+
- Overlay - resolved problem with z-index in components using overlay (e.g. modal, popconfirm, tooltip, components with dropdown menus). The components will be correctly displayed above the elements with sticky/fixed styles,
13+
- Charts - fixed default options and resolved problem with custom options merge.
14+
15+
### Vector maps 1.1.0:
16+
17+
- resolved problem with automatic updates of colors defined in `colorMap`,
18+
- resolved problem with tooltip display when `[hover]="false"` is used,
19+
- added possibility to display custom tooltips.
20+
21+
---
22+
123
## 1.5.0 (02.11.2021)
224

325
### New

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mdb-angular-ui-kit-free",
3-
"version": "1.5.0",
3+
"version": "1.5.1",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",

projects/mdb-angular-ui-kit/CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
## 1.5.1 (22.11.2021)
2+
3+
### Fixes and improvements
4+
5+
- Toast/Alert - resolved problem with stacking and close animation,
6+
- Modal - resolved problem with closing when mouseup event is detected outside the component,
7+
- Sidenav - setting `hidden` input to `false` will no longer trigger component animation,
8+
- Sidenav - resolved problem with arrow rotation update when `[collapsed]="false"` is used,
9+
- Sidenav - removed focus trap in side and push modes,
10+
- Sidenav - default position will be now correctly set to `fixed`,
11+
- Input - resolved problem with border top gap recalculation when used inside a dynamically loaded component (such as tabs),
12+
- Overlay - resolved problem with z-index in components using overlay (e.g. modal, popconfirm, tooltip, components with dropdown menus). The components will be correctly displayed above the elements with sticky/fixed styles,
13+
- Charts - fixed default options and resolved problem with custom options merge.
14+
15+
### Vector maps 1.1.0:
16+
17+
- resolved problem with automatic updates of colors defined in `colorMap`,
18+
- resolved problem with tooltip display when `[hover]="false"` is used,
19+
- added possibility to display custom tooltips.
20+
21+
---
22+
123
## 1.5.0 (02.11.2021)
224

325
### New

projects/mdb-angular-ui-kit/assets/scss/free/_alert.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,3 @@
1717
.parent-alert-relative {
1818
position: relative;
1919
}
20-
21-
.notification-open .cdk-overlay-container {
22-
z-index: $zindex-alert;
23-
}

projects/mdb-angular-ui-kit/assets/scss/free/_modal.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,3 @@
3434
overflow-y: auto;
3535
}
3636
}
37-
38-
.modal-open {
39-
.cdk-overlay-container {
40-
z-index: 1040;
41-
}
42-
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Owerride default overlay z-index. Change required to allow elements inside the overlay to have z-index value ​​up to 1200.
2+
3+
div.cdk-overlay-container {
4+
z-index: 1200;
5+
.cdk-overlay-backdrop {
6+
z-index: 1200;
7+
}
8+
.cdk-global-overlay-wrapper {
9+
z-index: 1200
10+
}
11+
.cdk-overlay-pane {
12+
z-index: 1200;
13+
}
14+
.cdk-overlay-connected-position-bounding-box {
15+
z-index: 1200;
16+
}
17+
}

projects/mdb-angular-ui-kit/assets/scss/free/_toasts.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
background-color: $toast-background-color;
55
border: 0;
66
box-shadow: $toast-box-shadow;
7+
margin-bottom: 10px;
78

89
.btn-close {
910
width: 1.3em;

projects/mdb-angular-ui-kit/assets/scss/mdb.free.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
@import './free/shadows';
6262
@import './free/flag';
6363
@import './free/images';
64+
@import './free/overlay';
6465

6566
// MDB COMPONENTS
6667
@import './free/tables';

projects/mdb-angular-ui-kit/assets/scss/mdb.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
@import './free/shadows';
6363
@import './free/flag';
6464
@import './free/images';
65+
@import './free/overlay';
6566

6667
// MDB COMPONENTS
6768
@import './free/accordion';
@@ -98,4 +99,5 @@
9899
@import './free/forms/input-group';
99100
@import './free/forms/form-file';
100101

102+
101103
@import '~@angular/cdk/overlay-prebuilt.css';

projects/mdb-angular-ui-kit/forms/form-control.component.ts

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
AfterContentInit,
99
Renderer2,
1010
OnDestroy,
11+
NgZone,
1112
} from '@angular/core';
1213
import { MdbAbstractFormControl } from './form-control';
1314
import { MdbLabelDirective } from './label.directive';
@@ -32,14 +33,20 @@ export class MdbFormControlComponent implements AfterContentInit, OnDestroy {
3233
return this._formControl.input;
3334
}
3435

35-
constructor(private _renderer: Renderer2, private _contentObserver: ContentObserver) {}
36+
constructor(
37+
private _renderer: Renderer2,
38+
private _contentObserver: ContentObserver,
39+
private _elementRef: ElementRef,
40+
private _ngZone: NgZone
41+
) {}
3642

3743
readonly _destroy$: Subject<void> = new Subject<void>();
3844

3945
private _notchLeadingLength = 9;
4046
private _labelMarginLeft = 0;
4147
private _labelGapPadding = 8;
4248
private _labelScale = 0.8;
49+
private _recalculateGapWhenVisible = false;
4350

4451
ngAfterContentInit(): void {
4552
if (this._label) {
@@ -65,13 +72,13 @@ export class MdbFormControlComponent implements AfterContentInit, OnDestroy {
6572
}
6673
});
6774

68-
// Workaround for problems with border top styles in
69-
// inputs rendered inside a tab component
70-
setTimeout(() => {
71-
if (this._label) {
72-
this._updateBorderGap();
73-
}
74-
}, 0);
75+
this._ngZone.runOutsideAngular(() => {
76+
this._ngZone.onStable.pipe(takeUntil(this._destroy$)).subscribe(() => {
77+
if (this._label && this._recalculateGapWhenVisible) {
78+
this._updateBorderGap();
79+
}
80+
});
81+
});
7582
}
7683

7784
ngOnDestroy(): void {
@@ -84,12 +91,23 @@ export class MdbFormControlComponent implements AfterContentInit, OnDestroy {
8491
}
8592

8693
private _updateBorderGap(): void {
94+
// Element is in DOM but is not visible, we need to recalculate the gap when element
95+
// is displayed. This problem may occur in components such as tabs where content of
96+
// inactive tabs has display:none styles
97+
98+
if (this._isHidden()) {
99+
this._recalculateGapWhenVisible = true;
100+
return;
101+
}
102+
87103
const notchLeadingWidth = `${this._labelMarginLeft + this._notchLeadingLength}px`;
88104
const notchMiddleWidth = `${this._getLabelWidth()}px`;
89105

90-
this._renderer.setStyle(this._notchLeading.nativeElement, 'width', notchLeadingWidth);
91-
this._renderer.setStyle(this._notchMiddle.nativeElement, 'width', notchMiddleWidth);
92-
this._renderer.setStyle(this._label.nativeElement, 'margin-left', `${this._labelMarginLeft}px`);
106+
this._notchLeading.nativeElement.style.width = notchLeadingWidth;
107+
this._notchMiddle.nativeElement.style.width = notchMiddleWidth;
108+
this._label.nativeElement.style.marginLeft = `${this._labelMarginLeft}px`;
109+
110+
this._recalculateGapWhenVisible = false;
93111
}
94112

95113
private _updateLabelActiveState(): void {
@@ -103,4 +121,10 @@ export class MdbFormControlComponent implements AfterContentInit, OnDestroy {
103121
private _isLabelActive(): boolean {
104122
return this._formControl && this._formControl.labelActive;
105123
}
124+
125+
private _isHidden(): boolean {
126+
const el = this._elementRef.nativeElement;
127+
128+
return !el.offsetHeight && !el.offsetWidth;
129+
}
106130
}

projects/mdb-angular-ui-kit/modal/modal-container.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class MdbModalContainerComponent implements OnInit, AfterViewInit, OnDest
7575

7676
ngAfterViewInit(): void {
7777
if (!this._config.ignoreBackdropClick) {
78-
fromEvent(this._elementRef.nativeElement, 'click')
78+
fromEvent(this._elementRef.nativeElement, 'mousedown')
7979
.pipe(
8080
filter((event: MouseEvent) => {
8181
const target = event.target as HTMLElement;

projects/mdb-angular-ui-kit/modal/modal.spec.ts

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,24 @@ import { OverlayContainer } from '@angular/cdk/overlay';
44
import { MdbModalModule } from './modal.module';
55
import { MdbModalService } from './modal.service';
66
import { Component, NgModule } from '@angular/core';
7+
import { BrowserModule } from '@angular/platform-browser';
78

89
@Component({
910
template: `
1011
<div class="modal-header">
1112
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
1213
<button type="button" class="btn-close" aria-label="Close" (click)="close()"></button>
1314
</div>
14-
<div class="modal-body">...</div>
15+
<div class="modal-body">
16+
<div id="main-view" *ngIf="mainView">
17+
<button id="main-view-toggler" class="btn btn-primary" (click)="setView(false)"></button>
18+
<p>main view</p>
19+
</div>
20+
<div id="not-main-view" *ngIf="!mainView">
21+
<button id="not-main-view-toggler" class="btn btn-primary" (click)="setView(true)"></button>
22+
<p>not main view</p>
23+
</div>
24+
</div>
1525
<div class="modal-footer">
1626
<button type="button" class="btn btn-secondary" (click)="close()">Close</button>
1727
<button type="button" class="btn btn-primary">Save changes</button>
@@ -21,11 +31,18 @@ import { Component, NgModule } from '@angular/core';
2131
})
2232
class BasicModalComponent {
2333
constructor(public modal: MdbModalService) {}
34+
35+
mainView = true;
36+
37+
setView(isMain) {
38+
this.mainView = isMain;
39+
}
2440
}
2541

2642
@NgModule({
2743
declarations: [BasicModalComponent],
2844
entryComponents: [BasicModalComponent],
45+
imports: [BrowserModule],
2946
})
3047
class TestModalModule {}
3148

@@ -102,7 +119,7 @@ describe('MDB Modal', () => {
102119
) as HTMLElement;
103120
expect(modalContainer).not.toBe(null);
104121

105-
const event = new MouseEvent('click', { clientX: 0, clientY: 0 });
122+
const event = new MouseEvent('mousedown', { clientX: 0, clientY: 0 });
106123
modalContainer.dispatchEvent(event);
107124

108125
fixture.detectChanges();
@@ -113,6 +130,36 @@ describe('MDB Modal', () => {
113130
expect(modalContainer).toBe(null);
114131
}));
115132

133+
it('should dont close the modal on mousedown inside modal, move mouse outside modal and mouseup', fakeAsync(() => {
134+
modal.open(BasicModalComponent);
135+
136+
fixture.detectChanges();
137+
tick(350);
138+
139+
let modalContainer = overlayContainerElement.querySelector(
140+
'mdb-modal-container'
141+
) as HTMLElement;
142+
let modalContent = overlayContainerElement.querySelector('.modal-content') as HTMLElement;
143+
144+
expect(modalContainer).not.toBe(null);
145+
expect(modalContent).not.toBe(null);
146+
147+
const mousedownEvent = new MouseEvent('mousedown', { clientX: 0, clientY: 0 });
148+
const mouseupEvent = new MouseEvent('mouseup', { clientX: 0, clientY: 0 });
149+
150+
modalContent.dispatchEvent(mousedownEvent);
151+
modalContainer.dispatchEvent(mouseupEvent);
152+
153+
fixture.detectChanges();
154+
tick(700);
155+
156+
modalContainer = overlayContainerElement.querySelector('mdb-modal-container') as HTMLElement;
157+
modalContent = overlayContainerElement.querySelector('.modal-content') as HTMLElement;
158+
159+
expect(modalContent).not.toBe(null);
160+
expect(modalContainer).not.toBe(null);
161+
}));
162+
116163
it('should not close the modal on backdrop click if ignoreBackdropClick is set to true', fakeAsync(() => {
117164
modal.open(BasicModalComponent, {
118165
ignoreBackdropClick: true,
@@ -124,7 +171,7 @@ describe('MDB Modal', () => {
124171
let modalContainer = overlayContainerElement.querySelector('mdb-modal-container');
125172
expect(modalContainer).not.toBe(null);
126173

127-
const event = new MouseEvent('click');
174+
const event = new MouseEvent('mousedown');
128175
modalContainer.dispatchEvent(event);
129176

130177
fixture.detectChanges();
@@ -175,4 +222,40 @@ describe('MDB Modal', () => {
175222

176223
expect(modalContainer).not.toBe(null);
177224
}));
225+
226+
it('should not close when click on btn inside modal', fakeAsync(() => {
227+
modal.open(BasicModalComponent);
228+
229+
fixture.detectChanges();
230+
tick(700);
231+
232+
let modalContainer = overlayContainerElement.querySelector('mdb-modal-container');
233+
let mainView = modalContainer.querySelector('#main-view');
234+
let notMainView = modalContainer.querySelector('#not-main-view');
235+
let mainViewToggler = modalContainer.querySelector('#main-view-toggler');
236+
let notMainViewToggler = modalContainer.querySelector('#not-main-view-toggler');
237+
238+
expect(modalContainer).not.toBe(null);
239+
expect(mainView).not.toBe(null);
240+
expect(notMainView).toBe(null);
241+
expect(mainViewToggler).not.toBe(null);
242+
expect(notMainViewToggler).toBe(null);
243+
244+
mainViewToggler.dispatchEvent(new MouseEvent('click'));
245+
246+
fixture.detectChanges();
247+
tick(700);
248+
249+
modalContainer = overlayContainerElement.querySelector('mdb-modal-container');
250+
mainView = modalContainer.querySelector('#main-view');
251+
notMainView = modalContainer.querySelector('#not-main-view');
252+
mainViewToggler = modalContainer.querySelector('#main-view-toggler');
253+
notMainViewToggler = modalContainer.querySelector('#not-main-view-toggler');
254+
255+
expect(modalContainer).not.toBe(null);
256+
expect(mainView).toBe(null);
257+
expect(notMainView).not.toBe(null);
258+
expect(mainViewToggler).toBe(null);
259+
expect(notMainViewToggler).not.toBe(null);
260+
}));
178261
});

projects/mdb-angular-ui-kit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"repository": "https://github.com/mdbootstrap/mdb-angular-ui-kit",
44
"author": "MDBootstrap",
55
"license": "MIT",
6-
"version": "1.5.0",
6+
"version": "1.5.1",
77
"peerDependencies": {
88
"@angular/common": "^12.0.0",
99
"@angular/core": "^12.0.0",

0 commit comments

Comments
 (0)