@refinitiv-ui/efx-grid 6.0.59 → 6.0.61

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +1 -1
  2. package/lib/column-selection-dialog/lib/column-selection-dialog.js +1 -41
  3. package/lib/column-selection-dialog/themes/base.less +32 -0
  4. package/lib/column-selection-dialog/themes/elemental/dark/column-selection-dialog.js +1 -1
  5. package/lib/column-selection-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
  6. package/lib/column-selection-dialog/themes/elemental/light/column-selection-dialog.js +1 -1
  7. package/lib/column-selection-dialog/themes/elemental/light/es5/all-elements.js +1 -1
  8. package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
  9. package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
  10. package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
  11. package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
  12. package/lib/column-selection-dialog/themes/solar/charcoal/column-selection-dialog.js +1 -1
  13. package/lib/column-selection-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
  14. package/lib/column-selection-dialog/themes/solar/pearl/column-selection-dialog.js +1 -1
  15. package/lib/column-selection-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
  16. package/lib/core/dist/core.js +2 -6
  17. package/lib/core/dist/core.min.js +1 -1
  18. package/lib/core/es6/grid/Core.js +2 -6
  19. package/lib/grid/index.js +1 -1
  20. package/lib/grid/lib/efx-grid.d.ts +0 -1
  21. package/lib/grid/lib/efx-grid.js +8 -5
  22. package/lib/grid/themes/base.less +1 -1
  23. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  24. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  25. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  26. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  27. package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
  28. package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
  29. package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
  30. package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
  31. package/lib/tr-grid-column-stack/es6/ColumnStack.js +1 -0
  32. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +65 -14
  33. package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +2 -0
  34. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +162 -118
  35. package/lib/tr-grid-util/es6/CellPainter.d.ts +4 -0
  36. package/lib/tr-grid-util/es6/CellPainter.js +43 -15
  37. package/lib/tr-grid-util/es6/ElementObserver.js +2 -1
  38. package/lib/tr-grid-util/es6/ExpressionParser.js +55 -13
  39. package/lib/tr-grid-util/es6/SubTable.js +21 -7
  40. package/lib/tr-grid-util/es6/Table.d.ts +2 -0
  41. package/lib/tr-grid-util/es6/Table.js +1 -0
  42. package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +35 -13
  43. package/lib/tr-grid-util/es6/jet/DataGenerator.js +42 -17
  44. package/lib/types/es6/RowColoring.d.ts +2 -0
  45. package/lib/utils/index.d.ts +2 -1
  46. package/lib/utils/index.js +2 -1
  47. package/lib/versions.json +5 -5
  48. package/package.json +3 -3
@@ -99,7 +99,7 @@ RowColoringPlugin.prototype.initialize = function (host, options) {
99
99
  return;
100
100
  }
101
101
  this._hosts.push(host);
102
- host.listen("postSectionDataBinding", this._onSectionBinding);
102
+ host.listen("preSectionDataBinding", this._onSectionBinding);
103
103
  this.config(options);
104
104
  this._updateTimer = setTimeout(this._updateRowColor, 100); // For lazy loading
105
105
  };
