@odoo/o-spreadsheet 17.4.32 → 17.4.34

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 17.4.32
6
- * @date 2025-04-25T08:06:59.937Z
7
- * @hash c370ddf
5
+ * @version 17.4.34
6
+ * @date 2025-05-12T05:23:37.387Z
7
+ * @hash e3ac48a
8
8
  */
9
9
 
10
10
  'use strict';
@@ -2362,6 +2362,7 @@ exports.CommandResult = void 0;
2362
2362
  CommandResult["InvalidTableResize"] = "InvalidTableResize";
2363
2363
  CommandResult["PivotIdNotFound"] = "PivotIdNotFound";
2364
2364
  CommandResult["EmptyName"] = "EmptyName";
2365
+ CommandResult["InvalidPivotDataSet"] = "InvalidPivotDataSet";
2365
2366
  })(exports.CommandResult || (exports.CommandResult = {}));
2366
2367
 
2367
2368
  const PLAIN_TEXT_FORMAT = "@"; // see OpenXML spec §18.8.31
@@ -5191,6 +5192,25 @@ function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
5191
5192
  })
5192
5193
  .filter(isDefined);
5193
5194
  }
5195
+ function getNextSheetName(existingNames, baseName = "Sheet") {
5196
+ let i = 1;
5197
+ let name = `${baseName}${i}`;
5198
+ while (existingNames.includes(name)) {
5199
+ name = `${baseName}${i}`;
5200
+ i++;
5201
+ }
5202
+ return name;
5203
+ }
5204
+ function getDuplicateSheetName(nameToDuplicate, existingNames) {
5205
+ let i = 1;
5206
+ const baseName = _t("Copy of %s", nameToDuplicate);
5207
+ let name = baseName.toString();
5208
+ while (existingNames.includes(name)) {
5209
+ name = `${baseName} (${i})`;
5210
+ i++;
5211
+ }
5212
+ return name;
5213
+ }
5194
5214
 
5195
5215
  function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
5196
5216
  return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
@@ -6394,6 +6414,24 @@ const monthNumberAdapter = {
6394
6414
  return `${normalizedValue}`;
6395
6415
  },
6396
6416
  };
6417
+ /**
6418
+ * normalizes month number + year
6419
+ */
6420
+ const monthAdapter = {
6421
+ normalizeFunctionValue(value) {
6422
+ const date = toNumber(value, DEFAULT_LOCALE);
6423
+ return formatValue(date, { locale: DEFAULT_LOCALE, format: "mm/yyyy" });
6424
+ },
6425
+ toValueAndFormat(normalizedValue) {
6426
+ return {
6427
+ value: toNumber(normalizedValue, DEFAULT_LOCALE),
6428
+ format: "mmmm yyyy",
6429
+ };
6430
+ },
6431
+ toFunctionValue(normalizedValue) {
6432
+ return `"${normalizedValue}"`;
6433
+ },
6434
+ };
6397
6435
  /**
6398
6436
  * normalizes quarter number
6399
6437
  */
@@ -6461,6 +6499,7 @@ pivotTimeAdapterRegistry
6461
6499
  .add("day_of_month", nullHandlerDecorator(dayOfMonthAdapter))
6462
6500
  .add("iso_week_number", nullHandlerDecorator(isoWeekNumberAdapter))
6463
6501
  .add("month_number", nullHandlerDecorator(monthNumberAdapter))
6502
+ .add("month", nullHandlerDecorator(monthAdapter))
6464
6503
  .add("quarter_number", nullHandlerDecorator(quarterNumberAdapter));
6465
6504
 
