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