@silurus/ooxml 0.50.0 → 0.51.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/README.md +8 -4
- package/dist/bridge-BFwyMqvY.js +228 -0
- package/dist/{docx-BmrIhf6p.js → docx-DtI9YHuK.js} +33 -33
- package/dist/docx.mjs +2 -2
- package/dist/index.mjs +3 -3
- package/dist/{pptx-DefKBJxp.js → pptx-BlOPRzOV.js} +114 -114
- package/dist/pptx.mjs +2 -2
- package/dist/{mathml-B58AKtQj.js → preset-D4KAeT8N.js} +1 -113
- package/dist/{renderer-CeHKK7PX.js → renderer-Brm7AGnm.js} +99 -99
- package/dist/types/index.d.ts +31 -2
- package/dist/types/xlsx.d.ts +164 -2
- package/dist/xlsx-DjYv5qgM.js +3444 -0
- package/dist/xlsx.mjs +2 -2
- package/package.json +1 -1
- package/dist/bridge-jB4wAQWt.js +0 -116
- package/dist/xlsx-BO-a3nOm.js +0 -3332
|
@@ -1273,116 +1273,4 @@ function m(e, t, n, r, i, a, o = null, s = null, c = null, l = null) {
|
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
1275
|
//#endregion
|
|
1276
|
-
|
|
1277
|
-
var h = {
|
|
1278
|
-
"&": "&",
|
|
1279
|
-
"<": "<",
|
|
1280
|
-
">": ">",
|
|
1281
|
-
"\"": """
|
|
1282
|
-
}, g = (e) => e.replace(/[&<>"]/g, (e) => h[e]);
|
|
1283
|
-
function _(e) {
|
|
1284
|
-
switch (e) {
|
|
1285
|
-
case "roman": return "normal";
|
|
1286
|
-
case "bold": return "bold";
|
|
1287
|
-
case "boldItalic": return "bold-italic";
|
|
1288
|
-
case "italic": return null;
|
|
1289
|
-
}
|
|
1290
|
-
}
|
|
1291
|
-
var v = new Set([..."⏞⏟⎴⎵︷︸⏜⏝{}[]()¯_‾"]), y = "+−±∓×÷·∗⋅∘∙*/", b = "=≠<>≤≥≈≡∼≅≃→←↔⇒∈∉⊂⊆⊃⊇∝≪≫⊥≔", x = "([{⟨⌈⌊", S = ")]}⟩⌉⌋", C = ",;";
|
|
1292
|
-
function w(e, t) {
|
|
1293
|
-
let n = _(t), r = n ? ` mathvariant="${n}"` : "", i = "", a = "", o = () => {
|
|
1294
|
-
a &&= (i += `<mn${r}>${g(a)}</mn>`, "");
|
|
1295
|
-
};
|
|
1296
|
-
for (let t of e) {
|
|
1297
|
-
if (t === " ") {
|
|
1298
|
-
o();
|
|
1299
|
-
continue;
|
|
1300
|
-
}
|
|
1301
|
-
if (t >= "0" && t <= "9") {
|
|
1302
|
-
a += t;
|
|
1303
|
-
continue;
|
|
1304
|
-
}
|
|
1305
|
-
o(), y.includes(t) || b.includes(t) || C.includes(t) ? i += `<mo>${g(t)}</mo>` : x.includes(t) || S.includes(t) ? i += `<mo fence="true" stretchy="false">${g(t)}</mo>` : i += `<mi${r}>${g(t)}</mi>`;
|
|
1306
|
-
}
|
|
1307
|
-
return o(), i;
|
|
1308
|
-
}
|
|
1309
|
-
function T(e) {
|
|
1310
|
-
return e.map(D).join("");
|
|
1311
|
-
}
|
|
1312
|
-
function E(e) {
|
|
1313
|
-
return `<mrow>${T(e)}</mrow>`;
|
|
1314
|
-
}
|
|
1315
|
-
function D(e) {
|
|
1316
|
-
switch (e.kind) {
|
|
1317
|
-
case "run": return w(e.text, e.style);
|
|
1318
|
-
case "group": return E(e.items);
|
|
1319
|
-
case "fraction": return `<mfrac${e.bar === !1 ? " linethickness=\"0\"" : ""}>${E(e.num)}${E(e.den)}</mfrac>`;
|
|
1320
|
-
case "sup": return `<msup>${E(e.base)}${E(e.sup ?? [])}</msup>`;
|
|
1321
|
-
case "sub": return `<msub>${E(e.base)}${E(e.sub ?? [])}</msub>`;
|
|
1322
|
-
case "subSup": return `<msubsup>${E(e.base)}${E(e.sub ?? [])}${E(e.sup ?? [])}</msubsup>`;
|
|
1323
|
-
case "nary": return P(e);
|
|
1324
|
-
case "delimiter": return F(e);
|
|
1325
|
-
case "radical": return e.index && e.index.length ? `<mroot>${E(e.radicand)}${E(e.index)}</mroot>` : `<msqrt>${T(e.radicand)}</msqrt>`;
|
|
1326
|
-
case "limit": return j(e);
|
|
1327
|
-
case "array": return M(e);
|
|
1328
|
-
case "groupChr": {
|
|
1329
|
-
let t = E(e.base), n = v.has(e.char), r = e.pos === "top" ? "mover" : "munder", i = `<mo stretchy="${n}">${g(e.char)}</mo>`;
|
|
1330
|
-
return n ? `<${r}>${t}${i}</${r}>` : `<${r} accent="true">${t}${i}</${r}>`;
|
|
1331
|
-
}
|
|
1332
|
-
case "bar": {
|
|
1333
|
-
let t = E(e.base), n = "<mo stretchy=\"true\">―</mo>";
|
|
1334
|
-
return e.pos === "bot" ? `<munder>${t}${n}</munder>` : `<mover>${t}${n}</mover>`;
|
|
1335
|
-
}
|
|
1336
|
-
case "accent": return A(e);
|
|
1337
|
-
case "func": return `<mrow>${E(e.name)}<mo>⁡</mo>${E(e.arg)}</mrow>`;
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
var O = {
|
|
1341
|
-
"̀": "`",
|
|
1342
|
-
"́": "´",
|
|
1343
|
-
"̂": "^",
|
|
1344
|
-
"̃": "~",
|
|
1345
|
-
"̆": "˘",
|
|
1346
|
-
"̇": "˙",
|
|
1347
|
-
"̈": "¨",
|
|
1348
|
-
"̌": "ˇ",
|
|
1349
|
-
"⃗": "→",
|
|
1350
|
-
"⃖": "←"
|
|
1351
|
-
}, k = new Set([
|
|
1352
|
-
"̅",
|
|
1353
|
-
"̄",
|
|
1354
|
-
"¯",
|
|
1355
|
-
"‾",
|
|
1356
|
-
"̲",
|
|
1357
|
-
"̳"
|
|
1358
|
-
]);
|
|
1359
|
-
function A(e) {
|
|
1360
|
-
let t = E(e.base);
|
|
1361
|
-
if (k.has(e.char)) return `<mover>${t}<mo stretchy="true">―</mo></mover>`;
|
|
1362
|
-
let n = O[e.char] ?? e.char;
|
|
1363
|
-
return `<mover accent="true">${t}<mo stretchy="${n === "→" || n === "←" ? "true" : "false"}">${g(n)}</mo></mover>`;
|
|
1364
|
-
}
|
|
1365
|
-
function j(e) {
|
|
1366
|
-
let t = E(e.base), n = e.lower && e.lower.length ? E(e.lower) : null, r = e.upper && e.upper.length ? E(e.upper) : null;
|
|
1367
|
-
return n && r ? `<munderover>${t}${n}${r}</munderover>` : n ? `<munder>${t}${n}</munder>` : r ? `<mover>${t}${r}</mover>` : t;
|
|
1368
|
-
}
|
|
1369
|
-
function M(e) {
|
|
1370
|
-
let t = Math.max(1, ...e.rows.map((e) => e.length)), n;
|
|
1371
|
-
n = e.align === "eq" ? Array.from({ length: t }, (e, t) => t % 2 == 0 ? "right" : "left").join(" ") : e.align === "left" ? "left" : "center";
|
|
1372
|
-
let r = e.rows.map((e) => `<mtr>${e.map((e) => `<mtd>${T(e)}</mtd>`).join("")}</mtr>`).join("");
|
|
1373
|
-
return `<mtable columnalign="${n}" rowspacing="0.2em" columnspacing="0.3em">${r}</mtable>`;
|
|
1374
|
-
}
|
|
1375
|
-
var N = new Set([..."∫∬∭∮∯∰∱∲∳⨌⨍⨎⨏⨐⨑⨒⨓⨔⨕⨖⨗"]);
|
|
1376
|
-
function P(e) {
|
|
1377
|
-
let t = e.limLoc === "subSup" ? !0 : e.limLoc === "undOvr" ? !1 : N.has(e.op), n = `<mo largeop="true">${g(e.op)}</mo>`, r = e.sub ?? [], i = e.sup ?? [], a;
|
|
1378
|
-
return a = t ? r.length && i.length ? `<msubsup>${n}${E(r)}${E(i)}</msubsup>` : r.length ? `<msub>${n}${E(r)}</msub>` : i.length ? `<msup>${n}${E(i)}</msup>` : n : r.length && i.length ? `<munderover>${n}${E(r)}${E(i)}</munderover>` : r.length ? `<munder>${n}${E(r)}</munder>` : i.length ? `<mover>${n}${E(i)}</mover>` : n, `<mrow>${a}${T(e.body)}</mrow>`;
|
|
1379
|
-
}
|
|
1380
|
-
function F(e) {
|
|
1381
|
-
let t = (e) => `<mo fence="true" stretchy="true">${g(e)}</mo>`, n = e.items.map((e) => E(e)).join("<mo separator=\"true\">,</mo>");
|
|
1382
|
-
return `<mrow>${t(e.begChar)}${n}${t(e.endChar)}</mrow>`;
|
|
1383
|
-
}
|
|
1384
|
-
function I(e, t) {
|
|
1385
|
-
return `<math xmlns="http://www.w3.org/1998/Math/MathML" display="${t ? "block" : "inline"}">${T(e)}</math>`;
|
|
1386
|
-
}
|
|
1387
|
-
//#endregion
|
|
1388
|
-
export { o as a, a as i, m as n, e as o, u as r, I as t };
|
|
1276
|
+
export { e as a, o as i, u as n, a as r, m as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as e, o as t } from "./bridge-BFwyMqvY.js";
|
|
2
2
|
//#region packages/core/src/chart/axis-scale.ts
|
|
3
3
|
function n(e, t = 5) {
|
|
4
4
|
if (e === 0) return 1;
|
|
@@ -332,7 +332,7 @@ function D(e, t, n, r, i, a, o, s, c) {
|
|
|
332
332
|
l === "inBase" ? (e.textAlign = "left", e.textBaseline = "middle", e.fillText(t, n + 4, o)) : l === "inEnd" ? (e.textAlign = "right", e.textBaseline = "middle", e.fillText(t, n + i - 4, o)) : l === "ctr" ? (e.textAlign = "center", e.textBaseline = "middle", e.fillText(t, n + i / 2, o)) : (e.textAlign = "left", e.textBaseline = "middle", e.fillText(t, n + i + 2, o));
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
function O(
|
|
335
|
+
function O(t, i, a, s) {
|
|
336
336
|
let { x: c, y: l, w: u, h: d } = a, f = i.chartType === "clusteredBarH" || i.chartType === "stackedBarH" || i.chartType === "stackedBarHPct", m = i.chartType.startsWith("stacked"), h = i.chartType === "stackedBarPct" || i.chartType === "stackedBarHPct", _ = i.series.filter((e) => e.seriesType !== "line"), v = i.series.filter((e) => e.seriesType === "line"), y = E(i), S = y.length;
|
|
337
337
|
if (S === 0) return;
|
|
338
338
|
let w = i.title ? C(i, d, s) : 0, O = i.title ? d * .02 : 0, k = i.title ? d * .025 : 0, A = i.title ? w + O + k : 0, j = b(i, u, d), M = j?.side === "r" ? j.reserveW : 0, N = j?.side === "l" ? j.reserveW : 0, P = j?.side === "t" ? j.reserveH : 0, F = j?.side === "b" ? j.reserveH : 0, I = Math.max(8, Math.min(10, d * .045)), L = i.catAxisTitle ? I + 4 : 0, R = i.valAxisTitle ? I + 4 : 0, z = {
|
|
@@ -341,10 +341,10 @@ function O(e, i, a, s) {
|
|
|
341
341
|
b: d * .14 + L + F,
|
|
342
342
|
l: u * .12 + R + N
|
|
343
343
|
};
|
|
344
|
-
f && (z.l = (i.catAxisHidden ? u * .03 : u * .22) + R + N, z.b = (i.valAxisHidden ? d * .02 : d * .08) + L + F), T(
|
|
344
|
+
f && (z.l = (i.catAxisHidden ? u * .03 : u * .22) + R + N, z.b = (i.valAxisHidden ? d * .02 : d * .08) + L + F), T(t, i, c, l + O, u, w);
|
|
345
345
|
let B = i.plotAreaManualLayout, V, H, U, W;
|
|
346
346
|
if (B && B.w != null && B.h != null ? (V = c + B.x * u, H = l + B.y * d, U = B.w * u, W = B.h * d) : (V = c + z.l, H = l + z.t, U = u - z.l - z.r, W = d - z.t - z.b), U <= 0 || W <= 0) return;
|
|
347
|
-
i.plotAreaBg && (
|
|
347
|
+
i.plotAreaBg && (t.fillStyle = `#${i.plotAreaBg}`, t.fillRect(V, H, U, W));
|
|
348
348
|
let G = 0;
|
|
349
349
|
for (let e = 0; e < S; e++) {
|
|
350
350
|
let t = 0;
|
|
@@ -356,76 +356,76 @@ function O(e, i, a, s) {
|
|
|
356
356
|
}
|
|
357
357
|
h && (G = 100), i.valMax != null && (G = i.valMax), G === 0 && (G = 1);
|
|
358
358
|
let K = n(G), q = i.valMax ?? r(G, K), J = "#e0e0e0", Y = Math.round(q / K);
|
|
359
|
-
if (
|
|
360
|
-
let n =
|
|
359
|
+
if (t.textBaseline = "middle", t.font = `${Math.max(8, Math.min(11, W / 20))}px sans-serif`, t.fillStyle = i.valAxisFontColor ? `#${i.valAxisFontColor}` : "#555", !i.valAxisHidden) for (let e = 0; e <= Y; e++) {
|
|
360
|
+
let n = e * K, r = h ? `${Math.round(n)}%` : o(n, i.valAxisFormatCode);
|
|
361
361
|
if (f) {
|
|
362
362
|
let i = V + n / q * U;
|
|
363
|
-
|
|
363
|
+
t.strokeStyle = e === 0 ? "#aaa" : J, t.lineWidth = e === 0 ? 1 : .5, t.beginPath(), t.moveTo(i, H), t.lineTo(i, H + W), t.stroke(), t.textAlign = "center", t.fillText(r, i, H + W + 10);
|
|
364
364
|
} else {
|
|
365
365
|
let i = H + W - n / q * W;
|
|
366
|
-
|
|
366
|
+
t.strokeStyle = e === 0 ? "#aaa" : J, t.lineWidth = e === 0 ? 1 : .5, t.beginPath(), t.moveTo(V, i), t.lineTo(V + U, i), t.stroke(), t.textAlign = "right", t.fillText(r, V - 4, i);
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
let X = i.catAxisLineColor ? `#${i.catAxisLineColor}` : "#aaa", ee = i.valAxisLineColor ? `#${i.valAxisLineColor}` : "#aaa", Z = i.catAxisLineWidthEmu ? Math.max(.5, i.catAxisLineWidthEmu /
|
|
370
|
-
|
|
369
|
+
let X = i.catAxisLineColor ? `#${i.catAxisLineColor}` : "#aaa", ee = i.valAxisLineColor ? `#${i.valAxisLineColor}` : "#aaa", Z = i.catAxisLineWidthEmu ? Math.max(.5, i.catAxisLineWidthEmu / e) : 1, te = i.valAxisLineWidthEmu ? Math.max(.5, i.valAxisLineWidthEmu / e) : 1, ne = (e, n, r, i, a, o) => {
|
|
370
|
+
t.strokeStyle = a, t.lineWidth = o, t.beginPath(), t.moveTo(e, n), t.lineTo(r, i), t.stroke();
|
|
371
371
|
}, re = !i.catAxisHidden && !i.catAxisLineHidden, ie = !i.valAxisHidden && !i.valAxisLineHidden && i.valAxisLineColor != null;
|
|
372
372
|
f ? (re && ne(V, H, V, H + W, X, Z), ie && ne(V, H + W, V + U, H + W, ee, te)) : (re && ne(V, H + W, V + U, H + W, X, Z), ie && ne(V, H, V, H + W, ee, te));
|
|
373
373
|
let Q = f ? W / S : U / S, ae = m ? 1 : Math.max(1, _.length), oe = m ? 0 : i.barOverlap ?? 0, se = i.barGapWidth ?? 150, $ = Q / (1 + (ae - 1) * (1 - oe / 100) + se / 100), ce = m ? 0 : $ * (1 - oe / 100), le = (Q - ($ + (ae - 1) * ce)) / 2;
|
|
374
|
-
for (let
|
|
374
|
+
for (let e = 0; e < S; e++) {
|
|
375
375
|
let n = 0, r = 0;
|
|
376
376
|
if (h) {
|
|
377
|
-
for (let
|
|
377
|
+
for (let t of _) r += Math.abs(t.values[e] ?? 0);
|
|
378
378
|
r === 0 && (r = 1);
|
|
379
379
|
}
|
|
380
380
|
for (let a = 0; a < _.length; a++) {
|
|
381
|
-
let c = _[a], l = c.values[
|
|
381
|
+
let c = _[a], l = c.values[e] ?? 0, u = h ? Math.abs(l) / r * 100 : Math.abs(l), d = p(a, c);
|
|
382
382
|
if (f) {
|
|
383
|
-
let r = m ? a : _.length - 1 - a, l = m ? H + (S - 1 -
|
|
384
|
-
|
|
383
|
+
let r = m ? a : _.length - 1 - a, l = m ? H + (S - 1 - e) * Q + le : H + (S - 1 - e) * Q + le + r * ce, f = u / q * U, p = m ? V + n / q * U : V;
|
|
384
|
+
t.fillStyle = d, t.fillRect(p, l, f, $), i.showDataLabels && u > 0 && (t.font = `bold ${i.dataLabelFontSizeHpt ? i.dataLabelFontSizeHpt / 100 * s : Math.max(7, Math.min(11, $ * .6))}px sans-serif`, D(t, h ? `${Math.round(u)}%` : o(u, i.dataLabelFormatCode ?? c.valFormatCode ?? null), p, l, f, $, "horizontal", i.dataLabelPosition ?? null, c.labelColor ?? i.dataLabelFontColor ?? null));
|
|
385
385
|
} else {
|
|
386
|
-
let r = m ? V +
|
|
387
|
-
|
|
386
|
+
let r = m ? V + e * Q + le : V + e * Q + le + a * ce, l = u / q * W, f = H + W - (m ? n + u : u) / q * W;
|
|
387
|
+
t.fillStyle = d, t.fillRect(r, f, $, l), i.showDataLabels && u > 0 && (t.font = `bold ${i.dataLabelFontSizeHpt ? i.dataLabelFontSizeHpt / 100 * s : Math.max(7, Math.min(11, $ * .6))}px sans-serif`, D(t, h ? `${Math.round(u)}%` : o(u, i.dataLabelFormatCode ?? c.valFormatCode ?? null), r, f, l, $, "vertical", i.dataLabelPosition ?? null, c.labelColor ?? i.dataLabelFontColor ?? null));
|
|
388
388
|
}
|
|
389
389
|
m && (n += u);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
if (!i.catAxisHidden) {
|
|
393
|
-
|
|
394
|
-
for (let
|
|
395
|
-
let n = (y[
|
|
393
|
+
t.fillStyle = i.catAxisFontColor ? `#${i.catAxisFontColor}` : "#555", t.font = `${Math.max(8, Math.min(11, Q * .5))}px sans-serif`;
|
|
394
|
+
for (let e = 0; e < S; e++) {
|
|
395
|
+
let n = (y[e] ?? "").toString().slice(0, 12);
|
|
396
396
|
if (f) {
|
|
397
|
-
let r = H + (S - 1 -
|
|
398
|
-
|
|
397
|
+
let r = H + (S - 1 - e) * Q + Q / 2;
|
|
398
|
+
t.textAlign = "right", t.textBaseline = "middle", t.fillText(n, V - 4, r);
|
|
399
399
|
} else {
|
|
400
|
-
let r = V +
|
|
401
|
-
|
|
400
|
+
let r = V + e * Q + Q / 2;
|
|
401
|
+
t.textAlign = "center", t.textBaseline = "top", t.fillText(n, r, H + W + 3);
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
if (v.length > 0 && !f) for (let
|
|
406
|
-
let n = v[
|
|
407
|
-
|
|
405
|
+
if (v.length > 0 && !f) for (let e = 0; e < v.length; e++) {
|
|
406
|
+
let n = v[e], r = p(_.length + e, n);
|
|
407
|
+
t.strokeStyle = r, t.lineWidth = 2, t.setLineDash([]), t.beginPath();
|
|
408
408
|
let i = !1;
|
|
409
|
-
for (let
|
|
410
|
-
let r = n.values[
|
|
409
|
+
for (let e = 0; e < S; e++) {
|
|
410
|
+
let r = n.values[e];
|
|
411
411
|
if (r == null) {
|
|
412
412
|
i = !1;
|
|
413
413
|
continue;
|
|
414
414
|
}
|
|
415
|
-
let a = V +
|
|
416
|
-
i ?
|
|
415
|
+
let a = V + e * Q + Q / 2, o = H + W - r / q * W;
|
|
416
|
+
i ? t.lineTo(a, o) : (t.moveTo(a, o), i = !0);
|
|
417
417
|
}
|
|
418
|
-
if (
|
|
419
|
-
let i = n.values[
|
|
418
|
+
if (t.stroke(), n.showMarker !== !1) for (let e = 0; e < S; e++) {
|
|
419
|
+
let i = n.values[e];
|
|
420
420
|
if (i == null) continue;
|
|
421
|
-
let a = V +
|
|
422
|
-
|
|
421
|
+
let a = V + e * Q + Q / 2, o = H + W - i / q * W;
|
|
422
|
+
t.fillStyle = r, t.beginPath(), t.arc(a, o, 3, 0, Math.PI * 2), t.fill();
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
x(
|
|
425
|
+
x(t, f && !m ? {
|
|
426
426
|
...i,
|
|
427
427
|
series: [...i.series].reverse()
|
|
428
|
-
} : i, j, c, l, u, d, V, H, U, W, A + 2), i.catAxisTitle && g(
|
|
428
|
+
} : i, j, c, l, u, d, V, H, U, W, A + 2), i.catAxisTitle && g(t, i.catAxisTitle, V, H, U, W, "cat", I), i.valAxisTitle && g(t, i.valAxisTitle, V, H, U, W, "val", I);
|
|
429
429
|
}
|
|
430
430
|
function k(e, t, s, c) {
|
|
431
431
|
let { x: l, y: u, w: d, h: f } = s, m = E(t), h = m.length;
|
|
@@ -648,11 +648,11 @@ function M(e, t, i, o) {
|
|
|
648
648
|
}
|
|
649
649
|
x(e, t, y, s, c, l, u, M - A / 2, N - j / 2, A, j, v + 2);
|
|
650
650
|
}
|
|
651
|
-
function N(
|
|
651
|
+
function N(t, r, i, a) {
|
|
652
652
|
let { x: s, y: c, w: l, h: u } = i, d = r.title ? C(r, u, a) : 0, f = r.title ? u * .035 : 0, m = r.title ? u * .035 : 0, h = r.title ? d + f + m : 0, _ = b(r, l, u), v = _?.side === "r" ? _.reserveW : 0, y = _?.side === "l" ? _.reserveW : 0, w = _?.side === "t" ? _.reserveH : 0, E = _?.side === "b" ? _.reserveH : 0, D = Math.max(8, Math.min(10, u * .045)), O = r.catAxisTitle ? D + 4 : 0, k = r.valAxisTitle ? D + 4 : 0;
|
|
653
653
|
if (r.title) {
|
|
654
|
-
let
|
|
655
|
-
|
|
654
|
+
let e = r.titleManualLayout;
|
|
655
|
+
e && (e.x !== void 0 || e.y !== void 0) ? T(t, r, s + e.x * l, c + e.y * u, (e.w ?? .5) * l, d) : T(t, r, s, c + f, l, d);
|
|
656
656
|
}
|
|
657
657
|
let A = r.plotAreaManualLayout, j, M, N, L;
|
|
658
658
|
if (A && A.w != null && A.h != null) j = s + A.x * l, M = c + A.y * u, N = A.w * l, L = A.h * u;
|
|
@@ -666,7 +666,7 @@ function N(e, r, i, a) {
|
|
|
666
666
|
j = s + e.l, M = c + e.t, N = l - e.l - e.r, L = u - e.t - e.b;
|
|
667
667
|
}
|
|
668
668
|
if (N <= 0 || L <= 0) return;
|
|
669
|
-
r.plotAreaBg && (
|
|
669
|
+
r.plotAreaBg && (t.fillStyle = `#${r.plotAreaBg}`, t.fillRect(j, M, N, L));
|
|
670
670
|
let z = [], B = [];
|
|
671
671
|
for (let e of r.series) {
|
|
672
672
|
let t = e.categories ?? [];
|
|
@@ -689,15 +689,15 @@ function N(e, r, i, a) {
|
|
|
689
689
|
let K = (e) => j + (e - H) / (U - H) * N, q = (e) => M + L - (e - W) / (G - W) * L;
|
|
690
690
|
if (!r.valAxisHidden) {
|
|
691
691
|
let i = Math.max(8, Math.min(11, L / 20));
|
|
692
|
-
|
|
692
|
+
t.font = `${r.valAxisFontBold ? "bold " : ""}${i}px sans-serif`;
|
|
693
693
|
let a = n(G - W), s = Math.round((G - W) / a) + 1;
|
|
694
694
|
for (let n = 0; n < s; n++) {
|
|
695
695
|
let i = W + n * a;
|
|
696
696
|
if (i > G + a * .01) break;
|
|
697
697
|
let s = q(i);
|
|
698
|
-
|
|
699
|
-
let c = r.valAxisLineColor ? `#${r.valAxisLineColor}` : void 0, l = r.valAxisLineWidthEmu ? Math.max(.5, r.valAxisLineWidthEmu /
|
|
700
|
-
S(
|
|
698
|
+
t.strokeStyle = "#e0e0e0", t.lineWidth = .5, t.beginPath(), t.moveTo(j, s), t.lineTo(j + N, s), t.stroke(), t.fillStyle = "#555", t.textAlign = "right", t.textBaseline = "middle", t.fillText(o(i, r.valAxisFormatCode), j - 4, s);
|
|
699
|
+
let c = r.valAxisLineColor ? `#${r.valAxisLineColor}` : void 0, l = r.valAxisLineWidthEmu ? Math.max(.5, r.valAxisLineWidthEmu / e) : void 0;
|
|
700
|
+
S(t, r.valAxisMajorTickMark, "val", j, s, c, l);
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
703
|
let J = M + L;
|
|
@@ -706,49 +706,49 @@ function N(e, r, i, a) {
|
|
|
706
706
|
let e = r.catAxisCrosses ?? "autoZero";
|
|
707
707
|
e === "autoZero" && W < 0 && G > 0 ? J = R(q(0), M, M + L) : e === "min" ? J = M + L : e === "max" && (J = M);
|
|
708
708
|
}
|
|
709
|
-
if (!r.catAxisHidden && !r.catAxisLineHidden && (
|
|
709
|
+
if (!r.catAxisHidden && !r.catAxisLineHidden && (t.save(), t.strokeStyle = r.catAxisLineColor ? `#${r.catAxisLineColor}` : "#888", t.lineWidth = r.catAxisLineWidthEmu ? Math.max(.5, r.catAxisLineWidthEmu / e) : 1, t.lineCap = "butt", t.beginPath(), t.moveTo(j, J), t.lineTo(j + N, J), t.stroke(), t.restore()), !r.valAxisHidden && !r.valAxisLineHidden && (t.save(), t.strokeStyle = r.valAxisLineColor ? `#${r.valAxisLineColor}` : "#888", t.lineWidth = r.valAxisLineWidthEmu ? Math.max(.5, r.valAxisLineWidthEmu / e) : 1, t.beginPath(), t.moveTo(j, M), t.lineTo(j, M + L), t.stroke(), t.restore()), !r.catAxisHidden) {
|
|
710
710
|
let i = Math.max(8, Math.min(11, L / 20));
|
|
711
|
-
|
|
711
|
+
t.font = `${r.catAxisFontBold ? "bold " : ""}${i}px sans-serif`;
|
|
712
712
|
let a = n(U - H), s = Math.round((U - H) / a) + 1;
|
|
713
|
-
|
|
713
|
+
t.fillStyle = "#555", t.textAlign = "center", t.textBaseline = "top";
|
|
714
714
|
for (let n = 0; n < s; n++) {
|
|
715
715
|
let i = H + n * a;
|
|
716
716
|
if (i > U + a * .01) break;
|
|
717
717
|
let s = K(i);
|
|
718
|
-
|
|
719
|
-
let c = r.catAxisLineColor ? `#${r.catAxisLineColor}` : void 0, l = r.catAxisLineWidthEmu ? Math.max(.5, r.catAxisLineWidthEmu /
|
|
720
|
-
S(
|
|
718
|
+
t.fillText(o(i, r.catAxisFormatCode), s, J + 4);
|
|
719
|
+
let c = r.catAxisLineColor ? `#${r.catAxisLineColor}` : void 0, l = r.catAxisLineWidthEmu ? Math.max(.5, r.catAxisLineWidthEmu / e) : void 0;
|
|
720
|
+
S(t, r.catAxisMajorTickMark, "cat", J, s, c, l);
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
723
|
let Y = r.chartType === "bubble", X = Y ? "marker" : r.scatterStyle ?? "marker", ee = X === "line" || X === "lineMarker" || X === "lineNoMarker", Z = X === "smooth" || X === "smoothMarker" || X === "smoothNoMarker", te = X === "lineNoMarker" || X === "smoothNoMarker";
|
|
724
|
-
for (let
|
|
725
|
-
let n = r.series[
|
|
726
|
-
for (let
|
|
724
|
+
for (let e = 0; e < r.series.length; e++) {
|
|
725
|
+
let n = r.series[e], i = p(e, n), o = n.categories ?? [];
|
|
726
|
+
for (let e of n.errBars ?? []) F(t, n, e, o, V, K, q, i);
|
|
727
727
|
if (ee || Z) {
|
|
728
|
-
let
|
|
729
|
-
for (let
|
|
730
|
-
let r = n.values[
|
|
728
|
+
let e = [];
|
|
729
|
+
for (let t = 0; t < n.values.length; t++) {
|
|
730
|
+
let r = n.values[t];
|
|
731
731
|
if (r == null) continue;
|
|
732
|
-
let i = V ?
|
|
733
|
-
isNaN(i) ||
|
|
732
|
+
let i = V ? t : parseFloat(o[t] ?? "0");
|
|
733
|
+
isNaN(i) || e.push({
|
|
734
734
|
x: K(i),
|
|
735
735
|
y: q(r)
|
|
736
736
|
});
|
|
737
737
|
}
|
|
738
|
-
if (
|
|
739
|
-
if (
|
|
740
|
-
let r =
|
|
741
|
-
|
|
738
|
+
if (e.length >= 2) {
|
|
739
|
+
if (t.save(), t.strokeStyle = n.color ? `#${n.color}` : i, t.lineWidth = 1.5, t.beginPath(), t.moveTo(e[0].x, e[0].y), Z && e.length >= 3) for (let n = 0; n < e.length - 1; n++) {
|
|
740
|
+
let r = e[n - 1] ?? e[n], i = e[n], a = e[n + 1], o = e[n + 2] ?? a, s = i.x + (a.x - r.x) / 6, c = i.y + (a.y - r.y) / 6, l = a.x - (o.x - i.x) / 6, u = a.y - (o.y - i.y) / 6;
|
|
741
|
+
t.bezierCurveTo(s, c, l, u, a.x, a.y);
|
|
742
742
|
}
|
|
743
|
-
else for (let n = 1; n <
|
|
744
|
-
|
|
743
|
+
else for (let n = 1; n < e.length; n++) t.lineTo(e[n].x, e[n].y);
|
|
744
|
+
t.stroke(), t.restore();
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
747
|
if (!(te || n.showMarker === !1 || typeof n.markerSymbol == "string" && n.markerSymbol === "none")) {
|
|
748
|
-
let
|
|
748
|
+
let e = 0;
|
|
749
749
|
if (Y && n.bubbleSizes && n.bubbleSizes.length > 0) {
|
|
750
|
-
let
|
|
751
|
-
|
|
750
|
+
let t = Math.max(0, ...n.bubbleSizes.filter((e) => e != null));
|
|
751
|
+
t > 0 && (e = Math.min(N, L) / Math.max(8, n.values.length * 1.6) / Math.sqrt(t));
|
|
752
752
|
}
|
|
753
753
|
for (let r = 0; r < n.values.length; r++) {
|
|
754
754
|
let s = n.values[r];
|
|
@@ -756,17 +756,17 @@ function N(e, r, i, a) {
|
|
|
756
756
|
let c = V ? r : parseFloat(o[r] ?? "0");
|
|
757
757
|
if (isNaN(c)) continue;
|
|
758
758
|
let l = (n.dataPointOverrides ?? []).find((e) => e.idx === r), u = l?.markerSymbol ?? n.markerSymbol ?? "circle", d = l?.markerSize ?? n.markerSize ?? 5;
|
|
759
|
-
if (Y &&
|
|
760
|
-
let
|
|
761
|
-
|
|
759
|
+
if (Y && e > 0) {
|
|
760
|
+
let t = n.bubbleSizes?.[r];
|
|
761
|
+
t != null && t > 0 && (d = Math.sqrt(t) * e * 2 / a);
|
|
762
762
|
}
|
|
763
763
|
let f = l?.markerFill ?? l?.color ?? n.markerFill ?? i, p = l?.markerLine ?? n.markerLine ?? null;
|
|
764
|
-
P(
|
|
764
|
+
P(t, K(c), q(s), u, d, f, p, a);
|
|
765
765
|
}
|
|
766
766
|
}
|
|
767
|
-
I(
|
|
767
|
+
I(t, n, o, V, K, q, L, a);
|
|
768
768
|
}
|
|
769
|
-
x(
|
|
769
|
+
x(t, r, _, s, c, l, u, j, M, N, L, h + 2), r.catAxisTitle && g(t, r.catAxisTitle, j, M, N, L, "cat", D), r.valAxisTitle && g(t, r.valAxisTitle, j, M, N, L, "val", D);
|
|
770
770
|
}
|
|
771
771
|
function P(e, t, n, r, i, a, o, s) {
|
|
772
772
|
let c = Math.max(2, i * s), l = c / 2, u = a.startsWith("#") ? a : `#${a}`, d = o ? o.startsWith("#") ? o : `#${o}` : null;
|
|
@@ -808,28 +808,28 @@ function P(e, t, n, r, i, a, o, s) {
|
|
|
808
808
|
}
|
|
809
809
|
e.restore();
|
|
810
810
|
}
|
|
811
|
-
function F(
|
|
812
|
-
|
|
813
|
-
let l = r.barType === "plus" || r.barType === "both", u = r.barType === "minus" || r.barType === "both", d = r.dir === "x", f =
|
|
814
|
-
for (let
|
|
815
|
-
let c = n.values[
|
|
811
|
+
function F(t, n, r, i, a, o, s, c) {
|
|
812
|
+
t.save(), t.strokeStyle = r.color ? `#${r.color}` : c, t.lineWidth = r.lineWidthEmu ? Math.max(.5, r.lineWidthEmu / e) : 1, t.setLineDash(z(r.dash));
|
|
813
|
+
let l = r.barType === "plus" || r.barType === "both", u = r.barType === "minus" || r.barType === "both", d = r.dir === "x", f = t.lineWidth * 1.5;
|
|
814
|
+
for (let e = 0; e < n.values.length; e++) {
|
|
815
|
+
let c = n.values[e];
|
|
816
816
|
if (c == null) continue;
|
|
817
|
-
let p = a ?
|
|
817
|
+
let p = a ? e : parseFloat(i[e] ?? "0");
|
|
818
818
|
if (isNaN(p)) continue;
|
|
819
|
-
let m = o(p), h = s(c), g = (
|
|
819
|
+
let m = o(p), h = s(c), g = (e) => {
|
|
820
820
|
let n = m, i = h;
|
|
821
|
-
d ? n = o(p +
|
|
821
|
+
d ? n = o(p + e) : i = s(c + e), t.beginPath(), t.moveTo(m, h), t.lineTo(n, i), t.stroke(), r.noEndCap || (t.save(), t.setLineDash([]), t.beginPath(), d ? (t.moveTo(n, i - f), t.lineTo(n, i + f)) : (t.moveTo(n - f, i), t.lineTo(n + f, i)), t.stroke(), t.restore());
|
|
822
822
|
};
|
|
823
823
|
if (l) {
|
|
824
|
-
let
|
|
825
|
-
|
|
824
|
+
let t = r.plus[e];
|
|
825
|
+
t != null && g(t);
|
|
826
826
|
}
|
|
827
827
|
if (u) {
|
|
828
|
-
let
|
|
829
|
-
|
|
828
|
+
let t = r.minus[e];
|
|
829
|
+
t != null && g(-t);
|
|
830
830
|
}
|
|
831
831
|
}
|
|
832
|
-
|
|
832
|
+
t.restore();
|
|
833
833
|
}
|
|
834
834
|
function I(e, t, n, r, i, a, s, c) {
|
|
835
835
|
let l = t.dataLabelOverrides ?? [];
|
|
@@ -977,10 +977,10 @@ function B(e, t, r) {
|
|
|
977
977
|
}
|
|
978
978
|
e.restore();
|
|
979
979
|
}
|
|
980
|
-
function V(
|
|
980
|
+
function V(e, n, r, i = t) {
|
|
981
981
|
let { x: a, y: o, w: s, h: c } = r;
|
|
982
|
-
if (n.chartBg && (
|
|
983
|
-
|
|
982
|
+
if (n.chartBg && (e.fillStyle = `#${n.chartBg}`, e.fillRect(a, o, s, c)), n.series.length === 0) {
|
|
983
|
+
e.fillStyle = "#888", e.font = "12px sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText("(no data)", a + s / 2, o + c / 2);
|
|
984
984
|
return;
|
|
985
985
|
}
|
|
986
986
|
switch (n.chartType) {
|
|
@@ -990,35 +990,35 @@ function V(t, n, r, i = e) {
|
|
|
990
990
|
case "stackedBarH":
|
|
991
991
|
case "stackedBarPct":
|
|
992
992
|
case "stackedBarHPct":
|
|
993
|
-
O(
|
|
993
|
+
O(e, n, r, i);
|
|
994
994
|
break;
|
|
995
995
|
case "line":
|
|
996
996
|
case "stackedLine":
|
|
997
997
|
case "stackedLinePct":
|
|
998
|
-
k(
|
|
998
|
+
k(e, n, r, i);
|
|
999
999
|
break;
|
|
1000
1000
|
case "area":
|
|
1001
1001
|
case "stackedArea":
|
|
1002
1002
|
case "stackedAreaPct":
|
|
1003
|
-
A(
|
|
1003
|
+
A(e, n, r, i);
|
|
1004
1004
|
break;
|
|
1005
1005
|
case "pie":
|
|
1006
|
-
j(
|
|
1006
|
+
j(e, n, r, !1, i);
|
|
1007
1007
|
break;
|
|
1008
1008
|
case "doughnut":
|
|
1009
|
-
j(
|
|
1009
|
+
j(e, n, r, !0, i);
|
|
1010
1010
|
break;
|
|
1011
1011
|
case "radar":
|
|
1012
|
-
M(
|
|
1012
|
+
M(e, n, r, i);
|
|
1013
1013
|
break;
|
|
1014
1014
|
case "scatter":
|
|
1015
1015
|
case "bubble":
|
|
1016
|
-
N(
|
|
1016
|
+
N(e, n, r, i);
|
|
1017
1017
|
break;
|
|
1018
1018
|
case "waterfall":
|
|
1019
|
-
B(
|
|
1019
|
+
B(e, n, r);
|
|
1020
1020
|
break;
|
|
1021
|
-
default:
|
|
1021
|
+
default: e.fillStyle = "#888", e.font = "11px sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText(`Chart: ${n.chartType}`, a + s / 2, o + c / 2);
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
1024
|
//#endregion
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1906,6 +1906,11 @@ declare interface RenderViewportOptions {
|
|
|
1906
1906
|
cellScale?: number;
|
|
1907
1907
|
/** Pre-loaded Image elements keyed by their dataUrl (for ImageAnchor rendering). */
|
|
1908
1908
|
loadedImages?: Map<string, HTMLImageElement>;
|
|
1909
|
+
/** Opt-in OMML equation engine. Import it from the separate `@silurus/ooxml/math`
|
|
1910
|
+
* entry and pass it in (`import { math } from '@silurus/ooxml/math'`). When
|
|
1911
|
+
* omitted, equations in shapes are skipped and the ~3 MB engine never enters
|
|
1912
|
+
* the bundle. Same DI contract as docx/pptx. */
|
|
1913
|
+
math?: MathRenderer;
|
|
1909
1914
|
/** Called once per cell that contains text, with canvas-pixel position and cell address. */
|
|
1910
1915
|
onTextRun?: (info: XlsxTextRunInfo) => void;
|
|
1911
1916
|
/** Highlighted row range for selected row headers (1-indexed inclusive).
|
|
@@ -2220,7 +2225,12 @@ declare interface ShapeText_2 {
|
|
|
2220
2225
|
alignment: string;
|
|
2221
2226
|
}
|
|
2222
2227
|
|
|
2223
|
-
|
|
2228
|
+
/** A run within a shape paragraph — tagged union mirroring the Rust enum
|
|
2229
|
+
* (matches the pptx `TextRun` shape): styled text, a soft line break, or an
|
|
2230
|
+
* OMML equation. Excel stores "Insert > Equation" as OMML inside the shared
|
|
2231
|
+
* DrawingML `<xdr:txBody>` grammar (ECMA-376 §22.1), like PowerPoint. */
|
|
2232
|
+
declare type ShapeTextRun = {
|
|
2233
|
+
type: 'text';
|
|
2224
2234
|
text: string;
|
|
2225
2235
|
bold: boolean;
|
|
2226
2236
|
italic: boolean;
|
|
@@ -2229,7 +2239,18 @@ declare interface ShapeTextRun {
|
|
|
2229
2239
|
size: number;
|
|
2230
2240
|
color?: string;
|
|
2231
2241
|
fontFace?: string;
|
|
2232
|
-
}
|
|
2242
|
+
} | {
|
|
2243
|
+
type: 'break';
|
|
2244
|
+
} | {
|
|
2245
|
+
type: 'math';
|
|
2246
|
+
/** OMML AST (shared `MathNode` model) for the equation. */
|
|
2247
|
+
nodes: MathNode[];
|
|
2248
|
+
/** true = block (`m:oMathPara`), false = inline (`m:oMath`). */
|
|
2249
|
+
display: boolean;
|
|
2250
|
+
/** Point size when the run carries an explicit `rPr@sz`; else inherit. */
|
|
2251
|
+
fontSize?: number;
|
|
2252
|
+
color?: string;
|
|
2253
|
+
};
|
|
2233
2254
|
|
|
2234
2255
|
declare interface SharedString {
|
|
2235
2256
|
text: string;
|
|
@@ -2887,6 +2908,14 @@ declare interface XlsxViewerOptions {
|
|
|
2887
2908
|
* values fall back to the default.
|
|
2888
2909
|
*/
|
|
2889
2910
|
maxZipEntryBytes?: number;
|
|
2911
|
+
/**
|
|
2912
|
+
* Opt-in OMML equation engine for rendering math in shapes/text boxes.
|
|
2913
|
+
* Import it from the separate `@silurus/ooxml/math` entry and pass it in
|
|
2914
|
+
* (`import { math } from '@silurus/ooxml/math'`). When omitted, equations are
|
|
2915
|
+
* skipped and the ~3 MB engine never enters the bundle (tree-shaken). Same
|
|
2916
|
+
* dependency-injection contract as the docx/pptx viewers.
|
|
2917
|
+
*/
|
|
2918
|
+
math?: MathRenderer;
|
|
2890
2919
|
}
|
|
2891
2920
|
|
|
2892
2921
|
declare class XlsxWorkbook {
|