@refinitiv-ui/efx-grid 6.1.0 → 6.1.2

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.
package/lib/grid/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import {Grid} from "./lib/efx-grid.js";
2
2
  export {Grid}
3
- window.EFX_GRID = { version: "6.0.170" };
3
+ window.EFX_GRID = { version: "6.1.2" };
@@ -76,6 +76,18 @@ CellWriter.prototype.setTooltip = function (str) {
76
76
  this._elem.removeAttribute("title");
77
77
  }
78
78
  };
79
+ /** @public
80
+ * @ignore
81
+ * @param {string} type
82
+ * @param {*=} tooltip
83
+ */
84
+ CellWriter.prototype.setTooltipInfo = function(type, tooltip) {
85
+ };
86
+ /** @public
87
+ * @ignore
88
+ */
89
+ CellWriter.prototype.updateTooltip = function() {
90
+ };
79
91
 
80
92
  /** @public
81
93
  * @param {string} str
@@ -29,10 +29,11 @@ let _getPageSize = function (options) {
29
29
  pageHeight = options["pageHeight"];
30
30
  }
31
31
  }
32
- if (!pageWidth) {
32
+ // WARNING: clientWidth and clientHeight still include padding from the element
33
+ if (!pageWidth || pageWidth < 0) {
33
34
  pageWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
34
35
  }
35
- if (!pageHeight) {
36
+ if (!pageHeight || pageHeight < 0) {
36
37
  pageHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
37
38
  }
38
39
 
@@ -109,7 +110,7 @@ let _setColumnAlignment = function (tbl, colIndex, alignment) {
109
110
  if (!cells) return;
110
111
  for (let i = cells.length; --i >= 0;) {
111
112
  let cell = cells[i];
112
- cell.classList.add("tr-align-" + alignment);
113
+ cell.style.textAlign = alignment;
113
114
  }
114
115
  };
115
116
 
@@ -215,13 +216,13 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
215
216
  }
216
217
  pfInfo._calculated = false;
217
218
  if (GridPrinter._options["pageWidth"]) {
218
- options.pageWidth = GridPrinter._options["pageWidth"];
219
+ pfInfo.pageWidth = GridPrinter._options["pageWidth"];
219
220
  }
220
221
  if (GridPrinter._options["pageHeight"]) {
221
- options.pageHeight = GridPrinter._options["pageHeight"];
222
+ pfInfo.pageHeight = GridPrinter._options["pageHeight"];
222
223
  }
223
224
 
224
- let pageSize = _getPageSize(options);
225
+ let pageSize = _getPageSize(pfInfo);
225
226
  let pageWidth = pfInfo.pageWidth = pageSize.pageWidth;
226
227
  let pageHeight = pfInfo.pageHeight = pageSize.pageHeight;
227
228
 
@@ -320,14 +321,21 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
320
321
  // Find cutoff point for each page
321
322
  let titleSect = grid.getSection("title");
322
323
  let headerHeight = pfInfo.headerHeight = (titleSect.isVisible()) ? titleSect.getDefaultRowHeight() : 0;
324
+ let availableSpace = pageHeight - headerHeight;
325
+
323
326
  let rowHeight = pfInfo.rowHeight = grid.getSection("content").getDefaultRowHeight();
324
- let maxRowPerPage = (pageHeight - headerHeight) / rowHeight | 0;
327
+ let maxRowPerPage = totalRowCount;
328
+ if(availableSpace < (totalRowCount * rowHeight)) {
329
+ maxRowPerPage = Math.floor(availableSpace / rowHeight);
330
+ }
331
+
325
332
  if (!(maxRowPerPage > 0)) { // NaN, negative number, or zero is not allowed.
326
333
  maxRowPerPage = 1; // number of content rows
327
334
  }
328
335
  pfInfo.maxRowPerPage = maxRowPerPage;
329
336
 
330
- let gridCount = pfInfo.gridCount = Math.ceil(totalRowCount / maxRowPerPage); // Number of grid require to render all of the rows. Grid must fit a single page
337
+ // Number of grid require to render all of the rows. Grid must fit a single page
338
+ let gridCount = pfInfo.gridCount = (totalRowCount > maxRowPerPage) ? Math.ceil(totalRowCount / maxRowPerPage) : 1;
331
339
  // let lastPageRowCount = totalRowCount - (totalRowCount / maxRowPerPage | 0);
332
340
  pfInfo.pageCount = gridCount * colSetCount;
333
341
 
@@ -517,15 +525,6 @@ GridPrinter._applyCss = function () {
517
525
  "color: black;",
518
526
  "background-color: white;"
519
527
  ],
520
- ".tr-printing-root .tr-align-left", [
521
- "text-align: left;"
522
- ],
523
- ".tr-printing-root .tr-align-right", [
524
- "text-align: right;"
525
- ],
526
- ".tr-printing-root .tr-align-center", [
527
- "text-align: center;"
528
- ],
529
528
  ".tr-printing-root .cell ef-icon", [
530
529
  "margin-top: 3px;"
531
530
  ],
package/lib/versions.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "tr-grid-util": "1.3.178",
3
- "tr-grid-printer": "1.0.18",
3
+ "tr-grid-printer": "1.0.19",
4
4
  "@grid/column-dragging": "1.0.22",
5
5
  "@grid/row-segmenting": "2.0.3",
6
6
  "@grid/statistics-row": "1.0.17",
package/package.json CHANGED
@@ -77,5 +77,5 @@
77
77
  "publishConfig": {
78
78
  "access": "public"
79
79
  },
80
- "version": "6.1.0"
80
+ "version": "6.1.2"
81
81
  }