@ionic/angular 7.5.5-dev.11699885110.10e38569 → 7.5.5-dev.11699885804.1d8011d5

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.
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
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, toastController, createAnimation, getTimeGivenProgression, createGesture, isPlatform, getPlatforms, LIFECYCLE_WILL_ENTER, LIFECYCLE_DID_ENTER, LIFECYCLE_WILL_LEAVE, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_UNLOAD, componentOnReady } from '@ionic/core/components';
2
+ import { Injectable, inject, NgZone, ApplicationRef, Injector, createComponent, InjectionToken, EnvironmentInjector, Inject, Optional, TemplateRef, Directive, ContentChild, EventEmitter, ViewContainerRef, Attribute, SkipSelf, Input, Output, reflectComponentType, HostListener, ElementRef, ViewChild } from '@angular/core';
3
+ import { alertController, loadingController, LIFECYCLE_WILL_ENTER, LIFECYCLE_DID_ENTER, LIFECYCLE_WILL_LEAVE, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_UNLOAD, modalController, pickerController, toastController, createAnimation, getTimeGivenProgression, createGesture, isPlatform, getPlatforms, 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';
@@ -155,6 +155,219 @@ class MenuController {
155
155
  }
156
156
  }
157
157
 
158
+ /**
159
+ * @description
160
+ * NavParams are an object that exists on a page and can contain data for that particular view.
161
+ * Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
162
+ * option with a simple `get` method.
163
+ *
164
+ * @usage
165
+ * ```ts
166
+ * import { NavParams } from '@ionic/angular';
167
+ *
168
+ * export class MyClass{
169
+ *
170
+ * constructor(navParams: NavParams){
171
+ * // userParams is an object we have in our nav-parameters
172
+ * navParams.get('userParams');
173
+ * }
174
+ *
175
+ * }
176
+ * ```
177
+ */
178
+ class NavParams {
179
+ constructor(data = {}) {
180
+ this.data = data;
181
+ }
182
+ /**
183
+ * Get the value of a nav-parameter for the current view
184
+ *
185
+ * ```ts
186
+ * import { NavParams } from 'ionic-angular';
187
+ *
188
+ * export class MyClass{
189
+ * constructor(public navParams: NavParams){
190
+ * // userParams is an object we have in our nav-parameters
191
+ * this.navParams.get('userParams');
192
+ * }
193
+ * }
194
+ * ```
195
+ *
196
+ * @param param Which param you want to look up
197
+ */
198
+ get(param) {
199
+ return this.data[param];
200
+ }
201
+ }
202
+
203
+ // TODO(FW-2827): types
204
+ class AngularDelegate {
205
+ constructor() {
206
+ this.zone = inject(NgZone);
207
+ this.applicationRef = inject(ApplicationRef);
208
+ }
209
+ create(environmentInjector, injector, elementReferenceKey) {
210
+ return new AngularFrameworkDelegate(environmentInjector, injector, this.applicationRef, this.zone, elementReferenceKey);
211
+ }
212
+ }
213
+ /** @nocollapse */ AngularDelegate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
214
+ /** @nocollapse */ AngularDelegate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate });
215
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, decorators: [{
216
+ type: Injectable
217
+ }] });
218
+ class AngularFrameworkDelegate {
219
+ constructor(environmentInjector, injector, applicationRef, zone, elementReferenceKey) {
220
+ this.environmentInjector = environmentInjector;
221
+ this.injector = injector;
222
+ this.applicationRef = applicationRef;
223
+ this.zone = zone;
224
+ this.elementReferenceKey = elementReferenceKey;
225
+ this.elRefMap = new WeakMap();
226
+ this.elEventsMap = new WeakMap();
227
+ }
228
+ attachViewToDom(container, component, params, cssClasses) {
229
+ return this.zone.run(() => {
230
+ return new Promise((resolve) => {
231
+ const componentProps = {
232
+ ...params,
233
+ };
234
+ /**
235
+ * Ionic Angular passes a reference to a modal
236
+ * or popover that can be accessed using a
237
+ * variable in the overlay component. If
238
+ * elementReferenceKey is defined, then we should
239
+ * pass a reference to the component using
240
+ * elementReferenceKey as the key.
241
+ */
242
+ if (this.elementReferenceKey !== undefined) {
243
+ componentProps[this.elementReferenceKey] = container;
244
+ }
245
+ const el = attachView(this.zone, this.environmentInjector, this.injector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey);
246
+ resolve(el);
247
+ });
248
+ });
249
+ }
250
+ removeViewFromDom(_container, component) {
251
+ return this.zone.run(() => {
252
+ return new Promise((resolve) => {
253
+ const componentRef = this.elRefMap.get(component);
254
+ if (componentRef) {
255
+ componentRef.destroy();
256
+ this.elRefMap.delete(component);
257
+ const unbindEvents = this.elEventsMap.get(component);
258
+ if (unbindEvents) {
259
+ unbindEvents();
260
+ this.elEventsMap.delete(component);
261
+ }
262
+ }
263
+ resolve();
264
+ });
265
+ });
266
+ }
267
+ }
268
+ const attachView = (zone, environmentInjector, injector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey) => {
269
+ /**
270
+ * Wraps the injector with a custom injector that
271
+ * provides NavParams to the component.
272
+ *
273
+ * NavParams is a legacy feature from Ionic v3 that allows
274
+ * Angular developers to provide data to a component
275
+ * and access it by providing NavParams as a dependency
276
+ * in the constructor.
277
+ *
278
+ * The modern approach is to access the data directly
279
+ * from the component's class instance.
280
+ */
281
+ const childInjector = Injector.create({
282
+ providers: getProviders(params),
283
+ parent: injector,
284
+ });
285
+ const componentRef = createComponent(component, {
286
+ environmentInjector,
287
+ elementInjector: childInjector,
288
+ });
289
+ const instance = componentRef.instance;
290
+ const hostElement = componentRef.location.nativeElement;
291
+ if (params) {
292
+ /**
293
+ * For modals and popovers, a reference to the component is
294
+ * added to `params` during the call to attachViewToDom. If
295
+ * a reference using this name is already set, this means
296
+ * the app is trying to use the name as a component prop,
297
+ * which will cause collisions.
298
+ */
299
+ if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
300
+ console.error(`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${component.name}.`);
301
+ }
302
+ Object.assign(instance, params);
303
+ }
304
+ if (cssClasses) {
305
+ for (const cssClass of cssClasses) {
306
+ hostElement.classList.add(cssClass);
307
+ }
308
+ }
309
+ const unbindEvents = bindLifecycleEvents(zone, instance, hostElement);
310
+ container.appendChild(hostElement);
311
+ applicationRef.attachView(componentRef.hostView);
312
+ elRefMap.set(hostElement, componentRef);
313
+ elEventsMap.set(hostElement, unbindEvents);
314
+ return hostElement;
315
+ };
316
+ const LIFECYCLES = [
317
+ LIFECYCLE_WILL_ENTER,
318
+ LIFECYCLE_DID_ENTER,
319
+ LIFECYCLE_WILL_LEAVE,
320
+ LIFECYCLE_DID_LEAVE,
321
+ LIFECYCLE_WILL_UNLOAD,
322
+ ];
323
+ const bindLifecycleEvents = (zone, instance, element) => {
324
+ return zone.run(() => {
325
+ const unregisters = LIFECYCLES.filter((eventName) => typeof instance[eventName] === 'function').map((eventName) => {
326
+ const handler = (ev) => instance[eventName](ev.detail);
327
+ element.addEventListener(eventName, handler);
328
+ return () => element.removeEventListener(eventName, handler);
329
+ });
330
+ return () => unregisters.forEach((fn) => fn());
331
+ });
332
+ };
333
+ const NavParamsToken = new InjectionToken('NavParamsToken');
334
+ const getProviders = (params) => {
335
+ return [
336
+ {
337
+ provide: NavParamsToken,
338
+ useValue: params,
339
+ },
340
+ {
341
+ provide: NavParams,
342
+ useFactory: provideNavParamsInjectable,
343
+ deps: [NavParamsToken],
344
+ },
345
+ ];
346
+ };
347
+ const provideNavParamsInjectable = (params) => {
348
+ return new NavParams(params);
349
+ };
350
+
351
+ class ModalController extends OverlayBaseController {
352
+ constructor() {
353
+ super(modalController);
354
+ this.angularDelegate = inject(AngularDelegate);
355
+ this.injector = inject(Injector);
356
+ this.environmentInjector = inject(EnvironmentInjector);
357
+ }
358
+ create(opts) {
359
+ return super.create({
360
+ ...opts,
361
+ delegate: this.angularDelegate.create(this.environmentInjector, this.injector, 'modal'),
362
+ });
363
+ }
364
+ }
365
+ /** @nocollapse */ ModalController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
366
+ /** @nocollapse */ ModalController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController });
367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController, decorators: [{
368
+ type: Injectable
369
+ }], ctorParameters: function () { return []; } });
370
+
158
371
  class PickerController extends OverlayBaseController {
159
372
  constructor() {
160
373
  super(pickerController);
@@ -793,199 +1006,6 @@ const getConfig = () => {
793
1006
  return null;
794
1007
  };
795
1008
 
796
- /**
797
- * @description
798
- * NavParams are an object that exists on a page and can contain data for that particular view.
799
- * Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
800
- * option with a simple `get` method.
801
- *
802
- * @usage
803
- * ```ts
804
- * import { NavParams } from '@ionic/angular';
805
- *
806
- * export class MyClass{
807
- *
808
- * constructor(navParams: NavParams){
809
- * // userParams is an object we have in our nav-parameters
810
- * navParams.get('userParams');
811
- * }
812
- *
813
- * }
814
- * ```
815
- */
816
- class NavParams {
817
- constructor(data = {}) {
818
- this.data = data;
819
- }
820
- /**
821
- * Get the value of a nav-parameter for the current view
822
- *
823
- * ```ts
824
- * import { NavParams } from 'ionic-angular';
825
- *
826
- * export class MyClass{
827
- * constructor(public navParams: NavParams){
828
- * // userParams is an object we have in our nav-parameters
829
- * this.navParams.get('userParams');
830
- * }
831
- * }
832
- * ```
833
- *
834
- * @param param Which param you want to look up
835
- */
836
- get(param) {
837
- return this.data[param];
838
- }
839
- }
840
-
841
- // TODO(FW-2827): types
842
- class AngularDelegate {
843
- constructor() {
844
- this.zone = inject(NgZone);
845
- this.applicationRef = inject(ApplicationRef);
846
- }
847
- create(environmentInjector, injector, elementReferenceKey) {
848
- return new AngularFrameworkDelegate(environmentInjector, injector, this.applicationRef, this.zone, elementReferenceKey);
849
- }
850
- }
851
- /** @nocollapse */ AngularDelegate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
852
- /** @nocollapse */ AngularDelegate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate });
853
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, decorators: [{
854
- type: Injectable
855
- }] });
856
- class AngularFrameworkDelegate {
857
- constructor(environmentInjector, injector, applicationRef, zone, elementReferenceKey) {
858
- this.environmentInjector = environmentInjector;
859
- this.injector = injector;
860
- this.applicationRef = applicationRef;
861
- this.zone = zone;
862
- this.elementReferenceKey = elementReferenceKey;
863
- this.elRefMap = new WeakMap();
864
- this.elEventsMap = new WeakMap();
865
- }
866
- attachViewToDom(container, component, params, cssClasses) {
867
- return this.zone.run(() => {
868
- return new Promise((resolve) => {
869
- const componentProps = {
870
- ...params,
871
- };
872
- /**
873
- * Ionic Angular passes a reference to a modal
874
- * or popover that can be accessed using a
875
- * variable in the overlay component. If
876
- * elementReferenceKey is defined, then we should
877
- * pass a reference to the component using
878
- * elementReferenceKey as the key.
879
- */
880
- if (this.elementReferenceKey !== undefined) {
881
- componentProps[this.elementReferenceKey] = container;
882
- }
883
- const el = attachView(this.zone, this.environmentInjector, this.injector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey);
884
- resolve(el);
885
- });
886
- });
887
- }
888
- removeViewFromDom(_container, component) {
889
- return this.zone.run(() => {
890
- return new Promise((resolve) => {
891
- const componentRef = this.elRefMap.get(component);
892
- if (componentRef) {
893
- componentRef.destroy();
894
- this.elRefMap.delete(component);
895
- const unbindEvents = this.elEventsMap.get(component);
896
- if (unbindEvents) {
897
- unbindEvents();
898
- this.elEventsMap.delete(component);
899
- }
900
- }
901
- resolve();
902
- });
903
- });
904
- }
905
- }
906
- const attachView = (zone, environmentInjector, injector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey) => {
907
- /**
908
- * Wraps the injector with a custom injector that
909
- * provides NavParams to the component.
910
- *
911
- * NavParams is a legacy feature from Ionic v3 that allows
912
- * Angular developers to provide data to a component
913
- * and access it by providing NavParams as a dependency
914
- * in the constructor.
915
- *
916
- * The modern approach is to access the data directly
917
- * from the component's class instance.
918
- */
919
- const childInjector = Injector.create({
920
- providers: getProviders(params),
921
- parent: injector,
922
- });
923
- const componentRef = createComponent(component, {
924
- environmentInjector,
925
- elementInjector: childInjector,
926
- });
927
- const instance = componentRef.instance;
928
- const hostElement = componentRef.location.nativeElement;
929
- if (params) {
930
- /**
931
- * For modals and popovers, a reference to the component is
932
- * added to `params` during the call to attachViewToDom. If
933
- * a reference using this name is already set, this means
934
- * the app is trying to use the name as a component prop,
935
- * which will cause collisions.
936
- */
937
- if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
938
- console.error(`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${component.name}.`);
939
- }
940
- Object.assign(instance, params);
941
- }
942
- if (cssClasses) {
943
- for (const cssClass of cssClasses) {
944
- hostElement.classList.add(cssClass);
945
- }
946
- }
947
- const unbindEvents = bindLifecycleEvents(zone, instance, hostElement);
948
- container.appendChild(hostElement);
949
- applicationRef.attachView(componentRef.hostView);
950
- elRefMap.set(hostElement, componentRef);
951
- elEventsMap.set(hostElement, unbindEvents);
952
- return hostElement;
953
- };
954
- const LIFECYCLES = [
955
- LIFECYCLE_WILL_ENTER,
956
- LIFECYCLE_DID_ENTER,
957
- LIFECYCLE_WILL_LEAVE,
958
- LIFECYCLE_DID_LEAVE,
959
- LIFECYCLE_WILL_UNLOAD,
960
- ];
961
- const bindLifecycleEvents = (zone, instance, element) => {
962
- return zone.run(() => {
963
- const unregisters = LIFECYCLES.filter((eventName) => typeof instance[eventName] === 'function').map((eventName) => {
964
- const handler = (ev) => instance[eventName](ev.detail);
965
- element.addEventListener(eventName, handler);
966
- return () => element.removeEventListener(eventName, handler);
967
- });
968
- return () => unregisters.forEach((fn) => fn());
969
- });
970
- };
971
- const NavParamsToken = new InjectionToken('NavParamsToken');
972
- const getProviders = (params) => {
973
- return [
974
- {
975
- provide: NavParamsToken,
976
- useValue: params,
977
- },
978
- {
979
- provide: NavParams,
980
- useFactory: provideNavParamsInjectable,
981
- deps: [NavParamsToken],
982
- },
983
- ];
984
- };
985
- const provideNavParamsInjectable = (params) => {
986
- return new NavParams(params);
987
- };
988
-
989
1009
  // TODO: Is there a way we can grab this from angular-component-lib instead?
