@ionic/angular 7.6.2-dev.11705355381.14b22962 → 7.6.2-dev.11706202387.1dfcd9b8

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 (37) hide show
  1. package/common/directives/navigation/nav.d.ts +2 -2
  2. package/common/index.d.ts +0 -1
  3. package/common/providers/angular-delegate.d.ts +4 -5
  4. package/directives/navigation/ion-nav.d.ts +2 -2
  5. package/esm2020/common/directives/navigation/nav.mjs +5 -5
  6. package/esm2020/common/index.mjs +1 -2
  7. package/esm2020/common/providers/angular-delegate.mjs +28 -44
  8. package/esm2020/directives/navigation/ion-nav.mjs +5 -5
  9. package/esm2020/index.mjs +2 -2
  10. package/esm2020/providers/modal-controller.mjs +3 -4
  11. package/esm2020/providers/popover-controller.mjs +3 -4
  12. package/esm2020/standalone/index.mjs +2 -2
  13. package/esm2020/standalone/navigation/nav.mjs +5 -5
  14. package/esm2020/standalone/providers/modal-controller.mjs +3 -4
  15. package/esm2020/standalone/providers/popover-controller.mjs +3 -4
  16. package/fesm2015/ionic-angular-common.mjs +33 -93
  17. package/fesm2015/ionic-angular-common.mjs.map +1 -1
  18. package/fesm2015/ionic-angular-standalone.mjs +8 -10
  19. package/fesm2015/ionic-angular-standalone.mjs.map +1 -1
  20. package/fesm2015/ionic-angular.mjs +8 -10
  21. package/fesm2015/ionic-angular.mjs.map +1 -1
  22. package/fesm2020/ionic-angular-common.mjs +32 -92
  23. package/fesm2020/ionic-angular-common.mjs.map +1 -1
  24. package/fesm2020/ionic-angular-standalone.mjs +8 -10
  25. package/fesm2020/ionic-angular-standalone.mjs.map +1 -1
  26. package/fesm2020/ionic-angular.mjs +8 -10
  27. package/fesm2020/ionic-angular.mjs.map +1 -1
  28. package/index.d.ts +1 -1
  29. package/package.json +2 -2
  30. package/providers/modal-controller.d.ts +0 -1
  31. package/providers/popover-controller.d.ts +0 -1
  32. package/standalone/index.d.ts +1 -1
  33. package/standalone/navigation/nav.d.ts +2 -2
  34. package/standalone/providers/modal-controller.d.ts +0 -1
  35. package/standalone/providers/popover-controller.d.ts +0 -1
  36. package/common/directives/navigation/nav-params.d.ts +0 -45
  37. package/esm2020/common/directives/navigation/nav-params.mjs +0 -45
@@ -1,5 +1,5 @@
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';
2
+ import { Injectable, Inject, Optional, InjectionToken, inject, NgZone, ApplicationRef, createComponent, TemplateRef, Directive, ContentChild, EventEmitter, ViewContainerRef, EnvironmentInjector, Attribute, SkipSelf, Input, Output, reflectComponentType, HostListener, ElementRef, ViewChild } from '@angular/core';
3
3
  import * as i3 from '@angular/router';
4
4
  import { NavigationStart, PRIMARY_OUTLET, ChildrenOutletContexts, ActivatedRoute, Router } from '@angular/router';
5
5
  import * as i1 from '@angular/common';
@@ -671,59 +671,14 @@ const getConfig = () => {
671
671
  return null;
672
672
  };
673
673
 
674
- /**
675
- * @description
676
- * NavParams are an object that exists on a page and can contain data for that particular view.
677
- * Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
678
- * option with a simple `get` method.
679
- *
680
- * @usage
681
- * ```ts
682
- * import { NavParams } from '@ionic/angular';
683
- *
684
- * export class MyClass{
685
- *
686
- * constructor(navParams: NavParams){
687
- * // userParams is an object we have in our nav-parameters
688
- * navParams.get('userParams');
689
- * }
690
- *
691
- * }
692
- * ```
693
- */
694
- class NavParams {
695
- constructor(data = {}) {
696
- this.data = data;
697
- }
698
- /**
699
- * Get the value of a nav-parameter for the current view
700
- *
701
- * ```ts
702
- * import { NavParams } from 'ionic-angular';
703
- *
704
- * export class MyClass{
705
- * constructor(public navParams: NavParams){
706
- * // userParams is an object we have in our nav-parameters
707
- * this.navParams.get('userParams');
708
- * }
709
- * }
710
- * ```
711
- *
712
- * @param param Which param you want to look up
713
- */
714
- get(param) {
715
- return this.data[param];
716
- }
717
- }
718
-
719
674
  // TODO(FW-2827): types
