@odoo/o-spreadsheet 15.2.3 → 15.2.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.
- package/dist/o-spreadsheet.cjs.js +45 -11
- package/dist/o-spreadsheet.d.ts +18 -1
- package/dist/o-spreadsheet.esm.js +45 -11
- package/dist/o-spreadsheet.iife.js +45 -11
- package/dist/o-spreadsheet.iife.min.js +9 -5
- package/package.json +2 -2
|
@@ -372,7 +372,7 @@ function formatJSTime(jsDate, format) {
|
|
|
372
372
|
* - it does not accept "," as thousand separator, because when we tokenize a
|
|
373
373
|
* formula, commas are used to separate arguments
|
|
374
374
|
*/
|
|
375
|
-
const formulaNumberRegexp =
|
|
375
|
+
const formulaNumberRegexp = /(^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?)(?!\w|!)/;
|
|
376
376
|
const numberRegexp = /^-?\d+(,\d+)*(\.?\d*(e\d+)?)?(\s*%)?$|^-?\.\d+(\s*%)?$/;
|
|
377
377
|
/**
|
|
378
378
|
* Return true if the argument is a "number string".
|
|
@@ -26031,7 +26031,7 @@ const { Portal } = owl.misc;
|
|
|
26031
26031
|
const { xml: xml$l } = owl.tags;
|
|
26032
26032
|
const TEMPLATE$j = xml$l /* xml */ `
|
|
26033
26033
|
<Portal target="'.o-spreadsheet'">
|
|
26034
|
-
<div t-att-style="style">
|
|
26034
|
+
<div class="o-popover" t-att-style="style">
|
|
26035
26035
|
<t t-slot="default"/>
|
|
26036
26036
|
</div>
|
|
26037
26037
|
</Portal>
|
|
@@ -27022,14 +27022,31 @@ class ContentEditableHelper {
|
|
|
27022
27022
|
* */
|
|
27023
27023
|
getCurrentSelection() {
|
|
27024
27024
|
let { startElement, endElement, startSelectionOffset, endSelectionOffset } = this.getStartAndEndSelection();
|
|
27025
|
-
let startSizeBefore = this.
|
|
27026
|
-
let endSizeBefore = this.
|
|
27025
|
+
let startSizeBefore = this.findSelectionIndex(startElement, startSelectionOffset);
|
|
27026
|
+
let endSizeBefore = this.findSelectionIndex(endElement, endSelectionOffset);
|
|
27027
27027
|
return {
|
|
27028
|
-
start: startSizeBefore
|
|
27029
|
-
end: endSizeBefore
|
|
27028
|
+
start: startSizeBefore,
|
|
27029
|
+
end: endSizeBefore,
|
|
27030
27030
|
};
|
|
27031
27031
|
}
|
|
27032
|
-
|
|
27032
|
+
/**
|
|
27033
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
27034
|
+
* The selected node is either a Text node or an Element node.
|
|
27035
|
+
*
|
|
27036
|
+
* case 1 -Text node:
|
|
27037
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
27038
|
+
* content length of all previous nodes.
|
|
27039
|
+
*
|
|
27040
|
+
* case 2 - Element node:
|
|
27041
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
27042
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
27043
|
+
*
|
|
27044
|
+
* See the MDN documentation for more details.
|
|
27045
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
27046
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
27047
|
+
*
|
|
27048
|
+
*/
|
|
27049
|
+
findSelectionIndex(nodeToFind, nodeOffset) {
|
|
27033
27050
|
let it = this.iterateChildren(this.el);
|
|
27034
27051
|
let usedCharacters = 0;
|
|
27035
27052
|
let current = it.next();
|
|
@@ -27041,6 +27058,19 @@ class ContentEditableHelper {
|
|
|
27041
27058
|
}
|
|
27042
27059
|
current = it.next();
|
|
27043
27060
|
}
|
|
27061
|
+
if (current.value === nodeToFind) {
|
|
27062
|
+
if (!current.value.hasChildNodes()) {
|
|
27063
|
+
usedCharacters += nodeOffset;
|
|
27064
|
+
}
|
|
27065
|
+
else {
|
|
27066
|
+
const children = [...current.value.childNodes].slice(0, nodeOffset);
|
|
27067
|
+
for (const child of children) {
|
|
27068
|
+
if (!child.textContent)
|
|
27069
|
+
continue;
|
|
27070
|
+
usedCharacters += child.textContent.length;
|
|
27071
|
+
}
|
|
27072
|
+
}
|
|
27073
|
+
}
|
|
27044
27074
|
return usedCharacters;
|
|
27045
27075
|
}
|
|
27046
27076
|
getStartAndEndSelection() {
|
|
@@ -27265,7 +27295,7 @@ const CSS$b = css$d /* scss */ `
|
|
|
27265
27295
|
padding: 0;
|
|
27266
27296
|
margin: 0;
|
|
27267
27297
|
border: 0;
|
|
27268
|
-
z-index:
|
|
27298
|
+
z-index: 6;
|
|
27269
27299
|
flex-grow: 1;
|
|
27270
27300
|
max-height: inherit;
|
|
27271
27301
|
.o-composer {
|
|
@@ -27834,6 +27864,10 @@ const CSS$9 = css$b /* scss */ `
|
|
|
27834
27864
|
border-left: 3px solid red;
|
|
27835
27865
|
padding: 10px;
|
|
27836
27866
|
}
|
|
27867
|
+
|
|
27868
|
+
.o-popover:has(.o-error-tooltip) {
|
|
27869
|
+
z-index: 4 !important;
|
|
27870
|
+
}
|
|
27837
27871
|
`;
|
|
27838
27872
|
class ErrorToolTip extends owl.Component {
|
|
27839
27873
|
}
|
|
@@ -31298,6 +31332,6 @@ exports.registries = registries;
|
|
|
31298
31332
|
exports.setTranslationMethod = setTranslationMethod;
|
|
31299
31333
|
|
|
31300
31334
|
|
|
31301
|
-
__info__.version = '15.2.
|
|
31302
|
-
__info__.date = '2023-
|
|
31303
|
-
__info__.hash = '
|
|
31335
|
+
__info__.version = '15.2.5';
|
|
31336
|
+
__info__.date = '2023-04-21T07:27:24.954Z';
|
|
31337
|
+
__info__.hash = '0896859';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -4288,7 +4288,24 @@ declare class ContentEditableHelper {
|
|
|
4288
4288
|
start: number;
|
|
4289
4289
|
end: number;
|
|
4290
4290
|
};
|
|
4291
|
-
|
|
4291
|
+
/**
|
|
4292
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
4293
|
+
* The selected node is either a Text node or an Element node.
|
|
4294
|
+
*
|
|
4295
|
+
* case 1 -Text node:
|
|
4296
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
4297
|
+
* content length of all previous nodes.
|
|
4298
|
+
*
|
|
4299
|
+
* case 2 - Element node:
|
|
4300
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
4301
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
4302
|
+
*
|
|
4303
|
+
* See the MDN documentation for more details.
|
|
4304
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
4305
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
4306
|
+
*
|
|
4307
|
+
*/
|
|
4308
|
+
private findSelectionIndex;
|
|
4292
4309
|
private getStartAndEndSelection;
|
|
4293
4310
|
}
|
|
4294
4311
|
|
|
@@ -349,7 +349,7 @@ function formatJSTime(jsDate, format) {
|
|
|
349
349
|
* - it does not accept "," as thousand separator, because when we tokenize a
|
|
350
350
|
* formula, commas are used to separate arguments
|
|
351
351
|
*/
|
|
352
|
-
const formulaNumberRegexp =
|
|
352
|
+
const formulaNumberRegexp = /(^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?)(?!\w|!)/;
|
|
353
353
|
const numberRegexp = /^-?\d+(,\d+)*(\.?\d*(e\d+)?)?(\s*%)?$|^-?\.\d+(\s*%)?$/;
|
|
354
354
|
/**
|
|
355
355
|
* Return true if the argument is a "number string".
|
|
@@ -26008,7 +26008,7 @@ const { Portal } = misc$1;
|
|
|
26008
26008
|
const { xml: xml$l } = tags;
|
|
26009
26009
|
const TEMPLATE$j = xml$l /* xml */ `
|
|
26010
26010
|
<Portal target="'.o-spreadsheet'">
|
|
26011
|
-
<div t-att-style="style">
|
|
26011
|
+
<div class="o-popover" t-att-style="style">
|
|
26012
26012
|
<t t-slot="default"/>
|
|
26013
26013
|
</div>
|
|
26014
26014
|
</Portal>
|
|
@@ -26999,14 +26999,31 @@ class ContentEditableHelper {
|
|
|
26999
26999
|
* */
|
|
27000
27000
|
getCurrentSelection() {
|
|
27001
27001
|
let { startElement, endElement, startSelectionOffset, endSelectionOffset } = this.getStartAndEndSelection();
|
|
27002
|
-
let startSizeBefore = this.
|
|
27003
|
-
let endSizeBefore = this.
|
|
27002
|
+
let startSizeBefore = this.findSelectionIndex(startElement, startSelectionOffset);
|
|
27003
|
+
let endSizeBefore = this.findSelectionIndex(endElement, endSelectionOffset);
|
|
27004
27004
|
return {
|
|
27005
|
-
start: startSizeBefore
|
|
27006
|
-
end: endSizeBefore
|
|
27005
|
+
start: startSizeBefore,
|
|
27006
|
+
end: endSizeBefore,
|
|
27007
27007
|
};
|
|
27008
27008
|
}
|
|
27009
|
-
|
|
27009
|
+
/**
|
|
27010
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
27011
|
+
* The selected node is either a Text node or an Element node.
|
|
27012
|
+
*
|
|
27013
|
+
* case 1 -Text node:
|
|
27014
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
27015
|
+
* content length of all previous nodes.
|
|
27016
|
+
*
|
|
27017
|
+
* case 2 - Element node:
|
|
27018
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
27019
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
27020
|
+
*
|
|
27021
|
+
* See the MDN documentation for more details.
|
|
27022
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
27023
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
27024
|
+
*
|
|
27025
|
+
*/
|
|
27026
|
+
findSelectionIndex(nodeToFind, nodeOffset) {
|
|
27010
27027
|
let it = this.iterateChildren(this.el);
|
|
27011
27028
|
let usedCharacters = 0;
|
|
27012
27029
|
let current = it.next();
|
|
@@ -27018,6 +27035,19 @@ class ContentEditableHelper {
|
|
|
27018
27035
|
}
|
|
27019
27036
|
current = it.next();
|
|
27020
27037
|
}
|
|
27038
|
+
if (current.value === nodeToFind) {
|
|
27039
|
+
if (!current.value.hasChildNodes()) {
|
|
27040
|
+
usedCharacters += nodeOffset;
|
|
27041
|
+
}
|
|
27042
|
+
else {
|
|
27043
|
+
const children = [...current.value.childNodes].slice(0, nodeOffset);
|
|
27044
|
+
for (const child of children) {
|
|
27045
|
+
if (!child.textContent)
|
|
27046
|
+
continue;
|
|
27047
|
+
usedCharacters += child.textContent.length;
|
|
27048
|
+
}
|
|
27049
|
+
}
|
|
27050
|
+
}
|
|
27021
27051
|
return usedCharacters;
|
|
27022
27052
|
}
|
|
27023
27053
|
getStartAndEndSelection() {
|
|
@@ -27242,7 +27272,7 @@ const CSS$b = css$d /* scss */ `
|
|
|
27242
27272
|
padding: 0;
|
|
27243
27273
|
margin: 0;
|
|
27244
27274
|
border: 0;
|
|
27245
|
-
z-index:
|
|
27275
|
+
z-index: 6;
|
|
27246
27276
|
flex-grow: 1;
|
|
27247
27277
|
max-height: inherit;
|
|
27248
27278
|
.o-composer {
|
|
@@ -27811,6 +27841,10 @@ const CSS$9 = css$b /* scss */ `
|
|
|
27811
27841
|
border-left: 3px solid red;
|
|
27812
27842
|
padding: 10px;
|
|
27813
27843
|
}
|
|
27844
|
+
|
|
27845
|
+
.o-popover:has(.o-error-tooltip) {
|
|
27846
|
+
z-index: 4 !important;
|
|
27847
|
+
}
|
|
27814
27848
|
`;
|
|
27815
27849
|
class ErrorToolTip extends Component {
|
|
27816
27850
|
}
|
|
@@ -31252,6 +31286,6 @@ const helpers = {
|
|
|
31252
31286
|
export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, compile, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, parse, readonlyAllowedCommands, registries, setTranslationMethod };
|
|
31253
31287
|
|
|
31254
31288
|
|
|
31255
|
-
__info__.version = '15.2.
|
|
31256
|
-
__info__.date = '2023-
|
|
31257
|
-
__info__.hash = '
|
|
31289
|
+
__info__.version = '15.2.5';
|
|
31290
|
+
__info__.date = '2023-04-21T07:27:24.954Z';
|
|
31291
|
+
__info__.hash = '0896859';
|
|
@@ -369,7 +369,7 @@
|
|
|
369
369
|
* - it does not accept "," as thousand separator, because when we tokenize a
|
|
370
370
|
* formula, commas are used to separate arguments
|
|
371
371
|
*/
|
|
372
|
-
const formulaNumberRegexp =
|
|
372
|
+
const formulaNumberRegexp = /(^-?\d+(\.?\d*(e\d+)?)?(\s*%)?|^-?\.\d+(\s*%)?)(?!\w|!)/;
|
|
373
373
|
const numberRegexp = /^-?\d+(,\d+)*(\.?\d*(e\d+)?)?(\s*%)?$|^-?\.\d+(\s*%)?$/;
|
|
374
374
|
/**
|
|
375
375
|
* Return true if the argument is a "number string".
|
|
@@ -26028,7 +26028,7 @@
|
|
|
26028
26028
|
const { xml: xml$l } = owl.tags;
|
|
26029
26029
|
const TEMPLATE$j = xml$l /* xml */ `
|
|
26030
26030
|
<Portal target="'.o-spreadsheet'">
|
|
26031
|
-
<div t-att-style="style">
|
|
26031
|
+
<div class="o-popover" t-att-style="style">
|
|
26032
26032
|
<t t-slot="default"/>
|
|
26033
26033
|
</div>
|
|
26034
26034
|
</Portal>
|
|
@@ -27019,14 +27019,31 @@
|
|
|
27019
27019
|
* */
|
|
27020
27020
|
getCurrentSelection() {
|
|
27021
27021
|
let { startElement, endElement, startSelectionOffset, endSelectionOffset } = this.getStartAndEndSelection();
|
|
27022
|
-
let startSizeBefore = this.
|
|
27023
|
-
let endSizeBefore = this.
|
|
27022
|
+
let startSizeBefore = this.findSelectionIndex(startElement, startSelectionOffset);
|
|
27023
|
+
let endSizeBefore = this.findSelectionIndex(endElement, endSelectionOffset);
|
|
27024
27024
|
return {
|
|
27025
|
-
start: startSizeBefore
|
|
27026
|
-
end: endSizeBefore
|
|
27025
|
+
start: startSizeBefore,
|
|
27026
|
+
end: endSizeBefore,
|
|
27027
27027
|
};
|
|
27028
27028
|
}
|
|
27029
|
-
|
|
27029
|
+
/**
|
|
27030
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
27031
|
+
* The selected node is either a Text node or an Element node.
|
|
27032
|
+
*
|
|
27033
|
+
* case 1 -Text node:
|
|
27034
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
27035
|
+
* content length of all previous nodes.
|
|
27036
|
+
*
|
|
27037
|
+
* case 2 - Element node:
|
|
27038
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
27039
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
27040
|
+
*
|
|
27041
|
+
* See the MDN documentation for more details.
|
|
27042
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
27043
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
27044
|
+
*
|
|
27045
|
+
*/
|
|
27046
|
+
findSelectionIndex(nodeToFind, nodeOffset) {
|
|
27030
27047
|
let it = this.iterateChildren(this.el);
|
|
27031
27048
|
let usedCharacters = 0;
|
|
27032
27049
|
let current = it.next();
|
|
@@ -27038,6 +27055,19 @@
|
|
|
27038
27055
|
}
|
|
27039
27056
|
current = it.next();
|
|
27040
27057
|
}
|
|
27058
|
+
if (current.value === nodeToFind) {
|
|
27059
|
+
if (!current.value.hasChildNodes()) {
|
|
27060
|
+
usedCharacters += nodeOffset;
|
|
27061
|
+
}
|
|
27062
|
+
else {
|
|
27063
|
+
const children = [...current.value.childNodes].slice(0, nodeOffset);
|
|
27064
|
+
for (const child of children) {
|
|
27065
|
+
if (!child.textContent)
|
|
27066
|
+
continue;
|
|
27067
|
+
usedCharacters += child.textContent.length;
|
|
27068
|
+
}
|
|
27069
|
+
}
|
|
27070
|
+
}
|
|
27041
27071
|
return usedCharacters;
|
|
27042
27072
|
}
|
|
27043
27073
|
getStartAndEndSelection() {
|
|
@@ -27262,7 +27292,7 @@
|
|
|
27262
27292
|
padding: 0;
|
|
27263
27293
|
margin: 0;
|
|
27264
27294
|
border: 0;
|
|
27265
|
-
z-index:
|
|
27295
|
+
z-index: 6;
|
|
27266
27296
|
flex-grow: 1;
|
|
27267
27297
|
max-height: inherit;
|
|
27268
27298
|
.o-composer {
|
|
@@ -27831,6 +27861,10 @@
|
|
|
27831
27861
|
border-left: 3px solid red;
|
|
27832
27862
|
padding: 10px;
|
|
27833
27863
|
}
|
|
27864
|
+
|
|
27865
|
+
.o-popover:has(.o-error-tooltip) {
|
|
27866
|
+
z-index: 4 !important;
|
|
27867
|
+
}
|
|
27834
27868
|
`;
|
|
27835
27869
|
class ErrorToolTip extends owl.Component {
|
|
27836
27870
|
}
|
|
@@ -31297,9 +31331,9 @@
|
|
|
31297
31331
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
31298
31332
|
|
|
31299
31333
|
|
|
31300
|
-
__info__.version = '15.2.
|
|
31301
|
-
__info__.date = '2023-
|
|
31302
|
-
__info__.hash = '
|
|
31334
|
+
__info__.version = '15.2.5';
|
|
31335
|
+
__info__.date = '2023-04-21T07:27:24.954Z';
|
|
31336
|
+
__info__.hash = '0896859';
|
|
31303
31337
|
|
|
31304
31338
|
|
|
31305
31339
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|