@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,3654 @@
1
+ import Ext from "../../../tr-grid-util/es6/Ext.js";
2
+ import DataCache from "./DataCache.js";
3
+ import DataTable from "./DataTable.js";
4
+ import ColumnStats from "./ColumnStats.js";
5
+ import EventDispatcher from "../grid/event/EventDispatcher.js";
6
+ import Util from "../grid/util/util.js";
7
+ import { Conflator } from "../../../tr-grid-util/es6/Conflator.js";
8
+
9
+ /** @event DataView#dataChanged
10
+ * @description Trigger when data within the data view has been changed. Not only actual change in data, but also position change will trigger this event.
11
+ * @property {boolean} globalChange Indicates a big change. User should expect all data has been change. With active sorting or filtering, this flag will always be true due to multiple changes in row position.
12
+ * @property {string} type Type of changes. Possible values are "inserted", "removed", "updated", and undefined
13
+ * @property {string} rid Row Id
14
+ * @property {Object.<string, *>} rowData Column values of the changed row in JSON object format
15
+ */
16
+ /** @event DataView#pageIndexChanged
17
+ * @property {number} pageIndex
18
+ */
19
+ /** @event DataView#pageCountChanged
20
+ * @property {number} pageCount
21
+ */
22
+ /** @event DataView#preDisposed
23
+ */
24
+ /** @event DataView#groupAdded
25
+ * @property {DataView} dataView Parent data view that create the new group
26
+ * @property {DataView} newGroup Child data view that is newly created
27
+ */
28
+ /** @event DataView#beforeGroupAdded
29
+ * @description Fired each time before group added. Set property `cancel` to true to cancel adding of the new group
30
+ * @type {Object}
31
+ * @property {DataView} dataView Parent data view that create the new group
32
+ * @property {string} newGroupId
33
+ * @property {*} newGroupValue
34
+ * @property {string} newGroupRowId Unique row Id given for the group
35
+ */
36
+ /** @event DataView#groupCriteriaChanged
37
+ * @type {Object}
38
+ */
39
+ /** @event DataView#beforeFiltering
40
+ * @description Fired once before actual row filtering (before multiple execution of filter logic). This allow optimization by preparing data needed for the filtering
41
+ * @type {Object}
42
+ */
43
+
44
+ /** DataView doesn't hold the actual data. It is just a transform view (by applying filtering or sorting) of the data from the {@link DataTable}
45
+ * @constructor
46
+ * @extends {EventDispatcher}
47
+ * @param {DataTable|DataView=} source
48
+ * @see {@link DataTable}
49
+ */
50
+ var DataView = function(source) {
51
+ var t = this; // For file minification
52
+ t._groupFilterLogic = t._groupFilterLogic.bind(t);
53
+ t._internalGroupSortingLogic = t._internalGroupSortingLogic.bind(t);
54
+
55
+ t._onDataChanged = t._onDataChanged.bind(t);
56
+ t._onGroupAdded = t._onGroupAdded.bind(t);
57
+ t._onBeforeGroupAdded = t._onBeforeGroupAdded.bind(t);
58
+ t._onRefreshTimeout = t._onRefreshTimeout.bind(t);
59
+
60
+ t._rids = [];
61
+ t._sortingDefs = [];
62
+ t._columnStats = {};
63
+ t._shared = {};
64
+
65
+ t._conflator = new Conflator(this._onDataChanged, 0);
66
+ t._conflator.disable();
67
+
68
+ t._addEvents("dataChanged",
69
+ "preDisposed",
70
+ "pageIndexChanged",
71
+ "pageCountChanged",
72
+ "groupAdded",
73
+ "beforeGroupAdded",
74
+ "groupCriteriaChanged",
75
+ "beforeFiltering"
76
+ );
77
+
78
+ t.setDataSource(source);
79
+ };
80
+ Ext.inherits(DataView, EventDispatcher);
81
+
82
+ /** List of row Ids with filtering and sorting transformation
83
+ * @private
84
+ * @type {!Array.<string>}
85
+ */
86
+ DataView.prototype._rids; // Contains only data rows that have been filtered
87
+ /** List of row Ids with grouping transformation
88
+ * @private
89
+ * @type {Array.<string>}
90
+ */
91
+ DataView.prototype._groupView = null; // Contains non-data rows (e.g. group headers, group footers) and exclude collapsed group data rows
92
+ /** List of row Ids with paging transformation
93
+ * @private
94
+ * @type {Array.<string>}
95
+ */
96
+ DataView.prototype._pageView = null; // Cut-off version of _rids or _groupView
97
+ /** List of row Ids with expanding transformation
98
+ * @private
99
+ * @type {Array.<string>}
100
+ */
101
+ DataView.prototype._expansionView = null; // The rids with row expansion
102
+
103
+ /** @private
104
+ * @type {Object.<string, boolean>}
105
+ */
106
+ DataView.prototype._hiddenRids = null;
107
+ /** @private
108
+ * @type {Object.<string, boolean>}
109
+ */
110
+ DataView.prototype._collapsedRids = null; // for segmentation
111
+ /** @private
112
+ * @type {Object.<string, number>}
113
+ */
114
+ DataView.prototype._expansionMap = null;
115
+ /** @private
116
+ * @type {Object.<string, string>}
117
+ */
118
+ DataView.prototype._expansionChildren = null;
119
+ /** @private
120
+ * @type {number}
121
+ */
122
+ DataView.prototype._expansionCount = 0;
123
+
124
+ /** @private
125
+ * @type {DataTable}
126
+ */
127
+ DataView.prototype._dt = null;
128
+ /** @private
129
+ * @type {DataTable|DataView}
130
+ */
131
+ DataView.prototype._parent = null;
132
+ /** @private
133
+ * @type {Object}
134
+ */
135
+ DataView.prototype._shared = null; // Shared options between data view in the same hierarchy
136
+
137
+ /** @private
138
+ * @type {Array.<Array>}
139
+ */
140
+ DataView.prototype._sortingDefs = null;
141
+
142
+ /** @private
143
+ * @type {function(string, Object.<string, *>)|null}
144
+ */
145
+ DataView.prototype._userFilter = null;
146
+ /** @private
147
+ * @type {boolean}
148
+ */
149
+ DataView.prototype._filteringOut = false;
150
+
151
+ /** @private
152
+ * @type {number}
153
+ */
154
+ DataView.prototype._refreshTimerId = 0;
155
+
156
+ /** @private
157
+ * @type {Function}
158
+ */
159
+ DataView.prototype._groupSortingLogic = null;
160
+
161
+ /** @private
162
+ * @type {boolean}
163
+ */
164
+ DataView.prototype._pageCorrection = true;
165
+ /** @private
166
+ * @type {number}
167
+ */
168
+ DataView.prototype._pageSize = 0;
169
+ /** @private
170
+ * @type {number}
171
+ */
172
+ DataView.prototype._pageIndex = 1;
173
+ /** @private
174
+ * @type {number}
175
+ */
176
+ DataView.prototype._lastPageIndex = 0;
177
+
178
+ /** @private
179
+ * @type {Array.<Function>}
180
+ */
181
+ DataView.prototype._groupCriteria = null; // Shared between groups
182
+ /** @private
183
+ * @type {Array.<Array>}
184
+ */
185
+ DataView.prototype._preDefGroups = null;
186
+ /** @private
187
+ * @type {boolean}
188
+ */
189
+ DataView.prototype._preDefGroupsDirty = false;
190
+ /** @private
191
+ * @type {Object.<string, DataView>}
192
+ */
193
+ DataView.prototype._groupMembers = null; // Map of immediate child data views (key is id)
194
+ /** @private
195
+ * @type {Array.<string>}
196
+ */
197
+ DataView.prototype._groupList = null; // List of immediate child's ids
198
+ /** A map object that contains all groups with key is group row id and value is the group DataView
199
+ * @private
200
+ * @type {Object.<string, DataView>}
201
+ */
202
+ DataView.prototype._groupRows = null; // Shared between groups
203
+ /** @private
204
+ * @type {string}
205
+ */
206
+ DataView.prototype._groupId = "";
207
+ /** @private
208
+ * @type {*}
209
+ */
210
+ DataView.prototype._groupValue;
211
+ /** @private
212
+ * @type {string}
213
+ */
214
+ DataView.prototype._groupRowId = "";
215
+ /** @private
216
+ * @type {Array.<string>}
217
+ */
218
+ DataView.prototype._footerRowIds = null;
219
+ /** @private
220
+ * @type {number}
221
+ */
222
+ DataView.prototype._groupLevel = 0;
223
+ /** @private
224
+ * @type {boolean}
225
+ */
226
+ DataView.prototype._groupViewDirty = false;
227
+
228
+ /** @private
229
+ * @type {Object.<string, ColumnStats>}
230
+ */
231
+ DataView.prototype._columnStats;
232
+
233
+ /** @private
234
+ * @type {boolean}
235
+ */
236
+ DataView.prototype._hidden = false;
237
+ /** @private
238
+ * @type {boolean}
239
+ */
240
+ DataView.prototype._hiddenHeaderRow = false;
241
+ /** @private
242
+ * @type {boolean}
243
+ */
244
+ DataView.prototype._collapsed = false;
245
+ /** @private
246
+ * @type {boolean}
247
+ */
248
+ DataView.prototype._showOnlyFirstMember = false;
249
+ /** @private
250
+ * @type {boolean}
251
+ */
252
+ DataView.prototype._beingAdded = false;
253
+ /** @private
254
+ * @type {Conflator | null}
255
+ */
256
+ DataView.prototype._conflator = null;
257
+
258
+ /** @public
259
+ * @fires DataView#preDisposed
260
+ */
261
+ DataView.prototype.dispose = function() {
262
+ this._dispatch("preDisposed", {});
263
+
264
+ this.unlistenAll();
265
+ this.setDataSource(null); // Remove this._dt and this._parent. WARNING: an event is fired
266
+ this.groupBy(null); // Remove this._groupCriteria, this._groupRows and all of its children. WARNING: an event is fired
267
+
268
+ this._conflator.dispose();
269
+ this._sortingDefs = null;
270
+ this._shared = null; // Remove shared options
271
+
272
+ this._userFilter = this._groupSortingLogic = null;
273
+
274
+ if(this._refreshTimerId) {
275
+ clearTimeout(this._refreshTimerId);
276
+ this._refreshTimerId = 0;
277
+ }
278
+
279
+ if(this._columnStats) {
280
+ for(var field in this._columnStats) {
281
+ this._columnStats[field].dispose();
282
+ }
283
+ this._columnStats = null;
284
+ }
285
+ };
286
+
287
+ /** Get data by row id and column id (field)
288
+ * @public
289
+ * @param {string} rid
290
+ * @param {string} cid
291
+ * @returns {Object.<string, *>}
292
+ */
293
+ DataView.prototype.getData = function(rid, cid) {
294
+ return this._dt.getData(rid, cid);
295
+ };
296
+ /** Get entire row data by row id
297
+ * @public
298
+ * @param {string} rid
299
+ * @return {Object.<string, *>}
300
+ */
301
+ DataView.prototype.getRowData = function(rid) {
302
+ return this._dt.getRowData(rid);
303
+ };
304
+ /** @public
305
+ * @param {string} cid
306
+ * @param {boolean=} inclNonDataRow=false If enabled, group header rows are included
307
+ * @return {!Array}
308
+ */
309
+ DataView.prototype.getColumnData = function(cid, inclNonDataRow) {
310
+ var rids = this.getAllRowIds(true, inclNonDataRow);
311
+
312
+ var rows = [];
313
+ var len = rids.length;
314
+ for(var r = 0; r < len; ++r) {
315
+ var rowData = this._dt.getRowData(rids[r]);
316
+ if(rowData) {
317
+ rows.push(rowData[cid]);
318
+ } else if(inclNonDataRow) {
319
+ rows.push(null);
320
+ }
321
+ }
322
+ return rows;
323
+ };
324
+ /** @public
325
+ * @param {number} rowIndex
326
+ * @return {string}
327
+ * @see {@link DataView#getRowIndex}
328
+ */
329
+ DataView.prototype.getRowId = function(rowIndex) {
330
+ this._rebuildRowIdsFromChildren();
331
+
332
+ return this._getRids()[rowIndex] || "";
333
+ };
334
+ /** @private
335
+ * @param {number|string} rowRef
336
+ * @return {string}
337
+ */
338
+ DataView.prototype._toRowId = function(rowRef) {
339
+ if(typeof rowRef === "number") {
340
+ this._rebuildRowIdsFromChildren();
341
+ return this._getRids()[rowRef] || "";
342
+ }
343
+ return /** @type{string} */(rowRef || "");
344
+ };
345
+ /** @private
346
+ * @param {Array.<number|string>} rowRefs
347
+ * @return {Array.<string>}
348
+ */
349
+ DataView.prototype._toRowIds = function(rowRefs) {
350
+ var rowCount = Array.isArray(rowRefs) ? rowRefs.length : 0;
351
+ var ary = new Array(rowCount);
352
+ var rids = this._getRids();
353
+ for(var r = 0; r < rowCount; ++r) {
354
+ var rowRef = rowRefs[r];
355
+ if(typeof rowRef === "number") {
356
+ this._rebuildRowIdsFromChildren();
357
+ ary[r] = rids[rowRef] || "";
358
+ } else {
359
+ ary[r] = rowRef || "";
360
+ }
361
+ }
362
+ return ary;
363
+ };
364
+ /** Return all row ids with row data, excluding the group header rows (auto generated rows).<br>
365
+ * Do use getAllRowData to retrieve all data
366
+ * @public
367
+ * @param {boolean=} shallowCopy Default value is false. Set to true for speed
368
+ * @param {boolean=} inclNonDataRow=false If enabled, group header rows are included
369
+ * @return {!Array.<string>}
370
+ * @see {@link DataView#getAllRowData}
371
+ * @see {@link DataView#getMultipleRowData}
372
+ */
373
+ DataView.prototype.getAllRowIds = function(shallowCopy, inclNonDataRow) {
374
+ this._rebuildRowIdsFromChildren();
375
+
376
+ // WARNING: this._pageView can contain non-data rows (group header rows), even if inclNonDataRow flag is false
377
+ var rids = (inclNonDataRow) ? this._getRids() : (this._pageView || this._rids);
378
+
379
+ return (shallowCopy) ? rids : rids.slice(0); // Fastest way to clone an array is Array.slice()
380
+ };
381
+ /** Return all data rows that is filtered and sorted, excluding header rows or paging. This method ignores pagination.
382
+ * @public
383
+ * @param {boolean=} opt_shallowCopy Default value is false. Set to true for speed
384
+ * @return {!Array.<string>}
385
+ */
386
+ DataView.prototype.getSortedRowIds = function(opt_shallowCopy) {
387
+ this._rebuildRowIdsFromChildren();
388
+ if(opt_shallowCopy) {
389
+ return this._rids;
390
+ }
391
+ return this._rids.slice(0); // Fastest way to clone an array
392
+ };
393
+ /** This method is quite slow
394
+ * @public
395
+ * @param {string} rid
396
+ * @return {number}
397
+ * @see {@link DataView#getRowId}
398
+ */
399
+ DataView.prototype.getRowIndex = function(rid) {
400
+ this._rebuildRowIdsFromChildren();
401
+
402
+ return this._getRids().indexOf(rid);
403
+ };
404
+ /** @public
405
+ * @return {number}
406
+ */
407
+ DataView.prototype.getRowCount = function() {
408
+ return this._getRids().length;
409
+ };
410
+ /** @public
411
+ * @param {number} rowIndex
412
+ * @param {string} cid
413
+ * @returns {Object.<string, *>}
414
+ */
415
+ DataView.prototype.getDataAt = function(rowIndex, cid) {
416
+ return this._dt.getData(this.getRowId(rowIndex), cid);
417
+ };
418
+ /** This method is slow. When working with huge amount of rows, use getRowData in combination with getAllRowIds(true) instead of calling getRowDataAt multiple times.
419
+ * @public
420
+ * @param {number} rowIndex
421
+ * @return {Object.<string, *>}
422
+ */
423
+ DataView.prototype.getRowDataAt = function(rowIndex) {
424
+ return this._dt.getRowData(this.getRowId(rowIndex));
425
+ };
426
+ /** @public
427
+ * @param {string} rid
428
+ * @param {string} cid
429
+ * @returns {Object.<string, *>}
430
+ */
431
+ DataView.prototype.getPreviousData = function(rid, cid) {
432
+ return this._dt.getPreviousData(rid, cid);
433
+ };
434
+ /** @public
435
+ * @param {Array.<string>} rids
436
+ * @param {number=} opt_from
437
+ * @param {number=} opt_to EXCLUSIVE
438
+ * @return {!Array.<Object>}
439
+ */
440
+ DataView.prototype.getMultipleRowData = function(rids, opt_from, opt_to) {
441
+ return this._dt.getMultipleRowData(rids, opt_from, opt_to);
442
+ };
443
+ /** Return all rows with row data, excluding the group header rows (auto generated rows)
444
+ * @public
445
+ * @return {!Array.<Object>}
446
+ */
447
+ DataView.prototype.getAllRowData = function() {
448
+ return this.getMultipleRowData(this.getAllRowIds(true));
449
+ };
450
+
451
+ /** @public
452
+ * @param {string} rid
453
+ * @param {string} cid
454
+ * @param {*} value
455
+ * @return {boolean} Return true if there is any change, and false otherwise
456
+ * @fires DataView#dataChanged
457
+ */
458
+ DataView.prototype.setData = function(rid, cid, value) {
459
+ if(this._dt) {
460
+ return this._dt.setData(rid, cid, value);
461
+ }
462
+ return false;
463
+ };
464
+ /** @public
465
+ * @param {string} rid
466
+ * @param {Object.<string, *>=} values
467
+ * @param {Object=} opt_eventArg
468
+ * @return {boolean} Return true if there is any change, and false otherwise
469
+ * @fires DataView#dataChanged
470
+ */
471
+ DataView.prototype.setRowData = function(rid, values, opt_eventArg) {
472
+ if(rid && this._dt) {
473
+ if (!this.isRowExpansion(rid)) {
474
+ return this._dt.setRowData(rid, values, opt_eventArg);
475
+ }
476
+ }
477
+ return false;
478
+ };
479
+ /** Set data in a column manner. This is faster than repeatedly calling {@link DataTable#setData}
480
+ * @public
481
+ * @param {string} cid
482
+ * @param {Array} valueList
483
+ * @param {Array.<string>=} opt_ridList Specify row id to be set corresponding to the data item
484
+ */
485
+ DataView.prototype.setColumnData = function(cid, valueList, opt_ridList) {
486
+ // Note: This function should filter out row expansion before calling dt.setColumnData
487
+ if(this._dt) {
488
+ this._dt.setColumnData(cid, valueList, opt_ridList);
489
+ }
490
+ };
491
+ /** This method is slow. When working with huge amount of rows, use setData in combination with getAllRowIds(true) instead of calling setDataAt multiple times.
492
+ * @public
493
+ * @param {number} rowIndex
494
+ * @param {string} cid
495
+ * @param {*} value
496
+ * @return {boolean} Return true if there is any change, and false otherwise
497
+ * @fires DataView#dataChanged
498
+ */
499
+ DataView.prototype.setDataAt = function(rowIndex, cid, value) {
500
+ var rid = this.getRowId(rowIndex);
501
+ if(rid && this._dt) {
502
+ return this._dt.setData(rid, cid, value);
503
+ }
504
+ return false;
505
+ };
506
+ /** This method is slow. When working with huge amount of rows, use setRowData in combination with getAllRowIds(true) instead of calling setRowDataAt multiple times.
507
+ * @public
508
+ * @param {number} rowIndex
509
+ * @param {Object.<string, *>=} values
510
+ * @param {Object=} opt_eventArg
511
+ * @return {boolean} Return true if there is any change, and false otherwise
512
+ * @fires DataView#dataChanged
513
+ */
514
+ DataView.prototype.setRowDataAt = function(rowIndex, values, opt_eventArg) {
515
+ var rid = this.getRowId(rowIndex);
516
+ return this.setRowData(rid, values, opt_eventArg);
517
+ };
518
+
519
+ /** @public
520
+ * @param {string|number} rowRef The position of the new row
521
+ * @param {Object.<string, *>=} opt_values
522
+ * @param {string|null=} opt_rid If the given row Id already exists, data is updated and no new row is added. Leave blank or null to let DataTable generate unique row Id
523
+ * @return {string} Return Row id that has been inserted or changed
524
+ */
525
+ DataView.prototype.insertRow = function(rowRef, opt_values, opt_rid) { // Data changed event may be dispatched
526
+ this._rebuildRowIdsFromChildren(); // TODO: Check if we need to rebuild row ids
527
+ var nextRid = this._toRowId(rowRef);
528
+
529
+ if(this._dt) {
530
+ return this._dt.insertRow(nextRid, opt_values, opt_rid);
531
+ }
532
+ return "";
533
+ };
534
+
535
+ /** Permanently remove the specified row by row id or DataView's row index. If you want to temporarily remove the row, use {@link DataView.hideRows} instead
536
+ * @public
537
+ * @param {number|string} rowRef
538
+ * @fires DataView#dataChanged
539
+ */
540
+ DataView.prototype.removeRow = function(rowRef) {
541
+ if(this._dt) {
542
+ this._dt.removeRow(this._toRowId(rowRef)); // Trigger dataChanged
543
+ }
544
+ };
545
+ /** Permanently remove the specified rows by row id or DataView's row index. If you want to temporarily remove the rows, use {@link DataView.hideRows} instead
546
+ * @public
547
+ * @param {Array.<number|string>} refs
548
+ */
549
+ DataView.prototype.removeRows = function(refs) {
550
+ if(!this._dt) { return; }
551
+ for(var i = refs.length; --i >= 0;) {
552
+ var rowRef = refs[i];
553
+ if(typeof rowRef === "number") {
554
+ refs[i] = this.getRowId(rowRef);
555
+ }
556
+ }
557
+ this._dt.removeRows(refs); // Trigger dataChanged
558
+ };
559
+ /** Move a single row or multiple rows to the position BEFORE the specified index (toIndex).
560
+ * @public
561
+ * @param {Array.<number>|number} fromIndex fromIndex could be a rowIndex or array of rowIndex.
562
+ * @param {number} toIndex
563
+ * @return {Array.<string>|string} rid rowId or array of the rowId of the moved row(s)
564
+ * @example
565
+ * ary = [0, 1, 2];
566
+ * move(ary, 0, 1); // [0, 1, 2] Move index 0 to the position before index 1 (nothing is changed)
567
+ * move(ary, 1, 0); // [1, 0, 2] Move index 1 to the position before index 0
568
+ */
569
+ DataView.prototype.moveRow = function(fromIndex, toIndex) {
570
+ this._rebuildRowIdsFromChildren();
571
+ var rids = this._getRids();
572
+
573
+ var toRid = (toIndex >= 0 && toIndex < rids.length) ? rids[toIndex] : "";
574
+
575
+ var fromIndices = /** @type{Array.<number>} */(Array.isArray(fromIndex) ? fromIndex : [fromIndex]);
576
+ var len = fromIndices.length;
577
+ var fromRids = new Array(len);
578
+ for(var i = 0; i < len; ++i) {
579
+ fromRids[i] = rids[fromIndices[i]];
580
+ }
581
+
582
+ if(this._dt.hasSegmentation()) {
583
+ this.synchronizeRowOrder();
584
+ }
585
+
586
+ return this._dt._moveRow(fromRids, toRid);
587
+ };
588
+
589
+ /** Deprecated
590
+ * @public
591
+ * @function
592
+ * @param {number} fromIndex
593
+ * @param {number} toIndex INCLUSIVE
594
+ */
595
+ DataView.prototype.swapRow = Util._deprecatedFunction;
596
+
597
+ /** Returns the root data source (DataTable) of all data views
598
+ * @public
599
+ * @return {DataTable}
600
+ * @see {@link DataView#getDataSource}
601
+ */
602
+ DataView.prototype.getDataTable = function() {
603
+ return this._dt;
604
+ };
605
+ /** Return source for this data view which could be another data view or a data table.
606
+ * @public
607
+ * @return {DataTable|DataView}
608
+ * @see {@link DataView#getDataTable}
609
+ */
610
+ DataView.prototype.getDataSource = function() {
611
+ return this._parent;
612
+ };
613
+ /** @public
614
+ * @param {DataTable|DataView=} source
615
+ * @fires DataView#dataChanged
616
+ */
617
+ DataView.prototype.setDataSource = function(source) {
618
+ if(source) {
619
+ if(this._groupLevel > 0) {
620
+ return; // Sub group cannot be changed data source
621
+ }
622
+ this._setParent(source);
623
+
624
+ this._onDataChanged(DataTable._globalChangeArg); // Update current view
625
+ this._parent.listen("dataChanged", this._onDataChanged);
626
+ } else {
627
+ if(this._parent) {
628
+ this._parent.unlisten("dataChanged", this._onDataChanged);
629
+ this._resetAllViews();
630
+ this._groupViewDirty = false;
631
+ }
632
+ this._parent = this._dt = null;
633
+ this._shared = {}; // The options are no longer shared
634
+ }
635
+ };
636
+
637
+ /** @public
638
+ * @param {number} milliSecond
639
+ */
640
+ DataView.prototype.setConflationRate = function (milliSecond) {
641
+ this._conflator.disable(!milliSecond);
642
+ this._conflator.setConflatingTime(milliSecond);
643
+ };
644
+
645
+ /** @public
646
+ * @return {number}
647
+ */
648
+ DataView.prototype.getConflationRate = function () {
649
+ return this._conflator.getConflatingTime();
650
+ };
651
+
652
+ /** @private
653
+ */
654
+ DataView.prototype._resetAllViews = function() {
655
+ this._rids.length = 0;
656
+ if(this._groupView && this._groupView.length) { this._groupView.length = 0; }
657
+ if(this._pageView && this._pageView.length) { this._pageView.length = 0; }
658
+ if(this._expansionView && this._expansionView.length) { this._expansionView.length = 0; }
659
+ };
660
+
661
+ /**
662
+ * @public
663
+ * @ignore
664
+ * @return {Object.<string, DataTable.SortLogic>}
665
+ */
666
+ DataView.prototype.getSortingLogics = function() {
667
+ return this._dt ? this._dt.getSortingLogics() : null;
668
+ };
669
+ /** @public
670
+ * @param {string|Array.<string>} cid
671
+ * @param {string|number|Array.<string|number>=} opt_sortOrder
672
+ * @param {Function|Array.<Function>=} sortLogics
673
+ * @param {boolean=} noOptimization=false Force to sort without optimization to refresh all rowIds again.
674
+ * @fires DataView#dataChanged
675
+ */
676
+ DataView.prototype.sort = function (cid, opt_sortOrder, sortLogics, noOptimization) {
677
+ if(this._groupLevel > 0) {
678
+ window.console.log("ERROR: Sub-group cannot be sorted individually");
679
+ return;
680
+ }
681
+
682
+ var compMap = this.getSortingLogics();
683
+ var sortingDefs = this._sortingDefs;
684
+ var curSortLen = sortingDefs.length;
685
+
686
+ if (Array.isArray(sortLogics)) {
687
+ for(var c = sortLogics.length; --c >= 0;) {
688
+ if (typeof sortLogics[c] !== "function") {
689
+ var columnId = Array.isArray(cid) ? cid[c] : cid;
690
+ sortLogics[c] = compMap[columnId] || compMap["_default"];
691
+ }
692
+ }
693
+ }
694
+ DataTable._buildSortContext(
695
+ sortingDefs,
696
+ cid,
697
+ opt_sortOrder,
698
+ sortLogics || compMap
699
+ );
700
+ if(sortingDefs.length === 1 && sortingDefs[0][3] === 0) { // Sort order is zero which is resetting to original order
701
+ sortingDefs.length = 0;
702
+ }
703
+ if(curSortLen <= 0 && sortingDefs.length <= 0) {
704
+ return; // Nothing is changed
705
+ }
706
+ if(this._shared.stalledRids) { // The stalled view cannot be changed
707
+ return;
708
+ }
709
+
710
+ var change = false;
711
+
712
+ if (this._groupMembers || sortingDefs.length <= 0 || noOptimization) {
713
+ change = true;
714
+ this._updateRowIds(); // WARNING: Slow!
715
+ } else { // filtering should already be done beforehand
716
+ change = this._sort();
717
+ }
718
+ if (change) {
719
+ this._dispatchDataChange(DataTable._positionChangeArg);
720
+ }
721
+ };
722
+ /** @public
723
+ * @param {string|Array.<string>} cid
724
+ * @param {string|number|Array.<string|number>=} opt_sortOrder
725
+ * @fires DataView#dataChanged
726
+ */
727
+ DataView.prototype.sortOnce = function(cid, opt_sortOrder) {
728
+ this.sort(cid, opt_sortOrder); // Global change event is dispatched
729
+ this._sortingDefs.length = 0;
730
+ };
731
+ /** @public
732
+ * @param {DataTable.SortLogic} func
733
+ * @example
734
+ * customLogic = function(a, b, sortOrder) {
735
+ * return (a - b) * sortOrder; // for numeric comparison
736
+ * };
737
+ * var dt = new DataTable();
738
+ * var dv = new DataView(dt);
739
+ * dv.setSortingLogic(customLogic);
740
+ * dv.sort("Column id", "ascending");
741
+ */
742
+ DataView.prototype.setSortingLogic = function(func) {
743
+ if(this._dt) {
744
+ this._dt.setSortingLogic(func);
745
+ }
746
+ };
747
+ /** Specified sorting logic for the column with the given column id. This will override logic set by {@link DataView#setSortingLogic}, when the column is sorted
748
+ * @public
749
+ * @param {string} cid
750
+ * @param {DataTable.SortLogic} func Use null to remove current sorting logic
751
+ */
752
+ DataView.prototype.setColumnSortingLogic = function(cid, func) {
753
+ if(this._dt) {
754
+ this._dt.setColumnSortingLogic(cid, func);
755
+ }
756
+ };
757
+ /** Check if this view is in sorting mode
758
+ * @public
759
+ * @return {boolean}
760
+ */
761
+ DataView.prototype.isSorting = function() {
762
+ return this._sortingDefs.length > 0;
763
+ };
764
+
765
+ /** Hide rows in the data view
766
+ * @param {string|number} rId Row id to hide. If the rId is a number, it will be treated as a row index
767
+ * @param {boolean=} opt_show show if false
768
+ * @public
769
+ */
770
+ DataView.prototype.hideRow = function(rId, opt_show) {
771
+ this.showRows([rId], opt_show === false);
772
+ };
773
+ /** Hide rows in the data view
774
+ * @param {Array.<string|number>} rowRefs Array of row ids or indices to hide
775
+ * @param {boolean=} opt_show show if false
776
+ * @public
777
+ */
778
+ DataView.prototype.hideRows = function(rowRefs, opt_show) {
779
+ this.showRows(rowRefs, opt_show === false);
780
+ };
781
+ /**
782
+ * Show/hide rows in the data view
783
+ * @param {Array.<string|number>} rowRefs Array of row ids or indices to hide
784
+ * @param {boolean=} opt_show hide instead show if false
785
+ * @public
786
+ */
787
+ DataView.prototype.showRows = function(rowRefs, opt_show) {
788
+ var hidden = opt_show === false;
789
+ if(hidden){
790
+ if(!this._hiddenRids) {
791
+ this._hiddenRids = {};
792
+ }
793
+ } else if(!this._hiddenRids) {
794
+ return; // All rows are visible
795
+ }
796
+
797
+ var rids = this._toRowIds(rowRefs);
798
+ for(var i = rids.length; --i >= 0;) {
799
+ var rid = rids[i];
800
+ if(rid) { // undefined, null, and an empty string value are not a valid row id
801
+ this._hiddenRids[rid] = hidden;
802
+ }
803
+ }
804
+
805
+ this._refreshAndNotify(); // Very slow
806
+ };
807
+ /** Unhide all rows
808
+ * @public
809
+ */
810
+ DataView.prototype.unhideAllRows = function(){
811
+ if(this._hiddenRids) {
812
+ this._hiddenRids = null;
813
+ this._refreshAndNotify();
814
+ }
815
+ };
816
+ /** Check if there is any hidden row
817
+ * @public
818
+ * @return {boolean}
819
+ */
820
+ DataView.prototype.hasHiddenRow = function(){
821
+ return !!this._hiddenRids;
822
+ };
823
+
824
+ /** @public
825
+ * @param {string|function(string, Object.<string, *>):boolean} cid Use string to identify column name. Use function for custom filter logic. Function will take rowId and column values as parameters, and return boolean value
826
+ * @param {*=} value
827
+ * @param {boolean=} opt_filteringOut
828
+ * @return {boolean} Return true if there is any change. Otherwise, return false.
829
+ * @fires DataView#pageCountChanged
830
+ * @fires DataView#pageIndexChanged
831
+ * @fires DataView#dataChanged
832
+ * @example
833
+ * dv.filterIn("FIELD", "Some value");
834
+ * dv.filterIn(function(rowId, rowData)) { // This is equivalent with the above statement
835
+ * return rowData["FIELD"] === "Some value";
836
+ * });
837
+ */
838
+ DataView.prototype.filterIn = function(cid, value, opt_filteringOut) {
839
+ var newLogic = this._getFilterLogic(cid, value);
840
+ var filteringOut = (opt_filteringOut === true);
841
+ if(this._userFilter === newLogic && typeof cid !== "function") {
842
+ if(!newLogic || filteringOut === this._filteringOut) {
843
+ return false; // Nothing to update
844
+ }
845
+ }
846
+ this._shared.filterLogic = newLogic;
847
+ this._userFilter = newLogic;
848
+ this._filteringOut = filteringOut;
849
+ this._refreshAndNotify();
850
+ return true;
851
+ };
852
+ /** @public
853
+ * @param {string|function(string, Object.<string, *>):boolean} cid Use string to identify column name. Use function for custom filter logic. Function will take rowId and column values as parameters, and return boolean value
854
+ * @param {*=} value
855
+ * @return {boolean} Return true if there is any change. Otherwise, return false.
856
+ * @fires DataView#pageCountChanged
857
+ * @fires DataView#pageIndexChanged
858
+ * @fires DataView#dataChanged
859
+ * @example
860
+ * dv.filterIn("FIELD", "Some value");
861
+ * dv.filterOut(function(rowId, rowData)) { // This is equivalent with the above statement
862
+ * return rowData["FIELD"] !== "Some value";
863
+ * });
864
+ */
865
+ DataView.prototype.filterOut = function(cid, value) {
866
+ return this.filterIn(cid, value, true);
867
+ };
868
+ /** @public
869
+ * @param {string|Function} cid Use string to identify column name. Use function for custom filter logic. Function will take rowId and column values as parameters, and return boolean value
870
+ * @param {*=} value
871
+ * @param {boolean=} opt_filteringOut
872
+ * @fires DataView#pageCountChanged
873
+ * @fires DataView#pageIndexChanged
874
+ * @fires DataView#dataChanged
875
+ */
876
+ DataView.prototype.filterInOnce = function(cid, value, opt_filteringOut) {
877
+ var checker = this._getFilterLogic(cid, value);
878
+ if(!checker) { return; }
879
+
880
+ var filteringOut = (opt_filteringOut === true);
881
+ var rids = this._rids;
882
+ var dt = this._dt;
883
+ var removalMap = {};
884
+ var totalRem = 0;
885
+ var len = rids.length;
886
+ for(var i = len; --i >= 0;) {
887
+ var rid = rids[i];
888
+ var values = dt.getRowData(rid);
889
+ if (!values || checker(rid, values) === filteringOut) {
890
+ removalMap[rid] = true;
891
+ ++totalRem;
892
+ }
893
+ }
894
+ if(totalRem <= 0) { return; }
895
+
896
+ var firstChange = this._removeRowIds(removalMap);
897
+
898
+ var pageIndexChanged = this._updatePageCount();
899
+ if(pageIndexChanged || this._transformView(firstChange)) {
900
+ this._dispatchGlobalChange();
901
+ } else {
902
+ this._dispatchMultiRowRemoved(Object.keys(removalMap));
903
+ }
904
+ };
905
+ /** @public
906
+ * @suppress {checkTypes}
907
+ * @param {string|function(string, Object.<string, *>):boolean} cid Use string to identify column name. Use function for custom filter logic. Function will take rowId and column values as parameters, and return boolean value
908
+ * @param {*=} value
909
+ * @fires DataView#pageCountChanged
910
+ * @fires DataView#pageIndexChanged
911
+ * @fires DataView#dataChanged
912
+ */
913
+ DataView.prototype.filterOutOnce = function(cid, value) {
914
+ this.filterInOnce(cid, value, true);
915
+ };
916
+ /** @private
917
+ * @param {!Object.<string, *>} removalMap
918
+ * @return {number}
919
+ */
920
+ DataView.prototype._removeRowIds = function(removalMap) {
921
+ var firstChange = this._removeArrayItems(this._rids, removalMap);
922
+ if(this._groupView) {
923
+ firstChange = this._removeArrayItems(this._groupView, removalMap);
924
+ }
925
+
926
+ if(this._groupMembers) {
927
+ var len = this._groupList.length;
928
+ for(var i = 0; i < len; ++i) {
929
+ var groupId = this._groupList[i];
930
+ this._groupMembers[groupId]._removeRowIds(removalMap);
931
+ }
932
+ }
933
+ return firstChange;
934
+ };
935
+ /** @public
936
+ * @fires DataView#pageCountChanged
937
+ * @fires DataView#pageIndexChanged
938
+ * @fires DataView#dataChanged
939
+ */
940
+ DataView.prototype.clearFilter = function() {
941
+ if(this._userFilter) {
942
+ this._userFilter = null;
943
+ this._shared.filterLogic = null;
944
+ this._refreshAndNotify();
945
+ }
946
+ };
947
+
948
+ /** Disable the page index correction
949
+ * @public
950
+ * @param {boolean=} opt_disable
951
+ */
952
+ DataView.prototype.disablePageCorrection = function(opt_disable) {
953
+ this._pageCorrection = (opt_disable === false);
954
+ };
955
+ /** Goes to the specified page
956
+ * @public
957
+ * @param {number} pageIndex
958
+ * @return {boolean} True if there is any change, otherwise false
959
+ * @fires DataView#pageIndexChanged
960
+ * @fires DataView#dataChanged
961
+ */
962
+ DataView.prototype.setPage = function (pageIndex) {
963
+ var result = this._setPage(pageIndex);
964
+ if(result) {
965
+ this._dispatchGlobalChange();
966
+ }
967
+ return result;
968
+ };
969
+ /** {@link DataView#setPage}
970
+ * @public
971
+ * @function
972
+ * @fires DataView#pageIndexChanged
973
+ * @fires DataView#dataChanged
974
+ */
975
+ DataView.prototype.gotoPage = DataView.prototype.setPage;
976
+ /** Goes to the next page. If current page is already the last page, nothing is performed
977
+ * @public
978
+ * @return {boolean} True if there is any change, otherwise false
979
+ * @fires DataView#pageIndexChanged
980
+ * @fires DataView#dataChanged
981
+ */
982
+ DataView.prototype.nextPage = function () {
983
+ return this.gotoPage(this._pageIndex + 1);
984
+ };
985
+ /** Goes back to the previous page. If current page is already the first page, nothing is performed
986
+ * @public
987
+ * @return {boolean} True if there is any change, otherwise false
988
+ * @fires DataView#pageIndexChanged
989
+ * @fires DataView#dataChanged
990
+ */
991
+ DataView.prototype.previousPage = function () {
992
+ return this.gotoPage(this._pageIndex - 1);
993
+ };
994
+ /** {@link DataView#previousPage}
995
+ * @public
996
+ * @function
997
+ * @fires DataView#pageIndexChanged
998
+ * @fires DataView#dataChanged
999
+ */
1000
+ DataView.prototype.prevPage = DataView.prototype.previousPage;
1001
+ /** Goes to the last page
1002
+ * @public
1003
+ * @return {boolean} True if there is any change, otherwise false
1004
+ * @fires DataView#pageIndexChanged
1005
+ * @fires DataView#dataChanged
1006
+ */
1007
+ DataView.prototype.lastPage = function () {
1008
+ return this.gotoPage(this._lastPageIndex - 1);
1009
+ };
1010
+ /** Goes to the first page
1011
+ * @public
1012
+ * @return {boolean} True if there is any change, otherwise false
1013
+ * @fires DataView#pageIndexChanged
1014
+ */
1015
+ DataView.prototype.firstPage = function () {
1016
+ return this.gotoPage(0);
1017
+ };
1018
+
1019
+ /**
1020
+ * @public
1021
+ * @return {number}
1022
+ */
1023
+ DataView.prototype.getCurrentPage = function () {
1024
+ return this._pageIndex;
1025
+ };
1026
+ /** {@link DataView#getCurrentPage}
1027
+ * @public
1028
+ * @function
1029
+ */
1030
+ DataView.prototype.getPageIndex = DataView.prototype.getCurrentPage;
1031
+ /** Verifies that current page is the last page
1032
+ * @public
1033
+ * @return {boolean}
1034
+ */
1035
+ DataView.prototype.isOnLastPage = function () {
1036
+ return (this._pageIndex === this._lastPageIndex);
1037
+ };
1038
+ /** Verifies that current page is the first page
1039
+ * @public
1040
+ * @return {boolean}
1041
+ */
1042
+ DataView.prototype.isOnFirstPage = function () {
1043
+ return (this._pageIndex === 1);
1044
+ };
1045
+
1046
+ /** Get total number of rows in a single page
1047
+ * @public
1048
+ * @return {number}
1049
+ */
1050
+ DataView.prototype.getPageSize = function () {
1051
+ return this._pageSize;
1052
+ };
1053
+ /** Get total number of pages
1054
+ * @public
1055
+ * @return {number}
1056
+ */
1057
+ DataView.prototype.getPageCount = function () {
1058
+ return this._lastPageIndex;
1059
+ };
1060
+ /** {@link DataView#getTotalPages}
1061
+ * @public
1062
+ * @function
1063
+ */
1064
+ DataView.prototype.getTotalPages = DataView.prototype.getPageCount;
1065
+ /** Shrink current view to the specified size. Set it 0 to reset to original size
1066
+ * @public
1067
+ * @param {number} pageSize
1068
+ * @fires DataView#pageCountChanged
1069
+ * @fires DataView#pageIndexChanged
1070
+ * @fires DataView#dataChanged
1071
+ */
1072
+ DataView.prototype.setPageSize = function (pageSize) {
1073
+ if(!(pageSize >= 0)) { pageSize = 0; }
1074
+ if(this._pageSize === pageSize) { return; }
1075
+
1076
+ this._pageSize = pageSize;
1077
+ this._updatePageCount();
1078
+
1079
+ if(pageSize > 0) {
1080
+ if(!this._pageView) {
1081
+ this._pageView = [];
1082
+ }
1083
+ } else {
1084
+ if(this._pageView) {
1085
+ this._pageView = null;
1086
+ }
1087
+ }
1088
+
1089
+ if(!this._pageView || pageSize === 0) {
1090
+ this._updateRowIds();
1091
+ } else {
1092
+ // filtering and sorting should already be done beforehand
1093
+ this._transformView();
1094
+ }
1095
+ this._dispatchGlobalChange();
1096
+ };
1097
+
1098
+ /** string|function(Object.<string, *>):string|null
1099
+ * @public
1100
+ * @param {string|Function|Array.<string|Function>} cid Column id or grouper method that take one parameter for row data in JSON format, and returns groupId (string)
1101
+ * @param {Array=} opt_predefinedGroups
1102
+ * @fires DataView#groupAdded
1103
+ * @fires DataView#groupCriteriaChanged
1104
+ * @fires DataView#pageCountChanged
1105
+ * @fires DataView#pageIndexChanged
1106
+ */
1107
+ DataView.prototype.groupBy = function (cid, opt_predefinedGroups) {
1108
+ // always deactivate multi-group row mode, it will automatically activate when populating group
1109
+ this._shared.multiGroupRow = false;
1110
+
1111
+ if(this._groupCriteria) {
1112
+ if(this._groupList && this._groupList.length > 0) { // Dispose any existing member
1113
+ for(var key in this._groupMembers) {
1114
+ this._groupMembers[key].dispose(); // Clear everything in the data view
1115
+ }
1116
+ this._groupMembers = {}; // Clear all members
1117
+ this._groupList.length = 0;
1118
+ }
1119
+ this._groupCriteria = null;
1120
+ }
1121
+ if(opt_predefinedGroups != null) { // null is allowed
1122
+ this._setPredefinedGroups(opt_predefinedGroups);
1123
+ }
1124
+
1125
+ var i, len;
1126
+ if(cid && this._groupLevel === 0) { // Sub group cannot be re-group without its parent noticing it
1127
+ this._groupCriteria = [];
1128
+ var ary;
1129
+ if(!Array.isArray(cid)) {
1130
+ ary = [cid];
1131
+ } else {
1132
+ ary = /** @type{Array.<string|Function>} */(cid);
1133
+ }
1134
+ len = ary.length;
1135
+ for(i = 0; i < len; ++i) {
1136
+ var criteria = ary[i];
1137
+ if(typeof criteria === "string") {
1138
+ this._groupCriteria.push(this._defaultGroupCriteria.bind(this, criteria));
1139
+ } else if(criteria) {
1140
+ this._groupCriteria.push(/** @type{Function} */(criteria));
1141
+ }
1142
+ }
1143
+ }
1144
+
1145
+ if(this._groupCriteria) { // Only root view can have group criteria at this point
1146
+ if(!this._groupMembers) {
1147
+ this._groupMembers = {};
1148
+ this._groupList = [];
1149
+ this._groupRows = {};
1150
+ }
1151
+ if(!this._groupView) {
1152
+ this._groupView = [];
1153
+ }
1154
+ } else {
1155
+ this._groupMembers = null;
1156
+ this._groupList = null;
1157
+ this._groupView = null;
1158
+ if(this._groupRows) { // this._groupRows is a shared member
1159
+ if(this._groupLevel <= 0) {
1160
+ this._footerRowIds = null;
1161
+ } else {
1162
+ if(this._groupRowId) {
1163
+ delete this._groupRows[this._groupRowId];
1164
+ }
1165
+ if(this._footerRowIds) {
1166
+ len = this._footerRowIds.length;
1167
+ for(i = 0; i < len; ++i) {
1168
+ delete this._groupRows[this._footerRowIds[i]];
1169
+ }
1170
+ this._footerRowIds = null;
1171
+ }
1172
+ }
1173
+ this._groupRows = null;
1174
+ }
1175
+ this._groupValue = null;
1176
+ }
1177
+ this._groupLevel = 0; // View that is set criteria will always be in the first group level
1178
+ this._updateRowIds();
1179
+
1180
+ this._dispatch("groupCriteriaChanged", {});
1181
+ this._dispatchGlobalChange();
1182
+ };
1183
+ /** addGroup is used to add a single predefined group or multiple predefined groups.
1184
+ * @public
1185
+ * @param {*|Array} value
1186
+ * @fires DataView#groupAdded
1187
+ * @fires DataView#pageCountChanged
1188
+ * @fires DataView#pageIndexChanged
1189
+ */
1190
+ DataView.prototype.addGroup = function (value) {
1191
+ if(!this._groupMembers) {
1192
+ // window.console.log("Group criteria must be specified first before adding any group");
1193
+ return;
1194
+ }
1195
+
1196
+ if(!isArray(value)) {
1197
+ this._addGroup(value);
1198
+ } else {
1199
+ var ary = /** @type{Array} */(value);
1200
+ var len = ary.length;
1201
+ for(var i = 0; i < len; ++i) {
1202
+ this._addGroup(ary[i]);
1203
+ }
1204
+ }
1205
+ };
1206
+ /** Sort all of its descendants based on given compare function
1207
+ * @public
1208
+ * @param {Function=} compare Default is sorting by text. If null or false value is given, no sorting is performed
1209
+ */
1210
+ DataView.prototype.sortGroups = function (compare) {
1211
+ if(!this._groupMembers) { return; }
1212
+
1213
+ if(compare == null) {
1214
+ this._groupSortingLogic = DataView._defaultGroupSortingLogic; // Temporary set the variable
1215
+ } else {
1216
+ this._groupSortingLogic = compare || null;
1217
+ }
1218
+ if(!this._groupSortingLogic) {
1219
+ return; // No logic is defined
1220
+ }
1221
+
1222
+ this._groupList.sort(this._internalGroupSortingLogic);
1223
+ for(var i = this._groupList.length; --i >= 0;){
1224
+ var groupId = this._groupList[i];
1225
+ this._groupMembers[groupId].sortGroups(this._groupSortingLogic);
1226
+ }
1227
+ this._groupViewDirty = true;
1228
+ if(this._groupLevel <= 0) {
1229
+ this._dispatchGlobalChange();
1230
+ }
1231
+ };
1232
+ /** Move the specified group within its group
1233
+ * @public
1234
+ * @param {number|string} groupRef
1235
+ * @param {number} destIndex
1236
+ */
1237
+ DataView.prototype.moveGroup = function (groupRef, destIndex) {
1238
+ var movedGroup = this.getGroup(groupRef);
1239
+ if(!movedGroup) {
1240
+ return; // Cannot find the given group
1241
+ }
1242
+
1243
+ var parentGroup = movedGroup.getDataSource();
1244
+ var groupId = movedGroup.getGroupId();
1245
+ var curGroupIndex = parentGroup._groupList.indexOf(groupId);
1246
+ if(curGroupIndex === destIndex || curGroupIndex + 1 === destIndex) {
1247
+ return; // Nothing is needed to be moved
1248
+ }
1249
+
1250
+ parentGroup._groupList.splice(curGroupIndex, 1);
1251
+ if(curGroupIndex < destIndex) {
1252
+ --destIndex;
1253
+ }
1254
+ parentGroup._groupList.splice(destIndex, 0, groupId);
1255
+
1256
+ this._requestRebuildingRowIds(false);
1257
+ };
1258
+ /** WARNING: This could be very slow to perform
1259
+ * @public
1260
+ * @param {Array} predefinedGroups Use two dimensional array to define groups for multi-level grouping. The first item is for the top level groups. The second item is for the second level groups, and so on. If one dimentional array is given, it is treated as the first item in the two-dimentionsal array.
1261
+ * @example
1262
+ * dv.setPredefinedGroups(["a", "b", "c"]); // Create empty three empty groups
1263
+ * dv.setPredefinedGroups([ // Create two empty groups, and each group has 3 sub-groups
1264
+ * ["Main Group 1", "Main 2"],
1265
+ * ["Sub 1", "Sub 2", "Sub 3"]
1266
+ * ]);
1267
+ */
1268
+ DataView.prototype.setPredefinedGroups = function (predefinedGroups) {
1269
+ this._setPredefinedGroups(predefinedGroups);
1270
+ if(this._groupMembers) {
1271
+ this._refreshAndNotify();
1272
+ }
1273
+ };
1274
+ /** @private
1275
+ * @param {Array} predefinedGroups
1276
+ */
1277
+ DataView.prototype._setPredefinedGroups = function (predefinedGroups) {
1278
+ if(this._preDefGroups === predefinedGroups) {
1279
+ return;
1280
+ }
1281
+
1282
+ if(this._preDefGroups) {
1283
+ this._preDefGroups.length = 0; // Remove all predefined groups in all members (this var is shared)
1284
+ }
1285
+ var is2D = false;
1286
+ if(predefinedGroups) {
1287
+ for(var i = predefinedGroups.length; --i >= 0;) {
1288
+ if(Array.isArray(predefinedGroups[i])) {
1289
+ is2D = true;
1290
+ break;
1291
+ }
1292
+ }
1293
+ }
1294
+
1295
+ if(is2D) {
1296
+ this._preDefGroups = predefinedGroups; // WARNING: Referencing user's object
1297
+ } else if(Array.isArray(predefinedGroups)) {
1298
+ this._preDefGroups = [predefinedGroups]; // Convert to 2D Array
1299
+ } else {
1300
+ this._preDefGroups = null;
1301
+ }
1302
+ this._preDefGroupsDirty = true;
1303
+ };
1304
+
1305
+ /** Add a footer to current group
1306
+ * @public
1307
+ * @param {number=} opt_num Number of footer to be added. If not specified, the number is one.
1308
+ */
1309
+ DataView.prototype.addFooter = function (opt_num) {
1310
+ if(this._groupLevel <= 0) {
1311
+ console.log("WARNING: Only group can have a footer");
1312
+ return;
1313
+ }
1314
+ if(opt_num == null) {
1315
+ opt_num = 1;
1316
+ }
1317
+ if(opt_num <= 0) { // 0 and negative number is not acceptable
1318
+ return;
1319
+ }
1320
+
1321
+ if(!this._footerRowIds) {
1322
+ this._footerRowIds = [];
1323
+ }
1324
+
1325
+ for(var i = 0; i < opt_num; ++i) {
1326
+ var footerRowId = this._groupRowId + "_footer" + (this._footerRowIds.length || "");
1327
+ this._footerRowIds.push(footerRowId);
1328
+ this._groupRows[footerRowId] = this;
1329
+ }
1330
+
1331
+ if(!this._beingAdded) {
1332
+ this._requestRebuildingRowIds(this._collapsed); // Slow
1333
+ }
1334
+ };
1335
+ /** Remove all footers in the gurrent view
1336
+ * @public
1337
+ */
1338
+ DataView.prototype.removeFooter = function () {
1339
+ if(this._footerRowIds) {
1340
+ var len = this._footerRowIds.length;
1341
+ for(var i = 0; i < len; ++i) {
1342
+ delete this._groupRows[this._footerRowIds[i]];
1343
+ }
1344
+ this._footerRowIds = null;
1345
+
1346
+ if(!this._beingAdded) {
1347
+ this._requestRebuildingRowIds(this._collapsed); // Slow
1348
+ }
1349
+ }
1350
+ };
1351
+
1352
+ /** Enable/Disable multi-group row mode
1353
+ * @public
1354
+ * @ignore
1355
+ * @param {boolean=} enabled
1356
+ */
1357
+ DataView.prototype.enableMultiGroup = function(enabled) {
1358
+ this._shared.multiGroupRow = enabled !== false;
1359
+ };
1360
+
1361
+ /** Get a group DataView by group row id. If content row id is given, null is returned (unlike getGroup method).<br>
1362
+ * Nested groups and other groups outside of this group branch will be searched.
1363
+ * @public
1364
+ * @param {string} rowId Group Id, row Id or group index (for immediate child groups)
1365
+ * @return {DataView}
1366
+ * @see {@link DataView#getGroup}
1367
+ */
1368
+ DataView.prototype.getGroupByRowId = function (rowId) {
1369
+ if(this._groupRows) {
1370
+ return this._groupRows[rowId] || null;
1371
+ }
1372
+ return null;
1373
+ };
1374
+ /** Get a corresponding DataView by the given group Id, row Id or group index. If row Id of content row is given, a parent group will be returned. <br>
1375
+ * Nested groups and other groups outside of this group branch will be searched.
1376
+ * @public
1377
+ * @param {number|string} groupRef Group Id, row Id or group index (for immediate child groups)
1378
+ * @return {DataView}
1379
+ * @see {@link DataView#getGroupByRowId}
1380
+ */
1381
+ DataView.prototype.getGroup = function (groupRef) {
1382
+ if(!this._groupMembers) {
1383
+ return null;
1384
+ }
1385
+ var groupId;
1386
+ if(typeof groupRef === "number") {
1387
+ groupId = this._groupList[groupRef];
1388
+ if(!groupId) {
1389
+ return null;
1390
+ }
1391
+ } else {
1392
+ groupId = groupRef + ""; // Convert to string
1393
+ }
1394
+
1395
+ // Search immediate child groups by group Id
1396
+ var dv = this._groupMembers[groupId];
1397
+ if(dv) {
1398
+ return dv;
1399
+ }
1400
+
1401
+ // A group cannot be found by group Id. It is now assumed to be row id
1402
+ var rowId = groupId;
1403
+ dv = this._groupRows[rowId]; // Groups of any level will be searched
1404
+ if(dv) {
1405
+ return dv;
1406
+ }
1407
+
1408
+ // The given row id is not a group row. Check if it is actually content row of this group
1409
+ return this._getGroupByContentRowId(rowId); // Slow recursive function
1410
+ };
1411
+ /** Get group of this data view by content row id. Group outside of this group branch is NOT searched
1412
+ * @private
1413
+ * @param {string} rowId
1414
+ * @return {DataView} Group of rowId that given
1415
+ */
1416
+ DataView.prototype._getGroupByContentRowId = function (rowId) {
1417
+ if(this._groupMembers) {
1418
+ for (var i = 0; i < this._groupList.length; i++) {
1419
+ var groupId = this._groupList[i];
1420
+ var grp = this._groupMembers[groupId];
1421
+ var childGroup = grp._getGroupByContentRowId(rowId);
1422
+ if(childGroup) {
1423
+ return childGroup;
1424
+ }
1425
+ }
1426
+ } else { // Last childGroup
1427
+ if(this._rids.indexOf(rowId) !== -1) {
1428
+ return this; // return group if match with rowId
1429
+ }
1430
+ }
1431
+ return null;
1432
+ };
1433
+ /** Get all group descendants
1434
+ * @public
1435
+ * @param {Array=} out_ary
1436
+ * @return {!Array.<DataView>}
1437
+ */
1438
+ DataView.prototype.getAllGroups = function (out_ary) {
1439
+ if(!out_ary) { out_ary = []; }
1440
+ if(this._groupMembers) {
1441
+ var len = this._groupList.length;
1442
+ for(var i = 0; i < len; ++i) {
1443
+ var groupId = this._groupList[i];
1444
+ var grp = this._groupMembers[groupId];
1445
+ out_ary.push(grp);
1446
+ grp.getAllGroups(out_ary);
1447
+ }
1448
+ }
1449
+ return out_ary;
1450
+ };
1451
+ /** Get immediate group members row ids in array list
1452
+ * @public
1453
+ * @return {Array.<string>}
1454
+ */
1455
+ DataView.prototype.getGroupList = function () {
1456
+ return this._groupList;
1457
+ };
1458
+ /** Get group id (string) of this data view. Only exists if this data view is a child data view
1459
+ * @public
1460
+ * @return {string}
1461
+ */
1462
+ DataView.prototype.getGroupId = function () {
1463
+ return this._groupId;
1464
+ };
1465
+ /** Get group value (any data type) of this data view. Only exists if this data view is a child data view
1466
+ * @public
1467
+ * @return {*}
1468
+ */
1469
+ DataView.prototype.getGroupValue = function () {
1470
+ return this._groupValue;
1471
+ };
1472
+ /** Row id used by parent data view as a header row for referencing
1473
+ * @public
1474
+ * @return {string}
1475
+ */
1476
+ DataView.prototype.getGroupRowId = function () {
1477
+ return this._groupRowId;
1478
+ };
1479
+ /**
1480
+ * @public
1481
+ * @ignore
1482
+ * @param {number} rid
1483
+ * @return {number}
1484
+ */
1485
+ DataView.prototype.getFooterRowIndex = function (rid) {
1486
+ if(this._footerRowIds) {
1487
+ for(var i = this._footerRowIds.length; --i >= 0;) {
1488
+ if(this._footerRowIds[i] === rid) {
1489
+ return i;
1490
+ }
1491
+ }
1492
+ }
1493
+ return -1;
1494
+ };
1495
+ /** A List of the footer row ids. Footer row is placed at the bottom of all other rows in this view
1496
+ * @public
1497
+ * @ignore
1498
+ * @return {Array.<string>} Null if there is no footer row
1499
+ */
1500
+ DataView.prototype.getFooterRowIds = function () {
1501
+ return this._footerRowIds;
1502
+ };
1503
+ /**
1504
+ * @public
1505
+ * @return {boolean}
1506
+ */
1507
+ DataView.prototype.hasGroup = function () {
1508
+ return (this._groupMembers) ? true : false;
1509
+ };
1510
+ /** Deprecated in favor of getGroupByRowId
1511
+ * @public
1512
+ * @return {null}
1513
+ * @see {@link DataView#getGroupByRowId}
1514
+ */
1515
+ DataView.prototype.getGroupRows = function () {
1516
+ return null;
1517
+ };
1518
+ /** Get group level of the corresponding row. If the given index is not specified, header row (the view itself) is used instead. Group level 0 means it is the root data view.
1519
+ * @public
1520
+ * @param {(number|string)=} rowRef
1521
+ * @return {number}
1522
+ */
1523
+ DataView.prototype.getGroupLevel = function (rowRef) {
1524
+ if(rowRef != null && this._groupRows) {
1525
+ if(typeof rowRef === 'number'){ // TODO: Change logic to acquire row id from row index instead
1526
+ this._rebuildRowIdsFromChildren();
1527
+ var rids = this._getRids(); // TODO : Should include hidden rows
1528
+ var rid = rids[rowRef];
1529
+ while(rid) {
1530
+ var dv = this._groupRows[rid];
1531
+ if(dv) {
1532
+ return dv._groupLevel;
1533
+ }
1534
+ rid = rids[--rowRef];
1535
+ }
1536
+ } else {
1537
+ var currentGroup = this.getGroup(rowRef); // Slow becuase recursive
1538
+ if(currentGroup) {
1539
+ return currentGroup._groupLevel;
1540
+ }
1541
+ return -1; // group not found
1542
+ }
1543
+ }
1544
+ return this._groupLevel;
1545
+ };
1546
+
1547
+ /** Statistics (e.g. Sum, Avg, Max, and Min) of the specified column will be collected on every update. WARNING: CPU usage is intensive. Do disable, if the column is no longer used.
1548
+ * @public
1549
+ * @param {string} cid
1550
+ * @param {boolean=} opt_enabled
1551
+ * @param {string=} opt_refId
1552
+ * @return {ColumnStats} ColumnStats Object
1553
+ */
1554
+ DataView.prototype.enableColumnStats = function(cid, opt_enabled, opt_refId) {
1555
+ if (!cid) { return null; }
1556
+ var enabled = opt_enabled !== false;
1557
+ var cs = this._columnStats[cid];
1558
+ if(enabled) {
1559
+ if(!cs) {
1560
+ cs = new ColumnStats(this, cid);
1561
+ this._columnStats[cid] = cs;
1562
+ }
1563
+ cs.addRef(opt_refId);
1564
+ } else {
1565
+ if(cs) {
1566
+ if(!cs.deRef(opt_refId)) {
1567
+ cs.dispose();
1568
+ delete this._columnStats[cid];
1569
+ }
1570
+ }
1571
+ }
1572
+ if(this._groupMembers) {
1573
+ for(var i = this._groupList.length; --i >= 0;) {
1574
+ var groupId = this._groupList[i];
1575
+ this._groupMembers[groupId].enableColumnStats(cid, opt_enabled, opt_refId);
1576
+ }
1577
+ }
1578
+ return cs || null;
1579
+ };
1580
+ /** @public
1581
+ * @param {string} cid
1582
+ * @return {ColumnStats} ColumnStats. Return null if the column has not been enabled
1583
+ */
1584
+ DataView.prototype.getColumnStats = function(cid) {
1585
+ return this._columnStats[cid] || null;
1586
+ };
1587
+
1588
+ /** This method temporarily remove all rows from the view, which can improve performance as further updates and operations will be ignored
1589
+ * @public
1590
+ * @param {boolean=} opt_hidden
1591
+ * @returns {boolean}
1592
+ */
1593
+ DataView.prototype.hide = function(opt_hidden) {
1594
+ var val = opt_hidden !== false;
1595
+ if(this._hidden === val) {
1596
+ return false;
1597
+ }
1598
+
1599
+ this._hidden = val;
1600
+ this._refreshAndNotify();
1601
+ return true;
1602
+ };
1603
+ /** @public
1604
+ * @return {boolean}
1605
+ */
1606
+ DataView.prototype.isHidden = function() {
1607
+ return this._hidden;
1608
+ };
1609
+ /** @private
1610
+ * @return {boolean}
1611
+ */
1612
+ DataView.prototype._isHeaderRowShown = function() {
1613
+ if (this._hiddenHeaderRow) {
1614
+ return false;
1615
+ }
1616
+ if (this._shared.filterLogic && this._rids.length === 0) {
1617
+ // When filter is active, group without its member will be hidden
1618
+ return false;
1619
+ }
1620
+
1621
+ // Group member with option autoGroupHiding enabled should always set `_collapsed` to false. Otherwise group will be collapsed and cannot be expanded by UI.
1622
+ if (this._shared.autoGroupHiding && this._groupValue == null) {
1623
+ // In auto grouping mode, if group value is either undifined or null the header row will be hidden
1624
+ return false;
1625
+ }
1626
+ return true;
1627
+ };
1628
+ /** @private
1629
+ * @param {boolean} collapsed
1630
+ * @return {boolean} Return true if there is any change
1631
+ */
1632
+ DataView.prototype._setCollapse = function(collapsed) {
1633
+ if (this._shared.contentAsHeader) {
1634
+ // In this mode, only groups with hidden group header can be expanded/collapsed.
1635
+ // Ignore any group with visible group header
1636
+ if (this._hiddenHeaderRow) {
1637
+ if (this._showOnlyFirstMember !== collapsed) {
1638
+ this._showOnlyFirstMember = collapsed;
1639
+ return true;
1640
+ }
1641
+ }
1642
+ } else if (this._isHeaderRowShown()) { // Only groups with visible group header can be expanded/collapsed
1643
+ if (this._collapsed !== collapsed) {
1644
+ this._collapsed = collapsed;
1645
+ return true;
1646
+ }
1647
+ }
1648
+ return false;
1649
+ };
1650
+ /** Collapse current view. This works only if the view is generated as a child view
1651
+ * @public
1652
+ * @param {boolean=} opt_collapsed
1653
+ */
1654
+ DataView.prototype.collapse = function(opt_collapsed) {
1655
+ var dirty = this._setCollapse(opt_collapsed !== false);
1656
+
1657
+ if(dirty) {
1658
+ if (this._shared.contentAsHeader) {
1659
+ if (this._hiddenHeaderRow) {
1660
+ this._requestRebuildingRowIds(this._showOnlyFirstMember); // Slow
1661
+ }
1662
+ } else {
1663
+ if(this._groupLevel > 0) {
1664
+ this._requestRebuildingRowIds(this._collapsed);
1665
+ }
1666
+ }
1667
+ }
1668
+ };
1669
+ /** Collapse all children and descendants, excluding itself and its parent
1670
+ * @public
1671
+ * @param {boolean=} opt_collapsed
1672
+ */
1673
+ DataView.prototype.collapseAllGroups = function(opt_collapsed) {
1674
+ var grpList = this.getAllGroups();
1675
+ var len = grpList.length;
1676
+ if(len) {
1677
+ var collapsed = (opt_collapsed !== false);
1678
+ for(var i = 0; i < len; ++i) {
1679
+ var grpItem = grpList[i];
1680
+ grpItem._setCollapse(collapsed);
1681
+ }
1682
+ this._requestRebuildingRowIds(false);
1683
+ }
1684
+ };
1685
+ /** @public
1686
+ */
1687
+ DataView.prototype.toggleCollapsedState = function() {
1688
+ this.collapse(!this.isCollapsed());
1689
+ };
1690
+ /** @public
1691
+ * @return {boolean}
1692
+ */
1693
+ DataView.prototype.isCollapsed = function() {
1694
+ return this._collapsed || this._showOnlyFirstMember;
1695
+ };
1696
+ /** Content as header mode indicates that the group headers cannot be collapsed and the first row in the group will always be shown.
1697
+ * @public
1698
+ * @param {boolean=} bool
1699
+ */
1700
+ DataView.prototype.enableContentAsHeader = function(bool) {
1701
+ this._shared.contentAsHeader = bool !== false;
1702
+ };
1703
+ /** @private
1704
+ * @return {?Array.<string>}
1705
+ */
1706
+ DataView.prototype._getFirstHiddenRids = function() {
1707
+ if(this._shared.contentAsHeader) {
1708
+ if(this._showOnlyFirstMember) {
1709
+ var rids = this._rids;
1710
+ if (Array.isArray(rids) && rids.length) {
1711
+ return [rids[0]]; // Get only the first member of rids
1712
+ }
1713
+ }
1714
+ }
1715
+ return null;
1716
+ };
1717
+ /** This method returns current visible rows (i.e. it excludes rows that are not in current page, and are in collapsed groups). Group header rows are also includes in the results.
1718
+ * @public
1719
+ * @param {boolean=} opt_shallowCopy Default value is false. Set to true for speed
1720
+ * @return {!Array.<string>}
1721
+ */
1722
+ DataView.prototype.getVisibleRowIds = function(opt_shallowCopy) {
1723
+ return this.getAllRowIds(opt_shallowCopy, true);
1724
+ };
1725
+ /** This will not include collapsed group and rows
1726
+ * @public
1727
+ * @return {number}
1728
+ */
1729
+ DataView.prototype.getVisibleRowCount = function() {
1730
+ if(this._collapsed) {
1731
+ return 0;
1732
+ }
1733
+ this._rebuildRowIdsFromChildren();
1734
+ return this._getRids().length;
1735
+ };
1736
+
1737
+ /** @public
1738
+ * @description check weather row object is in group
1739
+ * @param {Object} rowData
1740
+ * @param {string=} groupID Default group id is the group id of the DataView that is being called.
1741
+ * @return {boolean}
1742
+ */
1743
+ DataView.prototype.isRowDataInGroup = function (rowData, groupID) {
1744
+ var criteria = this._groupCriteria;
1745
+ var level = this._groupLevel;
1746
+
1747
+ // Because self is a leaf group, only check against self.
1748
+ if (!groupID || groupID === this.getGroupId()) {
1749
+ return this._isAllowedInGroup(null, rowData);
1750
+ }
1751
+
1752
+ // Check against self and all sub groups within self
1753
+ for (var i = level; i < criteria.length; i++) {
1754
+ if (criteria[i](rowData).indexOf(groupID) >= 0) {
1755
+ return true;
1756
+ }
1757
+ }
1758
+ return false;
1759
+ };
1760
+
1761
+ /** @public
1762
+ * @description check weather row ID is in group
1763
+ * @param {string} rowId
1764
+ * @param {string=} groupID Default group id is the group id of the DataView that is being called.
1765
+ * @return {boolean}
1766
+ */
1767
+ DataView.prototype.isRowIdInGroup = function (rowId, groupID) {
1768
+ var rowData = this.getRowData(rowId);
1769
+ if(rowData) {
1770
+ return this.isRowDataInGroup(rowData, groupID);
1771
+ }
1772
+ return false;
1773
+ };
1774
+
1775
+ /** @private
1776
+ * @param {string} rid Row Id
1777
+ * @param {number} _index child index
1778
+ * @return {string}
1779
+ */
1780
+ DataView._getDataViewExpansionId = function (rid, _index) {
1781
+ return rid + "_ex" + _index;
1782
+ };
1783
+
1784
+ /** The row expansion will be directly below the specified row, even if this data view is sorted.
1785
+ * @public
1786
+ * @param {string} rid Row Id
1787
+ * @param {number=} count=1
1788
+ */
1789
+ DataView.prototype.addRowExpansion = function(rid, count) {
1790
+ if(this._groupLevel > 0) {
1791
+ return; // Sub-group is not allowed to add a row expansion
1792
+ }
1793
+
1794
+ if(!count || count < 0) {
1795
+ if(count == null) {
1796
+ count = 1;
1797
+ } else {
1798
+ return;
1799
+ }
1800
+ }
1801
+
1802
+ var rowIndex = this._rids.indexOf(rid);
1803
+ if(rowIndex < 0) {
1804
+ // The given row id must be normal row. header and expansion row are not in the this._rids list
1805
+ return;
1806
+ }
1807
+
1808
+ var expCount = 0;
1809
+ if(this._expansionMap) {
1810
+ expCount = this._expansionMap[rid] || 0;
1811
+ } else {
1812
+ this._expansionMap = {};
1813
+ this._expansionChildren = {};
1814
+ }
1815
+ var totalChild = expCount + count;
1816
+ this._expansionMap[rid] = totalChild;
1817
+
1818
+ // create _expansionChildren mapping
1819
+
1820
+ for (var i = expCount; i < totalChild; i++) {
1821
+ this._expansionChildren[DataView._getDataViewExpansionId(rid, i)] = rid;
1822
+ }
1823
+
1824
+ if(!expCount) {
1825
+ // There is no row expansion for the row before, add number of entries to the map
1826
+ this._expansionCount++;
1827
+ }
1828
+
1829
+ if(this._groupViewDirty) { // If group view is already dirty, we don't need to update row expansion right away
1830
+ return;
1831
+ }
1832
+
1833
+ if(this._updateExpansionView()) {
1834
+ var e = {}; // Slow
1835
+ e["rid"] = rid;
1836
+ e["type"] = "inserted";
1837
+ e["nextRid"] = this._rids[rowIndex + 1];
1838
+ e["fallback"] = rowIndex; // Fallback index in case of no nextRid is found in the receiver
1839
+ this._dispatchDataChange(e);
1840
+ }
1841
+ };
1842
+ /**
1843
+ * @public
1844
+ * @param {string} rid Row Id
1845
+ */
1846
+ DataView.prototype.removeRowExpansion = function(rid) {
1847
+ if(!this._expansionMap) {
1848
+ return;
1849
+ }
1850
+ var expCount = this._expansionMap[rid];
1851
+ if(!expCount) {
1852
+ return;
1853
+ }
1854
+
1855
+ var rids = new Array(expCount);
1856
+ for (var i = 0; i < expCount; ++i) {
1857
+ rids[i] = DataView._getDataViewExpansionId(rid, i);
1858
+ delete this._expansionChildren[rids[i]];
1859
+ }
1860
+
1861
+ delete this._expansionMap[rid];
1862
+ this._expansionCount--;
1863
+
1864
+ if(!this._groupViewDirty) { // If group view is already dirty, we don't need to update row expansion right away
1865
+ if(this._updateExpansionView()) {
1866
+ if(expCount === 1) {
1867
+ this._dispatchRowRemoved(rids[0]); // TODO: Expansion rid may not need to be sent
1868
+ } else {
1869
+ this._dispatchMultiRowRemoved(rids);
1870
+ }
1871
+ }
1872
+ }
1873
+ };
1874
+ /**
1875
+ * @public
1876
+ * @param {string|number} rowRef Row Id or index
1877
+ * @param {boolean=} force
1878
+ * @param {number=} count=1
1879
+ */
1880
+ DataView.prototype.toggleRowExpansion = function(rowRef, force, count) {
1881
+ var rid = this._toRowId(rowRef);
1882
+
1883
+ if(force != null) {
1884
+ force = force === true;
1885
+ } else {
1886
+ force = !this.hasRowExpansion(rid);
1887
+ }
1888
+
1889
+ if (force) {
1890
+ this.addRowExpansion(rid, count);
1891
+ } else {
1892
+ this.removeRowExpansion(rid);
1893
+ }
1894
+ };
1895
+ /** @public
1896
+ */
1897
+ DataView.prototype.removeAllRowExpansions = function() {
1898
+ if(this._expansionMap) {
1899
+ this._expansionMap = null;
1900
+ this._expansionCount = 0;
1901
+ this._expansionView = null;
1902
+ this._expansionChildren = null;
1903
+ this._refreshAndNotify();
1904
+ }
1905
+ };
1906
+ /** Deprecated. Use {@link DataView#getExpansionParents} instead. Get all rows with expansion (not row expansion itself) will contains row id, otherwise undefined.
1907
+ * @public
1908
+ * @ignore
1909
+ * @param {number=} from
1910
+ * @param {number=} to EXCLUSIVE
1911
+ * @return {!Array.<string|undefined>}
1912
+ */
1913
+ DataView.prototype.getRowsWithExpansion = function(from, to) {
1914
+ if(!this._expansionMap) {
1915
+ return [];
1916
+ }
1917
+ var rids = this._expansionView;
1918
+ var len = rids.length;
1919
+ if(to == null) { to = len; }
1920
+ else if(to > len) { to = len; }
1921
+
1922
+ if(!(from > 0)) { from = 0; } // Handle NaN, undefined, null, and other invalid value
1923
+
1924
+ var entryCount = this._expansionCount;
1925
+ var out_ary = new Array(len);
1926
+ for(var i = from; i < to; ++i) {
1927
+ var rid = rids[i];
1928
+ if(this._expansionMap[rid]) {
1929
+ out_ary[i] = rid;
1930
+ if(--entryCount <= 0) {
1931
+ break;
1932
+ }
1933
+ }
1934
+ }
1935
+ return out_ary;
1936
+ };
1937
+ /** Get row expansion states from the specified range. The returned value will be row id for row expansion, otherwise empty string for other types of row (e.g. normal row, or group header row)
1938
+ * @public
1939
+ * @param {number=} from
1940
+ * @param {number=} to EXCLUSIVE
1941
+ * @return {Array.<string>} object mapping of rowIndex and parentRowId
1942
+ */
1943
+ DataView.prototype.getExpansionParents = function (from, to) {
1944
+ var parentMapping = [];
1945
+ if (this._expansionMap) {
1946
+ var rids = this._expansionView;
1947
+ var len = rids.length;
1948
+
1949
+ // Handle NaN, undefined, null, and other invalid values
1950
+ if (to == null || to > len) {
1951
+ to = len;
1952
+ }
1953
+ if (!from || from < 0) {
1954
+ from = 0;
1955
+ }
1956
+
1957
+ for (var i = from; i < to; ++i) {
1958
+ parentMapping[i] = this._expansionChildren[rids[i]] || "";
1959
+ }
1960
+ }
1961
+ return parentMapping;
1962
+ };
1963
+
1964
+ /** Check if the specified row is itself a row expansion.
1965
+ * @public
1966
+ * @param {string} rid rowId
1967
+ * @return {boolean}
1968
+ */
1969
+ DataView.prototype.isRowExpansion = function(rid) {
1970
+ if(this._expansionChildren) {
1971
+ return this._expansionChildren[rid] ? true : false;
1972
+ }
1973
+ return false;
1974
+ };
1975
+ /** Check if the specified row has row expansion (not row expansion itself).
1976
+ * @public
1977
+ * @param {string} rid rowId
1978
+ * @return {boolean}
1979
+ */
1980
+ DataView.prototype.hasRowExpansion = function(rid) {
1981
+ if(this._expansionMap) {
1982
+ return this._expansionMap[rid] ? true : false;
1983
+ }
1984
+ return false;
1985
+ };
1986
+ /** Get row Id of the row expansion by providing the row Id of the row with row expansion (not row expansion itself). This is NOT recommended for normal usage, since the row expansion contains no data in the DataView
1987
+ * @public
1988
+ * @param {string} rid rowId
1989
+ * @param {number=} idx=0
1990
+ * @return {string} Empty string is returned if the provided row does not contains a row expansion.
1991
+ */
1992
+ DataView.prototype.getRowExpansionId = function(rid, idx) {
1993
+ if(this._expansionMap) {
1994
+ var expCount = this._expansionMap[rid] || 0;
1995
+ if(!idx) {
1996
+ idx = 0;
1997
+ }
1998
+ if (idx < expCount) {
1999
+ return DataView._getDataViewExpansionId(rid, idx); // WARNING: Internal logic is exposed
2000
+ }
2001
+ }
2002
+ return "";
2003
+ };
2004
+
2005
+ /** Get index from the row expansion id. Any row other than row expansion will yield negative value (-1)
2006
+ * @public
2007
+ * @param {string} rid Row expansion id
2008
+ * @return {number}
2009
+ */
2010
+ DataView.prototype.getRowExpansionIndex = function(rid) {
2011
+ if(rid) {
2012
+ var matches = rid.match(/_ex(\d+)$/);
2013
+ if(matches) {
2014
+ return +matches[1]; // TODO: Check for NaN value
2015
+ }
2016
+ }
2017
+ return -1;
2018
+ };
2019
+ /** @private
2020
+ * @return {boolean}
2021
+ */
2022
+ DataView.prototype._updateExpansionView = function() {
2023
+ var expMap = this._expansionMap;
2024
+ if(expMap) {
2025
+ if(!this._expansionCount || this._expansionCount < 0) {
2026
+ this._expansionCount = 0;
2027
+ this._expansionMap = null;
2028
+ this._expansionView = null;
2029
+ this._expansionChildren = null;
2030
+ return true;
2031
+ }
2032
+
2033
+ var rids = this._pageView || this._groupView || this._rids;
2034
+ var rowLen = rids.length;
2035
+ var origLen = this._expansionView ? this._expansionView.length : 0;
2036
+ if(!this._expansionView) {
2037
+ this._expansionView = new Array(rowLen);
2038
+ } else {
2039
+ this._expansionView.length = rowLen;
2040
+ }
2041
+ var entryCount = this._expansionCount;
2042
+ for(var i = 0, j = 0; i < rowLen; ++i) {
2043
+ var rid = rids[i];
2044
+ this._expansionView[j++] = rid;
2045
+ if(entryCount) {
2046
+ var expCount = expMap[rid] || 0;
2047
+ if(expCount) {
2048
+ for(var k = 0; k < expCount; ++k) {
2049
+ this._expansionView[j++] = DataView._getDataViewExpansionId(rid, k);
2050
+ }
2051
+ --entryCount;
2052
+ }
2053
+ }
2054
+ }
2055
+ return origLen !== this._expansionView.length; // TODO: This does not completely check the change of all cases
2056
+ } else {
2057
+ return false;
2058
+ }
2059
+ };
2060
+ /** Guarantee that expansion is added after the pagination view
2061
+ * @private
2062
+ * @param {number=} firstChange
2063
+ * @return {boolean}
2064
+ */
2065
+ DataView.prototype._transformView = function(firstChange) {
2066
+ var dirty = this._updatePaginationView(firstChange);
2067
+ dirty |= this._updateExpansionView();
2068
+ return dirty ? true : false;
2069
+ };
2070
+
2071
+ /**
2072
+ * @public
2073
+ * @param {function(Object):boolean} searchLogic Function that takes row data object and return boolean value
2074
+ * @param {Array.<string>=} opt_out Array for containing row ids
2075
+ * @return {!Array.<string>} List of row ids
2076
+ */
2077
+ DataView.prototype.searchAll = function(searchLogic, opt_out) {
2078
+ if(!opt_out) { opt_out = []; }
2079
+
2080
+ this._rebuildRowIdsFromChildren();
2081
+ var rids = this._getRids();
2082
+ var len = rids.length;
2083
+
2084
+ for(var i = 0; i < len; ++i) {
2085
+ var rid = rids[i];
2086
+ var row = this._dt.getRowData(rid);
2087
+ if(row) {
2088
+ if(searchLogic(row)) {
2089
+ opt_out.push(rid);
2090
+ }
2091
+ }
2092
+ }
2093
+ return opt_out;
2094
+ };
2095
+ /**
2096
+ * @public
2097
+ * @param {number|string} rowRef
2098
+ * @param {function(Object):boolean} searchLogic Function that takes row data object and return boolean value
2099
+ * @return {number} Row index
2100
+ */
2101
+ DataView.prototype.searchPrev = function(rowRef, searchLogic) {
2102
+ this._rebuildRowIdsFromChildren();
2103
+ var rids = this._getRids();
2104
+ var rowIndex = -1;
2105
+ if(typeof rowRef === "number") {
2106
+ if(this._dt.getRowData(rids[rowRef])) {
2107
+ rowIndex = rowRef;
2108
+ }
2109
+ } else {
2110
+ rowIndex = rids.indexOf(rowRef);
2111
+ }
2112
+
2113
+ var foundAt = -1;
2114
+ var len = rids.length;
2115
+ if(rowIndex > 0) {
2116
+ foundAt = this._searchRow(rids, searchLogic, rowIndex - 1, -1, -1);
2117
+ if(foundAt >= 0) {
2118
+ return foundAt;
2119
+ }
2120
+ }
2121
+ if(rowIndex >= 0) { // loop the search by starting from the end
2122
+ foundAt = this._searchRow(rids, searchLogic, len - 1, rowIndex, -1);
2123
+ if(foundAt >= 0) {
2124
+ return foundAt;
2125
+ }
2126
+ }
2127
+ return -1;
2128
+ };
2129
+ /**
2130
+ * @public
2131
+ * @param {number|string} rowRef
2132
+ * @param {function(Object):boolean} searchLogic Function that takes row data object and return boolean value
2133
+ * @return {number} Row index
2134
+ */
2135
+ DataView.prototype.searchNext = function(rowRef, searchLogic) {
2136
+ this._rebuildRowIdsFromChildren();
2137
+ var rids = this._getRids();
2138
+ var rowIndex = -1;
2139
+ if(typeof rowRef === "number") {
2140
+ if(this._dt.getRowData(rids[rowRef])) {
2141
+ rowIndex = rowRef;
2142
+ }
2143
+ } else {
2144
+ rowIndex = rids.indexOf(rowRef);
2145
+ }
2146
+ if(rowIndex < 0) { // Cannot find the specified row
2147
+ return -1;
2148
+ }
2149
+
2150
+ var foundAt = -1;
2151
+ var len = rids.length;
2152
+ if(rowIndex < len - 1) {
2153
+ foundAt = this._searchRow(rids, searchLogic, rowIndex + 1, len, 1);
2154
+ if(foundAt >= 0) {
2155
+ return foundAt;
2156
+ }
2157
+ }
2158
+ if(rowIndex > 0) { // loop the search by starting from the start
2159
+ foundAt = this._searchRow(rids, searchLogic, 0, rowIndex, 1);
2160
+ if(foundAt >= 0) {
2161
+ return foundAt;
2162
+ }
2163
+ }
2164
+ return -1;
2165
+ };
2166
+ /**
2167
+ * @private
2168
+ * @param {!Array.<string>} rids
2169
+ * @param {function(Object):boolean} searchLogic
2170
+ * @param {number} start
2171
+ * @param {number} end
2172
+ * @param {number} inc
2173
+ * @return {number}
2174
+ */
2175
+ DataView.prototype._searchRow = function(rids, searchLogic, start, end, inc) {
2176
+ while(start !== end) {
2177
+ var rid = rids[start];
2178
+ var row = this._dt.getRowData(rid);
2179
+ if(row) {
2180
+ if(searchLogic(row)) {
2181
+ return start;
2182
+ }
2183
+ }
2184
+ start += inc;
2185
+ }
2186
+ return -1;
2187
+ };
2188
+
2189
+ /** Blocks all row insertion and removal, but keep updating the data
2190
+ * @public
2191
+ * @param {boolean=} opt_bool
2192
+ * @return {boolean} True if there is any change
2193
+ */
2194
+ DataView.prototype.stall = function(opt_bool) {
2195
+ var newBool = opt_bool !== false;
2196
+ var curBool = this._shared.stalledRids ? true : false;
2197
+ if(curBool === newBool) { return false; }
2198
+ if(newBool) {
2199
+ var srs = {};
2200
+ this._shared.stalledRids = srs;
2201
+ var rids = this._getRids();
2202
+
2203
+ for(var i = rids.length; --i >= 0;) {
2204
+ srs[rids[i]] = 1;
2205
+ }
2206
+ } else {
2207
+ this._shared.stalledRids = null;
2208
+ this._refreshAndNotify();
2209
+ }
2210
+ return true;
2211
+ };
2212
+ /** Automatically and asyncronuosly remove group that has no member or no content. Predefined groups will not be removed in this way.
2213
+ * @public
2214
+ * @param {boolean=} opt_bool
2215
+ * @return {boolean} True if there is any change
2216
+ */
2217
+ DataView.prototype.enableAutoGroupRemoval = function(opt_bool) {
2218
+ opt_bool = opt_bool !== false;
2219
+ var autoGroupRemoval = this._shared.autoGroupRemoval ? true : false;
2220
+ if(autoGroupRemoval !== opt_bool) {
2221
+ this._shared.autoGroupRemoval = opt_bool;
2222
+ this._triggerGroupRefreshing();
2223
+ return true;
2224
+ }
2225
+ return false;
2226
+ };
2227
+ /** Automatically hide null or undefined group header, while keeping the group's items intact.
2228
+ * @public
2229
+ * @param {boolean=} opt_bool
2230
+ * @return {boolean} True if there is any change
2231
+ */
2232
+ DataView.prototype.enableAutoGroupHiding = function(opt_bool) {
2233
+ opt_bool = opt_bool !== false;
2234
+ var autoGroupHiding = this._shared.autoGroupHiding ? true : false;
2235
+ if(autoGroupHiding !== opt_bool) {
2236
+ this._shared.autoGroupHiding = opt_bool;
2237
+ this._triggerGroupRefreshing();
2238
+ return true;
2239
+ }
2240
+ return false;
2241
+ };
2242
+
2243
+ /** Copy row order in data view to its data table
2244
+ * @public
2245
+ */
2246
+ DataView.prototype.synchronizeRowOrder = function() {
2247
+ if(this.isSorting()) {
2248
+ this._dt._sort(this._sortingDefs);
2249
+ }
2250
+ };
2251
+ /** Set visible row as segment separator (hidden or filtered rows cannot be a segment separator)
2252
+ * @public
2253
+ * @param {string|number} rowRef Row id or row index
2254
+ * @param {boolean=} enabled
2255
+ * @return {boolean} Return true if there is any change
2256
+ */
2257
+ DataView.prototype.setSegmentSeparator = function(rowRef, enabled) {
2258
+ var rowId = "";
2259
+ if(typeof rowRef === "number") {
2260
+ rowId = this.getRowId(rowRef);
2261
+ } else if(typeof rowRef === "string") {
2262
+ rowId = rowRef; // WARNING: Invisible row id can still be set as segment separator as long as it is in the data table
2263
+ }
2264
+
2265
+ if(rowId) {
2266
+ enabled = enabled !== false;
2267
+ if(enabled) {
2268
+ this.synchronizeRowOrder();
2269
+ }
2270
+ // TODO: Force expanding of segment before unsetting segment separator
2271
+ return this._dt.setSegmentSeparator(rowId, enabled);
2272
+ }
2273
+ return false;
2274
+ };
2275
+ /**
2276
+ * @public
2277
+ * @return {boolean} Return true if there is any change
2278
+ */
2279
+ DataView.prototype.unsetAllSegmentSeparators = function() {
2280
+ return this._dt.unsetAllSegmentSeparators();
2281
+ };
2282
+ /**
2283
+ * @public
2284
+ * @return {boolean}
2285
+ */
2286
+ DataView.prototype.hasSegmentation = function() {
2287
+ return this._dt.hasSegmentation();
2288
+ };
2289
+ /**
2290
+ * @public
2291
+ * @param {string} rid
2292
+ * @return {boolean}
2293
+ */
2294
+ DataView.prototype.isSegmentSeparator = function(rid) {
2295
+ return this._dt.isSegmentSeparator(rid);
2296
+ };
2297
+
2298
+ /**
2299
+ * @public
2300
+ * @param {string} rid
2301
+ * @return {string} parent row id of this segmentation. If the parent row id for this segmentation cannot be found, return ""
2302
+ */
2303
+ DataView.prototype.getSegmentParentRowId = function(rid) {
2304
+ return this._dt.getSegmentParentRowId(rid);
2305
+ };
2306
+ /** @public
2307
+ * @param {string|number} rowRef Row id or row index
2308
+ * @param {boolean=} collapsed
2309
+ * @return {boolean} Return true if there is any change
2310
+ */
2311
+ DataView.prototype.collapseSegment = function(rowRef, collapsed) {
2312
+ collapsed = collapsed !== false;
2313
+ var segments = this._dt._getSegmentSeparators();
2314
+ if(segments) {
2315
+ var segmentRid = this._toRowId(rowRef);
2316
+
2317
+ if(segments.collapseSegment(segmentRid, collapsed)) {
2318
+ this._refreshAndNotify(); // dispatch global change event
2319
+
2320
+ return true;
2321
+ }
2322
+ }
2323
+
2324
+ return false;
2325
+ };
2326
+ /** @public
2327
+ * @param {string|number} rowRef Row id or row index
2328
+ * @param {boolean=} expanded
2329
+ * @return {boolean} Return true if there is any change
2330
+ */
2331
+ DataView.prototype.expandSegment = function(rowRef, expanded) {
2332
+ return this.collapseSegment(rowRef, expanded === false);
2333
+ };
2334
+ /** @public
2335
+ * @return {boolean} Return true if there is any change
2336
+ */
2337
+ DataView.prototype.expandAllSegments = function() {
2338
+ var segments = this._dt._getSegmentSeparators();
2339
+ if(segments) {
2340
+ if(segments.expandAllSegments()) {
2341
+ this._refreshAndNotify();
2342
+ return true;
2343
+ }
2344
+ }
2345
+ return false;
2346
+ };
2347
+ /** Deprecated.
2348
+ * @public
2349
+ * @ignore
2350
+ */
2351
+ DataView.prototype.setSegmentCollapsingLogic = function() {};
2352
+ /** @public
2353
+ * @param {string|number} rowRef Row id or row index
2354
+ * @return {boolean} Return true if only the given row is a collapsed segment separator
2355
+ */
2356
+ DataView.prototype.isSegmentCollapsed = function(rowRef) {
2357
+ var segments = this._dt._getSegmentSeparators();
2358
+ if(segments) {
2359
+ return segments.isCollapsedSegment(this._toRowId(rowRef));
2360
+ }
2361
+ return false;
2362
+ };
2363
+ /** Remove existing segment children and fill the segments with all contnet rows before the next segment separator
2364
+ * @public
2365
+ * @param {string|number} segmentRef Row id or row index
2366
+ */
2367
+ DataView.prototype.fillSegment = function(segmentRef) {
2368
+ this._dt.fillSegment(this._toRowId(segmentRef));
2369
+ };
2370
+ /** Remove all existing segment children in each segment and fill the segments with all contnet rows before the next segment separator
2371
+ * @public
2372
+ */
2373
+ DataView.prototype.fillSegments = function() {
2374
+ this._dt.fillSegments();
2375
+ };
2376
+ /** @public
2377
+ * @param {string|number} segmentRef Row id or row index
2378
+ * @param {string|number} rowRef Row id, row index
2379
+ * @return {boolean} Return true if there is any change
2380
+ */
2381
+ DataView.prototype.addSegmentChild = function(segmentRef, rowRef) {
2382
+ if(this._dt._getSegmentSeparators()) {
2383
+ var segmentId = this._toRowId(segmentRef);
2384
+ var rowId = this._toRowId(rowRef);
2385
+ return this._dt.addSegmentChild(segmentId, rowId);
2386
+ }
2387
+ return false;
2388
+ };
2389
+ /** @public
2390
+ * @param {string|number} segmentRef Row id or row index
2391
+ * @param {Array.<string|number>} rowRefs Array of row ids or row indices
2392
+ * @return {boolean} Return true if there is any change
2393
+ */
2394
+ DataView.prototype.addSegmentChildren = function(segmentRef, rowRefs) {
2395
+ if(this._dt._getSegmentSeparators()) {
2396
+ var segmentId = this._toRowId(segmentRef);
2397
+ var rowIds = this._toRowIds(rowRefs);
2398
+ return this._dt.addSegmentChildren(segmentId, rowIds);
2399
+ }
2400
+ return false;
2401
+ };
2402
+ /** @public
2403
+ * @param {string|number} segmentRef Row id or row index
2404
+ * @param {string|number} rowRef Row id, row index
2405
+ * @return {boolean} Return true if there is any change
2406
+ */
2407
+ DataView.prototype.removeSegmentChild = function(segmentRef, rowRef) {
2408
+ if(this._dt._getSegmentSeparators()) {
2409
+ var segmentId = this._toRowId(segmentRef);
2410
+ var rowId = this._toRowId(rowRef);
2411
+ return this._dt.removeSegmentChild(segmentId, rowId); // TODO: Handle the case where a child is remove from its collapsed parent. Child should be made visible
2412
+ }
2413
+ return false;
2414
+ };
2415
+ /** @public
2416
+ * @param {string|number} segmentRef Row id or row index
2417
+ * @param {Array.<string|number>} rowRefs Array of row ids or row indices. If null is given, no child will be removed.
2418
+ * @return {boolean} Return true if there is any change
2419
+ */
2420
+ DataView.prototype.removeSegmentChildren = function(segmentRef, rowRefs) {
2421
+ if(this._dt._getSegmentSeparators()) {
2422
+ var segmentId = this._toRowId(segmentRef);
2423
+ var rowIds = this._toRowIds(rowRefs);
2424
+ return this._dt.removeSegmentChildren(segmentId, rowIds); // TODO: Handle the case where a child is remove from its collapsed parent. Child should be made visible
2425
+ }
2426
+ return false;
2427
+ };
2428
+ /** @public
2429
+ * @return {boolean} Return true if there is any change
2430
+ */
2431
+ DataView.prototype.removeAllSegmentChildren = function() {
2432
+ return this._dt.removeAllSegmentChildren();
2433
+ };
2434
+ /** Get row ids of all segment separator
2435
+ * @public
2436
+ * @return {Array.<string>} Return null if there is no segment separator
2437
+ */
2438
+ DataView.prototype.getSegmentIds = function() {
2439
+ return this._dt.getSegmentIds();
2440
+ };
2441
+ /** Get row ids of all children from the specified segment
2442
+ * @public
2443
+ * @param {string|number} segmentRef Row id or row index
2444
+ * @return {Array.<string>} Returns array of row ids. Returns null if there is no child or no segment separator found
2445
+ */
2446
+ DataView.prototype.getSegmentChildIds = function(segmentRef) {
2447
+ return this._dt.getSegmentChildIds(this._toRowId(segmentRef));
2448
+ };
2449
+ /** Sort all of existing segments by given compare function
2450
+ * @public
2451
+ * @param {Function} compare
2452
+ */
2453
+ DataView.prototype.sortSegments = function (compare) {
2454
+ this._dt.sortSegments(compare);
2455
+ };
2456
+
2457
+ /** Construct a JSON object that is compatible with console.table()
2458
+ * @public
2459
+ * @param {Object=} opt_options {@link DataCache#dump}
2460
+ * @return {!Array.<Object>} Return a JSON object that is compatible with console.table()
2461
+ * @see {@link DataCache#dump}
2462
+ */
2463
+ DataView.prototype.dump = function(opt_options) {
2464
+ this._rebuildRowIdsFromChildren();
2465
+ var rids = this._getRids();
2466
+
2467
+ return DataCache.constructTable(this.getMultipleRowData(rids), opt_options, rids);
2468
+ };
2469
+ /** Print current data and structure to console panel
2470
+ * @public
2471
+ * @param {Object=} opt_options
2472
+ * @example
2473
+ // Options have the following format:
2474
+ // {
2475
+ // "colNames": Array.<string>,
2476
+ // "rowCount": number,
2477
+ // "startIndex": number,
2478
+ // "getter": function(Object, string):*,
2479
+ // "withRowIds": boolean
2480
+ //}
2481
+ dv.log({"rowCount": 10}); // Showing 10 records
2482
+ dv.log({"getter": function(rowData, colName){
2483
+ var complexData = rowData[colName];
2484
+ return complextData.someProperty;
2485
+ }});
2486
+ */
2487
+ DataView.prototype.log = function(opt_options) {
2488
+ console.table(this.dump(opt_options));
2489
+ };
2490
+
2491
+
2492
+ /** @private
2493
+ * @return {!Array.<string>}
2494
+ */
2495
+ DataView.prototype._getRids = function() {
2496
+ return this._expansionView || this._pageView || this._groupView || this._rids;
2497
+ };
2498
+
2499
+ /** @private
2500
+ * @param {Array.<string>=} opt_rowIds Provide this parameter to avoid unnecessary group filtering
2501
+ * @fires DataView#pageCountChanged
2502
+ * @fires DataView#pageIndexChanged
2503
+ */
2504
+ DataView.prototype._updateRowIds = function(opt_rowIds) {
2505
+ this._groupViewDirty = false;
2506
+ if(!this._parent || this._hidden) {
2507
+ this._resetAllViews();
2508
+ return;
2509
+ }
2510
+ if(this._shared.stalledRids) { // The stalled view cannot be changed
2511
+ return;
2512
+ }
2513
+
2514
+ // Perform the following sequences: parent view cloning >> row hiding >> row filtering >> row grouping >> sorting >> paging
2515
+ this._rids = opt_rowIds || this._parent.getAllRowIds(); // Get all data ids
2516
+
2517
+ if(this._hiddenRids) {
2518
+ this._removeArrayItems(this._rids, this._hiddenRids);
2519
+ }
2520
+ var segments = this._dt._getSegmentSeparators();
2521
+ this._collapsedRids = null;
2522
+ var filterExceptions = null;
2523
+ if(segments) {
2524
+ filterExceptions = segments.getSegments(); // Segment separators should not be filtered out (hidden)
2525
+ var collapsedRows = this._collapsedRids = segments.getCollapsedRows(); // Children of collapsed segments must be filtered out (hidden)
2526
+ if(collapsedRows) {
2527
+ this._removeArrayItems(this._rids, collapsedRows);
2528
+ }
2529
+ }
2530
+
2531
+ this._dispatch("beforeFiltering", {});
2532
+ this._quickFilter(this._userFilter, this._filteringOut, filterExceptions);
2533
+
2534
+ if(this._groupLevel > 0 && !opt_rowIds) {
2535
+ this._quickFilter(this._groupFilterLogic, false); // Filter In
2536
+ }
2537
+
2538
+ if(this._groupMembers) { // Has grouping
2539
+ this._populateGroups(); // View will be properly re-populate inside _populateGroups()
2540
+ } else { // No grouping
2541
+ var pageIndexChanged = this._updatePageCount();
2542
+ var sorted = this._sort();
2543
+ if(!sorted && !pageIndexChanged) {
2544
+ this._transformView();
2545
+ }
2546
+ }
2547
+ };
2548
+ /** @private
2549
+ * @param {Object} e
2550
+ */
2551
+ DataView.prototype._onDataChanged = function (e) {
2552
+ if (this._conflator.conflate(e)) return;
2553
+
2554
+ var events = this._conflator.popAllData() || [e];
2555
+
2556
+ // process all events
2557
+ var eventsCount = events.length;
2558
+ if (eventsCount === 1) {
2559
+ var event = events[0];
2560
+ if (event["globalChange"]) {
2561
+ this._updateRowIds(); // Reset all row ids and perform sorting
2562
+ this._dispatchDataChange(e);
2563
+ return;
2564
+ }
2565
+
2566
+ var type = event["type"];
2567
+ if (type === "inserted") {
2568
+ this._onRowInserted(event);
2569
+ } else if (type === "removed") {
2570
+ this._onRowRemoved(event);
2571
+ } else {
2572
+ this._onRowUpdated(event);
2573
+ }
2574
+ } else {
2575
+ // multi event should occur globalchange
2576
+ this._updateRowIds(); // Reset all row ids and perform sorting
2577
+ var positionChangeOnly = true;
2578
+ for (var i = 0; i < eventsCount; i++) {
2579
+ if (!events[i].positionChangeOnly) {
2580
+ positionChangeOnly = false;
2581
+ break;
2582
+ }
2583
+ }
2584
+ this._dispatchDataChange({
2585
+ "globalChange": true,
2586
+ "positionChangeOnly": positionChangeOnly,
2587
+ "events": events
2588
+ });
2589
+ }
2590
+ };
2591
+ /** @private
2592
+ * @param {!Object} e
2593
+ * @return {number} 1 if there is any change, zero otherwise.
2594
+ */
2595
+ DataView.prototype._onRowInserted = function(e) { // onInsert
2596
+ if(this._shared.stalledRids) {
2597
+ return 0;
2598
+ }
2599
+
2600
+ if(this.isRowFiltered(e["rid"], e["rowData"])) {
2601
+ return 0;
2602
+ }
2603
+
2604
+ var ret = 0;
2605
+ if(this._groupMembers) {
2606
+ var gids = this._resolveGroupId(e["rowData"]);
2607
+ var groupLen = gids.length;
2608
+ if(groupLen > 1) {
2609
+ // activate multi-group row mode
2610
+ this._shared.multiGroupRow = true;
2611
+ }
2612
+ var gid;
2613
+ for(var i = 0; i < groupLen; i++) {
2614
+ gid = gids[i];
2615
+ if(this._groupMembers[gid]) { // Insert to existing member
2616
+ ret = this._groupMembers[gid]._onRowInserted(e);
2617
+ } else {
2618
+ var member = this._addGroup(gid);
2619
+ if(member) {
2620
+ e["globalChange"] = true;
2621
+ member._onRowInserted(e);
2622
+ ret = 1;
2623
+ }
2624
+ }
2625
+ }
2626
+ if(e["globalChange"]) {
2627
+ this._groupViewDirty = true;
2628
+ }
2629
+ }
2630
+
2631
+ if(this._hidden) {
2632
+ return ret; // the view is hidden and there is no need to be updated
2633
+ }
2634
+
2635
+ var rid = e["rid"];
2636
+ var rowData = e["rowData"];
2637
+
2638
+ if(!this._isAllowedInGroup(rid, rowData)) {
2639
+ return ret;
2640
+ }
2641
+
2642
+ var nextRid = /** @type{string} */(e["nextRid"]);
2643
+ var rowIndex;
2644
+ if(this.isSorting() && !e["segmentChanged"]) {
2645
+ rowIndex = this._addDataRow(rid);
2646
+ } else {
2647
+ rowIndex = this._addDataRow(rid, nextRid, e["fallback"]);
2648
+ }
2649
+
2650
+ var pageIndexChanged = this._updatePageCount();
2651
+ var sorted = this._sort();
2652
+ if(sorted) {
2653
+ e["globalChange"] = true; // Notify parent
2654
+ }
2655
+ if(e["globalChange"]) {
2656
+ if(!sorted && !pageIndexChanged) {
2657
+ this._transformView();
2658
+ }
2659
+ } else {
2660
+ e = { // Slow
2661
+ "rid": rid,
2662
+ "rowData": rowData,
2663
+ "type": "inserted"
2664
+ };
2665
+ if(nextRid != null) {
2666
+ e["nextRid"] = nextRid;
2667
+ e["fallback"] = rowIndex;
2668
+ }
2669
+ if(this._transformView(rowIndex)) {
2670
+ e["globalChange"] = true;
2671
+ }
2672
+ }
2673
+ this._dispatchDataChange(e);
2674
+
2675
+ return 1;
2676
+ };
2677
+ /** @private
2678
+ * @param {!Object} e
2679
+ * @return {number}
2680
+ */
2681
+ DataView.prototype._onRowRemoved = function(e) { // onRemove
2682
+ if(this._shared.stalledRids) {
2683
+ return 0;
2684
+ }
2685
+
2686
+ if(e["segmentChanged"] && this.isSorting()) {
2687
+ this._refreshAndNotify();
2688
+ return 1; // may not be a correct number
2689
+ }
2690
+
2691
+ var removeCount = 0;
2692
+ var rids = e["rids"];
2693
+ var i;
2694
+ if(this._groupMembers) {
2695
+ var rowData = e["rowData"];
2696
+ var groupIds, groupId;
2697
+ if(!rids && rowData) {
2698
+ groupIds = this._resolveGroupId(rowData);
2699
+ for(i = 0; i < groupIds.length; i++) {
2700
+ groupId = groupIds[i];
2701
+ if(this._groupMembers[groupId]) { // remove existing member
2702
+ removeCount += this._groupMembers[groupId]._onRowRemoved(e);
2703
+ }
2704
+ }
2705
+
2706
+ // should allow rebuilding because rows which the same rid were removed from many groups
2707
+ // sectionSetting will not know the proper changed row index
2708
+ if(removeCount > 1) {
2709
+ this._groupViewDirty = true;
2710
+ }
2711
+ } else {
2712
+ var len = this._groupList.length;
2713
+ for(i = 0; i < len; ++i) {
2714
+ groupId = this._groupList[i];
2715
+ removeCount += this._groupMembers[groupId]._onRowRemoved(e);
2716
+ }
2717
+ }
2718
+ }
2719
+
2720
+ var firstModifiedIndex = NaN;
2721
+ var removedRids = null;
2722
+ var rid, at;
2723
+
2724
+ // TODO: Change removal mechanism to object map based logic to speed up the process
2725
+ removeCount = 0;
2726
+ if(rids) {
2727
+ removedRids = [];
2728
+ for(i = rids.length; --i >= 0;) {
2729
+ rid = rids[i];
2730
+ at = this._removeDataRow(rid);
2731
+ if(at >= 0) {
2732
+ removedRids.push(rid);
2733
+ if(!(at >= firstModifiedIndex)) {
2734
+ firstModifiedIndex = at;
2735
+ }
2736
+ }
2737
+ }
2738
+ removeCount = removedRids.length;
2739
+ } else {
2740
+ rid = e["rid"];
2741
+ at = this._removeDataRow(rid);
2742
+ if(at >= 0) {
2743
+ removedRids = [rid];
2744
+ firstModifiedIndex = at;
2745
+ removeCount = 1;
2746
+ }
2747
+ }
2748
+ if(removeCount > 0) {
2749
+ // No sorting is required, since no order should be changed during the removal
2750
+ var pageIndexChanged = this._updatePageCount();
2751
+ if(pageIndexChanged || this._transformView(firstModifiedIndex)) {
2752
+ this._dispatchGlobalChange();
2753
+ } else {
2754
+ this._dispatchMultiRowRemoved(removedRids);
2755
+ }
2756
+ if(this._shared.autoGroupRemoval &&
2757
+ this._groupRows &&
2758
+ this._rids.length <= 0) {
2759
+ this._triggerGroupRefreshing(); // Set a timer to refresh group view
2760
+ }
2761
+ if (this._hiddenHeaderRow) { // If the first row is removed while th group is collapsing, the next row should take place.
2762
+ this._requestRebuildingRowIds(true); // TODO: Optimize
2763
+ }
2764
+ }
2765
+ return removeCount;
2766
+ };
2767
+ /** @private
2768
+ * @param {!Object} e
2769
+ * @return {number}
2770
+ */
2771
+ DataView.prototype._onRowUpdated = function(e) { // onUpdate
2772
+ var rid = e["rid"];
2773
+ var rowData = e["rowData"];
2774
+ var i, gid;
2775
+ if(this.isRowFiltered(rid, rowData)) { // The row is qualified but it is filtered out
2776
+ if(this._onRowRemoved(e)) {
2777
+ return 1;
2778
+ }
2779
+ return 0; // The row does not belong to this view
2780
+ }
2781
+
2782
+ if(this._groupMembers) {
2783
+ var flags = [];
2784
+ var len = this._groupList.length;
2785
+ for(i = 0; i < len; ++i) {
2786
+ gid = this._groupList[i];
2787
+ flags[this._groupMembers[gid]._onRowUpdated(e)] = true;
2788
+ }
2789
+
2790
+ if(e["globalChange"]) { // If current dataView is sorting, globalChange will always be true
2791
+ this._groupViewDirty = true;
2792
+ }
2793
+
2794
+ // conclude flag
2795
+ var processingFlag = 0;
2796
+ if(flags[2]) {
2797
+ processingFlag = 2;
2798
+ } else if(flags[1]) {
2799
+ if(!this._isAllowedInGroup(rid, rowData)) {
2800
+ processingFlag = 1;
2801
+ }
2802
+ } else if(flags[4]) {
2803
+ processingFlag = 4;
2804
+ }
2805
+
2806
+ if(this._groupLevel > 0) {
2807
+ if(processingFlag === 1) { // The row is moved to the other group
2808
+ if(this._removeArrayItem(this._rids, rid) >= 0) {
2809
+ if(this._groupView) {
2810
+ this._removeArrayItem(this._groupView, rid);
2811
+ }
2812
+ }
2813
+ if(this._shared.multiGroupRow) {
2814
+ this._groupViewDirty = true;
2815
+ }
2816
+ } else if(processingFlag === 2) { // The row is added to its sub-group
2817
+ if(!this._hidden) {
2818
+ if(this._rids.indexOf(rid) < 0) {
2819
+ this._rids.push(rid);
2820
+ }
2821
+
2822
+ this._groupViewDirty = true; // Adding row to sub-group both single and multiple-group require parent group to rebuild rows
2823
+
2824
+ var groupLen = this._resolveGroupId(rowData).length;
2825
+ if(groupLen > 1) {
2826
+ // activate multi-group row mode
2827
+ this._shared.multiGroupRow = true;
2828
+ }
2829
+ }
2830
+ }
2831
+ } else { // This is the root node
2832
+ var noNewGroup = (flags[1] && flags[2]) || flags[4];
2833
+ if(this._shared.multiGroupRow || !noNewGroup) {
2834
+ // 0 - updated data from non-existing group to new group
2835
+ // 1 - updated data from existing group to new group
2836
+ // 2 - updated data from a non-existing group to existing group
2837
+ // 3 - updated data from a existing group to another existing group
2838
+ // 4 - updated data with in a single group and no group member changed
2839
+ var gids = this._resolveGroupId(rowData);
2840
+ for(i = 0; i < gids.length; i++) {
2841
+ gid = gids[i];
2842
+ var member = this._addGroup(gid); // Add header row
2843
+ if(member) {
2844
+ member._onRowInserted(e);
2845
+ processingFlag = 1;
2846
+ }
2847
+ }
2848
+ }
2849
+
2850
+ if(!noNewGroup && !this._hidden && this._rids.indexOf(rid) < 0) {
2851
+ this._addDataRow(rid);
2852
+ }
2853
+
2854
+ if(processingFlag === 4) {
2855
+ if(this._shared.multiGroupRow) {
2856
+ this._dispatchGlobalChange();
2857
+ } else {
2858
+ this._dispatchDataChange(e);
2859
+ }
2860
+ } else {
2861
+ this._groupViewDirty = true;
2862
+ this._dispatchGlobalChange();
2863
+ }
2864
+ }
2865
+ return processingFlag;
2866
+ }
2867
+
2868
+ // recursive task for leaf group
2869
+ if(this._isAllowedInGroup(rid, rowData)) {
2870
+ var newRowIndex = this._rids.indexOf(rid);
2871
+ if(newRowIndex < 0) { // The row is qualified to be in the group, but not in the current view, so insert the row
2872
+ this._onRowInserted(e);
2873
+ return 2;
2874
+ }
2875
+
2876
+ // Perform normal data updating
2877
+ if (!this._shared.stalledRids) { // Stalled view cannot be sorted
2878
+ if(this._sort()) {
2879
+ e["globalChange"] = true;
2880
+ }
2881
+ }
2882
+
2883
+ this._dispatchDataChange(e);
2884
+ return 4; // Update is within the group
2885
+ } else {
2886
+ if(this._onRowRemoved(e)) {
2887
+ return 1;
2888
+ }
2889
+ return 0; // The row does not belong to this view
2890
+ }
2891
+ };
2892
+ /** @private
2893
+ * @param {!Object} e
2894
+ */
2895
+ DataView.prototype._onGroupAdded = function(e) {
2896
+ if(!this._hidden) {
2897
+ var newGroup = /** @type{DataView} */(e["newGroup"]);
2898
+ var rid = newGroup.getGroupRowId();
2899
+ this._groupView.push(rid); // Add header row
2900
+ this._groupViewDirty = true;
2901
+ this._dispatch("groupAdded", e);
2902
+
2903
+ Util.pushArrayItems(this._groupView, newGroup.getFooterRowIds());
2904
+ }
2905
+ };
2906
+ /** @private
2907
+ * @param {!Object} e
2908
+ */
2909
+ DataView.prototype._onBeforeGroupAdded = function(e) {
2910
+ this._dispatch("beforeGroupAdded", e);
2911
+ };
2912
+ /** NOTE: This is not handle well in case of calling this function infinitely
2913
+ * @private
2914
+ * @param {boolean} bottomUp
2915
+ */
2916
+ DataView.prototype._requestRebuildingRowIds = function(bottomUp) {
2917
+ if(this._groupMembers) {
2918
+ this._groupViewDirty = true;
2919
+ }
2920
+ if(this._groupLevel > 0) {
2921
+ this._parent._requestRebuildingRowIds(bottomUp);
2922
+ } else {
2923
+ if(bottomUp) { // Regenerate row Ids from children. Use when something is changed and can be resolved from the requester.
2924
+ this._rebuildRowIdsFromChildren();
2925
+ } else { // Use when something is changed in the hierarchy tree but cannot be resolved by any of the children. Root view then repopulates the entire tree (slow).
2926
+ this._updateRowIds();
2927
+ }
2928
+ this._dispatchGlobalChange();
2929
+ }
2930
+ };
2931
+ /** There should be no other operation after calling this method
2932
+ * @private
2933
+ */
2934
+ DataView.prototype._refreshAndNotify = function() {
2935
+ this._updateRowIds();
2936
+ this._dispatchGlobalChange();
2937
+ };
2938
+ /** @private
2939
+ */
2940
+ DataView.prototype._onRefreshTimeout = function() {
2941
+ this._refreshTimerId = 0;
2942
+ this._refreshAndNotify();
2943
+ };
2944
+
2945
+ /** @private
2946
+ * @param {string} rid
2947
+ * @param {string=} opt_nextRid
2948
+ * @param {number=} opt_fallback
2949
+ * @return {number}
2950
+ */
2951
+ DataView.prototype._addDataRow = function(rid, opt_nextRid, opt_fallback) {
2952
+ var rowIndex = this._getRowIndex(this._rids, opt_nextRid, opt_fallback);
2953
+ this._insertItems(this._rids, rowIndex, rid);
2954
+ if(this._groupView) {
2955
+ if(this._groupMembers) {
2956
+ this._groupViewDirty = true;
2957
+ return this._insertItems(this._groupView, -1, rid);
2958
+ } else if(rowIndex < 0) { // No nextRid, No fallback
2959
+ return this._insertItems(this._groupView, -1, rid);
2960
+ }
2961
+
2962
+ rowIndex = this._getRowIndex(this._groupView, opt_nextRid, opt_fallback);
2963
+ return this._insertItems(this._groupView, rowIndex, rid);
2964
+ }
2965
+
2966
+ return (rowIndex >= 0) ? rowIndex : this._rids.length - 1;
2967
+ };
2968
+ /** @private
2969
+ * @param {Array.<string>} ary
2970
+ * @param {number} idx
2971
+ * @param {string} item1
2972
+ * @return {number} Return the first position of the inserted item
2973
+ */
2974
+ DataView.prototype._insertItems = function(ary, idx, item1) {
2975
+ if(idx < 0){
2976
+ idx = ary.length;
2977
+ ary.push(item1);
2978
+ } else {
2979
+ ary.splice(idx, 0, item1);
2980
+ }
2981
+ return idx;
2982
+ };
2983
+ /** @private
2984
+ * @param {Array.<string>} rids
2985
+ * @param {string=} opt_nextRid
2986
+ * @param {number=} opt_fallback Fallback index in case of no nextRid found
2987
+ * @return {number} Return negative number if not found
2988
+ */
2989
+ DataView.prototype._getRowIndex = function(rids, opt_nextRid, opt_fallback) {
2990
+ if(opt_nextRid == null) {
2991
+ return -1;
2992
+ }
2993
+
2994
+ var rowIndex = this._rids.indexOf(opt_nextRid);
2995
+ if(rowIndex >= 0) {
2996
+ return rowIndex;
2997
+ }
2998
+
2999
+ if(opt_fallback == null || opt_fallback >= rids.length) {
3000
+ return -1;
3001
+ }
3002
+ return /** @type{number} */(opt_fallback);
3003
+ };
3004
+ /**
3005
+ * @private
3006
+ * @param {string} rid
3007
+ * @returns {number}
3008
+ */
3009
+ DataView.prototype._removeDataRow = function(rid) {
3010
+ var at = this._removeArrayItem(this._rids, rid);
3011
+ if(this._groupView && at >= 0) {
3012
+ at = this._removeArrayItem(this._groupView, rid);
3013
+ }
3014
+ return at;
3015
+ };
3016
+ /** @private
3017
+ * @param {Array} ary
3018
+ * @param {*} item
3019
+ * @return {number} Index of the removed item
3020
+ */
3021
+ DataView.prototype._removeArrayItem = function(ary, item) {
3022
+ var len = ary.length;
3023
+ for(var i = 0; i < len; ++i) {
3024
+ if(ary[i] === item) {
3025
+ ary.splice(i, 1);
3026
+ return i;
3027
+ }
3028
+ }
3029
+ return -1;
3030
+ };
3031
+ /** Remove multiple array items
3032
+ * @private
3033
+ * @param {Array.<string>} ary
3034
+ * @param {Object.<string, *>} items
3035
+ * @return {number} First item index that is being removed. NaN if no item is removed
3036
+ */
3037
+ DataView.prototype._removeArrayItems = function(ary, items) {
3038
+ var f = NaN;
3039
+ var c = 0;
3040
+ for(var i = ary.length; --i >= 0;) {
3041
+ if (items[ary[i]]) {
3042
+ ++c;
3043
+ } else if(c) {
3044
+ f = i + 1;
3045
+ ary.splice(f, c);
3046
+ c = 0;
3047
+ }
3048
+ }
3049
+ if(c) {
3050
+ ary.splice(0, c);
3051
+ f = 0;
3052
+ }
3053
+ return f;
3054
+ };
3055
+ /** @private
3056
+ * @param {string|null} rid
3057
+ * @param {Object} rowData
3058
+ * @return {boolean}
3059
+ */
3060
+ DataView.prototype._isAllowedInGroup = function(rid, rowData) {
3061
+ // Check if it the row is belong to this group branch
3062
+ if(this._groupLevel > 0) {
3063
+ var dv = this;
3064
+ for(var i = this._groupLevel; --i >= 0;) {
3065
+ if(!dv._groupFilterLogic(rid, rowData)) {
3066
+ return false;
3067
+ }
3068
+ dv = dv.getDataSource();
3069
+ }
3070
+ }
3071
+
3072
+ return true; // The row is in this group
3073
+ };
3074
+ /** Check if the row should be filtered out
3075
+ * @public
3076
+ * @param {string} rid
3077
+ * @param {Object} rowData
3078
+ * @return {boolean}
3079
+ */
3080
+ DataView.prototype.isRowFiltered = function(rid, rowData) {
3081
+ if(this._shared.stalledRids) {
3082
+ return !this._shared.stalledRids[rid]; // Snapshot override everything else
3083
+ }
3084
+ if(this._hiddenRids) {
3085
+ if(this._hiddenRids[rid]) {
3086
+ return true;
3087
+ }
3088
+ }
3089
+ if(this.isSegmentSeparator(rid)) {
3090
+ return false; // Segment separator cannot be filtered
3091
+ }
3092
+ if(this._collapsedRids) {
3093
+ if(this._collapsedRids[rid]) {
3094
+ return true;
3095
+ }
3096
+ }
3097
+
3098
+ if(this._userFilter) {
3099
+ if(this._userFilter(rid, rowData) === this._filteringOut) {
3100
+ return true;
3101
+ }
3102
+ }
3103
+ return false; // The row is not filtered out
3104
+ };
3105
+
3106
+ /** Performance is extremely vital in this method.<br>
3107
+ * _sort() will be executed by: _onRowUpdated(), _onRowInserted(), _updateRowIds(), and sort()
3108
+ * @private
3109
+ * @return {boolean} True if there is any change, otherwise false
3110
+ */
3111
+ DataView.prototype._sort = function() {
3112
+ if(this._groupMembers) {
3113
+ return false; // DataView with children should not be sorted as sort operation will be done on each child
3114
+ }
3115
+
3116
+ if(this._dt._getSegmentSeparators() || this.isSorting()) {
3117
+ var rids = this._rids;
3118
+ var dataRows = this._dt.getMultipleRowData(rids);
3119
+ var segmentValues = this._dt.getSegmentValues(rids);
3120
+ var change = DataTable._performMultiLevelSorting(dataRows, this._sortingDefs, segmentValues);
3121
+
3122
+ if(change) {
3123
+ this._rids = DataTable._reorderItems(rids, change); // Group view should be changed after this
3124
+ this._transformView();
3125
+ return true;
3126
+ }
3127
+ }
3128
+
3129
+ return false;
3130
+ };
3131
+
3132
+ /** @private
3133
+ * @param {Function} checker
3134
+ * @param {boolean} filteringOut
3135
+ * @param {Object=} exceptions
3136
+ */
3137
+ DataView.prototype._quickFilter = function(checker, filteringOut, exceptions) {
3138
+ if(!checker) {
3139
+ return;
3140
+ }
3141
+
3142
+ var rids = this._rids; // Make local variable to speed up the process
3143
+ var len = rids.length;
3144
+ var dt = this._dt;
3145
+ var spliceCount = 0;
3146
+ for(var i = len; --i >= 0;) {
3147
+ var rid = rids[i];
3148
+ var removed = false;
3149
+ if(!exceptions || !exceptions[rid]) {
3150
+ var values = dt.getRowData(rid);
3151
+ if (values) {
3152
+ removed = checker(rid, values) === filteringOut;
3153
+ } else {
3154
+ removed = true;
3155
+ }
3156
+ }
3157
+ if(removed) {
3158
+ ++spliceCount;
3159
+ } else if(spliceCount > 0) {
3160
+ rids.splice(i + 1, spliceCount);
3161
+ spliceCount = 0;
3162
+ }
3163
+ }
3164
+ if(spliceCount > 0) {
3165
+ rids.splice(0, spliceCount);
3166
+ }
3167
+ };
3168
+ /** @private
3169
+ * @param {string|Function|undefined} cid
3170
+ * @param {*} value
3171
+ * @return {Function} A new function object is created, if cid is a string
3172
+ */
3173
+ DataView.prototype._getFilterLogic = function(cid, value) {
3174
+ if(cid != null) {
3175
+ if(typeof cid == "function") {
3176
+ return cid;
3177
+ } else if(typeof cid == "string") {
3178
+ return DataView._defaultFilterLogic.bind(null, cid, value);
3179
+ } else {
3180
+ return DataView._defaultFilterLogic.bind(null, cid + "", value);
3181
+ }
3182
+ }
3183
+ return null;
3184
+ };
3185
+
3186
+ /**
3187
+ * @private
3188
+ * @param {number} pageIndex
3189
+ * @return {boolean} True if there is any change, otherwise false
3190
+ * @fires DataView#pageIndexChanged
3191
+ */
3192
+ DataView.prototype._setPage = function (pageIndex) {
3193
+ if (pageIndex > this._lastPageIndex && this._pageCorrection) {
3194
+ pageIndex = this._lastPageIndex;
3195
+ }
3196
+ if (pageIndex < 1) {
3197
+ pageIndex = 1;
3198
+ }
3199
+
3200
+ if (pageIndex == this._pageIndex) {
3201
+ return false;
3202
+ }
3203
+
3204
+ this._pageIndex = pageIndex;
3205
+ this._transformView();
3206
+ this._dispatch("pageIndexChanged", {"pageIndex": this._pageIndex});
3207
+ return true;
3208
+ };
3209
+ /** @private
3210
+ * @param {number=} firstChange Negative value is equivalent to 0
3211
+ * @return {boolean} Return true if there is any change, otherwise false
3212
+ */
3213
+ DataView.prototype._updatePaginationView = function(firstChange) {
3214
+ var dirty = false;
3215
+ if(this._pageView) {
3216
+ if(!firstChange) { firstChange = 0; }
3217
+
3218
+ var pageStart = this._pageSize * (this._pageIndex - 1);
3219
+
3220
+ var pageEnd = this._pageSize + pageStart;
3221
+ if(firstChange < pageEnd) { // The change happens before current page
3222
+ var rids = this._groupView || this._rids;
3223
+ if (pageEnd > rids.length) { // Shrink view if the last page is not a full page
3224
+ pageEnd = rids.length;
3225
+ }
3226
+
3227
+ // Populate the page
3228
+ var ridsLen = pageEnd - pageStart;
3229
+ this._pageView.length = (ridsLen >= 0) ? ridsLen : 0;
3230
+ for(var i = pageStart; i < pageEnd; ++i) {
3231
+ this._pageView[i - pageStart] = rids[i];
3232
+ }
3233
+ dirty = true;
3234
+ }
3235
+ }
3236
+ return dirty;
3237
+ };
3238
+
3239
+ /** WARNING: _transformView() may be called due to page index changed
3240
+ * @private
3241
+ * @return {boolean} Return true if page index is changed
3242
+ * @fires DataView#pageCountChanged
3243
+ * @fires DataView#pageIndexChanged
3244
+ */
3245
+ DataView.prototype._updatePageCount = function () {
3246
+ var lastPageIndex = 1;
3247
+ if (this._pageSize > 0) {
3248
+ var rows = this._groupView || this._rids;
3249
+ var rowCount = (rows.length > 0) ? rows.length : 0;
3250
+ lastPageIndex = Math.ceil(rowCount / this._pageSize);
3251
+ }
3252
+ if(this._lastPageIndex !== lastPageIndex) {
3253
+ this._lastPageIndex = lastPageIndex;
3254
+ this._dispatch("pageCountChanged", {"pageCount": this._lastPageIndex});
3255
+
3256
+ if(this._lastPageIndex < this._pageIndex && this._pageCorrection) {
3257
+ return this._setPage(this._lastPageIndex);
3258
+ }
3259
+ }
3260
+ return false;
3261
+ };
3262
+
3263
+ /** @private
3264
+ * @param {string} rid
3265
+ */
3266
+ DataView.prototype._dispatchRowRemoved = function(rid) {
3267
+ if(rid) {
3268
+ this._dispatchDataChange({"type": "removed", "rid": rid});
3269
+ }
3270
+ };
3271
+ /** @private
3272
+ * @param {Array.<string>} rids
3273
+ */
3274
+ DataView.prototype._dispatchMultiRowRemoved = function(rids) {
3275
+ if(rids) {
3276
+ var count = rids.length;
3277
+ if(count === 1) {
3278
+ this._dispatchRowRemoved(rids[0]);
3279
+ } else if(count > 1) {
3280
+ this._dispatchDataChange({"type": "removed", "rids": rids});
3281
+ }
3282
+ }
3283
+ };
3284
+ /** @private
3285
+ */
3286
+ DataView.prototype._dispatchGlobalChange = function() {
3287
+ this._dispatchDataChange(DataTable._globalChangeArg);
3288
+ };
3289
+ /** @private
3290
+ * @param {!Object} evtArgument
3291
+ */
3292
+ DataView.prototype._dispatchDataChange = function(evtArgument) {
3293
+ this._dispatch("dataChanged", evtArgument);
3294
+ };
3295
+
3296
+ /** @private
3297
+ * @param {DataTable|DataView} source
3298
+ */
3299
+ DataView.prototype._setParent = function (source) {
3300
+ this._parent = source;
3301
+ this._dt = /** @type{DataTable} */(source);
3302
+ do {
3303
+ source = source.getDataSource();
3304
+ if(source) {
3305
+ this._dt = /** @type{DataTable} */(source);
3306
+ }
3307
+ } while(source);
3308
+
3309
+ if(this._parent && this._dt !== this._parent) { // Copy shared member from parent data view
3310
+ this._shared = this._parent._shared;
3311
+
3312
+ var cids = this._parent._columnStats;
3313
+ if(cids) {
3314
+ for(var cid in cids) {
3315
+ var cs = this.enableColumnStats(cid);
3316
+ var pcs = this._parent.getColumnStats(cid);
3317
+ if(cs && pcs) {
3318
+ cs.setColumnDataGetter(pcs.getColumnDataGetter());
3319
+ }
3320
+ }
3321
+ }
3322
+ }
3323
+ };
3324
+
3325
+ /** @private
3326
+ */
3327
+ DataView.prototype._populateGroups = function () {
3328
+ var initialRids = this._rids;
3329
+ var i, len, member;
3330
+ this._rids = [];
3331
+
3332
+ // Collect members of each group from the available data
3333
+ var groupId, groupIds, groupLen;
3334
+ var ridMap = {};
3335
+ var groupList = [];
3336
+ len = initialRids.length;
3337
+ for(i = 0; i < len; ++i) {
3338
+ var rid = initialRids[i];
3339
+ var rowData = this._dt.getRowData(rid);
3340
+ if(rowData) {
3341
+ groupIds = this._resolveGroupId(rowData);
3342
+ groupLen = groupIds.length;
3343
+ if(groupLen > 1) {
3344
+ // activate multi-group row mode
3345
+ this._shared.multiGroupRow = true;
3346
+ }
3347
+ for(var j = 0; j < groupLen; j++) {
3348
+ groupId = groupIds[j];
3349
+ var groupedRids = ridMap[groupId];
3350
+ if(groupedRids) {
3351
+ groupedRids.push(rid);
3352
+ } else {
3353
+ groupedRids = [rid];
3354
+ ridMap[groupId] = groupedRids;
3355
+ groupList.push(groupId);
3356
+ }
3357
+ }
3358
+ }
3359
+ }
3360
+
3361
+ // Remove groups that have no member
3362
+ if(this._shared.autoGroupRemoval) {
3363
+ len = this._groupList.length;
3364
+ for(i = len; --i >= 0;) {
3365
+ groupId = this._groupList[i];
3366
+ if(!ridMap[groupId]) { // No member exists
3367
+ member = this._groupMembers[groupId];
3368
+ if(member && !member._predefinedGroup) { // Predefined group should not be removed automatically
3369
+ this._removeGroupMember(i, groupId);
3370
+ }
3371
+ }
3372
+ }
3373
+ }
3374
+ // Remove any non existing predefined groups
3375
+ var preDefGroups = null;
3376
+ if(this._preDefGroups && this._groupLevel < this._preDefGroups.length) {
3377
+ preDefGroups = this._preDefGroups[this._groupLevel];
3378
+ }
3379
+
3380
+ len = this._groupList.length;
3381
+ if(this._preDefGroupsDirty) {
3382
+ this._preDefGroupsDirty = false;
3383
+ for(i = len; --i >= 0;) {
3384
+ groupId = this._groupList[i];
3385
+ member = this._groupMembers[groupId];
3386
+ if(member && member._predefinedGroup) {
3387
+ // TODO: Handle the case where predefined groups exist in normal groupList
3388
+ if(preDefGroups) {
3389
+ if(preDefGroups.indexOf(member._groupId) < 0) {
3390
+ this._removeGroupMember(i, groupId);
3391
+ }
3392
+ } else {
3393
+ this._removeGroupMember(i, groupId);
3394
+ }
3395
+ }
3396
+ }
3397
+ }
3398
+
3399
+
3400
+ // Add predefined groups first, allowing user to initially order the groups
3401
+ if(preDefGroups) {
3402
+ len = preDefGroups.length;
3403
+ for(i = 0; i < len; ++i) {
3404
+ var pdg = this._addGroup(preDefGroups[i]);
3405
+ if(pdg) {
3406
+ pdg._predefinedGroup = true;
3407
+ }
3408
+ }
3409
+ }
3410
+ // Add normal group
3411
+ len = groupList.length;
3412
+ for(i = 0; i < len; ++i) {
3413
+ this._addGroup(groupList[i]);
3414
+ }
3415
+
3416
+ // Add row Id
3417
+ len = this._groupList.length;
3418
+ for(i = 0; i < len; ++i) { // Re-distribute this object content to all of its group members
3419
+ groupId = this._groupList[i];
3420
+ member = this._groupMembers[groupId];
3421
+ member._updateRowIds(ridMap[groupId]); // member will be sorted individually
3422
+ member._markColumnStatsDirty(); // Since there is no event fired for child members
3423
+ }
3424
+
3425
+ this._groupViewDirty = true;
3426
+ this._rebuildRowIdsFromChildren();
3427
+ };
3428
+ /** @private
3429
+ * @param {number} groupIndex
3430
+ * @param {string} groupId
3431
+ */
3432
+ DataView.prototype._removeGroupMember = function (groupIndex, groupId) {
3433
+ var member = this._groupMembers[groupId];
3434
+ if(member) {
3435
+ this._groupList.splice(groupIndex, 1);
3436
+ delete this._groupMembers[groupId];
3437
+
3438
+ member.dispose(); // Clear everything. Note that this will call groupBy(null);
3439
+ }
3440
+ };
3441
+ /** @private
3442
+ * @param {string} cid
3443
+ * @param {Object.<string, *>} values
3444
+ * @return {Array.<string>}
3445
+ */
3446
+ DataView.prototype._defaultGroupCriteria = function(cid, values) {
3447
+ var val = values[cid];
3448
+ if(Array.isArray(val)) {
3449
+ return val.map(function(data) {
3450
+ return data + "";
3451
+ });
3452
+ } else {
3453
+ return [val + ""];
3454
+ }
3455
+ };
3456
+ /** @private
3457
+ * @param {string|null} rid
3458
+ * @param {Object.<string, *>} values
3459
+ * @return {boolean}
3460
+ */
3461
+ DataView.prototype._groupFilterLogic = function(rid, values) {
3462
+ var gids = this._groupCriteria[this._groupLevel - 1](values);
3463
+ return gids.indexOf(this._groupId) >= 0;
3464
+ };
3465
+
3466
+ /** @private
3467
+ * @param {string} strA
3468
+ * @param {string} strB
3469
+ * @return {number}
3470
+ */
3471
+ DataView.prototype._internalGroupSortingLogic = function(strA, strB) {
3472
+ var dvA = this._groupMembers[strA];
3473
+ var dvB = this._groupMembers[strB];
3474
+
3475
+ return this._groupSortingLogic(strA, strB, dvA, dvB);
3476
+ };
3477
+
3478
+ /** @private
3479
+ * @param {*} value
3480
+ * @return {DataView} Newly added group member. If it already exists, this method returns null.
3481
+ */
3482
+ DataView.prototype._addGroup = function (value) {
3483
+ var groupId = value + "";
3484
+ if(!groupId) {
3485
+ // window.console.log("WARNING: Group Id cannot be an empty string");
3486
+ return null;
3487
+ }
3488
+ var member = this._groupMembers[groupId];
3489
+ if(member) {
3490
+ return null;
3491
+ }
3492
+ var parentGrpRowId = this._groupRowId || "_grp";
3493
+ var newGrpRowId = parentGrpRowId + "_" + groupId;
3494
+ var arg;
3495
+ if(this._hasListener("beforeGroupAdded")) {
3496
+ arg = {
3497
+ "dataView": this, // parent
3498
+ "newGroupId": groupId,
3499
+ "newGroupValue": value,
3500
+ "newGroupRowId": newGrpRowId,
3501
+ "newGroupLevel": this._groupLevel + 1
3502
+ };
3503
+ this._dispatch("beforeGroupAdded", arg);
3504
+ if(arg["cancel"]) {
3505
+ return null;
3506
+ }
3507
+ }
3508
+ member = new DataView();
3509
+ member._groupId = groupId;
3510
+ if(typeof value == "string") { // TODO: Raw value should not always be a string
3511
+ if(value == "null") {
3512
+ member._groupValue = null;
3513
+ } else if(value != "undefined") {
3514
+ member._groupValue = value;
3515
+ } // else { value is undefined string
3516
+ } else {
3517
+ member._groupValue = value;
3518
+ }
3519
+
3520
+ if (arg && arg["hideHeaderRow"] === true) {
3521
+ member._hiddenHeaderRow = true;
3522
+ }
3523
+
3524
+ member._groupRowId = newGrpRowId;
3525
+ member._groupLevel = this._groupLevel + 1;
3526
+ member._groupCriteria = this._groupCriteria; // Shared Member
3527
+ member._preDefGroups = this._preDefGroups;
3528
+ if(member._groupLevel < member._groupCriteria.length) {
3529
+ member._groupMembers = {};
3530
+ member._groupList = [];
3531
+ member._groupView = [];
3532
+ }
3533
+ member._groupRows = this._groupRows; // Shared Member
3534
+ member._setParent(this);
3535
+ member._sortingDefs = this._sortingDefs; // Shared Member
3536
+
3537
+ this._groupMembers[groupId] = member;
3538
+ this._groupList.push(groupId);
3539
+ this._groupRows[member._groupRowId] = member;
3540
+
3541
+ if(!this._hidden) {
3542
+ if (member._isHeaderRowShown()) {
3543
+ this._groupView.push(member._groupRowId); // Add header row
3544
+ }
3545
+
3546
+ this._groupViewDirty = true;
3547
+ member._beingAdded = true;
3548
+ this._dispatch("groupAdded", {
3549
+ "dataView": this,
3550
+ "newGroup": member
3551
+ });
3552
+ member._beingAdded = false;
3553
+ }
3554
+
3555
+ member.listen("groupAdded", this._onGroupAdded);
3556
+ if(this._hasListener("beforeGroupAdded")) {
3557
+ member.listen("beforeGroupAdded", this._onBeforeGroupAdded);
3558
+ }
3559
+ return member;
3560
+ };
3561
+ /** @private
3562
+ */
3563
+ DataView.prototype._triggerGroupRefreshing = function () {
3564
+ if(this._groupLevel > 0) {
3565
+ if(this._parent) {
3566
+ this._parent._triggerGroupRefreshing();
3567
+ }
3568
+ } else if(this._groupRows && !this._refreshTimerId) {
3569
+ this._refreshTimerId = setTimeout(this._onRefreshTimeout, 100);
3570
+ }
3571
+ };
3572
+ /** @private
3573
+ * @fires DataView#pageCountChanged
3574
+ * @fires DataView#pageIndexChanged
3575
+ */
3576
+ DataView.prototype._rebuildRowIdsFromChildren = function () {
3577
+ if(!this._groupViewDirty) {
3578
+ return;
3579
+ }
3580
+
3581
+ this._rids.length = 0;
3582
+ if(this._groupView) { this._groupView.length = 0; }
3583
+ if(!this._hidden) {
3584
+ var grpLen = this._groupList.length;
3585
+ for(var i = 0; i < grpLen; ++i) { // Re-distribute this object content to all of its group members
3586
+ var gid = this._groupList[i];
3587
+ var member = this._groupMembers[gid];
3588
+ member._rebuildRowIdsFromChildren();
3589
+
3590
+ Util.pushArrayItems(this._rids, member._rids);
3591
+
3592
+ if(!this._collapsed && this._groupView) {
3593
+ if (member._isHeaderRowShown()) {
3594
+ this._groupView.push(member._groupRowId); // Add header row
3595
+ }
3596
+ if(!member._collapsed) { // WARNING: This gives different value from isCollapsed() method
3597
+ var rids = member._getFirstHiddenRids() || member._groupView || member._rids;
3598
+ Util.pushArrayItems(this._groupView, rids);
3599
+ Util.pushArrayItems(this._groupView, member._footerRowIds);
3600
+ }
3601
+ }
3602
+ }
3603
+ }
3604
+ this._groupViewDirty = false;
3605
+
3606
+ // View has been re-created. So we need to add row expansion
3607
+ if(!this._updatePageCount()) {
3608
+ this._transformView();
3609
+ }
3610
+ };
3611
+ /** @private
3612
+ * @param {Object} rowData
3613
+ * @return {Array.<string>}
3614
+ */
3615
+ DataView.prototype._resolveGroupId = function (rowData) {
3616
+ return /** @type{Array.<string>} */(this._groupCriteria[this._groupLevel](rowData));
3617
+ };
3618
+
3619
+ /** @private
3620
+ */
3621
+ DataView.prototype._markColumnStatsDirty = function() {
3622
+ for(var cid in this._columnStats) {
3623
+ this._columnStats[cid].markDirty();
3624
+ }
3625
+ };
3626
+
3627
+ /** @private
3628
+ * @function
3629
+ * @param {string} cid
3630
+ * @param {*} value
3631
+ * @param {string} rid
3632
+ * @param {Object.<string, *>} values
3633
+ * @return {boolean}
3634
+ */
3635
+ DataView._defaultFilterLogic = function(cid, value, rid, values) {
3636
+ return (values[cid] === value);
3637
+ };
3638
+ /** @private
3639
+ * @function
3640
+ * @param {string} strA
3641
+ * @param {string} strB
3642
+ * @return {number}
3643
+ */
3644
+ DataView._defaultGroupSortingLogic = function(strA, strB) {
3645
+ if(strA == strB) {
3646
+ return 0;
3647
+ }
3648
+ return (strA < strB) ? -1 : 1;
3649
+ };
3650
+
3651
+ DataView._proto = DataView.prototype;
3652
+
3653
+ export default DataView;
3654
+ export { DataView };