fix(label): inline position by default

This commit is contained in:
Manu Mtz.-Almeida
2018-04-13 17:36:33 +02:00
parent b1ee4b8e3a
commit fde878baf3
4 changed files with 12 additions and 16 deletions

View File

@ -14,9 +14,9 @@
} }
}, },
"@stencil/core": { "@stencil/core": {
"version": "0.7.22", "version": "0.7.23",
"resolved": "https://registry.npmjs.org/@stencil/core/-/core-0.7.22.tgz", "resolved": "https://registry.npmjs.org/@stencil/core/-/core-0.7.23.tgz",
"integrity": "sha512-DKZU73P6DaWA58sIWiu1jlSY6KBjRaOl3xzQjDFjktoQWZTNgC0mZLExTbPp21CaqsVmyGJjDxnQzy+Ja931fg==", "integrity": "sha512-12gdCOmVWt1zqo3q757mlWCnSHvJGJNuc8Sxv1YvRfzhzoGjJNPzjBabpTODQXAGRvvblbyCbwrIqyYC1qyM+A==",
"dev": true, "dev": true,
"requires": { "requires": {
"chokidar": "2.0.3", "chokidar": "2.0.3",

View File

@ -24,7 +24,7 @@
"ionicons": "4.0.0-19" "ionicons": "4.0.0-19"
}, },
"devDependencies": { "devDependencies": {
"@stencil/core": "0.7.22", "@stencil/core": "0.7.23",
"@stencil/dev-server": "latest", "@stencil/dev-server": "latest",
"@stencil/sass": "0.0.3", "@stencil/sass": "0.0.3",
"@stencil/utils": "latest", "@stencil/utils": "latest",

View File

@ -3013,7 +3013,7 @@ declare global {
/** /**
* The position determines where and how the label behaves inside an item. Possible values are: 'inline' | 'fixed' | 'stacked' | 'floating' * The position determines where and how the label behaves inside an item. Possible values are: 'inline' | 'fixed' | 'stacked' | 'floating'
*/ */
'position': 'inline' | 'fixed' | 'stacked' | 'floating' | undefined; 'position': 'fixed' | 'stacked' | 'floating';
} }
} }
@ -3051,7 +3051,7 @@ declare global {
/** /**
* The position determines where and how the label behaves inside an item. Possible values are: 'inline' | 'fixed' | 'stacked' | 'floating' * The position determines where and how the label behaves inside an item. Possible values are: 'inline' | 'fixed' | 'stacked' | 'floating'
*/ */
'position'?: 'inline' | 'fixed' | 'stacked' | 'floating' | undefined; 'position'?: 'fixed' | 'stacked' | 'floating';
} }
} }
} }

View File

@ -32,7 +32,7 @@ export class Label {
* The position determines where and how the label behaves inside an item. * The position determines where and how the label behaves inside an item.
* Possible values are: 'inline' | 'fixed' | 'stacked' | 'floating' * Possible values are: 'inline' | 'fixed' | 'stacked' | 'floating'
*/ */
@Prop({mutable: true}) position: 'inline' | 'fixed' | 'stacked' | 'floating' | undefined; @Prop() position?: 'fixed' | 'stacked' | 'floating';
/** /**
* Emitted when the styles change. * Emitted when the styles change.
@ -44,28 +44,24 @@ export class Label {
return this.el.textContent || ''; return this.el.textContent || '';
} }
componentWillLoad() {
if (this.position === undefined) {
this.position = (this.mode === 'ios') ? 'inline' : 'floating';
}
}
componentDidLoad() { componentDidLoad() {
this.positionChanged(); this.positionChanged();
} }
@Watch('position') @Watch('position')
positionChanged() { positionChanged() {
const position = this.position;
return this.ionStyle.emit({ return this.ionStyle.emit({
[`label-${this.position}`]: true, [`label-${position}`]: !!position,
}); });
} }
hostData() { hostData() {
const position = this.position;
return { return {
class: { class: {
[`label-${this.position}`]: true, [`label-${position}`]: !!position,
[`label-${this.mode}-${this.position}`]: true [`label-${this.mode}-${position}`]: !!position
} }
}; };
} }