@odoo/o-spreadsheet 16.0.9 → 16.0.11
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 +77 -54
- package/dist/o-spreadsheet.d.ts +10 -11
- package/dist/o-spreadsheet.esm.js +77 -54
- package/dist/o-spreadsheet.iife.js +77 -54
- package/dist/o-spreadsheet.iife.min.js +162 -145
- package/package.json +1 -1
|
@@ -6413,6 +6413,12 @@ css /* scss */ `
|
|
|
6413
6413
|
height: 25px;
|
|
6414
6414
|
}
|
|
6415
6415
|
}
|
|
6416
|
+
/** Make the character a bit bigger
|
|
6417
|
+
compared to its neighbor INPUT box */
|
|
6418
|
+
.o-remove-selection {
|
|
6419
|
+
font-weight: bold;
|
|
6420
|
+
font-size: calc(100% + 4px);
|
|
6421
|
+
}
|
|
6416
6422
|
}
|
|
6417
6423
|
`;
|
|
6418
6424
|
/**
|
|
@@ -6489,6 +6495,9 @@ class SelectionInput extends Component {
|
|
|
6489
6495
|
(_b = (_a = this.props).onSelectionChanged) === null || _b === void 0 ? void 0 : _b.call(_a, ranges);
|
|
6490
6496
|
this.previousRanges = ranges;
|
|
6491
6497
|
}
|
|
6498
|
+
extractRanges(value) {
|
|
6499
|
+
return this.props.hasSingleRange ? value.split(",")[0] : value;
|
|
6500
|
+
}
|
|
6492
6501
|
focus(rangeId) {
|
|
6493
6502
|
this.state.isMissing = false;
|
|
6494
6503
|
this.env.model.dispatch("FOCUS_RANGE", {
|
|
@@ -6507,15 +6516,16 @@ class SelectionInput extends Component {
|
|
|
6507
6516
|
}
|
|
6508
6517
|
onInputChanged(rangeId, ev) {
|
|
6509
6518
|
const target = ev.target;
|
|
6519
|
+
const value = this.extractRanges(target.value);
|
|
6510
6520
|
this.env.model.dispatch("CHANGE_RANGE", {
|
|
6511
6521
|
id: this.id,
|
|
6512
6522
|
rangeId,
|
|
6513
|
-
value
|
|
6523
|
+
value,
|
|
6514
6524
|
});
|
|
6515
6525
|
target.blur();
|
|
6516
6526
|
this.triggerChange();
|
|
6517
6527
|
}
|
|
6518
|
-
|
|
6528
|
+
confirm() {
|
|
6519
6529
|
var _a, _b;
|
|
6520
6530
|
this.env.model.dispatch("UNFOCUS_SELECTION_INPUT");
|
|
6521
6531
|
const ranges = this.env.model.getters.getSelectionInputValue(this.id);
|
|
@@ -6564,7 +6574,7 @@ class LineBarPieConfigPanel extends Component {
|
|
|
6564
6574
|
return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(32 /* CommandResult.InvalidLabelRange */));
|
|
6565
6575
|
}
|
|
6566
6576
|
onUpdateDataSetsHaveTitle(ev) {
|
|
6567
|
-
this.props.updateChart({
|
|
6577
|
+
this.props.updateChart(this.props.figureId, {
|
|
6568
6578
|
dataSetsHaveTitle: ev.target.checked,
|
|
6569
6579
|
});
|
|
6570
6580
|
}
|
|
@@ -6576,7 +6586,7 @@ class LineBarPieConfigPanel extends Component {
|
|
|
6576
6586
|
this.dataSeriesRanges = ranges;
|
|
6577
6587
|
}
|
|
6578
6588
|
onDataSeriesConfirmed() {
|
|
6579
|
-
this.state.datasetDispatchResult = this.props.updateChart({
|
|
6589
|
+
this.state.datasetDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
6580
6590
|
dataSets: this.dataSeriesRanges,
|
|
6581
6591
|
});
|
|
6582
6592
|
}
|
|
@@ -6588,7 +6598,7 @@ class LineBarPieConfigPanel extends Component {
|
|
|
6588
6598
|
this.labelRange = ranges[0];
|
|
6589
6599
|
}
|
|
6590
6600
|
onLabelRangeConfirmed() {
|
|
6591
|
-
this.state.labelsDispatchResult = this.props.updateChart({
|
|
6601
|
+
this.state.labelsDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
6592
6602
|
labelRange: this.labelRange,
|
|
6593
6603
|
});
|
|
6594
6604
|
}
|
|
@@ -6598,7 +6608,7 @@ LineBarPieConfigPanel.components = { SelectionInput };
|
|
|
6598
6608
|
|
|
6599
6609
|
class BarConfigPanel extends LineBarPieConfigPanel {
|
|
6600
6610
|
onUpdateStacked(ev) {
|
|
6601
|
-
this.props.updateChart({
|
|
6611
|
+
this.props.updateChart(this.props.figureId, {
|
|
6602
6612
|
stacked: ev.target.checked,
|
|
6603
6613
|
});
|
|
6604
6614
|
}
|
|
@@ -8346,6 +8356,18 @@ css /* scss */ `
|
|
|
8346
8356
|
grid-template-columns: repeat(${ITEMS_PER_LINE}, 1fr);
|
|
8347
8357
|
grid-gap: ${ITEM_HORIZONTAL_MARGIN * 2}px;
|
|
8348
8358
|
}
|
|
8359
|
+
.o-color-picker-toggler {
|
|
8360
|
+
display: flex;
|
|
8361
|
+
.o-color-picker-toggler-sign {
|
|
8362
|
+
margin: auto auto;
|
|
8363
|
+
width: 55%;
|
|
8364
|
+
height: 55%;
|
|
8365
|
+
.o-icon {
|
|
8366
|
+
width: 100%;
|
|
8367
|
+
height: 100%;
|
|
8368
|
+
}
|
|
8369
|
+
}
|
|
8370
|
+
}
|
|
8349
8371
|
.o-color-picker-line-item {
|
|
8350
8372
|
width: ${ITEM_EDGE_LENGTH}px;
|
|
8351
8373
|
height: ${ITEM_EDGE_LENGTH}px;
|
|
@@ -8562,17 +8584,17 @@ class LineBarPieDesignPanel extends Component {
|
|
|
8562
8584
|
this.state.fillColorTool = !this.state.fillColorTool;
|
|
8563
8585
|
}
|
|
8564
8586
|
updateBackgroundColor(color) {
|
|
8565
|
-
this.props.updateChart({
|
|
8587
|
+
this.props.updateChart(this.props.figureId, {
|
|
8566
8588
|
background: color,
|
|
8567
8589
|
});
|
|
8568
8590
|
}
|
|
8569
8591
|
updateTitle(ev) {
|
|
8570
|
-
this.props.updateChart({
|
|
8592
|
+
this.props.updateChart(this.props.figureId, {
|
|
8571
8593
|
title: ev.target.value,
|
|
8572
8594
|
});
|
|
8573
8595
|
}
|
|
8574
8596
|
updateSelect(attr, ev) {
|
|
8575
|
-
this.props.updateChart({
|
|
8597
|
+
this.props.updateChart(this.props.figureId, {
|
|
8576
8598
|
[attr]: ev.target.value,
|
|
8577
8599
|
});
|
|
8578
8600
|
}
|
|
@@ -8605,7 +8627,7 @@ class GaugeChartConfigPanel extends Component {
|
|
|
8605
8627
|
this.dataRange = ranges[0];
|
|
8606
8628
|
}
|
|
8607
8629
|
updateDataRange() {
|
|
8608
|
-
this.state.dataRangeDispatchResult = this.props.updateChart({
|
|
8630
|
+
this.state.dataRangeDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
8609
8631
|
dataRange: this.dataRange,
|
|
8610
8632
|
});
|
|
8611
8633
|
}
|
|
@@ -8675,12 +8697,12 @@ class GaugeChartDesignPanel extends Component {
|
|
|
8675
8697
|
}
|
|
8676
8698
|
updateBackgroundColor(color) {
|
|
8677
8699
|
this.state.openedMenu = undefined;
|
|
8678
|
-
this.props.updateChart({
|
|
8700
|
+
this.props.updateChart(this.props.figureId, {
|
|
8679
8701
|
background: color,
|
|
8680
8702
|
});
|
|
8681
8703
|
}
|
|
8682
8704
|
updateTitle(ev) {
|
|
8683
|
-
this.props.updateChart({
|
|
8705
|
+
this.props.updateChart(this.props.figureId, {
|
|
8684
8706
|
title: ev.target.value,
|
|
8685
8707
|
});
|
|
8686
8708
|
}
|
|
@@ -8749,7 +8771,7 @@ class GaugeChartDesignPanel extends Component {
|
|
|
8749
8771
|
}
|
|
8750
8772
|
}
|
|
8751
8773
|
updateSectionRule(sectionRule) {
|
|
8752
|
-
this.state.sectionRuleDispatchResult = this.props.updateChart({
|
|
8774
|
+
this.state.sectionRuleDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
8753
8775
|
sectionRule,
|
|
8754
8776
|
});
|
|
8755
8777
|
}
|
|
@@ -8769,12 +8791,12 @@ class LineConfigPanel extends LineBarPieConfigPanel {
|
|
|
8769
8791
|
return false;
|
|
8770
8792
|
}
|
|
8771
8793
|
onUpdateLabelsAsText(ev) {
|
|
8772
|
-
this.props.updateChart({
|
|
8794
|
+
this.props.updateChart(this.props.figureId, {
|
|
8773
8795
|
labelsAsText: ev.target.checked,
|
|
8774
8796
|
});
|
|
8775
8797
|
}
|
|
8776
8798
|
onUpdateStacked(ev) {
|
|
8777
|
-
this.props.updateChart({
|
|
8799
|
+
this.props.updateChart(this.props.figureId, {
|
|
8778
8800
|
stacked: ev.target.checked,
|
|
8779
8801
|
});
|
|
8780
8802
|
}
|
|
@@ -8815,7 +8837,7 @@ class ScorecardChartConfigPanel extends Component {
|
|
|
8815
8837
|
this.keyValue = ranges[0];
|
|
8816
8838
|
}
|
|
8817
8839
|
updateKeyValueRange() {
|
|
8818
|
-
this.state.keyValueDispatchResult = this.props.updateChart({
|
|
8840
|
+
this.state.keyValueDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
8819
8841
|
keyValue: this.keyValue,
|
|
8820
8842
|
});
|
|
8821
8843
|
}
|
|
@@ -8823,12 +8845,12 @@ class ScorecardChartConfigPanel extends Component {
|
|
|
8823
8845
|
this.baseline = ranges[0];
|
|
8824
8846
|
}
|
|
8825
8847
|
updateBaselineRange() {
|
|
8826
|
-
this.state.baselineDispatchResult = this.props.updateChart({
|
|
8848
|
+
this.state.baselineDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
8827
8849
|
baseline: this.baseline,
|
|
8828
8850
|
});
|
|
8829
8851
|
}
|
|
8830
8852
|
updateBaselineMode(ev) {
|
|
8831
|
-
this.props.updateChart({ baselineMode: ev.target.value });
|
|
8853
|
+
this.props.updateChart(this.props.figureId, { baselineMode: ev.target.value });
|
|
8832
8854
|
}
|
|
8833
8855
|
}
|
|
8834
8856
|
ScorecardChartConfigPanel.template = "o-spreadsheet-ScorecardChartConfigPanel";
|
|
@@ -8848,12 +8870,12 @@ class ScorecardChartDesignPanel extends Component {
|
|
|
8848
8870
|
useExternalListener(window, "click", this.onClick);
|
|
8849
8871
|
}
|
|
8850
8872
|
updateTitle(ev) {
|
|
8851
|
-
this.props.updateChart({
|
|
8873
|
+
this.props.updateChart(this.props.figureId, {
|
|
8852
8874
|
title: ev.target.value,
|
|
8853
8875
|
});
|
|
8854
8876
|
}
|
|
8855
8877
|
updateBaselineDescr(ev) {
|
|
8856
|
-
this.props.updateChart({ baselineDescr: ev.target.value });
|
|
8878
|
+
this.props.updateChart(this.props.figureId, { baselineDescr: ev.target.value });
|
|
8857
8879
|
}
|
|
8858
8880
|
openColorPicker(colorPickerId) {
|
|
8859
8881
|
this.state.openedColorPicker = colorPickerId;
|
|
@@ -8861,13 +8883,13 @@ class ScorecardChartDesignPanel extends Component {
|
|
|
8861
8883
|
setColor(color, colorPickerId) {
|
|
8862
8884
|
switch (colorPickerId) {
|
|
8863
8885
|
case "backgroundColor":
|
|
8864
|
-
this.props.updateChart({ background: color });
|
|
8886
|
+
this.props.updateChart(this.props.figureId, { background: color });
|
|
8865
8887
|
break;
|
|
8866
8888
|
case "baselineColorDown":
|
|
8867
|
-
this.props.updateChart({ baselineColorDown: color });
|
|
8889
|
+
this.props.updateChart(this.props.figureId, { baselineColorDown: color });
|
|
8868
8890
|
break;
|
|
8869
8891
|
case "baselineColorUp":
|
|
8870
|
-
this.props.updateChart({ baselineColorUp: color });
|
|
8892
|
+
this.props.updateChart(this.props.figureId, { baselineColorUp: color });
|
|
8871
8893
|
break;
|
|
8872
8894
|
}
|
|
8873
8895
|
this.state.openedColorPicker = undefined;
|
|
@@ -8931,16 +8953,9 @@ css /* scss */ `
|
|
|
8931
8953
|
}
|
|
8932
8954
|
`;
|
|
8933
8955
|
class ChartPanel extends Component {
|
|
8934
|
-
constructor() {
|
|
8935
|
-
super(...arguments);
|
|
8936
|
-
this.shouldUpdateChart = true;
|
|
8937
|
-
}
|
|
8938
8956
|
get figureId() {
|
|
8939
8957
|
return this.state.figureId;
|
|
8940
8958
|
}
|
|
8941
|
-
get sheetId() {
|
|
8942
|
-
return this.state.sheetId;
|
|
8943
|
-
}
|
|
8944
8959
|
setup() {
|
|
8945
8960
|
const selectedFigureId = this.env.model.getters.getSelectedFigureId();
|
|
8946
8961
|
if (!selectedFigureId) {
|
|
@@ -8949,17 +8964,11 @@ class ChartPanel extends Component {
|
|
|
8949
8964
|
this.state = useState({
|
|
8950
8965
|
panel: "configuration",
|
|
8951
8966
|
figureId: selectedFigureId,
|
|
8952
|
-
sheetId: this.env.model.getters.getActiveSheetId(),
|
|
8953
8967
|
});
|
|
8954
8968
|
onWillUpdateProps(() => {
|
|
8955
8969
|
const selectedFigureId = this.env.model.getters.getSelectedFigureId();
|
|
8956
8970
|
if (selectedFigureId && selectedFigureId !== this.state.figureId) {
|
|
8957
8971
|
this.state.figureId = selectedFigureId;
|
|
8958
|
-
this.state.sheetId = this.env.model.getters.getActiveSheetId();
|
|
8959
|
-
this.shouldUpdateChart = false;
|
|
8960
|
-
}
|
|
8961
|
-
else {
|
|
8962
|
-
this.shouldUpdateChart = true;
|
|
8963
8972
|
}
|
|
8964
8973
|
if (!this.env.model.getters.isChartDefined(this.figureId)) {
|
|
8965
8974
|
this.props.onCloseSidePanel();
|
|
@@ -8967,8 +8976,8 @@ class ChartPanel extends Component {
|
|
|
8967
8976
|
}
|
|
8968
8977
|
});
|
|
8969
8978
|
}
|
|
8970
|
-
updateChart(updateDefinition) {
|
|
8971
|
-
if (
|
|
8979
|
+
updateChart(figureId, updateDefinition) {
|
|
8980
|
+
if (figureId !== this.figureId) {
|
|
8972
8981
|
return;
|
|
8973
8982
|
}
|
|
8974
8983
|
const definition = {
|
|
@@ -8977,8 +8986,8 @@ class ChartPanel extends Component {
|
|
|
8977
8986
|
};
|
|
8978
8987
|
return this.env.model.dispatch("UPDATE_CHART", {
|
|
8979
8988
|
definition,
|
|
8980
|
-
id:
|
|
8981
|
-
sheetId: this.
|
|
8989
|
+
id: figureId,
|
|
8990
|
+
sheetId: this.env.model.getters.getFigureSheetId(figureId),
|
|
8982
8991
|
});
|
|
8983
8992
|
}
|
|
8984
8993
|
onTypeChange(type) {
|
|
@@ -8990,7 +8999,7 @@ class ChartPanel extends Component {
|
|
|
8990
8999
|
this.env.model.dispatch("UPDATE_CHART", {
|
|
8991
9000
|
definition,
|
|
8992
9001
|
id: this.figureId,
|
|
8993
|
-
sheetId: this.
|
|
9002
|
+
sheetId: this.env.model.getters.getFigureSheetId(this.figureId),
|
|
8994
9003
|
});
|
|
8995
9004
|
}
|
|
8996
9005
|
get chartPanel() {
|
|
@@ -32477,7 +32486,7 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
32477
32486
|
// magic "empty" value
|
|
32478
32487
|
// Returning {value: null} instead of undefined will ensure that we don't
|
|
32479
32488
|
// fall back on the default value of the argument provided to the formula's compute function
|
|
32480
|
-
return { value: null };
|
|
32489
|
+
return { value: null, format: cell === null || cell === void 0 ? void 0 : cell.format };
|
|
32481
32490
|
}
|
|
32482
32491
|
return getEvaluatedCell(cell);
|
|
32483
32492
|
}
|
|
@@ -34892,6 +34901,9 @@ const uuidGenerator = new UuidGenerator();
|
|
|
34892
34901
|
*/
|
|
34893
34902
|
class SelectionInputPlugin extends UIPlugin {
|
|
34894
34903
|
constructor(getters, state, dispatch, config, selection, initialRanges, inputHasSingleRange) {
|
|
34904
|
+
if (inputHasSingleRange && initialRanges.length > 1) {
|
|
34905
|
+
throw new Error("Input with a single range cannot be instantiated with several range references.");
|
|
34906
|
+
}
|
|
34895
34907
|
super(getters, state, dispatch, config, selection);
|
|
34896
34908
|
this.inputHasSingleRange = inputHasSingleRange;
|
|
34897
34909
|
this.ranges = [];
|
|
@@ -34914,6 +34926,11 @@ class SelectionInputPlugin extends UIPlugin {
|
|
|
34914
34926
|
return 29 /* CommandResult.MaximumRangesReached */;
|
|
34915
34927
|
}
|
|
34916
34928
|
break;
|
|
34929
|
+
case "CHANGE_RANGE":
|
|
34930
|
+
if (this.inputHasSingleRange && cmd.value.split(",").length > 1) {
|
|
34931
|
+
return 29 /* CommandResult.MaximumRangesReached */;
|
|
34932
|
+
}
|
|
34933
|
+
break;
|
|
34917
34934
|
}
|
|
34918
34935
|
return 0 /* CommandResult.Success */;
|
|
34919
34936
|
}
|
|
@@ -35727,13 +35744,9 @@ class Session extends EventBus {
|
|
|
35727
35744
|
}
|
|
35728
35745
|
loadInitialMessages(messages) {
|
|
35729
35746
|
this.isReplayingInitialRevisions = true;
|
|
35730
|
-
this.on("unexpected-revision-id", this, ({ revisionId }) => {
|
|
35731
|
-
throw new Error(`The spreadsheet could not be loaded. Revision ${revisionId} is corrupted.`);
|
|
35732
|
-
});
|
|
35733
35747
|
for (const message of messages) {
|
|
35734
35748
|
this.onMessageReceived(message);
|
|
35735
35749
|
}
|
|
35736
|
-
this.off("unexpected-revision-id", this);
|
|
35737
35750
|
this.isReplayingInitialRevisions = false;
|
|
35738
35751
|
}
|
|
35739
35752
|
/**
|
|
@@ -35805,6 +35818,10 @@ class Session extends EventBus {
|
|
|
35805
35818
|
onMessageReceived(message) {
|
|
35806
35819
|
if (this.isAlreadyProcessed(message))
|
|
35807
35820
|
return;
|
|
35821
|
+
if (this.isWrongServerRevisionId(message)) {
|
|
35822
|
+
this.trigger("unexpected-revision-id");
|
|
35823
|
+
return;
|
|
35824
|
+
}
|
|
35808
35825
|
switch (message.type) {
|
|
35809
35826
|
case "CLIENT_MOVED":
|
|
35810
35827
|
this.onClientMoved(message);
|
|
@@ -35831,10 +35848,6 @@ class Session extends EventBus {
|
|
|
35831
35848
|
});
|
|
35832
35849
|
break;
|
|
35833
35850
|
case "REMOTE_REVISION":
|
|
35834
|
-
if (message.serverRevisionId !== this.serverRevisionId) {
|
|
35835
|
-
this.trigger("unexpected-revision-id", { revisionId: message.serverRevisionId });
|
|
35836
|
-
return;
|
|
35837
|
-
}
|
|
35838
35851
|
const { clientId, commands } = message;
|
|
35839
35852
|
const revision = new Revision(message.nextRevisionId, clientId, commands);
|
|
35840
35853
|
if (revision.clientId !== this.clientId) {
|
|
@@ -35966,6 +35979,17 @@ class Session extends EventBus {
|
|
|
35966
35979
|
return false;
|
|
35967
35980
|
}
|
|
35968
35981
|
}
|
|
35982
|
+
isWrongServerRevisionId(message) {
|
|
35983
|
+
switch (message.type) {
|
|
35984
|
+
case "REMOTE_REVISION":
|
|
35985
|
+
case "REVISION_REDONE":
|
|
35986
|
+
case "REVISION_UNDONE":
|
|
35987
|
+
case "SNAPSHOT_CREATED":
|
|
35988
|
+
return message.serverRevisionId !== this.serverRevisionId;
|
|
35989
|
+
default:
|
|
35990
|
+
return false;
|
|
35991
|
+
}
|
|
35992
|
+
}
|
|
35969
35993
|
dropPendingHistoryMessages() {
|
|
35970
35994
|
this.waitingUndoRedoAck = false;
|
|
35971
35995
|
this.pendingMessages = this.pendingMessages.filter(({ type }) => type !== "REVISION_REDONE" && type !== "REVISION_UNDONE");
|
|
@@ -37929,7 +37953,6 @@ css /* scss */ `
|
|
|
37929
37953
|
color: dimgrey;
|
|
37930
37954
|
}
|
|
37931
37955
|
.o-sidePanelClose {
|
|
37932
|
-
font-size: 1.5rem;
|
|
37933
37956
|
padding: 5px 10px;
|
|
37934
37957
|
cursor: pointer;
|
|
37935
37958
|
&:hover {
|
|
@@ -42747,6 +42770,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
42747
42770
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
42748
42771
|
|
|
42749
42772
|
|
|
42750
|
-
__info__.version = '16.0.
|
|
42751
|
-
__info__.date = '2023-
|
|
42752
|
-
__info__.hash = '
|
|
42773
|
+
__info__.version = '16.0.11';
|
|
42774
|
+
__info__.date = '2023-05-25T12:57:28.152Z';
|
|
42775
|
+
__info__.hash = 'd27e998';
|