@refinitiv-ui/efx-grid 6.0.0-next.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 (837) hide show
  1. package/LICENSE +17 -0
  2. package/README.md +61 -0
  3. package/lib/column-format-dialog/index.d.ts +1 -0
  4. package/lib/column-format-dialog/index.js +1 -0
  5. package/lib/column-format-dialog/lib/column-format-dialog.d.ts +64 -0
  6. package/lib/column-format-dialog/lib/column-format-dialog.js +2713 -0
  7. package/lib/column-format-dialog/lib/locale/translation-de.d.ts +7 -0
  8. package/lib/column-format-dialog/lib/locale/translation-de.js +94 -0
  9. package/lib/column-format-dialog/lib/locale/translation-en.d.ts +7 -0
  10. package/lib/column-format-dialog/lib/locale/translation-en.js +94 -0
  11. package/lib/column-format-dialog/lib/locale/translation-ja.d.ts +7 -0
  12. package/lib/column-format-dialog/lib/locale/translation-ja.js +94 -0
  13. package/lib/column-format-dialog/lib/locale/translation-zh-hant.d.ts +7 -0
  14. package/lib/column-format-dialog/lib/locale/translation-zh-hant.js +94 -0
  15. package/lib/column-format-dialog/lib/locale/translation-zh.d.ts +7 -0
  16. package/lib/column-format-dialog/lib/locale/translation-zh.js +94 -0
  17. package/lib/column-format-dialog/lib/locale/translation.d.ts +11 -0
  18. package/lib/column-format-dialog/lib/locale/translation.js +18 -0
  19. package/lib/column-format-dialog/lib/preview-table.d.ts +151 -0
  20. package/lib/column-format-dialog/lib/preview-table.js +995 -0
  21. package/lib/column-format-dialog/themes/base.less +429 -0
  22. package/lib/column-format-dialog/themes/elemental/column-format-dialog.less +1 -0
  23. package/lib/column-format-dialog/themes/elemental/dark/column-format-dialog.js +4 -0
  24. package/lib/column-format-dialog/themes/elemental/dark/css/native-elements.css +0 -0
  25. package/lib/column-format-dialog/themes/elemental/dark/es5/all-elements.js +2 -0
  26. package/lib/column-format-dialog/themes/elemental/dark/imports/all-elements.js +1 -0
  27. package/lib/column-format-dialog/themes/elemental/dark/imports/custom-elements.js +1 -0
  28. package/lib/column-format-dialog/themes/elemental/dark/imports/native-elements.js +0 -0
  29. package/lib/column-format-dialog/themes/elemental/dark.js +16 -0
  30. package/lib/column-format-dialog/themes/elemental/defaults.less +1 -0
  31. package/lib/column-format-dialog/themes/elemental/index.less +5 -0
  32. package/lib/column-format-dialog/themes/elemental/light/column-format-dialog.js +4 -0
  33. package/lib/column-format-dialog/themes/elemental/light/css/native-elements.css +0 -0
  34. package/lib/column-format-dialog/themes/elemental/light/es5/all-elements.js +2 -0
  35. package/lib/column-format-dialog/themes/elemental/light/imports/all-elements.js +1 -0
  36. package/lib/column-format-dialog/themes/elemental/light/imports/custom-elements.js +1 -0
  37. package/lib/column-format-dialog/themes/elemental/light/imports/native-elements.js +0 -0
  38. package/lib/column-format-dialog/themes/elemental/light.js +16 -0
  39. package/lib/column-format-dialog/themes/halo/column-format-dialog.less +6 -0
  40. package/lib/column-format-dialog/themes/halo/dark/column-format-dialog.js +4 -0
  41. package/lib/column-format-dialog/themes/halo/dark/css/native-elements.css +0 -0
  42. package/lib/column-format-dialog/themes/halo/dark/es5/all-elements.js +2 -0
  43. package/lib/column-format-dialog/themes/halo/dark/imports/all-elements.js +1 -0
  44. package/lib/column-format-dialog/themes/halo/dark/imports/custom-elements.js +1 -0
  45. package/lib/column-format-dialog/themes/halo/dark/imports/native-elements.js +0 -0
  46. package/lib/column-format-dialog/themes/halo/dark.js +16 -0
  47. package/lib/column-format-dialog/themes/halo/defaults.less +1 -0
  48. package/lib/column-format-dialog/themes/halo/index.less +5 -0
  49. package/lib/column-format-dialog/themes/halo/light/column-format-dialog.js +4 -0
  50. package/lib/column-format-dialog/themes/halo/light/css/native-elements.css +0 -0
  51. package/lib/column-format-dialog/themes/halo/light/es5/all-elements.js +2 -0
  52. package/lib/column-format-dialog/themes/halo/light/imports/all-elements.js +1 -0
  53. package/lib/column-format-dialog/themes/halo/light/imports/custom-elements.js +1 -0
  54. package/lib/column-format-dialog/themes/halo/light/imports/native-elements.js +0 -0
  55. package/lib/column-format-dialog/themes/halo/light.js +16 -0
  56. package/lib/column-format-dialog/themes/luna/column-format-dialog.less +1 -0
  57. package/lib/column-format-dialog/themes/luna/default/column-format-dialog.js +4 -0
  58. package/lib/column-format-dialog/themes/luna/default/css/native-elements.css +0 -0
  59. package/lib/column-format-dialog/themes/luna/default/es5/all-elements.js +2 -0
  60. package/lib/column-format-dialog/themes/luna/default/imports/all-elements.js +1 -0
  61. package/lib/column-format-dialog/themes/luna/default/imports/custom-elements.js +1 -0
  62. package/lib/column-format-dialog/themes/luna/default/imports/native-elements.js +0 -0
  63. package/lib/column-format-dialog/themes/luna/defaults.less +1 -0
  64. package/lib/column-format-dialog/themes/luna/index.less +5 -0
  65. package/lib/column-format-dialog/themes/solar/charcoal/column-format-dialog.js +4 -0
  66. package/lib/column-format-dialog/themes/solar/charcoal/css/native-elements.css +0 -0
  67. package/lib/column-format-dialog/themes/solar/charcoal/es5/all-elements.js +2 -0
  68. package/lib/column-format-dialog/themes/solar/charcoal/imports/all-elements.js +1 -0
  69. package/lib/column-format-dialog/themes/solar/charcoal/imports/custom-elements.js +1 -0
  70. package/lib/column-format-dialog/themes/solar/charcoal/imports/native-elements.js +0 -0
  71. package/lib/column-format-dialog/themes/solar/charcoal.js +16 -0
  72. package/lib/column-format-dialog/themes/solar/column-format-dialog.less +6 -0
  73. package/lib/column-format-dialog/themes/solar/defaults.less +1 -0
  74. package/lib/column-format-dialog/themes/solar/index.less +5 -0
  75. package/lib/column-format-dialog/themes/solar/pearl/column-format-dialog.js +4 -0
  76. package/lib/column-format-dialog/themes/solar/pearl/css/native-elements.css +0 -0
  77. package/lib/column-format-dialog/themes/solar/pearl/es5/all-elements.js +2 -0
  78. package/lib/column-format-dialog/themes/solar/pearl/imports/all-elements.js +1 -0
  79. package/lib/column-format-dialog/themes/solar/pearl/imports/custom-elements.js +1 -0
  80. package/lib/column-format-dialog/themes/solar/pearl/imports/native-elements.js +0 -0
  81. package/lib/column-format-dialog/themes/solar/pearl.js +16 -0
  82. package/lib/column-selection-dialog/index.d.ts +1 -0
  83. package/lib/column-selection-dialog/index.js +1 -0
  84. package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +41 -0
  85. package/lib/column-selection-dialog/lib/column-selection-dialog.js +1410 -0
  86. package/lib/column-selection-dialog/lib/locale/translation-de.d.ts +7 -0
  87. package/lib/column-selection-dialog/lib/locale/translation-de.js +19 -0
  88. package/lib/column-selection-dialog/lib/locale/translation-en.d.ts +7 -0
  89. package/lib/column-selection-dialog/lib/locale/translation-en.js +19 -0
  90. package/lib/column-selection-dialog/lib/locale/translation-ja.d.ts +7 -0
  91. package/lib/column-selection-dialog/lib/locale/translation-ja.js +19 -0
  92. package/lib/column-selection-dialog/lib/locale/translation-zh-hant.d.ts +7 -0
  93. package/lib/column-selection-dialog/lib/locale/translation-zh-hant.js +19 -0
  94. package/lib/column-selection-dialog/lib/locale/translation-zh.d.ts +7 -0
  95. package/lib/column-selection-dialog/lib/locale/translation-zh.js +19 -0
  96. package/lib/column-selection-dialog/lib/locale/translation.d.ts +11 -0
  97. package/lib/column-selection-dialog/lib/locale/translation.js +18 -0
  98. package/lib/column-selection-dialog/themes/base.less +189 -0
  99. package/lib/column-selection-dialog/themes/elemental/column-selection-dialog.less +1 -0
  100. package/lib/column-selection-dialog/themes/elemental/dark/column-selection-dialog.js +4 -0
  101. package/lib/column-selection-dialog/themes/elemental/dark/css/native-elements.css +0 -0
  102. package/lib/column-selection-dialog/themes/elemental/dark/es5/all-elements.js +2 -0
  103. package/lib/column-selection-dialog/themes/elemental/dark/imports/all-elements.js +1 -0
  104. package/lib/column-selection-dialog/themes/elemental/dark/imports/custom-elements.js +1 -0
  105. package/lib/column-selection-dialog/themes/elemental/dark/imports/native-elements.js +0 -0
  106. package/lib/column-selection-dialog/themes/elemental/dark.js +6 -0
  107. package/lib/column-selection-dialog/themes/elemental/defaults.less +1 -0
  108. package/lib/column-selection-dialog/themes/elemental/index.less +5 -0
  109. package/lib/column-selection-dialog/themes/elemental/light/column-selection-dialog.js +4 -0
  110. package/lib/column-selection-dialog/themes/elemental/light/css/native-elements.css +0 -0
  111. package/lib/column-selection-dialog/themes/elemental/light/es5/all-elements.js +2 -0
  112. package/lib/column-selection-dialog/themes/elemental/light/imports/all-elements.js +1 -0
  113. package/lib/column-selection-dialog/themes/elemental/light/imports/custom-elements.js +1 -0
  114. package/lib/column-selection-dialog/themes/elemental/light/imports/native-elements.js +0 -0
  115. package/lib/column-selection-dialog/themes/elemental/light.js +6 -0
  116. package/lib/column-selection-dialog/themes/halo/column-selection-dialog.less +22 -0
  117. package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +4 -0
  118. package/lib/column-selection-dialog/themes/halo/dark/css/native-elements.css +0 -0
  119. package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +2 -0
  120. package/lib/column-selection-dialog/themes/halo/dark/imports/all-elements.js +1 -0
  121. package/lib/column-selection-dialog/themes/halo/dark/imports/custom-elements.js +1 -0
  122. package/lib/column-selection-dialog/themes/halo/dark/imports/native-elements.js +0 -0
  123. package/lib/column-selection-dialog/themes/halo/dark.js +6 -0
  124. package/lib/column-selection-dialog/themes/halo/defaults.less +1 -0
  125. package/lib/column-selection-dialog/themes/halo/index.less +6 -0
  126. package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +4 -0
  127. package/lib/column-selection-dialog/themes/halo/light/css/native-elements.css +0 -0
  128. package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +2 -0
  129. package/lib/column-selection-dialog/themes/halo/light/imports/all-elements.js +1 -0
  130. package/lib/column-selection-dialog/themes/halo/light/imports/custom-elements.js +1 -0
  131. package/lib/column-selection-dialog/themes/halo/light/imports/native-elements.js +0 -0
  132. package/lib/column-selection-dialog/themes/halo/light.js +6 -0
  133. package/lib/column-selection-dialog/themes/solar/charcoal/column-selection-dialog.js +4 -0
  134. package/lib/column-selection-dialog/themes/solar/charcoal/css/native-elements.css +0 -0
  135. package/lib/column-selection-dialog/themes/solar/charcoal/es5/all-elements.js +2 -0
  136. package/lib/column-selection-dialog/themes/solar/charcoal/imports/all-elements.js +1 -0
  137. package/lib/column-selection-dialog/themes/solar/charcoal/imports/custom-elements.js +1 -0
  138. package/lib/column-selection-dialog/themes/solar/charcoal/imports/native-elements.js +0 -0
  139. package/lib/column-selection-dialog/themes/solar/charcoal.js +6 -0
  140. package/lib/column-selection-dialog/themes/solar/column-selection-dialog.less +1 -0
  141. package/lib/column-selection-dialog/themes/solar/defaults.less +1 -0
  142. package/lib/column-selection-dialog/themes/solar/index.less +6 -0
  143. package/lib/column-selection-dialog/themes/solar/pearl/column-selection-dialog.js +4 -0
  144. package/lib/column-selection-dialog/themes/solar/pearl/css/native-elements.css +0 -0
  145. package/lib/column-selection-dialog/themes/solar/pearl/es5/all-elements.js +2 -0
  146. package/lib/column-selection-dialog/themes/solar/pearl/imports/all-elements.js +1 -0
  147. package/lib/column-selection-dialog/themes/solar/pearl/imports/custom-elements.js +1 -0
  148. package/lib/column-selection-dialog/themes/solar/pearl/imports/native-elements.js +0 -0
  149. package/lib/column-selection-dialog/themes/solar/pearl.js +6 -0
  150. package/lib/core/dist/core.css +1 -0
  151. package/lib/core/dist/core.js +28075 -0
  152. package/lib/core/dist/core.min.js +1 -0
  153. package/lib/core/es6/data/ColumnStats.d.ts +42 -0
  154. package/lib/core/es6/data/ColumnStats.js +428 -0
  155. package/lib/core/es6/data/DataCache.d.ts +81 -0
  156. package/lib/core/es6/data/DataCache.js +1317 -0
  157. package/lib/core/es6/data/DataTable.d.ts +125 -0
  158. package/lib/core/es6/data/DataTable.js +1655 -0
  159. package/lib/core/es6/data/DataView.d.ts +280 -0
  160. package/lib/core/es6/data/DataView.js +3654 -0
  161. package/lib/core/es6/data/Segment.d.ts +38 -0
  162. package/lib/core/es6/data/Segment.js +193 -0
  163. package/lib/core/es6/data/SegmentCollection.d.ts +58 -0
  164. package/lib/core/es6/data/SegmentCollection.js +431 -0
  165. package/lib/core/es6/grid/Core.d.ts +387 -0
  166. package/lib/core/es6/grid/Core.js +4939 -0
  167. package/lib/core/es6/grid/ILayoutGrid.d.ts +204 -0
  168. package/lib/core/es6/grid/ILayoutGrid.js +658 -0
  169. package/lib/core/es6/grid/LayoutGrid.d.ts +23 -0
  170. package/lib/core/es6/grid/LayoutGrid.js +2602 -0
  171. package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +18 -0
  172. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +907 -0
  173. package/lib/core/es6/grid/components/Cell.d.ts +50 -0
  174. package/lib/core/es6/grid/components/Cell.js +740 -0
  175. package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +19 -0
  176. package/lib/core/es6/grid/components/CellFloatingPanel.js +123 -0
  177. package/lib/core/es6/grid/components/CellSpan.d.ts +18 -0
  178. package/lib/core/es6/grid/components/CellSpan.js +99 -0
  179. package/lib/core/es6/grid/components/CellSpans.d.ts +38 -0
  180. package/lib/core/es6/grid/components/CellSpans.js +341 -0
  181. package/lib/core/es6/grid/components/Column.d.ts +22 -0
  182. package/lib/core/es6/grid/components/Column.js +612 -0
  183. package/lib/core/es6/grid/components/ElementWrapper.d.ts +125 -0
  184. package/lib/core/es6/grid/components/ElementWrapper.js +714 -0
  185. package/lib/core/es6/grid/components/HScrollbar.d.ts +24 -0
  186. package/lib/core/es6/grid/components/HScrollbar.js +222 -0
  187. package/lib/core/es6/grid/components/Scrollbar.d.ts +61 -0
  188. package/lib/core/es6/grid/components/Scrollbar.js +1374 -0
  189. package/lib/core/es6/grid/components/StretchedCells.d.ts +17 -0
  190. package/lib/core/es6/grid/components/StretchedCells.js +328 -0
  191. package/lib/core/es6/grid/components/VScrollbar.d.ts +18 -0
  192. package/lib/core/es6/grid/components/VScrollbar.js +139 -0
  193. package/lib/core/es6/grid/components/VirtualItems.d.ts +12 -0
  194. package/lib/core/es6/grid/components/VirtualItems.js +51 -0
  195. package/lib/core/es6/grid/event/EventDispatcher.d.ts +16 -0
  196. package/lib/core/es6/grid/event/EventDispatcher.js +138 -0
  197. package/lib/core/es6/grid/event/EventListeners.d.ts +34 -0
  198. package/lib/core/es6/grid/event/EventListeners.js +163 -0
  199. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.d.ts +24 -0
  200. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.js +615 -0
  201. package/lib/core/es6/grid/plugins/Plugin.d.ts +28 -0
  202. package/lib/core/es6/grid/plugins/Plugin.js +272 -0
  203. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +127 -0
  204. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +1707 -0
  205. package/lib/core/es6/grid/util/Conflator.d.ts +32 -0
  206. package/lib/core/es6/grid/util/Conflator.js +191 -0
  207. package/lib/core/es6/grid/util/ElementFrameWork.d.ts +18 -0
  208. package/lib/core/es6/grid/util/ElementFrameWork.js +227 -0
  209. package/lib/core/es6/grid/util/HttpRequest.d.ts +53 -0
  210. package/lib/core/es6/grid/util/HttpRequest.js +371 -0
  211. package/lib/core/es6/grid/util/PercentBar.d.ts +43 -0
  212. package/lib/core/es6/grid/util/PercentBar.js +390 -0
  213. package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +41 -0
  214. package/lib/core/es6/grid/util/PercentBarRenderer.js +316 -0
  215. package/lib/core/es6/grid/util/RangeBar.d.ts +25 -0
  216. package/lib/core/es6/grid/util/RangeBar.js +255 -0
  217. package/lib/core/es6/grid/util/Reverter.d.ts +14 -0
  218. package/lib/core/es6/grid/util/Reverter.js +79 -0
  219. package/lib/core/es6/grid/util/SectionSettings.d.ts +79 -0
  220. package/lib/core/es6/grid/util/SectionSettings.js +674 -0
  221. package/lib/core/es6/grid/util/SelectionList.d.ts +50 -0
  222. package/lib/core/es6/grid/util/SelectionList.js +422 -0
  223. package/lib/core/es6/grid/util/TrackLayout.d.ts +84 -0
  224. package/lib/core/es6/grid/util/TrackLayout.js +850 -0
  225. package/lib/core/es6/grid/util/Virtualizer.d.ts +40 -0
  226. package/lib/core/es6/grid/util/Virtualizer.js +340 -0
  227. package/lib/core/es6/grid/util/util.d.ts +18 -0
  228. package/lib/core/es6/grid/util/util.js +450 -0
  229. package/lib/core/es6/index.d.ts +84 -0
  230. package/lib/core/es6/index.js +132 -0
  231. package/lib/core/es6/tr-grid-theme.d.ts +5 -0
  232. package/lib/core/es6/tr-grid-theme.js +5 -0
  233. package/lib/filter-dialog/index.d.ts +1 -0
  234. package/lib/filter-dialog/index.js +1 -0
  235. package/lib/filter-dialog/lib/checkbox-list.d.ts +27 -0
  236. package/lib/filter-dialog/lib/checkbox-list.js +336 -0
  237. package/lib/filter-dialog/lib/filter-dialog.d.ts +53 -0
  238. package/lib/filter-dialog/lib/filter-dialog.js +860 -0
  239. package/lib/filter-dialog/lib/locale/translation-de.d.ts +7 -0
  240. package/lib/filter-dialog/lib/locale/translation-de.js +37 -0
  241. package/lib/filter-dialog/lib/locale/translation-en.d.ts +7 -0
  242. package/lib/filter-dialog/lib/locale/translation-en.js +37 -0
  243. package/lib/filter-dialog/lib/locale/translation-ja.d.ts +7 -0
  244. package/lib/filter-dialog/lib/locale/translation-ja.js +37 -0
  245. package/lib/filter-dialog/lib/locale/translation-zh-hant.d.ts +7 -0
  246. package/lib/filter-dialog/lib/locale/translation-zh-hant.js +37 -0
  247. package/lib/filter-dialog/lib/locale/translation-zh.d.ts +7 -0
  248. package/lib/filter-dialog/lib/locale/translation-zh.js +37 -0
  249. package/lib/filter-dialog/lib/locale/translation.d.ts +11 -0
  250. package/lib/filter-dialog/lib/locale/translation.js +18 -0
  251. package/lib/filter-dialog/themes/base-checkbox.less +37 -0
  252. package/lib/filter-dialog/themes/base.less +102 -0
  253. package/lib/filter-dialog/themes/elemental/checkbox-list.less +3 -0
  254. package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +4 -0
  255. package/lib/filter-dialog/themes/elemental/dark/css/native-elements.css +0 -0
  256. package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +4 -0
  257. package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +5 -0
  258. package/lib/filter-dialog/themes/elemental/dark/imports/all-elements.js +2 -0
  259. package/lib/filter-dialog/themes/elemental/dark/imports/custom-elements.js +2 -0
  260. package/lib/filter-dialog/themes/elemental/dark/imports/native-elements.js +0 -0
  261. package/lib/filter-dialog/themes/elemental/dark.js +11 -0
  262. package/lib/filter-dialog/themes/elemental/defaults.less +3 -0
  263. package/lib/filter-dialog/themes/elemental/filter-dialog.less +1 -0
  264. package/lib/filter-dialog/themes/elemental/index.less +6 -0
  265. package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +4 -0
  266. package/lib/filter-dialog/themes/elemental/light/css/native-elements.css +0 -0
  267. package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +4 -0
  268. package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +5 -0
  269. package/lib/filter-dialog/themes/elemental/light/imports/all-elements.js +2 -0
  270. package/lib/filter-dialog/themes/elemental/light/imports/custom-elements.js +2 -0
  271. package/lib/filter-dialog/themes/elemental/light/imports/native-elements.js +0 -0
  272. package/lib/filter-dialog/themes/elemental/light.js +11 -0
  273. package/lib/filter-dialog/themes/halo/checkbox-list.less +3 -0
  274. package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +4 -0
  275. package/lib/filter-dialog/themes/halo/dark/css/native-elements.css +0 -0
  276. package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +4 -0
  277. package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +5 -0
  278. package/lib/filter-dialog/themes/halo/dark/imports/all-elements.js +2 -0
  279. package/lib/filter-dialog/themes/halo/dark/imports/custom-elements.js +2 -0
  280. package/lib/filter-dialog/themes/halo/dark/imports/native-elements.js +0 -0
  281. package/lib/filter-dialog/themes/halo/dark.js +11 -0
  282. package/lib/filter-dialog/themes/halo/defaults.less +3 -0
  283. package/lib/filter-dialog/themes/halo/filter-dialog.less +9 -0
  284. package/lib/filter-dialog/themes/halo/index.less +6 -0
  285. package/lib/filter-dialog/themes/halo/light/checkbox-list.js +4 -0
  286. package/lib/filter-dialog/themes/halo/light/css/native-elements.css +0 -0
  287. package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +4 -0
  288. package/lib/filter-dialog/themes/halo/light/filter-dialog.js +5 -0
  289. package/lib/filter-dialog/themes/halo/light/imports/all-elements.js +2 -0
  290. package/lib/filter-dialog/themes/halo/light/imports/custom-elements.js +2 -0
  291. package/lib/filter-dialog/themes/halo/light/imports/native-elements.js +0 -0
  292. package/lib/filter-dialog/themes/halo/light.js +11 -0
  293. package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +4 -0
  294. package/lib/filter-dialog/themes/solar/charcoal/css/native-elements.css +0 -0
  295. package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +4 -0
  296. package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +5 -0
  297. package/lib/filter-dialog/themes/solar/charcoal/imports/all-elements.js +2 -0
  298. package/lib/filter-dialog/themes/solar/charcoal/imports/custom-elements.js +2 -0
  299. package/lib/filter-dialog/themes/solar/charcoal/imports/native-elements.js +0 -0
  300. package/lib/filter-dialog/themes/solar/charcoal.js +11 -0
  301. package/lib/filter-dialog/themes/solar/checkbox-list.less +3 -0
  302. package/lib/filter-dialog/themes/solar/defaults.less +3 -0
  303. package/lib/filter-dialog/themes/solar/filter-dialog.less +5 -0
  304. package/lib/filter-dialog/themes/solar/index.less +6 -0
  305. package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +4 -0
  306. package/lib/filter-dialog/themes/solar/pearl/css/native-elements.css +0 -0
  307. package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +4 -0
  308. package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +5 -0
  309. package/lib/filter-dialog/themes/solar/pearl/imports/all-elements.js +2 -0
  310. package/lib/filter-dialog/themes/solar/pearl/imports/custom-elements.js +2 -0
  311. package/lib/filter-dialog/themes/solar/pearl/imports/native-elements.js +0 -0
  312. package/lib/filter-dialog/themes/solar/pearl.js +11 -0
  313. package/lib/formatters/es6/CoralButtonFormatter.d.ts +22 -0
  314. package/lib/formatters/es6/CoralButtonFormatter.js +40 -0
  315. package/lib/formatters/es6/CoralCheckboxFormatter.d.ts +12 -0
  316. package/lib/formatters/es6/CoralCheckboxFormatter.js +45 -0
  317. package/lib/formatters/es6/CoralComboBoxFormatter.d.ts +23 -0
  318. package/lib/formatters/es6/CoralComboBoxFormatter.js +102 -0
  319. package/lib/formatters/es6/CoralIconFormatter.d.ts +23 -0
  320. package/lib/formatters/es6/CoralIconFormatter.js +45 -0
  321. package/lib/formatters/es6/CoralInputFormatter.d.ts +12 -0
  322. package/lib/formatters/es6/CoralInputFormatter.js +40 -0
  323. package/lib/formatters/es6/CoralRadioButtonFormatter.d.ts +22 -0
  324. package/lib/formatters/es6/CoralRadioButtonFormatter.js +80 -0
  325. package/lib/formatters/es6/CoralSelectFormatter.d.ts +23 -0
  326. package/lib/formatters/es6/CoralSelectFormatter.js +66 -0
  327. package/lib/formatters/es6/CoralToggleFormatter.d.ts +12 -0
  328. package/lib/formatters/es6/CoralToggleFormatter.js +47 -0
  329. package/lib/formatters/es6/DuplexEmeraldDateTimePickerFormatter.d.ts +14 -0
  330. package/lib/formatters/es6/DuplexEmeraldDateTimePickerFormatter.js +119 -0
  331. package/lib/formatters/es6/EFButtonFormatter.d.ts +22 -0
  332. package/lib/formatters/es6/EFButtonFormatter.js +40 -0
  333. package/lib/formatters/es6/EFCheckboxFormatter.d.ts +12 -0
  334. package/lib/formatters/es6/EFCheckboxFormatter.js +45 -0
  335. package/lib/formatters/es6/EFComboBoxFormatter.d.ts +23 -0
  336. package/lib/formatters/es6/EFComboBoxFormatter.js +68 -0
  337. package/lib/formatters/es6/EFDateTimePickerFormatter.d.ts +13 -0
  338. package/lib/formatters/es6/EFDateTimePickerFormatter.js +55 -0
  339. package/lib/formatters/es6/EFIconFormatter.d.ts +23 -0
  340. package/lib/formatters/es6/EFIconFormatter.js +45 -0
  341. package/lib/formatters/es6/EFNumberFieldFormatter.d.ts +12 -0
  342. package/lib/formatters/es6/EFNumberFieldFormatter.js +40 -0
  343. package/lib/formatters/es6/EFRadioButtonFormatter.d.ts +22 -0
  344. package/lib/formatters/es6/EFRadioButtonFormatter.js +80 -0
  345. package/lib/formatters/es6/EFSelectFormatter.d.ts +23 -0
  346. package/lib/formatters/es6/EFSelectFormatter.js +66 -0
  347. package/lib/formatters/es6/EFTextFieldFormatter.d.ts +12 -0
  348. package/lib/formatters/es6/EFTextFieldFormatter.js +40 -0
  349. package/lib/formatters/es6/EFToggleFormatter.d.ts +12 -0
  350. package/lib/formatters/es6/EFToggleFormatter.js +47 -0
  351. package/lib/formatters/es6/EmeraldDateTimePickerFormatter.d.ts +13 -0
  352. package/lib/formatters/es6/EmeraldDateTimePickerFormatter.js +55 -0
  353. package/lib/formatters/es6/FormatterBuilder.d.ts +22 -0
  354. package/lib/formatters/es6/FormatterBuilder.js +334 -0
  355. package/lib/formatters/es6/NumericInputFormatter.d.ts +13 -0
  356. package/lib/formatters/es6/NumericInputFormatter.js +64 -0
  357. package/lib/formatters/es6/PercentBarFormatter.d.ts +25 -0
  358. package/lib/formatters/es6/PercentBarFormatter.js +62 -0
  359. package/lib/formatters/es6/SimpleImageFormatter.d.ts +21 -0
  360. package/lib/formatters/es6/SimpleImageFormatter.js +64 -0
  361. package/lib/formatters/es6/SimpleInputFormatter.d.ts +12 -0
  362. package/lib/formatters/es6/SimpleInputFormatter.js +40 -0
  363. package/lib/formatters/es6/SimpleLinkFormatter.d.ts +21 -0
  364. package/lib/formatters/es6/SimpleLinkFormatter.js +48 -0
  365. package/lib/formatters/es6/SimpleTickerFormatter.d.ts +25 -0
  366. package/lib/formatters/es6/SimpleTickerFormatter.js +65 -0
  367. package/lib/formatters/es6/SimpleToggleFormatter.d.ts +22 -0
  368. package/lib/formatters/es6/SimpleToggleFormatter.js +132 -0
  369. package/lib/formatters/es6/TextFormatter.d.ts +12 -0
  370. package/lib/formatters/es6/TextFormatter.js +30 -0
  371. package/lib/formatters/es6/index.d.ts +43 -0
  372. package/lib/formatters/es6/index.js +67 -0
  373. package/lib/grid/index.d.ts +1 -0
  374. package/lib/grid/index.js +2 -0
  375. package/lib/grid/lib/efx-grid.d.ts +32 -0
  376. package/lib/grid/lib/efx-grid.js +469 -0
  377. package/lib/grid/themes/base.less +134 -0
  378. package/lib/grid/themes/halo/dark/css/native-elements.css +0 -0
  379. package/lib/grid/themes/halo/dark/efx-grid.js +4 -0
  380. package/lib/grid/themes/halo/dark/es5/all-elements.js +2 -0
  381. package/lib/grid/themes/halo/dark/imports/all-elements.js +1 -0
  382. package/lib/grid/themes/halo/dark/imports/custom-elements.js +1 -0
  383. package/lib/grid/themes/halo/dark/imports/native-elements.js +0 -0
  384. package/lib/grid/themes/halo/dark.js +3 -0
  385. package/lib/grid/themes/halo/efx-grid.less +92 -0
  386. package/lib/grid/themes/halo/index.less +3 -0
  387. package/lib/grid/themes/halo/light/css/native-elements.css +0 -0
  388. package/lib/grid/themes/halo/light/efx-grid.js +4 -0
  389. package/lib/grid/themes/halo/light/es5/all-elements.js +2 -0
  390. package/lib/grid/themes/halo/light/imports/all-elements.js +1 -0
  391. package/lib/grid/themes/halo/light/imports/custom-elements.js +1 -0
  392. package/lib/grid/themes/halo/light/imports/native-elements.js +0 -0
  393. package/lib/grid/themes/halo/light.js +3 -0
  394. package/lib/grid/themes/solar/charcoal/css/native-elements.css +0 -0
  395. package/lib/grid/themes/solar/charcoal/efx-grid.js +4 -0
  396. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +2 -0
  397. package/lib/grid/themes/solar/charcoal/imports/all-elements.js +1 -0
  398. package/lib/grid/themes/solar/charcoal/imports/custom-elements.js +1 -0
  399. package/lib/grid/themes/solar/charcoal/imports/native-elements.js +0 -0
  400. package/lib/grid/themes/solar/charcoal.js +3 -0
  401. package/lib/grid/themes/solar/efx-grid.less +27 -0
  402. package/lib/grid/themes/solar/index.less +3 -0
  403. package/lib/grid/themes/solar/pearl/css/native-elements.css +0 -0
  404. package/lib/grid/themes/solar/pearl/efx-grid.js +4 -0
  405. package/lib/grid/themes/solar/pearl/es5/all-elements.js +2 -0
  406. package/lib/grid/themes/solar/pearl/imports/all-elements.js +1 -0
  407. package/lib/grid/themes/solar/pearl/imports/custom-elements.js +1 -0
  408. package/lib/grid/themes/solar/pearl/imports/native-elements.js +0 -0
  409. package/lib/grid/themes/solar/pearl.js +3 -0
  410. package/lib/index.d.ts +102 -0
  411. package/lib/index.js +102 -0
  412. package/lib/row-segmenting/es6/RowSegmenting.d.ts +83 -0
  413. package/lib/row-segmenting/es6/RowSegmenting.js +592 -0
  414. package/lib/row-segmenting/es6/index.d.ts +1 -0
  415. package/lib/row-segmenting/es6/index.js +1 -0
  416. package/lib/rt-grid/dist/rt-grid.js +44672 -0
  417. package/lib/rt-grid/dist/rt-grid.min.js +1 -0
  418. package/lib/rt-grid/es6/ColumnDefinition.d.ts +141 -0
  419. package/lib/rt-grid/es6/ColumnDefinition.js +1074 -0
  420. package/lib/rt-grid/es6/DataConnector.d.ts +37 -0
  421. package/lib/rt-grid/es6/DataConnector.js +266 -0
  422. package/lib/rt-grid/es6/FieldDefinition.d.ts +20 -0
  423. package/lib/rt-grid/es6/FieldDefinition.js +418 -0
  424. package/lib/rt-grid/es6/Grid.d.ts +261 -0
  425. package/lib/rt-grid/es6/Grid.js +2893 -0
  426. package/lib/rt-grid/es6/PredefinedFormula.d.ts +16 -0
  427. package/lib/rt-grid/es6/PredefinedFormula.js +33 -0
  428. package/lib/rt-grid/es6/ReferenceCounter.d.ts +38 -0
  429. package/lib/rt-grid/es6/ReferenceCounter.js +230 -0
  430. package/lib/rt-grid/es6/RowDefinition.d.ts +120 -0
  431. package/lib/rt-grid/es6/RowDefinition.js +873 -0
  432. package/lib/rt-grid/es6/SnapshotFiller.d.ts +21 -0
  433. package/lib/rt-grid/es6/SnapshotFiller.js +252 -0
  434. package/lib/rt-grid/es6/StyleLoader.d.ts +17 -0
  435. package/lib/rt-grid/es6/StyleLoader.js +47 -0
  436. package/lib/rt-grid/es6/index.d.ts +8 -0
  437. package/lib/rt-grid/es6/index.js +43 -0
  438. package/lib/statistics-row/es6/StatisticsRow.d.ts +67 -0
  439. package/lib/statistics-row/es6/StatisticsRow.js +786 -0
  440. package/lib/statistics-row/es6/index.d.ts +1 -0
  441. package/lib/statistics-row/es6/index.js +1 -0
  442. package/lib/tr-grid-auto-tooltip/es6/AutoTooltip.d.ts +45 -0
  443. package/lib/tr-grid-auto-tooltip/es6/AutoTooltip.js +431 -0
  444. package/lib/tr-grid-auto-tooltip/es6/index.d.ts +1 -0
  445. package/lib/tr-grid-auto-tooltip/es6/index.js +1 -0
  446. package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +67 -0
  447. package/lib/tr-grid-cell-selection/es6/CellSelection.js +1777 -0
  448. package/lib/tr-grid-cell-selection/es6/index.d.ts +1 -0
  449. package/lib/tr-grid-cell-selection/es6/index.js +1 -0
  450. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +69 -0
  451. package/lib/tr-grid-checkbox/es6/Checkbox.js +1476 -0
  452. package/lib/tr-grid-checkbox/es6/index.d.ts +1 -0
  453. package/lib/tr-grid-checkbox/es6/index.js +1 -0
  454. package/lib/tr-grid-column-fitter/es6/ColumnFitter.d.ts +56 -0
  455. package/lib/tr-grid-column-fitter/es6/ColumnFitter.js +1000 -0
  456. package/lib/tr-grid-column-fitter/es6/index.d.ts +1 -0
  457. package/lib/tr-grid-column-fitter/es6/index.js +1 -0
  458. package/lib/tr-grid-column-formatting/es6/ColumnFormatting.d.ts +89 -0
  459. package/lib/tr-grid-column-formatting/es6/ColumnFormatting.js +615 -0
  460. package/lib/tr-grid-column-formatting/es6/index.d.ts +1 -0
  461. package/lib/tr-grid-column-formatting/es6/index.js +1 -0
  462. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +60 -0
  463. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +913 -0
  464. package/lib/tr-grid-column-grouping/es6/index.d.ts +1 -0
  465. package/lib/tr-grid-column-grouping/es6/index.js +1 -0
  466. package/lib/tr-grid-column-resizing/es6/ColumnResizing.d.ts +68 -0
  467. package/lib/tr-grid-column-resizing/es6/ColumnResizing.js +1013 -0
  468. package/lib/tr-grid-column-resizing/es6/index.d.ts +1 -0
  469. package/lib/tr-grid-column-resizing/es6/index.js +1 -0
  470. package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +70 -0
  471. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +928 -0
  472. package/lib/tr-grid-column-selection/es6/index.d.ts +1 -0
  473. package/lib/tr-grid-column-selection/es6/index.js +1 -0
  474. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +76 -0
  475. package/lib/tr-grid-column-stack/es6/ColumnStack.js +1227 -0
  476. package/lib/tr-grid-column-stack/es6/index.d.ts +1 -0
  477. package/lib/tr-grid-column-stack/es6/index.js +1 -0
  478. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +70 -0
  479. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +947 -0
  480. package/lib/tr-grid-conditional-coloring/es6/index.d.ts +1 -0
  481. package/lib/tr-grid-conditional-coloring/es6/index.js +1 -0
  482. package/lib/tr-grid-content-wrap/es6/ContentWrap.d.ts +43 -0
  483. package/lib/tr-grid-content-wrap/es6/ContentWrap.js +478 -0
  484. package/lib/tr-grid-content-wrap/es6/index.d.ts +1 -0
  485. package/lib/tr-grid-content-wrap/es6/index.js +1 -0
  486. package/lib/tr-grid-contextmenu/es6/ContextMenu.d.ts +83 -0
  487. package/lib/tr-grid-contextmenu/es6/ContextMenu.js +471 -0
  488. package/lib/tr-grid-contextmenu/es6/MenuEventAPI.d.ts +22 -0
  489. package/lib/tr-grid-contextmenu/es6/MenuEventAPI.js +133 -0
  490. package/lib/tr-grid-contextmenu/es6/MenuItem.d.ts +39 -0
  491. package/lib/tr-grid-contextmenu/es6/MenuItem.js +245 -0
  492. package/lib/tr-grid-contextmenu/es6/PopupMenu.d.ts +29 -0
  493. package/lib/tr-grid-contextmenu/es6/PopupMenu.js +292 -0
  494. package/lib/tr-grid-contextmenu/es6/index.d.ts +1 -0
  495. package/lib/tr-grid-contextmenu/es6/index.js +1 -0
  496. package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +57 -0
  497. package/lib/tr-grid-filter-input/es6/FilterInput.js +928 -0
  498. package/lib/tr-grid-filter-input/es6/index.d.ts +1 -0
  499. package/lib/tr-grid-filter-input/es6/index.js +1 -0
  500. package/lib/tr-grid-heat-map/es6/HeatMap.d.ts +44 -0
  501. package/lib/tr-grid-heat-map/es6/HeatMap.js +394 -0
  502. package/lib/tr-grid-heat-map/es6/index.d.ts +1 -0
  503. package/lib/tr-grid-heat-map/es6/index.js +1 -0
  504. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +129 -0
  505. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +1977 -0
  506. package/lib/tr-grid-in-cell-editing/es6/index.d.ts +1 -0
  507. package/lib/tr-grid-in-cell-editing/es6/index.js +1 -0
  508. package/lib/tr-grid-pagination/es6/Pagination.d.ts +57 -0
  509. package/lib/tr-grid-pagination/es6/Pagination.js +427 -0
  510. package/lib/tr-grid-pagination/es6/index.d.ts +1 -0
  511. package/lib/tr-grid-pagination/es6/index.js +1 -0
  512. package/lib/tr-grid-percent-bar/es6/PercentBar.d.ts +60 -0
  513. package/lib/tr-grid-percent-bar/es6/PercentBar.js +801 -0
  514. package/lib/tr-grid-percent-bar/es6/index.d.ts +1 -0
  515. package/lib/tr-grid-percent-bar/es6/index.js +1 -0
  516. package/lib/tr-grid-printer/es6/CellWriter.d.ts +49 -0
  517. package/lib/tr-grid-printer/es6/CellWriter.js +226 -0
  518. package/lib/tr-grid-printer/es6/ColumnWriter.d.ts +12 -0
  519. package/lib/tr-grid-printer/es6/ColumnWriter.js +21 -0
  520. package/lib/tr-grid-printer/es6/GridPrinter.d.ts +32 -0
  521. package/lib/tr-grid-printer/es6/GridPrinter.js +761 -0
  522. package/lib/tr-grid-printer/es6/PrintTrait.d.ts +38 -0
  523. package/lib/tr-grid-printer/es6/PrintTrait.js +481 -0
  524. package/lib/tr-grid-printer/es6/SectionWriter.d.ts +54 -0
  525. package/lib/tr-grid-printer/es6/SectionWriter.js +205 -0
  526. package/lib/tr-grid-printer/es6/index.d.ts +1 -0
  527. package/lib/tr-grid-printer/es6/index.js +1 -0
  528. package/lib/tr-grid-range-bar/es6/RangeBar.d.ts +39 -0
  529. package/lib/tr-grid-range-bar/es6/RangeBar.js +353 -0
  530. package/lib/tr-grid-range-bar/es6/index.d.ts +1 -0
  531. package/lib/tr-grid-range-bar/es6/index.js +1 -0
  532. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +53 -0
  533. package/lib/tr-grid-row-dragging/es6/RowDragging.js +794 -0
  534. package/lib/tr-grid-row-dragging/es6/index.d.ts +1 -0
  535. package/lib/tr-grid-row-dragging/es6/index.js +1 -0
  536. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +118 -0
  537. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +1884 -0
  538. package/lib/tr-grid-row-filtering/es6/index.d.ts +1 -0
  539. package/lib/tr-grid-row-filtering/es6/index.js +1 -0
  540. package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +109 -0
  541. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +1541 -0
  542. package/lib/tr-grid-row-grouping/es6/index.d.ts +1 -0
  543. package/lib/tr-grid-row-grouping/es6/index.js +1 -0
  544. package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +74 -0
  545. package/lib/tr-grid-row-selection/es6/RowSelection.js +1202 -0
  546. package/lib/tr-grid-row-selection/es6/index.d.ts +1 -0
  547. package/lib/tr-grid-row-selection/es6/index.js +1 -0
  548. package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +60 -0
  549. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +611 -0
  550. package/lib/tr-grid-rowcoloring/es6/index.d.ts +1 -0
  551. package/lib/tr-grid-rowcoloring/es6/index.js +1 -0
  552. package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +77 -0
  553. package/lib/tr-grid-textformatting/es6/TextFormatting.js +574 -0
  554. package/lib/tr-grid-textformatting/es6/index.d.ts +1 -0
  555. package/lib/tr-grid-textformatting/es6/index.js +1 -0
  556. package/lib/tr-grid-titlewrap/es6/TitleWrap.d.ts +29 -0
  557. package/lib/tr-grid-titlewrap/es6/TitleWrap.js +431 -0
  558. package/lib/tr-grid-titlewrap/es6/index.d.ts +1 -0
  559. package/lib/tr-grid-titlewrap/es6/index.js +1 -0
  560. package/lib/tr-grid-util/es6/CellPainter.d.ts +136 -0
  561. package/lib/tr-grid-util/es6/CellPainter.js +1128 -0
  562. package/lib/tr-grid-util/es6/Conflator.d.ts +34 -0
  563. package/lib/tr-grid-util/es6/Conflator.js +193 -0
  564. package/lib/tr-grid-util/es6/CoralItems.d.ts +10 -0
  565. package/lib/tr-grid-util/es6/CoralItems.js +42 -0
  566. package/lib/tr-grid-util/es6/DateTime.d.ts +57 -0
  567. package/lib/tr-grid-util/es6/DateTime.js +508 -0
  568. package/lib/tr-grid-util/es6/Deferred.d.ts +14 -0
  569. package/lib/tr-grid-util/es6/Deferred.js +98 -0
  570. package/lib/tr-grid-util/es6/Delay.d.ts +20 -0
  571. package/lib/tr-grid-util/es6/Delay.js +85 -0
  572. package/lib/tr-grid-util/es6/Dom.d.ts +32 -0
  573. package/lib/tr-grid-util/es6/Dom.js +346 -0
  574. package/lib/tr-grid-util/es6/ElementObserver.d.ts +10 -0
  575. package/lib/tr-grid-util/es6/ElementObserver.js +101 -0
  576. package/lib/tr-grid-util/es6/ElementWrapper.d.ts +23 -0
  577. package/lib/tr-grid-util/es6/ElementWrapper.js +83 -0
  578. package/lib/tr-grid-util/es6/ElfDate.d.ts +26 -0
  579. package/lib/tr-grid-util/es6/ElfDate.js +163 -0
  580. package/lib/tr-grid-util/es6/ElfUtil.d.ts +33 -0
  581. package/lib/tr-grid-util/es6/ElfUtil.js +458 -0
  582. package/lib/tr-grid-util/es6/EventDispatcher.d.ts +26 -0
  583. package/lib/tr-grid-util/es6/EventDispatcher.js +161 -0
  584. package/lib/tr-grid-util/es6/ExpanderIcon.d.ts +27 -0
  585. package/lib/tr-grid-util/es6/ExpanderIcon.js +169 -0
  586. package/lib/tr-grid-util/es6/Ext.d.ts +10 -0
  587. package/lib/tr-grid-util/es6/Ext.js +52 -0
  588. package/lib/tr-grid-util/es6/FieldFormatter.d.ts +55 -0
  589. package/lib/tr-grid-util/es6/FieldFormatter.js +432 -0
  590. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +48 -0
  591. package/lib/tr-grid-util/es6/FilterBuilder.js +521 -0
  592. package/lib/tr-grid-util/es6/FilterOperators.d.ts +41 -0
  593. package/lib/tr-grid-util/es6/FilterOperators.js +181 -0
  594. package/lib/tr-grid-util/es6/GridPlugin.d.ts +72 -0
  595. package/lib/tr-grid-util/es6/GridPlugin.js +747 -0
  596. package/lib/tr-grid-util/es6/Icon.d.ts +14 -0
  597. package/lib/tr-grid-util/es6/Icon.js +61 -0
  598. package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +42 -0
  599. package/lib/tr-grid-util/es6/MouseDownTrait.js +237 -0
  600. package/lib/tr-grid-util/es6/MultiTableManager.d.ts +32 -0
  601. package/lib/tr-grid-util/es6/MultiTableManager.js +506 -0
  602. package/lib/tr-grid-util/es6/NumberFormatter.d.ts +83 -0
  603. package/lib/tr-grid-util/es6/NumberFormatter.js +471 -0
  604. package/lib/tr-grid-util/es6/PercentBar.d.ts +71 -0
  605. package/lib/tr-grid-util/es6/PercentBar.js +600 -0
  606. package/lib/tr-grid-util/es6/Perf.d.ts +32 -0
  607. package/lib/tr-grid-util/es6/Perf.js +162 -0
  608. package/lib/tr-grid-util/es6/Popup.d.ts +84 -0
  609. package/lib/tr-grid-util/es6/Popup.js +818 -0
  610. package/lib/tr-grid-util/es6/RangeBar.d.ts +33 -0
  611. package/lib/tr-grid-util/es6/RangeBar.js +259 -0
  612. package/lib/tr-grid-util/es6/RequestQueue.d.ts +30 -0
  613. package/lib/tr-grid-util/es6/RequestQueue.js +239 -0
  614. package/lib/tr-grid-util/es6/RowPainter.d.ts +23 -0
  615. package/lib/tr-grid-util/es6/RowPainter.js +188 -0
  616. package/lib/tr-grid-util/es6/SubTable.d.ts +74 -0
  617. package/lib/tr-grid-util/es6/SubTable.js +558 -0
  618. package/lib/tr-grid-util/es6/Table.d.ts +125 -0
  619. package/lib/tr-grid-util/es6/Table.js +790 -0
  620. package/lib/tr-grid-util/es6/TextHighlighter.d.ts +18 -0
  621. package/lib/tr-grid-util/es6/TextHighlighter.js +273 -0
  622. package/lib/tr-grid-util/es6/TickCodes.d.ts +8 -0
  623. package/lib/tr-grid-util/es6/TickCodes.js +33 -0
  624. package/lib/tr-grid-util/es6/Timer.d.ts +16 -0
  625. package/lib/tr-grid-util/es6/Timer.js +49 -0
  626. package/lib/tr-grid-util/es6/TouchProxy.d.ts +46 -0
  627. package/lib/tr-grid-util/es6/TouchProxy.js +212 -0
  628. package/lib/tr-grid-util/es6/Util.d.ts +65 -0
  629. package/lib/tr-grid-util/es6/Util.js +528 -0
  630. package/lib/tr-grid-util/es6/formula/ADCService.d.ts +11 -0
  631. package/lib/tr-grid-util/es6/formula/ADCService.js +72 -0
  632. package/lib/tr-grid-util/es6/formula/ADCSubscription.d.ts +17 -0
  633. package/lib/tr-grid-util/es6/formula/ADCSubscription.js +317 -0
  634. package/lib/tr-grid-util/es6/formula/AdFinService.d.ts +12 -0
  635. package/lib/tr-grid-util/es6/formula/AdFinService.js +61 -0
  636. package/lib/tr-grid-util/es6/formula/AdFinSubscription.d.ts +19 -0
  637. package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +310 -0
  638. package/lib/tr-grid-util/es6/formula/Engine.d.ts +56 -0
  639. package/lib/tr-grid-util/es6/formula/Engine.js +592 -0
  640. package/lib/tr-grid-util/es6/formula/Formula.d.ts +68 -0
  641. package/lib/tr-grid-util/es6/formula/Formula.js +882 -0
  642. package/lib/tr-grid-util/es6/formula/IntervalSubscription.d.ts +16 -0
  643. package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +165 -0
  644. package/lib/tr-grid-util/es6/formula/Realtime.d.ts +18 -0
  645. package/lib/tr-grid-util/es6/formula/Realtime.js +279 -0
  646. package/lib/tr-grid-util/es6/formula/RealtimeService.d.ts +18 -0
  647. package/lib/tr-grid-util/es6/formula/RealtimeService.js +203 -0
  648. package/lib/tr-grid-util/es6/formula/TSIService.d.ts +11 -0
  649. package/lib/tr-grid-util/es6/formula/TSIService.js +51 -0
  650. package/lib/tr-grid-util/es6/formula/TSISubscription.d.ts +18 -0
  651. package/lib/tr-grid-util/es6/formula/TSISubscription.js +1015 -0
  652. package/lib/tr-grid-util/es6/formula/VariableToken.d.ts +30 -0
  653. package/lib/tr-grid-util/es6/formula/VariableToken.js +314 -0
  654. package/lib/tr-grid-util/es6/formula/functions/AdFin.d.ts +9 -0
  655. package/lib/tr-grid-util/es6/formula/functions/AdFin.js +1778 -0
  656. package/lib/tr-grid-util/es6/formula/functions/Excel.d.ts +8 -0
  657. package/lib/tr-grid-util/es6/formula/functions/Excel.js +21 -0
  658. package/lib/tr-grid-util/es6/formula/functions/Info.d.ts +8 -0
  659. package/lib/tr-grid-util/es6/formula/functions/Info.js +192 -0
  660. package/lib/tr-grid-util/es6/formula/functions/Internal.d.ts +8 -0
  661. package/lib/tr-grid-util/es6/formula/functions/Internal.js +90 -0
  662. package/lib/tr-grid-util/es6/formula/functions/Logic.d.ts +12 -0
  663. package/lib/tr-grid-util/es6/formula/functions/Logic.js +176 -0
  664. package/lib/tr-grid-util/es6/formula/functions/Math.d.ts +18 -0
  665. package/lib/tr-grid-util/es6/formula/functions/Math.js +1624 -0
  666. package/lib/tr-grid-util/es6/formula/functions/Statistics.d.ts +18 -0
  667. package/lib/tr-grid-util/es6/formula/functions/Statistics.js +234 -0
  668. package/lib/tr-grid-util/es6/formula/functions/Text.d.ts +10 -0
  669. package/lib/tr-grid-util/es6/formula/functions/Text.js +676 -0
  670. package/lib/tr-grid-util/es6/index.d.ts +63 -0
  671. package/lib/tr-grid-util/es6/index.js +99 -0
  672. package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +28 -0
  673. package/lib/tr-grid-util/es6/jet/CollectionDict.js +141 -0
  674. package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +114 -0
  675. package/lib/tr-grid-util/es6/jet/DataGenerator.js +827 -0
  676. package/lib/tr-grid-util/es6/jet/DataSet.d.ts +8 -0
  677. package/lib/tr-grid-util/es6/jet/DataSet.js +392 -0
  678. package/lib/tr-grid-util/es6/jet/MockArchive.d.ts +21 -0
  679. package/lib/tr-grid-util/es6/jet/MockArchive.js +56 -0
  680. package/lib/tr-grid-util/es6/jet/MockJET.d.ts +25 -0
  681. package/lib/tr-grid-util/es6/jet/MockJET.js +63 -0
  682. package/lib/tr-grid-util/es6/jet/MockQuotes.d.ts +37 -0
  683. package/lib/tr-grid-util/es6/jet/MockQuotes.js +199 -0
  684. package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +72 -0
  685. package/lib/tr-grid-util/es6/jet/MockQuotes2.js +564 -0
  686. package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +8 -0
  687. package/lib/tr-grid-util/es6/jet/MockRTK.js +43 -0
  688. package/lib/tr-grid-util/es6/jet/index.d.ts +9 -0
  689. package/lib/tr-grid-util/es6/jet/index.js +18 -0
  690. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +11 -0
  691. package/lib/tr-grid-util/es6/jet/mockDataAPI.js +131 -0
  692. package/lib/tr-grid-util/es6/locale/translation-de.d.ts +7 -0
  693. package/lib/tr-grid-util/es6/locale/translation-de.js +51 -0
  694. package/lib/tr-grid-util/es6/locale/translation-en.d.ts +7 -0
  695. package/lib/tr-grid-util/es6/locale/translation-en.js +51 -0
  696. package/lib/tr-grid-util/es6/locale/translation-ja.d.ts +7 -0
  697. package/lib/tr-grid-util/es6/locale/translation-ja.js +51 -0
  698. package/lib/tr-grid-util/es6/locale/translation-zh-hant.d.ts +7 -0
  699. package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +51 -0
  700. package/lib/tr-grid-util/es6/locale/translation-zh.d.ts +7 -0
  701. package/lib/tr-grid-util/es6/locale/translation-zh.js +51 -0
  702. package/lib/tr-grid-util/es6/locale/translation.d.ts +11 -0
  703. package/lib/tr-grid-util/es6/locale/translation.js +18 -0
  704. package/lib/types/es6/AutoTooltip.d.ts +45 -0
  705. package/lib/types/es6/CellSelection.d.ts +67 -0
  706. package/lib/types/es6/Checkbox.d.ts +69 -0
  707. package/lib/types/es6/ColumnFitter.d.ts +56 -0
  708. package/lib/types/es6/ColumnFormatting.d.ts +90 -0
  709. package/lib/types/es6/ColumnGrouping.d.ts +60 -0
  710. package/lib/types/es6/ColumnResizing.d.ts +68 -0
  711. package/lib/types/es6/ColumnSelection.d.ts +70 -0
  712. package/lib/types/es6/ColumnStack.d.ts +76 -0
  713. package/lib/types/es6/CompositeGrid/CollapsibleHeaderPlugin.d.ts +11 -0
  714. package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +38 -0
  715. package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +45 -0
  716. package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +287 -0
  717. package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +22 -0
  718. package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +44 -0
  719. package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +30 -0
  720. package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +42 -0
  721. package/lib/types/es6/CompositeGrid/TextWidthCalculator.d.ts +24 -0
  722. package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +46 -0
  723. package/lib/types/es6/CompositeGrid/index.d.ts +9 -0
  724. package/lib/types/es6/ConditionalColoring.d.ts +70 -0
  725. package/lib/types/es6/ContentWrap.d.ts +43 -0
  726. package/lib/types/es6/ContextMenu.d.ts +83 -0
  727. package/lib/types/es6/CoralButtonFormatter.d.ts +22 -0
  728. package/lib/types/es6/CoralCheckboxFormatter.d.ts +12 -0
  729. package/lib/types/es6/CoralComboBoxFormatter.d.ts +23 -0
  730. package/lib/types/es6/CoralIconFormatter.d.ts +23 -0
  731. package/lib/types/es6/CoralInputFormatter.d.ts +12 -0
  732. package/lib/types/es6/CoralRadioButtonFormatter.d.ts +22 -0
  733. package/lib/types/es6/CoralSelectFormatter.d.ts +23 -0
  734. package/lib/types/es6/CoralToggleFormatter.d.ts +12 -0
  735. package/lib/types/es6/Core/data/ColumnStats.d.ts +42 -0
  736. package/lib/types/es6/Core/data/DataCache.d.ts +81 -0
  737. package/lib/types/es6/Core/data/DataTable.d.ts +125 -0
  738. package/lib/types/es6/Core/data/DataView.d.ts +280 -0
  739. package/lib/types/es6/Core/data/Segment.d.ts +38 -0
  740. package/lib/types/es6/Core/data/SegmentCollection.d.ts +58 -0
  741. package/lib/types/es6/Core/grid/Core.d.ts +387 -0
  742. package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +204 -0
  743. package/lib/types/es6/Core/grid/LayoutGrid.d.ts +23 -0
  744. package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +18 -0
  745. package/lib/types/es6/Core/grid/components/Cell.d.ts +50 -0
  746. package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +19 -0
  747. package/lib/types/es6/Core/grid/components/CellSpan.d.ts +18 -0
  748. package/lib/types/es6/Core/grid/components/CellSpans.d.ts +38 -0
  749. package/lib/types/es6/Core/grid/components/Column.d.ts +22 -0
  750. package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +125 -0
  751. package/lib/types/es6/Core/grid/components/HScrollbar.d.ts +24 -0
  752. package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +61 -0
  753. package/lib/types/es6/Core/grid/components/StretchedCells.d.ts +17 -0
  754. package/lib/types/es6/Core/grid/components/VScrollbar.d.ts +18 -0
  755. package/lib/types/es6/Core/grid/components/VirtualItems.d.ts +12 -0
  756. package/lib/types/es6/Core/grid/event/EventDispatcher.d.ts +16 -0
  757. package/lib/types/es6/Core/grid/event/EventListeners.d.ts +34 -0
  758. package/lib/types/es6/Core/grid/plugins/DragAndDropTitlePlugin.d.ts +24 -0
  759. package/lib/types/es6/Core/grid/plugins/Plugin.d.ts +28 -0
  760. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +127 -0
  761. package/lib/types/es6/Core/grid/util/Conflator.d.ts +32 -0
  762. package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +18 -0
  763. package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +53 -0
  764. package/lib/types/es6/Core/grid/util/PercentBar.d.ts +43 -0
  765. package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +41 -0
  766. package/lib/types/es6/Core/grid/util/RangeBar.d.ts +25 -0
  767. package/lib/types/es6/Core/grid/util/Reverter.d.ts +14 -0
  768. package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +79 -0
  769. package/lib/types/es6/Core/grid/util/SelectionList.d.ts +50 -0
  770. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +84 -0
  771. package/lib/types/es6/Core/grid/util/Virtualizer.d.ts +40 -0
  772. package/lib/types/es6/Core/grid/util/util.d.ts +18 -0
  773. package/lib/types/es6/Core/index.d.ts +84 -0
  774. package/lib/types/es6/Core/tr-grid-theme.d.ts +5 -0
  775. package/lib/types/es6/DuplexEmeraldDateTimePickerFormatter.d.ts +14 -0
  776. package/lib/types/es6/EFButtonFormatter.d.ts +22 -0
  777. package/lib/types/es6/EFCheckboxFormatter.d.ts +12 -0
  778. package/lib/types/es6/EFComboBoxFormatter.d.ts +23 -0
  779. package/lib/types/es6/EFDateTimePickerFormatter.d.ts +13 -0
  780. package/lib/types/es6/EFIconFormatter.d.ts +23 -0
  781. package/lib/types/es6/EFNumberFieldFormatter.d.ts +12 -0
  782. package/lib/types/es6/EFRadioButtonFormatter.d.ts +22 -0
  783. package/lib/types/es6/EFSelectFormatter.d.ts +23 -0
  784. package/lib/types/es6/EFTextFieldFormatter.d.ts +12 -0
  785. package/lib/types/es6/EFToggleFormatter.d.ts +12 -0
  786. package/lib/types/es6/EmeraldDateTimePickerFormatter.d.ts +13 -0
  787. package/lib/types/es6/ExtensionColumnOptions.d.ts +41 -0
  788. package/lib/types/es6/ExtensionOptions.d.ts +52 -0
  789. package/lib/types/es6/Extensions.d.ts +61 -0
  790. package/lib/types/es6/FilterInput.d.ts +57 -0
  791. package/lib/types/es6/FormatterBuilder.d.ts +22 -0
  792. package/lib/types/es6/GridFormatter.d.ts +63 -0
  793. package/lib/types/es6/HeatMap.d.ts +44 -0
  794. package/lib/types/es6/InCellEditing.d.ts +129 -0
  795. package/lib/types/es6/MenuEventAPI.d.ts +22 -0
  796. package/lib/types/es6/MenuItem.d.ts +39 -0
  797. package/lib/types/es6/NumericInputFormatter.d.ts +13 -0
  798. package/lib/types/es6/Pagination.d.ts +57 -0
  799. package/lib/types/es6/PercentBar.d.ts +60 -0
  800. package/lib/types/es6/PercentBarFormatter.d.ts +25 -0
  801. package/lib/types/es6/PopupMenu.d.ts +29 -0
  802. package/lib/types/es6/RangeBar.d.ts +39 -0
  803. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +143 -0
  804. package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +37 -0
  805. package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +20 -0
  806. package/lib/types/es6/RealtimeGrid/Grid.d.ts +263 -0
  807. package/lib/types/es6/RealtimeGrid/PredefinedFormula.d.ts +16 -0
  808. package/lib/types/es6/RealtimeGrid/ReferenceCounter.d.ts +38 -0
  809. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +120 -0
  810. package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +21 -0
  811. package/lib/types/es6/RealtimeGrid/StyleLoader.d.ts +17 -0
  812. package/lib/types/es6/RealtimeGrid/index.d.ts +8 -0
  813. package/lib/types/es6/RowColoring.d.ts +60 -0
  814. package/lib/types/es6/RowDragging.d.ts +53 -0
  815. package/lib/types/es6/RowFiltering.d.ts +118 -0
  816. package/lib/types/es6/RowGrouping.d.ts +109 -0
  817. package/lib/types/es6/RowSegmenting.d.ts +83 -0
  818. package/lib/types/es6/RowSelection.d.ts +74 -0
  819. package/lib/types/es6/SimpleImageFormatter.d.ts +21 -0
  820. package/lib/types/es6/SimpleInputFormatter.d.ts +12 -0
  821. package/lib/types/es6/SimpleLinkFormatter.d.ts +21 -0
  822. package/lib/types/es6/SimpleTickerFormatter.d.ts +25 -0
  823. package/lib/types/es6/SimpleToggleFormatter.d.ts +22 -0
  824. package/lib/types/es6/StatisticsRow.d.ts +67 -0
  825. package/lib/types/es6/TextFormatter.d.ts +12 -0
  826. package/lib/types/es6/TextFormatting.d.ts +77 -0
  827. package/lib/types/es6/TitleWrap.d.ts +29 -0
  828. package/lib/types/es6/Zoom.d.ts +51 -0
  829. package/lib/types/es6/index.d.ts +76 -0
  830. package/lib/types/index.d.ts +1 -0
  831. package/lib/versions.json +36 -0
  832. package/lib/window-exporter.js +13 -0
  833. package/lib/zoom/es6/Zoom.d.ts +51 -0
  834. package/lib/zoom/es6/Zoom.js +419 -0
  835. package/lib/zoom/es6/index.d.ts +1 -0
  836. package/lib/zoom/es6/index.js +1 -0
  837. package/package.json +42 -0