720
675
  class AngularDelegate {
721
676
  constructor() {
722
677
  this.zone = inject(NgZone);
723
678
  this.applicationRef = inject(ApplicationRef);
724
679
  }
725
- create(environmentInjector, injector, elementReferenceKey) {
726
- return new AngularFrameworkDelegate(environmentInjector, injector, this.applicationRef, this.zone, elementReferenceKey);
680
+ create(environmentInjector, elementReferenceKey) {
681
+ return new AngularFrameworkDelegate(environmentInjector, this.applicationRef, this.zone, elementReferenceKey);
727
682
  }
728
683
  }
729
684
  /** @nocollapse */ AngularDelegate.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AngularDelegate, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -732,9 +687,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
732
687
  type: Injectable
733
688
  }] });
734
689
  class AngularFrameworkDelegate {
735
- constructor(environmentInjector, injector, applicationRef, zone, elementReferenceKey) {
690
+ constructor(environmentInjector, applicationRef, zone, elementReferenceKey) {
736
691
  this.environmentInjector = environmentInjector;
737
- this.injector = injector;
738
692
  this.applicationRef = applicationRef;
739
693
  this.zone = zone;
740
694
  this.elementReferenceKey = elementReferenceKey;
@@ -758,7 +712,7 @@ class AngularFrameworkDelegate {
758
712
  if (this.elementReferenceKey !== undefined) {
759
713
  componentProps[this.elementReferenceKey] = container;
760
714
  }
761
- const el = attachView(this.zone, this.environmentInjector, this.injector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey);
715
+ const el = attachView(this.zone, this.environmentInjector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey);
762
716
  resolve(el);
763
717
  });
764
718
  });
@@ -781,26 +735,9 @@ class AngularFrameworkDelegate {
781
735
  });
782
736
  }
783
737
  }
