js.documents 14.1.1 → 14.2.0

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.
Files changed (49) hide show
  1. package/dist/convert/variant-bridges.cjs +2 -2
  2. package/dist/convert/variant-bridges.js +2 -2
  3. package/dist/{diagnostics-9twvwLNY.d.cts → diagnostics-CGWySzd-.d.cts} +1 -0
  4. package/dist/{diagnostics-9twvwLNY.d.ts → diagnostics-CGWySzd-.d.ts} +1 -0
  5. package/dist/edit/doc/table.cjs +3 -3
  6. package/dist/edit/doc/table.js +3 -3
  7. package/dist/edit/docx/content.cjs +1 -1
  8. package/dist/edit/docx/content.js +1 -1
  9. package/dist/edit/markdown/table.cjs +3 -3
  10. package/dist/edit/markdown/table.js +3 -3
  11. package/dist/edit/odp/slide.d.cts +1 -1
  12. package/dist/edit/odp/slide.d.ts +1 -1
  13. package/dist/edit/odt/content.cjs +4 -2
  14. package/dist/edit/odt/content.d.cts +2 -2
  15. package/dist/edit/odt/content.d.ts +2 -2
  16. package/dist/edit/odt/content.js +4 -2
  17. package/dist/edit/odt/editor.d.cts +1 -1
  18. package/dist/edit/odt/editor.d.ts +1 -1
  19. package/dist/edit/odt/table.cjs +59 -4
  20. package/dist/edit/odt/table.d.cts +1 -1
  21. package/dist/edit/odt/table.d.ts +1 -1
  22. package/dist/edit/odt/table.js +59 -4
  23. package/dist/edit/pptx/content.cjs +11 -1
  24. package/dist/edit/pptx/content.d.cts +1 -1
  25. package/dist/edit/pptx/content.d.ts +1 -1
  26. package/dist/edit/pptx/content.js +11 -1
  27. package/dist/edit/pptx/diagnostics.cjs +4 -1
  28. package/dist/edit/pptx/diagnostics.d.cts +1 -1
  29. package/dist/edit/pptx/diagnostics.d.ts +1 -1
  30. package/dist/edit/pptx/diagnostics.js +4 -1
  31. package/dist/edit/table-grid.cjs +2 -2
  32. package/dist/edit/table-grid.js +2 -2
  33. package/dist/index.d.cts +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/layout/engine.cjs +1 -1
  36. package/dist/layout/engine.js +1 -1
  37. package/dist/layout/reconstruct.cjs +6 -6
  38. package/dist/layout/reconstruct.js +6 -6
  39. package/dist/layout/shared.cjs +3 -2
  40. package/dist/layout/shared.js +3 -2
  41. package/dist/layout/slides.cjs +1 -1
  42. package/dist/layout/slides.js +1 -1
  43. package/dist/markdown/render.cjs +3 -3
  44. package/dist/markdown/render.js +3 -3
  45. package/dist/odb/report/render.cjs +1 -1
  46. package/dist/odb/report/render.js +1 -1
  47. package/dist/{table-Cou5rKOo.d.ts → table-B5htMG3g.d.ts} +2 -0
  48. package/dist/{table-Bt9ahRyh.d.cts → table-DrE6jEWv.d.cts} +2 -0
  49. package/package.json +13 -13
@@ -120,11 +120,11 @@ function sheetToTableBlock(sheet) {
120
120
  const visibleColumns = [];
121
121
  for (let column = 0; column <= maxColumn; column += 1) if (!hiddenColumns.has(column)) visibleColumns.push(column);
122
122
  const columnWidthByIndex = new Map(sheet.columns.map((column) => [column.index, column.widthPt]));
123
- const columnWidthsPt = visibleColumns.map((column) => columnWidthByIndex.get(column) ?? 72);
123
+ const columns = visibleColumns.map((column) => ({ widthPt: columnWidthByIndex.get(column) ?? 72 }));
124
124
  return {
125
125
  kind: "table",
126
126
  rows: visibleRows.map((row) => ({ cells: visibleColumns.map((column) => spreadsheetCellToTableCell(cellByPosition.get(`${String(row)}:${String(column)}`))) })),
127
- columnWidthsPt
127
+ columns
128
128
  };
129
129
  }
