@refinitiv-ui/efx-grid 6.0.3 → 6.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) 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/core/dist/core.css +1 -1
  6. package/lib/core/dist/core.js +389 -1070
  7. package/lib/core/dist/core.min.js +1 -1
  8. package/lib/core/es6/data/ColumnStats.d.ts +2 -2
  9. package/lib/core/es6/data/DataCache.d.ts +4 -4
  10. package/lib/core/es6/data/DataTable.d.ts +5 -5
  11. package/lib/core/es6/data/DataTable.js +1 -1
  12. package/lib/core/es6/data/DataView.d.ts +12 -12
  13. package/lib/core/es6/data/SegmentCollection.d.ts +3 -3
  14. package/lib/core/es6/data/WrappedView.d.ts +13 -13
  15. package/lib/core/es6/grid/Core.d.ts +29 -27
  16. package/lib/core/es6/grid/Core.js +26 -4
  17. package/lib/core/es6/grid/ILayoutGrid.d.ts +15 -15
  18. package/lib/core/es6/grid/LayoutGrid.js +54 -26
  19. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +66 -0
  20. package/lib/core/es6/grid/components/Cell.d.ts +4 -4
  21. package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +1 -1
  22. package/lib/core/es6/grid/components/CellSpans.d.ts +8 -8
  23. package/lib/core/es6/grid/components/Column.d.ts +1 -1
  24. package/lib/core/es6/grid/components/ElementWrapper.d.ts +6 -6
  25. package/lib/core/es6/grid/components/Scrollbar.d.ts +1 -1
  26. package/lib/core/es6/grid/components/StretchedCells.js +2 -2
  27. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +14 -6
  28. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +147 -81
  29. package/lib/core/es6/grid/util/Conflator.d.ts +2 -2
  30. package/lib/core/es6/grid/util/ElementFrameWork.d.ts +3 -3
  31. package/lib/core/es6/grid/util/HttpRequest.d.ts +2 -2
  32. package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +1 -1
  33. package/lib/core/es6/grid/util/RangeBar.d.ts +1 -1
  34. package/lib/core/es6/grid/util/SectionSettings.d.ts +5 -5
  35. package/lib/core/es6/grid/util/SectionSettings.js +5 -0
  36. package/lib/core/es6/grid/util/SelectionList.d.ts +2 -2
  37. package/lib/core/es6/grid/util/TrackLayout.d.ts +7 -3
  38. package/lib/core/es6/grid/util/TrackLayout.js +27 -0
  39. package/lib/core/es6/grid/util/util.d.ts +2 -2
  40. package/lib/core/es6/index.d.ts +1 -5
  41. package/lib/core/es6/index.js +1 -7
  42. package/lib/core/es6/tr-grid-theme.js +1 -1
  43. package/lib/filter-dialog/lib/filter-dialog.d.ts +1 -0
  44. package/lib/filter-dialog/lib/filter-dialog.js +73 -26
  45. package/lib/filter-dialog/themes/base-checkbox.less +8 -1
  46. package/lib/filter-dialog/themes/base.less +69 -1
  47. package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
  48. package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
  49. package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
  50. package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
  51. package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +2 -2
  52. package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
  53. package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
  54. package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +2 -2
  55. package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
  56. package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
  57. package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +2 -2
  58. package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
  59. package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
  60. package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +2 -2
  61. package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
  62. package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
  63. package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +2 -2
  64. package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
  65. package/lib/grid/lib/efx-grid.d.ts +8 -5
  66. package/lib/grid/lib/efx-grid.js +10 -4
  67. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  68. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  69. package/lib/grid/themes/halo/efx-grid.less +33 -39
  70. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  71. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  72. package/lib/index.d.ts +2 -0
  73. package/lib/index.js +2 -0
  74. package/lib/row-segmenting/es6/RowSegmenting.d.ts +7 -2
  75. package/lib/row-segmenting/es6/RowSegmenting.js +94 -9
  76. package/lib/rt-grid/dist/rt-grid.js +567 -1171
  77. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  78. package/lib/rt-grid/es6/ColumnDefinition.d.ts +5 -3
  79. package/lib/rt-grid/es6/ColumnDefinition.js +17 -108
  80. package/lib/rt-grid/es6/DataConnector.d.ts +3 -3
  81. package/lib/rt-grid/es6/Grid.d.ts +17 -9
  82. package/lib/rt-grid/es6/Grid.js +201 -101
  83. package/lib/rt-grid/es6/RowDefSorter.d.ts +19 -0
  84. package/lib/rt-grid/es6/RowDefSorter.js +137 -0
  85. package/lib/rt-grid/es6/RowDefinition.d.ts +9 -7
  86. package/lib/rt-grid/es6/RowDefinition.js +6 -0
  87. package/lib/rt-grid/es6/SnapshotFiller.d.ts +3 -1
  88. package/lib/rt-grid/es6/SnapshotFiller.js +23 -0
  89. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -2
  90. package/lib/tr-grid-checkbox/es6/Checkbox.js +38 -20
  91. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +46 -9
  92. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +8 -4
  93. package/lib/tr-grid-column-stack/es6/ColumnStack.js +240 -125
  94. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +1 -1
  95. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +18 -12
  96. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +7 -4
  97. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +93 -2
  98. package/lib/tr-grid-printer/es6/CellWriter.d.ts +3 -3
  99. package/lib/tr-grid-printer/es6/GridPrinter.d.ts +1 -1
  100. package/lib/tr-grid-printer/es6/GridPrinter.js +26 -13
  101. package/lib/tr-grid-printer/es6/PrintTrait.d.ts +2 -2
  102. package/lib/tr-grid-printer/es6/SectionWriter.d.ts +3 -3
  103. package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +2 -1
  104. package/lib/tr-grid-row-dragging/es6/RowDragging.js +29 -143
  105. package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +7 -2
  106. package/lib/tr-grid-row-grouping/es6/RowGrouping.js +97 -7
  107. package/lib/tr-grid-row-selection/es6/RowSelection.js +10 -0
  108. package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +1 -1
  109. package/lib/tr-grid-textformatting/es6/TextFormatting.js +12 -0
  110. package/lib/tr-grid-util/es6/DragUI.d.ts +16 -0
  111. package/lib/tr-grid-util/es6/DragUI.js +214 -0
  112. package/lib/tr-grid-util/es6/ElementObserver.d.ts +2 -0
  113. package/lib/tr-grid-util/es6/ElementObserver.js +28 -1
  114. package/lib/tr-grid-util/es6/ElfUtil.js +1 -1
  115. package/lib/tr-grid-util/es6/FieldFormatter.js +7 -5
  116. package/lib/tr-grid-util/es6/GridPlugin.js +8 -4
  117. package/lib/tr-grid-util/es6/NumberFormatter.d.ts +2 -0
  118. package/lib/tr-grid-util/es6/NumberFormatter.js +64 -19
  119. package/lib/tr-grid-util/es6/RowPainter.js +41 -11
  120. package/lib/tr-grid-util/es6/formula/Formula.js +9 -1
  121. package/lib/types/es6/Checkbox.d.ts +2 -2
  122. package/lib/types/es6/ColumnStack.d.ts +8 -4
  123. package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +3 -2
  124. package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +2 -1
  125. package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +20 -18
  126. package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +2 -1
  127. package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +3 -2
  128. package/lib/types/es6/CompositeGrid/Plugin.d.ts +28 -0
  129. package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +2 -1
  130. package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +5 -4
  131. package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +2 -1
  132. package/lib/types/es6/CompositeGrid/index.d.ts +9 -9
  133. package/lib/types/es6/ConditionalColoring.d.ts +1 -1
  134. package/lib/types/es6/Core/data/ColumnStats.d.ts +2 -2
  135. package/lib/types/es6/Core/data/DataCache.d.ts +4 -4
  136. package/lib/types/es6/Core/data/DataTable.d.ts +5 -5
  137. package/lib/types/es6/Core/data/DataView.d.ts +12 -12
  138. package/lib/types/es6/Core/data/SegmentCollection.d.ts +3 -3
  139. package/lib/types/es6/Core/data/WrappedView.d.ts +13 -13
  140. package/lib/types/es6/Core/grid/Core.d.ts +29 -27
  141. package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +15 -15
  142. package/lib/types/es6/Core/grid/components/Cell.d.ts +4 -4
  143. package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +1 -1
  144. package/lib/types/es6/Core/grid/components/CellSpans.d.ts +8 -8
  145. package/lib/types/es6/Core/grid/components/Column.d.ts +1 -1
  146. package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +6 -6
  147. package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +1 -1
  148. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +14 -6
  149. package/lib/types/es6/Core/grid/util/Conflator.d.ts +2 -2
  150. package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +3 -3
  151. package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +2 -2
  152. package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +1 -1
  153. package/lib/types/es6/Core/grid/util/RangeBar.d.ts +1 -1
  154. package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +5 -5
  155. package/lib/types/es6/Core/grid/util/SelectionList.d.ts +2 -2
  156. package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +7 -3
  157. package/lib/types/es6/Core/grid/util/util.d.ts +2 -2
  158. package/lib/types/es6/Core/index.d.ts +1 -5
  159. package/lib/types/es6/ExtensionOptions.d.ts +2 -0
  160. package/lib/types/es6/InCellEditing.d.ts +7 -4
  161. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +5 -3
  162. package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +3 -3
  163. package/lib/types/es6/RealtimeGrid/Grid.d.ts +17 -9
  164. package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +19 -0
  165. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +9 -7
  166. package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +3 -1
  167. package/lib/types/es6/RowDragging.d.ts +2 -1
  168. package/lib/types/es6/RowGrouping.d.ts +7 -2
  169. package/lib/types/es6/RowSegmenting.d.ts +7 -2
  170. package/lib/types/es6/TextFormatting.d.ts +1 -1
  171. package/lib/versions.json +14 -13
  172. package/package.json +1 -1
  173. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
  174. package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.js +0 -615
  175. package/lib/core/es6/grid/plugins/Plugin.d.ts +0 -28
  176. package/lib/core/es6/grid/plugins/Plugin.js +0 -272
  177. package/lib/types/es6/Core/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
  178. package/lib/types/es6/Core/grid/plugins/Plugin.d.ts +0 -28
