@odoo/o-spreadsheet 18.1.7 → 18.1.8
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.
- package/dist/o-spreadsheet.cjs.js +166 -111
- package/dist/o-spreadsheet.d.ts +18 -2
- package/dist/o-spreadsheet.esm.js +166 -111
- package/dist/o-spreadsheet.iife.js +166 -111
- package/dist/o-spreadsheet.iife.min.js +151 -147
- package/dist/o_spreadsheet.xml +16 -14
- package/package.json +1 -1
|
@@ -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.1.
|
|
6
|
-
* @date 2025-02-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.8
|
|
6
|
+
* @date 2025-02-14T08:42:08.322Z
|
|
7
|
+
* @hash 02682f4
|
|
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';
|
|
@@ -6479,6 +6479,33 @@ function drawDecoratedText(context, text, position, underline = false, strikethr
|
|
|
6479
6479
|
* https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
|
|
6480
6480
|
* */
|
|
6481
6481
|
class UuidGenerator {
|
|
6482
|
+
/**
|
|
6483
|
+
* Generates a custom UUID using a simple 36^12 method (8-character alphanumeric string with lowercase letters)
|
|
6484
|
+
* This has a higher chance of collision than a UUIDv4, but not only faster to generate than an UUIDV4,
|
|
6485
|
+
* it also has a smaller size, which is preferable to alleviate the overall data size.
|
|
6486
|
+
*
|
|
6487
|
+
* This method is preferable when generating uuids for the core data (sheetId, figureId, etc)
|
|
6488
|
+
* as they will appear several times in the revisions and local history.
|
|
6489
|
+
*
|
|
6490
|
+
*/
|
|
6491
|
+
smallUuid() {
|
|
6492
|
+
//@ts-ignore
|
|
6493
|
+
if (window.crypto && window.crypto.getRandomValues) {
|
|
6494
|
+
//@ts-ignore
|
|
6495
|
+
return ([1e7] + -1e3).replace(/[018]/g, (c) => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16));
|
|
6496
|
+
}
|
|
6497
|
+
else {
|
|
6498
|
+
// mainly for jest and other browsers that do not have the crypto functionality
|
|
6499
|
+
return "xxxxxxxx-xxxx".replace(/[xy]/g, function (c) {
|
|
6500
|
+
const r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
6501
|
+
return v.toString(16);
|
|
6502
|
+
});
|
|
6503
|
+
}
|
|
6504
|
+
}
|
|
6505
|
+
/**
|
|
6506
|
+
* Generates an UUIDV4, has astronomically low chance of collision, but is larger in size than the smallUuid.
|
|
6507
|
+
* This method should be used when you need to avoid collisions at all costs, like the id of a revision.
|
|
6508
|
+
*/
|
|
6482
6509
|
uuidv4() {
|
|
6483
6510
|
//@ts-ignore
|
|
6484
6511
|
if (window.crypto && window.crypto.getRandomValues) {
|
|
@@ -8513,7 +8540,7 @@ class ChartClipboardHandler extends AbstractFigureClipboardHandler {
|
|
|
8513
8540
|
};
|
|
8514
8541
|
}
|
|
8515
8542
|
getPasteTarget(sheetId, target, content, options) {
|
|
8516
|
-
const newId = new UuidGenerator().
|
|
8543
|
+
const newId = new UuidGenerator().smallUuid();
|
|
8517
8544
|
return { zones: [], figureId: newId, sheetId };
|
|
8518
8545
|
}
|
|
8519
8546
|
paste(target, clippedContent, options) {
|
|
@@ -8679,7 +8706,7 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8679
8706
|
if (!targetCF && queuedCfs) {
|
|
8680
8707
|
targetCF = queuedCfs.find((queued) => queued.cf.stopIfTrue === originCF.stopIfTrue && deepEquals(queued.cf.rule, originCF.rule))?.cf;
|
|
8681
8708
|
}
|
|
8682
|
-
return targetCF || { ...originCF, id: this.uuidGenerator.
|
|
8709
|
+
return targetCF || { ...originCF, id: this.uuidGenerator.smallUuid(), ranges: [] };
|
|
8683
8710
|
}
|
|
8684
8711
|
}
|
|
8685
8712
|
|
|
@@ -8772,7 +8799,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8772
8799
|
}
|
|
8773
8800
|
return (targetRule || {
|
|
8774
8801
|
...originRule,
|
|
8775
|
-
id: newId ? this.uuidGenerator.
|
|
8802
|
+
id: newId ? this.uuidGenerator.smallUuid() : originRule.id,
|
|
8776
8803
|
ranges: [],
|
|
8777
8804
|
});
|
|
8778
8805
|
}
|
|
@@ -8834,7 +8861,7 @@ class ImageClipboardHandler extends AbstractFigureClipboardHandler {
|
|
|
8834
8861
|
};
|
|
8835
8862
|
}
|
|
8836
8863
|
getPasteTarget(sheetId, target, content, options) {
|
|
8837
|
-
const newId = new UuidGenerator().
|
|
8864
|
+
const newId = new UuidGenerator().smallUuid();
|
|
8838
8865
|
return { sheetId, zones: [], figureId: newId };
|
|
8839
8866
|
}
|
|
8840
8867
|
paste(target, clippedContent, options) {
|
|
@@ -15109,7 +15136,7 @@ const SORTN = {
|
|
|
15109
15136
|
}
|
|
15110
15137
|
}
|
|
15111
15138
|
},
|
|
15112
|
-
isExported:
|
|
15139
|
+
isExported: false,
|
|
15113
15140
|
};
|
|
15114
15141
|
// -----------------------------------------------------------------------------
|
|
15115
15142
|
// UNIQUE
|
|
@@ -27622,7 +27649,7 @@ function forceUnicityOfFigure(data) {
|
|
|
27622
27649
|
for (const sheet of data.sheets || []) {
|
|
27623
27650
|
for (const figure of sheet.figures || []) {
|
|
27624
27651
|
if (figureIds.has(figure.id)) {
|
|
27625
|
-
figure.id += uuidGenerator.
|
|
27652
|
+
figure.id += uuidGenerator.smallUuid();
|
|
27626
27653
|
}
|
|
27627
27654
|
figureIds.add(figure.id);
|
|
27628
27655
|
}
|
|
@@ -28207,9 +28234,7 @@ function getBarChartData(definition, dataSets, labelRange, getters) {
|
|
|
28207
28234
|
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
28208
28235
|
let labels = labelValues.formattedValues;
|
|
28209
28236
|
let dataSetsValues = getChartDatasetValues(getters, dataSets);
|
|
28210
|
-
if (definition.dataSetsHaveTitle
|
|
28211
|
-
dataSetsValues[0] &&
|
|
28212
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
28237
|
+
if (shouldRemoveFirstLabel(labelRange, dataSets[0], definition.dataSetsHaveTitle || false)) {
|
|
28213
28238
|
labels.shift();
|
|
28214
28239
|
}
|
|
28215
28240
|
({ labels, dataSetsValues } = filterInvalidDataPoints(labels, dataSetsValues));
|
|
@@ -28258,13 +28283,12 @@ function getPyramidChartData(definition, dataSets, labelRange, getters) {
|
|
|
28258
28283
|
};
|
|
28259
28284
|
}
|
|
28260
28285
|
function getLineChartData(definition, dataSets, labelRange, getters) {
|
|
28261
|
-
const axisType = getChartAxisType(definition, labelRange, getters);
|
|
28286
|
+
const axisType = getChartAxisType(definition, dataSets, labelRange, getters);
|
|
28262
28287
|
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
28263
28288
|
let labels = axisType === "linear" ? labelValues.values : labelValues.formattedValues;
|
|
28264
28289
|
let dataSetsValues = getChartDatasetValues(getters, dataSets);
|
|
28265
|
-
|
|
28266
|
-
|
|
28267
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
28290
|
+
const removeFirstLabel = shouldRemoveFirstLabel(labelRange, dataSets[0], definition.dataSetsHaveTitle || false);
|
|
28291
|
+
if (removeFirstLabel) {
|
|
28268
28292
|
labels.shift();
|
|
28269
28293
|
}
|
|
28270
28294
|
({ labels, dataSetsValues } = filterInvalidDataPoints(labels, dataSetsValues));
|
|
@@ -28276,7 +28300,7 @@ function getLineChartData(definition, dataSets, labelRange, getters) {
|
|
|
28276
28300
|
}
|
|
28277
28301
|
const leftAxisFormat = getChartDatasetFormat(getters, dataSets, "left");
|
|
28278
28302
|
const rightAxisFormat = getChartDatasetFormat(getters, dataSets, "right");
|
|
28279
|
-
const labelsFormat = getChartLabelFormat(getters, labelRange);
|
|
28303
|
+
const labelsFormat = getChartLabelFormat(getters, labelRange, removeFirstLabel);
|
|
28280
28304
|
const axisFormats = { y: leftAxisFormat, y1: rightAxisFormat, x: labelsFormat };
|
|
28281
28305
|
const trendDataSetsValues = [];
|
|
28282
28306
|
for (const index in dataSetsValues) {
|
|
@@ -28312,9 +28336,7 @@ function getPieChartData(definition, dataSets, labelRange, getters) {
|
|
|
28312
28336
|
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
28313
28337
|
let labels = labelValues.formattedValues;
|
|
28314
28338
|
let dataSetsValues = getChartDatasetValues(getters, dataSets);
|
|
28315
|
-
if (definition.dataSetsHaveTitle
|
|
28316
|
-
dataSetsValues[0] &&
|
|
28317
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
28339
|
+
if (shouldRemoveFirstLabel(labelRange, dataSets[0], definition.dataSetsHaveTitle || false)) {
|
|
28318
28340
|
labels.shift();
|
|
28319
28341
|
}
|
|
28320
28342
|
({ labels, dataSetsValues } = filterInvalidDataPoints(labels, dataSetsValues));
|
|
@@ -28334,9 +28356,7 @@ function getRadarChartData(definition, dataSets, labelRange, getters) {
|
|
|
28334
28356
|
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
28335
28357
|
let labels = labelValues.formattedValues;
|
|
28336
28358
|
let dataSetsValues = getChartDatasetValues(getters, dataSets);
|
|
28337
|
-
if (definition.dataSetsHaveTitle
|
|
28338
|
-
dataSetsValues[0] &&
|
|
28339
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
28359
|
+
if (shouldRemoveFirstLabel(labelRange, dataSets[0], definition.dataSetsHaveTitle || false)) {
|
|
28340
28360
|
labels.shift();
|
|
28341
28361
|
}
|
|
28342
28362
|
({ labels, dataSetsValues } = filterInvalidDataPoints(labels, dataSetsValues));
|
|
@@ -28356,7 +28376,7 @@ function getRadarChartData(definition, dataSets, labelRange, getters) {
|
|
|
28356
28376
|
function getGeoChartData(definition, dataSets, labelRange, getters) {
|
|
28357
28377
|
const labelValues = getChartLabelValues(getters, dataSets, labelRange);
|
|
28358
28378
|
let labels = labelValues.formattedValues;
|
|
28359
|
-
if (definition.dataSetsHaveTitle) {
|
|
28379
|
+
if (shouldRemoveFirstLabel(labelRange, dataSets[0], definition.dataSetsHaveTitle || false)) {
|
|
28360
28380
|
labels.shift();
|
|
28361
28381
|
}
|
|
28362
28382
|
let dataSetsValues = getChartDatasetValues(getters, dataSets);
|
|
@@ -28517,36 +28537,41 @@ function normalizeLabels(labels, newLabels, config) {
|
|
|
28517
28537
|
}
|
|
28518
28538
|
return { normalizedLabels, normalizedNewLabels };
|
|
28519
28539
|
}
|
|
28520
|
-
function getChartAxisType(
|
|
28521
|
-
if (isDateChart(
|
|
28540
|
+
function getChartAxisType(definition, dataSets, labelRange, getters) {
|
|
28541
|
+
if (isDateChart(definition, dataSets, labelRange, getters) && isLuxonTimeAdapterInstalled()) {
|
|
28522
28542
|
return "time";
|
|
28523
28543
|
}
|
|
28524
|
-
if (isLinearChart(
|
|
28544
|
+
if (isLinearChart(definition, dataSets, labelRange, getters)) {
|
|
28525
28545
|
return "linear";
|
|
28526
28546
|
}
|
|
28527
28547
|
return "category";
|
|
28528
28548
|
}
|
|
28529
|
-
function isDateChart(definition, labelRange, getters) {
|
|
28530
|
-
return !definition.labelsAsText && canBeDateChart(labelRange, getters);
|
|
28549
|
+
function isDateChart(definition, dataSets, labelRange, getters) {
|
|
28550
|
+
return !definition.labelsAsText && canBeDateChart(definition, dataSets, labelRange, getters);
|
|
28531
28551
|
}
|
|
28532
|
-
function isLinearChart(definition, labelRange, getters) {
|
|
28533
|
-
return !definition.labelsAsText && canBeLinearChart(labelRange, getters);
|
|
28552
|
+
function isLinearChart(definition, dataSets, labelRange, getters) {
|
|
28553
|
+
return !definition.labelsAsText && canBeLinearChart(definition, dataSets, labelRange, getters);
|
|
28534
28554
|
}
|
|
28535
|
-
function canChartParseLabels(labelRange, getters) {
|
|
28536
|
-
return canBeDateChart(
|
|
28555
|
+
function canChartParseLabels(definition, dataSets, labelRange, getters) {
|
|
28556
|
+
return (canBeDateChart(definition, dataSets, labelRange, getters) ||
|
|
28557
|
+
canBeLinearChart(definition, dataSets, labelRange, getters));
|
|
28537
28558
|
}
|
|
28538
|
-
function canBeDateChart(labelRange, getters) {
|
|
28539
|
-
if (!labelRange || !canBeLinearChart(labelRange, getters)) {
|
|
28559
|
+
function canBeDateChart(definition, dataSets, labelRange, getters) {
|
|
28560
|
+
if (!labelRange || !canBeLinearChart(definition, dataSets, labelRange, getters)) {
|
|
28540
28561
|
return false;
|
|
28541
28562
|
}
|
|
28542
|
-
const
|
|
28563
|
+
const removeFirstLabel = shouldRemoveFirstLabel(labelRange, dataSets[0], definition.dataSetsHaveTitle || false);
|
|
28564
|
+
const labelFormat = getChartLabelFormat(getters, labelRange, removeFirstLabel);
|
|
28543
28565
|
return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
|
|
28544
28566
|
}
|
|
28545
|
-
function canBeLinearChart(labelRange, getters) {
|
|
28567
|
+
function canBeLinearChart(definition, dataSets, labelRange, getters) {
|
|
28546
28568
|
if (!labelRange) {
|
|
28547
28569
|
return false;
|
|
28548
28570
|
}
|
|
28549
28571
|
const labels = getters.getRangeValues(labelRange);
|
|
28572
|
+
if (shouldRemoveFirstLabel(labelRange, dataSets[0], definition.dataSetsHaveTitle || false)) {
|
|
28573
|
+
labels.shift();
|
|
28574
|
+
}
|
|
28550
28575
|
if (labels.some((label) => isNaN(Number(label)) && label)) {
|
|
28551
28576
|
return false;
|
|
28552
28577
|
}
|
|
@@ -28655,17 +28680,15 @@ function aggregateDataForLabels(labels, datasets) {
|
|
|
28655
28680
|
})),
|
|
28656
28681
|
};
|
|
28657
28682
|
}
|
|
28658
|
-
function getChartLabelFormat(getters, range) {
|
|
28683
|
+
function getChartLabelFormat(getters, range, shouldRemoveFirstLabel) {
|
|
28659
28684
|
if (!range)
|
|
28660
28685
|
return undefined;
|
|
28661
|
-
const { sheetId, zone
|
|
28662
|
-
|
|
28663
|
-
|
|
28664
|
-
|
|
28665
|
-
return format;
|
|
28666
|
-
}
|
|
28686
|
+
const { sheetId, zone } = range;
|
|
28687
|
+
const formats = positions(zone).map((position) => getters.getEvaluatedCell({ sheetId, ...position }).format);
|
|
28688
|
+
if (shouldRemoveFirstLabel) {
|
|
28689
|
+
formats.shift();
|
|
28667
28690
|
}
|
|
28668
|
-
return undefined;
|
|
28691
|
+
return formats.find((format) => format !== undefined);
|
|
28669
28692
|
}
|
|
28670
28693
|
function getChartLabelValues(getters, dataSets, labelRange) {
|
|
28671
28694
|
let labels = { values: [], formattedValues: [] };
|
|
@@ -32898,7 +32921,7 @@ const linkSheet = {
|
|
|
32898
32921
|
const deleteSheet = {
|
|
32899
32922
|
name: _t("Delete"),
|
|
32900
32923
|
isVisible: (env) => {
|
|
32901
|
-
return env.model.getters.
|
|
32924
|
+
return env.model.getters.getVisibleSheetIds().length > 1;
|
|
32902
32925
|
},
|
|
32903
32926
|
execute: (env) => env.askConfirmation(_t("Are you sure you want to delete this sheet?"), () => {
|
|
32904
32927
|
env.model.dispatch("DELETE_SHEET", { sheetId: env.model.getters.getActiveSheetId() });
|
|
@@ -32909,7 +32932,7 @@ const duplicateSheet = {
|
|
|
32909
32932
|
name: _t("Duplicate"),
|
|
32910
32933
|
execute: (env) => {
|
|
32911
32934
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
32912
|
-
const sheetIdTo = env.model.uuidGenerator.
|
|
32935
|
+
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
32913
32936
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
32914
32937
|
sheetId: sheetIdFrom,
|
|
32915
32938
|
sheetIdTo,
|
|
@@ -33612,20 +33635,21 @@ function getSmartChartDefinition(zone, getters) {
|
|
|
33612
33635
|
}
|
|
33613
33636
|
// Only display legend for several datasets.
|
|
33614
33637
|
const newLegendPos = dataSetZone.right === dataSetZone.left ? "none" : "top";
|
|
33615
|
-
const
|
|
33616
|
-
|
|
33617
|
-
|
|
33618
|
-
|
|
33619
|
-
|
|
33620
|
-
|
|
33621
|
-
|
|
33622
|
-
|
|
33623
|
-
|
|
33624
|
-
|
|
33625
|
-
|
|
33626
|
-
|
|
33627
|
-
|
|
33628
|
-
|
|
33638
|
+
const lineChartDefinition = {
|
|
33639
|
+
title: {},
|
|
33640
|
+
dataSets,
|
|
33641
|
+
labelsAsText: false,
|
|
33642
|
+
stacked: false,
|
|
33643
|
+
aggregated: false,
|
|
33644
|
+
cumulative: false,
|
|
33645
|
+
labelRange: labelRangeXc,
|
|
33646
|
+
type: "line",
|
|
33647
|
+
dataSetsHaveTitle,
|
|
33648
|
+
legendPosition: newLegendPos,
|
|
33649
|
+
};
|
|
33650
|
+
const chart = new LineChart(lineChartDefinition, sheetId, getters);
|
|
33651
|
+
if (canChartParseLabels(lineChartDefinition, chart.dataSets, chart.labelRange, getters)) {
|
|
33652
|
+
return lineChartDefinition;
|
|
33629
33653
|
}
|
|
33630
33654
|
const _dataSets = createDataSets(getters, dataSets, sheetId, dataSetsHaveTitle);
|
|
33631
33655
|
if (singleColumn &&
|
|
@@ -34039,7 +34063,7 @@ const HIDE_ROWS_NAME = (env) => {
|
|
|
34039
34063
|
//------------------------------------------------------------------------------
|
|
34040
34064
|
const CREATE_CHART = (env) => {
|
|
34041
34065
|
const getters = env.model.getters;
|
|
34042
|
-
const id = env.model.uuidGenerator.
|
|
34066
|
+
const id = env.model.uuidGenerator.smallUuid();
|
|
34043
34067
|
const sheetId = getters.getActiveSheetId();
|
|
34044
34068
|
if (getZoneArea(env.model.getters.getSelectedZone()) === 1) {
|
|
34045
34069
|
env.model.selection.selectTableAroundSelection();
|
|
@@ -34062,8 +34086,8 @@ const CREATE_CHART = (env) => {
|
|
|
34062
34086
|
// Pivots
|
|
34063
34087
|
//------------------------------------------------------------------------------
|
|
34064
34088
|
const CREATE_PIVOT = (env) => {
|
|
34065
|
-
const pivotId = env.model.uuidGenerator.
|
|
34066
|
-
const newSheetId = env.model.uuidGenerator.
|
|
34089
|
+
const pivotId = env.model.uuidGenerator.smallUuid();
|
|
34090
|
+
const newSheetId = env.model.uuidGenerator.smallUuid();
|
|
34067
34091
|
const result = env.model.dispatch("INSERT_NEW_PIVOT", { pivotId, newSheetId });
|
|
34068
34092
|
if (result.isSuccessful) {
|
|
34069
34093
|
env.openSidePanel("PivotSidePanel", { pivotId });
|
|
@@ -34122,7 +34146,7 @@ async function requestImage(env) {
|
|
|
34122
34146
|
const CREATE_IMAGE = async (env) => {
|
|
34123
34147
|
if (env.imageProvider) {
|
|
34124
34148
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
34125
|
-
const figureId = env.model.uuidGenerator.
|
|
34149
|
+
const figureId = env.model.uuidGenerator.smallUuid();
|
|
34126
34150
|
const image = await requestImage(env);
|
|
34127
34151
|
if (!image) {
|
|
34128
34152
|
throw new Error("No image provider was given to the environment");
|
|
@@ -34675,7 +34699,7 @@ const insertCheckbox = {
|
|
|
34675
34699
|
ranges,
|
|
34676
34700
|
sheetId,
|
|
34677
34701
|
rule: {
|
|
34678
|
-
id: env.model.uuidGenerator.
|
|
34702
|
+
id: env.model.uuidGenerator.smallUuid(),
|
|
34679
34703
|
criterion: {
|
|
34680
34704
|
type: "isBoolean",
|
|
34681
34705
|
values: [],
|
|
@@ -34691,7 +34715,7 @@ const insertDropdown = {
|
|
|
34691
34715
|
const zones = env.model.getters.getSelectedZones();
|
|
34692
34716
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
34693
34717
|
const ranges = zones.map((zone) => env.model.getters.getRangeDataFromZone(sheetId, zone));
|
|
34694
|
-
const ruleID = env.model.uuidGenerator.
|
|
34718
|
+
const ruleID = env.model.uuidGenerator.smallUuid();
|
|
34695
34719
|
env.model.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
34696
34720
|
ranges,
|
|
34697
34721
|
sheetId,
|
|
@@ -34722,7 +34746,7 @@ const insertSheet = {
|
|
|
34722
34746
|
execute: (env) => {
|
|
34723
34747
|
const activeSheetId = env.model.getters.getActiveSheetId();
|
|
34724
34748
|
const position = env.model.getters.getSheetIds().indexOf(activeSheetId) + 1;
|
|
34725
|
-
const sheetId = env.model.uuidGenerator.
|
|
34749
|
+
const sheetId = env.model.uuidGenerator.smallUuid();
|
|
34726
34750
|
env.model.dispatch("CREATE_SHEET", { sheetId, position });
|
|
34727
34751
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
|
|
34728
34752
|
},
|
|
@@ -39211,7 +39235,7 @@ class LineConfigPanel extends GenericChartConfigPanel {
|
|
|
39211
39235
|
get canTreatLabelsAsText() {
|
|
39212
39236
|
const chart = this.env.model.getters.getChart(this.props.figureId);
|
|
39213
39237
|
if (chart && chart instanceof LineChart) {
|
|
39214
|
-
return canChartParseLabels(chart.labelRange, this.env.model.getters);
|
|
39238
|
+
return canChartParseLabels(chart.getDefinition(), chart.dataSets, chart.labelRange, this.env.model.getters);
|
|
39215
39239
|
}
|
|
39216
39240
|
return false;
|
|
39217
39241
|
}
|
|
@@ -39288,7 +39312,7 @@ class ScatterConfigPanel extends GenericChartConfigPanel {
|
|
|
39288
39312
|
get canTreatLabelsAsText() {
|
|
39289
39313
|
const chart = this.env.model.getters.getChart(this.props.figureId);
|
|
39290
39314
|
if (chart && chart instanceof ScatterChart) {
|
|
39291
|
-
return canChartParseLabels(chart.labelRange, this.env.model.getters);
|
|
39315
|
+
return canChartParseLabels(chart.getDefinition(), chart.dataSets, chart.labelRange, this.env.model.getters);
|
|
39292
39316
|
}
|
|
39293
39317
|
return false;
|
|
39294
39318
|
}
|
|
@@ -42066,7 +42090,7 @@ class ConditionalFormattingPanel extends Component {
|
|
|
42066
42090
|
this.originalEditedCf = undefined;
|
|
42067
42091
|
}
|
|
42068
42092
|
addConditionalFormat() {
|
|
42069
|
-
const cfId = this.env.model.uuidGenerator.
|
|
42093
|
+
const cfId = this.env.model.uuidGenerator.smallUuid();
|
|
42070
42094
|
this.env.model.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
42071
42095
|
sheetId: this.activeSheetId,
|
|
42072
42096
|
ranges: this.env.model.getters
|
|
@@ -43336,7 +43360,7 @@ class DataValidationEditor extends Component {
|
|
|
43336
43360
|
.getSelectedZones()
|
|
43337
43361
|
.map((zone) => zoneToXc(this.env.model.getters.getUnboundedZone(sheetId, zone)));
|
|
43338
43362
|
return {
|
|
43339
|
-
id: this.env.model.uuidGenerator.
|
|
43363
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
43340
43364
|
criterion: { type: "textContains", values: [""] },
|
|
43341
43365
|
ranges,
|
|
43342
43366
|
};
|
|
@@ -44954,8 +44978,8 @@ class PivotTitleSection extends Component {
|
|
|
44954
44978
|
return this.env.model.getters.getPivotDisplayName(this.props.pivotId);
|
|
44955
44979
|
}
|
|
44956
44980
|
duplicatePivot() {
|
|
44957
|
-
const newPivotId = this.env.model.uuidGenerator.
|
|
44958
|
-
const newSheetId = this.env.model.uuidGenerator.
|
|
44981
|
+
const newPivotId = this.env.model.uuidGenerator.smallUuid();
|
|
44982
|
+
const newSheetId = this.env.model.uuidGenerator.smallUuid();
|
|
44959
44983
|
const result = this.env.model.dispatch("DUPLICATE_PIVOT_IN_NEW_SHEET", {
|
|
44960
44984
|
pivotId: this.props.pivotId,
|
|
44961
44985
|
newPivotId,
|
|
@@ -47580,7 +47604,7 @@ class TableStyleEditorPanel extends Component {
|
|
|
47580
47604
|
this.state.selectedTemplateName = templateName;
|
|
47581
47605
|
}
|
|
47582
47606
|
onConfirm() {
|
|
47583
|
-
const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.
|
|
47607
|
+
const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.smallUuid();
|
|
47584
47608
|
this.env.model.dispatch("CREATE_TABLE_STYLE", {
|
|
47585
47609
|
tableStyleId,
|
|
47586
47610
|
tableStyleName: this.state.styleName,
|
|
@@ -56154,7 +56178,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
56154
56178
|
? "Success" /* CommandResult.Success */
|
|
56155
56179
|
: "InvalidColor" /* CommandResult.InvalidColor */;
|
|
56156
56180
|
case "DELETE_SHEET":
|
|
56157
|
-
return this.
|
|
56181
|
+
return this.getVisibleSheetIds().length > 1
|
|
56158
56182
|
? "Success" /* CommandResult.Success */
|
|
56159
56183
|
: "NotEnoughSheets" /* CommandResult.NotEnoughSheets */;
|
|
56160
56184
|
case "ADD_COLUMNS_ROWS":
|
|
@@ -63513,6 +63537,15 @@ class Session extends EventBus {
|
|
|
63513
63537
|
}
|
|
63514
63538
|
this.sendPendingMessage();
|
|
63515
63539
|
}
|
|
63540
|
+
dropPendingRevision(revisionId) {
|
|
63541
|
+
this.revisions.drop(revisionId);
|
|
63542
|
+
const revisionIds = this.pendingMessages
|
|
63543
|
+
.filter((message) => message.type === "REMOTE_REVISION")
|
|
63544
|
+
.map((message) => message.nextRevisionId);
|
|
63545
|
+
this.trigger("pending-revisions-dropped", { revisionIds });
|
|
63546
|
+
this.waitingAck = false;
|
|
63547
|
+
this.waitingUndoRedoAck = false;
|
|
63548
|
+
}
|
|
63516
63549
|
/**
|
|
63517
63550
|
* Send the next pending message
|
|
63518
63551
|
*/
|
|
@@ -63527,13 +63560,7 @@ class Session extends EventBus {
|
|
|
63527
63560
|
* The command is empty, we have to drop all the next local revisions
|
|
63528
63561
|
* to avoid issues with undo/redo
|
|
63529
63562
|
*/
|
|
63530
|
-
this.
|
|
63531
|
-
const revisionIds = this.pendingMessages
|
|
63532
|
-
.filter((message) => message.type === "REMOTE_REVISION")
|
|
63533
|
-
.map((message) => message.nextRevisionId);
|
|
63534
|
-
this.trigger("pending-revisions-dropped", { revisionIds });
|
|
63535
|
-
this.waitingAck = false;
|
|
63536
|
-
this.waitingUndoRedoAck = false;
|
|
63563
|
+
this.dropPendingRevision(revision.id);
|
|
63537
63564
|
this.pendingMessages = [];
|
|
63538
63565
|
return;
|
|
63539
63566
|
}
|
|
@@ -63560,7 +63587,6 @@ class Session extends EventBus {
|
|
|
63560
63587
|
switch (message.type) {
|
|
63561
63588
|
case "REMOTE_REVISION":
|
|
63562
63589
|
case "REVISION_REDONE":
|
|
63563
|
-
case "REVISION_UNDONE":
|
|
63564
63590
|
case "SNAPSHOT_CREATED":
|
|
63565
63591
|
this.waitingAck = false;
|
|
63566
63592
|
this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
|
|
@@ -63569,6 +63595,27 @@ class Session extends EventBus {
|
|
|
63569
63595
|
this.lastRevisionMessage = message;
|
|
63570
63596
|
this.sendPendingMessage();
|
|
63571
63597
|
break;
|
|
63598
|
+
case "REVISION_UNDONE": {
|
|
63599
|
+
this.waitingAck = false;
|
|
63600
|
+
this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
|
|
63601
|
+
const pendingRemoteRevisions = this.pendingMessages.filter((message) => message.type === "REMOTE_REVISION");
|
|
63602
|
+
const firstTransformedRevisionIndex = pendingRemoteRevisions.findIndex((message) => !deepEquals(message.commands, this.revisions.get(message.nextRevisionId).commands));
|
|
63603
|
+
if (firstTransformedRevisionIndex !== -1) {
|
|
63604
|
+
/**
|
|
63605
|
+
* Some revisions undergo transformations that may cause issues with
|
|
63606
|
+
* undo/redo if the transformation is destructive (we don't get back
|
|
63607
|
+
* the original command by transforming it with the inverse).
|
|
63608
|
+
* To prevent these problems, we must discard all subsequent local
|
|
63609
|
+
* revisions.
|
|
63610
|
+
*/
|
|
63611
|
+
this.dropPendingRevision(this.pendingMessages[firstTransformedRevisionIndex].nextRevisionId);
|
|
63612
|
+
this.pendingMessages = this.pendingMessages.slice(0, firstTransformedRevisionIndex);
|
|
63613
|
+
}
|
|
63614
|
+
this.serverRevisionId = message.nextRevisionId;
|
|
63615
|
+
this.processedRevisions.add(message.nextRevisionId);
|
|
63616
|
+
this.sendPendingMessage();
|
|
63617
|
+
break;
|
|
63618
|
+
}
|
|
63572
63619
|
}
|
|
63573
63620
|
}
|
|
63574
63621
|
isAlreadyProcessed(message) {
|
|
@@ -65039,23 +65086,23 @@ const uuidGenerator = new UuidGenerator();
|
|
|
65039
65086
|
function repeatCreateChartCommand(getters, cmd) {
|
|
65040
65087
|
return {
|
|
65041
65088
|
...repeatSheetDependantCommand(getters, cmd),
|
|
65042
|
-
id: uuidGenerator.
|
|
65089
|
+
id: uuidGenerator.smallUuid(),
|
|
65043
65090
|
};
|
|
65044
65091
|
}
|
|
65045
65092
|
function repeatCreateImageCommand(getters, cmd) {
|
|
65046
65093
|
return {
|
|
65047
65094
|
...repeatSheetDependantCommand(getters, cmd),
|
|
65048
|
-
figureId: uuidGenerator.
|
|
65095
|
+
figureId: uuidGenerator.smallUuid(),
|
|
65049
65096
|
};
|
|
65050
65097
|
}
|
|
65051
65098
|
function repeatCreateFigureCommand(getters, cmd) {
|
|
65052
65099
|
const newCmd = repeatSheetDependantCommand(getters, cmd);
|
|
65053
|
-
newCmd.figure.id = uuidGenerator.
|
|
65100
|
+
newCmd.figure.id = uuidGenerator.smallUuid();
|
|
65054
65101
|
return newCmd;
|
|
65055
65102
|
}
|
|
65056
65103
|
function repeatCreateSheetCommand(getters, cmd) {
|
|
65057
65104
|
const newCmd = deepCopy(cmd);
|
|
65058
|
-
newCmd.sheetId = uuidGenerator.
|
|
65105
|
+
newCmd.sheetId = uuidGenerator.smallUuid();
|
|
65059
65106
|
const sheetName = cmd.name || getters.getSheet(getters.getActiveSheetId()).name;
|
|
65060
65107
|
// Extract the prefix of the sheet name (everything before the number at the end of the name)
|
|
65061
65108
|
const namePrefix = sheetName.match(/(.+?)\d*$/)?.[1] || sheetName;
|
|
@@ -66518,23 +66565,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
66518
66565
|
gridSelection: deepCopy(gridSelection),
|
|
66519
66566
|
};
|
|
66520
66567
|
}
|
|
66521
|
-
|
|
66522
|
-
const currentSheetIds = this.getters.getVisibleSheetIds();
|
|
66523
|
-
this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
|
|
66524
|
-
if (this.activeSheet.id in this.sheetsData) {
|
|
66525
|
-
const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
|
|
66526
|
-
this.selectCell(anchor.cell.col, anchor.cell.row);
|
|
66527
|
-
}
|
|
66528
|
-
else {
|
|
66529
|
-
this.selectCell(0, 0);
|
|
66530
|
-
}
|
|
66531
|
-
const { col, row } = this.gridSelection.anchor.cell;
|
|
66532
|
-
this.moveClient({
|
|
66533
|
-
sheetId: this.getters.getActiveSheetId(),
|
|
66534
|
-
col,
|
|
66535
|
-
row,
|
|
66536
|
-
});
|
|
66537
|
-
}
|
|
66568
|
+
this.fallbackToVisibleSheet();
|
|
66538
66569
|
const sheetId = this.getters.getActiveSheetId();
|
|
66539
66570
|
this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
|
|
66540
66571
|
this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
|
|
@@ -66544,6 +66575,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
66544
66575
|
}
|
|
66545
66576
|
}
|
|
66546
66577
|
finalize() {
|
|
66578
|
+
this.fallbackToVisibleSheet();
|
|
66547
66579
|
/** Any change to the selection has to be reflected in the selection processor. */
|
|
66548
66580
|
this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
|
|
66549
66581
|
}
|
|
@@ -66854,6 +66886,25 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
66854
66886
|
}
|
|
66855
66887
|
return "Success" /* CommandResult.Success */;
|
|
66856
66888
|
}
|
|
66889
|
+
fallbackToVisibleSheet() {
|
|
66890
|
+
if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
|
|
66891
|
+
const currentSheetIds = this.getters.getVisibleSheetIds();
|
|
66892
|
+
this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
|
|
66893
|
+
if (this.activeSheet.id in this.sheetsData) {
|
|
66894
|
+
const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
|
|
66895
|
+
this.selectCell(anchor.cell.col, anchor.cell.row);
|
|
66896
|
+
}
|
|
66897
|
+
else {
|
|
66898
|
+
this.selectCell(0, 0);
|
|
66899
|
+
}
|
|
66900
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
66901
|
+
this.moveClient({
|
|
66902
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
66903
|
+
col,
|
|
66904
|
+
row,
|
|
66905
|
+
});
|
|
66906
|
+
}
|
|
66907
|
+
}
|
|
66857
66908
|
//-------------------------------------------
|
|
66858
66909
|
// Helpers for extensions
|
|
66859
66910
|
// ------------------------------------------
|
|
@@ -68854,7 +68905,7 @@ class BottomBar extends Component {
|
|
|
68854
68905
|
clickAddSheet(ev) {
|
|
68855
68906
|
const activeSheetId = this.env.model.getters.getActiveSheetId();
|
|
68856
68907
|
const position = this.env.model.getters.getSheetIds().findIndex((sheetId) => sheetId === activeSheetId) + 1;
|
|
68857
|
-
const sheetId = this.env.model.uuidGenerator.
|
|
68908
|
+
const sheetId = this.env.model.uuidGenerator.smallUuid();
|
|
68858
68909
|
const name = this.env.model.getters.getNextSheetName(_t("Sheet"));
|
|
68859
68910
|
this.env.model.dispatch("CREATE_SHEET", { sheetId, position, name });
|
|
68860
68911
|
this.env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
|
|
@@ -69869,6 +69920,10 @@ const FX_SVG = /*xml*/ `
|
|
|
69869
69920
|
</svg>
|
|
69870
69921
|
`;
|
|
69871
69922
|
css /* scss */ `
|
|
69923
|
+
.o-topbar-composer-container {
|
|
69924
|
+
height: ${TOPBAR_TOOLBAR_HEIGHT}px;
|
|
69925
|
+
}
|
|
69926
|
+
|
|
69872
69927
|
.o-topbar-composer {
|
|
69873
69928
|
height: fit-content;
|
|
69874
69929
|
margin-top: -1px;
|
|
@@ -71142,7 +71197,7 @@ class Tree {
|
|
|
71142
71197
|
}
|
|
71143
71198
|
/**
|
|
71144
71199
|
* Drop the operation and all following operations in every
|
|
71145
|
-
*
|
|
71200
|
+
* branches
|
|
71146
71201
|
*/
|
|
71147
71202
|
drop(operationId) {
|
|
71148
71203
|
for (const branch of this.branches) {
|
|
@@ -74587,7 +74642,7 @@ class Model extends EventBus {
|
|
|
74587
74642
|
}
|
|
74588
74643
|
setupConfig(config) {
|
|
74589
74644
|
const client = config.client || {
|
|
74590
|
-
id: this.uuidGenerator.
|
|
74645
|
+
id: this.uuidGenerator.smallUuid(),
|
|
74591
74646
|
name: _t("Anonymous").toString(),
|
|
74592
74647
|
};
|
|
74593
74648
|
const transportService = config.transportService || new LocalTransportService();
|
|
@@ -75066,6 +75121,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
|
|
|
75066
75121
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, 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 };
|
|
75067
75122
|
|
|
75068
75123
|
|
|
75069
|
-
__info__.version = "18.1.
|
|
75070
|
-
__info__.date = "2025-02-
|
|
75071
|
-
__info__.hash = "
|
|
75124
|
+
__info__.version = "18.1.8";
|
|
75125
|
+
__info__.date = "2025-02-14T08:42:08.322Z";
|
|
75126
|
+
__info__.hash = "02682f4";
|