130
130
  function spreadsheetToWordprocessing(doc) {
@@ -119,11 +119,11 @@ function sheetToTableBlock(sheet) {
119
119
  const visibleColumns = [];
120
120
  for (let column = 0; column <= maxColumn; column += 1) if (!hiddenColumns.has(column)) visibleColumns.push(column);
121
121
  const columnWidthByIndex = new Map(sheet.columns.map((column) => [column.index, column.widthPt]));
122
- const columnWidthsPt = visibleColumns.map((column) => columnWidthByIndex.get(column) ?? 72);
122
+ const columns = visibleColumns.map((column) => ({ widthPt: columnWidthByIndex.get(column) ?? 72 }));
123
123
  return {
124
124
  kind: "table",
125
125
  rows: visibleRows.map((row) => ({ cells: visibleColumns.map((column) => spreadsheetCellToTableCell(cellByPosition.get(`${String(row)}:${String(column)}`))) })),
126
- columnWidthsPt
126
+ columns
127
127
  };
128
128
  }
129
129
  function spreadsheetToWordprocessing(doc) {
@@ -2,6 +2,7 @@
2
2
  type PptxWriteDiagnosticSeverity = "info" | "warning";
3
3
  declare const PptxWriteDiagnosticCodes: {
4
4
  readonly TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped";
5
+ readonly TABLE_HEADER_COLUMN_DROPPED: "pptx-write/table-header-column-dropped";
5
6
  };
6
7
  type PptxWriteDiagnosticCode = (typeof PptxWriteDiagnosticCodes)[keyof typeof PptxWriteDiagnosticCodes];
7
8
  interface PptxWriteDiagnostic {
@@ -2,6 +2,7 @@
2
2
  type PptxWriteDiagnosticSeverity = "info" | "warning";
3
3
  declare const PptxWriteDiagnosticCodes: {
4
4
  readonly TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped";
5
+ readonly TABLE_HEADER_COLUMN_DROPPED: "pptx-write/table-header-column-dropped";
5
6
  };
6
7
  type PptxWriteDiagnosticCode = (typeof PptxWriteDiagnosticCodes)[keyof typeof PptxWriteDiagnosticCodes];
7
8
  interface PptxWriteDiagnostic {
@@ -81,7 +81,7 @@ var DocTable = class {
81
81
  }
82
82
  appendRow() {
83
83
  const node = this.live();
84
- const row = buildRow(node.columnWidthsPt.length);
84
+ const row = buildRow(node.columns.length);
85
85
  node.rows.push(row);
86
86
  return new DocTableRow(row);
87
87
  }
@@ -115,13 +115,13 @@ var DocTable = class {
115
115
  }
116
116
  };
117
117
  function buildTable(init) {
118
- const columnWidthsPt = Array.from({ length: init.columns }, () => DEFAULT_TABLE_WIDTH_PT / init.columns);
118
+ const columns = Array.from({ length: init.columns }, () => ({ widthPt: DEFAULT_TABLE_WIDTH_PT / init.columns }));
119
119
  const rows = [];
120
120
  for (let r = 0; r < init.rows; r++) rows.push(buildRow(init.columns));
121
121
  return {
122
122
  kind: "table",
123
123
  rows,
124
- columnWidthsPt
124
+ columns
125
125
  };
126
126
  }
127
127
  //#endregion
@@ -80,7 +80,7 @@ var DocTable = class {
80
80
  }
81
81
  appendRow() {
82
82
  const node = this.live();
83
- const row = buildRow(node.columnWidthsPt.length);
83
+ const row = buildRow(node.columns.length);
84
84
  node.rows.push(row);
85
85
  return new DocTableRow(row);
86
86
  }
@@ -114,13 +114,13 @@ var DocTable = class {
114
114
  }
115
115
  };
116
116
  function buildTable(init) {
117
- const columnWidthsPt = Array.from({ length: init.columns }, () => DEFAULT_TABLE_WIDTH_PT / init.columns);
117
+ const columns = Array.from({ length: init.columns }, () => ({ widthPt: DEFAULT_TABLE_WIDTH_PT / init.columns }));
118
118
  const rows = [];
119
119
  for (let r = 0; r < init.rows; r++) rows.push(buildRow(init.columns));
120
120
  return {
121
121
  kind: "table",
122
122
  rows,
123
- columnWidthsPt
123
+ columns
124
124
  };
125
125
  }
126
126
  //#endregion
@@ -214,7 +214,7 @@ function appendTable(body, block) {
214
214
  const table = body.appendTable({
215
215
  rows: 0,
216
216
  columns: (0, document_schema_js.tableGridColumnCount)(block),
217
- columnWidthsTwips: block.columnWidthsPt.map(require_model_units.ptToTwips)
217
+ columnWidthsTwips: block.columns.map((c) => require_model_units.ptToTwips(c.widthPt))
218
218
  });
219
219
  const positionsByRow = (0, document_schema_js.walkTableGrid)(block);
220
220
  block.rows.forEach((row, rowIndex) => {
@@ -213,7 +213,7 @@ function appendTable(body, block) {
213
213
  const table = body.appendTable({
214
214
  rows: 0,
215
215
  columns: tableGridColumnCount(block),
216
- columnWidthsTwips: block.columnWidthsPt.map(ptToTwips)
216
+ columnWidthsTwips: block.columns.map((c) => ptToTwips(c.widthPt))
217
217
  });
218
218
  const positionsByRow = walkTableGrid(block);
219
219
  block.rows.forEach((row, rowIndex) => {
@@ -66,7 +66,7 @@ var MarkdownTable = class {
66
66
  }
67
67
  appendRow() {
68
68
  const node = this.live();
69
- const row = buildRow(node.columnWidthsPt.length);
69
+ const row = buildRow(node.columns.length);
70
70
  node.rows.push(row);
71
71
  return new MarkdownTableRow(row);
72
72
  }
@@ -78,13 +78,13 @@ var MarkdownTable = class {
78
78
  }
79
79
  };
80
80
  function buildTable(init) {
81
- const columnWidthsPt = Array.from({ length: init.columns }, () => DEFAULT_TABLE_WIDTH_PT / init.columns);
81
+ const columns = Array.from({ length: init.columns }, () => ({ widthPt: DEFAULT_TABLE_WIDTH_PT / init.columns }));
82
82
  const rows = [];
83
83
  for (let r = 0; r < init.rows; r++) rows.push(buildRow(init.columns));
84
84
  return {
85
85
  kind: "table",
86
86
  rows,
87
- columnWidthsPt
87
+ columns
88
88
  };
89
89
  }
90
90
  //#endregion
@@ -65,7 +65,7 @@ var MarkdownTable = class {
65
65
  }
66
66
  appendRow() {
67
67
  const node = this.live();
68
- const row = buildRow(node.columnWidthsPt.length);
68
+ const row = buildRow(node.columns.length);
69
69
  node.rows.push(row);
70
70
  return new MarkdownTableRow(row);
71
71
  }
@@ -77,13 +77,13 @@ var MarkdownTable = class {
77
77
  }
78
78
  };
79
79
  function buildTable(init) {
80
- const columnWidthsPt = Array.from({ length: init.columns }, () => DEFAULT_TABLE_WIDTH_PT / init.columns);
80
+ const columns = Array.from({ length: init.columns }, () => ({ widthPt: DEFAULT_TABLE_WIDTH_PT / init.columns }));
81
81
  const rows = [];
82
82
  for (let r = 0; r < init.rows; r++) rows.push(buildRow(init.columns));
83
83
  return {
84
84
  kind: "table",
85
85
  rows,
86
- columnWidthsPt
86
+ columns
87
87
  };
88
88
  }
89
89
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { t as ImageInit } from "../../image-D1z0T9Za.cjs";
2
2
  import { t as OdpShape } from "../../shape-Kmmxib5z.cjs";
3
3
  import { s as OdgVector } from "../../vector-DDP7hgvm.cjs";
4
- import { o as TableInit, r as OdtTable } from "../../table-Bt9ahRyh.cjs";
4
+ import { o as TableInit, r as OdtTable } from "../../table-DrE6jEWv.cjs";
5
5
  import { Box, ContentFormula, ContentVector } from "document-schema.js";
6
6
  import { Package, XmlElement, XmlNode } from "odf.js";
7
7
  //#region src/edit/odp/slide.d.ts
@@ -1,7 +1,7 @@
1
1
  import { t as ImageInit } from "../../image-D1z0T9Za.js";
2
2
  import { t as OdpShape } from "../../shape-ZAfNsCC5.js";
3
3
  import { s as OdgVector } from "../../vector-DDP7hgvm.js";
4
- import { o as TableInit, r as OdtTable } from "../../table-Cou5rKOo.js";
4
+ import { o as TableInit, r as OdtTable } from "../../table-B5htMG3g.js";
5
5
  import { Box, ContentFormula, ContentVector } from "document-schema.js";
6
6
  import { Package, XmlElement, XmlNode } from "odf.js";
7
7
  //#region src/edit/odp/slide.d.ts
@@ -136,6 +136,7 @@ function populateOdtTable(table, block) {
136
136
  require_edit_table_grid.assertTableObeysGridRule(block, "populateOdtTable");
137
137
  const gridPositions = (0, document_schema_js.walkTableGrid)(block);
138
138
  const headerFlags = block.rows.map((row) => row.isHeader === true);
139
+ const columnHeaderFlags = block.columns.map((column) => column.isHeader === true);
139
140
  block.rows.forEach((row, rowIndex) => {
140
141
  const tableRow = table.appendEmptyRow();
141
142
  tableRow.heightPt = row.heightPt;
@@ -155,6 +156,7 @@ function populateOdtTable(table, block) {
155
156
  });
156
157
  });
157
158
  table.setHeaderRows(headerFlags);
159
+ table.setHeaderColumns(columnHeaderFlags);
158
160
  }
159
161
  function applyCellDecoration(target, cell) {
160
162
  if (cell.background !== void 0) target.background = (0, document_schema_js.resolveCellFillColor)(cell.background);
@@ -163,7 +165,7 @@ function applyCellDecoration(target, cell) {
163
165
  /**
164
166
  * The arguments that create the empty `table:table` a ContentTable is written into: no rows, since populateOdtTable appends one per ContentTableRow, and as many columns as the table's grid is wide.
165
167
  *
166
- * The grid width is what the rows and `columnWidthsPt` together state (tableGridColumnCount), so a table whose rows carry cells but which states no column widths still gets one `table:table-column` per grid column; a column with no stated width takes an equal share of the default table width, the same as any column created without one. `columnWidthsPt` is passed through untouched, so a width the table does state is always written.
168
+ * The grid width is what the rows and `columns` together state (tableGridColumnCount), so a table whose rows carry cells but which states no column widths still gets one `table:table-column` per grid column; a column with no stated width takes an equal share of the default table width, the same as any column created without one. Each column's own `widthPt` is passed through untouched, so a width the table does state is always written; `isHeader` is not part of this init at all, since populateOdtTable states it afterwards via OdtTable.setHeaderColumns, the identical two-step `setHeaderRows` already needs for the same reason on the row axis.
167
169
  *
168
170
  * Throws when the table has no rows: ODF requires a `table:table` to hold at least one `table:table-row`, so no faithful spelling exists, and dropping the table would lose it without a trace. `entryPoint` names the caller in the message. A table that breaks the grid rule is refused by populateOdtTable before it writes anything, and a table with no rows has no grid fault to report, so the two checks never compete.
169
171
  */
@@ -172,7 +174,7 @@ function odtTableInit(block, entryPoint) {
172
174
  return {
173
175
  rows: 0,
174
176
  columns: (0, document_schema_js.tableGridColumnCount)(block),
175
- columnWidthsPt: block.columnWidthsPt
177
+ columnWidthsPt: block.columns.map((column) => column.widthPt)
176
178
  };
177
179
  }
178
180
  function appendTable(body, block) {
@@ -1,6 +1,6 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.cjs";
2
2
  import { t as OdtParagraph } from "../../paragraph-CRaLSzWz.cjs";
3
- import { o as TableInit, r as OdtTable } from "../../table-Bt9ahRyh.cjs";
3
+ import { o as TableInit, r as OdtTable } from "../../table-DrE6jEWv.cjs";
4
4
  import { ContentDocument, ContentParagraph, ContentTable } from "document-schema.js";
5
5
  import { Package } from "odf.js";
6
6
  //#region src/edit/odt/content.d.ts
@@ -16,7 +16,7 @@ declare function populateOdtTable(table: OdtTable, block: ContentTable): void;
16
16
  /**
17
17
  * The arguments that create the empty `table:table` a ContentTable is written into: no rows, since populateOdtTable appends one per ContentTableRow, and as many columns as the table's grid is wide.
18
18
  *
19
- * The grid width is what the rows and `columnWidthsPt` together state (tableGridColumnCount), so a table whose rows carry cells but which states no column widths still gets one `table:table-column` per grid column; a column with no stated width takes an equal share of the default table width, the same as any column created without one. `columnWidthsPt` is passed through untouched, so a width the table does state is always written.
19
+ * The grid width is what the rows and `columns` together state (tableGridColumnCount), so a table whose rows carry cells but which states no column widths still gets one `table:table-column` per grid column; a column with no stated width takes an equal share of the default table width, the same as any column created without one. Each column's own `widthPt` is passed through untouched, so a width the table does state is always written; `isHeader` is not part of this init at all, since populateOdtTable states it afterwards via OdtTable.setHeaderColumns, the identical two-step `setHeaderRows` already needs for the same reason on the row axis.
20
20
  *
21
21
  * Throws when the table has no rows: ODF requires a `table:table` to hold at least one `table:table-row`, so no faithful spelling exists, and dropping the table would lose it without a trace. `entryPoint` names the caller in the message. A table that breaks the grid rule is refused by populateOdtTable before it writes anything, and a table with no rows has no grid fault to report, so the two checks never compete.
22
22
  */
@@ -1,6 +1,6 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.js";
2
2
  import { t as OdtParagraph } from "../../paragraph-D4f705GG.js";
3
- import { o as TableInit, r as OdtTable } from "../../table-Cou5rKOo.js";
3
+ import { o as TableInit, r as OdtTable } from "../../table-B5htMG3g.js";
4
4
  import { ContentDocument, ContentParagraph, ContentTable } from "document-schema.js";
5
5
  import { Package } from "odf.js";
6
6
  //#region src/edit/odt/content.d.ts
@@ -16,7 +16,7 @@ declare function populateOdtTable(table: OdtTable, block: ContentTable): void;
16
16
  /**
17
17
  * The arguments that create the empty `table:table` a ContentTable is written into: no rows, since populateOdtTable appends one per ContentTableRow, and as many columns as the table's grid is wide.
18
18
  *
19
- * The grid width is what the rows and `columnWidthsPt` together state (tableGridColumnCount), so a table whose rows carry cells but which states no column widths still gets one `table:table-column` per grid column; a column with no stated width takes an equal share of the default table width, the same as any column created without one. `columnWidthsPt` is passed through untouched, so a width the table does state is always written.
19
+ * The grid width is what the rows and `columns` together state (tableGridColumnCount), so a table whose rows carry cells but which states no column widths still gets one `table:table-column` per grid column; a column with no stated width takes an equal share of the default table width, the same as any column created without one. Each column's own `widthPt` is passed through untouched, so a width the table does state is always written; `isHeader` is not part of this init at all, since populateOdtTable states it afterwards via OdtTable.setHeaderColumns, the identical two-step `setHeaderRows` already needs for the same reason on the row axis.
20
20
  *
21
21
  * Throws when the table has no rows: ODF requires a `table:table` to hold at least one `table:table-row`, so no faithful spelling exists, and dropping the table would lose it without a trace. `entryPoint` names the caller in the message. A table that breaks the grid rule is refused by populateOdtTable before it writes anything, and a table with no rows has no grid fault to report, so the two checks never compete.
22
22
  */
@@ -135,6 +135,7 @@ function populateOdtTable(table, block) {
135
135
  assertTableObeysGridRule(block, "populateOdtTable");
136
136
  const gridPositions = walkTableGrid(block);
137
137
  const headerFlags = block.rows.map((row) => row.isHeader === true);
138
+ const columnHeaderFlags = block.columns.map((column) => column.isHeader === true);
138
139
  block.rows.forEach((row, rowIndex) => {
139
140
  const tableRow = table.appendEmptyRow();
140
141
  tableRow.heightPt = row.heightPt;
@@ -154,6 +155,7 @@ function populateOdtTable(table, block) {
154
155
  });
155
156
  });
156
157
  table.setHeaderRows(headerFlags);
158
+ table.setHeaderColumns(columnHeaderFlags);
157
159
  }
158
160
  function applyCellDecoration(target, cell) {
159
161
  if (cell.background !== void 0) target.background = resolveCellFillColor(cell.background);
@@ -162,7 +164,7 @@ function applyCellDecoration(target, cell) {
162
164
  /**
163
165
  * The arguments that create the empty `table:table` a ContentTable is written into: no rows, since populateOdtTable appends one per ContentTableRow, and as many columns as the table's grid is wide.
164
166
  *
165
- * The grid width is what the rows and `columnWidthsPt` together state (tableGridColumnCount), so a table whose rows carry cells but which states no column widths still gets one `table:table-column` per grid column; a column with no stated width takes an equal share of the default table width, the same as any column created without one. `columnWidthsPt` is passed through untouched, so a width the table does state is always written.
167
+ * The grid width is what the rows and `columns` together state (tableGridColumnCount), so a table whose rows carry cells but which states no column widths still gets one `table:table-column` per grid column; a column with no stated width takes an equal share of the default table width, the same as any column created without one. Each column's own `widthPt` is passed through untouched, so a width the table does state is always written; `isHeader` is not part of this init at all, since populateOdtTable states it afterwards via OdtTable.setHeaderColumns, the identical two-step `setHeaderRows` already needs for the same reason on the row axis.
166
168
  *
167
169
  * Throws when the table has no rows: ODF requires a `table:table` to hold at least one `table:table-row`, so no faithful spelling exists, and dropping the table would lose it without a trace. `entryPoint` names the caller in the message. A table that breaks the grid rule is refused by populateOdtTable before it writes anything, and a table with no rows has no grid fault to report, so the two checks never compete.
168
170
  */
@@ -171,7 +173,7 @@ function odtTableInit(block, entryPoint) {
171
173
  return {
172
174
  rows: 0,
173
175
  columns: tableGridColumnCount(block),
174
- columnWidthsPt: block.columnWidthsPt
176
+ columnWidthsPt: block.columns.map((column) => column.widthPt)
175
177
  };
176
178
  }
177
179
  function appendTable(body, block) {
@@ -1,7 +1,7 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.cjs";
2
2
  import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-CRaLSzWz.cjs";
3
3
  import { t as OdtList } from "../../list-C_UPIZWM.cjs";
4
- import { o as TableInit, r as OdtTable } from "../../table-Bt9ahRyh.cjs";
4
+ import { o as TableInit, r as OdtTable } from "../../table-DrE6jEWv.cjs";
5
5
  import { Box, ContentControlDescriptor, ContentFormula, ContentVector, DivisionDescriptor, LayoutMetadata } from "document-schema.js";
6
6
  import { Package } from "odf.js";
7
7
  //#region src/edit/odt/editor.d.ts
@@ -1,7 +1,7 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.js";
2
2
  import { n as ParagraphInit, t as OdtParagraph } from "../../paragraph-D4f705GG.js";
3
3
  import { t as OdtList } from "../../list-C2GWIe6E.js";
4
- import { o as TableInit, r as OdtTable } from "../../table-Cou5rKOo.js";
4
+ import { o as TableInit, r as OdtTable } from "../../table-B5htMG3g.js";
5
5
  import { Box, ContentControlDescriptor, ContentFormula, ContentVector, DivisionDescriptor, LayoutMetadata } from "document-schema.js";
6
6
  import { Package } from "odf.js";
7
7
  //#region src/edit/odt/editor.d.ts
@@ -299,10 +299,7 @@ function placedCells(row, pkg) {
299
299
  function resolveOdtGrid(table, pkg) {
300
300
  const placedRows = [];
301
301
  let declaredColumns = 0;
302
- for (const child of table.children) {
303
- if (child.type !== "element") continue;
304
- if (child.tag === "table:table-column") declaredColumns += require_edit_odf_repeated_runs.readRunRepeatCount(child, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR);
305
- }
302
+ for (const column of tableColumnElements(table)) declaredColumns += require_edit_odf_repeated_runs.readRunRepeatCount(column, require_edit_odf_repeated_runs.COLUMN_REPEAT_ATTR);
306
303
  for (const row of tableRowElements(table)) placedRows.push(placedCells(row, pkg));
307
304
  return require_edit_table_grid.resolveLiveTableGrid(placedRows, declaredColumns);
308
305
  }
@@ -403,6 +400,26 @@ function tableRowEntries(parent, insideHeader = false) {
403
400
  }
404
401
  return entries;
405
402
  }
403
+ const COLUMN_WRAPPER_TAGS = /* @__PURE__ */ new Set([
404
+ "table:table-columns",
405
+ "table:table-header-columns",
406
+ "table:table-column-group"
407
+ ]);
408
+ function tableColumnEntries(parent, insideHeader = false) {
409
+ const entries = [];
410
+ for (const child of parent.children) {
411
+ if (child.type !== "element") continue;
412
+ if (child.tag === "table:table-column") entries.push({
413
+ element: child,
414
+ insideHeader
415
+ });
416
+ else if (COLUMN_WRAPPER_TAGS.has(child.tag)) entries.push(...tableColumnEntries(child, insideHeader || child.tag === "table:table-header-columns"));
417
+ }
418
+ return entries;
419
+ }
420
+ function tableColumnElements(table) {
421
+ return tableColumnEntries(table).map((entry) => entry.element);
422
+ }
406
423
  var OdtTableRow = class {
407
424
  node;
408
425
  pkg;
@@ -529,6 +546,44 @@ var OdtTable = class {
529
546
  if (!placed) rest.push(...regrouped);
530
547
  table.children = rest;
531
548
  }
549
+ headerColumns() {
550
+ return tableColumnEntries(this.live()).map((entry) => entry.insideHeader);
551
+ }
552
+ setHeaderColumns(flags) {
553
+ const table = this.live();
554
+ const columns = tableColumnElements(table);
555
+ const regrouped = [];
556
+ let run = [];
557
+ const closeRun = () => {
558
+ if (run.length > 0) {
559
+ regrouped.push(require_xml_fragment.el("table:table-header-columns", {}, run));
560
+ run = [];
561
+ }
562
+ };
563
+ columns.forEach((column, index) => {
564
+ if (flags[index] === true) {
565
+ run.push(column);
566
+ return;
567
+ }
568
+ closeRun();
569
+ regrouped.push(column);
570
+ });
571
+ closeRun();
572
+ const rest = [];
573
+ let placed = false;
574
+ for (const child of table.children) {
575
+ if (!(child.type === "element" && (child.tag === "table:table-column" || COLUMN_WRAPPER_TAGS.has(child.tag)))) {
576
+ rest.push(child);
577
+ continue;
578
+ }
579
+ if (!placed) {
580
+ rest.push(...regrouped);
581
+ placed = true;
582
+ }
583
+ }
584
+ if (!placed) rest.push(...regrouped);
585
+ table.children = rest;
586
+ }
532
587
  gridRows() {
533
588
  return this.grid().rows;
534
589
  }
@@ -1,2 +1,2 @@
1
- import { a as OdtTableRow, c as buildTable, i as OdtTableCell, l as readCellDecoration, n as OdtCoveredTableCell, o as TableInit, r as OdtTable, s as buildCellStyle, t as CellDecoration } from "../../table-Bt9ahRyh.cjs";
1
+ import { a as OdtTableRow, c as buildTable, i as OdtTableCell, l as readCellDecoration, n as OdtCoveredTableCell, o as TableInit, r as OdtTable, s as buildCellStyle, t as CellDecoration } from "../../table-DrE6jEWv.cjs";
2
2
  export { CellDecoration, OdtCoveredTableCell, OdtTable, OdtTableCell, OdtTableRow, TableInit, buildCellStyle, buildTable, readCellDecoration };
@@ -1,2 +1,2 @@
1
- import { a as OdtTableRow, c as buildTable, i as OdtTableCell, l as readCellDecoration, n as OdtCoveredTableCell, o as TableInit, r as OdtTable, s as buildCellStyle, t as CellDecoration } from "../../table-Cou5rKOo.js";
1
+ import { a as OdtTableRow, c as buildTable, i as OdtTableCell, l as readCellDecoration, n as OdtCoveredTableCell, o as TableInit, r as OdtTable, s as buildCellStyle, t as CellDecoration } from "../../table-B5htMG3g.js";
2
2
  export { CellDecoration, OdtCoveredTableCell, OdtTable, OdtTableCell, OdtTableRow, TableInit, buildCellStyle, buildTable, readCellDecoration };
@@ -298,10 +298,7 @@ function placedCells(row, pkg) {
298
298
  function resolveOdtGrid(table, pkg) {
299
299
  const placedRows = [];
300
300
  let declaredColumns = 0;
301
- for (const child of table.children) {
302
- if (child.type !== "element") continue;
303
- if (child.tag === "table:table-column") declaredColumns += readRunRepeatCount(child, COLUMN_REPEAT_ATTR);
304
- }
301
+ for (const column of tableColumnElements(table)) declaredColumns += readRunRepeatCount(column, COLUMN_REPEAT_ATTR);
305
302
  for (const row of tableRowElements(table)) placedRows.push(placedCells(row, pkg));
306
303
  return resolveLiveTableGrid(placedRows, declaredColumns);
307
304
  }
@@ -402,6 +399,26 @@ function tableRowEntries(parent, insideHeader = false) {
402
399
  }
403
400
  return entries;
404
401
  }
402
+ const COLUMN_WRAPPER_TAGS = /* @__PURE__ */ new Set([
403
+ "table:table-columns",
404
+ "table:table-header-columns",
405
+ "table:table-column-group"
406
+ ]);
407
+ function tableColumnEntries(parent, insideHeader = false) {
408
+ const entries = [];
409
+ for (const child of parent.children) {
410
+ if (child.type !== "element") continue;
411
+ if (child.tag === "table:table-column") entries.push({
412
+ element: child,
413
+ insideHeader
414
+ });
415
+ else if (COLUMN_WRAPPER_TAGS.has(child.tag)) entries.push(...tableColumnEntries(child, insideHeader || child.tag === "table:table-header-columns"));
416
+ }
417
+ return entries;
418
+ }
419
+ function tableColumnElements(table) {
420
+ return tableColumnEntries(table).map((entry) => entry.element);
421
+ }
405
422
  var OdtTableRow = class {
406
423
  node;
407
424
  pkg;
@@ -528,6 +545,44 @@ var OdtTable = class {
528
545
  if (!placed) rest.push(...regrouped);
529
546
  table.children = rest;
530
547
  }
548
+ headerColumns() {
549
+ return tableColumnEntries(this.live()).map((entry) => entry.insideHeader);
550
+ }
551
+ setHeaderColumns(flags) {
552
+ const table = this.live();
553
+ const columns = tableColumnElements(table);
554
+ const regrouped = [];
555
+ let run = [];
556
+ const closeRun = () => {
557
+ if (run.length > 0) {
558
+ regrouped.push(el("table:table-header-columns", {}, run));
559
+ run = [];
560
+ }
561
+ };
562
+ columns.forEach((column, index) => {
563
+ if (flags[index] === true) {
564
+ run.push(column);
565
+ return;
566
+ }
567
+ closeRun();
568
+ regrouped.push(column);
569
+ });
570
+ closeRun();
571
+ const rest = [];
572
+ let placed = false;
573
+ for (const child of table.children) {
574
+ if (!(child.type === "element" && (child.tag === "table:table-column" || COLUMN_WRAPPER_TAGS.has(child.tag)))) {
575
+ rest.push(child);
576
+ continue;
577
+ }
578
+ if (!placed) {
579
+ rest.push(...regrouped);
580
+ placed = true;
581
+ }
582
+ }
583
+ if (!placed) rest.push(...regrouped);
584
+ table.children = rest;
585
+ }
531
586
  gridRows() {
532
587
  return this.grid().rows;
533
588
  }
@@ -64,7 +64,7 @@ function appendShape(slide, shape, options) {
64
64
  table: {
65
65
  rows: onlyBlock.rows.length,
66
66
  columns: (0, document_schema_js.tableGridColumnCount)(onlyBlock),
67
- columnWidthsPt: onlyBlock.columnWidthsPt
67
+ columnWidthsPt: onlyBlock.columns.map((c) => c.widthPt)
68
68
  }
69
69
  }), onlyBlock, options?.onDiagnostic ?? require_edit_pptx_diagnostics.NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, (url) => slide.registerHyperlink(url));
70
70
  return;
@@ -115,8 +115,18 @@ function populateCellParagraphs(cell, blocks, resolveHyperlinkRId) {
115
115
  }
116
116
  cell.setParagraphs(paragraphs);
117
117
  }
118
+ function reportDroppedHeaderColumns(block, onDiagnostic) {
119
+ block.columns.forEach((column, columnIndex) => {
120
+ if (column.isHeader === true) onDiagnostic({
121
+ code: require_edit_pptx_diagnostics.PptxWriteDiagnosticCodes.TABLE_HEADER_COLUMN_DROPPED,
122
+ severity: "warning",
123
+ message: `buildPptxPackage: table column ${String(columnIndex)} is a header column, and that is dropped; DrawingML has no header-column marker, so the column is written exactly as any other`
124
+ }, { sourcePath: block.sourcePath });
125
+ });
126
+ }
118
127
  function populatePptxTable(table, block, onDiagnostic, resolveHyperlinkRId) {
119
128
  require_edit_table_grid.assertTableObeysGridRule(block, "buildPptxPackage");
129
+ reportDroppedHeaderColumns(block, onDiagnostic);
120
130
  (0, document_schema_js.walkTableGrid)(block).forEach((positions, rowIndex) => {
121
131
  if (block.rows[rowIndex]?.isHeader === true) onDiagnostic({
122
132
  code: require_edit_pptx_diagnostics.PptxWriteDiagnosticCodes.TABLE_HEADER_ROW_DROPPED,
@@ -1,6 +1,6 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.cjs";
2
2
  import { t as OmmlDiagnosticSink } from "../../formula-BH1FBblm.cjs";
3
- import { o as PptxWriteDiagnosticSink } from "../../diagnostics-9twvwLNY.cjs";
3
+ import { o as PptxWriteDiagnosticSink } from "../../diagnostics-CGWySzd-.cjs";
4
4
  import { ContentDocument } from "document-schema.js";
5
5
  import { EmbeddedPresentationSerialiser, Package } from "ooxml.js";
6
6
  //#region src/edit/pptx/content.d.ts
@@ -1,6 +1,6 @@
1
1
  import { t as ClockPort } from "../../clock-C7SUuYN0.js";
2
2
  import { t as OmmlDiagnosticSink } from "../../formula-DF4R1QEJ.js";
3
- import { o as PptxWriteDiagnosticSink } from "../../diagnostics-9twvwLNY.js";
3
+ import { o as PptxWriteDiagnosticSink } from "../../diagnostics-CGWySzd-.js";
4
4
  import { EmbeddedPresentationSerialiser, Package } from "ooxml.js";
5
5
  import { ContentDocument } from "document-schema.js";
6
6
  //#region src/edit/pptx/content.d.ts
@@ -63,7 +63,7 @@ function appendShape(slide, shape, options) {
63
63
  table: {
64
64
  rows: onlyBlock.rows.length,
65
65
  columns: tableGridColumnCount(onlyBlock),
66
- columnWidthsPt: onlyBlock.columnWidthsPt
66
+ columnWidthsPt: onlyBlock.columns.map((c) => c.widthPt)
67
67
  }
68
68
  }), onlyBlock, options?.onDiagnostic ?? NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, (url) => slide.registerHyperlink(url));
69
69
  return;
@@ -114,8 +114,18 @@ function populateCellParagraphs(cell, blocks, resolveHyperlinkRId) {
114
114
  }
115
115
  cell.setParagraphs(paragraphs);
116
116
  }
117
+ function reportDroppedHeaderColumns(block, onDiagnostic) {
118
+ block.columns.forEach((column, columnIndex) => {
119
+ if (column.isHeader === true) onDiagnostic({
120
+ code: PptxWriteDiagnosticCodes.TABLE_HEADER_COLUMN_DROPPED,
121
+ severity: "warning",
122
+ message: `buildPptxPackage: table column ${String(columnIndex)} is a header column, and that is dropped; DrawingML has no header-column marker, so the column is written exactly as any other`
123
+ }, { sourcePath: block.sourcePath });
124
+ });
125
+ }
117
126
  function populatePptxTable(table, block, onDiagnostic, resolveHyperlinkRId) {
118
127
  assertTableObeysGridRule(block, "buildPptxPackage");
128
+ reportDroppedHeaderColumns(block, onDiagnostic);
119
129
  walkTableGrid(block).forEach((positions, rowIndex) => {
120
130
  if (block.rows[rowIndex]?.isHeader === true) onDiagnostic({
121
131
  code: PptxWriteDiagnosticCodes.TABLE_HEADER_ROW_DROPPED,
@@ -1,6 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/edit/pptx/diagnostics.ts
3
- const PptxWriteDiagnosticCodes = { TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped" };
3
+ const PptxWriteDiagnosticCodes = {
4
+ TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped",
5
+ TABLE_HEADER_COLUMN_DROPPED: "pptx-write/table-header-column-dropped"
6
+ };
4
7
  const NOOP_PPTX_WRITE_DIAGNOSTIC_SINK = () => {};
5
8
  //#endregion
6
9
  exports.NOOP_PPTX_WRITE_DIAGNOSTIC_SINK = NOOP_PPTX_WRITE_DIAGNOSTIC_SINK;
@@ -1,2 +1,2 @@
1
- import { a as PptxWriteDiagnosticSeverity, i as PptxWriteDiagnosticCodes, n as PptxWriteDiagnostic, o as PptxWriteDiagnosticSink, r as PptxWriteDiagnosticCode, t as NOOP_PPTX_WRITE_DIAGNOSTIC_SINK } from "../../diagnostics-9twvwLNY.cjs";
1
+ import { a as PptxWriteDiagnosticSeverity, i as PptxWriteDiagnosticCodes, n as PptxWriteDiagnostic, o as PptxWriteDiagnosticSink, r as PptxWriteDiagnosticCode, t as NOOP_PPTX_WRITE_DIAGNOSTIC_SINK } from "../../diagnostics-CGWySzd-.cjs";
2
2
  export { NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, PptxWriteDiagnostic, PptxWriteDiagnosticCode, PptxWriteDiagnosticCodes, PptxWriteDiagnosticSeverity, PptxWriteDiagnosticSink };
@@ -1,2 +1,2 @@
1
- import { a as PptxWriteDiagnosticSeverity, i as PptxWriteDiagnosticCodes, n as PptxWriteDiagnostic, o as PptxWriteDiagnosticSink, r as PptxWriteDiagnosticCode, t as NOOP_PPTX_WRITE_DIAGNOSTIC_SINK } from "../../diagnostics-9twvwLNY.js";
1
+ import { a as PptxWriteDiagnosticSeverity, i as PptxWriteDiagnosticCodes, n as PptxWriteDiagnostic, o as PptxWriteDiagnosticSink, r as PptxWriteDiagnosticCode, t as NOOP_PPTX_WRITE_DIAGNOSTIC_SINK } from "../../diagnostics-CGWySzd-.js";
2
2
  export { NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, PptxWriteDiagnostic, PptxWriteDiagnosticCode, PptxWriteDiagnosticCodes, PptxWriteDiagnosticSeverity, PptxWriteDiagnosticSink };
@@ -1,5 +1,8 @@
1
1
  //#region src/edit/pptx/diagnostics.ts
2
- const PptxWriteDiagnosticCodes = { TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped" };
2
+ const PptxWriteDiagnosticCodes = {
3
+ TABLE_HEADER_ROW_DROPPED: "pptx-write/table-header-row-dropped",
4
+ TABLE_HEADER_COLUMN_DROPPED: "pptx-write/table-header-column-dropped"
5
+ };
3
6
  const NOOP_PPTX_WRITE_DIAGNOSTIC_SINK = () => {};
4
7
  //#endregion
5
8
  export { NOOP_PPTX_WRITE_DIAGNOSTIC_SINK, PptxWriteDiagnosticCodes };
@@ -22,7 +22,7 @@ function resolveLiveTableGrid(rows, declaredColumnCount) {
22
22
  })) }));
23
23
  const skeleton = {
24
24
  kind: "table",
25
- columnWidthsPt: [],
25
+ columns: [],
26
26
  rows: (0, document_schema_js.denseTableRows)(positioned, declaredColumnCount)
27
27
  };
28
28
  const liveCells = /* @__PURE__ */ new Map();
@@ -51,7 +51,7 @@ function resolvePivotTableGrid(table, wrap) {
51
51
  cell: wrap(cell),
52
52
  colSpan: cell.colSpan,
53
53
  rowSpan: cell.rowSpan
54
- }))), table.columnWidthsPt.length);
54
+ }))), table.columns.length);
55
55
  }
56
56
  /**
57
57
  * Throws when `table` breaks the grid rule (ContentTableCell in document-schema.js), naming `entryPoint` and the fault. The edit layer's builders write a covered position as a marker with no content of its own (a docx vertical-merge continuation, an ODF `table:covered-table-cell`, a pptx `hMerge`/`vMerge` cell), so a table whose covered positions carry blocks or spans, whose rows disagree about the grid, or whose regions run past the grid or into each other has no faithful spelling: the builder would drop what a covered position held, or guess which of two regions a position belongs to.
@@ -21,7 +21,7 @@ function resolveLiveTableGrid(rows, declaredColumnCount) {
21
21
  })) }));
22
22
  const skeleton = {
23
23
  kind: "table",
24
- columnWidthsPt: [],
24
+ columns: [],
25
25
  rows: denseTableRows(positioned, declaredColumnCount)
26
26
  };
27
27
  const liveCells = /* @__PURE__ */ new Map();
@@ -50,7 +50,7 @@ function resolvePivotTableGrid(table, wrap) {
50
50
  cell: wrap(cell),
51
51
  colSpan: cell.colSpan,
52
52
  rowSpan: cell.rowSpan
53
- }))), table.columnWidthsPt.length);
53
+ }))), table.columns.length);
54
54
  }
