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

Commit e0b3abf

Browse files
feat(demo): add demo to show fxHide with used with custom breakpoint
Add demo showing custom breakpoint working with `fxHide.yba-min-height` Refs #961.
1 parent 7d2db14 commit e0b3abf

File tree

9 files changed

+155
-55
lines changed

9 files changed

+155
-55
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"karma-coverage": "^1.1.2",
100100
"karma-firefox-launcher": "^1.0.1",
101101
"karma-jasmine": "^1.1.2",
102-
"karma-sauce-launcher": "^1.2.0",
102+
"karma-sauce-launcher": "^2.0.2",
103103
"karma-sourcemap-loader": "^0.3.7",
104104
"magic-string": "^0.22.5",
105105
"merge2": "^1.2.3",

src/apps/demo-app/src/app/app.module.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ import {FlexLayoutModule, BREAKPOINT} from '@angular/flex-layout';
66
import {RoutingModule} from './routing.module';
77
import {AppComponent} from './app.component';
88
import {DemoMaterialModule} from './material.module';
9+
import {
10+
YBA_BREAKPOINT_PROVIDER
11+
} from './stack-overflow/hide-custom-bp/hide-with-custom-bp.component';
912
import {WatermarkComponent} from './watermark.component';
1013

11-
const EXTRA_BREAKPOINT = [{
14+
const EXTRA_BREAKPOINTS = [{
1215
alias: 'xs.landscape',
1316
suffix: 'XsLandscape',
1417
mediaQuery: 'screen and (orientation: landscape) and (max-width: 559px)',
@@ -18,7 +21,8 @@ const EXTRA_BREAKPOINT = [{
1821

1922
@NgModule({
2023
declarations: [
21-
AppComponent, WatermarkComponent
24+
AppComponent,
25+
WatermarkComponent
2226
],
2327
imports: [
2428
BrowserModule.withServerTransition({ appId: 'serverApp' }),
@@ -30,7 +34,14 @@ const EXTRA_BREAKPOINT = [{
3034
printWithBreakpoints: ['md', 'lt-lg', 'lt-xl', 'gt-sm', 'gt-xs']
3135
}),
3236
],
33-
providers: [{provide: BREAKPOINT, useValue: EXTRA_BREAKPOINT, multi: true}],
37+
providers: [
38+
YBA_BREAKPOINT_PROVIDER,
39+
{
40+
provide: BREAKPOINT,
41+
useValue: EXTRA_BREAKPOINTS,
42+
multi: true
43+
}
44+
],
3445
bootstrap: [AppComponent]
3546
})
3647
export class AppModule { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.bounds {
2+
background-color:#ddd;
3+
height :800px;
4+
}
5+
6+
.sec1 {
7+
background: red;
8+
color:white;
9+
text-transform: uppercase;
10+
padding: 20px;
11+
}
12+
13+
.sec2 {
14+
background: yellow;
15+
color:blue;
16+
padding: 20px;
17+
}
18+
19+
.sec3 {
20+
background: blue;
21+
color:white;
22+
text-transform: uppercase;
23+
padding: 20px;
24+
}
25+
26+
.sec1, .sec2, .sec3 {
27+
padding-top:20px;
28+
text-align:center
29+
}
30+
31+
.content {
32+
min-width: 300px;
33+
/*height: 400px;*/
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import {Component, Directive} from '@angular/core';
2+
import {BREAKPOINT, ShowHideDirective} from '@angular/flex-layout';
3+
4+
const YBA_BREAKPOINT = {
5+
alias: 'yba',
6+
suffix: 'Yba',
7+
mediaQuery: 'screen and (max-height: 600px)',
8+
overlapping: false,
9+
};
10+
11+
export const YBA_BREAKPOINT_PROVIDER = {
12+
provide: BREAKPOINT,
13+
useValue: [YBA_BREAKPOINT],
14+
multi: true
15+
};
16+
17+
const inputs = ['fxHide', 'fxHide.yba'];
18+
const selector = `[fxHide], [fxHide.yba]`;
19+
20+
@Directive({selector, inputs})
21+
export class CustomHideDirective extends ShowHideDirective {
22+
protected inputs = inputs;
23+
}
24+
25+
@Component({
26+
selector: 'demo-hide-custom-bp',
27+
styleUrls: [
28+
'hide-custom-bp.component.scss'
29+
],
30+
template: `
31+
<mat-card class="card-demo">
32+
<mat-card-title><a
33+
href="http://bit.ly/2D2dAxM"
34+
target="_blank">StackBlitz</a></mat-card-title>
35+
<mat-card-subtitle>Hide when height < 800px using custom breakpoint <span
36+
style="font-weight: bold; color: #7a7af7;">fxHide.yba</span>
37+
</mat-card-subtitle>
38+
<mat-card-content>
39+
<div class="content"
40+
fxHide.yba
41+
fxLayout="row"
42+
fxLayout.md="column"
43+
fxFlexFill>
44+
45+
<div fxFlex="15" fxFlex.md="55" class="sec1" fxFlex.xs="55">
46+
first-section
47+
</div>
48+
<div fxFlex="30" fxFlex.md="15" class="sec2">
49+
second-section
50+
</div>
51+
<div fxFlex="55" fxFlex.md="30" class="sec3" fxFlex.xs="15">
52+
third-section
53+
</div>
54+
55+
</div>
56+
</mat-card-content>
57+
<mat-card-footer class="bottomPad">
58+
<div class="hint">&lt;div fxLayout="row" fxLayout.xs="column" fxFlexFill fxHide.yba &gt;
59+
</div>
60+
</mat-card-footer>
61+
</mat-card>
62+
`
63+
})
64+
export class HideWithCustomBPComponent {
65+
}
66+
67+

src/apps/demo-app/src/app/stack-overflow/stack-overflow.module.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ import {FlexLayoutModule} from '@angular/flex-layout';
55
import {MatCardModule} from '@angular/material/card';
66

77
import {StackOverflowComponent} from './stack-overflow/stack-overflow.component';
8-
import {
9-
ComplexColumnOrderingComponent
10-
} from './complex-column-ordering/complex-column-ordering.component';
118
import {GridAreaRowSpanComponent} from './grid-area-row-span/grid-area-row-span.component';
129
import {GridColumnSpanComponent} from './grid-column-span/grid-column-span.component';
1310
import {MozHolyGrailComponent} from './moz-holy-grail/moz-holy-grail.component';
1411
import {RoutingModule} from './routing.module';
12+
import {
13+
ComplexColumnOrderingComponent
14+
} from './complex-column-ordering/complex-column-ordering.component';
15+
import {
16+
HideWithCustomBPComponent,
17+
CustomHideDirective
18+
} from './hide-custom-bp/hide-with-custom-bp.component';
1519

1620
@NgModule({
1721
imports: [
@@ -27,6 +31,8 @@ import {RoutingModule} from './routing.module';
2731
GridAreaRowSpanComponent,
2832
GridColumnSpanComponent,
2933
MozHolyGrailComponent,
34+
CustomHideDirective,
35+
HideWithCustomBPComponent
3036
]
3137
})
3238
export class DocsStackOverflowModule {}

src/apps/demo-app/src/app/stack-overflow/stack-overflow/stack-overflow.component.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {Component} from '@angular/core';
33
@Component({
44
selector: 'demo-stack-overflow',
55
template: `
6+
<demo-hide-custom-bp></demo-hide-custom-bp>
67
<demo-moz-holy-grail class='small-demo'></demo-moz-holy-grail>
78
<demo-complex-column-ordering></demo-complex-column-ordering>
89
<demo-grid-area-row-span></demo-grid-area-row-span>

src/apps/demo-app/src/styles.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ div.colored > div:nth-child(10n+7), .seven {
144144
}
145145

146146
.hint {
147-
margin: 5px 5px 0;
147+
margin: 5px 5px 0 20px;
148148
font-size: 0.9em;
149149
color: #a3a3a3;
150150
}
@@ -324,7 +324,7 @@ mat-card-content pre {
324324
.hint {
325325
color: #a3a3a3;
326326
font-size: 0.9em;
327-
margin: 5px 5px 0;
327+
margin: 5px 5px 0 20px;
328328
}
329329

330330
.forceAbove {

src/lib/core/media-marshaller/media-marshaller.ts

-3
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,12 @@ export class MediaMarshaller {
7474
if (mc.matches && this.activatedBreakpoints.indexOf(bp) === -1) {
7575
this.activatedBreakpoints.push(bp);
7676
this.activatedBreakpoints.sort(sortDescendingPriority);
77-
7877
this.updateStyles();
7978

8079
} else if (!mc.matches && this.activatedBreakpoints.indexOf(bp) !== -1) {
8180
// Remove the breakpoint when it's deactivated
8281
this.activatedBreakpoints.splice(this.activatedBreakpoints.indexOf(bp), 1);
8382
this.activatedBreakpoints.sort(sortDescendingPriority);
84-
8583
this.updateStyles();
8684
}
8785
}
@@ -338,4 +336,3 @@ function initBuilderMap(map: BuilderMap,
338336
oldMap.set(key, input);
339337
}
340338
}
341-

yarn.lock

+27-43
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ archiver-utils@^1.3.0:
967967
normalize-path "^2.0.0"
968968
readable-stream "^2.0.0"
969969

970-
archiver@2.1.1, archiver@^2.1.1:
970+
archiver@^2.1.1:
971971
version "2.1.1"
972972
resolved "https://registry.yarnpkg.com/archiver/-/archiver-2.1.1.tgz#ff662b4a78201494a3ee544d3a33fe7496509ebc"
973973
integrity sha1-/2YrSnggFJSj7lRNOjP+dJZQnrw=
@@ -1183,13 +1183,6 @@ async@1.x, async@^1.3.0, async@^1.5.2:
11831183
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
11841184
integrity sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=
11851185

1186-
async@2.0.1:
1187-
version "2.0.1"
1188-
resolved "https://registry.yarnpkg.com/async/-/async-2.0.1.tgz#b709cc0280a9c36f09f4536be823c838a9049e25"
1189-
integrity sha1-twnMAoCpw28J9FNr6CPIOKkEniU=
1190-
dependencies:
1191-
lodash "^4.8.0"
1192-
11931186
async@2.6.0:
11941187
version "2.6.0"
11951188
resolved "https://registry.yarnpkg.com/async/-/async-2.6.0.tgz#61a29abb6fcc026fea77e56d1c6ec53a795951f4"
@@ -5952,15 +5945,14 @@ karma-parallel@^0.3.1:
59525945
istanbul "^0.4.5"
59535946
lodash "^4.17.11"
59545947

5955-
karma-sauce-launcher@^1.2.0:
5956-
version "1.2.0"
5957-
resolved "https://registry.yarnpkg.com/karma-sauce-launcher/-/karma-sauce-launcher-1.2.0.tgz#6f2558ddef3cf56879fa27540c8ae9f8bfd16bca"
5958-
integrity sha512-lEhtGRGS+3Yw6JSx/vJY9iQyHNtTjcojrSwNzqNUOaDceKDu9dPZqA/kr69bUO9G2T6GKbu8AZgXqy94qo31Jg==
5948+
karma-sauce-launcher@^2.0.2:
5949+
version "2.0.2"
5950+
resolved "https://registry.yarnpkg.com/karma-sauce-launcher/-/karma-sauce-launcher-2.0.2.tgz#dbf98e70d86bf287b03a537cf637eb7aefa975c3"
5951+
integrity sha512-jLUFaJhHMcKpxFWUesyWYihzM5FvQiJsDwGcCtKeOy2lsWhkVw0V0Byqb1d+wU6myU1mribBtsIcub23HS4kWA==
59595952
dependencies:
5960-
q "^1.5.0"
5961-
sauce-connect-launcher "^1.2.2"
5962-
saucelabs "^1.4.0"
5963-
wd "^1.4.0"
5953+
sauce-connect-launcher "^1.2.4"
5954+
saucelabs "^1.5.0"
5955+
selenium-webdriver "^4.0.0-alpha.1"
59645956

59655957
karma-sourcemap-loader@^0.3.7:
59665958
version "0.3.7"
@@ -6469,11 +6461,6 @@ lodash.values@^2.4.1, lodash.values@~2.4.1:
64696461
dependencies:
64706462
lodash.keys "~2.4.1"
64716463

6472-
lodash@4.17.11, lodash@^4.0.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.16.6, lodash@^4.17.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.8.0, lodash@~4.17.10:
6473-
version "4.17.11"
6474-
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
6475-
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
6476-
64776464
lodash@4.17.5:
64786465
version "4.17.5"
64796466
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
@@ -6484,6 +6471,11 @@ lodash@^3.10.1:
64846471
resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
64856472
integrity sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=
64866473

6474+
lodash@^4.0.0, lodash@^4.13.1, lodash@^4.14.0, lodash@^4.16.6, lodash@^4.17.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0, lodash@^4.8.0, lodash@~4.17.10:
6475+
version "4.17.11"
6476+
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d"
6477+
integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==
6478+
64876479
lodash@~1.0.1:
64886480
version "1.0.2"
64896481
resolved "https://registry.yarnpkg.com/lodash/-/lodash-1.0.2.tgz#8f57560c83b59fc270bd3d561b690043430e2551"
@@ -8233,7 +8225,7 @@ q@1.4.1:
82338225
resolved "https://registry.yarnpkg.com/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e"
82348226
integrity sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=
82358227

8236-
q@^1.4.1, q@^1.5.0, q@^1.5.1, q@~1.5.0:
8228+
q@^1.4.1, q@^1.5.1, q@~1.5.0:
82378229
version "1.5.1"
82388230
resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7"
82398231
integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=
@@ -8618,7 +8610,7 @@ replace-homedir@^1.0.0:
86188610
is-absolute "^1.0.0"
86198611
remove-trailing-separator "^1.1.0"
86208612

8621-
request@2.88.0, request@^2.55.0, request@^2.72.0, request@^2.74.0, request@^2.79.0, request@^2.81.0, request@^2.85.0, request@^2.87.0, request@^2.88.0:
8613+
request@^2.55.0, request@^2.72.0, request@^2.74.0, request@^2.79.0, request@^2.81.0, request@^2.85.0, request@^2.87.0, request@^2.88.0:
86228614
version "2.88.0"
86238615
resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef"
86248616
integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==
@@ -8885,7 +8877,7 @@ sass-graph@^2.2.4:
88858877
scss-tokenizer "^0.2.3"
88868878
yargs "^7.0.0"
88878879

8888-
sauce-connect-launcher@^1.2.2:
8880+
sauce-connect-launcher@^1.2.4:
88898881
version "1.2.4"
88908882
resolved "https://registry.yarnpkg.com/sauce-connect-launcher/-/sauce-connect-launcher-1.2.4.tgz#8d38f85242a9fbede1b2303b559f7e20c5609a1c"
88918883
integrity sha512-X2vfwulR6brUGiicXKxPm1GJ7dBEeP1II450Uv4bHGrcGOapZNgzJvn9aioea5IC5BPp/7qjKdE3xbbTBIVXMA==
@@ -8896,7 +8888,7 @@ sauce-connect-launcher@^1.2.2:
88968888
lodash "^4.16.6"
88978889
rimraf "^2.5.4"
88988890

8899-
saucelabs@^1.4.0, saucelabs@^1.5.0:
8891+
saucelabs@^1.5.0:
89008892
version "1.5.0"
89018893
resolved "https://registry.yarnpkg.com/saucelabs/-/saucelabs-1.5.0.tgz#9405a73c360d449b232839919a86c396d379fd9d"
89028894
integrity sha512-jlX3FGdWvYf4Q3LFfFWS1QvPg3IGCGWxIc8QBFdPTbpTJnt/v17FHXYVAn7C8sHf1yUXo2c7yIM0isDryfYtHQ==
@@ -8939,6 +8931,16 @@ selenium-webdriver@3.6.0, "selenium-webdriver@>= 2.53.1", selenium-webdriver@^3.
89398931
tmp "0.0.30"
89408932
xml2js "^0.4.17"
89418933

8934+
selenium-webdriver@^4.0.0-alpha.1:
8935+
version "4.0.0-alpha.1"
8936+
resolved "https://registry.yarnpkg.com/selenium-webdriver/-/selenium-webdriver-4.0.0-alpha.1.tgz#cc93415e21d2dc1dfd85dfc5f6b55f3ac53933b1"
8937+
integrity sha512-z88rdjHAv3jmTZ7KSGUkTvo4rGzcDGMq0oXWHNIDK96Gs31JKVdu9+FMtT4KBrVoibg8dUicJDok6GnqqttO5Q==
8938+
dependencies:
8939+
jszip "^3.1.3"
8940+
rimraf "^2.5.4"
8941+
tmp "0.0.30"
8942+
xml2js "^0.4.17"
8943+
89428944
semver-diff@^2.0.0:
89438945
version "2.1.0"
89448946
resolved "https://registry.yarnpkg.com/semver-diff/-/semver-diff-2.1.0.tgz#4bbb8437c8d37e4b0cf1a68fd726ec6d645d6d36"
@@ -10601,11 +10603,6 @@ validate.js@^0.12.0:
1060110603
resolved "https://registry.yarnpkg.com/validate.js/-/validate.js-0.12.0.tgz#17f989e37c192ea2f826bbf19bf4e97e6e4be68f"
1060210604
integrity sha512-/x2RJSvbqEyxKj0RPN4xaRquK+EggjeVXiDDEyrJzsJogjtiZ9ov7lj/svVb4DM5Q5braQF4cooAryQbUwOxlA==
1060310605

10604-
vargs@0.1.0:
10605-
version "0.1.0"
10606-
resolved "https://registry.yarnpkg.com/vargs/-/vargs-0.1.0.tgz#6b6184da6520cc3204ce1b407cac26d92609ebff"
10607-
integrity sha1-a2GE2mUgzDIEzhtAfKwm2SYJ6/8=
10608-
1060910606
vary@~1.1.2:
1061010607
version "1.1.2"
1061110608
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
@@ -10709,19 +10706,6 @@ void-elements@^2.0.0:
1070910706
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec"
1071010707
integrity sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=
1071110708

10712-
wd@^1.4.0:
10713-
version "1.11.1"
10714-
resolved "https://registry.yarnpkg.com/wd/-/wd-1.11.1.tgz#21a33e21977ad20522bb189f6529c3b55ac3862c"
10715-
integrity sha512-XNK6EbOrXF7cG8f3pbps6mb/+xPGZH2r1AL1zGJluGynA/Xt6ip1Tvqj2AkavyDFworreaGXoe+0AP/r7EX9pg==
10716-
dependencies:
10717-
archiver "2.1.1"
10718-
async "2.0.1"
10719-
lodash "4.17.11"
10720-
mkdirp "^0.5.1"
10721-
q "1.4.1"
10722-
request "2.88.0"
10723-
vargs "0.1.0"
10724-
1072510709
webdriver-js-extender@2.1.0:
1072610710
version "2.1.0"
1072710711
resolved "https://registry.yarnpkg.com/webdriver-js-extender/-/webdriver-js-extender-2.1.0.tgz#57d7a93c00db4cc8d556e4d3db4b5db0a80c3bb7"

0 commit comments

Comments
 (0)