@odoo/o-spreadsheet 16.4.30 → 16.4.32
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 +382 -16
- package/dist/o-spreadsheet.d.ts +1 -1
- package/dist/o-spreadsheet.esm.js +382 -16
- package/dist/o-spreadsheet.iife.js +382 -16
- package/dist/o-spreadsheet.iife.min.js +96 -96
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -16383,7 +16383,7 @@
|
|
|
16383
16383
|
/**
|
|
16384
16384
|
* Get a default chart js configuration
|
|
16385
16385
|
*/
|
|
16386
|
-
function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale }) {
|
|
16386
|
+
function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale }, truncateLabels = true) {
|
|
16387
16387
|
return {
|
|
16388
16388
|
type: chart.type,
|
|
16389
16389
|
options: {
|
|
@@ -16436,7 +16436,7 @@
|
|
|
16436
16436
|
},
|
|
16437
16437
|
},
|
|
16438
16438
|
data: {
|
|
16439
|
-
labels: labels.map(truncateLabel),
|
|
16439
|
+
labels: truncateLabels ? labels.map(truncateLabel) : labels,
|
|
16440
16440
|
datasets: [],
|
|
16441
16441
|
},
|
|
16442
16442
|
};
|
|
@@ -17279,9 +17279,9 @@
|
|
|
17279
17279
|
}
|
|
17280
17280
|
return true;
|
|
17281
17281
|
}
|
|
17282
|
-
function getLineConfiguration(chart, labels, localeFormat) {
|
|
17282
|
+
function getLineConfiguration(chart, labels, localeFormat, truncateLabels = true) {
|
|
17283
17283
|
const fontColor = chartFontColor(chart.background);
|
|
17284
|
-
const config = getDefaultChartJsRuntime(chart, labels, fontColor, localeFormat);
|
|
17284
|
+
const config = getDefaultChartJsRuntime(chart, labels, fontColor, localeFormat, truncateLabels);
|
|
17285
17285
|
const legend = {
|
|
17286
17286
|
labels: {
|
|
17287
17287
|
fontColor,
|
|
@@ -17357,9 +17357,10 @@
|
|
|
17357
17357
|
({ labels, dataSetsValues } = aggregateDataForLabels(labels, dataSetsValues));
|
|
17358
17358
|
}
|
|
17359
17359
|
const locale = getters.getLocale();
|
|
17360
|
+
const truncateLabels = axisType === "category";
|
|
17360
17361
|
const dataSetFormat = getChartDatasetFormat(getters, chart.dataSets);
|
|
17361
17362
|
const localeFormat = { format: dataSetFormat, locale };
|
|
17362
|
-
const config = getLineConfiguration(chart, labels, localeFormat);
|
|
17363
|
+
const config = getLineConfiguration(chart, labels, localeFormat, truncateLabels);
|
|
17363
17364
|
const labelFormat = getChartLabelFormat(getters, chart.labelRange);
|
|
17364
17365
|
if (axisType === "time") {
|
|
17365
17366
|
config.options.scales.xAxes[0].type = "time";
|
|
@@ -31399,7 +31400,7 @@
|
|
|
31399
31400
|
this.clearBorders(cmd.sheetId, cmd.target);
|
|
31400
31401
|
break;
|
|
31401
31402
|
case "REMOVE_COLUMNS_ROWS":
|
|
31402
|
-
for (let el of cmd.elements) {
|
|
31403
|
+
for (let el of [...cmd.elements].sort((a, b) => b - a)) {
|
|
31403
31404
|
if (cmd.dimension === "COL") {
|
|
31404
31405
|
this.shiftBordersHorizontally(cmd.sheetId, el + 1, -1);
|
|
31405
31406
|
}
|
|
@@ -35770,6 +35771,353 @@
|
|
|
35770
35771
|
}
|
|
35771
35772
|
}
|
|
35772
35773
|
|
|
35774
|
+
/**
|
|
35775
|
+
* ####################################################
|
|
35776
|
+
* # INTRODUCTION
|
|
35777
|
+
* ####################################################
|
|
35778
|
+
*
|
|
35779
|
+
* This file contain the function recomputeZones.
|
|
35780
|
+
* This function try to recompute in a performant way
|
|
35781
|
+
* an ensemble of zones possibly overlapping to avoid
|
|
35782
|
+
* overlapping and to reduce the number of zones.
|
|
35783
|
+
*
|
|
35784
|
+
* It also allows to remove some zones from the ensemble.
|
|
35785
|
+
*
|
|
35786
|
+
* In the following example, 2 zones are overlapping.
|
|
35787
|
+
* Applying recomputeZones will return zones without
|
|
35788
|
+
* overlapping:
|
|
35789
|
+
*
|
|
35790
|
+
* ["B3:D4", "D2:E3"] ["B3:C4", "D2:D4", "E2:E3"]
|
|
35791
|
+
*
|
|
35792
|
+
* A B C D E A B C D E
|
|
35793
|
+
* 1 ___ 1 ___
|
|
35794
|
+
* 2 ___|_ | 2 ___| | |
|
|
35795
|
+
* 3 | |_|_| ---> 3 | | |_|
|
|
35796
|
+
* 4 |_____| 4 |___|_|
|
|
35797
|
+
* 6 6
|
|
35798
|
+
* 7 7
|
|
35799
|
+
*
|
|
35800
|
+
*
|
|
35801
|
+
* In the following example, 2 zones are contiguous.
|
|
35802
|
+
* Applying recomputeZones will return only one zone:
|
|
35803
|
+
*
|
|
35804
|
+
* ["B2:B3", "C2:D3"] ["B2:D3"]
|
|
35805
|
+
*
|
|
35806
|
+
* A B C D E A B C D E
|
|
35807
|
+
* 1 _ ___ 1 _____
|
|
35808
|
+
* 2 | | | ---> 2 | |
|
|
35809
|
+
* 3 |_|___| 3 |_____|
|
|
35810
|
+
* 4 4
|
|
35811
|
+
*
|
|
35812
|
+
*
|
|
35813
|
+
* In the following example, we want to remove a zone
|
|
35814
|
+
* from the ensemble. Applying recomputeZones will
|
|
35815
|
+
* return the ensemble without the zone to remove:
|
|
35816
|
+
*
|
|
35817
|
+
* remove ["C3:D3"] ["B2:B4", "C2:D2",
|
|
35818
|
+
* "C4:D4", "E2:E4"]
|
|
35819
|
+
*
|
|
35820
|
+
* A B C D E F A B C D E F
|
|
35821
|
+
* 1 _______ 1 _______
|
|
35822
|
+
* 2 | | ---> 2 | |___| |
|
|
35823
|
+
* 3 | xxx | 3 | |___| |
|
|
35824
|
+
* 4 |_______| 4 |_|___|_|
|
|
35825
|
+
* 5 5
|
|
35826
|
+
*
|
|
35827
|
+
*
|
|
35828
|
+
* The exercise seems simple when we have only 2 zones.
|
|
35829
|
+
* But with n zones and in a performant way, we want to
|
|
35830
|
+
* avoid comparing each zone with all the others.
|
|
35831
|
+
*
|
|
35832
|
+
*
|
|
35833
|
+
* ####################################################
|
|
35834
|
+
* # Methodological approach
|
|
35835
|
+
* ####################################################
|
|
35836
|
+
*
|
|
35837
|
+
* The methodological approach to avoid comparing each
|
|
35838
|
+
* zone with all the others is to use a data structure
|
|
35839
|
+
* that allow to quickly find which zones are
|
|
35840
|
+
* overlapping with any other given zone.
|
|
35841
|
+
*
|
|
35842
|
+
* Here the idea is to profile the zones at the columns level.
|
|
35843
|
+
*
|
|
35844
|
+
* To do that, we propose to use a data structure
|
|
35845
|
+
* composed of 2 parts:
|
|
35846
|
+
* - profilesStartingPosition: a sorted number array
|
|
35847
|
+
* indicating on which columns a new profile begins.
|
|
35848
|
+
* - profiles: a map where the key is a column
|
|
35849
|
+
* position (from profilesStartingPosition) and the
|
|
35850
|
+
* value is a sorted number array representing a
|
|
35851
|
+
* profile.
|
|
35852
|
+
*
|
|
35853
|
+
*
|
|
35854
|
+
* See the following example: here profileStartingPosition
|
|
35855
|
+
* corresponds to [A,C,E,G,K]
|
|
35856
|
+
* A B C D E F G H I J K so with number [0,2,4,6,10]
|
|
35857
|
+
* 1 ' ' ' '
|
|
35858
|
+
* 2 ' ' '_______' here profile correspond
|
|
35859
|
+
* 3 '___' |_______| for A to []
|
|
35860
|
+
* 4 | | for C to [3, 5]
|
|
35861
|
+
* 5 |___| for E to []
|
|
35862
|
+
* 6 for G to [2, 3]
|
|
35863
|
+
* 7 for K to []
|
|
35864
|
+
*
|
|
35865
|
+
*
|
|
35866
|
+
* Now we can easily find which zones are overlapping
|
|
35867
|
+
* with a given zone. Suppose we want to add a new zone
|
|
35868
|
+
* D5:H6 to the ensemble:
|
|
35869
|
+
*
|
|
35870
|
+
* With a binary search of left and right
|
|
35871
|
+
* A B C D E F G H I J K on profilesStartingPosition, we can
|
|
35872
|
+
* 1 ' ' ' ' find the indexes of the profiles on which
|
|
35873
|
+
* 2 ' ' '_______' to apply a modification.
|
|
35874
|
+
* 3 '___' |_______|
|
|
35875
|
+
* 4 | _|_______ Here we will:
|
|
35876
|
+
* 5 |_|_| | - add a new profile in D --> become [3, 6]
|
|
35877
|
+
* 6 |_________| - modify the profile in E --> become [4, 6]
|
|
35878
|
+
* 7 - modify the profile in G --> become [2, 3, 4, 6]
|
|
35879
|
+
* - add a new profile in I --> become [8, 10]
|
|
35880
|
+
*
|
|
35881
|
+
* See below the result:
|
|
35882
|
+
*
|
|
35883
|
+
* Note the particularity of the profile
|
|
35884
|
+
* A B C D E F G H I J K for G: it will correspond to [2, 3, 4, 6]
|
|
35885
|
+
* 1 ' ' ' ' ' '
|
|
35886
|
+
* 2 ' ' ' '___'___' To know how to modify the profile (add a
|
|
35887
|
+
* 3 '_'_' |___|___| zone or remove it) we do a binary
|
|
35888
|
+
* 4 | | |___ ___ search of the top and bottom value on the
|
|
35889
|
+
* 5 |_| | | | profile array. Depending on the result index
|
|
35890
|
+
* 6 |_|___|___| parity (odd or even), because zone boundaries
|
|
35891
|
+
* 7 go by pairs, we know if we are in a zone or
|
|
35892
|
+
* not and how operate.
|
|
35893
|
+
*/
|
|
35894
|
+
/**
|
|
35895
|
+
* Recompute the zone without the cells in toRemoveZones and avoid overlapping.
|
|
35896
|
+
* This compute is particularly useful because after this function:
|
|
35897
|
+
* - you will find coordinate of a cell only once among all the zones
|
|
35898
|
+
* - the number of zones will be reduced to the minimum
|
|
35899
|
+
*/
|
|
35900
|
+
function futureRecomputeZones(zones, zonesToRemove = []) {
|
|
35901
|
+
const profilesStartingPosition = [0];
|
|
35902
|
+
const profiles = new Map([[0, []]]);
|
|
35903
|
+
modifyProfiles(profilesStartingPosition, profiles, zones, false);
|
|
35904
|
+
modifyProfiles(profilesStartingPosition, profiles, zonesToRemove, true);
|
|
35905
|
+
return constructZonesFromProfiles(profilesStartingPosition, profiles);
|
|
35906
|
+
}
|
|
35907
|
+
function modifyProfiles(// export for testing only
|
|
35908
|
+
profilesStartingPosition, profiles, zones, toRemove = false) {
|
|
35909
|
+
for (const zone of zones) {
|
|
35910
|
+
const leftValue = zone.left;
|
|
35911
|
+
const rightValue = zone.right === undefined ? undefined : zone.right + 1;
|
|
35912
|
+
const leftIndex = findIndexAndCreateProfile(profilesStartingPosition, profiles, leftValue, true, 0);
|
|
35913
|
+
const rightIndex = findIndexAndCreateProfile(profilesStartingPosition, profiles, rightValue, false, leftIndex);
|
|
35914
|
+
for (let i = leftIndex; i <= rightIndex; i++) {
|
|
35915
|
+
const profile = profiles.get(profilesStartingPosition[i]);
|
|
35916
|
+
modifyProfile(profile, zone, toRemove);
|
|
35917
|
+
}
|
|
35918
|
+
// maybe this part cost in performance, and maybe it's not necessary (depending on the use case). To be checked
|
|
35919
|
+
removeContiguousProfiles(profilesStartingPosition, profiles, leftIndex, rightIndex);
|
|
35920
|
+
}
|
|
35921
|
+
}
|
|
35922
|
+
function findIndexAndCreateProfile(profilesStartingPosition, profiles, value, searchLeft, startIndex) {
|
|
35923
|
+
if (value === undefined) {
|
|
35924
|
+
// this is only the case when the value correspond to a bottom value that could be undefined
|
|
35925
|
+
return profilesStartingPosition.length - 1;
|
|
35926
|
+
}
|
|
35927
|
+
const predecessorIndex = binaryPredecessorSearch(profilesStartingPosition, value, startIndex);
|
|
35928
|
+
if (value != profilesStartingPosition[predecessorIndex]) {
|
|
35929
|
+
// mean that the value is not ending/starting at the same position as the previous/next profile
|
|
35930
|
+
// --> it's a new profile
|
|
35931
|
+
// --> we need to add it
|
|
35932
|
+
profilesStartingPosition.splice(predecessorIndex + 1, 0, value);
|
|
35933
|
+
// suppose the we want to add the for the left value
|
|
35934
|
+
// following profile following zone: 'C', the predecessor index
|
|
35935
|
+
// for B: [1, 3] "C3:D4" correspond to 'B'.
|
|
35936
|
+
// The next line code will
|
|
35937
|
+
// A B C D A B C D copy the profile of 'B'
|
|
35938
|
+
// 1 '___' 1 '___' to 'C'. In the rest of the
|
|
35939
|
+
// 2 | | ---> 2 | _|_ process the 'modifyProfile'
|
|
35940
|
+
// 3 |___| 3 |_|_| | function will adapt the waiting
|
|
35941
|
+
// 4 4 |___| 'C' profile [1, 3] to the
|
|
35942
|
+
// correct 'C' profile [1, 4]
|
|
35943
|
+
profiles.set(value, [...profiles.get(profilesStartingPosition[predecessorIndex])]);
|
|
35944
|
+
return searchLeft ? predecessorIndex + 1 : predecessorIndex;
|
|
35945
|
+
}
|
|
35946
|
+
return searchLeft ? predecessorIndex : predecessorIndex - 1;
|
|
35947
|
+
}
|
|
35948
|
+
/**
|
|
35949
|
+
* Suppose the following Suppose we want to add We want to have the
|
|
35950
|
+
* profile: the following zone: following profile:
|
|
35951
|
+
*
|
|
35952
|
+
* A B C D E F A B C D E F A B C D E F
|
|
35953
|
+
* 1 '___' 1 ' ' 1 '___'
|
|
35954
|
+
* 2 |___| 2 '___' 2 | |
|
|
35955
|
+
* 3 ' ' 3 | | 3 | |
|
|
35956
|
+
* 4 '___' --> 4 | | --> 4 | |
|
|
35957
|
+
* 6 | | 6 |___| 6 | |
|
|
35958
|
+
* 7 |___| 7 7 |___|
|
|
35959
|
+
* 8 8 8
|
|
35960
|
+
*
|
|
35961
|
+
* the profile for 'C' the top zone correspond Here [2, 3, 5, 8] with [3, 7]
|
|
35962
|
+
* corresponds to: to 3 and the bottom zone would be merged into [2, 8]
|
|
35963
|
+
* ____ ____ correspond to 6
|
|
35964
|
+
* [2, 3, 5, 8] would be the profile: The difficulty of modify profile
|
|
35965
|
+
* ____ is to know what must be deleted
|
|
35966
|
+
* Note that the 'filled [3, 7] and what must be added to the
|
|
35967
|
+
* zone' are always between existing profile.
|
|
35968
|
+
* an even index and its
|
|
35969
|
+
* next index
|
|
35970
|
+
*
|
|
35971
|
+
*/
|
|
35972
|
+
function modifyProfile(profile, zone, toRemove = false) {
|
|
35973
|
+
const topValue = zone.top;
|
|
35974
|
+
const bottomValue = zone.bottom === undefined ? undefined : zone.bottom + 1;
|
|
35975
|
+
const newPoints = [];
|
|
35976
|
+
// Case we want to add a zone to the profile:
|
|
35977
|
+
// - If the top predecessor index `topPredIndex` is even, it means the top of the zone is already positioned on a filled zone
|
|
35978
|
+
// so we don't need to add it to the profile. we can keep in reference the index of the predecessor.
|
|
35979
|
+
// - If it is odd, it means the top of the zone must be the beginning of a filled zone.
|
|
35980
|
+
// so we can keep the index of the top position
|
|
35981
|
+
// Case we want to remove a zone from the profile: it's the opposite of the previous case
|
|
35982
|
+
const topPredIndex = binaryPredecessorSearch(profile, topValue, 0, false);
|
|
35983
|
+
if ((topPredIndex % 2 !== 0 && !toRemove) || (topPredIndex % 2 === 0 && toRemove)) {
|
|
35984
|
+
newPoints.push(topValue);
|
|
35985
|
+
}
|
|
35986
|
+
if (bottomValue === undefined) {
|
|
35987
|
+
// The following two code lines will not impact the final result,
|
|
35988
|
+
// but they will impact the intermediate profile.
|
|
35989
|
+
// We keep them for performance reason
|
|
35990
|
+
profile.splice(topPredIndex + 1);
|
|
35991
|
+
profile.push(...newPoints);
|
|
35992
|
+
return;
|
|
35993
|
+
}
|
|
35994
|
+
// Case we want to add a zone to the profile:
|
|
35995
|
+
// - If the bottom successor index `bottomSuccIndex` is even, it means the bottom of the zone must be the ending of a filled zone
|
|
35996
|
+
// so we can keep the index of the bottom position.
|
|
35997
|
+
// - If it is odd, it means the bottom of the zone is already positioned on a filled zone
|
|
35998
|
+
// so we don't need to add it to the profile. we can keep in reference the index of the successor
|
|
35999
|
+
// Case we want to remove a zone from the profile: it's the opposite of the previous case
|
|
36000
|
+
const bottomSuccIndex = binarySuccessorSearch(profile, bottomValue, 0, false);
|
|
36001
|
+
if ((bottomSuccIndex % 2 === 0 && !toRemove) || (bottomSuccIndex % 2 !== 0 && toRemove)) {
|
|
36002
|
+
newPoints.push(bottomValue);
|
|
36003
|
+
}
|
|
36004
|
+
// add the top and bottom value to the profile and
|
|
36005
|
+
// remove all information between the top and bottom index
|
|
36006
|
+
profile.splice(topPredIndex + 1, bottomSuccIndex - topPredIndex - 1, ...newPoints);
|
|
36007
|
+
}
|
|
36008
|
+
function removeContiguousProfiles(profilesStartingPosition, profiles, leftIndex, rightIndex) {
|
|
36009
|
+
const start = leftIndex - 1 === -1 ? 0 : leftIndex - 1;
|
|
36010
|
+
const end = rightIndex === profilesStartingPosition.length - 1 ? rightIndex : rightIndex + 1;
|
|
36011
|
+
for (let i = end; i > start; i--) {
|
|
36012
|
+
if (deepEqualsArray(profiles.get(profilesStartingPosition[i]), profiles.get(profilesStartingPosition[i - 1]))) {
|
|
36013
|
+
profiles.delete(profilesStartingPosition[i]);
|
|
36014
|
+
profilesStartingPosition.splice(i, 1);
|
|
36015
|
+
}
|
|
36016
|
+
}
|
|
36017
|
+
}
|
|
36018
|
+
function constructZonesFromProfiles(profilesStartingPosition, profiles) {
|
|
36019
|
+
const mergedZone = [];
|
|
36020
|
+
let pendingZones = [];
|
|
36021
|
+
for (let colIndex = 0; colIndex < profilesStartingPosition.length; colIndex++) {
|
|
36022
|
+
const left = profilesStartingPosition[colIndex];
|
|
36023
|
+
const profile = profiles.get(left);
|
|
36024
|
+
if (!profile || profile.length === 0) {
|
|
36025
|
+
mergedZone.push(...pendingZones);
|
|
36026
|
+
pendingZones = [];
|
|
36027
|
+
continue;
|
|
36028
|
+
}
|
|
36029
|
+
let right = profilesStartingPosition[colIndex + 1];
|
|
36030
|
+
if (right !== undefined) {
|
|
36031
|
+
right--;
|
|
36032
|
+
}
|
|
36033
|
+
const nextPendingZones = [];
|
|
36034
|
+
for (let i = 0; i < profile.length; i += 2) {
|
|
36035
|
+
const top = profile[i];
|
|
36036
|
+
let bottom = profile[i + 1];
|
|
36037
|
+
if (bottom !== undefined) {
|
|
36038
|
+
bottom--;
|
|
36039
|
+
}
|
|
36040
|
+
const profileZone = {
|
|
36041
|
+
top,
|
|
36042
|
+
left,
|
|
36043
|
+
bottom,
|
|
36044
|
+
right,
|
|
36045
|
+
hasHeader: (bottom === undefined && top !== 0) || (right === undefined && left !== 0),
|
|
36046
|
+
};
|
|
36047
|
+
let findCorrespondingZone = false;
|
|
36048
|
+
for (let j = pendingZones.length - 1; j >= 0; j--) {
|
|
36049
|
+
const pendingZone = pendingZones[j];
|
|
36050
|
+
if (pendingZone.top === profileZone.top && pendingZone.bottom === profileZone.bottom) {
|
|
36051
|
+
pendingZone.right = profileZone.right;
|
|
36052
|
+
pendingZones.splice(j, 1);
|
|
36053
|
+
nextPendingZones.push(pendingZone);
|
|
36054
|
+
findCorrespondingZone = true;
|
|
36055
|
+
break;
|
|
36056
|
+
}
|
|
36057
|
+
}
|
|
36058
|
+
if (!findCorrespondingZone) {
|
|
36059
|
+
nextPendingZones.push(profileZone);
|
|
36060
|
+
}
|
|
36061
|
+
}
|
|
36062
|
+
mergedZone.push(...pendingZones);
|
|
36063
|
+
pendingZones = nextPendingZones;
|
|
36064
|
+
}
|
|
36065
|
+
mergedZone.push(...pendingZones);
|
|
36066
|
+
return mergedZone;
|
|
36067
|
+
}
|
|
36068
|
+
function binaryPredecessorSearch(arr, val, start = 0, matchEqual = true) {
|
|
36069
|
+
let end = arr.length - 1;
|
|
36070
|
+
let result = -1;
|
|
36071
|
+
while (start <= end) {
|
|
36072
|
+
const mid = Math.floor((start + end) / 2);
|
|
36073
|
+
if (arr[mid] === val && matchEqual) {
|
|
36074
|
+
return mid;
|
|
36075
|
+
}
|
|
36076
|
+
else if (arr[mid] < val) {
|
|
36077
|
+
result = mid;
|
|
36078
|
+
start = mid + 1;
|
|
36079
|
+
}
|
|
36080
|
+
else {
|
|
36081
|
+
end = mid - 1;
|
|
36082
|
+
}
|
|
36083
|
+
}
|
|
36084
|
+
return result;
|
|
36085
|
+
}
|
|
36086
|
+
function binarySuccessorSearch(arr, val, start = 0, matchEqual = true) {
|
|
36087
|
+
let end = arr.length - 1;
|
|
36088
|
+
let result = arr.length;
|
|
36089
|
+
while (start <= end) {
|
|
36090
|
+
const mid = Math.floor((start + end) / 2);
|
|
36091
|
+
if (arr[mid] === val && matchEqual) {
|
|
36092
|
+
return mid;
|
|
36093
|
+
}
|
|
36094
|
+
else if (arr[mid] > val) {
|
|
36095
|
+
result = mid;
|
|
36096
|
+
end = mid - 1;
|
|
36097
|
+
}
|
|
36098
|
+
else {
|
|
36099
|
+
start = mid + 1;
|
|
36100
|
+
}
|
|
36101
|
+
}
|
|
36102
|
+
return result;
|
|
36103
|
+
}
|
|
36104
|
+
/**
|
|
36105
|
+
* Compares two arrays.
|
|
36106
|
+
* For performance reasons, this function is to be preferred
|
|
36107
|
+
* to 'deepEquals' in the case we know that the inputs are arrays.
|
|
36108
|
+
*/
|
|
36109
|
+
function deepEqualsArray(arr1, arr2) {
|
|
36110
|
+
if (arr1.length !== arr2.length) {
|
|
36111
|
+
return false;
|
|
36112
|
+
}
|
|
36113
|
+
for (let i = 0; i < arr1.length; i++) {
|
|
36114
|
+
if (!deepEquals(arr1[i], arr2[i])) {
|
|
36115
|
+
return false;
|
|
36116
|
+
}
|
|
36117
|
+
}
|
|
36118
|
+
return true;
|
|
36119
|
+
}
|
|
36120
|
+
|
|
35773
36121
|
function quickselect(arr, k, left, right, compare) {
|
|
35774
36122
|
quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare);
|
|
35775
36123
|
}
|
|
@@ -36533,7 +36881,7 @@
|
|
|
36533
36881
|
}
|
|
36534
36882
|
}
|
|
36535
36883
|
/**
|
|
36536
|
-
* Return the
|
|
36884
|
+
* Return all the cells that depend on the provided ranges,
|
|
36537
36885
|
* in the correct order they should be evaluated.
|
|
36538
36886
|
* This is called a topological ordering (excluding cycles)
|
|
36539
36887
|
*/
|
|
@@ -36544,11 +36892,20 @@
|
|
|
36544
36892
|
const range = queue.pop();
|
|
36545
36893
|
visited.addMany(this.encoder.encodeBoundingBox(range));
|
|
36546
36894
|
const impactedPositionIds = this.rTree.search(range).map((dep) => dep.data);
|
|
36895
|
+
const nextInQueue = {};
|
|
36547
36896
|
for (const positionId of impactedPositionIds) {
|
|
36548
36897
|
if (!visited.has(positionId)) {
|
|
36549
|
-
|
|
36898
|
+
const { sheetId, zone } = this.encoder.decodeToBoundingBox(positionId);
|
|
36899
|
+
if (!nextInQueue[sheetId]) {
|
|
36900
|
+
nextInQueue[sheetId] = [];
|
|
36901
|
+
}
|
|
36902
|
+
nextInQueue[sheetId].push(zone);
|
|
36550
36903
|
}
|
|
36551
36904
|
}
|
|
36905
|
+
for (const sheetId in nextInQueue) {
|
|
36906
|
+
const zones = futureRecomputeZones(nextInQueue[sheetId]);
|
|
36907
|
+
queue.push(...zones.map((zone) => ({ sheetId, zone })));
|
|
36908
|
+
}
|
|
36552
36909
|
}
|
|
36553
36910
|
visited.deleteMany(ranges.flatMap((r) => this.encoder.encodeBoundingBox(r)));
|
|
36554
36911
|
return visited;
|
|
@@ -36697,7 +37054,7 @@
|
|
|
36697
37054
|
}
|
|
36698
37055
|
if (!content) {
|
|
36699
37056
|
// The previous content could have blocked some array formulas
|
|
36700
|
-
impactedPositionIds.addMany(this.
|
|
37057
|
+
impactedPositionIds.addMany(this.getArrayFormulasBlockedBy(positionId));
|
|
36701
37058
|
}
|
|
36702
37059
|
}
|
|
36703
37060
|
return impactedPositionIds;
|
|
@@ -36741,13 +37098,22 @@
|
|
|
36741
37098
|
}
|
|
36742
37099
|
return positionIds;
|
|
36743
37100
|
}
|
|
36744
|
-
|
|
37101
|
+
/**
|
|
37102
|
+
* Return the position of formulas blocked by the given position
|
|
37103
|
+
* as well as all their dependencies.
|
|
37104
|
+
*/
|
|
37105
|
+
getArrayFormulasBlockedBy(positionId) {
|
|
36745
37106
|
if (!this.spreadingRelations.hasArrayFormulaResult(positionId)) {
|
|
36746
37107
|
return [];
|
|
36747
37108
|
}
|
|
36748
37109
|
const arrayFormulas = this.spreadingRelations.getFormulaPositionsSpreadingOn(positionId);
|
|
36749
37110
|
const cells = new JetSet(arrayFormulas);
|
|
36750
|
-
|
|
37111
|
+
const arrayFormulaPositionId = this.getArrayFormulaSpreadingOnId(positionId);
|
|
37112
|
+
if (arrayFormulaPositionId) {
|
|
37113
|
+
// ignore the formula spreading on the position. Keep only the blocked ones
|
|
37114
|
+
cells.delete(arrayFormulaPositionId);
|
|
37115
|
+
}
|
|
37116
|
+
cells.addMany(this.getCellsDependingOn(cells));
|
|
36751
37117
|
return cells;
|
|
36752
37118
|
}
|
|
36753
37119
|
nextPositionsToUpdate = new JetSet();
|
|
@@ -36914,7 +37280,7 @@
|
|
|
36914
37280
|
}
|
|
36915
37281
|
this.evaluatedCells.delete(child);
|
|
36916
37282
|
this.nextPositionsToUpdate.addMany(this.getCellsDependingOn([child]));
|
|
36917
|
-
this.nextPositionsToUpdate.addMany(this.
|
|
37283
|
+
this.nextPositionsToUpdate.addMany(this.getArrayFormulasBlockedBy(child));
|
|
36918
37284
|
}
|
|
36919
37285
|
this.spreadingRelations.removeNode(positionId);
|
|
36920
37286
|
}
|
|
@@ -37284,7 +37650,7 @@
|
|
|
37284
37650
|
? getItemId(newFormat, data.formats)
|
|
37285
37651
|
: exportedCellData.format;
|
|
37286
37652
|
let content;
|
|
37287
|
-
if (formulaCell instanceof FormulaCellWithDependencies) {
|
|
37653
|
+
if (isExported && formulaCell instanceof FormulaCellWithDependencies) {
|
|
37288
37654
|
content = this.getters.buildFormulaContent(exportedSheetData.id, formulaCell, formulaCell.dependencies, true);
|
|
37289
37655
|
}
|
|
37290
37656
|
else {
|
|
@@ -51760,9 +52126,9 @@
|
|
|
51760
52126
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
51761
52127
|
|
|
51762
52128
|
|
|
51763
|
-
__info__.version = '16.4.
|
|
51764
|
-
__info__.date = '2024-
|
|
51765
|
-
__info__.hash = '
|
|
52129
|
+
__info__.version = '16.4.32';
|
|
52130
|
+
__info__.date = '2024-05-07T10:38:24.733Z';
|
|
52131
|
+
__info__.hash = '314d75d';
|
|
51766
52132
|
|
|
51767
52133
|
|
|
51768
52134
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|