55
55
  /**
56
56
  * Throws when `table` breaks the grid rule (ContentTableCell in document-schema.js), naming `entryPoint` and the fault. The edit layer's builders write a covered position as a marker with no content of its own (a docx vertical-merge continuation, an ODF `table:covered-table-cell`, a pptx `hMerge`/`vMerge` cell), so a table whose covered positions carry blocks or spans, whose rows disagree about the grid, or whose regions run past the grid or into each other has no faithful spelling: the builder would drop what a covered position held, or guess which of two regions a position belongs to.
package/dist/index.d.cts CHANGED
@@ -47,7 +47,7 @@ import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.cjs";
47
47
  import { CreateOdgOptions, OdgEditor, createOdg, openOdg } from "./edit/odg/editor.cjs";
48
48
  import { CreateEmptyOdgPackageOptions } from "./edit/odg/scaffold.cjs";
49
49
  import { BuildOdpPackageOptions, buildOdpPackage } from "./edit/odp/content.cjs";
50
- import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-Bt9ahRyh.cjs";
50
+ import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-DrE6jEWv.cjs";
51
51
  import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.cjs";
52
52
  import { CreateOdpOptions, OdpEditor, createOdp, openOdp } from "./edit/odp/editor.cjs";
53
53
  import { CreateEmptyOdpPackageOptions } from "./edit/odp/scaffold.cjs";
package/dist/index.d.ts CHANGED
@@ -47,7 +47,7 @@ import { OdgPage, PageImageInit, TextBoxInit } from "./edit/odg/page.js";
47
47
  import { CreateOdgOptions, OdgEditor, createOdg, openOdg } from "./edit/odg/editor.js";
48
48
  import { CreateEmptyOdgPackageOptions } from "./edit/odg/scaffold.js";
49
49
  import { BuildOdpPackageOptions, buildOdpPackage } from "./edit/odp/content.js";
50
- import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-Cou5rKOo.js";
50
+ import { a as OdtTableRow, i as OdtTableCell, n as OdtCoveredTableCell, o as TableInit$2, r as OdtTable } from "./table-B5htMG3g.js";
51
51
  import { OdpSlide, SlideImageInit, SlideTableInit, TextBoxInit as TextBoxInit$1 } from "./edit/odp/slide.js";
52
52
  import { CreateOdpOptions, OdpEditor, createOdp, openOdp } from "./edit/odp/editor.js";
53
53
  import { CreateEmptyOdpPackageOptions } from "./edit/odp/scaffold.js";
@@ -157,7 +157,7 @@ function layoutParagraphInCell(paragraph, cellLeftXDown, cellWidthPt, startYDown
157
157
  return cursorYDown + (paragraph.spacingAfterPt ?? 0);
158
158
  }
159
159
  function layoutTableFlow(table, section, pages, state, contentLeftXDown, contentWidthPt, contentBottomYDown, measurer, listCounters) {
160
- const gridWidthPt = table.columnWidthsPt.reduce((sum, w) => sum + w, 0);
160
+ const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
161
161
  const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
162
162
  for (const { row, anchors } of require_layout_shared.tableAnchorBoxes(table, scale)) {
163
163
  const rowHeightPt = row.heightPt ?? require_layout_shared.estimateRowHeightPt(anchors, measurer);
@@ -156,7 +156,7 @@ function layoutParagraphInCell(paragraph, cellLeftXDown, cellWidthPt, startYDown
156
156
  return cursorYDown + (paragraph.spacingAfterPt ?? 0);
157
157
  }
158
158
  function layoutTableFlow(table, section, pages, state, contentLeftXDown, contentWidthPt, contentBottomYDown, measurer, listCounters) {
159
- const gridWidthPt = table.columnWidthsPt.reduce((sum, w) => sum + w, 0);
159
+ const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
160
160
  const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
161
161
  for (const { row, anchors } of tableAnchorBoxes(table, scale)) {
162
162
  const rowHeightPt = row.heightPt ?? estimateRowHeightPt(anchors, measurer);
@@ -1187,7 +1187,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
1187
1187
  const rows = [...rowsById.values()].sort((a, b) => a.row.order - b.row.order);
1188
1188
  for (const row of rows) row.cells.sort((a, b) => a.cell.order - b.cell.order);
1189
1189
  const columnCount = Math.max(...rows.map((row) => row.cells.length));
1190
- const columnWidthsPt = [];
1190
+ const columns = [];
1191
1191
  for (let j = 0; j < columnCount; j++) {
1192
1192
  let minX = Number.POSITIVE_INFINITY;
1193
1193
  let maxX = Number.NEGATIVE_INFINITY;
@@ -1200,7 +1200,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
1200
1200
  }
1201
1201
  }
1202
1202
  const width = maxX - minX;
1203
- columnWidthsPt.push(width > 0 ? width : DEFAULT_COLUMN_WIDTH_FALLBACK_PT);
1203
+ columns.push({ widthPt: width > 0 ? width : DEFAULT_COLUMN_WIDTH_FALLBACK_PT });
1204
1204
  }
1205
1205
  const allItems = cells.flatMap((cellEntry) => cellEntry.items);
1206
1206
  const contentRows = rows.map((row) => {
@@ -1217,7 +1217,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
1217
1217
  const table = {
1218
1218
  kind: "table",
1219
1219
  rows: contentRows,
1220
- columnWidthsPt
1220
+ columns
1221
1221
  };
1222
1222
  require_layout_shared.stampFrame(table, pageIndex, box);
1223
1223
  recovered.push({
@@ -1277,8 +1277,8 @@ function recoverTable(page, pageIndex) {
1277
1277
  consumedText.add(item);
1278
1278
  }
1279
1279
  if (consumedText.size === 0) return;
1280
- const columnWidthsPt = [];
1281
- for (let j = 0; j < columnCount; j++) columnWidthsPt.push(lattice.columnBoundariesAscPt[j + 1] - lattice.columnBoundariesAscPt[j]);
1280
+ const columns = [];
1281
+ for (let j = 0; j < columnCount; j++) columns.push({ widthPt: lattice.columnBoundariesAscPt[j + 1] - lattice.columnBoundariesAscPt[j] });
1282
1282
  const positionedRows = [];
1283
1283
  for (let i = 0; i < rowCount; i++) {
1284
1284
  const positioned = [];
@@ -1327,7 +1327,7 @@ function recoverTable(page, pageIndex) {
1327
1327
  const table = {
1328
1328
  kind: "table",
1329
1329
  rows,
1330
- columnWidthsPt
1330
+ columns
1331
1331
  };
1332
1332
  require_layout_shared.stampFrame(table, pageIndex, pdfBox);
1333
1333
  return {
@@ -1186,7 +1186,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
1186
1186
  const rows = [...rowsById.values()].sort((a, b) => a.row.order - b.row.order);
1187
1187
  for (const row of rows) row.cells.sort((a, b) => a.cell.order - b.cell.order);
1188
1188
  const columnCount = Math.max(...rows.map((row) => row.cells.length));
1189
- const columnWidthsPt = [];
1189
+ const columns = [];
1190
1190
  for (let j = 0; j < columnCount; j++) {
1191
1191
  let minX = Number.POSITIVE_INFINITY;
1192
1192
  let maxX = Number.NEGATIVE_INFINITY;
@@ -1199,7 +1199,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
1199
1199
  }
1200
1200
  }
1201
1201
  const width = maxX - minX;
1202
- columnWidthsPt.push(width > 0 ? width : DEFAULT_COLUMN_WIDTH_FALLBACK_PT);
1202
+ columns.push({ widthPt: width > 0 ? width : DEFAULT_COLUMN_WIDTH_FALLBACK_PT });
1203
1203
  }
1204
1204
  const allItems = cells.flatMap((cellEntry) => cellEntry.items);
1205
1205
  const contentRows = rows.map((row) => {
@@ -1216,7 +1216,7 @@ function recoverTaggedTables(page, pageIndex, structure) {
1216
1216
  const table = {
1217
1217
  kind: "table",
1218
1218
  rows: contentRows,
1219
- columnWidthsPt
1219
+ columns
1220
1220
  };
1221
1221
  stampFrame(table, pageIndex, box);
1222
1222
  recovered.push({
@@ -1276,8 +1276,8 @@ function recoverTable(page, pageIndex) {
1276
1276
  consumedText.add(item);
1277
1277
  }
1278
1278
  if (consumedText.size === 0) return;
1279
- const columnWidthsPt = [];
1280
- for (let j = 0; j < columnCount; j++) columnWidthsPt.push(lattice.columnBoundariesAscPt[j + 1] - lattice.columnBoundariesAscPt[j]);
1279
+ const columns = [];
1280
+ for (let j = 0; j < columnCount; j++) columns.push({ widthPt: lattice.columnBoundariesAscPt[j + 1] - lattice.columnBoundariesAscPt[j] });
1281
1281
  const positionedRows = [];
1282
1282
  for (let i = 0; i < rowCount; i++) {
1283
1283
  const positioned = [];
@@ -1326,7 +1326,7 @@ function recoverTable(page, pageIndex) {
1326
1326
  const table = {
1327
1327
  kind: "table",
1328
1328
  rows,
1329
- columnWidthsPt
1329
+ columns
1330
1330
  };
1331
1331
  stampFrame(table, pageIndex, pdfBox);
1332
1332
  return {
@@ -221,12 +221,13 @@ function sumColumnWidthsPt(columnWidthsPt, startIndex, span) {
221
221
  */
