@odoo/o-spreadsheet 17.0.19 → 17.0.20
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 -20
- package/dist/o-spreadsheet.esm.js +382 -20
- package/dist/o-spreadsheet.iife.js +382 -20
- package/dist/o-spreadsheet.iife.min.js +100 -100
- 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.0.
|
|
6
|
-
* @date 2024-04-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.20
|
|
6
|
+
* @date 2024-04-26T07:37:04.503Z
|
|
7
|
+
* @hash 065ac98
|
|
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';
|
|
@@ -26666,17 +26666,13 @@ class Composer extends Component {
|
|
|
26666
26666
|
this.env.focusableElement.setFocusableElement(el);
|
|
26667
26667
|
}
|
|
26668
26668
|
this.contentHelper.updateEl(el);
|
|
26669
|
-
this.processTokenAtCursor();
|
|
26670
26669
|
});
|
|
26671
26670
|
useEffect(() => {
|
|
26672
26671
|
this.processContent();
|
|
26673
26672
|
});
|
|
26674
|
-
|
|
26675
|
-
|
|
26676
|
-
|
|
26677
|
-
this.processTokenAtCursor();
|
|
26678
|
-
}
|
|
26679
|
-
});
|
|
26673
|
+
useEffect(() => {
|
|
26674
|
+
this.processTokenAtCursor();
|
|
26675
|
+
}, () => [this.env.model.getters.getEditionMode() !== "inactive"]);
|
|
26680
26676
|
}
|
|
26681
26677
|
// ---------------------------------------------------------------------------
|
|
26682
26678
|
// Handlers
|
|
@@ -27107,6 +27103,7 @@ class Composer extends Component {
|
|
|
27107
27103
|
const dataValidationAutocompleteValues = this.env.model.getters.getAutoCompleteDataValidationValues();
|
|
27108
27104
|
if (!content.startsWith("=") && dataValidationAutocompleteValues.length) {
|
|
27109
27105
|
this.showDataValidationAutocomplete(dataValidationAutocompleteValues);
|
|
27106
|
+
return;
|
|
27110
27107
|
}
|
|
27111
27108
|
if (content.startsWith("=")) {
|
|
27112
27109
|
const token = this.env.model.getters.getTokenAtCursor();
|
|
@@ -34366,7 +34363,7 @@ class BordersPlugin extends CorePlugin {
|
|
|
34366
34363
|
this.clearBorders(cmd.sheetId, cmd.target);
|
|
34367
34364
|
break;
|
|
34368
34365
|
case "REMOVE_COLUMNS_ROWS":
|
|
34369
|
-
for (let el of cmd.elements) {
|
|
34366
|
+
for (let el of [...cmd.elements].sort((a, b) => b - a)) {
|
|
34370
34367
|
if (cmd.dimension === "COL") {
|
|
34371
34368
|
this.shiftBordersHorizontally(cmd.sheetId, el + 1, -1);
|
|
34372
34369
|
}
|
|
@@ -40146,6 +40143,353 @@ class CompilationParametersBuilder {
|
|
|
40146
40143
|
}
|
|
40147
40144
|
}
|
|
40148
40145
|
|
|
40146
|
+
/**
|
|
40147
|
+
* ####################################################
|
|
40148
|
+
* # INTRODUCTION
|
|
40149
|
+
* ####################################################
|
|
40150
|
+
*
|
|
40151
|
+
* This file contain the function recomputeZones.
|
|
40152
|
+
* This function try to recompute in a performant way
|
|
40153
|
+
* an ensemble of zones possibly overlapping to avoid
|
|
40154
|
+
* overlapping and to reduce the number of zones.
|
|
40155
|
+
*
|
|
40156
|
+
* It also allows to remove some zones from the ensemble.
|
|
40157
|
+
*
|
|
40158
|
+
* In the following example, 2 zones are overlapping.
|
|
40159
|
+
* Applying recomputeZones will return zones without
|
|
40160
|
+
* overlapping:
|
|
40161
|
+
*
|
|
40162
|
+
* ["B3:D4", "D2:E3"] ["B3:C4", "D2:D4", "E2:E3"]
|
|
40163
|
+
*
|
|
40164
|
+
* A B C D E A B C D E
|
|
40165
|
+
* 1 ___ 1 ___
|
|
40166
|
+
* 2 ___|_ | 2 ___| | |
|
|
40167
|
+
* 3 | |_|_| ---> 3 | | |_|
|
|
40168
|
+
* 4 |_____| 4 |___|_|
|
|
40169
|
+
* 6 6
|
|
40170
|
+
* 7 7
|
|
40171
|
+
*
|
|
40172
|
+
*
|
|
40173
|
+
* In the following example, 2 zones are contiguous.
|
|
40174
|
+
* Applying recomputeZones will return only one zone:
|
|
40175
|
+
*
|
|
40176
|
+
* ["B2:B3", "C2:D3"] ["B2:D3"]
|
|
40177
|
+
*
|
|
40178
|
+
* A B C D E A B C D E
|
|
40179
|
+
* 1 _ ___ 1 _____
|
|
40180
|
+
* 2 | | | ---> 2 | |
|
|
40181
|
+
* 3 |_|___| 3 |_____|
|
|
40182
|
+
* 4 4
|
|
40183
|
+
*
|
|
40184
|
+
*
|
|
40185
|
+
* In the following example, we want to remove a zone
|
|
40186
|
+
* from the ensemble. Applying recomputeZones will
|
|
40187
|
+
* return the ensemble without the zone to remove:
|
|
40188
|
+
*
|
|
40189
|
+
* remove ["C3:D3"] ["B2:B4", "C2:D2",
|
|
40190
|
+
* "C4:D4", "E2:E4"]
|
|
40191
|
+
*
|
|
40192
|
+
* A B C D E F A B C D E F
|
|
40193
|
+
* 1 _______ 1 _______
|
|
40194
|
+
* 2 | | ---> 2 | |___| |
|
|
40195
|
+
* 3 | xxx | 3 | |___| |
|
|
40196
|
+
* 4 |_______| 4 |_|___|_|
|
|
40197
|
+
* 5 5
|
|
40198
|
+
*
|
|
40199
|
+
*
|
|
40200
|
+
* The exercise seems simple when we have only 2 zones.
|
|
40201
|
+
* But with n zones and in a performant way, we want to
|
|
40202
|
+
* avoid comparing each zone with all the others.
|
|
40203
|
+
*
|
|
40204
|
+
*
|
|
40205
|
+
* ####################################################
|
|
40206
|
+
* # Methodological approach
|
|
40207
|
+
* ####################################################
|
|
40208
|
+
*
|
|
40209
|
+
* The methodological approach to avoid comparing each
|
|
40210
|
+
* zone with all the others is to use a data structure
|
|
40211
|
+
* that allow to quickly find which zones are
|
|
40212
|
+
* overlapping with any other given zone.
|
|
40213
|
+
*
|
|
40214
|
+
* Here the idea is to profile the zones at the columns level.
|
|
40215
|
+
*
|
|
40216
|
+
* To do that, we propose to use a data structure
|
|
40217
|
+
* composed of 2 parts:
|
|
40218
|
+
* - profilesStartingPosition: a sorted number array
|
|
40219
|
+
* indicating on which columns a new profile begins.
|
|
40220
|
+
* - profiles: a map where the key is a column
|
|
40221
|
+
* position (from profilesStartingPosition) and the
|
|
40222
|
+
* value is a sorted number array representing a
|
|
40223
|
+
* profile.
|
|
40224
|
+
*
|
|
40225
|
+
*
|
|
40226
|
+
* See the following example: here profileStartingPosition
|
|
40227
|
+
* corresponds to [A,C,E,G,K]
|
|
40228
|
+
* A B C D E F G H I J K so with number [0,2,4,6,10]
|
|
40229
|
+
* 1 ' ' ' '
|
|
40230
|
+
* 2 ' ' '_______' here profile correspond
|
|
40231
|
+
* 3 '___' |_______| for A to []
|
|
40232
|
+
* 4 | | for C to [3, 5]
|
|
40233
|
+
* 5 |___| for E to []
|
|
40234
|
+
* 6 for G to [2, 3]
|
|
40235
|
+
* 7 for K to []
|
|
40236
|
+
*
|
|
40237
|
+
*
|
|
40238
|
+
* Now we can easily find which zones are overlapping
|
|
40239
|
+
* with a given zone. Suppose we want to add a new zone
|
|
40240
|
+
* D5:H6 to the ensemble:
|
|
40241
|
+
*
|
|
40242
|
+
* With a binary search of left and right
|
|
40243
|
+
* A B C D E F G H I J K on profilesStartingPosition, we can
|
|
40244
|
+
* 1 ' ' ' ' find the indexes of the profiles on which
|
|
40245
|
+
* 2 ' ' '_______' to apply a modification.
|
|
40246
|
+
* 3 '___' |_______|
|
|
40247
|
+
* 4 | _|_______ Here we will:
|
|
40248
|
+
* 5 |_|_| | - add a new profile in D --> become [3, 6]
|
|
40249
|
+
* 6 |_________| - modify the profile in E --> become [4, 6]
|
|
40250
|
+
* 7 - modify the profile in G --> become [2, 3, 4, 6]
|
|
40251
|
+
* - add a new profile in I --> become [8, 10]
|
|
40252
|
+
*
|
|
40253
|
+
* See below the result:
|
|
40254
|
+
*
|
|
40255
|
+
* Note the particularity of the profile
|
|
40256
|
+
* A B C D E F G H I J K for G: it will correspond to [2, 3, 4, 6]
|
|
40257
|
+
* 1 ' ' ' ' ' '
|
|
40258
|
+
* 2 ' ' ' '___'___' To know how to modify the profile (add a
|
|
40259
|
+
* 3 '_'_' |___|___| zone or remove it) we do a binary
|
|
40260
|
+
* 4 | | |___ ___ search of the top and bottom value on the
|
|
40261
|
+
* 5 |_| | | | profile array. Depending on the result index
|
|
40262
|
+
* 6 |_|___|___| parity (odd or even), because zone boundaries
|
|
40263
|
+
* 7 go by pairs, we know if we are in a zone or
|
|
40264
|
+
* not and how operate.
|
|
40265
|
+
*/
|
|
40266
|
+
/**
|
|
40267
|
+
* Recompute the zone without the cells in toRemoveZones and avoid overlapping.
|
|
40268
|
+
* This compute is particularly useful because after this function:
|
|
40269
|
+
* - you will find coordinate of a cell only once among all the zones
|
|
40270
|
+
* - the number of zones will be reduced to the minimum
|
|
40271
|
+
*/
|
|
40272
|
+
function futureRecomputeZones(zones, zonesToRemove = []) {
|
|
40273
|
+
const profilesStartingPosition = [0];
|
|
40274
|
+
const profiles = new Map([[0, []]]);
|
|
40275
|
+
modifyProfiles(profilesStartingPosition, profiles, zones, false);
|
|
40276
|
+
modifyProfiles(profilesStartingPosition, profiles, zonesToRemove, true);
|
|
40277
|
+
return constructZonesFromProfiles(profilesStartingPosition, profiles);
|
|
40278
|
+
}
|
|
40279
|
+
function modifyProfiles(// export for testing only
|
|
40280
|
+
profilesStartingPosition, profiles, zones, toRemove = false) {
|
|
40281
|
+
for (const zone of zones) {
|
|
40282
|
+
const leftValue = zone.left;
|
|
40283
|
+
const rightValue = zone.right === undefined ? undefined : zone.right + 1;
|
|
40284
|
+
const leftIndex = findIndexAndCreateProfile(profilesStartingPosition, profiles, leftValue, true, 0);
|
|
40285
|
+
const rightIndex = findIndexAndCreateProfile(profilesStartingPosition, profiles, rightValue, false, leftIndex);
|
|
40286
|
+
for (let i = leftIndex; i <= rightIndex; i++) {
|
|
40287
|
+
const profile = profiles.get(profilesStartingPosition[i]);
|
|
40288
|
+
modifyProfile(profile, zone, toRemove);
|
|
40289
|
+
}
|
|
40290
|
+
// maybe this part cost in performance, and maybe it's not necessary (depending on the use case). To be checked
|
|
40291
|
+
removeContiguousProfiles(profilesStartingPosition, profiles, leftIndex, rightIndex);
|
|
40292
|
+
}
|
|
40293
|
+
}
|
|
40294
|
+
function findIndexAndCreateProfile(profilesStartingPosition, profiles, value, searchLeft, startIndex) {
|
|
40295
|
+
if (value === undefined) {
|
|
40296
|
+
// this is only the case when the value correspond to a bottom value that could be undefined
|
|
40297
|
+
return profilesStartingPosition.length - 1;
|
|
40298
|
+
}
|
|
40299
|
+
const predecessorIndex = binaryPredecessorSearch(profilesStartingPosition, value, startIndex);
|
|
40300
|
+
if (value != profilesStartingPosition[predecessorIndex]) {
|
|
40301
|
+
// mean that the value is not ending/starting at the same position as the previous/next profile
|
|
40302
|
+
// --> it's a new profile
|
|
40303
|
+
// --> we need to add it
|
|
40304
|
+
profilesStartingPosition.splice(predecessorIndex + 1, 0, value);
|
|
40305
|
+
// suppose the we want to add the for the left value
|
|
40306
|
+
// following profile following zone: 'C', the predecessor index
|
|
40307
|
+
// for B: [1, 3] "C3:D4" correspond to 'B'.
|
|
40308
|
+
// The next line code will
|
|
40309
|
+
// A B C D A B C D copy the profile of 'B'
|
|
40310
|
+
// 1 '___' 1 '___' to 'C'. In the rest of the
|
|
40311
|
+
// 2 | | ---> 2 | _|_ process the 'modifyProfile'
|
|
40312
|
+
// 3 |___| 3 |_|_| | function will adapt the waiting
|
|
40313
|
+
// 4 4 |___| 'C' profile [1, 3] to the
|
|
40314
|
+
// correct 'C' profile [1, 4]
|
|
40315
|
+
profiles.set(value, [...profiles.get(profilesStartingPosition[predecessorIndex])]);
|
|
40316
|
+
return searchLeft ? predecessorIndex + 1 : predecessorIndex;
|
|
40317
|
+
}
|
|
40318
|
+
return searchLeft ? predecessorIndex : predecessorIndex - 1;
|
|
40319
|
+
}
|
|
40320
|
+
/**
|
|
40321
|
+
* Suppose the following Suppose we want to add We want to have the
|
|
40322
|
+
* profile: the following zone: following profile:
|
|
40323
|
+
*
|
|
40324
|
+
* A B C D E F A B C D E F A B C D E F
|
|
40325
|
+
* 1 '___' 1 ' ' 1 '___'
|
|
40326
|
+
* 2 |___| 2 '___' 2 | |
|
|
40327
|
+
* 3 ' ' 3 | | 3 | |
|
|
40328
|
+
* 4 '___' --> 4 | | --> 4 | |
|
|
40329
|
+
* 6 | | 6 |___| 6 | |
|
|
40330
|
+
* 7 |___| 7 7 |___|
|
|
40331
|
+
* 8 8 8
|
|
40332
|
+
*
|
|
40333
|
+
* the profile for 'C' the top zone correspond Here [2, 3, 5, 8] with [3, 7]
|
|
40334
|
+
* corresponds to: to 3 and the bottom zone would be merged into [2, 8]
|
|
40335
|
+
* ____ ____ correspond to 6
|
|
40336
|
+
* [2, 3, 5, 8] would be the profile: The difficulty of modify profile
|
|
40337
|
+
* ____ is to know what must be deleted
|
|
40338
|
+
* Note that the 'filled [3, 7] and what must be added to the
|
|
40339
|
+
* zone' are always between existing profile.
|
|
40340
|
+
* an even index and its
|
|
40341
|
+
* next index
|
|
40342
|
+
*
|
|
40343
|
+
*/
|
|
40344
|
+
function modifyProfile(profile, zone, toRemove = false) {
|
|
40345
|
+
const topValue = zone.top;
|
|
40346
|
+
const bottomValue = zone.bottom === undefined ? undefined : zone.bottom + 1;
|
|
40347
|
+
const newPoints = [];
|
|
40348
|
+
// Case we want to add a zone to the profile:
|
|
40349
|
+
// - If the top predecessor index `topPredIndex` is even, it means the top of the zone is already positioned on a filled zone
|
|
40350
|
+
// so we don't need to add it to the profile. we can keep in reference the index of the predecessor.
|
|
40351
|
+
// - If it is odd, it means the top of the zone must be the beginning of a filled zone.
|
|
40352
|
+
// so we can keep the index of the top position
|
|
40353
|
+
// Case we want to remove a zone from the profile: it's the opposite of the previous case
|
|
40354
|
+
const topPredIndex = binaryPredecessorSearch(profile, topValue, 0, false);
|
|
40355
|
+
if ((topPredIndex % 2 !== 0 && !toRemove) || (topPredIndex % 2 === 0 && toRemove)) {
|
|
40356
|
+
newPoints.push(topValue);
|
|
40357
|
+
}
|
|
40358
|
+
if (bottomValue === undefined) {
|
|
40359
|
+
// The following two code lines will not impact the final result,
|
|
40360
|
+
// but they will impact the intermediate profile.
|
|
40361
|
+
// We keep them for performance reason
|
|
40362
|
+
profile.splice(topPredIndex + 1);
|
|
40363
|
+
profile.push(...newPoints);
|
|
40364
|
+
return;
|
|
40365
|
+
}
|
|
40366
|
+
// Case we want to add a zone to the profile:
|
|
40367
|
+
// - If the bottom successor index `bottomSuccIndex` is even, it means the bottom of the zone must be the ending of a filled zone
|
|
40368
|
+
// so we can keep the index of the bottom position.
|
|
40369
|
+
// - If it is odd, it means the bottom of the zone is already positioned on a filled zone
|
|
40370
|
+
// so we don't need to add it to the profile. we can keep in reference the index of the successor
|
|
40371
|
+
// Case we want to remove a zone from the profile: it's the opposite of the previous case
|
|
40372
|
+
const bottomSuccIndex = binarySuccessorSearch(profile, bottomValue, 0, false);
|
|
40373
|
+
if ((bottomSuccIndex % 2 === 0 && !toRemove) || (bottomSuccIndex % 2 !== 0 && toRemove)) {
|
|
40374
|
+
newPoints.push(bottomValue);
|
|
40375
|
+
}
|
|
40376
|
+
// add the top and bottom value to the profile and
|
|
40377
|
+
// remove all information between the top and bottom index
|
|
40378
|
+
profile.splice(topPredIndex + 1, bottomSuccIndex - topPredIndex - 1, ...newPoints);
|
|
40379
|
+
}
|
|
40380
|
+
function removeContiguousProfiles(profilesStartingPosition, profiles, leftIndex, rightIndex) {
|
|
40381
|
+
const start = leftIndex - 1 === -1 ? 0 : leftIndex - 1;
|
|
40382
|
+
const end = rightIndex === profilesStartingPosition.length - 1 ? rightIndex : rightIndex + 1;
|
|
40383
|
+
for (let i = end; i > start; i--) {
|
|
40384
|
+
if (deepEqualsArray(profiles.get(profilesStartingPosition[i]), profiles.get(profilesStartingPosition[i - 1]))) {
|
|
40385
|
+
profiles.delete(profilesStartingPosition[i]);
|
|
40386
|
+
profilesStartingPosition.splice(i, 1);
|
|
40387
|
+
}
|
|
40388
|
+
}
|
|
40389
|
+
}
|
|
40390
|
+
function constructZonesFromProfiles(profilesStartingPosition, profiles) {
|
|
40391
|
+
const mergedZone = [];
|
|
40392
|
+
let pendingZones = [];
|
|
40393
|
+
for (let colIndex = 0; colIndex < profilesStartingPosition.length; colIndex++) {
|
|
40394
|
+
const left = profilesStartingPosition[colIndex];
|
|
40395
|
+
const profile = profiles.get(left);
|
|
40396
|
+
if (!profile || profile.length === 0) {
|
|
40397
|
+
mergedZone.push(...pendingZones);
|
|
40398
|
+
pendingZones = [];
|
|
40399
|
+
continue;
|
|
40400
|
+
}
|
|
40401
|
+
let right = profilesStartingPosition[colIndex + 1];
|
|
40402
|
+
if (right !== undefined) {
|
|
40403
|
+
right--;
|
|
40404
|
+
}
|
|
40405
|
+
const nextPendingZones = [];
|
|
40406
|
+
for (let i = 0; i < profile.length; i += 2) {
|
|
40407
|
+
const top = profile[i];
|
|
40408
|
+
let bottom = profile[i + 1];
|
|
40409
|
+
if (bottom !== undefined) {
|
|
40410
|
+
bottom--;
|
|
40411
|
+
}
|
|
40412
|
+
const profileZone = {
|
|
40413
|
+
top,
|
|
40414
|
+
left,
|
|
40415
|
+
bottom,
|
|
40416
|
+
right,
|
|
40417
|
+
hasHeader: (bottom === undefined && top !== 0) || (right === undefined && left !== 0),
|
|
40418
|
+
};
|
|
40419
|
+
let findCorrespondingZone = false;
|
|
40420
|
+
for (let j = pendingZones.length - 1; j >= 0; j--) {
|
|
40421
|
+
const pendingZone = pendingZones[j];
|
|
40422
|
+
if (pendingZone.top === profileZone.top && pendingZone.bottom === profileZone.bottom) {
|
|
40423
|
+
pendingZone.right = profileZone.right;
|
|
40424
|
+
pendingZones.splice(j, 1);
|
|
40425
|
+
nextPendingZones.push(pendingZone);
|
|
40426
|
+
findCorrespondingZone = true;
|
|
40427
|
+
break;
|
|
40428
|
+
}
|
|
40429
|
+
}
|
|
40430
|
+
if (!findCorrespondingZone) {
|
|
40431
|
+
nextPendingZones.push(profileZone);
|
|
40432
|
+
}
|
|
40433
|
+
}
|
|
40434
|
+
mergedZone.push(...pendingZones);
|
|
40435
|
+
pendingZones = nextPendingZones;
|
|
40436
|
+
}
|
|
40437
|
+
mergedZone.push(...pendingZones);
|
|
40438
|
+
return mergedZone;
|
|
40439
|
+
}
|
|
40440
|
+
function binaryPredecessorSearch(arr, val, start = 0, matchEqual = true) {
|
|
40441
|
+
let end = arr.length - 1;
|
|
40442
|
+
let result = -1;
|
|
40443
|
+
while (start <= end) {
|
|
40444
|
+
const mid = Math.floor((start + end) / 2);
|
|
40445
|
+
if (arr[mid] === val && matchEqual) {
|
|
40446
|
+
return mid;
|
|
40447
|
+
}
|
|
40448
|
+
else if (arr[mid] < val) {
|
|
40449
|
+
result = mid;
|
|
40450
|
+
start = mid + 1;
|
|
40451
|
+
}
|
|
40452
|
+
else {
|
|
40453
|
+
end = mid - 1;
|
|
40454
|
+
}
|
|
40455
|
+
}
|
|
40456
|
+
return result;
|
|
40457
|
+
}
|
|
40458
|
+
function binarySuccessorSearch(arr, val, start = 0, matchEqual = true) {
|
|
40459
|
+
let end = arr.length - 1;
|
|
40460
|
+
let result = arr.length;
|
|
40461
|
+
while (start <= end) {
|
|
40462
|
+
const mid = Math.floor((start + end) / 2);
|
|
40463
|
+
if (arr[mid] === val && matchEqual) {
|
|
40464
|
+
return mid;
|
|
40465
|
+
}
|
|
40466
|
+
else if (arr[mid] > val) {
|
|
40467
|
+
result = mid;
|
|
40468
|
+
end = mid - 1;
|
|
40469
|
+
}
|
|
40470
|
+
else {
|
|
40471
|
+
start = mid + 1;
|
|
40472
|
+
}
|
|
40473
|
+
}
|
|
40474
|
+
return result;
|
|
40475
|
+
}
|
|
40476
|
+
/**
|
|
40477
|
+
* Compares two arrays.
|
|
40478
|
+
* For performance reasons, this function is to be preferred
|
|
40479
|
+
* to 'deepEquals' in the case we know that the inputs are arrays.
|
|
40480
|
+
*/
|
|
40481
|
+
function deepEqualsArray(arr1, arr2) {
|
|
40482
|
+
if (arr1.length !== arr2.length) {
|
|
40483
|
+
return false;
|
|
40484
|
+
}
|
|
40485
|
+
for (let i = 0; i < arr1.length; i++) {
|
|
40486
|
+
if (!deepEquals(arr1[i], arr2[i])) {
|
|
40487
|
+
return false;
|
|
40488
|
+
}
|
|
40489
|
+
}
|
|
40490
|
+
return true;
|
|
40491
|
+
}
|
|
40492
|
+
|
|
40149
40493
|
function quickselect(arr, k, left, right, compare) {
|
|
40150
40494
|
quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare);
|
|
40151
40495
|
}
|
|
@@ -40909,7 +41253,7 @@ class FormulaDependencyGraph {
|
|
|
40909
41253
|
}
|
|
40910
41254
|
}
|
|
40911
41255
|
/**
|
|
40912
|
-
* Return the
|
|
41256
|
+
* Return all the cells that depend on the provided ranges,
|
|
40913
41257
|
* in the correct order they should be evaluated.
|
|
40914
41258
|
* This is called a topological ordering (excluding cycles)
|
|
40915
41259
|
*/
|
|
@@ -40920,11 +41264,20 @@ class FormulaDependencyGraph {
|
|
|
40920
41264
|
const range = queue.pop();
|
|
40921
41265
|
visited.addMany(this.encoder.encodeBoundingBox(range));
|
|
40922
41266
|
const impactedPositionIds = this.rTree.search(range).map((dep) => dep.data);
|
|
41267
|
+
const nextInQueue = {};
|
|
40923
41268
|
for (const positionId of impactedPositionIds) {
|
|
40924
41269
|
if (!visited.has(positionId)) {
|
|
40925
|
-
|
|
41270
|
+
const { sheetId, zone } = this.encoder.decodeToBoundingBox(positionId);
|
|
41271
|
+
if (!nextInQueue[sheetId]) {
|
|
41272
|
+
nextInQueue[sheetId] = [];
|
|
41273
|
+
}
|
|
41274
|
+
nextInQueue[sheetId].push(zone);
|
|
40926
41275
|
}
|
|
40927
41276
|
}
|
|
41277
|
+
for (const sheetId in nextInQueue) {
|
|
41278
|
+
const zones = futureRecomputeZones(nextInQueue[sheetId]);
|
|
41279
|
+
queue.push(...zones.map((zone) => ({ sheetId, zone })));
|
|
41280
|
+
}
|
|
40928
41281
|
}
|
|
40929
41282
|
visited.deleteMany(ranges.flatMap((r) => this.encoder.encodeBoundingBox(r)));
|
|
40930
41283
|
return visited;
|
|
@@ -41080,7 +41433,7 @@ class Evaluator {
|
|
|
41080
41433
|
}
|
|
41081
41434
|
if (!content) {
|
|
41082
41435
|
// The previous content could have blocked some array formulas
|
|
41083
|
-
impactedPositionIds.addMany(this.
|
|
41436
|
+
impactedPositionIds.addMany(this.getArrayFormulasBlockedBy(positionId));
|
|
41084
41437
|
}
|
|
41085
41438
|
}
|
|
41086
41439
|
return impactedPositionIds;
|
|
@@ -41125,13 +41478,22 @@ class Evaluator {
|
|
|
41125
41478
|
}
|
|
41126
41479
|
return positionIds;
|
|
41127
41480
|
}
|
|
41128
|
-
|
|
41481
|
+
/**
|
|
41482
|
+
* Return the position of formulas blocked by the given position
|
|
41483
|
+
* as well as all their dependencies.
|
|
41484
|
+
*/
|
|
41485
|
+
getArrayFormulasBlockedBy(positionId) {
|
|
41129
41486
|
if (!this.spreadingRelations.hasArrayFormulaResult(positionId)) {
|
|
41130
41487
|
return [];
|
|
41131
41488
|
}
|
|
41132
41489
|
const arrayFormulas = this.spreadingRelations.getFormulaPositionsSpreadingOn(positionId);
|
|
41133
41490
|
const cells = new JetSet(arrayFormulas);
|
|
41134
|
-
|
|
41491
|
+
const arrayFormulaPositionId = this.getArrayFormulaSpreadingOnId(positionId);
|
|
41492
|
+
if (arrayFormulaPositionId) {
|
|
41493
|
+
// ignore the formula spreading on the position. Keep only the blocked ones
|
|
41494
|
+
cells.delete(arrayFormulaPositionId);
|
|
41495
|
+
}
|
|
41496
|
+
cells.addMany(this.getCellsDependingOn(cells));
|
|
41135
41497
|
return cells;
|
|
41136
41498
|
}
|
|
41137
41499
|
nextPositionsToUpdate = new JetSet();
|
|
@@ -41296,7 +41658,7 @@ class Evaluator {
|
|
|
41296
41658
|
}
|
|
41297
41659
|
this.evaluatedCells.delete(child);
|
|
41298
41660
|
this.nextPositionsToUpdate.addMany(this.getCellsDependingOn([child]));
|
|
41299
|
-
this.nextPositionsToUpdate.addMany(this.
|
|
41661
|
+
this.nextPositionsToUpdate.addMany(this.getArrayFormulasBlockedBy(child));
|
|
41300
41662
|
}
|
|
41301
41663
|
this.spreadingRelations.removeNode(positionId);
|
|
41302
41664
|
}
|
|
@@ -56993,6 +57355,6 @@ const constants = {
|
|
|
56993
57355
|
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
56994
57356
|
|
|
56995
57357
|
|
|
56996
|
-
__info__.version = "17.0.
|
|
56997
|
-
__info__.date = "2024-04-
|
|
56998
|
-
__info__.hash = "
|
|
57358
|
+
__info__.version = "17.0.20";
|
|
57359
|
+
__info__.date = "2024-04-26T07:37:04.503Z";
|
|
57360
|
+
__info__.hash = "065ac98";
|