@ionic/angular 8.8.19 → 8.8.20-dev.11787158518.168a2fea

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 (600) hide show
  1. package/README.md +9 -7
  2. package/dist/common/directives/control-value-accessors/index.js +2 -0
  3. package/dist/common/directives/control-value-accessors/index.js.map +1 -0
  4. package/{common → dist/common}/directives/control-value-accessors/value-accessor.d.ts +1 -1
  5. package/dist/common/directives/control-value-accessors/value-accessor.js +152 -0
  6. package/dist/common/directives/control-value-accessors/value-accessor.js.map +1 -0
  7. package/{common → dist/common}/directives/navigation/back-button.d.ts +1 -1
  8. package/dist/common/directives/navigation/back-button.js +61 -0
  9. package/dist/common/directives/navigation/back-button.js.map +1 -0
  10. package/dist/common/directives/navigation/nav-params.js +47 -0
  11. package/dist/common/directives/navigation/nav-params.js.map +1 -0
  12. package/{common → dist/common}/directives/navigation/nav.d.ts +1 -1
  13. package/dist/common/directives/navigation/nav.js +49 -0
  14. package/dist/common/directives/navigation/nav.js.map +1 -0
  15. package/{common → dist/common}/directives/navigation/router-link-delegate.d.ts +2 -2
  16. package/dist/common/directives/navigation/router-link-delegate.js +188 -0
  17. package/dist/common/directives/navigation/router-link-delegate.js.map +1 -0
  18. package/{common → dist/common}/directives/navigation/router-outlet.d.ts +1 -1
  19. package/dist/common/directives/navigation/router-outlet.js +476 -0
  20. package/dist/common/directives/navigation/router-outlet.js.map +1 -0
  21. package/dist/common/directives/navigation/stack-controller.js +282 -0
  22. package/dist/common/directives/navigation/stack-controller.js.map +1 -0
  23. package/dist/common/directives/navigation/stack-utils.js +73 -0
  24. package/dist/common/directives/navigation/stack-utils.js.map +1 -0
  25. package/{common → dist/common}/directives/navigation/tabs.d.ts +9 -1
  26. package/dist/common/directives/navigation/tabs.js +290 -0
  27. package/dist/common/directives/navigation/tabs.js.map +1 -0
  28. package/{common → dist/common}/index.d.ts +1 -1
  29. package/dist/common/index.js +20 -0
  30. package/dist/common/index.js.map +1 -0
  31. package/{common → dist/common}/overlays/modal.d.ts +1 -1
  32. package/dist/common/overlays/modal.js +96 -0
  33. package/dist/common/overlays/modal.js.map +1 -0
  34. package/{common → dist/common}/overlays/popover.d.ts +1 -1
  35. package/dist/common/overlays/popover.js +84 -0
  36. package/dist/common/overlays/popover.js.map +1 -0
  37. package/{common → dist/common}/providers/angular-delegate.d.ts +2 -2
  38. package/dist/common/providers/angular-delegate.js +229 -0
  39. package/dist/common/providers/angular-delegate.js.map +1 -0
  40. package/dist/common/providers/config.js +44 -0
  41. package/dist/common/providers/config.js.map +1 -0
  42. package/dist/common/providers/dom-controller.js +44 -0
  43. package/dist/common/providers/dom-controller.js.map +1 -0
  44. package/dist/common/providers/menu-controller.js +114 -0
  45. package/dist/common/providers/menu-controller.js.map +1 -0
  46. package/dist/common/providers/nav-controller.js +232 -0
  47. package/dist/common/providers/nav-controller.js.map +1 -0
  48. package/dist/common/providers/platform.js +256 -0
  49. package/dist/common/providers/platform.js.map +1 -0
  50. package/dist/common/types/interfaces.js +2 -0
  51. package/dist/common/types/interfaces.js.map +1 -0
  52. package/dist/common/types/ionic-lifecycle-hooks.js +5 -0
  53. package/dist/common/types/ionic-lifecycle-hooks.js.map +1 -0
  54. package/dist/common/types/overlay-options.js +2 -0
  55. package/dist/common/types/overlay-options.js.map +1 -0
  56. package/dist/common/utils/overlay.js +26 -0
  57. package/dist/common/utils/overlay.js.map +1 -0
  58. package/dist/common/utils/proxy.js +47 -0
  59. package/dist/common/utils/proxy.js.map +1 -0
  60. package/dist/common/utils/routing.js +55 -0
  61. package/dist/common/utils/routing.js.map +1 -0
  62. package/dist/common/utils/util.js +10 -0
  63. package/dist/common/utils/util.js.map +1 -0
  64. package/dist/lazy/app-initialize.js +29 -0
  65. package/dist/lazy/app-initialize.js.map +1 -0
  66. package/dist/lazy/directives/angular-component-lib/utils.js +59 -0
  67. package/dist/lazy/directives/angular-component-lib/utils.js.map +1 -0
  68. package/{directives → dist/lazy/directives}/control-value-accessors/boolean-value-accessor.d.ts +1 -1
  69. package/dist/lazy/directives/control-value-accessors/boolean-value-accessor.js +47 -0
  70. package/dist/lazy/directives/control-value-accessors/boolean-value-accessor.js.map +1 -0
  71. package/dist/lazy/directives/control-value-accessors/index.js +5 -0
  72. package/dist/lazy/directives/control-value-accessors/index.js.map +1 -0
  73. package/{directives → dist/lazy/directives}/control-value-accessors/numeric-value-accessor.d.ts +1 -1
  74. package/dist/lazy/directives/control-value-accessors/numeric-value-accessor.js +55 -0
  75. package/dist/lazy/directives/control-value-accessors/numeric-value-accessor.js.map +1 -0
  76. package/{directives → dist/lazy/directives}/control-value-accessors/select-value-accessor.d.ts +1 -1
  77. package/dist/lazy/directives/control-value-accessors/select-value-accessor.js +44 -0
  78. package/dist/lazy/directives/control-value-accessors/select-value-accessor.js.map +1 -0
  79. package/{directives → dist/lazy/directives}/control-value-accessors/text-value-accessor.d.ts +1 -1
  80. package/dist/lazy/directives/control-value-accessors/text-value-accessor.js +43 -0
  81. package/dist/lazy/directives/control-value-accessors/text-value-accessor.js.map +1 -0
  82. package/dist/lazy/directives/navigation/ion-back-button.js +24 -0
  83. package/dist/lazy/directives/navigation/ion-back-button.js.map +1 -0
  84. package/dist/lazy/directives/navigation/ion-nav.js +21 -0
  85. package/dist/lazy/directives/navigation/ion-nav.js.map +1 -0
  86. package/dist/lazy/directives/navigation/ion-router-outlet.js +52 -0
  87. package/dist/lazy/directives/navigation/ion-router-outlet.js.map +1 -0
  88. package/dist/lazy/directives/navigation/ion-tabs.js +58 -0
  89. package/dist/lazy/directives/navigation/ion-tabs.js.map +1 -0
  90. package/dist/lazy/directives/navigation/router-link-delegate.js +32 -0
  91. package/dist/lazy/directives/navigation/router-link-delegate.js.map +1 -0
  92. package/dist/lazy/directives/overlays/modal.js +22 -0
  93. package/dist/lazy/directives/overlays/modal.js.map +1 -0
  94. package/dist/lazy/directives/overlays/popover.js +18 -0
  95. package/dist/lazy/directives/overlays/popover.js.map +1 -0
  96. package/{directives → dist/lazy/directives}/proxies-list.d.ts +1 -1
  97. package/dist/lazy/directives/proxies-list.js +89 -0
  98. package/dist/lazy/directives/proxies-list.js.map +1 -0
  99. package/{directives → dist/lazy/directives}/proxies.d.ts +290 -191
  100. package/dist/lazy/directives/proxies.js +2759 -0
  101. package/dist/lazy/directives/proxies.js.map +1 -0
  102. package/dist/lazy/directives/validators/index.js +3 -0
  103. package/dist/lazy/directives/validators/index.js.map +1 -0
  104. package/dist/lazy/directives/validators/max-validator.js +26 -0
  105. package/dist/lazy/directives/validators/max-validator.js.map +1 -0
  106. package/dist/lazy/directives/validators/min-validator.js +26 -0
  107. package/dist/lazy/directives/validators/min-validator.js.map +1 -0
  108. package/{index.d.ts → dist/lazy/index.d.ts} +1 -2
  109. package/dist/lazy/index.js +34 -0
  110. package/dist/lazy/index.js.map +1 -0
  111. package/dist/lazy/ionic-module.d.ts +38 -0
  112. package/dist/lazy/ionic-module.js +121 -0
  113. package/dist/lazy/ionic-module.js.map +1 -0
  114. package/dist/lazy/providers/action-sheet-controller.js +18 -0
  115. package/dist/lazy/providers/action-sheet-controller.js.map +1 -0
  116. package/dist/lazy/providers/alert-controller.js +18 -0
  117. package/dist/lazy/providers/alert-controller.js.map +1 -0
  118. package/dist/lazy/providers/animation-controller.js +37 -0
  119. package/dist/lazy/providers/animation-controller.js.map +1 -0
  120. package/dist/lazy/providers/gesture-controller.js +32 -0
  121. package/dist/lazy/providers/gesture-controller.js.map +1 -0
  122. package/dist/lazy/providers/loading-controller.js +18 -0
  123. package/dist/lazy/providers/loading-controller.js.map +1 -0
  124. package/dist/lazy/providers/menu-controller.js +18 -0
  125. package/dist/lazy/providers/menu-controller.js.map +1 -0
  126. package/dist/lazy/providers/modal-controller.js +25 -0
  127. package/dist/lazy/providers/modal-controller.js.map +1 -0
  128. package/dist/lazy/providers/popover-controller.js +19 -0
  129. package/dist/lazy/providers/popover-controller.js.map +1 -0
  130. package/dist/lazy/providers/toast-controller.js +18 -0
  131. package/dist/lazy/providers/toast-controller.js.map +1 -0
  132. package/{schematics → dist/schematics}/add/index.js +6 -6
  133. package/dist/schematics/utils/ast.js +64 -0
  134. package/{schematics → dist/schematics}/utils/config.js +10 -11
  135. package/{schematics → dist/schematics}/utils/package.js +6 -4
  136. package/dist/standalone/directives/angular-component-lib/utils.js +59 -0
  137. package/dist/standalone/directives/angular-component-lib/utils.js.map +1 -0
  138. package/dist/standalone/directives/checkbox.js +75 -0
  139. package/dist/standalone/directives/checkbox.js.map +1 -0
  140. package/dist/standalone/directives/datetime.js +93 -0
  141. package/dist/standalone/directives/datetime.js.map +1 -0
  142. package/dist/standalone/directives/icon.js +35 -0
  143. package/dist/standalone/directives/icon.js.map +1 -0
  144. package/dist/standalone/directives/index.js +13 -0
  145. package/dist/standalone/directives/index.js.map +1 -0
  146. package/dist/standalone/directives/input-otp.js +89 -0
  147. package/dist/standalone/directives/input-otp.js.map +1 -0
  148. package/dist/standalone/directives/input.js +112 -0
  149. package/dist/standalone/directives/input.js.map +1 -0
  150. package/dist/standalone/directives/ion-accordion-group.d.ts +21 -0
  151. package/dist/standalone/directives/ion-accordion-group.js +40 -0
  152. package/dist/standalone/directives/ion-accordion-group.js.map +1 -0
  153. package/dist/standalone/directives/ion-accordion.d.ts +12 -0
  154. package/dist/standalone/directives/ion-accordion.js +36 -0
  155. package/dist/standalone/directives/ion-accordion.js.map +1 -0
  156. package/dist/standalone/directives/ion-action-sheet.d.ts +58 -0
  157. package/dist/standalone/directives/ion-action-sheet.js +62 -0
  158. package/dist/standalone/directives/ion-action-sheet.js.map +1 -0
  159. package/dist/standalone/directives/ion-alert.d.ts +58 -0
  160. package/dist/standalone/directives/ion-alert.js +62 -0
  161. package/dist/standalone/directives/ion-alert.js.map +1 -0
  162. package/dist/standalone/directives/ion-app.d.ts +12 -0
  163. package/dist/standalone/directives/ion-app.js +36 -0
  164. package/dist/standalone/directives/ion-app.js.map +1 -0
  165. package/dist/standalone/directives/ion-avatar.d.ts +12 -0
  166. package/dist/standalone/directives/ion-avatar.js +35 -0
  167. package/dist/standalone/directives/ion-avatar.js.map +1 -0
  168. package/dist/standalone/directives/ion-backdrop.d.ts +18 -0
  169. package/dist/standalone/directives/ion-backdrop.js +40 -0
  170. package/dist/standalone/directives/ion-backdrop.js.map +1 -0
  171. package/dist/standalone/directives/ion-badge.d.ts +12 -0
  172. package/dist/standalone/directives/ion-badge.js +36 -0
  173. package/dist/standalone/directives/ion-badge.js.map +1 -0
  174. package/dist/standalone/directives/ion-breadcrumb.d.ts +23 -0
  175. package/dist/standalone/directives/ion-breadcrumb.js +43 -0
  176. package/dist/standalone/directives/ion-breadcrumb.js.map +1 -0
  177. package/dist/standalone/directives/ion-breadcrumbs.d.ts +19 -0
  178. package/dist/standalone/directives/ion-breadcrumbs.js +40 -0
  179. package/dist/standalone/directives/ion-breadcrumbs.js.map +1 -0
  180. package/dist/standalone/directives/ion-button.d.ts +23 -0
  181. package/dist/standalone/directives/ion-button.js +43 -0
  182. package/dist/standalone/directives/ion-button.js.map +1 -0
  183. package/dist/standalone/directives/ion-buttons.d.ts +12 -0
  184. package/dist/standalone/directives/ion-buttons.js +36 -0
  185. package/dist/standalone/directives/ion-buttons.js.map +1 -0
  186. package/dist/standalone/directives/ion-card-content.d.ts +12 -0
  187. package/dist/standalone/directives/ion-card-content.js +36 -0
  188. package/dist/standalone/directives/ion-card-content.js.map +1 -0
  189. package/dist/standalone/directives/ion-card-header.d.ts +12 -0
  190. package/dist/standalone/directives/ion-card-header.js +36 -0
  191. package/dist/standalone/directives/ion-card-header.js.map +1 -0
  192. package/dist/standalone/directives/ion-card-subtitle.d.ts +12 -0
  193. package/dist/standalone/directives/ion-card-subtitle.js +36 -0
  194. package/dist/standalone/directives/ion-card-subtitle.js.map +1 -0
  195. package/dist/standalone/directives/ion-card-title.d.ts +12 -0
  196. package/dist/standalone/directives/ion-card-title.js +36 -0
  197. package/dist/standalone/directives/ion-card-title.js.map +1 -0
  198. package/dist/standalone/directives/ion-card.d.ts +12 -0
  199. package/dist/standalone/directives/ion-card.js +36 -0
  200. package/dist/standalone/directives/ion-card.js.map +1 -0
  201. package/dist/standalone/directives/ion-chip.d.ts +12 -0
  202. package/dist/standalone/directives/ion-chip.js +36 -0
  203. package/dist/standalone/directives/ion-chip.js.map +1 -0
  204. package/dist/standalone/directives/ion-col.d.ts +12 -0
  205. package/dist/standalone/directives/ion-col.js +36 -0
  206. package/dist/standalone/directives/ion-col.js.map +1 -0
  207. package/dist/standalone/directives/ion-content.d.ts +33 -0
  208. package/dist/standalone/directives/ion-content.js +47 -0
  209. package/dist/standalone/directives/ion-content.js.map +1 -0
  210. package/dist/standalone/directives/ion-datetime-button.d.ts +12 -0
  211. package/dist/standalone/directives/ion-datetime-button.js +36 -0
  212. package/dist/standalone/directives/ion-datetime-button.js.map +1 -0
  213. package/dist/standalone/directives/ion-fab-button.d.ts +23 -0
  214. package/dist/standalone/directives/ion-fab-button.js +43 -0
  215. package/dist/standalone/directives/ion-fab-button.js.map +1 -0
  216. package/dist/standalone/directives/ion-fab-list.d.ts +12 -0
  217. package/dist/standalone/directives/ion-fab-list.js +36 -0
  218. package/dist/standalone/directives/ion-fab-list.js.map +1 -0
  219. package/dist/standalone/directives/ion-fab.d.ts +12 -0
  220. package/dist/standalone/directives/ion-fab.js +37 -0
  221. package/dist/standalone/directives/ion-fab.js.map +1 -0
  222. package/dist/standalone/directives/ion-footer.d.ts +12 -0
  223. package/dist/standalone/directives/ion-footer.js +36 -0
  224. package/dist/standalone/directives/ion-footer.js.map +1 -0
  225. package/dist/standalone/directives/ion-grid.d.ts +12 -0
  226. package/dist/standalone/directives/ion-grid.js +36 -0
  227. package/dist/standalone/directives/ion-grid.js.map +1 -0
  228. package/dist/standalone/directives/ion-header.d.ts +12 -0
  229. package/dist/standalone/directives/ion-header.js +36 -0
  230. package/dist/standalone/directives/ion-header.js.map +1 -0
  231. package/dist/standalone/directives/ion-img.d.ts +28 -0
  232. package/dist/standalone/directives/ion-img.js +46 -0
  233. package/dist/standalone/directives/ion-img.js.map +1 -0
  234. package/dist/standalone/directives/ion-infinite-scroll-content.d.ts +12 -0
  235. package/dist/standalone/directives/ion-infinite-scroll-content.js +36 -0
  236. package/dist/standalone/directives/ion-infinite-scroll-content.js.map +1 -0
  237. package/dist/standalone/directives/ion-infinite-scroll.d.ts +21 -0
  238. package/dist/standalone/directives/ion-infinite-scroll.js +41 -0
  239. package/dist/standalone/directives/ion-infinite-scroll.js.map +1 -0
  240. package/dist/standalone/directives/ion-input-password-toggle.d.ts +12 -0
  241. package/dist/standalone/directives/ion-input-password-toggle.js +36 -0
  242. package/dist/standalone/directives/ion-input-password-toggle.js.map +1 -0
  243. package/dist/standalone/directives/ion-item-divider.d.ts +12 -0
  244. package/dist/standalone/directives/ion-item-divider.js +36 -0
  245. package/dist/standalone/directives/ion-item-divider.js.map +1 -0
  246. package/dist/standalone/directives/ion-item-group.d.ts +12 -0
  247. package/dist/standalone/directives/ion-item-group.js +35 -0
  248. package/dist/standalone/directives/ion-item-group.js.map +1 -0
  249. package/dist/standalone/directives/ion-item-option.d.ts +12 -0
  250. package/dist/standalone/directives/ion-item-option.js +36 -0
  251. package/dist/standalone/directives/ion-item-option.js.map +1 -0
  252. package/dist/standalone/directives/ion-item-options.d.ts +18 -0
  253. package/dist/standalone/directives/ion-item-options.js +40 -0
  254. package/dist/standalone/directives/ion-item-options.js.map +1 -0
  255. package/dist/standalone/directives/ion-item-sliding.d.ts +18 -0
  256. package/dist/standalone/directives/ion-item-sliding.js +41 -0
  257. package/dist/standalone/directives/ion-item-sliding.js.map +1 -0
  258. package/dist/standalone/directives/ion-item.d.ts +12 -0
  259. package/dist/standalone/directives/ion-item.js +36 -0
  260. package/dist/standalone/directives/ion-item.js.map +1 -0
  261. package/dist/standalone/directives/ion-label.d.ts +12 -0
  262. package/dist/standalone/directives/ion-label.js +36 -0
  263. package/dist/standalone/directives/ion-label.js.map +1 -0
  264. package/dist/standalone/directives/ion-list-header.d.ts +12 -0
  265. package/dist/standalone/directives/ion-list-header.js +36 -0
  266. package/dist/standalone/directives/ion-list-header.js.map +1 -0
  267. package/dist/standalone/directives/ion-list.d.ts +12 -0
  268. package/dist/standalone/directives/ion-list.js +37 -0
  269. package/dist/standalone/directives/ion-list.js.map +1 -0
  270. package/dist/standalone/directives/ion-loading.d.ts +58 -0
  271. package/dist/standalone/directives/ion-loading.js +62 -0
  272. package/dist/standalone/directives/ion-loading.js.map +1 -0
  273. package/dist/standalone/directives/ion-menu-button.d.ts +12 -0
  274. package/dist/standalone/directives/ion-menu-button.js +36 -0
  275. package/dist/standalone/directives/ion-menu-button.js.map +1 -0
  276. package/dist/standalone/directives/ion-menu-toggle.d.ts +12 -0
  277. package/dist/standalone/directives/ion-menu-toggle.js +36 -0
  278. package/dist/standalone/directives/ion-menu-toggle.js.map +1 -0
  279. package/dist/standalone/directives/ion-menu.d.ts +34 -0
  280. package/dist/standalone/directives/ion-menu.js +50 -0
  281. package/dist/standalone/directives/ion-menu.js.map +1 -0
  282. package/dist/standalone/directives/ion-nav-link.d.ts +12 -0
  283. package/dist/standalone/directives/ion-nav-link.js +36 -0
  284. package/dist/standalone/directives/ion-nav-link.js.map +1 -0
  285. package/dist/standalone/directives/ion-note.d.ts +12 -0
  286. package/dist/standalone/directives/ion-note.js +36 -0
  287. package/dist/standalone/directives/ion-note.js.map +1 -0
  288. package/dist/standalone/directives/ion-picker-column-option.d.ts +12 -0
  289. package/dist/standalone/directives/ion-picker-column-option.js +36 -0
  290. package/dist/standalone/directives/ion-picker-column-option.js.map +1 -0
  291. package/dist/standalone/directives/ion-picker-column.d.ts +21 -0
  292. package/dist/standalone/directives/ion-picker-column.js +41 -0
  293. package/dist/standalone/directives/ion-picker-column.js.map +1 -0
  294. package/dist/standalone/directives/ion-picker.d.ts +12 -0
  295. package/dist/standalone/directives/ion-picker.js +36 -0
  296. package/dist/standalone/directives/ion-picker.js.map +1 -0
  297. package/dist/standalone/directives/ion-progress-bar.d.ts +12 -0
  298. package/dist/standalone/directives/ion-progress-bar.js +36 -0
  299. package/dist/standalone/directives/ion-progress-bar.js.map +1 -0
  300. package/dist/standalone/directives/ion-radio.d.ts +23 -0
  301. package/dist/standalone/directives/ion-radio.js +43 -0
  302. package/dist/standalone/directives/ion-radio.js.map +1 -0
  303. package/dist/standalone/directives/ion-refresher-content.d.ts +12 -0
  304. package/dist/standalone/directives/ion-refresher-content.js +36 -0
  305. package/dist/standalone/directives/ion-refresher-content.js.map +1 -0
  306. package/dist/standalone/directives/ion-refresher.d.ts +45 -0
  307. package/dist/standalone/directives/ion-refresher.js +53 -0
  308. package/dist/standalone/directives/ion-refresher.js.map +1 -0
  309. package/dist/standalone/directives/ion-reorder-group.d.ts +44 -0
  310. package/dist/standalone/directives/ion-reorder-group.js +50 -0
  311. package/dist/standalone/directives/ion-reorder-group.js.map +1 -0
  312. package/dist/standalone/directives/ion-reorder.d.ts +12 -0
  313. package/dist/standalone/directives/ion-reorder.js +35 -0
  314. package/dist/standalone/directives/ion-reorder.js.map +1 -0
  315. package/dist/standalone/directives/ion-ripple-effect.d.ts +12 -0
  316. package/dist/standalone/directives/ion-ripple-effect.js +37 -0
  317. package/dist/standalone/directives/ion-ripple-effect.js.map +1 -0
  318. package/dist/standalone/directives/ion-row.d.ts +12 -0
  319. package/dist/standalone/directives/ion-row.js +35 -0
  320. package/dist/standalone/directives/ion-row.js.map +1 -0
  321. package/dist/standalone/directives/ion-segment-button.d.ts +12 -0
  322. package/dist/standalone/directives/ion-segment-button.js +36 -0
  323. package/dist/standalone/directives/ion-segment-button.js.map +1 -0
  324. package/dist/standalone/directives/ion-segment-content.d.ts +12 -0
  325. package/dist/standalone/directives/ion-segment-content.js +35 -0
  326. package/dist/standalone/directives/ion-segment-content.js.map +1 -0
  327. package/dist/standalone/directives/ion-segment-view.d.ts +19 -0
  328. package/dist/standalone/directives/ion-segment-view.js +40 -0
  329. package/dist/standalone/directives/ion-segment-view.js.map +1 -0
  330. package/dist/standalone/directives/ion-select-modal.d.ts +12 -0
  331. package/dist/standalone/directives/ion-select-modal.js +36 -0
  332. package/dist/standalone/directives/ion-select-modal.js.map +1 -0
  333. package/dist/standalone/directives/ion-select-option.d.ts +12 -0
  334. package/dist/standalone/directives/ion-select-option.js +36 -0
  335. package/dist/standalone/directives/ion-select-option.js.map +1 -0
  336. package/dist/standalone/directives/ion-skeleton-text.d.ts +12 -0
  337. package/dist/standalone/directives/ion-skeleton-text.js +36 -0
  338. package/dist/standalone/directives/ion-skeleton-text.js.map +1 -0
  339. package/dist/standalone/directives/ion-spinner.d.ts +12 -0
  340. package/dist/standalone/directives/ion-spinner.js +36 -0
  341. package/dist/standalone/directives/ion-spinner.js.map +1 -0
  342. package/dist/standalone/directives/ion-split-pane.d.ts +22 -0
  343. package/dist/standalone/directives/ion-split-pane.js +40 -0
  344. package/dist/standalone/directives/ion-split-pane.js.map +1 -0
  345. package/dist/standalone/directives/ion-tab-bar.d.ts +12 -0
  346. package/dist/standalone/directives/ion-tab-bar.js +36 -0
  347. package/dist/standalone/directives/ion-tab-bar.js.map +1 -0
  348. package/dist/standalone/directives/ion-tab-button.d.ts +12 -0
  349. package/dist/standalone/directives/ion-tab-button.js +36 -0
  350. package/dist/standalone/directives/ion-tab-button.js.map +1 -0
  351. package/dist/standalone/directives/ion-tab.d.ts +12 -0
  352. package/dist/standalone/directives/ion-tab.js +37 -0
  353. package/dist/standalone/directives/ion-tab.js.map +1 -0
  354. package/dist/standalone/directives/ion-text.d.ts +12 -0
  355. package/dist/standalone/directives/ion-text.js +36 -0
  356. package/dist/standalone/directives/ion-text.js.map +1 -0
  357. package/dist/standalone/directives/ion-thumbnail.d.ts +12 -0
  358. package/dist/standalone/directives/ion-thumbnail.js +35 -0
  359. package/dist/standalone/directives/ion-thumbnail.js.map +1 -0
  360. package/dist/standalone/directives/ion-title.d.ts +12 -0
  361. package/dist/standalone/directives/ion-title.js +36 -0
  362. package/dist/standalone/directives/ion-title.js.map +1 -0
  363. package/dist/standalone/directives/ion-toast.d.ts +58 -0
  364. package/dist/standalone/directives/ion-toast.js +62 -0
  365. package/dist/standalone/directives/ion-toast.js.map +1 -0
  366. package/dist/standalone/directives/ion-toolbar.d.ts +12 -0
  367. package/dist/standalone/directives/ion-toolbar.js +36 -0
  368. package/dist/standalone/directives/ion-toolbar.js.map +1 -0
  369. package/dist/standalone/directives/proxies.d.ts +77 -0
  370. package/dist/standalone/directives/proxies.js +79 -0
  371. package/dist/standalone/directives/proxies.js.map +1 -0
  372. package/dist/standalone/directives/radio-group.js +59 -0
  373. package/dist/standalone/directives/radio-group.js.map +1 -0
  374. package/dist/standalone/directives/range.js +77 -0
  375. package/dist/standalone/directives/range.js.map +1 -0
  376. package/dist/standalone/directives/searchbar.js +81 -0
  377. package/dist/standalone/directives/searchbar.js.map +1 -0
  378. package/dist/standalone/directives/segment.js +59 -0
  379. package/dist/standalone/directives/segment.js.map +1 -0
  380. package/dist/standalone/directives/select.js +83 -0
  381. package/dist/standalone/directives/select.js.map +1 -0
  382. package/dist/standalone/directives/textarea.js +90 -0
  383. package/dist/standalone/directives/textarea.js.map +1 -0
  384. package/dist/standalone/directives/toggle.js +75 -0
  385. package/dist/standalone/directives/toggle.js.map +1 -0
  386. package/{standalone → dist/standalone}/index.d.ts +1 -2
  387. package/dist/standalone/index.js +24 -0
  388. package/dist/standalone/index.js.map +1 -0
  389. package/dist/standalone/navigation/back-button.js +32 -0
  390. package/dist/standalone/navigation/back-button.js.map +1 -0
  391. package/dist/standalone/navigation/nav.js +28 -0
  392. package/dist/standalone/navigation/nav.js.map +1 -0
  393. package/dist/standalone/navigation/router-link-delegate.js +26 -0
  394. package/dist/standalone/navigation/router-link-delegate.js.map +1 -0
  395. package/dist/standalone/navigation/router-outlet.js +60 -0
  396. package/dist/standalone/navigation/router-outlet.js.map +1 -0
  397. package/dist/standalone/navigation/tabs.js +57 -0
  398. package/dist/standalone/navigation/tabs.js.map +1 -0
  399. package/dist/standalone/overlays/modal.js +32 -0
  400. package/dist/standalone/overlays/modal.js.map +1 -0
  401. package/dist/standalone/overlays/popover.js +28 -0
  402. package/dist/standalone/overlays/popover.js.map +1 -0
  403. package/dist/standalone/providers/action-sheet-controller.js +20 -0
  404. package/dist/standalone/providers/action-sheet-controller.js.map +1 -0
  405. package/dist/standalone/providers/alert-controller.js +20 -0
  406. package/dist/standalone/providers/alert-controller.js.map +1 -0
  407. package/dist/standalone/providers/animation-controller.js +37 -0
  408. package/dist/standalone/providers/animation-controller.js.map +1 -0
  409. package/dist/standalone/providers/gesture-controller.js +32 -0
  410. package/dist/standalone/providers/gesture-controller.js.map +1 -0
  411. package/dist/standalone/providers/ionic-angular.js +38 -0
  412. package/dist/standalone/providers/ionic-angular.js.map +1 -0
  413. package/dist/standalone/providers/loading-controller.js +20 -0
  414. package/dist/standalone/providers/loading-controller.js.map +1 -0
  415. package/dist/standalone/providers/menu-controller.js +18 -0
  416. package/dist/standalone/providers/menu-controller.js.map +1 -0
  417. package/dist/standalone/providers/modal-controller.js +27 -0
  418. package/dist/standalone/providers/modal-controller.js.map +1 -0
  419. package/dist/standalone/providers/popover-controller.js +21 -0
  420. package/dist/standalone/providers/popover-controller.js.map +1 -0
  421. package/dist/standalone/providers/toast-controller.js +20 -0
  422. package/dist/standalone/providers/toast-controller.js.map +1 -0
  423. package/package.json +172 -30
  424. package/esm2022/app-initialize.mjs +0 -29
  425. package/esm2022/common/directives/control-value-accessors/index.mjs +0 -2
  426. package/esm2022/common/directives/control-value-accessors/value-accessor.mjs +0 -153
  427. package/esm2022/common/directives/navigation/back-button.mjs +0 -61
  428. package/esm2022/common/directives/navigation/nav-params.mjs +0 -47
  429. package/esm2022/common/directives/navigation/nav.mjs +0 -49
  430. package/esm2022/common/directives/navigation/router-link-delegate.mjs +0 -190
  431. package/esm2022/common/directives/navigation/router-outlet.mjs +0 -480
  432. package/esm2022/common/directives/navigation/stack-controller.mjs +0 -283
  433. package/esm2022/common/directives/navigation/stack-utils.mjs +0 -73
  434. package/esm2022/common/directives/navigation/tabs.mjs +0 -279
  435. package/esm2022/common/index.mjs +0 -20
  436. package/esm2022/common/ionic-angular-common.mjs +0 -5
  437. package/esm2022/common/overlays/modal.mjs +0 -103
  438. package/esm2022/common/overlays/popover.mjs +0 -91
  439. package/esm2022/common/providers/angular-delegate.mjs +0 -210
  440. package/esm2022/common/providers/config.mjs +0 -45
  441. package/esm2022/common/providers/dom-controller.mjs +0 -45
  442. package/esm2022/common/providers/menu-controller.mjs +0 -114
  443. package/esm2022/common/providers/nav-controller.mjs +0 -235
  444. package/esm2022/common/providers/platform.mjs +0 -258
  445. package/esm2022/common/types/interfaces.mjs +0 -2
  446. package/esm2022/common/types/ionic-lifecycle-hooks.mjs +0 -5
  447. package/esm2022/common/types/overlay-options.mjs +0 -2
  448. package/esm2022/common/utils/overlay.mjs +0 -26
  449. package/esm2022/common/utils/proxy.mjs +0 -47
  450. package/esm2022/common/utils/routing.mjs +0 -55
  451. package/esm2022/common/utils/util.mjs +0 -10
  452. package/esm2022/directives/angular-component-lib/utils.mjs +0 -59
  453. package/esm2022/directives/control-value-accessors/boolean-value-accessor.mjs +0 -42
  454. package/esm2022/directives/control-value-accessors/index.mjs +0 -5
  455. package/esm2022/directives/control-value-accessors/numeric-value-accessor.mjs +0 -50
  456. package/esm2022/directives/control-value-accessors/select-value-accessor.mjs +0 -39
  457. package/esm2022/directives/control-value-accessors/text-value-accessor.mjs +0 -38
  458. package/esm2022/directives/navigation/ion-back-button.mjs +0 -24
  459. package/esm2022/directives/navigation/ion-nav.mjs +0 -21
  460. package/esm2022/directives/navigation/ion-router-outlet.mjs +0 -52
  461. package/esm2022/directives/navigation/ion-tabs.mjs +0 -59
  462. package/esm2022/directives/navigation/router-link-delegate.mjs +0 -32
  463. package/esm2022/directives/overlays/modal.mjs +0 -22
  464. package/esm2022/directives/overlays/popover.mjs +0 -18
  465. package/esm2022/directives/proxies-list.mjs +0 -90
  466. package/esm2022/directives/proxies.mjs +0 -2373
  467. package/esm2022/directives/validators/index.mjs +0 -3
  468. package/esm2022/directives/validators/max-validator.mjs +0 -27
  469. package/esm2022/directives/validators/min-validator.mjs +0 -27
  470. package/esm2022/index.mjs +0 -32
  471. package/esm2022/ionic-angular.mjs +0 -5
  472. package/esm2022/ionic-module.mjs +0 -111
  473. package/esm2022/providers/action-sheet-controller.mjs +0 -19
  474. package/esm2022/providers/alert-controller.mjs +0 -19
  475. package/esm2022/providers/animation-controller.mjs +0 -38
  476. package/esm2022/providers/gesture-controller.mjs +0 -33
  477. package/esm2022/providers/loading-controller.mjs +0 -19
  478. package/esm2022/providers/menu-controller.mjs +0 -19
  479. package/esm2022/providers/modal-controller.mjs +0 -26
  480. package/esm2022/providers/picker-controller.mjs +0 -22
  481. package/esm2022/providers/popover-controller.mjs +0 -19
  482. package/esm2022/providers/toast-controller.mjs +0 -19
  483. package/esm2022/standalone/directives/angular-component-lib/utils.mjs +0 -59
  484. package/esm2022/standalone/directives/checkbox.mjs +0 -76
  485. package/esm2022/standalone/directives/datetime.mjs +0 -95
  486. package/esm2022/standalone/directives/icon.mjs +0 -35
  487. package/esm2022/standalone/directives/index.mjs +0 -13
  488. package/esm2022/standalone/directives/input-otp.mjs +0 -90
  489. package/esm2022/standalone/directives/input.mjs +0 -113
  490. package/esm2022/standalone/directives/proxies.mjs +0 -2260
  491. package/esm2022/standalone/directives/radio-group.mjs +0 -60
  492. package/esm2022/standalone/directives/range.mjs +0 -78
  493. package/esm2022/standalone/directives/searchbar.mjs +0 -82
  494. package/esm2022/standalone/directives/segment.mjs +0 -60
  495. package/esm2022/standalone/directives/select.mjs +0 -84
  496. package/esm2022/standalone/directives/textarea.mjs +0 -91
  497. package/esm2022/standalone/directives/toggle.mjs +0 -76
  498. package/esm2022/standalone/index.mjs +0 -25
  499. package/esm2022/standalone/ionic-angular-standalone.mjs +0 -5
  500. package/esm2022/standalone/navigation/back-button.mjs +0 -32
  501. package/esm2022/standalone/navigation/nav.mjs +0 -28
  502. package/esm2022/standalone/navigation/router-link-delegate.mjs +0 -28
  503. package/esm2022/standalone/navigation/router-outlet.mjs +0 -60
  504. package/esm2022/standalone/navigation/tabs.mjs +0 -58
  505. package/esm2022/standalone/overlays/modal.mjs +0 -32
  506. package/esm2022/standalone/overlays/popover.mjs +0 -28
  507. package/esm2022/standalone/providers/action-sheet-controller.mjs +0 -21
  508. package/esm2022/standalone/providers/alert-controller.mjs +0 -21
  509. package/esm2022/standalone/providers/animation-controller.mjs +0 -38
  510. package/esm2022/standalone/providers/gesture-controller.mjs +0 -33
  511. package/esm2022/standalone/providers/ionic-angular.mjs +0 -38
  512. package/esm2022/standalone/providers/loading-controller.mjs +0 -21
  513. package/esm2022/standalone/providers/menu-controller.mjs +0 -19
  514. package/esm2022/standalone/providers/modal-controller.mjs +0 -28
  515. package/esm2022/standalone/providers/picker-controller.mjs +0 -24
  516. package/esm2022/standalone/providers/popover-controller.mjs +0 -21
  517. package/esm2022/standalone/providers/toast-controller.mjs +0 -21
  518. package/fesm2022/ionic-angular-common.mjs +0 -2791
  519. package/fesm2022/ionic-angular-common.mjs.map +0 -1
  520. package/fesm2022/ionic-angular-standalone.mjs +0 -3562
  521. package/fesm2022/ionic-angular-standalone.mjs.map +0 -1
  522. package/fesm2022/ionic-angular.mjs +0 -3139
  523. package/fesm2022/ionic-angular.mjs.map +0 -1
  524. package/ionic-module.d.ts +0 -28
  525. package/providers/picker-controller.d.ts +0 -11
  526. package/schematics/utils/ast.js +0 -32
  527. package/standalone/directives/proxies.d.ts +0 -1035
  528. package/standalone/providers/picker-controller.d.ts +0 -11
  529. /package/{common → dist/common}/directives/control-value-accessors/index.d.ts +0 -0
  530. /package/{common → dist/common}/directives/navigation/nav-params.d.ts +0 -0
  531. /package/{common → dist/common}/directives/navigation/stack-controller.d.ts +0 -0
  532. /package/{common → dist/common}/directives/navigation/stack-utils.d.ts +0 -0
  533. /package/{common → dist/common}/providers/config.d.ts +0 -0
  534. /package/{common → dist/common}/providers/dom-controller.d.ts +0 -0
  535. /package/{common → dist/common}/providers/menu-controller.d.ts +0 -0
  536. /package/{common → dist/common}/providers/nav-controller.d.ts +0 -0
  537. /package/{common → dist/common}/providers/platform.d.ts +0 -0
  538. /package/{common → dist/common}/types/interfaces.d.ts +0 -0
  539. /package/{common → dist/common}/types/ionic-lifecycle-hooks.d.ts +0 -0
  540. /package/{common → dist/common}/types/overlay-options.d.ts +0 -0
  541. /package/{common → dist/common}/utils/overlay.d.ts +0 -0
  542. /package/{common → dist/common}/utils/proxy.d.ts +0 -0
  543. /package/{common → dist/common}/utils/routing.d.ts +0 -0
  544. /package/{common → dist/common}/utils/util.d.ts +0 -0
  545. /package/{app-initialize.d.ts → dist/lazy/app-initialize.d.ts} +0 -0
  546. /package/{directives → dist/lazy/directives}/angular-component-lib/utils.d.ts +0 -0
  547. /package/{directives → dist/lazy/directives}/control-value-accessors/index.d.ts +0 -0
  548. /package/{directives → dist/lazy/directives}/navigation/ion-back-button.d.ts +0 -0
  549. /package/{directives → dist/lazy/directives}/navigation/ion-nav.d.ts +0 -0
  550. /package/{directives → dist/lazy/directives}/navigation/ion-router-outlet.d.ts +0 -0
  551. /package/{directives → dist/lazy/directives}/navigation/ion-tabs.d.ts +0 -0
  552. /package/{directives → dist/lazy/directives}/navigation/router-link-delegate.d.ts +0 -0
  553. /package/{directives → dist/lazy/directives}/overlays/modal.d.ts +0 -0
  554. /package/{directives → dist/lazy/directives}/overlays/popover.d.ts +0 -0
  555. /package/{directives → dist/lazy/directives}/validators/index.d.ts +0 -0
  556. /package/{directives → dist/lazy/directives}/validators/max-validator.d.ts +0 -0
  557. /package/{directives → dist/lazy/directives}/validators/min-validator.d.ts +0 -0
  558. /package/{providers → dist/lazy/providers}/action-sheet-controller.d.ts +0 -0
  559. /package/{providers → dist/lazy/providers}/alert-controller.d.ts +0 -0
  560. /package/{providers → dist/lazy/providers}/animation-controller.d.ts +0 -0
  561. /package/{providers → dist/lazy/providers}/gesture-controller.d.ts +0 -0
  562. /package/{providers → dist/lazy/providers}/loading-controller.d.ts +0 -0
  563. /package/{providers → dist/lazy/providers}/menu-controller.d.ts +0 -0
  564. /package/{providers → dist/lazy/providers}/modal-controller.d.ts +0 -0
  565. /package/{providers → dist/lazy/providers}/popover-controller.d.ts +0 -0
  566. /package/{providers → dist/lazy/providers}/toast-controller.d.ts +0 -0
  567. /package/{schematics → dist/schematics}/add/files/root/theme/variables.css +0 -0
  568. /package/{schematics → dist/schematics}/add/schema.json +0 -0
  569. /package/{schematics → dist/schematics}/collection.json +0 -0
  570. /package/{standalone → dist/standalone}/directives/angular-component-lib/utils.d.ts +0 -0
  571. /package/{standalone → dist/standalone}/directives/checkbox.d.ts +0 -0
  572. /package/{standalone → dist/standalone}/directives/datetime.d.ts +0 -0
  573. /package/{standalone → dist/standalone}/directives/icon.d.ts +0 -0
  574. /package/{standalone → dist/standalone}/directives/index.d.ts +0 -0
  575. /package/{standalone → dist/standalone}/directives/input-otp.d.ts +0 -0
  576. /package/{standalone → dist/standalone}/directives/input.d.ts +0 -0
  577. /package/{standalone → dist/standalone}/directives/radio-group.d.ts +0 -0
  578. /package/{standalone → dist/standalone}/directives/range.d.ts +0 -0
  579. /package/{standalone → dist/standalone}/directives/searchbar.d.ts +0 -0
  580. /package/{standalone → dist/standalone}/directives/segment.d.ts +0 -0
  581. /package/{standalone → dist/standalone}/directives/select.d.ts +0 -0
  582. /package/{standalone → dist/standalone}/directives/textarea.d.ts +0 -0
  583. /package/{standalone → dist/standalone}/directives/toggle.d.ts +0 -0
  584. /package/{standalone → dist/standalone}/navigation/back-button.d.ts +0 -0
  585. /package/{standalone → dist/standalone}/navigation/nav.d.ts +0 -0
  586. /package/{standalone → dist/standalone}/navigation/router-link-delegate.d.ts +0 -0
  587. /package/{standalone → dist/standalone}/navigation/router-outlet.d.ts +0 -0
  588. /package/{standalone → dist/standalone}/navigation/tabs.d.ts +0 -0
  589. /package/{standalone → dist/standalone}/overlays/modal.d.ts +0 -0
  590. /package/{standalone → dist/standalone}/overlays/popover.d.ts +0 -0
  591. /package/{standalone → dist/standalone}/providers/action-sheet-controller.d.ts +0 -0
  592. /package/{standalone → dist/standalone}/providers/alert-controller.d.ts +0 -0
  593. /package/{standalone → dist/standalone}/providers/animation-controller.d.ts +0 -0
  594. /package/{standalone → dist/standalone}/providers/gesture-controller.d.ts +0 -0
  595. /package/{standalone → dist/standalone}/providers/ionic-angular.d.ts +0 -0
  596. /package/{standalone → dist/standalone}/providers/loading-controller.d.ts +0 -0
  597. /package/{standalone → dist/standalone}/providers/menu-controller.d.ts +0 -0
  598. /package/{standalone → dist/standalone}/providers/modal-controller.d.ts +0 -0
  599. /package/{standalone → dist/standalone}/providers/popover-controller.d.ts +0 -0
  600. /package/{standalone → dist/standalone}/providers/toast-controller.d.ts +0 -0
