Skip to content
This repository was archived by the owner on Nov 6, 2024. It is now read-only.

Commit e787dba

Browse files
jfcerescote
authored andcommitted
* Update [email protected] and [email protected] * Fix @types/jquery version and unit tests * FIx yarn.lock * Remove fixCloseOnClick workaround in SideNav component * Workaround for multiple select options not aligned
1 parent 25dc793 commit e787dba

10 files changed

+52
-240
lines changed

demo-app/src/app/app.component.html

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<mz-sidenav #sidenav
33
[id]="'sidenav'"
44
[backgroundClass]="'sidenav-background'"
5+
[closeOnClick]="true"
56
[collapseButtonId]="'btn-sidenav'"
67
[fixed]="true">
78

demo-app/yarn.lock

+17-33
Original file line numberDiff line numberDiff line change
@@ -163,21 +163,17 @@
163163
version "2.5.45"
164164
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.5.45.tgz#58928a621d014ce6ab59c5a9c41071f7328b0ca9"
165165

166-
"@types/jquery@*":
167-
version "2.0.46"
168-
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-2.0.46.tgz#c245426299b43c4bb75f44b813090bd5918d00f2"
169-
170-
"@types/jquery@^2.0.47":
171-
version "2.0.48"
172-
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-2.0.48.tgz#3e90d8cde2d29015e5583017f7830cb3975b2eef"
166+
"@types/jquery@*", "@types/jquery@^3.2.12":
167+
version "3.2.12"
168+
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.2.12.tgz#f496823108c3874c97c9a822e675a3926ee64b46"
173169

174170
175171
version "0.3.0"
176172
resolved "https://registry.yarnpkg.com/@types/marked/-/marked-0.3.0.tgz#583c223dd33385a1dda01aaf77b0cd0411c4b524"
177173

178-
"@types/materialize-css@0.98.0":
179-
version "0.98.0"
180-
resolved "https://registry.yarnpkg.com/@types/materialize-css/-/materialize-css-0.98.0.tgz#8d514647c1d92e2bc5ec7aea0c1f13c408be61e5"
174+
"@types/materialize-css@^0.100.0":
175+
version "0.100.0"
176+
resolved "https://registry.yarnpkg.com/@types/materialize-css/-/materialize-css-0.100.0.tgz#2b311b2ca273d6fd689609ab8e8d932966f8f45c"
181177
dependencies:
182178
"@types/jquery" "*"
183179
"@types/pickadate" "*"
@@ -2288,7 +2284,7 @@ gulplog@^1.0.0:
22882284
dependencies:
22892285
glogg "^1.0.0"
22902286

2291-
hammerjs@^2.0.4:
2287+
hammerjs@^2.0.8:
22922288
version "2.0.8"
22932289
resolved "https://registry.yarnpkg.com/hammerjs/-/hammerjs-2.0.8.tgz#04ef77862cff2bb79d30f7692095930222bf60f1"
22942290

@@ -2986,11 +2982,7 @@ jquery-mousewheel@>=3.0.6:
29862982
version "3.1.13"
29872983
resolved "https://registry.yarnpkg.com/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz#06f0335f16e353a695e7206bf50503cb523a6ee5"
29882984

2989-
jquery@^2.1.4:
2990-
version "2.2.4"
2991-
resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.2.4.tgz#2c89d6889b5eac522a7eea32c14521559c6cbf02"
2992-
2993-
jquery@^3.0.0:
2985+
jquery@^3.0.0, "jquery@^3.0.0 || ^2.1.4":
29942986
version "3.2.1"
29952987
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787"
29962988

@@ -3509,13 +3501,12 @@ matcher-collection@^1.0.0:
35093501
dependencies:
35103502
minimatch "^3.0.2"
35113503

3512-
materialize-css@0.98.2:
3513-
version "0.98.2"
3514-
resolved "https://registry.yarnpkg.com/materialize-css/-/materialize-css-0.98.2.tgz#f9e4239fd27e2a917a0de379d74d508e2d92ec8e"
3504+
materialize-css@^0.100.2:
3505+
version "0.100.2"
3506+
resolved "https://registry.yarnpkg.com/materialize-css/-/materialize-css-0.100.2.tgz#9ca32b24904c9a04491fc7d0a2e9402e7b1dae07"
35153507
dependencies:
3516-
hammerjs "^2.0.4"
3517-
jquery "^2.1.4"
3518-
node-archiver "^0.3.0"
3508+
hammerjs "^2.0.8"
3509+
jquery "^3.0.0 || ^2.1.4"
35193510

35203511
math-expression-evaluator@^1.2.14:
35213512
version "1.2.17"
@@ -3701,11 +3692,11 @@ ng2-markdown-to-html@^1.3.1:
37013692
prismjs "^1.6.0"
37023693

37033694
"ng2-materialize@file:../":
3704-
version "1.5.2-beta.0"
3695+
version "1.5.3-beta.0"
37053696
dependencies:
3706-
"@types/jquery" "^2.0.47"
3707-
"@types/materialize-css" "0.98.0"
3708-
materialize-css "0.98.2"
3697+
"@types/jquery" "^3.2.12"
3698+
"@types/materialize-css" "^0.100.0"
3699+
materialize-css "^0.100.2"
37093700

37103701
ngx-malihu-scrollbar@^1.2.1:
37113702
version "1.2.1"
@@ -3721,13 +3712,6 @@ no-case@^2.2.0:
37213712
dependencies:
37223713
lower-case "^1.1.1"
37233714

