@odoo/o-spreadsheet 19.4.10 → 19.4.12
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 +807 -759
- package/dist/o_spreadsheet.css +7 -6
- package/dist/o_spreadsheet.esm.js +807 -759
- package/dist/o_spreadsheet.iife.js +807 -759
- package/dist/o_spreadsheet.min.iife.js +258 -258
- package/dist/o_spreadsheet.xml +11 -11
- package/dist/types/components/grid_overlay/grid_overlay.d.ts +1 -0
- package/dist/types/components/side_panel/chart/calendar_chart/calendar_chart_config_panel.d.ts +0 -2
- package/dist/types/components/spreadsheet/spreadsheet.d.ts +9 -4
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/helpers/text_helper.d.ts +4 -0
- package/dist/types/plugins/core/carousel.d.ts +1 -1
- package/dist/types/plugins/core/range.d.ts +3 -1
- package/dist/types/plugins/ui_feature/geo_features.d.ts +2 -1
- package/dist/types/types/commands.d.ts +2 -2
- package/dist/types/types/misc.d.ts +1 -0
- package/dist/types/types/model.d.ts +2 -2
- package/package.json +2 -2
package/dist/o_spreadsheet.cjs
CHANGED
|
@@ -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.4.
|
|
6
|
-
* @date 2026-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 19.4.12
|
|
6
|
+
* @date 2026-09-10T05:38:01.898Z
|
|
7
|
+
* @hash cdb63b4
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
@@ -446,6 +446,7 @@ const FILTERS_COLOR = "#188038";
|
|
|
446
446
|
const COMPOSER_ASSISTANT_COLOR = "light-dark(#9B359B, #B972A6)";
|
|
447
447
|
const COLOR_TRANSPARENT = "#00000000";
|
|
448
448
|
const TABLE_HOVER_BACKGROUND_COLOR = "#017E8414";
|
|
449
|
+
const DEFAULT_CHART_BACKGROUND_COLOR = "#FFFFFF";
|
|
449
450
|
const CHART_WATERFALL_POSITIVE_COLOR = "#4EA7F2";
|
|
450
451
|
const CHART_WATERFALL_NEGATIVE_COLOR = "#EA6175";
|
|
451
452
|
const CHART_WATERFALL_SUBTOTAL_COLOR = "#AAAAAA";
|
|
@@ -7852,7 +7853,8 @@ const invalidateChartEvaluationCommands = /* @__PURE__ */ new Set([
|
|
|
7852
7853
|
"UPDATE_TABLE",
|
|
7853
7854
|
"UPDATE_FILTER",
|
|
7854
7855
|
"UNDO",
|
|
7855
|
-
"REDO"
|
|
7856
|
+
"REDO",
|
|
7857
|
+
"UPDATE_COLOR_SCHEME"
|
|
7856
7858
|
]);
|
|
7857
7859
|
const invalidateDependenciesCommands = /* @__PURE__ */ new Set(["MOVE_RANGES"]);
|
|
7858
7860
|
const invalidateCFEvaluationCommands = /* @__PURE__ */ new Set([
|
|
@@ -8993,6 +8995,259 @@ const chartMinorGridPlugin = {
|
|
|
8993
8995
|
}
|
|
8994
8996
|
};
|
|
8995
8997
|
|
|
8998
|
+
//#endregion
|
|
8999
|
+
//#region src/xlsx/constants.ts
|
|
9000
|
+
/** In XLSX color format (no #) */
|
|
9001
|
+
const AUTO_COLOR = "000000";
|
|
9002
|
+
const XLSX_ICONSET_MAP = {
|
|
9003
|
+
arrows: "3Arrows",
|
|
9004
|
+
smiley: "3Symbols",
|
|
9005
|
+
dots: "3TrafficLights1"
|
|
9006
|
+
};
|
|
9007
|
+
const NAMESPACE = {
|
|
9008
|
+
styleSheet: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9009
|
+
sst: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9010
|
+
Relationships: "http://schemas.openxmlformats.org/package/2006/relationships",
|
|
9011
|
+
Types: "http://schemas.openxmlformats.org/package/2006/content-types",
|
|
9012
|
+
worksheet: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9013
|
+
workbook: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9014
|
+
drawing: "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",
|
|
9015
|
+
table: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9016
|
+
revision: "http://schemas.microsoft.com/office/spreadsheetml/2014/revision",
|
|
9017
|
+
revision3: "http://schemas.microsoft.com/office/spreadsheetml/2016/revision3",
|
|
9018
|
+
markupCompatibility: "http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
9019
|
+
};
|
|
9020
|
+
const DRAWING_NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
9021
|
+
const DRAWING_NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
9022
|
+
const CONTENT_TYPES = {
|
|
9023
|
+
workbook: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
|
9024
|
+
macroEnabledWorkbook: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
|
9025
|
+
templateWorkbook: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml",
|
|
9026
|
+
macroEnabledTemplateWorkbook: "application/vnd.ms-excel.template.macroEnabled.main+xml",
|
|
9027
|
+
excelAddInWorkbook: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
|
9028
|
+
sheet: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
|
9029
|
+
metadata: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
|
9030
|
+
sharedStrings: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
|
9031
|
+
styles: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
|
9032
|
+
drawing: "application/vnd.openxmlformats-officedocument.drawing+xml",
|
|
9033
|
+
chart: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
|
|
9034
|
+
themes: "application/vnd.openxmlformats-officedocument.theme+xml",
|
|
9035
|
+
table: "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
|
|
9036
|
+
pivot: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml",
|
|
9037
|
+
externalLink: "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml"
|
|
9038
|
+
};
|
|
9039
|
+
const XLSX_RELATION_TYPE = {
|
|
9040
|
+
document: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
|
|
9041
|
+
sheet: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",
|
|
9042
|
+
metadata: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",
|
|
9043
|
+
sharedStrings: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",
|
|
9044
|
+
styles: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",
|
|
9045
|
+
drawing: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",
|
|
9046
|
+
chart: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",
|
|
9047
|
+
theme: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
|
|
9048
|
+
table: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",
|
|
9049
|
+
hyperlink: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
9050
|
+
image: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
|
|
9051
|
+
};
|
|
9052
|
+
const ARRAY_FORMULA_URI = "bdbb8cdc-fa1e-496e-a857-3c3f30c029c3";
|
|
9053
|
+
const RELATIONSHIP_NSR = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
9054
|
+
const HEIGHT_FACTOR = .75;
|
|
9055
|
+
/**
|
|
9056
|
+
* Excel says its default column width is 8.43 characters (64px)
|
|
9057
|
+
* which makes WIDTH_FACTOR = 0.1317, but it doesn't work well
|
|
9058
|
+
* 0.143 is a value from dev's experiments.
|
|
9059
|
+
*/
|
|
9060
|
+
const WIDTH_FACTOR = .143;
|
|
9061
|
+
/** unit : maximum number of characters a column can hold at the standard font size. What. */
|
|
9062
|
+
const EXCEL_DEFAULT_COL_WIDTH = 8.43;
|
|
9063
|
+
/** unit : points */
|
|
9064
|
+
const EXCEL_DEFAULT_ROW_HEIGHT = 12.75;
|
|
9065
|
+
const FORCE_DEFAULT_ARGS_FUNCTIONS = {
|
|
9066
|
+
FLOOR: [{
|
|
9067
|
+
type: "NUMBER",
|
|
9068
|
+
value: 1
|
|
9069
|
+
}],
|
|
9070
|
+
CEILING: [{
|
|
9071
|
+
type: "NUMBER",
|
|
9072
|
+
value: 1
|
|
9073
|
+
}],
|
|
9074
|
+
ROUND: [{
|
|
9075
|
+
type: "NUMBER",
|
|
9076
|
+
value: 0
|
|
9077
|
+
}],
|
|
9078
|
+
ROUNDUP: [{
|
|
9079
|
+
type: "NUMBER",
|
|
9080
|
+
value: 0
|
|
9081
|
+
}],
|
|
9082
|
+
ROUNDDOWN: [{
|
|
9083
|
+
type: "NUMBER",
|
|
9084
|
+
value: 0
|
|
9085
|
+
}],
|
|
9086
|
+
IFERROR: [{
|
|
9087
|
+
type: "NUMBER",
|
|
9088
|
+
value: 0
|
|
9089
|
+
}]
|
|
9090
|
+
};
|
|
9091
|
+
/**
|
|
9092
|
+
* This list contains all "future" functions that are not compatible with older versions of Excel
|
|
9093
|
+
* For more information, see https://docs.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/5d1b6d44-6fc1-4ecd-8fef-0b27406cc2bf
|
|
9094
|
+
*/
|
|
9095
|
+
const NON_RETROCOMPATIBLE_FUNCTIONS = [
|
|
9096
|
+
"ACOT",
|
|
9097
|
+
"ACOTH",
|
|
9098
|
+
"AGGREGATE",
|
|
9099
|
+
"ARABIC",
|
|
9100
|
+
"BASE",
|
|
9101
|
+
"BETA.DIST",
|
|
9102
|
+
"BETA.INV",
|
|
9103
|
+
"BINOM.DIST",
|
|
9104
|
+
"BINOM.DIST.RANGE",
|
|
9105
|
+
"BINOM.INV",
|
|
9106
|
+
"BITAND",
|
|
9107
|
+
"BITLSHIFT",
|
|
9108
|
+
"BITOR",
|
|
9109
|
+
"BITRSHIFT",
|
|
9110
|
+
"BITXOR",
|
|
9111
|
+
"BYCOL",
|
|
9112
|
+
"BYROW",
|
|
9113
|
+
"CEILING.MATH",
|
|
9114
|
+
"CEILING.PRECISE",
|
|
9115
|
+
"CHISQ.DIST",
|
|
9116
|
+
"CHISQ.DIST.RT",
|
|
9117
|
+
"CHISQ.INV",
|
|
9118
|
+
"CHISQ.INV.RT",
|
|
9119
|
+
"CHISQ.TEST",
|
|
9120
|
+
"CHOOSECOLS",
|
|
9121
|
+
"CHOOSEROWS",
|
|
9122
|
+
"COMBINA",
|
|
9123
|
+
"CONCAT",
|
|
9124
|
+
"CONFIDENCE.NORM",
|
|
9125
|
+
"CONFIDENCE.T",
|
|
9126
|
+
"COT",
|
|
9127
|
+
"COTH",
|
|
9128
|
+
"COVARIANCE.P",
|
|
9129
|
+
"COVARIANCE.S",
|
|
9130
|
+
"CSC",
|
|
9131
|
+
"CSCH",
|
|
9132
|
+
"DAYS",
|
|
9133
|
+
"DECIMAL",
|
|
9134
|
+
"DROP",
|
|
9135
|
+
"ERF.PRECISE",
|
|
9136
|
+
"ERFC.PRECISE",
|
|
9137
|
+
"EXPAND",
|
|
9138
|
+
"EXPON.DIST",
|
|
9139
|
+
"F.DIST",
|
|
9140
|
+
"F.DIST.RT",
|
|
9141
|
+
"F.INV",
|
|
9142
|
+
"F.INV.RT",
|
|
9143
|
+
"F.TEST",
|
|
9144
|
+
"FIELDVALUE",
|
|
9145
|
+
"FILTERXML",
|
|
9146
|
+
"FLOOR.MATH",
|
|
9147
|
+
"FLOOR.PRECISE",
|
|
9148
|
+
"FORECAST.ETS",
|
|
9149
|
+
"FORECAST.ETS.CONFINT",
|
|
9150
|
+
"FORECAST.ETS.SEASONALITY",
|
|
9151
|
+
"FORECAST.ETS.STAT",
|
|
9152
|
+
"FORECAST.LINEAR",
|
|
9153
|
+
"FORMULATEXT",
|
|
9154
|
+
"GAMMA",
|
|
9155
|
+
"GAMMA.DIST",
|
|
9156
|
+
"GAMMA.INV",
|
|
9157
|
+
"GAMMALN.PRECISE",
|
|
9158
|
+
"GAUSS",
|
|
9159
|
+
"HSTACK",
|
|
9160
|
+
"HYPGEOM.DIST",
|
|
9161
|
+
"IFNA",
|
|
9162
|
+
"IFS",
|
|
9163
|
+
"IMCOSH",
|
|
9164
|
+
"IMCOT",
|
|
9165
|
+
"IMCSC",
|
|
9166
|
+
"IMCSCH",
|
|
9167
|
+
"IMSEC",
|
|
9168
|
+
"IMSECH",
|
|
9169
|
+
"IMSINH",
|
|
9170
|
+
"IMTAN",
|
|
9171
|
+
"ISFORMULA",
|
|
9172
|
+
"ISOMITTED",
|
|
9173
|
+
"ISOWEEKNUM",
|
|
9174
|
+
"LAMBDA",
|
|
9175
|
+
"LET",
|
|
9176
|
+
"LOGNORM.DIST",
|
|
9177
|
+
"LOGNORM.INV",
|
|
9178
|
+
"MAKEARRAY",
|
|
9179
|
+
"MAP",
|
|
9180
|
+
"MAXIFS",
|
|
9181
|
+
"MINIFS",
|
|
9182
|
+
"MODE.MULT",
|
|
9183
|
+
"MODE.SNGL",
|
|
9184
|
+
"MUNIT",
|
|
9185
|
+
"NEGBINOM.DIST",
|
|
9186
|
+
"NORM.DIST",
|
|
9187
|
+
"NORM.INV",
|
|
9188
|
+
"NORM.S.DIST",
|
|
9189
|
+
"NORM.S.INV",
|
|
9190
|
+
"NUMBERVALUE",
|
|
9191
|
+
"PDURATION",
|
|
9192
|
+
"PERCENTILE.EXC",
|
|
9193
|
+
"PERCENTILE.INC",
|
|
9194
|
+
"PERCENTRANK.EXC",
|
|
9195
|
+
"PERCENTRANK.INC",
|
|
9196
|
+
"PERMUTATIONA",
|
|
9197
|
+
"PHI",
|
|
9198
|
+
"POISSON.DIST",
|
|
9199
|
+
"PQSOURCE",
|
|
9200
|
+
"PYTHON_STR",
|
|
9201
|
+
"PYTHON_TYPE",
|
|
9202
|
+
"PYTHON_TYPENAME",
|
|
9203
|
+
"QUARTILE.EXC",
|
|
9204
|
+
"QUARTILE.INC",
|
|
9205
|
+
"QUERYSTRING",
|
|
9206
|
+
"RANDARRAY",
|
|
9207
|
+
"RANK.AVG",
|
|
9208
|
+
"RANK.EQ",
|
|
9209
|
+
"REDUCE",
|
|
9210
|
+
"RRI",
|
|
9211
|
+
"SCAN",
|
|
9212
|
+
"SEC",
|
|
9213
|
+
"SECH",
|
|
9214
|
+
"SEQUENCE",
|
|
9215
|
+
"SHEET",
|
|
9216
|
+
"SHEETS",
|
|
9217
|
+
"SKEW.P",
|
|
9218
|
+
"SORTBY",
|
|
9219
|
+
"STDEV.P",
|
|
9220
|
+
"STDEV.S",
|
|
9221
|
+
"SWITCH",
|
|
9222
|
+
"T.DIST",
|
|
9223
|
+
"T.DIST.2T",
|
|
9224
|
+
"T.DIST.RT",
|
|
9225
|
+
"T.INV",
|
|
9226
|
+
"T.INV.2T",
|
|
9227
|
+
"T.TEST",
|
|
9228
|
+
"TAKE",
|
|
9229
|
+
"TEXTAFTER",
|
|
9230
|
+
"TEXTBEFORE",
|
|
9231
|
+
"TEXTJOIN",
|
|
9232
|
+
"TEXTSPLIT",
|
|
9233
|
+
"TOCOL",
|
|
9234
|
+
"TOROW",
|
|
9235
|
+
"UNICHAR",
|
|
9236
|
+
"UNICODE",
|
|
9237
|
+
"UNIQUE",
|
|
9238
|
+
"VAR.P",
|
|
9239
|
+
"VAR.S",
|
|
9240
|
+
"VSTACK",
|
|
9241
|
+
"WEBSERVICE",
|
|
9242
|
+
"WEIBULL.DIST",
|
|
9243
|
+
"WRAPCOLS",
|
|
9244
|
+
"WRAPROWS",
|
|
9245
|
+
"XLOOKUP",
|
|
9246
|
+
"XOR",
|
|
9247
|
+
"Z.TEST"
|
|
9248
|
+
];
|
|
9249
|
+
const CONTENT_TYPES_FILE = "[Content_Types].xml";
|
|
9250
|
+
|
|
8996
9251
|
//#endregion
|
|
8997
9252
|
//#region src/helpers/color.ts
|
|
8998
9253
|
const RBA_REGEX = /rgba?\(|\s+|\)/gi;
|
|
@@ -9694,259 +9949,6 @@ function colorCell(value, minValue, minColor, colorDiffUnit) {
|
|
|
9694
9949
|
return r << 16 | g << 8 | b;
|
|
9695
9950
|
}
|
|
9696
9951
|
|
|
9697
|
-
//#endregion
|
|
9698
|
-
//#region src/xlsx/constants.ts
|
|
9699
|
-
/** In XLSX color format (no #) */
|
|
9700
|
-
const AUTO_COLOR = "000000";
|
|
9701
|
-
const XLSX_ICONSET_MAP = {
|
|
9702
|
-
arrows: "3Arrows",
|
|
9703
|
-
smiley: "3Symbols",
|
|
9704
|
-
dots: "3TrafficLights1"
|
|
9705
|
-
};
|
|
9706
|
-
const NAMESPACE = {
|
|
9707
|
-
styleSheet: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9708
|
-
sst: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9709
|
-
Relationships: "http://schemas.openxmlformats.org/package/2006/relationships",
|
|
9710
|
-
Types: "http://schemas.openxmlformats.org/package/2006/content-types",
|
|
9711
|
-
worksheet: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9712
|
-
workbook: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9713
|
-
drawing: "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",
|
|
9714
|
-
table: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9715
|
-
revision: "http://schemas.microsoft.com/office/spreadsheetml/2014/revision",
|
|
9716
|
-
revision3: "http://schemas.microsoft.com/office/spreadsheetml/2016/revision3",
|
|
9717
|
-
markupCompatibility: "http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
9718
|
-
};
|
|
9719
|
-
const DRAWING_NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
9720
|
-
const DRAWING_NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
9721
|
-
const CONTENT_TYPES = {
|
|
9722
|
-
workbook: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
|
9723
|
-
macroEnabledWorkbook: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
|
9724
|
-
templateWorkbook: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml",
|
|
9725
|
-
macroEnabledTemplateWorkbook: "application/vnd.ms-excel.template.macroEnabled.main+xml",
|
|
9726
|
-
excelAddInWorkbook: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
|
9727
|
-
sheet: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
|
9728
|
-
metadata: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
|
9729
|
-
sharedStrings: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
|
9730
|
-
styles: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
|
9731
|
-
drawing: "application/vnd.openxmlformats-officedocument.drawing+xml",
|
|
9732
|
-
chart: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
|
|
9733
|
-
themes: "application/vnd.openxmlformats-officedocument.theme+xml",
|
|
9734
|
-
table: "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
|
|
9735
|
-
pivot: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml",
|
|
9736
|
-
externalLink: "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml"
|
|
9737
|
-
};
|
|
9738
|
-
const XLSX_RELATION_TYPE = {
|
|
9739
|
-
document: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
|
|
9740
|
-
sheet: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",
|
|
9741
|
-
metadata: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",
|
|
9742
|
-
sharedStrings: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",
|
|
9743
|
-
styles: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",
|
|
9744
|
-
drawing: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",
|
|
9745
|
-
chart: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",
|
|
9746
|
-
theme: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
|
|
9747
|
-
table: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",
|
|
9748
|
-
hyperlink: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
9749
|
-
image: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
|
|
9750
|
-
};
|
|
9751
|
-
const ARRAY_FORMULA_URI = "bdbb8cdc-fa1e-496e-a857-3c3f30c029c3";
|
|
9752
|
-
const RELATIONSHIP_NSR = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
9753
|
-
const HEIGHT_FACTOR = .75;
|
|
9754
|
-
/**
|
|
9755
|
-
* Excel says its default column width is 8.43 characters (64px)
|
|
9756
|
-
* which makes WIDTH_FACTOR = 0.1317, but it doesn't work well
|
|
9757
|
-
* 0.143 is a value from dev's experiments.
|
|
9758
|
-
*/
|
|
9759
|
-
const WIDTH_FACTOR = .143;
|
|
9760
|
-
/** unit : maximum number of characters a column can hold at the standard font size. What. */
|
|
9761
|
-
const EXCEL_DEFAULT_COL_WIDTH = 8.43;
|
|
9762
|
-
/** unit : points */
|
|
9763
|
-
const EXCEL_DEFAULT_ROW_HEIGHT = 12.75;
|
|
9764
|
-
const FORCE_DEFAULT_ARGS_FUNCTIONS = {
|
|
9765
|
-
FLOOR: [{
|
|
9766
|
-
type: "NUMBER",
|
|
9767
|
-
value: 1
|
|
9768
|
-
}],
|
|
9769
|
-
CEILING: [{
|
|
9770
|
-
type: "NUMBER",
|
|
9771
|
-
value: 1
|
|
9772
|
-
}],
|
|
9773
|
-
ROUND: [{
|
|
9774
|
-
type: "NUMBER",
|
|
9775
|
-
value: 0
|
|
9776
|
-
}],
|
|
9777
|
-
ROUNDUP: [{
|
|
9778
|
-
type: "NUMBER",
|
|
9779
|
-
value: 0
|
|
9780
|
-
}],
|
|
9781
|
-
ROUNDDOWN: [{
|
|
9782
|
-
type: "NUMBER",
|
|
9783
|
-
value: 0
|
|
9784
|
-
}],
|
|
9785
|
-
IFERROR: [{
|
|
9786
|
-
type: "NUMBER",
|
|
9787
|
-
value: 0
|
|
9788
|
-
}]
|
|
9789
|
-
};
|
|
9790
|
-
/**
|
|
9791
|
-
* This list contains all "future" functions that are not compatible with older versions of Excel
|
|
9792
|
-
* For more information, see https://docs.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/5d1b6d44-6fc1-4ecd-8fef-0b27406cc2bf
|
|
9793
|
-
*/
|
|
9794
|
-
const NON_RETROCOMPATIBLE_FUNCTIONS = [
|
|
9795
|
-
"ACOT",
|
|
9796
|
-
"ACOTH",
|
|
9797
|
-
"AGGREGATE",
|
|
9798
|
-
"ARABIC",
|
|
9799
|
-
"BASE",
|
|
9800
|
-
"BETA.DIST",
|
|
9801
|
-
"BETA.INV",
|
|
9802
|
-
"BINOM.DIST",
|
|
9803
|
-
"BINOM.DIST.RANGE",
|
|
9804
|
-
"BINOM.INV",
|
|
9805
|
-
"BITAND",
|
|
9806
|
-
"BITLSHIFT",
|
|
9807
|
-
"BITOR",
|
|
9808
|
-
"BITRSHIFT",
|
|
9809
|
-
"BITXOR",
|
|
9810
|
-
"BYCOL",
|
|
9811
|
-
"BYROW",
|
|
9812
|
-
"CEILING.MATH",
|
|
9813
|
-
"CEILING.PRECISE",
|
|
9814
|
-
"CHISQ.DIST",
|
|
9815
|
-
"CHISQ.DIST.RT",
|
|
9816
|
-
"CHISQ.INV",
|
|
9817
|
-
"CHISQ.INV.RT",
|
|
9818
|
-
"CHISQ.TEST",
|
|
9819
|
-
"CHOOSECOLS",
|
|
9820
|
-
"CHOOSEROWS",
|
|
9821
|
-
"COMBINA",
|
|
9822
|
-
"CONCAT",
|
|
9823
|
-
"CONFIDENCE.NORM",
|
|
9824
|
-
"CONFIDENCE.T",
|
|
9825
|
-
"COT",
|
|
9826
|
-
"COTH",
|
|
9827
|
-
"COVARIANCE.P",
|
|
9828
|
-
"COVARIANCE.S",
|
|
9829
|
-
"CSC",
|
|
9830
|
-
"CSCH",
|
|
9831
|
-
"DAYS",
|
|
9832
|
-
"DECIMAL",
|
|
9833
|
-
"DROP",
|
|
9834
|
-
"ERF.PRECISE",
|
|
9835
|
-
"ERFC.PRECISE",
|
|
9836
|
-
"EXPAND",
|
|
9837
|
-
"EXPON.DIST",
|
|
9838
|
-
"F.DIST",
|
|
9839
|
-
"F.DIST.RT",
|
|
9840
|
-
"F.INV",
|
|
9841
|
-
"F.INV.RT",
|
|
9842
|
-
"F.TEST",
|
|
9843
|
-
"FIELDVALUE",
|
|
9844
|
-
"FILTERXML",
|
|
9845
|
-
"FLOOR.MATH",
|
|
9846
|
-
"FLOOR.PRECISE",
|
|
9847
|
-
"FORECAST.ETS",
|
|
9848
|
-
"FORECAST.ETS.CONFINT",
|
|
9849
|
-
"FORECAST.ETS.SEASONALITY",
|
|
9850
|
-
"FORECAST.ETS.STAT",
|
|
9851
|
-
"FORECAST.LINEAR",
|
|
9852
|
-
"FORMULATEXT",
|
|
9853
|
-
"GAMMA",
|
|
9854
|
-
"GAMMA.DIST",
|
|
9855
|
-
"GAMMA.INV",
|
|
9856
|
-
"GAMMALN.PRECISE",
|
|
9857
|
-
"GAUSS",
|
|
9858
|
-
"HSTACK",
|
|
9859
|
-
"HYPGEOM.DIST",
|
|
9860
|
-
"IFNA",
|
|
9861
|
-
"IFS",
|
|
9862
|
-
"IMCOSH",
|
|
9863
|
-
"IMCOT",
|
|
9864
|
-
"IMCSC",
|
|
9865
|
-
"IMCSCH",
|
|
9866
|
-
"IMSEC",
|
|
9867
|
-
"IMSECH",
|
|
9868
|
-
"IMSINH",
|
|
9869
|
-
"IMTAN",
|
|
9870
|
-
"ISFORMULA",
|
|
9871
|
-
"ISOMITTED",
|
|
9872
|
-
"ISOWEEKNUM",
|
|
9873
|
-
"LAMBDA",
|
|
9874
|
-
"LET",
|
|
9875
|
-
"LOGNORM.DIST",
|
|
9876
|
-
"LOGNORM.INV",
|
|
9877
|
-
"MAKEARRAY",
|
|
9878
|
-
"MAP",
|
|
9879
|
-
"MAXIFS",
|
|
9880
|
-
"MINIFS",
|
|
9881
|
-
"MODE.MULT",
|
|
9882
|
-
"MODE.SNGL",
|
|
9883
|
-
"MUNIT",
|
|
9884
|
-
"NEGBINOM.DIST",
|
|
9885
|
-
"NORM.DIST",
|
|
9886
|
-
"NORM.INV",
|
|
9887
|
-
"NORM.S.DIST",
|
|
9888
|
-
"NORM.S.INV",
|
|
9889
|
-
"NUMBERVALUE",
|
|
9890
|
-
"PDURATION",
|
|
9891
|
-
"PERCENTILE.EXC",
|
|
9892
|
-
"PERCENTILE.INC",
|
|
9893
|
-
"PERCENTRANK.EXC",
|
|
9894
|
-
"PERCENTRANK.INC",
|
|
9895
|
-
"PERMUTATIONA",
|
|
9896
|
-
"PHI",
|
|
9897
|
-
"POISSON.DIST",
|
|
9898
|
-
"PQSOURCE",
|
|
9899
|
-
"PYTHON_STR",
|
|
9900
|
-
"PYTHON_TYPE",
|
|
9901
|
-
"PYTHON_TYPENAME",
|
|
9902
|
-
"QUARTILE.EXC",
|
|
9903
|
-
"QUARTILE.INC",
|
|
9904
|
-
"QUERYSTRING",
|
|
9905
|
-
"RANDARRAY",
|
|
9906
|
-
"RANK.AVG",
|
|
9907
|
-
"RANK.EQ",
|
|
9908
|
-
"REDUCE",
|
|
9909
|
-
"RRI",
|
|
9910
|
-
"SCAN",
|
|
9911
|
-
"SEC",
|
|
9912
|
-
"SECH",
|
|
9913
|
-
"SEQUENCE",
|
|
9914
|
-
"SHEET",
|
|
9915
|
-
"SHEETS",
|
|
9916
|
-
"SKEW.P",
|
|
9917
|
-
"SORTBY",
|
|
9918
|
-
"STDEV.P",
|
|
9919
|
-
"STDEV.S",
|
|
9920
|
-
"SWITCH",
|
|
9921
|
-
"T.DIST",
|
|
9922
|
-
"T.DIST.2T",
|
|
9923
|
-
"T.DIST.RT",
|
|
9924
|
-
"T.INV",
|
|
9925
|
-
"T.INV.2T",
|
|
9926
|
-
"T.TEST",
|
|
9927
|
-
"TAKE",
|
|
9928
|
-
"TEXTAFTER",
|
|
9929
|
-
"TEXTBEFORE",
|
|
9930
|
-
"TEXTJOIN",
|
|
9931
|
-
"TEXTSPLIT",
|
|
9932
|
-
"TOCOL",
|
|
9933
|
-
"TOROW",
|
|
9934
|
-
"UNICHAR",
|
|
9935
|
-
"UNICODE",
|
|
9936
|
-
"UNIQUE",
|
|
9937
|
-
"VAR.P",
|
|
9938
|
-
"VAR.S",
|
|
9939
|
-
"VSTACK",
|
|
9940
|
-
"WEBSERVICE",
|
|
9941
|
-
"WEIBULL.DIST",
|
|
9942
|
-
"WRAPCOLS",
|
|
9943
|
-
"WRAPROWS",
|
|
9944
|
-
"XLOOKUP",
|
|
9945
|
-
"XOR",
|
|
9946
|
-
"Z.TEST"
|
|
9947
|
-
];
|
|
9948
|
-
const CONTENT_TYPES_FILE = "[Content_Types].xml";
|
|
9949
|
-
|
|
9950
9952
|
//#endregion
|
|
9951
9953
|
//#region src/helpers/figures/charts/chart_common.ts
|
|
9952
9954
|
const TREND_LINE_XAXIS_ID = "x1";
|
|
@@ -10212,10 +10214,10 @@ const chartShowValuesPlugin = {
|
|
|
10212
10214
|
drawLineOrBarOrRadarChartValues(chart, options, ctx);
|
|
10213
10215
|
break;
|
|
10214
10216
|
case "bar":
|
|
10215
|
-
options.horizontal ? drawHorizontalBarChartValues(chart, options, ctx) : drawLineOrBarOrRadarChartValues(chart, options, ctx);
|
|
10217
|
+
options.horizontal ? drawHorizontalBarChartValues(chart, options, ctx, { offsetFromAxisOrigin: true }) : drawLineOrBarOrRadarChartValues(chart, options, ctx);
|
|
10216
10218
|
break;
|
|
10217
10219
|
case "pyramid":
|
|
10218
|
-
drawHorizontalBarChartValues(chart, options, ctx);
|
|
10220
|
+
drawHorizontalBarChartValues(chart, options, ctx, { offsetFromAxisOrigin: true });
|
|
10219
10221
|
break;
|
|
10220
10222
|
case "calendar":
|
|
10221
10223
|
drawBarChartValues(chart, options, ctx);
|
|
@@ -10224,7 +10226,7 @@ const chartShowValuesPlugin = {
|
|
|
10224
10226
|
drawBubbleChartValues(chart, options, ctx);
|
|
10225
10227
|
break;
|
|
10226
10228
|
case "funnel":
|
|
10227
|
-
drawHorizontalBarChartValues(chart, options, ctx);
|
|
10229
|
+
drawHorizontalBarChartValues(chart, options, ctx, { offsetFromAxisOrigin: false });
|
|
10228
10230
|
break;
|
|
10229
10231
|
}
|
|
10230
10232
|
ctx.restore();
|
|
@@ -10248,7 +10250,7 @@ function drawLineOrBarOrRadarChartValues(chart, options, ctx) {
|
|
|
10248
10250
|
const point = dataset.data[i];
|
|
10249
10251
|
const xPosition = point.x;
|
|
10250
10252
|
let yPosition = 0;
|
|
10251
|
-
if (
|
|
10253
|
+
if (dataset.type === "line" || dataset.type === "radar") yPosition = value < 0 ? point.y + 10 : point.y - 10;
|
|
10252
10254
|
else if (chart.config.type === "bubble") yPosition = point.y;
|
|
10253
10255
|
else {
|
|
10254
10256
|
const yZeroLine = yAxisScale.getPixelForValue(0);
|
|
@@ -10299,23 +10301,33 @@ function drawBubbleChartValues(chart, options, ctx) {
|
|
|
10299
10301
|
const yMax = chart.chartArea.bottom;
|
|
10300
10302
|
const yMin = chart.chartArea.top;
|
|
10301
10303
|
const textsPositions = {};
|
|
10304
|
+
const canDrawTextInsideBubble = (chartElement, textSize) => {
|
|
10305
|
+
const radius = chartElement.options.radius ?? globalThis.Chart?.defaults.elements.point.radius ?? 3;
|
|
10306
|
+
return textSize.height < radius * 2;
|
|
10307
|
+
};
|
|
10302
10308
|
for (const dataset of chart._metasets) for (let i = 0; i < dataset._parsed.length; i++) {
|
|
10303
10309
|
const value = dataset._parsed[i].y;
|
|
10304
10310
|
if (isNaN(value)) continue;
|
|
10311
|
+
const valueToDisplay = options.callback(Number(value), dataset, i);
|
|
10305
10312
|
const point = dataset.data[i];
|
|
10306
10313
|
const xPosition = point.x;
|
|
10307
10314
|
let yPosition = Math.max(Math.min(point.y, yMax), yMin);
|
|
10315
|
+
const textSize = getTextDimensions(valueToDisplay, ctx);
|
|
10316
|
+
if (!canDrawTextInsideBubble(point, textSize)) yPosition = value < 0 ? point.y + 10 : point.y - 10;
|
|
10308
10317
|
if (!textsPositions[xPosition]) textsPositions[xPosition] = [];
|
|
10309
10318
|
for (const otherPosition of textsPositions[xPosition] || []) if (Math.abs(otherPosition - yPosition) < MINIMAL_VERTICAL_DISTANCE) yPosition = otherPosition + MINIMAL_VERTICAL_DISTANCE * (value < 0 ? 1 : -1);
|
|
10310
10319
|
textsPositions[xPosition].push(yPosition);
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10320
|
+
if (canDrawTextInsideBubble(point, textSize)) {
|
|
10321
|
+
ctx.strokeStyle = point.options.backgroundColor;
|
|
10322
|
+
ctx.fillStyle = options.background(Number(value), dataset, i) || "#ffffff";
|
|
10323
|
+
} else {
|
|
10324
|
+
ctx.strokeStyle = options.background(Number(value), dataset, i) || "#ffffff";
|
|
10325
|
+
ctx.fillStyle = point.options.backgroundColor;
|
|
10326
|
+
}
|
|
10327
|
+
drawTextWithBackground(valueToDisplay, xPosition, yPosition, ctx);
|
|
10316
10328
|
}
|
|
10317
10329
|
}
|
|
10318
|
-
function drawHorizontalBarChartValues(chart, options, ctx) {
|
|
10330
|
+
function drawHorizontalBarChartValues(chart, options, ctx, args) {
|
|
10319
10331
|
const textsPositions = {};
|
|
10320
10332
|
for (const dataset of chart._metasets) {
|
|
10321
10333
|
if (isTrendLineAxis(dataset.xAxisID) || isLineOverlayOnBarChart(options, dataset)) continue;
|
|
@@ -10330,7 +10342,7 @@ function drawHorizontalBarChartValues(chart, options, ctx) {
|
|
|
10330
10342
|
const distanceFromAxisOrigin = Math.abs(point.x - xZeroLine);
|
|
10331
10343
|
const PADDING = 3;
|
|
10332
10344
|
let xPosition;
|
|
10333
|
-
if (distanceFromAxisOrigin < textWidth) xPosition = value < 0 ? xZeroLine - textWidth / 2 - PADDING : xZeroLine + textWidth / 2 + PADDING;
|
|
10345
|
+
if (args.offsetFromAxisOrigin && distanceFromAxisOrigin < textWidth) xPosition = value < 0 ? xZeroLine - textWidth / 2 - PADDING : xZeroLine + textWidth / 2 + PADDING;
|
|
10334
10346
|
else xPosition = value < 0 ? point.x + point.width / 2 : point.x - point.width / 2;
|
|
10335
10347
|
if (!textsPositions[yPosition]) textsPositions[yPosition] = [];
|
|
10336
10348
|
for (const otherPosition of textsPositions[yPosition]) if (Math.abs(otherPosition - xPosition) < textWidth) xPosition = value < 0 ? otherPosition - textWidth - PADDING : otherPosition + textWidth + PADDING;
|
|
@@ -10365,6 +10377,9 @@ function drawPieChartValues(chart, options, ctx) {
|
|
|
10365
10377
|
drawTextWithBackground(displayValue, x, y, ctx);
|
|
10366
10378
|
}
|
|
10367
10379
|
}
|
|
10380
|
+
function getTextDimensions(text, ctx) {
|
|
10381
|
+
return computeCachedTextDimension(ctx, text, computeTextFont({ fontSize: globalThis.Chart?.defaults.font.size ?? 12 }, "px"));
|
|
10382
|
+
}
|
|
10368
10383
|
|
|
10369
10384
|
//#endregion
|
|
10370
10385
|
//#region src/types/chart/tree_map_chart.ts
|
|
@@ -15838,7 +15853,7 @@ const RemoveDuplicateTerms = { Errors: {
|
|
|
15838
15853
|
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
15839
15854
|
["EmptySelectedRange"]: _t("Please select a range of cells containing values."),
|
|
15840
15855
|
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
15841
|
-
["WillRemoveExistingMerge"]: _t("
|
|
15856
|
+
["WillRemoveExistingMerge"]: _t("Cannot perform this action on merged cells. Unmerge the cells and try again.")
|
|
15842
15857
|
} };
|
|
15843
15858
|
const DVTerms = {
|
|
15844
15859
|
DateIs: {
|
|
@@ -30170,433 +30185,6 @@ var ChartRangeDataSourceComponent = class extends Component {
|
|
|
30170
30185
|
}
|
|
30171
30186
|
};
|
|
30172
30187
|
|
|
30173
|
-
//#endregion
|
|
30174
|
-
//#region src/helpers/figures/chart.ts
|
|
30175
|
-
var SpreadsheetChart = class SpreadsheetChart {
|
|
30176
|
-
getters;
|
|
30177
|
-
sheetId;
|
|
30178
|
-
definition;
|
|
30179
|
-
chartTypeBuilder;
|
|
30180
|
-
dataSourceBuilder;
|
|
30181
|
-
dataSource;
|
|
30182
|
-
constructor(getters, sheetId, definition, chartTypeBuilder, dataSourceBuilder) {
|
|
30183
|
-
this.getters = getters;
|
|
30184
|
-
this.sheetId = sheetId;
|
|
30185
|
-
this.definition = definition;
|
|
30186
|
-
this.chartTypeBuilder = chartTypeBuilder;
|
|
30187
|
-
this.dataSourceBuilder = dataSourceBuilder;
|
|
30188
|
-
this.dataSource = definition.dataSource;
|
|
30189
|
-
}
|
|
30190
|
-
static fromStrDefinition(getters, sheetId, definition) {
|
|
30191
|
-
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
30192
|
-
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
30193
|
-
const dataSource = dataSourceBuilder.fromExternalDefinition(definition.dataSource ?? { type: "none" }, sheetId, getters);
|
|
30194
|
-
const rangeDefinition = {
|
|
30195
|
-
...chartTypeBuilder.fromStrDefinition(definition, sheetId, getters),
|
|
30196
|
-
dataSource
|
|
30197
|
-
};
|
|
30198
|
-
return new SpreadsheetChart(getters, sheetId, SpreadsheetChart.deleteInvalidKeys(rangeDefinition), chartTypeBuilder, dataSourceBuilder);
|
|
30199
|
-
}
|
|
30200
|
-
static fromDefinition(getters, sheetId, definition) {
|
|
30201
|
-
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
30202
|
-
return new SpreadsheetChart(getters, sheetId, definition, chartTypeRegistry.get(definition.type), dataSourceBuilder);
|
|
30203
|
-
}
|
|
30204
|
-
static validate(validator, definition) {
|
|
30205
|
-
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
30206
|
-
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
30207
|
-
return validator.batchValidations(() => chartTypeBuilder.validateDefinition(validator, definition), () => dataSourceBuilder.validate(definition.dataSource ?? { type: "none" }, validator))(void 0);
|
|
30208
|
-
}
|
|
30209
|
-
static transformDefinition(chartSheetId, definition, rangeAdapters) {
|
|
30210
|
-
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
30211
|
-
if (!definition.dataSource) return chartTypeBuilder.transformDefinition(definition, chartSheetId, rangeAdapters);
|
|
30212
|
-
const newDataSource = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none").transform(definition.dataSource, chartSheetId, rangeAdapters);
|
|
30213
|
-
return {
|
|
30214
|
-
...chartTypeBuilder.transformDefinition(definition, chartSheetId, rangeAdapters),
|
|
30215
|
-
dataSource: newDataSource
|
|
30216
|
-
};
|
|
30217
|
-
}
|
|
30218
|
-
getRangeDefinition() {
|
|
30219
|
-
return {
|
|
30220
|
-
...this.definition,
|
|
30221
|
-
dataSource: this.dataSource
|
|
30222
|
-
};
|
|
30223
|
-
}
|
|
30224
|
-
getDefinition() {
|
|
30225
|
-
return {
|
|
30226
|
-
...this.chartTypeBuilder.toStrDefinition(this.definition, this.sheetId, this.getters),
|
|
30227
|
-
dataSource: this.dataSource && this.dataSourceBuilder.getDefinition(this.dataSource, this.sheetId, this.getters)
|
|
30228
|
-
};
|
|
30229
|
-
}
|
|
30230
|
-
updateRanges(rangeAdapters) {
|
|
30231
|
-
return {
|
|
30232
|
-
...this.chartTypeBuilder.updateRanges(this.definition, rangeAdapters, this.sheetId),
|
|
30233
|
-
dataSource: this.dataSource && this.dataSourceBuilder.adaptRanges(this.dataSource, rangeAdapters)
|
|
30234
|
-
};
|
|
30235
|
-
}
|
|
30236
|
-
duplicateInDuplicatedSheet(sheetIdFrom, sheetIdTo) {
|
|
30237
|
-
const newDataSource = this.dataSource && this.dataSourceBuilder.duplicateInDuplicatedSheet(this.dataSource, sheetIdFrom, sheetIdTo, this.getters);
|
|
30238
|
-
const definition = {
|
|
30239
|
-
...this.chartTypeBuilder.duplicateInDuplicatedSheet(this.definition, sheetIdFrom, sheetIdTo, this.getters),
|
|
30240
|
-
dataSource: newDataSource
|
|
30241
|
-
};
|
|
30242
|
-
return SpreadsheetChart.fromDefinition(this.getters, sheetIdTo, definition).getDefinition();
|
|
30243
|
-
}
|
|
30244
|
-
copyInSheetId(sheetIdTo) {
|
|
30245
|
-
return {
|
|
30246
|
-
...this.chartTypeBuilder.copyInSheetId(this.definition, this.sheetId, sheetIdTo, this.getters),
|
|
30247
|
-
dataSource: this.dataSource
|
|
30248
|
-
};
|
|
30249
|
-
}
|
|
30250
|
-
getContextCreation() {
|
|
30251
|
-
const definition = this.getDefinition();
|
|
30252
|
-
return {
|
|
30253
|
-
...this.dataSourceBuilder.getContextCreation(definition.dataSource ?? { type: "none" }),
|
|
30254
|
-
...this.chartTypeBuilder.getContextCreation(definition, this.dataSourceBuilder, definition.dataSource)
|
|
30255
|
-
};
|
|
30256
|
-
}
|
|
30257
|
-
getDefinitionForExcel(getters) {
|
|
30258
|
-
const definition = this.definition;
|
|
30259
|
-
const excelDataSets = this.dataSourceBuilder.toExcelDataSets(this.dataSource, "dataSetStyles" in definition ? definition.dataSetStyles : {}, getters);
|
|
30260
|
-
if (excelDataSets === void 0) return;
|
|
30261
|
-
return this.chartTypeBuilder.getDefinitionForExcel(getters, definition, excelDataSets);
|
|
30262
|
-
}
|
|
30263
|
-
getData(getters, chartId) {
|
|
30264
|
-
const dataSource = this.dataSource;
|
|
30265
|
-
return dataSource ? this.dataSourceBuilder.extractData(dataSource, chartId, getters) : {
|
|
30266
|
-
dataSetsValues: [],
|
|
30267
|
-
labelValues: []
|
|
30268
|
-
};
|
|
30269
|
-
}
|
|
30270
|
-
getRuntime(getters, chartId) {
|
|
30271
|
-
const dataSource = this.dataSource;
|
|
30272
|
-
const dataExtractors = dataSource ? {
|
|
30273
|
-
extractData: () => this.dataSourceBuilder.extractData(dataSource, chartId, getters),
|
|
30274
|
-
extractHierarchicalData: () => this.dataSourceBuilder.extractHierarchicalData(dataSource, chartId, getters)
|
|
30275
|
-
} : {
|
|
30276
|
-
extractData: () => ({
|
|
30277
|
-
dataSetsValues: [],
|
|
30278
|
-
labelValues: []
|
|
30279
|
-
}),
|
|
30280
|
-
extractHierarchicalData: () => ({
|
|
30281
|
-
dataSetsValues: [],
|
|
30282
|
-
labelValues: []
|
|
30283
|
-
})
|
|
30284
|
-
};
|
|
30285
|
-
return this.chartTypeBuilder.getRuntime(getters, this.definition, dataExtractors, this.sheetId, {
|
|
30286
|
-
onClick: (event, items, chartJsChart) => {
|
|
30287
|
-
return this.dataSourceBuilder.onDataSetClick?.(this.definition.type, chartId, event, items, chartJsChart, getters);
|
|
30288
|
-
},
|
|
30289
|
-
onHover: (event, items, chartJsChart) => this.dataSourceBuilder.onDataSetHover?.(this.definition.type, chartId, event, items, chartJsChart)
|
|
30290
|
-
});
|
|
30291
|
-
}
|
|
30292
|
-
static deleteInvalidKeys(definition) {
|
|
30293
|
-
definition = { ...definition };
|
|
30294
|
-
const keys = new Set(chartTypeRegistry.get(definition.type).allowedDefinitionKeys);
|
|
30295
|
-
for (const key of Object.keys(definition)) if (!keys.has(key)) delete definition[key];
|
|
30296
|
-
return definition;
|
|
30297
|
-
}
|
|
30298
|
-
};
|
|
30299
|
-
|
|
30300
|
-
//#endregion
|
|
30301
|
-
//#region src/helpers/figures/charts/chart_data_sources.ts
|
|
30302
|
-
const EMPTY = Object.freeze({ value: null });
|
|
30303
|
-
const ONE = Object.freeze({ value: 1 });
|
|
30304
|
-
const ChartRangeDataSourceHandler = {
|
|
30305
|
-
supportedChartTypes: CHART_TYPES,
|
|
30306
|
-
fromExternalDefinition(dataSource, defaultSheetId, getters) {
|
|
30307
|
-
const dataSets = createDataSets(getters, defaultSheetId, dataSource);
|
|
30308
|
-
const labelRange = createValidRange(getters, defaultSheetId, dataSource.labelRange);
|
|
30309
|
-
return {
|
|
30310
|
-
...dataSource,
|
|
30311
|
-
dataSets,
|
|
30312
|
-
labelRange
|
|
30313
|
-
};
|
|
30314
|
-
},
|
|
30315
|
-
fromContextCreation(context) {
|
|
30316
|
-
return {
|
|
30317
|
-
type: "range",
|
|
30318
|
-
dataSets: [],
|
|
30319
|
-
dataSetsHaveTitle: false,
|
|
30320
|
-
labelRange: context.auxiliaryRange,
|
|
30321
|
-
...context.dataSource
|
|
30322
|
-
};
|
|
30323
|
-
},
|
|
30324
|
-
fromHierarchicalContextCreation(context) {
|
|
30325
|
-
if (context.dataSource?.type !== "range" || context.hierarchicalDataSource !== void 0 && context.hierarchicalDataSource.type !== "range") return {
|
|
30326
|
-
type: "range",
|
|
30327
|
-
dataSets: [],
|
|
30328
|
-
dataSetsHaveTitle: false
|
|
30329
|
-
};
|
|
30330
|
-
let dataSource = {
|
|
30331
|
-
type: "range",
|
|
30332
|
-
dataSets: [],
|
|
30333
|
-
dataSetsHaveTitle: context.dataSource?.dataSetsHaveTitle ?? false,
|
|
30334
|
-
labelRange: context.dataSource?.dataSets?.[0]?.dataRange
|
|
30335
|
-
};
|
|
30336
|
-
if (context.hierarchicalDataSource?.dataSets.length) dataSource = context.hierarchicalDataSource;
|
|
30337
|
-
else if (context.auxiliaryRange) dataSource = {
|
|
30338
|
-
...dataSource,
|
|
30339
|
-
dataSets: [{
|
|
30340
|
-
dataRange: context.auxiliaryRange,
|
|
30341
|
-
dataSetId: "0"
|
|
30342
|
-
}]
|
|
30343
|
-
};
|
|
30344
|
-
return dataSource;
|
|
30345
|
-
},
|
|
30346
|
-
validate: (dataSource, validator) => validator.checkValidations(dataSource, checkDataset, checkLabelRange),
|
|
30347
|
-
transform(dataSource, defaultSheetId, { adaptRangeString }) {
|
|
30348
|
-
let labelRange;
|
|
30349
|
-
if (dataSource.labelRange) {
|
|
30350
|
-
const { changeType, range: adaptedRange } = adaptRangeString(defaultSheetId, dataSource.labelRange);
|
|
30351
|
-
if (changeType !== "REMOVE") labelRange = adaptedRange;
|
|
30352
|
-
}
|
|
30353
|
-
const dataSets = [];
|
|
30354
|
-
for (const dataSet of dataSource.dataSets) {
|
|
30355
|
-
const newDataSet = { ...dataSet };
|
|
30356
|
-
const { changeType, range: adaptedRange } = adaptRangeString(defaultSheetId, dataSet.dataRange);
|
|
30357
|
-
if (changeType !== "REMOVE") {
|
|
30358
|
-
newDataSet.dataRange = adaptedRange;
|
|
30359
|
-
dataSets.push(newDataSet);
|
|
30360
|
-
}
|
|
30361
|
-
}
|
|
30362
|
-
return {
|
|
30363
|
-
...dataSource,
|
|
30364
|
-
dataSets,
|
|
30365
|
-
labelRange
|
|
30366
|
-
};
|
|
30367
|
-
},
|
|
30368
|
-
extractData: (dataSource, chartId, getters) => getChartData(getters, dataSource),
|
|
30369
|
-
extractHierarchicalData(dataSource, chartId, getters) {
|
|
30370
|
-
const dataSets = dataSource.dataSets;
|
|
30371
|
-
const labelRange = dataSource.labelRange;
|
|
30372
|
-
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
30373
|
-
const dataSetsValues = getHierarchicalDatasetValues(getters, dataSets);
|
|
30374
|
-
const data = {
|
|
30375
|
-
labelValues,
|
|
30376
|
-
dataSetsValues
|
|
30377
|
-
};
|
|
30378
|
-
if (shouldRemoveFirstLabel(labelValues.length, dataSetsValues[0]?.data.length + (dataSetsValues[0]?.label !== void 0 ? 1 : 0), dataSource.dataSetsHaveTitle || false)) labelValues.shift();
|
|
30379
|
-
return data;
|
|
30380
|
-
},
|
|
30381
|
-
adaptRanges(dataSource, { applyChange }) {
|
|
30382
|
-
const dataSetsWithUndefined = dataSource.dataSets.map((ds) => {
|
|
30383
|
-
const { range: adaptedRangeStr, changeType } = applyChange(ds.dataRange);
|
|
30384
|
-
if (changeType === "REMOVE") return;
|
|
30385
|
-
let labelCell = void 0;
|
|
30386
|
-
if (ds.labelCell) {
|
|
30387
|
-
const { range: adaptedLabelCellRange, changeType: labelCellChangeType } = applyChange(ds.labelCell);
|
|
30388
|
-
if (labelCellChangeType !== "REMOVE") labelCell = adaptedLabelCellRange;
|
|
30389
|
-
}
|
|
30390
|
-
return {
|
|
30391
|
-
...ds,
|
|
30392
|
-
dataRange: adaptedRangeStr,
|
|
30393
|
-
labelCell
|
|
30394
|
-
};
|
|
30395
|
-
}).filter(isDefined);
|
|
30396
|
-
let labelRange = dataSource.labelRange;
|
|
30397
|
-
if (labelRange) {
|
|
30398
|
-
const { range: adaptedLabelRange, changeType } = applyChange(labelRange);
|
|
30399
|
-
if (changeType === "REMOVE") labelRange = void 0;
|
|
30400
|
-
else labelRange = adaptedLabelRange;
|
|
30401
|
-
}
|
|
30402
|
-
const dataSets = dataSetsWithUndefined;
|
|
30403
|
-
return {
|
|
30404
|
-
...dataSource,
|
|
30405
|
-
dataSets,
|
|
30406
|
-
labelRange: labelRange?.invalidSheetName || labelRange?.invalidXc ? void 0 : labelRange
|
|
30407
|
-
};
|
|
30408
|
-
},
|
|
30409
|
-
getDefinition(dataSource, defaultSheetId, getters) {
|
|
30410
|
-
return {
|
|
30411
|
-
labelRange: dataSource.labelRange ? getters.getRangeString(dataSource.labelRange, defaultSheetId) : void 0,
|
|
30412
|
-
type: "range",
|
|
30413
|
-
dataSets: dataSource.dataSets.map((dataSet) => ({
|
|
30414
|
-
dataSetId: dataSet.dataSetId,
|
|
30415
|
-
dataRange: getters.getRangeString(dataSet.dataRange, defaultSheetId)
|
|
30416
|
-
})),
|
|
30417
|
-
dataSetsHaveTitle: dataSource.dataSetsHaveTitle
|
|
30418
|
-
};
|
|
30419
|
-
},
|
|
30420
|
-
/**
|
|
30421
|
-
* Duplicate the dataSets. All ranges on sheetIdFrom are adapted to target
|
|
30422
|
-
* sheetIdTo.
|
|
30423
|
-
*/
|
|
30424
|
-
duplicateInDuplicatedSheet(dataSource, sheetIdFrom, sheetIdTo, getters) {
|
|
30425
|
-
return {
|
|
30426
|
-
...dataSource,
|
|
30427
|
-
labelRange: duplicateLabelRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, dataSource.labelRange),
|
|
30428
|
-
dataSets: dataSource.dataSets.map((ds) => ({
|
|
30429
|
-
...ds,
|
|
30430
|
-
dataRange: duplicateRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, ds.dataRange)
|
|
30431
|
-
}))
|
|
30432
|
-
};
|
|
30433
|
-
},
|
|
30434
|
-
getContextCreation: (dataSource) => ({
|
|
30435
|
-
auxiliaryRange: dataSource.labelRange,
|
|
30436
|
-
dataSource
|
|
30437
|
-
}),
|
|
30438
|
-
getHierarchicalContextCreation(dataSource) {
|
|
30439
|
-
const leafRange = dataSource.dataSets.at(-1)?.dataRange;
|
|
30440
|
-
const dataSetsHaveTitle = dataSource.dataSetsHaveTitle;
|
|
30441
|
-
return {
|
|
30442
|
-
auxiliaryRange: leafRange,
|
|
30443
|
-
hierarchicalDataSource: dataSource,
|
|
30444
|
-
dataSource: dataSource.labelRange ? {
|
|
30445
|
-
type: "range",
|
|
30446
|
-
dataSets: [{
|
|
30447
|
-
dataRange: dataSource.labelRange,
|
|
30448
|
-
dataSetId: "0"
|
|
30449
|
-
}],
|
|
30450
|
-
dataSetsHaveTitle
|
|
30451
|
-
} : {
|
|
30452
|
-
type: "range",
|
|
30453
|
-
dataSets: [],
|
|
30454
|
-
dataSetsHaveTitle
|
|
30455
|
-
}
|
|
30456
|
-
};
|
|
30457
|
-
},
|
|
30458
|
-
toExcelDataSets(dataSource, dataSetStyles, getters) {
|
|
30459
|
-
const dataSets = dataSource.dataSets;
|
|
30460
|
-
const labelRange = dataSource.labelRange;
|
|
30461
|
-
const excelDataSets = dataSets.map((ds) => toExcelDataset(getters, dataSetStyles, ds)).filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
|
|
30462
|
-
const datasetLength = dataSets[0] ? getZoneArea(dataSets[0].dataRange.zone) : void 0;
|
|
30463
|
-
return {
|
|
30464
|
-
dataSets: excelDataSets,
|
|
30465
|
-
labelRange: toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel(labelRange ? getZoneArea(labelRange.zone) : 0, datasetLength, dataSource.dataSetsHaveTitle))
|
|
30466
|
-
};
|
|
30467
|
-
}
|
|
30468
|
-
};
|
|
30469
|
-
function getChartData(getters, dataSource) {
|
|
30470
|
-
const dataSets = dataSource.dataSets;
|
|
30471
|
-
const labelRange = dataSource.labelRange;
|
|
30472
|
-
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
30473
|
-
const dataSetsValues = getChartDatasetValues(getters, dataSets);
|
|
30474
|
-
const data = {
|
|
30475
|
-
labelValues,
|
|
30476
|
-
dataSetsValues
|
|
30477
|
-
};
|
|
30478
|
-
const numberOfDataPoints = dataSetsValues.length ? dataSetsValues[0]?.data.length + (dataSetsValues[0]?.label !== void 0 ? 1 : 0) : 0;
|
|
30479
|
-
if (shouldRemoveFirstLabel(labelValues.length, numberOfDataPoints, dataSource.dataSetsHaveTitle || false)) labelValues.shift();
|
|
30480
|
-
return data;
|
|
30481
|
-
}
|
|
30482
|
-
function getChartDatasetValues(getters, dataSets) {
|
|
30483
|
-
const datasetValues = [];
|
|
30484
|
-
for (const [dsIndex, ds] of Object.entries(dataSets)) {
|
|
30485
|
-
let label = `${ChartTerms.Series} ${parseInt(dsIndex) + 1}`;
|
|
30486
|
-
let hidden = getters.isColHidden(ds.dataRange.sheetId, ds.dataRange.zone.left);
|
|
30487
|
-
if (ds.labelCell) {
|
|
30488
|
-
const { sheetId, zone } = ds.labelCell;
|
|
30489
|
-
const cell = getters.getEvaluatedCell({
|
|
30490
|
-
sheetId,
|
|
30491
|
-
col: zone.left,
|
|
30492
|
-
row: zone.top
|
|
30493
|
-
});
|
|
30494
|
-
if (cell) label = cell.formattedValue;
|
|
30495
|
-
}
|
|
30496
|
-
let data = ds.dataRange ? getData(getters, ds) : [];
|
|
30497
|
-
if (data.every((cell) => !cell.value || isTextResult(cell)) && data.filter(isTextResult).length > 1) data = data.map((cell) => cell.value && !isErrorResult(cell) ? ONE : EMPTY);
|
|
30498
|
-
else if (data.every((cell) => !isNumberResult(cell))) hidden = true;
|
|
30499
|
-
datasetValues.push({
|
|
30500
|
-
data,
|
|
30501
|
-
label,
|
|
30502
|
-
hidden,
|
|
30503
|
-
dataSetId: ds.dataSetId
|
|
30504
|
-
});
|
|
30505
|
-
}
|
|
30506
|
-
return datasetValues;
|
|
30507
|
-
}
|
|
30508
|
-
function getChartLabelValues(getters, dataSets, labelRange) {
|
|
30509
|
-
if (labelRange) {
|
|
30510
|
-
const { left } = labelRange.zone;
|
|
30511
|
-
if (!labelRange.invalidXc && !labelRange.invalidSheetName && !getters.isColHidden(labelRange.sheetId, left)) return getters.getVisibleRangeValues(labelRange);
|
|
30512
|
-
}
|
|
30513
|
-
if (dataSets[0]) {
|
|
30514
|
-
const dataLength = getData(getters, dataSets[0]).length;
|
|
30515
|
-
return Array.from({ length: dataLength }, () => ({ value: "" }));
|
|
30516
|
-
}
|
|
30517
|
-
return [];
|
|
30518
|
-
}
|
|
30519
|
-
/**
|
|
30520
|
-
* Get the values for a hierarchical dataset. The values can be defined in a tree-like structure
|
|
30521
|
-
* in the sheet, and this function will fill up the blanks.
|
|
30522
|
-
*
|
|
30523
|
-
* @example the following dataset:
|
|
30524
|
-
*
|
|
30525
|
-
* 2024 Q1 W1 100
|
|
30526
|
-
* W2 200
|
|
30527
|
-
*
|
|
30528
|
-
* will have the same value as the dataset:
|
|
30529
|
-
* 2024 Q1 W1 100
|
|
30530
|
-
* 2024 Q1 W2 200
|
|
30531
|
-
*/
|
|
30532
|
-
function getHierarchicalDatasetValues(getters, dataSets) {
|
|
30533
|
-
dataSets = dataSets.filter((ds) => !getters.isColHidden(ds.dataRange.sheetId, ds.dataRange.zone.left));
|
|
30534
|
-
const datasetValues = dataSets.map((ds) => ({
|
|
30535
|
-
data: [],
|
|
30536
|
-
label: "",
|
|
30537
|
-
dataSetId: ds.dataSetId
|
|
30538
|
-
}));
|
|
30539
|
-
const locale = getters.getLocale();
|
|
30540
|
-
const dataSetsData = dataSets.map((ds) => getData(getters, ds)).map((values) => values.map(({ value, format }) => value === null ? EMPTY : { value: formatValue(value, {
|
|
30541
|
-
format,
|
|
30542
|
-
locale
|
|
30543
|
-
}) }));
|
|
30544
|
-
if (!dataSetsData.length) return datasetValues;
|
|
30545
|
-
const minLength = Math.min(...dataSetsData.map((ds) => ds.length));
|
|
30546
|
-
let currentValues = [];
|
|
30547
|
-
const leafDatasetIndex = dataSets.length - 1;
|
|
30548
|
-
for (let i = 0; i < minLength; i++) for (let dsIndex = 0; dsIndex < dataSetsData.length; dsIndex++) {
|
|
30549
|
-
let cell = dataSetsData[dsIndex][i];
|
|
30550
|
-
if ((cell === void 0 || cell.value === null) && dsIndex !== leafDatasetIndex) cell = currentValues[dsIndex];
|
|
30551
|
-
if (cell?.value !== currentValues[dsIndex]?.value) {
|
|
30552
|
-
currentValues = currentValues.slice(0, dsIndex);
|
|
30553
|
-
currentValues[dsIndex] = cell;
|
|
30554
|
-
}
|
|
30555
|
-
datasetValues[dsIndex].data.push(cell ?? EMPTY);
|
|
30556
|
-
}
|
|
30557
|
-
return datasetValues.filter((ds) => ds.data.some((d) => d.value !== null));
|
|
30558
|
-
}
|
|
30559
|
-
/**
|
|
30560
|
-
* Get the data from a dataSet
|
|
30561
|
-
*/
|
|
30562
|
-
function getData(getters, ds) {
|
|
30563
|
-
if (ds.dataRange) {
|
|
30564
|
-
const labelCellZone = ds.labelCell ? [ds.labelCell.zone] : [];
|
|
30565
|
-
const dataZone = recomputeZones([ds.dataRange.zone], labelCellZone)[0];
|
|
30566
|
-
if (dataZone === void 0) return [];
|
|
30567
|
-
const dataRange = getters.getRangeFromZone(ds.dataRange.sheetId, dataZone);
|
|
30568
|
-
return getters.getVisibleRangeValues(dataRange).map((cell) => cell.value === "" ? EMPTY : cell);
|
|
30569
|
-
}
|
|
30570
|
-
return [];
|
|
30571
|
-
}
|
|
30572
|
-
const ChartNeverDataSourceHandler = {
|
|
30573
|
-
supportedChartTypes: [],
|
|
30574
|
-
fromExternalDefinition: () => ({ type: "none" }),
|
|
30575
|
-
fromContextCreation: () => ({ type: "none" }),
|
|
30576
|
-
fromHierarchicalContextCreation: () => ({ type: "none" }),
|
|
30577
|
-
validate: () => "Success",
|
|
30578
|
-
transform: () => ({ type: "none" }),
|
|
30579
|
-
extractData: () => ({
|
|
30580
|
-
dataSetsValues: [],
|
|
30581
|
-
labelValues: []
|
|
30582
|
-
}),
|
|
30583
|
-
extractHierarchicalData: () => ({
|
|
30584
|
-
dataSetsValues: [],
|
|
30585
|
-
labelValues: []
|
|
30586
|
-
}),
|
|
30587
|
-
adaptRanges: (dataSource) => dataSource,
|
|
30588
|
-
getDefinition: (dataSource) => dataSource,
|
|
30589
|
-
duplicateInDuplicatedSheet: (dataSource) => dataSource,
|
|
30590
|
-
getContextCreation: () => ({}),
|
|
30591
|
-
getHierarchicalContextCreation: () => ({}),
|
|
30592
|
-
toExcelDataSets: () => ({
|
|
30593
|
-
dataSets: [],
|
|
30594
|
-
labelRange: void 0
|
|
30595
|
-
})
|
|
30596
|
-
};
|
|
30597
|
-
chartDataSourceRegistry.add("range", ChartRangeDataSourceHandler);
|
|
30598
|
-
chartDataSourceRegistry.add("none", ChartNeverDataSourceHandler);
|
|
30599
|
-
|
|
30600
30188
|
//#endregion
|
|
30601
30189
|
//#region src/types/chart/calendar_chart.ts
|
|
30602
30190
|
const CALENDAR_CHART_GRANULARITIES = [
|
|
@@ -30623,41 +30211,6 @@ var CalendarChartConfigPanel = class extends GenericChartConfigPanel {
|
|
|
30623
30211
|
value,
|
|
30624
30212
|
label: ALL_PERIODS[value]
|
|
30625
30213
|
}));
|
|
30626
|
-
getGroupByOptions() {
|
|
30627
|
-
const sheetId = this.env.model.getters.getFigureSheetId(this.env.model.getters.getFigureIdFromChartId(this.props.chartId));
|
|
30628
|
-
const definition = SpreadsheetChart.fromStrDefinition(this.env.model.getters, sheetId, this.props.definition).getRangeDefinition();
|
|
30629
|
-
const labels = getBarChartData(definition, getChartData(this.env.model.getters, definition.dataSource), this.env.model.getters).labels.filter((l) => isDateTime(l, DEFAULT_LOCALE));
|
|
30630
|
-
if (labels.length === 0) return [];
|
|
30631
|
-
const dates = labels.map((label) => toJsDate(label, this.env.model.getters.getLocale()));
|
|
30632
|
-
const uniqueYears = /* @__PURE__ */ new Set();
|
|
30633
|
-
const uniqueMonths = /* @__PURE__ */ new Set();
|
|
30634
|
-
const uniqueDays = /* @__PURE__ */ new Set();
|
|
30635
|
-
const uniqueHours = /* @__PURE__ */ new Set();
|
|
30636
|
-
const uniqueMinutes = /* @__PURE__ */ new Set();
|
|
30637
|
-
const uniqueSeconds = /* @__PURE__ */ new Set();
|
|
30638
|
-
for (const date of dates) {
|
|
30639
|
-
uniqueYears.add(date.getFullYear());
|
|
30640
|
-
uniqueMonths.add(date.getMonth());
|
|
30641
|
-
uniqueDays.add(date.getDate());
|
|
30642
|
-
uniqueHours.add(date.getHours());
|
|
30643
|
-
uniqueMinutes.add(date.getMinutes());
|
|
30644
|
-
uniqueSeconds.add(date.getSeconds());
|
|
30645
|
-
}
|
|
30646
|
-
return this.groupByChoices.filter((groupBy) => {
|
|
30647
|
-
switch (groupBy.value) {
|
|
30648
|
-
case "year": return uniqueYears.size > 1;
|
|
30649
|
-
case "quarter_number":
|
|
30650
|
-
case "month_number": return uniqueMonths.size > 1;
|
|
30651
|
-
case "iso_week_number":
|
|
30652
|
-
case "day_of_month":
|
|
30653
|
-
case "day_of_week": return uniqueDays.size > 1;
|
|
30654
|
-
case "hour_number": return uniqueHours.size > 1;
|
|
30655
|
-
case "minute_number": return uniqueMinutes.size > 1;
|
|
30656
|
-
case "second_number": return uniqueSeconds.size > 1;
|
|
30657
|
-
default: return false;
|
|
30658
|
-
}
|
|
30659
|
-
});
|
|
30660
|
-
}
|
|
30661
30214
|
getGroupByType(currentAxis) {
|
|
30662
30215
|
return (currentAxis === "horizontal" ? this.props.definition.horizontalGroupBy : this.props.definition.verticalGroupBy) || "year";
|
|
30663
30216
|
}
|
|
@@ -31230,7 +30783,7 @@ var SpeechBubble = class extends Component {
|
|
|
31230
30783
|
spreadsheetRect = useSpreadsheetRect();
|
|
31231
30784
|
bubbleRef = (0, _odoo_owl.signal)(null);
|
|
31232
30785
|
setup() {
|
|
31233
|
-
(
|
|
30786
|
+
useLayoutEffect(() => {
|
|
31234
30787
|
const el = this.bubbleRef();
|
|
31235
30788
|
if (!el) return;
|
|
31236
30789
|
const anchorRect = this.props.anchorRect;
|
|
@@ -31291,9 +30844,10 @@ var Composer = class extends Component {
|
|
|
31291
30844
|
compositionActive = false;
|
|
31292
30845
|
spreadsheetRect = useSpreadsheetRect();
|
|
31293
30846
|
lastHoveredTokenIndex = void 0;
|
|
31294
|
-
debouncedHover = debounce((tokenIndex, hoveredRect) => {
|
|
30847
|
+
debouncedHover = debounce((tokenIndex, composerContent, hoveredRect) => {
|
|
31295
30848
|
const selection = this.contentHelper.getCurrentSelection();
|
|
31296
|
-
|
|
30849
|
+
const currentContent = this.props.composerStore.currentContent;
|
|
30850
|
+
if (selection.start !== selection.end || currentContent !== composerContent) return;
|
|
31297
30851
|
const currentHoveredContext = this.props.composerStore.hoveredTokens;
|
|
31298
30852
|
this.props.composerStore.hoverToken(tokenIndex);
|
|
31299
30853
|
if (!deepEquals(currentHoveredContext, this.props.composerStore.hoveredTokens)) this.composerState.hoveredRect = hoveredRect;
|
|
@@ -31613,7 +31167,8 @@ var Composer = class extends Component {
|
|
|
31613
31167
|
onTokenHover(tokenIndex, hoveredRect) {
|
|
31614
31168
|
if (this.lastHoveredTokenIndex !== tokenIndex) {
|
|
31615
31169
|
this.lastHoveredTokenIndex = tokenIndex;
|
|
31616
|
-
this.
|
|
31170
|
+
const composerContent = this.props.composerStore.currentContent;
|
|
31171
|
+
this.debouncedHover(tokenIndex, composerContent, hoveredRect);
|
|
31617
31172
|
}
|
|
31618
31173
|
}
|
|
31619
31174
|
/**
|
|
@@ -32642,7 +32197,7 @@ var AbstractComposerStore = class extends SpreadsheetStore {
|
|
|
32642
32197
|
col: range.zone.left,
|
|
32643
32198
|
row: range.zone.top
|
|
32644
32199
|
});
|
|
32645
|
-
if (spreadZone) return this.getters.getRangeFromZone(sheetId, spreadZone);
|
|
32200
|
+
if (spreadZone) return this.getters.getRangeFromZone(range.sheetId, spreadZone);
|
|
32646
32201
|
return range;
|
|
32647
32202
|
}
|
|
32648
32203
|
updateAutoCompleteProvider() {
|
|
@@ -33855,6 +33410,133 @@ var ChartTypePicker = class extends Component {
|
|
|
33855
33410
|
}
|
|
33856
33411
|
};
|
|
33857
33412
|
|
|
33413
|
+
//#endregion
|
|
33414
|
+
//#region src/helpers/figures/chart.ts
|
|
33415
|
+
var SpreadsheetChart = class SpreadsheetChart {
|
|
33416
|
+
getters;
|
|
33417
|
+
sheetId;
|
|
33418
|
+
definition;
|
|
33419
|
+
chartTypeBuilder;
|
|
33420
|
+
dataSourceBuilder;
|
|
33421
|
+
dataSource;
|
|
33422
|
+
constructor(getters, sheetId, definition, chartTypeBuilder, dataSourceBuilder) {
|
|
33423
|
+
this.getters = getters;
|
|
33424
|
+
this.sheetId = sheetId;
|
|
33425
|
+
this.definition = definition;
|
|
33426
|
+
this.chartTypeBuilder = chartTypeBuilder;
|
|
33427
|
+
this.dataSourceBuilder = dataSourceBuilder;
|
|
33428
|
+
this.dataSource = definition.dataSource;
|
|
33429
|
+
}
|
|
33430
|
+
static fromStrDefinition(getters, sheetId, definition) {
|
|
33431
|
+
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
33432
|
+
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
33433
|
+
const dataSource = dataSourceBuilder.fromExternalDefinition(definition.dataSource ?? { type: "none" }, sheetId, getters);
|
|
33434
|
+
const rangeDefinition = {
|
|
33435
|
+
...chartTypeBuilder.fromStrDefinition(definition, sheetId, getters),
|
|
33436
|
+
dataSource
|
|
33437
|
+
};
|
|
33438
|
+
return new SpreadsheetChart(getters, sheetId, SpreadsheetChart.deleteInvalidKeys(rangeDefinition), chartTypeBuilder, dataSourceBuilder);
|
|
33439
|
+
}
|
|
33440
|
+
static fromDefinition(getters, sheetId, definition) {
|
|
33441
|
+
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
33442
|
+
return new SpreadsheetChart(getters, sheetId, definition, chartTypeRegistry.get(definition.type), dataSourceBuilder);
|
|
33443
|
+
}
|
|
33444
|
+
static validate(validator, definition) {
|
|
33445
|
+
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
33446
|
+
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
33447
|
+
return validator.batchValidations(() => chartTypeBuilder.validateDefinition(validator, definition), () => dataSourceBuilder.validate(definition.dataSource ?? { type: "none" }, validator))(void 0);
|
|
33448
|
+
}
|
|
33449
|
+
static transformDefinition(chartSheetId, definition, rangeAdapters) {
|
|
33450
|
+
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
33451
|
+
if (!definition.dataSource) return chartTypeBuilder.transformDefinition(definition, chartSheetId, rangeAdapters);
|
|
33452
|
+
const newDataSource = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none").transform(definition.dataSource, chartSheetId, rangeAdapters);
|
|
33453
|
+
return {
|
|
33454
|
+
...chartTypeBuilder.transformDefinition(definition, chartSheetId, rangeAdapters),
|
|
33455
|
+
dataSource: newDataSource
|
|
33456
|
+
};
|
|
33457
|
+
}
|
|
33458
|
+
getRangeDefinition() {
|
|
33459
|
+
return {
|
|
33460
|
+
...this.definition,
|
|
33461
|
+
dataSource: this.dataSource
|
|
33462
|
+
};
|
|
33463
|
+
}
|
|
33464
|
+
getDefinition() {
|
|
33465
|
+
return {
|
|
33466
|
+
...this.chartTypeBuilder.toStrDefinition(this.definition, this.sheetId, this.getters),
|
|
33467
|
+
dataSource: this.dataSource && this.dataSourceBuilder.getDefinition(this.dataSource, this.sheetId, this.getters)
|
|
33468
|
+
};
|
|
33469
|
+
}
|
|
33470
|
+
updateRanges(rangeAdapters) {
|
|
33471
|
+
return {
|
|
33472
|
+
...this.chartTypeBuilder.updateRanges(this.definition, rangeAdapters, this.sheetId),
|
|
33473
|
+
dataSource: this.dataSource && this.dataSourceBuilder.adaptRanges(this.dataSource, rangeAdapters)
|
|
33474
|
+
};
|
|
33475
|
+
}
|
|
33476
|
+
duplicateInDuplicatedSheet(sheetIdFrom, sheetIdTo) {
|
|
33477
|
+
const newDataSource = this.dataSource && this.dataSourceBuilder.duplicateInDuplicatedSheet(this.dataSource, sheetIdFrom, sheetIdTo, this.getters);
|
|
33478
|
+
const definition = {
|
|
33479
|
+
...this.chartTypeBuilder.duplicateInDuplicatedSheet(this.definition, sheetIdFrom, sheetIdTo, this.getters),
|
|
33480
|
+
dataSource: newDataSource
|
|
33481
|
+
};
|
|
33482
|
+
return SpreadsheetChart.fromDefinition(this.getters, sheetIdTo, definition).getDefinition();
|
|
33483
|
+
}
|
|
33484
|
+
copyInSheetId(sheetIdTo) {
|
|
33485
|
+
return {
|
|
33486
|
+
...this.chartTypeBuilder.copyInSheetId(this.definition, this.sheetId, sheetIdTo, this.getters),
|
|
33487
|
+
dataSource: this.dataSource
|
|
33488
|
+
};
|
|
33489
|
+
}
|
|
33490
|
+
getContextCreation() {
|
|
33491
|
+
const definition = this.getDefinition();
|
|
33492
|
+
return {
|
|
33493
|
+
...this.dataSourceBuilder.getContextCreation(definition.dataSource ?? { type: "none" }),
|
|
33494
|
+
...this.chartTypeBuilder.getContextCreation(definition, this.dataSourceBuilder, definition.dataSource)
|
|
33495
|
+
};
|
|
33496
|
+
}
|
|
33497
|
+
getDefinitionForExcel(getters) {
|
|
33498
|
+
const definition = this.definition;
|
|
33499
|
+
const excelDataSets = this.dataSourceBuilder.toExcelDataSets(this.dataSource, "dataSetStyles" in definition ? definition.dataSetStyles : {}, getters);
|
|
33500
|
+
if (excelDataSets === void 0) return;
|
|
33501
|
+
return this.chartTypeBuilder.getDefinitionForExcel(getters, definition, excelDataSets);
|
|
33502
|
+
}
|
|
33503
|
+
getData(getters, chartId) {
|
|
33504
|
+
const dataSource = this.dataSource;
|
|
33505
|
+
return dataSource ? this.dataSourceBuilder.extractData(dataSource, chartId, getters) : {
|
|
33506
|
+
dataSetsValues: [],
|
|
33507
|
+
labelValues: []
|
|
33508
|
+
};
|
|
33509
|
+
}
|
|
33510
|
+
getRuntime(getters, chartId) {
|
|
33511
|
+
const dataSource = this.dataSource;
|
|
33512
|
+
const dataExtractors = dataSource ? {
|
|
33513
|
+
extractData: () => this.dataSourceBuilder.extractData(dataSource, chartId, getters),
|
|
33514
|
+
extractHierarchicalData: () => this.dataSourceBuilder.extractHierarchicalData(dataSource, chartId, getters)
|
|
33515
|
+
} : {
|
|
33516
|
+
extractData: () => ({
|
|
33517
|
+
dataSetsValues: [],
|
|
33518
|
+
labelValues: []
|
|
33519
|
+
}),
|
|
33520
|
+
extractHierarchicalData: () => ({
|
|
33521
|
+
dataSetsValues: [],
|
|
33522
|
+
labelValues: []
|
|
33523
|
+
})
|
|
33524
|
+
};
|
|
33525
|
+
return this.chartTypeBuilder.getRuntime(getters, this.definition, dataExtractors, this.sheetId, {
|
|
33526
|
+
onClick: (event, items, chartJsChart) => {
|
|
33527
|
+
return this.dataSourceBuilder.onDataSetClick?.(this.definition.type, chartId, event, items, chartJsChart, getters);
|
|
33528
|
+
},
|
|
33529
|
+
onHover: (event, items, chartJsChart) => this.dataSourceBuilder.onDataSetHover?.(this.definition.type, chartId, event, items, chartJsChart)
|
|
33530
|
+
});
|
|
33531
|
+
}
|
|
33532
|
+
static deleteInvalidKeys(definition) {
|
|
33533
|
+
definition = { ...definition };
|
|
33534
|
+
const keys = new Set(chartTypeRegistry.get(definition.type).allowedDefinitionKeys);
|
|
33535
|
+
for (const key of Object.keys(definition)) if (!keys.has(key)) delete definition[key];
|
|
33536
|
+
return definition;
|
|
33537
|
+
}
|
|
33538
|
+
};
|
|
33539
|
+
|
|
33858
33540
|
//#endregion
|
|
33859
33541
|
//#region src/components/side_panel/chart/main_chart_panel/main_chart_panel_store.ts
|
|
33860
33542
|
var MainChartPanelStore = class extends SpreadsheetStore {
|
|
@@ -37076,7 +36758,7 @@ var FindAndReplacePanel = class extends Component {
|
|
|
37076
36758
|
}
|
|
37077
36759
|
get specificRangeMatchesCount() {
|
|
37078
36760
|
const range = this.searchOptions.specificRange;
|
|
37079
|
-
if (!range) return "";
|
|
36761
|
+
if (!range || range.invalidSheetName || range.invalidXc) return "";
|
|
37080
36762
|
const { specificRangeMatchesCount: count, specificRangeHiddenMatchesCount: hidden, searchOptions } = this.store;
|
|
37081
36763
|
const { sheetId, zone } = range;
|
|
37082
36764
|
let label = count === 1 ? _t("1 match in range %(range)s of '%(sheetName)s'", {
|
|
@@ -41269,7 +40951,13 @@ var PivotSpreadsheetSidePanel = class extends Component {
|
|
|
41269
40951
|
}
|
|
41270
40952
|
onSelectionChanged(ranges) {
|
|
41271
40953
|
this.state.rangeHasChanged = true;
|
|
41272
|
-
|
|
40954
|
+
if (ranges.length === 0) {
|
|
40955
|
+
this.state.range = void 0;
|
|
40956
|
+
return;
|
|
40957
|
+
}
|
|
40958
|
+
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
40959
|
+
const range = this.env.model.getters.getRangeFromSheetXC(sheetId, ranges[0]);
|
|
40960
|
+
this.state.range = this.env.model.getters.getRangeString(range, "forceSheetReference", { useBoundedReference: true });
|
|
41273
40961
|
}
|
|
41274
40962
|
onSelectionConfirmed() {
|
|
41275
40963
|
if (this.state.range) {
|
|
@@ -47458,6 +47146,11 @@ var GridOverlay = class extends Component {
|
|
|
47458
47146
|
});
|
|
47459
47147
|
return icon?.onClick ? icon : void 0;
|
|
47460
47148
|
}
|
|
47149
|
+
get isFooterVisible() {
|
|
47150
|
+
const { y } = this.env.model.getters.getMainViewportCoordinates();
|
|
47151
|
+
const { height } = this.env.model.getters.getSheetViewDimension();
|
|
47152
|
+
return !this.env.model.getters.isReadonly() && height - y > 46;
|
|
47153
|
+
}
|
|
47461
47154
|
};
|
|
47462
47155
|
|
|
47463
47156
|
//#endregion
|
|
@@ -51028,6 +50721,7 @@ var CarouselPlugin = class extends CorePlugin {
|
|
|
51028
50721
|
return "Success";
|
|
51029
50722
|
case "UPDATE_CAROUSEL":
|
|
51030
50723
|
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return "InvalidFigureId";
|
|
50724
|
+
for (const item of cmd.definition.items) if (item.type === "chart" && !this.getters.getChart(item.chartId)) return "ChartDoesNotExist";
|
|
51031
50725
|
return "Success";
|
|
51032
50726
|
}
|
|
51033
50727
|
return "Success";
|
|
@@ -56251,7 +55945,7 @@ var CompilationParametersBuilder = class {
|
|
|
56251
55945
|
if (rangeError) return [[rangeError]];
|
|
56252
55946
|
const sheetId = range.sheetId;
|
|
56253
55947
|
const zone = range.zone;
|
|
56254
|
-
const _zone =
|
|
55948
|
+
const _zone = this.getters.clipRangeToSheet(range)?.zone;
|
|
56255
55949
|
if (!_zone) return [[]];
|
|
56256
55950
|
const { top, left, bottom, right } = zone;
|
|
56257
55951
|
const cacheKey = `${sheetId}-${top}-${left}-${bottom}-${right}`;
|
|
@@ -56555,6 +56249,7 @@ var FormulaDependencyGraph = class {
|
|
|
56555
56249
|
}
|
|
56556
56250
|
getCellsDependingOn(ranges, visited = new RangeSet()) {
|
|
56557
56251
|
visited = visited.copy();
|
|
56252
|
+
let initialRangesToRemove = visited.copy();
|
|
56558
56253
|
const queue = Array.from(ranges).reverse();
|
|
56559
56254
|
while (queue.length > 0) {
|
|
56560
56255
|
const range = queue.pop();
|
|
@@ -56570,8 +56265,9 @@ var FormulaDependencyGraph = class {
|
|
|
56570
56265
|
for (const interval of overlappingIntervals) impactedRanges.add(interval.dependents);
|
|
56571
56266
|
}
|
|
56572
56267
|
queue.push(...impactedRanges.difference(visited));
|
|
56268
|
+
initialRangesToRemove = initialRangesToRemove.difference(impactedRanges);
|
|
56573
56269
|
}
|
|
56574
|
-
for (const range of
|
|
56270
|
+
for (const range of initialRangesToRemove) visited.delete(range);
|
|
56575
56271
|
return visited;
|
|
56576
56272
|
}
|
|
56577
56273
|
getOrCreateIntervalTree(sheetId, col) {
|
|
@@ -57423,10 +57119,10 @@ var Evaluator = class {
|
|
|
57423
57119
|
updateDependencies(position) {
|
|
57424
57120
|
this.formulaDependencies().removeAllDependencies(position);
|
|
57425
57121
|
const dependencies = this.getDirectDependencies(position);
|
|
57426
|
-
this.formulaDependencies().addDependencies(position, dependencies);
|
|
57122
|
+
this.formulaDependencies().addDependencies(position, this.getters.clipRangesToSheet(dependencies));
|
|
57427
57123
|
}
|
|
57428
57124
|
addDependencies(position, dependencies) {
|
|
57429
|
-
this.formulaDependencies().addDependencies(position, dependencies);
|
|
57125
|
+
this.formulaDependencies().addDependencies(position, this.getters.clipRangesToSheet(dependencies));
|
|
57430
57126
|
this.computeDependencies(dependencies);
|
|
57431
57127
|
}
|
|
57432
57128
|
computeDependencies(dependencies) {
|
|
@@ -57499,7 +57195,8 @@ var Evaluator = class {
|
|
|
57499
57195
|
const graph = new FormulaDependencyGraph();
|
|
57500
57196
|
for (const sheetId of this.getters.getSheetIds()) for (const cell of this.getters.getCells(sheetId)) if (cell.isFormula) {
|
|
57501
57197
|
const cellPosition = this.getters.getCellPosition(cell.id);
|
|
57502
|
-
|
|
57198
|
+
const dependencies = this.getters.clipRangesToSheet(cell.compiledFormula.rangeDependencies);
|
|
57199
|
+
graph.addDependencies(cellPosition, dependencies);
|
|
57503
57200
|
}
|
|
57504
57201
|
return graph;
|
|
57505
57202
|
});
|
|
@@ -63480,7 +63177,8 @@ var GeoFeaturePlugin = class extends UIPlugin {
|
|
|
63480
63177
|
"getGeoJsonFeatures",
|
|
63481
63178
|
"geoFeatureNameToId",
|
|
63482
63179
|
"getGeoChartAvailableRegions",
|
|
63483
|
-
"getAvailableChartRegions"
|
|
63180
|
+
"getAvailableChartRegions",
|
|
63181
|
+
"loadUsedGeoJsonFeatures"
|
|
63484
63182
|
];
|
|
63485
63183
|
geoJsonService;
|
|
63486
63184
|
geoJsonCache = {};
|
|
@@ -63563,6 +63261,23 @@ var GeoFeaturePlugin = class extends UIPlugin {
|
|
|
63563
63261
|
}
|
|
63564
63262
|
return this.geoJsonService.geoFeatureNameToId(region, featureName);
|
|
63565
63263
|
}
|
|
63264
|
+
loadUsedGeoJsonFeatures() {
|
|
63265
|
+
const regions = this.getters.getSheetIds().flatMap((sheetId) => this.getters.getChartIds(sheetId).map((chartId) => {
|
|
63266
|
+
const definition = this.getters.getChartDefinition(chartId);
|
|
63267
|
+
return definition.type === "geo" ? definition.region || this.getters.getGeoChartAvailableRegions()[0]?.id : void 0;
|
|
63268
|
+
})).filter(isDefined);
|
|
63269
|
+
const uniqueRegions = Array.from(new Set(regions));
|
|
63270
|
+
if (uniqueRegions.length && !this.geoJsonService) {
|
|
63271
|
+
console.error("No geoJsonService provided to the model");
|
|
63272
|
+
return Promise.resolve();
|
|
63273
|
+
}
|
|
63274
|
+
for (const region of uniqueRegions) this.getGeoJsonFeatures(region);
|
|
63275
|
+
const promises = uniqueRegions.map((region) => {
|
|
63276
|
+
const cachedGeoJson = this.geoJsonCache[region];
|
|
63277
|
+
return cachedGeoJson instanceof Promise ? cachedGeoJson : Promise.resolve();
|
|
63278
|
+
});
|
|
63279
|
+
return Promise.all(promises).then(() => {});
|
|
63280
|
+
}
|
|
63566
63281
|
convertToGeoJson(json) {
|
|
63567
63282
|
if (!json) return null;
|
|
63568
63283
|
if (json.type === "Topology") {
|
|
@@ -66647,7 +66362,7 @@ var InternalViewport = class {
|
|
|
66647
66362
|
let height = lastRowEnd - this.offsetCorrectionY;
|
|
66648
66363
|
if (this.canScrollVertically) {
|
|
66649
66364
|
height = Math.max(height, this.viewportHeight);
|
|
66650
|
-
if (lastRowEnd + 46 > height && !this.getters.isReadonly()) height += 46;
|
|
66365
|
+
if (lastRowEnd + 46 > height && !this.getters.isReadonly() && this.viewportHeight > 46) height += 46;
|
|
66651
66366
|
}
|
|
66652
66367
|
return {
|
|
66653
66368
|
width,
|
|
@@ -70431,7 +70146,7 @@ var FigureRendererStore = class extends DisposableStore {
|
|
|
70431
70146
|
if (!this.getters.isDashboard()) {
|
|
70432
70147
|
ctx.strokeStyle = GRAY_400;
|
|
70433
70148
|
ctx.lineWidth = 1;
|
|
70434
|
-
ctx.strokeRect(x, y, figure.width, figure.height);
|
|
70149
|
+
ctx.strokeRect(x + .5, y + .5, figure.width - 1, figure.height - 1);
|
|
70435
70150
|
}
|
|
70436
70151
|
}
|
|
70437
70152
|
}
|
|
@@ -70640,12 +70355,11 @@ var SpreadsheetPrintStore = class extends SpreadsheetStore {
|
|
|
70640
70355
|
const { width: printWidth, height: printHeight } = this.pageDimensionWithMargins;
|
|
70641
70356
|
const start = dimension === "COL" ? printZone.left : printZone.top;
|
|
70642
70357
|
const end = dimension === "COL" ? printZone.right : printZone.bottom;
|
|
70643
|
-
const getHeaderSize = dimension === "COL" ? this.getters.getColDimensions : this.getters.getRowDimensions;
|
|
70644
70358
|
const max = dimension === "COL" ? printWidth : printHeight;
|
|
70645
70359
|
const breaks = [];
|
|
70646
70360
|
let current = 0;
|
|
70647
70361
|
for (let i = start; i <= end; i++) {
|
|
70648
|
-
const headerSize =
|
|
70362
|
+
const headerSize = this.getters.isHeaderHidden(sheetId, dimension, i) ? 0 : this.getters.getHeaderSize(sheetId, dimension, i) * zoom;
|
|
70649
70363
|
current += headerSize;
|
|
70650
70364
|
if (current >= max) {
|
|
70651
70365
|
breaks.push(i);
|
|
@@ -72096,7 +71810,10 @@ var Spreadsheet = class extends Component {
|
|
|
72096
71810
|
sidePanel;
|
|
72097
71811
|
spreadsheetRef = (0, _odoo_owl.signal)(null);
|
|
72098
71812
|
spreadsheetRect = useSpreadsheetRect();
|
|
72099
|
-
state = (0, _odoo_owl.proxy)({
|
|
71813
|
+
state = (0, _odoo_owl.proxy)({
|
|
71814
|
+
printModeEnabled: false,
|
|
71815
|
+
colorThemeBeforePrint: "light"
|
|
71816
|
+
});
|
|
72100
71817
|
_focusGrid;
|
|
72101
71818
|
isViewportTooSmall = false;
|
|
72102
71819
|
notificationStore;
|
|
@@ -72108,7 +71825,7 @@ var Spreadsheet = class extends Component {
|
|
|
72108
71825
|
const properties = {};
|
|
72109
71826
|
properties["--os-scrollbar-width"] = `${this.env.model.getters.getScrollBarWidth()}px`;
|
|
72110
71827
|
properties["--os-dark-mode-filter"] = DARK_MODE_FILTER_STRING;
|
|
72111
|
-
properties["color-scheme"] = this.
|
|
71828
|
+
properties["color-scheme"] = this.colorScheme;
|
|
72112
71829
|
if (this.state.printModeEnabled) properties["display"] = `block`;
|
|
72113
71830
|
else {
|
|
72114
71831
|
if (this.env.model.getters.isDashboard()) properties["grid-template-rows"] = `auto`;
|
|
@@ -72148,7 +71865,7 @@ var Spreadsheet = class extends Component {
|
|
|
72148
71865
|
askConfirmation: (text, confirm, cancel) => this.notificationStore.askConfirmation(text, confirm, cancel),
|
|
72149
71866
|
raiseError: (text, cb) => this.notificationStore.raiseError(text, cb),
|
|
72150
71867
|
isMobile: isMobileOS,
|
|
72151
|
-
printSpreadsheet:
|
|
71868
|
+
printSpreadsheet: this.enterPrintMode.bind(this)
|
|
72152
71869
|
});
|
|
72153
71870
|
this.notificationStore.updateNotificationCallbacks({ ...this.props });
|
|
72154
71871
|
useLayoutEffect(() => {
|
|
@@ -72165,7 +71882,7 @@ var Spreadsheet = class extends Component {
|
|
|
72165
71882
|
useExternalListener(document.body, "wheel", () => {});
|
|
72166
71883
|
useExternalListener(window, "keydown", async (event) => {
|
|
72167
71884
|
if (keyboardEventToShortcutString(event) === "Ctrl+P") {
|
|
72168
|
-
this.
|
|
71885
|
+
this.enterPrintMode();
|
|
72169
71886
|
event.stopPropagation();
|
|
72170
71887
|
event.preventDefault();
|
|
72171
71888
|
}
|
|
@@ -72278,9 +71995,21 @@ var Spreadsheet = class extends Component {
|
|
|
72278
71995
|
getSpreadSheetClasses() {
|
|
72279
71996
|
return [this.env.isSmall ? "o-spreadsheet-mobile" : "", this.props.model.getters.isDarkMode() ? "dark" : ""].join(" ");
|
|
72280
71997
|
}
|
|
71998
|
+
enterPrintMode() {
|
|
71999
|
+
if (this.state.printModeEnabled) return;
|
|
72000
|
+
this.state.colorThemeBeforePrint = this.props.model.getters.isDarkMode() ? "dark" : "light";
|
|
72001
|
+
this.env.model.dispatch("UPDATE_COLOR_SCHEME", { colorScheme: "light" });
|
|
72002
|
+
this.state.printModeEnabled = true;
|
|
72003
|
+
}
|
|
72281
72004
|
exitPrintMode() {
|
|
72005
|
+
if (!this.state.printModeEnabled) return;
|
|
72006
|
+
this.env.model.dispatch("UPDATE_COLOR_SCHEME", { colorScheme: this.state.colorThemeBeforePrint });
|
|
72282
72007
|
this.state.printModeEnabled = false;
|
|
72283
72008
|
}
|
|
72009
|
+
get colorScheme() {
|
|
72010
|
+
if (this.state.printModeEnabled) return this.state.colorThemeBeforePrint;
|
|
72011
|
+
return this.props.model.getters.isDarkMode() ? "dark" : "light";
|
|
72012
|
+
}
|
|
72284
72013
|
};
|
|
72285
72014
|
|
|
72286
72015
|
//#endregion
|
|
@@ -73155,6 +72884,8 @@ var RangeAdapterPlugin = class {
|
|
|
73155
72884
|
"extendRange",
|
|
73156
72885
|
"getRangeString",
|
|
73157
72886
|
"getRangeFromSheetXC",
|
|
72887
|
+
"clipRangesToSheet",
|
|
72888
|
+
"clipRangeToSheet",
|
|
73158
72889
|
"createAdaptedRanges",
|
|
73159
72890
|
"getRangeData",
|
|
73160
72891
|
"getRangeDataFromXc",
|
|
@@ -73193,6 +72924,22 @@ var RangeAdapterPlugin = class {
|
|
|
73193
72924
|
addRangeProvider(provider) {
|
|
73194
72925
|
this.providers.push(provider);
|
|
73195
72926
|
}
|
|
72927
|
+
clipRangeToSheet(range) {
|
|
72928
|
+
if (range.invalidXc) return range;
|
|
72929
|
+
const sheetZone = this.getters.getSheetZone(range.sheetId);
|
|
72930
|
+
if (isZoneInside(range.zone, sheetZone)) return range;
|
|
72931
|
+
const newZone = intersection(range.zone, sheetZone);
|
|
72932
|
+
if (!newZone) return;
|
|
72933
|
+
return this.getters.getRangeFromZone(range.sheetId, newZone);
|
|
72934
|
+
}
|
|
72935
|
+
clipRangesToSheet(ranges) {
|
|
72936
|
+
const clippedRanges = [];
|
|
72937
|
+
for (const range of ranges) {
|
|
72938
|
+
const clippedRange = this.clipRangeToSheet(range);
|
|
72939
|
+
if (clippedRange) clippedRanges.push(clippedRange);
|
|
72940
|
+
}
|
|
72941
|
+
return clippedRanges;
|
|
72942
|
+
}
|
|
73196
72943
|
createAdaptedRanges(ranges, offsetX, offsetY, sheetId) {
|
|
73197
72944
|
return ranges.map((range) => {
|
|
73198
72945
|
if (!isZoneValid(range.zone)) return range;
|
|
@@ -76426,6 +76173,8 @@ var Model = class Model extends EventBus {
|
|
|
76426
76173
|
this.range = new RangeAdapterPlugin(this.coreGetters);
|
|
76427
76174
|
this.coreGetters.getRangeString = this.range.getRangeString.bind(this.range);
|
|
76428
76175
|
this.coreGetters.getRangeFromSheetXC = this.range.getRangeFromSheetXC.bind(this.range);
|
|
76176
|
+
this.coreGetters.clipRangesToSheet = this.range.clipRangesToSheet.bind(this.range);
|
|
76177
|
+
this.coreGetters.clipRangeToSheet = this.range.clipRangeToSheet.bind(this.range);
|
|
76429
76178
|
this.coreGetters.createAdaptedRanges = this.range.createAdaptedRanges.bind(this.range);
|
|
76430
76179
|
this.coreGetters.getRangeData = this.range.getRangeData.bind(this.range);
|
|
76431
76180
|
this.coreGetters.getRangeDataFromXc = this.range.getRangeDataFromXc.bind(this.range);
|
|
@@ -78388,6 +78137,306 @@ const LinkEditorPopoverBuilder = { onOpen: (position, getters) => {
|
|
|
78388
78137
|
//#region src/components/popover/popover_builders.ts
|
|
78389
78138
|
cellPopoverRegistry.add("ErrorToolTip", ErrorToolTipPopoverBuilder).add("LinkCell", LinkCellPopoverBuilder).add("LinkEditor", LinkEditorPopoverBuilder).add("FilterMenu", FilterMenuPopoverBuilder);
|
|
78390
78139
|
|
|
78140
|
+
//#endregion
|
|
78141
|
+
//#region src/helpers/figures/charts/chart_data_sources.ts
|
|
78142
|
+
const EMPTY = Object.freeze({ value: null });
|
|
78143
|
+
const ONE = Object.freeze({ value: 1 });
|
|
78144
|
+
const ChartRangeDataSourceHandler = {
|
|
78145
|
+
supportedChartTypes: CHART_TYPES,
|
|
78146
|
+
fromExternalDefinition(dataSource, defaultSheetId, getters) {
|
|
78147
|
+
const dataSets = createDataSets(getters, defaultSheetId, dataSource);
|
|
78148
|
+
const labelRange = createValidRange(getters, defaultSheetId, dataSource.labelRange);
|
|
78149
|
+
return {
|
|
78150
|
+
...dataSource,
|
|
78151
|
+
dataSets,
|
|
78152
|
+
labelRange
|
|
78153
|
+
};
|
|
78154
|
+
},
|
|
78155
|
+
fromContextCreation(context) {
|
|
78156
|
+
return {
|
|
78157
|
+
type: "range",
|
|
78158
|
+
dataSets: [],
|
|
78159
|
+
dataSetsHaveTitle: false,
|
|
78160
|
+
labelRange: context.auxiliaryRange,
|
|
78161
|
+
...context.dataSource
|
|
78162
|
+
};
|
|
78163
|
+
},
|
|
78164
|
+
fromHierarchicalContextCreation(context) {
|
|
78165
|
+
if (context.dataSource?.type !== "range" || context.hierarchicalDataSource !== void 0 && context.hierarchicalDataSource.type !== "range") return {
|
|
78166
|
+
type: "range",
|
|
78167
|
+
dataSets: [],
|
|
78168
|
+
dataSetsHaveTitle: false
|
|
78169
|
+
};
|
|
78170
|
+
let dataSource = {
|
|
78171
|
+
type: "range",
|
|
78172
|
+
dataSets: [],
|
|
78173
|
+
dataSetsHaveTitle: context.dataSource?.dataSetsHaveTitle ?? false,
|
|
78174
|
+
labelRange: context.dataSource?.dataSets?.[0]?.dataRange
|
|
78175
|
+
};
|
|
78176
|
+
if (context.hierarchicalDataSource?.dataSets.length) dataSource = context.hierarchicalDataSource;
|
|
78177
|
+
else if (context.auxiliaryRange) dataSource = {
|
|
78178
|
+
...dataSource,
|
|
78179
|
+
dataSets: [{
|
|
78180
|
+
dataRange: context.auxiliaryRange,
|
|
78181
|
+
dataSetId: "0"
|
|
78182
|
+
}]
|
|
78183
|
+
};
|
|
78184
|
+
return dataSource;
|
|
78185
|
+
},
|
|
78186
|
+
validate: (dataSource, validator) => validator.checkValidations(dataSource, checkDataset, checkLabelRange),
|
|
78187
|
+
transform(dataSource, defaultSheetId, { adaptRangeString }) {
|
|
78188
|
+
let labelRange;
|
|
78189
|
+
if (dataSource.labelRange) {
|
|
78190
|
+
const { changeType, range: adaptedRange } = adaptRangeString(defaultSheetId, dataSource.labelRange);
|
|
78191
|
+
if (changeType !== "REMOVE") labelRange = adaptedRange;
|
|
78192
|
+
}
|
|
78193
|
+
const dataSets = [];
|
|
78194
|
+
for (const dataSet of dataSource.dataSets) {
|
|
78195
|
+
const newDataSet = { ...dataSet };
|
|
78196
|
+
const { changeType, range: adaptedRange } = adaptRangeString(defaultSheetId, dataSet.dataRange);
|
|
78197
|
+
if (changeType !== "REMOVE") {
|
|
78198
|
+
newDataSet.dataRange = adaptedRange;
|
|
78199
|
+
dataSets.push(newDataSet);
|
|
78200
|
+
}
|
|
78201
|
+
}
|
|
78202
|
+
return {
|
|
78203
|
+
...dataSource,
|
|
78204
|
+
dataSets,
|
|
78205
|
+
labelRange
|
|
78206
|
+
};
|
|
78207
|
+
},
|
|
78208
|
+
extractData: (dataSource, chartId, getters) => getChartData(getters, dataSource),
|
|
78209
|
+
extractHierarchicalData(dataSource, chartId, getters) {
|
|
78210
|
+
const dataSets = dataSource.dataSets;
|
|
78211
|
+
const labelRange = dataSource.labelRange;
|
|
78212
|
+
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
78213
|
+
const dataSetsValues = getHierarchicalDatasetValues(getters, dataSets);
|
|
78214
|
+
const data = {
|
|
78215
|
+
labelValues,
|
|
78216
|
+
dataSetsValues
|
|
78217
|
+
};
|
|
78218
|
+
if (shouldRemoveFirstLabel(labelValues.length, dataSetsValues[0]?.data.length + (dataSetsValues[0]?.label !== void 0 ? 1 : 0), dataSource.dataSetsHaveTitle || false)) labelValues.shift();
|
|
78219
|
+
return data;
|
|
78220
|
+
},
|
|
78221
|
+
adaptRanges(dataSource, { applyChange }) {
|
|
78222
|
+
const dataSetsWithUndefined = dataSource.dataSets.map((ds) => {
|
|
78223
|
+
const { range: adaptedRangeStr, changeType } = applyChange(ds.dataRange);
|
|
78224
|
+
if (changeType === "REMOVE") return;
|
|
78225
|
+
let labelCell = void 0;
|
|
78226
|
+
if (ds.labelCell) {
|
|
78227
|
+
const { range: adaptedLabelCellRange, changeType: labelCellChangeType } = applyChange(ds.labelCell);
|
|
78228
|
+
if (labelCellChangeType !== "REMOVE") labelCell = adaptedLabelCellRange;
|
|
78229
|
+
}
|
|
78230
|
+
return {
|
|
78231
|
+
...ds,
|
|
78232
|
+
dataRange: adaptedRangeStr,
|
|
78233
|
+
labelCell
|
|
78234
|
+
};
|
|
78235
|
+
}).filter(isDefined);
|
|
78236
|
+
let labelRange = dataSource.labelRange;
|
|
78237
|
+
if (labelRange) {
|
|
78238
|
+
const { range: adaptedLabelRange, changeType } = applyChange(labelRange);
|
|
78239
|
+
if (changeType === "REMOVE") labelRange = void 0;
|
|
78240
|
+
else labelRange = adaptedLabelRange;
|
|
78241
|
+
}
|
|
78242
|
+
const dataSets = dataSetsWithUndefined;
|
|
78243
|
+
return {
|
|
78244
|
+
...dataSource,
|
|
78245
|
+
dataSets,
|
|
78246
|
+
labelRange: labelRange?.invalidSheetName || labelRange?.invalidXc ? void 0 : labelRange
|
|
78247
|
+
};
|
|
78248
|
+
},
|
|
78249
|
+
getDefinition(dataSource, defaultSheetId, getters) {
|
|
78250
|
+
return {
|
|
78251
|
+
labelRange: dataSource.labelRange ? getters.getRangeString(dataSource.labelRange, defaultSheetId) : void 0,
|
|
78252
|
+
type: "range",
|
|
78253
|
+
dataSets: dataSource.dataSets.map((dataSet) => ({
|
|
78254
|
+
dataSetId: dataSet.dataSetId,
|
|
78255
|
+
dataRange: getters.getRangeString(dataSet.dataRange, defaultSheetId)
|
|
78256
|
+
})),
|
|
78257
|
+
dataSetsHaveTitle: dataSource.dataSetsHaveTitle
|
|
78258
|
+
};
|
|
78259
|
+
},
|
|
78260
|
+
/**
|
|
78261
|
+
* Duplicate the dataSets. All ranges on sheetIdFrom are adapted to target
|
|
78262
|
+
* sheetIdTo.
|
|
78263
|
+
*/
|
|
78264
|
+
duplicateInDuplicatedSheet(dataSource, sheetIdFrom, sheetIdTo, getters) {
|
|
78265
|
+
return {
|
|
78266
|
+
...dataSource,
|
|
78267
|
+
labelRange: duplicateLabelRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, dataSource.labelRange),
|
|
78268
|
+
dataSets: dataSource.dataSets.map((ds) => ({
|
|
78269
|
+
...ds,
|
|
78270
|
+
dataRange: duplicateRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, ds.dataRange)
|
|
78271
|
+
}))
|
|
78272
|
+
};
|
|
78273
|
+
},
|
|
78274
|
+
getContextCreation: (dataSource) => ({
|
|
78275
|
+
auxiliaryRange: dataSource.labelRange,
|
|
78276
|
+
dataSource
|
|
78277
|
+
}),
|
|
78278
|
+
getHierarchicalContextCreation(dataSource) {
|
|
78279
|
+
const leafRange = dataSource.dataSets.at(-1)?.dataRange;
|
|
78280
|
+
const dataSetsHaveTitle = dataSource.dataSetsHaveTitle;
|
|
78281
|
+
return {
|
|
78282
|
+
auxiliaryRange: leafRange,
|
|
78283
|
+
hierarchicalDataSource: dataSource,
|
|
78284
|
+
dataSource: dataSource.labelRange ? {
|
|
78285
|
+
type: "range",
|
|
78286
|
+
dataSets: [{
|
|
78287
|
+
dataRange: dataSource.labelRange,
|
|
78288
|
+
dataSetId: "0"
|
|
78289
|
+
}],
|
|
78290
|
+
dataSetsHaveTitle
|
|
78291
|
+
} : {
|
|
78292
|
+
type: "range",
|
|
78293
|
+
dataSets: [],
|
|
78294
|
+
dataSetsHaveTitle
|
|
78295
|
+
}
|
|
78296
|
+
};
|
|
78297
|
+
},
|
|
78298
|
+
toExcelDataSets(dataSource, dataSetStyles, getters) {
|
|
78299
|
+
const dataSets = dataSource.dataSets;
|
|
78300
|
+
const labelRange = dataSource.labelRange;
|
|
78301
|
+
const excelDataSets = dataSets.map((ds) => toExcelDataset(getters, dataSetStyles, ds)).filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
|
|
78302
|
+
const datasetLength = dataSets[0] ? getZoneArea(dataSets[0].dataRange.zone) : void 0;
|
|
78303
|
+
return {
|
|
78304
|
+
dataSets: excelDataSets,
|
|
78305
|
+
labelRange: toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel(labelRange ? getZoneArea(labelRange.zone) : 0, datasetLength, dataSource.dataSetsHaveTitle))
|
|
78306
|
+
};
|
|
78307
|
+
}
|
|
78308
|
+
};
|
|
78309
|
+
function getChartData(getters, dataSource) {
|
|
78310
|
+
const dataSets = dataSource.dataSets;
|
|
78311
|
+
const labelRange = dataSource.labelRange;
|
|
78312
|
+
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
78313
|
+
const dataSetsValues = getChartDatasetValues(getters, dataSets);
|
|
78314
|
+
const data = {
|
|
78315
|
+
labelValues,
|
|
78316
|
+
dataSetsValues
|
|
78317
|
+
};
|
|
78318
|
+
const numberOfDataPoints = dataSetsValues.length ? dataSetsValues[0]?.data.length + (dataSetsValues[0]?.label !== void 0 ? 1 : 0) : 0;
|
|
78319
|
+
if (shouldRemoveFirstLabel(labelValues.length, numberOfDataPoints, dataSource.dataSetsHaveTitle || false)) labelValues.shift();
|
|
78320
|
+
return data;
|
|
78321
|
+
}
|
|
78322
|
+
function getChartDatasetValues(getters, dataSets) {
|
|
78323
|
+
const datasetValues = [];
|
|
78324
|
+
for (const [dsIndex, ds] of Object.entries(dataSets)) {
|
|
78325
|
+
let label = `${ChartTerms.Series} ${parseInt(dsIndex) + 1}`;
|
|
78326
|
+
let hidden = getters.isColHidden(ds.dataRange.sheetId, ds.dataRange.zone.left);
|
|
78327
|
+
if (ds.labelCell) {
|
|
78328
|
+
const { sheetId, zone } = ds.labelCell;
|
|
78329
|
+
const cell = getters.getEvaluatedCell({
|
|
78330
|
+
sheetId,
|
|
78331
|
+
col: zone.left,
|
|
78332
|
+
row: zone.top
|
|
78333
|
+
});
|
|
78334
|
+
if (cell) label = cell.formattedValue;
|
|
78335
|
+
}
|
|
78336
|
+
let data = ds.dataRange ? getData(getters, ds) : [];
|
|
78337
|
+
if (data.every((cell) => !cell.value || isTextResult(cell)) && data.filter(isTextResult).length > 1) data = data.map((cell) => cell.value && !isErrorResult(cell) ? ONE : EMPTY);
|
|
78338
|
+
else if (data.every((cell) => !isNumberResult(cell))) hidden = true;
|
|
78339
|
+
datasetValues.push({
|
|
78340
|
+
data,
|
|
78341
|
+
label,
|
|
78342
|
+
hidden,
|
|
78343
|
+
dataSetId: ds.dataSetId
|
|
78344
|
+
});
|
|
78345
|
+
}
|
|
78346
|
+
return datasetValues;
|
|
78347
|
+
}
|
|
78348
|
+
function getChartLabelValues(getters, dataSets, labelRange) {
|
|
78349
|
+
if (labelRange) {
|
|
78350
|
+
const { left } = labelRange.zone;
|
|
78351
|
+
if (!labelRange.invalidXc && !labelRange.invalidSheetName && !getters.isColHidden(labelRange.sheetId, left)) return getters.getVisibleRangeValues(labelRange);
|
|
78352
|
+
}
|
|
78353
|
+
if (dataSets[0]) {
|
|
78354
|
+
const dataLength = getData(getters, dataSets[0]).length;
|
|
78355
|
+
return Array.from({ length: dataLength }, () => ({ value: "" }));
|
|
78356
|
+
}
|
|
78357
|
+
return [];
|
|
78358
|
+
}
|
|
78359
|
+
/**
|
|
78360
|
+
* Get the values for a hierarchical dataset. The values can be defined in a tree-like structure
|
|
78361
|
+
* in the sheet, and this function will fill up the blanks.
|
|
78362
|
+
*
|
|
78363
|
+
* @example the following dataset:
|
|
78364
|
+
*
|
|
78365
|
+
* 2024 Q1 W1 100
|
|
78366
|
+
* W2 200
|
|
78367
|
+
*
|
|
78368
|
+
* will have the same value as the dataset:
|
|
78369
|
+
* 2024 Q1 W1 100
|
|
78370
|
+
* 2024 Q1 W2 200
|
|
78371
|
+
*/
|
|
78372
|
+
function getHierarchicalDatasetValues(getters, dataSets) {
|
|
78373
|
+
dataSets = dataSets.filter((ds) => !getters.isColHidden(ds.dataRange.sheetId, ds.dataRange.zone.left));
|
|
78374
|
+
const datasetValues = dataSets.map((ds) => ({
|
|
78375
|
+
data: [],
|
|
78376
|
+
label: "",
|
|
78377
|
+
dataSetId: ds.dataSetId
|
|
78378
|
+
}));
|
|
78379
|
+
const locale = getters.getLocale();
|
|
78380
|
+
const dataSetsData = dataSets.map((ds) => getData(getters, ds)).map((values) => values.map(({ value, format }) => value === null ? EMPTY : { value: formatValue(value, {
|
|
78381
|
+
format,
|
|
78382
|
+
locale
|
|
78383
|
+
}) }));
|
|
78384
|
+
if (!dataSetsData.length) return datasetValues;
|
|
78385
|
+
const minLength = Math.min(...dataSetsData.map((ds) => ds.length));
|
|
78386
|
+
let currentValues = [];
|
|
78387
|
+
const leafDatasetIndex = dataSets.length - 1;
|
|
78388
|
+
for (let i = 0; i < minLength; i++) for (let dsIndex = 0; dsIndex < dataSetsData.length; dsIndex++) {
|
|
78389
|
+
let cell = dataSetsData[dsIndex][i];
|
|
78390
|
+
if ((cell === void 0 || cell.value === null) && dsIndex !== leafDatasetIndex) cell = currentValues[dsIndex];
|
|
78391
|
+
if (cell?.value !== currentValues[dsIndex]?.value) {
|
|
78392
|
+
currentValues = currentValues.slice(0, dsIndex);
|
|
78393
|
+
currentValues[dsIndex] = cell;
|
|
78394
|
+
}
|
|
78395
|
+
datasetValues[dsIndex].data.push(cell ?? EMPTY);
|
|
78396
|
+
}
|
|
78397
|
+
return datasetValues.filter((ds) => ds.data.some((d) => d.value !== null));
|
|
78398
|
+
}
|
|
78399
|
+
/**
|
|
78400
|
+
* Get the data from a dataSet
|
|
78401
|
+
*/
|
|
78402
|
+
function getData(getters, ds) {
|
|
78403
|
+
if (ds.dataRange) {
|
|
78404
|
+
const labelCellZone = ds.labelCell ? [ds.labelCell.zone] : [];
|
|
78405
|
+
const dataZone = recomputeZones([ds.dataRange.zone], labelCellZone)[0];
|
|
78406
|
+
if (dataZone === void 0) return [];
|
|
78407
|
+
const dataRange = getters.getRangeFromZone(ds.dataRange.sheetId, dataZone);
|
|
78408
|
+
return getters.getVisibleRangeValues(dataRange).map((cell) => cell.value === "" ? EMPTY : cell);
|
|
78409
|
+
}
|
|
78410
|
+
return [];
|
|
78411
|
+
}
|
|
78412
|
+
const ChartNeverDataSourceHandler = {
|
|
78413
|
+
supportedChartTypes: [],
|
|
78414
|
+
fromExternalDefinition: () => ({ type: "none" }),
|
|
78415
|
+
fromContextCreation: () => ({ type: "none" }),
|
|
78416
|
+
fromHierarchicalContextCreation: () => ({ type: "none" }),
|
|
78417
|
+
validate: () => "Success",
|
|
78418
|
+
transform: () => ({ type: "none" }),
|
|
78419
|
+
extractData: () => ({
|
|
78420
|
+
dataSetsValues: [],
|
|
78421
|
+
labelValues: []
|
|
78422
|
+
}),
|
|
78423
|
+
extractHierarchicalData: () => ({
|
|
78424
|
+
dataSetsValues: [],
|
|
78425
|
+
labelValues: []
|
|
78426
|
+
}),
|
|
78427
|
+
adaptRanges: (dataSource) => dataSource,
|
|
78428
|
+
getDefinition: (dataSource) => dataSource,
|
|
78429
|
+
duplicateInDuplicatedSheet: (dataSource) => dataSource,
|
|
78430
|
+
getContextCreation: () => ({}),
|
|
78431
|
+
getHierarchicalContextCreation: () => ({}),
|
|
78432
|
+
toExcelDataSets: () => ({
|
|
78433
|
+
dataSets: [],
|
|
78434
|
+
labelRange: void 0
|
|
78435
|
+
})
|
|
78436
|
+
};
|
|
78437
|
+
chartDataSourceRegistry.add("range", ChartRangeDataSourceHandler);
|
|
78438
|
+
chartDataSourceRegistry.add("none", ChartNeverDataSourceHandler);
|
|
78439
|
+
|
|
78391
78440
|
//#endregion
|
|
78392
78441
|
//#region src/registries/auto_completes/data_validation_auto_complete.ts
|
|
78393
78442
|
autoCompleteProviders.add("dataValidation", {
|
|
@@ -79311,14 +79360,13 @@ const PyramidChart = {
|
|
|
79311
79360
|
},
|
|
79312
79361
|
getDefinitionForExcel(getters, definition, { dataSets, labelRange }) {
|
|
79313
79362
|
if (definition.dataSource.type !== "range") return;
|
|
79314
|
-
const
|
|
79315
|
-
const { dataSetsValues } = chartData;
|
|
79363
|
+
const { dataSetsValues } = getPyramidChartData(definition, getChartData(getters, definition.dataSource), getters);
|
|
79316
79364
|
const maxValue = Math.max(...dataSetsValues.map((dataSet) => Math.max(...dataSet.data.map((cell) => isNumberResult(cell) ? Math.abs(cell.value) : -Infinity))));
|
|
79317
79365
|
return {
|
|
79318
79366
|
...definition,
|
|
79319
79367
|
horizontal: true,
|
|
79320
|
-
backgroundColor: toXlsxHexColor(
|
|
79321
|
-
fontColor: toXlsxHexColor(chartFontColor(
|
|
79368
|
+
backgroundColor: toXlsxHexColor(definition.background || "#FFFFFF"),
|
|
79369
|
+
fontColor: toXlsxHexColor(chartFontColor(definition.background)),
|
|
79322
79370
|
dataSets,
|
|
79323
79371
|
labelRange,
|
|
79324
79372
|
verticalAxis: getDefinedAxis(definition),
|
|
@@ -87973,6 +88021,6 @@ exports.stores = stores;
|
|
|
87973
88021
|
exports.tokenColors = tokenColors;
|
|
87974
88022
|
exports.tokenize = tokenize;
|
|
87975
88023
|
|
|
87976
|
-
__info__.version = "19.4.
|
|
87977
|
-
__info__.date = "2026-
|
|
87978
|
-
__info__.hash = "
|
|
88024
|
+
__info__.version = "19.4.12";
|
|
88025
|
+
__info__.date = "2026-09-10T05:38:01.898Z";
|
|
88026
|
+
__info__.hash = "cdb63b4";
|