@odoo/o-spreadsheet 19.5.0-alpha.12 → 19.5.0-alpha.14

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.
Files changed (39) hide show
  1. package/dist/o_spreadsheet.cjs +625 -563
  2. package/dist/o_spreadsheet.css +38 -22
  3. package/dist/o_spreadsheet.esm.js +625 -563
  4. package/dist/o_spreadsheet.iife.js +625 -563
  5. package/dist/o_spreadsheet.min.iife.js +300 -300
  6. package/dist/o_spreadsheet.xml +80 -67
  7. package/dist/types/components/figures/figure_container/figure_container.d.ts +6 -2
  8. package/dist/types/components/helpers/figure_drag_helper.d.ts +3 -3
  9. package/dist/types/components/helpers/figure_snap_helper.d.ts +8 -3
  10. package/dist/types/components/link/link_editor/link_editor.d.ts +1 -0
  11. package/dist/types/components/side_panel/carousel_panel/carousel_panel.d.ts +1 -1
  12. package/dist/types/components/side_panel/chart/chart_type_picker_popover/chart_type_picker_popover.d.ts +12 -12
  13. package/dist/types/components/side_panel/chart/scorecard_chart_panel/scorecard_chart_config_panel.d.ts +6 -10
  14. package/dist/types/components/side_panel/find_and_replace/find_and_replace.d.ts +1 -0
  15. package/dist/types/components/side_panel/find_and_replace/find_and_replace_store.d.ts +2 -1
  16. package/dist/types/components/side_panel/table_style_editor_panel/table_style_editor_panel.d.ts +2 -0
  17. package/dist/types/constants.d.ts +0 -1
  18. package/dist/types/helpers/color_themes.d.ts +2 -0
  19. package/dist/types/helpers/figures/chart.d.ts +3 -2
  20. package/dist/types/helpers/figures/charts/chart_common.d.ts +2 -2
  21. package/dist/types/helpers/figures/charts/chart_ui_common.d.ts +3 -3
  22. package/dist/types/helpers/figures/charts/runtime/chart_data_extractor.d.ts +11 -10
  23. package/dist/types/helpers/owl3_helpers.d.ts +4 -0
  24. package/dist/types/index.d.ts +0 -1
  25. package/dist/types/owl3_compatibility_layer.d.ts +1 -14
  26. package/dist/types/plugins/ui_core_views/evaluation_chart.d.ts +6 -5
  27. package/dist/types/plugins/ui_feature/chart_ui.d.ts +6 -0
  28. package/dist/types/plugins/ui_feature/color_theme.d.ts +0 -3
  29. package/dist/types/registries/chart_registry.d.ts +2 -2
  30. package/dist/types/registries/figures_registry.d.ts +1 -1
  31. package/dist/types/stores/main_viewport_store.d.ts +3 -0
  32. package/dist/types/stores/viewports_store.d.ts +0 -1
  33. package/dist/types/types/chart/chart.d.ts +3 -1
  34. package/dist/types/types/chart/scorecard_chart.d.ts +3 -4
  35. package/dist/types/types/commands.d.ts +15 -17
  36. package/dist/types/types/getters.d.ts +2 -1
  37. package/dist/types/types/model.d.ts +2 -1
  38. package/dist/types/types/rendering.d.ts +2 -0
  39. package/package.json +4 -3
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 19.5.0-alpha.12
6
- * @date 2026-08-19T09:47:03.774Z
7
- * @hash 68ca68e
5
+ * @version 19.5.0-alpha.14
6
+ * @date 2026-08-29T09:17:09.184Z
7
+ * @hash e8ad6ad
8
8
  */
9
9
 
10
10
  import * as owl from "@odoo/owl";
@@ -401,7 +401,13 @@ function createAction(item) {
401
401
  if (isEnabled(env)) return item.execute(env, isMiddleClick);
402
402
  } : void 0,
403
403
  children: children ? (env) => {
404
- return children.map((child) => typeof child === "function" ? child(env) : child).flat().map(createAction).sort((a, b) => a.sequence - b.sequence);
404
+ const uniqueChildren = {};
405
+ children.flatMap((child) => typeof child === "function" ? child(env) : child).forEach((childSpec) => {
406
+ const childAction = createAction(childSpec);
407
+ if (uniqueChildren[childAction.id]) throw new Error(`Duplicate child action id "${childAction.id}" in action "${itemId}".`);
408
+ uniqueChildren[childAction.id] = childAction;
409
+ });
410
+ return Object.values(uniqueChildren).sort((a, b) => a.sequence - b.sequence);
405
411
  } : () => [],
406
412
  isReadonlyAllowed: item.isReadonlyAllowed || false,
407
413
  isEnabledOnLockedSheet: item.isEnabledOnLockedSheet || false,
