@odoo/o-spreadsheet 17.4.21 → 17.4.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.4.21
6
- * @date 2025-02-05T06:46:54.366Z
7
- * @hash 0c55e18
5
+ * @version 17.4.23
6
+ * @date 2025-02-14T08:37:12.219Z
7
+ * @hash 8339907
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';
@@ -746,9 +746,16 @@ function deepEqualsArray(arr1, arr2) {
746
746
  }
747
747
  return true;
748
748
  }
749
- /** Check if the given array contains all the values of the other array. */
749
+ /**
750
+ * Check if the given array contains all the values of the other array.
751
+ * It makes the assumption that both array do not contain duplicates.
752
+ */
750
753
  function includesAll(arr, values) {
751
- return values.every((value) => arr.includes(value));
754
+ if (arr.length < values.length) {
755
+ return false;
756
+ }
757
+ const set = new Set(arr);
758
+ return values.every((value) => set.has(value));
752
759
  }
753
760
  /**
754
761
  * Return an object with all the keys in the object that have a falsy value removed.
@@ -5491,6 +5498,37 @@ class UuidGenerator {
5491
5498
  setIsFastStrategy(isFast) {
5492
5499
  this.isFastIdStrategy = isFast;
5493
5500
  }
5501
+ /**
5502
+ * Generates a custom UUID using a simple 36^12 method (8-character alphanumeric string with lowercase letters)
5503
+ * This has a higher chance of collision than a UUIDv4, but not only faster to generate than an UUIDV4,
5504
+ * it also has a smaller size, which is preferable to alleviate the overall data size.
5505
+ *
5506
+ * This method is preferable when generating uuids for the core data (sheetId, figureId, etc)
5507
+ * as they will appear several times in the revisions and local history.
5508
+ *
5509
+ */
5510
+ smallUuid() {
5511
+ if (this.isFastIdStrategy) {
5512
+ this.fastIdStart++;
5513
+ return String(this.fastIdStart);
5514
+ //@ts-ignore
5515
+ }
5516
+ else if (window.crypto && window.crypto.getRandomValues) {
5517
+ //@ts-ignore
5518
+ return ([1e7] + -1e3).replace(/[018]/g, (c) => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16));
5519
+ }
5520
+ else {
5521
+ // mainly for jest and other browsers that do not have the crypto functionality
5522
+ return "xxxxxxxx-xxxx".replace(/[xy]/g, function (c) {
5523
+ var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
5524
+ return v.toString(16);
5525
+ });
5526
+ }
5527
+ }
5528
+ /**
5529
+ * Generates an UUIDV4, has astronomically low chance of collision, but is larger in size than the smallUuid.
5530
+ * This method should be used when you need to avoid collisions at all costs, like the id of a revision.
5531
+ */
5494
5532
  uuidv4() {
5495
5533
  if (this.isFastIdStrategy) {
5496
5534
  this.fastIdStart++;
@@ -5504,7 +5542,7 @@ class UuidGenerator {
5504
5542
  else {
5505
5543
  // mainly for jest and other browsers that do not have the crypto functionality
5506
5544
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
5507
- var r = (Math.random() * 16) | 0, v = c === "x" ? r : (r & 0x3) | 0x8;
5545
+ var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
5508
5546
  return v.toString(16);
5509
5547
  });
5510
5548
  }
@@ -6891,7 +6929,7 @@ class ChartClipboardHandler extends AbstractFigureClipboardHandler {
6891
6929
  };
6892
6930
  }
6893
6931
  getPasteTarget(sheetId, target, content, options) {
6894
- const newId = new UuidGenerator().uuidv4();
6932
+ const newId = new UuidGenerator().smallUuid();
6895
6933
  return { zones: [], figureId: newId, sheetId };
6896
6934
  }
6897
6935
  paste(target, clippedContent, options) {
@@ -7033,7 +7071,9 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
7033
7071
  const cfInTarget = this.getters
7034
7072
  .getConditionalFormats(targetSheetId)
7035
7073
  .find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
7036
- return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
7074
+ return cfInTarget
7075
+ ? cfInTarget
7076
+ : { ...originCF, id: this.uuidGenerator.smallUuid(), ranges: [] };
7037
7077
  }
7038
7078
  }
7039
7079
 
@@ -7118,7 +7158,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
7118
7158
  originRule.isBlocking === rule.isBlocking);
7119
7159
  return ruleInTargetSheet
7120
7160
  ? ruleInTargetSheet
7121
- : { ...originRule, id: newId ? this.uuidGenerator.uuidv4() : originRule.id, ranges: [] };
7161
+ : { ...originRule, id: newId ? this.uuidGenerator.smallUuid() : originRule.id, ranges: [] };
7122
7162
  }