222
222
  function tableAnchorBoxes(table, scale) {
223
223
  const positionsByRow = (0, document_schema_js.walkTableGrid)(table);
224
+ const columnWidthsPt = table.columns.map((column) => column.widthPt);
224
225
  return table.rows.map((row, rowIndex) => ({
225
226
  row,
226
227
  anchors: positionsByRow[rowIndex].flatMap((position) => position.anchorRowIndex === void 0 ? [{
227
228
  cell: position.cell,
228
- xOffsetPt: sumColumnWidthsPt(table.columnWidthsPt, 0, position.columnIndex) * scale,
229
- widthPt: sumColumnWidthsPt(table.columnWidthsPt, position.columnIndex, (0, document_schema_js.tableCellColumnSpan)(position.cell)) * scale
229
+ xOffsetPt: sumColumnWidthsPt(columnWidthsPt, 0, position.columnIndex) * scale,
230
+ widthPt: sumColumnWidthsPt(columnWidthsPt, position.columnIndex, (0, document_schema_js.tableCellColumnSpan)(position.cell)) * scale
230
231
  }] : [])
231
232
  }));
232
233
  }
@@ -220,12 +220,13 @@ function sumColumnWidthsPt(columnWidthsPt, startIndex, span) {
220
220
  */
221
221
  function tableAnchorBoxes(table, scale) {
222
222
  const positionsByRow = walkTableGrid(table);
223
+ const columnWidthsPt = table.columns.map((column) => column.widthPt);
223
224
  return table.rows.map((row, rowIndex) => ({
224
225
  row,
225
226
  anchors: positionsByRow[rowIndex].flatMap((position) => position.anchorRowIndex === void 0 ? [{
226
227
  cell: position.cell,
227
- xOffsetPt: sumColumnWidthsPt(table.columnWidthsPt, 0, position.columnIndex) * scale,
228
- widthPt: sumColumnWidthsPt(table.columnWidthsPt, position.columnIndex, tableCellColumnSpan(position.cell)) * scale
228
+ xOffsetPt: sumColumnWidthsPt(columnWidthsPt, 0, position.columnIndex) * scale,
229
+ widthPt: sumColumnWidthsPt(columnWidthsPt, position.columnIndex, tableCellColumnSpan(position.cell)) * scale
229
230
  }] : [])
230
231
  }));
231
232
  }
@@ -79,7 +79,7 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
79
79
  }
