@pixerate/editor 0.141.0 → 0.143.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/agent/index.cjs +107 -48
- package/dist/agent/index.js +76 -17
- package/dist/agent/planner.d.cts +7 -2
- package/dist/agent/planner.d.ts +7 -2
- package/dist/agent/providers.d.cts +4 -1
- package/dist/agent/providers.d.ts +4 -1
- package/dist/animation-editor/index.cjs +69 -19
- package/dist/animation-editor/index.d.cts +1 -0
- package/dist/animation-editor/index.d.ts +1 -0
- package/dist/animation-editor/index.js +54 -4
- package/dist/animation-editor/playback.d.cts +10 -0
- package/dist/animation-editor/playback.d.ts +10 -0
- package/dist/canvas/index.cjs +103 -101
- package/dist/canvas/index.js +3 -1
- package/dist/canvas/layout.d.cts +15 -2
- package/dist/canvas/layout.d.ts +15 -2
- package/dist/chart/index.cjs +254 -170
- package/dist/chart/index.d.cts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.js +243 -159
- package/dist/chart/playback.d.cts +22 -0
- package/dist/chart/playback.d.ts +22 -0
- package/dist/{chunk-MFFE55CS.js → chunk-54GVEVXS.js} +6 -4
- package/dist/{chunk-E747F3D5.js → chunk-CC6WKVIH.js} +86 -5
- package/dist/{chunk-UBRYHNRU.cjs → chunk-EL4PSKFT.cjs} +46 -4
- package/dist/{chunk-VTY64I6H.cjs → chunk-QSM3MDDJ.cjs} +85 -85
- package/dist/{chunk-2RUNJYOX.cjs → chunk-QZFEX2N4.cjs} +86 -5
- package/dist/{chunk-DW4CV5H4.js → chunk-U4VE4UI2.js} +45 -3
- package/dist/{chunk-LMSFXRAJ.js → chunk-VGJTUCWM.js} +1 -1
- package/dist/{chunk-6SFREX6H.cjs → chunk-X2HQP7DF.cjs} +6 -4
- package/dist/chunk-XH32BATE.cjs +68 -0
- package/dist/chunk-Y6SGC6KO.js +68 -0
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.js +1 -1
- package/dist/index.cjs +7 -3
- package/dist/index.js +6 -2
- package/dist/paint-editor/index.cjs +67 -19
- package/dist/paint-editor/index.d.cts +1 -0
- package/dist/paint-editor/index.d.ts +1 -0
- package/dist/paint-editor/index.js +67 -19
- package/dist/paint-editor/playback.d.cts +16 -0
- package/dist/paint-editor/playback.d.ts +16 -0
- package/dist/parameters/index.cjs +32 -8
- package/dist/parameters/index.d.cts +1 -0
- package/dist/parameters/index.d.ts +1 -0
- package/dist/parameters/index.js +28 -4
- package/dist/parameters/playback.d.cts +10 -0
- package/dist/parameters/playback.d.ts +10 -0
- package/dist/spreadsheet/index.cjs +7 -3
- package/dist/spreadsheet/index.d.cts +1 -0
- package/dist/spreadsheet/index.d.ts +1 -0
- package/dist/spreadsheet/index.js +6 -2
- package/dist/spreadsheet/playback.d.cts +15 -0
- package/dist/spreadsheet/playback.d.ts +15 -0
- package/dist/tools/index.cjs +10 -3
- package/dist/tools/index.d.cts +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +9 -2
- package/dist/tools/script.d.cts +77 -0
- package/dist/tools/script.d.ts +77 -0
- package/dist/video-editor/index.cjs +81 -28
- package/dist/video-editor/index.d.cts +1 -0
- package/dist/video-editor/index.d.ts +1 -0
- package/dist/video-editor/index.js +58 -5
- package/dist/video-editor/playback.d.cts +20 -0
- package/dist/video-editor/playback.d.ts +20 -0
- package/package.json +1 -1
- package/skills/pixerate-animation-editor/SKILL.md +1 -0
- package/skills/pixerate-chart/SKILL.md +1 -0
- package/skills/pixerate-paint-editor/SKILL.md +1 -0
- package/skills/pixerate-parameters/SKILL.md +1 -0
- package/skills/pixerate-spreadsheet/SKILL.md +1 -0
- package/skills/pixerate-video-editor/SKILL.md +1 -0
- package/dist/chunk-PLKIYNJZ.js +0 -0
- package/dist/chunk-TNCWKC5M.cjs +0 -1
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
23
|
+
var _chunkQZFEX2N4cjs = require('./chunk-QZFEX2N4.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
@@ -82,7 +82,7 @@ function extractCellDependencies(node) {
|
|
|
82
82
|
deps.push({ col: curr.col, row: curr.row, ...sheet });
|
|
83
83
|
} else if (curr.type === "SpillRef") {
|
|
84
84
|
deps.push({ col: curr.col, row: curr.row, ...sheet });
|
|
85
|
-
} else if (curr.type === "Range" && curr.endRow >=
|
|
85
|
+
} else if (curr.type === "Range" && curr.endRow >= _chunkQZFEX2N4cjs.WHOLE_COLUMN_END_ROW) {
|
|
86
86
|
const startC = _chunk55AKPTLMcjs.colNameToIndex.call(void 0, curr.startCol);
|
|
87
87
|
const endC = _chunk55AKPTLMcjs.colNameToIndex.call(void 0, curr.endCol);
|
|
88
88
|
for (let c = Math.min(startC, endC); c <= Math.max(startC, endC); c++) {
|
|
@@ -129,13 +129,13 @@ function extractReferenceDependencies(node) {
|
|
|
129
129
|
case "Range": {
|
|
130
130
|
const startC = _chunk55AKPTLMcjs.colNameToIndex.call(void 0, curr.startCol);
|
|
131
131
|
const endC = _chunk55AKPTLMcjs.colNameToIndex.call(void 0, curr.endCol);
|
|
132
|
-
const whole = curr.endRow >=
|
|
132
|
+
const whole = curr.endRow >= _chunkQZFEX2N4cjs.WHOLE_COLUMN_END_ROW;
|
|
133
133
|
deps.push({
|
|
134
134
|
kind: "range",
|
|
135
135
|
startCol: _chunk55AKPTLMcjs.indexToColName.call(void 0, Math.min(startC, endC)),
|
|
136
136
|
endCol: _chunk55AKPTLMcjs.indexToColName.call(void 0, Math.max(startC, endC)),
|
|
137
137
|
startRow: whole ? 1 : Math.min(curr.startRow, curr.endRow),
|
|
138
|
-
endRow: whole ?
|
|
138
|
+
endRow: whole ? _chunkQZFEX2N4cjs.WHOLE_COLUMN_END_ROW : Math.max(curr.startRow, curr.endRow),
|
|
139
139
|
...sheet
|
|
140
140
|
});
|
|
141
141
|
break;
|
|
@@ -273,7 +273,7 @@ function parseKey(key) {
|
|
|
273
273
|
m = COLUMN_KEY.exec(ref);
|
|
274
274
|
if (m) {
|
|
275
275
|
const c = _chunk55AKPTLMcjs.colNameToIndex.call(void 0, m[1]);
|
|
276
|
-
return { kind: "range", sheet, c0: c, c1: c, r0: 1, r1:
|
|
276
|
+
return { kind: "range", sheet, c0: c, c1: c, r0: 1, r1: _chunkQZFEX2N4cjs.WHOLE_COLUMN_END_ROW };
|
|
277
277
|
}
|
|
278
278
|
return { kind: "opaque" };
|
|
279
279
|
}
|
|
@@ -411,7 +411,7 @@ var DependencyGraph = (_class2 = class {constructor() { _class2.prototype.__init
|
|
|
411
411
|
}
|
|
412
412
|
let ast;
|
|
413
413
|
try {
|
|
414
|
-
ast =
|
|
414
|
+
ast = _chunkQZFEX2N4cjs.parseFormula.call(void 0, formulaStr);
|
|
415
415
|
} catch (e2) {
|
|
416
416
|
this.setCellDependencies(key, []);
|
|
417
417
|
return;
|
|
@@ -419,7 +419,7 @@ var DependencyGraph = (_class2 = class {constructor() { _class2.prototype.__init
|
|
|
419
419
|
const keys = [];
|
|
420
420
|
for (const dep of extractReferenceDependencies(ast)) {
|
|
421
421
|
keys.push(
|
|
422
|
-
dep.kind === "cell" ? `${dep.col}${dep.row}` : dep.endRow >=
|
|
422
|
+
dep.kind === "cell" ? `${dep.col}${dep.row}` : dep.endRow >= _chunkQZFEX2N4cjs.WHOLE_COLUMN_END_ROW && dep.startCol === dep.endCol ? columnDependencyKey(dep.startCol) : rangeDependencyKey(dep.startCol, dep.startRow, dep.endCol, dep.endRow)
|
|
423
423
|
);
|
|
424
424
|
}
|
|
425
425
|
this.setCellDependencies(key, keys);
|
|
@@ -790,7 +790,7 @@ function mapFormulaReferences(formula, rewrite) {
|
|
|
790
790
|
if (!formula.startsWith("=")) return formula;
|
|
791
791
|
let tokens;
|
|
792
792
|
try {
|
|
793
|
-
tokens =
|
|
793
|
+
tokens = _chunkQZFEX2N4cjs.tokenizeFormula.call(void 0, formula);
|
|
794
794
|
} catch (e3) {
|
|
795
795
|
return formula;
|
|
796
796
|
}
|
|
@@ -919,7 +919,7 @@ function formatSheetPrefix(sheet, sheetEnd) {
|
|
|
919
919
|
function tokensOf(formula) {
|
|
920
920
|
if (!formula.startsWith("=")) return null;
|
|
921
921
|
try {
|
|
922
|
-
return
|
|
922
|
+
return _chunkQZFEX2N4cjs.tokenizeFormula.call(void 0, formula);
|
|
923
923
|
} catch (e4) {
|
|
924
924
|
return null;
|
|
925
925
|
}
|
|
@@ -1049,7 +1049,7 @@ function innermostCall(stack) {
|
|
|
1049
1049
|
}
|
|
1050
1050
|
var toSuggestion = (def) => ({
|
|
1051
1051
|
name: def.name,
|
|
1052
|
-
signature:
|
|
1052
|
+
signature: _chunkQZFEX2N4cjs.getFormulaSignature.call(void 0, def),
|
|
1053
1053
|
description: def.description,
|
|
1054
1054
|
category: def.category
|
|
1055
1055
|
});
|
|
@@ -1068,21 +1068,21 @@ function getFormulaHints(input, caret = input.length, options = {}) {
|
|
|
1068
1068
|
}));
|
|
1069
1069
|
suggestions = [
|
|
1070
1070
|
...names,
|
|
1071
|
-
...
|
|
1071
|
+
..._chunkQZFEX2N4cjs.searchFormulaFunctions.call(void 0, query, { limit: void 0 }).filter((def) => def.name.startsWith(query) && !names.some((n) => n.name.toUpperCase() === def.name)).map(toSuggestion)
|
|
1072
1072
|
].slice(0, _nullishCoalesce(options.limit, () => ( 8)));
|
|
1073
1073
|
const followedByParen = input.slice(context.prefix.end).trimStart().startsWith("(");
|
|
1074
1074
|
if (followedByParen || suggestions.length === 1 && suggestions[0].name.toUpperCase() === query) suggestions = [];
|
|
1075
1075
|
}
|
|
1076
1076
|
let activeCall = null;
|
|
1077
1077
|
if (context.call) {
|
|
1078
|
-
const def =
|
|
1078
|
+
const def = _chunkQZFEX2N4cjs.getFormulaFunction.call(void 0, context.call.name);
|
|
1079
1079
|
if (def) {
|
|
1080
|
-
const specIndex =
|
|
1080
|
+
const specIndex = _chunkQZFEX2N4cjs.getFormulaArgumentSpecIndex.call(void 0, def, context.call.argIndex);
|
|
1081
1081
|
activeCall = {
|
|
1082
1082
|
name: def.name,
|
|
1083
|
-
signature:
|
|
1083
|
+
signature: _chunkQZFEX2N4cjs.getFormulaSignature.call(void 0, def),
|
|
1084
1084
|
description: def.description,
|
|
1085
|
-
parts:
|
|
1085
|
+
parts: _chunkQZFEX2N4cjs.getFormulaSignatureParts.call(void 0, def, context.call.argIndex),
|
|
1086
1086
|
argIndex: context.call.argIndex,
|
|
1087
1087
|
argument: specIndex >= 0 ? def.args[specIndex] : null
|
|
1088
1088
|
};
|
|
@@ -1432,7 +1432,7 @@ function rebaseClipboardRows(rows, origin, target) {
|
|
|
1432
1432
|
|
|
1433
1433
|
// src/spreadsheet/rule-ranges.ts
|
|
1434
1434
|
function adjustRangeForStructuralChange(range, change) {
|
|
1435
|
-
const r =
|
|
1435
|
+
const r = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range);
|
|
1436
1436
|
const startKey = change.axis === "row" ? "startRow" : "startCol";
|
|
1437
1437
|
const endKey = change.axis === "row" ? "endRow" : "endCol";
|
|
1438
1438
|
if (change.type === "insert") {
|
|
@@ -1454,9 +1454,9 @@ function adjustRangesForStructuralChange(ranges, change) {
|
|
|
1454
1454
|
return out;
|
|
1455
1455
|
}
|
|
1456
1456
|
function subtractRange(range, cut) {
|
|
1457
|
-
const r =
|
|
1458
|
-
const c =
|
|
1459
|
-
if (!
|
|
1457
|
+
const r = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range);
|
|
1458
|
+
const c = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, cut);
|
|
1459
|
+
if (!_chunkQZFEX2N4cjs.rangesIntersect.call(void 0, r, c)) return [r];
|
|
1460
1460
|
const out = [];
|
|
1461
1461
|
const top = Math.max(r.startRow, c.startRow);
|
|
1462
1462
|
const bottom = Math.min(r.endRow, c.endRow);
|
|
@@ -1496,7 +1496,7 @@ function shiftRuleFormula(formula, change) {
|
|
|
1496
1496
|
function forEachRangeCell(ranges, rowCount, colCount, fn) {
|
|
1497
1497
|
const seen = ranges.length > 1 ? /* @__PURE__ */ new Set() : null;
|
|
1498
1498
|
for (const range of ranges) {
|
|
1499
|
-
const r =
|
|
1499
|
+
const r = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range);
|
|
1500
1500
|
const endRow = Math.min(r.endRow, rowCount - 1);
|
|
1501
1501
|
const endCol = Math.min(r.endCol, colCount - 1);
|
|
1502
1502
|
for (let row = Math.max(0, r.startRow); row <= endRow; row++) {
|
|
@@ -1513,7 +1513,7 @@ function forEachRangeCell(ranges, rowCount, colCount, fn) {
|
|
|
1513
1513
|
}
|
|
1514
1514
|
function formatRuleRanges(ranges) {
|
|
1515
1515
|
return ranges.map((range) => {
|
|
1516
|
-
const r =
|
|
1516
|
+
const r = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range);
|
|
1517
1517
|
const start = `${_chunk55AKPTLMcjs.indexToColName.call(void 0, r.startCol)}${r.startRow + 1}`;
|
|
1518
1518
|
const end = `${_chunk55AKPTLMcjs.indexToColName.call(void 0, r.endCol)}${r.endRow + 1}`;
|
|
1519
1519
|
return start === end ? start : `${start}:${end}`;
|
|
@@ -1532,14 +1532,14 @@ function parseRuleRanges(text) {
|
|
|
1532
1532
|
const endRow = m[4] ? Number(m[4]) - 1 : startRow;
|
|
1533
1533
|
const endCol = m[3] ? _chunk55AKPTLMcjs.colNameToIndex.call(void 0, m[3]) : startCol;
|
|
1534
1534
|
if (startRow < 0 || endRow < 0 || startCol < 0 || endCol < 0) return null;
|
|
1535
|
-
out.push(
|
|
1535
|
+
out.push(_chunkQZFEX2N4cjs.normalizeRange.call(void 0, { startRow, startCol, endRow, endCol }));
|
|
1536
1536
|
}
|
|
1537
1537
|
return out;
|
|
1538
1538
|
}
|
|
1539
1539
|
function mergeRuleRanges(ranges) {
|
|
1540
1540
|
const join = (list, across) => {
|
|
1541
1541
|
const [lo, hi, fixedLo, fixedHi] = across === "row" ? ["startRow", "endRow", "startCol", "endCol"] : ["startCol", "endCol", "startRow", "endRow"];
|
|
1542
|
-
const sorted = list.map(
|
|
1542
|
+
const sorted = list.map(_chunkQZFEX2N4cjs.normalizeRange).sort((a, b) => a[fixedLo] - b[fixedLo] || a[fixedHi] - b[fixedHi] || a[lo] - b[lo]);
|
|
1543
1543
|
const out = [];
|
|
1544
1544
|
for (const r of sorted) {
|
|
1545
1545
|
const last = out[out.length - 1];
|
|
@@ -1554,12 +1554,12 @@ function mergeRuleRanges(ranges) {
|
|
|
1554
1554
|
return join(join(ranges, "row"), "col").sort((a, b) => a.startRow - b.startRow || a.startCol - b.startCol);
|
|
1555
1555
|
}
|
|
1556
1556
|
function sortRuleRanges(ranges, block, newRowOf) {
|
|
1557
|
-
const b =
|
|
1557
|
+
const b = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, block);
|
|
1558
1558
|
let changed = false;
|
|
1559
1559
|
const pieces = [];
|
|
1560
1560
|
const moved = /* @__PURE__ */ new Map();
|
|
1561
1561
|
for (const range of ranges) {
|
|
1562
|
-
const r =
|
|
1562
|
+
const r = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range);
|
|
1563
1563
|
const top = Math.max(r.startRow, b.startRow);
|
|
1564
1564
|
const bottom = Math.min(r.endRow, b.endRow);
|
|
1565
1565
|
const left = Math.max(r.startCol, b.startCol);
|
|
@@ -1588,13 +1588,13 @@ function sortRuleRanges(ranges, block, newRowOf) {
|
|
|
1588
1588
|
return mergeRuleRanges(pieces);
|
|
1589
1589
|
}
|
|
1590
1590
|
function transposeRuleRanges(ranges, block, target) {
|
|
1591
|
-
const s =
|
|
1592
|
-
const t =
|
|
1593
|
-
if (!ranges.some((r) =>
|
|
1591
|
+
const s = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, block);
|
|
1592
|
+
const t = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, target);
|
|
1593
|
+
if (!ranges.some((r) => _chunkQZFEX2N4cjs.rangesIntersect.call(void 0, r, s) || _chunkQZFEX2N4cjs.rangesIntersect.call(void 0, r, t))) return null;
|
|
1594
1594
|
const inside = [];
|
|
1595
1595
|
for (const range of ranges) {
|
|
1596
|
-
const r =
|
|
1597
|
-
if (!
|
|
1596
|
+
const r = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range);
|
|
1597
|
+
if (!_chunkQZFEX2N4cjs.rangesIntersect.call(void 0, r, s)) continue;
|
|
1598
1598
|
const top = Math.max(r.startRow, s.startRow);
|
|
1599
1599
|
const bottom = Math.min(r.endRow, s.endRow);
|
|
1600
1600
|
const left = Math.max(r.startCol, s.startCol);
|
|
@@ -1617,7 +1617,7 @@ function reanchorRuleFormula(formula, from, to) {
|
|
|
1617
1617
|
}
|
|
1618
1618
|
function transposeRuleFormula(formula, anchor, block) {
|
|
1619
1619
|
const hadEquals = formula.trimStart().startsWith("=");
|
|
1620
|
-
const out = transposeFormulaReferences(withEquals(formula), anchor,
|
|
1620
|
+
const out = transposeFormulaReferences(withEquals(formula), anchor, _chunkQZFEX2N4cjs.normalizeRange.call(void 0, block));
|
|
1621
1621
|
return hadEquals ? out : out.slice(1);
|
|
1622
1622
|
}
|
|
1623
1623
|
var isFormulaText = (text) => text !== void 0 && text.trimStart().startsWith("=");
|
|
@@ -1666,7 +1666,7 @@ function sortRules(rules, block, newRowOf, mapFormulas) {
|
|
|
1666
1666
|
return changed ? out : rules;
|
|
1667
1667
|
}
|
|
1668
1668
|
function transposeRules(rules, block, target, mapFormulas, newId) {
|
|
1669
|
-
const s =
|
|
1669
|
+
const s = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, block);
|
|
1670
1670
|
let changed = false;
|
|
1671
1671
|
const out = [];
|
|
1672
1672
|
for (const rule of rules) {
|
|
@@ -1687,7 +1687,7 @@ function transposeRules(rules, block, target, mapFormulas, newId) {
|
|
|
1687
1687
|
const transposed = () => {
|
|
1688
1688
|
const next = { ...rule, ranges: inside };
|
|
1689
1689
|
if (!withFormulas) return next;
|
|
1690
|
-
const first2 = rule.ranges.map(
|
|
1690
|
+
const first2 = rule.ranges.map(_chunkQZFEX2N4cjs.normalizeRange).find((r) => _chunkQZFEX2N4cjs.rangesIntersect.call(void 0, r, s));
|
|
1691
1691
|
const at = { row: Math.max(first2.startRow, s.startRow), col: Math.max(first2.startCol, s.startCol) };
|
|
1692
1692
|
const atT = { row: s.startRow + (at.col - s.startCol), col: s.startCol + (at.row - s.startRow) };
|
|
1693
1693
|
const to = ruleAnchor(inside);
|
|
@@ -2604,7 +2604,7 @@ function rowPassesFilters(doc, rowIndex, getValue) {
|
|
|
2604
2604
|
return filter.rules.every((rule) => {
|
|
2605
2605
|
const colIndex = doc.columns.findIndex((c) => c.id === rule.colId);
|
|
2606
2606
|
if (colIndex === -1) return true;
|
|
2607
|
-
return
|
|
2607
|
+
return _chunkQZFEX2N4cjs.matchesFilterRule.call(void 0, getValue(rowIndex, colIndex), rule);
|
|
2608
2608
|
});
|
|
2609
2609
|
}
|
|
2610
2610
|
function computeRowGroups(doc, getValue) {
|
|
@@ -2617,18 +2617,18 @@ function computeRowGroups(doc, getValue) {
|
|
|
2617
2617
|
for (let r = headerRows; r < doc.rows.length - footerRows; r++) {
|
|
2618
2618
|
if (doc.rows[r].hidden || !rowPassesFilters(doc, r, getValue)) continue;
|
|
2619
2619
|
const value = getValue(r, groupCol);
|
|
2620
|
-
const key =
|
|
2620
|
+
const key = _chunkQZFEX2N4cjs.isBlankValue.call(void 0, value) ? "" : String(value).trim();
|
|
2621
2621
|
if (!byKey.has(key)) byKey.set(key, []);
|
|
2622
2622
|
byKey.get(key).push(r);
|
|
2623
2623
|
}
|
|
2624
2624
|
const collapsed = new Set(grouping.collapsed);
|
|
2625
|
-
return Array.from(byKey.keys()).sort((a, b) =>
|
|
2625
|
+
return Array.from(byKey.keys()).sort((a, b) => _chunkQZFEX2N4cjs.compareCellValues.call(void 0, a, b)).map((key) => {
|
|
2626
2626
|
const rowIndices = byKey.get(key);
|
|
2627
2627
|
const summaries = {};
|
|
2628
2628
|
for (const summary of grouping.summaries) {
|
|
2629
2629
|
const colIndex = doc.columns.findIndex((c) => c.id === summary.colId);
|
|
2630
2630
|
if (colIndex === -1) continue;
|
|
2631
|
-
summaries[summary.colId] =
|
|
2631
|
+
summaries[summary.colId] = _chunkQZFEX2N4cjs.aggregateValues.call(void 0,
|
|
2632
2632
|
rowIndices.map((r) => getValue(r, colIndex)),
|
|
2633
2633
|
summary.aggregate
|
|
2634
2634
|
);
|
|
@@ -2705,7 +2705,7 @@ function buildSpreadsheetView(doc, getValue) {
|
|
|
2705
2705
|
return { first: visible[0], run };
|
|
2706
2706
|
};
|
|
2707
2707
|
for (const raw of _nullishCoalesce(_optionalChain([doc, 'access', _95 => _95.table, 'optionalAccess', _96 => _96.merges]), () => ( []))) {
|
|
2708
|
-
const merge =
|
|
2708
|
+
const merge = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, raw);
|
|
2709
2709
|
const rowIdx = [];
|
|
2710
2710
|
const colIdx = [];
|
|
2711
2711
|
for (let r = merge.startRow; r <= merge.endRow; r++) rowIdx.push(r);
|
|
@@ -2921,7 +2921,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
2921
2921
|
if (options.dataSources) {
|
|
2922
2922
|
options.dataSources.forEach((ds) => this.binder.register(ds));
|
|
2923
2923
|
}
|
|
2924
|
-
this.evaluator = new (0,
|
|
2924
|
+
this.evaluator = new (0, _chunkQZFEX2N4cjs.FormulaEvaluator)({
|
|
2925
2925
|
resolveCell: (colStr, rowNum, sheet) => this.onSheet(sheet, () => this.resolveCellByCoord(colStr, rowNum)),
|
|
2926
2926
|
resolveRange: (sCol, sRow, eCol, eRow, sheet, options2) => this.onSheet(sheet, () => this.resolveRangeByCoords(sCol, sRow, eCol, eRow, options2)),
|
|
2927
2927
|
resolveProperty: (prop) => this.resolveCurrentRowProperty(prop),
|
|
@@ -3414,7 +3414,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
3414
3414
|
parseCached(formula) {
|
|
3415
3415
|
let ast = this.astCache.get(formula);
|
|
3416
3416
|
if (!ast) {
|
|
3417
|
-
ast =
|
|
3417
|
+
ast = _chunkQZFEX2N4cjs.parseFormula.call(void 0, formula);
|
|
3418
3418
|
if (this.astCache.size >= AST_CACHE_SIZE) this.astCache.clear();
|
|
3419
3419
|
this.astCache.set(formula, ast);
|
|
3420
3420
|
}
|
|
@@ -3447,7 +3447,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
3447
3447
|
}
|
|
3448
3448
|
for (const used of extractNameDependencies(ast)) {
|
|
3449
3449
|
if (used.call) {
|
|
3450
|
-
const fn =
|
|
3450
|
+
const fn = _chunkQZFEX2N4cjs.getFormulaFunction.call(void 0, used.name);
|
|
3451
3451
|
if (fn) {
|
|
3452
3452
|
if (fn.volatile) volatile.found = true;
|
|
3453
3453
|
continue;
|
|
@@ -3463,7 +3463,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
3463
3463
|
if (seenNames.has(seenKey)) continue;
|
|
3464
3464
|
seenNames.add(seenKey);
|
|
3465
3465
|
try {
|
|
3466
|
-
this.collectDependencies(
|
|
3466
|
+
this.collectDependencies(_chunkQZFEX2N4cjs.parseFormula.call(void 0, def.refersTo), nameHome, out, seenNames, volatile);
|
|
3467
3467
|
} catch (e11) {
|
|
3468
3468
|
}
|
|
3469
3469
|
}
|
|
@@ -3677,7 +3677,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
3677
3677
|
const blockers = [];
|
|
3678
3678
|
if (area.endRow >= this.document.rows.length || area.endCol >= this.document.columns.length) {
|
|
3679
3679
|
reason = `The ${rows}\xD7${cols} result needs ${label}, which extends past the edge of the sheet.`;
|
|
3680
|
-
} else if (this.getMerges().some((m) =>
|
|
3680
|
+
} else if (this.getMerges().some((m) => _chunkQZFEX2N4cjs.rangesIntersect.call(void 0, m, area))) {
|
|
3681
3681
|
reason = `The result can't spill into merged cells (it needs ${label}).`;
|
|
3682
3682
|
} else {
|
|
3683
3683
|
for (let c = area.startCol; c <= area.endCol; c++) {
|
|
@@ -3723,7 +3723,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
3723
3723
|
};
|
|
3724
3724
|
if (_chunk55AKPTLMcjs.isFormulaError.call(void 0, value)) {
|
|
3725
3725
|
display.error = value;
|
|
3726
|
-
display.errorMessage =
|
|
3726
|
+
display.errorMessage = _chunkQZFEX2N4cjs.describeFormulaError.call(void 0, value);
|
|
3727
3727
|
}
|
|
3728
3728
|
this.spillCells.set(spillCellId(rowObj.id, column.id), display);
|
|
3729
3729
|
if (this.spilledBy.get(key) !== anchor) {
|
|
@@ -3805,7 +3805,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
3805
3805
|
endRow: record.row + record.rows - 1,
|
|
3806
3806
|
endCol: record.col + record.cols - 1
|
|
3807
3807
|
};
|
|
3808
|
-
if (
|
|
3808
|
+
if (_chunkQZFEX2N4cjs.rangesIntersect.call(void 0, area, range)) return true;
|
|
3809
3809
|
}
|
|
3810
3810
|
return false;
|
|
3811
3811
|
}
|
|
@@ -3828,7 +3828,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
3828
3828
|
const minC = Math.min(startC, endC);
|
|
3829
3829
|
const maxC = Math.max(startC, endC);
|
|
3830
3830
|
const minR = Math.min(sRow, eRow);
|
|
3831
|
-
const maxR = Math.min(Math.max(sRow, eRow),
|
|
3831
|
+
const maxR = Math.min(Math.max(sRow, eRow), _chunkQZFEX2N4cjs.WHOLE_COLUMN_END_ROW, this.document.rows.length);
|
|
3832
3832
|
const skipBlanks = _optionalChain([options, 'optionalAccess', _177 => _177.skipBlanks]) === true;
|
|
3833
3833
|
const cacheable = this.rangeCache !== null && !this.valueOverride && (maxC - minC + 1) * (maxR - minR + 1) >= RANGE_CACHE_MIN_CELLS;
|
|
3834
3834
|
const cacheKey = cacheable ? `${this.document.id}|${minC}|${maxC}|${minR}|${maxR}|${skipBlanks ? 1 : 0}` : "";
|
|
@@ -4297,7 +4297,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4297
4297
|
}
|
|
4298
4298
|
/** The cells of `range` (or the whole sheet), row by row. */
|
|
4299
4299
|
readMatrix(range) {
|
|
4300
|
-
const r = range ?
|
|
4300
|
+
const r = range ? _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range) : null;
|
|
4301
4301
|
const rows = r ? this.document.rows.slice(r.startRow, r.endRow + 1) : this.document.rows;
|
|
4302
4302
|
const columns = r ? this.document.columns.slice(r.startCol, r.endCol + 1) : this.document.columns;
|
|
4303
4303
|
return rows.map((row) => columns.map((col) => this.getCell(row.id, col.id)));
|
|
@@ -4309,7 +4309,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4309
4309
|
* with `clipboardData.setData(type, data)` in a `copy` event.
|
|
4310
4310
|
*/
|
|
4311
4311
|
copyToClipboardData(range = this.selectedRange) {
|
|
4312
|
-
const r = range ?
|
|
4312
|
+
const r = range ? _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range) : { startRow: 0, startCol: 0, endRow: this.document.rows.length - 1, endCol: this.document.columns.length - 1 };
|
|
4313
4313
|
const cells = this.readMatrix(r).map(
|
|
4314
4314
|
(row) => row.map((cell) => {
|
|
4315
4315
|
const value = cell.error || cell.value;
|
|
@@ -4333,7 +4333,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4333
4333
|
const at = _nullishCoalesce(target, () => ( this.getSelectionTopLeft()));
|
|
4334
4334
|
const rows = parsed.origin ? rebaseClipboardRows(parsed.rows, parsed.origin, at) : parsed.rows;
|
|
4335
4335
|
this.writeMatrix(rows, at.row, at.col);
|
|
4336
|
-
const r =
|
|
4336
|
+
const r = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, {
|
|
4337
4337
|
startRow: at.row,
|
|
4338
4338
|
startCol: at.col,
|
|
4339
4339
|
endRow: at.row + rows.length - 1,
|
|
@@ -4344,11 +4344,11 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4344
4344
|
}
|
|
4345
4345
|
spillAnchorInRange(anchor, range) {
|
|
4346
4346
|
const record = this.spills.get(anchor);
|
|
4347
|
-
return !!record &&
|
|
4347
|
+
return !!record && _chunkQZFEX2N4cjs.rangeContains.call(void 0, range, record.row, record.col);
|
|
4348
4348
|
}
|
|
4349
4349
|
getSelectionTopLeft() {
|
|
4350
4350
|
if (this.selectedRange) {
|
|
4351
|
-
const r =
|
|
4351
|
+
const r = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, this.selectedRange);
|
|
4352
4352
|
return { row: r.startRow, col: r.startCol };
|
|
4353
4353
|
}
|
|
4354
4354
|
return { row: _nullishCoalesce(_optionalChain([this, 'access', _232 => _232.activeCell, 'optionalAccess', _233 => _233.row]), () => ( 0)), col: _nullishCoalesce(_optionalChain([this, 'access', _234 => _234.activeCell, 'optionalAccess', _235 => _235.col]), () => ( 0)) };
|
|
@@ -4417,7 +4417,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4417
4417
|
if (m[startKey] > change.index) m[startKey]--;
|
|
4418
4418
|
if (m[endKey] >= change.index) m[endKey]--;
|
|
4419
4419
|
}
|
|
4420
|
-
if (!
|
|
4420
|
+
if (!_chunkQZFEX2N4cjs.isSingleCellRange.call(void 0, m)) next.push(m);
|
|
4421
4421
|
}
|
|
4422
4422
|
this.document.table.merges = next;
|
|
4423
4423
|
}
|
|
@@ -4433,7 +4433,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4433
4433
|
sortRows(keys, options = {}) {
|
|
4434
4434
|
const colCount = this.document.columns.length;
|
|
4435
4435
|
const body = this.getBodyRowBounds();
|
|
4436
|
-
const range = options.range ?
|
|
4436
|
+
const range = options.range ? _chunkQZFEX2N4cjs.normalizeRange.call(void 0, options.range) : null;
|
|
4437
4437
|
const startRow = Math.max(_nullishCoalesce(_optionalChain([range, 'optionalAccess', _243 => _243.startRow]), () => ( body.start)), body.start);
|
|
4438
4438
|
const endRow = Math.min(_nullishCoalesce(_optionalChain([range, 'optionalAccess', _244 => _244.endRow]), () => ( body.end)), body.end);
|
|
4439
4439
|
const startCol = range ? Math.max(0, range.startCol) : 0;
|
|
@@ -4445,13 +4445,13 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4445
4445
|
}));
|
|
4446
4446
|
if (keyCols.length === 0 || keyCols.some((k) => k.index < startCol || k.index > endCol)) return false;
|
|
4447
4447
|
const area = { startRow, startCol, endRow, endCol };
|
|
4448
|
-
if ((_nullishCoalesce(_optionalChain([this, 'access', _245 => _245.document, 'access', _246 => _246.table, 'optionalAccess', _247 => _247.merges]), () => ( []))).some((m) =>
|
|
4448
|
+
if ((_nullishCoalesce(_optionalChain([this, 'access', _245 => _245.document, 'access', _246 => _246.table, 'optionalAccess', _247 => _247.merges]), () => ( []))).some((m) => _chunkQZFEX2N4cjs.rangesIntersect.call(void 0, m, area))) return false;
|
|
4449
4449
|
if (this.intersectsSpill(area)) return false;
|
|
4450
4450
|
const sourceRows = [];
|
|
4451
4451
|
for (let r = startRow; r <= endRow; r++) sourceRows.push(r);
|
|
4452
4452
|
const sorted = sourceRows.map((r) => ({ r, values: keyCols.map((k) => this.getCellValueAt(r, k.index)) })).sort((a, b) => {
|
|
4453
4453
|
for (let i = 0; i < keyCols.length; i++) {
|
|
4454
|
-
const result =
|
|
4454
|
+
const result = _chunkQZFEX2N4cjs.compareCellValues.call(void 0, a.values[i], b.values[i], keyCols[i].direction);
|
|
4455
4455
|
if (result !== 0) return result;
|
|
4456
4456
|
}
|
|
4457
4457
|
return a.r - b.r;
|
|
@@ -4588,7 +4588,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4588
4588
|
*/
|
|
4589
4589
|
setCellNumberFormat(range, code) {
|
|
4590
4590
|
if (!range) return false;
|
|
4591
|
-
const r =
|
|
4591
|
+
const r = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range);
|
|
4592
4592
|
this.recordSnapshot();
|
|
4593
4593
|
const kind = code === null ? void 0 : cellFormatForNumberFormat(code);
|
|
4594
4594
|
for (let ri = r.startRow; ri <= r.endRow; ri++) {
|
|
@@ -4703,16 +4703,16 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4703
4703
|
}
|
|
4704
4704
|
/** The merge containing (row, col), or null. */
|
|
4705
4705
|
getMergeAt(row, col) {
|
|
4706
|
-
return _nullishCoalesce(this.getMerges().find((m) =>
|
|
4706
|
+
return _nullishCoalesce(this.getMerges().find((m) => _chunkQZFEX2N4cjs.rangeContains.call(void 0, m, row, col)), () => ( null));
|
|
4707
4707
|
}
|
|
4708
4708
|
/** Grows `range` until no merge crosses its edge. Keeps the drag direction. */
|
|
4709
4709
|
expandRangeToMerges(range) {
|
|
4710
|
-
let r =
|
|
4710
|
+
let r = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range);
|
|
4711
4711
|
let changed = true;
|
|
4712
4712
|
while (changed) {
|
|
4713
4713
|
changed = false;
|
|
4714
4714
|
for (const m of this.getMerges()) {
|
|
4715
|
-
if (
|
|
4715
|
+
if (_chunkQZFEX2N4cjs.rangesIntersect.call(void 0, m, r) && !_chunkQZFEX2N4cjs.rangeContainsRange.call(void 0, r, m)) {
|
|
4716
4716
|
r = {
|
|
4717
4717
|
startRow: Math.min(r.startRow, m.startRow),
|
|
4718
4718
|
startCol: Math.min(r.startCol, m.startCol),
|
|
@@ -4740,12 +4740,12 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4740
4740
|
*/
|
|
4741
4741
|
mergeCells(range = this.selectedRange) {
|
|
4742
4742
|
if (!range) return false;
|
|
4743
|
-
const r =
|
|
4744
|
-
if (
|
|
4743
|
+
const r = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range);
|
|
4744
|
+
if (_chunkQZFEX2N4cjs.isSingleCellRange.call(void 0, r) || r.startRow < 0 || r.startCol < 0 || r.endRow >= this.document.rows.length || r.endCol >= this.document.columns.length) {
|
|
4745
4745
|
return false;
|
|
4746
4746
|
}
|
|
4747
4747
|
const merges = this.getMerges();
|
|
4748
|
-
if (merges.some((m) =>
|
|
4748
|
+
if (merges.some((m) => _chunkQZFEX2N4cjs.rangesIntersect.call(void 0, m, r) && !_chunkQZFEX2N4cjs.rangeContainsRange.call(void 0, r, m))) return false;
|
|
4749
4749
|
if (this.intersectsSpill(r)) return false;
|
|
4750
4750
|
this.applyTableChange(() => {
|
|
4751
4751
|
for (let row = r.startRow; row <= r.endRow; row++) {
|
|
@@ -4755,7 +4755,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4755
4755
|
_optionalChainDelete([this, 'access', _268 => _268.document, 'access', _269 => _269.cells, 'access', _270 => _270[rowId], 'optionalAccess', _271 => _271[this.document.columns[col].id]]);
|
|
4756
4756
|
}
|
|
4757
4757
|
}
|
|
4758
|
-
this.table.merges = [...merges.filter((m) => !
|
|
4758
|
+
this.table.merges = [...merges.filter((m) => !_chunkQZFEX2N4cjs.rangeContainsRange.call(void 0, r, m)), r];
|
|
4759
4759
|
}, { recalculate: true });
|
|
4760
4760
|
this.selectCell(r.startRow, r.startCol);
|
|
4761
4761
|
return true;
|
|
@@ -4764,7 +4764,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4764
4764
|
unmergeCells(range = this.selectedRange) {
|
|
4765
4765
|
if (!range) return false;
|
|
4766
4766
|
const merges = this.getMerges();
|
|
4767
|
-
const remaining = merges.filter((m) => !
|
|
4767
|
+
const remaining = merges.filter((m) => !_chunkQZFEX2N4cjs.rangesIntersect.call(void 0, m, range));
|
|
4768
4768
|
if (remaining.length === merges.length) return false;
|
|
4769
4769
|
this.applyTableChange(() => {
|
|
4770
4770
|
this.table.merges = remaining;
|
|
@@ -4781,9 +4781,9 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4781
4781
|
* the ranges don't line up.
|
|
4782
4782
|
*/
|
|
4783
4783
|
autofill(source, target) {
|
|
4784
|
-
const s =
|
|
4785
|
-
const t =
|
|
4786
|
-
const direction =
|
|
4784
|
+
const s = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, source);
|
|
4785
|
+
const t = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, target);
|
|
4786
|
+
const direction = _chunkQZFEX2N4cjs.getFillDirection.call(void 0, s, t);
|
|
4787
4787
|
if (!direction || t.startRow < 0 || t.startCol < 0) return false;
|
|
4788
4788
|
if (s.endRow >= this.document.rows.length || s.endCol >= this.document.columns.length) return false;
|
|
4789
4789
|
const vertical = direction === "down" || direction === "up";
|
|
@@ -4805,7 +4805,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4805
4805
|
return this.getCell(this.document.rows[p.row].id, this.document.columns[p.col].id).raw;
|
|
4806
4806
|
});
|
|
4807
4807
|
const hasFormula = raws.some((raw) => raw.startsWith("="));
|
|
4808
|
-
const series = hasFormula ? null :
|
|
4808
|
+
const series = hasFormula ? null : _chunkQZFEX2N4cjs.fillSeries.call(void 0, raws, fillSteps.length);
|
|
4809
4809
|
fillSteps.forEach((step, i) => {
|
|
4810
4810
|
const p = at(step);
|
|
4811
4811
|
let raw;
|
|
@@ -4883,17 +4883,17 @@ var SpreadsheetController = (_class6 = class {
|
|
|
4883
4883
|
*/
|
|
4884
4884
|
transposeRange(range = this.selectedRange) {
|
|
4885
4885
|
if (!range) return false;
|
|
4886
|
-
const s =
|
|
4887
|
-
if (
|
|
4886
|
+
const s = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, range);
|
|
4887
|
+
if (_chunkQZFEX2N4cjs.isSingleCellRange.call(void 0, s)) return false;
|
|
4888
4888
|
const height = s.endRow - s.startRow + 1;
|
|
4889
4889
|
const width = s.endCol - s.startCol + 1;
|
|
4890
4890
|
const t = { startRow: s.startRow, startCol: s.startCol, endRow: s.startRow + width - 1, endCol: s.startCol + height - 1 };
|
|
4891
|
-
if (this.getMerges().some((m) =>
|
|
4891
|
+
if (this.getMerges().some((m) => _chunkQZFEX2N4cjs.rangesIntersect.call(void 0, m, s) || _chunkQZFEX2N4cjs.rangesIntersect.call(void 0, m, t))) return false;
|
|
4892
4892
|
if (this.intersectsSpill(s) || this.intersectsSpill(t)) return false;
|
|
4893
4893
|
this.applyTableChange(() => {
|
|
4894
4894
|
this.growGrid(t.endRow, t.endCol);
|
|
4895
4895
|
this.remapAllFormulas(({ row, col }) => {
|
|
4896
|
-
if (!
|
|
4896
|
+
if (!_chunkQZFEX2N4cjs.rangeContains.call(void 0, s, row, col)) return null;
|
|
4897
4897
|
return { row: s.startRow + (col - s.startCol), col: s.startCol + (row - s.startRow) };
|
|
4898
4898
|
});
|
|
4899
4899
|
this.moveRulesForTranspose(s, t);
|
|
@@ -5165,7 +5165,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
5165
5165
|
if (invalid2) throw new Error(invalid2);
|
|
5166
5166
|
const formula = refersTo.trim().startsWith("=") ? refersTo.trim() : `=${refersTo.trim()}`;
|
|
5167
5167
|
try {
|
|
5168
|
-
|
|
5168
|
+
_chunkQZFEX2N4cjs.parseFormula.call(void 0, formula);
|
|
5169
5169
|
} catch (err) {
|
|
5170
5170
|
throw new Error(`There's a problem with this formula: ${_nullishCoalesce(_optionalChain([err, 'optionalAccess', _312 => _312.message]), () => ( formula))}`);
|
|
5171
5171
|
}
|
|
@@ -5538,7 +5538,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
5538
5538
|
*/
|
|
5539
5539
|
addConditionalFormat(rule, options = {}) {
|
|
5540
5540
|
const id = rule.id || this.generateRuleId("cf");
|
|
5541
|
-
const stored = { ...rule, id, ranges: rule.ranges.map((r) =>
|
|
5541
|
+
const stored = { ...rule, id, ranges: rule.ranges.map((r) => _chunkQZFEX2N4cjs.normalizeRange.call(void 0, r)) };
|
|
5542
5542
|
this.applyTableChange(() => {
|
|
5543
5543
|
const rules = [..._nullishCoalesce(this.table.conditionalFormats, () => ( []))];
|
|
5544
5544
|
if (options.priority === "last") rules.push(stored);
|
|
@@ -5555,7 +5555,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
5555
5555
|
this.applyTableChange(() => {
|
|
5556
5556
|
const next = [...rules];
|
|
5557
5557
|
const updated = { ...rules[index], ...changes, id };
|
|
5558
|
-
if (changes.ranges) updated.ranges = changes.ranges.map((r) =>
|
|
5558
|
+
if (changes.ranges) updated.ranges = changes.ranges.map((r) => _chunkQZFEX2N4cjs.normalizeRange.call(void 0, r));
|
|
5559
5559
|
next[index] = updated;
|
|
5560
5560
|
this.table.conditionalFormats = next;
|
|
5561
5561
|
});
|
|
@@ -5645,7 +5645,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
5645
5645
|
*/
|
|
5646
5646
|
addDataValidation(rule) {
|
|
5647
5647
|
const id = rule.id || this.generateRuleId("dv");
|
|
5648
|
-
const ranges = rule.ranges.map((r) =>
|
|
5648
|
+
const ranges = rule.ranges.map((r) => _chunkQZFEX2N4cjs.normalizeRange.call(void 0, r));
|
|
5649
5649
|
this.applyTableChange(() => {
|
|
5650
5650
|
let rules = _nullishCoalesce(this.table.dataValidations, () => ( []));
|
|
5651
5651
|
for (const cut of ranges) {
|
|
@@ -5663,7 +5663,7 @@ var SpreadsheetController = (_class6 = class {
|
|
|
5663
5663
|
this.applyTableChange(() => {
|
|
5664
5664
|
const next = [...rules];
|
|
5665
5665
|
const updated = { ...rules[index], ...changes, id };
|
|
5666
|
-
if (changes.ranges) updated.ranges = changes.ranges.map((r) =>
|
|
5666
|
+
if (changes.ranges) updated.ranges = changes.ranges.map((r) => _chunkQZFEX2N4cjs.normalizeRange.call(void 0, r));
|
|
5667
5667
|
next[index] = updated;
|
|
5668
5668
|
this.table.dataValidations = next;
|
|
5669
5669
|
});
|
|
@@ -5774,7 +5774,7 @@ function getSpreadsheetMenuItems(controller, cell) {
|
|
|
5774
5774
|
const column = doc.columns[cell.col];
|
|
5775
5775
|
const row = doc.rows[cell.row];
|
|
5776
5776
|
if (!column || !row) return [];
|
|
5777
|
-
const selection = controller.selectedRange &&
|
|
5777
|
+
const selection = controller.selectedRange && _chunkQZFEX2N4cjs.rangeContains.call(void 0, controller.selectedRange, cell.row, cell.col) ? _chunkQZFEX2N4cjs.normalizeRange.call(void 0, controller.selectedRange) : { startRow: cell.row, startCol: cell.col, endRow: cell.row, endCol: cell.col };
|
|
5778
5778
|
const colName = _chunk55AKPTLMcjs.indexToColName.call(void 0, cell.col);
|
|
5779
5779
|
const cellData = controller.getCell(row.id, column.id);
|
|
5780
5780
|
const value = cellData.value;
|
|
@@ -5784,8 +5784,8 @@ function getSpreadsheetMenuItems(controller, cell) {
|
|
|
5784
5784
|
const rows = Array.from({ length: selection.endRow - selection.startRow + 1 }, (_, i) => selection.startRow + i);
|
|
5785
5785
|
const cols = Array.from({ length: selection.endCol - selection.startCol + 1 }, (_, i) => selection.startCol + i);
|
|
5786
5786
|
const anyHidden = doc.rows.some((r) => r.hidden) || doc.columns.some((c) => c.hidden);
|
|
5787
|
-
const hasMerge = controller.getMerges().some((m) =>
|
|
5788
|
-
const sortRange =
|
|
5787
|
+
const hasMerge = controller.getMerges().some((m) => _chunkQZFEX2N4cjs.rangesIntersect.call(void 0, m, selection));
|
|
5788
|
+
const sortRange = _chunkQZFEX2N4cjs.isSingleCellRange.call(void 0, selection) ? null : selection;
|
|
5789
5789
|
const items = [
|
|
5790
5790
|
{
|
|
5791
5791
|
id: "sort-asc",
|
|
@@ -5866,7 +5866,7 @@ function getSpreadsheetMenuItems(controller, cell) {
|
|
|
5866
5866
|
id: "merge",
|
|
5867
5867
|
label: "Merge cells",
|
|
5868
5868
|
separatorBefore: true,
|
|
5869
|
-
disabled:
|
|
5869
|
+
disabled: _chunkQZFEX2N4cjs.isSingleCellRange.call(void 0, selection),
|
|
5870
5870
|
run: () => {
|
|
5871
5871
|
controller.mergeCells(selection);
|
|
5872
5872
|
}
|
|
@@ -5882,7 +5882,7 @@ function getSpreadsheetMenuItems(controller, cell) {
|
|
|
5882
5882
|
{
|
|
5883
5883
|
id: "transpose",
|
|
5884
5884
|
label: "Transpose",
|
|
5885
|
-
disabled:
|
|
5885
|
+
disabled: _chunkQZFEX2N4cjs.isSingleCellRange.call(void 0, selection),
|
|
5886
5886
|
run: () => {
|
|
5887
5887
|
controller.transposeRange(selection);
|
|
5888
5888
|
}
|
|
@@ -5940,8 +5940,8 @@ function getSpreadsheetMenuItems(controller, cell) {
|
|
|
5940
5940
|
}
|
|
5941
5941
|
function getRuleMenuItems(controller, selection) {
|
|
5942
5942
|
const ranges = [selection];
|
|
5943
|
-
const hasFormats = controller.getConditionalFormats().some((rule) => rule.ranges.some((r) =>
|
|
5944
|
-
const hasValidation = controller.getDataValidations().some((rule) => rule.ranges.some((r) =>
|
|
5943
|
+
const hasFormats = controller.getConditionalFormats().some((rule) => rule.ranges.some((r) => _chunkQZFEX2N4cjs.rangesIntersect.call(void 0, r, selection)));
|
|
5944
|
+
const hasValidation = controller.getDataValidations().some((rule) => rule.ranges.some((r) => _chunkQZFEX2N4cjs.rangesIntersect.call(void 0, r, selection)));
|
|
5945
5945
|
const add = (input) => {
|
|
5946
5946
|
controller.addConditionalFormat(createConditionalFormatRule({ ...input, ranges }));
|
|
5947
5947
|
};
|
|
@@ -6312,7 +6312,7 @@ function getSpreadsheetViewWindow(metrics, viewport, options = {}) {
|
|
|
6312
6312
|
for (let changed = merges.length > 0, guard = 0; changed && guard < 8; guard++) {
|
|
6313
6313
|
changed = false;
|
|
6314
6314
|
for (const raw of merges) {
|
|
6315
|
-
const merge =
|
|
6315
|
+
const merge = _chunkQZFEX2N4cjs.normalizeRange.call(void 0, raw);
|
|
6316
6316
|
const rows = displayedSpan(metrics.rowPosition, merge.startRow, merge.endRow);
|
|
6317
6317
|
const cols = displayedSpan(metrics.columnPosition, merge.startCol, merge.endCol);
|
|
6318
6318
|
if (!rows || !cols) continue;
|