@covalent/core 3.1.2 → 4.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 (317) hide show
  1. package/bundles/covalent-core-user-profile.umd.js +1 -9
  2. package/bundles/covalent-core-user-profile.umd.js.map +1 -1
  3. package/bundles/covalent-core-user-profile.umd.min.js.map +1 -1
  4. package/esm2015/user-profile/user-profile.module.js +3 -11
  5. package/fesm2015/covalent-core-user-profile.js +1 -9
  6. package/fesm2015/covalent-core-user-profile.js.map +1 -1
  7. package/package.json +1 -1
  8. package/schematics/components.js +1 -14
  9. package/schematics/components.js.map +1 -1
  10. package/theming/_all-theme.scss +0 -14
  11. package/theming/prebuilt/blue-grey-deep-orange.css +0 -248
  12. package/theming/prebuilt/blue-grey-deep-orange.css.map +1 -1
  13. package/theming/prebuilt/blue-orange.css +0 -248
  14. package/theming/prebuilt/blue-orange.css.map +1 -1
  15. package/theming/prebuilt/indigo-pink.css +0 -248
  16. package/theming/prebuilt/indigo-pink.css.map +1 -1
  17. package/theming/prebuilt/orange-light-blue.css +0 -248
  18. package/theming/prebuilt/orange-light-blue.css.map +1 -1
  19. package/theming/prebuilt/teal-orange.css +0 -248
  20. package/theming/prebuilt/teal-orange.css.map +1 -1
  21. package/typography/_all-typography.scss +0 -10
  22. package/user-profile/covalent-core-user-profile.metadata.json +1 -1
  23. package/bundles/covalent-core-chips.umd.js +0 -1507
  24. package/bundles/covalent-core-chips.umd.js.map +0 -1
  25. package/bundles/covalent-core-chips.umd.min.js +0 -16
  26. package/bundles/covalent-core-chips.umd.min.js.map +0 -1
  27. package/bundles/covalent-core-data-table.umd.js +0 -2756
  28. package/bundles/covalent-core-data-table.umd.js.map +0 -1
  29. package/bundles/covalent-core-data-table.umd.min.js +0 -16
  30. package/bundles/covalent-core-data-table.umd.min.js.map +0 -1
  31. package/bundles/covalent-core-expansion-panel.umd.js +0 -853
  32. package/bundles/covalent-core-expansion-panel.umd.js.map +0 -1
  33. package/bundles/covalent-core-expansion-panel.umd.min.js +0 -16
  34. package/bundles/covalent-core-expansion-panel.umd.min.js.map +0 -1
  35. package/bundles/covalent-core-loading.umd.js +0 -1534
  36. package/bundles/covalent-core-loading.umd.js.map +0 -1
  37. package/bundles/covalent-core-loading.umd.min.js +0 -16
  38. package/bundles/covalent-core-loading.umd.min.js.map +0 -1
  39. package/bundles/covalent-core-media.umd.js +0 -749
  40. package/bundles/covalent-core-media.umd.js.map +0 -1
  41. package/bundles/covalent-core-media.umd.min.js +0 -16
  42. package/bundles/covalent-core-media.umd.min.js.map +0 -1
  43. package/bundles/covalent-core-nav-links.umd.js +0 -197
  44. package/bundles/covalent-core-nav-links.umd.js.map +0 -1
  45. package/bundles/covalent-core-nav-links.umd.min.js +0 -2
  46. package/bundles/covalent-core-nav-links.umd.min.js.map +0 -1
  47. package/bundles/covalent-core-notifications.umd.js +0 -275
  48. package/bundles/covalent-core-notifications.umd.js.map +0 -1
  49. package/bundles/covalent-core-notifications.umd.min.js +0 -2
  50. package/bundles/covalent-core-notifications.umd.min.js.map +0 -1
  51. package/bundles/covalent-core-paging.umd.js +0 -491
  52. package/bundles/covalent-core-paging.umd.js.map +0 -1
  53. package/bundles/covalent-core-paging.umd.min.js +0 -2
  54. package/bundles/covalent-core-paging.umd.min.js.map +0 -1
  55. package/bundles/covalent-core-sidesheet.umd.js +0 -145
  56. package/bundles/covalent-core-sidesheet.umd.js.map +0 -1
  57. package/bundles/covalent-core-sidesheet.umd.min.js +0 -2
  58. package/bundles/covalent-core-sidesheet.umd.min.js.map +0 -1
  59. package/bundles/covalent-core-steps.umd.js +0 -1756
  60. package/bundles/covalent-core-steps.umd.js.map +0 -1
  61. package/bundles/covalent-core-steps.umd.min.js +0 -16
  62. package/bundles/covalent-core-steps.umd.min.js.map +0 -1
  63. package/bundles/covalent-core-tab-select.umd.js +0 -732
  64. package/bundles/covalent-core-tab-select.umd.js.map +0 -1
  65. package/bundles/covalent-core-tab-select.umd.min.js +0 -16
  66. package/bundles/covalent-core-tab-select.umd.min.js.map +0 -1
  67. package/bundles/covalent-core-virtual-scroll.umd.js +0 -785
  68. package/bundles/covalent-core-virtual-scroll.umd.js.map +0 -1
  69. package/bundles/covalent-core-virtual-scroll.umd.min.js +0 -16
  70. package/bundles/covalent-core-virtual-scroll.umd.min.js.map +0 -1
  71. package/chips/README.md +0 -99
  72. package/chips/_chips-theme.scss +0 -87
  73. package/chips/chips.component.d.ts +0 -287
  74. package/chips/chips.component.scss +0 -147
  75. package/chips/chips.module.d.ts +0 -2
  76. package/chips/covalent-core-chips.d.ts +0 -4
  77. package/chips/covalent-core-chips.metadata.json +0 -1
  78. package/chips/index.d.ts +0 -1
  79. package/chips/package.json +0 -11
  80. package/chips/public-api.d.ts +0 -2
  81. package/data-table/README.md +0 -134
  82. package/data-table/_data-table-theme.scss +0 -115
  83. package/data-table/covalent-core-data-table.d.ts +0 -4
  84. package/data-table/covalent-core-data-table.metadata.json +0 -1
  85. package/data-table/data-table-cell/data-table-cell.component.d.ts +0 -22
  86. package/data-table/data-table-cell/data-table-cell.component.scss +0 -58
  87. package/data-table/data-table-column/data-table-column.component.d.ts +0 -63
  88. package/data-table/data-table-column/data-table-column.component.scss +0 -80
  89. package/data-table/data-table-row/data-table-row.component.d.ts +0 -20
  90. package/data-table/data-table-row/data-table-row.component.scss +0 -12
  91. package/data-table/data-table-table/data-table-table.component.d.ts +0 -6
  92. package/data-table/data-table-table/data-table-table.component.scss +0 -7
  93. package/data-table/data-table.component.d.ts +0 -356
  94. package/data-table/data-table.component.scss +0 -93
  95. package/data-table/data-table.module.d.ts +0 -2
  96. package/data-table/directives/data-table-template.directive.d.ts +0 -6
  97. package/data-table/index.d.ts +0 -1
  98. package/data-table/package.json +0 -11
  99. package/data-table/public-api.d.ts +0 -8
  100. package/data-table/services/data-table.service.d.ts +0 -31
  101. package/esm2015/chips/chips.component.js +0 -1115
  102. package/esm2015/chips/chips.module.js +0 -23
  103. package/esm2015/chips/covalent-core-chips.js +0 -10
  104. package/esm2015/chips/index.js +0 -7
  105. package/esm2015/chips/public-api.js +0 -8
  106. package/esm2015/data-table/covalent-core-data-table.js +0 -10
  107. package/esm2015/data-table/data-table-cell/data-table-cell.component.js +0 -88
  108. package/esm2015/data-table/data-table-column/data-table-column.component.js +0 -218
  109. package/esm2015/data-table/data-table-row/data-table-row.component.js +0 -132
  110. package/esm2015/data-table/data-table-table/data-table-table.component.js +0 -43
  111. package/esm2015/data-table/data-table.component.js +0 -1640
  112. package/esm2015/data-table/data-table.module.js +0 -39
  113. package/esm2015/data-table/directives/data-table-template.directive.js +0 -32
  114. package/esm2015/data-table/index.js +0 -7
  115. package/esm2015/data-table/public-api.js +0 -14
  116. package/esm2015/data-table/services/data-table.service.js +0 -116
  117. package/esm2015/expansion-panel/covalent-core-expansion-panel.js +0 -10
  118. package/esm2015/expansion-panel/expansion-panel-group.component.js +0 -212
  119. package/esm2015/expansion-panel/expansion-panel.component.js +0 -272
  120. package/esm2015/expansion-panel/expansion-panel.module.js +0 -31
  121. package/esm2015/expansion-panel/index.js +0 -7
  122. package/esm2015/expansion-panel/public-api.js +0 -9
  123. package/esm2015/loading/covalent-core-loading.js +0 -10
  124. package/esm2015/loading/directives/loading.directive.js +0 -231
  125. package/esm2015/loading/index.js +0 -7
  126. package/esm2015/loading/loading.component.js +0 -302
  127. package/esm2015/loading/loading.module.js +0 -30
  128. package/esm2015/loading/public-api.js +0 -11
  129. package/esm2015/loading/services/loading.factory.js +0 -297
  130. package/esm2015/loading/services/loading.service.js +0 -319
  131. package/esm2015/media/covalent-core-media.js +0 -10
  132. package/esm2015/media/directives/media-toggle.directive.js +0 -207
  133. package/esm2015/media/index.js +0 -7
  134. package/esm2015/media/media.module.js +0 -20
  135. package/esm2015/media/public-api.js +0 -9
  136. package/esm2015/media/services/media.service.js +0 -169
  137. package/esm2015/nav-links/covalent-core-nav-links.js +0 -10
  138. package/esm2015/nav-links/index.js +0 -7
  139. package/esm2015/nav-links/nav-links.component.js +0 -138
  140. package/esm2015/nav-links/nav-links.module.js +0 -37
  141. package/esm2015/nav-links/public-api.js +0 -8
  142. package/esm2015/notifications/covalent-core-notifications.js +0 -10
  143. package/esm2015/notifications/index.js +0 -7
  144. package/esm2015/notifications/notification-count.component.js +0 -191
  145. package/esm2015/notifications/notifications.module.js +0 -20
  146. package/esm2015/notifications/public-api.js +0 -8
  147. package/esm2015/paging/covalent-core-paging.js +0 -10
  148. package/esm2015/paging/index.js +0 -7
  149. package/esm2015/paging/paging-bar.component.js +0 -412
  150. package/esm2015/paging/paging.module.js +0 -20
  151. package/esm2015/paging/public-api.js +0 -8
  152. package/esm2015/sidesheet/covalent-core-sidesheet.js +0 -10
  153. package/esm2015/sidesheet/index.js +0 -7
  154. package/esm2015/sidesheet/public-api.js +0 -8
  155. package/esm2015/sidesheet/sidesheet.component.js +0 -72
  156. package/esm2015/sidesheet/sidesheet.module.js +0 -27
  157. package/esm2015/steps/covalent-core-steps.js +0 -10
  158. package/esm2015/steps/index.js +0 -7
  159. package/esm2015/steps/nav/nav-step-link/nav-step-link.component.js +0 -144
  160. package/esm2015/steps/nav/nav-steps-horizontal/nav-steps-horizontal.component.js +0 -371
  161. package/esm2015/steps/nav/nav-steps-vertical/nav-steps-vertical.component.js +0 -130
  162. package/esm2015/steps/public-api.js +0 -14
  163. package/esm2015/steps/step-body/step-body.component.js +0 -83
  164. package/esm2015/steps/step-header/step-header.component.js +0 -79
  165. package/esm2015/steps/step.component.js +0 -312
  166. package/esm2015/steps/steps.component.js +0 -234
  167. package/esm2015/steps/steps.module.js +0 -44
  168. package/esm2015/tab-select/covalent-core-tab-select.js +0 -10
  169. package/esm2015/tab-select/index.js +0 -7
  170. package/esm2015/tab-select/public-api.js +0 -9
  171. package/esm2015/tab-select/tab-option.component.js +0 -82
  172. package/esm2015/tab-select/tab-select.component.js +0 -291
  173. package/esm2015/tab-select/tab-select.module.js +0 -31
  174. package/esm2015/virtual-scroll/covalent-core-virtual-scroll.js +0 -10
  175. package/esm2015/virtual-scroll/index.js +0 -7
  176. package/esm2015/virtual-scroll/public-api.js +0 -9
  177. package/esm2015/virtual-scroll/virtual-scroll-container.component.js +0 -391
  178. package/esm2015/virtual-scroll/virtual-scroll-row.directive.js +0 -25
  179. package/esm2015/virtual-scroll/virtual-scroll.module.js +0 -21
  180. package/expansion-panel/README.md +0 -116
  181. package/expansion-panel/_expansion-panel-theme.scss +0 -80
  182. package/expansion-panel/covalent-core-expansion-panel.d.ts +0 -4
  183. package/expansion-panel/covalent-core-expansion-panel.metadata.json +0 -1
  184. package/expansion-panel/expansion-panel-group.component.d.ts +0 -31
  185. package/expansion-panel/expansion-panel-group.component.scss +0 -0
  186. package/expansion-panel/expansion-panel.component.d.ts +0 -82
  187. package/expansion-panel/expansion-panel.component.scss +0 -50
  188. package/expansion-panel/expansion-panel.module.d.ts +0 -2
  189. package/expansion-panel/index.d.ts +0 -1
  190. package/expansion-panel/package.json +0 -11
  191. package/expansion-panel/public-api.d.ts +0 -3
  192. package/fesm2015/covalent-core-chips.js +0 -1151
  193. package/fesm2015/covalent-core-chips.js.map +0 -1
  194. package/fesm2015/covalent-core-data-table.js +0 -2309
  195. package/fesm2015/covalent-core-data-table.js.map +0 -1
  196. package/fesm2015/covalent-core-expansion-panel.js +0 -528
  197. package/fesm2015/covalent-core-expansion-panel.js.map +0 -1
  198. package/fesm2015/covalent-core-loading.js +0 -1179
  199. package/fesm2015/covalent-core-loading.js.map +0 -1
  200. package/fesm2015/covalent-core-media.js +0 -411
  201. package/fesm2015/covalent-core-media.js.map +0 -1
  202. package/fesm2015/covalent-core-nav-links.js +0 -193
  203. package/fesm2015/covalent-core-nav-links.js.map +0 -1
  204. package/fesm2015/covalent-core-notifications.js +0 -228
  205. package/fesm2015/covalent-core-notifications.js.map +0 -1
  206. package/fesm2015/covalent-core-paging.js +0 -451
  207. package/fesm2015/covalent-core-paging.js.map +0 -1
  208. package/fesm2015/covalent-core-sidesheet.js +0 -118
  209. package/fesm2015/covalent-core-sidesheet.js.map +0 -1
  210. package/fesm2015/covalent-core-steps.js +0 -1384
  211. package/fesm2015/covalent-core-steps.js.map +0 -1
  212. package/fesm2015/covalent-core-tab-select.js +0 -416
  213. package/fesm2015/covalent-core-tab-select.js.map +0 -1
  214. package/fesm2015/covalent-core-virtual-scroll.js +0 -453
  215. package/fesm2015/covalent-core-virtual-scroll.js.map +0 -1
  216. package/loading/README.md +0 -180
  217. package/loading/_loading-theme.scss +0 -10
  218. package/loading/covalent-core-loading.d.ts +0 -4
  219. package/loading/covalent-core-loading.metadata.json +0 -1
  220. package/loading/directives/loading.directive.d.ts +0 -71
  221. package/loading/index.d.ts +0 -1
  222. package/loading/loading.component.d.ts +0 -87
  223. package/loading/loading.component.scss +0 -42
  224. package/loading/loading.module.d.ts +0 -2
  225. package/loading/package.json +0 -11
  226. package/loading/public-api.d.ts +0 -5
  227. package/loading/services/loading.factory.d.ts +0 -66
  228. package/loading/services/loading.service.d.ts +0 -118
  229. package/media/covalent-core-media.d.ts +0 -4
  230. package/media/covalent-core-media.metadata.json +0 -1
  231. package/media/directives/media-toggle.directive.d.ts +0 -42
  232. package/media/index.d.ts +0 -1
  233. package/media/media.module.d.ts +0 -2
  234. package/media/package.json +0 -11
  235. package/media/public-api.d.ts +0 -3
  236. package/media/services/media.service.d.ts +0 -31
  237. package/nav-links/README.md +0 -1
  238. package/nav-links/covalent-core-nav-links.d.ts +0 -4
  239. package/nav-links/covalent-core-nav-links.metadata.json +0 -1
  240. package/nav-links/index.d.ts +0 -1
  241. package/nav-links/nav-links.component.d.ts +0 -51
  242. package/nav-links/nav-links.component.scss +0 -15
  243. package/nav-links/nav-links.module.d.ts +0 -2
  244. package/nav-links/package.json +0 -11
  245. package/nav-links/public-api.d.ts +0 -2
  246. package/notifications/README.md +0 -69
  247. package/notifications/_notification-count-theme.scss +0 -27
  248. package/notifications/covalent-core-notifications.d.ts +0 -4
  249. package/notifications/covalent-core-notifications.metadata.json +0 -1
  250. package/notifications/index.d.ts +0 -1
  251. package/notifications/notification-count.component.d.ts +0 -74
  252. package/notifications/notification-count.component.scss +0 -90
  253. package/notifications/notifications.module.d.ts +0 -2
  254. package/notifications/package.json +0 -11
  255. package/notifications/public-api.d.ts +0 -2
  256. package/paging/README.md +0 -141
  257. package/paging/_paging-bar-theme.scss +0 -26
  258. package/paging/covalent-core-paging.d.ts +0 -4
  259. package/paging/covalent-core-paging.metadata.json +0 -1
  260. package/paging/index.d.ts +0 -1
  261. package/paging/package.json +0 -11
  262. package/paging/paging-bar.component.d.ts +0 -115
  263. package/paging/paging-bar.component.scss +0 -23
  264. package/paging/paging.module.d.ts +0 -2
  265. package/paging/public-api.d.ts +0 -2
  266. package/sidesheet/README.md +0 -68
  267. package/sidesheet/covalent-core-sidesheet.d.ts +0 -4
  268. package/sidesheet/covalent-core-sidesheet.metadata.json +0 -1
  269. package/sidesheet/index.d.ts +0 -1
  270. package/sidesheet/package.json +0 -11
  271. package/sidesheet/public-api.d.ts +0 -2
  272. package/sidesheet/sidesheet.component.d.ts +0 -13
  273. package/sidesheet/sidesheet.component.scss +0 -101
  274. package/sidesheet/sidesheet.module.d.ts +0 -2
  275. package/steps/README.md +0 -159
  276. package/steps/_steps-theme.scss +0 -108
  277. package/steps/covalent-core-steps.d.ts +0 -4
  278. package/steps/covalent-core-steps.metadata.json +0 -1
  279. package/steps/index.d.ts +0 -1
  280. package/steps/nav/README.md +0 -90
  281. package/steps/nav/nav-step-link/nav-step-link.component.d.ts +0 -42
  282. package/steps/nav/nav-step-link/nav-step-link.component.scss +0 -17
  283. package/steps/nav/nav-steps-horizontal/nav-steps-horizontal.component.d.ts +0 -79
  284. package/steps/nav/nav-steps-horizontal/nav-steps-horizontal.component.scss +0 -83
  285. package/steps/nav/nav-steps-vertical/nav-steps-vertical.component.d.ts +0 -18
  286. package/steps/nav/nav-steps-vertical/nav-steps-vertical.component.scss +0 -18
  287. package/steps/package.json +0 -11
  288. package/steps/public-api.d.ts +0 -8
  289. package/steps/step-body/step-body.component.d.ts +0 -25
  290. package/steps/step-body/step-body.component.scss +0 -29
  291. package/steps/step-header/step-header.component.d.ts +0 -35
  292. package/steps/step-header/step-header.component.scss +0 -90
  293. package/steps/step.component.d.ts +0 -97
  294. package/steps/steps.component.d.ts +0 -60
  295. package/steps/steps.component.scss +0 -55
  296. package/steps/steps.module.d.ts +0 -2
  297. package/tab-select/README.md +0 -93
  298. package/tab-select/covalent-core-tab-select.d.ts +0 -4
  299. package/tab-select/covalent-core-tab-select.metadata.json +0 -1
  300. package/tab-select/index.d.ts +0 -1
  301. package/tab-select/package.json +0 -11
  302. package/tab-select/public-api.d.ts +0 -3
  303. package/tab-select/tab-option.component.d.ts +0 -20
  304. package/tab-select/tab-option.component.scss +0 -0
  305. package/tab-select/tab-select.component.d.ts +0 -62
  306. package/tab-select/tab-select.component.scss +0 -3
  307. package/tab-select/tab-select.module.d.ts +0 -2
  308. package/virtual-scroll/README.md +0 -68
  309. package/virtual-scroll/covalent-core-virtual-scroll.d.ts +0 -4
  310. package/virtual-scroll/covalent-core-virtual-scroll.metadata.json +0 -1
  311. package/virtual-scroll/index.d.ts +0 -1
  312. package/virtual-scroll/package.json +0 -11
  313. package/virtual-scroll/public-api.d.ts +0 -3
  314. package/virtual-scroll/virtual-scroll-container.component.d.ts +0 -73
  315. package/virtual-scroll/virtual-scroll-container.component.scss +0 -7
  316. package/virtual-scroll/virtual-scroll-row.directive.d.ts +0 -5
  317. package/virtual-scroll/virtual-scroll.module.d.ts +0 -2