7123
7163
  /**
7124
7164
  * Add or remove XCs to a given data validation rule.
@@ -7159,7 +7199,7 @@ class ImageClipboardHandler extends AbstractFigureClipboardHandler {
7159
7199
  };
7160
7200
  }
7161
7201
  getPasteTarget(sheetId, target, content, options) {
7162
- const newId = new UuidGenerator().uuidv4();
7202
+ const newId = new UuidGenerator().smallUuid();
7163
7203
  return { sheetId, zones: [], figureId: newId };
7164
7204
  }
7165
7205
  paste(target, clippedContent, options) {
@@ -13028,6 +13068,25 @@ const LN = {
13028
13068
  isExported: true,
13029
13069
  };
13030
13070
  // -----------------------------------------------------------------------------
13071
+ // LOG
13072
+ // -----------------------------------------------------------------------------
13073
+ const LOG = {
13074
+ description: _t("The logarithm of a number, for a given base."),
13075
+ args: [
13076
+ arg("value (number)", _t("The value for which to calculate the logarithm.")),
13077
+ arg("base (number, default=10)", _t("The base of the logarithm.")),
13078
+ ],
13079
+ compute: function (value, base = { value: 10 }) {
13080
+ const _value = toNumber(value, this.locale);
13081
+ const _base = toNumber(base, this.locale);
13082
+ assert(() => _value > 0, _t("The value (%s) must be strictly positive.", _value.toString()));
13083
+ assert(() => _base > 0, _t("The base (%s) must be strictly positive.", _base.toString()));
13084
+ assert(() => _base !== 1, _t("The base must be different from 1."));
13085
+ return Math.log10(_value) / Math.log10(_base);
13086
+ },
13087
+ isExported: true,
13088
+ };
13089
+ // -----------------------------------------------------------------------------
13031
13090
  // MOD
13032
13091
  // -----------------------------------------------------------------------------
13033
13092
  function mod(dividend, divisor) {
@@ -13541,6 +13600,7 @@ var math = /*#__PURE__*/Object.freeze({
13541
13600
  ISODD: ISODD,
13542
13601
  ISO_CEILING: ISO_CEILING,
13543
13602
  LN: LN,
13603
+ LOG: LOG,
13544
13604
  MOD: MOD,
13545
13605
  MUNIT: MUNIT,
13546
13606
  ODD: ODD,
@@ -16249,7 +16309,7 @@ const SORTN = {
16249
16309
  }
16250
16310
  }
16251
16311
  },
16252
- isExported: true,
16312
+ isExported: false,
16253
16313
  };
16254
16314
  // -----------------------------------------------------------------------------
16255
16315
  // UNIQUE
@@ -23515,17 +23575,15 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
23515
23575
  plugins: [],
23516
23576
  };
23517
23577
  }
