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