@json-to-office/core-docx 7.3.0 → 7.3.1
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 +29 -3
- package/dist/index.js.map +1 -1
- package/dist/ir/chartValues.d.ts +7 -5
- package/dist/ir/chartValues.d.ts.map +1 -1
- package/dist/plugin/example/index.js +29 -3
- package/dist/plugin/example/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2876,12 +2876,28 @@ var init_units = __esm({
|
|
|
2876
2876
|
});
|
|
2877
2877
|
|
|
2878
2878
|
// src/ir/chartValues.ts
|
|
2879
|
+
function numericLabelValue(label) {
|
|
2880
|
+
const value = label.trim();
|
|
2881
|
+
return NUMERIC_LABEL.test(value) ? Number(value) : void 0;
|
|
2882
|
+
}
|
|
2879
2883
|
function isNumericLabel(label) {
|
|
2880
|
-
|
|
2884
|
+
const value = numericLabelValue(label);
|
|
2885
|
+
return value !== void 0 && Number.isFinite(value);
|
|
2886
|
+
}
|
|
2887
|
+
function isOutOfRangeNumericLabel(label) {
|
|
2888
|
+
const value = numericLabelValue(label);
|
|
2889
|
+
return value !== void 0 && !Number.isFinite(value);
|
|
2881
2890
|
}
|
|
2882
2891
|
function scatterX(labels, index) {
|
|
2883
2892
|
const label = labels[index];
|
|
2884
|
-
|
|
2893
|
+
const value = label === void 0 ? void 0 : numericLabelValue(label);
|
|
2894
|
+
if (value === void 0) return index + 1;
|
|
2895
|
+
if (!Number.isFinite(value)) {
|
|
2896
|
+
throw new RangeError(
|
|
2897
|
+
`Scatter x label ${JSON.stringify(label)} is not finite.`
|
|
2898
|
+
);
|
|
2899
|
+
}
|
|
2900
|
+
return value;
|
|
2885
2901
|
}
|
|
2886
2902
|
var NUMERIC_LABEL;
|
|
2887
2903
|
var init_chartValues = __esm({
|
|
@@ -12446,11 +12462,21 @@ function compileChart(component, scope) {
|
|
|
12446
12462
|
);
|
|
12447
12463
|
}
|
|
12448
12464
|
}
|
|
12465
|
+
if (props.type === "scatter") {
|
|
12466
|
+
for (const [index, entry] of series.entries()) {
|
|
12467
|
+
const at = entry.labels.findIndex(isOutOfRangeNumericLabel);
|
|
12468
|
+
if (at !== -1) {
|
|
12469
|
+
throw new Error(
|
|
12470
|
+
`Chart series "${entry.name ?? `series ${index}`}" at ${path4} has an x label ${JSON.stringify(entry.labels[at])} outside the finite number range.`
|
|
12471
|
+
);
|
|
12472
|
+
}
|
|
12473
|
+
}
|
|
12474
|
+
}
|
|
12449
12475
|
if (props.type === "scatter" && series.some((entry) => entry.labels.some((label) => !isNumericLabel(label)))) {
|
|
12450
12476
|
warnOnce(
|
|
12451
12477
|
ctx,
|
|
12452
12478
|
"chart",
|
|
12453
|
-
`Chart at ${path4} is a scatter chart whose labels are not all numbers;
|
|
12479
|
+
`Chart at ${path4} is a scatter chart whose labels are not all finite numbers; labels that do not read as finite numbers use their 1-based positions for x.`
|
|
12454
12480
|
);
|
|
12455
12481
|
}
|
|
12456
12482
|
if ((props.type === "pie" || props.type === "doughnut") && (typeof props.catAxisTitle === "string" || typeof props.valAxisTitle === "string")) {
|