@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,2309 +0,0 @@
1
- import { Component, ElementRef, Renderer2, Input, HostListener, Directive, TemplateRef, ViewContainerRef, EventEmitter, forwardRef, ChangeDetectionStrategy, Optional, Inject, ChangeDetectorRef, ContentChildren, ViewChild, ViewChildren, Output, HostBinding, Injectable, NgModule } from '@angular/core';
2
- import { DOCUMENT, CommonModule } from '@angular/common';
3
- import { MatCheckboxModule } from '@angular/material/checkbox';
4
- import { MatTooltipModule } from '@angular/material/tooltip';
5
- import { MatIconModule } from '@angular/material/icon';
6
- import { MatPseudoCheckboxModule } from '@angular/material/core';
7
- import { DomSanitizer } from '@angular/platform-browser';
8
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
9
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
10
- import { DOWN_ARROW, UP_ARROW, SPACE, ENTER } from '@angular/cdk/keycodes';
11
- import { Subject } from 'rxjs';
12
- import { debounceTime } from 'rxjs/operators';
13
- import { TemplatePortalDirective } from '@angular/cdk/portal';
14
- import { mixinControlValueAccessor } from '@covalent/core/common';
15
-
16
- /**
17
- * @fileoverview added by tsickle
18
- * Generated from: data-table-row/data-table-row.component.ts
19
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
20
- */
21
- class TdDataTableColumnRowComponent {
22
- /**
23
- * @param {?} _elementRef
24
- * @param {?} _renderer
25
- */
26
- constructor(_elementRef, _renderer) {
27
- this._elementRef = _elementRef;
28
- this._renderer = _renderer;
29
- this._renderer.addClass(this._elementRef.nativeElement, 'td-data-table-column-row');
30
- }
31
- }
32
- TdDataTableColumnRowComponent.decorators = [
33
- { type: Component, args: [{
34
- /* tslint:disable-next-line */
35
- selector: 'tr[td-data-table-column-row]',
36
- template: "<ng-content></ng-content>\n",
37
- styles: [":host{border-bottom-style:solid;border-bottom-width:1px}:host.td-data-table-row{height:48px}:host.td-data-table-column-row{height:56px}"]
38
- }] }
39
- ];
40
- /** @nocollapse */
41
- TdDataTableColumnRowComponent.ctorParameters = () => [
42
- { type: ElementRef },
43
- { type: Renderer2 }
44
- ];
45
- if (false) {
46
- /**
47
- * @type {?}
48
- * @protected
49
- */
50
- TdDataTableColumnRowComponent.prototype._elementRef;
51
- /**
52
- * @type {?}
53
- * @protected
54
- */
55
- TdDataTableColumnRowComponent.prototype._renderer;
56
- }
57
- class TdDataTableRowComponent {
58
- /**
59
- * @param {?} _elementRef
60
- * @param {?} _renderer
61
- */
62
- constructor(_elementRef, _renderer) {
63
- this._elementRef = _elementRef;
64
- this._renderer = _renderer;
65
- this._selected = false;
66
- this._renderer.addClass(this._elementRef.nativeElement, 'td-data-table-row');
67
- }
68
- /**
69
- * @param {?} selected
70
- * @return {?}
71
- */
72
- set selected(selected) {
73
- if (selected) {
74
- this._renderer.addClass(this._elementRef.nativeElement, 'td-selected');
75
- }
76
- else {
77
- this._renderer.removeClass(this._elementRef.nativeElement, 'td-selected');
78
- }
79
- this._selected = selected;
80
- }
81
- /**
82
- * @return {?}
83
- */
84
- get selected() {
85
- return this._selected;
86
- }
87
- /**
88
- * @return {?}
89
- */
90
- get height() {
91
- /** @type {?} */
92
- let height = 48;
93
- if (this._elementRef.nativeElement) {
94
- height = ((/** @type {?} */ (this._elementRef.nativeElement))).getBoundingClientRect().height;
95
- }
96
- return height;
97
- }
98
- /**
99
- * Listening to click event to explicitly focus the row element.
100
- * @return {?}
101
- */
102
- clickListener() {
103
- this.focus();
104
- }
105
- /**
106
- * @return {?}
107
- */
108
- focus() {
109
- this._elementRef.nativeElement.focus();
110
- }
111
- }
112
- TdDataTableRowComponent.decorators = [
113
- { type: Component, args: [{
114
- /* tslint:disable-next-line */
115
- selector: 'tr[td-data-table-row]',
116
- template: "<ng-content></ng-content>\n",
117
- styles: [":host{border-bottom-style:solid;border-bottom-width:1px}:host.td-data-table-row{height:48px}:host.td-data-table-column-row{height:56px}"]
118
- }] }
119
- ];
120
- /** @nocollapse */
121
- TdDataTableRowComponent.ctorParameters = () => [
122
- { type: ElementRef },
123
- { type: Renderer2 }
124
- ];
125
- TdDataTableRowComponent.propDecorators = {
126
- selected: [{ type: Input, args: ['selected',] }],
127
- clickListener: [{ type: HostListener, args: ['click',] }]
128
- };
129
- if (false) {
130
- /**
131
- * @type {?}
132
- * @private
133
- */
134
- TdDataTableRowComponent.prototype._selected;
135
- /**
136
- * @type {?}
137
- * @private
138
- */
139
- TdDataTableRowComponent.prototype._elementRef;
140
- /**
141
- * @type {?}
142
- * @private
143
- */
144
- TdDataTableRowComponent.prototype._renderer;
145
- }
146
-
147
- /**
148
- * @fileoverview added by tsickle
149
- * Generated from: directives/data-table-template.directive.ts
150
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
151
- */
152
- class TdDataTableTemplateDirective extends TemplatePortalDirective {
153
- /**
154
- * @param {?} templateRef
155
- * @param {?} viewContainerRef
156
- */
157
- constructor(templateRef, viewContainerRef) {
158
- super(templateRef, viewContainerRef);
159
- }
160
- }
161
- TdDataTableTemplateDirective.decorators = [
162
- { type: Directive, args: [{ selector: '[tdDataTableTemplate]ng-template' },] }
163
- ];
164
- /** @nocollapse */
165
- TdDataTableTemplateDirective.ctorParameters = () => [
166
- { type: TemplateRef },
167
- { type: ViewContainerRef }
168
- ];
169
- TdDataTableTemplateDirective.propDecorators = {
170
- tdDataTableTemplate: [{ type: Input }]
171
- };
172
- if (false) {
173
- /** @type {?} */
174
- TdDataTableTemplateDirective.prototype.tdDataTableTemplate;
175
- }
176
-
177
- /**
178
- * @fileoverview added by tsickle
179
- * Generated from: data-table.component.ts
180
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
181
- */
182
- /** @enum {string} */
183
- const TdDataTableSortingOrder = {
184
- Ascending: "ASC",
185
- Descending: "DESC",
186
- };
187
- /**
188
- * @record
189
- */
190
- function ITdDataTableColumnWidth() { }
191
- if (false) {
192
- /** @type {?|undefined} */
193
- ITdDataTableColumnWidth.prototype.min;
194
- /** @type {?|undefined} */
195
- ITdDataTableColumnWidth.prototype.max;
196
- }
197
- /**
198
- * @record
199
- */
200
- function ITdDataTableColumn() { }
201
- if (false) {
202
- /** @type {?} */
203
- ITdDataTableColumn.prototype.name;
204
- /** @type {?} */
205
- ITdDataTableColumn.prototype.label;
206
- /** @type {?|undefined} */
207
- ITdDataTableColumn.prototype.tooltip;
208
- /** @type {?|undefined} */
209
- ITdDataTableColumn.prototype.numeric;
210
- /** @type {?|undefined} */
211
- ITdDataTableColumn.prototype.format;
212
- /** @type {?|undefined} */
213
- ITdDataTableColumn.prototype.nested;
214
- /** @type {?|undefined} */
215
- ITdDataTableColumn.prototype.sortable;
216
- /** @type {?|undefined} */
217
- ITdDataTableColumn.prototype.hidden;
218
- /** @type {?|undefined} */
219
- ITdDataTableColumn.prototype.filter;
220
- /** @type {?|undefined} */
221
- ITdDataTableColumn.prototype.width;
222
- /** @type {?|undefined} */
223
- ITdDataTableColumn.prototype.columnSortOrder;
224
- }
225
- /**
226
- * @record
227
- */
228
- function ITdDataTableSelectEvent() { }
229
- if (false) {
230
- /** @type {?} */
231
- ITdDataTableSelectEvent.prototype.row;
232
- /** @type {?} */
233
- ITdDataTableSelectEvent.prototype.selected;
234
- /** @type {?} */
235
- ITdDataTableSelectEvent.prototype.index;
236
- }
237
- /**
238
- * @record
239
- */
240
- function ITdDataTableSelectAllEvent() { }
241
- if (false) {
242
- /** @type {?} */
243
- ITdDataTableSelectAllEvent.prototype.rows;
244
- /** @type {?} */
245
- ITdDataTableSelectAllEvent.prototype.selected;
246
- }
247
- /**
248
- * @record
249
- */
250
- function ITdDataTableRowClickEvent() { }
251
- if (false) {
252
- /** @type {?} */
253
- ITdDataTableRowClickEvent.prototype.row;
254
- /** @type {?} */
255
- ITdDataTableRowClickEvent.prototype.index;
256
- }
257
- /**
258
- * @record
259
- */
260
- function IInternalColumnWidth() { }
261
- if (false) {
262
- /** @type {?} */
263
- IInternalColumnWidth.prototype.value;
264
- /** @type {?} */
265
- IInternalColumnWidth.prototype.limit;
266
- /** @type {?} */
267
- IInternalColumnWidth.prototype.index;
268
- /** @type {?|undefined} */
269
- IInternalColumnWidth.prototype.min;
270
- /** @type {?|undefined} */
271
- IInternalColumnWidth.prototype.max;
272
- }
273
- /**
274
- * Constant to set the rows offset before and after the viewport
275
- * @type {?}
276
- */
277
- const TD_VIRTUAL_OFFSET = 2;
278
- /**
279
- * Constant to set default row height if none is provided
280
- * @type {?}
281
- */
282
- const TD_VIRTUAL_DEFAULT_ROW_HEIGHT = 48;
283
- class TdDataTableBase {
284
- /**
285
- * @param {?} _changeDetectorRef
286
- */
287
- constructor(_changeDetectorRef) {
288
- this._changeDetectorRef = _changeDetectorRef;
289
- }
290
- }
291
- if (false) {
292
- /** @type {?} */
293
- TdDataTableBase.prototype._changeDetectorRef;
294
- }
295
- /* tslint:disable-next-line */
296
- /** @type {?} */
297
- const _TdDataTableMixinBase = mixinControlValueAccessor(TdDataTableBase, []);
298
- class TdDataTableComponent extends _TdDataTableMixinBase {
299
- /**
300
- * @param {?} _document
301
- * @param {?} _elementRef
302
- * @param {?} _domSanitizer
303
- * @param {?} _changeDetectorRef
304
- */
305
- constructor(_document, _elementRef, _domSanitizer, _changeDetectorRef) {
306
- super(_changeDetectorRef);
307
- this._document = _document;
308
- this._elementRef = _elementRef;
309
- this._domSanitizer = _domSanitizer;
310
- this._hostWidth = 0;
311
- /**
312
- * manually resizable columns
313
- */
314
- this._resizableColumns = false;
315
- this._columnClientX = 0;
316
- this._onColumnResize = new Subject();
317
- this._widths = [];
318
- this._onResize = new Subject();
319
- this._scrollHorizontalOffset = 0;
320
- this._onHorizontalScroll = new Subject();
321
- this._onVerticalScroll = new Subject();
322
- // Array of cached row heights to allow dynamic row heights
323
- this._rowHeightCache = [];
324
- // Total pseudo height of all the elements
325
- this._totalHeight = 0;
326
- // Total host height for the viewport
327
- this._hostHeight = 0;
328
- // Scrolled vertical pixels
329
- this._scrollVerticalOffset = 0;
330
- // Variables that set from and to which rows will be rendered
331
- this._fromRow = 0;
332
- this._toRow = 0;
333
- this._selectable = false;
334
- this._clickable = false;
335
- this._multiple = true;
336
- this._allSelected = false;
337
- this._indeterminate = false;
338
- /**
339
- * sorting
340
- */
341
- this._sortable = false;
342
- this._sortOrder = TdDataTableSortingOrder.Ascending;
343
- /**
344
- * shift select
345
- */
346
- this._shiftPreviouslyPressed = false;
347
- this._lastSelectedIndex = -1;
348
- this._firstSelectedIndex = -1;
349
- this._firstCheckboxValue = false;
350
- /**
351
- * template fetching support
352
- */
353
- this._templateMap = new Map();
354
- /**
355
- * sortChange?: function
356
- * Event emitted when the column headers are clicked. [sortable] needs to be enabled.
357
- * Emits an [ITdDataTableSortChangeEvent] implemented object.
358
- */
359
- this.sortChange = new EventEmitter();
360
- /**
361
- * rowSelect?: function
362
- * Event emitted when a row is selected/deselected. [selectable] needs to be enabled.
363
- * Emits an [ITdDataTableSelectEvent] implemented object.
364
- */
365
- this.rowSelect = new EventEmitter();
366
- /**
367
- * rowClick?: function
368
- * Event emitted when a row is clicked.
369
- * Emits an [ITdDataTableRowClickEvent] implemented object.
370
- */
371
- this.rowClick = new EventEmitter();
372
- /**
373
- * selectAll?: function
374
- * Event emitted when all rows are selected/deselected by the all checkbox. [selectable] needs to be enabled.
375
- * Emits an [ITdDataTableSelectAllEvent] implemented object.
376
- */
377
- this.selectAll = new EventEmitter();
378
- /**
379
- * compareWith?: function(row, model): boolean
380
- * Allows custom comparison between row and model to see if row is selected or not
381
- * Default comparation is by reference
382
- */
383
- this.compareWith = (/**
384
- * @param {?} row
385
- * @param {?} model
386
- * @return {?}
387
- */
388
- (row, model) => {
389
- return row === model;
390
- });
391
- }
392
- /**
393
- * @return {?}
394
- */
395
- get resizingColumn() {
396
- return this._resizingColumn;
397
- }
398
- /**
399
- * @return {?}
400
- */
401
- get hostWidth() {
402
- // if the checkboxes are rendered, we need to remove their width
403
- // from the total width to calculate properly
404
- if (this.selectable) {
405
- return this._hostWidth - 42;
406
- }
407
- return this._hostWidth;
408
- }
409
- /**
410
- * Returns the offset style with a proper calculation on how much it should move
411
- * over the y axis of the total height
412
- * @return {?}
413
- */
414
- get offsetTransform() {
415
- return this._offsetTransform;
416
- }
417
- /**
418
- * Returns the assumed total height of the rows
419
- * @return {?}
420
- */
421
- get totalHeight() {
422
- return this._totalHeight;
423
- }
424
- /**
425
- * Returns the initial row to render in the viewport
426
- * @return {?}
427
- */
428
- get fromRow() {
429
- return this._fromRow;
430
- }
431
- /**
432
- * Returns the last row to render in the viewport
433
- * @return {?}
434
- */
435
- get toRow() {
436
- return this._toRow;
437
- }
438
- /**
439
- * Returns scroll position to reposition column headers
440
- * @return {?}
441
- */
442
- get columnsLeftScroll() {
443
- return this._scrollHorizontalOffset * -1;
444
- }
445
- /**
446
- * Returns true if all values are selected.
447
- * @return {?}
448
- */
449
- get allSelected() {
450
- return this._allSelected;
451
- }
452
- /**
453
- * Returns true if all values are not deselected
454
- * and at least one is.
455
- * @return {?}
456
- */
457
- get indeterminate() {
458
- return this._indeterminate;
459
- }
460
- /**
461
- * data?: {[key: string]: any}[]
462
- * Sets the data to be rendered as rows.
463
- * @param {?} data
464
- * @return {?}
465
- */
466
- set data(data) {
467
- this._data = data;
468
- this._rowHeightCache = [];
469
- Promise.resolve().then((/**
470
- * @return {?}
471
- */
472
- () => {
473
- this.refresh();
474
- // scroll back to the top if the data has changed
475
- this._scrollableDiv.nativeElement.scrollTop = 0;
476
- }));
477
- }
478
- /**
479
- * @return {?}
480
- */
481
- get data() {
482
- return this._data;
483
- }
484
- /**
485
- * @return {?}
486
- */
487
- get virtualData() {
488
- return this._virtualData;
489
- }
490
- /**
491
- * columns?: ITdDataTableColumn[]
492
- * Sets additional column configuration. [ITdDataTableColumn.name] has to exist in [data] as key.
493
- * Defaults to [data] keys.
494
- * @param {?} cols
495
- * @return {?}
496
- */
497
- set columns(cols) {
498
- this._columns = cols;
499
- }
500
- /**
501
- * @return {?}
502
- */
503
- get columns() {
504
- if (this._columns) {
505
- return this._columns;
506
- }
507
- if (this.hasData) {
508
- this._columns = [];
509
- // if columns is undefined, use key in [data] rows as name and label for column headers.
510
- /** @type {?} */
511
- const row = this._data[0];
512
- Object.keys(row).forEach((/**
513
- * @param {?} k
514
- * @return {?}
515
- */
516
- (k) => {
517
- if (!this._columns.find((/**
518
- * @param {?} c
519
- * @return {?}
520
- */
521
- (c) => c.name === k))) {
522
- this._columns.push({ name: k, label: k });
523
- }
524
- }));
525
- return this._columns;
526
- }
527
- else {
528
- return [];
529
- }
530
- }
531
- /**
532
- * resizableColumns?: boolean
533
- * Enables manual column resize.
534
- * Defaults to 'false'
535
- * @param {?} resizableColumns
536
- * @return {?}
537
- */
538
- set resizableColumns(resizableColumns) {
539
- this._resizableColumns = coerceBooleanProperty(resizableColumns);
540
- }
541
- /**
542
- * @return {?}
543
- */
544
- get resizableColumns() {
545
- return this._resizableColumns;
546
- }
547
- /**
548
- * selectable?: boolean
549
- * Enables row selection events, hover and selected row states.
550
- * Defaults to 'false'
551
- * @param {?} selectable
552
- * @return {?}
553
- */
554
- set selectable(selectable) {
555
- this._selectable = coerceBooleanProperty(selectable);
556
- }
557
- /**
558
- * @return {?}
559
- */
560
- get selectable() {
561
- return this._selectable;
562
- }
563
- /**
564
- * clickable?: boolean
565
- * Enables row click events, hover.
566
- * Defaults to 'false'
567
- * @param {?} clickable
568
- * @return {?}
569
- */
570
- set clickable(clickable) {
571
- this._clickable = coerceBooleanProperty(clickable);
572
- }
573
- /**
574
- * @return {?}
575
- */
576
- get clickable() {
577
- return this._clickable;
578
- }
579
- /**
580
- * multiple?: boolean
581
- * Enables multiple row selection. [selectable] needs to be enabled.
582
- * Defaults to 'false'
583
- * @param {?} multiple
584
- * @return {?}
585
- */
586
- set multiple(multiple) {
587
- this._multiple = coerceBooleanProperty(multiple);
588
- }
589
- /**
590
- * @return {?}
591
- */
592
- get multiple() {
593
- return this._multiple;
594
- }
595
- /**
596
- * sortable?: boolean
597
- * Enables sorting events, sort icons and active column states.
598
- * Defaults to 'false'
599
- * @param {?} sortable
600
- * @return {?}
601
- */
602
- set sortable(sortable) {
603
- this._sortable = coerceBooleanProperty(sortable);
604
- }
605
- /**
606
- * @return {?}
607
- */
608
- get sortable() {
609
- return this._sortable;
610
- }
611
- /**
612
- * sortBy?: string
613
- * Sets the active sort column. [sortable] needs to be enabled.
614
- * @param {?} columnName
615
- * @return {?}
616
- */
617
- set sortBy(columnName) {
618
- if (!columnName) {
619
- return;
620
- }
621
- /** @type {?} */
622
- const column = this.columns.find((/**
623
- * @param {?} c
624
- * @return {?}
625
- */
626
- (c) => c.name === columnName));
627
- if (!column) {
628
- throw new Error('[sortBy] must be a valid column name');
629
- }
630
- this._sortBy = column;
631
- }
632
- /**
633
- * @return {?}
634
- */
635
- get sortByColumn() {
636
- return this._sortBy;
637
- }
638
- /**
639
- * sortOrder?: ['ASC' | 'DESC'] or TdDataTableSortingOrder
640
- * Sets the sort order of the [sortBy] column. [sortable] needs to be enabled.
641
- * Defaults to 'ASC' or TdDataTableSortingOrder.Ascending
642
- * @param {?} order
643
- * @return {?}
644
- */
645
- set sortOrder(order) {
646
- /** @type {?} */
647
- const sortOrder = order ? order.toUpperCase() : 'ASC';
648
- if (sortOrder !== 'DESC' && sortOrder !== 'ASC') {
649
- throw new Error('[sortOrder] must be empty, ASC or DESC');
650
- }
651
- this._sortOrder = sortOrder === 'ASC' ? TdDataTableSortingOrder.Ascending : TdDataTableSortingOrder.Descending;
652
- }
653
- /**
654
- * @return {?}
655
- */
656
- get sortOrderEnum() {
657
- return this._sortOrder;
658
- }
659
- /**
660
- * @return {?}
661
- */
662
- get hasData() {
663
- return this._data && this._data.length > 0;
664
- }
665
- /**
666
- * Initialize observable for resize and scroll events
667
- * @return {?}
668
- */
669
- ngOnInit() {
670
- // initialize observable for resize calculations
671
- this._resizeSubs = this._onResize.asObservable().subscribe((/**
672
- * @return {?}
673
- */
674
- () => {
675
- if (this._rows) {
676
- this._rows.toArray().forEach((/**
677
- * @param {?} row
678
- * @param {?} index
679
- * @return {?}
680
- */
681
- (row, index) => {
682
- this._rowHeightCache[this.fromRow + index] = row.height + 1;
683
- }));
684
- }
685
- this._calculateWidths();
686
- this._calculateVirtualRows();
687
- }));
688
- // initialize observable for column resize calculations
689
- this._columnResizeSubs = this._onColumnResize
690
- .asObservable()
691
- .pipe(debounceTime(0))
692
- .subscribe((/**
693
- * @param {?} clientX
694
- * @return {?}
695
- */
696
- (clientX) => {
697
- this._columnClientX = clientX;
698
- this._calculateWidths();
699
- this._changeDetectorRef.markForCheck();
700
- }));
701
- // initialize observable for scroll column header reposition
702
- this._horizontalScrollSubs = this._onHorizontalScroll.asObservable().subscribe((/**
703
- * @param {?} horizontalScroll
704
- * @return {?}
705
- */
706
- (horizontalScroll) => {
707
- this._scrollHorizontalOffset = horizontalScroll;
708
- this._changeDetectorRef.markForCheck();
709
- }));
710
- // initialize observable for virtual scroll rendering
711
- this._verticalScrollSubs = this._onVerticalScroll.asObservable().subscribe((/**
712
- * @param {?} verticalScroll
713
- * @return {?}
714
- */
715
- (verticalScroll) => {
716
- this._scrollVerticalOffset = verticalScroll;
717
- this._calculateVirtualRows();
718
- this._changeDetectorRef.markForCheck();
719
- }));
720
- this._valueChangesSubs = this.valueChanges.subscribe((/**
721
- * @param {?} value
722
- * @return {?}
723
- */
724
- (value) => {
725
- this.refresh();
726
- }));
727
- }
728
- /**
729
- * Loads templates and sets them in a map for faster access.
730
- * @return {?}
731
- */
732
- ngAfterContentInit() {
733
- for (const template of this._templates.toArray()) {
734
- this._templateMap.set(template.tdDataTableTemplate, template.templateRef);
735
- }
736
- }
737
- /**
738
- * Checks hosts native elements widths to see if it has changed (resize check)
739
- * @return {?}
740
- */
741
- ngAfterContentChecked() {
742
- // check if the scroll has been reset when element is hidden
743
- if (this._scrollVerticalOffset - this._scrollableDiv.nativeElement.scrollTop > 5) {
744
- // scroll back to the top if element has been reset
745
- this._onVerticalScroll.next(0);
746
- }
747
- if (this._elementRef.nativeElement) {
748
- /** @type {?} */
749
- const newHostWidth = this._elementRef.nativeElement.getBoundingClientRect().width;
750
- // if the width has changed then we throw a resize event.
751
- if (this._hostWidth !== newHostWidth) {
752
- setTimeout((/**
753
- * @return {?}
754
- */
755
- () => {
756
- this._hostWidth = newHostWidth;
757
- this._onResize.next();
758
- }), 0);
759
- }
760
- }
761
- if (this._scrollableDiv.nativeElement) {
762
- /** @type {?} */
763
- const newHostHeight = this._scrollableDiv.nativeElement.getBoundingClientRect().height;
764
- // if the height of the viewport has changed, then we mark for check
765
- if (this._hostHeight !== newHostHeight) {
766
- this._hostHeight = newHostHeight;
767
- this._calculateVirtualRows();
768
- this._changeDetectorRef.markForCheck();
769
- }
770
- }
771
- }
772
- /**
773
- * Registers to an observable that checks if all rows have been rendered
774
- * so we can start calculating the widths
775
- * @return {?}
776
- */
777
- ngAfterViewInit() {
778
- this._rowsChangedSubs = this._rows.changes.pipe(debounceTime(0)).subscribe((/**
779
- * @return {?}
780
- */
781
- () => {
782
- this._onResize.next();
783
- }));
784
- this._calculateVirtualRows();
785
- }
786
- /**
787
- * Unsubscribes observables when data table is destroyed
788
- * @return {?}
789
- */
790
- ngOnDestroy() {
791
- if (this._resizeSubs) {
792
- this._resizeSubs.unsubscribe();
793
- }
794
- if (this._columnResizeSubs) {
795
- this._columnResizeSubs.unsubscribe();
796
- }
797
- if (this._horizontalScrollSubs) {
798
- this._horizontalScrollSubs.unsubscribe();
799
- }
800
- if (this._verticalScrollSubs) {
801
- this._verticalScrollSubs.unsubscribe();
802
- }
803
- if (this._rowsChangedSubs) {
804
- this._rowsChangedSubs.unsubscribe();
805
- }
806
- if (this._valueChangesSubs) {
807
- this._valueChangesSubs.unsubscribe();
808
- }
809
- }
810
- /**
811
- * Method that gets executed every time there is a scroll event
812
- * Calls the scroll observable
813
- * @param {?} event
814
- * @return {?}
815
- */
816
- handleScroll(event) {
817
- /** @type {?} */
818
- const element = (/** @type {?} */ (event.target));
819
- if (element) {
820
- /** @type {?} */
821
- const horizontalScroll = element.scrollLeft;
822
- if (this._scrollHorizontalOffset !== horizontalScroll) {
823
- this._onHorizontalScroll.next(horizontalScroll);
824
- }
825
- /** @type {?} */
826
- const verticalScroll = element.scrollTop;
827
- if (this._scrollVerticalOffset !== verticalScroll) {
828
- this._onVerticalScroll.next(verticalScroll);
829
- }
830
- }
831
- }
832
- /**
833
- * Returns the width needed for the columns via index
834
- * @param {?} index
835
- * @return {?}
836
- */
837
- getColumnWidth(index) {
838
- if (this._widths[index]) {
839
- return this._widths[index].value;
840
- }
841
- return undefined;
842
- }
843
- /**
844
- * @param {?} column
845
- * @param {?} value
846
- * @return {?}
847
- */
848
- getCellValue(column, value) {
849
- if (column.nested === undefined || column.nested) {
850
- return this._getNestedValue(column.name, value);
851
- }
852
- return value[column.name];
853
- }
854
- /**
855
- * Getter method for template references
856
- * @param {?} name
857
- * @return {?}
858
- */
859
- getTemplateRef(name) {
860
- return this._templateMap.get(name);
861
- }
862
- /**
863
- * Clears model (ngModel) of component by removing all values in array.
864
- * @return {?}
865
- */
866
- clearModel() {
867
- this.value.splice(0, this.value.length);
868
- }
869
- /**
870
- * Refreshes data table and rerenders [data] and [columns]
871
- * @return {?}
872
- */
873
- refresh() {
874
- this._calculateVirtualRows();
875
- this._calculateWidths();
876
- this._calculateCheckboxState();
877
- this._changeDetectorRef.markForCheck();
878
- }
879
- /**
880
- * Selects or clears all rows depending on 'checked' value.
881
- * @param {?} checked
882
- * @return {?}
883
- */
884
- _selectAll(checked) {
885
- /** @type {?} */
886
- const toggledRows = [];
887
- if (checked) {
888
- this._data.forEach((/**
889
- * @param {?} row
890
- * @return {?}
891
- */
892
- (row) => {
893
- // skiping already selected rows
894
- if (!this.isRowSelected(row)) {
895
- this.value.push(row);
896
- // checking which ones are being toggled
897
- toggledRows.push(row);
898
- }
899
- }));
900
- this._allSelected = true;
901
- this._indeterminate = true;
902
- }
903
- else {
904
- this._data.forEach((/**
905
- * @param {?} row
906
- * @return {?}
907
- */
908
- (row) => {
909
- // checking which ones are being toggled
910
- if (this.isRowSelected(row)) {
911
- toggledRows.push(row);
912
- /** @type {?} */
913
- const modelRow = this.value.filter((/**
914
- * @param {?} val
915
- * @return {?}
916
- */
917
- (val) => {
918
- return this.compareWith(row, val);
919
- }))[0];
920
- /** @type {?} */
921
- const index = this.value.indexOf(modelRow);
922
- if (index > -1) {
923
- this.value.splice(index, 1);
924
- }
925
- }
926
- }));
927
- this._allSelected = false;
928
- this._indeterminate = false;
929
- }
930
- this.selectAll.emit({ rows: toggledRows, selected: checked });
931
- this.onChange(this.value);
932
- }
933
- /**
934
- * Checks if row is selected
935
- * @param {?} row
936
- * @return {?}
937
- */
938
- isRowSelected(row) {
939
- // compare items by [compareWith] function
940
- return this.value
941
- ? this.value.filter((/**
942
- * @param {?} val
943
- * @return {?}
944
- */
945
- (val) => {
946
- return this.compareWith(row, val);
947
- })).length > 0
948
- : false;
949
- }
950
- /**
951
- * Selects or clears a row depending on 'checked' value if the row 'isSelectable'
952
- * handles cntrl clicks and shift clicks for multi-select
953
- * @param {?} row
954
- * @param {?} event
955
- * @param {?} currentSelected
956
- * @return {?}
957
- */
958
- select(row, event, currentSelected) {
959
- if (this.selectable) {
960
- this.blockEvent(event);
961
- // Check to see if Shift key is selected and need to select everything in between
962
- /** @type {?} */
963
- const mouseEvent = (/** @type {?} */ (event));
964
- if (this.multiple && mouseEvent && mouseEvent.shiftKey && this._lastSelectedIndex > -1) {
965
- /** @type {?} */
966
- let firstIndex = currentSelected;
967
- /** @type {?} */
968
- let lastIndex = this._lastSelectedIndex;
969
- if (currentSelected > this._lastSelectedIndex) {
970
- firstIndex = this._lastSelectedIndex;
971
- lastIndex = currentSelected;
972
- }
973
- // if clicking a checkbox behind the initial check, then toggle all selections expect the initial checkbox
974
- // else the checkboxes clicked are all after the initial one
975
- if ((this._firstSelectedIndex >= currentSelected && this._lastSelectedIndex > this._firstSelectedIndex) ||
976
- (this._firstSelectedIndex <= currentSelected && this._lastSelectedIndex < this._firstSelectedIndex)) {
977
- for (let i = firstIndex; i <= lastIndex; i++) {
978
- if (this._firstSelectedIndex !== i) {
979
- this._doSelection(this._data[i], i);
980
- }
981
- }
982
- }
983
- else if (this._firstSelectedIndex > currentSelected || this._firstSelectedIndex < currentSelected) {
984
- // change indexes depending on where the next checkbox is selected (before or after)
985
- if (this._firstSelectedIndex > currentSelected) {
986
- lastIndex--;
987
- }
988
- else if (this._firstSelectedIndex < currentSelected) {
989
- firstIndex++;
990
- }
991
- for (let i = firstIndex; i <= lastIndex; i++) {
992
- /** @type {?} */
993
- const rowSelected = this.isRowSelected(this._data[i]);
994
- // if row is selected and first checkbox was selected
995
- // or if row was unselected and first checkbox was unselected
996
- // we ignore the toggle
997
- if ((this._firstCheckboxValue && !rowSelected) || (!this._firstCheckboxValue && rowSelected)) {
998
- this._doSelection(this._data[i], i);
999
- }
1000
- else if (this._shiftPreviouslyPressed &&
1001
- ((currentSelected >= this._firstSelectedIndex && currentSelected <= this._lastSelectedIndex) ||
1002
- (currentSelected <= this._firstSelectedIndex && currentSelected >= this._lastSelectedIndex))) {
1003
- // else if the checkbox selected was in the middle of the last selection and the first selection
1004
- // then we undo the selections
1005
- this._doSelection(this._data[i], i);
1006
- }
1007
- }
1008
- }
1009
- this._shiftPreviouslyPressed = true;
1010
- // if shift wasnt pressed, then we take the element checked as the first row
1011
- // incase the next click uses shift
1012
- }
1013
- else if (mouseEvent && !mouseEvent.shiftKey) {
1014
- this._firstCheckboxValue = this._doSelection(row, currentSelected);
1015
- this._shiftPreviouslyPressed = false;
1016
- this._firstSelectedIndex = currentSelected;
1017
- }
1018
- this._lastSelectedIndex = currentSelected;
1019
- }
1020
- }
1021
- /**
1022
- * Overrides the onselectstart method of the document so other text on the page
1023
- * doesn't get selected when doing shift selections.
1024
- * @return {?}
1025
- */
1026
- disableTextSelection() {
1027
- if (this._document) {
1028
- this._document.onselectstart = (/**
1029
- * @return {?}
1030
- */
1031
- function () {
1032
- return false;
1033
- });
1034
- }
1035
- }
1036
- /**
1037
- * Resets the original onselectstart method.
1038
- * @return {?}
1039
- */
1040
- enableTextSelection() {
1041
- if (this._document) {
1042
- this._document.onselectstart = undefined;
1043
- }
1044
- }
1045
- /**
1046
- * emits the onRowClickEvent when a row is clicked
1047
- * if clickable is true and selectable is false then select the row
1048
- * @param {?} row
1049
- * @param {?} index
1050
- * @param {?} event
1051
- * @return {?}
1052
- */
1053
- handleRowClick(row, index, event) {
1054
- if (this.clickable) {
1055
- // ignoring linting rules here because attribute it actually null or not there
1056
- // can't check for undefined
1057
- /** @type {?} */
1058
- const srcElement = event.srcElement || event.currentTarget;
1059
- /** @type {?} */
1060
- const element = (/** @type {?} */ (event.target));
1061
- /* tslint:disable-next-line */
1062
- if (srcElement.getAttribute('stopRowClick') === null && element.tagName.toLowerCase() !== 'mat-pseudo-checkbox') {
1063
- this.rowClick.emit({
1064
- row,
1065
- index,
1066
- });
1067
- }
1068
- }
1069
- }
1070
- /**
1071
- * Method handle for sort click event in column headers.
1072
- * @param {?} column
1073
- * @return {?}
1074
- */
1075
- handleSort(column) {
1076
- if (this._sortBy === column) {
1077
- this._sortOrder =
1078
- this._sortOrder === TdDataTableSortingOrder.Ascending
1079
- ? TdDataTableSortingOrder.Descending
1080
- : TdDataTableSortingOrder.Ascending;
1081
- }
1082
- else {
1083
- this._sortBy = column;
1084
- this._sortOrder = TdDataTableSortingOrder.Ascending;
1085
- }
1086
- this.sortChange.next({ name: this._sortBy.name, order: this._sortOrder });
1087
- }
1088
- /**
1089
- * Handle all keyup events when focusing a data table row
1090
- * @param {?} event
1091
- * @param {?} row
1092
- * @param {?} index
1093
- * @return {?}
1094
- */
1095
- _rowKeyup(event, row, index) {
1096
- switch (event.keyCode) {
1097
- case ENTER:
1098
- case SPACE:
1099
- /** if user presses enter or space, the row should be selected */
1100
- if (this.selectable) {
1101
- this._doSelection(this._data[this.fromRow + index], this.fromRow + index);
1102
- }
1103
- break;
1104
- case UP_ARROW:
1105
- /**
1106
- * if users presses the up arrow, we focus the prev row
1107
- * unless its the first row
1108
- */
1109
- if (index > 0) {
1110
- this._rows.toArray()[index - 1].focus();
1111
- }
1112
- this.blockEvent(event);
1113
- if (this.selectable && this.multiple && event.shiftKey && this.fromRow + index >= 0) {
1114
- this._doSelection(this._data[this.fromRow + index], this.fromRow + index);
1115
- }
1116
- break;
1117
- case DOWN_ARROW:
1118
- /**
1119
- * if users presses the down arrow, we focus the next row
1120
- * unless its the last row
1121
- */
1122
- if (index < this._rows.toArray().length - 1) {
1123
- this._rows.toArray()[index + 1].focus();
1124
- }
1125
- this.blockEvent(event);
1126
- if (this.selectable && this.multiple && event.shiftKey && this.fromRow + index < this._data.length) {
1127
- this._doSelection(this._data[this.fromRow + index], this.fromRow + index);
1128
- }
1129
- break;
1130
- default:
1131
- // default
1132
- }
1133
- }
1134
- /**
1135
- * Sets column index of the dragged column and initial clientX of column
1136
- * @param {?} index
1137
- * @param {?} event
1138
- * @return {?}
1139
- */
1140
- _handleStartColumnDrag(index, event) {
1141
- this._columnClientX = event.clientX;
1142
- this._resizingColumn = index;
1143
- }
1144
- /**
1145
- * Calculates new width depending on new clientX of dragger column
1146
- * @param {?} event
1147
- * @return {?}
1148
- */
1149
- _handleColumnDrag(event) {
1150
- // check if there was been a separator clicked for resize
1151
- if (this._resizingColumn !== undefined && event.clientX > 0) {
1152
- /** @type {?} */
1153
- const xPosition = event.clientX;
1154
- // checks if the separator is being moved to try and resize the column, else dont do anything
1155
- if (xPosition > 0 && this._columnClientX > 0 && xPosition - this._columnClientX !== 0) {
1156
- // calculate the new width depending if making the column bigger or smaller
1157
- /** @type {?} */
1158
- let proposedManualWidth = this._widths[this._resizingColumn].value + (xPosition - this._columnClientX);
1159
- // if the proposed new width is less than the projected min width of the column, use projected min width
1160
- if (proposedManualWidth < this._colElements.toArray()[this._resizingColumn].projectedWidth) {
1161
- proposedManualWidth = this._colElements.toArray()[this._resizingColumn].projectedWidth;
1162
- }
1163
- this.columns[this._resizingColumn].width = proposedManualWidth;
1164
- // update new x position for the resized column
1165
- this._onColumnResize.next(xPosition);
1166
- }
1167
- }
1168
- }
1169
- /**
1170
- * Ends dragged flags
1171
- * @return {?}
1172
- */
1173
- _handleEndColumnDrag() {
1174
- this._columnClientX = undefined;
1175
- this._resizingColumn = undefined;
1176
- }
1177
- /**
1178
- * Method to prevent the default events
1179
- * @param {?} event
1180
- * @return {?}
1181
- */
1182
- blockEvent(event) {
1183
- event.preventDefault();
1184
- }
1185
- /**
1186
- * @private
1187
- * @param {?} name
1188
- * @param {?} value
1189
- * @return {?}
1190
- */
1191
- _getNestedValue(name, value) {
1192
- if (!(value instanceof Object) || !name) {
1193
- return value;
1194
- }
1195
- if (name.indexOf('.') > -1) {
1196
- /** @type {?} */
1197
- const splitName = name.split(/\.(.+)/, 2);
1198
- return this._getNestedValue(splitName[1], value[splitName[0]]);
1199
- }
1200
- else {
1201
- return value[name];
1202
- }
1203
- }
1204
- /**
1205
- * Does the actual Row Selection
1206
- * @private
1207
- * @param {?} row
1208
- * @param {?} rowIndex
1209
- * @return {?}
1210
- */
1211
- _doSelection(row, rowIndex) {
1212
- /** @type {?} */
1213
- const wasSelected = this.isRowSelected(row);
1214
- if (!wasSelected) {
1215
- if (!this._multiple) {
1216
- this.clearModel();
1217
- }
1218
- this.value.push(row);
1219
- }
1220
- else {
1221
- // compare items by [compareWith] function
1222
- row = this.value.filter((/**
1223
- * @param {?} val
1224
- * @return {?}
1225
- */
1226
- (val) => {
1227
- return this.compareWith(row, val);
1228
- }))[0];
1229
- /** @type {?} */
1230
- const index = this.value.indexOf(row);
1231
- if (index > -1) {
1232
- this.value.splice(index, 1);
1233
- }
1234
- }
1235
- this._calculateCheckboxState();
1236
- this.rowSelect.emit({ row, index: rowIndex, selected: !wasSelected });
1237
- this.onChange(this.value);
1238
- return !wasSelected;
1239
- }
1240
- /**
1241
- * Calculate all the state of all checkboxes
1242
- * @private
1243
- * @return {?}
1244
- */
1245
- _calculateCheckboxState() {
1246
- if (this._data) {
1247
- this._allSelected = typeof this._data.find((/**
1248
- * @param {?} d
1249
- * @return {?}
1250
- */
1251
- (d) => !this.isRowSelected(d))) === 'undefined';
1252
- this._indeterminate = false;
1253
- for (const row of this._data) {
1254
- if (!this.isRowSelected(row)) {
1255
- continue;
1256
- }
1257
- this._indeterminate = true;
1258
- break;
1259
- }
1260
- }
1261
- }
1262
- /**
1263
- * Calculates the widths for columns and cells depending on content
1264
- * @private
1265
- * @return {?}
1266
- */
1267
- _calculateWidths() {
1268
- if (this._colElements && this._colElements.length) {
1269
- this._widths = [];
1270
- this._colElements.forEach((/**
1271
- * @param {?} col
1272
- * @param {?} index
1273
- * @return {?}
1274
- */
1275
- (col, index) => {
1276
- this._adjustColumnWidth(index, this._calculateWidth());
1277
- }));
1278
- this._adjustColumnWidhts();
1279
- this._changeDetectorRef.markForCheck();
1280
- }
1281
- }
1282
- /**
1283
- * Adjusts columns after calculation to see if they need to be recalculated.
1284
- * @private
1285
- * @return {?}
1286
- */
1287
- _adjustColumnWidhts() {
1288
- /** @type {?} */
1289
- let fixedTotalWidth = 0;
1290
- // get the number of total columns that have flexible widths (not fixed or hidden)
1291
- /** @type {?} */
1292
- const flexibleWidths = this._widths.filter((/**
1293
- * @param {?} width
1294
- * @param {?} index
1295
- * @return {?}
1296
- */
1297
- (width, index) => {
1298
- if (this.columns[index].hidden) {
1299
- return false;
1300
- }
1301
- if (width.limit || width.max || width.min) {
1302
- fixedTotalWidth += width.value;
1303
- }
1304
- return !width.limit && !width.max && !width.min;
1305
- })).length;
1306
- // calculate how much pixes are left that could be spread across
1307
- // the flexible columns
1308
- /** @type {?} */
1309
- let recalculateHostWidth = 0;
1310
- if (fixedTotalWidth < this.hostWidth) {
1311
- recalculateHostWidth = this.hostWidth - fixedTotalWidth;
1312
- }
1313
- // if we have flexible columns and pixels to spare on them
1314
- // we try and spread the pixels across them
1315
- if (flexibleWidths && recalculateHostWidth) {
1316
- /** @type {?} */
1317
- const newValue = Math.floor(recalculateHostWidth / flexibleWidths);
1318
- /** @type {?} */
1319
- let adjustedNumber = 0;
1320
- // adjust the column widths with the spread pixels
1321
- this._widths.forEach((/**
1322
- * @param {?} colWidth
1323
- * @return {?}
1324
- */
1325
- (colWidth) => {
1326
- if ((this._widths[colWidth.index].max && this._widths[colWidth.index].value > newValue) ||
1327
- (this._widths[colWidth.index].min && this._widths[colWidth.index].value < newValue) ||
1328
- !this._widths[colWidth.index].limit) {
1329
- this._adjustColumnWidth(colWidth.index, newValue);
1330
- adjustedNumber++;
1331
- }
1332
- }));
1333
- // if there are still columns that need to be recalculated, we start over
1334
- /** @type {?} */
1335
- const newFlexibleWidths = this._widths.filter((/**
1336
- * @param {?} width
1337
- * @return {?}
1338
- */
1339
- (width) => {
1340
- return !width.limit && !width.max;
1341
- })).length;
1342
- if (newFlexibleWidths !== adjustedNumber && newFlexibleWidths !== flexibleWidths) {
1343
- this._adjustColumnWidhts();
1344
- }
1345
- }
1346
- }
1347
- /**
1348
- * Adjusts a single column to see if it can be recalculated
1349
- * @private
1350
- * @param {?} index
1351
- * @param {?} value
1352
- * @return {?}
1353
- */
1354
- _adjustColumnWidth(index, value) {
1355
- this._widths[index] = {
1356
- value,
1357
- index,
1358
- limit: false,
1359
- min: false,
1360
- max: false,
1361
- };
1362
- // flag to see if we need to skip the min width projection
1363
- // depending if a width or min width has been provided
1364
- /** @type {?} */
1365
- let skipMinWidthProjection = false;
1366
- if (this.columns[index]) {
1367
- // if the provided width has min/max, then we check to see if we need to set it
1368
- if (typeof this.columns[index].width === 'object') {
1369
- /** @type {?} */
1370
- const widthOpts = (/** @type {?} */ (this.columns[index].width));
1371
- // if the column width is less than the configured min, we override it
1372
- skipMinWidthProjection = widthOpts && !!widthOpts.min;
1373
- if (widthOpts && widthOpts.min >= this._widths[index].value) {
1374
- this._widths[index].value = widthOpts.min;
1375
- this._widths[index].min = true;
1376
- // if the column width is more than the configured max, we override it
1377
- }
1378
- else if (widthOpts && widthOpts.max <= this._widths[index].value) {
1379
- this._widths[index].value = widthOpts.max;
1380
- this._widths[index].max = true;
1381
- }
1382
- // if it has a fixed width, then we just set it
1383
- }
1384
- else if (typeof this.columns[index].width === 'number') {
1385
- this._widths[index].value = (/** @type {?} */ (this.columns[index].width));
1386
- skipMinWidthProjection = this._widths[index].limit = true;
1387
- }
1388
- }
1389
- // if there wasn't any width or min width provided, we set a min to what the column width min should be
1390
- if (!skipMinWidthProjection && this._widths[index].value < this._colElements.toArray()[index].projectedWidth) {
1391
- this._widths[index].value = this._colElements.toArray()[index].projectedWidth;
1392
- this._widths[index].min = true;
1393
- this._widths[index].limit = false;
1394
- }
1395
- }
1396
- /**
1397
- * Generic method to calculate column width
1398
- * @private
1399
- * @return {?}
1400
- */
1401
- _calculateWidth() {
1402
- /** @type {?} */
1403
- const renderedColumns = this.columns.filter((/**
1404
- * @param {?} col
1405
- * @return {?}
1406
- */
1407
- (col) => !col.hidden));
1408
- return Math.floor(this.hostWidth / renderedColumns.length);
1409
- }
1410
- /**
1411
- * Method to calculate the rows to be rendered in the viewport
1412
- * @private
1413
- * @return {?}
1414
- */
1415
- _calculateVirtualRows() {
1416
- /** @type {?} */
1417
- let scrolledRows = 0;
1418
- if (this._data) {
1419
- this._totalHeight = 0;
1420
- /** @type {?} */
1421
- let rowHeightSum = 0;
1422
- // loop through all rows to see if we have their height cached
1423
- // and sum them all to calculate the total height
1424
- this._data.forEach((/**
1425
- * @param {?} d
1426
- * @param {?} i
1427
- * @return {?}
1428
- */
1429
- (d, i) => {
1430
- // iterate through all rows at first and assume all
1431
- // rows are the same height as the first one
1432
- if (!this._rowHeightCache[i]) {
1433
- this._rowHeightCache[i] = this._rowHeightCache[0] || TD_VIRTUAL_DEFAULT_ROW_HEIGHT;
1434
- }
1435
- rowHeightSum += this._rowHeightCache[i];
1436
- // check how many rows have been scrolled
1437
- if (this._scrollVerticalOffset - rowHeightSum > 0) {
1438
- scrolledRows++;
1439
- }
1440
- }));
1441
- this._totalHeight = rowHeightSum;
1442
- // set the initial row to be rendered taking into account the row offset
1443
- /** @type {?} */
1444
- const fromRow = scrolledRows - TD_VIRTUAL_OFFSET;
1445
- this._fromRow = fromRow > 0 ? fromRow : 0;
1446
- /** @type {?} */
1447
- let hostHeight = this._hostHeight;
1448
- /** @type {?} */
1449
- let index = 0;
1450
- // calculate how many rows can fit in the viewport
1451
- while (hostHeight > 0) {
1452
- hostHeight -= this._rowHeightCache[this.fromRow + index];
1453
- index++;
1454
- }
1455
- // set the last row to be rendered taking into account the row offset
1456
- /** @type {?} */
1457
- const range = index - 1 + TD_VIRTUAL_OFFSET * 2;
1458
- /** @type {?} */
1459
- let toRow = range + this.fromRow;
1460
- // if last row is greater than the total length, then we use the total length
1461
- if (isFinite(toRow) && toRow > this._data.length) {
1462
- toRow = this._data.length;
1463
- }
1464
- else if (!isFinite(toRow)) {
1465
- toRow = TD_VIRTUAL_OFFSET;
1466
- }
1467
- this._toRow = toRow;
1468
- }
1469
- else {
1470
- this._totalHeight = 0;
1471
- this._fromRow = 0;
1472
- this._toRow = 0;
1473
- }
1474
- /** @type {?} */
1475
- let offset = 0;
1476
- // calculate the proper offset depending on how many rows have been scrolled
1477
- if (scrolledRows > TD_VIRTUAL_OFFSET) {
1478
- for (let index = 0; index < this.fromRow; index++) {
1479
- offset += this._rowHeightCache[index];
1480
- }
1481
- }
1482
- this._offsetTransform = this._domSanitizer.bypassSecurityTrustStyle('translateY(' + (offset - this.totalHeight) + 'px)');
1483
- if (this._data) {
1484
- this._virtualData = this.data.slice(this.fromRow, this.toRow);
1485
- }
1486
- // mark for check at the end of the queue so we are sure
1487
- // that the changes will be marked
1488
- Promise.resolve().then((/**
1489
- * @return {?}
1490
- */
1491
- () => {
1492
- this._changeDetectorRef.markForCheck();
1493
- }));
1494
- }
1495
- }
1496
- TdDataTableComponent.decorators = [
1497
- { type: Component, args: [{
1498
- providers: [
1499
- {
1500
- provide: NG_VALUE_ACCESSOR,
1501
- useExisting: forwardRef((/**
1502
- * @return {?}
1503
- */
1504
- () => TdDataTableComponent)),
1505
- multi: true,
1506
- },
1507
- ],
1508
- selector: 'td-data-table',
1509
- template: "<table td-data-table [style.left.px]=\"columnsLeftScroll\" [class.mat-selectable]=\"selectable\">\n <thead class=\"td-data-table-head\" (dragover)=\"_handleColumnDrag($event)\">\n <tr td-data-table-column-row>\n <th td-data-table-column class=\"mat-checkbox-column\" *ngIf=\"selectable\">\n <mat-checkbox\n #checkBoxAll\n *ngIf=\"multiple\"\n [disabled]=\"!hasData\"\n [indeterminate]=\"indeterminate && !allSelected && hasData\"\n [checked]=\"allSelected && hasData\"\n (click)=\"blockEvent($event); _selectAll(!checkBoxAll.checked)\"\n (keyup.enter)=\"_selectAll(!checkBoxAll.checked)\"\n (keyup.space)=\"_selectAll(!checkBoxAll.checked)\"\n (keydown.space)=\"blockEvent($event)\"\n ></mat-checkbox>\n </th>\n <th\n td-data-table-column\n #columnElement\n *ngFor=\"let column of columns; let i = index; let last = last\"\n [style.min-width.px]=\"getColumnWidth(i)\"\n [style.max-width.px]=\"getColumnWidth(i)\"\n [name]=\"column.name\"\n [numeric]=\"column.numeric\"\n [active]=\"(column.sortable || sortable) && column === sortByColumn\"\n [sortable]=\"column.sortable || (sortable && column.sortable !== false)\"\n [sortOrder]=\"sortOrderEnum\"\n [hidden]=\"column.hidden\"\n [isColumnSortOrder]=\"!!column.columnSortOrder\"\n (sortChange)=\"handleSort(column)\"\n >\n <span [matTooltip]=\"column.tooltip\" [class]=\"column.columnSortOrder ? 'td-table-header-label' : ''\">\n {{ column.label }}\n <span *ngIf=\"column.columnSortOrder\" class=\"td-data-table-sort-badge\">\n {{ column.columnSortOrder || '' }}\n\n <span\n td-column-resizer\n *ngIf=\"resizableColumns\"\n draggable=\"true\"\n class=\"td-data-table-column-resizer\"\n [class.td-resizing]=\"i === resizingColumn\"\n (mousedown)=\"_handleStartColumnDrag(i, $event)\"\n (dragstart)=\"$event?.dataTransfer?.setData('text', '')\"\n (drag)=\"_handleColumnDrag($event)\"\n (dragend)=\"_handleEndColumnDrag()\"\n (mouseup)=\"_handleEndColumnDrag()\"\n >\n <span class=\"td-data-table-column-separator\"></span>\n </span>\n </span>\n </span>\n </th>\n </tr>\n </thead>\n</table>\n<div #scrollableDiv class=\"td-data-table-scrollable\" (scroll)=\"handleScroll($event)\">\n <div [style.height.px]=\"totalHeight\"></div>\n <table\n td-data-table\n [style.transform]=\"offsetTransform\"\n [style.position]=\"'absolute'\"\n [class.mat-selectable]=\"selectable\"\n [class.mat-clickable]=\"clickable\"\n >\n <tbody class=\"td-data-table-body\">\n <tr\n td-data-table-row\n #dtRow\n [tabIndex]=\"selectable ? 0 : -1\"\n [selected]=\"(clickable || selectable) && isRowSelected(row)\"\n *ngFor=\"let row of virtualData; let rowIndex = index\"\n (click)=\"handleRowClick(row, fromRow + rowIndex, $event)\"\n (keyup)=\"selectable && _rowKeyup($event, row, rowIndex)\"\n (keydown.space)=\"blockEvent($event)\"\n (keydown.shift.space)=\"blockEvent($event)\"\n (keydown.shift)=\"disableTextSelection()\"\n (keyup.shift)=\"enableTextSelection()\"\n >\n <td td-data-table-cell class=\"mat-checkbox-cell\" *ngIf=\"selectable\">\n <mat-pseudo-checkbox\n [state]=\"dtRow.selected ? 'checked' : 'unchecked'\"\n (mousedown)=\"disableTextSelection()\"\n (mouseup)=\"enableTextSelection()\"\n stopRowClick\n (click)=\"select(row, $event, fromRow + rowIndex)\"\n ></mat-pseudo-checkbox>\n </td>\n <td\n td-data-table-cell\n [numeric]=\"column.numeric\"\n [hidden]=\"column.hidden\"\n *ngFor=\"let column of columns; let i = index\"\n [style.min-width.px]=\"getColumnWidth(i)\"\n [style.max-width.px]=\"getColumnWidth(i)\"\n >\n <span *ngIf=\"!getTemplateRef(column.name)\">\n {{ column.format ? column.format(getCellValue(column, row)) : getCellValue(column, row) }}\n </span>\n <ng-template\n *ngIf=\"getTemplateRef(column.name)\"\n [ngTemplateOutlet]=\"getTemplateRef(column.name)\"\n [ngTemplateOutletContext]=\"{\n value: getCellValue(column, row),\n row: row,\n column: column.name,\n index: rowIndex\n }\"\n ></ng-template>\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n<ng-content></ng-content>\n",
1510
- inputs: ['value'],
1511
- changeDetection: ChangeDetectionStrategy.OnPush,
1512
- styles: [".td-data-table-sort-badge{-ms-flex-align:center;-ms-flex-pack:center;align-items:center;border-radius:50%;display:-ms-flexbox;display:flex;height:16px;justify-content:center;margin-left:4px;width:16px}:host{display:block;overflow:hidden}:host .td-data-table-scrollable{height:calc(100% - 56px);overflow:auto;position:relative}.td-table-header-label{display:-ms-flexbox;display:flex}.td-data-table-column-resizer{cursor:col-resize;right:0;width:6px}.td-data-table-column-resizer,.td-data-table-column-resizer .td-data-table-column-separator{height:100%;position:absolute;top:0}.td-data-table-column-resizer .td-data-table-column-separator{left:2px}.td-data-table-column-resizer.td-resizing{cursor:-webkit-grabbing}table.td-data-table{width:auto!important}table.td-data-table.mat-selectable tbody>tr.td-data-table-row{transition:background-color .2s}table.td-data-table.mat-selectable .td-data-table-column:first-child>.td-data-table-column-content-wrapper,table.td-data-table.mat-selectable td.td-data-table-cell:first-child>.td-data-table-column-content-wrapper,table.td-data-table.mat-selectable th.td-data-table-column:first-child>.td-data-table-column-content-wrapper{min-width:18px;padding:0 24px;width:18px}table.td-data-table.mat-selectable .td-data-table-column:nth-child(2)>.td-data-table-column-content-wrapper,table.td-data-table.mat-selectable td.td-data-table-cell:nth-child(2)>.td-data-table-column-content-wrapper,table.td-data-table.mat-selectable th.td-data-table-column:nth-child(2)>.td-data-table-column-content-wrapper{padding-left:0}[dir=rtl] table.td-data-table.mat-selectable .td-data-table-column:nth-child(2)>.td-data-table-column-content-wrapper,[dir=rtl] table.td-data-table.mat-selectable td.td-data-table-cell:nth-child(2)>.td-data-table-column-content-wrapper,[dir=rtl] table.td-data-table.mat-selectable th.td-data-table-column:nth-child(2)>.td-data-table-column-content-wrapper{padding-left:28px;padding-right:0}table.td-data-table td.mat-checkbox-cell,table.td-data-table th.mat-checkbox-column{font-size:0!important;min-width:42px;width:42px}table.td-data-table td.mat-checkbox-cell mat-pseudo-checkbox,table.td-data-table th.mat-checkbox-column mat-pseudo-checkbox{height:18px;width:18px}::ng-deep table.td-data-table td.mat-checkbox-cell mat-pseudo-checkbox.mat-pseudo-checkbox-checked:after,::ng-deep table.td-data-table th.mat-checkbox-column mat-pseudo-checkbox.mat-pseudo-checkbox-checked:after{height:4px!important;width:11px!important}table.td-data-table td.mat-checkbox-cell mat-checkbox ::ng-deep .mat-checkbox-inner-container,table.td-data-table th.mat-checkbox-column mat-checkbox ::ng-deep .mat-checkbox-inner-container{height:18px;margin:0;width:18px}"]
1513
- }] }
1514
- ];
1515
- /** @nocollapse */
1516
- TdDataTableComponent.ctorParameters = () => [
1517
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] },
1518
- { type: ElementRef },
1519
- { type: DomSanitizer },
1520
- { type: ChangeDetectorRef }
1521
- ];
1522
- TdDataTableComponent.propDecorators = {
1523
- _templates: [{ type: ContentChildren, args: [TdDataTableTemplateDirective, { descendants: true },] }],
1524
- _scrollableDiv: [{ type: ViewChild, args: ['scrollableDiv', { static: true },] }],
1525
- _colElements: [{ type: ViewChildren, args: ['columnElement',] }],
1526
- _rows: [{ type: ViewChildren, args: [TdDataTableRowComponent,] }],
1527
- data: [{ type: Input, args: ['data',] }],
1528
- columns: [{ type: Input, args: ['columns',] }],
1529
- resizableColumns: [{ type: Input, args: ['resizableColumns',] }],
1530
- selectable: [{ type: Input, args: ['selectable',] }],
1531
- clickable: [{ type: Input, args: ['clickable',] }],
1532
- multiple: [{ type: Input, args: ['multiple',] }],
1533
- sortable: [{ type: Input, args: ['sortable',] }],
1534
- sortBy: [{ type: Input, args: ['sortBy',] }],
1535
- sortOrder: [{ type: Input, args: ['sortOrder',] }],
1536
- sortChange: [{ type: Output }],
1537
- rowSelect: [{ type: Output }],
1538
- rowClick: [{ type: Output }],
1539
- selectAll: [{ type: Output }],
1540
- compareWith: [{ type: Input }]
1541
- };
1542
- if (false) {
1543
- /**
1544
- * responsive width calculations
1545
- * @type {?}
1546
- * @private
1547
- */
1548
- TdDataTableComponent.prototype._resizeSubs;
1549
- /**
1550
- * @type {?}
1551
- * @private
1552
- */
1553
- TdDataTableComponent.prototype._rowsChangedSubs;
1554
- /**
1555
- * @type {?}
1556
- * @private
1557
- */
1558
- TdDataTableComponent.prototype._hostWidth;
1559
- /**
1560
- * manually resizable columns
1561
- * @type {?}
1562
- * @private
1563
- */
1564
- TdDataTableComponent.prototype._resizableColumns;
1565
- /**
1566
- * @type {?}
1567
- * @private
1568
- */
1569
- TdDataTableComponent.prototype._columnClientX;
1570
- /**
1571
- * @type {?}
1572
- * @private
1573
- */
1574
- TdDataTableComponent.prototype._columnResizeSubs;
1575
- /**
1576
- * @type {?}
1577
- * @private
1578
- */
1579
- TdDataTableComponent.prototype._resizingColumn;
1580
- /**
1581
- * @type {?}
1582
- * @private
1583
- */
1584
- TdDataTableComponent.prototype._onColumnResize;
1585
- /**
1586
- * @type {?}
1587
- * @private
1588
- */
1589
- TdDataTableComponent.prototype._widths;
1590
- /**
1591
- * @type {?}
1592
- * @private
1593
- */
1594
- TdDataTableComponent.prototype._onResize;
1595
- /**
1596
- * column header reposition and viewpoort
1597
- * @type {?}
1598
- * @private
1599
- */
1600
- TdDataTableComponent.prototype._verticalScrollSubs;
1601
- /**
1602
- * @type {?}
1603
- * @private
1604
- */
1605
- TdDataTableComponent.prototype._horizontalScrollSubs;
1606
- /**
1607
- * @type {?}
1608
- * @private
1609
- */
1610
- TdDataTableComponent.prototype._scrollHorizontalOffset;
1611
- /**
1612
- * @type {?}
1613
- * @private
1614
- */
1615
- TdDataTableComponent.prototype._onHorizontalScroll;
1616
- /**
1617
- * @type {?}
1618
- * @private
1619
- */
1620
- TdDataTableComponent.prototype._onVerticalScroll;
1621
- /**
1622
- * @type {?}
1623
- * @private
1624
- */
1625
- TdDataTableComponent.prototype._rowHeightCache;
1626
- /**
1627
- * @type {?}
1628
- * @private
1629
- */
1630
- TdDataTableComponent.prototype._totalHeight;
1631
- /**
1632
- * @type {?}
1633
- * @private
1634
- */
1635
- TdDataTableComponent.prototype._hostHeight;
1636
- /**
1637
- * @type {?}
1638
- * @private
1639
- */
1640
- TdDataTableComponent.prototype._scrollVerticalOffset;
1641
- /**
1642
- * @type {?}
1643
- * @private
1644
- */
1645
- TdDataTableComponent.prototype._offsetTransform;
1646
- /**
1647
- * @type {?}
1648
- * @private
1649
- */
1650
- TdDataTableComponent.prototype._fromRow;
1651
- /**
1652
- * @type {?}
1653
- * @private
1654
- */
1655
- TdDataTableComponent.prototype._toRow;
1656
- /**
1657
- * @type {?}
1658
- * @private
1659
- */
1660
- TdDataTableComponent.prototype._valueChangesSubs;
1661
- /**
1662
- * internal attributes
1663
- * @type {?}
1664
- * @private
1665
- */
1666
- TdDataTableComponent.prototype._data;
1667
- /**
1668
- * @type {?}
1669
- * @private
1670
- */
1671
- TdDataTableComponent.prototype._virtualData;
1672
- /**
1673
- * @type {?}
1674
- * @private
1675
- */
1676
- TdDataTableComponent.prototype._columns;
1677
- /**
1678
- * @type {?}
1679
- * @private
1680
- */
1681
- TdDataTableComponent.prototype._selectable;
1682
- /**
1683
- * @type {?}
1684
- * @private
1685
- */
1686
- TdDataTableComponent.prototype._clickable;
1687
- /**
1688
- * @type {?}
1689
- * @private
1690
- */
1691
- TdDataTableComponent.prototype._multiple;
1692
- /**
1693
- * @type {?}
1694
- * @private
1695
- */
1696
- TdDataTableComponent.prototype._allSelected;
1697
- /**
1698
- * @type {?}
1699
- * @private
1700
- */
1701
- TdDataTableComponent.prototype._indeterminate;
1702
- /**
1703
- * sorting
1704
- * @type {?}
1705
- * @private
1706
- */
1707
- TdDataTableComponent.prototype._sortable;
1708
- /**
1709
- * @type {?}
1710
- * @private
1711
- */
1712
- TdDataTableComponent.prototype._sortBy;
1713
- /**
1714
- * @type {?}
1715
- * @private
1716
- */
1717
- TdDataTableComponent.prototype._sortOrder;
1718
- /**
1719
- * shift select
1720
- * @type {?}
1721
- * @private
1722
- */
1723
- TdDataTableComponent.prototype._shiftPreviouslyPressed;
1724
- /**
1725
- * @type {?}
1726
- * @private
1727
- */
1728
- TdDataTableComponent.prototype._lastSelectedIndex;
1729
- /**
1730
- * @type {?}
1731
- * @private
1732
- */
1733
- TdDataTableComponent.prototype._firstSelectedIndex;
1734
- /**
1735
- * @type {?}
1736
- * @private
1737
- */
1738
- TdDataTableComponent.prototype._firstCheckboxValue;
1739
- /**
1740
- * template fetching support
1741
- * @type {?}
1742
- * @private
1743
- */
1744
- TdDataTableComponent.prototype._templateMap;
1745
- /** @type {?} */
1746
- TdDataTableComponent.prototype._templates;
1747
- /** @type {?} */
1748
- TdDataTableComponent.prototype._scrollableDiv;
1749
- /** @type {?} */
1750
- TdDataTableComponent.prototype._colElements;
1751
- /** @type {?} */
1752
- TdDataTableComponent.prototype._rows;
1753
- /**
1754
- * sortChange?: function
1755
- * Event emitted when the column headers are clicked. [sortable] needs to be enabled.
1756
- * Emits an [ITdDataTableSortChangeEvent] implemented object.
1757
- * @type {?}
1758
- */
1759
- TdDataTableComponent.prototype.sortChange;
1760
- /**
1761
- * rowSelect?: function
1762
- * Event emitted when a row is selected/deselected. [selectable] needs to be enabled.
1763
- * Emits an [ITdDataTableSelectEvent] implemented object.
1764
- * @type {?}
1765
- */
1766
- TdDataTableComponent.prototype.rowSelect;
1767
- /**
1768
- * rowClick?: function
1769
- * Event emitted when a row is clicked.
1770
- * Emits an [ITdDataTableRowClickEvent] implemented object.
1771
- * @type {?}
1772
- */
1773
- TdDataTableComponent.prototype.rowClick;
1774
- /**
1775
- * selectAll?: function
1776
- * Event emitted when all rows are selected/deselected by the all checkbox. [selectable] needs to be enabled.
1777
- * Emits an [ITdDataTableSelectAllEvent] implemented object.
1778
- * @type {?}
1779
- */
1780
- TdDataTableComponent.prototype.selectAll;
1781
- /**
1782
- * compareWith?: function(row, model): boolean
1783
- * Allows custom comparison between row and model to see if row is selected or not
1784
- * Default comparation is by reference
1785
- * @type {?}
1786
- */
1787
- TdDataTableComponent.prototype.compareWith;
1788
- /**
1789
- * @type {?}
1790
- * @private
1791
- */
1792
- TdDataTableComponent.prototype._document;
1793
- /**
1794
- * @type {?}
1795
- * @private
1796
- */
1797
- TdDataTableComponent.prototype._elementRef;
1798
- /**
1799
- * @type {?}
1800
- * @private
1801
- */
1802
- TdDataTableComponent.prototype._domSanitizer;
1803
- }
1804
-
1805
- /**
1806
- * @fileoverview added by tsickle
1807
- * Generated from: data-table-column/data-table-column.component.ts
1808
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1809
- */
1810
- /**
1811
- * @record
1812
- */
1813
- function ITdDataTableSortChangeEvent() { }
1814
- if (false) {
1815
- /** @type {?} */
1816
- ITdDataTableSortChangeEvent.prototype.order;
1817
- /** @type {?} */
1818
- ITdDataTableSortChangeEvent.prototype.name;
1819
- }
1820
- class TdDataTableColumnComponent {
1821
- /**
1822
- * @param {?} _elementRef
1823
- * @param {?} _renderer
1824
- */
1825
- constructor(_elementRef, _renderer) {
1826
- this._elementRef = _elementRef;
1827
- this._renderer = _renderer;
1828
- this._sortOrder = TdDataTableSortingOrder.Ascending;
1829
- /**
1830
- * name?: string
1831
- * Sets unique column [name] for [sortable] events.
1832
- */
1833
- this.name = '';
1834
- /**
1835
- * sortable?: boolean
1836
- * Enables sorting events, sort icons and active column states.
1837
- * Defaults to 'false'
1838
- */
1839
- this.sortable = false;
1840
- /**
1841
- * active?: boolean
1842
- * Sets column to active state when 'true'.
1843
- * Defaults to 'false'
1844
- */
1845
- this.active = false;
1846
- /**
1847
- * numeric?: boolean
1848
- * Makes column follow the numeric data-table specs and sort icon.
1849
- * Defaults to 'false'
1850
- */
1851
- this.numeric = false;
1852
- /**
1853
- * if column sort order is present
1854
- */
1855
- this.isColumnSortOrder = false;
1856
- /**
1857
- * sortChange?: function
1858
- * Event emitted when the column headers are clicked. [sortable] needs to be enabled.
1859
- * Emits an [ITdDataTableSortChangeEvent] implemented object.
1860
- */
1861
- this.sortChange = new EventEmitter();
1862
- this._renderer.addClass(this._elementRef.nativeElement, 'td-data-table-column');
1863
- }
1864
- /**
1865
- * @return {?}
1866
- */
1867
- get projectedWidth() {
1868
- if (this._columnContent && this._columnContent.nativeElement) {
1869
- return ((/** @type {?} */ (this._columnContent.nativeElement))).getBoundingClientRect().width;
1870
- }
1871
- return 100;
1872
- }
1873
- /**
1874
- * sortOrder?: ['ASC' | 'DESC'] or TdDataTableSortingOrder
1875
- * Sets the sort order of column.
1876
- * Defaults to 'ASC' or TdDataTableSortingOrder.Ascending
1877
- * @param {?} order
1878
- * @return {?}
1879
- */
1880
- set sortOrder(order) {
1881
- /** @type {?} */
1882
- const sortOrder = order ? order.toUpperCase() : 'ASC';
1883
- if (sortOrder !== 'DESC' && sortOrder !== 'ASC') {
1884
- throw new Error('[sortOrder] must be empty, ASC or DESC');
1885
- }
1886
- this._sortOrder = sortOrder === 'ASC' ? TdDataTableSortingOrder.Ascending : TdDataTableSortingOrder.Descending;
1887
- }
1888
- /**
1889
- * @return {?}
1890
- */
1891
- get bindClickable() {
1892
- return this.sortable;
1893
- }
1894
- /**
1895
- * @return {?}
1896
- */
1897
- get bingSortable() {
1898
- return this.sortable;
1899
- }
1900
- /**
1901
- * @return {?}
1902
- */
1903
- get bindActive() {
1904
- return this.active;
1905
- }
1906
- /**
1907
- * @return {?}
1908
- */
1909
- get bindNumeric() {
1910
- return this.numeric;
1911
- }
1912
- /**
1913
- * Listening to click event on host to throw a sort event
1914
- * @return {?}
1915
- */
1916
- handleClick() {
1917
- if (this.sortable) {
1918
- this.sortChange.emit({ name: this.name, order: this._sortOrder });
1919
- }
1920
- }
1921
- /**
1922
- * @return {?}
1923
- */
1924
- isAscending() {
1925
- return this._sortOrder === TdDataTableSortingOrder.Ascending;
1926
- }
1927
- /**
1928
- * @return {?}
1929
- */
1930
- isDescending() {
1931
- return this._sortOrder === TdDataTableSortingOrder.Descending;
1932
- }
1933
- }
1934
- TdDataTableColumnComponent.decorators = [
1935
- { type: Component, args: [{
1936
- /* tslint:disable-next-line */
1937
- selector: 'th[td-data-table-column]',
1938
- template: "<span #columnContent class=\"td-data-table-heading\">\n <mat-icon\n class=\"td-data-table-sort-icon\"\n *ngIf=\"sortable && numeric\"\n [class.mat-asc]=\"isAscending()\"\n [class.mat-desc]=\"isDescending()\"\n >\n arrow_upward\n </mat-icon>\n <span>\n <ng-content></ng-content>\n </span>\n <mat-icon\n class=\"td-data-table-sort-icon\"\n *ngIf=\"sortable && !numeric\"\n [class.mat-asc]=\"isAscending()\"\n [class.mat-desc]=\"isDescending()\"\n [class.display-numeric]=\"isColumnSortOrder\"\n >\n arrow_upward\n </mat-icon>\n</span>\n<ng-content select=\"[td-column-resizer]\"></ng-content>\n",
1939
- styles: [":host{padding:0;position:relative;text-align:left;vertical-align:middle;white-space:nowrap}:host>.td-data-table-heading{padding:0 28px}:host:first-child>.td-data-table-heading{padding-left:24px;padding-right:0}html[dir=rtl] :host:first-child>.td-data-table-heading{padding-left:0}body[dir=rtl] :host:first-child>.td-data-table-heading{padding-left:0}[dir=rtl] :host:first-child>.td-data-table-heading{padding-left:0}html[dir=rtl] :host:first-child>.td-data-table-heading{padding-right:24px;unicode-bidi:embed}body[dir=rtl] :host:first-child>.td-data-table-heading{padding-right:24px;unicode-bidi:embed}[dir=rtl] :host:first-child>.td-data-table-heading{padding-right:24px;unicode-bidi:embed}:host:first-child>.td-data-table-heading bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host:first-child>.td-data-table-heading bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host:last-child>.td-data-table-heading{padding-left:28px;padding-right:24px}html[dir=rtl] :host:last-child>.td-data-table-heading{padding-left:24px}body[dir=rtl] :host:last-child>.td-data-table-heading{padding-left:24px}[dir=rtl] :host:last-child>.td-data-table-heading{padding-left:24px}html[dir=rtl] :host:last-child>.td-data-table-heading{padding-right:28px;unicode-bidi:embed}body[dir=rtl] :host:last-child>.td-data-table-heading{padding-right:28px;unicode-bidi:embed}[dir=rtl] :host:last-child>.td-data-table-heading{padding-right:28px;unicode-bidi:embed}:host:last-child>.td-data-table-heading bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host:last-child>.td-data-table-heading bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host mat-icon{font-size:16px!important;height:16px;line-height:16px!important;width:16px}:host mat-icon.td-data-table-sort-icon{opacity:0;position:absolute;top:0;transition:transform .25s}:host mat-icon.td-data-table-sort-icon.display-numeric{right:0}:host mat-icon.td-data-table-sort-icon.mat-asc{-ms-transform:rotate(0deg);transform:rotate(0deg)}:host mat-icon.td-data-table-sort-icon.mat-desc{-ms-transform:rotate(180deg);transform:rotate(180deg)}:host.mat-active.mat-sortable mat-icon.td-data-table-sort-icon,:host:hover.mat-sortable mat-icon.td-data-table-sort-icon{opacity:1}html[dir=rtl] :host{text-align:right;unicode-bidi:embed}body[dir=rtl] :host{text-align:right;unicode-bidi:embed}[dir=rtl] :host{text-align:right;unicode-bidi:embed}:host bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host>*{vertical-align:middle}:host.mat-clickable{cursor:pointer}:host.mat-clickable:focus{outline:none}:host .td-data-table-heading{display:inline-block;position:relative}:host.mat-numeric{text-align:right}html[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}body[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}:host.mat-numeric bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host.mat-numeric bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host.mat-numeric mat-icon.td-data-table-sort-icon{margin-left:-22px;margin-right:0}html[dir=rtl] :host.mat-numeric mat-icon.td-data-table-sort-icon{margin-left:0}body[dir=rtl] :host.mat-numeric mat-icon.td-data-table-sort-icon{margin-left:0}[dir=rtl] :host.mat-numeric mat-icon.td-data-table-sort-icon{margin-left:0}html[dir=rtl] :host.mat-numeric mat-icon.td-data-table-sort-icon{margin-right:-22px;unicode-bidi:embed}body[dir=rtl] :host.mat-numeric mat-icon.td-data-table-sort-icon{margin-right:-22px;unicode-bidi:embed}[dir=rtl] :host.mat-numeric mat-icon.td-data-table-sort-icon{margin-right:-22px;unicode-bidi:embed}:host.mat-numeric mat-icon.td-data-table-sort-icon bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host.mat-numeric mat-icon.td-data-table-sort-icon bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host:not(.mat-numeric) mat-icon.td-data-table-sort-icon{margin-left:6px;margin-right:0}html[dir=rtl] :host:not(.mat-numeric) mat-icon.td-data-table-sort-icon{margin-left:0}body[dir=rtl] :host:not(.mat-numeric) mat-icon.td-data-table-sort-icon{margin-left:0}[dir=rtl] :host:not(.mat-numeric) mat-icon.td-data-table-sort-icon{margin-left:0}html[dir=rtl] :host:not(.mat-numeric) mat-icon.td-data-table-sort-icon{margin-right:6px;unicode-bidi:embed}body[dir=rtl] :host:not(.mat-numeric) mat-icon.td-data-table-sort-icon{margin-right:6px;unicode-bidi:embed}[dir=rtl] :host:not(.mat-numeric) mat-icon.td-data-table-sort-icon{margin-right:6px;unicode-bidi:embed}:host:not(.mat-numeric) mat-icon.td-data-table-sort-icon bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host:not(.mat-numeric) mat-icon.td-data-table-sort-icon bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}"]
1940
- }] }
1941
- ];
1942
- /** @nocollapse */
1943
- TdDataTableColumnComponent.ctorParameters = () => [
1944
- { type: ElementRef },
1945
- { type: Renderer2 }
1946
- ];
1947
- TdDataTableColumnComponent.propDecorators = {
1948
- _columnContent: [{ type: ViewChild, args: ['columnContent', { read: ElementRef, static: true },] }],
1949
- name: [{ type: Input }],
1950
- sortable: [{ type: Input }],
1951
- active: [{ type: Input }],
1952
- numeric: [{ type: Input }],
1953
- isColumnSortOrder: [{ type: Input }],
1954
- sortOrder: [{ type: Input, args: ['sortOrder',] }],
1955
- sortChange: [{ type: Output }],
1956
- bindClickable: [{ type: HostBinding, args: ['class.mat-clickable',] }],
1957
- bingSortable: [{ type: HostBinding, args: ['class.mat-sortable',] }],
1958
- bindActive: [{ type: HostBinding, args: ['class.mat-active',] }],
1959
- bindNumeric: [{ type: HostBinding, args: ['class.mat-numeric',] }],
1960
- handleClick: [{ type: HostListener, args: ['click',] }]
1961
- };
1962
- if (false) {
1963
- /**
1964
- * @type {?}
1965
- * @private
1966
- */
1967
- TdDataTableColumnComponent.prototype._sortOrder;
1968
- /** @type {?} */
1969
- TdDataTableColumnComponent.prototype._columnContent;
1970
- /**
1971
- * name?: string
1972
- * Sets unique column [name] for [sortable] events.
1973
- * @type {?}
1974
- */
1975
- TdDataTableColumnComponent.prototype.name;
1976
- /**
1977
- * sortable?: boolean
1978
- * Enables sorting events, sort icons and active column states.
1979
- * Defaults to 'false'
1980
- * @type {?}
1981
- */
1982
- TdDataTableColumnComponent.prototype.sortable;
1983
- /**
1984
- * active?: boolean
1985
- * Sets column to active state when 'true'.
1986
- * Defaults to 'false'
1987
- * @type {?}
1988
- */
1989
- TdDataTableColumnComponent.prototype.active;
1990
- /**
1991
- * numeric?: boolean
1992
- * Makes column follow the numeric data-table specs and sort icon.
1993
- * Defaults to 'false'
1994
- * @type {?}
1995
- */
1996
- TdDataTableColumnComponent.prototype.numeric;
1997
- /**
1998
- * if column sort order is present
1999
- * @type {?}
2000
- */
2001
- TdDataTableColumnComponent.prototype.isColumnSortOrder;
2002
- /**
2003
- * sortChange?: function
2004
- * Event emitted when the column headers are clicked. [sortable] needs to be enabled.
2005
- * Emits an [ITdDataTableSortChangeEvent] implemented object.
2006
- * @type {?}
2007
- */
2008
- TdDataTableColumnComponent.prototype.sortChange;
2009
- /**
2010
- * @type {?}
2011
- * @private
2012
- */
2013
- TdDataTableColumnComponent.prototype._elementRef;
2014
- /**
2015
- * @type {?}
2016
- * @private
2017
- */
2018
- TdDataTableColumnComponent.prototype._renderer;
2019
- }
2020
-
2021
- /**
2022
- * @fileoverview added by tsickle
2023
- * Generated from: data-table-cell/data-table-cell.component.ts
2024
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2025
- */
2026
- class TdDataTableCellComponent {
2027
- /**
2028
- * @param {?} _elementRef
2029
- * @param {?} _renderer
2030
- */
2031
- constructor(_elementRef, _renderer) {
2032
- this._elementRef = _elementRef;
2033
- this._renderer = _renderer;
2034
- /**
2035
- * numeric?: boolean
2036
- * Makes cell follow the numeric data-table specs.
2037
- * Defaults to 'false'
2038
- */
2039
- this.numeric = false;
2040
- this._renderer.addClass(this._elementRef.nativeElement, 'td-data-table-cell');
2041
- }
2042
- /**
2043
- * align?: 'start' | 'center' | 'end'
2044
- * Makes cell content align on demand
2045
- * Defaults to 'left', overrides numeric
2046
- * @param {?} align
2047
- * @return {?}
2048
- */
2049
- set align(align) {
2050
- this._align = align;
2051
- }
2052
- /**
2053
- * @return {?}
2054
- */
2055
- get align() {
2056
- return this._align;
2057
- }
2058
- /**
2059
- * @return {?}
2060
- */
2061
- get bindNumeric() {
2062
- return this.numeric;
2063
- }
2064
- }
2065
- TdDataTableCellComponent.decorators = [
2066
- { type: Component, args: [{
2067
- /* tslint:disable-next-line */
2068
- selector: 'td[td-data-table-cell]',
2069
- template: "<div\n class=\"td-data-table-cell-content-wrapper\"\n [class.td-data-table-cell-numeric]=\"numeric\"\n [class.td-data-table-cell-align-center]=\"align === 'center'\"\n [class.td-data-table-cell-align-end]=\"align === 'end'\"\n [class.td-data-table-cell-align-start]=\"align === 'start'\"\n>\n <ng-content></ng-content>\n</div>\n",
2070
- styles: [":host{padding:0;text-align:left;vertical-align:middle}html[dir=rtl] :host{text-align:right;unicode-bidi:embed}body[dir=rtl] :host{text-align:right;unicode-bidi:embed}[dir=rtl] :host{text-align:right;unicode-bidi:embed}:host bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host>.td-data-table-cell-content-wrapper{-ms-flex-align:center;-ms-flex-direction:row;-ms-flex-line-pack:center;-ms-flex-pack:start;align-content:center;align-items:center;box-sizing:border-box;display:-ms-flexbox;display:flex;flex-direction:row;justify-content:flex-start;max-width:100%;padding:0 28px}:host>.td-data-table-cell-content-wrapper.td-data-table-cell-numeric{-ms-flex-pack:end;justify-content:flex-end}:host>.td-data-table-cell-content-wrapper.td-data-table-cell-align-start{-ms-flex-pack:start;justify-content:flex-start}:host>.td-data-table-cell-content-wrapper.td-data-table-cell-align-end{-ms-flex-pack:end;justify-content:flex-end}:host>.td-data-table-cell-content-wrapper.td-data-table-cell-align-center{-ms-flex-pack:center;justify-content:center}:host:first-child>.td-data-table-cell-content-wrapper{padding-left:24px;padding-right:0}html[dir=rtl] :host:first-child>.td-data-table-cell-content-wrapper{padding-left:0}body[dir=rtl] :host:first-child>.td-data-table-cell-content-wrapper{padding-left:0}[dir=rtl] :host:first-child>.td-data-table-cell-content-wrapper{padding-left:0}html[dir=rtl] :host:first-child>.td-data-table-cell-content-wrapper{padding-right:24px;unicode-bidi:embed}body[dir=rtl] :host:first-child>.td-data-table-cell-content-wrapper{padding-right:24px;unicode-bidi:embed}[dir=rtl] :host:first-child>.td-data-table-cell-content-wrapper{padding-right:24px;unicode-bidi:embed}:host:first-child>.td-data-table-cell-content-wrapper bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host:first-child>.td-data-table-cell-content-wrapper bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host:last-child>.td-data-table-cell-content-wrapper{padding-left:28px;padding-right:24px}html[dir=rtl] :host:last-child>.td-data-table-cell-content-wrapper{padding-left:24px}body[dir=rtl] :host:last-child>.td-data-table-cell-content-wrapper{padding-left:24px}[dir=rtl] :host:last-child>.td-data-table-cell-content-wrapper{padding-left:24px}html[dir=rtl] :host:last-child>.td-data-table-cell-content-wrapper{padding-right:28px;unicode-bidi:embed}body[dir=rtl] :host:last-child>.td-data-table-cell-content-wrapper{padding-right:28px;unicode-bidi:embed}[dir=rtl] :host:last-child>.td-data-table-cell-content-wrapper{padding-right:28px;unicode-bidi:embed}:host:last-child>.td-data-table-cell-content-wrapper bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host:last-child>.td-data-table-cell-content-wrapper bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}:host>*{vertical-align:middle}:host.mat-clickable{cursor:pointer}:host.mat-clickable:focus{outline:none}:host.mat-numeric{text-align:right}html[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}body[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}[dir=rtl] :host.mat-numeric{text-align:left;unicode-bidi:embed}:host.mat-numeric bdo[dir=rtl]{direction:rtl;unicode-bidi:bidi-override}:host.mat-numeric bdo[dir=ltr]{direction:ltr;unicode-bidi:bidi-override}"]
2071
- }] }
2072
- ];
2073
- /** @nocollapse */
2074
- TdDataTableCellComponent.ctorParameters = () => [
2075
- { type: ElementRef },
2076
- { type: Renderer2 }
2077
- ];
2078
- TdDataTableCellComponent.propDecorators = {
2079
- numeric: [{ type: Input }],
2080
- align: [{ type: Input }],
2081
- bindNumeric: [{ type: HostBinding, args: ['class.mat-numeric',] }]
2082
- };
2083
- if (false) {
2084
- /**
2085
- * @type {?}
2086
- * @private
2087
- */
2088
- TdDataTableCellComponent.prototype._align;
2089
- /**
2090
- * numeric?: boolean
2091
- * Makes cell follow the numeric data-table specs.
2092
- * Defaults to 'false'
2093
- * @type {?}
2094
- */
2095
- TdDataTableCellComponent.prototype.numeric;
2096
- /**
2097
- * @type {?}
2098
- * @private
2099
- */
2100
- TdDataTableCellComponent.prototype._elementRef;
2101
- /**
2102
- * @type {?}
2103
- * @private
2104
- */
2105
- TdDataTableCellComponent.prototype._renderer;
2106
- }
2107
-
2108
- /**
2109
- * @fileoverview added by tsickle
2110
- * Generated from: data-table-table/data-table-table.component.ts
2111
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2112
- */
2113
- class TdDataTableTableComponent {
2114
- /**
2115
- * @param {?} _elementRef
2116
- * @param {?} _renderer
2117
- */
2118
- constructor(_elementRef, _renderer) {
2119
- this._elementRef = _elementRef;
2120
- this._renderer = _renderer;
2121
- this._renderer.addClass(this._elementRef.nativeElement, 'td-data-table');
2122
- }
2123
- }
2124
- TdDataTableTableComponent.decorators = [
2125
- { type: Component, args: [{
2126
- /* tslint:disable-next-line */
2127
- selector: 'table[td-data-table]',
2128
- template: "<ng-content></ng-content>\n",
2129
- styles: [":host{border-collapse:collapse;border-spacing:0;overflow:hidden;position:relative;width:100%}"]
2130
- }] }
2131
- ];
2132
- /** @nocollapse */
2133
- TdDataTableTableComponent.ctorParameters = () => [
2134
- { type: ElementRef },
2135
- { type: Renderer2 }
2136
- ];
2137
- if (false) {
2138
- /**
2139
- * @type {?}
2140
- * @private
2141
- */
2142
- TdDataTableTableComponent.prototype._elementRef;
2143
- /**
2144
- * @type {?}
2145
- * @private
2146
- */
2147
- TdDataTableTableComponent.prototype._renderer;
2148
- }
2149
-
2150
- /**
2151
- * @fileoverview added by tsickle
2152
- * Generated from: services/data-table.service.ts
2153
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2154
- */
2155
- class TdDataTableService {
2156
- /**
2157
- * params:
2158
- * - data: any[]
2159
- * - searchTerm: string
2160
- * - ignoreCase: boolean = false
2161
- * - excludedColumns: string[] = []
2162
- *
2163
- * Searches [data] parameter for [searchTerm] matches and returns a new array with them.
2164
- * @param {?} data
2165
- * @param {?} searchTerm
2166
- * @param {?=} ignoreCase
2167
- * @param {?=} excludedColumns
2168
- * @return {?}
2169
- */
2170
- filterData(data, searchTerm, ignoreCase = false, excludedColumns) {
2171
- /** @type {?} */
2172
- const filter = searchTerm ? (ignoreCase ? searchTerm.toLowerCase() : searchTerm) : '';
2173
- if (filter) {
2174
- data = data.filter((/**
2175
- * @param {?} item
2176
- * @return {?}
2177
- */
2178
- (item) => {
2179
- /** @type {?} */
2180
- const res = Object.keys(item).find((/**
2181
- * @param {?} key
2182
- * @return {?}
2183
- */
2184
- (key) => {
2185
- if (!excludedColumns || excludedColumns.indexOf(key) === -1) {
2186
- /** @type {?} */
2187
- const preItemValue = '' + item[key];
2188
- /** @type {?} */
2189
- const itemValue = ignoreCase ? preItemValue.toLowerCase() : preItemValue;
2190
- return itemValue.indexOf(filter) > -1;
2191
- }
2192
- }));
2193
- return typeof res !== 'undefined';
2194
- }));
2195
- }
2196
- return data;
2197
- }
2198
- /**
2199
- * params:
2200
- * - data: any[]
2201
- * - sortBy: string
2202
- * - sortOrder: TdDataTableSortingOrder = TdDataTableSortingOrder.Ascending
2203
- *
2204
- * Sorts [data] parameter by [sortBy] and [sortOrder] and returns the sorted data.
2205
- * @param {?} data
2206
- * @param {?} sortBy
2207
- * @param {?=} sortOrder
2208
- * @return {?}
2209
- */
2210
- sortData(data, sortBy, sortOrder = TdDataTableSortingOrder.Ascending) {
2211
- if (sortBy) {
2212
- data = Array.from(data); // Change the array reference to trigger OnPush and not mutate original array
2213
- data.sort((/**
2214
- * @param {?} a
2215
- * @param {?} b
2216
- * @return {?}
2217
- */
2218
- (a, b) => {
2219
- /** @type {?} */
2220
- const compA = a[sortBy];
2221
- /** @type {?} */
2222
- const compB = b[sortBy];
2223
- /** @type {?} */
2224
- let direction = 0;
2225
- if (!Number.isNaN(Number.parseFloat(compA)) && !Number.isNaN(Number.parseFloat(compB))) {
2226
- direction = Number.parseFloat(compA) - Number.parseFloat(compB);
2227
- }
2228
- else {
2229
- if (compA < compB) {
2230
- direction = -1;
2231
- }
2232
- else if (compA > compB) {
2233
- direction = 1;
2234
- }
2235
- }
2236
- return direction * (sortOrder === TdDataTableSortingOrder.Descending ? -1 : 1);
2237
- }));
2238
- }
2239
- return data;
2240
- }
2241
- /**
2242
- * params:
2243
- * - data: any[]
2244
- * - fromRow: number
2245
- * - toRow: : number
2246
- *
2247
- * Returns a section of the [data] parameter starting from [fromRow] and ending in [toRow].
2248
- * @param {?} data
2249
- * @param {?} fromRow
2250
- * @param {?} toRow
2251
- * @return {?}
2252
- */
2253
- pageData(data, fromRow, toRow) {
2254
- if (fromRow >= 1) {
2255
- data = data.slice(fromRow - 1, toRow);
2256
- }
2257
- return data;
2258
- }
2259
- }
2260
- TdDataTableService.decorators = [
2261
- { type: Injectable }
2262
- ];
2263
-
2264
- /**
2265
- * @fileoverview added by tsickle
2266
- * Generated from: data-table.module.ts
2267
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2268
- */
2269
- /** @type {?} */
2270
- const TD_DATA_TABLE = [
2271
- TdDataTableComponent,
2272
- TdDataTableTemplateDirective,
2273
- TdDataTableColumnComponent,
2274
- TdDataTableCellComponent,
2275
- TdDataTableRowComponent,
2276
- TdDataTableColumnRowComponent,
2277
- TdDataTableTableComponent,
2278
- ];
2279
- class CovalentDataTableModule {
2280
- }
2281
- CovalentDataTableModule.decorators = [
2282
- { type: NgModule, args: [{
2283
- imports: [CommonModule, MatCheckboxModule, MatTooltipModule, MatIconModule, MatPseudoCheckboxModule],
2284
- declarations: [TD_DATA_TABLE],
2285
- exports: [TD_DATA_TABLE],
2286
- providers: [TdDataTableService],
2287
- },] }
2288
- ];
2289
-
2290
- /**
2291
- * @fileoverview added by tsickle
2292
- * Generated from: public-api.ts
2293
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2294
- */
2295
-
2296
- /**
2297
- * @fileoverview added by tsickle
2298
- * Generated from: index.ts
2299
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2300
- */
2301
-
2302
- /**
2303
- * @fileoverview added by tsickle
2304
- * Generated from: covalent-core-data-table.ts
2305
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2306
- */
2307
-
2308
- export { CovalentDataTableModule, TdDataTableBase, TdDataTableCellComponent, TdDataTableColumnComponent, TdDataTableColumnRowComponent, TdDataTableComponent, TdDataTableRowComponent, TdDataTableService, TdDataTableSortingOrder, TdDataTableTableComponent, TdDataTableTemplateDirective, _TdDataTableMixinBase };
2309
- //# sourceMappingURL=covalent-core-data-table.js.map