@odoo/o-spreadsheet 19.5.0-alpha.12 → 19.5.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 +281 -260
- package/dist/o_spreadsheet.css +26 -21
- package/dist/o_spreadsheet.esm.js +281 -260
- package/dist/o_spreadsheet.iife.js +281 -260
- package/dist/o_spreadsheet.min.iife.js +22 -22
- package/dist/o_spreadsheet.xml +67 -60
- package/dist/types/components/side_panel/chart/scorecard_chart_panel/scorecard_chart_config_panel.d.ts +6 -10
- package/dist/types/helpers/figures/chart.d.ts +1 -1
- package/dist/types/stores/main_viewport_store.d.ts +3 -0
- package/dist/types/stores/viewports_store.d.ts +0 -1
- package/dist/types/types/chart/chart.d.ts +3 -1
- package/dist/types/types/chart/scorecard_chart.d.ts +3 -4
- package/dist/types/types/commands.d.ts +0 -2
- package/package.json +3 -2
|
@@ -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 19.5.0-alpha.
|
|
6
|
-
* @date 2026-08-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 19.5.0-alpha.13
|
|
6
|
+
* @date 2026-08-21T15:33:44.046Z
|
|
7
|
+
* @hash a73559e
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import * as owl from "@odoo/owl";
|
|
@@ -401,7 +401,13 @@ function createAction(item) {
|
|
|
401
401
|
if (isEnabled(env)) return item.execute(env, isMiddleClick);
|
|
402
402
|
} : void 0,
|
|
403
403
|
children: children ? (env) => {
|
|
404
|
-
|
|
404
|
+
const uniqueChildren = {};
|
|
405
|
+
children.flatMap((child) => typeof child === "function" ? child(env) : child).forEach((childSpec) => {
|
|
406
|
+
const childAction = createAction(childSpec);
|
|
407
|
+
if (uniqueChildren[childAction.id]) throw new Error(`Duplicate child action id "${childAction.id}" in action "${itemId}".`);
|
|
408
|
+
uniqueChildren[childAction.id] = childAction;
|
|
409
|
+
});
|
|
410
|
+
return Object.values(uniqueChildren).sort((a, b) => a.sequence - b.sequence);
|
|
405
411
|
} : () => [],
|
|
406
412
|
isReadonlyAllowed: item.isReadonlyAllowed || false,
|
|
407
413
|
isEnabledOnLockedSheet: item.isEnabledOnLockedSheet || false,
|
|
@@ -5407,7 +5413,7 @@ function _roundFormat(internalFormat) {
|
|
|
5407
5413
|
}
|
|
5408
5414
|
function humanizeNumber({ value, format }, locale) {
|
|
5409
5415
|
const numberValue = tryToNumber(value, locale);
|
|
5410
|
-
if (numberValue === void 0) return "";
|
|
5416
|
+
if (numberValue === void 0) return value?.toString() || "";
|
|
5411
5417
|
let numberFormat = format;
|
|
5412
5418
|
if (Math.abs(numberValue) < 1e3) {
|
|
5413
5419
|
const hasDecimal = numberValue % 1 !== 0;
|
|
@@ -8122,8 +8128,6 @@ let CommandResult = /* @__PURE__ */ function(CommandResult) {
|
|
|
8122
8128
|
CommandResult["InvalidXRange"] = "InvalidXRange";
|
|
8123
8129
|
CommandResult["InvalidLabelRange"] = "InvalidLabelRange";
|
|
8124
8130
|
CommandResult["InvalidBubbleSizeRange"] = "InvalidBubbleSizeRange";
|
|
8125
|
-
CommandResult["InvalidScorecardKeyValue"] = "InvalidScorecardKeyValue";
|
|
8126
|
-
CommandResult["InvalidScorecardBaseline"] = "InvalidScorecardBaseline";
|
|
8127
8131
|
CommandResult["InvalidGaugeDataRange"] = "InvalidGaugeDataRange";
|
|
8128
8132
|
CommandResult["EmptyGaugeRangeMin"] = "EmptyGaugeRangeMin";
|
|
8129
8133
|
CommandResult["GaugeRangeMinNaN"] = "GaugeRangeMinNaN";
|
|
@@ -12010,6 +12014,110 @@ var ChartJsComponent = class extends Component {
|
|
|
12010
12014
|
}
|
|
12011
12015
|
};
|
|
12012
12016
|
|
|
12017
|
+
//#endregion
|
|
12018
|
+
//#region src/functions/helper_matrices.ts
|
|
12019
|
+
function getUnitMatrix(n) {
|
|
12020
|
+
const matrix = Array(n);
|
|
12021
|
+
for (let i = 0; i < n; i++) {
|
|
12022
|
+
matrix[i] = Array(n).fill(0);
|
|
12023
|
+
matrix[i][i] = 1;
|
|
12024
|
+
}
|
|
12025
|
+
return matrix;
|
|
12026
|
+
}
|
|
12027
|
+
/**
|
|
12028
|
+
* Invert a matrix and compute its determinant using Gaussian Elimination.
|
|
12029
|
+
*
|
|
12030
|
+
* The Matrix should be a square matrix, and should be indexed [col][row] instead of the
|
|
12031
|
+
* standard mathematical indexing [row][col].
|
|
12032
|
+
*/
|
|
12033
|
+
function invertMatrix(M) {
|
|
12034
|
+
if (M.length < 1 || M[0].length < 1) throw new Error("invertMatrix: an empty matrix cannot be inverted.");
|
|
12035
|
+
if (M.length !== M[0].length) throw new Error("invertMatrix: only square matrices are invertible");
|
|
12036
|
+
let determinant = 1;
|
|
12037
|
+
const dim = M.length;
|
|
12038
|
+
const I = getUnitMatrix(dim);
|
|
12039
|
+
const C = M.map((row) => row.slice());
|
|
12040
|
+
for (let pivot = 0; pivot < dim; pivot++) {
|
|
12041
|
+
let diagonalElement = C[pivot][pivot];
|
|
12042
|
+
if (diagonalElement === 0) {
|
|
12043
|
+
for (let row = pivot + 1; row < dim; row++) if (C[pivot][row] !== 0) {
|
|
12044
|
+
swapMatrixRows(C, pivot, row);
|
|
12045
|
+
swapMatrixRows(I, pivot, row);
|
|
12046
|
+
determinant *= -1;
|
|
12047
|
+
break;
|
|
12048
|
+
}
|
|
12049
|
+
diagonalElement = C[pivot][pivot];
|
|
12050
|
+
if (diagonalElement === 0) return { determinant: 0 };
|
|
12051
|
+
}
|
|
12052
|
+
for (let col = 0; col < dim; col++) {
|
|
12053
|
+
C[col][pivot] = C[col][pivot] / diagonalElement;
|
|
12054
|
+
I[col][pivot] = I[col][pivot] / diagonalElement;
|
|
12055
|
+
}
|
|
12056
|
+
determinant *= diagonalElement;
|
|
12057
|
+
for (let row = 0; row < dim; row++) {
|
|
12058
|
+
if (row === pivot) continue;
|
|
12059
|
+
const e = C[pivot][row];
|
|
12060
|
+
for (let col = 0; col < dim; col++) {
|
|
12061
|
+
C[col][row] -= e * C[col][pivot];
|
|
12062
|
+
I[col][row] -= e * I[col][pivot];
|
|
12063
|
+
}
|
|
12064
|
+
}
|
|
12065
|
+
}
|
|
12066
|
+
return {
|
|
12067
|
+
inverted: I,
|
|
12068
|
+
determinant
|
|
12069
|
+
};
|
|
12070
|
+
}
|
|
12071
|
+
function swapMatrixRows(matrix, row1, row2) {
|
|
12072
|
+
for (let i = 0; i < matrix.length; i++) {
|
|
12073
|
+
const tmp = matrix[i][row1];
|
|
12074
|
+
matrix[i][row1] = matrix[i][row2];
|
|
12075
|
+
matrix[i][row2] = tmp;
|
|
12076
|
+
}
|
|
12077
|
+
}
|
|
12078
|
+
/**
|
|
12079
|
+
* Matrix multiplication of 2 matrices.
|
|
12080
|
+
* ex: matrix1 : n x l, matrix2 : m x n => result : m x l
|
|
12081
|
+
*
|
|
12082
|
+
* Note: we use indexing [col][row] instead of the standard mathematical notation [row][col]
|
|
12083
|
+
*/
|
|
12084
|
+
function multiplyMatrices(matrix1, matrix2) {
|
|
12085
|
+
if (matrix1.length < 1 || matrix2.length < 1) throw new Error("multiplyMatrices: empty matrices cannot be multiplied.");
|
|
12086
|
+
if (matrix1.length !== matrix2[0].length) throw new Error("multiplyMatrices: incompatible matrices size.");
|
|
12087
|
+
const rowsM1 = matrix1[0].length;
|
|
12088
|
+
const colsM2 = matrix2.length;
|
|
12089
|
+
const n = matrix1.length;
|
|
12090
|
+
const result = Array(colsM2);
|
|
12091
|
+
for (let col = 0; col < colsM2; col++) {
|
|
12092
|
+
result[col] = Array(rowsM1);
|
|
12093
|
+
for (let row = 0; row < rowsM1; row++) {
|
|
12094
|
+
let sum = 0;
|
|
12095
|
+
for (let k = 0; k < n; k++) sum += matrix1[k][row] * matrix2[col][k];
|
|
12096
|
+
result[col][row] = sum;
|
|
12097
|
+
}
|
|
12098
|
+
}
|
|
12099
|
+
return result;
|
|
12100
|
+
}
|
|
12101
|
+
/**
|
|
12102
|
+
* Return the input if it's a scalar or the first element of the input if it's a matrix.
|
|
12103
|
+
*/
|
|
12104
|
+
function toScalar(arg) {
|
|
12105
|
+
if (!isMatrix(arg)) return arg;
|
|
12106
|
+
if (!isSingleElementMatrix(arg)) throw new Error("The value should be a scalar or a 1x1 matrix");
|
|
12107
|
+
return arg[0][0];
|
|
12108
|
+
}
|
|
12109
|
+
function isSingleElementMatrix(matrix) {
|
|
12110
|
+
return matrix.length === 1 && matrix[0].length === 1;
|
|
12111
|
+
}
|
|
12112
|
+
function isMultipleElementMatrix(arg) {
|
|
12113
|
+
return isMatrix(arg) && !isSingleElementMatrix(arg);
|
|
12114
|
+
}
|
|
12115
|
+
function getMatrixArgIndices(args) {
|
|
12116
|
+
const indices = [];
|
|
12117
|
+
for (let i = 0; i < args.length; i++) if (isMultipleElementMatrix(args[i])) indices.push(i);
|
|
12118
|
+
return indices;
|
|
12119
|
+
}
|
|
12120
|
+
|
|
12013
12121
|
//#endregion
|
|
12014
12122
|
//#region src/helpers/figures/charts/abstract_chart.ts
|
|
12015
12123
|
var AbstractChart = class {
|
|
@@ -12025,11 +12133,42 @@ var AbstractChart = class {
|
|
|
12025
12133
|
|
|
12026
12134
|
//#endregion
|
|
12027
12135
|
//#region src/helpers/figures/charts/scorecard_chart.ts
|
|
12136
|
+
function getData$1(value, getters, sheetId) {
|
|
12137
|
+
if (!value) return {
|
|
12138
|
+
scalar: void 0,
|
|
12139
|
+
range: void 0
|
|
12140
|
+
};
|
|
12141
|
+
if (!isFormula(value)) return {
|
|
12142
|
+
scalar: { value },
|
|
12143
|
+
range: void 0
|
|
12144
|
+
};
|
|
12145
|
+
const result = getters.evaluateFormulaResult(sheetId, value);
|
|
12146
|
+
let scalar = isMultipleElementMatrix(result) ? result[0][0] : toScalar(result);
|
|
12147
|
+
let range = void 0;
|
|
12148
|
+
const xc = getFormulaRangeXc(value);
|
|
12149
|
+
if (xc) {
|
|
12150
|
+
range = createValidRange(getters, sheetId, xc);
|
|
12151
|
+
if (range) {
|
|
12152
|
+
if (getters.getEvaluatedCell({
|
|
12153
|
+
sheetId: range.sheetId,
|
|
12154
|
+
col: range.zone.left,
|
|
12155
|
+
row: range.zone.top
|
|
12156
|
+
}).type === "empty") scalar = void 0;
|
|
12157
|
+
}
|
|
12158
|
+
}
|
|
12159
|
+
return {
|
|
12160
|
+
scalar,
|
|
12161
|
+
range
|
|
12162
|
+
};
|
|
12163
|
+
}
|
|
12028
12164
|
function getBaselineText(baseline, keyValue, baselineMode, humanizeNumbers, locale) {
|
|
12029
12165
|
if (!baseline) return "";
|
|
12030
|
-
else if (baselineMode === "text" || keyValue?.
|
|
12166
|
+
else if (baselineMode === "text" || typeof keyValue?.value !== "number" || typeof baseline.value !== "number") {
|
|
12031
12167
|
if (humanizeNumbers) return humanizeNumber(baseline, locale);
|
|
12032
|
-
return baseline.
|
|
12168
|
+
return formatValue(baseline.value, {
|
|
12169
|
+
format: baseline.format,
|
|
12170
|
+
locale
|
|
12171
|
+
});
|
|
12033
12172
|
}
|
|
12034
12173
|
let { value, format } = baseline;
|
|
12035
12174
|
if (baselineMode === "progress") {
|
|
@@ -12050,29 +12189,31 @@ function getBaselineText(baseline, keyValue, baselineMode, humanizeNumbers, loca
|
|
|
12050
12189
|
locale
|
|
12051
12190
|
});
|
|
12052
12191
|
}
|
|
12053
|
-
function getKeyValueText(
|
|
12054
|
-
if (
|
|
12055
|
-
if (humanizeNumbers) return humanizeNumber(
|
|
12056
|
-
return
|
|
12192
|
+
function getKeyValueText(keyValue, humanizeNumbers, locale) {
|
|
12193
|
+
if (keyValue?.value === void 0 || keyValue?.value === null) return "";
|
|
12194
|
+
if (humanizeNumbers) return humanizeNumber(keyValue, locale);
|
|
12195
|
+
return keyValue.format ? formatValue(keyValue.value, {
|
|
12196
|
+
format: keyValue.format,
|
|
12197
|
+
locale
|
|
12198
|
+
}) : String(keyValue.value ?? "");
|
|
12057
12199
|
}
|
|
12058
12200
|
function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
|
|
12059
|
-
if (baselineMode === "text" || baselineMode === "progress" || baseline?.
|
|
12201
|
+
if (baselineMode === "text" || baselineMode === "progress" || typeof baseline?.value !== "number" || typeof keyValue?.value !== "number") return;
|
|
12060
12202
|
const diff = keyValue.value - baseline.value;
|
|
12061
12203
|
if (diff > 0) return colorUp;
|
|
12062
12204
|
else if (diff < 0) return colorDown;
|
|
12063
12205
|
}
|
|
12064
12206
|
function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
|
|
12065
|
-
if (baselineMode === "text" || baseline?.
|
|
12207
|
+
if (baselineMode === "text" || typeof baseline?.value !== "number" || typeof keyValue?.value !== "number") return "neutral";
|
|
12066
12208
|
const diff = keyValue.value - baseline.value;
|
|
12067
12209
|
if (diff > 0) return "up";
|
|
12068
12210
|
else if (diff < 0) return "down";
|
|
12069
12211
|
return "neutral";
|
|
12070
12212
|
}
|
|
12071
|
-
function
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
|
|
12213
|
+
function getFormulaRangeXc(formula) {
|
|
12214
|
+
if (!formula || !isFormula(formula)) return;
|
|
12215
|
+
const content = formula.slice(1);
|
|
12216
|
+
return rangeReference.test(content) ? content : void 0;
|
|
12076
12217
|
}
|
|
12077
12218
|
const Path2DConstructor = globalThis.Path2D;
|
|
12078
12219
|
const arrowDownPath = Path2DConstructor && new Path2DConstructor("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z");
|
|
@@ -12089,84 +12230,76 @@ const ScorecardChart$1 = {
|
|
|
12089
12230
|
"baselineColorUp",
|
|
12090
12231
|
"baselineColorDown"
|
|
12091
12232
|
],
|
|
12092
|
-
fromStrDefinition(definition
|
|
12093
|
-
|
|
12094
|
-
|
|
12233
|
+
fromStrDefinition: (definition) => definition,
|
|
12234
|
+
validateDefinition(validator, definition) {
|
|
12235
|
+
return "Success";
|
|
12236
|
+
},
|
|
12237
|
+
copyInSheetId: (definition, sheetIdFrom, sheetIdTo, getters) => {
|
|
12238
|
+
const adaptFormula = (formula) => getters.copyFormulaStringForSheet(sheetIdFrom, sheetIdTo, formula, "keepSameReference");
|
|
12095
12239
|
return {
|
|
12096
12240
|
...definition,
|
|
12097
|
-
|
|
12098
|
-
|
|
12241
|
+
keyValue: definition.keyValue ? adaptFormula(definition.keyValue) : definition.keyValue,
|
|
12242
|
+
baseline: definition.baseline ? adaptFormula(definition.baseline) : definition.baseline
|
|
12099
12243
|
};
|
|
12100
12244
|
},
|
|
12101
|
-
validateDefinition(validator, definition) {
|
|
12102
|
-
return validator.checkValidations(definition, checkKeyValue, checkBaseline);
|
|
12103
|
-
},
|
|
12104
|
-
copyInSheetId: (definition) => definition,
|
|
12105
12245
|
getDefinitionFromContextCreation(context, dataSourceBuilder) {
|
|
12246
|
+
const dataRange = context.dataSource?.type === "range" ? context.dataSource?.dataSets?.[0]?.dataRange : void 0;
|
|
12247
|
+
const keyValue = (context.scorecardKeyValueFormula === void 0 || getFormulaRangeXc(context.scorecardKeyValueFormula)) && dataRange ? `=${dataRange}` : context.scorecardKeyValueFormula;
|
|
12248
|
+
const baseline = (context.scorecardBaselineFormula === void 0 || getFormulaRangeXc(context.scorecardBaselineFormula)) && context.auxiliaryRange ? `=${context.auxiliaryRange}` : context.scorecardBaselineFormula;
|
|
12106
12249
|
return {
|
|
12107
12250
|
background: context.background,
|
|
12108
12251
|
type: "scorecard",
|
|
12109
|
-
keyValue
|
|
12252
|
+
keyValue,
|
|
12110
12253
|
title: context.title || { text: "" },
|
|
12111
12254
|
baselineMode: DEFAULT_SCORECARD_BASELINE_MODE,
|
|
12112
12255
|
baselineColorUp: DEFAULT_SCORECARD_BASELINE_COLOR_UP,
|
|
12113
12256
|
baselineColorDown: DEFAULT_SCORECARD_BASELINE_COLOR_DOWN,
|
|
12114
|
-
baseline
|
|
12257
|
+
baseline,
|
|
12115
12258
|
humanize: context.humanize,
|
|
12116
12259
|
annotationLink: context.annotationLink,
|
|
12117
12260
|
annotationText: context.annotationText
|
|
12118
12261
|
};
|
|
12119
12262
|
},
|
|
12120
|
-
transformDefinition(definition, chartSheetId, {
|
|
12263
|
+
transformDefinition(definition, chartSheetId, { adaptFormulaString }) {
|
|
12121
12264
|
let baseline;
|
|
12122
12265
|
let keyValue;
|
|
12123
|
-
if (definition.baseline)
|
|
12124
|
-
|
|
12125
|
-
if (changeType !== "REMOVE") baseline = adaptedRange;
|
|
12126
|
-
}
|
|
12127
|
-
if (definition.keyValue) {
|
|
12128
|
-
const { changeType, range: adaptedRange } = adaptRangeString(chartSheetId, definition.keyValue);
|
|
12129
|
-
if (changeType !== "REMOVE") keyValue = adaptedRange;
|
|
12130
|
-
}
|
|
12131
|
-
return {
|
|
12132
|
-
...definition,
|
|
12133
|
-
baseline,
|
|
12134
|
-
keyValue
|
|
12135
|
-
};
|
|
12136
|
-
},
|
|
12137
|
-
duplicateInDuplicatedSheet(definition, sheetIdFrom, sheetIdTo) {
|
|
12138
|
-
const baseline = duplicateLabelRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, definition.baseline);
|
|
12139
|
-
const keyValue = duplicateLabelRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, definition.keyValue);
|
|
12266
|
+
if (definition.baseline) baseline = adaptFormulaString(chartSheetId, definition.baseline);
|
|
12267
|
+
if (definition.keyValue) keyValue = adaptFormulaString(chartSheetId, definition.keyValue);
|
|
12140
12268
|
return {
|
|
12141
12269
|
...definition,
|
|
12142
12270
|
baseline,
|
|
12143
12271
|
keyValue
|
|
12144
12272
|
};
|
|
12145
12273
|
},
|
|
12146
|
-
|
|
12274
|
+
duplicateInDuplicatedSheet(definition, sheetIdFrom, sheetIdTo, getters) {
|
|
12275
|
+
const adaptFormula = (formula) => getters.copyFormulaStringForSheet(sheetIdFrom, sheetIdTo, formula, "moveReference");
|
|
12147
12276
|
return {
|
|
12148
12277
|
...definition,
|
|
12149
|
-
keyValue: definition.keyValue ?
|
|
12150
|
-
baseline: definition.baseline ?
|
|
12278
|
+
keyValue: definition.keyValue ? adaptFormula(definition.keyValue) : definition.keyValue,
|
|
12279
|
+
baseline: definition.baseline ? adaptFormula(definition.baseline) : definition.baseline
|
|
12151
12280
|
};
|
|
12152
12281
|
},
|
|
12282
|
+
toStrDefinition: (definition) => definition,
|
|
12153
12283
|
getContextCreation(definition, dataSource) {
|
|
12284
|
+
const keyValueXc = getFormulaRangeXc(definition.keyValue);
|
|
12154
12285
|
return {
|
|
12155
12286
|
...definition,
|
|
12156
12287
|
dataSource: {
|
|
12157
12288
|
type: "range",
|
|
12158
|
-
dataSets:
|
|
12159
|
-
dataRange:
|
|
12289
|
+
dataSets: keyValueXc ? [{
|
|
12290
|
+
dataRange: keyValueXc,
|
|
12160
12291
|
dataSetId: "0"
|
|
12161
12292
|
}] : []
|
|
12162
12293
|
},
|
|
12163
|
-
auxiliaryRange: definition.baseline
|
|
12294
|
+
auxiliaryRange: getFormulaRangeXc(definition.baseline),
|
|
12295
|
+
scorecardKeyValueFormula: definition.keyValue,
|
|
12296
|
+
scorecardBaselineFormula: definition.baseline
|
|
12164
12297
|
};
|
|
12165
12298
|
},
|
|
12166
12299
|
getDefinitionForExcel: () => void 0,
|
|
12167
|
-
updateRanges(definition, adapterFunctions) {
|
|
12168
|
-
const baseline =
|
|
12169
|
-
const keyValue =
|
|
12300
|
+
updateRanges(definition, adapterFunctions, sheetId) {
|
|
12301
|
+
const baseline = definition.baseline ? adapterFunctions.adaptFormulaString(sheetId, definition.baseline) : definition.baseline;
|
|
12302
|
+
const keyValue = definition.keyValue ? adapterFunctions.adaptFormulaString(sheetId, definition.keyValue) : definition.keyValue;
|
|
12170
12303
|
if (definition.baseline === baseline && definition.keyValue === keyValue) return definition;
|
|
12171
12304
|
return {
|
|
12172
12305
|
...definition,
|
|
@@ -12174,32 +12307,21 @@ const ScorecardChart$1 = {
|
|
|
12174
12307
|
keyValue
|
|
12175
12308
|
};
|
|
12176
12309
|
},
|
|
12177
|
-
getFormulas
|
|
12178
|
-
|
|
12310
|
+
getFormulas(getters, sheetId, definition) {
|
|
12311
|
+
const formulas = [];
|
|
12312
|
+
if (definition.keyValue && isFormula(definition.keyValue)) formulas.push(CompiledFormula.Compile(definition.keyValue, sheetId, getters));
|
|
12313
|
+
if (definition.baseline && isFormula(definition.baseline)) formulas.push(CompiledFormula.Compile(definition.baseline, sheetId, getters));
|
|
12314
|
+
return formulas;
|
|
12315
|
+
},
|
|
12316
|
+
getRuntime(getters, definition, _dataExtractor, sheetId) {
|
|
12179
12317
|
let formattedKeyValue = "";
|
|
12180
|
-
|
|
12318
|
+
const { scalar: keyValue, range: keyValueRange } = getData$1(definition.keyValue, getters, sheetId);
|
|
12181
12319
|
const locale = getters.getLocale();
|
|
12182
|
-
if (definition.
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
};
|
|
12188
|
-
keyValueCell = getters.getEvaluatedCell(keyValuePosition);
|
|
12189
|
-
formattedKeyValue = getKeyValueText(keyValueCell, definition.humanize ?? true, locale);
|
|
12190
|
-
}
|
|
12191
|
-
let baselineCell;
|
|
12192
|
-
const baseline = definition.baseline;
|
|
12193
|
-
if (baseline) {
|
|
12194
|
-
const baselinePosition = {
|
|
12195
|
-
sheetId: baseline.sheetId,
|
|
12196
|
-
col: baseline.zone.left,
|
|
12197
|
-
row: baseline.zone.top
|
|
12198
|
-
};
|
|
12199
|
-
baselineCell = getters.getEvaluatedCell(baselinePosition);
|
|
12200
|
-
}
|
|
12201
|
-
const { background, fontColor } = getters.getStyleOfSingleCellChart(definition.background, definition.keyValue);
|
|
12202
|
-
const baselineDisplay = getBaselineText(baselineCell, keyValueCell, definition.baselineMode, definition.humanize ?? true, locale);
|
|
12320
|
+
if (keyValue !== null && keyValue !== void 0) formattedKeyValue = getKeyValueText(keyValue, definition.humanize ?? true, locale);
|
|
12321
|
+
else formattedKeyValue = "";
|
|
12322
|
+
const { scalar: baseline, range: baselineRange } = getData$1(definition.baseline, getters, sheetId);
|
|
12323
|
+
const { background, fontColor } = getters.getStyleOfSingleCellChart(definition.background, keyValueRange);
|
|
12324
|
+
const baselineDisplay = getBaselineText(baseline, keyValue, definition.baselineMode, definition.humanize ?? true, locale);
|
|
12203
12325
|
const baselineValue = definition.baselineMode === "progress" && isNumber(baselineDisplay, locale) ? toNumber(baselineDisplay, locale) : 0;
|
|
12204
12326
|
const title = definition.title;
|
|
12205
12327
|
return {
|
|
@@ -12210,16 +12332,16 @@ const ScorecardChart$1 = {
|
|
|
12210
12332
|
keyValue: formattedKeyValue,
|
|
12211
12333
|
keyDescr: definition.keyDescr?.text ? getters.dynamicTranslate(definition.keyDescr.text) : "",
|
|
12212
12334
|
baselineDisplay,
|
|
12213
|
-
baselineArrow: getBaselineArrowDirection(
|
|
12214
|
-
baselineColor: getBaselineColor(
|
|
12335
|
+
baselineArrow: getBaselineArrowDirection(baseline, keyValue, definition.baselineMode),
|
|
12336
|
+
baselineColor: getBaselineColor(baseline, definition.baselineMode, keyValue, definition.baselineColorUp, definition.baselineColorDown),
|
|
12215
12337
|
baselineDescr: definition.baselineMode !== "progress" && definition.baselineDescr?.text ? getters.dynamicTranslate(definition.baselineDescr.text) : "",
|
|
12216
12338
|
fontColor,
|
|
12217
12339
|
background,
|
|
12218
12340
|
baselineStyle: {
|
|
12219
|
-
...definition.baselineMode !== "percentage" && definition.baselineMode !== "progress" &&
|
|
12220
|
-
sheetId:
|
|
12221
|
-
col:
|
|
12222
|
-
row:
|
|
12341
|
+
...definition.baselineMode !== "percentage" && definition.baselineMode !== "progress" && baselineRange ? getters.getCellComputedStyle({
|
|
12342
|
+
sheetId: baselineRange.sheetId,
|
|
12343
|
+
col: baselineRange.zone.left,
|
|
12344
|
+
row: baselineRange.zone.top
|
|
12223
12345
|
}) : void 0,
|
|
12224
12346
|
fontSize: definition.baselineDescr?.fontSize,
|
|
12225
12347
|
align: definition.baselineDescr?.align
|
|
@@ -12229,10 +12351,10 @@ const ScorecardChart$1 = {
|
|
|
12229
12351
|
...definition.baselineDescr
|
|
12230
12352
|
},
|
|
12231
12353
|
keyValueStyle: {
|
|
12232
|
-
...
|
|
12233
|
-
sheetId:
|
|
12234
|
-
col:
|
|
12235
|
-
row:
|
|
12354
|
+
...keyValueRange ? getters.getCellComputedStyle({
|
|
12355
|
+
sheetId: keyValueRange.sheetId,
|
|
12356
|
+
col: keyValueRange.zone.left,
|
|
12357
|
+
row: keyValueRange.zone.top
|
|
12236
12358
|
}) : void 0,
|
|
12237
12359
|
fontSize: definition.keyDescr?.fontSize,
|
|
12238
12360
|
align: definition.keyDescr?.align
|
|
@@ -13734,33 +13856,8 @@ var ViewportsStore = class extends SpreadsheetStore {
|
|
|
13734
13856
|
displayedSheetId = this.model.getters.getActiveSheetId();
|
|
13735
13857
|
constructor(get) {
|
|
13736
13858
|
super(get);
|
|
13737
|
-
this.model.selection.observe(this, { handleEvent: this.handleEvent.bind(this) });
|
|
13738
|
-
this.onDispose(() => {
|
|
13739
|
-
this.model.selection.unobserve(this);
|
|
13740
|
-
});
|
|
13741
13859
|
this.viewports.resetViewports(this.displayedSheetId);
|
|
13742
13860
|
}
|
|
13743
|
-
handleEvent(event) {
|
|
13744
|
-
const eventSheetId = this.getters.getActiveSheetId();
|
|
13745
|
-
if (event.options.scrollIntoView) {
|
|
13746
|
-
const oldZone = event.previousAnchor.zone;
|
|
13747
|
-
const newZone = event.anchor.zone;
|
|
13748
|
-
const isUpdateAnchorEvent = event.mode === "updateAnchor";
|
|
13749
|
-
const sameZone = isEqual(oldZone, newZone);
|
|
13750
|
-
let { col, row } = isUpdateAnchorEvent && sameZone ? event.anchor.cell : findCellInNewZone(oldZone, newZone);
|
|
13751
|
-
if (isUpdateAnchorEvent && !sameZone) {
|
|
13752
|
-
const { top, bottom, left, right } = this.viewports.getMainInternalViewport(eventSheetId);
|
|
13753
|
-
if (oldZone.left === newZone.left && oldZone.right === newZone.right) col = left > col || col > right ? left : col;
|
|
13754
|
-
if (oldZone.top === newZone.top && oldZone.bottom === newZone.bottom) row = top > row || row > bottom ? top : row;
|
|
13755
|
-
}
|
|
13756
|
-
col = Math.min(col, this.getters.getNumberCols(eventSheetId) - 1);
|
|
13757
|
-
row = Math.min(row, this.getters.getNumberRows(eventSheetId) - 1);
|
|
13758
|
-
if (!this.sheetsWithDirtyViewports.has(eventSheetId)) this.viewports.refreshViewport(eventSheetId, {
|
|
13759
|
-
col,
|
|
13760
|
-
row
|
|
13761
|
-
});
|
|
13762
|
-
}
|
|
13763
|
-
}
|
|
13764
13861
|
handle(cmd) {
|
|
13765
13862
|
if (invalidateEvaluationCommands.has(cmd.type)) for (const sheetId of this.getters.getSheetIds()) this.sheetsWithDirtyViewports.add(sheetId);
|
|
13766
13863
|
switch (cmd.type) {
|
|
@@ -13860,6 +13957,7 @@ var ViewportsStore = class extends SpreadsheetStore {
|
|
|
13860
13957
|
this.shiftVertically(topRowDims.end - boundaryTopY - viewportHeight);
|
|
13861
13958
|
}
|
|
13862
13959
|
scrollToCell(sheetId, col, row) {
|
|
13960
|
+
if (this.sheetsWithDirtyViewports.has(sheetId)) return;
|
|
13863
13961
|
this.viewports.refreshViewport(sheetId, {
|
|
13864
13962
|
col,
|
|
13865
13963
|
row
|
|
@@ -16952,110 +17050,6 @@ function isSquareMatrix(arg) {
|
|
|
16952
17050
|
}
|
|
16953
17051
|
const expectNumberGreaterThanOrEqualToOne = (value) => _t("The function [[FUNCTION_NAME]] expects a number value to be greater than or equal to 1, but receives %s.", value);
|
|
16954
17052
|
|
|
16955
|
-
//#endregion
|
|
16956
|
-
//#region src/functions/helper_matrices.ts
|
|
16957
|
-
function getUnitMatrix(n) {
|
|
16958
|
-
const matrix = Array(n);
|
|
16959
|
-
for (let i = 0; i < n; i++) {
|
|
16960
|
-
matrix[i] = Array(n).fill(0);
|
|
16961
|
-
matrix[i][i] = 1;
|
|
16962
|
-
}
|
|
16963
|
-
return matrix;
|
|
16964
|
-
}
|
|
16965
|
-
/**
|
|
16966
|
-
* Invert a matrix and compute its determinant using Gaussian Elimination.
|
|
16967
|
-
*
|
|
16968
|
-
* The Matrix should be a square matrix, and should be indexed [col][row] instead of the
|
|
16969
|
-
* standard mathematical indexing [row][col].
|
|
16970
|
-
*/
|
|
16971
|
-
function invertMatrix(M) {
|
|
16972
|
-
if (M.length < 1 || M[0].length < 1) throw new Error("invertMatrix: an empty matrix cannot be inverted.");
|
|
16973
|
-
if (M.length !== M[0].length) throw new Error("invertMatrix: only square matrices are invertible");
|
|
16974
|
-
let determinant = 1;
|
|
16975
|
-
const dim = M.length;
|
|
16976
|
-
const I = getUnitMatrix(dim);
|
|
16977
|
-
const C = M.map((row) => row.slice());
|
|
16978
|
-
for (let pivot = 0; pivot < dim; pivot++) {
|
|
16979
|
-
let diagonalElement = C[pivot][pivot];
|
|
16980
|
-
if (diagonalElement === 0) {
|
|
16981
|
-
for (let row = pivot + 1; row < dim; row++) if (C[pivot][row] !== 0) {
|
|
16982
|
-
swapMatrixRows(C, pivot, row);
|
|
16983
|
-
swapMatrixRows(I, pivot, row);
|
|
16984
|
-
determinant *= -1;
|
|
16985
|
-
break;
|
|
16986
|
-
}
|
|
16987
|
-
diagonalElement = C[pivot][pivot];
|
|
16988
|
-
if (diagonalElement === 0) return { determinant: 0 };
|
|
16989
|
-
}
|
|
16990
|
-
for (let col = 0; col < dim; col++) {
|
|
16991
|
-
C[col][pivot] = C[col][pivot] / diagonalElement;
|
|
16992
|
-
I[col][pivot] = I[col][pivot] / diagonalElement;
|
|
16993
|
-
}
|
|
16994
|
-
determinant *= diagonalElement;
|
|
16995
|
-
for (let row = 0; row < dim; row++) {
|
|
16996
|
-
if (row === pivot) continue;
|
|
16997
|
-
const e = C[pivot][row];
|
|
16998
|
-
for (let col = 0; col < dim; col++) {
|
|
16999
|
-
C[col][row] -= e * C[col][pivot];
|
|
17000
|
-
I[col][row] -= e * I[col][pivot];
|
|
17001
|
-
}
|
|
17002
|
-
}
|
|
17003
|
-
}
|
|
17004
|
-
return {
|
|
17005
|
-
inverted: I,
|
|
17006
|
-
determinant
|
|
17007
|
-
};
|
|
17008
|
-
}
|
|
17009
|
-
function swapMatrixRows(matrix, row1, row2) {
|
|
17010
|
-
for (let i = 0; i < matrix.length; i++) {
|
|
17011
|
-
const tmp = matrix[i][row1];
|
|
17012
|
-
matrix[i][row1] = matrix[i][row2];
|
|
17013
|
-
matrix[i][row2] = tmp;
|
|
17014
|
-
}
|
|
17015
|
-
}
|
|
17016
|
-
/**
|
|
17017
|
-
* Matrix multiplication of 2 matrices.
|
|
17018
|
-
* ex: matrix1 : n x l, matrix2 : m x n => result : m x l
|
|
17019
|
-
*
|
|
17020
|
-
* Note: we use indexing [col][row] instead of the standard mathematical notation [row][col]
|
|
17021
|
-
*/
|
|
17022
|
-
function multiplyMatrices(matrix1, matrix2) {
|
|
17023
|
-
if (matrix1.length < 1 || matrix2.length < 1) throw new Error("multiplyMatrices: empty matrices cannot be multiplied.");
|
|
17024
|
-
if (matrix1.length !== matrix2[0].length) throw new Error("multiplyMatrices: incompatible matrices size.");
|
|
17025
|
-
const rowsM1 = matrix1[0].length;
|
|
17026
|
-
const colsM2 = matrix2.length;
|
|
17027
|
-
const n = matrix1.length;
|
|
17028
|
-
const result = Array(colsM2);
|
|
17029
|
-
for (let col = 0; col < colsM2; col++) {
|
|
17030
|
-
result[col] = Array(rowsM1);
|
|
17031
|
-
for (let row = 0; row < rowsM1; row++) {
|
|
17032
|
-
let sum = 0;
|
|
17033
|
-
for (let k = 0; k < n; k++) sum += matrix1[k][row] * matrix2[col][k];
|
|
17034
|
-
result[col][row] = sum;
|
|
17035
|
-
}
|
|
17036
|
-
}
|
|
17037
|
-
return result;
|
|
17038
|
-
}
|
|
17039
|
-
/**
|
|
17040
|
-
* Return the input if it's a scalar or the first element of the input if it's a matrix.
|
|
17041
|
-
*/
|
|
17042
|
-
function toScalar(arg) {
|
|
17043
|
-
if (!isMatrix(arg)) return arg;
|
|
17044
|
-
if (!isSingleElementMatrix(arg)) throw new Error("The value should be a scalar or a 1x1 matrix");
|
|
17045
|
-
return arg[0][0];
|
|
17046
|
-
}
|
|
17047
|
-
function isSingleElementMatrix(matrix) {
|
|
17048
|
-
return matrix.length === 1 && matrix[0].length === 1;
|
|
17049
|
-
}
|
|
17050
|
-
function isMultipleElementMatrix(arg) {
|
|
17051
|
-
return isMatrix(arg) && !isSingleElementMatrix(arg);
|
|
17052
|
-
}
|
|
17053
|
-
function getMatrixArgIndices(args) {
|
|
17054
|
-
const indices = [];
|
|
17055
|
-
for (let i = 0; i < args.length; i++) if (isMultipleElementMatrix(args[i])) indices.push(i);
|
|
17056
|
-
return indices;
|
|
17057
|
-
}
|
|
17058
|
-
|
|
17059
17053
|
//#endregion
|
|
17060
17054
|
//#region src/functions/helper_statistical.ts
|
|
17061
17055
|
function assertSameNumberOfElements(...args) {
|
|
@@ -18206,8 +18200,6 @@ const ChartTerms = {
|
|
|
18206
18200
|
Unexpected: _t("The chart definition is invalid for an unknown reason"),
|
|
18207
18201
|
["InvalidDataSet"]: _t("The dataset is invalid"),
|
|
18208
18202
|
["InvalidLabelRange"]: _t("Labels are invalid"),
|
|
18209
|
-
["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
|
|
18210
|
-
["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
|
|
18211
18203
|
["InvalidGaugeDataRange"]: _t("The data range is invalid"),
|
|
18212
18204
|
["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
|
|
18213
18205
|
["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
|
|
@@ -21884,7 +21876,7 @@ function getPivotIconSvg(isCollapsed, isHovered) {
|
|
|
21884
21876
|
};
|
|
21885
21877
|
}
|
|
21886
21878
|
function getDataFilterIcon(isActive, isHighContrast, isHovered) {
|
|
21887
|
-
const symbolPath = isActive ? "
|
|
21879
|
+
const symbolPath = isActive ? "M 11 20 Q 10.575 20 10.2875 19.7125 T 10 19 L 10 13 L 4.2 5.6 Q 3.825 5.1 4.0875 4.55 T 5 4 L 19 4 Q 19.65 4 19.9125 4.55 T 19.8 5.6 L 14 13 L 14 19 Q 14 19.425 13.7125 19.7125 T 13 20 L 11 20 Z" : "M 339.667 681 L 510.333 681 L 510.333 595.667 L 339.667 595.667 L 339.667 681 Z M 41 169 L 41 254.333 L 809 254.333 L 809 169 L 41 169 Z M 169 467.667 L 681 467.667 L 681 382.333 L 169 382.333 L 169 467.667 Z";
|
|
21888
21880
|
const hoverBackgroundPath = isActive ? "M0,0 h24 v24 h-24" : "M0,0 h850 v850 h-850";
|
|
21889
21881
|
const colors = {
|
|
21890
21882
|
iconColor: FILTERS_COLOR,
|
|
@@ -29277,6 +29269,20 @@ migrationStepRegistry.add("0.1", { migrate(data) {
|
|
|
29277
29269
|
figure.data.chartDefinitions[chartId] = upgrade(definition);
|
|
29278
29270
|
}
|
|
29279
29271
|
return data;
|
|
29272
|
+
} }).add("19.5.1", { migrate(data) {
|
|
29273
|
+
function upgrade(definition) {
|
|
29274
|
+
if (definition.type !== "scorecard") return definition;
|
|
29275
|
+
definition = { ...definition };
|
|
29276
|
+
if (definition.keyValue) definition.keyValue = `=${definition.keyValue}`;
|
|
29277
|
+
if (definition.baseline) definition.baseline = `=${definition.baseline}`;
|
|
29278
|
+
return definition;
|
|
29279
|
+
}
|
|
29280
|
+
for (const sheet of data.sheets || []) for (const figure of sheet.figures || []) if (figure.tag === "chart") figure.data = upgrade(figure.data);
|
|
29281
|
+
else if (figure.tag === "carousel") for (const chartId in figure.data.chartDefinitions) {
|
|
29282
|
+
const definition = figure.data.chartDefinitions[chartId];
|
|
29283
|
+
figure.data.chartDefinitions[chartId] = upgrade(definition);
|
|
29284
|
+
}
|
|
29285
|
+
return data;
|
|
29280
29286
|
} });
|
|
29281
29287
|
function fixOverlappingFilters(data) {
|
|
29282
29288
|
for (const sheet of data.sheets || []) {
|
|
@@ -29949,7 +29955,7 @@ function buildScorecard(zone, getters) {
|
|
|
29949
29955
|
return {
|
|
29950
29956
|
type: "scorecard",
|
|
29951
29957
|
title: {},
|
|
29952
|
-
keyValue: getUnboundRange(getters, zone)
|
|
29958
|
+
keyValue: `=${getUnboundRange(getters, zone)}`,
|
|
29953
29959
|
background: cell?.style?.fillColor,
|
|
29954
29960
|
baselineMode: DEFAULT_SCORECARD_BASELINE_MODE,
|
|
29955
29961
|
baselineColorUp: DEFAULT_SCORECARD_BASELINE_COLOR_UP,
|
|
@@ -39647,10 +39653,10 @@ var ScatterConfigPanel = class extends GenericChartConfigPanel {
|
|
|
39647
39653
|
var ScorecardChartConfigPanel = class extends Component {
|
|
39648
39654
|
static template = "o-spreadsheet-ScorecardChartConfigPanel";
|
|
39649
39655
|
static components = {
|
|
39650
|
-
SelectionInput,
|
|
39651
39656
|
ChartErrorSection,
|
|
39652
39657
|
Section,
|
|
39653
|
-
Select
|
|
39658
|
+
Select,
|
|
39659
|
+
StandaloneComposer
|
|
39654
39660
|
};
|
|
39655
39661
|
props = useProps(chartSidePanelPropsDefinition);
|
|
39656
39662
|
state = proxy({
|
|
@@ -39662,30 +39668,18 @@ var ScorecardChartConfigPanel = class extends Component {
|
|
|
39662
39668
|
get errorMessages() {
|
|
39663
39669
|
return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
|
|
39664
39670
|
}
|
|
39665
|
-
|
|
39666
|
-
|
|
39667
|
-
}
|
|
39668
|
-
get isBaselineInvalid() {
|
|
39669
|
-
return !!this.state.baselineDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
|
|
39670
|
-
}
|
|
39671
|
-
onKeyValueRangeChanged(ranges) {
|
|
39672
|
-
this.keyValue = ranges[0];
|
|
39673
|
-
this.state.keyValueDispatchResult = this.props.canUpdateChart(this.props.chartId, { keyValue: this.keyValue });
|
|
39674
|
-
}
|
|
39675
|
-
updateKeyValueRange() {
|
|
39671
|
+
onConfirmKeyValue(keyValue) {
|
|
39672
|
+
this.keyValue = keyValue;
|
|
39676
39673
|
this.state.keyValueDispatchResult = this.props.updateChart(this.props.chartId, { keyValue: this.keyValue });
|
|
39677
39674
|
}
|
|
39678
|
-
|
|
39675
|
+
getKeyValue() {
|
|
39679
39676
|
return this.keyValue || "";
|
|
39680
39677
|
}
|
|
39681
|
-
|
|
39682
|
-
this.baseline =
|
|
39683
|
-
this.state.baselineDispatchResult = this.props.canUpdateChart(this.props.chartId, { baseline: this.baseline });
|
|
39684
|
-
}
|
|
39685
|
-
updateBaselineRange() {
|
|
39678
|
+
onConfirmBaseline(baseline) {
|
|
39679
|
+
this.baseline = baseline;
|
|
39686
39680
|
this.state.baselineDispatchResult = this.props.updateChart(this.props.chartId, { baseline: this.baseline });
|
|
39687
39681
|
}
|
|
39688
|
-
|
|
39682
|
+
getBaseline() {
|
|
39689
39683
|
return this.baseline || "";
|
|
39690
39684
|
}
|
|
39691
39685
|
updateBaselineMode(baselineMode) {
|
|
@@ -40142,6 +40136,7 @@ var MainChartPanelStore = class extends SpreadsheetStore {
|
|
|
40142
40136
|
changeChartType(chartId, newDisplayType) {
|
|
40143
40137
|
const currentCreationContext = this.getters.getContextCreationChart(chartId);
|
|
40144
40138
|
const savedCreationContext = this.creationContexts[chartId] || {};
|
|
40139
|
+
const auxiliaryRange = currentCreationContext && "auxiliaryRange" in currentCreationContext ? currentCreationContext.auxiliaryRange : savedCreationContext.auxiliaryRange;
|
|
40145
40140
|
let dataSetStyles = savedCreationContext.dataSetStyles ?? currentCreationContext?.dataSetStyles;
|
|
40146
40141
|
let dataSource = {
|
|
40147
40142
|
...savedCreationContext.dataSource,
|
|
@@ -40163,7 +40158,8 @@ var MainChartPanelStore = class extends SpreadsheetStore {
|
|
|
40163
40158
|
dataSetsHaveTitle: false,
|
|
40164
40159
|
...savedCreationContext.dataSource,
|
|
40165
40160
|
...currentCreationContext?.dataSource,
|
|
40166
|
-
dataSets: newRanges ?? []
|
|
40161
|
+
dataSets: newRanges ?? [],
|
|
40162
|
+
labelRange: auxiliaryRange
|
|
40167
40163
|
};
|
|
40168
40164
|
}
|
|
40169
40165
|
this.creationContexts[chartId] = {
|
|
@@ -40192,7 +40188,7 @@ var MainChartPanelStore = class extends SpreadsheetStore {
|
|
|
40192
40188
|
dataSetsStartWithSameRanges(currentDataSets, savedDataSets, currentStyles, savedStyles) {
|
|
40193
40189
|
return currentDataSets.every((ds, i) => {
|
|
40194
40190
|
const savedDs = savedDataSets[i];
|
|
40195
|
-
return deepEquals(ds.dataRange, savedDs
|
|
40191
|
+
return deepEquals(ds.dataRange, savedDs?.dataRange) && deepEquals(currentStyles?.[ds.dataSetId], savedStyles?.[savedDs?.dataSetId]);
|
|
40196
40192
|
});
|
|
40197
40193
|
}
|
|
40198
40194
|
/**
|
|
@@ -42712,8 +42708,8 @@ const SINGLE_NUMBER_COLUMN_SUGGESTIONS = [
|
|
|
42712
42708
|
{
|
|
42713
42709
|
description: _t("Highlights the most recent value compared to the previous one."),
|
|
42714
42710
|
isApplicable: ({ rowCount }) => rowCount < 3,
|
|
42715
|
-
build: (ctx) => scorecardChart(ctx.title, ctx.lastCellXC
|
|
42716
|
-
baseline: ctx.prevCellXC,
|
|
42711
|
+
build: (ctx) => scorecardChart(ctx.title, `=${ctx.lastCellXC}`, {
|
|
42712
|
+
baseline: ctx.prevCellXC ? `=${ctx.prevCellXC}` : void 0,
|
|
42717
42713
|
baselineMode: "difference"
|
|
42718
42714
|
})
|
|
42719
42715
|
},
|
|
@@ -42746,8 +42742,8 @@ const SINGLE_PERCENTAGE_COLUMN_SUGGESTIONS = [
|
|
|
42746
42742
|
{
|
|
42747
42743
|
description: _t("Shows the last percentage value with its baseline."),
|
|
42748
42744
|
isApplicable: ({ rowCount }) => rowCount < 3,
|
|
42749
|
-
build: (ctx) => scorecardChart(ctx.title, ctx.lastCellXC
|
|
42750
|
-
baseline: ctx.prevCellXC,
|
|
42745
|
+
build: (ctx) => scorecardChart(ctx.title, `=${ctx.lastCellXC}`, {
|
|
42746
|
+
baseline: ctx.prevCellXC ? `=${ctx.prevCellXC}` : void 0,
|
|
42751
42747
|
baselineMode: "percentage"
|
|
42752
42748
|
})
|
|
42753
42749
|
},
|
|
@@ -42776,7 +42772,7 @@ const SINGLE_PERCENTAGE_COLUMN_SUGGESTIONS = [
|
|
|
42776
42772
|
const SINGLE_DATE_COLUMN_SUGGESTIONS = [{
|
|
42777
42773
|
description: _t("Shows the last date value."),
|
|
42778
42774
|
isApplicable: ({ rowCount }) => rowCount === 1,
|
|
42779
|
-
build: (ctx) => scorecardChart(ctx.title, ctx.lastCellXC)
|
|
42775
|
+
build: (ctx) => scorecardChart(ctx.title, `=${ctx.lastCellXC}`)
|
|
42780
42776
|
}];
|
|
42781
42777
|
/** Pattern D — Single categorical column */
|
|
42782
42778
|
const SINGLE_CATEGORICAL_COLUMN_SUGGESTIONS = [
|
|
@@ -42810,7 +42806,7 @@ const SINGLE_CATEGORICAL_COLUMN_SUGGESTIONS = [
|
|
|
42810
42806
|
const SINGLE_LABEL_COLUMN_SUGGESTIONS = [{
|
|
42811
42807
|
description: _t("Displays a key performance indicator."),
|
|
42812
42808
|
isApplicable: ({ rowCount }) => rowCount === 1,
|
|
42813
|
-
build: (ctx) => scorecardChart(ctx.title, ctx.lastCellXC
|
|
42809
|
+
build: (ctx) => scorecardChart(ctx.title, `=${ctx.lastCellXC}`, {
|
|
42814
42810
|
baselineMode: "text",
|
|
42815
42811
|
humanize: false
|
|
42816
42812
|
})
|
|
@@ -42868,8 +42864,8 @@ const NUMBER_VS_NUMBER_SUGGESTIONS = [
|
|
|
42868
42864
|
{
|
|
42869
42865
|
description: _t("Highlights the second metric compared to the first one."),
|
|
42870
42866
|
isApplicable: ({ rowCount1, rowCount2 }) => rowCount1 === 1 && rowCount2 === 1,
|
|
42871
|
-
build: (ctx) => scorecardChart(ctx.title, ctx.lastCellXC
|
|
42872
|
-
baseline: ctx.prevCellXC,
|
|
42867
|
+
build: (ctx) => scorecardChart(ctx.title, `=${ctx.lastCellXC}`, {
|
|
42868
|
+
baseline: ctx.prevCellXC ? `=${ctx.prevCellXC}` : void 0,
|
|
42873
42869
|
baselineMode: "difference"
|
|
42874
42870
|
})
|
|
42875
42871
|
},
|
|
@@ -42927,10 +42923,10 @@ const LABEL_VS_NUMBER_SUGGESTIONS = [
|
|
|
42927
42923
|
{
|
|
42928
42924
|
description: _t("Highlights the most recent value for the named entity."),
|
|
42929
42925
|
isApplicable: ({ rowCount }) => rowCount === 1,
|
|
42930
|
-
build: (ctx) => scorecardChart("", ctx.lastCellXC
|
|
42926
|
+
build: (ctx) => scorecardChart("", `=${ctx.lastCellXC}`, {
|
|
42931
42927
|
humanize: false,
|
|
42932
42928
|
baselineMode: "text",
|
|
42933
|
-
baseline: ctx.prevCellXC
|
|
42929
|
+
baseline: ctx.prevCellXC ? `=${ctx.prevCellXC}` : void 0
|
|
42934
42930
|
})
|
|
42935
42931
|
},
|
|
42936
42932
|
{
|
|
@@ -71495,6 +71491,31 @@ var ImageProvider = class {
|
|
|
71495
71491
|
var MainViewportStore = class extends SpreadsheetStore {
|
|
71496
71492
|
viewStore = this.get(ViewportsStore);
|
|
71497
71493
|
sheetIdAtFinalize = void 0;
|
|
71494
|
+
constructor(get) {
|
|
71495
|
+
super(get);
|
|
71496
|
+
this.model.selection.observe(this, { handleEvent: this.handleEvent.bind(this) });
|
|
71497
|
+
this.onDispose(() => {
|
|
71498
|
+
this.model.selection.unobserve(this);
|
|
71499
|
+
});
|
|
71500
|
+
}
|
|
71501
|
+
handleEvent(event) {
|
|
71502
|
+
const eventSheetId = this.getters.getActiveSheetId();
|
|
71503
|
+
if (event.options.scrollIntoView) {
|
|
71504
|
+
const oldZone = event.previousAnchor.zone;
|
|
71505
|
+
const newZone = event.anchor.zone;
|
|
71506
|
+
const isUpdateAnchorEvent = event.mode === "updateAnchor";
|
|
71507
|
+
const sameZone = isEqual(oldZone, newZone);
|
|
71508
|
+
let { col, row } = isUpdateAnchorEvent && sameZone ? event.anchor.cell : findCellInNewZone(oldZone, newZone);
|
|
71509
|
+
if (isUpdateAnchorEvent && !sameZone) {
|
|
71510
|
+
const { top, bottom, left, right } = this.viewStore.viewports.getMainInternalViewport(eventSheetId);
|
|
71511
|
+
if (oldZone.left === newZone.left && oldZone.right === newZone.right) col = left > col || col > right ? left : col;
|
|
71512
|
+
if (oldZone.top === newZone.top && oldZone.bottom === newZone.bottom) row = top > row || row > bottom ? top : row;
|
|
71513
|
+
}
|
|
71514
|
+
col = Math.min(col, this.getters.getNumberCols(eventSheetId) - 1);
|
|
71515
|
+
row = Math.min(row, this.getters.getNumberRows(eventSheetId) - 1);
|
|
71516
|
+
this.viewStore.scrollToCell(eventSheetId, col, row);
|
|
71517
|
+
}
|
|
71518
|
+
}
|
|
71498
71519
|
handle(cmd) {
|
|
71499
71520
|
switch (cmd.type) {
|
|
71500
71521
|
case "UNDO":
|
|
@@ -90914,6 +90935,6 @@ const chartHelpers = {
|
|
|
90914
90935
|
//#endregion
|
|
90915
90936
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, BadExpressionError, CHART_TYPES, CellErrorType, CellValueType, CircularDependencyError, ClientDisconnectedError, ClipboardMIMEType, CommandResult, CompiledFormula, CorePlugin, CoreViewPlugin, DEFAULT_LOCALE, DEFAULT_LOCALES, DEFAULT_LOCALE_DIGIT_GROUPING, DIRECTION, DispatchResult, DivisionByZeroError, EvaluationError, InvalidReferenceError, LocalTransportService, Model, NEXT_VALUE, NotAvailableError, NumberTooLargeError, OrderedLayers, PREVIOUS_VALUE, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, SplillBlockedError, Spreadsheet, SpreadsheetPivotTable, UIPlugin, UnknownFunctionError, __info__, addFunction, addRenderingLayer, astToFormula, availableConditionalFormatOperators, availableDataValidationOperators, availableFiltersOperators, borderPositions, borderStyles, canExecuteInReadonly, categories, chartHelpers, compatibility, components, composerFocusTypes, constants, convertAstNodes, coreTypes, createAutocompleteArgumentsProvider, errorTypes, filterDateCriterionOperators, filterNumberCriterionOperators, filterTextCriterionOperators, findCellInNewZone, functionCache, getCaretDownSvg, getCaretUpSvg, helpers, hooks, invalidSubtotalFormulasCommands, invalidateBordersCommands, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, isCoreCommand, isHeadersDependant, isMatrix, isPositionDependent, isRangeDependant, isSheetDependent, isTargetDependent, isZoneDependent, iterateAstNodes, links, load, lockedSheetAllowedCommands, parse, parseTokens, readonlyAllowedCommands, registries, schemeToColorScale, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
90916
90937
|
|
|
90917
|
-
__info__.version = "19.5.0-alpha.
|
|
90918
|
-
__info__.date = "2026-08-
|
|
90919
|
-
__info__.hash = "
|
|
90938
|
+
__info__.version = "19.5.0-alpha.13";
|
|
90939
|
+
__info__.date = "2026-08-21T15:33:44.046Z";
|
|
90940
|
+
__info__.hash = "a73559e";
|