@refinitiv-ui/efx-grid 6.0.58 → 6.0.60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/lib/core/dist/core.js +4 -4
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/grid/Core.js +1 -1
  4. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +3 -3
  5. package/lib/grid/index.js +1 -1
  6. package/lib/grid/lib/efx-grid.d.ts +0 -1
  7. package/lib/grid/lib/efx-grid.js +8 -5
  8. package/lib/grid/themes/base.less +1 -1
  9. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  10. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  11. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  12. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  13. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  14. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  15. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  16. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  17. package/lib/rt-grid/dist/rt-grid.js +8 -8
  18. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  19. package/lib/rt-grid/es6/Grid.d.ts +3 -3
  20. package/lib/rt-grid/es6/Grid.js +8 -8
  21. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +3 -1
  22. package/lib/tr-grid-column-stack/es6/ColumnStack.js +64 -8
  23. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +65 -14
  24. package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +2 -0
  25. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +162 -118
  26. package/lib/tr-grid-util/es6/CellPainter.d.ts +4 -0
  27. package/lib/tr-grid-util/es6/CellPainter.js +43 -15
  28. package/lib/tr-grid-util/es6/ElementObserver.js +4 -2
  29. package/lib/tr-grid-util/es6/ElementWrapper.js +3 -2
  30. package/lib/tr-grid-util/es6/GridPlugin.js +5 -0
  31. package/lib/tr-grid-util/es6/SubTable.d.ts +4 -2
  32. package/lib/tr-grid-util/es6/SubTable.js +157 -79
  33. package/lib/tr-grid-util/es6/Table.d.ts +27 -10
  34. package/lib/tr-grid-util/es6/Table.js +104 -78
  35. package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +1 -1
  36. package/lib/types/es6/ColumnStack.d.ts +3 -1
  37. package/lib/types/es6/RealtimeGrid/Grid.d.ts +3 -3
  38. package/lib/types/es6/RowColoring.d.ts +2 -0
  39. package/lib/types/es6/TextFormatting.d.ts +1 -1
  40. package/lib/utils/index.d.ts +2 -1
  41. package/lib/utils/index.js +2 -1
  42. package/lib/versions.json +4 -4
  43. package/package.json +3 -3
@@ -3,26 +3,43 @@ import { Ext } from "./Ext.js";
3
3
  import { ElementWrapper } from "./ElementWrapper.js";
4
4
  import { SubTable } from "./SubTable.js";
5
5
 
6
+ /** @typedef {Object} Table~Options
7
+ * @description Options for Table initialization
8
+ * @property {number=} colCount=0 Number of columns
9
+ * @property {number=} rowCount=0 Number of rows in content table (tbody)
10
+ * @property {number=} cellWidth Default cell width of each column
11
+ * @property {number=} cellHeight Default cell height of each row
12
+ * @property {number=} width Total width of the table. If it is specified, it will override cellWidth
13
+ * @property {number=} height Total height of the table. If it is specified, it will override cellHeight
14
+ * @property {number=} header=0 Number of header rows
15
+ * @property {number=} footer=0 Number of footer rows
16
+ */
6
17
 
