@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 { __awaiter, __decorate } from 'tslib';
5
5
  import * as i3 from '@angular/router';
6
6
  import { NavigationStart, PRIMARY_OUTLET, ChildrenOutletContexts, ActivatedRoute, Router } from '@angular/router';
@@ -155,214 +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 = Object.assign({}, params);
232
- /**
233
- * Ionic Angular passes a reference to a modal
234
- * or popover that can be accessed using a
235
- * variable in the overlay component. If
236
- * elementReferenceKey is defined, then we should
237
- * pass a reference to the component using
238
- * elementReferenceKey as the key.
239
- */
240
- if (this.elementReferenceKey !== undefined) {
241
- componentProps[this.elementReferenceKey] = container;
242
- }
243
- const el = attachView(this.zone, this.environmentInjector, this.injector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey);
244
- resolve(el);
245
- });
246
- });
247
- }
248
- removeViewFromDom(_container, component) {
249
- return this.zone.run(() => {
250
- return new Promise((resolve) => {
251
- const componentRef = this.elRefMap.get(component);
252
- if (componentRef) {
253
- componentRef.destroy();
254
- this.elRefMap.delete(component);
255
- const unbindEvents = this.elEventsMap.get(component);
256
- if (unbindEvents) {
257
- unbindEvents();
258
- this.elEventsMap.delete(component);
259
- }
260
- }
261
- resolve();
262
- });
263
- });
264
- }
265
- }
266
- const attachView = (zone, environmentInjector, injector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey) => {
267
- /**
268
- * Wraps the injector with a custom injector that
269
- * provides NavParams to the component.
270
- *
271
- * NavParams is a legacy feature from Ionic v3 that allows
272
- * Angular developers to provide data to a component
273
- * and access it by providing NavParams as a dependency
274
- * in the constructor.
275
- *
276
- * The modern approach is to access the data directly
277
- * from the component's class instance.
278
- */
279
- const childInjector = Injector.create({
280
- providers: getProviders(params),
281
- parent: injector,
282
- });
283
- const componentRef = createComponent(component, {
284
- environmentInjector,
285
- elementInjector: childInjector,
286
- });
287
- const instance = componentRef.instance;
288
- const hostElement = componentRef.location.nativeElement;
289
- if (params) {
290
- /**
291
- * For modals and popovers, a reference to the component is
292
- * added to `params` during the call to attachViewToDom. If
293
- * a reference using this name is already set, this means
294
- * the app is trying to use the name as a component prop,
295
- * which will cause collisions.
296
- */
297
- if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
298
- console.error(`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${component.name}.`);
299
- }
300
- Object.assign(instance, params);
301
- }
302
- if (cssClasses) {
303
- for (const cssClass of cssClasses) {
304
- hostElement.classList.add(cssClass);
305
- }
306
- }
307
- const unbindEvents = bindLifecycleEvents(zone, instance, hostElement);
308
- container.appendChild(hostElement);
309
- applicationRef.attachView(componentRef.hostView);
310
- elRefMap.set(hostElement, componentRef);
311
- elEventsMap.set(hostElement, unbindEvents);
312
- return hostElement;
313
- };
314
- const LIFECYCLES = [
315
- LIFECYCLE_WILL_ENTER,
316
- LIFECYCLE_DID_ENTER,
317
- LIFECYCLE_WILL_LEAVE,
318
- LIFECYCLE_DID_LEAVE,
319
- LIFECYCLE_WILL_UNLOAD,
320
- ];
321
- const bindLifecycleEvents = (zone, instance, element) => {
322
- return zone.run(() => {
323
- const unregisters = LIFECYCLES.filter((eventName) => typeof instance[eventName] === 'function').map((eventName) => {
324
- const handler = (ev) => instance[eventName](ev.detail);
325
- element.addEventListener(eventName, handler);
326
- return () => element.removeEventListener(eventName, handler);
327
- });
328
- return () => unregisters.forEach((fn) => fn());
329
- });
330
- };
331
- const NavParamsToken = new InjectionToken('NavParamsToken');
332
- const getProviders = (params) => {
333
- return [
334
- {
335
- provide: NavParamsToken,
336
- useValue: params,
337
- },
338
- {
339
- provide: NavParams,
340
- useFactory: provideNavParamsInjectable,
341
- deps: [NavParamsToken],
342
- },
343
- ];
344
- };
345
- const provideNavParamsInjectable = (params) => {
346
- return new NavParams(params);
347
- };
348
-
349
- class ModalController extends OverlayBaseController {
350
- constructor() {
351
- super(modalController);
352
- this.angularDelegate = inject(AngularDelegate);
353
- this.injector = inject(Injector);
354
- this.environmentInjector = inject(EnvironmentInjector);
355
- }
356
- create(opts) {
357
- return super.create(Object.assign(Object.assign({}, opts), { delegate: this.angularDelegate.create(this.environmentInjector, this.injector, 'modal') }));
358
- }
359
- }
360
- /** @nocollapse */ ModalController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
361
- /** @nocollapse */ ModalController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController });
362
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ModalController, decorators: [{
363
- type: Injectable
364
- }], ctorParameters: function () { return []; } });
365
-
366
158
  class PickerController extends OverlayBaseController {
367
159
  constructor() {
368
160
  super(pickerController);
@@ -377,20 +169,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
377
169
  }]
