@refinitiv-ui/efx-grid 6.0.2 → 6.0.5

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 (203) 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 +146 -5
  8. package/lib/core/dist/core.css +1 -1
  9. package/lib/core/dist/core.js +468 -1092
  10. package/lib/core/dist/core.min.js +1 -1
  11. package/lib/core/es6/data/ColumnStats.d.ts +2 -2
  12. package/lib/core/es6/data/DataCache.d.ts +4 -4
  13. package/lib/core/es6/data/DataTable.d.ts +5 -5
  14. package/lib/core/es6/data/DataTable.js +33 -11
  15. package/lib/core/es6/data/DataView.d.ts +12 -18
  16. package/lib/core/es6/data/DataView.js +0 -4
  17. package/lib/core/es6/data/Segment.d.ts +2 -0
  18. package/lib/core/es6/data/Segment.js +7 -0
  19. package/lib/core/es6/data/SegmentCollection.d.ts +3 -3
  20. package/lib/core/es6/data/WrappedView.d.ts +13 -13
  21. package/lib/core/es6/data/WrappedView.js +6 -6
  22. package/lib/core/es6/grid/Core.d.ts +31 -27
  23. package/lib/core/es6/grid/Core.js +47 -11
  24. package/lib/core/es6/grid/ILayoutGrid.d.ts +15 -15
  25. package/lib/core/es6/grid/LayoutGrid.js +54 -26
  26. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +71 -0
  27. package/lib/core/es6/grid/components/Cell.d.ts +4 -4
  28. package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +1 -1
  29. package/lib/core/es6/grid/components/CellSpans.d.ts +8 -8
  30. package/lib/core/es6/grid/components/Column.d.ts +1 -1
  31. package/lib/core/es6/grid/components/ElementWrapper.d.ts +6 -6
  32. package/lib/core/es6/grid/components/Scrollbar.d.ts +3 -1
  33. package/lib/core/es6/grid/components/Scrollbar.js +13 -0
  34. package/lib/core/es6/grid/components/StretchedCells.js +2 -2
  35. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +14 -6
  36. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +147 -81
  37. package/lib/core/es6/grid/util/Conflator.d.ts +2 -2
  38. package/lib/core/es6/grid/util/ElementFrameWork.d.ts +3 -3
  39. package/lib/core/es6/grid/util/HttpRequest.d.ts +2 -2
  40. package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +1 -1
  41. package/lib/core/es6/grid/util/RangeBar.d.ts +1 -1
  42. package/lib/core/es6/grid/util/SectionSettings.d.ts +5 -5
  43. package/lib/core/es6/grid/util/SectionSettings.js +5 -0
  44. package/lib/core/es6/grid/util/SelectionList.d.ts +2 -2
  45. package/lib/core/es6/grid/util/TrackLayout.d.ts +7 -3
  46. package/lib/core/es6/grid/util/TrackLayout.js +27 -0
  47. package/lib/core/es6/grid/util/util.d.ts +2 -2
  48. package/lib/core/es6/index.d.ts +1 -5
  49. package/lib/core/es6/index.js +1 -7
  50. package/lib/core/es6/tr-grid-theme.js +1 -1
  51. package/lib/filter-dialog/lib/checkbox-list.d.ts +13 -1
  52. package/lib/filter-dialog/lib/filter-dialog.d.ts +14 -1
  53. package/lib/filter-dialog/lib/filter-dialog.js +86 -26
  54. package/lib/filter-dialog/themes/base-checkbox.less +8 -1
  55. package/lib/filter-dialog/themes/base.less +69 -1
  56. package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
  57. package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
  58. package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
  59. package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
  60. package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +2 -2
  61. package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
  62. package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
  63. package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +2 -2
  64. package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
  65. package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
  66. package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +2 -2
  67. package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
  68. package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
  69. package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +2 -2
  70. package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
  71. package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
  72. package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +2 -2
  73. package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
  74. package/lib/grid/lib/efx-grid.d.ts +25 -10
  75. package/lib/grid/lib/efx-grid.js +22 -56
  76. package/lib/grid/themes/base.less +1 -1
  77. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  78. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  79. package/lib/grid/themes/halo/efx-grid.less +33 -39
  80. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  81. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  82. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  83. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  84. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  85. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  86. package/lib/index.d.ts +2 -0
  87. package/lib/index.js +2 -0
  88. package/lib/row-segmenting/es6/RowSegmenting.d.ts +7 -2
  89. package/lib/row-segmenting/es6/RowSegmenting.js +98 -11
  90. package/lib/rt-grid/dist/rt-grid.js +1244 -1249
  91. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  92. package/lib/rt-grid/es6/ColumnDefinition.d.ts +5 -3
  93. package/lib/rt-grid/es6/ColumnDefinition.js +17 -108
  94. package/lib/rt-grid/es6/DataConnector.d.ts +3 -3
  95. package/lib/rt-grid/es6/Grid.d.ts +24 -9
  96. package/lib/rt-grid/es6/Grid.js +285 -103
  97. package/lib/rt-grid/es6/RowDefSorter.d.ts +19 -0
  98. package/lib/rt-grid/es6/RowDefSorter.js +137 -0
  99. package/lib/rt-grid/es6/RowDefinition.d.ts +9 -7
  100. package/lib/rt-grid/es6/RowDefinition.js +6 -0
  101. package/lib/rt-grid/es6/SnapshotFiller.d.ts +6 -1
  102. package/lib/rt-grid/es6/SnapshotFiller.js +144 -15
  103. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +4 -3
  104. package/lib/tr-grid-checkbox/es6/Checkbox.js +51 -21
  105. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +46 -9
  106. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +8 -4
  107. package/lib/tr-grid-column-stack/es6/ColumnStack.js +240 -125
  108. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +4 -3
  109. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +28 -13
  110. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +8 -5
  111. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +106 -3
  112. package/lib/tr-grid-percent-bar/es6/PercentBar.js +1 -1
  113. package/lib/tr-grid-printer/es6/CellWriter.d.ts +3 -3
  114. package/lib/tr-grid-printer/es6/GridPrinter.d.ts +1 -1
  115. package/lib/tr-grid-printer/es6/GridPrinter.js +26 -13
  116. package/lib/tr-grid-printer/es6/PrintTrait.d.ts +2 -2
  117. package/lib/tr-grid-printer/es6/SectionWriter.d.ts +3 -3
  118. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +3 -4
  119. package/lib/tr-grid-row-dragging/es6/RowDragging.js +86 -195
  120. package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +7 -2
  121. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +97 -7
  122. package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +8 -8
  123. package/lib/tr-grid-row-selection/es6/RowSelection.js +55 -31
  124. package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +1 -1
  125. package/lib/tr-grid-textformatting/es6/TextFormatting.js +12 -0
  126. package/lib/tr-grid-util/es6/CellPainter.js +1 -1
  127. package/lib/tr-grid-util/es6/DragUI.d.ts +16 -0
  128. package/lib/tr-grid-util/es6/DragUI.js +214 -0
  129. package/lib/tr-grid-util/es6/ElementObserver.d.ts +2 -0
  130. package/lib/tr-grid-util/es6/ElementObserver.js +32 -2
  131. package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -1
  132. package/lib/tr-grid-util/es6/ElfUtil.js +131 -28
  133. package/lib/tr-grid-util/es6/ExpanderIcon.js +2 -2
  134. package/lib/tr-grid-util/es6/FieldFormatter.js +7 -5
  135. package/lib/tr-grid-util/es6/GridPlugin.js +8 -4
  136. package/lib/tr-grid-util/es6/MultiTableManager.d.ts +8 -0
  137. package/lib/tr-grid-util/es6/MultiTableManager.js +164 -57
  138. package/lib/tr-grid-util/es6/NumberFormatter.d.ts +2 -0
  139. package/lib/tr-grid-util/es6/NumberFormatter.js +64 -19
  140. package/lib/tr-grid-util/es6/RowPainter.js +57 -19
  141. package/lib/tr-grid-util/es6/formula/Formula.js +9 -1
  142. package/lib/tr-grid-util/es6/jsx.d.ts +223 -0
  143. package/lib/types/es6/Checkbox.d.ts +4 -3
  144. package/lib/types/es6/ColumnStack.d.ts +8 -4
  145. package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +3 -2
  146. package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +2 -1
  147. package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +20 -18
  148. package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +2 -1
  149. package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +3 -2
  150. package/lib/types/es6/CompositeGrid/Plugin.d.ts +28 -0
  151. package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +2 -1
  152. package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +5 -4
  153. package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +2 -1
  154. package/lib/types/es6/CompositeGrid/index.d.ts +9 -9
  155. package/lib/types/es6/ConditionalColoring.d.ts +4 -3
  156. package/lib/types/es6/Core/data/ColumnStats.d.ts +2 -2
  157. package/lib/types/es6/Core/data/DataCache.d.ts +4 -4
  158. package/lib/types/es6/Core/data/DataTable.d.ts +5 -5
  159. package/lib/types/es6/Core/data/DataView.d.ts +12 -18
  160. package/lib/types/es6/Core/data/Segment.d.ts +2 -0
  161. package/lib/types/es6/Core/data/SegmentCollection.d.ts +3 -3
  162. package/lib/types/es6/Core/data/WrappedView.d.ts +13 -13
  163. package/lib/types/es6/Core/grid/Core.d.ts +31 -27
  164. package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +15 -15
  165. package/lib/types/es6/Core/grid/components/Cell.d.ts +4 -4
  166. package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +1 -1
  167. package/lib/types/es6/Core/grid/components/CellSpans.d.ts +8 -8
  168. package/lib/types/es6/Core/grid/components/Column.d.ts +1 -1
  169. package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +6 -6
  170. package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +3 -1
  171. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +14 -6
  172. package/lib/types/es6/Core/grid/util/Conflator.d.ts +2 -2
  173. package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +3 -3
  174. package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +2 -2
  175. package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +1 -1
  176. package/lib/types/es6/Core/grid/util/RangeBar.d.ts +1 -1
  177. package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +5 -5
  178. package/lib/types/es6/Core/grid/util/SelectionList.d.ts +2 -2
  179. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +7 -3
  180. package/lib/types/es6/Core/grid/util/util.d.ts +2 -2
  181. package/lib/types/es6/Core/index.d.ts +1 -5
  182. package/lib/types/es6/ExtensionOptions.d.ts +2 -0
  183. package/lib/types/es6/InCellEditing.d.ts +8 -5
  184. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +5 -3
  185. package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +3 -3
  186. package/lib/types/es6/RealtimeGrid/Grid.d.ts +24 -9
  187. package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +19 -0
  188. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +9 -7
  189. package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +6 -1
  190. package/lib/types/es6/RowDragging.d.ts +3 -4
  191. package/lib/types/es6/RowGrouping.d.ts +7 -2
  192. package/lib/types/es6/RowSegmenting.d.ts +7 -2
  193. package/lib/types/es6/RowSelection.d.ts +8 -8
  194. package/lib/types/es6/TextFormatting.d.ts +1 -1
  195. package/lib/types/es6/index.d.ts +1 -0
  196. package/lib/versions.json +17 -16
  197. package/package.json +1 -1
  198. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
  199. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.js +0 -615
  200. package/lib/core/es6/grid/plugins/Plugin.d.ts +0 -28
  201. package/lib/core/es6/grid/plugins/Plugin.js +0 -272
  202. package/lib/types/es6/Core/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
  203. package/lib/types/es6/Core/grid/plugins/Plugin.d.ts +0 -28
@@ -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
 
