1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | const index = require('./index-a0a08b2a.js');
|
6 | const ionicGlobal = require('./ionic-global-06f21c1a.js');
|
7 | const overlays = require('./overlays-59863ad4.js');
|
8 | const index$1 = require('./index-e1bb33c3.js');
|
9 | const theme = require('./theme-30b7a575.js');
|
10 | const animation = require('./animation-13cbbb20.js');
|
11 | require('./hardware-back-button-148ce546.js');
|
12 | require('./helpers-d381ec4d.js');
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | const iosEnterAnimation = (baseEl) => {
|
18 | const baseAnimation = animation.createAnimation();
|
19 | const backdropAnimation = animation.createAnimation();
|
20 | const wrapperAnimation = animation.createAnimation();
|
21 | backdropAnimation
|
22 | .addElement(baseEl.querySelector('ion-backdrop'))
|
23 | .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
24 | .beforeStyles({
|
25 | 'pointer-events': 'none'
|
26 | })
|
27 | .afterClearStyles(['pointer-events']);
|
28 | wrapperAnimation
|
29 | .addElement(baseEl.querySelector('.loading-wrapper'))
|
30 | .keyframes([
|
31 | { offset: 0, opacity: 0.01, transform: 'scale(1.1)' },
|
32 | { offset: 1, opacity: 1, transform: 'scale(1)' }
|
33 | ]);
|
34 | return baseAnimation
|
35 | .addElement(baseEl)
|
36 | .easing('ease-in-out')
|
37 | .duration(200)
|
38 | .addAnimation([backdropAnimation, wrapperAnimation]);
|
39 | };
|
40 |
|
41 |
|
42 |
|
43 |
|
44 | const iosLeaveAnimation = (baseEl) => {
|
45 | const baseAnimation = animation.createAnimation();
|
46 | const backdropAnimation = animation.createAnimation();
|
47 | const wrapperAnimation = animation.createAnimation();
|
48 | backdropAnimation
|
49 | .addElement(baseEl.querySelector('ion-backdrop'))
|
50 | .fromTo('opacity', 'var(--backdrop-opacity)', 0);
|
51 | wrapperAnimation
|
52 | .addElement(baseEl.querySelector('.loading-wrapper'))
|
53 | .keyframes([
|
54 | { offset: 0, opacity: 0.99, transform: 'scale(1)' },
|
55 | { offset: 1, opacity: 0, transform: 'scale(0.9)' }
|
56 | ]);
|
57 | return baseAnimation
|
58 | .addElement(baseEl)
|
59 | .easing('ease-in-out')
|
60 | .duration(200)
|
61 | .addAnimation([backdropAnimation, wrapperAnimation]);
|
62 | };
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | const mdEnterAnimation = (baseEl) => {
|
68 | const baseAnimation = animation.createAnimation();
|
69 | const backdropAnimation = animation.createAnimation();
|
70 | const wrapperAnimation = animation.createAnimation();
|
71 | backdropAnimation
|
72 | .addElement(baseEl.querySelector('ion-backdrop'))
|
73 | .fromTo('opacity', 0.01, 'var(--backdrop-opacity)')
|
74 | .beforeStyles({
|
75 | 'pointer-events': 'none'
|
76 | })
|
77 | .afterClearStyles(['pointer-events']);
|
78 | wrapperAnimation
|
79 | .addElement(baseEl.querySelector('.loading-wrapper'))
|
80 | .keyframes([
|
81 | { offset: 0, opacity: 0.01, transform: 'scale(1.1)' },
|
82 | { offset: 1, opacity: 1, transform: 'scale(1)' }
|
83 | ]);
|
84 | return baseAnimation
|
85 | .addElement(baseEl)
|
86 | .easing('ease-in-out')
|
87 | .duration(200)
|
88 | .addAnimation([backdropAnimation, wrapperAnimation]);
|
89 | };
|
90 |
|
91 |
|
92 |
|
93 |
|
94 | const mdLeaveAnimation = (baseEl) => {
|
95 | const baseAnimation = animation.createAnimation();
|
96 | const backdropAnimation = animation.createAnimation();
|
97 | const wrapperAnimation = animation.createAnimation();
|
98 | backdropAnimation
|
99 | .addElement(baseEl.querySelector('ion-backdrop'))
|
100 | .fromTo('opacity', 'var(--backdrop-opacity)', 0);
|
101 | wrapperAnimation
|
102 | .addElement(baseEl.querySelector('.loading-wrapper'))
|
103 | .keyframes([
|
104 | { offset: 0, opacity: 0.99, transform: 'scale(1)' },
|
105 | { offset: 1, opacity: 0, transform: 'scale(0.9)' }
|
106 | ]);
|
107 | return baseAnimation
|
108 | .addElement(baseEl)
|
109 | .easing('ease-in-out')
|
110 | .duration(200)
|
111 | .addAnimation([backdropAnimation, wrapperAnimation]);
|
112 | };
|
113 |
|
114 | const loadingIosCss = ".sc-ion-loading-ios-h{--min-width:auto;--width:auto;--min-height:auto;--height:auto;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;font-family:var(--ion-font-family, inherit);contain:strict;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.overlay-hidden.sc-ion-loading-ios-h{display:none}.loading-wrapper.sc-ion-loading-ios{display:-ms-flexbox;display:flex;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);opacity:0;z-index:10}.spinner-lines.sc-ion-loading-ios,.spinner-lines-small.sc-ion-loading-ios,.spinner-bubbles.sc-ion-loading-ios,.spinner-circles.sc-ion-loading-ios,.spinner-crescent.sc-ion-loading-ios,.spinner-dots.sc-ion-loading-ios{color:var(--spinner-color)}.sc-ion-loading-ios-h{--background:var(--ion-overlay-background-color, var(--ion-color-step-100, #f9f9f9));--max-width:270px;--max-height:90%;--spinner-color:var(--ion-color-step-600, #666666);--backdrop-opacity:var(--ion-backdrop-opacity, 0.3);color:var(--ion-text-color, #000);font-size:14px}.loading-wrapper.sc-ion-loading-ios{border-radius:8px;padding-left:34px;padding-right:34px;padding-top:24px;padding-bottom:24px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.loading-wrapper.sc-ion-loading-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:34px;padding-inline-start:34px;-webkit-padding-end:34px;padding-inline-end:34px}}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){.loading-translucent.sc-ion-loading-ios-h .loading-wrapper.sc-ion-loading-ios{background-color:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}}.loading-content.sc-ion-loading-ios{font-weight:bold}.loading-spinner.sc-ion-loading-ios+.loading-content.sc-ion-loading-ios{margin-left:16px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.loading-spinner.sc-ion-loading-ios+.loading-content.sc-ion-loading-ios{margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}";
|
115 |
|
116 | const loadingMdCss = ".sc-ion-loading-md-h{--min-width:auto;--width:auto;--min-height:auto;--height:auto;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;left:0;right:0;top:0;bottom:0;display:-ms-flexbox;display:flex;position:fixed;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;outline:none;font-family:var(--ion-font-family, inherit);contain:strict;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:1001}.overlay-hidden.sc-ion-loading-md-h{display:none}.loading-wrapper.sc-ion-loading-md{display:-ms-flexbox;display:flex;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);background:var(--background);opacity:0;z-index:10}.spinner-lines.sc-ion-loading-md,.spinner-lines-small.sc-ion-loading-md,.spinner-bubbles.sc-ion-loading-md,.spinner-circles.sc-ion-loading-md,.spinner-crescent.sc-ion-loading-md,.spinner-dots.sc-ion-loading-md{color:var(--spinner-color)}.sc-ion-loading-md-h{--background:var(--ion-color-step-50, #f2f2f2);--max-width:280px;--max-height:90%;--spinner-color:var(--ion-color-primary, #3880ff);--backdrop-opacity:var(--ion-backdrop-opacity, 0.32);color:var(--ion-color-step-850, #262626);font-size:14px}.loading-wrapper.sc-ion-loading-md{border-radius:2px;padding-left:24px;padding-right:24px;padding-top:24px;padding-bottom:24px;-webkit-box-shadow:0 16px 20px rgba(0, 0, 0, 0.4);box-shadow:0 16px 20px rgba(0, 0, 0, 0.4)}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.loading-wrapper.sc-ion-loading-md{padding-left:unset;padding-right:unset;-webkit-padding-start:24px;padding-inline-start:24px;-webkit-padding-end:24px;padding-inline-end:24px}}.loading-spinner.sc-ion-loading-md+.loading-content.sc-ion-loading-md{margin-left:16px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.loading-spinner.sc-ion-loading-md+.loading-content.sc-ion-loading-md{margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}";
|
117 |
|
118 | const Loading = class {
|
119 | constructor(hostRef) {
|
120 | index.registerInstance(this, hostRef);
|
121 | this.didPresent = index.createEvent(this, "ionLoadingDidPresent", 7);
|
122 | this.willPresent = index.createEvent(this, "ionLoadingWillPresent", 7);
|
123 | this.willDismiss = index.createEvent(this, "ionLoadingWillDismiss", 7);
|
124 | this.didDismiss = index.createEvent(this, "ionLoadingDidDismiss", 7);
|
125 | this.presented = false;
|
126 | |
127 |
|
128 |
|
129 | this.keyboardClose = true;
|
130 | |
131 |
|
132 |
|
133 | this.duration = 0;
|
134 | |
135 |
|
136 |
|
137 | this.backdropDismiss = false;
|
138 | |
139 |
|
140 |
|
141 | this.showBackdrop = true;
|
142 | |
143 |
|
144 |
|
145 |
|
146 |
|
147 | this.translucent = false;
|
148 | |
149 |
|
150 |
|
151 | this.animated = true;
|
152 | this.onBackdropTap = () => {
|
153 | this.dismiss(undefined, overlays.BACKDROP);
|
154 | };
|
155 | }
|
156 | connectedCallback() {
|
157 | overlays.prepareOverlay(this.el);
|
158 | }
|
159 | componentWillLoad() {
|
160 | if (this.spinner === undefined) {
|
161 | const mode = ionicGlobal.getIonMode(this);
|
162 | this.spinner = ionicGlobal.config.get('loadingSpinner', ionicGlobal.config.get('spinner', mode === 'ios' ? 'lines' : 'crescent'));
|
163 | }
|
164 | }
|
165 | |
166 |
|
167 |
|
168 | async present() {
|
169 | await overlays.present(this, 'loadingEnter', iosEnterAnimation, mdEnterAnimation, undefined);
|
170 | if (this.duration > 0) {
|
171 | this.durationTimeout = setTimeout(() => this.dismiss(), this.duration + 10);
|
172 | }
|
173 | }
|
174 | |
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 | dismiss(data, role) {
|
184 | if (this.durationTimeout) {
|
185 | clearTimeout(this.durationTimeout);
|
186 | }
|
187 | return overlays.dismiss(this, data, role, 'loadingLeave', iosLeaveAnimation, mdLeaveAnimation);
|
188 | }
|
189 | |
190 |
|
191 |
|
192 | onDidDismiss() {
|
193 | return overlays.eventMethod(this.el, 'ionLoadingDidDismiss');
|
194 | }
|
195 | |
196 |
|
197 |
|
198 | onWillDismiss() {
|
199 | return overlays.eventMethod(this.el, 'ionLoadingWillDismiss');
|
200 | }
|
201 | render() {
|
202 | const { message, spinner } = this;
|
203 | const mode = ionicGlobal.getIonMode(this);
|
204 | return (index.h(index.Host, { onIonBackdropTap: this.onBackdropTap, tabindex: "-1", style: {
|
205 | zIndex: `${40000 + this.overlayIndex}`
|
206 | }, class: Object.assign(Object.assign({}, theme.getClassMap(this.cssClass)), { [mode]: true, 'loading-translucent': this.translucent }) }, index.h("ion-backdrop", { visible: this.showBackdrop, tappable: this.backdropDismiss }), index.h("div", { tabindex: "0" }), index.h("div", { class: "loading-wrapper ion-overlay-wrapper", role: "dialog" }, spinner && (index.h("div", { class: "loading-spinner" }, index.h("ion-spinner", { name: spinner, "aria-hidden": "true" }))), message && index.h("div", { class: "loading-content", innerHTML: index$1.sanitizeDOMString(message) })), index.h("div", { tabindex: "0" })));
|
207 | }
|
208 | get el() { return index.getElement(this); }
|
209 | };
|
210 | Loading.style = {
|
211 | ios: loadingIosCss,
|
212 | md: loadingMdCss
|
213 | };
|
214 |
|
215 | exports.ion_loading = Loading;
|