@odoo/o-spreadsheet 18.0.14 → 18.0.16

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.0.14
6
- * @date 2025-02-05T06:47:33.041Z
7
- * @hash 90f2af4
5
+ * @version 18.0.16
6
+ * @date 2025-02-14T08:44:19.475Z
7
+ * @hash 39979ab
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -765,9 +765,16 @@ function deepEqualsArray(arr1, arr2) {
765
765
  }
766
766
  return true;
767
767
  }
768
- /** Check if the given array contains all the values of the other array. */
768
+ /**
769
+ * Check if the given array contains all the values of the other array.
770
+ * It makes the assumption that both array do not contain duplicates.
771
+ */
769
772
  function includesAll(arr, values) {
770
- return values.every((value) => arr.includes(value));
773
+ if (arr.length < values.length) {
774
+ return false;
775
+ }
776
+ const set = new Set(arr);
777
+ return values.every((value) => set.has(value));
771
778
  }
772
779
  /**
773
780
  * Return an object with all the keys in the object that have a falsy value removed.
@@ -6338,6 +6345,37 @@ class UuidGenerator {
6338
6345
  setIsFastStrategy(isFast) {
6339
6346
  this.isFastIdStrategy = isFast;
6340
6347
  }
6348
+ /**
6349
+ * Generates a custom UUID using a simple 36^12 method (8-character alphanumeric string with lowercase letters)
6350
+ * This has a higher chance of collision than a UUIDv4, but not only faster to generate than an UUIDV4,
6351
+ * it also has a smaller size, which is preferable to alleviate the overall data size.
6352
+ *
6353
+ * This method is preferable when generating uuids for the core data (sheetId, figureId, etc)
6354
+ * as they will appear several times in the revisions and local history.
6355
+ *
6356
+ */
6357
+ smallUuid() {
6358
+ if (this.isFastIdStrategy) {
6359
+ this.fastIdStart++;
6360
+ return String(this.fastIdStart);
6361
+ //@ts-ignore
6362
+ }
6363
+ else if (window.crypto && window.crypto.getRandomValues) {
6364
+ //@ts-ignore
6365
+ return ([1e7] + -1e3).replace(/[018]/g, (c) => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16));
6366
+ }
6367
+ else {
6368
+ // mainly for jest and other browsers that do not have the crypto functionality
6369
+ return "xxxxxxxx-xxxx".replace(/[xy]/g, function (c) {
6370
+ var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
6371
+ return v.toString(16);
6372
+ });
6373
+ }
6374
+ }
6375
+ /**
6376
+ * Generates an UUIDV4, has astronomically low chance of collision, but is larger in size than the smallUuid.
6377
+ * This method should be used when you need to avoid collisions at all costs, like the id of a revision.
6378
+ */
6341
6379
  uuidv4() {
6342
6380
  if (this.isFastIdStrategy) {
6343
6381
  this.fastIdStart++;
@@ -6351,7 +6389,7 @@ class UuidGenerator {
6351
6389
  else {
6352
6390
  // mainly for jest and other browsers that do not have the crypto functionality
6353
6391
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
6354
- var r = (Math.random() * 16) | 0, v = c === "x" ? r : (r & 0x3) | 0x8;
6392
+ var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
6355
6393
  return v.toString(16);
6356
6394
  });
6357
6395
  }
@@ -8330,7 +8368,7 @@ class ChartClipboardHandler extends AbstractFigureClipboardHandler {
8330
8368
  };
8331
8369
  }
8332
8370
  getPasteTarget(sheetId, target, content, options) {
8333
- const newId = new UuidGenerator().uuidv4();
8371
+ const newId = new UuidGenerator().smallUuid();
8334
8372
  return { zones: [], figureId: newId, sheetId };
8335
8373
  }
8336
8374
  paste(target, clippedContent, options) {
@@ -8496,7 +8534,7 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
8496
8534
  if (!targetCF && queuedCfs) {
8497
8535
  targetCF = queuedCfs.find((queued) => queued.cf.stopIfTrue === originCF.stopIfTrue && deepEquals(queued.cf.rule, originCF.rule))?.cf;
8498
8536
  }
8499
- return targetCF || { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
8537
+ return targetCF || { ...originCF, id: this.uuidGenerator.smallUuid(), ranges: [] };
8500
8538
  }
8501
8539
  }
8502
8540
 
@@ -8589,7 +8627,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
8589
8627
  }
8590
8628
  return (targetRule || {
8591
8629
  ...originRule,
8592
- id: newId ? this.uuidGenerator.uuidv4() : originRule.id,
8630
+ id: newId ? this.uuidGenerator.smallUuid() : originRule.id,
8593
8631
  ranges: [],
8594
8632
  });
8595
8633
  }
@@ -8651,7 +8689,7 @@ class ImageClipboardHandler extends AbstractFigureClipboardHandler {
8651
8689
  };
8652
8690
  }
