@odoo/o-spreadsheet 18.0.15 → 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.15
6
- * @date 2025-02-10T08:59:22.993Z
7
- * @hash 5b19f88
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';
@@ -6345,6 +6345,37 @@ class UuidGenerator {
6345
6345
  setIsFastStrategy(isFast) {
6346
6346
  this.isFastIdStrategy = isFast;
6347
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
+ */
6348
6379
  uuidv4() {
6349
6380
  if (this.isFastIdStrategy) {
6350
6381
  this.fastIdStart++;
@@ -6358,7 +6389,7 @@ class UuidGenerator {
6358
6389
  else {
6359
6390
  // mainly for jest and other browsers that do not have the crypto functionality
6360
6391
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
6361
- 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;
6362
6393
  return v.toString(16);
6363
6394
  });
6364
6395
  }
@@ -8337,7 +8368,7 @@ class ChartClipboardHandler extends AbstractFigureClipboardHandler {
8337
8368
  };
8338
8369
  }
8339
8370
  getPasteTarget(sheetId, target, content, options) {
8340
- const newId = new UuidGenerator().uuidv4();
8371
+ const newId = new UuidGenerator().smallUuid();
8341
8372
  return { zones: [], figureId: newId, sheetId };
8342
8373
  }
8343
8374
  paste(target, clippedContent, options) {
@@ -8503,7 +8534,7 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
8503
8534
  if (!targetCF && queuedCfs) {
8504
8535
  targetCF = queuedCfs.find((queued) => queued.cf.stopIfTrue === originCF.stopIfTrue && deepEquals(queued.cf.rule, originCF.rule))?.cf;
8505
8536
  }
8506
- return targetCF || { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
8537
+ return targetCF || { ...originCF, id: this.uuidGenerator.smallUuid(), ranges: [] };
8507
8538
  }
8508
8539
  }
8509
8540
 
@@ -8596,7 +8627,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
8596
8627
  }
8597
8628
  return (targetRule || {
8598
8629
  ...originRule,
8599
- id: newId ? this.uuidGenerator.uuidv4() : originRule.id,
8630
+ id: newId ? this.uuidGenerator.smallUuid() : originRule.id,
8600
8631
  ranges: [],
8601
8632
  });
8602
8633
  }
@@ -8658,7 +8689,7 @@ class ImageClipboardHandler extends AbstractFigureClipboardHandler {
8658
8689
  };
8659
8690
  }
8660
8691
  getPasteTarget(sheetId, target, content, options) {
8661
- const newId = new UuidGenerator().uuidv4();
8692
+ const newId = new UuidGenerator().smallUuid();
8662
8693
  return { sheetId, zones: [], figureId: newId };
8663
8694
  }
8664
8695
  paste(target, clippedContent, options) {
@@ -15060,7 +15091,7 @@ const SORTN = {
15060
15091
  }
15061
15092
  }
15062
15093
  },
15063
- isExported: true,
15094
+ isExported: false,
15064
15095
  };
15065
15096
  // -----------------------------------------------------------------------------
15066
15097
  // UNIQUE
@@ -28514,17 +28545,15 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
28514
28545
  plugins: [],
28515
28546
  };
28516
28547
  }
