@file-viewer/docx 0.3.34 → 0.3.35

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.
@@ -5969,7 +5969,7 @@ class DocumentParser {
5969
5969
  row.className = values.classNameOfCnfStyle(c);
5970
5970
  break;
5971
5971
  case "tblHeader":
5972
- row.isHeader = globalXmlParser.boolAttr(c, "val");
5972
+ row.isHeader = globalXmlParser.boolAttr(c, "val", true);
5973
5973
  break;
5974
5974
  case "gridBefore":
5975
5975
  row.gridBefore = globalXmlParser.intAttr(c, "val");
@@ -8698,6 +8698,7 @@ class HtmlRenderer {
8698
8698
  this.tableCellPositions = [];
8699
8699
  this.currentCellPosition = null;
8700
8700
  this.currentTableRow = null;
8701
+ this.repeatedTableHeaderRows = new WeakSet();
8701
8702
  this.footnoteMap = {};
8702
8703
  this.endnoteMap = {};
8703
8704
  this.currentEndnoteIds = [];
@@ -8751,6 +8752,7 @@ class HtmlRenderer {
8751
8752
  this.endnoteMap = {};
8752
8753
  this.noteNumbering = new NoteNumbering();
8753
8754
  this.renderedNoteIds = new Set();
8755
+ this.repeatedTableHeaderRows = new WeakSet();
8754
8756
  this.noteSectionIds = new Map();
8755
8757
  this.notePageIndex = 1;
8756
8758
  this.dynamicNoteState = new WeakMap();
@@ -9535,8 +9537,14 @@ class HtmlRenderer {
9535
9537
  return;
9536
9538
  const continuation = result.length > 0;
9537
9539
  let fragmentRows = currentRows;
9538
- if (continuation && headerRows.length > 0 && !currentRows.some(row => row.isHeader))
9539
- fragmentRows = [...headerRows, ...currentRows];
9540
+ if (continuation && headerRows.length > 0 && !currentRows.some(row => row.isHeader)) {
9541
+ const repeatedHeaders = headerRows.map(row => {
9542
+ const copy = { ...row };
9543
+ this.repeatedTableHeaderRows.add(copy);
9544
+ return copy;
9545
+ });
9546
+ fragmentRows = [...repeatedHeaders, ...currentRows];
9547
+ }
9540
9548
  result.push({
9541
9549
  table: { ...table, children: fragmentRows },
9542
9550
  breakAfter
@@ -14009,6 +14017,8 @@ section.${c}>footer { z-index: 1; }
14009
14017
  const row = this.toHTML(elem, ns.html, "tr", children);
14010
14018
  if (elem.isHeader)
14011
14019
  row.dataset.docxRepeatHeader = "true";
14020
+ if (this.repeatedTableHeaderRows.has(elem))
14021
+ row.dataset.docxRepeatedHeader = "true";
14012
14022
  return row;
14013
14023
  }
14014
14024
  renderTableCellPlaceholder(colSpan) {
@@ -14572,7 +14572,7 @@
14572
14572
  row.className = values.classNameOfCnfStyle(c);
14573
14573
  break;
14574
14574
  case "tblHeader":
14575
- row.isHeader = globalXmlParser.boolAttr(c, "val");
14575
+ row.isHeader = globalXmlParser.boolAttr(c, "val", true);
14576
14576
  break;
14577
14577
  case "gridBefore":
14578
14578
  row.gridBefore = globalXmlParser.intAttr(c, "val");
@@ -123,6 +123,7 @@ export declare class HtmlRenderer {
123
123
  tableCellPositions: CellPos[];
124
124
  currentCellPosition: CellPos;
125
125
  currentTableRow: WmlTableRow;
126
+ private repeatedTableHeaderRows;
126
127
  footnoteMap: Record<string, WmlFootnote>;
127
128
  endnoteMap: Record<string, WmlFootnote>;
128
129
  currentFootnoteIds: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/docx",
3
- "version": "0.3.34",
3
+ "version": "0.3.35",
4
4
  "description": "Pure HTML DOCX renderer fork for browser-based Word previews.",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [