@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
  (function (exports, owl) {
@@ -6346,6 +6346,37 @@
6346
6346
  setIsFastStrategy(isFast) {
6347
6347
  this.isFastIdStrategy = isFast;
6348
6348
  }
6349
+ /**
6350
+ * Generates a custom UUID using a simple 36^12 method (8-character alphanumeric string with lowercase letters)
6351
+ * This has a higher chance of collision than a UUIDv4, but not only faster to generate than an UUIDV4,
6352
+ * it also has a smaller size, which is preferable to alleviate the overall data size.
6353
+ *
6354
+ * This method is preferable when generating uuids for the core data (sheetId, figureId, etc)
6355
+ * as they will appear several times in the revisions and local history.
6356
+ *
6357
+ */
6358
+ smallUuid() {
6359
+ if (this.isFastIdStrategy) {
6360
+ this.fastIdStart++;
6361
+ return String(this.fastIdStart);
6362
+ //@ts-ignore
6363
+ }
6364
+ else if (window.crypto && window.crypto.getRandomValues) {
6365
+ //@ts-ignore
6366
+ return ([1e7] + -1e3).replace(/[018]/g, (c) => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16));
6367
+ }
6368
+ else {
6369
+ // mainly for jest and other browsers that do not have the crypto functionality
6370
+ return "xxxxxxxx-xxxx".replace(/[xy]/g, function (c) {
6371
+ var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
6372
+ return v.toString(16);
6373
+ });
6374
+ }
6375
+ }
6376
+ /**
6377
+ * Generates an UUIDV4, has astronomically low chance of collision, but is larger in size than the smallUuid.
6378
+ * This method should be used when you need to avoid collisions at all costs, like the id of a revision.
6379
+ */
6349
6380
  uuidv4() {
6350
6381
  if (this.isFastIdStrategy) {
6351
6382
  this.fastIdStart++;
@@ -6359,7 +6390,7 @@
6359
6390
  else {
6360
6391
  // mainly for jest and other browsers that do not have the crypto functionality
6361
6392
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
6362
- var r = (Math.random() * 16) | 0, v = c === "x" ? r : (r & 0x3) | 0x8;
6393
+ var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
6363
6394
  return v.toString(16);
6364
6395
  });
6365
6396
  }
@@ -8338,7 +8369,7 @@
8338
8369
  };
8339
8370
  }
8340
8371
  getPasteTarget(sheetId, target, content, options) {
8341
- const newId = new UuidGenerator().uuidv4();
8372
+ const newId = new UuidGenerator().smallUuid();
8342
8373
  return { zones: [], figureId: newId, sheetId };
8343
8374
  }
8344
8375
  paste(target, clippedContent, options) {
@@ -8504,7 +8535,7 @@
8504
8535
  if (!targetCF && queuedCfs) {
8505
8536
  targetCF = queuedCfs.find((queued) => queued.cf.stopIfTrue === originCF.stopIfTrue && deepEquals(queued.cf.rule, originCF.rule))?.cf;
8506
8537
  }
8507
- return targetCF || { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
8538
+ return targetCF || { ...originCF, id: this.uuidGenerator.smallUuid(), ranges: [] };
8508
8539
  }
8509
8540
  }
8510
8541
 
@@ -8597,7 +8628,7 @@
8597
8628
  }
8598
8629
  return (targetRule || {
8599
8630
  ...originRule,
8600
- id: newId ? this.uuidGenerator.uuidv4() : originRule.id,
8631
+ id: newId ? this.uuidGenerator.smallUuid() : originRule.id,
8601
8632
  ranges: [],
8602
8633
  });
8603
8634
  }
@@ -8659,7 +8690,7 @@
8659
8690
  };
8660
8691
  }
8661
8692
  getPasteTarget(sheetId, target, content, options) {
8662
- const newId = new UuidGenerator().uuidv4();
8693
+ const newId = new UuidGenerator().smallUuid();
8663
8694
  return { sheetId, zones: [], figureId: newId };
8664
8695
  }
8665
8696
  paste(target, clippedContent, options) {
@@ -15061,7 +15092,7 @@ stores.inject(MyMetaStore, storeInstance);
15061
15092
  }
15062
15093
  }
15063
15094
  },
15064
- isExported: true,
15095
+ isExported: false,
15065
15096
  };