784
- const attachView = (zone, environmentInjector, injector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey) => {
785
- /**
786
- * Wraps the injector with a custom injector that
787
- * provides NavParams to the component.
788
- *
789
- * NavParams is a legacy feature from Ionic v3 that allows
790
- * Angular developers to provide data to a component
791
- * and access it by providing NavParams as a dependency
792
- * in the constructor.
793
- *
794
- * The modern approach is to access the data directly
795
- * from the component's class instance.
796
- */
797
- const childInjector = Injector.create({
798
- providers: getProviders(params),
799
- parent: injector,
800
- });
738
+ const attachView = (zone, environmentInjector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey) => {
801
739
  const componentRef = createComponent(component, {
802
740
  environmentInjector,
803
- elementInjector: childInjector,
804
741
  });
805
742
  const instance = componentRef.instance;
806
743
  const hostElement = componentRef.location.nativeElement;
@@ -815,7 +752,27 @@ const attachView = (zone, environmentInjector, injector, applicationRef, elRefMa
815
752
  if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
816
753
  console.error(`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${component.name}.`);
817
754
  }
818
- Object.assign(instance, params);
755
+ const { modal, popover, ...otherParams } = params;
756
+ /**
757
+ * Any key/value pairs set in componentProps
758
+ * must be set as inputs on the component instance.
759
+ */
760
+ for (const key in otherParams) {
761
+ componentRef.setInput(key, otherParams[key]);
762
+ }
763
+ /**
764
+ * Using setInput will cause an error when
765
+ * setting modal/popover on a component that
766
+ * does not define them as an input. For backwards
767
+ * compatibility purposes we fall back to using
768
+ * Object.assign for these properties.
769
+ */
770
+ if (modal !== undefined) {
771
+ Object.assign(instance, { modal });
772
+ }
773
+ if (popover !== undefined) {
774
+ Object.assign(instance, { popover });
775
+ }
819
776
  }
820
777
  if (cssClasses) {
821
778
  for (const cssClass of cssClasses) {
@@ -846,23 +803,6 @@ const bindLifecycleEvents = (zone, instance, element) => {
846
803
  return () => unregisters.forEach((fn) => fn());
847
804
  });
848
805
  };
849
- const NavParamsToken = new InjectionToken('NavParamsToken');
850
- const getProviders = (params) => {
851
- return [
852
- {
853
- provide: NavParamsToken,
854
- useValue: params,
855
- },
856
- {
857
- provide: NavParams,
858
- useFactory: provideNavParamsInjectable,
859
- deps: [NavParamsToken],
860
- },
861
- ];
862
- };
863
- const provideNavParamsInjectable = (params) => {
864
- return new NavParams(params);
865
- };
866
806
 
867
807
  // TODO: Is there a way we can grab this from angular-component-lib instead?
868
808
  const proxyInputs = (Cmp, inputs) => {
@@ -2039,15 +1979,15 @@ const NAV_METHODS = [
2039
1979
  'getPrevious',
2040
1980
  ];
2041
1981
  let IonNav = class IonNav {
2042
- constructor(ref, environmentInjector, injector, angularDelegate, z, c) {
1982
+ constructor(ref, environmentInjector, angularDelegate, z, c) {
2043
1983
  this.z = z;
2044
1984
  c.detach();
2045
1985
  this.el = ref.nativeElement;
2046
- ref.nativeElement.delegate = angularDelegate.create(environmentInjector, injector);
1986
+ ref.nativeElement.delegate = angularDelegate.create(environmentInjector);
2047
1987
  proxyOutputs(this, this.el, ['ionNavDidChange', 'ionNavWillChange']);
2048
1988
  }
2049
1989
  };
2050
- /** @nocollapse */ IonNav.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: IonNav, deps: [{ token: i0.ElementRef }, { token: i0.EnvironmentInjector }, { token: i0.Injector }, { token: AngularDelegate }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
1990
+ /** @nocollapse */ IonNav.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: IonNav, deps: [{ token: i0.ElementRef }, { token: i0.EnvironmentInjector }, { token: AngularDelegate }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
2051
1991
  /** @nocollapse */ IonNav.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: IonNav, inputs: { animated: "animated", animation: "animation", root: "root", rootParams: "rootParams", swipeGesture: "swipeGesture" }, ngImport: i0 });
2052
1992
  IonNav = __decorate([
2053
1993
  ProxyCmp({
@@ -2061,7 +2001,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
2061
2001
  // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
2062
2002
  inputs: NAV_INPUTS,
2063
2003
  }]
2064
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.EnvironmentInjector }, { type: i0.Injector }, { type: AngularDelegate }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; } });
2004
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.EnvironmentInjector }, { type: AngularDelegate }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; } });
2065
2005
 
2066
2006
  // eslint-disable-next-line @angular-eslint/directive-class-suffix
2067
2007
  class IonTabs {
@@ -2463,5 +2403,5 @@ class OverlayBaseController {
2463
2403
  * Generated bundle index. Do not edit.
2464
2404
  */
2465
2405
 
2466
- export { AngularDelegate, Config, ConfigToken, DomController, IonBackButton, IonModal, IonNav, IonPopover, IonRouterOutlet, IonTabs, IonicRouteStrategy, MenuController, NavController, NavParams, OverlayBaseController, Platform, ProxyCmp, RouterLinkDelegateDirective, RouterLinkWithHrefDelegateDirective, ValueAccessor, bindLifecycleEvents, provideComponentInputBinding, raf, setIonicClasses };
2406
+ export { AngularDelegate, Config, ConfigToken, DomController, IonBackButton, IonModal, IonNav, IonPopover, IonRouterOutlet, IonTabs, IonicRouteStrategy, MenuController, NavController, OverlayBaseController, Platform, ProxyCmp, RouterLinkDelegateDirective, RouterLinkWithHrefDelegateDirective, ValueAccessor, bindLifecycleEvents, provideComponentInputBinding, raf, setIonicClasses };
2467
2407
  //# sourceMappingURL=ionic-angular-common.mjs.map