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

Commit fa5aa7a

Browse files
committed
Merge branch 'master' into develop
2 parents 9e5a831 + e13881a commit fa5aa7a

38 files changed

Lines changed: 815 additions & 185 deletions

CHANGELOG.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,132 @@
1+
<a name="0.8.21"></a>
2+
## [0.8.21](https://github.com/fivethree-team/component-library/compare/v0.8.20...v0.8.21) (2019-07-20)
3+
4+
5+
### Bug Fixes
6+
7+
* **FivGallery:** Fix circular dependency in FivGallery and FivGalleryImage ([e1dec01](https://github.com/fivethree-team/component-library/commit/e1dec01))
8+
9+
10+
### Features
11+
12+
* **back-button:** add example page and modal to test the back button functionality ([afcfc88](https://github.com/fivethree-team/component-library/commit/afcfc88))
13+
14+
15+
16+
<a name="0.8.20"></a>
17+
## [0.8.20](https://github.com/fivethree-team/component-library/compare/v0.8.19...v0.8.20) (2019-07-17)
18+
19+
20+
### Bug Fixes
21+
22+
* **back-button:** fix android backbutton blurring out of window when goBack ([5920790](https://github.com/fivethree-team/component-library/commit/5920790))
23+
24+
25+
26+
<a name="0.8.19"></a>
27+
## [0.8.19](https://github.com/fivethree-team/component-library/compare/v0.8.18...v0.8.19) (2019-07-10)
28+
29+
30+
### Features
31+
32+
* **Gallery:** Slide out image when pulled image is not the initial image ([25d95a3](https://github.com/fivethree-team/component-library/commit/25d95a3))
33+
34+
35+
36+
<a name="0.8.18"></a>
37+
## [0.8.18](https://github.com/fivethree-team/component-library/compare/v0.8.15...v0.8.18) (2019-07-10)
38+
39+
40+
### Bug Fixes
41+
42+
* **FivLazyImage:** export FivLazyImage from [@fivethree](https://github.com/fivethree)/core ([c88b500](https://github.com/fivethree-team/component-library/commit/c88b500))
43+
* **gallery:** fix will close output not emitting on pull down ([5600335](https://github.com/fivethree-team/component-library/commit/5600335))
44+
45+
46+
### Features
47+
48+
* **FivLazyImage:** added inViewport boolean to directive ([cf62cb6](https://github.com/fivethree-team/component-library/commit/cf62cb6))
49+
50+
51+
52+
<a name="0.8.17"></a>
53+
## [0.8.17](https://github.com/fivethree-team/component-library/compare/v0.8.15...v0.8.17) (2019-07-10)
54+
55+
56+
### Bug Fixes
57+
58+
* **gallery:** fix will close output not emitting on pull down ([5600335](https://github.com/fivethree-team/component-library/commit/5600335))
59+
60+
61+
### Features
62+
63+
* **FivLazyImage:** added inViewport boolean to directive ([cf62cb6](https://github.com/fivethree-team/component-library/commit/cf62cb6))
64+
65+
66+
67+
<a name="0.8.16"></a>
68+
## [0.8.16](https://github.com/fivethree-team/component-library/compare/v0.8.15...v0.8.16) (2019-07-10)
69+
70+
71+
### Bug Fixes
72+
73+
* **gallery:** fix will close output not emitting on pull down ([5600335](https://github.com/fivethree-team/component-library/commit/5600335))
74+
75+
76+
77+
<a name="0.8.15"></a>
78+
## [0.8.15](https://github.com/fivethree-team/component-library/compare/v0.8.14...v0.8.15) (2019-07-10)
79+
80+
81+
### Bug Fixes
82+
83+
* **gallery:** fix a bug that crashed the gallery while pulling down before the gallery has fully been loaded, configuration options ([f0aa619](https://github.com/fivethree-team/component-library/commit/f0aa619))
84+
85+
86+
87+
<a name="0.8.14"></a>
88+
## [0.8.14](https://github.com/fivethree-team/component-library/compare/v0.8.13...v0.8.14) (2019-07-09)
89+
90+
91+
### Features
92+
93+
* **gallery:** ambient backdrop color input ([fe199a8](https://github.com/fivethree-team/component-library/commit/fe199a8))
94+
95+
96+
97+
<a name="0.8.13"></a>
98+
## [0.8.13](https://github.com/fivethree-team/component-library/compare/v0.8.12...v0.8.13) (2019-07-06)
99+
100+
101+
### Features
102+
103+
* **fivLazyImage:** add virtual input to lazy image ([fed25ad](https://github.com/fivethree-team/component-library/commit/fed25ad))
104+
105+
106+
107+
<a name="0.8.12"></a>
108+
## [0.8.12](https://github.com/fivethree-team/component-library/compare/v0.8.11...v0.8.12) (2019-06-24)
109+
110+
111+
### Bug Fixes
112+
113+
* **pull:** mark all touch event handlers as passive ([9c94409](https://github.com/fivethree-team/component-library/commit/9c94409))
114+
115+
116+
117+
<a name="0.8.11"></a>
118+
## [0.8.11](https://github.com/fivethree-team/component-library/compare/v0.8.9...v0.8.11) (2019-06-24)
119+
120+
121+
### Bug Fixes
122+
123+
* **dialog:** fix horizontal middle position animations ([4083f45](https://github.com/fivethree-team/component-library/commit/4083f45))
124+
* **refresher:** add content min-height ([4680e25](https://github.com/fivethree-team/component-library/commit/4680e25))
125+
* **refresher:** make touchmove listeners passive ([d10a227](https://github.com/fivethree-team/component-library/commit/d10a227))
126+
* **tests:** enable tests ([72c0f4b](https://github.com/fivethree-team/component-library/commit/72c0f4b))
127+
128+
129+
1130
<a name="0.8.10"></a>
2131
## [0.8.10](https://github.com/fivethree-team/component-library/compare/v0.8.9...v0.8.10) (2019-06-10)
3132

config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,5 @@
8282
<plugin name="cordova-plugin-ionic-webview" spec="2.0.0" />
8383
<plugin name="cordova-plugin-ionic-keyboard" spec="2.0.5" />
8484
<engine name="android" spec="8.0.0" />
85-
<engine name="ios" spec="5.0.0" />
85+
<engine name="ios" spec="5.0.1" />
8686
</widget>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fivethree",
3-
"version": "0.8.10",
3+
"version": "0.8.21",
44
"author": "Fivethree Team",
55
"homepage": "https://fivethree.io/",
66
"description": "Fivethree Web Components",

projects/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fivethree/core",
3-
"version": "0.8.10",
3+
"version": "0.8.21",
44
"description": "Fivethree Core Components",
55
"keywords": [
66
"fivethree",
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FivBackButton } from './back-button.component';
4-
import { FivRoutingStateService } from './routing-state.service';
54
import { FivIconModule } from '../icon/icon.module';
65
import { IonicModule } from '@ionic/angular';
76

87
@NgModule({
98
declarations: [FivBackButton],
109
imports: [CommonModule, FivIconModule, IonicModule],
1110
exports: [FivBackButton],
12-
providers: [FivRoutingStateService]
11+
providers: []
1312
})
1413
export class FivBackButtonModule {}

projects/core/src/lib/back-button/routing-state.service.ts

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Injectable } from '@angular/core';
22
import { Router, NavigationEnd } from '@angular/router';
3-
import { filter } from 'rxjs/operators';
3+
import { filter, tap, takeWhile } from 'rxjs/operators';
44
import { NavController, Platform } from '@ionic/angular';
5+
import { Navigateable } from '../interfaces';
6+
import { fromEvent, zip, race, from } from 'rxjs';
57

68
export interface RoutingStateConfig {
79
clearOn: string[];
@@ -12,7 +14,7 @@ export interface RoutingStateConfig {
1214
providedIn: 'root'
1315
})
1416
export class FivRoutingStateService {
15-
private history: string[] = [];
17+
private history: (string | Navigateable)[] = [];
1618
private config: RoutingStateConfig;
1719

1820
constructor(
@@ -32,7 +34,7 @@ export class FivRoutingStateService {
3234
this.pop();
3335
}
3436
// add url to history
35-
this.history = [...this.history, urlAfterRedirects];
37+
this.history.push(urlAfterRedirects);
3638
if (this.config && this.config.clearOn) {
3739
const clear = this.config.clearOn.some(s => s === urlAfterRedirects);
3840
if (clear) {
@@ -42,27 +44,40 @@ export class FivRoutingStateService {
4244
});
4345
}
4446

47+
registerNavigateable(target: Navigateable) {
48+
if (isNavigateable(target)) {
49+
this.history.push(target);
50+
}
51+
}
52+
4553
handleAndroidBackButton() {
46-
this.platform.backButton.subscribeWithPriority(9999, () => {
47-
if (this.getHistory().length <= 1) {
48-
// close the app because we are at root level
49-
navigator['app'].exitApp();
50-
} else {
51-
// go back
54+
this.platform.backButton
55+
.pipe(filter(() => !isNavigateable(this.getCurrentUrl())))
56+
.subscribe(event => {
5257
this.goBack();
53-
}
54-
});
58+
});
59+
60+
this.platform.backButton
61+
.pipe(filter(() => isNavigateable(this.getCurrentUrl())))
62+
.subscribe(event => {
63+
event.register(99999, () => {
64+
this.goBack('/');
65+
});
66+
});
5567
}
5668

57-
public getHistory(): string[] {
69+
public getHistory(): (string | Navigateable)[] {
5870
return this.history;
5971
}
6072

61-
public getPreviousUrl(defaultHref = '/'): string {
62-
return this.history[this.history.length - 2] || defaultHref;
73+
public getPreviousUrl(defaultHref = '/'): string | Navigateable {
74+
if (this.history.length > 2) {
75+
return this.history[this.history.length - 2];
76+
}
77+
return defaultHref;
6378
}
6479

65-
public pop(): string {
80+
public pop(): string | Navigateable {
6681
return this.history.pop();
6782
}
6883

@@ -84,11 +99,40 @@ export class FivRoutingStateService {
8499
}
85100
}
86101

87-
public getCurrentUrl(): string {
102+
public getCurrentUrl(): string | Navigateable {
88103
return this.history[this.history.length - 1];
89104
}
90105

91106
goBack(defaultHref = '/') {
92-
this.navCtrl.navigateBack(this.getPreviousUrl(defaultHref));
107+
if (this.getHistory().length <= 1) {
108+
// close the app because we are at root level
109+
return navigator['app'].exitApp();
110+
}
111+
const current = this.getCurrentUrl();
112+
if (typeof current !== 'string' && isNavigateable(current)) {
113+
current.dismiss();
114+
return this.pop();
115+
}
116+
117+
const previous = this.getPreviousUrl(defaultHref);
118+
if (typeof previous === 'string') {
119+
return this.navCtrl.navigateBack(previous);
120+
}
121+
if (isNavigateable(previous)) {
122+
return this.navCtrl.navigateBack(this.getLatestUrl(defaultHref));
123+
}
124+
}
125+
126+
getLatestUrl(defaultHref: string): string {
127+
const urls = this.history.filter(e => !!(typeof e === 'string'));
128+
const latest = urls[urls.length - 1];
129+
if (urls.length > 0 && latest && typeof latest === 'string') {
130+
return latest;
131+
}
132+
return defaultHref;
93133
}
94134
}
135+
136+
export function isNavigateable(object: any): boolean {
137+
return !!object && object.dismiss !== undefined;
138+
}

projects/core/src/lib/dialog/dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[@fade]="{value: dialogState, params: { opacity: 0, inDuration: '120ms' }}" (click)="backdropClick()" class="backdrop">
55
</ion-content>
66
<div #dialog [@fade]="{value: dialogState, params: { opacity: 0, inDuration: '120ms' }}"
7-
[@slide]="{value: dialogState, params: {top: outPosition, inDuration: inDuration + 'ms',outDuration: outDuration + 'ms', toPosition: toPosition, translate: translate}}"
7+
[@slide]="{value: dialogState, params: {top: outPosition, inDuration: inDuration + 'ms',outDuration: outDuration + 'ms', toPosition: toPosition, translate: translate,translateX: horizontalAlign === 'middle' ? 'translateX(-50%)' : '' }}"
88
(@slide.done)="animationDone($event)" class="dialog" [ngClass]="[verticalAlign, horizontalAlign, shape]">
99
<ng-container>
1010
<ng-container *ngTemplateOutlet="card"></ng-container>

projects/core/src/lib/dialog/dialog.component.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,60 +28,60 @@ export type Content<T> = TemplateRef<T> | Type<T>;
2828
animations: [
2929
trigger('slide', [
3030
transition('out => top', [
31-
style({ top: '0', transform: 'translateY(-100%)' }),
31+
style({ top: '0', transform: 'translateY(-100%) {{translateX}}' }),
3232
animate('220ms ease-out')
3333
]),
3434
transition('out => center', [
3535
style({
3636
top: '50%',
37-
transform: 'translateY(-50%) scale(0)',
37+
transform: 'translateY(-50%) {{translateX}} scale(0)',
3838
opacity: 0
3939
}),
4040
animate(
4141
'220ms ease-out',
4242
style({
4343
top: '50%',
44-
transform: 'translateY(-50%) scale(1)',
44+
transform: 'translateY(-50%) {{translateX}} scale(1)',
4545
opacity: 1
4646
})
4747
)
4848
]),
4949
transition('out => bottom', [
50-
style({ bottom: '0', transform: 'translateY(100%)' }),
50+
style({ bottom: '0', transform: 'translateY(100%) {{translateX}}' }),
5151
animate('220ms ease-out')
5252
]),
5353
transition('top => out', [
54-
style({ top: '0', transform: 'translateY(0)' }),
54+
style({ top: '0', transform: '*' }),
5555
animate(
5656
'140ms ease-in',
57-
style({ top: '0', transform: 'translateY(-100%)' })
57+
style({ top: '0', transform: 'translateY(-100%) {{translateX}}' })
5858
)
5959
]),
6060
transition('center => out', [
6161
style({
6262
top: '50%',
63-
transform: 'translateY(-50%) scale(1)',
63+
transform: '*',
6464
opacity: 1
6565
}),
6666
animate(
6767
'140ms ease-in',
6868
style({
6969
top: '50%',
70-
transform: 'translateY(-50%) scale(0)',
70+
transform: 'translateY(-50%) {{translateX}} scale(0)',
7171
opacity: 0
7272
})
7373
)
7474
]),
7575
transition('bottom => out', [
76-
style({ bottom: '0', transform: 'translateY(0)' }),
76+
style({ bottom: '0', transform: '*' }),
7777
animate(
7878
'140ms ease-in',
79-
style({ bottom: '0', transform: 'translateY(100%)' })
79+
style({ bottom: '0', transform: 'translateY(100%) {{translateX}}' })
8080
)
8181
]),
82-
state('bottom', style({ bottom: '0', transform: 'translateY(0)' })),
83-
state('top', style({ top: '0', transform: 'translateY(0)' })),
84-
state('center', style({ top: '50%', transform: 'translateY(-50%)' }))
82+
// state('bottom', style({ bottom: '0', transform: '*' })),
83+
// state('top', style({ top: '0', transform: '*' })),
84+
// state('center', style({ top: '50%', transform: 'translateY(-50%) {{translateX}}' }))
8585
]),
8686
trigger('fade', [
8787
transition(
@@ -131,13 +131,13 @@ export class FivDialog implements OnInit {
131131
dialogState: 'top' | 'center' | 'bottom' | 'out' = 'out';
132132
currentPullProgress: number;
133133

134-
ngOnInit(): void {}
134+
ngOnInit(): void { }
135135

136136
constructor(
137137
private renderer: Renderer2,
138138
private domCtrl: DomController,
139139
private animation: AnimationBuilder
140-
) {}
140+
) { }
141141

142142
open() {
143143
this.overlay.show(this.priority);

0 commit comments

Comments
 (0)