15066
15097
  // -----------------------------------------------------------------------------
15067
15098
  // UNIQUE
@@ -28515,17 +28546,15 @@ stores.inject(MyMetaStore, storeInstance);
28515
28546
  plugins: [],
28516
28547
  };
28517
28548
  }
28518
- function getChartLabelFormat(getters, range) {
28549
+ function getChartLabelFormat(getters, range, shouldRemoveFirstLabel) {
28519
28550
  if (!range)
28520
28551
  return undefined;
28521
- const { sheetId, zone: { left, top, bottom }, } = range;
28522
- for (let row = top; row <= bottom; row++) {
28523
- const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
28524
- if (format) {
28525
- return format;
28526
- }
28552
+ const { sheetId, zone } = range;
28553
+ const formats = positions(zone).map((position) => getters.getEvaluatedCell({ sheetId, ...position }).format);
28554
+ if (shouldRemoveFirstLabel) {
28555
+ formats.shift();
28527
28556
  }
28528
- return undefined;
28557
+ return formats.find((format) => format !== undefined);
28529
28558
  }
28530
28559
  function getChartLabelValues(getters, dataSets, labelRange) {
28531
28560
  let labels = { values: [], formattedValues: [] };
@@ -28813,9 +28842,7 @@ stores.inject(MyMetaStore, storeInstance);
28813
28842
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
28814
28843
  let labels = labelValues.formattedValues;
28815
28844
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
28816
- if (chart.dataSetsHaveTitle &&
28817
- dataSetsValues[0] &&
28818
- labels.length > dataSetsValues[0].data.length) {
28845
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
28819
28846
  labels.shift();
28820
28847
  }
28821
28848
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -29084,8 +29111,8 @@ stores.inject(MyMetaStore, storeInstance);
29084
29111
  }
29085
29112
  return { labels: newLabels, dataSetsValues: newDatasets };
29086
29113
  }
29087
- function canChartParseLabels(labelRange, getters) {
29088
- return canBeDateChart(labelRange, getters) || canBeLinearChart(labelRange, getters);
29114
+ function canChartParseLabels(chart, getters) {
29115
+ return canBeDateChart(chart, getters) || canBeLinearChart(chart, getters);
29089
29116
  }
29090
29117
  function getChartAxisType(chart, getters) {
29091
29118
  if (isDateChart(chart, getters) && isLuxonTimeAdapterInstalled()) {
@@ -29097,23 +29124,26 @@ stores.inject(MyMetaStore, storeInstance);
29097
29124
  return "category";
29098
29125
  }
29099
29126
  function isDateChart(chart, getters) {
29100
- return !chart.labelsAsText && canBeDateChart(chart.labelRange, getters);
29127
+ return !chart.labelsAsText && canBeDateChart(chart, getters);
29101
29128
  }
29102
29129
  function isLinearChart(chart, getters) {
29103
- return !chart.labelsAsText && canBeLinearChart(chart.labelRange, getters);
29130
+ return !chart.labelsAsText && canBeLinearChart(chart, getters);
29104
29131
  }
29105
- function canBeDateChart(labelRange, getters) {
29106
- if (!labelRange || !canBeLinearChart(labelRange, getters)) {
29132
+ function canBeDateChart(chart, getters) {
29133
+ if (!chart.labelRange || !canBeLinearChart(chart, getters)) {
29107
29134
  return false;
29108
29135
  }
29109
- const labelFormat = getChartLabelFormat(getters, labelRange);
29136
+ const labelFormat = getChartLabelFormat(getters, chart.labelRange, shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle));
29110
29137
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
29111
29138
  }
29112
- function canBeLinearChart(labelRange, getters) {
29113
- if (!labelRange) {
29139
+ function canBeLinearChart(chart, getters) {
29140
+ if (!chart.labelRange) {
29114
29141
  return false;
29115
29142
  }
29116
- const labels = getters.getRangeValues(labelRange);
29143
+ const labels = getters.getRangeValues(chart.labelRange);
29144
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
29145
+ labels.shift();
29146
+ }
29117
29147
  if (labels.some((label) => isNaN(Number(label)) && label)) {
29118
29148
  return false;
29119
29149
  }
@@ -29197,9 +29227,8 @@ stores.inject(MyMetaStore, storeInstance);
29197
29227
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
29198
29228
  let labels = axisType === "linear" ? labelValues.values : labelValues.formattedValues;
29199
29229
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
29200
- if (chart.dataSetsHaveTitle &&
29201
- dataSetsValues[0] &&
29202
- labels.length > dataSetsValues[0].data.length) {
29230
+ const removeFirstLabel = shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle);
29231
+ if (removeFirstLabel) {
29203
29232
  labels.shift();
29204
29233
  }
29205
29234
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -29289,12 +29318,7 @@ stores.inject(MyMetaStore, storeInstance);
29289
29318
  background: chart.background,
29290
29319
  callback: formatTickValue(options),
29291
29320
  };
29292
- if (chart.dataSetsHaveTitle &&
29293
- dataSetsValues[0] &&
29294
- labels.length > dataSetsValues[0].data.length) {
29295
- labels.shift();
29296
- }
29297
- const labelFormat = getChartLabelFormat(getters, chart.labelRange);
29321
+ const labelFormat = getChartLabelFormat(getters, chart.labelRange, removeFirstLabel);
29298
29322
  if (axisType === "time") {
29299
29323
  const axis = {
29300
29324
  type: "time",
@@ -29552,9 +29576,7 @@ stores.inject(MyMetaStore, storeInstance);
29552
29576
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
29553
29577
  let labels = labelValues.formattedValues;
29554
29578
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
29555
- if (chart.dataSetsHaveTitle &&
29556
- dataSetsValues[0] &&
29557
- labels.length > dataSetsValues[0].data.length) {
29579
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
29558
29580
  labels.shift();
29559
29581
  }
29560
29582
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -30245,9 +30267,7 @@ stores.inject(MyMetaStore, storeInstance);
30245
30267
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
30246
30268
  let labels = labelValues.formattedValues;
30247
30269
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
30248
- if (chart.dataSetsHaveTitle &&
30249
- dataSetsValues[0] &&
30250
- labels.length > dataSetsValues[0].data.length) {
30270
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
30251
30271
  labels.shift();
30252
30272
  }
30253
30273
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -30792,9 +30812,7 @@ stores.inject(MyMetaStore, storeInstance);
30792
30812
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
30793
30813
  let labels = labelValues.formattedValues;
30794
30814
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
30795
- if (chart.dataSetsHaveTitle &&
30796
- dataSetsValues[0] &&
30797
- labels.length > dataSetsValues[0].data.length) {
30815
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
30798
30816
  labels.shift();
30799
30817
  }
30800
30818
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -32290,7 +32308,7 @@ stores.inject(MyMetaStore, storeInstance);
32290
32308
  const deleteSheet = {
32291
32309
  name: _t("Delete"),
32292
32310
  isVisible: (env) => {
32293
- return env.model.getters.getSheetIds().length > 1;
32311
+ return env.model.getters.getVisibleSheetIds().length > 1;
32294
32312
  },
32295
32313
  execute: (env) => env.askConfirmation(_t("Are you sure you want to delete this sheet?"), () => {
32296
32314
  env.model.dispatch("DELETE_SHEET", { sheetId: env.model.getters.getActiveSheetId() });
@@ -32301,7 +32319,7 @@ stores.inject(MyMetaStore, storeInstance);
32301
32319
  name: _t("Duplicate"),
32302
32320
  execute: (env) => {
32303
32321
  const sheetIdFrom = env.model.getters.getActiveSheetId();
32304
- const sheetIdTo = env.model.uuidGenerator.uuidv4();
32322
+ const sheetIdTo = env.model.uuidGenerator.smallUuid();
32305
32323
  env.model.dispatch("DUPLICATE_SHEET", {
32306
32324
  sheetId: sheetIdFrom,
32307
32325
  sheetIdTo,
@@ -32928,20 +32946,21 @@ stores.inject(MyMetaStore, storeInstance);
32928
32946
  }
32929
32947
  // Only display legend for several datasets.
32930
32948
  const newLegendPos = dataSetZone.right === dataSetZone.left ? "none" : "top";
32931
- const labelRange = labelRangeXc ? getters.getRangeFromSheetXC(sheetId, labelRangeXc) : undefined;
32932
- if (canChartParseLabels(labelRange, getters)) {
32933
- return {
32934
- title: {},
32935
- dataSets,
32936
- labelsAsText: false,
32937
- stacked: false,
32938
- aggregated: false,
32939
- cumulative: false,
32940
- labelRange: labelRangeXc,
32941
- type: "line",
32942
- dataSetsHaveTitle,
32943
- legendPosition: newLegendPos,
32944
- };
32949
+ const lineChartDefinition = {
32950
+ title: {},
32951
+ dataSets,
32952
+ labelsAsText: false,
32953
+ stacked: false,
32954
+ aggregated: false,
32955
+ cumulative: false,
32956
+ labelRange: labelRangeXc,
32957
+ type: "line",
32958
+ dataSetsHaveTitle,
32959
+ legendPosition: newLegendPos,
32960
+ };
32961
+ const chart = new LineChart(lineChartDefinition, sheetId, getters);
32962
+ if (canChartParseLabels(chart, getters)) {
32963
+ return lineChartDefinition;
32945
32964
  }
32946
32965
  const _dataSets = createDataSets(getters, dataSets, sheetId, dataSetsHaveTitle);
32947
32966
  if (singleColumn &&
@@ -33309,7 +33328,7 @@ stores.inject(MyMetaStore, storeInstance);
33309
33328
  //------------------------------------------------------------------------------
33310
33329
  const CREATE_CHART = (env) => {
33311
33330
  const getters = env.model.getters;
33312
- const id = env.model.uuidGenerator.uuidv4();
33331
+ const id = env.model.uuidGenerator.smallUuid();
33313
33332
  const sheetId = getters.getActiveSheetId();
33314
33333
  if (getZoneArea(env.model.getters.getSelectedZone()) === 1) {
33315
33334
  env.model.selection.selectTableAroundSelection();
@@ -33332,8 +33351,8 @@ stores.inject(MyMetaStore, storeInstance);
33332
33351
  // Pivots
33333
33352
  //------------------------------------------------------------------------------
33334
33353
  const CREATE_PIVOT = (env) => {
33335
- const pivotId = env.model.uuidGenerator.uuidv4();
33336
- const newSheetId = env.model.uuidGenerator.uuidv4();
33354
+ const pivotId = env.model.uuidGenerator.smallUuid();
33355
+ const newSheetId = env.model.uuidGenerator.smallUuid();
33337
33356
  const result = env.model.dispatch("INSERT_NEW_PIVOT", { pivotId, newSheetId });
33338
33357
  if (result.isSuccessful) {
33339
33358
  env.openSidePanel("PivotSidePanel", { pivotId });
@@ -33392,7 +33411,7 @@ stores.inject(MyMetaStore, storeInstance);
33392
33411
  const CREATE_IMAGE = async (env) => {
33393
33412
  if (env.imageProvider) {
33394
33413
  const sheetId = env.model.getters.getActiveSheetId();
33395
- const figureId = env.model.uuidGenerator.uuidv4();
33414
+ const figureId = env.model.uuidGenerator.smallUuid();
33396
33415
  const image = await requestImage(env);
33397
33416
  if (!image) {
33398
33417
  throw new Error("No image provider was given to the environment");
@@ -33945,7 +33964,7 @@ stores.inject(MyMetaStore, storeInstance);
33945
33964
  ranges,
33946
33965
  sheetId,
33947
33966
  rule: {
33948
- id: env.model.uuidGenerator.uuidv4(),
33967
+ id: env.model.uuidGenerator.smallUuid(),
33949
33968
  criterion: {
33950
33969
  type: "isBoolean",
33951
33970
  values: [],
@@ -33961,7 +33980,7 @@ stores.inject(MyMetaStore, storeInstance);
33961
33980
  const zones = env.model.getters.getSelectedZones();
33962
33981
  const sheetId = env.model.getters.getActiveSheetId();
33963
33982
  const ranges = zones.map((zone) => env.model.getters.getRangeDataFromZone(sheetId, zone));
33964
- const ruleID = env.model.uuidGenerator.uuidv4();
33983
+ const ruleID = env.model.uuidGenerator.smallUuid();
33965
33984
  env.model.dispatch("ADD_DATA_VALIDATION_RULE", {
33966
33985
  ranges,
33967
33986
  sheetId,
@@ -33992,7 +34011,7 @@ stores.inject(MyMetaStore, storeInstance);
33992
34011
  execute: (env) => {
33993
34012
  const activeSheetId = env.model.getters.getActiveSheetId();
33994
34013
  const position = env.model.getters.getSheetIds().indexOf(activeSheetId) + 1;
33995
- const sheetId = env.model.uuidGenerator.uuidv4();
34014
+ const sheetId = env.model.uuidGenerator.smallUuid();
33996
34015
  env.model.dispatch("CREATE_SHEET", { sheetId, position });
33997
34016
  env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
33998
34017
  },
@@ -37987,7 +38006,7 @@ stores.inject(MyMetaStore, storeInstance);
37987
38006
  get canTreatLabelsAsText() {
37988
38007
  const chart = this.env.model.getters.getChart(this.props.figureId);
37989
38008
  if (chart && chart instanceof LineChart) {
37990
- return canChartParseLabels(chart.labelRange, this.env.model.getters);
38009
+ return canChartParseLabels(chart, this.env.model.getters);
37991
38010
  }
37992
38011
  return false;
37993
38012
  }
@@ -38056,7 +38075,7 @@ stores.inject(MyMetaStore, storeInstance);
38056
38075
  get canTreatLabelsAsText() {
38057
38076
  const chart = this.env.model.getters.getChart(this.props.figureId);
38058
38077
  if (chart && chart instanceof ScatterChart) {
38059
- return canChartParseLabels(chart.labelRange, this.env.model.getters);
38078
+ return canChartParseLabels(chart, this.env.model.getters);
38060
38079
  }
38061
38080
  return false;
38062
38081
  }
@@ -39871,7 +39890,7 @@ stores.inject(MyMetaStore, storeInstance);
39871
39890
  state;
39872
39891
  setup() {
39873
39892
  const cf = this.props.editedCf || {
39874
- id: this.env.model.uuidGenerator.uuidv4(),
39893
+ id: this.env.model.uuidGenerator.smallUuid(),
39875
39894
  ranges: this.env.model.getters
39876
39895
  .getSelectedZones()
39877
39896
  .map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone)),
@@ -41467,7 +41486,7 @@ stores.inject(MyMetaStore, storeInstance);
41467
41486
  .getSelectedZones()
41468
41487
  .map((zone) => zoneToXc(this.env.model.getters.getUnboundedZone(sheetId, zone)));
41469
41488
  return {
41470
- id: this.env.model.uuidGenerator.uuidv4(),
41489
+ id: this.env.model.uuidGenerator.smallUuid(),
41471
41490
  criterion: { type: "textContains", values: [""] },
41472
41491
  ranges,
41473
41492
  };
@@ -42986,8 +43005,8 @@ stores.inject(MyMetaStore, storeInstance);
42986
43005
  return this.env.model.getters.getPivotDisplayName(this.props.pivotId);
42987
43006
  }
42988
43007
  duplicatePivot() {
42989
- const newPivotId = this.env.model.uuidGenerator.uuidv4();
42990
- const newSheetId = this.env.model.uuidGenerator.uuidv4();
43008
+ const newPivotId = this.env.model.uuidGenerator.smallUuid();
43009
+ const newSheetId = this.env.model.uuidGenerator.smallUuid();
42991
43010
  const result = this.env.model.dispatch("DUPLICATE_PIVOT_IN_NEW_SHEET", {
42992
43011
  pivotId: this.props.pivotId,
42993
43012
  newPivotId,
@@ -45552,7 +45571,7 @@ stores.inject(MyMetaStore, storeInstance);
45552
45571
  this.state.selectedTemplateName = templateName;
45553
45572
  }
45554
45573
  onConfirm() {
45555
- const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.uuidv4();
45574
+ const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.smallUuid();
45556
45575
  this.env.model.dispatch("CREATE_TABLE_STYLE", {
45557
45576
  tableStyleId,
45558
45577
  tableStyleName: this.state.styleName,
@@ -54218,7 +54237,7 @@ stores.inject(MyMetaStore, storeInstance);
54218
54237
  ? "Success" /* CommandResult.Success */
54219
54238
  : "InvalidColor" /* CommandResult.InvalidColor */;
54220
54239
  case "DELETE_SHEET":
54221
- return this.orderedSheetIds.length > 1
54240
+ return this.getVisibleSheetIds().length > 1
54222
54241
  ? "Success" /* CommandResult.Success */
54223
54242
  : "NotEnoughSheets" /* CommandResult.NotEnoughSheets */;
54224
54243
  case "ADD_COLUMNS_ROWS":
@@ -55084,7 +55103,7 @@ stores.inject(MyMetaStore, storeInstance);
55084
55103
  const union = this.getters.getRangesUnion(ranges);
55085
55104
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, union.zone);
55086
55105
  this.dispatch("REMOVE_MERGE", { sheetId: cmd.sheetId, target: mergesInTarget });
55087
- const id = this.uuidGenerator.uuidv4();
55106
+ const id = this.uuidGenerator.smallUuid();
55088
55107
  const config = cmd.config || DEFAULT_TABLE_CONFIG;
55089
55108
  const newTable = cmd.tableType === "dynamic"
55090
55109
  ? this.createDynamicTable(id, union, config)
@@ -55237,7 +55256,7 @@ stores.inject(MyMetaStore, storeInstance);
55237
55256
  filters = [];
55238
55257
  for (const i of range(zone.left, zone.right + 1)) {
55239
55258
  const filterZone = { ...zone, left: i, right: i };
55240
- const uid = this.uuidGenerator.uuidv4();
55259
+ const uid = this.uuidGenerator.smallUuid();
55241
55260
  filters.push(this.createFilterFromZone(uid, tableRange.sheetId, filterZone, config));
55242
55261
  }
55243
55262
  }
@@ -55302,7 +55321,7 @@ stores.inject(MyMetaStore, storeInstance);
55302
55321
  ? table.filters.find((f) => f.col === i)
55303
55322
  : undefined;
55304
55323
  const filterZone = { ...tableZone, left: i, right: i };
55305
- const filterId = oldFilter?.id || this.uuidGenerator.uuidv4();
55324
+ const filterId = oldFilter?.id || this.uuidGenerator.smallUuid();
55306
55325
  filters.push(this.createFilterFromZone(filterId, tableRange.sheetId, filterZone, config));
55307
55326
  }
55308
55327
  }
@@ -55403,7 +55422,7 @@ stores.inject(MyMetaStore, storeInstance);
55403
55422
  if (filters.length < zoneToDimension(tableZone).numberOfCols) {
55404
55423
  for (let col = tableZone.left; col <= tableZone.right; col++) {
55405
55424
  if (!filters.find((filter) => filter.col === col)) {
55406
- const uid = this.uuidGenerator.uuidv4();
55425
+ const uid = this.uuidGenerator.smallUuid();
55407
55426
  const filterZone = { ...tableZone, left: col, right: col };
55408
55427
  filters.push(this.createFilterFromZone(uid, sheetId, filterZone, table.config));
55409
55428
  }
@@ -61603,6 +61622,15 @@ stores.inject(MyMetaStore, storeInstance);
61603
61622
  this.waitingAck = true;
61604
61623
  this.sendPendingMessage();
61605
61624
  }
61625
+ dropPendingRevision(revisionId) {
61626
+ this.revisions.drop(revisionId);
61627
+ const revisionIds = this.pendingMessages
61628
+ .filter((message) => message.type === "REMOTE_REVISION")
61629
+ .map((message) => message.nextRevisionId);
61630
+ this.trigger("pending-revisions-dropped", { revisionIds });
61631
+ this.waitingAck = false;
61632
+ this.waitingUndoRedoAck = false;
61633
+ }
61606
61634
  /**
61607
61635
  * Send the next pending message
61608
61636
  */
@@ -61617,13 +61645,7 @@ stores.inject(MyMetaStore, storeInstance);
61617
61645
  * The command is empty, we have to drop all the next local revisions
61618
61646
  * to avoid issues with undo/redo
61619
61647
  */
61620
- this.revisions.drop(revision.id);
61621
- const revisionIds = this.pendingMessages
61622
- .filter((message) => message.type === "REMOTE_REVISION")
61623
- .map((message) => message.nextRevisionId);
61624
- this.trigger("pending-revisions-dropped", { revisionIds });
61625
- this.waitingAck = false;
61626
- this.waitingUndoRedoAck = false;
61648
+ this.dropPendingRevision(revision.id);
61627
61649
  this.pendingMessages = [];
61628
61650
  return;
61629
61651
  }
@@ -61649,7 +61671,6 @@ stores.inject(MyMetaStore, storeInstance);
61649
61671
  switch (message.type) {
61650
61672
  case "REMOTE_REVISION":
61651
61673
  case "REVISION_REDONE":
61652
- case "REVISION_UNDONE":
61653
61674
  case "SNAPSHOT_CREATED":
61654
61675
  this.waitingAck = false;
61655
61676
  this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
@@ -61658,6 +61679,27 @@ stores.inject(MyMetaStore, storeInstance);
61658
61679
  this.lastRevisionMessage = message;
61659
61680
  this.sendPendingMessage();
61660
61681
  break;
61682
+ case "REVISION_UNDONE": {
61683
+ this.waitingAck = false;
61684
+ this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
61685
+ const pendingRemoteRevisions = this.pendingMessages.filter((message) => message.type === "REMOTE_REVISION");
61686
+ const firstTransformedRevisionIndex = pendingRemoteRevisions.findIndex((message) => !deepEquals(message.commands, this.revisions.get(message.nextRevisionId).commands));
61687
+ if (firstTransformedRevisionIndex !== -1) {
61688
+ /**
61689
+ * Some revisions undergo transformations that may cause issues with
61690
+ * undo/redo if the transformation is destructive (we don't get back
61691
+ * the original command by transforming it with the inverse).
61692
+ * To prevent these problems, we must discard all subsequent local
61693
+ * revisions.
61694
+ */
61695
+ this.dropPendingRevision(this.pendingMessages[firstTransformedRevisionIndex].nextRevisionId);
61696
+ this.pendingMessages = this.pendingMessages.slice(0, firstTransformedRevisionIndex);
61697
+ }
61698
+ this.serverRevisionId = message.nextRevisionId;
61699
+ this.processedRevisions.add(message.nextRevisionId);
61700
+ this.sendPendingMessage();
61701
+ break;
61702
+ }
61661
61703
  }
61662
61704
  }
61663
61705
  isAlreadyProcessed(message) {
@@ -63089,23 +63131,23 @@ stores.inject(MyMetaStore, storeInstance);
63089
63131
  function repeatCreateChartCommand(getters, cmd) {
63090
63132
  return {
63091
63133
  ...repeatSheetDependantCommand(getters, cmd),
63092
- id: uuidGenerator.uuidv4(),
63134
+ id: uuidGenerator.smallUuid(),
63093
63135
  };
63094
63136
  }
63095
63137
  function repeatCreateImageCommand(getters, cmd) {
63096
63138
  return {
63097
63139
  ...repeatSheetDependantCommand(getters, cmd),
63098
- figureId: uuidGenerator.uuidv4(),
63140
+ figureId: uuidGenerator.smallUuid(),
63099
63141
  };
63100
63142
  }
63101
63143
  function repeatCreateFigureCommand(getters, cmd) {
63102
63144
  const newCmd = repeatSheetDependantCommand(getters, cmd);
63103
- newCmd.figure.id = uuidGenerator.uuidv4();
63145
+ newCmd.figure.id = uuidGenerator.smallUuid();
63104
63146
  return newCmd;
63105
63147
  }
63106
63148
  function repeatCreateSheetCommand(getters, cmd) {
63107
63149
  const newCmd = deepCopy(cmd);
63108
- newCmd.sheetId = uuidGenerator.uuidv4();
63150
+ newCmd.sheetId = uuidGenerator.smallUuid();
63109
63151
  const sheetName = cmd.name || getters.getSheet(getters.getActiveSheetId()).name;
63110
63152
  // Extract the prefix of the sheet name (everything before the number at the end of the name)
63111
63153
  const namePrefix = sheetName.match(/(.+?)\d*$/)?.[1] || sheetName;
@@ -64568,23 +64610,7 @@ stores.inject(MyMetaStore, storeInstance);
64568
64610
  gridSelection: deepCopy(gridSelection),
64569
64611
  };
64570
64612
  }
64571
- if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
64572
- const currentSheetIds = this.getters.getVisibleSheetIds();
64573
- this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
64574
- if (this.activeSheet.id in this.sheetsData) {
64575
- const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
64576
- this.selectCell(anchor.cell.col, anchor.cell.row);
64577
- }
64578
- else {
64579
- this.selectCell(0, 0);
64580
- }
64581
- const { col, row } = this.gridSelection.anchor.cell;
64582
- this.moveClient({
64583
- sheetId: this.getters.getActiveSheetId(),
64584
- col,
64585
- row,
64586
- });
64587
- }
64613
+ this.fallbackToVisibleSheet();
64588
64614
  const sheetId = this.getters.getActiveSheetId();
64589
64615
  this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
64590
64616
  this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
@@ -64594,6 +64620,7 @@ stores.inject(MyMetaStore, storeInstance);
64594
64620
  }
64595
64621
  }
64596
64622
  finalize() {
64623
+ this.fallbackToVisibleSheet();
64597
64624
  /** Any change to the selection has to be reflected in the selection processor. */
64598
64625
  this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
64599
64626
  }
@@ -64897,6 +64924,25 @@ stores.inject(MyMetaStore, storeInstance);
64897
64924
  }
64898
64925
  return "Success" /* CommandResult.Success */;
64899
64926
  }
64927
+ fallbackToVisibleSheet() {
64928
+ if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
64929
+ const currentSheetIds = this.getters.getVisibleSheetIds();
64930
+ this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
64931
+ if (this.activeSheet.id in this.sheetsData) {
64932
+ const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
64933
+ this.selectCell(anchor.cell.col, anchor.cell.row);
64934
+ }
64935
+ else {
64936
+ this.selectCell(0, 0);
64937
+ }
64938
+ const { col, row } = this.gridSelection.anchor.cell;
64939
+ this.moveClient({
64940
+ sheetId: this.getters.getActiveSheetId(),
64941
+ col,
64942
+ row,
64943
+ });
64944
+ }
64945
+ }
64900
64946
  //-------------------------------------------
64901
64947
  // Helpers for extensions
64902
64948
  // ------------------------------------------
@@ -66899,7 +66945,7 @@ stores.inject(MyMetaStore, storeInstance);
66899
66945
  clickAddSheet(ev) {
66900
66946
  const activeSheetId = this.env.model.getters.getActiveSheetId();
66901
66947
  const position = this.env.model.getters.getSheetIds().findIndex((sheetId) => sheetId === activeSheetId) + 1;
66902
- const sheetId = this.env.model.uuidGenerator.uuidv4();
66948
+ const sheetId = this.env.model.uuidGenerator.smallUuid();
66903
66949
  const name = this.env.model.getters.getNextSheetName(_t("Sheet"));
66904
66950
  this.env.model.dispatch("CREATE_SHEET", { sheetId, position, name });
66905
66951
  this.env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
@@ -67987,7 +68033,7 @@ stores.inject(MyMetaStore, storeInstance);
67987
68033
  .o-font-size-editor {
67988
68034
  height: calc(100% - 4px);
67989
68035
  input.o-font-size {
67990
- outline-color: ${SELECTION_BORDER_COLOR};
68036
+ outline: none;
67991
68037
  height: 20px;
67992
68038
  width: 23px;
67993
68039
  }
@@ -69274,7 +69320,7 @@ stores.inject(MyMetaStore, storeInstance);
69274
69320
  }
69275
69321
  /**
69276
69322
  * Drop the operation and all following operations in every
69277
- * branch
69323
+ * branches
69278
69324
  */
69279
69325
  drop(operationId) {
69280
69326
  for (const branch of this.branches) {
@@ -72651,7 +72697,7 @@ stores.inject(MyMetaStore, storeInstance);
72651
72697
  }
72652
72698
  setupConfig(config) {
72653
72699
  const client = config.client || {
72654
- id: this.uuidGenerator.uuidv4(),
72700
+ id: this.uuidGenerator.smallUuid(),
72655
72701
  name: _t("Anonymous").toString(),
72656
72702
  };
72657
72703
  const transportService = config.transportService || new LocalTransportService();
@@ -73181,9 +73227,9 @@ stores.inject(MyMetaStore, storeInstance);
73181
73227
  exports.tokenize = tokenize;
73182
73228
 
73183
73229
 
73184
- __info__.version = "18.0.15";
73185
- __info__.date = "2025-02-10T08:59:22.993Z";
73186
- __info__.hash = "5b19f88";
73230
+ __info__.version = "18.0.16";
73231
+ __info__.date = "2025-02-14T08:44:19.475Z";
73232
+ __info__.hash = "39979ab";
73187
73233
 
73188
73234
 
73189
73235
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);