forms-reactive
Version:
Reactive Form Web Component
62 lines (59 loc) • 4.33 kB
JavaScript
import { r as registerInstance, h, H as Host, e as getElement } from './index-c364827c.js';
import { E as ENABLE_HTML_CONTENT_DEFAULT, s as sanitizeDOMString } from './index-90d51ece.js';
import { t as caretBackSharp, u as arrowDown } from './index-4fe22e32.js';
import { c as config, g as getIonMode } from './ionic-global-9c20d605.js';
import { e as supportsRubberBandScrolling } from './refresher.utils-0ee85a55.js';
import { S as SPINNERS } from './spinner-configs-839148f8.js';
import './animation-45b3e295.js';
import './index-51ff1772.js';
import './helpers-609e93da.js';
const RefresherContent = class {
constructor(hostRef) {
registerInstance(this, hostRef);
this.customHTMLEnabled = config.get('innerHTMLTemplatesEnabled', ENABLE_HTML_CONTENT_DEFAULT);
this.pullingIcon = undefined;
this.pullingText = undefined;
this.refreshingSpinner = undefined;
this.refreshingText = undefined;
}
componentWillLoad() {
if (this.pullingIcon === undefined) {
/**
* The native iOS refresher uses a spinner instead of
* an icon, so we need to see if this device supports
* the native iOS refresher.
*/
const hasRubberBandScrolling = supportsRubberBandScrolling();
const mode = getIonMode(this);
const overflowRefresher = hasRubberBandScrolling ? 'lines' : arrowDown;
this.pullingIcon = config.get('refreshingIcon', mode === 'ios' && hasRubberBandScrolling ? config.get('spinner', overflowRefresher) : 'circular');
}
if (this.refreshingSpinner === undefined) {
const mode = getIonMode(this);
this.refreshingSpinner = config.get('refreshingSpinner', config.get('spinner', mode === 'ios' ? 'lines' : 'circular'));
}
}
renderPullingText() {
const { customHTMLEnabled, pullingText } = this;
if (customHTMLEnabled) {
return h("div", { class: "refresher-pulling-text", innerHTML: sanitizeDOMString(pullingText) });
}
return h("div", { class: "refresher-pulling-text" }, pullingText);
}
renderRefreshingText() {
const { customHTMLEnabled, refreshingText } = this;
if (customHTMLEnabled) {
return h("div", { class: "refresher-refreshing-text", innerHTML: sanitizeDOMString(refreshingText) });
}
return h("div", { class: "refresher-refreshing-text" }, refreshingText);
}
render() {
const pullingIcon = this.pullingIcon;
const hasSpinner = pullingIcon != null && SPINNERS[pullingIcon] !== undefined;
const mode = getIonMode(this);
return (h(Host, { key: 'fb78d7e31f8feb31025e58903eb9de85cb928dbd', class: mode }, h("div", { key: '23f67800f09765ef8fde8cf85a843e19e667f337', class: "refresher-pulling" }, this.pullingIcon && hasSpinner && (h("div", { key: '5a08d3b69762f8b51dcd3dcfbaf3fddb707257fa', class: "refresher-pulling-icon" }, h("div", { key: '42a613b029e092acdff7fe613a429375d89f157e', class: "spinner-arrow-container" }, h("ion-spinner", { key: '2f9cdc75938c4d306de7a717ed67901daef71c2c', name: this.pullingIcon, paused: true }), mode === 'md' && this.pullingIcon === 'circular' && (h("div", { key: '1f8a6347b4a46417ba55286a79f1a41f04bf9c91', class: "arrow-container" }, h("ion-icon", { key: '326713d11d482d420ba5a739ff4528400a37e9ca', icon: caretBackSharp, "aria-hidden": "true" })))))), this.pullingIcon && !hasSpinner && (h("div", { key: 'ab18c7cbea7bcbfa034f90f317652af4d93660ed', class: "refresher-pulling-icon" }, h("ion-icon", { key: 'f488acd54acc8a61b6c5a279f0d7f9a437c370c0', icon: this.pullingIcon, lazy: false, "aria-hidden": "true" }))), this.pullingText !== undefined && this.renderPullingText()), h("div", { key: '914ad6139442dac53af47120ea821fa11c309a38', class: "refresher-refreshing" }, this.refreshingSpinner && (h("div", { key: '7eba732f5e2d72b90399d68a3e89617d8979b3d1', class: "refresher-refreshing-icon" }, h("ion-spinner", { key: '838d66d8bef6f56622c62b1068e7fed29e094302', name: this.refreshingSpinner }))), this.refreshingText !== undefined && this.renderRefreshingText())));
}
get el() { return getElement(this); }
};
export { RefresherContent as ion_refresher_content };
//# sourceMappingURL=ion-refresher-content.entry.js.map