28517
- function getChartLabelFormat(getters, range) {
28548
+ function getChartLabelFormat(getters, range, shouldRemoveFirstLabel) {
28518
28549
  if (!range)
28519
28550
  return undefined;
28520
- const { sheetId, zone: { left, top, bottom }, } = range;
28521
- for (let row = top; row <= bottom; row++) {
28522
- const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
28523
- if (format) {
28524
- return format;
28525
- }
28551
+ const { sheetId, zone } = range;
28552
+ const formats = positions(zone).map((position) => getters.getEvaluatedCell({ sheetId, ...position }).format);
28553
+ if (shouldRemoveFirstLabel) {
28554
+ formats.shift();
28526
28555
  }
28527
- return undefined;
28556
+ return formats.find((format) => format !== undefined);
28528
28557
  }
28529
28558
  function getChartLabelValues(getters, dataSets, labelRange) {
28530
28559
  let labels = { values: [], formattedValues: [] };
@@ -28812,9 +28841,7 @@ function createBarChartRuntime(chart, getters) {
28812
28841
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
28813
28842
  let labels = labelValues.formattedValues;
28814
28843
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
28815
- if (chart.dataSetsHaveTitle &&
28816
- dataSetsValues[0] &&
28817
- labels.length > dataSetsValues[0].data.length) {
28844
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
28818
28845
  labels.shift();
28819
28846
  }
28820
28847
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -29083,8 +29110,8 @@ function fixEmptyLabelsForDateCharts(labels, dataSetsValues) {
29083
29110
  }
29084
29111
  return { labels: newLabels, dataSetsValues: newDatasets };
29085
29112
  }
29086
- function canChartParseLabels(labelRange, getters) {
29087
- return canBeDateChart(labelRange, getters) || canBeLinearChart(labelRange, getters);
29113
+ function canChartParseLabels(chart, getters) {
29114
+ return canBeDateChart(chart, getters) || canBeLinearChart(chart, getters);
29088
29115
  }
29089
29116
  function getChartAxisType(chart, getters) {
29090
29117
  if (isDateChart(chart, getters) && isLuxonTimeAdapterInstalled()) {
@@ -29096,23 +29123,26 @@ function getChartAxisType(chart, getters) {
29096
29123
  return "category";
29097
29124
  }
29098
29125
  function isDateChart(chart, getters) {
29099
- return !chart.labelsAsText && canBeDateChart(chart.labelRange, getters);
29126
+ return !chart.labelsAsText && canBeDateChart(chart, getters);
29100
29127
  }
29101
29128
  function isLinearChart(chart, getters) {
29102
- return !chart.labelsAsText && canBeLinearChart(chart.labelRange, getters);
29129
+ return !chart.labelsAsText && canBeLinearChart(chart, getters);
29103
29130
  }
29104
- function canBeDateChart(labelRange, getters) {
29105
- if (!labelRange || !canBeLinearChart(labelRange, getters)) {
29131
+ function canBeDateChart(chart, getters) {
29132
+ if (!chart.labelRange || !canBeLinearChart(chart, getters)) {
29106
29133
  return false;
29107
29134
  }
29108
- const labelFormat = getChartLabelFormat(getters, labelRange);
29135
+ const labelFormat = getChartLabelFormat(getters, chart.labelRange, shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle));
29109
29136
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
29110
29137
  }
29111
- function canBeLinearChart(labelRange, getters) {
29112
- if (!labelRange) {
29138
+ function canBeLinearChart(chart, getters) {
29139
+ if (!chart.labelRange) {
29113
29140
  return false;
29114
29141
  }
29115
- 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
+ }
29116
29146
  if (labels.some((label) => isNaN(Number(label)) && label)) {
29117
29147
  return false;
29118
29148
  }
@@ -29196,9 +29226,8 @@ function createLineOrScatterChartRuntime(chart, getters) {
29196
29226
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
29197
29227
  let labels = axisType === "linear" ? labelValues.values : labelValues.formattedValues;
29198
29228
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
29199
- if (chart.dataSetsHaveTitle &&
29200
- dataSetsValues[0] &&
29201
- labels.length > dataSetsValues[0].data.length) {
29229
+ const removeFirstLabel = shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle);
29230
+ if (removeFirstLabel) {
29202
29231
  labels.shift();
29203
29232
  }
29204
29233
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -29288,12 +29317,7 @@ function createLineOrScatterChartRuntime(chart, getters) {
29288
29317
  background: chart.background,
29289
29318
  callback: formatTickValue(options),
29290
29319
  };
29291
- if (chart.dataSetsHaveTitle &&
29292
- dataSetsValues[0] &&
29293
- labels.length > dataSetsValues[0].data.length) {
29294
- labels.shift();
29295
- }
29296
- const labelFormat = getChartLabelFormat(getters, chart.labelRange);
29320
+ const labelFormat = getChartLabelFormat(getters, chart.labelRange, removeFirstLabel);
29297
29321
  if (axisType === "time") {
29298
29322
  const axis = {
29299
29323
  type: "time",
@@ -29551,9 +29575,7 @@ function createComboChartRuntime(chart, getters) {
29551
29575
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
29552
29576
  let labels = labelValues.formattedValues;
29553
29577
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
29554
- if (chart.dataSetsHaveTitle &&
29555
- dataSetsValues[0] &&
29556
- labels.length > dataSetsValues[0].data.length) {
29578
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
29557
29579
  labels.shift();
29558
29580
  }
29559
29581
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -30244,9 +30266,7 @@ function createPieChartRuntime(chart, getters) {
30244
30266
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
30245
30267
  let labels = labelValues.formattedValues;
30246
30268
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
30247
- if (chart.dataSetsHaveTitle &&
30248
- dataSetsValues[0] &&
30249
- labels.length > dataSetsValues[0].data.length) {
30269
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
30250
30270
  labels.shift();
30251
30271
  }
30252
30272
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -30791,9 +30811,7 @@ function createWaterfallChartRuntime(chart, getters) {
30791
30811
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
30792
30812
  let labels = labelValues.formattedValues;
30793
30813
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
30794
- if (chart.dataSetsHaveTitle &&
30795
- dataSetsValues[0] &&
30796
- labels.length > dataSetsValues[0].data.length) {
30814
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
30797
30815
  labels.shift();
30798
30816
  }
30799
30817
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -32289,7 +32307,7 @@ const linkSheet = {
32289
32307
  const deleteSheet = {
32290
32308
  name: _t("Delete"),
32291
32309
  isVisible: (env) => {
32292
- return env.model.getters.getSheetIds().length > 1;
32310
+ return env.model.getters.getVisibleSheetIds().length > 1;
32293
32311
  },
32294
32312
  execute: (env) => env.askConfirmation(_t("Are you sure you want to delete this sheet?"), () => {
32295
32313
  env.model.dispatch("DELETE_SHEET", { sheetId: env.model.getters.getActiveSheetId() });
@@ -32300,7 +32318,7 @@ const duplicateSheet = {
32300
32318
  name: _t("Duplicate"),
32301
32319
  execute: (env) => {
32302
32320
  const sheetIdFrom = env.model.getters.getActiveSheetId();
32303
- const sheetIdTo = env.model.uuidGenerator.uuidv4();
32321
+ const sheetIdTo = env.model.uuidGenerator.smallUuid();
32304
32322
  env.model.dispatch("DUPLICATE_SHEET", {
32305
32323
  sheetId: sheetIdFrom,
32306
32324
  sheetIdTo,
@@ -32927,20 +32945,21 @@ function getSmartChartDefinition(zone, getters) {
32927
32945
  }
32928
32946
  // Only display legend for several datasets.
32929
32947
  const newLegendPos = dataSetZone.right === dataSetZone.left ? "none" : "top";
32930
- const labelRange = labelRangeXc ? getters.getRangeFromSheetXC(sheetId, labelRangeXc) : undefined;
32931
- if (canChartParseLabels(labelRange, getters)) {
32932
- return {
32933
- title: {},
32934
- dataSets,
32935
- labelsAsText: false,
32936
- stacked: false,
32937
- aggregated: false,
32938
- cumulative: false,
32939
- labelRange: labelRangeXc,
32940
- type: "line",
32941
- dataSetsHaveTitle,
32942
- legendPosition: newLegendPos,
32943
- };
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;
32944
32963
  }
32945
32964
  const _dataSets = createDataSets(getters, dataSets, sheetId, dataSetsHaveTitle);
32946
32965
  if (singleColumn &&
@@ -33308,7 +33327,7 @@ const HIDE_ROWS_NAME = (env) => {
33308
33327
  //------------------------------------------------------------------------------
33309
33328
  const CREATE_CHART = (env) => {
33310
33329
  const getters = env.model.getters;
33311
- const id = env.model.uuidGenerator.uuidv4();
33330
+ const id = env.model.uuidGenerator.smallUuid();
33312
33331
  const sheetId = getters.getActiveSheetId();
33313
33332
  if (getZoneArea(env.model.getters.getSelectedZone()) === 1) {
33314
33333
  env.model.selection.selectTableAroundSelection();
@@ -33331,8 +33350,8 @@ const CREATE_CHART = (env) => {
33331
33350
  // Pivots
33332
33351
  //------------------------------------------------------------------------------
33333
33352
  const CREATE_PIVOT = (env) => {
33334
- const pivotId = env.model.uuidGenerator.uuidv4();
33335
- const newSheetId = env.model.uuidGenerator.uuidv4();
33353
+ const pivotId = env.model.uuidGenerator.smallUuid();
33354
+ const newSheetId = env.model.uuidGenerator.smallUuid();
33336
33355
  const result = env.model.dispatch("INSERT_NEW_PIVOT", { pivotId, newSheetId });
33337
33356
  if (result.isSuccessful) {
33338
33357
  env.openSidePanel("PivotSidePanel", { pivotId });
@@ -33391,7 +33410,7 @@ async function requestImage(env) {
33391
33410
  const CREATE_IMAGE = async (env) => {
33392
33411
  if (env.imageProvider) {
33393
33412
  const sheetId = env.model.getters.getActiveSheetId();
33394
- const figureId = env.model.uuidGenerator.uuidv4();
33413
+ const figureId = env.model.uuidGenerator.smallUuid();
33395
33414
  const image = await requestImage(env);
33396
33415
  if (!image) {
33397
33416
  throw new Error("No image provider was given to the environment");
@@ -33944,7 +33963,7 @@ const insertCheckbox = {
33944
33963
  ranges,
33945
33964
  sheetId,
33946
33965
  rule: {
33947
- id: env.model.uuidGenerator.uuidv4(),
33966
+ id: env.model.uuidGenerator.smallUuid(),
33948
33967
  criterion: {
33949
33968
  type: "isBoolean",
33950
33969
  values: [],
@@ -33960,7 +33979,7 @@ const insertDropdown = {
33960
33979
  const zones = env.model.getters.getSelectedZones();
33961
33980
  const sheetId = env.model.getters.getActiveSheetId();
33962
33981
  const ranges = zones.map((zone) => env.model.getters.getRangeDataFromZone(sheetId, zone));
33963
- const ruleID = env.model.uuidGenerator.uuidv4();
33982
+ const ruleID = env.model.uuidGenerator.smallUuid();
33964
33983
  env.model.dispatch("ADD_DATA_VALIDATION_RULE", {
33965
33984
  ranges,
33966
33985
  sheetId,
@@ -33991,7 +34010,7 @@ const insertSheet = {
33991
34010
  execute: (env) => {
33992
34011
  const activeSheetId = env.model.getters.getActiveSheetId();
33993
34012
  const position = env.model.getters.getSheetIds().indexOf(activeSheetId) + 1;
33994
- const sheetId = env.model.uuidGenerator.uuidv4();
34013
+ const sheetId = env.model.uuidGenerator.smallUuid();
33995
34014
  env.model.dispatch("CREATE_SHEET", { sheetId, position });
33996
34015
  env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
33997
34016
  },
@@ -37986,7 +38005,7 @@ class LineConfigPanel extends GenericChartConfigPanel {
37986
38005
  get canTreatLabelsAsText() {
37987
38006
  const chart = this.env.model.getters.getChart(this.props.figureId);
37988
38007
  if (chart && chart instanceof LineChart) {
37989
- return canChartParseLabels(chart.labelRange, this.env.model.getters);
38008
+ return canChartParseLabels(chart, this.env.model.getters);
37990
38009
  }
37991
38010
  return false;
37992
38011
  }
@@ -38055,7 +38074,7 @@ class ScatterConfigPanel extends GenericChartConfigPanel {
38055
38074
  get canTreatLabelsAsText() {
38056
38075
  const chart = this.env.model.getters.getChart(this.props.figureId);
38057
38076
  if (chart && chart instanceof ScatterChart) {
38058
- return canChartParseLabels(chart.labelRange, this.env.model.getters);
38077
+ return canChartParseLabels(chart, this.env.model.getters);
38059
38078
  }
38060
38079
  return false;
38061
38080
  }
@@ -39870,7 +39889,7 @@ class ConditionalFormattingEditor extends Component {
39870
39889
  state;
39871
39890
  setup() {
39872
39891
  const cf = this.props.editedCf || {
39873
- id: this.env.model.uuidGenerator.uuidv4(),
39892
+ id: this.env.model.uuidGenerator.smallUuid(),
39874
39893
  ranges: this.env.model.getters
39875
39894
  .getSelectedZones()
39876
39895
  .map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone)),
@@ -41466,7 +41485,7 @@ class DataValidationEditor extends Component {
41466
41485
  .getSelectedZones()
41467
41486
  .map((zone) => zoneToXc(this.env.model.getters.getUnboundedZone(sheetId, zone)));
41468
41487
  return {
41469
- id: this.env.model.uuidGenerator.uuidv4(),
41488
+ id: this.env.model.uuidGenerator.smallUuid(),
41470
41489
  criterion: { type: "textContains", values: [""] },
41471
41490
  ranges,
41472
41491
  };
@@ -42985,8 +43004,8 @@ class PivotTitleSection extends Component {
42985
43004
  return this.env.model.getters.getPivotDisplayName(this.props.pivotId);
42986
43005
  }
42987
43006
  duplicatePivot() {
42988
- const newPivotId = this.env.model.uuidGenerator.uuidv4();
42989
- const newSheetId = this.env.model.uuidGenerator.uuidv4();
43007
+ const newPivotId = this.env.model.uuidGenerator.smallUuid();
43008
+ const newSheetId = this.env.model.uuidGenerator.smallUuid();
42990
43009
  const result = this.env.model.dispatch("DUPLICATE_PIVOT_IN_NEW_SHEET", {
42991
43010
  pivotId: this.props.pivotId,
42992
43011
  newPivotId,
@@ -45551,7 +45570,7 @@ class TableStyleEditorPanel extends Component {
45551
45570
  this.state.selectedTemplateName = templateName;
45552
45571
  }
45553
45572
  onConfirm() {
45554
- const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.uuidv4();
45573
+ const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.smallUuid();
45555
45574
  this.env.model.dispatch("CREATE_TABLE_STYLE", {
45556
45575
  tableStyleId,
45557
45576
  tableStyleName: this.state.styleName,
@@ -54217,7 +54236,7 @@ class SheetPlugin extends CorePlugin {
54217
54236
  ? "Success" /* CommandResult.Success */
54218
54237
  : "InvalidColor" /* CommandResult.InvalidColor */;
54219
54238
  case "DELETE_SHEET":
54220
- return this.orderedSheetIds.length > 1
54239
+ return this.getVisibleSheetIds().length > 1
54221
54240
  ? "Success" /* CommandResult.Success */
54222
54241
  : "NotEnoughSheets" /* CommandResult.NotEnoughSheets */;
54223
54242
  case "ADD_COLUMNS_ROWS":
@@ -55083,7 +55102,7 @@ class TablePlugin extends CorePlugin {
55083
55102
  const union = this.getters.getRangesUnion(ranges);
55084
55103
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, union.zone);
55085
55104
  this.dispatch("REMOVE_MERGE", { sheetId: cmd.sheetId, target: mergesInTarget });
55086
- const id = this.uuidGenerator.uuidv4();
55105
+ const id = this.uuidGenerator.smallUuid();
55087
55106
  const config = cmd.config || DEFAULT_TABLE_CONFIG;
55088
55107
  const newTable = cmd.tableType === "dynamic"
55089
55108
  ? this.createDynamicTable(id, union, config)
@@ -55236,7 +55255,7 @@ class TablePlugin extends CorePlugin {
55236
55255
  filters = [];
55237
55256
  for (const i of range(zone.left, zone.right + 1)) {
55238
55257
  const filterZone = { ...zone, left: i, right: i };
55239
- const uid = this.uuidGenerator.uuidv4();
55258
+ const uid = this.uuidGenerator.smallUuid();
55240
55259
  filters.push(this.createFilterFromZone(uid, tableRange.sheetId, filterZone, config));
55241
55260
  }
55242
55261
  }
@@ -55301,7 +55320,7 @@ class TablePlugin extends CorePlugin {
55301
55320
  ? table.filters.find((f) => f.col === i)
55302
55321
  : undefined;
55303
55322
  const filterZone = { ...tableZone, left: i, right: i };
55304
- const filterId = oldFilter?.id || this.uuidGenerator.uuidv4();
55323
+ const filterId = oldFilter?.id || this.uuidGenerator.smallUuid();
55305
55324
  filters.push(this.createFilterFromZone(filterId, tableRange.sheetId, filterZone, config));
55306
55325
  }
55307
55326
  }
@@ -55402,7 +55421,7 @@ class TablePlugin extends CorePlugin {
55402
55421
  if (filters.length < zoneToDimension(tableZone).numberOfCols) {
55403
55422
  for (let col = tableZone.left; col <= tableZone.right; col++) {
55404
55423
  if (!filters.find((filter) => filter.col === col)) {
55405
- const uid = this.uuidGenerator.uuidv4();
55424
+ const uid = this.uuidGenerator.smallUuid();
55406
55425
  const filterZone = { ...tableZone, left: col, right: col };
55407
55426
  filters.push(this.createFilterFromZone(uid, sheetId, filterZone, table.config));
55408
55427
  }
@@ -61602,6 +61621,15 @@ class Session extends EventBus {
61602
61621
  this.waitingAck = true;
61603
61622
  this.sendPendingMessage();
61604
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
+ }
61605
61633
  /**
61606
61634
  * Send the next pending message
61607
61635
  */
@@ -61616,13 +61644,7 @@ class Session extends EventBus {
61616
61644
  * The command is empty, we have to drop all the next local revisions
61617
61645
  * to avoid issues with undo/redo
61618
61646
  */
61619
- this.revisions.drop(revision.id);
61620
- const revisionIds = this.pendingMessages
61621
- .filter((message) => message.type === "REMOTE_REVISION")
61622
- .map((message) => message.nextRevisionId);
61623
- this.trigger("pending-revisions-dropped", { revisionIds });
61624
- this.waitingAck = false;
61625
- this.waitingUndoRedoAck = false;
61647
+ this.dropPendingRevision(revision.id);
61626
61648
  this.pendingMessages = [];
61627
61649
  return;
61628
61650
  }
@@ -61648,7 +61670,6 @@ class Session extends EventBus {
61648
61670
  switch (message.type) {
61649
61671
  case "REMOTE_REVISION":
61650
61672
  case "REVISION_REDONE":
61651
- case "REVISION_UNDONE":
61652
61673
  case "SNAPSHOT_CREATED":
61653
61674
  this.waitingAck = false;
61654
61675
  this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
@@ -61657,6 +61678,27 @@ class Session extends EventBus {
61657
61678
  this.lastRevisionMessage = message;
61658
61679
  this.sendPendingMessage();
61659
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
+ }
61660
61702
  }
61661
61703
  }
61662
61704
  isAlreadyProcessed(message) {
@@ -63088,23 +63130,23 @@ const uuidGenerator = new UuidGenerator();
63088
63130
  function repeatCreateChartCommand(getters, cmd) {
63089
63131
  return {
63090
63132
  ...repeatSheetDependantCommand(getters, cmd),
63091
- id: uuidGenerator.uuidv4(),
63133
+ id: uuidGenerator.smallUuid(),
63092
63134
  };
63093
63135
  }
63094
63136
  function repeatCreateImageCommand(getters, cmd) {
63095
63137
  return {
63096
63138
  ...repeatSheetDependantCommand(getters, cmd),
63097
- figureId: uuidGenerator.uuidv4(),
63139
+ figureId: uuidGenerator.smallUuid(),
63098
63140
  };
63099
63141
  }
63100
63142
  function repeatCreateFigureCommand(getters, cmd) {
63101
63143
  const newCmd = repeatSheetDependantCommand(getters, cmd);
63102
- newCmd.figure.id = uuidGenerator.uuidv4();
63144
+ newCmd.figure.id = uuidGenerator.smallUuid();
63103
63145
  return newCmd;
63104
63146
  }
63105
63147
  function repeatCreateSheetCommand(getters, cmd) {
63106
63148
  const newCmd = deepCopy(cmd);
63107
- newCmd.sheetId = uuidGenerator.uuidv4();
63149
+ newCmd.sheetId = uuidGenerator.smallUuid();
63108
63150
  const sheetName = cmd.name || getters.getSheet(getters.getActiveSheetId()).name;
63109
63151
  // Extract the prefix of the sheet name (everything before the number at the end of the name)
63110
63152
  const namePrefix = sheetName.match(/(.+?)\d*$/)?.[1] || sheetName;
@@ -64567,23 +64609,7 @@ class GridSelectionPlugin extends UIPlugin {
64567
64609
  gridSelection: deepCopy(gridSelection),
64568
64610
  };
64569
64611
  }
64570
- if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
64571
- const currentSheetIds = this.getters.getVisibleSheetIds();
64572
- this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
64573
- if (this.activeSheet.id in this.sheetsData) {
64574
- const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
64575
- this.selectCell(anchor.cell.col, anchor.cell.row);
64576
- }
64577
- else {
64578
- this.selectCell(0, 0);
64579
- }
64580
- const { col, row } = this.gridSelection.anchor.cell;
64581
- this.moveClient({
64582
- sheetId: this.getters.getActiveSheetId(),
64583
- col,
64584
- row,
64585
- });
64586
- }
64612
+ this.fallbackToVisibleSheet();
64587
64613
  const sheetId = this.getters.getActiveSheetId();
64588
64614
  this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
64589
64615
  this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
@@ -64593,6 +64619,7 @@ class GridSelectionPlugin extends UIPlugin {
64593
64619
  }
64594
64620
  }
64595
64621
  finalize() {
64622
+ this.fallbackToVisibleSheet();
64596
64623
  /** Any change to the selection has to be reflected in the selection processor. */
64597
64624
  this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
64598
64625
  }
@@ -64896,6 +64923,25 @@ class GridSelectionPlugin extends UIPlugin {
64896
64923
  }
64897
64924
  return "Success" /* CommandResult.Success */;
64898
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
+ }
64899
64945
  //-------------------------------------------
64900
64946
  // Helpers for extensions
64901
64947
  // ------------------------------------------
@@ -66898,7 +66944,7 @@ class BottomBar extends Component {
66898
66944
  clickAddSheet(ev) {
66899
66945
  const activeSheetId = this.env.model.getters.getActiveSheetId();
66900
66946
  const position = this.env.model.getters.getSheetIds().findIndex((sheetId) => sheetId === activeSheetId) + 1;
66901
- const sheetId = this.env.model.uuidGenerator.uuidv4();
66947
+ const sheetId = this.env.model.uuidGenerator.smallUuid();
66902
66948
  const name = this.env.model.getters.getNextSheetName(_t("Sheet"));
66903
66949
  this.env.model.dispatch("CREATE_SHEET", { sheetId, position, name });
66904
66950
  this.env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
@@ -67986,7 +68032,7 @@ css /* scss */ `
67986
68032
  .o-font-size-editor {
67987
68033
  height: calc(100% - 4px);
67988
68034
  input.o-font-size {
67989
- outline-color: ${SELECTION_BORDER_COLOR};
68035
+ outline: none;
67990
68036
  height: 20px;
67991
68037
  width: 23px;
67992
68038
  }
@@ -69273,7 +69319,7 @@ class Tree {
69273
69319
  }
69274
69320
  /**
69275
69321
  * Drop the operation and all following operations in every
69276
- * branch
69322
+ * branches
69277
69323
  */
69278
69324
  drop(operationId) {
69279
69325
  for (const branch of this.branches) {
@@ -72650,7 +72696,7 @@ class Model extends EventBus {
72650
72696
  }
72651
72697
  setupConfig(config) {
72652
72698
  const client = config.client || {
72653
- id: this.uuidGenerator.uuidv4(),
72699
+ id: this.uuidGenerator.smallUuid(),
72654
72700
  name: _t("Anonymous").toString(),
72655
72701
  };
72656
72702
  const transportService = config.transportService || new LocalTransportService();
@@ -73137,6 +73183,6 @@ const constants = {
73137
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 };
73138
73184
 
73139
73185
 
73140
- __info__.version = "18.0.15";
73141
- __info__.date = "2025-02-10T08:59:22.993Z";
73142
- __info__.hash = "5b19f88";
73186
+ __info__.version = "18.0.16";
73187
+ __info__.date = "2025-02-14T08:44:19.475Z";
73188
+ __info__.hash = "39979ab";