@odoo/o-spreadsheet 16.5.0-alpha.12 → 16.5.0-alpha.13
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 +320 -110
- package/dist/o-spreadsheet.d.ts +3 -3
- package/dist/o-spreadsheet.esm.js +320 -110
- package/dist/o-spreadsheet.iife.js +320 -110
- package/dist/o-spreadsheet.iife.min.js +281 -281
- 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 16.5.0-alpha.
|
|
6
|
-
* @date 2023-10-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 16.5.0-alpha.13
|
|
6
|
+
* @date 2023-10-25T10:04:45.428Z
|
|
7
|
+
* @hash 18a08b1
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -7583,6 +7583,18 @@ function multiplyMatrices(matrix1, matrix2) {
|
|
|
7583
7583
|
}
|
|
7584
7584
|
return result;
|
|
7585
7585
|
}
|
|
7586
|
+
/**
|
|
7587
|
+
* Return the input if it's a scalar or the first element of the input if it's a matrix.
|
|
7588
|
+
*/
|
|
7589
|
+
function toScalar(matrix) {
|
|
7590
|
+
if (!isMatrix(matrix)) {
|
|
7591
|
+
return matrix;
|
|
7592
|
+
}
|
|
7593
|
+
if (matrix.length !== 1 || matrix[0].length !== 1) {
|
|
7594
|
+
throw new Error("toScalar: matrix should be a scalar or a 1x1 matrix");
|
|
7595
|
+
}
|
|
7596
|
+
return matrix[0][0];
|
|
7597
|
+
}
|
|
7586
7598
|
|
|
7587
7599
|
// -----------------------------------------------------------------------------
|
|
7588
7600
|
// ARRAY_CONSTRAIN
|
|
@@ -10296,6 +10308,42 @@ const QUARTILE_INC = {
|
|
|
10296
10308
|
},
|
|
10297
10309
|
isExported: true,
|
|
10298
10310
|
};
|
|
10311
|
+
// RANK
|
|
10312
|
+
// -----------------------------------------------------------------------------
|
|
10313
|
+
const RANK = {
|
|
10314
|
+
description: _t("Returns the rank of a specified value in a dataset."),
|
|
10315
|
+
args: [
|
|
10316
|
+
arg("value (number)", _t("The value whose rank will be determined.")),
|
|
10317
|
+
arg("data (range)", _t("The range containing the dataset to consider.")),
|
|
10318
|
+
arg("is_ascending (boolean, default=FALSE)", _t("Whether to consider the values in data in descending or ascending order.")),
|
|
10319
|
+
],
|
|
10320
|
+
returns: ["ANY"],
|
|
10321
|
+
compute: function (value, data, isAscending = false) {
|
|
10322
|
+
const _isAscending = toBoolean(isAscending);
|
|
10323
|
+
const _value = toNumber(value, this.locale);
|
|
10324
|
+
let rank = 1;
|
|
10325
|
+
let found = false;
|
|
10326
|
+
for (const row of data) {
|
|
10327
|
+
for (const cell of row) {
|
|
10328
|
+
if (typeof cell !== "number") {
|
|
10329
|
+
continue;
|
|
10330
|
+
}
|
|
10331
|
+
const _cell = toNumber(cell, this.locale);
|
|
10332
|
+
if (_cell === _value) {
|
|
10333
|
+
found = true;
|
|
10334
|
+
}
|
|
10335
|
+
else if (_cell > _value !== _isAscending) {
|
|
10336
|
+
rank++;
|
|
10337
|
+
}
|
|
10338
|
+
}
|
|
10339
|
+
}
|
|
10340
|
+
if (!found) {
|
|
10341
|
+
throw new NotAvailableError(_t("Value not found in the given data."));
|
|
10342
|
+
}
|
|
10343
|
+
return rank;
|
|
10344
|
+
},
|
|
10345
|
+
isExported: true,
|
|
10346
|
+
};
|
|
10299
10347
|
// -----------------------------------------------------------------------------
|
|
10300
10348
|
// RSQ
|
|
10301
10349
|
// -----------------------------------------------------------------------------
|
|
@@ -10640,6 +10688,7 @@ var statistical = /*#__PURE__*/Object.freeze({
|
|
|
10640
10688
|
QUARTILE: QUARTILE,
|
|
10641
10689
|
QUARTILE_EXC: QUARTILE_EXC,
|
|
10642
10690
|
QUARTILE_INC: QUARTILE_INC,
|
|
10691
|
+
RANK: RANK,
|
|
10643
10692
|
RSQ: RSQ,
|
|
10644
10693
|
SLOPE: SLOPE,
|
|
10645
10694
|
SMALL: SMALL,
|
|
@@ -11786,6 +11835,172 @@ var engineering = /*#__PURE__*/Object.freeze({
|
|
|
11786
11835
|
DELTA: DELTA
|
|
11787
11836
|
});
|
|
11788
11837
|
|
|
11838
|
+
const SORT_TYPES = [
|
|
11839
|
+
CellValueType.number,
|
|
11840
|
+
CellValueType.error,
|
|
11841
|
+
CellValueType.text,
|
|
11842
|
+
CellValueType.boolean,
|
|
11843
|
+
];
|
|
11844
|
+
function cellsSortingCriterion(sortingOrder) {
|
|
11845
|
+
const inverse = sortingOrder === "ascending" ? 1 : -1;
|
|
11846
|
+
return (left, right) => {
|
|
11847
|
+
if (left.type === CellValueType.empty) {
|
|
11848
|
+
return right.type === CellValueType.empty ? 0 : 1;
|
|
11849
|
+
}
|
|
11850
|
+
else if (right.type === CellValueType.empty) {
|
|
11851
|
+
return -1;
|
|
11852
|
+
}
|
|
11853
|
+
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
11854
|
+
if (typeOrder === 0) {
|
|
11855
|
+
if (left.type === CellValueType.text || left.type === CellValueType.error) {
|
|
11856
|
+
typeOrder = left.value.localeCompare(right.value);
|
|
11857
|
+
}
|
|
11858
|
+
else {
|
|
11859
|
+
typeOrder = left.value - right.value;
|
|
11860
|
+
}
|
|
11861
|
+
}
|
|
11862
|
+
return inverse * typeOrder;
|
|
11863
|
+
};
|
|
11864
|
+
}
|
|
11865
|
+
function sortCells(cells, sortDirection, emptyCellAsZero) {
|
|
11866
|
+
const cellsWithIndex = cells.map((cell, index) => ({
|
|
11867
|
+
index,
|
|
11868
|
+
type: cell.type,
|
|
11869
|
+
value: cell.value,
|
|
11870
|
+
}));
|
|
11871
|
+
const cellsToSort = emptyCellAsZero
|
|
11872
|
+
? cellsWithIndex.map((cell) => cell.type === CellValueType.empty ? { ...cell, type: CellValueType.number, value: 0 } : cell)
|
|
11873
|
+
: cellsWithIndex;
|
|
11874
|
+
return cellsToSort.sort(cellsSortingCriterion(sortDirection));
|
|
11875
|
+
}
|
|
11876
|
+
function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
|
|
11877
|
+
let result = DispatchResult.Success;
|
|
11878
|
+
//several columns => bypass the contiguity check
|
|
11879
|
+
let multiColumns = zone.right > zone.left;
|
|
11880
|
+
if (env.model.getters.doesIntersectMerge(sheetId, zone)) {
|
|
11881
|
+
multiColumns = false;
|
|
11882
|
+
let table;
|
|
11883
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
11884
|
+
table = [];
|
|
11885
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
11886
|
+
let merge = env.model.getters.getMerge({ sheetId, col, row });
|
|
11887
|
+
if (merge && !table.includes(merge.id.toString())) {
|
|
11888
|
+
table.push(merge.id.toString());
|
|
11889
|
+
}
|
|
11890
|
+
}
|
|
11891
|
+
if (table.length >= 2) {
|
|
11892
|
+
multiColumns = true;
|
|
11893
|
+
break;
|
|
11894
|
+
}
|
|
11895
|
+
}
|
|
11896
|
+
}
|
|
11897
|
+
const { col, row } = anchor;
|
|
11898
|
+
if (multiColumns) {
|
|
11899
|
+
result = env.model.dispatch("SORT_CELLS", { sheetId, col, row, zone, sortDirection });
|
|
11900
|
+
}
|
|
11901
|
+
else {
|
|
11902
|
+
// check contiguity
|
|
11903
|
+
const contiguousZone = env.model.getters.getContiguousZone(sheetId, zone);
|
|
11904
|
+
if (isEqual(contiguousZone, zone)) {
|
|
11905
|
+
// merge as it is
|
|
11906
|
+
result = env.model.dispatch("SORT_CELLS", {
|
|
11907
|
+
sheetId,
|
|
11908
|
+
col,
|
|
11909
|
+
row,
|
|
11910
|
+
zone,
|
|
11911
|
+
sortDirection,
|
|
11912
|
+
});
|
|
11913
|
+
}
|
|
11914
|
+
else {
|
|
11915
|
+
env.askConfirmation(_t("We found data next to your selection. Since this data was not selected, it will not be sorted. Do you want to extend your selection?"), () => {
|
|
11916
|
+
zone = contiguousZone;
|
|
11917
|
+
result = env.model.dispatch("SORT_CELLS", {
|
|
11918
|
+
sheetId,
|
|
11919
|
+
col,
|
|
11920
|
+
row,
|
|
11921
|
+
zone,
|
|
11922
|
+
sortDirection,
|
|
11923
|
+
});
|
|
11924
|
+
}, () => {
|
|
11925
|
+
result = env.model.dispatch("SORT_CELLS", {
|
|
11926
|
+
sheetId,
|
|
11927
|
+
col,
|
|
11928
|
+
row,
|
|
11929
|
+
zone,
|
|
11930
|
+
sortDirection,
|
|
11931
|
+
});
|
|
11932
|
+
});
|
|
11933
|
+
}
|
|
11934
|
+
}
|
|
11935
|
+
if (result.isCancelledBecause("InvalidSortZone" /* CommandResult.InvalidSortZone */)) {
|
|
11936
|
+
const { col, row } = anchor;
|
|
11937
|
+
env.model.selection.selectZone({ cell: { col, row }, zone });
|
|
11938
|
+
env.raiseError(_t("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
11939
|
+
}
|
|
11940
|
+
}
|
|
11941
|
+
|
|
11942
|
+
function sortMatrix(matrix, locale, ...criteria) {
|
|
11943
|
+
for (const [i, value] of criteria.entries()) {
|
|
11944
|
+
assert(() => value !== undefined, _t(`Value for parameter %d is missing, while the function [[FUNCTION_NAME]] expect a number or a range.`, i + 1));
|
|
11945
|
+
}
|
|
11946
|
+
const sortingOrders = [];
|
|
11947
|
+
const sortColumns = [];
|
|
11948
|
+
const nRows = matrix.length;
|
|
11949
|
+
for (let i = 0; i < criteria.length; i += 2) {
|
|
11950
|
+
sortingOrders.push(toBoolean(toScalar(criteria[i + 1])?.value) ? "ascending" : "descending");
|
|
11951
|
+
const sortColumn = criteria[i];
|
|
11952
|
+
if (isMatrix(sortColumn) && (sortColumn.length > 1 || sortColumn[0].length > 1)) {
|
|
11953
|
+
assert(() => sortColumn.length === 1 && sortColumn[0].length === nRows, _t(`Wrong size for %s. Expected a range of size 1x%s. Got %sx%s.`, `sort_column{i + 1}`, nRows, sortColumn.length, sortColumn[0].length));
|
|
11954
|
+
sortColumns.push(sortColumn.flat().map((c) => c.value));
|
|
11955
|
+
}
|
|
11956
|
+
else {
|
|
11957
|
+
const colIndex = toNumber(toScalar(sortColumn)?.value, locale);
|
|
11958
|
+
if (colIndex < 1 || colIndex > matrix[0].length) {
|
|
11959
|
+
return matrix;
|
|
11960
|
+
}
|
|
11961
|
+
sortColumns.push(matrix.map((row) => row[colIndex - 1].value));
|
|
11962
|
+
}
|
|
11963
|
+
}
|
|
11964
|
+
if (sortColumns.length === 0) {
|
|
11965
|
+
for (let i = 0; i < matrix[0].length; i++) {
|
|
11966
|
+
sortColumns.push(matrix.map((row) => row[i].value));
|
|
11967
|
+
sortingOrders.push("ascending");
|
|
11968
|
+
}
|
|
11969
|
+
}
|
|
11970
|
+
const sortingCriteria = {
|
|
11971
|
+
descending: cellsSortingCriterion("descending"),
|
|
11972
|
+
ascending: cellsSortingCriterion("ascending"),
|
|
11973
|
+
};
|
|
11974
|
+
const indexes = range(0, matrix.length);
|
|
11975
|
+
indexes.sort((a, b) => {
|
|
11976
|
+
for (const [i, sortColumn] of sortColumns.entries()) {
|
|
11977
|
+
const left = sortColumn[a];
|
|
11978
|
+
const right = sortColumn[b];
|
|
11979
|
+
const leftCell = {
|
|
11980
|
+
value: left,
|
|
11981
|
+
type: left === null
|
|
11982
|
+
? CellValueType.empty
|
|
11983
|
+
: typeof left === "string"
|
|
11984
|
+
? CellValueType.text
|
|
11985
|
+
: typeof left,
|
|
11986
|
+
};
|
|
11987
|
+
const rightCell = {
|
|
11988
|
+
value: right,
|
|
11989
|
+
type: right === null
|
|
11990
|
+
? CellValueType.empty
|
|
11991
|
+
: typeof right === "string"
|
|
11992
|
+
? CellValueType.text
|
|
11993
|
+
: typeof right,
|
|
11994
|
+
};
|
|
11995
|
+
const result = sortingCriteria[sortingOrders[i]](leftCell, rightCell);
|
|
11996
|
+
if (result !== 0) {
|
|
11997
|
+
return result;
|
|
11998
|
+
}
|
|
11999
|
+
}
|
|
12000
|
+
return 0;
|
|
12001
|
+
});
|
|
12002
|
+
return indexes.map((i) => matrix[i]);
|
|
12003
|
+
}
|
|
11789
12004
|
// -----------------------------------------------------------------------------
|
|
11790
12005
|
// FILTER
|
|
11791
12006
|
// -----------------------------------------------------------------------------
|
|
@@ -11822,6 +12037,93 @@ const FILTER = {
|
|
|
11822
12037
|
isExported: true,
|
|
11823
12038
|
};
|
|
11824
12039
|
// -----------------------------------------------------------------------------
|
|
12040
|
+
// SORT
|
|
12041
|
+
// -----------------------------------------------------------------------------
|
|
12042
|
+
const SORT = {
|
|
12043
|
+
description: _t("Sorts the rows of a given array or range by the values in one or more columns."),
|
|
12044
|
+
args: [
|
|
12045
|
+
arg("range (range)", _t("The data to be sorted.")),
|
|
12046
|
+
arg("sort_column (any, range<number>, repeating)", _t("The index of the column in range or a range outside of range containing the values by which to sort.")),
|
|
12047
|
+
arg("is_ascending (boolean, repeating)", _t("TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order.")),
|
|
12048
|
+
],
|
|
12049
|
+
returns: ["RANGE"],
|
|
12050
|
+
computeValueAndFormat: function (range, ...sortingCriteria) {
|
|
12051
|
+
const _range = transposeMatrix(range);
|
|
12052
|
+
return transposeMatrix(sortMatrix(_range, this.locale, ...sortingCriteria));
|
|
12053
|
+
},
|
|
12054
|
+
isExported: true,
|
|
12055
|
+
};
|
|
12056
|
+
// -----------------------------------------------------------------------------
|
|
12057
|
+
// SORTN
|
|
12058
|
+
// -----------------------------------------------------------------------------
|
|
12059
|
+
const SORTN = {
|
|
12060
|
+
description: _t("Returns the first n items in a data set after performing a sort."),
|
|
12061
|
+
args: [
|
|
12062
|
+
arg("range (range)", _t("The data to be sorted.")),
|
|
12063
|
+
arg("n (number, default=1)", _t("The number of items to return.")),
|
|
12064
|
+
arg("display_ties_mode (number, default=0)", _t("A number representing the way to display ties.")),
|
|
12065
|
+
arg("sort_column (number, range<number>, repeating)", _t("The index of the column in range or a range outside of range containing the values by which to sort.")),
|
|
12066
|
+
arg("is_ascending (boolean, repeating)", _t("TRUE or FALSE indicating whether to sort sort_column in ascending order. FALSE sorts in descending order.")),
|
|
12067
|
+
],
|
|
12068
|
+
returns: ["RANGE"],
|
|
12069
|
+
computeValueAndFormat: function (range, n, displayTiesMode, ...sortingCriteria) {
|
|
12070
|
+
const _n = toNumber(n?.value ?? 1, this.locale);
|
|
12071
|
+
assert(() => _n >= 0, _t(`Wrong value of 'n'. Expected a positive number. Got %s.`, _n));
|
|
12072
|
+
const _displayTiesMode = toNumber(displayTiesMode?.value ?? 0, this.locale);
|
|
12073
|
+
assert(() => _displayTiesMode >= 0 && _displayTiesMode <= 3, _t(`Wrong value of 'display_ties_mode'. Expected a positive number between 0 and 3. Got %s.`, _displayTiesMode));
|
|
12074
|
+
const sortedData = sortMatrix(transposeMatrix(range), this.locale, ...sortingCriteria);
|
|
12075
|
+
const sameRows = (i, j) => JSON.stringify(sortedData[i].map((c) => c.value)) ===
|
|
12076
|
+
JSON.stringify(sortedData[j].map((c) => c.value));
|
|
12077
|
+
/*
|
|
12078
|
+
* displayTiesMode determine how ties (equal values) are dealt with:
|
|
12079
|
+
* 0 - ignore ties and show first n rows only
|
|
12080
|
+
* 1 - show first n rows plus any additional ties with nth row
|
|
12081
|
+
* 2 - show n rows but remove duplicates
|
|
12082
|
+
* 3 - show first n unique rows and all duplicates of these rows
|
|
12083
|
+
*/
|
|
12084
|
+
switch (_displayTiesMode) {
|
|
12085
|
+
case 0:
|
|
12086
|
+
return transposeMatrix(sortedData.slice(0, _n));
|
|
12087
|
+
case 1:
|
|
12088
|
+
for (let i = _n; i < sortedData.length; i++) {
|
|
12089
|
+
if (!sameRows(i, _n - 1)) {
|
|
12090
|
+
return transposeMatrix(sortedData.slice(0, i));
|
|
12091
|
+
}
|
|
12092
|
+
}
|
|
12093
|
+
return transposeMatrix(sortedData);
|
|
12094
|
+
case 2: {
|
|
12095
|
+
const uniques = [sortedData[0]];
|
|
12096
|
+
for (let i = 1; i < sortedData.length; i++) {
|
|
12097
|
+
for (let j = 0; j < i; j++) {
|
|
12098
|
+
if (sameRows(i, j)) {
|
|
12099
|
+
break;
|
|
12100
|
+
}
|
|
12101
|
+
if (j === i - 1) {
|
|
12102
|
+
uniques.push(sortedData[i]);
|
|
12103
|
+
}
|
|
12104
|
+
}
|
|
12105
|
+
}
|
|
12106
|
+
return transposeMatrix(uniques.slice(0, _n));
|
|
12107
|
+
}
|
|
12108
|
+
case 3: {
|
|
12109
|
+
const uniques = [sortedData[0]];
|
|
12110
|
+
let counter = 1;
|
|
12111
|
+
for (let i = 1; i < sortedData.length; i++) {
|
|
12112
|
+
if (!sameRows(i, i - 1)) {
|
|
12113
|
+
counter++;
|
|
12114
|
+
}
|
|
12115
|
+
if (counter > _n) {
|
|
12116
|
+
break;
|
|
12117
|
+
}
|
|
12118
|
+
uniques.push(sortedData[i]);
|
|
12119
|
+
}
|
|
12120
|
+
return transposeMatrix(uniques);
|
|
12121
|
+
}
|
|
12122
|
+
}
|
|
12123
|
+
},
|
|
12124
|
+
isExported: true,
|
|
12125
|
+
};
|
|
12126
|
+
// -----------------------------------------------------------------------------
|
|
11825
12127
|
// UNIQUE
|
|
11826
12128
|
// -----------------------------------------------------------------------------
|
|
11827
12129
|
const UNIQUE = {
|
|
@@ -11869,6 +12171,8 @@ const UNIQUE = {
|
|
|
11869
12171
|
var filter = /*#__PURE__*/Object.freeze({
|
|
11870
12172
|
__proto__: null,
|
|
11871
12173
|
FILTER: FILTER,
|
|
12174
|
+
SORT: SORT,
|
|
12175
|
+
SORTN: SORTN,
|
|
11872
12176
|
UNIQUE: UNIQUE
|
|
11873
12177
|
});
|
|
11874
12178
|
|
|
@@ -20283,105 +20587,6 @@ cellMenuRegistry
|
|
|
20283
20587
|
separator: true,
|
|
20284
20588
|
});
|
|
20285
20589
|
|
|
20286
|
-
const SORT_TYPES = [
|
|
20287
|
-
CellValueType.number,
|
|
20288
|
-
CellValueType.error,
|
|
20289
|
-
CellValueType.text,
|
|
20290
|
-
CellValueType.boolean,
|
|
20291
|
-
];
|
|
20292
|
-
function sortCells(cells, sortDirection, emptyCellAsZero) {
|
|
20293
|
-
const cellsWithIndex = cells.map((cell, index) => ({
|
|
20294
|
-
index,
|
|
20295
|
-
type: cell.type,
|
|
20296
|
-
value: cell.value,
|
|
20297
|
-
}));
|
|
20298
|
-
let emptyCells = cellsWithIndex.filter((x) => x.type === CellValueType.empty);
|
|
20299
|
-
let nonEmptyCells = cellsWithIndex.filter((x) => x.type !== CellValueType.empty);
|
|
20300
|
-
if (emptyCellAsZero) {
|
|
20301
|
-
nonEmptyCells.push(...emptyCells.map((emptyCell) => ({ ...emptyCell, type: CellValueType.number, value: 0 })));
|
|
20302
|
-
emptyCells = [];
|
|
20303
|
-
}
|
|
20304
|
-
const inverse = sortDirection === "descending" ? -1 : 1;
|
|
20305
|
-
return nonEmptyCells
|
|
20306
|
-
.sort((left, right) => {
|
|
20307
|
-
let typeOrder = SORT_TYPES.indexOf(left.type) - SORT_TYPES.indexOf(right.type);
|
|
20308
|
-
if (typeOrder === 0) {
|
|
20309
|
-
if (left.type === CellValueType.text || left.type === CellValueType.error) {
|
|
20310
|
-
typeOrder = left.value.localeCompare(right.value);
|
|
20311
|
-
}
|
|
20312
|
-
else
|
|
20313
|
-
typeOrder = left.value - right.value;
|
|
20314
|
-
}
|
|
20315
|
-
return inverse * typeOrder;
|
|
20316
|
-
})
|
|
20317
|
-
.concat(emptyCells);
|
|
20318
|
-
}
|
|
20319
|
-
function interactiveSortSelection(env, sheetId, anchor, zone, sortDirection) {
|
|
20320
|
-
let result = DispatchResult.Success;
|
|
20321
|
-
//several columns => bypass the contiguity check
|
|
20322
|
-
let multiColumns = zone.right > zone.left;
|
|
20323
|
-
if (env.model.getters.doesIntersectMerge(sheetId, zone)) {
|
|
20324
|
-
multiColumns = false;
|
|
20325
|
-
let table;
|
|
20326
|
-
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
20327
|
-
table = [];
|
|
20328
|
-
for (let col = zone.left; col <= zone.right; col++) {
|
|
20329
|
-
let merge = env.model.getters.getMerge({ sheetId, col, row });
|
|
20330
|
-
if (merge && !table.includes(merge.id.toString())) {
|
|
20331
|
-
table.push(merge.id.toString());
|
|
20332
|
-
}
|
|
20333
|
-
}
|
|
20334
|
-
if (table.length >= 2) {
|
|
20335
|
-
multiColumns = true;
|
|
20336
|
-
break;
|
|
20337
|
-
}
|
|
20338
|
-
}
|
|
20339
|
-
}
|
|
20340
|
-
const { col, row } = anchor;
|
|
20341
|
-
if (multiColumns) {
|
|
20342
|
-
result = env.model.dispatch("SORT_CELLS", { sheetId, col, row, zone, sortDirection });
|
|
20343
|
-
}
|
|
20344
|
-
else {
|
|
20345
|
-
// check contiguity
|
|
20346
|
-
const contiguousZone = env.model.getters.getContiguousZone(sheetId, zone);
|
|
20347
|
-
if (isEqual(contiguousZone, zone)) {
|
|
20348
|
-
// merge as it is
|
|
20349
|
-
result = env.model.dispatch("SORT_CELLS", {
|
|
20350
|
-
sheetId,
|
|
20351
|
-
col,
|
|
20352
|
-
row,
|
|
20353
|
-
zone,
|
|
20354
|
-
sortDirection,
|
|
20355
|
-
});
|
|
20356
|
-
}
|
|
20357
|
-
else {
|
|
20358
|
-
env.askConfirmation(_t("We found data next to your selection. Since this data was not selected, it will not be sorted. Do you want to extend your selection?"), () => {
|
|
20359
|
-
zone = contiguousZone;
|
|
20360
|
-
result = env.model.dispatch("SORT_CELLS", {
|
|
20361
|
-
sheetId,
|
|
20362
|
-
col,
|
|
20363
|
-
row,
|
|
20364
|
-
zone,
|
|
20365
|
-
sortDirection,
|
|
20366
|
-
});
|
|
20367
|
-
}, () => {
|
|
20368
|
-
result = env.model.dispatch("SORT_CELLS", {
|
|
20369
|
-
sheetId,
|
|
20370
|
-
col,
|
|
20371
|
-
row,
|
|
20372
|
-
zone,
|
|
20373
|
-
sortDirection,
|
|
20374
|
-
});
|
|
20375
|
-
});
|
|
20376
|
-
}
|
|
20377
|
-
}
|
|
20378
|
-
if (result.isCancelledBecause("InvalidSortZone" /* CommandResult.InvalidSortZone */)) {
|
|
20379
|
-
const { col, row } = anchor;
|
|
20380
|
-
env.model.selection.selectZone({ cell: { col, row }, zone });
|
|
20381
|
-
env.raiseError(_t("Cannot sort. To sort, select only cells or only merges that have the same size."));
|
|
20382
|
-
}
|
|
20383
|
-
}
|
|
20384
|
-
|
|
20385
20590
|
const AddFilterInteractiveContent = {
|
|
20386
20591
|
filterOverlap: _t("You cannot create overlapping filters."),
|
|
20387
20592
|
nonContinuousTargets: _t("A filter can only be created on a continuous selection."),
|
|
@@ -26564,7 +26769,6 @@ css /* scss */ `
|
|
|
26564
26769
|
border-top-right-radius: 4px;
|
|
26565
26770
|
font-size: ${DEFAULT_FONT_SIZE};
|
|
26566
26771
|
color: white;
|
|
26567
|
-
opacity: 0;
|
|
26568
26772
|
pointer-events: none;
|
|
26569
26773
|
}
|
|
26570
26774
|
`;
|
|
@@ -26584,7 +26788,6 @@ class ClientTag extends Component {
|
|
|
26584
26788
|
left: `${x - 1}px`,
|
|
26585
26789
|
border: `1px solid ${color}`,
|
|
26586
26790
|
"background-color": color,
|
|
26587
|
-
opacity: this.props.active ? "opacity:1 !important" : undefined,
|
|
26588
26791
|
});
|
|
26589
26792
|
}
|
|
26590
26793
|
}
|
|
@@ -40761,7 +40964,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
40761
40964
|
return percentile(rangeValues, Number(threshold.value) / 100, true);
|
|
40762
40965
|
case "formula":
|
|
40763
40966
|
const value = threshold.value && this.getters.evaluateFormula(sheetId, threshold.value);
|
|
40764
|
-
return
|
|
40967
|
+
return typeof value === "number" ? value : null;
|
|
40765
40968
|
default:
|
|
40766
40969
|
return null;
|
|
40767
40970
|
}
|
|
@@ -40887,10 +41090,13 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
40887
41090
|
}
|
|
40888
41091
|
const [value0, value1] = rule.values.map((val) => {
|
|
40889
41092
|
if (val.startsWith("=")) {
|
|
40890
|
-
return this.getters.evaluateFormula(target.sheetId, val);
|
|
41093
|
+
return this.getters.evaluateFormula(target.sheetId, val) ?? "";
|
|
40891
41094
|
}
|
|
40892
41095
|
return parseLiteral(val, DEFAULT_LOCALE);
|
|
40893
41096
|
});
|
|
41097
|
+
if (isMatrix(value0) || isMatrix(value1)) {
|
|
41098
|
+
return false;
|
|
41099
|
+
}
|
|
40894
41100
|
switch (rule.operator) {
|
|
40895
41101
|
case "IsEmpty":
|
|
40896
41102
|
return cell.value.toString().trim() === "";
|
|
@@ -41079,7 +41285,7 @@ class EvaluationDataValidationPlugin extends UIPlugin {
|
|
|
41079
41285
|
const formula = compile(value);
|
|
41080
41286
|
const translatedFormula = this.getters.getTranslatedCellFormula(sheetId, offset.col, offset.row, formula, formula.dependencies.map((d) => this.getters.getRangeFromSheetXC(sheetId, d)));
|
|
41081
41287
|
const evaluated = this.getters.evaluateFormula(sheetId, translatedFormula);
|
|
41082
|
-
return evaluated ? evaluated.toString() : "";
|
|
41288
|
+
return evaluated && !isMatrix(evaluated) ? evaluated.toString() : "";
|
|
41083
41289
|
}
|
|
41084
41290
|
catch (e) {
|
|
41085
41291
|
return e instanceof EvaluationError ? e.errorType : CellErrorType.GenericError;
|
|
@@ -47574,6 +47780,9 @@ class EditionPlugin extends UIPlugin {
|
|
|
47574
47780
|
const cellValue = content.startsWith("=")
|
|
47575
47781
|
? this.getters.evaluateFormula(this.sheetId, content)
|
|
47576
47782
|
: parseLiteral(content, this.getters.getLocale());
|
|
47783
|
+
if (isMatrix(cellValue)) {
|
|
47784
|
+
return "Success" /* CommandResult.Success */;
|
|
47785
|
+
}
|
|
47577
47786
|
const validationResult = this.getters.getValidationResultForCellValue(cellValue, cellPosition);
|
|
47578
47787
|
if (!validationResult.isValid && validationResult.rule.isBlocking) {
|
|
47579
47788
|
return "BlockingValidationRule" /* CommandResult.BlockingValidationRule */;
|
|
@@ -50813,6 +51022,7 @@ const BORDER_POSITIONS = [
|
|
|
50813
51022
|
css /* scss */ `
|
|
50814
51023
|
.o-border-selector {
|
|
50815
51024
|
padding: 4px;
|
|
51025
|
+
background-color: white;
|
|
50816
51026
|
}
|
|
50817
51027
|
.o-divider {
|
|
50818
51028
|
border-right: 1px solid #e0e2e4;
|
|
@@ -55495,6 +55705,6 @@ const constants = {
|
|
|
55495
55705
|
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
55496
55706
|
|
|
55497
55707
|
|
|
55498
|
-
__info__.version = "16.5.0-alpha.
|
|
55499
|
-
__info__.date = "2023-10-
|
|
55500
|
-
__info__.hash = "
|
|
55708
|
+
__info__.version = "16.5.0-alpha.13";
|
|
55709
|
+
__info__.date = "2023-10-25T10:04:45.428Z";
|
|
55710
|
+
__info__.hash = "18a08b1";
|