@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
@@ -0,0 +1,19 @@
1
+
2
+
3
+ declare class RowDefSorter {
4
+
5
+ constructor();
6
+
7
+ public dispose(): void;
8
+
9
+ public getSorter(rowSorting?: boolean): ((...params: any[]) => any)|null;
10
+
11
+ public setSortLogic(func?: ((...params: any[]) => any)): void;
12
+
13
+ public setField(field: string): void;
14
+
15
+ public setContext(key: string, value: any): void;
16
+
17
+ }
18
+
19
+ export default RowDefSorter;
@@ -0,0 +1,137 @@
1
+ /** @constructor
2
+ */
3
+ var RowDefSorter = function() {
4
+ this._defaultSorter = this._defaultSorter.bind(this);
5
+ this._dataSorter = this._dataSorter.bind(this);
6
+ this._rowDefSorter = this._rowDefSorter.bind(this);
7
+
8
+ this._sortContext = {};
9
+ };
10
+
11
+
12
+ /** @type {string}
13
+ * @private
14
+ */
15
+ RowDefSorter.prototype._field = "";
16
+ /** @type {!Object}
17
+ * @private
18
+ */
19
+ RowDefSorter.prototype._sortContext;
20
+ /** @type {Function}
21
+ * @private
22
+ */
23
+ RowDefSorter.prototype._sortLogic = null;
24
+
25
+
26
+ /** @public
27
+ */
28
+ RowDefSorter.prototype.dispose = function() {
29
+ this._sortLogic = null;
30
+ this._sortContext = {}; // Clear any existing reference
31
+ };
32
+
33
+ /** @public
34
+ * @param {boolean=} rowSorting=false
35
+ * @return {Function}
36
+ */
37
+ RowDefSorter.prototype.getSorter = function(rowSorting) {
38
+ if(this._sortLogic) {
39
+ return rowSorting ? this._rowDefSorter : this._dataSorter;
40
+ } else {
41
+ return this._defaultSorter;
42
+ }
43
+ };
44
+ /** @public
45
+ * @param {Function=} func
46
+ */
47
+ RowDefSorter.prototype.setSortLogic = function(func) {
48
+ this._sortLogic = (typeof func === "function") ? func : null;
49
+ };
50
+
51
+
52
+ /** @public
53
+ * @param {string} field
54
+ */
55
+ RowDefSorter.prototype.setField = function(field) {
56
+ if(!field) {
57
+ field = "";
58
+ }
59
+ this._sortContext["field"] = this._field = field;
60
+ this._sortContext["formattedField"] = field + "_FORMATTED";
61
+ };
62
+ /** @public
63
+ * @param {string} key
64
+ * @param {*} value
65
+ */
66
+ RowDefSorter.prototype.setContext = function(key, value) {
67
+ this._sortContext[key] = value;
68
+ };
69
+
70
+ /** @private
71
+ * @param {RowDefinition} rowDefA
72
+ * @param {RowDefinition} rowDefB
73
+ * @param {number} order
74
+ * @return {number}
75
+ */
76
+ RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
77
+ var orderA = rowDefA.getGroupOrder();
78
+ var orderB = rowDefB.getGroupOrder();
79
+ if(orderA !== orderB) {
80
+ return orderA - orderB; // Regardless of sort order
81
+ }
82
+
83
+ var a = rowDefA.getData(this._field);
84
+ var b = rowDefB.getData(this._field);
85
+
86
+ if(a == null || a !== a) {
87
+ if(b == null || b !== b) {
88
+ return 0;
89
+ }
90
+ return 1;
91
+ }
92
+ if(b == null || b !== b) {
93
+ return -1;
94
+ }
95
+
96
+ if(a < b) {
97
+ return -order;
98
+ }
99
+ if(b < a) {
100
+ return order;
101
+ }
102
+ return 0;
103
+ };
104
+ /** @private
105
+ * @param {RowDefinition} rowDefA
106
+ * @param {RowDefinition} rowDefB
107
+ * @param {number} order
108
+ * @return {number}
109
+ */
110
+ RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
111
+ var orderA = rowDefA.getGroupOrder();
112
+ var orderB = rowDefB.getGroupOrder();
113
+ if(orderA !== orderB) {
114
+ return orderA - orderB; // Regardless of sort order
115
+ }
116
+
117
+ var a = rowDefA.getData(this._field);
118
+ var b = rowDefB.getData(this._field);
119
+ return this._sortLogic(a, b, order, this._sortContext);
120
+ };
121
+ /** @private
122
+ * @param {RowDefinition} rowDefA
123
+ * @param {RowDefinition} rowDefB
124
+ * @param {number} order
125
+ * @return {number}
126
+ */
127
+ RowDefSorter.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
128
+ var orderA = rowDefA.getGroupOrder();
129
+ var orderB = rowDefB.getGroupOrder();
130
+ if(orderA !== orderB) {
131
+ return orderA - orderB; // Regardless of sort order
132
+ }
133
+
134
+ return this._sortLogic(rowDefA, rowDefB, order, this._sortContext);
135
+ };
136
+
137
+ export default RowDefSorter;
@@ -31,12 +31,14 @@ declare class RowDefinition {
31
31
 
32
32
  public getRowId(): string;
33
33
 
34
- public getConfigObject(rowOptions?: RowDefinition.Options): RowDefinition.Options;
34
+ public getConfigObject(rowOptions?: RowDefinition.Options): RowDefinition.Options|null;
35
35
 
36
36
  public getDataId(): string;
37
37
 
38
38
  public setDataSource(dataSource: DataCache): void;
39
39
 
40
+ public getDataSource(): DataCache|null;
41
+
40
42
  public getRowData(): any;
41
43
 
42
44
  public getData(field: string): any;
@@ -57,7 +59,7 @@ declare class RowDefinition {
57
59
 
58
60
  public getDisplayText(): string;
59
61
 
60
- public getLabel(): string|null;
62
+ public getLabel(): string|null|null;
61
63
 
62
64
  public isRowHeader(): boolean;
63
65
 
@@ -81,13 +83,13 @@ declare class RowDefinition {
81
83
 
82
84
  public addUpdate(e: any): boolean;
83
85
 
84
- public getUpdates(): { [key: string]: number };
86
+ public getUpdates(): { [key: string]: number }|null;
85
87
 
86
88
  public resetUpdates(): void;
87
89
 
88
90
  public registerToView(view: DataTable, rowId?: string): void;
89
91
 
90
- public static deregisterFromView(rowIds: (string)[], rowDef: RowDefinition): (string)[];
92
+ public static deregisterFromView(rowIds: (string)[], rowDef: RowDefinition): (string)[]|null;
91
93
 
92
94
  public collapseChain(): boolean;
93
95
 
@@ -95,15 +97,15 @@ declare class RowDefinition {
95
97
 
96
98
  public toggleChain(): boolean;
97
99
 
98
- public getChildren(): (RowDefinition)[];
100
+ public getChildren(): (RowDefinition)[]|null;
99
101
 
100
102
  public getDescendants(ary?: (RowDefinition)[]): (RowDefinition)[];
101
103
 
102
- public getAllDescendantIds(): (string)[];
104
+ public getAllDescendantIds(): (string)[]|null;
103
105
 
104
106
  public getChildCount(): number;
105
107
 
106
- public getParent(): RowDefinition;
108
+ public getParent(): RowDefinition|null;
107
109
 
108
110
  public getDepthLevel(): number;
109
111
 
@@ -363,6 +363,12 @@ RowDefinition.prototype.setDataSource = function(dataSource) {
363
363
  // This will work for runtime row insertion, but not for first initilization.
364
364
  this.subscribeForUpdates();
365
365
  };
366
+ /** @public
367
+ * @return {DataCache} dataSource
368
+ */
369
+ RowDefinition.prototype.getDataSource = function() {
370
+ return this._dc;
371
+ };
366
372
 
367
373
  /** @public
368
374
  * @return {Object} rowData
@@ -1,3 +1,4 @@
1
+ import Grid from "./Grid.js";
1
2
  import {Ext} from "../../tr-grid-util/es6/Ext.js";
2
3
  import {EventDispatcher} from "../../tr-grid-util/es6/EventDispatcher.js";
3
4
 
@@ -7,11 +8,15 @@ declare class SnapshotFiller extends EventDispatcher {
7
8
 
8
9
  public setRTK(rtk: any): void;
9
10
 
11
+ public setADCOptions(adcOptions: Grid.ADCOptions): void;
12
+
10
13
  public addRic(ric: string): void;
11
14
 
15
+ public addRics(rics: (string)[]): boolean;
16
+
12
17
  public addField(str: string): void;
13
18
 
14
- public addFields(fields: (string)[]): void;
19
+ public addFields(fields: (string)[]): boolean;
15
20
 
16
21
  public static isValidField(str: string): boolean;
17
22
 
@@ -1,3 +1,5 @@
1
+ /* eslint-disable */
2
+ import Grid from "./Grid.js";
1
3
  import {Ext} from "../../tr-grid-util/es6/Ext.js";
2
4
  import {EventDispatcher} from "../../tr-grid-util/es6/EventDispatcher.js";
3
5
 
@@ -21,6 +23,9 @@ var SnapshotFiller = function () {
21
23
 
22
24
  this._rics = {};
23
25
  this._fields = {};
26
+ this._adcOptions = { // TODO: support requesting level parameter
27
+ productId: "001"
28
+ };
24
29
  };
25
30
  Ext.inherits(SnapshotFiller, EventDispatcher);
26
31
 
@@ -41,6 +46,10 @@ SnapshotFiller.prototype._fields;
41
46
  * @private
42
47
  */
43
48
  SnapshotFiller.prototype._rtk;
49
+ /** @type {!Grid~ADCOptions}
50
+ * @private
51
+ */
52
+ SnapshotFiller.prototype._adcOptions = null;
44
53
  //#endregion Private Members
45
54
 
46
55
  /** @public
@@ -50,6 +59,26 @@ SnapshotFiller.prototype.setRTK = function (rtk) {
50
59
  this._rtk = rtk;
51
60
  };
52
61
 
62
+ /** @public
63
+ * @param {Grid~ADCOptions} adcOptions ADC requesting level parameter options
64
+ */
65
+ SnapshotFiller.prototype.setADCOptions = function (adcOptions) {
66
+
67
+ var val = adcOptions["productId"];
68
+ if(val) {
69
+ this._adcOptions.productId = val;
70
+ }
71
+ // TODO: support requesting level parameter https://confluence.refinitiv.com/display/ADC/Request+level+parameters
72
+ // var val = adcOptions["lang"];
73
+ // if(val) {
74
+ // this._adcOptions.lang = val;
75
+ // }
76
+ // var val = adcOptions["cache"];
77
+ // if(val) {
78
+ // this._adcOptions.cache = val;
79
+ // }
80
+ };
81
+
53
82
  /** @public
54
83
  * @param {string} ric
55
84
  */
@@ -68,6 +97,26 @@ SnapshotFiller.prototype.addRic = function (ric) {
68
97
  }
69
98
  };
70
99
  /** @public
100
+ * @param {Array.<string>} rics
101
+ * @return {boolean}
102
+ */
103
+ SnapshotFiller.prototype.addRics = function (rics) {
104
+ var len = rics ? rics.length : 0;
105
+ var dirty = false;
106
+ for(var i = 0; i < len; ++i) {
107
+ var ric = rics[i];
108
+ if (ric && !this._rics[ric]) {
109
+ this._rics[ric] = 1;
110
+ dirty = true;
111
+ }
112
+ }
113
+ if(dirty) {
114
+ this._request();
115
+ return true;
116
+ }
117
+ return false;
118
+ };
119
+ /** @public
71
120
  * @param {string} str
72
121
  */
73
122
  SnapshotFiller.prototype.addField = function (str) {
@@ -77,6 +126,7 @@ SnapshotFiller.prototype.addField = function (str) {
77
126
  };
78
127
  /** @public
79
128
  * @param {Array.<string>} fields
129
+ * @return {boolean}
80
130
  */
81
131
  SnapshotFiller.prototype.addFields = function (fields) {
82
132
  var len = fields.length;
@@ -86,7 +136,9 @@ SnapshotFiller.prototype.addFields = function (fields) {
86
136
  }
87
137
  if(dirty) {
88
138
  this._request();
139
+ return true;
89
140
  }
141
+ return false;
90
142
  };
91
143
 
92
144
  /** @private
@@ -144,29 +196,37 @@ SnapshotFiller.prototype._onRequest = function () {
144
196
  return;
145
197
  }
146
198
 
147
- var reqFields = [];
148
- for(i = 0; i < fieldLen; i++) {
149
- reqFields.push({ "name": fields[i] });
150
- }
151
-
152
199
  // Clean up members, preparing for the next request
153
200
  this._rics = {};
154
201
  this._fields = {};
155
202
 
156
- var payload = {
157
- "instruments": instruments,
158
- "fields": reqFields
159
- };
160
-
161
- var onSuccess = this._onSuccess.bind(this, fields);
203
+ var onSuccess, payload;
162
204
  if (this._rtk) {
163
- this._rtk.Data.DataGrid
205
+ var strFields = fields.join(',');
206
+ payload = {
207
+ "method": "select",
208
+ "formula": strFields,
209
+ "identifiers": instruments,
210
+ "productId": this._adcOptions.productId,
211
+ "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"
212
+ };
213
+ onSuccess = this._onRTKSuccess.bind(this, fields);
214
+ this._rtk.Data.Adc
164
215
  .request(payload)
165
216
  .then(onSuccess)
166
217
  .catch(function (err) {
167
218
  console.log(err);
168
219
  });
169
220
  } else {
221
+ var reqFields = [];
222
+ for(i = 0; i < fieldLen; i++) {
223
+ reqFields.push({ "name": fields[i] });
224
+ }
225
+ payload = {
226
+ "instruments": instruments,
227
+ "fields": reqFields
228
+ };
229
+ onSuccess = this._onJETSuccess.bind(this, fields);
170
230
  jet["Data"]("datagrid")
171
231
  .then(function (service) { return service["request"](payload); })
172
232
  .then(JSON.parse)
@@ -182,16 +242,15 @@ SnapshotFiller.prototype._onRequest = function () {
182
242
  * @param {Array.<string>} fields
183
243
  * @param {string} serverResult
184
244
  */
185
- SnapshotFiller.prototype._onSuccess = function (fields, serverResult) {
245
+ SnapshotFiller.prototype._onJETSuccess = function (fields, serverResult) {
246
+ this._dispatch("adcDataReceived", serverResult);
186
247
  var data2D = serverResult["data"];
187
248
  var svHeaders = serverResult["headers"] && serverResult["headers"][0];
188
249
 
189
250
  if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
190
- console.log("Invalid server response detected");
191
251
  return; //TODO: Return Promise.reject(errMsg);
192
252
  }
193
253
 
194
- this._dispatch("adcDataReceived", serverResult);
195
254
 
196
255
  // Server will return field only in UPPERCASE
197
256
  // ex. requestField = TR.Volume ===> serverField = TR.VOLUME
@@ -248,5 +307,75 @@ SnapshotFiller.prototype._onSuccess = function (fields, serverResult) {
248
307
  });
249
308
  };
250
309
 
310
+ /** @private
311
+ * @function
312
+ * @param {Array.<string>} fields
313
+ * @param {string} serverResult
314
+ */
315
+ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
316
+ this._dispatch("adcDataReceived", serverResult);
317
+ var data2D = serverResult["rows"];
318
+ var svHeaders = serverResult["rows"] && serverResult["rows"][0];
319
+ if (!Array.isArray(data2D) || !Array.isArray(svHeaders)) {
320
+ return; //TODO: Return Promise.reject(errMsg);
321
+ }
322
+
323
+ // Server will return field only in UPPERCASE
324
+ // ex. requestField = TR.Volume ===> serverField = TR.VOLUME
325
+ // so we need convert UPPERCASE to be original
326
+ var i, field, ric;
327
+ var j = 1; // to skip instrument index, use j = 1
328
+ var fLength = fields.length;
329
+ var hLength = svHeaders.length;
330
+ var headers = new Array(hLength);
331
+ for (i = 0; i < fLength && j < hLength; i++) {
332
+ field = fields[i];
333
+ if (svHeaders[j].r.toUpperCase() === field.toUpperCase()) {
334
+ headers[j] = field;
335
+ j++;
336
+ }
337
+ }
338
+
339
+ var len = data2D.length;
340
+ var fieldLen = headers.length;
341
+ var ricMap = {};
342
+
343
+ // TODO: Freeze the data view before setting multiple data
344
+ for (i = 1; i < len; i++) { // to skip column header index, use i = 1
345
+ var dataRow = data2D[i];
346
+ ric = dataRow[0];
347
+
348
+ var snapData = ricMap[ric] = {};
349
+
350
+ // loop for create rowData for update
351
+ for (j = 1; j < fieldLen; j++) { // to skip instrument index, use j = 1
352
+ var value = dataRow[j];
353
+ if (value != null && value !== "") {
354
+ if(typeof value !== 'object') {
355
+ field = headers[j];
356
+ snapData[field] = value;
357
+ }
358
+ // TODO : handled when a cell has a mistake and the value appears as {f: "1"} ( description error in fault attribute at index 1 ),
359
+ // Therefore, we need to store information to the error field for this cell.
360
+ // else {}
361
+
362
+ }
363
+ }
364
+ }
365
+
366
+ // return result only ric that has update data
367
+ var updatedData = {};
368
+ for (ric in ricMap) {
369
+ var obj = ricMap[ric];
370
+ if (!isEmptyObject(obj)) {
371
+ updatedData[ric] = obj;
372
+ }
373
+ }
374
+
375
+ this._dispatch("dataChanged", {
376
+ data: updatedData
377
+ });
378
+ };
379
+
251
380
  export { SnapshotFiller };
252
381
  export default SnapshotFiller;
@@ -1,7 +1,7 @@
1
1
  import {Ext} from '../../tr-grid-util/es6/Ext.js';
2
2
  import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
3
3
  import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
4
- import {injectCss, prettifyCss, extendObject} from "../../tr-grid-util/es6/Util.js";
4
+ import {injectCss, prettifyCss} from "../../tr-grid-util/es6/Util.js";
5
5
 
6
6
  declare namespace CheckboxPlugin {
7
7
 
@@ -12,7 +12,8 @@ declare namespace CheckboxPlugin {
12
12
  checkboxCreated?: ((...params: any[]) => any),
13
13
  checkboxBinding?: ((...params: any[]) => any),
14
14
  clicked?: ((...params: any[]) => any),
15
- width?: number
15
+ width?: number,
16
+ topCheckboxHandler?: boolean
16
17
  };
17
18
 
18
19
  type ColumnOptions = {
@@ -41,7 +42,7 @@ declare class CheckboxPlugin extends GridPlugin {
41
42
 
42
43
  public getDisplayColumn(): number;
43
44
 
44
- public getCheckbox(sectionRef: any, rowIndex: number): Element;
45
+ public getCheckbox(sectionRef: any, rowIndex: number): Element|null;
45
46
 
46
47
  public selectAll(): void;
47
48
 
@@ -1,7 +1,7 @@
1
1
  import {Ext} from '../../tr-grid-util/es6/Ext.js';
2
2
  import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
3
3
  import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
4
- import {injectCss, prettifyCss, extendObject} from "../../tr-grid-util/es6/Util.js";
4
+ import {injectCss, prettifyCss} from "../../tr-grid-util/es6/Util.js";
5
5
 
6
6
  /** @typedef {Object} CheckboxPlugin~Options
7
7
  * @description Available options describing `checkbox` object specified in grid's option
@@ -12,6 +12,7 @@ import {injectCss, prettifyCss, extendObject} from "../../tr-grid-util/es6/Util.
12
12
  * @property {Function=} checkboxBinding=null Function handler for checkboxBinding event
13
13
  * @property {Function=} clicked=null Function handler for checkbox clicked event
14
14
  * @property {number=} width=34 Width for checkbox column
15
+ * @property {boolean=} topCheckboxHandler=true If disabled, when clicked on header row checkbox it will not perform default behavior
15
16
  */
16
17
 
17
18
  /** @typedef {Object} CheckboxPlugin~ColumnOptions
@@ -103,6 +104,10 @@ CheckboxPlugin.prototype._disablingField = "CHECK_BOX_DISABLED";
103
104
  * @private
104
105
  */
105
106
  CheckboxPlugin.prototype._autoRowSelection = false;
107
+ /** @type {boolean}
108
+ * @private
109
+ */
110
+ CheckboxPlugin.prototype._topCheckboxHandler = true;
106
111
  /** @type {Function}
107
112
  * @private
108
113
  */
@@ -121,9 +126,11 @@ CheckboxPlugin._styles = prettifyCss([
121
126
  ".tr-checkbox-column input[type='checkbox'], .tr-checkbox-column input+label", [
122
127
  "cursor: pointer;"
123
128
  ],
124
- ".column.tr-checkbox-column .cell", [
125
- "padding: 0;",
126
- "text-align: center;"
129
+ ".column.tr-checkbox-column.tr-align-left .cell", [
130
+ "text-align: left;"
131
+ ],
132
+ ".column.tr-checkbox-column.tr-align-right .cell", [
133
+ "text-align: right;"
127
134
  ]
128
135
  ]);
129
136
  /** @private
@@ -348,6 +355,10 @@ CheckboxPlugin.prototype.config = function (options) {
348
355
  if(val) {
349
356
  this._width = val;
350
357
  }
358
+ val = chkboxOpt["topCheckboxHandler"];
359
+ if(val != null) {
360
+ this._topCheckboxHandler = val ? true : false;
361
+ }
351
362
 
352
363
  this.addListener(chkboxOpt, "checkboxCreated");
353
364
  this.addListener(chkboxOpt, "clicked");
@@ -437,31 +448,30 @@ CheckboxPlugin.prototype.beforeInit = function(elem, config, runTime) {
437
448
  }
438
449
  }
439
450
 
440
- var chbxCol = t._genCheckboxColumn();
441
- var checkboxIdx = t._userCheckboxIdx = t._findCheckboxColumnIndexFromConfig(columns);
442
-
443
- if (checkboxIdx >= 0) {
444
- // WARNING:: User column config will be deleted here since we swap user column with our generated checkbox column
445
- extendObject(columns[checkboxIdx], chbxCol);
451
+ t._userCheckboxIdx = t._findCheckboxColumnIndexFromConfig(columns);
452
+ if (t._userCheckboxIdx >= 0) {
453
+ t._genCheckboxColumn(columns[t._userCheckboxIdx]);
446
454
  } else {
447
- checkboxIdx = t._userCheckboxIdx = 0;
448
- columns.unshift(chbxCol);
455
+ columns.unshift(t._genCheckboxColumn());
456
+ t._userCheckboxIdx = 0; // TODO: This _userCheckboxIdx has some misleading meaning
449
457
  }
450
458
  };
451
459
 
452
460
  /** @private
453
- * @return {Object} checkbox column config
461
+ * @param {Object=} userObj
462
+ * @return {!Object} checkbox column config
454
463
  */
455
- CheckboxPlugin.prototype._genCheckboxColumn = function () {
456
- return {
457
- autoGenerated: true,
464
+ CheckboxPlugin.prototype._genCheckboxColumn = function (userObj) {
465
+ var defaultObj = {
458
466
  width: this._width,
459
467
  sortable: false,
460
468
  className: "tr-checkbox-column", // For rt-grid
461
469
  classes: { "tr-checkbox-column": 1 }, // For composite grid
462
470
  noResizing: true, // ColumnResizing Extension
463
471
  resizable: false, // ResizableTitlePlugin
464
- headerRenderer: this._onPreSectionRender, // rt-grid support
472
+ title: "",
473
+ tooltip: "",
474
+ // headerRenderer: CheckboxPlugin._emptyFunc, // rt-grid support
465
475
  filterInput: { disabled: true },
466
476
  field: this._checkboxField,
467
477
  notRealTimeField: true, // Checkbox column is not a real-time field
@@ -473,6 +483,26 @@ CheckboxPlugin.prototype._genCheckboxColumn = function () {
473
483
  bind: CheckboxPlugin._emptyFunc
474
484
  }
475
485
  };
486
+
487
+ if(userObj && !userObj.autoGenerated) {
488
+ if(userObj.field && this._checkboxField === "CHECK_BOX") {
489
+ this._checkboxField = userObj.field;
490
+ }
491
+ if(userObj.width && this._width === 34) {
492
+ this._width = +userObj.width;
493
+ }
494
+
495
+ for(var key in defaultObj) {
496
+ var userVal = userObj[key];
497
+ if(userVal == null) {
498
+ userObj[key] = defaultObj[key];
499
+ }
500
+ }
501
+ return userObj;
502
+ }
503
+
504
+ defaultObj.autoGenerated = true;
505
+ return defaultObj;
476
506
  };
477
507
 
478
508
  /** @private
@@ -606,9 +636,6 @@ CheckboxPlugin.prototype._createCheckbox = function (sectionSettings, colIndex,
606
636
 
607
637
  cell.setContent(chkbox);
608
638
  var sectionType = sectionSettings.getType();
609
- if(sectionType == "title") {
610
- cell.enableClass("no-sort");
611
- }
612
639
 
613
640
  if(!this._coralCheckboxVer) { // Workaround for UIFR theme styling
614
641
  var lbl = document.createElement("label");
@@ -695,7 +722,7 @@ CheckboxPlugin.prototype.setAllCheckStates = function (checked) {
695
722
  * @see {@link CheckboxPlugin#checkAll}
696
723
  */
697
724
  CheckboxPlugin.prototype.selectAllPages = function (checked) {
698
- var state = CheckboxPlugin._toCheckState(checked != null ? checked : true);
725
+ var state = checked != null ? checked : true;
699
726
  var host = this._hosts[0];
700
727
  var dv = host ? host.getDataSource() : null;
701
728
 
@@ -982,6 +1009,9 @@ CheckboxPlugin.prototype._getAllCheckboxes = function (sectionSettings, ary) {
982
1009
  * @param {string} state
983
1010
  */
984
1011
  CheckboxPlugin.prototype._setDescendantCheckState = function (sectionSettings, state) {
1012
+ if(!this._topCheckboxHandler){
1013
+ return;
1014
+ }
985
1015
  var children = sectionSettings.getChildren();
986
1016
  if (children) {
987
1017
  for (var i = 0; i < children.length; ++i) {