@@ -1,2791 +0,0 @@
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 * as i3 from '@angular/router';
4
- import { NavigationStart, NavigationCancel, NavigationError, PRIMARY_OUTLET, ChildrenOutletContexts, ActivatedRoute, Router } from '@angular/router';
5
- import * as i1 from '@angular/common';
6
- import { DOCUMENT } from '@angular/common';
7
- import { isPlatform, getPlatforms, LIFECYCLE_WILL_ENTER, LIFECYCLE_DID_ENTER, LIFECYCLE_WILL_LEAVE, LIFECYCLE_DID_LEAVE, LIFECYCLE_WILL_UNLOAD, componentOnReady } from '@ionic/core/components';
8
- import { Subject, fromEvent, BehaviorSubject, combineLatest, of } from 'rxjs';
9
- import { __decorate } from 'tslib';
10
- import { filter, switchMap, distinctUntilChanged } from 'rxjs/operators';
11
- import { NgControl } from '@angular/forms';
12
-
13
- class DomController {
14
- /**
15
- * Schedules a task to run during the READ phase of the next frame.
16
- * This task should only read the DOM, but never modify it.
17
- */
18
- read(cb) {
19
- getQueue().read(cb);
20
- }
21
- /**
22
- * Schedules a task to run during the WRITE phase of the next frame.
23
- * This task should write the DOM, but never READ it.
24
- */
25
- write(cb) {
26
- getQueue().write(cb);
27
- }
28
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DomController, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
29
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DomController, providedIn: 'root' });
30
- }
31
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DomController, decorators: [{
32
- type: Injectable,
33
- args: [{
34
- providedIn: 'root',
35
- }]
36
- }] });
37
- const getQueue = () => {
38
- const win = typeof window !== 'undefined' ? window : null;
39
- if (win != null) {
40
- const Ionic = win.Ionic;
41
- if (Ionic?.queue) {
42
- return Ionic.queue;
43
- }
44
- return {
45
- read: (cb) => win.requestAnimationFrame(cb),
46
- write: (cb) => win.requestAnimationFrame(cb),
47
- };
48
- }
49
- return {
50
- read: (cb) => cb(),
51
- write: (cb) => cb(),
52
- };
53
- };
54
-
55
- class MenuController {
56
- menuController;
57
- constructor(menuController) {
58
- this.menuController = menuController;
59
- }
60
- /**
61
- * Programmatically open the Menu.
62
- * @param [menuId] Optionally get the menu by its id, or side.
63
- * @return returns a promise when the menu is fully opened
64
- */
65
- open(menuId) {
66
- return this.menuController.open(menuId);
67
- }
68
- /**
69
- * Programmatically close the Menu. If no `menuId` is given as the first
70
- * argument then it'll close any menu which is open. If a `menuId`
71
- * is given then it'll close that exact menu.
72
- * @param [menuId] Optionally get the menu by its id, or side.
73
- * @return returns a promise when the menu is fully closed
74
- */
75
- close(menuId) {
76
- return this.menuController.close(menuId);
77
- }
78
- /**
79
- * Toggle the menu. If it's closed, it will open, and if opened, it
80
- * will close.
81
- * @param [menuId] Optionally get the menu by its id, or side.
82
- * @return returns a promise when the menu has been toggled
83
- */
84
- toggle(menuId) {
85
- return this.menuController.toggle(menuId);
86
- }
87
- /**
88
- * Used to enable or disable a menu. For example, there could be multiple
89
- * left menus, but only one of them should be able to be opened at the same
90
- * time. If there are multiple menus on the same side, then enabling one menu
91
- * will also automatically disable all the others that are on the same side.
92
- * @param [menuId] Optionally get the menu by its id, or side.
93
- * @return Returns the instance of the menu, which is useful for chaining.
94
- */
95
- enable(shouldEnable, menuId) {
96
- return this.menuController.enable(shouldEnable, menuId);
97
- }
98
- /**
99
- * Used to enable or disable the ability to swipe open the menu.
100
- * @param shouldEnable True if it should be swipe-able, false if not.
101
- * @param [menuId] Optionally get the menu by its id, or side.
102
- * @return Returns the instance of the menu, which is useful for chaining.
103
- */
104
- swipeGesture(shouldEnable, menuId) {
105
- return this.menuController.swipeGesture(shouldEnable, menuId);
106
- }
107
- /**
108
- * @param [menuId] Optionally get the menu by its id, or side.
109
- * @return Returns true if the specified menu is currently open, otherwise false.
110
- * If the menuId is not specified, it returns true if ANY menu is currenly open.
111
- */
112
- isOpen(menuId) {
113
- return this.menuController.isOpen(menuId);
114
- }
115
- /**
116
- * @param [menuId] Optionally get the menu by its id, or side.
117
- * @return Returns true if the menu is currently enabled, otherwise false.
118
- */
119
- isEnabled(menuId) {
120
- return this.menuController.isEnabled(menuId);
121
- }
122
- /**
123
- * Used to get a menu instance. If a `menuId` is not provided then it'll
124
- * return the first menu found. If a `menuId` is `left` or `right`, then
125
- * it'll return the enabled menu on that side. Otherwise, if a `menuId` is
126
- * provided, then it'll try to find the menu using the menu's `id`
127
- * property. If a menu is not found then it'll return `null`.
128
- * @param [menuId] Optionally get the menu by its id, or side.
129
- * @return Returns the instance of the menu if found, otherwise `null`.
130
- */
131
- get(menuId) {
132
- return this.menuController.get(menuId);
133
- }
134
- /**
135
- * @return Returns the instance of the menu already opened, otherwise `null`.
136
- */
137
- getOpen() {
138
- return this.menuController.getOpen();
139
- }
140
- /**
141
- * @return Returns an array of all menu instances.
142
- */
143
- getMenus() {
144
- return this.menuController.getMenus();
145
- }
146
- registerAnimation(name, animation) {
147
- return this.menuController.registerAnimation(name, animation);
148
- }
149
- isAnimating() {
150
- return this.menuController.isAnimating();
151
- }
152
- _getOpenSync() {
153
- return this.menuController._getOpenSync();
154
- }
155
- _createAnimation(type, menuCmp) {
156
- return this.menuController._createAnimation(type, menuCmp);
157
- }
158
- _register(menu) {
159
- return this.menuController._register(menu);
160
- }
161
- _unregister(menu) {
162
- return this.menuController._unregister(menu);
163
- }
164
- _setOpen(menu, shouldOpen, animated) {
165
- return this.menuController._setOpen(menu, shouldOpen, animated);
166
- }
167
- }
168
-
169
- class Platform {
170
- doc;
171
- _readyPromise;
172
- win;
173
- /**
174
- * @hidden
175
- */
176
- backButton = new Subject();
177
- /**
178
- * The keyboardDidShow event emits when the
179
- * on-screen keyboard is presented.
180
- */
181
- keyboardDidShow = new Subject();
182
- /**
183
- * The keyboardDidHide event emits when the
184
- * on-screen keyboard is hidden.
185
- */
186
- keyboardDidHide = new Subject();
187
- /**
188
- * The pause event emits when the native platform puts the application
189
- * into the background, typically when the user switches to a different
190
- * application. This event would emit when a Cordova app is put into
191
- * the background, however, it would not fire on a standard web browser.
192
- */
193
- pause = new Subject();
194
- /**
195
- * The resume event emits when the native platform pulls the application
196
- * out from the background. This event would emit when a Cordova app comes
197
- * out from the background, however, it would not fire on a standard web browser.
198
- */
199
- resume = new Subject();
200
- /**
201
- * The resize event emits when the browser window has changed dimensions. This
202
- * could be from a browser window being physically resized, or from a device
203
- * changing orientation.
204
- */
205
- resize = new Subject();
206
- constructor(doc, zone) {
207
- this.doc = doc;
208
- zone.run(() => {
209
- this.win = doc.defaultView;
210
- this.backButton.subscribeWithPriority = function (priority, callback) {
211
- return this.subscribe((ev) => {
212
- return ev.register(priority, (processNextHandler) => zone.run(() => callback(processNextHandler)));
213
- });
214
- };
215
- proxyEvent(this.pause, doc, 'pause', zone);
216
- proxyEvent(this.resume, doc, 'resume', zone);
217
- proxyEvent(this.backButton, doc, 'ionBackButton', zone);
218
- proxyEvent(this.resize, this.win, 'resize', zone);
219
- proxyEvent(this.keyboardDidShow, this.win, 'ionKeyboardDidShow', zone);
220
- proxyEvent(this.keyboardDidHide, this.win, 'ionKeyboardDidHide', zone);
221
- let readyResolve;
222
- this._readyPromise = new Promise((res) => {
223
- readyResolve = res;
224
- });
225
- if (this.win?.['cordova']) {
226
- doc.addEventListener('deviceready', () => {
227
- readyResolve('cordova');
228
- }, { once: true });
229
- }
230
- else {
231
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
232
- readyResolve('dom');
233
- }
234
- });
235
- }
236
- /**
237
- * @returns returns true/false based on platform.
238
- * @description
239
- * Depending on the platform the user is on, `is(platformName)` will
240
- * return `true` or `false`. Note that the same app can return `true`
241
- * for more than one platform name. For example, an app running from
242
- * an iPad would return `true` for the platform names: `mobile`,
243
- * `ios`, `ipad`, and `tablet`. Additionally, if the app was running
244
- * from Cordova then `cordova` would be true, and if it was running
245
- * from a web browser on the iPad then `mobileweb` would be `true`.
246
- *
247
- * ```
248
- * import { Platform } from 'ionic-angular';
249
- *
250
- * @Component({...})
251
- * export MyPage {
252
- * constructor(public platform: Platform) {
253
- * if (this.platform.is('ios')) {
254
- * // This will only print when on iOS
255
- * console.log('I am an iOS device!');
256
- * }
257
- * }
258
- * }
259
- * ```
260
- *
261
- * | Platform Name | Description |
262
- * |-----------------|------------------------------------|
263
- * | android | on a device running Android. |
264
- * | capacitor | on a device running Capacitor. |
265
- * | cordova | on a device running Cordova. |
266
- * | ios | on a device running iOS. |
267
- * | ipad | on an iPad device. |
268
- * | iphone | on an iPhone device. |
269
- * | phablet | on a phablet device. |
270
- * | tablet | on a tablet device. |
271
- * | electron | in Electron on a desktop device. |
272
- * | pwa | as a PWA app. |
273
- * | mobile | on a mobile device. |
274
- * | mobileweb | on a mobile device in a browser. |
275
- * | desktop | on a desktop device. |
276
- * | hybrid | is a cordova or capacitor app. |
277
- *
278
- */
279
- is(platformName) {
280
- return isPlatform(this.win, platformName);
281
- }
282
- /**
283
- * @returns the array of platforms
284
- * @description
285
- * Depending on what device you are on, `platforms` can return multiple values.
286
- * Each possible value is a hierarchy of platforms. For example, on an iPhone,
287
- * it would return `mobile`, `ios`, and `iphone`.
288
- *
289
- * ```
290
- * import { Platform } from 'ionic-angular';
291
- *
292
- * @Component({...})
293
- * export MyPage {
294
- * constructor(public platform: Platform) {
295
- * // This will print an array of the current platforms
296
- * console.log(this.platform.platforms());
297
- * }
298
- * }
299
- * ```
300
- */
301
- platforms() {
302
- return getPlatforms(this.win);
303
- }
304
- /**
305
- * Returns a promise when the platform is ready and native functionality
306
- * can be called. If the app is running from within a web browser, then
307
- * the promise will resolve when the DOM is ready. When the app is running
308
- * from an application engine such as Cordova, then the promise will
309
- * resolve when Cordova triggers the `deviceready` event.
310
- *
311
- * The resolved value is the `readySource`, which states which platform
312
- * ready was used. For example, when Cordova is ready, the resolved ready
313
- * source is `cordova`. The default ready source value will be `dom`. The
314
- * `readySource` is useful if different logic should run depending on the
315
- * platform the app is running from. For example, only Cordova can execute
316
- * the status bar plugin, so the web should not run status bar plugin logic.
317
- *
318
- * ```
319
- * import { Component } from '@angular/core';
320
- * import { Platform } from 'ionic-angular';
321
- *
322
- * @Component({...})
323
- * export MyApp {
324
- * constructor(public platform: Platform) {
325
- * this.platform.ready().then((readySource) => {
326
- * console.log('Platform ready from', readySource);
327
- * // Platform now ready, execute any required native code
328
- * });
329
- * }
330
- * }
331
- * ```
332
- */
333
- ready() {
334
- return this._readyPromise;
335
- }
336
- /**
337
- * Returns if this app is using right-to-left language direction or not.
338
- * We recommend the app's `index.html` file already has the correct `dir`
339
- * attribute value set, such as `<html dir="ltr">` or `<html dir="rtl">`.
340
- * [W3C: Structural markup and right-to-left text in HTML](http://www.w3.org/International/questions/qa-html-dir)
341
- */
342
- get isRTL() {
343
- return this.doc.dir === 'rtl';
344
- }
345
- /**
346
- * Get the query string parameter
347
- */
348
- getQueryParam(key) {
349
- return readQueryParam(this.win.location.href, key);
350
- }
351
- /**
352
- * Returns `true` if the app is in landscape mode.
353
- */
354
- isLandscape() {
355
- return !this.isPortrait();
356
- }
357
- /**
358
- * Returns `true` if the app is in portrait mode.
359
- */
360
- isPortrait() {
361
- return this.win.matchMedia?.('(orientation: portrait)').matches;
362
- }
363
- testUserAgent(expression) {
364
- const nav = this.win.navigator;
365
- return !!(nav?.userAgent && nav.userAgent.indexOf(expression) >= 0);
366
- }
367
- /**
368
- * Get the current url.
369
- */
370
- url() {
371
- return this.win.location.href;
372
- }
373
- /**
374
- * Gets the width of the platform's viewport using `window.innerWidth`.
375
- */
376
- width() {
377
- return this.win.innerWidth;
378
- }
379
- /**
380
- * Gets the height of the platform's viewport using `window.innerHeight`.
381
- */
382
- height() {
383
- return this.win.innerHeight;
384
- }
385
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Platform, deps: [{ token: DOCUMENT }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
386
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Platform, providedIn: 'root' });
387
- }
388
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Platform, decorators: [{
389
- type: Injectable,
390
- args: [{
391
- providedIn: 'root',
392
- }]
393
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
394
- type: Inject,
395
- args: [DOCUMENT]
396
- }] }, { type: i0.NgZone }]; } });
397
- const readQueryParam = (url, key) => {
398
- key = key.replace(/[[\]\\]/g, '\\$&');
399
- const regex = new RegExp('[\\?&]' + key + '=([^&#]*)');
400
- const results = regex.exec(url);
401
- return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null;
402
- };
403
- const proxyEvent = (emitter, el, eventName, zone) => {
404
- if (el) {
405
- el.addEventListener(eventName, (ev) => {
406
- /**
407
- * `zone.run` is required to make sure that we are running inside the Angular zone
408
- * at all times. This is necessary since an app that has Capacitor will
409
- * override the `document.addEventListener` with its own implementation.
410
- * The override causes the event to no longer be in the Angular zone.
411
- */
412
- zone.run(() => {
413
- // ?? cordova might emit "null" events
414
- const value = ev != null ? ev.detail : undefined;
415
- emitter.next(value);
416
- });
417
- });
418
- }
419
- };
420
-
421
- class NavController {
422
- location;
423
- serializer;
424
- router;
425
- topOutlet;
426
- direction = DEFAULT_DIRECTION;
427
- animated = DEFAULT_ANIMATED;
428
- animationBuilder;
429
- guessDirection = 'forward';
430
- guessAnimation;
431
- lastNavId = -1;
432
- constructor(platform, location, serializer, router) {
433
- this.location = location;
434
- this.serializer = serializer;
435
- this.router = router;
436
- // Subscribe to router events to detect direction
437
- if (router) {
438
- router.events.subscribe((ev) => {
439
- if (ev instanceof NavigationStart) {
440
- // restoredState is set if the browser back/forward button is used
441
- const id = ev.restoredState ? ev.restoredState.navigationId : ev.id;
442
- this.guessDirection = this.guessAnimation = id < this.lastNavId ? 'back' : 'forward';
443
- this.lastNavId = this.guessDirection === 'forward' ? ev.id : id;
444
- }
445
- // Reset explicit direction when navigation is canceled (e.g., guard rejection)
446
- // to prevent stale direction from leaking into the next navigation
447
- if (ev instanceof NavigationCancel || ev instanceof NavigationError) {
448
- this.direction = DEFAULT_DIRECTION;
449
- this.animated = DEFAULT_ANIMATED;
450
- this.animationBuilder = undefined;
451
- }
452
- });
453
- }
454
- // Subscribe to backButton events
455
- platform.backButton.subscribeWithPriority(0, (processNextHandler) => {
456
- this.pop();
457
- processNextHandler();
458
- });
459
- }
460
- /**
461
- * This method uses Angular's [Router](https://angular.io/api/router/Router) under the hood,
462
- * it's equivalent to calling `this.router.navigateByUrl()`, but it's explicit about the **direction** of the transition.
463
- *
464
- * Going **forward** means that a new page is going to be pushed to the stack of the outlet (ion-router-outlet),
465
- * and that it will show a "forward" animation by default.
466
- *
467
- * Navigating forward can also be triggered in a declarative manner by using the `[routerDirection]` directive:
468
- *
469
- * ```html
470
- * <a routerLink="/path/to/page" routerDirection="forward">Link</a>
471
- * ```
472
- */
473
- navigateForward(url, options = {}) {
474
- this.setDirection('forward', options.animated, options.animationDirection, options.animation);
475
- return this.navigate(url, options);
476
- }
477
- /**
478
- * This method uses Angular's [Router](https://angular.io/api/router/Router) under the hood,
479
- * it's equivalent to calling:
480
- *
481
- * ```ts
482
- * this.navController.setDirection('back');
483
- * this.router.navigateByUrl(path);
484
- * ```
485
- *
486
- * Going **back** means that all the pages in the stack until the navigated page is found will be popped,
487
- * and that it will show a "back" animation by default.
488
- *
489
- * Navigating back can also be triggered in a declarative manner by using the `[routerDirection]` directive:
490
- *
491
- * ```html
492
- * <a routerLink="/path/to/page" routerDirection="back">Link</a>
493
- * ```
494
- */
495
- navigateBack(url, options = {}) {
496
- this.setDirection('back', options.animated, options.animationDirection, options.animation);
497
- return this.navigate(url, options);
498
- }
499
- /**
500
- * This method uses Angular's [Router](https://angular.io/api/router/Router) under the hood,
501
- * it's equivalent to calling:
502
- *
503
- * ```ts
504
- * this.navController.setDirection('root');
505
- * this.router.navigateByUrl(path);
506
- * ```
507
- *
508
- * Going **root** means that all existing pages in the stack will be removed,
509
- * and the navigated page will become the single page in the stack.
510
- *
511
- * Navigating root can also be triggered in a declarative manner by using the `[routerDirection]` directive:
512
- *
513
- * ```html
514
- * <a routerLink="/path/to/page" routerDirection="root">Link</a>
515
- * ```
516
- */
517
- navigateRoot(url, options = {}) {
518
- this.setDirection('root', options.animated, options.animationDirection, options.animation);
519
- return this.navigate(url, options);
520
- }
521
- /**
522
- * Same as [Location](https://angular.io/api/common/Location)'s back() method.
523
- * It will use the standard `window.history.back()` under the hood, but featuring a `back` animation
524
- * by default.
525
- */
526
- back(options = { animated: true, animationDirection: 'back' }) {
527
- this.setDirection('back', options.animated, options.animationDirection, options.animation);
528
- return this.location.back();
529
- }
530
- /**
531
- * This methods goes back in the context of Ionic's stack navigation.
532
- *
533
- * It recursively finds the top active `ion-router-outlet` and calls `pop()`.
534
- * This is the recommended way to go back when you are using `ion-router-outlet`.
535
- *
536
- * Resolves to `true` if it was able to pop.
537
- */
538
- async pop() {
539
- let outlet = this.topOutlet;
540
- while (outlet) {
541
- if (await outlet.pop()) {
542
- return true;
543
- }
544
- else {
545
- outlet = outlet.parentOutlet;
546
- }
547
- }
548
- return false;
549
- }
550
- /**
551
- * This methods specifies the direction of the next navigation performed by the Angular router.
552
- *
553
- * `setDirection()` does not trigger any transition, it just sets some flags to be consumed by `ion-router-outlet`.
554
- *
555
- * It's recommended to use `navigateForward()`, `navigateBack()` and `navigateRoot()` instead of `setDirection()`.
556
- */
557
- setDirection(direction, animated, animationDirection, animationBuilder) {
558
- this.direction = direction;
559
- this.animated = getAnimation(direction, animated, animationDirection);
560
- this.animationBuilder = animationBuilder;
561
- }
562
- /**
563
- * @internal
564
- */
565
- setTopOutlet(outlet) {
566
- this.topOutlet = outlet;
567
- }
568
- /**
569
- * @internal
570
- */
571
- consumeTransition() {
572
- let direction = 'root';
573
- let animation;
574
- const animationBuilder = this.animationBuilder;
575
- if (this.direction === 'auto') {
576
- direction = this.guessDirection;
577
- animation = this.guessAnimation;
578
- }
579
- else {
580
- animation = this.animated;
581
- direction = this.direction;
582
- }
583
- this.direction = DEFAULT_DIRECTION;
584
- this.animated = DEFAULT_ANIMATED;
585
- this.animationBuilder = undefined;
586
- return {
587
- direction,
588
- animation,
589
- animationBuilder,
590
- };
591
- }
592
- navigate(url, options) {
593
- if (Array.isArray(url)) {
594
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
595
- return this.router.navigate(url, options);
596
- }
597
- else {
598
- /**
599
- * navigateByUrl ignores any properties that
600
- * would change the url, so things like queryParams
601
- * would be ignored unless we create a url tree
602
- * More Info: https://github.com/angular/angular/issues/18798
603
- */
604
- const urlTree = this.serializer.parse(url.toString());
605
- if (options.queryParams !== undefined) {
606
- urlTree.queryParams = { ...options.queryParams };
607
- }
608
- if (options.fragment !== undefined) {
609
- urlTree.fragment = options.fragment;
610
- }
611
- /**
612
- * `navigateByUrl` will still apply `NavigationExtras` properties
613
- * that do not modify the url, such as `replaceUrl` which is why
614
- * `options` is passed in here.
615
- */
616
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
617
- return this.router.navigateByUrl(urlTree, options);
618
- }
619
- }
620
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NavController, deps: [{ token: Platform }, { token: i1.Location }, { token: i3.UrlSerializer }, { token: i3.Router, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
621
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NavController, providedIn: 'root' });
622
- }
623
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NavController, decorators: [{
624
- type: Injectable,
625
- args: [{
626
- providedIn: 'root',
627
- }]
628
- }], ctorParameters: function () { return [{ type: Platform }, { type: i1.Location }, { type: i3.UrlSerializer }, { type: i3.Router, decorators: [{
629
- type: Optional
630
- }] }]; } });
631
- const getAnimation = (direction, animated, animationDirection) => {
632
- if (animated === false) {
633
- return undefined;
634
- }
635
- if (animationDirection !== undefined) {
636
- return animationDirection;
637
- }
638
- if (direction === 'forward' || direction === 'back') {
639
- return direction;
640
- }
641
- else if (direction === 'root' && animated === true) {
642
- return 'forward';
643
- }
644
- return undefined;
645
- };
646
- const DEFAULT_DIRECTION = 'auto';
647
- const DEFAULT_ANIMATED = undefined;
648
-
649
- class Config {
650
- get(key, fallback) {
651
- const c = getConfig();
652
- if (c) {
653
- return c.get(key, fallback);
654
- }
655
- return null;
656
- }
657
- getBoolean(key, fallback) {
658
- const c = getConfig();
659
- if (c) {
660
- return c.getBoolean(key, fallback);
661
- }
662
- return false;
663
- }
664
- getNumber(key, fallback) {
665
- const c = getConfig();
666
- if (c) {
667
- return c.getNumber(key, fallback);
668
- }
669
- return 0;
670
- }
671
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Config, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
672
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Config, providedIn: 'root' });
673
- }
674
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: Config, decorators: [{
675
- type: Injectable,
676
- args: [{
677
- providedIn: 'root',
678
- }]
679
- }] });
680
- const ConfigToken = new InjectionToken('USERCONFIG');
681
- const getConfig = () => {
682
- if (typeof window !== 'undefined') {
683
- const Ionic = window.Ionic;
684
- if (Ionic?.config) {
685
- return Ionic.config;
686
- }
687
- }
688
- return null;
689
- };
690
-
691
- /**
692
- * @description
693
- * NavParams are an object that exists on a page and can contain data for that particular view.
694
- * Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
695
- * option with a simple `get` method.
696
- *
697
- * @usage
698
- * ```ts
699
- * import { NavParams } from '@ionic/angular';
700
- *
701
- * export class MyClass{
702
- *
703
- * constructor(navParams: NavParams){
704
- * // userParams is an object we have in our nav-parameters
705
- * navParams.get('userParams');
706
- * }
707
- *
708
- * }
709
- * ```
710
- */
711
- class NavParams {
712
- data;
713
- constructor(data = {}) {
714
- this.data = data;
715
- console.warn(`[Ionic Warning]: NavParams has been deprecated in favor of using Angular's input API. Developers should migrate to either the @Input decorator or the Signals-based input API.`);
716
- }
717
- /**
718
- * Get the value of a nav-parameter for the current view
719
- *
720
- * ```ts
721
- * import { NavParams } from 'ionic-angular';
722
- *
723
- * export class MyClass{
724
- * constructor(public navParams: NavParams){
725
- * // userParams is an object we have in our nav-parameters
726
- * this.navParams.get('userParams');
727
- * }
728
- * }
729
- * ```
730
- *
731
- * @param param Which param you want to look up
732
- */
733
- get(param) {
734
- return this.data[param];
735
- }
736
- }
737
-
738
- // Token for injecting the modal element
739
- const IonModalToken = new InjectionToken('IonModalToken');
740
- // TODO(FW-2827): types
741
- class AngularDelegate {
742
- zone = inject(NgZone);
743
- applicationRef = inject(ApplicationRef);
744
- config = inject(ConfigToken);
745
- create(environmentInjector, injector, elementReferenceKey, customInjector) {
746
- return new AngularFrameworkDelegate(environmentInjector, injector, this.applicationRef, this.zone, elementReferenceKey, this.config.useSetInputAPI ?? false, customInjector);
747
- }
748
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AngularDelegate, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
749
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AngularDelegate });
750
- }
751
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AngularDelegate, decorators: [{
752
- type: Injectable
753
- }] });
754
- class AngularFrameworkDelegate {
755
- environmentInjector;
756
- injector;
757
- applicationRef;
758
- zone;
759
- elementReferenceKey;
760
- enableSignalsSupport;
761
- customInjector;
762
- elRefMap = new WeakMap();
763
- elEventsMap = new WeakMap();
764
- constructor(environmentInjector, injector, applicationRef, zone, elementReferenceKey, enableSignalsSupport, customInjector) {
765
- this.environmentInjector = environmentInjector;
766
- this.injector = injector;
767
- this.applicationRef = applicationRef;
768
- this.zone = zone;
769
- this.elementReferenceKey = elementReferenceKey;
770
- this.enableSignalsSupport = enableSignalsSupport;
771
- this.customInjector = customInjector;
772
- }
773
- attachViewToDom(container, component, params, cssClasses) {
774
- return this.zone.run(() => {
775
- return new Promise((resolve) => {
776
- const componentProps = {
777
- ...params,
778
- };
779
- /**
780
- * Ionic Angular passes a reference to a modal
781
- * or popover that can be accessed using a
782
- * variable in the overlay component. If
783
- * elementReferenceKey is defined, then we should
784
- * pass a reference to the component using
785
- * elementReferenceKey as the key.
786
- */
787
- if (this.elementReferenceKey !== undefined) {
788
- componentProps[this.elementReferenceKey] = container;
789
- }
790
- const el = attachView(this.zone, this.environmentInjector, this.injector, this.applicationRef, this.elRefMap, this.elEventsMap, container, component, componentProps, cssClasses, this.elementReferenceKey, this.enableSignalsSupport, this.customInjector);
791
- resolve(el);
792
- });
793
- });
794
- }
795
- removeViewFromDom(_container, component) {
796
- return this.zone.run(() => {
797
- return new Promise((resolve) => {
798
- const componentRef = this.elRefMap.get(component);
799
- if (componentRef) {
800
- componentRef.destroy();
801
- this.elRefMap.delete(component);
802
- const unbindEvents = this.elEventsMap.get(component);
803
- if (unbindEvents) {
804
- unbindEvents();
805
- this.elEventsMap.delete(component);
806
- }
807
- }
808
- resolve();
809
- });
810
- });
811
- }
812
- }
813
- const attachView = (zone, environmentInjector, injector, applicationRef, elRefMap, elEventsMap, container, component, params, cssClasses, elementReferenceKey, enableSignalsSupport, customInjector) => {
814
- /**
815
- * Wraps the injector with a custom injector that
816
- * provides NavParams to the component.
817
- *
818
- * NavParams is a legacy feature from Ionic v3 that allows
819
- * Angular developers to provide data to a component
820
- * and access it by providing NavParams as a dependency
821
- * in the constructor.
822
- *
823
- * The modern approach is to access the data directly
824
- * from the component's class instance.
825
- */
826
- const providers = getProviders(params);
827
- // If this is an ion-modal, provide the modal element as an injectable
828
- // so components inside the modal can inject it directly
829
- if (container.tagName.toLowerCase() === 'ion-modal') {
830
- providers.push({
831
- provide: IonModalToken,
832
- useValue: container,
833
- });
834
- }
835
- const childInjector = Injector.create({
836
- providers,
837
- parent: customInjector ?? injector,
838
- });
839
- const componentRef = createComponent(component, {
840
- environmentInjector,
841
- elementInjector: childInjector,
842
- });
843
- const instance = componentRef.instance;
844
- const hostElement = componentRef.location.nativeElement;
845
- if (params) {
846
- /**
847
- * For modals and popovers, a reference to the component is
848
- * added to `params` during the call to attachViewToDom. If
849
- * a reference using this name is already set, this means
850
- * the app is trying to use the name as a component prop,
851
- * which will cause collisions.
852
- */
853
- if (elementReferenceKey && instance[elementReferenceKey] !== undefined) {
854
- console.error(`[Ionic Error]: ${elementReferenceKey} is a reserved property when using ${container.tagName.toLowerCase()}. Rename or remove the "${elementReferenceKey}" property from ${component.name}.`);
855
- }
856
- /**
857
- * Angular 14.1 added support for setInput
858
- * so we need to fall back to Object.assign
859
- * for Angular 14.0.
860
- */
861
- if (enableSignalsSupport === true && componentRef.setInput !== undefined) {
862
- const { modal, popover, ...otherParams } = params;
863
- /**
864
- * Any key/value pairs set in componentProps
865
- * must be set as inputs on the component instance.
866
- */
867
- for (const key in otherParams) {
868
- componentRef.setInput(key, otherParams[key]);
869
- }
870
- /**
871
- * Using setInput will cause an error when
872
- * setting modal/popover on a component that
873
- * does not define them as an input. For backwards
874
- * compatibility purposes we fall back to using
875
- * Object.assign for these properties.
876
- */
877
- if (modal !== undefined) {
878
- Object.assign(instance, { modal });
879
- }
880
- if (popover !== undefined) {
881
- Object.assign(instance, { popover });
882
- }
883
- }
884
- else {
885
- Object.assign(instance, params);
886
- }
887
- }
888
- if (cssClasses) {
889
- for (const cssClass of cssClasses) {
890
- hostElement.classList.add(cssClass);
891
- }
892
- }
893
- const unbindEvents = bindLifecycleEvents(zone, instance, hostElement);
894
- container.appendChild(hostElement);
895
- applicationRef.attachView(componentRef.hostView);
896
- /**
897
- * Run change detection so template bindings (e.g. `<ion-nav [root]="rootPage">`)
898
- * apply during this synchronous pass, before the web component runs its load
899
- * lifecycle. `createComponent` only runs the creation pass, so without this the
900
- * binding lands after the element has loaded, too late for `ion-nav` to read it.
901
- */
902
- componentRef.changeDetectorRef.detectChanges();
903
- elRefMap.set(hostElement, componentRef);
904
- elEventsMap.set(hostElement, unbindEvents);
905
- return hostElement;
906
- };
907
- const LIFECYCLES = [
908
- LIFECYCLE_WILL_ENTER,
909
- LIFECYCLE_DID_ENTER,
910
- LIFECYCLE_WILL_LEAVE,
911
- LIFECYCLE_DID_LEAVE,
912
- LIFECYCLE_WILL_UNLOAD,
913
- ];
914
- const bindLifecycleEvents = (zone, instance, element) => {
915
- return zone.run(() => {
916
- const unregisters = LIFECYCLES.filter((eventName) => typeof instance[eventName] === 'function').map((eventName) => {
917
- const handler = (ev) => instance[eventName](ev.detail);
918
- element.addEventListener(eventName, handler);
919
- return () => element.removeEventListener(eventName, handler);
920
- });
921
- return () => unregisters.forEach((fn) => fn());
922
- });
923
- };
924
- const NavParamsToken = new InjectionToken('NavParamsToken');
925
- const getProviders = (params) => {
926
- return [
927
- {
928
- provide: NavParamsToken,
929
- useValue: params,
930
- },
931
- {
932
- provide: NavParams,
933
- useFactory: provideNavParamsInjectable,
934
- deps: [NavParamsToken],
935
- },
936
- ];
937
- };
938
- const provideNavParamsInjectable = (params) => {
939
- return new NavParams(params);
940
- };
941
-
942
- // TODO: Is there a way we can grab this from angular-component-lib instead?
943
- /* eslint-disable */
944
- /* tslint:disable */
945
- const proxyInputs = (Cmp, inputs) => {
946
- const Prototype = Cmp.prototype;
947
- inputs.forEach((item) => {
948
- Object.defineProperty(Prototype, item, {
949
- get() {
950
- return this.el[item];
951
- },
952
- set(val) {
953
- this.z.runOutsideAngular(() => (this.el[item] = val));
954
- },
955
- });
956
- });
957
- };
958
- const proxyMethods = (Cmp, methods) => {
959
- const Prototype = Cmp.prototype;
960
- methods.forEach((methodName) => {
961
- Prototype[methodName] = function () {
962
- const args = arguments;
963
- return this.z.runOutsideAngular(() => this.el[methodName].apply(this.el, args));
964
- };
965
- });
966
- };
967
- const proxyOutputs = (instance, el, events) => {
968
- events.forEach((eventName) => (instance[eventName] = fromEvent(el, eventName)));
969
- };
970
- // tslint:disable-next-line: only-arrow-functions
971
- function ProxyCmp(opts) {
972
- const decorator = function (cls) {
973
- const { defineCustomElementFn, inputs, methods } = opts;
974
- if (defineCustomElementFn !== undefined) {
975
- defineCustomElementFn();
976
- }
977
- if (inputs) {
978
- proxyInputs(cls, inputs);
979
- }
980
- if (methods) {
981
- proxyMethods(cls, methods);
982
- }
983
- return cls;
984
- };
985
- return decorator;
986
- }
987
-
988
- const MODAL_INPUTS = [
989
- 'animated',
990
- 'keepContentsMounted',
991
- 'backdropBreakpoint',
992
- 'backdropDismiss',
993
- 'breakpoints',
994
- 'canDismiss',
995
- 'cssClass',
996
- 'enterAnimation',
997
- 'expandToScroll',
998
- 'event',
999
- 'focusTrap',
1000
- 'handle',
1001
- 'handleBehavior',
1002
- 'initialBreakpoint',
1003
- 'isOpen',
1004
- 'keyboardClose',
1005
- 'leaveAnimation',
1006
- 'mode',
1007
- 'presentingElement',
1008
- 'showBackdrop',
1009
- 'translucent',
1010
- 'trigger',
1011
- ];
1012
- const MODAL_METHODS = [
1013
- 'present',
1014
- 'dismiss',
1015
- 'onDidDismiss',
1016
- 'onWillDismiss',
1017
- 'setCurrentBreakpoint',
1018
- 'getCurrentBreakpoint',
1019
- ];
1020
- let IonModal =
1021
- /**
1022
- * @Component extends from @Directive
1023
- * so by defining the inputs here we
1024
- * do not need to re-define them for the
1025
- * lazy loaded popover.
1026
- */
1027
- class IonModal {
1028
- z;
1029
- // TODO(FW-2827): type
1030
- template;
1031
- isCmpOpen = false;
1032
- el;
1033
- constructor(c, r, z) {
1034
- this.z = z;
1035
- this.el = r.nativeElement;
1036
- this.el.addEventListener('ionMount', () => {
1037
- this.isCmpOpen = true;
1038
- c.detectChanges();
1039
- });
1040
- this.el.addEventListener('didDismiss', () => {
1041
- this.isCmpOpen = false;
1042
- c.detectChanges();
1043
- });
1044
- proxyOutputs(this, this.el, [
1045
- 'ionModalDidPresent',
1046
- 'ionModalWillPresent',
1047
- 'ionModalWillDismiss',
1048
- 'ionModalDidDismiss',
1049
- 'ionBreakpointDidChange',
1050
- 'didPresent',
1051
- 'willPresent',
1052
- 'willDismiss',
1053
- 'didDismiss',
1054
- 'ionDragStart',
1055
- 'ionDragMove',
1056
- 'ionDragEnd',
1057
- ]);
1058
- }
1059
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonModal, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
1060
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: IonModal, selector: "ion-modal", inputs: { animated: "animated", keepContentsMounted: "keepContentsMounted", backdropBreakpoint: "backdropBreakpoint", backdropDismiss: "backdropDismiss", breakpoints: "breakpoints", canDismiss: "canDismiss", cssClass: "cssClass", enterAnimation: "enterAnimation", expandToScroll: "expandToScroll", event: "event", focusTrap: "focusTrap", handle: "handle", handleBehavior: "handleBehavior", initialBreakpoint: "initialBreakpoint", isOpen: "isOpen", keyboardClose: "keyboardClose", leaveAnimation: "leaveAnimation", mode: "mode", presentingElement: "presentingElement", showBackdrop: "showBackdrop", translucent: "translucent", trigger: "trigger" }, queries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0 });
1061
- };
1062
- IonModal = __decorate([
1063
- ProxyCmp({
1064
- inputs: MODAL_INPUTS,
1065
- methods: MODAL_METHODS,
1066
- })
1067
- /**
1068
- * @Component extends from @Directive
1069
- * so by defining the inputs here we
1070
- * do not need to re-define them for the
1071
- * lazy loaded popover.
1072
- */
1073
- ], IonModal);
1074
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonModal, decorators: [{
1075
- type: Directive,
1076
- args: [{
1077
- selector: 'ion-modal',
1078
- // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1079
- inputs: MODAL_INPUTS,
1080
- }]
1081
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { template: [{
1082
- type: ContentChild,
1083
- args: [TemplateRef, { static: false }]
1084
- }] } });
1085
-
1086
- const POPOVER_INPUTS = [
1087
- 'alignment',
1088
- 'animated',
1089
- 'arrow',
1090
- 'keepContentsMounted',
1091
- 'backdropDismiss',
1092
- 'cssClass',
1093
- 'dismissOnSelect',
1094
- 'enterAnimation',
1095
- 'event',
1096
- 'focusTrap',
1097
- 'isOpen',
1098
- 'keyboardClose',
1099
- 'leaveAnimation',
1100
- 'mode',
1101
- 'showBackdrop',
1102
- 'translucent',
1103
- 'trigger',
1104
- 'triggerAction',
1105
- 'reference',
1106
- 'size',
1107
- 'side',
1108
- ];
1109
- const POPOVER_METHODS = ['present', 'dismiss', 'onDidDismiss', 'onWillDismiss'];
1110
- let IonPopover =
1111
- /**
1112
- * @Component extends from @Directive
1113
- * so by defining the inputs here we
1114
- * do not need to re-define them for the
1115
- * lazy loaded popover.
1116
- */
1117
- class IonPopover {
1118
- z;
1119
- // TODO(FW-2827): type
1120
- template;
1121
- isCmpOpen = false;
1122
- el;
1123
- constructor(c, r, z) {
1124
- this.z = z;
1125
- this.el = r.nativeElement;
1126
- this.el.addEventListener('ionMount', () => {
1127
- this.isCmpOpen = true;
1128
- c.detectChanges();
1129
- });
1130
- this.el.addEventListener('didDismiss', () => {
1131
- this.isCmpOpen = false;
1132
- c.detectChanges();
1133
- });
1134
- proxyOutputs(this, this.el, [
1135
- 'ionPopoverDidPresent',
1136
- 'ionPopoverWillPresent',
1137
- 'ionPopoverWillDismiss',
1138
- 'ionPopoverDidDismiss',
1139
- 'didPresent',
1140
- 'willPresent',
1141
- 'willDismiss',
1142
- 'didDismiss',
1143
- ]);
1144
- }
1145
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonPopover, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
1146
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: IonPopover, selector: "ion-popover", inputs: { alignment: "alignment", animated: "animated", arrow: "arrow", keepContentsMounted: "keepContentsMounted", backdropDismiss: "backdropDismiss", cssClass: "cssClass", dismissOnSelect: "dismissOnSelect", enterAnimation: "enterAnimation", event: "event", focusTrap: "focusTrap", isOpen: "isOpen", keyboardClose: "keyboardClose", leaveAnimation: "leaveAnimation", mode: "mode", showBackdrop: "showBackdrop", translucent: "translucent", trigger: "trigger", triggerAction: "triggerAction", reference: "reference", size: "size", side: "side" }, queries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0 });
1147
- };
1148
- IonPopover = __decorate([
1149
- ProxyCmp({
1150
- inputs: POPOVER_INPUTS,
1151
- methods: POPOVER_METHODS,
1152
- })
1153
- /**
1154
- * @Component extends from @Directive
1155
- * so by defining the inputs here we
1156
- * do not need to re-define them for the
1157
- * lazy loaded popover.
1158
- */
1159
- ], IonPopover);
1160
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonPopover, decorators: [{
1161
- type: Directive,
1162
- args: [{
1163
- selector: 'ion-popover',
1164
- // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1165
- inputs: POPOVER_INPUTS,
1166
- }]
1167
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { template: [{
1168
- type: ContentChild,
1169
- args: [TemplateRef, { static: false }]
1170
- }] } });
1171
-
1172
- const insertView = (views, view, direction) => {
1173
- if (direction === 'root') {
1174
- return setRoot(views, view);
1175
- }
1176
- else if (direction === 'forward') {
1177
- return setForward(views, view);
1178
- }
1179
- else {
1180
- return setBack(views, view);
1181
- }
1182
- };
1183
- const setRoot = (views, view) => {
1184
- views = views.filter((v) => v.stackId !== view.stackId);
1185
- views.push(view);
1186
- return views;
1187
- };
1188
- const setForward = (views, view) => {
1189
- const index = views.indexOf(view);
1190
- if (index >= 0) {
1191
- views = views.filter((v) => v.stackId !== view.stackId || v.id <= view.id);
1192
- }
1193
- else {
1194
- views.push(view);
1195
- }
1196
- return views;
1197
- };
1198
- const setBack = (views, view) => {
1199
- const index = views.indexOf(view);
1200
- if (index >= 0) {
1201
- return views.filter((v) => v.stackId !== view.stackId || v.id <= view.id);
1202
- }
1203
- else {
1204
- return setRoot(views, view);
1205
- }
1206
- };
1207
- const getUrl = (router, activatedRoute) => {
1208
- const urlTree = router.createUrlTree(['.'], { relativeTo: activatedRoute });
1209
- return router.serializeUrl(urlTree);
1210
- };
1211
- const isTabSwitch = (enteringView, leavingView) => {
1212
- if (!leavingView) {
1213
- return true;
1214
- }
1215
- return enteringView.stackId !== leavingView.stackId;
1216
- };
1217
- const computeStackId = (prefixUrl, url) => {
1218
- if (!prefixUrl) {
1219
- return undefined;
1220
- }
1221
- const segments = toSegments(url);
1222
- for (let i = 0; i < segments.length; i++) {
1223
- if (i >= prefixUrl.length) {
1224
- return segments[i];
1225
- }
1226
- if (segments[i] !== prefixUrl[i]) {
1227
- return undefined;
1228
- }
1229
- }
1230
- return undefined;
1231
- };
1232
- const toSegments = (path) => {
1233
- return path
1234
- .split('/')
1235
- .map((s) => s.trim())
1236
- .filter((s) => s !== '');
1237
- };
1238
- const destroyView = (view) => {
1239
- if (view) {
1240
- view.ref.destroy();
1241
- view.unlistenEvents();
1242
- }
1243
- };
1244
-
1245
- // TODO(FW-2827): types
1246
- class StackController {
1247
- containerEl;
1248
- router;
1249
- navCtrl;
1250
- zone;
1251
- location;
1252
- views = [];
1253
- runningTask;
1254
- skipTransition = false;
1255
- tabsPrefix;
1256
- activeView;
1257
- nextId = 0;
1258
- constructor(tabsPrefix, containerEl, router, navCtrl, zone, location) {
1259
- this.containerEl = containerEl;
1260
- this.router = router;
1261
- this.navCtrl = navCtrl;
1262
- this.zone = zone;
1263
- this.location = location;
1264
- this.tabsPrefix = tabsPrefix !== undefined ? toSegments(tabsPrefix) : undefined;
1265
- }
1266
- createView(ref, activatedRoute) {
1267
- const url = getUrl(this.router, activatedRoute);
1268
- const element = ref?.location?.nativeElement;
1269
- const unlistenEvents = bindLifecycleEvents(this.zone, ref.instance, element);
1270
- return {
1271
- id: this.nextId++,
1272
- stackId: computeStackId(this.tabsPrefix, url),
1273
- unlistenEvents,
1274
- element,
1275
- ref,
1276
- url,
1277
- };
1278
- }
1279
- getExistingView(activatedRoute) {
1280
- const activatedUrlKey = getUrl(this.router, activatedRoute);
1281
- const view = this.views.find((vw) => vw.url === activatedUrlKey);
1282
- if (view) {
1283
- view.ref.changeDetectorRef.reattach();
1284
- }
1285
- return view;
1286
- }
1287
- setActive(enteringView) {
1288
- const consumeResult = this.navCtrl.consumeTransition();
1289
- let { direction, animation, animationBuilder } = consumeResult;
1290
- const leavingView = this.activeView;
1291
- const tabSwitch = isTabSwitch(enteringView, leavingView);
1292
- if (tabSwitch) {
1293
- direction = 'back';
1294
- animation = undefined;
1295
- }
1296
- const viewsSnapshot = this.views.slice();
1297
- let currentNavigation;
1298
- const router = this.router;
1299
- // Angular >= 7.2.0
1300
- if (router.getCurrentNavigation) {
1301
- currentNavigation = router.getCurrentNavigation();
1302
- // Angular < 7.2.0
1303
- }
1304
- else if (router.navigations?.value) {
1305
- currentNavigation = router.navigations.value;
1306
- }
1307
- /**
1308
- * If the navigation action
1309
- * sets `replaceUrl: true`
1310
- * then we need to make sure
1311
- * we remove the last item
1312
- * from our views stack
1313
- */
1314
- if (currentNavigation?.extras?.replaceUrl) {
1315
- if (this.views.length > 0) {
1316
- this.views.splice(-1, 1);
1317
- }
1318
- }
1319
- const reused = this.views.includes(enteringView);
1320
- const views = this.insertView(enteringView, direction);
1321
- // Trigger change detection before transition starts
1322
- // This will call ngOnInit() the first time too, just after the view
1323
- // was attached to the dom, but BEFORE the transition starts
1324
- if (!reused) {
1325
- enteringView.ref.changeDetectorRef.detectChanges();
1326
- }
1327
- /**
1328
- * If we are going back from a page that
1329
- * was presented using a custom animation
1330
- * we should default to using that
1331
- * unless the developer explicitly
1332
- * provided another animation.
1333
- */
1334
- const customAnimation = enteringView.animationBuilder;
1335
- if (animationBuilder === undefined && direction === 'back' && !tabSwitch && customAnimation !== undefined) {
1336
- animationBuilder = customAnimation;
1337
- }
1338
- /**
1339
- * Save any custom animation so that navigating
1340
- * back will use this custom animation by default.
1341
- */
1342
- if (leavingView) {
1343
- leavingView.animationBuilder = animationBuilder;
1344
- }
1345
- // Wait until previous transitions finish
1346
- return this.zone.runOutsideAngular(() => {
1347
- return this.wait(() => {
1348
- // disconnect leaving page from change detection to
1349
- // reduce jank during the page transition
1350
- if (leavingView) {
1351
- leavingView.ref.changeDetectorRef.detach();
1352
- }
1353
- // In case the enteringView is the same as the leavingPage we need to reattach()
1354
- enteringView.ref.changeDetectorRef.reattach();
1355
- return this.transition(enteringView, leavingView, animation, this.canGoBack(1), false, animationBuilder)
1356
- .then(() => cleanupAsync(enteringView, views, viewsSnapshot, this.location, this.zone))
1357
- .then(() => ({
1358
- enteringView,
1359
- direction,
1360
- animation,
1361
- tabSwitch,
1362
- }));
1363
- });
1364
- });
1365
- }
1366
- canGoBack(deep, stackId = this.getActiveStackId()) {
1367
- return this.getStack(stackId).length > deep;
1368
- }
1369
- pop(deep, stackId = this.getActiveStackId()) {
1370
- return this.zone.run(() => {
1371
- const views = this.getStack(stackId);
1372
- if (views.length <= deep) {
1373
- return Promise.resolve(false);
1374
- }
1375
- const view = views[views.length - deep - 1];
1376
- let url = view.url;
1377
- const viewSavedData = view.savedData;
1378
- if (viewSavedData) {
1379
- const primaryOutlet = viewSavedData.get('primary');
1380
- if (primaryOutlet?.route?._routerState?.snapshot.url) {
1381
- url = primaryOutlet.route._routerState.snapshot.url;
1382
- }
1383
- }
1384
- const { animationBuilder } = this.navCtrl.consumeTransition();
1385
- return this.navCtrl.navigateBack(url, { ...view.savedExtras, animation: animationBuilder }).then(() => true);
1386
- });
1387
- }
1388
- startBackTransition() {
1389
- const leavingView = this.activeView;
1390
- if (leavingView) {
1391
- const views = this.getStack(leavingView.stackId);
1392
- const enteringView = views[views.length - 2];
1393
- const customAnimation = enteringView.animationBuilder;
1394
- return this.wait(() => {
1395
- return this.transition(enteringView, // entering view
1396
- leavingView, // leaving view
1397
- 'back', this.canGoBack(2), true, customAnimation);
1398
- });
1399
- }
1400
- return Promise.resolve();
1401
- }
1402
- endBackTransition(shouldComplete) {
1403
- if (shouldComplete) {
1404
- this.skipTransition = true;
1405
- this.pop(1);
1406
- }
1407
- else if (this.activeView) {
1408
- cleanup(this.activeView, this.views, this.views, this.location, this.zone);
1409
- }
1410
- }
1411
- getLastUrl(stackId) {
1412
- const views = this.getStack(stackId);
1413
- return views.length > 0 ? views[views.length - 1] : undefined;
1414
- }
1415
- /**
1416
- * @internal
1417
- */
1418
- getRootUrl(stackId) {
1419
- const views = this.getStack(stackId);
1420
- return views.length > 0 ? views[0] : undefined;
1421
- }
1422
- getActiveStackId() {
1423
- return this.activeView ? this.activeView.stackId : undefined;
1424
- }
1425
- /**
1426
- * @internal
1427
- */
1428
- getActiveView() {
1429
- return this.activeView;
1430
- }
1431
- hasRunningTask() {
1432
- return this.runningTask !== undefined;
1433
- }
1434
- destroy() {
1435
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1436
- this.containerEl = undefined;
1437
- this.views.forEach(destroyView);
1438
- this.activeView = undefined;
1439
- this.views = [];
1440
- }
1441
- getStack(stackId) {
1442
- return this.views.filter((v) => v.stackId === stackId);
1443
- }
1444
- insertView(enteringView, direction) {
1445
- this.activeView = enteringView;
1446
- this.views = insertView(this.views, enteringView, direction);
1447
- return this.views.slice();
1448
- }
1449
- transition(enteringView, leavingView, direction, showGoBack, progressAnimation, animationBuilder) {
1450
- if (this.skipTransition) {
1451
- this.skipTransition = false;
1452
- return Promise.resolve(false);
1453
- }
1454
- if (leavingView === enteringView) {
1455
- return Promise.resolve(false);
1456
- }
1457
- const enteringEl = enteringView ? enteringView.element : undefined;
1458
- const leavingEl = leavingView ? leavingView.element : undefined;
1459
- const containerEl = this.containerEl;
1460
- if (enteringEl && enteringEl !== leavingEl) {
1461
- enteringEl.classList.add('ion-page');
1462
- enteringEl.classList.add('ion-page-invisible');
1463
- // containerEl is set to undefined when the stack controller is destroyed,
1464
- // so a transition that resolves after its outlet was destroyed must not
1465
- // dereference it (see destroy()).
1466
- if (containerEl?.commit) {
1467
- return containerEl.commit(enteringEl, leavingEl, {
1468
- duration: direction === undefined ? 0 : undefined,
1469
- direction,
1470
- showGoBack,
1471
- progressAnimation,
1472
- animationBuilder,
1473
- });
1474
- }
1475
- }
1476
- return Promise.resolve(false);
1477
- }
1478
- async wait(task) {
1479
- if (this.runningTask !== undefined) {
1480
- await this.runningTask;
1481
- this.runningTask = undefined;
1482
- }
1483
- const promise = (this.runningTask = task());
1484
- promise.finally(() => (this.runningTask = undefined));
1485
- return promise;
1486
- }
1487
- }
1488
- const cleanupAsync = (activeRoute, views, viewsSnapshot, location, zone) => {
1489
- if (typeof requestAnimationFrame === 'function') {
1490
- return new Promise((resolve) => {
1491
- requestAnimationFrame(() => {
1492
- cleanup(activeRoute, views, viewsSnapshot, location, zone);
1493
- resolve();
1494
- });
1495
- });
1496
- }
1497
- return Promise.resolve();
1498
- };
1499
- const cleanup = (activeRoute, views, viewsSnapshot, location, zone) => {
1500
- /**
1501
- * Re-enter the Angular zone when destroying page components. This will allow
1502
- * lifecycle events (`ngOnDestroy`) to be run inside the Angular zone.
1503
- */
1504
- zone.run(() => viewsSnapshot.filter((view) => !views.includes(view)).forEach(destroyView));
1505
- views.forEach((view) => {
1506
- /**
1507
- * In the event that a user navigated multiple
1508
- * times in rapid succession, we want to make sure
1509
- * we don't pre-emptively detach a view while
1510
- * it is in mid-transition.
1511
- *
1512
- * In this instance we also do not care about query
1513
- * params or fragments as it will be the same view regardless
1514
- */
1515
- const locationWithoutParams = location.path().split('?')[0];
1516
- const locationWithoutFragment = locationWithoutParams.split('#')[0];
1517
- if (view !== activeRoute && view.url !== locationWithoutFragment) {
1518
- const element = view.element;
1519
- element.setAttribute('aria-hidden', 'true');
1520
- element.classList.add('ion-page-hidden');
1521
- view.ref.changeDetectorRef.detach();
1522
- }
1523
- });
1524
- };
1525
-
1526
- // TODO(FW-2827): types
1527
- class IonRouterOutlet {
1528
- parentOutlet;
1529
- nativeEl;
1530
- activatedView = null;
1531
- tabsPrefix;
1532
- _swipeGesture;
1533
- stackCtrl;
1534
- // Maintain map of activated route proxies for each component instance
1535
- proxyMap = new WeakMap();
1536
- // Keep the latest activated route in a subject for the proxy routes to switch map to
1537
- currentActivatedRoute$ = new BehaviorSubject(null);
1538
- activated = null;
1539
- /** @internal */
1540
- get activatedComponentRef() {
1541
- return this.activated;
1542
- }
1543
- _activatedRoute = null;
1544
- /**
1545
- * The name of the outlet
1546
- */
1547
- name = PRIMARY_OUTLET;
1548
- /** @internal */
1549
- stackWillChange = new EventEmitter();
1550
- /** @internal */
1551
- stackDidChange = new EventEmitter();
1552
- // eslint-disable-next-line @angular-eslint/no-output-rename
1553
- activateEvents = new EventEmitter();
1554
- // eslint-disable-next-line @angular-eslint/no-output-rename
1555
- deactivateEvents = new EventEmitter();
1556
- parentContexts = inject(ChildrenOutletContexts);
1557
- location = inject(ViewContainerRef);
1558
- environmentInjector = inject(EnvironmentInjector);
1559
- inputBinder = inject(INPUT_BINDER, { optional: true });
1560
- /** @nodoc */
1561
- supportsBindingToComponentInputs = true;
1562
- // Ionic providers
1563
- config = inject(Config);
1564
- navCtrl = inject(NavController);
1565
- set animation(animation) {
1566
- this.nativeEl.animation = animation;
1567
- }
1568
- set animated(animated) {
1569
- this.nativeEl.animated = animated;
1570
- }
1571
- set swipeGesture(swipe) {
1572
- this._swipeGesture = swipe;
1573
- this.nativeEl.swipeHandler = swipe
1574
- ? {
1575
- canStart: () => this.stackCtrl.canGoBack(1) && !this.stackCtrl.hasRunningTask(),
1576
- onStart: () => this.stackCtrl.startBackTransition(),
1577
- onEnd: (shouldContinue) => this.stackCtrl.endBackTransition(shouldContinue),
1578
- }
1579
- : undefined;
1580
- }
1581
- constructor(name, tabs, commonLocation, elementRef, router, zone, activatedRoute, parentOutlet) {
1582
- this.parentOutlet = parentOutlet;
1583
- this.nativeEl = elementRef.nativeElement;
1584
- this.name = name || PRIMARY_OUTLET;
1585
- this.tabsPrefix = tabs === 'true' ? getUrl(router, activatedRoute) : undefined;
1586
- this.stackCtrl = new StackController(this.tabsPrefix, this.nativeEl, router, this.navCtrl, zone, commonLocation);
1587
- this.parentContexts.onChildOutletCreated(this.name, this);
1588
- }
1589
- ngOnDestroy() {
1590
- this.stackCtrl.destroy();
1591
- this.inputBinder?.unsubscribeFromRouteData(this);
1592
- }
1593
- getContext() {
1594
- return this.parentContexts.getContext(this.name);
1595
- }
1596
- ngOnInit() {
1597
- this.initializeOutletWithName();
1598
- }
1599
- // Note: Ionic deviates from the Angular Router implementation here
1600
- initializeOutletWithName() {
1601
- if (!this.activated) {
1602
- // If the outlet was not instantiated at the time the route got activated we need to populate
1603
- // the outlet when it is initialized (ie inside a NgIf)
1604
- const context = this.getContext();
1605
- if (context?.route) {
1606
- this.activateWith(context.route, context.injector);
1607
- }
1608
- }
1609
- new Promise((resolve) => componentOnReady(this.nativeEl, resolve)).then(() => {
1610
- if (this._swipeGesture === undefined) {
1611
- this.swipeGesture = this.config.getBoolean('swipeBackEnabled', this.nativeEl.mode === 'ios');
1612
- }
1613
- });
1614
- }
1615
- get isActivated() {
1616
- return !!this.activated;
1617
- }
1618
- get component() {
1619
- if (!this.activated) {
1620
- throw new Error('Outlet is not activated');
1621
- }
1622
- return this.activated.instance;
1623
- }
1624
- get activatedRoute() {
1625
- if (!this.activated) {
1626
- throw new Error('Outlet is not activated');
1627
- }
1628
- return this._activatedRoute;
1629
- }
1630
- get activatedRouteData() {
1631
- if (this._activatedRoute) {
1632
- return this._activatedRoute.snapshot.data;
1633
- }
1634
- return {};
1635
- }
1636
- /**
1637
- * Called when the `RouteReuseStrategy` instructs to detach the subtree
1638
- */
1639
- detach() {
1640
- throw new Error('incompatible reuse strategy');
1641
- }
1642
- /**
1643
- * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
1644
- */
1645
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1646
- attach(_ref, _activatedRoute) {
1647
- throw new Error('incompatible reuse strategy');
1648
- }
1649
- deactivate() {
1650
- if (this.activated) {
1651
- if (this.activatedView) {
1652
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1653
- const context = this.getContext();
1654
- this.activatedView.savedData = new Map(context.children['contexts']);
1655
- /**
1656
- * Angular v11.2.10 introduced a change
1657
- * where this route context is cleared out when
1658
- * a router-outlet is deactivated, However,
1659
- * we need this route information in order to
1660
- * return a user back to the correct tab when
1661
- * leaving and then going back to the tab context.
1662
- */
1663
- const primaryOutlet = this.activatedView.savedData.get('primary');
1664
- if (primaryOutlet && context.route) {
1665
- primaryOutlet.route = { ...context.route };
1666
- }
1667
- /**
1668
- * Ensure we are saving the NavigationExtras
1669
- * data otherwise it will be lost
1670
- */
1671
- this.activatedView.savedExtras = {};
1672
- if (context.route) {
1673
- const contextSnapshot = context.route.snapshot;
1674
- this.activatedView.savedExtras.queryParams = contextSnapshot.queryParams;
1675
- this.activatedView.savedExtras.fragment = contextSnapshot.fragment;
1676
- }
1677
- }
1678
- const c = this.component;
1679
- this.activatedView = null;
1680
- this.activated = null;
1681
- this._activatedRoute = null;
1682
- this.deactivateEvents.emit(c);
1683
- }
1684
- }
1685
- activateWith(activatedRoute, environmentInjector) {
1686
- if (this.isActivated) {
1687
- throw new Error('Cannot activate an already activated outlet');
1688
- }
1689
- this._activatedRoute = activatedRoute;
1690
- let cmpRef;
1691
- let enteringView = this.stackCtrl.getExistingView(activatedRoute);
1692
- if (enteringView) {
1693
- cmpRef = this.activated = enteringView.ref;
1694
- const saved = enteringView.savedData;
1695
- if (saved) {
1696
- // self-restore
1697
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1698
- const context = this.getContext();
1699
- context.children['contexts'] = saved;
1700
- }
1701
- // Updated activated route proxy for this component
1702
- this.updateActivatedRouteProxy(cmpRef.instance, activatedRoute);
1703
- }
1704
- else {
1705
- const snapshot = activatedRoute._futureSnapshot;
1706
- /**
1707
- * Angular 14 introduces a new `loadComponent` property to the route config.
1708
- * This function will assign a `component` property to the route snapshot.
1709
- * We check for the presence of this property to determine if the route is
1710
- * using standalone components.
1711
- */
1712
- const childContexts = this.parentContexts.getOrCreateContext(this.name).children;
1713
- // We create an activated route proxy object that will maintain future updates for this component
1714
- // over its lifecycle in the stack.
1715
- const component$ = new BehaviorSubject(null);
1716
- const activatedRouteProxy = this.createActivatedRouteProxy(component$, activatedRoute);
1717
- const injector = new OutletInjector(activatedRouteProxy, childContexts, this.location.injector);
1718
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1719
- const component = snapshot.routeConfig.component ?? snapshot.component;
1720
- /**
1721
- * View components need to be added as a child of ion-router-outlet
1722
- * for page transitions and swipe to go back.
1723
- * However, createComponent mounts components as siblings of the
1724
- * ViewContainerRef. As a result, outletContent must reference
1725
- * an ng-container inside of ion-router-outlet and not
1726
- * ion-router-outlet itself.
1727
- */
1728
- cmpRef = this.activated = this.outletContent.createComponent(component, {
1729
- index: this.outletContent.length,
1730
- injector,
1731
- environmentInjector: environmentInjector ?? this.environmentInjector,
1732
- });
1733
- // Once the component is created we can push it to our local subject supplied to the proxy
1734
- component$.next(cmpRef.instance);
1735
- // Calling `markForCheck` to make sure we will run the change detection when the
1736
- // `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.
1737
- /**
1738
- * At this point this.activated has been set earlier
1739
- * in this function, so it is guaranteed to be non-null.
1740
- */
1741
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1742
- enteringView = this.stackCtrl.createView(this.activated, activatedRoute);
1743
- // Store references to the proxy by component
1744
- this.proxyMap.set(cmpRef.instance, activatedRouteProxy);
1745
- this.currentActivatedRoute$.next({ component: cmpRef.instance, activatedRoute });
1746
- }
1747
- this.inputBinder?.bindActivatedRouteToOutletComponent(this);
1748
- this.activatedView = enteringView;
1749
- /**
1750
- * The top outlet is set prior to the entering view's transition completing,
1751
- * so that when we have nested outlets (e.g. ion-tabs inside an ion-router-outlet),
1752
- * the tabs outlet will be assigned as the top outlet when a view inside tabs is
1753
- * activated.
1754
- *
1755
- * In this scenario, activeWith is called for both the tabs and the root router outlet.
1756
- * To avoid a race condition, we assign the top outlet synchronously.
1757
- */
1758
- this.navCtrl.setTopOutlet(this);
1759
- const leavingView = this.stackCtrl.getActiveView();
1760
- this.stackWillChange.emit({
1761
- enteringView,
1762
- tabSwitch: isTabSwitch(enteringView, leavingView),
1763
- });
1764
- this.stackCtrl.setActive(enteringView).then((data) => {
1765
- this.activateEvents.emit(cmpRef.instance);
1766
- this.stackDidChange.emit(data);
1767
- });
1768
- }
1769
- /**
1770
- * Returns `true` if there are pages in the stack to go back.
1771
- */
1772
- canGoBack(deep = 1, stackId) {
1773
- return this.stackCtrl.canGoBack(deep, stackId);
1774
- }
1775
- /**
1776
- * Resolves to `true` if it the outlet was able to sucessfully pop the last N pages.
1777
- */
1778
- pop(deep = 1, stackId) {
1779
- return this.stackCtrl.pop(deep, stackId);
1780
- }
1781
- /**
1782
- * Returns the URL of the active page of each stack.
1783
- */
1784
- getLastUrl(stackId) {
1785
- const active = this.stackCtrl.getLastUrl(stackId);
1786
- return active ? active.url : undefined;
1787
- }
1788
- /**
1789
- * Returns the RouteView of the active page of each stack.
1790
- * @internal
1791
- */
1792
- getLastRouteView(stackId) {
1793
- return this.stackCtrl.getLastUrl(stackId);
1794
- }
1795
- /**
1796
- * Returns the root view in the tab stack.
1797
- * @internal
1798
- */
1799
- getRootView(stackId) {
1800
- return this.stackCtrl.getRootUrl(stackId);
1801
- }
1802
- /**
1803
- * Returns the active stack ID. In the context of ion-tabs, it means the active tab.
1804
- */
1805
- getActiveStackId() {
1806
- return this.stackCtrl.getActiveStackId();
1807
- }
1808
- /**
1809
- * Since the activated route can change over the life time of a component in an ion router outlet, we create
1810
- * a proxy so that we can update the values over time as a user navigates back to components already in the stack.
1811
- */
1812
- createActivatedRouteProxy(component$, activatedRoute) {
1813
- const proxy = new ActivatedRoute();
1814
- proxy._futureSnapshot = activatedRoute._futureSnapshot;
1815
- proxy._routerState = activatedRoute._routerState;
1816
- proxy.snapshot = activatedRoute.snapshot;
1817
- proxy.outlet = activatedRoute.outlet;
1818
- proxy.component = activatedRoute.component;
1819
- // Setup wrappers for the observables so consumers don't have to worry about switching to new observables as the state updates
1820
- proxy._paramMap = this.proxyObservable(component$, 'paramMap');
1821
- proxy._queryParamMap = this.proxyObservable(component$, 'queryParamMap');
1822
- proxy.url = this.proxyObservable(component$, 'url');
1823
- proxy.params = this.proxyObservable(component$, 'params');
1824
- proxy.queryParams = this.proxyObservable(component$, 'queryParams');
1825
- proxy.fragment = this.proxyObservable(component$, 'fragment');
1826
- proxy.data = this.proxyObservable(component$, 'data');
1827
- return proxy;
1828
- }
1829
- /**
1830
- * Create a wrapped observable that will switch to the latest activated route matched by the given component
1831
- */
1832
- proxyObservable(component$, path) {
1833
- return component$.pipe(
1834
- // First wait until the component instance is pushed
1835
- filter((component) => !!component), switchMap((component) => this.currentActivatedRoute$.pipe(filter((current) => current !== null && current.component === component), switchMap((current) => current && current.activatedRoute[path]), distinctUntilChanged())));
1836
- }
1837
- /**
1838
- * Updates the activated route proxy for the given component to the new incoming router state
1839
- */
1840
- updateActivatedRouteProxy(component, activatedRoute) {
1841
- const proxy = this.proxyMap.get(component);
1842
- if (!proxy) {
1843
- throw new Error(`Could not find activated route proxy for view`);
1844
- }
1845
- proxy._futureSnapshot = activatedRoute._futureSnapshot;
1846
- proxy._routerState = activatedRoute._routerState;
1847
- proxy.snapshot = activatedRoute.snapshot;
1848
- proxy.outlet = activatedRoute.outlet;
1849
- proxy.component = activatedRoute.component;
1850
- this.currentActivatedRoute$.next({ component, activatedRoute });
1851
- }
1852
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonRouterOutlet, deps: [{ token: 'name', attribute: true }, { token: 'tabs', attribute: true, optional: true }, { token: i1.Location }, { token: i0.ElementRef }, { token: i3.Router }, { token: i0.NgZone }, { token: i3.ActivatedRoute }, { token: IonRouterOutlet, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.Directive });
1853
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: IonRouterOutlet, selector: "ion-router-outlet", inputs: { animated: "animated", animation: "animation", mode: "mode", swipeGesture: "swipeGesture", name: "name" }, outputs: { stackWillChange: "stackWillChange", stackDidChange: "stackDidChange", activateEvents: "activate", deactivateEvents: "deactivate" }, exportAs: ["outlet"], ngImport: i0 });
1854
- }
1855
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonRouterOutlet, decorators: [{
1856
- type: Directive,
1857
- args: [{
1858
- selector: 'ion-router-outlet',
1859
- exportAs: 'outlet',
1860
- // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
1861
- inputs: ['animated', 'animation', 'mode', 'swipeGesture'],
1862
- }]
1863
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1864
- type: Attribute,
1865
- args: ['name']
1866
- }] }, { type: undefined, decorators: [{
1867
- type: Optional
1868
- }, {
1869
- type: Attribute,
1870
- args: ['tabs']
1871
- }] }, { type: i1.Location }, { type: i0.ElementRef }, { type: i3.Router }, { type: i0.NgZone }, { type: i3.ActivatedRoute }, { type: IonRouterOutlet, decorators: [{
1872
- type: SkipSelf
1873
- }, {
1874
- type: Optional
1875
- }] }]; }, propDecorators: { name: [{
1876
- type: Input
1877
- }], stackWillChange: [{
1878
- type: Output
1879
- }], stackDidChange: [{
1880
- type: Output
1881
- }], activateEvents: [{
1882
- type: Output,
1883
- args: ['activate']
1884
- }], deactivateEvents: [{
1885
- type: Output,
1886
- args: ['deactivate']
1887
- }] } });
1888
- class OutletInjector {
1889
- route;
1890
- childContexts;
1891
- parent;
1892
- constructor(route, childContexts, parent) {
1893
- this.route = route;
1894
- this.childContexts = childContexts;
1895
- this.parent = parent;
1896
- }
1897
- get(token, notFoundValue) {
1898
- if (token === ActivatedRoute) {
1899
- return this.route;
1900
- }
1901
- if (token === ChildrenOutletContexts) {
1902
- return this.childContexts;
1903
- }
1904
- return this.parent.get(token, notFoundValue);
1905
- }
1906
- }
1907
- // TODO: FW-4785 - Remove this once Angular 15 support is dropped
1908
- const INPUT_BINDER = new InjectionToken('');
1909
- /**
1910
- * Injectable used as a tree-shakable provider for opting in to binding router data to component
1911
- * inputs.
1912
- *
1913
- * The RouterOutlet registers itself with this service when an `ActivatedRoute` is attached or
1914
- * activated. When this happens, the service subscribes to the `ActivatedRoute` observables (params,
1915
- * queryParams, data) and sets the inputs of the component using `ComponentRef.setInput`.
1916
- * Importantly, when an input does not have an item in the route data with a matching key, this
1917
- * input is set to `undefined`. If it were not done this way, the previous information would be
1918
- * retained if the data got removed from the route (i.e. if a query parameter is removed).
1919
- *
1920
- * The `RouterOutlet` should unregister itself when destroyed via `unsubscribeFromRouteData` so that
1921
- * the subscriptions are cleaned up.
1922
- */
1923
- class RoutedComponentInputBinder {
1924
- outletDataSubscriptions = new Map();
1925
- bindActivatedRouteToOutletComponent(outlet) {
1926
- this.unsubscribeFromRouteData(outlet);
1927
- this.subscribeToRouteData(outlet);
1928
- }
1929
- unsubscribeFromRouteData(outlet) {
1930
- this.outletDataSubscriptions.get(outlet)?.unsubscribe();
1931
- this.outletDataSubscriptions.delete(outlet);
1932
- }
1933
- subscribeToRouteData(outlet) {
1934
- const { activatedRoute } = outlet;
1935
- const dataSubscription = combineLatest([activatedRoute.queryParams, activatedRoute.params, activatedRoute.data])
1936
- .pipe(switchMap(([queryParams, params, data], index) => {
1937
- data = { ...queryParams, ...params, ...data };
1938
- // Get the first result from the data subscription synchronously so it's available to
1939
- // the component as soon as possible (and doesn't require a second change detection).
1940
- if (index === 0) {
1941
- return of(data);
1942
- }
1943
- // Promise.resolve is used to avoid synchronously writing the wrong data when
1944
- // two of the Observables in the `combineLatest` stream emit one after
1945
- // another.
1946
- return Promise.resolve(data);
1947
- }))
1948
- .subscribe((data) => {
1949
- // Outlet may have been deactivated or changed names to be associated with a different
1950
- // route
1951
- if (!outlet.isActivated ||
1952
- !outlet.activatedComponentRef ||
1953
- outlet.activatedRoute !== activatedRoute ||
1954
- activatedRoute.component === null) {
1955
- this.unsubscribeFromRouteData(outlet);
1956
- return;
1957
- }
1958
- const mirror = reflectComponentType(activatedRoute.component);
1959
- if (!mirror) {
1960
- this.unsubscribeFromRouteData(outlet);
1961
- return;
1962
- }
1963
- for (const { templateName } of mirror.inputs) {
1964
- outlet.activatedComponentRef.setInput(templateName, data[templateName]);
1965
- }
1966
- });
1967
- this.outletDataSubscriptions.set(outlet, dataSubscription);
1968
- }
1969
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RoutedComponentInputBinder, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1970
- /** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RoutedComponentInputBinder });
1971
- }
1972
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RoutedComponentInputBinder, decorators: [{
1973
- type: Injectable
1974
- }] });
1975
- const provideComponentInputBinding = () => {
1976
- return {
1977
- provide: INPUT_BINDER,
1978
- useFactory: componentInputBindingFactory,
1979
- deps: [Router],
1980
- };
1981
- };
1982
- function componentInputBindingFactory(router) {
1983
- /**
1984
- * We cast the router to any here, since the componentInputBindingEnabled
1985
- * property is not available until Angular v16.
1986
- */
1987
- if (router?.componentInputBindingEnabled) {
1988
- return new RoutedComponentInputBinder();
1989
- }
1990
- return null;
1991
- }
1992
-
1993
- const raf = (h) => {
1994
- if (typeof __zone_symbol__requestAnimationFrame === 'function') {
1995
- return __zone_symbol__requestAnimationFrame(h);
1996
- }
1997
- if (typeof requestAnimationFrame === 'function') {
1998
- return requestAnimationFrame(h);
1999
- }
2000
- return setTimeout(h);
2001
- };
2002
-
2003
- // TODO(FW-2827): types
2004
- class ValueAccessor {
2005
- injector;
2006
- elementRef;
2007
- onChange = () => {
2008
- /**/
2009
- };
2010
- onTouched = () => {
2011
- /**/
2012
- };
2013
- lastValue;
2014
- statusChanges;
2015
- constructor(injector, elementRef) {
2016
- this.injector = injector;
2017
- this.elementRef = elementRef;
2018
- }
2019
- writeValue(value) {
2020
- this.elementRef.nativeElement.value = this.lastValue = value;
2021
- setIonicClasses(this.elementRef);
2022
- }
2023
- /**
2024
- * Notifies the ControlValueAccessor of a change in the value of the control.
2025
- *
2026
- * This is called by each of the ValueAccessor directives when we want to update
2027
- * the status and validity of the form control. For example with text components this
2028
- * is called when the ionInput event is fired. For select components this is called
2029
- * when the ionChange event is fired.
2030
- *
2031
- * This also updates the Ionic form status classes on the element.
2032
- *
2033
- * @param el The component element.
2034
- * @param value The new value of the control.
2035
- */
2036
- handleValueChange(el, value) {
2037
- if (el === this.elementRef.nativeElement) {
2038
- if (value !== this.lastValue) {
2039
- this.lastValue = value;
2040
- this.onChange(value);
2041
- }
2042
- setIonicClasses(this.elementRef);
2043
- }
2044
- }
2045
- _handleBlurEvent(el) {
2046
- if (el === this.elementRef.nativeElement) {
2047
- this.onTouched();
2048
- setIonicClasses(this.elementRef);
2049
- // When ion-radio is blurred, el and this.elementRef.nativeElement are
2050
- // different so we need to check if the closest ion-radio-group is the same
2051
- // as this.elementRef.nativeElement and if so, we need to mark the radio group
2052
- // as touched
2053
- }
2054
- else if (el.closest('ion-radio-group') === this.elementRef.nativeElement) {
2055
- this.onTouched();
2056
- }
2057
- }
2058
- registerOnChange(fn) {
2059
- this.onChange = fn;
2060
- }
2061
- registerOnTouched(fn) {
2062
- this.onTouched = fn;
2063
- }
2064
- setDisabledState(isDisabled) {
2065
- this.elementRef.nativeElement.disabled = isDisabled;
2066
- }
2067
- ngOnDestroy() {
2068
- if (this.statusChanges) {
2069
- this.statusChanges.unsubscribe();
2070
- }
2071
- }
2072
- ngAfterViewInit() {
2073
- let ngControl;
2074
- try {
2075
- ngControl = this.injector.get(NgControl);
2076
- }
2077
- catch {
2078
- /* No FormControl or ngModel binding */
2079
- }
2080
- if (!ngControl) {
2081
- return;
2082
- }
2083
- // Listen for changes in validity, disabled, or pending states
2084
- if (ngControl.statusChanges) {
2085
- this.statusChanges = ngControl.statusChanges.subscribe(() => setIonicClasses(this.elementRef));
2086
- }
2087
- /**
2088
- * TODO FW-2787: Remove this in favor of https://github.com/angular/angular/issues/10887
2089
- * whenever it is implemented.
2090
- */
2091
- const formControl = ngControl.control;
2092
- if (formControl) {
2093
- const methodsToPatch = ['markAsTouched', 'markAllAsTouched', 'markAsUntouched', 'markAsDirty', 'markAsPristine'];
2094
- methodsToPatch.forEach((method) => {
2095
- if (typeof formControl[method] !== 'undefined') {
2096
- const oldFn = formControl[method].bind(formControl);
2097
- formControl[method] = (...params) => {
2098
- oldFn(...params);
2099
- setIonicClasses(this.elementRef);
2100
- };
2101
- }
2102
- });
2103
- }
2104
- }
2105
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ValueAccessor, deps: [{ token: i0.Injector }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
2106
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ValueAccessor, host: { listeners: { "ionBlur": "_handleBlurEvent($event.target)" } }, ngImport: i0 });
2107
- }
2108
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ValueAccessor, decorators: [{
2109
- type: Directive
2110
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.ElementRef }]; }, propDecorators: { _handleBlurEvent: [{
2111
- type: HostListener,
2112
- args: ['ionBlur', ['$event.target']]
2113
- }] } });
2114
- const setIonicClasses = (element) => {
2115
- raf(() => {
2116
- const input = element.nativeElement;
2117
- const hasValue = input.value != null && input.value.toString().length > 0;
2118
- const classes = getClasses(input);
2119
- setClasses(input, classes);
2120
- const item = input.closest('ion-item');
2121
- if (item) {
2122
- if (hasValue) {
2123
- setClasses(item, [...classes, 'item-has-value']);
2124
- }
2125
- else {
2126
- setClasses(item, classes);
2127
- }
2128
- }
2129
- });
2130
- };
2131
- const getClasses = (element) => {
2132
- const classList = element.classList;
2133
- const classes = [];
2134
- for (let i = 0; i < classList.length; i++) {
2135
- const item = classList.item(i);
2136
- if (item !== null && startsWith(item, 'ng-')) {
2137
- classes.push(`ion-${item.substring(3)}`);
2138
- }
2139
- }
2140
- return classes;
2141
- };
2142
- const setClasses = (element, classes) => {
2143
- const classList = element.classList;
2144
- classList.remove('ion-valid', 'ion-invalid', 'ion-touched', 'ion-untouched', 'ion-dirty', 'ion-pristine');
2145
- classList.add(...classes);
2146
- };
2147
- const startsWith = (input, search) => {
2148
- return input.substring(0, search.length) === search;
2149
- };
2150
-
2151
- const BACK_BUTTON_INPUTS = ['color', 'defaultHref', 'disabled', 'icon', 'mode', 'routerAnimation', 'text', 'type'];
2152
- let IonBackButton = class IonBackButton {
2153
- routerOutlet;
2154
- navCtrl;
2155
- config;
2156
- r;
2157
- z;
2158
- el;
2159
- constructor(routerOutlet, navCtrl, config, r, z, c) {
2160
- this.routerOutlet = routerOutlet;
2161
- this.navCtrl = navCtrl;
2162
- this.config = config;
2163
- this.r = r;
2164
- this.z = z;
2165
- c.detach();
2166
- this.el = this.r.nativeElement;
2167
- }
2168
- /**
2169
- * @internal
2170
- */
2171
- onClick(ev) {
2172
- const defaultHref = this.defaultHref || this.config.get('backButtonDefaultHref');
2173
- if (this.routerOutlet?.canGoBack()) {
2174
- this.navCtrl.setDirection('back', undefined, undefined, this.routerAnimation);
2175
- this.routerOutlet.pop();
2176
- ev.preventDefault();
2177
- }
2178
- else if (defaultHref != null) {
2179
- this.navCtrl.navigateBack(defaultHref, { animation: this.routerAnimation });
2180
- ev.preventDefault();
2181
- }
2182
- }
2183
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonBackButton, deps: [{ token: IonRouterOutlet, optional: true }, { token: NavController }, { token: Config }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
2184
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: IonBackButton, inputs: { color: "color", defaultHref: "defaultHref", disabled: "disabled", icon: "icon", mode: "mode", routerAnimation: "routerAnimation", text: "text", type: "type" }, host: { listeners: { "click": "onClick($event)" } }, ngImport: i0 });
2185
- };
2186
- IonBackButton = __decorate([
2187
- ProxyCmp({
2188
- inputs: BACK_BUTTON_INPUTS,
2189
- })
2190
- ], IonBackButton);
2191
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonBackButton, decorators: [{
2192
- type: Directive,
2193
- args: [{
2194
- // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
2195
- inputs: BACK_BUTTON_INPUTS,
2196
- }]
2197
- }], ctorParameters: function () { return [{ type: IonRouterOutlet, decorators: [{
2198
- type: Optional
2199
- }] }, { type: NavController }, { type: Config }, { type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { onClick: [{
2200
- type: HostListener,
2201
- args: ['click', ['$event']]
2202
- }] } });
2203
-
2204
- const NAV_INPUTS = ['animated', 'animation', 'root', 'rootParams', 'swipeGesture'];
2205
- const NAV_METHODS = [
2206
- 'push',
2207
- 'insert',
2208
- 'insertPages',
2209
- 'pop',
2210
- 'popTo',
2211
- 'popToRoot',
2212
- 'removeIndex',
2213
- 'setRoot',
2214
- 'setPages',
2215
- 'getActive',
2216
- 'getByIndex',
2217
- 'canGoBack',
2218
- 'getPrevious',
2219
- ];
2220
- let IonNav = class IonNav {
2221
- z;
2222
- el;
2223
- constructor(ref, environmentInjector, injector, angularDelegate, z, c) {
2224
- this.z = z;
2225
- c.detach();
2226
- this.el = ref.nativeElement;
2227
- ref.nativeElement.delegate = angularDelegate.create(environmentInjector, injector);
2228
- proxyOutputs(this, this.el, ['ionNavDidChange', 'ionNavWillChange']);
2229
- }
2230
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.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 });
2231
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: IonNav, inputs: { animated: "animated", animation: "animation", root: "root", rootParams: "rootParams", swipeGesture: "swipeGesture" }, ngImport: i0 });
2232
- };
2233
- IonNav = __decorate([
2234
- ProxyCmp({
2235
- inputs: NAV_INPUTS,
2236
- methods: NAV_METHODS,
2237
- })
2238
- ], IonNav);
2239
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonNav, decorators: [{
2240
- type: Directive,
2241
- args: [{
2242
- // eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
2243
- inputs: NAV_INPUTS,
2244
- }]
2245
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.EnvironmentInjector }, { type: i0.Injector }, { type: AngularDelegate }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }]; } });
2246
-
2247
- /**
2248
- * Adds support for Ionic routing directions and animations to the base Angular router link directive.
2249
- *
2250
- * When the router link is clicked, the directive will assign the direction and
2251
- * animation so that the routing integration will transition correctly.
2252
- */
2253
- class RouterLinkDelegateDirective {
2254
- locationStrategy;
2255
- navCtrl;
2256
- elementRef;
2257
- router;
2258
- routerLink;
2259
- routerDirection = 'forward';
2260
- routerAnimation;
2261
- constructor(locationStrategy, navCtrl, elementRef, router, routerLink) {
2262
- this.locationStrategy = locationStrategy;
2263
- this.navCtrl = navCtrl;
2264
- this.elementRef = elementRef;
2265
- this.router = router;
2266
- this.routerLink = routerLink;
2267
- }
2268
- ngOnInit() {
2269
- this.updateTargetUrlAndHref();
2270
- this.updateTabindex();
2271
- /**
2272
- * Ionic components like `ion-item` render a native anchor in their shadow DOM,
2273
- * so a modifier click (ctrl/meta/shift/alt) or a non-`_self` target should let
2274
- * the browser handle the navigation natively (new tab, new window, download)
2275
- * instead of navigating in-app.
2276
- *
2277
- * We listen in the capture phase so this runs before Angular's `RouterLink`
2278
- * handler and our own bubble-phase `onClick`. On a native-navigation intent it
2279
- * stops propagation to cancel the in-app navigation, but leaves `preventDefault`
2280
- * alone so the native anchor can still act.
2281
- */
2282
- this.elementRef.nativeElement.addEventListener('click', this.onCaptureClick, { capture: true });
2283
- }
2284
- ngOnChanges() {
2285
- this.updateTargetUrlAndHref();
2286
- }
2287
- ngOnDestroy() {
2288
- this.elementRef.nativeElement.removeEventListener('click', this.onCaptureClick, { capture: true });
2289
- }
2290
- onCaptureClick = (ev) => {
2291
- if (this.opensNatively(ev)) {
2292
- ev.stopImmediatePropagation();
2293
- }
2294
- };
2295
- /**
2296
- * True when the browser should handle the click natively instead of routing
2297
- * in-app: a modifier was held (ctrl/meta/shift/alt), or the host targets
2298
- * something other than `_self`. This mirrors the modifier set Angular's own
2299
- * `RouterLink` guards on, so an Ionic `routerLink` behaves like a plain anchor
2300
- * for new-tab, new-window, and download intents.
2301
- */
2302
- opensNatively(ev) {
2303
- if (ev instanceof MouseEvent && (ev.ctrlKey || ev.metaKey || ev.shiftKey || ev.altKey)) {
2304
- return true;
2305
- }
2306
- const target = this.elementRef.nativeElement.target;
2307
- return target != null && target !== '' && target !== '_self';
2308
- }
2309
- /**
2310
- * The `tabindex` is set to `0` by default on the host element when
2311
- * the `routerLink` directive is used. This causes issues with Ionic
2312
- * components that wrap an `a` or `button` element, such as `ion-item`.
2313
- * See issue https://github.com/angular/angular/issues/28345
2314
- *
2315
- * This method removes the `tabindex` attribute from the host element
2316
- * to allow the Ionic component to manage the focus state correctly.
2317
- */
2318
- updateTabindex() {
2319
- // Ionic components that render a native anchor or button element
2320
- const ionicComponents = [
2321
- 'ION-BACK-BUTTON',
2322
- 'ION-BREADCRUMB',
2323
- 'ION-BUTTON',
2324
- 'ION-CARD',
2325
- 'ION-FAB-BUTTON',
2326
- 'ION-ITEM',
2327
- 'ION-ITEM-OPTION',
2328
- 'ION-MENU-BUTTON',
2329
- 'ION-SEGMENT-BUTTON',
2330
- 'ION-TAB-BUTTON',
2331
- ];
2332
- const hostElement = this.elementRef.nativeElement;
2333
- if (ionicComponents.includes(hostElement.tagName)) {
2334
- if (hostElement.getAttribute('tabindex') === '0') {
2335
- hostElement.removeAttribute('tabindex');
2336
- }
2337
- }
2338
- }
2339
- updateTargetUrlAndHref() {
2340
- if (this.routerLink?.urlTree) {
2341
- const href = this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.routerLink.urlTree));
2342
- this.elementRef.nativeElement.href = href;
2343
- }
2344
- }
2345
- /**
2346
- * @internal
2347
- */
2348
- onClick(ev) {
2349
- this.navCtrl.setDirection(this.routerDirection, undefined, undefined, this.routerAnimation);
2350
- /**
2351
- * This prevents the browser from
2352
- * performing a page reload when pressing
2353
- * an Ionic component with routerLink.
2354
- * The page reload interferes with routing
2355
- * and causes ion-back-button to disappear
2356
- * since the local history is wiped on reload.
2357
- */
2358
- ev.preventDefault();
2359
- }
2360
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RouterLinkDelegateDirective, deps: [{ token: i1.LocationStrategy }, { token: NavController }, { token: i0.ElementRef }, { token: i3.Router }, { token: i3.RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
2361
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: RouterLinkDelegateDirective, selector: ":not(a):not(area)[routerLink]", inputs: { routerDirection: "routerDirection", routerAnimation: "routerAnimation" }, host: { listeners: { "click": "onClick($event)" } }, usesOnChanges: true, ngImport: i0 });
2362
- }
2363
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RouterLinkDelegateDirective, decorators: [{
2364
- type: Directive,
2365
- args: [{
2366
- selector: ':not(a):not(area)[routerLink]',
2367
- }]
2368
- }], ctorParameters: function () { return [{ type: i1.LocationStrategy }, { type: NavController }, { type: i0.ElementRef }, { type: i3.Router }, { type: i3.RouterLink, decorators: [{
2369
- type: Optional
2370
- }] }]; }, propDecorators: { routerDirection: [{
2371
- type: Input
2372
- }], routerAnimation: [{
2373
- type: Input
2374
- }], onClick: [{
2375
- type: HostListener,
2376
- args: ['click', ['$event']]
2377
- }] } });
2378
- class RouterLinkWithHrefDelegateDirective {
2379
- locationStrategy;
2380
- navCtrl;
2381
- elementRef;
2382
- router;
2383
- routerLink;
2384
- routerDirection = 'forward';
2385
- routerAnimation;
2386
- constructor(locationStrategy, navCtrl, elementRef, router, routerLink) {
2387
- this.locationStrategy = locationStrategy;
2388
- this.navCtrl = navCtrl;
2389
- this.elementRef = elementRef;
2390
- this.router = router;
2391
- this.routerLink = routerLink;
2392
- }
2393
- ngOnInit() {
2394
- this.updateTargetUrlAndHref();
2395
- }
2396
- ngOnChanges() {
2397
- this.updateTargetUrlAndHref();
2398
- }
2399
- updateTargetUrlAndHref() {
2400
- if (this.routerLink?.urlTree) {
2401
- const href = this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.routerLink.urlTree));
2402
- this.elementRef.nativeElement.href = href;
2403
- }
2404
- }
2405
- /**
2406
- * @internal
2407
- */
2408
- onClick() {
2409
- this.navCtrl.setDirection(this.routerDirection, undefined, undefined, this.routerAnimation);
2410
- }
2411
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RouterLinkWithHrefDelegateDirective, deps: [{ token: i1.LocationStrategy }, { token: NavController }, { token: i0.ElementRef }, { token: i3.Router }, { token: i3.RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
2412
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: RouterLinkWithHrefDelegateDirective, selector: "a[routerLink],area[routerLink]", inputs: { routerDirection: "routerDirection", routerAnimation: "routerAnimation" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
2413
- }
2414
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RouterLinkWithHrefDelegateDirective, decorators: [{
2415
- type: Directive,
2416
- args: [{
2417
- selector: 'a[routerLink],area[routerLink]',
2418
- }]
2419
- }], ctorParameters: function () { return [{ type: i1.LocationStrategy }, { type: NavController }, { type: i0.ElementRef }, { type: i3.Router }, { type: i3.RouterLink, decorators: [{
2420
- type: Optional
2421
- }] }]; }, propDecorators: { routerDirection: [{
2422
- type: Input
2423
- }], routerAnimation: [{
2424
- type: Input
2425
- }], onClick: [{
2426
- type: HostListener,
2427
- args: ['click']
2428
- }] } });
2429
-
2430
- /**
2431
- * Extracts `queryParams` and `fragment` from a tab button's href for use
2432
- * as Angular `NavigationExtras`. Returns `undefined` when neither is present.
2433
- */
2434
- const parseHrefExtras = (href) => {
2435
- if (!href) {
2436
- return undefined;
2437
- }
2438
- const hashIndex = href.indexOf('#');
2439
- // Treat a bare `#` (no fragment text) as no fragment.
2440
- const fragment = hashIndex >= 0 && hashIndex < href.length - 1 ? href.slice(hashIndex + 1) : undefined;
2441
- const beforeHash = hashIndex >= 0 ? href.slice(0, hashIndex) : href;
2442
- const queryIndex = beforeHash.indexOf('?');
2443
- const search = queryIndex >= 0 ? beforeHash.slice(queryIndex + 1) : '';
2444
- let queryParams;
2445
- if (search) {
2446
- const params = new URLSearchParams(search);
2447
- queryParams = {};
2448
- for (const key of new Set(params.keys())) {
2449
- const all = params.getAll(key);
2450
- queryParams[key] = all.length > 1 ? all : all[0];
2451
- }
2452
- }
2453
- if (!queryParams && fragment === undefined) {
2454
- return undefined;
2455
- }
2456
- /**
2457
- * Build the result with only the populated keys so that a spread of the
2458
- * returned object does not overwrite saved `queryParams`/`fragment` with
2459
- * `undefined` (which `Object.assign`/spread would copy as a real key).
2460
- */
2461
- const extras = {};
2462
- if (queryParams)
2463
- extras.queryParams = queryParams;
2464
- if (fragment !== undefined)
2465
- extras.fragment = fragment;
2466
- return extras;
2467
- };
2468
- class IonTabs {
2469
- navCtrl;
2470
- tabsInner;
2471
- /**
2472
- * Emitted before the tab view is changed.
2473
- */
2474
- ionTabsWillChange = new EventEmitter();
2475
- /**
2476
- * Emitted after the tab view is changed.
2477
- */
2478
- ionTabsDidChange = new EventEmitter();
2479
- tabBarSlot = 'bottom';
2480
- hasTab = false;
2481
- selectedTab;
2482
- leavingTab;
2483
- constructor(navCtrl) {
2484
- this.navCtrl = navCtrl;
2485
- }
2486
- ngAfterViewInit() {
2487
- /**
2488
- * Developers must pass at least one ion-tab
2489
- * inside of ion-tabs if they want to use a
2490
- * basic tab-based navigation without the
2491
- * history stack or URL updates associated
2492
- * with the router.
2493
- */
2494
- const firstTab = this.tabs.length > 0 ? this.tabs.first : undefined;
2495
- if (firstTab) {
2496
- this.hasTab = true;
2497
- this.setActiveTab(firstTab.tab);
2498
- this.tabSwitch();
2499
- }
2500
- }
2501
- ngAfterContentInit() {
2502
- this.detectSlotChanges();
2503
- }
2504
- ngAfterContentChecked() {
2505
- this.detectSlotChanges();
2506
- }
2507
- /**
2508
- * @internal
2509
- */
2510
- onStackWillChange({ enteringView, tabSwitch }) {
2511
- const stackId = enteringView.stackId;
2512
- if (tabSwitch && stackId !== undefined) {
2513
- this.ionTabsWillChange.emit({ tab: stackId });
2514
- }
2515
- }
2516
- /**
2517
- * @internal
2518
- */
2519
- onStackDidChange({ enteringView, tabSwitch }) {
2520
- const stackId = enteringView.stackId;
2521
- if (tabSwitch && stackId !== undefined) {
2522
- if (this.tabBar) {
2523
- this.tabBar.selectedTab = stackId;
2524
- }
2525
- this.ionTabsDidChange.emit({ tab: stackId });
2526
- }
2527
- }
2528
- /**
2529
- * When a tab button is clicked, there are several scenarios:
2530
- * 1. If the selected tab is currently active (the tab button has been clicked
2531
- * again), then it should go to the root view for that tab.
2532
- *
2533
- * a. Get the saved root view from the router outlet. If the saved root view
2534
- * matches the tabRootUrl, set the route view to this view including the
2535
- * navigation extras. Any `queryParams` or `fragment` declared on the tab
2536
- * button's `href` are also forwarded.
2537
- * b. If the saved root view from the router outlet does not match, navigate
2538
- * to the tabRootUrl, forwarding any `queryParams`/`fragment` declared on
2539
- * the tab button's `href`.
2540
- *
2541
- * 2. If the current tab tab is not currently selected, get the last route
2542
- * view from the router outlet.
2543
- *
2544
- * a. If the last route view exists, navigate to that view including any
2545
- * navigation extras.
2546
- * b. If the last route view doesn't exist, then navigate to the default
2547
- * tabRootUrl, forwarding any `queryParams`/`fragment` declared on the
2548
- * tab button's `href`.
2549
- */
2550
- select(tabOrEvent) {
2551
- const isTabString = typeof tabOrEvent === 'string';
2552
- const tab = isTabString ? tabOrEvent : tabOrEvent.detail.tab;
2553
- const href = isTabString ? undefined : tabOrEvent.detail.href;
2554
- /**
2555
- * If the tabs are not using the router, then
2556
- * the tab switch logic is handled by the tabs
2557
- * component itself.
2558
- */
2559
- if (this.hasTab) {
2560
- this.setActiveTab(tab);
2561
- this.tabSwitch();
2562
- return;
2563
- }
2564
- const alreadySelected = this.outlet.getActiveStackId() === tab;
2565
- const tabRootUrl = `${this.outlet.tabsPrefix}/${tab}`;
2566
- /**
2567
- * The href pathname is ignored here; tab routing is driven by `tabsPrefix/tab`.
2568
- * Only the query and fragment are forwarded as navigation extras.
2569
- */
2570
- const hrefExtras = parseHrefExtras(href);
2571
- /**
2572
- * If this is a nested tab, prevent the event
2573
- * from bubbling otherwise the outer tabs
2574
- * will respond to this event too, causing
2575
- * the app to get directed to the wrong place.
2576
- */
2577
- if (!isTabString) {
2578
- tabOrEvent.stopPropagation();
2579
- }
2580
- if (alreadySelected) {
2581
- const activeStackId = this.outlet.getActiveStackId();
2582
- const activeView = this.outlet.getLastRouteView(activeStackId);
2583
- // If on root tab, do not navigate to root tab again
2584
- if (activeView?.url === tabRootUrl) {
2585
- return;
2586
- }
2587
- const rootView = this.outlet.getRootView(tab);
2588
- const navigationExtras = rootView && tabRootUrl === rootView.url && rootView.savedExtras;
2589
- return this.navCtrl.navigateRoot(tabRootUrl, {
2590
- ...navigationExtras,
2591
- ...hrefExtras,
2592
- animated: true,
2593
- animationDirection: 'back',
2594
- });
2595
- }
2596
- else {
2597
- const lastRoute = this.outlet.getLastRouteView(tab);
2598
- /**
2599
- * If there is a lastRoute, goto that, otherwise goto the fallback url of the
2600
- * selected tab. When falling back to the tab root, honor query params and
2601
- * fragment declared on the tab button's href.
2602
- */
2603
- const url = lastRoute?.url || tabRootUrl;
2604
- const navigationExtras = lastRoute?.savedExtras ?? (url === tabRootUrl ? hrefExtras : undefined);
2605
- return this.navCtrl.navigateRoot(url, {
2606
- ...navigationExtras,
2607
- animated: true,
2608
- animationDirection: 'back',
2609
- });
2610
- }
2611
- }
2612
- setActiveTab(tab) {
2613
- const tabs = this.tabs;
2614
- const selectedTab = tabs.find((t) => t.tab === tab);
2615
- if (!selectedTab) {
2616
- console.error(`[Ionic Error]: Tab with id: "${tab}" does not exist`);
2617
- return;
2618
- }
2619
- this.leavingTab = this.selectedTab;
2620
- this.selectedTab = selectedTab;
2621
- this.ionTabsWillChange.emit({ tab });
2622
- selectedTab.el.active = true;
2623
- }
2624
- tabSwitch() {
2625
- const { selectedTab, leavingTab } = this;
2626
- if (this.tabBar && selectedTab) {
2627
- this.tabBar.selectedTab = selectedTab.tab;
2628
- }
2629
- if (leavingTab?.tab !== selectedTab?.tab) {
2630
- if (leavingTab?.el) {
2631
- leavingTab.el.active = false;
2632
- }
2633
- }
2634
- if (selectedTab) {
2635
- this.ionTabsDidChange.emit({ tab: selectedTab.tab });
2636
- }
2637
- }
2638
- getSelected() {
2639
- if (this.hasTab) {
2640
- return this.selectedTab?.tab;
2641
- }
2642
- return this.outlet.getActiveStackId();
2643
- }
2644
- /**
2645
- * Detects changes to the slot attribute of the tab bar.
2646
- *
2647
- * If the slot attribute has changed, then the tab bar
2648
- * should be relocated to the new slot position.
2649
- */
2650
- detectSlotChanges() {
2651
- this.tabBars.forEach((tabBar) => {
2652
- // el is a protected attribute from the generated component wrapper
2653
- const currentSlot = tabBar.el.getAttribute('slot');
2654
- if (currentSlot !== this.tabBarSlot) {
2655
- this.tabBarSlot = currentSlot;
2656
- this.relocateTabBar();
2657
- }
2658
- });
2659
- }
2660
- /**
2661
- * Relocates the tab bar to the new slot position.
2662
- */
2663
- relocateTabBar() {
2664
- /**
2665
- * `el` is a protected attribute from the generated component wrapper.
2666
- * To avoid having to manually create the wrapper for tab bar, we
2667
- * cast the tab bar to any and access the protected attribute.
2668
- */
2669
- const tabBar = this.tabBar.el;
2670
- if (this.tabBarSlot === 'top') {
2671
- /**
2672
- * A tab bar with a slot of "top" should be inserted
2673
- * at the top of the container.
2674
- */
2675
- this.tabsInner.nativeElement.before(tabBar);
2676
- }
2677
- else {
2678
- /**
2679
- * A tab bar with a slot of "bottom" or without a slot
2680
- * should be inserted at the end of the container.
2681
- */
2682
- this.tabsInner.nativeElement.after(tabBar);
2683
- }
2684
- }
2685
- /** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonTabs, deps: [{ token: NavController }], target: i0.ɵɵFactoryTarget.Directive });
2686
- /** @nocollapse */ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: IonTabs, selector: "ion-tabs", outputs: { ionTabsWillChange: "ionTabsWillChange", ionTabsDidChange: "ionTabsDidChange" }, host: { listeners: { "ionTabButtonClick": "select($event)" } }, viewQueries: [{ propertyName: "tabsInner", first: true, predicate: ["tabsInner"], descendants: true, read: ElementRef, static: true }], ngImport: i0 });
2687
- }
2688
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: IonTabs, decorators: [{
2689
- type: Directive,
2690
- args: [{
2691
- selector: 'ion-tabs',
2692
- }]
2693
- }], ctorParameters: function () { return [{ type: NavController }]; }, propDecorators: { tabsInner: [{
2694
- type: ViewChild,
2695
- args: ['tabsInner', { read: ElementRef, static: true }]
2696
- }], ionTabsWillChange: [{
2697
- type: Output
2698
- }], ionTabsDidChange: [{
2699
- type: Output
2700
- }], select: [{
2701
- type: HostListener,
2702
- args: ['ionTabButtonClick', ['$event']]
2703
- }] } });
2704
-
2705
- // TODO(FW-2827): types
2706
- class OverlayBaseController {
2707
- ctrl;
2708
- constructor(ctrl) {
2709
- this.ctrl = ctrl;
2710
- }
2711
- /**
2712
- * Creates a new overlay
2713
- */
2714
- create(opts) {
2715
- return this.ctrl.create((opts || {}));
2716
- }
2717
- /**
2718
- * When `id` is not provided, it dismisses the top overlay.
2719
- */
2720
- dismiss(data, role, id) {
2721
- return this.ctrl.dismiss(data, role, id);
2722
- }
2723
- /**
2724
- * Returns the top overlay.
2725
- */
2726
- getTop() {
2727
- return this.ctrl.getTop();
2728
- }
2729
- }
2730
-
2731
- /**
2732
- * Provides a way to customize when activated routes get reused.
2733
- */
2734
- class IonicRouteStrategy {
2735
- /**
2736
- * Whether the given route should detach for later reuse.
2737
- */
2738
- shouldDetach(_route) {
2739
- return false;
2740
- }
2741
- /**
2742
- * Returns `false`, meaning the route (and its subtree) is never reattached
2743
- */
2744
- shouldAttach(_route) {
2745
- return false;
2746
- }
2747
- /**
2748
- * A no-op; the route is never stored since this strategy never detaches routes for later re-use.
2749
- */
2750
- store(_route, _detachedTree) {
2751
- return;
2752
- }
2753
- /**
2754
- * Returns `null` because this strategy does not store routes for later re-use.
2755
- */
2756
- retrieve(_route) {
2757
- return null;
2758
- }
2759
- /**
2760
- * Determines if a route should be reused.
2761
- * This strategy returns `true` when the future route config and
2762
- * current route config are identical and all route parameters are identical.
2763
- */
2764
- shouldReuseRoute(future, curr) {
2765
- if (future.routeConfig !== curr.routeConfig) {
2766
- return false;
2767
- }
2768
- // checking router params
2769
- const futureParams = future.params;
2770
- const currentParams = curr.params;
2771
- const keysA = Object.keys(futureParams);
2772
- const keysB = Object.keys(currentParams);
2773
- if (keysA.length !== keysB.length) {
2774
- return false;
2775
- }
2776
- // Test for A's keys different from B.
2777
- for (const key of keysA) {
2778
- if (currentParams[key] !== futureParams[key]) {
2779
- return false;
2780
- }
2781
- }
2782
- return true;
2783
- }
2784
- }
2785
-
2786
- /**
2787
- * Generated bundle index. Do not edit.
2788
- */
2789
-
2790
- export { AngularDelegate, Config, ConfigToken, DomController, IonBackButton, IonModal, IonModalToken, IonNav, IonPopover, IonRouterOutlet, IonTabs, IonicRouteStrategy, MenuController, NavController, NavParams, OverlayBaseController, Platform, ProxyCmp, RouterLinkDelegateDirective, RouterLinkWithHrefDelegateDirective, ValueAccessor, bindLifecycleEvents, provideComponentInputBinding, raf, setIonicClasses };
2791
- //# sourceMappingURL=ionic-angular-common.mjs.map