@@ -2631,7 +2637,6 @@ function unregisterChartJsExtensions() {
2631
2637
  *
2632
2638
  * 1. Update template directives:
2633
2639
  * - replace `t-portal` → `t-custom-portal`
2634
- * - replace `t-model` → `t-custom-model`
2635
2640
  *
2636
2641
  * 2. Load this file immediately after Owl 3.
2637
2642
  *
@@ -2646,35 +2651,23 @@ function unregisterChartJsExtensions() {
2646
2651
  * Gradually remove the compatibility layer by migrating to native Owl 3:
2647
2652
  *
2648
2653
  * - replace `t-custom-portal` with proper Owl 3 portal usage
2649
- * - replace `t-custom-model` with `t-model` + signals
2650
2654
  * - convert `useLayoutEffect` back to `useEffect` where appropriate
2651
2655
  *
2652
2656
  * The end goal is to eliminate all compatibility shims.
2653
2657
  */
2654
- const { __ODOO_COMPATIBILITY_LAYER_ADDED__, blockDom: blockDom$1, config, onMounted: onMounted$1, onPatched: onPatched$1, onWillUnmount: onWillUnmount$1, App: OwlApp, Component: OwlComponent, EnvPlugin: OwlEnvPlugin, useChildEnv: OwlUseChildEnv, useChildSubEnv: OwlUseChildSubEnv, useComponent: OwlUseComponent, useEnv: OwlUseEnv, useExternalListener: OwlUseExternalListener, useLayoutEffect: OwlUseLayoutEffect, useSubEnv: OwlUseSubEnv, Plugin, plugin, props, providePlugins, useScope, xml: xml$1 } = owl;
2658
+ const { __ODOO_COMPATIBILITY_LAYER_ADDED__, blockDom: blockDom$1, config, onMounted: onMounted$1, onPatched: onPatched$1, onWillUnmount: onWillUnmount$1, App: OwlApp, Component: OwlComponent, EnvPlugin: OwlEnvPlugin, useComponent: OwlUseComponent, useEnv: OwlUseEnv, useLayoutEffect: OwlUseLayoutEffect, useSubEnv: OwlUseSubEnv, Plugin, usePlugin, useProps: useProps$1, providePlugins, useScope, xml: xml$1 } = owl;
2655
2659
  const isOdooCompatLoaded = __ODOO_COMPATIBILITY_LAYER_ADDED__ === true;
2656
2660
  var _Component = class extends OwlComponent {
2657
- static template = "";
2658
2661
  env;
2659
2662
  constructor(node) {
2660
2663
  super(node);
2661
- this.env = useChildEnv();
2662
- this.__owl__ = node;
2664
+ this.env = _useEnv();
2663
2665
  }
2664
2666
  setup() {}
2665
- render(deep = false) {
2666
- this.__owl__.render(deep === true);
2667
- }
2668
2667
  };
2669
2668
  function _useComponent() {
2670
2669
  return useScope().component;
2671
2670
  }
2672
- function _useExternalListener(target, eventName, handler, eventParams) {
2673
- const node = useScope();
2674
- const boundHandler = handler.bind(node.component);
2675
- onMounted$1(() => target.addEventListener(eventName, boundHandler, eventParams));
2676
- onWillUnmount$1(() => target.removeEventListener(eventName, boundHandler, eventParams));
2677
- }
2678
2671
  function onWillRender(cb) {
2679
2672
  const node = useScope();
2680
2673
  const renderFn = node.renderFn;
@@ -2712,27 +2705,14 @@ var _EnvPlugin = class extends Plugin {
2712
2705
  env = config("env") ?? {};
2713
2706
  };
2714
2707
  function _useEnv() {
2715
- return useScope().component.env;
2716
- }
2717
- function provideEnv(env) {
2718
- providePlugins([_EnvPlugin], { env });
2719
- return env;
2720
- }
2721
- function extendEnv(extension) {
2722
- const env = useChildEnv();
2723
- const subEnv = Object.create(env);
2724
- Object.defineProperties(subEnv, Object.getOwnPropertyDescriptors(extension));
2725
- return provideEnv(subEnv);
2708
+ return usePlugin(_EnvPlugin).env;
2726
2709
  }
2727
2710
  function _useSubEnv(extension) {
2728
- const component = useScope().component;
2729
- component.env = extendEnv(extension);
2730
- }
2731
- function _useChildSubEnv(extension) {
2732
- extendEnv(extension);
2733
- }
2734
- function _useChildEnv() {
2735
- return plugin(_EnvPlugin).env;
2711
+ const subEnv = Object.create(_useEnv());
2712
+ Object.defineProperties(subEnv, Object.getOwnPropertyDescriptors(extension));
2713
+ providePlugins([_EnvPlugin], { env: subEnv });
2714
+ const component = _useComponent();
2715
+ component.env = subEnv;
2736
2716
  }
2737
2717
  var VPortal = class extends blockDom$1.text("").constructor {
2738
2718
  /**
@@ -2781,7 +2761,7 @@ var Portal = class extends OwlComponent {
2781
2761
  static template = xml$1`<t t-call-slot="default"/>`;
2782
2762
  constructor(node) {
2783
2763
  super(node);
2784
- this.props = props();
2764
+ this.props = useProps$1();
2785
2765
  this.__owl__ = node;
2786
2766
  }
2787
2767
  setup() {
@@ -2814,18 +2794,6 @@ const customDirectives = {
2814
2794
  /**
2815
2795
  * @param {HTMLElement} node
2816
2796
  * @param {string} value
2817
- * @param {string[]} modifiers
2818
- */
2819
- model: (node, value, modifiers) => {
2820
- let attribute = "t-model";
2821
- for (const modifier of modifiers) attribute += `.${modifier}`;
2822
- const getter = `() => ${value}`;
2823
- const setter = `(nv) => {${value} = nv;}`;
2824
- node.setAttribute(attribute, `__globals__.createModelSignal(${getter}, ${setter})`);
2825
- },
2826
- /**
2827
- * @param {HTMLElement} node
2828
- * @param {string} value
2829
2797
  */
2830
2798
  portal: (node, value) => {
2831
2799
  if (node.nodeName.toLowerCase() !== "t") throw new Error("t-custom-portal should be on a 't' element");
@@ -2854,11 +2822,6 @@ set(value) {
2854
2822
  refInfo.values[refId] = value;
2855
2823
  } };
2856
2824
  },
2857
- /**
2858
- * @param {Function} getter
2859
- * @param {Function} setter
2860
- */
2861
- createModelSignal: (getter, setter) => Object.assign(getter, { set: setter }),
2862
2825
  Portal
2863
2826
  };
2864
2827
  var _App = class extends OwlApp {
@@ -2884,7 +2847,7 @@ var _App = class extends OwlApp {
2884
2847
  createRoot(component, config = {}) {
2885
2848
  if (config.env) component = { [component.name]: class extends component {
2886
2849
  constructor(node) {
2887
- provideEnv(config.env);
2850
+ providePlugins([_EnvPlugin], { env: config.env });
2888
2851
  super(node);
2889
2852
  }
2890
2853
  } }[component.name];
@@ -2893,13 +2856,10 @@ var _App = class extends OwlApp {
2893
2856
  };
2894
2857
  const Component = isOdooCompatLoaded ? OwlComponent : _Component;
2895
2858
  const useComponent = isOdooCompatLoaded ? OwlUseComponent : _useComponent;
2896
- const useExternalListener = isOdooCompatLoaded ? OwlUseExternalListener : _useExternalListener;
2897
2859
  const useLayoutEffect = isOdooCompatLoaded ? OwlUseLayoutEffect : _useLayoutEffect;
2898
2860
  const EnvPlugin = isOdooCompatLoaded ? OwlEnvPlugin : _EnvPlugin;
2899
2861
  const useEnv = isOdooCompatLoaded ? OwlUseEnv : _useEnv;
2900
2862
  const useSubEnv = isOdooCompatLoaded ? OwlUseSubEnv : _useSubEnv;
2901
- const useChildEnv = isOdooCompatLoaded ? OwlUseChildEnv : _useChildEnv;
2902
- const useChildSubEnv = isOdooCompatLoaded ? OwlUseChildSubEnv : _useChildSubEnv;
2903
2863
  const App$1 = isOdooCompatLoaded ? OwlApp : _App;
2904
2864
 
2905
2865
  //#endregion
@@ -5407,7 +5367,7 @@ function _roundFormat(internalFormat) {
5407
5367
  }
5408
5368
  function humanizeNumber({ value, format }, locale) {
5409
5369
  const numberValue = tryToNumber(value, locale);
5410
- if (numberValue === void 0) return "";
5370
+ if (numberValue === void 0) return value?.toString() || "";
5411
5371
  let numberFormat = format;
5412
5372
  if (Math.abs(numberValue) < 1e3) {
5413
5373
  const hasDecimal = numberValue % 1 !== 0;
@@ -7943,7 +7903,8 @@ const readonlyAllowedCommands = /* @__PURE__ */ new Set([
7943
7903
  "UPDATE_CHART",
7944
7904
  "UPDATE_CHART_REGION",
7945
7905
  "UPDATE_CAROUSEL_ACTIVE_ITEM",
7946
- "UPDATE_PIVOT"
7906
+ "UPDATE_PIVOT",
7907
+ "UPDATE_COLOR_SCHEME"
7947
7908
  ]);
7948
7909
  const lockedSheetAllowedCommands = /* @__PURE__ */ new Set([
7949
7910
  "LOCK_SHEET",
@@ -8122,8 +8083,6 @@ let CommandResult = /* @__PURE__ */ function(CommandResult) {
8122
8083
  CommandResult["InvalidXRange"] = "InvalidXRange";
8123
8084
  CommandResult["InvalidLabelRange"] = "InvalidLabelRange";
8124
8085
  CommandResult["InvalidBubbleSizeRange"] = "InvalidBubbleSizeRange";
8125
- CommandResult["InvalidScorecardKeyValue"] = "InvalidScorecardKeyValue";
8126
- CommandResult["InvalidScorecardBaseline"] = "InvalidScorecardBaseline";
8127
8086
  CommandResult["InvalidGaugeDataRange"] = "InvalidGaugeDataRange";
8128
8087
  CommandResult["EmptyGaugeRangeMin"] = "EmptyGaugeRangeMin";
8129
8088
  CommandResult["GaugeRangeMinNaN"] = "GaugeRangeMinNaN";
@@ -9989,6 +9948,46 @@ const NON_RETROCOMPATIBLE_FUNCTIONS = [
9989
9948
  ];
9990
9949
  const CONTENT_TYPES_FILE = "[Content_Types].xml";
9991
9950
 
9951
+ //#endregion
9952
+ //#region src/helpers/color_themes.ts
9953
+ const FROZEN_PANE_HEADER_BORDER_COLOR = "#BCBCBC";
9954
+ const FROZEN_PANE_BORDER_COLOR = "#DADFE8";
9955
+ const HEADER_BORDER_COLOR = "#C0C0C0";
9956
+ const TEXT_HEADER_COLOR = "#666666";
9957
+ const BACKGROUND_HEADER_COLOR = "#F8F9FA";
9958
+ const BACKGROUND_HEADER_SELECTED_COLOR = "#E8EAED";
9959
+ const BACKGROUND_HEADER_ACTIVE_COLOR = "#595959";
9960
+ const COLOR_THEMES = {
9961
+ light: {
9962
+ colorThemeName: "light",
9963
+ backgroundColor: "#FFFFFF",
9964
+ gridBorderColor: "#CECFCF",
9965
+ headerBackgroundColor: BACKGROUND_HEADER_COLOR,
9966
+ headerActiveBackgroundColor: BACKGROUND_HEADER_ACTIVE_COLOR,
9967
+ headerSelectedBackgroundColor: BACKGROUND_HEADER_SELECTED_COLOR,
9968
+ headerTextColor: TEXT_HEADER_COLOR,
9969
+ headerBorderColor: HEADER_BORDER_COLOR,
9970
+ frozenPaneBorderColor: FROZEN_PANE_BORDER_COLOR,
9971
+ frozenPaneHeaderBorderColor: FROZEN_PANE_HEADER_BORDER_COLOR,
9972
+ singleCellSelectionBackgroundColor: "#F3F7FE",
9973
+ multipleCellsSelectionBackgroundColor: "#E9F0FF"
9974
+ },
9975
+ dark: {
9976
+ colorThemeName: "dark",
9977
+ backgroundColor: adaptForDarkMode("#1A1C2E"),
9978
+ gridBorderColor: adaptForDarkMode("#6B706F"),
9979
+ headerBackgroundColor: adaptForDarkMode("#262A36"),
9980
+ headerActiveBackgroundColor: adaptForDarkMode("#3A4052"),
9981
+ headerSelectedBackgroundColor: adaptForDarkMode("#4E566E"),
9982
+ headerTextColor: adaptForDarkMode("#A1A6B3"),
9983
+ headerBorderColor: adaptForDarkMode("#7A7F91"),
9984
+ frozenPaneBorderColor: adaptForDarkMode("#7A7F91"),
9985
+ frozenPaneHeaderBorderColor: adaptForDarkMode("#9FA5BD"),
9986
+ singleCellSelectionBackgroundColor: adaptForDarkMode("#696E8044"),
9987
+ multipleCellsSelectionBackgroundColor: adaptForDarkMode("#828AA044")
9988
+ }
9989
+ };
9990
+
9992
9991
  //#endregion
9993
9992
  //#region src/helpers/figures/charts/chart_common.ts
9994
9993
  const TREND_LINE_XAXIS_ID = "x1";
@@ -10210,9 +10209,8 @@ function truncateLabel(label, maxLen = 20) {
10210
10209
  function isTrendLineAxis(axisID) {
10211
10210
  return axisID === "x1" || axisID === "xMovingAverage";
10212
10211
  }
10213
- function getChartBackgroundColor({ background }, getters) {
10214
- const defaultColor = getters.getSpreadsheetTheme().backgroundColor;
10215
- if (!background) return defaultColor;
10212
+ function getChartBackgroundColor({ background }, colorThemeName) {
10213
+ if (!background) return COLOR_THEMES[colorThemeName].backgroundColor;
10216
10214
  return background;
10217
10215
  }
10218
10216
 
@@ -12010,6 +12008,110 @@ var ChartJsComponent = class extends Component {
12010
12008
  }
12011
12009
  };
12012
12010
 
12011
+ //#endregion
12012
+ //#region src/functions/helper_matrices.ts
12013
+ function getUnitMatrix(n) {
12014
+ const matrix = Array(n);
12015
+ for (let i = 0; i < n; i++) {
12016
+ matrix[i] = Array(n).fill(0);
12017
+ matrix[i][i] = 1;
12018
+ }
12019
+ return matrix;
12020
+ }
12021
+ /**
12022
+ * Invert a matrix and compute its determinant using Gaussian Elimination.
12023
+ *
12024
+ * The Matrix should be a square matrix, and should be indexed [col][row] instead of the
12025
+ * standard mathematical indexing [row][col].
12026
+ */
12027
+ function invertMatrix(M) {
12028
+ if (M.length < 1 || M[0].length < 1) throw new Error("invertMatrix: an empty matrix cannot be inverted.");
12029
+ if (M.length !== M[0].length) throw new Error("invertMatrix: only square matrices are invertible");
12030
+ let determinant = 1;
12031
+ const dim = M.length;
12032
+ const I = getUnitMatrix(dim);
12033
+ const C = M.map((row) => row.slice());
12034
+ for (let pivot = 0; pivot < dim; pivot++) {
12035
+ let diagonalElement = C[pivot][pivot];
12036
+ if (diagonalElement === 0) {
12037
+ for (let row = pivot + 1; row < dim; row++) if (C[pivot][row] !== 0) {
12038
+ swapMatrixRows(C, pivot, row);
12039
+ swapMatrixRows(I, pivot, row);
12040
+ determinant *= -1;
12041
+ break;
12042
+ }
12043
+ diagonalElement = C[pivot][pivot];
12044
+ if (diagonalElement === 0) return { determinant: 0 };
12045
+ }
12046
+ for (let col = 0; col < dim; col++) {
12047
+ C[col][pivot] = C[col][pivot] / diagonalElement;
12048
+ I[col][pivot] = I[col][pivot] / diagonalElement;
12049
+ }
12050
+ determinant *= diagonalElement;
12051
+ for (let row = 0; row < dim; row++) {
12052
+ if (row === pivot) continue;
12053
+ const e = C[pivot][row];
12054
+ for (let col = 0; col < dim; col++) {
12055
+ C[col][row] -= e * C[col][pivot];
12056
+ I[col][row] -= e * I[col][pivot];
12057
+ }
12058
+ }
12059
+ }
12060
+ return {
12061
+ inverted: I,
12062
+ determinant
12063
+ };
12064
+ }
12065
+ function swapMatrixRows(matrix, row1, row2) {
12066
+ for (let i = 0; i < matrix.length; i++) {
12067
+ const tmp = matrix[i][row1];
12068
+ matrix[i][row1] = matrix[i][row2];
12069
+ matrix[i][row2] = tmp;
12070
+ }
12071
+ }
12072
+ /**
12073
+ * Matrix multiplication of 2 matrices.
12074
+ * ex: matrix1 : n x l, matrix2 : m x n => result : m x l
12075
+ *
12076
+ * Note: we use indexing [col][row] instead of the standard mathematical notation [row][col]
12077
+ */
12078
+ function multiplyMatrices(matrix1, matrix2) {
12079
+ if (matrix1.length < 1 || matrix2.length < 1) throw new Error("multiplyMatrices: empty matrices cannot be multiplied.");
12080
+ if (matrix1.length !== matrix2[0].length) throw new Error("multiplyMatrices: incompatible matrices size.");
12081
+ const rowsM1 = matrix1[0].length;
12082
+ const colsM2 = matrix2.length;
12083
+ const n = matrix1.length;
12084
+ const result = Array(colsM2);
12085
+ for (let col = 0; col < colsM2; col++) {
12086
+ result[col] = Array(rowsM1);
12087
+ for (let row = 0; row < rowsM1; row++) {
12088
+ let sum = 0;
12089
+ for (let k = 0; k < n; k++) sum += matrix1[k][row] * matrix2[col][k];
12090
+ result[col][row] = sum;
12091
+ }
12092
+ }
12093
+ return result;
12094
+ }
12095
+ /**
12096
+ * Return the input if it's a scalar or the first element of the input if it's a matrix.
12097
+ */
12098
+ function toScalar(arg) {
12099
+ if (!isMatrix(arg)) return arg;
12100
+ if (!isSingleElementMatrix(arg)) throw new Error("The value should be a scalar or a 1x1 matrix");
12101
+ return arg[0][0];
12102
+ }
12103
+ function isSingleElementMatrix(matrix) {
12104
+ return matrix.length === 1 && matrix[0].length === 1;
12105
+ }
12106
+ function isMultipleElementMatrix(arg) {
12107
+ return isMatrix(arg) && !isSingleElementMatrix(arg);
12108
+ }
12109
+ function getMatrixArgIndices(args) {
12110
+ const indices = [];
12111
+ for (let i = 0; i < args.length; i++) if (isMultipleElementMatrix(args[i])) indices.push(i);
12112
+ return indices;
12113
+ }
12114
+
12013
12115
  //#endregion
12014
12116
  //#region src/helpers/figures/charts/abstract_chart.ts
12015
12117
  var AbstractChart = class {
@@ -12025,11 +12127,42 @@ var AbstractChart = class {
12025
12127
 
12026
12128
  //#endregion
12027
12129
  //#region src/helpers/figures/charts/scorecard_chart.ts
12130
+ function getData$1(value, getters, sheetId) {
12131
+ if (!value) return {
12132
+ scalar: void 0,
12133
+ range: void 0
12134
+ };
12135
+ if (!isFormula(value)) return {
12136
+ scalar: { value },
12137
+ range: void 0
12138
+ };
12139
+ const result = getters.evaluateFormulaResult(sheetId, value);
12140
+ let scalar = isMultipleElementMatrix(result) ? result[0][0] : toScalar(result);
12141
+ let range = void 0;
12142
+ const xc = getFormulaRangeXc(value);
12143
+ if (xc) {
12144
+ range = createValidRange(getters, sheetId, xc);
12145
+ if (range) {
12146
+ if (getters.getEvaluatedCell({
12147
+ sheetId: range.sheetId,
12148
+ col: range.zone.left,
12149
+ row: range.zone.top
12150
+ }).type === "empty") scalar = void 0;
12151
+ }
12152
+ }
12153
+ return {
12154
+ scalar,
12155
+ range
12156
+ };
12157
+ }
12028
12158
  function getBaselineText(baseline, keyValue, baselineMode, humanizeNumbers, locale) {
12029
12159
  if (!baseline) return "";
12030
- else if (baselineMode === "text" || keyValue?.type !== "number" || baseline.type !== "number") {
12160
+ else if (baselineMode === "text" || typeof keyValue?.value !== "number" || typeof baseline.value !== "number") {
12031
12161
  if (humanizeNumbers) return humanizeNumber(baseline, locale);
12032
- return baseline.formattedValue;
12162
+ return formatValue(baseline.value, {
12163
+ format: baseline.format,
12164
+ locale
12165
+ });
12033
12166
  }
12034
12167
  let { value, format } = baseline;
12035
12168
  if (baselineMode === "progress") {
@@ -12050,29 +12183,31 @@ function getBaselineText(baseline, keyValue, baselineMode, humanizeNumbers, loca
12050
12183
  locale
12051
12184
  });
12052
12185
  }
12053
- function getKeyValueText(keyValueCell, humanizeNumbers, locale) {
12054
- if (!keyValueCell) return "";
12055
- if (humanizeNumbers) return humanizeNumber(keyValueCell, locale);
12056
- return keyValueCell.formattedValue ?? String(keyValueCell.value ?? "");
12186
+ function getKeyValueText(keyValue, humanizeNumbers, locale) {
12187
+ if (keyValue?.value === void 0 || keyValue?.value === null) return "";
12188
+ if (humanizeNumbers) return humanizeNumber(keyValue, locale);
12189
+ return keyValue.format ? formatValue(keyValue.value, {
12190
+ format: keyValue.format,
12191
+ locale
12192
+ }) : String(keyValue.value ?? "");
12057
12193
  }
12058
12194
  function getBaselineColor(baseline, baselineMode, keyValue, colorUp, colorDown) {
12059
- if (baselineMode === "text" || baselineMode === "progress" || baseline?.type !== "number" || keyValue?.type !== "number") return;
12195
+ if (baselineMode === "text" || baselineMode === "progress" || typeof baseline?.value !== "number" || typeof keyValue?.value !== "number") return;
12060
12196
  const diff = keyValue.value - baseline.value;
12061
12197
  if (diff > 0) return colorUp;
12062
12198
  else if (diff < 0) return colorDown;
12063
12199
  }
12064
12200
  function getBaselineArrowDirection(baseline, keyValue, baselineMode) {
12065
- if (baselineMode === "text" || baseline?.type !== "number" || keyValue?.type !== "number") return "neutral";
12201
+ if (baselineMode === "text" || typeof baseline?.value !== "number" || typeof keyValue?.value !== "number") return "neutral";
12066
12202
  const diff = keyValue.value - baseline.value;
12067
12203
  if (diff > 0) return "up";
12068
12204
  else if (diff < 0) return "down";
12069
12205
  return "neutral";
12070
12206
  }
12071
- function checkKeyValue(definition) {
12072
- return definition.keyValue && !rangeReference.test(definition.keyValue) ? "InvalidScorecardKeyValue" : "Success";
12073
- }
12074
- function checkBaseline(definition) {
12075
- return definition.baseline && !rangeReference.test(definition.baseline) ? "InvalidScorecardBaseline" : "Success";
12207
+ function getFormulaRangeXc(formula) {
12208
+ if (!formula || !isFormula(formula)) return;
12209
+ const content = formula.slice(1);
12210
+ return rangeReference.test(content) ? content : void 0;
12076
12211
  }
12077
12212
  const Path2DConstructor = globalThis.Path2D;
12078
12213
  const arrowDownPath = Path2DConstructor && new Path2DConstructor("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z");
@@ -12089,84 +12224,76 @@ const ScorecardChart$1 = {
12089
12224
  "baselineColorUp",
12090
12225
  "baselineColorDown"
12091
12226
  ],
12092
- fromStrDefinition(definition, sheetId, getters) {
12093
- const baseline = createValidRange(getters, sheetId, definition.baseline);
12094
- const keyValue = createValidRange(getters, sheetId, definition.keyValue);
12227
+ fromStrDefinition: (definition) => definition,
12228
+ validateDefinition(validator, definition) {
12229
+ return "Success";
12230
+ },
12231
+ copyInSheetId: (definition, sheetIdFrom, sheetIdTo, getters) => {
12232
+ const adaptFormula = (formula) => getters.copyFormulaStringForSheet(sheetIdFrom, sheetIdTo, formula, "keepSameReference");
12095
12233
  return {
12096
12234
  ...definition,
12097
- baseline,
12098
- keyValue
12235
+ keyValue: definition.keyValue ? adaptFormula(definition.keyValue) : definition.keyValue,
12236
+ baseline: definition.baseline ? adaptFormula(definition.baseline) : definition.baseline
12099
12237
  };
12100
12238
  },
12101
- validateDefinition(validator, definition) {
12102
- return validator.checkValidations(definition, checkKeyValue, checkBaseline);
12103
- },
12104
- copyInSheetId: (definition) => definition,
12105
12239
  getDefinitionFromContextCreation(context, dataSourceBuilder) {
12240
+ const dataRange = context.dataSource?.type === "range" ? context.dataSource?.dataSets?.[0]?.dataRange : void 0;
12241
+ const keyValue = (context.scorecardKeyValueFormula === void 0 || getFormulaRangeXc(context.scorecardKeyValueFormula)) && dataRange ? `=${dataRange}` : context.scorecardKeyValueFormula;
12242
+ const baseline = (context.scorecardBaselineFormula === void 0 || getFormulaRangeXc(context.scorecardBaselineFormula)) && context.auxiliaryRange ? `=${context.auxiliaryRange}` : context.scorecardBaselineFormula;
12106
12243
  return {
12107
12244
  background: context.background,
12108
12245
  type: "scorecard",
12109
- keyValue: context.dataSource?.type === "range" ? context.dataSource?.dataSets?.[0]?.dataRange : void 0,
12246
+ keyValue,
12110
12247
  title: context.title || { text: "" },
12111
12248
  baselineMode: DEFAULT_SCORECARD_BASELINE_MODE,
12112
12249
  baselineColorUp: DEFAULT_SCORECARD_BASELINE_COLOR_UP,
12113
12250
  baselineColorDown: DEFAULT_SCORECARD_BASELINE_COLOR_DOWN,
12114
- baseline: context.auxiliaryRange || "",
12251
+ baseline,
12115
12252
  humanize: context.humanize,
12116
12253
  annotationLink: context.annotationLink,
12117
12254
  annotationText: context.annotationText
12118
12255
  };
12119
12256
  },
12120
- transformDefinition(definition, chartSheetId, { adaptRangeString }) {
12257
+ transformDefinition(definition, chartSheetId, { adaptFormulaString }) {
12121
12258
  let baseline;
12122
12259
  let keyValue;
12123
- if (definition.baseline) {
12124
- const { changeType, range: adaptedRange } = adaptRangeString(chartSheetId, definition.baseline);
12125
- if (changeType !== "REMOVE") baseline = adaptedRange;
12126
- }
12127
- if (definition.keyValue) {
12128
- const { changeType, range: adaptedRange } = adaptRangeString(chartSheetId, definition.keyValue);
12129
- if (changeType !== "REMOVE") keyValue = adaptedRange;
12130
- }
12131
- return {
12132
- ...definition,
12133
- baseline,
12134
- keyValue
12135
- };
12136
- },
12137
- duplicateInDuplicatedSheet(definition, sheetIdFrom, sheetIdTo) {
12138
- const baseline = duplicateLabelRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, definition.baseline);
12139
- const keyValue = duplicateLabelRangeInDuplicatedSheet(sheetIdFrom, sheetIdTo, definition.keyValue);
12260
+ if (definition.baseline) baseline = adaptFormulaString(chartSheetId, definition.baseline);
12261
+ if (definition.keyValue) keyValue = adaptFormulaString(chartSheetId, definition.keyValue);
12140
12262
  return {
12141
12263
  ...definition,
12142
12264
  baseline,
12143
12265
  keyValue
12144
12266
  };
12145
12267
  },
12146
- toStrDefinition(definition, sheetId, getters) {
12268
+ duplicateInDuplicatedSheet(definition, sheetIdFrom, sheetIdTo, getters) {
12269
+ const adaptFormula = (formula) => getters.copyFormulaStringForSheet(sheetIdFrom, sheetIdTo, formula, "moveReference");
12147
12270
  return {
12148
12271
  ...definition,
12149
- keyValue: definition.keyValue ? getters.getRangeString(definition.keyValue, sheetId) : void 0,
12150
- baseline: definition.baseline ? getters.getRangeString(definition.baseline, sheetId) : void 0
12272
+ keyValue: definition.keyValue ? adaptFormula(definition.keyValue) : definition.keyValue,
12273
+ baseline: definition.baseline ? adaptFormula(definition.baseline) : definition.baseline
12151
12274
  };
12152
12275
  },
12276
+ toStrDefinition: (definition) => definition,
12153
12277
  getContextCreation(definition, dataSource) {
12278
+ const keyValueXc = getFormulaRangeXc(definition.keyValue);
12154
12279
  return {
12155
12280
  ...definition,
12156
12281
  dataSource: {
12157
12282
  type: "range",
12158
- dataSets: definition.keyValue ? [{
12159
- dataRange: definition.keyValue,
12283
+ dataSets: keyValueXc ? [{
12284
+ dataRange: keyValueXc,
12160
12285
  dataSetId: "0"
12161
12286
  }] : []
12162
12287
  },
12163
- auxiliaryRange: definition.baseline
12288
+ auxiliaryRange: getFormulaRangeXc(definition.baseline),
12289
+ scorecardKeyValueFormula: definition.keyValue,
12290
+ scorecardBaselineFormula: definition.baseline
12164
12291
  };
12165
12292
  },
12166
12293
  getDefinitionForExcel: () => void 0,
12167
- updateRanges(definition, adapterFunctions) {
12168
- const baseline = adaptChartRange(definition.baseline, adapterFunctions);
12169
- const keyValue = adaptChartRange(definition.keyValue, adapterFunctions);
12294
+ updateRanges(definition, adapterFunctions, sheetId) {
12295
+ const baseline = definition.baseline ? adapterFunctions.adaptFormulaString(sheetId, definition.baseline) : definition.baseline;
12296
+ const keyValue = definition.keyValue ? adapterFunctions.adaptFormulaString(sheetId, definition.keyValue) : definition.keyValue;
12170
12297
  if (definition.baseline === baseline && definition.keyValue === keyValue) return definition;
12171
12298
  return {
12172
12299
  ...definition,
@@ -12174,32 +12301,21 @@ const ScorecardChart$1 = {
12174
12301
  keyValue
12175
12302
  };
12176
12303
  },
12177
- getFormulas: () => [],
12178
- getRuntime(getters, definition) {
12304
+ getFormulas(getters, sheetId, definition) {
12305
+ const formulas = [];
12306
+ if (definition.keyValue && isFormula(definition.keyValue)) formulas.push(CompiledFormula.Compile(definition.keyValue, sheetId, getters));
12307
+ if (definition.baseline && isFormula(definition.baseline)) formulas.push(CompiledFormula.Compile(definition.baseline, sheetId, getters));
12308
+ return formulas;
12309
+ },
12310
+ getRuntime(getters, definition, _dataExtractor, sheetId, eventHandlers, colorThemeName) {
12179
12311
  let formattedKeyValue = "";
12180
- let keyValueCell;
12312
+ const { scalar: keyValue, range: keyValueRange } = getData$1(definition.keyValue, getters, sheetId);
12181
12313
  const locale = getters.getLocale();
12182
- if (definition.keyValue) {
12183
- const keyValuePosition = {
12184
- sheetId: definition.keyValue.sheetId,
12185
- col: definition.keyValue.zone.left,
12186
- row: definition.keyValue.zone.top
12187
- };
12188
- keyValueCell = getters.getEvaluatedCell(keyValuePosition);
12189
- formattedKeyValue = getKeyValueText(keyValueCell, definition.humanize ?? true, locale);
12190
- }
12191
- let baselineCell;
12192
- const baseline = definition.baseline;
12193
- if (baseline) {
12194
- const baselinePosition = {
12195
- sheetId: baseline.sheetId,
12196
- col: baseline.zone.left,
12197
- row: baseline.zone.top
12198
- };
12199
- baselineCell = getters.getEvaluatedCell(baselinePosition);
12200
- }
12201
- const { background, fontColor } = getters.getStyleOfSingleCellChart(definition.background, definition.keyValue);
12202
- const baselineDisplay = getBaselineText(baselineCell, keyValueCell, definition.baselineMode, definition.humanize ?? true, locale);
12314
+ if (keyValue !== null && keyValue !== void 0) formattedKeyValue = getKeyValueText(keyValue, definition.humanize ?? true, locale);
12315
+ else formattedKeyValue = "";
12316
+ const { scalar: baseline, range: baselineRange } = getData$1(definition.baseline, getters, sheetId);
12317
+ const { background, fontColor } = getters.getStyleOfSingleCellChart(definition.background, keyValueRange, colorThemeName);
12318
+ const baselineDisplay = getBaselineText(baseline, keyValue, definition.baselineMode, definition.humanize ?? true, locale);
12203
12319
  const baselineValue = definition.baselineMode === "progress" && isNumber(baselineDisplay, locale) ? toNumber(baselineDisplay, locale) : 0;
12204
12320
  const title = definition.title;
12205
12321
  return {
@@ -12210,16 +12326,16 @@ const ScorecardChart$1 = {
12210
12326
  keyValue: formattedKeyValue,
12211
12327
  keyDescr: definition.keyDescr?.text ? getters.dynamicTranslate(definition.keyDescr.text) : "",
12212
12328
  baselineDisplay,
12213
- baselineArrow: getBaselineArrowDirection(baselineCell, keyValueCell, definition.baselineMode),
12214
- baselineColor: getBaselineColor(baselineCell, definition.baselineMode, keyValueCell, definition.baselineColorUp, definition.baselineColorDown),
12329
+ baselineArrow: getBaselineArrowDirection(baseline, keyValue, definition.baselineMode),
12330
+ baselineColor: getBaselineColor(baseline, definition.baselineMode, keyValue, definition.baselineColorUp, definition.baselineColorDown),
12215
12331
  baselineDescr: definition.baselineMode !== "progress" && definition.baselineDescr?.text ? getters.dynamicTranslate(definition.baselineDescr.text) : "",
12216
12332
  fontColor,
12217
12333
  background,
12218
12334
  baselineStyle: {
12219
- ...definition.baselineMode !== "percentage" && definition.baselineMode !== "progress" && baseline ? getters.getCellComputedStyle({
12220
- sheetId: baseline.sheetId,
12221
- col: baseline.zone.left,
12222
- row: baseline.zone.top
12335
+ ...definition.baselineMode !== "percentage" && definition.baselineMode !== "progress" && baselineRange ? getters.getCellComputedStyle({
12336
+ sheetId: baselineRange.sheetId,
12337
+ col: baselineRange.zone.left,
12338
+ row: baselineRange.zone.top
12223
12339
  }) : void 0,
12224
12340
  fontSize: definition.baselineDescr?.fontSize,
12225
12341
  align: definition.baselineDescr?.align
@@ -12229,10 +12345,10 @@ const ScorecardChart$1 = {
12229
12345
  ...definition.baselineDescr
12230
12346
  },
12231
12347
  keyValueStyle: {
12232
- ...definition.keyValue ? getters.getCellComputedStyle({
12233
- sheetId: definition.keyValue.sheetId,
12234
- col: definition.keyValue.zone.left,
12235
- row: definition.keyValue.zone.top
12348
+ ...keyValueRange ? getters.getCellComputedStyle({
12349
+ sheetId: keyValueRange.sheetId,
12350
+ col: keyValueRange.zone.left,
12351
+ row: keyValueRange.zone.top
12236
12352
  }) : void 0,
12237
12353
  fontSize: definition.keyDescr?.fontSize,
12238
12354
  align: definition.keyDescr?.align
@@ -13734,33 +13850,8 @@ var ViewportsStore = class extends SpreadsheetStore {
13734
13850
  displayedSheetId = this.model.getters.getActiveSheetId();
13735
13851
  constructor(get) {
13736
13852
  super(get);
13737
- this.model.selection.observe(this, { handleEvent: this.handleEvent.bind(this) });
13738
- this.onDispose(() => {
13739
- this.model.selection.unobserve(this);
13740
- });
13741
13853
  this.viewports.resetViewports(this.displayedSheetId);
13742
13854
  }
13743
- handleEvent(event) {
13744
- const eventSheetId = this.getters.getActiveSheetId();
13745
- if (event.options.scrollIntoView) {
13746
- const oldZone = event.previousAnchor.zone;
13747
- const newZone = event.anchor.zone;
13748
- const isUpdateAnchorEvent = event.mode === "updateAnchor";
13749
- const sameZone = isEqual(oldZone, newZone);
13750
- let { col, row } = isUpdateAnchorEvent && sameZone ? event.anchor.cell : findCellInNewZone(oldZone, newZone);
13751
- if (isUpdateAnchorEvent && !sameZone) {
13752
- const { top, bottom, left, right } = this.viewports.getMainInternalViewport(eventSheetId);
13753
- if (oldZone.left === newZone.left && oldZone.right === newZone.right) col = left > col || col > right ? left : col;
13754
- if (oldZone.top === newZone.top && oldZone.bottom === newZone.bottom) row = top > row || row > bottom ? top : row;
13755
- }
13756
- col = Math.min(col, this.getters.getNumberCols(eventSheetId) - 1);
13757
- row = Math.min(row, this.getters.getNumberRows(eventSheetId) - 1);
13758
- if (!this.sheetsWithDirtyViewports.has(eventSheetId)) this.viewports.refreshViewport(eventSheetId, {
13759
- col,
13760
- row
13761
- });
13762
- }
13763
- }
13764
13855
  handle(cmd) {
13765
13856
  if (invalidateEvaluationCommands.has(cmd.type)) for (const sheetId of this.getters.getSheetIds()) this.sheetsWithDirtyViewports.add(sheetId);
13766
13857
  switch (cmd.type) {
@@ -13860,6 +13951,7 @@ var ViewportsStore = class extends SpreadsheetStore {
13860
13951
  this.shiftVertically(topRowDims.end - boundaryTopY - viewportHeight);
13861
13952
  }
13862
13953
  scrollToCell(sheetId, col, row) {
13954
+ if (this.sheetsWithDirtyViewports.has(sheetId)) return;
13863
13955
  this.viewports.refreshViewport(sheetId, {
13864
13956
  col,
13865
13957
  row
@@ -14462,22 +14554,35 @@ function sampleIndices(length, maxPoints) {
14462
14554
  const step = length / maxPoints;
14463
14555
  return Array.from({ length: maxPoints }, (_, i) => Math.min(length - 1, Math.floor(i * step)));
14464
14556
  }
14465
- async function chartToImageUrl(runtime, figure, type) {
14557
+ async function chartToImageUrl(runtime, figure, type, colorThemeName = "light") {
14466
14558
  try {
14467
14559
  const canvas = createRenderingSurface(figure.width, figure.height);
14468
14560
  const cleanup = drawChartOnCanvas(canvas, runtime, figure, type);
14469
- const imageUrl = await canvasToObjectUrl(canvas);
14561
+ const imageUrl = await canvasToObjectUrl(colorThemeName === "dark" ? applyDarkMode(canvas) : canvas);
14470
14562
  cleanup();
14471
14563
  return imageUrl;
14472
14564
  } catch (error) {
14473
14565
  console.log("Error exporting chart to image URL: " + error.message);
14474
14566
  }
14475
14567
  }
14476
- async function chartToImageFile(runtime, figure, type) {
14568
+ /**
14569
+ * Charts are drawn with pre-inverted colors (see `adaptForDarkMode`) because they are displayed
14570
+ * through the `os-theme-dependant` CSS filter. An exported image doesn't get that filter, so it
14571
+ * has to be applied to the pixels to obtain what is actually displayed on screen.
14572
+ */
14573
+ function applyDarkMode(canvas) {
14574
+ const filtered = createRenderingSurface(canvas.width, canvas.height);
14575
+ const ctx = filtered.getContext("2d");
14576
+ if (!ctx || !("filter" in ctx)) return canvas;
14577
+ ctx.filter = DARK_MODE_FILTER_STRING;
14578
+ ctx.drawImage(canvas, 0, 0);
14579
+ return filtered;
14580
+ }
14581
+ async function chartToImageFile(runtime, figure, type, colorThemeName = "light") {
14477
14582
  try {
14478
14583
  const canvas = createRenderingSurface(figure.width, figure.height);
14479
14584
  const cleanup = drawChartOnCanvas(canvas, runtime, figure, type);
14480
- const chartBlob = await canvasToBlob(canvas);
14585
+ const chartBlob = await canvasToBlob(colorThemeName === "dark" ? applyDarkMode(canvas) : canvas);
14481
14586
  cleanup();
14482
14587
  return chartBlob;
14483
14588
  } catch (error) {
@@ -14785,7 +14890,7 @@ function getCopyAsImageMenuItem(figureId, env) {
14785
14890
  const chartId = env.model.getters.getChartIdFromFigureId(figureId);
14786
14891
  if (!chartId) return;
14787
14892
  const chartType = env.model.getters.getChartType(chartId);
14788
- const blob = await chartToImageFile(env.model.getters.getChartRuntime(chartId), figure, chartType);
14893
+ const blob = await chartToImageFile(env.model.getters.getChartRuntime(chartId), figure, chartType, env.model.getters.getSpreadsheetTheme().colorThemeName);
14789
14894
  if (!blob) return;
14790
14895
  const image = await new Promise((resolve) => {
14791
14896
  const reader = new FileReader();
@@ -14822,7 +14927,7 @@ function getDownloadChartMenuItem(figureId, env) {
14822
14927
  const chartId = env.model.getters.getChartIdFromFigureId(figureId);
14823
14928
  if (!chartId) return;
14824
14929
  const chartType = env.model.getters.getChartType(chartId);
14825
- const url = await chartToImageUrl(env.model.getters.getChartRuntime(chartId), figure, chartType);
14930
+ const url = await chartToImageUrl(env.model.getters.getChartRuntime(chartId), figure, chartType, env.model.getters.getSpreadsheetTheme().colorThemeName);
14826
14931
  if (!url) return;
14827
14932
  downloadFile(url, "chart");
14828
14933
  },
@@ -16371,8 +16476,8 @@ var MenuPopover = class MenuPopover extends Component {
16371
16476
  useLayoutEffect(() => {
16372
16477
  if (!this.props.disableKeyboardNavigation && !this.state.hoveredMenu && !this.subMenu.isOpen) this.menuRef()?.focus();
16373
16478
  });
16374
- useExternalListener(window, "click", this.onExternalClick, { capture: true });
16375
- useExternalListener(window, "contextmenu", this.onExternalClick, { capture: true });
16479
+ useListener(window, "click", this.onExternalClick.bind(this), { capture: true });
16480
+ useListener(window, "contextmenu", this.onExternalClick.bind(this), { capture: true });
16376
16481
  onWillUpdateProps((nextProps) => {
16377
16482
  if (nextProps.menuItems !== this.props.menuItems) this.closeSubMenu();
16378
16483
  });
@@ -16952,110 +17057,6 @@ function isSquareMatrix(arg) {
16952
17057
  }
16953
17058
  const expectNumberGreaterThanOrEqualToOne = (value) => _t("The function [[FUNCTION_NAME]] expects a number value to be greater than or equal to 1, but receives %s.", value);
16954
17059
 
16955
- //#endregion
16956
- //#region src/functions/helper_matrices.ts
16957
- function getUnitMatrix(n) {
16958
- const matrix = Array(n);
16959
- for (let i = 0; i < n; i++) {
16960
- matrix[i] = Array(n).fill(0);
16961
- matrix[i][i] = 1;
16962
- }
16963
- return matrix;
16964
- }
16965
- /**
16966
- * Invert a matrix and compute its determinant using Gaussian Elimination.
16967
- *
16968
- * The Matrix should be a square matrix, and should be indexed [col][row] instead of the
16969
- * standard mathematical indexing [row][col].
16970
- */
16971
- function invertMatrix(M) {
16972
- if (M.length < 1 || M[0].length < 1) throw new Error("invertMatrix: an empty matrix cannot be inverted.");
16973
- if (M.length !== M[0].length) throw new Error("invertMatrix: only square matrices are invertible");
16974
- let determinant = 1;
16975
- const dim = M.length;
16976
- const I = getUnitMatrix(dim);
16977
- const C = M.map((row) => row.slice());
16978
- for (let pivot = 0; pivot < dim; pivot++) {
16979
- let diagonalElement = C[pivot][pivot];
16980
- if (diagonalElement === 0) {
16981
- for (let row = pivot + 1; row < dim; row++) if (C[pivot][row] !== 0) {
16982
- swapMatrixRows(C, pivot, row);
16983
- swapMatrixRows(I, pivot, row);
16984
- determinant *= -1;
16985
- break;
16986
- }
16987
- diagonalElement = C[pivot][pivot];
16988
- if (diagonalElement === 0) return { determinant: 0 };
16989
- }
16990
- for (let col = 0; col < dim; col++) {
16991
- C[col][pivot] = C[col][pivot] / diagonalElement;
16992
- I[col][pivot] = I[col][pivot] / diagonalElement;
16993
- }
16994
- determinant *= diagonalElement;
16995
- for (let row = 0; row < dim; row++) {
16996
- if (row === pivot) continue;
16997
- const e = C[pivot][row];
16998
- for (let col = 0; col < dim; col++) {
16999
- C[col][row] -= e * C[col][pivot];
17000
- I[col][row] -= e * I[col][pivot];
17001
- }
17002
- }
17003
- }
17004
- return {
17005
- inverted: I,
17006
- determinant
17007
- };
17008
- }
17009
- function swapMatrixRows(matrix, row1, row2) {
17010
- for (let i = 0; i < matrix.length; i++) {
17011
- const tmp = matrix[i][row1];
17012
- matrix[i][row1] = matrix[i][row2];
17013
- matrix[i][row2] = tmp;
17014
- }
17015
- }
17016
- /**
17017
- * Matrix multiplication of 2 matrices.
17018
- * ex: matrix1 : n x l, matrix2 : m x n => result : m x l
17019
- *
17020
- * Note: we use indexing [col][row] instead of the standard mathematical notation [row][col]
17021
- */
17022
- function multiplyMatrices(matrix1, matrix2) {
17023
- if (matrix1.length < 1 || matrix2.length < 1) throw new Error("multiplyMatrices: empty matrices cannot be multiplied.");
17024
- if (matrix1.length !== matrix2[0].length) throw new Error("multiplyMatrices: incompatible matrices size.");
17025
- const rowsM1 = matrix1[0].length;
17026
- const colsM2 = matrix2.length;
17027
- const n = matrix1.length;
17028
- const result = Array(colsM2);
17029
- for (let col = 0; col < colsM2; col++) {
17030
- result[col] = Array(rowsM1);
17031
- for (let row = 0; row < rowsM1; row++) {
17032
- let sum = 0;
17033
- for (let k = 0; k < n; k++) sum += matrix1[k][row] * matrix2[col][k];
17034
- result[col][row] = sum;
17035
- }
17036
- }
17037
- return result;
17038
- }
17039
- /**
17040
- * Return the input if it's a scalar or the first element of the input if it's a matrix.
17041
- */
17042
- function toScalar(arg) {
17043
- if (!isMatrix(arg)) return arg;
17044
- if (!isSingleElementMatrix(arg)) throw new Error("The value should be a scalar or a 1x1 matrix");
17045
- return arg[0][0];
17046
- }
17047
- function isSingleElementMatrix(matrix) {
17048
- return matrix.length === 1 && matrix[0].length === 1;
17049
- }
17050
- function isMultipleElementMatrix(arg) {
17051
- return isMatrix(arg) && !isSingleElementMatrix(arg);
17052
- }
17053
- function getMatrixArgIndices(args) {
17054
- const indices = [];
17055
- for (let i = 0; i < args.length; i++) if (isMultipleElementMatrix(args[i])) indices.push(i);
17056
- return indices;
17057
- }
17058
-
17059
17060
  //#endregion
17060
17061
  //#region src/functions/helper_statistical.ts
17061
17062
  function assertSameNumberOfElements(...args) {
@@ -18206,8 +18207,6 @@ const ChartTerms = {
18206
18207
  Unexpected: _t("The chart definition is invalid for an unknown reason"),
18207
18208
  ["InvalidDataSet"]: _t("The dataset is invalid"),
18208
18209
  ["InvalidLabelRange"]: _t("Labels are invalid"),
18209
- ["InvalidScorecardKeyValue"]: _t("The key value is invalid"),
18210
- ["InvalidScorecardBaseline"]: _t("The baseline value is invalid"),
18211
18210
  ["InvalidGaugeDataRange"]: _t("The data range is invalid"),
18212
18211
  ["EmptyGaugeRangeMin"]: _t("A minimum range limit value is needed"),
18213
18212
  ["GaugeRangeMinNaN"]: _t("The minimum range limit value must be a number"),
@@ -20982,7 +20981,7 @@ var GridAddRowsFooter = class extends Component {
20982
20981
  setup() {
20983
20982
  this.DOMFocusableElementStore = useStore(DOMFocusableElementStore);
20984
20983
  this.viewStore = useStore(ViewportsStore);
20985
- useExternalListener(window, "click", this.onExternalClick, { capture: true });
20984
+ useListener(window, "click", this.onExternalClick.bind(this), { capture: true });
20986
20985
  }
20987
20986
  get addRowsPosition() {
20988
20987
  const { scrollY } = this.viewStore.activeSheetScrollInfo;
@@ -21513,7 +21512,7 @@ function useCellHovered(env, gridRef) {
21513
21512
  useListener(gridRef, "mouseenter", resume);
21514
21513
  useListener(gridRef, "pointerdown", recompute);
21515
21514
  useListener(gridRef, "pointerdown", (ev) => env.isMobile() && updateMousePosition(withZoom(env, ev)));
21516
- useExternalListener(window, "click", handleGlobalClick);
21515
+ useListener(window, "click", handleGlobalClick);
21517
21516
  function handleGlobalClick(e) {
21518
21517
  const target = e.target;
21519
21518
  const grid = gridRef();
@@ -21884,7 +21883,7 @@ function getPivotIconSvg(isCollapsed, isHovered) {
21884
21883
  };
21885
21884
  }
21886
21885
  function getDataFilterIcon(isActive, isHighContrast, isHovered) {
21887
- const symbolPath = isActive ? "M18.6 3.5H4.29c-.7 0-1.06.85-.56 1.35l6.1 6.1v6.8c0 .26.13.5.34.65l2.64 1.85a.79.79 0 0 0 1.25-.65v-8.64l6.1-6.1a.79.79 0 0 0-.56-1.35" : "M 339.667 681 L 510.333 681 L 510.333 595.667 L 339.667 595.667 L 339.667 681 Z M 41 169 L 41 254.333 L 809 254.333 L 809 169 L 41 169 Z M 169 467.667 L 681 467.667 L 681 382.333 L 169 382.333 L 169 467.667 Z";
21886
+ const symbolPath = isActive ? "M 11 20 Q 10.575 20 10.2875 19.7125 T 10 19 L 10 13 L 4.2 5.6 Q 3.825 5.1 4.0875 4.55 T 5 4 L 19 4 Q 19.65 4 19.9125 4.55 T 19.8 5.6 L 14 13 L 14 19 Q 14 19.425 13.7125 19.7125 T 13 20 L 11 20 Z" : "M 339.667 681 L 510.333 681 L 510.333 595.667 L 339.667 595.667 L 339.667 681 Z M 41 169 L 41 254.333 L 809 254.333 L 809 169 L 41 169 Z M 169 467.667 L 681 467.667 L 681 382.333 L 169 382.333 L 169 467.667 Z";
21888
21887
  const hoverBackgroundPath = isActive ? "M0,0 h24 v24 h-24" : "M0,0 h850 v850 h-850";
21889
21888
  const colors = {
21890
21889
  iconColor: FILTERS_COLOR,
@@ -23517,7 +23516,7 @@ var Select = class extends Component {
23517
23516
  hoveredValue: void 0
23518
23517
  });
23519
23518
  setup() {
23520
- useExternalListener(window, "pointerdown", this.onExternalClick, { capture: true });
23519
+ useListener(window, "pointerdown", this.onExternalClick.bind(this), { capture: true });
23521
23520
  useLayoutEffect(() => {
23522
23521
  const el = this.dropdownRef();
23523
23522
  if (el) el.style.width = `${this.selectRef()?.offsetWidth}px`;
@@ -23619,7 +23618,7 @@ var InfoPopover = class extends Component {
23619
23618
  });
23620
23619
  static components = { Popover };
23621
23620
  setup() {
23622
- useExternalListener(window, "click", this.onExternalClick, { capture: true });
23621
+ useListener(window, "click", this.onExternalClick.bind(this), { capture: true });
23623
23622
  }
23624
23623
  infoRef = signal.ref();
23625
23624
  get popoverProps() {
@@ -24029,6 +24028,7 @@ figureRegistry.add("chart", {
24029
24028
  Component: ChartFigure,
24030
24029
  SidePanelComponent: "ChartPanel",
24031
24030
  menuBuilder: getChartMenuActions,
24031
+ minFigSize: 80,
24032
24032
  borderWidth: (getters) => getters.isDashboard() ? 0 : 1,
24033
24033
  hasShadow: (getters) => getters.isDashboard(),
24034
24034
  isRounded: (getters) => getters.isDashboard(),
@@ -24047,6 +24047,7 @@ figureRegistry.add("image", {
24047
24047
  figureRegistry.add("carousel", {
24048
24048
  Component: CarouselFigure,
24049
24049
  menuBuilder: getCarouselMenuActions,
24050
+ minFigSize: 80,
24050
24051
  borderWidth: (getters) => getters.isDashboard() ? 0 : 1,
24051
24052
  hasShadow: (getters) => getters.isDashboard(),
24052
24053
  isRounded: (getters) => getters.isDashboard(),
@@ -24179,7 +24180,7 @@ var FigureComponent = class extends Component {
24179
24180
  ...this.positionInBoundary(sheetId, this.env.model.getters.getFigureUI(sheetId, figure), ev.key, ev.shiftKey)
24180
24181
  });
24181
24182
  }
24182
- this.env.model.dispatch("MOVE_FIGURES", { figures });
24183
+ this.env.model.dispatch("UPDATE_FIGURES", { figures });
24183
24184
  ev.preventDefault();
24184
24185
  ev.stopPropagation();
24185
24186
  break;
@@ -29277,6 +29278,20 @@ migrationStepRegistry.add("0.1", { migrate(data) {
29277
29278
  figure.data.chartDefinitions[chartId] = upgrade(definition);
29278
29279
  }
29279
29280
  return data;
29281
+ } }).add("19.5.1", { migrate(data) {
29282
+ function upgrade(definition) {
29283
+ if (definition.type !== "scorecard") return definition;
29284
+ definition = { ...definition };
29285
+ if (definition.keyValue) definition.keyValue = `=${definition.keyValue}`;
29286
+ if (definition.baseline) definition.baseline = `=${definition.baseline}`;
29287
+ return definition;
29288
+ }
29289
+ for (const sheet of data.sheets || []) for (const figure of sheet.figures || []) if (figure.tag === "chart") figure.data = upgrade(figure.data);
29290
+ else if (figure.tag === "carousel") for (const chartId in figure.data.chartDefinitions) {
29291
+ const definition = figure.data.chartDefinitions[chartId];
29292
+ figure.data.chartDefinitions[chartId] = upgrade(definition);
29293
+ }
29294
+ return data;
29280
29295
  } });
29281
29296
  function fixOverlappingFilters(data) {
29282
29297
  for (const sheet of data.sheets || []) {
@@ -29949,7 +29964,7 @@ function buildScorecard(zone, getters) {
29949
29964
  return {
29950
29965
  type: "scorecard",
29951
29966
  title: {},
29952
- keyValue: getUnboundRange(getters, zone),
29967
+ keyValue: `=${getUnboundRange(getters, zone)}`,
29953
29968
  background: cell?.style?.fillColor,
29954
29969
  baselineMode: DEFAULT_SCORECARD_BASELINE_MODE,
29955
29970
  baselineColorUp: DEFAULT_SCORECARD_BASELINE_COLOR_UP,
@@ -30910,7 +30925,7 @@ var SpreadsheetChart = class SpreadsheetChart {
30910
30925
  getFormulas(getters) {
30911
30926
  return this.chartTypeBuilder.getFormulas(getters, this.sheetId, this.definition);
30912
30927
  }
30913
- getRuntime(getters, chartId) {
30928
+ getRuntime(getters, chartId, colorThemeName) {
30914
30929
  const dataSource = this.dataSource;
30915
30930
  const dataExtractors = dataSource ? {
30916
30931
  extractData: () => this.dataSourceBuilder.extractData(dataSource, chartId, getters),
@@ -30930,7 +30945,7 @@ var SpreadsheetChart = class SpreadsheetChart {
30930
30945
  return this.dataSourceBuilder.onDataSetClick?.(this.definition.type, chartId, event, items, chartJsChart, getters);
30931
30946
  },
30932
30947
  onHover: (event, items, chartJsChart) => this.dataSourceBuilder.onDataSetHover?.(this.definition.type, chartId, event, items, chartJsChart)
30933
- });
30948
+ }, colorThemeName);
30934
30949
  }
30935
30950
  static deleteInvalidKeys(definition) {
30936
30951
  definition = { ...definition };
@@ -32193,7 +32208,7 @@ var NumberEditor = class extends Component {
32193
32208
  DOMFocusableElementStore;
32194
32209
  setup() {
32195
32210
  this.DOMFocusableElementStore = useStore(DOMFocusableElementStore);
32196
- useExternalListener(window, "click", this.onExternalClick, { capture: true });
32211
+ useListener(window, "click", this.onExternalClick.bind(this), { capture: true });
32197
32212
  onWillUpdateProps((nextProps) => {
32198
32213
  const input = this.inputRef();
32199
32214
  if (input && document.activeElement !== input) input.value = nextProps.currentValue;
@@ -32294,7 +32309,7 @@ var TextStyler = class extends Component {
32294
32309
  });
32295
32310
  openedEl = null;
32296
32311
  setup() {
32297
- useExternalListener(window, "click", this.onExternalClick);
32312
+ useListener(window, "click", this.onExternalClick.bind(this));
32298
32313
  }
32299
32314
  state = proxy({ activeTool: "" });
32300
32315
  updateFontSize(fontSize) {
@@ -33388,7 +33403,7 @@ var RoundColorPicker = class extends Component {
33388
33403
  state;
33389
33404
  setup() {
33390
33405
  this.state = proxy({ pickerOpened: false });
33391
- useExternalListener(window, "click", this.closePicker);
33406
+ useListener(window, "click", this.closePicker.bind(this));
33392
33407
  }
33393
33408
  closePicker() {
33394
33409
  this.state.pickerOpened = false;
@@ -34011,7 +34026,7 @@ function toXlsxHexColor(color) {
34011
34026
  //#region src/helpers/figures/charts/runtime/chart_data_extractor.ts
34012
34027
  const EMPTY$1 = Object.freeze({ value: null });
34013
34028
  const ZERO = Object.freeze({ value: 0 });
34014
- function getBarChartData(definition, { labelValues, dataSetsValues }, getters) {
34029
+ function getBarChartData(definition, { labelValues, dataSetsValues }, getters, colorThemeName) {
34015
34030
  const locale = getters.getLocale();
34016
34031
  let labels = labelValues.map(({ value, format }) => formatValue(value, {
34017
34032
  format,
@@ -34043,7 +34058,7 @@ function getBarChartData(definition, { labelValues, dataSetsValues }, getters) {
34043
34058
  labels,
34044
34059
  locale: getters.getLocale(),
34045
34060
  topPadding: getTopPaddingForDashboard(definition, getters),
34046
- background: getChartBackgroundColor(definition, getters)
34061
+ background: getChartBackgroundColor(definition, colorThemeName)
34047
34062
  };
34048
34063
  }
34049
34064
  function getDateTimeLabel(value, stamp) {
@@ -34102,7 +34117,7 @@ function computeValuesAndLabels(timeValues, values, horizontalGroupBy, verticalG
34102
34117
  labels: xValues.map((v) => ({ value: getDateTimeLabel(v, horizontalGroupBy) }))
34103
34118
  };
34104
34119
  }
34105
- function getCalendarChartData(definition, { labelValues, dataSetsValues }, getters) {
34120
+ function getCalendarChartData(definition, { labelValues, dataSetsValues }, getters, colorThemeName) {
34106
34121
  let labels = labelValues;
34107
34122
  const locale = getters.getLocale();
34108
34123
  const countEntries = dataSetsValues.length === 0;
@@ -34115,14 +34130,14 @@ function getCalendarChartData(definition, { labelValues, dataSetsValues }, gette
34115
34130
  labels: labels.map(({ value }) => String(value ?? "")),
34116
34131
  locale: getters.getLocale(),
34117
34132
  topPadding: getTopPaddingForDashboard(definition, getters),
34118
- background: getChartBackgroundColor(definition, getters)
34133
+ background: getChartBackgroundColor(definition, colorThemeName)
34119
34134
  };
34120
34135
  }
34121
- function getPyramidChartData(definition, { labelValues, dataSetsValues }, getters) {
34136
+ function getPyramidChartData(definition, { labelValues, dataSetsValues }, getters, colorThemeName) {
34122
34137
  const barChartData = getBarChartData(definition, {
34123
34138
  labelValues,
34124
34139
  dataSetsValues: dataSetsValues.slice(0, 2)
34125
- }, getters);
34140
+ }, getters, colorThemeName);
34126
34141
  const barDataset = barChartData.dataSetsValues.filter((ds) => !ds.hidden);
34127
34142
  const pyramidDatasetValues = [];
34128
34143
  if (barDataset[0]) {
@@ -34144,7 +34159,7 @@ function getPyramidChartData(definition, { labelValues, dataSetsValues }, getter
34144
34159
  dataSetsValues: pyramidDatasetValues
34145
34160
  };
34146
34161
  }
34147
- function getLineChartData(definition, { labelValues, dataSetsValues }, getters) {
34162
+ function getLineChartData(definition, { labelValues, dataSetsValues }, getters, colorThemeName) {
34148
34163
  const axisType = getChartAxisType(definition, {
34149
34164
  labelValues,
34150
34165
  dataSetsValues
@@ -34180,10 +34195,10 @@ function getLineChartData(definition, { labelValues, dataSetsValues }, getters)
34180
34195
  trendDataSetsValues,
34181
34196
  axisType,
34182
34197
  topPadding: getTopPaddingForDashboard(definition, getters),
34183
- background: getChartBackgroundColor(definition, getters)
34198
+ background: getChartBackgroundColor(definition, colorThemeName)
34184
34199
  };
34185
34200
  }
34186
- function getPieChartData(definition, { labelValues, dataSetsValues }, getters) {
34201
+ function getPieChartData(definition, { labelValues, dataSetsValues }, getters, colorThemeName) {
34187
34202
  let labels = labelValues.map(({ value, format }) => formatValue(value, {
34188
34203
  format,
34189
34204
  locale: getters.getLocale()
@@ -34198,10 +34213,10 @@ function getPieChartData(definition, { labelValues, dataSetsValues }, getters) {
34198
34213
  labels,
34199
34214
  locale: getters.getLocale(),
34200
34215
  topPadding: getTopPaddingForDashboard(definition, getters),
34201
- background: getChartBackgroundColor(definition, getters)
34216
+ background: getChartBackgroundColor(definition, colorThemeName)
34202
34217
  };
34203
34218
  }
34204
- function getRadarChartData(definition, { labelValues, dataSetsValues }, getters) {
34219
+ function getRadarChartData(definition, { labelValues, dataSetsValues }, getters, colorThemeName) {
34205
34220
  let labels = labelValues.map(({ value, format }) => formatValue(value, {
34206
34221
  format,
34207
34222
  locale: getters.getLocale()
@@ -34214,10 +34229,10 @@ function getRadarChartData(definition, { labelValues, dataSetsValues }, getters)
34214
34229
  axisFormats,
34215
34230
  labels,
34216
34231
  locale: getters.getLocale(),
34217
- background: getChartBackgroundColor(definition, getters)
34232
+ background: getChartBackgroundColor(definition, colorThemeName)
34218
34233
  };
34219
34234
  }
34220
- function getGeoChartData(definition, { labelValues, dataSetsValues }, getters) {
34235
+ function getGeoChartData(definition, { labelValues, dataSetsValues }, getters, colorThemeName) {
34221
34236
  dataSetsValues = dataSetsValues.slice(0, 1);
34222
34237
  let labels = labelValues.map(({ value, format }) => formatValue(value, {
34223
34238
  format,
@@ -34233,10 +34248,10 @@ function getGeoChartData(definition, { labelValues, dataSetsValues }, getters) {
34233
34248
  availableRegions: getters.getGeoChartAvailableRegions(),
34234
34249
  geoFeatureNameToId: getters.geoFeatureNameToId,
34235
34250
  getGeoJsonFeatures: getters.getGeoJsonFeatures,
34236
- background: getChartBackgroundColor(definition, getters)
34251
+ background: getChartBackgroundColor(definition, colorThemeName)
34237
34252
  };
34238
34253
  }
34239
- function getFunnelChartData(definition, { labelValues, dataSetsValues }, getters) {
34254
+ function getFunnelChartData(definition, { labelValues, dataSetsValues }, getters, colorThemeName) {
34240
34255
  let labels = labelValues.map(({ value, format }) => formatValue(value, {
34241
34256
  format,
34242
34257
  locale: getters.getLocale()
@@ -34250,10 +34265,10 @@ function getFunnelChartData(definition, { labelValues, dataSetsValues }, getters
34250
34265
  axisFormats: { x: format },
34251
34266
  labels,
34252
34267
  locale: getters.getLocale(),
34253
- background: getChartBackgroundColor(definition, getters)
34268
+ background: getChartBackgroundColor(definition, colorThemeName)
34254
34269
  };
34255
34270
  }
34256
- function getHierarchalChartData(definition, { labelValues, dataSetsValues }, getters) {
34271
+ function getHierarchalChartData(definition, { labelValues, dataSetsValues }, getters, colorThemeName) {
34257
34272
  let labels = labelValues;
34258
34273
  ({labels, dataSetsValues} = filterValuesWithDifferentSigns(labels, dataSetsValues));
34259
34274
  ({labels, dataSetsValues} = filterInvalidHierarchicalPoints(labels, dataSetsValues));
@@ -34262,12 +34277,12 @@ function getHierarchalChartData(definition, { labelValues, dataSetsValues }, get
34262
34277
  axisFormats: { y: getChartLabelFormat(labels) },
34263
34278
  labels: labels.map(({ value }) => String(value ?? "")),
34264
34279
  locale: getters.getLocale(),
34265
- background: getChartBackgroundColor(definition, getters)
34280
+ background: getChartBackgroundColor(definition, colorThemeName)
34266
34281
  };
34267
34282
  }
34268
- function getBubbleChartData(definition, getters) {
34283
+ function getBubbleChartData(definition, getters, colorThemeName) {
34269
34284
  const chartData = getBubbleChartSourceData(definition, getters);
34270
- const data = getLineChartData(definition, chartData, getters);
34285
+ const data = getLineChartData(definition, chartData, getters, colorThemeName);
34271
34286
  let labelValues = definition.labelRange ? getters.getVisibleRangeValues(definition.labelRange) : [];
34272
34287
  let sizeValues = definition.sizeRange ? getters.getVisibleRangeValues(definition.sizeRange) : [];
34273
34288
  if (chartData.shouldRemoveFirstLabel) {
@@ -35269,9 +35284,9 @@ const templates = `
35269
35284
  `;
35270
35285
  let app;
35271
35286
  function renderToString(templateName, context = {}) {
35272
- return render(templateName, context).innerHTML;
35287
+ return render$1(templateName, context).innerHTML;
35273
35288
  }
35274
- function render(templateName, context = {}) {
35289
+ function render$1(templateName, context = {}) {
35275
35290
  if (!app) app = new App({
35276
35291
  templates,
35277
35292
  translateFn: _t
@@ -35636,8 +35651,8 @@ const BarChart = {
35636
35651
  verticalAxis: getDefinedAxis(definition)
35637
35652
  };
35638
35653
  },
35639
- getRuntime(getters, definition, { extractData }, sheetId, eventHandlers) {
35640
- const chartData = getBarChartData(definition, extractData(), getters);
35654
+ getRuntime(getters, definition, { extractData }, sheetId, eventHandlers, colorThemeName) {
35655
+ const chartData = getBarChartData(definition, extractData(), getters, colorThemeName);
35641
35656
  return {
35642
35657
  chartJsConfig: {
35643
35658
  type: "bar",
@@ -35825,7 +35840,7 @@ const GaugeChart = {
35825
35840
  definition.sectionRule.upperInflectionPoint.value
35826
35841
  ].filter((value) => value.startsWith("=")).map((formula) => CompiledFormula.Compile(formula, sheetId, getters));
35827
35842
  },
35828
- getRuntime(getters, definition, dataSource, sheetId) {
35843
+ getRuntime(getters, definition, dataSource, sheetId, eventHandlers, colorThemeName) {
35829
35844
  const locale = getters.getLocale();
35830
35845
  const chartColors = definition.sectionRule.colors;
35831
35846
  let gaugeValue = void 0;
@@ -35846,7 +35861,7 @@ const GaugeChart = {
35846
35861
  }
35847
35862
  let minValue = getFormulaNumberValue(sheetId, definition.sectionRule.rangeMin, getters);
35848
35863
  let maxValue = getFormulaNumberValue(sheetId, definition.sectionRule.rangeMax, getters);
35849
- if (minValue === void 0 || maxValue === void 0) return getInvalidGaugeRuntime(definition, getters);
35864
+ if (minValue === void 0 || maxValue === void 0) return getInvalidGaugeRuntime(definition, getters, colorThemeName);
35850
35865
  if (maxValue < minValue) [minValue, maxValue] = [maxValue, minValue];
35851
35866
  const lowerPoint = definition.sectionRule.lowerInflectionPoint;
35852
35867
  const upperPoint = definition.sectionRule.upperInflectionPoint;
@@ -35878,7 +35893,7 @@ const GaugeChart = {
35878
35893
  }
35879
35894
  colors.push(chartColors.upperColor);
35880
35895
  return {
35881
- background: getters.getStyleOfSingleCellChart(definition.background, dataRange).background,
35896
+ background: getters.getStyleOfSingleCellChart(definition.background, dataRange, colorThemeName).background,
35882
35897
  title: {
35883
35898
  ...title,
35884
35899
  text: title.text ? getters.dynamicTranslate(title.text) : ""
@@ -35912,9 +35927,9 @@ function getFormulaNumberValue(sheetId, formula, getters) {
35912
35927
  const value = getters.evaluateFormula(sheetId, formula);
35913
35928
  return isMultipleElementMatrix(value) ? void 0 : tryToNumber(toScalar(value), getters.getLocale());
35914
35929
  }
35915
- function getInvalidGaugeRuntime(definition, getters) {
35930
+ function getInvalidGaugeRuntime(definition, getters, colorThemeName) {
35916
35931
  return {
35917
- background: getters.getStyleOfSingleCellChart(definition.background, definition.dataRange).background,
35932
+ background: getters.getStyleOfSingleCellChart(definition.background, definition.dataRange, colorThemeName).background,
35918
35933
  title: definition.title ?? { text: "" },
35919
35934
  minValue: {
35920
35935
  value: 0,
@@ -36008,8 +36023,8 @@ const LineChart = {
36008
36023
  verticalAxis: getDefinedAxis(definition)
36009
36024
  };
36010
36025
  },
36011
- getRuntime(getters, definition, { extractData }, sheetId, eventHandlers) {
36012
- const chartData = getLineChartData(definition, extractData(), getters);
36026
+ getRuntime(getters, definition, { extractData }, sheetId, eventHandlers, colorThemeName) {
36027
+ const chartData = getLineChartData(definition, extractData(), getters, colorThemeName);
36013
36028
  return {
36014
36029
  chartJsConfig: {
36015
36030
  type: "line",
@@ -36090,8 +36105,8 @@ const PieChart = {
36090
36105
  labelRange
36091
36106
  };
36092
36107
  },
36093
- getRuntime(getters, definition, { extractData }, sheetId, eventHandlers) {
36094
- const chartData = getPieChartData(definition, extractData(), getters);
36108
+ getRuntime(getters, definition, { extractData }, sheetId, eventHandlers, colorThemeName) {
36109
+ const chartData = getPieChartData(definition, extractData(), getters, colorThemeName);
36095
36110
  return { chartJsConfig: {
36096
36111
  type: definition.isDoughnut ? "doughnut" : "pie",
36097
36112
  data: {
@@ -36167,8 +36182,8 @@ const WaterfallChart = {
36167
36182
  };
36168
36183
  },
36169
36184
  getDefinitionForExcel: () => void 0,
36170
- getRuntime(getters, definition, { extractData }, sheetId, eventHandlers) {
36171
- const chartData = getBarChartData(definition, extractData(), getters);
36185
+ getRuntime(getters, definition, { extractData }, sheetId, eventHandlers, colorThemeName) {
36186
+ const chartData = getBarChartData(definition, extractData(), getters, colorThemeName);
36172
36187
  const { labels, datasets } = getWaterfallDatasetAndLabels(definition, chartData);
36173
36188
  return { chartJsConfig: {
36174
36189
  type: "bar",
@@ -36935,7 +36950,7 @@ var CalendarChartConfigPanel = class extends GenericChartConfigPanel {
36935
36950
  getGroupByOptions() {
36936
36951
  const sheetId = this.env.model.getters.getFigureSheetId(this.env.model.getters.getFigureIdFromChartId(this.props.chartId));
36937
36952
  const definition = SpreadsheetChart.fromStrDefinition(this.env.model.getters, sheetId, this.props.definition).getRangeDefinition();
36938
- const labels = getBarChartData(definition, getChartData(this.env.model.getters, definition.dataSource), this.env.model.getters).labels.filter((l) => isDateTime(l, DEFAULT_LOCALE));
36953
+ const labels = getBarChartData(definition, getChartData(this.env.model.getters, definition.dataSource), this.env.model.getters, this.env.model.getters.getSpreadsheetTheme().colorThemeName).labels.filter((l) => isDateTime(l, DEFAULT_LOCALE));
36939
36954
  if (labels.length === 0) return [];
36940
36955
  const dates = labels.map((label) => toJsDate(label, this.env.model.getters.getLocale()));
36941
36956
  const uniqueYears = /* @__PURE__ */ new Set();
@@ -36999,7 +37014,7 @@ var ColorScalePicker = class extends Component {
36999
37014
  });
37000
37015
  popoverRef = signal.ref(HTMLTableElement);
37001
37016
  setup() {
37002
- useExternalListener(window, "click", this.closePopover);
37017
+ useListener(window, "click", this.closePopover.bind(this));
37003
37018
  }
37004
37019
  get currentColorScale() {
37005
37020
  return this.props.definition.colorScale || schemeToColorScale("oranges");
@@ -39647,10 +39662,10 @@ var ScatterConfigPanel = class extends GenericChartConfigPanel {
39647
39662
  var ScorecardChartConfigPanel = class extends Component {
39648
39663
  static template = "o-spreadsheet-ScorecardChartConfigPanel";
39649
39664
  static components = {
39650
- SelectionInput,
39651
39665
  ChartErrorSection,
39652
39666
  Section,
39653
- Select
39667
+ Select,
39668
+ StandaloneComposer
39654
39669
  };
39655
39670
  props = useProps(chartSidePanelPropsDefinition);
39656
39671
  state = proxy({
@@ -39662,30 +39677,18 @@ var ScorecardChartConfigPanel = class extends Component {
39662
39677
  get errorMessages() {
39663
39678
  return [...this.state.keyValueDispatchResult?.reasons || [], ...this.state.baselineDispatchResult?.reasons || []].filter((reason) => reason !== "NoChanges").map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
39664
39679
  }
39665
- get isKeyValueInvalid() {
39666
- return !!this.state.keyValueDispatchResult?.isCancelledBecause("InvalidScorecardKeyValue");
39667
- }
39668
- get isBaselineInvalid() {
39669
- return !!this.state.baselineDispatchResult?.isCancelledBecause("InvalidScorecardBaseline");
39670
- }
39671
- onKeyValueRangeChanged(ranges) {
39672
- this.keyValue = ranges[0];
39673
- this.state.keyValueDispatchResult = this.props.canUpdateChart(this.props.chartId, { keyValue: this.keyValue });
39674
- }
39675
- updateKeyValueRange() {
39680
+ onConfirmKeyValue(keyValue) {
39681
+ this.keyValue = keyValue;
39676
39682
  this.state.keyValueDispatchResult = this.props.updateChart(this.props.chartId, { keyValue: this.keyValue });
39677
39683
  }
39678
- getKeyValueRange() {
39684
+ getKeyValue() {
39679
39685
  return this.keyValue || "";
39680
39686
  }
39681
- onBaselineRangeChanged(ranges) {
39682
- this.baseline = ranges[0];
39683
- this.state.baselineDispatchResult = this.props.canUpdateChart(this.props.chartId, { baseline: this.baseline });
39684
- }
39685
- updateBaselineRange() {
39687
+ onConfirmBaseline(baseline) {
39688
+ this.baseline = baseline;
39686
39689
  this.state.baselineDispatchResult = this.props.updateChart(this.props.chartId, { baseline: this.baseline });
39687
39690
  }
39688
- getBaselineRange() {
39691
+ getBaseline() {
39689
39692
  return this.baseline || "";
39690
39693
  }
39691
39694
  updateBaselineMode(baselineMode) {
@@ -40142,6 +40145,7 @@ var MainChartPanelStore = class extends SpreadsheetStore {
40142
40145
  changeChartType(chartId, newDisplayType) {
40143
40146
  const currentCreationContext = this.getters.getContextCreationChart(chartId);
40144
40147
  const savedCreationContext = this.creationContexts[chartId] || {};
40148
+ const auxiliaryRange = currentCreationContext && "auxiliaryRange" in currentCreationContext ? currentCreationContext.auxiliaryRange : savedCreationContext.auxiliaryRange;
40145
40149
  let dataSetStyles = savedCreationContext.dataSetStyles ?? currentCreationContext?.dataSetStyles;
40146
40150
  let dataSource = {
40147
40151
  ...savedCreationContext.dataSource,
@@ -40163,7 +40167,8 @@ var MainChartPanelStore = class extends SpreadsheetStore {
40163
40167
  dataSetsHaveTitle: false,
40164
40168
  ...savedCreationContext.dataSource,
40165
40169
  ...currentCreationContext?.dataSource,
40166
- dataSets: newRanges ?? []
40170
+ dataSets: newRanges ?? [],
40171
+ labelRange: auxiliaryRange
40167
40172
  };
40168
40173
  }
40169
40174
  this.creationContexts[chartId] = {
@@ -40192,7 +40197,7 @@ var MainChartPanelStore = class extends SpreadsheetStore {
40192
40197
  dataSetsStartWithSameRanges(currentDataSets, savedDataSets, currentStyles, savedStyles) {
40193
40198
  return currentDataSets.every((ds, i) => {
40194
40199
  const savedDs = savedDataSets[i];
40195
- return deepEquals(ds.dataRange, savedDs.dataRange) && deepEquals(currentStyles?.[ds.dataSetId], savedStyles?.[savedDs.dataSetId]);
40200
+ return deepEquals(ds.dataRange, savedDs?.dataRange) && deepEquals(currentStyles?.[ds.dataSetId], savedStyles?.[savedDs?.dataSetId]);
40196
40201
  });
40197
40202
  }
40198
40203
  /**
@@ -42028,7 +42033,7 @@ var ConditionalFormattingEditor = class extends Component {
42028
42033
  useLayoutEffect((sheetId, isCfRemoved) => {
42029
42034
  if (this.activeSheetId !== sheetId || isCfRemoved) this.env.replaceSidePanel("ConditionalFormatting", `ConditionalFormattingEditor_${this.props.cf.id}`);
42030
42035
  }, () => [this.env.model.getters.getActiveSheetId(), this.isEditedCfRemoved]);
42031
- useExternalListener(window, "click", () => this.store.closeMenus());
42036
+ useListener(window, "click", () => this.store.closeMenus());
42032
42037
  }
42033
42038
  get isEditedCfRemoved() {
42034
42039
  return !Boolean(this.env.model.getters.getConditionalFormats(this.activeSheetId).find((cf) => cf.id === this.props.cf.id));
@@ -42301,7 +42306,7 @@ function startChartDragAndDrop(env, definition, ev) {
42301
42306
  canvas.className = "w-100 h-100";
42302
42307
  container.appendChild(canvas);
42303
42308
  spreadsheet.appendChild(container);
42304
- destroyChart = drawChartOnCanvas(canvas, SpreadsheetChart.fromStrDefinition(getters, sheetId, definition).getRuntime(getters, "newChart"), {
42309
+ destroyChart = drawChartOnCanvas(canvas, SpreadsheetChart.fromStrDefinition(getters, sheetId, definition).getRuntime(getters, "newChart", getters.getSpreadsheetTheme().colorThemeName), {
42305
42310
  width,
42306
42311
  height
42307
42312
  }, definition.type, zoom);
@@ -42382,7 +42387,7 @@ var ChartSuggestionPreview = class extends Component {
42382
42387
  getChartConfiguration() {
42383
42388
  const getters = this.env.model.getters;
42384
42389
  const activeSheetId = getters.getActiveSheetId();
42385
- const runtime = SpreadsheetChart.fromStrDefinition(getters, activeSheetId, this.props.definition).getRuntime(getters, "myChart");
42390
+ const runtime = SpreadsheetChart.fromStrDefinition(getters, activeSheetId, this.props.definition).getRuntime(getters, "myChart", getters.getSpreadsheetTheme().colorThemeName);
42386
42391
  if (!("chartJsConfig" in runtime)) return null;
42387
42392
  let config = runtime.chartJsConfig;
42388
42393
  const existingScales = config.options?.scales ?? {};
@@ -42449,7 +42454,7 @@ var ChartSuggestionPreview = class extends Component {
42449
42454
  const canvas = this.chartCanvasRef();
42450
42455
  if (!canvas) return;
42451
42456
  const getters = this.env.model.getters;
42452
- let runtime = SpreadsheetChart.fromStrDefinition(getters, getters.getActiveSheetId(), this.props.definition).getRuntime(getters, "myChart");
42457
+ let runtime = SpreadsheetChart.fromStrDefinition(getters, getters.getActiveSheetId(), this.props.definition).getRuntime(getters, "myChart", getters.getSpreadsheetTheme().colorThemeName);
42453
42458
  const { type } = this.props.definition;
42454
42459
  if (type === "scorecard") {
42455
42460
  const rect = canvas.getBoundingClientRect();
@@ -42712,8 +42717,8 @@ const SINGLE_NUMBER_COLUMN_SUGGESTIONS = [
42712
42717
  {
42713
42718
  description: _t("Highlights the most recent value compared to the previous one."),
42714
42719
  isApplicable: ({ rowCount }) => rowCount < 3,
42715
- build: (ctx) => scorecardChart(ctx.title, ctx.lastCellXC, {
42716
- baseline: ctx.prevCellXC,
42720
+ build: (ctx) => scorecardChart(ctx.title, `=${ctx.lastCellXC}`, {
42721
+ baseline: ctx.prevCellXC ? `=${ctx.prevCellXC}` : void 0,
42717
42722
  baselineMode: "difference"
42718
42723
  })
42719
42724
  },
@@ -42746,8 +42751,8 @@ const SINGLE_PERCENTAGE_COLUMN_SUGGESTIONS = [
42746
42751
  {
42747
42752
  description: _t("Shows the last percentage value with its baseline."),
42748
42753
  isApplicable: ({ rowCount }) => rowCount < 3,
42749
- build: (ctx) => scorecardChart(ctx.title, ctx.lastCellXC, {
42750
- baseline: ctx.prevCellXC,
42754
+ build: (ctx) => scorecardChart(ctx.title, `=${ctx.lastCellXC}`, {
42755
+ baseline: ctx.prevCellXC ? `=${ctx.prevCellXC}` : void 0,
42751
42756
  baselineMode: "percentage"
42752
42757
  })
42753
42758
  },
@@ -42776,7 +42781,7 @@ const SINGLE_PERCENTAGE_COLUMN_SUGGESTIONS = [
42776
42781
  const SINGLE_DATE_COLUMN_SUGGESTIONS = [{
42777
42782
  description: _t("Shows the last date value."),
42778
42783
  isApplicable: ({ rowCount }) => rowCount === 1,
42779
- build: (ctx) => scorecardChart(ctx.title, ctx.lastCellXC)
42784
+ build: (ctx) => scorecardChart(ctx.title, `=${ctx.lastCellXC}`)
42780
42785
  }];
42781
42786
  /** Pattern D — Single categorical column */
42782
42787
  const SINGLE_CATEGORICAL_COLUMN_SUGGESTIONS = [
@@ -42810,7 +42815,7 @@ const SINGLE_CATEGORICAL_COLUMN_SUGGESTIONS = [
42810
42815
  const SINGLE_LABEL_COLUMN_SUGGESTIONS = [{
42811
42816
  description: _t("Displays a key performance indicator."),
42812
42817
  isApplicable: ({ rowCount }) => rowCount === 1,
42813
- build: (ctx) => scorecardChart(ctx.title, ctx.lastCellXC, {
42818
+ build: (ctx) => scorecardChart(ctx.title, `=${ctx.lastCellXC}`, {
42814
42819
  baselineMode: "text",
42815
42820
  humanize: false
42816
42821
  })
@@ -42868,8 +42873,8 @@ const NUMBER_VS_NUMBER_SUGGESTIONS = [
42868
42873
  {
42869
42874
  description: _t("Highlights the second metric compared to the first one."),
42870
42875
  isApplicable: ({ rowCount1, rowCount2 }) => rowCount1 === 1 && rowCount2 === 1,
42871
- build: (ctx) => scorecardChart(ctx.title, ctx.lastCellXC, {
42872
- baseline: ctx.prevCellXC,
42876
+ build: (ctx) => scorecardChart(ctx.title, `=${ctx.lastCellXC}`, {
42877
+ baseline: ctx.prevCellXC ? `=${ctx.prevCellXC}` : void 0,
42873
42878
  baselineMode: "difference"
42874
42879
  })
42875
42880
  },
@@ -42927,10 +42932,10 @@ const LABEL_VS_NUMBER_SUGGESTIONS = [
42927
42932
  {
42928
42933
  description: _t("Highlights the most recent value for the named entity."),
42929
42934
  isApplicable: ({ rowCount }) => rowCount === 1,
42930
- build: (ctx) => scorecardChart("", ctx.lastCellXC, {
42935
+ build: (ctx) => scorecardChart("", `=${ctx.lastCellXC}`, {
42931
42936
  humanize: false,
42932
42937
  baselineMode: "text",
42933
- baseline: ctx.prevCellXC
42938
+ baseline: ctx.prevCellXC ? `=${ctx.prevCellXC}` : void 0
42934
42939
  })
42935
42940
  },
42936
42941
  {
@@ -43931,6 +43936,7 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
43931
43936
  mutators = [
43932
43937
  "updateSearchOptions",
43933
43938
  "updateSearchContent",
43939
+ "updateReplaceContent",
43934
43940
  "searchFormulas",
43935
43941
  "selectPreviousMatch",
43936
43942
  "selectNextMatch",
@@ -43983,6 +43989,9 @@ var FindAndReplaceStore = class extends SpreadsheetStore {
43983
43989
  updateSearchContent(toSearch) {
43984
43990
  this._updateSearch(toSearch, this.searchOptions);
43985
43991
  }
43992
+ updateReplaceContent(toReplace) {
43993
+ this.toReplace = toReplace;
43994
+ }
43986
43995
  updateSearchOptions(searchOptions) {
43987
43996
  this._updateSearch(this.toSearch, {
43988
43997
  ...this.searchOptions,
@@ -44340,7 +44349,7 @@ var FindAndReplacePanel = class extends Component {
44340
44349
  get currentSheetMatchesCount() {
44341
44350
  const { activeSheetMatchesCount: count, activeSheetHiddenMatchesCount: hidden, searchOptions } = this.store;
44342
44351
  const sheetName = this.env.model.getters.getSheetName(this.env.model.getters.getActiveSheetId());
44343
- let label = count === 1 ? _t("1 match in %(sheetName)s", { sheetName }) : _t("%(count)s matches in %(sheetName)s", {
44352
+ let label = count === 1 ? _t("1 match in '%(sheetName)s'", { sheetName }) : _t("%(count)s matches in '%(sheetName)s'", {
44344
44353
  count,
44345
44354
  sheetName
44346
44355
  });
@@ -44352,10 +44361,10 @@ var FindAndReplacePanel = class extends Component {
44352
44361
  if (!range) return "";
44353
44362
  const { specificRangeMatchesCount: count, specificRangeHiddenMatchesCount: hidden, searchOptions } = this.store;
44354
44363
  const { sheetId, zone } = range;
44355
- let label = count === 1 ? _t("1 match in range %(range)s of %(sheetName)s", {
44364
+ let label = count === 1 ? _t("1 match in range %(range)s of '%(sheetName)s'", {
44356
44365
  range: zoneToXc(zone),
44357
44366
  sheetName: this.env.model.getters.getSheetName(sheetId)
44358
- }) : _t("%(count)s matches in range %(range)s of %(sheetName)s", {
44367
+ }) : _t("%(count)s matches in range %(range)s of '%(sheetName)s'", {
44359
44368
  count,
44360
44369
  range: zoneToXc(zone),
44361
44370
  sheetName: this.env.model.getters.getSheetName(sheetId)
@@ -44383,7 +44392,7 @@ var FindAndReplacePanel = class extends Component {
44383
44392
  onMounted(() => this.searchInputRef()?.focus());
44384
44393
  onWillUnmount(() => this.updateSearchContent.stopDebounce());
44385
44394
  this.updateSearchContent = debounce(this.store.updateSearchContent, 200);
44386
- useExternalListener(window, "keydown", (ev) => {
44395
+ useListener(window, "keydown", (ev) => {
44387
44396
  const code = keyboardEventToShortcutString(ev);
44388
44397
  if (code === "Ctrl+F" || code === "Ctrl+H") {
44389
44398
  this.searchInputRef()?.focus();
@@ -44398,6 +44407,9 @@ var FindAndReplacePanel = class extends Component {
44398
44407
  onSearchInput(ev) {
44399
44408
  this.updateSearchContent(ev.target.value);
44400
44409
  }
44410
+ onReplaceInput(ev) {
44411
+ this.store.updateReplaceContent(ev.target.value);
44412
+ }
44401
44413
  onKeydownPanel(ev) {
44402
44414
  if (ev.key === "Escape") {
44403
44415
  ev.preventDefault();
@@ -45978,7 +45990,7 @@ var PivotFilterEditor = class extends Component {
45978
45990
  buttonFilter = signal.ref();
45979
45991
  popover;
45980
45992
  setup() {
45981
- useExternalListener(window, "click", (ev) => {
45993
+ useListener(window, "click", (ev) => {
45982
45994
  if (!isChildEvent(this.buttonFilter(), ev)) this.popover.isOpen = false;
45983
45995
  });
45984
45996
  onWillUpdateProps((nextProps) => {
@@ -46112,7 +46124,7 @@ var AddDimensionButton = class extends Component {
46112
46124
  setup() {
46113
46125
  this.autoComplete = useLocalStore(AutoCompleteStore);
46114
46126
  this.autoComplete.useProvider(this.getProvider());
46115
- useExternalListener(window, "click", (ev) => {
46127
+ useListener(window, "click", (ev) => {
46116
46128
  if (ev.target !== this.buttonRef()) this.popover.isOpen = false;
46117
46129
  });
46118
46130
  useAutofocus(this.autofocusRef);
@@ -48490,7 +48502,7 @@ var TableStylesPopover = class extends Component {
48490
48502
  tableStyleListRef = signal.ref();
48491
48503
  state = proxy({ selectedCategory: this.initialSelectedCategory });
48492
48504
  setup() {
48493
- useExternalListener(window, "click", this.onExternalClick, { capture: true });
48505
+ useListener(window, "click", this.onExternalClick.bind(this), { capture: true });
48494
48506
  }
48495
48507
  onExternalClick(ev) {
48496
48508
  const el = this.tableStyleListRef();
@@ -49705,7 +49717,8 @@ var TableStyleEditorPanel = class extends Component {
49705
49717
  static components = {
49706
49718
  Section,
49707
49719
  RoundColorPicker,
49708
- TableStylePreview
49720
+ TableStylePreview,
49721
+ TextInput
49709
49722
  };
49710
49723
  props = useProps({
49711
49724
  onCloseSidePanel: types$1.function(),
@@ -49714,7 +49727,7 @@ var TableStyleEditorPanel = class extends Component {
49714
49727
  });
49715
49728
  state = proxy(this.getInitialState());
49716
49729
  setup() {
49717
- useExternalListener(window, "click", () => this.state.pickerOpened = false);
49730
+ useListener(window, "click", () => this.state.pickerOpened = false);
49718
49731
  }
49719
49732
  getInitialState() {
49720
49733
  const editedStyle = this.props.styleId ? this.env.model.getters.getTableStyle(this.props.styleId) : null;
@@ -53591,6 +53604,15 @@ var GridComposer = class extends Component {
53591
53604
  }
53592
53605
  };
53593
53606
 
53607
+ //#endregion
53608
+ //#region src/helpers/owl3_helpers.ts
53609
+ /**
53610
+ * Comes from https://github.com/odoo/odoo/blob/master/addons/web/static/src/owl2/utils.js
53611
+ */
53612
+ function render(component, deep = false) {
53613
+ component.__owl__.render(deep);
53614
+ }
53615
+
53594
53616
  //#endregion
53595
53617
  //#region src/components/helpers/figure_drag_helper.ts
53596
53618
  function dragFigureForMove({ x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, initialFigures, { maxX, maxY }, { scrollX: initialScrollX, scrollY: initialScrollY }, { scrollX, scrollY }) {
@@ -53608,19 +53630,19 @@ function dragFigureForMove({ x: mouseX, y: mouseY }, { x: mouseInitialX, y: mous
53608
53630
  };
53609
53631
  });
53610
53632
  }
53611
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX: initialScrollX, scrollY: initialScrollY }, { scrollX, scrollY }, { maxX, maxY }) {
53612
- let { x, y, width, height } = initialFigure;
53633
+ function dragFigureForResize(initialRect, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX: initialScrollX, scrollY: initialScrollY }, { scrollX, scrollY }, { maxX, maxY }) {
53634
+ let { x, y, width, height } = initialRect;
53613
53635
  if (keepRatio && dirX !== 0 && dirY !== 0) {
53614
- const deltaX = Math.min(dirX * (mouseInitialX - mouseX + scrollX - initialScrollX), width - minFigSize);
53615
- const deltaY = Math.min(dirY * (mouseInitialY - mouseY + scrollY - initialScrollY), height - minFigSize);
53636
+ const deltaX = Math.min(dirX * (mouseInitialX - mouseX + scrollX - initialScrollX), width - minFigSize.width);
53637
+ const deltaY = Math.min(dirY * (mouseInitialY - mouseY + scrollY - initialScrollY), height - minFigSize.height);
53616
53638
  const fraction = Math.min(deltaX / width, deltaY / height);
53617
53639
  if (dirX < 0) x = x + width * fraction;
53618
53640
  if (dirY < 0) y = y + height * fraction;
53619
53641
  width = width * (1 - fraction);
53620
53642
  height = height * (1 - fraction);
53621
53643
  } else {
53622
- const deltaX = Math.max(dirX * (mouseX - mouseInitialX + scrollX - initialScrollX), minFigSize - width);
53623
- const deltaY = Math.max(dirY * (mouseY - mouseInitialY + scrollY - initialScrollY), minFigSize - height);
53644
+ const deltaX = Math.max(dirX * (mouseX - mouseInitialX + scrollX - initialScrollX), minFigSize.width - width);
53645
+ const deltaY = Math.max(dirY * (mouseY - mouseInitialY + scrollY - initialScrollY), minFigSize.height - height);
53624
53646
  width = width + deltaX;
53625
53647
  height = height + deltaY;
53626
53648
  if (dirX < 0) x = x - deltaX;
@@ -53635,7 +53657,6 @@ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }
53635
53657
  y = -scrollY;
53636
53658
  } else if (y + height > maxY) height = maxY - y;
53637
53659
  return {
53638
- ...initialFigure,
53639
53660
  x,
53640
53661
  y,
53641
53662
  width,
@@ -53698,29 +53719,30 @@ function snapForMove(env, figuresToSnap, otherFigures) {
53698
53719
  * Try to snap the given figure to the other figures when resizing the figure, and return the snapped
53699
53720
  * figure and the possible snap lines, if any were found
53700
53721
  */
53701
- function snapForResize(env, resizeDirX, resizeDirY, figureToSnap, otherFigures) {
53702
- const verticalSnapLine = getSnapLine(env, figureToSnap, [resizeDirX === -1 ? "left" : "right"], otherFigures, ["right", "left"]);
53722
+ function snapForResize(env, resizeDirX, resizeDirY, rect, otherFigures) {
53723
+ const verticalSnapLine = getSnapLine(env, rect, [resizeDirX === -1 ? "left" : "right"], otherFigures, ["right", "left"]);
53724
+ const horizontalSnapLine = getSnapLine(env, rect, [resizeDirY === -1 ? "top" : "bottom"], otherFigures, ["bottom", "top"]);
53703
53725
  if (verticalSnapLine) {
53704
- if (resizeDirX === 1) figureToSnap.width -= verticalSnapLine.snapOffset;
53726
+ if (resizeDirX === 1) rect.width -= verticalSnapLine.snapOffset;
53705
53727
  else if (resizeDirX === -1) {
53706
- figureToSnap.x -= verticalSnapLine.snapOffset;
53707
- figureToSnap.width += verticalSnapLine.snapOffset;
53728
+ rect.x -= verticalSnapLine.snapOffset;
53729
+ rect.width += verticalSnapLine.snapOffset;
53708
53730
  }
53709
53731
  }
53710
- const horizontalSnapLine = getSnapLine(env, figureToSnap, [resizeDirY === -1 ? "top" : "bottom"], otherFigures, ["bottom", "top"]);
53711
53732
  if (horizontalSnapLine) {
53712
- if (resizeDirY === 1) figureToSnap.height -= horizontalSnapLine.snapOffset;
53733
+ if (resizeDirY === 1) rect.height -= horizontalSnapLine.snapOffset;
53713
53734
  else if (resizeDirY === -1) {
53714
- figureToSnap.y -= horizontalSnapLine.snapOffset;
53715
- figureToSnap.height += horizontalSnapLine.snapOffset;
53735
+ rect.y -= horizontalSnapLine.snapOffset;
53736
+ rect.height += horizontalSnapLine.snapOffset;
53716
53737
  }
53717
53738
  }
53718
- figureToSnap.x = Math.round(figureToSnap.x);
53719
- figureToSnap.y = Math.round(figureToSnap.y);
53720
- figureToSnap.height = Math.round(figureToSnap.height);
53721
- figureToSnap.width = Math.round(figureToSnap.width);
53722
53739
  return {
53723
- snappedFigures: [figureToSnap],
53740
+ snappedRect: {
53741
+ x: Math.round(rect.x),
53742
+ y: Math.round(rect.y),
53743
+ width: Math.round(rect.width),
53744
+ height: Math.round(rect.height)
53745
+ },
53724
53746
  verticalSnapLine,
53725
53747
  horizontalSnapLine
53726
53748
  };
@@ -53911,7 +53933,7 @@ var FiguresContainer = class extends Component {
53911
53933
  this.zoomStore = useStore(ZoomStore);
53912
53934
  this.chartDragStore = useStore(ChartDragStore);
53913
53935
  onMounted(() => {
53914
- this.render();
53936
+ render(this);
53915
53937
  });
53916
53938
  onWillUpdateProps(() => {
53917
53939
  const sheetId = this.env.model.getters.getActiveSheetId();
@@ -53985,6 +54007,13 @@ var FiguresContainer = class extends Component {
53985
54007
  get selectedRectStyle() {
53986
54008
  return this.dnd.selectedRect ? this.rectToCss(this.dnd.selectedRect) : "";
53987
54009
  }
54010
+ get maxDimensions() {
54011
+ const sheetId = this.env.model.getters.getActiveSheetId();
54012
+ return {
54013
+ maxX: this.env.model.getters.getColDimensions(sheetId, this.env.model.getters.getNumberCols(sheetId) - 1).end,
54014
+ maxY: this.env.model.getters.getRowDimensions(sheetId, this.env.model.getters.getNumberRows(sheetId) - 1).end
54015
+ };
54016
+ }
53988
54017
  getInverseViewportPositionStyle(container) {
53989
54018
  const { scrollX, scrollY } = this.viewStore.activeSheetScrollInfo;
53990
54019
  const { x: viewportX, y: viewportY } = this.viewStore.mainViewportCoordinates;
@@ -54042,12 +54071,9 @@ var FiguresContainer = class extends Component {
54042
54071
  y: ev.clientY / zoom
54043
54072
  };
54044
54073
  const initialScrollPosition = this.viewStore.activeSheetScrollInfo;
54074
+ const maxDimensions = this.maxDimensions;
54045
54075
  const initialFigures = this.env.model.getters.getSelectedFigureIds().map((id) => this.env.model.getters.getFigure(sheetId, id)).filter(isDefined).map((f) => this.env.model.getters.getFigureUI(sheetId, f)).map(this.toBottomRightViewport.bind(this));
54046
54076
  const draggedFigureId = figureUI.id;
54047
- const maxDimensions = {
54048
- maxX: this.env.model.getters.getColDimensions(sheetId, this.env.model.getters.getNumberCols(sheetId) - 1).end,
54049
- maxY: this.env.model.getters.getRowDimensions(sheetId, this.env.model.getters.getNumberRows(sheetId) - 1).end
54050
- };
54051
54077
  let hasStartedDnd = false;
54052
54078
  let overlappingChartOrCarousel = void 0;
54053
54079
  const onMouseMove = (ev) => {
@@ -54094,7 +54120,7 @@ var FiguresContainer = class extends Component {
54094
54120
  ...this.viewStore.viewports.getPositionAnchorOffset(sheetId, f)
54095
54121
  };
54096
54122
  }) || [];
54097
- this.env.model.dispatch("MOVE_FIGURES", { figures: payloads });
54123
+ this.env.model.dispatch("UPDATE_FIGURES", { figures: payloads });
54098
54124
  } else {
54099
54125
  const overlappingFigureId = overlappingChartOrCarousel.id;
54100
54126
  const chartFigureIds = this.dnd.selectedFigures?.map((f) => f.id) || [];
@@ -54119,7 +54145,7 @@ var FiguresContainer = class extends Component {
54119
54145
  this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
54120
54146
  }
54121
54147
  /**
54122
- * Initialize the resize of a figure with mouse movements
54148
+ * Initialize the resize of the selected figures with mouse movements
54123
54149
  *
54124
54150
  * @param dirX X direction of the resize. -1 : resize from the left border of the figure, 0 : no resize in X, 1 :
54125
54151
  * resize from the right border of the figure
@@ -54127,44 +54153,78 @@ var FiguresContainer = class extends Component {
54127
54153
  * resize from the bottom border of the figure
54128
54154
  * @param ev Mouse Event
54129
54155
  */
54130
- startResize(figureUI, dirX, dirY, ev) {
54156
+ resizeAllSelectedFigures(dirX, dirY, ev) {
54131
54157
  ev.stopPropagation();
54132
- const initialScrollPosition = this.viewStore.activeSheetScrollInfo;
54133
- const keepRatio = figureRegistry.get(figureUI.tag).keepRatio || false;
54134
- const minFigSize = figureRegistry.get(figureUI.tag).minFigSize || 80;
54135
- const zoom = this.zoomStore.zoomLevel;
54136
54158
  const sheetId = this.env.model.getters.getActiveSheetId();
54159
+ const zoom = this.zoomStore.zoomLevel;
54137
54160
  const initialMousePosition = {
54138
54161
  x: ev.clientX / zoom,
54139
54162
  y: ev.clientY / zoom
54140
54163
  };
54141
- const maxDimensions = {
54142
- maxX: this.env.model.getters.getColDimensions(sheetId, this.env.model.getters.getNumberCols(sheetId) - 1).end,
54143
- maxY: this.env.model.getters.getRowDimensions(sheetId, this.env.model.getters.getNumberRows(sheetId) - 1).end
54144
- };
54164
+ const initialScrollPosition = this.viewStore.activeSheetScrollInfo;
54165
+ const maxDimensions = this.maxDimensions;
54166
+ const selectedFiguresIds = this.env.model.getters.getSelectedFigureIds();
54167
+ const initialFigures = selectedFiguresIds.map((id) => this.env.model.getters.getFigure(sheetId, id)).filter(isDefined).map((figure) => this.env.model.getters.getFigureUI(sheetId, figure)).map(this.toBottomRightViewport.bind(this));
54168
+ const mutlipleFiguresSelected = selectedFiguresIds.length > 1;
54169
+ const otherFiguresUI = this.getOtherFigures(selectedFiguresIds);
54170
+ if (initialFigures.length === 0) return;
54171
+ let minAggregateSize;
54172
+ if (mutlipleFiguresSelected) {
54173
+ const widthScaleMax = Math.max(...initialFigures.map((f) => {
54174
+ return figureRegistry.get(f.tag).minFigSize / f.width;
54175
+ }));
54176
+ const heightScaleMax = Math.max(...initialFigures.map((f) => {
54177
+ return figureRegistry.get(f.tag).minFigSize / f.height;
54178
+ }));
54179
+ const initialAggregateRect = rectUnion(...initialFigures);
54180
+ minAggregateSize = {
54181
+ width: Math.round(initialAggregateRect.width * widthScaleMax),
54182
+ height: Math.round(initialAggregateRect.height * heightScaleMax)
54183
+ };
54184
+ } else {
54185
+ const minFigSize = figureRegistry.get(initialFigures[0].tag).minFigSize;
54186
+ minAggregateSize = {
54187
+ width: minFigSize,
54188
+ height: minFigSize
54189
+ };
54190
+ }
54145
54191
  const onMouseMove = (ev) => {
54146
- const draggedFigure = dragFigureForResize(figureUI, dirX, dirY, {
54192
+ const currentMousePosition = {
54147
54193
  x: ev.clientX / zoom,
54148
54194
  y: ev.clientY / zoom
54149
- }, initialMousePosition, keepRatio, minFigSize, initialScrollPosition, this.viewStore.activeSheetScrollInfo, maxDimensions);
54150
- const otherFigures = this.getOtherFigures([figureUI.id]);
54151
- const snapResult = snapForResize(this.env, dirX, dirY, draggedFigure, otherFigures);
54152
- this.dnd.draggedFigure = snapResult.snappedFigures[0];
54153
- this.dnd.selectedFigures = [this.dnd.draggedFigure];
54154
- this.dnd.selectedRect = void 0;
54155
- this.dnd.horizontalSnap = this.getSnap(snapResult.horizontalSnapLine);
54156
- this.dnd.verticalSnap = this.getSnap(snapResult.verticalSnapLine);
54195
+ };
54196
+ const keepRatio = mutlipleFiguresSelected || ev.shiftKey ? true : figureRegistry.get(initialFigures[0].tag).keepRatio || false;
54197
+ const initialRect = rectUnion(...initialFigures);
54198
+ const resizedRect = dragFigureForResize(initialRect, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minAggregateSize, initialScrollPosition, this.viewStore.activeSheetScrollInfo, maxDimensions);
54199
+ const { snappedRect, verticalSnapLine, horizontalSnapLine } = snapForResize(this.env, dirX, dirY, resizedRect, otherFiguresUI);
54200
+ const scaleX = snappedRect.width / initialRect.width;
54201
+ const scaleY = snappedRect.height / initialRect.height;
54202
+ const snappedFigures = initialFigures.map((figureUI) => ({
54203
+ ...figureUI,
54204
+ x: Math.round(snappedRect.x + (figureUI.x - initialRect.x) * scaleX),
54205
+ y: Math.round(snappedRect.y + (figureUI.y - initialRect.y) * scaleY),
54206
+ width: Math.round(figureUI.width * scaleX),
54207
+ height: Math.round(figureUI.height * scaleY)
54208
+ }));
54209
+ this.dnd.draggedFigure = snappedFigures[0];
54210
+ this.dnd.selectedFigures = snappedFigures;
54211
+ this.dnd.selectedRect = this.getDndFigureRect();
54212
+ this.dnd.horizontalSnap = this.getSnap(horizontalSnapLine);
54213
+ this.dnd.verticalSnap = this.getSnap(verticalSnapLine);
54157
54214
  };
54158
- const onMouseUp = (ev) => {
54159
- if (!this.dnd.draggedFigure) return;
54160
- const update = this.viewStore.viewports.getPositionAnchorOffset(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure);
54161
- if (dirX) update.width = this.dnd.draggedFigure.width;
54162
- if (dirY) update.height = this.dnd.draggedFigure.height;
54163
- this.env.model.dispatch("UPDATE_FIGURE", {
54164
- sheetId: this.env.model.getters.getActiveSheetId(),
54165
- figureId: figureUI.id,
54166
- ...update
54215
+ const onMouseUp = () => {
54216
+ if (!this.dnd.selectedFigures) return;
54217
+ const dispatchPayload = this.dnd.selectedFigures.map((figureUI) => {
54218
+ const update = this.viewStore.viewports.getPositionAnchorOffset(sheetId, figureUI);
54219
+ if (dirX) update.width = figureUI.width;
54220
+ if (dirY) update.height = figureUI.height;
54221
+ return {
54222
+ sheetId,
54223
+ figureId: figureUI.id,
54224
+ ...update
54225
+ };
54167
54226
  });
54227
+ this.env.model.dispatch("UPDATE_FIGURES", { figures: dispatchPayload });
54168
54228
  this.dnd.draggedFigure = void 0;
54169
54229
  this.dnd.selectedFigures = void 0;
54170
54230
  this.dnd.selectedRect = void 0;
@@ -54827,7 +54887,7 @@ function useTouchHandlers(ref, { updateScroll, canMoveUp, canMoveDown, getZoom,
54827
54887
  passive: false,
54828
54888
  capture: false
54829
54889
  });
54830
- useExternalListener(window, "pointerup", onPointerUp, {
54890
+ useListener(window, "pointerup", onPointerUp, {
54831
54891
  passive: false,
54832
54892
  capture: true
54833
54893
  });
@@ -55391,10 +55451,10 @@ var Grid = class extends Component {
55391
55451
  this.checkboxToggleStore = useStore(CheckboxToggleStore);
55392
55452
  useStore(ArrayFormulaHighlight);
55393
55453
  this.automaticSumStore = useLocalStore(AutomaticSumStore);
55394
- useChildSubEnv({ getPopoverContainerRect: () => this.getGridRect() });
55395
- useExternalListener(document.body, "cut", this.copy.bind(this, true));
55396
- useExternalListener(document.body, "copy", this.copy.bind(this, false));
55397
- useExternalListener(document.body, "paste", this.paste);
55454
+ useSubEnv({ getPopoverContainerRect: () => this.getGridRect() });
55455
+ useListener(document.body, "cut", this.copy.bind(this, true));
55456
+ useListener(document.body, "copy", this.copy.bind(this, false));
55457
+ useListener(document.body, "paste", this.paste.bind(this));
55398
55458
  onMounted(() => this.focusDefaultElement());
55399
55459
  this.props.exposeFocus(() => this.focusDefaultElement());
55400
55460
  useGridDrawing({
@@ -64525,36 +64585,37 @@ function generateMasterChartConfig(chartJsConfig) {
64525
64585
  //#endregion
64526
64586
  //#region src/plugins/ui_core_views/evaluation_chart.ts
64527
64587
  var EvaluationChartPlugin = class extends CoreViewPlugin {
64528
- static getters = ["getChartRuntime", "getStyleOfSingleCellChart"];
64588
+ static getters = ["getStyleOfSingleCellChart", "getChartRuntimeWithTheme"];
64529
64589
  charts = {};
64530
64590
  handle(cmd) {
64531
- if (invalidateEvaluationCommands.has(cmd.type) || invalidateCFEvaluationCommands.has(cmd.type) || invalidateChartEvaluationCommands.has(cmd.type)) for (const chartId in this.charts) this.charts[chartId] = void 0;
64591
+ if (invalidateEvaluationCommands.has(cmd.type) || invalidateCFEvaluationCommands.has(cmd.type) || invalidateChartEvaluationCommands.has(cmd.type)) for (const chartId in this.charts) this.charts[chartId] = {};
64532
64592
  switch (cmd.type) {
64533
64593
  case "UPDATE_CHART":
64534
64594
  case "CREATE_CHART":
64535
- this.charts[cmd.chartId] = void 0;
64595
+ this.charts[cmd.chartId] = {};
64536
64596
  break;
64537
64597
  case "DELETE_CHART":
64538
- this.charts[cmd.chartId] = void 0;
64598
+ this.charts[cmd.chartId] = {};
64539
64599
  break;
64540
64600
  case "DELETE_SHEET":
64541
- for (const chartId in this.charts) if (!this.getters.isChartDefined(chartId)) this.charts[chartId] = void 0;
64601
+ for (const chartId in this.charts) if (!this.getters.isChartDefined(chartId)) this.charts[chartId] = {};
64542
64602
  break;
64543
64603
  }
64544
64604
  }
64545
- getChartRuntime(chartId) {
64546
- if (!this.charts[chartId]) {
64605
+ getChartRuntimeWithTheme(chartId, colorThemeName) {
64606
+ if (!this.charts[chartId]) this.charts[chartId] = {};
64607
+ if (!this.charts[chartId][colorThemeName]) {
64547
64608
  const chart = this.getters.getChart(chartId);
64548
64609
  if (!chart) throw new Error(`No chart for the given id: ${chartId}`);
64549
- this.charts[chartId] = this.createRuntimeChart(chartId, chart);
64610
+ this.charts[chartId][colorThemeName] = this.createRuntimeChart(chartId, chart, colorThemeName);
64550
64611
  }
64551
- return this.charts[chartId];
64612
+ return this.charts[chartId][colorThemeName];
64552
64613
  }
64553
64614
  /**
64554
64615
  * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
64555
64616
  */
64556
- getStyleOfSingleCellChart(chartBackground, mainRange) {
64557
- const themeBackground = this.getters.getSpreadsheetTheme().backgroundColor;
64617
+ getStyleOfSingleCellChart(chartBackground, mainRange, colorThemeName) {
64618
+ const themeBackground = COLOR_THEMES[colorThemeName].backgroundColor;
64558
64619
  if (chartBackground) return {
64559
64620
  background: chartBackground,
64560
64621
  fontColor: chartFontColor(chartBackground)
@@ -64595,7 +64656,7 @@ var EvaluationChartPlugin = class extends CoreViewPlugin {
64595
64656
  else {
64596
64657
  if (!chart) continue;
64597
64658
  const type = this.getters.getChartType(chartId);
64598
- const img = await chartToImageUrl(this.getters.getChartRuntime(chartId), figure, type);
64659
+ const img = await chartToImageUrl(this.getChartRuntimeWithTheme(chartId, "light"), figure, type);
64599
64660
  if (img) sheet.images.push({
64600
64661
  ...figure,
64601
64662
  tag: "image",
@@ -64613,9 +64674,9 @@ var EvaluationChartPlugin = class extends CoreViewPlugin {
64613
64674
  sheet.charts = figures;
64614
64675
  }
64615
64676
  }
64616
- createRuntimeChart(chartId, chart) {
64677
+ createRuntimeChart(chartId, chart, colorThemeName) {
64617
64678
  const definition = chart.getRangeDefinition();
64618
- const runtime = chart.getRuntime(this.getters, chartId);
64679
+ const runtime = chart.getRuntime(this.getters, chartId, colorThemeName);
64619
64680
  if ("chartJsConfig" in runtime && /line|combo|bar|scatter|waterfall/.test(definition.type)) {
64620
64681
  const chartJsConfig = runtime.chartJsConfig;
64621
64682
  runtime["masterChartConfig"] = generateMasterChartConfig(chartJsConfig);
@@ -65981,6 +66042,39 @@ var PivotUIPlugin = class extends CoreViewPlugin {
65981
66042
  }
65982
66043
  };
65983
66044
 
66045
+ //#endregion
66046
+ //#region src/plugins/ui_plugin.ts
66047
+ /**
66048
+ * UI plugins handle any transient data required to display a spreadsheet.
66049
+ * They can draw on the grid canvas.
66050
+ */
66051
+ var UIPlugin = class extends BasePlugin {
66052
+ static layers = [];
66053
+ getters;
66054
+ ui;
66055
+ selection;
66056
+ dispatch;
66057
+ canDispatch;
66058
+ constructor({ getters, stateObserver, dispatch, canDispatch, uiActions, selection }) {
66059
+ super(stateObserver);
66060
+ this.getters = getters;
66061
+ this.ui = uiActions;
66062
+ this.selection = selection;
66063
+ this.dispatch = dispatch;
66064
+ this.canDispatch = canDispatch;
66065
+ }
66066
+ drawLayer(ctx, layer) {}
66067
+ };
66068
+
66069
+ //#endregion
66070
+ //#region src/plugins/ui_feature/chart_ui.ts
66071
+ var ChartUIPlugin = class extends UIPlugin {
66072
+ static getters = ["getChartRuntime"];
66073
+ getChartRuntime(chartId) {
66074
+ return this.getters.getChartRuntimeWithTheme(chartId, this.getters.getSpreadsheetTheme().colorThemeName);
66075
+ }
66076
+ };
66077
+
65984
66078
  //#endregion
65985
66079
  //#region src/helpers/range_adapter_functions.ts
65986
66080
  function getRangeAdapterFunctions(executedCommand) {
@@ -66970,30 +67064,6 @@ var Session = class extends EventBus {
66970
67064
  }
66971
67065
  };
66972
67066
 
66973
- //#endregion
66974
- //#region src/plugins/ui_plugin.ts
66975
- /**
66976
- * UI plugins handle any transient data required to display a spreadsheet.
66977
- * They can draw on the grid canvas.
66978
- */
66979
- var UIPlugin = class extends BasePlugin {
66980
- static layers = [];
66981
- getters;
66982
- ui;
66983
- selection;
66984
- dispatch;
66985
- canDispatch;
66986
- constructor({ getters, stateObserver, dispatch, canDispatch, uiActions, selection }) {
66987
- super(stateObserver);
66988
- this.getters = getters;
66989
- this.ui = uiActions;
66990
- this.selection = selection;
66991
- this.dispatch = dispatch;
66992
- this.canDispatch = canDispatch;
66993
- }
66994
- drawLayer(ctx, layer) {}
66995
- };
66996
-
66997
67067
  //#endregion
66998
67068
  //#region src/plugins/ui_feature/collaborative.ts
66999
67069
  var CollaborativePlugin = class extends UIPlugin {
@@ -67077,41 +67147,6 @@ var CollaborativePlugin = class extends UIPlugin {
67077
67147
 
67078
67148
  //#endregion
67079
67149
  //#region src/plugins/ui_feature/color_theme.ts
67080
- const FROZEN_PANE_HEADER_BORDER_COLOR = "#BCBCBC";
67081
- const FROZEN_PANE_BORDER_COLOR = "#DADFE8";
67082
- const HEADER_BORDER_COLOR = "#C0C0C0";
67083
- const TEXT_HEADER_COLOR = "#666666";
67084
- const BACKGROUND_HEADER_COLOR = "#F8F9FA";
67085
- const BACKGROUND_HEADER_SELECTED_COLOR = "#E8EAED";
67086
- const BACKGROUND_HEADER_ACTIVE_COLOR = "#595959";
67087
- const COLOR_THEMES = {
67088
- light: {
67089
- backgroundColor: "#FFFFFF",
67090
- gridBorderColor: "#CECFCF",
67091
- headerBackgroundColor: BACKGROUND_HEADER_COLOR,
67092
- headerActiveBackgroundColor: BACKGROUND_HEADER_ACTIVE_COLOR,
67093
- headerSelectedBackgroundColor: BACKGROUND_HEADER_SELECTED_COLOR,
67094
- headerTextColor: TEXT_HEADER_COLOR,
67095
- headerBorderColor: HEADER_BORDER_COLOR,
67096
- frozenPaneBorderColor: FROZEN_PANE_BORDER_COLOR,
67097
- frozenPaneHeaderBorderColor: FROZEN_PANE_HEADER_BORDER_COLOR,
67098
- singleCellSelectionBackgroundColor: "#F3F7FE",
67099
- multipleCellsSelectionBackgroundColor: "#E9F0FF"
67100
- },
67101
- dark: {
67102
- backgroundColor: adaptForDarkMode("#1A1C2E"),
67103
- gridBorderColor: adaptForDarkMode("#6B706F"),
67104
- headerBackgroundColor: adaptForDarkMode("#262A36"),
67105
- headerActiveBackgroundColor: adaptForDarkMode("#3A4052"),
67106
- headerSelectedBackgroundColor: adaptForDarkMode("#4E566E"),
67107
- headerTextColor: adaptForDarkMode("#A1A6B3"),
67108
- headerBorderColor: adaptForDarkMode("#7A7F91"),
67109
- frozenPaneBorderColor: adaptForDarkMode("#7A7F91"),
67110
- frozenPaneHeaderBorderColor: adaptForDarkMode("#9FA5BD"),
67111
- singleCellSelectionBackgroundColor: adaptForDarkMode("#696E8044"),
67112
- multipleCellsSelectionBackgroundColor: adaptForDarkMode("#828AA044")
67113
- }
67114
- };
67115
67150
  var ColorThemeUIPlugin = class extends UIPlugin {
67116
67151
  static getters = ["isDarkMode", "getSpreadsheetTheme"];
67117
67152
  colorScheme;
@@ -69382,7 +69417,7 @@ var FigureUIPlugin = class extends UIPlugin {
69382
69417
  static getters = ["getFigureUI"];
69383
69418
  allowDispatch(cmd) {
69384
69419
  switch (cmd.type) {
69385
- case "MOVE_FIGURES":
69420
+ case "UPDATE_FIGURES":
69386
69421
  for (const updateFigurePayload of cmd.figures) {
69387
69422
  const result = this.canDispatch("UPDATE_FIGURE", updateFigurePayload);
69388
69423
  if (!result.isSuccessful) return result.reasons;
@@ -69406,7 +69441,7 @@ var FigureUIPlugin = class extends UIPlugin {
69406
69441
  }
69407
69442
  handle(cmd) {
69408
69443
  switch (cmd.type) {
69409
- case "MOVE_FIGURES":
69444
+ case "UPDATE_FIGURES":
69410
69445
  for (const updateFigurePayload of cmd.figures) this.dispatch("UPDATE_FIGURE", updateFigurePayload);
69411
69446
  break;
69412
69447
  case "DELETE_FIGURES":
@@ -70553,7 +70588,7 @@ var GridSelectionPlugin = class extends UIPlugin {
70553
70588
  //#endregion
70554
70589
  //#region src/plugins/plugin_registries.ts
70555
70590
  const corePluginRegistry = new Registry().add("settings", SettingsPlugin).add("sheet", SheetPlugin).add("header grouping", HeaderGroupingPlugin).add("header visibility", HeaderVisibilityPlugin).add("tables", TablePlugin).add("dataValidation", DataValidationPlugin).add("cell", CellPlugin).add("default", DefaultPlugin).add("merge", MergePlugin).add("headerSize", HeaderSizePlugin).add("borders", BordersPlugin).add("conditional formatting", ConditionalFormatPlugin).add("figures", FigurePlugin).add("chart", ChartPlugin).add("carousel", CarouselPlugin).add("image", ImagePlugin).add("named_ranges", NamedRangesPlugin).add("pivot_core", PivotCorePlugin).add("spreadsheet_pivot_core", SpreadsheetPivotCorePlugin).add("tableStyle", TableStylePlugin);
70556
- const featurePluginRegistry = new Registry().add("ui_sheet", SheetUIPlugin).add("ui_options", UIOptionsPlugin).add("sort", SortPlugin).add("format", FormatPlugin).add("insert_pivot", InsertPivotPlugin).add("pivot_presence", PivotPresencePlugin).add("subtotal_evaluation", SubtotalEvaluationPlugin).add("collaborative", CollaborativePlugin).add("history", HistoryPlugin).add("datavalidation_insert", DataValidationInsertionPlugin).add("dynamic_translate", DynamicTranslate).add("geo_features", GeoFeaturePlugin).add("color_theme", ColorThemeUIPlugin).add("lock_sheet", LockSheetPlugin);
70591
+ const featurePluginRegistry = new Registry().add("ui_sheet", SheetUIPlugin).add("ui_options", UIOptionsPlugin).add("sort", SortPlugin).add("format", FormatPlugin).add("insert_pivot", InsertPivotPlugin).add("pivot_presence", PivotPresencePlugin).add("subtotal_evaluation", SubtotalEvaluationPlugin).add("collaborative", CollaborativePlugin).add("history", HistoryPlugin).add("datavalidation_insert", DataValidationInsertionPlugin).add("dynamic_translate", DynamicTranslate).add("geo_features", GeoFeaturePlugin).add("color_theme", ColorThemeUIPlugin).add("lock_sheet", LockSheetPlugin).add("chart_ui", ChartUIPlugin);
70557
70592
  const statefulUIPluginRegistry = new Registry().add("selection", GridSelectionPlugin).add("evaluation_filter", FilterEvaluationPlugin).add("header_visibility_ui", HeaderVisibilityUIPlugin).add("cell_computed_style", CellComputedStylePlugin).add("table_computed_style", TableComputedStylePlugin).add("header_positions", HeaderPositionsUIPlugin).add("clipboard", ClipboardPlugin).add("carousel_ui", CarouselUIPlugin).add("figure_ui", FigureUIPlugin);
70558
70593
  const coreViewsPluginRegistry = new Registry().add("evaluation", EvaluationPlugin).add("evaluation_chart", EvaluationChartPlugin).add("fingerprints", FingerprintPlugin).add("evaluation_cf", EvaluationConditionalFormatPlugin).add("row_size", HeaderSizeUIPlugin).add("data_validation_ui", EvaluationDataValidationPlugin).add("dynamic_tables", DynamicTablesPlugin).add("custom_colors", CustomColorsPlugin).add("pivot_ui", PivotUIPlugin).add("cell_icon", CellIconPlugin).add("formula_tracker", FormulaTrackerPlugin);
70559
70594
 
@@ -71495,6 +71530,31 @@ var ImageProvider = class {
71495
71530
  var MainViewportStore = class extends SpreadsheetStore {
71496
71531
  viewStore = this.get(ViewportsStore);
71497
71532
  sheetIdAtFinalize = void 0;
71533
+ constructor(get) {
71534
+ super(get);
71535
+ this.model.selection.observe(this, { handleEvent: this.handleEvent.bind(this) });
71536
+ this.onDispose(() => {
71537
+ this.model.selection.unobserve(this);
71538
+ });
71539
+ }
71540
+ handleEvent(event) {
71541
+ const eventSheetId = this.getters.getActiveSheetId();
71542
+ if (event.options.scrollIntoView) {
71543
+ const oldZone = event.previousAnchor.zone;
71544
+ const newZone = event.anchor.zone;
71545
+ const isUpdateAnchorEvent = event.mode === "updateAnchor";
71546
+ const sameZone = isEqual(oldZone, newZone);
71547
+ let { col, row } = isUpdateAnchorEvent && sameZone ? event.anchor.cell : findCellInNewZone(oldZone, newZone);
71548
+ if (isUpdateAnchorEvent && !sameZone) {
71549
+ const { top, bottom, left, right } = this.viewStore.viewports.getMainInternalViewport(eventSheetId);
71550
+ if (oldZone.left === newZone.left && oldZone.right === newZone.right) col = left > col || col > right ? left : col;
71551
+ if (oldZone.top === newZone.top && oldZone.bottom === newZone.bottom) row = top > row || row > bottom ? top : row;
71552
+ }
71553
+ col = Math.min(col, this.getters.getNumberCols(eventSheetId) - 1);
71554
+ row = Math.min(row, this.getters.getNumberRows(eventSheetId) - 1);
71555
+ this.viewStore.scrollToCell(eventSheetId, col, row);
71556
+ }
71557
+ }
71498
71558
  handle(cmd) {
71499
71559
  switch (cmd.type) {
71500
71560
  case "UNDO":
@@ -71884,7 +71944,7 @@ var BottomBarSheet = class extends Component {
71884
71944
  DOMFocusableElementStore;
71885
71945
  setup() {
71886
71946
  this.DOMFocusableElementStore = useStore(DOMFocusableElementStore);
71887
- useExternalListener(window, "click", this.onExternalClick.bind(this), { capture: true });
71947
+ useListener(window, "click", this.onExternalClick.bind(this), { capture: true });
71888
71948
  useLayoutEffect(() => {}, () => [this.state.isEditing]);
71889
71949
  onPatched(() => {
71890
71950
  if (this.sheetNameRef() && this.state.isEditing && this.editionState === "initializing") {
@@ -72448,7 +72508,7 @@ var SpreadsheetDashboard = class extends Component {
72448
72508
  this.zoomStore = useStore(ZoomStore);
72449
72509
  useLocalStore(HoveredTableStore);
72450
72510
  const rendererStore = useLocalStore(RendererStore, OrderedLayers().filter((layer) => layer !== "Headers"));
72451
- useChildSubEnv({ getPopoverContainerRect: () => this.zoomStore.getZoomedRect(this.getGridRect()) });
72511
+ useSubEnv({ getPopoverContainerRect: () => this.zoomStore.getZoomedRect(this.getGridRect()) });
72452
72512
  useGridDrawing({
72453
72513
  canvasRef: this.canvasRef,
72454
72514
  rendererStore,
@@ -72520,13 +72580,12 @@ var SpreadsheetDashboard = class extends Component {
72520
72580
  return this.env.model.getters.getColDimensions(sheetId, right).end;
72521
72581
  }
72522
72582
  get dashboardStyle() {
72523
- const style = { zoom: this.zoomStore.cssZoom };
72524
- if (this.env.model.getters.getActiveSheet().backgroundColor) style["background-color"] = "transparent";
72525
- return cssPropertiesToCss(style);
72583
+ return cssPropertiesToCss({ zoom: this.zoomStore.cssZoom });
72526
72584
  }
72527
72585
  get backgroundStyle() {
72528
72586
  const sheet = this.env.model.getters.getActiveSheet();
72529
- return sheet.backgroundColor ? cssPropertiesToCss({ "background-color": sheet.backgroundColor }) : "";
72587
+ const theme = this.env.model.getters.getSpreadsheetTheme();
72588
+ return cssPropertiesToCss({ "background-color": sheet.backgroundColor || theme.backgroundColor });
72530
72589
  }
72531
72590
  };
72532
72591
 
@@ -72872,7 +72931,7 @@ var RibbonMenu = class extends Component {
72872
72931
  parentState: void 0
72873
72932
  });
72874
72933
  setup() {
72875
- useExternalListener(window, "click", this.onExternalClick, { capture: true });
72934
+ useListener(window, "click", this.onExternalClick.bind(this), { capture: true });
72876
72935
  onMounted(this.updateShadows);
72877
72936
  }
72878
72937
  onExternalClick(ev) {
@@ -73526,7 +73585,7 @@ var SpreadsheetPrint = class extends Component {
73526
73585
  setup() {
73527
73586
  this.printStore = useLocalStore(SpreadsheetPrintStore);
73528
73587
  let styleElement = null;
73529
- useExternalListener(window, "beforeprint", () => {
73588
+ useListener(window, "beforeprint", () => {
73530
73589
  styleElement = document.createElement("style");
73531
73590
  styleElement.id = "o-spreadsheet-print-style";
73532
73591
  const size = `${this.printStore.pageLayout} ${this.printStore.orientation}`;
@@ -73539,7 +73598,7 @@ var SpreadsheetPrint = class extends Component {
73539
73598
  styleElement = null;
73540
73599
  }
73541
73600
  };
73542
- useExternalListener(window, "afterprint", () => removePrintStyle());
73601
+ useListener(window, "afterprint", () => removePrintStyle());
73543
73602
  onWillUnmount(() => removePrintStyle());
73544
73603
  }
73545
73604
  get pageStyle() {
@@ -74528,8 +74587,8 @@ var TopBar = class extends Component {
74528
74587
  this.composerFocusStore = useStore(ComposerFocusStore);
74529
74588
  this.fingerprints = useStore(FormulaFingerprintStore);
74530
74589
  this.topBarToolStore = useStore(TopBarToolStore);
74531
- useExternalListener(window, "click", this.onExternalClick);
74532
- useExternalListener(window, "keydown", this.onKeydown);
74590
+ useListener(window, "click", this.onExternalClick.bind(this));
74591
+ useListener(window, "keydown", this.onKeydown.bind(this));
74533
74592
  this.menus = topbarMenuRegistry.getMenuItems();
74534
74593
  let lastWidth;
74535
74594
  const updateVisibility = () => {
@@ -74856,9 +74915,9 @@ var Spreadsheet = class extends Component {
74856
74915
  const el = this.spreadsheetRef();
74857
74916
  if (el && !el.contains(document.activeElement) && document.activeElement?.contains(el)) this.focusGrid();
74858
74917
  });
74859
- useExternalListener(window, "resize", () => this.render(true));
74860
- useExternalListener(document.body, "wheel", () => {});
74861
- useExternalListener(window, "keydown", async (event) => {
74918
+ useListener(window, "resize", () => render(this, true));
74919
+ useListener(document.body, "wheel", () => {});
74920
+ useListener(window, "keydown", async (event) => {
74862
74921
  if (keyboardEventToShortcutString(event) === "Ctrl+P") {
74863
74922
  this.state.printModeEnabled = true;
74864
74923
  event.stopPropagation();
@@ -74878,11 +74937,11 @@ var Spreadsheet = class extends Component {
74878
74937
  resizeObserver.observe(el);
74879
74938
  return () => resizeObserver.disconnect();
74880
74939
  });
74881
- const render = batched(this.render.bind(this, true));
74940
+ const batchedRender = batched(() => render(this, true));
74882
74941
  onMounted(() => {
74883
74942
  this.bindModelEvents();
74884
74943
  this.checkViewportSize();
74885
- stores.on("store-updated", this, render);
74944
+ stores.on("store-updated", this, batchedRender);
74886
74945
  });
74887
74946
  onWillUnmount(() => {
74888
74947
  this.unbindModelEvents();
@@ -74894,7 +74953,7 @@ var Spreadsheet = class extends Component {
74894
74953
  });
74895
74954
  }
74896
74955
  bindModelEvents() {
74897
- this.model.on("update", this, () => this.render(true));
74956
+ this.model.on("update", this, () => render(this, true));
74898
74957
  this.model.on("command-rejected", this, ({ result }) => {
74899
74958
  if (result.isCancelledBecause("SheetLocked")) this.notificationStore.notifyUser({
74900
74959
  type: "info",
@@ -80967,6 +81026,10 @@ var LinkEditor = class extends Component {
80967
81026
  this.computeLinks();
80968
81027
  onMounted(() => this.urlInput()?.focus());
80969
81028
  }
81029
+ onLinkUrlInput(ev) {
81030
+ this.state.url = ev.target.value;
81031
+ this.computeLinks();
81032
+ }
80970
81033
  computeLinks() {
80971
81034
  this.state.selectedIndex = null;
80972
81035
  this.state.linksByCategory = this.linkProposalByCategory;
@@ -81666,8 +81729,8 @@ const BubbleChart = {
81666
81729
  };
81667
81730
  },
81668
81731
  copyInSheetId: (definition) => definition,
81669
- getRuntime(getters, definition) {
81670
- const chartData = getBubbleChartData(definition, getters);
81732
+ getRuntime(getters, definition, chartDataExtractors, sheetId, eventHandlers, colorThemeName) {
81733
+ const chartData = getBubbleChartData(definition, getters, colorThemeName);
81671
81734
  return { chartJsConfig: {
81672
81735
  type: "line",
81673
81736
  data: {
@@ -81742,8 +81805,8 @@ const CalendarChart = {
81742
81805
  };
81743
81806
  },
81744
81807
  getDefinitionForExcel: () => void 0,
81745
- getRuntime(getters, definition, { extractData }) {
81746
- const chartData = getCalendarChartData(definition, extractData(), getters);
81808
+ getRuntime(getters, definition, { extractData }, sheetId, eventHandlers, colorThemeName) {
81809
+ const chartData = getCalendarChartData(definition, extractData(), getters, colorThemeName);
81747
81810
  const { labels, datasets } = getCalendarChartDatasetAndLabels(definition, chartData);
81748
81811
  return { chartJsConfig: {
81749
81812
  type: "calendar",
@@ -81829,8 +81892,8 @@ const ComboChart = {
81829
81892
  annotationLink: context.annotationLink
81830
81893
  };
81831
81894
  },
81832
- getRuntime(getters, definition, { extractData }, sheetId, eventHandlers) {
81833
- const chartData = getBarChartData(definition, extractData(), getters);
81895
+ getRuntime(getters, definition, { extractData }, sheetId, eventHandlers, colorThemeName) {
81896
+ const chartData = getBarChartData(definition, extractData(), getters, colorThemeName);
81834
81897
  return {
81835
81898
  chartJsConfig: {
81836
81899
  type: "bar",
@@ -81906,8 +81969,8 @@ const FunnelChart = {
81906
81969
  };
81907
81970
  },
81908
81971
  getDefinitionForExcel: () => void 0,
81909
- getRuntime(getters, definition, { extractData }, sheetId, eventHandlers) {
81910
- const chartData = getFunnelChartData(definition, extractData(), getters);
81972
+ getRuntime(getters, definition, { extractData }, sheetId, eventHandlers, colorThemeName) {
81973
+ const chartData = getFunnelChartData(definition, extractData(), getters, colorThemeName);
81911
81974
  return { chartJsConfig: {
81912
81975
  type: "funnel",
81913
81976
  data: {
@@ -81969,8 +82032,8 @@ const GeoChart = {
81969
82032
  };
81970
82033
  },
81971
82034
  getDefinitionForExcel: () => void 0,
81972
- getRuntime(getters, definition, { extractData }, sheetId, eventHandlers) {
81973
- const chartData = getGeoChartData(definition, extractData(), getters);
82035
+ getRuntime(getters, definition, { extractData }, sheetId, eventHandlers, colorThemeName) {
82036
+ const chartData = getGeoChartData(definition, extractData(), getters, colorThemeName);
81974
82037
  return { chartJsConfig: {
81975
82038
  type: "choropleth",
81976
82039
  data: { datasets: getGeoChartDatasets(definition, chartData) },
@@ -82039,7 +82102,7 @@ const PyramidChart = {
82039
82102
  },
82040
82103
  getDefinitionForExcel(getters, definition, { dataSets, labelRange }) {
82041
82104
  if (definition.dataSource.type !== "range") return;
82042
- const chartData = getPyramidChartData(definition, getChartData(getters, definition.dataSource), getters);
82105
+ const chartData = getPyramidChartData(definition, getChartData(getters, definition.dataSource), getters, "light");
82043
82106
  const { dataSetsValues } = chartData;
82044
82107
  const maxValue = Math.max(...dataSetsValues.map((dataSet) => Math.max(...dataSet.data.map((cell) => isNumberResult(cell) ? Math.abs(cell.value) : -Infinity))));
82045
82108
  return {
@@ -82053,8 +82116,8 @@ const PyramidChart = {
82053
82116
  maxValue
82054
82117
  };
82055
82118
  },
82056
- getRuntime(getters, definition, { extractData }, sheetId, eventHandlers) {
82057
- const chartData = getPyramidChartData(definition, extractData(), getters);
82119
+ getRuntime(getters, definition, { extractData }, sheetId, eventHandlers, colorThemeName) {
82120
+ const chartData = getPyramidChartData(definition, extractData(), getters, colorThemeName);
82058
82121
  return {
82059
82122
  chartJsConfig: {
82060
82123
  type: "bar",
@@ -82136,8 +82199,8 @@ const RadarChart = {
82136
82199
  labelRange
82137
82200
  };
82138
82201
  },
82139
- getRuntime(getters, definition, { extractData }, sheetId, eventHandlers) {
82140
- const chartData = getRadarChartData(definition, extractData(), getters);
82202
+ getRuntime(getters, definition, { extractData }, sheetId, eventHandlers, colorThemeName) {
82203
+ const chartData = getRadarChartData(definition, extractData(), getters, colorThemeName);
82141
82204
  return {
82142
82205
  chartJsConfig: {
82143
82206
  type: "radar",
@@ -82217,8 +82280,8 @@ const ScatterChart = {
82217
82280
  verticalAxis: getDefinedAxis(definition)
82218
82281
  };
82219
82282
  },
82220
- getRuntime(getters, definition, { extractData }, sheetId, eventHandlers) {
82221
- const chartData = getLineChartData(definition, extractData(), getters);
82283
+ getRuntime(getters, definition, { extractData }, sheetId, eventHandlers, colorThemeName) {
82284
+ const chartData = getLineChartData(definition, extractData(), getters, colorThemeName);
82222
82285
  return {
82223
82286
  chartJsConfig: {
82224
82287
  type: "line",
@@ -82296,8 +82359,8 @@ const SunburstChart = {
82296
82359
  };
82297
82360
  },
82298
82361
  getDefinitionForExcel: () => void 0,
82299
- getRuntime(getters, definition, { extractHierarchicalData }, sheetId, eventHandlers) {
82300
- const chartData = getHierarchalChartData(definition, extractHierarchicalData(), getters);
82362
+ getRuntime(getters, definition, { extractHierarchicalData }, sheetId, eventHandlers, colorThemeName) {
82363
+ const chartData = getHierarchalChartData(definition, extractHierarchicalData(), getters, colorThemeName);
82301
82364
  return { chartJsConfig: {
82302
82365
  type: "doughnut",
82303
82366
  data: { datasets: getSunburstChartDatasets(definition, chartData) },
@@ -82370,8 +82433,8 @@ const TreeMapChart = {
82370
82433
  };
82371
82434
  },
82372
82435
  getDefinitionForExcel: () => void 0,
82373
- getRuntime(getters, definition, { extractHierarchicalData }, sheetId, eventHandlers) {
82374
- const chartData = getHierarchalChartData(definition, extractHierarchicalData(), getters);
82436
+ getRuntime(getters, definition, { extractHierarchicalData }, sheetId, eventHandlers, colorThemeName) {
82437
+ const chartData = getHierarchalChartData(definition, extractHierarchicalData(), getters, colorThemeName);
82375
82438
  return { chartJsConfig: {
82376
82439
  type: "treemap",
82377
82440
  data: {
@@ -90858,7 +90921,6 @@ const hooks = {
90858
90921
  };
90859
90922
  const compatibility = {
90860
90923
  Component,
90861
- useExternalListener,
90862
90924
  EnvPlugin,
90863
90925
  App: App$1
90864
90926
  };
@@ -90914,6 +90976,6 @@ const chartHelpers = {
90914
90976
  //#endregion
90915
90977
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, BadExpressionError, CHART_TYPES, CellErrorType, CellValueType, CircularDependencyError, ClientDisconnectedError, ClipboardMIMEType, CommandResult, CompiledFormula, CorePlugin, CoreViewPlugin, DEFAULT_LOCALE, DEFAULT_LOCALES, DEFAULT_LOCALE_DIGIT_GROUPING, DIRECTION, DispatchResult, DivisionByZeroError, EvaluationError, InvalidReferenceError, LocalTransportService, Model, NEXT_VALUE, NotAvailableError, NumberTooLargeError, OrderedLayers, PREVIOUS_VALUE, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, SplillBlockedError, Spreadsheet, SpreadsheetPivotTable, UIPlugin, UnknownFunctionError, __info__, addFunction, addRenderingLayer, astToFormula, availableConditionalFormatOperators, availableDataValidationOperators, availableFiltersOperators, borderPositions, borderStyles, canExecuteInReadonly, categories, chartHelpers, compatibility, components, composerFocusTypes, constants, convertAstNodes, coreTypes, createAutocompleteArgumentsProvider, errorTypes, filterDateCriterionOperators, filterNumberCriterionOperators, filterTextCriterionOperators, findCellInNewZone, functionCache, getCaretDownSvg, getCaretUpSvg, helpers, hooks, invalidSubtotalFormulasCommands, invalidateBordersCommands, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, isCoreCommand, isHeadersDependant, isMatrix, isPositionDependent, isRangeDependant, isSheetDependent, isTargetDependent, isZoneDependent, iterateAstNodes, links, load, lockedSheetAllowedCommands, parse, parseTokens, readonlyAllowedCommands, registries, schemeToColorScale, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
90916
90978
 
90917
- __info__.version = "19.5.0-alpha.12";
90918
- __info__.date = "2026-08-19T09:47:03.774Z";
90919
- __info__.hash = "68ca68e";
90979
+ __info__.version = "19.5.0-alpha.14";
90980
+ __info__.date = "2026-08-29T09:17:09.184Z";
90981
+ __info__.hash = "e8ad6ad";