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