@ionic/angular 7.5.5-dev.11699885804.1d8011d5 → 7.5.5-dev.11699898164.1391cfb3

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.
Files changed (31) hide show
  1. package/common/index.d.ts +0 -2
  2. package/esm2020/common/index.mjs +1 -3
  3. package/esm2020/index.mjs +5 -3
  4. package/esm2020/ionic-module.mjs +3 -2
  5. package/esm2020/providers/modal-controller.mjs +24 -0
  6. package/esm2020/providers/toast-controller.mjs +18 -0
  7. package/esm2020/standalone/index.mjs +5 -3
  8. package/esm2020/standalone/providers/ionic-angular.mjs +3 -2
  9. package/esm2020/standalone/providers/modal-controller.mjs +24 -0
  10. package/esm2020/standalone/providers/toast-controller.mjs +18 -0
  11. package/fesm2015/ionic-angular-common.mjs +194 -225
  12. package/fesm2015/ionic-angular-common.mjs.map +1 -1
  13. package/fesm2015/ionic-angular-standalone.mjs +41 -10
  14. package/fesm2015/ionic-angular-standalone.mjs.map +1 -1
  15. package/fesm2015/ionic-angular.mjs +40 -9
  16. package/fesm2015/ionic-angular.mjs.map +1 -1
  17. package/fesm2020/ionic-angular-common.mjs +196 -230
  18. package/fesm2020/ionic-angular-common.mjs.map +1 -1
  19. package/fesm2020/ionic-angular-standalone.mjs +44 -10
  20. package/fesm2020/ionic-angular-standalone.mjs.map +1 -1
  21. package/fesm2020/ionic-angular.mjs +43 -9
  22. package/fesm2020/ionic-angular.mjs.map +1 -1
  23. package/index.d.ts +4 -2
  24. package/package.json +2 -2
  25. package/providers/modal-controller.d.ts +12 -0
  26. package/providers/toast-controller.d.ts +8 -0
  27. package/standalone/index.d.ts +4 -2
  28. package/{common → standalone}/providers/modal-controller.d.ts +1 -1
  29. package/{common → standalone}/providers/toast-controller.d.ts +1 -1
  30. package/esm2020/common/providers/modal-controller.mjs +0 -25
  31. package/esm2020/common/providers/toast-controller.mjs +0 -18
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
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';
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, 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';
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,219 +155,6 @@ 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
-
371
158
  class PickerController extends OverlayBaseController {
372
159
  constructor() {
373
160
  super(pickerController);
@@ -382,20 +169,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
382
169
  }]
383
170
  }], ctorParameters: function () { return []; } });
384
171
 
