fix(fab-button): add routerDirection

fixes #15551
This commit is contained in:
Manu Mtz.-Almeida
2018-09-11 17:49:36 +02:00
parent fcb45d12e2
commit 239863465c
4 changed files with 31 additions and 13 deletions

View File

@ -239,12 +239,12 @@ export class Fab {
} }
export declare interface FabButton extends StencilComponents<'IonFabButton'> {} export declare interface FabButton extends StencilComponents<'IonFabButton'> {}
@Component({ selector: 'ion-fab-button', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '<ng-content></ng-content>', inputs: ['mode', 'color', 'activated', 'disabled', 'href', 'translucent', 'show'] }) @Component({ selector: 'ion-fab-button', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '<ng-content></ng-content>', inputs: ['mode', 'color', 'activated', 'disabled', 'routerDirection', 'href', 'translucent', 'show'] })
export class FabButton { export class FabButton {
constructor(r: ElementRef) { constructor(r: ElementRef) {
const el = r.nativeElement; const el = r.nativeElement;
proxyInputs(this, el, ['mode', 'color', 'activated', 'disabled', 'href', 'translucent', 'show']); proxyInputs(this, el, ['mode', 'color', 'activated', 'disabled', 'routerDirection', 'href', 'translucent', 'show']);
} }
} }

View File

@ -1398,6 +1398,10 @@ export namespace Components {
*/ */
'mode': Mode; 'mode': Mode;
/** /**
* When using a router, it specifies the transition direction when navigating to another page using `href`.
*/
'routerDirection'?: RouterDirection;
/**
* If true, the fab button will show when in a fab-list. * If true, the fab button will show when in a fab-list.
*/ */
'show': boolean; 'show': boolean;
@ -1428,6 +1432,10 @@ export namespace Components {
*/ */
'mode'?: Mode; 'mode'?: Mode;
/** /**
* When using a router, it specifies the transition direction when navigating to another page using `href`.
*/
'routerDirection'?: RouterDirection;
/**
* If true, the fab button will show when in a fab-list. * If true, the fab button will show when in a fab-list.
*/ */
'show'?: boolean; 'show'?: boolean;

View File

@ -1,7 +1,7 @@
import { Component, Element, Prop } from '@stencil/core'; import { Component, Element, Prop } from '@stencil/core';
import { Color, CssClassMap, Mode } from '../../interface'; import { Color, CssClassMap, Mode, RouterDirection } from '../../interface';
import { createColorClasses } from '../../utils/theme'; import { createColorClasses, openURL } from '../../utils/theme';
@Component({ @Component({
tag: 'ion-fab-button', tag: 'ion-fab-button',
@ -14,6 +14,8 @@ import { createColorClasses } from '../../utils/theme';
export class FabButton { export class FabButton {
private inList = false; private inList = false;
@Prop({ context: 'window' }) win!: Window;
@Element() el!: HTMLElement; @Element() el!: HTMLElement;
/** /**
@ -39,6 +41,12 @@ export class FabButton {
*/ */
@Prop() disabled = false; @Prop() disabled = false;
/**
* When using a router, it specifies the transition direction when navigating to
* another page using `href`.
*/
@Prop() routerDirection?: RouterDirection;
/** /**
* Contains a URL or a URL fragment that the hyperlink points to. * Contains a URL or a URL fragment that the hyperlink points to.
* If this property is set, an anchor tag will be rendered. * If this property is set, an anchor tag will be rendered.
@ -94,6 +102,7 @@ export class FabButton {
class="fab-button-native" class="fab-button-native"
disabled={this.disabled} disabled={this.disabled}
href={this.href} href={this.href}
onClick={ev => openURL(this.win, this.href, ev, this.routerDirection)}
> >
<span class="fab-button-close-icon"> <span class="fab-button-close-icon">
<ion-icon name="close" lazy={false}></ion-icon> <ion-icon name="close" lazy={false}></ion-icon>

View File

@ -9,15 +9,16 @@ If the FAB button is not wrapped with `<ion-fab>`, it will scroll with the conte
## Properties ## Properties
| Property | Attribute | Description | Type | | Property | Attribute | Description | Type |
| ------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | | ----------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| `activated` | `activated` | If true, the fab button will be show a close icon. Defaults to `false`. | `boolean` | | `activated` | `activated` | If true, the fab button will be show a close icon. Defaults to `false`. | `boolean` |
| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `Color` | | `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `Color` |
| `disabled` | `disabled` | If true, the user cannot interact with the fab button. Defaults to `false`. | `boolean` | | `disabled` | `disabled` | If true, the user cannot interact with the fab button. Defaults to `false`. | `boolean` |
| `href` | `href` | Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. | `string` | | `href` | `href` | Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. | `string` |
| `mode` | `mode` | The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`. | `Mode` | | `mode` | `mode` | The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`. | `Mode` |
| `show` | `show` | If true, the fab button will show when in a fab-list. | `boolean` | | `routerDirection` | `router-direction` | When using a router, it specifies the transition direction when navigating to another page using `href`. | `RouterDirection` |
| `translucent` | `translucent` | If true, the fab button will be translucent. Defaults to `false`. | `boolean` | | `show` | `show` | If true, the fab button will show when in a fab-list. | `boolean` |
| `translucent` | `translucent` | If true, the fab button will be translucent. Defaults to `false`. | `boolean` |
---------------------------------------------- ----------------------------------------------