@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,2206 @@
1
+ import Ext from "../../../tr-grid-util/es6/Ext.js";
2
+ import DataCache from "./DataCache.js";
3
+ import Util from "../grid/util/util.js";
4
+ import Segment from "./Segment.js"; // eslint-disable-line
5
+ import SegmentCollection from "./SegmentCollection.js";
6
+
7
+ /** Trigger when data within the table has been changed
8
+ * @event DataTable#dataChanged
9
+ * @property {boolean} globalChange Indicates a big change. User should expect all data has been change
10
+ * @property {string} type Type of changes. Possible values are "inserted", "removed", "updated", and undefined
11
+ * @property {string} rid Row Id
12
+ * @property {Object.<string, *>} rowData Column values of the changed row in JSON object format
13
+ */
14
+
15
+ /** Trigger before DataTable#dataChanged. Perform any data update during the event will NOT cause more dataChanged events
16
+ * @event DataTable#dataComposed
17
+ */
18
+
19
+ /** @constructor
20
+ * @extends {DataCache}
21
+ */
22
+ let DataTable = function() {
23
+ DataTable.base(this, 'constructor');
24
+
25
+ this._removeRows = this._removeRows.bind(this);
26
+ this._bySegmentSeparator = this._bySegmentSeparator.bind(this);
27
+ this._onClassifyingTimer = this._onClassifyingTimer.bind(this);
28
+ this._onSubSegmentChanged = this._onSubSegmentChanged.bind(this);
29
+
30
+ this._prevData = {};
31
+ this._rids = [];
32
+
33
+ this._compMap = {};
34
+
35
+ this._addEvent("subSegmentChanged");
36
+ };
37
+ Ext.inherits(DataTable, DataCache);
38
+
39
+ /** @private
40
+ * @type {Object.<string, Object.<string, *>>}
41
+ */
42
+ DataTable.prototype._prevData = null; // Mainly used for blinking
43
+ /** @private
44
+ * @type {!Array.<string>}
45
+ */
46
+ DataTable.prototype._rids;
47
+ /** @private
48
+ * @type {boolean}
49
+ */
50
+ DataTable.prototype._frozen = false;
51
+ /** @private
52
+ * @type {number}
53
+ */
54
+ DataTable.prototype._runningId = 0;
55
+
56
+ /** Comparer map that will be shared across all child DataViews
57
+ * @private
58
+ * @type {Object.<string, DataTable.SortLogic>}
59
+ */
60
+ DataTable.prototype._compMap = null;
61
+
62
+ /** @private
63
+ * @type {SegmentCollection}
64
+ */
65
+ DataTable.prototype._segments = null;
66
+ /** @private
67
+ * @type {boolean}
68
+ */
69
+ DataTable.prototype._autoSegmentFilling = false;
70
+ /** @private
71
+ * @type {Object}
72
+ */
73
+ DataTable.prototype._removedRows = null;
74
+ /** @private
75
+ * @type {Function}
76
+ */
77
+ DataTable.prototype._userSegmentComparer = null;
78
+ /** @private
79
+ * @type {number}
80
+ */
81
+ DataTable.prototype._segmentSortOrder = 0;
82
+ /** @private
83
+ * @type {*}
84
+ */
85
+ DataTable.prototype._segmentSortContext = null;
86
+ /** @private
87
+ * @type {Object.<string, Object>}
88
+ */
89
+ DataTable.prototype._clsSource = null;
90
+ /** @private
91
+ * @type {number}
92
+ */
93
+ DataTable.prototype._classifyingTimer = 0;
94
+ /** @private
95
+ * @type {boolean}
96
+ */
97
+ DataTable.prototype._segmentDefaultCollapsing = false;
98
+
99
+ /** @typedef {Function} DataTable~SortLogic
100
+ * @description SortLogic function is used for comparison between two values during sorting. <br>
101
+ * The function should return:<br>
102
+ * negative value to put val1 before val2, <br>
103
+ * positive value to put val2 before val1. <br>
104
+ * zero or falsy value to keep val1 and val2 unchanged.
105
+ * @property {*} val1 Value from a row
106
+ * @property {*} val2 Value from another row
107
+ * @property {number=} order 1 indicates ascending order, and -1 indicates descending order
108
+ * @property {*=} contextObject Any given user context
109
+ * @example
110
+ * let customComparer = function(a, b, order) {
111
+ * if(a + 10 < b) { return -order; }
112
+ * if(b + 10 < a) { return order; }
113
+ * return 0; // a and b are less than 10 difference apart
114
+ * };
115
+ */
116
+ DataTable.SortLogic;
117
+
118
+
119
+ /** @override
120
+ */
121
+ DataTable.prototype.dispose = function() {
122
+ this.unlistenAll();
123
+ this.clearAllData(true);
124
+
125
+ if(this._classifyingTimer) {
126
+ clearTimeout(this._classifyingTimer);
127
+ this._classifyingTimer = 0;
128
+ }
129
+
130
+ this._compMap = null; // Release user function that may be bound
131
+ this._clsSource = null;
132
+ DataTable._removeIndexArray();
133
+ if(this._segments) {
134
+ this._segments.dispose();
135
+ this._segments = null;
136
+ }
137
+ };
138
+
139
+ /** {@link DataCache#getColumnData}
140
+ * @override
141
+ */
142
+ DataTable.prototype.getColumnData = function(cid) {
143
+ let rows = new Array(this._rids.length);
144
+ for(let i = this._rids.length; --i >= 0;) {
145
+ rows[i] = this._rows[this._rids[i]][cid];
146
+ }
147
+ return rows;
148
+ };
149
+ /** @public
150
+ * @param {number} rowIndex
151
+ * @return {string}
152
+ */
153
+ DataTable.prototype.getRowId = function(rowIndex) {
154
+ return this._rids[rowIndex] || "";
155
+ };
156
+ /** {@link DataCache#getAllRowIds}
157
+ * @override
158
+ * @param {boolean=} opt_shallowCopy Default value is false. Set to true for speed
159
+ */
160
+ DataTable.prototype.getAllRowIds = function(opt_shallowCopy) {
161
+ if(opt_shallowCopy) {
162
+ return this._rids;
163
+ }
164
+ return this._rids.slice(0); // Fastest way to clone an array
165
+ };
166
+ /** @public
167
+ * @param {string} rid
168
+ * @return {number}
169
+ */
170
+ DataTable.prototype.getRowIndex = function(rid) {
171
+ return this._rids.indexOf(rid);
172
+ };
173
+ /** @public
174
+ * @return {number}
175
+ */
176
+ DataTable.prototype.getRowCount = function() {
177
+ return this._rids.length;
178
+ };
179
+ /** @public
180
+ * @param {number} rowIndex
181
+ * @param {string} cid
182
+ * @return {Object.<string, *>}
183
+ */
184
+ DataTable.prototype.getDataAt = function(rowIndex, cid) {
185
+ return this.getData(this._rids[rowIndex], cid);
186
+ };
187
+ /** @public
188
+ * @param {number} rowIndex
189
+ * @return {Object.<string, *>}
190
+ */
191
+ DataTable.prototype.getRowDataAt = function(rowIndex) {
192
+ return this.getRowData(this._rids[rowIndex]);
193
+ };
194
+ /** Get previously set data. This is good for blinking changed data
195
+ * @public
196
+ * @param {string} rid
197
+ * @param {string} cid
198
+ * @return {Object.<string, *>}
199
+ */
200
+ DataTable.prototype.getPreviousData = function(rid, cid) {
201
+ let row = this._prevData[rid] || null;
202
+ if(row) {
203
+ return row[cid];
204
+ }
205
+ return null;
206
+ };
207
+
208
+
209
+ /** Set data to individual cell
210
+ * @override
211
+ * @param {string} rid Row Id
212
+ * @param {string} cid Column Id
213
+ * @param {*} value
214
+ * @return {boolean} Return true if there is any change, and false otherwise
215
+ * @fires DataTable#dataChanged
216
+ */
217
+ DataTable.prototype.setData = function(rid, cid, value) { // Data changed event may be dispatched
218
+ if(!this._needFiring()) {
219
+ return this._setData(rid, cid, value);
220
+ }
221
+ let values = {};
222
+ values[cid] = value;
223
+ return this.setRowData(rid, values);
224
+ };
225
+ /** @private
226
+ * @param {string} rid Row Id
227
+ * @returns {boolean}
228
+ */
229
+ DataTable.prototype._removeRidFromSegments = function(rid) {
230
+ if(this._segments) {
231
+ let segment = this._segments.getSegment(rid);
232
+ if(segment) {
233
+ if(this._segments.removeSegment(rid)) {
234
+ // TODO: Handle sub segment removal
235
+ if(!this._segments.getSegmentCount()) {
236
+ this._segments.dispose();
237
+ this._segments = null;
238
+ }
239
+ return true;
240
+ }
241
+ } else {
242
+ let segmentParentId = this._segments.getParentRowId(rid);
243
+ if(segmentParentId) {
244
+ this._segments.removeSegmentChild(segmentParentId, rid);
245
+ }
246
+ }
247
+ }
248
+ return false;
249
+ };
250
+ /** Set data in row manner
251
+ * @override
252
+ * @public
253
+ * @param {string} rid Row Id
254
+ * @param {Object.<string, *>=} values Object where the key is column Id and value is the data to be set
255
+ * @param {Object=} eventArg Additional arguments to be attached to the event fired
256
+ * @return {boolean} Return true if there is any change, and false otherwise
257
+ * @fires DataTable#dataChanged
258
+ * @example
259
+ * let dt = new DataTable();
260
+ * dt.setRowData("row 1", {"column 1": "a", "column 2": 1, "column 3": null});
261
+ * dt.log(); // See console for the results
262
+ */
263
+ DataTable.prototype.setRowData = function(rid, values, eventArg) { // Data changed event may be dispatched
264
+ if(!rid) {
265
+ return false;
266
+ }
267
+
268
+ let row = this.getRowData(rid);
269
+ let dirty = false;
270
+ let type = "updated";
271
+ let segmentChanged = false;
272
+
273
+ if(values) {
274
+ if(!row) {
275
+ type = "inserted";
276
+ row = values;
277
+ this._rows[rid] = row; // WARNING: Dangerous use of external reference. User may modify data without using DataTable's API
278
+ this._prevData[rid] = {};
279
+ if(eventArg) {
280
+ let nextRid = /** @type{string} */(eventArg["nextRid"]); // Used for insertion only
281
+ let rowIndex = (nextRid) ? this.getRowIndex(nextRid) : -1;
282
+ if(rowIndex < 0) {
283
+ rowIndex = /** @type{number} */(eventArg["fallback"]);
284
+ }
285
+ if(rowIndex == null || rowIndex < 0 || rowIndex >= this._rids.length) {
286
+ this._rids.push(rid);
287
+ } else {
288
+ this._rids.splice(rowIndex, 0, rid);
289
+ if(this._segments) { // for no sorting case
290
+ this._segments.invalidateSegmentOrder();
291
+ }
292
+ segmentChanged = !this._isLastSegment(rowIndex); // This is slow. Check if this is required
293
+ }
294
+ } else {
295
+ this._rids.push(rid);
296
+ }
297
+ } else {
298
+ let prevData = this._prevData[rid];
299
+ for (let cid in values) {
300
+ prevData[cid] = row[cid];
301
+ row[cid] = values[cid];
302
+ }
303
+ }
304
+ dirty = true;
305
+ } else {
306
+ if(row) {
307
+ type = "removed";
308
+ // WARNING: Even if row is removed we still keep previous data
309
+ // delete this._prevData[rid];
310
+ this._prevData[rid] = this._rows[rid]; // Move reference from the removed row to history
311
+ delete this._rows[rid];
312
+ segmentChanged = this._removeRidFromSegments(rid);
313
+ DataTable._removeArrayItem(this._rids, rid);
314
+ dirty = true;
315
+ }
316
+ }
317
+
318
+ if(dirty && this._needFiring()) {
319
+ if(this._autoFillSegments()) {
320
+ this.dispatchGlobalChange();
321
+ } else {
322
+ let e = eventArg || {};
323
+ e["rid"] = rid;
324
+ e["changes"] = values; // WARNING: External user data is passed along
325
+ e["rowData"] = row;
326
+ e["type"] = type;
327
+ if(segmentChanged) {
328
+ e["segmentChanged"] = true;
329
+ }
330
+ this._dispatchDataChange(e);
331
+ }
332
+ this.requestClassifying(); // TODO: Check if needFiring method should have an effect on this request
333
+ }
334
+ return dirty;
335
+ };
336
+ /** Set data in a column manner. This is faster than repeatedly calling {@link DataTable#setData}
337
+ * @public
338
+ * @param {string} cid
339
+ * @param {Array.<*>} valueList
340
+ * @param {Array.<string>=} opt_ridList Specify row id to be set corresponding to the data item
341
+ * @example
342
+ * let dt = new DataTable();
343
+ * dt.setColumnData("column 1", ["1st row data", "2nd row data", "3rd row data"]);
344
+ * dt.log(); // See console for the results
345
+ */
346
+ DataTable.prototype.setColumnData = function(cid, valueList, opt_ridList) { // Data changed event may be dispatched
347
+ let rLen = (valueList) ? valueList.length : 0;
348
+ if(rLen < 0) { return; }
349
+
350
+ let prevFrozen = this._frozen;
351
+ this.freeze();
352
+ let rids = this._generateRids(rLen, opt_ridList);
353
+
354
+ for(let r = 0; r < rLen; ++r) {
355
+ this._setData(rids[r], cid, valueList[r]);
356
+ }
357
+
358
+ this.freeze(prevFrozen);
359
+ };
360
+ /** Add, update, and remove data in batch by using JSON object. This is faster than repeatedly calling {@link DataTable#setRowData}. <br>
361
+ Any existing row, that is not matched by the same row id provided in the argument, remains the same. <br>
362
+ Any existing row with the same row id from the provided argument will be updated. <br>
363
+ Row id with null value will cause a removal of the row with the same id.
364
+ * @public
365
+ * @param {Object.<string, Object.<string, *>>} obj Object is 2 level nested object where 1st level key is row Id and 2nd level key is column Id
366
+ * @see {@link DataTable#addRows}
367
+ * @see {@link DataTable#setDataFrom2DArray}
368
+ * @example
369
+ * let data = {
370
+ * "rowId 1": {"column 1": "a", "column 2": 1, "column 3": 2},
371
+ * "rowId 2": {"column 1": "b", "column 2": 3, "column 3": 4},
372
+ * "rowId 4": {"column 1": "d", "group_criteria": 1} // Rows don't need to be in uniform structure
373
+ * };
374
+ * let dt = new DataTable();
375
+ * dt.setDataFromObjectMap(data);
376
+ * dt.log(); // See console for the results
377
+ * dt.setDataFromObjectMap({"rowId 1": null}); // Remove the row with "rowId 1"
378
+ * dt.setDataFromObjectMap({"rowId 2": {"column 1": "newValue"} }); // Update existing row
379
+ */
380
+ DataTable.prototype.setDataFromObjectMap = function(obj) {
381
+ if(!obj) {
382
+ return;
383
+ }
384
+ if(Array.isArray(obj)) {
385
+ this.addRows(/** @type{Array.<Object>} */(obj));
386
+ return;
387
+ }
388
+
389
+ let prevFrozen = this._frozen;
390
+ this.freeze();
391
+
392
+ for(let rid in obj) {
393
+ this.setRowData(rid, obj[rid]);
394
+ }
395
+
396
+ this.freeze(prevFrozen);
397
+ };
398
+ /** Set data in batch from 2 dimensional array. This is faster than repeatedly calling {@link DataTable#setRowData}
399
+ * @public
400
+ * @param {Array.<Array.<*>>} ary Row based array
401
+ * @param {Array.<string>=} opt_cidList
402
+ * @param {Array.<string>=} opt_ridList
403
+ * @see {@link DataTable#addRows}
404
+ * @see {@link DataTable#setDataFromObjectMap}
405
+ * @example
406
+ * let data = [
407
+ * ["a", 1, 2],
408
+ * ["b", 3, 4],
409
+ * ["c", 5, 6]
410
+ * ];
411
+ * let dt = new DataTable();
412
+ * dt.setDataFrom2DArray(data, ["column 1", "column 2", "column 3"]);
413
+ * dt.log(); // See console for the results
414
+ */
415
+ DataTable.prototype.setDataFrom2DArray = function(ary, opt_cidList, opt_ridList) {
416
+ let rLen = (ary) ? ary.length : 0;
417
+ if(rLen < 0) { return; }
418
+
419
+ let prevFrozen = this._frozen;
420
+ this.freeze();
421
+
422
+ let c = 0;
423
+ let rids = this._generateRids(rLen, opt_ridList);
424
+
425
+ for(let r = 0; r < rLen; ++r) {
426
+ let row = ary[r];
427
+ let rid = rids[r];
428
+ if(opt_cidList) {
429
+ for(c = row.length; --c >= 0;) {
430
+ this._setData(rid, opt_cidList[c], row[c]);
431
+ }
432
+ } else {
433
+ for(c = row.length; --c >= 0;) {
434
+ this._setData(rid, "" + c, row[c]); // Auto-generate column id
435
+ }
436
+ }
437
+ }
438
+
439
+ this.freeze(prevFrozen);
440
+ };
441
+
442
+ /** Set data to individual cell by specified row index instead of row Id
443
+ * @public
444
+ * @param {number} rowIndex Invalid row index will not produce any effect
445
+ * @param {string} cid
446
+ * @param {*} value
447
+ * @return {boolean} Return true if there is any change, and false otherwise
448
+ * @fires DataTable#dataChanged
449
+ */
450
+ DataTable.prototype.setDataAt = function(rowIndex, cid, value) { // Data changed event may be dispatched
451
+ let rid = this.getRowId(rowIndex);
452
+ return (rid) ? this.setData(rid, cid, value) : false;
453
+ };
454
+ /** @public
455
+ * @param {number} rowIndex Invalid row index will not produce any effect
456
+ * @param {Object.<string, *>=} values Object where the key is column Id and value is the data to be set
457
+ * @param {Object=} opt_eventArg
458
+ * @return {boolean} Return true if there is any change, and false otherwise
459
+ * @fires DataTable#dataChanged
460
+ */
461
+ DataTable.prototype.setRowDataAt = function(rowIndex, values, opt_eventArg) { // Data changed event may be dispatched
462
+ let rid = this.getRowId(rowIndex);
463
+ return (rid) ? this.setRowData(rid, values, opt_eventArg) : false;
464
+ };
465
+ /** Add new row of data to the end of the Data Table
466
+ * @public
467
+ * @param {Object.<string, *>=} values field-value pair object
468
+ * @param {string|null=} 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
469
+ * @return {string} Return Row id that has been inserted or changed
470
+ * @fires DataTable#dataChanged
471
+ * @example
472
+ * let dt = new DataTable();
473
+ * dt.addRow({"column 1": "a", "column 2": 1, "column 3": null});
474
+ * dt.addRow({"column 1": "b", "column 2": 5, "column 3": {"someKey": 10}});
475
+ * dt.log(); // See console for the results
476
+ */
477
+ DataTable.prototype.addRow = function(values, rid) {
478
+ if(!values) { values = {}; }
479
+ rid = this._generateUniqueRid(values, rid);
480
+
481
+ this.setRowData(rid, values);
482
+ return rid;
483
+ };
484
+ /** Add multiple rows all at once. This is used to improve the performance. dataChagned with globalChange flag will be fired, if multiple rows are added.
485
+ * @public
486
+ * @param {Array.<Object>} rows Array of field-value pair object.
487
+ * @param {Array.<string>=} rids 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
488
+ * @fires DataTable#dataChanged
489
+ * @see {@link DataTable#setDataFrom2DArray}
490
+ * @see {@link DataTable#setDataFromObjectMap}
491
+ * @example
492
+ * let dt = new DataTable();
493
+ * dt.addRows([
494
+ * {"field1": "a", "field2": 1, "field3": null},
495
+ * {"field1": "b", "field2": 5, "field3": {"someKey": 10}},
496
+ * {"field1": "c", "field2": 7, "field3": [1, 2, 3]},
497
+ * {"field1": "c", "field4": "some value"} // Rows don't need to be in uniform structure
498
+ * ]); // 4 rows are added
499
+ * dt.log(); // See console for the results
500
+ */
501
+ DataTable.prototype.addRows = function(rows, rids) {
502
+ if(!Array.isArray(rows)) {
503
+ return;
504
+ }
505
+ let len = rows.length;
506
+ if(!len) {
507
+ return;
508
+ } else if(len === 1) {
509
+ this.addRow(rows[0], rids ? rids[0] : null);
510
+ return;
511
+ }
512
+ if(!rids) {
513
+ rids = [];
514
+ }
515
+ let prevFrozen = this._frozen;
516
+ this.freeze();
517
+ for(let i = 0; i < len; ++i) {
518
+ this.addRow(rows[i], rids[i]);
519
+ }
520
+ this.freeze(prevFrozen);
521
+ };
522
+
523
+ /** Insert a new row as the first row
524
+ * @public
525
+ * @param {Object.<string, *>=} opt_values
526
+ * @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
527
+ * @return {string} Return Row id that has been inserted or changed
528
+ * @fires DataTable#dataChanged
529
+ * @see {@link DataTable#insertRow}
530
+ */
531
+ DataTable.prototype.unshiftRow = function(opt_values, opt_rid) {
532
+ return this.insertRow(0, opt_values, opt_rid);
533
+ };
534
+ /** @public
535
+ * @param {(string|number|null)=} rowRef
536
+ * @param {Object.<string, *>=} values Key/value pair object map
537
+ * @param {string|null=} 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
538
+ * @return {string} Return Row id that has been inserted or changed
539
+ * @fires DataTable#dataChanged
540
+ * @see {@link DataTable#unshiftRow}
541
+ * @see {@link DataTable#removeRow}
542
+ */
543
+ DataTable.prototype.insertRow = function(rowRef, values, rid) {
544
+ let arg = null;
545
+ if(typeof rowRef === "number") {
546
+ arg = {};
547
+ arg["nextRid"] = this._rids[rowRef];
548
+ arg["fallback"] = rowRef; // Fallback index in case of no nextRid found
549
+ } else if(rowRef) {
550
+ arg = {};
551
+ arg["nextRid"] = /** @type{string} */(rowRef);
552
+ }
553
+
554
+ if(!values) { values = {}; }
555
+ rid = this._generateUniqueRid(values, rid);
556
+
557
+ this.setRowData(rid, values, arg);
558
+ return rid;
559
+ };
560
+ /** @public
561
+ * @param {string|number} rowRef
562
+ * @param {Object=} opt_values
563
+ * @param {string=} opt_rid
564
+ * @return {string}
565
+ * @fires DataTable#dataChanged
566
+ */
567
+ DataTable.prototype.insertAfter = function(rowRef, opt_values, opt_rid) {
568
+ let rowIndex = (typeof rowRef === "string") ? this.getRowIndex(rowRef) : /** @type{number}*/ (rowRef);
569
+
570
+ if(!(rowIndex >= 0) || rowIndex >= this._rids.length - 1) {
571
+ return this.addRow(opt_values, opt_rid);
572
+ }
573
+ return this.insertRow(rowIndex + 1, opt_values, opt_rid);
574
+ };
575
+
576
+ /** @public
577
+ * @param {number|string} rowRef Reference to the row to be removed
578
+ * @see {@link DataTable#removeRows}
579
+ */
580
+ DataTable.prototype.removeRow = function(rowRef) { // Data changed event may be dispatched
581
+ if(typeof rowRef === "number") {
582
+ this.setRowData(this.getRowId(rowRef), null);
583
+ } else {
584
+ this.setRowData(/** @type{string} */(rowRef), null);
585
+ }
586
+ };
587
+ /** @public
588
+ * @param {Array.<number|string>} refs Reference to the rows to be removed
589
+ * @see {@link DataTable#removeAllRows}
590
+ */
591
+ DataTable.prototype.removeRows = function(refs) {
592
+ let rid;
593
+ if(refs.length === 1) {
594
+ rid = refs[0];
595
+ if (typeof rid === "number") {
596
+ this.removeRow(rid);
597
+ } else {
598
+ this.setRowData(rid, null);
599
+ }
600
+ return;
601
+ }
602
+
603
+ let i;
604
+ let dirty = false;
605
+ this._removedRows = {};
606
+ for (i = refs.length; --i >= 0;) {
607
+ rid = refs[i];
608
+ if (typeof rid === "number") {
609
+ rid = this.getRowId(rid);
610
+ }
611
+
612
+ let row = this.getRowData(rid);
613
+ if(row) {
614
+ this._prevData[rid] = this._rows[rid];
615
+ this._removedRows[rid] = 1;
616
+ delete this._rows[rid];
617
+ this._removeRidFromSegments(rid);
618
+ dirty = true;
619
+ }
620
+ }
621
+ if(dirty) {
622
+ this._rids = this._rids.filter(this._removeRows);
623
+ this._removedRows = null;
624
+ this.dispatchGlobalChange();
625
+ } else {
626
+ this._removedRows = null;
627
+ }
628
+ };
629
+ /** @private
630
+ * @param {string} rid
631
+ * @return {boolean}
632
+ */
633
+ DataTable.prototype._removeRows = function(rid) {
634
+ return !this._removedRows[rid];
635
+ };
636
+
637
+ /** @private
638
+ * @param {Array} ary
639
+ * @param {*} item
640
+ * @return {boolean}
641
+ */
642
+ DataTable._removeArrayItem = function(ary, item) {
643
+ let at = ary.indexOf(item);
644
+ if(at >= 0) {
645
+ if(at >= ary.length) {
646
+ ary.pop(); // Array.pop is 100 times faster than Array.splice
647
+ } else {
648
+ ary.splice(at, 1);
649
+ }
650
+ return true;
651
+ }
652
+ return false;
653
+ };
654
+ /** Remove all existing rows
655
+ * @override
656
+ */
657
+ DataTable.prototype.clearAllData = function(suppressEvent) {
658
+ DataTable.base(this, "clearAllData", true);
659
+ this._prevData = {};
660
+
661
+ if(this._segments) {
662
+ this._segments.dispose();
663
+ this._segments = null;
664
+ }
665
+
666
+ if(this._rids.length) {
667
+ this._rids.length = 0;
668
+
669
+ this.dispatchGlobalChange(suppressEvent);
670
+ }
671
+ };
672
+ /** Alias to {@link DataTable#clearAllData}
673
+ * @public
674
+ * @function
675
+ * @param {boolean=} suppressEvent
676
+ * @fires DataTable#dataChanged
677
+ */
678
+ DataTable.prototype.removeAllRows = DataTable.prototype.clearAllData;
679
+ /** @private
680
+ * @function
681
+ * @param {number} a
682
+ * @param {number} b
683
+ * @return {number}
684
+ */
685
+ DataTable._ascendingOrder = function(a, b) { return a - b; };
686
+ /** @public
687
+ * @param {Array.<number>|number} fromIndex
688
+ * @param {number} toIndex
689
+ * @param {boolean=} suppressEvent
690
+ * @return {Array.<string>|string} Return row id(s). Return null if nothing has changed
691
+ */
692
+ DataTable.prototype.moveRow = function(fromIndex, toIndex, suppressEvent) {
693
+ let output = null;
694
+ let rid = "";
695
+ if(!(toIndex >= 0 && toIndex < this._rids.length)) {
696
+ toIndex = this._rids.length;
697
+ }
698
+
699
+ if (Array.isArray(fromIndex)) {
700
+ let fromIndices = fromIndex;
701
+ fromIndices.sort(DataTable._ascendingOrder);
702
+ let movedRids = [];
703
+ for (let i = fromIndices.length; --i >= 0;) {
704
+ let idx = fromIndices[i];
705
+ rid = this._rids[idx];
706
+ if(rid) {
707
+ movedRids.unshift(rid);
708
+ this._rids.splice(idx, 1); // WARNING: splice method is slow
709
+ if (idx < toIndex) {
710
+ --toIndex;
711
+ }
712
+ }
713
+ }
714
+ if(movedRids.length) {
715
+ this._rids.splice.apply(this._rids, [toIndex, 0].concat(movedRids));
716
+ output = movedRids;
717
+ }
718
+ } else {
719
+ if (fromIndex < 0) {
720
+ fromIndex = 0;
721
+ }
722
+
723
+ if(fromIndex !== toIndex && (fromIndex + 1) !== toIndex) {
724
+ rid = this._rids.splice(fromIndex, 1)[0];
725
+ if (rid) {
726
+ if (fromIndex < toIndex) {
727
+ --toIndex;
728
+ }
729
+ this._rids.splice(toIndex, 0, rid);
730
+ output = rid;
731
+ }
732
+ }
733
+ }
734
+
735
+ if(output) {
736
+ if(this._segments) {
737
+ this._segments.invalidateSegmentOrder();
738
+ this._sort(null); // Reorder segment members
739
+ }
740
+ this._dispatchPositionChange(suppressEvent);
741
+ }
742
+ return output;
743
+ };
744
+ /** @public
745
+ * @ignore
746
+ * @param {Array.<string>} fromRids
747
+ * @param {string} toRid If rid is empty string, insert the rid to the last index
748
+ * @param {boolean=} suppressEvent
749
+ * @return {Array.<string>|string} rid
750
+ */
751
+ DataTable.prototype._moveRow = function(fromRids, toRid, suppressEvent) {
752
+ let len = fromRids.length;
753
+ if(!len) {
754
+ return null;
755
+ }
756
+
757
+ let fromIndices = new Array(len);
758
+ for(let i = 0; i < len; ++i) {
759
+ fromIndices[i] = this.getRowIndex(fromRids[i]);
760
+ }
761
+
762
+ let toIndex = (toRid) ? this.getRowIndex(toRid) : this._rids.length;
763
+ if(len > 1) {
764
+ return this.moveRow(fromIndices, toIndex, suppressEvent);
765
+ }
766
+ return this.moveRow(fromIndices[0], toIndex, suppressEvent);
767
+ };
768
+
769
+ /** Move rows in chunk by specifying chunk size in the third parameter.
770
+ * @public
771
+ * @param {number|string} startIndex
772
+ * @param {number|string} toIndex
773
+ * @param {number=} opt_count
774
+ * @param {boolean=} suppressEvent
775
+ * @return {Array.<string>} rids Return null if nothing has changed
776
+ * @see {@link DataTable#moveRow}
777
+ */
778
+ DataTable.prototype.moveRows = function(startIndex, toIndex, opt_count, suppressEvent) {
779
+ if(typeof startIndex === "string") {
780
+ startIndex = this.getRowIndex(startIndex);
781
+ }
782
+ if(typeof toIndex === "string") {
783
+ toIndex = this.getRowIndex(toIndex);
784
+ }
785
+ if(startIndex < 0) { startIndex = 0; }
786
+ if(toIndex < 0) { toIndex = this._rids.length; }
787
+ if(!opt_count) { opt_count = 1; }
788
+
789
+ let endIndex = startIndex + opt_count - 1;
790
+ let targetIndex = toIndex;
791
+ if (toIndex >= startIndex) {
792
+ if (toIndex <= endIndex) {
793
+ targetIndex = startIndex;
794
+ } else {
795
+ targetIndex = toIndex - opt_count;
796
+ }
797
+ }
798
+
799
+ if ((opt_count > 0) && (endIndex <= this._rids.length)) {
800
+ if (targetIndex > this._rids.length) {
801
+ targetIndex = this._rids.length;
802
+ }
803
+
804
+ let rows = this._rids.splice(startIndex, opt_count);
805
+ let args = [targetIndex, 0].concat(rows);
806
+ Array.prototype.splice.apply(this._rids, args);
807
+
808
+ if(this._segments) {
809
+ this._sort(null); // Reorder segment members
810
+ }
811
+ this._dispatchPositionChange(suppressEvent);
812
+ return rows;
813
+ }
814
+
815
+ return null;
816
+ };
817
+
818
+ /** This method is deprecated in favor of more sophisticate {@link DataTable#moveRow}
819
+ * @public
820
+ * @param {number} fromIndex
821
+ * @param {number} toIndex
822
+ */
823
+ DataTable.prototype.swapRow = function(fromIndex, toIndex) { // No event is fired. No effect on other views
824
+ let len = this._rids.length;
825
+ if(fromIndex < 0 || fromIndex >= len) { return; }
826
+ if(toIndex < 0 || toIndex >= len) { return; }
827
+
828
+ let rid = this._rids[fromIndex];
829
+ this._rids[fromIndex] = this._rids[toIndex];
830
+ this._rids[toIndex] = rid;
831
+ };
832
+
833
+ /**
834
+ * @protected
835
+ * @override
836
+ * @ignore
837
+ * @param {string} fromRid
838
+ * @param {string} toRid
839
+ * @return {boolean}
840
+ */
841
+ DataTable.prototype._replaceRowId = function(fromRid, toRid) {
842
+ let rids = this._rids;
843
+ let idx = rids.indexOf(fromRid);
844
+ if(idx >= 0) {
845
+ rids[idx] = toRid;
846
+ this._rows[toRid] = this._rows[fromRid];
847
+ delete this._rows[fromRid];
848
+ this._prevData[toRid] = this._prevData[fromRid];
849
+ delete this._prevData[fromRid];
850
+ return true;
851
+ }
852
+ return false;
853
+ };
854
+ /**
855
+ * @public
856
+ * @override
857
+ * @ignore
858
+ * @param {Object} ridPair
859
+ */
860
+ DataTable.prototype.replaceRowIds = function(ridPair) {
861
+ if(typeof ridPair === "object") {
862
+ let dirty = false;
863
+ for(let oldRid in ridPair) {
864
+ dirty |= this._replaceRowId(oldRid, ridPair[oldRid]);
865
+ }
866
+ if(dirty) {
867
+ this.dispatchGlobalChange();
868
+ }
869
+ }
870
+ };
871
+
872
+ /** @public
873
+ * @function
874
+ * @param {string} rid
875
+ */
876
+ DataTable.prototype.clearRowData = DataTable.prototype.removeRow;
877
+ /** {@link DataCache#clearColumnData}
878
+ * @override
879
+ */
880
+ DataTable.prototype.clearColumnData = function(colId, suppressEvent) {
881
+ let cids = (typeof colId === "string") ? [/** @type {string} */(colId)] : /** @type {Array.<string>} */(colId);
882
+ for(let i = cids.length; --i >= 0;) {
883
+ let cid = cids[i];
884
+ if(cid) {
885
+ for(let rid in this._rows) {
886
+ delete this._rows[rid][cid];
887
+ delete this._prevData[rid][cid];
888
+ }
889
+ }
890
+ }
891
+
892
+ this.dispatchGlobalChange(suppressEvent);
893
+ };
894
+
895
+ /** Get parent data source. Note that DataTable cannot be child of other data source. So the returned value will always be null.
896
+ * @public
897
+ * @return {null}
898
+ */
899
+ DataTable.prototype.getDataSource = function() {
900
+ return null; // No other source
901
+ };
902
+ /** @public
903
+ * @param {*} source
904
+ */
905
+ DataTable.prototype.setDataSource = function(source) {};
906
+
907
+ /**
908
+ * @public
909
+ * @ignore
910
+ * @return {Object.<string, DataTable.SortLogic>}
911
+ */
912
+ DataTable.prototype.getSortingLogics = function() {
913
+ return this._compMap;
914
+ };
915
+ /** @public
916
+ * @param {string|Array.<string>} cid Column id
917
+ * @param {(string|number|Array.<string|number>)=} sortOrders "a"|"d"|"n"
918
+ * @param {DataTable.SortLogic=} customComparer
919
+ * @param {*=} contextObj Context object that will be provided as the forth parameter of the given comparer method
920
+ * @return {boolean} Return true if there is any change, otherwise false
921
+ * @fires DataTable#dataChanged
922
+ */
923
+ DataTable.prototype.sortOnce = function(cid, sortOrders, customComparer, contextObj) {
924
+ let sortingDefs = DataTable._buildSortContext(
925
+ [],
926
+ cid,
927
+ sortOrders,
928
+ customComparer || this._compMap,
929
+ contextObj // User context
930
+ );
931
+
932
+ if(this._sort(sortingDefs)) {
933
+ this._dispatchPositionChange();
934
+ return true;
935
+ }
936
+ return false;
937
+ };
938
+ /** @public
939
+ * @param {DataTable.SortLogic} func
940
+ * @example
941
+ * customLogic = function(a, b, sortOrder) {
942
+ * return (a - b) * sortOrder; // for numeric comparison
943
+ * };
944
+ * let dt = new DataTable();
945
+ * dt.setSortingLogic(customLogic);
946
+ * dt.sortOnce("Column id", "ascending");
947
+ */
948
+ DataTable.prototype.setSortingLogic = function(func) {
949
+ this._compMap["_default"] = func;
950
+ };
951
+ /** Specified sorting logic for the column with the given column id. This will override logic set by {@link DataTable#setSortingLogic}, when the column is sorted
952
+ * @public
953
+ * @param {string} cid
954
+ * @param {DataTable.SortLogic} func Use null to remove current sorting logic
955
+ */
956
+ DataTable.prototype.setColumnSortingLogic = function(cid, func) {
957
+ if(cid) {
958
+ this._compMap[cid] = func;
959
+ }
960
+ };
961
+ /** Get sorting logic for the specified field. Default logic is returned, if no logic is specified for the column
962
+ * @public
963
+ * @param {string=} cid
964
+ * @return {DataTable.SortLogic}
965
+ */
966
+ DataTable.prototype.getColumnSortingLogic = function(cid) {
967
+ if(cid) {
968
+ let logic = this._compMap[cid];
969
+ if(logic) {
970
+ return logic;
971
+ }
972
+ }
973
+
974
+ return this._compMap["_default"] || null;
975
+ };
976
+
977
+ /** Freeze data table so that no event is fired for data processing until executing {@link DataTable#unfreeze} method
978
+ * @public
979
+ * @param {boolean=} bool
980
+ * @return {boolean} Previous freeze state before the execution
981
+ * @fires DataTable#dataChanged
982
+ * @example
983
+ * let prevState = dt.freeze();
984
+ * for(let i = 0; i < 100; ++i) {
985
+ * dt.insertRow(); // no event is fired
986
+ * }
987
+ * dt.freeze(prevState); // Restore previous freeze states
988
+ */
989
+ DataTable.prototype.freeze = function(bool) {
990
+ bool = bool !== false;
991
+ let prevState = this._frozen;
992
+ if(prevState !== bool) {
993
+ this._frozen = bool;
994
+ if(!bool && this._segments) { // for no sorting case
995
+ this._segments.invalidateSegmentOrder();
996
+ }
997
+ this._autoFillSegments();
998
+ this.dispatchGlobalChange();
999
+ }
1000
+ return prevState;
1001
+ };
1002
+ /** @public
1003
+ * @param {boolean=} bool
1004
+ * @return {boolean} Previous freeze state before the execution
1005
+ */
1006
+ DataTable.prototype.unfreeze = function(bool) {
1007
+ return this.freeze(bool === false);
1008
+ };
1009
+ /** @public
1010
+ * @return {boolean} Current freeze state
1011
+ */
1012
+ DataTable.prototype.isFrozen = function() {
1013
+ return this._frozen;
1014
+ };
1015
+
1016
+ /** @private
1017
+ */
1018
+ DataTable.prototype._initSegmentCollection = function() {
1019
+ if (!this._segments) {
1020
+ this._segments = new SegmentCollection();
1021
+ this._segments.setDefaultCollapsing(this._segmentDefaultCollapsing);
1022
+ this._segments.addEventListener("subSegmentChanged", this._onSubSegmentChanged);
1023
+ }
1024
+ };
1025
+ /** Add or remove all segments from the given row ids
1026
+ * @public
1027
+ * @param {Array.<string>} rids
1028
+ * @param {boolean=} enabled
1029
+ * @return {boolean} Return true if there is any change
1030
+ */
1031
+ DataTable.prototype.setSegmentSeparators = function(rids, enabled) {
1032
+ if (!rids) {
1033
+ return false;
1034
+ }
1035
+ let adding = (enabled !== false);
1036
+ let segmentAdded = 0;
1037
+ let segmentRemoved = 0;
1038
+
1039
+ let len = rids.length;
1040
+ for (let i = 0; i < len; i++) {
1041
+ let rid = rids[i];
1042
+ if(adding) {
1043
+ this._initSegmentCollection();
1044
+ if(this._autoSegmentFilling) {
1045
+ let parentId = this._segments.getParentRowId(rid);
1046
+ if(parentId) {
1047
+ this._segments.removeSegmentChild(parentId, rid);
1048
+ }
1049
+ }
1050
+ segmentAdded |= this._segments.addSegment(rid);
1051
+ } else if (this._segments) { // Removing
1052
+ let segment = this._segments.getSegment(rid);
1053
+ if(segment) {
1054
+ if(this._segments.removeSegment(rid)) {
1055
+ segmentRemoved = 1;
1056
+ if(!this._segments.getSegmentCount()) {
1057
+ this._segments = null;
1058
+ }
1059
+ }
1060
+ }
1061
+ }
1062
+ }
1063
+ let changed = segmentAdded || segmentRemoved;
1064
+ if(changed && this._needFiring()) {
1065
+ this.dispatchGlobalChange();
1066
+ }
1067
+ return changed ? true : false;
1068
+ };
1069
+
1070
+ /**
1071
+ * @public
1072
+ * @param {string} rid
1073
+ * @param {*=} options=null Segment options. If the value is false, segment separator will be stripped off from the given rid
1074
+ * @return {boolean} Return true if there is any change
1075
+ */
1076
+ DataTable.prototype.setSegmentSeparator = function(rid, options) {
1077
+ let change = false;
1078
+ let memberCount = 0;
1079
+ if(rid && typeof rid === "string") {
1080
+ if(options !== false) {
1081
+ this._initSegmentCollection();
1082
+ if(this._autoSegmentFilling) {
1083
+ let parentId = this._segments.getParentRowId(rid);
1084
+ if(parentId) {
1085
+ this._segments.removeSegmentChild(parentId, rid);
1086
+ }
1087
+ }
1088
+ let children = (options && options["children"]) ? options["children"] : null;
1089
+ if(this._segments.addSegment(rid, children)) {
1090
+ change = true;
1091
+ }
1092
+ } else if(this._segments) { // Remove the separator
1093
+ let segment = this._segments.getSegment(rid);
1094
+ if(segment) {
1095
+ memberCount = segment.getChildCount();
1096
+ if(this._segments.removeSegment(rid)) {
1097
+ change = true;
1098
+ if(!this._segments.getSegmentCount()) {
1099
+ this._segments = null;
1100
+ }
1101
+ }
1102
+ }
1103
+ }
1104
+ }
1105
+ if(change && this._needFiring()) {
1106
+ if(this._autoFillSegments() || memberCount) {
1107
+ this.dispatchGlobalChange();
1108
+ } else {
1109
+ let rowData = this._rows[rid] || null;
1110
+ if(rowData) {
1111
+ this._dispatchDataChange({
1112
+ "rid": rid,
1113
+ "changes": {},
1114
+ "rowData": rowData,
1115
+ "type": "updated",
1116
+ "segmentChanged": true
1117
+ });
1118
+ }
1119
+ }
1120
+ }
1121
+
1122
+ return change;
1123
+ };
1124
+ /** @public
1125
+ * @return {boolean} Return true if there is any change
1126
+ */
1127
+ DataTable.prototype.unsetAllSegmentSeparators = function() {
1128
+ if(this._segments) {
1129
+ this._segments.dispose();
1130
+ this._segments = null;
1131
+ this.dispatchGlobalChange();
1132
+ return true;
1133
+ }
1134
+ return false;
1135
+ };
1136
+ /**
1137
+ * @public
1138
+ * @return {boolean}
1139
+ */
1140
+ DataTable.prototype.hasSegmentation = function() {
1141
+ return this._segments ? true : false;
1142
+ };
1143
+ /**
1144
+ * @public
1145
+ * @return {boolean}
1146
+ */
1147
+ DataTable.prototype.hasSegmentClassification = function() {
1148
+ return this._segments ? this._segments.hasClassification() : false;
1149
+ };
1150
+ /**
1151
+ * @public
1152
+ * @param {string} rid
1153
+ * @return {boolean}
1154
+ */
1155
+ DataTable.prototype.isSegmentSeparator = function(rid) {
1156
+ if(this._segments) {
1157
+ return this._segments.containsSegment(rid);
1158
+ }
1159
+ return false;
1160
+ };
1161
+ /** Get Segment object
1162
+ * @public
1163
+ * @param {string} rid Row id
1164
+ * @return {Segment} Returns null if a segment cannot be found
1165
+ */
1166
+ DataTable.prototype.getSegment = function(rid) {
1167
+ if(this._segments) {
1168
+ return this._segments.getSegment(rid);
1169
+ }
1170
+ return null;
1171
+ };
1172
+ /**
1173
+ * @public
1174
+ * @param {string} rid Row id of a segment child
1175
+ * @return {Segment} Returns null if a segment cannot be found
1176
+ */
1177
+ DataTable.prototype.getSegmentParent = function(rid) {
1178
+ if(this._segments) {
1179
+ return this._segments.getSegmentParent(rid);
1180
+ }
1181
+ return null;
1182
+ };
1183
+ /** Segment level starts from 1
1184
+ * @public
1185
+ * @param {string} rid
1186
+ * @return {number} Return 0 if the given rid is not a segment
1187
+ */
1188
+ DataTable.prototype.getSegmentLevel = function(rid) {
1189
+ let segment = this.getSegment(rid);
1190
+ if(segment) {
1191
+ return segment.getSegmentLevel() + 1;
1192
+ }
1193
+ return 0;
1194
+ };
1195
+ /**
1196
+ * @public
1197
+ * @param {string} rid
1198
+ * @return {string} parent row id of this segmentation. If the parent row id for this segmentation cannot be found, return ""
1199
+ */
1200
+ DataTable.prototype.getSegmentParentRowId = function(rid) {
1201
+ if(this._segments) {
1202
+ return this._segments.getParentRowId(rid);
1203
+ }
1204
+ return "";
1205
+ };
1206
+ /**
1207
+ * @public
1208
+ * @param {Array.<string>=} rids If no row id is given, row ids of this data table is used instead
1209
+ * @param {boolean=} partial Indicating that the given ids are not the whole list
1210
+ * @return {Array.<number>} Return null if there is no segmentation
1211
+ */
1212
+ DataTable.prototype.getSegmentValues = function(rids, partial) {
1213
+ if(this._segments) {
1214
+ this._segments.calcSegmentOrder(this._rids, true); // use cache
1215
+ return this._segments.getSegmentValues(rids || this._rids, partial);
1216
+ }
1217
+ return null;
1218
+ };
1219
+ /**
1220
+ * @private
1221
+ * @param {number} at Row index
1222
+ * @return {boolean} Return true if the given row is in the last segment
1223
+ */
1224
+ DataTable.prototype._isLastSegment = function(at) {
1225
+ let segmentSeparators = this._segments;
1226
+ if(segmentSeparators) {
1227
+ let rids = this._rids;
1228
+ let rowCount = rids.length;
1229
+ for(let r = at + 1; r < rowCount; ++r) {
1230
+ if(segmentSeparators.containsSegment(rids[r])) {
1231
+ return false;
1232
+ }
1233
+ }
1234
+ }
1235
+ return true;
1236
+ };
1237
+ /**
1238
+ * @public
1239
+ * @ignore
1240
+ * @return {SegmentCollection} Return null if there is no segmentation
1241
+ */
1242
+ DataTable.prototype._getSegmentSeparators = function() {
1243
+ return this._segments;
1244
+ };
1245
+ /** @public
1246
+ * @param {boolean=} enabled
1247
+ * @ignore
1248
+ */
1249
+ DataTable.prototype.enableAutoSegmentFilling = function(enabled) {
1250
+ this._autoSegmentFilling = enabled != false;
1251
+ this._autoFillSegments();
1252
+ };
1253
+ /** @private
1254
+ * @return {boolean} Return true if the fill segments have changed, otherwise return false
1255
+ */
1256
+ DataTable.prototype._autoFillSegments = function() {
1257
+ if(this._autoSegmentFilling) {
1258
+ return this.fillSegments();
1259
+ }
1260
+ return false;
1261
+ };
1262
+ /** Remove existing segment children and fill the segments with all content rows before the next segment separator
1263
+ * @public
1264
+ * @param {string} segmentId Row id
1265
+ */
1266
+ DataTable.prototype.fillSegment = function(segmentId) {
1267
+ if(this._segments) {
1268
+ this._segments.fillSegment(segmentId, this._rids);
1269
+ this.dispatchGlobalChange();
1270
+ this.requestClassifying();
1271
+ }
1272
+ };
1273
+ /** Remove all existing segment children in each segment and fill the segments with all contnet rows before the next segment separator
1274
+ * @public
1275
+ * @return {boolean} Return true if the fill segments have changed, otherwise return false
1276
+ */
1277
+ DataTable.prototype.fillSegments = function() {
1278
+ if(this._segments) {
1279
+ let dirty = this._segments.fillSegments(this._rids);
1280
+ if(dirty) {
1281
+ this.dispatchGlobalChange();
1282
+ this.requestClassifying();
1283
+ }
1284
+ return dirty;
1285
+ }
1286
+ return false;
1287
+ };
1288
+ /** @private
1289
+ * @param {boolean=} adding This indicates that segment is changed by adding a new child
1290
+ */
1291
+ DataTable.prototype._onSegmentChildChanged = function(adding) {
1292
+ if(adding !== false) {
1293
+ this._sort(null);
1294
+ }
1295
+ this._dispatchPositionChange(); // Force rerendering, even if there is no position change
1296
+
1297
+ this.requestClassifying();
1298
+ };
1299
+ /** @public
1300
+ * @param {string} segmentId Row id
1301
+ * @param {string} rid Row id
1302
+ * @param {string=} dataId Row id for retrieving data
1303
+ * @return {boolean} Return true if there is any change
1304
+ */
1305
+ DataTable.prototype.addSegmentChild = function(segmentId, rid, dataId) {
1306
+ if(this._segments) {
1307
+ let dirty = this._segments.addSegmentChild(segmentId, rid, dataId);
1308
+ if(dirty) {
1309
+ this._onSegmentChildChanged();
1310
+ return true;
1311
+ }
1312
+ }
1313
+ return false;
1314
+ };
1315
+ /** @public
1316
+ * @param {string} segmentId Row id
1317
+ * @param {Array.<string>} rids Row id
1318
+ * @param {Array.<string>=} dataIds Row ids for retrieving data
1319
+ * @return {boolean} Return true if there is any change
1320
+ */
1321
+ DataTable.prototype.addSegmentChildren = function(segmentId, rids, dataIds) {
1322
+ if(this._segments) {
1323
+ let dirty = this._segments.addSegmentChildren(segmentId, rids, dataIds);
1324
+ if(dirty) {
1325
+ this._onSegmentChildChanged();
1326
+ return true;
1327
+ }
1328
+ }
1329
+ return false;
1330
+ };
1331
+
1332
+ /** Deprecated. Remove all existing children and add new children according to the give array
1333
+ * @public
1334
+ * @param {Array.<Object>} segmentArr Segment array that contain "segmentId", "rowIds" to set segment children
1335
+ * @return {boolean} Return true if there is any change
1336
+ */
1337
+ DataTable.prototype.setSegmentChildren = function(segmentArr) {
1338
+ if(!this._segments) {
1339
+ return false;
1340
+ }
1341
+ let dirty = this._segments.removeAllSegmentChildren();
1342
+ let len = segmentArr.length;
1343
+ for (let i = 0; i < len; i++) {
1344
+ let obj = segmentArr[i];
1345
+ if(this._segments.addSegmentChildren(obj["segmentId"], obj["rowIds"])) {
1346
+ dirty = true;
1347
+ }
1348
+ }
1349
+ if(dirty) {
1350
+ this._onSegmentChildChanged();
1351
+ return true;
1352
+ }
1353
+
1354
+ return false;
1355
+ };
1356
+ /** @public
1357
+ * @param {string} segmentId Row id
1358
+ * @param {string} rid Row id
1359
+ * @return {boolean} Return true if there is any change
1360
+ */
1361
+ DataTable.prototype.removeSegmentChild = function(segmentId, rid) {
1362
+ if(this._segments) {
1363
+ let dirty = this._segments.removeSegmentChild(segmentId, rid);
1364
+ if(dirty) {
1365
+ this._onSegmentChildChanged(false);
1366
+ }
1367
+ return dirty;
1368
+ }
1369
+ return false;
1370
+ };
1371
+ /** @public
1372
+ * @param {string} segmentId Row id
1373
+ * @param {Array.<string>} rids Row id
1374
+ * @return {boolean} Return true if there is any change
1375
+ */
1376
+ DataTable.prototype.removeSegmentChildren = function(segmentId, rids) {
1377
+ if(this._segments) {
1378
+ let dirty = this._segments.removeSegmentChildren(segmentId, rids);
1379
+ if(dirty) {
1380
+ this._onSegmentChildChanged(false);
1381
+ }
1382
+ return dirty;
1383
+ }
1384
+ return false;
1385
+ };
1386
+ /** @public
1387
+ * @return {boolean} Return true if there is any change
1388
+ */
1389
+ DataTable.prototype.removeAllSegmentChildren = function() {
1390
+ if(this._segments) {
1391
+ let dirty = this._segments.removeAllSegmentChildren(); // This immediately remove all sub segments
1392
+ if (dirty) {
1393
+ this._onSegmentChildChanged(false);
1394
+ }
1395
+ return dirty;
1396
+ }
1397
+ return false;
1398
+ };
1399
+ /** Get row ids of all segment separator
1400
+ * @public
1401
+ * @return {Array.<string>} Return null if there is no segment separator
1402
+ */
1403
+ DataTable.prototype.getSegmentIds = function() {
1404
+ if(this._segments) {
1405
+ return this._segments.getSegmentIds();
1406
+ }
1407
+ return null;
1408
+ };
1409
+ /** Get row ids of all children from the specified segment
1410
+ * @public
1411
+ * @param {string} segmentId
1412
+ * @return {Array.<string>} Returns array of row ids. Returns null if there is no child or no segment separator found
1413
+ */
1414
+ DataTable.prototype.getSegmentChildIds = function(segmentId) {
1415
+ if(this._segments) {
1416
+ let segment = this._segments.getSegment(segmentId);
1417
+ if(segment) {
1418
+ let chdr = segment.getChildIds();
1419
+ return chdr.length ? chdr : null;
1420
+ }
1421
+ }
1422
+ return null;
1423
+ };
1424
+ /**
1425
+ * @private
1426
+ * @param {(Array|number)} sortOrder
1427
+ * @param {*} context
1428
+ */
1429
+ DataTable.prototype._setSegmentSortContext = function (sortOrder, context) {
1430
+ this._segmentSortOrder = sortOrder;
1431
+ this._segmentSortContext = context;
1432
+ };
1433
+ /** Sort all of existing segments by multiple sort logics
1434
+ * @public
1435
+ * @param {Function|Array.<Function>|Object} sortLogics
1436
+ * @param {Array.<number|string>=} sortOrders
1437
+ * @param {Array.<string>=} cids
1438
+ * @return {boolean}
1439
+ */
1440
+ DataTable.prototype.sortSeparators = function (sortLogics, sortOrders, cids) {
1441
+ if(!this._segments){
1442
+ return false;
1443
+ }
1444
+ if(typeof sortLogics === "function"){
1445
+ this._setSegmentSortContext(DataTable._getSortOrder(sortOrders), cids);
1446
+ return this.sortSegments(sortLogics);
1447
+ }
1448
+ if(!cids) {
1449
+ return false;
1450
+ }
1451
+ let sortingDefs = DataTable._buildSortContext(
1452
+ [],
1453
+ cids,
1454
+ sortOrders,
1455
+ sortLogics || this._compMap
1456
+ );
1457
+ let defCount = sortingDefs.length;
1458
+ let sortLogic = null;
1459
+ if(defCount > 1) {
1460
+ sortLogic = DataTable._multiColumnSeparatorCompareLogic;
1461
+ this._setSegmentSortContext(1, sortingDefs);
1462
+ } else if(defCount === 1) { // Single level sorting
1463
+ sortLogic = DataTable._singleColumnSeparatorCompareLogic;
1464
+ this._setSegmentSortContext(sortingDefs[0][3], sortingDefs[0]); // sortOrder and context
1465
+ } else {
1466
+ return false;
1467
+ }
1468
+ return this.sortSegments(sortLogic);
1469
+ };
1470
+ /** Sort all of existing segments by given compare function
1471
+ * @public
1472
+ * @param {Function} compare
1473
+ * @return {boolean}
1474
+ */
1475
+ DataTable.prototype.sortSegments = function (compare) {
1476
+ if(!this._segments) {
1477
+ return false;
1478
+ }
1479
+ if(typeof compare !== "function") {
1480
+ return false;
1481
+ }
1482
+
1483
+ this._userSegmentComparer = compare;
1484
+
1485
+ let segments = this._segments;
1486
+ let rootSegments = segments.sortSegments(this._bySegmentSeparator);
1487
+
1488
+ this._userSegmentComparer = null;
1489
+ this._setSegmentSortContext(0, null);
1490
+
1491
+ let rids = this._rids;
1492
+ let origRids = rids.slice();
1493
+ let rowCount = rids.length;
1494
+ rids.length = 0;
1495
+
1496
+ let segmentCount = 0;
1497
+ let dirty = false;
1498
+ for(let i = 0; i < rowCount; ++i) {
1499
+ let rid = origRids[i];
1500
+ let segment = segments.getSegment(rid);
1501
+ if(segment) {
1502
+ if(segment.isRootSegment()) {
1503
+ rootSegments[segmentCount++].getFlattenTreeIds(rids);
1504
+ }
1505
+ } else if(!segments.getParentRowId(rid)) {
1506
+ rids.push(rid);
1507
+ }
1508
+ if(rid !== rids[i]) {
1509
+ dirty = true;
1510
+ }
1511
+ }
1512
+
1513
+ if(dirty) {
1514
+ this._sort(null);
1515
+ this._dispatchPositionChange();
1516
+ }
1517
+ return dirty;
1518
+ };
1519
+ /** Sort all of existing segments by given compare function
1520
+ * @private
1521
+ * @param {*} rowA
1522
+ * @param {*} rowB
1523
+ * @return {number}
1524
+ */
1525
+ DataTable.prototype._bySegmentSeparator = function (rowA, rowB) {
1526
+ return /** @type{number} */(this._userSegmentComparer(
1527
+ this._getRowDataFromSegment(rowA),
1528
+ this._getRowDataFromSegment(rowB),
1529
+ this._segmentSortOrder,
1530
+ this._segmentSortContext
1531
+ ));
1532
+ };
1533
+ /** Get row data from either Segment or row id
1534
+ * @private
1535
+ * @param {*} obj
1536
+ * @return {Object}
1537
+ */
1538
+ DataTable.prototype._getRowDataFromSegment = function (obj) {
1539
+ var rowData = null;
1540
+ if(obj) {
1541
+ if(typeof obj == "string") {
1542
+ rowData = this.getRowData(obj);
1543
+ } else if(obj.getId) {
1544
+ rowData = this.getRowData(obj.getId());
1545
+ }
1546
+ }
1547
+ return rowData;
1548
+ };
1549
+
1550
+ /** A data source to be used with segment classification
1551
+ * @public
1552
+ * @param {DataCache} dc
1553
+ */
1554
+ DataTable.prototype.setClassificationSource = function(dc) {
1555
+ this._clsSource = null;
1556
+
1557
+ if(dc && dc._rows) {
1558
+ this._clsSource = dc._rows;
1559
+ }
1560
+ };
1561
+ /**
1562
+ * @public
1563
+ * @param {string} segmentId
1564
+ * @param {string|Array.<string>} fields
1565
+ * @return {boolean}
1566
+ */
1567
+ DataTable.prototype.setSegmentClassification = function(segmentId, fields) {
1568
+ if(this._segments) {
1569
+ let dirty = this._segments.setSegmentClassification(segmentId, fields);
1570
+ if(dirty) {
1571
+ return this.classifySegments();
1572
+ }
1573
+ }
1574
+ return false;
1575
+ };
1576
+ /** @public
1577
+ * @return {boolean}
1578
+ */
1579
+ DataTable.prototype.classifySegments = function() {
1580
+ if(this._segments) {
1581
+ if(this._rids.length) {
1582
+ return this._segments.classify(this._clsSource || this._rows);
1583
+ }
1584
+ }
1585
+ return false;
1586
+ };
1587
+
1588
+ /** @public
1589
+ */
1590
+ DataTable.prototype.requestClassifying = function() {
1591
+ if(this._segments && !this._classifyingTimer) {
1592
+ if(this._segments.hasClassification()) {
1593
+ this._classifyingTimer = setTimeout(this._onClassifyingTimer, 10);
1594
+ }
1595
+ }
1596
+ };
1597
+ /** @private
1598
+ */
1599
+ DataTable.prototype._onClassifyingTimer = function() {
1600
+ this._classifyingTimer = 0;
1601
+ this.classifySegments();
1602
+ };
1603
+ /** @private
1604
+ * @param {Object} e
1605
+ */
1606
+ DataTable.prototype._onSubSegmentChanged = function(e) {
1607
+ let insertionList = /** @type{Array.<Segment>} */(e["insertionList"]);
1608
+ let removalList = /** @type{Array.<string>} */(e["removalList"]);
1609
+
1610
+ let dirty = false;
1611
+ let rows = this._rows;
1612
+ let clsSource = this._clsSource || rows;
1613
+ let rids = this._rids;
1614
+ let prevData = this._prevData;
1615
+ let i;
1616
+
1617
+ let removalCount = removalList.length;
1618
+ let removedRows = {};
1619
+ for(i = 0; i < removalCount; i++) {
1620
+ let rid = removalList[i];
1621
+ if(rows[rid]) {
1622
+ removedRows[rid] = prevData[rid] = rows[rid];
1623
+ delete rows[rid];
1624
+ DataTable._removeArrayItem(rids, rid);
1625
+ dirty = true;
1626
+ // TODO: Remove classification source
1627
+ }
1628
+ }
1629
+
1630
+ let insertionCount = insertionList.length;
1631
+ for(i = 0; i < insertionCount; i++) {
1632
+ let segment = insertionList[i];
1633
+ let parentId = segment.getParentId();
1634
+ let segmentId = segment.getId();
1635
+
1636
+ if(!rows[segmentId]) {
1637
+ prevData[segmentId] = {};
1638
+ segment.setRowData(rows, clsSource);
1639
+
1640
+ let parentAt = rids.indexOf(parentId);
1641
+ if(parentAt < 0 || parentAt + 1 >= rids.length) {
1642
+ rids.push(segmentId);
1643
+ } else {
1644
+ rids.splice(parentAt + 1, 0, segmentId);
1645
+ }
1646
+ dirty = true;
1647
+ }
1648
+ }
1649
+ if(dirty) {
1650
+ e["removedRows"] = removedRows;
1651
+ this._dispatch("subSegmentChanged", e);
1652
+ this.dispatchGlobalChange(); // Rerender everything
1653
+ }
1654
+ };
1655
+
1656
+ /**
1657
+ * @public
1658
+ * @param {boolean} bool
1659
+ * @return {boolean}
1660
+ */
1661
+ DataTable.prototype.setSegmentDefaultCollapsing = function(bool) {
1662
+ if(this._segmentDefaultCollapsing !== bool) {
1663
+ this._segmentDefaultCollapsing = bool;
1664
+ if(this._segments) {
1665
+ this._segments.setDefaultCollapsing(bool);
1666
+ }
1667
+ return true;
1668
+ }
1669
+ return false;
1670
+ };
1671
+
1672
+
1673
+ /**
1674
+ * @public
1675
+ * @ignore
1676
+ * @param {Array.<Array>} sortingDefs
1677
+ * @return {boolean} Return true if there is any change, otherwise false
1678
+ */
1679
+ DataTable.prototype._sort = function(sortingDefs) {
1680
+ let rids = this._rids;
1681
+ let dataRows = this.getMultipleRowData(rids);
1682
+ let segmentValues = this.getSegmentValues(rids);
1683
+ let change = DataTable._performMultiLevelSorting(dataRows, sortingDefs, segmentValues);
1684
+
1685
+ if(change) {
1686
+ this._rids = DataTable._reorderItems(rids, change);
1687
+ return true;
1688
+ }
1689
+ return false;
1690
+ };
1691
+
1692
+ /** Simulate data changed event by firing global change event argument to all listeners<br>
1693
+ * Normally this will force data view to do sorting, filtering, and grouping again
1694
+ * @public
1695
+ * @param {boolean=} suppressEvent
1696
+ * @fires DataTable#dataComposed
1697
+ * @fires DataTable#dataChanged
1698
+ */
1699
+ DataTable.prototype.dispatchGlobalChange = function(suppressEvent) {
1700
+ if(!suppressEvent && this._needFiring()) {
1701
+ this._dispatchDataChange(DataTable._globalChangeArg);
1702
+ }
1703
+ };
1704
+ /** Position change will not cause dataComposed to be fired
1705
+ * @private
1706
+ * @param {boolean=} suppressEvent
1707
+ * @fires DataTable#dataChanged
1708
+ */
1709
+ DataTable.prototype._dispatchPositionChange = function(suppressEvent) {
1710
+ if(!suppressEvent && this._needFiring()) {
1711
+ this._dispatch("dataChanged", DataTable._positionChangeArg);
1712
+ }
1713
+ };
1714
+
1715
+ /** {@link DataCache#dump} Construct a JSON object that is compatible with console.table()
1716
+ * @override
1717
+ * @param {Object=} opt_options {@link DataCache#dump}
1718
+ * @return {!Array.<Object>} Return a JSON object that is compatible with console.table()
1719
+ * @see {@link DataCache#dump}
1720
+ */
1721
+ DataTable.prototype.dump = function(opt_options) {
1722
+ return DataCache.constructTable(this.getMultipleRowData(this._rids), opt_options, this._rids);
1723
+ };
1724
+
1725
+
1726
+ /** @private
1727
+ * @param {string} rid
1728
+ * @param {string} cid
1729
+ * @param {*} value
1730
+ * @return {boolean} Return true if there is any change, and false otherwise
1731
+ */
1732
+ DataTable.prototype._setData = function(rid, cid, value) {
1733
+ let row = this.getRowData(rid);
1734
+
1735
+ if(!row) {
1736
+ row = {};
1737
+ this._rows[rid] = row;
1738
+ this._prevData[rid] = {};
1739
+ this._rids.push(rid);
1740
+ }
1741
+ this._prevData[rid][cid] = row[cid];
1742
+ row[cid] = value;
1743
+ return true;
1744
+ };
1745
+ /** @private
1746
+ * @param {number} len
1747
+ * @param {Array.<string>=} opt_ridList
1748
+ * @returns {Array.<string>}
1749
+ */
1750
+ DataTable.prototype._generateRids = function(len, opt_ridList) {
1751
+ let r = 0, rids;
1752
+ if(opt_ridList) {
1753
+ rids = opt_ridList;
1754
+ } else {
1755
+ rids = [];
1756
+ let rowCount = this._rids.length;
1757
+ while(r < rowCount && r < len) {
1758
+ rids.push(this._rids[r++]);
1759
+ }
1760
+ }
1761
+ r = rids.length;
1762
+ while(r < len) {
1763
+ rids.push("" + r++); // Auto-generate row id
1764
+ }
1765
+ return rids;
1766
+ };
1767
+ /** @private
1768
+ * @param {Object} values
1769
+ * @param {string|null=} rid
1770
+ * @return {string}
1771
+ */
1772
+ DataTable.prototype._generateUniqueRid = function(values, rid) {
1773
+ if(!rid) {
1774
+ if(values["ROW_ID"]) {
1775
+ return values["ROW_ID"];
1776
+ }
1777
+ rid = "_" + this._runningId++;
1778
+ while(this._rows[rid]) {
1779
+ rid = "_" + this._runningId++;
1780
+ }
1781
+ }
1782
+ return rid;
1783
+ };
1784
+
1785
+ /** @private
1786
+ * @return {boolean}
1787
+ */
1788
+ DataTable.prototype._needFiring = function() {
1789
+ return !this._frozen && !this._composing;
1790
+ };
1791
+
1792
+ /** Deprecated
1793
+ * @deprecated
1794
+ * @public
1795
+ * @function
1796
+ */
1797
+ DataTable.getSortingDefinitions = Util._deprecatedFunction;
1798
+ /** @public
1799
+ * @const
1800
+ * @ignore
1801
+ * @type {!Object}
1802
+ */
1803
+ DataTable._globalChangeArg = {"globalChange": true};
1804
+ /** @public
1805
+ * @const
1806
+ * @ignore
1807
+ * @type {!Object}
1808
+ */
1809
+ DataTable._positionChangeArg = {"globalChange": true, "positionChangeOnly": true};
1810
+
1811
+
1812
+ /**
1813
+ * @function
1814
+ * @public
1815
+ * @ignore
1816
+ * @param {!Array.<Array>} out_defs Output object. Array is used to optimize property accessing time.
1817
+ * @param {string|Array.<string>} cids
1818
+ * @param {string|number|Array.<string|number>=} sortOrders
1819
+ * @param {Function|Array.<Function>|Object.<string, DataTable.SortLogic>=} logics
1820
+ * @param {*=} contextObj Context object that will be provided as the forth parameter of the given comparer method
1821
+ * @return {!Array.<Array>}
1822
+ */
1823
+ DataTable._buildSortContext = function(out_defs, cids, sortOrders, logics, contextObj) {
1824
+ let aryColumnIds, aryOrders;
1825
+ if(Array.isArray(cids)) {
1826
+ aryColumnIds = /** @type{Array.<string>} */(cids);
1827
+ aryOrders = /** @type{Array.<string|number>} */(sortOrders);
1828
+ } else {
1829
+ aryColumnIds = [/** @type{string} */(cids)];
1830
+ aryOrders = (cids) ? [/** @type{string|number} */(sortOrders)] : [0];
1831
+ }
1832
+
1833
+ let logic = null;
1834
+ let logicMap = null;
1835
+ if(typeof logics == "function") {
1836
+ logic = logics;
1837
+ } else {
1838
+ logicMap = /** @type{Array.<Function>|Object.<string, DataTable.SortLogic>} */(logics);
1839
+ }
1840
+ let len = aryColumnIds.length;
1841
+ out_defs.length = len;
1842
+ for(let c = len; --c >= 0;) {
1843
+ if (Array.isArray(logicMap)) {
1844
+ logic = logicMap[c];
1845
+ }
1846
+ let sortingDef = out_defs[c];
1847
+ if(!sortingDef) {
1848
+ sortingDef = out_defs[c] = new Array(5);
1849
+ }
1850
+ let columnId = aryColumnIds[c];
1851
+ sortingDef[0] = columnId; // text field
1852
+ sortingDef[1] = null; // Reserved for row data
1853
+ sortingDef[2] = logic || logicMap[columnId] || logicMap["_default"]; // sort logic
1854
+ if(!sortingDef[2]) {
1855
+ sortingDef[2] = DataTable._defaultComparer;
1856
+ }
1857
+ sortingDef[3] = DataTable._getSortOrder(aryOrders[c]); // sort order
1858
+ sortingDef[4] = contextObj;
1859
+ }
1860
+ return out_defs;
1861
+ };
1862
+ /** Performance is extremely vital in this method
1863
+ * @public
1864
+ * @ignore
1865
+ * @function
1866
+ * @param {number} a
1867
+ * @param {number} b
1868
+ * @param {number} order Not used by in this method
1869
+ * @param {Array.<Array>} sortingDefs
1870
+ * @return {number}
1871
+ */
1872
+ DataTable._multiColumnCompareLogic = function(a, b, order, sortingDefs) {
1873
+ let count = sortingDefs.length;
1874
+ let result = 0;
1875
+ for(let c = 0; c < count; ++c) {
1876
+ let sortingDef = sortingDefs[c];
1877
+ result = DataTable._singleColumnCompareLogic(a, b, sortingDef[3], sortingDef);
1878
+ if(result) {
1879
+ return result;
1880
+ }
1881
+ }
1882
+ return result;
1883
+ };
1884
+ /** Performance is extremely vital in this method
1885
+ * @public
1886
+ * @ignore
1887
+ * @function
1888
+ * @param {number} a
1889
+ * @param {number} b
1890
+ * @param {number} order
1891
+ * @param {Array} sortingDef
1892
+ * @return {number}
1893
+ */
1894
+ DataTable._singleColumnCompareLogic = function(a, b, order, sortingDef) {
1895
+ let values = /** @type{Array} */(sortingDef[1]);
1896
+ return /** @type{number} */(sortingDef[2](
1897
+ values[a], // Value1
1898
+ values[b], // Value2
1899
+ order, // Sort order (3)
1900
+ sortingDef[4] // Context object
1901
+ ));
1902
+ };
1903
+ /** Performance is extremely vital in this method
1904
+ * @public
1905
+ * @ignore
1906
+ * @function
1907
+ * @param {*} a
1908
+ * @param {*} b
1909
+ * @param {number} order Not used by in this method
1910
+ * @param {Array.<Array>} sortingDefs
1911
+ * @return {number}
1912
+ */
1913
+ DataTable._multiColumnSeparatorCompareLogic = function(a, b, order, sortingDefs) {
1914
+ let count = sortingDefs.length;
1915
+ let result = 0;
1916
+ for(let c = 0; c < count; ++c) {
1917
+ let sortingDef = sortingDefs[c];
1918
+ result = DataTable._singleColumnSeparatorCompareLogic(a, b, sortingDef[3], sortingDef);
1919
+ if(result) {
1920
+ return result;
1921
+ }
1922
+ }
1923
+ return result;
1924
+ };
1925
+ /** Performance is extremely vital in this method
1926
+ * @public
1927
+ * @ignore
1928
+ * @function
1929
+ * @param {*} a
1930
+ * @param {*} b
1931
+ * @param {number} order
1932
+ * @param {Array} sortingDef
1933
+ * @return {number}
1934
+ */
1935
+ DataTable._singleColumnSeparatorCompareLogic = function(a, b, order, sortingDef) {
1936
+ let key = /** @type{string} */(sortingDef[0]);
1937
+ return /** @type{number} */(sortingDef[2](
1938
+ a[key], // Value1
1939
+ b[key], // Value2
1940
+ order, // Sort order (3)
1941
+ sortingDef[4] // Context object
1942
+ ));
1943
+ };
1944
+ /** @public
1945
+ * @function
1946
+ * @ignore
1947
+ * @param {!Array.<Object>} dataRows
1948
+ * @param {Array.<Array>} sortingDefs
1949
+ * @param {Array.<number>=} segmentValues
1950
+ * @return {Array.<number>} Returns new item positions if there is any change, otherwise returns null
1951
+ */
1952
+ DataTable._performMultiLevelSorting = function(dataRows, sortingDefs, segmentValues) {
1953
+ let rowCount = dataRows ? dataRows.length : 0;
1954
+ let defCount = sortingDefs ? sortingDefs.length : 0;
1955
+ if(!rowCount) {
1956
+ return null;
1957
+ }
1958
+
1959
+ let sortLogic;
1960
+ // Populate data for each definition
1961
+ for(let c = 0; c < defCount; ++c) {
1962
+ let sortingDef = sortingDefs[c];
1963
+ let rows = sortingDef[1];
1964
+ sortLogic = sortingDef[2];
1965
+ let rowSorting = sortLogic["rowSorting"];
1966
+ let r;
1967
+ if(rowSorting) {
1968
+ if(rows) {
1969
+ rows.length = rowCount;
1970
+ for(r = 0; r < rowCount; ++r) {
1971
+ rows[r] = dataRows[r];
1972
+ }
1973
+ } else {
1974
+ rows = sortingDef[1] = dataRows;
1975
+ }
1976
+ } else {
1977
+ if(rows) {
1978
+ rows.length = rowCount;
1979
+ } else {
1980
+ rows = sortingDef[1] = new Array(rowCount);
1981
+ }
1982
+ let columnId = sortingDef[0];
1983
+ for(r = 0; r < rowCount; ++r) {
1984
+ rows[r] = dataRows[r][columnId];
1985
+ }
1986
+ }
1987
+ }
1988
+
1989
+ if(segmentValues) {
1990
+ let segmentDef = [ // TODO: Make this static variable
1991
+ "ROW_SEGMENT", // Dummy column id
1992
+ segmentValues, // Segment values
1993
+ DataTable._segmentComparer,
1994
+ 1, // Ascending order
1995
+ null // Context object
1996
+ ];
1997
+ if(sortingDefs) {
1998
+ sortingDefs = sortingDefs.slice();
1999
+ sortingDefs.unshift(segmentDef);
2000
+ } else {
2001
+ sortingDefs = [segmentDef];
2002
+ }
2003
+ ++defCount;
2004
+ }
2005
+
2006
+ if(!defCount) {
2007
+ return null;
2008
+ }
2009
+
2010
+ let sortOrder = 0;
2011
+ let sortContext;
2012
+ if(defCount > 1) {
2013
+ sortLogic = DataTable._multiColumnCompareLogic;
2014
+ sortContext = sortingDefs;
2015
+ sortOrder = 1; // sortOrder is not used by _multiColumnCompareLogic
2016
+ } else { // Single level sorting
2017
+ sortLogic = DataTable._singleColumnCompareLogic;
2018
+ sortContext = sortingDefs[0];
2019
+ sortOrder = /** @type{number} */(sortContext[3]);
2020
+ }
2021
+
2022
+ return DataTable._mergeSort(rowCount, sortOrder, sortLogic, sortContext);
2023
+ };
2024
+ /**
2025
+ * @function
2026
+ * @public
2027
+ * @ignore
2028
+ * @param {number} len Length of array item
2029
+ * @param {number} order
2030
+ * @param {DataTable.SortLogic} comparer
2031
+ * @param {*=} contextObj Context object that will be provided as the forth parameter of the given comparer method
2032
+ * @return {Array.<number>} Returns new item positions if there is any change, otherwise returns null
2033
+ */
2034
+ DataTable._mergeSort = function(len, order, comparer, contextObj) {
2035
+ let change = false;
2036
+
2037
+ let grpSize = 1;
2038
+ let iter, lhsFrom, rhsFrom, lhsTo, rhsTo;
2039
+ let subj = DataTable._createIndexArray(len);
2040
+ let obj = subj.slice();
2041
+
2042
+ while(grpSize <= len) {
2043
+ iter = rhsTo = 0; // start from 0
2044
+ while(iter < len) {
2045
+ lhsFrom = rhsTo;
2046
+ lhsTo = lhsFrom + grpSize;
2047
+ rhsFrom = lhsTo;
2048
+ rhsTo = rhsFrom + grpSize;
2049
+ if(rhsTo > len) rhsTo = len;
2050
+
2051
+ if(rhsFrom < rhsTo) {
2052
+ while(true) { // Merge two groups together
2053
+ if(comparer(subj[lhsFrom], subj[rhsFrom], order, contextObj) <= 0) {
2054
+ obj[iter++] = subj[lhsFrom];
2055
+ if(++lhsFrom >= lhsTo) {
2056
+ while(rhsFrom < rhsTo) {
2057
+ obj[iter++] = subj[rhsFrom];
2058
+ ++rhsFrom;
2059
+ }
2060
+ break;
2061
+ }
2062
+ } else {
2063
+ change = true;
2064
+ obj[iter++] = subj[rhsFrom];
2065
+ if(++rhsFrom >= rhsTo) {
2066
+ while(lhsFrom < lhsTo) {
2067
+ obj[iter++] = subj[lhsFrom];
2068
+ ++lhsFrom;
2069
+ }
2070
+ break;
2071
+ }
2072
+ }
2073
+ }
2074
+ } else {
2075
+ while(iter < len) {
2076
+ obj[iter] = subj[iter];
2077
+ ++iter;
2078
+ }
2079
+ }
2080
+ }
2081
+
2082
+ let tmp = subj;
2083
+ subj = obj;
2084
+ obj = tmp;
2085
+ grpSize <<= 1;
2086
+ }
2087
+ return change ? subj : null;
2088
+ };
2089
+ /** reorderItems(["a", "b", "c", "d"], [1, 3, 0, 2]) === ["b", "d", "a", "c"]; (Move the first item to where its corresponding index is) <br>
2090
+ * Not in-place reordering. Orders array will become the results
2091
+ * @function
2092
+ * @public
2093
+ * @ignore
2094
+ * @param {!Array} ary
2095
+ * @param {Array} orders
2096
+ * @return {!Array}
2097
+ */
2098
+ DataTable._reorderItems = function (ary, orders) {
2099
+ if(orders) {
2100
+ for(let i = ary.length; --i >= 0;) {
2101
+ orders[i] = ary[orders[i]];
2102
+ }
2103
+ return orders;
2104
+ }
2105
+ return ary;
2106
+ };
2107
+ /** Create array of incremental series starting from 0 (e.g. [0, 1, 2, 3, ...])
2108
+ * @private
2109
+ * @function
2110
+ * @ignore
2111
+ * @param {number} len Length of the generated array
2112
+ * @return {!Array.<number>}
2113
+ */
2114
+ DataTable._createIndexArray = function(len) {
2115
+ let ary = DataTable._idxAryMap[len];
2116
+ if(!ary) {
2117
+ if(DataTable._idxAryCount > 50) { // Clear cache to avoid caching huge memory
2118
+ DataTable._idxAryMap = {};
2119
+ DataTable._idxAryCount = 0;
2120
+ }
2121
+ ary = DataTable._idxAryMap[len] = new Array(len);
2122
+ DataTable._idxAryCount++;
2123
+
2124
+ for(let i = 0; i < len; ++i) {
2125
+ ary[i] = i;
2126
+ }
2127
+ }
2128
+ return ary.slice(); // Fastest way to clone an array is to perform slice() method
2129
+ };
2130
+ /** Remove _idxAryMap and _idAryCount
2131
+ * @private
2132
+ */
2133
+ DataTable._removeIndexArray = function() {
2134
+ DataTable._idxAryMap = {};
2135
+ DataTable._idxAryCount = 0;
2136
+ };
2137
+ /** @private
2138
+ * @type {Object.<number, Array.<number>>}
2139
+ */
2140
+ DataTable._idxAryMap = {};
2141
+ /** @private
2142
+ * @type {number}
2143
+ */
2144
+ DataTable._idxAryCount = 0;
2145
+
2146
+ /** @private
2147
+ * @function
2148
+ * @param {number} a
2149
+ * @param {number} b
2150
+ * @return {number}
2151
+ */
2152
+ DataTable._segmentComparer = function(a, b) {
2153
+ if(a === b) {
2154
+ return 0;
2155
+ }
2156
+ return (a < b) ? -1 : 1;
2157
+ };
2158
+ /** @private
2159
+ * @function
2160
+ * @param {*} a
2161
+ * @param {*} b
2162
+ * @param {number} order
2163
+ * @return {number}
2164
+ */
2165
+ DataTable._defaultComparer = function(a, b, order) { // User data may contain invalid value such as undefined or null
2166
+ if(a == null || a !== a) {
2167
+ if(b == null || b !== b) {
2168
+ return 0;
2169
+ }
2170
+ return 1;
2171
+ }
2172
+ if(b == null || b !== b) {
2173
+ return -1;
2174
+ }
2175
+
2176
+ if(a < b) {
2177
+ return -order;
2178
+ }
2179
+ if(b < a) {
2180
+ return order;
2181
+ }
2182
+ return 0;
2183
+ };
2184
+ /** @private
2185
+ * @function
2186
+ * @param {string|number=} sortOrder
2187
+ * @returns {number}
2188
+ */
2189
+ DataTable._getSortOrder = function(sortOrder) {
2190
+ if(typeof sortOrder === "number") {
2191
+ return sortOrder;
2192
+ } else if(sortOrder && typeof sortOrder === "string") {
2193
+ sortOrder = sortOrder.charAt(0).toLowerCase();
2194
+ if(sortOrder === "a") {
2195
+ return 1;
2196
+ } else if(sortOrder === "d") {
2197
+ return -1;
2198
+ }
2199
+ }
2200
+ return 0;
2201
+ };
2202
+
2203
+ DataTable._proto = DataTable.prototype;
2204
+
2205
+ export default DataTable;
2206
+ export { DataTable };