@refinitiv-ui/efx-grid 6.0.1 → 6.0.4

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 (268) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.d.ts +49 -0
  2. package/lib/column-dragging/es6/ColumnDragging.js +764 -0
  3. package/lib/column-dragging/es6/index.d.ts +1 -0
  4. package/lib/column-dragging/es6/index.js +1 -0
  5. package/lib/column-format-dialog/lib/column-format-dialog.d.ts +13 -1
  6. package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +15 -2
  7. package/lib/column-selection-dialog/lib/column-selection-dialog.js +226 -23
  8. package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
  9. package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
  10. package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
  11. package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
  12. package/lib/core/dist/core.css +1 -1
  13. package/lib/core/dist/core.js +17835 -16266
  14. package/lib/core/dist/core.min.js +1 -1
  15. package/lib/core/es6/data/ColumnStats.d.ts +2 -2
  16. package/lib/core/es6/data/DataCache.d.ts +4 -4
  17. package/lib/core/es6/data/DataTable.d.ts +5 -5
  18. package/lib/core/es6/data/DataTable.js +33 -11
  19. package/lib/core/es6/data/DataView.d.ts +26 -17
  20. package/lib/core/es6/data/DataView.js +172 -49
  21. package/lib/core/es6/data/Segment.d.ts +2 -0
  22. package/lib/core/es6/data/Segment.js +7 -0
  23. package/lib/core/es6/data/SegmentCollection.d.ts +3 -3
  24. package/lib/core/es6/data/WrappedView.d.ts +289 -0
  25. package/lib/core/es6/data/WrappedView.js +1319 -0
  26. package/lib/core/es6/grid/Core.d.ts +42 -27
  27. package/lib/core/es6/grid/Core.js +431 -163
  28. package/lib/core/es6/grid/ILayoutGrid.d.ts +23 -15
  29. package/lib/core/es6/grid/ILayoutGrid.js +45 -2
  30. package/lib/core/es6/grid/LayoutGrid.d.ts +10 -1
  31. package/lib/core/es6/grid/LayoutGrid.js +311 -108
  32. package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +10 -1
  33. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +382 -24
  34. package/lib/core/es6/grid/components/Cell.d.ts +4 -4
  35. package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +1 -1
  36. package/lib/core/es6/grid/components/CellSpans.d.ts +8 -8
  37. package/lib/core/es6/grid/components/Column.d.ts +1 -1
  38. package/lib/core/es6/grid/components/Column.js +8 -2
  39. package/lib/core/es6/grid/components/ElementWrapper.d.ts +6 -6
  40. package/lib/core/es6/grid/components/HScrollbar.d.ts +4 -0
  41. package/lib/core/es6/grid/components/HScrollbar.js +20 -4
  42. package/lib/core/es6/grid/components/Scrollbar.d.ts +1 -1
  43. package/lib/core/es6/grid/components/StretchedCells.js +2 -2
  44. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +14 -6
  45. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +147 -81
  46. package/lib/core/es6/grid/util/Conflator.d.ts +2 -2
  47. package/lib/core/es6/grid/util/ElementFrameWork.d.ts +3 -3
  48. package/lib/core/es6/grid/util/HttpRequest.d.ts +2 -2
  49. package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +1 -1
  50. package/lib/core/es6/grid/util/RangeBar.d.ts +1 -1
  51. package/lib/core/es6/grid/util/SectionSettings.d.ts +5 -5
  52. package/lib/core/es6/grid/util/SectionSettings.js +5 -0
  53. package/lib/core/es6/grid/util/SelectionList.d.ts +2 -2
  54. package/lib/core/es6/grid/util/TrackLayout.d.ts +7 -3
  55. package/lib/core/es6/grid/util/TrackLayout.js +29 -3
  56. package/lib/core/es6/grid/util/util.d.ts +2 -2
  57. package/lib/core/es6/index.d.ts +1 -5
  58. package/lib/core/es6/index.js +1 -7
  59. package/lib/core/es6/tr-grid-theme.js +1 -1
  60. package/lib/filter-dialog/lib/checkbox-list.d.ts +13 -1
  61. package/lib/filter-dialog/lib/filter-dialog.d.ts +14 -1
  62. package/lib/filter-dialog/lib/filter-dialog.js +94 -32
  63. package/lib/filter-dialog/themes/base-checkbox.less +8 -1
  64. package/lib/filter-dialog/themes/base.less +69 -1
  65. package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
  66. package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
  67. package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
  68. package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
  69. package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +2 -2
  70. package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
  71. package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
  72. package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +2 -2
  73. package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
  74. package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
  75. package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +2 -2
  76. package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
  77. package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
  78. package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +2 -2
  79. package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
  80. package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
  81. package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +2 -2
  82. package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
  83. package/lib/grid/lib/efx-grid.d.ts +30 -8
  84. package/lib/grid/lib/efx-grid.js +120 -115
  85. package/lib/grid/themes/base.less +5 -3
  86. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  87. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  88. package/lib/grid/themes/halo/efx-grid.less +72 -41
  89. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  90. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  91. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  92. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  93. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  94. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  95. package/lib/index.d.ts +2 -0
  96. package/lib/index.js +2 -0
  97. package/lib/row-segmenting/es6/RowSegmenting.d.ts +8 -2
  98. package/lib/row-segmenting/es6/RowSegmenting.js +137 -21
  99. package/lib/rt-grid/dist/rt-grid.js +11017 -9193
  100. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  101. package/lib/rt-grid/es6/ColumnDefinition.d.ts +9 -4
  102. package/lib/rt-grid/es6/ColumnDefinition.js +20 -108
  103. package/lib/rt-grid/es6/DataConnector.d.ts +3 -3
  104. package/lib/rt-grid/es6/Grid.d.ts +30 -15
  105. package/lib/rt-grid/es6/Grid.js +436 -167
  106. package/lib/rt-grid/es6/RowDefSorter.d.ts +19 -0
  107. package/lib/rt-grid/es6/RowDefSorter.js +137 -0
  108. package/lib/rt-grid/es6/RowDefinition.d.ts +12 -7
  109. package/lib/rt-grid/es6/RowDefinition.js +58 -2
  110. package/lib/rt-grid/es6/SnapshotFiller.d.ts +3 -1
  111. package/lib/rt-grid/es6/SnapshotFiller.js +23 -0
  112. package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +1 -1
  113. package/lib/tr-grid-cell-selection/es6/CellSelection.js +53 -40
  114. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +6 -3
  115. package/lib/tr-grid-checkbox/es6/Checkbox.js +79 -34
  116. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
  117. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +10 -0
  118. package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +5 -1
  119. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +269 -10
  120. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +8 -4
  121. package/lib/tr-grid-column-stack/es6/ColumnStack.js +243 -125
  122. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +1 -1
  123. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +24 -13
  124. package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +4 -2
  125. package/lib/tr-grid-filter-input/es6/FilterInput.js +73 -10
  126. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +8 -5
  127. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +106 -3
  128. package/lib/tr-grid-printer/es6/CellWriter.d.ts +3 -3
  129. package/lib/tr-grid-printer/es6/GridPrinter.d.ts +1 -1
  130. package/lib/tr-grid-printer/es6/GridPrinter.js +26 -13
  131. package/lib/tr-grid-printer/es6/PrintTrait.d.ts +2 -2
  132. package/lib/tr-grid-printer/es6/SectionWriter.d.ts +3 -3
  133. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +3 -4
  134. package/lib/tr-grid-row-dragging/es6/RowDragging.js +108 -127
  135. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
  136. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +88 -33
  137. package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +7 -2
  138. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +138 -38
  139. package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +13 -9
  140. package/lib/tr-grid-row-selection/es6/RowSelection.js +230 -29
  141. package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +2 -0
  142. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +36 -0
  143. package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +1 -1
  144. package/lib/tr-grid-textformatting/es6/TextFormatting.js +12 -0
  145. package/lib/tr-grid-util/es6/CellPainter.d.ts +8 -8
  146. package/lib/tr-grid-util/es6/Conflator.d.ts +2 -2
  147. package/lib/tr-grid-util/es6/CoralItems.d.ts +1 -1
  148. package/lib/tr-grid-util/es6/DateTime.d.ts +4 -4
  149. package/lib/tr-grid-util/es6/Delay.d.ts +1 -1
  150. package/lib/tr-grid-util/es6/Dom.d.ts +4 -4
  151. package/lib/tr-grid-util/es6/DragUI.d.ts +16 -0
  152. package/lib/tr-grid-util/es6/DragUI.js +214 -0
  153. package/lib/tr-grid-util/es6/ElementObserver.d.ts +2 -0
  154. package/lib/tr-grid-util/es6/ElementObserver.js +28 -1
  155. package/lib/tr-grid-util/es6/ElementWrapper.d.ts +1 -1
  156. package/lib/tr-grid-util/es6/ElfDate.d.ts +3 -3
  157. package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -4
  158. package/lib/tr-grid-util/es6/ElfUtil.js +1 -1
  159. package/lib/tr-grid-util/es6/EventDispatcher.d.ts +1 -1
  160. package/lib/tr-grid-util/es6/ExpanderIcon.js +2 -2
  161. package/lib/tr-grid-util/es6/FieldFormatter.d.ts +1 -1
  162. package/lib/tr-grid-util/es6/FieldFormatter.js +7 -5
  163. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +5 -5
  164. package/lib/tr-grid-util/es6/GridPlugin.d.ts +3 -3
  165. package/lib/tr-grid-util/es6/GridPlugin.js +8 -4
  166. package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +1 -1
  167. package/lib/tr-grid-util/es6/MultiTableManager.d.ts +10 -2
  168. package/lib/tr-grid-util/es6/MultiTableManager.js +164 -57
  169. package/lib/tr-grid-util/es6/NumberFormatter.d.ts +2 -0
  170. package/lib/tr-grid-util/es6/NumberFormatter.js +64 -19
  171. package/lib/tr-grid-util/es6/PercentBar.d.ts +1 -1
  172. package/lib/tr-grid-util/es6/Perf.d.ts +4 -4
  173. package/lib/tr-grid-util/es6/Popup.d.ts +2 -2
  174. package/lib/tr-grid-util/es6/RequestQueue.d.ts +1 -1
  175. package/lib/tr-grid-util/es6/RowPainter.d.ts +3 -0
  176. package/lib/tr-grid-util/es6/RowPainter.js +120 -28
  177. package/lib/tr-grid-util/es6/SubTable.d.ts +9 -9
  178. package/lib/tr-grid-util/es6/Table.d.ts +13 -13
  179. package/lib/tr-grid-util/es6/TextHighlighter.d.ts +3 -3
  180. package/lib/tr-grid-util/es6/TickCodes.d.ts +2 -2
  181. package/lib/tr-grid-util/es6/TouchProxy.d.ts +1 -1
  182. package/lib/tr-grid-util/es6/Util.d.ts +6 -6
  183. package/lib/tr-grid-util/es6/formula/Engine.d.ts +5 -5
  184. package/lib/tr-grid-util/es6/formula/Formula.d.ts +3 -3
  185. package/lib/tr-grid-util/es6/formula/Formula.js +9 -1
  186. package/lib/tr-grid-util/es6/formula/RealtimeService.d.ts +1 -1
  187. package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +2 -2
  188. package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +4 -4
  189. package/lib/tr-grid-util/es6/jet/MockArchive.d.ts +1 -1
  190. package/lib/tr-grid-util/es6/jet/MockJET.d.ts +4 -4
  191. package/lib/tr-grid-util/es6/jet/MockQuotes.d.ts +11 -11
  192. package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +7 -7
  193. package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +1 -1
  194. package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -1
  195. package/lib/tr-grid-util/es6/jsx.d.ts +223 -0
  196. package/lib/types/es6/CellSelection.d.ts +1 -1
  197. package/lib/types/es6/Checkbox.d.ts +6 -3
  198. package/lib/types/es6/ColumnGrouping.d.ts +1 -0
  199. package/lib/types/es6/ColumnSelection.d.ts +5 -1
  200. package/lib/types/es6/ColumnStack.d.ts +8 -4
  201. package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +3 -2
  202. package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +2 -1
  203. package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +20 -18
  204. package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +2 -1
  205. package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +3 -2
  206. package/lib/types/es6/CompositeGrid/Plugin.d.ts +28 -0
  207. package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +2 -1
  208. package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +5 -4
  209. package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +2 -1
  210. package/lib/types/es6/CompositeGrid/index.d.ts +9 -9
  211. package/lib/types/es6/ConditionalColoring.d.ts +1 -1
  212. package/lib/types/es6/Core/data/ColumnStats.d.ts +2 -2
  213. package/lib/types/es6/Core/data/DataCache.d.ts +4 -4
  214. package/lib/types/es6/Core/data/DataTable.d.ts +5 -5
  215. package/lib/types/es6/Core/data/DataView.d.ts +26 -17
  216. package/lib/types/es6/Core/data/Segment.d.ts +2 -0
  217. package/lib/types/es6/Core/data/SegmentCollection.d.ts +3 -3
  218. package/lib/types/es6/Core/data/WrappedView.d.ts +289 -0
  219. package/lib/types/es6/Core/grid/Core.d.ts +42 -27
  220. package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +23 -15
  221. package/lib/types/es6/Core/grid/LayoutGrid.d.ts +10 -1
  222. package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +10 -1
  223. package/lib/types/es6/Core/grid/components/Cell.d.ts +4 -4
  224. package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +1 -1
  225. package/lib/types/es6/Core/grid/components/CellSpans.d.ts +8 -8
  226. package/lib/types/es6/Core/grid/components/Column.d.ts +1 -1
  227. package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +6 -6
  228. package/lib/types/es6/Core/grid/components/HScrollbar.d.ts +4 -0
  229. package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +1 -1
  230. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +14 -6
  231. package/lib/types/es6/Core/grid/util/Conflator.d.ts +2 -2
  232. package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +3 -3
  233. package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +2 -2
  234. package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +1 -1
  235. package/lib/types/es6/Core/grid/util/RangeBar.d.ts +1 -1
  236. package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +5 -5
  237. package/lib/types/es6/Core/grid/util/SelectionList.d.ts +2 -2
  238. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +7 -3
  239. package/lib/types/es6/Core/grid/util/util.d.ts +2 -2
  240. package/lib/types/es6/Core/index.d.ts +1 -5
  241. package/lib/types/es6/ExtensionOptions.d.ts +2 -0
  242. package/lib/types/es6/FilterInput.d.ts +4 -2
  243. package/lib/types/es6/InCellEditing.d.ts +8 -5
  244. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +9 -4
  245. package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +3 -3
  246. package/lib/types/es6/RealtimeGrid/Grid.d.ts +31 -16
  247. package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +19 -0
  248. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +12 -7
  249. package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +3 -1
  250. package/lib/types/es6/RowColoring.d.ts +2 -0
  251. package/lib/types/es6/RowDragging.d.ts +3 -4
  252. package/lib/types/es6/RowFiltering.d.ts +2 -0
  253. package/lib/types/es6/RowGrouping.d.ts +7 -2
  254. package/lib/types/es6/RowSegmenting.d.ts +8 -2
  255. package/lib/types/es6/RowSelection.d.ts +13 -9
  256. package/lib/types/es6/TextFormatting.d.ts +1 -1
  257. package/lib/types/es6/Zoom.d.ts +2 -1
  258. package/lib/types/es6/index.d.ts +3 -0
  259. package/lib/versions.json +22 -21
  260. package/lib/zoom/es6/Zoom.d.ts +2 -1
  261. package/lib/zoom/es6/Zoom.js +11 -4
  262. package/package.json +7 -7
  263. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
  264. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.js +0 -615
  265. package/lib/core/es6/grid/plugins/Plugin.d.ts +0 -28
  266. package/lib/core/es6/grid/plugins/Plugin.js +0 -272
  267. package/lib/types/es6/Core/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
  268. package/lib/types/es6/Core/grid/plugins/Plugin.d.ts +0 -28
