@refinitiv-ui/efx-grid 6.0.4 → 6.0.6

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 (277) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.d.ts +13 -11
  2. package/lib/column-dragging/es6/ColumnDragging.js +21 -15
  3. package/lib/column-format-dialog/lib/column-format-dialog.d.ts +1 -1
  4. package/lib/column-format-dialog/lib/column-format-dialog.js +3 -4
  5. package/lib/column-format-dialog/lib/preview-table.js +3 -4
  6. package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +2 -2
  7. package/lib/column-selection-dialog/lib/column-selection-dialog.js +23 -7
  8. package/lib/core/dist/core.css +1 -1
  9. package/lib/core/dist/core.js +392 -230
  10. package/lib/core/dist/core.min.js +1 -1
  11. package/lib/core/es6/data/ColumnStats.d.ts +3 -3
  12. package/lib/core/es6/data/DataCache.d.ts +9 -9
  13. package/lib/core/es6/data/DataTable.d.ts +28 -28
  14. package/lib/core/es6/data/DataTable.js +33 -10
  15. package/lib/core/es6/data/DataView.d.ts +62 -62
  16. package/lib/core/es6/data/DataView.js +42 -22
  17. package/lib/core/es6/data/Segment.d.ts +4 -4
  18. package/lib/core/es6/data/SegmentCollection.d.ts +7 -7
  19. package/lib/core/es6/data/WrappedView.d.ts +62 -62
  20. package/lib/core/es6/grid/Core.d.ts +97 -95
  21. package/lib/core/es6/grid/Core.js +180 -26
  22. package/lib/core/es6/grid/ILayoutGrid.d.ts +20 -20
  23. package/lib/core/es6/grid/ILayoutGrid.js +2 -1
  24. package/lib/core/es6/grid/LayoutGrid.d.ts +2 -2
  25. package/lib/core/es6/grid/LayoutGrid.js +18 -10
  26. package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +2 -2
  27. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +14 -3
  28. package/lib/core/es6/grid/components/Cell.d.ts +6 -6
  29. package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +2 -2
  30. package/lib/core/es6/grid/components/CellSpans.d.ts +2 -2
  31. package/lib/core/es6/grid/components/Column.d.ts +2 -2
  32. package/lib/core/es6/grid/components/ElementWrapper.d.ts +19 -19
  33. package/lib/core/es6/grid/components/Scrollbar.d.ts +11 -9
  34. package/lib/core/es6/grid/components/Scrollbar.js +13 -0
  35. package/lib/core/es6/grid/components/StretchedCells.js +12 -2
  36. package/lib/core/es6/grid/event/EventDispatcher.d.ts +3 -3
  37. package/lib/core/es6/grid/event/EventListeners.d.ts +5 -5
  38. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +45 -44
  39. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +62 -65
  40. package/lib/core/es6/grid/util/Conflator.d.ts +4 -4
  41. package/lib/core/es6/grid/util/HttpRequest.d.ts +3 -3
  42. package/lib/core/es6/grid/util/PercentBar.d.ts +8 -8
  43. package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +8 -8
  44. package/lib/core/es6/grid/util/RangeBar.d.ts +1 -1
  45. package/lib/core/es6/grid/util/RangeBar.js +1 -1
  46. package/lib/core/es6/grid/util/Reverter.d.ts +1 -1
  47. package/lib/core/es6/grid/util/SectionSettings.d.ts +13 -13
  48. package/lib/core/es6/grid/util/SelectionList.d.ts +2 -2
  49. package/lib/core/es6/grid/util/TrackLayout.d.ts +9 -9
  50. package/lib/core/es6/grid/util/Virtualizer.d.ts +3 -3
  51. package/lib/core/es6/grid/util/util.d.ts +6 -4
  52. package/lib/core/es6/grid/util/util.js +16 -91
  53. package/lib/core/es6/tr-grid-theme.js +1 -1
  54. package/lib/filter-dialog/lib/checkbox-list.d.ts +1 -1
  55. package/lib/filter-dialog/lib/filter-dialog.d.ts +1 -1
  56. package/lib/filter-dialog/lib/filter-dialog.js +27 -9
  57. package/lib/filter-dialog/themes/base-checkbox.less +0 -1
  58. package/lib/filter-dialog/themes/base.less +1 -1
  59. package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
  60. package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
  61. package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
  62. package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
  63. package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +2 -2
  64. package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
  65. package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
  66. package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +2 -2
  67. package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
  68. package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
  69. package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +2 -2
  70. package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
  71. package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
  72. package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +2 -2
  73. package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
  74. package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
  75. package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +2 -2
  76. package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
  77. package/lib/grid/index.js +1 -1
  78. package/lib/grid/lib/efx-grid.js +7 -44
  79. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  80. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  81. package/lib/grid/themes/halo/efx-grid.less +5 -5
  82. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  83. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  84. package/lib/row-segmenting/es6/RowSegmenting.d.ts +30 -24
  85. package/lib/row-segmenting/es6/RowSegmenting.js +122 -21
  86. package/lib/rt-grid/dist/rt-grid.js +1354 -435
  87. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  88. package/lib/rt-grid/es6/ColumnDefinition.d.ts +46 -42
  89. package/lib/rt-grid/es6/ColumnDefinition.js +31 -1
  90. package/lib/rt-grid/es6/DataConnector.d.ts +6 -4
  91. package/lib/rt-grid/es6/DataConnector.js +8 -0
  92. package/lib/rt-grid/es6/FieldDefinition.d.ts +2 -2
  93. package/lib/rt-grid/es6/FieldDefinition.js +12 -5
  94. package/lib/rt-grid/es6/Grid.d.ts +106 -91
  95. package/lib/rt-grid/es6/Grid.js +151 -106
  96. package/lib/rt-grid/es6/ReferenceCounter.d.ts +5 -5
  97. package/lib/rt-grid/es6/RowDefSorter.d.ts +2 -2
  98. package/lib/rt-grid/es6/RowDefinition.d.ts +22 -22
  99. package/lib/rt-grid/es6/RowDefinition.js +12 -5
  100. package/lib/rt-grid/es6/SnapshotFiller.d.ts +5 -2
  101. package/lib/rt-grid/es6/SnapshotFiller.js +121 -15
  102. package/lib/rt-grid/es6/StyleLoader.d.ts +1 -1
  103. package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +11 -11
  104. package/lib/tr-grid-cell-selection/es6/CellSelection.js +20 -35
  105. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +18 -16
  106. package/lib/tr-grid-checkbox/es6/Checkbox.js +1 -0
  107. package/lib/tr-grid-column-formatting/es6/ColumnFormatting.d.ts +29 -27
  108. package/lib/tr-grid-column-formatting/es6/ColumnFormatting.js +1 -0
  109. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +28 -14
  110. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +556 -11
  111. package/lib/tr-grid-column-resizing/es6/ColumnResizing.d.ts +2 -2
  112. package/lib/tr-grid-column-resizing/es6/ColumnResizing.js +1 -0
  113. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +2 -3
  114. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +15 -13
  115. package/lib/tr-grid-column-stack/es6/ColumnStack.js +96 -72
  116. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +14 -4
  117. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +314 -114
  118. package/lib/tr-grid-content-wrap/es6/ContentWrap.js +1 -6
  119. package/lib/tr-grid-contextmenu/es6/ContextMenu.js +3 -3
  120. package/lib/tr-grid-contextmenu/es6/MenuEventAPI.d.ts +2 -2
  121. package/lib/tr-grid-contextmenu/es6/MenuItem.d.ts +2 -2
  122. package/lib/tr-grid-heat-map/es6/HeatMap.d.ts +2 -1
  123. package/lib/tr-grid-heat-map/es6/HeatMap.js +6 -9
  124. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +5 -2
  125. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +311 -71
  126. package/lib/tr-grid-percent-bar/es6/PercentBar.d.ts +1 -1
  127. package/lib/tr-grid-percent-bar/es6/PercentBar.js +8 -11
  128. package/lib/tr-grid-printer/es6/SectionWriter.js +8 -0
  129. package/lib/tr-grid-range-bar/es6/RangeBar.js +3 -10
  130. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +6 -0
  131. package/lib/tr-grid-row-dragging/es6/RowDragging.js +56 -23
  132. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +4 -3
  133. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +57 -13
  134. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +1 -1
  135. package/lib/tr-grid-row-selection/es6/RowSelection.js +16 -13
  136. package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +0 -2
  137. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +1 -40
  138. package/lib/tr-grid-util/es6/CellPainter.d.ts +30 -30
  139. package/lib/tr-grid-util/es6/CellPainter.js +9 -8
  140. package/lib/tr-grid-util/es6/Conflator.d.ts +4 -4
  141. package/lib/tr-grid-util/es6/CoralItems.d.ts +1 -1
  142. package/lib/tr-grid-util/es6/DateTime.d.ts +10 -10
  143. package/lib/tr-grid-util/es6/Deferred.d.ts +3 -1
  144. package/lib/tr-grid-util/es6/Deferred.js +11 -1
  145. package/lib/tr-grid-util/es6/Delay.d.ts +2 -2
  146. package/lib/tr-grid-util/es6/Dom.d.ts +10 -10
  147. package/lib/tr-grid-util/es6/Dom.js +14 -10
  148. package/lib/tr-grid-util/es6/DragUI.js +5 -2
  149. package/lib/tr-grid-util/es6/ElementObserver.d.ts +2 -2
  150. package/lib/tr-grid-util/es6/ElementObserver.js +6 -3
  151. package/lib/tr-grid-util/es6/ElementWrapper.d.ts +4 -4
  152. package/lib/tr-grid-util/es6/ElfDate.d.ts +5 -5
  153. package/lib/tr-grid-util/es6/ElfDate.js +1 -0
  154. package/lib/tr-grid-util/es6/ElfUtil.d.ts +13 -4
  155. package/lib/tr-grid-util/es6/ElfUtil.js +178 -26
  156. package/lib/tr-grid-util/es6/EventDispatcher.d.ts +5 -5
  157. package/lib/tr-grid-util/es6/ExpanderIcon.d.ts +2 -2
  158. package/lib/tr-grid-util/es6/ExpanderIcon.js +1 -1
  159. package/lib/tr-grid-util/es6/Ext.d.ts +1 -1
  160. package/lib/tr-grid-util/es6/FieldFormatter.d.ts +12 -12
  161. package/lib/tr-grid-util/es6/FieldFormatter.js +1 -1
  162. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +13 -13
  163. package/lib/tr-grid-util/es6/FilterBuilder.js +15 -8
  164. package/lib/tr-grid-util/es6/FilterOperators.d.ts +22 -22
  165. package/lib/tr-grid-util/es6/FilterOperators.js +3 -3
  166. package/lib/tr-grid-util/es6/GridPlugin.d.ts +10 -10
  167. package/lib/tr-grid-util/es6/GridPlugin.js +20 -0
  168. package/lib/tr-grid-util/es6/Icon.d.ts +3 -3
  169. package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +8 -8
  170. package/lib/tr-grid-util/es6/MultiTableManager.d.ts +6 -6
  171. package/lib/tr-grid-util/es6/NumberFormatter.d.ts +19 -19
  172. package/lib/tr-grid-util/es6/NumberFormatter.js +1 -1
  173. package/lib/tr-grid-util/es6/PercentBar.d.ts +19 -19
  174. package/lib/tr-grid-util/es6/Perf.d.ts +4 -4
  175. package/lib/tr-grid-util/es6/Popup.d.ts +36 -33
  176. package/lib/tr-grid-util/es6/Popup.js +19 -1
  177. package/lib/tr-grid-util/es6/RangeBar.d.ts +5 -5
  178. package/lib/tr-grid-util/es6/RequestQueue.d.ts +4 -4
  179. package/lib/tr-grid-util/es6/RowPainter.d.ts +37 -4
  180. package/lib/tr-grid-util/es6/RowPainter.js +199 -76
  181. package/lib/tr-grid-util/es6/SubTable.d.ts +14 -14
  182. package/lib/tr-grid-util/es6/Table.d.ts +25 -25
  183. package/lib/tr-grid-util/es6/TextHighlighter.d.ts +1 -1
  184. package/lib/tr-grid-util/es6/Timer.d.ts +1 -1
  185. package/lib/tr-grid-util/es6/TouchProxy.d.ts +9 -9
  186. package/lib/tr-grid-util/es6/Util.d.ts +12 -12
  187. package/lib/tr-grid-util/es6/formula/ADCService.d.ts +1 -1
  188. package/lib/tr-grid-util/es6/formula/ADCSubscription.d.ts +1 -1
  189. package/lib/tr-grid-util/es6/formula/AdFinService.d.ts +1 -1
  190. package/lib/tr-grid-util/es6/formula/AdFinSubscription.d.ts +1 -1
  191. package/lib/tr-grid-util/es6/formula/Engine.d.ts +9 -9
  192. package/lib/tr-grid-util/es6/formula/Formula.d.ts +4 -4
  193. package/lib/tr-grid-util/es6/formula/IntervalSubscription.d.ts +1 -1
  194. package/lib/tr-grid-util/es6/formula/Realtime.d.ts +3 -3
  195. package/lib/tr-grid-util/es6/formula/RealtimeService.d.ts +1 -1
  196. package/lib/tr-grid-util/es6/formula/TSIService.d.ts +1 -1
  197. package/lib/tr-grid-util/es6/formula/TSISubscription.d.ts +1 -1
  198. package/lib/tr-grid-util/es6/formula/VariableToken.d.ts +1 -1
  199. package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +1 -1
  200. package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +34 -34
  201. package/lib/tr-grid-util/es6/jet/MockArchive.d.ts +1 -1
  202. package/lib/tr-grid-util/es6/jet/MockJET.d.ts +4 -4
  203. package/lib/tr-grid-util/es6/jet/MockJET.js +12 -4
  204. package/lib/tr-grid-util/es6/jet/MockQuotes.d.ts +9 -9
  205. package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +17 -9
  206. package/lib/tr-grid-util/es6/jet/MockQuotes2.js +84 -24
  207. package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +42 -2
  208. package/lib/tr-grid-util/es6/jet/MockRTK.js +55 -16
  209. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +2 -2
  210. package/lib/tr-grid-util/es6/jet/mockDataAPI.js +99 -1
  211. package/lib/types/es6/Checkbox.d.ts +18 -16
  212. package/lib/types/es6/ColumnFormatting.d.ts +29 -27
  213. package/lib/types/es6/ColumnGrouping.d.ts +28 -14
  214. package/lib/types/es6/ColumnResizing.d.ts +2 -2
  215. package/lib/types/es6/ColumnStack.d.ts +15 -13
  216. package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +4 -2
  217. package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +0 -1
  218. package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +1 -1
  219. package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +1 -1
  220. package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +1 -5
  221. package/lib/types/es6/CompositeGrid/Plugin.d.ts +3 -1
  222. package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +2 -1
  223. package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +2 -1
  224. package/lib/types/es6/CompositeGrid/TextWidthCalculator.d.ts +1 -1
  225. package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +0 -1
  226. package/lib/types/es6/ConditionalColoring.d.ts +14 -4
  227. package/lib/types/es6/Core/data/ColumnStats.d.ts +3 -3
  228. package/lib/types/es6/Core/data/DataCache.d.ts +9 -9
  229. package/lib/types/es6/Core/data/DataTable.d.ts +28 -28
  230. package/lib/types/es6/Core/data/DataView.d.ts +62 -62
  231. package/lib/types/es6/Core/data/Segment.d.ts +4 -4
  232. package/lib/types/es6/Core/data/SegmentCollection.d.ts +7 -7
  233. package/lib/types/es6/Core/data/WrappedView.d.ts +62 -62
  234. package/lib/types/es6/Core/grid/Core.d.ts +97 -95
  235. package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +20 -20
  236. package/lib/types/es6/Core/grid/LayoutGrid.d.ts +2 -2
  237. package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +2 -2
  238. package/lib/types/es6/Core/grid/components/Cell.d.ts +6 -6
  239. package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +2 -2
  240. package/lib/types/es6/Core/grid/components/CellSpans.d.ts +2 -2
  241. package/lib/types/es6/Core/grid/components/Column.d.ts +2 -2
  242. package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +19 -19
  243. package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +11 -9
  244. package/lib/types/es6/Core/grid/event/EventDispatcher.d.ts +3 -3
  245. package/lib/types/es6/Core/grid/event/EventListeners.d.ts +5 -5
  246. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +45 -44
  247. package/lib/types/es6/Core/grid/util/Conflator.d.ts +4 -4
  248. package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +3 -3
  249. package/lib/types/es6/Core/grid/util/PercentBar.d.ts +8 -8
  250. package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +8 -8
  251. package/lib/types/es6/Core/grid/util/RangeBar.d.ts +1 -1
  252. package/lib/types/es6/Core/grid/util/Reverter.d.ts +1 -1
  253. package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +13 -13
  254. package/lib/types/es6/Core/grid/util/SelectionList.d.ts +2 -2
  255. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +9 -9
  256. package/lib/types/es6/Core/grid/util/Virtualizer.d.ts +3 -3
  257. package/lib/types/es6/Core/grid/util/util.d.ts +6 -4
  258. package/lib/types/es6/HeatMap.d.ts +2 -1
  259. package/lib/types/es6/InCellEditing.d.ts +5 -2
  260. package/lib/types/es6/MenuEventAPI.d.ts +2 -2
  261. package/lib/types/es6/MenuItem.d.ts +2 -2
  262. package/lib/types/es6/PercentBar.d.ts +1 -1
  263. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +46 -42
  264. package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +6 -4
  265. package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +2 -2
  266. package/lib/types/es6/RealtimeGrid/Grid.d.ts +104 -89
  267. package/lib/types/es6/RealtimeGrid/ReferenceCounter.d.ts +5 -5
  268. package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +2 -2
  269. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +22 -22
  270. package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +5 -2
  271. package/lib/types/es6/RealtimeGrid/StyleLoader.d.ts +1 -1
  272. package/lib/types/es6/RowColoring.d.ts +0 -2
  273. package/lib/types/es6/RowDragging.d.ts +6 -0
  274. package/lib/types/es6/RowFiltering.d.ts +4 -3
  275. package/lib/types/es6/RowSegmenting.d.ts +30 -24
  276. package/lib/versions.json +26 -26
  277. package/package.json +2 -2
