@odoo/o-spreadsheet 18.0.22 → 18.0.23
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 +3 -3
- 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.0.
|
|
6
|
-
* @date 2025-04-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.23
|
|
6
|
+
* @date 2025-04-14T17:16:35.374Z
|
|
7
|
+
* @hash f560133
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -3397,6 +3397,7 @@ const coreTypes = new Set([
|
|
|
3397
3397
|
"CLEAR_FORMATTING",
|
|
3398
3398
|
"SET_BORDER",
|
|
3399
3399
|
"SET_ZONE_BORDERS",
|
|
3400
|
+
"SET_BORDERS_ON_TARGET",
|
|
3400
3401
|
/** CHART */
|
|
3401
3402
|
"CREATE_CHART",
|
|
3402
3403
|
"UPDATE_CHART",
|
|
@@ -6560,6 +6561,7 @@ class AbstractCellClipboardHandler extends ClipboardHandler {
|
|
|
6560
6561
|
}
|
|
6561
6562
|
|
|
6562
6563
|
class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
6564
|
+
queuedBordersToAdd = {};
|
|
6563
6565
|
copy(data) {
|
|
6564
6566
|
const sheetId = data.sheetId;
|
|
6565
6567
|
if (data.zones.length === 0) {
|
|
@@ -6590,6 +6592,7 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
6590
6592
|
const { left, top } = zones[0];
|
|
6591
6593
|
this.pasteZone(sheetId, left, top, content.borders);
|
|
6592
6594
|
}
|
|
6595
|
+
this.executeQueuedChanges(sheetId);
|
|
6593
6596
|
}
|
|
6594
6597
|
pasteZone(sheetId, col, row, borders) {
|
|
6595
6598
|
for (const [r, rowBorders] of borders.entries()) {
|
|
@@ -6608,7 +6611,20 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
6608
6611
|
...targetBorders,
|
|
6609
6612
|
...originBorders,
|
|
6610
6613
|
};
|
|
6611
|
-
|
|
6614
|
+
const borderKey = JSON.stringify(border);
|
|
6615
|
+
if (!this.queuedBordersToAdd[borderKey]) {
|
|
6616
|
+
this.queuedBordersToAdd[borderKey] = [];
|
|
6617
|
+
}
|
|
6618
|
+
this.queuedBordersToAdd[borderKey].push(positionToZone(target));
|
|
6619
|
+
}
|
|
6620
|
+
executeQueuedChanges(pasteSheetTarget) {
|
|
6621
|
+
for (const borderKey in this.queuedBordersToAdd) {
|
|
6622
|
+
const zones = this.queuedBordersToAdd[borderKey];
|
|
6623
|
+
const border = JSON.parse(borderKey);
|
|
6624
|
+
const target = recomputeZones(zones, []);
|
|
6625
|
+
this.dispatch("SET_BORDERS_ON_TARGET", { sheetId: pasteSheetTarget, target, border });
|
|
6626
|
+
}
|
|
6627
|
+
this.queuedBordersToAdd = {};
|
|
6612
6628
|
}
|
|
6613
6629
|
}
|
|
6614
6630
|
|
|
@@ -8500,12 +8516,13 @@ class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8500
8516
|
}
|
|
8501
8517
|
pasteCf(origin, target, isCutOperation) {
|
|
8502
8518
|
if (origin?.rules && origin.rules.length > 0) {
|
|
8519
|
+
const originZone = positionToZone(origin.position);
|
|
8503
8520
|
const zone = positionToZone(target);
|
|
8504
8521
|
for (const rule of origin.rules) {
|
|
8505
8522
|
const toRemoveZones = [];
|
|
8506
8523
|
if (isCutOperation) {
|
|
8507
8524
|
//remove from current rule
|
|
8508
|
-
toRemoveZones.push(
|
|
8525
|
+
toRemoveZones.push(originZone);
|
|
8509
8526
|
}
|
|
8510
8527
|
if (origin.position.sheetId === target.sheetId) {
|
|
8511
8528
|
this.adaptCFRules(origin.position.sheetId, rule, [zone], toRemoveZones);
|
|
@@ -8619,6 +8636,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8619
8636
|
pasteDataValidation(origin, target, isCutOperation) {
|
|
8620
8637
|
if (origin) {
|
|
8621
8638
|
const zone = positionToZone(target);
|
|
8639
|
+
const originZone = positionToZone(origin.position);
|
|
8622
8640
|
const rule = origin.rule;
|
|
8623
8641
|
if (!rule) {
|
|
8624
8642
|
const targetRule = this.getters.getValidationRuleForCell(target);
|
|
@@ -8630,7 +8648,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8630
8648
|
}
|
|
8631
8649
|
const toRemoveZone = [];
|
|
8632
8650
|
if (isCutOperation) {
|
|
8633
|
-
toRemoveZone.push(
|
|
8651
|
+
toRemoveZone.push(originZone);
|
|
8634
8652
|
}
|
|
8635
8653
|
if (origin.position.sheetId === target.sheetId) {
|
|
8636
8654
|
const copyToRule = this.getDataValidationRuleToCopyTo(target.sheetId, rule, false);
|
|
@@ -8690,7 +8708,7 @@ class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
8690
8708
|
continue;
|
|
8691
8709
|
}
|
|
8692
8710
|
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
8693
|
-
rule: dv,
|
|
8711
|
+
rule: { id: dv.id, criterion: dv.criterion, isBlocking: dv.isBlocking },
|
|
8694
8712
|
ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
8695
8713
|
sheetId,
|
|
8696
8714
|
});
|
|
@@ -50791,6 +50809,15 @@ class BordersPlugin extends CorePlugin {
|
|
|
50791
50809
|
case "SET_BORDER":
|
|
50792
50810
|
this.setBorder(cmd.sheetId, cmd.col, cmd.row, cmd.border);
|
|
50793
50811
|
break;
|
|
50812
|
+
case "SET_BORDERS_ON_TARGET":
|
|
50813
|
+
for (const zone of cmd.target) {
|
|
50814
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
50815
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
50816
|
+
this.setBorder(cmd.sheetId, col, row, cmd.border);
|
|
50817
|
+
}
|
|
50818
|
+
}
|
|
50819
|
+
}
|
|
50820
|
+
break;
|
|
50794
50821
|
case "SET_ZONE_BORDERS":
|
|
50795
50822
|
if (cmd.border) {
|
|
50796
50823
|
const target = cmd.target.map((zone) => this.getters.expandZone(cmd.sheetId, zone));
|
|
@@ -60609,25 +60636,6 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60609
60636
|
case "AUTOFILL_AUTO":
|
|
60610
60637
|
this.autofillAuto();
|
|
60611
60638
|
break;
|
|
60612
|
-
case "AUTOFILL_CELL":
|
|
60613
|
-
this.autoFillMerge(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
60614
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
60615
|
-
this.dispatch("UPDATE_CELL", {
|
|
60616
|
-
sheetId,
|
|
60617
|
-
col: cmd.col,
|
|
60618
|
-
row: cmd.row,
|
|
60619
|
-
style: cmd.style || null,
|
|
60620
|
-
content: cmd.content || "",
|
|
60621
|
-
format: cmd.format || "",
|
|
60622
|
-
});
|
|
60623
|
-
this.dispatch("SET_BORDER", {
|
|
60624
|
-
sheetId,
|
|
60625
|
-
col: cmd.col,
|
|
60626
|
-
row: cmd.row,
|
|
60627
|
-
border: cmd.border,
|
|
60628
|
-
});
|
|
60629
|
-
this.autofillCF(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
60630
|
-
this.autofillDV(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
60631
60639
|
}
|
|
60632
60640
|
}
|
|
60633
60641
|
// ---------------------------------------------------------------------------
|
|
@@ -60651,6 +60659,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60651
60659
|
}
|
|
60652
60660
|
const source = this.getters.getSelectedZone();
|
|
60653
60661
|
const target = this.autofillZone;
|
|
60662
|
+
const autofillCellsData = [];
|
|
60654
60663
|
switch (this.direction) {
|
|
60655
60664
|
case "down" /* DIRECTION.DOWN */:
|
|
60656
60665
|
for (let col = source.left; col <= source.right; col++) {
|
|
@@ -60660,7 +60669,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60660
60669
|
}
|
|
60661
60670
|
const generator = this.createGenerator(xcs);
|
|
60662
60671
|
for (let row = target.top; row <= target.bottom; row++) {
|
|
60663
|
-
this.computeNewCell(generator, col, row
|
|
60672
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60664
60673
|
}
|
|
60665
60674
|
}
|
|
60666
60675
|
break;
|
|
@@ -60672,7 +60681,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60672
60681
|
}
|
|
60673
60682
|
const generator = this.createGenerator(xcs);
|
|
60674
60683
|
for (let row = target.bottom; row >= target.top; row--) {
|
|
60675
|
-
this.computeNewCell(generator, col, row
|
|
60684
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60676
60685
|
}
|
|
60677
60686
|
}
|
|
60678
60687
|
break;
|
|
@@ -60684,7 +60693,7 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60684
60693
|
}
|
|
60685
60694
|
const generator = this.createGenerator(xcs);
|
|
60686
60695
|
for (let col = target.right; col >= target.left; col--) {
|
|
60687
|
-
this.computeNewCell(generator, col, row
|
|
60696
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60688
60697
|
}
|
|
60689
60698
|
}
|
|
60690
60699
|
break;
|
|
@@ -60696,12 +60705,26 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60696
60705
|
}
|
|
60697
60706
|
const generator = this.createGenerator(xcs);
|
|
60698
60707
|
for (let col = target.left; col <= target.right; col++) {
|
|
60699
|
-
this.computeNewCell(generator, col, row
|
|
60708
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
60700
60709
|
}
|
|
60701
60710
|
}
|
|
60702
60711
|
break;
|
|
60703
60712
|
}
|
|
60704
60713
|
if (apply) {
|
|
60714
|
+
const bordersZones = {};
|
|
60715
|
+
const cfNewRanges = {};
|
|
60716
|
+
const dvNewZones = {};
|
|
60717
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
60718
|
+
for (const data of autofillCellsData) {
|
|
60719
|
+
this.collectBordersData(data, bordersZones);
|
|
60720
|
+
this.autofillMerge(sheetId, data);
|
|
60721
|
+
this.autofillCell(sheetId, data);
|
|
60722
|
+
this.collectConditionalFormatsData(sheetId, data, cfNewRanges);
|
|
60723
|
+
this.collectDataValidationsData(sheetId, data, dvNewZones);
|
|
60724
|
+
}
|
|
60725
|
+
this.autofillBorders(sheetId, bordersZones);
|
|
60726
|
+
this.autofillConditionalFormats(sheetId, cfNewRanges);
|
|
60727
|
+
this.autofillDataValidations(sheetId, dvNewZones);
|
|
60705
60728
|
this.autofillZone = undefined;
|
|
60706
60729
|
this.selection.resizeAnchorZone(this.direction, this.steps);
|
|
60707
60730
|
this.lastCellSelected = {};
|
|
@@ -60710,6 +60733,95 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60710
60733
|
this.tooltip = undefined;
|
|
60711
60734
|
}
|
|
60712
60735
|
}
|
|
60736
|
+
collectBordersData(data, bordersPositions) {
|
|
60737
|
+
const key = JSON.stringify(data.border);
|
|
60738
|
+
if (!(key in bordersPositions)) {
|
|
60739
|
+
bordersPositions[key] = [];
|
|
60740
|
+
}
|
|
60741
|
+
bordersPositions[key].push(positionToZone({ col: data.col, row: data.row }));
|
|
60742
|
+
}
|
|
60743
|
+
collectConditionalFormatsData(sheetId, data, cfNewRanges) {
|
|
60744
|
+
const { originCol, originRow, col, row } = data;
|
|
60745
|
+
const cfsAtOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
60746
|
+
const xc = toXC(col, row);
|
|
60747
|
+
for (const cf of cfsAtOrigin) {
|
|
60748
|
+
if (!(cf.id in cfNewRanges)) {
|
|
60749
|
+
cfNewRanges[cf.id] = [];
|
|
60750
|
+
}
|
|
60751
|
+
cfNewRanges[cf.id].push(xc);
|
|
60752
|
+
}
|
|
60753
|
+
}
|
|
60754
|
+
collectDataValidationsData(sheetId, data, dvNewZones) {
|
|
60755
|
+
const { originCol, originRow, col, row } = data;
|
|
60756
|
+
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
60757
|
+
const dvsAtOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
60758
|
+
if (!dvsAtOrigin) {
|
|
60759
|
+
return;
|
|
60760
|
+
}
|
|
60761
|
+
if (!(dvsAtOrigin.id in dvNewZones)) {
|
|
60762
|
+
dvNewZones[dvsAtOrigin.id] = [];
|
|
60763
|
+
}
|
|
60764
|
+
dvNewZones[dvsAtOrigin.id].push(positionToZone({ col, row }));
|
|
60765
|
+
}
|
|
60766
|
+
autofillCell(sheetId, data) {
|
|
60767
|
+
this.dispatch("UPDATE_CELL", {
|
|
60768
|
+
sheetId,
|
|
60769
|
+
col: data.col,
|
|
60770
|
+
row: data.row,
|
|
60771
|
+
content: data.content || "",
|
|
60772
|
+
style: data.style || null,
|
|
60773
|
+
format: data.format || "",
|
|
60774
|
+
});
|
|
60775
|
+
// Still usefull in odoo ATM to autofill field sync
|
|
60776
|
+
this.dispatch("AUTOFILL_CELL", data);
|
|
60777
|
+
}
|
|
60778
|
+
autofillBorders(sheetId, bordersPositions) {
|
|
60779
|
+
for (const stringifiedBorder in bordersPositions) {
|
|
60780
|
+
const border = stringifiedBorder === "undefined" ? undefined : JSON.parse(stringifiedBorder);
|
|
60781
|
+
this.dispatch("SET_BORDERS_ON_TARGET", {
|
|
60782
|
+
sheetId,
|
|
60783
|
+
border,
|
|
60784
|
+
target: recomputeZones(bordersPositions[stringifiedBorder]),
|
|
60785
|
+
});
|
|
60786
|
+
}
|
|
60787
|
+
}
|
|
60788
|
+
autofillConditionalFormats(sheetId, cfNewRanges) {
|
|
60789
|
+
for (const cfId in cfNewRanges) {
|
|
60790
|
+
const changes = cfNewRanges[cfId];
|
|
60791
|
+
const cf = this.getters.getConditionalFormats(sheetId).find((cf) => cf.id === cfId);
|
|
60792
|
+
if (!cf) {
|
|
60793
|
+
continue;
|
|
60794
|
+
}
|
|
60795
|
+
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, changes.map(toZone), []);
|
|
60796
|
+
if (newCfRanges) {
|
|
60797
|
+
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
60798
|
+
cf: {
|
|
60799
|
+
id: cf.id,
|
|
60800
|
+
rule: cf.rule,
|
|
60801
|
+
stopIfTrue: cf.stopIfTrue,
|
|
60802
|
+
},
|
|
60803
|
+
ranges: newCfRanges,
|
|
60804
|
+
sheetId,
|
|
60805
|
+
});
|
|
60806
|
+
}
|
|
60807
|
+
}
|
|
60808
|
+
}
|
|
60809
|
+
autofillDataValidations(sheetId, dvNewZones) {
|
|
60810
|
+
for (const dvId in dvNewZones) {
|
|
60811
|
+
const changes = dvNewZones[dvId];
|
|
60812
|
+
const dvOrigin = this.getters.getDataValidationRule(sheetId, dvId);
|
|
60813
|
+
if (!dvOrigin) {
|
|
60814
|
+
continue;
|
|
60815
|
+
}
|
|
60816
|
+
const dvRangesXcs = dvOrigin.ranges.map((range) => range.zone);
|
|
60817
|
+
const newDvRanges = recomputeZones(dvRangesXcs.concat(changes), []);
|
|
60818
|
+
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
60819
|
+
rule: dvOrigin,
|
|
60820
|
+
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
60821
|
+
sheetId,
|
|
60822
|
+
});
|
|
60823
|
+
}
|
|
60824
|
+
}
|
|
60713
60825
|
/**
|
|
60714
60826
|
* Select a cell which becomes the last cell of the autofillZone
|
|
60715
60827
|
*/
|
|
@@ -60788,22 +60900,20 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60788
60900
|
/**
|
|
60789
60901
|
* Generate the next cell
|
|
60790
60902
|
*/
|
|
60791
|
-
computeNewCell(generator, col, row
|
|
60903
|
+
computeNewCell(generator, col, row) {
|
|
60792
60904
|
const { cellData, tooltip, origin } = generator.next();
|
|
60793
60905
|
const { content, style, border, format } = cellData;
|
|
60794
60906
|
this.tooltip = tooltip;
|
|
60795
|
-
|
|
60796
|
-
|
|
60797
|
-
|
|
60798
|
-
|
|
60799
|
-
|
|
60800
|
-
|
|
60801
|
-
|
|
60802
|
-
|
|
60803
|
-
|
|
60804
|
-
|
|
60805
|
-
});
|
|
60806
|
-
}
|
|
60907
|
+
return {
|
|
60908
|
+
originCol: origin.col,
|
|
60909
|
+
originRow: origin.row,
|
|
60910
|
+
col,
|
|
60911
|
+
row,
|
|
60912
|
+
content,
|
|
60913
|
+
style,
|
|
60914
|
+
border,
|
|
60915
|
+
format,
|
|
60916
|
+
};
|
|
60807
60917
|
}
|
|
60808
60918
|
/**
|
|
60809
60919
|
* Get the rule associated to the current cell
|
|
@@ -60871,8 +60981,8 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60871
60981
|
? position[first].value
|
|
60872
60982
|
: position[second].value;
|
|
60873
60983
|
}
|
|
60874
|
-
|
|
60875
|
-
const
|
|
60984
|
+
autofillMerge(sheetId, data) {
|
|
60985
|
+
const { originCol, originRow, col, row } = data;
|
|
60876
60986
|
const position = { sheetId, col, row };
|
|
60877
60987
|
const originPosition = { sheetId, col: originCol, row: originRow };
|
|
60878
60988
|
if (this.getters.isInMerge(position) && !this.getters.isInMerge(originPosition)) {
|
|
@@ -60899,35 +61009,6 @@ class AutofillPlugin extends UIPlugin {
|
|
|
60899
61009
|
});
|
|
60900
61010
|
}
|
|
60901
61011
|
}
|
|
60902
|
-
autofillCF(originCol, originRow, col, row) {
|
|
60903
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
60904
|
-
const cfOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
60905
|
-
for (const cf of cfOrigin) {
|
|
60906
|
-
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, [positionToZone({ col, row })], []);
|
|
60907
|
-
if (newCfRanges) {
|
|
60908
|
-
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
60909
|
-
cf: deepCopy(cf),
|
|
60910
|
-
ranges: newCfRanges,
|
|
60911
|
-
sheetId,
|
|
60912
|
-
});
|
|
60913
|
-
}
|
|
60914
|
-
}
|
|
60915
|
-
}
|
|
60916
|
-
autofillDV(originCol, originRow, col, row) {
|
|
60917
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
60918
|
-
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
60919
|
-
const dvOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
60920
|
-
if (!dvOrigin) {
|
|
60921
|
-
return;
|
|
60922
|
-
}
|
|
60923
|
-
const dvRangesZones = dvOrigin.ranges.map((range) => range.zone);
|
|
60924
|
-
const newDvRanges = recomputeZones(dvRangesZones.concat(positionToZone({ col, row })), []);
|
|
60925
|
-
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
60926
|
-
rule: dvOrigin,
|
|
60927
|
-
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
60928
|
-
sheetId,
|
|
60929
|
-
});
|
|
60930
|
-
}
|
|
60931
61012
|
// ---------------------------------------------------------------------------
|
|
60932
61013
|
// Grid rendering
|
|
60933
61014
|
// ---------------------------------------------------------------------------
|
|
@@ -73633,6 +73714,6 @@ exports.tokenColors = tokenColors;
|
|
|
73633
73714
|
exports.tokenize = tokenize;
|
|
73634
73715
|
|
|
73635
73716
|
|
|
73636
|
-
__info__.version = "18.0.
|
|
73637
|
-
__info__.date = "2025-04-
|
|
73638
|
-
__info__.hash = "
|
|
73717
|
+
__info__.version = "18.0.23";
|
|
73718
|
+
__info__.date = "2025-04-14T17:16:35.374Z";
|
|
73719
|
+
__info__.hash = "f560133";
|