6466
6505
  const AGGREGATOR_NAMES = {
@@ -6641,10 +6680,7 @@ function toNormalizedPivotValue(dimension, groupValue) {
6641
6680
  return normalizer(groupValueString, dimension.granularity);
6642
6681
  }
6643
6682
  function normalizeDateTime(value, granularity) {
6644
- if (!granularity) {
6645
- throw new Error("Missing granularity");
6646
- }
6647
- return pivotTimeAdapter(granularity).normalizeFunctionValue(value);
6683
+ return pivotTimeAdapter(granularity ?? "month").normalizeFunctionValue(value);
6648
6684
  }
6649
6685
  function toFunctionPivotValue(value, dimension) {
6650
6686
  if (value === null) {
@@ -6656,10 +6692,7 @@ function toFunctionPivotValue(value, dimension) {
6656
6692
  return pivotToFunctionValueRegistry.get(dimension.type)(value, dimension.granularity);
6657
6693
  }
6658
6694
  function toFunctionValueDateTime(value, granularity) {
6659
- if (!granularity) {
6660
- throw new Error("Missing granularity");
6661
- }
6662
- return pivotTimeAdapter(granularity).toFunctionValue(value);
6695
+ return pivotTimeAdapter(granularity ?? "month").toFunctionValue(value);
6663
6696
  }
6664
6697
  const pivotNormalizationValueRegistry = new Registry();
6665
6698
  pivotNormalizationValueRegistry
@@ -12243,6 +12276,7 @@ class ChartJsComponent extends owl.Component {
12243
12276
  canvas = owl.useRef("graphContainer");
12244
12277
  chart;
12245
12278
  currentRuntime;
12279
+ currentDevicePixelRatio = window.devicePixelRatio;
12246
12280
  get background() {
12247
12281
  return this.chartRuntime.background;
12248
12282
  }
@@ -12276,11 +12310,11 @@ class ChartJsComponent extends owl.Component {
12276
12310
  }
12277
12311
  this.currentRuntime = runtime;
12278
12312
  }
12313
+ else if (this.currentDevicePixelRatio !== window.devicePixelRatio) {
12314
+ this.currentDevicePixelRatio = window.devicePixelRatio;
12315
+ this.updateChartJs(deepCopy(this.currentRuntime));
12316
+ }
12279
12317
  });
12280
- owl.useEffect(() => {
12281
- this.currentRuntime = this.chartRuntime;
12282
- this.updateChartJs(deepCopy(this.currentRuntime));
12283
- }, () => [window.devicePixelRatio]);
12284
12318
  }
12285
12319
  createChart(chartData) {
12286
12320
  const canvas = this.canvas.el;
@@ -19382,7 +19416,7 @@ const IF = {
19382
19416
  return { value: "" };
19383
19417
  }
19384
19418
  if (result.value === null) {
19385
- result.value = "";
19419
+ return { ...result, value: "" };
19386
19420
  }
19387
19421
  return result;
19388
19422
  },
@@ -19403,7 +19437,7 @@ const IFERROR = {
19403
19437
  return { value: "" };
19404
19438
  }
19405
19439
  if (result.value === null) {
19406
- result.value = "";
19440
+ return { ...result, value: "" };
19407
19441
  }
19408
19442
  return result;
19409
19443
  },
@@ -19424,7 +19458,7 @@ const IFNA = {
19424
19458
  return { value: "" };
19425
19459
  }
19426
19460
  if (result.value === null) {
19427
- result.value = "";
19461
+ return { ...result, value: "" };
19428
19462
  }
19429
19463
  return result;
19430
19464
  },
@@ -19450,7 +19484,7 @@ const IFS = {
19450
19484
  return { value: "" };
19451
19485
  }
19452
19486
  if (result.value === null) {
19453
- result.value = "";
19487
+ return { ...result, value: "" };
19454
19488
  }
19455
19489
  return result;
19456
19490
  }
