@odoo/o-spreadsheet 17.0.43 → 17.0.45
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 +113 -47
- package/dist/o-spreadsheet.d.ts +15 -0
- package/dist/o-spreadsheet.esm.js +113 -47
- package/dist/o-spreadsheet.iife.js +113 -47
- package/dist/o-spreadsheet.iife.min.js +258 -259
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +2 -2
|
@@ -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
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.45
|
|
6
|
+
* @date 2025-01-14T11:30:44.730Z
|
|
7
|
+
* @hash 94f8ef9
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -705,6 +705,7 @@
|
|
|
705
705
|
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
|
|
706
706
|
*/
|
|
707
707
|
const whiteSpaceSpecialCharacters = [
|
|
708
|
+
" ",
|
|
708
709
|
"\t",
|
|
709
710
|
"\f",
|
|
710
711
|
"\v",
|
|
@@ -719,17 +720,15 @@
|
|
|
719
720
|
String.fromCharCode(parseInt("3000", 16)),
|
|
720
721
|
String.fromCharCode(parseInt("feff", 16)),
|
|
721
722
|
];
|
|
722
|
-
const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|")
|
|
723
|
+
const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|"), "g");
|
|
724
|
+
const newLineRegexp = /(\r\n|\r)/g;
|
|
723
725
|
/**
|
|
724
|
-
* Replace all
|
|
725
|
-
* different newlines types by \n.
|
|
726
|
+
* Replace all different newlines characters by \n
|
|
726
727
|
*/
|
|
727
|
-
function
|
|
728
|
+
function replaceNewLines(text) {
|
|
728
729
|
if (!text)
|
|
729
730
|
return "";
|
|
730
|
-
|
|
731
|
-
return text;
|
|
732
|
-
return text.replace(whiteSpaceRegexp, (match, newLine) => (newLine ? NEWLINE : " "));
|
|
731
|
+
return text.replace(newLineRegexp, NEWLINE);
|
|
733
732
|
}
|
|
734
733
|
/**
|
|
735
734
|
* Determine if the numbers are consecutive.
|
|
@@ -7472,7 +7471,7 @@
|
|
|
7472
7471
|
const POSTFIX_UNARY_OPERATORS = ["%"];
|
|
7473
7472
|
const OPERATORS = "+,-,*,/,:,=,<>,>=,>,<=,<,^,&".split(",").concat(POSTFIX_UNARY_OPERATORS);
|
|
7474
7473
|
function tokenize(str, locale = DEFAULT_LOCALE) {
|
|
7475
|
-
str =
|
|
7474
|
+
str = replaceNewLines(str);
|
|
7476
7475
|
const chars = new TokenizingChars(str);
|
|
7477
7476
|
const result = [];
|
|
7478
7477
|
while (!chars.isOver()) {
|
|
@@ -7619,12 +7618,12 @@
|
|
|
7619
7618
|
if (length) {
|
|
7620
7619
|
return { type: "SPACE", value: NEWLINE.repeat(length) };
|
|
7621
7620
|
}
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
chars.shift();
|
|
7621
|
+
let spaces = "";
|
|
7622
|
+
while (chars.current && chars.current.match(whiteSpaceRegexp)) {
|
|
7623
|
+
spaces += chars.shift();
|
|
7625
7624
|
}
|
|
7626
|
-
if (
|
|
7627
|
-
return { type: "SPACE", value:
|
|
7625
|
+
if (spaces) {
|
|
7626
|
+
return { type: "SPACE", value: spaces };
|
|
7628
7627
|
}
|
|
7629
7628
|
return null;
|
|
7630
7629
|
}
|
|
@@ -21819,15 +21818,23 @@
|
|
|
21819
21818
|
}
|
|
21820
21819
|
}
|
|
21821
21820
|
|
|
21821
|
+
/**
|
|
21822
|
+
* Start listening to pointer events and apply the given callbacks.
|
|
21823
|
+
*
|
|
21824
|
+
* @returns A function to remove the listeners.
|
|
21825
|
+
*/
|
|
21822
21826
|
function startDnd(onMouseMove, onMouseUp, onMouseDown = () => { }) {
|
|
21823
|
-
const
|
|
21824
|
-
onMouseUp(ev);
|
|
21827
|
+
const removeListeners = () => {
|
|
21825
21828
|
window.removeEventListener("mousedown", onMouseDown);
|
|
21826
21829
|
window.removeEventListener("mouseup", _onMouseUp);
|
|
21827
21830
|
window.removeEventListener("dragstart", _onDragStart);
|
|
21828
21831
|
window.removeEventListener("mousemove", onMouseMove);
|
|
21829
21832
|
window.removeEventListener("wheel", onMouseMove);
|
|
21830
21833
|
};
|
|
21834
|
+
const _onMouseUp = (ev) => {
|
|
21835
|
+
onMouseUp(ev);
|
|
21836
|
+
removeListeners();
|
|
21837
|
+
};
|
|
21831
21838
|
function _onDragStart(ev) {
|
|
21832
21839
|
ev.preventDefault();
|
|
21833
21840
|
}
|
|
@@ -21839,6 +21846,7 @@
|
|
|
21839
21846
|
// preventDefault() is not allowed in passive event handler.
|
|
21840
21847
|
// https://chromestatus.com/feature/6662647093133312
|
|
21841
21848
|
window.addEventListener("wheel", onMouseMove, { passive: false });
|
|
21849
|
+
return removeListeners;
|
|
21842
21850
|
}
|
|
21843
21851
|
/**
|
|
21844
21852
|
* Function to be used during a mousedown event, this function allows to
|
|
@@ -28012,6 +28020,7 @@
|
|
|
28012
28020
|
draggedFigure: undefined,
|
|
28013
28021
|
horizontalSnap: undefined,
|
|
28014
28022
|
verticalSnap: undefined,
|
|
28023
|
+
cancelDnd: undefined,
|
|
28015
28024
|
});
|
|
28016
28025
|
setup() {
|
|
28017
28026
|
owl.onMounted(() => {
|
|
@@ -28024,12 +28033,28 @@
|
|
|
28024
28033
|
// new rendering
|
|
28025
28034
|
this.render();
|
|
28026
28035
|
});
|
|
28036
|
+
owl.onWillUpdateProps(() => {
|
|
28037
|
+
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
28038
|
+
const draggedFigureId = this.dnd.draggedFigure?.id;
|
|
28039
|
+
if (draggedFigureId && !this.env.model.getters.getFigure(sheetId, draggedFigureId)) {
|
|
28040
|
+
if (this.dnd.cancelDnd) {
|
|
28041
|
+
this.dnd.cancelDnd();
|
|
28042
|
+
}
|
|
28043
|
+
this.dnd.draggedFigure = undefined;
|
|
28044
|
+
this.dnd.horizontalSnap = undefined;
|
|
28045
|
+
this.dnd.verticalSnap = undefined;
|
|
28046
|
+
this.dnd.cancelDnd = undefined;
|
|
28047
|
+
}
|
|
28048
|
+
});
|
|
28027
28049
|
}
|
|
28028
28050
|
getVisibleFigures() {
|
|
28029
28051
|
const visibleFigures = this.env.model.getters.getVisibleFigures();
|
|
28030
28052
|
if (this.dnd.draggedFigure &&
|
|
28031
28053
|
!visibleFigures.some((figure) => figure.id === this.dnd.draggedFigure?.id)) {
|
|
28032
|
-
|
|
28054
|
+
const draggedFigure = this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id);
|
|
28055
|
+
if (draggedFigure) {
|
|
28056
|
+
visibleFigures.push(draggedFigure);
|
|
28057
|
+
}
|
|
28033
28058
|
}
|
|
28034
28059
|
return visibleFigures;
|
|
28035
28060
|
}
|
|
@@ -28148,7 +28173,7 @@
|
|
|
28148
28173
|
this.dnd.verticalSnap = undefined;
|
|
28149
28174
|
this.env.model.dispatch("UPDATE_FIGURE", { sheetId, id: figure.id, x, y });
|
|
28150
28175
|
};
|
|
28151
|
-
startDnd(onMouseMove, onMouseUp);
|
|
28176
|
+
this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
|
|
28152
28177
|
}
|
|
28153
28178
|
/**
|
|
28154
28179
|
* Initialize the resize of a figure with mouse movements
|
|
@@ -28196,7 +28221,7 @@
|
|
|
28196
28221
|
this.dnd.horizontalSnap = undefined;
|
|
28197
28222
|
this.dnd.verticalSnap = undefined;
|
|
28198
28223
|
};
|
|
28199
|
-
startDnd(onMouseMove, onMouseUp);
|
|
28224
|
+
this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
|
|
28200
28225
|
}
|
|
28201
28226
|
getOtherFigures(figId) {
|
|
28202
28227
|
return this.getVisibleFigures().filter((f) => f.id !== figId);
|
|
@@ -31492,7 +31517,7 @@
|
|
|
31492
31517
|
vertical: style.verticalAlign
|
|
31493
31518
|
? V_ALIGNMENT_EXPORT_CONVERSION_MAP[style.verticalAlign]
|
|
31494
31519
|
: undefined,
|
|
31495
|
-
wrapText: style.wrapping === "wrap",
|
|
31520
|
+
wrapText: style.wrapping === "wrap" || cell.content?.includes(NEWLINE) ? true : undefined,
|
|
31496
31521
|
},
|
|
31497
31522
|
};
|
|
31498
31523
|
styles.font["strike"] = !!style?.strikethrough || undefined;
|
|
@@ -31709,7 +31734,7 @@
|
|
|
31709
31734
|
return undefined;
|
|
31710
31735
|
}
|
|
31711
31736
|
function isChartData(data) {
|
|
31712
|
-
return "dataSets" in data;
|
|
31737
|
+
return "dataSets" in data && data.dataSets.length > 0;
|
|
31713
31738
|
}
|
|
31714
31739
|
function isImageData(data) {
|
|
31715
31740
|
return "imageSrc" in data;
|
|
@@ -31921,9 +31946,8 @@
|
|
|
31921
31946
|
}
|
|
31922
31947
|
return rows;
|
|
31923
31948
|
}
|
|
31924
|
-
/** Remove newlines (\n) in shared strings, We do not support them */
|
|
31925
31949
|
function convertSharedStrings(xlsxSharedStrings) {
|
|
31926
|
-
return xlsxSharedStrings.map(
|
|
31950
|
+
return xlsxSharedStrings.map(replaceNewLines);
|
|
31927
31951
|
}
|
|
31928
31952
|
function convertCells(sheet, data, sheetDims, warningManager) {
|
|
31929
31953
|
const cells = {};
|
|
@@ -32714,15 +32738,10 @@
|
|
|
32714
32738
|
getSharedStrings() {
|
|
32715
32739
|
return this.mapOnElements({ parent: this.rootFile.file.xml, query: "si" }, (ssElement) => {
|
|
32716
32740
|
// Shared string can either be a simple text, or a rich text (text with formatting, possibly in multiple parts)
|
|
32717
|
-
if (ssElement.children[0].tagName === "t") {
|
|
32718
|
-
return this.extractTextContent(ssElement) || "";
|
|
32719
|
-
}
|
|
32720
32741
|
// We don't support rich text formatting, we'll only extract the text
|
|
32721
|
-
|
|
32722
|
-
return this.
|
|
32723
|
-
|
|
32724
|
-
}).join("");
|
|
32725
|
-
}
|
|
32742
|
+
return this.mapOnElements({ parent: ssElement, query: "t" }, (textElement) => {
|
|
32743
|
+
return this.extractTextContent(textElement) || "";
|
|
32744
|
+
}).join("");
|
|
32726
32745
|
});
|
|
32727
32746
|
}
|
|
32728
32747
|
}
|
|
@@ -34529,10 +34548,34 @@
|
|
|
34529
34548
|
const elements = [...cmd.elements].sort((a, b) => b - a);
|
|
34530
34549
|
for (const group of groupConsecutive(elements)) {
|
|
34531
34550
|
if (cmd.dimension === "COL") {
|
|
34532
|
-
|
|
34551
|
+
if (group[0] >= this.getters.getNumberCols(cmd.sheetId)) {
|
|
34552
|
+
for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
|
|
34553
|
+
this.history.update("borders", cmd.sheetId, group[0] + 1, row, "vertical", undefined);
|
|
34554
|
+
}
|
|
34555
|
+
}
|
|
34556
|
+
if (group[group.length - 1] === 0) {
|
|
34557
|
+
for (let row = 0; row < this.getters.getNumberRows(cmd.sheetId); row++) {
|
|
34558
|
+
this.history.update("borders", cmd.sheetId, 0, row, "vertical", undefined);
|
|
34559
|
+
}
|
|
34560
|
+
}
|
|
34561
|
+
const zone = this.getters.getColsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
|
|
34562
|
+
this.clearInsideBorders(cmd.sheetId, [zone]);
|
|
34563
|
+
this.shiftBordersHorizontally(cmd.sheetId, group[0] + 1, -group.length);
|
|
34533
34564
|
}
|
|
34534
34565
|
else {
|
|
34535
|
-
|
|
34566
|
+
if (group[0] >= this.getters.getNumberRows(cmd.sheetId)) {
|
|
34567
|
+
for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
|
|
34568
|
+
this.history.update("borders", cmd.sheetId, col, group[0] + 1, "horizontal", undefined);
|
|
34569
|
+
}
|
|
34570
|
+
}
|
|
34571
|
+
if (group[group.length - 1] === 0) {
|
|
34572
|
+
for (let col = 0; col < this.getters.getNumberCols(cmd.sheetId); col++) {
|
|
34573
|
+
this.history.update("borders", cmd.sheetId, col, 0, "horizontal", undefined);
|
|
34574
|
+
}
|
|
34575
|
+
}
|
|
34576
|
+
const zone = this.getters.getRowsZone(cmd.sheetId, group[group.length - 1] + 1, group[0]);
|
|
34577
|
+
this.clearInsideBorders(cmd.sheetId, [zone]);
|
|
34578
|
+
this.shiftBordersVertically(cmd.sheetId, group[0] + 1, -group.length);
|
|
34536
34579
|
}
|
|
34537
34580
|
}
|
|
34538
34581
|
break;
|
|
@@ -34839,6 +34882,18 @@
|
|
|
34839
34882
|
}
|
|
34840
34883
|
}
|
|
34841
34884
|
}
|
|
34885
|
+
/**
|
|
34886
|
+
* Remove the borders inside of a zone
|
|
34887
|
+
*/
|
|
34888
|
+
clearInsideBorders(sheetId, zones) {
|
|
34889
|
+
for (let zone of zones) {
|
|
34890
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
34891
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
34892
|
+
this.history.update("borders", sheetId, col, row, undefined);
|
|
34893
|
+
}
|
|
34894
|
+
}
|
|
34895
|
+
}
|
|
34896
|
+
}
|
|
34842
34897
|
/**
|
|
34843
34898
|
* Add a border to the existing one to a cell
|
|
34844
34899
|
*/
|
|
@@ -36095,7 +36150,7 @@
|
|
|
36095
36150
|
const before = this.getters.getCell({ sheetId, col, row });
|
|
36096
36151
|
const hasContent = "content" in after || "formula" in after;
|
|
36097
36152
|
// Compute the new cell properties
|
|
36098
|
-
const afterContent = hasContent ?
|
|
36153
|
+
const afterContent = hasContent ? replaceNewLines(after?.content) : before?.content || "";
|
|
36099
36154
|
let style;
|
|
36100
36155
|
if (after.style !== undefined) {
|
|
36101
36156
|
style = after.style || undefined;
|
|
@@ -50915,6 +50970,7 @@
|
|
|
50915
50970
|
break;
|
|
50916
50971
|
case "DELETE_SHEET":
|
|
50917
50972
|
this.cleanViewports();
|
|
50973
|
+
this.sheetsWithDirtyViewports.delete(cmd.sheetId);
|
|
50918
50974
|
break;
|
|
50919
50975
|
case "ACTIVATE_SHEET":
|
|
50920
50976
|
this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
|
|
@@ -51837,17 +51893,17 @@
|
|
|
51837
51893
|
sheetNameRef = owl.useRef("sheetNameSpan");
|
|
51838
51894
|
editionState = "initializing";
|
|
51839
51895
|
setup() {
|
|
51840
|
-
owl.onMounted(() => {
|
|
51841
|
-
if (this.isSheetActive) {
|
|
51842
|
-
this.scrollToSheet();
|
|
51843
|
-
}
|
|
51844
|
-
});
|
|
51845
51896
|
owl.onPatched(() => {
|
|
51846
51897
|
if (this.sheetNameRef.el && this.state.isEditing && this.editionState === "initializing") {
|
|
51847
51898
|
this.editionState = "editing";
|
|
51848
51899
|
this.focusInputAndSelectContent();
|
|
51849
51900
|
}
|
|
51850
51901
|
});
|
|
51902
|
+
owl.useEffect((sheetId) => {
|
|
51903
|
+
if (this.props.sheetId === sheetId) {
|
|
51904
|
+
this.scrollToSheet();
|
|
51905
|
+
}
|
|
51906
|
+
}, () => [this.env.model.getters.getActiveSheetId()]);
|
|
51851
51907
|
}
|
|
51852
51908
|
focusInputAndSelectContent() {
|
|
51853
51909
|
if (!this.state.isEditing || !this.sheetNameRef.el)
|
|
@@ -51859,7 +51915,10 @@
|
|
|
51859
51915
|
}
|
|
51860
51916
|
}
|
|
51861
51917
|
scrollToSheet() {
|
|
51862
|
-
this.sheetDivRef.el?.scrollIntoView?.(
|
|
51918
|
+
this.sheetDivRef.el?.scrollIntoView?.({
|
|
51919
|
+
behavior: "smooth",
|
|
51920
|
+
inline: "nearest",
|
|
51921
|
+
});
|
|
51863
51922
|
}
|
|
51864
51923
|
onFocusOut() {
|
|
51865
51924
|
if (this.state.isEditing && this.editionState !== "initializing") {
|
|
@@ -53136,7 +53195,6 @@
|
|
|
53136
53195
|
height: fit-content;
|
|
53137
53196
|
margin-top: -1px;
|
|
53138
53197
|
border: 1px solid;
|
|
53139
|
-
z-index: ${ComponentsImportance.TopBarComposer};
|
|
53140
53198
|
|
|
53141
53199
|
.o-composer:empty:not(:focus):not(.active)::before {
|
|
53142
53200
|
content: url("data:image/svg+xml,${encodeURIComponent(FX_SVG)}");
|
|
@@ -53170,6 +53228,7 @@
|
|
|
53170
53228
|
}
|
|
53171
53229
|
return cssPropertiesToCss({
|
|
53172
53230
|
"border-color": SELECTION_BORDER_COLOR,
|
|
53231
|
+
"z-index": String(ComponentsImportance.TopBarComposer),
|
|
53173
53232
|
});
|
|
53174
53233
|
}
|
|
53175
53234
|
}
|
|
@@ -56972,7 +57031,12 @@
|
|
|
56972
57031
|
["count", strings.length],
|
|
56973
57032
|
["uniqueCount", strings.length],
|
|
56974
57033
|
];
|
|
56975
|
-
const stringNodes = strings.map((string) =>
|
|
57034
|
+
const stringNodes = strings.map((string) => {
|
|
57035
|
+
if (string.trim() !== string) {
|
|
57036
|
+
return escapeXml /*xml*/ `<si><t xml:space="preserve">${string}</t></si>`;
|
|
57037
|
+
}
|
|
57038
|
+
return escapeXml /*xml*/ `<si><t>${string}</t></si>`;
|
|
57039
|
+
});
|
|
56976
57040
|
const xml = escapeXml /*xml*/ `
|
|
56977
57041
|
<sst ${formatAttributes(namespaces)}>
|
|
56978
57042
|
${joinXmlNodes(stringNodes)}
|
|
@@ -57605,6 +57669,8 @@
|
|
|
57605
57669
|
createActions,
|
|
57606
57670
|
transformRangeData,
|
|
57607
57671
|
deepEquals,
|
|
57672
|
+
isNumber,
|
|
57673
|
+
isDateTime,
|
|
57608
57674
|
};
|
|
57609
57675
|
const links = {
|
|
57610
57676
|
isMarkdownLink,
|
|
@@ -57683,9 +57749,9 @@
|
|
|
57683
57749
|
exports.tokenize = tokenize;
|
|
57684
57750
|
|
|
57685
57751
|
|
|
57686
|
-
__info__.version = "17.0.
|
|
57687
|
-
__info__.date = "
|
|
57688
|
-
__info__.hash = "
|
|
57752
|
+
__info__.version = "17.0.45";
|
|
57753
|
+
__info__.date = "2025-01-14T11:30:44.730Z";
|
|
57754
|
+
__info__.hash = "94f8ef9";
|
|
57689
57755
|
|
|
57690
57756
|
|
|
57691
57757
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|