@odoo/o-spreadsheet 16.0.46 → 16.0.47
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/o-spreadsheet.cjs.js +176 -157
- package/dist/o-spreadsheet.d.ts +4 -0
- package/dist/o-spreadsheet.esm.js +176 -157
- package/dist/o-spreadsheet.iife.js +176 -157
- package/dist/o-spreadsheet.iife.min.js +5 -5
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -8247,15 +8247,6 @@ function createLineChartRuntime(chart, getters) {
|
|
|
8247
8247
|
}
|
|
8248
8248
|
const colors = new ChartColors();
|
|
8249
8249
|
for (let [index, { label, data }] of dataSetsValues.entries()) {
|
|
8250
|
-
if (["linear", "time"].includes(axisType)) {
|
|
8251
|
-
// Replace empty string labels by undefined to make sure chartJS doesn't decide that "" is the same as 0
|
|
8252
|
-
data = data.map((y, index) => ({ x: labels[index] || undefined, y }));
|
|
8253
|
-
}
|
|
8254
|
-
const color = colors.next();
|
|
8255
|
-
let backgroundRGBA = colorToRGBA(color);
|
|
8256
|
-
if (chart.stacked) {
|
|
8257
|
-
backgroundRGBA.a = LINE_FILL_TRANSPARENCY;
|
|
8258
|
-
}
|
|
8259
8250
|
if (chart.cumulative) {
|
|
8260
8251
|
let accumulator = 0;
|
|
8261
8252
|
data = data.map((value) => {
|
|
@@ -8266,6 +8257,15 @@ function createLineChartRuntime(chart, getters) {
|
|
|
8266
8257
|
return value;
|
|
8267
8258
|
});
|
|
8268
8259
|
}
|
|
8260
|
+
if (["linear", "time"].includes(axisType)) {
|
|
8261
|
+
// Replace empty string labels by undefined to make sure chartJS doesn't decide that "" is the same as 0
|
|
8262
|
+
data = data.map((y, index) => ({ x: labels[index] || undefined, y }));
|
|
8263
|
+
}
|
|
8264
|
+
const color = colors.next();
|
|
8265
|
+
let backgroundRGBA = colorToRGBA(color);
|
|
8266
|
+
if (chart.stacked) {
|
|
8267
|
+
backgroundRGBA.a = LINE_FILL_TRANSPARENCY;
|
|
8268
|
+
}
|
|
8269
8269
|
const backgroundColor = rgbaToHex(backgroundRGBA);
|
|
8270
8270
|
const dataset = {
|
|
8271
8271
|
label,
|
|
@@ -11387,6 +11387,9 @@ function getPredicate(descr, isQuery) {
|
|
|
11387
11387
|
return result;
|
|
11388
11388
|
}
|
|
11389
11389
|
function operandToRegExp(operand) {
|
|
11390
|
+
if (operand === "*") {
|
|
11391
|
+
return /.+/;
|
|
11392
|
+
}
|
|
11390
11393
|
let exp = "";
|
|
11391
11394
|
let predecessor = "";
|
|
11392
11395
|
for (let char of operand) {
|
|
@@ -11410,9 +11413,9 @@ function operandToRegExp(operand) {
|
|
|
11410
11413
|
}
|
|
11411
11414
|
return new RegExp("^" + exp + "$", "i");
|
|
11412
11415
|
}
|
|
11413
|
-
function evaluatePredicate(value, criterion) {
|
|
11416
|
+
function evaluatePredicate(value = "", criterion) {
|
|
11414
11417
|
const { operator, operand } = criterion;
|
|
11415
|
-
if (
|
|
11418
|
+
if (operand === undefined) {
|
|
11416
11419
|
return false;
|
|
11417
11420
|
}
|
|
11418
11421
|
if (typeof operand === "number" && operator === "=") {
|
|
@@ -18401,6 +18404,147 @@ function tokenizeInvalidRange(chars) {
|
|
|
18401
18404
|
return null;
|
|
18402
18405
|
}
|
|
18403
18406
|
|
|
18407
|
+
var State;
|
|
18408
|
+
(function (State) {
|
|
18409
|
+
/**
|
|
18410
|
+
* Initial state.
|
|
18411
|
+
* Expecting any reference for the left part of a range
|
|
18412
|
+
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
18413
|
+
*/
|
|
18414
|
+
State[State["LeftRef"] = 0] = "LeftRef";
|
|
18415
|
+
/**
|
|
18416
|
+
* Expecting any reference for the right part of a range
|
|
18417
|
+
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
18418
|
+
*/
|
|
18419
|
+
State[State["RightRef"] = 1] = "RightRef";
|
|
18420
|
+
/**
|
|
18421
|
+
* Expecting the separator without any constraint on the right part
|
|
18422
|
+
*/
|
|
18423
|
+
State[State["Separator"] = 2] = "Separator";
|
|
18424
|
+
/**
|
|
18425
|
+
* Expecting the separator for a full column range
|
|
18426
|
+
*/
|
|
18427
|
+
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
18428
|
+
/**
|
|
18429
|
+
* Expecting the separator for a full row range
|
|
18430
|
+
*/
|
|
18431
|
+
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
18432
|
+
/**
|
|
18433
|
+
* Expecting the right part of a full column range
|
|
18434
|
+
* e.g. "1", "A1"
|
|
18435
|
+
*/
|
|
18436
|
+
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
18437
|
+
/**
|
|
18438
|
+
* Expecting the right part of a full row range
|
|
18439
|
+
* e.g. "A", "A1"
|
|
18440
|
+
*/
|
|
18441
|
+
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
18442
|
+
/**
|
|
18443
|
+
* Final state. A range has been matched
|
|
18444
|
+
*/
|
|
18445
|
+
State[State["Found"] = 7] = "Found";
|
|
18446
|
+
})(State || (State = {}));
|
|
18447
|
+
const goTo = (state, guard = () => true) => [
|
|
18448
|
+
{
|
|
18449
|
+
goTo: state,
|
|
18450
|
+
guard,
|
|
18451
|
+
},
|
|
18452
|
+
];
|
|
18453
|
+
const goToMulti = (state, guard = () => true) => ({
|
|
18454
|
+
goTo: state,
|
|
18455
|
+
guard,
|
|
18456
|
+
});
|
|
18457
|
+
const machine = {
|
|
18458
|
+
[State.LeftRef]: {
|
|
18459
|
+
REFERENCE: goTo(State.Separator),
|
|
18460
|
+
NUMBER: goTo(State.FullRowSeparator),
|
|
18461
|
+
SYMBOL: [
|
|
18462
|
+
goToMulti(State.FullColumnSeparator, (token) => isColReference(token.value)),
|
|
18463
|
+
goToMulti(State.FullRowSeparator, (token) => isRowReference(token.value)),
|
|
18464
|
+
],
|
|
18465
|
+
},
|
|
18466
|
+
[State.FullColumnSeparator]: {
|
|
18467
|
+
SPACE: goTo(State.FullColumnSeparator),
|
|
18468
|
+
OPERATOR: goTo(State.RightColumnRef, (token) => token.value === ":"),
|
|
18469
|
+
},
|
|
18470
|
+
[State.FullRowSeparator]: {
|
|
18471
|
+
SPACE: goTo(State.FullRowSeparator),
|
|
18472
|
+
OPERATOR: goTo(State.RightRowRef, (token) => token.value === ":"),
|
|
18473
|
+
},
|
|
18474
|
+
[State.Separator]: {
|
|
18475
|
+
SPACE: goTo(State.Separator),
|
|
18476
|
+
OPERATOR: goTo(State.RightRef, (token) => token.value === ":"),
|
|
18477
|
+
},
|
|
18478
|
+
[State.RightRef]: {
|
|
18479
|
+
SPACE: goTo(State.RightRef),
|
|
18480
|
+
NUMBER: goTo(State.Found),
|
|
18481
|
+
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
18482
|
+
SYMBOL: goTo(State.Found, (token) => isColHeader(token.value) || isRowHeader(token.value)),
|
|
18483
|
+
},
|
|
18484
|
+
[State.RightColumnRef]: {
|
|
18485
|
+
SPACE: goTo(State.RightColumnRef),
|
|
18486
|
+
SYMBOL: goTo(State.Found, (token) => isColHeader(token.value)),
|
|
18487
|
+
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
18488
|
+
},
|
|
18489
|
+
[State.RightRowRef]: {
|
|
18490
|
+
SPACE: goTo(State.RightRowRef),
|
|
18491
|
+
NUMBER: goTo(State.Found),
|
|
18492
|
+
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
18493
|
+
SYMBOL: goTo(State.Found, (token) => isRowHeader(token.value)),
|
|
18494
|
+
},
|
|
18495
|
+
[State.Found]: {},
|
|
18496
|
+
};
|
|
18497
|
+
/**
|
|
18498
|
+
* Check if the list of tokens starts with a sequence of tokens representing
|
|
18499
|
+
* a range.
|
|
18500
|
+
* If a range is found, the sequence is removed from the list and is returned
|
|
18501
|
+
* as a single token.
|
|
18502
|
+
*/
|
|
18503
|
+
function matchReference(tokens) {
|
|
18504
|
+
var _a;
|
|
18505
|
+
let head = 0;
|
|
18506
|
+
let transitions = machine[State.LeftRef];
|
|
18507
|
+
let matchedTokens = "";
|
|
18508
|
+
while (transitions !== undefined) {
|
|
18509
|
+
const token = tokens[head++];
|
|
18510
|
+
if (!token) {
|
|
18511
|
+
return null;
|
|
18512
|
+
}
|
|
18513
|
+
const transition = (_a = transitions[token.type]) === null || _a === void 0 ? void 0 : _a.find((transition) => transition.guard(token));
|
|
18514
|
+
const nextState = transition ? transition.goTo : undefined;
|
|
18515
|
+
switch (nextState) {
|
|
18516
|
+
case undefined:
|
|
18517
|
+
return null;
|
|
18518
|
+
case State.Found:
|
|
18519
|
+
matchedTokens += token.value;
|
|
18520
|
+
tokens.splice(0, head);
|
|
18521
|
+
return {
|
|
18522
|
+
type: "REFERENCE",
|
|
18523
|
+
value: matchedTokens,
|
|
18524
|
+
};
|
|
18525
|
+
default:
|
|
18526
|
+
transitions = machine[nextState];
|
|
18527
|
+
matchedTokens += token.value;
|
|
18528
|
+
break;
|
|
18529
|
+
}
|
|
18530
|
+
}
|
|
18531
|
+
return null;
|
|
18532
|
+
}
|
|
18533
|
+
/**
|
|
18534
|
+
* Take the result of the tokenizer and transform it to be usable in the
|
|
18535
|
+
* manipulations of range
|
|
18536
|
+
*
|
|
18537
|
+
* @param formula
|
|
18538
|
+
*/
|
|
18539
|
+
function rangeTokenize(formula) {
|
|
18540
|
+
const tokens = tokenize(formula);
|
|
18541
|
+
const result = [];
|
|
18542
|
+
while (tokens.length) {
|
|
18543
|
+
result.push(matchReference(tokens) || tokens.shift());
|
|
18544
|
+
}
|
|
18545
|
+
return result;
|
|
18546
|
+
}
|
|
18547
|
+
|
|
18404
18548
|
const functionRegex = /[a-zA-Z0-9\_]+(\.[a-zA-Z0-9\_]+)*/;
|
|
18405
18549
|
const UNARY_OPERATORS_PREFIX = ["-", "+"];
|
|
18406
18550
|
const UNARY_OPERATORS_POSTFIX = ["%"];
|
|
@@ -18567,7 +18711,7 @@ function parseExpression(tokens, bp) {
|
|
|
18567
18711
|
* Parse an expression (as a string) into an AST.
|
|
18568
18712
|
*/
|
|
18569
18713
|
function parse(str) {
|
|
18570
|
-
return parseTokens(
|
|
18714
|
+
return parseTokens(rangeTokenize(str));
|
|
18571
18715
|
}
|
|
18572
18716
|
function parseTokens(tokens) {
|
|
18573
18717
|
tokens = tokens.filter((x) => x.type !== "SPACE");
|
|
@@ -18679,147 +18823,6 @@ function rightOperandToFormula(operationAST) {
|
|
|
18679
18823
|
return needParenthesis ? `(${astToFormula(rightOperation)})` : astToFormula(rightOperation);
|
|
18680
18824
|
}
|
|
18681
18825
|
|
|
18682
|
-
var State;
|
|
18683
|
-
(function (State) {
|
|
18684
|
-
/**
|
|
18685
|
-
* Initial state.
|
|
18686
|
-
* Expecting any reference for the left part of a range
|
|
18687
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
18688
|
-
*/
|
|
18689
|
-
State[State["LeftRef"] = 0] = "LeftRef";
|
|
18690
|
-
/**
|
|
18691
|
-
* Expecting any reference for the right part of a range
|
|
18692
|
-
* e.g. "A1", "1", "A", "Sheet1!A1", "Sheet1!A"
|
|
18693
|
-
*/
|
|
18694
|
-
State[State["RightRef"] = 1] = "RightRef";
|
|
18695
|
-
/**
|
|
18696
|
-
* Expecting the separator without any constraint on the right part
|
|
18697
|
-
*/
|
|
18698
|
-
State[State["Separator"] = 2] = "Separator";
|
|
18699
|
-
/**
|
|
18700
|
-
* Expecting the separator for a full column range
|
|
18701
|
-
*/
|
|
18702
|
-
State[State["FullColumnSeparator"] = 3] = "FullColumnSeparator";
|
|
18703
|
-
/**
|
|
18704
|
-
* Expecting the separator for a full row range
|
|
18705
|
-
*/
|
|
18706
|
-
State[State["FullRowSeparator"] = 4] = "FullRowSeparator";
|
|
18707
|
-
/**
|
|
18708
|
-
* Expecting the right part of a full column range
|
|
18709
|
-
* e.g. "1", "A1"
|
|
18710
|
-
*/
|
|
18711
|
-
State[State["RightColumnRef"] = 5] = "RightColumnRef";
|
|
18712
|
-
/**
|
|
18713
|
-
* Expecting the right part of a full row range
|
|
18714
|
-
* e.g. "A", "A1"
|
|
18715
|
-
*/
|
|
18716
|
-
State[State["RightRowRef"] = 6] = "RightRowRef";
|
|
18717
|
-
/**
|
|
18718
|
-
* Final state. A range has been matched
|
|
18719
|
-
*/
|
|
18720
|
-
State[State["Found"] = 7] = "Found";
|
|
18721
|
-
})(State || (State = {}));
|
|
18722
|
-
const goTo = (state, guard = () => true) => [
|
|
18723
|
-
{
|
|
18724
|
-
goTo: state,
|
|
18725
|
-
guard,
|
|
18726
|
-
},
|
|
18727
|
-
];
|
|
18728
|
-
const goToMulti = (state, guard = () => true) => ({
|
|
18729
|
-
goTo: state,
|
|
18730
|
-
guard,
|
|
18731
|
-
});
|
|
18732
|
-
const machine = {
|
|
18733
|
-
[State.LeftRef]: {
|
|
18734
|
-
REFERENCE: goTo(State.Separator),
|
|
18735
|
-
NUMBER: goTo(State.FullRowSeparator),
|
|
18736
|
-
SYMBOL: [
|
|
18737
|
-
goToMulti(State.FullColumnSeparator, (token) => isColReference(token.value)),
|
|
18738
|
-
goToMulti(State.FullRowSeparator, (token) => isRowReference(token.value)),
|
|
18739
|
-
],
|
|
18740
|
-
},
|
|
18741
|
-
[State.FullColumnSeparator]: {
|
|
18742
|
-
SPACE: goTo(State.FullColumnSeparator),
|
|
18743
|
-
OPERATOR: goTo(State.RightColumnRef, (token) => token.value === ":"),
|
|
18744
|
-
},
|
|
18745
|
-
[State.FullRowSeparator]: {
|
|
18746
|
-
SPACE: goTo(State.FullRowSeparator),
|
|
18747
|
-
OPERATOR: goTo(State.RightRowRef, (token) => token.value === ":"),
|
|
18748
|
-
},
|
|
18749
|
-
[State.Separator]: {
|
|
18750
|
-
SPACE: goTo(State.Separator),
|
|
18751
|
-
OPERATOR: goTo(State.RightRef, (token) => token.value === ":"),
|
|
18752
|
-
},
|
|
18753
|
-
[State.RightRef]: {
|
|
18754
|
-
SPACE: goTo(State.RightRef),
|
|
18755
|
-
NUMBER: goTo(State.Found),
|
|
18756
|
-
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
18757
|
-
SYMBOL: goTo(State.Found, (token) => isColHeader(token.value) || isRowHeader(token.value)),
|
|
18758
|
-
},
|
|
18759
|
-
[State.RightColumnRef]: {
|
|
18760
|
-
SPACE: goTo(State.RightColumnRef),
|
|
18761
|
-
SYMBOL: goTo(State.Found, (token) => isColHeader(token.value)),
|
|
18762
|
-
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
18763
|
-
},
|
|
18764
|
-
[State.RightRowRef]: {
|
|
18765
|
-
SPACE: goTo(State.RightRowRef),
|
|
18766
|
-
NUMBER: goTo(State.Found),
|
|
18767
|
-
REFERENCE: goTo(State.Found, (token) => isSingleCellReference(token.value)),
|
|
18768
|
-
SYMBOL: goTo(State.Found, (token) => isRowHeader(token.value)),
|
|
18769
|
-
},
|
|
18770
|
-
[State.Found]: {},
|
|
18771
|
-
};
|
|
18772
|
-
/**
|
|
18773
|
-
* Check if the list of tokens starts with a sequence of tokens representing
|
|
18774
|
-
* a range.
|
|
18775
|
-
* If a range is found, the sequence is removed from the list and is returned
|
|
18776
|
-
* as a single token.
|
|
18777
|
-
*/
|
|
18778
|
-
function matchReference(tokens) {
|
|
18779
|
-
var _a;
|
|
18780
|
-
let head = 0;
|
|
18781
|
-
let transitions = machine[State.LeftRef];
|
|
18782
|
-
let matchedTokens = "";
|
|
18783
|
-
while (transitions !== undefined) {
|
|
18784
|
-
const token = tokens[head++];
|
|
18785
|
-
if (!token) {
|
|
18786
|
-
return null;
|
|
18787
|
-
}
|
|
18788
|
-
const transition = (_a = transitions[token.type]) === null || _a === void 0 ? void 0 : _a.find((transition) => transition.guard(token));
|
|
18789
|
-
const nextState = transition ? transition.goTo : undefined;
|
|
18790
|
-
switch (nextState) {
|
|
18791
|
-
case undefined:
|
|
18792
|
-
return null;
|
|
18793
|
-
case State.Found:
|
|
18794
|
-
matchedTokens += token.value;
|
|
18795
|
-
tokens.splice(0, head);
|
|
18796
|
-
return {
|
|
18797
|
-
type: "REFERENCE",
|
|
18798
|
-
value: matchedTokens,
|
|
18799
|
-
};
|
|
18800
|
-
default:
|
|
18801
|
-
transitions = machine[nextState];
|
|
18802
|
-
matchedTokens += token.value;
|
|
18803
|
-
break;
|
|
18804
|
-
}
|
|
18805
|
-
}
|
|
18806
|
-
return null;
|
|
18807
|
-
}
|
|
18808
|
-
/**
|
|
18809
|
-
* Take the result of the tokenizer and transform it to be usable in the
|
|
18810
|
-
* manipulations of range
|
|
18811
|
-
*
|
|
18812
|
-
* @param formula
|
|
18813
|
-
*/
|
|
18814
|
-
function rangeTokenize(formula) {
|
|
18815
|
-
const tokens = tokenize(formula);
|
|
18816
|
-
const result = [];
|
|
18817
|
-
while (tokens.length) {
|
|
18818
|
-
result.push(matchReference(tokens) || tokens.shift());
|
|
18819
|
-
}
|
|
18820
|
-
return result;
|
|
18821
|
-
}
|
|
18822
|
-
|
|
18823
18826
|
const functions$2 = functionRegistry.content;
|
|
18824
18827
|
const OPERATOR_MAP = {
|
|
18825
18828
|
"=": "EQ",
|
|
@@ -27602,6 +27605,22 @@ class BordersPlugin extends CorePlugin {
|
|
|
27602
27605
|
return [];
|
|
27603
27606
|
return Object.keys(sheetBorders).map((index) => parseInt(index, 10));
|
|
27604
27607
|
}
|
|
27608
|
+
/**
|
|
27609
|
+
* Get all the rows which contains at least a border
|
|
27610
|
+
*/
|
|
27611
|
+
getRowsWithBorders(sheetId) {
|
|
27612
|
+
var _a;
|
|
27613
|
+
const sheetBorders = (_a = this.borders[sheetId]) === null || _a === void 0 ? void 0 : _a.filter(isDefined$1);
|
|
27614
|
+
if (!sheetBorders)
|
|
27615
|
+
return [];
|
|
27616
|
+
const rowsWithBorders = new Set();
|
|
27617
|
+
for (const rowBorders of sheetBorders) {
|
|
27618
|
+
for (const rowBorder in rowBorders) {
|
|
27619
|
+
rowsWithBorders.add(parseInt(rowBorder, 10));
|
|
27620
|
+
}
|
|
27621
|
+
}
|
|
27622
|
+
return Array.from(rowsWithBorders);
|
|
27623
|
+
}
|
|
27605
27624
|
/**
|
|
27606
27625
|
* Get the range of all the rows in the sheet
|
|
27607
27626
|
*/
|
|
@@ -27651,7 +27670,7 @@ class BordersPlugin extends CorePlugin {
|
|
|
27651
27670
|
destructive: false,
|
|
27652
27671
|
});
|
|
27653
27672
|
}
|
|
27654
|
-
this.
|
|
27673
|
+
this.getRowsWithBorders(sheetId)
|
|
27655
27674
|
.filter((row) => row >= start)
|
|
27656
27675
|
.sort((a, b) => (delta < 0 ? a - b : b - a)) // start by the end when moving up
|
|
27657
27676
|
.forEach((row) => {
|
|
@@ -43385,6 +43404,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
43385
43404
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
43386
43405
|
|
|
43387
43406
|
|
|
43388
|
-
__info__.version = '16.0.
|
|
43389
|
-
__info__.date = '2024-07-
|
|
43390
|
-
__info__.hash = '
|
|
43407
|
+
__info__.version = '16.0.47';
|
|
43408
|
+
__info__.date = '2024-07-08T05:37:37.541Z';
|
|
43409
|
+
__info__.hash = 'f52ca6f';
|