@harbour-enterprises/superdoc 1.17.0-next.1 → 1.17.0-next.10
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-BNtgL-OA.cjs → SuperConverter-BQs6tZ2x.cjs} +163 -143
- package/dist/chunks/{SuperConverter-K4WSGFuY.es.js → SuperConverter-CqDsHOKA.es.js} +161 -141
- package/dist/chunks/{src-CTUYPp9B.es.js → src-C4SehkH8.es.js} +2727 -1552
- package/dist/chunks/{src-CoenE8GQ.cjs → src-_k0ahqT1.cjs} +2887 -1721
- package/dist/style.css +63 -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 +291 -202
- package/dist/superdoc.es.js +291 -202
- package/dist/superdoc.umd.js +3284 -2001
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -6529,7 +6529,7 @@ const translator$71 = NodeTranslator.from({
|
|
|
6529
6529
|
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
6530
6530
|
}
|
|
6531
6531
|
});
|
|
6532
|
-
const translator$76 = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
|
|
6532
|
+
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));
|
|
6533
6533
|
const translator$77 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:keepLines"));
|
|
6534
6534
|
const translator$78 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:keepNext"));
|
|
6535
6535
|
const translator$80 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:kinsoku"));
|
|
@@ -16167,6 +16167,15 @@ const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
|
|
|
16167
16167
|
i++;
|
|
16168
16168
|
continue;
|
|
16169
16169
|
}
|
|
16170
|
+
const childElements = node.elements || [];
|
|
16171
|
+
if (childElements.length > 0) {
|
|
16172
|
+
for (const child of childElements) {
|
|
16173
|
+
if (Array.isArray(child.elements)) child.elements = preProcessPageFieldsOnly(child.elements, depth + 1).processedNodes;
|
|
16174
|
+
processedNodes.push(child);
|
|
16175
|
+
}
|
|
16176
|
+
i++;
|
|
16177
|
+
continue;
|
|
16178
|
+
}
|
|
16170
16179
|
}
|
|
16171
16180
|
if (fldType === "begin") {
|
|
16172
16181
|
const fieldInfo = scanFieldSequence(nodes, i);
|
|
@@ -16187,6 +16196,12 @@ const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
|
|
|
16187
16196
|
continue;
|
|
16188
16197
|
}
|
|
16189
16198
|
}
|
|
16199
|
+
if (node.name === "w:r" && node.elements?.some((el) => el.name === "w:pgNum")) {
|
|
16200
|
+
const processedField = preProcessPageInstruction([], "", node.elements.find((el) => el.name === "w:rPr") || null);
|
|
16201
|
+
processedNodes.push(...processedField);
|
|
16202
|
+
i++;
|
|
16203
|
+
continue;
|
|
16204
|
+
}
|
|
16190
16205
|
if (Array.isArray(node.elements)) node.elements = preProcessPageFieldsOnly(node.elements, depth + 1).processedNodes;
|
|
16191
16206
|
processedNodes.push(node);
|
|
16192
16207
|
i++;
|
|
@@ -27608,85 +27623,6 @@ const config$16 = {
|
|
|
27608
27623
|
attributes: validXmlAttributes$3
|
|
27609
27624
|
};
|
|
27610
27625
|
const translator$7 = NodeTranslator.from(config$16);
|
|
27611
|
-
var getColspan = (cell) => {
|
|
27612
|
-
const rawColspan = cell?.attrs?.colspan;
|
|
27613
|
-
const numericColspan = typeof rawColspan === "string" ? parseInt(rawColspan, 10) : rawColspan;
|
|
27614
|
-
return Number.isFinite(numericColspan) && numericColspan > 0 ? numericColspan : 1;
|
|
27615
|
-
};
|
|
27616
|
-
var resolveGridBefore = (row) => {
|
|
27617
|
-
const rawGridBefore = row?.attrs?.tableRowProperties?.gridBefore ?? row?.attrs?.gridBefore;
|
|
27618
|
-
const numericGridBefore = typeof rawGridBefore === "string" ? parseInt(rawGridBefore, 10) : rawGridBefore;
|
|
27619
|
-
if (!Number.isFinite(numericGridBefore) || numericGridBefore <= 0) return 0;
|
|
27620
|
-
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27621
|
-
let leadingGridBefore = 0;
|
|
27622
|
-
while (leadingGridBefore < cells.length && cells[leadingGridBefore]?.attrs?.__placeholder === "gridBefore") leadingGridBefore += 1;
|
|
27623
|
-
return leadingGridBefore > 0 ? 0 : numericGridBefore;
|
|
27624
|
-
};
|
|
27625
|
-
var advanceColumnsForCell = (columnIndex, cell) => columnIndex + getColspan(cell);
|
|
27626
|
-
var getCellStartColumn = (row, targetCell) => {
|
|
27627
|
-
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27628
|
-
let columnIndex = resolveGridBefore(row);
|
|
27629
|
-
for (const cell of cells) {
|
|
27630
|
-
if (cell === targetCell) return columnIndex;
|
|
27631
|
-
columnIndex = advanceColumnsForCell(columnIndex, cell);
|
|
27632
|
-
}
|
|
27633
|
-
return columnIndex;
|
|
27634
|
-
};
|
|
27635
|
-
var findCellCoveringColumn = (row, targetColumn) => {
|
|
27636
|
-
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27637
|
-
let columnIndex = resolveGridBefore(row);
|
|
27638
|
-
for (const cell of cells) {
|
|
27639
|
-
const colspan = getColspan(cell);
|
|
27640
|
-
if (targetColumn >= columnIndex && targetColumn < columnIndex + colspan) return cell;
|
|
27641
|
-
columnIndex = advanceColumnsForCell(columnIndex, cell);
|
|
27642
|
-
}
|
|
27643
|
-
return null;
|
|
27644
|
-
};
|
|
27645
|
-
var findInsertionIndexForColumn = (row, targetColumn) => {
|
|
27646
|
-
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27647
|
-
let columnIndex = resolveGridBefore(row);
|
|
27648
|
-
for (let index = 0; index < cells.length; index++) {
|
|
27649
|
-
if (columnIndex >= targetColumn) return index;
|
|
27650
|
-
columnIndex = advanceColumnsForCell(columnIndex, cells[index]);
|
|
27651
|
-
}
|
|
27652
|
-
return cells.length;
|
|
27653
|
-
};
|
|
27654
|
-
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
27655
|
-
if (!table || !Array.isArray(table.content)) return table;
|
|
27656
|
-
const rows = table.content;
|
|
27657
|
-
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
27658
|
-
const row = rows[rowIndex];
|
|
27659
|
-
if (!row) continue;
|
|
27660
|
-
if (!Array.isArray(row.content)) row.content = [];
|
|
27661
|
-
for (let cellIndex = 0; cellIndex < row.content.length; cellIndex++) {
|
|
27662
|
-
const cell = row.content[cellIndex];
|
|
27663
|
-
if (!cell) continue;
|
|
27664
|
-
const attrs = cell.attrs || {};
|
|
27665
|
-
const rawRowspan = typeof attrs.rowspan === "string" ? parseInt(attrs.rowspan, 10) : attrs.rowspan;
|
|
27666
|
-
if (!Number.isFinite(rawRowspan) || rawRowspan <= 1) continue;
|
|
27667
|
-
const maxRowspan = Math.min(rawRowspan, rows.length - rowIndex);
|
|
27668
|
-
const startColumn = getCellStartColumn(row, cell);
|
|
27669
|
-
for (let offset = 1; offset < maxRowspan; offset++) {
|
|
27670
|
-
const rowToChange = rows[rowIndex + offset];
|
|
27671
|
-
if (!rowToChange) continue;
|
|
27672
|
-
if (!Array.isArray(rowToChange.content)) rowToChange.content = [];
|
|
27673
|
-
if (findCellCoveringColumn(rowToChange, startColumn)?.attrs?.continueMerge) continue;
|
|
27674
|
-
const mergedCell = {
|
|
27675
|
-
type: cell.type,
|
|
27676
|
-
content: [editorSchema.nodes.paragraph.createAndFill().toJSON()],
|
|
27677
|
-
attrs: {
|
|
27678
|
-
...cell.attrs,
|
|
27679
|
-
rowspan: null,
|
|
27680
|
-
continueMerge: true
|
|
27681
|
-
}
|
|
27682
|
-
};
|
|
27683
|
-
const insertionIndex = findInsertionIndexForColumn(rowToChange, startColumn);
|
|
27684
|
-
rowToChange.content.splice(insertionIndex, 0, mergedCell);
|
|
27685
|
-
}
|
|
27686
|
-
}
|
|
27687
|
-
}
|
|
27688
|
-
return table;
|
|
27689
|
-
}
|
|
27690
27626
|
const translator$39 = NodeTranslator.from({
|
|
27691
27627
|
xmlName: "w:bidiVisual",
|
|
27692
27628
|
sdNodeOrKeyName: "rightToLeft",
|
|
@@ -27800,7 +27736,94 @@ var propertyTranslators$3 = [
|
|
|
27800
27736
|
translator$145
|
|
27801
27737
|
];
|
|
27802
27738
|
const translator$154 = NodeTranslator.from(createNestedPropertiesTranslator("w:tblPr", "tableProperties", propertyTranslators$3));
|
|
27803
|
-
|
|
27739
|
+
var propertyTranslators$2 = [
|
|
27740
|
+
translator$117,
|
|
27741
|
+
translator$120,
|
|
27742
|
+
translator$154,
|
|
27743
|
+
translator$162,
|
|
27744
|
+
translator$180
|
|
27745
|
+
];
|
|
27746
|
+
var attributeHandlers$1 = [createAttributeHandler("w:type")];
|
|
27747
|
+
const translator$191 = NodeTranslator.from(createNestedPropertiesTranslator("w:tblStylePr", "tableStyleProperties", propertyTranslators$2, {}, attributeHandlers$1));
|
|
27748
|
+
var getColspan = (cell) => {
|
|
27749
|
+
const rawColspan = cell?.attrs?.colspan;
|
|
27750
|
+
const numericColspan = typeof rawColspan === "string" ? parseInt(rawColspan, 10) : rawColspan;
|
|
27751
|
+
return Number.isFinite(numericColspan) && numericColspan > 0 ? numericColspan : 1;
|
|
27752
|
+
};
|
|
27753
|
+
var resolveGridBefore = (row) => {
|
|
27754
|
+
const rawGridBefore = row?.attrs?.tableRowProperties?.gridBefore ?? row?.attrs?.gridBefore;
|
|
27755
|
+
const numericGridBefore = typeof rawGridBefore === "string" ? parseInt(rawGridBefore, 10) : rawGridBefore;
|
|
27756
|
+
if (!Number.isFinite(numericGridBefore) || numericGridBefore <= 0) return 0;
|
|
27757
|
+
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27758
|
+
let leadingGridBefore = 0;
|
|
27759
|
+
while (leadingGridBefore < cells.length && cells[leadingGridBefore]?.attrs?.__placeholder === "gridBefore") leadingGridBefore += 1;
|
|
27760
|
+
return leadingGridBefore > 0 ? 0 : numericGridBefore;
|
|
27761
|
+
};
|
|
27762
|
+
var advanceColumnsForCell = (columnIndex, cell) => columnIndex + getColspan(cell);
|
|
27763
|
+
var getCellStartColumn = (row, targetCell) => {
|
|
27764
|
+
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27765
|
+
let columnIndex = resolveGridBefore(row);
|
|
27766
|
+
for (const cell of cells) {
|
|
27767
|
+
if (cell === targetCell) return columnIndex;
|
|
27768
|
+
columnIndex = advanceColumnsForCell(columnIndex, cell);
|
|
27769
|
+
}
|
|
27770
|
+
return columnIndex;
|
|
27771
|
+
};
|
|
27772
|
+
var findCellCoveringColumn = (row, targetColumn) => {
|
|
27773
|
+
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27774
|
+
let columnIndex = resolveGridBefore(row);
|
|
27775
|
+
for (const cell of cells) {
|
|
27776
|
+
const colspan = getColspan(cell);
|
|
27777
|
+
if (targetColumn >= columnIndex && targetColumn < columnIndex + colspan) return cell;
|
|
27778
|
+
columnIndex = advanceColumnsForCell(columnIndex, cell);
|
|
27779
|
+
}
|
|
27780
|
+
return null;
|
|
27781
|
+
};
|
|
27782
|
+
var findInsertionIndexForColumn = (row, targetColumn) => {
|
|
27783
|
+
const cells = Array.isArray(row.content) ? row.content : [];
|
|
27784
|
+
let columnIndex = resolveGridBefore(row);
|
|
27785
|
+
for (let index = 0; index < cells.length; index++) {
|
|
27786
|
+
if (columnIndex >= targetColumn) return index;
|
|
27787
|
+
columnIndex = advanceColumnsForCell(columnIndex, cells[index]);
|
|
27788
|
+
}
|
|
27789
|
+
return cells.length;
|
|
27790
|
+
};
|
|
27791
|
+
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
27792
|
+
if (!table || !Array.isArray(table.content)) return table;
|
|
27793
|
+
const rows = table.content;
|
|
27794
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
27795
|
+
const row = rows[rowIndex];
|
|
27796
|
+
if (!row) continue;
|
|
27797
|
+
if (!Array.isArray(row.content)) row.content = [];
|
|
27798
|
+
for (let cellIndex = 0; cellIndex < row.content.length; cellIndex++) {
|
|
27799
|
+
const cell = row.content[cellIndex];
|
|
27800
|
+
if (!cell) continue;
|
|
27801
|
+
const attrs = cell.attrs || {};
|
|
27802
|
+
const rawRowspan = typeof attrs.rowspan === "string" ? parseInt(attrs.rowspan, 10) : attrs.rowspan;
|
|
27803
|
+
if (!Number.isFinite(rawRowspan) || rawRowspan <= 1) continue;
|
|
27804
|
+
const maxRowspan = Math.min(rawRowspan, rows.length - rowIndex);
|
|
27805
|
+
const startColumn = getCellStartColumn(row, cell);
|
|
27806
|
+
for (let offset = 1; offset < maxRowspan; offset++) {
|
|
27807
|
+
const rowToChange = rows[rowIndex + offset];
|
|
27808
|
+
if (!rowToChange) continue;
|
|
27809
|
+
if (!Array.isArray(rowToChange.content)) rowToChange.content = [];
|
|
27810
|
+
if (findCellCoveringColumn(rowToChange, startColumn)?.attrs?.continueMerge) continue;
|
|
27811
|
+
const mergedCell = {
|
|
27812
|
+
type: cell.type,
|
|
27813
|
+
content: [editorSchema.nodes.paragraph.createAndFill().toJSON()],
|
|
27814
|
+
attrs: {
|
|
27815
|
+
...cell.attrs,
|
|
27816
|
+
rowspan: null,
|
|
27817
|
+
continueMerge: true
|
|
27818
|
+
}
|
|
27819
|
+
};
|
|
27820
|
+
const insertionIndex = findInsertionIndexForColumn(rowToChange, startColumn);
|
|
27821
|
+
rowToChange.content.splice(insertionIndex, 0, mergedCell);
|
|
27822
|
+
}
|
|
27823
|
+
}
|
|
27824
|
+
}
|
|
27825
|
+
return table;
|
|
27826
|
+
}
|
|
27804
27827
|
const DEFAULT_COLUMN_WIDTH_PX = 100;
|
|
27805
27828
|
const normalizeTwipWidth = (value) => {
|
|
27806
27829
|
if (value == null) return null;
|
|
@@ -27837,6 +27860,58 @@ const resolveFallbackColumnWidthTwips = (params, totalColumns, cellMinWidthTwips
|
|
|
27837
27860
|
if (!Number.isFinite(fallbackWidthTwips) || Number.isNaN(fallbackWidthTwips) || fallbackWidthTwips <= 0) return Math.max(require_constants.pixelsToTwips(safeDefaultPx), cellMinWidthTwips);
|
|
27838
27861
|
return Math.max(fallbackWidthTwips, cellMinWidthTwips);
|
|
27839
27862
|
};
|
|
27863
|
+
const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
|
|
27864
|
+
const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
|
|
27865
|
+
const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
|
|
27866
|
+
const MIN_COLUMN_WIDTH_TWIPS = require_constants.pixelsToTwips(10);
|
|
27867
|
+
const pctToPercent = (value) => {
|
|
27868
|
+
if (value == null) return null;
|
|
27869
|
+
return value / 50;
|
|
27870
|
+
};
|
|
27871
|
+
const resolveContentWidthTwips = () => DEFAULT_CONTENT_WIDTH_TWIPS;
|
|
27872
|
+
const resolveMeasurementWidthPx = (measurement) => {
|
|
27873
|
+
if (!measurement || typeof measurement.value !== "number" || measurement.value <= 0) return null;
|
|
27874
|
+
const { value, type } = measurement;
|
|
27875
|
+
if (!type || type === "auto") return null;
|
|
27876
|
+
if (type === "dxa") return require_constants.twipsToPixels(value);
|
|
27877
|
+
if (type === "pct") {
|
|
27878
|
+
const percent = pctToPercent(value);
|
|
27879
|
+
if (percent == null || percent <= 0) return null;
|
|
27880
|
+
return require_constants.twipsToPixels(resolveContentWidthTwips() * percent / 100);
|
|
27881
|
+
}
|
|
27882
|
+
return null;
|
|
27883
|
+
};
|
|
27884
|
+
const countColumnsInRow = (row) => {
|
|
27885
|
+
if (!row?.elements?.length) return 0;
|
|
27886
|
+
return row.elements.reduce((count, element) => {
|
|
27887
|
+
if (element.name !== "w:tc") return count;
|
|
27888
|
+
const gridSpan = (element.elements?.find((el) => el.name === "w:tcPr"))?.elements?.find((el) => el.name === "w:gridSpan");
|
|
27889
|
+
const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
|
|
27890
|
+
return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
|
|
27891
|
+
}, 0);
|
|
27892
|
+
};
|
|
27893
|
+
var clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
|
|
27894
|
+
var createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
|
|
27895
|
+
const buildFallbackGridForTable = ({ params, rows, tableWidth, tableWidthMeasurement }) => {
|
|
27896
|
+
const columnCount = countColumnsInRow(rows.find((row) => row.elements?.some((el) => el.name === "w:tc")));
|
|
27897
|
+
if (!columnCount) return null;
|
|
27898
|
+
const schemaDefaultPx = getSchemaDefaultColumnWidthPx(params);
|
|
27899
|
+
const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : 100;
|
|
27900
|
+
let totalWidthPx;
|
|
27901
|
+
if (tableWidthMeasurement) {
|
|
27902
|
+
const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
|
|
27903
|
+
if (resolved != null) totalWidthPx = resolved;
|
|
27904
|
+
}
|
|
27905
|
+
if (totalWidthPx == null && tableWidth?.width && tableWidth.width > 0) totalWidthPx = tableWidth.width;
|
|
27906
|
+
if (totalWidthPx == null) totalWidthPx = require_constants.twipsToPixels(DEFAULT_CONTENT_WIDTH_TWIPS);
|
|
27907
|
+
const columnWidthTwips = clampColumnWidthTwips(require_constants.pixelsToTwips(Math.max(totalWidthPx / columnCount, minimumColumnWidthPx)));
|
|
27908
|
+
const fallbackColumnWidthPx = require_constants.twipsToPixels(columnWidthTwips);
|
|
27909
|
+
return {
|
|
27910
|
+
grid: createFallbackGrid(columnCount, columnWidthTwips),
|
|
27911
|
+
columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
|
|
27912
|
+
};
|
|
27913
|
+
};
|
|
27914
|
+
const translator$60 = NodeTranslator.from(createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString));
|
|
27840
27915
|
var XML_NODE_NAME$16 = "w:tblGrid";
|
|
27841
27916
|
var SD_ATTR_KEY$1 = "grid";
|
|
27842
27917
|
var cellMinWidth = require_constants.pixelsToTwips(10);
|
|
@@ -27915,66 +27990,6 @@ var config$15 = {
|
|
|
27915
27990
|
decode: decode$33
|
|
27916
27991
|
};
|
|
27917
27992
|
const translator$148 = NodeTranslator.from(config$15);
|
|
27918
|
-
var propertyTranslators$2 = [
|
|
27919
|
-
translator$117,
|
|
27920
|
-
translator$120,
|
|
27921
|
-
translator$154,
|
|
27922
|
-
translator$162,
|
|
27923
|
-
translator$180
|
|
27924
|
-
];
|
|
27925
|
-
var attributeHandlers$1 = [createAttributeHandler("w:type")];
|
|
27926
|
-
const translator$191 = NodeTranslator.from(createNestedPropertiesTranslator("w:tblStylePr", "tableStyleProperties", propertyTranslators$2, {}, attributeHandlers$1));
|
|
27927
|
-
const DEFAULT_PAGE_WIDTH_TWIPS = 12240;
|
|
27928
|
-
const DEFAULT_PAGE_MARGIN_TWIPS = 1440;
|
|
27929
|
-
const DEFAULT_CONTENT_WIDTH_TWIPS = DEFAULT_PAGE_WIDTH_TWIPS - 2 * DEFAULT_PAGE_MARGIN_TWIPS;
|
|
27930
|
-
const MIN_COLUMN_WIDTH_TWIPS = require_constants.pixelsToTwips(10);
|
|
27931
|
-
const pctToPercent = (value) => {
|
|
27932
|
-
if (value == null) return null;
|
|
27933
|
-
return value / 50;
|
|
27934
|
-
};
|
|
27935
|
-
const resolveContentWidthTwips = () => DEFAULT_CONTENT_WIDTH_TWIPS;
|
|
27936
|
-
const resolveMeasurementWidthPx = (measurement) => {
|
|
27937
|
-
if (!measurement || typeof measurement.value !== "number" || measurement.value <= 0) return null;
|
|
27938
|
-
const { value, type } = measurement;
|
|
27939
|
-
if (!type || type === "auto") return null;
|
|
27940
|
-
if (type === "dxa") return require_constants.twipsToPixels(value);
|
|
27941
|
-
if (type === "pct") {
|
|
27942
|
-
const percent = pctToPercent(value);
|
|
27943
|
-
if (percent == null || percent <= 0) return null;
|
|
27944
|
-
return require_constants.twipsToPixels(resolveContentWidthTwips() * percent / 100);
|
|
27945
|
-
}
|
|
27946
|
-
return null;
|
|
27947
|
-
};
|
|
27948
|
-
const countColumnsInRow = (row) => {
|
|
27949
|
-
if (!row?.elements?.length) return 0;
|
|
27950
|
-
return row.elements.reduce((count, element) => {
|
|
27951
|
-
if (element.name !== "w:tc") return count;
|
|
27952
|
-
const gridSpan = (element.elements?.find((el) => el.name === "w:tcPr"))?.elements?.find((el) => el.name === "w:gridSpan");
|
|
27953
|
-
const spanValue = parseInt(gridSpan?.attributes?.["w:val"] || "1", 10);
|
|
27954
|
-
return count + (Number.isFinite(spanValue) && spanValue > 0 ? spanValue : 1);
|
|
27955
|
-
}, 0);
|
|
27956
|
-
};
|
|
27957
|
-
var clampColumnWidthTwips = (value) => Math.max(Math.round(value), MIN_COLUMN_WIDTH_TWIPS);
|
|
27958
|
-
var createFallbackGrid = (columnCount, columnWidthTwips) => Array.from({ length: columnCount }, () => ({ col: clampColumnWidthTwips(columnWidthTwips) }));
|
|
27959
|
-
const buildFallbackGridForTable = ({ params, rows, tableWidth, tableWidthMeasurement }) => {
|
|
27960
|
-
const columnCount = countColumnsInRow(rows.find((row) => row.elements?.some((el) => el.name === "w:tc")));
|
|
27961
|
-
if (!columnCount) return null;
|
|
27962
|
-
const schemaDefaultPx = getSchemaDefaultColumnWidthPx(params);
|
|
27963
|
-
const minimumColumnWidthPx = Number.isFinite(schemaDefaultPx) && schemaDefaultPx > 0 ? schemaDefaultPx : 100;
|
|
27964
|
-
let totalWidthPx;
|
|
27965
|
-
if (tableWidthMeasurement) {
|
|
27966
|
-
const resolved = resolveMeasurementWidthPx(tableWidthMeasurement);
|
|
27967
|
-
if (resolved != null) totalWidthPx = resolved;
|
|
27968
|
-
}
|
|
27969
|
-
if (totalWidthPx == null && tableWidth?.width && tableWidth.width > 0) totalWidthPx = tableWidth.width;
|
|
27970
|
-
if (totalWidthPx == null) totalWidthPx = minimumColumnWidthPx * columnCount;
|
|
27971
|
-
const columnWidthTwips = clampColumnWidthTwips(require_constants.pixelsToTwips(Math.max(totalWidthPx / columnCount, minimumColumnWidthPx)));
|
|
27972
|
-
const fallbackColumnWidthPx = require_constants.twipsToPixels(columnWidthTwips);
|
|
27973
|
-
return {
|
|
27974
|
-
grid: createFallbackGrid(columnCount, columnWidthTwips),
|
|
27975
|
-
columnWidths: Array(columnCount).fill(fallbackColumnWidthPx)
|
|
27976
|
-
};
|
|
27977
|
-
};
|
|
27978
27993
|
var XML_NODE_NAME$15 = "w:tbl";
|
|
27979
27994
|
var SD_NODE_NAME$14 = "table";
|
|
27980
27995
|
var INDENT_TWIPS_TOLERANCE = 5;
|
|
@@ -28072,7 +28087,7 @@ var encode$30 = (params, encodedAttrs) => {
|
|
|
28072
28087
|
const rowTcWTwipsTotal = hasExplicitGrid && hasIndent ? getFirstRowCellWidthSumTwips(rows) : null;
|
|
28073
28088
|
const indentDiff = rowTcWTwipsTotal != null && gridTwipsTotal != null ? rowTcWTwipsTotal - gridTwipsTotal : null;
|
|
28074
28089
|
const preferTableGridWidths = hasExplicitGrid && hasIndent && gridTwipsTotal != null && rowTcWTwipsTotal != null && Math.sign(indentDiff) === Math.sign(tableIndentTwips) && Math.abs(indentDiff - tableIndentTwips) <= INDENT_TWIPS_TOLERANCE;
|
|
28075
|
-
if (!columnWidths.length) {
|
|
28090
|
+
if (!(columnWidths.length > 0 && columnWidths.some((w$1) => w$1 > 0))) {
|
|
28076
28091
|
const fallback = buildFallbackGridForTable({
|
|
28077
28092
|
params,
|
|
28078
28093
|
rows,
|
|
@@ -28083,6 +28098,11 @@ var encode$30 = (params, encodedAttrs) => {
|
|
|
28083
28098
|
encodedAttrs.grid = fallback.grid;
|
|
28084
28099
|
columnWidths = fallback.columnWidths;
|
|
28085
28100
|
}
|
|
28101
|
+
const tw = encodedAttrs.tableWidth;
|
|
28102
|
+
if (!(tw && tw.type !== "auto" && (tw.width > 0 || tw.value > 0))) encodedAttrs.tableWidth = {
|
|
28103
|
+
value: 5e3,
|
|
28104
|
+
type: "pct"
|
|
28105
|
+
};
|
|
28086
28106
|
}
|
|
28087
28107
|
const content = [];
|
|
28088
28108
|
const totalColumns = columnWidths.length;
|
|
@@ -33833,7 +33853,7 @@ var SuperConverter = class SuperConverter {
|
|
|
33833
33853
|
static getStoredSuperdocVersion(docx) {
|
|
33834
33854
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
33835
33855
|
}
|
|
33836
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.17.0-next.
|
|
33856
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.17.0-next.10") {
|
|
33837
33857
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
33838
33858
|
}
|
|
33839
33859
|
static generateWordTimestamp() {
|