@odoo/o-spreadsheet 18.2.10 → 18.2.11

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.
@@ -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 18.2.10
6
- * @date 2025-05-02T12:34:39.632Z
7
- * @hash e8ff3fc
5
+ * @version 18.2.11
6
+ * @date 2025-05-12T05:25:59.138Z
7
+ * @hash eb87dca
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -6280,6 +6280,25 @@ function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
6280
6280
  })
6281
6281
  .filter(isDefined);
6282
6282
  }
6283
+ function getNextSheetName(existingNames, baseName = "Sheet") {
6284
+ let i = 1;
6285
+ let name = `${baseName}${i}`;
6286
+ while (existingNames.includes(name)) {
6287
+ name = `${baseName}${i}`;
6288
+ i++;
6289
+ }
6290
+ return name;
6291
+ }
6292
+ function getDuplicateSheetName(nameToDuplicate, existingNames) {
6293
+ let i = 1;
6294
+ const baseName = _t("Copy of %s", nameToDuplicate);
6295
+ let name = baseName.toString();
6296
+ while (existingNames.includes(name)) {
6297
+ name = `${baseName} (${i})`;
6298
+ i++;
6299
+ }
6300
+ return name;
6301
+ }
6283
6302
 
6284
6303
  function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
6285
6304
  return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
@@ -7978,6 +7997,24 @@ const monthNumberAdapter = {
7978
7997
  return `${normalizedValue}`;
7979
7998
  },
7980
7999
  };
8000
+ /**
8001
+ * normalizes month number + year
8002
+ */
8003
+ const monthAdapter = {
8004
+ normalizeFunctionValue(value) {
8005
+ const date = toNumber(value, DEFAULT_LOCALE);
8006
+ return formatValue(date, { locale: DEFAULT_LOCALE, format: "mm/yyyy" });
8007
+ },
8008
+ toValueAndFormat(normalizedValue) {
8009
+ return {
8010
+ value: toNumber(normalizedValue, DEFAULT_LOCALE),
8011
+ format: "mmmm yyyy",
8012
+ };
8013
+ },
8014
+ toFunctionValue(normalizedValue) {
8015
+ return `"${normalizedValue}"`;
8016
+ },
8017
+ };
7981
8018
  /**
7982
8019
  * normalizes quarter number
7983
8020
  */
@@ -8108,6 +8145,7 @@ pivotTimeAdapterRegistry
8108
8145
  .add("day_of_month", nullHandlerDecorator(dayOfMonthAdapter))
8109
8146
  .add("iso_week_number", nullHandlerDecorator(isoWeekNumberAdapter))
8110
8147
  .add("month_number", nullHandlerDecorator(monthNumberAdapter))
8148
+ .add("month", nullHandlerDecorator(monthAdapter))
8111
8149
  .add("quarter_number", nullHandlerDecorator(quarterNumberAdapter))
8112
8150
  .add("day_of_week", nullHandlerDecorator(dayOfWeekAdapter))
8113
8151
  .add("hour_number", nullHandlerDecorator(hourNumberAdapter))
@@ -8288,10 +8326,7 @@ function toNormalizedPivotValue(dimension, groupValue) {
8288
8326
  return normalizer(groupValueString, dimension.granularity);
8289
8327
  }
8290
8328
  function normalizeDateTime(value, granularity) {
8291
- if (!granularity) {
8292
- throw new Error("Missing granularity");
8293
- }
8294
- return pivotTimeAdapter(granularity).normalizeFunctionValue(value);
8329
+ return pivotTimeAdapter(granularity ?? "month").normalizeFunctionValue(value);
8295
8330
  }