7
18
  /** Table represents table (tag) element which can host multiple tbody, thead, tfoot elements at the same time
8
19
  * @constructor
9
20
  * @extends {ElementWrapper}
10
- * @param {(Element|number)=} elem Element is a place holder element (e.g. div). This should not be a table (tag) element. Column count may be placed here and if so, opt_colCount becomes row count.
11
- * @param {(number|Object)=} opt_colCount options
12
- * @param {number=} opt_rowCount
13
- */
14
- var Table = function(elem, opt_colCount, opt_rowCount) {
21
+ * @param {Element=} elem Element is a place holder element (e.g., div). This should not be a table (tag) element.
22
+ * @param {Table~Options=} options
23
+ * @example
24
+ * var elem = document.getElementById("table_div");
25
+ * // Create a table element with 2 columns and 3 rows inside the given element
26
+ * var tbl = new Table(elem, {colCount: 2, rowCount: 3});
27
+ */
28
+ var Table = function(elem, options) {
15
29
  var t = this;
16
30
 
31
+ var colCount = 0;
32
+ var rowCount = 0;
17
33
  if(elem && elem.nodeType === 1) {
18
34
  t._elem = /** @type{Element} */(elem);
19
35
  } else {
20
36
  t._elem = Dom.create("div", "inline-table");
21
37
  if(typeof elem == "number") {
22
- if(typeof opt_colCount === "number") {
23
- opt_rowCount = opt_colCount;
38
+ if(typeof options === "number") {
39
+ rowCount = options;
40
+ options = null;
24
41
  }
25
- opt_colCount = elem;
42
+ colCount = elem;
26
43
  elem = null;
27
44
  }
28
45
  }
@@ -35,23 +52,26 @@ var Table = function(elem, opt_colCount, opt_rowCount) {
35
52
  t._tbody = new SubTable("tbody");
36
53
  t._subs = [t._tbody]; // tbody will always be the first item
37
54
 
38
- var options = null;
39
- if(opt_colCount && typeof opt_colCount !== "number") {
40
- options = /** @type{Object} */(opt_colCount);
41
- opt_colCount = 0;
55
+ var configObj = null;
56
+ if(options) {
57
+ if(typeof options == "number") {
58
+ colCount = options;
59
+ } else {
60
+ configObj = /** @type{Object} */(options);
61
+ }
42
62
  }
43
- if(opt_colCount > 0) {
44
- t.addColumns(opt_colCount);
63
+ if(colCount > 0) {
64
+ t.addColumns(colCount);
45
65
  }
46
- if(opt_rowCount > 0) {
47
- t.addRows(opt_rowCount);
66
+ if(rowCount > 0) {
67
+ t.addRows(rowCount);
48
68
  }
49
69
  t._table.appendChild(t._colgroup);
50
70
  t._table.appendChild(t._tbody.getElement());
51
71
 
52
72
  t.fixateTableWidth(); // By default, table should be able to overflow its container if it has a fixed size
53
73
 
54
- t.init(options);
74
+ t.init(configObj);
55
75
 
56
76
  t._elem.appendChild(t._table); // Append the entire table last to save some page reflow
57
77
  };
@@ -119,7 +139,7 @@ Table.prototype.setCRWH = function(col, row, width, height) {
119
139
  this.setSize(width, height);
120
140
  };
121
141
  /** @public
122
- * @param {Object} options
142
+ * @param {Table~Options} options
123
143
  */
124
144
  Table.prototype.init = function(options) {
125
145
  if(!options) {
@@ -156,34 +176,60 @@ Table.prototype.init = function(options) {
156
176
  this.setDefaultRowHeight((tableHeight / rowCount) | 0);
157
177
  }
158
178
  }
179
+
180
+ var header = options["header"];
181
+ if(header != null) {
182
+ if(header) {
183
+ rowCount = (typeof header === "number") ? header : 1;
184
+
185
+ this._addHeader();
186
+ this._thead.setRowCount(rowCount);
187
+ } else if(this._thead) {
188
+ Dom.removeParent(this._thead.getElement());
189
+ this._thead = null;
190
+ }
191
+ }
192
+
193
+ var footer = options["footer"];
194
+ if(footer != null) {
195
+ if(footer) {
196
+ rowCount = (typeof footer === "number") ? footer : 1;
197
+
198
+ this._addFooter();
199
+ this._tfoot.setRowCount(rowCount);
200
+ } else if(this._tfoot) {
201
+ Dom.removeParent(this._tfoot.getElement());
202
+ this._tfoot = null;
203
+ }
204
+ }
159
205
  };
160
206
 
161
207
  /** @public
162
- * @param {number=} opt_count
208
+ * @param {number=} count=1
163
209
  * @return {Array.<Element>} Array of col elements (not td or cell)
164
210
  */
165
- Table.prototype.addColumns = function(opt_count) {
166
- if(opt_count == null) { opt_count = 1; }
167
- else if(opt_count <= 0) { return null; }
211
+ Table.prototype.addColumns = function(count) {
212
+ if(count == null) { count = 1; }
213
+ else if(count <= 0) { return null; }
168
214
 
169
215
  var cols = [];
170
216
  var c;
171
- for(c = opt_count; --c >= 0;) {
217
+ for(c = count; --c >= 0;) {
172
218
  var col = document.createElement("col");
173
219
  this._colgroup.appendChild(col);
174
220
  cols[c] = col;
175
221
  }
176
- this._colCount += opt_count;
222
+ this._colCount += count;
177
223
 
178
224
  if(this._defaultColumnWidth != null) {
179
225
  var minWidth = this._defaultColumnWidth + "px";
180
- for(c = opt_count; --c >= 0;) {
226
+ for(c = count; --c >= 0;) {
181
227
  cols[c].style.width = minWidth;
182
228
  }
183
229
  }
184
230
 
185
231
  for(var i = this._subs.length; --i >= 0;) {
186
- this._subs[i].addColumns(opt_count);
232
+ this._subs[i].addColumns(count);
187
233
  }
188
234
  this._updateTableWidth();
189
235
  return cols;
@@ -229,17 +275,17 @@ Table.prototype.setColumnCount = function(val) {
229
275
  };
230
276
 
231
277
  /** @public
232
- * @param {number=} opt_count
278
+ * @param {number=} count=1
233
279
  * @return {!Array.<Element>} Array of tr (HTMLTableRowElement) elements
234
280
  */
235
- Table.prototype.addRows = function(opt_count) {
236
- return this._tbody.addRows(opt_count);
281
+ Table.prototype.addRows = function(count) {
282
+ return this._tbody.addRows(count);
237
283
  };
238
284
  /** @public
239
- * @param {number=} opt_count
285
+ * @param {number=} count Number of rows to be removed. If count is not specified, all rows are removed
240
286
  */
241
- Table.prototype.removeRows = function(opt_count) {
242
- this._tbody.removeRows(opt_count);
287
+ Table.prototype.removeRows = function(count) {
288
+ this._tbody.removeRows(count);
243
289
  };
244
290
  /** @public */
245
291
  Table.prototype.removeAllRows = function() {
@@ -285,6 +331,7 @@ Table.prototype.getAllCells = function() { return this._tbody.getAllCells(); };
285
331
  */
286
332
  Table.prototype.getAllRows = function() { return this._tbody.getAllRows(); };
287
333
  /** @public
334
+ * @function
288
335
  * @return {!Array<Element>} Array of tr (HTMLTableRowElement) elements
289
336
  */
290
337
  Table.prototype.getRows = Table.prototype.getAllRows;
@@ -295,10 +342,10 @@ Table.prototype.getRows = Table.prototype.getAllRows;
295
342
  Table.prototype.getRow = function(r) { return this._tbody.getRow(r); };
296
343
 
297
344
  /** @public
298
- * @param {number} c1
299
- * @param {number} c2
300
- * @param {number} r1
301
- * @param {number} r2
345
+ * @param {number} c1 Starting column index
346
+ * @param {number} c2 Destination column index
347
+ * @param {number} r1 Starting row index
348
+ * @param {number} r2 Destination row index
302
349
  * @return {Element} Top left cell element
303
350
  */
304
351
  Table.prototype.spanBlock = function(c1, c2, r1, r2) { return this._tbody.spanBlock(c1, c2, r1, r2); };
@@ -314,37 +361,37 @@ Table.prototype.spanHorizontally = function(r, bool) {
314
361
 
315
362
  /** @public
316
363
  * @param {number|string|Array.<string|number>} val
317
- * @param {number=} opt_at
364
+ * @param {number=} colIndex Column index
318
365
  */
319
- Table.prototype.setColMinWidths = function(val, opt_at) {
320
- this._setColStyle("width", val, opt_at);
366
+ Table.prototype.setColMinWidths = function(val, colIndex) {
367
+ this._setColStyle("width", val, colIndex);
321
368
  this._updateTableWidth();
322
369
  };
323
370
  /** @public
324
371
  * @function
325
372
  * @param {number|string|Array.<string|number>} val
326
- * @param {number=} opt_at
373
+ * @param {number=} colIndex Column index
327
374
  */
328
375
  Table.prototype.setColumnWidths = Table.prototype.setColMinWidths;
329
376
  /** @public
330
377
  * @param {string|Array.<string>} val
331
- * @param {number=} opt_at
378
+ * @param {number=} colIndex Column index
332
379
  */
333
- Table.prototype.setColBackgroundColors = function(val, opt_at) {
334
- this._setColStyle("background-color", val, opt_at);
380
+ Table.prototype.setColBackgroundColors = function(val, colIndex) {
381
+ this._setColStyle("background-color", val, colIndex);
335
382
  };
336
383
  /** @public
337
384
  * @function
338
385
  * @param {string|Array.<string>} val
339
- * @param {number=} opt_at
386
+ * @param {number=} colIndex Column index
340
387
  */
341
388
  Table.prototype.setColBGColors = Table.prototype.setColBackgroundColors; // Alias
342
389
  /** @public
343
390
  * @param {number|string|Array.<number|string>} val
344
- * @param {number=} opt_at
391
+ * @param {number=} colIndex Column index
345
392
  */
346
- Table.prototype.setColBorders = function(val, opt_at) {
347
- this._setColStyle("border", val, opt_at);
393
+ Table.prototype.setColBorders = function(val, colIndex) {
394
+ this._setColStyle("border", val, colIndex);
348
395
  };
349
396
 
350
397
  /** @public
@@ -675,35 +722,35 @@ Table.prototype.getFooter = function() {
675
722
 
676
723
 
677
724
  /** @private
678
- * @param {Element=} opt_elem
725
+ * @param {Element=} elem
679
726
  */
680
- Table.prototype._addHeader = function(opt_elem) {
727
+ Table.prototype._addHeader = function(elem) {
681
728
  var t = this;
682
729
  if(!t._thead) {
683
- t._thead = new SubTable((opt_elem) ? opt_elem : "thead");
730
+ t._thead = new SubTable(elem ? elem : "thead");
684
731
  t._subs.push(t._thead);
685
732
 
686
733
  t._thead.setColumnCount(t._colCount);
687
734
  t._thead.setDefaultRowHeight(t._defaultRowHeight);
688
735
  t._table.insertBefore(t._thead.getElement(), t._tbody.getElement());
689
- } else if(opt_elem) {
690
- t._thead.cloak(opt_elem);
736
+ } else if(elem) {
737
+ t._thead.cloak(elem);
691
738
  }
692
739
  };
693
740
  /** @private
694
- * @param {Element=} opt_elem
741
+ * @param {Element=} elem
695
742
  */
696
- Table.prototype._addFooter = function(opt_elem) {
743
+ Table.prototype._addFooter = function(elem) {
697
744
  var t = this;
698
745
  if(!t._tfoot) {
699
- t._tfoot = new SubTable((opt_elem) ? opt_elem : "tfoot");
746
+ t._tfoot = new SubTable(elem ? elem : "tfoot");
700
747
  t._subs.push(t._tfoot);
701
748
 
702
749
  t._tfoot.setColumnCount(t._colCount);
703
750
  t._tfoot.setDefaultRowHeight(t._defaultRowHeight);
704
751
  t._table.appendChild(t._tfoot.getElement());
705
- } else if(opt_elem) {
706
- t._tfoot.cloak(opt_elem);
752
+ } else if(elem) {
753
+ t._tfoot.cloak(elem);
707
754
  }
708
755
  };
709
756
 
@@ -763,28 +810,7 @@ Table.prototype._updateTableWidth = function() {
763
810
  this._table.style.width = "";
764
811
  }
765
812
  };
766
- /** @private
767
- * @param {Array.<Array>} ary
768
- * @return {number}
769
- */
770
- Table.prototype._adjustColCount = function(ary) {
771
- if(this._colCount > 0) {
772
- return this._colCount;
773
- }
774
-
775
- var colCount = 0;
776
- var rowCount = ary.length;
777
-
778
- for(var r = 0; r < rowCount; ++r) {
779
- var cols = ary[r];
780
- if(cols.length > colCount) {
781
- colCount = cols.length;
782
- }
783
- }
784
813
 
785
- this.setColumnCount(colCount);
786
- return colCount;
787
- };
788
814
 
789
815
  export default Table;
790
816
  export { Table };
@@ -18,7 +18,7 @@ Ext.inherits(AdFinSubscription, EventDispatcher);
18
18
  AdFinSubscription.Request;
19
19
 
20
20
  /** call signature -> value
21
- * @type {Object.<string, {pending:boolean,value:*}
21
+ * @type {Object}
22
22
  * @private
23
23
  */
24
24
  AdFinSubscription.prototype._cache = null;
@@ -14,7 +14,9 @@ declare namespace ColumnStackPlugin {
14
14
  fields: (string)[]|null,
15
15
  stacks: (ColumnStackPlugin.StackDefinition)[]|null,
16
16
  autoStacking?: boolean|null,
17
- clicked?: ((...params: any[]) => any)|null
17
+ clicked?: ((...params: any[]) => any)|null,
18
+ menuElement?: Element|null,
19
+ menuItemClicked?: ((...params: any[]) => any)|null
18
20
  };
19
21
 
20
22
  type ColumnOptions = {
@@ -183,9 +183,9 @@ declare class Grid extends EventDispatcher {
183
183
 
184
184
  public _initDuplicateRicData(rowDef: RowDefinition|null): void;
185
185
 
186
- public insertRow(rowOption?: any, rowRef?: Grid.RowReference|null): any;
186
+ public insertRow(rowOption?: (RowDefinition.Options|string)|null, rowRef?: Grid.RowReference|null): RowDefinition|null;
187
187
 
188
- public insertRows(rowOptions: (any)[]|null, rowRef?: Grid.RowReference|null, opt_fields?: (string)[]|null): void;
188
+ public insertRows(rowOptions: (RowDefinition.Options|string)[]|null, rowRef?: Grid.RowReference|null, opt_fields?: (string)[]|null): void;
189
189
 
190
190
  public addStaticDataRows(dataRows: any[]|null, fields?: (string)[]|null): void;
191
191
 
@@ -325,7 +325,7 @@ declare class Grid extends EventDispatcher {
325
325
 
326
326
  public logDV(opt_options?: any): void;
327
327
 
328
- public replaceRow(rowRef: Grid.RowReference|null, rowOption?: any): any;
328
+ public replaceRow(rowRef: Grid.RowReference|null, rowOption?: (RowDefinition.Options|string)|null): RowDefinition|null;
329
329
 
330
330
  public scrollToColumn(colIndex: number, leftOfView?: boolean|null): boolean;
331
331
 
@@ -56,6 +56,8 @@ declare class RowColoringPlugin extends GridPlugin {
56
56
 
57
57
  public getContrastColor(hexColor: string): string;
58
58
 
59
+ public forceUpdateRowColor(): void;
60
+
59
61
  }
60
62
 
61
63
  export default RowColoringPlugin;
@@ -10,7 +10,7 @@ declare namespace TextFormattingPlugin {
10
10
  formatType?: string|null,
11
11
  type?: string|null,
12
12
  field?: string|null,
13
- decimalPlaces?: number|null,
13
+ decimalPlaces?: (number|boolean)|null,
14
14
  precisionEnabled?: boolean|null,
15
15
  plusSign?: boolean|null,
16
16
  separator?: boolean|null,
@@ -1,5 +1,6 @@
1
1
  import { GridPrinter } from "../tr-grid-printer/es6/GridPrinter.js";
2
+ import { Table } from "../tr-grid-util/es6/Table.js";
2
3
  import { MultiTableManager } from "../tr-grid-util/es6/MultiTableManager.js";
3
4
  import { DataGenerator } from "../tr-grid-util/es6/jet/DataGenerator.js";
4
5
  import { MockRTK } from "../tr-grid-util/es6/jet/MockRTK.js";
5
- export { GridPrinter, MultiTableManager, DataGenerator, MockRTK };
6
+ export { GridPrinter, Table, MultiTableManager, DataGenerator, MockRTK };
@@ -1,5 +1,6 @@
1
1
  import { GridPrinter } from "../tr-grid-printer/es6/GridPrinter.js";
2
+ import { Table } from "../tr-grid-util/es6/Table.js";
2
3
  import { MultiTableManager } from "../tr-grid-util/es6/MultiTableManager.js";
3
4
  import { DataGenerator } from "../tr-grid-util/es6/jet/DataGenerator.js";
4
5
  import { MockRTK } from "../tr-grid-util/es6/jet/MockRTK.js";
5
- export { GridPrinter, MultiTableManager, DataGenerator, MockRTK };
6
+ export { GridPrinter, Table, MultiTableManager, DataGenerator, MockRTK };
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.117",
2
+ "tr-grid-util": "1.3.124",
3
3
  "tr-grid-printer": "1.0.16",
4
4
  "@grid/column-dragging": "1.0.14",
5
5
  "@grid/row-segmenting": "1.0.24",
@@ -13,8 +13,8 @@
13
13
  "tr-grid-column-grouping": "1.0.54",
14
14
  "tr-grid-column-resizing": "1.0.28",
15
15
  "tr-grid-column-selection": "1.0.29",
16
- "tr-grid-column-stack": "1.0.68",
17
- "tr-grid-conditional-coloring": "1.0.61",
16
+ "tr-grid-column-stack": "1.0.69",
17
+ "tr-grid-conditional-coloring": "1.0.62",
18
18
  "tr-grid-content-wrap": "1.0.20",
19
19
  "tr-grid-contextmenu": "1.0.39",
20
20
  "tr-grid-filter-input": "0.9.33",
@@ -27,7 +27,7 @@
27
27
  "tr-grid-row-filtering": "1.0.57",
28
28
  "tr-grid-row-grouping": "1.0.81",
29
29
  "tr-grid-row-selection": "1.0.23",
30
- "tr-grid-rowcoloring": "1.0.23",
30
+ "tr-grid-rowcoloring": "1.0.24",
31
31
  "tr-grid-textformatting": "1.0.46",
32
32
  "tr-grid-titlewrap": "1.0.19",
33
33
  "@grid/formatters": "1.0.50",
package/package.json CHANGED
@@ -60,11 +60,11 @@
60
60
  "./utils": "./lib/utils/index.js"
61
61
  },
62
62
  "peerDependencies": {
63
- "@refinitiv-ui/core": "^6.2.0",
64
- "@refinitiv-ui/elements": "^6.5.0"
63
+ "@refinitiv-ui/core": "^6.2.0 || ^7.0.0",
64
+ "@refinitiv-ui/elements": "^6.5.0 || ^7.0.0"
65
65
  },
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.58"
69
+ "version": "6.0.60"
70
70
  }