@json-to-office/core-docx 2.0.0 → 2.3.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/index.js +25 -23
- package/dist/index.js.map +1 -1
- package/dist/plugin/example/index.d.ts.map +1 -1
- package/dist/plugin/example/index.js +257 -341
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/plugin/example/plugin-demo.json +16 -93
- package/dist/plugin/example/weather.component.d.ts +73 -9
- package/dist/plugin/example/weather.component.d.ts.map +1 -1
- package/dist/plugin/validation.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/plugin/example/columns-layout.component.d.ts +0 -29
- package/dist/plugin/example/columns-layout.component.d.ts.map +0 -1
- package/dist/plugin/example/eldermoor-census.component.d.ts +0 -32
- package/dist/plugin/example/eldermoor-census.component.d.ts.map +0 -1
- package/dist/plugin/example/nested-section.component.d.ts +0 -16
- package/dist/plugin/example/nested-section.component.d.ts.map +0 -1
- package/dist/plugin/example/text-space-after.component.d.ts +0 -22
- package/dist/plugin/example/text-space-after.component.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -13042,34 +13042,36 @@ function validateDocument(document, customComponents, options) {
|
|
|
13042
13042
|
const errors = [...documentResult.errors || []];
|
|
13043
13043
|
function validateComponents(components, pathPrefix = "children") {
|
|
13044
13044
|
components.forEach((componentData, index) => {
|
|
13045
|
-
|
|
13046
|
-
(cc) => cc.name === componentData.name
|
|
13047
|
-
);
|
|
13048
|
-
if (!customComponent) {
|
|
13045
|
+
if (!componentData || typeof componentData !== "object" || Array.isArray(componentData)) {
|
|
13049
13046
|
return;
|
|
13050
13047
|
}
|
|
13051
|
-
const
|
|
13052
|
-
|
|
13053
|
-
customComponent.versions,
|
|
13054
|
-
componentData.version
|
|
13055
|
-
);
|
|
13056
|
-
const validation = validateComponentProps(
|
|
13057
|
-
versionEntry,
|
|
13058
|
-
componentData.props,
|
|
13059
|
-
customComponent.name,
|
|
13060
|
-
// Reject unknown custom props unless the caller allows them.
|
|
13061
|
-
{ clean: options?.allowUnknownFields === true }
|
|
13048
|
+
const customComponent = customComponents.find(
|
|
13049
|
+
(cc) => cc.name === componentData.name
|
|
13062
13050
|
);
|
|
13063
|
-
if (
|
|
13064
|
-
const
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13051
|
+
if (customComponent) {
|
|
13052
|
+
const versionEntry = resolveComponentVersion(
|
|
13053
|
+
customComponent.name,
|
|
13054
|
+
customComponent.versions,
|
|
13055
|
+
componentData.version
|
|
13056
|
+
);
|
|
13057
|
+
const validation = validateComponentProps(
|
|
13058
|
+
versionEntry,
|
|
13059
|
+
componentData.props,
|
|
13060
|
+
customComponent.name,
|
|
13061
|
+
// Reject unknown custom props unless the caller allows them.
|
|
13062
|
+
{ clean: options?.allowUnknownFields === true }
|
|
13069
13063
|
);
|
|
13070
|
-
errors
|
|
13064
|
+
if (!validation.valid && validation.errors) {
|
|
13065
|
+
const indexedErrors = validation.errors.map(
|
|
13066
|
+
(error) => ({
|
|
13067
|
+
...error,
|
|
13068
|
+
path: `${pathPrefix}[${index}].${error.path}`
|
|
13069
|
+
})
|
|
13070
|
+
);
|
|
13071
|
+
errors.push(...indexedErrors);
|
|
13072
|
+
}
|
|
13071
13073
|
}
|
|
13072
|
-
if (
|
|
13074
|
+
if (Array.isArray(componentData.children)) {
|
|
13073
13075
|
validateComponents(
|
|
13074
13076
|
componentData.children,
|
|
13075
13077
|
`${pathPrefix}[${index}].children`
|