@odoo/o-spreadsheet 18.1.10 → 18.1.12
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 +207 -71
- package/dist/o-spreadsheet.d.ts +5 -1
- package/dist/o-spreadsheet.esm.js +207 -71
- package/dist/o-spreadsheet.iife.js +207 -71
- package/dist/o-spreadsheet.iife.min.js +402 -402
- package/dist/o_spreadsheet.xml +28 -15
- 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 18.1.
|
|
6
|
-
* @date 2025-03-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.12
|
|
6
|
+
* @date 2025-03-19T08:23:50.676Z
|
|
7
|
+
* @hash 32f788f
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -423,7 +423,6 @@
|
|
|
423
423
|
* Sparse arrays remain sparse.
|
|
424
424
|
*/
|
|
425
425
|
function deepCopy(obj) {
|
|
426
|
-
const result = Array.isArray(obj) ? [] : {};
|
|
427
426
|
switch (typeof obj) {
|
|
428
427
|
case "object": {
|
|
429
428
|
if (obj === null) {
|
|
@@ -435,8 +434,18 @@
|
|
|
435
434
|
else if (!(isPlainObject(obj) || obj instanceof Array)) {
|
|
436
435
|
throw new Error("Unsupported type: only objects and arrays are supported");
|
|
437
436
|
}
|
|
438
|
-
|
|
439
|
-
|
|
437
|
+
const result = Array.isArray(obj) ? new Array(obj.length) : {};
|
|
438
|
+
if (Array.isArray(obj)) {
|
|
439
|
+
for (let i = 0, len = obj.length; i < len; i++) {
|
|
440
|
+
if (i in obj) {
|
|
441
|
+
result[i] = deepCopy(obj[i]);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
for (const key in obj) {
|
|
447
|
+
result[key] = deepCopy(obj[key]);
|
|
448
|
+
}
|
|
440
449
|
}
|
|
441
450
|
return result;
|
|
442
451
|
}
|
|
@@ -2689,21 +2698,30 @@
|
|
|
2689
2698
|
return mergedZones;
|
|
2690
2699
|
}
|
|
2691
2700
|
|
|
2701
|
+
const globalReverseLookup$1 = new WeakMap();
|
|
2702
|
+
const globalIdCounter = new WeakMap();
|
|
2692
2703
|
/**
|
|
2693
2704
|
* Get the id of the given item (its key in the given dictionary).
|
|
2694
2705
|
* If the given item does not exist in the dictionary, it creates one with a new id.
|
|
2695
2706
|
*/
|
|
2696
2707
|
function getItemId(item, itemsDic) {
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2708
|
+
if (!globalReverseLookup$1.has(itemsDic)) {
|
|
2709
|
+
globalReverseLookup$1.set(itemsDic, new Map());
|
|
2710
|
+
globalIdCounter.set(itemsDic, 0);
|
|
2711
|
+
}
|
|
2712
|
+
const reverseLookup = globalReverseLookup$1.get(itemsDic);
|
|
2713
|
+
const canonical = getCanonicalRepresentation(item);
|
|
2714
|
+
if (reverseLookup.has(canonical)) {
|
|
2715
|
+
const id = reverseLookup.get(canonical);
|
|
2716
|
+
itemsDic[id] = item;
|
|
2717
|
+
return id;
|
|
2701
2718
|
}
|
|
2702
2719
|
// Generate new Id if the item didn't exist in the dictionary
|
|
2703
|
-
const
|
|
2704
|
-
|
|
2705
|
-
itemsDic
|
|
2706
|
-
|
|
2720
|
+
const newId = globalIdCounter.get(itemsDic) + 1;
|
|
2721
|
+
reverseLookup.set(canonical, newId);
|
|
2722
|
+
globalIdCounter.set(itemsDic, newId);
|
|
2723
|
+
itemsDic[newId] = item;
|
|
2724
|
+
return newId;
|
|
2707
2725
|
}
|
|
2708
2726
|
function groupItemIdsByZones(positionsByItemId) {
|
|
2709
2727
|
const result = {};
|
|
@@ -2727,6 +2745,33 @@
|
|
|
2727
2745
|
}
|
|
2728
2746
|
}
|
|
2729
2747
|
}
|
|
2748
|
+
function getCanonicalRepresentation(item) {
|
|
2749
|
+
if (item === null)
|
|
2750
|
+
return "null";
|
|
2751
|
+
if (item === undefined)
|
|
2752
|
+
return "undefined";
|
|
2753
|
+
if (typeof item !== "object")
|
|
2754
|
+
return String(item);
|
|
2755
|
+
if (Array.isArray(item)) {
|
|
2756
|
+
const len = item.length;
|
|
2757
|
+
let result = "[";
|
|
2758
|
+
for (let i = 0; i < len; i++) {
|
|
2759
|
+
if (i > 0)
|
|
2760
|
+
result += ",";
|
|
2761
|
+
result += getCanonicalRepresentation(item[i]);
|
|
2762
|
+
}
|
|
2763
|
+
return result + "]";
|
|
2764
|
+
}
|
|
2765
|
+
const keys = Object.keys(item).sort();
|
|
2766
|
+
let repr = "{";
|
|
2767
|
+
for (const key of keys) {
|
|
2768
|
+
if (item[key] !== undefined) {
|
|
2769
|
+
repr += `"${key}":${getCanonicalRepresentation(item[key])},`;
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
repr += "}";
|
|
2773
|
+
return repr;
|
|
2774
|
+
}
|
|
2730
2775
|
|
|
2731
2776
|
// -----------------------------------------------------------------------------
|
|
2732
2777
|
// Date Type
|
|
@@ -6232,11 +6277,13 @@
|
|
|
6232
6277
|
if (!cell || (!cell.isFormula && !cell.content)) {
|
|
6233
6278
|
return DEFAULT_CELL_HEIGHT;
|
|
6234
6279
|
}
|
|
6235
|
-
const
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
const
|
|
6280
|
+
const content = cell.isFormula ? "" : cell.content;
|
|
6281
|
+
return getCellContentHeight(ctx, content, cell.style, colSize);
|
|
6282
|
+
}
|
|
6283
|
+
function getCellContentHeight(ctx, content, style, colSize) {
|
|
6284
|
+
const maxWidth = style?.wrapping === "wrap" ? colSize - 2 * MIN_CELL_TEXT_MARGIN : undefined;
|
|
6285
|
+
const numberOfLines = splitTextToWidth(ctx, content, style, maxWidth).length;
|
|
6286
|
+
const fontSize = computeTextFontSizeInPixels(style);
|
|
6240
6287
|
return computeTextLinesHeight(fontSize, numberOfLines) + 2 * PADDING_AUTORESIZE_VERTICAL;
|
|
6241
6288
|
}
|
|
6242
6289
|
function getDefaultContextFont(fontSize, bold = false, italic = false) {
|
|
@@ -8280,7 +8327,8 @@
|
|
|
8280
8327
|
const possibleValues = pivot
|
|
8281
8328
|
.getPossibleFieldValues(columns[i])
|
|
8282
8329
|
.map((v) => v.value);
|
|
8283
|
-
if (!possibleValues.includes(sortedColumn.domain[i].value)
|
|
8330
|
+
if (!possibleValues.includes(sortedColumn.domain[i].value) &&
|
|
8331
|
+
!(sortedColumn.domain[i].value === null && possibleValues.includes(""))) {
|
|
8284
8332
|
return false;
|
|
8285
8333
|
}
|
|
8286
8334
|
}
|
|
@@ -8431,13 +8479,6 @@
|
|
|
8431
8479
|
this.clearClippedZones(content);
|
|
8432
8480
|
const selection = target[0];
|
|
8433
8481
|
this.pasteZone(sheetId, selection.left, selection.top, content.cells, options);
|
|
8434
|
-
this.dispatch("MOVE_RANGES", {
|
|
8435
|
-
target: content.zones,
|
|
8436
|
-
sheetId: content.sheetId,
|
|
8437
|
-
targetSheetId: sheetId,
|
|
8438
|
-
col: selection.left,
|
|
8439
|
-
row: selection.top,
|
|
8440
|
-
});
|
|
8441
8482
|
}
|
|
8442
8483
|
/**
|
|
8443
8484
|
* Clear the clipped zones: remove the cells and clear the formatting
|
|
@@ -8946,14 +8987,15 @@
|
|
|
8946
8987
|
}
|
|
8947
8988
|
merges.push(mergesInRow);
|
|
8948
8989
|
}
|
|
8949
|
-
return { merges };
|
|
8990
|
+
return { merges, sheetId };
|
|
8950
8991
|
}
|
|
8951
8992
|
/**
|
|
8952
8993
|
* Paste the clipboard content in the given target
|
|
8953
8994
|
*/
|
|
8954
8995
|
paste(target, content, options) {
|
|
8955
8996
|
if (options.isCutOperation) {
|
|
8956
|
-
|
|
8997
|
+
const copiedMerges = content.merges.flat().filter(isDefined);
|
|
8998
|
+
this.dispatch("REMOVE_MERGE", { sheetId: content.sheetId, target: copiedMerges });
|
|
8957
8999
|
}
|
|
8958
9000
|
this.pasteFromCopy(target.sheetId, target.zones, content.merges, options);
|
|
8959
9001
|
}
|
|
@@ -8988,6 +9030,27 @@
|
|
|
8988
9030
|
}
|
|
8989
9031
|
}
|
|
8990
9032
|
|
|
9033
|
+
class ReferenceClipboardHandler extends AbstractCellClipboardHandler {
|
|
9034
|
+
copy(data) {
|
|
9035
|
+
return {
|
|
9036
|
+
zones: data.clippedZones,
|
|
9037
|
+
sheetId: data.sheetId,
|
|
9038
|
+
};
|
|
9039
|
+
}
|
|
9040
|
+
paste(target, content, options) {
|
|
9041
|
+
if (options.isCutOperation) {
|
|
9042
|
+
const selection = target.zones[0];
|
|
9043
|
+
this.dispatch("MOVE_RANGES", {
|
|
9044
|
+
target: content.zones,
|
|
9045
|
+
sheetId: content.sheetId,
|
|
9046
|
+
targetSheetId: target.sheetId,
|
|
9047
|
+
col: selection.left,
|
|
9048
|
+
row: selection.top,
|
|
9049
|
+
});
|
|
9050
|
+
}
|
|
9051
|
+
}
|
|
9052
|
+
}
|
|
9053
|
+
|
|
8991
9054
|
class SheetClipboardHandler extends AbstractCellClipboardHandler {
|
|
8992
9055
|
isPasteAllowed(sheetId, target, content, options) {
|
|
8993
9056
|
if (!("cells" in content)) {
|
|
@@ -9151,7 +9214,8 @@
|
|
|
9151
9214
|
.add("merge", MergeClipboardHandler)
|
|
9152
9215
|
.add("border", BorderClipboardHandler)
|
|
9153
9216
|
.add("table", TableClipboardHandler)
|
|
9154
|
-
.add("conditionalFormat", ConditionalFormatClipboardHandler)
|
|
9217
|
+
.add("conditionalFormat", ConditionalFormatClipboardHandler)
|
|
9218
|
+
.add("references", ReferenceClipboardHandler);
|
|
9155
9219
|
|
|
9156
9220
|
function transformZone(zone, executed) {
|
|
9157
9221
|
if (executed.type === "REMOVE_COLUMNS_ROWS") {
|
|
@@ -11155,6 +11219,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
11155
11219
|
const autoCompleteProviders = new Registry();
|
|
11156
11220
|
|
|
11157
11221
|
autoCompleteProviders.add("dataValidation", {
|
|
11222
|
+
displayAllOnInitialContent: true,
|
|
11158
11223
|
getProposals(tokenAtCursor, content) {
|
|
11159
11224
|
if (content.startsWith("=")) {
|
|
11160
11225
|
return [];
|
|
@@ -20947,8 +21012,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20947
21012
|
this.computeParenthesisRelatedToCursor();
|
|
20948
21013
|
}
|
|
20949
21014
|
cancelEdition() {
|
|
20950
|
-
this.cancelEditionAndActivateSheet();
|
|
20951
21015
|
this.resetContent();
|
|
21016
|
+
this.cancelEditionAndActivateSheet();
|
|
20952
21017
|
}
|
|
20953
21018
|
setCurrentContent(content, selection) {
|
|
20954
21019
|
if (selection && !this.isSelectionValid(content.length, selection.start, selection.end)) {
|
|
@@ -20966,8 +21031,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20966
21031
|
switch (cmd.type) {
|
|
20967
21032
|
case "SELECT_FIGURE":
|
|
20968
21033
|
if (cmd.id) {
|
|
20969
|
-
this.cancelEditionAndActivateSheet();
|
|
20970
21034
|
this.resetContent();
|
|
21035
|
+
this.cancelEditionAndActivateSheet();
|
|
20971
21036
|
}
|
|
20972
21037
|
break;
|
|
20973
21038
|
case "START_CHANGE_HIGHLIGHT":
|
|
@@ -21451,6 +21516,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
21451
21516
|
const exactMatch = proposals?.find((p) => p.text === tokenAtCursor.value);
|
|
21452
21517
|
// remove tokens that are likely to be other parts of the formula that slipped in the token if it's a string
|
|
21453
21518
|
const searchTerm = tokenAtCursor.value.replace(/[ ,\(\)]/g, "");
|
|
21519
|
+
if (this._currentContent === this.initialContent &&
|
|
21520
|
+
provider.displayAllOnInitialContent &&
|
|
21521
|
+
proposals?.length) {
|
|
21522
|
+
return {
|
|
21523
|
+
proposals,
|
|
21524
|
+
selectProposal: provider.selectProposal,
|
|
21525
|
+
autoSelectFirstProposal: provider.autoSelectFirstProposal ?? false,
|
|
21526
|
+
};
|
|
21527
|
+
}
|
|
21454
21528
|
if (exactMatch && this._currentContent !== this.initialContent) {
|
|
21455
21529
|
// this means the user has chosen a proposal
|
|
21456
21530
|
return;
|
|
@@ -22274,7 +22348,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
22274
22348
|
text,
|
|
22275
22349
|
description: usedLabel,
|
|
22276
22350
|
htmlContent: [{ value: text, color }],
|
|
22277
|
-
fuzzySearchKey:
|
|
22351
|
+
fuzzySearchKey: text + usedLabel,
|
|
22278
22352
|
};
|
|
22279
22353
|
});
|
|
22280
22354
|
},
|
|
@@ -24336,16 +24410,25 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
24336
24410
|
}
|
|
24337
24411
|
return id;
|
|
24338
24412
|
}
|
|
24413
|
+
const globalReverseLookup = new WeakMap();
|
|
24339
24414
|
function pushElement(property, propertyList) {
|
|
24340
|
-
let
|
|
24341
|
-
|
|
24342
|
-
|
|
24343
|
-
|
|
24344
|
-
|
|
24415
|
+
let reverseLookup = globalReverseLookup.get(propertyList);
|
|
24416
|
+
if (!reverseLookup) {
|
|
24417
|
+
reverseLookup = new Map();
|
|
24418
|
+
for (let i = 0; i < propertyList.length; i++) {
|
|
24419
|
+
const canonical = getCanonicalRepresentation(propertyList[i]);
|
|
24420
|
+
reverseLookup.set(canonical, i);
|
|
24345
24421
|
}
|
|
24422
|
+
globalReverseLookup.set(propertyList, reverseLookup);
|
|
24423
|
+
}
|
|
24424
|
+
const canonical = getCanonicalRepresentation(property);
|
|
24425
|
+
if (reverseLookup.has(canonical)) {
|
|
24426
|
+
return reverseLookup.get(canonical);
|
|
24346
24427
|
}
|
|
24347
|
-
propertyList
|
|
24348
|
-
|
|
24428
|
+
const maxId = propertyList.length;
|
|
24429
|
+
propertyList.push(property);
|
|
24430
|
+
reverseLookup.set(canonical, maxId);
|
|
24431
|
+
return maxId;
|
|
24349
24432
|
}
|
|
24350
24433
|
const chartIds = [];
|
|
24351
24434
|
/**
|
|
@@ -26192,7 +26275,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26192
26275
|
title: { text: chartTitle },
|
|
26193
26276
|
type: CHART_TYPE_CONVERSION_MAP[chartType],
|
|
26194
26277
|
dataSets: this.extractChartDatasets(this.querySelectorAll(rootChartElement, `c:${chartType}`), chartType),
|
|
26195
|
-
labelRange: this.
|
|
26278
|
+
labelRange: this.extractLabelRange(chartType, rootChartElement),
|
|
26196
26279
|
backgroundColor: this.extractChildAttr(rootChartElement, "c:chartSpace > c:spPr a:srgbClr", "val", {
|
|
26197
26280
|
default: "ffffff",
|
|
26198
26281
|
}).asString(),
|
|
@@ -26204,6 +26287,13 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26204
26287
|
};
|
|
26205
26288
|
})[0];
|
|
26206
26289
|
}
|
|
26290
|
+
extractLabelRange(chartType, rootChartElement) {
|
|
26291
|
+
if (chartType === "scatterChart") {
|
|
26292
|
+
return (this.extractChildTextContent(rootChartElement, `c:ser c:strRef c:f`) ||
|
|
26293
|
+
this.extractChildTextContent(rootChartElement, `c:ser c:numRef c:f`));
|
|
26294
|
+
}
|
|
26295
|
+
return this.extractChildTextContent(rootChartElement, `c:ser c:cat c:f`);
|
|
26296
|
+
}
|
|
26207
26297
|
extractComboChart(chartElement) {
|
|
26208
26298
|
// Title can be separated into multiple xml elements (for styling and such), we only import the text
|
|
26209
26299
|
const chartTitle = this.mapOnElements({ parent: chartElement, query: "c:title a:t" }, (textElement) => {
|
|
@@ -36205,6 +36295,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
36205
36295
|
fingerprintStore.enable();
|
|
36206
36296
|
}
|
|
36207
36297
|
},
|
|
36298
|
+
isReadonlyAllowed: true,
|
|
36208
36299
|
icon: "o-spreadsheet-Icon.IRREGULARITY_MAP",
|
|
36209
36300
|
};
|
|
36210
36301
|
const viewFormulas = {
|
|
@@ -46764,6 +46855,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46764
46855
|
columns: {},
|
|
46765
46856
|
});
|
|
46766
46857
|
setup() {
|
|
46858
|
+
this.updateColumns();
|
|
46767
46859
|
owl.onWillUpdateProps(() => this.updateColumns());
|
|
46768
46860
|
}
|
|
46769
46861
|
toggleHasHeader() {
|
|
@@ -48551,8 +48643,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
48551
48643
|
const sheetIdExists = !!this.getters.tryGetSheet(this.sheetId);
|
|
48552
48644
|
if (!sheetIdExists && this.editionMode !== "inactive") {
|
|
48553
48645
|
this.sheetId = this.getters.getActiveSheetId();
|
|
48554
|
-
this.cancelEditionAndActivateSheet();
|
|
48555
48646
|
this.resetContent();
|
|
48647
|
+
this.cancelEditionAndActivateSheet();
|
|
48556
48648
|
this.notificationStore.raiseError(CELL_DELETED_MESSAGE);
|
|
48557
48649
|
}
|
|
48558
48650
|
break;
|
|
@@ -50410,6 +50502,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50410
50502
|
this.MAX_SIZE_MARGIN = 90;
|
|
50411
50503
|
this.MIN_ELEMENT_SIZE = MIN_COL_WIDTH;
|
|
50412
50504
|
}
|
|
50505
|
+
get sheetId() {
|
|
50506
|
+
return this.env.model.getters.getActiveSheetId();
|
|
50507
|
+
}
|
|
50413
50508
|
_getEvOffset(ev) {
|
|
50414
50509
|
return ev.offsetX;
|
|
50415
50510
|
}
|
|
@@ -50432,10 +50527,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50432
50527
|
return this.env.model.getters.getEdgeScrollCol(position, position, position);
|
|
50433
50528
|
}
|
|
50434
50529
|
_getDimensionsInViewport(index) {
|
|
50435
|
-
return this.env.model.getters.getColDimensionsInViewport(this.
|
|
50530
|
+
return this.env.model.getters.getColDimensionsInViewport(this.sheetId, index);
|
|
50436
50531
|
}
|
|
50437
50532
|
_getElementSize(index) {
|
|
50438
|
-
return this.env.model.getters.getColSize(this.
|
|
50533
|
+
return this.env.model.getters.getColSize(this.sheetId, index);
|
|
50439
50534
|
}
|
|
50440
50535
|
_getMaxSize() {
|
|
50441
50536
|
return this.colResizerRef.el.clientWidth;
|
|
@@ -50446,7 +50541,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50446
50541
|
const cols = this.env.model.getters.getActiveCols();
|
|
50447
50542
|
this.env.model.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
50448
50543
|
dimension: "COL",
|
|
50449
|
-
sheetId: this.
|
|
50544
|
+
sheetId: this.sheetId,
|
|
50450
50545
|
elements: cols.has(index) ? [...cols] : [index],
|
|
50451
50546
|
size,
|
|
50452
50547
|
});
|
|
@@ -50459,7 +50554,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50459
50554
|
elements.push(colIndex);
|
|
50460
50555
|
}
|
|
50461
50556
|
const result = this.env.model.dispatch("MOVE_COLUMNS_ROWS", {
|
|
50462
|
-
sheetId: this.
|
|
50557
|
+
sheetId: this.sheetId,
|
|
50463
50558
|
dimension: "COL",
|
|
50464
50559
|
base: this.state.base,
|
|
50465
50560
|
elements,
|
|
@@ -50478,7 +50573,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50478
50573
|
_fitElementSize(index) {
|
|
50479
50574
|
const cols = this.env.model.getters.getActiveCols();
|
|
50480
50575
|
this.env.model.dispatch("AUTORESIZE_COLUMNS", {
|
|
50481
|
-
sheetId: this.
|
|
50576
|
+
sheetId: this.sheetId,
|
|
50482
50577
|
cols: cols.has(index) ? [...cols] : [index],
|
|
50483
50578
|
});
|
|
50484
50579
|
}
|
|
@@ -50489,7 +50584,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50489
50584
|
return this.env.model.getters.getActiveCols();
|
|
50490
50585
|
}
|
|
50491
50586
|
_getPreviousVisibleElement(index) {
|
|
50492
|
-
const sheetId = this.
|
|
50587
|
+
const sheetId = this.sheetId;
|
|
50493
50588
|
let row;
|
|
50494
50589
|
for (row = index - 1; row >= 0; row--) {
|
|
50495
50590
|
if (!this.env.model.getters.isColHidden(sheetId, row)) {
|
|
@@ -50500,7 +50595,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50500
50595
|
}
|
|
50501
50596
|
unhide(hiddenElements) {
|
|
50502
50597
|
this.env.model.dispatch("UNHIDE_COLUMNS_ROWS", {
|
|
50503
|
-
sheetId: this.
|
|
50598
|
+
sheetId: this.sheetId,
|
|
50504
50599
|
elements: hiddenElements,
|
|
50505
50600
|
dimension: "COL",
|
|
50506
50601
|
});
|
|
@@ -50516,7 +50611,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50516
50611
|
left: 0;
|
|
50517
50612
|
right: 0;
|
|
50518
50613
|
width: ${HEADER_WIDTH}px;
|
|
50519
|
-
height: 100
|
|
50614
|
+
height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
|
|
50520
50615
|
&.o-dragging {
|
|
50521
50616
|
cursor: grabbing;
|
|
50522
50617
|
}
|
|
@@ -50574,6 +50669,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50574
50669
|
this.MIN_ELEMENT_SIZE = MIN_ROW_HEIGHT;
|
|
50575
50670
|
}
|
|
50576
50671
|
rowResizerRef;
|
|
50672
|
+
get sheetId() {
|
|
50673
|
+
return this.env.model.getters.getActiveSheetId();
|
|
50674
|
+
}
|
|
50577
50675
|
_getEvOffset(ev) {
|
|
50578
50676
|
return ev.offsetY;
|
|
50579
50677
|
}
|
|
@@ -50596,10 +50694,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50596
50694
|
return this.env.model.getters.getEdgeScrollRow(position, position, position);
|
|
50597
50695
|
}
|
|
50598
50696
|
_getDimensionsInViewport(index) {
|
|
50599
|
-
return this.env.model.getters.getRowDimensionsInViewport(this.
|
|
50697
|
+
return this.env.model.getters.getRowDimensionsInViewport(this.sheetId, index);
|
|
50600
50698
|
}
|
|
50601
50699
|
_getElementSize(index) {
|
|
50602
|
-
return this.env.model.getters.getRowSize(this.
|
|
50700
|
+
return this.env.model.getters.getRowSize(this.sheetId, index);
|
|
50603
50701
|
}
|
|
50604
50702
|
_getMaxSize() {
|
|
50605
50703
|
return this.rowResizerRef.el.clientHeight;
|
|
@@ -50610,7 +50708,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50610
50708
|
const rows = this.env.model.getters.getActiveRows();
|
|
50611
50709
|
this.env.model.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
50612
50710
|
dimension: "ROW",
|
|
50613
|
-
sheetId: this.
|
|
50711
|
+
sheetId: this.sheetId,
|
|
50614
50712
|
elements: rows.has(index) ? [...rows] : [index],
|
|
50615
50713
|
size,
|
|
50616
50714
|
});
|
|
@@ -50623,7 +50721,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50623
50721
|
elements.push(rowIndex);
|
|
50624
50722
|
}
|
|
50625
50723
|
const result = this.env.model.dispatch("MOVE_COLUMNS_ROWS", {
|
|
50626
|
-
sheetId: this.
|
|
50724
|
+
sheetId: this.sheetId,
|
|
50627
50725
|
dimension: "ROW",
|
|
50628
50726
|
base: this.state.base,
|
|
50629
50727
|
elements,
|
|
@@ -50642,7 +50740,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50642
50740
|
_fitElementSize(index) {
|
|
50643
50741
|
const rows = this.env.model.getters.getActiveRows();
|
|
50644
50742
|
this.env.model.dispatch("AUTORESIZE_ROWS", {
|
|
50645
|
-
sheetId: this.
|
|
50743
|
+
sheetId: this.sheetId,
|
|
50646
50744
|
rows: rows.has(index) ? [...rows] : [index],
|
|
50647
50745
|
});
|
|
50648
50746
|
}
|
|
@@ -50653,7 +50751,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50653
50751
|
return this.env.model.getters.getActiveRows();
|
|
50654
50752
|
}
|
|
50655
50753
|
_getPreviousVisibleElement(index) {
|
|
50656
|
-
const sheetId = this.
|
|
50754
|
+
const sheetId = this.sheetId;
|
|
50657
50755
|
let row;
|
|
50658
50756
|
for (row = index - 1; row >= 0; row--) {
|
|
50659
50757
|
if (!this.env.model.getters.isRowHidden(sheetId, row)) {
|
|
@@ -50664,7 +50762,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50664
50762
|
}
|
|
50665
50763
|
unhide(hiddenElements) {
|
|
50666
50764
|
this.env.model.dispatch("UNHIDE_COLUMNS_ROWS", {
|
|
50667
|
-
sheetId: this.
|
|
50765
|
+
sheetId: this.sheetId,
|
|
50668
50766
|
dimension: "ROW",
|
|
50669
50767
|
elements: hiddenElements,
|
|
50670
50768
|
});
|
|
@@ -64833,12 +64931,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
64833
64931
|
}
|
|
64834
64932
|
break;
|
|
64835
64933
|
case "AUTORESIZE_ROWS":
|
|
64836
|
-
this.
|
|
64837
|
-
elements: cmd.rows,
|
|
64838
|
-
dimension: "ROW",
|
|
64839
|
-
size: null,
|
|
64840
|
-
sheetId: cmd.sheetId,
|
|
64841
|
-
});
|
|
64934
|
+
this.autoResizeRows(cmd.sheetId, cmd.rows);
|
|
64842
64935
|
break;
|
|
64843
64936
|
}
|
|
64844
64937
|
}
|
|
@@ -65002,6 +65095,48 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
65002
65095
|
}
|
|
65003
65096
|
return "Success" /* CommandResult.Success */;
|
|
65004
65097
|
}
|
|
65098
|
+
autoResizeRows(sheetId, rows) {
|
|
65099
|
+
const rowSizes = [];
|
|
65100
|
+
for (const row of rows) {
|
|
65101
|
+
let evaluatedRowSize = 0;
|
|
65102
|
+
for (const cellId of this.getters.getRowCells(sheetId, row)) {
|
|
65103
|
+
const cell = this.getters.getCellById(cellId);
|
|
65104
|
+
if (!cell) {
|
|
65105
|
+
continue;
|
|
65106
|
+
}
|
|
65107
|
+
const position = this.getters.getCellPosition(cell.id);
|
|
65108
|
+
const colSize = this.getters.getColSize(sheetId, position.col);
|
|
65109
|
+
if (cell.isFormula) {
|
|
65110
|
+
const content = this.getters.getEvaluatedCell(position).formattedValue;
|
|
65111
|
+
const evaluatedSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
|
|
65112
|
+
if (evaluatedSize > evaluatedRowSize && evaluatedSize > DEFAULT_CELL_HEIGHT) {
|
|
65113
|
+
evaluatedRowSize = evaluatedSize;
|
|
65114
|
+
}
|
|
65115
|
+
}
|
|
65116
|
+
else {
|
|
65117
|
+
const content = cell.content;
|
|
65118
|
+
const dynamicRowSize = getCellContentHeight(this.ctx, content, cell?.style, colSize);
|
|
65119
|
+
// Only keep the size of evaluated cells if it's bigger than the dynamic row size
|
|
65120
|
+
if (dynamicRowSize >= evaluatedRowSize && dynamicRowSize > DEFAULT_CELL_HEIGHT) {
|
|
65121
|
+
evaluatedRowSize = 0;
|
|
65122
|
+
}
|
|
65123
|
+
}
|
|
65124
|
+
}
|
|
65125
|
+
rowSizes.push(evaluatedRowSize || null);
|
|
65126
|
+
}
|
|
65127
|
+
const groupedSizes = new Map(rowSizes.map((size) => [size, []]));
|
|
65128
|
+
for (let i = 0; i < rowSizes.length; i++) {
|
|
65129
|
+
groupedSizes.get(rowSizes[i])?.push(rows[i]);
|
|
65130
|
+
}
|
|
65131
|
+
for (const [size, rows] of groupedSizes) {
|
|
65132
|
+
this.dispatch("RESIZE_COLUMNS_ROWS", {
|
|
65133
|
+
elements: rows,
|
|
65134
|
+
dimension: "ROW",
|
|
65135
|
+
size,
|
|
65136
|
+
sheetId,
|
|
65137
|
+
});
|
|
65138
|
+
}
|
|
65139
|
+
}
|
|
65005
65140
|
}
|
|
65006
65141
|
|
|
65007
65142
|
class TableComputedStylePlugin extends UIPlugin {
|
|
@@ -67903,7 +68038,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67903
68038
|
? this.getters.getSheetViewVisibleCols()
|
|
67904
68039
|
: this.getters.getSheetViewVisibleRows();
|
|
67905
68040
|
const startIndex = visibleHeaders.findIndex((header) => referenceHeaderIndex >= header);
|
|
67906
|
-
|
|
68041
|
+
let endIndex = visibleHeaders.findIndex((header) => targetHeaderIndex <= header);
|
|
68042
|
+
endIndex = endIndex === -1 ? visibleHeaders.length : endIndex;
|
|
67907
68043
|
const relevantIndexes = visibleHeaders.slice(startIndex, endIndex);
|
|
67908
68044
|
let offset = 0;
|
|
67909
68045
|
for (const i of relevantIndexes) {
|
|
@@ -74010,7 +74146,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74010
74146
|
}
|
|
74011
74147
|
if (alignAttrs.length > 0) {
|
|
74012
74148
|
attributes.push(["applyAlignment", "1"]); // for Libre Office
|
|
74013
|
-
styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}
|
|
74149
|
+
styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)}><alignment ${formatAttributes(alignAttrs)} /></xf> `);
|
|
74014
74150
|
}
|
|
74015
74151
|
else {
|
|
74016
74152
|
styleNodes.push(escapeXml /*xml*/ `<xf ${formatAttributes(attributes)} />`);
|
|
@@ -74178,6 +74314,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74178
74314
|
}
|
|
74179
74315
|
function addRows(construct, data, sheet) {
|
|
74180
74316
|
const rowNodes = [];
|
|
74317
|
+
const styles = new PositionMap(iterateItemIdsPositions(sheet.id, sheet.styles));
|
|
74318
|
+
const borders = new PositionMap(iterateItemIdsPositions(sheet.id, sheet.borders));
|
|
74319
|
+
const formats = new PositionMap(iterateItemIdsPositions(sheet.id, sheet.formats));
|
|
74181
74320
|
for (let r = 0; r < sheet.rowNumber; r++) {
|
|
74182
74321
|
const rowAttrs = [["r", r + 1]];
|
|
74183
74322
|
const row = sheet.rows[r] || {};
|
|
@@ -74193,9 +74332,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
74193
74332
|
if (row.collapsed) {
|
|
74194
74333
|
rowAttrs.push(["collapsed", 1]);
|
|
74195
74334
|
}
|
|
74196
|
-
const styles = new PositionMap(iterateItemIdsPositions(sheet.id, sheet.styles));
|
|
74197
|
-
const borders = new PositionMap(iterateItemIdsPositions(sheet.id, sheet.borders));
|
|
74198
|
-
const formats = new PositionMap(iterateItemIdsPositions(sheet.id, sheet.formats));
|
|
74199
74335
|
const cellNodes = [];
|
|
74200
74336
|
for (let c = 0; c < sheet.colNumber; c++) {
|
|
74201
74337
|
const xc = toXC(c, r);
|
|
@@ -75467,9 +75603,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
75467
75603
|
exports.tokenize = tokenize;
|
|
75468
75604
|
|
|
75469
75605
|
|
|
75470
|
-
__info__.version = "18.1.
|
|
75471
|
-
__info__.date = "2025-03-
|
|
75472
|
-
__info__.hash = "
|
|
75606
|
+
__info__.version = "18.1.12";
|
|
75607
|
+
__info__.date = "2025-03-19T08:23:50.676Z";
|
|
75608
|
+
__info__.hash = "32f788f";
|
|
75473
75609
|
|
|
75474
75610
|
|
|
75475
75611
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|