@harbour-enterprises/superdoc 1.17.0-next.1 → 1.17.0-next.11
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/dist/chunks/{SuperConverter-K4WSGFuY.es.js → SuperConverter-D0cZ7DBR.es.js} +161 -141
- package/dist/chunks/{SuperConverter-BNtgL-OA.cjs → SuperConverter-DOQaFkjd.cjs} +163 -143
- package/dist/chunks/{src-CoenE8GQ.cjs → src-DQKyE7kq.cjs} +2887 -1721
- package/dist/chunks/{src-CTUYPp9B.es.js → src-bsYwK29H.es.js} +2727 -1552
- package/dist/style.css +67 -61
- package/dist/super-editor/converter.cjs +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/src/core/header-footer/HeaderFooterPerRidLayout.d.ts +8 -0
- package/dist/super-editor/src/core/header-footer/HeaderFooterPerRidLayout.d.ts.map +1 -1
- package/dist/super-editor/src/core/header-footer/HeaderFooterRegistry.d.ts.map +1 -1
- package/dist/super-editor/src/core/presentation-editor/PresentationEditor.d.ts.map +1 -1
- package/dist/super-editor/src/core/presentation-editor/dom/PointerNormalization.d.ts +2 -0
- package/dist/super-editor/src/core/presentation-editor/dom/PointerNormalization.d.ts.map +1 -1
- package/dist/super-editor/src/core/presentation-editor/header-footer/HeaderFooterSessionManager.d.ts +6 -1
- package/dist/super-editor/src/core/presentation-editor/header-footer/HeaderFooterSessionManager.d.ts.map +1 -1
- package/dist/super-editor/src/core/presentation-editor/pointer-events/EditorInputManager.d.ts +3 -1
- package/dist/super-editor/src/core/presentation-editor/pointer-events/EditorInputManager.d.ts.map +1 -1
- package/dist/super-editor/src/core/presentation-editor/types.d.ts +2 -0
- package/dist/super-editor/src/core/presentation-editor/types.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/field-references/preProcessPageFieldsOnly.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/helpers/tableFallbackHelpers.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/jc/jc-translator.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tbl/tbl-translator.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/__conformance__/schema-validator.d.ts +3 -1
- package/dist/super-editor/src/document-api-adapters/__conformance__/schema-validator.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/assemble-adapters.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/capabilities-adapter.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/find-adapter.d.ts +5 -5
- package/dist/super-editor/src/document-api-adapters/find-adapter.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/helpers/adapter-utils.d.ts +9 -0
- package/dist/super-editor/src/document-api-adapters/helpers/adapter-utils.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/helpers/comment-entity-store.d.ts +3 -2
- package/dist/super-editor/src/document-api-adapters/helpers/comment-entity-store.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/helpers/list-item-resolver.d.ts +2 -6
- package/dist/super-editor/src/document-api-adapters/helpers/list-item-resolver.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/index.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/info-adapter.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/comments-wrappers.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/compiler.d.ts +27 -3
- package/dist/super-editor/src/document-api-adapters/plan-engine/compiler.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/create-wrappers.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/executor-registry.types.d.ts +29 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/executor-registry.types.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/executor.d.ts +18 -21
- package/dist/super-editor/src/document-api-adapters/plan-engine/executor.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/format-value-wrappers.d.ts +7 -0
- package/dist/super-editor/src/document-api-adapters/plan-engine/format-value-wrappers.d.ts.map +1 -0
- package/dist/super-editor/src/document-api-adapters/plan-engine/index.d.ts +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/index.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/lists-wrappers.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/match-style-helpers.d.ts +58 -0
- package/dist/super-editor/src/document-api-adapters/plan-engine/match-style-helpers.d.ts.map +1 -0
- package/dist/super-editor/src/document-api-adapters/plan-engine/plan-wrappers.d.ts +2 -5
- package/dist/super-editor/src/document-api-adapters/plan-engine/plan-wrappers.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/preview.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/query-match-adapter.d.ts +1 -7
- package/dist/super-editor/src/document-api-adapters/plan-engine/query-match-adapter.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/register-executors.d.ts +4 -0
- package/dist/super-editor/src/document-api-adapters/plan-engine/register-executors.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/replacement-normalizer.d.ts +19 -0
- package/dist/super-editor/src/document-api-adapters/plan-engine/replacement-normalizer.d.ts.map +1 -0
- package/dist/super-editor/src/document-api-adapters/plan-engine/snippet-builder.d.ts +21 -0
- package/dist/super-editor/src/document-api-adapters/plan-engine/snippet-builder.d.ts.map +1 -0
- package/dist/super-editor/src/document-api-adapters/plan-engine/style-resolver.d.ts.map +1 -1
- package/dist/super-editor/src/document-api-adapters/plan-engine/track-changes-wrappers.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/comment/comments-plugin.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/page-number/page-number.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/pagination/pagination-helpers.d.ts.map +1 -1
- package/dist/super-editor/src/index.d.ts.map +1 -1
- package/dist/super-editor.cjs +3 -2
- package/dist/super-editor.es.js +3 -3
- package/dist/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/superdoc/src/helpers/group-changes.d.ts.map +1 -1
- package/dist/superdoc/src/stores/comments-store.d.ts +4 -1
- package/dist/superdoc/src/stores/comments-store.d.ts.map +1 -1
- package/dist/superdoc/src/stores/superdoc-store.d.ts +12 -3
- package/dist/superdoc/src/stores/superdoc-store.d.ts.map +1 -1
- package/dist/superdoc.cjs +305 -187
- package/dist/superdoc.es.js +305 -187
- package/dist/superdoc.umd.js +3266 -1953
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -6520,7 +6520,7 @@ const translator$71 = NodeTranslator.from({
|
|
|
6520
6520
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
6521
6521
|
}
|
|
6522
6522
|
});
|
|
6523
|
-
const translator$76 = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
|
|
6523
|
+
const translator$76 = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification", "w:val", (v$1) => v$1 === "both" ? "justify" : v$1, (v$1) => v$1 === "justify" ? "both" : v$1));
|
|
6524
6524
|
const translator$77 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:keepLines"));
|
|
6525
6525
|
const translator$78 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:keepNext"));
|
|
6526
6526
|
const translator$80 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:kinsoku"));
|
|
@@ -16156,6 +16156,15 @@ const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
|
|
|
16156
16156
|
i++;
|
|
16157
16157
|
continue;
|
|
16158
16158
|
}
|
|
16159
|
+
const childElements = node.elements || [];
|
|
16160
|
+
if (childElements.length > 0) {
|
|
16161
|
+
for (const child of childElements) {
|
|
16162
|
+
if (Array.isArray(child.elements)) child.elements = preProcessPageFieldsOnly(child.elements, depth + 1).processedNodes;
|
|
16163
|
+
processedNodes.push(child);
|
|
16164
|
+
}
|
|
16165
|
+
i++;
|
|
16166
|
+
continue;
|
|
16167
|
+
}
|
|
16159
16168
|
}
|
|
16160
16169
|
if (fldType === "begin") {
|
|
16161
16170
|
const fieldInfo = scanFieldSequence(nodes, i);
|
|
@@ -16176,6 +16185,12 @@ const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
|
|
|
16176
16185
|
continue;
|
|
16177
16186
|
}
|
|
16178
16187
|
}
|
|
16188
|
+
if (node.name === "w:r" && node.elements?.some((el) => el.name === "w:pgNum")) {
|
|
16189
|
+
const processedField = preProcessPageInstruction([], "", node.elements.find((el) => el.name === "w:rPr") || null);
|
|
16190
|
+
processedNodes.push(...processedField);
|
|
16191
|
+
i++;
|
|
16192
|
+
continue;
|
|
16193
|
+
}
|
|
16179
16194
|
if (Array.isArray(node.elements)) node.elements = preProcessPageFieldsOnly(node.elements, depth + 1).processedNodes;
|
|
16180
16195
|
processedNodes.push(node);
|
|
16181
16196
|
i++;
|
|
@@ -27601,85 +27616,6 @@ const config$16 = {
|
|
|
27601
27616
|
attributes: validXmlAttributes$3
|
|
27602
27617
|
};
|
|
27603
27618
|
const translator$7 = NodeTranslator.from(config$16);
|
|
27604
|
-
var getColspan = (cell) => {
|
|
27605
|
-
const rawColspan = cell?.attrs?.colspan;
|
|
27606
|
-
const numericColspan = typeof rawColspan === "string" ? parseInt(rawColspan, 10) : rawColspan;
|
|
27607
|
-
return Number.isFinite(numericColspan) && numericColspan > 0 ? numericColspan : 1;
|
|
27608
|
-
};
|
|
27609
|
-
var resolveGridBefore = (row) => {
|
|
27610
|
-
const rawGridBefore = row?.attrs?.tableRowProperties?.gridBefore ?? row?.attrs?.gridBefore;
|
|
27611
|
-
const numericGridBefore = typeof rawGridBefore === "string" ? parseInt(rawGridBefore, 10) : rawGridBefore;
|
|
27612
|
-
if (!Number.isFinite(numericGridBefore) || numericGridBefore <= 0) return 0;
|
|
27613
|
-
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27614
|
-
let leadingGridBefore = 0;
|
|
27615
|
-
while (leadingGridBefore < cells.length && cells[leadingGridBefore]?.attrs?.__placeholder === "gridBefore") leadingGridBefore += 1;
|
|
27616
|
-
return leadingGridBefore > 0 ? 0 : numericGridBefore;
|
|
27617
|
-
};
|
|
27618
|
-
var advanceColumnsForCell = (columnIndex, cell) => columnIndex + getColspan(cell);
|
|
27619
|
-
var getCellStartColumn = (row, targetCell) => {
|
|
27620
|
-
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27621
|
-
let columnIndex = resolveGridBefore(row);
|
|
27622
|
-
for (const cell of cells) {
|
|
27623
|
-
if (cell === targetCell) return columnIndex;
|
|
27624
|
-
columnIndex = advanceColumnsForCell(columnIndex, cell);
|
|
27625
|
-
}
|
|
27626
|
-
return columnIndex;
|
|
27627
|
-
};
|
|
27628
|
-
var findCellCoveringColumn = (row, targetColumn) => {
|
|
27629
|
-
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27630
|
-
let columnIndex = resolveGridBefore(row);
|
|
27631
|
-
for (const cell of cells) {
|
|
27632
|
-
const colspan = getColspan(cell);
|
|
27633
|
-
if (targetColumn >= columnIndex && targetColumn < columnIndex + colspan) return cell;
|
|
27634
|
-
columnIndex = advanceColumnsForCell(columnIndex, cell);
|
|
27635
|
-
}
|
|
27636
|
-
return null;
|
|
27637
|
-
};
|
|
27638
|
-
var findInsertionIndexForColumn = (row, targetColumn) => {
|
|
27639
|
-
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27640
|
-
let columnIndex = resolveGridBefore(row);
|
|
27641
|
-
for (let index = 0; index < cells.length; index++) {
|
|
27642
|
-
if (columnIndex >= targetColumn) return index;
|
|
27643
|
-
columnIndex = advanceColumnsForCell(columnIndex, cells[index]);
|
|
27644
|
-
}
|
|
27645
|
-
return cells.length;
|
|
27646
|
-
};
|
|
27647
|
-
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
27648
|
-
if (!table || !Array.isArray(table.content)) return table;
|
|
27649
|
-
const rows = table.content;
|
|
27650
|
-
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
27651
|
-
const row = rows[rowIndex];
|
|
27652
|
-
if (!row) continue;
|
|
27653
|
-
if (!Array.isArray(row.content)) row.content = [];
|
|
27654
|
-
for (let cellIndex = 0; cellIndex < row.content.length; cellIndex++) {
|
|
27655
|
-
const cell = row.content[cellIndex];
|
|
27656
|
-
if (!cell) continue;
|
|
27657
|
-
const attrs = cell.attrs || {};
|
|
27658
|
-
const rawRowspan = typeof attrs.rowspan === "string" ? parseInt(attrs.rowspan, 10) : attrs.rowspan;
|
|
27659
|
-
if (!Number.isFinite(rawRowspan) || rawRowspan <= 1) continue;
|
|
27660
|
-
const maxRowspan = Math.min(rawRowspan, rows.length - rowIndex);
|
|
27661
|
-
const startColumn = getCellStartColumn(row, cell);
|
|
27662
|
-
for (let offset = 1; offset < maxRowspan; offset++) {
|
|
27663
|
-
const rowToChange = rows[rowIndex + offset];
|
|
27664
|
-
if (!rowToChange) continue;
|
|
27665
|
-
if (!Array.isArray(rowToChange.content)) rowToChange.content = [];
|
|
27666
|
-
if (findCellCoveringColumn(rowToChange, startColumn)?.attrs?.continueMerge) continue;
|
|
27667
|
-
const mergedCell = {
|
|
27668
|
-
type: cell.type,
|
|
27669
|
-
content: [editorSchema.nodes.paragraph.createAndFill().toJSON()],
|
|
27670
|
-
attrs: {
|
|
27671
|
-
...cell.attrs,
|
|
27672
|
-
rowspan: null,
|
|
27673
|
-
continueMerge: true
|
|
27674
|
-
}
|
|
27675
|
-
};
|
|
27676
|
-
const insertionIndex = findInsertionIndexForColumn(rowToChange, startColumn);
|
|
27677
|
-
rowToChange.content.splice(insertionIndex, 0, mergedCell);
|
|
27678
|
-
}
|
|
27679
|
-
}
|
|
27680
|
-
}
|
|
27681
|
-
return table;
|
|
27682
|
-
}
|
|
27683
27619
|
const translator$39 = NodeTranslator.from({
|
|
27684
27620
|
xmlName: "w:bidiVisual",
|
|
27685
27621
|
sdNodeOrKeyName: "rightToLeft",
|
|
@@ -27793,7 +27729,94 @@ var propertyTranslators$3 = [
|
|
|
27793
27729
|
translator$145
|
|
27794
27730
|
];
|
|
27795
27731
|
const translator$154 = NodeTranslator.from(createNestedPropertiesTranslator("w:tblPr", "tableProperties", propertyTranslators$3));
|
|
27796
|
-
|
|
27732
|
+
var propertyTranslators$2 = [
|
|
27733
|
+
translator$117,
|
|
27734
|
+
translator$120,
|
|
27735
|
+
translator$154,
|
|
27736
|
+
translator$162,
|
|
27737
|
+
translator$180
|
|
27738
|
+
];
|
|
27739
|
+
var attributeHandlers$1 = [createAttributeHandler("w:type")];
|
|
27740
|
+
const translator$191 = NodeTranslator.from(createNestedPropertiesTranslator("w:tblStylePr", "tableStyleProperties", propertyTranslators$2, {}, attributeHandlers$1));
|
|
27741
|
+
var getColspan = (cell) => {
|
|
27742
|
+
const rawColspan = cell?.attrs?.colspan;
|
|
27743
|
+
const numericColspan = typeof rawColspan === "string" ? parseInt(rawColspan, 10) : rawColspan;
|
|
27744
|
+
return Number.isFinite(numericColspan) && numericColspan > 0 ? numericColspan : 1;
|
|
27745
|
+
};
|
|
27746
|
+
var resolveGridBefore = (row) => {
|
|
27747
|
+
const rawGridBefore = row?.attrs?.tableRowProperties?.gridBefore ?? row?.attrs?.gridBefore;
|
|
27748
|
+
const numericGridBefore = typeof rawGridBefore === "string" ? parseInt(rawGridBefore, 10) : rawGridBefore;
|
|
27749
|
+
if (!Number.isFinite(numericGridBefore) || numericGridBefore <= 0) return 0;
|
|
27750
|
+
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27751
|
+
let leadingGridBefore = 0;
|
|
27752
|
+
while (leadingGridBefore < cells.length && cells[leadingGridBefore]?.attrs?.__placeholder === "gridBefore") leadingGridBefore += 1;
|
|
27753
|
+
return leadingGridBefore > 0 ? 0 : numericGridBefore;
|
|
27754
|
+
};
|
|
27755
|
+
var advanceColumnsForCell = (columnIndex, cell) => columnIndex + getColspan(cell);
|
|
27756
|
+
var getCellStartColumn = (row, targetCell) => {
|
|
27757
|
+
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27758
|
+
let columnIndex = resolveGridBefore(row);
|
|
27759
|
+
for (const cell of cells) {
|
|
27760
|
+
if (cell === targetCell) return columnIndex;
|
|
27761
|
+
columnIndex = advanceColumnsForCell(columnIndex, cell);
|
|
27762
|
+
}
|
|
27763
|
+
return columnIndex;
|
|
27764
|
+
};
|
|
27765
|
+
var findCellCoveringColumn = (row, targetColumn) => {
|
|
27766
|
+
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27767
|
+
let columnIndex = resolveGridBefore(row);
|
|
27768
|
+
for (const cell of cells) {
|
|
27769
|
+
const colspan = getColspan(cell);
|
|
27770
|
+
if (targetColumn >= columnIndex && targetColumn < columnIndex + colspan) return cell;
|
|
27771
|
+
columnIndex = advanceColumnsForCell(columnIndex, cell);
|
|
27772
|
+
}
|
|
27773
|
+
return null;
|
|
27774
|
+
};
|
|
27775
|
+
var findInsertionIndexForColumn = (row, targetColumn) => {
|
|
27776
|
+
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27777
|
+
let columnIndex = resolveGridBefore(row);
|
|
27778
|
+
for (let index = 0; index < cells.length; index++) {
|
|
27779
|
+
if (columnIndex >= targetColumn) return index;
|
|
27780
|
+
columnIndex = advanceColumnsForCell(columnIndex, cells[index]);
|
|
27781
|
+
}
|
|
27782
|
+
return cells.length;
|
|
27783
|
+
};
|
|
27784
|
+
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
27785
|
+
if (!table || !Array.isArray(table.content)) return table;
|
|
27786
|
+
const rows = table.content;
|
|
27787
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
27788
|
+
const row = rows[rowIndex];
|
|
27789
|
+
if (!row) continue;
|
|
27790
|
+
if (!Array.isArray(row.content)) row.content = [];
|
|
27791
|
+
for (let cellIndex = 0; cellIndex < row.content.length; cellIndex++) {
|
|
27792
|
+
const cell = row.content[cellIndex];
|
|
27793
|
+
if (!cell) continue;
|
|
27794
|
+
const attrs = cell.attrs || {};
|
|
27795
|
+
const rawRowspan = typeof attrs.rowspan === "string" ? parseInt(attrs.rowspan, 10) : attrs.rowspan;
|
|
27796
|
+
if (!Number.isFinite(rawRowspan) || rawRowspan <= 1) continue;
|
|
27797
|
+
const maxRowspan = Math.min(rawRowspan, rows.length - rowIndex);
|
|
27798
|
+
const startColumn = getCellStartColumn(row, cell);
|
|
27799
|
+
for (let offset = 1; offset < maxRowspan; offset++) {
|
|
27800
|
+
const rowToChange = rows[rowIndex + offset];
|
|
27801
|
+
if (!rowToChange) continue;
|
|
27802
|
+
if (!Array.isArray(rowToChange.content)) rowToChange.content = [];
|
|
27803
|
+
if (findCellCoveringColumn(rowToChange, startColumn)?.attrs?.continueMerge) continue;
|
|
27804
|
+
const mergedCell = {
|
|
27805
|
+
type: cell.type,
|
|
27806
|
+
content: [editorSchema.nodes.paragraph.createAndFill().toJSON()],
|
|
27807
|
+
attrs: {
|
|
27808
|
+
...cell.attrs,
|
|
27809
|
+
rowspan: null,
|
|
27810
|
+
continueMerge: true
|
|
27811
|
+
}
|
|
27812
|
+
};
|
|
27813
|
+
const insertionIndex = findInsertionIndexForColumn(rowToChange, startColumn);
|
|
27814
|
+
rowToChange.content.splice(insertionIndex, 0, mergedCell);
|
|
27815
|
+
}
|
|
27816
|
+
}
|
|
27817
|
+
}
|
|
27818
|
+
return table;
|
|
27819
|
+
}
|
|
27797
27820
|
const normalizeTwipWidth = (value) => {
|
|
27798
27821
|
if (value == null) return null;
|
|
27799
27822
|
const numericValue = typeof value === "string" ? parseInt(value, 10) : value;
|
|
@@ -27829,6 +27852,56 @@ const resolveFallbackColumnWidthTwips = (params, totalColumns, cellMinWidthTwips
|
|
|
27829
27852
|
if (!Number.isFinite(fallbackWidthTwips) || Number.isNaN(fallbackWidthTwips) || fallbackWidthTwips <= 0) return Math.max(pixelsToTwips(safeDefaultPx), cellMinWidthTwips);
|
|
27830
27853
|
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
27831
27854
|
};
|
|
27855
|
+
const DEFAULT_CONTENT_WIDTH_TWIPS = 12240 - 2 * 1440;
|
|
27856
|
+
const MIN_COLUMN_WIDTH_TWIPS = pixelsToTwips(10);
|
|
27857
|
+
const pctToPercent = (value) => {
|
|
27858
|
+
if (value == null) return null;
|
|
27859
|
+
return value / 50;
|
|
27860
|
+
};
|
|
27861
|
+
const resolveContentWidthTwips = () => DEFAULT_CONTENT_WIDTH_TWIPS;
|
|
27862
|
+
const resolveMeasurementWidthPx = (measurement) => {
|
|
27863
|
+
if (!measurement || typeof measurement.value !== "number" || measurement.value <= 0) return null;
|
|
27864
|
+
const { value, type } = measurement;
|
|
27865
|
+
if (!type || type === "auto") return null;
|
|
27866
|
+
if (type === "dxa") return twipsToPixels(value);
|
|
27867
|
+
if (type === "pct") {
|
|
27868
|
+
const percent = pctToPercent(value);
|
|
27869
|
+
if (percent == null || percent <= 0) return null;
|
|
27870
|
+
return twipsToPixels(resolveContentWidthTwips() * percent / 100);
|
|
27871
|
+
}
|
|
27872
|
+
return null;
|
|
27873
|
+
};
|
|
27874
|
+
const countColumnsInRow = (row) => {
|
|
27875
|
+
if (!row?.elements?.length) return 0;
|
|
27876
|
+
return row.elements.reduce((count, element) => {
|
|
27877
|
+
if (element.name !== "w:tc") return count;
|
|
27878
|
+
const gridSpan = (element.elements?.find((el) => el.name === "w:tcPr"))?.elements?.find((el) => el.name === "w:gridSpan");
|
|
27879
|
+
const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
|
|
27880
|
+
return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
|
|
27881
|
+
}, 0);
|
|
27882
|
+
};
|
|
27883
|
+
var clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
|
|
27884
|
+
var createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
|
|
27885
|
+
const buildFallbackGridForTable = ({ params, rows, tableWidth, tableWidthMeasurement }) => {
|
|
27886
|
+
const columnCount = countColumnsInRow(rows.find((row) => row.elements?.some((el) => el.name === "w:tc")));
|
|
27887
|
+
if (!columnCount) return null;
|
|
27888
|
+
const schemaDefaultPx = getSchemaDefaultColumnWidthPx(params);
|
|
27889
|
+
const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : 100;
|
|
27890
|
+
let totalWidthPx;
|
|
27891
|
+
if (tableWidthMeasurement) {
|
|
27892
|
+
const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
|
|
27893
|
+
if (resolved != null) totalWidthPx = resolved;
|
|
27894
|
+
}
|
|
27895
|
+
if (totalWidthPx == null && tableWidth?.width && tableWidth.width > 0) totalWidthPx = tableWidth.width;
|
|
27896
|
+
if (totalWidthPx == null) totalWidthPx = twipsToPixels(DEFAULT_CONTENT_WIDTH_TWIPS);
|
|
27897
|
+
const columnWidthTwips = clampColumnWidthTwips(pixelsToTwips(Math.max(totalWidthPx / columnCount, minimumColumnWidthPx)));
|
|
27898
|
+
const fallbackColumnWidthPx = twipsToPixels(columnWidthTwips);
|
|
27899
|
+
return {
|
|
27900
|
+
grid: createFallbackGrid(columnCount, columnWidthTwips),
|
|
27901
|
+
columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
|
|
27902
|
+
};
|
|
27903
|
+
};
|
|
27904
|
+
const translator$60 = NodeTranslator.from(createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString));
|
|
27832
27905
|
var XML_NODE_NAME$16 = "w:tblGrid";
|
|
27833
27906
|
var SD_ATTR_KEY$1 = "grid";
|
|
27834
27907
|
var cellMinWidth = pixelsToTwips(10);
|
|
@@ -27907,64 +27980,6 @@ var config$15 = {
|
|
|
27907
27980
|
decode: decode$33
|
|
27908
27981
|
};
|
|
27909
27982
|
const translator$148 = NodeTranslator.from(config$15);
|
|
27910
|
-
var propertyTranslators$2 = [
|
|
27911
|
-
translator$117,
|
|
27912
|
-
translator$120,
|
|
27913
|
-
translator$154,
|
|
27914
|
-
translator$162,
|
|
27915
|
-
translator$180
|
|
27916
|
-
];
|
|
27917
|
-
var attributeHandlers$1 = [createAttributeHandler("w:type")];
|
|
27918
|
-
const translator$191 = NodeTranslator.from(createNestedPropertiesTranslator("w:tblStylePr", "tableStyleProperties", propertyTranslators$2, {}, attributeHandlers$1));
|
|
27919
|
-
const DEFAULT_CONTENT_WIDTH_TWIPS = 12240 - 2 * 1440;
|
|
27920
|
-
const MIN_COLUMN_WIDTH_TWIPS = pixelsToTwips(10);
|
|
27921
|
-
const pctToPercent = (value) => {
|
|
27922
|
-
if (value == null) return null;
|
|
27923
|
-
return value / 50;
|
|
27924
|
-
};
|
|
27925
|
-
const resolveContentWidthTwips = () => DEFAULT_CONTENT_WIDTH_TWIPS;
|
|
27926
|
-
const resolveMeasurementWidthPx = (measurement) => {
|
|
27927
|
-
if (!measurement || typeof measurement.value !== "number" || measurement.value <= 0) return null;
|
|
27928
|
-
const { value, type } = measurement;
|
|
27929
|
-
if (!type || type === "auto") return null;
|
|
27930
|
-
if (type === "dxa") return twipsToPixels(value);
|
|
27931
|
-
if (type === "pct") {
|
|
27932
|
-
const percent = pctToPercent(value);
|
|
27933
|
-
if (percent == null || percent <= 0) return null;
|
|
27934
|
-
return twipsToPixels(resolveContentWidthTwips() * percent / 100);
|
|
27935
|
-
}
|
|
27936
|
-
return null;
|
|
27937
|
-
};
|
|
27938
|
-
const countColumnsInRow = (row) => {
|
|
27939
|
-
if (!row?.elements?.length) return 0;
|
|
27940
|
-
return row.elements.reduce((count, element) => {
|
|
27941
|
-
if (element.name !== "w:tc") return count;
|
|
27942
|
-
const gridSpan = (element.elements?.find((el) => el.name === "w:tcPr"))?.elements?.find((el) => el.name === "w:gridSpan");
|
|
27943
|
-
const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
|
|
27944
|
-
return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
|
|
27945
|
-
}, 0);
|
|
27946
|
-
};
|
|
27947
|
-
var clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
|
|
27948
|
-
var createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
|
|
27949
|
-
const buildFallbackGridForTable = ({ params, rows, tableWidth, tableWidthMeasurement }) => {
|
|
27950
|
-
const columnCount = countColumnsInRow(rows.find((row) => row.elements?.some((el) => el.name === "w:tc")));
|
|
27951
|
-
if (!columnCount) return null;
|
|
27952
|
-
const schemaDefaultPx = getSchemaDefaultColumnWidthPx(params);
|
|
27953
|
-
const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : 100;
|
|
27954
|
-
let totalWidthPx;
|
|
27955
|
-
if (tableWidthMeasurement) {
|
|
27956
|
-
const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
|
|
27957
|
-
if (resolved != null) totalWidthPx = resolved;
|
|
27958
|
-
}
|
|
27959
|
-
if (totalWidthPx == null && tableWidth?.width && tableWidth.width > 0) totalWidthPx = tableWidth.width;
|
|
27960
|
-
if (totalWidthPx == null) totalWidthPx = minimumColumnWidthPx * columnCount;
|
|
27961
|
-
const columnWidthTwips = clampColumnWidthTwips(pixelsToTwips(Math.max(totalWidthPx / columnCount, minimumColumnWidthPx)));
|
|
27962
|
-
const fallbackColumnWidthPx = twipsToPixels(columnWidthTwips);
|
|
27963
|
-
return {
|
|
27964
|
-
grid: createFallbackGrid(columnCount, columnWidthTwips),
|
|
27965
|
-
columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
|
|
27966
|
-
};
|
|
27967
|
-
};
|
|
27968
27983
|
var XML_NODE_NAME$15 = "w:tbl";
|
|
27969
27984
|
var SD_NODE_NAME$14 = "table";
|
|
27970
27985
|
var INDENT_TWIPS_TOLERANCE = 5;
|
|
@@ -28062,7 +28077,7 @@ var encode$30 = (params, encodedAttrs) => {
|
|
|
28062
28077
|
const rowTcWTwipsTotal = hasExplicitGrid && hasIndent ? getFirstRowCellWidthSumTwips(rows) : null;
|
|
28063
28078
|
const indentDiff = rowTcWTwipsTotal != null && gridTwipsTotal != null ? rowTcWTwipsTotal - gridTwipsTotal : null;
|
|
28064
28079
|
const preferTableGridWidths = hasExplicitGrid && hasIndent && gridTwipsTotal != null && rowTcWTwipsTotal != null && Math.sign(indentDiff) === Math.sign(tableIndentTwips) && Math.abs(indentDiff - tableIndentTwips) <= INDENT_TWIPS_TOLERANCE;
|
|
28065
|
-
if (!columnWidths.length) {
|
|
28080
|
+
if (!(columnWidths.length > 0 && columnWidths.some((w$1) => w$1 > 0))) {
|
|
28066
28081
|
const fallback = buildFallbackGridForTable({
|
|
28067
28082
|
params,
|
|
28068
28083
|
rows,
|
|
@@ -28073,6 +28088,11 @@ var encode$30 = (params, encodedAttrs) => {
|
|
|
28073
28088
|
encodedAttrs.grid = fallback.grid;
|
|
28074
28089
|
columnWidths = fallback.columnWidths;
|
|
28075
28090
|
}
|
|
28091
|
+
const tw = encodedAttrs.tableWidth;
|
|
28092
|
+
if (!(tw && tw.type !== "auto" && (tw.width > 0 || tw.value > 0))) encodedAttrs.tableWidth = {
|
|
28093
|
+
value: 5e3,
|
|
28094
|
+
type: "pct"
|
|
28095
|
+
};
|
|
28076
28096
|
}
|
|
28077
28097
|
const content = [];
|
|
28078
28098
|
const totalColumns = columnWidths.length;
|
|
@@ -33819,7 +33839,7 @@ var SuperConverter = class SuperConverter {
|
|
|
33819
33839
|
static getStoredSuperdocVersion(docx) {
|
|
33820
33840
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
33821
33841
|
}
|
|
33822
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.17.0-next.
|
|
33842
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.17.0-next.11") {
|
|
33823
33843
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
33824
33844
|
}
|
|
33825
33845
|
static generateWordTimestamp() {
|