ooxml-core 1.8.3 → 1.8.4
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/automation/index.cjs +7240 -7192
- package/dist/automation/index.mjs +7240 -7192
- package/dist/teams/index.cjs +79 -3
- package/dist/teams/index.mjs +79 -3
- package/dist/xlsx/edit/sheets.d.ts.map +1 -1
- package/dist/xlsx/index.cjs +268 -222
- package/dist/xlsx/index.mjs +268 -222
- package/dist/xlsx/load/index.cjs +63 -1
- package/dist/xlsx/load/index.mjs +63 -1
- package/dist/xlsx/ui/index.cjs +222 -221
- package/dist/xlsx/ui/index.mjs +222 -221
- package/dist/xlsx/write/chart-cache.d.ts +8 -0
- package/dist/xlsx/write/chart-cache.d.ts.map +1 -0
- package/dist/xlsx/write/sheet-parts.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/xlsx/ui/index.mjs
CHANGED
|
@@ -14331,6 +14331,222 @@ function shiftFormulaInBand(formula, formulaSheet, sheet, shift2, band) {
|
|
|
14331
14331
|
return changed ? tokens.map((t) => t.text).join("") : formula;
|
|
14332
14332
|
}
|
|
14333
14333
|
|
|
14334
|
+
// xlsx/layout/sparkline-view.ts
|
|
14335
|
+
var DEFAULTS = {
|
|
14336
|
+
colorSeries: "#376092",
|
|
14337
|
+
colorNegative: "#D00000",
|
|
14338
|
+
colorAxis: "#000000",
|
|
14339
|
+
colorMarkers: "#D00000",
|
|
14340
|
+
colorFirst: "#D00000",
|
|
14341
|
+
colorLast: "#D00000",
|
|
14342
|
+
colorHigh: "#D00000",
|
|
14343
|
+
colorLow: "#D00000"
|
|
14344
|
+
};
|
|
14345
|
+
var COLUMN_GAP = 0.2;
|
|
14346
|
+
function extent(values2) {
|
|
14347
|
+
let min = Infinity;
|
|
14348
|
+
let max = -Infinity;
|
|
14349
|
+
for (const v of values2) {
|
|
14350
|
+
if (v === null) continue;
|
|
14351
|
+
if (v < min) min = v;
|
|
14352
|
+
if (v > max) max = v;
|
|
14353
|
+
}
|
|
14354
|
+
return min <= max ? { min, max } : void 0;
|
|
14355
|
+
}
|
|
14356
|
+
function sparklineValues(group, values2) {
|
|
14357
|
+
return group.displayEmptyCellsAs === "zero" ? values2.map((v) => v ?? 0) : [...values2];
|
|
14358
|
+
}
|
|
14359
|
+
function sparklineScale(group, all2, index2) {
|
|
14360
|
+
const own = extent(sparklineValues(group, all2[index2]?.values ?? []));
|
|
14361
|
+
const needsGroup = group.minAxisType === "group" || group.maxAxisType === "group";
|
|
14362
|
+
const shared = needsGroup ? extent(all2.flatMap((data) => sparklineValues(group, data.values))) : void 0;
|
|
14363
|
+
const end = (type, manual, key) => {
|
|
14364
|
+
if (type === "custom" && manual !== void 0) return manual;
|
|
14365
|
+
if (type === "group" && shared) return shared[key];
|
|
14366
|
+
return own?.[key];
|
|
14367
|
+
};
|
|
14368
|
+
const min = end(group.minAxisType, group.manualMin, "min");
|
|
14369
|
+
const max = end(group.maxAxisType, group.manualMax, "max");
|
|
14370
|
+
return min === void 0 || max === void 0 ? void 0 : { min, max };
|
|
14371
|
+
}
|
|
14372
|
+
function positions(group, data, n) {
|
|
14373
|
+
const dates = data.dates;
|
|
14374
|
+
if (group.dateAxis && dates && dates.length === n) {
|
|
14375
|
+
const span4 = extent(dates);
|
|
14376
|
+
if (span4) {
|
|
14377
|
+
const width = span4.max - span4.min;
|
|
14378
|
+
return dates.map((d) => d === null ? null : width ? (d - span4.min) / width : 0.5);
|
|
14379
|
+
}
|
|
14380
|
+
}
|
|
14381
|
+
return Array.from({ length: n }, (_, i2) => n === 1 ? 0.5 : i2 / (n - 1));
|
|
14382
|
+
}
|
|
14383
|
+
function pointFacts(values2) {
|
|
14384
|
+
const numbers3 = values2.filter((x) => x !== null);
|
|
14385
|
+
let last = values2.length - 1;
|
|
14386
|
+
while (last >= 0 && values2[last] === null) last--;
|
|
14387
|
+
return {
|
|
14388
|
+
high: Math.max(...numbers3),
|
|
14389
|
+
low: Math.min(...numbers3),
|
|
14390
|
+
first: values2.findIndex((x) => x !== null),
|
|
14391
|
+
last
|
|
14392
|
+
};
|
|
14393
|
+
}
|
|
14394
|
+
function pointColor(group, v, i2, facts, colors, markers) {
|
|
14395
|
+
let color = markers && group.markers ? colors.colorMarkers : void 0;
|
|
14396
|
+
if (group.negative && v < 0) color = colors.colorNegative;
|
|
14397
|
+
if (group.high && v === facts.high) color = colors.colorHigh;
|
|
14398
|
+
if (group.low && v === facts.low) color = colors.colorLow;
|
|
14399
|
+
if (group.first && i2 === facts.first) color = colors.colorFirst;
|
|
14400
|
+
if (group.last && i2 === facts.last) color = colors.colorLast;
|
|
14401
|
+
return color;
|
|
14402
|
+
}
|
|
14403
|
+
function resolveColors(group, theme2) {
|
|
14404
|
+
const out = { ...DEFAULTS };
|
|
14405
|
+
for (const key of Object.keys(DEFAULTS)) {
|
|
14406
|
+
const color = group[key];
|
|
14407
|
+
out[key] = resolveColor(color, theme2, DEFAULTS[key]) ?? DEFAULTS[key];
|
|
14408
|
+
}
|
|
14409
|
+
return out;
|
|
14410
|
+
}
|
|
14411
|
+
function sparklineView(group, data, scale2, theme2) {
|
|
14412
|
+
const colors = resolveColors(group, theme2);
|
|
14413
|
+
const view = {
|
|
14414
|
+
type: group.type,
|
|
14415
|
+
color: colors.colorSeries,
|
|
14416
|
+
lineWeightPt: group.lineWeight,
|
|
14417
|
+
lines: [],
|
|
14418
|
+
markers: [],
|
|
14419
|
+
columns: []
|
|
14420
|
+
};
|
|
14421
|
+
const values2 = sparklineValues(group, data.values);
|
|
14422
|
+
const n = values2.length;
|
|
14423
|
+
if (!n || !scale2) return view;
|
|
14424
|
+
const facts = pointFacts(values2);
|
|
14425
|
+
const xs = positions(group, data, n);
|
|
14426
|
+
const flip = (x) => group.rightToLeft ? 1 - x : x;
|
|
14427
|
+
const range2 = scale2.max - scale2.min;
|
|
14428
|
+
const yOf = (v) => range2 ? Math.max(0, Math.min(1, (scale2.max - v) / range2)) : 0.5;
|
|
14429
|
+
if (group.type === "line") {
|
|
14430
|
+
let segment = [];
|
|
14431
|
+
values2.forEach((v, i2) => {
|
|
14432
|
+
const x = xs[i2];
|
|
14433
|
+
if (v === null || x === null || x === void 0) {
|
|
14434
|
+
if (group.displayEmptyCellsAs === "gap" && segment.length) {
|
|
14435
|
+
view.lines.push(segment);
|
|
14436
|
+
segment = [];
|
|
14437
|
+
}
|
|
14438
|
+
return;
|
|
14439
|
+
}
|
|
14440
|
+
const point = { x: flip(x), y: yOf(v) };
|
|
14441
|
+
segment.push(point);
|
|
14442
|
+
const color = pointColor(group, v, i2, facts, colors, true);
|
|
14443
|
+
if (color) view.markers.push({ ...point, color });
|
|
14444
|
+
});
|
|
14445
|
+
if (segment.length) view.lines.push(segment);
|
|
14446
|
+
} else {
|
|
14447
|
+
const slot = 1 / n;
|
|
14448
|
+
const w = slot * (1 - COLUMN_GAP);
|
|
14449
|
+
const base = yOf(Math.max(scale2.min, Math.min(scale2.max, 0)));
|
|
14450
|
+
values2.forEach((v, i2) => {
|
|
14451
|
+
const position = xs[i2];
|
|
14452
|
+
if (v === null || position === null || position === void 0) return;
|
|
14453
|
+
if (v === 0) return;
|
|
14454
|
+
let top;
|
|
14455
|
+
let bottom;
|
|
14456
|
+
if (group.type === "stacked") [top, bottom] = v > 0 ? [0, 0.5] : [0.5, 1];
|
|
14457
|
+
else if (!range2) [top, bottom] = [0, 1];
|
|
14458
|
+
else [top, bottom] = [Math.min(base, yOf(v)), Math.max(base, yOf(v))];
|
|
14459
|
+
const centre = flip(slot / 2 + position * (1 - slot));
|
|
14460
|
+
const color = pointColor(group, v, i2, facts, colors, false) ?? view.color;
|
|
14461
|
+
view.columns.push({ x: centre - w / 2, y: top, w, h: bottom - top, color });
|
|
14462
|
+
});
|
|
14463
|
+
}
|
|
14464
|
+
if (group.type === "stacked") {
|
|
14465
|
+
if (group.displayXAxis) view.axis = { y: 0.5, color: colors.colorAxis };
|
|
14466
|
+
} else if (group.displayXAxis && range2 && scale2.min <= 0 && scale2.max >= 0)
|
|
14467
|
+
view.axis = { y: yOf(0), color: colors.colorAxis };
|
|
14468
|
+
return view;
|
|
14469
|
+
}
|
|
14470
|
+
|
|
14471
|
+
// xlsx/layout/sparkline-data.ts
|
|
14472
|
+
var MAX_POINTS = 1e4;
|
|
14473
|
+
var hostIndex = /* @__PURE__ */ new WeakMap();
|
|
14474
|
+
function hosts(sheet) {
|
|
14475
|
+
const groups = sheetSparklineGroups(sheet);
|
|
14476
|
+
let index2 = hostIndex.get(groups);
|
|
14477
|
+
if (!index2) {
|
|
14478
|
+
index2 = /* @__PURE__ */ new Map();
|
|
14479
|
+
for (const group of groups)
|
|
14480
|
+
group.sparklines.forEach((line2, i2) => {
|
|
14481
|
+
const key = cellKey(line2.host.start.row, line2.host.start.col);
|
|
14482
|
+
if (!index2.has(key)) index2.set(key, { group, index: i2 });
|
|
14483
|
+
});
|
|
14484
|
+
hostIndex.set(groups, index2);
|
|
14485
|
+
}
|
|
14486
|
+
return index2;
|
|
14487
|
+
}
|
|
14488
|
+
function hasSparklineAt(sheet, row2, col) {
|
|
14489
|
+
return hosts(sheet).has(cellKey(row2, col));
|
|
14490
|
+
}
|
|
14491
|
+
function resolveSparklineRange(workbook, sheet, formula) {
|
|
14492
|
+
const ref = formula.trim().replace(/^=/, "");
|
|
14493
|
+
const bang = ref.lastIndexOf("!");
|
|
14494
|
+
let target2 = sheet;
|
|
14495
|
+
if (bang >= 0) {
|
|
14496
|
+
const raw = ref.slice(0, bang);
|
|
14497
|
+
const name = /^'.*'$/.test(raw) ? raw.slice(1, -1).replace(/''/g, "'") : raw;
|
|
14498
|
+
target2 = sheetByName(workbook, name);
|
|
14499
|
+
}
|
|
14500
|
+
const range2 = parseRange(ref.slice(bang + 1).replace(/\$/g, ""));
|
|
14501
|
+
return target2 && range2 ? { sheet: target2, range: normalizeRange(range2) } : void 0;
|
|
14502
|
+
}
|
|
14503
|
+
var rowHidden = (sheet, row2) => sheet.rowInfo.get(row2)?.hidden === true;
|
|
14504
|
+
var colHidden = (sheet, col) => sheet.columns.some((c) => c.hidden === true && col >= c.min && col <= c.max);
|
|
14505
|
+
function readSparklineValues(sheet, range2, displayHidden) {
|
|
14506
|
+
let endRow = range2.end.row;
|
|
14507
|
+
if (endRow - range2.start.row >= MAX_POINTS) {
|
|
14508
|
+
let lastRow = range2.start.row;
|
|
14509
|
+
for (const row2 of sheet.rows.keys()) if (row2 > lastRow) lastRow = row2;
|
|
14510
|
+
endRow = Math.min(endRow, lastRow);
|
|
14511
|
+
}
|
|
14512
|
+
const out = [];
|
|
14513
|
+
for (let row2 = range2.start.row; row2 <= endRow && out.length < MAX_POINTS; row2++) {
|
|
14514
|
+
if (!displayHidden && rowHidden(sheet, row2)) continue;
|
|
14515
|
+
for (let col = range2.start.col; col <= range2.end.col && out.length < MAX_POINTS; col++) {
|
|
14516
|
+
if (!displayHidden && colHidden(sheet, col)) continue;
|
|
14517
|
+
const value2 = getCell(sheet, row2, col)?.value;
|
|
14518
|
+
out.push(typeof value2 === "number" && Number.isFinite(value2) ? value2 : null);
|
|
14519
|
+
}
|
|
14520
|
+
}
|
|
14521
|
+
return out;
|
|
14522
|
+
}
|
|
14523
|
+
function groupData(workbook, sheet, group) {
|
|
14524
|
+
const dateRange = group.dateAxis && group.dateFormula;
|
|
14525
|
+
const dates = dateRange ? resolveSparklineRange(workbook, sheet, dateRange) : void 0;
|
|
14526
|
+
const dateValues = dates ? readSparklineValues(dates.sheet, dates.range, group.displayHidden) : void 0;
|
|
14527
|
+
return group.sparklines.map((line2) => {
|
|
14528
|
+
const source = line2.formula ? resolveSparklineRange(workbook, sheet, line2.formula) : void 0;
|
|
14529
|
+
const values2 = source ? readSparklineValues(source.sheet, source.range, group.displayHidden) : [];
|
|
14530
|
+
return dateValues ? { values: values2, dates: dateValues } : { values: values2 };
|
|
14531
|
+
});
|
|
14532
|
+
}
|
|
14533
|
+
function sparklineViewAt(workbook, sheetIndex2, row2, col) {
|
|
14534
|
+
const sheet = workbook.sheets[sheetIndex2];
|
|
14535
|
+
if (!sheet) return void 0;
|
|
14536
|
+
const entry = hosts(sheet).get(cellKey(row2, col));
|
|
14537
|
+
if (!entry) return void 0;
|
|
14538
|
+
const { group, index: index2 } = entry;
|
|
14539
|
+
const needsGroup = group.minAxisType === "group" || group.maxAxisType === "group";
|
|
14540
|
+
const data = needsGroup ? groupData(workbook, sheet, group) : groupData(workbook, sheet, { ...group, sparklines: [group.sparklines[index2]] });
|
|
14541
|
+
const at = needsGroup ? index2 : 0;
|
|
14542
|
+
return sparklineView(
|
|
14543
|
+
group,
|
|
14544
|
+
data[at] ?? { values: [] },
|
|
14545
|
+
sparklineScale(group, data, at),
|
|
14546
|
+
workbook.theme
|
|
14547
|
+
);
|
|
14548
|
+
}
|
|
14549
|
+
|
|
14334
14550
|
// xlsx/edit/context.ts
|
|
14335
14551
|
function sheetAt(workbook, index2) {
|
|
14336
14552
|
const sheet = Number.isInteger(index2) ? workbook.sheets[index2] : void 0;
|
|
@@ -20573,222 +20789,6 @@ function bordersView(border, theme2) {
|
|
|
20573
20789
|
return out;
|
|
20574
20790
|
}
|
|
20575
20791
|
|
|
20576
|
-
// xlsx/layout/sparkline-view.ts
|
|
20577
|
-
var DEFAULTS = {
|
|
20578
|
-
colorSeries: "#376092",
|
|
20579
|
-
colorNegative: "#D00000",
|
|
20580
|
-
colorAxis: "#000000",
|
|
20581
|
-
colorMarkers: "#D00000",
|
|
20582
|
-
colorFirst: "#D00000",
|
|
20583
|
-
colorLast: "#D00000",
|
|
20584
|
-
colorHigh: "#D00000",
|
|
20585
|
-
colorLow: "#D00000"
|
|
20586
|
-
};
|
|
20587
|
-
var COLUMN_GAP = 0.2;
|
|
20588
|
-
function extent(values2) {
|
|
20589
|
-
let min = Infinity;
|
|
20590
|
-
let max = -Infinity;
|
|
20591
|
-
for (const v of values2) {
|
|
20592
|
-
if (v === null) continue;
|
|
20593
|
-
if (v < min) min = v;
|
|
20594
|
-
if (v > max) max = v;
|
|
20595
|
-
}
|
|
20596
|
-
return min <= max ? { min, max } : void 0;
|
|
20597
|
-
}
|
|
20598
|
-
function sparklineValues(group, values2) {
|
|
20599
|
-
return group.displayEmptyCellsAs === "zero" ? values2.map((v) => v ?? 0) : [...values2];
|
|
20600
|
-
}
|
|
20601
|
-
function sparklineScale(group, all2, index2) {
|
|
20602
|
-
const own = extent(sparklineValues(group, all2[index2]?.values ?? []));
|
|
20603
|
-
const needsGroup = group.minAxisType === "group" || group.maxAxisType === "group";
|
|
20604
|
-
const shared = needsGroup ? extent(all2.flatMap((data) => sparklineValues(group, data.values))) : void 0;
|
|
20605
|
-
const end = (type, manual, key) => {
|
|
20606
|
-
if (type === "custom" && manual !== void 0) return manual;
|
|
20607
|
-
if (type === "group" && shared) return shared[key];
|
|
20608
|
-
return own?.[key];
|
|
20609
|
-
};
|
|
20610
|
-
const min = end(group.minAxisType, group.manualMin, "min");
|
|
20611
|
-
const max = end(group.maxAxisType, group.manualMax, "max");
|
|
20612
|
-
return min === void 0 || max === void 0 ? void 0 : { min, max };
|
|
20613
|
-
}
|
|
20614
|
-
function positions(group, data, n) {
|
|
20615
|
-
const dates = data.dates;
|
|
20616
|
-
if (group.dateAxis && dates && dates.length === n) {
|
|
20617
|
-
const span4 = extent(dates);
|
|
20618
|
-
if (span4) {
|
|
20619
|
-
const width = span4.max - span4.min;
|
|
20620
|
-
return dates.map((d) => d === null ? null : width ? (d - span4.min) / width : 0.5);
|
|
20621
|
-
}
|
|
20622
|
-
}
|
|
20623
|
-
return Array.from({ length: n }, (_, i2) => n === 1 ? 0.5 : i2 / (n - 1));
|
|
20624
|
-
}
|
|
20625
|
-
function pointFacts(values2) {
|
|
20626
|
-
const numbers3 = values2.filter((x) => x !== null);
|
|
20627
|
-
let last = values2.length - 1;
|
|
20628
|
-
while (last >= 0 && values2[last] === null) last--;
|
|
20629
|
-
return {
|
|
20630
|
-
high: Math.max(...numbers3),
|
|
20631
|
-
low: Math.min(...numbers3),
|
|
20632
|
-
first: values2.findIndex((x) => x !== null),
|
|
20633
|
-
last
|
|
20634
|
-
};
|
|
20635
|
-
}
|
|
20636
|
-
function pointColor(group, v, i2, facts, colors, markers) {
|
|
20637
|
-
let color = markers && group.markers ? colors.colorMarkers : void 0;
|
|
20638
|
-
if (group.negative && v < 0) color = colors.colorNegative;
|
|
20639
|
-
if (group.high && v === facts.high) color = colors.colorHigh;
|
|
20640
|
-
if (group.low && v === facts.low) color = colors.colorLow;
|
|
20641
|
-
if (group.first && i2 === facts.first) color = colors.colorFirst;
|
|
20642
|
-
if (group.last && i2 === facts.last) color = colors.colorLast;
|
|
20643
|
-
return color;
|
|
20644
|
-
}
|
|
20645
|
-
function resolveColors(group, theme2) {
|
|
20646
|
-
const out = { ...DEFAULTS };
|
|
20647
|
-
for (const key of Object.keys(DEFAULTS)) {
|
|
20648
|
-
const color = group[key];
|
|
20649
|
-
out[key] = resolveColor(color, theme2, DEFAULTS[key]) ?? DEFAULTS[key];
|
|
20650
|
-
}
|
|
20651
|
-
return out;
|
|
20652
|
-
}
|
|
20653
|
-
function sparklineView(group, data, scale2, theme2) {
|
|
20654
|
-
const colors = resolveColors(group, theme2);
|
|
20655
|
-
const view = {
|
|
20656
|
-
type: group.type,
|
|
20657
|
-
color: colors.colorSeries,
|
|
20658
|
-
lineWeightPt: group.lineWeight,
|
|
20659
|
-
lines: [],
|
|
20660
|
-
markers: [],
|
|
20661
|
-
columns: []
|
|
20662
|
-
};
|
|
20663
|
-
const values2 = sparklineValues(group, data.values);
|
|
20664
|
-
const n = values2.length;
|
|
20665
|
-
if (!n || !scale2) return view;
|
|
20666
|
-
const facts = pointFacts(values2);
|
|
20667
|
-
const xs = positions(group, data, n);
|
|
20668
|
-
const flip = (x) => group.rightToLeft ? 1 - x : x;
|
|
20669
|
-
const range2 = scale2.max - scale2.min;
|
|
20670
|
-
const yOf = (v) => range2 ? Math.max(0, Math.min(1, (scale2.max - v) / range2)) : 0.5;
|
|
20671
|
-
if (group.type === "line") {
|
|
20672
|
-
let segment = [];
|
|
20673
|
-
values2.forEach((v, i2) => {
|
|
20674
|
-
const x = xs[i2];
|
|
20675
|
-
if (v === null || x === null || x === void 0) {
|
|
20676
|
-
if (group.displayEmptyCellsAs === "gap" && segment.length) {
|
|
20677
|
-
view.lines.push(segment);
|
|
20678
|
-
segment = [];
|
|
20679
|
-
}
|
|
20680
|
-
return;
|
|
20681
|
-
}
|
|
20682
|
-
const point = { x: flip(x), y: yOf(v) };
|
|
20683
|
-
segment.push(point);
|
|
20684
|
-
const color = pointColor(group, v, i2, facts, colors, true);
|
|
20685
|
-
if (color) view.markers.push({ ...point, color });
|
|
20686
|
-
});
|
|
20687
|
-
if (segment.length) view.lines.push(segment);
|
|
20688
|
-
} else {
|
|
20689
|
-
const slot = 1 / n;
|
|
20690
|
-
const w = slot * (1 - COLUMN_GAP);
|
|
20691
|
-
const base = yOf(Math.max(scale2.min, Math.min(scale2.max, 0)));
|
|
20692
|
-
values2.forEach((v, i2) => {
|
|
20693
|
-
const position = xs[i2];
|
|
20694
|
-
if (v === null || position === null || position === void 0) return;
|
|
20695
|
-
if (v === 0) return;
|
|
20696
|
-
let top;
|
|
20697
|
-
let bottom;
|
|
20698
|
-
if (group.type === "stacked") [top, bottom] = v > 0 ? [0, 0.5] : [0.5, 1];
|
|
20699
|
-
else if (!range2) [top, bottom] = [0, 1];
|
|
20700
|
-
else [top, bottom] = [Math.min(base, yOf(v)), Math.max(base, yOf(v))];
|
|
20701
|
-
const centre = flip(slot / 2 + position * (1 - slot));
|
|
20702
|
-
const color = pointColor(group, v, i2, facts, colors, false) ?? view.color;
|
|
20703
|
-
view.columns.push({ x: centre - w / 2, y: top, w, h: bottom - top, color });
|
|
20704
|
-
});
|
|
20705
|
-
}
|
|
20706
|
-
if (group.type === "stacked") {
|
|
20707
|
-
if (group.displayXAxis) view.axis = { y: 0.5, color: colors.colorAxis };
|
|
20708
|
-
} else if (group.displayXAxis && range2 && scale2.min <= 0 && scale2.max >= 0)
|
|
20709
|
-
view.axis = { y: yOf(0), color: colors.colorAxis };
|
|
20710
|
-
return view;
|
|
20711
|
-
}
|
|
20712
|
-
|
|
20713
|
-
// xlsx/layout/sparkline-data.ts
|
|
20714
|
-
var MAX_POINTS = 1e4;
|
|
20715
|
-
var hostIndex = /* @__PURE__ */ new WeakMap();
|
|
20716
|
-
function hosts(sheet) {
|
|
20717
|
-
const groups = sheetSparklineGroups(sheet);
|
|
20718
|
-
let index2 = hostIndex.get(groups);
|
|
20719
|
-
if (!index2) {
|
|
20720
|
-
index2 = /* @__PURE__ */ new Map();
|
|
20721
|
-
for (const group of groups)
|
|
20722
|
-
group.sparklines.forEach((line2, i2) => {
|
|
20723
|
-
const key = cellKey(line2.host.start.row, line2.host.start.col);
|
|
20724
|
-
if (!index2.has(key)) index2.set(key, { group, index: i2 });
|
|
20725
|
-
});
|
|
20726
|
-
hostIndex.set(groups, index2);
|
|
20727
|
-
}
|
|
20728
|
-
return index2;
|
|
20729
|
-
}
|
|
20730
|
-
function hasSparklineAt(sheet, row2, col) {
|
|
20731
|
-
return hosts(sheet).has(cellKey(row2, col));
|
|
20732
|
-
}
|
|
20733
|
-
function resolveSparklineRange(workbook, sheet, formula) {
|
|
20734
|
-
const ref = formula.trim().replace(/^=/, "");
|
|
20735
|
-
const bang = ref.lastIndexOf("!");
|
|
20736
|
-
let target2 = sheet;
|
|
20737
|
-
if (bang >= 0) {
|
|
20738
|
-
const raw = ref.slice(0, bang);
|
|
20739
|
-
const name = /^'.*'$/.test(raw) ? raw.slice(1, -1).replace(/''/g, "'") : raw;
|
|
20740
|
-
target2 = sheetByName(workbook, name);
|
|
20741
|
-
}
|
|
20742
|
-
const range2 = parseRange(ref.slice(bang + 1).replace(/\$/g, ""));
|
|
20743
|
-
return target2 && range2 ? { sheet: target2, range: normalizeRange(range2) } : void 0;
|
|
20744
|
-
}
|
|
20745
|
-
var rowHidden = (sheet, row2) => sheet.rowInfo.get(row2)?.hidden === true;
|
|
20746
|
-
var colHidden = (sheet, col) => sheet.columns.some((c) => c.hidden === true && col >= c.min && col <= c.max);
|
|
20747
|
-
function readSparklineValues(sheet, range2, displayHidden) {
|
|
20748
|
-
let endRow = range2.end.row;
|
|
20749
|
-
if (endRow - range2.start.row >= MAX_POINTS) {
|
|
20750
|
-
let lastRow = range2.start.row;
|
|
20751
|
-
for (const row2 of sheet.rows.keys()) if (row2 > lastRow) lastRow = row2;
|
|
20752
|
-
endRow = Math.min(endRow, lastRow);
|
|
20753
|
-
}
|
|
20754
|
-
const out = [];
|
|
20755
|
-
for (let row2 = range2.start.row; row2 <= endRow && out.length < MAX_POINTS; row2++) {
|
|
20756
|
-
if (!displayHidden && rowHidden(sheet, row2)) continue;
|
|
20757
|
-
for (let col = range2.start.col; col <= range2.end.col && out.length < MAX_POINTS; col++) {
|
|
20758
|
-
if (!displayHidden && colHidden(sheet, col)) continue;
|
|
20759
|
-
const value2 = getCell(sheet, row2, col)?.value;
|
|
20760
|
-
out.push(typeof value2 === "number" && Number.isFinite(value2) ? value2 : null);
|
|
20761
|
-
}
|
|
20762
|
-
}
|
|
20763
|
-
return out;
|
|
20764
|
-
}
|
|
20765
|
-
function groupData(workbook, sheet, group) {
|
|
20766
|
-
const dateRange = group.dateAxis && group.dateFormula;
|
|
20767
|
-
const dates = dateRange ? resolveSparklineRange(workbook, sheet, dateRange) : void 0;
|
|
20768
|
-
const dateValues = dates ? readSparklineValues(dates.sheet, dates.range, group.displayHidden) : void 0;
|
|
20769
|
-
return group.sparklines.map((line2) => {
|
|
20770
|
-
const source = line2.formula ? resolveSparklineRange(workbook, sheet, line2.formula) : void 0;
|
|
20771
|
-
const values2 = source ? readSparklineValues(source.sheet, source.range, group.displayHidden) : [];
|
|
20772
|
-
return dateValues ? { values: values2, dates: dateValues } : { values: values2 };
|
|
20773
|
-
});
|
|
20774
|
-
}
|
|
20775
|
-
function sparklineViewAt(workbook, sheetIndex2, row2, col) {
|
|
20776
|
-
const sheet = workbook.sheets[sheetIndex2];
|
|
20777
|
-
if (!sheet) return void 0;
|
|
20778
|
-
const entry = hosts(sheet).get(cellKey(row2, col));
|
|
20779
|
-
if (!entry) return void 0;
|
|
20780
|
-
const { group, index: index2 } = entry;
|
|
20781
|
-
const needsGroup = group.minAxisType === "group" || group.maxAxisType === "group";
|
|
20782
|
-
const data = needsGroup ? groupData(workbook, sheet, group) : groupData(workbook, sheet, { ...group, sparklines: [group.sparklines[index2]] });
|
|
20783
|
-
const at = needsGroup ? index2 : 0;
|
|
20784
|
-
return sparklineView(
|
|
20785
|
-
group,
|
|
20786
|
-
data[at] ?? { values: [] },
|
|
20787
|
-
sparklineScale(group, data, at),
|
|
20788
|
-
workbook.theme
|
|
20789
|
-
);
|
|
20790
|
-
}
|
|
20791
|
-
|
|
20792
20792
|
// xlsx/layout/units.ts
|
|
20793
20793
|
var DEFAULT_MAX_DIGIT_WIDTH = 7;
|
|
20794
20794
|
var DEFAULT_BASE_COL_WIDTH = 8;
|
|
@@ -21359,13 +21359,14 @@ function duplicateSheet(ctx, index2) {
|
|
|
21359
21359
|
delete next.partName;
|
|
21360
21360
|
return next;
|
|
21361
21361
|
});
|
|
21362
|
-
|
|
21363
|
-
|
|
21364
|
-
|
|
21365
|
-
|
|
21366
|
-
|
|
21362
|
+
const rewrite = (formula) => renames.reduce(
|
|
21363
|
+
(f6, [from, to]) => renameTableInFormula(f6, from, to),
|
|
21364
|
+
renameSheetInFormula(formula, sheet.name, copy2.name)
|
|
21365
|
+
);
|
|
21366
|
+
rewriteSheetFormulas(copy2, rewrite);
|
|
21367
21367
|
for (const drawing of copy2.drawings) if (drawing.kind === "chart") delete drawing.partName;
|
|
21368
21368
|
const copiedNames = namesForCopy(workbook, index2, sheet.name, copy2.name);
|
|
21369
|
+
for (const name of copiedNames) name.formula = rewrite(name.formula);
|
|
21369
21370
|
workbook.sheets.splice(at, 0, copy2);
|
|
21370
21371
|
remapSheets(workbook, (i2) => i2 >= at ? i2 + 1 : i2);
|
|
21371
21372
|
for (const n of copiedNames) workbook.definedNames.push({ ...n, localSheet: at });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ChartObject, Workbook, Worksheet } from '../model.js';
|
|
2
|
+
/**
|
|
3
|
+
* A serialization-only chart with bounded local-range caches. Oversized or unresolvable
|
|
4
|
+
* references keep their imported caches; series names refresh only from single-cell ranges.
|
|
5
|
+
* Charts carried from the source package never use this helper.
|
|
6
|
+
*/
|
|
7
|
+
export declare function chartWithCurrentCaches(workbook: Workbook, sheet: Worksheet, chart: ChartObject): ChartObject;
|
|
8
|
+
//# sourceMappingURL=chart-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-cache.d.ts","sourceRoot":"","sources":["../../../xlsx/write/chart-cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAa,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAyC5E;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,WAAW,GAChB,WAAW,CAkBb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet-parts.d.ts","sourceRoot":"","sources":["../../../xlsx/write/sheet-parts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAQpD,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"sheet-parts.d.ts","sourceRoot":"","sources":["../../../xlsx/write/sheet-parts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAQpD,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAK5C,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,cAAc,CAAC;IACxB,uEAAuE;IACvE,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IAC5B,uFAAuF;IACvF,aAAa,CAAC,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;CACxB;AAED,wBAAgB,YAAY,CAC3B,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,GACd;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAQvC;AAED,wBAAgB,aAAa,CAC5B,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,eAAe,GACnB,MAAM,CAkER;AASD,wBAAgB,WAAW,CAC1B,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,MAAM,CA+CR;AAED,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,eAAe,EACrB,aAAa,EAAE,MAAM,GAAG,SAAS,GAC/B,MAAM,CA2BR"}
|