@odoo/o-spreadsheet 18.1.14 → 18.1.15
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 +158 -77
- package/dist/o-spreadsheet.d.ts +33 -16
- package/dist/o-spreadsheet.esm.js +158 -77
- package/dist/o-spreadsheet.iife.js +158 -77
- package/dist/o-spreadsheet.iife.min.js +34 -34
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -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 18.1.
|
|
6
|
-
* @date 2025-04-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.15
|
|
6
|
+
* @date 2025-04-14T17:17:30.890Z
|
|
7
|
+
* @hash ddaea83
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -3563,6 +3563,7 @@
|
|
|
3563
3563
|
"CLEAR_FORMATTING",
|
|
3564
3564
|
"SET_BORDER",
|
|
3565
3565
|
"SET_ZONE_BORDERS",
|
|
3566
|
+
"SET_BORDERS_ON_TARGET",
|
|
3566
3567
|
/** CHART */
|
|
3567
3568
|
"CREATE_CHART",
|
|
3568
3569
|
"UPDATE_CHART",
|
|
@@ -6714,6 +6715,7 @@
|
|
|
6714
6715
|
}
|
|
6715
6716
|
|
|
6716
6717
|
class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
6718
|
+
queuedBordersToAdd = {};
|
|
6717
6719
|
copy(data) {
|
|
6718
6720
|
const sheetId = data.sheetId;
|
|
6719
6721
|
if (data.zones.length === 0) {
|
|
@@ -6744,6 +6746,7 @@
|
|
|
6744
6746
|
const { left, top } = zones[0];
|
|
6745
6747
|
this.pasteZone(sheetId, left, top, content.borders);
|
|
6746
6748
|
}
|
|
6749
|
+
this.executeQueuedChanges(sheetId);
|
|
6747
6750
|
}
|
|
6748
6751
|
pasteZone(sheetId, col, row, borders) {
|
|
6749
6752
|
for (const [r, rowBorders] of borders.entries()) {
|
|
@@ -6762,7 +6765,20 @@
|
|
|
6762
6765
|
...targetBorders,
|
|
6763
6766
|
...originBorders,
|
|
6764
6767
|
};
|
|
6765
|
-
|
|
6768
|
+
const borderKey = JSON.stringify(border);
|
|
6769
|
+
if (!this.queuedBordersToAdd[borderKey]) {
|
|
6770
|
+
this.queuedBordersToAdd[borderKey] = [];
|
|
6771
|
+
}
|
|
6772
|
+
this.queuedBordersToAdd[borderKey].push(positionToZone(target));
|
|
6773
|
+
}
|
|
6774
|
+
executeQueuedChanges(pasteSheetTarget) {
|
|
6775
|
+
for (const borderKey in this.queuedBordersToAdd) {
|
|
6776
|
+
const zones = this.queuedBordersToAdd[borderKey];
|
|
6777
|
+
const border = JSON.parse(borderKey);
|
|
6778
|
+
const target = recomputeZones(zones, []);
|
|
6779
|
+
this.dispatch("SET_BORDERS_ON_TARGET", { sheetId: pasteSheetTarget, target, border });
|
|
6780
|
+
}
|
|
6781
|
+
this.queuedBordersToAdd = {};
|
|
6766
6782
|
}
|
|
6767
6783
|
}
|
|
6768
6784
|
|
|
@@ -8701,12 +8717,13 @@
|
|
|
8701
8717
|
}
|
|
8702
8718
|
pasteCf(origin, target, isCutOperation) {
|
|
8703
8719
|
if (origin?.rules && origin.rules.length > 0) {
|
|
8720
|
+
const originZone = positionToZone(origin.position);
|
|
8704
8721
|
const zone = positionToZone(target);
|
|
8705
8722
|
for (const rule of origin.rules) {
|
|
8706
8723
|
const toRemoveZones = [];
|
|
8707
8724
|
if (isCutOperation) {
|
|
8708
8725
|
//remove from current rule
|
|
8709
|
-
toRemoveZones.push(
|
|
8726
|
+
toRemoveZones.push(originZone);
|
|
8710
8727
|
}
|
|
8711
8728
|
if (origin.position.sheetId === target.sheetId) {
|
|
8712
8729
|
this.adaptCFRules(origin.position.sheetId, rule, [zone], toRemoveZones);
|
|
@@ -8820,6 +8837,7 @@
|
|
|
8820
8837
|
pasteDataValidation(origin, target, isCutOperation) {
|
|
8821
8838
|
if (origin) {
|
|
8822
8839
|
const zone = positionToZone(target);
|
|
8840
|
+
const originZone = positionToZone(origin.position);
|
|
8823
8841
|
const rule = origin.rule;
|
|
8824
8842
|
if (!rule) {
|
|
8825
8843
|
const targetRule = this.getters.getValidationRuleForCell(target);
|
|
@@ -8831,7 +8849,7 @@
|
|
|
8831
8849
|
}
|
|
8832
8850
|
const toRemoveZone = [];
|
|
8833
8851
|
if (isCutOperation) {
|
|
8834
|
-
toRemoveZone.push(
|
|
8852
|
+
toRemoveZone.push(originZone);
|
|
8835
8853
|
}
|
|
8836
8854
|
if (origin.position.sheetId === target.sheetId) {
|
|
8837
8855
|
const copyToRule = this.getDataValidationRuleToCopyTo(target.sheetId, rule, false);
|
|
@@ -8891,7 +8909,7 @@
|
|
|
8891
8909
|
continue;
|
|
8892
8910
|
}
|
|
8893
8911
|
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
8894
|
-
rule: dv,
|
|
8912
|
+
rule: { id: dv.id, criterion: dv.criterion, isBlocking: dv.isBlocking },
|
|
8895
8913
|
ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
8896
8914
|
sheetId,
|
|
8897
8915
|
});
|
|
@@ -52871,6 +52889,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52871
52889
|
case "SET_BORDER":
|
|
52872
52890
|
this.setBorder(cmd.sheetId, cmd.col, cmd.row, cmd.border);
|
|
52873
52891
|
break;
|
|
52892
|
+
case "SET_BORDERS_ON_TARGET":
|
|
52893
|
+
for (const zone of cmd.target) {
|
|
52894
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
52895
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
52896
|
+
this.setBorder(cmd.sheetId, col, row, cmd.border);
|
|
52897
|
+
}
|
|
52898
|
+
}
|
|
52899
|
+
}
|
|
52900
|
+
break;
|
|
52874
52901
|
case "SET_ZONE_BORDERS":
|
|
52875
52902
|
if (cmd.border) {
|
|
52876
52903
|
const target = cmd.target.map((zone) => this.getters.expandZone(cmd.sheetId, zone));
|
|
@@ -62597,25 +62624,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62597
62624
|
case "AUTOFILL_AUTO":
|
|
62598
62625
|
this.autofillAuto();
|
|
62599
62626
|
break;
|
|
62600
|
-
case "AUTOFILL_CELL":
|
|
62601
|
-
this.autoFillMerge(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
62602
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
62603
|
-
this.dispatch("UPDATE_CELL", {
|
|
62604
|
-
sheetId,
|
|
62605
|
-
col: cmd.col,
|
|
62606
|
-
row: cmd.row,
|
|
62607
|
-
style: cmd.style || null,
|
|
62608
|
-
content: cmd.content || "",
|
|
62609
|
-
format: cmd.format || "",
|
|
62610
|
-
});
|
|
62611
|
-
this.dispatch("SET_BORDER", {
|
|
62612
|
-
sheetId,
|
|
62613
|
-
col: cmd.col,
|
|
62614
|
-
row: cmd.row,
|
|
62615
|
-
border: cmd.border,
|
|
62616
|
-
});
|
|
62617
|
-
this.autofillCF(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
62618
|
-
this.autofillDV(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
62619
62627
|
}
|
|
62620
62628
|
}
|
|
62621
62629
|
// ---------------------------------------------------------------------------
|
|
@@ -62639,6 +62647,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62639
62647
|
}
|
|
62640
62648
|
const source = this.getters.getSelectedZone();
|
|
62641
62649
|
const target = this.autofillZone;
|
|
62650
|
+
const autofillCellsData = [];
|
|
62642
62651
|
switch (this.direction) {
|
|
62643
62652
|
case "down" /* DIRECTION.DOWN */:
|
|
62644
62653
|
for (let col = source.left; col <= source.right; col++) {
|
|
@@ -62648,7 +62657,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62648
62657
|
}
|
|
62649
62658
|
const generator = this.createGenerator(xcs);
|
|
62650
62659
|
for (let row = target.top; row <= target.bottom; row++) {
|
|
62651
|
-
this.computeNewCell(generator, col, row
|
|
62660
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
62652
62661
|
}
|
|
62653
62662
|
}
|
|
62654
62663
|
break;
|
|
@@ -62660,7 +62669,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62660
62669
|
}
|
|
62661
62670
|
const generator = this.createGenerator(xcs);
|
|
62662
62671
|
for (let row = target.bottom; row >= target.top; row--) {
|
|
62663
|
-
this.computeNewCell(generator, col, row
|
|
62672
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
62664
62673
|
}
|
|
62665
62674
|
}
|
|
62666
62675
|
break;
|
|
@@ -62672,7 +62681,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62672
62681
|
}
|
|
62673
62682
|
const generator = this.createGenerator(xcs);
|
|
62674
62683
|
for (let col = target.right; col >= target.left; col--) {
|
|
62675
|
-
this.computeNewCell(generator, col, row
|
|
62684
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
62676
62685
|
}
|
|
62677
62686
|
}
|
|
62678
62687
|
break;
|
|
@@ -62684,12 +62693,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62684
62693
|
}
|
|
62685
62694
|
const generator = this.createGenerator(xcs);
|
|
62686
62695
|
for (let col = target.left; col <= target.right; col++) {
|
|
62687
|
-
this.computeNewCell(generator, col, row
|
|
62696
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
62688
62697
|
}
|
|
62689
62698
|
}
|
|
62690
62699
|
break;
|
|
62691
62700
|
}
|
|
62692
62701
|
if (apply) {
|
|
62702
|
+
const bordersZones = {};
|
|
62703
|
+
const cfNewRanges = {};
|
|
62704
|
+
const dvNewZones = {};
|
|
62705
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
62706
|
+
for (const data of autofillCellsData) {
|
|
62707
|
+
this.collectBordersData(data, bordersZones);
|
|
62708
|
+
this.autofillMerge(sheetId, data);
|
|
62709
|
+
this.autofillCell(sheetId, data);
|
|
62710
|
+
this.collectConditionalFormatsData(sheetId, data, cfNewRanges);
|
|
62711
|
+
this.collectDataValidationsData(sheetId, data, dvNewZones);
|
|
62712
|
+
}
|
|
62713
|
+
this.autofillBorders(sheetId, bordersZones);
|
|
62714
|
+
this.autofillConditionalFormats(sheetId, cfNewRanges);
|
|
62715
|
+
this.autofillDataValidations(sheetId, dvNewZones);
|
|
62693
62716
|
this.autofillZone = undefined;
|
|
62694
62717
|
this.selection.resizeAnchorZone(this.direction, this.steps);
|
|
62695
62718
|
this.lastCellSelected = {};
|
|
@@ -62698,6 +62721,95 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62698
62721
|
this.tooltip = undefined;
|
|
62699
62722
|
}
|
|
62700
62723
|
}
|
|
62724
|
+
collectBordersData(data, bordersPositions) {
|
|
62725
|
+
const key = JSON.stringify(data.border);
|
|
62726
|
+
if (!(key in bordersPositions)) {
|
|
62727
|
+
bordersPositions[key] = [];
|
|
62728
|
+
}
|
|
62729
|
+
bordersPositions[key].push(positionToZone({ col: data.col, row: data.row }));
|
|
62730
|
+
}
|
|
62731
|
+
collectConditionalFormatsData(sheetId, data, cfNewRanges) {
|
|
62732
|
+
const { originCol, originRow, col, row } = data;
|
|
62733
|
+
const cfsAtOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
62734
|
+
const xc = toXC(col, row);
|
|
62735
|
+
for (const cf of cfsAtOrigin) {
|
|
62736
|
+
if (!(cf.id in cfNewRanges)) {
|
|
62737
|
+
cfNewRanges[cf.id] = [];
|
|
62738
|
+
}
|
|
62739
|
+
cfNewRanges[cf.id].push(xc);
|
|
62740
|
+
}
|
|
62741
|
+
}
|
|
62742
|
+
collectDataValidationsData(sheetId, data, dvNewZones) {
|
|
62743
|
+
const { originCol, originRow, col, row } = data;
|
|
62744
|
+
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
62745
|
+
const dvsAtOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
62746
|
+
if (!dvsAtOrigin) {
|
|
62747
|
+
return;
|
|
62748
|
+
}
|
|
62749
|
+
if (!(dvsAtOrigin.id in dvNewZones)) {
|
|
62750
|
+
dvNewZones[dvsAtOrigin.id] = [];
|
|
62751
|
+
}
|
|
62752
|
+
dvNewZones[dvsAtOrigin.id].push(positionToZone({ col, row }));
|
|
62753
|
+
}
|
|
62754
|
+
autofillCell(sheetId, data) {
|
|
62755
|
+
this.dispatch("UPDATE_CELL", {
|
|
62756
|
+
sheetId,
|
|
62757
|
+
col: data.col,
|
|
62758
|
+
row: data.row,
|
|
62759
|
+
content: data.content || "",
|
|
62760
|
+
style: data.style || null,
|
|
62761
|
+
format: data.format || "",
|
|
62762
|
+
});
|
|
62763
|
+
// Still usefull in odoo ATM to autofill field sync
|
|
62764
|
+
this.dispatch("AUTOFILL_CELL", data);
|
|
62765
|
+
}
|
|
62766
|
+
autofillBorders(sheetId, bordersPositions) {
|
|
62767
|
+
for (const stringifiedBorder in bordersPositions) {
|
|
62768
|
+
const border = stringifiedBorder === "undefined" ? undefined : JSON.parse(stringifiedBorder);
|
|
62769
|
+
this.dispatch("SET_BORDERS_ON_TARGET", {
|
|
62770
|
+
sheetId,
|
|
62771
|
+
border,
|
|
62772
|
+
target: recomputeZones(bordersPositions[stringifiedBorder]),
|
|
62773
|
+
});
|
|
62774
|
+
}
|
|
62775
|
+
}
|
|
62776
|
+
autofillConditionalFormats(sheetId, cfNewRanges) {
|
|
62777
|
+
for (const cfId in cfNewRanges) {
|
|
62778
|
+
const changes = cfNewRanges[cfId];
|
|
62779
|
+
const cf = this.getters.getConditionalFormats(sheetId).find((cf) => cf.id === cfId);
|
|
62780
|
+
if (!cf) {
|
|
62781
|
+
continue;
|
|
62782
|
+
}
|
|
62783
|
+
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, changes.map(toZone), []);
|
|
62784
|
+
if (newCfRanges) {
|
|
62785
|
+
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
62786
|
+
cf: {
|
|
62787
|
+
id: cf.id,
|
|
62788
|
+
rule: cf.rule,
|
|
62789
|
+
stopIfTrue: cf.stopIfTrue,
|
|
62790
|
+
},
|
|
62791
|
+
ranges: newCfRanges,
|
|
62792
|
+
sheetId,
|
|
62793
|
+
});
|
|
62794
|
+
}
|
|
62795
|
+
}
|
|
62796
|
+
}
|
|
62797
|
+
autofillDataValidations(sheetId, dvNewZones) {
|
|
62798
|
+
for (const dvId in dvNewZones) {
|
|
62799
|
+
const changes = dvNewZones[dvId];
|
|
62800
|
+
const dvOrigin = this.getters.getDataValidationRule(sheetId, dvId);
|
|
62801
|
+
if (!dvOrigin) {
|
|
62802
|
+
continue;
|
|
62803
|
+
}
|
|
62804
|
+
const dvRangesXcs = dvOrigin.ranges.map((range) => range.zone);
|
|
62805
|
+
const newDvRanges = recomputeZones(dvRangesXcs.concat(changes), []);
|
|
62806
|
+
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
62807
|
+
rule: dvOrigin,
|
|
62808
|
+
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
62809
|
+
sheetId,
|
|
62810
|
+
});
|
|
62811
|
+
}
|
|
62812
|
+
}
|
|
62701
62813
|
/**
|
|
62702
62814
|
* Select a cell which becomes the last cell of the autofillZone
|
|
62703
62815
|
*/
|
|
@@ -62776,22 +62888,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62776
62888
|
/**
|
|
62777
62889
|
* Generate the next cell
|
|
62778
62890
|
*/
|
|
62779
|
-
computeNewCell(generator, col, row
|
|
62891
|
+
computeNewCell(generator, col, row) {
|
|
62780
62892
|
const { cellData, tooltip, origin } = generator.next();
|
|
62781
62893
|
const { content, style, border, format } = cellData;
|
|
62782
62894
|
this.tooltip = tooltip;
|
|
62783
|
-
|
|
62784
|
-
|
|
62785
|
-
|
|
62786
|
-
|
|
62787
|
-
|
|
62788
|
-
|
|
62789
|
-
|
|
62790
|
-
|
|
62791
|
-
|
|
62792
|
-
|
|
62793
|
-
});
|
|
62794
|
-
}
|
|
62895
|
+
return {
|
|
62896
|
+
originCol: origin.col,
|
|
62897
|
+
originRow: origin.row,
|
|
62898
|
+
col,
|
|
62899
|
+
row,
|
|
62900
|
+
content,
|
|
62901
|
+
style,
|
|
62902
|
+
border,
|
|
62903
|
+
format,
|
|
62904
|
+
};
|
|
62795
62905
|
}
|
|
62796
62906
|
/**
|
|
62797
62907
|
* Get the rule associated to the current cell
|
|
@@ -62859,8 +62969,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62859
62969
|
? position[first].value
|
|
62860
62970
|
: position[second].value;
|
|
62861
62971
|
}
|
|
62862
|
-
|
|
62863
|
-
const
|
|
62972
|
+
autofillMerge(sheetId, data) {
|
|
62973
|
+
const { originCol, originRow, col, row } = data;
|
|
62864
62974
|
const position = { sheetId, col, row };
|
|
62865
62975
|
const originPosition = { sheetId, col: originCol, row: originRow };
|
|
62866
62976
|
if (this.getters.isInMerge(position) && !this.getters.isInMerge(originPosition)) {
|
|
@@ -62887,35 +62997,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
62887
62997
|
});
|
|
62888
62998
|
}
|
|
62889
62999
|
}
|
|
62890
|
-
autofillCF(originCol, originRow, col, row) {
|
|
62891
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
62892
|
-
const cfOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
62893
|
-
for (const cf of cfOrigin) {
|
|
62894
|
-
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, [positionToZone({ col, row })], []);
|
|
62895
|
-
if (newCfRanges) {
|
|
62896
|
-
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
62897
|
-
cf: deepCopy(cf),
|
|
62898
|
-
ranges: newCfRanges,
|
|
62899
|
-
sheetId,
|
|
62900
|
-
});
|
|
62901
|
-
}
|
|
62902
|
-
}
|
|
62903
|
-
}
|
|
62904
|
-
autofillDV(originCol, originRow, col, row) {
|
|
62905
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
62906
|
-
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
62907
|
-
const dvOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
62908
|
-
if (!dvOrigin) {
|
|
62909
|
-
return;
|
|
62910
|
-
}
|
|
62911
|
-
const dvRangesZones = dvOrigin.ranges.map((range) => range.zone);
|
|
62912
|
-
const newDvRanges = recomputeZones(dvRangesZones.concat(positionToZone({ col, row })), []);
|
|
62913
|
-
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
62914
|
-
rule: dvOrigin,
|
|
62915
|
-
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
62916
|
-
sheetId,
|
|
62917
|
-
});
|
|
62918
|
-
}
|
|
62919
63000
|
// ---------------------------------------------------------------------------
|
|
62920
63001
|
// Grid rendering
|
|
62921
63002
|
// ---------------------------------------------------------------------------
|
|
@@ -75644,9 +75725,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
75644
75725
|
exports.tokenize = tokenize;
|
|
75645
75726
|
|
|
75646
75727
|
|
|
75647
|
-
__info__.version = "18.1.
|
|
75648
|
-
__info__.date = "2025-04-
|
|
75649
|
-
__info__.hash = "
|
|
75728
|
+
__info__.version = "18.1.15";
|
|
75729
|
+
__info__.date = "2025-04-14T17:17:30.890Z";
|
|
75730
|
+
__info__.hash = "ddaea83";
|
|
75650
75731
|
|
|
75651
75732
|
|
|
75652
75733
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|