@odoo/o-spreadsheet 15.0.3 → 15.0.5
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.
|
@@ -370,7 +370,7 @@ function formatJSTime(jsDate, format) {
|
|
|
370
370
|
* - it does not accept "," as thousand separator, because when we tokenize a
|
|
371
371
|
* formula, commas are used to separate arguments
|
|
372
372
|
*/
|
|
373
|
-
const formulaNumberRegexp =
|
|
373
|
+
const formulaNumberRegexp = /(^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?)(?!\w|!)/;
|
|
374
374
|
const numberRegexp = /^-?\d+(,\d+)*(\.?\d*(e\d+)?)?(\s*%)?$|^-?\.\d+(\s*%)?$/;
|
|
375
375
|
/**
|
|
376
376
|
* Return true if the argument is a "number string".
|
|
@@ -27080,14 +27080,31 @@ class ContentEditableHelper {
|
|
|
27080
27080
|
* */
|
|
27081
27081
|
getCurrentSelection() {
|
|
27082
27082
|
let { startElement, endElement, startSelectionOffset, endSelectionOffset } = this.getStartAndEndSelection();
|
|
27083
|
-
let startSizeBefore = this.
|
|
27084
|
-
let endSizeBefore = this.
|
|
27083
|
+
let startSizeBefore = this.findSelectionIndex(startElement, startSelectionOffset);
|
|
27084
|
+
let endSizeBefore = this.findSelectionIndex(endElement, endSelectionOffset);
|
|
27085
27085
|
return {
|
|
27086
|
-
start: startSizeBefore
|
|
27087
|
-
end: endSizeBefore
|
|
27086
|
+
start: startSizeBefore,
|
|
27087
|
+
end: endSizeBefore,
|
|
27088
27088
|
};
|
|
27089
27089
|
}
|
|
27090
|
-
|
|
27090
|
+
/**
|
|
27091
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
27092
|
+
* The selected node is either a Text node or an Element node.
|
|
27093
|
+
*
|
|
27094
|
+
* case 1 -Text node:
|
|
27095
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
27096
|
+
* content length of all previous nodes.
|
|
27097
|
+
*
|
|
27098
|
+
* case 2 - Element node:
|
|
27099
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
27100
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
27101
|
+
*
|
|
27102
|
+
* See the MDN documentation for more details.
|
|
27103
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
27104
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
27105
|
+
*
|
|
27106
|
+
*/
|
|
27107
|
+
findSelectionIndex(nodeToFind, nodeOffset) {
|
|
27091
27108
|
let it = this.iterateChildren(this.el);
|
|
27092
27109
|
let usedCharacters = 0;
|
|
27093
27110
|
let current = it.next();
|
|
@@ -27099,6 +27116,19 @@ class ContentEditableHelper {
|
|
|
27099
27116
|
}
|
|
27100
27117
|
current = it.next();
|
|
27101
27118
|
}
|
|
27119
|
+
if (current.value === nodeToFind) {
|
|
27120
|
+
if (!current.value.hasChildNodes()) {
|
|
27121
|
+
usedCharacters += nodeOffset;
|
|
27122
|
+
}
|
|
27123
|
+
else {
|
|
27124
|
+
const children = [...current.value.childNodes].slice(0, nodeOffset);
|
|
27125
|
+
for (const child of children) {
|
|
27126
|
+
if (!child.textContent)
|
|
27127
|
+
continue;
|
|
27128
|
+
usedCharacters += child.textContent.length;
|
|
27129
|
+
}
|
|
27130
|
+
}
|
|
27131
|
+
}
|
|
27102
27132
|
return usedCharacters;
|
|
27103
27133
|
}
|
|
27104
27134
|
getStartAndEndSelection() {
|
|
@@ -31369,6 +31399,6 @@ exports.registries = registries;
|
|
|
31369
31399
|
exports.setTranslationMethod = setTranslationMethod;
|
|
31370
31400
|
|
|
31371
31401
|
|
|
31372
|
-
__info__.version = '15.0.
|
|
31373
|
-
__info__.date = '2023-
|
|
31374
|
-
__info__.hash = '
|
|
31402
|
+
__info__.version = '15.0.5';
|
|
31403
|
+
__info__.date = '2023-04-21T07:27:19.753Z';
|
|
31404
|
+
__info__.hash = 'ef69cc7';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4279,7 +4279,24 @@ declare class ContentEditableHelper {
|
|
|
4279
4279
|
start: number;
|
|
4280
4280
|
end: number;
|
|
4281
4281
|
};
|
|
4282
|
-
|
|
4282
|
+
/**
|
|
4283
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
4284
|
+
* The selected node is either a Text node or an Element node.
|
|
4285
|
+
*
|
|
4286
|
+
* case 1 -Text node:
|
|
4287
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
4288
|
+
* content length of all previous nodes.
|
|
4289
|
+
*
|
|
4290
|
+
* case 2 - Element node:
|
|
4291
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
4292
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
4293
|
+
*
|
|
4294
|
+
* See the MDN documentation for more details.
|
|
4295
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
4296
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
4297
|
+
*
|
|
4298
|
+
*/
|
|
4299
|
+
private findSelectionIndex;
|
|
4283
4300
|
private getStartAndEndSelection;
|
|
4284
4301
|
}
|
|
4285
4302
|
|
|
@@ -347,7 +347,7 @@ function formatJSTime(jsDate, format) {
|
|
|
347
347
|
* - it does not accept "," as thousand separator, because when we tokenize a
|
|
348
348
|
* formula, commas are used to separate arguments
|
|
349
349
|
*/
|
|
350
|
-
const formulaNumberRegexp =
|
|
350
|
+
const formulaNumberRegexp = /(^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?)(?!\w|!)/;
|
|
351
351
|
const numberRegexp = /^-?\d+(,\d+)*(\.?\d*(e\d+)?)?(\s*%)?$|^-?\.\d+(\s*%)?$/;
|
|
352
352
|
/**
|
|
353
353
|
* Return true if the argument is a "number string".
|
|
@@ -27057,14 +27057,31 @@ class ContentEditableHelper {
|
|
|
27057
27057
|
* */
|
|
27058
27058
|
getCurrentSelection() {
|
|
27059
27059
|
let { startElement, endElement, startSelectionOffset, endSelectionOffset } = this.getStartAndEndSelection();
|
|
27060
|
-
let startSizeBefore = this.
|
|
27061
|
-
let endSizeBefore = this.
|
|
27060
|
+
let startSizeBefore = this.findSelectionIndex(startElement, startSelectionOffset);
|
|
27061
|
+
let endSizeBefore = this.findSelectionIndex(endElement, endSelectionOffset);
|
|
27062
27062
|
return {
|
|
27063
|
-
start: startSizeBefore
|
|
27064
|
-
end: endSizeBefore
|
|
27063
|
+
start: startSizeBefore,
|
|
27064
|
+
end: endSizeBefore,
|
|
27065
27065
|
};
|
|
27066
27066
|
}
|
|
27067
|
-
|
|
27067
|
+
/**
|
|
27068
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
27069
|
+
* The selected node is either a Text node or an Element node.
|
|
27070
|
+
*
|
|
27071
|
+
* case 1 -Text node:
|
|
27072
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
27073
|
+
* content length of all previous nodes.
|
|
27074
|
+
*
|
|
27075
|
+
* case 2 - Element node:
|
|
27076
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
27077
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
27078
|
+
*
|
|
27079
|
+
* See the MDN documentation for more details.
|
|
27080
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
27081
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
27082
|
+
*
|
|
27083
|
+
*/
|
|
27084
|
+
findSelectionIndex(nodeToFind, nodeOffset) {
|
|
27068
27085
|
let it = this.iterateChildren(this.el);
|
|
27069
27086
|
let usedCharacters = 0;
|
|
27070
27087
|
let current = it.next();
|
|
@@ -27076,6 +27093,19 @@ class ContentEditableHelper {
|
|
|
27076
27093
|
}
|
|
27077
27094
|
current = it.next();
|
|
27078
27095
|
}
|
|
27096
|
+
if (current.value === nodeToFind) {
|
|
27097
|
+
if (!current.value.hasChildNodes()) {
|
|
27098
|
+
usedCharacters += nodeOffset;
|
|
27099
|
+
}
|
|
27100
|
+
else {
|
|
27101
|
+
const children = [...current.value.childNodes].slice(0, nodeOffset);
|
|
27102
|
+
for (const child of children) {
|
|
27103
|
+
if (!child.textContent)
|
|
27104
|
+
continue;
|
|
27105
|
+
usedCharacters += child.textContent.length;
|
|
27106
|
+
}
|
|
27107
|
+
}
|
|
27108
|
+
}
|
|
27079
27109
|
return usedCharacters;
|
|
27080
27110
|
}
|
|
27081
27111
|
getStartAndEndSelection() {
|
|
@@ -31324,6 +31354,6 @@ const helpers = {
|
|
|
31324
31354
|
export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, normalize, parse, readonlyAllowedCommands, registries, setTranslationMethod };
|
|
31325
31355
|
|
|
31326
31356
|
|
|
31327
|
-
__info__.version = '15.0.
|
|
31328
|
-
__info__.date = '2023-
|
|
31329
|
-
__info__.hash = '
|
|
31357
|
+
__info__.version = '15.0.5';
|
|
31358
|
+
__info__.date = '2023-04-21T07:27:19.753Z';
|
|
31359
|
+
__info__.hash = 'ef69cc7';
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
* - it does not accept "," as thousand separator, because when we tokenize a
|
|
368
368
|
* formula, commas are used to separate arguments
|
|
369
369
|
*/
|
|
370
|
-
const formulaNumberRegexp =
|
|
370
|
+
const formulaNumberRegexp = /(^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?)(?!\w|!)/;
|
|
371
371
|
const numberRegexp = /^-?\d+(,\d+)*(\.?\d*(e\d+)?)?(\s*%)?$|^-?\.\d+(\s*%)?$/;
|
|
372
372
|
/**
|
|
373
373
|
* Return true if the argument is a "number string".
|
|
@@ -27077,14 +27077,31 @@
|
|
|
27077
27077
|
* */
|
|
27078
27078
|
getCurrentSelection() {
|
|
27079
27079
|
let { startElement, endElement, startSelectionOffset, endSelectionOffset } = this.getStartAndEndSelection();
|
|
27080
|
-
let startSizeBefore = this.
|
|
27081
|
-
let endSizeBefore = this.
|
|
27080
|
+
let startSizeBefore = this.findSelectionIndex(startElement, startSelectionOffset);
|
|
27081
|
+
let endSizeBefore = this.findSelectionIndex(endElement, endSelectionOffset);
|
|
27082
27082
|
return {
|
|
27083
|
-
start: startSizeBefore
|
|
27084
|
-
end: endSizeBefore
|
|
27083
|
+
start: startSizeBefore,
|
|
27084
|
+
end: endSizeBefore,
|
|
27085
27085
|
};
|
|
27086
27086
|
}
|
|
27087
|
-
|
|
27087
|
+
/**
|
|
27088
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
27089
|
+
* The selected node is either a Text node or an Element node.
|
|
27090
|
+
*
|
|
27091
|
+
* case 1 -Text node:
|
|
27092
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
27093
|
+
* content length of all previous nodes.
|
|
27094
|
+
*
|
|
27095
|
+
* case 2 - Element node:
|
|
27096
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
27097
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
27098
|
+
*
|
|
27099
|
+
* See the MDN documentation for more details.
|
|
27100
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
27101
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
27102
|
+
*
|
|
27103
|
+
*/
|
|
27104
|
+
findSelectionIndex(nodeToFind, nodeOffset) {
|
|
27088
27105
|
let it = this.iterateChildren(this.el);
|
|
27089
27106
|
let usedCharacters = 0;
|
|
27090
27107
|
let current = it.next();
|
|
@@ -27096,6 +27113,19 @@
|
|
|
27096
27113
|
}
|
|
27097
27114
|
current = it.next();
|
|
27098
27115
|
}
|
|
27116
|
+
if (current.value === nodeToFind) {
|
|
27117
|
+
if (!current.value.hasChildNodes()) {
|
|
27118
|
+
usedCharacters += nodeOffset;
|
|
27119
|
+
}
|
|
27120
|
+
else {
|
|
27121
|
+
const children = [...current.value.childNodes].slice(0, nodeOffset);
|
|
27122
|
+
for (const child of children) {
|
|
27123
|
+
if (!child.textContent)
|
|
27124
|
+
continue;
|
|
27125
|
+
usedCharacters += child.textContent.length;
|
|
27126
|
+
}
|
|
27127
|
+
}
|
|
27128
|
+
}
|
|
27099
27129
|
return usedCharacters;
|
|
27100
27130
|
}
|
|
27101
27131
|
getStartAndEndSelection() {
|
|
@@ -31368,9 +31398,9 @@
|
|
|
31368
31398
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
31369
31399
|
|
|
31370
31400
|
|
|
31371
|
-
__info__.version = '15.0.
|
|
31372
|
-
__info__.date = '2023-
|
|
31373
|
-
__info__.hash = '
|
|
31401
|
+
__info__.version = '15.0.5';
|
|
31402
|
+
__info__.date = '2023-04-21T07:27:19.753Z';
|
|
31403
|
+
__info__.hash = 'ef69cc7';
|
|
31374
31404
|
|
|
31375
31405
|
|
|
31376
31406
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|