@ionic/core
Version:
Base components for Ionic
66 lines (65 loc) • 1.91 kB
JavaScript
import { createColorClasses } from '../../utils/theme';
export class Label {
constructor() {
this.noAnimate = false;
}
componentWillLoad() {
this.noAnimate = (this.position === 'floating');
this.emitStyle();
}
componentDidLoad() {
if (this.noAnimate) {
setTimeout(() => {
this.noAnimate = false;
}, 1000);
}
}
positionChanged() {
this.emitStyle();
}
emitStyle() {
const position = this.position;
this.ionStyle.emit({
'label': true,
[`label-${position}`]: position !== undefined
});
}
hostData() {
const position = this.position;
return {
class: Object.assign({}, createColorClasses(this.color), { [`label-${position}`]: position !== undefined, [`label-no-animate`]: (this.noAnimate) })
};
}
static get is() { return "ion-label"; }
static get encapsulation() { return "scoped"; }
static get properties() { return {
"color": {
"type": String,
"attr": "color"
},
"el": {
"elementRef": true
},
"mode": {
"type": String,
"attr": "mode"
},
"noAnimate": {
"state": true
},
"position": {
"type": String,
"attr": "position",
"watchCallbacks": ["positionChanged"]
}
}; }
static get events() { return [{
"name": "ionStyle",
"method": "ionStyle",
"bubbles": true,
"cancelable": true,
"composed": true
}]; }
static get style() { return "/**style-placeholder:ion-label:**/"; }
static get styleMode() { return "/**style-id-placeholder:ion-label:**/"; }
}