@covalent/core 6.3.0 → 7.0.0

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 (269) hide show
  1. package/breadcrumbs/breadcrumbs.component.d.ts +1 -1
  2. package/dialogs/window-dialog/window-dialog.component.d.ts +1 -1
  3. package/dynamic-menu/dynamic-menu-item/dynamic-menu-item.component.d.ts +1 -1
  4. package/dynamic-menu/dynamic-menu-item/dynamic-menu-link/dynamic-menu-link.component.d.ts +1 -1
  5. package/dynamic-menu/dynamic-menu.component.d.ts +1 -1
  6. package/esm2022/breadcrumbs/breadcrumb/breadcrumb.component.mjs +94 -0
  7. package/esm2022/breadcrumbs/breadcrumbs.component.mjs +135 -0
  8. package/{esm2020 → esm2022}/breadcrumbs/breadcrumbs.module.mjs +5 -5
  9. package/esm2022/common/behaviors/control-value-accesor.mixin.mjs +43 -0
  10. package/esm2022/common/behaviors/disable-ripple.mixin.mjs +24 -0
  11. package/{esm2020 → esm2022}/common/behaviors/disabled.mixin.mjs +2 -2
  12. package/{esm2020 → esm2022}/common/common.module.mjs +17 -17
  13. package/esm2022/common/directives/fullscreen/fullscreen.directive.mjs +87 -0
  14. package/esm2022/common/forms/auto-trim/auto-trim.directive.mjs +37 -0
  15. package/esm2022/common/functions/convert.mjs +84 -0
  16. package/esm2022/common/functions/download.mjs +75 -0
  17. package/esm2022/common/pipes/bytes/bytes.pipe.mjs +42 -0
  18. package/esm2022/common/pipes/decimal-bytes/decimal-bytes.pipe.mjs +42 -0
  19. package/esm2022/common/pipes/digits/digits.pipe.mjs +41 -0
  20. package/{esm2020 → esm2022}/common/pipes/time-ago/time-ago.pipe.mjs +4 -4
  21. package/{esm2020 → esm2022}/common/pipes/time-difference/time-difference.pipe.mjs +4 -4
  22. package/{esm2020 → esm2022}/common/pipes/time-until/time-until.pipe.mjs +4 -4
  23. package/esm2022/common/pipes/truncate/truncate.pipe.mjs +27 -0
  24. package/esm2022/common/services/icon.service.mjs +1087 -0
  25. package/esm2022/common/services/router-path.service.mjs +30 -0
  26. package/esm2022/dialogs/alert-dialog/alert-dialog.component.mjs +26 -0
  27. package/esm2022/dialogs/confirm-dialog/confirm-dialog.component.mjs +31 -0
  28. package/esm2022/dialogs/dialog.component.mjs +60 -0
  29. package/{esm2020 → esm2022}/dialogs/dialogs.module.mjs +39 -39
  30. package/esm2022/dialogs/prompt-dialog/prompt-dialog.component.mjs +84 -0
  31. package/esm2022/dialogs/resizable-draggable-dialog/resizable-draggable-dialog.mjs +220 -0
  32. package/esm2022/dialogs/services/dialog.service.mjs +179 -0
  33. package/esm2022/dialogs/window-dialog/window-dialog.component.mjs +40 -0
  34. package/esm2022/dynamic-menu/dynamic-menu-item/dynamic-menu-item.component.mjs +30 -0
  35. package/esm2022/dynamic-menu/dynamic-menu-item/dynamic-menu-link/dynamic-menu-link.component.mjs +23 -0
  36. package/esm2022/dynamic-menu/dynamic-menu.component.mjs +28 -0
  37. package/{esm2020 → esm2022}/dynamic-menu/dynamic-menu.module.mjs +19 -19
  38. package/esm2022/file/directives/file-drop.directive.mjs +145 -0
  39. package/esm2022/file/directives/file-select.directive.mjs +78 -0
  40. package/esm2022/file/file-input/file-input.component.mjs +146 -0
  41. package/esm2022/file/file-upload/file-upload.component.mjs +185 -0
  42. package/{esm2020 → esm2022}/file/file.module.mjs +21 -21
  43. package/esm2022/file/services/file.service.mjs +66 -0
  44. package/esm2022/json-formatter/json-formatter.component.mjs +222 -0
  45. package/{esm2020 → esm2022}/json-formatter/json-formatter.module.mjs +5 -5
  46. package/esm2022/layout/layout-card-over/layout-card-over.component.mjs +50 -0
  47. package/esm2022/layout/layout-footer/layout-footer.component.mjs +36 -0
  48. package/esm2022/layout/layout-manage-list/layout-manage-list.component.mjs +92 -0
  49. package/{esm2020 → esm2022}/layout/layout-manage-list/layout-manage-list.directives.mjs +10 -10
  50. package/esm2022/layout/layout-nav/layout-nav.component.mjs +76 -0
  51. package/esm2022/layout/layout-nav-list/layout-nav-list.component.mjs +154 -0
  52. package/{esm2020 → esm2022}/layout/layout-nav-list/layout-nav-list.directives.mjs +10 -10
  53. package/esm2022/layout/layout-toggle.class.mjs +96 -0
  54. package/esm2022/layout/layout.component.mjs +91 -0
  55. package/{esm2020 → esm2022}/layout/layout.directives.mjs +10 -10
  56. package/{esm2020 → esm2022}/layout/layout.module.mjs +55 -55
  57. package/esm2022/layout/navigation-drawer/navigation-drawer.component.mjs +221 -0
  58. package/esm2022/loading/directives/loading.directive.mjs +133 -0
  59. package/esm2022/loading/loading.component.mjs +193 -0
  60. package/{esm2020 → esm2022}/loading/loading.module.mjs +13 -13
  61. package/esm2022/loading/services/loading.factory.mjs +210 -0
  62. package/esm2022/loading/services/loading.service.mjs +219 -0
  63. package/{esm2020 → esm2022}/menu/menu.component.mjs +4 -4
  64. package/{esm2020 → esm2022}/menu/menu.module.mjs +5 -5
  65. package/esm2022/message/message.component.mjs +222 -0
  66. package/{esm2020 → esm2022}/message/message.module.mjs +7 -7
  67. package/esm2022/search/search-box/search-box.component.mjs +198 -0
  68. package/esm2022/search/search-input/search-input.component.mjs +214 -0
  69. package/{esm2020 → esm2022}/search/search.module.mjs +13 -13
  70. package/esm2022/side-sheet/side-sheet-container.mjs +285 -0
  71. package/esm2022/side-sheet/side-sheet-ref.mjs +30 -0
  72. package/{esm2020 → esm2022}/side-sheet/side-sheet.config.mjs +2 -5
  73. package/esm2022/side-sheet/side-sheet.content-directives.mjs +206 -0
  74. package/esm2022/side-sheet/side-sheet.mjs +236 -0
  75. package/{esm2020 → esm2022}/side-sheet/side-sheet.module.mjs +14 -14
  76. package/esm2022/user-profile/user-profile-menu/user-profile-menu.component.mjs +25 -0
  77. package/esm2022/user-profile/user-profile.component.mjs +21 -0
  78. package/{esm2020 → esm2022}/user-profile/user-profile.module.mjs +15 -15
  79. package/{fesm2015 → fesm2022}/covalent-core-breadcrumbs.mjs +28 -22
  80. package/{fesm2015 → fesm2022}/covalent-core-breadcrumbs.mjs.map +1 -1
  81. package/{fesm2020 → fesm2022}/covalent-core-common.mjs +1131 -1125
  82. package/fesm2022/covalent-core-common.mjs.map +1 -0
  83. package/{fesm2020 → fesm2022}/covalent-core-dialogs.mjs +109 -80
  84. package/{fesm2020 → fesm2022}/covalent-core-dialogs.mjs.map +1 -1
  85. package/fesm2022/covalent-core-dynamic-menu.mjs +125 -0
  86. package/{fesm2015 → fesm2022}/covalent-core-dynamic-menu.mjs.map +1 -1
  87. package/{fesm2020 → fesm2022}/covalent-core-file.mjs +148 -110
  88. package/{fesm2020 → fesm2022}/covalent-core-file.mjs.map +1 -1
  89. package/{fesm2020 → fesm2022}/covalent-core-json-formatter.mjs +26 -21
  90. package/{fesm2020 → fesm2022}/covalent-core-json-formatter.mjs.map +1 -1
  91. package/{fesm2020 → fesm2022}/covalent-core-layout.mjs +396 -271
  92. package/{fesm2015 → fesm2022}/covalent-core-layout.mjs.map +1 -1
  93. package/{fesm2020 → fesm2022}/covalent-core-loading.mjs +100 -78
  94. package/{fesm2020 → fesm2022}/covalent-core-loading.mjs.map +1 -1
  95. package/{fesm2015 → fesm2022}/covalent-core-menu.mjs +7 -7
  96. package/{fesm2015 → fesm2022}/covalent-core-menu.mjs.map +1 -1
  97. package/{fesm2020 → fesm2022}/covalent-core-message.mjs +42 -23
  98. package/{fesm2020 → fesm2022}/covalent-core-message.mjs.map +1 -1
  99. package/fesm2022/covalent-core-search.mjs +438 -0
  100. package/fesm2022/covalent-core-search.mjs.map +1 -0
  101. package/{fesm2020 → fesm2022}/covalent-core-side-sheet.mjs +124 -99
  102. package/{fesm2020 → fesm2022}/covalent-core-side-sheet.mjs.map +1 -1
  103. package/fesm2022/covalent-core-user-profile.mjs +87 -0
  104. package/fesm2022/covalent-core-user-profile.mjs.map +1 -0
  105. package/file/directives/file-drop.directive.d.ts +1 -1
  106. package/file/directives/file-select.directive.d.ts +1 -1
  107. package/file/file-input/file-input.component.d.ts +1 -1
  108. package/file/file-upload/file-upload.component.d.ts +1 -1
  109. package/json-formatter/json-formatter.component.d.ts +1 -1
  110. package/layout/layout-card-over/layout-card-over.component.d.ts +1 -1
  111. package/layout/layout-footer/layout-footer.component.d.ts +1 -1
  112. package/layout/layout-manage-list/layout-manage-list.component.d.ts +1 -1
  113. package/layout/layout-manage-list/layout-manage-list.directives.d.ts +3 -3
  114. package/layout/layout-nav/layout-nav.component.d.ts +1 -1
  115. package/layout/layout-nav-list/layout-nav-list.component.d.ts +1 -1
  116. package/layout/layout-nav-list/layout-nav-list.directives.d.ts +3 -3
  117. package/layout/layout-toggle.class.d.ts +1 -1
  118. package/layout/layout.component.d.ts +1 -1
  119. package/layout/layout.directives.d.ts +3 -3
  120. package/layout/navigation-drawer/navigation-drawer.component.d.ts +1 -1
  121. package/loading/directives/loading.directive.d.ts +1 -1
  122. package/message/message.component.d.ts +1 -1
  123. package/package.json +55 -91
  124. package/search/search-box/search-box.component.d.ts +1 -1
  125. package/search/search-input/search-input.component.d.ts +1 -1
  126. package/side-sheet/side-sheet.content-directives.d.ts +2 -2
  127. package/user-profile/user-profile-menu/user-profile-menu.component.d.ts +1 -1
  128. package/user-profile/user-profile.component.d.ts +1 -1
  129. package/common/styles/font/README.md +0 -11
  130. package/dialogs/src/README.md +0 -223
  131. package/esm2020/breadcrumbs/breadcrumb/breadcrumb.component.mjs +0 -92
  132. package/esm2020/breadcrumbs/breadcrumbs.component.mjs +0 -131
  133. package/esm2020/common/behaviors/control-value-accesor.mixin.mjs +0 -41
  134. package/esm2020/common/behaviors/disable-ripple.mixin.mjs +0 -24
  135. package/esm2020/common/directives/fullscreen/fullscreen.directive.mjs +0 -85
  136. package/esm2020/common/forms/auto-trim/auto-trim.directive.mjs +0 -36
  137. package/esm2020/common/functions/convert.mjs +0 -84
  138. package/esm2020/common/functions/download.mjs +0 -75
  139. package/esm2020/common/pipes/bytes/bytes.pipe.mjs +0 -42
  140. package/esm2020/common/pipes/decimal-bytes/decimal-bytes.pipe.mjs +0 -42
  141. package/esm2020/common/pipes/digits/digits.pipe.mjs +0 -39
  142. package/esm2020/common/pipes/truncate/truncate.pipe.mjs +0 -27
  143. package/esm2020/common/services/icon.service.mjs +0 -1089
  144. package/esm2020/common/services/router-path.service.mjs +0 -29
  145. package/esm2020/dialogs/alert-dialog/alert-dialog.component.mjs +0 -23
  146. package/esm2020/dialogs/confirm-dialog/confirm-dialog.component.mjs +0 -28
  147. package/esm2020/dialogs/dialog.component.mjs +0 -57
  148. package/esm2020/dialogs/prompt-dialog/prompt-dialog.component.mjs +0 -75
  149. package/esm2020/dialogs/resizable-draggable-dialog/resizable-draggable-dialog.mjs +0 -216
  150. package/esm2020/dialogs/services/dialog.service.mjs +0 -174
  151. package/esm2020/dialogs/window-dialog/window-dialog.component.mjs +0 -38
  152. package/esm2020/dynamic-menu/dynamic-menu-item/dynamic-menu-item.component.mjs +0 -30
  153. package/esm2020/dynamic-menu/dynamic-menu-item/dynamic-menu-link/dynamic-menu-link.component.mjs +0 -24
  154. package/esm2020/dynamic-menu/dynamic-menu.component.mjs +0 -28
  155. package/esm2020/file/directives/file-drop.directive.mjs +0 -139
  156. package/esm2020/file/directives/file-select.directive.mjs +0 -77
  157. package/esm2020/file/file-input/file-input.component.mjs +0 -128
  158. package/esm2020/file/file-upload/file-upload.component.mjs +0 -174
  159. package/esm2020/file/services/file.service.mjs +0 -64
  160. package/esm2020/json-formatter/json-formatter.component.mjs +0 -217
  161. package/esm2020/layout/layout-card-over/layout-card-over.component.mjs +0 -40
  162. package/esm2020/layout/layout-footer/layout-footer.component.mjs +0 -33
  163. package/esm2020/layout/layout-manage-list/layout-manage-list.component.mjs +0 -93
  164. package/esm2020/layout/layout-nav/layout-nav.component.mjs +0 -50
  165. package/esm2020/layout/layout-nav-list/layout-nav-list.component.mjs +0 -128
  166. package/esm2020/layout/layout-toggle.class.mjs +0 -92
  167. package/esm2020/layout/layout.component.mjs +0 -92
  168. package/esm2020/layout/navigation-drawer/navigation-drawer.component.mjs +0 -163
  169. package/esm2020/loading/directives/loading.directive.mjs +0 -126
  170. package/esm2020/loading/loading.component.mjs +0 -187
  171. package/esm2020/loading/services/loading.factory.mjs +0 -207
  172. package/esm2020/loading/services/loading.service.mjs +0 -213
  173. package/esm2020/message/message.component.mjs +0 -203
  174. package/esm2020/search/search-box/search-box.component.mjs +0 -194
  175. package/esm2020/search/search-input/search-input.component.mjs +0 -207
  176. package/esm2020/side-sheet/side-sheet-container.mjs +0 -274
  177. package/esm2020/side-sheet/side-sheet-ref.mjs +0 -26
  178. package/esm2020/side-sheet/side-sheet.content-directives.mjs +0 -201
  179. package/esm2020/side-sheet/side-sheet.mjs +0 -228
  180. package/esm2020/user-profile/user-profile-menu/user-profile-menu.component.mjs +0 -23
  181. package/esm2020/user-profile/user-profile.component.mjs +0 -19
  182. package/fesm2015/covalent-core-common.mjs +0 -2281
  183. package/fesm2015/covalent-core-common.mjs.map +0 -1
  184. package/fesm2015/covalent-core-dialogs.mjs +0 -668
  185. package/fesm2015/covalent-core-dialogs.mjs.map +0 -1
  186. package/fesm2015/covalent-core-dynamic-menu.mjs +0 -126
  187. package/fesm2015/covalent-core-file.mjs +0 -621
  188. package/fesm2015/covalent-core-file.mjs.map +0 -1
  189. package/fesm2015/covalent-core-json-formatter.mjs +0 -298
  190. package/fesm2015/covalent-core-json-formatter.mjs.map +0 -1
  191. package/fesm2015/covalent-core-layout.mjs +0 -1024
  192. package/fesm2015/covalent-core-loading.mjs +0 -766
  193. package/fesm2015/covalent-core-loading.mjs.map +0 -1
  194. package/fesm2015/covalent-core-message.mjs +0 -284
  195. package/fesm2015/covalent-core-message.mjs.map +0 -1
  196. package/fesm2015/covalent-core-search.mjs +0 -430
  197. package/fesm2015/covalent-core-search.mjs.map +0 -1
  198. package/fesm2015/covalent-core-side-sheet.mjs +0 -784
  199. package/fesm2015/covalent-core-side-sheet.mjs.map +0 -1
  200. package/fesm2015/covalent-core-user-profile.mjs +0 -83
  201. package/fesm2015/covalent-core-user-profile.mjs.map +0 -1
  202. package/fesm2020/covalent-core-breadcrumbs.mjs +0 -243
  203. package/fesm2020/covalent-core-breadcrumbs.mjs.map +0 -1
  204. package/fesm2020/covalent-core-common.mjs.map +0 -1
  205. package/fesm2020/covalent-core-dynamic-menu.mjs +0 -126
  206. package/fesm2020/covalent-core-dynamic-menu.mjs.map +0 -1
  207. package/fesm2020/covalent-core-layout.mjs.map +0 -1
  208. package/fesm2020/covalent-core-menu.mjs +0 -37
  209. package/fesm2020/covalent-core-menu.mjs.map +0 -1
  210. package/fesm2020/covalent-core-search.mjs +0 -427
  211. package/fesm2020/covalent-core-search.mjs.map +0 -1
  212. package/fesm2020/covalent-core-user-profile.mjs +0 -83
  213. package/fesm2020/covalent-core-user-profile.mjs.map +0 -1
  214. package/fesm2020/covalent-core.mjs +0 -4
  215. package/fesm2020/covalent-core.mjs.map +0 -1
  216. package/file/src/file-input/README.md +0 -147
  217. package/file/src/file-upload/README.md +0 -136
  218. package/layout/src/layout-card-over/README.md +0 -43
  219. package/layout/src/layout-manage-list/README.md +0 -80
  220. package/layout/src/layout-nav/README.md +0 -50
  221. package/layout/src/layout-nav-list/README.md +0 -105
  222. package/search/src/search-box/README.md +0 -73
  223. package/search/src/search-input/README.md +0 -74
  224. /package/{esm2020 → esm2022}/breadcrumbs/covalent-core-breadcrumbs.mjs +0 -0
  225. /package/{esm2020 → esm2022}/breadcrumbs/public_api.mjs +0 -0
  226. /package/{esm2020 → esm2022}/common/animations/bounce/bounce.animation.mjs +0 -0
  227. /package/{esm2020 → esm2022}/common/animations/collapse/collapse.animation.mjs +0 -0
  228. /package/{esm2020 → esm2022}/common/animations/common/interfaces.mjs +0 -0
  229. /package/{esm2020 → esm2022}/common/animations/fade/fadeInOut.animation.mjs +0 -0
  230. /package/{esm2020 → esm2022}/common/animations/flash/flash.animation.mjs +0 -0
  231. /package/{esm2020 → esm2022}/common/animations/headshake/headshake.animation.mjs +0 -0
  232. /package/{esm2020 → esm2022}/common/animations/jello/jello.animation.mjs +0 -0
  233. /package/{esm2020 → esm2022}/common/animations/pulse/pulse.animation.mjs +0 -0
  234. /package/{esm2020 → esm2022}/common/animations/rotate/rotate.animation.mjs +0 -0
  235. /package/{esm2020 → esm2022}/common/covalent-core-common.mjs +0 -0
  236. /package/{esm2020 → esm2022}/common/forms/validators/validators.mjs +0 -0
  237. /package/{esm2020 → esm2022}/common/functions/clipboard.mjs +0 -0
  238. /package/{esm2020 → esm2022}/common/functions/file.mjs +0 -0
  239. /package/{esm2020 → esm2022}/common/public_api.mjs +0 -0
  240. /package/{esm2020 → esm2022}/covalent-core.mjs +0 -0
  241. /package/{esm2020 → esm2022}/dialogs/covalent-core-dialogs.mjs +0 -0
  242. /package/{esm2020 → esm2022}/dialogs/public_api.mjs +0 -0
  243. /package/{esm2020 → esm2022}/dynamic-menu/covalent-core-dynamic-menu.mjs +0 -0
  244. /package/{esm2020 → esm2022}/dynamic-menu/dynamic-menu.menu.mjs +0 -0
  245. /package/{esm2020 → esm2022}/dynamic-menu/public_api.mjs +0 -0
  246. /package/{esm2020 → esm2022}/file/covalent-core-file.mjs +0 -0
  247. /package/{esm2020 → esm2022}/file/public_api.mjs +0 -0
  248. /package/{esm2020 → esm2022}/json-formatter/collapse.animation.mjs +0 -0
  249. /package/{esm2020 → esm2022}/json-formatter/covalent-core-json-formatter.mjs +0 -0
  250. /package/{esm2020 → esm2022}/json-formatter/public_api.mjs +0 -0
  251. /package/{esm2020 → esm2022}/layout/covalent-core-layout.mjs +0 -0
  252. /package/{esm2020 → esm2022}/layout/public_api.mjs +0 -0
  253. /package/{esm2020 → esm2022}/loading/covalent-core-loading.mjs +0 -0
  254. /package/{esm2020 → esm2022}/loading/public_api.mjs +0 -0
  255. /package/{esm2020 → esm2022}/menu/covalent-core-menu.mjs +0 -0
  256. /package/{esm2020 → esm2022}/menu/public_api.mjs +0 -0
  257. /package/{esm2020 → esm2022}/message/collapse.animation.mjs +0 -0
  258. /package/{esm2020 → esm2022}/message/covalent-core-message.mjs +0 -0
  259. /package/{esm2020 → esm2022}/message/public_api.mjs +0 -0
  260. /package/{esm2020 → esm2022}/public_api.mjs +0 -0
  261. /package/{esm2020 → esm2022}/search/covalent-core-search.mjs +0 -0
  262. /package/{esm2020 → esm2022}/search/public_api.mjs +0 -0
  263. /package/{esm2020 → esm2022}/side-sheet/covalent-core-side-sheet.mjs +0 -0
  264. /package/{esm2020 → esm2022}/side-sheet/public_api.mjs +0 -0
  265. /package/{esm2020 → esm2022}/side-sheet/side-sheet.animation.mjs +0 -0
  266. /package/{esm2020 → esm2022}/user-profile/covalent-core-user-profile.mjs +0 -0
  267. /package/{esm2020 → esm2022}/user-profile/public_api.mjs +0 -0
  268. /package/{fesm2015 → fesm2022}/covalent-core.mjs +0 -0
  269. /package/{fesm2015 → fesm2022}/covalent-core.mjs.map +0 -0