@@ -22621,10 +22655,13 @@ const duplicateSheet = {
22621
22655
  name: _t("Duplicate"),
22622
22656
  execute: (env) => {
22623
22657
  const sheetIdFrom = env.model.getters.getActiveSheetId();
22658
+ const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
22624
22659
  const sheetIdTo = env.model.uuidGenerator.smallUuid();
22660
+ const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
22625
22661
  env.model.dispatch("DUPLICATE_SHEET", {
22626
22662
  sheetId: sheetIdFrom,
22627
22663
  sheetIdTo,
22664
+ sheetNameTo,
22628
22665
  });
22629
22666
  env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
22630
22667
  },
@@ -22742,18 +22779,28 @@ linkMenuRegistry.add("sheet", {
22742
22779
  function useInterval(callback, delay) {
22743
22780
  let intervalId;
22744
22781
  const { setInterval, clearInterval } = window;
22782
+ const pause = () => {
22783
+ clearInterval(intervalId);
22784
+ intervalId = undefined;
22785
+ };
22786
+ const safeCallback = () => {
22787
+ try {
22788
+ callback();
22789
+ }
22790
+ catch (e) {
22791
+ pause();
22792
+ throw e;
22793
+ }
22794
+ };
22745
22795
  owl.useEffect(() => {
22746
- intervalId = setInterval(callback, delay);
22796
+ intervalId = setInterval(safeCallback, delay);
22747
22797
  return () => clearInterval(intervalId);
22748
22798
  }, () => [delay]);
22749
22799
  return {
22750
- pause: () => {
22751
- clearInterval(intervalId);
22752
- intervalId = undefined;
22753
- },
22800
+ pause,
22754
22801
  resume: () => {
22755
22802
  if (intervalId === undefined) {
22756
- intervalId = setInterval(callback, delay);
22803
+ intervalId = setInterval(safeCallback, delay);
22757
22804
  }
22758
22805
  },
22759
22806
  };
@@ -24059,6 +24106,13 @@ class Composer extends owl.Component {
24059
24106
  this.props.onInputContextMenu?.(ev);
24060
24107
  }
24061
24108
  }
24109
+ onWheel(event) {
24110
+ // detect if scrollbar is available
24111
+ if (this.composerRef.el &&
24112
+ this.composerRef.el.scrollHeight > this.composerRef.el.clientHeight) {
24113
+ event.stopPropagation();
24114
+ }
24115
+ }
24062
24116
  // ---------------------------------------------------------------------------
24063
24117
  // Private
24064
24118
  // ---------------------------------------------------------------------------
@@ -25336,9 +25390,6 @@ class BarChart extends AbstractChart {
25336
25390
  };
25337
25391
  }
25338
25392
  getDefinitionForExcel() {
25339
- // Excel does not support aggregating labels
25340
- if (this.aggregated)
25341
- return undefined;
25342
25393
  const dataSets = this.dataSets
25343
25394
  .map((ds) => toExcelDataset(this.getters, ds))
25344
25395
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -26415,9 +26466,6 @@ class LineChart extends AbstractChart {
26415
26466
  return new LineChart(definition, this.sheetId, this.getters);
26416
26467
  }
26417
26468
  getDefinitionForExcel() {
26418
- // Excel does not support aggregating labels
26419
- if (this.aggregated)
26420
- return undefined;
26421
26469
  const dataSets = this.dataSets
26422
26470
  .map((ds) => toExcelDataset(this.getters, ds))
26423
26471
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -26528,9 +26576,6 @@ class PieChart extends AbstractChart {
26528
26576
  return new PieChart(definition, sheetId, this.getters);
26529
26577
  }
26530
26578
  getDefinitionForExcel() {
26531
- // Excel does not support aggregating labels
26532
- if (this.aggregated)
26533
- return undefined;
26534
26579
  const dataSets = this.dataSets
26535
26580
  .map((ds) => toExcelDataset(this.getters, ds))
26536
26581
  .filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
@@ -29356,7 +29401,7 @@ const FIX_FORMULAS = {
29356
29401
  if (!pivot.isValid()) {
29357
29402
  return;
29358
29403
  }
29359
- env.model.dispatch("INSERT_PIVOT", {
29404
+ env.model.dispatch("SPLIT_PIVOT_FORMULA", {
29360
29405
  sheetId,
29361
29406
  col,
29362
29407
  row,
@@ -36990,8 +37035,8 @@ function compareDimensionValues(dimension, a, b) {
36990
37035
 
36991
37036
  const NULL_SYMBOL = Symbol("NULL");
36992
37037
  function createDate(dimension, value, locale) {
36993
- const granularity = dimension.granularity;
36994
- if (!granularity || !(granularity in MAP_VALUE_DIMENSION_DATE)) {
37038
+ const granularity = dimension.granularity || "month";
37039
+ if (!(granularity in MAP_VALUE_DIMENSION_DATE)) {
36995
37040
  throw new Error(`Unknown date granularity: ${granularity}`);
36996
37041
  }
36997
37042
  const keyInMap = typeof value === "number" || typeof value === "string" ? value : NULL_SYMBOL;
@@ -37010,6 +37055,9 @@ function createDate(dimension, value, locale) {
37010
37055
  case "month_number":
37011
37056
  number = date.getMonth() + 1;
37012
37057
  break;
37058
+ case "month":
37059
+ number = Math.floor(toNumber(value, locale));
37060
+ break;
37013
37061
  case "iso_week_number":
37014
37062
  number = date.getIsoWeek();
37015
37063
  break;
@@ -37068,6 +37116,10 @@ const MAP_VALUE_DIMENSION_DATE = {
37068
37116
  set: new Set(),
37069
37117
  values: {},
37070
37118
  },
37119
+ month: {
37120
+ set: new Set(),
37121
+ values: {},
37122
+ },
37071
37123
  iso_week_number: {
37072
37124
  set: new Set(),
37073
37125
  values: {},
@@ -37244,7 +37296,7 @@ class SpreadsheetPivot {
37244
37296
  const cells = this.filterDataEntriesFromDomain(this.dataEntries, domain);
37245
37297
  const finalCell = cells[0]?.[dimension.nameWithGranularity];
37246
37298
  if (dimension.type === "date") {
37247
- const adapter = pivotTimeAdapter(dimension.granularity);
37299
+ const adapter = pivotTimeAdapter((dimension.granularity || "month"));
37248
37300
  return adapter.toValueAndFormat(lastNode.value, this.getters.getLocale());
37249
37301
  }
37250
37302
  if (!finalCell) {
@@ -37329,7 +37381,7 @@ class SpreadsheetPivot {
37329
37381
  if (nonEmptyCells.length === 0) {
37330
37382
  return "integer";
37331
37383
  }
37332
- if (nonEmptyCells.every((cell) => cell.format && isDateTimeFormat(cell.format))) {
37384
+ if (nonEmptyCells.every((cell) => cell.type === CellValueType.number && cell.format && isDateTimeFormat(cell.format))) {
37333
37385
  return "date";
37334
37386
  }
37335
37387
  if (nonEmptyCells.every((cell) => cell.type === CellValueType.boolean)) {
@@ -37444,6 +37496,7 @@ pivotRegistry.add("SPREADSHEET", {
37444
37496
  "year",
37445
37497
  "quarter_number",
37446
37498
  "month_number",
37499
+ "month",
37447
37500
  "iso_week_number",
37448
37501
  "day_of_month",
37449
37502
  "day",
@@ -37653,7 +37706,7 @@ class PivotSidePanelStore extends SpreadsheetStore {
37653
37706
  granularitiesPerFields[field.name] = new Set(granularities);
37654
37707
  }
37655
37708
  for (const field of dateFields) {
37656
- granularitiesPerFields[field.name].delete(field.granularity);
37709
+ granularitiesPerFields[field.name].delete(field.granularity || "month");
37657
37710
  }
37658
37711
  return granularitiesPerFields;
37659
37712
  }
@@ -39540,12 +39593,15 @@ class GridComposer extends owl.Component {
39540
39593
  });
39541
39594
  }
39542
39595
  get composerProps() {
39596
+ // Remove the wrapper border width
39597
+ const maxHeight = this.props.gridDims.height - this.rect.y - 2 * COMPOSER_BORDER_WIDTH;
39543
39598
  return {
39544
39599
  focus: this.composerFocusStore.gridComposerFocus,
39545
39600
  isDefaultFocus: true,
39546
39601
  onComposerContentFocused: () => this.composerFocusStore.focusGridComposerContent(),
39547
39602
  onComposerCellFocused: (content) => this.composerFocusStore.focusGridComposerCell(content),
39548
39603
  onInputContextMenu: this.props.onInputContextMenu,
39604
+ inputStyle: `max-height: ${maxHeight}px;`,
39549
39605
  };
39550
39606
  }
39551
39607
  get containerStyle() {
@@ -41000,7 +41056,7 @@ css /* scss */ `
41000
41056
  position: absolute;
41001
41057
  top: 0;
41002
41058
  left: ${HEADER_WIDTH}px;
41003
- right: 0;
41059
+ right: ${SCROLLBAR_WIDTH}px;
41004
41060
  height: ${HEADER_HEIGHT}px;
41005
41061
  &.o-dragging {
41006
41062
  cursor: grabbing;
@@ -41166,9 +41222,8 @@ css /* scss */ `
41166
41222
  position: absolute;
41167
41223
  top: ${HEADER_HEIGHT}px;
41168
41224
  left: 0;
41169
- right: 0;
41225
+ bottom: ${SCROLLBAR_WIDTH}px;
41170
41226
  width: ${HEADER_WIDTH}px;
41171
- height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
41172
41227
  &.o-dragging {
41173
41228
  cursor: grabbing;
41174
41229
  }
@@ -47303,6 +47358,7 @@ function repairInitialMessages(data, initialMessages) {
47303
47358
  initialMessages = dropCommands(initialMessages, "SORT_CELLS");
47304
47359
  initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
47305
47360
  initialMessages = fixChartDefinitions(data, initialMessages);
47361
+ initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
47306
47362
  return initialMessages;
47307
47363
  }
47308
47364
  /**
@@ -47422,6 +47478,40 @@ function fixOverlappingFilters(data) {
47422
47478
  }
47423
47479
  return data;
47424
47480
  }
47481
+ function fixTranslatedDuplicateSheetName(data, initialMessages) {
47482
+ const sheetNames = {};
47483
+ for (const sheet of data.sheets || []) {
47484
+ sheetNames[sheet.id] = sheet.name;
47485
+ }
47486
+ const messages = [];
47487
+ for (const message of initialMessages) {
47488
+ if (message.type === "REMOTE_REVISION") {
47489
+ const commands = [];
47490
+ for (const cmd of message.commands) {
47491
+ switch (cmd.type) {
47492
+ case "DUPLICATE_SHEET":
47493
+ cmd.sheetNameTo =
47494
+ cmd.sheetNameTo ??
47495
+ getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
47496
+ break;
47497
+ case "CREATE_SHEET":
47498
+ case "RENAME_SHEET":
47499
+ sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
47500
+ break;
47501
+ }
47502
+ commands.push(cmd);
47503
+ }
47504
+ messages.push({
47505
+ ...message,
47506
+ commands,
47507
+ });
47508
+ }
47509
+ else {
47510
+ messages.push(message);
47511
+ }
47512
+ }
47513
+ return initialMessages;
47514
+ }
47425
47515
  // -----------------------------------------------------------------------------
47426
47516
  // Helpers
47427
47517
  // -----------------------------------------------------------------------------
@@ -48957,9 +49047,7 @@ class ChartPlugin extends CorePlugin {
48957
49047
  : "Success" /* CommandResult.Success */;
48958
49048
  }
48959
49049
  checkChartExists(cmd) {
48960
- return this.getters.getFigureSheetId(cmd.id)
48961
- ? "Success" /* CommandResult.Success */
48962
- : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
49050
+ return this.isChartDefined(cmd.id) ? "Success" /* CommandResult.Success */ : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
48963
49051
  }
48964
49052
  }
48965
49053
 
@@ -51136,6 +51224,7 @@ class SheetPlugin extends CorePlugin {
51136
51224
  "getCommandZones",
51137
51225
  "getUnboundedZone",
51138
51226
  "checkElementsIncludeAllNonFrozenHeaders",
51227
+ "getDuplicateSheetName",
51139
51228
  ];
51140
51229
  sheetIdsMapName = {};
51141
51230
  orderedSheetIds = [];
@@ -51160,7 +51249,11 @@ class SheetPlugin extends CorePlugin {
51160
51249
  return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
51161
51250
  }
51162
51251
  case "DUPLICATE_SHEET": {
51163
- return this.sheets[cmd.sheetIdTo] ? "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */ : "Success" /* CommandResult.Success */;
51252
+ if (this.sheets[cmd.sheetIdTo])
51253
+ return "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */;
51254
+ if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
51255
+ return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
51256
+ return "Success" /* CommandResult.Success */;
51164
51257
  }
51165
51258
  case "MOVE_SHEET":
51166
51259
  try {
@@ -51230,7 +51323,7 @@ class SheetPlugin extends CorePlugin {
51230
51323
  this.showSheet(cmd.sheetId);
51231
51324
  break;
51232
51325
  case "DUPLICATE_SHEET":
51233
- this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
51326
+ this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
51234
51327
  break;
51235
51328
  case "DELETE_SHEET":
51236
51329
  this.deleteSheet(this.sheets[cmd.sheetId]);
@@ -51430,14 +51523,8 @@ class SheetPlugin extends CorePlugin {
51430
51523
  return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
51431
51524
  }
51432
51525
  getNextSheetName(baseName = "Sheet") {
51433
- let i = 1;
51434
51526
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
51435
- let name = `${baseName}${i}`;
51436
- while (names.includes(name)) {
51437
- name = `${baseName}${i}`;
51438
- i++;
51439
- }
51440
- return name;
51527
+ return getNextSheetName(names, baseName);
51441
51528
  }
51442
51529
  getSheetSize(sheetId) {
51443
51530
  return {
@@ -51683,9 +51770,8 @@ class SheetPlugin extends CorePlugin {
51683
51770
  showSheet(sheetId) {
51684
51771
  this.history.update("sheets", sheetId, "isVisible", true);
51685
51772
  }
51686
- duplicateSheet(fromId, toId) {
51773
+ duplicateSheet(fromId, toId, toName) {
51687
51774
  const sheet = this.getSheet(fromId);
51688
- const toName = this.getDuplicateSheetName(sheet.name);
51689
51775
  const newSheet = deepCopy(sheet);
51690
51776
  newSheet.id = toId;
51691
51777
  newSheet.name = toName;
@@ -51717,15 +51803,8 @@ class SheetPlugin extends CorePlugin {
51717
51803
  this.history.update("sheetIdsMapName", sheetIdsMapName);
51718
51804
  }
51719
51805
  getDuplicateSheetName(sheetName) {
51720
- let i = 1;
51721
51806
  const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
51722
- const baseName = _t("Copy of %s", sheetName);
51723
- let name = baseName.toString();
51724
- while (names.includes(name)) {
51725
- name = `${baseName} (${i})`;
51726
- i++;
51727
- }
51728
- return name;
51807
+ return getDuplicateSheetName(sheetName, names);
51729
51808
  }
51730
51809
  deleteSheet(sheet) {
51731
51810
  const name = sheet.name;
@@ -53133,6 +53212,15 @@ function adaptPivotRange(range, applyChange) {
53133
53212
  }
53134
53213
  }
53135
53214
  class SpreadsheetPivotCorePlugin extends CorePlugin {
53215
+ allowDispatch(cmd) {
53216
+ switch (cmd.type) {
53217
+ case "ADD_PIVOT":
53218
+ case "UPDATE_PIVOT":
53219
+ const definition = cmd.pivot;
53220
+ return this.checkDataSetValidity(definition);
53221
+ }
53222
+ return "Success" /* CommandResult.Success */;
53223
+ }
53136
53224
  adaptRanges(applyChange) {
53137
53225
  for (const pivotId of this.getters.getPivotIds()) {
53138
53226
  const definition = this.getters.getPivotCoreDefinition(pivotId);
@@ -53151,6 +53239,16 @@ class SpreadsheetPivotCorePlugin extends CorePlugin {
53151
53239
  }
53152
53240
  }
53153
53241
  }
53242
+ checkDataSetValidity(definition) {
53243
+ if (definition.type === "SPREADSHEET" && definition.dataSet) {
53244
+ const { zone, sheetId } = definition.dataSet;
53245
+ if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) {
53246
+ return "InvalidDataSet" /* CommandResult.InvalidDataSet */;
53247
+ }
53248
+ return this.getters.checkZonesExistInSheet(sheetId, [zone]);
53249
+ }
53250
+ return "Success" /* CommandResult.Success */;
53251
+ }
53154
53252
  }
53155
53253
 
53156
53254
  class TableStylePlugin extends CorePlugin {
@@ -54505,8 +54603,8 @@ class SpreadingRelation {
54505
54603
  const EMPTY_ARRAY = [];
54506
54604
 
54507
54605
  const MAX_ITERATION = 30;
54508
- const ERROR_CYCLE_CELL = createEvaluatedCell(new CircularDependencyError());
54509
- const EMPTY_CELL = createEvaluatedCell({ value: null });
54606
+ const ERROR_CYCLE_CELL = Object.freeze(createEvaluatedCell(new CircularDependencyError()));
54607
+ const EMPTY_CELL = Object.freeze(createEvaluatedCell({ value: null }));
54510
54608
  class Evaluator {
54511
54609
  context;
54512
54610
  getters;
@@ -55986,7 +56084,7 @@ class DynamicTablesPlugin extends UIPlugin {
55986
56084
  tables = {};
55987
56085
  handle(cmd) {
55988
56086
  if (invalidateEvaluationCommands.has(cmd.type) ||
55989
- (cmd.type === "UPDATE_CELL" && "content" in cmd) ||
56087
+ (cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd)) ||
55990
56088
  cmd.type === "EVALUATE_CELLS") {
55991
56089
  this.tables = {};
55992
56090
  return;
@@ -58568,6 +58666,8 @@ class InsertPivotPlugin extends UIPlugin {
58568
58666
  case "INSERT_PIVOT_WITH_TABLE":
58569
58667
  this.insertPivotWithTable(cmd.sheetId, cmd.col, cmd.row, cmd.pivotId, cmd.table, cmd.pivotMode);
58570
58668
  break;
58669
+ case "SPLIT_PIVOT_FORMULA":
58670
+ this.splitPivotFormula(cmd.sheetId, cmd.col, cmd.row, cmd.pivotId, cmd.table);
58571
58671
  }
58572
58672
  }
58573
58673
  insertNewPivot(pivotId, sheetId) {
@@ -58715,6 +58815,36 @@ class InsertPivotPlugin extends UIPlugin {
58715
58815
  });
58716
58816
  }
58717
58817
  }
58818
+ splitPivotFormula(sheetId, col, row, pivotId, pivotTableData) {
58819
+ this.dispatch("INSERT_PIVOT", {
58820
+ sheetId,
58821
+ col,
58822
+ row,
58823
+ pivotId,
58824
+ table: pivotTableData,
58825
+ });
58826
+ const table = this.getters.getCoreTable({ sheetId, col, row });
58827
+ if (table?.type === "dynamic") {
58828
+ const zone = positionToZone({ col, row });
58829
+ const { cols, rows, measures, fieldsType } = pivotTableData;
58830
+ const pivotTable = new SpreadsheetPivotTable(cols, rows, measures, fieldsType || {});
58831
+ const colNumber = pivotTable.getNumberOfDataColumns() + 1;
58832
+ const rowNumber = pivotTable.columns.length + pivotTable.rows.length;
58833
+ const tableZone = {
58834
+ left: col,
58835
+ top: row,
58836
+ right: col + colNumber - 1,
58837
+ bottom: row + rowNumber - 1,
58838
+ };
58839
+ const rangeData = this.getters.getRangeDataFromZone(sheetId, tableZone);
58840
+ this.dispatch("UPDATE_TABLE", {
58841
+ sheetId,
58842
+ zone,
58843
+ newTableRange: rangeData,
58844
+ tableType: "static",
58845
+ });
58846
+ }
58847
+ }
58718
58848
  }
58719
58849
 
58720
58850
  class SortPlugin extends UIPlugin {
@@ -59123,7 +59253,7 @@ class TableComputedStylePlugin extends UIPlugin {
59123
59253
  tableStyles = {};
59124
59254
  handle(cmd) {
59125
59255
  if (invalidateEvaluationCommands.has(cmd.type) ||
59126
- (cmd.type === "UPDATE_CELL" && "content" in cmd) ||
59256
+ (cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd)) ||
59127
59257
  cmd.type === "EVALUATE_CELLS") {
59128
59258
  this.tableStyles = {};
59129
59259
  return;
@@ -61094,6 +61224,8 @@ class GridSelectionPlugin extends UIPlugin {
61094
61224
  });
61095
61225
  this.selectCell(col, row);
61096
61226
  }
61227
+ const { col, row } = this.gridSelection.anchor.cell;
61228
+ this.moveClient({ sheetId: this.activeSheet.id, col, row });
61097
61229
  }
61098
61230
  /**
61099
61231
  * Ensure selections are not outside sheet boundaries.
@@ -61826,8 +61958,11 @@ class SheetViewPlugin extends UIPlugin {
61826
61958
  case "REMOVE_TABLE":
61827
61959
  case "UPDATE_TABLE":
61828
61960
  case "UPDATE_FILTER":
61829
- this.sheetsWithDirtyViewports.add(cmd.sheetId);
61830
- break;
61961
+ case "UNFREEZE_ROWS":
61962
+ case "UNFREEZE_COLUMNS":
61963
+ case "FREEZE_COLUMNS":
61964
+ case "FREEZE_ROWS":
61965
+ case "UNFREEZE_COLUMNS_ROWS":
61831
61966
  case "REMOVE_COLUMNS_ROWS":
61832
61967
  case "RESIZE_COLUMNS_ROWS":
61833
61968
  case "HIDE_COLUMNS_ROWS":
@@ -61840,11 +61975,9 @@ class SheetViewPlugin extends UIPlugin {
61840
61975
  case "FOLD_HEADER_GROUPS_IN_ZONE":
61841
61976
  case "UNFOLD_HEADER_GROUPS_IN_ZONE":
61842
61977
  case "UNFOLD_ALL_HEADER_GROUPS":
61843
- case "FOLD_ALL_HEADER_GROUPS": {
61844
- const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.getActiveSheetId();
61845
- this.sheetsWithDirtyViewports.add(sheetId);
61978
+ case "FOLD_ALL_HEADER_GROUPS":
61979
+ this.sheetsWithDirtyViewports.add(cmd.sheetId);
61846
61980
  break;
61847
- }
61848
61981
  case "UPDATE_CELL":
61849
61982
  // update cell content or format can change hidden rows because of data filters
61850
61983
  if ("content" in cmd || "format" in cmd || cmd.style?.fontSize !== undefined) {
@@ -61860,13 +61993,6 @@ class SheetViewPlugin extends UIPlugin {
61860
61993
  case "ACTIVATE_SHEET":
61861
61994
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
61862
61995
  break;
61863
- case "UNFREEZE_ROWS":
61864
- case "UNFREEZE_COLUMNS":
61865
- case "FREEZE_COLUMNS":
61866
- case "FREEZE_ROWS":
61867
- case "UNFREEZE_COLUMNS_ROWS":
61868
- this.resetViewports(this.getters.getActiveSheetId());
61869
- break;
61870
61996
  case "DELETE_SHEET":
61871
61997
  this.sheetsWithDirtyViewports.delete(cmd.sheetId);
61872
61998
  break;
@@ -63022,7 +63148,7 @@ class AggregateStatisticsStore extends SpreadsheetStore {
63022
63148
  }
63023
63149
  handle(cmd) {
63024
63150
  if (invalidateEvaluationCommands.has(cmd.type) ||
63025
- (cmd.type === "UPDATE_CELL" && "content" in cmd)) {
63151
+ (cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd))) {
63026
63152
  this.isDirty = true;
63027
63153
  }
63028
63154
  switch (cmd.type) {
@@ -69389,6 +69515,6 @@ exports.tokenColors = tokenColors;
69389
69515
  exports.tokenize = tokenize;
69390
69516
 
69391
69517
 
69392
- __info__.version = "17.4.32";
69393
- __info__.date = "2025-04-25T08:06:59.937Z";
69394
- __info__.hash = "c370ddf";
69518
+ __info__.version = "17.4.34";
69519
+ __info__.date = "2025-05-12T05:23:37.387Z";
69520
+ __info__.hash = "e3ac48a";