@@ -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
@@ -9,9 +9,11 @@ declare class SnapshotFiller extends EventDispatcher {
9
9
 
10
10
  public addRic(ric: string): void;
11
11
 
12
+ public addRics(rics: (string)[]): boolean;
13
+
12
14
  public addField(str: string): void;
13
15
 
14
- public addFields(fields: (string)[]): void;
16
+ public addFields(fields: (string)[]): boolean;
15
17
 
16
18
  public static isValidField(str: string): boolean;
17
19
 
@@ -68,6 +68,26 @@ SnapshotFiller.prototype.addRic = function (ric) {
68
68
  }
69
69
  };
70
70
  /** @public
71
+ * @param {Array.<string>} rics
72
+ * @return {boolean}
73
+ */
74
+ SnapshotFiller.prototype.addRics = function (rics) {
75
+ var len = rics ? rics.length : 0;
76
+ var dirty = false;
77
+ for(var i = 0; i < len; ++i) {
78
+ var ric = rics[i];
79
+ if (ric && !this._rics[ric]) {
80
+ this._rics[ric] = 1;
81
+ dirty = true;
82
+ }
83
+ }
84
+ if(dirty) {
85
+ this._request();
86
+ return true;
87
+ }
88
+ return false;
89
+ };
90
+ /** @public
71
91
  * @param {string} str
72
92
  */
