@odoo/o-spreadsheet 14.0.2 → 14.0.3
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 → o-spreadsheet.cjs.js} +65 -21
- package/dist/{o_spreadsheet.d.ts → o-spreadsheet.d.ts} +18 -1
- package/dist/{o_spreadsheet.esm.js → o-spreadsheet.esm.js} +65 -21
- package/dist/{o_spreadsheet.iife.js → o-spreadsheet.iife.js} +65 -21
- package/dist/{o_spreadsheet.iife.min.js → o-spreadsheet.iife.min.js} +79 -73
- package/package.json +11 -8
|
@@ -5456,7 +5456,7 @@ autofillRulesRegistry
|
|
|
5456
5456
|
sequence: 40,
|
|
5457
5457
|
});
|
|
5458
5458
|
|
|
5459
|
-
const { xml: xml$i, css: css$
|
|
5459
|
+
const { xml: xml$i, css: css$i } = owl.tags;
|
|
5460
5460
|
const { useRef: useRef$5 } = owl.hooks;
|
|
5461
5461
|
const TEMPLATE$f = xml$i /* xml */ `
|
|
5462
5462
|
<div class="o-chart-container">
|
|
@@ -5465,7 +5465,7 @@ const TEMPLATE$f = xml$i /* xml */ `
|
|
|
5465
5465
|
// -----------------------------------------------------------------------------
|
|
5466
5466
|
// STYLE
|
|
5467
5467
|
// -----------------------------------------------------------------------------
|
|
5468
|
-
const CSS$
|
|
5468
|
+
const CSS$f = css$i /* scss */ `
|
|
5469
5469
|
.o-chart-container {
|
|
5470
5470
|
width: 100%;
|
|
5471
5471
|
height: 100%;
|
|
@@ -5512,10 +5512,10 @@ class ChartFigure extends owl.Component {
|
|
|
5512
5512
|
}
|
|
5513
5513
|
}
|
|
5514
5514
|
ChartFigure.template = TEMPLATE$f;
|
|
5515
|
-
ChartFigure.style = CSS$
|
|
5515
|
+
ChartFigure.style = CSS$f;
|
|
5516
5516
|
ChartFigure.components = {};
|
|
5517
5517
|
|
|
5518
|
-
const { xml: xml$h, css: css$
|
|
5518
|
+
const { xml: xml$h, css: css$h } = owl.tags;
|
|
5519
5519
|
const TEMPLATE$e = xml$h /* xml */ `
|
|
5520
5520
|
<div class="o-fig-text">
|
|
5521
5521
|
<p t-esc="props.figure.data"/>
|
|
@@ -5524,7 +5524,7 @@ const TEMPLATE$e = xml$h /* xml */ `
|
|
|
5524
5524
|
// -----------------------------------------------------------------------------
|
|
5525
5525
|
// STYLE
|
|
5526
5526
|
// -----------------------------------------------------------------------------
|
|
5527
|
-
const CSS$
|
|
5527
|
+
const CSS$e = css$h /* scss */ `
|
|
5528
5528
|
.o-fig-text {
|
|
5529
5529
|
width: 100%;
|
|
5530
5530
|
height: 100%;
|
|
@@ -5540,7 +5540,7 @@ const CSS$d = css$g /* scss */ `
|
|
|
5540
5540
|
class TextFigure extends owl.Component {
|
|
5541
5541
|
}
|
|
5542
5542
|
TextFigure.template = TEMPLATE$e;
|
|
5543
|
-
TextFigure.style = CSS$
|
|
5543
|
+
TextFigure.style = CSS$e;
|
|
5544
5544
|
|
|
5545
5545
|
const figureRegistry = new Registry();
|
|
5546
5546
|
// figureRegistry.add("ConditionalFormatting", {
|
|
@@ -6460,7 +6460,7 @@ for (let fs of fontSizes) {
|
|
|
6460
6460
|
}
|
|
6461
6461
|
|
|
6462
6462
|
const Component$e = owl__namespace.Component;
|
|
6463
|
-
const { xml: xml$g, css: css$
|
|
6463
|
+
const { xml: xml$g, css: css$g } = owl__namespace.tags;
|
|
6464
6464
|
const TEMPLATE$d = xml$g /* xml */ `
|
|
6465
6465
|
<div class="o-selection">
|
|
6466
6466
|
<t t-foreach="ranges" t-as="range" t-key="range.id">
|
|
@@ -6490,7 +6490,7 @@ const TEMPLATE$d = xml$g /* xml */ `
|
|
|
6490
6490
|
t-on-click="disable">OK</button>
|
|
6491
6491
|
</div>
|
|
6492
6492
|
</div>`;
|
|
6493
|
-
const CSS$
|
|
6493
|
+
const CSS$d = css$g /* scss */ `
|
|
6494
6494
|
.o-selection {
|
|
6495
6495
|
input {
|
|
6496
6496
|
display: inline-block;
|
|
@@ -6604,7 +6604,7 @@ class SelectionInput extends Component$e {
|
|
|
6604
6604
|
}
|
|
6605
6605
|
}
|
|
6606
6606
|
SelectionInput.template = TEMPLATE$d;
|
|
6607
|
-
SelectionInput.style = CSS$
|
|
6607
|
+
SelectionInput.style = CSS$d;
|
|
6608
6608
|
|
|
6609
6609
|
const terms = {
|
|
6610
6610
|
CF_TITLE: _lt("Format rules"),
|
|
@@ -6650,7 +6650,7 @@ const chartTerms = {
|
|
|
6650
6650
|
|
|
6651
6651
|
const Component$d = owl__namespace.Component;
|
|
6652
6652
|
const { useState: useState$d } = owl__namespace;
|
|
6653
|
-
const { xml: xml$f } = owl__namespace.tags;
|
|
6653
|
+
const { xml: xml$f, css: css$f } = owl__namespace.tags;
|
|
6654
6654
|
const TEMPLATE$c = xml$f /* xml */ `
|
|
6655
6655
|
<div class="o-chart">
|
|
6656
6656
|
<div class="o-section">
|
|
@@ -6676,10 +6676,17 @@ const TEMPLATE$c = xml$f /* xml */ `
|
|
|
6676
6676
|
</div>
|
|
6677
6677
|
<div class="o-sidePanelButtons">
|
|
6678
6678
|
<button t-if="props.figure" t-on-click="updateChart(props.figure)" class="o-sidePanelButton" t-esc="env._t('${chartTerms.UpdateChart}')"/>
|
|
6679
|
-
<button t-else="" t-on-click="createChart" class="o-sidePanelButton" t-esc="env._t('${chartTerms.CreateChart}')"/>
|
|
6679
|
+
<button t-else="" t-on-click="createChart" t-att-class="{ 'o-error': state.errorWhileCreating }" class="o-sidePanelButton" t-esc="env._t('${chartTerms.CreateChart}')"/>
|
|
6680
6680
|
</div>
|
|
6681
6681
|
</div>
|
|
6682
6682
|
`;
|
|
6683
|
+
const CSS$c = css$f /*scss */ `
|
|
6684
|
+
.o-chart {
|
|
6685
|
+
.o-sidePanelButton.o-error {
|
|
6686
|
+
border-color: #e14747;
|
|
6687
|
+
}
|
|
6688
|
+
}
|
|
6689
|
+
`;
|
|
6683
6690
|
class ChartPanel extends Component$d {
|
|
6684
6691
|
constructor() {
|
|
6685
6692
|
super(...arguments);
|
|
@@ -6693,12 +6700,17 @@ class ChartPanel extends Component$d {
|
|
|
6693
6700
|
this.state.labelRange = ev.detail.ranges[0];
|
|
6694
6701
|
}
|
|
6695
6702
|
createChart() {
|
|
6696
|
-
this.env.dispatch("CREATE_CHART", {
|
|
6703
|
+
const result = this.env.dispatch("CREATE_CHART", {
|
|
6697
6704
|
sheetId: this.getters.getActiveSheet(),
|
|
6698
6705
|
id: uuidv4(),
|
|
6699
6706
|
definition: this.getChartDefinition(),
|
|
6700
6707
|
});
|
|
6701
|
-
|
|
6708
|
+
if (result.status === "SUCCESS") {
|
|
6709
|
+
this.trigger("close-side-panel");
|
|
6710
|
+
}
|
|
6711
|
+
else {
|
|
6712
|
+
this.state.errorWhileCreating = true;
|
|
6713
|
+
}
|
|
6702
6714
|
}
|
|
6703
6715
|
updateChart(chart) {
|
|
6704
6716
|
this.env.dispatch("UPDATE_CHART", {
|
|
@@ -6724,10 +6736,12 @@ class ChartPanel extends Component$d {
|
|
|
6724
6736
|
labelRange: data ? data.labelRange : "",
|
|
6725
6737
|
type: data ? data.type : "bar",
|
|
6726
6738
|
seriesHasTitle: data ? data.title !== undefined : false,
|
|
6739
|
+
errorWhileCreating: false,
|
|
6727
6740
|
};
|
|
6728
6741
|
}
|
|
6729
6742
|
}
|
|
6730
6743
|
ChartPanel.template = TEMPLATE$c;
|
|
6744
|
+
ChartPanel.style = CSS$c;
|
|
6731
6745
|
ChartPanel.components = { SelectionInput };
|
|
6732
6746
|
|
|
6733
6747
|
const Component$c = owl__namespace.Component;
|
|
@@ -15360,14 +15374,31 @@ class ContentEditableHelper {
|
|
|
15360
15374
|
* */
|
|
15361
15375
|
getCurrentSelection() {
|
|
15362
15376
|
let { startElement, endElement, startSelectionOffset, endSelectionOffset } = this.getStartAndEndSelection();
|
|
15363
|
-
let startSizeBefore = this.
|
|
15364
|
-
let endSizeBefore = this.
|
|
15377
|
+
let startSizeBefore = this.findSelectionIndex(startElement, startSelectionOffset);
|
|
15378
|
+
let endSizeBefore = this.findSelectionIndex(endElement, endSelectionOffset);
|
|
15365
15379
|
return {
|
|
15366
|
-
start: startSizeBefore
|
|
15367
|
-
end: endSizeBefore
|
|
15380
|
+
start: startSizeBefore,
|
|
15381
|
+
end: endSizeBefore,
|
|
15368
15382
|
};
|
|
15369
15383
|
}
|
|
15370
|
-
|
|
15384
|
+
/**
|
|
15385
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
15386
|
+
* The selected node is either a Text node or an Element node.
|
|
15387
|
+
*
|
|
15388
|
+
* case 1 -Text node:
|
|
15389
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
15390
|
+
* content length of all previous nodes.
|
|
15391
|
+
*
|
|
15392
|
+
* case 2 - Element node:
|
|
15393
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
15394
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
15395
|
+
*
|
|
15396
|
+
* See the MDN documentation for more details.
|
|
15397
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
15398
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
15399
|
+
*
|
|
15400
|
+
*/
|
|
15401
|
+
findSelectionIndex(nodeToFind, nodeOffset) {
|
|
15371
15402
|
let it = this.iterateChildren(this.el);
|
|
15372
15403
|
let usedCharacters = 0;
|
|
15373
15404
|
let current = it.next();
|
|
@@ -15379,6 +15410,19 @@ class ContentEditableHelper {
|
|
|
15379
15410
|
}
|
|
15380
15411
|
current = it.next();
|
|
15381
15412
|
}
|
|
15413
|
+
if (current.value === nodeToFind) {
|
|
15414
|
+
if (!current.value.hasChildNodes()) {
|
|
15415
|
+
usedCharacters += nodeOffset;
|
|
15416
|
+
}
|
|
15417
|
+
else {
|
|
15418
|
+
const children = [...current.value.childNodes].slice(0, nodeOffset);
|
|
15419
|
+
for (const child of children) {
|
|
15420
|
+
if (!child.textContent)
|
|
15421
|
+
continue;
|
|
15422
|
+
usedCharacters += child.textContent.length;
|
|
15423
|
+
}
|
|
15424
|
+
}
|
|
15425
|
+
}
|
|
15382
15426
|
return usedCharacters;
|
|
15383
15427
|
}
|
|
15384
15428
|
getStartAndEndSelection() {
|
|
@@ -17831,6 +17875,6 @@ exports.registries = registries;
|
|
|
17831
17875
|
exports.setTranslationMethod = setTranslationMethod;
|
|
17832
17876
|
|
|
17833
17877
|
|
|
17834
|
-
__info__.version = '14.0.
|
|
17835
|
-
__info__.date = '2023-
|
|
17836
|
-
__info__.hash = '
|
|
17878
|
+
__info__.version = '14.0.3';
|
|
17879
|
+
__info__.date = '2023-04-21T07:27:17.798Z';
|
|
17880
|
+
__info__.hash = '32b98aa';
|
|
@@ -2421,7 +2421,24 @@ declare class ContentEditableHelper {
|
|
|
2421
2421
|
start: number;
|
|
2422
2422
|
end: number;
|
|
2423
2423
|
};
|
|
2424
|
-
|
|
2424
|
+
/**
|
|
2425
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
2426
|
+
* The selected node is either a Text node or an Element node.
|
|
2427
|
+
*
|
|
2428
|
+
* case 1 -Text node:
|
|
2429
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
2430
|
+
* content length of all previous nodes.
|
|
2431
|
+
*
|
|
2432
|
+
* case 2 - Element node:
|
|
2433
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
2434
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
2435
|
+
*
|
|
2436
|
+
* See the MDN documentation for more details.
|
|
2437
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
2438
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
2439
|
+
*
|
|
2440
|
+
*/
|
|
2441
|
+
private findSelectionIndex;
|
|
2425
2442
|
private getStartAndEndSelection;
|
|
2426
2443
|
}
|
|
2427
2444
|
|
|
@@ -5433,7 +5433,7 @@ autofillRulesRegistry
|
|
|
5433
5433
|
sequence: 40,
|
|
5434
5434
|
});
|
|
5435
5435
|
|
|
5436
|
-
const { xml: xml$i, css: css$
|
|
5436
|
+
const { xml: xml$i, css: css$i } = tags;
|
|
5437
5437
|
const { useRef: useRef$5 } = hooks$3;
|
|
5438
5438
|
const TEMPLATE$f = xml$i /* xml */ `
|
|
5439
5439
|
<div class="o-chart-container">
|
|
@@ -5442,7 +5442,7 @@ const TEMPLATE$f = xml$i /* xml */ `
|
|
|
5442
5442
|
// -----------------------------------------------------------------------------
|
|
5443
5443
|
// STYLE
|
|
5444
5444
|
// -----------------------------------------------------------------------------
|
|
5445
|
-
const CSS$
|
|
5445
|
+
const CSS$f = css$i /* scss */ `
|
|
5446
5446
|
.o-chart-container {
|
|
5447
5447
|
width: 100%;
|
|
5448
5448
|
height: 100%;
|
|
@@ -5489,10 +5489,10 @@ class ChartFigure extends Component$f {
|
|
|
5489
5489
|
}
|
|
5490
5490
|
}
|
|
5491
5491
|
ChartFigure.template = TEMPLATE$f;
|
|
5492
|
-
ChartFigure.style = CSS$
|
|
5492
|
+
ChartFigure.style = CSS$f;
|
|
5493
5493
|
ChartFigure.components = {};
|
|
5494
5494
|
|
|
5495
|
-
const { xml: xml$h, css: css$
|
|
5495
|
+
const { xml: xml$h, css: css$h } = tags;
|
|
5496
5496
|
const TEMPLATE$e = xml$h /* xml */ `
|
|
5497
5497
|
<div class="o-fig-text">
|
|
5498
5498
|
<p t-esc="props.figure.data"/>
|
|
@@ -5501,7 +5501,7 @@ const TEMPLATE$e = xml$h /* xml */ `
|
|
|
5501
5501
|
// -----------------------------------------------------------------------------
|
|
5502
5502
|
// STYLE
|
|
5503
5503
|
// -----------------------------------------------------------------------------
|
|
5504
|
-
const CSS$
|
|
5504
|
+
const CSS$e = css$h /* scss */ `
|
|
5505
5505
|
.o-fig-text {
|
|
5506
5506
|
width: 100%;
|
|
5507
5507
|
height: 100%;
|
|
@@ -5517,7 +5517,7 @@ const CSS$d = css$g /* scss */ `
|
|
|
5517
5517
|
class TextFigure extends Component$f {
|
|
5518
5518
|
}
|
|
5519
5519
|
TextFigure.template = TEMPLATE$e;
|
|
5520
|
-
TextFigure.style = CSS$
|
|
5520
|
+
TextFigure.style = CSS$e;
|
|
5521
5521
|
|
|
5522
5522
|
const figureRegistry = new Registry();
|
|
5523
5523
|
// figureRegistry.add("ConditionalFormatting", {
|
|
@@ -6437,7 +6437,7 @@ for (let fs of fontSizes) {
|
|
|
6437
6437
|
}
|
|
6438
6438
|
|
|
6439
6439
|
const Component$e = owl.Component;
|
|
6440
|
-
const { xml: xml$g, css: css$
|
|
6440
|
+
const { xml: xml$g, css: css$g } = owl.tags;
|
|
6441
6441
|
const TEMPLATE$d = xml$g /* xml */ `
|
|
6442
6442
|
<div class="o-selection">
|
|
6443
6443
|
<t t-foreach="ranges" t-as="range" t-key="range.id">
|
|
@@ -6467,7 +6467,7 @@ const TEMPLATE$d = xml$g /* xml */ `
|
|
|
6467
6467
|
t-on-click="disable">OK</button>
|
|
6468
6468
|
</div>
|
|
6469
6469
|
</div>`;
|
|
6470
|
-
const CSS$
|
|
6470
|
+
const CSS$d = css$g /* scss */ `
|
|
6471
6471
|
.o-selection {
|
|
6472
6472
|
input {
|
|
6473
6473
|
display: inline-block;
|
|
@@ -6581,7 +6581,7 @@ class SelectionInput extends Component$e {
|
|
|
6581
6581
|
}
|
|
6582
6582
|
}
|
|
6583
6583
|
SelectionInput.template = TEMPLATE$d;
|
|
6584
|
-
SelectionInput.style = CSS$
|
|
6584
|
+
SelectionInput.style = CSS$d;
|
|
6585
6585
|
|
|
6586
6586
|
const terms = {
|
|
6587
6587
|
CF_TITLE: _lt("Format rules"),
|
|
@@ -6627,7 +6627,7 @@ const chartTerms = {
|
|
|
6627
6627
|
|
|
6628
6628
|
const Component$d = owl.Component;
|
|
6629
6629
|
const { useState: useState$d } = owl;
|
|
6630
|
-
const { xml: xml$f } = owl.tags;
|
|
6630
|
+
const { xml: xml$f, css: css$f } = owl.tags;
|
|
6631
6631
|
const TEMPLATE$c = xml$f /* xml */ `
|
|
6632
6632
|
<div class="o-chart">
|
|
6633
6633
|
<div class="o-section">
|
|
@@ -6653,10 +6653,17 @@ const TEMPLATE$c = xml$f /* xml */ `
|
|
|
6653
6653
|
</div>
|
|
6654
6654
|
<div class="o-sidePanelButtons">
|
|
6655
6655
|
<button t-if="props.figure" t-on-click="updateChart(props.figure)" class="o-sidePanelButton" t-esc="env._t('${chartTerms.UpdateChart}')"/>
|
|
6656
|
-
<button t-else="" t-on-click="createChart" class="o-sidePanelButton" t-esc="env._t('${chartTerms.CreateChart}')"/>
|
|
6656
|
+
<button t-else="" t-on-click="createChart" t-att-class="{ 'o-error': state.errorWhileCreating }" class="o-sidePanelButton" t-esc="env._t('${chartTerms.CreateChart}')"/>
|
|
6657
6657
|
</div>
|
|
6658
6658
|
</div>
|
|
6659
6659
|
`;
|
|
6660
|
+
const CSS$c = css$f /*scss */ `
|
|
6661
|
+
.o-chart {
|
|
6662
|
+
.o-sidePanelButton.o-error {
|
|
6663
|
+
border-color: #e14747;
|
|
6664
|
+
}
|
|
6665
|
+
}
|
|
6666
|
+
`;
|
|
6660
6667
|
class ChartPanel extends Component$d {
|
|
6661
6668
|
constructor() {
|
|
6662
6669
|
super(...arguments);
|
|
@@ -6670,12 +6677,17 @@ class ChartPanel extends Component$d {
|
|
|
6670
6677
|
this.state.labelRange = ev.detail.ranges[0];
|
|
6671
6678
|
}
|
|
6672
6679
|
createChart() {
|
|
6673
|
-
this.env.dispatch("CREATE_CHART", {
|
|
6680
|
+
const result = this.env.dispatch("CREATE_CHART", {
|
|
6674
6681
|
sheetId: this.getters.getActiveSheet(),
|
|
6675
6682
|
id: uuidv4(),
|
|
6676
6683
|
definition: this.getChartDefinition(),
|
|
6677
6684
|
});
|
|
6678
|
-
|
|
6685
|
+
if (result.status === "SUCCESS") {
|
|
6686
|
+
this.trigger("close-side-panel");
|
|
6687
|
+
}
|
|
6688
|
+
else {
|
|
6689
|
+
this.state.errorWhileCreating = true;
|
|
6690
|
+
}
|
|
6679
6691
|
}
|
|
6680
6692
|
updateChart(chart) {
|
|
6681
6693
|
this.env.dispatch("UPDATE_CHART", {
|
|
@@ -6701,10 +6713,12 @@ class ChartPanel extends Component$d {
|
|
|
6701
6713
|
labelRange: data ? data.labelRange : "",
|
|
6702
6714
|
type: data ? data.type : "bar",
|
|
6703
6715
|
seriesHasTitle: data ? data.title !== undefined : false,
|
|
6716
|
+
errorWhileCreating: false,
|
|
6704
6717
|
};
|
|
6705
6718
|
}
|
|
6706
6719
|
}
|
|
6707
6720
|
ChartPanel.template = TEMPLATE$c;
|
|
6721
|
+
ChartPanel.style = CSS$c;
|
|
6708
6722
|
ChartPanel.components = { SelectionInput };
|
|
6709
6723
|
|
|
6710
6724
|
const Component$c = owl.Component;
|
|
@@ -15337,14 +15351,31 @@ class ContentEditableHelper {
|
|
|
15337
15351
|
* */
|
|
15338
15352
|
getCurrentSelection() {
|
|
15339
15353
|
let { startElement, endElement, startSelectionOffset, endSelectionOffset } = this.getStartAndEndSelection();
|
|
15340
|
-
let startSizeBefore = this.
|
|
15341
|
-
let endSizeBefore = this.
|
|
15354
|
+
let startSizeBefore = this.findSelectionIndex(startElement, startSelectionOffset);
|
|
15355
|
+
let endSizeBefore = this.findSelectionIndex(endElement, endSelectionOffset);
|
|
15342
15356
|
return {
|
|
15343
|
-
start: startSizeBefore
|
|
15344
|
-
end: endSizeBefore
|
|
15357
|
+
start: startSizeBefore,
|
|
15358
|
+
end: endSizeBefore,
|
|
15345
15359
|
};
|
|
15346
15360
|
}
|
|
15347
|
-
|
|
15361
|
+
/**
|
|
15362
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
15363
|
+
* The selected node is either a Text node or an Element node.
|
|
15364
|
+
*
|
|
15365
|
+
* case 1 -Text node:
|
|
15366
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
15367
|
+
* content length of all previous nodes.
|
|
15368
|
+
*
|
|
15369
|
+
* case 2 - Element node:
|
|
15370
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
15371
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
15372
|
+
*
|
|
15373
|
+
* See the MDN documentation for more details.
|
|
15374
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
15375
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
15376
|
+
*
|
|
15377
|
+
*/
|
|
15378
|
+
findSelectionIndex(nodeToFind, nodeOffset) {
|
|
15348
15379
|
let it = this.iterateChildren(this.el);
|
|
15349
15380
|
let usedCharacters = 0;
|
|
15350
15381
|
let current = it.next();
|
|
@@ -15356,6 +15387,19 @@ class ContentEditableHelper {
|
|
|
15356
15387
|
}
|
|
15357
15388
|
current = it.next();
|
|
15358
15389
|
}
|
|
15390
|
+
if (current.value === nodeToFind) {
|
|
15391
|
+
if (!current.value.hasChildNodes()) {
|
|
15392
|
+
usedCharacters += nodeOffset;
|
|
15393
|
+
}
|
|
15394
|
+
else {
|
|
15395
|
+
const children = [...current.value.childNodes].slice(0, nodeOffset);
|
|
15396
|
+
for (const child of children) {
|
|
15397
|
+
if (!child.textContent)
|
|
15398
|
+
continue;
|
|
15399
|
+
usedCharacters += child.textContent.length;
|
|
15400
|
+
}
|
|
15401
|
+
}
|
|
15402
|
+
}
|
|
15359
15403
|
return usedCharacters;
|
|
15360
15404
|
}
|
|
15361
15405
|
getStartAndEndSelection() {
|
|
@@ -17796,6 +17840,6 @@ const helpers = {
|
|
|
17796
17840
|
export { BasePlugin, Model, SPREADSHEET_DIMENSIONS, Spreadsheet, DEBUG as __DEBUG__, __info__, astToFormula, functionCache, helpers, normalize, parse, registries, setTranslationMethod };
|
|
17797
17841
|
|
|
17798
17842
|
|
|
17799
|
-
__info__.version = '14.0.
|
|
17800
|
-
__info__.date = '2023-
|
|
17801
|
-
__info__.hash = '
|
|
17843
|
+
__info__.version = '14.0.3';
|
|
17844
|
+
__info__.date = '2023-04-21T07:27:17.798Z';
|
|
17845
|
+
__info__.hash = '32b98aa';
|
|
@@ -5453,7 +5453,7 @@
|
|
|
5453
5453
|
sequence: 40,
|
|
5454
5454
|
});
|
|
5455
5455
|
|
|
5456
|
-
const { xml: xml$i, css: css$
|
|
5456
|
+
const { xml: xml$i, css: css$i } = owl.tags;
|
|
5457
5457
|
const { useRef: useRef$5 } = owl.hooks;
|
|
5458
5458
|
const TEMPLATE$f = xml$i /* xml */ `
|
|
5459
5459
|
<div class="o-chart-container">
|
|
@@ -5462,7 +5462,7 @@
|
|
|
5462
5462
|
// -----------------------------------------------------------------------------
|
|
5463
5463
|
// STYLE
|
|
5464
5464
|
// -----------------------------------------------------------------------------
|
|
5465
|
-
const CSS$
|
|
5465
|
+
const CSS$f = css$i /* scss */ `
|
|
5466
5466
|
.o-chart-container {
|
|
5467
5467
|
width: 100%;
|
|
5468
5468
|
height: 100%;
|
|
@@ -5509,10 +5509,10 @@
|
|
|
5509
5509
|
}
|
|
5510
5510
|
}
|
|
5511
5511
|
ChartFigure.template = TEMPLATE$f;
|
|
5512
|
-
ChartFigure.style = CSS$
|
|
5512
|
+
ChartFigure.style = CSS$f;
|
|
5513
5513
|
ChartFigure.components = {};
|
|
5514
5514
|
|
|
5515
|
-
const { xml: xml$h, css: css$
|
|
5515
|
+
const { xml: xml$h, css: css$h } = owl.tags;
|
|
5516
5516
|
const TEMPLATE$e = xml$h /* xml */ `
|
|
5517
5517
|
<div class="o-fig-text">
|
|
5518
5518
|
<p t-esc="props.figure.data"/>
|
|
@@ -5521,7 +5521,7 @@
|
|
|
5521
5521
|
// -----------------------------------------------------------------------------
|
|
5522
5522
|
// STYLE
|
|
5523
5523
|
// -----------------------------------------------------------------------------
|
|
5524
|
-
const CSS$
|
|
5524
|
+
const CSS$e = css$h /* scss */ `
|
|
5525
5525
|
.o-fig-text {
|
|
5526
5526
|
width: 100%;
|
|
5527
5527
|
height: 100%;
|
|
@@ -5537,7 +5537,7 @@
|
|
|
5537
5537
|
class TextFigure extends owl.Component {
|
|
5538
5538
|
}
|
|
5539
5539
|
TextFigure.template = TEMPLATE$e;
|
|
5540
|
-
TextFigure.style = CSS$
|
|
5540
|
+
TextFigure.style = CSS$e;
|
|
5541
5541
|
|
|
5542
5542
|
const figureRegistry = new Registry();
|
|
5543
5543
|
// figureRegistry.add("ConditionalFormatting", {
|
|
@@ -6457,7 +6457,7 @@
|
|
|
6457
6457
|
}
|
|
6458
6458
|
|
|
6459
6459
|
const Component$e = owl__namespace.Component;
|
|
6460
|
-
const { xml: xml$g, css: css$
|
|
6460
|
+
const { xml: xml$g, css: css$g } = owl__namespace.tags;
|
|
6461
6461
|
const TEMPLATE$d = xml$g /* xml */ `
|
|
6462
6462
|
<div class="o-selection">
|
|
6463
6463
|
<t t-foreach="ranges" t-as="range" t-key="range.id">
|
|
@@ -6487,7 +6487,7 @@
|
|
|
6487
6487
|
t-on-click="disable">OK</button>
|
|
6488
6488
|
</div>
|
|
6489
6489
|
</div>`;
|
|
6490
|
-
const CSS$
|
|
6490
|
+
const CSS$d = css$g /* scss */ `
|
|
6491
6491
|
.o-selection {
|
|
6492
6492
|
input {
|
|
6493
6493
|
display: inline-block;
|
|
@@ -6601,7 +6601,7 @@
|
|
|
6601
6601
|
}
|
|
6602
6602
|
}
|
|
6603
6603
|
SelectionInput.template = TEMPLATE$d;
|
|
6604
|
-
SelectionInput.style = CSS$
|
|
6604
|
+
SelectionInput.style = CSS$d;
|
|
6605
6605
|
|
|
6606
6606
|
const terms = {
|
|
6607
6607
|
CF_TITLE: _lt("Format rules"),
|
|
@@ -6647,7 +6647,7 @@
|
|
|
6647
6647
|
|
|
6648
6648
|
const Component$d = owl__namespace.Component;
|
|
6649
6649
|
const { useState: useState$d } = owl__namespace;
|
|
6650
|
-
const { xml: xml$f } = owl__namespace.tags;
|
|
6650
|
+
const { xml: xml$f, css: css$f } = owl__namespace.tags;
|
|
6651
6651
|
const TEMPLATE$c = xml$f /* xml */ `
|
|
6652
6652
|
<div class="o-chart">
|
|
6653
6653
|
<div class="o-section">
|
|
@@ -6673,9 +6673,16 @@
|
|
|
6673
6673
|
</div>
|
|
6674
6674
|
<div class="o-sidePanelButtons">
|
|
6675
6675
|
<button t-if="props.figure" t-on-click="updateChart(props.figure)" class="o-sidePanelButton" t-esc="env._t('${chartTerms.UpdateChart}')"/>
|
|
6676
|
-
<button t-else="" t-on-click="createChart" class="o-sidePanelButton" t-esc="env._t('${chartTerms.CreateChart}')"/>
|
|
6676
|
+
<button t-else="" t-on-click="createChart" t-att-class="{ 'o-error': state.errorWhileCreating }" class="o-sidePanelButton" t-esc="env._t('${chartTerms.CreateChart}')"/>
|
|
6677
6677
|
</div>
|
|
6678
6678
|
</div>
|
|
6679
|
+
`;
|
|
6680
|
+
const CSS$c = css$f /*scss */ `
|
|
6681
|
+
.o-chart {
|
|
6682
|
+
.o-sidePanelButton.o-error {
|
|
6683
|
+
border-color: #e14747;
|
|
6684
|
+
}
|
|
6685
|
+
}
|
|
6679
6686
|
`;
|
|
6680
6687
|
class ChartPanel extends Component$d {
|
|
6681
6688
|
constructor() {
|
|
@@ -6690,12 +6697,17 @@
|
|
|
6690
6697
|
this.state.labelRange = ev.detail.ranges[0];
|
|
6691
6698
|
}
|
|
6692
6699
|
createChart() {
|
|
6693
|
-
this.env.dispatch("CREATE_CHART", {
|
|
6700
|
+
const result = this.env.dispatch("CREATE_CHART", {
|
|
6694
6701
|
sheetId: this.getters.getActiveSheet(),
|
|
6695
6702
|
id: uuidv4(),
|
|
6696
6703
|
definition: this.getChartDefinition(),
|
|
6697
6704
|
});
|
|
6698
|
-
|
|
6705
|
+
if (result.status === "SUCCESS") {
|
|
6706
|
+
this.trigger("close-side-panel");
|
|
6707
|
+
}
|
|
6708
|
+
else {
|
|
6709
|
+
this.state.errorWhileCreating = true;
|
|
6710
|
+
}
|
|
6699
6711
|
}
|
|
6700
6712
|
updateChart(chart) {
|
|
6701
6713
|
this.env.dispatch("UPDATE_CHART", {
|
|
@@ -6721,10 +6733,12 @@
|
|
|
6721
6733
|
labelRange: data ? data.labelRange : "",
|
|
6722
6734
|
type: data ? data.type : "bar",
|
|
6723
6735
|
seriesHasTitle: data ? data.title !== undefined : false,
|
|
6736
|
+
errorWhileCreating: false,
|
|
6724
6737
|
};
|
|
6725
6738
|
}
|
|
6726
6739
|
}
|
|
6727
6740
|
ChartPanel.template = TEMPLATE$c;
|
|
6741
|
+
ChartPanel.style = CSS$c;
|
|
6728
6742
|
ChartPanel.components = { SelectionInput };
|
|
6729
6743
|
|
|
6730
6744
|
const Component$c = owl__namespace.Component;
|
|
@@ -15357,14 +15371,31 @@
|
|
|
15357
15371
|
* */
|
|
15358
15372
|
getCurrentSelection() {
|
|
15359
15373
|
let { startElement, endElement, startSelectionOffset, endSelectionOffset } = this.getStartAndEndSelection();
|
|
15360
|
-
let startSizeBefore = this.
|
|
15361
|
-
let endSizeBefore = this.
|
|
15374
|
+
let startSizeBefore = this.findSelectionIndex(startElement, startSelectionOffset);
|
|
15375
|
+
let endSizeBefore = this.findSelectionIndex(endElement, endSelectionOffset);
|
|
15362
15376
|
return {
|
|
15363
|
-
start: startSizeBefore
|
|
15364
|
-
end: endSizeBefore
|
|
15377
|
+
start: startSizeBefore,
|
|
15378
|
+
end: endSizeBefore,
|
|
15365
15379
|
};
|
|
15366
15380
|
}
|
|
15367
|
-
|
|
15381
|
+
/**
|
|
15382
|
+
* Computes the text 'index' inside this.el based on the currently selected node and its offset.
|
|
15383
|
+
* The selected node is either a Text node or an Element node.
|
|
15384
|
+
*
|
|
15385
|
+
* case 1 -Text node:
|
|
15386
|
+
* the offset is the number of characters from the start of the node. We have to add this offset to the
|
|
15387
|
+
* content length of all previous nodes.
|
|
15388
|
+
*
|
|
15389
|
+
* case 2 - Element node:
|
|
15390
|
+
* the offset is the number of child nodes before the selected node. We have to add the content length of
|
|
15391
|
+
* all the bnodes prior to the selected node as well as the content of the child node before the offset.
|
|
15392
|
+
*
|
|
15393
|
+
* See the MDN documentation for more details.
|
|
15394
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
|
|
15395
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset
|
|
15396
|
+
*
|
|
15397
|
+
*/
|
|
15398
|
+
findSelectionIndex(nodeToFind, nodeOffset) {
|
|
15368
15399
|
let it = this.iterateChildren(this.el);
|
|
15369
15400
|
let usedCharacters = 0;
|
|
15370
15401
|
let current = it.next();
|
|
@@ -15376,6 +15407,19 @@
|
|
|
15376
15407
|
}
|
|
15377
15408
|
current = it.next();
|
|
15378
15409
|
}
|
|
15410
|
+
if (current.value === nodeToFind) {
|
|
15411
|
+
if (!current.value.hasChildNodes()) {
|
|
15412
|
+
usedCharacters += nodeOffset;
|
|
15413
|
+
}
|
|
15414
|
+
else {
|
|
15415
|
+
const children = [...current.value.childNodes].slice(0, nodeOffset);
|
|
15416
|
+
for (const child of children) {
|
|
15417
|
+
if (!child.textContent)
|
|
15418
|
+
continue;
|
|
15419
|
+
usedCharacters += child.textContent.length;
|
|
15420
|
+
}
|
|
15421
|
+
}
|
|
15422
|
+
}
|
|
15379
15423
|
return usedCharacters;
|
|
15380
15424
|
}
|
|
15381
15425
|
getStartAndEndSelection() {
|
|
@@ -17830,9 +17874,9 @@
|
|
|
17830
17874
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
17831
17875
|
|
|
17832
17876
|
|
|
17833
|
-
__info__.version = '14.0.
|
|
17834
|
-
__info__.date = '2023-
|
|
17835
|
-
__info__.hash = '
|
|
17877
|
+
__info__.version = '14.0.3';
|
|
17878
|
+
__info__.date = '2023-04-21T07:27:17.798Z';
|
|
17879
|
+
__info__.hash = '32b98aa';
|
|
17836
17880
|
|
|
17837
17881
|
|
|
17838
17882
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|