mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
refactor(all): updating to newest stencil apis (#18578)
* chore(): update ionicons * refactor(all): updating to newest stencil apis * fix lint issues * more changes * moreee * fix treeshaking * fix config * fix checkbox * fix stuff * chore(): update ionicons * fix linting errors
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
import { Component, ComponentInterface, Element, Event, EventEmitter, Listen, Method, Prop, h } from '@stencil/core';
|
||||
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, h } from '@stencil/core';
|
||||
|
||||
import { config } from '../../global/config';
|
||||
import { getIonMode } from '../../global/ionic-global';
|
||||
import { Animation, AnimationBuilder, Config, OverlayEventDetail, OverlayInterface, SpinnerTypes } from '../../interface';
|
||||
import { Animation, AnimationBuilder, OverlayEventDetail, OverlayInterface, SpinnerTypes } from '../../interface';
|
||||
import { BACKDROP, dismiss, eventMethod, present } from '../../utils/overlays';
|
||||
import { sanitizeDOMString } from '../../utils/sanitization';
|
||||
import { getClassMap } from '../../utils/theme';
|
||||
@ -31,8 +32,6 @@ export class Loading implements ComponentInterface, OverlayInterface {
|
||||
|
||||
@Element() el!: HTMLElement;
|
||||
|
||||
@Prop({ context: 'config' }) config!: Config;
|
||||
|
||||
/** @internal */
|
||||
@Prop() overlayIndex!: number;
|
||||
|
||||
@ -115,18 +114,13 @@ export class Loading implements ComponentInterface, OverlayInterface {
|
||||
componentWillLoad() {
|
||||
if (this.spinner === undefined) {
|
||||
const mode = getIonMode(this);
|
||||
this.spinner = this.config.get(
|
||||
this.spinner = config.get(
|
||||
'loadingSpinner',
|
||||
this.config.get('spinner', mode === 'ios' ? 'lines' : 'crescent')
|
||||
config.get('spinner', mode === 'ios' ? 'lines' : 'crescent')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Listen('ionBackdropTap')
|
||||
protected onBackdropTap() {
|
||||
this.dismiss(undefined, BACKDROP);
|
||||
}
|
||||
|
||||
/**
|
||||
* Present the loading overlay after it has been created.
|
||||
*/
|
||||
@ -175,32 +169,36 @@ export class Loading implements ComponentInterface, OverlayInterface {
|
||||
return eventMethod(this.el, 'ionLoadingWillDismiss');
|
||||
}
|
||||
|
||||
hostData() {
|
||||
const mode = getIonMode(this);
|
||||
return {
|
||||
style: {
|
||||
zIndex: 40000 + this.overlayIndex
|
||||
},
|
||||
class: {
|
||||
...getClassMap(this.cssClass),
|
||||
[`${mode}`]: true,
|
||||
'loading-translucent': this.translucent
|
||||
}
|
||||
};
|
||||
private onBackdropTap = () => {
|
||||
this.dismiss(undefined, BACKDROP);
|
||||
}
|
||||
|
||||
render() {
|
||||
return [
|
||||
<ion-backdrop visible={this.showBackdrop} tappable={this.backdropDismiss} />,
|
||||
<div class="loading-wrapper" role="dialog">
|
||||
{this.spinner && (
|
||||
<div class="loading-spinner">
|
||||
<ion-spinner name={this.spinner} />
|
||||
</div>
|
||||
)}
|
||||
const { message, spinner } = this;
|
||||
const mode = getIonMode(this);
|
||||
return (
|
||||
<Host
|
||||
onIonBackdropTap={this.onBackdropTap}
|
||||
style={{
|
||||
zIndex: `${40000 + this.overlayIndex}`
|
||||
}}
|
||||
class={{
|
||||
...getClassMap(this.cssClass),
|
||||
[mode]: true,
|
||||
'loading-translucent': this.translucent
|
||||
}}
|
||||
>
|
||||
<ion-backdrop visible={this.showBackdrop} tappable={this.backdropDismiss} />
|
||||
<div class="loading-wrapper" role="dialog">
|
||||
{spinner && (
|
||||
<div class="loading-spinner">
|
||||
<ion-spinner name={spinner} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{this.message && <div class="loading-content" innerHTML={sanitizeDOMString(this.message)}></div>}
|
||||
</div>
|
||||
];
|
||||
{message && <div class="loading-content" innerHTML={sanitizeDOMString(message)}></div>}
|
||||
</div>
|
||||
</Host>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user