@silurus/ooxml 0.66.1 → 0.66.2
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.
|
@@ -1253,15 +1253,16 @@ function bt(e, t, n) {
|
|
|
1253
1253
|
}
|
|
1254
1254
|
return e;
|
|
1255
1255
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1256
|
+
let s = e.widthPt != null || e.widthPct != null;
|
|
1257
|
+
if (i.reduce((e, t) => e + t, 0) > 0 && s) return o(i.map((e, t) => Math.max(e, a[t])));
|
|
1258
|
+
let c = Array(r).fill(0), l = Array(r).fill(!1), u = (e) => e.widthPt == null ? e.widthPct == null ? null : e.widthPct / 5e3 * t : e.widthPt;
|
|
1258
1259
|
for (let t of e.rows) {
|
|
1259
1260
|
let e = 0;
|
|
1260
1261
|
for (let n of t.cells) {
|
|
1261
1262
|
let t = Math.min(Math.max(n.colSpan, 1), r - e);
|
|
1262
1263
|
if (t === 1) {
|
|
1263
|
-
let t =
|
|
1264
|
-
t != null && (t >
|
|
1264
|
+
let t = u(n);
|
|
1265
|
+
t != null && (t > c[e] && (c[e] = t), l[e] = !0);
|
|
1265
1266
|
}
|
|
1266
1267
|
e += t;
|
|
1267
1268
|
}
|
|
@@ -1271,14 +1272,14 @@ function bt(e, t, n) {
|
|
|
1271
1272
|
for (let n of t.cells) {
|
|
1272
1273
|
let t = Math.min(Math.max(n.colSpan, 1), r - e);
|
|
1273
1274
|
if (t > 1) {
|
|
1274
|
-
let r =
|
|
1275
|
+
let r = u(n);
|
|
1275
1276
|
if (r != null) {
|
|
1276
|
-
let n = i.slice(e, e + t), a = n.reduce((e, t) => e + t, 0), o = n.reduce((t, n, r) => t + (
|
|
1277
|
+
let n = i.slice(e, e + t), a = n.reduce((e, t) => e + t, 0), o = n.reduce((t, n, r) => t + (l[e + r] ? c[e + r] : n), 0);
|
|
1277
1278
|
if (r > o) {
|
|
1278
|
-
let
|
|
1279
|
+
let s = r - o;
|
|
1279
1280
|
for (let r = 0; r < t; r++) {
|
|
1280
|
-
let o = a > 0 ? n[r] / a : 1 / t, u =
|
|
1281
|
-
|
|
1281
|
+
let o = a > 0 ? n[r] / a : 1 / t, u = l[e + r] ? c[e + r] : i[e + r];
|
|
1282
|
+
c[e + r] = u + s * o, l[e + r] = !0;
|
|
1282
1283
|
}
|
|
1283
1284
|
}
|
|
1284
1285
|
}
|
|
@@ -1286,7 +1287,7 @@ function bt(e, t, n) {
|
|
|
1286
1287
|
e += t;
|
|
1287
1288
|
}
|
|
1288
1289
|
}
|
|
1289
|
-
return o(
|
|
1290
|
+
return o(c.map((e, t) => Math.max(l[t] ? e : i[t], a[t])));
|
|
1290
1291
|
}
|
|
1291
1292
|
function xt(e, t) {
|
|
1292
1293
|
return t <= 0 ? !0 : !e.rows[t].cells.some((e) => e.vMerge === !1);
|
|
@@ -1830,12 +1831,12 @@ function Gt(e) {
|
|
|
1830
1831
|
}), t;
|
|
1831
1832
|
}
|
|
1832
1833
|
function Kt(e) {
|
|
1833
|
-
let t =
|
|
1834
|
-
for (let
|
|
1835
|
-
let e =
|
|
1836
|
-
|
|
1834
|
+
let t = (e) => e >= 48 && e <= 57, n = (e) => e === "." || e === "," || e === ":" || e === "/" || e === "\xA0", r = [], i = "", a = null;
|
|
1835
|
+
for (let o = 0; o < e.length; o++) {
|
|
1836
|
+
let s = e[o], c = t(s.charCodeAt(0));
|
|
1837
|
+
!c && a === !0 && n(s) && t(e.charCodeAt(o + 1)) && (c = !0), a === null || c === a ? i += s : (r.push(i), i = s), a = c;
|
|
1837
1838
|
}
|
|
1838
|
-
return
|
|
1839
|
+
return i.length > 0 && r.push(i), r.length ? r : [e];
|
|
1839
1840
|
}
|
|
1840
1841
|
function qt(e) {
|
|
1841
1842
|
let t = [], n = 0;
|
|
@@ -2228,14 +2229,14 @@ function cn(e, t, n, r, i, a, o, s = {}, c = /* @__PURE__ */ new Map()) {
|
|
|
2228
2229
|
let e = (e) => t.alignment === "distribute" ? "center" : _e(t.alignment, e);
|
|
2229
2230
|
a.textAlign = "left";
|
|
2230
2231
|
for (let t = 0; t < n.lines.length; t++) {
|
|
2231
|
-
let r = n.lines[t], i = n.lineHeights[t], c = r.reduce((e, t) => e + t.width, 0), l = w(void 0, r.map((e) => e.text).join("")) === "rtl";
|
|
2232
|
-
a.direction = l ? "rtl" : "ltr";
|
|
2233
|
-
let u = e(l), d = m;
|
|
2232
|
+
let r = n.lines[t], i = n.lineHeights[t], c = r.reduce((e, t) => e + t.width, 0), l = w(void 0, r.map((e) => e.text).join("")) === "rtl", u = e(l), d = m;
|
|
2234
2233
|
u === "center" ? d = m + Math.max(0, (h - c) / 2) : u === "right" && (d = m + Math.max(0, h - c));
|
|
2235
|
-
let f = i / 1.2, p = S + f * .85;
|
|
2236
|
-
for (let e
|
|
2237
|
-
let t = e
|
|
2238
|
-
a.
|
|
2234
|
+
let f = i / 1.2, p = S + f * .85, g = ge(r, l);
|
|
2235
|
+
for (let e = 0; e < r.length; e++) {
|
|
2236
|
+
let t = g.order[e], n = r[t];
|
|
2237
|
+
a.direction = g.rtl[t] ? "rtl" : "ltr";
|
|
2238
|
+
let i = n.run.fontSizePt * o;
|
|
2239
|
+
a.font = X(n.run.bold ?? !1, n.run.italic ?? !1, i, nn(n.text, n.run), s), a.fillStyle = n.run.color ? `#${n.run.color}` : "#000000", a.fillText(n.text, d, p), d += n.width;
|
|
2239
2240
|
}
|
|
2240
2241
|
S += i;
|
|
2241
2242
|
}
|
|
@@ -2808,7 +2809,7 @@ var dr = class e {
|
|
|
2808
2809
|
static async load(t, n = {}) {
|
|
2809
2810
|
let r = n.mode ?? "main";
|
|
2810
2811
|
if (r === "worker" && (typeof Worker > "u" || typeof OffscreenCanvas > "u")) throw Error("mode: 'worker' requires Worker and OffscreenCanvas support");
|
|
2811
|
-
let i = new e(r === "worker" ? (await import("./render-worker-host-
|
|
2812
|
+
let i = new e(r === "worker" ? (await import("./render-worker-host-D0ovEZj9.js")).createRenderWorker() : new ie(), r), a;
|
|
2812
2813
|
if (typeof t == "string") {
|
|
2813
2814
|
let e = await fetch(t);
|
|
2814
2815
|
if (!e.ok) throw Error(`Failed to fetch: ${e.status} ${e.statusText}`);
|
package/dist/docx.mjs
CHANGED
package/dist/index.mjs
CHANGED