@json-to-office/core-docx 1.9.0 → 1.10.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 +18 -18
- package/dist/index.js.map +1 -1
- package/dist/plugin/example/index.js +16 -16
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -8647,8 +8647,8 @@ function compileComponent(component, scope) {
|
|
|
8647
8647
|
return compileStatistic(component, scope);
|
|
8648
8648
|
case "toc":
|
|
8649
8649
|
return compileToc(component, scope);
|
|
8650
|
-
case "
|
|
8651
|
-
return
|
|
8650
|
+
case "divider":
|
|
8651
|
+
return compileDivider(component, scope);
|
|
8652
8652
|
case "text-box":
|
|
8653
8653
|
return compileTextBox(component, scope);
|
|
8654
8654
|
case "columns":
|
|
@@ -9225,16 +9225,16 @@ function compileToc(component, scope) {
|
|
|
9225
9225
|
});
|
|
9226
9226
|
return blocks;
|
|
9227
9227
|
}
|
|
9228
|
-
var
|
|
9229
|
-
var
|
|
9230
|
-
var
|
|
9231
|
-
var
|
|
9228
|
+
var DEFAULT_DIVIDER_SPACING_PT = 6;
|
|
9229
|
+
var DEFAULT_DIVIDER_THICKNESS_PT = 1;
|
|
9230
|
+
var DIVIDER_LINE_TWIPS = 20;
|
|
9231
|
+
var DIVIDER_BORDER_STYLE = {
|
|
9232
9232
|
solid: "single",
|
|
9233
9233
|
dashed: "dashed",
|
|
9234
9234
|
dotted: "dotted",
|
|
9235
9235
|
double: "double"
|
|
9236
9236
|
};
|
|
9237
|
-
function
|
|
9237
|
+
function compileDivider(component, scope) {
|
|
9238
9238
|
const { ctx, path: path3 } = scope;
|
|
9239
9239
|
const props = component.props ?? {};
|
|
9240
9240
|
ctx.features.require("borders", path3);
|
|
@@ -9242,12 +9242,12 @@ function compileRule(component, scope) {
|
|
|
9242
9242
|
12,
|
|
9243
9243
|
Math.max(
|
|
9244
9244
|
0.25,
|
|
9245
|
-
typeof props.thickness === "number" && Number.isFinite(props.thickness) ? props.thickness :
|
|
9245
|
+
typeof props.thickness === "number" && Number.isFinite(props.thickness) ? props.thickness : DEFAULT_DIVIDER_THICKNESS_PT
|
|
9246
9246
|
)
|
|
9247
9247
|
);
|
|
9248
9248
|
const spacing = props.spacing ?? {};
|
|
9249
|
-
const beforePt = typeof spacing.before === "number" && Number.isFinite(spacing.before) ? spacing.before :
|
|
9250
|
-
const afterPt = typeof spacing.after === "number" && Number.isFinite(spacing.after) ? spacing.after :
|
|
9249
|
+
const beforePt = typeof spacing.before === "number" && Number.isFinite(spacing.before) ? spacing.before : DEFAULT_DIVIDER_SPACING_PT;
|
|
9250
|
+
const afterPt = typeof spacing.after === "number" && Number.isFinite(spacing.after) ? spacing.after : DEFAULT_DIVIDER_SPACING_PT;
|
|
9251
9251
|
return [
|
|
9252
9252
|
{
|
|
9253
9253
|
kind: "paragraph",
|
|
@@ -9259,13 +9259,13 @@ function compileRule(component, scope) {
|
|
|
9259
9259
|
spacing: {
|
|
9260
9260
|
beforeTwips: pointsToTwips2(beforePt),
|
|
9261
9261
|
afterTwips: pointsToTwips2(afterPt),
|
|
9262
|
-
lineTwips:
|
|
9262
|
+
lineTwips: DIVIDER_LINE_TWIPS,
|
|
9263
9263
|
lineRule: "exact"
|
|
9264
9264
|
},
|
|
9265
|
-
...
|
|
9265
|
+
...dividerIndent(props, ctx, path3),
|
|
9266
9266
|
borders: {
|
|
9267
9267
|
bottom: {
|
|
9268
|
-
style:
|
|
9268
|
+
style: DIVIDER_BORDER_STYLE[String(props.style)] ?? "single",
|
|
9269
9269
|
sizeEighthPoints: pointsToEighthPoints(thicknessPt),
|
|
9270
9270
|
color: irColor(
|
|
9271
9271
|
resolveColor(String(props.color ?? "border"), ctx.theme)
|
|
@@ -9279,7 +9279,7 @@ function compileRule(component, scope) {
|
|
|
9279
9279
|
}
|
|
9280
9280
|
];
|
|
9281
9281
|
}
|
|
9282
|
-
function
|
|
9282
|
+
function dividerIndent(props, ctx, path3) {
|
|
9283
9283
|
const width = props.width;
|
|
9284
9284
|
if (width === void 0) return {};
|
|
9285
9285
|
const page = getPageSetup(ctx.theme);
|
|
@@ -9302,8 +9302,8 @@ function ruleIndent(props, ctx, path3) {
|
|
|
9302
9302
|
if (remainder < 0) {
|
|
9303
9303
|
warnOnce(
|
|
9304
9304
|
ctx,
|
|
9305
|
-
"
|
|
9306
|
-
`
|
|
9305
|
+
"divider",
|
|
9306
|
+
`Divider width ${JSON.stringify(width)} at ${path3} is wider than the ${Math.round(measureTwips / 20)}pt text measure; it runs the full measure instead.`
|
|
9307
9307
|
);
|
|
9308
9308
|
}
|
|
9309
9309
|
return {};
|