23518
- function getChartLabelFormat(getters, range) {
23578
+ function getChartLabelFormat(getters, range, shouldRemoveFirstLabel) {
23519
23579
  if (!range)
23520
23580
  return undefined;
23521
- const { sheetId, zone: { left, top, bottom }, } = range;
23522
- for (let row = top; row <= bottom; row++) {
23523
- const format = getters.getEvaluatedCell({ sheetId, col: left, row }).format;
23524
- if (format) {
23525
- return format;
23526
- }
23581
+ const { sheetId, zone } = range;
23582
+ const formats = positions(zone).map((position) => getters.getEvaluatedCell({ sheetId, ...position }).format);
23583
+ if (shouldRemoveFirstLabel) {
23584
+ formats.shift();
23527
23585
  }
23528
- return undefined;
23586
+ return formats.find((format) => format !== undefined);
23529
23587
  }
23530
23588
  function getChartLabelValues(getters, dataSets, labelRange) {
23531
23589
  let labels = { values: [], formattedValues: [] };
@@ -23863,9 +23921,7 @@ function createBarChartRuntime(chart, getters) {
23863
23921
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
23864
23922
  let labels = labelValues.formattedValues;
23865
23923
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
23866
- if (chart.dataSetsHaveTitle &&
23867
- dataSetsValues[0] &&
23868
- labels.length > dataSetsValues[0].data.length) {
23924
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
23869
23925
  labels.shift();
23870
23926
  }
23871
23927
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -24042,8 +24098,8 @@ function fixEmptyLabelsForDateCharts(labels, dataSetsValues) {
24042
24098
  }
24043
24099
  return { labels: newLabels, dataSetsValues: newDatasets };
24044
24100
  }
24045
- function canChartParseLabels(labelRange, getters) {
24046
- return canBeDateChart(labelRange, getters) || canBeLinearChart(labelRange, getters);
24101
+ function canChartParseLabels(chart, getters) {
24102
+ return canBeDateChart(chart, getters) || canBeLinearChart(chart, getters);
24047
24103
  }
24048
24104
  function getChartAxisType(chart, getters) {
24049
24105
  if (isDateChart(chart, getters) && isLuxonTimeAdapterInstalled()) {
@@ -24055,23 +24111,26 @@ function getChartAxisType(chart, getters) {
24055
24111
  return "category";
24056
24112
  }
24057
24113
  function isDateChart(chart, getters) {
24058
- return !chart.labelsAsText && canBeDateChart(chart.labelRange, getters);
24114
+ return !chart.labelsAsText && canBeDateChart(chart, getters);
24059
24115
  }
24060
24116
  function isLinearChart(chart, getters) {
24061
- return !chart.labelsAsText && canBeLinearChart(chart.labelRange, getters);
24117
+ return !chart.labelsAsText && canBeLinearChart(chart, getters);
24062
24118
  }
24063
- function canBeDateChart(labelRange, getters) {
24064
- if (!labelRange || !canBeLinearChart(labelRange, getters)) {
24119
+ function canBeDateChart(chart, getters) {
24120
+ if (!chart.labelRange || !canBeLinearChart(chart, getters)) {
24065
24121
  return false;
24066
24122
  }
24067
- const labelFormat = getChartLabelFormat(getters, labelRange);
24123
+ const labelFormat = getChartLabelFormat(getters, chart.labelRange, shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle));
24068
24124
  return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
24069
24125
  }
24070
- function canBeLinearChart(labelRange, getters) {
24071
- if (!labelRange) {
24126
+ function canBeLinearChart(chart, getters) {
24127
+ if (!chart.labelRange) {
24072
24128
  return false;
24073
24129
  }
24074
- const labels = getters.getRangeValues(labelRange);
24130
+ const labels = getters.getRangeValues(chart.labelRange);
24131
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
24132
+ labels.shift();
24133
+ }
24075
24134
  if (labels.some((label) => isNaN(Number(label)) && label)) {
24076
24135
  return false;
24077
24136
  }
@@ -24174,9 +24233,8 @@ function createLineOrScatterChartRuntime(chart, getters) {
24174
24233
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
24175
24234
  let labels = axisType === "linear" ? labelValues.values : labelValues.formattedValues;
24176
24235
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
24177
- if (chart.dataSetsHaveTitle &&
24178
- dataSetsValues[0] &&
24179
- labels.length > dataSetsValues[0].data.length) {
24236
+ const removeFirstLabel = shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle);
24237
+ if (removeFirstLabel) {
24180
24238
  labels.shift();
24181
24239
  }
24182
24240
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -24191,7 +24249,7 @@ function createLineOrScatterChartRuntime(chart, getters) {
24191
24249
  const dataSetFormat = getChartDatasetFormat(getters, chart.dataSets);
24192
24250
  const options = { format: dataSetFormat, locale, truncateLabels };
24193
24251
  const config = getLineOrScatterConfiguration(chart, labels, options);
24194
- const labelFormat = getChartLabelFormat(getters, chart.labelRange);
24252
+ const labelFormat = getChartLabelFormat(getters, chart.labelRange, removeFirstLabel);
24195
24253
  if (axisType === "time") {
24196
24254
  const axis = {
24197
24255
  type: "time",
@@ -24405,9 +24463,7 @@ function createComboChartRuntime(chart, getters) {
24405
24463
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
24406
24464
  let labels = labelValues.formattedValues;
24407
24465
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
24408
- if (chart.dataSetsHaveTitle &&
24409
- dataSetsValues[0] &&
24410
- labels.length > dataSetsValues[0].data.length) {
24466
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
24411
24467
  labels.shift();
24412
24468
  }
24413
24469
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -25060,9 +25116,7 @@ function createPieChartRuntime(chart, getters) {
25060
25116
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
25061
25117
  let labels = labelValues.formattedValues;
25062
25118
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
25063
- if (chart.dataSetsHaveTitle &&
25064
- dataSetsValues[0] &&
25065
- labels.length > dataSetsValues[0].data.length) {
25119
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
25066
25120
  labels.shift();
25067
25121
  }
25068
25122
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -25610,9 +25664,7 @@ function createWaterfallChartRuntime(chart, getters) {
25610
25664
  const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
25611
25665
  let labels = labelValues.formattedValues;
25612
25666
  let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
25613
- if (chart.dataSetsHaveTitle &&
25614
- dataSetsValues[0] &&
25615
- labels.length > dataSetsValues[0].data.length) {
25667
+ if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
25616
25668
  labels.shift();
25617
25669
  }
25618
25670
  ({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
@@ -27130,7 +27182,7 @@ const linkSheet = {
27130
27182
  const deleteSheet = {
27131
27183
  name: _t("Delete"),
27132
27184
  isVisible: (env) => {
27133
- return env.model.getters.getSheetIds().length > 1;
27185
+ return env.model.getters.getVisibleSheetIds().length > 1;
27134
27186
  },
27135
27187
  execute: (env) => env.askConfirmation(_t("Are you sure you want to delete this sheet?"), () => {
27136
27188
  env.model.dispatch("DELETE_SHEET", { sheetId: env.model.getters.getActiveSheetId() });
@@ -27140,7 +27192,7 @@ const duplicateSheet = {
27140
27192
  name: _t("Duplicate"),
27141
27193
  execute: (env) => {
27142
27194
  const sheetIdFrom = env.model.getters.getActiveSheetId();
27143
- const sheetIdTo = env.model.uuidGenerator.uuidv4();
27195
+ const sheetIdTo = env.model.uuidGenerator.smallUuid();
27144
27196
  env.model.dispatch("DUPLICATE_SHEET", {
27145
27197
  sheetId: sheetIdFrom,
27146
27198
  sheetIdTo,
@@ -27755,20 +27807,21 @@ function getSmartChartDefinition(zone, getters) {
27755
27807
  }
27756
27808
  // Only display legend for several datasets.
27757
27809
  const newLegendPos = dataSetZone.right === dataSetZone.left ? "none" : "top";
27758
- const labelRange = labelRangeXc ? getters.getRangeFromSheetXC(sheetId, labelRangeXc) : undefined;
27759
- if (canChartParseLabels(labelRange, getters)) {
27760
- return {
27761
- title: {},
27762
- dataSets,
27763
- labelsAsText: false,
27764
- stacked: false,
27765
- aggregated: false,
27766
- cumulative: false,
27767
- labelRange: labelRangeXc,
27768
- type: "line",
27769
- dataSetsHaveTitle,
27770
- legendPosition: newLegendPos,
27771
- };
27810
+ const lineChartDefinition = {
27811
+ title: {},
27812
+ dataSets,
27813
+ labelsAsText: false,
27814
+ stacked: false,
27815
+ aggregated: false,
27816
+ cumulative: false,
27817
+ labelRange: labelRangeXc,
27818
+ type: "line",
27819
+ dataSetsHaveTitle,
27820
+ legendPosition: newLegendPos,
27821
+ };
27822
+ const chart = new LineChart(lineChartDefinition, sheetId, getters);
27823
+ if (canChartParseLabels(chart, getters)) {
27824
+ return lineChartDefinition;
27772
27825
  }
27773
27826
  const _dataSets = createDataSets(getters, dataSets, sheetId, dataSetsHaveTitle);
27774
27827
  if (singleColumn &&
@@ -28462,7 +28515,7 @@ const HIDE_ROWS_NAME = (env) => {
28462
28515
  //------------------------------------------------------------------------------
28463
28516
  const CREATE_CHART = (env) => {
28464
28517
  const getters = env.model.getters;
28465
- const id = env.model.uuidGenerator.uuidv4();
28518
+ const id = env.model.uuidGenerator.smallUuid();
28466
28519
  const sheetId = getters.getActiveSheetId();
28467
28520
  if (getZoneArea(env.model.getters.getSelectedZone()) === 1) {
28468
28521
  env.model.selection.selectTableAroundSelection();
@@ -28485,8 +28538,8 @@ const CREATE_CHART = (env) => {
28485
28538
  // Pivots
28486
28539
  //------------------------------------------------------------------------------
28487
28540
  const CREATE_PIVOT = (env) => {
28488
- const pivotId = env.model.uuidGenerator.uuidv4();
28489
- const newSheetId = env.model.uuidGenerator.uuidv4();
28541
+ const pivotId = env.model.uuidGenerator.smallUuid();
28542
+ const newSheetId = env.model.uuidGenerator.smallUuid();
28490
28543
  const result = env.model.dispatch("INSERT_NEW_PIVOT", { pivotId, newSheetId });
28491
28544
  if (result.isSuccessful) {
28492
28545
  env.openSidePanel("PivotSidePanel", { pivotId });
@@ -28545,7 +28598,7 @@ async function requestImage(env) {
28545
28598
  const CREATE_IMAGE = async (env) => {
28546
28599
  if (env.imageProvider) {
28547
28600
  const sheetId = env.model.getters.getActiveSheetId();
28548
- const figureId = env.model.uuidGenerator.uuidv4();
28601
+ const figureId = env.model.uuidGenerator.smallUuid();
28549
28602
  const image = await requestImage(env);
28550
28603
  if (!image) {
28551
28604
  throw new Error("No image provider was given to the environment");
@@ -29098,7 +29151,7 @@ const insertCheckbox = {
29098
29151
  ranges,
29099
29152
  sheetId,
29100
29153
  rule: {
29101
- id: env.model.uuidGenerator.uuidv4(),
29154
+ id: env.model.uuidGenerator.smallUuid(),
29102
29155
  criterion: {
29103
29156
  type: "isBoolean",
29104
29157
  values: [],
@@ -29114,7 +29167,7 @@ const insertDropdown = {
29114
29167
  const zones = env.model.getters.getSelectedZones();
29115
29168
  const sheetId = env.model.getters.getActiveSheetId();
29116
29169
  const ranges = zones.map((zone) => env.model.getters.getRangeDataFromZone(sheetId, zone));
29117
- const ruleID = env.model.uuidGenerator.uuidv4();
29170
+ const ruleID = env.model.uuidGenerator.smallUuid();
29118
29171
  env.model.dispatch("ADD_DATA_VALIDATION_RULE", {
29119
29172
  ranges,
29120
29173
  sheetId,
@@ -29145,7 +29198,7 @@ const insertSheet = {
29145
29198
  execute: (env) => {
29146
29199
  const activeSheetId = env.model.getters.getActiveSheetId();
29147
29200
  const position = env.model.getters.getSheetIds().indexOf(activeSheetId) + 1;
29148
- const sheetId = env.model.uuidGenerator.uuidv4();
29201
+ const sheetId = env.model.uuidGenerator.smallUuid();
29149
29202
  env.model.dispatch("CREATE_SHEET", { sheetId, position });
29150
29203
  env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
29151
29204
  },
@@ -32844,7 +32897,7 @@ class LineConfigPanel extends GenericChartConfigPanel {
32844
32897
  get canTreatLabelsAsText() {
32845
32898
  const chart = this.env.model.getters.getChart(this.props.figureId);
32846
32899
  if (chart && chart instanceof LineChart) {
32847
- return canChartParseLabels(chart.labelRange, this.env.model.getters);
32900
+ return canChartParseLabels(chart, this.env.model.getters);
32848
32901
  }
32849
32902
  return false;
32850
32903
  }
@@ -32916,7 +32969,7 @@ class ScatterConfigPanel extends GenericChartConfigPanel {
32916
32969
  get canTreatLabelsAsText() {
32917
32970
  const chart = this.env.model.getters.getChart(this.props.figureId);
32918
32971
  if (chart && chart instanceof ScatterChart) {
32919
- return canChartParseLabels(chart.labelRange, this.env.model.getters);
32972
+ return canChartParseLabels(chart, this.env.model.getters);
32920
32973
  }
32921
32974
  return false;
32922
32975
  }
@@ -33545,8 +33598,8 @@ function useDragAndDropListItems() {
33545
33598
  document.body.style.cursor = "move";
33546
33599
  state.draggedItemId = args.draggedItemId;
33547
33600
  const container = direction === "horizontal"
33548
- ? new HorizontalContainer(args.containerEl)
33549
- : new VerticalContainer(args.containerEl);
33601
+ ? new HorizontalContainer(args.scrollableContainerEl)
33602
+ : new VerticalContainer(args.scrollableContainerEl);
33550
33603
  dndHelper = new DOMDndHelper({
33551
33604
  ...args,
33552
33605
  container,
@@ -33557,8 +33610,8 @@ function useDragAndDropListItems() {
33557
33610
  const stopListening = startDnd(dndHelper.onMouseMove.bind(dndHelper), dndHelper.onMouseUp.bind(dndHelper));
33558
33611
  cleanupFns.push(stopListening);
33559
33612
  const onScroll = dndHelper.onScroll.bind(dndHelper);
33560
- args.containerEl.addEventListener("scroll", onScroll);
33561
- cleanupFns.push(() => args.containerEl.removeEventListener("scroll", onScroll));
33613
+ args.scrollableContainerEl.addEventListener("scroll", onScroll);
33614
+ cleanupFns.push(() => args.scrollableContainerEl.removeEventListener("scroll", onScroll));
33562
33615
  cleanupFns.push(dndHelper.destroy.bind(dndHelper));
33563
33616
  };
33564
33617
  onWillUnmount(() => {
@@ -34006,7 +34059,7 @@ class ConditionalFormatPreviewList extends Component {
34006
34059
  draggedItemId: cf.id,
34007
34060
  initialMousePosition: event.clientY,
34008
34061
  items: items,
34009
- containerEl: this.cfListRef.el,
34062
+ scrollableContainerEl: this.cfListRef.el,
34010
34063
  onDragEnd: (cfId, finalIndex) => this.onDragEnd(cfId, finalIndex),
34011
34064
  });
34012
34065
  }
@@ -34215,7 +34268,7 @@ class ConditionalFormattingEditor extends Component {
34215
34268
  state;
34216
34269
  setup() {
34217
34270
  const cf = this.props.editedCf || {
34218
- id: this.env.model.uuidGenerator.uuidv4(),
34271
+ id: this.env.model.uuidGenerator.smallUuid(),
34219
34272
  ranges: this.env.model.getters
34220
34273
  .getSelectedZones()
34221
34274
  .map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone)),
@@ -35187,7 +35240,7 @@ class DataValidationEditor extends Component {
35187
35240
  .getSelectedZones()
35188
35241
  .map((zone) => zoneToXc(this.env.model.getters.getUnboundedZone(sheetId, zone)));
35189
35242
  return {
35190
- id: this.env.model.uuidGenerator.uuidv4(),
35243
+ id: this.env.model.uuidGenerator.smallUuid(),
35191
35244
  criterion: { type: "textContains", values: [""] },
35192
35245
  ranges,
35193
35246
  };
@@ -36018,6 +36071,7 @@ class PivotLayoutConfigurator extends Component {
36018
36071
  unusedMeasureFields: Array,
36019
36072
  unusedDateTimeGranularities: Object,
36020
36073
  allGranularities: Array,
36074
+ getScrollableContainerEl: { type: Function, optional: true },
36021
36075
  };
36022
36076
  dimensionsRef = useRef("pivot-dimensions");
36023
36077
  dragAndDrop = useDragAndDropListItems();
@@ -36046,7 +36100,7 @@ class PivotLayoutConfigurator extends Component {
36046
36100
  draggedItemId: dimension.nameWithGranularity,
36047
36101
  initialMousePosition: event.clientY,
36048
36102
  items: draggableItems,
36049
- containerEl: this.dimensionsRef.el,
36103
+ scrollableContainerEl: this.props.getScrollableContainerEl?.() || this.dimensionsRef.el,
36050
36104
  onDragEnd: (dimensionName, finalIndex) => {
36051
36105
  const originalIndex = draggableIds.findIndex((id) => id === dimensionName);
36052
36106
  if (originalIndex === finalIndex) {
@@ -36086,7 +36140,7 @@ class PivotLayoutConfigurator extends Component {
36086
36140
  draggedItemId: measure.name,
36087
36141
  initialMousePosition: event.clientY,
36088
36142
  items: draggableItems,
36089
- containerEl: this.dimensionsRef.el,
36143
+ scrollableContainerEl: this.props.getScrollableContainerEl?.() || this.dimensionsRef.el,
36090
36144
  onDragEnd: (measureName, finalIndex) => {
36091
36145
  const originalIndex = draggableIds.findIndex((id) => id === measureName);
36092
36146
  if (originalIndex === finalIndex) {
@@ -36305,8 +36359,8 @@ class PivotTitleSection extends Component {
36305
36359
  return this.env.model.getters.getPivotDisplayName(this.props.pivotId);
36306
36360
  }
36307
36361
  duplicatePivot() {
36308
- const newPivotId = this.env.model.uuidGenerator.uuidv4();
36309
- const newSheetId = this.env.model.uuidGenerator.uuidv4();
36362
+ const newPivotId = this.env.model.uuidGenerator.smallUuid();
36363
+ const newSheetId = this.env.model.uuidGenerator.smallUuid();
36310
36364
  const result = this.env.model.dispatch("DUPLICATE_PIVOT_IN_NEW_SHEET", {
36311
36365
  pivotId: this.props.pivotId,
36312
36366
  newPivotId,
@@ -37525,6 +37579,7 @@ class PivotSpreadsheetSidePanel extends Component {
37525
37579
  };
37526
37580
  store;
37527
37581
  state;
37582
+ pivotSidePanelRef = useRef("pivotSidePanel");
37528
37583
  setup() {
37529
37584
  this.store = useLocalStore(PivotSidePanelStore, this.props.pivotId);
37530
37585
  this.state = useState({
@@ -37553,6 +37608,9 @@ class PivotSpreadsheetSidePanel extends Component {
37553
37608
  get definition() {
37554
37609
  return this.store.definition;
37555
37610
  }
37611
+ getScrollableContainerEl() {
37612
+ return this.pivotSidePanelRef.el;
37613
+ }
37556
37614
  onSelectionChanged(ranges) {
37557
37615
  this.state.rangeHasChanged = true;
37558
37616
  this.state.range = ranges[0];
@@ -38631,7 +38689,7 @@ class TableStyleEditorPanel extends Component {
38631
38689
  this.state.selectedTemplateName = templateName;
38632
38690
  }
38633
38691
  onConfirm() {
38634
- const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.uuidv4();
38692
+ const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.smallUuid();
38635
38693
  this.env.model.dispatch("CREATE_TABLE_STYLE", {
38636
38694
  tableStyleId,
38637
38695
  tableStyleName: this.state.styleName,
@@ -50912,7 +50970,7 @@ class SheetPlugin extends CorePlugin {
50912
50970
  case "RENAME_SHEET":
50913
50971
  return this.isRenameAllowed(cmd);
50914
50972
  case "DELETE_SHEET":
50915
- return this.orderedSheetIds.length > 1
50973
+ return this.getVisibleSheetIds().length > 1
50916
50974
  ? "Success" /* CommandResult.Success */
50917
50975
  : "NotEnoughSheets" /* CommandResult.NotEnoughSheets */;
50918
50976
  case "ADD_COLUMNS_ROWS":
@@ -51769,7 +51827,7 @@ class TablePlugin extends CorePlugin {
51769
51827
  const union = this.getters.getRangesUnion(ranges);
51770
51828
  const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, union.zone);
51771
51829
  this.dispatch("REMOVE_MERGE", { sheetId: cmd.sheetId, target: mergesInTarget });
51772
- const id = this.uuidGenerator.uuidv4();
51830
+ const id = this.uuidGenerator.smallUuid();
51773
51831
  const config = cmd.config || DEFAULT_TABLE_CONFIG;
51774
51832
  const newTable = cmd.tableType === "dynamic"
51775
51833
  ? this.createDynamicTable(id, union, config)
@@ -51922,7 +51980,7 @@ class TablePlugin extends CorePlugin {
51922
51980
  filters = [];
51923
51981
  for (const i of range(zone.left, zone.right + 1)) {
51924
51982
  const filterZone = { ...zone, left: i, right: i };
51925
- const uid = this.uuidGenerator.uuidv4();
51983
+ const uid = this.uuidGenerator.smallUuid();
51926
51984
  filters.push(this.createFilterFromZone(uid, tableRange.sheetId, filterZone, config));
51927
51985
  }
51928
51986
  }
@@ -51987,7 +52045,7 @@ class TablePlugin extends CorePlugin {
51987
52045
  ? table.filters.find((f) => f.col === i)
51988
52046
  : undefined;
51989
52047
  const filterZone = { ...tableZone, left: i, right: i };
51990
- const filterId = oldFilter?.id || this.uuidGenerator.uuidv4();
52048
+ const filterId = oldFilter?.id || this.uuidGenerator.smallUuid();
51991
52049
  filters.push(this.createFilterFromZone(filterId, tableRange.sheetId, filterZone, config));
51992
52050
  }
51993
52051
  }
@@ -52088,7 +52146,7 @@ class TablePlugin extends CorePlugin {
52088
52146
  if (filters.length < zoneToDimension(tableZone).numberOfCols) {
52089
52147
  for (let col = tableZone.left; col <= tableZone.right; col++) {
52090
52148
  if (!filters.find((filter) => filter.col === col)) {
52091
- const uid = this.uuidGenerator.uuidv4();
52149
+ const uid = this.uuidGenerator.smallUuid();
52092
52150
  const filterZone = { ...tableZone, left: col, right: col };
52093
52151
  filters.push(this.createFilterFromZone(uid, sheetId, filterZone, table.config));
52094
52152
  }
@@ -59037,23 +59095,23 @@ const uuidGenerator = new UuidGenerator();
59037
59095
  function repeatCreateChartCommand(getters, cmd) {
59038
59096
  return {
59039
59097
  ...repeatSheetDependantCommand(getters, cmd),
59040
- id: uuidGenerator.uuidv4(),
59098
+ id: uuidGenerator.smallUuid(),
59041
59099
  };
59042
59100
  }
59043
59101
  function repeatCreateImageCommand(getters, cmd) {
59044
59102
  return {
59045
59103
  ...repeatSheetDependantCommand(getters, cmd),
59046
- figureId: uuidGenerator.uuidv4(),
59104
+ figureId: uuidGenerator.smallUuid(),
59047
59105
  };
59048
59106
  }
59049
59107
  function repeatCreateFigureCommand(getters, cmd) {
59050
59108
  const newCmd = repeatSheetDependantCommand(getters, cmd);
59051
- newCmd.figure.id = uuidGenerator.uuidv4();
59109
+ newCmd.figure.id = uuidGenerator.smallUuid();
59052
59110
  return newCmd;
59053
59111
  }
59054
59112
  function repeatCreateSheetCommand(getters, cmd) {
59055
59113
  const newCmd = deepCopy(cmd);
59056
- newCmd.sheetId = uuidGenerator.uuidv4();
59114
+ newCmd.sheetId = uuidGenerator.smallUuid();
59057
59115
  const sheetName = cmd.name || getters.getSheet(getters.getActiveSheetId()).name;
59058
59116
  // Extract the prefix of the sheet name (everything before the number at the end of the name)
59059
59117
  const namePrefix = sheetName.match(/(.+?)\d*$/)?.[1] || sheetName;
@@ -60523,23 +60581,7 @@ class GridSelectionPlugin extends UIPlugin {
60523
60581
  gridSelection: deepCopy(gridSelection),
60524
60582
  };
60525
60583
  }
60526
- if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
60527
- const currentSheetIds = this.getters.getVisibleSheetIds();
60528
- this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
60529
- if (this.activeSheet.id in this.sheetsData) {
60530
- const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
60531
- this.selectCell(anchor.cell.col, anchor.cell.row);
60532
- }
60533
- else {
60534
- this.selectCell(0, 0);
60535
- }
60536
- const { col, row } = this.gridSelection.anchor.cell;
60537
- this.moveClient({
60538
- sheetId: this.getters.getActiveSheetId(),
60539
- col,
60540
- row,
60541
- });
60542
- }
60584
+ this.fallbackToVisibleSheet();
60543
60585
  const sheetId = this.getters.getActiveSheetId();
60544
60586
  this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
60545
60587
  this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
@@ -60549,6 +60591,7 @@ class GridSelectionPlugin extends UIPlugin {
60549
60591
  }
60550
60592
  }
60551
60593
  finalize() {
60594
+ this.fallbackToVisibleSheet();
60552
60595
  /** Any change to the selection has to be reflected in the selection processor. */
60553
60596
  this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
60554
60597
  }
@@ -60852,6 +60895,25 @@ class GridSelectionPlugin extends UIPlugin {
60852
60895
  }
60853
60896
  return "Success" /* CommandResult.Success */;
60854
60897
  }
60898
+ fallbackToVisibleSheet() {
60899
+ if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
60900
+ const currentSheetIds = this.getters.getVisibleSheetIds();
60901
+ this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
60902
+ if (this.activeSheet.id in this.sheetsData) {
60903
+ const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
60904
+ this.selectCell(anchor.cell.col, anchor.cell.row);
60905
+ }
60906
+ else {
60907
+ this.selectCell(0, 0);
60908
+ }
60909
+ const { col, row } = this.gridSelection.anchor.cell;
60910
+ this.moveClient({
60911
+ sheetId: this.getters.getActiveSheetId(),
60912
+ col,
60913
+ row,
60914
+ });
60915
+ }
60916
+ }
60855
60917
  //-------------------------------------------
60856
60918
  // Helpers for extensions
60857
60919
  // ------------------------------------------
@@ -62831,7 +62893,7 @@ class BottomBar extends Component {
62831
62893
  clickAddSheet(ev) {
62832
62894
  const activeSheetId = this.env.model.getters.getActiveSheetId();
62833
62895
  const position = this.env.model.getters.getSheetIds().findIndex((sheetId) => sheetId === activeSheetId) + 1;
62834
- const sheetId = this.env.model.uuidGenerator.uuidv4();
62896
+ const sheetId = this.env.model.uuidGenerator.smallUuid();
62835
62897
  const name = this.env.model.getters.getNextSheetName(_t("Sheet"));
62836
62898
  this.env.model.dispatch("CREATE_SHEET", { sheetId, position, name });
62837
62899
  this.env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
@@ -62946,7 +63008,7 @@ class BottomBar extends Component {
62946
63008
  draggedItemId: sheetId,
62947
63009
  initialMousePosition: event.clientX,
62948
63010
  items: sheets,
62949
- containerEl: this.sheetListRef.el,
63011
+ scrollableContainerEl: this.sheetListRef.el,
62950
63012
  onDragEnd: (sheetId, finalIndex) => this.onDragEnd(sheetId, finalIndex),
62951
63013
  });
62952
63014
  }
@@ -68389,7 +68451,7 @@ class Model extends EventBus {
68389
68451
  }
68390
68452
  setupConfig(config) {
68391
68453
  const client = config.client || {
68392
- id: this.uuidGenerator.uuidv4(),
68454
+ id: this.uuidGenerator.smallUuid(),
68393
68455
  name: _t("Anonymous").toString(),
68394
68456
  };
68395
68457
  const transportService = config.transportService || new LocalTransportService();
@@ -68865,6 +68927,6 @@ const constants = {
68865
68927
  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 };
68866
68928
 
68867
68929
 
68868
- __info__.version = "17.4.21";
68869
- __info__.date = "2025-02-05T06:46:54.366Z";
68870
- __info__.hash = "0c55e18";
68930
+ __info__.version = "17.4.23";
68931
+ __info__.date = "2025-02-14T08:37:12.219Z";
68932
+ __info__.hash = "8339907";