@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,621 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { EventEmitter, Directive, Optional, Host, Input, Output, HostBinding, HostListener, forwardRef, ElementRef, Component, ChangeDetectionStrategy, ViewChild, ContentChild, Injectable, NgModule } from '@angular/core';
3
- import * as i2 from '@angular/common';
4
- import { CommonModule } from '@angular/common';
5
- import * as i1 from '@angular/forms';
6
- import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
7
- import * as i5 from '@angular/cdk/portal';
8
- import { TemplatePortalDirective, PortalModule } from '@angular/cdk/portal';
9
- import * as i3 from '@angular/material/icon';
10
- import { MatIconModule } from '@angular/material/icon';
11
- import * as i4 from '@angular/material/button';
12
- import { MatButtonModule } from '@angular/material/button';
13
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
14
- import { ENTER } from '@angular/cdk/keycodes';
15
- import { Subject, merge, fromEvent } from 'rxjs';
16
- import { filter, takeUntil, tap } from 'rxjs/operators';
17
- import { mixinControlValueAccessor, mixinDisabled } from '@covalent/core/common';
18
- import * as i1$1 from '@angular/common/http';
19
- import { HttpRequest, HttpHeaders, HttpParams, HttpEventType } from '@angular/common/http';
20
-
21
- class TdFileSelectDirective {
22
- /**
23
- * multiple?: boolean
24
- * Sets whether multiple files can be selected at once in host element, or just a single file.
25
- * Can also be 'multiple' native attribute.
26
- */
27
- set multiple(multiple) {
28
- this._multiple = coerceBooleanProperty(multiple);
29
- }
30
- /**
31
- * Binds native 'multiple' attribute if [multiple] property is 'true'.
32
- */
33
- get multipleBinding() {
34
- return this._multiple ? '' : undefined;
35
- }
36
- constructor(model) {
37
- this.model = model;
38
- this._multiple = false;
39
- /**
40
- * fileSelect?: function
41
- * Event emitted when a file or files are selected in host [HTMLInputElement].
42
- * Emits a [FileList | File] object.
43
- * Alternative to not use [(ngModel)].
44
- */
45
- this.fileSelect = new EventEmitter();
46
- }
47
- /**
48
- * Listens to 'change' host event to get [HTMLInputElement] files.
49
- * Emits the 'fileSelect' event with a [FileList] or [File] depending if 'multiple' attr exists in host.
50
- * Uses [(ngModel)] if declared, instead of emitting 'fileSelect' event.
51
- */
52
- onChange(event) {
53
- if (event.target instanceof HTMLInputElement) {
54
- const fileInputEl = event.target;
55
- const files = fileInputEl.files || new FileList();
56
- if (files.length) {
57
- const value = this._multiple
58
- ? files.length > 1
59
- ? files
60
- : files[0]
61
- : files[0];
62
- this.model
63
- ? this.model.update.emit(value)
64
- : this.fileSelect.emit(value);
65
- }
66
- }
67
- }
68
- }
69
- TdFileSelectDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileSelectDirective, deps: [{ token: i1.NgModel, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
70
- TdFileSelectDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.5", type: TdFileSelectDirective, selector: "[tdFileSelect]", inputs: { multiple: "multiple" }, outputs: { fileSelect: "fileSelect" }, host: { listeners: { "change": "onChange($event)" }, properties: { "attr.multiple": "this.multipleBinding" } }, ngImport: i0 });
71
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileSelectDirective, decorators: [{
72
- type: Directive,
73
- args: [{
74
- selector: '[tdFileSelect]',
75
- }]
76
- }], ctorParameters: function () {
77
- return [{ type: i1.NgModel, decorators: [{
78
- type: Optional
79
- }, {
80
- type: Host
81
- }] }];
82
- }, propDecorators: { multiple: [{
83
- type: Input
84
- }], fileSelect: [{
85
- type: Output
86
- }], multipleBinding: [{
87
- type: HostBinding,
88
- args: ['attr.multiple']
89
- }], onChange: [{
90
- type: HostListener,
91
- args: ['change', ['$event']]
92
- }] } });
93
-
94
- class TdFileDropBase {
95
- }
96
- class TdFileDropDirective {
97
- /**
98
- * multiple?: boolean
99
- * Sets whether multiple files can be dropped at once in host element, or just a single file.
100
- * Can also be 'multiple' native attribute.
101
- */
102
- set multiple(multiple) {
103
- this._multiple = coerceBooleanProperty(multiple);
104
- }
105
- /**
106
- * Binds native 'multiple' attribute if [multiple] property is 'true'.
107
- */
108
- get multipleBinding() {
109
- return this._multiple ? '' : undefined;
110
- }
111
- /**
112
- * Binds native 'disabled' attribute if [disabled] property is 'true'.
113
- */
114
- get disabledBinding() {
115
- return this.disabled ? '' : undefined;
116
- }
117
- constructor(_renderer, _element, _ngZone) {
118
- this._renderer = _renderer;
119
- this._element = _element;
120
- this._ngZone = _ngZone;
121
- this._multiple = false;
122
- this.disabled = false;
123
- /**
124
- * fileDrop?: function
125
- * Event emitted when a file or files are dropped in host element after being validated.
126
- * Emits a [FileList | File] object.
127
- */
128
- this.fileDrop = new EventEmitter();
129
- }
130
- ngOnInit() {
131
- this._ngZone.runOutsideAngular(() => {
132
- // Listens to 'dragenter' host event to add animation class 'drop-zone' which can be overriden in host.
133
- // Stops event propagation and default action from browser for 'dragenter' event.
134
- this._dragenterListener = this._renderer.listen(this._element.nativeElement, 'dragenter', (event) => {
135
- if (!this.disabled) {
136
- this._renderer.addClass(this._element.nativeElement, 'drop-zone');
137
- }
138
- this._stopEvent(event);
139
- });
140
- // Listens to 'dragleave' host event to remove animation class 'drop-zone'.
141
- // Stops event propagation and default action from browser for 'dragleave' event.
142
- this._dragleaveListener = this._renderer.listen(this._element.nativeElement, 'dragleave', (event) => {
143
- this._renderer.removeClass(this._element.nativeElement, 'drop-zone');
144
- this._stopEvent(event);
145
- });
146
- // Listens to 'dragover' host event to validate transfer items.
147
- // Checks if 'multiple' attr exists in host to allow multiple file drops.
148
- // Stops event propagation and default action from browser for 'dragover' event.
149
- this._dragoverListener = this._renderer.listen(this._element.nativeElement, 'dragover', (event) => {
150
- const transfer = event.dataTransfer || new DataTransfer();
151
- transfer.dropEffect = this._typeCheck(transfer.types);
152
- if (this.disabled ||
153
- (!this._multiple &&
154
- ((transfer.items && transfer.items.length > 1) ||
155
- transfer.mozItemCount > 1))) {
156
- transfer.dropEffect = 'none';
157
- }
158
- else {
159
- transfer.dropEffect = 'copy';
160
- }
161
- this._stopEvent(event);
162
- });
163
- });
164
- }
165
- ngOnDestroy() {
166
- var _a, _b, _c;
167
- (_a = this._dragenterListener) === null || _a === void 0 ? void 0 : _a.call(this);
168
- (_b = this._dragleaveListener) === null || _b === void 0 ? void 0 : _b.call(this);
169
- (_c = this._dragoverListener) === null || _c === void 0 ? void 0 : _c.call(this);
170
- }
171
- /**
172
- * Listens to 'drop' host event to get validated transfer items.
173
- * Emits the 'fileDrop' event with a [FileList] or [File] depending if 'multiple' attr exists in host.
174
- * Stops event propagation and default action from browser for 'drop' event.
175
- */
176
- onDrop(event) {
177
- var _a;
178
- if (!this.disabled) {
179
- const transfer = (_a = event.dataTransfer) !== null && _a !== void 0 ? _a : new DataTransfer();
180
- const files = transfer.files;
181
- if (files.length) {
182
- const value = this._multiple
183
- ? files.length > 1
184
- ? files
185
- : files[0]
186
- : files[0];
187
- this.fileDrop.emit(value);
188
- }
189
- }
190
- this._renderer.removeClass(this._element.nativeElement, 'drop-zone');
191
- this._stopEvent(event);
192
- }
193
- /**
194
- * Validates if the transfer item types are 'Files'.
195
- */
196
- _typeCheck(types) {
197
- let dropEffect = 'none';
198
- if (types &&
199
- ((types.contains && types.contains('Files')) ||
200
- (types.indexOf && types.indexOf('Files') !== -1))) {
201
- dropEffect = 'copy';
202
- }
203
- return dropEffect;
204
- }
205
- _stopEvent(event) {
206
- event.preventDefault();
207
- event.stopPropagation();
208
- }
209
- }
210
- TdFileDropDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileDropDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
211
- TdFileDropDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.5", type: TdFileDropDirective, selector: "[tdFileDrop]", inputs: { multiple: "multiple", disabled: "disabled" }, outputs: { fileDrop: "fileDrop" }, host: { listeners: { "drop": "onDrop($event)" }, properties: { "attr.multiple": "this.multipleBinding", "attr.disabled": "this.disabledBinding" } }, ngImport: i0 });
212
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileDropDirective, decorators: [{
213
- type: Directive,
214
- args: [{ selector: '[tdFileDrop]' }]
215
- }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { multiple: [{
216
- type: Input
217
- }], disabled: [{
218
- type: Input
219
- }], fileDrop: [{
220
- type: Output
221
- }], multipleBinding: [{
222
- type: HostBinding,
223
- args: ['attr.multiple']
224
- }], disabledBinding: [{
225
- type: HostBinding,
226
- args: ['attr.disabled']
227
- }], onDrop: [{
228
- type: HostListener,
229
- args: ['drop', ['$event']]
230
- }] } });
231
-
232
- class TdFileInputLabelDirective extends TemplatePortalDirective {
233
- constructor(templateRef, viewContainerRef) {
234
- super(templateRef, viewContainerRef);
235
- }
236
- }
237
- TdFileInputLabelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileInputLabelDirective, deps: [{ token: i0.TemplateRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
238
- TdFileInputLabelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.5", type: TdFileInputLabelDirective, selector: "[tdFileInputLabel]ng-template", usesInheritance: true, ngImport: i0 });
239
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileInputLabelDirective, decorators: [{
240
- type: Directive,
241
- args: [{
242
- selector: '[tdFileInputLabel]ng-template',
243
- }]
244
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: i0.ViewContainerRef }]; } });
245
- class TdFileInputBase {
246
- constructor(_changeDetectorRef) {
247
- this._changeDetectorRef = _changeDetectorRef;
248
- }
249
- }
250
- const _TdFileInputMixinBase = mixinControlValueAccessor(mixinDisabled(TdFileInputBase));
251
- class TdFileInputComponent extends _TdFileInputMixinBase {
252
- get inputElement() {
253
- return this._inputElement.nativeElement;
254
- }
255
- /**
256
- * multiple?: boolean
257
- * Sets if multiple files can be dropped/selected at once in [TdFileInputComponent].
258
- */
259
- set multiple(multiple) {
260
- this._multiple = coerceBooleanProperty(multiple);
261
- }
262
- get multiple() {
263
- return this._multiple;
264
- }
265
- constructor(_ngZone, _renderer, _changeDetectorRef) {
266
- super(_changeDetectorRef);
267
- this._ngZone = _ngZone;
268
- this._renderer = _renderer;
269
- this._multiple = false;
270
- /**
271
- * select?: function
272
- * Event emitted a file is selected
273
- * Emits a [File | FileList] object.
274
- */
275
- this.selectFile = new EventEmitter();
276
- this._destroy$ = new Subject();
277
- }
278
- ngOnInit() {
279
- this._ngZone.runOutsideAngular(() => {
280
- merge(fromEvent(this._inputButton.nativeElement, 'click'), fromEvent(this._inputButton.nativeElement, 'keyup').pipe(filter((event) => event.keyCode === ENTER)))
281
- .pipe(takeUntil(this._destroy$))
282
- .subscribe(() => this._inputElement.nativeElement.click());
283
- });
284
- }
285
- ngOnDestroy() {
286
- this._destroy$.next();
287
- }
288
- /**
289
- * Method executed when a file is selected.
290
- */
291
- handleSelect(files) {
292
- this.writeValue(files);
293
- this.selectFile.emit(files);
294
- }
295
- /**
296
- * Used to clear the selected files from the [TdFileInputComponent].
297
- */
298
- clear() {
299
- this.writeValue(undefined);
300
- this._renderer.setProperty(this.inputElement, 'value', '');
301
- }
302
- /** Method executed when the disabled value changes */
303
- onDisabledChange(v) {
304
- if (v) {
305
- this.clear();
306
- }
307
- }
308
- /**
309
- * Sets disable to the component. Implemented as part of ControlValueAccessor.
310
- */
311
- setDisabledState(isDisabled) {
312
- this.disabled = isDisabled;
313
- }
314
- }
315
- TdFileInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileInputComponent, deps: [{ token: i0.NgZone }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
316
- TdFileInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: TdFileInputComponent, selector: "td-file-input", inputs: { disabled: "disabled", value: "value", color: "color", multiple: "multiple", accept: "accept" }, outputs: { selectFile: "selectFile" }, providers: [
317
- {
318
- provide: NG_VALUE_ACCESSOR,
319
- useExisting: forwardRef(() => TdFileInputComponent),
320
- multi: true,
321
- },
322
- ], viewQueries: [{ propertyName: "_inputButton", first: true, predicate: ["fileInputButton"], descendants: true, read: ElementRef, static: true }, { propertyName: "_inputElement", first: true, predicate: ["fileInput"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<button\n #fileInputButton\n mat-raised-button\n class=\"td-file-input\"\n type=\"button\"\n [color]=\"color\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\"\n (fileDrop)=\"handleSelect($event)\"\n tdFileDrop\n>\n <ng-content></ng-content>\n</button>\n<input\n #fileInput\n class=\"td-file-input-hidden\"\n type=\"file\"\n [attr.accept]=\"accept\"\n (fileSelect)=\"handleSelect($event)\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\"\n tdFileSelect\n/>\n", styles: [":host .td-file-input{padding-left:8px;padding-right:8px}:host input.td-file-input-hidden{display:none}:host ::ng-deep .mdc-button__label{display:flex;align-items:center}:host .drop-zone{border-radius:3px}:host .drop-zone *{pointer-events:none}\n"], dependencies: [{ kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: TdFileSelectDirective, selector: "[tdFileSelect]", inputs: ["multiple"], outputs: ["fileSelect"] }, { kind: "directive", type: TdFileDropDirective, selector: "[tdFileDrop]", inputs: ["multiple", "disabled"], outputs: ["fileDrop"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
323
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileInputComponent, decorators: [{
324
- type: Component,
325
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, providers: [
326
- {
327
- provide: NG_VALUE_ACCESSOR,
328
- useExisting: forwardRef(() => TdFileInputComponent),
329
- multi: true,
330
- },
331
- ], selector: 'td-file-input', inputs: ['disabled', 'value'], template: "<button\n #fileInputButton\n mat-raised-button\n class=\"td-file-input\"\n type=\"button\"\n [color]=\"color\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\"\n (fileDrop)=\"handleSelect($event)\"\n tdFileDrop\n>\n <ng-content></ng-content>\n</button>\n<input\n #fileInput\n class=\"td-file-input-hidden\"\n type=\"file\"\n [attr.accept]=\"accept\"\n (fileSelect)=\"handleSelect($event)\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\"\n tdFileSelect\n/>\n", styles: [":host .td-file-input{padding-left:8px;padding-right:8px}:host input.td-file-input-hidden{display:none}:host ::ng-deep .mdc-button__label{display:flex;align-items:center}:host .drop-zone{border-radius:3px}:host .drop-zone *{pointer-events:none}\n"] }]
332
- }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { _inputButton: [{
333
- type: ViewChild,
334
- args: ['fileInputButton', { static: true, read: ElementRef }]
335
- }], _inputElement: [{
336
- type: ViewChild,
337
- args: ['fileInput', { static: true }]
338
- }], color: [{
339
- type: Input
340
- }], multiple: [{
341
- type: Input
342
- }], accept: [{
343
- type: Input
344
- }], selectFile: [{
345
- type: Output
346
- }] } });
347
-
348
- class TdFileUploadBase {
349
- constructor(_changeDetectorRef) {
350
- this._changeDetectorRef = _changeDetectorRef;
351
- }
352
- }
353
- class TdFileUploadComponent {
354
- /**
355
- * multiple?: boolean
356
- * Sets if multiple files can be dropped/selected at once in [TdFileUploadComponent].
357
- */
358
- set multiple(multiple) {
359
- this._multiple = coerceBooleanProperty(multiple);
360
- }
361
- get multiple() {
362
- return this._multiple;
363
- }
364
- /**
365
- * required?: boolean
366
- * Forces at least one file upload.
367
- * Defaults to 'false'
368
- */
369
- set required(required) {
370
- this._required = coerceBooleanProperty(required);
371
- }
372
- get required() {
373
- return this._required;
374
- }
375
- set disabled(disabled) {
376
- this._disabled = disabled;
377
- this.onDisabledChange(disabled);
378
- }
379
- get disabled() {
380
- return this._disabled;
381
- }
382
- constructor(_changeDetectorRef) {
383
- this._changeDetectorRef = _changeDetectorRef;
384
- this._multiple = false;
385
- this._required = false;
386
- this._disabled = false;
387
- /**
388
- * defaultColor?: 'accent' | 'primary' | 'warn'
389
- * Sets browse button color. Uses same color palette accepted as [MatButton] and defaults to 'primary'.
390
- */
391
- this.defaultColor = 'primary';
392
- /**
393
- * activeColor?: 'accent' | 'primary' | 'warn'
394
- * Sets upload button color. Uses same color palette accepted as [MatButton] and defaults to 'accent'.
395
- */
396
- this.activeColor = 'accent';
397
- /**
398
- * cancelColor?: 'accent' | 'primary' | 'warn'
399
- * Sets cancel button color. Uses same color palette accepted as [MatButton] and defaults to 'warn'.
400
- */
401
- this.cancelColor = 'warn';
402
- /**
403
- * select?: function
404
- * Event emitted when a file is selected.
405
- * Emits a [File | FileList] object.
406
- */
407
- this.selectFile = new EventEmitter();
408
- /**
409
- * upload?: function
410
- * Event emitted when upload button is clicked.
411
- * Emits a [File | FileList] object.
412
- */
413
- this.upload = new EventEmitter();
414
- /**
415
- * cancel?: function
416
- * Event emitted when cancel button is clicked.
417
- */
418
- this.cancel = new EventEmitter();
419
- }
420
- writeValue(value) {
421
- this.value = value;
422
- this._changeDetectorRef.markForCheck();
423
- }
424
- registerOnChange() {
425
- //
426
- }
427
- registerOnTouched() {
428
- //
429
- }
430
- /**
431
- * Method executed when upload button is clicked.
432
- */
433
- uploadPressed() {
434
- if (this.value) {
435
- this.upload.emit(this.value);
436
- }
437
- }
438
- /**
439
- * Method executed when a file is selected.
440
- */
441
- handleSelect(value) {
442
- this.value = value;
443
- this.selectFile.emit(value);
444
- }
445
- /**
446
- * Methods executed when cancel button is clicked.
447
- * Clears files.
448
- */
449
- _cancel() {
450
- this.value = undefined;
451
- this.cancel.emit();
452
- // check if the file input is rendered before clearing it
453
- if (this.fileInput) {
454
- this.fileInput.clear();
455
- }
456
- }
457
- /** Method executed when the disabled value changes */
458
- onDisabledChange(v) {
459
- if (v) {
460
- this._cancel();
461
- }
462
- }
463
- }
464
- TdFileUploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileUploadComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
465
- TdFileUploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: TdFileUploadComponent, selector: "td-file-upload", inputs: { defaultColor: "defaultColor", activeColor: "activeColor", cancelColor: "cancelColor", multiple: "multiple", required: "required", accept: "accept", disabled: "disabled", value: "value" }, outputs: { selectFile: "selectFile", upload: "upload", cancel: "cancel" }, providers: [
466
- {
467
- provide: NG_VALUE_ACCESSOR,
468
- useExisting: forwardRef(() => TdFileUploadComponent),
469
- multi: true,
470
- },
471
- ], queries: [{ propertyName: "inputLabel", first: true, predicate: TdFileInputLabelDirective, descendants: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: TdFileInputComponent, descendants: true }], ngImport: i0, template: "<td-file-input\n *ngIf=\"!value\"\n [(ngModel)]=\"value\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\"\n [accept]=\"accept\"\n [color]=\"defaultColor\"\n (selectFile)=\"(handleSelect)\"\n>\n <ng-template [cdkPortalOutlet]=\"inputLabel\" [ngIf]=\"true\"></ng-template>\n</td-file-input>\n<div *ngIf=\"value\">\n <button\n #fileUpload\n class=\"td-file-upload\"\n mat-raised-button\n type=\"button\"\n [color]=\"activeColor\"\n (keyup.delete)=\"_cancel()\"\n (keyup.backspace)=\"_cancel()\"\n (keyup.escape)=\"_cancel()\"\n (click)=\"uploadPressed()\"\n >\n <ng-content></ng-content>\n </button>\n <button\n mat-icon-button\n type=\"button\"\n class=\"td-file-upload-cancel\"\n [color]=\"cancelColor\"\n (click)=\"_cancel()\"\n >\n <mat-icon>cancel</mat-icon>\n </button>\n</div>\n", styles: [".td-file-upload{padding-left:8px;padding-right:8px}.td-file-upload-cancel{height:24px;width:24px;position:relative;top:24px;left:-12px}::ng-deep [dir=rtl] .td-file-upload-cancel{right:-12px;left:0}.td-file-upload-cancel mat-icon{border-radius:12px;vertical-align:baseline}.drop-zone{border-radius:3px}.drop-zone *{pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i4.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i5.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: TdFileInputComponent, selector: "td-file-input", inputs: ["disabled", "value", "color", "multiple", "accept"], outputs: ["selectFile"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
472
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileUploadComponent, decorators: [{
473
- type: Component,
474
- args: [{ changeDetection: ChangeDetectionStrategy.OnPush, providers: [
475
- {
476
- provide: NG_VALUE_ACCESSOR,
477
- useExisting: forwardRef(() => TdFileUploadComponent),
478
- multi: true,
479
- },
480
- ], selector: 'td-file-upload', template: "<td-file-input\n *ngIf=\"!value\"\n [(ngModel)]=\"value\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\"\n [accept]=\"accept\"\n [color]=\"defaultColor\"\n (selectFile)=\"(handleSelect)\"\n>\n <ng-template [cdkPortalOutlet]=\"inputLabel\" [ngIf]=\"true\"></ng-template>\n</td-file-input>\n<div *ngIf=\"value\">\n <button\n #fileUpload\n class=\"td-file-upload\"\n mat-raised-button\n type=\"button\"\n [color]=\"activeColor\"\n (keyup.delete)=\"_cancel()\"\n (keyup.backspace)=\"_cancel()\"\n (keyup.escape)=\"_cancel()\"\n (click)=\"uploadPressed()\"\n >\n <ng-content></ng-content>\n </button>\n <button\n mat-icon-button\n type=\"button\"\n class=\"td-file-upload-cancel\"\n [color]=\"cancelColor\"\n (click)=\"_cancel()\"\n >\n <mat-icon>cancel</mat-icon>\n </button>\n</div>\n", styles: [".td-file-upload{padding-left:8px;padding-right:8px}.td-file-upload-cancel{height:24px;width:24px;position:relative;top:24px;left:-12px}::ng-deep [dir=rtl] .td-file-upload-cancel{right:-12px;left:0}.td-file-upload-cancel mat-icon{border-radius:12px;vertical-align:baseline}.drop-zone{border-radius:3px}.drop-zone *{pointer-events:none}\n"] }]
481
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { fileInput: [{
482
- type: ViewChild,
483
- args: [TdFileInputComponent]
484
- }], inputLabel: [{
485
- type: ContentChild,
486
- args: [TdFileInputLabelDirective]
487
- }], defaultColor: [{
488
- type: Input
489
- }], activeColor: [{
490
- type: Input
491
- }], cancelColor: [{
492
- type: Input
493
- }], multiple: [{
494
- type: Input
495
- }], required: [{
496
- type: Input
497
- }], accept: [{
498
- type: Input
499
- }], disabled: [{
500
- type: Input
501
- }], value: [{
502
- type: Input
503
- }], selectFile: [{
504
- type: Output
505
- }], upload: [{
506
- type: Output
507
- }], cancel: [{
508
- type: Output
509
- }] } });
510
-
511
- class TdFileService {
512
- /**
513
- * Gets progress observable to keep track of the files being uploaded.
514
- * Needs to be supported by backend.
515
- */
516
- get progress() {
517
- return this._progressObservable;
518
- }
519
- /**
520
- * Creates a new instance
521
- * @param _http the http client instance
522
- * @breaking-change 3.0.0 remove 'Optional' decorator once the legay upload method is removed
523
- */
524
- constructor(_http) {
525
- this._http = _http;
526
- this._progressSubject = new Subject();
527
- this._progressObservable = this._progressSubject.asObservable();
528
- }
529
- /**
530
- * Uploads a file to a URL.
531
- */
532
- send(url, method, body, { headers, params } = {}) {
533
- if (!this._http) {
534
- throw new Error('The HttpClient module needs to be imported at root module level');
535
- }
536
- const req = new HttpRequest(method.toUpperCase(), url, body, {
537
- reportProgress: true,
538
- headers: new HttpHeaders(headers || {}),
539
- params: new HttpParams({ fromObject: params || {} }),
540
- });
541
- return this._http
542
- .request(req)
543
- .pipe(tap((event) => this.handleEvent(event)));
544
- }
545
- handleEvent(event) {
546
- var _a;
547
- switch (event.type) {
548
- case HttpEventType.Sent:
549
- this._progressSubject.next(0);
550
- break;
551
- case HttpEventType.UploadProgress:
552
- this._progressSubject.next(Math.round((100 * event.loaded) / ((_a = event.total) !== null && _a !== void 0 ? _a : 0)));
553
- break;
554
- case HttpEventType.Response:
555
- this._progressSubject.next(100);
556
- break;
557
- default:
558
- break;
559
- }
560
- }
561
- }
562
- TdFileService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileService, deps: [{ token: i1$1.HttpClient, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
563
- TdFileService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileService });
564
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdFileService, decorators: [{
565
- type: Injectable
566
- }], ctorParameters: function () {
567
- return [{ type: i1$1.HttpClient, decorators: [{
568
- type: Optional
569
- }] }];
570
- } });
571
-
572
- const TD_FILE = [
573
- TdFileSelectDirective,
574
- TdFileDropDirective,
575
- TdFileUploadComponent,
576
- TdFileInputComponent,
577
- TdFileInputLabelDirective,
578
- ];
579
- class CovalentFileModule {
580
- }
581
- CovalentFileModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CovalentFileModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
582
- CovalentFileModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: CovalentFileModule, declarations: [TdFileSelectDirective,
583
- TdFileDropDirective,
584
- TdFileUploadComponent,
585
- TdFileInputComponent,
586
- TdFileInputLabelDirective], imports: [FormsModule,
587
- CommonModule,
588
- MatIconModule,
589
- MatButtonModule,
590
- PortalModule], exports: [TdFileSelectDirective,
591
- TdFileDropDirective,
592
- TdFileUploadComponent,
593
- TdFileInputComponent,
594
- TdFileInputLabelDirective] });
595
- CovalentFileModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CovalentFileModule, providers: [TdFileService], imports: [FormsModule,
596
- CommonModule,
597
- MatIconModule,
598
- MatButtonModule,
599
- PortalModule] });
600
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CovalentFileModule, decorators: [{
601
- type: NgModule,
602
- args: [{
603
- imports: [
604
- FormsModule,
605
- CommonModule,
606
- MatIconModule,
607
- MatButtonModule,
608
- PortalModule,
609
- ],
610
- declarations: [TD_FILE],
611
- exports: [TD_FILE],
612
- providers: [TdFileService],
613
- }]
614
- }] });
615
-
616
- /**
617
- * Generated bundle index. Do not edit.
618
- */
619
-
620
- export { CovalentFileModule, TdFileDropBase, TdFileDropDirective, TdFileInputBase, TdFileInputComponent, TdFileInputLabelDirective, TdFileSelectDirective, TdFileService, TdFileUploadBase, TdFileUploadComponent, _TdFileInputMixinBase };
621
- //# sourceMappingURL=covalent-core-file.mjs.map