@@ -0,0 +1,764 @@
1
+ import { Ext } from "../../tr-grid-util/es6/Ext.js";
2
+ import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";
3
+ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
4
+ import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
5
+ import { cloneObject } from "../../tr-grid-util/es6/Util.js";
6
+ import { DragUI } from "../../tr-grid-util/es6/DragUI.js";
7
+
8
+ /** @typedef {Object} ColumnDraggingPlugin~Options
9
+ * @description The options can be specified by `columnDragging` property of the main grid's options
10
+ * @property {Function=} dragStart Function handler for dragStart event
11
+ * @property {Function=} drag Function handler for drag event
12
+ * @property {Function=} dragEnd Function handler for dragEnd event
13
+ * @property {Function=} preColumnMoved Function handler for preColumnMoved event
14
+ * @property {Function=} columnMoved Function handler for columnMoved event
15
+ * @property {Function=} dragInterval Function handler for dragInterval event
16
+ * @property {Function=} dragBoxRenderer Allow user to customize dragBox
17
+ */
18
+
19
+ /** @event ColumnDraggingPlugin#drag
20
+ * @description Fired on each mousemove or touchmove
21
+ * @type {Object}
22
+ */
23
+ /** @event ColumnDraggingPlugin#dragStart
24
+ * @description The event is fired at the beginning of the drag operation. You can cancel the operation by setting cancel property to true.
25
+ * @type {Object}
26
+ * @example
27
+ * // ...
28
+ * dragStart: function(e) {
29
+ * e.cancel = true; // To cancel the operation
30
+ * }, // ..
31
+ */
32
+ /** @event ColumnDraggingPlugin#dragEnd
33
+ * @description The event will always be fired at the end of the drag operation. This is to allow clearing of any resource used. You can cancel the data moving operation by setting cancel property to true.
34
+ * @type {Object}
35
+ */
36
+
37
+ /** @event ColumnDraggingPlugin#preColumnMoved
38
+ * @description Fired before the actual move
39
+ * @type {Object}
40
+ * @property {number} startColumnIndex
41
+ * @property {number} destColumnIndex
42
+ * @example
43
+ * // ...
44
+ * preColumnMoved: function(e) {
45
+ * e.cancel = true; // To cancel the operation
46
+ * }, // ..
47
+ */
48
+ /** @event ColumnDraggingPlugin#columnMoved
49
+ * @description Fired if the column is successfully moved by drag and drop operation
50
+ * @type {Object}
51
+ * @property {number} startColumnIndex
52
+ * @property {number} destColumnIndex
53
+ */
54
+
55
+ /** @event ColumnDraggingPlugin#dragInterval
56
+ * @description Fired at an interval during drag
57
+ * @type {Object}
58
+ */
59
+
60
+ /** @constructor
61
+ * @param {ColumnDraggingPlugin~Options=} options
62
+ * @extends {GridPlugin}
63
+ */
64
+ var ColumnDraggingPlugin = function (options) {
65
+ var t = this;
66
+ t._onMouseUp = t._onMouseUp.bind(t);
67
+ t._onMouseDown = t._onMouseDown.bind(t);
68
+
69
+ t._onDrag = t._onDrag.bind(t);
70
+ t._onDragStart = t._onDragStart.bind(t);
71
+ t._onDragEnd = t._onDragEnd.bind(t);
72
+ t._onDragPulse = t._onDragPulse.bind(t);
73
+ t._onThemeLoaded = t._onThemeLoaded.bind(t);
74
+
75
+ t._hosts = [];
76
+
77
+ t._guideline = document.createElement("div");
78
+ t._guideline.className = "guideline";
79
+ t._dragBox = document.createElement("div");
80
+ t._dragBox.className = "drag-box-disabled"; // defualt disable dragbox
81
+ t._dragBoxIcon = document.createElement("ef-icon");
82
+ t._dragBoxIcon.className = "drag-box-icon";
83
+
84
+ if(options) {
85
+ this.config({ "columnDragging": options });
86
+ }
87
+ };
88
+ Ext.inherits(ColumnDraggingPlugin, GridPlugin);
89
+
90
+ /** @private
91
+ * @type {Core}
92
+ */
93
+ ColumnDraggingPlugin.prototype._clickedGrid = null;
94
+ /** @private
95
+ * @type {ILayoutGrid}
96
+ */
97
+ ColumnDraggingPlugin.prototype._clickedSection = null;
98
+ /** @private
99
+ * @type {number}
100
+ */
101
+ ColumnDraggingPlugin.prototype._clickedRow = -1;
102
+ /** @private
103
+ * @type {Element}
104
+ */
105
+ ColumnDraggingPlugin.prototype._guideline = null;
106
+ /** @private
107
+ * @type {Element}
108
+ */
109
+ ColumnDraggingPlugin.prototype._dragBox = null;
110
+ /** @private
111
+ * @type {Element}
112
+ */
113
+ ColumnDraggingPlugin.prototype._dragBoxIcon = null;
114
+ /** @type {Object}
115
+ * @private
116
+ */
117
+ ColumnDraggingPlugin.prototype._dragBoxRenderer = null;
118
+ /** @private
119
+ * @type {number}
120
+ */
121
+ ColumnDraggingPlugin.prototype._timerId = 0;
122
+ /** @private
123
+ * @type {number}
124
+ */
125
+ ColumnDraggingPlugin.prototype._dragPulseId = 0;
126
+ /** @private
127
+ * @type {Object}
128
+ */
129
+ ColumnDraggingPlugin.prototype._pos = null; // Cache of current mouse position
130
+ /** @private
131
+ * @type {number}
132
+ */
133
+ ColumnDraggingPlugin.prototype._cacheLeft = 0;
134
+ /** @private
135
+ * @type {number}
136
+ */
137
+ ColumnDraggingPlugin.prototype._cacheWidth = 0;
138
+
139
+ /** @private
140
+ * @type {number}
141
+ */
142
+ ColumnDraggingPlugin.prototype._startColumn = -1;
143
+ /** @private
144
+ * @type {number}
145
+ */
146
+ ColumnDraggingPlugin.prototype._endColumn = -1;
147
+ /** @private
148
+ * @type {number}
149
+ */
150
+ ColumnDraggingPlugin.prototype._destColumn = -1;
151
+ /** @private
152
+ * @type {number}
153
+ */
154
+ ColumnDraggingPlugin.prototype._leftMovableBorder = -1;
155
+ /** @private
156
+ * @type {number}
157
+ */
158
+ ColumnDraggingPlugin.prototype._rightMovableBorder = -1;
159
+ /** @private
160
+ * @type {boolean}
161
+ */
162
+ ColumnDraggingPlugin.prototype._isDragging = false;
163
+ /** @private
164
+ * @type {boolean}
165
+ */
166
+ ColumnDraggingPlugin.prototype._lockFrozen = false;
167
+ /** @private
168
+ * @type {boolean}
169
+ */
170
+ ColumnDraggingPlugin.prototype._disabled = false;
171
+ /** @private
172
+ * @type {boolean}
173
+ */
174
+ ColumnDraggingPlugin.prototype._noColumnMoving = false;
175
+ /** @private
176
+ * @type {boolean}
177
+ */
178
+ ColumnDraggingPlugin.prototype._noDragBox = false;
179
+ /** @type {string}
180
+ * @private
181
+ */
182
+ ColumnDraggingPlugin._styles = ""; // Static variable
183
+ /** @private
184
+ * @type {Object}
185
+ */
186
+ ColumnDraggingPlugin.prototype._dragUI = null;
187
+
188
+ /** @public
189
+ * @return {string}
190
+ */
191
+ ColumnDraggingPlugin.prototype.getName = function () {
192
+ return "ColumnDraggingPlugin"; // Read Only
193
+ };
194
+ /** Plugin that has multi-table support means that it can have multiple hosts/tables and share its states across those hosts/tables.
195
+ * @public
196
+ * @return {boolean}
197
+ */
198
+ ColumnDraggingPlugin.prototype.hasMultiTableSupport = function () {
199
+ return true;
200
+ };
201
+
202
+ /** @public
203
+ * @param {Object} host core grid instance
204
+ * @param {Object=} options
205
+ */
206
+ ColumnDraggingPlugin.prototype.initialize = function (host, options) {
207
+ if (this._hosts.indexOf(host) >= 0) {
208
+ return;
209
+ }
210
+
211
+ this._hosts.push(host);
212
+ host.unloadPlugin("DragAndDropTitlePlugin");
213
+
214
+ host.listen("mousedown", this._onMouseDown);
215
+ host.listen("dragstart", preventDefault);
216
+
217
+ this.config(options);
218
+
219
+ this._dragUI = new DragUI({
220
+ dragBox: this._dragBox,
221
+ dragBoxIcon: this._dragBoxIcon
222
+ });
223
+
224
+ // Share dragging styles
225
+ if(DragUI.stylePromise) {
226
+ DragUI.applyThemeColor(host);
227
+ } else {
228
+ DragUI.stylePromise = ElfUtil.getThemeColors();
229
+ DragUI.stylePromise.then(this._onThemeLoaded);
230
+ }
231
+ };
232
+ /** @public
233
+ * @param {Object=} host core grid instance
234
+ */
235
+ ColumnDraggingPlugin.prototype.unload = function (host) {
236
+ var at = this._hosts.indexOf(host);
237
+ if (at < 0) {
238
+ return;
239
+ }
240
+
241
+ this._hosts.splice(at, 1);
242
+ host.unlisten("mousedown", this._onMouseDown);
243
+
244
+ if(!this._hosts.length) {
245
+ if(this._dragPulseId) {
246
+ window.clearInterval(this._dragPulseId);
247
+ this._dragPulseId = 0;
248
+ }
249
+ }
250
+
251
+ this._dispose();
252
+ };
253
+
254
+ /** @private
255
+ * @param {Object} colors
256
+ */
257
+ ColumnDraggingPlugin.prototype._onThemeLoaded = function(colors) {
258
+ this._dragUI.onThemeLoaded(colors); // TODO : onThemeLoaded should be static function like DragUI.applyThemeColor
259
+ for(var i = this._hosts.length; --i >= 0;) {
260
+ DragUI.applyThemeColor(this._hosts[i]);
261
+ }
262
+ };
263
+
264
+ /** @public
265
+ * @param {Object=} options Grid configuration object
266
+ */
267
+ ColumnDraggingPlugin.prototype.config = function (options) {
268
+ if (!options) { return; }
269
+
270
+ var noColumnDragging = options["noColumnDragging"];
271
+ if (noColumnDragging == null && options["columnReorder"] != null) {
272
+ noColumnDragging = !options["columnReorder"];
273
+ }
274
+ if (noColumnDragging != null) {
275
+ this._disabled = noColumnDragging ? true : false;
276
+ }
277
+
278
+ var extOptions = options.columnDragging;
279
+ if (!extOptions) { return; }
280
+
281
+ if (typeof extOptions["dragBoxRenderer"] === "function") {
282
+ this._dragBoxRenderer = extOptions["dragBoxRenderer"];
283
+ this._dragBox.className = "drag-box";
284
+ }
285
+ this.addListener(extOptions, "dragStart");
286
+ this.addListener(extOptions, "drag");
287
+ this.addListener(extOptions, "dragEnd");
288
+ this.addListener(extOptions, "preColumnMoved");
289
+ this.addListener(extOptions, "columnMoved");
290
+ this.addListener(extOptions, "dragInterval");
291
+ };
292
+
293
+ /** @public
294
+ * @param {Object=} gridOptions
295
+ * @return {!Object}
296
+ */
297
+ ColumnDraggingPlugin.prototype.getConfigObject = function (gridOptions) {
298
+ var obj = gridOptions || {};
299
+
300
+ if(this._disabled) {
301
+ obj.noColumnDragging = true;
302
+ }
303
+
304
+ var extOptions = obj.columnDragging;
305
+ if(!extOptions) {
306
+ extOptions = obj.columnDragging = {};
307
+ }
308
+
309
+ return obj;
310
+ };
311
+
312
+ /**
313
+ * Lock moving of frozen column. If true is spsecified, dragging is disabled for frozen column.
314
+ * @public
315
+ * @param {boolean} lock
316
+ */
317
+ ColumnDraggingPlugin.prototype.lockFrozenColumn = function(lock) {
318
+ this._lockFrozen = lock;
319
+ };
320
+
321
+ /** Disable this plugin entirely
322
+ * @public
323
+ * @param {boolean=} opt_disabled
324
+ */
325
+ ColumnDraggingPlugin.prototype.disable = function(opt_disabled) {
326
+ this._disabled = opt_disabled !== false;
327
+ };
328
+ /** Disable column moving. Only cursor is showing and events are fired. No real column moving.
329
+ * @public
330
+ * @param {boolean=} opt_disabled
331
+ */
332
+ ColumnDraggingPlugin.prototype.disableMoving = function(opt_disabled) {
333
+ this._noColumnMoving = opt_disabled !== false;
334
+ };
335
+ /** Disable column moving. Only cursor is showing and events are fired. No real column moving.
336
+ * @public
337
+ * @param {boolean=} opt_disabled
338
+ */
339
+ ColumnDraggingPlugin.prototype.disableDragBox = function(opt_disabled) {
340
+ this._noDragBox = opt_disabled !== false;
341
+ };
342
+
343
+ /** @private
344
+ * @param {number} colIndex
345
+ * @return {boolean}
346
+ */
347
+ ColumnDraggingPlugin.prototype._isAllowed = function(colIndex) {
348
+ var host = this._clickedGrid || this._hosts[0];
349
+ if (host) {
350
+ var stationaryIndex = host.getStationaryColumnIndex();
351
+ if (stationaryIndex < 0) {
352
+ return true;
353
+ }
354
+ if (colIndex <= stationaryIndex) {
355
+ return false;
356
+ }
357
+ }
358
+ return true;
359
+ };
360
+ /** @private
361
+ * @param {Event} e
362
+ */
363
+ ColumnDraggingPlugin.prototype._onMouseDown = function (e) {
364
+ if(this._disabled) {
365
+ return;
366
+ }
367
+ if(e.shiftKey || e.ctrlKey || e.altKey) {
368
+ return; // Ignore mousedown event, if modifier key is detected
369
+ }
370
+ if(e.button) {
371
+ return; // We don't allow drag with middle click (button == 1), or right click (button == 2)
372
+ }
373
+ if(this._timerId) {
374
+ return; // Drag timer is already start
375
+ }
376
+
377
+ var host = this.getRelativeGrid(e);
378
+ if(!host) {
379
+ return; // Given event should be within grid element
380
+ }
381
+
382
+ this._pos = host.getRelativePosition(e);
383
+ if (this._pos["hit"] === false) {
384
+ return; // Only start dragging when mouse is down on the grid
385
+ }
386
+
387
+ var section = /** @type{ILayoutGrid} */(this._pos["section"]);
388
+ if(!section) {
389
+ return; // The section that is not in the target section list cannot be dragged
390
+ } else if(this._pos["sectionType"] !== "title") {
391
+ return; // Sections other than title section cannot be dragged by default
392
+ }
393
+
394
+ var colIndex = this._pos["colIndex"];
395
+ if(!this._isAllowed(colIndex)) {
396
+ return; // The column cannot be dragged
397
+ }
398
+ if(this._lockFrozen && host.isPinnedColumn(colIndex)) {
399
+ return; // If the lock frag is on, frozen columns cannot be dragged
400
+ }
401
+
402
+ var rowIndex = this._pos["rowIndex"]; // rowIndex may not exist
403
+ var movableBorder = this._findMoveableBorder(colIndex, rowIndex - 1, section);
404
+ var movingColumns = this._getSpan(colIndex, rowIndex, section);
405
+
406
+ this._clickedGrid = host;
407
+ this._clickedSection = section;
408
+ this._clickedRow = rowIndex;
409
+
410
+ this._startColumn = movingColumns["left"];
411
+ this._endColumn = movingColumns["right"];
412
+ this._leftMovableBorder = movableBorder["left"];
413
+ this._rightMovableBorder = movableBorder["right"];
414
+ this._destColumn = this._startColumn;
415
+ this._timerId = setTimeout(this._onDragStart, 300);
416
+ window.addEventListener("mouseup", this._onMouseUp, false);
417
+ };
418
+ /** @private
419
+ * @param {Object} e
420
+ */
421
+ ColumnDraggingPlugin.prototype._onMouseUp = function (e) {
422
+ if(this._timerId) {
423
+ window.clearTimeout(this._timerId);
424
+ window.removeEventListener("mouseup", this._onMouseUp, false);
425
+ this._timerId = 0;
426
+ this._clearCache();
427
+ }
428
+ };
429
+
430
+ /** @private
431
+ * @param {*} e
432
+ */
433
+ ColumnDraggingPlugin.prototype._onDragStart = function (e) {
434
+ if(this._disabled || this._isDragging) { return; }
435
+ if (this.hasListener("dragStart")) {
436
+ this._dispatch("dragStart", /** @type{!Object} */(this._pos));
437
+ }
438
+
439
+ if (this._pos["cancel"]) {
440
+ return;
441
+ }
442
+
443
+ this._timerId = 0;
444
+ window.removeEventListener("mouseup", this._onMouseUp, false);
445
+
446
+ if(!this._clickedGrid) {
447
+ return;
448
+ }
449
+
450
+ this._isDragging = true;
451
+ document.body.classList.add("tr-dragging"); // Prevent text selection
452
+ // document.body.classList.add("tr-move-cursor");
453
+
454
+ window.addEventListener("mousemove", this._onDrag, false); // TODO: support touch operation
455
+ window.addEventListener("mouseup", this._onDragEnd, true);
456
+
457
+ var host = this._clickedGrid;
458
+ var height = host.getHeight();
459
+ var sectionBound = this._clickedSection.getBoundingClientRect();
460
+ var clickedCellBound = this._clickedSection.getCell(this._startColumn, this._clickedRow).getBoundingClientRect();
461
+
462
+ var gridElem = host.getElement();
463
+ this._guideline.style.top = (clickedCellBound.top - sectionBound.top) + "px";
464
+ this._guideline.style.height = (height - 1) + "px";
465
+
466
+ // TODO: guideline and drag box should be outside of grid area
467
+ gridElem.parentNode.classList.add("mouse-dragging"); // change cursor
468
+
469
+
470
+ // TODO: guideline and drag box should be outside of grid area
471
+ gridElem.appendChild(this._guideline);
472
+
473
+ if (this._dragBoxRenderer) { // For custom drag box rendering
474
+ var arg = cloneObject(e); // TODO: Check if cloning is necessary
475
+ var id = this.getColumnId(this._startColumn);
476
+ var index = this.getColumnIndex(id);
477
+ var field = this._getField(this._startColumn);
478
+
479
+ arg.dragBox = this._dragBox;
480
+ arg.columnData = {
481
+ index: index,
482
+ field: field,
483
+ id: id
484
+ };
485
+ this._dragBoxRenderer(arg);
486
+ }
487
+ this._dimCol(true);
488
+ this._renderGuideline();
489
+
490
+ // For step scrolling // TODO: Merge this logic with DraggableContentPlugin
491
+ this._scrollStep = Math.floor(host.getScrollWidth() / 25); // Update the scrollbar first
492
+ if(this._scrollStep < 40) {
493
+ this._scrollStep = 40;
494
+ } else if(this._scrollStep > 400) {
495
+ this._scrollStep = 400;
496
+ }
497
+ var scrollbar = host.getHScrollbar();
498
+ this._cacheLeft = scrollbar.getLeft() + 20;
499
+ this._cacheWidth = scrollbar.getLeft() + scrollbar.getWidth() - 20;
500
+
501
+ this._dragPulseId = window.setInterval(this._onDragPulse, 150); // Start pulse
502
+ };
503
+ /** @private
504
+ * @param {Event} e
505
+ */
506
+ ColumnDraggingPlugin.prototype._onDrag = function (e) {
507
+ if(!this._isDragging) { return; }
508
+
509
+ preventDefault(e);
510
+ this._pos = this._clickedGrid.getRelativePosition(e); // Relative to the clicked grid
511
+
512
+ var host = this.getRelativeGrid(e);
513
+ if (!host || host !== this._clickedGrid) { return; }
514
+
515
+ var colIndex = this._pos["colIndex"];
516
+ if ((colIndex >= this._leftMovableBorder) &&
517
+ (colIndex <= this._rightMovableBorder) &&
518
+ this._isAllowed(colIndex) &&
519
+ !(this._lockFrozen && host.isPinnedColumn(colIndex))) {
520
+ e.dragBox = this._dragBox;
521
+ this._renderGuideline();
522
+ this._dispatch("drag", /** @type{!Object} */(e));
523
+ }
524
+ if(!this._noDragBox) {
525
+ var drop = this._dragUI.renderDragBox(e, this._clickedGrid);
526
+ if(!drop) { // can not be drop or not allow to drop or insertion
527
+ this._pos["cancel"] = true;
528
+ }
529
+ }
530
+ };
531
+ /** @private
532
+ * @param {Event} e
533
+ */
534
+ ColumnDraggingPlugin.prototype._onDragEnd = function (e) {
535
+ if(!this._isDragging) {
536
+ return;
537
+ }
538
+
539
+ this._isDragging = false;
540
+ document.body.classList.remove("tr-dragging");
541
+ // document.body.classList.remove("tr-move-cursor");
542
+ this._dimCol(false);
543
+
544
+ var pn = this._guideline.parentNode;
545
+ if(pn) {
546
+ pn.removeChild(this._guideline);
547
+ }
548
+
549
+ pn = this._dragBox.parentNode;
550
+ if(pn) {
551
+ pn.removeChild(this._dragBox);
552
+ }
553
+ this._clickedGrid.getElement().parentNode.classList.remove("mouse-dragging"); // retain mouse cursor
554
+
555
+ window.removeEventListener("mousemove", this._onDrag, false);
556
+ window.removeEventListener("mouseup", this._onDragEnd, true);
557
+
558
+ if(this._dragPulseId) {
559
+ window.clearInterval(this._dragPulseId);
560
+ this._dragPulseId = 0;
561
+ }
562
+ var destPos = this._pos;
563
+ this._pos = null;
564
+
565
+ preventDefault(e);
566
+ var operationCancelled = false;
567
+ if(destPos["cancel"]) {
568
+ operationCancelled = true;
569
+ }
570
+
571
+ //When move to the right, the first position is the current one.
572
+ if (this._destColumn > this._startColumn) {
573
+ --this._destColumn;
574
+ }
575
+ //Cancel moving if the destination column is the current column or not allowed column
576
+ if ((!this._destColumn && this._destColumn !== 0) || // undefined, NaN, null
577
+ this._destColumn < 0 ||
578
+ !this._isAllowed(this._destColumn) ||
579
+ (this._destColumn >= this._startColumn && this._destColumn <= this._endColumn)) {
580
+ operationCancelled = true;
581
+ }
582
+
583
+ var arg = null;
584
+
585
+ if(!operationCancelled) {
586
+ arg = {
587
+ "startColumnIndex": this._startColumn,
588
+ "destColumnIndex": this._destColumn
589
+ };
590
+ this._dispatch("preColumnMoved", arg);
591
+ if(arg["cancel"]) {
592
+ operationCancelled = true;
593
+ }
594
+ }
595
+
596
+ if (!operationCancelled) {
597
+ if (!this._noColumnMoving) {
598
+ var shiftStart = -1;
599
+ var shiftEnd = -1;
600
+ var moveSize = -1;
601
+ if (this._startColumn > this._destColumn) { //Move backward
602
+ shiftStart = this._destColumn;
603
+ shiftEnd = this._startColumn - 1;
604
+ moveSize = -1 * (this._startColumn - this._destColumn); //Move to the left
605
+ } else
606
+ if (this._startColumn < this._destColumn) { //Move foward
607
+ shiftStart = this._endColumn + 1;
608
+ shiftEnd = this._destColumn;
609
+ moveSize = ((shiftEnd - shiftStart) + 1); //Move to the right
610
+ }
611
+
612
+ //Perform moving all columns in the range
613
+ for(var j = this._hosts.length; --j >= 0;) {
614
+ var host = this._hosts[j];
615
+ var i;
616
+ if (moveSize > 0) { //Move forward
617
+ for (i = this._startColumn; i <= this._endColumn; i++) {
618
+ host.moveColumn(this._startColumn, this._destColumn);
619
+ }
620
+ } else { //Move backward
621
+ for (i = this._startColumn; i <= this._endColumn; i++) {
622
+ host.moveColumn(this._startColumn + (i - this._startColumn), this._destColumn + (i - this._startColumn));
623
+ }
624
+ }
625
+ }
626
+ }
627
+
628
+ if (this.hasListener("columnMoved")) {
629
+ this._dispatch("columnMoved", {
630
+ "startColumnIndex": this._startColumn,
631
+ "endColumnIndex": this._endColumn,
632
+ "destColumnIndex": this._destColumn,
633
+ "clickedRow": this._clickedRow
634
+ });
635
+ }
636
+ }
637
+
638
+ this._dispatch("dragEnd", destPos || {}); // Always fire drag end for client to clean up its resource
639
+ this._clearCache();
640
+ };
641
+
642
+ /** @private
643
+ */
644
+ ColumnDraggingPlugin.prototype._onDragPulse = function() {
645
+ if(!this._isDragging || !this._pos) { return; }
646
+
647
+ this._dispatch("dragInterval", /** @type{!Object} */(this._pos));
648
+
649
+ var host = this._clickedGrid;
650
+ if(!host || !host.getHScrollbar().isActive()) { return; }
651
+
652
+ var x = this._pos["x"];
653
+ var scrollVal = 0;
654
+ if(x < this._cacheLeft) {
655
+ scrollVal = -Math.floor(this._scrollStep * (0.8 + Math.random()));
656
+
657
+ } else if(x > this._cacheWidth) {
658
+ scrollVal = Math.floor(this._scrollStep * (0.8 + Math.random()));
659
+ }
660
+
661
+ var len = this._hosts ? this._hosts.length : 0;
662
+ for(var i = 0; i < len; ++i) {
663
+ this._hosts[i].scrollRight(scrollVal);
664
+ }
665
+ };
666
+ /** @private
667
+ */
668
+ ColumnDraggingPlugin.prototype._clearCache = function() {
669
+ this._startColumn = this._endColumn = this._destColumn = -1;
670
+
671
+ this._leftMovableBorder = this._rightMovableBorder = -1;
672
+
673
+ this._clickedRow = -1;
674
+ this._clickedSection = this._clickedGrid = null;
675
+ };
676
+
677
+ /** @private
678
+ * @param {number} colIndex
679
+ * @param {number} row
680
+ * @param {ILayoutGrid} section
681
+ * @return {!Object}
682
+ */
683
+ ColumnDraggingPlugin.prototype._getSpan = function(colIndex, row, section) {
684
+ var cellSpan = section.getCellColSpan(colIndex, row);
685
+
686
+ if (cellSpan <= 0) { // The specified cell is being occupied
687
+ colIndex += cellSpan; // Convert the given negative index to the spanning cell
688
+ cellSpan = section.getCellColSpan(colIndex, row);
689
+ }
690
+
691
+ return { "left": colIndex, "right": (colIndex + cellSpan - 1) };
692
+ };
693
+ /** @private
694
+ * @param {number} col
695
+ * @param {number} row
696
+ * @param {ILayoutGrid} section
697
+ * @return {!Object}
698
+ */
699
+ ColumnDraggingPlugin.prototype._findMoveableBorder = function(col, row, section) {
700
+ if (row < 0 || (!row && row !== 0)) { // Guaranteed to get out of infinite loop by checking undefined, NaN, null
701
+ return { "left": 0, "right": (section.getColumnCount() - 1) };
702
+ }
703
+ var span = this._getSpan(col, row, section);
704
+ if (span["right"] >= span["left"]) {
705
+ return span;
706
+ } else {
707
+ return this._findMoveableBorder(col, row - 1, section);
708
+ }
709
+ };
710
+ /**
711
+ * @private
712
+ */
713
+ ColumnDraggingPlugin.prototype._renderGuideline = function() {
714
+ var colIndex = this._pos["colIndex"];
715
+ if(colIndex == null || colIndex < 0) { // undefined, null or negative number
716
+ return;
717
+ }
718
+
719
+ var currentSpan = this._getSpan(colIndex, this._clickedRow, this._clickedSection);
720
+ var colStart = currentSpan["left"]; // This can be different from colIndex
721
+ var colEnd = currentSpan["right"];
722
+ var colLeft = this._clickedGrid.getColumnLeft(colStart);
723
+ var colWidth = 0;
724
+ for(var i = colStart; i <= colEnd; ++i) {
725
+ colWidth += this._clickedGrid.getColumnWidth(i);
726
+ }
727
+
728
+ var rightHand = this._pos["x"] > colLeft + colWidth / 2;
729
+ var destColumn = (rightHand) ? colEnd + 1 : colStart;
730
+
731
+ colLeft = this._clickedGrid.getColumnLeft(this._destColumn);
732
+ // If destination exceeds the specified bounds
733
+ if (destColumn < this._leftMovableBorder) {
734
+ destColumn = this._leftMovableBorder;
735
+ } else if (destColumn > this._rightMovableBorder) {
736
+ destColumn = this._rightMovableBorder + 1;
737
+ if(rightHand) {
738
+ colLeft -= 4; // Shift guideline to the left if this is the rightmost column
739
+ }
740
+ }
741
+
742
+ this._destColumn = destColumn;
743
+ this._guideline.style.left = colLeft + "px";
744
+ };
745
+
746
+ /**
747
+ * @private
748
+ * @param {boolean} inOut
749
+ */
750
+ ColumnDraggingPlugin.prototype._dimCol = function(inOut) {
751
+ var host = this._clickedGrid;
752
+ var titleCell = host.getSection("title").getColumn(this._startColumn).getCell(0);
753
+ var titleCellEl = titleCell.getElement();
754
+ if(inOut) {
755
+ titleCellEl.classList.add("drag-indicator");
756
+ } else {
757
+ titleCellEl.classList.remove("drag-indicator");
758
+ }
759
+ };
760
+
761
+
762
+
763
+ export default ColumnDraggingPlugin;
764
+ export { ColumnDraggingPlugin, ColumnDraggingPlugin as ColumnDragging, ColumnDraggingPlugin as ColumnDraggingExtension };