8653
8691
  getPasteTarget(sheetId, target, content, options) {
8654
- const newId = new UuidGenerator().uuidv4();
8692
+ const newId = new UuidGenerator().smallUuid();
8655
8693
  return { sheetId, zones: [], figureId: newId };
8656
8694
  }
8657
8695
  paste(target, clippedContent, options) {
@@ -15053,7 +15091,7 @@ const SORTN = {
15053
15091
  }
15054
15092
  }
15055
15093
  },
15056
- isExported: true,
15094
+ isExported: false,
15057
15095
  };
15058
15096
  // -----------------------------------------------------------------------------
15059
15097
  // UNIQUE
@@ -28507,17 +28545,15 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
28507
28545
  plugins: [],
28508
28546
  };
28509
28547
  }
28510
- function getChartLabelFormat(getters, range) {
28548
+ function getChartLabelFormat(getters, range, shouldRemoveFirstLabel) {
28511
28549
  if (!range)
28512
28550
  return undefined;
28513
- const { sheetId, zone: { left, top, bottom }, } = range;
28514
- for (let row = top; row <= bottom; row++) {
28515
- const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
28516
- if (format) {
28517
- return format;
28518
- }
28551
+ const { sheetId, zone } = range;
28552
+ const formats = positions(zone).map((position) => getters.getEvaluatedCell({ sheetId, ...position }).format);
28553
+ if (shouldRemoveFirstLabel) {
28554
+ formats.shift();
28519
28555
  }
28520
- return undefined;
28556
+ return formats.find((format) => format !== undefined);
28521
28557
  }
28522
28558
  function getChartLabelValues(getters, dataSets, labelRange) {
28523
28559
  let labels = { values: [], formattedValues: [] };
@@ -28805,9 +28841,7 @@ function createBarChartRuntime(chart, getters) {
28805
28841
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
28806
28842
  let labels = labelValues.formattedValues;
28807
28843
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
28808
- if (chart.dataSetsHaveTitle &&
28809
- dataSetsValues[0] &&
28810
- labels.length > dataSetsValues[0].data.length) {
28844
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
28811
28845
  labels.shift();
28812
28846
  }
28813
28847
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -29076,8 +29110,8 @@ function fixEmptyLabelsForDateCharts(labels, dataSetsValues) {
29076
29110
  }
29077
29111
  return { labels: newLabels, dataSetsValues: newDatasets };
29078
29112
  }
29079
- function canChartParseLabels(labelRange, getters) {
29080
- return canBeDateChart(labelRange, getters) || canBeLinearChart(labelRange, getters);
29113
+ function canChartParseLabels(chart, getters) {
29114
+ return canBeDateChart(chart, getters) || canBeLinearChart(chart, getters);
29081
29115
  }
29082
29116
  function getChartAxisType(chart, getters) {
29083
29117
  if (isDateChart(chart, getters) && isLuxonTimeAdapterInstalled()) {
@@ -29089,23 +29123,26 @@ function getChartAxisType(chart, getters) {
29089
29123
  return "category";
29090
29124
  }
29091
29125
  function isDateChart(chart, getters) {
29092
- return !chart.labelsAsText && canBeDateChart(chart.labelRange, getters);
29126
+ return !chart.labelsAsText && canBeDateChart(chart, getters);
29093
29127
  }
29094
29128
  function isLinearChart(chart, getters) {
29095
- return !chart.labelsAsText && canBeLinearChart(chart.labelRange, getters);
29129
+ return !chart.labelsAsText && canBeLinearChart(chart, getters);
29096
29130
  }
29097
- function canBeDateChart(labelRange, getters) {
29098
- if (!labelRange || !canBeLinearChart(labelRange, getters)) {
29131
+ function canBeDateChart(chart, getters) {
29132
+ if (!chart.labelRange || !canBeLinearChart(chart, getters)) {
29099
29133
  return false;
29100
29134
  }
29101
- const labelFormat = getChartLabelFormat(getters, labelRange);
29135
+ const labelFormat = getChartLabelFormat(getters, chart.labelRange, shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle));
29102
29136
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
29103
29137
  }
29104
- function canBeLinearChart(labelRange, getters) {
29105
- if (!labelRange) {
29138
+ function canBeLinearChart(chart, getters) {
29139
+ if (!chart.labelRange) {
29106
29140
  return false;
29107
29141
  }
29108
- const labels = getters.getRangeValues(labelRange);
29142
+ const labels = getters.getRangeValues(chart.labelRange);
29143
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
29144
+ labels.shift();
29145
+ }
29109
29146
  if (labels.some((label) => isNaN(Number(label)) && label)) {
29110
29147
  return false;
29111
29148
  }
@@ -29189,9 +29226,8 @@ function createLineOrScatterChartRuntime(chart, getters) {
29189
29226
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
29190
29227
  let labels = axisType === "linear" ? labelValues.values : labelValues.formattedValues;
29191
29228
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
29192
- if (chart.dataSetsHaveTitle &&
29193
- dataSetsValues[0] &&
29194
- labels.length > dataSetsValues[0].data.length) {
29229
+ const removeFirstLabel = shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle);
29230
+ if (removeFirstLabel) {
29195
29231
  labels.shift();
29196
29232
  }
29197
29233
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -29281,12 +29317,7 @@ function createLineOrScatterChartRuntime(chart, getters) {
29281
29317
  background: chart.background,
29282
29318
  callback: formatTickValue(options),
29283
29319
  };
29284
- if (chart.dataSetsHaveTitle &&
29285
- dataSetsValues[0] &&
29286
- labels.length > dataSetsValues[0].data.length) {
29287
- labels.shift();
29288
- }
29289
- const labelFormat = getChartLabelFormat(getters, chart.labelRange);
29320
+ const labelFormat = getChartLabelFormat(getters, chart.labelRange, removeFirstLabel);
29290
29321
  if (axisType === "time") {
29291
29322
  const axis = {
29292
29323
  type: "time",
@@ -29544,9 +29575,7 @@ function createComboChartRuntime(chart, getters) {
29544
29575
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
29545
29576
  let labels = labelValues.formattedValues;
29546
29577
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
29547
- if (chart.dataSetsHaveTitle &&
29548
- dataSetsValues[0] &&
29549
- labels.length > dataSetsValues[0].data.length) {
29578
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
29550
29579
  labels.shift();
29551
29580
  }
29552
29581
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -30237,9 +30266,7 @@ function createPieChartRuntime(chart, getters) {
30237
30266
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
30238
30267
  let labels = labelValues.formattedValues;
30239
30268
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
30240
- if (chart.dataSetsHaveTitle &&
30241
- dataSetsValues[0] &&
30242
- labels.length > dataSetsValues[0].data.length) {
30269
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
30243
30270
  labels.shift();
30244
30271
  }
30245
30272
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -30784,9 +30811,7 @@ function createWaterfallChartRuntime(chart, getters) {
30784
30811
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
30785
30812
  let labels = labelValues.formattedValues;
30786
30813
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
30787
- if (chart.dataSetsHaveTitle &&
30788
- dataSetsValues[0] &&
30789
- labels.length > dataSetsValues[0].data.length) {
30814
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
30790
30815
  labels.shift();
30791
30816
  }
30792
30817
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -32282,7 +32307,7 @@ const linkSheet = {
32282
32307
  const deleteSheet = {
32283
32308
  name: _t("Delete"),
32284
32309
  isVisible: (env) => {
32285
- return env.model.getters.getSheetIds().length > 1;
32310
+ return env.model.getters.getVisibleSheetIds().length > 1;
32286
32311
  },
32287
32312
  execute: (env) => env.askConfirmation(_t("Are you sure you want to delete this sheet?"), () => {
32288
32313
  env.model.dispatch("DELETE_SHEET", { sheetId: env.model.getters.getActiveSheetId() });
@@ -32293,7 +32318,7 @@ const duplicateSheet = {
32293
32318
  name: _t("Duplicate"),
32294
32319
  execute: (env) => {
32295
32320
  const sheetIdFrom = env.model.getters.getActiveSheetId();
32296
- const sheetIdTo = env.model.uuidGenerator.uuidv4();
32321
+ const sheetIdTo = env.model.uuidGenerator.smallUuid();
32297
32322
  env.model.dispatch("DUPLICATE_SHEET", {
32298
32323
  sheetId: sheetIdFrom,
32299
32324
  sheetIdTo,
@@ -32920,20 +32945,21 @@ function getSmartChartDefinition(zone, getters) {
32920
32945
  }
32921
32946
  // Only display legend for several datasets.
32922
32947
  const newLegendPos = dataSetZone.right === dataSetZone.left ? "none" : "top";
32923
- const labelRange = labelRangeXc ? getters.getRangeFromSheetXC(sheetId, labelRangeXc) : undefined;
32924
- if (canChartParseLabels(labelRange, getters)) {
32925
- return {
32926
- title: {},
32927
- dataSets,
32928
- labelsAsText: false,
32929
- stacked: false,
32930
- aggregated: false,
32931
- cumulative: false,
32932
- labelRange: labelRangeXc,
32933
- type: "line",
32934
- dataSetsHaveTitle,
32935
- legendPosition: newLegendPos,
32936
- };
32948
+ const lineChartDefinition = {
32949
+ title: {},
32950
+ dataSets,
32951
+ labelsAsText: false,
32952
+ stacked: false,
32953
+ aggregated: false,
32954
+ cumulative: false,
32955
+ labelRange: labelRangeXc,
32956
+ type: "line",
32957
+ dataSetsHaveTitle,
32958
+ legendPosition: newLegendPos,
32959
+ };
32960
+ const chart = new LineChart(lineChartDefinition, sheetId, getters);
32961
+ if (canChartParseLabels(chart, getters)) {
32962
+ return lineChartDefinition;
32937
32963
  }
32938
32964
  const _dataSets = createDataSets(getters, dataSets, sheetId, dataSetsHaveTitle);
32939
32965
  if (singleColumn &&
@@ -33301,7 +33327,7 @@ const HIDE_ROWS_NAME = (env) => {
33301
33327
  //------------------------------------------------------------------------------
33302
33328
  const CREATE_CHART = (env) => {
33303
33329
  const getters = env.model.getters;
33304
- const id = env.model.uuidGenerator.uuidv4();
33330
+ const id = env.model.uuidGenerator.smallUuid();
33305
33331
  const sheetId = getters.getActiveSheetId();
33306
33332
  if (getZoneArea(env.model.getters.getSelectedZone()) === 1) {
33307
33333
  env.model.selection.selectTableAroundSelection();
@@ -33324,8 +33350,8 @@ const CREATE_CHART = (env) => {
33324
33350
  // Pivots
33325
33351
  //------------------------------------------------------------------------------
33326
33352
  const CREATE_PIVOT = (env) => {
33327
- const pivotId = env.model.uuidGenerator.uuidv4();
33328
- const newSheetId = env.model.uuidGenerator.uuidv4();
33353
+ const pivotId = env.model.uuidGenerator.smallUuid();
33354
+ const newSheetId = env.model.uuidGenerator.smallUuid();
33329
33355
  const result = env.model.dispatch("INSERT_NEW_PIVOT", { pivotId, newSheetId });
33330
33356
  if (result.isSuccessful) {
33331
33357
  env.openSidePanel("PivotSidePanel", { pivotId });
@@ -33384,7 +33410,7 @@ async function requestImage(env) {
33384
33410
  const CREATE_IMAGE = async (env) => {
33385
33411
  if (env.imageProvider) {
33386
33412
  const sheetId = env.model.getters.getActiveSheetId();
33387
- const figureId = env.model.uuidGenerator.uuidv4();
33413
+ const figureId = env.model.uuidGenerator.smallUuid();
33388
33414
  const image = await requestImage(env);
33389
33415
  if (!image) {
33390
33416
  throw new Error("No image provider was given to the environment");
@@ -33937,7 +33963,7 @@ const insertCheckbox = {
33937
33963
  ranges,
33938
33964
  sheetId,
33939
33965
  rule: {
33940
- id: env.model.uuidGenerator.uuidv4(),
33966
+ id: env.model.uuidGenerator.smallUuid(),
33941
33967
  criterion: {
33942
33968
  type: "isBoolean",
33943
33969
  values: [],
@@ -33953,7 +33979,7 @@ const insertDropdown = {
33953
33979
  const zones = env.model.getters.getSelectedZones();
33954
33980
  const sheetId = env.model.getters.getActiveSheetId();
33955
33981
  const ranges = zones.map((zone) => env.model.getters.getRangeDataFromZone(sheetId, zone));
33956
- const ruleID = env.model.uuidGenerator.uuidv4();
33982
+ const ruleID = env.model.uuidGenerator.smallUuid();
33957
33983
  env.model.dispatch("ADD_DATA_VALIDATION_RULE", {
33958
33984
  ranges,
33959
33985
  sheetId,
@@ -33984,7 +34010,7 @@ const insertSheet = {
33984
34010
  execute: (env) => {
33985
34011
  const activeSheetId = env.model.getters.getActiveSheetId();
33986
34012
  const position = env.model.getters.getSheetIds().indexOf(activeSheetId) + 1;
33987
- const sheetId = env.model.uuidGenerator.uuidv4();
34013
+ const sheetId = env.model.uuidGenerator.smallUuid();
33988
34014
  env.model.dispatch("CREATE_SHEET", { sheetId, position });
33989
34015
  env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
33990
34016
  },
@@ -37979,7 +38005,7 @@ class LineConfigPanel extends GenericChartConfigPanel {
37979
38005
  get canTreatLabelsAsText() {
37980
38006
  const chart = this.env.model.getters.getChart(this.props.figureId);
37981
38007
  if (chart && chart instanceof LineChart) {
37982
- return canChartParseLabels(chart.labelRange, this.env.model.getters);
38008
+ return canChartParseLabels(chart, this.env.model.getters);
37983
38009
  }
37984
38010
  return false;
37985
38011
  }
@@ -38048,7 +38074,7 @@ class ScatterConfigPanel extends GenericChartConfigPanel {
38048
38074
  get canTreatLabelsAsText() {
38049
38075
  const chart = this.env.model.getters.getChart(this.props.figureId);
38050
38076
  if (chart && chart instanceof ScatterChart) {
38051
- return canChartParseLabels(chart.labelRange, this.env.model.getters);
38077
+ return canChartParseLabels(chart, this.env.model.getters);
38052
38078
  }
38053
38079
  return false;
38054
38080
  }
@@ -39255,8 +39281,8 @@ function useDragAndDropListItems() {
39255
39281
  document.body.style.cursor = "move";
39256
39282
  state.draggedItemId = args.draggedItemId;
39257
39283
  const container = direction === "horizontal"
39258
- ? new HorizontalContainer(args.containerEl)
39259
- : new VerticalContainer(args.containerEl);
39284
+ ? new HorizontalContainer(args.scrollableContainerEl)
39285
+ : new VerticalContainer(args.scrollableContainerEl);
39260
39286
  dndHelper = new DOMDndHelper({
39261
39287
  ...args,
39262
39288
  container,
@@ -39267,8 +39293,8 @@ function useDragAndDropListItems() {
39267
39293
  const stopListening = startDnd(dndHelper.onMouseMove.bind(dndHelper), dndHelper.onMouseUp.bind(dndHelper));
39268
39294
  cleanupFns.push(stopListening);
39269
39295
  const onScroll = dndHelper.onScroll.bind(dndHelper);
39270
- args.containerEl.addEventListener("scroll", onScroll);
39271
- cleanupFns.push(() => args.containerEl.removeEventListener("scroll", onScroll));
39296
+ args.scrollableContainerEl.addEventListener("scroll", onScroll);
39297
+ cleanupFns.push(() => args.scrollableContainerEl.removeEventListener("scroll", onScroll));
39272
39298
  cleanupFns.push(dndHelper.destroy.bind(dndHelper));
39273
39299
  };
39274
39300
  onWillUnmount(() => {
@@ -39732,7 +39758,7 @@ class ConditionalFormatPreviewList extends Component {
39732
39758
  draggedItemId: cf.id,
39733
39759
  initialMousePosition: event.clientY,
39734
39760
  items: items,
39735
- containerEl: this.cfListRef.el,
39761
+ scrollableContainerEl: this.cfListRef.el,
39736
39762
  onDragEnd: (cfId, finalIndex) => this.onDragEnd(cfId, finalIndex),
39737
39763
  });
39738
39764
  }
@@ -39863,7 +39889,7 @@ class ConditionalFormattingEditor extends Component {
39863
39889
  state;
39864
39890
  setup() {
39865
39891
  const cf = this.props.editedCf || {
39866
- id: this.env.model.uuidGenerator.uuidv4(),
39892
+ id: this.env.model.uuidGenerator.smallUuid(),
39867
39893
  ranges: this.env.model.getters
39868
39894
  .getSelectedZones()
39869
39895
  .map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone)),
@@ -41459,7 +41485,7 @@ class DataValidationEditor extends Component {
41459
41485
  .getSelectedZones()
41460
41486
  .map((zone) => zoneToXc(this.env.model.getters.getUnboundedZone(sheetId, zone)));
41461
41487
  return {
41462
- id: this.env.model.uuidGenerator.uuidv4(),
41488
+ id: this.env.model.uuidGenerator.smallUuid(),
41463
41489
  criterion: { type: "textContains", values: [""] },
41464
41490
  ranges,
41465
41491
  };
@@ -42716,6 +42742,7 @@ class PivotLayoutConfigurator extends Component {
42716
42742
  unusedGranularities: Object,
42717
42743
  dateGranularities: Array,
42718
42744
  datetimeGranularities: Array,
42745
+ getScrollableContainerEl: { type: Function, optional: true },
42719
42746
  pivotId: String,
42720
42747
  };
42721
42748
  dimensionsRef = useRef("pivot-dimensions");
@@ -42749,7 +42776,7 @@ class PivotLayoutConfigurator extends Component {
42749
42776
  draggedItemId: dimension.nameWithGranularity,
42750
42777
  initialMousePosition: event.clientY,
42751
42778
  items: draggableItems,
42752
- containerEl: this.dimensionsRef.el,
42779
+ scrollableContainerEl: this.props.getScrollableContainerEl?.() || this.dimensionsRef.el,
42753
42780
  onDragEnd: (dimensionName, finalIndex) => {
42754
42781
  const originalIndex = draggableIds.findIndex((id) => id === dimensionName);
42755
42782
  if (originalIndex === finalIndex) {
@@ -42798,7 +42825,7 @@ class PivotLayoutConfigurator extends Component {
42798
42825
  draggedItemId: measure.id,
42799
42826
  initialMousePosition: event.clientY,
42800
42827
  items: draggableItems,
42801
- containerEl: this.dimensionsRef.el,
42828
+ scrollableContainerEl: this.props.getScrollableContainerEl?.() || this.dimensionsRef.el,
42802
42829
  onDragEnd: (measureName, finalIndex) => {
42803
42830
  const originalIndex = draggableIds.findIndex((id) => id === measureName);
42804
42831
  if (originalIndex === finalIndex) {
@@ -42977,8 +43004,8 @@ class PivotTitleSection extends Component {
42977
43004
  return this.env.model.getters.getPivotDisplayName(this.props.pivotId);
42978
43005
  }
42979
43006
  duplicatePivot() {
42980
- const newPivotId = this.env.model.uuidGenerator.uuidv4();
42981
- const newSheetId = this.env.model.uuidGenerator.uuidv4();
43007
+ const newPivotId = this.env.model.uuidGenerator.smallUuid();
43008
+ const newSheetId = this.env.model.uuidGenerator.smallUuid();
42982
43009
  const result = this.env.model.dispatch("DUPLICATE_PIVOT_IN_NEW_SHEET", {
42983
43010
  pivotId: this.props.pivotId,
42984
43011
  newPivotId,
@@ -44426,6 +44453,7 @@ class PivotSpreadsheetSidePanel extends Component {
44426
44453
  };
44427
44454
  store;
44428
44455
  state;
44456
+ pivotSidePanelRef = useRef("pivotSidePanel");
44429
44457
  setup() {
44430
44458
  this.store = useLocalStore(PivotSidePanelStore, this.props.pivotId);
44431
44459
  this.state = useState({
@@ -44454,6 +44482,9 @@ class PivotSpreadsheetSidePanel extends Component {
44454
44482
  get definition() {
44455
44483
  return this.store.definition;
44456
44484
  }
44485
+ getScrollableContainerEl() {
44486
+ return this.pivotSidePanelRef.el;
44487
+ }
44457
44488
  onSelectionChanged(ranges) {
44458
44489
  this.state.rangeHasChanged = true;
44459
44490
  this.state.range = ranges[0];
@@ -45539,7 +45570,7 @@ class TableStyleEditorPanel extends Component {
45539
45570
  this.state.selectedTemplateName = templateName;
45540
45571
  }
45541
45572
  onConfirm() {
45542
- const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.uuidv4();
45573
+ const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.smallUuid();
45543
45574
  this.env.model.dispatch("CREATE_TABLE_STYLE", {
45544
45575
  tableStyleId,
45545
45576
  tableStyleName: this.state.styleName,
@@ -54205,7 +54236,7 @@ class SheetPlugin extends CorePlugin {
54205
54236
  ? "Success" /* CommandResult.Success */
54206
54237
  : "InvalidColor" /* CommandResult.InvalidColor */;
54207
54238
  case "DELETE_SHEET":
54208
- return this.orderedSheetIds.length > 1
54239
+ return this.getVisibleSheetIds().length > 1
54209
54240
  ? "Success" /* CommandResult.Success */
54210
54241
  : "NotEnoughSheets" /* CommandResult.NotEnoughSheets */;
54211
54242
  case "ADD_COLUMNS_ROWS":
@@ -55071,7 +55102,7 @@ class TablePlugin extends CorePlugin {
55071
55102
  const union = this.getters.getRangesUnion(ranges);
55072
55103
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, union.zone);
55073
55104
  this.dispatch("REMOVE_MERGE", { sheetId: cmd.sheetId, target: mergesInTarget });
55074
- const id = this.uuidGenerator.uuidv4();
55105
+ const id = this.uuidGenerator.smallUuid();
55075
55106
  const config = cmd.config || DEFAULT_TABLE_CONFIG;
55076
55107
  const newTable = cmd.tableType === "dynamic"
55077
55108
  ? this.createDynamicTable(id, union, config)
@@ -55224,7 +55255,7 @@ class TablePlugin extends CorePlugin {
55224
55255
  filters = [];
55225
55256
  for (const i of range(zone.left, zone.right + 1)) {
55226
55257
  const filterZone = { ...zone, left: i, right: i };
55227
- const uid = this.uuidGenerator.uuidv4();
55258
+ const uid = this.uuidGenerator.smallUuid();
55228
55259
  filters.push(this.createFilterFromZone(uid, tableRange.sheetId, filterZone, config));
55229
55260
  }
55230
55261
  }
@@ -55289,7 +55320,7 @@ class TablePlugin extends CorePlugin {
55289
55320
  ? table.filters.find((f) => f.col === i)
55290
55321
  : undefined;
55291
55322
  const filterZone = { ...tableZone, left: i, right: i };
55292
- const filterId = oldFilter?.id || this.uuidGenerator.uuidv4();
55323
+ const filterId = oldFilter?.id || this.uuidGenerator.smallUuid();
55293
55324
  filters.push(this.createFilterFromZone(filterId, tableRange.sheetId, filterZone, config));
55294
55325
  }
55295
55326
  }
@@ -55390,7 +55421,7 @@ class TablePlugin extends CorePlugin {
55390
55421
  if (filters.length < zoneToDimension(tableZone).numberOfCols) {
55391
55422
  for (let col = tableZone.left; col <= tableZone.right; col++) {
55392
55423
  if (!filters.find((filter) => filter.col === col)) {
55393
- const uid = this.uuidGenerator.uuidv4();
55424
+ const uid = this.uuidGenerator.smallUuid();
55394
55425
  const filterZone = { ...tableZone, left: col, right: col };
55395
55426
  filters.push(this.createFilterFromZone(uid, sheetId, filterZone, table.config));
55396
55427
  }
@@ -61590,6 +61621,15 @@ class Session extends EventBus {
61590
61621
  this.waitingAck = true;
61591
61622
  this.sendPendingMessage();
61592
61623
  }
61624
+ dropPendingRevision(revisionId) {
61625
+ this.revisions.drop(revisionId);
61626
+ const revisionIds = this.pendingMessages
61627
+ .filter((message) => message.type === "REMOTE_REVISION")
61628
+ .map((message) => message.nextRevisionId);
61629
+ this.trigger("pending-revisions-dropped", { revisionIds });
61630
+ this.waitingAck = false;
61631
+ this.waitingUndoRedoAck = false;
61632
+ }
61593
61633
  /**
61594
61634
  * Send the next pending message
61595
61635
  */
@@ -61604,13 +61644,7 @@ class Session extends EventBus {
61604
61644
  * The command is empty, we have to drop all the next local revisions
61605
61645
  * to avoid issues with undo/redo
61606
61646
  */
61607
- this.revisions.drop(revision.id);
61608
- const revisionIds = this.pendingMessages
61609
- .filter((message) => message.type === "REMOTE_REVISION")
61610
- .map((message) => message.nextRevisionId);
61611
- this.trigger("pending-revisions-dropped", { revisionIds });
61612
- this.waitingAck = false;
61613
- this.waitingUndoRedoAck = false;
61647
+ this.dropPendingRevision(revision.id);
61614
61648
  this.pendingMessages = [];
61615
61649
  return;
61616
61650
  }
@@ -61636,7 +61670,6 @@ class Session extends EventBus {
61636
61670
  switch (message.type) {
61637
61671
  case "REMOTE_REVISION":
61638
61672
  case "REVISION_REDONE":
61639
- case "REVISION_UNDONE":
61640
61673
  case "SNAPSHOT_CREATED":
61641
61674
  this.waitingAck = false;
61642
61675
  this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
@@ -61645,6 +61678,27 @@ class Session extends EventBus {
61645
61678
  this.lastRevisionMessage = message;
61646
61679
  this.sendPendingMessage();
61647
61680
  break;
61681
+ case "REVISION_UNDONE": {
61682
+ this.waitingAck = false;
61683
+ this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
61684
+ const pendingRemoteRevisions = this.pendingMessages.filter((message) => message.type === "REMOTE_REVISION");
61685
+ const firstTransformedRevisionIndex = pendingRemoteRevisions.findIndex((message) => !deepEquals(message.commands, this.revisions.get(message.nextRevisionId).commands));
61686
+ if (firstTransformedRevisionIndex !== -1) {
61687
+ /**
61688
+ * Some revisions undergo transformations that may cause issues with
61689
+ * undo/redo if the transformation is destructive (we don't get back
61690
+ * the original command by transforming it with the inverse).
61691
+ * To prevent these problems, we must discard all subsequent local
61692
+ * revisions.
61693
+ */
61694
+ this.dropPendingRevision(this.pendingMessages[firstTransformedRevisionIndex].nextRevisionId);
61695
+ this.pendingMessages = this.pendingMessages.slice(0, firstTransformedRevisionIndex);
61696
+ }
61697
+ this.serverRevisionId = message.nextRevisionId;
61698
+ this.processedRevisions.add(message.nextRevisionId);
61699
+ this.sendPendingMessage();
61700
+ break;
61701
+ }
61648
61702
  }
61649
61703
  }
61650
61704
  isAlreadyProcessed(message) {
@@ -63076,23 +63130,23 @@ const uuidGenerator = new UuidGenerator();
63076
63130
  function repeatCreateChartCommand(getters, cmd) {
63077
63131
  return {
63078
63132
  ...repeatSheetDependantCommand(getters, cmd),
63079
- id: uuidGenerator.uuidv4(),
63133
+ id: uuidGenerator.smallUuid(),
63080
63134
  };
63081
63135
  }
63082
63136
  function repeatCreateImageCommand(getters, cmd) {
63083
63137
  return {
63084
63138
  ...repeatSheetDependantCommand(getters, cmd),
63085
- figureId: uuidGenerator.uuidv4(),
63139
+ figureId: uuidGenerator.smallUuid(),
63086
63140
  };
63087
63141
  }
63088
63142
  function repeatCreateFigureCommand(getters, cmd) {
63089
63143
  const newCmd = repeatSheetDependantCommand(getters, cmd);
63090
- newCmd.figure.id = uuidGenerator.uuidv4();
63144
+ newCmd.figure.id = uuidGenerator.smallUuid();
63091
63145
  return newCmd;
63092
63146
  }
63093
63147
  function repeatCreateSheetCommand(getters, cmd) {
63094
63148
  const newCmd = deepCopy(cmd);
63095
- newCmd.sheetId = uuidGenerator.uuidv4();
63149
+ newCmd.sheetId = uuidGenerator.smallUuid();
63096
63150
  const sheetName = cmd.name || getters.getSheet(getters.getActiveSheetId()).name;
63097
63151
  // Extract the prefix of the sheet name (everything before the number at the end of the name)
63098
63152
  const namePrefix = sheetName.match(/(.+?)\d*$/)?.[1] || sheetName;
@@ -64555,23 +64609,7 @@ class GridSelectionPlugin extends UIPlugin {
64555
64609
  gridSelection: deepCopy(gridSelection),
64556
64610
  };
64557
64611
  }
64558
- if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
64559
- const currentSheetIds = this.getters.getVisibleSheetIds();
64560
- this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
64561
- if (this.activeSheet.id in this.sheetsData) {
64562
- const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
64563
- this.selectCell(anchor.cell.col, anchor.cell.row);
64564
- }
64565
- else {
64566
- this.selectCell(0, 0);
64567
- }
64568
- const { col, row } = this.gridSelection.anchor.cell;
64569
- this.moveClient({
64570
- sheetId: this.getters.getActiveSheetId(),
64571
- col,
64572
- row,
64573
- });
64574
- }
64612
+ this.fallbackToVisibleSheet();
64575
64613
  const sheetId = this.getters.getActiveSheetId();
64576
64614
  this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
64577
64615
  this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
@@ -64581,6 +64619,7 @@ class GridSelectionPlugin extends UIPlugin {
64581
64619
  }
64582
64620
  }
64583
64621
  finalize() {
64622
+ this.fallbackToVisibleSheet();
64584
64623
  /** Any change to the selection has to be reflected in the selection processor. */
64585
64624
  this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
64586
64625
  }
@@ -64884,6 +64923,25 @@ class GridSelectionPlugin extends UIPlugin {
64884
64923
  }
64885
64924
  return "Success" /* CommandResult.Success */;
64886
64925
  }
64926
+ fallbackToVisibleSheet() {
64927
+ if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
64928
+ const currentSheetIds = this.getters.getVisibleSheetIds();
64929
+ this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
64930
+ if (this.activeSheet.id in this.sheetsData) {
64931
+ const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
64932
+ this.selectCell(anchor.cell.col, anchor.cell.row);
64933
+ }
64934
+ else {
64935
+ this.selectCell(0, 0);
64936
+ }
64937
+ const { col, row } = this.gridSelection.anchor.cell;
64938
+ this.moveClient({
64939
+ sheetId: this.getters.getActiveSheetId(),
64940
+ col,
64941
+ row,
64942
+ });
64943
+ }
64944
+ }
64887
64945
  //-------------------------------------------
64888
64946
  // Helpers for extensions
64889
64947
  // ------------------------------------------
@@ -66886,7 +66944,7 @@ class BottomBar extends Component {
66886
66944
  clickAddSheet(ev) {
66887
66945
  const activeSheetId = this.env.model.getters.getActiveSheetId();
66888
66946
  const position = this.env.model.getters.getSheetIds().findIndex((sheetId) => sheetId === activeSheetId) + 1;
66889
- const sheetId = this.env.model.uuidGenerator.uuidv4();
66947
+ const sheetId = this.env.model.uuidGenerator.smallUuid();
66890
66948
  const name = this.env.model.getters.getNextSheetName(_t("Sheet"));
66891
66949
  this.env.model.dispatch("CREATE_SHEET", { sheetId, position, name });
66892
66950
  this.env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
@@ -67003,7 +67061,7 @@ class BottomBar extends Component {
67003
67061
  draggedItemId: sheetId,
67004
67062
  initialMousePosition: event.clientX,
67005
67063
  items: sheets,
67006
- containerEl: this.sheetListRef.el,
67064
+ scrollableContainerEl: this.sheetListRef.el,
67007
67065
  onDragEnd: (sheetId, finalIndex) => this.onDragEnd(sheetId, finalIndex),
67008
67066
  });
67009
67067
  }
@@ -67974,7 +68032,7 @@ css /* scss */ `
67974
68032
  .o-font-size-editor {
67975
68033
  height: calc(100% - 4px);
67976
68034
  input.o-font-size {
67977
- outline-color: ${SELECTION_BORDER_COLOR};
68035
+ outline: none;
67978
68036
  height: 20px;
67979
68037
  width: 23px;
67980
68038
  }
@@ -69261,7 +69319,7 @@ class Tree {
69261
69319
  }
69262
69320
  /**
69263
69321
  * Drop the operation and all following operations in every
69264
- * branch
69322
+ * branches
69265
69323
  */
69266
69324
  drop(operationId) {
69267
69325
  for (const branch of this.branches) {
@@ -72638,7 +72696,7 @@ class Model extends EventBus {
72638
72696
  }
72639
72697
  setupConfig(config) {
72640
72698
  const client = config.client || {
72641
- id: this.uuidGenerator.uuidv4(),
72699
+ id: this.uuidGenerator.smallUuid(),
72642
72700
  name: _t("Anonymous").toString(),
72643
72701
  };
72644
72702
  const transportService = config.transportService || new LocalTransportService();
@@ -73125,6 +73183,6 @@ const constants = {
73125
73183
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, 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 };
73126
73184
 
73127
73185
 
73128
- __info__.version = "18.0.14";
73129
- __info__.date = "2025-02-05T06:47:33.041Z";
73130
- __info__.hash = "90f2af4";
73186
+ __info__.version = "18.0.16";
73187
+ __info__.date = "2025-02-14T08:44:19.475Z";
73188
+ __info__.hash = "39979ab";