@@ -1,1179 +0,0 @@
1
- import { Component, ElementRef, ChangeDetectorRef, Injectable, ComponentFactoryResolver, Injector, Optional, SkipSelf, Directive, ViewContainerRef, TemplateRef, Input, NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { ComponentPortal, TemplatePortal, PortalModule } from '@angular/cdk/portal';
4
- import { OverlayConfig, Overlay, OverlayModule } from '@angular/cdk/overlay';
5
- import { MatProgressBarModule } from '@angular/material/progress-bar';
6
- import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
7
- import { tdFadeInOutAnimation } from '@covalent/core/common';
8
- import { Subject } from 'rxjs';
9
- import { distinctUntilChanged } from 'rxjs/operators';
10
-
11
- /**
12
- * @fileoverview added by tsickle
13
- * Generated from: loading.component.ts
14
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
15
- */
16
- /** @enum {string} */
17
- const LoadingType = {
18
- Circular: "circular",
19
- Linear: "linear",
20
- };
21
- /** @enum {string} */
22
- const LoadingMode = {
23
- Determinate: "determinate",
24
- Indeterminate: "indeterminate",
25
- };
26
- /** @enum {string} */
27
- const LoadingStrategy = {
28
- Overlay: "overlay",
29
- Replace: "replace",
30
- };
31
- /** @enum {string} */
32
- const LoadingStyle = {
33
- FullScreen: "fullscreen",
34
- Overlay: "overlay",
35
- None: "none",
36
- };
37
- /** @type {?} */
38
- const TD_CIRCLE_DIAMETER = 100;
39
- class TdLoadingComponent {
40
- /**
41
- * @param {?} _elementRef
42
- * @param {?} _changeDetectorRef
43
- */
44
- constructor(_elementRef, _changeDetectorRef) {
45
- this._elementRef = _elementRef;
46
- this._changeDetectorRef = _changeDetectorRef;
47
- this._mode = LoadingMode.Indeterminate;
48
- this._defaultMode = LoadingMode.Indeterminate;
49
- this._value = 0;
50
- this._circleDiameter = TD_CIRCLE_DIAMETER;
51
- /**
52
- * Flag for animation
53
- */
54
- this.animation = false;
55
- this.style = LoadingStyle.None;
56
- /**
57
- * type: LoadingType
58
- * Sets type of [TdLoadingComponent] rendered.
59
- */
60
- this.type = LoadingType.Circular;
61
- /**
62
- * color: primary' | 'accent' | 'warn'
63
- * Sets theme color of [TdLoadingComponent] rendered.
64
- */
65
- this.color = 'primary';
66
- }
67
- /**
68
- * Sets mode of [TdLoadingComponent] to LoadingMode.Determinate or LoadingMode.Indeterminate
69
- * @param {?} mode
70
- * @return {?}
71
- */
72
- set mode(mode) {
73
- this._defaultMode = mode;
74
- }
75
- /**
76
- * @return {?}
77
- */
78
- get mode() {
79
- return this._mode;
80
- }
81
- /**
82
- * Sets value of [TdLoadingComponent] if mode is 'LoadingMode.Determinate'
83
- * @param {?} value
84
- * @return {?}
85
- */
86
- set value(value) {
87
- this._value = value;
88
- // Check for changes for `OnPush` change detection
89
- this._changeDetectorRef.markForCheck();
90
- }
91
- /**
92
- * @return {?}
93
- */
94
- get value() {
95
- return this._value;
96
- }
97
- /**
98
- * @return {?}
99
- */
100
- ngDoCheck() {
101
- // When overlay is used and the host width has a value greater than 1px
102
- // set the circle diameter when possible incase the loading component was rendered in a hidden state
103
- if (this.isOverlay() && this._hostHeight() > 1 && this.animation) {
104
- this._setCircleDiameter();
105
- this._changeDetectorRef.markForCheck();
106
- }
107
- }
108
- /**
109
- * @return {?}
110
- */
111
- getHeight() {
112
- // Ignore height if style is `overlay` or `fullscreen`.
113
- // Add height if child elements have a height and style is `none`, else return default height.
114
- if (this.isOverlay() || this.isFullScreen()) {
115
- return undefined;
116
- }
117
- else {
118
- return this.height ? `${this.height}px` : '150px';
119
- }
120
- }
121
- /**
122
- * @return {?}
123
- */
124
- getCircleDiameter() {
125
- return this._circleDiameter;
126
- }
127
- /**
128
- * @return {?}
129
- */
130
- getCircleStrokeWidth() {
131
- // we calculate the stroke width by setting it as 10% of its diameter
132
- /** @type {?} */
133
- const strokeWidth = this.getCircleDiameter() / 10;
134
- return Math.abs(strokeWidth);
135
- }
136
- /**
137
- * @return {?}
138
- */
139
- isCircular() {
140
- return this.type === LoadingType.Circular;
141
- }
142
- /**
143
- * @return {?}
144
- */
145
- isLinear() {
146
- return this.type === LoadingType.Linear;
147
- }
148
- /**
149
- * @return {?}
150
- */
151
- isFullScreen() {
152
- return this.style === LoadingStyle.FullScreen;
153
- }
154
- /**
155
- * @return {?}
156
- */
157
- isOverlay() {
158
- return this.style === LoadingStyle.Overlay;
159
- }
160
- /**
161
- * Starts in animation and returns an observable for completition event.
162
- * @return {?}
163
- */
164
- show() {
165
- /* need to switch back to the selected mode, so we have saved it in another variable
166
- * and then recover it. (issue with protractor)
167
- */
168
- this._mode = this._defaultMode;
169
- // Set values before the animations starts
170
- this._setCircleDiameter();
171
- // Check for changes for `OnPush` change detection
172
- this.animation = true;
173
- this._changeDetectorRef.markForCheck();
174
- }
175
- /**
176
- * Starts out animation and returns an observable for completition event.
177
- * @return {?}
178
- */
179
- hide() {
180
- this.animation = false;
181
- /* need to switch back and forth from determinate/indeterminate so the setInterval()
182
- * inside mat-progress-spinner stops and protractor doesnt timeout waiting to sync.
183
- */
184
- this._mode = LoadingMode.Determinate;
185
- // Check for changes for `OnPush` change detection
186
- /* little hack to reset the loader value and animation before removing it from DOM
187
- * else, the loader will appear with prev value when its registered again
188
- * and will do an animation going prev value to 0.
189
- */
190
- this.value = 0;
191
- // Check for changes for `OnPush` change detection
192
- this._changeDetectorRef.markForCheck();
193
- }
194
- /**
195
- * Calculate the proper diameter for the circle and set it
196
- * @private
197
- * @return {?}
198
- */
199
- _setCircleDiameter() {
200
- // we set a default diameter of 100 since this is the default in material
201
- /** @type {?} */
202
- let diameter = TD_CIRCLE_DIAMETER;
203
- // if height is provided, then we take that as diameter
204
- if (this.height) {
205
- diameter = this.height;
206
- // else if its not provided, then we take the host height
207
- }
208
- else if (this.height === undefined) {
209
- diameter = this._hostHeight();
210
- }
211
- // if the diameter is over TD_CIRCLE_DIAMETER, we set TD_CIRCLE_DIAMETER
212
- if (!!diameter && diameter <= TD_CIRCLE_DIAMETER) {
213
- this._circleDiameter = Math.floor(diameter);
214
- }
215
- else {
216
- this._circleDiameter = TD_CIRCLE_DIAMETER;
217
- }
218
- }
219
- /**
220
- * Returns the host height of the loading component
221
- * @private
222
- * @return {?}
223
- */
224
- _hostHeight() {
225
- if ((/** @type {?} */ (this._elementRef.nativeElement))) {
226
- return ((/** @type {?} */ (this._elementRef.nativeElement))).getBoundingClientRect().height;
227
- }
228
- return 0;
229
- }
230
- }
231
- TdLoadingComponent.decorators = [
232
- { type: Component, args: [{
233
- selector: 'td-loading',
234
- 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 [@tdFadeInOut]=\"animation\" [style.min-height]=\"getHeight()\" class=\"td-loading\">\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 *ngIf=\"isLinear()\" [mode]=\"mode\" [value]=\"value\" [color]=\"color\"></mat-progress-bar>\n </div>\n <ng-template [cdkPortalOutlet]=\"content\"></ng-template>\n</div>\n",
235
- animations: [tdFadeInOutAnimation],
236
- styles: [".td-loading-wrapper{display:block;position:relative}.td-loading-wrapper.td-fullscreen{position:inherit}.td-loading-wrapper .td-loading{-ms-flex:1;-ms-flex-align:center;-ms-flex-direction:row;-ms-flex-line-pack:center;-ms-flex-pack:center;align-content:center;align-items:center;box-sizing:border-box;display:-ms-flexbox;display:flex;flex:1;flex-direction:row;justify-content:center;max-width:100%}.td-loading-wrapper.td-overlay .td-loading{left:0;margin:0;position:absolute;right:0;top:0;z-index:1000}.td-loading-wrapper.td-overlay .td-loading mat-progress-bar{left:0;position:absolute;right:0;top:0}.td-loading-wrapper.td-overlay-circular .td-loading{bottom:0}"]
237
- }] }
238
- ];
239
- /** @nocollapse */
240
- TdLoadingComponent.ctorParameters = () => [
241
- { type: ElementRef },
242
- { type: ChangeDetectorRef }
243
- ];
244
- if (false) {
245
- /**
246
- * @type {?}
247
- * @private
248
- */
249
- TdLoadingComponent.prototype._mode;
250
- /**
251
- * @type {?}
252
- * @private
253
- */
254
- TdLoadingComponent.prototype._defaultMode;
255
- /**
256
- * @type {?}
257
- * @private
258
- */
259
- TdLoadingComponent.prototype._value;
260
- /**
261
- * @type {?}
262
- * @private
263
- */
264
- TdLoadingComponent.prototype._circleDiameter;
265
- /**
266
- * Flag for animation
267
- * @type {?}
268
- */
269
- TdLoadingComponent.prototype.animation;
270
- /**
271
- * Content injected into loading component.
272
- * @type {?}
273
- */
274
- TdLoadingComponent.prototype.content;
275
- /** @type {?} */
276
- TdLoadingComponent.prototype.style;
277
- /**
278
- * height: number
279
- * Sets height of [TdLoadingComponent].
280
- * @type {?}
281
- */
282
- TdLoadingComponent.prototype.height;
283
- /**
284
- * type: LoadingType
285
- * Sets type of [TdLoadingComponent] rendered.
286
- * @type {?}
287
- */
288
- TdLoadingComponent.prototype.type;
289
- /**
290
- * color: primary' | 'accent' | 'warn'
291
- * Sets theme color of [TdLoadingComponent] rendered.
292
- * @type {?}
293
- */
294
- TdLoadingComponent.prototype.color;
295
- /**
296
- * @type {?}
297
- * @private
298
- */
299
- TdLoadingComponent.prototype._elementRef;
300
- /**
301
- * @type {?}
302
- * @private
303
- */
304
- TdLoadingComponent.prototype._changeDetectorRef;
305
- }
306
-
307
- /**
308
- * @fileoverview added by tsickle
309
- * Generated from: services/loading.factory.ts
310
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
311
- */
312
- /**
313
- * @record
314
- */
315
- function IInternalLoadingOptions() { }
316
- if (false) {
317
- /** @type {?|undefined} */
318
- IInternalLoadingOptions.prototype.height;
319
- /** @type {?|undefined} */
320
- IInternalLoadingOptions.prototype.style;
321
- }
322
- /**
323
- * @record
324
- */
325
- function ILoadingRef() { }
326
- if (false) {
327
- /** @type {?} */
328
- ILoadingRef.prototype.observable;
329
- /** @type {?} */
330
- ILoadingRef.prototype.componentRef;
331
- /** @type {?|undefined} */
332
- ILoadingRef.prototype.subject;
333
- /** @type {?|undefined} */
334
- ILoadingRef.prototype.times;
335
- }
336
- /**
337
- * NOTE: \@internal usage only.
338
- */
339
- class TdLoadingFactory {
340
- /**
341
- * @param {?} _componentFactoryResolver
342
- * @param {?} _overlay
343
- * @param {?} _injector
344
- */
345
- constructor(_componentFactoryResolver, _overlay, _injector) {
346
- this._componentFactoryResolver = _componentFactoryResolver;
347
- this._overlay = _overlay;
348
- this._injector = _injector;
349
- }
350
- /**
351
- * Uses material `Overlay` services to create a DOM element and attach the loading component
352
- * into it. Leveraging the state and configuration from it.
353
- *
354
- * Saves a reference in context to be called when registering/resolving the loading element.
355
- * @param {?} options
356
- * @return {?}
357
- */
358
- createFullScreenComponent(options) {
359
- ((/** @type {?} */ (options))).height = undefined;
360
- ((/** @type {?} */ (options))).style = LoadingStyle.FullScreen;
361
- /** @type {?} */
362
- const loadingRef = this._initializeContext();
363
- /** @type {?} */
364
- let loading = false;
365
- /** @type {?} */
366
- let overlayRef;
367
- loadingRef.observable.pipe(distinctUntilChanged()).subscribe((/**
368
- * @param {?} registered
369
- * @return {?}
370
- */
371
- (registered) => {
372
- if (registered > 0 && !loading) {
373
- loading = true;
374
- overlayRef = this._createOverlay();
375
- loadingRef.componentRef = overlayRef.attach(new ComponentPortal(TdLoadingComponent));
376
- this._mapOptions(options, loadingRef.componentRef.instance);
377
- loadingRef.componentRef.instance.show();
378
- loadingRef.componentRef.changeDetectorRef.detectChanges();
379
- }
380
- else if (registered <= 0 && loading) {
381
- loading = false;
382
- loadingRef.componentRef.instance.hide();
383
- loadingRef.componentRef.destroy();
384
- overlayRef.detach();
385
- overlayRef.dispose();
386
- }
387
- }));
388
- return loadingRef;
389
- }
390
- /**
391
- * Creates a loading component dynamically and attaches it into the given viewContainerRef.
392
- * Leverages TemplatePortals from material to inject the template inside of it so it fits
393
- * perfectly when overlaying it.
394
- *
395
- * Saves a reference in context to be called when registering/resolving the loading element.
396
- * @param {?} options
397
- * @param {?} viewContainerRef
398
- * @param {?} templateRef
399
- * @return {?}
400
- */
401
- createOverlayComponent(options, viewContainerRef, templateRef) {
402
- ((/** @type {?} */ (options))).height = undefined;
403
- ((/** @type {?} */ (options))).style = LoadingStyle.Overlay;
404
- /** @type {?} */
405
- const loadingRef = this._createComponent(options);
406
- /** @type {?} */
407
- let loading = false;
408
- loadingRef.componentRef.instance.content = new TemplatePortal(templateRef, viewContainerRef);
409
- viewContainerRef.clear();
410
- viewContainerRef.insert(loadingRef.componentRef.hostView, 0);
411
- loadingRef.observable.pipe(distinctUntilChanged()).subscribe((/**
412
- * @param {?} registered
413
- * @return {?}
414
- */
415
- (registered) => {
416
- if (registered > 0 && !loading) {
417
- loading = true;
418
- loadingRef.componentRef.instance.show();
419
- }
420
- else if (registered <= 0 && loading) {
421
- loading = false;
422
- loadingRef.componentRef.instance.hide();
423
- }
424
- }));
425
- return loadingRef;
426
- }
427
- /**
428
- * Creates a loading component dynamically and attaches it into the given viewContainerRef.
429
- * Replaces the template with the loading component depending if it was registered or resolved.
430
- *
431
- * Saves a reference in context to be called when registering/resolving the loading element.
432
- * @param {?} options
433
- * @param {?} viewContainerRef
434
- * @param {?} templateRef
435
- * @param {?} context
436
- * @return {?}
437
- */
438
- createReplaceComponent(options, viewContainerRef, templateRef, context) {
439
- /** @type {?} */
440
- const nativeElement = (/** @type {?} */ (templateRef.elementRef.nativeElement));
441
- ((/** @type {?} */ (options))).height = nativeElement.nextElementSibling
442
- ? nativeElement.nextElementSibling.scrollHeight
443
- : undefined;
444
- ((/** @type {?} */ (options))).style = LoadingStyle.None;
445
- /** @type {?} */
446
- const loadingRef = this._createComponent(options);
447
- /** @type {?} */
448
- let loading = false;
449
- // passing context so when the template is attached, we can keep the reference of the variables
450
- /** @type {?} */
451
- const contentRef = viewContainerRef.createEmbeddedView(templateRef, context);
452
- loadingRef.observable.pipe(distinctUntilChanged()).subscribe((/**
453
- * @param {?} registered
454
- * @return {?}
455
- */
456
- (registered) => {
457
- if (registered > 0 && !loading) {
458
- loading = true;
459
- // detach the content and attach the loader if loader is there
460
- /** @type {?} */
461
- const index = viewContainerRef.indexOf(loadingRef.componentRef.hostView);
462
- if (index < 0) {
463
- viewContainerRef.detach(viewContainerRef.indexOf(contentRef));
464
- viewContainerRef.insert(loadingRef.componentRef.hostView, 0);
465
- }
466
- loadingRef.componentRef.instance.show();
467
- }
468
- else if (registered <= 0 && loading) {
469
- loading = false;
470
- loadingRef.componentRef.instance.hide();
471
- // detach loader and attach the content if content is there
472
- /** @type {?} */
473
- const index = viewContainerRef.indexOf(contentRef);
474
- if (index < 0) {
475
- viewContainerRef.detach(viewContainerRef.indexOf(loadingRef.componentRef.hostView));
476
- viewContainerRef.insert(contentRef, 0);
477
- }
478
- /**
479
- * Need to call "markForCheck" and "detectChanges" on attached template, so its detected by parent component when attached
480
- * with "OnPush" change detection
481
- */
482
- contentRef.detectChanges();
483
- contentRef.markForCheck();
484
- }
485
- }));
486
- return loadingRef;
487
- }
488
- /**
489
- * Creates a fullscreen overlay for the loading usage.
490
- * @private
491
- * @return {?}
492
- */
493
- _createOverlay() {
494
- /** @type {?} */
495
- const state = new OverlayConfig();
496
- state.hasBackdrop = false;
497
- state.positionStrategy = this._overlay.position().global().centerHorizontally().centerVertically();
498
- return this._overlay.create(state);
499
- }
500
- /**
501
- * Creates a generic component dynamically waiting to be attached to a viewContainerRef.
502
- * @private
503
- * @param {?} options
504
- * @return {?}
505
- */
506
- _createComponent(options) {
507
- /** @type {?} */
508
- const compRef = this._initializeContext();
509
- compRef.componentRef = this._componentFactoryResolver
510
- .resolveComponentFactory(TdLoadingComponent)
511
- .create(this._injector);
512
- this._mapOptions(options, compRef.componentRef.instance);
513
- return compRef;
514
- }
515
- /**
516
- * Initialize context for loading component.
517
- * @private
518
- * @return {?}
519
- */
520
- _initializeContext() {
521
- /** @type {?} */
522
- const subject = new Subject();
523
- return {
524
- observable: subject.asObservable(),
525
- subject,
526
- componentRef: undefined,
527
- times: 0,
528
- };
529
- }
530
- /**
531
- * Maps configuration to the loading component instance.
532
- * @private
533
- * @param {?} options
534
- * @param {?} instance
535
- * @return {?}
536
- */
537
- _mapOptions(options, instance) {
538
- instance.style = options.style;
539
- if (options.type !== undefined) {
540
- instance.type = options.type;
541
- }
542
- if (options.height !== undefined) {
543
- instance.height = options.height;
544
- }
545
- if (options.mode !== undefined) {
546
- instance.mode = options.mode;
547
- }
548
- if (options.color !== undefined) {
549
- instance.color = options.color;
550
- }
551
- }
552
- }
553
- TdLoadingFactory.decorators = [
554
- { type: Injectable }
555
- ];
556
- /** @nocollapse */
557
- TdLoadingFactory.ctorParameters = () => [
558
- { type: ComponentFactoryResolver },
559
- { type: Overlay },
560
- { type: Injector }
561
- ];
562
- if (false) {
563
- /**
564
- * @type {?}
565
- * @private
566
- */
567
- TdLoadingFactory.prototype._componentFactoryResolver;
568
- /**
569
- * @type {?}
570
- * @private
571
- */
572
- TdLoadingFactory.prototype._overlay;
573
- /**
574
- * @type {?}
575
- * @private
576
- */
577
- TdLoadingFactory.prototype._injector;
578
- }
579
- /**
580
- * @param {?} parent
581
- * @param {?} componentFactoryResolver
582
- * @param {?} overlay
583
- * @param {?} injector
584
- * @return {?}
585
- */
586
- function LOADING_FACTORY_PROVIDER_FACTORY(parent, componentFactoryResolver, overlay, injector) {
587
- return parent || new TdLoadingFactory(componentFactoryResolver, overlay, injector);
588
- }
589
- /** @type {?} */
590
- const LOADING_FACTORY_PROVIDER = {
591
- // If there is already a service available, use that. Otherwise, provide a new one.
592
- provide: TdLoadingFactory,
593
- deps: [[new Optional(), new SkipSelf(), TdLoadingFactory], ComponentFactoryResolver, Overlay, Injector],
594
- useFactory: LOADING_FACTORY_PROVIDER_FACTORY,
595
- };
596
-
597
- /**
598
- * @fileoverview added by tsickle
599
- * Generated from: services/loading.service.ts
600
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
601
- */
602
- /**
603
- * @record
604
- */
605
- function ITdLoadingConfig() { }
606
- if (false) {
607
- /** @type {?} */
608
- ITdLoadingConfig.prototype.name;
609
- /** @type {?|undefined} */
610
- ITdLoadingConfig.prototype.type;
611
- /** @type {?|undefined} */
612
- ITdLoadingConfig.prototype.mode;
613
- /** @type {?|undefined} */
614
- ITdLoadingConfig.prototype.color;
615
- }
616
- class TdLoadingConfig {
617
- /**
618
- * @param {?} config
619
- */
620
- constructor(config) {
621
- this.name = config.name;
622
- if (!this.name) {
623
- throw Error('Name is required for [TdLoading] configuration.');
624
- }
625
- this.mode = config.mode ? config.mode : LoadingMode.Indeterminate;
626
- this.type = config.type ? config.type : LoadingType.Circular;
627
- this.color = config.color ? config.color : 'primary';
628
- }
629
- }
630
- if (false) {
631
- /** @type {?} */
632
- TdLoadingConfig.prototype.name;
633
- /** @type {?} */
634
- TdLoadingConfig.prototype.type;
635
- /** @type {?} */
636
- TdLoadingConfig.prototype.mode;
637
- /** @type {?} */
638
- TdLoadingConfig.prototype.color;
639
- }
640
- /**
641
- * @record
642
- */
643
- function ITdLoadingDirectiveConfig() { }
644
- if (false) {
645
- /** @type {?|undefined} */
646
- ITdLoadingDirectiveConfig.prototype.strategy;
647
- }
648
- class TdLoadingDirectiveConfig extends TdLoadingConfig {
649
- /**
650
- * @param {?} config
651
- */
652
- constructor(config) {
653
- super(config);
654
- this.strategy = config.strategy ? config.strategy : LoadingStrategy.Replace;
655
- }
656
- }
657
- if (false) {
658
- /** @type {?} */
659
- TdLoadingDirectiveConfig.prototype.name;
660
- /** @type {?} */
661
- TdLoadingDirectiveConfig.prototype.type;
662
- /** @type {?} */
663
- TdLoadingDirectiveConfig.prototype.mode;
664
- /** @type {?} */
665
- TdLoadingDirectiveConfig.prototype.strategy;
666
- }
667
- class TdLoadingService {
668
- /**
669
- * @param {?} _loadingFactory
670
- */
671
- constructor(_loadingFactory) {
672
- this._loadingFactory = _loadingFactory;
673
- this._context = {};
674
- this._timeouts = {};
675
- this.create({
676
- name: 'td-loading-main',
677
- });
678
- }
679
- /**
680
- * params:
681
- * - config: ILoadingDirectiveConfig
682
- * - viewContainerRef: ViewContainerRef
683
- * - templateRef: TemplateRef<Object>
684
- *
685
- * Creates an replace loading mask and attaches it to the viewContainerRef.
686
- * Replaces the templateRef with the mask when a request is registered on it.
687
- *
688
- * NOTE: \@internal usage only.
689
- * @param {?} config
690
- * @param {?} viewContainerRef
691
- * @param {?} templateRef
692
- * @param {?} context
693
- * @return {?}
694
- */
695
- createComponent(config, viewContainerRef, templateRef, context) {
696
- /** @type {?} */
697
- const directiveConfig = new TdLoadingDirectiveConfig(config);
698
- if (this._context[directiveConfig.name]) {
699
- throw Error(`Name duplication: [TdLoading] directive has a name conflict with ${directiveConfig.name}.`);
700
- }
701
- if (directiveConfig.strategy === LoadingStrategy.Overlay) {
702
- this._context[directiveConfig.name] = this._loadingFactory.createOverlayComponent(directiveConfig, viewContainerRef, templateRef);
703
- }
704
- else {
705
- this._context[directiveConfig.name] = this._loadingFactory.createReplaceComponent(directiveConfig, viewContainerRef, templateRef, context);
706
- }
707
- return this._context[directiveConfig.name];
708
- }
709
- /**
710
- * params:
711
- * - config: ITdLoadingConfig
712
- *
713
- * Creates a fullscreen loading mask and attaches it to the DOM with the given configuration.
714
- * Only displayed when the mask has a request registered on it.
715
- * @param {?} config
716
- * @return {?}
717
- */
718
- create(config) {
719
- /** @type {?} */
720
- const fullscreenConfig = new TdLoadingConfig(config);
721
- this.removeComponent(fullscreenConfig.name);
722
- this._context[fullscreenConfig.name] = this._loadingFactory.createFullScreenComponent(fullscreenConfig);
723
- }
724
- /**
725
- * params:
726
- * - name: string
727
- *
728
- * Removes `loading` component from service context.
729
- * @param {?} name
730
- * @return {?}
731
- */
732
- removeComponent(name) {
733
- if (this._context[name]) {
734
- this._context[name].subject.unsubscribe();
735
- if (this._context[name].componentRef) {
736
- this._context[name].componentRef.destroy();
737
- }
738
- this._context[name] = undefined;
739
- delete this._context[name];
740
- }
741
- }
742
- /**
743
- * params:
744
- * - name: string
745
- * - registers?: number
746
- * returns: true if successful
747
- *
748
- * Resolves a request for the loading mask referenced by the name parameter.
749
- * Can optionally pass registers argument to set a number of register calls.
750
- *
751
- * If no paramemeters are used, then default main mask will be used.
752
- *
753
- * e.g. loadingService.register()
754
- * @param {?=} name
755
- * @param {?=} registers
756
- * @return {?}
757
- */
758
- register(name = 'td-loading-main', registers = 1) {
759
- // try registering into the service if the loading component has been instanciated or if it exists.
760
- if (this._context[name]) {
761
- registers = registers < 1 ? 1 : registers;
762
- this._context[name].times += registers;
763
- this._context[name].subject.next(this._context[name].times);
764
- return true;
765
- }
766
- else {
767
- // if it doesnt exist, set a timeout so its registered after change detection happens
768
- // this in case "register" occured on the `ngOnInit` lifehook cycle.
769
- if (!this._timeouts[name]) {
770
- this._timeouts[name] = setTimeout((/**
771
- * @return {?}
772
- */
773
- () => {
774
- this.register(name, registers);
775
- }));
776
- }
777
- else {
778
- // if it timeout occured and still doesnt exist, it means the tiemout wasnt needed so we clear it.
779
- this._clearTimeout(name);
780
- }
781
- }
782
- return false;
783
- }
784
- /**
785
- * params:
786
- * - name: string
787
- * - resolves?: number
788
- * returns: true if successful
789
- *
790
- * Resolves a request for the loading mask referenced by the name parameter.
791
- * Can optionally pass resolves argument to set a number of resolve calls.
792
- *
793
- * If no paramemeters are used, then default main mask will be used.
794
- *
795
- * e.g. loadingService.resolve()
796
- * @param {?=} name
797
- * @param {?=} resolves
798
- * @return {?}
799
- */
800
- resolve(name = 'td-loading-main', resolves = 1) {
801
- // clear timeout if the loading component is "resolved" before its "registered"
802
- this._clearTimeout(name);
803
- if (this._context[name]) {
804
- resolves = resolves < 1 ? 1 : resolves;
805
- if (this._context[name].times > 0) {
806
- /** @type {?} */
807
- let times = this._context[name].times;
808
- times -= resolves;
809
- this._context[name].times = times < 0 ? 0 : times;
810
- }
811
- this._context[name].subject.next(this._context[name].times);
812
- return true;
813
- }
814
- return false;
815
- }
816
- /**
817
- * params:
818
- * - name: string
819
- * returns: true if successful
820
- *
821
- * Resolves all request for the loading mask referenced by the name parameter.
822
- *
823
- * If no paramemeters are used, then default main mask will be used.
824
- *
825
- * e.g. loadingService.resolveAll()
826
- * @param {?=} name
827
- * @return {?}
828
- */
829
- resolveAll(name = 'td-loading-main') {
830
- // clear timeout if the loading component is "resolved" before its "registered"
831
- this._clearTimeout(name);
832
- if (this._context[name]) {
833
- this._context[name].times = 0;
834
- this._context[name].subject.next(this._context[name].times);
835
- return true;
836
- }
837
- return false;
838
- }
839
- /**
840
- * params:
841
- * - name: string
842
- * - value: number
843
- * returns: true if successful
844
- *
845
- * Set value on a loading mask referenced by the name parameter.
846
- * Usage only available if its mode is 'determinate' and if loading is showing.
847
- * @param {?} name
848
- * @param {?} value
849
- * @return {?}
850
- */
851
- setValue(name, value) {
852
- if (this._context[name]) {
853
- /** @type {?} */
854
- const instance = this._context[name].componentRef.instance;
855
- if (instance.mode === LoadingMode.Determinate && instance.animation) {
856
- instance.value = value;
857
- return true;
858
- }
859
- }
860
- return false;
861
- }
862
- /**
863
- * Clears timeout linked to the name.
864
- * @private
865
- * @param {?} name Name of the loading component to be cleared
866
- * @return {?}
867
- */
868
- _clearTimeout(name) {
869
- clearTimeout(this._timeouts[name]);
870
- delete this._timeouts[name];
871
- }
872
- }
873
- TdLoadingService.decorators = [
874
- { type: Injectable }
875
- ];
876
- /** @nocollapse */
877
- TdLoadingService.ctorParameters = () => [
878
- { type: TdLoadingFactory }
879
- ];
880
- if (false) {
881
- /**
882
- * @type {?}
883
- * @private
884
- */
885
- TdLoadingService.prototype._context;
886
- /**
887
- * @type {?}
888
- * @private
889
- */
890
- TdLoadingService.prototype._timeouts;
891
- /**
892
- * @type {?}
893
- * @private
894
- */
895
- TdLoadingService.prototype._loadingFactory;
896
- }
897
- /**
898
- * @param {?} parent
899
- * @param {?} loadingFactory
900
- * @return {?}
901
- */
902
- function LOADING_PROVIDER_FACTORY(parent, loadingFactory) {
903
- return parent || new TdLoadingService(loadingFactory);
904
- }
905
- /** @type {?} */
906
- const LOADING_PROVIDER = {
907
- // If there is already a service available, use that. Otherwise, provide a new one.
908
- provide: TdLoadingService,
909
- deps: [[new Optional(), new SkipSelf(), TdLoadingService], TdLoadingFactory],
910
- useFactory: LOADING_PROVIDER_FACTORY,
911
- };
912
-
913
- /**
914
- * @fileoverview added by tsickle
915
- * Generated from: directives/loading.directive.ts
916
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
917
- */
918
- /**
919
- * Context class for variable reference
920
- */
921
- class TdLoadingContext {
922
- constructor() {
923
- this.$implicit = undefined;
924
- this.tdLoading = undefined;
925
- }
926
- }
927
- if (false) {
928
- /** @type {?} */
929
- TdLoadingContext.prototype.$implicit;
930
- /** @type {?} */
931
- TdLoadingContext.prototype.tdLoading;
932
- }
933
- // Constant for generation of the id for the next component
934
- /** @type {?} */
935
- let TD_LOADING_NEXT_ID = 0;
936
- class TdLoadingDirective {
937
- /**
938
- * @param {?} _viewContainerRef
939
- * @param {?} _templateRef
940
- * @param {?} _loadingService
941
- */
942
- constructor(_viewContainerRef, _templateRef, _loadingService) {
943
- this._viewContainerRef = _viewContainerRef;
944
- this._templateRef = _templateRef;
945
- this._loadingService = _loadingService;
946
- this._context = new TdLoadingContext();
947
- /**
948
- * tdLoadingColor?: "primary" | "accent" | "warn"
949
- * Sets the theme color of the loading component. Defaults to "primary"
950
- */
951
- this.color = 'primary';
952
- }
953
- /**
954
- * tdLoading: string
955
- * Name reference of the loading mask, used to register/resolve requests to the mask.
956
- * @param {?} name
957
- * @return {?}
958
- */
959
- set name(name) {
960
- if (!this._name && name) {
961
- this._name = name;
962
- }
963
- }
964
- /**
965
- * tdLoadingUntil?: any
966
- * If its null, undefined or false it will be used to register requests to the mask.
967
- * Else if its any value that can be resolved as true, it will resolve the mask.
968
- * [name] is optional when using [until], but can still be used to register/resolve it manually.
969
- * @param {?} until
970
- * @return {?}
971
- */
972
- set until(until) {
973
- if (!this._name) {
974
- this._name = 'td-loading-until-' + TD_LOADING_NEXT_ID++;
975
- }
976
- this._context.$implicit = this._context.tdLoading = until;
977
- if (!until) {
978
- this._loadingService.register(this._name);
979
- }
980
- else {
981
- this._loadingService.resolveAll(this._name);
982
- }
983
- }
984
- /**
985
- * tdLoadingType?: LoadingType or ['linear' | 'circular']
986
- * Sets the type of loading mask depending on value.
987
- * Defaults to [LoadingType.Circular | 'circular'].
988
- * @param {?} type
989
- * @return {?}
990
- */
991
- set type(type) {
992
- if (type === LoadingType.Linear) {
993
- this._type = LoadingType.Linear;
994
- }
995
- else {
996
- this._type = LoadingType.Circular;
997
- }
998
- }
999
- /**
1000
- * tdLoadingMode?: LoadingMode or ['determinate' | 'indeterminate']
1001
- * Sets the mode of loading mask depending on value.
1002
- * Defaults to [LoadingMode.Indeterminate | 'indeterminate'].
1003
- * @param {?} mode
1004
- * @return {?}
1005
- */
1006
- set mode(mode) {
1007
- if (mode === LoadingMode.Determinate) {
1008
- this._mode = LoadingMode.Determinate;
1009
- }
1010
- else {
1011
- this._mode = LoadingMode.Indeterminate;
1012
- }
1013
- }
1014
- /**
1015
- * tdLoadingStrategy?: LoadingStrategy or ['replace' | 'overlay']
1016
- * Sets the strategy of loading mask depending on value.
1017
- * Defaults to [LoadingMode.Replace | 'replace'].
1018
- * @param {?} strategy
1019
- * @return {?}
1020
- */
1021
- set strategy(strategy) {
1022
- if (strategy === LoadingStrategy.Overlay) {
1023
- this._strategy = LoadingStrategy.Overlay;
1024
- }
1025
- else {
1026
- this._strategy = LoadingStrategy.Replace;
1027
- }
1028
- }
1029
- /**
1030
- * Registers component in the DOM, so it will be available when calling resolve/register.
1031
- * @return {?}
1032
- */
1033
- ngOnInit() {
1034
- this._registerComponent();
1035
- }
1036
- /**
1037
- * Remove component when directive is destroyed.
1038
- * @return {?}
1039
- */
1040
- ngOnDestroy() {
1041
- this._loadingService.removeComponent(this._name);
1042
- this._loadingRef = undefined;
1043
- }
1044
- /**
1045
- * Creates [TdLoadingComponent] and attaches it to this directive's [ViewContainerRef].
1046
- * Passes this directive's [TemplateRef] to modify DOM depending on loading `strategy`.
1047
- * @private
1048
- * @return {?}
1049
- */
1050
- _registerComponent() {
1051
- if (!this._name) {
1052
- throw new Error('Name is needed to register loading directive');
1053
- }
1054
- // Check if `TdLoadingComponent` has been created before trying to add one again.
1055
- // There is a weird edge case when using `[routerLinkActive]` that calls the `ngOnInit` twice in a row
1056
- if (!this._loadingRef) {
1057
- this._loadingRef = this._loadingService.createComponent({
1058
- name: this._name,
1059
- type: this._type,
1060
- mode: this._mode,
1061
- color: this.color,
1062
- strategy: this._strategy,
1063
- }, this._viewContainerRef, this._templateRef, this._context);
1064
- }
1065
- }
1066
- }
1067
- TdLoadingDirective.decorators = [
1068
- { type: Directive, args: [{
1069
- selector: '[tdLoading]',
1070
- },] }
1071
- ];
1072
- /** @nocollapse */
1073
- TdLoadingDirective.ctorParameters = () => [
1074
- { type: ViewContainerRef },
1075
- { type: TemplateRef },
1076
- { type: TdLoadingService }
1077
- ];
1078
- TdLoadingDirective.propDecorators = {
1079
- name: [{ type: Input, args: ['tdLoading',] }],
1080
- until: [{ type: Input, args: ['tdLoadingUntil',] }],
1081
- type: [{ type: Input, args: ['tdLoadingType',] }],
1082
- mode: [{ type: Input, args: ['tdLoadingMode',] }],
1083
- strategy: [{ type: Input, args: ['tdLoadingStrategy',] }],
1084
- color: [{ type: Input, args: ['tdLoadingColor',] }]
1085
- };
1086
- if (false) {
1087
- /**
1088
- * @type {?}
1089
- * @private
1090
- */
1091
- TdLoadingDirective.prototype._context;
1092
- /**
1093
- * @type {?}
1094
- * @private
1095
- */
1096
- TdLoadingDirective.prototype._type;
1097
- /**
1098
- * @type {?}
1099
- * @private
1100
- */
1101
- TdLoadingDirective.prototype._mode;
1102
- /**
1103
- * @type {?}
1104
- * @private
1105
- */
1106
- TdLoadingDirective.prototype._strategy;
1107
- /**
1108
- * @type {?}
1109
- * @private
1110
- */
1111
- TdLoadingDirective.prototype._name;
1112
- /**
1113
- * @type {?}
1114
- * @private
1115
- */
1116
- TdLoadingDirective.prototype._loadingRef;
1117
- /**
1118
- * tdLoadingColor?: "primary" | "accent" | "warn"
1119
- * Sets the theme color of the loading component. Defaults to "primary"
1120
- * @type {?}
1121
- */
1122
- TdLoadingDirective.prototype.color;
1123
- /**
1124
- * @type {?}
1125
- * @private
1126
- */
1127
- TdLoadingDirective.prototype._viewContainerRef;
1128
- /**
1129
- * @type {?}
1130
- * @private
1131
- */
1132
- TdLoadingDirective.prototype._templateRef;
1133
- /**
1134
- * @type {?}
1135
- * @private
1136
- */
1137
- TdLoadingDirective.prototype._loadingService;
1138
- }
1139
-
1140
- /**
1141
- * @fileoverview added by tsickle
1142
- * Generated from: loading.module.ts
1143
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1144
- */
1145
- /** @type {?} */
1146
- const TD_LOADING = [TdLoadingComponent, TdLoadingDirective];
1147
- /** @type {?} */
1148
- const TD_LOADING_ENTRY_COMPONENTS = [TdLoadingComponent];
1149
- class CovalentLoadingModule {
1150
- }
1151
- CovalentLoadingModule.decorators = [
1152
- { type: NgModule, args: [{
1153
- imports: [CommonModule, MatProgressBarModule, MatProgressSpinnerModule, OverlayModule, PortalModule],
1154
- declarations: [TD_LOADING],
1155
- exports: [TD_LOADING],
1156
- providers: [LOADING_FACTORY_PROVIDER, LOADING_PROVIDER],
1157
- },] }
1158
- ];
1159
-
1160
- /**
1161
- * @fileoverview added by tsickle
1162
- * Generated from: public-api.ts
1163
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1164
- */
1165
-
1166
- /**
1167
- * @fileoverview added by tsickle
1168
- * Generated from: index.ts
1169
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1170
- */
1171
-
1172
- /**
1173
- * @fileoverview added by tsickle
1174
- * Generated from: covalent-core-loading.ts
1175
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1176
- */
1177
-
1178
- 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 };
1179
- //# sourceMappingURL=covalent-core-loading.js.map