3724-
node-archiver@^0.3.0:
3725-
version "0.3.0"
3726-
resolved "https://registry.yarnpkg.com/node-archiver/-/node-archiver-0.3.0.tgz#b9f1afe5006d0bdf29260181833a070978bc6947"
3727-
dependencies:
3728-
fstream "^1.0.10"
3729-
tar "^2.2.1"
3730-
37313715
node-gyp@^3.3.1:
37323716
version "3.6.2"
37333717
resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.6.2.tgz#9bfbe54562286284838e750eac05295853fa1c60"

karma.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = function (config) {
2020
},
2121
files: [
2222
'./node_modules/jquery/dist/jquery.js',
23-
'./node_modules/materialize-css/bin/materialize.js',
23+
'./node_modules/materialize-css/dist/js/materialize.js',
2424
{ pattern: './src/test.ts', watched: false }
2525
],
2626
preprocessors: {

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
"heroku-postbuild": "cd demo-app && yarn install && yarn run build:prod"
3737
},
3838
"dependencies": {
39-
"@types/jquery": "^2.0.47",
40-
"@types/materialize-css": "0.98.0",
41-
"materialize-css": "0.98.2"
39+
"@types/jquery": "^3.2.12",
40+
"@types/materialize-css": "^0.100.0",
41+
"materialize-css": "^0.100.2"
4242
},
4343
"devDependencies": {
4444
"@angular/animations": "^4.0.0",
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
.input-field:not(.inline) {
22
// fix unwanted space under the input-field when error-message is not shown
33
display: block;
4-
}
4+
}
5+
6+
// workaround for materialize bug: multiple select options are not aligned
7+
// https://github.com/Dogfalo/materialize/issues/5083#issue-248489869
8+
#{'/deep/'} .input-field .dropdown-content [type="checkbox"]+label {
9+
top: -11px;
10+
}

src/app/select/select.directive.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class MzSelectDirective extends HandlePropChanges implements OnInit, OnDe
128128
}
129129

130130
handleDOMEvents() {
131-
this.inputElement.on('blur focus', (event: BaseJQueryEventObject) => {
131+
this.inputElement.on('blur focus', (event: JQuery.Event) => {
132132
this.selectElement[0].dispatchEvent(new Event(event.type));
133133
});
134134
}
+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
<ul #sidenav
2-
class="side-nav {{ backgroundClass }}"
1+
<ul class="side-nav {{ backgroundClass }}"
32
[attr.id]="id"
43
[class.fixed]="fixed">
5-
64
<ng-content></ng-content>
75
</ul>

src/app/sidenav/sidenav.component.ts

+6-33
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import {
66
OnDestroy,
77
OnInit,
88
Renderer,
9-
ViewChild } from '@angular/core';
9+
} from '@angular/core';
1010

1111
@Component({
1212
selector: 'mz-sidenav',
1313
templateUrl: './sidenav.component.html',
1414
})
15-
export class MzSidenavComponent implements AfterViewInit, OnDestroy, OnInit {
15+
export class MzSidenavComponent implements AfterViewInit, OnDestroy {
1616
@Input() backgroundClass: string;
1717
@Input() closeOnClick: boolean;
1818
@Input() collapseButtonId: string;
@@ -21,29 +21,18 @@ export class MzSidenavComponent implements AfterViewInit, OnDestroy, OnInit {
2121
@Input() id: string;
2222
@Input() width: number;
2323

24-
@ViewChild('sidenav') sideNav: ElementRef;
25-
26-
closeOnClickListeners: Function[];
27-
2824
constructor(private renderer: Renderer) { }
2925

30-
ngOnInit(): void {
31-
this.closeOnClickListeners = [];
32-
}
33-
34-
ngAfterViewInit(): void {
26+
ngAfterViewInit() {
3527
this.initCollapseButton();
3628
this.initCollapsibleLinks();
37-
this.fixCloseOnClick();
3829
}
3930

40-
ngOnDestroy(): void {
31+
ngOnDestroy() {
4132
$(`#${this.collapseButtonId}`).sideNav('destroy');
42-
this.closeOnClickListeners.forEach(listener => listener());
4333
}
4434

45-
initCollapseButton(): void {
46-
35+
initCollapseButton() {
4736
if (!this.collapseButtonId) {
4837
return;
4938
}
@@ -66,24 +55,8 @@ export class MzSidenavComponent implements AfterViewInit, OnDestroy, OnInit {
6655
});
6756
}
6857

69-
initCollapsibleLinks(): void {
58+
initCollapsibleLinks() {
7059
// Initialize collapsible elements
7160
$('.collapsible').collapsible();
7261
}
73-
74-
fixCloseOnClick() {
75-
// Fix side navigation closeOnClick for non-collapsible links
76-
// issue: https://github.com/Dogfalo/materialize/issues/2520
77-
// workaround: https://github.com/Dogfalo/materialize/issues/1426
78-
$(this.sideNav.nativeElement)
79-
.find('li a:not(.collapsible-header)')
80-
.each((index: number, link: Element) => {
81-
const listener = this.renderer.listen(link, 'click', (element: JQueryEventObject) => {
82-
if ($(window).width() < 992) {
83-
$(`#${this.collapseButtonId}`).sideNav('hide');
84-
}
85-
});
86-
this.closeOnClickListeners.push(listener);
87-
});
88-
}
8962
}

0 commit comments

Comments
 (0)