80
80
  function layoutTable(table, contentLeftXDown, contentWidthPt, startYDown, slideHeightPt, pageIndex, placement, measurer, out) {
81
81
  let cursorYDown = startYDown;
82
- const gridWidthPt = table.columnWidthsPt.reduce((sum, w) => sum + w, 0);
82
+ const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
83
83
  const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
84
84
  for (const { row, anchors } of require_layout_shared.tableAnchorBoxes(table, scale)) {
85
85
  const rowHeightPt = row.heightPt ?? require_layout_shared.estimateRowHeightPt(anchors, measurer);
@@ -78,7 +78,7 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
78
78
  }
79
79
  function layoutTable(table, contentLeftXDown, contentWidthPt, startYDown, slideHeightPt, pageIndex, placement, measurer, out) {
80
80
  let cursorYDown = startYDown;
81
- const gridWidthPt = table.columnWidthsPt.reduce((sum, w) => sum + w, 0);
81
+ const gridWidthPt = table.columns.reduce((sum, c) => sum + c.widthPt, 0);
82
82
  const scale = gridWidthPt > 0 ? contentWidthPt / gridWidthPt : 1;
83
83
  for (const { row, anchors } of tableAnchorBoxes(table, scale)) {
84
84
  const rowHeightPt = row.heightPt ?? estimateRowHeightPt(anchors, measurer);
@@ -115,17 +115,17 @@ function sheetToTable(sheet, sink) {
115
115
  const visibleColumns = [];
116
116
  for (let column = 0; column <= maxColumn; column += 1) if (!hiddenColumns.has(column)) visibleColumns.push(column);
117
117
  const columnWidthByIndex = new Map(sheet.columns.map((column) => [column.index, column.widthPt]));
118
- const columnWidthsPt = visibleColumns.map((column) => columnWidthByIndex.get(column) ?? DEFAULT_COLUMN_WIDTH_PT);
118
+ const columns = visibleColumns.map((column) => ({ widthPt: columnWidthByIndex.get(column) ?? DEFAULT_COLUMN_WIDTH_PT }));
119
119
  const rows = visibleRows.map((row) => ({ cells: visibleColumns.map((column) => spreadsheetCellToTableCell(cellByPosition.get(`${String(row)}:${String(column)}`))) }));
120
120
  sink({
121
121
  severity: "info",
122
122
  code: MarkdownRenderDiagnosticCodes.SPREADSHEET_SHEET_AS_TABLE,
123
- message: `sheet "${sheet.name}" flattened to a ${String(rows.length)}x${String(columnWidthsPt.length)} GFM table; its first row is rendered as the table header (a GFM table always has one, and a spreadsheet has no header/body distinction of its own)`
123
+ message: `sheet "${sheet.name}" flattened to a ${String(rows.length)}x${String(columns.length)} GFM table; its first row is rendered as the table header (a GFM table always has one, and a spreadsheet has no header/body distinction of its own)`
124
124
  });
125
125
  return {
126
126
  kind: "table",
127
127
  rows,
128
- columnWidthsPt
128
+ columns
129
129
  };
130
130
  }
131
131
  function spreadsheetBlocks(document, sink) {
@@ -114,17 +114,17 @@ function sheetToTable(sheet, sink) {
114
114
  const visibleColumns = [];
115
115
  for (let column = 0; column <= maxColumn; column += 1) if (!hiddenColumns.has(column)) visibleColumns.push(column);
116
116
  const columnWidthByIndex = new Map(sheet.columns.map((column) => [column.index, column.widthPt]));
117
- const columnWidthsPt = visibleColumns.map((column) => columnWidthByIndex.get(column) ?? DEFAULT_COLUMN_WIDTH_PT);
117
+ const columns = visibleColumns.map((column) => ({ widthPt: columnWidthByIndex.get(column) ?? DEFAULT_COLUMN_WIDTH_PT }));
118
118
  const rows = visibleRows.map((row) => ({ cells: visibleColumns.map((column) => spreadsheetCellToTableCell(cellByPosition.get(`${String(row)}:${String(column)}`))) }));
119
119
  sink({
120
120
  severity: "info",
121
121
  code: MarkdownRenderDiagnosticCodes.SPREADSHEET_SHEET_AS_TABLE,
122
- message: `sheet "${sheet.name}" flattened to a ${String(rows.length)}x${String(columnWidthsPt.length)} GFM table; its first row is rendered as the table header (a GFM table always has one, and a spreadsheet has no header/body distinction of its own)`
122
+ message: `sheet "${sheet.name}" flattened to a ${String(rows.length)}x${String(columns.length)} GFM table; its first row is rendered as the table header (a GFM table always has one, and a spreadsheet has no header/body distinction of its own)`
123
123
  });
124
124
  return {
125
125
  kind: "table",
126
126
  rows,
127
- columnWidthsPt
127
+ columns
128
128
  };
129
129
  }
130
130
  function spreadsheetBlocks(document, sink) {
@@ -56,7 +56,7 @@ function bandTable(band) {
56
56
  const columnWidthPt = CONTENT_WIDTH_PT / band.elements.length;
57
57
  return {
58
58
  kind: "table",
59
- columnWidthsPt: band.elements.map(() => columnWidthPt),
59
+ columns: band.elements.map(() => ({ widthPt: columnWidthPt })),
60
60
  rows: [{ cells: band.elements.map((element, index) => ({ blocks: [cellParagraph(element, band.values[index], band.styleId)] })) }]
61
61
  };
62
62
  }
@@ -55,7 +55,7 @@ function bandTable(band) {
55
55
  const columnWidthPt = CONTENT_WIDTH_PT / band.elements.length;
56
56
  return {
57
57
  kind: "table",
58
- columnWidthsPt: band.elements.map(() => columnWidthPt),
58
+ columns: band.elements.map(() => ({ widthPt: columnWidthPt })),
59
59
  rows: [{ cells: band.elements.map((element, index) => ({ blocks: [cellParagraph(element, band.values[index], band.styleId)] })) }]
60
60
  };
61
61
  }
@@ -62,6 +62,8 @@ declare class OdtTable {
62
62
  rows(): OdtTableRow[];
63
63
  headerRows(): boolean[];
64
64
  setHeaderRows(flags: readonly boolean[]): void;
65
+ headerColumns(): boolean[];
66
+ setHeaderColumns(flags: readonly boolean[]): void;
65
67
  gridRows(): TableGridRows<OdtTableCell>;
66
68
  gridColumnCount(): number;
67
69
  private grid;
@@ -62,6 +62,8 @@ declare class OdtTable {
62
62
  rows(): OdtTableRow[];
63
63
  headerRows(): boolean[];
64
64
  setHeaderRows(flags: readonly boolean[]): void;
65
+ headerColumns(): boolean[];
66
+ setHeaderColumns(flags: readonly boolean[]): void;
65
67
  gridRows(): TableGridRows<OdtTableCell>;
66
68
  gridColumnCount(): number;
67
69
  private grid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js.documents",
3
- "version": "14.1.1",
3
+ "version": "14.2.0",
4
4
  "description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -77,21 +77,21 @@
77
77
  ],
78
78
  "license": "MIT",
79
79
  "dependencies": {
80
- "archive-codec": "1.11.11",
80
+ "archive-codec": "1.11.12",
81
81
  "byte-codec": "1.8.1",
82
- "doc-codec": "6.0.2",
83
- "document-schema.js": "7.14.1",
84
- "epub-codec": "5.0.2",
82
+ "doc-codec": "6.0.3",
83
+ "document-schema.js": "7.15.0",
84
+ "epub-codec": "5.1.0",
85
85
  "fflate": "0.8.3",
86
- "markdown-codec": "11.0.2",
87
- "odf.js": "11.0.1",
88
- "ooxml.js": "12.0.1",
89
- "pdf-codec": "5.2.5",
90
- "ppt-codec": "2.1.1",
91
- "rtf-codec": "8.0.2",
86
+ "markdown-codec": "11.1.0",
87
+ "odf.js": "11.1.0",
88
+ "ooxml.js": "12.0.2",
89
+ "pdf-codec": "5.2.6",
90
+ "ppt-codec": "2.2.0",
91
+ "rtf-codec": "8.1.0",
92
92
  "temml": "0.13.4",
93
- "wpd-codec": "5.1.1",
94
- "xls-codec": "4.15.17",
93
+ "wpd-codec": "5.1.2",
94
+ "xls-codec": "4.15.18",
95
95
  "zod": "4.4.3"
96
96
  },
97
97
  "devDependencies": {