@odoo/o-spreadsheet 17.4.0-alpha.12 → 17.4.0-alpha.13
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 +527 -112
- package/dist/o-spreadsheet.d.ts +42 -26
- package/dist/o-spreadsheet.esm.js +527 -112
- package/dist/o-spreadsheet.iife.js +527 -112
- package/dist/o-spreadsheet.iife.min.js +345 -345
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 17.4.0-alpha.
|
|
6
|
-
* @date 2024-07-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.4.0-alpha.13
|
|
6
|
+
* @date 2024-07-11T06:36:58.556Z
|
|
7
|
+
* @hash e0f506b
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -592,7 +592,7 @@ function getAddHeaderStartIndex(position, base) {
|
|
|
592
592
|
/**
|
|
593
593
|
* Compares two objects.
|
|
594
594
|
*/
|
|
595
|
-
function deepEquals(o1, o2
|
|
595
|
+
function deepEquals(o1, o2) {
|
|
596
596
|
if (o1 === o2)
|
|
597
597
|
return true;
|
|
598
598
|
if ((o1 && !o2) || (o2 && !o1))
|
|
@@ -608,17 +608,13 @@ function deepEquals(o1, o2, ignoreFunctions) {
|
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
610
|
for (const key in o1) {
|
|
611
|
-
|
|
612
|
-
if (typeOfO1Key !== typeof o2[key])
|
|
611
|
+
if (typeof o1[key] !== typeof o2[key])
|
|
613
612
|
return false;
|
|
614
|
-
if (
|
|
615
|
-
if (!deepEquals(o1[key], o2[key]
|
|
613
|
+
if (typeof o1[key] === "object") {
|
|
614
|
+
if (!deepEquals(o1[key], o2[key]))
|
|
616
615
|
return false;
|
|
617
616
|
}
|
|
618
617
|
else {
|
|
619
|
-
if (ignoreFunctions && typeOfO1Key === "function") {
|
|
620
|
-
continue;
|
|
621
|
-
}
|
|
622
618
|
if (o1[key] !== o2[key])
|
|
623
619
|
return false;
|
|
624
620
|
}
|
|
@@ -2641,11 +2637,11 @@ function generateMatrix(nColumns, nRows, callback) {
|
|
|
2641
2637
|
}
|
|
2642
2638
|
return returned;
|
|
2643
2639
|
}
|
|
2644
|
-
function matrixMap(matrix,
|
|
2640
|
+
function matrixMap(matrix, callback) {
|
|
2645
2641
|
if (matrix.length === 0) {
|
|
2646
2642
|
return [];
|
|
2647
2643
|
}
|
|
2648
|
-
return generateMatrix(matrix.length, matrix[0].length, (col, row) =>
|
|
2644
|
+
return generateMatrix(matrix.length, matrix[0].length, (col, row) => callback(matrix[col][row]));
|
|
2649
2645
|
}
|
|
2650
2646
|
function matrixForEach(matrix, fn) {
|
|
2651
2647
|
const numberOfCols = matrix.length;
|
|
@@ -2745,6 +2741,9 @@ function getPredicate(descr, locale) {
|
|
|
2745
2741
|
* If the character is a special regular expression character, it is escaped with "\\".
|
|
2746
2742
|
*/
|
|
2747
2743
|
const wildcardToRegExp = memoize(function wildcardToRegExp(operand) {
|
|
2744
|
+
if (operand === "*") {
|
|
2745
|
+
return /.+/;
|
|
2746
|
+
}
|
|
2748
2747
|
let exp = "";
|
|
2749
2748
|
let predecessor = "";
|
|
2750
2749
|
for (let char of operand) {
|
|
@@ -2768,9 +2767,9 @@ const wildcardToRegExp = memoize(function wildcardToRegExp(operand) {
|
|
|
2768
2767
|
}
|
|
2769
2768
|
return new RegExp("^" + exp + "$", "i");
|
|
2770
2769
|
});
|
|
2771
|
-
function evaluatePredicate(value, criterion) {
|
|
2770
|
+
function evaluatePredicate(value = "", criterion) {
|
|
2772
2771
|
const { operator, operand } = criterion;
|
|
2773
|
-
if (
|
|
2772
|
+
if (operand === undefined || value === null || operand === null) {
|
|
2774
2773
|
return false;
|
|
2775
2774
|
}
|
|
2776
2775
|
if (typeof operand === "number" && operator === "=") {
|
|
@@ -8073,8 +8072,8 @@ function detectLink(value) {
|
|
|
8073
8072
|
|
|
8074
8073
|
function evaluateLiteral(literalCell, localeFormat) {
|
|
8075
8074
|
const value = localeFormat.format === PLAIN_TEXT_FORMAT ? literalCell.content : literalCell.parsedValue;
|
|
8076
|
-
const
|
|
8077
|
-
return createEvaluatedCell(
|
|
8075
|
+
const functionResult = { value, format: localeFormat.format };
|
|
8076
|
+
return createEvaluatedCell(functionResult, localeFormat.locale);
|
|
8078
8077
|
}
|
|
8079
8078
|
function parseLiteral(content, locale) {
|
|
8080
8079
|
if (content.startsWith("=")) {
|
|
@@ -8095,13 +8094,13 @@ function parseLiteral(content, locale) {
|
|
|
8095
8094
|
}
|
|
8096
8095
|
return content;
|
|
8097
8096
|
}
|
|
8098
|
-
function createEvaluatedCell(
|
|
8099
|
-
const link = detectLink(
|
|
8097
|
+
function createEvaluatedCell(functionResult, locale = DEFAULT_LOCALE, cell) {
|
|
8098
|
+
const link = detectLink(functionResult.value);
|
|
8100
8099
|
if (!link) {
|
|
8101
|
-
return _createEvaluatedCell(
|
|
8100
|
+
return _createEvaluatedCell(functionResult, locale, cell);
|
|
8102
8101
|
}
|
|
8103
8102
|
const value = parseLiteral(link.label, locale);
|
|
8104
|
-
const format =
|
|
8103
|
+
const format = functionResult.format ||
|
|
8105
8104
|
(typeof value === "number"
|
|
8106
8105
|
? detectDateFormat(link.label, locale) || detectNumberFormat(link.label)
|
|
8107
8106
|
: undefined);
|
|
@@ -8114,8 +8113,8 @@ function createEvaluatedCell(fPayload, locale = DEFAULT_LOCALE, cell) {
|
|
|
8114
8113
|
link,
|
|
8115
8114
|
};
|
|
8116
8115
|
}
|
|
8117
|
-
function _createEvaluatedCell(
|
|
8118
|
-
let { value, format, message } =
|
|
8116
|
+
function _createEvaluatedCell(functionResult, locale, cell) {
|
|
8117
|
+
let { value, format, message } = functionResult;
|
|
8119
8118
|
format = cell?.format || format;
|
|
8120
8119
|
const formattedValue = formatValue(value, { format, locale });
|
|
8121
8120
|
if (isEvaluationError(value)) {
|
|
@@ -10302,7 +10301,6 @@ function getNextNonEmptyBar(bars, startIndex) {
|
|
|
10302
10301
|
return bars.find((bar, i) => i > startIndex && bar.height !== 0);
|
|
10303
10302
|
}
|
|
10304
10303
|
|
|
10305
|
-
// @ts-ignore
|
|
10306
10304
|
window.Chart?.register(waterfallLinesPlugin);
|
|
10307
10305
|
class ChartJsComponent extends owl.Component {
|
|
10308
10306
|
static template = "o-spreadsheet-ChartJsComponent";
|
|
@@ -10335,7 +10333,7 @@ class ChartJsComponent extends owl.Component {
|
|
|
10335
10333
|
owl.onWillUnmount(() => this.chart?.destroy());
|
|
10336
10334
|
owl.useEffect(() => {
|
|
10337
10335
|
const runtime = this.chartRuntime;
|
|
10338
|
-
if (
|
|
10336
|
+
if (runtime !== this.currentRuntime) {
|
|
10339
10337
|
if (runtime.chartJsConfig.type !== this.currentRuntime.chartJsConfig.type) {
|
|
10340
10338
|
this.chart?.destroy();
|
|
10341
10339
|
this.createChart(deepCopy(runtime.chartJsConfig));
|
|
@@ -10350,7 +10348,6 @@ class ChartJsComponent extends owl.Component {
|
|
|
10350
10348
|
createChart(chartData) {
|
|
10351
10349
|
const canvas = this.canvas.el;
|
|
10352
10350
|
const ctx = canvas.getContext("2d");
|
|
10353
|
-
// @ts-ignore
|
|
10354
10351
|
this.chart = new window.Chart(ctx, chartData);
|
|
10355
10352
|
}
|
|
10356
10353
|
updateChartJs(chartRuntime) {
|
|
@@ -19102,7 +19099,7 @@ const PIVOT = {
|
|
|
19102
19099
|
arg("include_column_titles (boolean, default=TRUE)", _t("Whether to include the column titles or not.")),
|
|
19103
19100
|
arg("column_count (number, optional)", _t("number of columns")),
|
|
19104
19101
|
],
|
|
19105
|
-
compute: function (pivotFormulaId, rowCount = { value:
|
|
19102
|
+
compute: function (pivotFormulaId, rowCount = { value: 10000 }, includeTotal = { value: true }, includeColumnHeaders = { value: true }, columnCount = { value: Number.MAX_VALUE }) {
|
|
19106
19103
|
const _pivotFormulaId = toString(pivotFormulaId);
|
|
19107
19104
|
const _rowCount = toNumber(rowCount, this.locale);
|
|
19108
19105
|
if (_rowCount < 0) {
|
|
@@ -19526,6 +19523,320 @@ var operators = /*#__PURE__*/Object.freeze({
|
|
|
19526
19523
|
UPLUS: UPLUS
|
|
19527
19524
|
});
|
|
19528
19525
|
|
|
19526
|
+
const transformFromFactor = (factor) => ({
|
|
19527
|
+
transform: (x) => x * factor,
|
|
19528
|
+
inverseTransform: (x) => x / factor,
|
|
19529
|
+
});
|
|
19530
|
+
const standard = { transform: (x) => x, inverseTransform: (x) => x };
|
|
19531
|
+
const ANG2M = 1e-10;
|
|
19532
|
+
const IN2M = 0.0254;
|
|
19533
|
+
const PICAPT2M = IN2M / 72;
|
|
19534
|
+
const FT2M = 0.3048;
|
|
19535
|
+
const YD2M = 0.9144;
|
|
19536
|
+
const MI2M = 1609.34;
|
|
19537
|
+
const NMI2M = 1852;
|
|
19538
|
+
const LY2M = 9.46073047258e15;
|
|
19539
|
+
const UNITS = {
|
|
19540
|
+
// WEIGHT UNITs : Standard = gramme
|
|
19541
|
+
g: { ...standard, category: "weight" },
|
|
19542
|
+
u: { ...transformFromFactor(1.66053e-24), category: "weight" },
|
|
19543
|
+
grain: { ...transformFromFactor(0.0647989), category: "weight" },
|
|
19544
|
+
ozm: { ...transformFromFactor(28.3495), category: "weight" },
|
|
19545
|
+
lbm: { ...transformFromFactor(453.592), category: "weight" },
|
|
19546
|
+
stone: { ...transformFromFactor(6350.29), category: "weight" },
|
|
19547
|
+
sg: { ...transformFromFactor(14593.90294), category: "weight" },
|
|
19548
|
+
cwt: { ...transformFromFactor(45359.237), category: "weight" },
|
|
19549
|
+
uk_cwt: { ...transformFromFactor(50802.3), category: "weight" },
|
|
19550
|
+
ton: { ...transformFromFactor(907184.74), category: "weight" },
|
|
19551
|
+
uk_ton: { ...transformFromFactor(1016046.9), category: "weight" },
|
|
19552
|
+
// DISTANCE UNITS : Standard = meter
|
|
19553
|
+
m: { ...standard, category: "distance" },
|
|
19554
|
+
km: { ...transformFromFactor(1000), category: "distance" },
|
|
19555
|
+
ang: { ...transformFromFactor(ANG2M), category: "distance" },
|
|
19556
|
+
Picapt: { ...transformFromFactor(PICAPT2M), category: "distance" },
|
|
19557
|
+
pica: { ...transformFromFactor(IN2M / 6), category: "distance" },
|
|
19558
|
+
in: { ...transformFromFactor(IN2M), category: "distance" },
|
|
19559
|
+
ft: { ...transformFromFactor(FT2M), category: "distance" },
|
|
19560
|
+
yd: { ...transformFromFactor(YD2M), category: "distance" },
|
|
19561
|
+
ell: { ...transformFromFactor(1.143), category: "distance" },
|
|
19562
|
+
mi: { ...transformFromFactor(MI2M), category: "distance" },
|
|
19563
|
+
survey_mi: { ...transformFromFactor(1609.34), category: "distance" },
|
|
19564
|
+
Nmi: { ...transformFromFactor(NMI2M), category: "distance" },
|
|
19565
|
+
ly: { ...transformFromFactor(LY2M), category: "distance" },
|
|
19566
|
+
parsec: { ...transformFromFactor(3.0856775814914e16), category: "distance" },
|
|
19567
|
+
// TIME UNITS : Standard = second
|
|
19568
|
+
sec: { ...standard, category: "time" },
|
|
19569
|
+
min: { ...transformFromFactor(60), category: "time" },
|
|
19570
|
+
hr: { ...transformFromFactor(3600), category: "time" },
|
|
19571
|
+
day: { ...transformFromFactor(86400), category: "time" },
|
|
19572
|
+
yr: { ...transformFromFactor(31556952), category: "time" },
|
|
19573
|
+
// PRESSURE UNITS : Standard = Pascal
|
|
19574
|
+
Pa: { ...standard, category: "pressure" },
|
|
19575
|
+
bar: { ...transformFromFactor(100000), category: "pressure" },
|
|
19576
|
+
mmHg: { ...transformFromFactor(133.322), category: "pressure" },
|
|
19577
|
+
Torr: { ...transformFromFactor(133.322), category: "pressure" },
|
|
19578
|
+
psi: { ...transformFromFactor(6894.76), category: "pressure" },
|
|
19579
|
+
atm: { ...transformFromFactor(101325), category: "pressure" },
|
|
19580
|
+
// FORCE UNITS : Standard = Newton
|
|
19581
|
+
N: { ...standard, category: "force" },
|
|
19582
|
+
dyn: { ...transformFromFactor(1e-5), category: "force" },
|
|
19583
|
+
pond: { ...transformFromFactor(0.00980665), category: "force" },
|
|
19584
|
+
lbf: { ...transformFromFactor(4.44822), category: "force" },
|
|
19585
|
+
// ENERGY UNITS : Standard = Joule
|
|
19586
|
+
J: { ...standard, category: "energy" },
|
|
19587
|
+
eV: { ...transformFromFactor(1.60218e-19), category: "energy" },
|
|
19588
|
+
e: { ...transformFromFactor(1e-7), category: "energy" },
|
|
19589
|
+
flb: { ...transformFromFactor(1.3558179483), category: "energy" },
|
|
19590
|
+
c: { ...transformFromFactor(4.184), category: "energy" },
|
|
19591
|
+
cal: { ...transformFromFactor(4.1868), category: "energy" },
|
|
19592
|
+
BTU: { ...transformFromFactor(1055.06), category: "energy" },
|
|
19593
|
+
Wh: { ...transformFromFactor(3600), category: "energy" },
|
|
19594
|
+
HPh: { ...transformFromFactor(2684520), category: "energy" },
|
|
19595
|
+
// POWER UNITS : Standard = Watt
|
|
19596
|
+
W: { ...standard, category: "power" },
|
|
19597
|
+
PS: { ...transformFromFactor(735.499), category: "power" },
|
|
19598
|
+
HP: { ...transformFromFactor(745.7), category: "power" },
|
|
19599
|
+
// MAGNETISM UNITS : Standard = Tesla
|
|
19600
|
+
T: { ...standard, category: "magnetism" },
|
|
19601
|
+
ga: { ...transformFromFactor(1e-4), category: "magnetism" },
|
|
19602
|
+
// TEMPERATURE UNITS : Standard = Kelvin
|
|
19603
|
+
K: { ...standard, category: "temperature" },
|
|
19604
|
+
C: {
|
|
19605
|
+
transform: (T) => T + 273.15,
|
|
19606
|
+
inverseTransform: (T) => T - 273.15,
|
|
19607
|
+
category: "temperature",
|
|
19608
|
+
},
|
|
19609
|
+
F: {
|
|
19610
|
+
transform: (T) => ((T - 32) * 5) / 9 + 273.15,
|
|
19611
|
+
inverseTransform: (T) => ((T - 273.15) * 9) / 5 + 32,
|
|
19612
|
+
category: "temperature",
|
|
19613
|
+
},
|
|
19614
|
+
Rank: { ...transformFromFactor(5 / 9), category: "temperature" },
|
|
19615
|
+
Reau: {
|
|
19616
|
+
transform: (T) => T * 1.25 + 273.15,
|
|
19617
|
+
inverseTransform: (T) => (T - 273.15) / 1.25,
|
|
19618
|
+
category: "temperature",
|
|
19619
|
+
},
|
|
19620
|
+
// VOLUME UNITS : Standard = cubic meter
|
|
19621
|
+
"m^3": { ...standard, category: "volume", order: 3 },
|
|
19622
|
+
"ang^3": { ...transformFromFactor(Math.pow(ANG2M, 3)), category: "volume", order: 3 },
|
|
19623
|
+
"Picapt^3": { ...transformFromFactor(Math.pow(PICAPT2M, 3)), category: "volume", order: 3 },
|
|
19624
|
+
tsp: { ...transformFromFactor(4.92892e-6), category: "volume" },
|
|
19625
|
+
tspm: { ...transformFromFactor(5e-6), category: "volume" },
|
|
19626
|
+
tbs: { ...transformFromFactor(1.4786764825785619e-5), category: "volume" },
|
|
19627
|
+
"in^3": { ...transformFromFactor(Math.pow(IN2M, 3)), category: "volume", order: 3 },
|
|
19628
|
+
oz: { ...transformFromFactor(2.95735295625e-5), category: "volume" },
|
|
19629
|
+
cup: { ...transformFromFactor(0.000237), category: "volume" },
|
|
19630
|
+
pt: { ...transformFromFactor(0.0004731765), category: "volume" },
|
|
19631
|
+
uk_pt: { ...transformFromFactor(0.000568261), category: "volume" },
|
|
19632
|
+
qt: { ...transformFromFactor(0.0009463529), category: "volume" },
|
|
19633
|
+
l: { ...transformFromFactor(1e-3), category: "volume" },
|
|
19634
|
+
uk_qt: { ...transformFromFactor(0.0011365225), category: "volume" },
|
|
19635
|
+
gal: { ...transformFromFactor(0.0037854118), category: "volume" },
|
|
19636
|
+
uk_gal: { ...transformFromFactor(0.00454609), category: "volume" },
|
|
19637
|
+
"ft^3": { ...transformFromFactor(Math.pow(FT2M, 3)), category: "volume", order: 3 },
|
|
19638
|
+
bushel: { ...transformFromFactor(0.0352390704), category: "volume" },
|
|
19639
|
+
barrel: { ...transformFromFactor(0.158987295), category: "volume" },
|
|
19640
|
+
"yd^3": { ...transformFromFactor(Math.pow(YD2M, 3)), category: "volume", order: 3 },
|
|
19641
|
+
MTON: { ...transformFromFactor(1.13267386368), category: "volume" },
|
|
19642
|
+
GRT: { ...transformFromFactor(2.83168), category: "volume" },
|
|
19643
|
+
"mi^3": { ...transformFromFactor(Math.pow(MI2M, 3)), category: "volume", order: 3 },
|
|
19644
|
+
"Nmi^3": { ...transformFromFactor(Math.pow(NMI2M, 3)), category: "volume", order: 3 },
|
|
19645
|
+
"ly^3": { ...transformFromFactor(Math.pow(LY2M, 3)), category: "volume", order: 3 },
|
|
19646
|
+
// AREA UNITS : Standard = square meter
|
|
19647
|
+
"m^2": { ...standard, category: "area", order: 2 },
|
|
19648
|
+
"ang^2": { ...transformFromFactor(Math.pow(ANG2M, 2)), category: "area", order: 2 },
|
|
19649
|
+
"Picapt^2": { ...transformFromFactor(Math.pow(PICAPT2M, 2)), category: "area", order: 2 },
|
|
19650
|
+
"in^2": { ...transformFromFactor(Math.pow(IN2M, 2)), category: "area", order: 2 },
|
|
19651
|
+
"ft^2": { ...transformFromFactor(Math.pow(FT2M, 2)), category: "area", order: 2 },
|
|
19652
|
+
"yd^2": { ...transformFromFactor(Math.pow(YD2M, 2)), category: "area", order: 2 },
|
|
19653
|
+
ar: { ...transformFromFactor(100), category: "area" },
|
|
19654
|
+
Morgen: { ...transformFromFactor(2500), category: "area" },
|
|
19655
|
+
uk_acre: { ...transformFromFactor(4046.8564224), category: "area" },
|
|
19656
|
+
us_acre: { ...transformFromFactor(4046.8726098743), category: "area" },
|
|
19657
|
+
ha: { ...transformFromFactor(1e4), category: "area" },
|
|
19658
|
+
"mi^2": { ...transformFromFactor(Math.pow(MI2M, 2)), category: "area", order: 2 },
|
|
19659
|
+
"Nmi^2": { ...transformFromFactor(Math.pow(NMI2M, 2)), category: "area", order: 2 },
|
|
19660
|
+
"ly^2": { ...transformFromFactor(Math.pow(LY2M, 2)), category: "area", order: 2 },
|
|
19661
|
+
// INFORMATION UNITS : Standard = bit
|
|
19662
|
+
bit: { ...standard, category: "information" },
|
|
19663
|
+
byte: { ...transformFromFactor(8), category: "information" },
|
|
19664
|
+
// SPEED UNITS : Standard = m/s
|
|
19665
|
+
"m/s": { ...standard, category: "speed" },
|
|
19666
|
+
"m/hr": { ...transformFromFactor(1 / 3600), category: "speed" },
|
|
19667
|
+
"km/hr": { ...transformFromFactor(1 / 3.6), category: "speed" },
|
|
19668
|
+
mph: { ...transformFromFactor(0.44704), category: "speed" },
|
|
19669
|
+
kn: { ...transformFromFactor(0.5144444444), category: "speed" },
|
|
19670
|
+
admkn: { ...transformFromFactor(0.5147733333), category: "speed" },
|
|
19671
|
+
};
|
|
19672
|
+
const UNITS_ALIASES = {
|
|
19673
|
+
shweight: "cwt",
|
|
19674
|
+
lcwt: "uk_cwt",
|
|
19675
|
+
hweight: "uk_cwt",
|
|
19676
|
+
LTON: "uk_ton",
|
|
19677
|
+
brton: "uk_ton",
|
|
19678
|
+
pc: "parsec",
|
|
19679
|
+
Pica: "Picapt",
|
|
19680
|
+
d: "day",
|
|
19681
|
+
mn: "min",
|
|
19682
|
+
s: "sec",
|
|
19683
|
+
p: "Pa",
|
|
19684
|
+
at: "atm",
|
|
19685
|
+
dy: "dyn",
|
|
19686
|
+
ev: "eV",
|
|
19687
|
+
hh: "HPh",
|
|
19688
|
+
wh: "Wh",
|
|
19689
|
+
btu: "BTU",
|
|
19690
|
+
h: "HP",
|
|
19691
|
+
cel: "C",
|
|
19692
|
+
fah: "F",
|
|
19693
|
+
kel: "K",
|
|
19694
|
+
us_pt: "pt",
|
|
19695
|
+
L: "l",
|
|
19696
|
+
lt: "l",
|
|
19697
|
+
ang3: "ang^3",
|
|
19698
|
+
ft3: "ft^3",
|
|
19699
|
+
in3: "in^3",
|
|
19700
|
+
ly3: "ly^3",
|
|
19701
|
+
m3: "m^3",
|
|
19702
|
+
mi3: "mi^3",
|
|
19703
|
+
yd3: "yd^3",
|
|
19704
|
+
Nmi3: "Nmi^3",
|
|
19705
|
+
Picapt3: "Picapt^3",
|
|
19706
|
+
"Pica^3": "Picapt^3",
|
|
19707
|
+
Pica3: "Picapt^3",
|
|
19708
|
+
regton: "GRT",
|
|
19709
|
+
ang2: "ang^2",
|
|
19710
|
+
ft2: "ft^2",
|
|
19711
|
+
in2: "in^2",
|
|
19712
|
+
ly2: "ly^2",
|
|
19713
|
+
m2: "m^2",
|
|
19714
|
+
mi2: "mi^2",
|
|
19715
|
+
Nmi2: "Nmi^2",
|
|
19716
|
+
Picapt2: "Picapt^2",
|
|
19717
|
+
"Pica^2": "Picapt^2",
|
|
19718
|
+
Pica2: "Picapt^2",
|
|
19719
|
+
yd2: "yd^2",
|
|
19720
|
+
"m/h": "m/hr",
|
|
19721
|
+
"m/sec": "m/s",
|
|
19722
|
+
};
|
|
19723
|
+
const UNIT_PREFIXES = {
|
|
19724
|
+
"": 1,
|
|
19725
|
+
Y: 1e24,
|
|
19726
|
+
Z: 1e21,
|
|
19727
|
+
E: 1e18,
|
|
19728
|
+
P: 1e15,
|
|
19729
|
+
T: 1e12,
|
|
19730
|
+
G: 1e9,
|
|
19731
|
+
M: 1e6,
|
|
19732
|
+
k: 1e3,
|
|
19733
|
+
h: 1e2,
|
|
19734
|
+
da: 1e1,
|
|
19735
|
+
e: 1e1,
|
|
19736
|
+
d: 1e-1,
|
|
19737
|
+
c: 1e-2,
|
|
19738
|
+
m: 1e-3,
|
|
19739
|
+
u: 1e-6,
|
|
19740
|
+
n: 1e-9,
|
|
19741
|
+
p: 1e-12,
|
|
19742
|
+
f: 1e-15,
|
|
19743
|
+
a: 1e-18,
|
|
19744
|
+
z: 1e-21,
|
|
19745
|
+
y: 1e-21,
|
|
19746
|
+
Yi: Math.pow(2, 80),
|
|
19747
|
+
Zi: Math.pow(2, 70),
|
|
19748
|
+
Ei: Math.pow(2, 60),
|
|
19749
|
+
Pi: Math.pow(2, 50),
|
|
19750
|
+
Ti: Math.pow(2, 40),
|
|
19751
|
+
Gi: Math.pow(2, 30),
|
|
19752
|
+
Mi: Math.pow(2, 20),
|
|
19753
|
+
ki: Math.pow(2, 10),
|
|
19754
|
+
};
|
|
19755
|
+
const TRANSLATED_CATEGORIES = {
|
|
19756
|
+
weight: _t("Weight"),
|
|
19757
|
+
distance: _t("Distance"),
|
|
19758
|
+
time: _t("Time"),
|
|
19759
|
+
pressure: _t("Pressure"),
|
|
19760
|
+
force: _t("Force"),
|
|
19761
|
+
energy: _t("Energy"),
|
|
19762
|
+
power: _t("Power"),
|
|
19763
|
+
magnetism: _t("Magnetism"),
|
|
19764
|
+
temperature: _t("Temperature"),
|
|
19765
|
+
volume: _t("Volume"),
|
|
19766
|
+
area: _t("Area"),
|
|
19767
|
+
information: _t("Information"),
|
|
19768
|
+
speed: _t("Speed"),
|
|
19769
|
+
};
|
|
19770
|
+
function getTranslatedCategory(key) {
|
|
19771
|
+
return TRANSLATED_CATEGORIES[key] ?? "";
|
|
19772
|
+
}
|
|
19773
|
+
function getTransformation(key) {
|
|
19774
|
+
for (const [prefix, value] of Object.entries(UNIT_PREFIXES)) {
|
|
19775
|
+
if (prefix && !key.startsWith(prefix))
|
|
19776
|
+
continue;
|
|
19777
|
+
const _key = key.slice(prefix.length);
|
|
19778
|
+
let conversion = UNITS[_key];
|
|
19779
|
+
if (!conversion && UNITS_ALIASES[_key]) {
|
|
19780
|
+
conversion = UNITS[UNITS_ALIASES[_key]];
|
|
19781
|
+
}
|
|
19782
|
+
if (conversion) {
|
|
19783
|
+
return {
|
|
19784
|
+
...conversion,
|
|
19785
|
+
factor: conversion.order ? Math.pow(value, conversion.order) : value,
|
|
19786
|
+
};
|
|
19787
|
+
}
|
|
19788
|
+
}
|
|
19789
|
+
return;
|
|
19790
|
+
}
|
|
19791
|
+
|
|
19792
|
+
// -----------------------------------------------------------------------------
|
|
19793
|
+
// CONVERT
|
|
19794
|
+
// -----------------------------------------------------------------------------
|
|
19795
|
+
const CONVERT = {
|
|
19796
|
+
description: _t("Converts a numeric value to a different unit of measure."),
|
|
19797
|
+
args: [
|
|
19798
|
+
arg("value (number)", _t("the numeric value in start_unit to convert to end_unit")),
|
|
19799
|
+
arg("start_unit (string)", _t("The starting unit, the unit currently assigned to value")),
|
|
19800
|
+
arg("end_unit (string)", _t("The unit of measure into which to convert value")),
|
|
19801
|
+
],
|
|
19802
|
+
compute: function (value, startUnit, endUnit) {
|
|
19803
|
+
const _value = toNumber(value, this.locale);
|
|
19804
|
+
const _startUnit = toString(startUnit);
|
|
19805
|
+
const _endUnit = toString(endUnit);
|
|
19806
|
+
const startConversion = getTransformation(_startUnit);
|
|
19807
|
+
const endConversion = getTransformation(_endUnit);
|
|
19808
|
+
if (!startConversion) {
|
|
19809
|
+
return {
|
|
19810
|
+
value: CellErrorType.GenericError,
|
|
19811
|
+
message: _t("Invalid units of measure ('%s')", _startUnit),
|
|
19812
|
+
};
|
|
19813
|
+
}
|
|
19814
|
+
if (!endConversion) {
|
|
19815
|
+
return {
|
|
19816
|
+
value: CellErrorType.GenericError,
|
|
19817
|
+
message: _t("Invalid units of measure ('%s')", _endUnit),
|
|
19818
|
+
};
|
|
19819
|
+
}
|
|
19820
|
+
if (startConversion.category !== endConversion.category) {
|
|
19821
|
+
return {
|
|
19822
|
+
value: CellErrorType.GenericError,
|
|
19823
|
+
message: _t("Incompatible units of measure ('%s' vs '%s')", getTranslatedCategory(startConversion.category), getTranslatedCategory(endConversion.category)),
|
|
19824
|
+
};
|
|
19825
|
+
}
|
|
19826
|
+
return {
|
|
19827
|
+
value: endConversion.inverseTransform(startConversion.factor * startConversion.transform(_value)) /
|
|
19828
|
+
endConversion.factor,
|
|
19829
|
+
format: value?.format,
|
|
19830
|
+
};
|
|
19831
|
+
},
|
|
19832
|
+
isExported: true,
|
|
19833
|
+
};
|
|
19834
|
+
|
|
19835
|
+
var parser = /*#__PURE__*/Object.freeze({
|
|
19836
|
+
__proto__: null,
|
|
19837
|
+
CONVERT: CONVERT
|
|
19838
|
+
});
|
|
19839
|
+
|
|
19529
19840
|
const DEFAULT_STARTING_AT = 1;
|
|
19530
19841
|
/** Regex matching all the words in a string */
|
|
19531
19842
|
const wordRegex = /[A-Za-zÀ-ÖØ-öø-ÿ]+/g;
|
|
@@ -19943,6 +20254,7 @@ const categories = [
|
|
|
19943
20254
|
{ name: _t("Text"), functions: text },
|
|
19944
20255
|
{ name: _t("Engineering"), functions: engineering },
|
|
19945
20256
|
{ name: _t("Web"), functions: web },
|
|
20257
|
+
{ name: _t("Parser"), functions: parser },
|
|
19946
20258
|
];
|
|
19947
20259
|
const functionNameRegex = /^[A-Z0-9\_\.]+$/;
|
|
19948
20260
|
class FunctionRegistry extends Registry {
|
|
@@ -19954,41 +20266,127 @@ class FunctionRegistry extends Registry {
|
|
|
19954
20266
|
}
|
|
19955
20267
|
const descr = addMetaInfoFromArg(addDescr);
|
|
19956
20268
|
validateArguments(descr.args);
|
|
19957
|
-
this.mapping[name] =
|
|
20269
|
+
this.mapping[name] = createComputeFunction(descr, name);
|
|
19958
20270
|
super.add(name, descr);
|
|
19959
20271
|
return this;
|
|
19960
20272
|
}
|
|
19961
20273
|
}
|
|
19962
|
-
|
|
19963
|
-
|
|
20274
|
+
const functionRegistry = new FunctionRegistry();
|
|
20275
|
+
for (let category of categories) {
|
|
20276
|
+
const fns = category.functions;
|
|
20277
|
+
for (let name in fns) {
|
|
20278
|
+
const addDescr = fns[name];
|
|
20279
|
+
addDescr.category = addDescr.category || category.name;
|
|
20280
|
+
name = name.replace(/_/g, ".");
|
|
20281
|
+
functionRegistry.add(name, { isExported: false, ...addDescr });
|
|
20282
|
+
}
|
|
20283
|
+
}
|
|
20284
|
+
const notAvailableError = new NotAvailableError(_t("Array arguments to [[FUNCTION_NAME]] are of different size."));
|
|
20285
|
+
function createComputeFunction(descr, functionName) {
|
|
20286
|
+
function runtimeCompute(...args) {
|
|
20287
|
+
try {
|
|
20288
|
+
return vectorizedCompute.apply(this, args);
|
|
20289
|
+
}
|
|
20290
|
+
catch (e) {
|
|
20291
|
+
return handleError(e, functionName);
|
|
20292
|
+
}
|
|
20293
|
+
}
|
|
20294
|
+
function vectorizedCompute(...args) {
|
|
20295
|
+
let countVectorizableCol = 1;
|
|
20296
|
+
let countVectorizableRow = 1;
|
|
20297
|
+
let vectorizableColLimit = Infinity;
|
|
20298
|
+
let vectorizableRowLimit = Infinity;
|
|
20299
|
+
let vectorArgsType = undefined;
|
|
20300
|
+
//#region Compute vectorisation limits
|
|
19964
20301
|
for (let i = 0; i < args.length; i++) {
|
|
19965
20302
|
const argDefinition = descr.args[descr.getArgToFocus(i + 1) - 1];
|
|
19966
20303
|
const arg = args[i];
|
|
19967
20304
|
if (isMatrix(arg) && !argDefinition.acceptMatrix) {
|
|
19968
|
-
if
|
|
19969
|
-
|
|
20305
|
+
// if argDefinition does not accept a matrix but arg is still a matrix
|
|
20306
|
+
// --> triggers the arguments vectorization
|
|
20307
|
+
const nColumns = arg.length;
|
|
20308
|
+
const nRows = arg[0].length;
|
|
20309
|
+
if (nColumns !== 1 || nRows !== 1) {
|
|
20310
|
+
vectorArgsType ??= new Array(args.length);
|
|
20311
|
+
if (nColumns !== 1 && nRows !== 1) {
|
|
20312
|
+
vectorArgsType[i] = "matrix";
|
|
20313
|
+
countVectorizableCol = Math.max(countVectorizableCol, nColumns);
|
|
20314
|
+
countVectorizableRow = Math.max(countVectorizableRow, nRows);
|
|
20315
|
+
vectorizableColLimit = Math.min(vectorizableColLimit, nColumns);
|
|
20316
|
+
vectorizableRowLimit = Math.min(vectorizableRowLimit, nRows);
|
|
20317
|
+
}
|
|
20318
|
+
else if (nColumns !== 1) {
|
|
20319
|
+
vectorArgsType[i] = "horizontal";
|
|
20320
|
+
countVectorizableCol = Math.max(countVectorizableCol, nColumns);
|
|
20321
|
+
vectorizableColLimit = Math.min(vectorizableColLimit, nColumns);
|
|
20322
|
+
}
|
|
20323
|
+
else if (nRows !== 1) {
|
|
20324
|
+
vectorArgsType[i] = "vertical";
|
|
20325
|
+
countVectorizableRow = Math.max(countVectorizableRow, nRows);
|
|
20326
|
+
vectorizableRowLimit = Math.min(vectorizableRowLimit, nRows);
|
|
20327
|
+
}
|
|
20328
|
+
}
|
|
20329
|
+
else {
|
|
20330
|
+
args[i] = arg[0][0];
|
|
19970
20331
|
}
|
|
19971
|
-
args[i] = arg[0][0];
|
|
19972
20332
|
}
|
|
19973
20333
|
if (!isMatrix(arg) && argDefinition.acceptMatrixOnly) {
|
|
19974
20334
|
throw new BadExpressionError(_t("Function [[FUNCTION_NAME]] expects the parameter '%s' to be reference to a cell or range.", (i + 1).toString()));
|
|
19975
20335
|
}
|
|
19976
20336
|
}
|
|
19977
|
-
|
|
20337
|
+
//#endregion
|
|
20338
|
+
if (countVectorizableCol === 1 && countVectorizableRow === 1) {
|
|
20339
|
+
// either this function is not vectorized or it ends up with a 1x1 dimension
|
|
20340
|
+
return computeFunctionToObject.apply(this, args);
|
|
20341
|
+
}
|
|
20342
|
+
const getArgOffset = (i, j) => args.map((arg, index) => {
|
|
20343
|
+
switch (vectorArgsType?.[index]) {
|
|
20344
|
+
case "matrix":
|
|
20345
|
+
return arg[i][j];
|
|
20346
|
+
case "horizontal":
|
|
20347
|
+
return arg[i][0];
|
|
20348
|
+
case "vertical":
|
|
20349
|
+
return arg[0][j];
|
|
20350
|
+
case undefined:
|
|
20351
|
+
return arg;
|
|
20352
|
+
}
|
|
20353
|
+
});
|
|
20354
|
+
return generateMatrix(countVectorizableCol, countVectorizableRow, (col, row) => {
|
|
20355
|
+
if (col > vectorizableColLimit - 1 || row > vectorizableRowLimit - 1) {
|
|
20356
|
+
return notAvailableError;
|
|
20357
|
+
}
|
|
20358
|
+
const singleCellComputeResult = computeFunctionToObject.apply(this, getArgOffset(col, row));
|
|
20359
|
+
// In the case where the user tries to vectorize arguments of an array formula, we will get an
|
|
20360
|
+
// array for every combination of the vectorized arguments, which will lead to a 3D matrix and
|
|
20361
|
+
// we won't be able to return the values.
|
|
20362
|
+
// In this case, we keep the first element of each spreading part, just as Excel does, and
|
|
20363
|
+
// create an array with these parts.
|
|
20364
|
+
// For exemple, we have MUNIT(x) that return an unitary matrix of x*x. If we use it with a
|
|
20365
|
+
// range, like MUNIT(A1:A2), we will get two unitary matrices (one for the value in A1 and one
|
|
20366
|
+
// for the value in A2). In this case, we will simply take the first value of each matrix and
|
|
20367
|
+
// return the array [First value of MUNIT(A1), First value of MUNIT(A2)].
|
|
20368
|
+
return isMatrix(singleCellComputeResult)
|
|
20369
|
+
? singleCellComputeResult[0][0]
|
|
20370
|
+
: singleCellComputeResult;
|
|
20371
|
+
});
|
|
19978
20372
|
}
|
|
19979
|
-
|
|
19980
|
-
|
|
19981
|
-
|
|
19982
|
-
|
|
19983
|
-
|
|
19984
|
-
|
|
20373
|
+
function computeFunctionToObject(...args) {
|
|
20374
|
+
const result = descr.compute.apply(this, args);
|
|
20375
|
+
if (!isMatrix(result)) {
|
|
20376
|
+
if (typeof result === "object" && result !== null && "value" in result) {
|
|
20377
|
+
replaceFunctionNamePlaceholder(result, functionName);
|
|
20378
|
+
return result;
|
|
20379
|
+
}
|
|
20380
|
+
return { value: result };
|
|
19985
20381
|
}
|
|
19986
|
-
|
|
19987
|
-
|
|
20382
|
+
if (typeof result[0][0] === "object" && result[0][0] !== null && "value" in result[0][0]) {
|
|
20383
|
+
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, functionName));
|
|
20384
|
+
return result;
|
|
19988
20385
|
}
|
|
19989
|
-
|
|
20386
|
+
return matrixMap(result, (row) => ({ value: row }));
|
|
20387
|
+
}
|
|
20388
|
+
return runtimeCompute;
|
|
19990
20389
|
}
|
|
19991
|
-
const implementationErrorMessage = _t("An unexpected error occurred. Submit a support ticket at odoo.com/help.");
|
|
19992
20390
|
function handleError(e, functionName) {
|
|
19993
20391
|
// the error could be an user error (instance of EvaluationError)
|
|
19994
20392
|
// or a javascript error (instance of Error)
|
|
@@ -20007,42 +20405,16 @@ function hasStringValue(obj) {
|
|
|
20007
20405
|
return (obj?.value !== undefined &&
|
|
20008
20406
|
typeof obj.value === "string");
|
|
20009
20407
|
}
|
|
20010
|
-
function
|
|
20011
|
-
return (obj?.message !== undefined &&
|
|
20012
|
-
typeof obj.message === "string");
|
|
20013
|
-
}
|
|
20014
|
-
function addResultHandling(compute, functionName) {
|
|
20015
|
-
return function computeWithResultHandling(...args) {
|
|
20016
|
-
const result = compute.apply(this, args);
|
|
20017
|
-
if (!isMatrix(result)) {
|
|
20018
|
-
if (typeof result === "object" && result !== null && "value" in result) {
|
|
20019
|
-
replaceFunctionNamePlaceholder(result, functionName);
|
|
20020
|
-
return result;
|
|
20021
|
-
}
|
|
20022
|
-
return { value: result };
|
|
20023
|
-
}
|
|
20024
|
-
if (typeof result[0][0] === "object" && result[0][0] !== null && "value" in result[0][0]) {
|
|
20025
|
-
matrixForEach(result, (result) => replaceFunctionNamePlaceholder(result, functionName));
|
|
20026
|
-
return result;
|
|
20027
|
-
}
|
|
20028
|
-
return matrixMap(result, (row) => ({ value: row }));
|
|
20029
|
-
};
|
|
20030
|
-
}
|
|
20031
|
-
function replaceFunctionNamePlaceholder(fPayload, functionName) {
|
|
20408
|
+
function replaceFunctionNamePlaceholder(functionResult, functionName) {
|
|
20032
20409
|
// for performance reasons: change in place and only if needed
|
|
20033
|
-
if (
|
|
20034
|
-
|
|
20410
|
+
if (functionResult.message?.includes("[[FUNCTION_NAME]]")) {
|
|
20411
|
+
functionResult.message = functionResult.message.replace("[[FUNCTION_NAME]]", functionName);
|
|
20035
20412
|
}
|
|
20036
20413
|
}
|
|
20037
|
-
const
|
|
20038
|
-
|
|
20039
|
-
|
|
20040
|
-
|
|
20041
|
-
const addDescr = fns[name];
|
|
20042
|
-
addDescr.category = addDescr.category || category.name;
|
|
20043
|
-
name = name.replace(/_/g, ".");
|
|
20044
|
-
functionRegistry.add(name, { isExported: false, ...addDescr });
|
|
20045
|
-
}
|
|
20414
|
+
const implementationErrorMessage = _t("An unexpected error occurred. Submit a support ticket at odoo.com/help.");
|
|
20415
|
+
function hasStringMessage(obj) {
|
|
20416
|
+
return (obj?.message !== undefined &&
|
|
20417
|
+
typeof obj.message === "string");
|
|
20046
20418
|
}
|
|
20047
20419
|
|
|
20048
20420
|
autoCompleteProviders.add("functions", {
|
|
@@ -21491,6 +21863,7 @@ function indentCode(code) {
|
|
|
21491
21863
|
|
|
21492
21864
|
const functions$1 = functionRegistry.content;
|
|
21493
21865
|
const OPERATOR_MAP = {
|
|
21866
|
+
// export for test
|
|
21494
21867
|
"=": "EQ",
|
|
21495
21868
|
"+": "ADD",
|
|
21496
21869
|
"-": "MINUS",
|
|
@@ -21505,6 +21878,7 @@ const OPERATOR_MAP = {
|
|
|
21505
21878
|
"&": "CONCATENATE",
|
|
21506
21879
|
};
|
|
21507
21880
|
const UNARY_OPERATOR_MAP = {
|
|
21881
|
+
// export for test
|
|
21508
21882
|
"-": "UMINUS",
|
|
21509
21883
|
"+": "UPLUS",
|
|
21510
21884
|
"%": "UNARY.PERCENT",
|
|
@@ -22793,8 +23167,7 @@ function truncateLabel(label) {
|
|
|
22793
23167
|
/**
|
|
22794
23168
|
* Get a default chart js configuration
|
|
22795
23169
|
*/
|
|
22796
|
-
function getDefaultChartJsRuntime(chart, labels, fontColor,
|
|
22797
|
-
const { format, locale, truncateLabels, horizontalChart } = args;
|
|
23170
|
+
function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, truncateLabels = true, horizontalChart, }) {
|
|
22798
23171
|
const chartTitle = chart.title.text ? chart.title : { ...chart.title, content: "" };
|
|
22799
23172
|
const options = {
|
|
22800
23173
|
// https://www.chartjs.org/docs/latest/general/responsive.html
|
|
@@ -22970,7 +23343,6 @@ function chartToImage(runtime, figure, type) {
|
|
|
22970
23343
|
if ("chartJsConfig" in runtime) {
|
|
22971
23344
|
const config = deepCopy(runtime.chartJsConfig);
|
|
22972
23345
|
config.plugins = [backgroundColorChartJSPlugin];
|
|
22973
|
-
// @ts-ignore
|
|
22974
23346
|
const chart = new window.Chart(canvas, config);
|
|
22975
23347
|
const imgContent = chart.toBase64Image();
|
|
22976
23348
|
chart.destroy();
|
|
@@ -23891,13 +24263,11 @@ function canBeLinearChart(labelRange, getters) {
|
|
|
23891
24263
|
}
|
|
23892
24264
|
let missingTimeAdapterAlreadyWarned = false;
|
|
23893
24265
|
function isLuxonTimeAdapterInstalled() {
|
|
23894
|
-
// @ts-ignore
|
|
23895
24266
|
if (!window.Chart) {
|
|
23896
24267
|
return false;
|
|
23897
24268
|
}
|
|
23898
24269
|
// @ts-ignore
|
|
23899
24270
|
const adapter = new window.Chart._adapters._date({});
|
|
23900
|
-
// @ts-ignore
|
|
23901
24271
|
const isInstalled = adapter._id === "luxon";
|
|
23902
24272
|
if (!isInstalled && !missingTimeAdapterAlreadyWarned) {
|
|
23903
24273
|
missingTimeAdapterAlreadyWarned = true;
|
|
@@ -23914,9 +24284,7 @@ function getLineOrScatterConfiguration(chart, labels, options) {
|
|
|
23914
24284
|
generateLabels(chart) {
|
|
23915
24285
|
// color the legend labels with the dataset color, without any transparency
|
|
23916
24286
|
const { data } = chart;
|
|
23917
|
-
|
|
23918
|
-
const labels = window.Chart.defaults.plugins.legend.labels
|
|
23919
|
-
.generateLabels(chart);
|
|
24287
|
+
const labels = window.Chart.defaults.plugins.legend.labels.generateLabels(chart);
|
|
23920
24288
|
for (const [index, label] of labels.entries()) {
|
|
23921
24289
|
label.fillStyle = data.datasets[index].borderColor;
|
|
23922
24290
|
}
|
|
@@ -33158,21 +33526,25 @@ function useHoveredElement(ref) {
|
|
|
33158
33526
|
|
|
33159
33527
|
function useHighlightsOnHover(ref, highlightProvider) {
|
|
33160
33528
|
const hoverState = useHoveredElement(ref);
|
|
33161
|
-
const stores = useStoreProvider();
|
|
33162
33529
|
useHighlights({
|
|
33163
33530
|
get highlights() {
|
|
33164
33531
|
return hoverState.hovered ? highlightProvider.highlights : [];
|
|
33165
33532
|
},
|
|
33166
33533
|
});
|
|
33167
|
-
owl.useEffect(() => {
|
|
33168
|
-
stores.trigger("store-updated");
|
|
33169
|
-
}, () => [hoverState.hovered]);
|
|
33170
33534
|
}
|
|
33171
33535
|
function useHighlights(highlightProvider) {
|
|
33536
|
+
const stores = useStoreProvider();
|
|
33172
33537
|
const store = useLocalStore(HighlightStore);
|
|
33173
33538
|
owl.onMounted(() => {
|
|
33174
33539
|
store.register(highlightProvider);
|
|
33175
33540
|
});
|
|
33541
|
+
let currentHighlights = highlightProvider.highlights;
|
|
33542
|
+
owl.useEffect((highlights) => {
|
|
33543
|
+
if (!deepEquals(highlights, currentHighlights)) {
|
|
33544
|
+
currentHighlights = highlights;
|
|
33545
|
+
stores.trigger("store-updated");
|
|
33546
|
+
}
|
|
33547
|
+
}, () => [highlightProvider.highlights]);
|
|
33176
33548
|
}
|
|
33177
33549
|
|
|
33178
33550
|
css /* scss */ `
|
|
@@ -45766,7 +46138,7 @@ function getRelationFile(file, xmls) {
|
|
|
45766
46138
|
return relsFile;
|
|
45767
46139
|
}
|
|
45768
46140
|
|
|
45769
|
-
const EXCEL_IMPORT_VERSION =
|
|
46141
|
+
const EXCEL_IMPORT_VERSION = 17;
|
|
45770
46142
|
class XlsxReader {
|
|
45771
46143
|
warningManager;
|
|
45772
46144
|
xmls;
|
|
@@ -45898,7 +46270,7 @@ function normalizeV9(formula) {
|
|
|
45898
46270
|
* a breaking change is made in the way the state is handled, and an upgrade
|
|
45899
46271
|
* function should be defined
|
|
45900
46272
|
*/
|
|
45901
|
-
const CURRENT_VERSION =
|
|
46273
|
+
const CURRENT_VERSION = 17;
|
|
45902
46274
|
const INITIAL_SHEET_ID = "Sheet1";
|
|
45903
46275
|
/**
|
|
45904
46276
|
* This function tries to load anything that could look like a valid
|
|
@@ -49235,10 +49607,12 @@ class MergePlugin extends CorePlugin {
|
|
|
49235
49607
|
if (!sheetMap)
|
|
49236
49608
|
return [];
|
|
49237
49609
|
const mergeIds = new Set();
|
|
49238
|
-
for (
|
|
49239
|
-
|
|
49240
|
-
|
|
49241
|
-
|
|
49610
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
49611
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
49612
|
+
const mergeId = sheetMap[col]?.[row];
|
|
49613
|
+
if (mergeId) {
|
|
49614
|
+
mergeIds.add(mergeId);
|
|
49615
|
+
}
|
|
49242
49616
|
}
|
|
49243
49617
|
}
|
|
49244
49618
|
return Array.from(mergeIds)
|
|
@@ -53106,7 +53480,13 @@ class FormulaDependencyGraph {
|
|
|
53106
53480
|
const queue = Array.from(ranges).reverse();
|
|
53107
53481
|
while (queue.length > 0) {
|
|
53108
53482
|
const range = queue.pop();
|
|
53109
|
-
|
|
53483
|
+
const zone = range.zone;
|
|
53484
|
+
const sheetId = range.sheetId;
|
|
53485
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
53486
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
53487
|
+
visited.add({ sheetId, col, row });
|
|
53488
|
+
}
|
|
53489
|
+
}
|
|
53110
53490
|
const impactedPositions = this.rTree.search(range).map((dep) => dep.data);
|
|
53111
53491
|
const nextInQueue = {};
|
|
53112
53492
|
for (const position of impactedPositions) {
|
|
@@ -53122,7 +53502,16 @@ class FormulaDependencyGraph {
|
|
|
53122
53502
|
queue.push(...zones.map((zone) => ({ sheetId, zone })));
|
|
53123
53503
|
}
|
|
53124
53504
|
}
|
|
53125
|
-
|
|
53505
|
+
// remove initial ranges
|
|
53506
|
+
for (const range of ranges) {
|
|
53507
|
+
const zone = range.zone;
|
|
53508
|
+
const sheetId = range.sheetId;
|
|
53509
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
53510
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
53511
|
+
visited.delete({ sheetId, col, row });
|
|
53512
|
+
}
|
|
53513
|
+
}
|
|
53514
|
+
}
|
|
53126
53515
|
return visited;
|
|
53127
53516
|
}
|
|
53128
53517
|
}
|
|
@@ -53253,7 +53642,7 @@ class PositionSet {
|
|
|
53253
53642
|
return this.sheets[position.sheetId].getValue(position) === 1;
|
|
53254
53643
|
}
|
|
53255
53644
|
clear() {
|
|
53256
|
-
const insertions = this
|
|
53645
|
+
const insertions = [...this];
|
|
53257
53646
|
this.insertions = [];
|
|
53258
53647
|
for (const sheetId in this.sheets) {
|
|
53259
53648
|
this.sheets[sheetId].clear();
|
|
@@ -53597,6 +53986,7 @@ class Evaluator {
|
|
|
53597
53986
|
}
|
|
53598
53987
|
finally {
|
|
53599
53988
|
this.cellsBeingComputed.delete(cellId);
|
|
53989
|
+
this.nextPositionsToUpdate.delete(position);
|
|
53600
53990
|
}
|
|
53601
53991
|
}
|
|
53602
53992
|
computeAndSave(position) {
|
|
@@ -53623,8 +54013,33 @@ class Evaluator {
|
|
|
53623
54013
|
forEachSpreadPositionInMatrix(nbColumns, nbRows,
|
|
53624
54014
|
// thanks to the isMatrix check above, we know that formulaReturn is MatrixFunctionReturn
|
|
53625
54015
|
this.spreadValues(formulaPosition, formulaReturn));
|
|
54016
|
+
this.invalidatePositionsDependingOnSpread(formulaPosition, nbColumns, nbRows);
|
|
53626
54017
|
return createEvaluatedCell(nullValueToZeroValue(formulaReturn[0][0]), this.getters.getLocale(), cellData);
|
|
53627
54018
|
}
|
|
54019
|
+
invalidatePositionsDependingOnSpread(arrayFormulaPosition, nbColumns, nbRows) {
|
|
54020
|
+
// the result matrix is split in 2 zones to exclude the array formula position
|
|
54021
|
+
const top = arrayFormulaPosition.row;
|
|
54022
|
+
const left = arrayFormulaPosition.col;
|
|
54023
|
+
const bottom = top + nbRows - 1;
|
|
54024
|
+
const leftColumnZone = {
|
|
54025
|
+
top: top + 1,
|
|
54026
|
+
bottom,
|
|
54027
|
+
left,
|
|
54028
|
+
right: left,
|
|
54029
|
+
};
|
|
54030
|
+
const rightPartZone = {
|
|
54031
|
+
top,
|
|
54032
|
+
bottom,
|
|
54033
|
+
left: left + 1,
|
|
54034
|
+
right: left + nbColumns - 1,
|
|
54035
|
+
};
|
|
54036
|
+
const sheetId = arrayFormulaPosition.sheetId;
|
|
54037
|
+
const invalidatedPositions = this.formulaDependencies().getCellsDependingOn([
|
|
54038
|
+
{ sheetId, zone: rightPartZone },
|
|
54039
|
+
{ sheetId, zone: leftColumnZone },
|
|
54040
|
+
]);
|
|
54041
|
+
this.nextPositionsToUpdate.addMany(invalidatedPositions);
|
|
54042
|
+
}
|
|
53628
54043
|
assertSheetHasEnoughSpaceToSpreadFormulaResult({ sheetId, col, row }, matrixResult) {
|
|
53629
54044
|
const numberOfCols = this.getters.getNumberCols(sheetId);
|
|
53630
54045
|
const numberOfRows = this.getters.getNumberRows(sheetId);
|
|
@@ -53655,14 +54070,15 @@ class Evaluator {
|
|
|
53655
54070
|
}
|
|
53656
54071
|
updateSpreadRelation({ sheetId, col, row, }) {
|
|
53657
54072
|
const arrayFormulaPosition = { sheetId, col, row };
|
|
53658
|
-
|
|
54073
|
+
const updateSpreadRelation = (i, j) => {
|
|
53659
54074
|
const position = { sheetId, col: i + col, row: j + row };
|
|
53660
54075
|
this.spreadingRelations.addRelation({ resultPosition: position, arrayFormulaPosition });
|
|
53661
54076
|
};
|
|
54077
|
+
return updateSpreadRelation;
|
|
53662
54078
|
}
|
|
53663
54079
|
checkCollision(formulaPosition) {
|
|
53664
54080
|
const { sheetId, col, row } = formulaPosition;
|
|
53665
|
-
|
|
54081
|
+
const checkCollision = (i, j) => {
|
|
53666
54082
|
const position = { sheetId: sheetId, col: i + col, row: j + row };
|
|
53667
54083
|
const rawCell = this.getters.getCell(position);
|
|
53668
54084
|
if (rawCell?.content ||
|
|
@@ -53672,17 +54088,16 @@ class Evaluator {
|
|
|
53672
54088
|
}
|
|
53673
54089
|
this.blockedArrayFormulas.delete(formulaPosition);
|
|
53674
54090
|
};
|
|
54091
|
+
return checkCollision;
|
|
53675
54092
|
}
|
|
53676
54093
|
spreadValues({ sheetId, col, row }, matrixResult) {
|
|
53677
|
-
|
|
54094
|
+
const spreadValues = (i, j) => {
|
|
53678
54095
|
const position = { sheetId, col: i + col, row: j + row };
|
|
53679
54096
|
const cell = this.getters.getCell(position);
|
|
53680
54097
|
const evaluatedCell = createEvaluatedCell(nullValueToZeroValue(matrixResult[i][j]), this.getters.getLocale(), cell);
|
|
53681
54098
|
this.evaluatedCells.set(position, evaluatedCell);
|
|
53682
|
-
// check if formula dependencies present in the spread zone
|
|
53683
|
-
// if so, they need to be recomputed
|
|
53684
|
-
this.nextPositionsToUpdate.addMany(this.getCellsDependingOn([position]));
|
|
53685
54099
|
};
|
|
54100
|
+
return spreadValues;
|
|
53686
54101
|
}
|
|
53687
54102
|
invalidateSpreading(position) {
|
|
53688
54103
|
if (!this.spreadingRelations.isArrayFormula(position)) {
|
|
@@ -53737,12 +54152,12 @@ function forEachSpreadPositionInMatrix(nbColumns, nbRows, callback) {
|
|
|
53737
54152
|
* rather than appearing empty. This indicates that the
|
|
53738
54153
|
* cell is the result of a non-empty content.
|
|
53739
54154
|
*/
|
|
53740
|
-
function nullValueToZeroValue(
|
|
53741
|
-
if (
|
|
53742
|
-
// '
|
|
53743
|
-
return { ...
|
|
54155
|
+
function nullValueToZeroValue(functionResult) {
|
|
54156
|
+
if (functionResult.value === null || functionResult.value === undefined) {
|
|
54157
|
+
// 'functionResult.value === undefined' is supposed to never happen, it's a safety net for javascript use
|
|
54158
|
+
return { ...functionResult, value: 0 };
|
|
53744
54159
|
}
|
|
53745
|
-
return
|
|
54160
|
+
return functionResult;
|
|
53746
54161
|
}
|
|
53747
54162
|
function updateEvalContextAndExecute(compiledFormula, compilationParams, sheetId, cellId) {
|
|
53748
54163
|
compilationParams.evalContext.__originCellXC = lazy(() => {
|
|
@@ -67833,6 +68248,6 @@ exports.tokenColors = tokenColors;
|
|
|
67833
68248
|
exports.tokenize = tokenize;
|
|
67834
68249
|
|
|
67835
68250
|
|
|
67836
|
-
__info__.version = "17.4.0-alpha.
|
|
67837
|
-
__info__.date = "2024-07-
|
|
67838
|
-
__info__.hash = "
|
|
68251
|
+
__info__.version = "17.4.0-alpha.13";
|
|
68252
|
+
__info__.date = "2024-07-11T06:36:58.556Z";
|
|
68253
|
+
__info__.hash = "e0f506b";
|