@@ -1204,7 +1204,15 @@ Formula.toUpperCase = function(exp) {
1204
1204
  exp = exp.toUpperCase(); // Upper case the remaining
1205
1205
 
1206
1206
  // May have the new string token from ADC field with parameter
1207
- exp = exp.replace(/TR\.[\w_ ]+\([^\(\)]*\)(\.[a-zA-Z]+)*/g, Formula._encloseWithTR);
1207
+ // Regex for adc fileds
1208
+ // TR : start with tr
1209
+ // (\.[\w]+)+ : dot follow by any character at least 1
1210
+ // \( : start parentheses
1211
+ // [^\(\)]* : any except parentheses
1212
+ // \) : end parentheses
1213
+ // (\.[a-zA-Z]+)* : dot follow by any character (optional)
1214
+
1215
+ exp = exp.replace(/TR(\.[\w ]+)+\([^\(\)]*\)(\.[a-zA-Z]+)*/g, Formula._encloseWithTR);
1208
1216
 
1209
1217
  exp = Formula.resolveTokens(exp, tokens, calcHierarchy); // Restore the string
1210
1218
 
@@ -2384,7 +2392,7 @@ Dom.getRelativePosition = function(A, B, retObj) {
2384
2392
  retObj["y"] -= bp["y"];
2385
2393
  return /**@type {!Object} */(retObj);
2386
2394
  };
2387
- /** Return closest ancestor element or the element itself with specified class string. Otherwise return null
2395
+ /** The method returns closest ancestor element or the element itself with specified class string. Otherwise, it returns null
2388
2396
  * @public
2389
2397
  * @function
2390
2398
  * @param {Element|Node|undefined} elem
@@ -2393,15 +2401,17 @@ Dom.getRelativePosition = function(A, B, retObj) {
2393
2401
  */
2394
2402
  Dom.closestElement = function(elem, classStr) {
2395
2403
  var n = elem;
2396
- while(n && n.classList) {
2397
- if(n.classList.contains(classStr)) {
2398
- return /** @type{Element} */(n);
2404
+ while (n) {
2405
+ if(n.classList) { // DocumentFragment does not have classList property
2406
+ if (n.classList.contains(classStr)) {
2407
+ return /** @type{Element} */(n);
2408
+ }
2399
2409
  }
2400
- n = n.parentNode;
2410
+ n = n.parentNode || n.host; // ShadowRoot has host, but not parentNode
2401
2411
  }
2402
2412
  return null;
2403
2413
  };
2404
- /** Return closest ancestor element or the element itself with the specified tagName. Otherwise return null
2414
+ /** The method returns closest ancestor element or the element itself with the specified tagName. Otherwise, it returns null
2405
2415
  * @public
2406
2416
  * @function
2407
2417
  * @param {Element|Node|undefined} elem
@@ -2410,11 +2420,13 @@ Dom.closestElement = function(elem, classStr) {
2410
2420
  */
2411
2421
  Dom.closestTagName = function(elem, tn) {
2412
2422
  var n = elem;
2413
- while(n && n.tagName) {
2414
- if(n.tagName == tn) {
2415
- return /** @type{Element} */(n);
2423
+ while(n) {
2424
+ if(n.tagName) {
2425
+ if(n.tagName == tn) {
2426
+ return /** @type{Element} */(n);
2427
+ }
2416
2428
  }
2417
- n = n.parentNode;
2429
+ n = n.parentNode || n.host; // ShadowRoot has host, but not parentNode
2418
2430
  }
2419
2431
  return null;
2420
2432
  };
@@ -2971,7 +2983,10 @@ Deferred.prototype._rejectHandler = null;
2971
2983
  * @private
2972
2984
  */
2973
2985
  Deferred.prototype._ctx = null;
2974
-
2986
+ /** @type {boolean}
2987
+ * @private
2988
+ */
2989
+ Deferred.prototype._fulfilled = false;
2975
2990
 
2976
2991
  /** @public
2977
2992
  * @param {*=} result
@@ -3003,10 +3018,17 @@ Deferred.prototype.reject = function(result) {
3003
3018
  this._finally();
3004
3019
  }
3005
3020
  };
3021
+ /** @public
3022
+ * @return {boolean}
3023
+ */
3024
+ Deferred.prototype.isFulfilled = function() {
3025
+ return this._fulfilled;
3026
+ };
3006
3027
 
3007
3028
  /** @private */
3008
3029
  Deferred.prototype._finally = function() {
3009
3030
  // Release all references to avoid memory leak
3031
+ this._fulfilled = true;
3010
3032
  this._ctx = this._resolveHandler = this._rejectHandler = null;
3011
3033
  this._resolve = this._reject = null;
3012
3034
  };
@@ -3014,10 +3036,144 @@ Deferred.prototype._finally = function() {
3014
3036
  /* harmony default export */ var es6_Deferred = (Deferred);
3015
3037
 
3016
3038
 
3039
+ // CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/ElementObserver.js
3040
+
3041
+ /** @namespace
3042
+ */
3043
+ var ElementObserver = {};
3044
+
3045
+ /** @private
3046
+ * @param {Element} elem
3047
+ * @param {MutationRecord} mutation
3048
+ */
3049
+ var _onLanguageMutated = function (elem, mutation) {
3050
+ if (mutation.type == "attributes" && mutation.attributeName == "lang") {
3051
+ elem.lang = mutation.target.lang || "en";
3052
+ }
3053
+ };
3054
+
3055
+ /** @private
3056
+ * @param {Function} listener
3057
+ * @param {string=} attributeName
3058
+ * @param {MutationRecord} mutation
3059
+ */
3060
+ var _onAttributeMutated = function (listener, attributeName, mutation) {
3061
+ if (mutation.type === "attributes") {
3062
+ if (attributeName != null) {
3063
+ if (mutation.attributeName === attributeName) {
3064
+ listener(mutation.target.getAttribute(attributeName));
3065
+ }
3066
+ } else {
3067
+ listener(mutation.target);
3068
+ }
3069
+ }
3070
+ };
3071
+
3072
+ /** @private
3073
+ * @return {string}
3074
+ */
3075
+ ElementObserver._getNewId = function () {
3076
+ var id = "observer_" + (++ElementObserver._id);
3077
+ return id;
3078
+ };
3079
+
3080
+ /** @private Observe any element
3081
+ * @param {Element} elem
3082
+ * @param {Function} listener
3083
+ * @param {Object=} opt_option
3084
+ */
3085
+ ElementObserver._addObserver = function(elem, listener, opt_option) {
3086
+ var option = opt_option;
3087
+ if (!option) {
3088
+ option = {};
3089
+ }
3090
+ option.attributes = true; //configure it to listen to attribute changes
3091
+
3092
+ ElementObserver._observer.observe(elem, option);
3093
+ ElementObserver._addListener(elem, listener);
3094
+ };
3095
+
3096
+ /** @private
3097
+ * @param {Array.<MutationRecord>} mutations
3098
+ */
3099
+ ElementObserver._onMutationCallback = function(mutations) {
3100
+ for (var i = 0; i < mutations.length; i++) {
3101
+ var mutation = mutations[i];
3102
+ var listeners = ElementObserver._listeners[mutation.target._observeId];
3103
+ for (var j = 0; j < listeners.length; j++) {
3104
+ listeners[j](mutation);
3105
+ }
3106
+ }
3107
+ };
3108
+
3109
+ /** @private
3110
+ * @param {Element} elem
3111
+ * @param {Function} fn
3112
+ */
3113
+ ElementObserver._addListener = function(elem, fn) {
3114
+ var listeners = ElementObserver._listeners;
3115
+ if (!listeners) {
3116
+ listeners = ElementObserver._listeners = {};
3117
+ }
3118
+ if (!elem._observeId) {
3119
+ var id = ElementObserver._getNewId();
3120
+ elem._observeId = id;
3121
+ }
3122
+ if (!listeners[elem._observeId]) { // Always check to support the using of separated ElfUtil module in testing page
3123
+ listeners[elem._observeId] = [];
3124
+ }
3125
+
3126
+ var listener = listeners[elem._observeId];
3127
+ if (listener.indexOf(fn) < 0) {
3128
+ listener.push(fn);
3129
+ }
3130
+ };
3131
+
3132
+ /** @public Add a listener to a html lang attribute
3133
+ * @param {Element} element An element within the DOM tree to watch for changes
3134
+ */
3135
+ ElementObserver.addLanguageListener = function(element) {
3136
+ if (!element) { return; }
3137
+
3138
+ element.lang = document.documentElement.lang || "en";
3139
+
3140
+ ElementObserver._addObserver(document.documentElement, _onLanguageMutated.bind(null, element));
3141
+ };
3142
+
3143
+ /** @public Add a listener to a html attribute
3144
+ * @param {Element} element An element within the DOM tree to watch for changes
3145
+ * @param {Function} listener A function which will be called on each attribute change
3146
+ * @param {string=} attributeName If not specified, listener will be called on every attribute change
3147
+ */
3148
+ ElementObserver.addAttributeListener = function(element, listener, attributeName) {
3149
+ if (!element || !listener) { return; }
3150
+ ElementObserver._addObserver(element, _onAttributeMutated.bind(null, listener, attributeName));
3151
+ };
3152
+
3153
+ /**
3154
+ * @type {MutationObserver}
3155
+ * @private
3156
+ */
3157
+ ElementObserver._observer = new MutationObserver(ElementObserver._onMutationCallback);
3158
+ /**
3159
+ * @type {Obect}
3160
+ * @private
3161
+ */
3162
+ ElementObserver._listeners = {};
3163
+ /**
3164
+ * @type {number}
3165
+ * @private
3166
+ */
3167
+ ElementObserver._id = 0;
3168
+
3169
+ /* harmony default export */ var es6_ElementObserver = (ElementObserver);
3170
+
3171
+
3017
3172
  // CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/ElfUtil.js
3018
3173
 
3019
3174
 
3020
3175
 
3176
+
3021
3177
  /** Dialog supporting language (selection dialog, formater dialog and filter dialog)
3022
3178
  * @type {!Object.<string, boolean>}
3023
3179
  * @private
@@ -3080,6 +3236,26 @@ ElfUtil._dummyIcon = null;
3080
3236
  * @private
3081
3237
  */
3082
3238
  ElfUtil._iconLoaded = false;
3239
+ /** @type {string|null}
3240
+ * @private
3241
+ */
3242
+ ElfUtil._profileName = null;
3243
+ /** @type {Array}
3244
+ * @private
3245
+ */
3246
+ ElfUtil._callbacks = [];
3247
+ /** @type {boolean}
3248
+ * @private
3249
+ */
3250
+ ElfUtil._observed = false;
3251
+ /** @type {boolean}
3252
+ * @private
3253
+ */
3254
+ ElfUtil._pendingResolve = false;
3255
+ /** @type {boolean}
3256
+ * @private
3257
+ */
3258
+ ElfUtil._themeLoaded = false;
3083
3259
 
3084
3260
  /** @type {Object.<string, Object>}
3085
3261
  * @private
@@ -3228,6 +3404,32 @@ ElfUtil.getThemeName = function (optElem) {
3228
3404
  return ElfUtil._themeName;
3229
3405
  };
3230
3406
 
3407
+ /** This method is using for unit test
3408
+ * @public
3409
+ * @ignore
3410
+ * @function
3411
+ * @param {string} themeName
3412
+ */
3413
+ ElfUtil.setThemeName = function (themeName) {
3414
+ ElfUtil._themeName = themeName;
3415
+ };
3416
+
3417
+ /** @public
3418
+ * @function
3419
+ * @return {boolean}
3420
+ */
3421
+ ElfUtil.isThemeLoaded = function () {
3422
+ return ElfUtil._themeLoaded;
3423
+ };
3424
+
3425
+ /** @public
3426
+ * @function
3427
+ * @return {Object}
3428
+ */
3429
+ ElfUtil.getColors = function() {
3430
+ return ElfUtil.themeColors;
3431
+ };
3432
+
3231
3433
  /** Check the current ELF theme is Halo theme
3232
3434
  * @public
3233
3435
  * @function
@@ -3351,57 +3553,165 @@ ElfUtil.getCssVariables = function (obj, optElem) {
3351
3553
  return obj || null;
3352
3554
  };
3353
3555
 
3556
+ /** @public
3557
+ * @param {Object} rtk
3558
+ */
3559
+ ElfUtil.setRTK = function(rtk) {
3560
+ if(rtk != null) {
3561
+ ElfUtil._rtk = rtk;
3562
+ }
3563
+ };
3564
+
3565
+ /** Get current profile name set on the root html element (document.documentElement)
3566
+ * @public
3567
+ * @return {string} Current profile name
3568
+ */
3569
+ ElfUtil.getMovementColorProfile = function() {
3570
+ return document.documentElement.getAttribute("movement-color-profile");
3571
+ };
3572
+
3573
+ /** @private
3574
+ * @param {Function} cb
3575
+ */
3576
+ ElfUtil._addThemeChangedCallback = function(cb) {
3577
+ var callbacks = ElfUtil._callbacks;
3578
+ if(callbacks.indexOf(cb) < 0) {
3579
+ callbacks.push(cb);
3580
+ }
3581
+ };
3582
+
3583
+ /** @public
3584
+ * @return {Promise<Object>} A promise of object of theme colors
3585
+ */
3586
+ ElfUtil.reloadThemeColors = function() {
3587
+ if (ElfUtil._deferred && ElfUtil._deferred.isFulfilled()) {
3588
+ ElfUtil._profileName = "";
3589
+ ElfUtil._themeLoaded = false;
3590
+ ElfUtil.themeReady = null;
3591
+ return ElfUtil.getThemeColors();
3592
+ } else {
3593
+ return ElfUtil.themeReady;
3594
+ }
3595
+ };
3596
+
3354
3597
  /** Gets current theme colors from the document and returns a promise. <br>
3355
- * WANRING: This method sets movement color profile to html tag automatically, if JET.Settings exists. <br>
3598
+ * WANRING: This method sets movement color profile to html tag automatically, if JET.Settings exists or RTK.Settings is available. <br>
3356
3599
  * To re-request/reset theme colors, set ElfUtil.themeReady variable to null
3357
3600
  * @public
3601
+ * @param {Function=} themeChangedCb
3358
3602
  * @return {Promise<Object>} A promise of object of theme colors
3359
3603
  */
3360
- ElfUtil.getThemeColors = function() {
3604
+ ElfUtil.getThemeColors = function(themeChangedCb) {
3605
+ if(typeof themeChangedCb === "function") {
3606
+ ElfUtil._addThemeChangedCallback(themeChangedCb);
3607
+ }
3608
+
3361
3609
  if(ElfUtil.themeReady) {
3362
3610
  return ElfUtil.themeReady;
3363
3611
  }
3612
+
3364
3613
  var d = ElfUtil._deferred = new Deferred();
3365
3614
  ElfUtil.themeReady = d.promise;
3366
3615
 
3367
- var jet = window ? window.JET : null;
3368
- if(jet && jet.Settings) {
3369
- try {
3370
- jet.Settings.read(ElfUtil._onColorProfile, {
3371
- providerName: "Configuration",
3372
- settingName: "RDE_USER_CURRENT_TICK_COLOR"
3373
- });
3374
- } catch (err) {
3375
- d.reject("Cannot read JET's settings");
3616
+ var profileName = ElfUtil.getMovementColorProfile();
3617
+ if(profileName) {
3618
+ if(profileName !== ElfUtil._profileName) {
3619
+ setTimeout(ElfUtil._profileNameRetrieved, 100); // TODO: Find a proper way to ensure that theme is ready
3620
+ } else {
3621
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
3376
3622
  }
3377
3623
  } else {
3378
- setTimeout(ElfUtil._retrieveThemeColors, 100); // TODO: Find a proper way to ensure that theme is ready
3624
+ var options = {
3625
+ providerName: "Configuration",
3626
+ settingName: "RDE_USER_CURRENT_TICK_COLOR"
3627
+ };
3628
+
3629
+ var jet = window ? window.JET : null;
3630
+ ElfUtil._themeLoaded = false;
3631
+ if(ElfUtil._rtk && ElfUtil._rtk.Settings) {
3632
+ ElfUtil._rtk.Settings.getAsync(options)
3633
+ .then(ElfUtil._loadingProfileSuccess)
3634
+ .catch(ElfUtil._loadingProfileFailure);
3635
+ } else if(jet && jet.Settings) {
3636
+ try {
3637
+ jet.Settings.read(ElfUtil._loadingProfileSuccess, options);
3638
+ } catch (err) {
3639
+ ElfUtil._loadingProfileFailure();
3640
+ }
3641
+ } else {
3642
+ setTimeout(ElfUtil._profileNameRetrieved, 100); // TODO: Find a proper way to ensure that theme is ready
3643
+ }
3379
3644
  }
3645
+
3380
3646
  return d.promise;
3381
3647
  };
3382
3648
 
3383
- /** Get user's color profile from JET and set it to html tag (document.documentElement)
3649
+ /** @private
3650
+ * @param {string} profileName
3651
+ */
3652
+ var movementColorProfileChanged = function(profileName) {
3653
+ if(profileName !== ElfUtil._profileName) {
3654
+ ElfUtil._retrieveThemeColors(profileName);
3655
+
3656
+ if(ElfUtil._pendingResolve) {
3657
+ ElfUtil._pendingResolve = false;
3658
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
3659
+ }
3660
+
3661
+ var callbacks = ElfUtil._callbacks;
3662
+ for (var i = 0; i < callbacks.length; i++) {
3663
+ callbacks[i]();
3664
+ }
3665
+ }
3666
+ };
3667
+
3668
+ /** Get user's color profile from JET or RTK and set it to html tag (document.documentElement)
3384
3669
  * @private
3385
- * @param {string} colorProfile Returned from JET.Settings
3670
+ * @param {string} profileName Returned from JET.Settings or RTK.Settings
3386
3671
  */
3387
- ElfUtil._onColorProfile = function (colorProfile) {
3388
- if(colorProfile) {
3389
- document.documentElement.setAttribute("movement-color-profile", colorProfile.toLowerCase());
3672
+ ElfUtil._loadingProfileSuccess = function(profileName) {
3673
+ if(profileName) {
3674
+ document.documentElement.setAttribute("movement-color-profile", profileName.toLowerCase());
3390
3675
  }
3676
+
3677
+ if(ElfUtil._observed) { // Let attribute listener does the job
3678
+ ElfUtil._pendingResolve = true;
3679
+ } else {
3680
+ ElfUtil._profileNameRetrieved(profileName);
3681
+ }
3682
+ };
3683
+
3684
+ /** @private
3685
+ */
3686
+ ElfUtil._loadingProfileFailure = function() {
3391
3687
  ElfUtil._retrieveThemeColors();
3688
+ if(!ElfUtil._observed) {
3689
+ ElfUtil._observed = true;
3690
+ ElementObserver.addAttributeListener(document.documentElement, movementColorProfileChanged, "movement-color-profile");
3691
+ }
3692
+ ElfUtil._deferred.reject("Failed to get movement color profile from settings.");
3392
3693
  };
3393
- /** Get current profile name set on the root html element (document.documentElement)
3394
- * @public
3395
- * @return {string} Current profile name
3694
+
3695
+ /** @private
3396
3696
  */
3397
- ElfUtil.getMovementColorProfile = function() {
3398
- return document.documentElement.getAttribute("movement-color-profile");
3697
+ ElfUtil._profileNameRetrieved = function() {
3698
+ var profileName = ElfUtil.getMovementColorProfile();
3699
+ ElfUtil._retrieveThemeColors(profileName);
3700
+ if(!ElfUtil._observed) {
3701
+ ElfUtil._observed = true;
3702
+ ElementObserver.addAttributeListener(document.documentElement, movementColorProfileChanged, "movement-color-profile");
3703
+ }
3704
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
3399
3705
  };
3400
3706
 
3401
3707
  /** Get theme colors from document
3402
3708
  * @private
3709
+ * @param {string} profileName Movement color profile name
3403
3710
  */
3404
- ElfUtil._retrieveThemeColors = function() {
3711
+ ElfUtil._retrieveThemeColors = function(profileName) {
3712
+ ElfUtil._themeLoaded = true;
3713
+ ElfUtil._profileName = profileName;
3714
+
3405
3715
  var colors = ElfUtil.themeColors = ElfUtil.getCssVariables({
3406
3716
  "primary": "--color-scheme-primary", // Usually used in headers, and selection
3407
3717
  "secondary": "--color-scheme-secondary",
@@ -3466,11 +3776,8 @@ ElfUtil._retrieveThemeColors = function() {
3466
3776
  colors["baseGrid"] = colors["tableBg"];
3467
3777
  colors["baseText"] = colors["tableText"];
3468
3778
  colors["trackColor"] = colors["primary"] || ElfUtil._defaultColors["trackColor"];
3469
-
3470
- ElfUtil._deferred.resolve(colors);
3471
3779
  };
3472
3780
 
3473
-
3474
3781
  /* harmony default export */ var es6_ElfUtil = (ElfUtil);
3475
3782
 
3476
3783
 
@@ -7650,40 +7957,6 @@ util_Util.moveArrayItem = function (ary, from, to) {
7650
7957
  }
7651
7958
  return ary;
7652
7959
  };
7653
- /** Insert an item in the given array at the specified position. If the position exceeds the array length, the array will be expanded
7654
- * @public
7655
- * @ignore
7656
- * @param {Array|*} ary
7657
- * @param {number} at INCLUSIVE
7658
- * @param {*} item
7659
- */
7660
- util_Util.insertArrayItem = function (ary, at, item) {
7661
- if (!ary) { return; }
7662
-
7663
- if (at < 0) {
7664
- return; // Negative index cannot be added
7665
- }
7666
- if (at < ary.length) {
7667
- ary.splice(at, 0, item); // any subsequence item is shifted to the right
7668
- } else {
7669
- ary[at] = item;
7670
- }
7671
- };
7672
- /** Remove the specified item from the given array
7673
- * @public
7674
- * @ignore
7675
- * @param {Array|*} ary
7676
- * @param {number} at INCLUSIVE
7677
- * @return {*} removed item. If not existed, null is returned
7678
- */
7679
- util_Util.removeArrayItem = function (ary, at) {
7680
- if (!ary) { return null; }
7681
-
7682
- if (at >= 0 && at < ary.length) {
7683
- return ary.splice(at, 1)[0];
7684
- }
7685
- return null;
7686
- };
7687
7960
  /** @public
7688
7961
  * @function
7689
7962
  * @param {Array} ary
@@ -7751,35 +8024,6 @@ util_Util.cycleArray = function (ary, numItems) {
7751
8024
  return ary || null;
7752
8025
  };
7753
8026
 
7754
- /** Correct the index when associated item is moved by the specified indices
7755
- * @public
7756
- * @ignore
7757
- * @param {number|null} num
7758
- * @param {number|null} from INCLUSIVE removed index
7759
- * @param {number|null=} opt_to INCLUSIVE added index
7760
- * @return {number} Negative if the index is removed
7761
- */
7762
- util_Util.moveIndex = function (num, from, opt_to) {
7763
- if (!util_Util.isNumber(num)) { return -1; }
7764
- if (num === from) {
7765
- if (util_Util.isNumber(opt_to)) {
7766
- return /** @type{number} */(opt_to);
7767
- }
7768
- return -1;
7769
- }
7770
- if (from !== null) {
7771
- if (num > from) {
7772
- --num;
7773
- }
7774
- }
7775
- if (opt_to !== null) {
7776
- if (num >= opt_to) {
7777
- ++num;
7778
- }
7779
- }
7780
- return /** @type{number} */(num);
7781
- };
7782
-
7783
8027
  /** STL implementation of lowerBound() of the C++ vector class with no recursion
7784
8028
  * @public
7785
8029
  * @ignore
@@ -7852,28 +8096,6 @@ util_Util.stringFormat = function (format) {
7852
8096
  util_Util._defaultLessComparator = function (left, right) {
7853
8097
  return left < right;
7854
8098
  };
7855
- /** @public
7856
- * @function
7857
- * @ignore
7858
- * @param {number} left
7859
- * @param {number} right
7860
- * @return {number}
7861
- * @example [4, 1, 2].sort(Util._numericSorter) === [1, 2, 4];
7862
- */
7863
- util_Util._numericSorter = function (left, right) {
7864
- return left - right;
7865
- };
7866
-
7867
- /** @public
7868
- * @function
7869
- * @ignore
7870
- * @param {Event} e
7871
- */
7872
- util_Util._preventDefault = function (e) {
7873
- e.preventDefault();
7874
- e.stopPropagation();
7875
- };
7876
-
7877
8099
  /**
7878
8100
  * @public
7879
8101
  * @function
@@ -7911,24 +8133,34 @@ util_Util.calculatePercent = function (lowVal, lastVal, highVal) {
7911
8133
  return percent * 100;
7912
8134
  };
7913
8135
 
7914
- /** @description Return closest ancestor element or the element itself with specified class string. Otherwise return null
8136
+ /** @description The method returns closest ancestor element or the element itself with specified class string. Otherwise, it returns null
7915
8137
  * @public
7916
8138
  * @function
7917
- * @ignore
7918
8139
  * @param {Element|Node|undefined} elem
7919
8140
  * @param {string} classStr The class string can only be one single class without spaces
7920
8141
  * @return {Element}
7921
8142
  */
7922
8143
  util_Util.closestElement = function (elem, classStr) {
7923
8144
  var n = elem;
7924
- while (n && n.classList) {
7925
- if (n.classList.contains(classStr)) {
7926
- return /** @type{Element} */(n);
8145
+ while (n) {
8146
+ if(n.classList) { // DocumentFragment does not have classList property
8147
+ if (n.classList.contains(classStr)) {
8148
+ return /** @type{Element} */(n);
8149
+ }
7927
8150
  }
7928
- n = n.parentNode;
8151
+ n = n.parentNode || n.host; // ShadowRoot has host, but not parentNode
7929
8152
  }
7930
8153
  return null;
7931
8154
  };
8155
+ /** @public
8156
+ * @function
8157
+ * @ignore
8158
+ * @param {Event} e
8159
+ */
8160
+ util_Util._preventDefault = function (e) {
8161
+ e.preventDefault();
8162
+ e.stopPropagation();
8163
+ };
7932
8164
 
7933
8165
  /** @public
7934
8166
  * @type {boolean}
@@ -10448,7 +10680,15 @@ DataTable.prototype.setRowData = function(rid, values, eventArg) { // Data chang
10448
10680
  this._prevData[rid] = this._rows[rid]; // Move reference from the removed row to history
10449
10681
  delete this._rows[rid];
10450
10682
  if(this._segments) {
10451
- segmentChanged = this._segments.containsSegment(rid); // TODO: Handle this case where the segment separator row is removed
10683
+ var segment = this._segments.getSegment(rid);
10684
+ if(segment) {
10685
+ if(this._segments.removeSegment(rid)) {
10686
+ segmentChanged = true;
10687
+ if(!this._segments.getSegmentCount()) {
10688
+ this._segments = null;
10689
+ }
10690
+ }
10691
+ }
10452
10692
  }
10453
10693
  for(var i = this._rids.length; --i >= 0;) {
10454
10694
  if(this._rids[i] === rid) {
@@ -11651,18 +11891,33 @@ DataTable._performMultiLevelSorting = function(dataRows, sortingDefs, segmentVal
11651
11891
  return null;
11652
11892
  }
11653
11893
 
11894
+ var sortLogic;
11654
11895
  // Populate data for each definition
11655
11896
  for(var c = 0; c < defCount; ++c) {
11656
11897
  var sortingDef = sortingDefs[c];
11657
- var columnId = sortingDef[0];
11658
11898
  var rows = sortingDef[1];
11659
- if(rows) {
11660
- rows.length = rowCount;
11661
- } else {
11662
- rows = sortingDef[1] = new Array(rowCount);
11663
- }
11664
- for(var r = 0; r < rowCount; ++r) {
11665
- rows[r] = dataRows[r][columnId];
11899
+ sortLogic = sortingDef[2];
11900
+ var rowSorting = sortLogic["rowSorting"];
11901
+ var r;
11902
+ if(rowSorting) {
11903
+ if(rows) {
11904
+ rows.length = rowCount;
11905
+ for(r = 0; r < rowCount; ++r) {
11906
+ rows[r] = dataRows[r];
11907
+ }
11908
+ } else {
11909
+ rows = sortingDef[1] = dataRows;
11910
+ }
11911
+ } else {
11912
+ if(rows) {
11913
+ rows.length = rowCount;
11914
+ } else {
11915
+ rows = sortingDef[1] = new Array(rowCount);
11916
+ }
11917
+ var columnId = sortingDef[0];
11918
+ for(r = 0; r < rowCount; ++r) {
11919
+ rows[r] = dataRows[r][columnId];
11920
+ }
11666
11921
  }
11667
11922
  }
11668
11923
 
@@ -11688,7 +11943,7 @@ DataTable._performMultiLevelSorting = function(dataRows, sortingDefs, segmentVal
11688
11943
  }
11689
11944
 
11690
11945
  var sortOrder = 0;
11691
- var sortLogic, sortContext;
11946
+ var sortContext;
11692
11947
  if(defCount > 1) {
11693
11948
  sortLogic = DataTable._multiColumnCompareLogic;
11694
11949
  sortContext = sortingDefs;
@@ -12153,7 +12408,12 @@ RowDefinition.prototype.setContent = function(userInput) {
12153
12408
  this._dataId = this._rowId + this._ric; // JET/RTK will generate data id to be rowId (given from this rowDef) + ric;
12154
12409
 
12155
12410
  // This will work for runtime ric modification, but not for first initilization.
12156
- this.subscribeForUpdates();
12411
+ if(!this.subscribeForUpdates()) {
12412
+ // Avoid losing the ROW_DEF pointer.
12413
+ var rowData = {};
12414
+ rowData[ROW_DEF] = this; // Enable tracking back and updating data
12415
+ this.setRowData(rowData);
12416
+ }
12157
12417
  return true;
12158
12418
  };
12159
12419
  /** @public
@@ -12175,7 +12435,7 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
12175
12435
 
12176
12436
  val = this._staticValues;
12177
12437
  if(val) {
12178
- obj["values"] = val;
12438
+ obj["values"] = Object(Util["b" /* cloneObject */])(val);
12179
12439
  }
12180
12440
 
12181
12441
  val = this._chainRic;
@@ -12432,15 +12692,16 @@ RowDefinition.prototype.isRealTimeRow = function() {
12432
12692
  };
12433
12693
 
12434
12694
  /** @public
12695
+ * @return {boolean} If a subscription is made, return true.
12435
12696
  */
12436
12697
  RowDefinition.prototype.subscribeForUpdates = function() {
12437
12698
  if(!this.isRealTimeRow()) {
12438
- return;
12699
+ return false;
12439
12700
  }
12440
12701
 
12441
12702
  var subs = this._dc ? this._dc.getSubscriptions() : null;
12442
12703
  if(!subs) {
12443
- return;
12704
+ return false;
12444
12705
  }
12445
12706
  // TODO: Check if the same subscription is being made.
12446
12707
  var prevRowData = this.unsubscribeForUpdates();
@@ -12457,6 +12718,7 @@ RowDefinition.prototype.subscribeForUpdates = function() {
12457
12718
  } else {
12458
12719
  this._dc.setRowData(this._dataId, {"X_RIC_NAME": this._ric, "ROW_DEF": this}); // Trigger data update immediately
12459
12720
  }
12721
+ return true;
12460
12722
  };
12461
12723
  /** @public
12462
12724
  * @returns {*}
@@ -12983,6 +13245,11 @@ FieldDefinition._synapse = '';
12983
13245
  * @const
12984
13246
  */
12985
13247
  FieldDefinition._lang = 'en';
13248
+ /**
13249
+ * @type {boolean}
13250
+ * @private
13251
+ */
13252
+ FieldDefinition._caching = false;
12986
13253
 
12987
13254
  /**
12988
13255
  * @type {Object.<string, boolean>}
@@ -13004,7 +13271,10 @@ FieldDefinition.set = function(field, def) {
13004
13271
  * @return {Object}
13005
13272
  */
13006
13273
  FieldDefinition.get = function(field) {
13007
- return FieldDefinition._defs[field];
13274
+ if(this._caching) {
13275
+ return FieldDefinition._defs[field];
13276
+ }
13277
+ return null;
13008
13278
  };
13009
13279
  /** @public
13010
13280
  * @function
@@ -13025,11 +13295,10 @@ FieldDefinition.setSynapseConfig = function (config) {
13025
13295
 
13026
13296
  /** @public
13027
13297
  * @function
13028
- * @param {string} field
13029
- * @param {Object} def
13298
+ * @param {boolean} caching
13030
13299
  */
13031
- FieldDefinition.set = function (field, def) {
13032
- FieldDefinition._defs[field] = def || null;
13300
+ FieldDefinition.setFieldCaching = function (caching) {
13301
+ FieldDefinition._caching = caching;
13033
13302
  };
13034
13303
 
13035
13304
  /** to get more info about field via synapse service
@@ -13336,7 +13605,11 @@ var TYPE_MAPPING = {
13336
13605
 
13337
13606
  PRICE: "number",
13338
13607
  DOUBLE: "number",
13339
- MONEY: "number"
13608
+ MONEY: "number",
13609
+
13610
+ INTEGER: "number",
13611
+ FLOAT: "number",
13612
+ SCORE: "number"
13340
13613
  };
13341
13614
 
13342
13615
  /** @type {string}
@@ -13414,6 +13687,10 @@ ColumnDefinition.prototype._name = "";
13414
13687
  * @private
13415
13688
  */
13416
13689
  ColumnDefinition.prototype._isDefaultName = true;
13690
+ /** @type {boolean}
13691
+ * @private
13692
+ */
13693
+ ColumnDefinition.prototype._emptyField = false;
13417
13694
  /** @type {string|null}
13418
13695
  * @private
13419
13696
  */
@@ -13734,6 +14011,17 @@ ColumnDefinition.prototype.getDataType = function () {
13734
14011
  }
13735
14012
  return "";
13736
14013
  };
14014
+ /** set data type
14015
+ * @public
14016
+ * @param {string} dataType
14017
+ */
14018
+ ColumnDefinition.prototype.setDataType = function (dataType) {
14019
+ var val = TYPE_MAPPING[dataType.toUpperCase()];
14020
+ if(val) {
14021
+ dataType = val;
14022
+ }
14023
+ this._dataType = dataType;
14024
+ };
13737
14025
  /** get data type
13738
14026
  * @public
13739
14027
  * @param {string} field
@@ -13896,6 +14184,13 @@ ColumnDefinition.prototype.getTextAlign = function() {
13896
14184
  var colIndex = grid.getColumnIndex(this);
13897
14185
  return core.getColumnAlignment(colIndex);
13898
14186
  };
14187
+ /** @public
14188
+ * @return {boolean}
14189
+ */
14190
+ ColumnDefinition.prototype.isFieldEmpty = function() {
14191
+ return this._emptyField;
14192
+ };
14193
+
13899
14194
  /** @public
13900
14195
  * @return {string}
13901
14196
  */
@@ -14154,9 +14449,11 @@ ColumnDefinition.prototype._setField = function(field, formulaStr) {
14154
14449
  if(defaultField) {
14155
14450
  this._field = "COLUMN_" + this._id;
14156
14451
  this._name = "Column " + this._id;
14452
+ this._emptyField = true;
14157
14453
  } else {
14158
14454
  this._field = field;
14159
14455
  this._name = field;
14456
+ this._emptyField = false;
14160
14457
  this._realTimeField = field ? true : false;
14161
14458
  }
14162
14459
  this._isDefaultName = true;
@@ -14212,6 +14509,8 @@ ColumnDefinition.prototype._customRenderer = function(e) {
14212
14509
  arg["rowIndex"] = e["rowIndex"];
14213
14510
  if(rowData) {
14214
14511
  arg["data"] = rowData[this._field];
14512
+ } else {
14513
+ arg["data"] = null;
14215
14514
  }
14216
14515
  arg["colIndex"] = e["colIndex"];
14217
14516
  arg["cell"] = e["cell"];
@@ -14253,6 +14552,8 @@ ColumnDefinition.prototype.clearUserModel = function() {
14253
14552
  /* harmony default export */ var js_ColumnDefinition = (ColumnDefinition);
14254
14553
 
14255
14554
  // CONCATENATED MODULE: ./src/js/SnapshotFiller.js
14555
+ /* eslint-disable */
14556
+
14256
14557
 
14257
14558
 
14258
14559
 
@@ -14276,6 +14577,9 @@ var SnapshotFiller = function () {
14276
14577
 
14277
14578
  this._rics = {};
14278
14579
  this._fields = {};
14580
+ this._adcOptions = { // TODO: support requesting level parameter
14581
+ productId: "001"
14582
+ };
14279
14583
  };
14280
14584
  Ext["a" /* Ext */].inherits(SnapshotFiller, EventDispatcher["a" /* EventDispatcher */]);
14281
14585
 
@@ -14296,6 +14600,10 @@ SnapshotFiller.prototype._fields;
14296
14600
  * @private
14297
14601
  */
14298
14602
  SnapshotFiller.prototype._rtk;
14603
+ /** @type {!Grid~ADCOptions}
14604
+ * @private
14605
+ */
14606
+ SnapshotFiller.prototype._adcOptions = null;
14299
14607
  //#endregion Private Members
14300
14608
 
14301
14609
  /** @public
@@ -14305,6 +14613,26 @@ SnapshotFiller.prototype.setRTK = function (rtk) {
14305
14613
  this._rtk = rtk;
14306
14614
  };
14307
14615
 
14616
+ /** @public
14617
+ * @param {Grid~ADCOptions} adcOptions ADC requesting level parameter options
14618
+ */
14619
+ SnapshotFiller.prototype.setADCOptions = function (adcOptions) {
14620
+
14621
+ var val = adcOptions["productId"];
14622
+ if(val) {
14623
+ this._adcOptions.productId = val;
14624
+ }
14625
+ // TODO: support requesting level parameter https://confluence.refinitiv.com/display/ADC/Request+level+parameters
14626
+ // var val = adcOptions["lang"];
14627
+ // if(val) {
14628
+ // this._adcOptions.lang = val;
14629
+ // }
14630
+ // var val = adcOptions["cache"];
14631
+ // if(val) {
14632
+ // this._adcOptions.cache = val;
14633
+ // }
14634
+ };
14635
+
14308
14636
  /** @public
14309
14637
  * @param {string} ric
14310
14638
  */
@@ -14422,29 +14750,37 @@ SnapshotFiller.prototype._onRequest = function () {
14422
14750
  return;
14423
14751
  }
14424
14752
 
14425
- var reqFields = [];
14426
- for(i = 0; i < fieldLen; i++) {
14427
- reqFields.push({ "name": fields[i] });
14428
- }
14429
-
14430
14753
  // Clean up members, preparing for the next request
14431
14754
  this._rics = {};
14432
14755
  this._fields = {};
14433
14756
 
14434
- var payload = {
14435
- "instruments": instruments,
14436
- "fields": reqFields
14437
- };
14438
-
14439
- var onSuccess = this._onSuccess.bind(this, fields);
14757
+ var onSuccess, payload;
14440
14758
  if (this._rtk) {
14441
- this._rtk.Data.DataGrid
14759
+ var strFields = fields.join(',');
14760
+ payload = {
14761
+ "method": "select",
14762
+ "formula": strFields,
14763
+ "identifiers": instruments,
14764
+ "productId": this._adcOptions.productId,
14765
+ "output": "Col,In,va,T,NoEmptyTickers" // For customize output server, for more information please visit "https://confluence.refinitiv.com/display/ADC/Data+Cloud+Output+Format"
14766
+ };
14767
+ onSuccess = this._onRTKSuccess.bind(this, fields);
14768
+ this._rtk.Data.Adc
14442
14769
  .request(payload)
14443
14770
  .then(onSuccess)
14444
14771
  .catch(function (err) {
14445
14772
  console.log(err);
14446
14773
  });
14447
14774
  } else {
14775
+ var reqFields = [];
14776
+ for(i = 0; i < fieldLen; i++) {
14777
+ reqFields.push({ "name": fields[i] });
14778
+ }
14779
+ payload = {
14780
+ "instruments": instruments,
14781
+ "fields": reqFields
14782
+ };
14783
+ onSuccess = this._onJETSuccess.bind(this, fields);
14448
14784
  jet["Data"]("datagrid")
14449
14785
  .then(function (service) { return service["request"](payload); })
14450
14786
  .then(JSON.parse)
@@ -14460,16 +14796,15 @@ SnapshotFiller.prototype._onRequest = function () {
14460
14796
  * @param {Array.<string>} fields
14461
14797
  * @param {string} serverResult
14462
14798
  */
14463
- SnapshotFiller.prototype._onSuccess = function (fields, serverResult) {
14799
+ SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
14800
+ this._dispatch("adcDataReceived", serverResult);
14464
14801
  var data2D = serverResult["data"];
14465
14802
  var svHeaders = serverResult["headers"] && serverResult["headers"][0];
14466
14803
 
14467
14804
  if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
14468
- console.log("Invalid server response detected");
14469
14805
  return; //TODO: Return Promise.reject(errMsg);
14470
14806
  }
14471
14807
 
14472
- this._dispatch("adcDataReceived", serverResult);
14473
14808
 
14474
14809
  // Server will return field only in UPPERCASE
14475
14810
  // ex. requestField = TR.Volume ===> serverField = TR.VOLUME
@@ -14526,6 +14861,76 @@ SnapshotFiller.prototype._onSuccess = function (fields, serverResult) {
14526
14861
  });
14527
14862
  };
14528
14863
 
14864
+ /** @private
14865
+ * @function
14866
+ * @param {Array.<string>} fields
14867
+ * @param {string} serverResult
14868
+ */
14869
+ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
14870
+ this._dispatch("adcDataReceived", serverResult);
14871
+ var data2D = serverResult["rows"];
14872
+ var svHeaders = serverResult["rows"] && serverResult["rows"][0];
14873
+ if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
14874
+ return; //TODO: Return Promise.reject(errMsg);
14875
+ }
14876
+
14877
+ // Server will return field only in UPPERCASE
14878
+ // ex. requestField = TR.Volume ===> serverField = TR.VOLUME
14879
+ // so we need convert UPPERCASE to be original
14880
+ var i, field, ric;
14881
+ var j = 1; // to skip instrument index, use j = 1
14882
+ var fLength = fields.length;
14883
+ var hLength = svHeaders.length;
14884
+ var headers = new Array(hLength);
14885
+ for (i = 0; i < fLength && j < hLength; i++) {
14886
+ field = fields[i];
14887
+ if (svHeaders[j].r.toUpperCase() === field.toUpperCase()) {
14888
+ headers[j] = field;
14889
+ j++;
14890
+ }
14891
+ }
14892
+
14893
+ var len = data2D.length;
14894
+ var fieldLen = headers.length;
14895
+ var ricMap = {};
14896
+
14897
+ // TODO: Freeze the data view before setting multiple data
14898
+ for (i = 1; i < len; i++) { // to skip column header index, use i = 1
14899
+ var dataRow = data2D[i];
14900
+ ric = dataRow[0];
14901
+
14902
+ var snapData = ricMap[ric] = {};
14903
+
14904
+ // loop for create rowData for update
14905
+ for (j = 1; j < fieldLen; j++) { // to skip instrument index, use j = 1
14906
+ var value = dataRow[j];
14907
+ if (value != null && value !== "") {
14908
+ if(typeof value !== 'object') {
14909
+ field = headers[j];
14910
+ snapData[field] = value;
14911
+ }
14912
+ // TODO : handled when a cell has a mistake and the value appears as {f: "1"} ( description error in fault attribute at index 1 ),
14913
+ // Therefore, we need to store information to the error field for this cell.
14914
+ // else {}
14915
+
14916
+ }
14917
+ }
14918
+ }
14919
+
14920
+ // return result only ric that has update data
14921
+ var updatedData = {};
14922
+ for (ric in ricMap) {
14923
+ var obj = ricMap[ric];
14924
+ if (!isEmptyObject(obj)) {
14925
+ updatedData[ric] = obj;
14926
+ }
14927
+ }
14928
+
14929
+ this._dispatch("dataChanged", {
14930
+ data: updatedData
14931
+ });
14932
+ };
14933
+
14529
14934
 
14530
14935
  /* harmony default export */ var js_SnapshotFiller = (SnapshotFiller);
14531
14936
 
@@ -16516,6 +16921,33 @@ TrackLayout.prototype.setLaneSize = function (index, val) {
16516
16921
  return false;
16517
16922
  };
16518
16923
 
16924
+ /** @public
16925
+ * @param {number} index
16926
+ * @param {string} propName
16927
+ * @param {*} val
16928
+ * @return {boolean}
16929
+ */
16930
+ TrackLayout.prototype.setLaneProperty = function (index, propName, val) {
16931
+ if (index < 0 || index >= this._laneCount) { return false; }
16932
+
16933
+ var col = this._cols[index];
16934
+ if (col == null || col[propName] !== val) {
16935
+ col = this._newColumn(index);
16936
+ col[propName] = val;
16937
+ return true;
16938
+ }
16939
+
16940
+ return false;
16941
+ };
16942
+ /** @public
16943
+ * @param {number} index
16944
+ * @param {string} propName
16945
+ * @return {*}
16946
+ */
16947
+ TrackLayout.prototype.getLaneProperty = function (index, propName) {
16948
+ var col = this._cols[index];
16949
+ return (col && col[propName] != null) ? col[propName] : null;
16950
+ };
16519
16951
  /** @public
16520
16952
  * @param {number} index
16521
16953
  * @return {number}
@@ -17660,8 +18092,9 @@ ILayoutGrid.prototype.calculateColumnBounds = function (lftIdx, rgtIdx, outPosit
17660
18092
  * @ignore
17661
18093
  * @param {!Array.<number>} positions Left and right bound positions in pixel
17662
18094
  * @param {!Array.<boolean>} noBorders Boolean values indicating existence of left and right CSS borders
18095
+ * @param {number=} topPx Top position of bound
17663
18096
  */
17664
- ILayoutGrid.prototype.updateColumnBounds = function (positions, noBorders) {};
18097
+ ILayoutGrid.prototype.updateColumnBounds = function (positions, noBorders, topPx) {};
17665
18098
 
17666
18099
  /* harmony default export */ var grid_ILayoutGrid = (ILayoutGrid);
17667
18100
 
@@ -18502,10 +18935,10 @@ StretchedCells.prototype.getColumnIndex = function (cellRef) {
18502
18935
  if(cellRef["getElement"]) {
18503
18936
  var cellElement = cellRef["getElement"]();
18504
18937
  if(cellElement) {
18505
- return cellElement._colIndex || 0;
18938
+ return cellElement._colIndex != null ? cellElement._colIndex : -1;
18506
18939
  }
18507
18940
  } else {
18508
- return cellRef._colIndex || 0;
18941
+ return cellRef._colIndex != null ? cellRef._colIndex : -1;
18509
18942
  }
18510
18943
  }
18511
18944
  return -1;
@@ -18540,7 +18973,7 @@ StretchedCells.prototype.getRowIndex = function (cellRef) {
18540
18973
  * @return {Cell}
18541
18974
  */
18542
18975
  StretchedCells.prototype.stretchCell = function (rowIndex, colIndex) {
18543
- // Increase the active count regardless of redundancy. This acts as a dirty flag. It does not needed to be accurate
18976
+ // Increase the active count regardless of redundancy. This acts as a dirty flag. It does not need to be accurate
18544
18977
  ++this._activeCount;
18545
18978
  if(!colIndex || colIndex < 0) {
18546
18979
  colIndex = 0;
@@ -18555,7 +18988,17 @@ StretchedCells.prototype.stretchCell = function (rowIndex, colIndex) {
18555
18988
  }
18556
18989
  var cellElem = cell["getElement"]();
18557
18990
  cellElem["stretched"] = true;
18558
- cellElem._colIndex = colIndex;
18991
+ if(cellElem._colIndex !== colIndex) {
18992
+ cellElem._colIndex = colIndex;
18993
+ if(colIndex > 0) {
18994
+ cellElem.classList.add("right-stretching");
18995
+ } else {
18996
+ cellElem.classList.remove("right-stretching");
18997
+ }
18998
+ }
18999
+ if(cellElem._rowIndex !== rowIndex) {
19000
+ cellElem._rowIndex = rowIndex;
19001
+ }
18559
19002
 
18560
19003
  var width = this._stretchSize || this._trackX.getTrackSize();
18561
19004
  _updateXAxis(cell, this._trackX, colIndex, width);
@@ -20988,6 +21431,19 @@ Scrollbar.prototype.freezeScrolling = function (frozen) {
20988
21431
  this._isFrozen = frozen !== false;
20989
21432
  return prev;
20990
21433
  };
21434
+ /** @public
21435
+ */
21436
+ Scrollbar.prototype.restoreTrackPosition = function () {
21437
+ // Scroll event will be fired asynchronously, if there is any change
21438
+ var track = this._element;
21439
+ if(this._vertical) {
21440
+ track.scrollTop = this._tScrollVal;
21441
+ if(track.scrollTop){
21442
+ this._tScrollVal = track.scrollTop; //Check to ensure that cache equal to element's scroll
21443
+ }
21444
+ }
21445
+ //TODO: handle restore scrollLeft for hscroll
21446
+ };
20991
21447
 
20992
21448
  Scrollbar._proto = Scrollbar.prototype;
20993
21449
 
@@ -21765,6 +22221,20 @@ LayoutGrid.prototype._setColumnWidth = function (indexX, val) {
21765
22221
  LayoutGrid.prototype._updateColumnLayout = function () {
21766
22222
  this._syncLayoutToColumns(0);
21767
22223
  };
22224
+ /** @public
22225
+ * @ignore
22226
+ * @param {boolean} enabled
22227
+ */
22228
+ LayoutGrid.prototype._startBindingSession = function (enabled) {
22229
+ // Prevent error when calling _startBindingSession in LayoutGrid
22230
+ };
22231
+ /** @public
22232
+ * @ignore
22233
+ * @return {Array<boolean>}
22234
+ */
22235
+ LayoutGrid.prototype._getTempRowHeights = function () {
22236
+ return null;
22237
+ };
21768
22238
 
21769
22239
  /**
21770
22240
  * {@link ILayoutGrid#getRowHeight}
@@ -22606,6 +23076,11 @@ LayoutGrid.prototype.setRowHighlight = function (rowIndex) {
22606
23076
  this._highlightedCells[c] = cell;
22607
23077
  cell.addClass("highlighted-row");
22608
23078
  }
23079
+ var stretchEl = this.getStretchedCell(rowIndex); // check stretched cell
23080
+ if(stretchEl) {
23081
+ this._highlightedCells.push(stretchEl);
23082
+ stretchEl.addClass("highlighted-row");
23083
+ }
22609
23084
  } else {
22610
23085
  this._highlightedCells.length = 0;
22611
23086
  }
@@ -22891,6 +23366,7 @@ LayoutGrid.prototype.insertColumn = function (index, opt_json) {
22891
23366
  cell.addClass("selected-row");
22892
23367
  }
22893
23368
  }
23369
+ // TODO: Check if it can insert column with stretch cell
22894
23370
  }
22895
23371
 
22896
23372
  column.activate(atTheMiddle || !this._colVir);
@@ -22966,8 +23442,14 @@ LayoutGrid.prototype.moveColumn = function (from, to) {
22966
23442
 
22967
23443
  util.moveArrayItem(this._columns, from, to);
22968
23444
 
22969
- var nextSibling = this._columns[to + 1] || null;
22970
- movedColumn.insertBefore(nextSibling);
23445
+ if(movedColumn.getElement().offsetParent) {
23446
+ var siblingIndex = to + 1;
23447
+ var nextSibling = this._columns[siblingIndex] || null;
23448
+ while (nextSibling && !nextSibling.getElement().offsetParent) {
23449
+ nextSibling = this._columns[++siblingIndex];
23450
+ }
23451
+ movedColumn.insertBefore(nextSibling);
23452
+ }
22971
23453
 
22972
23454
  this._updateColumnIndices();
22973
23455
  this._updateCellSpans(cellSpans, true); // Restore all styling
@@ -23122,6 +23604,10 @@ LayoutGrid.prototype.stretchCell = function (cellRef, rowIndex, opt_stretching,
23122
23604
  } else {
23123
23605
  cell = this._stretchedCells.unstretchCell(rowIndex);
23124
23606
  }
23607
+ if(cell) {
23608
+ var selected = this._selectionList.getSelection(rowIndex);
23609
+ cell.enableClass("selected-row", selected); // It's can enable class without get stretch cell again.
23610
+ }
23125
23611
  return cell;
23126
23612
  };
23127
23613
 
@@ -23182,6 +23668,10 @@ LayoutGrid.prototype.updateStretchedCells = function () {
23182
23668
  * @return {number}
23183
23669
  */
23184
23670
  LayoutGrid.prototype._calculateViewSize = function (forceRecal) {
23671
+ if(this._frozenLayout) {
23672
+ return this._stretchedCells.getStretchSize();
23673
+ }
23674
+
23185
23675
  var ctx = this._ctx;
23186
23676
  var stretchSize = forceRecal ? 0 : this._stretchedCells.getStretchSize();
23187
23677
  if(!stretchSize && ctx) {
@@ -23189,9 +23679,6 @@ LayoutGrid.prototype._calculateViewSize = function (forceRecal) {
23189
23679
  var contentWidth = this.getContentWidth();
23190
23680
  stretchSize = ctx["getWidth"]();
23191
23681
  if(stretchSize) { // Grid may not be in the document
23192
- if(!ctx.hasClass("no-borders")) {
23193
- stretchSize -= 1;
23194
- }
23195
23682
  if(contentWidth < stretchSize) { // If view width is larger than actual content
23196
23683
  stretchSize = contentWidth;
23197
23684
  }
@@ -23204,6 +23691,19 @@ LayoutGrid.prototype._calculateViewSize = function (forceRecal) {
23204
23691
  }
23205
23692
  return stretchSize;
23206
23693
  };
23694
+
23695
+ /**
23696
+ * @private
23697
+ * @param {number} rowIndex
23698
+ * @param {string} className
23699
+ * @param {boolean} enabled
23700
+ */
23701
+ LayoutGrid.prototype._enableStretchCellClass = function (rowIndex, className, enabled ) {
23702
+ var stretchEl = this.getStretchedCell(rowIndex); // check stretched cell
23703
+ if(stretchEl) {
23704
+ stretchEl.enableClass(className, enabled);
23705
+ }
23706
+ };
23207
23707
  /** View size is width of container (Grid's pane) or content (LayoutGrid's columns), whichever is smaller.
23208
23708
  * @public
23209
23709
  * @ignore
@@ -23526,8 +24026,9 @@ LayoutGrid.prototype.calculateColumnBounds = function (lftIdx, rgtIdx, outPositi
23526
24026
  * @ignore
23527
24027
  * @param {!Array.<number>} positions Left and right bound positions in pixel
23528
24028
  * @param {!Array.<boolean>} noBorders Boolean values indicating existence of left and right CSS borders
24029
+ * @param {number=} topPx Top position of bound
23529
24030
  */
23530
- LayoutGrid.prototype.updateColumnBounds = function (positions, noBorders) {
24031
+ LayoutGrid.prototype.updateColumnBounds = function (positions, noBorders, topPx) {
23531
24032
  var columnBound = this._columnBound;
23532
24033
  if(!columnBound) {
23533
24034
  return;
@@ -23544,7 +24045,9 @@ LayoutGrid.prototype.updateColumnBounds = function (positions, noBorders) {
23544
24045
  columnBound.style.left = lftPx + "px";
23545
24046
  columnBound.style.width = (rgtPx - lftPx) + "px";
23546
24047
 
23547
- columnBound.style.height = this._trackY.getTrackSize() + "px";
24048
+ topPx = topPx || 0;
24049
+ columnBound.style.top = topPx + "px";
24050
+ columnBound.style.height = (this._trackY.getTrackSize() - topPx) + "px";
23548
24051
  columnBound.classList.toggle("no-left-bound", noBorders[0]);
23549
24052
  columnBound.classList.toggle("no-right-bound", noBorders[1]);
23550
24053
  if(this._boundLayer) {
@@ -23887,11 +24390,16 @@ LayoutGrid.prototype._updateCellSpans = function (cellSpans, adding) {
23887
24390
  */
23888
24391
  LayoutGrid.prototype._onMouseMove = function (e) {
23889
24392
  var target = e["target"];
23890
- var colElement = util.closestElement(target, "column");
23891
- var colIndex = this.getColumnIndex(colElement);
23892
- var cellElement = (colIndex >= 0) ? util.closestElement(target, "cell") : null;
23893
24393
 
23894
- this.setRowHighlight(this.getCellIndex(colIndex, cellElement));
24394
+ var cellElement = util.closestElement(target, "cell");
24395
+ var colIndex = this._stretchedCells.getColumnIndex(cellElement);
24396
+ if(colIndex < 0) { // Not found colIndex in stretching cell, then get from normal row
24397
+ var colElement = util.closestElement(target, "column");
24398
+ colIndex = this.getColumnIndex(colElement);
24399
+ }
24400
+ var rowIndex = this.getCellIndex(colIndex, cellElement);
24401
+
24402
+ this.setRowHighlight(rowIndex);
23895
24403
  };
23896
24404
 
23897
24405
  /**
@@ -23922,27 +24430,16 @@ LayoutGrid.prototype._onMouseOut = function (e) {
23922
24430
  */
23923
24431
  LayoutGrid.prototype._updateSelectionUI = function (rowIndex) { // Update UI of the specified row index
23924
24432
  var selected = this._selectionList.getSelection(rowIndex);
23925
-
23926
- for (var c = 0; c < this._colCount; ++c) {
23927
- var cell = this._columns[c].getCell(rowIndex);
23928
-
23929
- if (cell) {
23930
- cell.enableClass("selected-row", selected);
23931
- }
23932
- }
24433
+ this._enableStretchCellClass(rowIndex, "selected-row", selected);
24434
+ this.enableRowClass(rowIndex, "selected-row", selected);
23933
24435
  };
23934
24436
 
23935
24437
  /** @private
23936
24438
  * @param {number} rowIndex
23937
24439
  */
23938
24440
  LayoutGrid.prototype._addSelectionUI = function (rowIndex) {
23939
- for (var c = 0; c < this._colCount; ++c) {
23940
- var cell = this._columns[c].getCell(rowIndex);
23941
-
23942
- if (cell) {
23943
- cell.addClass("selected-row");
23944
- }
23945
- }
24441
+ this._enableStretchCellClass(rowIndex, "selected-row", true);
24442
+ this.enableRowClass(rowIndex, "selected-row", true);
23946
24443
  };
23947
24444
 
23948
24445
  /**
@@ -23950,13 +24447,8 @@ LayoutGrid.prototype._addSelectionUI = function (rowIndex) {
23950
24447
  * @param {number} rowIndex
23951
24448
  */
23952
24449
  LayoutGrid.prototype._removeSelectionUI = function (rowIndex) {
23953
- for (var c = 0; c < this._colCount; ++c) {
23954
- var cell = this._columns[c].getCell(rowIndex);
23955
-
23956
- if (cell) {
23957
- cell.removeClass("selected-row");
23958
- }
23959
- }
24450
+ this._enableStretchCellClass(rowIndex, "selected-row", false);
24451
+ this.enableRowClass(rowIndex, "selected-row", false);
23960
24452
  };
23961
24453
 
23962
24454
  /**
@@ -26559,45 +27051,65 @@ DataView.prototype.isSorting = function() {
26559
27051
 
26560
27052
  /** Hide rows in the data view
26561
27053
  * @param {string|number} rId Row id to hide. If the rId is a number, it will be treated as a row index
26562
- * @param {boolean=} opt_show show if false
27054
+ * @param {boolean=} hidden=true If the value is false, the specified row will be shown.
26563
27055
  * @public
26564
27056
  */
26565
- DataView.prototype.hideRow = function(rId, opt_show) {
26566
- this.showRows([rId], opt_show === false);
27057
+ DataView.prototype.hideRow = function(rId, hidden) {
27058
+ this.hideRows([rId], hidden);
26567
27059
  };
26568
27060
  /** Hide rows in the data view
26569
27061
  * @param {Array.<string|number>} rowRefs Array of row ids or indices to hide
26570
- * @param {boolean=} opt_show show if false
27062
+ * @param {boolean=} hidden=true If the value is false, the specified rows will be shown.
26571
27063
  * @public
26572
27064
  */
26573
- DataView.prototype.hideRows = function(rowRefs, opt_show) {
26574
- this.showRows(rowRefs, opt_show === false);
26575
- };
26576
- /**
26577
- * Show/hide rows in the data view
26578
- * @param {Array.<string|number>} rowRefs Array of row ids or indices to hide
26579
- * @param {boolean=} opt_show hide instead show if false
26580
- * @public
26581
- */
26582
- DataView.prototype.showRows = function(rowRefs, opt_show) {
26583
- var hidden = opt_show === false;
27065
+ DataView.prototype.hideRows = function(rowRefs, hidden) {
27066
+ hidden = hidden !== false;
27067
+ var dirty = false;
27068
+ var rids = this._toRowIds(rowRefs);
27069
+ var hiddenRids = this._hiddenRids;
27070
+
26584
27071
  if(hidden){
26585
- if(!this._hiddenRids) {
26586
- this._hiddenRids = {};
27072
+ if(!hiddenRids) {
27073
+ hiddenRids = this._hiddenRids = {};
26587
27074
  }
26588
- } else if(!this._hiddenRids) {
27075
+ } else if(!hiddenRids) {
26589
27076
  return; // All rows are visible
26590
27077
  }
26591
27078
 
26592
- var rids = this._toRowIds(rowRefs);
26593
27079
  for(var i = rids.length; --i >= 0;) {
26594
27080
  var rid = rids[i];
26595
27081
  if(rid) { // undefined, null, and an empty string value are not a valid row id
26596
- this._hiddenRids[rid] = hidden;
27082
+ if(!!hiddenRids[rid] !== hidden) {
27083
+ hiddenRids[rid] = hidden;
27084
+ dirty = true;
27085
+ }
26597
27086
  }
26598
27087
  }
26599
27088
 
26600
- this._refreshAndNotify(); // Very slow
27089
+ if(dirty) {
27090
+ if(!hidden) {
27091
+ var hasHiddenRow = false;
27092
+ for(var key in hiddenRids) {
27093
+ if(hiddenRids[key]) {
27094
+ hasHiddenRow = true;
27095
+ break;
27096
+ }
27097
+ }
27098
+ if(!hasHiddenRow) {
27099
+ hiddenRids = this._hiddenRids = null;
27100
+ }
27101
+ }
27102
+ this._refreshAndNotify(); // Very slow
27103
+ }
27104
+ };
27105
+ /**
27106
+ * Show/hide rows in the data view
27107
+ * @param {Array.<string|number>} rowRefs Array of row ids or indices to hide
27108
+ * @param {boolean=} shown=true If the value is false, the specified rows will be hidden.
27109
+ * @public
27110
+ */
27111
+ DataView.prototype.showRows = function(rowRefs, shown) {
27112
+ this.hideRows(rowRefs, shown === false);
26601
27113
  };
26602
27114
  /** Unhide all rows
26603
27115
  * @public
@@ -26613,7 +27125,7 @@ DataView.prototype.unhideAllRows = function(){
26613
27125
  * @return {boolean}
26614
27126
  */
26615
27127
  DataView.prototype.hasHiddenRow = function(){
26616
- return !!this._hiddenRids;
27128
+ return this._hiddenRids ? true : false;
26617
27129
  };
26618
27130
 
26619
27131
  /** @public
@@ -30271,6 +30783,11 @@ SectionSettings.prototype._dispatchDataChanged = function (firstUpdate, lastUpda
30271
30783
  */
30272
30784
  SectionSettings.prototype.updateRowData = function (fromRowIndex, lastRowIndex, e) {
30273
30785
  if(this.isDataBindable()) { // Prevent dispatching dataChanged event without the data view
30786
+ if(this._grid._getTempRowHeights()){
30787
+ fromRowIndex = this._grid.getFirstIndexInView();
30788
+ lastRowIndex = this._grid.getLastIndexInView() + 1;
30789
+ }
30790
+
30274
30791
  e = this.extendDataEventArg(e, fromRowIndex, lastRowIndex);
30275
30792
  if(e["fromRowIndex"] < e["toRowIndex"]) {
30276
30793
  this._dispatch("dataChanged", e);
@@ -31031,6 +31548,14 @@ VirtualizedLayoutGrid.prototype._boundLayer = null;
31031
31548
  * @private
31032
31549
  */
31033
31550
  VirtualizedLayoutGrid.prototype._hscrollbar = null;
31551
+ /** @type {string}
31552
+ * @private
31553
+ */
31554
+ VirtualizedLayoutGrid.prototype._session = "A";
31555
+ /** @type {Array<boolean>}
31556
+ * @private
31557
+ */
31558
+ VirtualizedLayoutGrid.prototype._tempRowHeights = null;
31034
31559
 
31035
31560
  //#region ====== Override ElementWrapper ======//
31036
31561
  /** @override */
@@ -31142,13 +31667,68 @@ VirtualizedLayoutGrid.prototype._setColumnWidth = function (indexX, val) {
31142
31667
  VirtualizedLayoutGrid.prototype._updateColumnLayout = function () {
31143
31668
  this._grid._updateColumnLayout();
31144
31669
  };
31670
+ /** @public
31671
+ * @ignore
31672
+ * @param {boolean} enabled
31673
+ */
31674
+ VirtualizedLayoutGrid.prototype._startBindingSession = function (enabled) {
31675
+ this._isBinding = enabled;
31676
+ if(!enabled){
31677
+ // Clear old session
31678
+ if(this._tempRowHeights){
31679
+ var defaultRowHeight = this.getDefaultRowHeight();
31680
+ var hasSession = true;
31681
+ var removedIndices = [];
31682
+
31683
+ for(var key in this._tempRowHeights){
31684
+ var index = +key;
31685
+ var rowSession = this._layoutY.getLaneProperty(index, "sizeSession");
31686
+ if(rowSession) {
31687
+ if(rowSession != this._session){
31688
+ this.setRowHeight(index, defaultRowHeight);
31689
+ this._layoutY.setLaneProperty(index, "sizeSession", null);
31690
+ removedIndices.push(index);
31691
+ }
31692
+ }
31693
+ }
31694
+ var removedCount = removedIndices.length;
31695
+ for(var i = 0; i < removedCount; i++){
31696
+ delete this._tempRowHeights[removedIndices[i]];
31697
+ }
31698
+ if(removedCount){
31699
+ for(var remainingKey in this._tempRowHeights){
31700
+ hasSession = remainingKey != null;
31701
+ break;
31702
+ }
31703
+ }
31704
+ if(!hasSession){
31705
+ this._tempRowHeights = null;
31706
+ }
31145
31707
 
31708
+ }
31709
+ this._session = this._session === "A" ? "B" : "A";
31710
+ }
31711
+ };
31712
+ /** @public
31713
+ * @ignore
31714
+ * @return {Array<boolean>}
31715
+ */
31716
+ VirtualizedLayoutGrid.prototype._getTempRowHeights = function () {
31717
+ return this._tempRowHeights;
31718
+ };
31146
31719
  /** @inheritDoc */
31147
31720
  VirtualizedLayoutGrid.prototype.getRowHeight = function (index) {
31148
31721
  return this._layoutY.getLaneSize(index);
31149
31722
  };
31150
31723
  /** @inheritDoc */
31151
31724
  VirtualizedLayoutGrid.prototype.setRowHeight = function (index, val) {
31725
+ if(this._isBinding && val != this.getDefaultRowHeight()){
31726
+ this._layoutY.setLaneProperty(index, "sizeSession", this._session);
31727
+ if(!this._tempRowHeights){
31728
+ this._tempRowHeights = [];
31729
+ }
31730
+ this._tempRowHeights[index] = true; // Store row index that set temporary row height
31731
+ }
31152
31732
  if(this._layoutY.setLaneSize(index, val)) {
31153
31733
  this._grid.setRowHeight(index - this._firstIndex, val);
31154
31734
  this._element.style.height = this._layoutY.getTrackSize() + "px";
@@ -31302,6 +31882,9 @@ VirtualizedLayoutGrid.prototype.setRowCount = function (val, noBinding) {
31302
31882
  var prevCount = this._layoutY.getLaneCount();
31303
31883
  if(prevCount !== val){
31304
31884
  this._layoutY.setLaneCount(val);
31885
+ if(this._tempRowHeights){
31886
+ this._tempRowHeights.length = val;
31887
+ }
31305
31888
  this._element.style.height = this._layoutY.getTrackSize() + "px";
31306
31889
  this._requestUpdatingRowBounds();
31307
31890
  //After rowCountChanged fires, virtualizer will update virtual row count if
@@ -31681,12 +32264,22 @@ VirtualizedLayoutGrid.prototype.updateLayout = function () {
31681
32264
  /** {@link ILayoutGrid#stretchCell}
31682
32265
  * @inheritDoc */
31683
32266
  VirtualizedLayoutGrid.prototype.stretchCell = function (cellRef, rowIndex, opt_stretching, onlyToTheRight) {
31684
- return this._grid.stretchCell(
32267
+ var stretchedCell = this._grid.stretchCell(
31685
32268
  cellRef,
31686
32269
  (rowIndex != null) ? rowIndex - this._firstIndex : null,
31687
32270
  opt_stretching,
31688
32271
  onlyToTheRight
31689
32272
  );
32273
+
32274
+ if (stretchedCell){
32275
+ var cellElem = stretchedCell.getElement();
32276
+ if(rowIndex === 0) {
32277
+ cellElem.classList.add("top");
32278
+ } else {
32279
+ cellElem.classList.remove("top");
32280
+ }
32281
+ }
32282
+ return stretchedCell;
31690
32283
  };
31691
32284
 
31692
32285
  /** {@link ILayoutGrid#unstretchCell}
@@ -31905,9 +32498,10 @@ VirtualizedLayoutGrid.prototype._updateCellBounds = function () {
31905
32498
  * @ignore
31906
32499
  * @param {!Array.<number>} positions Left and right bound positions in pixel
31907
32500
  * @param {!Array.<boolean>} noBorders Boolean values indicating existence of left and right CSS borders
32501
+ * @param {number=} topPx Top position of bound
31908
32502
  */
31909
- VirtualizedLayoutGrid.prototype.updateColumnBounds = function (positions, noBorders) {
31910
- this._grid.updateColumnBounds(positions, noBorders);
32503
+ VirtualizedLayoutGrid.prototype.updateColumnBounds = function (positions, noBorders, topPx) {
32504
+ this._grid.updateColumnBounds(positions, noBorders, topPx);
31911
32505
  this._updateRowBounds();
31912
32506
  };
31913
32507
  /** @private
@@ -32097,9 +32691,9 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
32097
32691
 
32098
32692
 
32099
32693
  // CONCATENATED MODULE: ./node_modules/@grid/core/es6/grid/Core.js
32100
- /* eslint-disable */
32101
32694
 
32102
32695
 
32696
+ // eslint-disable-line
32103
32697
 
32104
32698
 
32105
32699
 
@@ -32112,8 +32706,6 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
32112
32706
 
32113
32707
 
32114
32708
 
32115
- /* eslint-enable */
32116
-
32117
32709
  //#region Events
32118
32710
  /** @event Core#sectionAdded */
32119
32711
  /** @event Core#columnAdded */
@@ -32150,6 +32742,15 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
32150
32742
  */
32151
32743
  //#endregion Events
32152
32744
 
32745
+ /** @private
32746
+ * @param {number} a
32747
+ * @param {number} b
32748
+ * @return {number}
32749
+ */
32750
+ var ascNumberSorter = function (a, b) {
32751
+ return a - b;
32752
+ };
32753
+
32153
32754
  /** @constructor
32154
32755
  * @param {Element=} opt_initializer this can be either element id (string) or DOM element.
32155
32756
  * @extends {ElementWrapper}
@@ -32190,6 +32791,7 @@ var Core = function (opt_initializer) {
32190
32791
  _t._updateColumnBounds = _t._updateColumnBounds.bind(_t);
32191
32792
  _t._dispatchColumnPositionChanged = _t._dispatchColumnPositionChanged.bind(_t);
32192
32793
  _t._dispatchRowPositionChanged = _t._dispatchRowPositionChanged.bind(_t);
32794
+ _t._requestScrollbarUpdate = _t._requestScrollbarUpdate.bind(_t);
32193
32795
 
32194
32796
  // Text nodes are unintentionally getting in the tag.
32195
32797
  if(opt_initializer) { // Any node other than element node is not allowed within the tag.
@@ -32286,7 +32888,8 @@ var Core = function (opt_initializer) {
32286
32888
  "rowAdded",
32287
32889
  "rowRemoved",
32288
32890
  "columnPositionChanged",
32289
- "rowPositionChanged"
32891
+ "rowPositionChanged",
32892
+ "beforeColumnBoundUpdate"
32290
32893
  );
32291
32894
 
32292
32895
  // For debugging in advanced optimization mode
@@ -32306,13 +32909,13 @@ var Core = function (opt_initializer) {
32306
32909
  Core._runningGridId++;
32307
32910
 
32308
32911
  // init hiddenInput for retrieve copy and cut event
32309
- var hiddenInput = document.createElement('input');
32310
- hiddenInput.style.position = 'absolute';
32311
- hiddenInput.style.width = '0';
32312
- hiddenInput.style.height = '0';
32313
- hiddenInput.style.padding = '0';
32314
- hiddenInput.style.border = '0';
32315
- hiddenInput.value = '0';
32912
+ var hiddenInput = document.createElement("input");
32913
+ hiddenInput.style.position = "absolute";
32914
+ hiddenInput.style.width = "0";
32915
+ hiddenInput.style.height = "0";
32916
+ hiddenInput.style.padding = "0";
32917
+ hiddenInput.style.border = "0";
32918
+ hiddenInput.value = "0";
32316
32919
  _t._hiddenInput = hiddenInput;
32317
32920
  elem.insertBefore(hiddenInput, elem.firstChild);
32318
32921
 
@@ -32607,6 +33210,10 @@ Core.prototype._preserveProportion = false;
32607
33210
  * @private
32608
33211
  */
32609
33212
  Core.prototype._preserveGridSize = false;
33213
+ /** @type {number}
33214
+ * @private
33215
+ */
33216
+ Core.prototype._rowHeightTimerId = 0;
32610
33217
  //#region Public Methods
32611
33218
 
32612
33219
  /**
@@ -32614,7 +33221,7 @@ Core.prototype._preserveGridSize = false;
32614
33221
  * @return {string}
32615
33222
  */
32616
33223
  Core.getVersion = function () {
32617
- return "5.0.55";
33224
+ return "5.1.15";
32618
33225
  };
32619
33226
  /** {@link ElementWrapper#dispose}
32620
33227
  * @override
@@ -32778,6 +33385,9 @@ Core.prototype.getConfigObject = function (gridOptions) {
32778
33385
  if(this.hasClass("no-horizontal-grid-line")) {
32779
33386
  obj["horizontalLines"] = false;
32780
33387
  }
33388
+ if(this.hasClass("no-content-vertical-line")) {
33389
+ obj["contentVerticalLines"] = false;
33390
+ }
32781
33391
  if(this._bottomPaddingSect) {
32782
33392
  obj["contentBottomPadding"] = this._bottomPadding;
32783
33393
  }
@@ -33611,13 +34221,118 @@ Core.prototype.isColumnMoveAllowed = function (fromColIndex, toColIndex) {
33611
34221
  return true;
33612
34222
  };
33613
34223
 
34224
+ /** This method is used for checking movability of column.
34225
+ * @public
34226
+ * @param {number} colIndex Index of the column.
34227
+ * @return {boolean} Return true if the column moving is movable, and false otherwise
34228
+ */
34229
+ Core.prototype.isColumnMovable = function (colIndex) {
34230
+ var stationaryIndex = this.getStationaryColumnIndex();
34231
+
34232
+ if (stationaryIndex > -1) {
34233
+ if (colIndex <= stationaryIndex) {
34234
+ return false;
34235
+ }
34236
+ }
34237
+
34238
+ return true;
34239
+ };
34240
+
33614
34241
  /** @public
33615
- * @param {number} fromCol INCLUSIVE
34242
+ * @param {number|Array.<number>} fromCol INCLUSIVE index/indices of the column to be moved
33616
34243
  * @param {number} destCol INCLUSIVE
33617
34244
  * @return {boolean} Return true if there is any change, and false otherwise
33618
34245
  * @fires Core#columnMoved
33619
34246
  */
33620
34247
  Core.prototype.moveColumn = function (fromCol, destCol) {
34248
+ if(typeof fromCol === "number") {
34249
+ return this._moveColumn(fromCol, destCol);
34250
+ }
34251
+ if(!Array.isArray(fromCol)) {
34252
+ return false;
34253
+ }
34254
+
34255
+ // Validate user inputs
34256
+ var i;
34257
+ var len = fromCol.length;
34258
+ var colIndices = [];
34259
+ var colIndex = 0;
34260
+ var colCount = this.getColumnCount();
34261
+ var dict = {};
34262
+ for(i = 0; i < len; ++i) {
34263
+ colIndex = fromCol[i];
34264
+ if(colIndex >= 0 && colIndex < colCount) { // Filter out invalid index
34265
+ if(dict[colIndex] == null) { // Remove duplication
34266
+ dict[colIndex] = 1;
34267
+ colIndices.push(colIndex);
34268
+ }
34269
+ }
34270
+ }
34271
+ if (destCol < 0) {
34272
+ destCol = 0;
34273
+ } else if (destCol >= colCount) {
34274
+ destCol = colCount - 1;
34275
+ }
34276
+
34277
+ // Skip unneccessary cases
34278
+ len = colIndices.length;
34279
+ if(!len) {
34280
+ return false;
34281
+ }
34282
+ if(len === 1) {
34283
+ return this._moveColumn(colIndices[0], destCol);
34284
+ }
34285
+ if(!this.isColumnMoveAllowed(colIndices, destCol)) {
34286
+ return false;
34287
+ }
34288
+
34289
+ colIndices.sort(ascNumberSorter);
34290
+ if(dict[destCol]) { // Destination falls in the same place as source columns
34291
+ // Check if source columns are in continuous sequence
34292
+ var continuousSequence = true;
34293
+ colIndex = colIndices[0];
34294
+ for(i = 1; i < len; ++i) {
34295
+ if(++colIndex !== colIndices[i]) {
34296
+ continuousSequence = false;
34297
+ break;
34298
+ }
34299
+ }
34300
+ if(continuousSequence) {
34301
+ return false; // No moving operation is required
34302
+ }
34303
+ }
34304
+ var prevState = this.freezeLayout(true);
34305
+
34306
+ // Start moving multiple items
34307
+ var rhsCount = 0;
34308
+ var srcIndex, destIndex;
34309
+ // Perform move operation on the right hand side
34310
+ for(i = 0; i < len; ++i) {
34311
+ srcIndex = colIndices[i];
34312
+ if(srcIndex >= destCol) {
34313
+ destIndex = destCol + rhsCount;
34314
+ this._moveColumn(srcIndex, destIndex);
34315
+ ++rhsCount;
34316
+ }
34317
+ }
34318
+ // Perform move operation on the left hand side
34319
+ var lhsCount = len - rhsCount;
34320
+ destIndex = rhsCount ? destCol - 1 : destCol;
34321
+ for(i = 0; i < lhsCount; ++i) {
34322
+ srcIndex = colIndices[i] - i;
34323
+ this._moveColumn(srcIndex, destIndex);
34324
+ }
34325
+
34326
+ this.freezeLayout(prevState);
34327
+ return true;
34328
+ };
34329
+ /** @private
34330
+ * @param {number} fromCol INCLUSIVE
34331
+ * @param {number} destCol INCLUSIVE
34332
+ * @return {boolean} Return true if there is any change, and false otherwise
34333
+ * @fires Core#columnMoved
34334
+ */
34335
+ Core.prototype._moveColumn = function (fromCol, destCol) {
33621
34336
  var colCount = this.getColumnCount();
33622
34337
  if (fromCol < 0) { fromCol = 0; }
33623
34338
  else if (fromCol >= colCount) { fromCol = colCount - 1; }
@@ -33702,6 +34417,7 @@ Core.prototype.moveColumn = function (fromCol, destCol) {
33702
34417
  this._colVirtualizer.update();
33703
34418
  }
33704
34419
  }
34420
+ this._updateColumnBounds();
33705
34421
  return true;
33706
34422
  };
33707
34423
 
@@ -34908,6 +35624,7 @@ Core.prototype.isLayoutFrozen = function () {
34908
35624
 
34909
35625
  /** Deprecated
34910
35626
  * @public
35627
+ * @ignore
34911
35628
  * @function
34912
35629
  * @param {boolean=} opt_shown
34913
35630
  * @see {@link Core#toggleBorders}
@@ -34915,6 +35632,7 @@ Core.prototype.isLayoutFrozen = function () {
34915
35632
  Core.prototype.showBorders = util._deprecatedFunction;
34916
35633
  /** Deprecated
34917
35634
  * @public
35635
+ * @ignore
34918
35636
  * @function
34919
35637
  * @param {boolean=} opt_hidden
34920
35638
  * @see {@link Core#toggleBorders}
@@ -34948,6 +35666,14 @@ Core.prototype.toggleVerticalLines = function(forcedVal) {
34948
35666
  Core.prototype.toggleHorizontalLines = function(forcedVal) {
34949
35667
  this.toggleClass("no-horizontal-grid-line", forcedVal != null ? !forcedVal : null);
34950
35668
  };
35669
+ /** Toggle vertical gridlines. This applies to ONLY content sections.
35670
+ * @public
35671
+ * @param {boolean=} forcedVal If value is true, show horizontal lines, otherwise hide them
35672
+ */
35673
+ Core.prototype.toggleContentVerticalLines = function(forcedVal) {
35674
+ this.toggleClass("no-content-vertical-line", forcedVal != null ? !forcedVal : null);
35675
+ };
35676
+
34951
35677
 
34952
35678
  /** @public
34953
35679
  * @return {Array.<string>}
@@ -35442,6 +36168,11 @@ Core.prototype.getScrollHeight = function () {
35442
36168
  }
35443
36169
  return this._vscrollbar.getContentHeight();
35444
36170
  };
36171
+ /** @public
36172
+ */
36173
+ Core.prototype.restoreScrollbars = function () {
36174
+ this._vscrollbar.restoreTrackPosition();
36175
+ };
35445
36176
 
35446
36177
  /** @public
35447
36178
  * @ignore
@@ -35567,6 +36298,13 @@ Core.prototype.requestRowRefresh = function() {
35567
36298
  this._rowRefreshTimer = setTimeout(this._onRowRefresh, 100);
35568
36299
  }
35569
36300
  };
36301
+ /** Set a timer to call updateScrollbarHeight only once to avoid performance issue due to multiple call of _updateScrollbarHeight()
36302
+ * @public
36303
+ */
36304
+ Core.prototype._requestScrollbarUpdate = function() {
36305
+ this._updateScrollbarHeight(true, true);
36306
+ this._rowHeightTimerId = 0;
36307
+ };
35570
36308
 
35571
36309
  /** prevent bind data process
35572
36310
  * @public
@@ -35751,18 +36489,18 @@ Core.prototype.isBinding = function() {
35751
36489
  };
35752
36490
 
35753
36491
  /**
35754
- * Hide row(s) in the Grid by specifying the rId
36492
+ * Hide the specified rows by row id
35755
36493
  * @param {number | string} rowId rowId of the row to hide
35756
- * @param {boolean=} hidden if false, show instead of hide
36494
+ * @param {boolean=} hidden=true If the value is false, the specified rows will be shown.
35757
36495
  * @public
35758
36496
  */
35759
36497
  Core.prototype.hideRow = function (rowId, hidden) {
35760
36498
  this._dataSource.hideRow(rowId, hidden);
35761
36499
  };
35762
36500
  /**
35763
- * Hide row(s) in the Grid by specifying the rIds
36501
+ * Hide the specified rows by rowIds
35764
36502
  * @param {number | string | Array.<number | string>} rowIds rowId(s) of the rows to hide
35765
- * @param {boolean=} hidden if false, show instead of hide
36503
+ * @param {boolean=} hidden=true If the value is false, the specified rows will be shown.
35766
36504
  * @public
35767
36505
  */
35768
36506
  Core.prototype.hideRows = function (rowIds, hidden) {
@@ -35774,9 +36512,9 @@ Core.prototype.hideRows = function (rowIds, hidden) {
35774
36512
  };
35775
36513
 
35776
36514
  /**
35777
- * Show row(s) in the Grid by specifying the rIds
36515
+ * Show the specified rows by rowIds. To show all rows, use unhideAllRows method for better performance.
35778
36516
  * @param {number | string | Array.<number | string>} rowIds rowId(s) of the rows to show
35779
- * @param {boolean=} shown if false, hide instead of show
36517
+ * @param {boolean=} shown=true If the value is false, the specified rows will be hidden.
35780
36518
  * @public
35781
36519
  */
35782
36520
  Core.prototype.showRows = function (rowIds, shown) {
@@ -35797,7 +36535,7 @@ Core.prototype.unhideAllRows = function () {
35797
36535
 
35798
36536
  /**
35799
36537
  * @public
35800
- * @returns {boolean}
36538
+ * @return {boolean}
35801
36539
  */
35802
36540
  Core.prototype.hasHiddenRow = function () {
35803
36541
  return this._dataSource.hasHiddenRow();
@@ -35876,10 +36614,22 @@ Core.prototype._updateColumnBounds = function () {
35876
36614
  return;
35877
36615
  }
35878
36616
 
36617
+ var colCount = this.getColumnCount();
36618
+ var colIndices = [];
36619
+ var i;
36620
+ for(i = 0; i < colCount; i++) {
36621
+ if(this.isSelectedColumn(i)) {
36622
+ colIndices.push(i);
36623
+ }
36624
+ }
36625
+ var arg = {
36626
+ selectedColumns: colIndices
36627
+ };
36628
+ this._dispatch("beforeColumnBoundUpdate", arg);
36629
+
35879
36630
  var len = this.getColumnCount();
35880
36631
  var lftIdx = -1;
35881
36632
  var rgtIdx = -1;
35882
- var i;
35883
36633
  for(i = 0; i < len; ++i) {
35884
36634
  if(this.isSelectedColumn(i)) {
35885
36635
  rgtIdx = i;
@@ -35890,12 +36640,17 @@ Core.prototype._updateColumnBounds = function () {
35890
36640
  }
35891
36641
  var sectCount = this._settings.length;
35892
36642
  if(sectCount) {
35893
- var section = this._settings[0].getSection();
36643
+ var sectionSetting = this._settings[0];
36644
+ var section = sectionSetting.getSection();
35894
36645
  var positions = [0, 0];
35895
36646
  var noBorders = [false, false];
35896
36647
  section.calculateColumnBounds(lftIdx, rgtIdx, positions, noBorders);
35897
-
35898
- for (i = sectCount; --i >= 0; ) {
36648
+ var topPx = 0;
36649
+ if(sectionSetting.getType() === "title" && arg.topBoundRowIndex != null) {
36650
+ topPx = this._layoutY.getLaneStart(arg.topBoundRowIndex);
36651
+ }
36652
+ section.updateColumnBounds(positions, noBorders, topPx);
36653
+ for(i = 1; i < sectCount; i++) {
35899
36654
  section = this._settings[i].getSection();
35900
36655
  section.updateColumnBounds(positions, noBorders);
35901
36656
  }
@@ -36462,6 +37217,9 @@ Core.prototype._onSectionDataChanged = function (e) {
36462
37217
  var dataView = /** @type{DataView} */(e["dataSource"]);
36463
37218
  var hasDataView = (dataView && dataView.getDataSource()) ? 1 : 0;
36464
37219
  var rids, rowDataCollection;
37220
+
37221
+ section._startBindingSession(true);
37222
+
36465
37223
  if(hasDataView) {
36466
37224
  rids = dataView.getVisibleRowIds(true);
36467
37225
  rowDataCollection = dataView.getMultipleRowData(rids, fromR, toR);
@@ -36499,8 +37257,9 @@ Core.prototype._onSectionDataChanged = function (e) {
36499
37257
  }
36500
37258
 
36501
37259
  this._dispatch("postSectionDataBinding", e);
36502
-
36503
37260
  this._dispatchRowExpansionBinding(e);
37261
+
37262
+ section._startBindingSession(false);
36504
37263
  this._dispatchingDataChanged = false;
36505
37264
  };
36506
37265
 
@@ -36826,8 +37585,14 @@ Core.prototype._onRowHeightChanged = function (e) {
36826
37585
  this._rowHeightConflator._needScrollbarUpdate = false;
36827
37586
  this._updateScrollbarHeight(true, true);
36828
37587
  } else if(minSectionIndex >= 0) {
36829
- this._updateScrollbarHeight(minSectionIndex < this._startVScrollbarIndex,
36830
- minSectionIndex >= this._startVScrollbarIndex);
37588
+ if(this._dispatchingDataChanged){
37589
+ if(!this._rowHeightTimerId){
37590
+ this._rowHeightTimerId = setTimeout(this._requestScrollbarUpdate, 0);
37591
+ }
37592
+ } else {
37593
+ this._updateScrollbarHeight(minSectionIndex < this._startVScrollbarIndex,
37594
+ minSectionIndex >= this._startVScrollbarIndex);
37595
+ }
36831
37596
  }
36832
37597
 
36833
37598
  this._dispatchRowPositionChanged();
@@ -37055,6 +37820,10 @@ Core.prototype._updateScrollbarHeight = function (paneChanged, contentChanged, n
37055
37820
  * @param {boolean} contentChanged
37056
37821
  */
37057
37822
  Core.prototype._updateScrollbarWidth = function (paneChanged, contentChanged) {
37823
+ if (this._frozenLayout) {
37824
+ return;
37825
+ }
37826
+
37058
37827
  if (paneChanged && this._hScrollbarEnabled) {
37059
37828
  // Scroll Frame
37060
37829
  var gridElem = this.getElement();
@@ -37253,12 +38022,13 @@ Core.prototype._updateSectionIndices = function (from) {
37253
38022
 
37254
38023
  /** @private */
37255
38024
  Core.prototype._updateLayout = function () {
37256
- if(this._disposed) { return; }
38025
+ var element = this.getElement();
38026
+ if(this._disposed || !element.offsetParent) { return; }
37257
38027
 
37258
38028
  this._syncLayoutToColumns(); // Update only if need
37259
38029
 
37260
38030
  this._updateScrollbarHeight(true, true);
37261
- this._updateScrollbarWidth(true, true);
38031
+ this._updateScrollbarWidth(true, true); // WARNING this may be redundant with _syncLayoutToColumns
37262
38032
 
37263
38033
  var sectionCount = this.getSectionCount();
37264
38034
  for (var s = 0; s < sectionCount; ++s) {
@@ -37770,6 +38540,14 @@ DataConnector.prototype.removeFields = function (fieldRef, referer) {
37770
38540
  this._commitFieldsChanges();
37771
38541
  };
37772
38542
 
38543
+ /** @public
38544
+ * @param {string} referrer
38545
+ */
38546
+ DataConnector.prototype.removeFieldReferrer = function (referrer) {
38547
+ this._fields.removeReferer(referrer);
38548
+ this._commitFieldsChanges();
38549
+ };
38550
+
37773
38551
  /** @public
37774
38552
  */
37775
38553
  DataConnector.prototype.removeAllFields = function () {
@@ -38078,7 +38856,7 @@ SortableTitlePlugin.ColumnOptions;
38078
38856
  * @property {(boolean|number)=} multiColumn=false Alias to `multicolumn`
38079
38857
  * @property {boolean=} threeStatesSorting=false If enabled, sorting will cycle through ascending, descending and original order states. This option is deprecated in favor of sortingSequence option
38080
38858
  * @property {Object.<string, DataTable.SortLogic>=} sortLogic=null Custom logic for sorting based on the specified field. The key is field name and the value pair is a function.
38081
- * @property {boolean=} disableDoubleClickToSort=false If enabled, double click on column title to sort
38859
+ * @property {boolean=} disableDoubleClickToSort=true If disabled, double click will trigger sorting operation
38082
38860
  * @property {boolean=} sortableColumns=false If enabled, all columns will be sortable by field automatically
38083
38861
  * @property {boolean=} sortableIndicator=false If enabled, sort indicator (diamond) icon will always show regardless of sorting states. In Halo theme, this option will be enabled by default.
38084
38862
  * @property {boolean=} indicatorOnly=false If enabled, data will not be sorted, but the UI is rendered normally. This is useful for server side sorting.
@@ -38088,7 +38866,8 @@ SortableTitlePlugin.ColumnOptions;
38088
38866
  * @property {Function=} preClicked A shortcut to define the preClicked event handler
38089
38867
  * @property {Function=} clicked A shortcut to define the clicked event handler
38090
38868
  * @property {Function=} preDataSorting A shortcut to define the preDataSorting event handler
38091
- * @property {Array.<SortableTitlePlugin~SortOrder>=} sortingSequence=["a", "d"] Sequence in which sort order will be changed. The default value is ["a", "d"]. This option override threeStatesSorting
38869
+ * @property {Array.<SortableTitlePlugin~SortOrder>=} sortingSequence=["a", "d"] Sequence in which sort order will be changed. The default value is ["a", "d"]. This option overrides threeStatesSorting
38870
+ * @property {boolean=} rowSorting=false A flag indicating that the given sortLogic takes entire row data instead of a field value for comparison
38092
38871
  */
38093
38872
  SortableTitlePlugin.Options;
38094
38873
 
@@ -38117,7 +38896,7 @@ SortableTitlePlugin.prototype._dataSorting = true;
38117
38896
  /** @private
38118
38897
  * @type {boolean}
38119
38898
  */
38120
- SortableTitlePlugin.prototype._isDisableDoubleClickToSort = true;
38899
+ SortableTitlePlugin.prototype._dblClickAllowed = false;
38121
38900
 
38122
38901
  /** @private
38123
38902
  * @type {number}
@@ -38260,19 +39039,20 @@ SortableTitlePlugin.prototype.unload = function (host) {
38260
39039
  SortableTitlePlugin.prototype.afterInit = function () {
38261
39040
  var t = this;
38262
39041
 
38263
- // Data source not available during initialization
39042
+ // Set logic to the data source, since the data source not available during the initialization
38264
39043
  t.setSortLogics(t._sortLogic);
38265
39044
 
38266
- // Sort columns if initialSort are specified initially
38267
- if (t._initialSort != null) {
38268
- var initialSort = t._initialSort;
38269
- if (!Array.isArray(initialSort)) {
38270
- initialSort = [initialSort];
38271
- }
38272
- if (t._maxCount === 1) {
38273
- initialSort = initialSort.slice(0, 1); // Ensure only 1 item is sorted in non-multiColumn mode
39045
+ var userInput = t._initialSort;
39046
+ if (userInput != null) {
39047
+ if(Array.isArray(userInput)) {
39048
+ if(t._maxCount === 1) { // TODO: max count could be part of sortColumns method
39049
+ t.sortColumns(userInput.slice(0, 1));
39050
+ } else {
39051
+ t.sortColumns(userInput);
39052
+ }
39053
+ } else {
39054
+ t.sortColumns([userInput]);
38274
39055
  }
38275
- t.sortColumns(initialSort);
38276
39056
  }
38277
39057
  };
38278
39058
 
@@ -38450,7 +39230,9 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
38450
39230
  if(this._maxCount !== 1) {
38451
39231
  extOptions["multiColumn"] = this._maxCount === -1 ? true : this._maxCount;
38452
39232
  }
38453
- extOptions["disableDoubleClickToSort"] = this._isDisableDoubleClickToSort;
39233
+ if(this._dblClickAllowed) {
39234
+ extOptions["disableDoubleClickToSort"] = !this._dblClickAllowed;
39235
+ }
38454
39236
  extOptions["sortableColumns"] = this._sortableColumns;
38455
39237
  extOptions["indicatorOnly"] = !this._dataSorting;
38456
39238
  // extOptions["mode"] = this._mode;
@@ -38823,9 +39605,10 @@ SortableTitlePlugin.prototype.getColumnSortingField = function (colIndex) {
38823
39605
  * @public
38824
39606
  * @param {number} colIndex
38825
39607
  * @param {string|null} field A field used for sorting
38826
- * @param {Function=} sortLogic
39608
+ * @param {Function=} sortLogic=null
39609
+ * @param {boolean=} rowSorting=false A flag indicating that the given sortLogic takes entire row data instead of a field value for comparison
38827
39610
  */
38828
- SortableTitlePlugin.prototype.setColumnSortingField = function (colIndex, field, sortLogic) {
39611
+ SortableTitlePlugin.prototype.setColumnSortingField = function (colIndex, field, sortLogic, rowSorting) {
38829
39612
  if (typeof colIndex == "number" && field != null) {
38830
39613
  var options = this._newSortOptions(colIndex);
38831
39614
  if (!field) {
@@ -38837,6 +39620,9 @@ SortableTitlePlugin.prototype.setColumnSortingField = function (colIndex, field,
38837
39620
  if(sortLogic != null && !this._userManagedLogic) {
38838
39621
  if (options["sortLogic"] !== sortLogic) {
38839
39622
  options["sortLogic"] = sortLogic || null;
39623
+ if(rowSorting && sortLogic) {
39624
+ sortLogic["rowSorting"] = true; // Tell data view/table about the argument
39625
+ }
38840
39626
  }
38841
39627
  }
38842
39628
  }
@@ -38936,10 +39722,10 @@ SortableTitlePlugin.prototype.disableDataSorting = function (disabled) {
38936
39722
  };
38937
39723
  /** @public
38938
39724
  * @description To allow double click action to sort. Default value is false.
38939
- * @param {boolean=} disabled
39725
+ * @param {boolean=} disabled=false
38940
39726
  */
38941
39727
  SortableTitlePlugin.prototype.disableDoubleClickToSort = function (disabled) {
38942
- this._isDisableDoubleClickToSort = !!disabled;
39728
+ this._dblClickAllowed = !disabled;
38943
39729
  };
38944
39730
  /** This api is deprecated. Use {@link SortableTitlePlugin.prototype.disableColumnSorting} instead
38945
39731
  * @public
@@ -38985,54 +39771,26 @@ SortableTitlePlugin.prototype.setClickDelayInterval = function (opt_ms) {
38985
39771
  this._delayInterval = (opt_ms != null) ? opt_ms : 500;
38986
39772
  };
38987
39773
 
38988
- /** @private
38989
- * @description Pre-process columns options to support both composite and rt-grid backward compatible
38990
- * @param {number} colIndex
38991
- * @param {Object} options
38992
- * @returns {Object}
38993
- */
38994
- SortableTitlePlugin.prototype._prepareColumnOptions = function (colIndex, options) {
38995
- var t = this;
38996
- var column = options || {};
38997
- var colOption = {
38998
- "colIndex": colIndex,
38999
- "field": column["field"],
39000
- "sortable": !!t._sortableColumns
39001
- };
39002
-
39003
- if (column["sortBy"] != null) { // composite grid option
39004
- colOption["sortable"] = !!column["sortBy"];
39005
- colOption["sortBy"] = column["sortBy"];
39006
- }
39007
- if (column["sortable"] != null) { // rt grid option
39008
- colOption["sortable"] = !!column["sortable"];
39009
- }
39010
-
39011
- colOption["sortLogic"] = column["sortLogic"] || column["sortingLogic"] || column["sorter"]; // Originally, rt grid support option for sortLogic by column
39012
- colOption["sort"] = column["defaultSort"] || column["sort"]; // composite and rt grid option for default sort order
39013
- return colOption;
39014
- };
39015
-
39016
39774
  /** @private
39017
39775
  * @description Get initial sort from column option `defaultSort` or `sort`
39018
39776
  * @param {Object} options Core model object
39019
39777
  * @returns {Object}
39020
39778
  */
39021
39779
  SortableTitlePlugin.prototype._initialSortByColumnField = function (options) {
39022
- var t = this;
39023
- var columns = options["columns"] || [];
39024
- var initialSort = null;
39025
- for (var i = 0; i < columns.length; i++) {
39026
- var col = t._prepareColumnOptions(i, columns[i]);
39027
- var val = col["sort"];
39028
- if (val) {
39029
- initialSort = {
39030
- "colIndex": col["colIndex"],
39031
- "sortOrder": val
39780
+ var columns = options["columns"];
39781
+ var colCount = columns ? columns.length : 0;
39782
+ for (var i = 0; i < colCount; i++) {
39783
+ var column = columns[i];
39784
+ var sortOrder = column["defaultSort"] || column["sort"]; // composite and rt grid option for default sort order
39785
+ if (sortOrder) {
39786
+ // TODO: Support multi-column sorting
39787
+ return {
39788
+ "colIndex": i,
39789
+ "sortOrder": sortOrder
39032
39790
  };
39033
39791
  }
39034
39792
  }
39035
- return initialSort;
39793
+ return null;
39036
39794
  };
39037
39795
 
39038
39796
  /** @private
@@ -39143,7 +39901,7 @@ SortableTitlePlugin.prototype._onClickTitle = function (grid, e) {
39143
39901
  if(this._disabled) {
39144
39902
  return;
39145
39903
  }
39146
- if (e.detail === 2 && this._isDisableDoubleClickToSort) { // dblclick
39904
+ if (e.detail === 2 && !this._dblClickAllowed) { // dblclick
39147
39905
  if (this._clickTimer) {
39148
39906
  clearTimeout(this._clickTimer);
39149
39907
  this._clickTimer = 0;
@@ -39421,18 +40179,35 @@ SortableTitlePlugin.prototype._sortColumn = function (states, opt_arg) {
39421
40179
  SortableTitlePlugin.prototype._onColumnAdded = function (e) {
39422
40180
  var t = this;
39423
40181
  var colIndex = e["colIndex"];
39424
- var context = e["context"];
39425
- var col = t._prepareColumnOptions(colIndex, context);
39426
- var field = col["sortBy"] || col["field"];
39427
- var logic = col["sortLogic"] || t._sortLogic[field];
40182
+ var column = e["context"] || {};
40183
+
40184
+ var sortable = !!t._sortableColumns;
40185
+ var field = column["field"];
40186
+ var sortBy = column["sortBy"];
40187
+
40188
+ if (sortBy != null) { // composite grid option
40189
+ sortable = !!sortBy;
40190
+ field = sortBy;
40191
+ }
40192
+ if (column["sortable"] != null) { // rt grid option
40193
+ sortable = !!column["sortable"];
40194
+ }
40195
+
40196
+ var sortLogic = column["sortLogic"] || column["sortingLogic"] || column["sorter"]; // Originally, rt grid support option for sortLogic by column
40197
+ if(!sortLogic) {
40198
+ sortLogic = t._sortLogic[field];
40199
+ }
40200
+ if(typeof sortLogic !== "function") {
40201
+ sortLogic = null;
40202
+ }
39428
40203
 
39429
- var sortingSequence = context ? context["sortingSequence"] : null;
40204
+ var sortingSequence = column["sortingSequence"];
39430
40205
  if (sortingSequence != null && field) { // Make sure that column config does not affect grid level config
39431
40206
  t.setSortingSequence(sortingSequence, field);
39432
40207
  }
39433
40208
 
39434
- if (col["sortable"]) {
39435
- t.setColumnSortingField(colIndex, field, typeof logic === "function" ? logic : null);
40209
+ if (sortable) { // TODO: Check if empty field should be sortable
40210
+ t.setColumnSortingField(colIndex, field, sortLogic, column["rowSorting"]);
39436
40211
  } else {
39437
40212
  t.disableColumnSorting(colIndex, true);
39438
40213
  }
@@ -39780,6 +40555,11 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
39780
40555
  * @property {boolean=} debug=false If true, Synapse response will be mock
39781
40556
  */
39782
40557
 
40558
+ /** @typedef {Object} Grid~ADCOptions
40559
+ * @description ADC requesting level config from adc team
40560
+ * @property {string=} productId=001 required parameter, it specifies the product for which you request data. Contact the adc staff to create one.
40561
+ */
40562
+
39783
40563
  /** @typedef {Object} Grid~GridOptions
39784
40564
  * @description Configuration object that can be provided directly at the initialization phase
39785
40565
  * @property {Array.<ColumnDefinition~Options|string>=} columns Collection of the column definitions
@@ -39812,8 +40592,10 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
39812
40592
  * @property {boolean=} borders=true Lines around grid element
39813
40593
  * @property {boolean=} gridlines=true Horizontal and Vertical lines for ONLY content sections
39814
40594
  * @property {boolean=} verticalLines=true Vertical lines for all sections
40595
+ * @property {boolean=} contentVerticalLines=true Vertical lines for all content section
39815
40596
  * @property {boolean=} horizontalLines=true Horizontal lines for all sections
39816
40597
  * @property {*=} RTK=null rtk toolkit instance
40598
+ * @property {Grid~ADCOptions=} ADC=null ADC requesting level config object from adc team
39817
40599
  * @property {Grid~SynapseConfig=} synapse=null synapse config object
39818
40600
  * @property {number=} contentRightPadding=0 Padding that is added next to the right most column. The padding is still a part of scrollable content.
39819
40601
  * @property {number=} contentBottomPadding=0 Padding that is added below the last section. The padding is still a part of scrollable content.
@@ -39825,6 +40607,7 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
39825
40607
  * @property {Element=} scrollbarParent=null Element to be attached by grid's scrollbars, allowing them to move outside and avoid overlapping with the content.
39826
40608
  * @property {boolean=} formulaEngine=false If enabled, field with leading equal sign will be treated as a formula and rows will be filled with the calculated values.
39827
40609
  * @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
40610
+ * @property {boolean=} fieldCaching=false If enabled, field definition will be caching internal mechanism
39828
40611
  */
39829
40612
 
39830
40613
  /** @typedef {number|string|RowDefinition} Grid~RowReference
@@ -39837,7 +40620,7 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
39837
40620
  /** @typedef {number|string|ColumnDefinition} Grid~ColumnReference
39838
40621
  * @description A column in Grid can be referred by the following values:<br>
39839
40622
  * <b>number</b> : Column index including all invisible (hidden) columns<br>
39840
- * <b>string</b> : Field name of the column<br>
40623
+ * <b>string</b> : Field name or column id of the column<br>
39841
40624
  * <b>ColumnDefinition</b> : Column definition object<br>
39842
40625
  */
39843
40626
 
@@ -39933,25 +40716,6 @@ var cloneRowData = function(fromRowDef, toRowDef) {
39933
40716
  }
39934
40717
  };
39935
40718
 
39936
- /** @private
39937
- * @param {number} a
39938
- * @param {number} b
39939
- * @return {number}
39940
- */
39941
- var ascNumberSorter = function (a, b) {
39942
- return a - b;
39943
- };
39944
-
39945
- /** @private
39946
- * @param {number} min
39947
- * @param {number} max
39948
- * @param {number} elem
39949
- * @return {boolean}
39950
- */
39951
- var inRangeFilter = function (min, max, elem) {
39952
- return elem >= min && elem <= max;
39953
- };
39954
-
39955
40719
  /** @private
39956
40720
  * @param {string} sortField
39957
40721
  * @param {Object} elemData
@@ -40204,6 +40968,10 @@ Grid.prototype._defaultColumnOptions = null;
40204
40968
  * @type {*}
40205
40969
  */
40206
40970
  Grid.prototype._RTK = null;
40971
+ /** @private
40972
+ * @type {Grid~ADCOptions}
40973
+ */
40974
+ Grid.prototype._ADCOptions = null;
40207
40975
  /** use for synapse service
40208
40976
  * @private
40209
40977
  * @type {string}
@@ -40245,6 +41013,10 @@ Grid.prototype._lastPollingRequest = 0;
40245
41013
  * @private
40246
41014
  */
40247
41015
  Grid.prototype._pollingEnabled = true;
41016
+ /** @type {boolean}
41017
+ * @private
41018
+ */
41019
+ Grid.prototype._fieldCaching = false;
40248
41020
 
40249
41021
 
40250
41022
  /** @public
@@ -40478,11 +41250,22 @@ Grid.prototype.initialize = function(gridOption) {
40478
41250
  t._RTK = gridOption["RTK"];
40479
41251
  t._snapshot.setRTK(t._RTK);
40480
41252
  }
41253
+
41254
+ if (gridOption["ADC"]) {
41255
+ t._ADCOptions = gridOption["ADC"];
41256
+ t._snapshot.setADCOptions(t._ADCOptions);
41257
+ }
41258
+
40481
41259
  if (gridOption["synapse"]) {
40482
41260
  t._synapse = gridOption["synapse"];
40483
41261
  js_FieldDefinition.setSynapseConfig(t._synapse);
40484
41262
  }
40485
41263
 
41264
+ if (gridOption["fieldCaching"]) {
41265
+ t._fieldCaching = gridOption["fieldCaching"];
41266
+ js_FieldDefinition.setFieldCaching(t._fieldCaching);
41267
+ }
41268
+
40486
41269
  if (gridOption["icons"] && gridOption["icons"]["rowGrouping"] && gridOption["icons"]["rowGrouping"]["expander"]) {
40487
41270
  js_StyleLoader.chainIcon = gridOption["icons"]["rowGrouping"]["expander"];
40488
41271
  }
@@ -40505,6 +41288,10 @@ Grid.prototype.initialize = function(gridOption) {
40505
41288
  if (vLines != null) {
40506
41289
  grid.toggleVerticalLines(vLines);
40507
41290
  }
41291
+ var cvLines = gridOption["contentVerticalLines"];
41292
+ if (cvLines != null) {
41293
+ grid.toggleContentVerticalLines(cvLines);
41294
+ }
40508
41295
  var hLines = gridOption["horizontalLines"];
40509
41296
  if (hLines != null) {
40510
41297
  grid.toggleHorizontalLines(hLines);
@@ -40793,11 +41580,14 @@ Grid.prototype.getConfigObject = function (gridOptions) {
40793
41580
  if(this._pollingInterval) {
40794
41581
  obj["adcPollingInterval"] = this._pollingInterval;
40795
41582
  }
41583
+ if(this._fieldCaching) {
41584
+ obj["fieldCaching"] = this._fieldCaching;
41585
+ }
40796
41586
 
40797
41587
  // get all rows config
40798
41588
  var rowDefs = this.getAllRowDefinitions();
40799
41589
  var rows = obj["rows"] = [];
40800
- var rowDef, rowConfig, pluginInstance, retObj, row;
41590
+ var rowDef, rowConfig;
40801
41591
  len = rowDefs.length;
40802
41592
  for (i = 0; i < len; i++) {
40803
41593
  rowDef = rowDefs[i];
@@ -40807,6 +41597,7 @@ Grid.prototype.getConfigObject = function (gridOptions) {
40807
41597
 
40808
41598
  // get row config from extensions
40809
41599
  var extensions = grid.getPlugins();
41600
+ var pluginInstance, row;
40810
41601
  for(var key in extensions) {
40811
41602
  pluginInstance = extensions[key];
40812
41603
  if(typeof pluginInstance["getRowConfigObject"] === "function") {
@@ -40814,15 +41605,7 @@ Grid.prototype.getConfigObject = function (gridOptions) {
40814
41605
  for (i = 0; i < len; i++) {
40815
41606
  rowDef = rowDefs[i];
40816
41607
  row = rows[i];
40817
- retObj = pluginInstance["getRowConfigObject"](rowDef.getRowId());
40818
- if(retObj) {
40819
- if(row.values) {
40820
- // eslint-disable-next-line es5/no-es6-static-methods
40821
- Object.assign(row.values, retObj); // Ignore lint
40822
- } else {
40823
- row.values = retObj;
40824
- }
40825
- }
41608
+ pluginInstance["getRowConfigObject"](row, rowDef.getRowId());
40826
41609
  }
40827
41610
  }
40828
41611
  }
@@ -40833,7 +41616,7 @@ Grid.prototype.getConfigObject = function (gridOptions) {
40833
41616
  // topFreezingCount, bottomFreezingCount
40834
41617
  // scrollbarParent
40835
41618
 
40836
- // NOTE: no need to export synapseApiKey and RTK
41619
+ // NOTE: no need to export synapseApiKey, ADC and RTK
40837
41620
 
40838
41621
  return obj;
40839
41622
  };
@@ -40994,6 +41777,70 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
40994
41777
  };
40995
41778
 
40996
41779
 
41780
+ /** @public
41781
+ * @param {ColumnDefinition~Options|string} columnOption String will be treated as field, while object is treated as the column options
41782
+ * @param {Grid~ColumnReference} colRef
41783
+ */
41784
+ Grid.prototype.replaceColumn = function (columnOption, colRef) {
41785
+ var colIndex = this.getColumnIndex(colRef);
41786
+ if(colIndex < 0) {
41787
+ return;
41788
+ }
41789
+ var colConfig = {};
41790
+ var core = this._grid;
41791
+ var columnDef = core._getColumnDef(colIndex);
41792
+
41793
+ var value = core.getColumnScalability(colIndex);
41794
+ colConfig["scalable"] = value;
41795
+
41796
+ value = core.getColumnCustomLaneSize(colIndex);
41797
+ colConfig["width"] = value;
41798
+
41799
+ value = core.getMinimumColumnWidth(colIndex);
41800
+ if(value !== 32) {
41801
+ colConfig["minWidth"] = value;
41802
+ }
41803
+
41804
+ value = core.isColumnVisible(colIndex);
41805
+ if(!value) {
41806
+ colConfig["hidden"] = true;
41807
+ }
41808
+
41809
+ value = columnDef["stationary"];
41810
+ if (value) {
41811
+ colConfig["stationary"] = value;
41812
+ }
41813
+
41814
+ value = columnDef["leftPinned"];
41815
+ if (value) {
41816
+ colConfig["leftPinned"] = value;
41817
+ }
41818
+
41819
+ value = columnDef["rightPinned"];
41820
+ if (value) {
41821
+ colConfig["rightPinned"] = value;
41822
+ }
41823
+
41824
+ if(typeof columnOption === "string") {
41825
+ colConfig["field"] = columnOption;
41826
+ } else { // type object from user
41827
+ for (var key in columnOption) {
41828
+ colConfig[key] = columnOption[key];
41829
+ }
41830
+ }
41831
+
41832
+ if(columnOption["width"] && !columnOption["scalable"]) {
41833
+ colConfig["scalable"] = false;
41834
+ }
41835
+
41836
+ if(columnOption["scalable"] && !columnOption["width"]) {
41837
+ colConfig["width"] = 1;
41838
+ }
41839
+
41840
+ this.insertColumn(colConfig, colIndex);
41841
+ this.removeColumn(colIndex + 1); // remove existing column after insert
41842
+ };
41843
+
40997
41844
  /** to update column name when field info is loaded
40998
41845
  * @private
40999
41846
  * @param {string} field
@@ -41290,78 +42137,7 @@ Grid.prototype.removeAllColumns = function() {
41290
42137
  * @return {boolean} Return true if there is any change, and false otherwise
41291
42138
  */
41292
42139
  Grid.prototype.moveColumn = function (fromColIndex, toColIndex) {
41293
- //Wrap single index to array
41294
- if (!Array.isArray(fromColIndex)) {
41295
- fromColIndex = [fromColIndex];
41296
- }
41297
-
41298
- var columnCount = this._grid.getColumnCount();
41299
- var lastColIndex = columnCount - 1;
41300
- fromColIndex.sort(ascNumberSorter);
41301
- fromColIndex = fromColIndex.filter(inRangeFilter.bind(null, 0, lastColIndex));
41302
-
41303
- if (!this._grid.isColumnMoveAllowed(fromColIndex, toColIndex)) {
41304
- return false;
41305
- }
41306
-
41307
- var frozen = this._grid.isLayoutFrozen();
41308
- this._grid.freezeLayout(true);
41309
-
41310
- var marker = [];
41311
- var runner = 0;
41312
- var i;
41313
- for (i = 0; i < columnCount; i++) {
41314
- if (i == fromColIndex[runner]) {
41315
- marker.push(true);
41316
- runner++;
41317
- } else {
41318
- marker.push(false);
41319
- }
41320
- }
41321
- //Find the index to be moved to
41322
- var counter = -1;
41323
- var toMoveTo = -1;
41324
-
41325
- for (i = 0; i < columnCount; i++) {
41326
- if (marker[i] === false) {
41327
- counter++;
41328
- }
41329
-
41330
- if (counter === toColIndex) {
41331
- toMoveTo = i;
41332
- break;
41333
- }
41334
- }
41335
-
41336
- //If toMoveTo == -1, it means the target column index is beyond the last colmn so just move the columns
41337
- //to the end of the table
41338
- if (toMoveTo === -1) {
41339
- toMoveTo = columnCount;
41340
- }
41341
-
41342
- //Perform moving
41343
- var leftList = [], rightList = [];
41344
-
41345
- for (i = 0; i < fromColIndex.length; i++) {
41346
- if (fromColIndex[i] < toMoveTo) {
41347
- leftList.push(fromColIndex[i]);
41348
- } else if (fromColIndex[i] > toMoveTo) {
41349
- rightList.push(fromColIndex[i]);
41350
- }
41351
- }
41352
-
41353
- for (i = 0; i < rightList.length; i++) {
41354
- this._grid.moveColumn(rightList[i], toMoveTo + i);
41355
- }
41356
-
41357
- for (i = leftList.length - 1; i >= 0; i--) {
41358
- toMoveTo--;
41359
-
41360
- this._grid.moveColumn(leftList[i], toMoveTo);
41361
- }
41362
-
41363
- this._grid.freezeLayout(frozen);
41364
- return true;
42140
+ return this._grid.moveColumn(fromColIndex, toColIndex);
41365
42141
  };
41366
42142
 
41367
42143
  /** The hidden column still occupies the same index.
@@ -41426,7 +42202,7 @@ Grid.prototype.addDataFields = function(fieldRef, referrer) {
41426
42202
 
41427
42203
  if(!dataType) {
41428
42204
  // wait field-info to be loaded before adding field
41429
- onLoaded = this._onFieldLoaded.bind(this, field);
42205
+ onLoaded = this._onFieldLoaded.bind(this, field, referrer);
41430
42206
  prom = prom.then(onLoaded).catch(onLoaded);
41431
42207
  } else {
41432
42208
  this._connector.addFields(field, referrer || "grid");
@@ -41452,6 +42228,16 @@ Grid.prototype.removeDataFields = function(fieldRef, referrer) {
41452
42228
  this._connector.removeFields(fieldRef, referrer || "grid");
41453
42229
  return true;
41454
42230
  };
42231
+ /** @public
42232
+ * @param {string} referrer
42233
+ */
42234
+ Grid.prototype.removeFieldReferrer = function(referrer) {
42235
+ if(!referrer) {
42236
+ return;
42237
+ }
42238
+
42239
+ this._connector.removeFieldReferrer(referrer);
42240
+ };
41455
42241
 
41456
42242
  /** @public
41457
42243
  * @param {Grid~ColumnReference} colRef
@@ -42078,6 +42864,40 @@ Grid.prototype.getColumnDefinition = function(colIndex) {
42078
42864
  }
42079
42865
  return null;
42080
42866
  };
42867
+
42868
+ /** @public
42869
+ * @param {string} colId
42870
+ * @return {ColumnDefinition}
42871
+ */
42872
+ Grid.prototype.getColumnDefinitionById = function(colId) {
42873
+ if(typeof colId === "string") {
42874
+ var colIndex = this.getColumnIndex(colId);
42875
+ var colData = this._grid.getColumnData(colIndex);
42876
+ if(colData) {
42877
+ return /** @type{ColumnDefinition} */(colData[COL_DEF]) || null;
42878
+ }
42879
+ }
42880
+ return null;
42881
+ };
42882
+
42883
+ /** @public
42884
+ * @param {Array.<string>} colIds
42885
+ * @return {ColumnDefinition}
42886
+ */
42887
+ Grid.prototype.getColumnDefinitionsById = function(colIds) {
42888
+ var colCount = Array.isArray(colIds) ? colIds.length : 0;
42889
+ if(colCount > 0) {
42890
+ var i, colId;
42891
+ var colDefs = new Array(colCount);
42892
+ for(i = 0; i < colCount; i++) {
42893
+ colId = colIds[i];
42894
+ colDefs[i] = this.getColumnDefinitionById(colId);
42895
+ }
42896
+ return colDefs;
42897
+ }
42898
+ return null;
42899
+
42900
+ };
42081
42901
  /** @private
42082
42902
  * @param {Grid~ColumnReference} colRef
42083
42903
  * @return {ColumnDefinition}
@@ -42091,7 +42911,7 @@ Grid.prototype._getColumnDefinition = function(colRef) {
42091
42911
  var colCount = this.getColumnCount();
42092
42912
  for(var i = 0; i < colCount; ++i) {
42093
42913
  var colDef = this.getColumnDefinition(i);
42094
- if(colDef.getField() === colRef) {
42914
+ if(colDef.getField() === colRef || colDef.getId() === colRef) {
42095
42915
  return colDef; // Return the first found field
42096
42916
  }
42097
42917
  }
@@ -42283,7 +43103,7 @@ Grid.prototype.getColumnIndex = function(colRef) {
42283
43103
  } else if(typeof colRef === "string") {
42284
43104
  for(i = 0; i < colCount; ++i) {
42285
43105
  colDef = this.getColumnDefinition(i);
42286
- if(colDef.getField() === colRef) {
43106
+ if(colDef.getField() === colRef || colDef.getId() === colRef) {
42287
43107
  return i; // Return the first found field
42288
43108
  }
42289
43109
  }
@@ -45117,6 +45937,11 @@ var dataGen = new DataGenerator();
45117
45937
  */
45118
45938
  var DataGrid = {};
45119
45939
 
45940
+ /** @private
45941
+ * @namespace
45942
+ */
45943
+ var Adc = {};
45944
+
45120
45945
  /** @private
45121
45946
  * @function
45122
45947
  * @param {Object} payload
@@ -45195,6 +46020,97 @@ DataGrid.request = function (payload, mockResponse) {
45195
46020
  }));
45196
46021
  };
45197
46022
 
46023
+ /** @private
46024
+ * @function
46025
+ * @param {Object} payload
46026
+ * @param {Object=} mockResponse
46027
+ * @return {Promise}
46028
+ */
46029
+ Adc.request = function (payload, mockResponse) {
46030
+ if (mockResponse) {
46031
+ return Promise.resolve(JSON.stringify(mockResponse));
46032
+ }
46033
+
46034
+ var i, f, len, row;
46035
+ var identifiers = payload.identifiers;
46036
+ var formula = payload.formula.split(",");
46037
+ var fields = [];
46038
+
46039
+ // _invalidFieldDict is a dictionary of non exist field
46040
+ // so we must remove invalid field to make "mocking api" return result more like a "real api".
46041
+ var invalidDict = _invalidFieldDict;
46042
+ for (i = 0; i < formula.length; i++) {
46043
+ f = formula[i];
46044
+ if (!invalidDict[f]) {
46045
+ fields.push(f);
46046
+ }
46047
+ }
46048
+
46049
+ // build row header
46050
+ var rows = [];
46051
+ rows[0] = [{
46052
+ "h": true,
46053
+ "i": "instrument",
46054
+ "v": "Instrument"
46055
+ }];
46056
+ for (i = 0; i < fields.length; i++) {
46057
+ f = fields[i];
46058
+ rows[0].push({
46059
+ "h": true,
46060
+ "r": f.toUpperCase()
46061
+ // "v": "Price Close", // Doesn't use
46062
+ // "p": "I_TRP_PH_PriceClose" // Doesn't use this property
46063
+ });
46064
+ }
46065
+
46066
+ // build data
46067
+ var rowMap = {};
46068
+
46069
+ len = identifiers.length;
46070
+ var rowData = dataGen.generate(fields, len);
46071
+ for (i = 0; i < len; ++i) {
46072
+ var inst = identifiers[i];
46073
+ row = rowMap[inst];
46074
+ if (!row) {
46075
+ row = rowMap[inst] = rowData[i];
46076
+ row.unshift(inst); // prepend instrument on each row
46077
+ }
46078
+ rows.push(row);
46079
+ }
46080
+
46081
+ // There is a chance that rtk will return multiple row data per instrument
46082
+ // so we must create mock up for this case
46083
+ if (rows.length > 0) {
46084
+ var chance = dataGen.randInt(1, 10);
46085
+ if (chance <= 3) { // chance 30%
46086
+ var pos = dataGen.randInt(0, rows.length - 1); // random row pos
46087
+ row = rows[pos];
46088
+ len = row.length;
46089
+ var mockupRow = new Array(len);
46090
+ mockupRow[0] = row[0]; // 1st index is for instrument
46091
+ for (i = 1; i < len; i++) {
46092
+ mockupRow[i] = ''; // real case will return null or empty string
46093
+ }
46094
+ rows.splice(pos + 1, 0, mockupRow);
46095
+ }
46096
+ }
46097
+
46098
+ /*
46099
+ response type is :
46100
+ {
46101
+ cols: number,
46102
+ faults: Array<obj>,
46103
+ rows: Array<obj>,
46104
+ status: string
46105
+ }
46106
+ Currently, we use only the rows property for cache ADC data
46107
+ */
46108
+ return Promise.resolve(JSON.stringify({
46109
+ rows: rows
46110
+ // TODO : supports faults property
46111
+ }));
46112
+ };
46113
+
45198
46114
  /** @public
45199
46115
  * @function
45200
46116
  * @param {string} dataType
@@ -45203,6 +46119,8 @@ DataGrid.request = function (payload, mockResponse) {
45203
46119
  var mockDataAPI = function (dataType) {
45204
46120
  if (dataType === "datagrid") {
45205
46121
  return Promise.resolve(DataGrid);
46122
+ } else if(dataType === "adc") {
46123
+ return Promise.resolve(Adc);
45206
46124
  } else {
45207
46125
  return Promise.reject(dataType + " is not supported.");
45208
46126
  }
@@ -45554,7 +46472,7 @@ CellPainter.prototype.clearHeatMap = function() {
45554
46472
 
45555
46473
  /** @public */
45556
46474
  CellPainter.prototype.applyThemeColor = function() {
45557
- var colors = ElfUtil.themeColors;
46475
+ var colors = ElfUtil.getColors();
45558
46476
  var cond = this._conditions[0]; // Heatmap, color text condition must be the first
45559
46477
  if(cond) {
45560
46478
  if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) { // Heatmap uses grid color to blend the result color
@@ -46141,16 +47059,13 @@ CellPainter.themeChanged = function() {};
46141
47059
  CellPainter.setThemeColors = function() {};
46142
47060
  /** @private
46143
47061
  * @function
46144
- * @param {Object} colors
46145
- * @return {Object} colors
46146
47062
  */
46147
- CellPainter._onThemeChanged = function(colors) {
47063
+ CellPainter._onThemeChanged = function() {
46148
47064
  // Apply newly changed theme to all the painters
46149
47065
  var painters = CellPainter._painters;
46150
47066
  for(var i = painters.length; --i >= 0;) {
46151
47067
  painters[i].applyThemeColor(); // Re-apply theme color
46152
47068
  }
46153
- return colors;
46154
47069
  };
46155
47070
  /** Load theme colors and change colors for all instances of CellPainter
46156
47071
  * @public
@@ -46159,7 +47074,9 @@ CellPainter._onThemeChanged = function(colors) {
46159
47074
  */
46160
47075
  CellPainter.loadThemeColors = function() {
46161
47076
  if(!CellPainter.themeReady) {
46162
- CellPainter.themeReady = ElfUtil.getThemeColors().then(CellPainter._onThemeChanged);
47077
+ CellPainter.themeReady = ElfUtil.getThemeColors(CellPainter._onThemeChanged)
47078
+ .then(CellPainter._onThemeChanged)
47079
+ .catch(CellPainter._onThemeChanged);
46163
47080
  }
46164
47081
  return CellPainter.themeReady;
46165
47082
  };
@@ -46170,8 +47087,10 @@ CellPainter.loadThemeColors = function() {
46170
47087
  * @return {Promise<Object>}
46171
47088
  */
46172
47089
  CellPainter.reloadThemeColors = function () {
46173
- CellPainter.themeReady = ElfUtil.themeReady = null;
46174
- return CellPainter.loadThemeColors();
47090
+ CellPainter.themeReady = ElfUtil.reloadThemeColors()
47091
+ .then(CellPainter._onThemeChanged)
47092
+ .catch(CellPainter._onThemeChanged);
47093
+ return CellPainter.themeReady;
46175
47094
  };
46176
47095
 
46177
47096
  /** @public