73
93
  SnapshotFiller.prototype.addField = function (str) {
@@ -77,6 +97,7 @@ SnapshotFiller.prototype.addField = function (str) {
77
97
  };
78
98
  /** @public
79
99
  * @param {Array.<string>} fields
100
+ * @return {boolean}
80
101
  */
81
102
  SnapshotFiller.prototype.addFields = function (fields) {
82
103
  var len = fields.length;
@@ -86,7 +107,9 @@ SnapshotFiller.prototype.addFields = function (fields) {
86
107
  }
87
108
  if(dirty) {
88
109
  this._request();
110
+ return true;
89
111
  }
112
+ return false;
90
113
  };
91
114
 
92
115
  /** @private
@@ -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
 
@@ -42,7 +42,7 @@ declare class CheckboxPlugin extends GridPlugin {
42
42
 
43
43
  public getDisplayColumn(): number;
44
44
 
45
- public getCheckbox(sectionRef: any, rowIndex: number): Element;
45
+ public getCheckbox(sectionRef: any, rowIndex: number): Element|null;
46
46
 
47
47
  public selectAll(): void;
48
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
@@ -126,9 +126,11 @@ CheckboxPlugin._styles = prettifyCss([
126
126
  ".tr-checkbox-column input[type='checkbox'], .tr-checkbox-column input+label", [
127
127
  "cursor: pointer;"
128
128
  ],
129
- ".column.tr-checkbox-column .cell", [
130
- "padding: 0;",
131
- "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;"
132
134
  ]
133
135
  ]);
134
136
  /** @private
@@ -446,31 +448,30 @@ CheckboxPlugin.prototype.beforeInit = function(elem, config, runTime) {
446
448
  }
447
449
  }
448
450
 
449
- var chbxCol = t._genCheckboxColumn();
450
- var checkboxIdx = t._userCheckboxIdx = t._findCheckboxColumnIndexFromConfig(columns);
451
-
452
- if (checkboxIdx >= 0) {
453
- // WARNING:: User column config will be deleted here since we swap user column with our generated checkbox column
454
- extendObject(columns[checkboxIdx], chbxCol);
451
+ t._userCheckboxIdx = t._findCheckboxColumnIndexFromConfig(columns);
452
+ if (t._userCheckboxIdx >= 0) {
453
+ t._genCheckboxColumn(columns[t._userCheckboxIdx]);
455
454
  } else {
456
- checkboxIdx = t._userCheckboxIdx = 0;
457
- columns.unshift(chbxCol);
455
+ columns.unshift(t._genCheckboxColumn());
456
+ t._userCheckboxIdx = 0; // TODO: This _userCheckboxIdx has some misleading meaning
458
457
  }
459
458
  };
460
459
 
461
460
  /** @private
462
- * @return {Object} checkbox column config
461
+ * @param {Object=} userObj
462
+ * @return {!Object} checkbox column config
463
463
  */
464
- CheckboxPlugin.prototype._genCheckboxColumn = function () {
465
- return {
466
- autoGenerated: true,
464
+ CheckboxPlugin.prototype._genCheckboxColumn = function (userObj) {
465
+ var defaultObj = {
467
466
  width: this._width,
468
467
  sortable: false,
469
468
  className: "tr-checkbox-column", // For rt-grid
470
469
  classes: { "tr-checkbox-column": 1 }, // For composite grid
471
470
  noResizing: true, // ColumnResizing Extension
472
471
  resizable: false, // ResizableTitlePlugin
473
- headerRenderer: this._onPreSectionRender, // rt-grid support
472
+ title: "",
473
+ tooltip: "",
474
+ // headerRenderer: CheckboxPlugin._emptyFunc, // rt-grid support
474
475
  filterInput: { disabled: true },
475
476
  field: this._checkboxField,
476
477
  notRealTimeField: true, // Checkbox column is not a real-time field
@@ -482,6 +483,26 @@ CheckboxPlugin.prototype._genCheckboxColumn = function () {
482
483
  bind: CheckboxPlugin._emptyFunc
483
484
  }
484
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;
485
506
  };
486
507
 
487
508
  /** @private
@@ -615,9 +636,6 @@ CheckboxPlugin.prototype._createCheckbox = function (sectionSettings, colIndex,
615
636
 
616
637
  cell.setContent(chkbox);
617
638
  var sectionType = sectionSettings.getType();
618
- if(sectionType == "title") {
619
- cell.enableClass("no-sort");
620
- }
621
639
 
622
640
  if(!this._coralCheckboxVer) { // Workaround for UIFR theme styling
623
641
  var lbl = document.createElement("label");
@@ -34,6 +34,7 @@ var ColumnSelectionPlugin = function ColumnSelectionPlugin(options) {
34
34
  t._onMouseDown = t._onMouseDown.bind(t);
35
35
  t._onKeyDown = t._onKeyDown.bind(t);
36
36
  t._onColumnRemoved = t._onColumnRemoved.bind(t);
37
+ t._onColumnAdded = t._onColumnAdded.bind(t);
37
38
  t._onReselection = t._onReselection.bind(t);
38
39
  t._onThemeLoaded = t._onThemeLoaded.bind(t);
39
40
  t._onColumnPositionChanged = t._onColumnPositionChanged.bind(t);
@@ -93,7 +94,12 @@ ColumnSelectionPlugin.prototype._timerMenuId = 0;
93
94
  * @private
94
95
  */
95
96
 
96
- ColumnSelectionPlugin.prototype._pendingSelection = -1;
97
+ ColumnSelectionPlugin.prototype._pendingSelectionOnAdded = -1;
98
+ /** @type {Function}
99
+ * @private
100
+ */
101
+
102
+ ColumnSelectionPlugin.prototype._pendingSelectionOnRemoved = -1;
97
103
  /** @type {Function}
98
104
  * @private
99
105
  */
@@ -142,6 +148,7 @@ ColumnSelectionPlugin.prototype.initialize = function (host, options) {
142
148
  host.listen("mousedown", this._onMouseDown);
143
149
  host.listen("keydown", this._onKeyDown);
144
150
  host.listen("columnRemoved", this._onColumnRemoved);
151
+ host.listen("columnAdded", this._onColumnAdded);
145
152
  host.listen("columnPositionChanged", this._onColumnPositionChanged);
146
153
  this.config(options);
147
154
 
@@ -204,6 +211,7 @@ ColumnSelectionPlugin.prototype.unload = function (host) {
204
211
  host.unlisten("mousedown", this._onMouseDown);
205
212
  host.unlisten("keydown", this._onKeyDown);
206
213
  host.unlisten("columnRemoved", this._onColumnRemoved);
214
+ host.unlisten("columnAdded", this._onColumnAdded);
207
215
  host.unlisten("columnPositionChanged", this._onColumnPositionChanged);
208
216
 
209
217
  this._hosts.splice(at, 1);
@@ -458,7 +466,9 @@ ColumnSelectionPlugin.prototype.setSelectedColumn = function (colIndex, opt_sele
458
466
  }
459
467
 
460
468
  this._hasSelection = selection ? true : null;
461
- this._pendingSelection = -1; // New selection happens before resolving the pending selection
469
+ this._pendingSelectionOnAdded = -1; // New selection happens before resolving the pending selection
470
+
471
+ this._pendingSelectionOnRemoved = -1; // New selection happens before resolving the pending selection
462
472
 
463
473
  var len = this._hosts.length;
464
474
 
@@ -867,7 +877,13 @@ ColumnSelectionPlugin.prototype._onKeyDown = function (e) {
867
877
 
868
878
 
869
879
  ColumnSelectionPlugin.prototype._onColumnRemoved = function (e) {
880
+ var colIndex = e.colIndex;
881
+
870
882
  if (this._timerId) {
883
+ if (this._pendingSelectionOnAdded > 0 && colIndex < this._pendingSelectionOnAdded) {
884
+ this._pendingSelectionOnAdded = this._pendingSelectionOnAdded - 1;
885
+ }
886
+
871
887
  return;
872
888
  } // Since column and its selection state has been removed, we have to keep track of the first selection across multiple calls
873
889
 
@@ -879,19 +895,17 @@ ColumnSelectionPlugin.prototype._onColumnRemoved = function (e) {
879
895
  // The last selection has been removed
880
896
  this._hasSelection = false;
881
897
 
882
- if (this._pendingSelection < 0) {
883
- var colIndex = e.colIndex;
884
-
898
+ if (this._pendingSelectionOnRemoved < 0) {
885
899
  if (colIndex >= this.getColumnCount()) {
886
900
  colIndex = this.getColumnCount() - 1;
887
901
  }
888
902
 
889
- this._pendingSelection = colIndex;
903
+ this._pendingSelectionOnRemoved = colIndex;
890
904
  }
891
905
 
892
906
  this._timerId = setTimeout(this._onReselection, 10);
893
907
  } else {
894
- this._pendingSelection = firstSel;
908
+ this._pendingSelectionOnRemoved = firstSel;
895
909
  }
896
910
  }
897
911
  };
@@ -900,10 +914,33 @@ ColumnSelectionPlugin.prototype._onColumnRemoved = function (e) {
900
914
  */
901
915
 
902
916
 
917
+ ColumnSelectionPlugin.prototype._onColumnAdded = function (e) {
918
+ if (this._timerId) {
919
+ this._pendingSelectionOnAdded = e.colIndex;
920
+ return;
921
+ }
922
+
923
+ if (this._hasSelection) {
924
+ this.clearAllSelections();
925
+
926
+ if (this._pendingSelectionOnAdded < 0) {
927
+ this._pendingSelectionOnAdded = e.colIndex;
928
+ }
929
+
930
+ this._timerId = setTimeout(this._onReselection, 10);
931
+ }
932
+ };
933
+ /** @private
934
+ * @param {Object} e
935
+ */
936
+
937
+
903
938
  ColumnSelectionPlugin.prototype._onReselection = function (e) {
904
939
  this._timerId = 0;
905
- this.setSelectedColumn(this._pendingSelection, true);
906
- this._pendingSelection = -1;
940
+ var pendingSelection = this._pendingSelectionOnAdded > -1 ? this._pendingSelectionOnAdded : this._pendingSelectionOnRemoved;
941
+ this.setSelectedColumn(pendingSelection, true);
942
+ this._pendingSelectionOnAdded = -1;
943
+ this._pendingSelectionOnRemoved = -1;
907
944
 
908
945
  if (!this._activeGrid) {
909
946
  this._activeGrid = this._hosts[0];
@@ -9,6 +9,10 @@ import { preventDefault } from "../../tr-grid-util/es6/EventDispatcher.js";
9
9
 
10
10
  declare namespace ColumnStackPlugin {
11
11
 
12
+ type Options = {
13
+ fields: (string)[]
14
+ };
15
+
12
16
  type ColumnOptions = {
13
17
  stackId?: string,
14
18
  stack?: (string|StackOptions)
@@ -34,11 +38,11 @@ declare class ColumnStackPlugin extends GridPlugin {
34
38
 
35
39
  public getConfigObject(gridOptions?: any): any;
36
40
 
37
- public getMemberIndices(colIndex: number): (number)[];
41
+ public getMemberIndices(colIndex: number): (number)[]|null;
38
42
 
39
- public collapseGroup(colIndex: number, collapsed?: boolean): (number)[];
43
+ public collapseGroup(colIndex: number, collapsed?: boolean): (number)[]|null;
40
44
 
41
- public expandGroup(colIndex: number): (number)[];
45
+ public expandGroup(colIndex: number): (number)[]|null;
42
46
 
43
47
  public isColumnStackable(colIndices: (number)[]): boolean;
44
48
 
@@ -60,7 +64,7 @@ declare class ColumnStackPlugin extends GridPlugin {
60
64
 
61
65
  public getStackId(colIndex: number): string;
62
66
 
63
- public stackColumns(colIndices?: (number)[], stackId?: string, options?: any): boolean;
67
+ public stackColumns(colRefs?: (number|string)[], stackId?: string, options?: any): boolean;
64
68
 
65
69
  public setStack(colRefs: (number|string)[]): boolean;
66
70