8296
8331
  function toFunctionPivotValue(value, dimension) {
8297
8332
  if (value === null) {
@@ -8303,10 +8338,7 @@ function toFunctionPivotValue(value, dimension) {
8303
8338
  return pivotToFunctionValueRegistry.get(dimension.type)(value, dimension.granularity);
8304
8339
  }
8305
8340
  function toFunctionValueDateTime(value, granularity) {
8306
- if (!granularity) {
8307
- throw new Error("Missing granularity");
8308
- }
8309
- return pivotTimeAdapter(granularity).toFunctionValue(value);
8341
+ return pivotTimeAdapter(granularity ?? "month").toFunctionValue(value);
8310
8342
  }
8311
8343
  const pivotNormalizationValueRegistry = new Registry();
8312
8344
  pivotNormalizationValueRegistry
@@ -9765,12 +9797,24 @@ function getElementMargins(el) {
9765
9797
  }
9766
9798
 
9767
9799
  const chartJsExtensionRegistry = new Registry();
9768
- /** Return window.Chart, making sure all our extensions are loaded in ChartJS */
9769
- function getChartJSConstructor() {
9770
- if (window.Chart && !window.Chart?.registry.plugins.get("chartShowValuesPlugin")) {
9771
- window.Chart.register(...chartJsExtensionRegistry.getAll());
9800
+ function areChartJSExtensionsLoaded() {
9801
+ return !!window.Chart.registry.plugins.get("chartShowValuesPlugin");
9802
+ }
9803
+ function registerChartJSExtensions() {
9804
+ if (!window.Chart || areChartJSExtensionsLoaded()) {
9805
+ return;
9806
+ }
9807
+ for (const registryItem of chartJsExtensionRegistry.getAll()) {
9808
+ registryItem.register(window.Chart);
9809
+ }
9810
+ }
9811
+ function unregisterChartJsExtensions() {
9812
+ if (!window.Chart) {
9813
+ return;
9814
+ }
9815
+ for (const registryItem of chartJsExtensionRegistry.getAll()) {
9816
+ registryItem.unregister(window.Chart);
9772
9817
  }
9773
- return window.Chart;
9774
9818
  }
9775
9819
 
9776
9820
  const TREND_LINE_XAXIS_ID = "x1";
@@ -10330,8 +10374,14 @@ css /* scss */ `
10330
10374
  }
10331
10375
  }
10332
10376
  `;
10333
- chartJsExtensionRegistry.add("chartShowValuesPlugin", chartShowValuesPlugin);
10334
- chartJsExtensionRegistry.add("waterfallLinesPlugin", waterfallLinesPlugin);
10377
+ chartJsExtensionRegistry.add("chartShowValuesPlugin", {
10378
+ register: (Chart) => Chart.register(chartShowValuesPlugin),
10379
+ unregister: (Chart) => Chart.unregister(chartShowValuesPlugin),
10380
+ });
10381
+ chartJsExtensionRegistry.add("waterfallLinesPlugin", {
10382
+ register: (Chart) => Chart.register(waterfallLinesPlugin),
10383
+ unregister: (Chart) => Chart.unregister(waterfallLinesPlugin),
10384
+ });
10335
10385
  class ChartJsComponent extends Component {
10336
10386
  static template = "o-spreadsheet-ChartJsComponent";
10337
10387
  static props = {
@@ -10383,8 +10433,7 @@ class ChartJsComponent extends Component {
10383
10433
  createChart(chartData) {
10384
10434
  const canvas = this.canvas.el;
10385
10435
  const ctx = canvas.getContext("2d");
10386
- const Chart = getChartJSConstructor();
10387
- this.chart = new Chart(ctx, chartData);
10436
+ this.chart = new window.Chart(ctx, chartData);
10388
10437
  }
10389
10438
  updateChartJs(chartData) {
10390
10439
  if (chartData.data && chartData.data.datasets) {
@@ -18516,7 +18565,7 @@ const IF = {
18516
18565
  return { value: "" };
18517
18566
  }
18518
18567
  if (result.value === null) {
18519
- result.value = "";
18568
+ return { ...result, value: "" };
18520
18569
  }
18521
18570
  return result;
18522
18571
  },
@@ -18537,7 +18586,7 @@ const IFERROR = {
18537
18586
  return { value: "" };
18538
18587
  }
18539
18588
  if (result.value === null) {
18540
- result.value = "";
18589
+ return { ...result, value: "" };
18541
18590
  }
18542
18591
  return result;
18543
18592
  },
@@ -18558,7 +18607,7 @@ const IFNA = {
18558
18607
  return { value: "" };
18559
18608
  }
18560
18609
  if (result.value === null) {
18561
- result.value = "";
18610
+ return { ...result, value: "" };
18562
18611
  }
18563
18612
  return result;
18564
18613
  },
@@ -18584,7 +18633,7 @@ const IFS = {
18584
18633
  return { value: "" };
18585
18634
  }
18586
18635
  if (result.value === null) {
18587
- result.value = "";
18636
+ return { ...result, value: "" };
18588
18637
  }
18589
18638
  return result;
18590
18639
  }
@@ -18702,6 +18751,11 @@ function addPivotDependencies(evalContext, coreDefinition, forMeasures) {
18702
18751
  if (range === undefined || range.invalidXc || range.invalidSheetName) {
18703
18752
  throw new InvalidReferenceError();
18704
18753
  }
18754
+ if (evalContext.__originCellPosition &&
18755
+ range.sheetId === evalContext.__originSheetId &&
18756
+ isZoneInside(positionToZone(evalContext.__originCellPosition), zone)) {
18757
+ throw new CircularDependencyError();
18758
+ }
18705
18759
  dependencies.push(range);
18706
18760
  }
18707
18761
  for (const measure of forMeasures) {
@@ -22963,6 +23017,7 @@ const CHART_COMMON_OPTIONS = {
22963
23017
  },
22964
23018
  },
22965
23019
  animation: false,
23020
+ events: ["mousemove", "mouseout", "click", "touchstart", "touchmove", "mouseup"],
22966
23021
  };
22967
23022
  function chartToImage(runtime, figure, type) {
22968
23023
  // wrap the canvas in a div with a fixed size because chart.js would
@@ -22979,8 +23034,7 @@ function chartToImage(runtime, figure, type) {
22979
23034
  if ("chartJsConfig" in runtime) {
22980
23035
  const config = deepCopy(runtime.chartJsConfig);
22981
23036
  config.plugins = [backgroundColorChartJSPlugin];
22982
- const Chart = getChartJSConstructor();
22983
- const chart = new Chart(canvas, config);
23037
+ const chart = new window.Chart(canvas, config);
22984
23038
  const imgContent = chart.toBase64Image();
22985
23039
  chart.destroy();
22986
23040
  div.remove();
@@ -27973,6 +28027,7 @@ function repairInitialMessages(data, initialMessages) {
27973
28027
  initialMessages = dropCommands(initialMessages, "SORT_CELLS");
27974
28028
  initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
27975
28029
  initialMessages = fixChartDefinitions(data, initialMessages);
28030
+ initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
27976
28031
  return initialMessages;
27977
28032
  }
27978
28033
  /**
@@ -28072,6 +28127,40 @@ function fixChartDefinitions(data, initialMessages) {
28072
28127
  }
28073
28128
  return messages;
28074
28129
  }
28130
+ function fixTranslatedDuplicateSheetName(data, initialMessages) {
28131
+ const sheetNames = {};
28132
+ for (const sheet of data.sheets || []) {
28133
+ sheetNames[sheet.id] = sheet.name;
28134
+ }
28135
+ const messages = [];
28136
+ for (const message of initialMessages) {
28137
+ if (message.type === "REMOTE_REVISION") {
28138
+ const commands = [];
28139
+ for (const cmd of message.commands) {
28140
+ switch (cmd.type) {
28141
+ case "DUPLICATE_SHEET":
28142
+ cmd.sheetNameTo =
28143
+ cmd.sheetNameTo ??
28144
+ getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
28145
+ break;
28146
+ case "CREATE_SHEET":
28147
+ case "RENAME_SHEET":
28148
+ sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
28149
+ break;
28150
+ }
28151
+ commands.push(cmd);
28152
+ }
28153
+ messages.push({
28154
+ ...message,
28155
+ commands,
28156
+ });
28157
+ }
28158
+ else {
28159
+ messages.push(message);
28160
+ }
28161
+ }
28162
+ return initialMessages;
28163
+ }
28075
28164
  // -----------------------------------------------------------------------------
28076
28165
  // Helpers
28077
28166
  // -----------------------------------------------------------------------------
@@ -28868,12 +28957,11 @@ function canBeLinearChart(definition, dataSets, labelRange, getters) {
28868
28957
  }
28869
28958
  let missingTimeAdapterAlreadyWarned = false;
28870
28959
  function isLuxonTimeAdapterInstalled() {
28871
- const Chart = getChartJSConstructor();
28872
- if (!Chart) {
28960
+ if (!window.Chart) {
28873
28961
  return false;
28874
28962
  }
28875
28963
  // @ts-ignore
28876
- const adapter = new Chart._adapters._date({});
28964
+ const adapter = new window.Chart._adapters._date({});
28877
28965
  const isInstalled = adapter._id === "luxon";
28878
28966
  if (!isInstalled && !missingTimeAdapterAlreadyWarned) {
28879
28967
  missingTimeAdapterAlreadyWarned = true;
@@ -29511,6 +29599,9 @@ const INTERACTIVE_LEGEND_CONFIG = {
29511
29599
  target.style.cursor = "default";
29512
29600
  },
29513
29601
  onClick: (event, legendItem, legend) => {
29602
+ if (event.type !== "click") {
29603
+ return;
29604
+ }
29514
29605
  const index = legendItem.datasetIndex;
29515
29606
  if (!legend.legendItems || index === undefined) {
29516
29607
  return;
@@ -33410,10 +33501,13 @@ const duplicateSheet = {
33410
33501
  name: _t("Duplicate"),
33411
33502
  execute: (env) => {
33412
33503
  const sheetIdFrom = env.model.getters.getActiveSheetId();
33504
+ const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
33413
33505
  const sheetIdTo = env.model.uuidGenerator.smallUuid();
33506
+ const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
33414
33507
  env.model.dispatch("DUPLICATE_SHEET", {
33415
33508
  sheetId: sheetIdFrom,
33416
33509
  sheetIdTo,
33510
+ sheetNameTo,
33417
33511
  });
33418
33512
  env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
33419
33513
  },
@@ -38616,7 +38710,7 @@ class GenericChartConfigPanel extends Component {
38616
38710
  const cancelledReasons = [
38617
38711
  ...(this.state.datasetDispatchResult?.reasons || []),
38618
38712
  ...(this.state.labelsDispatchResult?.reasons || []),
38619
- ];
38713
+ ].filter((reason) => reason !== "NoChanges" /* CommandResult.NoChanges */);
38620
38714
  return cancelledReasons.map((error) => ChartTerms.Errors[error] || ChartTerms.Errors.Unexpected);
38621
38715
  }
38622
38716
  get isDatasetInvalid() {
@@ -40838,6 +40932,13 @@ class Composer extends Component {
40838
40932
  openAssistant() {
40839
40933
  this.assistant.forcedClosed = false;
40840
40934
  }
40935
+ onWheel(event) {
40936
+ // detect if scrollbar is available
40937
+ if (this.composerRef.el &&
40938
+ this.composerRef.el.scrollHeight > this.composerRef.el.clientHeight) {
40939
+ event.stopPropagation();
40940
+ }
40941
+ }
40841
40942
  // ---------------------------------------------------------------------------
40842
40943
  // Private
40843
40944
  // ---------------------------------------------------------------------------
@@ -46314,8 +46415,8 @@ function compareDimensionValues(dimension, a, b) {
46314
46415
 
46315
46416
  const NULL_SYMBOL = Symbol("NULL");
46316
46417
  function createDate(dimension, value, locale) {
46317
- const granularity = dimension.granularity;
46318
- if (!granularity || !(granularity in MAP_VALUE_DIMENSION_DATE)) {
46418
+ const granularity = dimension.granularity || "month";
46419
+ if (!(granularity in MAP_VALUE_DIMENSION_DATE)) {
46319
46420
  throw new Error(`Unknown date granularity: ${granularity}`);
46320
46421
  }
46321
46422
  const keyInMap = typeof value === "number" || typeof value === "string" ? value : NULL_SYMBOL;
@@ -46334,6 +46435,9 @@ function createDate(dimension, value, locale) {
46334
46435
  case "month_number":
46335
46436
  number = date.getMonth() + 1;
46336
46437
  break;
46438
+ case "month":
46439
+ number = Math.floor(toNumber(value, locale));
46440
+ break;
46337
46441
  case "iso_week_number":
46338
46442
  number = date.getIsoWeek();
46339
46443
  break;
@@ -46427,6 +46531,10 @@ const MAP_VALUE_DIMENSION_DATE = {
46427
46531
  set: new Set(),
46428
46532
  values: {},
46429
46533
  },
46534
+ month: {
46535
+ set: new Set(),
46536
+ values: {},
46537
+ },
46430
46538
  iso_week_number: {
46431
46539
  set: new Set(),
46432
46540
  values: {},
@@ -46637,7 +46745,7 @@ class SpreadsheetPivot {
46637
46745
  const cells = this.filterDataEntriesFromDomain(this.dataEntries, domain);
46638
46746
  const finalCell = cells[0]?.[dimension.nameWithGranularity];
46639
46747
  if (dimension.type === "datetime") {
46640
- const adapter = pivotTimeAdapter(dimension.granularity);
46748
+ const adapter = pivotTimeAdapter((dimension.granularity || "month"));
46641
46749
  return adapter.toValueAndFormat(lastNode.value, this.getters.getLocale());
46642
46750
  }
46643
46751
  if (!finalCell) {
@@ -46755,7 +46863,7 @@ class SpreadsheetPivot {
46755
46863
  if (nonEmptyCells.length === 0) {
46756
46864
  return "integer";
46757
46865
  }
46758
- if (nonEmptyCells.every((cell) => cell.format && isDateTimeFormat(cell.format))) {
46866
+ if (nonEmptyCells.every((cell) => cell.type === CellValueType.number && cell.format && isDateTimeFormat(cell.format))) {
46759
46867
  return "datetime";
46760
46868
  }
46761
46869
  if (nonEmptyCells.every((cell) => cell.type === CellValueType.boolean)) {
@@ -46848,7 +46956,7 @@ class SpreadsheetPivot {
46848
46956
  for (const entry of dataEntries) {
46849
46957
  for (const dimension of dateDimensions) {
46850
46958
  const value = createDate(dimension, entry[dimension.fieldName]?.value || null, this.getters.getLocale());
46851
- const adapter = pivotTimeAdapter(dimension.granularity);
46959
+ const adapter = pivotTimeAdapter((dimension.granularity || "month"));
46852
46960
  const { format, value: valueToFormat } = adapter.toValueAndFormat(value, locale);
46853
46961
  entry[dimension.nameWithGranularity] = {
46854
46962
  value,
@@ -46868,6 +46976,7 @@ const dateGranularities = [
46868
46976
  "year",
46869
46977
  "quarter_number",
46870
46978
  "month_number",
46979
+ "month",
46871
46980
  "iso_week_number",
46872
46981
  "day_of_month",
46873
46982
  "day",
@@ -47118,7 +47227,7 @@ class PivotSidePanelStore extends SpreadsheetStore {
47118
47227
  : this.datetimeGranularities);
47119
47228
  }
47120
47229
  for (const field of dateFields) {
47121
- granularitiesPerFields[field.fieldName].delete(field.granularity);
47230
+ granularitiesPerFields[field.fieldName].delete(field.granularity || "month");
47122
47231
  }
47123
47232
  return granularitiesPerFields;
47124
47233
  }
@@ -49288,6 +49397,8 @@ class GridComposer extends Component {
49288
49397
  }
49289
49398
  get composerProps() {
49290
49399
  const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
49400
+ // Remove the wrapper border width
49401
+ const maxHeight = this.props.gridDims.height - this.rect.y - 2 * COMPOSER_BORDER_WIDTH;
49291
49402
  return {
49292
49403
  rect: { ...this.rect },
49293
49404
  delimitation: {
@@ -49305,6 +49416,7 @@ class GridComposer extends Component {
49305
49416
  }),
49306
49417
  onInputContextMenu: this.props.onInputContextMenu,
49307
49418
  composerStore: this.composerStore,
49419
+ inputStyle: `max-height: ${maxHeight}px;`,
49308
49420
  };
49309
49421
  }
49310
49422
  get containerStyle() {
@@ -54567,7 +54679,7 @@ class ChartPlugin extends CorePlugin {
54567
54679
  case "CREATE_CHART":
54568
54680
  return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
54569
54681
  case "UPDATE_CHART":
54570
- return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
54682
+ return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists, this.checkChartChanged));
54571
54683
  default:
54572
54684
  return "Success" /* CommandResult.Success */;
54573
54685
  }
@@ -54722,9 +54834,12 @@ class ChartPlugin extends CorePlugin {
54722
54834
  : "Success" /* CommandResult.Success */;
54723
54835
  }
54724
54836
  checkChartExists(cmd) {
54725
- return this.getters.getFigureSheetId(cmd.id)
54726
- ? "Success" /* CommandResult.Success */
54727
- : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
54837
+ return this.isChartDefined(cmd.id) ? "Success" /* CommandResult.Success */ : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
54838
+ }
54839
+ checkChartChanged(cmd) {
54840
+ return deepEquals(this.getChartDefinition(cmd.id), cmd.definition)
54841
+ ? "NoChanges" /* CommandResult.NoChanges */
54842
+ : "Success" /* CommandResult.Success */;
54728
54843
  }
54729
54844
  }
54730
54845
 
@@ -57043,6 +57158,7 @@ class SheetPlugin extends CorePlugin {
57043
57158
  "getCommandZones",
57044
57159
  "getUnboundedZone",
57045
57160
  "checkElementsIncludeAllNonFrozenHeaders",
57161
+ "getDuplicateSheetName",
57046
57162
  ];
57047
57163
  sheetIdsMapName = {};
57048
57164
  orderedSheetIds = [];
@@ -57067,7 +57183,11 @@ class SheetPlugin extends CorePlugin {
57067
57183
  return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
57068
57184
  }
57069
57185
  case "DUPLICATE_SHEET": {
57070
- return this.sheets[cmd.sheetIdTo] ? "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */ : "Success" /* CommandResult.Success */;
57186
+ if (this.sheets[cmd.sheetIdTo])
57187
+ return "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */;
57188
+ if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
57189
+ return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
57190
+ return "Success" /* CommandResult.Success */;
57071
57191
  }
57072
57192
  case "MOVE_SHEET":
57073
57193
  try {
@@ -57144,7 +57264,7 @@ class SheetPlugin extends CorePlugin {
57144
57264
  this.showSheet(cmd.sheetId);
57145
57265
  break;
57146
57266
  case "DUPLICATE_SHEET":
57147
- this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
57267
+ this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
57148
57268
  break;
57149
57269
  case "DELETE_SHEET":
57150
57270
  this.deleteSheet(this.sheets[cmd.sheetId]);
@@ -57351,10 +57471,7 @@ class SheetPlugin extends CorePlugin {
57351
57471
  }
57352
57472
  getNextSheetName(baseName = "Sheet") {
57353
57473
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
57354
- return getUniqueText(baseName, names, {
57355
- compute: (name, i) => `${name}${i}`,
57356
- computeFirstOne: true,
57357
- });
57474
+ return getNextSheetName(names, baseName);
57358
57475
  }
57359
57476
  getSheetSize(sheetId) {
57360
57477
  return {
@@ -57600,9 +57717,8 @@ class SheetPlugin extends CorePlugin {
57600
57717
  showSheet(sheetId) {
57601
57718
  this.history.update("sheets", sheetId, "isVisible", true);
57602
57719
  }
57603
- duplicateSheet(fromId, toId) {
57720
+ duplicateSheet(fromId, toId, toName) {
57604
57721
  const sheet = this.getSheet(fromId);
57605
- const toName = this.getDuplicateSheetName(sheet.name);
57606
57722
  const newSheet = deepCopy(sheet);
57607
57723
  newSheet.id = toId;
57608
57724
  newSheet.name = toName;
@@ -57635,8 +57751,7 @@ class SheetPlugin extends CorePlugin {
57635
57751
  }
57636
57752
  getDuplicateSheetName(sheetName) {
57637
57753
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
57638
- const baseName = _t("Copy of %s", sheetName);
57639
- return getUniqueText(baseName.toString(), names);
57754
+ return getDuplicateSheetName(sheetName, names);
57640
57755
  }
57641
57756
  deleteSheet(sheet) {
57642
57757
  const name = sheet.name;
@@ -60431,8 +60546,8 @@ class SpreadingRelation {
60431
60546
  const EMPTY_ARRAY = [];
60432
60547
 
60433
60548
  const MAX_ITERATION = 30;
60434
- const ERROR_CYCLE_CELL = createEvaluatedCell(new CircularDependencyError());
60435
- const EMPTY_CELL = createEvaluatedCell({ value: null });
60549
+ const ERROR_CYCLE_CELL = Object.freeze(createEvaluatedCell(new CircularDependencyError()));
60550
+ const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
60436
60551
  class Evaluator {
60437
60552
  context;
60438
60553
  getters;
@@ -71737,11 +71852,13 @@ class Spreadsheet extends Component {
71737
71852
  this.checkViewportSize();
71738
71853
  stores.on("store-updated", this, render);
71739
71854
  resizeObserver.observe(this.spreadsheetRef.el);
71855
+ registerChartJSExtensions();
71740
71856
  });
71741
71857
  onWillUnmount(() => {
71742
71858
  this.unbindModelEvents();
71743
71859
  stores.off("store-updated", this);
71744
71860
  resizeObserver.disconnect();
71861
+ unregisterChartJsExtensions();
71745
71862
  });
71746
71863
  onPatched(() => {
71747
71864
  this.checkViewportSize();
@@ -76223,6 +76340,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
76223
76340
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
76224
76341
 
76225
76342
 
76226
- __info__.version = "18.2.10";
76227
- __info__.date = "2025-05-02T12:34:39.632Z";
76228
- __info__.hash = "e8ff3fc";
76343
+ __info__.version = "18.2.11";
76344
+ __info__.date = "2025-05-12T05:25:59.138Z";
76345
+ __info__.hash = "eb87dca";