@ionic/angular 7.5.4 → 7.5.5-dev.11699655013.1a2cb3ad
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/index.d.ts +1 -6
- package/common/utils/overlay.d.ts +1 -2
- package/esm2020/common/index.mjs +2 -7
- package/esm2020/common/utils/overlay.mjs +1 -1
- package/esm2020/index.mjs +8 -2
- package/esm2020/ionic-module.mjs +4 -2
- package/esm2020/providers/action-sheet-controller.mjs +18 -0
- package/esm2020/providers/animation-controller.mjs +37 -0
- package/esm2020/providers/gesture-controller.mjs +31 -0
- package/esm2020/providers/modal-controller.mjs +24 -0
- package/esm2020/providers/popover-controller.mjs +18 -0
- package/esm2020/providers/toast-controller.mjs +18 -0
- package/esm2020/standalone/index.mjs +8 -2
- package/esm2020/standalone/providers/action-sheet-controller.mjs +18 -0
- package/esm2020/standalone/providers/animation-controller.mjs +37 -0
- package/esm2020/standalone/providers/gesture-controller.mjs +31 -0
- package/esm2020/standalone/providers/ionic-angular.mjs +4 -2
- package/esm2020/standalone/providers/modal-controller.mjs +24 -0
- package/esm2020/standalone/providers/popover-controller.mjs +18 -0
- package/esm2020/standalone/providers/toast-controller.mjs +18 -0
- package/fesm2015/ionic-angular-common.mjs +194 -318
- package/fesm2015/ionic-angular-common.mjs.map +1 -1
- package/fesm2015/ionic-angular-standalone.mjs +124 -5
- package/fesm2015/ionic-angular-standalone.mjs.map +1 -1
- package/fesm2015/ionic-angular.mjs +124 -5
- package/fesm2015/ionic-angular.mjs.map +1 -1
- package/fesm2020/ionic-angular-common.mjs +196 -326
- package/fesm2020/ionic-angular-common.mjs.map +1 -1
- package/fesm2020/ionic-angular-standalone.mjs +130 -5
- package/fesm2020/ionic-angular-standalone.mjs.map +1 -1
- package/fesm2020/ionic-angular.mjs +130 -5
- package/fesm2020/ionic-angular.mjs.map +1 -1
- package/index.d.ts +7 -1
- package/package.json +2 -2
- package/providers/action-sheet-controller.d.ts +8 -0
- package/{common/providers → providers}/animation-controller.d.ts +1 -1
- package/providers/gesture-controller.d.ts +13 -0
- package/providers/modal-controller.d.ts +12 -0
- package/providers/popover-controller.d.ts +9 -0
- package/providers/toast-controller.d.ts +8 -0
- package/standalone/index.d.ts +7 -1
- package/{common → standalone}/providers/action-sheet-controller.d.ts +1 -1
- package/standalone/providers/animation-controller.d.ts +25 -0
- package/{common → standalone}/providers/modal-controller.d.ts +1 -1
- package/{common → standalone}/providers/popover-controller.d.ts +1 -4
- package/{common → standalone}/providers/toast-controller.d.ts +1 -1
- package/esm2020/common/providers/action-sheet-controller.mjs +0 -18
- package/esm2020/common/providers/animation-controller.mjs +0 -37
- package/esm2020/common/providers/gesture-controller.mjs +0 -31
- package/esm2020/common/providers/modal-controller.mjs +0 -25
- package/esm2020/common/providers/popover-controller.mjs +0 -25
- package/esm2020/common/providers/toast-controller.mjs +0 -18
- /package/{common → standalone}/providers/gesture-controller.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable,
|
|
3
|
-
import {
|
|
2
|
+
import { Injectable, Inject, Optional, InjectionToken, inject, NgZone, ApplicationRef, Injector, createComponent, TemplateRef, Directive, ContentChild, EventEmitter, ViewContainerRef, EnvironmentInjector, Attribute, SkipSelf, Input, Output, reflectComponentType, HostListener, ElementRef, ViewChild } from '@angular/core';
|
|
3
|
+
import { alertController, loadingController, pickerController, isPlatform, getPlatforms, LIFECYCLE_WILL_ENTER, LIFECYCLE_DID_ENTER, LIFECYCLE_WILL_LEAVE, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_UNLOAD, componentOnReady } from '@ionic/core/components';
|
|
4
4
|
import * as i3 from '@angular/router';
|
|
5
5
|
import { NavigationStart, PRIMARY_OUTLET, ChildrenOutletContexts, ActivatedRoute, Router } from '@angular/router';
|
|
6
6
|
import * as i1 from '@angular/common';
|
|
@@ -35,20 +35,6 @@ class OverlayBaseController {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
class ActionSheetController extends OverlayBaseController {
|
|
39
|
-
constructor() {
|
|
40
|
-
super(actionSheetController);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/** @nocollapse */ ActionSheetController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ActionSheetController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
44
|
-
/** @nocollapse */ ActionSheetController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ActionSheetController, providedIn: 'root' });
|
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ActionSheetController, decorators: [{
|
|
46
|
-
type: Injectable,
|
|
47
|
-
args: [{
|
|
48
|
-
providedIn: 'root',
|
|
49
|
-
}]
|
|
50
|
-
}], ctorParameters: function () { return []; } });
|
|
51
|
-
|
|
52
38
|
class AlertController extends OverlayBaseController {
|
|
53
39
|
constructor() {
|
|
54
40
|
super(alertController);
|
|
@@ -169,219 +155,6 @@ class MenuController {
|
|
|
169
155
|
}
|
|
170
156
|
}
|
|
171
157
|
|
|
172
|
-
/**
|
|
173
|
-
* @description
|
|
174
|
-
* NavParams are an object that exists on a page and can contain data for that particular view.
|
|
175
|
-
* Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
|
|
176
|
-
* option with a simple `get` method.
|
|
177
|
-
*
|
|
178
|
-
* @usage
|
|
179
|
-
* ```ts
|
|
180
|
-
* import { NavParams } from '@ionic/angular';
|
|
181
|
-
*
|
|
182
|
-
* export class MyClass{
|
|
183
|
-
*
|
|
184
|
-
* constructor(navParams: NavParams){
|
|
185
|
-
* // userParams is an object we have in our nav-parameters
|
|
186
|
-
* navParams.get('userParams');
|
|
187
|
-
* }
|
|
188
|
-
*
|
|
189
|
-
* }
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
|
-
class NavParams {
|
|
193
|
-
constructor(data = {}) {
|
|
194
|
-
this.data = data;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Get the value of a nav-parameter for the current view
|
|
198
|
-
*
|
|
199
|
-
* ```ts
|
|
200
|
-
* import { NavParams } from 'ionic-angular';
|
|
201
|
-
*
|
|
202
|
-
* export class MyClass{
|
|
203
|
-
* constructor(public navParams: NavParams){
|
|
204
|
-
* // userParams is an object we have in our nav-parameters
|
|
205
|
-
* this.navParams.get('userParams');
|
|
206
|
-
* }
|
|
207
|
-
* }
|
|
208
|
-
* ```
|
|
209
|
-
*
|
|
210
|
-
* @param param Which param you want to look up
|
|
211
|
-
*/
|
|
212
|
-
get(param) {
|
|
213
|
-
return this.data[param];
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// TODO(FW-2827): types
|
|
218
|
-
class AngularDelegate {
|
|
219
|
-
constructor() {
|
|
220
|
-
this.zone = inject(NgZone);
|
|
221
|
-
this.applicationRef = inject(ApplicationRef);
|
|
222
|
-
}
|
|
223
|
-
create(environmentInjector, injector, elementReferenceKey) {
|
|
224
|
-
return new AngularFrameworkDelegate(environmentInjector, injector, this.applicationRef, this.zone, elementReferenceKey);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
/** @nocollapse */ AngularDelegate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
228
|
-
/** @nocollapse */ AngularDelegate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate });
|
|
229
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, decorators: [{
|
|
230
|
-
type: Injectable
|
|
231
|
-
}] });
|
|
232
|
-
class AngularFrameworkDelegate {
|
|
233
|
-
constructor(environmentInjector, injector, applicationRef, zone, elementReferenceKey) {
|
|
234
|
-
this.environmentInjector = environmentInjector;
|
|
235
|
-
this.injector = injector;
|
|
236
|
-
this.applicationRef = applicationRef;
|
|
237
|
-
this.zone = zone;
|
|
238
|
-
this.elementReferenceKey = elementReferenceKey;
|
|
239
|
-
this.elRefMap = new WeakMap();
|
|
240
|
-
this.elEventsMap = new WeakMap();
|
|
241
|
-
}
|
|
242
|
-
attachViewToDom(container, component, params, cssClasses) {
|
|
243
|
-
return this.zone.run(() => {
|
|
244
|
-
return new Promise((resolve) => {
|
|
245
|
-
const componentProps = {
|
|
246
|
-
...params,
|
|
247
|
-
};
|
|
248
|
-
/**
|
|
249
|
-
* Ionic Angular passes a reference to a modal
|
|
250
|
-
* or popover that can be accessed using a
|
|
251
|
-
* variable in the overlay component. If
|
|
252
|
-
* elementReferenceKey is defined, then we should
|
|
253
|
-
* pass a reference to the component using
|
|
254
|
-
* elementReferenceKey as the key.
|
|
255
|
-
*/
|
|
256
|
-
if (this.elementReferenceKey !== undefined) {
|
|
257
|
-
componentProps[this.elementReferenceKey] = container;
|
|
258
|
-
}
|
|
259
|
-
const el = attachView(this.zone, this.environmentInjector, this.injector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey);
|
|
260
|
-
resolve(el);
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
removeViewFromDom(_container, component) {
|
|
265
|
-
return this.zone.run(() => {
|
|
266
|
-
return new Promise((resolve) => {
|
|
267
|
-
const componentRef = this.elRefMap.get(component);
|
|
268
|
-
if (componentRef) {
|
|
269
|
-
componentRef.destroy();
|
|
270
|
-
this.elRefMap.delete(component);
|
|
271
|
-
const unbindEvents = this.elEventsMap.get(component);
|
|
272
|
-
if (unbindEvents) {
|
|
273
|
-
unbindEvents();
|
|
274
|
-
this.elEventsMap.delete(component);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
resolve();
|
|
278
|
-
});
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
const attachView = (zone, environmentInjector, injector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey) => {
|
|
283
|
-
/**
|
|
284
|
-
* Wraps the injector with a custom injector that
|
|
285
|
-
* provides NavParams to the component.
|
|
286
|
-
*
|
|
287
|
-
* NavParams is a legacy feature from Ionic v3 that allows
|
|
288
|
-
* Angular developers to provide data to a component
|
|
289
|
-
* and access it by providing NavParams as a dependency
|
|
290
|
-
* in the constructor.
|
|
291
|
-
*
|
|
292
|
-
* The modern approach is to access the data directly
|
|
293
|
-
* from the component's class instance.
|
|
294
|
-
*/
|
|
295
|
-
const childInjector = Injector.create({
|
|
296
|
-
providers: getProviders(params),
|
|
297
|
-
parent: injector,
|
|
298
|
-
});
|
|
299
|
-
const componentRef = createComponent(component, {
|
|
300
|
-
environmentInjector,
|
|
301
|
-
elementInjector: childInjector,
|
|
302
|
-
});
|
|
303
|
-
const instance = componentRef.instance;
|
|
304
|
-
const hostElement = componentRef.location.nativeElement;
|
|
305
|
-
if (params) {
|
|
306
|
-
/**
|
|
307
|
-
* For modals and popovers, a reference to the component is
|
|
308
|
-
* added to `params` during the call to attachViewToDom. If
|
|
309
|
-
* a reference using this name is already set, this means
|
|
310
|
-
* the app is trying to use the name as a component prop,
|
|
311
|
-
* which will cause collisions.
|
|
312
|
-
*/
|
|
313
|
-
if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
|
|
314
|
-
console.error(`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${component.name}.`);
|
|
315
|
-
}
|
|
316
|
-
Object.assign(instance, params);
|
|
317
|
-
}
|
|
318
|
-
if (cssClasses) {
|
|
319
|
-
for (const cssClass of cssClasses) {
|
|
320
|
-
hostElement.classList.add(cssClass);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
const unbindEvents = bindLifecycleEvents(zone, instance, hostElement);
|
|
324
|
-
container.appendChild(hostElement);
|
|
325
|
-
applicationRef.attachView(componentRef.hostView);
|
|
326
|
-
elRefMap.set(hostElement, componentRef);
|
|
327
|
-
elEventsMap.set(hostElement, unbindEvents);
|
|
328
|
-
return hostElement;
|
|
329
|
-
};
|
|
330
|
-
const LIFECYCLES = [
|
|
331
|
-
LIFECYCLE_WILL_ENTER,
|
|
332
|
-
LIFECYCLE_DID_ENTER,
|
|
333
|
-
LIFECYCLE_WILL_LEAVE,
|
|
334
|
-
LIFECYCLE_DID_LEAVE,
|
|
335
|
-
LIFECYCLE_WILL_UNLOAD,
|
|
336
|
-
];
|
|
337
|
-
const bindLifecycleEvents = (zone, instance, element) => {
|
|
338
|
-
return zone.run(() => {
|
|
339
|
-
const unregisters = LIFECYCLES.filter((eventName) => typeof instance[eventName] === 'function').map((eventName) => {
|
|
340
|
-
const handler = (ev) => instance[eventName](ev.detail);
|
|
341
|
-
element.addEventListener(eventName, handler);
|
|
342
|
-
return () => element.removeEventListener(eventName, handler);
|
|
343
|
-
});
|
|
344
|
-
return () => unregisters.forEach((fn) => fn());
|
|
345
|
-
});
|
|
346
|
-
};
|
|
347
|
-
const NavParamsToken = new InjectionToken('NavParamsToken');
|
|
348
|
-
const getProviders = (params) => {
|
|
349
|
-
return [
|
|
350
|
-
{
|
|
351
|
-
provide: NavParamsToken,
|
|
352
|
-
useValue: params,
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
provide: NavParams,
|
|
356
|
-
useFactory: provideNavParamsInjectable,
|
|
357
|
-
deps: [NavParamsToken],
|
|
358
|
-
},
|
|
359
|
-
];
|
|
360
|
-
};
|
|
361
|
-
const provideNavParamsInjectable = (params) => {
|
|
362
|
-
return new NavParams(params);
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
class ModalController extends OverlayBaseController {
|
|
366
|
-
constructor() {
|
|
367
|
-
super(modalController);
|
|
368
|
-
this.angularDelegate = inject(AngularDelegate);
|
|
369
|
-
this.injector = inject(Injector);
|
|
370
|
-
this.environmentInjector = inject(EnvironmentInjector);
|
|
371
|
-
}
|
|
372
|
-
create(opts) {
|
|
373
|
-
return super.create({
|
|
374
|
-
...opts,
|
|
375
|
-
delegate: this.angularDelegate.create(this.environmentInjector, this.injector, 'modal'),
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
/** @nocollapse */ ModalController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
380
|
-
/** @nocollapse */ ModalController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController });
|
|
381
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController, decorators: [{
|
|
382
|
-
type: Injectable
|
|
383
|
-
}], ctorParameters: function () { return []; } });
|
|
384
|
-
|
|
385
158
|
class PickerController extends OverlayBaseController {
|
|
386
159
|
constructor() {
|
|
387
160
|
super(pickerController);
|
|
@@ -396,102 +169,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
396
169
|
}]
|
|
397
170
|
}], ctorParameters: function () { return []; } });
|
|
398
171
|
|
|
399
|
-
class PopoverController extends OverlayBaseController {
|
|
400
|
-
constructor() {
|
|
401
|
-
super(popoverController);
|
|
402
|
-
this.angularDelegate = inject(AngularDelegate);
|
|
403
|
-
this.injector = inject(Injector);
|
|
404
|
-
this.environmentInjector = inject(EnvironmentInjector);
|
|
405
|
-
}
|
|
406
|
-
create(opts) {
|
|
407
|
-
return super.create({
|
|
408
|
-
...opts,
|
|
409
|
-
delegate: this.angularDelegate.create(this.environmentInjector, this.injector, 'popover'),
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
/** @nocollapse */ PopoverController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: PopoverController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
414
|
-
/** @nocollapse */ PopoverController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: PopoverController });
|
|
415
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: PopoverController, decorators: [{
|
|
416
|
-
type: Injectable
|
|
417
|
-
}], ctorParameters: function () { return []; } });
|
|
418
|
-
|
|
419
|
-
class ToastController extends OverlayBaseController {
|
|
420
|
-
constructor() {
|
|
421
|
-
super(toastController);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
/** @nocollapse */ ToastController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
425
|
-
/** @nocollapse */ ToastController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, providedIn: 'root' });
|
|
426
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, decorators: [{
|
|
427
|
-
type: Injectable,
|
|
428
|
-
args: [{
|
|
429
|
-
providedIn: 'root',
|
|
430
|
-
}]
|
|
431
|
-
}], ctorParameters: function () { return []; } });
|
|
432
|
-
|
|
433
|
-
class AnimationController {
|
|
434
|
-
/**
|
|
435
|
-
* Create a new animation
|
|
436
|
-
*/
|
|
437
|
-
create(animationId) {
|
|
438
|
-
return createAnimation(animationId);
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* EXPERIMENTAL
|
|
442
|
-
*
|
|
443
|
-
* Given a progression and a cubic bezier function,
|
|
444
|
-
* this utility returns the time value(s) at which the
|
|
445
|
-
* cubic bezier reaches the given time progression.
|
|
446
|
-
*
|
|
447
|
-
* If the cubic bezier never reaches the progression
|
|
448
|
-
* the result will be an empty array.
|
|
449
|
-
*
|
|
450
|
-
* This is most useful for switching between easing curves
|
|
451
|
-
* when doing a gesture animation (i.e. going from linear easing
|
|
452
|
-
* during a drag, to another easing when `progressEnd` is called)
|
|
453
|
-
*/
|
|
454
|
-
easingTime(p0, p1, p2, p3, progression) {
|
|
455
|
-
return getTimeGivenProgression(p0, p1, p2, p3, progression);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
/** @nocollapse */ AnimationController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AnimationController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
459
|
-
/** @nocollapse */ AnimationController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AnimationController, providedIn: 'root' });
|
|
460
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AnimationController, decorators: [{
|
|
461
|
-
type: Injectable,
|
|
462
|
-
args: [{
|
|
463
|
-
providedIn: 'root',
|
|
464
|
-
}]
|
|
465
|
-
}] });
|
|
466
|
-
|
|
467
|
-
class GestureController {
|
|
468
|
-
constructor(zone) {
|
|
469
|
-
this.zone = zone;
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Create a new gesture
|
|
473
|
-
*/
|
|
474
|
-
create(opts, runInsideAngularZone = false) {
|
|
475
|
-
if (runInsideAngularZone) {
|
|
476
|
-
Object.getOwnPropertyNames(opts).forEach((key) => {
|
|
477
|
-
if (typeof opts[key] === 'function') {
|
|
478
|
-
const fn = opts[key];
|
|
479
|
-
opts[key] = (...props) => this.zone.run(() => fn(...props));
|
|
480
|
-
}
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
return createGesture(opts);
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
/** @nocollapse */ GestureController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: GestureController, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
487
|
-
/** @nocollapse */ GestureController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: GestureController, providedIn: 'root' });
|
|
488
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: GestureController, decorators: [{
|
|
489
|
-
type: Injectable,
|
|
490
|
-
args: [{
|
|
491
|
-
providedIn: 'root',
|
|
492
|
-
}]
|
|
493
|
-
}], ctorParameters: function () { return [{ type: i0.NgZone }]; } });
|
|
494
|
-
|
|
495
172
|
class DomController {
|
|
496
173
|
/**
|
|
497
174
|
* Schedules a task to run during the READ phase of the next frame.
|
|
@@ -1040,6 +717,199 @@ const getConfig = () => {
|
|
|
1040
717
|
return null;
|
|
1041
718
|
};
|
|
1042
719
|
|
|
720
|
+
/**
|
|
721
|
+
* @description
|
|
722
|
+
* NavParams are an object that exists on a page and can contain data for that particular view.
|
|
723
|
+
* Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
|
|
724
|
+
* option with a simple `get` method.
|
|
725
|
+
*
|
|
726
|
+
* @usage
|
|
727
|
+
* ```ts
|
|
728
|
+
* import { NavParams } from '@ionic/angular';
|
|
729
|
+
*
|
|
730
|
+
* export class MyClass{
|
|
731
|
+
*
|
|
732
|
+
* constructor(navParams: NavParams){
|
|
733
|
+
* // userParams is an object we have in our nav-parameters
|
|
734
|
+
* navParams.get('userParams');
|
|
735
|
+
* }
|
|
736
|
+
*
|
|
737
|
+
* }
|
|
738
|
+
* ```
|
|
739
|
+
*/
|
|
740
|
+
class NavParams {
|
|
741
|
+
constructor(data = {}) {
|
|
742
|
+
this.data = data;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Get the value of a nav-parameter for the current view
|
|
746
|
+
*
|
|
747
|
+
* ```ts
|
|
748
|
+
* import { NavParams } from 'ionic-angular';
|
|
749
|
+
*
|
|
750
|
+
* export class MyClass{
|
|
751
|
+
* constructor(public navParams: NavParams){
|
|
752
|
+
* // userParams is an object we have in our nav-parameters
|
|
753
|
+
* this.navParams.get('userParams');
|
|
754
|
+
* }
|
|
755
|
+
* }
|
|
756
|
+
* ```
|
|
757
|
+
*
|
|
758
|
+
* @param param Which param you want to look up
|
|
759
|
+
*/
|
|
760
|
+
get(param) {
|
|
761
|
+
return this.data[param];
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
// TODO(FW-2827): types
|
|
766
|
+
class AngularDelegate {
|
|
767
|
+
constructor() {
|
|
768
|
+
this.zone = inject(NgZone);
|
|
769
|
+
this.applicationRef = inject(ApplicationRef);
|
|
770
|
+
}
|
|
771
|
+
create(environmentInjector, injector, elementReferenceKey) {
|
|
772
|
+
return new AngularFrameworkDelegate(environmentInjector, injector, this.applicationRef, this.zone, elementReferenceKey);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
/** @nocollapse */ AngularDelegate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
776
|
+
/** @nocollapse */ AngularDelegate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate });
|
|
777
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, decorators: [{
|
|
778
|
+
type: Injectable
|
|
779
|
+
}] });
|
|
780
|
+
class AngularFrameworkDelegate {
|
|
781
|
+
constructor(environmentInjector, injector, applicationRef, zone, elementReferenceKey) {
|
|
782
|
+
this.environmentInjector = environmentInjector;
|
|
783
|
+
this.injector = injector;
|
|
784
|
+
this.applicationRef = applicationRef;
|
|
785
|
+
this.zone = zone;
|
|
786
|
+
this.elementReferenceKey = elementReferenceKey;
|
|
787
|
+
this.elRefMap = new WeakMap();
|
|
788
|
+
this.elEventsMap = new WeakMap();
|
|
789
|
+
}
|
|
790
|
+
attachViewToDom(container, component, params, cssClasses) {
|
|
791
|
+
return this.zone.run(() => {
|
|
792
|
+
return new Promise((resolve) => {
|
|
793
|
+
const componentProps = {
|
|
794
|
+
...params,
|
|
795
|
+
};
|
|
796
|
+
/**
|
|
797
|
+
* Ionic Angular passes a reference to a modal
|
|
798
|
+
* or popover that can be accessed using a
|
|
799
|
+
* variable in the overlay component. If
|
|
800
|
+
* elementReferenceKey is defined, then we should
|
|
801
|
+
* pass a reference to the component using
|
|
802
|
+
* elementReferenceKey as the key.
|
|
803
|
+
*/
|
|
804
|
+
if (this.elementReferenceKey !== undefined) {
|
|
805
|
+
componentProps[this.elementReferenceKey] = container;
|
|
806
|
+
}
|
|
807
|
+
const el = attachView(this.zone, this.environmentInjector, this.injector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey);
|
|
808
|
+
resolve(el);
|
|
809
|
+
});
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
removeViewFromDom(_container, component) {
|
|
813
|
+
return this.zone.run(() => {
|
|
814
|
+
return new Promise((resolve) => {
|
|
815
|
+
const componentRef = this.elRefMap.get(component);
|
|
816
|
+
if (componentRef) {
|
|
817
|
+
componentRef.destroy();
|
|
818
|
+
this.elRefMap.delete(component);
|
|
819
|
+
const unbindEvents = this.elEventsMap.get(component);
|
|
820
|
+
if (unbindEvents) {
|
|
821
|
+
unbindEvents();
|
|
822
|
+
this.elEventsMap.delete(component);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
resolve();
|
|
826
|
+
});
|
|
827
|
+
});
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
const attachView = (zone, environmentInjector, injector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey) => {
|
|
831
|
+
/**
|
|
832
|
+
* Wraps the injector with a custom injector that
|
|
833
|
+
* provides NavParams to the component.
|
|
834
|
+
*
|
|
835
|
+
* NavParams is a legacy feature from Ionic v3 that allows
|
|
836
|
+
* Angular developers to provide data to a component
|
|
837
|
+
* and access it by providing NavParams as a dependency
|
|
838
|
+
* in the constructor.
|
|
839
|
+
*
|
|
840
|
+
* The modern approach is to access the data directly
|
|
841
|
+
* from the component's class instance.
|
|
842
|
+
*/
|
|
843
|
+
const childInjector = Injector.create({
|
|
844
|
+
providers: getProviders(params),
|
|
845
|
+
parent: injector,
|
|
846
|
+
});
|
|
847
|
+
const componentRef = createComponent(component, {
|
|
848
|
+
environmentInjector,
|
|
849
|
+
elementInjector: childInjector,
|
|
850
|
+
});
|
|
851
|
+
const instance = componentRef.instance;
|
|
852
|
+
const hostElement = componentRef.location.nativeElement;
|
|
853
|
+
if (params) {
|
|
854
|
+
/**
|
|
855
|
+
* For modals and popovers, a reference to the component is
|
|
856
|
+
* added to `params` during the call to attachViewToDom. If
|
|
857
|
+
* a reference using this name is already set, this means
|
|
858
|
+
* the app is trying to use the name as a component prop,
|
|
859
|
+
* which will cause collisions.
|
|
860
|
+
*/
|
|
861
|
+
if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
|
|
862
|
+
console.error(`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${component.name}.`);
|
|
863
|
+
}
|
|
864
|
+
Object.assign(instance, params);
|
|
865
|
+
}
|
|
866
|
+
if (cssClasses) {
|
|
867
|
+
for (const cssClass of cssClasses) {
|
|
868
|
+
hostElement.classList.add(cssClass);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
const unbindEvents = bindLifecycleEvents(zone, instance, hostElement);
|
|
872
|
+
container.appendChild(hostElement);
|
|
873
|
+
applicationRef.attachView(componentRef.hostView);
|
|
874
|
+
elRefMap.set(hostElement, componentRef);
|
|
875
|
+
elEventsMap.set(hostElement, unbindEvents);
|
|
876
|
+
return hostElement;
|
|
877
|
+
};
|
|
878
|
+
const LIFECYCLES = [
|
|
879
|
+
LIFECYCLE_WILL_ENTER,
|
|
880
|
+
LIFECYCLE_DID_ENTER,
|
|
881
|
+
LIFECYCLE_WILL_LEAVE,
|
|
882
|
+
LIFECYCLE_DID_LEAVE,
|
|
883
|
+
LIFECYCLE_WILL_UNLOAD,
|
|
884
|
+
];
|
|
885
|
+
const bindLifecycleEvents = (zone, instance, element) => {
|
|
886
|
+
return zone.run(() => {
|
|
887
|
+
const unregisters = LIFECYCLES.filter((eventName) => typeof instance[eventName] === 'function').map((eventName) => {
|
|
888
|
+
const handler = (ev) => instance[eventName](ev.detail);
|
|
889
|
+
element.addEventListener(eventName, handler);
|
|
890
|
+
return () => element.removeEventListener(eventName, handler);
|
|
891
|
+
});
|
|
892
|
+
return () => unregisters.forEach((fn) => fn());
|
|
893
|
+
});
|
|
894
|
+
};
|
|
895
|
+
const NavParamsToken = new InjectionToken('NavParamsToken');
|
|
896
|
+
const getProviders = (params) => {
|
|
897
|
+
return [
|
|
898
|
+
{
|
|
899
|
+
provide: NavParamsToken,
|
|
900
|
+
useValue: params,
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
provide: NavParams,
|
|
904
|
+
useFactory: provideNavParamsInjectable,
|
|
905
|
+
deps: [NavParamsToken],
|
|
906
|
+
},
|
|
907
|
+
];
|
|
908
|
+
};
|
|
909
|
+
const provideNavParamsInjectable = (params) => {
|
|
910
|
+
return new NavParams(params);
|
|
911
|
+
};
|
|
912
|
+
|
|
1043
913
|
// TODO: Is there a way we can grab this from angular-component-lib instead?
|
|
1044
914
|
const proxyInputs = (Cmp, inputs) => {
|
|
1045
915
|
const Prototype = Cmp.prototype;
|
|
@@ -2608,5 +2478,5 @@ class IonicRouteStrategy {
|
|
|
2608
2478
|
* Generated bundle index. Do not edit.
|
|
2609
2479
|
*/
|
|
2610
2480
|
|
|
2611
|
-
export {
|
|
2481
|
+
export { AlertController, AngularDelegate, Config, ConfigToken, DomController, IonBackButton, IonModal, IonNav, IonPopover, IonRouterOutlet, IonTabs, IonicRouteStrategy, LoadingController, MenuController, NavController, NavParams, OverlayBaseController, PickerController, Platform, ProxyCmp, RouterLinkDelegateDirective, RouterLinkWithHrefDelegateDirective, ValueAccessor, bindLifecycleEvents, provideComponentInputBinding, raf, setIonicClasses };
|
|
2612
2482
|
//# sourceMappingURL=ionic-angular-common.mjs.map
|