@ionic/angular 8.8.14-dev.11784563563.137a903a → 8.8.14-dev.11785507167.1f41b13b

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