@@ -1,766 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Component, Injectable, Optional, SkipSelf, ComponentFactoryResolver, Injector, Directive, Input, NgModule } from '@angular/core';
3
- import * as i1 from '@angular/common';
4
- import { CommonModule } from '@angular/common';
5
- import * as i4 from '@angular/cdk/portal';
6
- import { ComponentPortal, TemplatePortal, PortalModule } from '@angular/cdk/portal';
7
- import * as i1$1 from '@angular/cdk/overlay';
8
- import { OverlayConfig, Overlay, OverlayModule } from '@angular/cdk/overlay';
9
- import * as i2 from '@angular/material/progress-bar';
10
- import { MatProgressBarModule } from '@angular/material/progress-bar';
11
- import * as i3 from '@angular/material/progress-spinner';
12
- import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
13
- import { tdFadeInOutAnimation } from '@covalent/core/common';
14
- import { Subject } from 'rxjs';
15
- import { distinctUntilChanged } from 'rxjs/operators';
16
-
17
- var LoadingType;
18
- (function (LoadingType) {
19
- LoadingType["Circular"] = "circular";
20
- LoadingType["Linear"] = "linear";
21
- })(LoadingType || (LoadingType = {}));
22
- var LoadingMode;
23
- (function (LoadingMode) {
24
- LoadingMode["Determinate"] = "determinate";
25
- LoadingMode["Indeterminate"] = "indeterminate";
26
- })(LoadingMode || (LoadingMode = {}));
27
- var LoadingStrategy;
28
- (function (LoadingStrategy) {
29
- LoadingStrategy["Overlay"] = "overlay";
30
- LoadingStrategy["Replace"] = "replace";
31
- })(LoadingStrategy || (LoadingStrategy = {}));
32
- var LoadingStyle;
33
- (function (LoadingStyle) {
34
- LoadingStyle["FullScreen"] = "fullscreen";
35
- LoadingStyle["Overlay"] = "overlay";
36
- LoadingStyle["None"] = "none";
37
- })(LoadingStyle || (LoadingStyle = {}));
38
- const TD_CIRCLE_DIAMETER = 40;
39
- class TdLoadingComponent {
40
- /**
41
- * Sets mode of [TdLoadingComponent] to LoadingMode.Determinate or LoadingMode.Indeterminate
42
- */
43
- set mode(mode) {
44
- this._defaultMode = mode;
45
- }
46
- get mode() {
47
- return this._mode;
48
- }
49
- /**
50
- * Sets value of [TdLoadingComponent] if mode is 'LoadingMode.Determinate'
51
- */
52
- set value(value) {
53
- this._value = value;
54
- // Check for changes for `OnPush` change detection
55
- this._changeDetectorRef.markForCheck();
56
- }
57
- get value() {
58
- return this._value;
59
- }
60
- constructor(_elementRef, _changeDetectorRef) {
61
- this._elementRef = _elementRef;
62
- this._changeDetectorRef = _changeDetectorRef;
63
- this._mode = LoadingMode.Indeterminate;
64
- this._defaultMode = LoadingMode.Indeterminate;
65
- this._value = 0;
66
- this._circleDiameter = TD_CIRCLE_DIAMETER;
67
- /**
68
- * Flag for animation
69
- */
70
- this.animation = false;
71
- this.style = LoadingStyle.None;
72
- /**
73
- * height: number
74
- * Sets height of [TdLoadingComponent].
75
- */
76
- this.height = 100;
77
- /**
78
- * type: LoadingType
79
- * Sets type of [TdLoadingComponent] rendered.
80
- */
81
- this.type = LoadingType.Circular;
82
- /**
83
- * color: primary' | 'accent' | 'warn'
84
- * Sets theme color of [TdLoadingComponent] rendered.
85
- */
86
- this.color = 'primary';
87
- }
88
- ngDoCheck() {
89
- // When overlay is used and the host width has a value greater than 1px
90
- // set the circle diameter when possible incase the loading component was rendered in a hidden state
91
- if (this.isOverlay() && this._hostHeight() > 1 && this.animation) {
92
- this._setCircleDiameter();
93
- this._changeDetectorRef.markForCheck();
94
- }
95
- }
96
- getHeight() {
97
- // Ignore height if style is `overlay` or `fullscreen`.
98
- // Add height if child elements have a height and style is `none`, else return default height.
99
- if (this.isOverlay() || this.isFullScreen()) {
100
- return undefined;
101
- }
102
- else {
103
- return this.height ? `${this.height}px` : '150px';
104
- }
105
- }
106
- getCircleDiameter() {
107
- return this._circleDiameter;
108
- }
109
- getCircleStrokeWidth() {
110
- // we calculate the stroke width by setting it as 10% of its diameter
111
- const strokeWidth = this.getCircleDiameter() / 10;
112
- return Math.abs(strokeWidth);
113
- }
114
- isCircular() {
115
- return this.type === LoadingType.Circular;
116
- }
117
- isLinear() {
118
- return this.type === LoadingType.Linear;
119
- }
120
- isFullScreen() {
121
- return this.style === LoadingStyle.FullScreen;
122
- }
123
- isOverlay() {
124
- return this.style === LoadingStyle.Overlay;
125
- }
126
- /**
127
- * Starts in animation and returns an observable for completition event.
128
- */
129
- show() {
130
- /* need to switch back to the selected mode, so we have saved it in another variable
131
- * and then recover it. (issue with protractor)
132
- */
133
- this._mode = this._defaultMode;
134
- // Set values before the animations starts
135
- this._setCircleDiameter();
136
- // Check for changes for `OnPush` change detection
137
- this.animation = true;
138
- this._changeDetectorRef.markForCheck();
139
- }
140
- /**
141
- * Starts out animation and returns an observable for completition event.
142
- */
143
- hide() {
144
- this.animation = false;
145
- /* need to switch back and forth from determinate/indeterminate so the setInterval()
146
- * inside mat-progress-spinner stops and protractor doesnt timeout waiting to sync.
147
- */
148
- this._mode = LoadingMode.Determinate;
149
- // Check for changes for `OnPush` change detection
150
- /* little hack to reset the loader value and animation before removing it from DOM
151
- * else, the loader will appear with prev value when its registered again
152
- * and will do an animation going prev value to 0.
153
- */
154
- this.value = 0;
155
- // Check for changes for `OnPush` change detection
156
- this._changeDetectorRef.markForCheck();
157
- }
158
- /**
159
- * Calculate the proper diameter for the circle and set it
160
- */
161
- _setCircleDiameter() {
162
- // we set a default diameter of 100 since this is the default in material
163
- let diameter = TD_CIRCLE_DIAMETER;
164
- // if height is provided, then we take that as diameter
165
- if (this.height) {
166
- diameter = this.height;
167
- // else if its not provided, then we take the host height
168
- }
169
- else if (this.height === undefined) {
170
- diameter = this._hostHeight();
171
- }
172
- // if the diameter is over TD_CIRCLE_DIAMETER, we set TD_CIRCLE_DIAMETER
173
- if (diameter <= TD_CIRCLE_DIAMETER) {
174
- this._circleDiameter = Math.floor(diameter);
175
- }
176
- else {
177
- this._circleDiameter = TD_CIRCLE_DIAMETER;
178
- }
179
- }
180
- /**
181
- * Returns the host height of the loading component
182
- */
183
- _hostHeight() {
184
- if (this._elementRef.nativeElement) {
185
- return (this._elementRef.nativeElement).getBoundingClientRect().height;
186
- }
187
- return 0;
188
- }
189
- }
190
- TdLoadingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdLoadingComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
191
- TdLoadingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: TdLoadingComponent, selector: "td-loading", ngImport: i0, template: "<div\n class=\"td-loading-wrapper\"\n [style.min-height]=\"getHeight()\"\n [class.td-overlay-circular]=\"(isOverlay() || isFullScreen()) && !isLinear()\"\n [class.td-overlay]=\"isOverlay() || isFullScreen()\"\n [class.td-fullscreen]=\"isFullScreen()\"\n>\n <div\n [@tdFadeInOut]=\"animation\"\n [style.min-height]=\"getHeight()\"\n class=\"td-loading\"\n >\n <mat-progress-spinner\n *ngIf=\"isCircular()\"\n [mode]=\"mode\"\n [value]=\"value\"\n [color]=\"color\"\n [diameter]=\"getCircleDiameter()\"\n [strokeWidth]=\"getCircleStrokeWidth()\"\n ></mat-progress-spinner>\n <mat-progress-bar\n *ngIf=\"isLinear()\"\n [mode]=\"mode\"\n [value]=\"value\"\n [color]=\"color\"\n ></mat-progress-bar>\n </div>\n <ng-template [cdkPortalOutlet]=\"content\"></ng-template>\n</div>\n", styles: [".td-loading-wrapper{position:relative;display:block}.td-loading-wrapper.td-fullscreen{position:inherit}.td-loading-wrapper .td-loading{box-sizing:border-box;display:flex;flex-direction:row;align-items:center;align-content:center;max-width:100%;justify-content:center;flex:1}.td-loading-wrapper.td-overlay .td-loading{position:absolute;margin:0;top:0;left:0;right:0;z-index:1000}.td-loading-wrapper.td-overlay .td-loading mat-progress-bar{position:absolute;top:0;left:0;right:0}.td-loading-wrapper.td-overlay-circular .td-loading{bottom:0}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i3.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i4.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], animations: [tdFadeInOutAnimation] });
192
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdLoadingComponent, decorators: [{
193
- type: Component,
194
- args: [{ selector: 'td-loading', animations: [tdFadeInOutAnimation], template: "<div\n class=\"td-loading-wrapper\"\n [style.min-height]=\"getHeight()\"\n [class.td-overlay-circular]=\"(isOverlay() || isFullScreen()) && !isLinear()\"\n [class.td-overlay]=\"isOverlay() || isFullScreen()\"\n [class.td-fullscreen]=\"isFullScreen()\"\n>\n <div\n [@tdFadeInOut]=\"animation\"\n [style.min-height]=\"getHeight()\"\n class=\"td-loading\"\n >\n <mat-progress-spinner\n *ngIf=\"isCircular()\"\n [mode]=\"mode\"\n [value]=\"value\"\n [color]=\"color\"\n [diameter]=\"getCircleDiameter()\"\n [strokeWidth]=\"getCircleStrokeWidth()\"\n ></mat-progress-spinner>\n <mat-progress-bar\n *ngIf=\"isLinear()\"\n [mode]=\"mode\"\n [value]=\"value\"\n [color]=\"color\"\n ></mat-progress-bar>\n </div>\n <ng-template [cdkPortalOutlet]=\"content\"></ng-template>\n</div>\n", styles: [".td-loading-wrapper{position:relative;display:block}.td-loading-wrapper.td-fullscreen{position:inherit}.td-loading-wrapper .td-loading{box-sizing:border-box;display:flex;flex-direction:row;align-items:center;align-content:center;max-width:100%;justify-content:center;flex:1}.td-loading-wrapper.td-overlay .td-loading{position:absolute;margin:0;top:0;left:0;right:0;z-index:1000}.td-loading-wrapper.td-overlay .td-loading mat-progress-bar{position:absolute;top:0;left:0;right:0}.td-loading-wrapper.td-overlay-circular .td-loading{bottom:0}\n"] }]
195
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; } });
196
-
197
- /**
198
- * NOTE: @internal usage only.
199
- */
200
- class TdLoadingFactory {
201
- constructor(_componentFactoryResolver, _overlay, _injector) {
202
- this._componentFactoryResolver = _componentFactoryResolver;
203
- this._overlay = _overlay;
204
- this._injector = _injector;
205
- }
206
- /**
207
- * Uses material `Overlay` services to create a DOM element and attach the loading component
208
- * into it. Leveraging the state and configuration from it.
209
- *
210
- * Saves a reference in context to be called when registering/resolving the loading element.
211
- */
212
- createFullScreenComponent(options) {
213
- options.height = undefined;
214
- options.style = LoadingStyle.FullScreen;
215
- const loadingRef = this._initializeContext();
216
- let loading = false;
217
- let overlayRef;
218
- loadingRef.observable
219
- .pipe(distinctUntilChanged())
220
- .subscribe((registered) => {
221
- var _a, _b, _c, _d, _e;
222
- if (registered > 0 && !loading) {
223
- loading = true;
224
- overlayRef = this._createOverlay();
225
- loadingRef.componentRef = overlayRef.attach(new ComponentPortal(TdLoadingComponent));
226
- this._mapOptions(options, (_a = loadingRef.componentRef) === null || _a === void 0 ? void 0 : _a.instance);
227
- (_b = loadingRef.componentRef) === null || _b === void 0 ? void 0 : _b.instance.show();
228
- (_c = loadingRef.componentRef) === null || _c === void 0 ? void 0 : _c.changeDetectorRef.detectChanges();
229
- }
230
- else if (registered <= 0 && loading) {
231
- loading = false;
232
- (_d = loadingRef.componentRef) === null || _d === void 0 ? void 0 : _d.instance.hide();
233
- (_e = loadingRef.componentRef) === null || _e === void 0 ? void 0 : _e.destroy();
234
- overlayRef.detach();
235
- overlayRef.dispose();
236
- }
237
- });
238
- return loadingRef;
239
- }
240
- /**
241
- * Creates a loading component dynamically and attaches it into the given viewContainerRef.
242
- * Leverages TemplatePortals from material to inject the template inside of it so it fits
243
- * perfectly when overlaying it.
244
- *
245
- * Saves a reference in context to be called when registering/resolving the loading element.
246
- */
247
- createOverlayComponent(options, viewContainerRef, templateRef) {
248
- var _a;
249
- options.height = undefined;
250
- options.style = LoadingStyle.Overlay;
251
- const loadingRef = this._createComponent(options);
252
- let loading = false;
253
- if (loadingRef.componentRef) {
254
- loadingRef.componentRef.instance.content = new TemplatePortal(templateRef, viewContainerRef);
255
- viewContainerRef.clear();
256
- viewContainerRef.insert((_a = loadingRef.componentRef) === null || _a === void 0 ? void 0 : _a.hostView, 0);
257
- }
258
- loadingRef.observable
259
- .pipe(distinctUntilChanged())
260
- .subscribe((registered) => {
261
- var _a, _b;
262
- if (registered > 0 && !loading) {
263
- loading = true;
264
- (_a = loadingRef.componentRef) === null || _a === void 0 ? void 0 : _a.instance.show();
265
- }
266
- else if (registered <= 0 && loading) {
267
- loading = false;
268
- (_b = loadingRef.componentRef) === null || _b === void 0 ? void 0 : _b.instance.hide();
269
- }
270
- });
271
- return loadingRef;
272
- }
273
- /**
274
- * Creates a loading component dynamically and attaches it into the given viewContainerRef.
275
- * Replaces the template with the loading component depending if it was registered or resolved.
276
- *
277
- * Saves a reference in context to be called when registering/resolving the loading element.
278
- */
279
- createReplaceComponent(options, viewContainerRef, templateRef, context) {
280
- const nativeElement = (templateRef.elementRef.nativeElement);
281
- options.height = nativeElement.nextElementSibling
282
- ? nativeElement.nextElementSibling.scrollHeight
283
- : undefined;
284
- options.style = LoadingStyle.None;
285
- const loadingRef = this._createComponent(options);
286
- let loading = false;
287
- // passing context so when the template is attached, we can keep the reference of the variables
288
- const contentRef = viewContainerRef.createEmbeddedView(templateRef, context);
289
- loadingRef.observable
290
- .pipe(distinctUntilChanged())
291
- .subscribe((registered) => {
292
- var _a, _b;
293
- if (registered > 0 && !loading && loadingRef.componentRef) {
294
- loading = true;
295
- // detach the content and attach the loader if loader is there
296
- const index = viewContainerRef.indexOf(loadingRef.componentRef.hostView);
297
- if (index < 0) {
298
- viewContainerRef.detach(viewContainerRef.indexOf(contentRef));
299
- viewContainerRef.insert(loadingRef.componentRef.hostView, 0);
300
- }
301
- (_a = loadingRef.componentRef) === null || _a === void 0 ? void 0 : _a.instance.show();
302
- }
303
- else if (registered <= 0 && loading && loadingRef.componentRef) {
304
- loading = false;
305
- (_b = loadingRef.componentRef) === null || _b === void 0 ? void 0 : _b.instance.hide();
306
- // detach loader and attach the content if content is there
307
- const index = viewContainerRef.indexOf(contentRef);
308
- if (index < 0) {
309
- viewContainerRef.detach(viewContainerRef.indexOf(loadingRef.componentRef.hostView));
310
- viewContainerRef.insert(contentRef, 0);
311
- }
312
- /**
313
- * Need to call "markForCheck" and "detectChanges" on attached template, so its detected by parent component when attached
314
- * with "OnPush" change detection
315
- */
316
- contentRef.detectChanges();
317
- contentRef.markForCheck();
318
- }
319
- });
320
- return loadingRef;
321
- }
322
- /**
323
- * Creates a fullscreen overlay for the loading usage.
324
- */
325
- _createOverlay() {
326
- const state = new OverlayConfig();
327
- state.hasBackdrop = false;
328
- state.positionStrategy = this._overlay
329
- .position()
330
- .global()
331
- .centerHorizontally()
332
- .centerVertically();
333
- return this._overlay.create(state);
334
- }
335
- /**
336
- * Creates a generic component dynamically waiting to be attached to a viewContainerRef.
337
- */
338
- _createComponent(options) {
339
- const compRef = this._initializeContext();
340
- compRef.componentRef = this._componentFactoryResolver
341
- .resolveComponentFactory(TdLoadingComponent)
342
- .create(this._injector);
343
- this._mapOptions(options, compRef.componentRef.instance);
344
- return compRef;
345
- }
346
- /**
347
- * Initialize context for loading component.
348
- */
349
- _initializeContext() {
350
- const subject = new Subject();
351
- return {
352
- observable: subject.asObservable(),
353
- subject,
354
- componentRef: undefined,
355
- times: 0,
356
- };
357
- }
358
- /**
359
- * Maps configuration to the loading component instance.
360
- */
361
- _mapOptions(options, instance) {
362
- if (options.style) {
363
- instance.style = options.style;
364
- }
365
- if (options.type !== undefined) {
366
- instance.type = options.type;
367
- }
368
- if (options.height !== undefined) {
369
- instance.height = options.height;
370
- }
371
- if (options.mode !== undefined) {
372
- instance.mode = options.mode;
373
- }
374
- if (options.color !== undefined) {
375
- instance.color = options.color;
376
- }
377
- }
378
- }
379
- TdLoadingFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdLoadingFactory, deps: [{ token: i0.ComponentFactoryResolver }, { token: i1$1.Overlay }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
380
- TdLoadingFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdLoadingFactory });
381
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdLoadingFactory, decorators: [{
382
- type: Injectable
383
- }], ctorParameters: function () { return [{ type: i0.ComponentFactoryResolver }, { type: i1$1.Overlay }, { type: i0.Injector }]; } });
384
- function LOADING_FACTORY_PROVIDER_FACTORY(parent, componentFactoryResolver, overlay, injector) {
385
- return (parent || new TdLoadingFactory(componentFactoryResolver, overlay, injector));
386
- }
387
- const LOADING_FACTORY_PROVIDER = {
388
- // If there is already a service available, use that. Otherwise, provide a new one.
389
- provide: TdLoadingFactory,
390
- deps: [
391
- [new Optional(), new SkipSelf(), TdLoadingFactory],
392
- ComponentFactoryResolver,
393
- Overlay,
394
- Injector,
395
- ],
396
- useFactory: LOADING_FACTORY_PROVIDER_FACTORY,
397
- };
398
-
399
- class TdLoadingConfig {
400
- constructor(config) {
401
- this.name = config.name;
402
- if (!this.name) {
403
- throw Error('Name is required for [TdLoading] configuration.');
404
- }
405
- this.mode = config.mode ? config.mode : LoadingMode.Indeterminate;
406
- this.type = config.type ? config.type : LoadingType.Circular;
407
- this.color = config.color ? config.color : 'primary';
408
- }
409
- }
410
- class TdLoadingDirectiveConfig extends TdLoadingConfig {
411
- constructor(config) {
412
- super(config);
413
- this.strategy = config.strategy ? config.strategy : LoadingStrategy.Replace;
414
- }
415
- }
416
- class TdLoadingService {
417
- constructor(_loadingFactory) {
418
- this._loadingFactory = _loadingFactory;
419
- this._context = {};
420
- this._timeouts = {};
421
- this.create({
422
- name: 'td-loading-main',
423
- });
424
- }
425
- /**
426
- * params:
427
- * - config: ILoadingDirectiveConfig
428
- * - viewContainerRef: ViewContainerRef
429
- * - templateRef: TemplateRef<Object>
430
- *
431
- * Creates an replace loading mask and attaches it to the viewContainerRef.
432
- * Replaces the templateRef with the mask when a request is registered on it.
433
- *
434
- * NOTE: @internal usage only.
435
- */
436
- createComponent(config, viewContainerRef, templateRef, context) {
437
- const directiveConfig = new TdLoadingDirectiveConfig(config);
438
- if (this._context[directiveConfig.name]) {
439
- throw Error(`Name duplication: [TdLoading] directive has a name conflict with ${directiveConfig.name}.`);
440
- }
441
- if (directiveConfig.strategy === LoadingStrategy.Overlay) {
442
- this._context[directiveConfig.name] =
443
- this._loadingFactory.createOverlayComponent(directiveConfig, viewContainerRef, templateRef);
444
- }
445
- else {
446
- this._context[directiveConfig.name] =
447
- this._loadingFactory.createReplaceComponent(directiveConfig, viewContainerRef, templateRef, context);
448
- }
449
- return this._context[directiveConfig.name];
450
- }
451
- /**
452
- * params:
453
- * - config: ITdLoadingConfig
454
- *
455
- * Creates a fullscreen loading mask and attaches it to the DOM with the given configuration.
456
- * Only displayed when the mask has a request registered on it.
457
- */
458
- create(config) {
459
- const fullscreenConfig = new TdLoadingConfig(config);
460
- this.removeComponent(fullscreenConfig.name);
461
- this._context[fullscreenConfig.name] =
462
- this._loadingFactory.createFullScreenComponent(fullscreenConfig);
463
- }
464
- /**
465
- * params:
466
- * - name: string
467
- *
468
- * Removes `loading` component from service context.
469
- */
470
- removeComponent(name) {
471
- var _a;
472
- if (this._context[name]) {
473
- this._context[name].subject.unsubscribe();
474
- if (this._context[name].componentRef) {
475
- (_a = this._context[name].componentRef) === null || _a === void 0 ? void 0 : _a.destroy();
476
- }
477
- delete this._context[name];
478
- }
479
- }
480
- /**
481
- * params:
482
- * - name: string
483
- * - registers?: number
484
- * returns: true if successful
485
- *
486
- * Resolves a request for the loading mask referenced by the name parameter.
487
- * Can optionally pass registers argument to set a number of register calls.
488
- *
489
- * If no paramemeters are used, then default main mask will be used.
490
- *
491
- * e.g. loadingService.register()
492
- */
493
- register(name = 'td-loading-main', registers = 1) {
494
- // try registering into the service if the loading component has been instanciated or if it exists.
495
- if (this._context[name]) {
496
- registers = registers < 1 ? 1 : registers;
497
- this._context[name].times += registers;
498
- this._context[name].subject.next(this._context[name].times);
499
- return true;
500
- }
501
- else {
502
- // if it doesnt exist, set a timeout so its registered after change detection happens
503
- // this in case "register" occured on the `ngOnInit` lifehook cycle.
504
- if (!this._timeouts[name]) {
505
- this._timeouts[name] = setTimeout(() => {
506
- this.register(name, registers);
507
- });
508
- }
509
- else {
510
- // if it timeout occured and still doesnt exist, it means the tiemout wasnt needed so we clear it.
511
- this._clearTimeout(name);
512
- }
513
- }
514
- return false;
515
- }
516
- /**
517
- * params:
518
- * - name: string
519
- * - resolves?: number
520
- * returns: true if successful
521
- *
522
- * Resolves a request for the loading mask referenced by the name parameter.
523
- * Can optionally pass resolves argument to set a number of resolve calls.
524
- *
525
- * If no paramemeters are used, then default main mask will be used.
526
- *
527
- * e.g. loadingService.resolve()
528
- */
529
- resolve(name = 'td-loading-main', resolves = 1) {
530
- var _a;
531
- // clear timeout if the loading component is "resolved" before its "registered"
532
- this._clearTimeout(name);
533
- if (this._context[name]) {
534
- resolves = resolves < 1 ? 1 : resolves;
535
- if (this._context[name].times) {
536
- let times = this._context[name].times;
537
- times -= resolves;
538
- this._context[name].times = times < 0 ? 0 : times;
539
- }
540
- (_a = this._context[name].subject) === null || _a === void 0 ? void 0 : _a.next(this._context[name].times);
541
- return true;
542
- }
543
- return false;
544
- }
545
- /**
546
- * params:
547
- * - name: string
548
- * returns: true if successful
549
- *
550
- * Resolves all request for the loading mask referenced by the name parameter.
551
- *
552
- * If no paramemeters are used, then default main mask will be used.
553
- *
554
- * e.g. loadingService.resolveAll()
555
- */
556
- resolveAll(name = 'td-loading-main') {
557
- var _a;
558
- // clear timeout if the loading component is "resolved" before its "registered"
559
- this._clearTimeout(name);
560
- if (this._context[name]) {
561
- this._context[name].times = 0;
562
- (_a = this._context[name].subject) === null || _a === void 0 ? void 0 : _a.next(this._context[name].times);
563
- return true;
564
- }
565
- return false;
566
- }
567
- /**
568
- * params:
569
- * - name: string
570
- * - value: number
571
- * returns: true if successful
572
- *
573
- * Set value on a loading mask referenced by the name parameter.
574
- * Usage only available if its mode is 'determinate' and if loading is showing.
575
- */
576
- setValue(name, value) {
577
- var _a;
578
- if (this._context[name]) {
579
- const instance = (_a = this._context[name].componentRef) === null || _a === void 0 ? void 0 : _a.instance;
580
- if (instance.mode === LoadingMode.Determinate && instance.animation) {
581
- instance.value = value;
582
- return true;
583
- }
584
- }
585
- return false;
586
- }
587
- /**
588
- * Clears timeout linked to the name.
589
- * @param name Name of the loading component to be cleared
590
- */
591
- _clearTimeout(name) {
592
- clearTimeout(this._timeouts[name]);
593
- delete this._timeouts[name];
594
- }
595
- }
596
- TdLoadingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdLoadingService, deps: [{ token: TdLoadingFactory }], target: i0.ɵɵFactoryTarget.Injectable });
597
- TdLoadingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdLoadingService });
598
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdLoadingService, decorators: [{
599
- type: Injectable
600
- }], ctorParameters: function () { return [{ type: TdLoadingFactory }]; } });
601
- function LOADING_PROVIDER_FACTORY(parent, loadingFactory) {
602
- return parent || new TdLoadingService(loadingFactory);
603
- }
604
- const LOADING_PROVIDER = {
605
- // If there is already a service available, use that. Otherwise, provide a new one.
606
- provide: TdLoadingService,
607
- deps: [[new Optional(), new SkipSelf(), TdLoadingService], TdLoadingFactory],
608
- useFactory: LOADING_PROVIDER_FACTORY,
609
- };
610
-
611
- /**
612
- * Context class for variable reference
613
- */
614
- class TdLoadingContext {
615
- constructor() {
616
- this.$implicit = undefined;
617
- this.tdLoading = undefined;
618
- }
619
- }
620
- // Constant for generation of the id for the next component
621
- let TD_LOADING_NEXT_ID = 0;
622
- class TdLoadingDirective {
623
- /**
624
- * tdLoadingUntil?: any
625
- * If its null, undefined or false it will be used to register requests to the mask.
626
- * Else if its any value that can be resolved as true, it will resolve the mask.
627
- * [name] is optional when using [until], but can still be used to register/resolve it manually.
628
- */
629
- set until(until) {
630
- if (!this.name) {
631
- this.name = 'td-loading-until-' + TD_LOADING_NEXT_ID++;
632
- }
633
- this._context.$implicit = this._context.tdLoading = until;
634
- if (!until) {
635
- this._loadingService.register(this.name);
636
- }
637
- else {
638
- this._loadingService.resolveAll(this.name);
639
- }
640
- }
641
- constructor(_viewContainerRef, _templateRef, _loadingService) {
642
- this._viewContainerRef = _viewContainerRef;
643
- this._templateRef = _templateRef;
644
- this._loadingService = _loadingService;
645
- this._context = new TdLoadingContext();
646
- /**
647
- * tdLoadingType?: LoadingType or ['linear' | 'circular']
648
- * Sets the type of loading mask depending on value.
649
- * Defaults to [LoadingType.Circular | 'circular'].
650
- */
651
- this.type = LoadingType.Circular;
652
- /**
653
- * tdLoadingMode?: LoadingMode or ['determinate' | 'indeterminate']
654
- * Sets the mode of loading mask depending on value.
655
- * Defaults to [LoadingMode.Indeterminate | 'indeterminate'].
656
- */
657
- this.mode = LoadingMode.Indeterminate;
658
- /**
659
- * tdLoadingStrategy?: LoadingStrategy or ['replace' | 'overlay']
660
- * Sets the strategy of loading mask depending on value.
661
- * Defaults to [LoadingMode.Replace | 'replace'].
662
- */
663
- this.strategy = LoadingStrategy.Replace;
664
- /**
665
- * tdLoadingColor?: "primary" | "accent" | "warn"
666
- * Sets the theme color of the loading component. Defaults to "primary"
667
- */
668
- this.color = 'primary';
669
- }
670
- /**
671
- * Registers component in the DOM, so it will be available when calling resolve/register.
672
- */
673
- ngOnInit() {
674
- this._registerComponent();
675
- }
676
- /**
677
- * Remove component when directive is destroyed.
678
- */
679
- ngOnDestroy() {
680
- this._loadingService.removeComponent(this.name);
681
- this._loadingRef = undefined;
682
- }
683
- /**
684
- * Creates [TdLoadingComponent] and attaches it to this directive's [ViewContainerRef].
685
- * Passes this directive's [TemplateRef] to modify DOM depending on loading `strategy`.
686
- */
687
- _registerComponent() {
688
- if (!this.name) {
689
- throw new Error('Name is needed to register loading directive');
690
- }
691
- // Check if `TdLoadingComponent` has been created before trying to add one again.
692
- // There is a weird edge case when using `[routerLinkActive]` that calls the `ngOnInit` twice in a row
693
- if (!this._loadingRef) {
694
- this._loadingRef = this._loadingService.createComponent({
695
- name: this.name,
696
- type: this.type,
697
- mode: this.mode,
698
- color: this.color,
699
- strategy: this.strategy,
700
- }, this._viewContainerRef, this._templateRef, this._context);
701
- }
702
- }
703
- }
704
- TdLoadingDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdLoadingDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }, { token: TdLoadingService }], target: i0.ɵɵFactoryTarget.Directive });
705
- TdLoadingDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.5", type: TdLoadingDirective, selector: "[tdLoading]", inputs: { name: ["tdLoading", "name"], until: ["tdLoadingUntil", "until"], type: ["tdLoadingType", "type"], mode: ["tdLoadingMode", "mode"], strategy: ["tdLoadingStrategy", "strategy"], color: ["tdLoadingColor", "color"] }, ngImport: i0 });
706
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdLoadingDirective, decorators: [{
707
- type: Directive,
708
- args: [{
709
- selector: '[tdLoading]',
710
- }]
711
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }, { type: TdLoadingService }]; }, propDecorators: { name: [{
712
- type: Input,
713
- args: ['tdLoading']
714
- }], until: [{
715
- type: Input,
716
- args: ['tdLoadingUntil']
717
- }], type: [{
718
- type: Input,
719
- args: ['tdLoadingType']
720
- }], mode: [{
721
- type: Input,
722
- args: ['tdLoadingMode']
723
- }], strategy: [{
724
- type: Input,
725
- args: ['tdLoadingStrategy']
726
- }], color: [{
727
- type: Input,
728
- args: ['tdLoadingColor']
729
- }] } });
730
-
731
- const TD_LOADING = [TdLoadingComponent, TdLoadingDirective];
732
- class CovalentLoadingModule {
733
- }
734
- CovalentLoadingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CovalentLoadingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
735
- CovalentLoadingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: CovalentLoadingModule, declarations: [TdLoadingComponent, TdLoadingDirective], imports: [CommonModule,
736
- MatProgressBarModule,
737
- MatProgressSpinnerModule,
738
- OverlayModule,
739
- PortalModule], exports: [TdLoadingComponent, TdLoadingDirective] });
740
- CovalentLoadingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CovalentLoadingModule, providers: [LOADING_FACTORY_PROVIDER, LOADING_PROVIDER], imports: [CommonModule,
741
- MatProgressBarModule,
742
- MatProgressSpinnerModule,
743
- OverlayModule,
744
- PortalModule] });
745
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CovalentLoadingModule, decorators: [{
746
- type: NgModule,
747
- args: [{
748
- imports: [
749
- CommonModule,
750
- MatProgressBarModule,
751
- MatProgressSpinnerModule,
752
- OverlayModule,
753
- PortalModule,
754
- ],
755
- declarations: [TD_LOADING],
756
- exports: [TD_LOADING],
757
- providers: [LOADING_FACTORY_PROVIDER, LOADING_PROVIDER],
758
- }]
759
- }] });
760
-
761
- /**
762
- * Generated bundle index. Do not edit.
763
- */
764
-
765
- export { CovalentLoadingModule, LOADING_FACTORY_PROVIDER, LOADING_FACTORY_PROVIDER_FACTORY, LOADING_PROVIDER, LOADING_PROVIDER_FACTORY, LoadingMode, LoadingStrategy, LoadingStyle, LoadingType, TD_CIRCLE_DIAMETER, TdLoadingComponent, TdLoadingConfig, TdLoadingContext, TdLoadingDirective, TdLoadingDirectiveConfig, TdLoadingFactory, TdLoadingService };
766
- //# sourceMappingURL=covalent-core-loading.mjs.map