@@ -3014,10 +3022,144 @@ Deferred.prototype._finally = function() {
3014
3022
  /* harmony default export */ var es6_Deferred = (Deferred);
3015
3023
 
3016
3024
 
3025
+ // CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/ElementObserver.js
3026
+
3027
+ /** @namespace
3028
+ */
3029
+ var ElementObserver = {};
3030
+
3031
+ /** @private
3032
+ * @param {Element} elem
3033
+ * @param {MutationRecord} mutation
3034
+ */
3035
+ var _onLanguageMutated = function (elem, mutation) {
3036
+ if (mutation.type == "attributes" && mutation.attributeName == "lang") {
3037
+ elem.lang = mutation.target.lang || "en";
3038
+ }
3039
+ };
3040
+
3041
+ /** @private
3042
+ * @param {Function} listener
3043
+ * @param {string=} attributeName
3044
+ * @param {MutationRecord} mutation
3045
+ */
3046
+ var _onAttributeMutated = function (listener, attributeName, mutation) {
3047
+ if (mutation.type === "attributes") {
3048
+ if (attributeName != null) {
3049
+ if (mutation.attributeName === attributeName) {
3050
+ listener(mutation.target.getAttribute(attributeName));
3051
+ }
3052
+ } else {
3053
+ listener(mutation.target);
3054
+ }
3055
+ }
3056
+ };
3057
+
3058
+ /** @private
3059
+ * @return {string}
3060
+ */
3061
+ ElementObserver._getNewId = function () {
3062
+ var id = "observer_" + (++ElementObserver._id);
3063
+ return id;
3064
+ };
3065
+
3066
+ /** @private Observe any element
3067
+ * @param {Element} elem
3068
+ * @param {Function} listener
3069
+ * @param {Object=} opt_option
3070
+ */
3071
+ ElementObserver._addObserver = function(elem, listener, opt_option) {
3072
+ var option = opt_option;
3073
+ if (!option) {
3074
+ option = {};
3075
+ }
3076
+ option.attributes = true; //configure it to listen to attribute changes
3077
+
3078
+ ElementObserver._observer.observe(elem, option);
3079
+ ElementObserver._addListener(elem, listener);
3080
+ };
3081
+
3082
+ /** @private
3083
+ * @param {Array.<MutationRecord>} mutations
3084
+ */
3085
+ ElementObserver._onMutationCallback = function(mutations) {
3086
+ for (var i = 0; i < mutations.length; i++) {
3087
+ var mutation = mutations[i];
3088
+ var listeners = ElementObserver._listeners[mutation.target._observeId];
3089
+ for (var j = 0; j < listeners.length; j++) {
3090
+ listeners[j](mutation);
3091
+ }
3092
+ }
3093
+ };
3094
+
3095
+ /** @private
3096
+ * @param {Element} elem
3097
+ * @param {Function} fn
3098
+ */
3099
+ ElementObserver._addListener = function(elem, fn) {
3100
+ var listeners = ElementObserver._listeners;
3101
+ if (!listeners) {
3102
+ listeners = ElementObserver._listeners = {};
3103
+ }
3104
+ if (!elem._observeId) {
3105
+ var id = ElementObserver._getNewId();
3106
+ elem._observeId = id;
3107
+ }
3108
+ if (!listeners[elem._observeId]) { // Always check to support the using of separated ElfUtil module in testing page
3109
+ listeners[elem._observeId] = [];
3110
+ }
3111
+
3112
+ var listener = listeners[elem._observeId];
3113
+ if (listener.indexOf(fn) < 0) {
3114
+ listener.push(fn);
3115
+ }
3116
+ };
3117
+
3118
+ /** @public Add a listener to a html lang attribute
3119
+ * @param {Element} element An element within the DOM tree to watch for changes
3120
+ */
3121
+ ElementObserver.addLanguageListener = function(element) {
3122
+ if (!element) { return; }
3123
+
3124
+ element.lang = document.documentElement.lang || "en";
3125
+
3126
+ ElementObserver._addObserver(document.documentElement, _onLanguageMutated.bind(null, element));
3127
+ };
3128
+
3129
+ /** @public Add a listener to a html attribute
3130
+ * @param {Element} element An element within the DOM tree to watch for changes
3131
+ * @param {Function} listener A function which will be called on each attribute change
3132
+ * @param {string=} attributeName If not specified, listener will be called on every attribute change
3133
+ */
3134
+ ElementObserver.addAttributeListener = function(element, listener, attributeName) {
3135
+ if (!element || !listener) { return; }
3136
+ ElementObserver._addObserver(element, _onAttributeMutated.bind(null, listener, attributeName));
3137
+ };
3138
+
3139
+ /**
3140
+ * @type {MutationObserver}
3141
+ * @private
3142
+ */
3143
+ ElementObserver._observer = new MutationObserver(ElementObserver._onMutationCallback);
3144
+ /**
3145
+ * @type {Obect}
3146
+ * @private
3147
+ */
3148
+ ElementObserver._listeners = {};
3149
+ /**
3150
+ * @type {number}
3151
+ * @private
3152
+ */
3153
+ ElementObserver._id = 0;
3154
+
3155
+ /* harmony default export */ var es6_ElementObserver = (ElementObserver);
3156
+
3157
+
3017
3158
  // CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/ElfUtil.js
3018
3159
 
3019
3160
 
3020
3161
 
3162
+
3021
3163
  /** Dialog supporting language (selection dialog, formater dialog and filter dialog)
3022
3164
  * @type {!Object.<string, boolean>}
3023
3165
  * @private
@@ -3080,6 +3222,22 @@ ElfUtil._dummyIcon = null;
3080
3222
  * @private
3081
3223
  */
3082
3224
  ElfUtil._iconLoaded = false;
3225
+ /** @type {string|null}
3226
+ * @private
3227
+ */
3228
+ ElfUtil._profileName = null;
3229
+ /** @type {Array}
3230
+ * @private
3231
+ */
3232
+ ElfUtil._callbacks = [];
3233
+ /** @type {boolean}
3234
+ * @private
3235
+ */
3236
+ ElfUtil._observed = false;
3237
+ /** @type {boolean}
3238
+ * @private
3239
+ */
3240
+ ElfUtil._pendingResolve = false;
3083
3241
 
3084
3242
  /** @type {Object.<string, Object>}
3085
3243
  * @private
@@ -3095,7 +3253,7 @@ ElfUtil._icons = {
3095
3253
  "sortable": "sort-up-down"
3096
3254
  },
3097
3255
  "columnStack": {
3098
- "stack": "list",
3256
+ "stack": "map-layers",
3099
3257
  "expand": "right",
3100
3258
  "collapse": "left"
3101
3259
  }
@@ -3351,57 +3509,146 @@ ElfUtil.getCssVariables = function (obj, optElem) {
3351
3509
  return obj || null;
3352
3510
  };
3353
3511
 
3512
+ /** @public
3513
+ * @param {Object} rtk
3514
+ */
3515
+ ElfUtil.setRTK = function(rtk) {
3516
+ if(rtk != null) {
3517
+ ElfUtil._rtk = rtk;
3518
+ }
3519
+ };
3520
+
3521
+ /** Get current profile name set on the root html element (document.documentElement)
3522
+ * @public
3523
+ * @return {string} Current profile name
3524
+ */
3525
+ ElfUtil.getMovementColorProfile = function() {
3526
+ return document.documentElement.getAttribute("movement-color-profile");
3527
+ };
3528
+
3529
+ /** @private
3530
+ * @param {Function} cb
3531
+ */
3532
+ ElfUtil._addThemeChangedCallback = function(cb) {
3533
+ var callbacks = ElfUtil._callbacks;
3534
+ if(callbacks.indexOf(cb) < 0) {
3535
+ callbacks.push(cb);
3536
+ }
3537
+ };
3538
+
3354
3539
  /** 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>
3540
+ * WANRING: This method sets movement color profile to html tag automatically, if JET.Settings exists or RTK is available. <br>
3356
3541
  * To re-request/reset theme colors, set ElfUtil.themeReady variable to null
3357
3542
  * @public
3543
+ * @param {Function=} themeChangedCb
3358
3544
  * @return {Promise<Object>} A promise of object of theme colors
3359
3545
  */
3360
- ElfUtil.getThemeColors = function() {
3546
+ ElfUtil.getThemeColors = function(themeChangedCb) {
3547
+ if(typeof themeChangedCb === "function") {
3548
+ ElfUtil._addThemeChangedCallback(themeChangedCb);
3549
+ }
3550
+
3361
3551
  if(ElfUtil.themeReady) {
3362
3552
  return ElfUtil.themeReady;
3363
3553
  }
3554
+
3364
3555
  var d = ElfUtil._deferred = new Deferred();
3365
3556
  ElfUtil.themeReady = d.promise;
3366
3557
 
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");
3558
+ var profileName = ElfUtil.getMovementColorProfile();
3559
+ if(profileName) {
3560
+ if(profileName !== ElfUtil._profileName) {
3561
+ setTimeout(ElfUtil._profileNameRetrieved, 100); // TODO: Find a proper way to ensure that theme is ready
3562
+ } else {
3563
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
3376
3564
  }
3377
3565
  } else {
3378
- setTimeout(ElfUtil._retrieveThemeColors, 100); // TODO: Find a proper way to ensure that theme is ready
3566
+ var options = {
3567
+ providerName: "Configuration",
3568
+ settingName: "RDE_USER_CURRENT_TICK_COLOR"
3569
+ };
3570
+
3571
+ var jet = window ? window.JET : null;
3572
+ if(ElfUtil._rtk && ElfUtil._rtk.Settings) {
3573
+ ElfUtil._rtk.Settings.getAsync(options).then(ElfUtil._loadingProfileSuccess, ElfUtil._loadingProfileFailure);
3574
+ } else if(jet && jet.Settings) {
3575
+ try {
3576
+ jet.Settings.read(ElfUtil._loadingProfileSuccess, options);
3577
+ } catch (err) {
3578
+ ElfUtil._loadingProfileFailure();
3579
+ }
3580
+ } else {
3581
+ setTimeout(ElfUtil._profileNameRetrieved, 100); // TODO: Find a proper way to ensure that theme is ready
3582
+ }
3379
3583
  }
3584
+
3380
3585
  return d.promise;
3381
3586
  };
3382
3587
 
3383
- /** Get user's color profile from JET and set it to html tag (document.documentElement)
3588
+ /** @private
3589
+ * @param {string} profileName
3590
+ */
3591
+ var movementColorProfileChanged = function(profileName) {
3592
+ if(profileName && profileName !== ElfUtil._profileName) {
3593
+ ElfUtil._retrieveThemeColors(profileName);
3594
+
3595
+ if(ElfUtil._pendingResolve) {
3596
+ ElfUtil._pendingResolve = false;
3597
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
3598
+ }
3599
+
3600
+ var callbacks = ElfUtil._callbacks;
3601
+ for (var i = 0; i < callbacks.length; i++) {
3602
+ callbacks[i]();
3603
+ }
3604
+ }
3605
+ };
3606
+
3607
+ /** Get user's color profile from JET or TRK and set it to html tag (document.documentElement)
3384
3608
  * @private
3385
- * @param {string} colorProfile Returned from JET.Settings
3609
+ * @param {string} profileName Returned from JET.Settings or RTK.Settings
3386
3610
  */
3387
- ElfUtil._onColorProfile = function (colorProfile) {
3388
- if(colorProfile) {
3389
- document.documentElement.setAttribute("movement-color-profile", colorProfile.toLowerCase());
3611
+ ElfUtil._loadingProfileSuccess = function(profileName) {
3612
+ if(profileName) {
3613
+ document.documentElement.setAttribute("movement-color-profile", profileName.toLowerCase());
3614
+ }
3615
+
3616
+ if(ElfUtil._observed) { // Let attribute listener does the job
3617
+ ElfUtil._pendingResolve = true;
3618
+ } else {
3619
+ ElfUtil._profileNameRetrieved(profileName);
3390
3620
  }
3391
- ElfUtil._retrieveThemeColors();
3392
3621
  };
3393
- /** Get current profile name set on the root html element (document.documentElement)
3394
- * @public
3395
- * @return {string} Current profile name
3622
+
3623
+ /** @private
3396
3624
  */
3397
- ElfUtil.getMovementColorProfile = function() {
3398
- return document.documentElement.getAttribute("movement-color-profile");
3625
+ ElfUtil._loadingProfileFailure = function() {
3626
+ if(!ElfUtil._observed) {
3627
+ ElfUtil._observed = true;
3628
+ ElementObserver.addAttributeListener(document.documentElement, movementColorProfileChanged, "movement-color-profile");
3629
+ }
3630
+ ElfUtil._deferred.reject("Failed to get movement color profile from settings.");
3631
+ };
3632
+
3633
+ /** @private
3634
+ */
3635
+ ElfUtil._profileNameRetrieved = function() {
3636
+ var profileName = ElfUtil.getMovementColorProfile();
3637
+ ElfUtil._retrieveThemeColors(profileName);
3638
+ if(!ElfUtil._observed) {
3639
+ ElfUtil._observed = true;
3640
+ ElementObserver.addAttributeListener(document.documentElement, movementColorProfileChanged, "movement-color-profile");
3641
+ }
3642
+ ElfUtil._deferred.resolve(ElfUtil.themeColors);
3399
3643
  };
3400
3644
 
3401
3645
  /** Get theme colors from document
3402
3646
  * @private
3647
+ * @param {string} profileName Movement color profile name
3403
3648
  */
3404
- ElfUtil._retrieveThemeColors = function() {
3649
+ ElfUtil._retrieveThemeColors = function(profileName) {
3650
+ ElfUtil._profileName = profileName;
3651
+
3405
3652
  var colors = ElfUtil.themeColors = ElfUtil.getCssVariables({
3406
3653
  "primary": "--color-scheme-primary", // Usually used in headers, and selection
3407
3654
  "secondary": "--color-scheme-secondary",
@@ -3466,11 +3713,8 @@ ElfUtil._retrieveThemeColors = function() {
3466
3713
  colors["baseGrid"] = colors["tableBg"];
3467
3714
  colors["baseText"] = colors["tableText"];
3468
3715
  colors["trackColor"] = colors["primary"] || ElfUtil._defaultColors["trackColor"];
3469
-
3470
- ElfUtil._deferred.resolve(colors);
3471
3716
  };
3472
3717
 
3473
-
3474
3718
  /* harmony default export */ var es6_ElfUtil = (ElfUtil);
3475
3719
 
3476
3720
 
@@ -9698,6 +9942,13 @@ Segment.prototype.removeAllChildren = function(objMap) {
9698
9942
  Segment.prototype.getChildIds = function() {
9699
9943
  return this._childCount ? Object.keys(this._children) : [];
9700
9944
  };
9945
+ /** @public
9946
+ * @return {number}
9947
+ */
9948
+ Segment.prototype.getChildCount = function() {
9949
+ return this._childCount;
9950
+ };
9951
+
9701
9952
 
9702
9953
 
9703
9954
  /** @public
@@ -11036,7 +11287,7 @@ DataTable.prototype.setColumnSortingLogic = function(cid, func) {
11036
11287
  * @example
11037
11288
  * var prevState = dt.freeze();
11038
11289
  * for(var i = 0; i < 100; ++i) {
11039
- * dt.insertRow({}); // no event is fired
11290
+ * dt.insertRow(); // no event is fired
11040
11291
  * }
11041
11292
  * dt.freeze(prevState); // Restore previous freeze states
11042
11293
  */
@@ -11073,6 +11324,7 @@ DataTable.prototype.isFrozen = function() {
11073
11324
  */
11074
11325
  DataTable.prototype.setSegmentSeparator = function(rid, enabled) {
11075
11326
  var change = false;
11327
+ var memberCount = 0;
11076
11328
  if(typeof rid === "string") {
11077
11329
  if(enabled !== false) {
11078
11330
  if(!this._segments) {
@@ -11082,16 +11334,20 @@ DataTable.prototype.setSegmentSeparator = function(rid, enabled) {
11082
11334
  change = true;
11083
11335
  }
11084
11336
  } else if(this._segments) {
11085
- if(this._segments.removeSegment(rid)) {
11086
- change = true;
11087
- if(!this._segments.getSegmentCount()) {
11088
- this._segments = null;
11337
+ var segment = this._segments.getSegment(rid);
11338
+ if(segment) {
11339
+ memberCount = segment.getChildCount();
11340
+ if(this._segments.removeSegment(rid)) {
11341
+ change = true;
11342
+ if(!this._segments.getSegmentCount()) {
11343
+ this._segments = null;
11344
+ }
11089
11345
  }
11090
11346
  }
11091
11347
  }
11092
11348
  }
11093
11349
  if(change && this._needFiring()) {
11094
- if(this._autoFillSegments()) {
11350
+ if(this._autoFillSegments() || memberCount) {
11095
11351
  this.dispatchGlobalChange();
11096
11352
  } else {
11097
11353
  var rowData = this._rows[rid] || null;
@@ -11203,13 +11459,14 @@ DataTable.prototype._autoFillSegments = function() {
11203
11459
  }
11204
11460
  return false;
11205
11461
  };
11206
- /** Remove existing segment children and fill the segments with all contnet rows before the next segment separator
11462
+ /** Remove existing segment children and fill the segments with all content rows before the next segment separator
11207
11463
  * @public
11208
11464
  * @param {string} segmentId Row id
11209
11465
  */
11210
11466
  DataTable.prototype.fillSegment = function(segmentId) {
11211
11467
  if(this._segments) {
11212
11468
  this._segments.fillSegment(segmentId, this._rids);
11469
+ this.dispatchGlobalChange();
11213
11470
  }
11214
11471
  };
11215
11472
  /** Remove all existing segment children in each segment and fill the segments with all contnet rows before the next segment separator
@@ -11218,7 +11475,11 @@ DataTable.prototype.fillSegment = function(segmentId) {
11218
11475
  */
11219
11476
  DataTable.prototype.fillSegments = function() {
11220
11477
  if(this._segments) {
11221
- return this._segments.fillSegments(this._rids);
11478
+ var dirty = this._segments.fillSegments(this._rids);
11479
+ if(dirty) {
11480
+ this.dispatchGlobalChange();
11481
+ }
11482
+ return dirty;
11222
11483
  }
11223
11484
  return false;
11224
11485
  };
@@ -11263,7 +11524,11 @@ DataTable.prototype.addSegmentChildren = function(segmentId, rids) {
11263
11524
  */
11264
11525
  DataTable.prototype.removeSegmentChild = function(segmentId, rid) {
11265
11526
  if(this._segments) {
11266
- return this._segments.removeSegmentChild(segmentId, rid);
11527
+ var dirty = this._segments.removeSegmentChild(segmentId, rid);
11528
+ if(dirty) {
11529
+ this.dispatchGlobalChange();
11530
+ }
11531
+ return dirty;
11267
11532
  }
11268
11533
  return false;
11269
11534
  };
@@ -11274,7 +11539,11 @@ DataTable.prototype.removeSegmentChild = function(segmentId, rid) {
11274
11539
  */
11275
11540
  DataTable.prototype.removeSegmentChildren = function(segmentId, rids) {
11276
11541
  if(this._segments) {
11277
- return this._segments.removeSegmentChildren(segmentId, rids);
11542
+ var dirty = this._segments.removeSegmentChildren(segmentId, rids);
11543
+ if(dirty) {
11544
+ this.dispatchGlobalChange();
11545
+ }
11546
+ return dirty;
11278
11547
  }
11279
11548
  return false;
11280
11549
  };
@@ -11283,7 +11552,11 @@ DataTable.prototype.removeSegmentChildren = function(segmentId, rids) {
11283
11552
  */
11284
11553
  DataTable.prototype.removeAllSegmentChildren = function() {
11285
11554
  if(this._segments) {
11286
- return this._segments.removeAllSegmentChildren();
11555
+ var dirty = this._segments.removeAllSegmentChildren();
11556
+ if (dirty) {
11557
+ this.dispatchGlobalChange();
11558
+ }
11559
+ return dirty;
11287
11560
  }
11288
11561
  return false;
11289
11562
  };
@@ -12215,6 +12488,12 @@ RowDefinition.prototype.setDataSource = function(dataSource) {
12215
12488
  // This will work for runtime row insertion, but not for first initilization.
12216
12489
  this.subscribeForUpdates();
12217
12490
  };
12491
+ /** @public
12492
+ * @return {DataCache} dataSource
12493
+ */
12494
+ RowDefinition.prototype.getDataSource = function() {
12495
+ return this._dc;
12496
+ };
12218
12497
 
12219
12498
  /** @public
12220
12499
  * @return {Object} rowData
@@ -13337,16 +13616,12 @@ var _toAlignment = function(str) {
13337
13616
  var ColumnDefinition = function(columnOption, hostGrid) {
13338
13617
  this._defaultRenderer = this._defaultRenderer.bind(this);
13339
13618
  this._customRenderer = this._customRenderer.bind(this);
13340
- this._defaultSorter = this._defaultSorter.bind(this);
13341
- this._dataSorter = this._dataSorter.bind(this);
13342
- this._rowDefSorter = this._rowDefSorter.bind(this);
13343
13619
 
13344
13620
  this._id = "" + ColumnDefinition._runningId++;
13345
13621
  this._internalRenderer = this._defaultRenderer;
13346
13622
  this._internalSorter = this._defaultSorter;
13347
13623
 
13348
13624
  this._eventArg = {"colDef": this}; // WARNING: Circular reference
13349
- this._sortContext = {"colDef": this};
13350
13625
  if(hostGrid) {
13351
13626
  this._updateContext("grid", hostGrid);
13352
13627
  this._updateContext("core", hostGrid["getCoreGrid"]()); // TODO: Handle multiple core grids
@@ -13415,15 +13690,6 @@ ColumnDefinition.prototype._activatedRenderer = null;
13415
13690
  * @private
13416
13691
  */
13417
13692
  ColumnDefinition.prototype._rendererMap = null;
13418
- /** @type {!Function}
13419
- * @private
13420
- */
13421
- ColumnDefinition.prototype._internalSorter;
13422
- /** Workaround to provide user a context during the sorting process
13423
- * @type {Object}
13424
- * @private
13425
- */
13426
- ColumnDefinition.prototype._sortContext = null;
13427
13693
  /** @type {Function}
13428
13694
  * @private
13429
13695
  */
@@ -13669,25 +13935,6 @@ ColumnDefinition.prototype.getRenderer = function() {
13669
13935
  ColumnDefinition.prototype.getHeaderRenderer = function() {
13670
13936
  return this._headerRenderer;
13671
13937
  };
13672
- /** @public
13673
- * @return {!Function}
13674
- */
13675
- ColumnDefinition.prototype.getSorter = function() {
13676
- return this._internalSorter;
13677
- };
13678
- /** Internal method for preparing sort context
13679
- * @public
13680
- * @ignore
13681
- * @param {number} colIndex
13682
- * @return {!Function}
13683
- */
13684
- ColumnDefinition.prototype._prepareSortContext = function(colIndex) {
13685
- // TODO: Context does not get updated when column is moved or removed
13686
- this._sortContext["colIndex"] = colIndex;
13687
- this._sortContext["field"] = this._field;
13688
-
13689
- return this._internalSorter;
13690
- };
13691
13938
 
13692
13939
  /** @public
13693
13940
  * @return {string}
@@ -14085,21 +14332,27 @@ ColumnDefinition.prototype.activateRenderer = function(id, func) {
14085
14332
  this.setRenderer(renderer);
14086
14333
  return this._activatedRenderer ? true : false;
14087
14334
  };
14335
+
14336
+ /** @public
14337
+ * @return {Function}
14338
+ */
14339
+ ColumnDefinition.prototype.getSorter = function() {
14340
+ return this._userSorter;
14341
+ };
14088
14342
  /** @public
14089
14343
  * @param {ColumnDefinition~SortLogic=} func
14090
14344
  */
14091
14345
  ColumnDefinition.prototype.setSorter = function(func) {
14092
- if(typeof func === "function") {
14093
- this._userSorter = func;
14094
- if(this._rowSorting == null) {
14095
- this._internalSorter = this._realTimeField ? this._dataSorter : this._rowDefSorter;
14096
- } else {
14097
- this._internalSorter = !this._rowSorting ? this._dataSorter : this._rowDefSorter;
14098
- }
14099
- } else {
14100
- this._userSorter = null;
14101
- this._internalSorter = this._defaultSorter;
14346
+ this._userSorter = (typeof func === "function") ? func : null;
14347
+ };
14348
+ /** @public
14349
+ * @return {boolean}
14350
+ */
14351
+ ColumnDefinition.prototype.isRowSorting = function() {
14352
+ if(this._rowSorting == null) {
14353
+ return !this._realTimeField;
14102
14354
  }
14355
+ return this._rowSorting ? true : false;
14103
14356
  };
14104
14357
 
14105
14358
  /** To allow user change column name in run-time (language change or localization)
@@ -14218,78 +14471,13 @@ ColumnDefinition.prototype._customRenderer = function(e) {
14218
14471
  }
14219
14472
  }
14220
14473
  };
14221
- /** @private
14222
- * @param {RowDefinition} rowDefA
14223
- * @param {RowDefinition} rowDefB
14224
- * @param {number} order
14225
- * @return {number}
14226
- */
14227
- ColumnDefinition.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
14228
- var orderA = rowDefA.getGroupOrder();
14229
- var orderB = rowDefB.getGroupOrder();
14230
- if(orderA !== orderB) {
14231
- return orderA - orderB; // Regardless of sort order
14232
- }
14233
-
14234
- var a = rowDefA.getData(this._field);
14235
- var b = rowDefB.getData(this._field);
14236
-
14237
- if(a == null || a !== a) {
14238
- if(b == null || b !== b) {
14239
- return 0;
14240
- }
14241
- return 1;
14242
- }
14243
- if(b == null || b !== b) {
14244
- return -1;
14245
- }
14246
-
14247
- if(a < b) {
14248
- return -order;
14249
- }
14250
- if(b < a) {
14251
- return order;
14252
- }
14253
- return 0;
14254
- };
14255
- /** @private
14256
- * @param {RowDefinition} rowDefA
14257
- * @param {RowDefinition} rowDefB
14258
- * @param {number} order
14259
- * @return {number}
14260
- */
14261
- ColumnDefinition.prototype._dataSorter = function(rowDefA, rowDefB, order) {
14262
- var orderA = rowDefA.getGroupOrder();
14263
- var orderB = rowDefB.getGroupOrder();
14264
- if(orderA !== orderB) {
14265
- return orderA - orderB; // Regardless of sort order
14266
- }
14267
14474
 
14268
- var a = rowDefA.getData(this._field);
14269
- var b = rowDefB.getData(this._field);
14270
- return this._userSorter(a, b, order, this._sortContext);
14271
- };
14272
- /** @private
14273
- * @param {RowDefinition} rowDefA
14274
- * @param {RowDefinition} rowDefB
14275
- * @param {number} order
14276
- * @return {number}
14277
- */
14278
- ColumnDefinition.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
14279
- var orderA = rowDefA.getGroupOrder();
14280
- var orderB = rowDefB.getGroupOrder();
14281
- if(orderA !== orderB) {
14282
- return orderA - orderB; // Regardless of sort order
14283
- }
14284
-
14285
- return this._userSorter(rowDefA, rowDefB, order, this._sortContext);
14286
- };
14287
14475
  /** @private
14288
14476
  * @param {string} propName
14289
14477
  * @param {*} val
14290
14478
  */
14291
14479
  ColumnDefinition.prototype._updateContext = function(propName, val) {
14292
- this._eventArg[propName] = this._sortContext[propName] = val;
14480
+ this._eventArg[propName] = val;
14293
14481
  };
14294
14482
 
14295
14483
  /** @public
@@ -14309,6 +14497,8 @@ ColumnDefinition.prototype.clearUserModel = function() {
14309
14497
  /* harmony default export */ var js_ColumnDefinition = (ColumnDefinition);
14310
14498
 
14311
14499
  // CONCATENATED MODULE: ./src/js/SnapshotFiller.js
14500
+ /* eslint-disable */
14501
+
14312
14502
 
14313
14503
 
14314
14504
 
@@ -14332,6 +14522,9 @@ var SnapshotFiller = function () {
14332
14522
 
14333
14523
  this._rics = {};
14334
14524
  this._fields = {};
14525
+ this._adcOptions = { // TODO: support requesting level parameter
14526
+ productId: "001"
14527
+ };
14335
14528
  };
14336
14529
  Ext["a" /* Ext */].inherits(SnapshotFiller, EventDispatcher["a" /* EventDispatcher */]);
14337
14530
 
@@ -14352,6 +14545,10 @@ SnapshotFiller.prototype._fields;
14352
14545
  * @private
14353
14546
  */
14354
14547
  SnapshotFiller.prototype._rtk;
14548
+ /** @type {!Grid~ADCOptions}
14549
+ * @private
14550
+ */
14551
+ SnapshotFiller.prototype._adcOptions = null;
14355
14552
  //#endregion Private Members
14356
14553
 
14357
14554
  /** @public
@@ -14361,6 +14558,26 @@ SnapshotFiller.prototype.setRTK = function (rtk) {
14361
14558
  this._rtk = rtk;
14362
14559
  };
14363
14560
 
14561
+ /** @public
14562
+ * @param {Grid~ADCOptions} adcOptions ADC requesting level parameter options
14563
+ */
14564
+ SnapshotFiller.prototype.setADCOptions = function (adcOptions) {
14565
+
14566
+ var val = adcOptions["productId"];
14567
+ if(val) {
14568
+ this._adcOptions.productId = val;
14569
+ }
14570
+ // TODO: support requesting level parameter https://confluence.refinitiv.com/display/ADC/Request+level+parameters
14571
+ // var val = adcOptions["lang"];
14572
+ // if(val) {
14573
+ // this._adcOptions.lang = val;
14574
+ // }
14575
+ // var val = adcOptions["cache"];
14576
+ // if(val) {
14577
+ // this._adcOptions.cache = val;
14578
+ // }
14579
+ };
14580
+
14364
14581
  /** @public
14365
14582
  * @param {string} ric
14366
14583
  */
@@ -14379,6 +14596,26 @@ SnapshotFiller.prototype.addRic = function (ric) {
14379
14596
  }
14380
14597
  };
14381
14598
  /** @public
14599
+ * @param {Array.<string>} rics
14600
+ * @return {boolean}
14601
+ */
14602
+ SnapshotFiller.prototype.addRics = function (rics) {
14603
+ var len = rics ? rics.length : 0;
14604
+ var dirty = false;
14605
+ for(var i = 0; i < len; ++i) {
14606
+ var ric = rics[i];
14607
+ if (ric && !this._rics[ric]) {
14608
+ this._rics[ric] = 1;
14609
+ dirty = true;
14610
+ }
14611
+ }
14612
+ if(dirty) {
14613
+ this._request();
14614
+ return true;
14615
+ }
14616
+ return false;
14617
+ };
14618
+ /** @public
14382
14619
  * @param {string} str
14383
14620
  */
14384
14621
  SnapshotFiller.prototype.addField = function (str) {
@@ -14388,6 +14625,7 @@ SnapshotFiller.prototype.addField = function (str) {
14388
14625
  };
14389
14626
  /** @public
14390
14627
  * @param {Array.<string>} fields
14628
+ * @return {boolean}
14391
14629
  */
14392
14630
  SnapshotFiller.prototype.addFields = function (fields) {
14393
14631
  var len = fields.length;
@@ -14397,7 +14635,9 @@ SnapshotFiller.prototype.addFields = function (fields) {
14397
14635
  }
14398
14636
  if(dirty) {
14399
14637
  this._request();
14638
+ return true;
14400
14639
  }
14640
+ return false;
14401
14641
  };
14402
14642
 
14403
14643
  /** @private
@@ -14455,29 +14695,37 @@ SnapshotFiller.prototype._onRequest = function () {
14455
14695
  return;
14456
14696
  }
14457
14697
 
14458
- var reqFields = [];
14459
- for(i = 0; i < fieldLen; i++) {
14460
- reqFields.push({ "name": fields[i] });
14461
- }
14462
-
14463
14698
  // Clean up members, preparing for the next request
14464
14699
  this._rics = {};
14465
14700
  this._fields = {};
14466
14701
 
14467
- var payload = {
14468
- "instruments": instruments,
14469
- "fields": reqFields
14470
- };
14471
-
14472
- var onSuccess = this._onSuccess.bind(this, fields);
14702
+ var onSuccess, payload;
14473
14703
  if (this._rtk) {
14474
- this._rtk.Data.DataGrid
14704
+ var strFields = fields.join(',');
14705
+ payload = {
14706
+ "method": "select",
14707
+ "formula": strFields,
14708
+ "identifiers": instruments,
14709
+ "productId": this._adcOptions.productId,
14710
+ "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"
14711
+ };
14712
+ onSuccess = this._onRTKSuccess.bind(this, fields);
14713
+ this._rtk.Data.Adc
14475
14714
  .request(payload)
14476
14715
  .then(onSuccess)
14477
14716
  .catch(function (err) {
14478
14717
  console.log(err);
14479
14718
  });
14480
14719
  } else {
14720
+ var reqFields = [];
14721
+ for(i = 0; i < fieldLen; i++) {
14722
+ reqFields.push({ "name": fields[i] });
14723
+ }
14724
+ payload = {
14725
+ "instruments": instruments,
14726
+ "fields": reqFields
14727
+ };
14728
+ onSuccess = this._onJETSuccess.bind(this, fields);
14481
14729
  jet["Data"]("datagrid")
14482
14730
  .then(function (service) { return service["request"](payload); })
14483
14731
  .then(JSON.parse)
@@ -14493,16 +14741,15 @@ SnapshotFiller.prototype._onRequest = function () {
14493
14741
  * @param {Array.<string>} fields
14494
14742
  * @param {string} serverResult
14495
14743
  */
14496
- SnapshotFiller.prototype._onSuccess = function (fields, serverResult) {
14744
+ SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
14745
+ this._dispatch("adcDataReceived", serverResult);
14497
14746
  var data2D = serverResult["data"];
14498
14747
  var svHeaders = serverResult["headers"] && serverResult["headers"][0];
14499
14748
 
14500
14749
  if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
14501
- console.log("Invalid server response detected");
14502
14750
  return; //TODO: Return Promise.reject(errMsg);
14503
14751
  }
14504
14752
 
14505
- this._dispatch("adcDataReceived", serverResult);
14506
14753
 
14507
14754
  // Server will return field only in UPPERCASE
14508
14755
  // ex. requestField = TR.Volume ===> serverField = TR.VOLUME
@@ -14559,6 +14806,76 @@ SnapshotFiller.prototype._onSuccess = function (fields, serverResult) {
14559
14806
  });
14560
14807
  };
14561
14808
 
14809
+ /** @private
14810
+ * @function
14811
+ * @param {Array.<string>} fields
14812
+ * @param {string} serverResult
14813
+ */
14814
+ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
14815
+ this._dispatch("adcDataReceived", serverResult);
14816
+ var data2D = serverResult["rows"];
14817
+ var svHeaders = serverResult["rows"] && serverResult["rows"][0];
14818
+ if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
14819
+ return; //TODO: Return Promise.reject(errMsg);
14820
+ }
14821
+
14822
+ // Server will return field only in UPPERCASE
14823
+ // ex. requestField = TR.Volume ===> serverField = TR.VOLUME
14824
+ // so we need convert UPPERCASE to be original
14825
+ var i, field, ric;
14826
+ var j = 1; // to skip instrument index, use j = 1
14827
+ var fLength = fields.length;
14828
+ var hLength = svHeaders.length;
14829
+ var headers = new Array(hLength);
14830
+ for (i = 0; i < fLength && j < hLength; i++) {
14831
+ field = fields[i];
14832
+ if (svHeaders[j].r.toUpperCase() === field.toUpperCase()) {
14833
+ headers[j] = field;
14834
+ j++;
14835
+ }
14836
+ }
14837
+
14838
+ var len = data2D.length;
14839
+ var fieldLen = headers.length;
14840
+ var ricMap = {};
14841
+
14842
+ // TODO: Freeze the data view before setting multiple data
14843
+ for (i = 1; i < len; i++) { // to skip column header index, use i = 1
14844
+ var dataRow = data2D[i];
14845
+ ric = dataRow[0];
14846
+
14847
+ var snapData = ricMap[ric] = {};
14848
+
14849
+ // loop for create rowData for update
14850
+ for (j = 1; j < fieldLen; j++) { // to skip instrument index, use j = 1
14851
+ var value = dataRow[j];
14852
+ if (value != null && value !== "") {
14853
+ if(typeof value !== 'object') {
14854
+ field = headers[j];
14855
+ snapData[field] = value;
14856
+ }
14857
+ // TODO : handled when a cell has a mistake and the value appears as {f: "1"} ( description error in fault attribute at index 1 ),
14858
+ // Therefore, we need to store information to the error field for this cell.
14859
+ // else {}
14860
+
14861
+ }
14862
+ }
14863
+ }
14864
+
14865
+ // return result only ric that has update data
14866
+ var updatedData = {};
14867
+ for (ric in ricMap) {
14868
+ var obj = ricMap[ric];
14869
+ if (!isEmptyObject(obj)) {
14870
+ updatedData[ric] = obj;
14871
+ }
14872
+ }
14873
+
14874
+ this._dispatch("dataChanged", {
14875
+ data: updatedData
14876
+ });
14877
+ };
14878
+
14562
14879
 
14563
14880
  /* harmony default export */ var js_SnapshotFiller = (SnapshotFiller);
14564
14881
 
@@ -16549,6 +16866,33 @@ TrackLayout.prototype.setLaneSize = function (index, val) {
16549
16866
  return false;
16550
16867
  };
16551
16868
 
16869
+ /** @public
16870
+ * @param {number} index
16871
+ * @param {string} propName
16872
+ * @param {*} val
16873
+ * @return {boolean}
16874
+ */
16875
+ TrackLayout.prototype.setLaneProperty = function (index, propName, val) {
16876
+ if (index < 0 || index >= this._laneCount) { return false; }
16877
+
16878
+ var col = this._cols[index];
16879
+ if (col == null || col[propName] !== val) {
16880
+ col = this._newColumn(index);
16881
+ col[propName] = val;
16882
+ return true;
16883
+ }
16884
+
16885
+ return false;
16886
+ };
16887
+ /** @public
16888
+ * @param {number} index
16889
+ * @param {string} propName
16890
+ * @return {*}
16891
+ */
16892
+ TrackLayout.prototype.getLaneProperty = function (index, propName) {
16893
+ var col = this._cols[index];
16894
+ return (col && col[propName] != null) ? col[propName] : null;
16895
+ };
16552
16896
  /** @public
16553
16897
  * @param {number} index
16554
16898
  * @return {number}
@@ -17880,10 +18224,16 @@ Column.prototype.show = function (opt_shown) {
17880
18224
  */
17881
18225
  Column.prototype.setWidth = function (val) {
17882
18226
  this._element.style.width = val + "px";
17883
- var magnitude = (val > 0 && val <= 60) ? 3 - Math.floor((val - 0.01) / 20) : 0;
17884
- if(magnitude < 0 || magnitude > 3) {
18227
+ var magnitude = 0;
18228
+ if(val > 0 && val <= 24){
17885
18229
  magnitude = 3;
17886
18230
  }
18231
+ else if(val > 24 && val <= 40){
18232
+ magnitude = 2;
18233
+ }
18234
+ else if(val > 40 && val < 60){
18235
+ magnitude = 1;
18236
+ }
17887
18237
 
17888
18238
  var i;
17889
18239
  var sc = this._sizeClasses;
@@ -18529,10 +18879,10 @@ StretchedCells.prototype.getColumnIndex = function (cellRef) {
18529
18879
  if(cellRef["getElement"]) {
18530
18880
  var cellElement = cellRef["getElement"]();
18531
18881
  if(cellElement) {
18532
- return cellElement._colIndex || 0;
18882
+ return cellElement._colIndex != null ? cellElement._colIndex : -1;
18533
18883
  }
18534
18884
  } else {
18535
- return cellRef._colIndex || 0;
18885
+ return cellRef._colIndex != null ? cellRef._colIndex : -1;
18536
18886
  }
18537
18887
  }
18538
18888
  return -1;
@@ -21015,6 +21365,19 @@ Scrollbar.prototype.freezeScrolling = function (frozen) {
21015
21365
  this._isFrozen = frozen !== false;
21016
21366
  return prev;
21017
21367
  };
21368
+ /** @public
21369
+ */
21370
+ Scrollbar.prototype.restoreTrackPosition = function () {
21371
+ // Scroll event will be fired asynchronously, if there is any change
21372
+ var track = this._element;
21373
+ if(this._vertical) {
21374
+ track.scrollTop = this._tScrollVal;
21375
+ if(track.scrollTop){
21376
+ this._tScrollVal = track.scrollTop; //Check to ensure that cache equal to element's scroll
21377
+ }
21378
+ }
21379
+ //TODO: handle restore scrollLeft for hscroll
21380
+ };
21018
21381
 
21019
21382
  Scrollbar._proto = Scrollbar.prototype;
21020
21383
 
@@ -21792,6 +22155,22 @@ LayoutGrid.prototype._setColumnWidth = function (indexX, val) {
21792
22155
  LayoutGrid.prototype._updateColumnLayout = function () {
21793
22156
  this._syncLayoutToColumns(0);
21794
22157
  };
22158
+ /** @public
22159
+ * @ignore
22160
+ * @param {boolean} enabled
22161
+ * @param {number=} fromR
22162
+ * @param {number=} toR
22163
+ */
22164
+ LayoutGrid.prototype._startBindingSession = function (enabled, fromR, toR) {
22165
+ // Prevent error when calling _startBindingSession in LayoutGrid
22166
+ };
22167
+ /** @public
22168
+ * @ignore
22169
+ * @return {Array<boolean>}
22170
+ */
22171
+ LayoutGrid.prototype._getTempRowHeights = function () {
22172
+ return null;
22173
+ };
21795
22174
 
21796
22175
  /**
21797
22176
  * {@link ILayoutGrid#getRowHeight}
@@ -22633,6 +23012,11 @@ LayoutGrid.prototype.setRowHighlight = function (rowIndex) {
22633
23012
  this._highlightedCells[c] = cell;
22634
23013
  cell.addClass("highlighted-row");
22635
23014
  }
23015
+ var stretchEl = this.getStretchedCell(rowIndex); // check stretched cell
23016
+ if(stretchEl) {
23017
+ this._highlightedCells.push(stretchEl);
23018
+ stretchEl.addClass("highlighted-row");
23019
+ }
22636
23020
  } else {
22637
23021
  this._highlightedCells.length = 0;
22638
23022
  }
@@ -22918,6 +23302,7 @@ LayoutGrid.prototype.insertColumn = function (index, opt_json) {
22918
23302
  cell.addClass("selected-row");
22919
23303
  }
22920
23304
  }
23305
+ // TODO: Check if it can insert column with stretch cell
22921
23306
  }
22922
23307
 
22923
23308
  column.activate(atTheMiddle || !this._colVir);
@@ -23149,6 +23534,10 @@ LayoutGrid.prototype.stretchCell = function (cellRef, rowIndex, opt_stretching,
23149
23534
  } else {
23150
23535
  cell = this._stretchedCells.unstretchCell(rowIndex);
23151
23536
  }
23537
+ if(cell) {
23538
+ var selected = this._selectionList.getSelection(rowIndex);
23539
+ cell.enableClass("selected-row", selected); // It's can enable class without get stretch cell again.
23540
+ }
23152
23541
  return cell;
23153
23542
  };
23154
23543
 
@@ -23231,6 +23620,19 @@ LayoutGrid.prototype._calculateViewSize = function (forceRecal) {
23231
23620
  }
23232
23621
  return stretchSize;
23233
23622
  };
23623
+
23624
+ /**
23625
+ * @private
23626
+ * @param {number} rowIndex
23627
+ * @param {string} className
23628
+ * @param {boolean} enabled
23629
+ */
23630
+ LayoutGrid.prototype._enableStretchCellClass = function (rowIndex, className, enabled ) {
23631
+ var stretchEl = this.getStretchedCell(rowIndex); // check stretched cell
23632
+ if(stretchEl) {
23633
+ stretchEl.enableClass(className, enabled);
23634
+ }
23635
+ };
23234
23636
  /** View size is width of container (Grid's pane) or content (LayoutGrid's columns), whichever is smaller.
23235
23637
  * @public
23236
23638
  * @ignore
@@ -23914,11 +24316,16 @@ LayoutGrid.prototype._updateCellSpans = function (cellSpans, adding) {
23914
24316
  */
23915
24317
  LayoutGrid.prototype._onMouseMove = function (e) {
23916
24318
  var target = e["target"];
23917
- var colElement = util.closestElement(target, "column");
23918
- var colIndex = this.getColumnIndex(colElement);
23919
- var cellElement = (colIndex >= 0) ? util.closestElement(target, "cell") : null;
23920
24319
 
23921
- this.setRowHighlight(this.getCellIndex(colIndex, cellElement));
24320
+ var cellElement = util.closestElement(target, "cell");
24321
+ var colIndex = this._stretchedCells.getColumnIndex(cellElement);
24322
+ if(colIndex < 0) { // Not found colIndex in stretching cell, then get from normal row
24323
+ var colElement = util.closestElement(target, "column");
24324
+ colIndex = this.getColumnIndex(colElement);
24325
+ }
24326
+ var rowIndex = this.getCellIndex(colIndex, cellElement);
24327
+
24328
+ this.setRowHighlight(rowIndex);
23922
24329
  };
23923
24330
 
23924
24331
  /**
@@ -23949,27 +24356,16 @@ LayoutGrid.prototype._onMouseOut = function (e) {
23949
24356
  */
23950
24357
  LayoutGrid.prototype._updateSelectionUI = function (rowIndex) { // Update UI of the specified row index
23951
24358
  var selected = this._selectionList.getSelection(rowIndex);
23952
-
23953
- for (var c = 0; c < this._colCount; ++c) {
23954
- var cell = this._columns[c].getCell(rowIndex);
23955
-
23956
- if (cell) {
23957
- cell.enableClass("selected-row", selected);
23958
- }
23959
- }
24359
+ this._enableStretchCellClass(rowIndex, "selected-row", selected);
24360
+ this.enableRowClass(rowIndex, "selected-row", selected);
23960
24361
  };
23961
24362
 
23962
24363
  /** @private
23963
24364
  * @param {number} rowIndex
23964
24365
  */
23965
24366
  LayoutGrid.prototype._addSelectionUI = function (rowIndex) {
23966
- for (var c = 0; c < this._colCount; ++c) {
23967
- var cell = this._columns[c].getCell(rowIndex);
23968
-
23969
- if (cell) {
23970
- cell.addClass("selected-row");
23971
- }
23972
- }
24367
+ this._enableStretchCellClass(rowIndex, "selected-row", true);
24368
+ this.enableRowClass(rowIndex, "selected-row", true);
23973
24369
  };
23974
24370
 
23975
24371
  /**
@@ -23977,13 +24373,8 @@ LayoutGrid.prototype._addSelectionUI = function (rowIndex) {
23977
24373
  * @param {number} rowIndex
23978
24374
  */
23979
24375
  LayoutGrid.prototype._removeSelectionUI = function (rowIndex) {
23980
- for (var c = 0; c < this._colCount; ++c) {
23981
- var cell = this._columns[c].getCell(rowIndex);
23982
-
23983
- if (cell) {
23984
- cell.removeClass("selected-row");
23985
- }
23986
- }
24376
+ this._enableStretchCellClass(rowIndex, "selected-row", false);
24377
+ this.enableRowClass(rowIndex, "selected-row", false);
23987
24378
  };
23988
24379
 
23989
24380
  /**
@@ -25431,7 +25822,7 @@ WrappedView.prototype.addRowExpansion = function(rid, count) {
25431
25822
  * @param {string} rid Row Id
25432
25823
  */
25433
25824
  WrappedView.prototype.removeRowExpansion = function(rid) {
25434
- this._dv.removeRowExpansion(rid, count);
25825
+ this._dv.removeRowExpansion(rid);
25435
25826
  };
25436
25827
  /**
25437
25828
  * @public
@@ -25638,7 +26029,7 @@ WrappedView.prototype.setSegmentCollapsingLogic = function() {};
25638
26029
  */
25639
26030
  WrappedView.prototype.isSegmentCollapsed = function(rowRef) {
25640
26031
  var rid = this._toRowId(rowRef);
25641
- return this._dv.isSegmentCollapsed(rid, collapsed);
26032
+ return this._dv.isSegmentCollapsed(rid);
25642
26033
  };
25643
26034
  /** Remove existing segment children and fill the segments with all contnet rows before the next segment separator
25644
26035
  * @public
@@ -25671,8 +26062,8 @@ WrappedView.prototype.addSegmentChild = function(segmentRef, rowRef) {
25671
26062
  */
25672
26063
  WrappedView.prototype.addSegmentChildren = function(segmentRef, rowRefs) {
25673
26064
  var segmentId = this._toRowId(segmentRef);
25674
- var rowId = this._toRowId(rowRef);
25675
- return this._dv.addSegmentChildren(segmentId, rowId);
26065
+ var rowIds = this._toRowIds(rowRefs);
26066
+ return this._dv.addSegmentChildren(segmentId, rowIds);
25676
26067
  };
25677
26068
  /** @public
25678
26069
  * @param {string|number} segmentRef Row id or row index
@@ -25691,8 +26082,8 @@ WrappedView.prototype.removeSegmentChild = function(segmentRef, rowRef) {
25691
26082
  */
25692
26083
  WrappedView.prototype.removeSegmentChildren = function(segmentRef, rowRefs) {
25693
26084
  var segmentId = this._toRowId(segmentRef);
25694
- var rowId = this._toRowId(rowRef);
25695
- return this._dv.removeSegmentChildren(segmentId, rowId);
26085
+ var rowIds = this._toRowIds(rowRefs);
26086
+ return this._dv.removeSegmentChildren(segmentId, rowIds);
25696
26087
  };
25697
26088
  /** @public
25698
26089
  * @return {boolean} Return true if there is any change
@@ -25801,10 +26192,6 @@ WrappedView.prototype.isRowFiltered = function(rid, rowData) {
25801
26192
 
25802
26193
 
25803
26194
 
25804
- /** @typedef {DataTable|WrappedView|DataView} DataView~IDataView
25805
- * @description DataView like classes
25806
- */
25807
-
25808
26195
  /** @event DataView#dataChanged
25809
26196
  * @description Trigger when data within the data view has been changed. Not only actual change in data, but also position change will trigger this event.
25810
26197
  * @property {boolean} globalChange Indicates a big change. User should expect all data has been change. With active sorting or filtering, this flag will always be true due to multiple changes in row position.
@@ -30302,6 +30689,11 @@ SectionSettings.prototype._dispatchDataChanged = function (firstUpdate, lastUpda
30302
30689
  */
30303
30690
  SectionSettings.prototype.updateRowData = function (fromRowIndex, lastRowIndex, e) {
30304
30691
  if(this.isDataBindable()) { // Prevent dispatching dataChanged event without the data view
30692
+ if(this._grid._getTempRowHeights()){
30693
+ fromRowIndex = this._grid.getFirstIndexInView();
30694
+ lastRowIndex = this._grid.getLastIndexInView() + 1;
30695
+ }
30696
+
30305
30697
  e = this.extendDataEventArg(e, fromRowIndex, lastRowIndex);
30306
30698
  if(e["fromRowIndex"] < e["toRowIndex"]) {
30307
30699
  this._dispatch("dataChanged", e);
@@ -30996,6 +31388,11 @@ Ext["b" /* default */].inherits(VirtualizedLayoutGrid, components_ElementWrapper
30996
31388
  */
30997
31389
  VirtualizedLayoutGrid.prototype._index = -1;
30998
31390
 
31391
+ /** Number of rows offsetting from the first section
31392
+ * @private
31393
+ * @type {number}
31394
+ */
31395
+ VirtualizedLayoutGrid.prototype._rowOffset = 0;
30999
31396
  /** For virtualization in Y-Axis
31000
31397
  * @private
31001
31398
  * @type {number}
@@ -31057,6 +31454,14 @@ VirtualizedLayoutGrid.prototype._boundLayer = null;
31057
31454
  * @private
31058
31455
  */
31059
31456
  VirtualizedLayoutGrid.prototype._hscrollbar = null;
31457
+ /** @type {string}
31458
+ * @private
31459
+ */
31460
+ VirtualizedLayoutGrid.prototype._session = "A";
31461
+ /** @type {Array<boolean>}
31462
+ * @private
31463
+ */
31464
+ VirtualizedLayoutGrid.prototype._tempRowHeights = null;
31060
31465
 
31061
31466
  //#region ====== Override ElementWrapper ======//
31062
31467
  /** @override */
@@ -31168,13 +31573,68 @@ VirtualizedLayoutGrid.prototype._setColumnWidth = function (indexX, val) {
31168
31573
  VirtualizedLayoutGrid.prototype._updateColumnLayout = function () {
31169
31574
  this._grid._updateColumnLayout();
31170
31575
  };
31576
+ /** @public
31577
+ * @ignore
31578
+ * @param {boolean} enabled
31579
+ */
31580
+ VirtualizedLayoutGrid.prototype._startBindingSession = function (enabled) {
31581
+ this._isBinding = enabled;
31582
+ if(!enabled){
31583
+ // Clear old session
31584
+ if(this._tempRowHeights){
31585
+ var defaultRowHeight = this.getDefaultRowHeight();
31586
+ var hasSession = true;
31587
+ var removedIndices = [];
31588
+
31589
+ for(var key in this._tempRowHeights){
31590
+ var index = +key;
31591
+ var rowSession = this._layoutY.getLaneProperty(index, "sizeSession");
31592
+ if(rowSession) {
31593
+ if(rowSession != this._session){
31594
+ this.setRowHeight(index, defaultRowHeight);
31595
+ this._layoutY.setLaneProperty(index, "sizeSession", null);
31596
+ removedIndices.push(index);
31597
+ }
31598
+ }
31599
+ }
31600
+ var removedCount = removedIndices.length;
31601
+ for(var i = 0; i < removedCount; i++){
31602
+ delete this._tempRowHeights[removedIndices[i]];
31603
+ }
31604
+ if(removedCount){
31605
+ for(var remainingKey in this._tempRowHeights){
31606
+ hasSession = remainingKey != null;
31607
+ break;
31608
+ }
31609
+ }
31610
+ if(!hasSession){
31611
+ this._tempRowHeights = null;
31612
+ }
31171
31613
 
31614
+ }
31615
+ this._session = this._session === "A" ? "B" : "A";
31616
+ }
31617
+ };
31618
+ /** @public
31619
+ * @ignore
31620
+ * @return {Array<boolean>}
31621
+ */
31622
+ VirtualizedLayoutGrid.prototype._getTempRowHeights = function () {
31623
+ return this._tempRowHeights;
31624
+ };
31172
31625
  /** @inheritDoc */
31173
31626
  VirtualizedLayoutGrid.prototype.getRowHeight = function (index) {
31174
31627
  return this._layoutY.getLaneSize(index);
31175
31628
  };
31176
31629
  /** @inheritDoc */
31177
31630
  VirtualizedLayoutGrid.prototype.setRowHeight = function (index, val) {
31631
+ if(this._isBinding && val != this.getDefaultRowHeight()){
31632
+ this._layoutY.setLaneProperty(index, "sizeSession", this._session);
31633
+ if(!this._tempRowHeights){
31634
+ this._tempRowHeights = [];
31635
+ }
31636
+ this._tempRowHeights[index] = true; // Store row index that set temporary row height
31637
+ }
31178
31638
  if(this._layoutY.setLaneSize(index, val)) {
31179
31639
  this._grid.setRowHeight(index - this._firstIndex, val);
31180
31640
  this._element.style.height = this._layoutY.getTrackSize() + "px";
@@ -31328,6 +31788,9 @@ VirtualizedLayoutGrid.prototype.setRowCount = function (val, noBinding) {
31328
31788
  var prevCount = this._layoutY.getLaneCount();
31329
31789
  if(prevCount !== val){
31330
31790
  this._layoutY.setLaneCount(val);
31791
+ if(this._tempRowHeights){
31792
+ this._tempRowHeights.length = val;
31793
+ }
31331
31794
  this._element.style.height = this._layoutY.getTrackSize() + "px";
31332
31795
  this._requestUpdatingRowBounds();
31333
31796
  //After rowCountChanged fires, virtualizer will update virtual row count if
@@ -32216,6 +32679,7 @@ var Core = function (opt_initializer) {
32216
32679
  _t._updateColumnBounds = _t._updateColumnBounds.bind(_t);
32217
32680
  _t._dispatchColumnPositionChanged = _t._dispatchColumnPositionChanged.bind(_t);
32218
32681
  _t._dispatchRowPositionChanged = _t._dispatchRowPositionChanged.bind(_t);
32682
+ _t._requestScrollbarUpdate = _t._requestScrollbarUpdate.bind(_t);
32219
32683
 
32220
32684
  // Text nodes are unintentionally getting in the tag.
32221
32685
  if(opt_initializer) { // Any node other than element node is not allowed within the tag.
@@ -32633,6 +33097,10 @@ Core.prototype._preserveProportion = false;
32633
33097
  * @private
32634
33098
  */
32635
33099
  Core.prototype._preserveGridSize = false;
33100
+ /** @type {number}
33101
+ * @private
33102
+ */
33103
+ Core.prototype._rowHeightTimerId = 0;
32636
33104
  //#region Public Methods
32637
33105
 
32638
33106
  /**
@@ -32640,7 +33108,7 @@ Core.prototype._preserveGridSize = false;
32640
33108
  * @return {string}
32641
33109
  */
32642
33110
  Core.getVersion = function () {
32643
- return "5.0.49";
33111
+ return "5.0.59";
32644
33112
  };
32645
33113
  /** {@link ElementWrapper#dispose}
32646
33114
  * @override
@@ -32959,6 +33427,10 @@ Core.prototype.addSectionAt = function (at, opt_type, opt_sectionName) {
32959
33427
  }
32960
33428
 
32961
33429
  this._updateSectionIndices(at);
33430
+ if (this._autoSetDataSource) {
33431
+ // This could trigger data binding and column virtualization
33432
+ sectionSettings.setDataSource(this._dataSource);
33433
+ }
32962
33434
 
32963
33435
  sectType = sectionSettings.getType();
32964
33436
  if (sectType === "footer") {
@@ -35464,6 +35936,11 @@ Core.prototype.getScrollHeight = function () {
35464
35936
  }
35465
35937
  return this._vscrollbar.getContentHeight();
35466
35938
  };
35939
+ /** @public
35940
+ */
35941
+ Core.prototype.restoreScrollbars = function () {
35942
+ this._vscrollbar.restoreTrackPosition();
35943
+ };
35467
35944
 
35468
35945
  /** @public
35469
35946
  * @ignore
@@ -35589,6 +36066,13 @@ Core.prototype.requestRowRefresh = function() {
35589
36066
  this._rowRefreshTimer = setTimeout(this._onRowRefresh, 100);
35590
36067
  }
35591
36068
  };
36069
+ /** Set a timer to call updateScrollbarHeight only once to avoid performance issue due to multiple call of _updateScrollbarHeight()
36070
+ * @public
36071
+ */
36072
+ Core.prototype._requestScrollbarUpdate = function() {
36073
+ this._updateScrollbarHeight(true, true);
36074
+ this._rowHeightTimerId = 0;
36075
+ };
35592
36076
 
35593
36077
  /** prevent bind data process
35594
36078
  * @public
@@ -36181,9 +36665,6 @@ Core.prototype._newSection = function (opt_type, sectionName) {
36181
36665
  section.listen("rowCountChanged", this._onRowCountChanged);
36182
36666
  section.listen("rowHeightChanged", this._onRowHeightChanged);
36183
36667
 
36184
- if (this._autoSetDataSource) {
36185
- sectionSettings.setDataSource(this._dataSource);
36186
- }
36187
36668
  return sectionSettings;
36188
36669
  };
36189
36670
 
@@ -36474,7 +36955,12 @@ Core.prototype._removeColumn = function (num) { // TODO: change the logic to us
36474
36955
  */
36475
36956
  Core.prototype._onSectionDataChanged = function (e) {
36476
36957
  if(this._dispatchingDataChanged) { return; } // Prevent infinite loop
36477
- this._dispatchingDataChanged = true;
36958
+
36959
+ var colCount = this._layoutX.getLaneCount();
36960
+ this._dispatchingDataChanged = colCount ? true : false;
36961
+ if(!colCount) {
36962
+ return;
36963
+ }
36478
36964
 
36479
36965
  var fromR = /** @type{number} */(e["fromRowIndex"]);
36480
36966
  var toR = /** @type{number} */(e["toRowIndex"]);
@@ -36482,6 +36968,9 @@ Core.prototype._onSectionDataChanged = function (e) {
36482
36968
  var dataView = /** @type{DataView} */(e["dataSource"]);
36483
36969
  var hasDataView = (dataView && dataView.getDataSource()) ? 1 : 0;
36484
36970
  var rids, rowDataCollection;
36971
+
36972
+ section._startBindingSession(true);
36973
+
36485
36974
  if(hasDataView) {
36486
36975
  rids = dataView.getVisibleRowIds(true);
36487
36976
  rowDataCollection = dataView.getMultipleRowData(rids, fromR, toR);
@@ -36489,7 +36978,6 @@ Core.prototype._onSectionDataChanged = function (e) {
36489
36978
  }
36490
36979
  this._dispatch("preSectionDataBinding", e);
36491
36980
 
36492
- var colCount = this._layoutX.getLaneCount();
36493
36981
  var dataMap = this.getDataColumnMap();
36494
36982
  for (var c = 0; c < colCount; ++c) {
36495
36983
  if(section["isColumnActive"](c) && (this.isColumnVisible(c) || this._isAlwaysRenderColumn(c))) {
@@ -36520,8 +37008,9 @@ Core.prototype._onSectionDataChanged = function (e) {
36520
37008
  }
36521
37009
 
36522
37010
  this._dispatch("postSectionDataBinding", e);
36523
-
36524
37011
  this._dispatchRowExpansionBinding(e);
37012
+
37013
+ section._startBindingSession(false);
36525
37014
  this._dispatchingDataChanged = false;
36526
37015
  };
36527
37016
 
@@ -36595,6 +37084,9 @@ Core.prototype._onRowInViewChanged = function (e) { // Triggered from virtualize
36595
37084
  * @param {Object} e
36596
37085
  */
36597
37086
  Core.prototype._onColInViewChanged = function (e) {
37087
+ if(!this.getColumnCount()) {
37088
+ return; // No column for activation and no cell to be rendered
37089
+ }
36598
37090
  var pfi = e["prevFirstIndex"];
36599
37091
  var pli = e["prevLastIndex"]; // INCLUSIVE
36600
37092
  var fi = e["firstIndex"];
@@ -36844,8 +37336,14 @@ Core.prototype._onRowHeightChanged = function (e) {
36844
37336
  this._rowHeightConflator._needScrollbarUpdate = false;
36845
37337
  this._updateScrollbarHeight(true, true);
36846
37338
  } else if(minSectionIndex >= 0) {
36847
- this._updateScrollbarHeight(minSectionIndex < this._startVScrollbarIndex,
36848
- minSectionIndex >= this._startVScrollbarIndex);
37339
+ if(this._dispatchingDataChanged){
37340
+ if(!this._rowHeightTimerId){
37341
+ this._rowHeightTimerId = setTimeout(this._requestScrollbarUpdate, 0);
37342
+ }
37343
+ } else {
37344
+ this._updateScrollbarHeight(minSectionIndex < this._startVScrollbarIndex,
37345
+ minSectionIndex >= this._startVScrollbarIndex);
37346
+ }
36849
37347
  }
36850
37348
 
36851
37349
  this._dispatchRowPositionChanged();
@@ -36910,7 +37408,7 @@ Core.prototype._onColumnCountChanged = function () {
36910
37408
  // TODO: Optimize these methods during initialization
36911
37409
  var pinnedLeft = this._countPinnedLeftColumns();
36912
37410
  var pinnedRight = this._countPinnedRightColumns();
36913
- ///
37411
+
36914
37412
  this._updateColumnBounds();
36915
37413
 
36916
37414
  if (this._hScrollbarEnabled && pinnedLeft + pinnedRight < this.getColumnCount()) {
@@ -37271,7 +37769,8 @@ Core.prototype._updateSectionIndices = function (from) {
37271
37769
 
37272
37770
  /** @private */
37273
37771
  Core.prototype._updateLayout = function () {
37274
- if(this._disposed) { return; }
37772
+ var element = this.getElement();
37773
+ if(this._disposed || !element.offsetParent) { return; }
37275
37774
 
37276
37775
  this._syncLayoutToColumns(); // Update only if need
37277
37776
 
@@ -37850,279 +38349,144 @@ DataConnector.prototype.reset = function () {
37850
38349
 
37851
38350
  /* harmony default export */ var js_DataConnector = (DataConnector);
37852
38351
 
37853
- // CONCATENATED MODULE: ./node_modules/@grid/core/es6/grid/plugins/Plugin.js
37854
-
37855
-
37856
- // eslint-disable-line
38352
+ // CONCATENATED MODULE: ./src/js/RowDefSorter.js
38353
+ /** @constructor
38354
+ */
38355
+ var RowDefSorter = function() {
38356
+ this._defaultSorter = this._defaultSorter.bind(this);
38357
+ this._dataSorter = this._dataSorter.bind(this);
38358
+ this._rowDefSorter = this._rowDefSorter.bind(this);
37857
38359
 
37858
- // eslint-disable-line
38360
+ this._sortContext = {};
38361
+ };
37859
38362
 
37860
38363
 
37861
- /** Base class for all built-in plugins
37862
- * @constructor
37863
- * @extends {EventDispatcher}
38364
+ /** @type {string}
38365
+ * @private
37864
38366
  */
37865
- var Plugin = function () {
37866
- /* throw("Plugin is an abstract Class"); */
37867
- };
37868
- Ext["b" /* default */].inherits(Plugin, event_EventDispatcher); // Inherits() will replace prototype of the derived object
37869
-
37870
- //#region Public Methods
37871
- /**The name must be readonly and unique among all other plugins
37872
- * @public
37873
- * @return {string}
38367
+ RowDefSorter.prototype._field = "";
38368
+ /** @type {!Object}
38369
+ * @private
37874
38370
  */
37875
- Plugin.prototype.getName = function () {
37876
- return "Plugin";
37877
- };
38371
+ RowDefSorter.prototype._sortContext;
38372
+ /** @type {Function}
38373
+ * @private
38374
+ */
38375
+ RowDefSorter.prototype._sortLogic = null;
38376
+
37878
38377
 
37879
38378
  /** @public
37880
- * @param {!Core} owner
37881
38379
  */
37882
- Plugin.prototype.initialize = function (owner) {
37883
- this._host = owner;
37884
- };
37885
- /**For disposing any resource
37886
- * @public
37887
- * @param {!Core} owner
37888
- */
37889
- Plugin.prototype.unload = function (owner) {
37890
- this._host = null;
37891
- this.unlistenAll();
38380
+ RowDefSorter.prototype.dispose = function() {
38381
+ this._sortLogic = null;
38382
+ this._sortContext = {}; // Clear any existing reference
37892
38383
  };
37893
38384
 
37894
38385
  /** @public
37895
- * @param {Event|Element|ElementWrapper} e
37896
- * @return {Core}
38386
+ * @param {boolean=} rowSorting=false
38387
+ * @return {Function}
37897
38388
  */
37898
- Plugin.prototype.getRelativeGrid = function (e) {
37899
- var targetEl;
37900
- if(e.target) { // The Given object is an Event
37901
- targetEl = /** @type{Element} */(e.target);
37902
- var gridAPI = targetEl["api"];
37903
- if(gridAPI && gridAPI["getCoreGrid"]) {
37904
- return /** @type{Core} */(gridAPI["getCoreGrid"]());
37905
- }
37906
- } else if(e["getElement"]) { // The Given object is implementing ElementWrapper
37907
- targetEl = e["getElement"]();
37908
- } else if(util.isElement(e)){ // The Given object is just an element
37909
- targetEl = /** @type{Element} */(e);
37910
- }
37911
-
37912
- var gridEl = (targetEl) ? util.closestElement(targetEl, "tr-grid") : null;
37913
- if(gridEl) {
37914
- if(this._host) {
37915
- if(this._host.getElement() === gridEl) {
37916
- return this._host;
37917
- }
37918
- } else {
37919
- var hostLength = this._hosts ? this._hosts.length : 0;
37920
- for (var i = 0; i < hostLength; i++) {
37921
- var host = this._hosts[i];
37922
- if (host.getElement() === gridEl) {
37923
- return host;
37924
- }
37925
- }
37926
- }
38389
+ RowDefSorter.prototype.getSorter = function(rowSorting) {
38390
+ if(this._sortLogic) {
38391
+ return rowSorting ? this._rowDefSorter : this._dataSorter;
38392
+ } else {
38393
+ return this._defaultSorter;
37927
38394
  }
37928
-
37929
- return null;
37930
38395
  };
37931
- /** Use in case of there is an overlay over the top of the grid (target element cannot be used).
37932
- * @public
37933
- * @param {number} x
37934
- * @param {number} y
37935
- * @return {Element}
38396
+ /** @public
38397
+ * @param {Function=} func
37936
38398
  */
37937
- Plugin.prototype.getGridElementFromPoint = function (x, y) {
37938
- var elem = document.elementFromPoint(x, y);
37939
- var grid = util.closestElement(elem, "tr-grid");
37940
-
37941
- // Some elements are over grid element, hide them all by setting the visibility to hidden
37942
- var skipElem = [];
37943
- var skipVisibility = [];
37944
- while (!grid && elem && elem.tagName != "HTML") {
37945
- skipElem.push(elem);
37946
- skipVisibility.push(elem.style.visibility);
37947
- elem.style.visibility = "hidden";
37948
- elem = document.elementFromPoint(x, y);
37949
-
37950
- grid = util.closestElement(elem, "tr-grid");
37951
- }
37952
- for (var i = 0; i < skipElem.length; i++) {
37953
- skipElem[i].style.visibility = skipVisibility[i];
37954
- }
37955
- return grid;
38399
+ RowDefSorter.prototype.setSortLogic = function(func) {
38400
+ this._sortLogic = (typeof func === "function") ? func : null;
37956
38401
  };
37957
38402
 
37958
- //#endregion Public Methods
37959
38403
 
37960
- //#region Protected Methods
37961
- /** @protected
37962
- * @ignore
37963
- * @return {Array.<string>}
38404
+ /** @public
38405
+ * @param {string} field
37964
38406
  */
37965
- Plugin.prototype._getDataColumnMap = function () {
37966
- if (this._dataMap) { return this._dataMap; }
37967
-
37968
- if (this._host) {
37969
- return this._host.getDataColumnMap();
37970
- }
37971
- if (this._hosts && this._hosts[0]) {
37972
- return this._hosts[0].getDataColumnMap();
38407
+ RowDefSorter.prototype.setField = function(field) {
38408
+ if(!field) {
38409
+ field = "";
37973
38410
  }
37974
- return null;
38411
+ this._sortContext["field"] = this._field = field;
38412
+ this._sortContext["formattedField"] = field + "_FORMATTED";
37975
38413
  };
37976
- /** @protected
37977
- * @ignore
37978
- * @param {number} colIndex
37979
- * @return {string}
37980
- */
37981
- Plugin.prototype._getDataColumnName = function (colIndex) {
37982
- var dataMap = this._getDataColumnMap();
37983
- if(dataMap){
37984
- return dataMap[colIndex] || "";
37985
- }
37986
- return "";
38414
+ /** @public
38415
+ * @param {string} key
38416
+ * @param {*} value
38417
+ */
38418
+ RowDefSorter.prototype.setContext = function(key, value) {
38419
+ this._sortContext[key] = value;
37987
38420
  };
37988
38421
 
37989
- /** @protected
37990
- * @ignore
37991
- * @param {Object} e
37992
- * @return {boolean}
38422
+ /** @private
38423
+ * @param {RowDefinition} rowDefA
38424
+ * @param {RowDefinition} rowDefB
38425
+ * @param {number} order
38426
+ * @return {number}
37993
38427
  */
37994
- Plugin.prototype._isNotFirstHost = function(e) {
37995
- if (this._hosts) {
37996
- return e["sender"] !== this._hosts[0];
38428
+ RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
38429
+ var orderA = rowDefA.getGroupOrder();
38430
+ var orderB = rowDefB.getGroupOrder();
38431
+ if(orderA !== orderB) {
38432
+ return orderA - orderB; // Regardless of sort order
37997
38433
  }
37998
- return false;
37999
- };
38000
- /** @protected
38001
- * @ignore
38002
- * @param {Object} e
38003
- */
38004
- Plugin.prototype._onColumnAdded = function (e) {
38005
- if (this._isNotFirstHost(e)) {
38006
- return;
38434
+
38435
+ var a = rowDefA.getData(this._field);
38436
+ var b = rowDefB.getData(this._field);
38437
+
38438
+ if(a == null || a !== a) {
38439
+ if(b == null || b !== b) {
38440
+ return 0;
38441
+ }
38442
+ return 1;
38007
38443
  }
38008
- if (!e["atTheMiddle"]) { return; }
38009
- var colIndex = /** @type{number} */(e["colIndex"]);
38010
- util.insertArrayItem(this._colData, colIndex, null);
38011
- util.insertArrayItem(this._dataMap, colIndex, null);
38012
- };
38013
- /** @protected
38014
- * @ignore
38015
- * @param {Object} e
38016
- */
38017
- Plugin.prototype._onColumnMoved = function (e) {
38018
- if (this._isNotFirstHost(e)) {
38019
- return;
38444
+ if(b == null || b !== b) {
38445
+ return -1;
38020
38446
  }
38021
- var from = /** @type{number} */(e["fromColIndex"]);
38022
- var to = /** @type{number} */(e["toColIndex"]);
38023
38447
 
38024
- util.moveArrayItem(this._colData, from, to);
38025
- util.moveArrayItem(this._dataMap, from, to);
38026
- };
38027
- /** @protected
38028
- * @ignore
38029
- * @param {Object} e
38030
- */
38031
- Plugin.prototype._onColumnRemoved = function (e) {
38032
- if (this._isNotFirstHost(e)) {
38033
- return;
38034
- }
38035
- if (!e["atTheMiddle"]) { return; }
38036
- var colIndex = /** @type{number} */(e["colIndex"]);
38037
- if(this._colData) {
38038
- this._colData.splice(colIndex, 1);
38448
+ if(a < b) {
38449
+ return -order;
38039
38450
  }
38040
- if(this._dataMap) {
38041
- this._dataMap.splice(colIndex, 1);
38451
+ if(b < a) {
38452
+ return order;
38042
38453
  }
38454
+ return 0;
38043
38455
  };
38044
-
38045
-
38046
- /** @protected
38047
- * @ignore
38456
+ /** @private
38457
+ * @param {RowDefinition} rowDefA
38458
+ * @param {RowDefinition} rowDefB
38459
+ * @param {number} order
38048
38460
  * @return {number}
38049
- */
38050
- Plugin.prototype._getColumnCount = function() {
38051
- var host = this._host || this._hosts[0];
38052
- return (host) ? host.getColumnCount() : 0;
38053
- };
38054
- /** @protected
38055
- * @ignore
38056
- * @param {string} pluginName
38057
- * @return {*|null}
38058
- */
38059
- Plugin.prototype._getPlugin = function(pluginName) {
38060
- var host = this._host || this._hosts[0];
38061
- return (host) ? host.getPlugin(pluginName) : null;
38062
- };
38063
-
38064
- /** @protected
38065
- * @ignore
38066
- * @param {number} scrollVal
38067
- */
38068
- Plugin.prototype._scrollDown = function (scrollVal) {
38069
- var host = this._host || this._hosts[0];
38070
- host.scrollDown(scrollVal);
38071
- };
38072
- /** @protected
38073
- * @ignore
38074
- * @param {number} rowIndex
38075
- */
38076
- Plugin.prototype._scrollToRow = function (rowIndex) {
38077
- var host = this._host || this._hosts[0];
38078
- host.scrollToRow(null, rowIndex);
38079
- };
38080
- /** @protected
38081
- * @ignore
38082
- * @param {number} scrollVal
38083
38461
  */
38084
- Plugin.prototype._scrollRight = function (scrollVal) {
38085
- if(this._host) {
38086
- this._host.scrollRight(scrollVal);
38087
- } else if(this._hosts) {
38088
- var len = this._hosts.length;
38089
- for(var i = 0; i < len; ++i) {
38090
- var host = this._hosts[i];
38091
- host.scrollRight(scrollVal);
38092
- }
38462
+ RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
38463
+ var orderA = rowDefA.getGroupOrder();
38464
+ var orderB = rowDefB.getGroupOrder();
38465
+ if(orderA !== orderB) {
38466
+ return orderA - orderB; // Regardless of sort order
38093
38467
  }
38094
- };
38095
-
38096
- //#endregion Protected Methods
38097
-
38098
- //#region Protected Fields
38099
- /** @protected
38100
- * @ignore
38101
- * @type {Core}
38102
- */
38103
- Plugin.prototype._host = null;
38104
- /** @protected
38105
- * @ignore
38106
- * @type {Array.<Core>}
38107
- */
38108
- Plugin.prototype._hosts = null; // For a plug-in that support multi-table
38109
38468
 
38110
- /** @protected
38111
- * @ignore
38112
- * @type {Array.<string|null>}
38113
- */
38114
- Plugin.prototype._dataMap = null;
38115
- /** @protected
38116
- * @ignore
38117
- * @type {Array.<Object>}
38469
+ var a = rowDefA.getData(this._field);
38470
+ var b = rowDefB.getData(this._field);
38471
+ return this._sortLogic(a, b, order, this._sortContext);
38472
+ };
38473
+ /** @private
38474
+ * @param {RowDefinition} rowDefA
38475
+ * @param {RowDefinition} rowDefB
38476
+ * @param {number} order
38477
+ * @return {number}
38118
38478
  */
38119
- Plugin.prototype._colData = null;
38120
- //#endregion Protected Fields
38121
-
38122
- Plugin._proto = Plugin.prototype;
38479
+ RowDefSorter.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
38480
+ var orderA = rowDefA.getGroupOrder();
38481
+ var orderB = rowDefB.getGroupOrder();
38482
+ if(orderA !== orderB) {
38483
+ return orderA - orderB; // Regardless of sort order
38484
+ }
38123
38485
 
38124
- /* harmony default export */ var plugins_Plugin = (Plugin);
38486
+ return this._sortLogic(rowDefA, rowDefB, order, this._sortContext);
38487
+ };
38125
38488
 
38489
+ /* harmony default export */ var js_RowDefSorter = (RowDefSorter);
38126
38490
 
38127
38491
  // CONCATENATED MODULE: ./node_modules/@grid/core/es6/grid/plugins/SortableTitlePlugin.js
38128
38492
  /* eslint-disable */
@@ -38167,7 +38531,7 @@ Plugin._proto = Plugin.prototype;
38167
38531
  */
38168
38532
 
38169
38533
  /** @constructor
38170
- * @extends {Plugin}
38534
+ * @extends {EventDispatcher}
38171
38535
  * @param {SortableTitlePlugin.Options=} options
38172
38536
  */
38173
38537
  var SortableTitlePlugin = function (options) { // TODO: Extract SortableTitlePlugin to grid extension.
@@ -38199,7 +38563,7 @@ var SortableTitlePlugin = function (options) { // TODO: Extract SortableTitlePlu
38199
38563
  _t.config({ "sorting": options });
38200
38564
  }
38201
38565
  };
38202
- Ext["b" /* default */].inherits(SortableTitlePlugin, plugins_Plugin);
38566
+ Ext["b" /* default */].inherits(SortableTitlePlugin, event_EventDispatcher);
38203
38567
 
38204
38568
  /**
38205
38569
  * @typedef {"a" | "ascending" | "d" | "descending" | "n" | null} SortableTitlePlugin~SortOrder
@@ -38245,6 +38609,12 @@ SortableTitlePlugin.ColumnOptions;
38245
38609
  */
38246
38610
  SortableTitlePlugin.Options;
38247
38611
 
38612
+
38613
+ /** @type {Array.<Core>}
38614
+ * @private
38615
+ */
38616
+ SortableTitlePlugin.prototype._hosts = null; // For a plug-in that support multi-table
38617
+
38248
38618
  /** Order of item indicates sort priorities used in DataView. <br>
38249
38619
  * Each state contains column name{string}, sort order {string}, and rendering cell {ElementWrapper}
38250
38620
  * @private
@@ -38349,13 +38719,17 @@ var CODE_DOWN = "\u25BC";
38349
38719
  */
38350
38720
  var CODE_DIAMOND = "\u25CA";
38351
38721
 
38352
- /** @override */
38722
+ /** The name must be readonly and unique among all other plugins
38723
+ * @public
38724
+ * @return {string}
38725
+ */
38353
38726
  SortableTitlePlugin.prototype.getName = function () {
38354
38727
  return "SortableTitlePlugin"; // Read Only
38355
38728
  };
38356
38729
 
38357
- /**
38358
- * @override
38730
+ /** @public
38731
+ * @param {!Core} host
38732
+ * @param {Object=} options
38359
38733
  * @description Suppress google compiler for argument options because Internal Plugin doesn't support.
38360
38734
  * @suppress {checkTypes}
38361
38735
  */
@@ -38374,7 +38748,10 @@ SortableTitlePlugin.prototype.initialize = function (host, options) {
38374
38748
  this.config(options);
38375
38749
  };
38376
38750
 
38377
- /** @override */
38751
+ /**For disposing any resource
38752
+ * @public
38753
+ * @param {!Core} host
38754
+ */
38378
38755
  SortableTitlePlugin.prototype.unload = function (host) {
38379
38756
  var at = this._hosts.indexOf(host);
38380
38757
  if (at < 0) { return; }
@@ -38765,31 +39142,18 @@ SortableTitlePlugin.prototype.getSortOrder = function (colIndex) {
38765
39142
  * @return {number} Return negative value if there is no sorted column
38766
39143
  */
38767
39144
  SortableTitlePlugin.prototype.getSortedColumnIndex = function (priority) {
38768
- var state = this._sortStates[priority || 0];
38769
- if (state) {
38770
- var host = this._hosts[0];
38771
- var colCount = host ? host.getColumnCount() : 0;
38772
- for (var c = 0; c < colCount; ++c) {
38773
- var sortOptions = this._getSortOptions(c);
38774
- if (sortOptions === state) {
38775
- return c;
38776
- }
38777
- }
38778
- }
38779
- return -1;
39145
+ return this._getColumnIndexByOptions(this._sortStates[priority || 0]);
38780
39146
  };
38781
- /** @public
39147
+ /** Start with 0 (the first column that is being sorted). The highest number will be sorted last. Negative value means the specified column is not sorted
39148
+ * @public
38782
39149
  * @param {number} colIndex
38783
- * @return {number} Start with 0 (first column to be sorted) and end in the highest number. Negative means the specified column is not sorted
39150
+ * @return {number}
38784
39151
  */
38785
39152
  SortableTitlePlugin.prototype.getSortPriority = function (colIndex) {
38786
- var sortOptions = this._getSortOptions(colIndex);
38787
- if (sortOptions && sortOptions["sortOrder"]) {
38788
- var len = this._sortStates.length;
38789
- for (var i = 0; i < len; ++i) {
38790
- if (this._sortStates[i] === sortOptions) {
38791
- return i;
38792
- }
39153
+ var len = this._sortStates.length;
39154
+ for (var i = 0; i < len; ++i) {
39155
+ if (this._sortStates[i] === this._getSortOptions(colIndex)) {
39156
+ return i;
38793
39157
  }
38794
39158
  }
38795
39159
  return -1;
@@ -38802,7 +39166,7 @@ SortableTitlePlugin.prototype.isColumnSorted = function (colIndex) {
38802
39166
  return this.getSortPriority(colIndex) >= 0;
38803
39167
  };
38804
39168
  /** @public
38805
- * @return {Array.<Object> | null} Array of object with "colIndex" and "sortOrder"
39169
+ * @return {Array.<Object>} Array of object with "colIndex" and "sortOrder"
38806
39170
  */
38807
39171
  SortableTitlePlugin.prototype.getSortedColumns = function () {
38808
39172
  var len = this._sortStates.length;
@@ -38811,28 +39175,33 @@ SortableTitlePlugin.prototype.getSortedColumns = function () {
38811
39175
  var arr = new Array(len);
38812
39176
  for (var i = 0; i < len; ++i) {
38813
39177
  var colIndex = this.getSortedColumnIndex(i);
39178
+ var state = this._sortStates[i];
38814
39179
  arr[i] = {
38815
39180
  "colIndex": colIndex,
38816
- "sortOrder": this._sortStates[i]["sortOrder"] || "n"
39181
+ "field": state["field"] || "",
39182
+ "sortOrder": state["sortOrder"] || "n"
38817
39183
  };
38818
39184
  }
38819
39185
  return arr;
38820
39186
  };
39187
+ /** @public
39188
+ * @return {boolean}
39189
+ */
39190
+ SortableTitlePlugin.prototype.isSorting = function () {
39191
+ return this._sortStates.length ? true : false;
39192
+ };
38821
39193
 
38822
39194
  /** @public
38823
- * @param {number} colIndex
39195
+ * @param {number|string} colRef Column index or field
38824
39196
  * @param {string=} sortOrder "a" for ascending, "d" for descending, and "n" for no sorting
38825
39197
  * @param {Object=} opt_arg Event argument to be sent with preDataSorting event
38826
39198
  * @fires SortableTitlePlugin#preDataSorting
38827
39199
  * @fires SortableTitlePlugin#columnSorted
38828
39200
  */
38829
- SortableTitlePlugin.prototype.sortColumn = function (colIndex, sortOrder, opt_arg) {
38830
- if (colIndex >= 0) { // ColIndex can be greater than the host column count, to allow default sorting
38831
-
38832
- var state = this._preSortColumn(colIndex, sortOrder);
38833
- if (state) {
38834
- this._sortColumn([state], opt_arg);
38835
- }
39201
+ SortableTitlePlugin.prototype.sortColumn = function (colRef, sortOrder, opt_arg) {
39202
+ var state = this._prepareSorting(colRef, sortOrder);
39203
+ if (state) {
39204
+ this._sortColumn([state], opt_arg);
38836
39205
  }
38837
39206
  };
38838
39207
 
@@ -38848,7 +39217,14 @@ SortableTitlePlugin.prototype.sortColumns = function (sortOptions, opt_arg) {
38848
39217
  var states = [];
38849
39218
  for (var i = 0; i < sortOptions.length; i++) {
38850
39219
  var opt = sortOptions[i];
38851
- var state = this._preSortColumn(opt["colIndex"], opt["sortOrder"] || opt["order"]);
39220
+ var colRef = opt["colIndex"];
39221
+ if(colRef < 0 || colRef == null) {
39222
+ colRef = opt["field"];
39223
+ }
39224
+ var state = this._prepareSorting(
39225
+ colRef,
39226
+ opt["sortOrder"] || opt["order"]
39227
+ );
38852
39228
  if (state) {
38853
39229
  states[i] = state;
38854
39230
  }
@@ -38877,7 +39253,6 @@ SortableTitlePlugin.prototype.refresh = function () {
38877
39253
 
38878
39254
  /** @description Perform sorting with the same parameter. Alias to {@link SortableTitlePlugin#refresh}
38879
39255
  * @public
38880
- * @override
38881
39256
  * @function
38882
39257
  */
38883
39258
  SortableTitlePlugin.prototype.restoreUserActions = SortableTitlePlugin.prototype.refresh;
@@ -38945,20 +39320,24 @@ SortableTitlePlugin.prototype.setDataColumnNames = SortableTitlePlugin.prototype
38945
39320
  * @return {string} field A field used for sorting
38946
39321
  */
38947
39322
  SortableTitlePlugin.prototype.getColumnSortingField = function (colIndex) {
38948
- var options = this._getSortOptions(colIndex);
39323
+ var sortOptions = this._getSortOptions(colIndex);
38949
39324
  // options["field"] is already consolidated from field, sortBy, and sortable properties.
38950
- var field = (options) ? options["field"] : null;
39325
+ var field = (sortOptions) ? sortOptions["field"] : null;
38951
39326
 
38952
- if (field == null && !this._rowDefMode) { // Old CompositeGrid may stored sorting field in DataColumnName
39327
+ if (field == null && !this._rowDefMode) { // Old CompositeGrid may store sorting field in DataColumnName
38953
39328
  var host = this._hosts[0];
38954
39329
  if (host) {
38955
39330
  field = host.getDataColumnName(colIndex);
39331
+ if(field && sortOptions) {
39332
+ sortOptions["field"] = field; // Cache for later use
39333
+ }
38956
39334
  }
38957
39335
  }
38958
39336
 
38959
39337
  return field || "";
38960
39338
  };
38961
- /** @public
39339
+ /** This is equivalent to setting sortBy in the configuration object.
39340
+ * @public
38962
39341
  * @param {number} colIndex
38963
39342
  * @param {string|null} field A field used for sorting
38964
39343
  * @param {Function=} sortLogic
@@ -38979,21 +39358,26 @@ SortableTitlePlugin.prototype.setColumnSortingField = function (colIndex, field,
38979
39358
  }
38980
39359
  }
38981
39360
  };
38982
- /** @public
39361
+ /** Return array of the fields from the currently sorted columns
39362
+ * @public
38983
39363
  * @return {!Array.<string>} fields of each sorting states
38984
39364
  */
38985
39365
  SortableTitlePlugin.prototype.getColumnSortingFields = function () {
38986
- var ary = [];
39366
+ var len = this._sortStates.length;
39367
+ var ary = new Array(len);
38987
39368
  var host = this._hosts[0];
38988
- var colCount = host ? host.getColumnCount() : 0;
38989
- for (var c = 0; c < colCount; ++c) {
38990
- var sortOptions = this._getSortOptions(c);
38991
- if (sortOptions && sortOptions["sortOrder"]) {
38992
- var priority = this._sortStates.indexOf(sortOptions);
38993
- if (priority >= 0) {
38994
- ary[priority] = this.getColumnSortingField(c);
39369
+
39370
+ for(var i = 0; i < len; ++i) {
39371
+ var sortOptions = this._sortStates[i];
39372
+ var field = sortOptions["field"];
39373
+ if(!field && !this._rowDefMode) {
39374
+ var colIndex = this._getColumnIndexByOptions(sortOptions); // Slow
39375
+ field = host.getDataColumnName(colIndex);
39376
+ if(field) {
39377
+ sortOptions["field"] = field; // Cache for later use
38995
39378
  }
38996
39379
  }
39380
+ ary[i] = field || "";
38997
39381
  }
38998
39382
  return ary;
38999
39383
  };
@@ -39237,7 +39621,7 @@ SortableTitlePlugin.prototype._proceedSorting = function (hitObj) {
39237
39621
  if (this._canClickToSort(hitObj)) {
39238
39622
  var colIndex = hitObj["colIndex"];
39239
39623
  // _proceedSorting() method is always produced by user clicking at the header // Thus, this operation is guaranteed to be a user action
39240
- var state = this._preSortColumn(colIndex);
39624
+ var state = this._prepareSorting(colIndex);
39241
39625
  if (state) {
39242
39626
  this._sortColumn([state], { "isUserAction": true });
39243
39627
  }
@@ -39261,6 +39645,14 @@ SortableTitlePlugin.prototype._onMouseDown = function (e) {
39261
39645
  }
39262
39646
  };
39263
39647
  /** @private
39648
+ * @param {string} pluginName
39649
+ * @return {*|null}
39650
+ */
39651
+ SortableTitlePlugin.prototype._getPlugin = function(pluginName) {
39652
+ var host = this._hosts[0];
39653
+ return (host) ? host.getPlugin(pluginName) : null;
39654
+ };
39655
+ /** @private
39264
39656
  * @param {Core} grid
39265
39657
  * @param {MouseEvent} e
39266
39658
  */
@@ -39415,23 +39807,36 @@ SortableTitlePlugin.prototype.clearAllColumnSortingSequences = function () {
39415
39807
 
39416
39808
 
39417
39809
  /** @private
39418
- * @param {number} colIndex
39810
+ * @param {number|string} colRef Column index or field
39419
39811
  * @param {string=} sortOrder "a" for ascending, "d" for descending, and "n" for no sorting
39420
39812
  * @returns {Object} state Returns null, if nothing is changed
39421
39813
  */
39422
- SortableTitlePlugin.prototype._preSortColumn = function (colIndex, sortOrder) {
39423
- if (!this._maxCount) { return null; }
39814
+ SortableTitlePlugin.prototype._prepareSorting = function (colRef, sortOrder) {
39815
+ if (!this._maxCount) {
39816
+ return null;
39817
+ }
39424
39818
 
39425
- var priority = this.getSortPriority(colIndex);
39426
- var curState = (priority >= 0) ? this._sortStates[priority] : null;
39819
+ var colIndex = -1;
39820
+ var field = "";
39821
+ var priority = -1;
39822
+ if(typeof colRef === "number") {
39823
+ colIndex = colRef;
39824
+ field = this.getColumnSortingField(colIndex);
39825
+ priority = this.getSortPriority(colIndex);
39826
+ } else if(typeof colRef === "string") {
39827
+ field = colRef;
39828
+ colIndex = this._getColumnIndexByField(field);
39829
+ var fields = this.getColumnSortingFields();
39830
+ priority = fields.indexOf(field);
39831
+ }
39427
39832
 
39833
+ var curState = (priority >= 0) ? this._sortStates[priority] : null;
39428
39834
  var curOrder = curState ? curState["sortOrder"] : "n";
39429
39835
 
39430
39836
  // Getting next sort order
39431
39837
  var nextOrder = "n";
39432
- var sortingField = this.getColumnSortingField(colIndex);
39433
39838
  if (sortOrder == null) { // Auto order switch
39434
- var sortingSequence = this.getSortingSequence(sortingField);
39839
+ var sortingSequence = this.getSortingSequence(field);
39435
39840
 
39436
39841
  var sequenceIndex = sortingSequence.indexOf(curOrder);
39437
39842
  if (sequenceIndex < 0) {
@@ -39456,10 +39861,16 @@ SortableTitlePlugin.prototype._preSortColumn = function (colIndex, sortOrder) {
39456
39861
  }
39457
39862
 
39458
39863
  if (nextOrder === "a" || nextOrder === "d") { // Reorder sort states
39864
+ if(colIndex < 0 && !field) {
39865
+ return null;
39866
+ }
39459
39867
  if (!curState) {
39460
39868
  // TODO: Sort state object should not be sortOptions
39461
39869
  curState = this._newSortOptions(colIndex); // This may come with sortLogic
39462
39870
  }
39871
+ if(colIndex < 0) {
39872
+ curState["field"] = field;
39873
+ }
39463
39874
 
39464
39875
  this._sortStates.push(curState); // Latest sorting have lowest priority (multiColumn sorting)
39465
39876
  }
@@ -39486,7 +39897,7 @@ SortableTitlePlugin.prototype._preSortColumn = function (colIndex, sortOrder) {
39486
39897
 
39487
39898
  return { // TODO: Refactor this code as it is only used by "columnSorted" event (unnecessarily complex).
39488
39899
  "colIndex": colIndex,
39489
- "sortedField": sortingField,
39900
+ "sortedField": field,
39490
39901
  "sortOrder": nextOrder || "n",
39491
39902
  "prevOrder": curOrder,
39492
39903
  "clearedSortColIndexes": clearedSortColIndexes
@@ -39494,7 +39905,7 @@ SortableTitlePlugin.prototype._preSortColumn = function (colIndex, sortOrder) {
39494
39905
  };
39495
39906
 
39496
39907
  /** @private
39497
- * @param {Array.<Object>} states States from _preSortColumn for dispatching columnSorted event.
39908
+ * @param {Array.<Object>} states States from _prepareSorting for dispatching columnSorted event.
39498
39909
  * @param {Object=} opt_arg Event argument to be sent with preDataSorting event
39499
39910
  * @fires SortableTitlePlugin#preDataSorting
39500
39911
  * @fires SortableTitlePlugin#columnSorted
@@ -39521,8 +39932,8 @@ SortableTitlePlugin.prototype._sortColumn = function (states, opt_arg) {
39521
39932
  this._dispatch("columnSorted", res);
39522
39933
  };
39523
39934
 
39524
- /** @override
39525
- * @ignore
39935
+ /** @private
39936
+ * @param {Object} e
39526
39937
  */
39527
39938
  SortableTitlePlugin.prototype._onColumnAdded = function (e) {
39528
39939
  var t = this;
@@ -39544,8 +39955,8 @@ SortableTitlePlugin.prototype._onColumnAdded = function (e) {
39544
39955
  }
39545
39956
  };
39546
39957
 
39547
- /** @override
39548
- * @ignore
39958
+ /** @private
39959
+ * @param {Object} e
39549
39960
  * @fires SortableTitlePlugin#preDataSorting
39550
39961
  * @fires SortableTitlePlugin#columnSorted
39551
39962
  */
@@ -39597,7 +40008,7 @@ SortableTitlePlugin.prototype._sortDataView = function (opt_action) {
39597
40008
  sortLogics = new Array(sortCount);
39598
40009
  for (var i = 0; i < sortCount; ++i) {
39599
40010
  orders[i] = this._sortStates[i]["sortOrder"];
39600
- sortLogics[i] = this._sortStates[i]["sortLogic"];
40011
+ sortLogics[i] = this._sortStates[i]["sortLogic"]; // sortLogic can be null
39601
40012
  }
39602
40013
  if(this._rowDefMode) { // DataView in real-time grid has only ROW_DEF column
39603
40014
  c_ref = this._sortStates.map(SortableTitlePlugin._toRowDefField);
@@ -39679,7 +40090,7 @@ SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
39679
40090
 
39680
40091
  cell["addClass"]("sortable");
39681
40092
 
39682
- var priority = t._getColumnSortingStatePriority(col);
40093
+ var priority = t.getSortPriority(col);
39683
40094
  var state = t._sortStates[priority];
39684
40095
 
39685
40096
  var isSorting = state && state["sortOrder"] !== "n";
@@ -39750,18 +40161,40 @@ SortableTitlePlugin.prototype._createIconElem = function (icon, fallback) {
39750
40161
  };
39751
40162
 
39752
40163
  /** @private
39753
- * @param {number} colIndex
39754
- * @return {number} -1 means not found
40164
+ * @param {Object} sortOptions
40165
+ * @return {number}
39755
40166
  */
39756
- SortableTitlePlugin.prototype._getColumnSortingStatePriority = function (colIndex) {
39757
- var t = this;
39758
- for (var i = t._sortStates.length; --i >= 0;) {
39759
- var col = t.getSortedColumnIndex(i);
39760
- if (col === colIndex) return i;
40167
+ SortableTitlePlugin.prototype._getColumnIndexByOptions = function (sortOptions) {
40168
+ if(sortOptions) {
40169
+ var host = this._hosts[0];
40170
+ var colCount = host ? host.getColumnCount() : 0;
40171
+ for (var c = 0; c < colCount; ++c) {
40172
+ var colData = host.getColumnData(c); // Equivalent to _getSortOptions() method
40173
+ if (colData) {
40174
+ if(sortOptions === colData["sortableTitle"]) {
40175
+ return c;
40176
+ }
40177
+ }
40178
+ }
40179
+ }
40180
+ return -1;
40181
+ };
40182
+ /** @private
40183
+ * @param {string} field
40184
+ * @return {number}
40185
+ */
40186
+ SortableTitlePlugin.prototype._getColumnIndexByField = function (field) {
40187
+ if(field) {
40188
+ var host = this._hosts[0];
40189
+ var colCount = host ? host.getColumnCount() : 0;
40190
+ for (var c = 0; c < colCount; ++c) {
40191
+ if(field === this.getColumnSortingField(c)) {
40192
+ return c;
40193
+ }
40194
+ }
39761
40195
  }
39762
40196
  return -1;
39763
40197
  };
39764
-
39765
40198
  /** @private
39766
40199
  * @param {number} colIndex
39767
40200
  * @return {Object}
@@ -39784,10 +40217,7 @@ SortableTitlePlugin.prototype._newSortOptions = function (colIndex) {
39784
40217
  var host = this._hosts[0];
39785
40218
  var sortOptions = null;
39786
40219
  if (host && colIndex >= 0) {
39787
- var colData = host.getColumnData(colIndex);
39788
- if (!colData) {
39789
- colData = host.setColumnData(colIndex, {});
39790
- }
40220
+ var colData = host.getColumnData(colIndex); // colData is guaranteed to exist
39791
40221
  sortOptions = colData["sortableTitle"];
39792
40222
  if (!sortOptions) {
39793
40223
  sortOptions = colData["sortableTitle"] = {};
@@ -39833,623 +40263,6 @@ SortableTitlePlugin._proto = SortableTitlePlugin.prototype;
39833
40263
  /* harmony default export */ var plugins_SortableTitlePlugin = (SortableTitlePlugin);
39834
40264
 
39835
40265
 
39836
- // CONCATENATED MODULE: ./node_modules/@grid/core/es6/grid/plugins/DragAndDropTitlePlugin.js
39837
- /* eslint-disable */
39838
-
39839
-
39840
-
39841
-
39842
-
39843
- /* eslint-enable */
39844
-
39845
- /** Event
39846
- * @event DragAndDropTitlePlugin#dragged
39847
- * @type {MouseEvent}
39848
- * @property {*} * Depends on the browser's mouse event arguments
39849
- */
39850
- /** Event
39851
- * @event DragAndDropTitlePlugin#columnMoved
39852
- * @property {number} startColumnIndex
39853
- * @property {number} destColumnIndex
39854
- */
39855
-
39856
- /** @constructor
39857
- * @extends {Plugin}
39858
- */
39859
- var DragAndDropTitlePlugin = function () {
39860
- var _t = this;
39861
-
39862
- _t._onColumnAdded = _t._onColumnAdded.bind(_t);
39863
- _t._onColumnMoved = _t._onColumnMoved.bind(_t);
39864
- _t._onColumnRemoved = _t._onColumnRemoved.bind(_t);
39865
-
39866
- _t._onMouseUp = _t._onMouseUp.bind(_t);
39867
- _t._onMouseDown = _t._onMouseDown.bind(_t);
39868
-
39869
- _t._onDrag = _t._onDrag.bind(_t);
39870
- _t._onDragStart = _t._onDragStart.bind(_t);
39871
- _t._onDragEnd = _t._onDragEnd.bind(_t);
39872
- _t._onDragPulse = _t._onDragPulse.bind(_t);
39873
-
39874
- _t._hosts = [];
39875
-
39876
- _t._guideline = document.createElement("svg");
39877
- _t._guideline.className = "tr-guideline";
39878
- _t._dragbox = document.createElement("svg");
39879
- _t._dragbox.className = "tr-dragbox";
39880
-
39881
- _t._addEvent("dragged"); // drag
39882
- _t._addEvent("dragStart");
39883
- _t._addEvent("dragInterval");
39884
- _t._addEvent("preColumnMoved");
39885
- _t._addEvent("columnMoved");
39886
-
39887
- };
39888
- Ext["b" /* default */].inherits(DragAndDropTitlePlugin, plugins_Plugin);
39889
-
39890
-
39891
- /** @private
39892
- * @type {Core}
39893
- */
39894
- DragAndDropTitlePlugin.prototype._clickedGrid;
39895
- /** @private
39896
- * @type {ILayoutGrid}
39897
- */
39898
- DragAndDropTitlePlugin.prototype._clickedSection = null;
39899
- /** @private
39900
- * @type {number}
39901
- */
39902
- DragAndDropTitlePlugin.prototype._clickedRow = -1;
39903
- /** @private
39904
- * @type {!Element}
39905
- */
39906
- DragAndDropTitlePlugin.prototype._guideline;
39907
- /** @private
39908
- * @type {!Element}
39909
- */
39910
- DragAndDropTitlePlugin.prototype._dragbox;
39911
- /** @private
39912
- * @type {number}
39913
- */
39914
- DragAndDropTitlePlugin.prototype._timerId = 0;
39915
- /** @private
39916
- * @type {number}
39917
- */
39918
- DragAndDropTitlePlugin.prototype._dragPulseId = 0;
39919
- /** @private
39920
- * @type {Object}
39921
- */
39922
- DragAndDropTitlePlugin.prototype._pos = null; // Cache of current mouse position
39923
- /** @private
39924
- * @type {number}
39925
- */
39926
- DragAndDropTitlePlugin.prototype._cacheLeft = 0;
39927
- /** @private
39928
- * @type {number}
39929
- */
39930
- DragAndDropTitlePlugin.prototype._cacheWidth = 0;
39931
-
39932
- /** @private
39933
- * @type {number}
39934
- */
39935
- DragAndDropTitlePlugin.prototype._startColumn = -1;
39936
- /** @private
39937
- * @type {number}
39938
- */
39939
- DragAndDropTitlePlugin.prototype._endColumn = -1;
39940
- /** @private
39941
- * @type {number}
39942
- */
39943
- DragAndDropTitlePlugin.prototype._destColumn = -1;
39944
- /** @private
39945
- * @type {number}
39946
- */
39947
- DragAndDropTitlePlugin.prototype._leftMovableBorder = -1;
39948
- /** @private
39949
- * @type {number}
39950
- */
39951
- DragAndDropTitlePlugin.prototype._rightMovableBorder = -1;
39952
- /** @private
39953
- * @type {boolean}
39954
- */
39955
- DragAndDropTitlePlugin.prototype._isDragging = false;
39956
- /** @private
39957
- * @type {boolean}
39958
- */
39959
- DragAndDropTitlePlugin.prototype._lockFrozen = false;
39960
- /** @private
39961
- * @type {boolean}
39962
- */
39963
- DragAndDropTitlePlugin.prototype._disabled = false;
39964
- /** @private
39965
- * @type {boolean}
39966
- */
39967
- DragAndDropTitlePlugin.prototype._noColumnMoving = false;
39968
- /** @private
39969
- * @type {boolean}
39970
- */
39971
- DragAndDropTitlePlugin.prototype._noDragBox = false;
39972
-
39973
-
39974
- /** @override */
39975
- DragAndDropTitlePlugin.prototype.getName = function () {
39976
- return "DragAndDropTitlePlugin"; // Read Only
39977
- };
39978
- /** @override */
39979
- DragAndDropTitlePlugin.prototype.initialize = function (host) {
39980
- if(this._hosts.indexOf(host) >= 0) { return; }
39981
-
39982
- this._hosts.push(host);
39983
- host.listen("mousedown", this._onMouseDown);
39984
- host.listen("columnAdded", this._onColumnAdded);
39985
- host.listen("columnMoved", this._onColumnMoved);
39986
- host.listen("columnRemoved", this._onColumnRemoved);
39987
-
39988
- host.listen("dragstart", util._preventDefault);
39989
- };
39990
-
39991
- /** @override */
39992
- DragAndDropTitlePlugin.prototype.unload = function (host) {
39993
- var at = this._hosts.indexOf(host);
39994
- if(at < 0) { return; }
39995
-
39996
- this._hosts.splice(at, 1);
39997
- host.unlisten("mousedown", this._onMouseDown);
39998
- host.unlisten("columnAdded", this._onColumnAdded);
39999
- host.unlisten("columnMoved", this._onColumnMoved);
40000
- host.unlisten("columnRemoved", this._onColumnRemoved);
40001
- };
40002
-
40003
- /** Specify column to be processed by this plugin
40004
- * @public
40005
- * @return {null}
40006
- */
40007
- DragAndDropTitlePlugin.prototype.getMarker = function () {
40008
- return null;
40009
- };
40010
-
40011
- /**
40012
- * Lock moving of frozen column. If true is spsecified, dragging is disabled for frozen column.
40013
- * @public
40014
- * @param {boolean} lock
40015
- */
40016
- DragAndDropTitlePlugin.prototype.lockFrozenColumn = function(lock) {
40017
- this._lockFrozen = lock;
40018
- };
40019
-
40020
- /** Disable this plugin entirely
40021
- * @public
40022
- * @param {boolean=} opt_disabled
40023
- */
40024
- DragAndDropTitlePlugin.prototype.disable = function(opt_disabled) {
40025
- this._disabled = opt_disabled !== false;
40026
- };
40027
- /** Disable column moving. Only cursor is showing and events are fired. No real column moving.
40028
- * @public
40029
- * @param {boolean=} opt_disabled
40030
- */
40031
- DragAndDropTitlePlugin.prototype.disableMoving = function(opt_disabled) {
40032
- this._noColumnMoving = opt_disabled !== false;
40033
- };
40034
- /** Disable column moving. Only cursor is showing and events are fired. No real column moving.
40035
- * @public
40036
- * @param {boolean=} opt_disabled
40037
- */
40038
- DragAndDropTitlePlugin.prototype.disableDragBox = function(opt_disabled) {
40039
- this._noDragBox = opt_disabled !== false;
40040
- };
40041
-
40042
- /** @private
40043
- * @param {number} colIndex
40044
- * @return {boolean}
40045
- */
40046
- DragAndDropTitlePlugin.prototype._isAllowed = function(colIndex) {
40047
- var host = this._clickedGrid || this._hosts[0];
40048
- if (host) {
40049
- var stationaryIndex = host.getStationaryColumnIndex();
40050
- if (stationaryIndex < 0) {
40051
- return true;
40052
- }
40053
- if (colIndex <= stationaryIndex) {
40054
- return false;
40055
- }
40056
- }
40057
- return true;
40058
- };
40059
- /** @private
40060
- * @param {Event} e
40061
- */
40062
- DragAndDropTitlePlugin.prototype._onMouseDown = function (e) {
40063
- if(this._disabled) {
40064
- return;
40065
- }
40066
- if(e.shiftKey || e.ctrlKey || e.altKey) {
40067
- return; // Ignore mousedown event, if modifier key is detected
40068
- }
40069
- if(e.button) {
40070
- return; // We don't allow drag with middle click (button == 1), or right click (button == 2)
40071
- }
40072
- if(this._timerId) {
40073
- return; // Drag timer is already start
40074
- }
40075
-
40076
- var host = this.getRelativeGrid(e);
40077
- if(!host) {
40078
- return; // Given event should be within grid element
40079
- }
40080
-
40081
- this._pos = host.getRelativePosition(e);
40082
- if (this._pos["hit"] === false) {
40083
- return; // Only start dragging when mouse is down on the grid
40084
- }
40085
-
40086
- var section = /** @type{ILayoutGrid} */(this._pos["section"]);
40087
- if(!section) {
40088
- return; // The section that is not in the target section list cannot be dragged
40089
- } else if(this._pos["sectionType"] !== "title") {
40090
- return; // Sections other than title section cannot be dragged by default
40091
- }
40092
-
40093
- var colIndex = this._pos["colIndex"];
40094
- if(!this._isAllowed(colIndex)) {
40095
- return; // The column cannot be dragged
40096
- }
40097
- if(this._lockFrozen && host.isPinnedColumn(colIndex)) {
40098
- return; // If the lock frag is on, frozen columns cannot be dragged
40099
- }
40100
-
40101
- var rowIndex = this._pos["rowIndex"]; // rowIndex may not exist
40102
- var movableBorder = this._findMoveableBorder(colIndex, rowIndex - 1, section);
40103
- var movingColumns = this._getSpan(colIndex, rowIndex, section);
40104
-
40105
- this._clickedGrid = host;
40106
- this._clickedSection = section;
40107
- this._clickedRow = rowIndex;
40108
-
40109
- this._startColumn = movingColumns["left"];
40110
- this._endColumn = movingColumns["right"];
40111
- this._leftMovableBorder = movableBorder["left"];
40112
- this._rightMovableBorder = movableBorder["right"];
40113
- this._destColumn = this._startColumn;
40114
-
40115
- this._timerId = setTimeout(this._onDragStart, 300);
40116
- window.addEventListener("mouseup", this._onMouseUp, false);
40117
- };
40118
- /** @private
40119
- * @param {Object} e
40120
- */
40121
- DragAndDropTitlePlugin.prototype._onMouseUp = function (e) {
40122
- if(this._timerId) {
40123
- window.clearTimeout(this._timerId);
40124
- window.removeEventListener("mouseup", this._onMouseUp, false);
40125
- this._timerId = 0;
40126
- this._clearCache();
40127
- }
40128
- };
40129
-
40130
- /** @private
40131
- */
40132
- DragAndDropTitlePlugin.prototype._onDragStart = function () {
40133
- if(this._disabled || this._isDragging) { return; }
40134
-
40135
- if (this._hasListener("dragStart")) {
40136
- this._dispatch("dragStart", /** @type{!Object} */(this._pos));
40137
- }
40138
-
40139
- if (this._pos["cancel"]) {
40140
- return;
40141
- }
40142
-
40143
- this._timerId = 0;
40144
- window.removeEventListener("mouseup", this._onMouseUp, false);
40145
-
40146
- if(!this._clickedGrid) {
40147
- return;
40148
- }
40149
-
40150
- this._isDragging = true;
40151
- document.body.classList.add("tr-dragging"); // Prevent text selection
40152
- // document.body.classList.add("tr-move-cursor");
40153
-
40154
- window.addEventListener("mousemove", this._onDrag, false);
40155
- window.addEventListener("mouseup", this._onDragEnd, true);
40156
-
40157
- var host = this._clickedGrid;
40158
- var height = host.getHeight();
40159
- var sectionBound = this._clickedSection.getBoundingClientRect();
40160
- var clickedCellBound = this._clickedSection.getCell(this._startColumn, this._clickedRow).getBoundingClientRect();
40161
-
40162
- var gridElem = host.getElement();
40163
- this._guideline.style.top = (clickedCellBound.top - sectionBound.top) + "px";
40164
- this._guideline.style.height = (height - 1) + "px";
40165
- this._dragbox.style.height = (height - 33) + "px"; // WARNING: Height could be long
40166
- this._dragbox.style.width = this._clickedSection.getColumnWidth(this._startColumn) + "px";
40167
-
40168
- // TODO: guideline and drag box should be outside of grid area
40169
- gridElem.appendChild(this._guideline);
40170
-
40171
- this._dimCol(true);
40172
- this._renderGuideline();
40173
-
40174
- // For step scrolling // TODO: Merge this logic with DraggableContentPlugin
40175
- this._scrollStep = Math.floor(host.getScrollWidth() / 25); // Update the scrollbar first
40176
- if(this._scrollStep < 40) {
40177
- this._scrollStep = 40;
40178
- } else if(this._scrollStep > 400) {
40179
- this._scrollStep = 400;
40180
- }
40181
- var scrollbar = host.getHScrollbar();
40182
- this._cacheLeft = scrollbar.getLeft() + 20;
40183
- this._cacheWidth = scrollbar.getLeft() + scrollbar.getWidth() - 20;
40184
-
40185
- this._dragPulseId = window.setInterval(this._onDragPulse, 150); // Start pulse
40186
- };
40187
- /** @private
40188
- * @param {Event} e
40189
- */
40190
- DragAndDropTitlePlugin.prototype._onDrag = function (e) {
40191
- if(!this._isDragging) { return; }
40192
-
40193
- util._preventDefault(e);
40194
- this._pos = this._clickedGrid.getRelativePosition(e); // Relative to the clicked grid
40195
-
40196
- var host = this.getRelativeGrid(e);
40197
- if (!host || host !== this._clickedGrid) { return; }
40198
-
40199
- var colIndex = this._pos["colIndex"];
40200
- if ((colIndex >= this._leftMovableBorder) &&
40201
- (colIndex <= this._rightMovableBorder) &&
40202
- this._isAllowed(colIndex) &&
40203
- !(this._lockFrozen && host.isPinnedColumn(colIndex))) {
40204
- this._renderGuideline();
40205
- this._dispatch("dragged", /** @type{!Object} */(e));
40206
- }
40207
- this._renderDragBox(e);
40208
- };
40209
- /** @private
40210
- * @param {Event} e
40211
- */
40212
- DragAndDropTitlePlugin.prototype._onDragEnd = function (e) {
40213
- if(!this._isDragging) {
40214
- return;
40215
- }
40216
-
40217
- this._isDragging = false;
40218
- document.body.classList.remove("tr-dragging");
40219
- // document.body.classList.remove("tr-move-cursor");
40220
- this._dimCol(false);
40221
-
40222
- var pn = this._guideline.parentNode;
40223
- if(pn) {
40224
- pn.removeChild(this._guideline);
40225
- }
40226
-
40227
- pn = this._dragbox.parentNode;
40228
- if(pn) {
40229
- pn.removeChild(this._dragbox);
40230
- }
40231
-
40232
- window.removeEventListener("mousemove", this._onDrag, false);
40233
- window.removeEventListener("mouseup", this._onDragEnd, true);
40234
-
40235
- if(this._dragPulseId) {
40236
- window.clearInterval(this._dragPulseId);
40237
- this._dragPulseId = 0;
40238
- }
40239
- this._pos = null;
40240
-
40241
- util._preventDefault(e);
40242
-
40243
- //When move to the right, the first position is the current one.
40244
- if (this._destColumn > this._startColumn) {
40245
- --this._destColumn;
40246
- }
40247
- //Cancel moving if the destination column is the current column or not allowed column
40248
- if ((!this._destColumn && this._destColumn !== 0) || // undefined, NaN, null
40249
- this._destColumn < 0 ||
40250
- !this._isAllowed(this._destColumn) ||
40251
- (this._destColumn >= this._startColumn && this._destColumn <= this._endColumn)) {
40252
- this._clearCache();
40253
- return;
40254
- }
40255
-
40256
- var arg = {
40257
- "startColumnIndex": this._startColumn,
40258
- "destColumnIndex": this._destColumn
40259
- };
40260
-
40261
- if (this._hasListener("preColumnMoved")) {
40262
- this._dispatch("preColumnMoved", arg);
40263
- }
40264
-
40265
- if (arg["cancel"]) {
40266
- return;
40267
- }
40268
-
40269
- if (!this._noColumnMoving) {
40270
- var shiftStart = -1;
40271
- var shiftEnd = -1;
40272
- var moveSize = -1;
40273
- if (this._startColumn > this._destColumn) { //Move backward
40274
- shiftStart = this._destColumn;
40275
- shiftEnd = this._startColumn - 1;
40276
- moveSize = -1 * (this._startColumn - this._destColumn); //Move to the left
40277
- } else
40278
- if (this._startColumn < this._destColumn) { //Move foward
40279
- shiftStart = this._endColumn + 1;
40280
- shiftEnd = this._destColumn;
40281
- moveSize = ((shiftEnd - shiftStart) + 1); //Move to the right
40282
- }
40283
-
40284
- //Perform moving all columns in the range
40285
- for(var j = this._hosts.length; --j >= 0;) {
40286
- var host = this._hosts[j];
40287
- var i;
40288
- if (moveSize > 0) { //Move forward
40289
- for (i = this._startColumn; i <= this._endColumn; i++) {
40290
- host.moveColumn(this._startColumn, this._destColumn);
40291
- }
40292
- } else { //Move backward
40293
- for (i = this._startColumn; i <= this._endColumn; i++) {
40294
- host.moveColumn(this._startColumn + (i - this._startColumn), this._destColumn + (i - this._startColumn));
40295
- }
40296
- }
40297
- }
40298
- }
40299
-
40300
- if (this._hasListener("columnMoved")) {
40301
- this._dispatch("columnMoved", {
40302
- "startColumnIndex": this._startColumn,
40303
- "endColumnIndex": this._endColumn,
40304
- "destColumnIndex": this._destColumn,
40305
- "clickedRow": this._clickedRow
40306
- });
40307
- }
40308
- this._clearCache();
40309
- };
40310
-
40311
- /** @private
40312
- */
40313
- DragAndDropTitlePlugin.prototype._onDragPulse = function() {
40314
- if(!this._isDragging || !this._pos) { return; }
40315
-
40316
- this._dispatch("dragInterval", /** @type{!Object} */(this._pos));
40317
-
40318
- var host = this._clickedGrid;
40319
- if(!host || !host.getHScrollbar().isActive()) { return; }
40320
-
40321
- var x = this._pos["x"];
40322
- var scrollVal = 0;
40323
- if(x < this._cacheLeft) {
40324
- scrollVal = -Math.floor(this._scrollStep * (0.8 + Math.random()));
40325
-
40326
- } else if(x > this._cacheWidth) {
40327
- scrollVal = Math.floor(this._scrollStep * (0.8 + Math.random()));
40328
- }
40329
-
40330
- this._scrollRight(scrollVal);
40331
- };
40332
- /** @private
40333
- */
40334
- DragAndDropTitlePlugin.prototype._clearCache = function() {
40335
- this._startColumn = this._endColumn = this._destColumn = -1;
40336
-
40337
- this._leftMovableBorder = this._rightMovableBorder = -1;
40338
-
40339
- this._clickedRow = -1;
40340
- this._clickedSection = this._clickedGrid = null;
40341
- };
40342
-
40343
- /** @private
40344
- * @param {number} colIndex
40345
- * @param {number} row
40346
- * @param {ILayoutGrid} section
40347
- * @return {!Object}
40348
- */
40349
- DragAndDropTitlePlugin.prototype._getSpan = function(colIndex, row, section) {
40350
- var cellSpan = section.getCellColSpan(colIndex, row);
40351
-
40352
- if (cellSpan <= 0) { // The specified cell is being occupied
40353
- colIndex += cellSpan; // Convert the given negative index to the spanning cell
40354
- cellSpan = section.getCellColSpan(colIndex, row);
40355
- }
40356
-
40357
- return { "left": colIndex, "right": (colIndex + cellSpan - 1) };
40358
- };
40359
- /** @private
40360
- * @param {number} col
40361
- * @param {number} row
40362
- * @param {ILayoutGrid} section
40363
- * @return {!Object}
40364
- */
40365
- DragAndDropTitlePlugin.prototype._findMoveableBorder = function(col, row, section) {
40366
- if (row < 0 || (!row && row !== 0)) { // Guaranteed to get out of infinite loop by checking undefined, NaN, null
40367
- return { "left": 0, "right": (section.getColumnCount() - 1) };
40368
- }
40369
- var span = this._getSpan(col, row, section);
40370
- if (span["right"] >= span["left"]) {
40371
- return span;
40372
- } else {
40373
- return this._findMoveableBorder(col, row - 1, section);
40374
- }
40375
- };
40376
- /**
40377
- * @private
40378
- */
40379
- DragAndDropTitlePlugin.prototype._renderGuideline = function() {
40380
- var colIndex = this._pos["colIndex"];
40381
- if(colIndex == null || colIndex < 0) { // undefined, null or negative number
40382
- return;
40383
- }
40384
-
40385
- var currentSpan = this._getSpan(colIndex, this._clickedRow, this._clickedSection);
40386
- var colStart = currentSpan["left"]; // This can be different from colIndex
40387
- var colEnd = currentSpan["right"];
40388
- var colLeft = this._clickedGrid.getColumnLeft(colStart);
40389
- var colWidth = 0;
40390
- for(var i = colStart; i <= colEnd; ++i) {
40391
- colWidth += this._clickedGrid.getColumnWidth(i);
40392
- }
40393
-
40394
- var rightHand = this._pos["x"] > colLeft + colWidth / 2;
40395
- var destColumn = (rightHand) ? colEnd + 1 : colStart;
40396
-
40397
- colLeft = this._clickedGrid.getColumnLeft(this._destColumn);
40398
- // If destination exceeds the specified bounds
40399
- if (destColumn < this._leftMovableBorder) {
40400
- destColumn = this._leftMovableBorder;
40401
- } else if (destColumn > this._rightMovableBorder) {
40402
- destColumn = this._rightMovableBorder + 1;
40403
- if(rightHand) {
40404
- colLeft -= 4; // Shift guideline to the left if this is the rightmost column
40405
- }
40406
- }
40407
-
40408
- this._destColumn = destColumn;
40409
- this._guideline.style.left = colLeft + "px";
40410
- };
40411
- /** @private
40412
- * @param {!Element|Event|MouseEvent} e
40413
- */
40414
- DragAndDropTitlePlugin.prototype._renderDragBox = function(e) {
40415
- if(this._noDragBox) {
40416
- return;
40417
- }
40418
-
40419
- var gridElem = this._clickedGrid.getElement();
40420
- var pn = this._dragbox.parentNode;
40421
- if(!pn) {
40422
- gridElem.appendChild(this._dragbox);
40423
- }
40424
-
40425
- var gridRect = gridElem.getBoundingClientRect();
40426
- var zoomFactor = this._clickedGrid["zoomFactor"]; // TODO: Remove zoom factor
40427
- var contentWidth = gridRect.width;
40428
-
40429
- var x = e.clientX - gridRect.left;
40430
- var y = ((e.pageY - gridRect.top) / zoomFactor) - window.scrollY;
40431
- var midFactor = parseFloat((x / contentWidth).toFixed(2));
40432
- var dragboxLeft = (gridRect.width * midFactor) / zoomFactor - this._dragbox.offsetWidth * midFactor;
40433
-
40434
- this._dragbox.style.left = dragboxLeft + "px";
40435
- this._dragbox.style.top = (y + 10) + "px";
40436
- };
40437
-
40438
- /**
40439
- * @private
40440
- * @param {boolean} inOut
40441
- */
40442
- DragAndDropTitlePlugin.prototype._dimCol = function(inOut) {
40443
- for (var i = this._startColumn; i <= this._endColumn; i++) {
40444
- this._clickedGrid.enableColumnClass(i, "drag-fadeout", inOut);
40445
- }
40446
- };
40447
-
40448
- DragAndDropTitlePlugin._proto = DragAndDropTitlePlugin.prototype;
40449
-
40450
- /* harmony default export */ var plugins_DragAndDropTitlePlugin = (DragAndDropTitlePlugin);
40451
-
40452
-
40453
40266
  // CONCATENATED MODULE: ./src/js/Grid.js
40454
40267
  /* eslint-disable */
40455
40268
 
@@ -40484,6 +40297,11 @@ DragAndDropTitlePlugin._proto = DragAndDropTitlePlugin.prototype;
40484
40297
  * @property {boolean=} debug=false If true, Synapse response will be mock
40485
40298
  */
40486
40299
 
40300
+ /** @typedef {Object} Grid~ADCOptions
40301
+ * @description ADC requesting level config from adc team
40302
+ * @property {string=} productId=001 required parameter, it specifies the product for which you request data. Contact the adc staff to create one.
40303
+ */
40304
+
40487
40305
  /** @typedef {Object} Grid~GridOptions
40488
40306
  * @description Configuration object that can be provided directly at the initialization phase
40489
40307
  * @property {Array.<ColumnDefinition~Options|string>=} columns Collection of the column definitions
@@ -40518,15 +40336,18 @@ DragAndDropTitlePlugin._proto = DragAndDropTitlePlugin.prototype;
40518
40336
  * @property {boolean=} verticalLines=true Vertical lines for all sections
40519
40337
  * @property {boolean=} horizontalLines=true Horizontal lines for all sections
40520
40338
  * @property {*=} RTK=null rtk toolkit instance
40339
+ * @property {Grid~ADCOptions=} ADC=null ADC requesting level config object from adc team
40521
40340
  * @property {Grid~SynapseConfig=} synapse=null synapse config object
40522
40341
  * @property {number=} contentRightPadding=0 Padding that is added next to the right most column. The padding is still a part of scrollable content.
40523
40342
  * @property {number=} contentBottomPadding=0 Padding that is added below the last section. The padding is still a part of scrollable content.
40524
40343
  * @property {number=} dataConflationRate=0 set delay for data to avoid to much sorting operation when data changed
40525
40344
  * @property {Function=} dataComposed Handler for dataComposed event
40526
40345
  * @property {boolean=} autoDateConversion=false If enabled, date-time field with numeric value will be automatically converted to native date object.
40527
- * @property {boolean=} textSelect=false If enabled, user can select text
40346
+ * @property {boolean=} textSelect=false If enabled, user can select content text by using mouse drag.
40528
40347
  * @property {string=} lang laguage for config localization date time, if null the default language is "en"
40529
40348
  * @property {Element=} scrollbarParent=null Element to be attached by grid's scrollbars, allowing them to move outside and avoid overlapping with the content.
40349
+ * @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.
40350
+ * @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
40530
40351
  */
40531
40352
 
40532
40353
  /** @typedef {number|string|RowDefinition} Grid~RowReference
@@ -40712,6 +40533,7 @@ var Grid = function(placeholder, config) {
40712
40533
  t._onFieldLoadedError = t._onFieldLoadedError.bind(t);
40713
40534
 
40714
40535
  t._snapshotFillerDataChanged = t._snapshotFillerDataChanged.bind(t);
40536
+ t._onPollingInterval = t._onPollingInterval.bind(t);
40715
40537
 
40716
40538
  t._streamingConflator = new Conflator(50, t._updateStreamingData);
40717
40539
  t._formulaConflator = new Conflator(300, t._onFormulaDataChanged);
@@ -40725,6 +40547,12 @@ var Grid = function(placeholder, config) {
40725
40547
  t._grid = new Core();
40726
40548
  t._grid._wrapper = this; // For back referencing
40727
40549
 
40550
+ t._sorter = new js_RowDefSorter();
40551
+ t._sorter.setContext("grid", this);
40552
+ t._sorter.setContext("core", t._grid); // TODO: Handle multiple core grids
40553
+
40554
+ t._dateTimeUtil = DateTime;
40555
+
40728
40556
  t._grid.listen("columnAdded", t._onColumnAdded); // Columns could be added by some plugins
40729
40557
 
40730
40558
  if(config) {
@@ -40736,20 +40564,15 @@ var Grid = function(placeholder, config) {
40736
40564
 
40737
40565
  var core = t._mainGrid.getCoreGrid();
40738
40566
  t._stp = core.getPlugin("SortableTitlePlugin");
40739
- t._dtp = core.getPlugin("DragAndDropTitlePlugin");
40740
40567
  }
40741
40568
  if(config["SortableTitle"]) { // Exception for built-in plugin
40742
40569
  t._stp = config["SortableTitle"];
40743
40570
  }
40744
- if(config["DragAndDropTitle"]) { // Exception for built-in plugin
40745
- t._dtp = config["DragAndDropTitle"];
40746
- }
40747
40571
  }
40748
40572
  if(!t._sharedDataSource) {
40749
40573
  t._dc = new DataCache_DataCache();
40750
40574
  t._dc.listen("dataChanged", t._onDataChanged);
40751
40575
  t._dc.listen("dataComposed", t._onDataComposed);
40752
- t._dc.listen("dataComposed", t._recalculateFormulas); // This will be called after _onDataComposed
40753
40576
 
40754
40577
  t._dt = new DataTable();
40755
40578
  t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
@@ -40757,8 +40580,11 @@ var Grid = function(placeholder, config) {
40757
40580
  t._dv.listen("pageIndexChanged", t._dispatch.bind(t, "pageIndexChanged"));
40758
40581
  t._dv.listen("pageCountChanged", t._dispatch.bind(t, "pageCountChanged")); // TODO: When implementing filtered row, it may need to implement the conflator
40759
40582
  }
40583
+ t._grid.setDataSource(t._dv); // Avoid triggering sorting
40584
+
40760
40585
  if(t._stp) {
40761
- this._sharedSorter = true;
40586
+ t._sharedSorter = true;
40587
+ t._stp.listen("preDataSorting", t._onPreDataSorting);
40762
40588
  t._grid.loadPlugin(t._stp); // The plugin instance is shared and don't need to be reconfigured.
40763
40589
  } else { // Create built-in plugin
40764
40590
  t._stp = new SortableTitlePlugin({
@@ -40774,10 +40600,6 @@ var Grid = function(placeholder, config) {
40774
40600
  // beforeInit is not called.
40775
40601
  t._grid.loadPlugin(t._stp, config);
40776
40602
  }
40777
- if(!t._dtp) { // Create built-in plugin
40778
- t._dtp = new DragAndDropTitlePlugin();
40779
- }
40780
- t._grid.loadPlugin(t._dtp);
40781
40603
 
40782
40604
  t._grid.listen("preSectionRender", t._onColumnHeaderBinding);
40783
40605
  t._grid.listen("postSectionDataBinding", t._onPostSectionDataBinding);
@@ -40785,7 +40607,6 @@ var Grid = function(placeholder, config) {
40785
40607
  t._grid.enableRowHighlighting(true);
40786
40608
 
40787
40609
  t._addGridSections();
40788
- t._grid.setDataSource(t._dv);
40789
40610
  t._grid.setParent(t._topNode);
40790
40611
 
40791
40612
  t._snapshot = new js_SnapshotFiller();
@@ -40798,10 +40619,6 @@ var Grid = function(placeholder, config) {
40798
40619
  t._connector.addEventListener("fieldAdded", t._onFieldAdded.bind(t));
40799
40620
  t._connector.addEventListener("fieldRemoved", t._onFieldRemoved.bind(t));
40800
40621
 
40801
- t._fnEngine = new Engine();
40802
- t._fnEngine.addEventListener("dataChanged", t._onFormulaDataChanged);
40803
- t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
40804
-
40805
40622
  t.initialize(config);
40806
40623
  t.initSubscription();
40807
40624
 
@@ -40855,10 +40672,6 @@ Grid.prototype._subs = null;
40855
40672
  * @private
40856
40673
  */
40857
40674
  Grid.prototype._stp = null;
40858
- /** @type {DragAndDropTitlePlugin}
40859
- * @private
40860
- */
40861
- Grid.prototype._dtp = null;
40862
40675
  /** @type {Function}
40863
40676
  * @private
40864
40677
  */
@@ -40876,6 +40689,10 @@ Grid.prototype._snapshot = null;
40876
40689
  * @type {DataConnector}
40877
40690
  */
40878
40691
  Grid.prototype._connector = null;
40692
+ /** @private
40693
+ * @type {RowDefSorter}
40694
+ */
40695
+ Grid.prototype._sorter = null;
40879
40696
 
40880
40697
  /** @private
40881
40698
  * @type {Engine}
@@ -40895,10 +40712,6 @@ Grid.prototype._chainMembers = null;
40895
40712
  */
40896
40713
  Grid.prototype._chainConflator = null;
40897
40714
  /** @private
40898
- * @type {boolean}
40899
- */
40900
- Grid.prototype._hasGroup = false;
40901
- /** @private
40902
40715
  * @type {number}
40903
40716
  */
40904
40717
  Grid.prototype._clientWidth = NaN;
@@ -40914,6 +40727,10 @@ Grid.prototype._defaultColumnOptions = null;
40914
40727
  * @type {*}
40915
40728
  */
40916
40729
  Grid.prototype._RTK = null;
40730
+ /** @private
40731
+ * @type {Grid~ADCOptions}
40732
+ */
40733
+ Grid.prototype._ADCOptions = null;
40917
40734
  /** use for synapse service
40918
40735
  * @private
40919
40736
  * @type {string}
@@ -40927,15 +40744,34 @@ Grid.prototype._autoDateConversion = false;
40927
40744
  * @type {boolean}
40928
40745
  */
40929
40746
  Grid.prototype._textSelect = false;
40930
- /** @private
40931
- * @type {string}
40747
+ /** @type {string}
40748
+ * @private
40932
40749
  */
40933
40750
  Grid.prototype._lang = null;
40934
- /**
40751
+ /** @type {Object}
40752
+ * @private
40753
+ */
40754
+ Grid.prototype._dateTimeUtil = null;
40755
+ /** @type {boolean}
40935
40756
  * @private
40936
- * @type {boolean}
40937
40757
  */
40938
40758
  Grid.prototype._initializing = false;
40759
+ /** @type {number}
40760
+ * @private
40761
+ */
40762
+ Grid.prototype._pollingInterval = 0;
40763
+ /** @type {number}
40764
+ * @private
40765
+ */
40766
+ Grid.prototype._pollingTimerId = 0;
40767
+ /** @type {number}
40768
+ * @private
40769
+ */
40770
+ Grid.prototype._lastPollingRequest = 0;
40771
+ /** @type {boolean}
40772
+ * @private
40773
+ */
40774
+ Grid.prototype._pollingEnabled = true;
40939
40775
 
40940
40776
 
40941
40777
  /** @public
@@ -40946,8 +40782,13 @@ Grid.prototype.dispose = function() {
40946
40782
  clearInterval(this._autoLayoutTimer);
40947
40783
  this._autoLayoutTimer = 0;
40948
40784
  }
40785
+ if(this._pollingTimerId) {
40786
+ clearTimeout(this._pollingTimerId);
40787
+ this._pollingTimerId = 0;
40788
+ }
40949
40789
  this.removeAllColumns(); // Some conflators are reset
40950
40790
  this.removeAllRows(); // Some conflators are reset
40791
+ this._sorter.dispose();
40951
40792
  this._grid.dispose();
40952
40793
  this._connector.reset();
40953
40794
 
@@ -41164,6 +41005,12 @@ Grid.prototype.initialize = function(gridOption) {
41164
41005
  t._RTK = gridOption["RTK"];
41165
41006
  t._snapshot.setRTK(t._RTK);
41166
41007
  }
41008
+
41009
+ if (gridOption["ADC"]) {
41010
+ t._ADCOptions = gridOption["ADC"];
41011
+ t._snapshot.setADCOptions(t._ADCOptions);
41012
+ }
41013
+
41167
41014
  if (gridOption["synapse"]) {
41168
41015
  t._synapse = gridOption["synapse"];
41169
41016
  js_FieldDefinition.setSynapseConfig(t._synapse);
@@ -41173,6 +41020,12 @@ Grid.prototype.initialize = function(gridOption) {
41173
41020
  js_StyleLoader.chainIcon = gridOption["icons"]["rowGrouping"]["expander"];
41174
41021
  }
41175
41022
 
41023
+ if(gridOption["formulaEngine"]) {
41024
+ t._fnEngine = new Engine();
41025
+ t._fnEngine.addEventListener("dataChanged", t._onFormulaDataChanged);
41026
+ t._fnEngine.addEventListener("dataRequired", t._onFormulaDataRequired);
41027
+ }
41028
+
41176
41029
  var borders = gridOption["borders"];
41177
41030
  if (borders != null) {
41178
41031
  grid.toggleBorders(borders);
@@ -41203,14 +41056,6 @@ Grid.prototype.initialize = function(gridOption) {
41203
41056
  grid.getSection("title").setDefaultRowHeight(hRowHeight);
41204
41057
  }
41205
41058
 
41206
- var noColumnDragging = gridOption["noColumnDragging"];
41207
- if (noColumnDragging == null && gridOption["columnReorder"] != null) {
41208
- noColumnDragging = !gridOption["columnReorder"];
41209
- }
41210
- if (noColumnDragging) {
41211
- t._dtp.disable();
41212
- }
41213
-
41214
41059
  var val = gridOption["autoLayoutUpdate"];
41215
41060
  if(!t._autoLayoutTimer && val) {
41216
41061
  if(val !== "0" && val !== "false") { // HACK: Temporarily support incorrect data type
@@ -41250,6 +41095,10 @@ Grid.prototype.initialize = function(gridOption) {
41250
41095
  if(gridOption["scrollbarParent"] != null) {
41251
41096
  t._setScrollbarParent(gridOption["scrollbarParent"]);
41252
41097
  }
41098
+ var pollingInterval = gridOption["adcPollingInterval"];
41099
+ if(pollingInterval != null) {
41100
+ t._pollingInterval = pollingInterval ? +pollingInterval : 0;
41101
+ }
41253
41102
 
41254
41103
  // Column operations
41255
41104
  t.setColumns(cols);
@@ -41324,7 +41173,7 @@ Grid.prototype.initialize = function(gridOption) {
41324
41173
  var lang = gridOption["lang"];
41325
41174
  if(lang != null) {
41326
41175
  t._lang = lang;
41327
- DateTime.setLocale(lang);
41176
+ t._dateTimeUtil.setLocale(lang);
41328
41177
  }
41329
41178
 
41330
41179
  // Row operations
@@ -41464,13 +41313,19 @@ Grid.prototype.getConfigObject = function (gridOptions) {
41464
41313
  obj["autoDateConversion"] = true;
41465
41314
  }
41466
41315
 
41467
- if (this._textSelect) {
41316
+ if(this._textSelect) {
41468
41317
  obj["textSelect"] = true;
41469
41318
  }
41470
41319
 
41471
- if (this._lang) {
41320
+ if(this._lang) {
41472
41321
  obj["lang"] = this._lang;
41473
41322
  }
41323
+ if(this._fnEngine) {
41324
+ obj["formulaEngine"] = true;
41325
+ }
41326
+ if(this._pollingInterval) {
41327
+ obj["adcPollingInterval"] = this._pollingInterval;
41328
+ }
41474
41329
 
41475
41330
  // get all rows config
41476
41331
  var rowDefs = this.getAllRowDefinitions();
@@ -41506,17 +41361,37 @@ Grid.prototype.getConfigObject = function (gridOptions) {
41506
41361
  }
41507
41362
 
41508
41363
  // TODO: The following states need to be retrieved
41509
- // noColumnDragging
41510
41364
  // rowHighlighting
41511
41365
  // columnVirtualization
41512
41366
  // topFreezingCount, bottomFreezingCount
41513
41367
  // scrollbarParent
41514
41368
 
41515
- // NOTE: no need to export synapseApiKey and RTK
41369
+ // NOTE: no need to export synapseApiKey, ADC and RTK
41516
41370
 
41517
41371
  return obj;
41518
41372
  };
41519
41373
 
41374
+ /** @public
41375
+ * @ignore
41376
+ * @param {Object} dateTimeUtil
41377
+ */
41378
+ Grid.prototype.setDateTimeUtil = function(dateTimeUtil) {
41379
+ if(this._dateTimeUtil !== dateTimeUtil) {
41380
+ this._dateTimeUtil = dateTimeUtil;
41381
+ this._dateTimeUtil.setLocale(this._lang);
41382
+ }
41383
+ };
41384
+ /** @public
41385
+ * @param {string} lang
41386
+ */
41387
+ Grid.prototype.setLocale = function(lang) {
41388
+ if(lang && this._lang !== lang) {
41389
+ this._lang = lang;
41390
+ this._dateTimeUtil.setLocale(lang);
41391
+ this._grid.requestRowRefresh();
41392
+ }
41393
+ };
41394
+
41520
41395
  /** @private
41521
41396
  * @param {Object} defaultCol
41522
41397
  * @param {Array.<Object>} userColumns
@@ -41622,10 +41497,6 @@ Grid.prototype._onFieldRemoved = function(e) {
41622
41497
  * @param {number=} idx
41623
41498
  */
41624
41499
  Grid.prototype.insertColumn = function (columnOption, idx) {
41625
- if (typeof columnOption === "string") {
41626
- columnOption = { field: columnOption };
41627
- }
41628
-
41629
41500
  var colCount = this.getColumnCount();
41630
41501
  if(idx == null || idx > colCount) {
41631
41502
  idx = colCount;
@@ -41633,19 +41504,93 @@ Grid.prototype.insertColumn = function (columnOption, idx) {
41633
41504
 
41634
41505
  // no need to merge defaultColumn during initialize process
41635
41506
  // because columnOption already mutate by initialize function
41636
- var userOptions = (this._initializing) ? {} : Object(Util["b" /* cloneObject */])(this._defaultColumnOptions);
41637
- Grid._objectAssign(userOptions, columnOption);
41638
- userOptions["formulaEngine"] = this._fnEngine; // Adding extra option
41507
+ var configObj = (this._initializing) ? {} : Object(Util["b" /* cloneObject */])(this._defaultColumnOptions);
41639
41508
 
41640
- var colDef = new ColumnDefinition(userOptions, this);
41641
- userOptions[COL_DEF] = colDef;
41509
+ if (typeof columnOption === "string") {
41510
+ configObj["field"] = columnOption;
41511
+ } else { // columnOption is assumed to be an object
41512
+ for (var key in columnOption) {
41513
+ configObj[key] = columnOption[key];
41514
+ }
41515
+ }
41516
+
41517
+ if(this._fnEngine) {
41518
+ configObj["formulaEngine"] = this._fnEngine; // Adding extra option
41519
+ }
41520
+
41521
+ var colDef = new ColumnDefinition(configObj, this);
41522
+ configObj[COL_DEF] = colDef;
41642
41523
 
41643
41524
  // WARNING: width is processed twice by tr-grid and rt-grid
41644
41525
  // Inserting column also initializes prefined formatter
41645
- this._grid.insertColumn(idx, userOptions); // columnAdded is fired
41526
+ this._grid.insertColumn(idx, configObj); // columnAdded is fired
41646
41527
  };
41647
41528
 
41648
41529
 
41530
+ /** @public
41531
+ * @param {ColumnDefinition~Options|string} columnOption String will be treated as field, while object is treated as the column options
41532
+ * @param {Grid~ColumnReference} colRef
41533
+ */
41534
+ Grid.prototype.replaceColumn = function (columnOption, colRef) {
41535
+ var colIndex = this.getColumnIndex(colRef);
41536
+ if(colIndex < 0) {
41537
+ return;
41538
+ }
41539
+ var colConfig = {};
41540
+ var core = this._grid;
41541
+ var columnDef = core._getColumnDef(colIndex);
41542
+
41543
+ var value = core.getColumnScalability(colIndex);
41544
+ colConfig["scalable"] = value;
41545
+
41546
+ value = core.getColumnCustomLaneSize(colIndex);
41547
+ colConfig["width"] = value;
41548
+
41549
+ value = core.getMinimumColumnWidth(colIndex);
41550
+ if(value !== 32) {
41551
+ colConfig["minWidth"] = value;
41552
+ }
41553
+
41554
+ value = core.isColumnVisible(colIndex);
41555
+ if(!value) {
41556
+ colConfig["hidden"] = true;
41557
+ }
41558
+
41559
+ value = columnDef["stationary"];
41560
+ if (value) {
41561
+ colConfig["stationary"] = value;
41562
+ }
41563
+
41564
+ value = columnDef["leftPinned"];
41565
+ if (value) {
41566
+ colConfig["leftPinned"] = value;
41567
+ }
41568
+
41569
+ value = columnDef["rightPinned"];
41570
+ if (value) {
41571
+ colConfig["rightPinned"] = value;
41572
+ }
41573
+
41574
+ if(typeof columnOption === "string") {
41575
+ colConfig["field"] = columnOption;
41576
+ } else { // type object from user
41577
+ for (var key in columnOption) {
41578
+ colConfig[key] = columnOption[key];
41579
+ }
41580
+ }
41581
+
41582
+ if(columnOption["width"] && !columnOption["scalable"]) {
41583
+ colConfig["scalable"] = false;
41584
+ }
41585
+
41586
+ if(columnOption["scalable"] && !columnOption["width"]) {
41587
+ colConfig["width"] = 1;
41588
+ }
41589
+
41590
+ this.insertColumn(colConfig, colIndex);
41591
+ this.removeColumn(colIndex + 1); // remove existing column after insert
41592
+ };
41593
+
41649
41594
  /** to update column name when field info is loaded
41650
41595
  * @private
41651
41596
  * @param {string} field
@@ -42110,6 +42055,11 @@ Grid.prototype.removeDataFields = function(fieldRef, referrer) {
42110
42055
  * @param {string=} opt_order This can be "ascending", "descending", "none", "noOrder", or "originalOrder"
42111
42056
  */
42112
42057
  Grid.prototype.sortColumn = function(colRef, opt_order) {
42058
+ if(typeof colRef === "string") {
42059
+ this._stp.sortColumn(colRef, opt_order); // Allow sorting by field
42060
+ return;
42061
+ }
42062
+
42113
42063
  var colIndex = this.getColumnIndex(colRef);
42114
42064
  if(colIndex < 0) {
42115
42065
  this._stp.sortColumn(this.getSortedColumnIndex(), "n"); // reset current sorting
@@ -42210,9 +42160,9 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
42210
42160
  if(colDef) {
42211
42161
  colDef.setSorter(func);
42212
42162
 
42213
- var sortedColumn = this.getSortedColumnIndex();
42163
+ var sortedColumn = this.getSortedColumnIndex(); // TODO: Support multi-column sorting
42214
42164
  if(sortedColumn === colIndex) {
42215
- this._columnSorter = colDef.getSorter();
42165
+ this._stp.refresh();
42216
42166
  }
42217
42167
  }
42218
42168
  };
@@ -42254,9 +42204,6 @@ Grid.prototype.insertRow = function(rowOption, rowRef) {
42254
42204
  var rowDef = new RowDefinition(rowOption);
42255
42205
  rowDef.setDataSource(this._dc); // This could also subscribe chain index/ric to JET/RTK
42256
42206
  this._initDuplicateRicData(rowDef);
42257
- if(rowDef.isFixedPosition()) {
42258
- this._hasGroup = true; // HACK: This is temporary solution
42259
- }
42260
42207
 
42261
42208
  rowDef.registerToView(this._dv, this._getRowId(rowRef));
42262
42209
  if(rowOption && rowOption["hidden"]) {
@@ -42301,7 +42248,6 @@ Grid.prototype.insertRows = function(rowOptions, rowRef, opt_fields) {
42301
42248
  }
42302
42249
  this.insertRow(rowOption, rowId); // Note that data view is being frozen, so only using row id will work properly
42303
42250
  }
42304
- this._updateGroupOrder(); // TODO: Update group order for all scenarios
42305
42251
  this._dt.freeze(prevState);
42306
42252
  };
42307
42253
  /** Add multiple rows without `ric` property in {@link RowDefinition}
@@ -43074,7 +43020,7 @@ Grid.prototype.updateColumnTitle = function() {
43074
43020
  * @return {boolean}
43075
43021
  */
43076
43022
  Grid.prototype.isSorting = function() {
43077
- return this.getSortedColumnIndex() >= 0;
43023
+ return this._stp.isSorting();
43078
43024
  };
43079
43025
  /** @public
43080
43026
  * @return {number}
@@ -43091,7 +43037,7 @@ Grid.prototype.getSortOrder = function() {
43091
43037
  /** @public
43092
43038
  */
43093
43039
  Grid.prototype.clearSort = function() {
43094
- this._stp.clearSortState();
43040
+ this._stp.clearSortState(); // WARNING: No event is dispatched
43095
43041
  };
43096
43042
 
43097
43043
  /** @private
@@ -43189,43 +43135,38 @@ Grid.prototype._updateStreamingData = function() {
43189
43135
  this._dt.dispatchGlobalChange();
43190
43136
  }
43191
43137
  };
43138
+
43192
43139
  /** @private
43140
+ * @param {Object} e
43193
43141
  */
43194
- Grid.prototype._updateGroupOrder = function() {
43195
- if(!this._hasGroup) { return; }
43196
- // TODO: Perform re-indexing of the data table, so that both data table and data view has the same index
43197
- // if(this.isSorting()) {
43198
- // this._dt.sortOnce(ROW_DEF, this.getSortOrder());
43199
- // }
43200
- var rowCount = this._dt.getRowCount();
43201
- var groupOrder = 0;
43202
- var dirty = 0;
43203
- var prevParent = null;
43204
- var prevFixedState = false;
43205
- for(var i = 0; i < rowCount; ++i) {
43206
- var rowDef = this._dt.getDataAt(i, ROW_DEF);
43207
- var curParent = rowDef.getParent();
43208
- var curFixedState = rowDef.isFixedPosition();
43209
- if(curFixedState || curFixedState !== prevFixedState || curParent !== prevParent) {
43210
- ++groupOrder;
43142
+ Grid.prototype._onPreDataSorting = function (e) {
43143
+ var field = "";
43144
+ var rowSorting = false;
43145
+ var sortLogic = null;
43146
+
43147
+ var states = this._stp.getSortingStates(); // WARNING: Use of deprecated function
43148
+ var state = states ? states[0] : null; // TODO: Support multi-column sorting
43149
+
43150
+ if(state) {
43151
+ field = state["field"] || "";
43152
+ var colIndex = this._stp.getSortedColumnIndex(0);
43153
+ var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
43154
+ this._sorter.setContext("colIndex", colIndex);
43155
+ this._sorter.setContext("colDef", colDef);
43156
+
43157
+ if(colDef) {
43158
+ field = colDef.getField(); // WARNING: Field and logic could be out of sync
43159
+ sortLogic = colDef.getSorter();
43160
+ rowSorting = colDef.isRowSorting();
43211
43161
  }
43212
- prevParent = curParent;
43213
- prevFixedState = curFixedState;
43214
- dirty |= rowDef.setGroupOrder(groupOrder);
43215
43162
  }
43216
- if(dirty && this.isSorting()){
43217
- this._stp.refresh();
43163
+ if(!sortLogic && field) {
43164
+ sortLogic = state["sortLogic"];
43218
43165
  }
43219
- };
43220
43166
 
43221
- /** @private
43222
- * @param {Object} e
43223
- */
43224
- Grid.prototype._onPreDataSorting = function (e) {
43225
- // TODO: Support multi-column sorting
43226
- var colIndex = this._stp.getSortedColumnIndex();
43227
- var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
43228
- this._columnSorter = (colDef) ? colDef._prepareSortContext(colIndex) : null;
43167
+ this._sorter.setField(field);
43168
+ this._sorter.setSortLogic(sortLogic);
43169
+ this._columnSorter = this._sorter.getSorter(rowSorting);
43229
43170
  };
43230
43171
  /** @private
43231
43172
  * @param {RowDefinition} rowDefA
@@ -43385,6 +43326,9 @@ Grid.prototype._onDataComposed = function(e) {
43385
43326
  if(!rowDef) {
43386
43327
  return;
43387
43328
  }
43329
+ if(!rowDef.getDataSource()) {
43330
+ return; // Somehow, rowDef is invalid and doesn't have data source
43331
+ }
43388
43332
 
43389
43333
  if(this._autoDateConversion) { // auto data conversion
43390
43334
  var field, value, dataType, colDef;
@@ -43410,13 +43354,17 @@ Grid.prototype._onDataComposed = function(e) {
43410
43354
  e["rowDef"] = rowDef;
43411
43355
  this._dispatch("dataComposed", e);
43412
43356
  }
43357
+
43358
+ this._recalculateFormulas(e);
43413
43359
  };
43414
43360
 
43415
43361
  /** @private
43416
43362
  * @param {Object=} e
43417
43363
  */
43418
43364
  Grid.prototype._recalculateFormulas = function(e) {
43419
- if(this._fnEngine.getFormulaCount() <= 0) { return; }
43365
+ if(!this._fnEngine || this._fnEngine.getFormulaCount() <= 0) {
43366
+ return;
43367
+ }
43420
43368
 
43421
43369
  if(e && e["rid"]) {
43422
43370
  this._fnEngine.calculate(/** @type{Object.<string, *>} */ (e["rowData"]), /** @type{Object.<string, *>} */ (e["changes"]));
@@ -43440,6 +43388,64 @@ Grid.prototype._snapshotFillerDataChanged = function (e) {
43440
43388
  for (var ric in data) {
43441
43389
  this.setRicData(ric, data[ric]);
43442
43390
  }
43391
+ if(!this._lastPollingRequest) { // This is the first time we receive successful ADC response
43392
+ this._lastPollingRequest = 1; // Allow polling to be started
43393
+ }
43394
+ this._startPolling();
43395
+ };
43396
+ /** @private
43397
+ */
43398
+ Grid.prototype._startPolling = function () {
43399
+ if(this._pollingEnabled && this._pollingInterval) {
43400
+ if(this._lastPollingRequest && !this._pollingTimerId) {
43401
+ var now = new Date();
43402
+ this._lastPollingRequest = now.getTime();
43403
+ this._pollingTimerId = setTimeout(this._onPollingInterval, this._pollingInterval);
43404
+ }
43405
+ }
43406
+ };
43407
+ /** @private
43408
+ */
43409
+ Grid.prototype._onPollingInterval = function () {
43410
+ this._pollingTimerId = 0;
43411
+ if(this._pollingEnabled && this._pollingInterval) {
43412
+ this.refreshADCData();
43413
+ this._startPolling();
43414
+ }
43415
+ };
43416
+ /** @public
43417
+ * @param {boolean=} activated=true
43418
+ */
43419
+ Grid.prototype.activateADCPolling = function (activated) {
43420
+ if(activated !== false) {
43421
+ this._pollingEnabled = true;
43422
+ // Make immediate request after re-activation if it has been a long time
43423
+ var now = new Date();
43424
+ if(this._lastPollingRequest) {
43425
+ var diff = now.getTime() - this._lastPollingRequest;
43426
+ if(diff > this._pollingInterval) {
43427
+ this.refreshADCData();
43428
+ }
43429
+ }
43430
+ this._startPolling();
43431
+ } else {
43432
+ this._pollingEnabled = false;
43433
+ }
43434
+ };
43435
+ /** Force re-requesting ADC data to immediately update the data
43436
+ * @public
43437
+ * @return {boolean} Return true, if a request has been made
43438
+ */
43439
+ Grid.prototype.refreshADCData = function () {
43440
+ var dirty = this._snapshot.addFields(this._connector.getAllFields());
43441
+ if(dirty) {
43442
+ dirty = this._snapshot.addRics(this._connector.getAllRics());
43443
+ if(dirty) {
43444
+ return true;
43445
+ }
43446
+ }
43447
+ this._lastPollingRequest = 0; // No ADC field or RIC detected. Prevent polling from continuing
43448
+ return false;
43443
43449
  };
43444
43450
 
43445
43451
  /** @private
@@ -43498,17 +43504,6 @@ Grid.prototype._logData = function(rowDefs, options) {
43498
43504
  console.table(tbl); // eslint-disable-line
43499
43505
  };
43500
43506
 
43501
- /** @private
43502
- * @function
43503
- * @param {Object} to
43504
- * @param {Object} from
43505
- */
43506
- Grid._objectAssign = function (to, from) {
43507
- for (var key in from) {
43508
- to[key] = from[key];
43509
- }
43510
- };
43511
-
43512
43507
 
43513
43508
  /* harmony default export */ var js_Grid = (Grid);
43514
43509
 
@@ -46761,7 +46756,7 @@ CellPainter._onThemeChanged = function(colors) {
46761
46756
  */
46762
46757
  CellPainter.loadThemeColors = function() {
46763
46758
  if(!CellPainter.themeReady) {
46764
- CellPainter.themeReady = ElfUtil.getThemeColors().then(CellPainter._onThemeChanged);
46759
+ CellPainter.themeReady = ElfUtil.getThemeColors(CellPainter._onThemeChanged).then(CellPainter._onThemeChanged);
46765
46760
  }
46766
46761
  return CellPainter.themeReady;
46767
46762
  };