385
- class ToastController extends OverlayBaseController {
386
- constructor() {
387
- super(toastController);
388
- }
389
- }
390
- /** @nocollapse */ ToastController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
391
- /** @nocollapse */ ToastController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, providedIn: 'root' });
392
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, decorators: [{
393
- type: Injectable,
394
- args: [{
395
- providedIn: 'root',
396
- }]
397
- }], ctorParameters: function () { return []; } });
398
-
399
172
  class AnimationController {
400
173
  /**
401
174
  * Create a new animation
@@ -1006,6 +779,199 @@ const getConfig = () => {
1006
779
  return null;
1007
780
  };
1008
781
 
782
+ /**
783
+ * @description
784
+ * NavParams are an object that exists on a page and can contain data for that particular view.
785
+ * Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
786
+ * option with a simple `get` method.
787
+ *
788
+ * @usage
789
+ * ```ts
790
+ * import { NavParams } from '@ionic/angular';
791
+ *
792
+ * export class MyClass{
793
+ *
794
+ * constructor(navParams: NavParams){
795
+ * // userParams is an object we have in our nav-parameters
796
+ * navParams.get('userParams');
797
+ * }
798
+ *
799
+ * }
800
+ * ```
801
+ */
802
+ class NavParams {
803
+ constructor(data = {}) {
804
+ this.data = data;
805
+ }
806
+ /**
807
+ * Get the value of a nav-parameter for the current view
808
+ *
809
+ * ```ts
810
+ * import { NavParams } from 'ionic-angular';
811
+ *
812
+ * export class MyClass{
813
+ * constructor(public navParams: NavParams){
814
+ * // userParams is an object we have in our nav-parameters
815
+ * this.navParams.get('userParams');
816
+ * }
817
+ * }
818
+ * ```
819
+ *
820
+ * @param param Which param you want to look up
821
+ */
822
+ get(param) {
823
+ return this.data[param];
824
+ }
825
+ }
826
+
827
+ // TODO(FW-2827): types
828
+ class AngularDelegate {
829
+ constructor() {
830
+ this.zone = inject(NgZone);
831
+ this.applicationRef = inject(ApplicationRef);
832
+ }
833
+ create(environmentInjector, injector, elementReferenceKey) {
834
+ return new AngularFrameworkDelegate(environmentInjector, injector, this.applicationRef, this.zone, elementReferenceKey);
835
+ }
836
+ }
837
+ /** @nocollapse */ AngularDelegate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
838
+ /** @nocollapse */ AngularDelegate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate });
839
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, decorators: [{
840
+ type: Injectable
841
+ }] });
842
+ class AngularFrameworkDelegate {
843
+ constructor(environmentInjector, injector, applicationRef, zone, elementReferenceKey) {
844
+ this.environmentInjector = environmentInjector;
845
+ this.injector = injector;
846
+ this.applicationRef = applicationRef;
847
+ this.zone = zone;
848
+ this.elementReferenceKey = elementReferenceKey;
849
+ this.elRefMap = new WeakMap();
850
+ this.elEventsMap = new WeakMap();
851
+ }
852
+ attachViewToDom(container, component, params, cssClasses) {
853
+ return this.zone.run(() => {
854
+ return new Promise((resolve) => {
855
+ const componentProps = {
856
+ ...params,
857
+ };
858
+ /**
859
+ * Ionic Angular passes a reference to a modal
860
+ * or popover that can be accessed using a
861
+ * variable in the overlay component. If
862
+ * elementReferenceKey is defined, then we should
863
+ * pass a reference to the component using
864
+ * elementReferenceKey as the key.
865
+ */
866
+ if (this.elementReferenceKey !== undefined) {
867
+ componentProps[this.elementReferenceKey] = container;
868
+ }
869
+ const el = attachView(this.zone, this.environmentInjector, this.injector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey);
870
+ resolve(el);
871
+ });
872
+ });
873
+ }
874
+ removeViewFromDom(_container, component) {
875
+ return this.zone.run(() => {
876
+ return new Promise((resolve) => {
877
+ const componentRef = this.elRefMap.get(component);
878
+ if (componentRef) {
879
+ componentRef.destroy();
880
+ this.elRefMap.delete(component);
881
+ const unbindEvents = this.elEventsMap.get(component);
882
+ if (unbindEvents) {
883
+ unbindEvents();
884
+ this.elEventsMap.delete(component);
885
+ }
886
+ }
887
+ resolve();
888
+ });
889
+ });
890
+ }
891
+ }
892
+ const attachView = (zone, environmentInjector, injector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey) => {
893
+ /**
894
+ * Wraps the injector with a custom injector that
895
+ * provides NavParams to the component.
896
+ *
897
+ * NavParams is a legacy feature from Ionic v3 that allows
898
+ * Angular developers to provide data to a component
899
+ * and access it by providing NavParams as a dependency
900
+ * in the constructor.
901
+ *
902
+ * The modern approach is to access the data directly
903
+ * from the component's class instance.
904
+ */
905
+ const childInjector = Injector.create({
906
+ providers: getProviders(params),
907
+ parent: injector,
908
+ });
909
+ const componentRef = createComponent(component, {
910
+ environmentInjector,
911
+ elementInjector: childInjector,
912
+ });
913
+ const instance = componentRef.instance;
914
+ const hostElement = componentRef.location.nativeElement;
915
+ if (params) {
916
+ /**
917
+ * For modals and popovers, a reference to the component is
918
+ * added to `params` during the call to attachViewToDom. If
919
+ * a reference using this name is already set, this means
920
+ * the app is trying to use the name as a component prop,
921
+ * which will cause collisions.
922
+ */
923
+ if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
924
+ console.error(`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${component.name}.`);
925
+ }
926
+ Object.assign(instance, params);
927
+ }
928
+ if (cssClasses) {
929
+ for (const cssClass of cssClasses) {
930
+ hostElement.classList.add(cssClass);
931
+ }
932
+ }
933
+ const unbindEvents = bindLifecycleEvents(zone, instance, hostElement);
934
+ container.appendChild(hostElement);
935
+ applicationRef.attachView(componentRef.hostView);
936
+ elRefMap.set(hostElement, componentRef);
937
+ elEventsMap.set(hostElement, unbindEvents);
938
+ return hostElement;
939
+ };
940
+ const LIFECYCLES = [
941
+ LIFECYCLE_WILL_ENTER,
942
+ LIFECYCLE_DID_ENTER,
943
+ LIFECYCLE_WILL_LEAVE,
944
+ LIFECYCLE_DID_LEAVE,
945
+ LIFECYCLE_WILL_UNLOAD,
946
+ ];
947
+ const bindLifecycleEvents = (zone, instance, element) => {
948
+ return zone.run(() => {
949
+ const unregisters = LIFECYCLES.filter((eventName) => typeof instance[eventName] === 'function').map((eventName) => {
950
+ const handler = (ev) => instance[eventName](ev.detail);
951
+ element.addEventListener(eventName, handler);
952
+ return () => element.removeEventListener(eventName, handler);
953
+ });
954
+ return () => unregisters.forEach((fn) => fn());
955
+ });
956
+ };
957
+ const NavParamsToken = new InjectionToken('NavParamsToken');
958
+ const getProviders = (params) => {
959
+ return [
960
+ {
961
+ provide: NavParamsToken,
962
+ useValue: params,
963
+ },
964
+ {
965
+ provide: NavParams,
966
+ useFactory: provideNavParamsInjectable,
967
+ deps: [NavParamsToken],
968
+ },
969
+ ];
970
+ };
971
+ const provideNavParamsInjectable = (params) => {
972
+ return new NavParams(params);
973
+ };
974
+
1009
975
  // TODO: Is there a way we can grab this from angular-component-lib instead?
1010
976
  const proxyInputs = (Cmp, inputs) => {
1011
977
  const Prototype = Cmp.prototype;
@@ -2574,5 +2540,5 @@ class IonicRouteStrategy {
2574
2540
  * Generated bundle index. Do not edit.
2575
2541
  */
2576
2542
 
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 };
2543
+ 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, ValueAccessor, bindLifecycleEvents, provideComponentInputBinding, raf, setIonicClasses };
2578
2544
  //# sourceMappingURL=ionic-angular-common.mjs.map