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