forms-reactive
Version:
Reactive Form Web Component
64 lines (58 loc) • 2.01 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
const index = require('./index-6e930523.js');
const frameworkDelegate = require('./framework-delegate-2cb48fb4.js');
require('./helpers-4dca71bf.js');
const tabCss = ":host(.tab-hidden){display:none !important}";
const IonTabStyle0 = tabCss;
const Tab = class {
constructor(hostRef) {
index.registerInstance(this, hostRef);
this.loaded = false;
this.active = false;
this.delegate = undefined;
this.tab = undefined;
this.component = undefined;
}
async componentWillLoad() {
if (this.active) {
await this.setActive();
}
}
/** Set the active component for the tab */
async setActive() {
await this.prepareLazyLoaded();
this.active = true;
}
changeActive(isActive) {
if (isActive) {
this.prepareLazyLoaded();
}
}
prepareLazyLoaded() {
if (!this.loaded && this.component != null) {
this.loaded = true;
try {
return frameworkDelegate.attachComponent(this.delegate, this.el, this.component, ['ion-page']);
}
catch (e) {
console.error(e);
}
}
return Promise.resolve(undefined);
}
render() {
const { tab, active, component } = this;
return (index.h(index.Host, { key: '2107ece2f1ebdf748bac8adb78a9ad67e7fc9057', role: "tabpanel", "aria-hidden": !active ? 'true' : null, "aria-labelledby": `tab-button-${tab}`, class: {
'ion-page': component === undefined,
'tab-hidden': !active,
} }, index.h("slot", { key: 'b4a1bc1aa79f6b82b8f77b544bcb74e65229b541' })));
}
get el() { return index.getElement(this); }
static get watchers() { return {
"active": ["changeActive"]
}; }
};
Tab.style = IonTabStyle0;
exports.ion_tab = Tab;
//# sourceMappingURL=ion-tab.cjs.entry.js.map