@refinitiv-ui/efx-grid 0.0.0-dev.12023565035.1

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