@refinitiv-ui/efx-grid 6.0.105 → 6.0.107
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/core/dist/core.js +12 -11
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +7 -8
- package/lib/core/es6/grid/ILayoutGrid.js +1 -1
- package/lib/core/es6/grid/components/Scrollbar.js +4 -2
- package/lib/filter-dialog/lib/filter-dialog.d.ts +2 -0
- package/lib/filter-dialog/lib/filter-dialog.js +23 -1
- package/lib/filter-dialog/themes/base-checkbox.less +1 -2
- package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
- package/lib/formatters/es6/FormatterBuilder.js +10 -1
- package/lib/formatters/es6/SimpleTickerFormatter.d.ts +0 -2
- package/lib/formatters/es6/SimpleTickerFormatter.js +1 -0
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +32 -15
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/FieldDefinition.d.ts +2 -0
- package/lib/rt-grid/es6/FieldDefinition.js +20 -4
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +128 -89
- package/lib/tr-grid-printer/es6/CellWriter.d.ts +6 -5
- package/lib/tr-grid-printer/es6/CellWriter.js +57 -49
- package/lib/tr-grid-printer/es6/ColumnWriter.d.ts +1 -0
- package/lib/tr-grid-printer/es6/ColumnWriter.js +3 -1
- package/lib/tr-grid-printer/es6/GridPrinter.js +117 -99
- package/lib/tr-grid-printer/es6/PrintTrait.d.ts +1 -0
- package/lib/tr-grid-printer/es6/PrintTrait.js +60 -47
- package/lib/tr-grid-printer/es6/SectionWriter.d.ts +4 -1
- package/lib/tr-grid-printer/es6/SectionWriter.js +40 -15
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +14 -0
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +6 -0
- package/lib/tr-grid-util/es6/MultiTableManager.js +1 -0
- package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +2 -0
- package/lib/types/es6/SimpleTickerFormatter.d.ts +0 -2
- package/lib/versions.json +7 -7
- package/package.json +1 -1
@@ -9,7 +9,7 @@ import { SectionWriter } from "./SectionWriter.js";
|
|
9
9
|
/** @private
|
10
10
|
* @type {Node}
|
11
11
|
*/
|
12
|
-
|
12
|
+
let _dummyNode = null;
|
13
13
|
|
14
14
|
|
15
15
|
/** TODO: Move this logic to PrintTrait
|
@@ -17,9 +17,9 @@ var _dummyNode = null;
|
|
17
17
|
* @param {Object=} options
|
18
18
|
* @return {!Object}
|
19
19
|
*/
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
let _getPageSize = function (options) {
|
21
|
+
let pageWidth = 0;
|
22
|
+
let pageHeight = 0;
|
23
23
|
|
24
24
|
if (options) {
|
25
25
|
if (options["pageWidth"]) {
|
@@ -50,7 +50,7 @@ var _getPageSize = function (options) {
|
|
50
50
|
* @param {Node} nodeA
|
51
51
|
* @param {Node} nodeB
|
52
52
|
*/
|
53
|
-
|
53
|
+
let swapNode = function (nodeA, nodeB) {
|
54
54
|
if (!nodeA || !nodeB || !nodeA.parentNode || !nodeB.parentNode) {
|
55
55
|
Dom.removeParent(nodeA);
|
56
56
|
Dom.removeParent(nodeB);
|
@@ -69,9 +69,9 @@ var swapNode = function (nodeA, nodeB) {
|
|
69
69
|
* @param {Node} fromNode
|
70
70
|
* @param {Node} toNode
|
71
71
|
*/
|
72
|
-
|
72
|
+
let copyNode = function (fromNode, toNode) {
|
73
73
|
if (fromNode && toNode) {
|
74
|
-
|
74
|
+
let i, attrs;
|
75
75
|
if (toNode.hasAttributes()) {
|
76
76
|
attrs = toNode.attributes;
|
77
77
|
for (i = attrs.length; --i >= 0;) {
|
@@ -88,8 +88,8 @@ var copyNode = function (fromNode, toNode) {
|
|
88
88
|
|
89
89
|
Dom.removeChildren(toNode);
|
90
90
|
|
91
|
-
|
92
|
-
|
91
|
+
let chdr = fromNode.childNodes;
|
92
|
+
let childCount = chdr.length;
|
93
93
|
for (i = 0; i < childCount; ++i) {
|
94
94
|
toNode.appendChild(chdr[i].cloneNode(true));
|
95
95
|
}
|
@@ -101,14 +101,14 @@ var copyNode = function (fromNode, toNode) {
|
|
101
101
|
* @param {number} colIndex
|
102
102
|
* @param {string} alignment
|
103
103
|
*/
|
104
|
-
|
104
|
+
let _setColumnAlignment = function (tbl, colIndex, alignment) {
|
105
105
|
if (!alignment || alignment === "default") {
|
106
106
|
return;
|
107
107
|
}
|
108
|
-
|
108
|
+
let cells = tbl.getCellsInColumn(colIndex);
|
109
109
|
if (!cells) return;
|
110
|
-
for (
|
111
|
-
|
110
|
+
for (let i = cells.length; --i >= 0;) {
|
111
|
+
let cell = cells[i];
|
112
112
|
cell.classList.add("tr-align-" + alignment);
|
113
113
|
}
|
114
114
|
};
|
@@ -117,8 +117,8 @@ var _setColumnAlignment = function (tbl, colIndex, alignment) {
|
|
117
117
|
* @param {*} grid grid element, currently supports atlas-blotter, ef-grid, tr.CompositeGrid, rt.Grid and Core
|
118
118
|
* @return {Object} core grid
|
119
119
|
*/
|
120
|
-
|
121
|
-
|
120
|
+
let _getCoreGrid = function (grid) {
|
121
|
+
let core = null;
|
122
122
|
try {
|
123
123
|
if (grid.api) { // ef-grid or atlas-blotter
|
124
124
|
core = grid.api.getCoreGrid();
|
@@ -136,7 +136,7 @@ var _getCoreGrid = function (grid) {
|
|
136
136
|
|
137
137
|
/** @namespace
|
138
138
|
*/
|
139
|
-
|
139
|
+
let GridPrinter = {};
|
140
140
|
/** @private
|
141
141
|
* @type {string}
|
142
142
|
*/
|
@@ -156,7 +156,7 @@ GridPrinter._grid = null;
|
|
156
156
|
/** @type {boolean}
|
157
157
|
* @private
|
158
158
|
*/
|
159
|
-
GridPrinter.
|
159
|
+
GridPrinter._manualObs = false;
|
160
160
|
/** @type {!Object}
|
161
161
|
* @private
|
162
162
|
*/
|
@@ -177,14 +177,16 @@ GridPrinter.setPrintOptions = function (options) {
|
|
177
177
|
* @param {HTMLIFrameElement=} iFrameElement If not specified, current window is used instead. Specify null to un-observe existing window object.
|
178
178
|
*/
|
179
179
|
GridPrinter.observe = function (iFrameElement) {
|
180
|
-
|
180
|
+
let pt = GridPrinter.getPrintTrait();
|
181
181
|
pt.observe(iFrameElement);
|
182
|
-
GridPrinter.
|
182
|
+
GridPrinter._manualObs = pt.isObserving();
|
183
183
|
};
|
184
184
|
/** @public
|
185
185
|
*/
|
186
186
|
GridPrinter.unobserve = function () {
|
187
|
-
GridPrinter.
|
187
|
+
let pt = GridPrinter.getPrintTrait();
|
188
|
+
pt.unobserve();
|
189
|
+
GridPrinter._manualObs = pt.isObserving();
|
188
190
|
};
|
189
191
|
/** @public
|
190
192
|
* @param {boolean=} bool
|
@@ -199,7 +201,7 @@ GridPrinter.enableDebugMode = function (bool) {
|
|
199
201
|
* @return {!Object}
|
200
202
|
*/
|
201
203
|
GridPrinter.getPreFlightInfo = function (grid, options) {
|
202
|
-
|
204
|
+
let pfInfo = options || {};
|
203
205
|
if (!pfInfo.pageCount) {
|
204
206
|
pfInfo.pageCount = 0;
|
205
207
|
}
|
@@ -207,7 +209,7 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
|
|
207
209
|
return pfInfo;
|
208
210
|
}
|
209
211
|
|
210
|
-
|
212
|
+
let colCount = grid.getColumnCount();
|
211
213
|
if (!colCount) {
|
212
214
|
return pfInfo;
|
213
215
|
}
|
@@ -219,14 +221,14 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
|
|
219
221
|
options.pageHeight = GridPrinter._options["pageHeight"];
|
220
222
|
}
|
221
223
|
|
222
|
-
|
223
|
-
|
224
|
-
|
224
|
+
let pageSize = _getPageSize(options);
|
225
|
+
let pageWidth = pfInfo.pageWidth = pageSize.pageWidth;
|
226
|
+
let pageHeight = pfInfo.pageHeight = pageSize.pageHeight;
|
225
227
|
|
226
228
|
// Find primary column that will exist in every page
|
227
|
-
|
228
|
-
|
229
|
-
|
229
|
+
let c;
|
230
|
+
let primaryColIndex = 0;
|
231
|
+
let identifierCol = GridPrinter._options["identifierField"] || GridPrinter._options["primaryColumn"];
|
230
232
|
// if(typeof identifierCol === "string") {
|
231
233
|
// for(c = 0; c < colCount; ++c) {
|
232
234
|
// if() {
|
@@ -237,21 +239,21 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
|
|
237
239
|
primaryColIndex = identifierCol;
|
238
240
|
}
|
239
241
|
|
240
|
-
|
242
|
+
let primaryCol = pfInfo.primaryColumn = GridPrinter._newColInfo(grid, primaryColIndex);
|
241
243
|
|
242
244
|
// Collect properties from all visible columns
|
243
245
|
// Create a column set that fit the page width
|
244
246
|
// Create multiple column sets for single grid
|
245
|
-
|
246
|
-
|
247
|
-
//
|
248
|
-
|
247
|
+
let colSets = []; // Each set will fit a single page
|
248
|
+
let colSet, colInfo;
|
249
|
+
// let defaultMinWidth = 50; // WARNING: Hardcoded value
|
250
|
+
let availSpace = 0;
|
249
251
|
for (c = 0; c < colCount; ++c) {
|
250
252
|
if (c == primaryCol.index) {
|
251
253
|
continue;
|
252
254
|
}
|
253
255
|
|
254
|
-
|
256
|
+
let colVisible = grid.isColumnVisible(c);
|
255
257
|
if (!colVisible) {
|
256
258
|
continue;
|
257
259
|
}
|
@@ -272,7 +274,7 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
|
|
272
274
|
}
|
273
275
|
|
274
276
|
|
275
|
-
|
277
|
+
let colSetCount = colSets.length;
|
276
278
|
if (!colSetCount) {
|
277
279
|
colSetCount = 1;
|
278
280
|
colSets.push([primaryCol]);
|
@@ -280,10 +282,10 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
|
|
280
282
|
pfInfo.columnSets = colSets;
|
281
283
|
|
282
284
|
// Resolve scalable columns and width
|
283
|
-
for (
|
285
|
+
for (let i = 0; i < colSetCount; ++i) {
|
284
286
|
colSet = colSets[i];
|
285
287
|
colCount = colSet.columns.length;
|
286
|
-
|
288
|
+
let scalableColumns = [];
|
287
289
|
availSpace = pageWidth;
|
288
290
|
for (c = 0; c < colCount; ++c) {
|
289
291
|
colInfo = colSet.columns[c];
|
@@ -293,16 +295,16 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
|
|
293
295
|
availSpace -= colInfo.width;
|
294
296
|
}
|
295
297
|
}
|
296
|
-
|
298
|
+
let scalableColCount = scalableColumns.length;
|
297
299
|
if (scalableColCount) {
|
298
|
-
|
300
|
+
let avgWidth = (availSpace / scalableColCount); // TODO: Take min width into account
|
299
301
|
for (c = 0; c < scalableColCount; ++c) {
|
300
302
|
scalableColumns[c].width = (avgWidth * (c + 1) | 0) - (avgWidth * c | 0);
|
301
303
|
}
|
302
304
|
}
|
303
305
|
|
304
|
-
|
305
|
-
|
306
|
+
let totalWidth = 0;
|
307
|
+
let widths = colSet.widths = new Array(colCount);
|
306
308
|
for (c = 0; c < colCount; ++c) {
|
307
309
|
colInfo = colSet.columns[c];
|
308
310
|
widths[c] = colInfo.width;
|
@@ -312,21 +314,21 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
|
|
312
314
|
}
|
313
315
|
|
314
316
|
// Find total row count per table. Remove all empty rows after the last occupied row.
|
315
|
-
|
316
|
-
|
317
|
+
let dv = grid.getDataSource();
|
318
|
+
let totalRowCount = pfInfo.totalRowcount = dv.getVisibleRowCount();
|
317
319
|
|
318
320
|
// Find cutoff point for each page
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
321
|
+
let titleSect = grid.getSection("title");
|
322
|
+
let headerHeight = pfInfo.headerHeight = (titleSect.isVisible()) ? titleSect.getDefaultRowHeight() : 0;
|
323
|
+
let rowHeight = pfInfo.rowHeight = grid.getSection("content").getDefaultRowHeight();
|
324
|
+
let maxRowPerPage = (pageHeight - headerHeight) / rowHeight | 0;
|
323
325
|
if (!(maxRowPerPage > 0)) { // NaN, negative number, or zero is not allowed.
|
324
326
|
maxRowPerPage = 1; // number of content rows
|
325
327
|
}
|
326
328
|
pfInfo.maxRowPerPage = maxRowPerPage;
|
327
329
|
|
328
|
-
|
329
|
-
//
|
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
|
331
|
+
// let lastPageRowCount = totalRowCount - (totalRowCount / maxRowPerPage | 0);
|
330
332
|
pfInfo.pageCount = gridCount * colSetCount;
|
331
333
|
|
332
334
|
|
@@ -334,10 +336,10 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
|
|
334
336
|
// if(colSetCount == 1 && pageCount > 1) {
|
335
337
|
// availSpace = pageWidth;
|
336
338
|
// tableWidth = tables[0]._width;
|
337
|
-
//
|
339
|
+
// let numGridPerPage = Math.floor(pageWidth / tableWidth);
|
338
340
|
|
339
|
-
//
|
340
|
-
//
|
341
|
+
// let margin = 4;
|
342
|
+
// let takenSpace = numTablePerPage * tableWidth + (numTablePerPage - 1) * margin;
|
341
343
|
// if(takenSpace > pageWidth) {
|
342
344
|
// numGridPerPage--; // There is not enough space for margin
|
343
345
|
// }
|
@@ -367,46 +369,47 @@ GridPrinter.createPrintElement = function (grid, options) {
|
|
367
369
|
return null;
|
368
370
|
}
|
369
371
|
|
370
|
-
|
372
|
+
let pfInfo = options || GridPrinter._printInfo;
|
371
373
|
if (!pfInfo || !pfInfo._calculated) {
|
372
374
|
pfInfo = GridPrinter.getPreFlightInfo(grid, pfInfo);
|
373
375
|
}
|
374
376
|
|
375
377
|
// TODO: Check if we need to recalculate everything again
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
378
|
+
let maxRowPerPage = pfInfo.maxRowPerPage;
|
379
|
+
let totalRowCount = pfInfo.totalRowcount;
|
380
|
+
let rowHeight = pfInfo.rowHeight;
|
381
|
+
let headerHeight = pfInfo.headerHeight;
|
382
|
+
let colSets = pfInfo.columnSets;
|
383
|
+
let colSetCount = pfInfo.columnSets.length;
|
384
|
+
let primaryColumn = pfInfo.primaryColumn;
|
385
|
+
let gridCount = pfInfo.gridCount;
|
386
|
+
let contentWriter = new SectionWriter(); // content section
|
387
|
+
let headerWriter = new SectionWriter();
|
388
|
+
|
389
|
+
let gridContentSection = grid.getSectionSettings("content");
|
388
390
|
gridContentSection.snapshot(contentWriter);
|
389
391
|
|
390
|
-
|
392
|
+
let gridHeaderSection = grid.getSectionSettings("title");
|
391
393
|
if (gridHeaderSection) {
|
392
394
|
gridHeaderSection.snapshot(headerWriter);
|
393
395
|
}
|
394
396
|
|
395
397
|
// Begin element construction
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
398
|
+
let tables = [];
|
399
|
+
let t;
|
400
|
+
for (t = 0; t < gridCount; ++t) { // For each table
|
401
|
+
let rowStart = t * maxRowPerPage;
|
402
|
+
let rowEnd = rowStart + maxRowPerPage;
|
400
403
|
if (rowEnd > totalRowCount) {
|
401
404
|
rowEnd = totalRowCount;
|
402
405
|
}
|
403
|
-
|
406
|
+
let rowCount = rowEnd - rowStart;
|
404
407
|
|
405
|
-
for (
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
408
|
+
for (let s = 0; s < colSetCount; ++s) { // For each column set
|
409
|
+
let colSet = colSets[s];
|
410
|
+
let colCount = colSet.columns.length;
|
411
|
+
let c, col, colIndex;
|
412
|
+
let tbl = new Table(null, {
|
410
413
|
colCount: colCount,
|
411
414
|
rowCount: rowCount,
|
412
415
|
rowHeight: rowHeight
|
@@ -416,7 +419,7 @@ GridPrinter.createPrintElement = function (grid, options) {
|
|
416
419
|
|
417
420
|
if (headerHeight) {
|
418
421
|
tbl.addHeaderRows(); // TODO: support multiple rows
|
419
|
-
|
422
|
+
let thead = tbl.getHeader();
|
420
423
|
thead.setDefaultRowHeight(headerHeight);
|
421
424
|
|
422
425
|
// Render header columns
|
@@ -434,12 +437,12 @@ GridPrinter.createPrintElement = function (grid, options) {
|
|
434
437
|
for (c = 0; c < colCount; ++c) { // Populate each cell
|
435
438
|
col = colSet.columns[c];
|
436
439
|
colIndex = col.index;
|
437
|
-
|
440
|
+
let isPrimary = colIndex === primaryColumn.index;
|
438
441
|
|
439
|
-
for (
|
440
|
-
|
441
|
-
|
442
|
-
|
442
|
+
for (let r = 0; r < rowCount; ++r) {
|
443
|
+
let rowIndex = rowStart + r;
|
444
|
+
let masterCell = contentWriter.getCellElement(colIndex, rowIndex);
|
445
|
+
let cell = tbl.getCell(c, r);
|
443
446
|
if (isPrimary) {
|
444
447
|
copyNode(masterCell, cell);
|
445
448
|
} else {
|
@@ -456,8 +459,8 @@ GridPrinter.createPrintElement = function (grid, options) {
|
|
456
459
|
}
|
457
460
|
|
458
461
|
// Produce the root element to be appended to the page
|
459
|
-
|
460
|
-
|
462
|
+
let pageCount = pfInfo.pageCount;
|
463
|
+
let rootElem = document.createElement("div");
|
461
464
|
rootElem.className = "tr-printing-root";
|
462
465
|
rootElem.style.display = "block"; // This will beat any CSS selector
|
463
466
|
for (t = 0; t < pageCount; ++t) {
|
@@ -650,7 +653,7 @@ GridPrinter._applyCss = function () {
|
|
650
653
|
* @param {*} grid grid element, currently supports efx-grid, atlas-blotter, ef-grid, tr.CompositeGrid, rt.Grid and Core
|
651
654
|
*/
|
652
655
|
GridPrinter.print = function (grid) {
|
653
|
-
|
656
|
+
let core = null;
|
654
657
|
if (grid) {
|
655
658
|
GridPrinter._applyCss();
|
656
659
|
core = _getCoreGrid(grid);
|
@@ -659,8 +662,8 @@ GridPrinter.print = function (grid) {
|
|
659
662
|
if (core) {
|
660
663
|
GridPrinter._grid = core;
|
661
664
|
|
662
|
-
|
663
|
-
if (!GridPrinter.
|
665
|
+
let pt = GridPrinter.getPrintTrait(); // initialize
|
666
|
+
if (!GridPrinter._manualObs) {
|
664
667
|
pt.observe(); // Observe current window
|
665
668
|
}
|
666
669
|
|
@@ -671,20 +674,35 @@ GridPrinter.print = function (grid) {
|
|
671
674
|
};
|
672
675
|
|
673
676
|
|
674
|
-
/** @
|
677
|
+
/** @public
|
678
|
+
* @ignore
|
675
679
|
* @return {!PrintTrait}
|
676
680
|
*/
|
677
|
-
GridPrinter.
|
678
|
-
|
681
|
+
GridPrinter.getPrintTrait = function () {
|
682
|
+
let pt = GridPrinter._printTrait;
|
679
683
|
if (!pt) {
|
680
|
-
pt =
|
681
|
-
|
684
|
+
pt = new PrintTrait();
|
685
|
+
GridPrinter.setPrintTrait(pt);
|
686
|
+
}
|
687
|
+
return pt;
|
688
|
+
};
|
689
|
+
/** @public
|
690
|
+
* @ignore
|
691
|
+
* @param {PrintTrait} pt
|
692
|
+
*/
|
693
|
+
GridPrinter.setPrintTrait = function (pt) {
|
694
|
+
if(GridPrinter._printTrait && GridPrinter._printTrait !== pt) {
|
695
|
+
GridPrinter._printTrait.dispose();
|
696
|
+
}
|
697
|
+
|
698
|
+
GridPrinter._printTrait = pt || null;
|
699
|
+
if (pt) {
|
700
|
+
// TODO: pt.fixPaperSize(); // WORKAROUND: We cannot detect the change in paper size during the browser's preview dialog.
|
682
701
|
|
683
702
|
pt.addEventListener('pageCounting', GridPrinter._onPageCounting);
|
684
703
|
pt.addEventListener('beforeprint', GridPrinter._onBeforePrint);
|
685
704
|
pt.addEventListener('afterprint', GridPrinter._onAfterPrint);
|
686
705
|
}
|
687
|
-
return pt;
|
688
706
|
};
|
689
707
|
/** @private
|
690
708
|
* @param {tr.Grid} grid
|
@@ -692,12 +710,12 @@ GridPrinter._getPrintTrait = function () {
|
|
692
710
|
* @return {!Object}
|
693
711
|
*/
|
694
712
|
GridPrinter._newColInfo = function (grid, idx) {
|
695
|
-
|
713
|
+
let minWidth = grid.getMinimumColumnWidth(idx);
|
696
714
|
if (minWidth <= 0) {
|
697
715
|
minWidth = 50; // WARNING: Hard-coded value
|
698
716
|
}
|
699
|
-
|
700
|
-
|
717
|
+
let scalability = grid.getColumnScalability(idx);
|
718
|
+
let width = scalability ? minWidth : grid.getColumnWidth(idx);
|
701
719
|
|
702
720
|
return {
|
703
721
|
"index": idx,
|
@@ -741,7 +759,7 @@ GridPrinter._onBeforePrint = function (e) {
|
|
741
759
|
if (GridPrinter._printInfo && GridPrinter._printInfo.pageCount) {
|
742
760
|
GridPrinter._printElem = GridPrinter.createPrintElement(GridPrinter._grid, GridPrinter._printInfo); // TODO: Use new sizes given from PrintTrait
|
743
761
|
|
744
|
-
//
|
762
|
+
// let elem = GridPrinter._printTrait.createClientBox(e.pageWidth, e.pageHeight);
|
745
763
|
e.bodyElement.appendChild(GridPrinter._printElem);
|
746
764
|
}
|
747
765
|
};
|
@@ -751,8 +769,8 @@ GridPrinter._onBeforePrint = function (e) {
|
|
751
769
|
GridPrinter._onAfterPrint = function (e) {
|
752
770
|
GridPrinter._removePrintElements();
|
753
771
|
|
754
|
-
if (!GridPrinter.
|
755
|
-
GridPrinter.
|
772
|
+
if (!GridPrinter._manualObs) {
|
773
|
+
GridPrinter.getPrintTrait().unobserve();
|
756
774
|
}
|
757
775
|
|
758
776
|
GridPrinter._printInfo = null;
|