990
1010
  const proxyInputs = (Cmp, inputs) => {
991
1011
  const Prototype = Cmp.prototype;
@@ -2554,5 +2574,5 @@ class IonicRouteStrategy {
2554
2574
  * Generated bundle index. Do not edit.
2555
2575
  */
2556
2576
 
2557
- export { AlertController, AngularDelegate, AnimationController, Config, ConfigToken, DomController, GestureController, IonBackButton, IonModal, IonNav, IonPopover, IonRouterOutlet, IonTabs, IonicRouteStrategy, LoadingController, MenuController, NavController, NavParams, OverlayBaseController, PickerController, Platform, ProxyCmp, RouterLinkDelegateDirective, RouterLinkWithHrefDelegateDirective, ToastController, ValueAccessor, bindLifecycleEvents, provideComponentInputBinding, raf, setIonicClasses };
2577
+ export { AlertController, AngularDelegate, AnimationController, Config, ConfigToken, DomController, GestureController, IonBackButton, IonModal, IonNav, IonPopover, IonRouterOutlet, IonTabs, IonicRouteStrategy, LoadingController, MenuController, ModalController, NavController, NavParams, OverlayBaseController, PickerController, Platform, ProxyCmp, RouterLinkDelegateDirective, RouterLinkWithHrefDelegateDirective, ToastController, ValueAccessor, bindLifecycleEvents, provideComponentInputBinding, raf, setIonicClasses };
2558
2578
  //# sourceMappingURL=ionic-angular-common.mjs.map