@odoo/o-spreadsheet 17.4.22 → 17.4.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/o-spreadsheet.cjs.js +154 -104
- package/dist/o-spreadsheet.d.ts +15 -0
- package/dist/o-spreadsheet.esm.js +154 -104
- package/dist/o-spreadsheet.iife.js +154 -104
- package/dist/o-spreadsheet.iife.min.js +345 -345
- package/dist/o_spreadsheet.xml +3 -3
- 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 17.4.
|
|
6
|
-
* @date 2025-02-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.4.23
|
|
6
|
+
* @date 2025-02-14T08:37:12.219Z
|
|
7
|
+
* @hash 8339907
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -5498,6 +5498,37 @@ class UuidGenerator {
|
|
|
5498
5498
|
setIsFastStrategy(isFast) {
|
|
5499
5499
|
this.isFastIdStrategy = isFast;
|
|
5500
5500
|
}
|
|
5501
|
+
/**
|
|
5502
|
+
* Generates a custom UUID using a simple 36^12 method (8-character alphanumeric string with lowercase letters)
|
|
5503
|
+
* This has a higher chance of collision than a UUIDv4, but not only faster to generate than an UUIDV4,
|
|
5504
|
+
* it also has a smaller size, which is preferable to alleviate the overall data size.
|
|
5505
|
+
*
|
|
5506
|
+
* This method is preferable when generating uuids for the core data (sheetId, figureId, etc)
|
|
5507
|
+
* as they will appear several times in the revisions and local history.
|
|
5508
|
+
*
|
|
5509
|
+
*/
|
|
5510
|
+
smallUuid() {
|
|
5511
|
+
if (this.isFastIdStrategy) {
|
|
5512
|
+
this.fastIdStart++;
|
|
5513
|
+
return String(this.fastIdStart);
|
|
5514
|
+
//@ts-ignore
|
|
5515
|
+
}
|
|
5516
|
+
else if (window.crypto && window.crypto.getRandomValues) {
|
|
5517
|
+
//@ts-ignore
|
|
5518
|
+
return ([1e7] + -1e3).replace(/[018]/g, (c) => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16));
|
|
5519
|
+
}
|
|
5520
|
+
else {
|
|
5521
|
+
// mainly for jest and other browsers that do not have the crypto functionality
|
|
5522
|
+
return "xxxxxxxx-xxxx".replace(/[xy]/g, function (c) {
|
|
5523
|
+
var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
5524
|
+
return v.toString(16);
|
|
5525
|
+
});
|
|
5526
|
+
}
|
|
5527
|
+
}
|
|
5528
|
+
/**
|
|
5529
|
+
* Generates an UUIDV4, has astronomically low chance of collision, but is larger in size than the smallUuid.
|
|
5530
|
+
* This method should be used when you need to avoid collisions at all costs, like the id of a revision.
|
|
5531
|
+
*/
|
|
5501
5532
|
uuidv4() {
|
|
5502
5533
|
if (this.isFastIdStrategy) {
|
|
5503
5534
|
this.fastIdStart++;
|
|
@@ -5511,7 +5542,7 @@ class UuidGenerator {
|
|
|
5511
5542
|
else {
|
|
5512
5543
|
// mainly for jest and other browsers that do not have the crypto functionality
|
|
5513
5544
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
5514
|
-
var r = (Math.random() * 16) | 0, v = c
|
|
5545
|
+
var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
5515
5546
|
return v.toString(16);
|
|
5516
5547
|
});
|
|
5517
5548
|
}
|
|
@@ -6898,7 +6929,7 @@ class ChartClipboardHandler extends AbstractFigureClipboardHandler {
|
|
|
6898
6929
|
};
|
|
6899
6930
|
}
|
|
6900
6931
|
getPasteTarget(sheetId, target, content, options) {
|
|
6901
|
-
const newId = new UuidGenerator().
|
|
6932
|
+
const newId = new UuidGenerator().smallUuid();
|
|
6902
6933
|
return { zones: [], figureId: newId, sheetId };
|
|
6903
6934
|
}
|
|
6904
6935
|
paste(target, clippedContent, options) {
|
|
@@ -7040,7 +7071,9 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
7040
7071
|
const cfInTarget = this.getters
|
|
7041
7072
|
.getConditionalFormats(targetSheetId)
|
|
7042
7073
|
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
7043
|
-
return cfInTarget
|
|
7074
|
+
return cfInTarget
|
|
7075
|
+
? cfInTarget
|
|
7076
|
+
: { ...originCF, id: this.uuidGenerator.smallUuid(), ranges: [] };
|
|
7044
7077
|
}
|
|
7045
7078
|
}
|
|
7046
7079
|
|
|
@@ -7125,7 +7158,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
7125
7158
|
originRule.isBlocking === rule.isBlocking);
|
|
7126
7159
|
return ruleInTargetSheet
|
|
7127
7160
|
? ruleInTargetSheet
|
|
7128
|
-
: { ...originRule, id: newId ? this.uuidGenerator.
|
|
7161
|
+
: { ...originRule, id: newId ? this.uuidGenerator.smallUuid() : originRule.id, ranges: [] };
|
|
7129
7162
|
}
|
|
7130
7163
|
/**
|
|
7131
7164
|
* Add or remove XCs to a given data validation rule.
|
|
@@ -7166,7 +7199,7 @@ class ImageClipboardHandler extends AbstractFigureClipboardHandler {
|
|
|
7166
7199
|
};
|
|
7167
7200
|
}
|
|
7168
7201
|
getPasteTarget(sheetId, target, content, options) {
|
|
7169
|
-
const newId = new UuidGenerator().
|
|
7202
|
+
const newId = new UuidGenerator().smallUuid();
|
|
7170
7203
|
return { sheetId, zones: [], figureId: newId };
|
|
7171
7204
|
}
|
|
7172
7205
|
paste(target, clippedContent, options) {
|
|
@@ -13035,6 +13068,25 @@ const LN = {
|
|
|
13035
13068
|
isExported: true,
|
|
13036
13069
|
};
|
|
13037
13070
|
// -----------------------------------------------------------------------------
|
|
13071
|
+
// LOG
|
|
13072
|
+
// -----------------------------------------------------------------------------
|
|
13073
|
+
const LOG = {
|
|
13074
|
+
description: _t("The logarithm of a number, for a given base."),
|
|
13075
|
+
args: [
|
|
13076
|
+
arg("value (number)", _t("The value for which to calculate the logarithm.")),
|
|
13077
|
+
arg("base (number, default=10)", _t("The base of the logarithm.")),
|
|
13078
|
+
],
|
|
13079
|
+
compute: function (value, base = { value: 10 }) {
|
|
13080
|
+
const _value = toNumber(value, this.locale);
|
|
13081
|
+
const _base = toNumber(base, this.locale);
|
|
13082
|
+
assert(() => _value > 0, _t("The value (%s) must be strictly positive.", _value.toString()));
|
|
13083
|
+
assert(() => _base > 0, _t("The base (%s) must be strictly positive.", _base.toString()));
|
|
13084
|
+
assert(() => _base !== 1, _t("The base must be different from 1."));
|
|
13085
|
+
return Math.log10(_value) / Math.log10(_base);
|
|
13086
|
+
},
|
|
13087
|
+
isExported: true,
|
|
13088
|
+
};
|
|
13089
|
+
// -----------------------------------------------------------------------------
|
|
13038
13090
|
// MOD
|
|
13039
13091
|
// -----------------------------------------------------------------------------
|
|
13040
13092
|
function mod(dividend, divisor) {
|
|
@@ -13548,6 +13600,7 @@ var math = /*#__PURE__*/Object.freeze({
|
|
|
13548
13600
|
ISODD: ISODD,
|
|
13549
13601
|
ISO_CEILING: ISO_CEILING,
|
|
13550
13602
|
LN: LN,
|
|
13603
|
+
LOG: LOG,
|
|
13551
13604
|
MOD: MOD,
|
|
13552
13605
|
MUNIT: MUNIT,
|
|
13553
13606
|
ODD: ODD,
|
|
@@ -16256,7 +16309,7 @@ const SORTN = {
|
|
|
16256
16309
|
}
|
|
16257
16310
|
}
|
|
16258
16311
|
},
|
|
16259
|
-
isExported:
|
|
16312
|
+
isExported: false,
|
|
16260
16313
|
};
|
|
16261
16314
|
// -----------------------------------------------------------------------------
|
|
16262
16315
|
// UNIQUE
|
|
@@ -23522,17 +23575,15 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
|
|
|
23522
23575
|
plugins: [],
|
|
23523
23576
|
};
|
|
23524
23577
|
}
|
|
23525
|
-
function getChartLabelFormat(getters, range) {
|
|
23578
|
+
function getChartLabelFormat(getters, range, shouldRemoveFirstLabel) {
|
|
23526
23579
|
if (!range)
|
|
23527
23580
|
return undefined;
|
|
23528
|
-
const { sheetId, zone
|
|
23529
|
-
|
|
23530
|
-
|
|
23531
|
-
|
|
23532
|
-
return format;
|
|
23533
|
-
}
|
|
23581
|
+
const { sheetId, zone } = range;
|
|
23582
|
+
const formats = positions(zone).map((position) => getters.getEvaluatedCell({ sheetId, ...position }).format);
|
|
23583
|
+
if (shouldRemoveFirstLabel) {
|
|
23584
|
+
formats.shift();
|
|
23534
23585
|
}
|
|
23535
|
-
return undefined;
|
|
23586
|
+
return formats.find((format) => format !== undefined);
|
|
23536
23587
|
}
|
|
23537
23588
|
function getChartLabelValues(getters, dataSets, labelRange) {
|
|
23538
23589
|
let labels = { values: [], formattedValues: [] };
|
|
@@ -23870,9 +23921,7 @@ function createBarChartRuntime(chart, getters) {
|
|
|
23870
23921
|
const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
|
|
23871
23922
|
let labels = labelValues.formattedValues;
|
|
23872
23923
|
let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
|
|
23873
|
-
if (chart.dataSetsHaveTitle
|
|
23874
|
-
dataSetsValues[0] &&
|
|
23875
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
23924
|
+
if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
|
|
23876
23925
|
labels.shift();
|
|
23877
23926
|
}
|
|
23878
23927
|
({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
|
|
@@ -24049,8 +24098,8 @@ function fixEmptyLabelsForDateCharts(labels, dataSetsValues) {
|
|
|
24049
24098
|
}
|
|
24050
24099
|
return { labels: newLabels, dataSetsValues: newDatasets };
|
|
24051
24100
|
}
|
|
24052
|
-
function canChartParseLabels(
|
|
24053
|
-
return canBeDateChart(
|
|
24101
|
+
function canChartParseLabels(chart, getters) {
|
|
24102
|
+
return canBeDateChart(chart, getters) || canBeLinearChart(chart, getters);
|
|
24054
24103
|
}
|
|
24055
24104
|
function getChartAxisType(chart, getters) {
|
|
24056
24105
|
if (isDateChart(chart, getters) && isLuxonTimeAdapterInstalled()) {
|
|
@@ -24062,23 +24111,26 @@ function getChartAxisType(chart, getters) {
|
|
|
24062
24111
|
return "category";
|
|
24063
24112
|
}
|
|
24064
24113
|
function isDateChart(chart, getters) {
|
|
24065
|
-
return !chart.labelsAsText && canBeDateChart(chart
|
|
24114
|
+
return !chart.labelsAsText && canBeDateChart(chart, getters);
|
|
24066
24115
|
}
|
|
24067
24116
|
function isLinearChart(chart, getters) {
|
|
24068
|
-
return !chart.labelsAsText && canBeLinearChart(chart
|
|
24117
|
+
return !chart.labelsAsText && canBeLinearChart(chart, getters);
|
|
24069
24118
|
}
|
|
24070
|
-
function canBeDateChart(
|
|
24071
|
-
if (!labelRange || !canBeLinearChart(
|
|
24119
|
+
function canBeDateChart(chart, getters) {
|
|
24120
|
+
if (!chart.labelRange || !canBeLinearChart(chart, getters)) {
|
|
24072
24121
|
return false;
|
|
24073
24122
|
}
|
|
24074
|
-
const labelFormat = getChartLabelFormat(getters, labelRange);
|
|
24123
|
+
const labelFormat = getChartLabelFormat(getters, chart.labelRange, shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle));
|
|
24075
24124
|
return Boolean(labelFormat && timeFormatLuxonCompatible.test(labelFormat));
|
|
24076
24125
|
}
|
|
24077
|
-
function canBeLinearChart(
|
|
24078
|
-
if (!labelRange) {
|
|
24126
|
+
function canBeLinearChart(chart, getters) {
|
|
24127
|
+
if (!chart.labelRange) {
|
|
24079
24128
|
return false;
|
|
24080
24129
|
}
|
|
24081
|
-
const labels = getters.getRangeValues(labelRange);
|
|
24130
|
+
const labels = getters.getRangeValues(chart.labelRange);
|
|
24131
|
+
if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
|
|
24132
|
+
labels.shift();
|
|
24133
|
+
}
|
|
24082
24134
|
if (labels.some((label) => isNaN(Number(label)) && label)) {
|
|
24083
24135
|
return false;
|
|
24084
24136
|
}
|
|
@@ -24181,9 +24233,8 @@ function createLineOrScatterChartRuntime(chart, getters) {
|
|
|
24181
24233
|
const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
|
|
24182
24234
|
let labels = axisType === "linear" ? labelValues.values : labelValues.formattedValues;
|
|
24183
24235
|
let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
|
|
24184
|
-
|
|
24185
|
-
|
|
24186
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
24236
|
+
const removeFirstLabel = shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle);
|
|
24237
|
+
if (removeFirstLabel) {
|
|
24187
24238
|
labels.shift();
|
|
24188
24239
|
}
|
|
24189
24240
|
({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
|
|
@@ -24198,7 +24249,7 @@ function createLineOrScatterChartRuntime(chart, getters) {
|
|
|
24198
24249
|
const dataSetFormat = getChartDatasetFormat(getters, chart.dataSets);
|
|
24199
24250
|
const options = { format: dataSetFormat, locale, truncateLabels };
|
|
24200
24251
|
const config = getLineOrScatterConfiguration(chart, labels, options);
|
|
24201
|
-
const labelFormat = getChartLabelFormat(getters, chart.labelRange);
|
|
24252
|
+
const labelFormat = getChartLabelFormat(getters, chart.labelRange, removeFirstLabel);
|
|
24202
24253
|
if (axisType === "time") {
|
|
24203
24254
|
const axis = {
|
|
24204
24255
|
type: "time",
|
|
@@ -24412,9 +24463,7 @@ function createComboChartRuntime(chart, getters) {
|
|
|
24412
24463
|
const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
|
|
24413
24464
|
let labels = labelValues.formattedValues;
|
|
24414
24465
|
let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
|
|
24415
|
-
if (chart.dataSetsHaveTitle
|
|
24416
|
-
dataSetsValues[0] &&
|
|
24417
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
24466
|
+
if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
|
|
24418
24467
|
labels.shift();
|
|
24419
24468
|
}
|
|
24420
24469
|
({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
|
|
@@ -25067,9 +25116,7 @@ function createPieChartRuntime(chart, getters) {
|
|
|
25067
25116
|
const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
|
|
25068
25117
|
let labels = labelValues.formattedValues;
|
|
25069
25118
|
let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
|
|
25070
|
-
if (chart.dataSetsHaveTitle
|
|
25071
|
-
dataSetsValues[0] &&
|
|
25072
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
25119
|
+
if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
|
|
25073
25120
|
labels.shift();
|
|
25074
25121
|
}
|
|
25075
25122
|
({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
|
|
@@ -25617,9 +25664,7 @@ function createWaterfallChartRuntime(chart, getters) {
|
|
|
25617
25664
|
const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
|
|
25618
25665
|
let labels = labelValues.formattedValues;
|
|
25619
25666
|
let dataSetsValues = getChartDatasetValues(getters, chart.dataSets);
|
|
25620
|
-
if (chart.dataSetsHaveTitle
|
|
25621
|
-
dataSetsValues[0] &&
|
|
25622
|
-
labels.length > dataSetsValues[0].data.length) {
|
|
25667
|
+
if (shouldRemoveFirstLabel(chart.labelRange, chart.dataSets[0], chart.dataSetsHaveTitle)) {
|
|
25623
25668
|
labels.shift();
|
|
25624
25669
|
}
|
|
25625
25670
|
({ labels, dataSetsValues } = filterEmptyDataPoints(labels, dataSetsValues));
|
|
@@ -27137,7 +27182,7 @@ const linkSheet = {
|
|
|
27137
27182
|
const deleteSheet = {
|
|
27138
27183
|
name: _t("Delete"),
|
|
27139
27184
|
isVisible: (env) => {
|
|
27140
|
-
return env.model.getters.
|
|
27185
|
+
return env.model.getters.getVisibleSheetIds().length > 1;
|
|
27141
27186
|
},
|
|
27142
27187
|
execute: (env) => env.askConfirmation(_t("Are you sure you want to delete this sheet?"), () => {
|
|
27143
27188
|
env.model.dispatch("DELETE_SHEET", { sheetId: env.model.getters.getActiveSheetId() });
|
|
@@ -27147,7 +27192,7 @@ const duplicateSheet = {
|
|
|
27147
27192
|
name: _t("Duplicate"),
|
|
27148
27193
|
execute: (env) => {
|
|
27149
27194
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
27150
|
-
const sheetIdTo = env.model.uuidGenerator.
|
|
27195
|
+
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
27151
27196
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
27152
27197
|
sheetId: sheetIdFrom,
|
|
27153
27198
|
sheetIdTo,
|
|
@@ -27762,20 +27807,21 @@ function getSmartChartDefinition(zone, getters) {
|
|
|
27762
27807
|
}
|
|
27763
27808
|
// Only display legend for several datasets.
|
|
27764
27809
|
const newLegendPos = dataSetZone.right === dataSetZone.left ? "none" : "top";
|
|
27765
|
-
const
|
|
27766
|
-
|
|
27767
|
-
|
|
27768
|
-
|
|
27769
|
-
|
|
27770
|
-
|
|
27771
|
-
|
|
27772
|
-
|
|
27773
|
-
|
|
27774
|
-
|
|
27775
|
-
|
|
27776
|
-
|
|
27777
|
-
|
|
27778
|
-
|
|
27810
|
+
const lineChartDefinition = {
|
|
27811
|
+
title: {},
|
|
27812
|
+
dataSets,
|
|
27813
|
+
labelsAsText: false,
|
|
27814
|
+
stacked: false,
|
|
27815
|
+
aggregated: false,
|
|
27816
|
+
cumulative: false,
|
|
27817
|
+
labelRange: labelRangeXc,
|
|
27818
|
+
type: "line",
|
|
27819
|
+
dataSetsHaveTitle,
|
|
27820
|
+
legendPosition: newLegendPos,
|
|
27821
|
+
};
|
|
27822
|
+
const chart = new LineChart(lineChartDefinition, sheetId, getters);
|
|
27823
|
+
if (canChartParseLabels(chart, getters)) {
|
|
27824
|
+
return lineChartDefinition;
|
|
27779
27825
|
}
|
|
27780
27826
|
const _dataSets = createDataSets(getters, dataSets, sheetId, dataSetsHaveTitle);
|
|
27781
27827
|
if (singleColumn &&
|
|
@@ -28469,7 +28515,7 @@ const HIDE_ROWS_NAME = (env) => {
|
|
|
28469
28515
|
//------------------------------------------------------------------------------
|
|
28470
28516
|
const CREATE_CHART = (env) => {
|
|
28471
28517
|
const getters = env.model.getters;
|
|
28472
|
-
const id = env.model.uuidGenerator.
|
|
28518
|
+
const id = env.model.uuidGenerator.smallUuid();
|
|
28473
28519
|
const sheetId = getters.getActiveSheetId();
|
|
28474
28520
|
if (getZoneArea(env.model.getters.getSelectedZone()) === 1) {
|
|
28475
28521
|
env.model.selection.selectTableAroundSelection();
|
|
@@ -28492,8 +28538,8 @@ const CREATE_CHART = (env) => {
|
|
|
28492
28538
|
// Pivots
|
|
28493
28539
|
//------------------------------------------------------------------------------
|
|
28494
28540
|
const CREATE_PIVOT = (env) => {
|
|
28495
|
-
const pivotId = env.model.uuidGenerator.
|
|
28496
|
-
const newSheetId = env.model.uuidGenerator.
|
|
28541
|
+
const pivotId = env.model.uuidGenerator.smallUuid();
|
|
28542
|
+
const newSheetId = env.model.uuidGenerator.smallUuid();
|
|
28497
28543
|
const result = env.model.dispatch("INSERT_NEW_PIVOT", { pivotId, newSheetId });
|
|
28498
28544
|
if (result.isSuccessful) {
|
|
28499
28545
|
env.openSidePanel("PivotSidePanel", { pivotId });
|
|
@@ -28552,7 +28598,7 @@ async function requestImage(env) {
|
|
|
28552
28598
|
const CREATE_IMAGE = async (env) => {
|
|
28553
28599
|
if (env.imageProvider) {
|
|
28554
28600
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
28555
|
-
const figureId = env.model.uuidGenerator.
|
|
28601
|
+
const figureId = env.model.uuidGenerator.smallUuid();
|
|
28556
28602
|
const image = await requestImage(env);
|
|
28557
28603
|
if (!image) {
|
|
28558
28604
|
throw new Error("No image provider was given to the environment");
|
|
@@ -29105,7 +29151,7 @@ const insertCheckbox = {
|
|
|
29105
29151
|
ranges,
|
|
29106
29152
|
sheetId,
|
|
29107
29153
|
rule: {
|
|
29108
|
-
id: env.model.uuidGenerator.
|
|
29154
|
+
id: env.model.uuidGenerator.smallUuid(),
|
|
29109
29155
|
criterion: {
|
|
29110
29156
|
type: "isBoolean",
|
|
29111
29157
|
values: [],
|
|
@@ -29121,7 +29167,7 @@ const insertDropdown = {
|
|
|
29121
29167
|
const zones = env.model.getters.getSelectedZones();
|
|
29122
29168
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
29123
29169
|
const ranges = zones.map((zone) => env.model.getters.getRangeDataFromZone(sheetId, zone));
|
|
29124
|
-
const ruleID = env.model.uuidGenerator.
|
|
29170
|
+
const ruleID = env.model.uuidGenerator.smallUuid();
|
|
29125
29171
|
env.model.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
29126
29172
|
ranges,
|
|
29127
29173
|
sheetId,
|
|
@@ -29152,7 +29198,7 @@ const insertSheet = {
|
|
|
29152
29198
|
execute: (env) => {
|
|
29153
29199
|
const activeSheetId = env.model.getters.getActiveSheetId();
|
|
29154
29200
|
const position = env.model.getters.getSheetIds().indexOf(activeSheetId) + 1;
|
|
29155
|
-
const sheetId = env.model.uuidGenerator.
|
|
29201
|
+
const sheetId = env.model.uuidGenerator.smallUuid();
|
|
29156
29202
|
env.model.dispatch("CREATE_SHEET", { sheetId, position });
|
|
29157
29203
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
|
|
29158
29204
|
},
|
|
@@ -32851,7 +32897,7 @@ class LineConfigPanel extends GenericChartConfigPanel {
|
|
|
32851
32897
|
get canTreatLabelsAsText() {
|
|
32852
32898
|
const chart = this.env.model.getters.getChart(this.props.figureId);
|
|
32853
32899
|
if (chart && chart instanceof LineChart) {
|
|
32854
|
-
return canChartParseLabels(chart
|
|
32900
|
+
return canChartParseLabels(chart, this.env.model.getters);
|
|
32855
32901
|
}
|
|
32856
32902
|
return false;
|
|
32857
32903
|
}
|
|
@@ -32923,7 +32969,7 @@ class ScatterConfigPanel extends GenericChartConfigPanel {
|
|
|
32923
32969
|
get canTreatLabelsAsText() {
|
|
32924
32970
|
const chart = this.env.model.getters.getChart(this.props.figureId);
|
|
32925
32971
|
if (chart && chart instanceof ScatterChart) {
|
|
32926
|
-
return canChartParseLabels(chart
|
|
32972
|
+
return canChartParseLabels(chart, this.env.model.getters);
|
|
32927
32973
|
}
|
|
32928
32974
|
return false;
|
|
32929
32975
|
}
|
|
@@ -34222,7 +34268,7 @@ class ConditionalFormattingEditor extends Component {
|
|
|
34222
34268
|
state;
|
|
34223
34269
|
setup() {
|
|
34224
34270
|
const cf = this.props.editedCf || {
|
|
34225
|
-
id: this.env.model.uuidGenerator.
|
|
34271
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
34226
34272
|
ranges: this.env.model.getters
|
|
34227
34273
|
.getSelectedZones()
|
|
34228
34274
|
.map((zone) => this.env.model.getters.zoneToXC(this.env.model.getters.getActiveSheetId(), zone)),
|
|
@@ -35194,7 +35240,7 @@ class DataValidationEditor extends Component {
|
|
|
35194
35240
|
.getSelectedZones()
|
|
35195
35241
|
.map((zone) => zoneToXc(this.env.model.getters.getUnboundedZone(sheetId, zone)));
|
|
35196
35242
|
return {
|
|
35197
|
-
id: this.env.model.uuidGenerator.
|
|
35243
|
+
id: this.env.model.uuidGenerator.smallUuid(),
|
|
35198
35244
|
criterion: { type: "textContains", values: [""] },
|
|
35199
35245
|
ranges,
|
|
35200
35246
|
};
|
|
@@ -36313,8 +36359,8 @@ class PivotTitleSection extends Component {
|
|
|
36313
36359
|
return this.env.model.getters.getPivotDisplayName(this.props.pivotId);
|
|
36314
36360
|
}
|
|
36315
36361
|
duplicatePivot() {
|
|
36316
|
-
const newPivotId = this.env.model.uuidGenerator.
|
|
36317
|
-
const newSheetId = this.env.model.uuidGenerator.
|
|
36362
|
+
const newPivotId = this.env.model.uuidGenerator.smallUuid();
|
|
36363
|
+
const newSheetId = this.env.model.uuidGenerator.smallUuid();
|
|
36318
36364
|
const result = this.env.model.dispatch("DUPLICATE_PIVOT_IN_NEW_SHEET", {
|
|
36319
36365
|
pivotId: this.props.pivotId,
|
|
36320
36366
|
newPivotId,
|
|
@@ -38643,7 +38689,7 @@ class TableStyleEditorPanel extends Component {
|
|
|
38643
38689
|
this.state.selectedTemplateName = templateName;
|
|
38644
38690
|
}
|
|
38645
38691
|
onConfirm() {
|
|
38646
|
-
const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.
|
|
38692
|
+
const tableStyleId = this.props.styleId || this.env.model.uuidGenerator.smallUuid();
|
|
38647
38693
|
this.env.model.dispatch("CREATE_TABLE_STYLE", {
|
|
38648
38694
|
tableStyleId,
|
|
38649
38695
|
tableStyleName: this.state.styleName,
|
|
@@ -50924,7 +50970,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
50924
50970
|
case "RENAME_SHEET":
|
|
50925
50971
|
return this.isRenameAllowed(cmd);
|
|
50926
50972
|
case "DELETE_SHEET":
|
|
50927
|
-
return this.
|
|
50973
|
+
return this.getVisibleSheetIds().length > 1
|
|
50928
50974
|
? "Success" /* CommandResult.Success */
|
|
50929
50975
|
: "NotEnoughSheets" /* CommandResult.NotEnoughSheets */;
|
|
50930
50976
|
case "ADD_COLUMNS_ROWS":
|
|
@@ -51781,7 +51827,7 @@ class TablePlugin extends CorePlugin {
|
|
|
51781
51827
|
const union = this.getters.getRangesUnion(ranges);
|
|
51782
51828
|
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, union.zone);
|
|
51783
51829
|
this.dispatch("REMOVE_MERGE", { sheetId: cmd.sheetId, target: mergesInTarget });
|
|
51784
|
-
const id = this.uuidGenerator.
|
|
51830
|
+
const id = this.uuidGenerator.smallUuid();
|
|
51785
51831
|
const config = cmd.config || DEFAULT_TABLE_CONFIG;
|
|
51786
51832
|
const newTable = cmd.tableType === "dynamic"
|
|
51787
51833
|
? this.createDynamicTable(id, union, config)
|
|
@@ -51934,7 +51980,7 @@ class TablePlugin extends CorePlugin {
|
|
|
51934
51980
|
filters = [];
|
|
51935
51981
|
for (const i of range(zone.left, zone.right + 1)) {
|
|
51936
51982
|
const filterZone = { ...zone, left: i, right: i };
|
|
51937
|
-
const uid = this.uuidGenerator.
|
|
51983
|
+
const uid = this.uuidGenerator.smallUuid();
|
|
51938
51984
|
filters.push(this.createFilterFromZone(uid, tableRange.sheetId, filterZone, config));
|
|
51939
51985
|
}
|
|
51940
51986
|
}
|
|
@@ -51999,7 +52045,7 @@ class TablePlugin extends CorePlugin {
|
|
|
51999
52045
|
? table.filters.find((f) => f.col === i)
|
|
52000
52046
|
: undefined;
|
|
52001
52047
|
const filterZone = { ...tableZone, left: i, right: i };
|
|
52002
|
-
const filterId = oldFilter?.id || this.uuidGenerator.
|
|
52048
|
+
const filterId = oldFilter?.id || this.uuidGenerator.smallUuid();
|
|
52003
52049
|
filters.push(this.createFilterFromZone(filterId, tableRange.sheetId, filterZone, config));
|
|
52004
52050
|
}
|
|
52005
52051
|
}
|
|
@@ -52100,7 +52146,7 @@ class TablePlugin extends CorePlugin {
|
|
|
52100
52146
|
if (filters.length < zoneToDimension(tableZone).numberOfCols) {
|
|
52101
52147
|
for (let col = tableZone.left; col <= tableZone.right; col++) {
|
|
52102
52148
|
if (!filters.find((filter) => filter.col === col)) {
|
|
52103
|
-
const uid = this.uuidGenerator.
|
|
52149
|
+
const uid = this.uuidGenerator.smallUuid();
|
|
52104
52150
|
const filterZone = { ...tableZone, left: col, right: col };
|
|
52105
52151
|
filters.push(this.createFilterFromZone(uid, sheetId, filterZone, table.config));
|
|
52106
52152
|
}
|
|
@@ -59049,23 +59095,23 @@ const uuidGenerator = new UuidGenerator();
|
|
|
59049
59095
|
function repeatCreateChartCommand(getters, cmd) {
|
|
59050
59096
|
return {
|
|
59051
59097
|
...repeatSheetDependantCommand(getters, cmd),
|
|
59052
|
-
id: uuidGenerator.
|
|
59098
|
+
id: uuidGenerator.smallUuid(),
|
|
59053
59099
|
};
|
|
59054
59100
|
}
|
|
59055
59101
|
function repeatCreateImageCommand(getters, cmd) {
|
|
59056
59102
|
return {
|
|
59057
59103
|
...repeatSheetDependantCommand(getters, cmd),
|
|
59058
|
-
figureId: uuidGenerator.
|
|
59104
|
+
figureId: uuidGenerator.smallUuid(),
|
|
59059
59105
|
};
|
|
59060
59106
|
}
|
|
59061
59107
|
function repeatCreateFigureCommand(getters, cmd) {
|
|
59062
59108
|
const newCmd = repeatSheetDependantCommand(getters, cmd);
|
|
59063
|
-
newCmd.figure.id = uuidGenerator.
|
|
59109
|
+
newCmd.figure.id = uuidGenerator.smallUuid();
|
|
59064
59110
|
return newCmd;
|
|
59065
59111
|
}
|
|
59066
59112
|
function repeatCreateSheetCommand(getters, cmd) {
|
|
59067
59113
|
const newCmd = deepCopy(cmd);
|
|
59068
|
-
newCmd.sheetId = uuidGenerator.
|
|
59114
|
+
newCmd.sheetId = uuidGenerator.smallUuid();
|
|
59069
59115
|
const sheetName = cmd.name || getters.getSheet(getters.getActiveSheetId()).name;
|
|
59070
59116
|
// Extract the prefix of the sheet name (everything before the number at the end of the name)
|
|
59071
59117
|
const namePrefix = sheetName.match(/(.+?)\d*$/)?.[1] || sheetName;
|
|
@@ -60535,23 +60581,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
60535
60581
|
gridSelection: deepCopy(gridSelection),
|
|
60536
60582
|
};
|
|
60537
60583
|
}
|
|
60538
|
-
|
|
60539
|
-
const currentSheetIds = this.getters.getVisibleSheetIds();
|
|
60540
|
-
this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
|
|
60541
|
-
if (this.activeSheet.id in this.sheetsData) {
|
|
60542
|
-
const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
|
|
60543
|
-
this.selectCell(anchor.cell.col, anchor.cell.row);
|
|
60544
|
-
}
|
|
60545
|
-
else {
|
|
60546
|
-
this.selectCell(0, 0);
|
|
60547
|
-
}
|
|
60548
|
-
const { col, row } = this.gridSelection.anchor.cell;
|
|
60549
|
-
this.moveClient({
|
|
60550
|
-
sheetId: this.getters.getActiveSheetId(),
|
|
60551
|
-
col,
|
|
60552
|
-
row,
|
|
60553
|
-
});
|
|
60554
|
-
}
|
|
60584
|
+
this.fallbackToVisibleSheet();
|
|
60555
60585
|
const sheetId = this.getters.getActiveSheetId();
|
|
60556
60586
|
this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
|
|
60557
60587
|
this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
|
|
@@ -60561,6 +60591,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
60561
60591
|
}
|
|
60562
60592
|
}
|
|
60563
60593
|
finalize() {
|
|
60594
|
+
this.fallbackToVisibleSheet();
|
|
60564
60595
|
/** Any change to the selection has to be reflected in the selection processor. */
|
|
60565
60596
|
this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
|
|
60566
60597
|
}
|
|
@@ -60864,6 +60895,25 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
60864
60895
|
}
|
|
60865
60896
|
return "Success" /* CommandResult.Success */;
|
|
60866
60897
|
}
|
|
60898
|
+
fallbackToVisibleSheet() {
|
|
60899
|
+
if (!this.getters.tryGetSheet(this.getters.getActiveSheetId())) {
|
|
60900
|
+
const currentSheetIds = this.getters.getVisibleSheetIds();
|
|
60901
|
+
this.activeSheet = this.getters.getSheet(currentSheetIds[0]);
|
|
60902
|
+
if (this.activeSheet.id in this.sheetsData) {
|
|
60903
|
+
const { anchor } = this.clipSelection(this.activeSheet.id, this.sheetsData[this.activeSheet.id].gridSelection);
|
|
60904
|
+
this.selectCell(anchor.cell.col, anchor.cell.row);
|
|
60905
|
+
}
|
|
60906
|
+
else {
|
|
60907
|
+
this.selectCell(0, 0);
|
|
60908
|
+
}
|
|
60909
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
60910
|
+
this.moveClient({
|
|
60911
|
+
sheetId: this.getters.getActiveSheetId(),
|
|
60912
|
+
col,
|
|
60913
|
+
row,
|
|
60914
|
+
});
|
|
60915
|
+
}
|
|
60916
|
+
}
|
|
60867
60917
|
//-------------------------------------------
|
|
60868
60918
|
// Helpers for extensions
|
|
60869
60919
|
// ------------------------------------------
|
|
@@ -62843,7 +62893,7 @@ class BottomBar extends Component {
|
|
|
62843
62893
|
clickAddSheet(ev) {
|
|
62844
62894
|
const activeSheetId = this.env.model.getters.getActiveSheetId();
|
|
62845
62895
|
const position = this.env.model.getters.getSheetIds().findIndex((sheetId) => sheetId === activeSheetId) + 1;
|
|
62846
|
-
const sheetId = this.env.model.uuidGenerator.
|
|
62896
|
+
const sheetId = this.env.model.uuidGenerator.smallUuid();
|
|
62847
62897
|
const name = this.env.model.getters.getNextSheetName(_t("Sheet"));
|
|
62848
62898
|
this.env.model.dispatch("CREATE_SHEET", { sheetId, position, name });
|
|
62849
62899
|
this.env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: activeSheetId, sheetIdTo: sheetId });
|
|
@@ -68401,7 +68451,7 @@ class Model extends EventBus {
|
|
|
68401
68451
|
}
|
|
68402
68452
|
setupConfig(config) {
|
|
68403
68453
|
const client = config.client || {
|
|
68404
|
-
id: this.uuidGenerator.
|
|
68454
|
+
id: this.uuidGenerator.smallUuid(),
|
|
68405
68455
|
name: _t("Anonymous").toString(),
|
|
68406
68456
|
};
|
|
68407
68457
|
const transportService = config.transportService || new LocalTransportService();
|
|
@@ -68877,6 +68927,6 @@ const constants = {
|
|
|
68877
68927
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
68878
68928
|
|
|
68879
68929
|
|
|
68880
|
-
__info__.version = "17.4.
|
|
68881
|
-
__info__.date = "2025-02-
|
|
68882
|
-
__info__.hash = "
|
|
68930
|
+
__info__.version = "17.4.23";
|
|
68931
|
+
__info__.date = "2025-02-14T08:37:12.219Z";
|
|
68932
|
+
__info__.hash = "8339907";
|