@harbour-enterprises/superdoc 0.20.0-next.5 → 0.20.0-next.6
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/{PdfViewer-Blwty0A0.cjs → PdfViewer--YKlzafo.cjs} +1 -1
- package/dist/chunks/{PdfViewer-DcPZsBsK.es.js → PdfViewer-CuiUv0d5.es.js} +1 -1
- package/dist/chunks/{index-BZzn2Rcn.es.js → index-Cl1u_lKk.es.js} +2 -2
- package/dist/chunks/{index-BB5vhzVT.cjs → index-CuHtS7O9.cjs} +2 -2
- package/dist/chunks/{super-editor.es-BgBNGRxg.cjs → super-editor.es-BIW7iKAk.cjs} +736 -464
- package/dist/chunks/{super-editor.es-BTcVSa_f.es.js → super-editor.es-DN4v75aq.es.js} +736 -464
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BPTfSIJf.js → converter-kutpjDQU.js} +687 -470
- package/dist/super-editor/chunks/{docx-zipper-ikgI-2vM.js → docx-zipper-BjcI24VU.js} +1 -1
- package/dist/super-editor/chunks/{editor-hh7sL4Wv.js → editor-ps-v4FlA.js} +55 -2
- package/dist/super-editor/chunks/{toolbar-B-apzt27.js → toolbar-Ch271j8X.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/src/core/super-converter/v2/importer/tableImporter.d.ts +0 -22
- package/dist/super-editor/src/core/super-converter/v3/handlers/utils.d.ts +10 -3
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/bidiVisual/bidiVisual-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/bidiVisual/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/bottom/bottom-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/bottom/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/bottom/marginBottom-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/end/end-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/end/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/end/marginEnd-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridCol/gridCol-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/gridCol/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/insideH/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/insideH/insideH-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/insideV/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/insideV/insideV-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/left/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/left/left-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/left/marginLeft-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/right/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/right/marginRight-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/right/right-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/shd/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/shd/shd-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/start/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/start/marginStart-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/start/start-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tbl/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tbl/tbl-translator.d.ts +28 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblBorders/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblBorders/tblBorders-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblCaption/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblCaption/tblCaption-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblCellMar/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblCellMar/tblCellMar-translator.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblDescription/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblDescription/tblDescription-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblGrid/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblGrid/tblGrid-translator.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblInd/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblInd/tblInd-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblLayout/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblLayout/tblLayout-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblLook/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblLook/tblLook-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblOverlap/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblOverlap/tblOverlap-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblPr/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblPr/tblPr-translator.d.ts +5 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblStyle/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblStyle/tblStyle-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblStyleColBandSize/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblStyleColBandSize/tblStyleColBandSize-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblStyleRowBandSize/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblStyleRowBandSize/tblStyleRowBandSize-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblW/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblW/tblW-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblpPr/index.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tblpPr/tblpPr-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/tc/helpers/legacy-handle-table-cell-node.d.ts +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/top/index.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/top/marginTop-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/w/top/top-translator.d.ts +6 -0
- package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +3 -1
- package/dist/super-editor/src/extensions/table/table.d.ts +330 -0
- package/dist/super-editor/super-editor.es.js +8 -8
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +736 -464
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -16411,41 +16411,6 @@ const prepareCommentsXmlFilesForExport = ({ convertedXml, defs, commentsWithPara
|
|
|
16411
16411
|
documentXml: updatedXml
|
|
16412
16412
|
};
|
|
16413
16413
|
};
|
|
16414
|
-
const getColStyleDeclaration = (minWidth, width) => {
|
|
16415
|
-
if (width) {
|
|
16416
|
-
return ["width", `${Math.max(width, minWidth)}px`];
|
|
16417
|
-
}
|
|
16418
|
-
return ["min-width", `${minWidth}px`];
|
|
16419
|
-
};
|
|
16420
|
-
const createColGroup = (node, cellMinWidth, overrideCol, overrideValue) => {
|
|
16421
|
-
let totalWidth = 0;
|
|
16422
|
-
let fixedWidth = true;
|
|
16423
|
-
const cols = [];
|
|
16424
|
-
const colsValues = [];
|
|
16425
|
-
const row = node.firstChild;
|
|
16426
|
-
if (!row) return {};
|
|
16427
|
-
for (let i = 0, col = 0; i < row.childCount; i++) {
|
|
16428
|
-
const { colspan, colwidth } = row.child(i).attrs;
|
|
16429
|
-
for (let j2 = 0; j2 < colspan; j2++, col++) {
|
|
16430
|
-
const hasWidth = overrideCol === col ? overrideValue : colwidth && colwidth[j2];
|
|
16431
|
-
totalWidth += hasWidth || cellMinWidth;
|
|
16432
|
-
if (!hasWidth) fixedWidth = false;
|
|
16433
|
-
const [prop, value] = getColStyleDeclaration(cellMinWidth, hasWidth);
|
|
16434
|
-
cols.push(["col", { style: `${prop}: ${value}` }]);
|
|
16435
|
-
colsValues.push(parseInt(value, 10));
|
|
16436
|
-
}
|
|
16437
|
-
}
|
|
16438
|
-
const tableWidth = fixedWidth ? `${totalWidth}px` : "";
|
|
16439
|
-
const tableMinWidth = fixedWidth ? "" : `${totalWidth}px`;
|
|
16440
|
-
const colgroup = ["colgroup", {}, ...cols];
|
|
16441
|
-
const colgroupValues = [...colsValues];
|
|
16442
|
-
return {
|
|
16443
|
-
colgroup,
|
|
16444
|
-
tableWidth,
|
|
16445
|
-
tableMinWidth,
|
|
16446
|
-
colgroupValues
|
|
16447
|
-
};
|
|
16448
|
-
};
|
|
16449
16414
|
const lower16 = 65535;
|
|
16450
16415
|
const factor16 = Math.pow(2, 16);
|
|
16451
16416
|
function makeRecover(index2, offset2) {
|
|
@@ -24215,46 +24180,6 @@ const baseNumbering = {
|
|
|
24215
24180
|
}
|
|
24216
24181
|
]
|
|
24217
24182
|
};
|
|
24218
|
-
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
24219
|
-
if (!table || !Array.isArray(table.content)) {
|
|
24220
|
-
return table;
|
|
24221
|
-
}
|
|
24222
|
-
const rows = table.content;
|
|
24223
|
-
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
24224
|
-
const row = rows[rowIndex];
|
|
24225
|
-
if (!row) continue;
|
|
24226
|
-
if (!Array.isArray(row.content)) {
|
|
24227
|
-
row.content = [];
|
|
24228
|
-
}
|
|
24229
|
-
for (let cellIndex = 0; cellIndex < row.content.length; cellIndex++) {
|
|
24230
|
-
const cell = row.content[cellIndex];
|
|
24231
|
-
if (!cell) continue;
|
|
24232
|
-
const attrs = cell.attrs || {};
|
|
24233
|
-
if (!attrs.rowspan || attrs.rowspan <= 1) continue;
|
|
24234
|
-
const maxRowspan = Math.min(attrs.rowspan, rows.length - rowIndex);
|
|
24235
|
-
for (let offset2 = 1; offset2 < maxRowspan; offset2++) {
|
|
24236
|
-
const rowToChange = rows[rowIndex + offset2];
|
|
24237
|
-
if (!rowToChange) continue;
|
|
24238
|
-
if (!Array.isArray(rowToChange.content)) {
|
|
24239
|
-
rowToChange.content = [];
|
|
24240
|
-
}
|
|
24241
|
-
const existingCell = rowToChange.content[cellIndex];
|
|
24242
|
-
if (existingCell?.attrs?.continueMerge) continue;
|
|
24243
|
-
const mergedCell = {
|
|
24244
|
-
type: cell.type,
|
|
24245
|
-
content: [editorSchema.nodes.paragraph.createAndFill().toJSON()],
|
|
24246
|
-
attrs: {
|
|
24247
|
-
...cell.attrs,
|
|
24248
|
-
rowspan: null,
|
|
24249
|
-
continueMerge: true
|
|
24250
|
-
}
|
|
24251
|
-
};
|
|
24252
|
-
rowToChange.content.splice(cellIndex, 0, mergedCell);
|
|
24253
|
-
}
|
|
24254
|
-
}
|
|
24255
|
-
}
|
|
24256
|
-
return table;
|
|
24257
|
-
}
|
|
24258
24183
|
const TranslatorTypes = Object.freeze({
|
|
24259
24184
|
NODE: "node",
|
|
24260
24185
|
ATTRIBUTE: "attribute"
|
|
@@ -24375,37 +24300,37 @@ const _NodeTranslator = class _NodeTranslator2 {
|
|
|
24375
24300
|
};
|
|
24376
24301
|
__publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
|
|
24377
24302
|
let NodeTranslator = _NodeTranslator;
|
|
24378
|
-
const encode$
|
|
24303
|
+
const encode$r = (attributes) => {
|
|
24379
24304
|
return attributes["w:type"];
|
|
24380
24305
|
};
|
|
24381
|
-
const decode$
|
|
24306
|
+
const decode$r = (attrs) => {
|
|
24382
24307
|
const { lineBreakType } = attrs;
|
|
24383
24308
|
return lineBreakType;
|
|
24384
24309
|
};
|
|
24385
24310
|
const attrConfig$b = Object.freeze({
|
|
24386
24311
|
xmlName: "w:type",
|
|
24387
24312
|
sdName: "lineBreakType",
|
|
24388
|
-
encode: encode$
|
|
24389
|
-
decode: decode$
|
|
24313
|
+
encode: encode$r,
|
|
24314
|
+
decode: decode$r
|
|
24390
24315
|
});
|
|
24391
|
-
const encode$
|
|
24316
|
+
const encode$q = (attributes) => {
|
|
24392
24317
|
const xmlAttrValue = attributes["w:clear"];
|
|
24393
24318
|
return xmlAttrValue;
|
|
24394
24319
|
};
|
|
24395
|
-
const decode$
|
|
24320
|
+
const decode$q = (attrs) => {
|
|
24396
24321
|
const { clear } = attrs;
|
|
24397
24322
|
return clear;
|
|
24398
24323
|
};
|
|
24399
24324
|
const attrConfig$a = Object.freeze({
|
|
24400
24325
|
xmlName: "w:clear",
|
|
24401
24326
|
sdName: "clear",
|
|
24402
|
-
encode: encode$
|
|
24403
|
-
decode: decode$
|
|
24327
|
+
encode: encode$q,
|
|
24328
|
+
decode: decode$q
|
|
24404
24329
|
});
|
|
24405
24330
|
const validXmlAttributes$9 = [attrConfig$b, attrConfig$a];
|
|
24406
|
-
const XML_NODE_NAME$
|
|
24407
|
-
const SD_NODE_NAME$
|
|
24408
|
-
const encode$
|
|
24331
|
+
const XML_NODE_NAME$f = "w:br";
|
|
24332
|
+
const SD_NODE_NAME$a = "lineBreak";
|
|
24333
|
+
const encode$p = (_2, encodedAttrs) => {
|
|
24409
24334
|
const isPageBreak = encodedAttrs?.lineBreakType === "page";
|
|
24410
24335
|
const translated = {
|
|
24411
24336
|
type: isPageBreak ? "hardBreak" : "lineBreak"
|
|
@@ -24415,7 +24340,7 @@ const encode$k = (_2, encodedAttrs) => {
|
|
|
24415
24340
|
}
|
|
24416
24341
|
return translated;
|
|
24417
24342
|
};
|
|
24418
|
-
const decode$
|
|
24343
|
+
const decode$p = (params2, decodedAttrs) => {
|
|
24419
24344
|
const { node } = params2;
|
|
24420
24345
|
if (!node) return;
|
|
24421
24346
|
const wBreak = { name: "w:br" };
|
|
@@ -24432,63 +24357,63 @@ const decode$k = (params2, decodedAttrs) => {
|
|
|
24432
24357
|
};
|
|
24433
24358
|
return translated;
|
|
24434
24359
|
};
|
|
24435
|
-
const config$
|
|
24436
|
-
xmlName: XML_NODE_NAME$
|
|
24437
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
24360
|
+
const config$d = {
|
|
24361
|
+
xmlName: XML_NODE_NAME$f,
|
|
24362
|
+
sdNodeOrKeyName: SD_NODE_NAME$a,
|
|
24438
24363
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24439
|
-
encode: encode$
|
|
24440
|
-
decode: decode$
|
|
24364
|
+
encode: encode$p,
|
|
24365
|
+
decode: decode$p,
|
|
24441
24366
|
attributes: validXmlAttributes$9
|
|
24442
24367
|
};
|
|
24443
|
-
const translator$
|
|
24444
|
-
const encode$
|
|
24368
|
+
const translator$T = NodeTranslator.from(config$d);
|
|
24369
|
+
const encode$o = (attributes) => {
|
|
24445
24370
|
return attributes["w:val"];
|
|
24446
24371
|
};
|
|
24447
|
-
const decode$
|
|
24372
|
+
const decode$o = (attrs) => {
|
|
24448
24373
|
const { tabSize } = attrs || {};
|
|
24449
24374
|
return tabSize;
|
|
24450
24375
|
};
|
|
24451
24376
|
const attrConfig$9 = Object.freeze({
|
|
24452
24377
|
xmlName: "w:val",
|
|
24453
24378
|
sdName: "tabSize",
|
|
24454
|
-
encode: encode$
|
|
24455
|
-
decode: decode$
|
|
24379
|
+
encode: encode$o,
|
|
24380
|
+
decode: decode$o
|
|
24456
24381
|
});
|
|
24457
|
-
const encode$
|
|
24382
|
+
const encode$n = (attributes) => {
|
|
24458
24383
|
return attributes["w:leader"];
|
|
24459
24384
|
};
|
|
24460
|
-
const decode$
|
|
24385
|
+
const decode$n = (attrs) => {
|
|
24461
24386
|
const { leader } = attrs || {};
|
|
24462
24387
|
return leader;
|
|
24463
24388
|
};
|
|
24464
24389
|
const attrConfig$8 = Object.freeze({
|
|
24465
24390
|
xmlName: "w:leader",
|
|
24466
24391
|
sdName: "leader",
|
|
24467
|
-
encode: encode$
|
|
24468
|
-
decode: decode$
|
|
24392
|
+
encode: encode$n,
|
|
24393
|
+
decode: decode$n
|
|
24469
24394
|
});
|
|
24470
|
-
const encode$
|
|
24395
|
+
const encode$m = (attributes) => {
|
|
24471
24396
|
return attributes["w:pos"];
|
|
24472
24397
|
};
|
|
24473
|
-
const decode$
|
|
24398
|
+
const decode$m = (attrs) => {
|
|
24474
24399
|
const { pos } = attrs || {};
|
|
24475
24400
|
return pos;
|
|
24476
24401
|
};
|
|
24477
24402
|
const attrConfig$7 = Object.freeze({
|
|
24478
24403
|
xmlName: "w:pos",
|
|
24479
24404
|
sdName: "pos",
|
|
24480
|
-
encode: encode$
|
|
24481
|
-
decode: decode$
|
|
24405
|
+
encode: encode$m,
|
|
24406
|
+
decode: decode$m
|
|
24482
24407
|
});
|
|
24483
24408
|
const validXmlAttributes$8 = [attrConfig$9, attrConfig$7, attrConfig$8];
|
|
24484
|
-
const XML_NODE_NAME$
|
|
24485
|
-
const SD_NODE_NAME$
|
|
24486
|
-
const encode$
|
|
24409
|
+
const XML_NODE_NAME$e = "w:tab";
|
|
24410
|
+
const SD_NODE_NAME$9 = "tab";
|
|
24411
|
+
const encode$l = (_2, encodedAttrs = {}) => {
|
|
24487
24412
|
const translated = { type: "tab" };
|
|
24488
24413
|
if (encodedAttrs) translated.attrs = { ...encodedAttrs };
|
|
24489
24414
|
return translated;
|
|
24490
24415
|
};
|
|
24491
|
-
const decode$
|
|
24416
|
+
const decode$l = (params2, decodedAttrs = {}) => {
|
|
24492
24417
|
const { node } = params2 || {};
|
|
24493
24418
|
if (!node) return;
|
|
24494
24419
|
const wTab = { name: "w:tab" };
|
|
@@ -24504,15 +24429,15 @@ const decode$g = (params2, decodedAttrs = {}) => {
|
|
|
24504
24429
|
}
|
|
24505
24430
|
return translated;
|
|
24506
24431
|
};
|
|
24507
|
-
const config$
|
|
24508
|
-
xmlName: XML_NODE_NAME$
|
|
24509
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
24432
|
+
const config$c = {
|
|
24433
|
+
xmlName: XML_NODE_NAME$e,
|
|
24434
|
+
sdNodeOrKeyName: SD_NODE_NAME$9,
|
|
24510
24435
|
type: NodeTranslator.translatorTypes.NODE,
|
|
24511
|
-
encode: encode$
|
|
24512
|
-
decode: decode$
|
|
24436
|
+
encode: encode$l,
|
|
24437
|
+
decode: decode$l,
|
|
24513
24438
|
attributes: validXmlAttributes$8
|
|
24514
24439
|
};
|
|
24515
|
-
const translator$
|
|
24440
|
+
const translator$S = NodeTranslator.from(config$c);
|
|
24516
24441
|
const mergeTextNodes = (nodes) => {
|
|
24517
24442
|
if (!nodes || !Array.isArray(nodes)) {
|
|
24518
24443
|
return nodes;
|
|
@@ -25082,89 +25007,89 @@ const handleParagraphNode$1 = (params2) => {
|
|
|
25082
25007
|
}
|
|
25083
25008
|
return schemaNode;
|
|
25084
25009
|
};
|
|
25085
|
-
const encode$
|
|
25010
|
+
const encode$k = (attributes) => {
|
|
25086
25011
|
return attributes["w:rsidDel"];
|
|
25087
25012
|
};
|
|
25088
|
-
const decode$
|
|
25013
|
+
const decode$k = (attrs) => {
|
|
25089
25014
|
return attrs.rsidDel;
|
|
25090
25015
|
};
|
|
25091
25016
|
const attrConfig$6 = Object.freeze({
|
|
25092
25017
|
xmlName: "w:rsidDel",
|
|
25093
25018
|
sdName: "rsidDel",
|
|
25094
|
-
encode: encode$
|
|
25095
|
-
decode: decode$
|
|
25019
|
+
encode: encode$k,
|
|
25020
|
+
decode: decode$k
|
|
25096
25021
|
});
|
|
25097
|
-
const encode$
|
|
25022
|
+
const encode$j = (attributes) => {
|
|
25098
25023
|
return attributes["w:rsidP"];
|
|
25099
25024
|
};
|
|
25100
|
-
const decode$
|
|
25025
|
+
const decode$j = (attrs) => {
|
|
25101
25026
|
return attrs.rsidP;
|
|
25102
25027
|
};
|
|
25103
25028
|
const attrConfig$5 = Object.freeze({
|
|
25104
25029
|
xmlName: "w:rsidP",
|
|
25105
25030
|
sdName: "rsidP",
|
|
25106
|
-
encode: encode$
|
|
25107
|
-
decode: decode$
|
|
25031
|
+
encode: encode$j,
|
|
25032
|
+
decode: decode$j
|
|
25108
25033
|
});
|
|
25109
|
-
const encode$
|
|
25034
|
+
const encode$i = (attributes) => {
|
|
25110
25035
|
return attributes["w:rsidR"];
|
|
25111
25036
|
};
|
|
25112
|
-
const decode$
|
|
25037
|
+
const decode$i = (attrs) => {
|
|
25113
25038
|
return attrs.rsidR;
|
|
25114
25039
|
};
|
|
25115
25040
|
const attrConfig$4 = Object.freeze({
|
|
25116
25041
|
xmlName: "w:rsidR",
|
|
25117
25042
|
sdName: "rsidR",
|
|
25118
|
-
encode: encode$
|
|
25119
|
-
decode: decode$
|
|
25043
|
+
encode: encode$i,
|
|
25044
|
+
decode: decode$i
|
|
25120
25045
|
});
|
|
25121
|
-
const encode$
|
|
25046
|
+
const encode$h = (attributes) => {
|
|
25122
25047
|
return attributes["w:rsidRPr"];
|
|
25123
25048
|
};
|
|
25124
|
-
const decode$
|
|
25049
|
+
const decode$h = (attrs) => {
|
|
25125
25050
|
return attrs.rsidRPr;
|
|
25126
25051
|
};
|
|
25127
25052
|
const attrConfig$3 = Object.freeze({
|
|
25128
25053
|
xmlName: "w:rsidRPr",
|
|
25129
25054
|
sdName: "rsidRPr",
|
|
25130
|
-
encode: encode$
|
|
25131
|
-
decode: decode$
|
|
25055
|
+
encode: encode$h,
|
|
25056
|
+
decode: decode$h
|
|
25132
25057
|
});
|
|
25133
|
-
const encode$
|
|
25058
|
+
const encode$g = (attributes) => {
|
|
25134
25059
|
return attributes["w:rsidRDefault"];
|
|
25135
25060
|
};
|
|
25136
|
-
const decode$
|
|
25061
|
+
const decode$g = (attrs) => {
|
|
25137
25062
|
return attrs.rsidRDefault;
|
|
25138
25063
|
};
|
|
25139
25064
|
const attrConfig$2 = Object.freeze({
|
|
25140
25065
|
xmlName: "w:rsidRDefault",
|
|
25141
25066
|
sdName: "rsidRDefault",
|
|
25142
|
-
encode: encode$
|
|
25143
|
-
decode: decode$
|
|
25067
|
+
encode: encode$g,
|
|
25068
|
+
decode: decode$g
|
|
25144
25069
|
});
|
|
25145
|
-
const encode$
|
|
25070
|
+
const encode$f = (attributes) => {
|
|
25146
25071
|
return attributes["w14:paraId"];
|
|
25147
25072
|
};
|
|
25148
|
-
const decode$
|
|
25073
|
+
const decode$f = (attrs) => {
|
|
25149
25074
|
return attrs.paraId;
|
|
25150
25075
|
};
|
|
25151
25076
|
const attrConfig$1 = Object.freeze({
|
|
25152
25077
|
xmlName: "w14:paraId",
|
|
25153
25078
|
sdName: "paraId",
|
|
25154
|
-
encode: encode$
|
|
25155
|
-
decode: decode$
|
|
25079
|
+
encode: encode$f,
|
|
25080
|
+
decode: decode$f
|
|
25156
25081
|
});
|
|
25157
|
-
const encode$
|
|
25082
|
+
const encode$e = (attributes) => {
|
|
25158
25083
|
return attributes["w14:textId"];
|
|
25159
25084
|
};
|
|
25160
|
-
const decode$
|
|
25085
|
+
const decode$e = (attrs) => {
|
|
25161
25086
|
return attrs.textId;
|
|
25162
25087
|
};
|
|
25163
25088
|
const attrConfig = Object.freeze({
|
|
25164
25089
|
xmlName: "w14:textId",
|
|
25165
25090
|
sdName: "textId",
|
|
25166
|
-
encode: encode$
|
|
25167
|
-
decode: decode$
|
|
25091
|
+
encode: encode$e,
|
|
25092
|
+
decode: decode$e
|
|
25168
25093
|
});
|
|
25169
25094
|
const validXmlAttributes$7 = [
|
|
25170
25095
|
attrConfig$1,
|
|
@@ -25175,9 +25100,9 @@ const validXmlAttributes$7 = [
|
|
|
25175
25100
|
attrConfig$3,
|
|
25176
25101
|
attrConfig$6
|
|
25177
25102
|
];
|
|
25178
|
-
const XML_NODE_NAME$
|
|
25179
|
-
const SD_NODE_NAME$
|
|
25180
|
-
const encode$
|
|
25103
|
+
const XML_NODE_NAME$d = "w:p";
|
|
25104
|
+
const SD_NODE_NAME$8 = "paragraph";
|
|
25105
|
+
const encode$d = (params2, encodedAttrs = {}) => {
|
|
25181
25106
|
const node = handleParagraphNode$1(params2);
|
|
25182
25107
|
if (!node) return void 0;
|
|
25183
25108
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
@@ -25185,7 +25110,7 @@ const encode$8 = (params2, encodedAttrs = {}) => {
|
|
|
25185
25110
|
}
|
|
25186
25111
|
return node;
|
|
25187
25112
|
};
|
|
25188
|
-
const decode$
|
|
25113
|
+
const decode$d = (params2, decodedAttrs = {}) => {
|
|
25189
25114
|
const translated = translateParagraphNode(params2);
|
|
25190
25115
|
if (!translated) return void 0;
|
|
25191
25116
|
if (decodedAttrs && Object.keys(decodedAttrs).length) {
|
|
@@ -25193,15 +25118,15 @@ const decode$8 = (params2, decodedAttrs = {}) => {
|
|
|
25193
25118
|
}
|
|
25194
25119
|
return translated;
|
|
25195
25120
|
};
|
|
25196
|
-
const config$
|
|
25197
|
-
xmlName: XML_NODE_NAME$
|
|
25198
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
25121
|
+
const config$b = {
|
|
25122
|
+
xmlName: XML_NODE_NAME$d,
|
|
25123
|
+
sdNodeOrKeyName: SD_NODE_NAME$8,
|
|
25199
25124
|
type: NodeTranslator.translatorTypes.NODE,
|
|
25200
|
-
encode: encode$
|
|
25201
|
-
decode: decode$
|
|
25125
|
+
encode: encode$d,
|
|
25126
|
+
decode: decode$d,
|
|
25202
25127
|
attributes: validXmlAttributes$7
|
|
25203
25128
|
};
|
|
25204
|
-
const translator$
|
|
25129
|
+
const translator$R = NodeTranslator.from(config$b);
|
|
25205
25130
|
const generateV2HandlerEntity = (handlerName, translator2) => ({
|
|
25206
25131
|
handlerName,
|
|
25207
25132
|
handler: (params2) => {
|
|
@@ -25229,7 +25154,7 @@ function createSingleAttrPropertyHandler(xmlName, sdName = null, attrName = "w:v
|
|
|
25229
25154
|
},
|
|
25230
25155
|
decode: ({ node }) => {
|
|
25231
25156
|
const value = node.attrs?.[sdName] != null ? transformDecode(node.attrs[sdName]) : void 0;
|
|
25232
|
-
return value != null ? { [attrName]: value } : void 0;
|
|
25157
|
+
return value != null ? { name: xmlName, attributes: { [attrName]: value } } : void 0;
|
|
25233
25158
|
}
|
|
25234
25159
|
};
|
|
25235
25160
|
}
|
|
@@ -25247,7 +25172,32 @@ function createMeasurementPropertyHandler(xmlName, sdName = null) {
|
|
|
25247
25172
|
},
|
|
25248
25173
|
decode: function({ node }) {
|
|
25249
25174
|
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
25250
|
-
return decodedAttrs["w:w"] != null ? decodedAttrs : void 0;
|
|
25175
|
+
return decodedAttrs["w:w"] != null ? { attributes: decodedAttrs } : void 0;
|
|
25176
|
+
}
|
|
25177
|
+
};
|
|
25178
|
+
}
|
|
25179
|
+
function createBorderPropertyHandler(xmlName, sdName = null) {
|
|
25180
|
+
if (!sdName) sdName = xmlName.split(":")[1];
|
|
25181
|
+
return {
|
|
25182
|
+
xmlName,
|
|
25183
|
+
sdNodeOrKeyName: sdName,
|
|
25184
|
+
attributes: [
|
|
25185
|
+
createAttributeHandler("w:val"),
|
|
25186
|
+
createAttributeHandler("w:color"),
|
|
25187
|
+
createAttributeHandler("w:themeColor"),
|
|
25188
|
+
createAttributeHandler("w:themeTint"),
|
|
25189
|
+
createAttributeHandler("w:themeShade"),
|
|
25190
|
+
createAttributeHandler("w:sz", "size", parseInteger, integerToString),
|
|
25191
|
+
createAttributeHandler("w:space", null, parseInteger, integerToString),
|
|
25192
|
+
createAttributeHandler("w:shadow", null, parseBoolean, booleanToString),
|
|
25193
|
+
createAttributeHandler("w:frame", null, parseBoolean, booleanToString)
|
|
25194
|
+
],
|
|
25195
|
+
encode: (_2, encodedAttrs) => {
|
|
25196
|
+
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25197
|
+
},
|
|
25198
|
+
decode: function({ node }, _2) {
|
|
25199
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs[sdName] || {} } });
|
|
25200
|
+
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25251
25201
|
}
|
|
25252
25202
|
};
|
|
25253
25203
|
}
|
|
@@ -25290,15 +25240,17 @@ function decodeProperties(translatorsBySdName, properties) {
|
|
|
25290
25240
|
Object.keys(properties).forEach((key2) => {
|
|
25291
25241
|
const translator2 = translatorsBySdName[key2];
|
|
25292
25242
|
if (translator2) {
|
|
25293
|
-
const
|
|
25294
|
-
if (
|
|
25295
|
-
|
|
25243
|
+
const result = translator2.decode({ node: { attrs: { [key2]: properties[key2] } } });
|
|
25244
|
+
if (result != null) {
|
|
25245
|
+
result.name = translator2.xmlName;
|
|
25246
|
+
elements.push(result);
|
|
25296
25247
|
}
|
|
25297
25248
|
}
|
|
25298
25249
|
});
|
|
25299
25250
|
return elements;
|
|
25300
25251
|
}
|
|
25301
|
-
const parseBoolean = (value) => ["1", "true"].includes(value);
|
|
25252
|
+
const parseBoolean = (value) => value != null ? ["1", "true"].includes(value) : void 0;
|
|
25253
|
+
const booleanToString = (value) => value != null ? value ? "1" : "0" : void 0;
|
|
25302
25254
|
const parseInteger = (value) => {
|
|
25303
25255
|
if (value == null) return void 0;
|
|
25304
25256
|
const intValue = parseInt(value, 10);
|
|
@@ -25308,13 +25260,53 @@ const integerToString = (value) => {
|
|
|
25308
25260
|
const intValue = parseInteger(value);
|
|
25309
25261
|
return intValue != void 0 ? String(intValue) : void 0;
|
|
25310
25262
|
};
|
|
25311
|
-
|
|
25263
|
+
function preProcessVerticalMergeCells(table, { editorSchema }) {
|
|
25264
|
+
if (!table || !Array.isArray(table.content)) {
|
|
25265
|
+
return table;
|
|
25266
|
+
}
|
|
25267
|
+
const rows = table.content;
|
|
25268
|
+
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
25269
|
+
const row = rows[rowIndex];
|
|
25270
|
+
if (!row) continue;
|
|
25271
|
+
if (!Array.isArray(row.content)) {
|
|
25272
|
+
row.content = [];
|
|
25273
|
+
}
|
|
25274
|
+
for (let cellIndex = 0; cellIndex < row.content.length; cellIndex++) {
|
|
25275
|
+
const cell = row.content[cellIndex];
|
|
25276
|
+
if (!cell) continue;
|
|
25277
|
+
const attrs = cell.attrs || {};
|
|
25278
|
+
if (!attrs.rowspan || attrs.rowspan <= 1) continue;
|
|
25279
|
+
const maxRowspan = Math.min(attrs.rowspan, rows.length - rowIndex);
|
|
25280
|
+
for (let offset2 = 1; offset2 < maxRowspan; offset2++) {
|
|
25281
|
+
const rowToChange = rows[rowIndex + offset2];
|
|
25282
|
+
if (!rowToChange) continue;
|
|
25283
|
+
if (!Array.isArray(rowToChange.content)) {
|
|
25284
|
+
rowToChange.content = [];
|
|
25285
|
+
}
|
|
25286
|
+
const existingCell = rowToChange.content[cellIndex];
|
|
25287
|
+
if (existingCell?.attrs?.continueMerge) continue;
|
|
25288
|
+
const mergedCell = {
|
|
25289
|
+
type: cell.type,
|
|
25290
|
+
content: [editorSchema.nodes.paragraph.createAndFill().toJSON()],
|
|
25291
|
+
attrs: {
|
|
25292
|
+
...cell.attrs,
|
|
25293
|
+
rowspan: null,
|
|
25294
|
+
continueMerge: true
|
|
25295
|
+
}
|
|
25296
|
+
};
|
|
25297
|
+
rowToChange.content.splice(cellIndex, 0, mergedCell);
|
|
25298
|
+
}
|
|
25299
|
+
}
|
|
25300
|
+
}
|
|
25301
|
+
return table;
|
|
25302
|
+
}
|
|
25303
|
+
const translator$Q = NodeTranslator.from({
|
|
25312
25304
|
xmlName: "w:cantSplit",
|
|
25313
25305
|
sdNodeOrKeyName: "cantSplit",
|
|
25314
25306
|
encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
25315
|
-
decode: ({ node }) => node.attrs?.cantSplit ? {} : void 0
|
|
25307
|
+
decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
|
|
25316
25308
|
});
|
|
25317
|
-
const translator$
|
|
25309
|
+
const translator$P = NodeTranslator.from({
|
|
25318
25310
|
xmlName: "w:cnfStyle",
|
|
25319
25311
|
sdNodeOrKeyName: "cnfStyle",
|
|
25320
25312
|
attributes: [
|
|
@@ -25329,26 +25321,19 @@ const translator$i = NodeTranslator.from({
|
|
|
25329
25321
|
"w:lastRowFirstColumn",
|
|
25330
25322
|
"w:lastRowLastColumn",
|
|
25331
25323
|
"w:oddHBand",
|
|
25332
|
-
"w:oddVBand"
|
|
25333
|
-
|
|
25334
|
-
].map((attr) => createAttributeHandler(attr)),
|
|
25324
|
+
"w:oddVBand"
|
|
25325
|
+
].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
25335
25326
|
encode: (_2, encodedAttrs) => {
|
|
25336
|
-
Object.keys(encodedAttrs).forEach((key2) => {
|
|
25337
|
-
encodedAttrs[key2] = ["1", "true"].includes(encodedAttrs[key2]);
|
|
25338
|
-
});
|
|
25339
25327
|
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25340
25328
|
},
|
|
25341
|
-
decode: ({ node })
|
|
25329
|
+
decode: function({ node }) {
|
|
25342
25330
|
if (!node.attrs?.cnfStyle) return;
|
|
25343
|
-
const
|
|
25344
|
-
Object.
|
|
25345
|
-
cnfStyleAttrs[`w:${key2}`] = value ? "1" : "0";
|
|
25346
|
-
});
|
|
25347
|
-
return Object.keys(cnfStyleAttrs).length > 0 ? cnfStyleAttrs : void 0;
|
|
25331
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.cnfStyle || {} } });
|
|
25332
|
+
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25348
25333
|
}
|
|
25349
25334
|
});
|
|
25350
|
-
const translator$
|
|
25351
|
-
const translator$
|
|
25335
|
+
const translator$O = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
|
|
25336
|
+
const translator$N = NodeTranslator.from(
|
|
25352
25337
|
createSingleAttrPropertyHandler(
|
|
25353
25338
|
"w:gridAfter",
|
|
25354
25339
|
null,
|
|
@@ -25357,7 +25342,7 @@ const translator$g = NodeTranslator.from(
|
|
|
25357
25342
|
(v2) => integerToString(v2)
|
|
25358
25343
|
)
|
|
25359
25344
|
);
|
|
25360
|
-
const translator$
|
|
25345
|
+
const translator$M = NodeTranslator.from(
|
|
25361
25346
|
createSingleAttrPropertyHandler(
|
|
25362
25347
|
"w:gridBefore",
|
|
25363
25348
|
null,
|
|
@@ -25366,21 +25351,21 @@ const translator$f = NodeTranslator.from(
|
|
|
25366
25351
|
(v2) => integerToString(v2)
|
|
25367
25352
|
)
|
|
25368
25353
|
);
|
|
25369
|
-
const translator$
|
|
25354
|
+
const translator$L = NodeTranslator.from({
|
|
25370
25355
|
xmlName: "w:hidden",
|
|
25371
25356
|
sdNodeOrKeyName: "hidden",
|
|
25372
25357
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
25373
|
-
decode: ({ node }) => node.attrs.hidden ? {} : void 0
|
|
25358
|
+
decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
|
|
25374
25359
|
});
|
|
25375
|
-
const translator$
|
|
25376
|
-
const translator$
|
|
25377
|
-
const translator$
|
|
25360
|
+
const translator$K = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
|
|
25361
|
+
const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
|
|
25362
|
+
const translator$I = NodeTranslator.from({
|
|
25378
25363
|
xmlName: "w:tblHeader",
|
|
25379
25364
|
sdNodeOrKeyName: "repeatHeader",
|
|
25380
25365
|
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
25381
|
-
decode: ({ node }) => node.attrs.repeatHeader ? {} : void 0
|
|
25366
|
+
decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
|
|
25382
25367
|
});
|
|
25383
|
-
const translator$
|
|
25368
|
+
const translator$H = NodeTranslator.from({
|
|
25384
25369
|
xmlName: "w:trHeight",
|
|
25385
25370
|
sdNodeOrKeyName: "rowHeight",
|
|
25386
25371
|
encode: ({ nodes }) => {
|
|
@@ -25404,14 +25389,14 @@ const translator$a = NodeTranslator.from({
|
|
|
25404
25389
|
if (node.attrs.rowHeight.rule) {
|
|
25405
25390
|
heightAttrs["w:hRule"] = node.attrs.rowHeight.rule;
|
|
25406
25391
|
}
|
|
25407
|
-
return Object.keys(heightAttrs).length > 0 ? heightAttrs : void 0;
|
|
25392
|
+
return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
|
|
25408
25393
|
}
|
|
25409
25394
|
});
|
|
25410
|
-
const translator$
|
|
25411
|
-
const translator$
|
|
25412
|
-
const XML_NODE_NAME$
|
|
25413
|
-
const SD_ATTR_KEY = "tableRowProperties";
|
|
25414
|
-
const encode$
|
|
25395
|
+
const translator$G = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
|
|
25396
|
+
const translator$F = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
|
|
25397
|
+
const XML_NODE_NAME$c = "w:trPr";
|
|
25398
|
+
const SD_ATTR_KEY$4 = "tableRowProperties";
|
|
25399
|
+
const encode$c = (params2) => {
|
|
25415
25400
|
const { nodes } = params2;
|
|
25416
25401
|
const node = nodes[0];
|
|
25417
25402
|
let attributes = {
|
|
@@ -25421,18 +25406,18 @@ const encode$7 = (params2) => {
|
|
|
25421
25406
|
};
|
|
25422
25407
|
attributes = {
|
|
25423
25408
|
...attributes,
|
|
25424
|
-
...encodeProperties(node, propertyTranslatorsByXmlName)
|
|
25409
|
+
...encodeProperties(node, propertyTranslatorsByXmlName$2)
|
|
25425
25410
|
};
|
|
25426
25411
|
return {
|
|
25427
25412
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25428
|
-
xmlName: XML_NODE_NAME$
|
|
25429
|
-
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
25413
|
+
xmlName: XML_NODE_NAME$c,
|
|
25414
|
+
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
25430
25415
|
attributes
|
|
25431
25416
|
};
|
|
25432
25417
|
};
|
|
25433
|
-
const decode$
|
|
25418
|
+
const decode$c = (params2) => {
|
|
25434
25419
|
const { tableRowProperties = {} } = params2.node.attrs || {};
|
|
25435
|
-
const elements = decodeProperties(propertyTranslatorsBySdName, tableRowProperties);
|
|
25420
|
+
const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
|
|
25436
25421
|
const newNode = {
|
|
25437
25422
|
name: "w:trPr",
|
|
25438
25423
|
type: "element",
|
|
@@ -25441,47 +25426,47 @@ const decode$7 = (params2) => {
|
|
|
25441
25426
|
};
|
|
25442
25427
|
return newNode;
|
|
25443
25428
|
};
|
|
25444
|
-
const propertyTranslators = [
|
|
25445
|
-
translator$
|
|
25446
|
-
translator$
|
|
25447
|
-
translator$
|
|
25448
|
-
translator$
|
|
25449
|
-
translator$
|
|
25450
|
-
translator$
|
|
25451
|
-
translator$
|
|
25452
|
-
translator$
|
|
25453
|
-
translator$
|
|
25454
|
-
translator$
|
|
25455
|
-
translator$
|
|
25456
|
-
translator$
|
|
25429
|
+
const propertyTranslators$3 = [
|
|
25430
|
+
translator$Q,
|
|
25431
|
+
translator$P,
|
|
25432
|
+
translator$O,
|
|
25433
|
+
translator$N,
|
|
25434
|
+
translator$M,
|
|
25435
|
+
translator$L,
|
|
25436
|
+
translator$K,
|
|
25437
|
+
translator$J,
|
|
25438
|
+
translator$I,
|
|
25439
|
+
translator$H,
|
|
25440
|
+
translator$G,
|
|
25441
|
+
translator$F
|
|
25457
25442
|
];
|
|
25458
|
-
const propertyTranslatorsByXmlName = {};
|
|
25459
|
-
propertyTranslators.forEach((translator2) => {
|
|
25460
|
-
propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
25443
|
+
const propertyTranslatorsByXmlName$2 = {};
|
|
25444
|
+
propertyTranslators$3.forEach((translator2) => {
|
|
25445
|
+
propertyTranslatorsByXmlName$2[translator2.xmlName] = translator2;
|
|
25461
25446
|
});
|
|
25462
|
-
const propertyTranslatorsBySdName = {};
|
|
25463
|
-
propertyTranslators.forEach((translator2) => {
|
|
25464
|
-
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
25447
|
+
const propertyTranslatorsBySdName$2 = {};
|
|
25448
|
+
propertyTranslators$3.forEach((translator2) => {
|
|
25449
|
+
propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
|
|
25465
25450
|
});
|
|
25466
|
-
const config$
|
|
25467
|
-
xmlName: XML_NODE_NAME$
|
|
25468
|
-
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
25451
|
+
const config$a = {
|
|
25452
|
+
xmlName: XML_NODE_NAME$c,
|
|
25453
|
+
sdNodeOrKeyName: SD_ATTR_KEY$4,
|
|
25469
25454
|
type: NodeTranslator.translatorTypes.ATTRIBUTE,
|
|
25470
|
-
encode: encode$
|
|
25471
|
-
decode: decode$
|
|
25455
|
+
encode: encode$c,
|
|
25456
|
+
decode: decode$c
|
|
25472
25457
|
};
|
|
25473
|
-
const translator$
|
|
25474
|
-
const XML_NODE_NAME$
|
|
25475
|
-
const SD_NODE_NAME$
|
|
25458
|
+
const translator$E = NodeTranslator.from(config$a);
|
|
25459
|
+
const XML_NODE_NAME$b = "w:tr";
|
|
25460
|
+
const SD_NODE_NAME$7 = "tableRow";
|
|
25476
25461
|
const validXmlAttributes$6 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
|
|
25477
25462
|
(xmlName) => createAttributeHandler(xmlName)
|
|
25478
25463
|
);
|
|
25479
|
-
const encode$
|
|
25480
|
-
const { row
|
|
25464
|
+
const encode$b = (params2, encodedAttrs) => {
|
|
25465
|
+
const { row } = params2.extraParams;
|
|
25481
25466
|
let tableRowProperties = {};
|
|
25482
25467
|
const tPr = row.elements.find((el) => el.name === "w:trPr");
|
|
25483
25468
|
if (tPr) {
|
|
25484
|
-
({ attributes: tableRowProperties } = translator$
|
|
25469
|
+
({ attributes: tableRowProperties } = translator$E.encode({
|
|
25485
25470
|
...params2,
|
|
25486
25471
|
nodes: [tPr]
|
|
25487
25472
|
}));
|
|
@@ -25489,7 +25474,7 @@ const encode$6 = (params2, encodedAttrs) => {
|
|
|
25489
25474
|
encodedAttrs["tableRowProperties"] = Object.freeze(tableRowProperties);
|
|
25490
25475
|
encodedAttrs["rowHeight"] = twipsToPixels(tableRowProperties["rowHeight"]?.value);
|
|
25491
25476
|
encodedAttrs["cantSplit"] = tableRowProperties["cantSplit"];
|
|
25492
|
-
const gridColumnWidths =
|
|
25477
|
+
const { columnWidths: gridColumnWidths } = params2.extraParams;
|
|
25493
25478
|
const cellNodes = row.elements.filter((el) => el.name === "w:tc");
|
|
25494
25479
|
let currentColumnIndex = 0;
|
|
25495
25480
|
const content = cellNodes?.map((n) => {
|
|
@@ -25516,16 +25501,7 @@ const encode$6 = (params2, encodedAttrs) => {
|
|
|
25516
25501
|
};
|
|
25517
25502
|
return newNode;
|
|
25518
25503
|
};
|
|
25519
|
-
const
|
|
25520
|
-
const tblGrid = tableNode.elements.find((el) => el.name === "w:tblGrid");
|
|
25521
|
-
if (!tblGrid) return [];
|
|
25522
|
-
const columnWidths = tblGrid?.elements?.flatMap((el) => {
|
|
25523
|
-
if (el.name !== "w:gridCol") return [];
|
|
25524
|
-
return twipsToPixels(el.attributes["w:w"]);
|
|
25525
|
-
}) || [];
|
|
25526
|
-
return columnWidths;
|
|
25527
|
-
};
|
|
25528
|
-
const decode$6 = (params2, decodedAttrs) => {
|
|
25504
|
+
const decode$b = (params2, decodedAttrs) => {
|
|
25529
25505
|
const { node } = params2;
|
|
25530
25506
|
const elements = translateChildNodes(params2);
|
|
25531
25507
|
if (node.attrs?.tableRowProperties) {
|
|
@@ -25537,7 +25513,7 @@ const decode$6 = (params2, decodedAttrs) => {
|
|
|
25537
25513
|
}
|
|
25538
25514
|
}
|
|
25539
25515
|
tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
|
|
25540
|
-
const trPr = translator$
|
|
25516
|
+
const trPr = translator$E.decode({
|
|
25541
25517
|
...params2,
|
|
25542
25518
|
node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
|
|
25543
25519
|
});
|
|
@@ -25549,86 +25525,348 @@ const decode$6 = (params2, decodedAttrs) => {
|
|
|
25549
25525
|
elements
|
|
25550
25526
|
};
|
|
25551
25527
|
};
|
|
25552
|
-
const config$
|
|
25553
|
-
xmlName: XML_NODE_NAME$
|
|
25554
|
-
sdNodeOrKeyName: SD_NODE_NAME$
|
|
25528
|
+
const config$9 = {
|
|
25529
|
+
xmlName: XML_NODE_NAME$b,
|
|
25530
|
+
sdNodeOrKeyName: SD_NODE_NAME$7,
|
|
25555
25531
|
type: NodeTranslator.translatorTypes.NODE,
|
|
25556
|
-
encode: encode$
|
|
25557
|
-
decode: decode$
|
|
25532
|
+
encode: encode$b,
|
|
25533
|
+
decode: decode$b,
|
|
25558
25534
|
attributes: validXmlAttributes$6
|
|
25559
25535
|
};
|
|
25560
|
-
const translator$
|
|
25561
|
-
const
|
|
25562
|
-
|
|
25563
|
-
|
|
25564
|
-
|
|
25536
|
+
const translator$D = NodeTranslator.from(config$9);
|
|
25537
|
+
const translator$C = NodeTranslator.from({
|
|
25538
|
+
xmlName: "w:bidiVisual",
|
|
25539
|
+
sdNodeOrKeyName: "rightToLeft",
|
|
25540
|
+
encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
|
|
25541
|
+
decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
|
|
25542
|
+
});
|
|
25543
|
+
const translator$B = NodeTranslator.from({
|
|
25544
|
+
xmlName: "w:shd",
|
|
25545
|
+
sdNodeOrKeyName: "shading",
|
|
25546
|
+
attributes: [
|
|
25547
|
+
"w:color",
|
|
25548
|
+
"w:fill",
|
|
25549
|
+
"w:themeColor",
|
|
25550
|
+
"w:themeFill",
|
|
25551
|
+
"w:themeFillShade",
|
|
25552
|
+
"w:themeFillTint",
|
|
25553
|
+
"w:themeShade",
|
|
25554
|
+
"w:themeTint",
|
|
25555
|
+
"w:val"
|
|
25556
|
+
].map((attr) => createAttributeHandler(attr)),
|
|
25557
|
+
encode: (_2, encodedAttrs) => {
|
|
25558
|
+
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25559
|
+
},
|
|
25560
|
+
decode: function({ node }, _2) {
|
|
25561
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.shading || {} } });
|
|
25562
|
+
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25565
25563
|
}
|
|
25564
|
+
});
|
|
25565
|
+
const translator$A = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
|
|
25566
|
+
const translator$z = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
|
|
25567
|
+
const translator$y = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
|
|
25568
|
+
const translator$x = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
|
|
25569
|
+
const translator$w = NodeTranslator.from({
|
|
25570
|
+
xmlName: "w:tblLook",
|
|
25571
|
+
sdNodeOrKeyName: "tblLook",
|
|
25572
|
+
attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
|
|
25573
|
+
encode: (_2, encodedAttrs) => {
|
|
25574
|
+
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25575
|
+
},
|
|
25576
|
+
decode: function({ node }, _2) {
|
|
25577
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.tblLook || {} } });
|
|
25578
|
+
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25579
|
+
}
|
|
25580
|
+
});
|
|
25581
|
+
const translator$v = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
|
|
25582
|
+
const translator$u = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
|
|
25583
|
+
const translator$t = NodeTranslator.from(
|
|
25584
|
+
createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
|
|
25585
|
+
);
|
|
25586
|
+
const translator$s = NodeTranslator.from(
|
|
25587
|
+
createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
|
|
25588
|
+
);
|
|
25589
|
+
const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
|
|
25590
|
+
const translator$q = NodeTranslator.from({
|
|
25591
|
+
xmlName: "w:tblpPr",
|
|
25592
|
+
sdNodeOrKeyName: "floatingTableProperties",
|
|
25593
|
+
attributes: ["w:leftFromText", "w:rightFromText", "w:topFromText", "w:bottomFromText", "w:tblpX", "w:tblpY"].map((attr) => createAttributeHandler(attr, null, parseInteger, integerToString)).concat(["w:horzAnchor", "w:vertAnchor", "w:tblpXSpec", "w:tblpYSpec"].map((attr) => createAttributeHandler(attr))),
|
|
25594
|
+
encode: (_2, encodedAttrs) => {
|
|
25595
|
+
return Object.keys(encodedAttrs).length > 0 ? encodedAttrs : void 0;
|
|
25596
|
+
},
|
|
25597
|
+
decode: function({ node }, _2) {
|
|
25598
|
+
const decodedAttrs = this.decodeAttributes({ node: { ...node, attrs: node.attrs.floatingTableProperties || {} } });
|
|
25599
|
+
return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
|
|
25600
|
+
}
|
|
25601
|
+
});
|
|
25602
|
+
const translator$p = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
|
|
25603
|
+
const translator$o = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
|
|
25604
|
+
const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:end"));
|
|
25605
|
+
const translator$m = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
|
|
25606
|
+
const translator$l = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
|
|
25607
|
+
const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
|
|
25608
|
+
const translator$j = NodeTranslator.from(createBorderPropertyHandler("w:left"));
|
|
25609
|
+
const translator$i = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
|
|
25610
|
+
const translator$h = NodeTranslator.from(createBorderPropertyHandler("w:right"));
|
|
25611
|
+
const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
|
|
25612
|
+
const translator$f = NodeTranslator.from(createBorderPropertyHandler("w:start"));
|
|
25613
|
+
const translator$e = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
|
|
25614
|
+
const translator$d = NodeTranslator.from(createBorderPropertyHandler("w:top"));
|
|
25615
|
+
const translator$c = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
|
|
25616
|
+
const XML_NODE_NAME$a = "w:tblBorders";
|
|
25617
|
+
const SD_ATTR_KEY$3 = "borders";
|
|
25618
|
+
const encode$a = (params2, _2) => {
|
|
25619
|
+
const { nodes } = params2;
|
|
25566
25620
|
const node = nodes[0];
|
|
25567
|
-
|
|
25568
|
-
|
|
25569
|
-
|
|
25621
|
+
const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
|
|
25622
|
+
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
25623
|
+
};
|
|
25624
|
+
const decode$a = (params2, _2) => {
|
|
25625
|
+
const { borders = {} } = params2.node.attrs || {};
|
|
25626
|
+
const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
|
|
25627
|
+
const newNode = {
|
|
25628
|
+
name: "w:tblBorders",
|
|
25629
|
+
type: "element",
|
|
25630
|
+
attributes: {},
|
|
25631
|
+
elements
|
|
25632
|
+
};
|
|
25633
|
+
return newNode;
|
|
25634
|
+
};
|
|
25635
|
+
const propertyTranslators$2 = [
|
|
25636
|
+
translator$p,
|
|
25637
|
+
translator$n,
|
|
25638
|
+
translator$l,
|
|
25639
|
+
translator$k,
|
|
25640
|
+
translator$j,
|
|
25641
|
+
translator$h,
|
|
25642
|
+
translator$f,
|
|
25643
|
+
translator$d
|
|
25644
|
+
];
|
|
25645
|
+
const tblBordersTranslatorsByXmlName = {};
|
|
25646
|
+
const tblBordersTranslatorsBySdName = {};
|
|
25647
|
+
propertyTranslators$2.forEach((translator2) => {
|
|
25648
|
+
tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
25649
|
+
tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
25650
|
+
});
|
|
25651
|
+
const translator$b = NodeTranslator.from({
|
|
25652
|
+
xmlName: XML_NODE_NAME$a,
|
|
25653
|
+
sdNodeOrKeyName: SD_ATTR_KEY$3,
|
|
25654
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
25655
|
+
attributes: [],
|
|
25656
|
+
encode: encode$a,
|
|
25657
|
+
decode: decode$a
|
|
25658
|
+
});
|
|
25659
|
+
const XML_NODE_NAME$9 = "w:tblCellMar";
|
|
25660
|
+
const SD_ATTR_KEY$2 = "cellMargins";
|
|
25661
|
+
const encode$9 = (params2, _2) => {
|
|
25662
|
+
const { nodes } = params2;
|
|
25663
|
+
const node = nodes[0];
|
|
25664
|
+
const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
|
|
25665
|
+
return Object.keys(attributes).length > 0 ? attributes : void 0;
|
|
25666
|
+
};
|
|
25667
|
+
const decode$9 = (params2, _2) => {
|
|
25668
|
+
const { cellMargins = {} } = params2.node.attrs || {};
|
|
25669
|
+
const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
|
|
25670
|
+
const newNode = {
|
|
25671
|
+
name: XML_NODE_NAME$9,
|
|
25672
|
+
type: "element",
|
|
25673
|
+
attributes: {},
|
|
25674
|
+
elements
|
|
25675
|
+
};
|
|
25676
|
+
return newNode;
|
|
25677
|
+
};
|
|
25678
|
+
const propertyTranslators$1 = [
|
|
25679
|
+
translator$o,
|
|
25680
|
+
translator$m,
|
|
25681
|
+
translator$i,
|
|
25682
|
+
translator$g,
|
|
25683
|
+
translator$e,
|
|
25684
|
+
translator$c
|
|
25685
|
+
];
|
|
25686
|
+
const propertyTranslatorsByXmlName$1 = {};
|
|
25687
|
+
const propertyTranslatorsBySdName$1 = {};
|
|
25688
|
+
propertyTranslators$1.forEach((translator2) => {
|
|
25689
|
+
propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
|
|
25690
|
+
propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
|
|
25691
|
+
});
|
|
25692
|
+
const translator$a = NodeTranslator.from({
|
|
25693
|
+
xmlName: XML_NODE_NAME$9,
|
|
25694
|
+
sdNodeOrKeyName: SD_ATTR_KEY$2,
|
|
25695
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
25696
|
+
attributes: [],
|
|
25697
|
+
encode: encode$9,
|
|
25698
|
+
decode: decode$9
|
|
25699
|
+
});
|
|
25700
|
+
const XML_NODE_NAME$8 = "w:tblPr";
|
|
25701
|
+
const SD_ATTR_KEY$1 = "tableProperties";
|
|
25702
|
+
const encode$8 = (params2) => {
|
|
25703
|
+
const { nodes } = params2;
|
|
25704
|
+
const node = nodes[0];
|
|
25705
|
+
const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
|
|
25706
|
+
return {
|
|
25707
|
+
xmlName: XML_NODE_NAME$8,
|
|
25708
|
+
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
25709
|
+
attributes
|
|
25710
|
+
};
|
|
25711
|
+
};
|
|
25712
|
+
const decode$8 = (params2) => {
|
|
25713
|
+
const { tableProperties = {} } = params2.node.attrs || {};
|
|
25714
|
+
const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
|
|
25715
|
+
const newNode = {
|
|
25716
|
+
name: "w:tblPr",
|
|
25717
|
+
type: "element",
|
|
25718
|
+
attributes: {},
|
|
25719
|
+
elements
|
|
25720
|
+
};
|
|
25721
|
+
return newNode;
|
|
25722
|
+
};
|
|
25723
|
+
const propertyTranslators = [
|
|
25724
|
+
translator$C,
|
|
25725
|
+
translator$K,
|
|
25726
|
+
translator$B,
|
|
25727
|
+
translator$A,
|
|
25728
|
+
translator$J,
|
|
25729
|
+
translator$z,
|
|
25730
|
+
translator$y,
|
|
25731
|
+
translator$x,
|
|
25732
|
+
translator$w,
|
|
25733
|
+
translator$v,
|
|
25734
|
+
translator$u,
|
|
25735
|
+
translator$t,
|
|
25736
|
+
translator$s,
|
|
25737
|
+
translator$r,
|
|
25738
|
+
translator$q,
|
|
25739
|
+
translator$b,
|
|
25740
|
+
translator$a
|
|
25741
|
+
];
|
|
25742
|
+
const propertyTranslatorsByXmlName = {};
|
|
25743
|
+
const propertyTranslatorsBySdName = {};
|
|
25744
|
+
propertyTranslators.forEach((translator2) => {
|
|
25745
|
+
propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
|
|
25746
|
+
propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
|
|
25747
|
+
});
|
|
25748
|
+
const config$8 = {
|
|
25749
|
+
xmlName: XML_NODE_NAME$8,
|
|
25750
|
+
sdNodeOrKeyName: SD_ATTR_KEY$1,
|
|
25751
|
+
encode: encode$8,
|
|
25752
|
+
decode: decode$8
|
|
25753
|
+
};
|
|
25754
|
+
const translator$9 = NodeTranslator.from(config$8);
|
|
25755
|
+
const translator$8 = NodeTranslator.from(
|
|
25756
|
+
createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
|
|
25757
|
+
);
|
|
25758
|
+
const XML_NODE_NAME$7 = "w:tblGrid";
|
|
25759
|
+
const SD_ATTR_KEY = "grid";
|
|
25760
|
+
const cellMinWidth = pixelsToTwips(10);
|
|
25761
|
+
const encode$7 = (params2) => {
|
|
25762
|
+
const { nodes } = params2;
|
|
25763
|
+
const node = nodes[0];
|
|
25764
|
+
const attributes = encodeProperties(node, { [translator$8.xmlName]: translator$8 }, true);
|
|
25765
|
+
return {
|
|
25766
|
+
xmlName: XML_NODE_NAME$7,
|
|
25767
|
+
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
25768
|
+
attributes
|
|
25769
|
+
};
|
|
25770
|
+
};
|
|
25771
|
+
const decode$7 = (params2) => {
|
|
25772
|
+
const { grid = [] } = params2.node.attrs || {};
|
|
25773
|
+
const { firstRow = {} } = params2.extraParams || {};
|
|
25774
|
+
const cellNodes = firstRow.content?.filter((n) => n.type === "tableCell") ?? [];
|
|
25775
|
+
const numberOfColumns = cellNodes.length || grid.length;
|
|
25776
|
+
const elements = [];
|
|
25777
|
+
for (let cellIdx = 0; cellIdx < numberOfColumns; cellIdx++) {
|
|
25778
|
+
const cell = cellNodes[cellIdx];
|
|
25779
|
+
const { colspan = 1, colwidth } = cell?.attrs || {};
|
|
25780
|
+
for (let mergedCellIdx = 0; mergedCellIdx < colspan; mergedCellIdx++) {
|
|
25781
|
+
const cellWidthPixels = colwidth && colwidth[mergedCellIdx];
|
|
25782
|
+
const colGridAttrs = grid?.[mergedCellIdx] || {};
|
|
25783
|
+
const gridWidthTwips = colGridAttrs.col;
|
|
25784
|
+
const gridWidthPixels = twipsToPixels(gridWidthTwips);
|
|
25785
|
+
let cellWidthTwips;
|
|
25786
|
+
if (gridWidthPixels === cellWidthPixels) {
|
|
25787
|
+
cellWidthTwips = gridWidthTwips;
|
|
25788
|
+
} else if (cellWidthPixels) {
|
|
25789
|
+
cellWidthTwips = pixelsToTwips(cellWidthPixels);
|
|
25790
|
+
}
|
|
25791
|
+
const widthTwips = Math.max(cellWidthTwips, cellMinWidth);
|
|
25792
|
+
elements.push(
|
|
25793
|
+
translator$8.decode({
|
|
25794
|
+
node: { type: (
|
|
25795
|
+
/** @type {string} */
|
|
25796
|
+
translator$8.sdNodeOrKeyName
|
|
25797
|
+
), attrs: { col: widthTwips } }
|
|
25798
|
+
})
|
|
25799
|
+
);
|
|
25800
|
+
}
|
|
25570
25801
|
}
|
|
25571
|
-
|
|
25802
|
+
const newNode = {
|
|
25803
|
+
name: XML_NODE_NAME$7,
|
|
25804
|
+
attributes: {},
|
|
25805
|
+
elements
|
|
25806
|
+
};
|
|
25807
|
+
return newNode;
|
|
25572
25808
|
};
|
|
25573
|
-
const
|
|
25574
|
-
|
|
25575
|
-
|
|
25809
|
+
const config$7 = {
|
|
25810
|
+
xmlName: XML_NODE_NAME$7,
|
|
25811
|
+
sdNodeOrKeyName: SD_ATTR_KEY,
|
|
25812
|
+
encode: encode$7,
|
|
25813
|
+
decode: decode$7
|
|
25576
25814
|
};
|
|
25577
|
-
|
|
25578
|
-
|
|
25815
|
+
const translator$7 = NodeTranslator.from(config$7);
|
|
25816
|
+
const XML_NODE_NAME$6 = "w:tbl";
|
|
25817
|
+
const SD_NODE_NAME$6 = "table";
|
|
25818
|
+
const encode$6 = (params2, encodedAttrs) => {
|
|
25819
|
+
const { nodes } = params2;
|
|
25820
|
+
const node = nodes[0];
|
|
25579
25821
|
const tblPr = node.elements.find((el) => el.name === "w:tblPr");
|
|
25580
|
-
|
|
25581
|
-
|
|
25582
|
-
|
|
25583
|
-
const
|
|
25584
|
-
|
|
25585
|
-
|
|
25586
|
-
const tableIndent = tblPr?.elements.find((el) => el.name === "w:tblInd");
|
|
25587
|
-
if (tableIndent) {
|
|
25588
|
-
const { "w:w": width, "w:type": type2 } = tableIndent.attributes;
|
|
25589
|
-
attrs["tableIndent"] = { width: twipsToPixels(width), type: type2 };
|
|
25590
|
-
}
|
|
25591
|
-
const tableLayout = tblPr?.elements.find((el) => el.name === "w:tblLayout");
|
|
25592
|
-
if (tableLayout) {
|
|
25593
|
-
const { "w:type": type2 } = tableLayout.attributes;
|
|
25594
|
-
attrs["tableLayout"] = type2;
|
|
25595
|
-
}
|
|
25596
|
-
const referencedStyles = getReferencedTableStyles(tblStyleTag, docx);
|
|
25597
|
-
const tblW = tblPr.elements.find((el) => el.name === "w:tblW");
|
|
25598
|
-
if (tblW) {
|
|
25599
|
-
attrs["tableWidth"] = {
|
|
25600
|
-
width: twipsToPixels(tblW.attributes["w:w"]),
|
|
25601
|
-
type: tblW.attributes["w:type"]
|
|
25602
|
-
};
|
|
25603
|
-
}
|
|
25604
|
-
const tblCellSpacing = tblPr.elements.find((el) => el.name === "w:tblCellSpacing");
|
|
25605
|
-
if (tblCellSpacing) {
|
|
25606
|
-
attrs["tableCellSpacing"] = {
|
|
25607
|
-
w: tblCellSpacing.attributes["w:w"],
|
|
25608
|
-
type: tblCellSpacing.attributes["w:type"]
|
|
25609
|
-
};
|
|
25610
|
-
attrs["borderCollapse"] = "separate";
|
|
25611
|
-
}
|
|
25612
|
-
const tblJustification = tblPr.elements.find((el) => el.name === "w:jc");
|
|
25613
|
-
if (tblJustification?.attributes) {
|
|
25614
|
-
attrs["justification"] = tblJustification.attributes["w:val"];
|
|
25822
|
+
if (tblPr) {
|
|
25823
|
+
encodedAttrs["tableProperties"] = translator$9.encode({ ...params2, nodes: [tblPr] }).attributes;
|
|
25824
|
+
}
|
|
25825
|
+
const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
|
|
25826
|
+
if (tblGrid) {
|
|
25827
|
+
encodedAttrs["grid"] = translator$7.encode({ ...params2, nodes: [tblGrid] }).attributes;
|
|
25615
25828
|
}
|
|
25829
|
+
[
|
|
25830
|
+
"tableStyleId",
|
|
25831
|
+
"justification",
|
|
25832
|
+
"tableLayout",
|
|
25833
|
+
["tableIndent", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
|
|
25834
|
+
["tableWidth", ({ value, type: type2 }) => ({ width: twipsToPixels(value), type: type2 })],
|
|
25835
|
+
["tableCellSpacing", ({ value, type: type2 }) => ({ w: String(value), type: type2 })]
|
|
25836
|
+
].forEach((prop) => {
|
|
25837
|
+
let key2;
|
|
25838
|
+
let transform;
|
|
25839
|
+
if (Array.isArray(prop)) {
|
|
25840
|
+
[key2, transform] = prop;
|
|
25841
|
+
} else {
|
|
25842
|
+
key2 = prop;
|
|
25843
|
+
transform = (v2) => v2;
|
|
25844
|
+
}
|
|
25845
|
+
if (encodedAttrs.tableProperties?.[key2]) {
|
|
25846
|
+
encodedAttrs[key2] = transform(encodedAttrs.tableProperties[key2]);
|
|
25847
|
+
}
|
|
25848
|
+
});
|
|
25849
|
+
if (encodedAttrs.tableCellSpacing) {
|
|
25850
|
+
encodedAttrs["borderCollapse"] = "separate";
|
|
25851
|
+
}
|
|
25852
|
+
const { borders, rowBorders } = _processTableBorders(encodedAttrs.tableProperties?.borders || {});
|
|
25853
|
+
const referencedStyles = _getReferencedTableStyles(encodedAttrs.tableStyleId, params2);
|
|
25616
25854
|
const rows = node.elements.filter((el) => el.name === "w:tr");
|
|
25617
|
-
const
|
|
25618
|
-
const
|
|
25619
|
-
|
|
25620
|
-
const
|
|
25621
|
-
|
|
25855
|
+
const borderData = Object.assign({}, referencedStyles?.borders || {}, borders || {});
|
|
25856
|
+
const borderRowData = Object.assign({}, referencedStyles?.rowBorders || {}, rowBorders || {});
|
|
25857
|
+
encodedAttrs["borders"] = borderData;
|
|
25858
|
+
const tblStyleTag = tblPr.elements.find((el) => el.name === "w:tblStyle");
|
|
25859
|
+
const columnWidths = (encodedAttrs["grid"] ?? []).map((item) => twipsToPixels(item.col));
|
|
25622
25860
|
const content = [];
|
|
25623
25861
|
rows.forEach((row) => {
|
|
25624
|
-
const result = translator$
|
|
25862
|
+
const result = translator$D.encode({
|
|
25625
25863
|
...params2,
|
|
25626
25864
|
nodes: [row],
|
|
25627
25865
|
extraParams: {
|
|
25628
25866
|
row,
|
|
25629
|
-
table: node,
|
|
25630
25867
|
rowBorders: borderRowData,
|
|
25631
|
-
styleTag: tblStyleTag
|
|
25868
|
+
styleTag: tblStyleTag,
|
|
25869
|
+
columnWidths
|
|
25632
25870
|
}
|
|
25633
25871
|
});
|
|
25634
25872
|
if (result.content?.length) content.push(result);
|
|
@@ -25636,9 +25874,113 @@ function handleTableNode(node, params2) {
|
|
|
25636
25874
|
return {
|
|
25637
25875
|
type: "table",
|
|
25638
25876
|
content,
|
|
25639
|
-
attrs
|
|
25877
|
+
attrs: encodedAttrs
|
|
25878
|
+
};
|
|
25879
|
+
};
|
|
25880
|
+
const decode$6 = (params2, decodedAttrs) => {
|
|
25881
|
+
params2.node = preProcessVerticalMergeCells(params2.node, params2);
|
|
25882
|
+
const { node } = params2;
|
|
25883
|
+
const elements = translateChildNodes(params2);
|
|
25884
|
+
const firstRow = node.content?.find((n) => n.type === "tableRow");
|
|
25885
|
+
const properties = node.attrs.grid;
|
|
25886
|
+
const element = translator$7.decode({
|
|
25887
|
+
...params2,
|
|
25888
|
+
node: { ...node, attrs: { ...node.attrs, grid: properties } },
|
|
25889
|
+
extraParams: {
|
|
25890
|
+
firstRow
|
|
25891
|
+
}
|
|
25892
|
+
});
|
|
25893
|
+
if (element) elements.unshift(element);
|
|
25894
|
+
if (node.attrs?.tableProperties) {
|
|
25895
|
+
const properties2 = { ...node.attrs.tableProperties };
|
|
25896
|
+
const element2 = translator$9.decode({
|
|
25897
|
+
...params2,
|
|
25898
|
+
node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
|
|
25899
|
+
});
|
|
25900
|
+
if (element2) elements.unshift(element2);
|
|
25901
|
+
}
|
|
25902
|
+
return {
|
|
25903
|
+
name: "w:tbl",
|
|
25904
|
+
attributes: decodedAttrs || {},
|
|
25905
|
+
elements
|
|
25906
|
+
};
|
|
25907
|
+
};
|
|
25908
|
+
function _processTableBorders(rawBorders) {
|
|
25909
|
+
const borders = {};
|
|
25910
|
+
const rowBorders = {};
|
|
25911
|
+
Object.entries(rawBorders).forEach(([name, attributes]) => {
|
|
25912
|
+
const attrs = {};
|
|
25913
|
+
const color = attributes.color;
|
|
25914
|
+
const size2 = attributes.size;
|
|
25915
|
+
if (color && color !== "auto") attrs["color"] = color.startsWith("#") ? color : `#${color}`;
|
|
25916
|
+
if (size2 && size2 !== "auto") attrs["size"] = eigthPointsToPixels(size2);
|
|
25917
|
+
const rowBorderNames = ["insideH", "insideV"];
|
|
25918
|
+
if (rowBorderNames.includes(name)) rowBorders[name] = attrs;
|
|
25919
|
+
borders[name] = attrs;
|
|
25920
|
+
});
|
|
25921
|
+
return {
|
|
25922
|
+
borders,
|
|
25923
|
+
rowBorders
|
|
25640
25924
|
};
|
|
25641
25925
|
}
|
|
25926
|
+
function _getReferencedTableStyles(tableStyleReference, params2) {
|
|
25927
|
+
if (!tableStyleReference) return null;
|
|
25928
|
+
const stylesToReturn = {};
|
|
25929
|
+
const { docx } = params2;
|
|
25930
|
+
const styles = docx["word/styles.xml"];
|
|
25931
|
+
const { elements } = styles.elements[0];
|
|
25932
|
+
const styleElements = elements.filter((el) => el.name === "w:style");
|
|
25933
|
+
const styleTag = styleElements.find((el) => el.attributes["w:styleId"] === tableStyleReference);
|
|
25934
|
+
if (!styleTag) return null;
|
|
25935
|
+
stylesToReturn.name = styleTag.elements.find((el) => el.name === "w:name");
|
|
25936
|
+
const basedOn = styleTag.elements.find((el) => el.name === "w:basedOn");
|
|
25937
|
+
let baseTblPr;
|
|
25938
|
+
if (basedOn?.attributes) {
|
|
25939
|
+
const baseStyles = styleElements.find((el) => el.attributes["w:styleId"] === basedOn.attributes["w:val"]);
|
|
25940
|
+
baseTblPr = baseStyles ? baseStyles.elements.find((el) => el.name === "w:tblPr") : {};
|
|
25941
|
+
}
|
|
25942
|
+
const pPr = styleTag.elements.find((el) => el.name === "w:pPr");
|
|
25943
|
+
if (pPr) {
|
|
25944
|
+
const justification = pPr.elements.find((el) => el.name === "w:jc");
|
|
25945
|
+
if (justification?.attributes) stylesToReturn.justification = justification.attributes["w:val"];
|
|
25946
|
+
}
|
|
25947
|
+
const rPr = styleTag?.elements.find((el) => el.name === "w:rPr");
|
|
25948
|
+
if (rPr) {
|
|
25949
|
+
const fonts = rPr.elements.find((el) => el.name === "w:rFonts");
|
|
25950
|
+
if (fonts) {
|
|
25951
|
+
const { "w:ascii": ascii, "w:hAnsi": hAnsi, "w:cs": cs } = fonts.attributes;
|
|
25952
|
+
stylesToReturn.fonts = { ascii, hAnsi, cs };
|
|
25953
|
+
}
|
|
25954
|
+
const fontSize2 = rPr.elements.find((el) => el.name === "w:sz");
|
|
25955
|
+
if (fontSize2?.attributes) stylesToReturn.fontSize = halfPointToPoints(fontSize2.attributes["w:val"]) + "pt";
|
|
25956
|
+
}
|
|
25957
|
+
const tblPr = styleTag.elements.find((el) => el.name === "w:tblPr");
|
|
25958
|
+
if (tblPr && tblPr.elements) {
|
|
25959
|
+
if (baseTblPr && baseTblPr.elements) {
|
|
25960
|
+
tblPr.elements.push(...baseTblPr.elements);
|
|
25961
|
+
}
|
|
25962
|
+
const tableProperties = translator$9.encode({ ...params2, nodes: [tblPr] }).attributes;
|
|
25963
|
+
const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
|
|
25964
|
+
if (borders) stylesToReturn.borders = borders;
|
|
25965
|
+
if (rowBorders) stylesToReturn.rowBorders = rowBorders;
|
|
25966
|
+
const cellMargins = {};
|
|
25967
|
+
Object.entries(tableProperties.cellMargins || {}).forEach(([key2, attrs]) => {
|
|
25968
|
+
if (attrs?.value) cellMargins[key2] = String(attrs.value);
|
|
25969
|
+
});
|
|
25970
|
+
if (Object.keys(cellMargins).length) stylesToReturn.cellMargins = cellMargins;
|
|
25971
|
+
}
|
|
25972
|
+
return stylesToReturn;
|
|
25973
|
+
}
|
|
25974
|
+
const config$6 = {
|
|
25975
|
+
xmlName: XML_NODE_NAME$6,
|
|
25976
|
+
sdNodeOrKeyName: SD_NODE_NAME$6,
|
|
25977
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
25978
|
+
encode: encode$6,
|
|
25979
|
+
decode: decode$6,
|
|
25980
|
+
attributes: []
|
|
25981
|
+
};
|
|
25982
|
+
const translator$6 = NodeTranslator.from(config$6);
|
|
25983
|
+
const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$6);
|
|
25642
25984
|
function getReferencedTableStyles(tblStyleTag, docx) {
|
|
25643
25985
|
if (!tblStyleTag) return null;
|
|
25644
25986
|
const stylesToReturn = {};
|
|
@@ -25719,15 +26061,6 @@ function processTableBorders(borderElements) {
|
|
|
25719
26061
|
rowBorders
|
|
25720
26062
|
};
|
|
25721
26063
|
}
|
|
25722
|
-
const getGridColumnWidths = (tableNode) => {
|
|
25723
|
-
const tblGrid = tableNode.elements.find((el) => el.name === "w:tblGrid");
|
|
25724
|
-
if (!tblGrid) return [];
|
|
25725
|
-
const columnWidths = tblGrid?.elements?.flatMap((el) => {
|
|
25726
|
-
if (el.name !== "w:gridCol") return [];
|
|
25727
|
-
return twipsToPixels(el.attributes["w:w"]);
|
|
25728
|
-
}) || [];
|
|
25729
|
-
return columnWidths;
|
|
25730
|
-
};
|
|
25731
26064
|
function handleTableCellNode({
|
|
25732
26065
|
params: params2,
|
|
25733
26066
|
node,
|
|
@@ -25736,7 +26069,8 @@ function handleTableCellNode({
|
|
|
25736
26069
|
rowBorders,
|
|
25737
26070
|
styleTag,
|
|
25738
26071
|
columnIndex,
|
|
25739
|
-
columnWidth = null
|
|
26072
|
+
columnWidth = null,
|
|
26073
|
+
allColumnWidths = []
|
|
25740
26074
|
}) {
|
|
25741
26075
|
const { docx, nodeListHandler } = params2;
|
|
25742
26076
|
const tcPr = node.elements.find((el) => el.name === "w:tcPr");
|
|
@@ -25750,7 +26084,7 @@ function handleTableCellNode({
|
|
|
25750
26084
|
delete rowBorders?.insideV;
|
|
25751
26085
|
}
|
|
25752
26086
|
const inlineBorders = processInlineCellBorders(borders, rowBorders);
|
|
25753
|
-
const gridColumnWidths =
|
|
26087
|
+
const gridColumnWidths = allColumnWidths;
|
|
25754
26088
|
const tcWidth = tcPr?.elements?.find((el) => el.name === "w:tcW");
|
|
25755
26089
|
let width = tcWidth ? twipsToPixels(tcWidth.attributes["w:w"]) : null;
|
|
25756
26090
|
const widthType = tcWidth?.attributes["w:type"];
|
|
@@ -26006,7 +26340,16 @@ const XML_NODE_NAME$5 = "w:tc";
|
|
|
26006
26340
|
const SD_NODE_NAME$5 = "tableCell";
|
|
26007
26341
|
const validXmlAttributes$5 = [];
|
|
26008
26342
|
function encode$5(params2, encodedAttrs) {
|
|
26009
|
-
const {
|
|
26343
|
+
const {
|
|
26344
|
+
node,
|
|
26345
|
+
table,
|
|
26346
|
+
row,
|
|
26347
|
+
rowBorders,
|
|
26348
|
+
styleTag,
|
|
26349
|
+
columnIndex,
|
|
26350
|
+
columnWidth,
|
|
26351
|
+
columnWidths: allColumnWidths
|
|
26352
|
+
} = params2.extraParams;
|
|
26010
26353
|
const schemaNode = handleTableCellNode({
|
|
26011
26354
|
params: params2,
|
|
26012
26355
|
node,
|
|
@@ -26015,7 +26358,8 @@ function encode$5(params2, encodedAttrs) {
|
|
|
26015
26358
|
rowBorders,
|
|
26016
26359
|
styleTag,
|
|
26017
26360
|
columnIndex,
|
|
26018
|
-
columnWidth
|
|
26361
|
+
columnWidth,
|
|
26362
|
+
allColumnWidths
|
|
26019
26363
|
});
|
|
26020
26364
|
if (encodedAttrs && Object.keys(encodedAttrs).length) {
|
|
26021
26365
|
schemaNode.attrs = { ...schemaNode.attrs, ...encodedAttrs };
|
|
@@ -26957,9 +27301,9 @@ const config$2 = {
|
|
|
26957
27301
|
};
|
|
26958
27302
|
const translator$2 = NodeTranslator.from(config$2);
|
|
26959
27303
|
const registeredHandlers = Object.freeze({
|
|
26960
|
-
"w:br": translator$
|
|
26961
|
-
"w:tab": translator$
|
|
26962
|
-
"w:p": translator$
|
|
27304
|
+
"w:br": translator$T,
|
|
27305
|
+
"w:tab": translator$S,
|
|
27306
|
+
"w:p": translator$R,
|
|
26963
27307
|
"wp:anchor": translator$3,
|
|
26964
27308
|
"wp:inline": translator$2
|
|
26965
27309
|
});
|
|
@@ -28578,7 +28922,7 @@ function translateStructuredContent(params2) {
|
|
|
28578
28922
|
const XML_NODE_NAME = "w:sdt";
|
|
28579
28923
|
const SD_NODE_NAME = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
|
|
28580
28924
|
const validXmlAttributes = [];
|
|
28581
|
-
function encode$
|
|
28925
|
+
function encode$s(params2, encodedAttrs) {
|
|
28582
28926
|
const nodes = params2.nodes;
|
|
28583
28927
|
const node = nodes[0];
|
|
28584
28928
|
const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
|
|
@@ -28608,7 +28952,7 @@ const config = {
|
|
|
28608
28952
|
xmlName: XML_NODE_NAME,
|
|
28609
28953
|
sdNodeOrKeyName: SD_NODE_NAME,
|
|
28610
28954
|
type: NodeTranslator.translatorTypes.NODE,
|
|
28611
|
-
encode: encode$
|
|
28955
|
+
encode: encode$s,
|
|
28612
28956
|
decode,
|
|
28613
28957
|
attributes: validXmlAttributes
|
|
28614
28958
|
};
|
|
@@ -28619,19 +28963,19 @@ function exportSchemaToJson(params2) {
|
|
|
28619
28963
|
doc: translateDocumentNode,
|
|
28620
28964
|
body: translateBodyNode,
|
|
28621
28965
|
heading: translateHeadingNode,
|
|
28622
|
-
paragraph: translator$
|
|
28966
|
+
paragraph: translator$R,
|
|
28623
28967
|
text: translateTextNode,
|
|
28624
28968
|
bulletList: translateList,
|
|
28625
28969
|
orderedList: translateList,
|
|
28626
|
-
lineBreak: translator$
|
|
28627
|
-
table:
|
|
28628
|
-
tableRow: translator$
|
|
28970
|
+
lineBreak: translator$T,
|
|
28971
|
+
table: translator$6,
|
|
28972
|
+
tableRow: translator$D,
|
|
28629
28973
|
tableCell: translator$5,
|
|
28630
28974
|
bookmarkStart: translateBookmarkStart,
|
|
28631
28975
|
fieldAnnotation: translator,
|
|
28632
|
-
tab: translator$
|
|
28976
|
+
tab: translator$S,
|
|
28633
28977
|
image: translator$1,
|
|
28634
|
-
hardBreak: translator$
|
|
28978
|
+
hardBreak: translator$T,
|
|
28635
28979
|
commentRangeStart: () => translateCommentNode(params2, "Start"),
|
|
28636
28980
|
commentRangeEnd: () => translateCommentNode(params2, "End"),
|
|
28637
28981
|
commentReference: () => null,
|
|
@@ -29238,131 +29582,6 @@ const generateNumPrTag = (numId, level) => {
|
|
|
29238
29582
|
]
|
|
29239
29583
|
};
|
|
29240
29584
|
};
|
|
29241
|
-
function translateTable(params2) {
|
|
29242
|
-
params2.node = preProcessVerticalMergeCells(params2.node, params2);
|
|
29243
|
-
const elements = translateChildNodes(params2);
|
|
29244
|
-
const tableProperties = generateTableProperties(params2.node);
|
|
29245
|
-
const gridProperties = generateTableGrid(params2.node, params2);
|
|
29246
|
-
elements.unshift(tableProperties);
|
|
29247
|
-
elements.unshift(gridProperties);
|
|
29248
|
-
return {
|
|
29249
|
-
name: "w:tbl",
|
|
29250
|
-
elements
|
|
29251
|
-
};
|
|
29252
|
-
}
|
|
29253
|
-
function generateTableProperties(node) {
|
|
29254
|
-
const elements = [];
|
|
29255
|
-
const { attrs } = node;
|
|
29256
|
-
const { tableWidth, tableStyleId, borders, tableIndent, tableLayout, tableCellSpacing, justification } = attrs;
|
|
29257
|
-
if (tableStyleId) {
|
|
29258
|
-
const tableStyleElement = {
|
|
29259
|
-
name: "w:tblStyle",
|
|
29260
|
-
attributes: { "w:val": tableStyleId }
|
|
29261
|
-
};
|
|
29262
|
-
elements.push(tableStyleElement);
|
|
29263
|
-
}
|
|
29264
|
-
if (borders) {
|
|
29265
|
-
const borderElement = generateTableBorders(node);
|
|
29266
|
-
elements.push(borderElement);
|
|
29267
|
-
}
|
|
29268
|
-
if (tableIndent) {
|
|
29269
|
-
const { width, type: type2 } = tableIndent;
|
|
29270
|
-
const tableIndentElement = {
|
|
29271
|
-
name: "w:tblInd",
|
|
29272
|
-
attributes: { "w:w": pixelsToTwips(width), "w:type": type2 }
|
|
29273
|
-
};
|
|
29274
|
-
elements.push(tableIndentElement);
|
|
29275
|
-
}
|
|
29276
|
-
if (tableLayout) {
|
|
29277
|
-
const tableLayoutElement = {
|
|
29278
|
-
name: "w:tblLayout",
|
|
29279
|
-
attributes: { "w:type": tableLayout }
|
|
29280
|
-
};
|
|
29281
|
-
elements.push(tableLayoutElement);
|
|
29282
|
-
}
|
|
29283
|
-
if (tableWidth && tableWidth.width) {
|
|
29284
|
-
const tableWidthElement = {
|
|
29285
|
-
name: "w:tblW",
|
|
29286
|
-
attributes: { "w:w": pixelsToTwips(tableWidth.width), "w:type": tableWidth.type }
|
|
29287
|
-
};
|
|
29288
|
-
elements.push(tableWidthElement);
|
|
29289
|
-
}
|
|
29290
|
-
if (tableCellSpacing) {
|
|
29291
|
-
elements.push({
|
|
29292
|
-
name: "w:tblCellSpacing",
|
|
29293
|
-
attributes: {
|
|
29294
|
-
"w:w": tableCellSpacing.w,
|
|
29295
|
-
"w:type": tableCellSpacing.type
|
|
29296
|
-
}
|
|
29297
|
-
});
|
|
29298
|
-
}
|
|
29299
|
-
if (justification) {
|
|
29300
|
-
const justificationElement = {
|
|
29301
|
-
name: "w:jc",
|
|
29302
|
-
attributes: { "w:val": justification }
|
|
29303
|
-
};
|
|
29304
|
-
elements.push(justificationElement);
|
|
29305
|
-
}
|
|
29306
|
-
return {
|
|
29307
|
-
name: "w:tblPr",
|
|
29308
|
-
elements
|
|
29309
|
-
};
|
|
29310
|
-
}
|
|
29311
|
-
function generateTableBorders(node) {
|
|
29312
|
-
const { borders } = node.attrs;
|
|
29313
|
-
const elements = [];
|
|
29314
|
-
if (!borders) return;
|
|
29315
|
-
const borderTypes = ["top", "bottom", "left", "right", "insideH", "insideV"];
|
|
29316
|
-
borderTypes.forEach((type2) => {
|
|
29317
|
-
const border = borders[type2];
|
|
29318
|
-
if (!border) return;
|
|
29319
|
-
let attributes = {};
|
|
29320
|
-
if (!Object.keys(border).length || !border.size) {
|
|
29321
|
-
attributes = {
|
|
29322
|
-
"w:val": "nil"
|
|
29323
|
-
};
|
|
29324
|
-
} else {
|
|
29325
|
-
attributes = {
|
|
29326
|
-
"w:val": "single",
|
|
29327
|
-
"w:sz": pixelsToEightPoints(border.size),
|
|
29328
|
-
"w:space": border.space || 0,
|
|
29329
|
-
"w:color": border?.color?.substring(1) || "000000"
|
|
29330
|
-
};
|
|
29331
|
-
}
|
|
29332
|
-
const borderElement = {
|
|
29333
|
-
name: `w:${type2}`,
|
|
29334
|
-
attributes
|
|
29335
|
-
};
|
|
29336
|
-
elements.push(borderElement);
|
|
29337
|
-
});
|
|
29338
|
-
return {
|
|
29339
|
-
name: "w:tblBorders",
|
|
29340
|
-
elements
|
|
29341
|
-
};
|
|
29342
|
-
}
|
|
29343
|
-
function generateTableGrid(node, params2) {
|
|
29344
|
-
const { editorSchema } = params2;
|
|
29345
|
-
let colgroup = [];
|
|
29346
|
-
try {
|
|
29347
|
-
const pmNode = editorSchema.nodeFromJSON(node);
|
|
29348
|
-
const cellMinWidth = 10;
|
|
29349
|
-
const { colgroupValues } = createColGroup(pmNode, cellMinWidth);
|
|
29350
|
-
colgroup = colgroupValues;
|
|
29351
|
-
} catch {
|
|
29352
|
-
colgroup = [];
|
|
29353
|
-
}
|
|
29354
|
-
const elements = [];
|
|
29355
|
-
colgroup?.forEach((width) => {
|
|
29356
|
-
elements.push({
|
|
29357
|
-
name: "w:gridCol",
|
|
29358
|
-
attributes: { "w:w": pixelsToTwips(width) }
|
|
29359
|
-
});
|
|
29360
|
-
});
|
|
29361
|
-
return {
|
|
29362
|
-
name: "w:tblGrid",
|
|
29363
|
-
elements
|
|
29364
|
-
};
|
|
29365
|
-
}
|
|
29366
29585
|
function translateBookmarkStart(params2) {
|
|
29367
29586
|
const bookmarkStartNode = {
|
|
29368
29587
|
name: "w:bookmarkStart",
|
|
@@ -29938,7 +30157,7 @@ const handleParagraphNode = (params2) => {
|
|
|
29938
30157
|
if (nodes.length === 0 || nodes[0].name !== "w:p") {
|
|
29939
30158
|
return { nodes: [], consumed: 0 };
|
|
29940
30159
|
}
|
|
29941
|
-
const schemaNode = translator$
|
|
30160
|
+
const schemaNode = translator$R.encode(params2);
|
|
29942
30161
|
const newNodes = schemaNode ? [schemaNode] : [];
|
|
29943
30162
|
return { nodes: newNodes, consumed: 1 };
|
|
29944
30163
|
};
|
|
@@ -30041,7 +30260,7 @@ const handler = (params2) => {
|
|
|
30041
30260
|
if (nodes.length === 0 || nodes[0].name !== "w:br") {
|
|
30042
30261
|
return { nodes: [], consumed: 0 };
|
|
30043
30262
|
}
|
|
30044
|
-
const result = translator$
|
|
30263
|
+
const result = translator$T.encode(params2);
|
|
30045
30264
|
if (!result) return { nodes: [], consumed: 0 };
|
|
30046
30265
|
return {
|
|
30047
30266
|
nodes: [result],
|
|
@@ -30737,7 +30956,7 @@ const handleTabNode = (params2) => {
|
|
|
30737
30956
|
if (!nodes.length || nodes[0].name !== "w:tab") {
|
|
30738
30957
|
return { nodes: [], consumed: 0 };
|
|
30739
30958
|
}
|
|
30740
|
-
const node = translator$
|
|
30959
|
+
const node = translator$S.encode(params2);
|
|
30741
30960
|
return { nodes: [node], consumed: 1 };
|
|
30742
30961
|
};
|
|
30743
30962
|
const tabNodeEntityHandler = {
|
|
@@ -53487,9 +53706,15 @@ const HardBreak = Node$1.create({
|
|
|
53487
53706
|
};
|
|
53488
53707
|
}
|
|
53489
53708
|
});
|
|
53709
|
+
const getColStyleDeclaration = (minWidth, width) => {
|
|
53710
|
+
if (width) {
|
|
53711
|
+
return ["width", `${Math.max(width, minWidth)}px`];
|
|
53712
|
+
}
|
|
53713
|
+
return ["min-width", `${minWidth}px`];
|
|
53714
|
+
};
|
|
53490
53715
|
const createTableView = ({ editor }) => {
|
|
53491
53716
|
return class TableView {
|
|
53492
|
-
constructor(node,
|
|
53717
|
+
constructor(node, cellMinWidth2) {
|
|
53493
53718
|
__publicField$1(this, "editor");
|
|
53494
53719
|
__publicField$1(this, "node");
|
|
53495
53720
|
__publicField$1(this, "dom");
|
|
@@ -53499,13 +53724,13 @@ const createTableView = ({ editor }) => {
|
|
|
53499
53724
|
__publicField$1(this, "cellMinWidth");
|
|
53500
53725
|
this.editor = editor;
|
|
53501
53726
|
this.node = node;
|
|
53502
|
-
this.cellMinWidth =
|
|
53727
|
+
this.cellMinWidth = cellMinWidth2;
|
|
53503
53728
|
this.dom = document.createElement("div");
|
|
53504
53729
|
this.dom.className = "tableWrapper";
|
|
53505
53730
|
this.table = this.dom.appendChild(document.createElement("table"));
|
|
53506
53731
|
this.colgroup = this.table.appendChild(document.createElement("colgroup"));
|
|
53507
53732
|
updateTable(this.editor, this.node, this.table);
|
|
53508
|
-
updateColumns(node, this.colgroup, this.table,
|
|
53733
|
+
updateColumns(node, this.colgroup, this.table, cellMinWidth2);
|
|
53509
53734
|
this.contentDOM = this.table.appendChild(document.createElement("tbody"));
|
|
53510
53735
|
setTimeout(() => {
|
|
53511
53736
|
updateTableWrapper(this.dom, this.table);
|
|
@@ -53530,7 +53755,7 @@ const createTableView = ({ editor }) => {
|
|
|
53530
53755
|
}
|
|
53531
53756
|
};
|
|
53532
53757
|
};
|
|
53533
|
-
function updateColumns(node, colgroup, table,
|
|
53758
|
+
function updateColumns(node, colgroup, table, cellMinWidth2, overrideCol, overrideValue) {
|
|
53534
53759
|
let totalWidth = 0;
|
|
53535
53760
|
let fixedWidth = true;
|
|
53536
53761
|
let nextDOM = colgroup.firstChild;
|
|
@@ -53541,16 +53766,16 @@ function updateColumns(node, colgroup, table, cellMinWidth, overrideCol, overrid
|
|
|
53541
53766
|
for (let j2 = 0; j2 < colspan; j2++, col++) {
|
|
53542
53767
|
const hasWidth = overrideCol === col ? overrideValue : colwidth && colwidth[j2];
|
|
53543
53768
|
const cssWidth = hasWidth ? `${hasWidth}px` : "";
|
|
53544
|
-
totalWidth += hasWidth ||
|
|
53769
|
+
totalWidth += hasWidth || cellMinWidth2;
|
|
53545
53770
|
if (!hasWidth) fixedWidth = false;
|
|
53546
53771
|
if (!nextDOM) {
|
|
53547
53772
|
const col2 = document.createElement("col");
|
|
53548
|
-
const [propKey, propVal] = getColStyleDeclaration(
|
|
53773
|
+
const [propKey, propVal] = getColStyleDeclaration(cellMinWidth2, hasWidth);
|
|
53549
53774
|
col2.style.setProperty(propKey, propVal);
|
|
53550
53775
|
colgroup.appendChild(col2);
|
|
53551
53776
|
} else {
|
|
53552
53777
|
if (nextDOM.style.width !== cssWidth) {
|
|
53553
|
-
const [propKey, propVal] = getColStyleDeclaration(
|
|
53778
|
+
const [propKey, propVal] = getColStyleDeclaration(cellMinWidth2, hasWidth);
|
|
53554
53779
|
nextDOM.style.setProperty(propKey, propVal);
|
|
53555
53780
|
}
|
|
53556
53781
|
nextDOM = nextDOM.nextSibling;
|
|
@@ -53647,6 +53872,35 @@ const createTable = (schema, rowsCount, colsCount, withHeaderRow, cellContent =
|
|
|
53647
53872
|
const tableBorders = createTableBorders();
|
|
53648
53873
|
return types2.table.createChecked({ borders: tableBorders }, rows);
|
|
53649
53874
|
};
|
|
53875
|
+
const createColGroup = (node, cellMinWidth2, overrideCol, overrideValue) => {
|
|
53876
|
+
let totalWidth = 0;
|
|
53877
|
+
let fixedWidth = true;
|
|
53878
|
+
const cols = [];
|
|
53879
|
+
const colsValues = [];
|
|
53880
|
+
const row = node.firstChild;
|
|
53881
|
+
if (!row) return {};
|
|
53882
|
+
for (let i = 0, col = 0; i < row.childCount; i++) {
|
|
53883
|
+
const { colspan, colwidth } = row.child(i).attrs;
|
|
53884
|
+
for (let j2 = 0; j2 < colspan; j2++, col++) {
|
|
53885
|
+
const hasWidth = overrideCol === col ? overrideValue : colwidth && colwidth[j2];
|
|
53886
|
+
totalWidth += hasWidth || cellMinWidth2;
|
|
53887
|
+
if (!hasWidth) fixedWidth = false;
|
|
53888
|
+
const [prop, value] = getColStyleDeclaration(cellMinWidth2, hasWidth);
|
|
53889
|
+
cols.push(["col", { style: `${prop}: ${value}` }]);
|
|
53890
|
+
colsValues.push(parseInt(value, 10));
|
|
53891
|
+
}
|
|
53892
|
+
}
|
|
53893
|
+
const tableWidth = fixedWidth ? `${totalWidth}px` : "";
|
|
53894
|
+
const tableMinWidth = fixedWidth ? "" : `${totalWidth}px`;
|
|
53895
|
+
const colgroup = ["colgroup", {}, ...cols];
|
|
53896
|
+
const colgroupValues = [...colsValues];
|
|
53897
|
+
return {
|
|
53898
|
+
colgroup,
|
|
53899
|
+
tableWidth,
|
|
53900
|
+
tableMinWidth,
|
|
53901
|
+
colgroupValues
|
|
53902
|
+
};
|
|
53903
|
+
};
|
|
53650
53904
|
var readFromCache;
|
|
53651
53905
|
var addToCache;
|
|
53652
53906
|
if (typeof WeakMap != "undefined") {
|
|
@@ -55464,7 +55718,7 @@ var columnResizingPluginKey = new PluginKey(
|
|
|
55464
55718
|
);
|
|
55465
55719
|
function columnResizing({
|
|
55466
55720
|
handleWidth = 5,
|
|
55467
|
-
cellMinWidth = 25,
|
|
55721
|
+
cellMinWidth: cellMinWidth2 = 25,
|
|
55468
55722
|
defaultCellMinWidth = 100,
|
|
55469
55723
|
View = TableView,
|
|
55470
55724
|
lastColumnResizable = true
|
|
@@ -55500,7 +55754,7 @@ function columnResizing({
|
|
|
55500
55754
|
handleMouseLeave(view);
|
|
55501
55755
|
},
|
|
55502
55756
|
mousedown: (view, event) => {
|
|
55503
|
-
handleMouseDown2(view, event,
|
|
55757
|
+
handleMouseDown2(view, event, cellMinWidth2, defaultCellMinWidth);
|
|
55504
55758
|
}
|
|
55505
55759
|
},
|
|
55506
55760
|
decorations: (state2) => {
|
|
@@ -55571,7 +55825,7 @@ function handleMouseLeave(view) {
|
|
|
55571
55825
|
if (pluginState && pluginState.activeHandle > -1 && !pluginState.dragging)
|
|
55572
55826
|
updateHandle(view, -1);
|
|
55573
55827
|
}
|
|
55574
|
-
function handleMouseDown2(view, event,
|
|
55828
|
+
function handleMouseDown2(view, event, cellMinWidth2, defaultCellMinWidth) {
|
|
55575
55829
|
var _a2;
|
|
55576
55830
|
if (!view.editable) return false;
|
|
55577
55831
|
const win = (_a2 = view.dom.ownerDocument.defaultView) != null ? _a2 : window;
|
|
@@ -55593,7 +55847,7 @@ function handleMouseDown2(view, event, cellMinWidth, defaultCellMinWidth) {
|
|
|
55593
55847
|
updateColumnWidth(
|
|
55594
55848
|
view,
|
|
55595
55849
|
pluginState2.activeHandle,
|
|
55596
|
-
draggedWidth(pluginState2.dragging, event2,
|
|
55850
|
+
draggedWidth(pluginState2.dragging, event2, cellMinWidth2)
|
|
55597
55851
|
);
|
|
55598
55852
|
view.dispatch(
|
|
55599
55853
|
view.state.tr.setMeta(columnResizingPluginKey, { setDragging: null })
|
|
@@ -55605,7 +55859,7 @@ function handleMouseDown2(view, event, cellMinWidth, defaultCellMinWidth) {
|
|
|
55605
55859
|
const pluginState2 = columnResizingPluginKey.getState(view.state);
|
|
55606
55860
|
if (!pluginState2) return;
|
|
55607
55861
|
if (pluginState2.dragging) {
|
|
55608
|
-
const dragged = draggedWidth(pluginState2.dragging, event2,
|
|
55862
|
+
const dragged = draggedWidth(pluginState2.dragging, event2, cellMinWidth2);
|
|
55609
55863
|
displayColumnWidth(
|
|
55610
55864
|
view,
|
|
55611
55865
|
pluginState2.activeHandle,
|
|
@@ -55960,6 +56214,24 @@ const Table = Node$1.create({
|
|
|
55960
56214
|
tableCellSpacing: {
|
|
55961
56215
|
default: null,
|
|
55962
56216
|
rendered: false
|
|
56217
|
+
},
|
|
56218
|
+
/**
|
|
56219
|
+
* @category Attribute
|
|
56220
|
+
* @param {TableProperties} [tableProperties] - Properties for the table.
|
|
56221
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 371-483
|
|
56222
|
+
*/
|
|
56223
|
+
tableProperties: {
|
|
56224
|
+
default: null,
|
|
56225
|
+
rendered: false
|
|
56226
|
+
},
|
|
56227
|
+
/**
|
|
56228
|
+
* @category Attribute
|
|
56229
|
+
* @param {TableGrid} [grid] - Grid definition for the table
|
|
56230
|
+
* @see {@link https://ecma-international.org/publications-and-standards/standards/ecma-376/} "Fundamentals And Markup Language Reference", page 432
|
|
56231
|
+
*/
|
|
56232
|
+
grid: {
|
|
56233
|
+
default: null,
|
|
56234
|
+
rendered: false
|
|
55963
56235
|
}
|
|
55964
56236
|
};
|
|
55965
56237
|
},
|