vue2-excel-grid 1.1.117 → 1.1.118

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * vue2-excel-grid v1.1.117
2
+ * vue2-excel-grid v1.1.118
3
3
  * (c) 2026
4
4
  * Released under the MIT License.
5
5
  */
@@ -1658,13 +1658,38 @@ function buildPrintTableHtml(_ref) {
1658
1658
  var rawWidths = exportCols.map(function (col) {
1659
1659
  return colWidths && colWidths[col._flatIndex] > 0 ? colWidths[col._flatIndex] : 100;
1660
1660
  });
1661
- var totalWidth = rawWidths.reduce(function (sum, w) {
1661
+
1662
+ // Never let a column's configured col.width squeeze its OWN header label
1663
+ // into an ellipsis — a short word like "Миқдори"/"Фоизи" should always
1664
+ // render in full; only a genuinely long title should ever truncate. No
1665
+ // real text metrics exist yet (the print document doesn't exist while
1666
+ // building this string), so this estimates each header's needed width the
1667
+ // same way excelExport.js already approximates Excel column widths
1668
+ // ("~7px per character"), scaled to the header font-size/weight actually
1669
+ // in use. Each column's width becomes max(configured, needed-for-header)
1670
+ // — a column configured deliberately wide for long DATA (not header) text
1671
+ // still keeps that width; only ones too narrow for their own label grow.
1672
+ var fontSizePx = parseInt(fontSize, 10) || 12;
1673
+ var avgHeaderCharWidthPx = fontSizePx * 0.62; // bold sans-serif average glyph advance
1674
+ var paddingParts = cellPadding.split(' ').map(function (p) {
1675
+ return parseInt(p, 10) || 0;
1676
+ });
1677
+ var paddingHPx = paddingParts.length > 1 ? paddingParts[1] : paddingParts[0];
1678
+ var CELL_BORDER_PX = 2; // 1px border on each side
1679
+ var minHeaderWidths = exportCols.map(function (col) {
1680
+ var title = col.title || '';
1681
+ return Math.ceil(title.length * avgHeaderCharWidthPx) + paddingHPx * 2 + CELL_BORDER_PX;
1682
+ });
1683
+ var adjustedWidths = rawWidths.map(function (w, i) {
1684
+ return Math.max(w, minHeaderWidths[i]);
1685
+ });
1686
+ var totalWidth = adjustedWidths.reduce(function (sum, w) {
1662
1687
  return sum + w;
1663
1688
  }, 0) || 1;
1664
- var colgroupHtml = '<colgroup>' + rawWidths.map(function (w) {
1689
+ var colgroupHtml = '<colgroup>' + adjustedWidths.map(function (w) {
1665
1690
  return "<col style=\"width:".concat((w / totalWidth * 100).toFixed(3), "%\">");
1666
1691
  }).join('') + '</colgroup>';
1667
- return "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>Print</title>\n<style>\n* { box-sizing: border-box; }\nbody { font-family: Arial, Helvetica, sans-serif; font-size: ".concat(fontSize, "; color: #000; margin: 0; padding: 16px; }\n/* table-layout:fixed makes the <colgroup> percentages authoritative \u2014\n without it the browser re-derives widths from cell CONTENT instead\n (table-layout:auto), defeating the whole point of sizing columns\n proportionally to the grid's own configured widths. */\ntable { border-collapse: collapse; width: 100%; table-layout: fixed; }\nth, td { border: 1px solid #999; padding: ").concat(cellPadding, "; text-align: left; }\n/* Header labels are short \u2014 never wrap them (avoids single-word headers\n like \"\u041C\u0438\u049B\u0434\u043E\u0440\u0438\"/\"\u0421\u0447\u0451\u0442\u0438\" collapsing into a vertical letter-by-letter\n column); if a column's proportional width still isn't enough for its\n own label, clip with an ellipsis rather than overflow the cell border.\n Data cells wrap normally at word boundaries, only breaking mid-word\n (overflow-wrap) when a single unbroken token genuinely doesn't fit \u2014\n word-break:break-word is deliberately NOT used here, it breaks far more\n eagerly than needed now that columns have a real, proportional width. */\nth { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\ntd { word-break: normal; overflow-wrap: break-word; }\nthead th { background: #f0f0f0; font-weight: bold; text-align: center; }\ntfoot td { font-weight: bold; background: #f7f7f7; }\n@page { size: ").concat(orientation, "; margin: 12mm; }\n</style>\n</head>\n<body>\n<table>\n").concat(colgroupHtml, "\n<thead>").concat(theadRowsHtml, "</thead>\n<tbody>").concat(tbodyRowsHtml, "</tbody>\n").concat(tfootHtml, "\n</table>\n</body>\n</html>");
1692
+ return "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<title>Print</title>\n<style>\n* { box-sizing: border-box; }\nbody { font-family: Arial, Helvetica, sans-serif; font-size: ".concat(fontSize, "; color: #000; margin: 0; padding: 16px; }\n/* table-layout:fixed makes the <colgroup> percentages authoritative \u2014\n without it the browser re-derives widths from cell CONTENT instead\n (table-layout:auto), defeating the whole point of sizing columns\n proportionally to the grid's own configured widths. */\ntable { border-collapse: collapse; width: 100%; table-layout: fixed; }\nth, td { border: 1px solid #999; padding: ").concat(cellPadding, "; text-align: left; }\n/* Header labels never wrap (avoids single-word headers like \"\u041C\u0438\u049B\u0434\u043E\u0440\u0438\"/\n \"\u0421\u0447\u0451\u0442\u0438\" collapsing into a vertical letter-by-letter column) \u2014 each\n column's width is already grown to fit its own header (see\n minHeaderWidths above), so this only ever clips with an ellipsis for a\n genuinely long title that a whole page still can't accommodate.\n Data cells wrap normally at word boundaries, only breaking mid-word\n (overflow-wrap) when a single unbroken token genuinely doesn't fit \u2014\n word-break:break-word is deliberately NOT used here, it breaks far more\n eagerly than needed now that columns have a real, proportional width. */\nth { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\ntd { word-break: normal; overflow-wrap: break-word; }\nthead th { background: #f0f0f0; font-weight: bold; text-align: center; }\ntfoot td { font-weight: bold; background: #f7f7f7; }\n@page { size: ").concat(orientation, "; margin: 12mm; }\n</style>\n</head>\n<body>\n<table>\n").concat(colgroupHtml, "\n<thead>").concat(theadRowsHtml, "</thead>\n<tbody>").concat(tbodyRowsHtml, "</tbody>\n").concat(tfootHtml, "\n</table>\n</body>\n</html>");
1668
1693
  }
1669
1694
 
1670
1695
  function flatLeaves(cols) {
@@ -16791,7 +16816,7 @@ __vue_render__._withStripped = true;
16791
16816
  undefined
16792
16817
  );
16793
16818
 
16794
- var version = "1.1.117";
16819
+ var version = "1.1.118";
16795
16820
 
16796
16821
  var index = {
16797
16822
  version: version,