@odoo/o-spreadsheet 17.0.49 → 17.0.50
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 +258 -132
- package/dist/o-spreadsheet.d.ts +21 -8
- package/dist/o-spreadsheet.esm.js +258 -132
- package/dist/o-spreadsheet.iife.js +258 -132
- package/dist/o-spreadsheet.iife.min.js +249 -249
- package/dist/o_spreadsheet.xml +4 -3
- package/package.json +2 -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 17.0.
|
|
6
|
-
* @date 2025-02-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.50
|
|
6
|
+
* @date 2025-02-14T08:37:34.289Z
|
|
7
|
+
* @hash cc1037d
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -1909,12 +1909,12 @@
|
|
|
1909
1909
|
function isRangeDependant(cmd) {
|
|
1910
1910
|
return "ranges" in cmd;
|
|
1911
1911
|
}
|
|
1912
|
-
function isZoneDependent(cmd) {
|
|
1913
|
-
return "zone" in cmd;
|
|
1914
|
-
}
|
|
1915
1912
|
function isPositionDependent(cmd) {
|
|
1916
1913
|
return "col" in cmd && "row" in cmd && "sheetId" in cmd;
|
|
1917
1914
|
}
|
|
1915
|
+
function isZoneDependent(cmd) {
|
|
1916
|
+
return "sheetId" in cmd && "zone" in cmd;
|
|
1917
|
+
}
|
|
1918
1918
|
const invalidateEvaluationCommands = new Set([
|
|
1919
1919
|
"RENAME_SHEET",
|
|
1920
1920
|
"DELETE_SHEET",
|
|
@@ -1924,6 +1924,7 @@
|
|
|
1924
1924
|
"UNDO",
|
|
1925
1925
|
"REDO",
|
|
1926
1926
|
"ADD_MERGE",
|
|
1927
|
+
"DUPLICATE_SHEET",
|
|
1927
1928
|
"UPDATE_LOCALE",
|
|
1928
1929
|
]);
|
|
1929
1930
|
const invalidateDependenciesCommands = new Set([
|
|
@@ -1932,7 +1933,6 @@
|
|
|
1932
1933
|
]);
|
|
1933
1934
|
const invalidateCFEvaluationCommands = new Set([
|
|
1934
1935
|
...invalidateEvaluationCommands,
|
|
1935
|
-
"DUPLICATE_SHEET",
|
|
1936
1936
|
"EVALUATE_CELLS",
|
|
1937
1937
|
"ADD_CONDITIONAL_FORMAT",
|
|
1938
1938
|
"REMOVE_CONDITIONAL_FORMAT",
|
|
@@ -2092,6 +2092,7 @@
|
|
|
2092
2092
|
CommandResult["InvalidRange"] = "InvalidRange";
|
|
2093
2093
|
CommandResult["InvalidZones"] = "InvalidZones";
|
|
2094
2094
|
CommandResult["InvalidSheetId"] = "InvalidSheetId";
|
|
2095
|
+
CommandResult["InvalidCellId"] = "InvalidCellId";
|
|
2095
2096
|
CommandResult["InvalidFigureId"] = "InvalidFigureId";
|
|
2096
2097
|
CommandResult["InputAlreadyFocused"] = "InputAlreadyFocused";
|
|
2097
2098
|
CommandResult["MaximumRangesReached"] = "MaximumRangesReached";
|
|
@@ -3672,17 +3673,20 @@
|
|
|
3672
3673
|
*/
|
|
3673
3674
|
function toUnboundedZone(xc) {
|
|
3674
3675
|
const zone = toZoneWithoutBoundaryChanges(xc);
|
|
3676
|
+
reorderZone(zone);
|
|
3677
|
+
return zone;
|
|
3678
|
+
}
|
|
3679
|
+
function reorderZone(zone) {
|
|
3675
3680
|
if (zone.right !== undefined && zone.right < zone.left) {
|
|
3676
|
-
const
|
|
3681
|
+
const right = zone.left;
|
|
3677
3682
|
zone.left = zone.right;
|
|
3678
|
-
zone.right =
|
|
3683
|
+
zone.right = right;
|
|
3679
3684
|
}
|
|
3680
3685
|
if (zone.bottom !== undefined && zone.bottom < zone.top) {
|
|
3681
|
-
const
|
|
3686
|
+
const bottom = zone.top;
|
|
3682
3687
|
zone.top = zone.bottom;
|
|
3683
|
-
zone.bottom =
|
|
3688
|
+
zone.bottom = bottom;
|
|
3684
3689
|
}
|
|
3685
|
-
return zone;
|
|
3686
3690
|
}
|
|
3687
3691
|
/**
|
|
3688
3692
|
* Convert from a cartesian reference to a Zone.
|
|
@@ -4715,6 +4719,37 @@
|
|
|
4715
4719
|
setIsFastStrategy(isFast) {
|
|
4716
4720
|
this.isFastIdStrategy = isFast;
|
|
4717
4721
|
}
|
|
4722
|
+
/**
|
|
4723
|
+
* Generates a custom UUID using a simple 26^8 method (8-character alphanumeric string with lowercase letters)
|
|
4724
|
+
* This has a higher chance of collision than a UUIDv4, but not only faster to generate than an UUIDV4,
|
|
4725
|
+
* it also has a smaller size, which is preferable to alleviate the overall data size.
|
|
4726
|
+
*
|
|
4727
|
+
* This method is preferable when generating uuids for the core data (sheetId, figureId, etc)
|
|
4728
|
+
* as they will appear several times in the revisions and local history.
|
|
4729
|
+
*
|
|
4730
|
+
*/
|
|
4731
|
+
smallUuid() {
|
|
4732
|
+
if (this.isFastIdStrategy) {
|
|
4733
|
+
this.fastIdStart++;
|
|
4734
|
+
return String(this.fastIdStart);
|
|
4735
|
+
//@ts-ignore
|
|
4736
|
+
}
|
|
4737
|
+
else if (window.crypto && window.crypto.getRandomValues) {
|
|
4738
|
+
//@ts-ignore
|
|
4739
|
+
return ([1e7] + -1e3).replace(/[018]/g, (c) => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16));
|
|
4740
|
+
}
|
|
4741
|
+
else {
|
|
4742
|
+
// mainly for jest and other browsers that do not have the crypto functionality
|
|
4743
|
+
return "xxxxxxxx-xxxx".replace(/[xy]/g, function (c) {
|
|
4744
|
+
var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
4745
|
+
return v.toString(16);
|
|
4746
|
+
});
|
|
4747
|
+
}
|
|
4748
|
+
}
|
|
4749
|
+
/**
|
|
4750
|
+
* Generates an UUIDV4, has astronomically low chance of collision, but is larger in size than the smallUuid.
|
|
4751
|
+
* This method should be used when you need to avoid collisions at all costs, like the id of a revision.
|
|
4752
|
+
*/
|
|
4718
4753
|
uuidv4() {
|
|
4719
4754
|
if (this.isFastIdStrategy) {
|
|
4720
4755
|
this.fastIdStart++;
|
|
@@ -4728,7 +4763,7 @@
|
|
|
4728
4763
|
else {
|
|
4729
4764
|
// mainly for jest and other browsers that do not have the crypto functionality
|
|
4730
4765
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
4731
|
-
var r = (Math.random() * 16) | 0, v = c
|
|
4766
|
+
var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
4732
4767
|
return v.toString(16);
|
|
4733
4768
|
});
|
|
4734
4769
|
}
|
|
@@ -7941,7 +7976,7 @@
|
|
|
7941
7976
|
const deleteSheet = {
|
|
7942
7977
|
name: _t("Delete"),
|
|
7943
7978
|
isVisible: (env) => {
|
|
7944
|
-
return env.model.getters.
|
|
7979
|
+
return env.model.getters.getVisibleSheetIds().length > 1;
|
|
7945
7980
|
},
|
|
7946
7981
|
execute: (env) => env.askConfirmation(_t("Are you sure you want to delete this sheet?"), () => {
|
|
7947
7982
|
env.model.dispatch("DELETE_SHEET", { sheetId: env.model.getters.getActiveSheetId() });
|
|
@@ -7951,7 +7986,7 @@
|
|
|
7951
7986
|
name: _t("Duplicate"),
|
|
7952
7987
|
execute: (env) => {
|
|
7953
7988
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
7954
|
-
const sheetIdTo = env.model.uuidGenerator.
|
|
7989
|
+
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
7955
7990
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
7956
7991
|
sheetId: sheetIdFrom,
|
|
7957
7992
|
sheetIdTo,
|
|
@@ -8501,17 +8536,15 @@
|
|
|
8501
8536
|
plugins: [],
|
|
8502
8537
|
};
|
|
8503
8538
|
}
|
|
8504
|
-
function getChartLabelFormat(getters, range) {
|
|
8539
|
+
function getChartLabelFormat(getters, range, shouldRemoveFirstLabel) {
|
|
8505
8540
|
if (!range)
|
|
8506
8541
|
return undefined;
|
|
8507
|
-
const { sheetId, zone
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
return format;
|
|
8512
|
-
}
|
|
8542
|
+
const { sheetId, zone } = range;
|
|
8543
|
+
const formats = positions(zone).map((position) => getters.getEvaluatedCell({ sheetId, ...position }).format);
|
|
8544
|
+
if (shouldRemoveFirstLabel) {
|
|
8545
|
+
formats.shift();
|
|
8513
8546
|
}
|
|
8514
|
-
return undefined;
|
|
8547
|
+
return formats.find((format) => format !== undefined);
|
|
8515
8548
|
}
|
|
8516
8549
|
function getChartLabelValues(getters, dataSets, labelRange) {
|
|
8517
8550
|
let labels = { values: [], formattedValues: [] };
|
|
@@ -8792,9 +8825,7 @@
|
|
|
8792
8825
|
const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
|
|
8793
8826
|
let labels = labelValues.formattedValues;
|
|
8794
8827
|
let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
|
|
8795
|
-
if (chart.dataSetsHaveTitle
|
|
8796
|
-
dataSetsValues[0] &&
|
|
8797
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
8828
|
+
if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
|
|
8798
8829
|
labels.shift();
|
|
8799
8830
|
}
|
|
8800
8831
|
({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
|
|
@@ -9338,8 +9369,8 @@
|
|
|
9338
9369
|
}
|
|
9339
9370
|
return { labels: newLabels, dataSetsValues: newDatasets };
|
|
9340
9371
|
}
|
|
9341
|
-
function canChartParseLabels(
|
|
9342
|
-
return canBeDateChart(
|
|
9372
|
+
function canChartParseLabels(chart, getters) {
|
|
9373
|
+
return canBeDateChart(chart, getters) || canBeLinearChart(chart, getters);
|
|
9343
9374
|
}
|
|
9344
9375
|
function getChartAxisType(chart, getters) {
|
|
9345
9376
|
if (isDateChart(chart, getters) && isLuxonTimeAdapterInstalled()) {
|
|
@@ -9351,23 +9382,26 @@
|
|
|
9351
9382
|
return "category";
|
|
9352
9383
|
}
|
|
9353
9384
|
function isDateChart(chart, getters) {
|
|
9354
|
-
return !chart.labelsAsText && canBeDateChart(chart
|
|
9385
|
+
return !chart.labelsAsText && canBeDateChart(chart, getters);
|
|
9355
9386
|
}
|
|
9356
9387
|
function isLinearChart(chart, getters) {
|
|
9357
|
-
return !chart.labelsAsText && canBeLinearChart(chart
|
|
9388
|
+
return !chart.labelsAsText && canBeLinearChart(chart, getters);
|
|
9358
9389
|
}
|
|
9359
|
-
function canBeDateChart(
|
|
9360
|
-
if (!labelRange || !canBeLinearChart(
|
|
9390
|
+
function canBeDateChart(chart, getters) {
|
|
9391
|
+
if (!chart.labelRange || !canBeLinearChart(chart, getters)) {
|
|
9361
9392
|
return false;
|
|
9362
9393
|
}
|
|
9363
|
-
const labelFormat = getChartLabelFormat(getters, labelRange);
|
|
9394
|
+
const labelFormat = getChartLabelFormat(getters, chart.labelRange, shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle));
|
|
9364
9395
|
return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
|
|
9365
9396
|
}
|
|
9366
|
-
function canBeLinearChart(
|
|
9367
|
-
if (!labelRange) {
|
|
9397
|
+
function canBeLinearChart(chart, getters) {
|
|
9398
|
+
if (!chart.labelRange) {
|
|
9368
9399
|
return false;
|
|
9369
9400
|
}
|
|
9370
|
-
const labels = getters.getRangeValues(labelRange);
|
|
9401
|
+
const labels = getters.getRangeValues(chart.labelRange);
|
|
9402
|
+
if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
|
|
9403
|
+
labels.shift();
|
|
9404
|
+
}
|
|
9371
9405
|
if (labels.some((label) => isNaN(Number(label)) && label)) {
|
|
9372
9406
|
return false;
|
|
9373
9407
|
}
|
|
@@ -9441,9 +9475,8 @@
|
|
|
9441
9475
|
const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
|
|
9442
9476
|
let labels = axisType === "linear" ? labelValues.values : labelValues.formattedValues;
|
|
9443
9477
|
let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
9478
|
+
const removeFirstLabel = shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle);
|
|
9479
|
+
if (removeFirstLabel) {
|
|
9447
9480
|
labels.shift();
|
|
9448
9481
|
}
|
|
9449
9482
|
({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
|
|
@@ -9458,7 +9491,7 @@
|
|
|
9458
9491
|
const dataSetFormat = getChartDatasetFormat(getters, chart.dataSets);
|
|
9459
9492
|
const options = { format: dataSetFormat, locale, truncateLabels };
|
|
9460
9493
|
const config = getLineConfiguration(chart, labels, options);
|
|
9461
|
-
const labelFormat = getChartLabelFormat(getters, chart.labelRange);
|
|
9494
|
+
const labelFormat = getChartLabelFormat(getters, chart.labelRange, removeFirstLabel);
|
|
9462
9495
|
if (axisType === "time") {
|
|
9463
9496
|
const axis = {
|
|
9464
9497
|
type: "time",
|
|
@@ -9680,9 +9713,7 @@
|
|
|
9680
9713
|
const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
|
|
9681
9714
|
let labels = labelValues.formattedValues;
|
|
9682
9715
|
let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
|
|
9683
|
-
if (chart.dataSetsHaveTitle
|
|
9684
|
-
dataSetsValues[0] &&
|
|
9685
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
9716
|
+
if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
|
|
9686
9717
|
labels.shift();
|
|
9687
9718
|
}
|
|
9688
9719
|
({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
|
|
@@ -10203,21 +10234,22 @@
|
|
|
10203
10234
|
}
|
|
10204
10235
|
// Only display legend for several datasets.
|
|
10205
10236
|
const newLegendPos = dataSetZone.right === dataSetZone.left ? "none" : "top";
|
|
10206
|
-
const
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10237
|
+
const lineChartDefinition = {
|
|
10238
|
+
title,
|
|
10239
|
+
dataSets,
|
|
10240
|
+
labelsAsText: false,
|
|
10241
|
+
stacked: false,
|
|
10242
|
+
aggregated: false,
|
|
10243
|
+
cumulative: false,
|
|
10244
|
+
labelRange: labelRangeXc,
|
|
10245
|
+
type: "line",
|
|
10246
|
+
dataSetsHaveTitle,
|
|
10247
|
+
verticalAxisPosition: "left",
|
|
10248
|
+
legendPosition: newLegendPos,
|
|
10249
|
+
};
|
|
10250
|
+
const chart = new LineChart(lineChartDefinition, sheetId, getters);
|
|
10251
|
+
if (canChartParseLabels(chart, getters)) {
|
|
10252
|
+
return lineChartDefinition;
|
|
10221
10253
|
}
|
|
10222
10254
|
return {
|
|
10223
10255
|
title,
|
|
@@ -10817,7 +10849,7 @@
|
|
|
10817
10849
|
//------------------------------------------------------------------------------
|
|
10818
10850
|
const CREATE_CHART = (env) => {
|
|
10819
10851
|
const getters = env.model.getters;
|
|
10820
|
-
const id = env.model.uuidGenerator.
|
|
10852
|
+
const id = env.model.uuidGenerator.smallUuid();
|
|
10821
10853
|
const sheetId = getters.getActiveSheetId();
|
|
10822
10854
|
if (getZoneArea(env.model.getters.getSelectedZone()) === 1) {
|
|
10823
10855
|
env.model.selection.selectTableAroundSelection();
|
|
@@ -10851,7 +10883,7 @@
|
|
|
10851
10883
|
const CREATE_IMAGE = async (env) => {
|
|
10852
10884
|
if (env.imageProvider) {
|
|
10853
10885
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
10854
|
-
const figureId = env.model.uuidGenerator.
|
|
10886
|
+
const figureId = env.model.uuidGenerator.smallUuid();
|
|
10855
10887
|
const image = await requestImage(env);
|
|
10856
10888
|
if (!image) {
|
|
10857
10889
|
throw new Error("No image provider was given to the environment");
|
|
@@ -12572,6 +12604,26 @@
|
|
|
12572
12604
|
isExported: true,
|
|
12573
12605
|
};
|
|
12574
12606
|
// -----------------------------------------------------------------------------
|
|
12607
|
+
// LOG
|
|
12608
|
+
// -----------------------------------------------------------------------------
|
|
12609
|
+
const LOG = {
|
|
12610
|
+
description: _t("The logarithm of a number, for a given base."),
|
|
12611
|
+
args: [
|
|
12612
|
+
arg("value (number)", _t("The value for which to calculate the logarithm.")),
|
|
12613
|
+
arg("base (number, default=10)", _t("The base of the logarithm.")),
|
|
12614
|
+
],
|
|
12615
|
+
returns: ["NUMBER"],
|
|
12616
|
+
compute: function (value, base = 10) {
|
|
12617
|
+
const _value = toNumber(value, this.locale);
|
|
12618
|
+
const _base = toNumber(base, this.locale);
|
|
12619
|
+
assert(() => _value > 0, _t("The value (%s) must be strictly positive.", _value.toString()));
|
|
12620
|
+
assert(() => _base > 0, _t("The base (%s) must be strictly positive.", _base.toString()));
|
|
12621
|
+
assert(() => _base !== 1, _t("The base must be different from 1."));
|
|
12622
|
+
return Math.log10(_value) / Math.log10(_base);
|
|
12623
|
+
},
|
|
12624
|
+
isExported: true,
|
|
12625
|
+
};
|
|
12626
|
+
// -----------------------------------------------------------------------------
|
|
12575
12627
|
// MOD
|
|
12576
12628
|
// -----------------------------------------------------------------------------
|
|
12577
12629
|
const MOD = {
|
|
@@ -13092,6 +13144,7 @@
|
|
|
13092
13144
|
ISODD: ISODD,
|
|
13093
13145
|
ISO_CEILING: ISO_CEILING,
|
|
13094
13146
|
LN: LN,
|
|
13147
|
+
LOG: LOG,
|
|
13095
13148
|
MOD: MOD,
|
|
13096
13149
|
MUNIT: MUNIT,
|
|
13097
13150
|
ODD: ODD,
|
|
@@ -15953,7 +16006,7 @@
|
|
|
15953
16006
|
}
|
|
15954
16007
|
}
|
|
15955
16008
|
},
|
|
15956
|
-
isExported:
|
|
16009
|
+
isExported: false,
|
|
15957
16010
|
};
|
|
15958
16011
|
// -----------------------------------------------------------------------------
|
|
15959
16012
|
// UNIQUE
|
|
@@ -19854,7 +19907,7 @@
|
|
|
19854
19907
|
execute: (env) => {
|
|
19855
19908
|
const activeSheetId = env.model.getters.getActiveSheetId();
|
|
19856
19909
|
const position = env.model.getters.getSheetIds().indexOf(activeSheetId) + 1;
|
|
19857
|
-
const sheetId = env.model.uuidGenerator.
|
|
19910
|
+
const sheetId = env.model.uuidGenerator.smallUuid();
|
|
19858
19911
|
env.model.dispatch("CREATE_SHEET", { sheetId, position });
|
|
19859
19912
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
|
|
19860
19913
|
},
|
|
@@ -21530,7 +21583,7 @@
|
|
|
21530
21583
|
*/
|
|
21531
21584
|
class SelectionInput extends owl.Component {
|
|
21532
21585
|
static template = "o-spreadsheet-SelectionInput";
|
|
21533
|
-
id = uuidGenerator$1.
|
|
21586
|
+
id = uuidGenerator$1.smallUuid();
|
|
21534
21587
|
previousRanges = this.props.ranges() || [];
|
|
21535
21588
|
originSheet = this.env.model.getters.getActiveSheetId();
|
|
21536
21589
|
state = owl.useState({
|
|
@@ -22580,7 +22633,7 @@
|
|
|
22580
22633
|
get canTreatLabelsAsText() {
|
|
22581
22634
|
const chart = this.env.model.getters.getChart(this.props.figureId);
|
|
22582
22635
|
if (chart && chart instanceof LineChart) {
|
|
22583
|
-
return canChartParseLabels(chart
|
|
22636
|
+
return canChartParseLabels(chart, this.env.model.getters);
|
|
22584
22637
|
}
|
|
22585
22638
|
return false;
|
|
22586
22639
|
}
|
|
@@ -23608,7 +23661,7 @@
|
|
|
23608
23661
|
state;
|
|
23609
23662
|
setup() {
|
|
23610
23663
|
const cf = this.props.editedCf || {
|
|
23611
|
-
id: this.env.model.uuidGenerator.
|
|
23664
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
23612
23665
|
ranges: this.env.model.getters
|
|
23613
23666
|
.getSelectedZones()
|
|
23614
23667
|
.map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone)),
|
|
@@ -25557,7 +25610,7 @@
|
|
|
25557
25610
|
.getSelectedZones()
|
|
25558
25611
|
.map((zone) => zoneToXc(this.env.model.getters.getUnboundedZone(sheetId, zone)));
|
|
25559
25612
|
return {
|
|
25560
|
-
id: this.env.model.uuidGenerator.
|
|
25613
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
25561
25614
|
criterion: { type: "textContains", values: [""] },
|
|
25562
25615
|
ranges,
|
|
25563
25616
|
};
|
|
@@ -34177,7 +34230,7 @@
|
|
|
34177
34230
|
for (const sheet of data.sheets || []) {
|
|
34178
34231
|
for (const figure of sheet.figures || []) {
|
|
34179
34232
|
if (figureIds.has(figure.id)) {
|
|
34180
|
-
figure.id += uuidGenerator.
|
|
34233
|
+
figure.id += uuidGenerator.smallUuid();
|
|
34181
34234
|
}
|
|
34182
34235
|
figureIds.add(figure.id);
|
|
34183
34236
|
}
|
|
@@ -35853,6 +35906,10 @@
|
|
|
35853
35906
|
return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
|
|
35854
35907
|
case "CLEAR_CELL":
|
|
35855
35908
|
return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
|
|
35909
|
+
case "UPDATE_CELL_POSITION":
|
|
35910
|
+
return !cmd.cellId || this.cells[cmd.sheetId]?.[cmd.cellId]
|
|
35911
|
+
? "Success" /* CommandResult.Success */
|
|
35912
|
+
: "InvalidCellId" /* CommandResult.InvalidCellId */;
|
|
35856
35913
|
default:
|
|
35857
35914
|
return "Success" /* CommandResult.Success */;
|
|
35858
35915
|
}
|
|
@@ -35894,6 +35951,9 @@
|
|
|
35894
35951
|
case "CLEAR_CELLS":
|
|
35895
35952
|
this.clearCells(cmd.sheetId, cmd.target);
|
|
35896
35953
|
break;
|
|
35954
|
+
case "DELETE_SHEET": {
|
|
35955
|
+
this.history.update("cells", cmd.sheetId, undefined);
|
|
35956
|
+
}
|
|
35897
35957
|
}
|
|
35898
35958
|
}
|
|
35899
35959
|
/**
|
|
@@ -36972,8 +37032,14 @@
|
|
|
36972
37032
|
allowDispatch(cmd) {
|
|
36973
37033
|
switch (cmd.type) {
|
|
36974
37034
|
case "ADD_DATA_VALIDATION_RULE":
|
|
37035
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) {
|
|
37036
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
37037
|
+
}
|
|
36975
37038
|
return this.checkValidations(cmd, this.chainValidations(this.checkCriterionTypeIsValid, this.checkCriterionHasValidNumberOfValues, this.checkCriterionValuesAreValid));
|
|
36976
37039
|
case "REMOVE_DATA_VALIDATION_RULE":
|
|
37040
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) {
|
|
37041
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
37042
|
+
}
|
|
36977
37043
|
if (!this.rules[cmd.sheetId].find((rule) => rule.id === cmd.id)) {
|
|
36978
37044
|
return "UnknownDataValidationRule" /* CommandResult.UnknownDataValidationRule */;
|
|
36979
37045
|
}
|
|
@@ -37147,6 +37213,7 @@
|
|
|
37147
37213
|
class FigurePlugin extends CorePlugin {
|
|
37148
37214
|
static getters = ["getFigures", "getFigure", "getFigureSheetId"];
|
|
37149
37215
|
figures = {};
|
|
37216
|
+
insertionOrders = []; // TODO use a list in master
|
|
37150
37217
|
// ---------------------------------------------------------------------------
|
|
37151
37218
|
// Command Handling
|
|
37152
37219
|
// ---------------------------------------------------------------------------
|
|
@@ -37249,11 +37316,14 @@
|
|
|
37249
37316
|
}
|
|
37250
37317
|
addFigure(figure, sheetId) {
|
|
37251
37318
|
this.history.update("figures", sheetId, figure.id, figure);
|
|
37319
|
+
this.history.update("insertionOrders", this.insertionOrders.length, figure.id);
|
|
37252
37320
|
}
|
|
37253
37321
|
deleteSheet(sheetId) {
|
|
37322
|
+
this.history.update("insertionOrders", this.insertionOrders.filter((id) => !this.figures[sheetId]?.[id]));
|
|
37254
37323
|
this.history.update("figures", sheetId, undefined);
|
|
37255
37324
|
}
|
|
37256
37325
|
removeFigure(id, sheetId) {
|
|
37326
|
+
this.history.update("insertionOrders", this.insertionOrders.filter((figureId) => figureId !== id));
|
|
37257
37327
|
this.history.update("figures", sheetId, id, undefined);
|
|
37258
37328
|
}
|
|
37259
37329
|
checkFigureExists(sheetId, figureId) {
|
|
@@ -37272,7 +37342,14 @@
|
|
|
37272
37342
|
// Getters
|
|
37273
37343
|
// ---------------------------------------------------------------------------
|
|
37274
37344
|
getFigures(sheetId) {
|
|
37275
|
-
|
|
37345
|
+
const figures = [];
|
|
37346
|
+
for (const figureId of this.insertionOrders) {
|
|
37347
|
+
const figure = this.figures[sheetId]?.[figureId];
|
|
37348
|
+
if (figure) {
|
|
37349
|
+
figures.push(figure);
|
|
37350
|
+
}
|
|
37351
|
+
}
|
|
37352
|
+
return figures;
|
|
37276
37353
|
}
|
|
37277
37354
|
getFigure(sheetId, figureId) {
|
|
37278
37355
|
return this.figures[sheetId]?.[figureId];
|
|
@@ -37285,11 +37362,9 @@
|
|
|
37285
37362
|
// ---------------------------------------------------------------------------
|
|
37286
37363
|
import(data) {
|
|
37287
37364
|
for (let sheet of data.sheets) {
|
|
37288
|
-
const figures
|
|
37289
|
-
|
|
37290
|
-
|
|
37291
|
-
});
|
|
37292
|
-
this.figures[sheet.id] = figures;
|
|
37365
|
+
for (const figure of sheet.figures) {
|
|
37366
|
+
this.addFigure(figure, sheet.id);
|
|
37367
|
+
}
|
|
37293
37368
|
}
|
|
37294
37369
|
}
|
|
37295
37370
|
export(data) {
|
|
@@ -37313,10 +37388,10 @@
|
|
|
37313
37388
|
this.filters = [];
|
|
37314
37389
|
this.zone = zone;
|
|
37315
37390
|
const uuid = new UuidGenerator();
|
|
37316
|
-
this.id = uuid.
|
|
37391
|
+
this.id = uuid.smallUuid();
|
|
37317
37392
|
for (const i of range(zone.left, zone.right + 1)) {
|
|
37318
37393
|
const filterZone = { ...this.zone, left: i, right: i };
|
|
37319
|
-
this.filters.push(new Filter(uuid.
|
|
37394
|
+
this.filters.push(new Filter(uuid.smallUuid(), filterZone));
|
|
37320
37395
|
}
|
|
37321
37396
|
}
|
|
37322
37397
|
/** Get zone of the table without the headers */
|
|
@@ -37518,7 +37593,7 @@
|
|
|
37518
37593
|
if (filters.length < zoneToDimension(zone).numberOfCols) {
|
|
37519
37594
|
for (let col = zone.left; col <= zone.right; col++) {
|
|
37520
37595
|
if (!filters.find((filter) => filter.col === col)) {
|
|
37521
|
-
filters.push(new Filter(this.uuidGenerator.
|
|
37596
|
+
filters.push(new Filter(this.uuidGenerator.smallUuid(), { ...zone, left: col, right: col }));
|
|
37522
37597
|
}
|
|
37523
37598
|
}
|
|
37524
37599
|
filters.sort((f1, f2) => f1.col - f2.col);
|
|
@@ -39007,6 +39082,9 @@
|
|
|
39007
39082
|
case "CREATE_SHEET": {
|
|
39008
39083
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
39009
39084
|
}
|
|
39085
|
+
case "DUPLICATE_SHEET": {
|
|
39086
|
+
return this.sheets[cmd.sheetIdTo] ? "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */ : "Success" /* CommandResult.Success */;
|
|
39087
|
+
}
|
|
39010
39088
|
case "MOVE_SHEET":
|
|
39011
39089
|
try {
|
|
39012
39090
|
const currentIndex = this.orderedSheetIds.findIndex((id) => id === cmd.sheetId);
|
|
@@ -39019,7 +39097,7 @@
|
|
|
39019
39097
|
case "RENAME_SHEET":
|
|
39020
39098
|
return this.isRenameAllowed(cmd);
|
|
39021
39099
|
case "DELETE_SHEET":
|
|
39022
|
-
return this.
|
|
39100
|
+
return this.getVisibleSheetIds().length > 1
|
|
39023
39101
|
? "Success" /* CommandResult.Success */
|
|
39024
39102
|
: "NotEnoughSheets" /* CommandResult.NotEnoughSheets */;
|
|
39025
39103
|
case "ADD_COLUMNS_ROWS":
|
|
@@ -39832,6 +39910,10 @@
|
|
|
39832
39910
|
checkZonesAreInSheet(cmd) {
|
|
39833
39911
|
if (!("sheetId" in cmd))
|
|
39834
39912
|
return "Success" /* CommandResult.Success */;
|
|
39913
|
+
if ("ranges" in cmd &&
|
|
39914
|
+
cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) {
|
|
39915
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
39916
|
+
}
|
|
39835
39917
|
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
39836
39918
|
}
|
|
39837
39919
|
}
|
|
@@ -39851,7 +39933,10 @@
|
|
|
39851
39933
|
allowDispatch(cmd) {
|
|
39852
39934
|
switch (cmd.type) {
|
|
39853
39935
|
case "GROUP_HEADERS": {
|
|
39854
|
-
const { start, end } = cmd;
|
|
39936
|
+
const { start, end, sheetId } = cmd;
|
|
39937
|
+
if (!this.getters.tryGetSheet(sheetId)) {
|
|
39938
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
39939
|
+
}
|
|
39855
39940
|
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) {
|
|
39856
39941
|
return "InvalidHeaderGroupStartEnd" /* CommandResult.InvalidHeaderGroupStartEnd */;
|
|
39857
39942
|
}
|
|
@@ -39864,7 +39949,10 @@
|
|
|
39864
39949
|
break;
|
|
39865
39950
|
}
|
|
39866
39951
|
case "UNGROUP_HEADERS": {
|
|
39867
|
-
const { start, end } = cmd;
|
|
39952
|
+
const { start, end, sheetId } = cmd;
|
|
39953
|
+
if (!this.getters.tryGetSheet(sheetId)) {
|
|
39954
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
39955
|
+
}
|
|
39868
39956
|
if (!this.getters.doesHeadersExist(cmd.sheetId, cmd.dimension, [start, end])) {
|
|
39869
39957
|
return "InvalidHeaderGroupStartEnd" /* CommandResult.InvalidHeaderGroupStartEnd */;
|
|
39870
39958
|
}
|
|
@@ -39875,6 +39963,9 @@
|
|
|
39875
39963
|
}
|
|
39876
39964
|
case "UNFOLD_HEADER_GROUP":
|
|
39877
39965
|
case "FOLD_HEADER_GROUP":
|
|
39966
|
+
if (!this.getters.tryGetSheet(cmd.sheetId)) {
|
|
39967
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
39968
|
+
}
|
|
39878
39969
|
const group = this.findGroupWithStartEnd(cmd.sheetId, cmd.dimension, cmd.start, cmd.end);
|
|
39879
39970
|
if (!group) {
|
|
39880
39971
|
return "UnknownHeaderGroup" /* CommandResult.UnknownHeaderGroup */;
|
|
@@ -44144,6 +44235,9 @@
|
|
|
44144
44235
|
};
|
|
44145
44236
|
}
|
|
44146
44237
|
function createSheetTransformation(toTransform, executed) {
|
|
44238
|
+
if (toTransform.sheetId === executed.sheetId) {
|
|
44239
|
+
toTransform = { ...toTransform, sheetId: `${toTransform.sheetId}~` };
|
|
44240
|
+
}
|
|
44147
44241
|
if (toTransform.name === executed.name) {
|
|
44148
44242
|
return {
|
|
44149
44243
|
...toTransform,
|
|
@@ -44780,21 +44874,14 @@
|
|
|
44780
44874
|
if (!message)
|
|
44781
44875
|
return;
|
|
44782
44876
|
if (message.type === "REMOTE_REVISION") {
|
|
44783
|
-
|
|
44877
|
+
let revision = this.revisions.get(message.nextRevisionId);
|
|
44784
44878
|
if (revision.commands.length === 0) {
|
|
44785
44879
|
/**
|
|
44786
|
-
* The command is empty, we have to
|
|
44880
|
+
* The command is empty, we have to rebase all the next local revisions
|
|
44787
44881
|
* to avoid issues with undo/redo
|
|
44788
44882
|
*/
|
|
44789
|
-
this.revisions.
|
|
44790
|
-
|
|
44791
|
-
.filter((message) => message.type === "REMOTE_REVISION")
|
|
44792
|
-
.map((message) => message.nextRevisionId);
|
|
44793
|
-
this.trigger("pending-revisions-dropped", { revisionIds });
|
|
44794
|
-
this.waitingAck = false;
|
|
44795
|
-
this.waitingUndoRedoAck = false;
|
|
44796
|
-
this.pendingMessages = [];
|
|
44797
|
-
return;
|
|
44883
|
+
this.revisions.rebase(revision.id);
|
|
44884
|
+
revision = this.revisions.get(message.nextRevisionId);
|
|
44798
44885
|
}
|
|
44799
44886
|
message = {
|
|
44800
44887
|
...message,
|
|
@@ -44818,7 +44905,6 @@
|
|
|
44818
44905
|
switch (message.type) {
|
|
44819
44906
|
case "REMOTE_REVISION":
|
|
44820
44907
|
case "REVISION_REDONE":
|
|
44821
|
-
case "REVISION_UNDONE":
|
|
44822
44908
|
case "SNAPSHOT_CREATED":
|
|
44823
44909
|
this.waitingAck = false;
|
|
44824
44910
|
this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
|
|
@@ -44826,6 +44912,25 @@
|
|
|
44826
44912
|
this.processedRevisions.add(message.nextRevisionId);
|
|
44827
44913
|
this.sendPendingMessage();
|
|
44828
44914
|
break;
|
|
44915
|
+
case "REVISION_UNDONE": {
|
|
44916
|
+
this.waitingAck = false;
|
|
44917
|
+
this.pendingMessages = this.pendingMessages.filter((msg) => msg.nextRevisionId !== message.nextRevisionId);
|
|
44918
|
+
const firstPendingRevisionId = this.pendingMessages.findIndex((message) => message.type === "REMOTE_REVISION");
|
|
44919
|
+
if (firstPendingRevisionId !== -1) {
|
|
44920
|
+
/**
|
|
44921
|
+
* Some revisions undergo transformations that may cause issues with
|
|
44922
|
+
* undo/redo if the transformation is destructive (we don't get back
|
|
44923
|
+
* the original command by transforming it with the inverse).
|
|
44924
|
+
* To prevent these problems, we must rebase all subsequent local
|
|
44925
|
+
* revisions.
|
|
44926
|
+
*/
|
|
44927
|
+
this.revisions.rebase(this.pendingMessages[firstPendingRevisionId].nextRevisionId);
|
|
44928
|
+
}
|
|
44929
|
+
this.serverRevisionId = message.nextRevisionId;
|
|
44930
|
+
this.processedRevisions.add(message.nextRevisionId);
|
|
44931
|
+
this.sendPendingMessage();
|
|
44932
|
+
break;
|
|
44933
|
+
}
|
|
44829
44934
|
}
|
|
44830
44935
|
}
|
|
44831
44936
|
isAlreadyProcessed(message) {
|
|
@@ -45530,7 +45635,9 @@
|
|
|
45530
45635
|
const cfInTarget = this.getters
|
|
45531
45636
|
.getConditionalFormats(targetSheetId)
|
|
45532
45637
|
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
45533
|
-
return cfInTarget
|
|
45638
|
+
return cfInTarget
|
|
45639
|
+
? cfInTarget
|
|
45640
|
+
: { ...originCF, id: this.uuidGenerator.smallUuid(), ranges: [] };
|
|
45534
45641
|
}
|
|
45535
45642
|
pasteDataValidation(origin, target) {
|
|
45536
45643
|
const rule = this.getters.getValidationRuleForCell(origin);
|
|
@@ -45562,7 +45669,7 @@
|
|
|
45562
45669
|
originRule.isBlocking === rule.isBlocking);
|
|
45563
45670
|
return ruleInTargetSheet
|
|
45564
45671
|
? ruleInTargetSheet
|
|
45565
|
-
: { ...originRule, id: this.uuidGenerator.
|
|
45672
|
+
: { ...originRule, id: this.uuidGenerator.smallUuid(), ranges: [] };
|
|
45566
45673
|
}
|
|
45567
45674
|
/**
|
|
45568
45675
|
* Add or remove XCs to a given data validation rule.
|
|
@@ -47754,6 +47861,10 @@
|
|
|
47754
47861
|
*/
|
|
47755
47862
|
checkZonesAreInSheet(cmd) {
|
|
47756
47863
|
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
47864
|
+
if ("ranges" in cmd &&
|
|
47865
|
+
cmd.ranges.some((rangeData) => !this.getters.tryGetSheet(rangeData._sheetId))) {
|
|
47866
|
+
return "InvalidSheetId" /* CommandResult.InvalidSheetId */;
|
|
47867
|
+
}
|
|
47757
47868
|
const zones = this.getters.getCommandZones(cmd);
|
|
47758
47869
|
if (!sheetId && zones.length > 0) {
|
|
47759
47870
|
return "NoActiveSheet" /* CommandResult.NoActiveSheet */;
|
|
@@ -47802,23 +47913,23 @@
|
|
|
47802
47913
|
function repeatCreateChartCommand(getters, cmd) {
|
|
47803
47914
|
return {
|
|
47804
47915
|
...repeatSheetDependantCommand(getters, cmd),
|
|
47805
|
-
id: uuidGenerator.
|
|
47916
|
+
id: uuidGenerator.smallUuid(),
|
|
47806
47917
|
};
|
|
47807
47918
|
}
|
|
47808
47919
|
function repeatCreateImageCommand(getters, cmd) {
|
|
47809
47920
|
return {
|
|
47810
47921
|
...repeatSheetDependantCommand(getters, cmd),
|
|
47811
|
-
figureId: uuidGenerator.
|
|
47922
|
+
figureId: uuidGenerator.smallUuid(),
|
|
47812
47923
|
};
|
|
47813
47924
|
}
|
|
47814
47925
|
function repeatCreateFigureCommand(getters, cmd) {
|
|
47815
47926
|
const newCmd = repeatSheetDependantCommand(getters, cmd);
|
|
47816
|
-
newCmd.figure.id = uuidGenerator.
|
|
47927
|
+
newCmd.figure.id = uuidGenerator.smallUuid();
|
|
47817
47928
|
return newCmd;
|
|
47818
47929
|
}
|
|
47819
47930
|
function repeatCreateSheetCommand(getters, cmd) {
|
|
47820
47931
|
const newCmd = deepCopy(cmd);
|
|
47821
|
-
newCmd.sheetId = uuidGenerator.
|
|
47932
|
+
newCmd.sheetId = uuidGenerator.smallUuid();
|
|
47822
47933
|
const sheetName = cmd.name || getters.getSheet(getters.getActiveSheetId()).name;
|
|
47823
47934
|
// Extract the prefix of the sheet name (everything before the number at the end of the name)
|
|
47824
47935
|
const namePrefix = sheetName.match(/(.+?)\d*$/)?.[1] || sheetName;
|
|
@@ -48013,7 +48124,6 @@
|
|
|
48013
48124
|
super(config);
|
|
48014
48125
|
this.session = config.session;
|
|
48015
48126
|
this.session.on("new-local-state-update", this, this.onNewLocalStateUpdate);
|
|
48016
|
-
this.session.on("pending-revisions-dropped", this, ({ revisionIds }) => this.drop(revisionIds));
|
|
48017
48127
|
this.session.on("snapshot", this, () => {
|
|
48018
48128
|
this.undoStack = [];
|
|
48019
48129
|
this.redoStack = [];
|
|
@@ -48083,10 +48193,6 @@
|
|
|
48083
48193
|
const lastNonRedoRevision = this.getPossibleRevisionToRepeat();
|
|
48084
48194
|
return canRepeatRevision(lastNonRedoRevision);
|
|
48085
48195
|
}
|
|
48086
|
-
drop(revisionIds) {
|
|
48087
|
-
this.undoStack = this.undoStack.filter((id) => !revisionIds.includes(id));
|
|
48088
|
-
this.redoStack = [];
|
|
48089
|
-
}
|
|
48090
48196
|
onNewLocalStateUpdate({ id }) {
|
|
48091
48197
|
this.undoStack.push(id);
|
|
48092
48198
|
this.redoStack = [];
|
|
@@ -48353,7 +48459,7 @@
|
|
|
48353
48459
|
x: maxX < width ? 0 : Math.min(targetX, maxX - width),
|
|
48354
48460
|
y: maxY < height ? 0 : Math.min(targetY, maxY - height),
|
|
48355
48461
|
};
|
|
48356
|
-
const newId = new UuidGenerator().
|
|
48462
|
+
const newId = new UuidGenerator().smallUuid();
|
|
48357
48463
|
this.copiedFigureContent.paste(sheetId, newId, position, { height, width });
|
|
48358
48464
|
if (this.operation === "CUT") {
|
|
48359
48465
|
this.dispatch("DELETE_FIGURE", {
|
|
@@ -50056,23 +50162,7 @@
|
|
|
50056
50162
|
gridSelection: deepCopy(gridSelection),
|
|
50057
50163
|
};
|
|
50058
50164
|
}
|
|
50059
|
-
|
|
50060
|
-
const currentSheetIds = this.getters.getVisibleSheetIds();
|
|
50061
|
-
this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
|
|
50062
|
-
if (this.activeSheet.id in this.sheetsData) {
|
|
50063
|
-
const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
|
|
50064
|
-
this.selectCell(anchor.cell.col, anchor.cell.row);
|
|
50065
|
-
}
|
|
50066
|
-
else {
|
|
50067
|
-
this.selectCell(0, 0);
|
|
50068
|
-
}
|
|
50069
|
-
const { col, row } = this.gridSelection.anchor.cell;
|
|
50070
|
-
this.moveClient({
|
|
50071
|
-
sheetId: this.getters.getActiveSheetId(),
|
|
50072
|
-
col,
|
|
50073
|
-
row,
|
|
50074
|
-
});
|
|
50075
|
-
}
|
|
50165
|
+
this.fallbackToVisibleSheet();
|
|
50076
50166
|
const sheetId = this.getters.getActiveSheetId();
|
|
50077
50167
|
this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
|
|
50078
50168
|
this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
|
|
@@ -50082,6 +50172,7 @@
|
|
|
50082
50172
|
}
|
|
50083
50173
|
}
|
|
50084
50174
|
finalize() {
|
|
50175
|
+
this.fallbackToVisibleSheet();
|
|
50085
50176
|
/** Any change to the selection has to be reflected in the selection processor. */
|
|
50086
50177
|
this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
|
|
50087
50178
|
}
|
|
@@ -50433,6 +50524,25 @@
|
|
|
50433
50524
|
}
|
|
50434
50525
|
return "Success" /* CommandResult.Success */;
|
|
50435
50526
|
}
|
|
50527
|
+
fallbackToVisibleSheet() {
|
|
50528
|
+
if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
|
|
50529
|
+
const currentSheetIds = this.getters.getVisibleSheetIds();
|
|
50530
|
+
this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
|
|
50531
|
+
if (this.activeSheet.id in this.sheetsData) {
|
|
50532
|
+
const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
|
|
50533
|
+
this.selectCell(anchor.cell.col, anchor.cell.row);
|
|
50534
|
+
}
|
|
50535
|
+
else {
|
|
50536
|
+
this.selectCell(0, 0);
|
|
50537
|
+
}
|
|
50538
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
50539
|
+
this.moveClient({
|
|
50540
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
50541
|
+
col,
|
|
50542
|
+
row,
|
|
50543
|
+
});
|
|
50544
|
+
}
|
|
50545
|
+
}
|
|
50436
50546
|
//-------------------------------------------
|
|
50437
50547
|
// Helpers for extensions
|
|
50438
50548
|
// ------------------------------------------
|
|
@@ -51580,7 +51690,9 @@
|
|
|
51580
51690
|
case "UNGROUP_HEADERS":
|
|
51581
51691
|
case "GROUP_HEADERS":
|
|
51582
51692
|
case "CREATE_SHEET":
|
|
51583
|
-
this.
|
|
51693
|
+
if (this.getters.tryGetSheet(cmd.sheetId)) {
|
|
51694
|
+
this.headerPositions[cmd.sheetId] = this.computeHeaderPositionsOfSheet(cmd.sheetId);
|
|
51695
|
+
}
|
|
51584
51696
|
break;
|
|
51585
51697
|
case "DUPLICATE_SHEET":
|
|
51586
51698
|
this.headerPositions[cmd.sheetIdTo] = deepCopy(this.headerPositions[cmd.sheetId]);
|
|
@@ -51588,12 +51700,14 @@
|
|
|
51588
51700
|
}
|
|
51589
51701
|
}
|
|
51590
51702
|
finalize() {
|
|
51591
|
-
|
|
51592
|
-
|
|
51703
|
+
for (const sheetId of this.getters.getSheetIds()) {
|
|
51704
|
+
// sheets can be created without this plugin being aware of it
|
|
51705
|
+
// in concurrent situations.
|
|
51706
|
+
if (this.isDirty || !this.headerPositions[sheetId]) {
|
|
51593
51707
|
this.headerPositions[sheetId] = this.computeHeaderPositionsOfSheet(sheetId);
|
|
51594
51708
|
}
|
|
51595
|
-
this.isDirty = false;
|
|
51596
51709
|
}
|
|
51710
|
+
this.isDirty = false;
|
|
51597
51711
|
}
|
|
51598
51712
|
/**
|
|
51599
51713
|
* Returns the size, start and end coordinates of a column on an unfolded sheet
|
|
@@ -52277,7 +52391,7 @@
|
|
|
52277
52391
|
clickAddSheet(ev) {
|
|
52278
52392
|
const activeSheetId = this.env.model.getters.getActiveSheetId();
|
|
52279
52393
|
const position = this.env.model.getters.getSheetIds().findIndex((sheetId) => sheetId === activeSheetId) + 1;
|
|
52280
|
-
const sheetId = this.env.model.uuidGenerator.
|
|
52394
|
+
const sheetId = this.env.model.uuidGenerator.smallUuid();
|
|
52281
52395
|
const name = this.env.model.getters.getNextSheetName(_t("Sheet"));
|
|
52282
52396
|
this.env.model.dispatch("CREATE_SHEET", { sheetId, position, name });
|
|
52283
52397
|
this.env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
|
|
@@ -53339,7 +53453,7 @@
|
|
|
53339
53453
|
.o-font-size-editor {
|
|
53340
53454
|
height: calc(100% - 4px);
|
|
53341
53455
|
input.o-font-size {
|
|
53342
|
-
outline
|
|
53456
|
+
outline: none;
|
|
53343
53457
|
height: 20px;
|
|
53344
53458
|
width: 23px;
|
|
53345
53459
|
}
|
|
@@ -54514,7 +54628,7 @@
|
|
|
54514
54628
|
}
|
|
54515
54629
|
/**
|
|
54516
54630
|
* Drop the operation and all following operations in every
|
|
54517
|
-
*
|
|
54631
|
+
* branches
|
|
54518
54632
|
*/
|
|
54519
54633
|
drop(operationId) {
|
|
54520
54634
|
for (const branch of this.branches) {
|
|
@@ -54819,9 +54933,16 @@
|
|
|
54819
54933
|
this.fastForward();
|
|
54820
54934
|
this.insert(redoId, this.buildEmpty(redoId), insertAfter);
|
|
54821
54935
|
}
|
|
54822
|
-
|
|
54936
|
+
rebase(operationId) {
|
|
54937
|
+
const operation = this.get(operationId);
|
|
54938
|
+
const execution = [...this.tree.execution(this.HEAD_BRANCH).startAfter(operationId)];
|
|
54823
54939
|
this.revertBefore(operationId);
|
|
54940
|
+
const baseId = this.HEAD_OPERATION.id;
|
|
54824
54941
|
this.tree.drop(operationId);
|
|
54942
|
+
this.insert(operationId, operation, baseId);
|
|
54943
|
+
for (const { operation } of execution) {
|
|
54944
|
+
this.insert(operation.id, operation.data, this.HEAD_OPERATION.id);
|
|
54945
|
+
}
|
|
54825
54946
|
}
|
|
54826
54947
|
getRevertedExecution() {
|
|
54827
54948
|
const data = [];
|
|
@@ -57398,6 +57519,11 @@
|
|
|
57398
57519
|
dispatch: (command) => {
|
|
57399
57520
|
const result = this.checkDispatchAllowed(command);
|
|
57400
57521
|
if (!result.isSuccessful) {
|
|
57522
|
+
// core views plugins need to be invalidated
|
|
57523
|
+
this.dispatchToHandlers(this.coreHandlers, {
|
|
57524
|
+
type: "UNDO",
|
|
57525
|
+
commands: [command],
|
|
57526
|
+
});
|
|
57401
57527
|
return;
|
|
57402
57528
|
}
|
|
57403
57529
|
this.isReplayingCommand = true;
|
|
@@ -57426,7 +57552,7 @@
|
|
|
57426
57552
|
}
|
|
57427
57553
|
setupConfig(config) {
|
|
57428
57554
|
const client = config.client || {
|
|
57429
|
-
id: this.uuidGenerator.
|
|
57555
|
+
id: this.uuidGenerator.smallUuid(),
|
|
57430
57556
|
name: _t("Anonymous").toString(),
|
|
57431
57557
|
};
|
|
57432
57558
|
const transportService = config.transportService || new LocalTransportService();
|
|
@@ -57847,9 +57973,9 @@
|
|
|
57847
57973
|
exports.tokenize = tokenize;
|
|
57848
57974
|
|
|
57849
57975
|
|
|
57850
|
-
__info__.version = "17.0.
|
|
57851
|
-
__info__.date = "2025-02-
|
|
57852
|
-
__info__.hash = "
|
|
57976
|
+
__info__.version = "17.0.50";
|
|
57977
|
+
__info__.date = "2025-02-14T08:37:34.289Z";
|
|
57978
|
+
__info__.hash = "cc1037d";
|
|
57853
57979
|
|
|
57854
57980
|
|
|
57855
57981
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|