@refinitiv-ui/efx-grid 6.0.57 → 6.0.59
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +25 -4
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.js +8 -0
- package/lib/core/es6/grid/Core.js +3 -1
- package/lib/core/es6/grid/event/EventListeners.js +3 -0
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +3 -3
- package/lib/core/es6/grid/util/TrackLayout.d.ts +2 -0
- package/lib/core/es6/grid/util/TrackLayout.js +8 -0
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +48 -16
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.d.ts +3 -3
- package/lib/rt-grid/es6/Grid.js +16 -8
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +3 -1
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +64 -8
- package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +1 -1
- package/lib/tr-grid-textformatting/es6/TextFormatting.js +35 -5
- package/lib/tr-grid-util/es6/ElementObserver.js +4 -2
- package/lib/tr-grid-util/es6/ElementWrapper.js +3 -2
- package/lib/tr-grid-util/es6/GridPlugin.js +5 -0
- package/lib/tr-grid-util/es6/SubTable.d.ts +4 -2
- package/lib/tr-grid-util/es6/SubTable.js +136 -72
- package/lib/tr-grid-util/es6/Table.d.ts +25 -10
- package/lib/tr-grid-util/es6/Table.js +103 -78
- package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +1 -1
- package/lib/types/es6/ColumnStack.d.ts +3 -1
- package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +3 -3
- package/lib/types/es6/TextFormatting.d.ts +1 -1
- package/lib/versions.json +3 -3
- package/package.json +1 -1
@@ -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 {
|
11
|
-
* @param {
|
12
|
-
* @
|
13
|
-
|
14
|
-
|
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
|
23
|
-
|
38
|
+
if(typeof options === "number") {
|
39
|
+
rowCount = options;
|
40
|
+
options = null;
|
24
41
|
}
|
25
|
-
|
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
|
39
|
-
if(
|
40
|
-
options
|
41
|
-
|
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(
|
44
|
-
t.addColumns(
|
63
|
+
if(colCount > 0) {
|
64
|
+
t.addColumns(colCount);
|
45
65
|
}
|
46
|
-
if(
|
47
|
-
t.addRows(
|
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(
|
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 {
|
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=}
|
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(
|
166
|
-
if(
|
167
|
-
else if(
|
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 =
|
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 +=
|
222
|
+
this._colCount += count;
|
177
223
|
|
178
224
|
if(this._defaultColumnWidth != null) {
|
179
225
|
var minWidth = this._defaultColumnWidth + "px";
|
180
|
-
for(c =
|
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(
|
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=}
|
278
|
+
* @param {number=} count=1
|
233
279
|
* @return {!Array.<Element>} Array of tr (HTMLTableRowElement) elements
|
234
280
|
*/
|
235
|
-
Table.prototype.addRows = function(
|
236
|
-
return this._tbody.addRows(
|
281
|
+
Table.prototype.addRows = function(count) {
|
282
|
+
return this._tbody.addRows(count);
|
237
283
|
};
|
238
284
|
/** @public
|
239
|
-
* @param {number=}
|
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(
|
242
|
-
this._tbody.removeRows(
|
287
|
+
Table.prototype.removeRows = function(count) {
|
288
|
+
this._tbody.removeRows(count);
|
243
289
|
};
|
244
290
|
/** @public */
|
245
291
|
Table.prototype.removeAllRows = function() {
|
@@ -295,10 +341,10 @@ Table.prototype.getRows = Table.prototype.getAllRows;
|
|
295
341
|
Table.prototype.getRow = function(r) { return this._tbody.getRow(r); };
|
296
342
|
|
297
343
|
/** @public
|
298
|
-
* @param {number} c1
|
299
|
-
* @param {number} c2
|
300
|
-
* @param {number} r1
|
301
|
-
* @param {number} r2
|
344
|
+
* @param {number} c1 Starting column index
|
345
|
+
* @param {number} c2 Destination column index
|
346
|
+
* @param {number} r1 Starting row index
|
347
|
+
* @param {number} r2 Destination row index
|
302
348
|
* @return {Element} Top left cell element
|
303
349
|
*/
|
304
350
|
Table.prototype.spanBlock = function(c1, c2, r1, r2) { return this._tbody.spanBlock(c1, c2, r1, r2); };
|
@@ -314,37 +360,37 @@ Table.prototype.spanHorizontally = function(r, bool) {
|
|
314
360
|
|
315
361
|
/** @public
|
316
362
|
* @param {number|string|Array.<string|number>} val
|
317
|
-
* @param {number=}
|
363
|
+
* @param {number=} colIndex Column index
|
318
364
|
*/
|
319
|
-
Table.prototype.setColMinWidths = function(val,
|
320
|
-
this._setColStyle("width", val,
|
365
|
+
Table.prototype.setColMinWidths = function(val, colIndex) {
|
366
|
+
this._setColStyle("width", val, colIndex);
|
321
367
|
this._updateTableWidth();
|
322
368
|
};
|
323
369
|
/** @public
|
324
370
|
* @function
|
325
371
|
* @param {number|string|Array.<string|number>} val
|
326
|
-
* @param {number=}
|
372
|
+
* @param {number=} colIndex Column index
|
327
373
|
*/
|
328
374
|
Table.prototype.setColumnWidths = Table.prototype.setColMinWidths;
|
329
375
|
/** @public
|
330
376
|
* @param {string|Array.<string>} val
|
331
|
-
* @param {number=}
|
377
|
+
* @param {number=} colIndex Column index
|
332
378
|
*/
|
333
|
-
Table.prototype.setColBackgroundColors = function(val,
|
334
|
-
this._setColStyle("background-color", val,
|
379
|
+
Table.prototype.setColBackgroundColors = function(val, colIndex) {
|
380
|
+
this._setColStyle("background-color", val, colIndex);
|
335
381
|
};
|
336
382
|
/** @public
|
337
383
|
* @function
|
338
384
|
* @param {string|Array.<string>} val
|
339
|
-
* @param {number=}
|
385
|
+
* @param {number=} colIndex Column index
|
340
386
|
*/
|
341
387
|
Table.prototype.setColBGColors = Table.prototype.setColBackgroundColors; // Alias
|
342
388
|
/** @public
|
343
389
|
* @param {number|string|Array.<number|string>} val
|
344
|
-
* @param {number=}
|
390
|
+
* @param {number=} colIndex Column index
|
345
391
|
*/
|
346
|
-
Table.prototype.setColBorders = function(val,
|
347
|
-
this._setColStyle("border", val,
|
392
|
+
Table.prototype.setColBorders = function(val, colIndex) {
|
393
|
+
this._setColStyle("border", val, colIndex);
|
348
394
|
};
|
349
395
|
|
350
396
|
/** @public
|
@@ -675,35 +721,35 @@ Table.prototype.getFooter = function() {
|
|
675
721
|
|
676
722
|
|
677
723
|
/** @private
|
678
|
-
* @param {Element=}
|
724
|
+
* @param {Element=} elem
|
679
725
|
*/
|
680
|
-
Table.prototype._addHeader = function(
|
726
|
+
Table.prototype._addHeader = function(elem) {
|
681
727
|
var t = this;
|
682
728
|
if(!t._thead) {
|
683
|
-
t._thead = new SubTable(
|
729
|
+
t._thead = new SubTable(elem ? elem : "thead");
|
684
730
|
t._subs.push(t._thead);
|
685
731
|
|
686
732
|
t._thead.setColumnCount(t._colCount);
|
687
733
|
t._thead.setDefaultRowHeight(t._defaultRowHeight);
|
688
734
|
t._table.insertBefore(t._thead.getElement(), t._tbody.getElement());
|
689
|
-
} else if(
|
690
|
-
t._thead.cloak(
|
735
|
+
} else if(elem) {
|
736
|
+
t._thead.cloak(elem);
|
691
737
|
}
|
692
738
|
};
|
693
739
|
/** @private
|
694
|
-
* @param {Element=}
|
740
|
+
* @param {Element=} elem
|
695
741
|
*/
|
696
|
-
Table.prototype._addFooter = function(
|
742
|
+
Table.prototype._addFooter = function(elem) {
|
697
743
|
var t = this;
|
698
744
|
if(!t._tfoot) {
|
699
|
-
t._tfoot = new SubTable(
|
745
|
+
t._tfoot = new SubTable(elem ? elem : "tfoot");
|
700
746
|
t._subs.push(t._tfoot);
|
701
747
|
|
702
748
|
t._tfoot.setColumnCount(t._colCount);
|
703
749
|
t._tfoot.setDefaultRowHeight(t._defaultRowHeight);
|
704
750
|
t._table.appendChild(t._tfoot.getElement());
|
705
|
-
} else if(
|
706
|
-
t._tfoot.cloak(
|
751
|
+
} else if(elem) {
|
752
|
+
t._tfoot.cloak(elem);
|
707
753
|
}
|
708
754
|
};
|
709
755
|
|
@@ -763,28 +809,7 @@ Table.prototype._updateTableWidth = function() {
|
|
763
809
|
this._table.style.width = "";
|
764
810
|
}
|
765
811
|
};
|
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
812
|
|
785
|
-
this.setColumnCount(colCount);
|
786
|
-
return colCount;
|
787
|
-
};
|
788
813
|
|
789
814
|
export default Table;
|
790
815
|
export { Table };
|
@@ -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?:
|
186
|
+
public insertRow(rowOption?: (RowDefinition.Options|string)|null, rowRef?: Grid.RowReference|null): RowDefinition|null;
|
187
187
|
|
188
|
-
public insertRows(rowOptions: (
|
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?:
|
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
|
|
@@ -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,
|
package/lib/versions.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"tr-grid-util": "1.3.
|
2
|
+
"tr-grid-util": "1.3.120",
|
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,7 +13,7 @@
|
|
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.
|
16
|
+
"tr-grid-column-stack": "1.0.69",
|
17
17
|
"tr-grid-conditional-coloring": "1.0.61",
|
18
18
|
"tr-grid-content-wrap": "1.0.20",
|
19
19
|
"tr-grid-contextmenu": "1.0.39",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"tr-grid-row-grouping": "1.0.81",
|
29
29
|
"tr-grid-row-selection": "1.0.23",
|
30
30
|
"tr-grid-rowcoloring": "1.0.23",
|
31
|
-
"tr-grid-textformatting": "1.0.
|
31
|
+
"tr-grid-textformatting": "1.0.46",
|
32
32
|
"tr-grid-titlewrap": "1.0.19",
|
33
33
|
"@grid/formatters": "1.0.50",
|
34
34
|
"@grid/column-selection-dialog": "4.0.52",
|
package/package.json
CHANGED