@json-to-office/core-docx 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/toc/index.d.ts.map +1 -1
- package/dist/core/layout.d.ts +0 -2
- package/dist/core/layout.d.ts.map +1 -1
- package/dist/core/render.d.ts.map +1 -1
- package/dist/core/structure.d.ts +0 -2
- package/dist/core/structure.d.ts.map +1 -1
- package/dist/index.js +6 -60
- package/dist/index.js.map +1 -1
- package/dist/plugin/example/index.js +72 -68
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/plugin/example/nested-section.component.d.ts.map +1 -1
- package/dist/plugin/example/plugin-demo.json +56 -4
- package/dist/templates/documents/proposal.docx.json +829 -246
- package/dist/templates/documents/technical-guide.docx.json +23 -8
- package/dist/templates/themes/index.d.ts +12 -8
- package/dist/templates/themes/index.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -2428,39 +2428,15 @@ async function extractSections(components, context) {
|
|
|
2428
2428
|
context
|
|
2429
2429
|
);
|
|
2430
2430
|
const shouldPageBreak = component.props?.pageBreak !== false;
|
|
2431
|
-
if (component.props?.title) {
|
|
2432
|
-
const headingLevel = Math.min(
|
|
2433
|
-
Math.max(component.props.level || 1, 1),
|
|
2434
|
-
6
|
|
2435
|
-
);
|
|
2436
|
-
sectionComponents.unshift(
|
|
2437
|
-
resolveComponentDefaults(
|
|
2438
|
-
{
|
|
2439
|
-
name: "heading",
|
|
2440
|
-
props: {
|
|
2441
|
-
text: component.props.title,
|
|
2442
|
-
level: headingLevel,
|
|
2443
|
-
pageBreak: shouldPageBreak,
|
|
2444
|
-
// Apply zero-spacing to prevent unwanted initial line
|
|
2445
|
-
spacing: {
|
|
2446
|
-
before: 0,
|
|
2447
|
-
after: 0
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
},
|
|
2451
|
-
context.fullTheme
|
|
2452
|
-
)
|
|
2453
|
-
);
|
|
2454
|
-
}
|
|
2455
2431
|
sections.push({
|
|
2456
|
-
title: component.props?.title,
|
|
2457
|
-
level: component.props?.level,
|
|
2458
2432
|
components: sectionComponents,
|
|
2459
2433
|
header: component.props?.header,
|
|
2460
2434
|
footer: component.props?.footer,
|
|
2461
2435
|
isExplicitSection: true,
|
|
2462
|
-
//
|
|
2463
|
-
|
|
2436
|
+
// Page break is handled at layout level (sections render no title of
|
|
2437
|
+
// their own — a visible title is an explicit heading child; the
|
|
2438
|
+
// authoring label lives in props.meta.title and is never rendered)
|
|
2439
|
+
pageBreak: shouldPageBreak,
|
|
2464
2440
|
// Preserve page configuration override if present
|
|
2465
2441
|
page: component.props?.page
|
|
2466
2442
|
});
|
|
@@ -2485,29 +2461,6 @@ async function flattenComponents(components, context) {
|
|
|
2485
2461
|
children: await flattenComponents(component.children, context)
|
|
2486
2462
|
});
|
|
2487
2463
|
} else if (isSectionComponent(component) && component.children) {
|
|
2488
|
-
if (component.props?.title) {
|
|
2489
|
-
const headingLevel = Math.min(
|
|
2490
|
-
Math.max(component.props.level || 1, 1),
|
|
2491
|
-
6
|
|
2492
|
-
);
|
|
2493
|
-
flattened.push(
|
|
2494
|
-
resolveComponentDefaults(
|
|
2495
|
-
{
|
|
2496
|
-
name: "heading",
|
|
2497
|
-
props: {
|
|
2498
|
-
text: component.props.title,
|
|
2499
|
-
level: headingLevel,
|
|
2500
|
-
// Apply zero-spacing to prevent unwanted initial line
|
|
2501
|
-
spacing: {
|
|
2502
|
-
before: 0,
|
|
2503
|
-
after: 0
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
},
|
|
2507
|
-
context.fullTheme
|
|
2508
|
-
)
|
|
2509
|
-
);
|
|
2510
|
-
}
|
|
2511
2464
|
flattened.push(...await flattenComponents(component.children, context));
|
|
2512
2465
|
} else {
|
|
2513
2466
|
flattened.push(component);
|
|
@@ -2570,7 +2523,6 @@ function applyLayout(sections, theme, themeName) {
|
|
|
2570
2523
|
footer: section.footer,
|
|
2571
2524
|
isUserSection: isSourceUserSection,
|
|
2572
2525
|
belongsToUserSection: isSourceUserSection,
|
|
2573
|
-
sectionTitleLevel: section.level,
|
|
2574
2526
|
pageOverride: section.page
|
|
2575
2527
|
});
|
|
2576
2528
|
continue;
|
|
@@ -2605,8 +2557,6 @@ function applyLayout(sections, theme, themeName) {
|
|
|
2605
2557
|
// at the start of column content.
|
|
2606
2558
|
isUserSection: isSourceUserSection && j === 0,
|
|
2607
2559
|
belongsToUserSection: isSourceUserSection,
|
|
2608
|
-
// Pass section title level for TOC scoping
|
|
2609
|
-
sectionTitleLevel: section.level,
|
|
2610
2560
|
// Pass page override for this section
|
|
2611
2561
|
pageOverride: section.page
|
|
2612
2562
|
});
|
|
@@ -6977,8 +6927,6 @@ function renderTocComponent(component, theme, context) {
|
|
|
6977
6927
|
);
|
|
6978
6928
|
}
|
|
6979
6929
|
const stylesWithLevels = [];
|
|
6980
|
-
const sectionTitleLevel = context?.section?.sectionTitleLevel;
|
|
6981
|
-
const startLevel = effectiveScope === "section" && sectionTitleLevel ? sectionTitleLevel : 0;
|
|
6982
6930
|
if (componentProps.styles && componentProps.styles.length > 0) {
|
|
6983
6931
|
for (const styleMapping of componentProps.styles) {
|
|
6984
6932
|
const styleId = styleMapping.styleId;
|
|
@@ -6989,7 +6937,7 @@ function renderTocComponent(component, theme, context) {
|
|
|
6989
6937
|
);
|
|
6990
6938
|
}
|
|
6991
6939
|
}
|
|
6992
|
-
const effectiveDepthStart =
|
|
6940
|
+
const effectiveDepthStart = depthStart;
|
|
6993
6941
|
const effectiveDepthEnd = depthEnd;
|
|
6994
6942
|
const tocOptions = {
|
|
6995
6943
|
hyperlink: true,
|
|
@@ -7868,9 +7816,7 @@ async function renderSection(section, theme, themeName, context, sectionOrdinal,
|
|
|
7868
7816
|
currentLayout: section.layoutType,
|
|
7869
7817
|
columnCount: section.properties.column?.count || 1,
|
|
7870
7818
|
// Always pass the same bookmark ID for all layout chunks of the same section
|
|
7871
|
-
sectionBookmarkId
|
|
7872
|
-
// Pass section title level for TOC scoping (excludes section title from its own TOC)
|
|
7873
|
-
sectionTitleLevel: section.sectionTitleLevel
|
|
7819
|
+
sectionBookmarkId
|
|
7874
7820
|
}
|
|
7875
7821
|
};
|
|
7876
7822
|
if (sectionBookmarkId && isFirstLayoutOfUserSection && sharedLinkId !== void 0) {
|
|
@@ -8801,10 +8747,13 @@ var nestedSectionsComponent = createComponent({
|
|
|
8801
8747
|
components.push({
|
|
8802
8748
|
name: "section",
|
|
8803
8749
|
props: {
|
|
8804
|
-
title: "First level 1 section"
|
|
8805
|
-
level: 1
|
|
8750
|
+
meta: { title: "First level 1 section" }
|
|
8806
8751
|
},
|
|
8807
8752
|
children: [
|
|
8753
|
+
{
|
|
8754
|
+
name: "heading",
|
|
8755
|
+
props: { text: "First level 1 section", level: 1 }
|
|
8756
|
+
},
|
|
8808
8757
|
{
|
|
8809
8758
|
name: "heading",
|
|
8810
8759
|
props: {
|
|
@@ -8836,10 +8785,13 @@ var nestedSectionsComponent = createComponent({
|
|
|
8836
8785
|
components.push({
|
|
8837
8786
|
name: "section",
|
|
8838
8787
|
props: {
|
|
8839
|
-
title: "Second level 1 section"
|
|
8840
|
-
level: 1
|
|
8788
|
+
meta: { title: "Second level 1 section" }
|
|
8841
8789
|
},
|
|
8842
8790
|
children: [
|
|
8791
|
+
{
|
|
8792
|
+
name: "heading",
|
|
8793
|
+
props: { text: "Second level 1 section", level: 1 }
|
|
8794
|
+
},
|
|
8843
8795
|
{
|
|
8844
8796
|
name: "heading",
|
|
8845
8797
|
props: {
|
|
@@ -8883,9 +8835,22 @@ var plugin_demo_default = {
|
|
|
8883
8835
|
{
|
|
8884
8836
|
name: "section",
|
|
8885
8837
|
props: {
|
|
8886
|
-
|
|
8838
|
+
meta: {
|
|
8839
|
+
title: "Weather Information"
|
|
8840
|
+
}
|
|
8887
8841
|
},
|
|
8888
8842
|
children: [
|
|
8843
|
+
{
|
|
8844
|
+
name: "heading",
|
|
8845
|
+
props: {
|
|
8846
|
+
text: "Weather Information",
|
|
8847
|
+
level: 1,
|
|
8848
|
+
spacing: {
|
|
8849
|
+
before: 0,
|
|
8850
|
+
after: 0
|
|
8851
|
+
}
|
|
8852
|
+
}
|
|
8853
|
+
},
|
|
8889
8854
|
{
|
|
8890
8855
|
name: "paragraph",
|
|
8891
8856
|
props: {
|
|
@@ -8913,9 +8878,22 @@ var plugin_demo_default = {
|
|
|
8913
8878
|
{
|
|
8914
8879
|
name: "section",
|
|
8915
8880
|
props: {
|
|
8916
|
-
|
|
8881
|
+
meta: {
|
|
8882
|
+
title: "Sales Data"
|
|
8883
|
+
}
|
|
8917
8884
|
},
|
|
8918
8885
|
children: [
|
|
8886
|
+
{
|
|
8887
|
+
name: "heading",
|
|
8888
|
+
props: {
|
|
8889
|
+
text: "Sales Data",
|
|
8890
|
+
level: 1,
|
|
8891
|
+
spacing: {
|
|
8892
|
+
before: 0,
|
|
8893
|
+
after: 0
|
|
8894
|
+
}
|
|
8895
|
+
}
|
|
8896
|
+
},
|
|
8919
8897
|
{
|
|
8920
8898
|
name: "paragraph",
|
|
8921
8899
|
props: {
|
|
@@ -8936,9 +8914,22 @@ var plugin_demo_default = {
|
|
|
8936
8914
|
{
|
|
8937
8915
|
name: "section",
|
|
8938
8916
|
props: {
|
|
8939
|
-
|
|
8917
|
+
meta: {
|
|
8918
|
+
title: "Quick Links"
|
|
8919
|
+
}
|
|
8940
8920
|
},
|
|
8941
8921
|
children: [
|
|
8922
|
+
{
|
|
8923
|
+
name: "heading",
|
|
8924
|
+
props: {
|
|
8925
|
+
text: "Quick Links",
|
|
8926
|
+
level: 1,
|
|
8927
|
+
spacing: {
|
|
8928
|
+
before: 0,
|
|
8929
|
+
after: 0
|
|
8930
|
+
}
|
|
8931
|
+
}
|
|
8932
|
+
},
|
|
8942
8933
|
{
|
|
8943
8934
|
name: "paragraph",
|
|
8944
8935
|
props: {
|
|
@@ -8950,9 +8941,22 @@ var plugin_demo_default = {
|
|
|
8950
8941
|
{
|
|
8951
8942
|
name: "section",
|
|
8952
8943
|
props: {
|
|
8953
|
-
|
|
8944
|
+
meta: {
|
|
8945
|
+
title: "More Data Examples"
|
|
8946
|
+
}
|
|
8954
8947
|
},
|
|
8955
8948
|
children: [
|
|
8949
|
+
{
|
|
8950
|
+
name: "heading",
|
|
8951
|
+
props: {
|
|
8952
|
+
text: "More Data Examples",
|
|
8953
|
+
level: 1,
|
|
8954
|
+
spacing: {
|
|
8955
|
+
before: 0,
|
|
8956
|
+
after: 0
|
|
8957
|
+
}
|
|
8958
|
+
}
|
|
8959
|
+
},
|
|
8956
8960
|
{
|
|
8957
8961
|
name: "dataTable",
|
|
8958
8962
|
props: {
|