@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
|
@@ -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
|
import * as owl from "@odoo/owl";
|
|
@@ -445,6 +445,7 @@ const FILTERS_COLOR = "#188038";
|
|
|
445
445
|
const COMPOSER_ASSISTANT_COLOR = "light-dark(#9B359B, #B972A6)";
|
|
446
446
|
const COLOR_TRANSPARENT = "#00000000";
|
|
447
447
|
const TABLE_HOVER_BACKGROUND_COLOR = "#017E8414";
|
|
448
|
+
const DEFAULT_CHART_BACKGROUND_COLOR = "#FFFFFF";
|
|
448
449
|
const CHART_WATERFALL_POSITIVE_COLOR = "#4EA7F2";
|
|
449
450
|
const CHART_WATERFALL_NEGATIVE_COLOR = "#EA6175";
|
|
450
451
|
const CHART_WATERFALL_SUBTOTAL_COLOR = "#AAAAAA";
|
|
@@ -7851,7 +7852,8 @@ const invalidateChartEvaluationCommands = /* @__PURE__ */ new Set([
|
|
|
7851
7852
|
"UPDATE_TABLE",
|
|
7852
7853
|
"UPDATE_FILTER",
|
|
7853
7854
|
"UNDO",
|
|
7854
|
-
"REDO"
|
|
7855
|
+
"REDO",
|
|
7856
|
+
"UPDATE_COLOR_SCHEME"
|
|
7855
7857
|
]);
|
|
7856
7858
|
const invalidateDependenciesCommands = /* @__PURE__ */ new Set(["MOVE_RANGES"]);
|
|
7857
7859
|
const invalidateCFEvaluationCommands = /* @__PURE__ */ new Set([
|
|
@@ -8992,6 +8994,259 @@ const chartMinorGridPlugin = {
|
|
|
8992
8994
|
}
|
|
8993
8995
|
};
|
|
8994
8996
|
|
|
8997
|
+
//#endregion
|
|
8998
|
+
//#region src/xlsx/constants.ts
|
|
8999
|
+
/** In XLSX color format (no #) */
|
|
9000
|
+
const AUTO_COLOR = "000000";
|
|
9001
|
+
const XLSX_ICONSET_MAP = {
|
|
9002
|
+
arrows: "3Arrows",
|
|
9003
|
+
smiley: "3Symbols",
|
|
9004
|
+
dots: "3TrafficLights1"
|
|
9005
|
+
};
|
|
9006
|
+
const NAMESPACE = {
|
|
9007
|
+
styleSheet: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9008
|
+
sst: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9009
|
+
Relationships: "http://schemas.openxmlformats.org/package/2006/relationships",
|
|
9010
|
+
Types: "http://schemas.openxmlformats.org/package/2006/content-types",
|
|
9011
|
+
worksheet: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9012
|
+
workbook: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9013
|
+
drawing: "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",
|
|
9014
|
+
table: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9015
|
+
revision: "http://schemas.microsoft.com/office/spreadsheetml/2014/revision",
|
|
9016
|
+
revision3: "http://schemas.microsoft.com/office/spreadsheetml/2016/revision3",
|
|
9017
|
+
markupCompatibility: "http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
9018
|
+
};
|
|
9019
|
+
const DRAWING_NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
9020
|
+
const DRAWING_NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
9021
|
+
const CONTENT_TYPES = {
|
|
9022
|
+
workbook: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
|
9023
|
+
macroEnabledWorkbook: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
|
9024
|
+
templateWorkbook: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml",
|
|
9025
|
+
macroEnabledTemplateWorkbook: "application/vnd.ms-excel.template.macroEnabled.main+xml",
|
|
9026
|
+
excelAddInWorkbook: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
|
9027
|
+
sheet: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
|
9028
|
+
metadata: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
|
9029
|
+
sharedStrings: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
|
9030
|
+
styles: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
|
9031
|
+
drawing: "application/vnd.openxmlformats-officedocument.drawing+xml",
|
|
9032
|
+
chart: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
|
|
9033
|
+
themes: "application/vnd.openxmlformats-officedocument.theme+xml",
|
|
9034
|
+
table: "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
|
|
9035
|
+
pivot: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml",
|
|
9036
|
+
externalLink: "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml"
|
|
9037
|
+
};
|
|
9038
|
+
const XLSX_RELATION_TYPE = {
|
|
9039
|
+
document: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
|
|
9040
|
+
sheet: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",
|
|
9041
|
+
metadata: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",
|
|
9042
|
+
sharedStrings: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",
|
|
9043
|
+
styles: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",
|
|
9044
|
+
drawing: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",
|
|
9045
|
+
chart: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",
|
|
9046
|
+
theme: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
|
|
9047
|
+
table: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",
|
|
9048
|
+
hyperlink: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
9049
|
+
image: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
|
|
9050
|
+
};
|
|
9051
|
+
const ARRAY_FORMULA_URI = "bdbb8cdc-fa1e-496e-a857-3c3f30c029c3";
|
|
9052
|
+
const RELATIONSHIP_NSR = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
9053
|
+
const HEIGHT_FACTOR = .75;
|
|
9054
|
+
/**
|
|
9055
|
+
* Excel says its default column width is 8.43 characters (64px)
|
|
9056
|
+
* which makes WIDTH_FACTOR = 0.1317, but it doesn't work well
|
|
9057
|
+
* 0.143 is a value from dev's experiments.
|
|
9058
|
+
*/
|
|
9059
|
+
const WIDTH_FACTOR = .143;
|
|
9060
|
+
/** unit : maximum number of characters a column can hold at the standard font size. What. */
|
|
9061
|
+
const EXCEL_DEFAULT_COL_WIDTH = 8.43;
|
|
9062
|
+
/** unit : points */
|
|
9063
|
+
const EXCEL_DEFAULT_ROW_HEIGHT = 12.75;
|
|
9064
|
+
const FORCE_DEFAULT_ARGS_FUNCTIONS = {
|
|
9065
|
+
FLOOR: [{
|
|
9066
|
+
type: "NUMBER",
|
|
9067
|
+
value: 1
|
|
9068
|
+
}],
|
|
9069
|
+
CEILING: [{
|
|
9070
|
+
type: "NUMBER",
|
|
9071
|
+
value: 1
|
|
9072
|
+
}],
|
|
9073
|
+
ROUND: [{
|
|
9074
|
+
type: "NUMBER",
|
|
9075
|
+
value: 0
|
|
9076
|
+
}],
|
|
9077
|
+
ROUNDUP: [{
|
|
9078
|
+
type: "NUMBER",
|
|
9079
|
+
value: 0
|
|
9080
|
+
}],
|
|
9081
|
+
ROUNDDOWN: [{
|
|
9082
|
+
type: "NUMBER",
|
|
9083
|
+
value: 0
|
|
9084
|
+
}],
|
|
9085
|
+
IFERROR: [{
|
|
9086
|
+
type: "NUMBER",
|
|
9087
|
+
value: 0
|
|
9088
|
+
}]
|
|
9089
|
+
};
|
|
9090
|
+
/**
|
|
9091
|
+
* This list contains all "future" functions that are not compatible with older versions of Excel
|
|
9092
|
+
* For more information, see https://docs.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/5d1b6d44-6fc1-4ecd-8fef-0b27406cc2bf
|
|
9093
|
+
*/
|
|
9094
|
+
const NON_RETROCOMPATIBLE_FUNCTIONS = [
|
|
9095
|
+
"ACOT",
|
|
9096
|
+
"ACOTH",
|
|
9097
|
+
"AGGREGATE",
|
|
9098
|
+
"ARABIC",
|
|
9099
|
+
"BASE",
|
|
9100
|
+
"BETA.DIST",
|
|
9101
|
+
"BETA.INV",
|
|
9102
|
+
"BINOM.DIST",
|
|
9103
|
+
"BINOM.DIST.RANGE",
|
|
9104
|
+
"BINOM.INV",
|
|
9105
|
+
"BITAND",
|
|
9106
|
+
"BITLSHIFT",
|
|
9107
|
+
"BITOR",
|
|
9108
|
+
"BITRSHIFT",
|
|
9109
|
+
"BITXOR",
|
|
9110
|
+
"BYCOL",
|
|
9111
|
+
"BYROW",
|
|
9112
|
+
"CEILING.MATH",
|
|
9113
|
+
"CEILING.PRECISE",
|
|
9114
|
+
"CHISQ.DIST",
|
|
9115
|
+
"CHISQ.DIST.RT",
|
|
9116
|
+
"CHISQ.INV",
|
|
9117
|
+
"CHISQ.INV.RT",
|
|
9118
|
+
"CHISQ.TEST",
|
|
9119
|
+
"CHOOSECOLS",
|
|
9120
|
+
"CHOOSEROWS",
|
|
9121
|
+
"COMBINA",
|
|
9122
|
+
"CONCAT",
|
|
9123
|
+
"CONFIDENCE.NORM",
|
|
9124
|
+
"CONFIDENCE.T",
|
|
9125
|
+
"COT",
|
|
9126
|
+
"COTH",
|
|
9127
|
+
"COVARIANCE.P",
|
|
9128
|
+
"COVARIANCE.S",
|
|
9129
|
+
"CSC",
|
|
9130
|
+
"CSCH",
|
|
9131
|
+
"DAYS",
|
|
9132
|
+
"DECIMAL",
|
|
9133
|
+
"DROP",
|
|
9134
|
+
"ERF.PRECISE",
|
|
9135
|
+
"ERFC.PRECISE",
|
|
9136
|
+
"EXPAND",
|
|
9137
|
+
"EXPON.DIST",
|
|
9138
|
+
"F.DIST",
|
|
9139
|
+
"F.DIST.RT",
|
|
9140
|
+
"F.INV",
|
|
9141
|
+
"F.INV.RT",
|
|
9142
|
+
"F.TEST",
|
|
9143
|
+
"FIELDVALUE",
|
|
9144
|
+
"FILTERXML",
|
|
9145
|
+
"FLOOR.MATH",
|
|
9146
|
+
"FLOOR.PRECISE",
|
|
9147
|
+
"FORECAST.ETS",
|
|
9148
|
+
"FORECAST.ETS.CONFINT",
|
|
9149
|
+
"FORECAST.ETS.SEASONALITY",
|
|
9150
|
+
"FORECAST.ETS.STAT",
|
|
9151
|
+
"FORECAST.LINEAR",
|
|
9152
|
+
"FORMULATEXT",
|
|
9153
|
+
"GAMMA",
|
|
9154
|
+
"GAMMA.DIST",
|
|
9155
|
+
"GAMMA.INV",
|
|
9156
|
+
"GAMMALN.PRECISE",
|
|
9157
|
+
"GAUSS",
|
|
9158
|
+
"HSTACK",
|
|
9159
|
+
"HYPGEOM.DIST",
|
|
9160
|
+
"IFNA",
|
|
9161
|
+
"IFS",
|
|
9162
|
+
"IMCOSH",
|
|
9163
|
+
"IMCOT",
|
|
9164
|
+
"IMCSC",
|
|
9165
|
+
"IMCSCH",
|
|
9166
|
+
"IMSEC",
|
|
9167
|
+
"IMSECH",
|
|
9168
|
+
"IMSINH",
|
|
9169
|
+
"IMTAN",
|
|
9170
|
+
"ISFORMULA",
|
|
9171
|
+
"ISOMITTED",
|
|
9172
|
+
"ISOWEEKNUM",
|
|
9173
|
+
"LAMBDA",
|
|
9174
|
+
"LET",
|
|
9175
|
+
"LOGNORM.DIST",
|
|
9176
|
+
"LOGNORM.INV",
|
|
9177
|
+
"MAKEARRAY",
|
|
9178
|
+
"MAP",
|
|
9179
|
+
"MAXIFS",
|
|
9180
|
+
"MINIFS",
|
|
9181
|
+
"MODE.MULT",
|
|
9182
|
+
"MODE.SNGL",
|
|
9183
|
+
"MUNIT",
|
|
9184
|
+
"NEGBINOM.DIST",
|
|
9185
|
+
"NORM.DIST",
|
|
9186
|
+
"NORM.INV",
|
|
9187
|
+
"NORM.S.DIST",
|
|
9188
|
+
"NORM.S.INV",
|
|
9189
|
+
"NUMBERVALUE",
|
|
9190
|
+
"PDURATION",
|
|
9191
|
+
"PERCENTILE.EXC",
|
|
9192
|
+
"PERCENTILE.INC",
|
|
9193
|
+
"PERCENTRANK.EXC",
|
|
9194
|
+
"PERCENTRANK.INC",
|
|
9195
|
+
"PERMUTATIONA",
|
|
9196
|
+
"PHI",
|
|
9197
|
+
"POISSON.DIST",
|
|
9198
|
+
"PQSOURCE",
|
|
9199
|
+
"PYTHON_STR",
|
|
9200
|
+
"PYTHON_TYPE",
|
|
9201
|
+
"PYTHON_TYPENAME",
|
|
9202
|
+
"QUARTILE.EXC",
|
|
9203
|
+
"QUARTILE.INC",
|
|
9204
|
+
"QUERYSTRING",
|
|
9205
|
+
"RANDARRAY",
|
|
9206
|
+
"RANK.AVG",
|
|
9207
|
+
"RANK.EQ",
|
|
9208
|
+
"REDUCE",
|
|
9209
|
+
"RRI",
|
|
9210
|
+
"SCAN",
|
|
9211
|
+
"SEC",
|
|
9212
|
+
"SECH",
|
|
9213
|
+
"SEQUENCE",
|
|
9214
|
+
"SHEET",
|
|
9215
|
+
"SHEETS",
|
|
9216
|
+
"SKEW.P",
|
|
9217
|
+
"SORTBY",
|
|
9218
|
+
"STDEV.P",
|
|
9219
|
+
"STDEV.S",
|
|
9220
|
+
"SWITCH",
|
|
9221
|
+
"T.DIST",
|
|
9222
|
+
"T.DIST.2T",
|
|
9223
|
+
"T.DIST.RT",
|
|
9224
|
+
"T.INV",
|
|
9225
|
+
"T.INV.2T",
|
|
9226
|
+
"T.TEST",
|
|
9227
|
+
"TAKE",
|
|
9228
|
+
"TEXTAFTER",
|
|
9229
|
+
"TEXTBEFORE",
|
|
9230
|
+
"TEXTJOIN",
|
|
9231
|
+
"TEXTSPLIT",
|
|
9232
|
+
"TOCOL",
|
|
9233
|
+
"TOROW",
|
|
9234
|
+
"UNICHAR",
|
|
9235
|
+
"UNICODE",
|
|
9236
|
+
"UNIQUE",
|
|
9237
|
+
"VAR.P",
|
|
9238
|
+
"VAR.S",
|
|
9239
|
+
"VSTACK",
|
|
9240
|
+
"WEBSERVICE",
|
|
9241
|
+
"WEIBULL.DIST",
|
|
9242
|
+
"WRAPCOLS",
|
|
9243
|
+
"WRAPROWS",
|
|
9244
|
+
"XLOOKUP",
|
|
9245
|
+
"XOR",
|
|
9246
|
+
"Z.TEST"
|
|
9247
|
+
];
|
|
9248
|
+
const CONTENT_TYPES_FILE = "[Content_Types].xml";
|
|
9249
|
+
|
|
8995
9250
|
//#endregion
|
|
8996
9251
|
//#region src/helpers/color.ts
|
|
8997
9252
|
const RBA_REGEX = /rgba?\(|\s+|\)/gi;
|
|
@@ -9693,259 +9948,6 @@ function colorCell(value, minValue, minColor, colorDiffUnit) {
|
|
|
9693
9948
|
return r << 16 | g << 8 | b;
|
|
9694
9949
|
}
|
|
9695
9950
|
|
|
9696
|
-
//#endregion
|
|
9697
|
-
//#region src/xlsx/constants.ts
|
|
9698
|
-
/** In XLSX color format (no #) */
|
|
9699
|
-
const AUTO_COLOR = "000000";
|
|
9700
|
-
const XLSX_ICONSET_MAP = {
|
|
9701
|
-
arrows: "3Arrows",
|
|
9702
|
-
smiley: "3Symbols",
|
|
9703
|
-
dots: "3TrafficLights1"
|
|
9704
|
-
};
|
|
9705
|
-
const NAMESPACE = {
|
|
9706
|
-
styleSheet: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9707
|
-
sst: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9708
|
-
Relationships: "http://schemas.openxmlformats.org/package/2006/relationships",
|
|
9709
|
-
Types: "http://schemas.openxmlformats.org/package/2006/content-types",
|
|
9710
|
-
worksheet: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9711
|
-
workbook: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9712
|
-
drawing: "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",
|
|
9713
|
-
table: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
|
|
9714
|
-
revision: "http://schemas.microsoft.com/office/spreadsheetml/2014/revision",
|
|
9715
|
-
revision3: "http://schemas.microsoft.com/office/spreadsheetml/2016/revision3",
|
|
9716
|
-
markupCompatibility: "http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
9717
|
-
};
|
|
9718
|
-
const DRAWING_NS_A = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
9719
|
-
const DRAWING_NS_C = "http://schemas.openxmlformats.org/drawingml/2006/chart";
|
|
9720
|
-
const CONTENT_TYPES = {
|
|
9721
|
-
workbook: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
|
|
9722
|
-
macroEnabledWorkbook: "application/vnd.ms-excel.sheet.macroEnabled.main+xml",
|
|
9723
|
-
templateWorkbook: "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml",
|
|
9724
|
-
macroEnabledTemplateWorkbook: "application/vnd.ms-excel.template.macroEnabled.main+xml",
|
|
9725
|
-
excelAddInWorkbook: "application/vnd.ms-excel.addin.macroEnabled.main+xml",
|
|
9726
|
-
sheet: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",
|
|
9727
|
-
metadata: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml",
|
|
9728
|
-
sharedStrings: "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",
|
|
9729
|
-
styles: "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",
|
|
9730
|
-
drawing: "application/vnd.openxmlformats-officedocument.drawing+xml",
|
|
9731
|
-
chart: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml",
|
|
9732
|
-
themes: "application/vnd.openxmlformats-officedocument.theme+xml",
|
|
9733
|
-
table: "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
|
|
9734
|
-
pivot: "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml",
|
|
9735
|
-
externalLink: "application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml"
|
|
9736
|
-
};
|
|
9737
|
-
const XLSX_RELATION_TYPE = {
|
|
9738
|
-
document: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",
|
|
9739
|
-
sheet: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",
|
|
9740
|
-
metadata: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata",
|
|
9741
|
-
sharedStrings: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",
|
|
9742
|
-
styles: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",
|
|
9743
|
-
drawing: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",
|
|
9744
|
-
chart: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",
|
|
9745
|
-
theme: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
|
|
9746
|
-
table: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",
|
|
9747
|
-
hyperlink: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
|
9748
|
-
image: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
|
|
9749
|
-
};
|
|
9750
|
-
const ARRAY_FORMULA_URI = "bdbb8cdc-fa1e-496e-a857-3c3f30c029c3";
|
|
9751
|
-
const RELATIONSHIP_NSR = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
9752
|
-
const HEIGHT_FACTOR = .75;
|
|
9753
|
-
/**
|
|
9754
|
-
* Excel says its default column width is 8.43 characters (64px)
|
|
9755
|
-
* which makes WIDTH_FACTOR = 0.1317, but it doesn't work well
|
|
9756
|
-
* 0.143 is a value from dev's experiments.
|
|
9757
|
-
*/
|
|
9758
|
-
const WIDTH_FACTOR = .143;
|
|
9759
|
-
/** unit : maximum number of characters a column can hold at the standard font size. What. */
|
|
9760
|
-
const EXCEL_DEFAULT_COL_WIDTH = 8.43;
|
|
9761
|
-
/** unit : points */
|
|
9762
|
-
const EXCEL_DEFAULT_ROW_HEIGHT = 12.75;
|
|
9763
|
-
const FORCE_DEFAULT_ARGS_FUNCTIONS = {
|
|
9764
|
-
FLOOR: [{
|
|
9765
|
-
type: "NUMBER",
|
|
9766
|
-
value: 1
|
|
9767
|
-
}],
|
|
9768
|
-
CEILING: [{
|
|
9769
|
-
type: "NUMBER",
|
|
9770
|
-
value: 1
|
|
9771
|
-
}],
|
|
9772
|
-
ROUND: [{
|
|
9773
|
-
type: "NUMBER",
|
|
9774
|
-
value: 0
|
|
9775
|
-
}],
|
|
9776
|
-
ROUNDUP: [{
|
|
9777
|
-
type: "NUMBER",
|
|
9778
|
-
value: 0
|
|
9779
|
-
}],
|
|
9780
|
-
ROUNDDOWN: [{
|
|
9781
|
-
type: "NUMBER",
|
|
9782
|
-
value: 0
|
|
9783
|
-
}],
|
|
9784
|
-
IFERROR: [{
|
|
9785
|
-
type: "NUMBER",
|
|
9786
|
-
value: 0
|
|
9787
|
-
}]
|
|
9788
|
-
};
|
|
9789
|
-
/**
|
|
9790
|
-
* This list contains all "future" functions that are not compatible with older versions of Excel
|
|
9791
|
-
* For more information, see https://docs.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/5d1b6d44-6fc1-4ecd-8fef-0b27406cc2bf
|
|
9792
|
-
*/
|
|
9793
|
-
const NON_RETROCOMPATIBLE_FUNCTIONS = [
|
|
9794
|
-
"ACOT",
|
|
9795
|
-
"ACOTH",
|
|
9796
|
-
"AGGREGATE",
|
|
9797
|
-
"ARABIC",
|
|
9798
|
-
"BASE",
|
|
9799
|
-
"BETA.DIST",
|
|
9800
|
-
"BETA.INV",
|
|
9801
|
-
"BINOM.DIST",
|
|
9802
|
-
"BINOM.DIST.RANGE",
|
|
9803
|
-
"BINOM.INV",
|
|
9804
|
-
"BITAND",
|
|
9805
|
-
"BITLSHIFT",
|
|
9806
|
-
"BITOR",
|
|
9807
|
-
"BITRSHIFT",
|
|
9808
|
-
"BITXOR",
|
|
9809
|
-
"BYCOL",
|
|
9810
|
-
"BYROW",
|
|
9811
|
-
"CEILING.MATH",
|
|
9812
|
-
"CEILING.PRECISE",
|
|
9813
|
-
"CHISQ.DIST",
|
|
9814
|
-
"CHISQ.DIST.RT",
|
|
9815
|
-
"CHISQ.INV",
|
|
9816
|
-
"CHISQ.INV.RT",
|
|
9817
|
-
"CHISQ.TEST",
|
|
9818
|
-
"CHOOSECOLS",
|
|
9819
|
-
"CHOOSEROWS",
|
|
9820
|
-
"COMBINA",
|
|
9821
|
-
"CONCAT",
|
|
9822
|
-
"CONFIDENCE.NORM",
|
|
9823
|
-
"CONFIDENCE.T",
|
|
9824
|
-
"COT",
|
|
9825
|
-
"COTH",
|
|
9826
|
-
"COVARIANCE.P",
|
|
9827
|
-
"COVARIANCE.S",
|
|
9828
|
-
"CSC",
|
|
9829
|
-
"CSCH",
|
|
9830
|
-
"DAYS",
|
|
9831
|
-
"DECIMAL",
|
|
9832
|
-
"DROP",
|
|
9833
|
-
"ERF.PRECISE",
|
|
9834
|
-
"ERFC.PRECISE",
|
|
9835
|
-
"EXPAND",
|
|
9836
|
-
"EXPON.DIST",
|
|
9837
|
-
"F.DIST",
|
|
9838
|
-
"F.DIST.RT",
|
|
9839
|
-
"F.INV",
|
|
9840
|
-
"F.INV.RT",
|
|
9841
|
-
"F.TEST",
|
|
9842
|
-
"FIELDVALUE",
|
|
9843
|
-
"FILTERXML",
|
|
9844
|
-
"FLOOR.MATH",
|
|
9845
|
-
"FLOOR.PRECISE",
|
|
9846
|
-
"FORECAST.ETS",
|
|
9847
|
-
"FORECAST.ETS.CONFINT",
|
|
9848
|
-
"FORECAST.ETS.SEASONALITY",
|
|
9849
|
-
"FORECAST.ETS.STAT",
|
|
9850
|
-
"FORECAST.LINEAR",
|
|
9851
|
-
"FORMULATEXT",
|
|
9852
|
-
"GAMMA",
|
|
9853
|
-
"GAMMA.DIST",
|
|
9854
|
-
"GAMMA.INV",
|
|
9855
|
-
"GAMMALN.PRECISE",
|
|
9856
|
-
"GAUSS",
|
|
9857
|
-
"HSTACK",
|
|
9858
|
-
"HYPGEOM.DIST",
|
|
9859
|
-
"IFNA",
|
|
9860
|
-
"IFS",
|
|
9861
|
-
"IMCOSH",
|
|
9862
|
-
"IMCOT",
|
|
9863
|
-
"IMCSC",
|
|
9864
|
-
"IMCSCH",
|
|
9865
|
-
"IMSEC",
|
|
9866
|
-
"IMSECH",
|
|
9867
|
-
"IMSINH",
|
|
9868
|
-
"IMTAN",
|
|
9869
|
-
"ISFORMULA",
|
|
9870
|
-
"ISOMITTED",
|
|
9871
|
-
"ISOWEEKNUM",
|
|
9872
|
-
"LAMBDA",
|
|
9873
|
-
"LET",
|
|
9874
|
-
"LOGNORM.DIST",
|
|
9875
|
-
"LOGNORM.INV",
|
|
9876
|
-
"MAKEARRAY",
|
|
9877
|
-
"MAP",
|
|
9878
|
-
"MAXIFS",
|
|
9879
|
-
"MINIFS",
|
|
9880
|
-
"MODE.MULT",
|
|
9881
|
-
"MODE.SNGL",
|
|
9882
|
-
"MUNIT",
|
|
9883
|
-
"NEGBINOM.DIST",
|
|
9884
|
-
"NORM.DIST",
|
|
9885
|
-
"NORM.INV",
|
|
9886
|
-
"NORM.S.DIST",
|
|
9887
|
-
"NORM.S.INV",
|
|
9888
|
-
"NUMBERVALUE",
|
|
9889
|
-
"PDURATION",
|
|
9890
|
-
"PERCENTILE.EXC",
|
|
9891
|
-
"PERCENTILE.INC",
|
|
9892
|
-
"PERCENTRANK.EXC",
|
|
9893
|
-
"PERCENTRANK.INC",
|
|
9894
|
-
"PERMUTATIONA",
|
|
9895
|
-
"PHI",
|
|
9896
|
-
"POISSON.DIST",
|
|
9897
|
-
"PQSOURCE",
|
|
9898
|
-
"PYTHON_STR",
|
|
9899
|
-
"PYTHON_TYPE",
|
|
9900
|
-
"PYTHON_TYPENAME",
|
|
9901
|
-
"QUARTILE.EXC",
|
|
9902
|
-
"QUARTILE.INC",
|
|
9903
|
-
"QUERYSTRING",
|
|
9904
|
-
"RANDARRAY",
|
|
9905
|
-
"RANK.AVG",
|
|
9906
|
-
"RANK.EQ",
|
|
9907
|
-
"REDUCE",
|
|
9908
|
-
"RRI",
|
|
9909
|
-
"SCAN",
|
|
9910
|
-
"SEC",
|
|
9911
|
-
"SECH",
|
|
9912
|
-
"SEQUENCE",
|
|
9913
|
-
"SHEET",
|
|
9914
|
-
"SHEETS",
|
|
9915
|
-
"SKEW.P",
|
|
9916
|
-
"SORTBY",
|
|
9917
|
-
"STDEV.P",
|
|
9918
|
-
"STDEV.S",
|
|
9919
|
-
"SWITCH",
|
|
9920
|
-
"T.DIST",
|
|
9921
|
-
"T.DIST.2T",
|
|
9922
|
-
"T.DIST.RT",
|
|
9923
|
-
"T.INV",
|
|
9924
|
-
"T.INV.2T",
|
|
9925
|
-
"T.TEST",
|
|
9926
|
-
"TAKE",
|
|
9927
|
-
"TEXTAFTER",
|
|
9928
|
-
"TEXTBEFORE",
|
|
9929
|
-
"TEXTJOIN",
|
|
9930
|
-
"TEXTSPLIT",
|
|
9931
|
-
"TOCOL",
|
|
9932
|
-
"TOROW",
|
|
9933
|
-
"UNICHAR",
|
|
9934
|
-
"UNICODE",
|
|
9935
|
-
"UNIQUE",
|
|
9936
|
-
"VAR.P",
|
|
9937
|
-
"VAR.S",
|
|
9938
|
-
"VSTACK",
|
|
9939
|
-
"WEBSERVICE",
|
|
9940
|
-
"WEIBULL.DIST",
|
|
9941
|
-
"WRAPCOLS",
|
|
9942
|
-
"WRAPROWS",
|
|
9943
|
-
"XLOOKUP",
|
|
9944
|
-
"XOR",
|
|
9945
|
-
"Z.TEST"
|
|
9946
|
-
];
|
|
9947
|
-
const CONTENT_TYPES_FILE = "[Content_Types].xml";
|
|
9948
|
-
|
|
9949
9951
|
//#endregion
|
|
9950
9952
|
//#region src/helpers/figures/charts/chart_common.ts
|
|
9951
9953
|
const TREND_LINE_XAXIS_ID = "x1";
|
|
@@ -10211,10 +10213,10 @@ const chartShowValuesPlugin = {
|
|
|
10211
10213
|
drawLineOrBarOrRadarChartValues(chart, options, ctx);
|
|
10212
10214
|
break;
|
|
10213
10215
|
case "bar":
|
|
10214
|
-
options.horizontal ? drawHorizontalBarChartValues(chart, options, ctx) : drawLineOrBarOrRadarChartValues(chart, options, ctx);
|
|
10216
|
+
options.horizontal ? drawHorizontalBarChartValues(chart, options, ctx, { offsetFromAxisOrigin: true }) : drawLineOrBarOrRadarChartValues(chart, options, ctx);
|
|
10215
10217
|
break;
|
|
10216
10218
|
case "pyramid":
|
|
10217
|
-
drawHorizontalBarChartValues(chart, options, ctx);
|
|
10219
|
+
drawHorizontalBarChartValues(chart, options, ctx, { offsetFromAxisOrigin: true });
|
|
10218
10220
|
break;
|
|
10219
10221
|
case "calendar":
|
|
10220
10222
|
drawBarChartValues(chart, options, ctx);
|
|
@@ -10223,7 +10225,7 @@ const chartShowValuesPlugin = {
|
|
|
10223
10225
|
drawBubbleChartValues(chart, options, ctx);
|
|
10224
10226
|
break;
|
|
10225
10227
|
case "funnel":
|
|
10226
|
-
drawHorizontalBarChartValues(chart, options, ctx);
|
|
10228
|
+
drawHorizontalBarChartValues(chart, options, ctx, { offsetFromAxisOrigin: false });
|
|
10227
10229
|
break;
|
|
10228
10230
|
}
|
|
10229
10231
|
ctx.restore();
|
|
@@ -10247,7 +10249,7 @@ function drawLineOrBarOrRadarChartValues(chart, options, ctx) {
|
|
|
10247
10249
|
const point = dataset.data[i];
|
|
10248
10250
|
const xPosition = point.x;
|
|
10249
10251
|
let yPosition = 0;
|
|
10250
|
-
if (
|
|
10252
|
+
if (dataset.type === "line" || dataset.type === "radar") yPosition = value < 0 ? point.y + 10 : point.y - 10;
|
|
10251
10253
|
else if (chart.config.type === "bubble") yPosition = point.y;
|
|
10252
10254
|
else {
|
|
10253
10255
|
const yZeroLine = yAxisScale.getPixelForValue(0);
|
|
@@ -10298,23 +10300,33 @@ function drawBubbleChartValues(chart, options, ctx) {
|
|
|
10298
10300
|
const yMax = chart.chartArea.bottom;
|
|
10299
10301
|
const yMin = chart.chartArea.top;
|
|
10300
10302
|
const textsPositions = {};
|
|
10303
|
+
const canDrawTextInsideBubble = (chartElement, textSize) => {
|
|
10304
|
+
const radius = chartElement.options.radius ?? globalThis.Chart?.defaults.elements.point.radius ?? 3;
|
|
10305
|
+
return textSize.height < radius * 2;
|
|
10306
|
+
};
|
|
10301
10307
|
for (const dataset of chart._metasets) for (let i = 0; i < dataset._parsed.length; i++) {
|
|
10302
10308
|
const value = dataset._parsed[i].y;
|
|
10303
10309
|
if (isNaN(value)) continue;
|
|
10310
|
+
const valueToDisplay = options.callback(Number(value), dataset, i);
|
|
10304
10311
|
const point = dataset.data[i];
|
|
10305
10312
|
const xPosition = point.x;
|
|
10306
10313
|
let yPosition = Math.max(Math.min(point.y, yMax), yMin);
|
|
10314
|
+
const textSize = getTextDimensions(valueToDisplay, ctx);
|
|
10315
|
+
if (!canDrawTextInsideBubble(point, textSize)) yPosition = value < 0 ? point.y + 10 : point.y - 10;
|
|
10307
10316
|
if (!textsPositions[xPosition]) textsPositions[xPosition] = [];
|
|
10308
10317
|
for (const otherPosition of textsPositions[xPosition] || []) if (Math.abs(otherPosition - yPosition) < MINIMAL_VERTICAL_DISTANCE) yPosition = otherPosition + MINIMAL_VERTICAL_DISTANCE * (value < 0 ? 1 : -1);
|
|
10309
10318
|
textsPositions[xPosition].push(yPosition);
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10319
|
+
if (canDrawTextInsideBubble(point, textSize)) {
|
|
10320
|
+
ctx.strokeStyle = point.options.backgroundColor;
|
|
10321
|
+
ctx.fillStyle = options.background(Number(value), dataset, i) || "#ffffff";
|
|
10322
|
+
} else {
|
|
10323
|
+
ctx.strokeStyle = options.background(Number(value), dataset, i) || "#ffffff";
|
|
10324
|
+
ctx.fillStyle = point.options.backgroundColor;
|
|
10325
|
+
}
|
|
10326
|
+
drawTextWithBackground(valueToDisplay, xPosition, yPosition, ctx);
|
|
10315
10327
|
}
|
|
10316
10328
|
}
|
|
10317
|
-
function drawHorizontalBarChartValues(chart, options, ctx) {
|
|
10329
|
+
function drawHorizontalBarChartValues(chart, options, ctx, args) {
|
|
10318
10330
|
const textsPositions = {};
|
|
10319
10331
|
for (const dataset of chart._metasets) {
|
|
10320
10332
|
if (isTrendLineAxis(dataset.xAxisID) || isLineOverlayOnBarChart(options, dataset)) continue;
|
|
@@ -10329,7 +10341,7 @@ function drawHorizontalBarChartValues(chart, options, ctx) {
|
|
|
10329
10341
|
const distanceFromAxisOrigin = Math.abs(point.x - xZeroLine);
|
|
10330
10342
|
const PADDING = 3;
|
|
10331
10343
|
let xPosition;
|
|
10332
|
-
if (distanceFromAxisOrigin < textWidth) xPosition = value < 0 ? xZeroLine - textWidth / 2 - PADDING : xZeroLine + textWidth / 2 + PADDING;
|
|
10344
|
+
if (args.offsetFromAxisOrigin && distanceFromAxisOrigin < textWidth) xPosition = value < 0 ? xZeroLine - textWidth / 2 - PADDING : xZeroLine + textWidth / 2 + PADDING;
|
|
10333
10345
|
else xPosition = value < 0 ? point.x + point.width / 2 : point.x - point.width / 2;
|
|
10334
10346
|
if (!textsPositions[yPosition]) textsPositions[yPosition] = [];
|
|
10335
10347
|
for (const otherPosition of textsPositions[yPosition]) if (Math.abs(otherPosition - xPosition) < textWidth) xPosition = value < 0 ? otherPosition - textWidth - PADDING : otherPosition + textWidth + PADDING;
|
|
@@ -10364,6 +10376,9 @@ function drawPieChartValues(chart, options, ctx) {
|
|
|
10364
10376
|
drawTextWithBackground(displayValue, x, y, ctx);
|
|
10365
10377
|
}
|
|
10366
10378
|
}
|
|
10379
|
+
function getTextDimensions(text, ctx) {
|
|
10380
|
+
return computeCachedTextDimension(ctx, text, computeTextFont({ fontSize: globalThis.Chart?.defaults.font.size ?? 12 }, "px"));
|
|
10381
|
+
}
|
|
10367
10382
|
|
|
10368
10383
|
//#endregion
|
|
10369
10384
|
//#region src/types/chart/tree_map_chart.ts
|
|
@@ -15837,7 +15852,7 @@ const RemoveDuplicateTerms = { Errors: {
|
|
|
15837
15852
|
["MoreThanOneRangeSelected"]: _t("Please select only one range of cells"),
|
|
15838
15853
|
["EmptySelectedRange"]: _t("Please select a range of cells containing values."),
|
|
15839
15854
|
["NoColumnsProvided"]: _t("Please select at latest one column to analyze."),
|
|
15840
|
-
["WillRemoveExistingMerge"]: _t("
|
|
15855
|
+
["WillRemoveExistingMerge"]: _t("Cannot perform this action on merged cells. Unmerge the cells and try again.")
|
|
15841
15856
|
} };
|
|
15842
15857
|
const DVTerms = {
|
|
15843
15858
|
DateIs: {
|
|
@@ -30169,433 +30184,6 @@ var ChartRangeDataSourceComponent = class extends Component {
|
|
|
30169
30184
|
}
|
|
30170
30185
|
};
|
|
30171
30186
|
|
|
30172
|
-
//#endregion
|
|
30173
|
-
//#region src/helpers/figures/chart.ts
|
|
30174
|
-
var SpreadsheetChart = class SpreadsheetChart {
|
|
30175
|
-
getters;
|
|
30176
|
-
sheetId;
|
|
30177
|
-
definition;
|
|
30178
|
-
chartTypeBuilder;
|
|
30179
|
-
dataSourceBuilder;
|
|
30180
|
-
dataSource;
|
|
30181
|
-
constructor(getters, sheetId, definition, chartTypeBuilder, dataSourceBuilder) {
|
|
30182
|
-
this.getters = getters;
|
|
30183
|
-
this.sheetId = sheetId;
|
|
30184
|
-
this.definition = definition;
|
|
30185
|
-
this.chartTypeBuilder = chartTypeBuilder;
|
|
30186
|
-
this.dataSourceBuilder = dataSourceBuilder;
|
|
30187
|
-
this.dataSource = definition.dataSource;
|
|
30188
|
-
}
|
|
30189
|
-
static fromStrDefinition(getters, sheetId, definition) {
|
|
30190
|
-
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
30191
|
-
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
30192
|
-
const dataSource = dataSourceBuilder.fromExternalDefinition(definition.dataSource ?? { type: "none" }, sheetId, getters);
|
|
30193
|
-
const rangeDefinition = {
|
|
30194
|
-
...chartTypeBuilder.fromStrDefinition(definition, sheetId, getters),
|
|
30195
|
-
dataSource
|
|
30196
|
-
};
|
|
30197
|
-
return new SpreadsheetChart(getters, sheetId, SpreadsheetChart.deleteInvalidKeys(rangeDefinition), chartTypeBuilder, dataSourceBuilder);
|
|
30198
|
-
}
|
|
30199
|
-
static fromDefinition(getters, sheetId, definition) {
|
|
30200
|
-
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
30201
|
-
return new SpreadsheetChart(getters, sheetId, definition, chartTypeRegistry.get(definition.type), dataSourceBuilder);
|
|
30202
|
-
}
|
|
30203
|
-
static validate(validator, definition) {
|
|
30204
|
-
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
30205
|
-
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
30206
|
-
return validator.batchValidations(() => chartTypeBuilder.validateDefinition(validator, definition), () => dataSourceBuilder.validate(definition.dataSource ?? { type: "none" }, validator))(void 0);
|
|
30207
|
-
}
|
|
30208
|
-
static transformDefinition(chartSheetId, definition, rangeAdapters) {
|
|
30209
|
-
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
30210
|
-
if (!definition.dataSource) return chartTypeBuilder.transformDefinition(definition, chartSheetId, rangeAdapters);
|
|
30211
|
-
const newDataSource = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none").transform(definition.dataSource, chartSheetId, rangeAdapters);
|
|
30212
|
-
return {
|
|
30213
|
-
...chartTypeBuilder.transformDefinition(definition, chartSheetId, rangeAdapters),
|
|
30214
|
-
dataSource: newDataSource
|
|
30215
|
-
};
|
|
30216
|
-
}
|
|
30217
|
-
getRangeDefinition() {
|
|
30218
|
-
return {
|
|
30219
|
-
...this.definition,
|
|
30220
|
-
dataSource: this.dataSource
|
|
30221
|
-
};
|
|
30222
|
-
}
|
|
30223
|
-
getDefinition() {
|
|
30224
|
-
return {
|
|
30225
|
-
...this.chartTypeBuilder.toStrDefinition(this.definition, this.sheetId, this.getters),
|
|
30226
|
-
dataSource: this.dataSource && this.dataSourceBuilder.getDefinition(this.dataSource, this.sheetId, this.getters)
|
|
30227
|
-
};
|
|
30228
|
-
}
|
|
30229
|
-
updateRanges(rangeAdapters) {
|
|
30230
|
-
return {
|
|
30231
|
-
...this.chartTypeBuilder.updateRanges(this.definition, rangeAdapters, this.sheetId),
|
|
30232
|
-
dataSource: this.dataSource && this.dataSourceBuilder.adaptRanges(this.dataSource, rangeAdapters)
|
|
30233
|
-
};
|
|
30234
|
-
}
|
|
30235
|
-
duplicateInDuplicatedSheet(sheetIdFrom, sheetIdTo) {
|
|
30236
|
-
const newDataSource = this.dataSource && this.dataSourceBuilder.duplicateInDuplicatedSheet(this.dataSource, sheetIdFrom, sheetIdTo, this.getters);
|
|
30237
|
-
const definition = {
|
|
30238
|
-
...this.chartTypeBuilder.duplicateInDuplicatedSheet(this.definition, sheetIdFrom, sheetIdTo, this.getters),
|
|
30239
|
-
dataSource: newDataSource
|
|
30240
|
-
};
|
|
30241
|
-
return SpreadsheetChart.fromDefinition(this.getters, sheetIdTo, definition).getDefinition();
|
|
30242
|
-
}
|
|
30243
|
-
copyInSheetId(sheetIdTo) {
|
|
30244
|
-
return {
|
|
30245
|
-
...this.chartTypeBuilder.copyInSheetId(this.definition, this.sheetId, sheetIdTo, this.getters),
|
|
30246
|
-
dataSource: this.dataSource
|
|
30247
|
-
};
|
|
30248
|
-
}
|
|
30249
|
-
getContextCreation() {
|
|
30250
|
-
const definition = this.getDefinition();
|
|
30251
|
-
return {
|
|
30252
|
-
...this.dataSourceBuilder.getContextCreation(definition.dataSource ?? { type: "none" }),
|
|
30253
|
-
...this.chartTypeBuilder.getContextCreation(definition, this.dataSourceBuilder, definition.dataSource)
|
|
30254
|
-
};
|
|
30255
|
-
}
|
|
30256
|
-
getDefinitionForExcel(getters) {
|
|
30257
|
-
const definition = this.definition;
|
|
30258
|
-
const excelDataSets = this.dataSourceBuilder.toExcelDataSets(this.dataSource, "dataSetStyles" in definition ? definition.dataSetStyles : {}, getters);
|
|
30259
|
-
if (excelDataSets === void 0) return;
|
|
30260
|
-
return this.chartTypeBuilder.getDefinitionForExcel(getters, definition, excelDataSets);
|
|
30261
|
-
}
|
|
30262
|
-
getData(getters, chartId) {
|
|
30263
|
-
const dataSource = this.dataSource;
|
|
30264
|
-
return dataSource ? this.dataSourceBuilder.extractData(dataSource, chartId, getters) : {
|
|
30265
|
-
dataSetsValues: [],
|
|
30266
|
-
labelValues: []
|
|
30267
|
-
};
|
|
30268
|
-
}
|
|
30269
|
-
getRuntime(getters, chartId) {
|
|
30270
|
-
const dataSource = this.dataSource;
|
|
30271
|
-
const dataExtractors = dataSource ? {
|
|
30272
|
-
extractData: () => this.dataSourceBuilder.extractData(dataSource, chartId, getters),
|
|
30273
|
-
extractHierarchicalData: () => this.dataSourceBuilder.extractHierarchicalData(dataSource, chartId, getters)
|
|
30274
|
-
} : {
|
|
30275
|
-
extractData: () => ({
|
|
30276
|
-
dataSetsValues: [],
|
|
30277
|
-
labelValues: []
|
|
30278
|
-
}),
|
|
30279
|
-
extractHierarchicalData: () => ({
|
|
30280
|
-
dataSetsValues: [],
|
|
30281
|
-
labelValues: []
|
|
30282
|
-
})
|
|
30283
|
-
};
|
|
30284
|
-
return this.chartTypeBuilder.getRuntime(getters, this.definition, dataExtractors, this.sheetId, {
|
|
30285
|
-
onClick: (event, items, chartJsChart) => {
|
|
30286
|
-
return this.dataSourceBuilder.onDataSetClick?.(this.definition.type, chartId, event, items, chartJsChart, getters);
|
|
30287
|
-
},
|
|
30288
|
-
onHover: (event, items, chartJsChart) => this.dataSourceBuilder.onDataSetHover?.(this.definition.type, chartId, event, items, chartJsChart)
|
|
30289
|
-
});
|
|
30290
|
-
}
|
|
30291
|
-
static deleteInvalidKeys(definition) {
|
|
30292
|
-
definition = { ...definition };
|
|
30293
|
-
const keys = new Set(chartTypeRegistry.get(definition.type).allowedDefinitionKeys);
|
|
30294
|
-
for (const key of Object.keys(definition)) if (!keys.has(key)) delete definition[key];
|
|
30295
|
-
return definition;
|
|
30296
|
-
}
|
|
30297
|
-
};
|
|
30298
|
-
|
|
30299
|
-
//#endregion
|
|
30300
|
-
//#region src/helpers/figures/charts/chart_data_sources.ts
|
|
30301
|
-
const EMPTY = Object.freeze({ value: null });
|
|
30302
|
-
const ONE = Object.freeze({ value: 1 });
|
|
30303
|
-
const ChartRangeDataSourceHandler = {
|
|
30304
|
-
supportedChartTypes: CHART_TYPES,
|
|
30305
|
-
fromExternalDefinition(dataSource, defaultSheetId, getters) {
|
|
30306
|
-
const dataSets = createDataSets(getters, defaultSheetId, dataSource);
|
|
30307
|
-
const labelRange = createValidRange(getters, defaultSheetId, dataSource.labelRange);
|
|
30308
|
-
return {
|
|
30309
|
-
...dataSource,
|
|
30310
|
-
dataSets,
|
|
30311
|
-
labelRange
|
|
30312
|
-
};
|
|
30313
|
-
},
|
|
30314
|
-
fromContextCreation(context) {
|
|
30315
|
-
return {
|
|
30316
|
-
type: "range",
|
|
30317
|
-
dataSets: [],
|
|
30318
|
-
dataSetsHaveTitle: false,
|
|
30319
|
-
labelRange: context.auxiliaryRange,
|
|
30320
|
-
...context.dataSource
|
|
30321
|
-
};
|
|
30322
|
-
},
|
|
30323
|
-
fromHierarchicalContextCreation(context) {
|
|
30324
|
-
if (context.dataSource?.type !== "range" || context.hierarchicalDataSource !== void 0 && context.hierarchicalDataSource.type !== "range") return {
|
|
30325
|
-
type: "range",
|
|
30326
|
-
dataSets: [],
|
|
30327
|
-
dataSetsHaveTitle: false
|
|
30328
|
-
};
|
|
30329
|
-
let dataSource = {
|
|
30330
|
-
type: "range",
|
|
30331
|
-
dataSets: [],
|
|
30332
|
-
dataSetsHaveTitle: context.dataSource?.dataSetsHaveTitle ?? false,
|
|
30333
|
-
labelRange: context.dataSource?.dataSets?.[0]?.dataRange
|
|
30334
|
-
};
|
|
30335
|
-
if (context.hierarchicalDataSource?.dataSets.length) dataSource = context.hierarchicalDataSource;
|
|
30336
|
-
else if (context.auxiliaryRange) dataSource = {
|
|
30337
|
-
...dataSource,
|
|
30338
|
-
dataSets: [{
|
|
30339
|
-
dataRange: context.auxiliaryRange,
|
|
30340
|
-
dataSetId: "0"
|
|
30341
|
-
}]
|
|
30342
|
-
};
|
|
30343
|
-
return dataSource;
|
|
30344
|
-
},
|
|
30345
|
-
validate: (dataSource, validator) => validator.checkValidations(dataSource, checkDataset, checkLabelRange),
|
|
30346
|
-
transform(dataSource, defaultSheetId, { adaptRangeString }) {
|
|
30347
|
-
let labelRange;
|
|
30348
|
-
if (dataSource.labelRange) {
|
|
30349
|
-
const { changeType, range: adaptedRange } = adaptRangeString(defaultSheetId, dataSource.labelRange);
|
|
30350
|
-
if (changeType !== "REMOVE") labelRange = adaptedRange;
|
|
30351
|
-
}
|
|
30352
|
-
const dataSets = [];
|
|
30353
|
-
for (const dataSet of dataSource.dataSets) {
|
|
30354
|
-
const newDataSet = { ...dataSet };
|
|
30355
|
-
const { changeType, range: adaptedRange } = adaptRangeString(defaultSheetId, dataSet.dataRange);
|
|
30356
|
-
if (changeType !== "REMOVE") {
|
|
30357
|
-
newDataSet.dataRange = adaptedRange;
|
|
30358
|
-
dataSets.push(newDataSet);
|
|
30359
|
-
}
|
|
30360
|
-
}
|
|
30361
|
-
return {
|
|
30362
|
-
...dataSource,
|
|
30363
|
-
dataSets,
|
|
30364
|
-
labelRange
|
|
30365
|
-
};
|
|
30366
|
-
},
|
|
30367
|
-
extractData: (dataSource, chartId, getters) => getChartData(getters, dataSource),
|
|
30368
|
-
extractHierarchicalData(dataSource, chartId, getters) {
|
|
30369
|
-
const dataSets = dataSource.dataSets;
|
|
30370
|
-
const labelRange = dataSource.labelRange;
|
|
30371
|
-
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
30372
|
-
const dataSetsValues = getHierarchicalDatasetValues(getters, dataSets);
|
|
30373
|
-
const data = {
|
|
30374
|
-
labelValues,
|
|
30375
|
-
dataSetsValues
|
|
30376
|
-
};
|
|
30377
|
-
if (shouldRemoveFirstLabel(labelValues.length, dataSetsValues[0]?.data.length + (dataSetsValues[0]?.label !== void 0 ? 1 : 0), dataSource.dataSetsHaveTitle || false)) labelValues.shift();
|
|
30378
|
-
return data;
|
|
30379
|
-
},
|
|
30380
|
-
adaptRanges(dataSource, { applyChange }) {
|
|
30381
|
-
const dataSetsWithUndefined = dataSource.dataSets.map((ds) => {
|
|
30382
|
-
const { range: adaptedRangeStr, changeType } = applyChange(ds.dataRange);
|
|
30383
|
-
if (changeType === "REMOVE") return;
|
|
30384
|
-
let labelCell = void 0;
|
|
30385
|
-
if (ds.labelCell) {
|
|
30386
|
-
const { range: adaptedLabelCellRange, changeType: labelCellChangeType } = applyChange(ds.labelCell);
|
|
30387
|
-
if (labelCellChangeType !== "REMOVE") labelCell = adaptedLabelCellRange;
|
|
30388
|
-
}
|
|
30389
|
-
return {
|
|
30390
|
-
...ds,
|
|
30391
|
-
dataRange: adaptedRangeStr,
|
|
30392
|
-
labelCell
|
|
30393
|
-
};
|
|
30394
|
-
}).filter(isDefined);
|
|
30395
|
-
let labelRange = dataSource.labelRange;
|
|
30396
|
-
if (labelRange) {
|
|
30397
|
-
const { range: adaptedLabelRange, changeType } = applyChange(labelRange);
|
|
30398
|
-
if (changeType === "REMOVE") labelRange = void 0;
|
|
30399
|
-
else labelRange = adaptedLabelRange;
|
|
30400
|
-
}
|
|
30401
|
-
const dataSets = dataSetsWithUndefined;
|
|
30402
|
-
return {
|
|
30403
|
-
...dataSource,
|
|
30404
|
-
dataSets,
|
|
30405
|
-
labelRange: labelRange?.invalidSheetName || labelRange?.invalidXc ? void 0 : labelRange
|
|
30406
|
-
};
|
|
30407
|
-
},
|
|
30408
|
-
getDefinition(dataSource, defaultSheetId, getters) {
|
|
30409
|
-
return {
|
|
30410
|
-
labelRange: dataSource.labelRange ? getters.getRangeString(dataSource.labelRange, defaultSheetId) : void 0,
|
|
30411
|
-
type: "range",
|
|
30412
|
-
dataSets: dataSource.dataSets.map((dataSet) => ({
|
|
30413
|
-
dataSetId: dataSet.dataSetId,
|
|
30414
|
-
dataRange: getters.getRangeString(dataSet.dataRange, defaultSheetId)
|
|
30415
|
-
})),
|
|
30416
|
-
dataSetsHaveTitle: dataSource.dataSetsHaveTitle
|
|
30417
|
-
};
|
|
30418
|
-
},
|
|
30419
|
-
/**
|
|
30420
|
-
* Duplicate the dataSets. All ranges on sheetIdFrom are adapted to target
|
|
30421
|
-
* sheetIdTo.
|
|
30422
|
-
*/
|
|
30423
|
-
duplicateInDuplicatedSheet(dataSource, sheetIdFrom, sheetIdTo, getters) {
|
|
30424
|
-
return {
|
|
30425
|
-
...dataSource,
|
|
30426
|
-
labelRange: duplicateLabelRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, dataSource.labelRange),
|
|
30427
|
-
dataSets: dataSource.dataSets.map((ds) => ({
|
|
30428
|
-
...ds,
|
|
30429
|
-
dataRange: duplicateRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, ds.dataRange)
|
|
30430
|
-
}))
|
|
30431
|
-
};
|
|
30432
|
-
},
|
|
30433
|
-
getContextCreation: (dataSource) => ({
|
|
30434
|
-
auxiliaryRange: dataSource.labelRange,
|
|
30435
|
-
dataSource
|
|
30436
|
-
}),
|
|
30437
|
-
getHierarchicalContextCreation(dataSource) {
|
|
30438
|
-
const leafRange = dataSource.dataSets.at(-1)?.dataRange;
|
|
30439
|
-
const dataSetsHaveTitle = dataSource.dataSetsHaveTitle;
|
|
30440
|
-
return {
|
|
30441
|
-
auxiliaryRange: leafRange,
|
|
30442
|
-
hierarchicalDataSource: dataSource,
|
|
30443
|
-
dataSource: dataSource.labelRange ? {
|
|
30444
|
-
type: "range",
|
|
30445
|
-
dataSets: [{
|
|
30446
|
-
dataRange: dataSource.labelRange,
|
|
30447
|
-
dataSetId: "0"
|
|
30448
|
-
}],
|
|
30449
|
-
dataSetsHaveTitle
|
|
30450
|
-
} : {
|
|
30451
|
-
type: "range",
|
|
30452
|
-
dataSets: [],
|
|
30453
|
-
dataSetsHaveTitle
|
|
30454
|
-
}
|
|
30455
|
-
};
|
|
30456
|
-
},
|
|
30457
|
-
toExcelDataSets(dataSource, dataSetStyles, getters) {
|
|
30458
|
-
const dataSets = dataSource.dataSets;
|
|
30459
|
-
const labelRange = dataSource.labelRange;
|
|
30460
|
-
const excelDataSets = dataSets.map((ds) => toExcelDataset(getters, dataSetStyles, ds)).filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
|
|
30461
|
-
const datasetLength = dataSets[0] ? getZoneArea(dataSets[0].dataRange.zone) : void 0;
|
|
30462
|
-
return {
|
|
30463
|
-
dataSets: excelDataSets,
|
|
30464
|
-
labelRange: toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel(labelRange ? getZoneArea(labelRange.zone) : 0, datasetLength, dataSource.dataSetsHaveTitle))
|
|
30465
|
-
};
|
|
30466
|
-
}
|
|
30467
|
-
};
|
|
30468
|
-
function getChartData(getters, dataSource) {
|
|
30469
|
-
const dataSets = dataSource.dataSets;
|
|
30470
|
-
const labelRange = dataSource.labelRange;
|
|
30471
|
-
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
30472
|
-
const dataSetsValues = getChartDatasetValues(getters, dataSets);
|
|
30473
|
-
const data = {
|
|
30474
|
-
labelValues,
|
|
30475
|
-
dataSetsValues
|
|
30476
|
-
};
|
|
30477
|
-
const numberOfDataPoints = dataSetsValues.length ? dataSetsValues[0]?.data.length + (dataSetsValues[0]?.label !== void 0 ? 1 : 0) : 0;
|
|
30478
|
-
if (shouldRemoveFirstLabel(labelValues.length, numberOfDataPoints, dataSource.dataSetsHaveTitle || false)) labelValues.shift();
|
|
30479
|
-
return data;
|
|
30480
|
-
}
|
|
30481
|
-
function getChartDatasetValues(getters, dataSets) {
|
|
30482
|
-
const datasetValues = [];
|
|
30483
|
-
for (const [dsIndex, ds] of Object.entries(dataSets)) {
|
|
30484
|
-
let label = `${ChartTerms.Series} ${parseInt(dsIndex) + 1}`;
|
|
30485
|
-
let hidden = getters.isColHidden(ds.dataRange.sheetId, ds.dataRange.zone.left);
|
|
30486
|
-
if (ds.labelCell) {
|
|
30487
|
-
const { sheetId, zone } = ds.labelCell;
|
|
30488
|
-
const cell = getters.getEvaluatedCell({
|
|
30489
|
-
sheetId,
|
|
30490
|
-
col: zone.left,
|
|
30491
|
-
row: zone.top
|
|
30492
|
-
});
|
|
30493
|
-
if (cell) label = cell.formattedValue;
|
|
30494
|
-
}
|
|
30495
|
-
let data = ds.dataRange ? getData(getters, ds) : [];
|
|
30496
|
-
if (data.every((cell) => !cell.value || isTextResult(cell)) && data.filter(isTextResult).length > 1) data = data.map((cell) => cell.value && !isErrorResult(cell) ? ONE : EMPTY);
|
|
30497
|
-
else if (data.every((cell) => !isNumberResult(cell))) hidden = true;
|
|
30498
|
-
datasetValues.push({
|
|
30499
|
-
data,
|
|
30500
|
-
label,
|
|
30501
|
-
hidden,
|
|
30502
|
-
dataSetId: ds.dataSetId
|
|
30503
|
-
});
|
|
30504
|
-
}
|
|
30505
|
-
return datasetValues;
|
|
30506
|
-
}
|
|
30507
|
-
function getChartLabelValues(getters, dataSets, labelRange) {
|
|
30508
|
-
if (labelRange) {
|
|
30509
|
-
const { left } = labelRange.zone;
|
|
30510
|
-
if (!labelRange.invalidXc && !labelRange.invalidSheetName && !getters.isColHidden(labelRange.sheetId, left)) return getters.getVisibleRangeValues(labelRange);
|
|
30511
|
-
}
|
|
30512
|
-
if (dataSets[0]) {
|
|
30513
|
-
const dataLength = getData(getters, dataSets[0]).length;
|
|
30514
|
-
return Array.from({ length: dataLength }, () => ({ value: "" }));
|
|
30515
|
-
}
|
|
30516
|
-
return [];
|
|
30517
|
-
}
|
|
30518
|
-
/**
|
|
30519
|
-
* Get the values for a hierarchical dataset. The values can be defined in a tree-like structure
|
|
30520
|
-
* in the sheet, and this function will fill up the blanks.
|
|
30521
|
-
*
|
|
30522
|
-
* @example the following dataset:
|
|
30523
|
-
*
|
|
30524
|
-
* 2024 Q1 W1 100
|
|
30525
|
-
* W2 200
|
|
30526
|
-
*
|
|
30527
|
-
* will have the same value as the dataset:
|
|
30528
|
-
* 2024 Q1 W1 100
|
|
30529
|
-
* 2024 Q1 W2 200
|
|
30530
|
-
*/
|
|
30531
|
-
function getHierarchicalDatasetValues(getters, dataSets) {
|
|
30532
|
-
dataSets = dataSets.filter((ds) => !getters.isColHidden(ds.dataRange.sheetId, ds.dataRange.zone.left));
|
|
30533
|
-
const datasetValues = dataSets.map((ds) => ({
|
|
30534
|
-
data: [],
|
|
30535
|
-
label: "",
|
|
30536
|
-
dataSetId: ds.dataSetId
|
|
30537
|
-
}));
|
|
30538
|
-
const locale = getters.getLocale();
|
|
30539
|
-
const dataSetsData = dataSets.map((ds) => getData(getters, ds)).map((values) => values.map(({ value, format }) => value === null ? EMPTY : { value: formatValue(value, {
|
|
30540
|
-
format,
|
|
30541
|
-
locale
|
|
30542
|
-
}) }));
|
|
30543
|
-
if (!dataSetsData.length) return datasetValues;
|
|
30544
|
-
const minLength = Math.min(...dataSetsData.map((ds) => ds.length));
|
|
30545
|
-
let currentValues = [];
|
|
30546
|
-
const leafDatasetIndex = dataSets.length - 1;
|
|
30547
|
-
for (let i = 0; i < minLength; i++) for (let dsIndex = 0; dsIndex < dataSetsData.length; dsIndex++) {
|
|
30548
|
-
let cell = dataSetsData[dsIndex][i];
|
|
30549
|
-
if ((cell === void 0 || cell.value === null) && dsIndex !== leafDatasetIndex) cell = currentValues[dsIndex];
|
|
30550
|
-
if (cell?.value !== currentValues[dsIndex]?.value) {
|
|
30551
|
-
currentValues = currentValues.slice(0, dsIndex);
|
|
30552
|
-
currentValues[dsIndex] = cell;
|
|
30553
|
-
}
|
|
30554
|
-
datasetValues[dsIndex].data.push(cell ?? EMPTY);
|
|
30555
|
-
}
|
|
30556
|
-
return datasetValues.filter((ds) => ds.data.some((d) => d.value !== null));
|
|
30557
|
-
}
|
|
30558
|
-
/**
|
|
30559
|
-
* Get the data from a dataSet
|
|
30560
|
-
*/
|
|
30561
|
-
function getData(getters, ds) {
|
|
30562
|
-
if (ds.dataRange) {
|
|
30563
|
-
const labelCellZone = ds.labelCell ? [ds.labelCell.zone] : [];
|
|
30564
|
-
const dataZone = recomputeZones([ds.dataRange.zone], labelCellZone)[0];
|
|
30565
|
-
if (dataZone === void 0) return [];
|
|
30566
|
-
const dataRange = getters.getRangeFromZone(ds.dataRange.sheetId, dataZone);
|
|
30567
|
-
return getters.getVisibleRangeValues(dataRange).map((cell) => cell.value === "" ? EMPTY : cell);
|
|
30568
|
-
}
|
|
30569
|
-
return [];
|
|
30570
|
-
}
|
|
30571
|
-
const ChartNeverDataSourceHandler = {
|
|
30572
|
-
supportedChartTypes: [],
|
|
30573
|
-
fromExternalDefinition: () => ({ type: "none" }),
|
|
30574
|
-
fromContextCreation: () => ({ type: "none" }),
|
|
30575
|
-
fromHierarchicalContextCreation: () => ({ type: "none" }),
|
|
30576
|
-
validate: () => "Success",
|
|
30577
|
-
transform: () => ({ type: "none" }),
|
|
30578
|
-
extractData: () => ({
|
|
30579
|
-
dataSetsValues: [],
|
|
30580
|
-
labelValues: []
|
|
30581
|
-
}),
|
|
30582
|
-
extractHierarchicalData: () => ({
|
|
30583
|
-
dataSetsValues: [],
|
|
30584
|
-
labelValues: []
|
|
30585
|
-
}),
|
|
30586
|
-
adaptRanges: (dataSource) => dataSource,
|
|
30587
|
-
getDefinition: (dataSource) => dataSource,
|
|
30588
|
-
duplicateInDuplicatedSheet: (dataSource) => dataSource,
|
|
30589
|
-
getContextCreation: () => ({}),
|
|
30590
|
-
getHierarchicalContextCreation: () => ({}),
|
|
30591
|
-
toExcelDataSets: () => ({
|
|
30592
|
-
dataSets: [],
|
|
30593
|
-
labelRange: void 0
|
|
30594
|
-
})
|
|
30595
|
-
};
|
|
30596
|
-
chartDataSourceRegistry.add("range", ChartRangeDataSourceHandler);
|
|
30597
|
-
chartDataSourceRegistry.add("none", ChartNeverDataSourceHandler);
|
|
30598
|
-
|
|
30599
30187
|
//#endregion
|
|
30600
30188
|
//#region src/types/chart/calendar_chart.ts
|
|
30601
30189
|
const CALENDAR_CHART_GRANULARITIES = [
|
|
@@ -30622,41 +30210,6 @@ var CalendarChartConfigPanel = class extends GenericChartConfigPanel {
|
|
|
30622
30210
|
value,
|
|
30623
30211
|
label: ALL_PERIODS[value]
|
|
30624
30212
|
}));
|
|
30625
|
-
getGroupByOptions() {
|
|
30626
|
-
const sheetId = this.env.model.getters.getFigureSheetId(this.env.model.getters.getFigureIdFromChartId(this.props.chartId));
|
|
30627
|
-
const definition = SpreadsheetChart.fromStrDefinition(this.env.model.getters, sheetId, this.props.definition).getRangeDefinition();
|
|
30628
|
-
const labels = getBarChartData(definition, getChartData(this.env.model.getters, definition.dataSource), this.env.model.getters).labels.filter((l) => isDateTime(l, DEFAULT_LOCALE));
|
|
30629
|
-
if (labels.length === 0) return [];
|
|
30630
|
-
const dates = labels.map((label) => toJsDate(label, this.env.model.getters.getLocale()));
|
|
30631
|
-
const uniqueYears = /* @__PURE__ */ new Set();
|
|
30632
|
-
const uniqueMonths = /* @__PURE__ */ new Set();
|
|
30633
|
-
const uniqueDays = /* @__PURE__ */ new Set();
|
|
30634
|
-
const uniqueHours = /* @__PURE__ */ new Set();
|
|
30635
|
-
const uniqueMinutes = /* @__PURE__ */ new Set();
|
|
30636
|
-
const uniqueSeconds = /* @__PURE__ */ new Set();
|
|
30637
|
-
for (const date of dates) {
|
|
30638
|
-
uniqueYears.add(date.getFullYear());
|
|
30639
|
-
uniqueMonths.add(date.getMonth());
|
|
30640
|
-
uniqueDays.add(date.getDate());
|
|
30641
|
-
uniqueHours.add(date.getHours());
|
|
30642
|
-
uniqueMinutes.add(date.getMinutes());
|
|
30643
|
-
uniqueSeconds.add(date.getSeconds());
|
|
30644
|
-
}
|
|
30645
|
-
return this.groupByChoices.filter((groupBy) => {
|
|
30646
|
-
switch (groupBy.value) {
|
|
30647
|
-
case "year": return uniqueYears.size > 1;
|
|
30648
|
-
case "quarter_number":
|
|
30649
|
-
case "month_number": return uniqueMonths.size > 1;
|
|
30650
|
-
case "iso_week_number":
|
|
30651
|
-
case "day_of_month":
|
|
30652
|
-
case "day_of_week": return uniqueDays.size > 1;
|
|
30653
|
-
case "hour_number": return uniqueHours.size > 1;
|
|
30654
|
-
case "minute_number": return uniqueMinutes.size > 1;
|
|
30655
|
-
case "second_number": return uniqueSeconds.size > 1;
|
|
30656
|
-
default: return false;
|
|
30657
|
-
}
|
|
30658
|
-
});
|
|
30659
|
-
}
|
|
30660
30213
|
getGroupByType(currentAxis) {
|
|
30661
30214
|
return (currentAxis === "horizontal" ? this.props.definition.horizontalGroupBy : this.props.definition.verticalGroupBy) || "year";
|
|
30662
30215
|
}
|
|
@@ -31229,7 +30782,7 @@ var SpeechBubble = class extends Component {
|
|
|
31229
30782
|
spreadsheetRect = useSpreadsheetRect();
|
|
31230
30783
|
bubbleRef = signal(null);
|
|
31231
30784
|
setup() {
|
|
31232
|
-
|
|
30785
|
+
useLayoutEffect(() => {
|
|
31233
30786
|
const el = this.bubbleRef();
|
|
31234
30787
|
if (!el) return;
|
|
31235
30788
|
const anchorRect = this.props.anchorRect;
|
|
@@ -31290,9 +30843,10 @@ var Composer = class extends Component {
|
|
|
31290
30843
|
compositionActive = false;
|
|
31291
30844
|
spreadsheetRect = useSpreadsheetRect();
|
|
31292
30845
|
lastHoveredTokenIndex = void 0;
|
|
31293
|
-
debouncedHover = debounce((tokenIndex, hoveredRect) => {
|
|
30846
|
+
debouncedHover = debounce((tokenIndex, composerContent, hoveredRect) => {
|
|
31294
30847
|
const selection = this.contentHelper.getCurrentSelection();
|
|
31295
|
-
|
|
30848
|
+
const currentContent = this.props.composerStore.currentContent;
|
|
30849
|
+
if (selection.start !== selection.end || currentContent !== composerContent) return;
|
|
31296
30850
|
const currentHoveredContext = this.props.composerStore.hoveredTokens;
|
|
31297
30851
|
this.props.composerStore.hoverToken(tokenIndex);
|
|
31298
30852
|
if (!deepEquals(currentHoveredContext, this.props.composerStore.hoveredTokens)) this.composerState.hoveredRect = hoveredRect;
|
|
@@ -31612,7 +31166,8 @@ var Composer = class extends Component {
|
|
|
31612
31166
|
onTokenHover(tokenIndex, hoveredRect) {
|
|
31613
31167
|
if (this.lastHoveredTokenIndex !== tokenIndex) {
|
|
31614
31168
|
this.lastHoveredTokenIndex = tokenIndex;
|
|
31615
|
-
this.
|
|
31169
|
+
const composerContent = this.props.composerStore.currentContent;
|
|
31170
|
+
this.debouncedHover(tokenIndex, composerContent, hoveredRect);
|
|
31616
31171
|
}
|
|
31617
31172
|
}
|
|
31618
31173
|
/**
|
|
@@ -32641,7 +32196,7 @@ var AbstractComposerStore = class extends SpreadsheetStore {
|
|
|
32641
32196
|
col: range.zone.left,
|
|
32642
32197
|
row: range.zone.top
|
|
32643
32198
|
});
|
|
32644
|
-
if (spreadZone) return this.getters.getRangeFromZone(sheetId, spreadZone);
|
|
32199
|
+
if (spreadZone) return this.getters.getRangeFromZone(range.sheetId, spreadZone);
|
|
32645
32200
|
return range;
|
|
32646
32201
|
}
|
|
32647
32202
|
updateAutoCompleteProvider() {
|
|
@@ -33854,6 +33409,133 @@ var ChartTypePicker = class extends Component {
|
|
|
33854
33409
|
}
|
|
33855
33410
|
};
|
|
33856
33411
|
|
|
33412
|
+
//#endregion
|
|
33413
|
+
//#region src/helpers/figures/chart.ts
|
|
33414
|
+
var SpreadsheetChart = class SpreadsheetChart {
|
|
33415
|
+
getters;
|
|
33416
|
+
sheetId;
|
|
33417
|
+
definition;
|
|
33418
|
+
chartTypeBuilder;
|
|
33419
|
+
dataSourceBuilder;
|
|
33420
|
+
dataSource;
|
|
33421
|
+
constructor(getters, sheetId, definition, chartTypeBuilder, dataSourceBuilder) {
|
|
33422
|
+
this.getters = getters;
|
|
33423
|
+
this.sheetId = sheetId;
|
|
33424
|
+
this.definition = definition;
|
|
33425
|
+
this.chartTypeBuilder = chartTypeBuilder;
|
|
33426
|
+
this.dataSourceBuilder = dataSourceBuilder;
|
|
33427
|
+
this.dataSource = definition.dataSource;
|
|
33428
|
+
}
|
|
33429
|
+
static fromStrDefinition(getters, sheetId, definition) {
|
|
33430
|
+
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
33431
|
+
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
33432
|
+
const dataSource = dataSourceBuilder.fromExternalDefinition(definition.dataSource ?? { type: "none" }, sheetId, getters);
|
|
33433
|
+
const rangeDefinition = {
|
|
33434
|
+
...chartTypeBuilder.fromStrDefinition(definition, sheetId, getters),
|
|
33435
|
+
dataSource
|
|
33436
|
+
};
|
|
33437
|
+
return new SpreadsheetChart(getters, sheetId, SpreadsheetChart.deleteInvalidKeys(rangeDefinition), chartTypeBuilder, dataSourceBuilder);
|
|
33438
|
+
}
|
|
33439
|
+
static fromDefinition(getters, sheetId, definition) {
|
|
33440
|
+
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
33441
|
+
return new SpreadsheetChart(getters, sheetId, definition, chartTypeRegistry.get(definition.type), dataSourceBuilder);
|
|
33442
|
+
}
|
|
33443
|
+
static validate(validator, definition) {
|
|
33444
|
+
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
33445
|
+
const dataSourceBuilder = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none");
|
|
33446
|
+
return validator.batchValidations(() => chartTypeBuilder.validateDefinition(validator, definition), () => dataSourceBuilder.validate(definition.dataSource ?? { type: "none" }, validator))(void 0);
|
|
33447
|
+
}
|
|
33448
|
+
static transformDefinition(chartSheetId, definition, rangeAdapters) {
|
|
33449
|
+
const chartTypeBuilder = chartTypeRegistry.get(definition.type);
|
|
33450
|
+
if (!definition.dataSource) return chartTypeBuilder.transformDefinition(definition, chartSheetId, rangeAdapters);
|
|
33451
|
+
const newDataSource = chartDataSourceRegistry.get(definition.dataSource?.type ?? "none").transform(definition.dataSource, chartSheetId, rangeAdapters);
|
|
33452
|
+
return {
|
|
33453
|
+
...chartTypeBuilder.transformDefinition(definition, chartSheetId, rangeAdapters),
|
|
33454
|
+
dataSource: newDataSource
|
|
33455
|
+
};
|
|
33456
|
+
}
|
|
33457
|
+
getRangeDefinition() {
|
|
33458
|
+
return {
|
|
33459
|
+
...this.definition,
|
|
33460
|
+
dataSource: this.dataSource
|
|
33461
|
+
};
|
|
33462
|
+
}
|
|
33463
|
+
getDefinition() {
|
|
33464
|
+
return {
|
|
33465
|
+
...this.chartTypeBuilder.toStrDefinition(this.definition, this.sheetId, this.getters),
|
|
33466
|
+
dataSource: this.dataSource && this.dataSourceBuilder.getDefinition(this.dataSource, this.sheetId, this.getters)
|
|
33467
|
+
};
|
|
33468
|
+
}
|
|
33469
|
+
updateRanges(rangeAdapters) {
|
|
33470
|
+
return {
|
|
33471
|
+
...this.chartTypeBuilder.updateRanges(this.definition, rangeAdapters, this.sheetId),
|
|
33472
|
+
dataSource: this.dataSource && this.dataSourceBuilder.adaptRanges(this.dataSource, rangeAdapters)
|
|
33473
|
+
};
|
|
33474
|
+
}
|
|
33475
|
+
duplicateInDuplicatedSheet(sheetIdFrom, sheetIdTo) {
|
|
33476
|
+
const newDataSource = this.dataSource && this.dataSourceBuilder.duplicateInDuplicatedSheet(this.dataSource, sheetIdFrom, sheetIdTo, this.getters);
|
|
33477
|
+
const definition = {
|
|
33478
|
+
...this.chartTypeBuilder.duplicateInDuplicatedSheet(this.definition, sheetIdFrom, sheetIdTo, this.getters),
|
|
33479
|
+
dataSource: newDataSource
|
|
33480
|
+
};
|
|
33481
|
+
return SpreadsheetChart.fromDefinition(this.getters, sheetIdTo, definition).getDefinition();
|
|
33482
|
+
}
|
|
33483
|
+
copyInSheetId(sheetIdTo) {
|
|
33484
|
+
return {
|
|
33485
|
+
...this.chartTypeBuilder.copyInSheetId(this.definition, this.sheetId, sheetIdTo, this.getters),
|
|
33486
|
+
dataSource: this.dataSource
|
|
33487
|
+
};
|
|
33488
|
+
}
|
|
33489
|
+
getContextCreation() {
|
|
33490
|
+
const definition = this.getDefinition();
|
|
33491
|
+
return {
|
|
33492
|
+
...this.dataSourceBuilder.getContextCreation(definition.dataSource ?? { type: "none" }),
|
|
33493
|
+
...this.chartTypeBuilder.getContextCreation(definition, this.dataSourceBuilder, definition.dataSource)
|
|
33494
|
+
};
|
|
33495
|
+
}
|
|
33496
|
+
getDefinitionForExcel(getters) {
|
|
33497
|
+
const definition = this.definition;
|
|
33498
|
+
const excelDataSets = this.dataSourceBuilder.toExcelDataSets(this.dataSource, "dataSetStyles" in definition ? definition.dataSetStyles : {}, getters);
|
|
33499
|
+
if (excelDataSets === void 0) return;
|
|
33500
|
+
return this.chartTypeBuilder.getDefinitionForExcel(getters, definition, excelDataSets);
|
|
33501
|
+
}
|
|
33502
|
+
getData(getters, chartId) {
|
|
33503
|
+
const dataSource = this.dataSource;
|
|
33504
|
+
return dataSource ? this.dataSourceBuilder.extractData(dataSource, chartId, getters) : {
|
|
33505
|
+
dataSetsValues: [],
|
|
33506
|
+
labelValues: []
|
|
33507
|
+
};
|
|
33508
|
+
}
|
|
33509
|
+
getRuntime(getters, chartId) {
|
|
33510
|
+
const dataSource = this.dataSource;
|
|
33511
|
+
const dataExtractors = dataSource ? {
|
|
33512
|
+
extractData: () => this.dataSourceBuilder.extractData(dataSource, chartId, getters),
|
|
33513
|
+
extractHierarchicalData: () => this.dataSourceBuilder.extractHierarchicalData(dataSource, chartId, getters)
|
|
33514
|
+
} : {
|
|
33515
|
+
extractData: () => ({
|
|
33516
|
+
dataSetsValues: [],
|
|
33517
|
+
labelValues: []
|
|
33518
|
+
}),
|
|
33519
|
+
extractHierarchicalData: () => ({
|
|
33520
|
+
dataSetsValues: [],
|
|
33521
|
+
labelValues: []
|
|
33522
|
+
})
|
|
33523
|
+
};
|
|
33524
|
+
return this.chartTypeBuilder.getRuntime(getters, this.definition, dataExtractors, this.sheetId, {
|
|
33525
|
+
onClick: (event, items, chartJsChart) => {
|
|
33526
|
+
return this.dataSourceBuilder.onDataSetClick?.(this.definition.type, chartId, event, items, chartJsChart, getters);
|
|
33527
|
+
},
|
|
33528
|
+
onHover: (event, items, chartJsChart) => this.dataSourceBuilder.onDataSetHover?.(this.definition.type, chartId, event, items, chartJsChart)
|
|
33529
|
+
});
|
|
33530
|
+
}
|
|
33531
|
+
static deleteInvalidKeys(definition) {
|
|
33532
|
+
definition = { ...definition };
|
|
33533
|
+
const keys = new Set(chartTypeRegistry.get(definition.type).allowedDefinitionKeys);
|
|
33534
|
+
for (const key of Object.keys(definition)) if (!keys.has(key)) delete definition[key];
|
|
33535
|
+
return definition;
|
|
33536
|
+
}
|
|
33537
|
+
};
|
|
33538
|
+
|
|
33857
33539
|
//#endregion
|
|
33858
33540
|
//#region src/components/side_panel/chart/main_chart_panel/main_chart_panel_store.ts
|
|
33859
33541
|
var MainChartPanelStore = class extends SpreadsheetStore {
|
|
@@ -37075,7 +36757,7 @@ var FindAndReplacePanel = class extends Component {
|
|
|
37075
36757
|
}
|
|
37076
36758
|
get specificRangeMatchesCount() {
|
|
37077
36759
|
const range = this.searchOptions.specificRange;
|
|
37078
|
-
if (!range) return "";
|
|
36760
|
+
if (!range || range.invalidSheetName || range.invalidXc) return "";
|
|
37079
36761
|
const { specificRangeMatchesCount: count, specificRangeHiddenMatchesCount: hidden, searchOptions } = this.store;
|
|
37080
36762
|
const { sheetId, zone } = range;
|
|
37081
36763
|
let label = count === 1 ? _t("1 match in range %(range)s of '%(sheetName)s'", {
|
|
@@ -41268,7 +40950,13 @@ var PivotSpreadsheetSidePanel = class extends Component {
|
|
|
41268
40950
|
}
|
|
41269
40951
|
onSelectionChanged(ranges) {
|
|
41270
40952
|
this.state.rangeHasChanged = true;
|
|
41271
|
-
|
|
40953
|
+
if (ranges.length === 0) {
|
|
40954
|
+
this.state.range = void 0;
|
|
40955
|
+
return;
|
|
40956
|
+
}
|
|
40957
|
+
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
40958
|
+
const range = this.env.model.getters.getRangeFromSheetXC(sheetId, ranges[0]);
|
|
40959
|
+
this.state.range = this.env.model.getters.getRangeString(range, "forceSheetReference", { useBoundedReference: true });
|
|
41272
40960
|
}
|
|
41273
40961
|
onSelectionConfirmed() {
|
|
41274
40962
|
if (this.state.range) {
|
|
@@ -47457,6 +47145,11 @@ var GridOverlay = class extends Component {
|
|
|
47457
47145
|
});
|
|
47458
47146
|
return icon?.onClick ? icon : void 0;
|
|
47459
47147
|
}
|
|
47148
|
+
get isFooterVisible() {
|
|
47149
|
+
const { y } = this.env.model.getters.getMainViewportCoordinates();
|
|
47150
|
+
const { height } = this.env.model.getters.getSheetViewDimension();
|
|
47151
|
+
return !this.env.model.getters.isReadonly() && height - y > 46;
|
|
47152
|
+
}
|
|
47460
47153
|
};
|
|
47461
47154
|
|
|
47462
47155
|
//#endregion
|
|
@@ -51027,6 +50720,7 @@ var CarouselPlugin = class extends CorePlugin {
|
|
|
51027
50720
|
return "Success";
|
|
51028
50721
|
case "UPDATE_CAROUSEL":
|
|
51029
50722
|
if (!this.carousels[cmd.sheetId]?.[cmd.figureId]) return "InvalidFigureId";
|
|
50723
|
+
for (const item of cmd.definition.items) if (item.type === "chart" && !this.getters.getChart(item.chartId)) return "ChartDoesNotExist";
|
|
51030
50724
|
return "Success";
|
|
51031
50725
|
}
|
|
51032
50726
|
return "Success";
|
|
@@ -56250,7 +55944,7 @@ var CompilationParametersBuilder = class {
|
|
|
56250
55944
|
if (rangeError) return [[rangeError]];
|
|
56251
55945
|
const sheetId = range.sheetId;
|
|
56252
55946
|
const zone = range.zone;
|
|
56253
|
-
const _zone =
|
|
55947
|
+
const _zone = this.getters.clipRangeToSheet(range)?.zone;
|
|
56254
55948
|
if (!_zone) return [[]];
|
|
56255
55949
|
const { top, left, bottom, right } = zone;
|
|
56256
55950
|
const cacheKey = `${sheetId}-${top}-${left}-${bottom}-${right}`;
|
|
@@ -56554,6 +56248,7 @@ var FormulaDependencyGraph = class {
|
|
|
56554
56248
|
}
|
|
56555
56249
|
getCellsDependingOn(ranges, visited = new RangeSet()) {
|
|
56556
56250
|
visited = visited.copy();
|
|
56251
|
+
let initialRangesToRemove = visited.copy();
|
|
56557
56252
|
const queue = Array.from(ranges).reverse();
|
|
56558
56253
|
while (queue.length > 0) {
|
|
56559
56254
|
const range = queue.pop();
|
|
@@ -56569,8 +56264,9 @@ var FormulaDependencyGraph = class {
|
|
|
56569
56264
|
for (const interval of overlappingIntervals) impactedRanges.add(interval.dependents);
|
|
56570
56265
|
}
|
|
56571
56266
|
queue.push(...impactedRanges.difference(visited));
|
|
56267
|
+
initialRangesToRemove = initialRangesToRemove.difference(impactedRanges);
|
|
56572
56268
|
}
|
|
56573
|
-
for (const range of
|
|
56269
|
+
for (const range of initialRangesToRemove) visited.delete(range);
|
|
56574
56270
|
return visited;
|
|
56575
56271
|
}
|
|
56576
56272
|
getOrCreateIntervalTree(sheetId, col) {
|
|
@@ -57238,10 +56934,10 @@ var Evaluator = class {
|
|
|
57238
56934
|
updateDependencies(position) {
|
|
57239
56935
|
this.formulaDependencies().removeAllDependencies(position);
|
|
57240
56936
|
const dependencies = this.getDirectDependencies(position);
|
|
57241
|
-
this.formulaDependencies().addDependencies(position, dependencies);
|
|
56937
|
+
this.formulaDependencies().addDependencies(position, this.getters.clipRangesToSheet(dependencies));
|
|
57242
56938
|
}
|
|
57243
56939
|
addDependencies(position, dependencies) {
|
|
57244
|
-
this.formulaDependencies().addDependencies(position, dependencies);
|
|
56940
|
+
this.formulaDependencies().addDependencies(position, this.getters.clipRangesToSheet(dependencies));
|
|
57245
56941
|
this.computeDependencies(dependencies);
|
|
57246
56942
|
}
|
|
57247
56943
|
computeDependencies(dependencies) {
|
|
@@ -57314,7 +57010,8 @@ var Evaluator = class {
|
|
|
57314
57010
|
const graph = new FormulaDependencyGraph();
|
|
57315
57011
|
for (const sheetId of this.getters.getSheetIds()) for (const cell of this.getters.getCells(sheetId)) if (cell.isFormula) {
|
|
57316
57012
|
const cellPosition = this.getters.getCellPosition(cell.id);
|
|
57317
|
-
|
|
57013
|
+
const dependencies = this.getters.clipRangesToSheet(cell.compiledFormula.rangeDependencies);
|
|
57014
|
+
graph.addDependencies(cellPosition, dependencies);
|
|
57318
57015
|
}
|
|
57319
57016
|
return graph;
|
|
57320
57017
|
});
|
|
@@ -63295,7 +62992,8 @@ var GeoFeaturePlugin = class extends UIPlugin {
|
|
|
63295
62992
|
"getGeoJsonFeatures",
|
|
63296
62993
|
"geoFeatureNameToId",
|
|
63297
62994
|
"getGeoChartAvailableRegions",
|
|
63298
|
-
"getAvailableChartRegions"
|
|
62995
|
+
"getAvailableChartRegions",
|
|
62996
|
+
"loadUsedGeoJsonFeatures"
|
|
63299
62997
|
];
|
|
63300
62998
|
geoJsonService;
|
|
63301
62999
|
geoJsonCache = {};
|
|
@@ -63378,6 +63076,23 @@ var GeoFeaturePlugin = class extends UIPlugin {
|
|
|
63378
63076
|
}
|
|
63379
63077
|
return this.geoJsonService.geoFeatureNameToId(region, featureName);
|
|
63380
63078
|
}
|
|
63079
|
+
loadUsedGeoJsonFeatures() {
|
|
63080
|
+
const regions = this.getters.getSheetIds().flatMap((sheetId) => this.getters.getChartIds(sheetId).map((chartId) => {
|
|
63081
|
+
const definition = this.getters.getChartDefinition(chartId);
|
|
63082
|
+
return definition.type === "geo" ? definition.region || this.getters.getGeoChartAvailableRegions()[0]?.id : void 0;
|
|
63083
|
+
})).filter(isDefined);
|
|
63084
|
+
const uniqueRegions = Array.from(new Set(regions));
|
|
63085
|
+
if (uniqueRegions.length && !this.geoJsonService) {
|
|
63086
|
+
console.error("No geoJsonService provided to the model");
|
|
63087
|
+
return Promise.resolve();
|
|
63088
|
+
}
|
|
63089
|
+
for (const region of uniqueRegions) this.getGeoJsonFeatures(region);
|
|
63090
|
+
const promises = uniqueRegions.map((region) => {
|
|
63091
|
+
const cachedGeoJson = this.geoJsonCache[region];
|
|
63092
|
+
return cachedGeoJson instanceof Promise ? cachedGeoJson : Promise.resolve();
|
|
63093
|
+
});
|
|
63094
|
+
return Promise.all(promises).then(() => {});
|
|
63095
|
+
}
|
|
63381
63096
|
convertToGeoJson(json) {
|
|
63382
63097
|
if (!json) return null;
|
|
63383
63098
|
if (json.type === "Topology") {
|
|
@@ -66462,7 +66177,7 @@ var InternalViewport = class {
|
|
|
66462
66177
|
let height = lastRowEnd - this.offsetCorrectionY;
|
|
66463
66178
|
if (this.canScrollVertically) {
|
|
66464
66179
|
height = Math.max(height, this.viewportHeight);
|
|
66465
|
-
if (lastRowEnd + 46 > height && !this.getters.isReadonly()) height += 46;
|
|
66180
|
+
if (lastRowEnd + 46 > height && !this.getters.isReadonly() && this.viewportHeight > 46) height += 46;
|
|
66466
66181
|
}
|
|
66467
66182
|
return {
|
|
66468
66183
|
width,
|
|
@@ -70246,7 +69961,7 @@ var FigureRendererStore = class extends DisposableStore {
|
|
|
70246
69961
|
if (!this.getters.isDashboard()) {
|
|
70247
69962
|
ctx.strokeStyle = GRAY_400;
|
|
70248
69963
|
ctx.lineWidth = 1;
|
|
70249
|
-
ctx.strokeRect(x, y, figure.width, figure.height);
|
|
69964
|
+
ctx.strokeRect(x + .5, y + .5, figure.width - 1, figure.height - 1);
|
|
70250
69965
|
}
|
|
70251
69966
|
}
|
|
70252
69967
|
}
|
|
@@ -70455,12 +70170,11 @@ var SpreadsheetPrintStore = class extends SpreadsheetStore {
|
|
|
70455
70170
|
const { width: printWidth, height: printHeight } = this.pageDimensionWithMargins;
|
|
70456
70171
|
const start = dimension === "COL" ? printZone.left : printZone.top;
|
|
70457
70172
|
const end = dimension === "COL" ? printZone.right : printZone.bottom;
|
|
70458
|
-
const getHeaderSize = dimension === "COL" ? this.getters.getColDimensions : this.getters.getRowDimensions;
|
|
70459
70173
|
const max = dimension === "COL" ? printWidth : printHeight;
|
|
70460
70174
|
const breaks = [];
|
|
70461
70175
|
let current = 0;
|
|
70462
70176
|
for (let i = start; i <= end; i++) {
|
|
70463
|
-
const headerSize =
|
|
70177
|
+
const headerSize = this.getters.isHeaderHidden(sheetId, dimension, i) ? 0 : this.getters.getHeaderSize(sheetId, dimension, i) * zoom;
|
|
70464
70178
|
current += headerSize;
|
|
70465
70179
|
if (current >= max) {
|
|
70466
70180
|
breaks.push(i);
|
|
@@ -71911,7 +71625,10 @@ var Spreadsheet = class extends Component {
|
|
|
71911
71625
|
sidePanel;
|
|
71912
71626
|
spreadsheetRef = signal(null);
|
|
71913
71627
|
spreadsheetRect = useSpreadsheetRect();
|
|
71914
|
-
state = proxy({
|
|
71628
|
+
state = proxy({
|
|
71629
|
+
printModeEnabled: false,
|
|
71630
|
+
colorThemeBeforePrint: "light"
|
|
71631
|
+
});
|
|
71915
71632
|
_focusGrid;
|
|
71916
71633
|
isViewportTooSmall = false;
|
|
71917
71634
|
notificationStore;
|
|
@@ -71923,7 +71640,7 @@ var Spreadsheet = class extends Component {
|
|
|
71923
71640
|
const properties = {};
|
|
71924
71641
|
properties["--os-scrollbar-width"] = `${this.env.model.getters.getScrollBarWidth()}px`;
|
|
71925
71642
|
properties["--os-dark-mode-filter"] = DARK_MODE_FILTER_STRING;
|
|
71926
|
-
properties["color-scheme"] = this.
|
|
71643
|
+
properties["color-scheme"] = this.colorScheme;
|
|
71927
71644
|
if (this.state.printModeEnabled) properties["display"] = `block`;
|
|
71928
71645
|
else {
|
|
71929
71646
|
if (this.env.model.getters.isDashboard()) properties["grid-template-rows"] = `auto`;
|
|
@@ -71963,7 +71680,7 @@ var Spreadsheet = class extends Component {
|
|
|
71963
71680
|
askConfirmation: (text, confirm, cancel) => this.notificationStore.askConfirmation(text, confirm, cancel),
|
|
71964
71681
|
raiseError: (text, cb) => this.notificationStore.raiseError(text, cb),
|
|
71965
71682
|
isMobile: isMobileOS,
|
|
71966
|
-
printSpreadsheet:
|
|
71683
|
+
printSpreadsheet: this.enterPrintMode.bind(this)
|
|
71967
71684
|
});
|
|
71968
71685
|
this.notificationStore.updateNotificationCallbacks({ ...this.props });
|
|
71969
71686
|
useLayoutEffect(() => {
|
|
@@ -71980,7 +71697,7 @@ var Spreadsheet = class extends Component {
|
|
|
71980
71697
|
useExternalListener(document.body, "wheel", () => {});
|
|
71981
71698
|
useExternalListener(window, "keydown", async (event) => {
|
|
71982
71699
|
if (keyboardEventToShortcutString(event) === "Ctrl+P") {
|
|
71983
|
-
this.
|
|
71700
|
+
this.enterPrintMode();
|
|
71984
71701
|
event.stopPropagation();
|
|
71985
71702
|
event.preventDefault();
|
|
71986
71703
|
}
|
|
@@ -72093,9 +71810,21 @@ var Spreadsheet = class extends Component {
|
|
|
72093
71810
|
getSpreadSheetClasses() {
|
|
72094
71811
|
return [this.env.isSmall ? "o-spreadsheet-mobile" : "", this.props.model.getters.isDarkMode() ? "dark" : ""].join(" ");
|
|
72095
71812
|
}
|
|
71813
|
+
enterPrintMode() {
|
|
71814
|
+
if (this.state.printModeEnabled) return;
|
|
71815
|
+
this.state.colorThemeBeforePrint = this.props.model.getters.isDarkMode() ? "dark" : "light";
|
|
71816
|
+
this.env.model.dispatch("UPDATE_COLOR_SCHEME", { colorScheme: "light" });
|
|
71817
|
+
this.state.printModeEnabled = true;
|
|
71818
|
+
}
|
|
72096
71819
|
exitPrintMode() {
|
|
71820
|
+
if (!this.state.printModeEnabled) return;
|
|
71821
|
+
this.env.model.dispatch("UPDATE_COLOR_SCHEME", { colorScheme: this.state.colorThemeBeforePrint });
|
|
72097
71822
|
this.state.printModeEnabled = false;
|
|
72098
71823
|
}
|
|
71824
|
+
get colorScheme() {
|
|
71825
|
+
if (this.state.printModeEnabled) return this.state.colorThemeBeforePrint;
|
|
71826
|
+
return this.props.model.getters.isDarkMode() ? "dark" : "light";
|
|
71827
|
+
}
|
|
72099
71828
|
};
|
|
72100
71829
|
|
|
72101
71830
|
//#endregion
|
|
@@ -72970,6 +72699,8 @@ var RangeAdapterPlugin = class {
|
|
|
72970
72699
|
"extendRange",
|
|
72971
72700
|
"getRangeString",
|
|
72972
72701
|
"getRangeFromSheetXC",
|
|
72702
|
+
"clipRangesToSheet",
|
|
72703
|
+
"clipRangeToSheet",
|
|
72973
72704
|
"createAdaptedRanges",
|
|
72974
72705
|
"getRangeData",
|
|
72975
72706
|
"getRangeDataFromXc",
|
|
@@ -73008,6 +72739,22 @@ var RangeAdapterPlugin = class {
|
|
|
73008
72739
|
addRangeProvider(provider) {
|
|
73009
72740
|
this.providers.push(provider);
|
|
73010
72741
|
}
|
|
72742
|
+
clipRangeToSheet(range) {
|
|
72743
|
+
if (range.invalidXc) return range;
|
|
72744
|
+
const sheetZone = this.getters.getSheetZone(range.sheetId);
|
|
72745
|
+
if (isZoneInside(range.zone, sheetZone)) return range;
|
|
72746
|
+
const newZone = intersection(range.zone, sheetZone);
|
|
72747
|
+
if (!newZone) return;
|
|
72748
|
+
return this.getters.getRangeFromZone(range.sheetId, newZone);
|
|
72749
|
+
}
|
|
72750
|
+
clipRangesToSheet(ranges) {
|
|
72751
|
+
const clippedRanges = [];
|
|
72752
|
+
for (const range of ranges) {
|
|
72753
|
+
const clippedRange = this.clipRangeToSheet(range);
|
|
72754
|
+
if (clippedRange) clippedRanges.push(clippedRange);
|
|
72755
|
+
}
|
|
72756
|
+
return clippedRanges;
|
|
72757
|
+
}
|
|
73011
72758
|
createAdaptedRanges(ranges, offsetX, offsetY, sheetId) {
|
|
73012
72759
|
return ranges.map((range) => {
|
|
73013
72760
|
if (!isZoneValid(range.zone)) return range;
|
|
@@ -76241,6 +75988,8 @@ var Model = class Model extends EventBus {
|
|
|
76241
75988
|
this.range = new RangeAdapterPlugin(this.coreGetters);
|
|
76242
75989
|
this.coreGetters.getRangeString = this.range.getRangeString.bind(this.range);
|
|
76243
75990
|
this.coreGetters.getRangeFromSheetXC = this.range.getRangeFromSheetXC.bind(this.range);
|
|
75991
|
+
this.coreGetters.clipRangesToSheet = this.range.clipRangesToSheet.bind(this.range);
|
|
75992
|
+
this.coreGetters.clipRangeToSheet = this.range.clipRangeToSheet.bind(this.range);
|
|
76244
75993
|
this.coreGetters.createAdaptedRanges = this.range.createAdaptedRanges.bind(this.range);
|
|
76245
75994
|
this.coreGetters.getRangeData = this.range.getRangeData.bind(this.range);
|
|
76246
75995
|
this.coreGetters.getRangeDataFromXc = this.range.getRangeDataFromXc.bind(this.range);
|
|
@@ -78203,6 +77952,306 @@ const LinkEditorPopoverBuilder = { onOpen: (position, getters) => {
|
|
|
78203
77952
|
//#region src/components/popover/popover_builders.ts
|
|
78204
77953
|
cellPopoverRegistry.add("ErrorToolTip", ErrorToolTipPopoverBuilder).add("LinkCell", LinkCellPopoverBuilder).add("LinkEditor", LinkEditorPopoverBuilder).add("FilterMenu", FilterMenuPopoverBuilder);
|
|
78205
77954
|
|
|
77955
|
+
//#endregion
|
|
77956
|
+
//#region src/helpers/figures/charts/chart_data_sources.ts
|
|
77957
|
+
const EMPTY = Object.freeze({ value: null });
|
|
77958
|
+
const ONE = Object.freeze({ value: 1 });
|
|
77959
|
+
const ChartRangeDataSourceHandler = {
|
|
77960
|
+
supportedChartTypes: CHART_TYPES,
|
|
77961
|
+
fromExternalDefinition(dataSource, defaultSheetId, getters) {
|
|
77962
|
+
const dataSets = createDataSets(getters, defaultSheetId, dataSource);
|
|
77963
|
+
const labelRange = createValidRange(getters, defaultSheetId, dataSource.labelRange);
|
|
77964
|
+
return {
|
|
77965
|
+
...dataSource,
|
|
77966
|
+
dataSets,
|
|
77967
|
+
labelRange
|
|
77968
|
+
};
|
|
77969
|
+
},
|
|
77970
|
+
fromContextCreation(context) {
|
|
77971
|
+
return {
|
|
77972
|
+
type: "range",
|
|
77973
|
+
dataSets: [],
|
|
77974
|
+
dataSetsHaveTitle: false,
|
|
77975
|
+
labelRange: context.auxiliaryRange,
|
|
77976
|
+
...context.dataSource
|
|
77977
|
+
};
|
|
77978
|
+
},
|
|
77979
|
+
fromHierarchicalContextCreation(context) {
|
|
77980
|
+
if (context.dataSource?.type !== "range" || context.hierarchicalDataSource !== void 0 && context.hierarchicalDataSource.type !== "range") return {
|
|
77981
|
+
type: "range",
|
|
77982
|
+
dataSets: [],
|
|
77983
|
+
dataSetsHaveTitle: false
|
|
77984
|
+
};
|
|
77985
|
+
let dataSource = {
|
|
77986
|
+
type: "range",
|
|
77987
|
+
dataSets: [],
|
|
77988
|
+
dataSetsHaveTitle: context.dataSource?.dataSetsHaveTitle ?? false,
|
|
77989
|
+
labelRange: context.dataSource?.dataSets?.[0]?.dataRange
|
|
77990
|
+
};
|
|
77991
|
+
if (context.hierarchicalDataSource?.dataSets.length) dataSource = context.hierarchicalDataSource;
|
|
77992
|
+
else if (context.auxiliaryRange) dataSource = {
|
|
77993
|
+
...dataSource,
|
|
77994
|
+
dataSets: [{
|
|
77995
|
+
dataRange: context.auxiliaryRange,
|
|
77996
|
+
dataSetId: "0"
|
|
77997
|
+
}]
|
|
77998
|
+
};
|
|
77999
|
+
return dataSource;
|
|
78000
|
+
},
|
|
78001
|
+
validate: (dataSource, validator) => validator.checkValidations(dataSource, checkDataset, checkLabelRange),
|
|
78002
|
+
transform(dataSource, defaultSheetId, { adaptRangeString }) {
|
|
78003
|
+
let labelRange;
|
|
78004
|
+
if (dataSource.labelRange) {
|
|
78005
|
+
const { changeType, range: adaptedRange } = adaptRangeString(defaultSheetId, dataSource.labelRange);
|
|
78006
|
+
if (changeType !== "REMOVE") labelRange = adaptedRange;
|
|
78007
|
+
}
|
|
78008
|
+
const dataSets = [];
|
|
78009
|
+
for (const dataSet of dataSource.dataSets) {
|
|
78010
|
+
const newDataSet = { ...dataSet };
|
|
78011
|
+
const { changeType, range: adaptedRange } = adaptRangeString(defaultSheetId, dataSet.dataRange);
|
|
78012
|
+
if (changeType !== "REMOVE") {
|
|
78013
|
+
newDataSet.dataRange = adaptedRange;
|
|
78014
|
+
dataSets.push(newDataSet);
|
|
78015
|
+
}
|
|
78016
|
+
}
|
|
78017
|
+
return {
|
|
78018
|
+
...dataSource,
|
|
78019
|
+
dataSets,
|
|
78020
|
+
labelRange
|
|
78021
|
+
};
|
|
78022
|
+
},
|
|
78023
|
+
extractData: (dataSource, chartId, getters) => getChartData(getters, dataSource),
|
|
78024
|
+
extractHierarchicalData(dataSource, chartId, getters) {
|
|
78025
|
+
const dataSets = dataSource.dataSets;
|
|
78026
|
+
const labelRange = dataSource.labelRange;
|
|
78027
|
+
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
78028
|
+
const dataSetsValues = getHierarchicalDatasetValues(getters, dataSets);
|
|
78029
|
+
const data = {
|
|
78030
|
+
labelValues,
|
|
78031
|
+
dataSetsValues
|
|
78032
|
+
};
|
|
78033
|
+
if (shouldRemoveFirstLabel(labelValues.length, dataSetsValues[0]?.data.length + (dataSetsValues[0]?.label !== void 0 ? 1 : 0), dataSource.dataSetsHaveTitle || false)) labelValues.shift();
|
|
78034
|
+
return data;
|
|
78035
|
+
},
|
|
78036
|
+
adaptRanges(dataSource, { applyChange }) {
|
|
78037
|
+
const dataSetsWithUndefined = dataSource.dataSets.map((ds) => {
|
|
78038
|
+
const { range: adaptedRangeStr, changeType } = applyChange(ds.dataRange);
|
|
78039
|
+
if (changeType === "REMOVE") return;
|
|
78040
|
+
let labelCell = void 0;
|
|
78041
|
+
if (ds.labelCell) {
|
|
78042
|
+
const { range: adaptedLabelCellRange, changeType: labelCellChangeType } = applyChange(ds.labelCell);
|
|
78043
|
+
if (labelCellChangeType !== "REMOVE") labelCell = adaptedLabelCellRange;
|
|
78044
|
+
}
|
|
78045
|
+
return {
|
|
78046
|
+
...ds,
|
|
78047
|
+
dataRange: adaptedRangeStr,
|
|
78048
|
+
labelCell
|
|
78049
|
+
};
|
|
78050
|
+
}).filter(isDefined);
|
|
78051
|
+
let labelRange = dataSource.labelRange;
|
|
78052
|
+
if (labelRange) {
|
|
78053
|
+
const { range: adaptedLabelRange, changeType } = applyChange(labelRange);
|
|
78054
|
+
if (changeType === "REMOVE") labelRange = void 0;
|
|
78055
|
+
else labelRange = adaptedLabelRange;
|
|
78056
|
+
}
|
|
78057
|
+
const dataSets = dataSetsWithUndefined;
|
|
78058
|
+
return {
|
|
78059
|
+
...dataSource,
|
|
78060
|
+
dataSets,
|
|
78061
|
+
labelRange: labelRange?.invalidSheetName || labelRange?.invalidXc ? void 0 : labelRange
|
|
78062
|
+
};
|
|
78063
|
+
},
|
|
78064
|
+
getDefinition(dataSource, defaultSheetId, getters) {
|
|
78065
|
+
return {
|
|
78066
|
+
labelRange: dataSource.labelRange ? getters.getRangeString(dataSource.labelRange, defaultSheetId) : void 0,
|
|
78067
|
+
type: "range",
|
|
78068
|
+
dataSets: dataSource.dataSets.map((dataSet) => ({
|
|
78069
|
+
dataSetId: dataSet.dataSetId,
|
|
78070
|
+
dataRange: getters.getRangeString(dataSet.dataRange, defaultSheetId)
|
|
78071
|
+
})),
|
|
78072
|
+
dataSetsHaveTitle: dataSource.dataSetsHaveTitle
|
|
78073
|
+
};
|
|
78074
|
+
},
|
|
78075
|
+
/**
|
|
78076
|
+
* Duplicate the dataSets. All ranges on sheetIdFrom are adapted to target
|
|
78077
|
+
* sheetIdTo.
|
|
78078
|
+
*/
|
|
78079
|
+
duplicateInDuplicatedSheet(dataSource, sheetIdFrom, sheetIdTo, getters) {
|
|
78080
|
+
return {
|
|
78081
|
+
...dataSource,
|
|
78082
|
+
labelRange: duplicateLabelRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, dataSource.labelRange),
|
|
78083
|
+
dataSets: dataSource.dataSets.map((ds) => ({
|
|
78084
|
+
...ds,
|
|
78085
|
+
dataRange: duplicateRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, ds.dataRange)
|
|
78086
|
+
}))
|
|
78087
|
+
};
|
|
78088
|
+
},
|
|
78089
|
+
getContextCreation: (dataSource) => ({
|
|
78090
|
+
auxiliaryRange: dataSource.labelRange,
|
|
78091
|
+
dataSource
|
|
78092
|
+
}),
|
|
78093
|
+
getHierarchicalContextCreation(dataSource) {
|
|
78094
|
+
const leafRange = dataSource.dataSets.at(-1)?.dataRange;
|
|
78095
|
+
const dataSetsHaveTitle = dataSource.dataSetsHaveTitle;
|
|
78096
|
+
return {
|
|
78097
|
+
auxiliaryRange: leafRange,
|
|
78098
|
+
hierarchicalDataSource: dataSource,
|
|
78099
|
+
dataSource: dataSource.labelRange ? {
|
|
78100
|
+
type: "range",
|
|
78101
|
+
dataSets: [{
|
|
78102
|
+
dataRange: dataSource.labelRange,
|
|
78103
|
+
dataSetId: "0"
|
|
78104
|
+
}],
|
|
78105
|
+
dataSetsHaveTitle
|
|
78106
|
+
} : {
|
|
78107
|
+
type: "range",
|
|
78108
|
+
dataSets: [],
|
|
78109
|
+
dataSetsHaveTitle
|
|
78110
|
+
}
|
|
78111
|
+
};
|
|
78112
|
+
},
|
|
78113
|
+
toExcelDataSets(dataSource, dataSetStyles, getters) {
|
|
78114
|
+
const dataSets = dataSource.dataSets;
|
|
78115
|
+
const labelRange = dataSource.labelRange;
|
|
78116
|
+
const excelDataSets = dataSets.map((ds) => toExcelDataset(getters, dataSetStyles, ds)).filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
|
|
78117
|
+
const datasetLength = dataSets[0] ? getZoneArea(dataSets[0].dataRange.zone) : void 0;
|
|
78118
|
+
return {
|
|
78119
|
+
dataSets: excelDataSets,
|
|
78120
|
+
labelRange: toExcelLabelRange(getters, labelRange, shouldRemoveFirstLabel(labelRange ? getZoneArea(labelRange.zone) : 0, datasetLength, dataSource.dataSetsHaveTitle))
|
|
78121
|
+
};
|
|
78122
|
+
}
|
|
78123
|
+
};
|
|
78124
|
+
function getChartData(getters, dataSource) {
|
|
78125
|
+
const dataSets = dataSource.dataSets;
|
|
78126
|
+
const labelRange = dataSource.labelRange;
|
|
78127
|
+
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
78128
|
+
const dataSetsValues = getChartDatasetValues(getters, dataSets);
|
|
78129
|
+
const data = {
|
|
78130
|
+
labelValues,
|
|
78131
|
+
dataSetsValues
|
|
78132
|
+
};
|
|
78133
|
+
const numberOfDataPoints = dataSetsValues.length ? dataSetsValues[0]?.data.length + (dataSetsValues[0]?.label !== void 0 ? 1 : 0) : 0;
|
|
78134
|
+
if (shouldRemoveFirstLabel(labelValues.length, numberOfDataPoints, dataSource.dataSetsHaveTitle || false)) labelValues.shift();
|
|
78135
|
+
return data;
|
|
78136
|
+
}
|
|
78137
|
+
function getChartDatasetValues(getters, dataSets) {
|
|
78138
|
+
const datasetValues = [];
|
|
78139
|
+
for (const [dsIndex, ds] of Object.entries(dataSets)) {
|
|
78140
|
+
let label = `${ChartTerms.Series} ${parseInt(dsIndex) + 1}`;
|
|
78141
|
+
let hidden = getters.isColHidden(ds.dataRange.sheetId, ds.dataRange.zone.left);
|
|
78142
|
+
if (ds.labelCell) {
|
|
78143
|
+
const { sheetId, zone } = ds.labelCell;
|
|
78144
|
+
const cell = getters.getEvaluatedCell({
|
|
78145
|
+
sheetId,
|
|
78146
|
+
col: zone.left,
|
|
78147
|
+
row: zone.top
|
|
78148
|
+
});
|
|
78149
|
+
if (cell) label = cell.formattedValue;
|
|
78150
|
+
}
|
|
78151
|
+
let data = ds.dataRange ? getData(getters, ds) : [];
|
|
78152
|
+
if (data.every((cell) => !cell.value || isTextResult(cell)) && data.filter(isTextResult).length > 1) data = data.map((cell) => cell.value && !isErrorResult(cell) ? ONE : EMPTY);
|
|
78153
|
+
else if (data.every((cell) => !isNumberResult(cell))) hidden = true;
|
|
78154
|
+
datasetValues.push({
|
|
78155
|
+
data,
|
|
78156
|
+
label,
|
|
78157
|
+
hidden,
|
|
78158
|
+
dataSetId: ds.dataSetId
|
|
78159
|
+
});
|
|
78160
|
+
}
|
|
78161
|
+
return datasetValues;
|
|
78162
|
+
}
|
|
78163
|
+
function getChartLabelValues(getters, dataSets, labelRange) {
|
|
78164
|
+
if (labelRange) {
|
|
78165
|
+
const { left } = labelRange.zone;
|
|
78166
|
+
if (!labelRange.invalidXc && !labelRange.invalidSheetName && !getters.isColHidden(labelRange.sheetId, left)) return getters.getVisibleRangeValues(labelRange);
|
|
78167
|
+
}
|
|
78168
|
+
if (dataSets[0]) {
|
|
78169
|
+
const dataLength = getData(getters, dataSets[0]).length;
|
|
78170
|
+
return Array.from({ length: dataLength }, () => ({ value: "" }));
|
|
78171
|
+
}
|
|
78172
|
+
return [];
|
|
78173
|
+
}
|
|
78174
|
+
/**
|
|
78175
|
+
* Get the values for a hierarchical dataset. The values can be defined in a tree-like structure
|
|
78176
|
+
* in the sheet, and this function will fill up the blanks.
|
|
78177
|
+
*
|
|
78178
|
+
* @example the following dataset:
|
|
78179
|
+
*
|
|
78180
|
+
* 2024 Q1 W1 100
|
|
78181
|
+
* W2 200
|
|
78182
|
+
*
|
|
78183
|
+
* will have the same value as the dataset:
|
|
78184
|
+
* 2024 Q1 W1 100
|
|
78185
|
+
* 2024 Q1 W2 200
|
|
78186
|
+
*/
|
|
78187
|
+
function getHierarchicalDatasetValues(getters, dataSets) {
|
|
78188
|
+
dataSets = dataSets.filter((ds) => !getters.isColHidden(ds.dataRange.sheetId, ds.dataRange.zone.left));
|
|
78189
|
+
const datasetValues = dataSets.map((ds) => ({
|
|
78190
|
+
data: [],
|
|
78191
|
+
label: "",
|
|
78192
|
+
dataSetId: ds.dataSetId
|
|
78193
|
+
}));
|
|
78194
|
+
const locale = getters.getLocale();
|
|
78195
|
+
const dataSetsData = dataSets.map((ds) => getData(getters, ds)).map((values) => values.map(({ value, format }) => value === null ? EMPTY : { value: formatValue(value, {
|
|
78196
|
+
format,
|
|
78197
|
+
locale
|
|
78198
|
+
}) }));
|
|
78199
|
+
if (!dataSetsData.length) return datasetValues;
|
|
78200
|
+
const minLength = Math.min(...dataSetsData.map((ds) => ds.length));
|
|
78201
|
+
let currentValues = [];
|
|
78202
|
+
const leafDatasetIndex = dataSets.length - 1;
|
|
78203
|
+
for (let i = 0; i < minLength; i++) for (let dsIndex = 0; dsIndex < dataSetsData.length; dsIndex++) {
|
|
78204
|
+
let cell = dataSetsData[dsIndex][i];
|
|
78205
|
+
if ((cell === void 0 || cell.value === null) && dsIndex !== leafDatasetIndex) cell = currentValues[dsIndex];
|
|
78206
|
+
if (cell?.value !== currentValues[dsIndex]?.value) {
|
|
78207
|
+
currentValues = currentValues.slice(0, dsIndex);
|
|
78208
|
+
currentValues[dsIndex] = cell;
|
|
78209
|
+
}
|
|
78210
|
+
datasetValues[dsIndex].data.push(cell ?? EMPTY);
|
|
78211
|
+
}
|
|
78212
|
+
return datasetValues.filter((ds) => ds.data.some((d) => d.value !== null));
|
|
78213
|
+
}
|
|
78214
|
+
/**
|
|
78215
|
+
* Get the data from a dataSet
|
|
78216
|
+
*/
|
|
78217
|
+
function getData(getters, ds) {
|
|
78218
|
+
if (ds.dataRange) {
|
|
78219
|
+
const labelCellZone = ds.labelCell ? [ds.labelCell.zone] : [];
|
|
78220
|
+
const dataZone = recomputeZones([ds.dataRange.zone], labelCellZone)[0];
|
|
78221
|
+
if (dataZone === void 0) return [];
|
|
78222
|
+
const dataRange = getters.getRangeFromZone(ds.dataRange.sheetId, dataZone);
|
|
78223
|
+
return getters.getVisibleRangeValues(dataRange).map((cell) => cell.value === "" ? EMPTY : cell);
|
|
78224
|
+
}
|
|
78225
|
+
return [];
|
|
78226
|
+
}
|
|
78227
|
+
const ChartNeverDataSourceHandler = {
|
|
78228
|
+
supportedChartTypes: [],
|
|
78229
|
+
fromExternalDefinition: () => ({ type: "none" }),
|
|
78230
|
+
fromContextCreation: () => ({ type: "none" }),
|
|
78231
|
+
fromHierarchicalContextCreation: () => ({ type: "none" }),
|
|
78232
|
+
validate: () => "Success",
|
|
78233
|
+
transform: () => ({ type: "none" }),
|
|
78234
|
+
extractData: () => ({
|
|
78235
|
+
dataSetsValues: [],
|
|
78236
|
+
labelValues: []
|
|
78237
|
+
}),
|
|
78238
|
+
extractHierarchicalData: () => ({
|
|
78239
|
+
dataSetsValues: [],
|
|
78240
|
+
labelValues: []
|
|
78241
|
+
}),
|
|
78242
|
+
adaptRanges: (dataSource) => dataSource,
|
|
78243
|
+
getDefinition: (dataSource) => dataSource,
|
|
78244
|
+
duplicateInDuplicatedSheet: (dataSource) => dataSource,
|
|
78245
|
+
getContextCreation: () => ({}),
|
|
78246
|
+
getHierarchicalContextCreation: () => ({}),
|
|
78247
|
+
toExcelDataSets: () => ({
|
|
78248
|
+
dataSets: [],
|
|
78249
|
+
labelRange: void 0
|
|
78250
|
+
})
|
|
78251
|
+
};
|
|
78252
|
+
chartDataSourceRegistry.add("range", ChartRangeDataSourceHandler);
|
|
78253
|
+
chartDataSourceRegistry.add("none", ChartNeverDataSourceHandler);
|
|
78254
|
+
|
|
78206
78255
|
//#endregion
|
|
78207
78256
|
//#region src/registries/auto_completes/data_validation_auto_complete.ts
|
|
78208
78257
|
autoCompleteProviders.add("dataValidation", {
|
|
@@ -79126,14 +79175,13 @@ const PyramidChart = {
|
|
|
79126
79175
|
},
|
|
79127
79176
|
getDefinitionForExcel(getters, definition, { dataSets, labelRange }) {
|
|
79128
79177
|
if (definition.dataSource.type !== "range") return;
|
|
79129
|
-
const
|
|
79130
|
-
const { dataSetsValues } = chartData;
|
|
79178
|
+
const { dataSetsValues } = getPyramidChartData(definition, getChartData(getters, definition.dataSource), getters);
|
|
79131
79179
|
const maxValue = Math.max(...dataSetsValues.map((dataSet) => Math.max(...dataSet.data.map((cell) => isNumberResult(cell) ? Math.abs(cell.value) : -Infinity))));
|
|
79132
79180
|
return {
|
|
79133
79181
|
...definition,
|
|
79134
79182
|
horizontal: true,
|
|
79135
|
-
backgroundColor: toXlsxHexColor(
|
|
79136
|
-
fontColor: toXlsxHexColor(chartFontColor(
|
|
79183
|
+
backgroundColor: toXlsxHexColor(definition.background || "#FFFFFF"),
|
|
79184
|
+
fontColor: toXlsxHexColor(chartFontColor(definition.background)),
|
|
79137
79185
|
dataSets,
|
|
79138
79186
|
labelRange,
|
|
79139
79187
|
verticalAxis: getDefinedAxis(definition),
|
|
@@ -87694,6 +87742,6 @@ const chartHelpers = {
|
|
|
87694
87742
|
//#endregion
|
|
87695
87743
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, BadExpressionError, CHART_TYPES, CellErrorType, CellValueType, CircularDependencyError, ClientDisconnectedError, ClipboardMIMEType, CommandResult, CompiledFormula, CorePlugin, CoreViewPlugin, DEFAULT_LOCALE, DEFAULT_LOCALES, DEFAULT_LOCALE_DIGIT_GROUPING, DIRECTION, DispatchResult, DivisionByZeroError, EvaluationError, InvalidReferenceError, LocalTransportService, Model, NEXT_VALUE, NotAvailableError, NumberTooLargeError, OrderedLayers, PREVIOUS_VALUE, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, SplillBlockedError, Spreadsheet, SpreadsheetPivotTable, UIPlugin, UnknownFunctionError, __info__, addFunction, addRenderingLayer, astToFormula, availableConditionalFormatOperators, availableDataValidationOperators, availableFiltersOperators, borderPositions, borderStyles, canExecuteInReadonly, categories, chartHelpers, compatibility, components, composerFocusTypes, constants, convertAstNodes, coreTypes, createAutocompleteArgumentsProvider, errorTypes, filterDateCriterionOperators, filterNumberCriterionOperators, filterTextCriterionOperators, findCellInNewZone, functionCache, getCaretDownSvg, getCaretUpSvg, helpers, hooks, invalidSubtotalFormulasCommands, invalidateBordersCommands, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, isCoreCommand, isHeadersDependant, isMatrix, isPositionDependent, isRangeDependant, isSheetDependent, isTargetDependent, isZoneDependent, iterateAstNodes, links, load, lockedSheetAllowedCommands, parse, parseTokens, readonlyAllowedCommands, registries, schemeToColorScale, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
87696
87744
|
|
|
87697
|
-
__info__.version = "19.4.
|
|
87698
|
-
__info__.date = "2026-
|
|
87699
|
-
__info__.hash = "
|
|
87745
|
+
__info__.version = "19.4.12";
|
|
87746
|
+
__info__.date = "2026-09-10T05:38:01.898Z";
|
|
87747
|
+
__info__.hash = "cdb63b4";
|