@@ -111,7 +111,7 @@ RowColoringPlugin.prototype.unload = function (host) {
111
111
  if (at < 0) {
112
112
  return;
113
113
  }
114
- host.unlisten("postSectionDataBinding", this._onSectionBinding);
114
+ host.unlisten("preSectionDataBinding", this._onSectionBinding);
115
115
  this._hosts.splice(at, 1);
116
116
  if (!this._hosts.length) {
117
117
  if (this._updateTimer) {
@@ -422,6 +422,141 @@ RowColoringPlugin.prototype._onSectionBinding = function (e) {
422
422
  }
423
423
  };
424
424
 
425
+ /** @private
426
+ * @param {Object} section
427
+ * @param {number} fromR from row index
428
+ * @param {number} toR to row index
429
+ * @param {boolean=} forceUpdate force update coloring
430
+ */
431
+ RowColoringPlugin.prototype._applyColor = function (section, fromR, toR, forceUpdate) {
432
+ var colCount = section.getColumnCount();
433
+ var dv = this._getDataView();
434
+ var textColor, bgColor, el, cell, stretchedCell;
435
+ var txtEnabled = this._txtEnabled;
436
+ var bgEnabled = this._bgEnabled;
437
+ for (var r = fromR; r < toR; ++r) {
438
+ textColor = bgColor = "";
439
+ var rowData = this._getRow(dv, r);
440
+ if (rowData) {
441
+ if (txtEnabled) {
442
+ textColor = rowData[this._txtColorField] || "";
443
+ }
444
+ if (bgEnabled) {
445
+ bgColor = rowData[this._bgField] || "";
446
+ }
447
+ }
448
+ stretchedCell = section.getStretchedCell(null, r);
449
+ if (stretchedCell) {
450
+ el = stretchedCell.getElement();
451
+ if (textColor || el._textColor) {
452
+ if (el._textColor !== textColor || forceUpdate) {
453
+ stretchedCell.setStyle("color", textColor);
454
+ el._textColor = textColor;
455
+ }
456
+ }
457
+ if (bgColor || el._bgColor) {
458
+ if (el._bgColor !== bgColor || forceUpdate) {
459
+ stretchedCell.setStyle("backgroundColor", bgColor);
460
+ el._bgColor = bgColor;
461
+ }
462
+ }
463
+ }
464
+ for (var c = 0; c < colCount; ++c) {
465
+ cell = section.getCell(c, r, false);
466
+ if (!cell) {
467
+ continue;
468
+ }
469
+ el = cell.getElement();
470
+ if (!el) {
471
+ continue;
472
+ }
473
+ if (textColor || el._textColor) {
474
+ if (el._textColor !== textColor || forceUpdate) {
475
+ cell.setStyle("color", textColor);
476
+ el._textColor = textColor;
477
+ }
478
+ }
479
+ if (bgColor || el._bgColor) {
480
+ if (el._bgColor !== bgColor || forceUpdate) {
481
+ cell.setStyle("backgroundColor", bgColor);
482
+ el._bgColor = bgColor;
483
+ }
484
+ }
485
+ }
486
+ }
487
+ };
488
+
489
+ /** @private
490
+ * @param {Object} section
491
+ * @param {number} fromR from row index
492
+ * @param {number} toR to row index
493
+ */
494
+ RowColoringPlugin.prototype._applyPredefinedColor = function (section, fromR, toR) {
495
+ var colCount = section.getColumnCount();
496
+ var dv = this._getDataView();
497
+ var cssField = this._cssField;
498
+ var altCssField = this._altCssField;
499
+ var rangeField = this._cssRangeField;
500
+ var className, el, start, end, altCssClass, range, colorSelected, stretchedCell, cell;
501
+ for (var r = fromR; r < toR; ++r) {
502
+ className = altCssClass = "";
503
+ start = end = range = null;
504
+ var rowData = this._getRow(dv, r);
505
+ if (rowData) {
506
+ className = rowData[cssField] || "";
507
+ altCssClass = rowData[altCssField] || "";
508
+ range = rowData[rangeField];
509
+ if (Array.isArray(range)) {
510
+ start = range[0];
511
+ end = range[1] ? range[0] + range[1] : colCount; // handled case user provide only the start field (not provide the length of columns)
512
+ }
513
+ }
514
+
515
+ stretchedCell = section.getStretchedCell(null, r);
516
+ if (stretchedCell) {
517
+ el = stretchedCell.getElement();
518
+ if (el._coloringClass !== className) {
519
+ if (el._coloringClass) {
520
+ el.classList.remove(el._coloringClass);
521
+ el._coloringClass = "";
522
+ }
523
+ if (className) {
524
+ el.classList.add(className);
525
+ el._coloringClass = className;
526
+ }
527
+ }
528
+ }
529
+ for (var c = 0; c < colCount; ++c) {
530
+ cell = section.getCell(c, r, false);
531
+ if (!cell) {
532
+ continue;
533
+ }
534
+ el = cell.getElement();
535
+ if (!el) {
536
+ continue;
537
+ }
538
+ if (className && range && (c < start || c > end)) {
539
+ // use alternative color
540
+ colorSelected = altCssClass;
541
+ } else {
542
+ // use normal color
543
+ colorSelected = className;
544
+ }
545
+ if (el._coloringClass === colorSelected) {
546
+ continue;
547
+ }
548
+ if (el._coloringClass) {
549
+ el.classList.remove(el._coloringClass);
550
+ el._coloringClass = "";
551
+ }
552
+ if (colorSelected) {
553
+ el.classList.add(colorSelected);
554
+ el._coloringClass = colorSelected;
555
+ }
556
+ }
557
+ }
558
+ };
559
+
425
560
  /** @private
426
561
  * @param {number=} fromR from row index
427
562
  * @param {number=} toR to row index
@@ -447,124 +582,33 @@ RowColoringPlugin.prototype._updateRowColor = function (fromR, toR) {
447
582
  toR = section.getLastIndexInView() + 1;
448
583
  }
449
584
  // TODO: consolidate the 2 separated flows
450
- var colCount = section.getColumnCount();
451
- var r, c, rowData, cell;
452
585
  if (this._predefinedColoring) {
453
- var cssField = this._cssField;
454
- var altCssField = this._altCssField;
455
- var rangeField = this._cssRangeField;
456
- var className, el, start, end, altCssClass, range, colorSelected, stretchedCell;
457
- for (r = fromR; r < toR; ++r) {
458
- className = altCssClass = "";
459
- start = end = range = null;
460
- rowData = this._getRow(dv, r);
461
- if (rowData) {
462
- className = rowData[cssField] || "";
463
- altCssClass = rowData[altCssField] || "";
464
- range = rowData[rangeField];
465
- if (Array.isArray(range)) {
466
- start = range[0];
467
- end = range[1] ? range[0] + range[1] : colCount; // handled case user provide only the start field (not provide the length of columns)
468
- }
469
- }
470
-
471
- stretchedCell = section.getStretchedCell(null, r);
472
- if (stretchedCell) {
473
- el = stretchedCell.getElement();
474
- if (el._coloringClass !== className) {
475
- if (el._coloringClass) {
476
- el.classList.remove(el._coloringClass);
477
- el._coloringClass = "";
478
- }
479
- if (className) {
480
- el.classList.add(className);
481
- el._coloringClass = className;
482
- }
483
- }
484
- }
485
- for (c = 0; c < colCount; ++c) {
486
- cell = section.getCell(c, r, false);
487
- if (!cell) {
488
- continue;
489
- }
490
- el = cell.getElement();
491
- if (!el) {
492
- continue;
493
- }
494
- if (className && range && (c < start || c > end)) {
495
- // use alternative color
496
- colorSelected = altCssClass;
497
- } else {
498
- // use normal color
499
- colorSelected = className;
500
- }
501
- if (el._coloringClass === colorSelected) {
502
- continue;
503
- }
504
- if (el._coloringClass) {
505
- el.classList.remove(el._coloringClass);
506
- el._coloringClass = "";
507
- }
508
- if (colorSelected) {
509
- el.classList.add(colorSelected);
510
- el._coloringClass = colorSelected;
511
- }
512
- }
513
- }
586
+ this._applyPredefinedColor(section, fromR, toR);
514
587
  } else {
515
- var textColor, bgColor;
516
- var txtEnabled = this._txtEnabled;
517
- var bgEnabled = this._bgEnabled;
518
- for (r = fromR; r < toR; ++r) {
519
- textColor = bgColor = "";
520
- rowData = this._getRow(dv, r);
521
- if (rowData) {
522
- if (txtEnabled) {
523
- textColor = rowData[this._txtColorField] || "";
524
- }
525
- if (bgEnabled) {
526
- bgColor = rowData[this._bgField] || "";
527
- }
528
- }
529
- stretchedCell = section.getStretchedCell(null, r);
530
- if (stretchedCell) {
531
- el = stretchedCell.getElement();
532
- if (textColor || el._textColor) {
533
- if (el._textColor !== textColor) {
534
- stretchedCell.setStyle("color", textColor);
535
- el._textColor = textColor;
536
- }
537
- }
538
- if (bgColor || el._bgColor) {
539
- if (el._bgColor !== bgColor) {
540
- stretchedCell.setStyle("backgroundColor", bgColor);
541
- el._bgColor = bgColor;
542
- }
543
- }
544
- }
545
- for (c = 0; c < colCount; ++c) {
546
- cell = section.getCell(c, r, false);
547
- if (!cell) {
548
- continue;
549
- }
550
- el = cell.getElement();
551
- if (!el) {
552
- continue;
553
- }
554
- if (textColor || el._textColor) {
555
- if (el._textColor !== textColor) {
556
- cell.setStyle("color", textColor);
557
- el._textColor = textColor;
558
- }
559
- }
560
- if (bgColor || el._bgColor) {
561
- if (el._bgColor !== bgColor) {
562
- cell.setStyle("backgroundColor", bgColor);
563
- el._bgColor = bgColor;
564
- }
565
- }
566
- }
567
- }
588
+ this._applyColor(section, fromR, toR);
589
+ }
590
+ };
591
+ /** @public
592
+ */
593
+ RowColoringPlugin.prototype.forceUpdateRowColor = function () {
594
+ if (this._disabled) {
595
+ return;
596
+ }
597
+ var dv = this._getDataView();
598
+ if (!dv) {
599
+ return;
600
+ }
601
+ var host = this._hosts ? this._hosts[0] : null;
602
+ var section = host ? host.getSection("content") : null;
603
+ if (!section) {
604
+ return;
605
+ }
606
+ var fromR = section.getFirstIndexInView();
607
+ var toR = section.getLastIndexInView() + 1;
608
+ if (this._predefinedColoring) {
609
+ this._applyPredefinedColor(section, fromR, toR);
610
+ } else {
611
+ this._applyColor(section, fromR, toR, true);
568
612
  }
569
613
  };
570
614
  export default RowColoringPlugin;
@@ -70,6 +70,10 @@ declare class CellPainter {
70
70
 
71
71
  public getColoringType(): CellPainter.ColoringTypes|null;
72
72
 
73
+ public setEffectiveStyles(mapping: any): void;
74
+
75
+ public getEffectiveStyles(): any;
76
+
73
77
  public setConditions(conditions: (CellPainter.Condition)[]|null): void;
74
78
 
75
79
  public setColumnStats(columnStats: any): void;
@@ -62,6 +62,10 @@ CellPainter.prototype._conditions = null;
62
62
  /** @type {Object}
63
63
  * @private
64
64
  */
65
+ CellPainter.prototype._effectiveStyles = null;
66
+ /** @type {Object}
67
+ * @private
68
+ */
65
69
  CellPainter.prototype._blinkCondition = null;
66
70
  /** @type {!Array}
67
71
  * @private
@@ -185,6 +189,7 @@ CellPainter.prototype.reset = function() {
185
189
  CellPainter.prototype.resetColoring = function() {
186
190
  // reset coloring type to allow other extensions to be able to set their new mode
187
191
  this._setColoringType(0);
192
+ this._effectiveStyles = null;
188
193
  this._conditions.length = 0;
189
194
  };
190
195
 
@@ -284,6 +289,18 @@ CellPainter.prototype._setColoringType = function(enumType) {
284
289
  }
285
290
  };
286
291
  /** @public
292
+ * @param {Object} mapping Effective styles mapping
293
+ */
294
+ CellPainter.prototype.setEffectiveStyles = function(mapping) {
295
+ this._effectiveStyles = mapping;
296
+ };
297
+ /** @public
298
+ * @return {Object}
299
+ */
300
+ CellPainter.prototype.getEffectiveStyles = function() {
301
+ return this._effectiveStyles;
302
+ };
303
+ /** @public
287
304
  * @param {Array.<CellPainter~Condition>} conditions
288
305
  */
289
306
  CellPainter.prototype.setConditions = function(conditions) {
@@ -901,9 +918,17 @@ CellPainter.clearCellStyle = function(cell, styles) {
901
918
  elem.classList.remove(elem._coloringCssClass);
902
919
  }
903
920
 
904
- styles = styles || CellPainter.supportedStyles;
905
- for(var i = styles.length; --i >= 0;) {
906
- elem.style[styles[i]] = ""; // WARNING: Very slow
921
+ if(!styles){
922
+ styles = CellPainter.supportedStyles;
923
+ }
924
+ if(Array.isArray(styles)){
925
+ for(var i = styles.length; --i >= 0;) {
926
+ elem.style[styles[i]] = ""; // WARNING: Very slow
927
+ }
928
+ } else {
929
+ for(var key in styles) {
930
+ elem.style[key] = ""; // WARNING: Very slow
931
+ }
907
932
  }
908
933
  };
909
934
  /** @private
@@ -1025,26 +1050,29 @@ CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
1025
1050
  }
1026
1051
 
1027
1052
  var styles = this._getStyles(rowData, min, max);
1053
+
1054
+ var elStyle = elem.style;
1055
+
1028
1056
  var cssClass = styles["cssClass"]; // Can be an empty string
1057
+ if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
1058
+ elem.classList.remove(elem._coloringCssClass);
1059
+ elem._coloringCssClass = null;
1060
+ }
1029
1061
  if (cssClass != null) { // Predefined colors mode
1030
- if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
1031
- elem.classList.remove(elem._coloringCssClass);
1032
- elem._coloringCssClass = null;
1033
- }
1034
1062
  if (cssClass) {
1035
1063
  elem.classList.add(cssClass);
1036
1064
  elem._coloringCssClass = cssClass;
1037
1065
  }
1038
1066
  } else {
1039
- if (elem._coloringCssClass) {
1040
- elem.classList.remove(elem._coloringCssClass);
1041
- elem._coloringCssClass = null;
1067
+ if(styles["backgroundColor"]){
1068
+ elStyle.backgroundColor = styles["backgroundColor"];
1069
+ } else if(!this._effectiveStyles || this._effectiveStyles["backgroundColor"]){
1070
+ elStyle.backgroundColor = "";
1042
1071
  }
1043
- var ss = CellPainter.bgStyles;
1044
- var elStyle = elem.style;
1045
- for (var n = ss.length; --n >= 0;) {
1046
- var styleName = ss[n];
1047
- elStyle[styleName] = styles[styleName] || "";
1072
+ if(styles["color"]){
1073
+ elStyle.color = styles["color"];
1074
+ } else if(!this._effectiveStyles || this._effectiveStyles["color"]){
1075
+ elStyle.color = "";
1048
1076
  }
1049
1077
  }
1050
1078
  };
@@ -91,7 +91,8 @@ ElementObserver._addListener = function(elem, fn) {
91
91
  }
92
92
  };
93
93
 
94
- /** @public Add a listener to a html lang attribute
94
+ /** Add a listener to a html lang attribute
95
+ * @public
95
96
  * @param {Element} element An element within the DOM tree to watch for changes
96
97
  */
97
98
  ElementObserver.addLanguageListener = function(element) {
@@ -17,7 +17,9 @@ var OperatorPrecedences = {
17
17
  "-": 4,
18
18
  "*": 5,
19
19
  "%": 6,
20
- "/": 6
20
+ "/": 6,
21
+ "!": 7,
22
+ "!!": 7
21
23
  };
22
24
  /** @type {Object.<string, Function>}
23
25
  * @private
@@ -36,10 +38,32 @@ var OperatorFunctions = {
36
38
  "==": function(lhs, rhs){ return lhs == rhs; },
37
39
  "!=": function(lhs, rhs){ return lhs != rhs; },
38
40
  "&&": function(lhs, rhs){ return lhs && rhs; },
39
- "||": function(lhs, rhs){ return lhs || rhs; }
41
+ "||": function(lhs, rhs){ return lhs || rhs; },
42
+ "!": function(lhs, rhs){ return !lhs; },
43
+ "!!": function(lhs, rhs){ return !!lhs; }
40
44
  };
41
45
  /** @type {Object.<string, Function>}
42
46
  * @private
47
+ * @const
48
+ */
49
+ var OperandRequirements = {
50
+ "+": 2,
51
+ "-": 2,
52
+ "*": 2,
53
+ "/": 2,
54
+ "%": 2,
55
+ "<": 2,
56
+ ">": 2,
57
+ "<=": 2,
58
+ ">=": 2,
59
+ "==": 2,
60
+ "!=": 2,
61
+ "&&": 2,
62
+ "||": 2,
63
+ "!": 1,
64
+ "!!": 1
65
+ };
66
+ /** @private
43
67
  * @function
44
68
  * @param {Array.<Object>} ary
45
69
  * @param {string|number} value
@@ -57,10 +81,20 @@ var _addToken = function(ary, value, type, dataType) {
57
81
  }
58
82
  if(type === "operator") {
59
83
  tok.precedence = OperatorPrecedences[value];
84
+ } else if(type === "parenthesis") {
85
+ tok.precedence = 0;
60
86
  }
61
87
  ary.push(tok);
62
88
  return ary.length - 1;
63
89
  };
90
+ /** @private
91
+ * @function
92
+ * @param {Object} obj
93
+ * @returns {*}
94
+ */
95
+ var _toValue = function(obj) { // eslint-disable-line
96
+ return obj.value;
97
+ };
64
98
 
65
99
  /** @public
66
100
  * @namespace
@@ -174,8 +208,9 @@ ExpressionParser._tester = function(ctx) {
174
208
  for(var i = 0; i < inputCount; ++i) {
175
209
  var tok = rpn[i];
176
210
  if(tok.type !== "literal") {
177
- if(operandCount >= 2) {
178
- operandCount -= 2;
211
+ var requiredCount = OperandRequirements[tok.value];
212
+ if(operandCount >= requiredCount) {
213
+ operandCount -= requiredCount;
179
214
  } else {
180
215
  console.warn("Cannot parse an expression with insufficient number of operands");
181
216
  return true;
@@ -216,11 +251,18 @@ ExpressionParser._filter = function(ctx, rowData) {
216
251
  curRes = rowData ? rowData[tokValue] : null;
217
252
  }
218
253
  } else { // operator
219
- curRes = OperatorFunctions[tokValue](
220
- results[operandCount - 2],
221
- results[operandCount - 1]
222
- );
223
- operandCount -= 2;
254
+ if(OperandRequirements[tokValue] === 1) {
255
+ curRes = OperatorFunctions[tokValue](
256
+ results[operandCount - 1]
257
+ );
258
+ operandCount -= 1;
259
+ } else { // 2
260
+ curRes = OperatorFunctions[tokValue](
261
+ results[operandCount - 2],
262
+ results[operandCount - 1]
263
+ );
264
+ operandCount -= 2;
265
+ }
224
266
  }
225
267
  results[operandCount++] = curRes;
226
268
  }
@@ -289,7 +331,6 @@ ExpressionParser.parse = function(expression) {
289
331
  }
290
332
  infixTokens.push(tok);
291
333
  }
292
- // TODO: Handle the case where subtraction operator is in front of a variable
293
334
  ExpressionParser._tokens.length = 0;
294
335
 
295
336
  // Convert Infix notation to Reverse Polish Notation (Postfix)
@@ -324,9 +365,10 @@ ExpressionParser.parse = function(expression) {
324
365
  }
325
366
  }
326
367
  } else { // operator
327
- lastOp = operators[operators.length - 1];
328
- var prevPrecedence = lastOp ? lastOp.precedence : null;
329
- if(prevPrecedence != null && tok.precedence <= prevPrecedence) {
368
+ while(operators.length) {
369
+ if(tok.precedence > operators[operators.length - 1].precedence) {
370
+ break;
371
+ }
330
372
  rpn.push(operators.pop());
331
373
  }
332
374
  operators.push(tok);
@@ -2,6 +2,18 @@ import { Dom } from "./Dom.js";
2
2
  import { Ext } from "./Ext.js";
3
3
  import { ElementWrapper } from "./ElementWrapper.js";
4
4
 
5
+ /** @private
6
+ * @function
7
+ * @param {Element} parentElem tr element
8
+ * @param {number} count Number of elements to be added
9
+ * @param {string} childTag Tag name of the cells
10
+ */
11
+ var _addElements = function(parentElem, count, childTag) {
12
+ for(var i = count; --i >= 0;) {
13
+ parentElem.appendChild(document.createElement(childTag));
14
+ }
15
+ };
16
+
5
17
  /** SubTable represents a single tbody, thead, or tfoot element within table element
6
18
  * @constructor
7
19
  * @extends {ElementWrapper}
@@ -39,6 +51,12 @@ SubTable.prototype._defaultRowHeight = null;
39
51
  SubTable.prototype._render;
40
52
 
41
53
 
54
+ /** @private
55
+ * @return {string} tagName
56
+ */
57
+ SubTable.prototype._getCellTagName = function() {
58
+ return this._elem.tagName === "THEAD" ? "TH" : "TD";
59
+ };
42
60
  /** @public
43
61
  * @ignore
44
62
  * @param {number=} opt_count
@@ -49,12 +67,10 @@ SubTable.prototype.addColumns = function(opt_count) {
49
67
 
50
68
  this._colCount += opt_count;
51
69
 
70
+ var cellTag = this._getCellTagName();
52
71
  var rows = this._elem.children; // TODO: Must include all suspended rows
53
72
  for(var r = rows.length; --r >= 0;) {
54
- var tr = rows[r];
55
- for(var c = 0; c < opt_count; ++c) {
56
- tr.insertCell(-1);
57
- }
73
+ _addElements(rows[r], opt_count, cellTag);
58
74
  }
59
75
  };
60
76
  /** @public
@@ -100,9 +116,7 @@ SubTable.prototype.setColumnCount = function(val) {
100
116
  */
101
117
  SubTable.prototype.insertRow = function(at) {
102
118
  var row = this._elem.insertRow(at);
103
- for(var i = this._colCount; --i >= 0;) {
104
- row.insertCell();
105
- }
119
+ _addElements(row, this._colCount, this._getCellTagName());
106
120
  return row;
107
121
  };
108
122
 
@@ -58,6 +58,8 @@ declare class Table extends ElementWrapper {
58
58
 
59
59
  public getAllRows(): (Element)[];
60
60
 
61
+ public getRows(): (Element)[];
62
+
61
63
  public getRow(r: number): Element|null;
62
64
 
63
65
  public spanBlock(c1: number, c2: number, r1: number, r2: number): Element|null;
@@ -331,6 +331,7 @@ Table.prototype.getAllCells = function() { return this._tbody.getAllCells(); };
331
331
  */
332
332
  Table.prototype.getAllRows = function() { return this._tbody.getAllRows(); };
333
333
  /** @public
334
+ * @function
334
335
  * @return {!Array<Element>} Array of tr (HTMLTableRowElement) elements
335
336
  */
336
337
  Table.prototype.getRows = Table.prototype.getAllRows;