@@ -0,0 +1,4939 @@
1
+ /* eslint-disable */
2
+ import Ext from "../../../tr-grid-util/es6/Ext.js";
3
+ import ElementWrapper from "./components/ElementWrapper.js";
4
+ import ILayoutGrid from "./ILayoutGrid.js";
5
+ import LayoutGrid from "./LayoutGrid.js";
6
+ import DataTable from "../data/DataTable.js";
7
+ import DataView from "../data/DataView.js";
8
+ import Util from "./util/util.js";
9
+ import SectionSettings from "./util/SectionSettings.js";
10
+ import Virtualizer from "./util/Virtualizer.js";
11
+ import Conflator from "./util/Conflator.js";
12
+ import TrackLayout from "./util/TrackLayout.js";
13
+ import HScrollbar from "./components/HScrollbar.js";
14
+ import VScrollbar from "./components/VScrollbar.js";
15
+ import VirtualizedLayoutGrid from "./VirtualizedLayoutGrid.js";
16
+ /* eslint-enable */
17
+
18
+ //#region Events
19
+ /** @event Core#sectionAdded */
20
+ /** @event Core#columnAdded */
21
+ /** @event Core#columnRemoved */
22
+ /** @event Core#columnVisibilityChanged */
23
+ /** @event Core#columnAlignmentChanged */
24
+ /** @event Core#widthChanged */
25
+ /** @event Core#dataSourceChanged */
26
+ /** @event Core#rowExpansionBinding
27
+ * @description Trigger after column data binding. Fires for all rows within the view.
28
+ * @property {Object.<string, *>} originalRowData
29
+ * @property {string} originalRowId The row that rowExpansion belongs to
30
+ * @property {boolean} rowExpansion
31
+ * @property {string} rowId
32
+ * @property {number} rowIndex
33
+ */
34
+ /** @event Core#postSectionDataBinding */
35
+ /** @event Core#rowHighlighted */
36
+
37
+ /** @event Core#rowAdded
38
+ * @ignore
39
+ */
40
+ /** @event Core#postDataSourceChanged
41
+ * @ignore
42
+ */
43
+ /** @event Core#preSectionRender
44
+ * @ignore
45
+ */
46
+ /** @event Core#preSectionDataBinding
47
+ * @ignore
48
+ */
49
+ /** @event Core#preForcedUpdate
50
+ * @ignore
51
+ */
52
+ //#endregion Events
53
+
54
+ /** @constructor
55
+ * @param {Element=} opt_initializer this can be either element id (string) or DOM element.
56
+ * @extends {ElementWrapper}
57
+ */
58
+ var Core = function (opt_initializer) {
59
+ if (!Core._sectionType) { // Initialize static variables
60
+ Core._sectionType = {};
61
+ Core._sectionType["title"] = true;
62
+ Core._sectionType["header"] = true;
63
+ Core._sectionType["content"] = true;
64
+ Core._sectionType["footer"] = true;
65
+ }
66
+
67
+ var _t = this;
68
+
69
+ // Initialize method binding
70
+ _t._onMouseMove = _t._onMouseMove.bind(_t);
71
+ _t._onRowHightlighted = _t._onRowHightlighted.bind(_t);
72
+
73
+ _t._onWindowResize = _t._onWindowResize.bind(_t);
74
+ _t._onSectionDataChanged = _t._onSectionDataChanged.bind(_t);
75
+ _t._onRowCountChanged = _t._onRowCountChanged.bind(_t);
76
+ _t._onRowHeightChanged = _t._onRowHeightChanged.bind(_t);
77
+ _t._onRowAvailable = _t._onRowAvailable.bind(_t);
78
+
79
+ _t._onVScroll = _t._onVScroll.bind(_t);
80
+ _t._onHScroll = _t._onHScroll.bind(_t);
81
+ _t._onSyncVScroll = _t._onSyncVScroll.bind(_t);
82
+ _t.updateLayout = _t.updateLayout.bind(_t);
83
+ _t._onRowRefresh = _t._onRowRefresh.bind(_t);
84
+ _t._onVScrollEnabled = _t._onVScrollEnabled.bind(_t);
85
+ _t._onVScrollDisabled = _t._onVScrollDisabled.bind(_t);
86
+
87
+ _t._onRowInViewChanged = _t._onRowInViewChanged.bind(_t);
88
+ _t._onColInViewChanged = _t._onColInViewChanged.bind(_t);
89
+
90
+ _t._updateVScrollbar = _t._updateVScrollbar.bind(_t);
91
+
92
+ // Text nodes are unintentionally getting in the tag.
93
+ if(opt_initializer) { // Any node other than element node is not allowed within the tag.
94
+ for(var i = opt_initializer.childNodes.length; --i >= 0;) {
95
+ if(!Util.isElement(opt_initializer.childNodes[i])) {
96
+ opt_initializer.removeChild(opt_initializer.childNodes[i]);
97
+ }
98
+ }
99
+ }
100
+
101
+ // Initialize members
102
+ _t._element = opt_initializer ? opt_initializer : document.createElement("div");
103
+ _t._element.classList.add("tr-grid");
104
+
105
+ _t._layoutX = new TrackLayout();
106
+ _t._layoutY = new TrackLayout();
107
+ _t._layoutX.setDefaultLaneSize(100); //Default column width
108
+ _t._layoutY.setDefaultLaneSize(32); //Default row height
109
+
110
+ _t._settings = [];
111
+ _t._plugins = {};
112
+ _t._columnDefs = [];
113
+ _t._sectionStarts = [];
114
+ _t._rowHeightException = "title";
115
+
116
+ _t._rowVirtualizer = new Virtualizer(_t._layoutY);
117
+ _t._rowVirtualizer.deactivate();
118
+ _t._rowVirtualizer.setViewSize(360); // Minimum view size
119
+
120
+ _t._colVirtualizer = new Virtualizer(_t._layoutX);
121
+ _t._colVirtualizer.enable(false);
122
+ _t._colVirtualizer.deactivate();
123
+ _t._colVirtualizer.setViewSize(400); // Minimum view size
124
+
125
+ // Initialize vertical scrollbar
126
+ _t._vscrollbar = new VScrollbar();
127
+ _t._vscrollbar.disable();
128
+ _t._vscrollbar.setParent(this.getParent() || this.getElement());
129
+
130
+ _t._vscrollbar.listen("scroll", _t._onVScroll);
131
+ _t._vscrollbar.listen("layoutChanged", _t._onVScroll);
132
+ _t._vscrollbar.listen("activated", _t.updateLayout); // TODO: remove column virtualization logic
133
+ _t._vscrollbar.listen("deactivated", _t.updateLayout); // TODO: remove column virtualization logic
134
+ _t._vscrollbar.listen("thicknessChanged", _t.updateLayout); // TODO: remove column virtualization logic
135
+ _t._vscrollbar.listen("enabled", _t._onVScrollEnabled);
136
+ _t._vscrollbar.listen("disabled", _t._onVScrollDisabled);
137
+
138
+ // Initialize horizontal scrollbars
139
+ _t._hscrollbar = new HScrollbar();
140
+ _t._hscrollbar.disable();
141
+ _t._hscrollbar.setParent(this.getParent() || this.getElement());
142
+
143
+ _t._hscrollbar.listen("scroll", this._onHScroll);
144
+ _t._hscrollbar.listen("layoutChanged", this._onHScroll);
145
+ _t._hscrollbar.listen("activated", this.updateLayout);
146
+ _t._hscrollbar.listen("deactivated", this.updateLayout);
147
+
148
+ // cross-reference scrollbars
149
+ _t._hscrollbar.setOtherScrollbar(_t._vscrollbar);
150
+ _t._vscrollbar.setOtherScrollbar(_t._hscrollbar);
151
+
152
+ if (Util.isMobile) {
153
+ _t._element.addEventListener("touchmove", this._onMouseMove, false);
154
+ } else {
155
+ _t._element.addEventListener("mousemove", this._onMouseMove, false);
156
+ }
157
+ window.addEventListener("resize", _t._onWindowResize, false); // Should be unlistened after destroyed
158
+ _t._rowVirtualizer.listen("indexChanged", _t._onRowInViewChanged);
159
+ _t._colVirtualizer.listen("indexChanged", _t._onColInViewChanged);
160
+ _t._rowHeightConflator = new Conflator(_t._onRowHeightChanged, 50);
161
+ _t._vScrollbarConflator = new Conflator(_t._updateVScrollbar, 200);
162
+
163
+ // Initialize events for external users
164
+ _t._addEvents(
165
+ "sectionAdded",
166
+ "columnAdded",
167
+ "columnRemoved",
168
+ "columnMoved",
169
+ "columnVisibilityChanged",
170
+ "columnAlignmentChanged",
171
+ "widthChanged",
172
+ "dataSourceChanged",
173
+ "postDataSourceChanged",
174
+ "preSectionRender",
175
+ "postSectionRender",
176
+ "preSectionDataBinding",
177
+ "postSectionDataBinding",
178
+ "rowExpansionBinding",
179
+ "rowHighlighted",
180
+ "preForcedUpdate",
181
+ "rowAdded",
182
+ "rowRemoved"
183
+ );
184
+
185
+ // For debugging in advanced optimization mode
186
+ var map = Core["map"];
187
+ if(!map) {
188
+ map = {};
189
+ Core["map"] = map;
190
+ }
191
+ var elem = _t._element;
192
+ elem["_control"] = _t;
193
+ var id = elem.id || elem.name;
194
+ if(!id || map[id]) {
195
+ id = "_grid" + Core._runningGridId;
196
+ }
197
+ _t["_id"] = id;
198
+ map[id] = _t;
199
+ Core._runningGridId++;
200
+
201
+ // init hiddenInput for retrieve copy and cut event
202
+ var hiddenInput = document.createElement('input');
203
+ hiddenInput.style.position = 'absolute';
204
+ hiddenInput.style.width = '0';
205
+ hiddenInput.style.height = '0';
206
+ hiddenInput.style.padding = '0';
207
+ hiddenInput.style.border = '0';
208
+ hiddenInput.value = '0';
209
+ _t._hiddenInput = hiddenInput;
210
+ elem.insertBefore(hiddenInput, elem.firstChild);
211
+
212
+ // Ensure all affected plugins are loaded prior zoom plugin
213
+ // use as entity to trigger updateLayout once zoom is changed
214
+ Object.defineProperty(_t, "zoomFactor", {
215
+ set: function(factor) {
216
+ if(!factor || factor < 0) {
217
+ return; // Cannot have negative factor or factor of zero
218
+ }
219
+ if(this._zoomFactor !== factor) {
220
+ this._zoomFactor = factor;
221
+ // Panes and view port are affected and need to be updated
222
+ _t._updateLayout(); // Super slow. Do not execute this so often
223
+ }
224
+ },
225
+ get: function() {
226
+ return this._zoomFactor;
227
+ }
228
+ });
229
+ };
230
+ Ext.inherits(Core, ElementWrapper);
231
+
232
+ /** @typedef {number|string|ILayoutGrid|SectionSettings} Core~SectionReference
233
+ * @description A section in core grid can be refered by the following object <br>
234
+ * `{@link ILayoutGrid}` : A pointer to Section instance <br>
235
+ * `{@link SectionSettings}` : A pointer to SectionSettings instance <br>
236
+ * `number` : Section index <br>
237
+ * `string` : Section type (e.g. "content", "title", "header", "footer"), or Section id (element id)
238
+ */
239
+ Core.SectionReference;
240
+
241
+ /** @typedef {Object} Core~MouseInfo
242
+ * @description Object returned from Core#getRelativePosition method
243
+ * @property {boolean} hit - Indicates whether the given position is on the grid
244
+ * @property {number} x - Horizontal coordinate that is relative to the top-left of the grid (Zero means left-most)
245
+ * @property {number} y - Vertical coordinate that is relative to the top-left of the grid (Zero means top-most)
246
+ * @property {number} colIndex
247
+ * @property {number} sectionIndex
248
+ * @property {number} rowIndex
249
+ * @property {string} sectionType
250
+ * @property {SectionSettings} sectionSettings
251
+ * @property {ILayoutGrid} section
252
+ * @property {Element} cellElement
253
+ * @property {DataView} dataSource
254
+ */
255
+ Core.MouseInfo;
256
+
257
+ /** @typedef {Core.MouseInfo|ElementWrapper|Element} Core~CellReference
258
+ * @description A section in core grid can be refered by the following object <br>
259
+ * `{Core.MouseInfo}` : Object with valid x, y coordinates and section index <br>
260
+ * `{@link ElementWrapper}` : a pointer to ElementWrapper instance <br>
261
+ * `Element` : cell element
262
+ */
263
+ Core.CellReference;
264
+
265
+ /** @typedef {Object} Core~ColumnOptions
266
+ * @description Column options that can be provided to {@link Core#insertColumn}
267
+ * @property {number=} width Column width
268
+ * @property {number=} minWidth Minimum column width
269
+ * @property {number=} minSize Alias to `minWidth`
270
+ * @property {number=} size Alias to `width`
271
+ * @property {boolean=} visible Column visibility
272
+ * @property {boolean=} scalable Column scalability
273
+ * @property {Object.<string, string>=} styles Key/value pair object specifying CSS styles
274
+ * @property {Object.<string, string>=} classes Key/value pair object specifying CSS classes
275
+ * @property {string=} dataColumnName Data column for sorting
276
+ * @property {Function=} renderingHandler - Deprecated
277
+ * @property {Function=} dataBindingHandler Column binding function
278
+ * @property {string=} columnData For attaching context (user data)
279
+ * @property {TrackLayout=} layout - Deprecated
280
+ */
281
+ Core.ColumnOptions;
282
+
283
+ /** For runtime debugging!
284
+ * @type {number}
285
+ * @private
286
+ */
287
+ Core._runningGridId = 0; // Static variable
288
+ /** For identifying column
289
+ * @type {number}
290
+ * @private
291
+ */
292
+ Core._runningColumnId = 0; // Static variable
293
+
294
+ /** @type {!Object.<string, boolean>}
295
+ * @private
296
+ * @const
297
+ */
298
+ Core._sectionType; // Static variable
299
+
300
+ /** @type {!Object.<string, *>}
301
+ * @private
302
+ */
303
+ Core.prototype._plugins;
304
+ /** @type {DataView}
305
+ * @private
306
+ */
307
+ Core.prototype._dataSource = null;
308
+
309
+ /** @type {!TrackLayout}
310
+ * @private
311
+ */
312
+ Core.prototype._layoutX;
313
+ /** @type {!TrackLayout}
314
+ * @private
315
+ */
316
+ Core.prototype._layoutY;
317
+ /** @type {!VScrollbar}
318
+ * @private
319
+ */
320
+ Core.prototype._vscrollbar; // vertical scrollbar is non-nullable
321
+ /** @type {!HScrollbar}
322
+ * @private
323
+ */
324
+ Core.prototype._hscrollbar; // horizontal scrollbar is non-nullable
325
+
326
+
327
+ /** reference of top frozen section. It's a temporaly use between function _freezeTopSectionAt and _onSectionCountChanged
328
+ * @type {string}
329
+ * @private
330
+ */
331
+ Core.prototype._tempFrozenSectionRef = "";
332
+ /** first index of section that vertical scroll placed, negative value mean no vertical scroll
333
+ * @type {number}
334
+ * @private
335
+ */
336
+ Core.prototype._startVScrollbarIndex = -1;
337
+ /** @type {number}
338
+ * @private
339
+ */
340
+ Core.prototype._startHScrollbarIndex = 0;
341
+ /** @type {number}
342
+ * @private
343
+ */
344
+ Core.prototype._pinnedRightColumnCount = 0;
345
+ /** number of footer that being freeze right now
346
+ * @type {number}
347
+ * @private
348
+ */
349
+ Core.prototype._frozenFooterCount = 0;
350
+ /** If true, the number of frozen top sections will not be changed automatically
351
+ * @type {boolean}
352
+ * @private
353
+ */
354
+ Core.prototype._fixFrozenTopSections = false;
355
+ /** If true, the number of frozen bottom sections will not be changed automatically
356
+ * @type {boolean}
357
+ * @private
358
+ */
359
+ Core.prototype._fixFrozenBottomSection = false;
360
+ /** cumulative row indices
361
+ * @type {Array.<number>}
362
+ * @private
363
+ */
364
+ Core.prototype._sectionStarts;
365
+
366
+ /** @type {!Array.<SectionSettings>}
367
+ * @private
368
+ */
369
+ Core.prototype._settings;
370
+ /** @type {SectionSettings}
371
+ * @private
372
+ */
373
+ Core.prototype._firstSettings;
374
+ /** @type {SectionSettings}
375
+ * @private
376
+ */
377
+ Core.prototype._lastSettings;
378
+
379
+ /** @type {boolean}
380
+ * @private
381
+ */
382
+ Core.prototype._fitContentWidth = false;
383
+
384
+ /** @type {!Array.<Object.<string, *>>}
385
+ * @private
386
+ */
387
+ Core.prototype._columnDefs;
388
+
389
+ /** @type {!Virtualizer}
390
+ * @private
391
+ */
392
+ Core.prototype._rowVirtualizer;
393
+ /** @type {!Virtualizer}
394
+ * @private
395
+ */
396
+ Core.prototype._colVirtualizer;
397
+
398
+ /** when set datasource without loading DataSourceTreePlugin, this datasource is used for every section.
399
+ * @type {boolean}
400
+ * @private
401
+ */
402
+ Core.prototype._autoSetDataSource = true;
403
+
404
+ /** @type {Function}
405
+ * @private
406
+ */
407
+ Core.prototype._renderingHandler = null;
408
+ /** @type {Function}
409
+ * @private
410
+ */
411
+ Core.prototype._dataBindingHandler = null;
412
+
413
+ /** @type {boolean}
414
+ * @private
415
+ */
416
+ Core.prototype._frozenLayout = false;
417
+ /** @type {boolean}
418
+ * @private
419
+ */
420
+ Core.prototype._noBinding = false;
421
+ /** @type {boolean}
422
+ * @private
423
+ */
424
+ Core.prototype._rowHeightSync = true;
425
+ /** @type {boolean}
426
+ * @private
427
+ */
428
+ Core.prototype._rowHighlighting = false;
429
+ /** @type {boolean}
430
+ * @private
431
+ */
432
+ Core.prototype._dispatchingDataChanged = false;
433
+
434
+ /** @type {string}
435
+ * @private
436
+ */
437
+ Core.prototype._rowHeightException = "";
438
+ /** @type {number}
439
+ * @private
440
+ */
441
+ Core.prototype._rowScrollingStep = 0;
442
+ /** @type {number}
443
+ * @private
444
+ */
445
+ Core.prototype._zoomFactor = 1;
446
+ /** @type {number}
447
+ * @private
448
+ */
449
+ Core.prototype._reservedSpace = 0;
450
+
451
+ /** @type {string}
452
+ * @private
453
+ */
454
+ Core.prototype._hidingMethod = "";
455
+ /** @type {Conflator}
456
+ * @private
457
+ */
458
+ Core.prototype._rowHeightConflator = null;
459
+ /** @type {number}
460
+ * @private
461
+ */
462
+ Core.prototype._rowRefreshTimer = 0;
463
+ /** @type {boolean}
464
+ * @private
465
+ */
466
+ Core.prototype._layoutUpdating = false;
467
+ /** A Hidden input that allow to get cut and copy event when user perform cut, copy activities
468
+ * @type {Element}
469
+ * @private
470
+ */
471
+ Core.prototype._hiddenInput;
472
+ /** @type {number}
473
+ * @private
474
+ */
475
+ Core.prototype._bottomPadding = 6;
476
+ /** @type {ILayoutGrid}
477
+ * @private
478
+ */
479
+ Core.prototype._bottomPaddingSect = null;
480
+ /** @type {boolean}
481
+ * @private
482
+ */
483
+ Core.prototype._preserveProportion = false;
484
+ /** @type {boolean}
485
+ * @private
486
+ */
487
+ Core.prototype._preserveGridSize = false;
488
+ //#region Public Methods
489
+
490
+ /**
491
+ * @public
492
+ * @return {string}
493
+ */
494
+ Core.getVersion = function () {
495
+ return "5.0.38";
496
+ };
497
+ /** {@link ElementWrapper#dispose}
498
+ * @override
499
+ */
500
+ Core.prototype.dispose = function () {
501
+ var internalId = this["_id"];
502
+ var map = Core["map"];
503
+ if (map[internalId]) {
504
+ map[internalId] = null;
505
+ } else {
506
+ console.log("WARNING: Core grid is disposed twice");
507
+ return;
508
+ }
509
+ this._disposed = true;
510
+ if(this._rowRefreshTimer) {
511
+ clearTimeout(this._rowRefreshTimer);
512
+ this._rowRefreshTimer = 0;
513
+ }
514
+
515
+ // Clear all events
516
+ this.unlistenAll();
517
+ window.removeEventListener("resize", this._onWindowResize, false);
518
+
519
+ for (var i = this._columnDefs.length; --i >= 0; ) {
520
+ var colDef = this._getColumnDef(i);
521
+ colDef["renderingHandler"] = colDef["dataBindingHandler"] = null;
522
+ }
523
+ for (var key in this._plugins) {
524
+ var plugin = this._plugins[key];
525
+ if (plugin["unload"]) {
526
+ plugin["unload"](this);
527
+ }
528
+ }
529
+
530
+ // Clear all Elements
531
+ this.removeAllSections(); // Remove all Sections and LayoutGrids
532
+ var mainScrolbar = this._vscrollbar._mainScrollbar;
533
+ if(mainScrolbar) {
534
+ mainScrolbar.unlisten("scroll", this._onSyncVScroll);
535
+ this._vscrollbar._mainScrollbar = null;
536
+ }
537
+ this._vscrollbar.dispose();
538
+ this._hscrollbar.dispose();
539
+ this._rowHeightConflator.dispose();
540
+
541
+ // Clean Top node
542
+ var elem = this._element;
543
+ if (elem !== null) {
544
+ if (elem["_control"]) {
545
+ delete elem["_control"];
546
+ }
547
+ elem.removeChild(this._hiddenInput);
548
+ }
549
+ this._dispose();
550
+
551
+ this._columnDefs.length = 0;
552
+ delete this._plugins;
553
+ };
554
+ /** Indicates if the object has been disposed or not
555
+ * @public
556
+ * @return {boolean}
557
+ */
558
+ Core.prototype.isDisposed = function () {
559
+ return this._disposed;
560
+ };
561
+
562
+ /** {@link ElementWrapper#setParent}
563
+ * @override
564
+ */
565
+ Core.prototype.setParent = function (obj, opt_prepend) {
566
+ this._setParent(obj, opt_prepend);
567
+ this._onParentChange();
568
+ };
569
+ /** {@link ElementWrapper#insertBefore}
570
+ * @override
571
+ */
572
+ Core.prototype.insertBefore = function (obj) {
573
+ this._insertBefore(obj);
574
+ this._onParentChange();
575
+ };
576
+ /** @private */
577
+ Core.prototype._onParentChange = function () {
578
+ var newParent = this.getParent() || this.getElement();
579
+ if(!this._vscrollbar._mainScrollbar) { // HACK
580
+ this._vscrollbar.setParent(newParent);
581
+ }
582
+ this._hscrollbar.setParent(newParent);
583
+
584
+ this._updateLayout();
585
+ };
586
+
587
+ /** @public
588
+ * @param {Object=} gridOptions
589
+ * @return {!Object}
590
+ */
591
+ Core.prototype.getConfigObject = function (gridOptions) {
592
+ var obj = gridOptions || {};
593
+
594
+ var columnCount = this.getColumnCount();
595
+ if (!obj["columns"]) {
596
+ obj["columns"] = [];
597
+ }
598
+
599
+ for (var colIndex = 0; colIndex < columnCount; colIndex++) {
600
+ var column = obj["columns"][colIndex];
601
+ if (!column) {
602
+ column = obj["columns"][colIndex] = {};
603
+ }
604
+
605
+ var columnDef = this._getColumnDef(colIndex);
606
+ if (columnDef["styles"]) {
607
+ column["styles"] = columnDef["styles"];
608
+ }
609
+ if (columnDef["stationary"] != null) {
610
+ column["stationary"] = columnDef["stationary"];
611
+ }
612
+ }
613
+
614
+ if(this._rowHighlighting) {
615
+ obj["rowHighlighting"] = true;
616
+ }
617
+ if(this._pinnedRightColumnCount) {
618
+ obj["pinnedRightColumns"] = this._pinnedRightColumnCount;
619
+ }
620
+ obj["columnVirtualization"] = this._colVirtualizer.isEnabled();
621
+
622
+ if(this._fixFrozenTopSections) {
623
+ obj["topFreezingCount"] = this._startVScrollbarIndex >= 0 ? (this._startVScrollbarIndex + 1) : false;
624
+ }
625
+ if(this._fixFrozenBottomSection) {
626
+ obj["bottomFreezingCount"] = this._frozenFooterCount;
627
+ }
628
+
629
+
630
+ if(this._rowScrollingStep) {
631
+ obj["stepScroll"] = (this._rowScrollingStep === 1) ? true : this._rowScrollingStep;
632
+ }
633
+ obj["autoHideScrollbar"] = this._vscrollbar.getAutoHide(); // this._hscrollbar has the same settings
634
+ var wheelSpeed = this._vscrollbar.getMouseWheelSpeed();
635
+ if(wheelSpeed) {
636
+ obj["linearWheelScrolling"] = wheelSpeed;
637
+ }
638
+
639
+ if(this.hasClass("no-borders")) {
640
+ obj["borders"] = false;
641
+ }
642
+ if(this.hasClass("no-gridlines")) {
643
+ obj["gridlines"] = false;
644
+ }
645
+ if(this.hasClass("no-vertical-grid-line")) {
646
+ obj["verticalLines"] = false;
647
+ }
648
+ if(this.hasClass("no-horizontal-grid-line")) {
649
+ obj["horizontalLines"] = false;
650
+ }
651
+ if(this._bottomPaddingSect) {
652
+ obj["contentBottomPadding"] = this._bottomPadding;
653
+ }
654
+ if(this._reservedSpace > 0) {
655
+ obj["contentRightPadding"] = this._reservedSpace;
656
+ }
657
+
658
+ var conflationRate = this.getDataConflationRate();
659
+ if (conflationRate) {
660
+ obj["dataConflationRate"] = conflationRate;
661
+ }
662
+
663
+ for(var key in this._plugins) {
664
+ var pluginInstance = this._plugins[key];
665
+ if(typeof pluginInstance["getConfigObject"] === "function") {
666
+ pluginInstance["getConfigObject"](obj);
667
+ }
668
+ }
669
+
670
+ return obj;
671
+ };
672
+
673
+ /** {@link ElementWrapper#fillParentWidth}
674
+ * @override
675
+ */
676
+ Core.prototype.fillParentWidth = function(pct) {
677
+ if(this._fitContentWidth) { return false; }
678
+ if(this._layoutX.isFixedSize()) { return false; }
679
+
680
+ // uses getBoundingClientRect() instead of clientWidth to prevents
681
+ // fraction error occured on Chrome (Windows 10) which make clientWidth
682
+ // exceeds expected value by 1px and will cause incorrect scrollbar active frag
683
+ var el = this._element;
684
+ var px = (el.getBoundingClientRect().width | 0) - el.clientLeft;
685
+ var changes = this._layoutX.setTrackSize(px, this._reservedSpace);
686
+ return changes !== null;
687
+ };
688
+ /** {@link ElementWrapper#show}
689
+ * @override
690
+ */
691
+ Core.prototype.show = function (opt_shown) {
692
+ this._element.style.display = (opt_shown !== false) ? "" : "none";
693
+ if (opt_shown !== false) {
694
+ this.updateLayout();
695
+ }
696
+ };
697
+ /** @public
698
+ * @return {number}
699
+ */
700
+ Core.prototype.getContentWidth = function() {
701
+ return this._layoutX.getTrackSize();
702
+ };
703
+
704
+ /** @public
705
+ * @return {number}
706
+ */
707
+ Core.prototype.getSectionCount = function() {
708
+ return this._settings.length;
709
+ };
710
+
711
+ /** @private */
712
+ Core.prototype._updateFrozenTopSections = function () {
713
+ if (!this._fixFrozenTopSections) {
714
+ var topCount = this._getTopSectionCount();
715
+ this._freezeTopSectionAt(topCount - 1);
716
+ }
717
+ };
718
+
719
+ /** @private */
720
+ Core.prototype._updateFrozenBottomSections = function () {
721
+ if (!this._fixFrozenBottomSection) {
722
+ var bottomCount = this._getBottomSectionCount();
723
+ this._setFrozenFooter(bottomCount);
724
+ }
725
+ };
726
+
727
+ /** @private
728
+ * @return {number}
729
+ */
730
+ Core.prototype._getTopSectionCount = function () {
731
+ var sectionSettings = this._settings;
732
+ var length = sectionSettings.length;
733
+ var count = 0;
734
+ for (var i = 0; i < length; i++) {
735
+ var type = sectionSettings[i].getType();
736
+ if (type === "header" || type === "title") {
737
+ count++;
738
+ } else {
739
+ break;
740
+ }
741
+ }
742
+ return count;
743
+ };
744
+
745
+ /** @private
746
+ * @return {number}
747
+ */
748
+ Core.prototype._getBottomSectionCount = function () {
749
+ var sectionSettings = this._settings;
750
+ var length = sectionSettings.length;
751
+ var count = 0;
752
+ for (var i = length - 1; i >= 0; i--) {
753
+ var type = sectionSettings[i].getType();
754
+ if (type === "footer") {
755
+ count++;
756
+ } else {
757
+ break;
758
+ }
759
+ }
760
+ return count;
761
+ };
762
+
763
+ /** @public
764
+ * @param {string=} opt_type
765
+ * @param {string=} opt_sectionName
766
+ * @return {ILayoutGrid|null}
767
+ */
768
+ Core.prototype.addSection = function (opt_type, opt_sectionName) {
769
+ return this.addSectionAt(this.getSectionCount(), opt_type, opt_sectionName);
770
+ };
771
+ /** @public
772
+ * @param {number} at
773
+ * @param {string=} opt_type
774
+ * @param {string=} opt_sectionName
775
+ * @return {ILayoutGrid|null}
776
+ * @fires Core#sectionAdded
777
+ */
778
+ Core.prototype.addSectionAt = function (at, opt_type, opt_sectionName) {
779
+ var sectionCount = this._settings.length;
780
+ if (at < 0) { at = 0; }
781
+ if (at > sectionCount) { at = sectionCount; }
782
+
783
+ var sectType = this._toSectionType(opt_type);
784
+ var isBottomPadding = (opt_sectionName === "bottomPadding");
785
+ var sectionSettings = this._newSection(
786
+ isBottomPadding ? "footer" : sectType, // Always use footer as a setup for bottom padding section
787
+ opt_sectionName
788
+ );
789
+ if(!sectionSettings){ return null; }
790
+
791
+ var section = sectionSettings.getSection();
792
+ if(isBottomPadding) {
793
+ sectionSettings.setAutoSyncRowCount(false); // Important
794
+ this._bottomPaddingSect = section;
795
+ }
796
+
797
+ if (at >= sectionCount) {
798
+ this._putToLast(section);
799
+ this._settings.push(sectionSettings);
800
+ } else {
801
+ this._settings.splice(at, 0, sectionSettings);
802
+ section.insertBefore(this._settings[at + 1].getSection());
803
+ }
804
+
805
+ this._updateSectionIndices(at);
806
+
807
+ sectType = sectionSettings.getType();
808
+ if (sectType === "footer") {
809
+ this._updateFrozenBottomSections();
810
+ } else if (sectType === "header" || sectType === "title") {
811
+ this._updateFrozenTopSections();
812
+ }
813
+
814
+ this._onColumnCountChanged(); // When a new section is added, new columns are also added
815
+ this._onSectionCountChanged(true);
816
+
817
+ if(this._colVirtualizer.isEnabled()) {
818
+ var activations = this._getColActivationList();
819
+ var colCount = this.getColumnCount();
820
+ sectionSettings.activateColumns(activations, 0, colCount - 1);
821
+ }
822
+
823
+ if (this._hasListener("sectionAdded")) {
824
+ var e = sectionSettings.extendEventArg();
825
+ this._dispatch("sectionAdded", e);
826
+ }
827
+
828
+ return section;
829
+ };
830
+ /** @public
831
+ * @param {Core.SectionReference} sectionRef
832
+ * @return {ILayoutGrid}
833
+ */
834
+ Core.prototype.removeSection = function(sectionRef) {
835
+ var section = this.getSection(sectionRef);
836
+ if(section !== null) {
837
+ return this.removeSectionAt(section.getIndex());
838
+ }
839
+ return null;
840
+ };
841
+ /** @public
842
+ * @param {number} at
843
+ * @return {ILayoutGrid}
844
+ */
845
+ Core.prototype.removeSectionAt = function (at) {
846
+ var sectionCount = this._settings.length;
847
+ if (at >= 0 && at < sectionCount) {
848
+ var sectionSettings = this._settings[at];
849
+ var removedIndex = sectionSettings.getIndex();
850
+ var section = sectionSettings.getSection();
851
+ var sectionType = sectionSettings.getType();
852
+
853
+ section.setRowCount(0); // Row count changed
854
+ this._settings.splice(at, 1);
855
+
856
+ this._updateSectionIndices(removedIndex);
857
+
858
+ if (sectionType === "footer") {
859
+ this._updateFrozenBottomSections();
860
+ this._onColumnCountChanged(); // Update footer count in hScrollbar
861
+ } else if (sectionType === "header" || sectionType === "title") {
862
+ this._updateFrozenTopSections();
863
+ }
864
+
865
+ this._onSectionCountChanged(); // Update vScrollbar
866
+
867
+ sectionSettings.dispose();
868
+ return section;
869
+ }
870
+ return null;
871
+ };
872
+ /** @public
873
+ * @return {ILayoutGrid}
874
+ */
875
+ Core.prototype.removeLastSection = function() {
876
+ return this.removeSectionAt(this._settings.length - 1);
877
+ };
878
+ /** @public */
879
+ Core.prototype.removeAllSections = function () {
880
+ var len = this._settings.length;
881
+ for (var i = 0; i < len; ++i) {
882
+ var sectionSettings = this._settings[i];
883
+ sectionSettings.dispose();
884
+ }
885
+ this._bottomPaddingSect = null;
886
+ this._firstSettings = this._lastSettings = null;
887
+ this._settings.length = 0;
888
+ this._updateSectionIndices(0);
889
+ this._onSectionCountChanged();
890
+ };
891
+ /** @public
892
+ * @param {boolean|number} paddingSize=6 Add special section at the bottom. If falsy value is specified, the section is removed.
893
+ */
894
+ Core.prototype.setBottomPaddingSection = function (paddingSize) {
895
+ var sect = this._bottomPaddingSect;
896
+ if(paddingSize) {
897
+ if(typeof paddingSize === "number") {
898
+ this._bottomPadding = paddingSize;
899
+ }
900
+ if(!sect) {
901
+ sect = this.addSection("content", "bottomPadding");
902
+ }
903
+ if(sect) {
904
+ sect.setDefaultRowHeight(this._bottomPadding);
905
+ if(!sect.getRowCount()) {
906
+ sect.addRow(1);
907
+ }
908
+ }
909
+ } else if(sect) {
910
+ this.removeSection(sect);
911
+ }
912
+ };
913
+
914
+ /** @private
915
+ * @return {boolean} Returns true if there is any change
916
+ */
917
+ Core.prototype._updatePaddingBottomSect = function () {
918
+ var bps = this._bottomPaddingSect;
919
+ if(bps) { // Always move bottom padding sect to the last
920
+ var sectCount = this._settings.length;
921
+ var last = sectCount - 1;
922
+ if(last > 0) {
923
+ var lastSettings = this._settings[last];
924
+ if(lastSettings.getSection() !== bps) {
925
+ var bpss = null;
926
+ for(var i = last; --i >= 0;) {
927
+ var settings = this._settings[i];
928
+ if(settings.getSection() === bps) {
929
+ bpss = settings;
930
+ break;
931
+ }
932
+ }
933
+ if(i >= 0) {
934
+ this._putToLast(bps);
935
+ this._settings.splice(i, 1);
936
+ this._settings.push(bpss);
937
+ // Blend styling with previous one
938
+ bpss.setType(lastSettings.getType() === "footer" ? "footer" : "content");
939
+ return true;
940
+ } else {
941
+ this._bottomPaddingSect = null; // The settings and section must have been removed
942
+ }
943
+ } else {
944
+ var prevSettings = this._settings[last - 1];
945
+ if(prevSettings) {
946
+ // Blend styling with previous one
947
+ lastSettings.setType(prevSettings.getType() === "footer" ? "footer" : "content");
948
+ }
949
+ }
950
+ }
951
+ }
952
+ return false;
953
+ };
954
+ /** @public
955
+ * @ignore
956
+ * @param {number} from INCLUSIVE
957
+ * @param {number} dest INCLUSIVE
958
+ */
959
+ Core.prototype.moveSection = function (from, dest) {
960
+ var sectionCount = this.getSectionCount();
961
+ if (from < 0) { from = 0; }
962
+ else if (from >= sectionCount) { return; }
963
+ if (dest < 0) { dest = 0; }
964
+ else if (dest >= sectionCount) { dest = sectionCount - 1; }
965
+ if (from === dest) { return; }
966
+
967
+ var fromSettings = this._settings[from];
968
+ var destSettings = this._settings[dest];
969
+ Util.moveArrayItem(this._settings, from, dest);
970
+
971
+ if (destSettings) {
972
+ fromSettings.getSection().insertBefore(destSettings.getSection());
973
+ } else {
974
+ this._putToLast(fromSettings.getSection());
975
+ }
976
+
977
+ this._updateSectionIndices((from <= dest) ? from : dest);
978
+ this._syncRowHeights();
979
+ this._onSectionCountChanged();
980
+ if (!this._frozenLayout) {
981
+ this._rowVirtualizer.update(true); // Force firing of row activation
982
+ }
983
+ };
984
+
985
+ /** @public
986
+ * @param {Core.SectionReference} sectionRef
987
+ * @return {ILayoutGrid}
988
+ */
989
+ Core.prototype.getSection = function (sectionRef) {
990
+ var settings = this.getSectionSettings(sectionRef);
991
+ return (settings !== null) ? settings.getSection() : null;
992
+
993
+ };
994
+ /** @public
995
+ * @param {Core.SectionReference} sectionRef
996
+ * @return {SectionSettings}
997
+ */
998
+ Core.prototype.getSectionSettings = function (sectionRef) {
999
+ if(Util.isString(sectionRef)) {
1000
+ if(Core._sectionType[/** @type{string} */(sectionRef)]) {
1001
+ return this._getNextSection(1, null, /** @type{string} */(sectionRef));
1002
+ }
1003
+ for(var i = this._settings.length; --i >= 0;) {
1004
+ if(this._settings[i].getId() === sectionRef) {
1005
+ return this._settings[i];
1006
+ }
1007
+ }
1008
+ } else {
1009
+ if(sectionRef != null) {
1010
+ var num = -1;
1011
+ if(sectionRef.getIndex != null) {
1012
+ num = /** @type{number} */(sectionRef.getIndex());
1013
+ } else if(Util.isNumber(sectionRef)) {
1014
+ num = /** @type{number} */(sectionRef);
1015
+ }
1016
+ if(num >= 0 && num < this._settings.length) {
1017
+ return this._settings[num];
1018
+ }
1019
+ }
1020
+ }
1021
+ return null;
1022
+ };
1023
+
1024
+ /** @public
1025
+ * @param {string=} opt_type
1026
+ * @return {!Array.<ILayoutGrid>}
1027
+ */
1028
+ Core.prototype.getAllSections = function (opt_type) {
1029
+ if(opt_type == null) { return this._getAllSections(); }
1030
+
1031
+ var list = this.getAllSectionSettings(opt_type);
1032
+ var ary = /** @type{!Array.<ILayoutGrid>} */(list);
1033
+ for (var i = ary.length; --i >= 0; ) {
1034
+ ary[i] = list[i].getSection();
1035
+ }
1036
+ return ary;
1037
+ };
1038
+ /** @public
1039
+ * @param {string=} opt_type
1040
+ * @return {!Array.<SectionSettings>}
1041
+ */
1042
+ Core.prototype.getAllSectionSettings = function (opt_type) {
1043
+ if(!opt_type) {
1044
+ return this._settings; // WARNING: Return internal private member
1045
+ }
1046
+
1047
+ var len = this._settings.length;
1048
+ var ary = [];
1049
+ opt_type = this._toSectionType(opt_type);
1050
+ for (var i = 0; i < len; ++i) {
1051
+ var sectionSettings = this._settings[i];
1052
+ if(opt_type === sectionSettings.getType()) {
1053
+ ary.push(sectionSettings);
1054
+ }
1055
+ }
1056
+ return ary;
1057
+ };
1058
+
1059
+ /** @public
1060
+ * @param {(MouseEvent|Core.SectionReference)=} identifier This can be MouseEvent, index, or section id or pointer reference
1061
+ * @return {number} Return negative value, if the section does not exist
1062
+ */
1063
+ Core.prototype.getSectionIndex = function(identifier) {
1064
+ if(Util.isNumber(identifier)) {
1065
+ return /** @type{number} */(identifier);
1066
+ }
1067
+
1068
+ if(identifier instanceof MouseEvent) {
1069
+ var mPos = Util.getRelativePosition(/** @type{MouseEvent} */(identifier), this._element);
1070
+ var obj = {};
1071
+ this._hitTestY(mPos["y"], obj); // TODO: This will not work with zoom feature
1072
+ return obj["sectionIndex"];
1073
+ }
1074
+
1075
+ var section = this.getSection(/** @type{string} */(identifier));
1076
+ if(section == null) { return -1; }
1077
+
1078
+ return section.getIndex();
1079
+ };
1080
+ /** @public
1081
+ * @param {Core.SectionReference} sectionRef
1082
+ * @return {number} Return zero, if identifier does not exist
1083
+ */
1084
+ Core.prototype.getSectionTop = function (sectionRef) {
1085
+ var section = this.getSection(sectionRef);
1086
+ if (section == null) { return 0; }
1087
+ var top = this._layoutY.getLaneStart(section.getRowOffset());
1088
+
1089
+ if (this._startVScrollbarIndex >= 0 && section.getIndex() >= this._startVScrollbarIndex) {
1090
+ top -= this._vscrollbar.getScrollTop();
1091
+ }
1092
+ return top;
1093
+ };
1094
+
1095
+ /** @public
1096
+ * @param {(MouseEvent|Core.SectionReference)=} identifier This can be MouseEvent, index, or section id or pointer reference <br>
1097
+ * If not specified, the last item is returned
1098
+ * @param {string=} opt_type The previous section with the specified type. Default is any type
1099
+ * @return {ILayoutGrid}
1100
+ */
1101
+ Core.prototype.getPreviousSection = function (identifier, opt_type) {
1102
+ if(identifier == null) { identifier = this._settings.length; }
1103
+ var s = this._getNextSection(-1, identifier, opt_type);
1104
+ return (s !== null) ? s.getSection() : null;
1105
+ };
1106
+ /** @public
1107
+ * @param {(MouseEvent|Core.SectionReference)=} identifier This can be MouseEvent, index, or section id or pointer reference <br>
1108
+ * If not specified, the first item is returned
1109
+ * @param {string=} opt_type The next section with the specified type. Default is any type
1110
+ * @return {ILayoutGrid}
1111
+ */
1112
+ Core.prototype.getNextSection = function (identifier, opt_type) {
1113
+ var s = this._getNextSection(1, identifier, opt_type);
1114
+ return (s !== null) ? s.getSection() : null;
1115
+ };
1116
+ /** @public
1117
+ * @return {ILayoutGrid}
1118
+ */
1119
+ Core.prototype.getLastSection = function () {
1120
+ return this.getSection(this._settings.length - 1);
1121
+ };
1122
+
1123
+ /** @public
1124
+ * @param {Core.SectionReference} sectionRef
1125
+ * @param {number} colIndex
1126
+ * @param {number} rowIndex
1127
+ * @param {boolean=} opt_includeSpan Default is true
1128
+ * @return {ElementWrapper}
1129
+ */
1130
+ Core.prototype.getCell = function (sectionRef, colIndex, rowIndex, opt_includeSpan) {
1131
+ var s = this.getSection(sectionRef);
1132
+ return (s) ? s.getCell(colIndex, rowIndex, opt_includeSpan) : null;
1133
+ };
1134
+ /** Get information about the cell, inclusing column index, row index, and section that the cell resides
1135
+ * @public
1136
+ * @param {Core.CellReference} cellRef Reference to cell element. This can be something inside the cell as well.
1137
+ * @return {Core.MouseInfo} Information about the given cell
1138
+ * @see {@link Core#getRelativePosition}
1139
+ * @example
1140
+ * core.getCellInfo({"colIndex": 0, "rowIndex": 0}); // Get cell information about the top left cell in the content section
1141
+ * core.getCellInfo(document.createElement("some_element"); // Get cell information for cell that contains the element with id "some_element"
1142
+ * core.getCellInfo(mouseEventArg); // Get cell information from the given MouseEvent argument (this is the same as getRelativePosition() method)
1143
+ * var cellInfo = core.getCellInfo({"colIndex": 1, "rowIndex": 1});
1144
+ * cellInfo.colIndex = cellInfo.colIndex + 1; // Get next cell to the right
1145
+ * core.getCellInfo(cellInfo);
1146
+ */
1147
+ Core.prototype.getCellInfo = function (cellRef) {
1148
+ if(!cellRef) { return null; }
1149
+ var colIndex = /** @type{number} */(cellRef["colIndex"]);
1150
+ var rowIndex = /** @type{number} */(cellRef["rowIndex"]);
1151
+ var sectionName = /** @type{string} */(cellRef["sectionName"]);
1152
+ var mouseInfo = null;
1153
+ if(colIndex == null || rowIndex == null) { // Core.MouseInfo Non Mouse Info
1154
+ mouseInfo = this.getRelativePosition(/** @type{ElementWrapper|Element} */(cellRef));
1155
+ if(!mouseInfo["hit"]) {
1156
+ mouseInfo = null;
1157
+ }
1158
+ } else {
1159
+ if(!sectionName) {
1160
+ sectionName = "content";
1161
+ }
1162
+ var ss = this.getSectionSettings(sectionName);
1163
+ if(ss) {
1164
+ var s = ss.getSection();
1165
+ var cell = s.getCell(colIndex, rowIndex);
1166
+ if(cell) {
1167
+ mouseInfo = {};
1168
+ mouseInfo["colIndex"] = colIndex;
1169
+ mouseInfo["rowIndex"] = rowIndex;
1170
+ ss.extendEventArg(mouseInfo);
1171
+ }
1172
+ }
1173
+ }
1174
+ return mouseInfo;
1175
+ };
1176
+ /** Get cell information of the next cell in the same row. If there is no next cell in the row, `cell` parameter is set to null
1177
+ * @public
1178
+ * @param {Core.CellReference} cellRef Reference to cell element. This can be something inside the cell as well.
1179
+ * @param {number=} step=1
1180
+ * @return {Core.MouseInfo} Information about the next cell in the row. Returns null if the given parameter is invalid
1181
+ */
1182
+ Core.prototype.getNextCellInRow = function (cellRef, step) {
1183
+ return this._getNextCellInRow(cellRef, (step != null) ? step : 1);
1184
+ };
1185
+ /** Get cell information of the previous cell in the same row. If there is no previous cell in the row, `cell` parameter is set to null
1186
+ * @public
1187
+ * @param {Core.CellReference} cellRef Reference to cell element. This can be something inside the cell as well.
1188
+ * @param {number=} step=1
1189
+ * @return {Core.MouseInfo} Information about the previous cell in the row. Returns null if the given parameter is invalid
1190
+ */
1191
+ Core.prototype.getPrevCellInRow = function (cellRef, step) {
1192
+ return this._getNextCellInRow(cellRef, (step != null) ? -step : -1);
1193
+ };
1194
+ /** @private
1195
+ * @param {Core.CellReference} cellRef
1196
+ * @param {number} step
1197
+ * @return {Core.MouseInfo}
1198
+ */
1199
+ Core.prototype._getNextCellInRow = function (cellRef, step) {
1200
+ var mouseInfo = this.getCellInfo(cellRef);
1201
+ if(mouseInfo) {
1202
+ var colIndex = /** @type{number} */(mouseInfo["colIndex"]) + step;
1203
+ var rowIndex = /** @type{number} */(mouseInfo["rowIndex"]);
1204
+ var section = /** @type{ILayoutGrid} */(mouseInfo["section"]);
1205
+
1206
+ mouseInfo["colIndex"] = colIndex;
1207
+ mouseInfo["cell"] = section.getCell(colIndex, rowIndex);
1208
+ }
1209
+ return mouseInfo;
1210
+ };
1211
+ /** Get cell information of the next cell. If bottom right has been reached, `cell` parameter is set to null
1212
+ * @public
1213
+ * @param {Core.CellReference} cellRef Reference to cell element. This can be something inside the cell as well.
1214
+ * @return {Core.MouseInfo} Information about the next cell from left to right and top to bottom. Returns null if the given parameter is invalid
1215
+ */
1216
+ Core.prototype.getNextCell = function (cellRef) {
1217
+ var mouseInfo = this.getNextCellInRow(cellRef);
1218
+ if(mouseInfo) {
1219
+ var cell = /** @type{Core.Cell} */(mouseInfo["cell"]);
1220
+ if(!cell) { // End of the row
1221
+ var section = /** @type{ILayoutGrid} */(mouseInfo["section"]);
1222
+ var colIndex = mouseInfo["colIndex"] = 0;
1223
+ var rowIndex = /** @type{number} */(mouseInfo["rowIndex"]);
1224
+
1225
+ mouseInfo["rowIndex"] = ++rowIndex;
1226
+ mouseInfo["cell"] = section.getCell(colIndex, rowIndex);
1227
+ }
1228
+ }
1229
+ return mouseInfo;
1230
+ };
1231
+ /** Get cell information of the previous cell. If top left cell has been reached, `cell` parameter is set to null
1232
+ * @public
1233
+ * @param {Core.CellReference} cellRef Reference to cell element. This can be something inside the cell as well.
1234
+ * @return {Core.MouseInfo} Information about the previous cell in the row. Returns null if the given parameter is invalid
1235
+ */
1236
+ Core.prototype.getPrevCell = function (cellRef) {
1237
+ var mouseInfo = this.getPrevCellInRow(cellRef);
1238
+ if(mouseInfo) {
1239
+ var cell = /** @type{Core.Cell} */(mouseInfo["cell"]);
1240
+ if(!cell) { // End of the row
1241
+ var section = /** @type{ILayoutGrid} */(mouseInfo["section"]);
1242
+ var colIndex = mouseInfo["colIndex"] = section.getColumnCount() - 1;
1243
+ var rowIndex = /** @type{number} */(mouseInfo["rowIndex"]);
1244
+
1245
+ mouseInfo["rowIndex"] = --rowIndex;
1246
+ mouseInfo["cell"] = section.getCell(colIndex, rowIndex);
1247
+ }
1248
+ }
1249
+ return mouseInfo;
1250
+ };
1251
+
1252
+ /** @public
1253
+ * @return {number}
1254
+ */
1255
+ Core.prototype.getColumnCount = function () {
1256
+ return this._layoutX.getLaneCount();
1257
+ };
1258
+ /** Column count can be independently set regardless of row count and section count
1259
+ * @public
1260
+ * @param {number} num
1261
+ * @fires Core#columnAdded
1262
+ * @fires Core#preSectionRender
1263
+ * @fires Core#columnRender
1264
+ * @fires Core#preSectionDataBinding
1265
+ * @fires Core#columnDataBinding
1266
+ * @fires Core#postSectionDataBinding
1267
+ */
1268
+ Core.prototype.setColumnCount = function(num) {
1269
+ var colCount = this._layoutX.getLaneCount();
1270
+ if(num >= colCount) {
1271
+ this._layoutX.setLaneCount(num);
1272
+ for (var i = this._settings.length; --i >= 0; ) {
1273
+ var section = this._settings[i].getSection();
1274
+ section.setColumnCount(num); // Column may not be added to the document due to virtualization
1275
+ }
1276
+
1277
+ this._onColumnCountChanged();
1278
+ this._syncLayoutToColumns(colCount, num);
1279
+ this._dispatchColumnAddedEvent(colCount, num - colCount, false);
1280
+ } else {
1281
+ this._removeColumn(colCount - num);
1282
+ }
1283
+ };
1284
+
1285
+ /** @public
1286
+ * @param {number} index
1287
+ * @param {Core.ColumnOptions=} jsonObj Column definition object
1288
+ * @fires Core#columnAdded
1289
+ * @fires Core#preSectionRender
1290
+ * @fires Core#columnRender
1291
+ * @fires Core#preSectionDataBinding
1292
+ * @fires Core#columnDataBinding
1293
+ * @fires Core#postSectionDataBinding
1294
+ */
1295
+ Core.prototype.insertColumn = function (index, jsonObj) {
1296
+ var prevCount = this.getColumnCount();
1297
+ if (!(index < prevCount)) { index = prevCount; }
1298
+
1299
+ this._layoutX.insertLane(index);
1300
+ for (var i = this._settings.length; --i >= 0; ) {
1301
+ var section = this._settings[i].getSection();
1302
+ section.insertColumn(index);
1303
+ }
1304
+
1305
+ var rightPinnedCount = this._countPinnedRightColumns();
1306
+ this._columnDefs.splice(index, 0, null);
1307
+
1308
+ if (prevCount > 0) {
1309
+ var leftPinnedCount = this._countPinnedLeftColumns();
1310
+ if ((index < leftPinnedCount) && (leftPinnedCount < prevCount + 1)) {
1311
+ // insert into left frozen zone
1312
+ this.freezeColumn(leftPinnedCount, rightPinnedCount);
1313
+ } else if (index > (prevCount - rightPinnedCount)) {
1314
+ // insert into right frozen zone
1315
+ this.freezeColumn(leftPinnedCount - 1, rightPinnedCount + 1);
1316
+ }
1317
+ }
1318
+
1319
+ this._onColumnCountChanged();
1320
+ this._deserializeColumn(index, jsonObj);
1321
+ this._syncLayoutToColumns(index, index + 1);
1322
+
1323
+ this._dispatchColumnAddedEvent(index, 1, (index < prevCount), jsonObj);
1324
+ };
1325
+
1326
+ /** @public
1327
+ * @param {number} at
1328
+ * @param {(number|Core.ColumnOptions|Array.<Core.ColumnOptions>)=} cols Column definition object or column count
1329
+ */
1330
+ Core.prototype.insertColumns = function (at, cols) {
1331
+ var prevCount = this.getColumnCount();
1332
+ if (!(at < prevCount)) { at = prevCount; }
1333
+
1334
+ var count = 0;
1335
+ var colDefs;
1336
+ if (Array.isArray(cols)) {
1337
+ count = cols.length;
1338
+ if(count === 1) {
1339
+ this.insertColumn(at, cols[0]);
1340
+ return;
1341
+ }
1342
+
1343
+ colDefs = cols;
1344
+ } else if (typeof cols === "number") {
1345
+ count = cols;
1346
+ if(count === 1) {
1347
+ this.insertColumn(at, null);
1348
+ return;
1349
+ }
1350
+ } else {
1351
+ this.insertColumn(at, cols);
1352
+ return;
1353
+ }
1354
+ if (count <= 0) { return; }
1355
+
1356
+ var leftPinnedCount = this._countPinnedLeftColumns();
1357
+ var rightPinnedCount = this._countPinnedRightColumns();
1358
+
1359
+ var prevState = this.freezeLayout();
1360
+ var args = [at, 0].concat(new Array(count));
1361
+ Array.prototype.splice.apply(this._columnDefs, args);
1362
+
1363
+ for (var i = 0; i < count; i++) {
1364
+ var index = at + i;
1365
+ this._layoutX.insertLane(index);
1366
+ for (var s = this._settings.length; --s >= 0; ) {
1367
+ var section = this._settings[s].getSection();
1368
+ section.insertColumn(index);
1369
+ }
1370
+ var colDef = colDefs && colDefs[i];
1371
+ this._deserializeColumn(index, colDef);
1372
+ }
1373
+
1374
+ if (prevCount > 0) {
1375
+ if (at < leftPinnedCount) {
1376
+ // insert into left frozen zone
1377
+ this.freezeColumn(leftPinnedCount + count - 1, rightPinnedCount);
1378
+ } else if (at > (prevCount - rightPinnedCount)) {
1379
+ // insert into right frozen zone
1380
+ this.freezeColumn(leftPinnedCount - 1, rightPinnedCount + count);
1381
+ }
1382
+ } else if (leftPinnedCount + this._pinnedRightColumnCount < count) {
1383
+ this.freezeColumn(leftPinnedCount - 1, this._pinnedRightColumnCount);
1384
+ }
1385
+
1386
+ this._dispatchColumnAddedEvent(at, count, (at < prevCount), colDefs);
1387
+
1388
+ this.freezeLayout(prevState); // call _syncLayoutToColumns internally
1389
+ };
1390
+
1391
+ /** @public
1392
+ * @param {number} index
1393
+ * @return {Object} Return column definition object
1394
+ * @see {@link Core#removeAllColumns}
1395
+ * @fires Core#widthChanged
1396
+ * @fires Core#columnRemoved
1397
+ */
1398
+ Core.prototype.removeColumnAt = function (index) {
1399
+ var colCount = this.getColumnCount();
1400
+ if(index < 0 || index >= colCount) { return null; }
1401
+
1402
+ var vEnd = -1;
1403
+ if(this._colVirtualizer.isVirtualizable()) {
1404
+ vEnd = this._colVirtualizer.getLastIndexInView();
1405
+ }
1406
+
1407
+ var layoutSettings = this._layoutX.removeLaneAt(index);
1408
+ var sectionCount = this._settings.length;
1409
+ for (var i = 0; i < sectionCount; ++i) {
1410
+ this._settings[i].getSection().removeColumnAt(index);
1411
+ }
1412
+
1413
+ var leftPinnedCount = this._countPinnedLeftColumns();
1414
+ var rightPinnedCount = this._countPinnedRightColumns();
1415
+
1416
+ var colDef = this._columnDefs.splice(index, 1)[0]; // width and styles
1417
+
1418
+ if (index < leftPinnedCount) {
1419
+ // remove left frozen column
1420
+ this.freezeColumn(leftPinnedCount - 2, rightPinnedCount);
1421
+ } else if (index >= (colCount - rightPinnedCount)) {
1422
+ // remove right frozen column
1423
+ this.freezeColumn(leftPinnedCount - 1, rightPinnedCount - 1);
1424
+ }
1425
+
1426
+ this._onColumnCountChanged();
1427
+ this._syncLayoutToColumns(index, colCount - 1, true); // TODO: There should be no change in column layout
1428
+
1429
+ if(!colDef) {
1430
+ colDef = {};
1431
+ }
1432
+ colDef["layout"] = layoutSettings;
1433
+
1434
+ if (this._hasListener("columnRemoved")) {
1435
+ var e = {};
1436
+ e["atTheMiddle"] = true;
1437
+ e["colIndex"] = index;
1438
+ e["columns"] = "deprecated";
1439
+ e["columnData"] = colDef["columnData"];
1440
+ e["colId"] = colDef["id"] || "";
1441
+ this._dispatch("columnRemoved", e);
1442
+ }
1443
+
1444
+ // Last index in view here might be different from before moving column if columns have different width.
1445
+ if(index <= vEnd && vEnd === this._colVirtualizer.getLastIndexInView()) {
1446
+ this._colVirtualizer.update(); // Since columns are shifted to the left, we need to activate the columns to the right
1447
+ }
1448
+
1449
+ return colDef;
1450
+ };
1451
+ /** @public
1452
+ * @see {@link Core#removeColumnAt}
1453
+ * @fires Core#widthChanged
1454
+ * @fires Core#columnRemoved
1455
+ */
1456
+ Core.prototype.removeAllColumns = function () {
1457
+ if (this.getColumnCount() > 0) {
1458
+ this._startHScrollbarIndex = 0;
1459
+ this._pinnedRightColumnCount = 0;
1460
+ this.setColumnCount(0);
1461
+ }
1462
+ };
1463
+
1464
+ /** @public
1465
+ * @return {number}
1466
+ */
1467
+ Core.prototype.getStationaryColumnIndex = function () {
1468
+ var colCount = this.getColumnCount();
1469
+ for (var i = colCount - 1; i >= 0; i--) {
1470
+ if (this._getColumnDef(i)["stationary"]) {
1471
+ return i;
1472
+ }
1473
+ }
1474
+ return -1;
1475
+ };
1476
+
1477
+ /** Moving columns from or to steady area marked by stationary flag is not allowed. This method is used for checking ability of move.
1478
+ * @public
1479
+ * @param {number|Array.<number>} fromColIndex index or array of indices of the column(s) to be moved.
1480
+ * @param {number} toColIndex target column index
1481
+ * @return {boolean} Return true if the moving is doable, and false otherwise
1482
+ */
1483
+ Core.prototype.isColumnMoveAllowed = function (fromColIndex, toColIndex) {
1484
+ if (!Array.isArray(fromColIndex)) {
1485
+ fromColIndex = [fromColIndex];
1486
+ }
1487
+
1488
+ if (fromColIndex.length === 0 || toColIndex == null) {
1489
+ return false;
1490
+ }
1491
+
1492
+ var stationaryIndex = this.getStationaryColumnIndex();
1493
+
1494
+ if (stationaryIndex > -1) {
1495
+ if (toColIndex <= stationaryIndex) {
1496
+ return false;
1497
+ }
1498
+
1499
+ for (var i = 0; i < fromColIndex.length; i++) {
1500
+ if (fromColIndex[i] <= stationaryIndex) {
1501
+ return false;
1502
+ }
1503
+ }
1504
+ }
1505
+
1506
+ return true;
1507
+ };
1508
+
1509
+ /** @public
1510
+ * @param {number} fromCol INCLUSIVE
1511
+ * @param {number} destCol INCLUSIVE
1512
+ * @return {boolean} Return true if there is any change, and false otherwise
1513
+ * @fires Core#columnMoved
1514
+ */
1515
+ Core.prototype.moveColumn = function (fromCol, destCol) {
1516
+ var colCount = this.getColumnCount();
1517
+ if (fromCol < 0) { fromCol = 0; }
1518
+ else if (fromCol >= colCount) { fromCol = colCount - 1; }
1519
+ if (destCol < 0) { destCol = 0; }
1520
+ else if (destCol >= colCount) { destCol = colCount - 1; }
1521
+ if (fromCol === destCol) { return false; }
1522
+
1523
+ if (!this.isColumnMoveAllowed(fromCol, destCol)) {
1524
+ return false;
1525
+ }
1526
+
1527
+ var vEnd = -1;
1528
+ if(this._colVirtualizer.isVirtualizable()) {
1529
+ vEnd = this._colVirtualizer.getLastIndexInView();
1530
+ }
1531
+
1532
+ var colId = this._getColumnId(fromCol);
1533
+ this._layoutX.moveLane(fromCol, destCol);
1534
+ var sectionCount = this._settings.length;
1535
+ for (var i = 0; i < sectionCount; ++i) {
1536
+ var sectionSettings = this._settings[i];
1537
+ var section = sectionSettings.getSection();
1538
+ section.moveColumn(fromCol, destCol);
1539
+ }
1540
+
1541
+ var colDef = this._columnDefs[fromCol];
1542
+ var rightPinnedCount = this._countPinnedRightColumns();
1543
+ // var minColumn = (fromCol < destCol) ? fromCol : destCol;
1544
+ Util.moveArrayItem(this._columnDefs, fromCol, destCol);
1545
+
1546
+ if(fromCol < this._startHScrollbarIndex) {
1547
+ // Left pinned column
1548
+
1549
+ if(destCol >= (colCount - rightPinnedCount)) {
1550
+ // moved into right frozen zone
1551
+ this.freezeColumn(this._startHScrollbarIndex - 2, rightPinnedCount + 1);
1552
+ } else if(destCol >= this._startHScrollbarIndex) {
1553
+ // moved out
1554
+ this.freezeColumn(this._startHScrollbarIndex - 2, rightPinnedCount);
1555
+ }
1556
+ } else if(colDef.rightPinned) {
1557
+ // Right pinned column
1558
+
1559
+ if(destCol < this._startHScrollbarIndex) {
1560
+ // moved into left frozen zone
1561
+ this.freezeColumn(this._startHScrollbarIndex, rightPinnedCount - 1);
1562
+ } else if(destCol < (colCount - rightPinnedCount)) {
1563
+ // moved out
1564
+ this.freezeColumn(this._startHScrollbarIndex - 1, rightPinnedCount - 1);
1565
+ }
1566
+ } else {
1567
+ // unpinned column
1568
+
1569
+ if(destCol < this._startHScrollbarIndex) {
1570
+ // moved into left frozen zone
1571
+ this.freezeColumn(this._startHScrollbarIndex, rightPinnedCount);
1572
+ } else if(destCol >= (colCount - rightPinnedCount)) {
1573
+ // moved into right frozen zone
1574
+ this.freezeColumn(this._startHScrollbarIndex - 1, rightPinnedCount + 1);
1575
+ }
1576
+ }
1577
+
1578
+ // no need to invoke because moving column does not change column-width
1579
+ // this._syncLayoutToColumns(minColumn, this.getColumnCount());
1580
+
1581
+ if (this._hasListener("columnMoved")) {
1582
+ var e = {};
1583
+ e["fromColIndex"] = fromCol;
1584
+ e["toColIndex"] = destCol;
1585
+ e["colId"] = colId; // TODO: Id may not needed
1586
+ this._dispatch("columnMoved", e);
1587
+ }
1588
+
1589
+ // Last index in view here might be different from before moving column if columns have different width.
1590
+ if(vEnd === this._colVirtualizer.getLastIndexInView()) {
1591
+ if (fromCol <= vEnd && destCol > vEnd) { // Columns are shifted to the left, we need to activate the columns to the right
1592
+ this._colVirtualizer.update();
1593
+ } else if (destCol <= vEnd && fromCol > vEnd) { // Move virtualized column into view, need to rerender destination column
1594
+ this._colVirtualizer.update();
1595
+ }
1596
+ }
1597
+ return true;
1598
+ };
1599
+
1600
+ /** @public
1601
+ * @ignore
1602
+ * @return {!TrackLayout}
1603
+ */
1604
+ Core.prototype.getColumnLayout = function () {
1605
+ return this._layoutX;
1606
+ };
1607
+
1608
+ /** @public
1609
+ * @ignore
1610
+ * @fires Core#widthChanged
1611
+ */
1612
+ Core.prototype.updateColumnLayout = function () {
1613
+ this._syncLayoutToColumns(0, this.getColumnCount());
1614
+ };
1615
+
1616
+ /** @private
1617
+ * @param {number} index
1618
+ * @param {Object=} jsonObj
1619
+ */
1620
+ Core.prototype._deserializeColumn = function (index, jsonObj) {
1621
+ if (!jsonObj) { return; }
1622
+
1623
+ var layout = jsonObj["layout"] || jsonObj;
1624
+ var val = jsonObj["width"];
1625
+ if (val != null) { layout["size"] = val; }
1626
+ val = jsonObj["scalable"];
1627
+ if (val != null) { layout["scalable"] = val; }
1628
+ val = jsonObj["minWidth"];
1629
+ if (val != null) { layout["minSize"] = val; }
1630
+ if (layout["scalable"] == null) {
1631
+ layout["scalable"] = (layout["size"] == null);
1632
+ }
1633
+
1634
+ this._layoutX.deserializeLane(index, layout);
1635
+
1636
+ var name;
1637
+ var styles = jsonObj["styles"];
1638
+ for (name in styles) {
1639
+ this.setColumnStyle(index, name, styles[name]);
1640
+ }
1641
+ var classes = jsonObj["classes"];
1642
+ for (name in classes) {
1643
+ this.enableColumnClass(index, name, classes[name]);
1644
+ }
1645
+ // TODO: Load specific styles for each column type (e.g. "content", "title", "header")
1646
+
1647
+ var colDef = this._getColumnDef(index);
1648
+ var value = jsonObj["dataColumnName"];
1649
+ if (value != null) {
1650
+ colDef["dataColumnName"] = dataColumnName;
1651
+ }
1652
+
1653
+ value = jsonObj["stationary"];
1654
+ if (value != null) {
1655
+ colDef["stationary"] = value;
1656
+ }
1657
+
1658
+ this.setColumnRenderingHandler(index, jsonObj["renderingHandler"]);
1659
+ this.setColumnDataBindingHandler(index, jsonObj["dataBindingHandler"]);
1660
+
1661
+ value = jsonObj["columnData"];
1662
+ if(value) {
1663
+ this.setColumnData(index, value);
1664
+ }
1665
+
1666
+ var formatter = jsonObj["formatter"] || jsonObj["binding"]; // support both composite and real-time grid
1667
+ if(Array.isArray(formatter)) {
1668
+ formatter = formatter[0]; // Support only one formatter in the array
1669
+ }
1670
+ if(formatter && typeof formatter !== "function") {
1671
+ var formatterInitializer = formatter["init"];
1672
+ if(typeof formatterInitializer === "function") {
1673
+ formatterInitializer(jsonObj, this); // Pass on userJson object and core grid instance
1674
+ }
1675
+ }
1676
+ };
1677
+
1678
+ /** Add specified number of rows to the last section. This method is intended for fast layout generation. <br>
1679
+ * If column count is zero, one column will be added automatically. <br>
1680
+ * If there is no section, a new section is created automatically. <br>
1681
+ * No row is added to the data source.
1682
+ * @public
1683
+ * @param {number=} opt_num Default is one row
1684
+ * @fires Core#preSectionRender
1685
+ * @fires Core#columnRender
1686
+ * @fires Core#preSectionDataBinding
1687
+ * @fires Core#columnDataBinding
1688
+ * @fires Core#postSectionDataBinding
1689
+ */
1690
+ Core.prototype.addRow = function (opt_num) {
1691
+ if (opt_num == null) { opt_num = 1; }
1692
+ else if (opt_num <= 0) { return; }
1693
+
1694
+ if (this.getColumnCount() <= 0) {
1695
+ this.setColumnCount(1); // WARNING: Auto column adding
1696
+ }
1697
+
1698
+ var section = this.getLastSection();
1699
+ if (section == null) {
1700
+ section = this.addSection(); // WARNING: Auto section adding
1701
+ }
1702
+
1703
+ section.addRow(opt_num);
1704
+ };
1705
+ /** Remove specified number of rows from the last section. <br>
1706
+ * Note that this will NOT remove row in the DataTable, as well as the section. <br>
1707
+ * Use removeRowData to remove the supporting data row from the data source
1708
+ * @public
1709
+ * @param {number=} opt_num Default is one row
1710
+ */
1711
+ Core.prototype.removeRow = function (opt_num) {
1712
+ var section = this.getLastSection();
1713
+ if (section == null) { return; }
1714
+
1715
+ if (opt_num == null) { opt_num = 1; }
1716
+ section.removeRow(opt_num);
1717
+ };
1718
+ /** @public
1719
+ * @return {number}
1720
+ */
1721
+ Core.prototype.getRowCount = function () {
1722
+ return this._layoutY.getLaneCount();
1723
+ };
1724
+ /** The specified section and columns must exist prior to calling this method
1725
+ * @public
1726
+ * @param {Core.SectionReference} sectionRef
1727
+ * @param {number} num
1728
+ */
1729
+ Core.prototype.setSectionRowCount = function(sectionRef, num) {
1730
+ var section = this.getSection(sectionRef);
1731
+ if (section == null) { return; }
1732
+ section.setRowCount(num);
1733
+ };
1734
+ /** @public
1735
+ * @param {number} sectionIndex
1736
+ * @param {number} rowIndex relative to the given section
1737
+ * @return {number} rowIndex relative to the first section (index as a whole)
1738
+ */
1739
+ Core.prototype.getRowIndex = function(sectionIndex, rowIndex) {
1740
+ return this._sectionStarts[sectionIndex] + rowIndex;
1741
+ };
1742
+ /** @private
1743
+ * @function
1744
+ */
1745
+ Core.prototype.getRelativeIndex = Util._deprecatedFunction;
1746
+
1747
+ /** WARNING: This only removes all rows in each section, but the sections and columns remain intact
1748
+ * @public
1749
+ */
1750
+ Core.prototype.removeAllRows = function() {
1751
+ var len = this._settings.length;
1752
+ for(var i = 0; i < len; ++i) {
1753
+ this._settings[i].getSection().setRowCount(0);
1754
+ this._sectionStarts[i] = 0;
1755
+ }
1756
+ this._sectionStarts[len] = 0;
1757
+ };
1758
+ /** @public
1759
+ * @return {number}
1760
+ */
1761
+ Core.prototype.getDefaultRowHeight = function () {
1762
+ return this._layoutY.getDefaultLaneSize();
1763
+ };
1764
+ /** This default row height only applies to header and content section. <br>
1765
+ * Use the second flag to apply the change to title section too. <br>
1766
+ * To set default row height for a specific section, please call setDefaultRowHeight directly from the section
1767
+ * @public
1768
+ * @param {number} val
1769
+ * @param {boolean=} opt_includeTitle
1770
+ */
1771
+ Core.prototype.setDefaultRowHeight = function (val, opt_includeTitle) {
1772
+ if (this._layoutY.setDefaultLaneSize(val)) {
1773
+ this._rowHeightSync = false;
1774
+ var defaultHeight = this._layoutY.getDefaultLaneSize();
1775
+ this._rowHeightException = (opt_includeTitle) ? "" : "title";
1776
+ var sectCount = this._settings.length;
1777
+ for (var i = 0; i < sectCount; ++i) {
1778
+ var sectionSettings = this._settings[i];
1779
+ if (
1780
+ sectionSettings.getType() !== this._rowHeightException &&
1781
+ sectionSettings.getId() !== "bottomPadding"
1782
+ ) {
1783
+ sectionSettings.getSection().setDefaultRowHeight(defaultHeight); // An event will be fired for each row
1784
+ }
1785
+ }
1786
+ this._syncRowHeights();
1787
+ this._rowHeightSync = true;
1788
+ this.setRowScrollingStep(this._rowScrollingStep);
1789
+ }
1790
+ };
1791
+
1792
+ /** @public
1793
+ * @return {DataView} dataSource
1794
+ */
1795
+ Core.prototype.getDataSource = function () {
1796
+ return this._dataSource;
1797
+ };
1798
+
1799
+ /** set Data Conflation for better performance
1800
+ * @public
1801
+ * @param {number} milliSecond
1802
+ */
1803
+ Core.prototype.setDataConflationRate = function (milliSecond) {
1804
+ this._dataSource.setConflationRate(milliSecond);
1805
+ };
1806
+
1807
+ /**
1808
+ * @public
1809
+ * @return {number}
1810
+ */
1811
+ Core.prototype.getDataConflationRate = function () {
1812
+ return this._dataSource.getConflationRate();
1813
+ };
1814
+
1815
+ /** @public
1816
+ * @param {DataTable|DataView} dataSource
1817
+ * @fires Core#dataSourceChanged
1818
+ * @fires Core#postDataSourceChanged
1819
+ * @return {DataView} Returns the root data view
1820
+ */
1821
+ Core.prototype.setDataSource = function (dataSource) {
1822
+ if (dataSource) {
1823
+ if (dataSource instanceof DataTable) { // Sometimes, user put in a wrong parameter
1824
+ dataSource = new DataView(dataSource);
1825
+ }
1826
+ }
1827
+
1828
+ var e = {};
1829
+ e["prevDataSource"] = this._dataSource;
1830
+ this._dataSource = dataSource || null;
1831
+ e["dataSource"] = this._dataSource;
1832
+
1833
+ this._dispatch("dataSourceChanged", e);
1834
+
1835
+ if (this._autoSetDataSource) {
1836
+ var len = this._settings.length;
1837
+ for (var i = 0; i < len; ++i) {
1838
+ this._settings[i].setDataSource(dataSource);
1839
+ }
1840
+ }
1841
+
1842
+ this._dispatch("postDataSourceChanged", e);
1843
+
1844
+ return this._dataSource;
1845
+ };
1846
+
1847
+ /** @private
1848
+ * @function
1849
+ */
1850
+ Core.prototype.setColumnTemplate = Util._deprecatedFunction;
1851
+ /** @private
1852
+ * @function
1853
+ */
1854
+ Core.prototype.getColumnTemplate = Util._deprecatedFunction;
1855
+
1856
+ /** Deprecated. Use setColumnRenderingHandler instead
1857
+ * @public
1858
+ * @function
1859
+ */
1860
+ Core.prototype.getColumnRenderEvent = Util._deprecatedFunction;
1861
+ /** Deprecated. Use setColumnDataBindingHandler instead
1862
+ * @public
1863
+ * @function
1864
+ * @param {number} c
1865
+ * @return {Object}
1866
+ * @see {@link Core#setColumnDataBindingHandler}
1867
+ */
1868
+ Core.prototype.getColumnDataBindingEvent = function(c) {
1869
+ console.log("getColumnDataBindingEvent() is deprecated. Use setColumnDataBindingHandler() instead");
1870
+ var t = this;
1871
+ return {
1872
+ "listen": function(f) {
1873
+ t.setColumnDataBindingHandler(c, f);
1874
+ },
1875
+ "unlisten": function() {
1876
+ t.setColumnDataBindingHandler(c, null);
1877
+ }
1878
+ };
1879
+ };
1880
+
1881
+
1882
+ /** @public
1883
+ * @param {number} colIndex
1884
+ * @param {string} style
1885
+ * @param {string} value
1886
+ * @param {string=} opt_type Apply the style only to the specified row type. Default is applying to all rows
1887
+ */
1888
+ Core.prototype.setColumnStyle = function (colIndex, style, value, opt_type) {
1889
+ if (!style) { return; }
1890
+ if (!Util.isNumber(colIndex)) {
1891
+ colIndex = 0;
1892
+ console.log("WARNING: the first parameter for setColumnStyle must be column index");
1893
+ }
1894
+
1895
+ var styles;
1896
+ if (opt_type == null) {
1897
+ styles = this._getNestedColumnDef(colIndex, "styles");
1898
+ } else {
1899
+ opt_type = this._toSectionType(opt_type);
1900
+ styles = this._getNestedColumnDef(colIndex, opt_type, "styles");
1901
+ }
1902
+ styles[style] = value;
1903
+
1904
+ for (var i = this._settings.length; --i >= 0; ) {
1905
+ var sectionSettings = this._settings[i];
1906
+ if (opt_type == null || opt_type === sectionSettings.getType()) {
1907
+ var section = sectionSettings.getSection();
1908
+ section.setColumnStyle(colIndex, style, value);
1909
+ }
1910
+ }
1911
+ };
1912
+
1913
+ /** @public
1914
+ * @param {number} colIndex
1915
+ * @param {string} clsName
1916
+ * @param {boolean=} enabled
1917
+ * @param {string=} opt_type Apply the class only to the specified row type. Default is applying to all rows
1918
+ * @return {boolean} Return true, if there is any change
1919
+ */
1920
+ Core.prototype.enableColumnClass = function (colIndex, clsName, enabled, opt_type) {
1921
+ if (typeof colIndex !== "number") {
1922
+ colIndex = 0;
1923
+ }
1924
+
1925
+ var classes;
1926
+ if (opt_type == null) {
1927
+ classes = this._getNestedColumnDef(colIndex, "classes");
1928
+ } else {
1929
+ opt_type = this._toSectionType(opt_type);
1930
+ classes = this._getNestedColumnDef(colIndex, opt_type, "classes");
1931
+ }
1932
+
1933
+ var dirty = false;
1934
+ enabled = (enabled !== false);
1935
+ if (enabled) {
1936
+ if(!classes[clsName]) {
1937
+ dirty = classes[clsName] = true;
1938
+ }
1939
+ } else if (classes[clsName]) {
1940
+ delete classes[clsName];
1941
+ dirty = true;
1942
+ }
1943
+
1944
+ if(dirty) {
1945
+ for (var i = this._settings.length; --i >= 0; ) {
1946
+ var sectionSettings = this._settings[i];
1947
+ if (opt_type == null || opt_type === sectionSettings.getType()) {
1948
+ sectionSettings.getSection().enableColumnClass(colIndex, clsName, enabled);
1949
+ }
1950
+ }
1951
+ }
1952
+ return dirty;
1953
+ };
1954
+ /** @public
1955
+ * @param {number} colIndex
1956
+ * @param {string} clsName
1957
+ * @param {string=} opt_type Row type
1958
+ * @return {boolean}
1959
+ */
1960
+ Core.prototype.hasColumnClass = function (colIndex, clsName, opt_type) {
1961
+ var classes;
1962
+ if (opt_type == null) {
1963
+ classes = this._getNestedColumnDef(colIndex, "classes");
1964
+ } else {
1965
+ opt_type = this._toSectionType(opt_type);
1966
+ classes = this._getNestedColumnDef(colIndex, opt_type, "classes");
1967
+ }
1968
+ return (classes && classes[clsName]) ? true : false;
1969
+ };
1970
+
1971
+ /** @public
1972
+ * @param {number} colIndex
1973
+ * @param {string=} alignment Available options are "center"|"right"|"left"|"c"|"r"|"l". Use empty string (falsy value) to reset back to default aliganment.
1974
+ */
1975
+ Core.prototype.setColumnAlignment = function(colIndex, alignment) {
1976
+ var ch = alignment ? alignment.charAt(0).toLowerCase() : "";
1977
+
1978
+ var dirty = 0;
1979
+ dirty |= this.enableColumnClass(colIndex, "tr-align-left", ch === "l");
1980
+ dirty |= this.enableColumnClass(colIndex, "tr-align-right", ch === "r");
1981
+ dirty |= this.enableColumnClass(colIndex, "tr-align-center", ch === "c");
1982
+
1983
+ if(dirty) {
1984
+ this._dispatch("columnAlignmentChanged", {
1985
+ "colIndex": colIndex,
1986
+ "alignment": ch
1987
+ });
1988
+ }
1989
+ };
1990
+ /** @public
1991
+ * @param {number} colIndex
1992
+ * @return {string} Possible returned values are "default"|"left"|"center"|"right"
1993
+ */
1994
+ Core.prototype.getColumnAlignment = function(colIndex) {
1995
+ if(this.hasColumnClass(colIndex, "tr-align-right")) {
1996
+ return "right";
1997
+ } else if(this.hasColumnClass(colIndex, "tr-align-center")) {
1998
+ return "center";
1999
+ } else if(this.hasColumnClass(colIndex, "tr-align-left")) {
2000
+ return "left";
2001
+ }
2002
+ return "default";
2003
+ };
2004
+
2005
+
2006
+ /** @public
2007
+ * @param {number} colIndex
2008
+ * @return {number}
2009
+ */
2010
+ Core.prototype.getColumnLeft = function (colIndex) {
2011
+ var colDef = this._columnDefs[colIndex];
2012
+ if(colDef && colDef.rightPinned) {
2013
+ var gridWidth = this.getElement().clientWidth;
2014
+ var contentWidth = this._layoutX.getTrackSize();
2015
+ var colLeft = contentWidth < gridWidth ? contentWidth : gridWidth;
2016
+ var lastIndex = this.getColumnCount() - 1;
2017
+ for(var i = lastIndex; i >= colIndex; --i) {
2018
+ colLeft -= this._layoutX.getLaneSize(i);
2019
+ }
2020
+ return colLeft;
2021
+ } else if (this._startHScrollbarIndex >= 0 && colIndex >= this._startHScrollbarIndex) {
2022
+ return this._layoutX.getLaneStart(colIndex) - this._hscrollbar.getScrollLeft();
2023
+ } else {
2024
+ return this._layoutX.getLaneStart(colIndex);
2025
+ }
2026
+ };
2027
+ /** @public
2028
+ * @param {number} colIndex
2029
+ * @return {number}
2030
+ */
2031
+ Core.prototype.getColumnRight = function (colIndex) {
2032
+ return this.getColumnLeft(colIndex) + this._layoutX.getLaneSize(colIndex);
2033
+ };
2034
+ /** @public
2035
+ * @param {number} colIndex
2036
+ * @return {number}
2037
+ */
2038
+ Core.prototype.getColumnWidth = function (colIndex) {
2039
+ return this._layoutX.getLaneSize(colIndex);
2040
+ };
2041
+ /** @public
2042
+ * @param {number} colIndex
2043
+ * @return {number}
2044
+ */
2045
+ Core.prototype.getColumnCustomLaneSize = function (colIndex) {
2046
+ return this._layoutX.getCustomLaneSize(colIndex);
2047
+ };
2048
+ /** @private
2049
+ * @param {Array.<number>} indices
2050
+ * @param {Array.<number>} widths
2051
+ * @return {Array.<number>}
2052
+ */
2053
+ Core.prototype._calculateColumnWidths = function (indices, widths) {
2054
+ if(!this._preserveGridSize) {
2055
+ return widths;
2056
+ }
2057
+
2058
+ var i, newWidth = 0, settingCols = {};
2059
+ var len = indices.length;
2060
+ var calWidths = new Array(len);
2061
+ for (i = 0; i < len; i++) {
2062
+ settingCols[indices[i]] = true;
2063
+ calWidths[i] = widths[i];
2064
+ newWidth += widths[i];
2065
+ }
2066
+ var fixedSize = 0, scalableCount = 0;
2067
+ var colCount = this.getColumnCount();
2068
+ var layoutX = this._layoutX;
2069
+
2070
+ for(i = 0; i < colCount; i++) {
2071
+ if (settingCols[i]) { continue; }
2072
+ if (layoutX.isLaneVisible(i)) { // If column is visible
2073
+ if (!layoutX.getLaneScalability(i)) {
2074
+ fixedSize += layoutX.getLaneSize(i);
2075
+ } else {
2076
+ fixedSize += layoutX.getMinimumLaneSize(i);
2077
+ scalableCount++;
2078
+ }
2079
+ }
2080
+ }
2081
+ var gridSize = this.getContentWidth();
2082
+ var excess = newWidth + fixedSize - gridSize;
2083
+
2084
+ if (scalableCount < 1 || excess > 0) {
2085
+ layoutX.resetLaneToDefaultSize();
2086
+ layoutX.setTrackSize(gridSize, this._reservedSpace);
2087
+ fixedSize = 0;
2088
+ for(i = 0; i < colCount; i++) {
2089
+ if (settingCols[i]) { continue; }
2090
+ if (layoutX.isLaneVisible(i)) { // If column is visible
2091
+ if (!layoutX.getLaneScalability(i)) {
2092
+ fixedSize += layoutX.getLaneSize(i);
2093
+ } else {
2094
+ fixedSize += layoutX.getMinimumLaneSize(i);
2095
+ }
2096
+ }
2097
+ }
2098
+ excess = newWidth + fixedSize - gridSize;
2099
+ if (excess > 0) {
2100
+ excess = excess / len;
2101
+ for (i = 0; i < len; i++) {
2102
+ calWidths[i] -= excess;
2103
+ }
2104
+ }
2105
+ }
2106
+ return calWidths;
2107
+ };
2108
+ /** @public
2109
+ * @param {number} colIndex
2110
+ * @param {number} px
2111
+ * @param {boolean=} opt_scalable If not defined false value is used instead
2112
+ * @return {boolean} True if there is any changed
2113
+ * @fires Core#widthChanged
2114
+ * @example
2115
+ * core.setColumnWidth(0, 100); // The first column will have a fixed width
2116
+ * core.setColumnWidth(1, 100, true); // The second column will have a percentage width where 100 is the weight comparing with other percentage column
2117
+ */
2118
+ Core.prototype.setColumnWidth = function (colIndex, px, opt_scalable) {
2119
+ var calWidths = this._calculateColumnWidths([colIndex], [px]);
2120
+ var dirty = this._setColumnWidth(colIndex, calWidths[0], opt_scalable);
2121
+ if (dirty) {
2122
+ this._syncLayoutToColumns(colIndex, colIndex + 1);
2123
+ }
2124
+ return dirty;
2125
+ };
2126
+ /** Specifies multiple column widths all at once.
2127
+ * @public
2128
+ * @param {Array.<number>} columnWidths in pixel. If the specified value is undefined or null, nothing is performed on that column.
2129
+ * @param {(boolean|Array.<boolean>)=} opt_proportion This will make columns scale in proportion specified by the given width
2130
+ * @return {boolean} True if there is any changed
2131
+ * @fires Core#widthChanged
2132
+ * @example
2133
+ * core.setColumnWidths([1, 2, 1, 1], true); // The first four columns have percentage width with the second column is twice as big as the others
2134
+ * core.setColumnWidths([1, 200, 1, 150], [true, false, true]); // The first column make column scale, seconds make column pixel, third make column scale and four make column pixel
2135
+ */
2136
+ Core.prototype.setColumnWidths = function (columnWidths, opt_proportion) {
2137
+ var dirty = 0;
2138
+ var indices = [], widths = [], propotions = [], i;
2139
+ for(i = columnWidths.length; --i >= 0;) {
2140
+ var px = columnWidths[i];
2141
+ if(px != null) {
2142
+ indices.push(i);
2143
+ widths.push(px);
2144
+ }
2145
+ var proportionMode = Array.isArray(opt_proportion) ? opt_proportion[i] : opt_proportion;
2146
+ propotions.push(proportionMode);
2147
+ }
2148
+ var calWidths = this._calculateColumnWidths(indices, widths);
2149
+ for(i = 0; i < calWidths.length; i++) {
2150
+ dirty |= this._setColumnWidth(indices[i], calWidths[i], propotions[i] );
2151
+ }
2152
+
2153
+ if (dirty) {
2154
+ this._syncLayoutToColumns(0, columnWidths.length);
2155
+ }
2156
+ return dirty ? true : false;
2157
+ };
2158
+ /** Use {@link Core#hideColumn} to hide the column
2159
+ * @public
2160
+ * @param {number} colIndex
2161
+ * @return {boolean}
2162
+ */
2163
+ Core.prototype.isColumnVisible = function (colIndex) {
2164
+ return this._layoutX.isLaneVisible(colIndex);
2165
+ };
2166
+ /** Note that the hidden columns continue to exist and occupy the index. So there is no index shifted after this function call.
2167
+ * @public
2168
+ * @param {number} colIndex
2169
+ * @param {boolean=} hidden If the value is true or undefined, hide the specified column. Otherwise, show the column
2170
+ * @fires Core#widthChanged
2171
+ * @fires Core#columnVisibilityChanged
2172
+ * @see {@link Core#isColumnVisible}
2173
+ * @see {@link Core#hideColumns}
2174
+ * @see {@link Core#showAllColumns}
2175
+ */
2176
+ Core.prototype.hideColumn = function (colIndex, hidden) {
2177
+ var visibility = hidden === false;
2178
+ this.setColumnVisibility(colIndex, visibility, 0);
2179
+ };
2180
+ /** Hide multiple columns at once, improving the performance. Note that the hidden columns continue to exist and occupy the index. So there is no index shifted after this function call.
2181
+ * @public
2182
+ * @param {Array.<number>} colIndices
2183
+ * @param {boolean=} hidden If the value is true or undefined, hide the specified columns. Otherwise, show the columns
2184
+ * @fires Core#widthChanged
2185
+ * @fires Core#columnVisibilityChanged
2186
+ * @see {@link Core#hideColumn}
2187
+ * @see {@link Core#showAllColumns}
2188
+ */
2189
+ Core.prototype.hideColumns = function (colIndices, hidden) {
2190
+ var len = Array.isArray(colIndices) ? colIndices.length : 0;
2191
+ var changeIndices = [];
2192
+ var colCount = this.getColumnCount();
2193
+ hidden = hidden !== false;
2194
+ for (var i = 0; i < len; ++i) {
2195
+ var colIndex = colIndices[i];
2196
+ if (colIndex >= 0 && colIndex < colCount) {
2197
+ if (this._layoutX.hideLane(colIndex, hidden, 0)) {
2198
+ changeIndices.push(colIndex);
2199
+ }
2200
+ }
2201
+ }
2202
+ if (changeIndices.length) {
2203
+ this._syncLayoutToColumns();
2204
+ this.requestRowRefresh();
2205
+
2206
+ if (this._hasListener("columnVisibilityChanged")) {
2207
+ var e = {};
2208
+ e["colIndices"] = changeIndices;
2209
+ e["hidden"] = hidden;
2210
+ this._dispatch("columnVisibilityChanged", e);
2211
+ }
2212
+ }
2213
+ };
2214
+ /** @public
2215
+ * @fires Core#widthChanged
2216
+ * @fires Core#columnVisibilityChanged
2217
+ * @see {@link Core#hideColumn}
2218
+ * @see {@link Core#hideColumns}
2219
+ */
2220
+ Core.prototype.showAllColumns = function () {
2221
+ var changeIndices = [];
2222
+ var colCount = this.getColumnCount();
2223
+ for (var c = 0; c < colCount; ++c) {
2224
+ if (this._layoutX.hideLane(c, false, 0)) {
2225
+ changeIndices.push(c);
2226
+ }
2227
+ }
2228
+ if (changeIndices.length) {
2229
+ this._syncLayoutToColumns();
2230
+ this.requestRowRefresh();
2231
+
2232
+ if (this._hasListener("columnVisibilityChanged")) {
2233
+ var e = {};
2234
+ e["colIndices"] = changeIndices;
2235
+ e["hidden"] = false;
2236
+ this._dispatch("columnVisibilityChanged", e);
2237
+ }
2238
+ }
2239
+ };
2240
+ /** @public
2241
+ * @param {number} colIndex
2242
+ * @return {number}
2243
+ */
2244
+ Core.prototype.getMinimumColumnWidth = function (colIndex) {
2245
+ return this._layoutX.getMinimumLaneSize(colIndex);
2246
+ };
2247
+ /** @public
2248
+ * @param {number} colIndex
2249
+ * @param {number} width
2250
+ * @fires Core#widthChanged
2251
+ */
2252
+ Core.prototype.setMinimumColumnWidth = function (colIndex, width) {
2253
+ if (this._layoutX.setMinimumLaneSize(colIndex, width)) {
2254
+ this._syncLayoutToColumns(colIndex, colIndex + 1);
2255
+ }
2256
+ };
2257
+ /** @public
2258
+ * @param {Array.<number|null>} minWidths
2259
+ * @param {boolean=} proportion This will make the column expand in proportion of its minimum width when there is enough space.
2260
+ * @fires Core#widthChanged
2261
+ * @return {boolean} True if there is any change
2262
+ */
2263
+ Core.prototype.setMinimumColumnWidths = function (minWidths, proportion) {
2264
+ var dirty = 0;
2265
+ var first = NaN;
2266
+ var last = NaN;
2267
+ for (var c = minWidths.length; --c >= 0; ) {
2268
+ var minWidth = minWidths[c];
2269
+ if (minWidth != null) {
2270
+ if(!last) { last = c; }
2271
+ first = c;
2272
+ dirty |= this._layoutX.setMinimumLaneSize(c, minWidth, proportion);
2273
+ }
2274
+ }
2275
+ if (dirty) {
2276
+ this._syncLayoutToColumns(first, last + 1);
2277
+ }
2278
+ return dirty ? true : false;
2279
+ };
2280
+ /** @public
2281
+ * @param {number} colIndex
2282
+ * @return {boolean}
2283
+ */
2284
+ Core.prototype.getColumnScalability = function (colIndex) {
2285
+ return this._layoutX.getLaneScalability(colIndex);
2286
+ };
2287
+ /** @public
2288
+ * @param {number|boolean} val column index or default column scalability
2289
+ * @param {boolean=} opt_scalable
2290
+ * @return {boolean}
2291
+ * @fires Core#widthChanged
2292
+ */
2293
+ Core.prototype.setColumnScalability = function (val, opt_scalable) {
2294
+ var dirty = false;
2295
+ if (Util.isNumber(val)) {
2296
+ opt_scalable = (opt_scalable !== false);
2297
+ dirty = this._layoutX.setLaneScalability(/** @type{number} */(val), opt_scalable);
2298
+ if (dirty) {
2299
+ this._syncLayoutToColumns(/** @type{number} */(val), val + 1);
2300
+ }
2301
+ } else {
2302
+ this.setDefaultColumnScalable(/** @type{boolean} */(val));
2303
+ }
2304
+ return dirty;
2305
+ };
2306
+ /** @public
2307
+ * @param {boolean} scalable
2308
+ */
2309
+ Core.prototype.setDefaultColumnScalable = function (scalable) {
2310
+ this._layoutX.setDefaultScalability(!!scalable);
2311
+ };
2312
+ /** @public
2313
+ * @return {boolean}
2314
+ */
2315
+ Core.prototype.resetColumnWidths = function () {
2316
+ var dirty = this._layoutX.resetLaneToDefaultSize();
2317
+ if (dirty) {
2318
+ this._syncLayoutToColumns(0, this.getColumnCount());
2319
+ }
2320
+ return dirty;
2321
+ };
2322
+ /** @public
2323
+ * @param {number} colIndex
2324
+ * @param {number} width
2325
+ */
2326
+ Core.prototype.setColumnDefaultWidth = function (colIndex, width) {
2327
+ this._layoutX.setLaneDefaultSize(colIndex, width);
2328
+ };
2329
+ /** @public
2330
+ * @param {boolean} preserve=false
2331
+ */
2332
+ Core.prototype.preserveProportion = function (preserve) {
2333
+ this._preserveProportion = preserve === true;
2334
+ };
2335
+ /** @public
2336
+ * @return {boolean} Proportion preserved
2337
+ */
2338
+ Core.prototype.isProportionPreserved = function () {
2339
+ return this._preserveProportion;
2340
+ };
2341
+ /** @public
2342
+ * @param {boolean} preserve=false
2343
+ */
2344
+ Core.prototype.preserveGridSize = function (preserve) {
2345
+ this._preserveGridSize = preserve === true;
2346
+ };
2347
+ /** @public
2348
+ * @param {number} colIndex
2349
+ * @return {Object} userData
2350
+ */
2351
+ Core.prototype.getColumnData = function (colIndex) {
2352
+ return this._getColumnDef(colIndex)["columnData"] || null;
2353
+ };
2354
+ /** @public
2355
+ * @param {number} colIndex
2356
+ * @param {Object} userData
2357
+ * @return {Object}
2358
+ */
2359
+ Core.prototype.setColumnData = function (colIndex, userData) { // TODO: Deprecate this method
2360
+ this._getColumnDef(colIndex)["columnData"] = userData;
2361
+ return userData;
2362
+ };
2363
+ /** @public
2364
+ * @param {number} colIndex
2365
+ * @return {!Object}
2366
+ */
2367
+ Core.prototype.newColumnData = function (colIndex) {
2368
+ return this.getColumnData(colIndex) || {};
2369
+ };
2370
+ /** @public
2371
+ * @param {number} colIndex
2372
+ * @param {boolean=} alwaysRender
2373
+ */
2374
+ Core.prototype.setAlwaysRenderColumn = function(colIndex, alwaysRender) {
2375
+ this.getColumnData(colIndex)["alwaysRender"] = (alwaysRender !== false);
2376
+ };
2377
+ /** @private
2378
+ * @param {number} colIndex
2379
+ * @return {!boolean}
2380
+ */
2381
+ Core.prototype._isAlwaysRenderColumn = function (colIndex) {
2382
+ var colData = this.getColumnData(colIndex);
2383
+ if(colData) {
2384
+ return colData["alwaysRender"] === true;
2385
+ }
2386
+ return false;
2387
+ };
2388
+
2389
+ /** @public
2390
+ * @return {boolean}
2391
+ */
2392
+ Core.prototype.getFitContentWidth = function () {
2393
+ return this._fitContentWidth;
2394
+ };
2395
+ /** @public
2396
+ * @param {boolean} bool
2397
+ */
2398
+ Core.prototype.setFitContentWidth = function (bool) {
2399
+ if (this._fitContentWidth !== bool) {
2400
+ this._fitContentWidth = bool;
2401
+ this.enableClass("fit-width", this._fitContentWidth);
2402
+ }
2403
+ };
2404
+
2405
+ /** A plugin can be loaded only once
2406
+ * @public
2407
+ * @param {*} pluginRef Plugin/extension instance. Plugin or extension name (string) is deprecated in favor of html import syntax
2408
+ * @param {Object=} opt_options Option for initialize the given plugin
2409
+ * @return {*} Return the plugin that has been successfully loaded. Returns null if the plugin is not loaded
2410
+ * @example
2411
+ * core.loadPlugin(new InCellEditingExtension());
2412
+ */
2413
+ Core.prototype.loadPlugin = function (pluginRef, opt_options) {
2414
+ var pluginInstance = null;
2415
+ if (typeof pluginRef === "string") {
2416
+ var trNamespace = window["tr"];
2417
+ var gridNamespace = trNamespace ? trNamespace["grid"] : null;
2418
+ if(!gridNamespace) {
2419
+ return null;
2420
+ }
2421
+ if (gridNamespace[pluginRef]) {
2422
+ pluginInstance = new gridNamespace[pluginRef]();
2423
+ } else if (gridNamespace[pluginRef + "Plugin"] ) {
2424
+ pluginInstance = new gridNamespace[pluginRef + "Plugin"]();
2425
+ } else {
2426
+ return null;
2427
+ }
2428
+ } else {
2429
+ pluginInstance = pluginRef;
2430
+ }
2431
+
2432
+ if (!pluginInstance || !pluginInstance["getName"]) {
2433
+ return null;
2434
+ }
2435
+
2436
+ var pluginName = pluginInstance["getName"]();
2437
+ if(!pluginName) {
2438
+ return null;
2439
+ }
2440
+
2441
+ var prevInstance = this._plugins[pluginName];
2442
+ if (prevInstance) {
2443
+ if(prevInstance === pluginInstance) {
2444
+ return prevInstance; // The same instance is loaded twice
2445
+ }
2446
+ console.log("WARNING: Two of the same " + pluginName + "s cannot be loaded on a single grid. The existing plugin is replaced.");
2447
+ this.unloadPlugin(pluginName);
2448
+ }
2449
+
2450
+ if (pluginInstance["initialize"]) {
2451
+ pluginInstance["initialize"](this, opt_options);
2452
+ }
2453
+ this._plugins[pluginName] = pluginInstance;
2454
+
2455
+ return pluginInstance;
2456
+ };
2457
+ /** @public
2458
+ * @param {*} pluginRef Plugin name (string) or instance
2459
+ * @return {*|null}
2460
+ */
2461
+ Core.prototype.unloadPlugin = function (pluginRef) {
2462
+ var pluginInstance;
2463
+ if (pluginRef) {
2464
+ var pluginName = "";
2465
+ if (typeof pluginRef === "string") {
2466
+ pluginName = pluginRef;
2467
+ } else if (pluginRef["getName"]) {
2468
+ pluginName = pluginRef["getName"]();
2469
+ }
2470
+
2471
+ pluginInstance = this._plugins[pluginName];
2472
+ if(!pluginInstance) {
2473
+ pluginName += "Plugin";
2474
+ pluginInstance = this._plugins[pluginName];
2475
+ }
2476
+
2477
+ if (pluginInstance) {
2478
+ if (pluginInstance["unload"]) {
2479
+ pluginInstance["unload"](this);
2480
+ }
2481
+
2482
+ delete this._plugins[pluginName];
2483
+ }
2484
+ }
2485
+ return pluginInstance || null;
2486
+ };
2487
+ /** Return null if the specified plugin has not been loaded
2488
+ * @public
2489
+ * @param {string} pluginName
2490
+ * @return {*|null} plugin Return null if the specified plugin has not been loaded
2491
+ */
2492
+ Core.prototype.getPlugin = function (pluginName) {
2493
+ var p = this._plugins[pluginName];
2494
+ if (!p) {
2495
+ p = this._plugins[pluginName + "Plugin"];
2496
+ }
2497
+ return p || null;
2498
+ };
2499
+ /** Get a list of all plugin instances
2500
+ * @public
2501
+ * @return {!Array}
2502
+ */
2503
+ Core.prototype.getPlugins = function () {
2504
+ var list = [];
2505
+ for (var key in this._plugins) {
2506
+ list.push(this._plugins[key]);
2507
+ }
2508
+ return list;
2509
+ };
2510
+ /** Get a list of existing plugin names
2511
+ * @public
2512
+ * @return {!Array.<string>}
2513
+ */
2514
+ Core.prototype.getPluginList = function () {
2515
+ var list = [];
2516
+ for (var key in this._plugins) {
2517
+ list.push(key);
2518
+ }
2519
+ return list;
2520
+ };
2521
+
2522
+ /** Vertical scrollbar will automatically appear for the rest of the sections, when container of Grid does NOT have enough space for Grid's content.
2523
+ * @public
2524
+ * @param {(string|number|null)=} opt_frozenSection the last section that will be fixed in place. <br>
2525
+ * Negative value means applying the scrollbar to all sections. <br>
2526
+ * null value means disabling the feature.
2527
+ */
2528
+ Core.prototype.freezeSection = function (opt_frozenSection) {
2529
+ this._fixFrozenTopSections = true;
2530
+ this._freezeTopSectionAt(opt_frozenSection);
2531
+ };
2532
+
2533
+ /** Vertical scrollbar will automatically appear for the rest of the sections, when container of Grid does NOT have enough space for Grid's content.
2534
+ * @private
2535
+ * @param {(string|number|null)=} opt_frozenSection the last section that will be fixed in place. <br>
2536
+ * Negative value means applying the scrollbar to all sections. <br>
2537
+ * null value means disabling the feature.
2538
+ */
2539
+ Core.prototype._freezeTopSectionAt = function (opt_frozenSection) {
2540
+ if (typeof opt_frozenSection == "number") {
2541
+ var newIndex = opt_frozenSection + 1;
2542
+ if (newIndex === this._startVScrollbarIndex) return; // same position then do nothing
2543
+ this._startVScrollbarIndex = newIndex;
2544
+ } else {
2545
+ this._startVScrollbarIndex = -1;
2546
+ if (typeof opt_frozenSection == "string") {
2547
+ this._tempFrozenSectionRef = opt_frozenSection;
2548
+ }
2549
+ }
2550
+ this._onSectionCountChanged();
2551
+ };
2552
+
2553
+ /** @public
2554
+ * @param {number} frozenCount the amount of sections that will be fixed in place (from bottom up).
2555
+ */
2556
+ Core.prototype.freezeFooter = function (frozenCount) {
2557
+ this._fixFrozenBottomSection = true;
2558
+ if (this._frozenFooterCount === frozenCount) return;
2559
+ this._setFrozenFooter(frozenCount);
2560
+ this._onSectionCountChanged();
2561
+ };
2562
+ /** @private
2563
+ * @param {number} frozenCount
2564
+ */
2565
+ Core.prototype._setFrozenFooter = function (frozenCount) {
2566
+ if (this._frozenFooterCount === frozenCount) return;
2567
+ this._frozenFooterCount = frozenCount;
2568
+ this._vscrollbar.setFooterCount(frozenCount); // Vertical scrollbar needs to know number of body sections for framing (excluding header and footer sections)
2569
+ this._hscrollbar.setFooterCount(frozenCount); // Horizontal scrollbar needs this for determining the scrollbar track width
2570
+ };
2571
+
2572
+ /** @public
2573
+ * @return {number} Total footer count
2574
+ */
2575
+ Core.prototype.getFooterCount = function () {
2576
+ return this._frozenFooterCount;
2577
+ };
2578
+
2579
+ /** Left columns will be frozen and horizontal scrollbar will automatically appear for the rest columns. This will happens only when the container of grid does NOT have enough space for the grid's content.
2580
+ * @public
2581
+ * @param {(number|null)=} frozenColIndex Last column index to be fixed/pinned on the left side. <br>
2582
+ * Use negative value (-1) make horizontal scrollbar bar cover the first column. <br>
2583
+ * Use null value to disable the scrollbar
2584
+ * @param {number=} numRightColumn Number of columns on the right side to be fixed/pinned on the right side
2585
+ * @example
2586
+ * core.freezeColumn(0); // The first column is pinned to the left side
2587
+ * core.freezeColumn(1); // The first two columns are pinned to the left side
2588
+ * core.freezeColumn(-1); // Grid's horizontal scrollbar will cover entire are of the grid.
2589
+ * core.freezeColumn(null); // Turn off grid's horizontal scrollbar
2590
+ * core.freezeColumn(-1, 1); // The last column is pinned to the right side
2591
+ * core.freezeColumn(-1, 2); // The last two columns are pinned to the right side
2592
+ * core.freezeColumn(0, 2); // Grid's horizontal scrollbar will affect only the middle part
2593
+ */
2594
+ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
2595
+ if (frozenColIndex || frozenColIndex === 0) {
2596
+ this._startHScrollbarIndex = (frozenColIndex >= 0) ? frozenColIndex + 1 : 0;
2597
+ } else {
2598
+ if (frozenColIndex == null) {
2599
+ this._startHScrollbarIndex = 0;
2600
+ } else {
2601
+ this._startHScrollbarIndex = -1;
2602
+ this._hscrollbar.setScrollContent( // TODO: Check if this is needed
2603
+ this,
2604
+ this._getAllSections(),
2605
+ this.getColumnCount(),
2606
+ this._countPinnedRightColumns()
2607
+ );
2608
+ }
2609
+ }
2610
+ if(numRightColumn != null) {
2611
+ this._pinRightColumns(numRightColumn > 0 ? numRightColumn : 0);
2612
+ }
2613
+
2614
+ this._onColumnCountChanged(); // Activate horizontal scrollbar and column virtualization
2615
+ this._updateScrollbarWidth(true, true);
2616
+ };
2617
+ /** @private
2618
+ * @param {number} numRightColumn Number of columns on the right side to be fixed/pinned on the right side
2619
+ */
2620
+ Core.prototype._pinRightColumns = function (numRightColumn) {
2621
+ this._pinnedRightColumnCount = numRightColumn;
2622
+ var len = this.getColumnCount();
2623
+ for (var i = len; --i >= 0;) {
2624
+ var colDef = this._getColumnDef(i);
2625
+ if(--numRightColumn >= 0) {
2626
+ colDef.rightPinned = true;
2627
+ } else if(colDef.rightPinned) {
2628
+ colDef.rightPinned = false;
2629
+ }
2630
+ }
2631
+ };
2632
+
2633
+ /** @private
2634
+ * @return {number} numLeftColumn Number of columns on the left side to be fixed/pinned on the left side
2635
+ */
2636
+ Core.prototype._countPinnedLeftColumns = function () {
2637
+ return this._startHScrollbarIndex >= 0 ? this._startHScrollbarIndex : 0;
2638
+ };
2639
+ /** @private
2640
+ * @return {number} numRightColumn Number of columns on the right side to be fixed/pinned on the right side
2641
+ */
2642
+ Core.prototype._countPinnedRightColumns = function () {
2643
+ var sum = 0;
2644
+ for(var i = this._columnDefs.length; --i >= 0;) {
2645
+ var colDef = this._columnDefs[i];
2646
+ if(colDef && colDef.rightPinned) {
2647
+ ++sum;
2648
+ } else {
2649
+ break;
2650
+ }
2651
+ }
2652
+ return sum;
2653
+ };
2654
+
2655
+ /** @public
2656
+ * @param {number} colIndex
2657
+ * @return {boolean} return weather colIndex in pinned or not
2658
+ */
2659
+ Core.prototype.isPinnedColumn = function (colIndex) {
2660
+ return colIndex < this.getFrozenColumnCount() || colIndex >= this.getFirstPinnedRightIndex();
2661
+ };
2662
+ /** Returns number of pinned left columns.
2663
+ * @public
2664
+ * @return {number}
2665
+ */
2666
+ Core.prototype.getFrozenColumnCount = function() {
2667
+ var count = this._startHScrollbarIndex;
2668
+ //Count maybe < 0 in the cass that null is passed to core.freezeColumn(null);
2669
+ //which indicates that the HScrollbar is disabled
2670
+ if (count < 0) {
2671
+ count = 0;
2672
+ }
2673
+ return count;
2674
+ };
2675
+ /** Returns number of pinned left columns. This is an alias to getFrozenColumnCount
2676
+ * @public
2677
+ * @function
2678
+ * @return {number}
2679
+ */
2680
+ Core.prototype.getPinnedLeftColumnCount = Core.prototype.getFrozenColumnCount;
2681
+ /** Returns number of pinned right columns.
2682
+ * @public
2683
+ * @return {number}
2684
+ */
2685
+ Core.prototype.getPinnedRightColumnCount = function() {
2686
+ return this._pinnedRightColumnCount;
2687
+ };
2688
+ /** @public
2689
+ * @return {number} If there is no pinned right column, column count is returned
2690
+ */
2691
+ Core.prototype.getFirstPinnedRightIndex = function () {
2692
+ return this.getColumnCount() - this._pinnedRightColumnCount;
2693
+ };
2694
+
2695
+ /** Sometimes there is a change in layout without Grid noticing it (e.g tab pane is switched, or parent is hidden from view). <br>
2696
+ * Hence, the layout must be manually and explicitly update by calling this method.
2697
+ * @public
2698
+ * @fires Core#widthChanged
2699
+ */
2700
+ Core.prototype.updateLayout = function () {
2701
+ if(this._disposed || this._layoutUpdating) { return; }
2702
+ this._layoutUpdating = true;
2703
+
2704
+ this._dispatch("preForcedUpdate", {});
2705
+ this._updateLayout();
2706
+
2707
+ if(this._colVirtualizer.isEnabled()) {
2708
+ this._activateColumns();
2709
+ }
2710
+
2711
+ this._layoutUpdating = false;
2712
+ };
2713
+
2714
+ /** @public
2715
+ * @param {boolean} updateHeight
2716
+ * @param {boolean} updateWidth
2717
+ */
2718
+ Core.prototype.updateScrollbars = function(updateHeight, updateWidth) {
2719
+ if (updateWidth) {
2720
+ this._updateScrollbarWidth(true, false);
2721
+ }
2722
+
2723
+ if (updateHeight) {
2724
+ this._updateScrollbarHeight(true, false);
2725
+ }
2726
+ };
2727
+
2728
+ /** Stop grid from updating layout to improve performance during multiple layout changes. Unfreeze the layout once all changes have been made.
2729
+ * @public
2730
+ * @param {boolean=} opt_bool
2731
+ * @return {boolean} Previous freezing state (Used for restoring original state)
2732
+ * @fires Core#widthChanged
2733
+ * @see {@link Core#isLayoutFrozen}
2734
+ */
2735
+ Core.prototype.freezeLayout = function (opt_bool) {
2736
+ opt_bool = opt_bool !== false;
2737
+ var prevState = this._frozenLayout;
2738
+ if (prevState !== opt_bool) {
2739
+ this._frozenLayout = opt_bool;
2740
+
2741
+ if (!this._frozenLayout) {
2742
+ // Width has not yet changed so we need to disable it first
2743
+ this._disableEvent("widthChanged");
2744
+ this._onSectionCountChanged();
2745
+ this._onColumnCountChanged(); // Update horizontal scrollbar
2746
+ if(this._colVirtualizer.isEnabled()) {
2747
+ this._activateColumns();
2748
+ }
2749
+ }
2750
+
2751
+ this._rowHeightSync = false;
2752
+ var s, section;
2753
+ var sectionCount = this._settings.length;
2754
+ for (s = 0; s < sectionCount; s++) {
2755
+ section = this._settings[s].getSection();
2756
+ section.setFrozenLayout(this._frozenLayout);
2757
+ }
2758
+
2759
+ if (!this._frozenLayout) {
2760
+ this._syncLayoutToColumns(0, this.getColumnCount()); // Column layout should be synchronized after sections are unfrozen
2761
+ // Layout has been changed dispatch it
2762
+ this._disableEvent("widthChanged", false);
2763
+ this._dispatch("widthChanged", {});
2764
+
2765
+ var viewChanged = this._syncRowHeights();
2766
+ if(!viewChanged) { // Always update virtualizer
2767
+ this._rowVirtualizer.update(true); // Force section activation
2768
+ }
2769
+ }
2770
+ this._rowHeightSync = true;
2771
+ }
2772
+ return prevState;
2773
+ };
2774
+ /** Deprecated. Please use freezeLayout instead
2775
+ * @public
2776
+ * @param {boolean=} opt_bool
2777
+ * @fires Core#widthChanged
2778
+ * @see {@link Core#freezeLayout}
2779
+ */
2780
+ Core.prototype.unfreezeLayout = function (opt_bool) {
2781
+ this.freezeLayout(opt_bool === false);
2782
+ };
2783
+ /** @public
2784
+ * @return {boolean}
2785
+ */
2786
+ Core.prototype.isLayoutFrozen = function () {
2787
+ return this._frozenLayout;
2788
+ };
2789
+
2790
+ /** Deprecated
2791
+ * @public
2792
+ * @function
2793
+ * @param {boolean=} opt_shown
2794
+ * @see {@link Core#toggleBorders}
2795
+ */
2796
+ Core.prototype.showBorders = Util._deprecatedFunction;
2797
+ /** Deprecated
2798
+ * @public
2799
+ * @function
2800
+ * @param {boolean=} opt_hidden
2801
+ * @see {@link Core#toggleBorders}
2802
+ */
2803
+ Core.prototype.hideBorders = Util._deprecatedFunction;
2804
+ /** Toggle borders around core grid element. WARNING: You will need to manually call updateLayout() method, if you call this method at run-time
2805
+ * @public
2806
+ * @param {boolean=} forcedVal If value is true, show border lines, otherwise hide them
2807
+ */
2808
+ Core.prototype.toggleBorders = function(forcedVal) {
2809
+ this.toggleClass("no-borders", forcedVal != null ? !forcedVal : null);
2810
+ };
2811
+ /** Toggle both horizontal and vertical gridlines. This applies to ONLY content sections.
2812
+ * @public
2813
+ * @param {boolean=} forcedVal If value is true, show gridlines, otherwise hide them
2814
+ */
2815
+ Core.prototype.toggleGridlines = function(forcedVal) {
2816
+ this.toggleClass("no-gridlines", forcedVal != null ? !forcedVal : null);
2817
+ };
2818
+ /** Toggle vertical gridlines. This applies to all sections.
2819
+ * @public
2820
+ * @param {boolean=} forcedVal If value is true, show vertical lines, otherwise hide them
2821
+ */
2822
+ Core.prototype.toggleVerticalLines = function(forcedVal) {
2823
+ this.toggleClass("no-vertical-grid-line", forcedVal != null ? !forcedVal : null);
2824
+ };
2825
+ /** Toggle horizontal gridlines. This applies to all sections.
2826
+ * @public
2827
+ * @param {boolean=} forcedVal If value is true, show horizontal lines, otherwise hide them
2828
+ */
2829
+ Core.prototype.toggleHorizontalLines = function(forcedVal) {
2830
+ this.toggleClass("no-horizontal-grid-line", forcedVal != null ? !forcedVal : null);
2831
+ };
2832
+
2833
+ /** @public
2834
+ * @return {Array.<string>}
2835
+ */
2836
+ Core.prototype.getDataColumnMap = function () {
2837
+ var dataMap = [];
2838
+ for (var i = this.getColumnCount(); --i >= 0; ) {
2839
+ dataMap[i] = this.getDataColumnName(i);
2840
+ }
2841
+ return dataMap;
2842
+ };
2843
+ /** For indirectional one to one data binding
2844
+ * @public
2845
+ * @param {Array.<string>=} opt_dataMap index in the array will be matched with the display column
2846
+ */
2847
+ Core.prototype.setDataColumnMap = function (opt_dataMap) {
2848
+ var i, colDef;
2849
+ if (opt_dataMap) {
2850
+ for (i = opt_dataMap.length; --i >= 0; ) {
2851
+ colDef = this._getColumnDef(i);
2852
+ colDef["dataColumnName"] = opt_dataMap[i];
2853
+ }
2854
+ } else {
2855
+ for (i = this._columnDefs.length; --i >= 0; ) {
2856
+ colDef = this._columnDefs[i];
2857
+ if (colDef && colDef["dataColumnName"] != null) {
2858
+ colDef["dataColumnName"] = null;
2859
+ }
2860
+ }
2861
+ }
2862
+ };
2863
+ /** @public
2864
+ * @param {number} colIndex
2865
+ * @return {string}
2866
+ */
2867
+ Core.prototype.getDataColumnName = function (colIndex) {
2868
+ var colDef = this._getColumnDef(colIndex);
2869
+ var dataColumnName = colDef["dataColumnName"];
2870
+ return dataColumnName || "";
2871
+ };
2872
+ /** @public
2873
+ * @param {number} colIndex
2874
+ * @param {(string|null)=} opt_dataColumnName Use string for normal mapping, null to disable, and undefined for default mapping
2875
+ */
2876
+ Core.prototype.setDataColumnName = function (colIndex, opt_dataColumnName) {
2877
+ this._getColumnDef(colIndex)["dataColumnName"] = opt_dataColumnName;
2878
+ };
2879
+
2880
+ /** If the given column has no rendering handler, this default handler will be executed instead
2881
+ * @public
2882
+ * @param {Function} handler that takes json object as a first parameter
2883
+ * @see {Core#setColumnRenderingHandler}
2884
+ */
2885
+ Core.prototype.setDefaultRenderingHandler = function (handler) {
2886
+ this._renderingHandler = (typeof handler === "function") ? handler : null;
2887
+ };
2888
+ /** If the given column has no data binding handler, this handler will be executed instead
2889
+ * @public
2890
+ * @param {Function} handler that takes json object as a first parameter
2891
+ * @see {Core#setColumnDataBindingHandler}
2892
+ */
2893
+ Core.prototype.setDefaultDataBindingHandler = function (handler) {
2894
+ this._dataBindingHandler = (typeof handler === "function") ? handler : null;
2895
+ };
2896
+ /** @public
2897
+ * @param {number} c
2898
+ * @param {*} func
2899
+ * @see {Core#setDefaultRenderingHandler}
2900
+ */
2901
+ Core.prototype.setColumnRenderingHandler = function(c, func) {
2902
+ this._getColumnDef(c)["renderingHandler"] = (typeof func === "function") ? func : null;
2903
+ };
2904
+ /** @public
2905
+ * @param {number} c
2906
+ * @param {*} func
2907
+ * @see {Core#setDefaultDataBindingHandler}
2908
+ */
2909
+ Core.prototype.setColumnDataBindingHandler = function(c, func) {
2910
+ this._getColumnDef(c)["dataBindingHandler"] = (typeof func === "function") ? func : null;
2911
+ };
2912
+ /** @public
2913
+ * @param {number} c
2914
+ * @return {Function} func
2915
+ */
2916
+ Core.prototype.getColumnRenderingHandler = function(c) {
2917
+ return this._getColumnDef(c)["renderingHandler"] || null;
2918
+ };
2919
+ /** @public
2920
+ * @param {number} c
2921
+ * @return {Function} func
2922
+ */
2923
+ Core.prototype.getColumnDataBindingHandler = function(c) {
2924
+ return this._getColumnDef(c)["dataBindingHandler"] || null;
2925
+ };
2926
+
2927
+ /** Rows will be highlighted when mouse is hoved over rows. This will works only with content section
2928
+ * @public
2929
+ * @param {boolean=} opt_enabled
2930
+ */
2931
+ Core.prototype.enableRowHighlighting = function (opt_enabled) {
2932
+ if (opt_enabled == null) { opt_enabled = true; }
2933
+
2934
+ if (this._rowHighlighting !== opt_enabled) {
2935
+ this._rowHighlighting = opt_enabled;
2936
+ var contentSections = this.getAllSections("content");
2937
+ for (var i = contentSections.length; --i >= 0; ) {
2938
+ contentSections[i].enableRowHighlighting(this._rowHighlighting);
2939
+ }
2940
+ }
2941
+ };
2942
+
2943
+ /** Get target from the given object for hit testing
2944
+ * @private
2945
+ * @param {!ElementWrapper|Element|Event|MouseEvent} obj Element, Browser's Event object, Browser's Mouse Event object are all valid
2946
+ * @return {Element}
2947
+ */
2948
+ Core.prototype._getTarget = function (obj) {
2949
+ var targetEl = /** @type{Element} */(obj["target"]);
2950
+ if(targetEl) { // The Given object is an Event object
2951
+ var path = null;
2952
+ if(!this._element.contains(targetEl)) {
2953
+ if(obj["composedPath"]) { // Handle the case where grid is used in the Shadow Dom
2954
+ path = /** @type{Array.<Element>} */(obj["composedPath"]());
2955
+ } else { // 'path' property is an alternative to composedPath, but it is a non-standard property
2956
+ path = /** @type{Array.<Element>} */(obj["path"]);
2957
+ }
2958
+ }
2959
+ if(path) {
2960
+ return path[0] || null;
2961
+ } else {
2962
+ return targetEl;
2963
+ }
2964
+ } else {
2965
+ if(obj["getElement"]) { // The Given object is implementing ElementWrapper
2966
+ return /** @type{Element} */(obj["getElement"]());
2967
+ } else if(Util.isElement(obj)){ // The Given object is just an element
2968
+ return /** @type{Element} */(obj);
2969
+ }
2970
+ }
2971
+ return null;
2972
+ };
2973
+ /** Return all information, from Grid and its internal components, related to the given position.
2974
+ * @public
2975
+ * @param {!ElementWrapper|Element|Event|MouseEvent} obj Element, Browser's Event object, Browser's Mouse Event object are all valid
2976
+ * @param {Object=} context An object that stores returned values
2977
+ * @return {!Core.MouseInfo}
2978
+ */
2979
+ Core.prototype.getRelativePosition = function (obj, context) {
2980
+ if(!obj) {
2981
+ return {};
2982
+ }
2983
+
2984
+ var ret_obj = context || {};
2985
+ var targetEl = this._getTarget(obj);
2986
+
2987
+ // Calculate object's x and y coordinates that are relative to the top left of this grid
2988
+ if(obj["target"]) { // The Given object is an Event object
2989
+ Util.getRelativePosition(/** @type{Event} */(obj), this.getElement(), ret_obj);
2990
+ } else if(targetEl) {
2991
+ Util.getRelativePosition(targetEl, this.getElement(), ret_obj);
2992
+ }
2993
+
2994
+ // The coordinates must be scaled by the zoom factor
2995
+ if (this._zoomFactor !== 1) {
2996
+ ret_obj["x"] /= this._zoomFactor;
2997
+ ret_obj["y"] /= this._zoomFactor;
2998
+ }
2999
+
3000
+ ret_obj["hit"] = false;
3001
+ ret_obj["grid"] = this;
3002
+ ret_obj["clientX"] = obj["clientX"];
3003
+ ret_obj["clientY"] = obj["clientY"];
3004
+ ret_obj["zoomFactor"] = this._zoomFactor;
3005
+
3006
+ // Find cell element
3007
+ var cellElement = Util.closestElement(targetEl, "cell");
3008
+ if(!cellElement) {
3009
+ return ret_obj;
3010
+ }
3011
+ ret_obj["cellElement"] = cellElement;
3012
+
3013
+ // Find column element
3014
+ var colElement = Util.closestElement(cellElement, "column");
3015
+ ret_obj["columnElement"] = colElement;
3016
+
3017
+ // Find section element
3018
+ var sectionElement = null;
3019
+ if (colElement) {
3020
+ // Column element may not be in the document (the column could be hidden)
3021
+ sectionElement = Util.closestElement(colElement, "tr-lg");
3022
+ } else {
3023
+ // Floating cell does have the column
3024
+ sectionElement = Util.closestElement(cellElement, "tr-lg");
3025
+ }
3026
+
3027
+ if(!sectionElement) {
3028
+ return ret_obj;
3029
+ }
3030
+ ret_obj["sectionName"] = sectionElement["id"] || Util.closestElement(sectionElement, "tr-vlg")["id"];
3031
+
3032
+ var sectionSettings = this.getSectionSettings(ret_obj["sectionName"]);
3033
+ if (!sectionSettings) {
3034
+ return ret_obj; // Cannot find a section from the given id
3035
+ }
3036
+ sectionSettings.extendEventArg(ret_obj);
3037
+
3038
+ // Find column index
3039
+ var section = sectionSettings.getSection();
3040
+ var colIndex = section.getColumnIndex(colElement || cellElement);
3041
+ if (colIndex < 0) {
3042
+ return ret_obj; // The given columnElement does not resolve in any column index
3043
+ }
3044
+ ret_obj["colIndex"] = colIndex;
3045
+
3046
+ // Find row index
3047
+ if (this._hitTestY(-1, ret_obj) === false) { // hitTestY requires only sectionSettings, colIndex, and cellElement
3048
+ return ret_obj;
3049
+ }
3050
+
3051
+ if(cellElement["stretched"]) {
3052
+ ret_obj["cell"] = section.getStretchedCell(colIndex, ret_obj["rowIndex"]);
3053
+ } else {
3054
+ ret_obj["cell"] = section.getCell(colIndex, ret_obj["rowIndex"]);
3055
+ }
3056
+ ret_obj["hit"] = true;
3057
+ return ret_obj;
3058
+ };
3059
+
3060
+ /** @public
3061
+ * @param {string} str data column name
3062
+ * @return {number} Return negative if the mouse is not hit
3063
+ */
3064
+ Core.prototype.getColumnIndex = function (str) {
3065
+ for(var c = this.getColumnCount(); --c >= 0;) {
3066
+ if(str === this.getDataColumnName(c)) {
3067
+ return c;
3068
+ }
3069
+ }
3070
+ return -1;
3071
+ };
3072
+
3073
+ /** @public
3074
+ * @return {!ElementWrapper}
3075
+ */
3076
+ Core.prototype.getVScrollbar = function () {
3077
+ return this._vscrollbar;
3078
+ };
3079
+ /** @public
3080
+ * @return {!ElementWrapper}
3081
+ */
3082
+ Core.prototype.getHScrollbar = function () {
3083
+ return this._hscrollbar;
3084
+ };
3085
+ /** @public
3086
+ * @param {boolean=} opt_hide True if autohide (default) or false to keep scrollbars permanently
3087
+ */
3088
+ Core.prototype.autoHideScrollbars = function(opt_hide){
3089
+ opt_hide = opt_hide != null ? opt_hide : true;
3090
+ this._vscrollbar.setAutoHide(opt_hide);
3091
+ this._hscrollbar.setAutoHide(opt_hide);
3092
+ };
3093
+ /** @public
3094
+ * @ignore
3095
+ * @return {number}
3096
+ */
3097
+ Core.prototype.getVScrollStartIndex = function () {
3098
+ return this._startVScrollbarIndex;
3099
+ };
3100
+ /** @public
3101
+ * @ignore
3102
+ * @return {number}
3103
+ */
3104
+ Core.prototype.getHScrollStartIndex = function () {
3105
+ return this._startHScrollbarIndex;
3106
+ };
3107
+ /** @public
3108
+ * @param {number} colIndex
3109
+ * @param {boolean=} leftOfView Default is false. If true, always make to specified column at the left most of the view.
3110
+ * @return {boolean} Return true, if there is any change
3111
+ */
3112
+ Core.prototype.scrollToColumn = function (colIndex, leftOfView) {
3113
+ if(!this._updateScrollbar(this._hscrollbar)) {
3114
+ return false;
3115
+ }
3116
+
3117
+ var colCount = this._layoutX.getLaneCount();
3118
+ if (colIndex <= 0) {
3119
+ colIndex = 0;
3120
+ } else if (colIndex >= colCount) {
3121
+ colIndex = colCount - 1;
3122
+ }
3123
+ if(this.isPinnedColumn(colIndex)) {
3124
+ return false;
3125
+ }
3126
+
3127
+ var widthOffset = this._startHScrollbarIndex > 0 ? this._layoutX.getLaneStart(this._startHScrollbarIndex) : 0;
3128
+ var scrollLeft = this._hscrollbar.getScrollLeft();
3129
+ var viewLeft = scrollLeft + widthOffset;
3130
+ var viewWidth = this._hscrollbar.getWidth();
3131
+ var viewTopIndex = this._layoutX.hitTest(viewLeft);
3132
+ var laneLeft = this._layoutX.getLaneStart(colIndex);
3133
+ var laneSize = this._layoutX.getLaneSize(colIndex);
3134
+
3135
+ if (leftOfView || laneSize >= viewWidth || colIndex <= viewTopIndex) {
3136
+ var toLeftOfView = laneLeft - widthOffset;
3137
+ if(scrollLeft !== toLeftOfView) {
3138
+ this._hscrollbar.setScrollLeft(toLeftOfView);
3139
+ return true;
3140
+ }
3141
+ } else {
3142
+ var viewRight = viewLeft + viewWidth;
3143
+ var viewRightIndex = this._layoutX.hitTest(viewRight - 0.1);
3144
+ if (colIndex >= viewRightIndex) {
3145
+ var laneRight = laneLeft + laneSize;
3146
+ var toEndOfView = scrollLeft + laneRight - viewRight; // Fit end of column into the view
3147
+
3148
+ this._hscrollbar.setScrollLeft(toEndOfView);
3149
+ return true;
3150
+ }
3151
+ }
3152
+ return false;
3153
+ };
3154
+ /** @public
3155
+ * @override
3156
+ * @return {number} pixels
3157
+ */
3158
+ Core.prototype.getScrollLeft = function () {
3159
+ return this._updateScrollbar(this._hscrollbar) ? this._hscrollbar.getScrollLeft() : 0;
3160
+ };
3161
+ /** @public
3162
+ * @param {number} pixels
3163
+ */
3164
+ Core.prototype.setScrollLeft = function (pixels) {
3165
+ if(!this._updateScrollbar(this._hscrollbar)) {
3166
+ return;
3167
+ }
3168
+
3169
+ this._hscrollbar.setScrollLeft(pixels);
3170
+ };
3171
+ /** @public
3172
+ * @param {number} pixels
3173
+ */
3174
+ Core.prototype.scrollRight = function (pixels) {
3175
+ this.setScrollLeft(this._hscrollbar.getScrollLeft() + pixels);
3176
+ };
3177
+ /** @public
3178
+ * @returns {number}
3179
+ */
3180
+ Core.prototype.getScrollWidth = function () {
3181
+ if(!this._updateScrollbar(this._hscrollbar)) {
3182
+ return 0;
3183
+ }
3184
+ return this._hscrollbar.getContentWidth();
3185
+ };
3186
+ /** Return the scroll value (in pixels) to make specified row visible in the view
3187
+ * @public
3188
+ * @param {Core.SectionReference} sectionRef Specify section that the given rowIndex is related to. Use null for the first scrollable section (first non-frozen section)
3189
+ * @param {number} rowIndex
3190
+ * @param {boolean=} topOfView=false. If true, Make to specified row at the top of the view.
3191
+ * @returns {number|null} The scroll value (in pixels)
3192
+ */
3193
+ Core.prototype.getYScrollVal = function (sectionRef, rowIndex, topOfView) {
3194
+ if(!this._updateScrollbar(this._vscrollbar)) {
3195
+ return null;
3196
+ }
3197
+ var section = null;
3198
+ if(sectionRef) {
3199
+ section = this.getSection(sectionRef);
3200
+ }
3201
+
3202
+ var rowCount = this._layoutY.getLaneCount();
3203
+ var rowIndexOffset = (section) ? section.getRowOffset() : this._sectionStarts[this._startVScrollbarIndex];
3204
+
3205
+ if(rowIndexOffset) {
3206
+ rowIndex += rowIndexOffset;
3207
+ }
3208
+ if (rowIndex <= 0) { rowIndex = 0; }
3209
+ else if (rowIndex >= rowCount) { rowIndex = rowCount - 1; }
3210
+
3211
+ var heightOffset = this._layoutY.getLaneStart(rowIndexOffset);
3212
+ var scrollTop = this._vscrollbar.getScrollTop();
3213
+ var viewTop = scrollTop + heightOffset;
3214
+ var viewTopIndex = section ? section.getFirstIndexInView() : this._layoutY.hitTest(viewTop); // TODO: Make it work in zooming mode
3215
+
3216
+ var scrollIndex = -1;
3217
+ if (topOfView) {
3218
+ scrollIndex = rowIndex;
3219
+ } else {
3220
+ if(rowIndex <= viewTopIndex) { // Scroll up
3221
+ scrollIndex = rowIndex - 3; // Have some spaces at the top for more appealing visual
3222
+ if(scrollIndex < 0) {
3223
+ scrollIndex = 0;
3224
+ }
3225
+ } else { // Scroll down
3226
+ var viewHeight = this._vscrollbar.getHeight();
3227
+ var viewBottom = viewTop + viewHeight;
3228
+ var viewBottomIndex = section ? section.getLastIndexInView() : this._layoutY.hitTest(viewBottom - 0.1);
3229
+ if (rowIndex >= viewBottomIndex) {
3230
+ var viewIndexSize = viewBottomIndex - viewTopIndex;
3231
+ scrollIndex = rowIndex - viewIndexSize + 3;
3232
+ if(scrollIndex < 0) {
3233
+ scrollIndex = 0;
3234
+ }
3235
+ }
3236
+ }
3237
+ }
3238
+
3239
+ return (scrollIndex >= 0) ? (this._layoutY.getLaneStart(scrollIndex) - heightOffset) : null;
3240
+ };
3241
+ /** Scroll up or down to make specified row visible in the view
3242
+ * @public
3243
+ * @param {Core.SectionReference} sectionRef Specify section that the given rowIndex is related to. Use null for the first scrollable section (first non-frozen section)
3244
+ * @param {number} rowIndex
3245
+ * @param {boolean=} topOfView=false. If true, Make to specified row at the top of the view.
3246
+ */
3247
+ Core.prototype.scrollToRow = function (sectionRef, rowIndex, topOfView) {
3248
+ var scrollVal = this.getYScrollVal(sectionRef, rowIndex, topOfView);
3249
+ if(scrollVal !== null) {
3250
+ this._vscrollbar.setScrollTop(scrollVal);
3251
+ }
3252
+ };
3253
+ /** @public
3254
+ * @return {Object} Returns null if vscrollbar does not exists
3255
+ */
3256
+ Core.prototype.getVScrollView = function () {
3257
+ if(!this._updateScrollbar(this._vscrollbar)) {
3258
+ return null;
3259
+ }
3260
+
3261
+ var rowCount = this._layoutY.getLaneCount();
3262
+ if (rowCount === 0) { return null; }
3263
+
3264
+ var rowIndexOffset = this._sectionStarts[this._startVScrollbarIndex];
3265
+ var heightOffset = this._layoutY.getLaneStart(rowIndexOffset);
3266
+ var viewTop = this._vscrollbar.getScrollTop() + heightOffset;
3267
+ var viewHeight = this._vscrollbar.getHeight();
3268
+ var viewBottom = viewTop + viewHeight;
3269
+ var topRowIndex = this._layoutY.hitTest(viewTop);
3270
+ var bottomRowIndex = this._layoutY.hitTest(viewBottom - 0.1);
3271
+
3272
+ var laneTop = this._layoutY.getLaneStart(topRowIndex);
3273
+ var laneBottom = this._layoutY.getLaneEnd(bottomRowIndex);
3274
+
3275
+ var prevAnchor = viewTop - viewHeight;
3276
+ var prevPage = (prevAnchor <= heightOffset) ? rowIndexOffset : this._layoutY.hitTest(prevAnchor) + 1;
3277
+ var nextAnchor = viewBottom + viewHeight;
3278
+ var trackSize = this._layoutY.getTrackSize();
3279
+ var nextPage = (nextAnchor >= trackSize) ? rowCount - 1 : this._layoutY.hitTest(nextAnchor - 0.1) - 1;
3280
+
3281
+ topRowIndex -= rowIndexOffset;
3282
+ bottomRowIndex -= rowIndexOffset;
3283
+ var obj = {};
3284
+ obj["viewTop"] = viewTop - heightOffset;
3285
+ obj["viewBottom"] = viewBottom - heightOffset;
3286
+ obj["topRowIndex"] = topRowIndex;
3287
+ obj["bottomRowIndex"] = bottomRowIndex;
3288
+ obj["firstFullRow"] = (laneTop < viewTop) ? topRowIndex + 1 : topRowIndex;
3289
+ obj["lastFullRow"] = (laneBottom > viewBottom) ? bottomRowIndex - 1 : bottomRowIndex;
3290
+ obj["prevPageRowIndex"] = prevPage - rowIndexOffset;
3291
+ obj["nextPageRowIndex"] = nextPage - rowIndexOffset;
3292
+ return obj;
3293
+ };
3294
+ /** @public
3295
+ * @override
3296
+ * @return {number} pixels
3297
+ */
3298
+ Core.prototype.getScrollTop = function () {
3299
+ return this._updateScrollbar(this._vscrollbar) ? this._vscrollbar.getScrollTop() : 0;
3300
+ };
3301
+ /** @public
3302
+ * @param {number} pixels
3303
+ */
3304
+ Core.prototype.setScrollTop = function (pixels) {
3305
+ if(!this._updateScrollbar(this._vscrollbar)) {
3306
+ return;
3307
+ }
3308
+
3309
+ this._vscrollbar.setScrollTop(pixels);
3310
+ };
3311
+ /** @public
3312
+ * @param {number} pixels
3313
+ */
3314
+ Core.prototype.scrollDown = function (pixels) {
3315
+ this.setScrollTop(this._vscrollbar.getScrollTop() + pixels);
3316
+ };
3317
+ /** @public
3318
+ * @returns {number}
3319
+ */
3320
+ Core.prototype.getScrollHeight = function () {
3321
+ if(!this._updateScrollbar(this._vscrollbar)) {
3322
+ return 0;
3323
+ }
3324
+ return this._vscrollbar.getContentHeight();
3325
+ };
3326
+
3327
+ /** @public
3328
+ * @ignore
3329
+ * @param {boolean} bool
3330
+ */
3331
+ Core.prototype.enableAutoSetDataSource = function (bool) {
3332
+ this._autoSetDataSource = bool;
3333
+ };
3334
+
3335
+ /** @public
3336
+ * @return {!Virtualizer}
3337
+ */
3338
+ Core.prototype.getRowVirtualizer = function () {
3339
+ return this._rowVirtualizer;
3340
+ };
3341
+
3342
+
3343
+ /** @public
3344
+ * @return {!Virtualizer}
3345
+ */
3346
+ Core.prototype.getColumnVirtualizer = function () {
3347
+ return this._colVirtualizer;
3348
+ };
3349
+
3350
+ /** No runtime support
3351
+ * @public
3352
+ * @param {boolean} opt_enabled
3353
+ */
3354
+ Core.prototype.enableRowVirtualization = function (opt_enabled) {
3355
+ this._rowVirtualizer.enable(opt_enabled);
3356
+ if (this._rowVirtualizer.isEnabled()) {
3357
+ if (this._vscrollbar.isEnabled()) {
3358
+ this._rowVirtualizer.activate();
3359
+ } else {
3360
+ this._rowVirtualizer.deactivate();
3361
+ }
3362
+ } else {
3363
+ this._rowVirtualizer.deactivate();
3364
+ }
3365
+ };
3366
+ /** No runtime support
3367
+ * @public
3368
+ * @param {boolean=} opt_enabled
3369
+ */
3370
+ Core.prototype.enableColumnVirtualization = function (opt_enabled) {
3371
+ this._colVirtualizer.enable(opt_enabled);
3372
+
3373
+ var colVir = this._colVirtualizer.isEnabled();
3374
+ for (var i = this._settings.length; --i >= 0; ) {
3375
+ var sectionSettings = this._settings[i];
3376
+ sectionSettings.enableColumnVirtualization(colVir);
3377
+ }
3378
+ };
3379
+
3380
+ /** Scrolling step will be multiple of the default row height in pixels. For example, if default row height is 32 pixel and row scrolling step is 2, <br>
3381
+ * then the actual scrolling step for vertical scrollbar will be (32 * 2) = 64 pixels
3382
+ * @public
3383
+ * @param {number} rowCount Number of rows for a single scrolling step. Use zero to disable this feature.
3384
+ */
3385
+ Core.prototype.setRowScrollingStep = function (rowCount) {
3386
+ this._rowScrollingStep = (rowCount > 0) ? rowCount : 0;
3387
+ this._vscrollbar.setScrollingStep(this._layoutY.getDefaultLaneSize() * this._rowScrollingStep);
3388
+ };
3389
+
3390
+ /** Allows other elements such as background to accept wheel event and scroll grid's vertical scrollbar
3391
+ * @public
3392
+ * @return {function(Event)}
3393
+ */
3394
+ Core.prototype.getVMouseWheelHandler = function () {
3395
+ return this._vscrollbar.getDefaultMouseWheelLogic();
3396
+ };
3397
+ /** Synchronize two vertical scrollbars of two grid, by hiding its scrollbar and using the one from the given grid
3398
+ * @public
3399
+ * @param {Core} subGrid
3400
+ */
3401
+ Core.prototype.synchronizeVScrollbar = function (subGrid) {
3402
+ subGrid.unlisten("mousemove", subGrid._onMouseMove);
3403
+ subGrid.listen("mousemove", this._onMouseMove);
3404
+
3405
+ var vscrollbar = subGrid.getVScrollbar();
3406
+ vscrollbar._mainScrollbar = this._vscrollbar; // HACK
3407
+
3408
+ vscrollbar.setStyle("visibility", "hidden");
3409
+ vscrollbar.setStyle("pointerEvents", "none");
3410
+ vscrollbar.disableMouseWheel(); // Disable sub-grid wheel behavior
3411
+ vscrollbar.attachToExternalElement(this._vscrollbar.getParent()); // MouseWheel event is still available on the main
3412
+
3413
+ // TODO: Check if we need to re-append this._vscrollbar to move it to the front over other grid elements.
3414
+ this._vscrollbar.listen("scroll", subGrid._onSyncVScroll);
3415
+ };
3416
+
3417
+ /** Fires data binding event without actual change in the data source. <br>
3418
+ * This will force visual elements to be re-rendered with the latest data in the data source.
3419
+ * @public
3420
+ * @param {Core.SectionReference=} sectionRef If not defined, "content" is used
3421
+ * @param {number=} fromRowIndex INCLUSIVE If the value is undefined, the first row index will be used
3422
+ * @param {number=} lastRowIndex INCLUSIVE If the value is undefined, the last row index will be used
3423
+ * @param {Object=} userParam Addtional parameters to be fired with the event
3424
+ * @fires Core#preSectionDataBinding
3425
+ * @fires Core#columnDataBinding
3426
+ * @fires Core#postSectionDataBinding
3427
+ */
3428
+ Core.prototype.updateRowData = function (sectionRef, fromRowIndex, lastRowIndex, userParam) {
3429
+ var ss = this.getSectionSettings(sectionRef || "content");
3430
+ if (ss) {
3431
+ ss.updateRowData(fromRowIndex, lastRowIndex, userParam);
3432
+ }
3433
+ };
3434
+ /** Re-render all sections (headers and contents) in grid. Layout will not be affected by this method
3435
+ * @public
3436
+ */
3437
+ Core.prototype.rerender = function () {
3438
+ var sectionCount = this._settings.length;
3439
+ for (var s = 0; s < sectionCount; s++) { // for each section
3440
+ this._settings[s].rerender();
3441
+ }
3442
+ };
3443
+ /** Set a timer to call updateRowData only once to avoid performance issue due to multiple call of updateRowData()
3444
+ * @public
3445
+ */
3446
+ Core.prototype.requestRowRefresh = function() {
3447
+ if(!this._rowRefreshTimer) {
3448
+ this._rowRefreshTimer = setTimeout(this._onRowRefresh, 100);
3449
+ }
3450
+ };
3451
+
3452
+ /** prevent bind data process
3453
+ * @public
3454
+ * @param {boolean=} disabled
3455
+ */
3456
+ Core.prototype.deactivateRendering = function(disabled) {
3457
+ disabled = disabled !== false;
3458
+
3459
+ // if option value not changed then do nothing
3460
+ if (disabled == this._noBinding) return;
3461
+
3462
+ this._noBinding = disabled;
3463
+ var contentSection = this.getSectionSettings("content");
3464
+ if (!contentSection) return;
3465
+
3466
+ contentSection.disableDataBinding(disabled);
3467
+
3468
+ if (!disabled) {
3469
+ this.requestRowRefresh();
3470
+ }
3471
+ };
3472
+
3473
+ /** @private */
3474
+ Core.prototype._onRowRefresh = function() {
3475
+ this._rowRefreshTimer = 0;
3476
+ this.updateRowData();
3477
+ };
3478
+
3479
+ /** @public
3480
+ * @ignore
3481
+ * @param {boolean=} opt_bool
3482
+ */
3483
+ Core.prototype.disableLazyRendering = function(opt_bool) {
3484
+ console.log("WARNING: This function is deprecated.");
3485
+ };
3486
+
3487
+ /** @param {Core.SectionReference} sectionRef
3488
+ * @param {number|string} colRef Either column index or data column name
3489
+ * @param {number|string} rowRef Row Index of the display section or row id of the data table
3490
+ * @return {*} Returns undefined if not success
3491
+ */
3492
+ Core.prototype.getData = function (sectionRef, colRef, rowRef) {
3493
+ var sectionSettings = this.getSectionSettings(sectionRef);
3494
+ if (!sectionSettings) { return null; }
3495
+
3496
+ var colName = this._toDataColumnName(colRef);
3497
+
3498
+ return sectionSettings.getData(colName, rowRef);
3499
+ };
3500
+ /** Do not used this method too often. This method is slow. It is always better to set data directly to the data table
3501
+ * @param {Core.SectionReference} sectionRef
3502
+ * @param {number|string} colRef Either column index or data column name
3503
+ * @param {number|string} rowRef Row Index of the display section or row id of the data table
3504
+ * @param {*} data
3505
+ * @return {boolean} True for successful data setting
3506
+ */
3507
+ Core.prototype.setData = function (sectionRef, colRef, rowRef, data) {
3508
+ var sectionSettings = this.getSectionSettings(sectionRef);
3509
+ if (sectionSettings && sectionSettings.isDataBindable()) {
3510
+ var colName = this._toDataColumnName(colRef);
3511
+ return sectionSettings.setData(colName, rowRef, data);
3512
+ }
3513
+ return false;
3514
+ };
3515
+
3516
+ /** Do not used this method too often. This method is slow. It is always better to set data directly to the data table
3517
+ * @param {Core.SectionReference} sectionRef
3518
+ * @param {number|string} rowRef Row Index of the display section or row id of the data table
3519
+ * @return {boolean} True for successful data setting
3520
+ */
3521
+ Core.prototype.removeRowData = function (sectionRef, rowRef) {
3522
+ var sectionSettings = this.getSectionSettings(sectionRef);
3523
+ if (sectionSettings && sectionSettings.isDataBindable()) {
3524
+ return sectionSettings.removeRowData(rowRef);
3525
+ }
3526
+ return false;
3527
+ };
3528
+
3529
+ /** @param {string} method */
3530
+ Core.prototype.setHidingMethod = function (method) {
3531
+ if(!method) { method = ""; }
3532
+ if(this._hidingMethod !== method) {
3533
+ this._hidingMethod = method;
3534
+ var sections = this.getAllSections();
3535
+ for(var i = sections.length; --i >= 0;) {
3536
+ sections[i].setHidingMethod(method);
3537
+ }
3538
+ }
3539
+ };
3540
+
3541
+ /** @public
3542
+ * @ignore
3543
+ * @return {!TrackLayout}
3544
+ */
3545
+ Core.prototype.getHorizontalLayout = function () {
3546
+ return this._layoutX;
3547
+ };
3548
+ /** @public
3549
+ * @ignore
3550
+ * @param {number} colIndex
3551
+ * @param {boolean} bool
3552
+ * @param {number} flag Default is 0
3553
+ * @return {boolean}
3554
+ */
3555
+ Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
3556
+ if (this._layoutX.hideLane(colIndex, !bool, flag)) {
3557
+ this._syncLayoutToColumns(colIndex, colIndex + 1);
3558
+
3559
+ if (bool) { // If column turns back to visible, update ui. TODO: This will cause a rendering issue for column grouping
3560
+ this.requestRowRefresh();
3561
+ }
3562
+ if (this._hasListener("columnVisibilityChanged")) {
3563
+ var e = {};
3564
+ e["colIndex"] = colIndex;
3565
+ e["hidden"] = !bool;
3566
+ this._dispatch("columnVisibilityChanged", e);
3567
+ }
3568
+ return true;
3569
+ }
3570
+ return false;
3571
+ };
3572
+
3573
+ /** @public
3574
+ * @param {number} size
3575
+ * @return {boolean}
3576
+ */
3577
+ Core.prototype.reserveRightSpace = function (size) {
3578
+ if(this._reservedSpace !== size) {
3579
+ this._reservedSpace = size;
3580
+ for(var i = this._settings.length; --i >= 0;) {
3581
+ this._settings[i].getSection().reserveRightSpace(size);
3582
+ }
3583
+ this._onColumnCountChanged(); // Activate horizontal scrollbar and column virtualization
3584
+ this._updateScrollbarWidth(true, true);
3585
+ return true;
3586
+ }
3587
+ return false;
3588
+ };
3589
+
3590
+ /** Get hidden input in grid <br>
3591
+ * this input for make grid can copy <br>
3592
+ * normal user should not touch it <br>
3593
+ * but sometime grid extension will have to use this element
3594
+ * @public
3595
+ * @return {Element}
3596
+ */
3597
+ Core.prototype.getHiddenInput = function () {
3598
+ return this._hiddenInput;
3599
+ };
3600
+
3601
+ /** Focus grid element without bringing grid into window's view. This is useful when grid is very wide or tall, since window can be scrolled to focused element by default in some browsers.
3602
+ * @public
3603
+ * @see {@link https://developer.mozilla.org/en/docs/Web/API/HTMLElement/focus}
3604
+ * @see {@link http://help.dottoro.com/ljqmdirr.php}
3605
+ */
3606
+ Core.prototype.focus = function () {
3607
+ var elem = this._element;
3608
+ var activeElem = document.activeElement;
3609
+ if(elem && elem !== activeElem) {
3610
+ var x = window.pageXOffset;
3611
+ var y = window.pageYOffset;
3612
+ if(elem["setActive"]) { // Non-standard IE specific method
3613
+ try { // MON-909
3614
+ elem["setActive"]();
3615
+ } catch (error) {
3616
+ elem["focus"]({"preventScroll": true});
3617
+ }
3618
+ } else {
3619
+ elem["focus"]({"preventScroll": true});
3620
+ }
3621
+ if(y !== window.pageYOffset || x !== window.pageXOffset) {
3622
+ window.scrollTo(x, y); // Restore scrolling
3623
+ }
3624
+ }
3625
+ };
3626
+
3627
+ /** @public
3628
+ * @return {boolean}
3629
+ */
3630
+ Core.prototype.isBinding = function() {
3631
+ return this._dispatchingDataChanged;
3632
+ };
3633
+
3634
+ /**
3635
+ * Hide row(s) in the Grid by specifying the rId
3636
+ * @param {number | string} rowId rowId of the row to hide
3637
+ * @param {boolean=} hidden if false, show instead of hide
3638
+ * @public
3639
+ */
3640
+ Core.prototype.hideRow = function (rowId, hidden) {
3641
+ this._dataSource.hideRow(rowId, hidden);
3642
+ };
3643
+ /**
3644
+ * Hide row(s) in the Grid by specifying the rIds
3645
+ * @param {number | string | Array.<number | string>} rowIds rowId(s) of the rows to hide
3646
+ * @param {boolean=} hidden if false, show instead of hide
3647
+ * @public
3648
+ */
3649
+ Core.prototype.hideRows = function (rowIds, hidden) {
3650
+ if (!Array.isArray(rowIds)) {
3651
+ this._dataSource.hideRow(/** @type{number | string} */(rowIds), hidden);
3652
+ } else {
3653
+ this._dataSource.hideRows(rowIds, hidden);
3654
+ }
3655
+ };
3656
+
3657
+ /**
3658
+ * Show row(s) in the Grid by specifying the rIds
3659
+ * @param {number | string | Array.<number | string>} rowIds rowId(s) of the rows to show
3660
+ * @param {boolean=} shown if false, hide instead of show
3661
+ * @public
3662
+ */
3663
+ Core.prototype.showRows = function (rowIds, shown) {
3664
+ if (!Array.isArray(rowIds)) {
3665
+ this._dataSource.showRows([rowIds], shown);
3666
+ } else {
3667
+ this._dataSource.showRows(rowIds, shown);
3668
+ }
3669
+ };
3670
+
3671
+ /**
3672
+ * Unhide all hidden rows in the Grid
3673
+ * @public
3674
+ */
3675
+ Core.prototype.unhideAllRows = function () {
3676
+ this._dataSource.unhideAllRows();
3677
+ };
3678
+
3679
+ /**
3680
+ * @public
3681
+ * @returns {boolean}
3682
+ */
3683
+ Core.prototype.hasHiddenRow = function () {
3684
+ return this._dataSource.hasHiddenRow();
3685
+ };
3686
+
3687
+ /** @public
3688
+ * @ignore
3689
+ * @param {Array=} columns
3690
+ */
3691
+ Core.prototype.initSimpleTable = function (columns) {
3692
+ var colCount = 0;
3693
+ if(!columns && !this.getColumnCount()) {
3694
+ columns = ["Default"]; // Row cannot be added unless there is at least 1 column
3695
+ }
3696
+
3697
+ if(columns) {
3698
+ colCount = columns.length;
3699
+ this.setColumnCount(colCount);
3700
+ this.setDataColumnMap(columns);
3701
+ }
3702
+
3703
+ var titleSect = this.addSection("title");
3704
+ titleSect.addRow(1);
3705
+
3706
+ if(!this._renderingHandler) { // Render title if there is no default rendering
3707
+ for(var c = 0; c < colCount; ++c) {
3708
+ titleSect.setCellContent(c, 0, columns[c]);
3709
+ }
3710
+ }
3711
+
3712
+ this.addSection("content");
3713
+ var titleSectionSetting = this.getSectionSettings("title");
3714
+ titleSectionSetting.disableDataBinding();
3715
+
3716
+ var contentSectionSetting = this.getSectionSettings("content");
3717
+ contentSectionSetting.setAutoSyncRowCount(true);
3718
+ contentSectionSetting.setParent(titleSectionSetting);
3719
+
3720
+ if(!this._dataBindingHandler) {
3721
+ this.setDefaultDataBindingHandler(Core._defaultDataBinding);
3722
+ }
3723
+ };
3724
+ /** @private
3725
+ * @param {Object} e
3726
+ */
3727
+ Core._defaultDataBinding = function(e) {
3728
+ e.cell.setContent(e.dataValue);
3729
+ };
3730
+
3731
+ //#endregion Public Methods
3732
+
3733
+ //#region Private Methods
3734
+ /** @private
3735
+ * @return {!Array.<ILayoutGrid>}
3736
+ */
3737
+ Core.prototype._getAllSections = function () {
3738
+ var sections = [];
3739
+ var sectionCount = this._settings.length;
3740
+ for (var i = 0; i < sectionCount; i++) {
3741
+ sections.push(this._settings[i].getSection());
3742
+ }
3743
+ return sections;
3744
+ };
3745
+ /** @private
3746
+ * @param {number} increment
3747
+ * @param {(MouseEvent|Core.SectionReference)=} identifier This can be MouseEvent, index, or element id or pointer reference
3748
+ * @param {string=} opt_type The next section with the specified type. Default is any type
3749
+ * @return {SectionSettings}
3750
+ */
3751
+ Core.prototype._getNextSection = function (increment, identifier, opt_type) {
3752
+ var nextAt = this.getSectionIndex(identifier) + increment;
3753
+ if(opt_type == null) { return this.getSectionSettings(nextAt); }
3754
+
3755
+ opt_type = this._toSectionType(opt_type);
3756
+ var count = this._settings.length;
3757
+ while (nextAt >= 0 && nextAt < count) {
3758
+ var sectionSettings = this._settings[nextAt];
3759
+ if (opt_type === sectionSettings.getType()) {
3760
+ return /**@type{SectionSettings}*/(sectionSettings);
3761
+ }
3762
+ nextAt += increment;
3763
+ }
3764
+ return null;
3765
+ };
3766
+
3767
+ /** @private
3768
+ * @param {*} val
3769
+ * @return {string}
3770
+ */
3771
+ Core.prototype._toSectionType = function (val) {
3772
+ if(Core._sectionType[/** @type{string} */(val)]) { return /** @type{string} */(val); }
3773
+
3774
+ if (Util.isString(val)) {
3775
+ var lowerCaseStr = val.charAt(0).toLowerCase();
3776
+ switch (lowerCaseStr) {
3777
+ case "t": return "title";
3778
+ case "h": return "header";
3779
+ case "s": return "header";
3780
+ case "f": return "footer";
3781
+ }
3782
+ }
3783
+
3784
+ return "content";
3785
+ };
3786
+
3787
+ /** @private
3788
+ * @param {string=} opt_type Possible value are "content", "title", "header", and "footer"
3789
+ * @param {string=} sectionName
3790
+ * @return {SectionSettings|null}
3791
+ */
3792
+ Core.prototype._newSection = function (opt_type, sectionName) {
3793
+ if(sectionName) {
3794
+ for(var i = this._settings.length; --i >= 0;) {
3795
+ if (this._settings[i].getId() === sectionName) { // check if section name isn't already used
3796
+ return null;
3797
+ }
3798
+ }
3799
+ }
3800
+
3801
+ opt_type = this._toSectionType(opt_type);
3802
+ var section = (opt_type === "content") ? new VirtualizedLayoutGrid() : new LayoutGrid();
3803
+ section._setContext(this);
3804
+
3805
+ var sectionSettings = new SectionSettings(section);
3806
+ sectionSettings.setId(sectionName);
3807
+ sectionSettings.setType(opt_type);
3808
+
3809
+ sectionSettings.listen("dataChanged", this._onSectionDataChanged);
3810
+ sectionSettings.listen("rowAvailable", this._onRowAvailable);
3811
+
3812
+ var rowHighlighting = (opt_type === "content") ? this._rowHighlighting : false;
3813
+ section.enableRowHighlighting(rowHighlighting);
3814
+ section.enableShading(false); // No alternate shading
3815
+ section.setHidingMethod(this._hidingMethod);
3816
+
3817
+ sectionSettings.enableColumnVirtualization(this._colVirtualizer.isEnabled());
3818
+ section.setColumnCount(this._layoutX.getLaneCount());
3819
+ section.reserveRightSpace(this._reservedSpace);
3820
+ // TODO: Add any column customization
3821
+ this._syncLayoutToSectionColumns(section);
3822
+ this._syncStyleToSectionColumns(section, opt_type);
3823
+
3824
+ if (opt_type !== this._rowHeightException) { section.setDefaultRowHeight(this._layoutY.getDefaultLaneSize()); }
3825
+ section.listen("rowHighlighted", this._onRowHightlighted);
3826
+ section.listen("rowCountChanged", this._onRowCountChanged);
3827
+ section.listen("rowHeightChanged", this._onRowHeightChanged);
3828
+
3829
+ if (this._autoSetDataSource) {
3830
+ sectionSettings.setDataSource(this._dataSource);
3831
+ }
3832
+ return sectionSettings;
3833
+ };
3834
+
3835
+ /** @private
3836
+ * @param {ILayoutGrid} section
3837
+ */
3838
+ Core.prototype._putToLast = function(section) {
3839
+ var sectionCount = this._settings.length;
3840
+ if (sectionCount === 0) {
3841
+ section.setParent(this._element, true);
3842
+ } else {
3843
+ var lastGrid = this.getLastSection();
3844
+ var nextSibling = lastGrid.getElement().nextSibling;
3845
+ if (nextSibling !== null) {
3846
+ section.insertBefore(nextSibling);
3847
+ } else {
3848
+ section.setParent(this._element);
3849
+ }
3850
+ }
3851
+ };
3852
+
3853
+ /** @private
3854
+ * @param {ILayoutGrid} section
3855
+ * @param {string} sectionType
3856
+ */
3857
+ Core.prototype._syncStyleToSectionColumns = function (section, sectionType) {
3858
+ var name;
3859
+ for (var i = this._columnDefs.length; --i >= 0; ) {
3860
+ var colDef = this._getColumnDef(i);
3861
+ var styles = colDef["styles"];
3862
+ for (name in styles) {
3863
+ section.setColumnStyle(i, name, styles[name]);
3864
+ }
3865
+ var classes = colDef["classes"];
3866
+ for (name in classes) {
3867
+ section.enableColumnClass(i, name, true);
3868
+ }
3869
+
3870
+ var sectionDef = colDef[sectionType];
3871
+ if(sectionDef) {
3872
+ styles = sectionDef["styles"];
3873
+ for (name in styles) {
3874
+ section.setColumnStyle(i, name, styles[name]);
3875
+ }
3876
+ classes = sectionDef["classes"];
3877
+ for (name in classes) {
3878
+ section.enableColumnClass(i, name, true);
3879
+ }
3880
+ }
3881
+ }
3882
+ };
3883
+ /** @private
3884
+ * @return {boolean}
3885
+ */
3886
+ Core.prototype._syncRowHeights = function () {
3887
+ var sectionCount = this._settings.length;
3888
+ for (var s = 0; s < sectionCount; ++s) {
3889
+ this._syncSectionRowHeights(this._settings[s].getSection());
3890
+ }
3891
+ if (!this._frozenLayout) {
3892
+ return this._updateScrollbarHeight(true, true);
3893
+ }
3894
+ return false;
3895
+ };
3896
+ /** @private
3897
+ * @param {ILayoutGrid} section
3898
+ */
3899
+ Core.prototype._syncSectionRowHeights = function (section) {
3900
+ this._layoutY.copyFrom(
3901
+ section.getRowLayout(),
3902
+ this._sectionStarts[section.getIndex()]
3903
+ );
3904
+ };
3905
+
3906
+ /** @private
3907
+ * @param {number} colIndex
3908
+ * @param {number} px If this is negative
3909
+ * @param {boolean=} opt_scalable Default is false
3910
+ * @return {boolean} True if there is any changed
3911
+ */
3912
+ Core.prototype._setColumnWidth = function (colIndex, px, opt_scalable) {
3913
+ var dirty = false;
3914
+ var layoutX = this._layoutX;
3915
+ if(opt_scalable != null) {
3916
+ dirty = layoutX.setLaneScalability(colIndex, opt_scalable ? true : false);
3917
+ } else {
3918
+ var scalable = layoutX.getLaneScalability(colIndex);
3919
+ if(this._preserveProportion) {
3920
+ if(scalable) {
3921
+ //calculate the proportion
3922
+ var colCount = this.getColumnCount();
3923
+ var totalWeight = 0, totalWidth = 0;
3924
+ for (var j = 0; j < colCount; ++j) {
3925
+ if(!layoutX.getLaneScalability(j)) { continue; }
3926
+ var colWidth = layoutX.getLaneSize(j);
3927
+ var colWeight = layoutX.getCustomLaneSize(j);
3928
+ totalWeight += colWeight;
3929
+ totalWidth += colWidth;
3930
+ }
3931
+ var oldWeight = layoutX.getCustomLaneSize(colIndex);
3932
+ px = ((px * totalWeight) - (px * oldWeight)) / (totalWidth - px);
3933
+ if(!px || px < 0) {
3934
+ px = totalWeight; // In case of new width exceeds total available width, set new weight as total weight
3935
+ }
3936
+ }
3937
+ } else {
3938
+ dirty = layoutX.setLaneScalability(colIndex, false);
3939
+ }
3940
+ }
3941
+ dirty = layoutX.setLaneSize(colIndex, px) || dirty;
3942
+ return dirty;
3943
+ };
3944
+
3945
+ /** @private
3946
+ * @param {number} at
3947
+ * @param {number} count
3948
+ * @param {boolean=} atTheMiddle
3949
+ * @param {*=} ctx
3950
+ */
3951
+ Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle, ctx) {
3952
+ if (this._hasListener("columnAdded")) {
3953
+ var e = {};
3954
+ e["atTheMiddle"] = atTheMiddle;
3955
+ if(count === 1) {
3956
+ e["colIndex"] = at;
3957
+ e["context"] = ctx;
3958
+ this._dispatch("columnAdded", e);
3959
+ } else {
3960
+ var ary = Array.isArray(ctx) ? ctx : [];
3961
+ for (var i = 0; i < count; ++i) {
3962
+ e["colIndex"] = at + i;
3963
+ e["context"] = ary[i];
3964
+ this._dispatch("columnAdded", e);
3965
+ }
3966
+ }
3967
+ }
3968
+
3969
+ this._dispatchColumnRenderEvent({},
3970
+ at, at + count,
3971
+ 0, this._settings.length,
3972
+ NaN, NaN);
3973
+ };
3974
+
3975
+ /** @private
3976
+ * @param {!Object} e
3977
+ * @param {number} fromC
3978
+ * @param {number} toC EXCLUSIVE
3979
+ * @param {number} fromS
3980
+ * @param {number} toS EXCLUSIVE
3981
+ * @param {number} fromR If NaN or negative value is given. The entire section will be updated
3982
+ * @param {number} toR EXCLUSIVE
3983
+ */
3984
+ Core.prototype._dispatchColumnRenderEvent = function (e, fromC, toC, fromS, toS, fromR, toR) {
3985
+ if (!(fromS < toS)) { // Column is added before section
3986
+ return;
3987
+ }
3988
+
3989
+ e["sender"] = this; // Make sure that the sender is this grid
3990
+ e["fromColIndex"] = fromC;
3991
+ e["toColIndex"] = toC;
3992
+
3993
+ var s;
3994
+ if (this._hasListener("preSectionRender")) {
3995
+ for (s = fromS; s < toS; ++s) {
3996
+ this._settings[s].extendRenderEventArg(e, fromR, toR);
3997
+ this._dispatch("preSectionRender", e);
3998
+ }
3999
+ }
4000
+
4001
+ // Dispatch column render event
4002
+ for (var c = fromC; c < toC; ++c) { // For each column
4003
+ var handler = this.getColumnRenderingHandler(c) || this._renderingHandler;
4004
+ if (handler) {
4005
+ e["colIndex"] = c;
4006
+ e["dataColumnName"] = this.getDataColumnName(c);
4007
+
4008
+ for (s = fromS; s < toS; ++s) { // For each section
4009
+ var sectionSettings = this._settings[s];
4010
+ sectionSettings.extendRenderEventArg(e, fromR, toR);
4011
+
4012
+ var section = sectionSettings.getSection();
4013
+ var startR = e["fromRowIndex"];
4014
+ var destR = e["toRowIndex"];
4015
+ for (var r = startR; r < destR; ++r) { // For each row
4016
+ e["rowIndex"] = r;
4017
+ e["cell"] = section["getCell"](c, r, false); // Accessing cell by using bracket allows extenal object to mock Section
4018
+ handler(e);
4019
+ }
4020
+ }
4021
+ }
4022
+ }
4023
+
4024
+ if (this._hasListener("postSectionRender")) {
4025
+ for (s = fromS; s < toS; ++s) {
4026
+ this._settings[s].extendRenderEventArg(e, fromR, toR);
4027
+ this._dispatch("postSectionRender", e);
4028
+ }
4029
+ }
4030
+
4031
+ // Dispatch data binding event once after rendering for populating content of newly rendered cells
4032
+ if (!e["noDataUpdate"] && !this._noBinding) {
4033
+ for (s = fromS; s < toS; ++s) { // For each sectionSettings
4034
+ this.updateRowData(this._settings[s], fromR, toR - 1);
4035
+ }
4036
+ }
4037
+ };
4038
+ /** @private
4039
+ * @param {Object} e
4040
+ */
4041
+ Core.prototype._dispatchRowExpansionBinding = function (e) {
4042
+ if (!this._hasListener("rowExpansionBinding")) {
4043
+ return;
4044
+ }
4045
+
4046
+ var dataView = /** @type{DataView} */(e["dataSource"]);
4047
+ if (!dataView || !dataView.getDataSource()) {
4048
+ return;
4049
+ }
4050
+
4051
+ var fromR = /** @type{number} */(e["fromRowIndex"]);
4052
+ var toR = /** @type{number} */(e["toRowIndex"]);
4053
+ var parents = dataView.getExpansionParents(fromR, toR);
4054
+ var rids = dataView.getVisibleRowIds(true);
4055
+ var section = /** @type{ILayoutGrid} */(e["section"]);
4056
+
4057
+ e["rowData"] = null;
4058
+ e["cell"] = null;
4059
+ for (var r = fromR; r < toR; ++r) {
4060
+ var parentRid = parents[r];
4061
+ var ctxRow = section.getContextRow(r);
4062
+ if(parentRid) { // Previous row is the row with expansion
4063
+ e["originalRowData"] = dataView.getRowData(parentRid);
4064
+ e["originalRowId"] = parentRid;
4065
+ e["rowExpansion"] = ctxRow["rowExpansion"] = true;
4066
+ } else if(ctxRow["rowExpansion"]) {
4067
+ e["originalRowData"] = null;
4068
+ e["originalRowId"] = null;
4069
+ e["rowExpansion"] = ctxRow["rowExpansion"] = false;
4070
+ } else {
4071
+ continue; // There is no need to dispatch the event for normal row
4072
+ }
4073
+ e["rowId"] = rids[r];
4074
+ e["rowIndex"] = r;
4075
+ this._dispatch("rowExpansionBinding", e);
4076
+ }
4077
+ e["originalRowData"] = null;
4078
+ e["originalRowId"] = null;
4079
+ e["rowExpansion"] = false;
4080
+ };
4081
+
4082
+ /** @private
4083
+ * @param {number} num
4084
+ */
4085
+ Core.prototype._removeColumn = function (num) { // TODO: change the logic to use removeColumnAt
4086
+ var colCount = this._layoutX.getLaneCount();
4087
+ if (num > colCount) { num = colCount; }
4088
+ if (num <= 0) { return; }
4089
+
4090
+ var newCount = colCount - num;
4091
+ this._layoutX.setLaneCount(newCount);
4092
+
4093
+ for (var s = this._settings.length; --s >= 0; ) {
4094
+ var section = this._settings[s].getSection();
4095
+ section.setColumnCount(newCount);
4096
+ }
4097
+
4098
+ var removedCols = this._columnDefs.slice(newCount); // Shallow cloning
4099
+ this._columnDefs.length = newCount;
4100
+
4101
+ this._onColumnCountChanged();
4102
+ this._syncLayoutToColumns(newCount, 0, true); // Virtualizer's view bound will not be affected from column
4103
+
4104
+ if (this._hasListener("columnRemoved")) {
4105
+ var e = {};
4106
+ for (var c = colCount; --c >= newCount; ) {
4107
+ var colDef = removedCols[c - newCount];
4108
+ e["colIndex"] = c;
4109
+ e["columnData"] = colDef ? colDef["columnData"] : null;
4110
+ this._dispatch("columnRemoved", e);
4111
+ }
4112
+ }
4113
+ };
4114
+
4115
+ /** `section` variable in this scope can either be instance of LayoutGrid or SectionWriter (from tr-grid-printer).
4116
+ * Need to force calling public methods (section["isColumnActive"] and section["getCell"]) so it works while being minified.
4117
+ * @private
4118
+ * @param {!Object} e
4119
+ */
4120
+ Core.prototype._onSectionDataChanged = function (e) {
4121
+ if(this._dispatchingDataChanged) { return; } // Prevent infinite loop
4122
+ this._dispatchingDataChanged = true;
4123
+
4124
+ var fromR = /** @type{number} */(e["fromRowIndex"]);
4125
+ var toR = /** @type{number} */(e["toRowIndex"]);
4126
+ var section = /** @type{ILayoutGrid} */(e["section"]);
4127
+ var dataView = /** @type{DataView} */(e["dataSource"]);
4128
+ var hasDataView = (dataView && dataView.getDataSource()) ? 1 : 0;
4129
+ var rids, rowDataCollection;
4130
+ if(hasDataView) {
4131
+ rids = dataView.getVisibleRowIds(true);
4132
+ rowDataCollection = dataView.getMultipleRowData(rids, fromR, toR);
4133
+ e["dataRows"] = rowDataCollection;
4134
+ }
4135
+ this._dispatch("preSectionDataBinding", e);
4136
+
4137
+ var colCount = this._layoutX.getLaneCount();
4138
+ var dataMap = this.getDataColumnMap();
4139
+ for (var c = 0; c < colCount; ++c) {
4140
+ if(section["isColumnActive"](c) && (this.isColumnVisible(c) || this._isAlwaysRenderColumn(c))) {
4141
+ var handler = this.getColumnDataBindingHandler(c) || this._dataBindingHandler;
4142
+ if (handler) {
4143
+ var cid = dataMap[c];
4144
+ e["dataColumnName"] = cid;
4145
+ e["colIndex"] = c;
4146
+
4147
+ for (var r = fromR; r < toR; ++r) {
4148
+ if(hasDataView) {
4149
+ var rowData = rowDataCollection[r];
4150
+ if(!rowData) { // This is a header row
4151
+ continue;
4152
+ }
4153
+
4154
+ e["rowData"] = rowData;
4155
+ e["rowId"] = rids[r];
4156
+ e["dataValue"] = rowData[cid];
4157
+ }
4158
+ e["rowIndex"] = r;
4159
+ e["cell"] = section["getCell"](c, r, false); // Accessing cell by using bracket allows extenal object to mock Section
4160
+
4161
+ handler(e);
4162
+ }
4163
+ }
4164
+ }
4165
+ }
4166
+
4167
+ this._dispatch("postSectionDataBinding", e);
4168
+
4169
+ this._dispatchRowExpansionBinding(e);
4170
+ this._dispatchingDataChanged = false;
4171
+ };
4172
+
4173
+ /** @private
4174
+ * @param {VScrollbar|HScrollbar} scrollbar
4175
+ * @returns {boolean}
4176
+ */
4177
+ Core.prototype._updateScrollbar = function (scrollbar) {
4178
+ if(scrollbar) {
4179
+ if(scrollbar.isEnabled()) { scrollbar.update(); }
4180
+ return scrollbar.isActive();
4181
+ }
4182
+ return false;
4183
+ };
4184
+ /** @private
4185
+ * @param {Object} e
4186
+ */
4187
+ Core.prototype._onVScroll = function (e) {
4188
+ this._rowVirtualizer.setViewOffset(this._vscrollbar.getScrollTop()); // Trigger virtualization event
4189
+ };
4190
+ /** @private
4191
+ * @param {Object} e
4192
+ */
4193
+ Core.prototype._onHScroll = function (e) {
4194
+ this._colVirtualizer.setViewOffset(this._hscrollbar.getScrollLeft()); // Trigger virtualization event
4195
+ };
4196
+ /** @private
4197
+ */
4198
+ Core.prototype._onVScrollEnabled = function () {
4199
+ this._updateScrollbarHeight(true, false);
4200
+ if(this._rowVirtualizer.isEnabled()) {
4201
+ this._rowVirtualizer.activate();
4202
+ }
4203
+ if(!this._vscrollbar.getAutoHide()) {
4204
+ this._updateVScrollbar();
4205
+ }
4206
+ };
4207
+ /** @private
4208
+ */
4209
+ Core.prototype._onVScrollDisabled = function () {
4210
+ if(this._rowVirtualizer.isEnabled()) {
4211
+ this._rowVirtualizer.deactivate();
4212
+ }
4213
+ };
4214
+ /** @private
4215
+ * @param {Object} e
4216
+ */
4217
+ Core.prototype._onRowInViewChanged = function (e) { // Triggered from virtualizer
4218
+ var fi = e["firstIndex"];
4219
+ var ei = e["lastIndex"] + 1; // End index
4220
+ var sectionCount = this._settings.length;
4221
+ var updateRange = [0, 0];
4222
+
4223
+ for (var s = 0; s < sectionCount; ++s) { // For each section
4224
+ var sectionSettings = this._settings[s];
4225
+ var section = sectionSettings.getSection();
4226
+ if(section && !section.getFrozenLayout()) { // Section may have been disposed or frozen
4227
+ section.activateRows(fi, ei, updateRange);
4228
+ this.updateRowData(sectionSettings,
4229
+ updateRange[0],
4230
+ updateRange[1] - 1
4231
+ ); // The updateRange are relative to the section
4232
+ }
4233
+ }
4234
+ };
4235
+ /** @private
4236
+ * @param {Object} e
4237
+ */
4238
+ Core.prototype._onColInViewChanged = function (e) {
4239
+ var pfi = e["prevFirstIndex"];
4240
+ var pli = e["prevLastIndex"]; // INCLUSIVE
4241
+ var fi = e["firstIndex"];
4242
+ var li = e["lastIndex"]; // INCLUSIVE
4243
+
4244
+ var first = pfi < fi ? pfi : fi;
4245
+ var last = pli > li ? pli : li; // INCLUSIVE
4246
+
4247
+ this._activateColumns(fi, li, first, last);
4248
+
4249
+ var rfi = this._rowVirtualizer.getFirstIndexInView();
4250
+ var rli = this._rowVirtualizer.getLastIndexInView();
4251
+ var sectionCount = this.getSectionCount();
4252
+ for (var s = 0; s < sectionCount; ++s) { // For each section
4253
+ var sectionSettings = this._settings[s];
4254
+ var rowIndexOffset = sectionSettings.getRowOffset();
4255
+ this.updateRowData(sectionSettings, rfi - rowIndexOffset, rli - rowIndexOffset);
4256
+ }
4257
+ };
4258
+ /** @private
4259
+ * @param {number=} fi First index in view
4260
+ * @param {number=} li Last index in view (inclusive)
4261
+ * @param {number=} first Starting index of range
4262
+ * @param {number=} last Ending index of range (inclusive)
4263
+ */
4264
+ Core.prototype._activateColumns = function(fi, li, first, last) {
4265
+ if (first == null) {
4266
+ first = 0;
4267
+ }
4268
+
4269
+ if (last == null) {
4270
+ last = this.getColumnCount() - 1;
4271
+ }
4272
+
4273
+ var activations = this._getColActivationList(fi, li, first, last);
4274
+ var sectionCount = this.getSectionCount();
4275
+ for(var s = sectionCount; --s >= 0;) {
4276
+ var sectionSettings = this._settings[s];
4277
+ sectionSettings.activateColumns(activations, first, last);
4278
+ }
4279
+ };
4280
+ /** @private
4281
+ * @param {number=} fi First index in view
4282
+ * @param {number=} li Last index in view (inclusive)
4283
+ * @param {number=} first Starting index of range
4284
+ * @param {number=} last Ending index of range (inclusive)
4285
+ * @return {Array.<boolean>}
4286
+ */
4287
+ Core.prototype._getColActivationList = function (fi, li, first, last) {
4288
+ if (first == null) { first = 0; }
4289
+
4290
+ var colCount = this.getColumnCount();
4291
+ if (last == null) { last = colCount - 1; }
4292
+
4293
+ if (fi == null) {
4294
+ fi = this._colVirtualizer.getFirstIndexInView();
4295
+ }
4296
+
4297
+ if (li == null) {
4298
+ li = this._colVirtualizer.getLastIndexInView();
4299
+ }
4300
+
4301
+ var leftPinnedIndex = this._startHScrollbarIndex;
4302
+ var rightPinnedIndex = this.getFirstPinnedRightIndex();
4303
+ var activations = new Array(last + 1);
4304
+ for (var c = first; c <= last; ++c) {
4305
+ activations[c] = (c < leftPinnedIndex) ||
4306
+ (c >= fi && c <= li) ||
4307
+ (c >= rightPinnedIndex);
4308
+ }
4309
+ return activations;
4310
+ };
4311
+ /** @public
4312
+ * @ignore
4313
+ * @param {number} colIndex
4314
+ * @return {!Object}
4315
+ */
4316
+ Core.prototype._getColumnDef = function (colIndex) {
4317
+ if (colIndex >= 0) {
4318
+ var def = this._columnDefs[colIndex];
4319
+ if (!def) {
4320
+ def = this._columnDefs[colIndex] = {
4321
+ "id": "" + Core._runningColumnId++, // Unique identifier
4322
+ "columnData": {}
4323
+ };
4324
+ }
4325
+ return def;
4326
+ }
4327
+ return {};
4328
+ };
4329
+ /** Retrieve 1 or 2 level of nested object definition
4330
+ * @private
4331
+ * @param {number} colIndex
4332
+ * @param {string=} firstLvl
4333
+ * @param {string=} secondLvl
4334
+ * @return {!Object}
4335
+ */
4336
+ Core.prototype._getNestedColumnDef = function (colIndex, firstLvl, secondLvl) {
4337
+ var def = this._getColumnDef(colIndex);
4338
+ if(firstLvl) {
4339
+ var parentDef = def;
4340
+ def = parentDef[firstLvl];
4341
+ if(!def) {
4342
+ def = parentDef[firstLvl] = {};
4343
+ }
4344
+ if(secondLvl) {
4345
+ parentDef = def;
4346
+ def = parentDef[secondLvl];
4347
+ if(!def) {
4348
+ def = parentDef[secondLvl] = {};
4349
+ }
4350
+ }
4351
+ }
4352
+ return def;
4353
+ };
4354
+ /** @public
4355
+ * @ignore
4356
+ * @param {number} colIndex
4357
+ * @return {string}
4358
+ */
4359
+ Core.prototype._getColumnId = function (colIndex) {
4360
+ return this._getColumnDef(colIndex)["id"];
4361
+ };
4362
+
4363
+
4364
+ /** @private */
4365
+ Core.prototype._onWindowResize = function() {
4366
+ this._updateLayout();
4367
+ this._rowVirtualizer.setViewOffset(this._vscrollbar.getScrollTop());
4368
+ };
4369
+ /** @private */
4370
+ Core.prototype._onMouseMove = function () {
4371
+ this._vscrollbar.flash();
4372
+ this._hscrollbar.flash();
4373
+ };
4374
+
4375
+ /** @private
4376
+ * @param {Object} e
4377
+ */
4378
+ Core.prototype._onRowHightlighted = function (e) {
4379
+ if (!this._hasListener("rowHighlighted")) { return; }
4380
+
4381
+ var section = e["sender"];
4382
+ var settings = this.getSectionSettings(section.getId());
4383
+ if (settings == null) { return; }
4384
+
4385
+ settings.extendEventArg(e);
4386
+
4387
+ var dataSource = settings.getDataSource();
4388
+ if (dataSource !== null) {
4389
+ e["rowId"] = dataSource.getRowId(/** @type{number} */(e["rowIndex"]));
4390
+ e["dataRow"] = dataSource.getRowData(e["rowId"]);
4391
+ }
4392
+ this._dispatch("rowHighlighted", e);
4393
+ };
4394
+ /** @private
4395
+ * @param {Object} e
4396
+ */
4397
+ Core.prototype._onRowCountChanged = function (e) {
4398
+ if(this._disposed) {
4399
+ return; // There is no need to do anything after grid is disposed
4400
+ }
4401
+ var section = /** @type {ILayoutGrid} */(e["sender"]);
4402
+ var prevRowCount = e["prevCount"];
4403
+ var newRowCount = e["rowCount"];
4404
+ var sectionIndex = section.getIndex();
4405
+ var offset = this._updateSectionIndices(sectionIndex);
4406
+ var i = 0;
4407
+
4408
+ if(prevRowCount > newRowCount) { // case row removed
4409
+ this._layoutY.removeLaneAt(offset, prevRowCount - newRowCount);
4410
+ if(!this._layoutY.isHomogeneous()) {
4411
+ this._syncSectionRowHeights(section);
4412
+ }
4413
+ } else { // case row added
4414
+ var defaultHeight = this._layoutY.getDefaultLaneSize();
4415
+ var customHeight = section.getDefaultRowHeight();
4416
+
4417
+ this._layoutY.insertLane(offset + prevRowCount, newRowCount - prevRowCount);
4418
+ if (customHeight !== defaultHeight) {
4419
+ for (i = prevRowCount; i < newRowCount; ++i) {
4420
+ this._layoutY.setLaneSize(offset + i, customHeight);
4421
+ }
4422
+ }
4423
+ }
4424
+
4425
+ var paneChanged = (sectionIndex <= this._startVScrollbarIndex) || (sectionIndex >= this._getFooterStartIndex());
4426
+ var forceUpdate = this._frozenFooterCount > 0 ? true : false; // Prevent from footer section flashing
4427
+ var viewChanged = this._updateScrollbarHeight(paneChanged, forceUpdate, e["noBinding"]); // Virtualization is triggered
4428
+ if(!this._frozenLayout && !viewChanged) { // Grid must activate newly created section if no event is dispatched from the row virtualizer
4429
+ if(this._rowVirtualizer.isVirtualizable()) {
4430
+ section.activateRows(this._rowVirtualizer.getFirstIndexInView(),
4431
+ this._rowVirtualizer.getLastIndexInView());
4432
+ } else {
4433
+ section.activateRows();
4434
+ }
4435
+ }
4436
+
4437
+ if(!forceUpdate) {
4438
+ this._updateVScrollbar(); // Asynchronous
4439
+ }
4440
+ if(prevRowCount < newRowCount) {
4441
+ this._dispatch("rowAdded", e);
4442
+ } else if(prevRowCount > newRowCount) {
4443
+ this._dispatch("rowRemoved", e);
4444
+ }
4445
+ };
4446
+
4447
+ /** @private
4448
+ * @param {Object} e
4449
+ */
4450
+ Core.prototype._onRowHeightChanged = function (e) {
4451
+ if (!this._rowHeightSync) { return; }
4452
+ if (this._disposed) { return; } // There is no need to sync anything after disposition
4453
+ if(this._rowHeightConflator.conflate(e)) {
4454
+ return;
4455
+ }
4456
+
4457
+ var evts = this._rowHeightConflator.popAllData();
4458
+
4459
+ var len = evts.length;
4460
+ var minSectionIndex = NaN;
4461
+
4462
+ // TODO: Set row height one by one is not good
4463
+ for(var j = 0; j < len; ++j) {
4464
+ var evt = evts[j];
4465
+ var section = /** @type {ILayoutGrid} */(evt["sender"]);
4466
+ if(!this._containsSection(section)) {
4467
+ continue; // The section is no longer contained in this grid
4468
+ }
4469
+
4470
+ var sectIndex = section.getIndex();
4471
+ var relIndex = evt["rowIndex"];
4472
+ var rowIndex = this.getRowIndex(sectIndex, relIndex);
4473
+
4474
+ var changeLength = evt["changeLength"];
4475
+ for (var i = 0; i < changeLength; ++i) {
4476
+ if(this._layoutY.setLaneSize(rowIndex + i, section.getRowHeight(relIndex + i))) {
4477
+ if(!(sectIndex >= minSectionIndex)) {
4478
+ minSectionIndex = sectIndex;
4479
+ }
4480
+ }
4481
+ }
4482
+ }
4483
+
4484
+ if(this._rowHeightConflator._needScrollbarUpdate) {
4485
+ this._rowHeightConflator._needScrollbarUpdate = false;
4486
+ this._updateScrollbarHeight(true, true);
4487
+ } else if(minSectionIndex >= 0) {
4488
+ this._updateScrollbarHeight(minSectionIndex < this._startVScrollbarIndex,
4489
+ minSectionIndex >= this._startVScrollbarIndex);
4490
+ }
4491
+ };
4492
+ /** @private
4493
+ * @param {ILayoutGrid} s
4494
+ * @returns {boolean}
4495
+ */
4496
+ Core.prototype._containsSection = function (s) {
4497
+ for(var i = this._settings.length; --i >= 0;) {
4498
+ if(this._settings[i].getSection() === s) {
4499
+ return true;
4500
+ }
4501
+ }
4502
+ return false;
4503
+ };
4504
+
4505
+ /** @private
4506
+ * @param {!Object} e
4507
+ */
4508
+ Core.prototype._onRowAvailable = function (e) {
4509
+ var sectionIndex = /** @type{number} */(e["sectionIndex"]);
4510
+ this._dispatchColumnRenderEvent(e,
4511
+ 0, this.getColumnCount(),
4512
+ sectionIndex, sectionIndex + 1,
4513
+ e["prevRowIndex"], e["rowIndex"]);
4514
+ };
4515
+
4516
+ /** @private
4517
+ * @param {boolean=} opt_suppressLayout
4518
+ */
4519
+ Core.prototype._onSectionCountChanged = function (opt_suppressLayout) {
4520
+ if(this._frozenLayout) { return; }
4521
+
4522
+ if (this._tempFrozenSectionRef) {
4523
+ var startVScrollbarSection = this.getNextSection(this._tempFrozenSectionRef);
4524
+ if (startVScrollbarSection !== null) {
4525
+ this._startVScrollbarIndex = startVScrollbarSection.getIndex();
4526
+ this._tempFrozenSectionRef = "";
4527
+ }
4528
+ }
4529
+
4530
+ if (this._startVScrollbarIndex >= 0 && this._startVScrollbarIndex < this._getFooterStartIndex()) {
4531
+ // TODO: should enable scrollbar inside DataSourceTreePlugin instead
4532
+ this._vscrollbar.enable();
4533
+
4534
+ // Reinsert sections
4535
+ this._vscrollbar.setScrollContent(this, this._getAllSections(), this._startVScrollbarIndex);
4536
+
4537
+ if(!opt_suppressLayout) {
4538
+ this._updateScrollbarHeight(true, true);
4539
+ }
4540
+ this._syncLayoutToColumns();
4541
+ } else {
4542
+ this._vscrollbar.disable();
4543
+ }
4544
+ };
4545
+ /** @private */
4546
+ Core.prototype._onColumnCountChanged = function () {
4547
+ if(this._frozenLayout) { return; }
4548
+
4549
+ var colCount = this.getColumnCount();
4550
+ var pinnedRight = this._countPinnedRightColumns();
4551
+ var pinnedLeft = this._startHScrollbarIndex >= 0 ? this._startHScrollbarIndex : colCount;
4552
+
4553
+ if (pinnedLeft + pinnedRight < colCount) {
4554
+ this._hscrollbar.enable();
4555
+ this._colVirtualizer.activate();
4556
+
4557
+ this._hscrollbar.setScrollContent(
4558
+ this,
4559
+ this._getAllSections(),
4560
+ this._startHScrollbarIndex,
4561
+ pinnedRight
4562
+ );
4563
+ } else {
4564
+ this._hscrollbar.disable();
4565
+ this._colVirtualizer.deactivate();
4566
+ }
4567
+ };
4568
+
4569
+ /** @private
4570
+ * @param {Object} e
4571
+ */
4572
+ Core.prototype._onSyncVScroll = function (e) {
4573
+ this._vscrollbar.setScrollTop(e.scrollTop);
4574
+ };
4575
+ /** @private
4576
+ * @return {number} index of footer section
4577
+ */
4578
+ Core.prototype._getFooterStartIndex = function () {
4579
+ return this.getSectionCount() - this._frozenFooterCount;
4580
+ };
4581
+ /** @private
4582
+ * @return {number} pixel without zoom factor
4583
+ */
4584
+ Core.prototype._getVScrollStart = function () {
4585
+ return this._getSectionSize(0, this._startVScrollbarIndex);
4586
+ };
4587
+ /** @private
4588
+ * @return {number} pixel without zoom factor
4589
+ */
4590
+ Core.prototype._getFooterSize = function () {
4591
+ return (this._frozenFooterCount > 0) ? this._getSectionSize(this._getFooterStartIndex()) : 0;
4592
+ };
4593
+ /** @private
4594
+ * @param {number=} startIndex
4595
+ * @param {number=} count
4596
+ * @return {number} pixel without zoom factor
4597
+ */
4598
+ Core.prototype._getSectionSize = function (startIndex, count) {
4599
+ if(!startIndex) {
4600
+ startIndex = 0;
4601
+ } else if(startIndex < 0) {
4602
+ return 0;
4603
+ }
4604
+ if(count == null) {
4605
+ count = this.getSectionCount() - startIndex;
4606
+ }
4607
+ var startPos = this._layoutY.getLaneStart(
4608
+ this._sectionStarts[startIndex]
4609
+ );
4610
+
4611
+ var endIndex = startIndex + count;
4612
+ var endPos = count > 0 ? this._layoutY.getLaneStart(
4613
+ this._sectionStarts[endIndex]
4614
+ ) : 0;
4615
+ return endPos - startPos;
4616
+ };
4617
+
4618
+ /** @private
4619
+ * @param {boolean} paneChanged
4620
+ * @param {boolean} contentChanged
4621
+ * @param {boolean=} noBinding
4622
+ * @return {boolean}
4623
+ */
4624
+ Core.prototype._updateScrollbarHeight = function (paneChanged, contentChanged, noBinding) {
4625
+ if(!this._vscrollbar.isEnabled()) {
4626
+ return false;
4627
+ }
4628
+
4629
+ var forceUpdateLayout = contentChanged;
4630
+ var recalculation = paneChanged && this._startVScrollbarIndex >= 0;
4631
+ var hasRowHeightChanged = this._rowHeightConflator.isConflating();
4632
+ if(hasRowHeightChanged) {
4633
+ this._rowHeightConflator._needScrollbarUpdate = true;
4634
+
4635
+ // Should not force layout-update while rowHeightConflator is executing
4636
+ // because states have not updated and will actives scrollbar unintentionally.
4637
+ forceUpdateLayout = false;
4638
+ }
4639
+
4640
+ if (recalculation && !hasRowHeightChanged) {
4641
+ // Scroll Frame
4642
+ var gridElem = this.getElement();
4643
+ if(!gridElem) {
4644
+ return false;
4645
+ }
4646
+
4647
+ var gridParent = this.getParent();
4648
+ var scrollFrame = this._vscrollbar.getParent();
4649
+ if(scrollFrame) {
4650
+ if(scrollFrame !== gridParent) { // If vscrollbar is attached to an external element
4651
+ // Assume that there is always a horizontal scrollbar host underneath
4652
+ if(scrollFrame.firstElementChild) {
4653
+ scrollFrame = scrollFrame.firstElementChild;
4654
+ }
4655
+ }
4656
+ } else {
4657
+ scrollFrame = gridElem;
4658
+ this._vscrollbar.setParent(scrollFrame);
4659
+ }
4660
+
4661
+ var sectionStart = this._getVScrollStart();
4662
+ var footerSize = this._getFooterSize();
4663
+
4664
+ if(scrollFrame !== gridElem) {
4665
+ sectionStart += gridElem.clientTop;
4666
+ }
4667
+
4668
+ // Scroll Track and Pane
4669
+ this._vscrollbar.resetPaneSize(); // scrollFrame could have a dynamic height that rely on pane's content.
4670
+ var containerHeight = scrollFrame.clientHeight - (sectionStart + footerSize) * this._zoomFactor;
4671
+
4672
+ // Pane size needs to be bigger when zooming out to keep the same view size
4673
+ this._vscrollbar.setTop(sectionStart * this._zoomFactor);
4674
+ this._vscrollbar.setTrackSize(containerHeight, containerHeight / this._zoomFactor);
4675
+
4676
+ // This calculation is for finding a appropriate dynamic buffer size
4677
+ // because in the large content number, buffer need to be bigger.
4678
+ // TODO: move buffer calculation to virtualizer
4679
+ var defaultSize = this._layoutY.getDefaultLaneSize();
4680
+ var viewSize = defaultSize * 12; // Display at least 12 rows
4681
+
4682
+ if (containerHeight > viewSize) {
4683
+ viewSize = (Math.ceil(containerHeight / defaultSize) + 4) * defaultSize;
4684
+ }
4685
+
4686
+ // HACK: Due to fixed layout size we need to scale view size instead of content size, when zooming
4687
+ // TODO: Check if zoom factor is used for virtualization correctly
4688
+ this._rowVirtualizer.setViewSize(viewSize / this._zoomFactor);
4689
+ this._rowVirtualizer.setViewBounds(this._startVScrollbarIndex, this.getFooterCount());
4690
+ } else {
4691
+ this._rowVirtualizer.validateVirtualization(); // Content height may be changed
4692
+ }
4693
+
4694
+ var viewChanged = false;
4695
+ if(!noBinding) {
4696
+ viewChanged = this._rowVirtualizer.update(); // May fire onRowInViewChanged
4697
+ }
4698
+
4699
+ this._vscrollbar.invalidate(forceUpdateLayout); // Update visual for vertical scrollbar
4700
+
4701
+ return viewChanged;
4702
+ };
4703
+ /** @private
4704
+ * @param {boolean} paneChanged
4705
+ * @param {boolean} contentChanged
4706
+ */
4707
+ Core.prototype._updateScrollbarWidth = function (paneChanged, contentChanged) {
4708
+ if (paneChanged && this._startHScrollbarIndex >= 0) {
4709
+ // Scroll Frame
4710
+ var gridElem = this.getElement();
4711
+ var scrollFrame = this._hscrollbar.getParent();
4712
+ if (!scrollFrame) {
4713
+ scrollFrame = this.getParent() || gridElem;
4714
+ this._hscrollbar.setParent(scrollFrame);
4715
+ }
4716
+
4717
+ // Frozen Area
4718
+ var leftFrozenArea = this._layoutX.getLaneStart(this._startHScrollbarIndex);
4719
+
4720
+ var colCount = this._layoutX.getLaneCount();
4721
+ var rightFrozenArea = 0;
4722
+ var rightPinnedCount = this._countPinnedRightColumns();
4723
+ if (rightPinnedCount) {
4724
+ rightFrozenArea = this._layoutX.getLaneStart(colCount) -
4725
+ this._layoutX.getLaneStart(colCount - rightPinnedCount);
4726
+ }
4727
+
4728
+ // Scroll Track and Pane
4729
+ var gridClientWidth = (scrollFrame !== gridElem) ? gridElem.clientLeft : 0;
4730
+ var containerWidth = scrollFrame.clientWidth -
4731
+ (leftFrozenArea + gridClientWidth + rightFrozenArea) * this._zoomFactor;
4732
+
4733
+ if (rightPinnedCount > 0) {
4734
+ containerWidth = containerWidth - this._reservedSpace;
4735
+ }
4736
+
4737
+ this._hscrollbar.setPaneLeft(leftFrozenArea);
4738
+ this._hscrollbar.setLeft((leftFrozenArea + gridClientWidth) * this._zoomFactor);
4739
+ this._hscrollbar.setTrackSize(containerWidth, containerWidth / this._zoomFactor);
4740
+
4741
+ var defaultSize = this._layoutX.getDefaultLaneSize();
4742
+ var viewSize = defaultSize * 4; // Display at least 4 column
4743
+ if (containerWidth > viewSize) {
4744
+ viewSize = containerWidth;
4745
+ }
4746
+ this._colVirtualizer.setViewSize(viewSize / this._zoomFactor);
4747
+ this._colVirtualizer.setViewBounds(this._startHScrollbarIndex, rightPinnedCount);
4748
+ } else {
4749
+ this._colVirtualizer.validateVirtualization(); // Content width may be changed
4750
+ }
4751
+
4752
+ this._colVirtualizer.update();
4753
+
4754
+ this._hscrollbar.invalidate(contentChanged); // Update content width
4755
+ };
4756
+
4757
+ /** @private
4758
+ * @ignore
4759
+ * @param {number} relativeY y position that is relative to the top left this object.
4760
+ * @param {!Object} returnedObj
4761
+ * @return {boolean}
4762
+ */
4763
+ Core.prototype._hitTestY = function (relativeY, returnedObj) {
4764
+ var sectionSettings;
4765
+ if (returnedObj["sectionSettings"]) {
4766
+ sectionSettings = returnedObj["sectionSettings"];
4767
+ } else {
4768
+ var rowIndex;
4769
+ if (returnedObj["rowIndex"] == 'number') {
4770
+ rowIndex = returnedObj['rowIndex'];
4771
+ } else {
4772
+ rowIndex = this._layoutY.hitTest(relativeY);
4773
+ }
4774
+ var validRowIndex = (rowIndex >= 0) ? rowIndex : ~rowIndex; // TODO: Check if this is necessary
4775
+ var sectionIndex = Util.upperBound(this._sectionStarts, validRowIndex) - 1;
4776
+ returnedObj["sectionIndex"] = sectionIndex;
4777
+ sectionSettings = this._settings[sectionIndex];
4778
+ if(!sectionSettings) { // Cannot find SectionSettings
4779
+ return false;
4780
+ }
4781
+ sectionSettings.extendEventArg(returnedObj);
4782
+ }
4783
+
4784
+ var section = sectionSettings.getSection();
4785
+ if(returnedObj["colIndex"] != null && returnedObj["cellElement"]) {
4786
+ returnedObj["rowIndex"] = section.getCellIndex(returnedObj["colIndex"], returnedObj["cellElement"]);
4787
+ } else {
4788
+ returnedObj["rowIndex"] = rowIndex + section.getRowOffset();
4789
+ }
4790
+
4791
+ return true;
4792
+ };
4793
+
4794
+ /** @private
4795
+ * @param {number=} from
4796
+ * @param {number=} to
4797
+ * @param {boolean=} opt_forceDispatching
4798
+ * @fires Core#widthChanged
4799
+ */
4800
+ Core.prototype._syncLayoutToColumns = function (from, to, opt_forceDispatching) {
4801
+ if (this._frozenLayout) { return; }
4802
+ var colCount = this._layoutX.getLaneCount();
4803
+ var forceUpdate = this.fillParentWidth(100); // Resize all columns if there is a scaling column
4804
+ if (forceUpdate || (from == null) || (to == null)) {
4805
+ from = 0;
4806
+ to = colCount;
4807
+ forceUpdate = true;
4808
+ }
4809
+
4810
+ var sectCount = this._settings.length;
4811
+ if (sectCount <= 0) { return; }
4812
+
4813
+ var dirty = false;
4814
+ if(from < to) {
4815
+ for (var i = 0; i < sectCount; ++i) {
4816
+ dirty = this._syncLayoutToSectionColumns(this._settings[i].getSection(), from, to) || dirty;
4817
+ }
4818
+ }
4819
+
4820
+ // TODO: Check if "to" should be greater than or equal to first pinnied right index
4821
+ var shouldUpdate = forceUpdate || (from < this._startHScrollbarIndex) || (to > this.getFirstPinnedRightIndex());
4822
+ this._updateScrollbarWidth(shouldUpdate, true);
4823
+
4824
+ if (dirty || opt_forceDispatching) {
4825
+ this._dispatch("widthChanged", {
4826
+ "from": from,
4827
+ "to": to,
4828
+ "colChanged": from
4829
+ });
4830
+ }
4831
+ };
4832
+ /** @private
4833
+ * @param {ILayoutGrid} section
4834
+ * @param {number=} opt_from
4835
+ * @param {number=} opt_to
4836
+ * @return {boolean} True if there is any change
4837
+ */
4838
+ Core.prototype._syncLayoutToSectionColumns = function (section, opt_from, opt_to) {
4839
+ if (opt_from == null) { opt_from = 0; }
4840
+ if (opt_to == null) { opt_to = this._layoutX.getLaneCount(); }
4841
+
4842
+ var dirty = 0;
4843
+ for (var i = opt_from; i < opt_to; ++i) {
4844
+ dirty |= section._setColumnWidth(i, this._layoutX.getLaneSize(i));
4845
+ }
4846
+ if(dirty && !this._frozenLayout) {
4847
+ section._updateColumnLayout(); // TODO: This could be further improved by identifying first dirty index
4848
+ return true;
4849
+ }
4850
+ return false;
4851
+ };
4852
+
4853
+ /** @private
4854
+ * @param {number|string} colRef
4855
+ * @return {string}
4856
+ */
4857
+ Core.prototype._toDataColumnName = function (colRef) {
4858
+ if (Util.isNumber(colRef)) {
4859
+ return this.getDataColumnName(/** @type{number} */(colRef));
4860
+ }
4861
+ return /** @type{string} */(colRef);
4862
+ };
4863
+
4864
+ /** @private
4865
+ * @param {number} from
4866
+ * @return {number} offset value at the given index
4867
+ */
4868
+ Core.prototype._updateSectionIndices = function (from) {
4869
+ if(this._updatePaddingBottomSect()) { // Bottom padding must always be at the last section
4870
+ --from; // The section has been moved, so we shift the position required for update
4871
+ }
4872
+
4873
+ if (from < 0) { from = 0; }
4874
+
4875
+ // Adjust Index offsets for hittest
4876
+ var sectionCount = this._settings.length;
4877
+ var first = this._settings[0] || null;
4878
+ if (first !== this._firstSettings) {
4879
+ if (this._firstSettings) { this._firstSettings.getSection().removeClass("first"); }
4880
+ this._firstSettings = first;
4881
+ if (this._firstSettings) { this._firstSettings.getSection().addClass("first"); }
4882
+ }
4883
+ var last = this._settings[sectionCount - 1] || null;
4884
+ if (last !== this._lastSettings) {
4885
+ if (this._lastSettings) { this._lastSettings.getSection().removeClass("last"); }
4886
+ this._lastSettings = last;
4887
+ if (this._lastSettings) { this._lastSettings.getSection().addClass("last"); }
4888
+ }
4889
+
4890
+ this._sectionStarts.length = sectionCount + 1;
4891
+ this._sectionStarts[0] = 0;
4892
+ for (var i = from; i < sectionCount; ++i) {
4893
+ var section = this._settings[i].getSection();
4894
+ section.setIndex(i);
4895
+ section.setRowOffset(this._sectionStarts[i]);
4896
+ this._sectionStarts[i + 1] = this._sectionStarts[i] + section.getRowCount();
4897
+ }
4898
+
4899
+ return this._sectionStarts[from];
4900
+ };
4901
+
4902
+ /** @private */
4903
+ Core.prototype._updateLayout = function () {
4904
+ if(this._disposed) { return; }
4905
+
4906
+ this._syncLayoutToColumns(); // Update only if need
4907
+
4908
+ this._updateScrollbarHeight(true, true);
4909
+ this._updateScrollbarWidth(true, true);
4910
+
4911
+ var sectionCount = this.getSectionCount();
4912
+ for (var s = 0; s < sectionCount; ++s) {
4913
+ var settings = this._settings[s];
4914
+ var section = settings.getSection();
4915
+ if(settings.getType() == "title") { // Currently we only need title to be updated
4916
+ section.updateLayout();
4917
+ }
4918
+ if(section.getReservedSpace()) {
4919
+ // TODO: should update right space's style inside section.updateLayout function
4920
+ section._updateRightSpaceStyle(this._hscrollbar.isActive() && !this._pinnedRightColumnCount);
4921
+ }
4922
+ }
4923
+ };
4924
+
4925
+ /** @private */
4926
+ Core.prototype._updateVScrollbar = function() {
4927
+ if (this._disposed || !this._vscrollbar.isEnabled()) { return; } // There is no need to sync anything after disposition
4928
+ if(this._vScrollbarConflator.conflate()) {
4929
+ return;
4930
+ }
4931
+ this._vscrollbar.update();
4932
+ };
4933
+
4934
+ //#endregion Private Methods
4935
+
4936
+ Core._proto = Core.prototype;
4937
+
4938
+ export default Core;
4939
+ export { Core };