378
170
  }], ctorParameters: function () { return []; } });
379
171
 
380
- class ToastController extends OverlayBaseController {
381
- constructor() {
382
- super(toastController);
383
- }
384
- }
385
- /** @nocollapse */ ToastController.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
386
- /** @nocollapse */ ToastController.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, providedIn: 'root' });
387
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ToastController, decorators: [{
388
- type: Injectable,
389
- args: [{
390
- providedIn: 'root',
391
- }]
392
- }], ctorParameters: function () { return []; } });
393
-
394
172
  class AnimationController {
395
173
  /**
396
174
  * Create a new animation
@@ -1009,6 +787,197 @@ const getConfig = () => {
1009
787
  return null;
1010
788
  };
1011
789
 
790
+ /**
791
+ * @description
792
+ * NavParams are an object that exists on a page and can contain data for that particular view.
793
+ * Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
794
+ * option with a simple `get` method.
795
+ *
796
+ * @usage
797
+ * ```ts
798
+ * import { NavParams } from '@ionic/angular';
799
+ *
800
+ * export class MyClass{
801
+ *
802
+ * constructor(navParams: NavParams){
803
+ * // userParams is an object we have in our nav-parameters
804
+ * navParams.get('userParams');
805
+ * }
806
+ *
807
+ * }
808
+ * ```
809
+ */
810
+ class NavParams {
811
+ constructor(data = {}) {
812
+ this.data = data;
813
+ }
814
+ /**
815
+ * Get the value of a nav-parameter for the current view
816
+ *
817
+ * ```ts
818
+ * import { NavParams } from 'ionic-angular';
819
+ *
820
+ * export class MyClass{
821
+ * constructor(public navParams: NavParams){
822
+ * // userParams is an object we have in our nav-parameters
823
+ * this.navParams.get('userParams');
824
+ * }
825
+ * }
826
+ * ```
827
+ *
828
+ * @param param Which param you want to look up
829
+ */
830
+ get(param) {
831
+ return this.data[param];
832
+ }
833
+ }
834
+
835
+ // TODO(FW-2827): types
836
+ class AngularDelegate {
837
+ constructor() {
838
+ this.zone = inject(NgZone);
839
+ this.applicationRef = inject(ApplicationRef);
840
+ }
841
+ create(environmentInjector, injector, elementReferenceKey) {
842
+ return new AngularFrameworkDelegate(environmentInjector, injector, this.applicationRef, this.zone, elementReferenceKey);
843
+ }
844
+ }
845
+ /** @nocollapse */ AngularDelegate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
846
+ /** @nocollapse */ AngularDelegate.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate });
847
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, decorators: [{
848
+ type: Injectable
849
+ }] });
850
+ class AngularFrameworkDelegate {
851
+ constructor(environmentInjector, injector, applicationRef, zone, elementReferenceKey) {
852
+ this.environmentInjector = environmentInjector;
853
+ this.injector = injector;
854
+ this.applicationRef = applicationRef;
855
+ this.zone = zone;
856
+ this.elementReferenceKey = elementReferenceKey;
857
+ this.elRefMap = new WeakMap();
858
+ this.elEventsMap = new WeakMap();
859
+ }
860
+ attachViewToDom(container, component, params, cssClasses) {
861
+ return this.zone.run(() => {
862
+ return new Promise((resolve) => {
863
+ const componentProps = Object.assign({}, params);
864
+ /**
865
+ * Ionic Angular passes a reference to a modal
866
+ * or popover that can be accessed using a
867
+ * variable in the overlay component. If
868
+ * elementReferenceKey is defined, then we should
869
+ * pass a reference to the component using
870
+ * elementReferenceKey as the key.
871
+ */
872
+ if (this.elementReferenceKey !== undefined) {
873
+ componentProps[this.elementReferenceKey] = container;
874
+ }
875
+ const el = attachView(this.zone, this.environmentInjector, this.injector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey);
876
+ resolve(el);
877
+ });
878
+ });
879
+ }
880
+ removeViewFromDom(_container, component) {
881
+ return this.zone.run(() => {
882
+ return new Promise((resolve) => {
883
+ const componentRef = this.elRefMap.get(component);
884
+ if (componentRef) {
885
+ componentRef.destroy();
886
+ this.elRefMap.delete(component);
887
+ const unbindEvents = this.elEventsMap.get(component);
888
+ if (unbindEvents) {
889
+ unbindEvents();
890
+ this.elEventsMap.delete(component);
891
+ }
892
+ }
893
+ resolve();
894
+ });
895
+ });
896
+ }
897
+ }
898
+ const attachView = (zone, environmentInjector, injector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey) => {
899
+ /**
900
+ * Wraps the injector with a custom injector that
901
+ * provides NavParams to the component.
902
+ *
903
+ * NavParams is a legacy feature from Ionic v3 that allows
904
+ * Angular developers to provide data to a component
905
+ * and access it by providing NavParams as a dependency
906
+ * in the constructor.
907
+ *
908
+ * The modern approach is to access the data directly
909
+ * from the component's class instance.
910
+ */
911
+ const childInjector = Injector.create({
912
+ providers: getProviders(params),
913
+ parent: injector,
914
+ });
915
+ const componentRef = createComponent(component, {
916
+ environmentInjector,
917
+ elementInjector: childInjector,
918
+ });
919
+ const instance = componentRef.instance;
920
+ const hostElement = componentRef.location.nativeElement;
921
+ if (params) {
922
+ /**
923
+ * For modals and popovers, a reference to the component is
924
+ * added to `params` during the call to attachViewToDom. If
925
+ * a reference using this name is already set, this means
926
+ * the app is trying to use the name as a component prop,
927
+ * which will cause collisions.
928
+ */
929
+ if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
930
+ console.error(`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${component.name}.`);
931
+ }
932
+ Object.assign(instance, params);
933
+ }
934
+ if (cssClasses) {
935
+ for (const cssClass of cssClasses) {
936
+ hostElement.classList.add(cssClass);
937
+ }
938
+ }
939
+ const unbindEvents = bindLifecycleEvents(zone, instance, hostElement);
940
+ container.appendChild(hostElement);
941
+ applicationRef.attachView(componentRef.hostView);
942
+ elRefMap.set(hostElement, componentRef);
943
+ elEventsMap.set(hostElement, unbindEvents);
944
+ return hostElement;
945
+ };
946
+ const LIFECYCLES = [
947
+ LIFECYCLE_WILL_ENTER,
948
+ LIFECYCLE_DID_ENTER,
949
+ LIFECYCLE_WILL_LEAVE,
950
+ LIFECYCLE_DID_LEAVE,
951
+ LIFECYCLE_WILL_UNLOAD,
952
+ ];
953
+ const bindLifecycleEvents = (zone, instance, element) => {
954
+ return zone.run(() => {
955
+ const unregisters = LIFECYCLES.filter((eventName) => typeof instance[eventName] === 'function').map((eventName) => {
956
+ const handler = (ev) => instance[eventName](ev.detail);
957
+ element.addEventListener(eventName, handler);
958
+ return () => element.removeEventListener(eventName, handler);
959
+ });
960
+ return () => unregisters.forEach((fn) => fn());
961
+ });
962
+ };
963
+ const NavParamsToken = new InjectionToken('NavParamsToken');
964
+ const getProviders = (params) => {
965
+ return [
966
+ {
967
+ provide: NavParamsToken,
968
+ useValue: params,
969
+ },
970
+ {
971
+ provide: NavParams,
972
+ useFactory: provideNavParamsInjectable,
973
+ deps: [NavParamsToken],
974
+ },
975
+ ];
976
+ };
977
+ const provideNavParamsInjectable = (params) => {
978
+ return new NavParams(params);
979
+ };
980
+
1012
981
  // TODO: Is there a way we can grab this from angular-component-lib instead?
1013
982
  const proxyInputs = (Cmp, inputs) => {
1014
983
  const Prototype = Cmp.prototype;
@@ -2588,5 +2557,5 @@ class IonicRouteStrategy {
2588
2557
  * Generated bundle index. Do not edit.
2589
2558
  */
2590
2559
 
2591
- 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 };
2560
+ 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 };
2592
2561
  //# sourceMappingURL=ionic-angular-common.mjs.map