@odoo/o-spreadsheet 17.4.29 → 17.4.30
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 +244 -111
- package/dist/o-spreadsheet.d.ts +32 -15
- package/dist/o-spreadsheet.esm.js +244 -111
- package/dist/o-spreadsheet.iife.js +244 -111
- 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 17.4.
|
|
6
|
-
* @date 2025-04-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.4.30
|
|
6
|
+
* @date 2025-04-14T17:17:01.767Z
|
|
7
|
+
* @hash e4cf37d
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -2168,6 +2168,7 @@
|
|
|
2168
2168
|
"CLEAR_FORMATTING",
|
|
2169
2169
|
"SET_BORDER",
|
|
2170
2170
|
"SET_ZONE_BORDERS",
|
|
2171
|
+
"SET_BORDERS_ON_TARGET",
|
|
2171
2172
|
/** CHART */
|
|
2172
2173
|
"CREATE_CHART",
|
|
2173
2174
|
"UPDATE_CHART",
|
|
@@ -5651,6 +5652,7 @@
|
|
|
5651
5652
|
}
|
|
5652
5653
|
|
|
5653
5654
|
class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
5655
|
+
queuedBordersToAdd = {};
|
|
5654
5656
|
copy(data) {
|
|
5655
5657
|
const sheetId = data.sheetId;
|
|
5656
5658
|
if (data.zones.length === 0) {
|
|
@@ -5681,6 +5683,7 @@
|
|
|
5681
5683
|
const { left, top } = zones[0];
|
|
5682
5684
|
this.pasteZone(sheetId, left, top, content.borders);
|
|
5683
5685
|
}
|
|
5686
|
+
this.executeQueuedChanges(sheetId);
|
|
5684
5687
|
}
|
|
5685
5688
|
pasteZone(sheetId, col, row, borders) {
|
|
5686
5689
|
for (const [r, rowBorders] of borders.entries()) {
|
|
@@ -5699,7 +5702,20 @@
|
|
|
5699
5702
|
...targetBorders,
|
|
5700
5703
|
...originBorders,
|
|
5701
5704
|
};
|
|
5702
|
-
|
|
5705
|
+
const borderKey = JSON.stringify(border);
|
|
5706
|
+
if (!this.queuedBordersToAdd[borderKey]) {
|
|
5707
|
+
this.queuedBordersToAdd[borderKey] = [];
|
|
5708
|
+
}
|
|
5709
|
+
this.queuedBordersToAdd[borderKey].push(positionToZone(target));
|
|
5710
|
+
}
|
|
5711
|
+
executeQueuedChanges(pasteSheetTarget) {
|
|
5712
|
+
for (const borderKey in this.queuedBordersToAdd) {
|
|
5713
|
+
const zones = this.queuedBordersToAdd[borderKey];
|
|
5714
|
+
const border = JSON.parse(borderKey);
|
|
5715
|
+
const target = recomputeZones(zones, []);
|
|
5716
|
+
this.dispatch("SET_BORDERS_ON_TARGET", { sheetId: pasteSheetTarget, target, border });
|
|
5717
|
+
}
|
|
5718
|
+
this.queuedBordersToAdd = {};
|
|
5703
5719
|
}
|
|
5704
5720
|
}
|
|
5705
5721
|
|
|
@@ -6963,6 +6979,7 @@
|
|
|
6963
6979
|
|
|
6964
6980
|
class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
|
|
6965
6981
|
uuidGenerator = new UuidGenerator();
|
|
6982
|
+
queuedChanges = {};
|
|
6966
6983
|
copy(data) {
|
|
6967
6984
|
if (!data.zones.length) {
|
|
6968
6985
|
return;
|
|
@@ -6984,6 +7001,7 @@
|
|
|
6984
7001
|
return { cfRules };
|
|
6985
7002
|
}
|
|
6986
7003
|
paste(target, clippedContent, options) {
|
|
7004
|
+
this.queuedChanges = {};
|
|
6987
7005
|
if (options.pasteOption === "asValue") {
|
|
6988
7006
|
return;
|
|
6989
7007
|
}
|
|
@@ -6995,6 +7013,7 @@
|
|
|
6995
7013
|
else {
|
|
6996
7014
|
this.pasteFromCut(sheetId, zones, clippedContent);
|
|
6997
7015
|
}
|
|
7016
|
+
this.executeQueuedChanges();
|
|
6998
7017
|
}
|
|
6999
7018
|
pasteFromCut(sheetId, target, content) {
|
|
7000
7019
|
const selection = target[0];
|
|
@@ -7012,12 +7031,13 @@
|
|
|
7012
7031
|
}
|
|
7013
7032
|
pasteCf(origin, target, isCutOperation) {
|
|
7014
7033
|
if (origin?.rules && origin.rules.length > 0) {
|
|
7034
|
+
const originZone = positionToZone(origin.position);
|
|
7015
7035
|
const zone = positionToZone(target);
|
|
7016
7036
|
for (const rule of origin.rules) {
|
|
7017
7037
|
const toRemoveZones = [];
|
|
7018
7038
|
if (isCutOperation) {
|
|
7019
7039
|
//remove from current rule
|
|
7020
|
-
toRemoveZones.push(
|
|
7040
|
+
toRemoveZones.push(originZone);
|
|
7021
7041
|
}
|
|
7022
7042
|
if (origin.position.sheetId === target.sheetId) {
|
|
7023
7043
|
this.adaptCFRules(origin.position.sheetId, rule, [zone], toRemoveZones);
|
|
@@ -7034,36 +7054,56 @@
|
|
|
7034
7054
|
* Add or remove cells to a given conditional formatting rule.
|
|
7035
7055
|
*/
|
|
7036
7056
|
adaptCFRules(sheetId, cf, toAdd, toRemove) {
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
return;
|
|
7057
|
+
if (!this.queuedChanges[sheetId]) {
|
|
7058
|
+
this.queuedChanges[sheetId] = [];
|
|
7040
7059
|
}
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7060
|
+
const queuedChange = this.queuedChanges[sheetId].find((queued) => queued.cf.id === cf.id);
|
|
7061
|
+
if (!queuedChange) {
|
|
7062
|
+
this.queuedChanges[sheetId].push({ toAdd, toRemove, cf });
|
|
7063
|
+
}
|
|
7064
|
+
else {
|
|
7065
|
+
queuedChange.toAdd.push(...toAdd);
|
|
7066
|
+
queuedChange.toRemove.push(...toRemove);
|
|
7067
|
+
}
|
|
7068
|
+
}
|
|
7069
|
+
executeQueuedChanges() {
|
|
7070
|
+
for (const sheetId in this.queuedChanges) {
|
|
7071
|
+
for (const { toAdd, toRemove, cf } of this.queuedChanges[sheetId]) {
|
|
7072
|
+
const newRangesXc = this.getters.getAdaptedCfRanges(sheetId, cf, toAdd, toRemove);
|
|
7073
|
+
if (!newRangesXc) {
|
|
7074
|
+
continue;
|
|
7075
|
+
}
|
|
7076
|
+
if (newRangesXc.length === 0) {
|
|
7077
|
+
this.dispatch("REMOVE_CONDITIONAL_FORMAT", { id: cf.id, sheetId });
|
|
7078
|
+
continue;
|
|
7079
|
+
}
|
|
7080
|
+
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
7081
|
+
cf: {
|
|
7082
|
+
id: cf.id,
|
|
7083
|
+
rule: cf.rule,
|
|
7084
|
+
stopIfTrue: cf.stopIfTrue,
|
|
7085
|
+
},
|
|
7086
|
+
ranges: newRangesXc,
|
|
7087
|
+
sheetId,
|
|
7088
|
+
});
|
|
7089
|
+
}
|
|
7044
7090
|
}
|
|
7045
|
-
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
7046
|
-
cf: {
|
|
7047
|
-
id: cf.id,
|
|
7048
|
-
rule: cf.rule,
|
|
7049
|
-
stopIfTrue: cf.stopIfTrue,
|
|
7050
|
-
},
|
|
7051
|
-
ranges: newRangesXc,
|
|
7052
|
-
sheetId,
|
|
7053
|
-
});
|
|
7054
7091
|
}
|
|
7055
7092
|
getCFToCopyTo(targetSheetId, originCF) {
|
|
7056
|
-
|
|
7093
|
+
let targetCF = this.getters
|
|
7057
7094
|
.getConditionalFormats(targetSheetId)
|
|
7058
7095
|
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7096
|
+
const queuedCfs = this.queuedChanges[targetSheetId];
|
|
7097
|
+
if (!targetCF && queuedCfs) {
|
|
7098
|
+
targetCF = queuedCfs.find((queued) => queued.cf.stopIfTrue === originCF.stopIfTrue && deepEquals(queued.cf.rule, originCF.rule))?.cf;
|
|
7099
|
+
}
|
|
7100
|
+
return targetCF || { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
|
|
7062
7101
|
}
|
|
7063
7102
|
}
|
|
7064
7103
|
|
|
7065
7104
|
class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
7066
7105
|
uuidGenerator = new UuidGenerator();
|
|
7106
|
+
queuedChanges = {};
|
|
7067
7107
|
copy(data) {
|
|
7068
7108
|
const { rowsIndexes, columnsIndexes } = data;
|
|
7069
7109
|
const sheetId = data.sheetId;
|
|
@@ -7080,6 +7120,7 @@
|
|
|
7080
7120
|
return { dvRules };
|
|
7081
7121
|
}
|
|
7082
7122
|
paste(target, clippedContent, options) {
|
|
7123
|
+
this.queuedChanges = {};
|
|
7083
7124
|
if (options.pasteOption) {
|
|
7084
7125
|
return;
|
|
7085
7126
|
}
|
|
@@ -7091,6 +7132,7 @@
|
|
|
7091
7132
|
else {
|
|
7092
7133
|
this.pasteFromCut(sheetId, zones, clippedContent);
|
|
7093
7134
|
}
|
|
7135
|
+
this.executeQueuedChanges();
|
|
7094
7136
|
}
|
|
7095
7137
|
pasteFromCut(sheetId, target, content) {
|
|
7096
7138
|
const selection = target[0];
|
|
@@ -7109,6 +7151,7 @@
|
|
|
7109
7151
|
pasteDataValidation(origin, target, isCutOperation) {
|
|
7110
7152
|
if (origin) {
|
|
7111
7153
|
const zone = positionToZone(target);
|
|
7154
|
+
const originZone = positionToZone(origin.position);
|
|
7112
7155
|
const rule = origin.rule;
|
|
7113
7156
|
if (!rule) {
|
|
7114
7157
|
const targetRule = this.getters.getValidationRuleForCell(target);
|
|
@@ -7120,7 +7163,7 @@
|
|
|
7120
7163
|
}
|
|
7121
7164
|
const toRemoveZone = [];
|
|
7122
7165
|
if (isCutOperation) {
|
|
7123
|
-
toRemoveZone.push(
|
|
7166
|
+
toRemoveZone.push(originZone);
|
|
7124
7167
|
}
|
|
7125
7168
|
if (origin.position.sheetId === target.sheetId) {
|
|
7126
7169
|
const copyToRule = this.getDataValidationRuleToCopyTo(target.sheetId, rule, false);
|
|
@@ -7137,29 +7180,55 @@
|
|
|
7137
7180
|
}
|
|
7138
7181
|
}
|
|
7139
7182
|
getDataValidationRuleToCopyTo(targetSheetId, originRule, newId = true) {
|
|
7140
|
-
|
|
7183
|
+
let targetRule = this.getters
|
|
7141
7184
|
.getDataValidationRules(targetSheetId)
|
|
7142
7185
|
.find((rule) => deepEquals(originRule.criterion, rule.criterion) &&
|
|
7143
7186
|
originRule.isBlocking === rule.isBlocking);
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7187
|
+
const queuedRules = this.queuedChanges[targetSheetId];
|
|
7188
|
+
if (!targetRule && queuedRules) {
|
|
7189
|
+
targetRule = queuedRules.find((queued) => deepEquals(originRule.criterion, queued.rule.criterion) &&
|
|
7190
|
+
originRule.isBlocking === queued.rule.isBlocking)?.rule;
|
|
7191
|
+
}
|
|
7192
|
+
return (targetRule || {
|
|
7193
|
+
...originRule,
|
|
7194
|
+
id: newId ? this.uuidGenerator.uuidv4() : originRule.id,
|
|
7195
|
+
ranges: [],
|
|
7196
|
+
});
|
|
7147
7197
|
}
|
|
7148
7198
|
/**
|
|
7149
7199
|
* Add or remove XCs to a given data validation rule.
|
|
7150
7200
|
*/
|
|
7151
7201
|
adaptDataValidationRule(sheetId, rule, toAdd, toRemove) {
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7202
|
+
if (!this.queuedChanges[sheetId]) {
|
|
7203
|
+
this.queuedChanges[sheetId] = [];
|
|
7204
|
+
}
|
|
7205
|
+
const queuedChange = this.queuedChanges[sheetId].find((queued) => queued.rule.id === rule.id);
|
|
7206
|
+
if (!queuedChange) {
|
|
7207
|
+
this.queuedChanges[sheetId].push({ toAdd, toRemove, rule });
|
|
7208
|
+
}
|
|
7209
|
+
else {
|
|
7210
|
+
queuedChange.toAdd.push(...toAdd);
|
|
7211
|
+
queuedChange.toRemove.push(...toRemove);
|
|
7212
|
+
}
|
|
7213
|
+
}
|
|
7214
|
+
executeQueuedChanges() {
|
|
7215
|
+
for (const sheetId in this.queuedChanges) {
|
|
7216
|
+
for (const { toAdd, toRemove, rule: dv } of this.queuedChanges[sheetId]) {
|
|
7217
|
+
// Remove the zones first in case the same position is in toAdd and toRemove
|
|
7218
|
+
const dvZones = dv.ranges.map((range) => range.zone);
|
|
7219
|
+
const withRemovedZones = recomputeZones(dvZones, toRemove);
|
|
7220
|
+
const newDvZones = recomputeZones([...withRemovedZones, ...toAdd], []);
|
|
7221
|
+
if (newDvZones.length === 0) {
|
|
7222
|
+
this.dispatch("REMOVE_DATA_VALIDATION_RULE", { sheetId, id: dv.id });
|
|
7223
|
+
continue;
|
|
7224
|
+
}
|
|
7225
|
+
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
7226
|
+
rule: { id: dv.id, criterion: dv.criterion, isBlocking: dv.isBlocking },
|
|
7227
|
+
ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
7228
|
+
sheetId,
|
|
7229
|
+
});
|
|
7230
|
+
}
|
|
7157
7231
|
}
|
|
7158
|
-
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
7159
|
-
rule,
|
|
7160
|
-
ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
7161
|
-
sheetId,
|
|
7162
|
-
});
|
|
7163
7232
|
}
|
|
7164
7233
|
}
|
|
7165
7234
|
|
|
@@ -47562,6 +47631,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47562
47631
|
case "SET_BORDER":
|
|
47563
47632
|
this.setBorder(cmd.sheetId, cmd.col, cmd.row, cmd.border);
|
|
47564
47633
|
break;
|
|
47634
|
+
case "SET_BORDERS_ON_TARGET":
|
|
47635
|
+
for (const zone of cmd.target) {
|
|
47636
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
47637
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
47638
|
+
this.setBorder(cmd.sheetId, col, row, cmd.border);
|
|
47639
|
+
}
|
|
47640
|
+
}
|
|
47641
|
+
}
|
|
47642
|
+
break;
|
|
47565
47643
|
case "SET_ZONE_BORDERS":
|
|
47566
47644
|
if (cmd.border) {
|
|
47567
47645
|
const target = cmd.target.map((zone) => this.getters.expandZone(cmd.sheetId, zone));
|
|
@@ -49040,8 +49118,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49040
49118
|
if (replaceIndex > -1) {
|
|
49041
49119
|
currentRanges = rules[replaceIndex].ranges.map(toUnboundedZone);
|
|
49042
49120
|
}
|
|
49043
|
-
|
|
49044
|
-
|
|
49121
|
+
// Remove the zones first in case the same position is in toAdd and toRemove
|
|
49122
|
+
const withRemovedZones = recomputeZones(currentRanges, toRemove);
|
|
49123
|
+
return recomputeZones([...toAdd, ...withRemovedZones], []).map((zone) => this.getters.getRangeDataFromZone(sheetId, zone));
|
|
49045
49124
|
}
|
|
49046
49125
|
// ---------------------------------------------------------------------------
|
|
49047
49126
|
// Private
|
|
@@ -56552,25 +56631,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56552
56631
|
case "AUTOFILL_AUTO":
|
|
56553
56632
|
this.autofillAuto();
|
|
56554
56633
|
break;
|
|
56555
|
-
case "AUTOFILL_CELL":
|
|
56556
|
-
this.autoFillMerge(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
56557
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
56558
|
-
this.dispatch("UPDATE_CELL", {
|
|
56559
|
-
sheetId,
|
|
56560
|
-
col: cmd.col,
|
|
56561
|
-
row: cmd.row,
|
|
56562
|
-
style: cmd.style || null,
|
|
56563
|
-
content: cmd.content || "",
|
|
56564
|
-
format: cmd.format || "",
|
|
56565
|
-
});
|
|
56566
|
-
this.dispatch("SET_BORDER", {
|
|
56567
|
-
sheetId,
|
|
56568
|
-
col: cmd.col,
|
|
56569
|
-
row: cmd.row,
|
|
56570
|
-
border: cmd.border,
|
|
56571
|
-
});
|
|
56572
|
-
this.autofillCF(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
56573
|
-
this.autofillDV(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
56574
56634
|
}
|
|
56575
56635
|
}
|
|
56576
56636
|
// ---------------------------------------------------------------------------
|
|
@@ -56594,6 +56654,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56594
56654
|
}
|
|
56595
56655
|
const source = this.getters.getSelectedZone();
|
|
56596
56656
|
const target = this.autofillZone;
|
|
56657
|
+
const autofillCellsData = [];
|
|
56597
56658
|
switch (this.direction) {
|
|
56598
56659
|
case "down" /* DIRECTION.DOWN */:
|
|
56599
56660
|
for (let col = source.left; col <= source.right; col++) {
|
|
@@ -56603,7 +56664,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56603
56664
|
}
|
|
56604
56665
|
const generator = this.createGenerator(xcs);
|
|
56605
56666
|
for (let row = target.top; row <= target.bottom; row++) {
|
|
56606
|
-
this.computeNewCell(generator, col, row
|
|
56667
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
56607
56668
|
}
|
|
56608
56669
|
}
|
|
56609
56670
|
break;
|
|
@@ -56615,7 +56676,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56615
56676
|
}
|
|
56616
56677
|
const generator = this.createGenerator(xcs);
|
|
56617
56678
|
for (let row = target.bottom; row >= target.top; row--) {
|
|
56618
|
-
this.computeNewCell(generator, col, row
|
|
56679
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
56619
56680
|
}
|
|
56620
56681
|
}
|
|
56621
56682
|
break;
|
|
@@ -56627,7 +56688,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56627
56688
|
}
|
|
56628
56689
|
const generator = this.createGenerator(xcs);
|
|
56629
56690
|
for (let col = target.right; col >= target.left; col--) {
|
|
56630
|
-
this.computeNewCell(generator, col, row
|
|
56691
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
56631
56692
|
}
|
|
56632
56693
|
}
|
|
56633
56694
|
break;
|
|
@@ -56639,12 +56700,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56639
56700
|
}
|
|
56640
56701
|
const generator = this.createGenerator(xcs);
|
|
56641
56702
|
for (let col = target.left; col <= target.right; col++) {
|
|
56642
|
-
this.computeNewCell(generator, col, row
|
|
56703
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
56643
56704
|
}
|
|
56644
56705
|
}
|
|
56645
56706
|
break;
|
|
56646
56707
|
}
|
|
56647
56708
|
if (apply) {
|
|
56709
|
+
const bordersZones = {};
|
|
56710
|
+
const cfNewRanges = {};
|
|
56711
|
+
const dvNewZones = {};
|
|
56712
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
56713
|
+
for (const data of autofillCellsData) {
|
|
56714
|
+
this.collectBordersData(data, bordersZones);
|
|
56715
|
+
this.autofillMerge(sheetId, data);
|
|
56716
|
+
this.autofillCell(sheetId, data);
|
|
56717
|
+
this.collectConditionalFormatsData(sheetId, data, cfNewRanges);
|
|
56718
|
+
this.collectDataValidationsData(sheetId, data, dvNewZones);
|
|
56719
|
+
}
|
|
56720
|
+
this.autofillBorders(sheetId, bordersZones);
|
|
56721
|
+
this.autofillConditionalFormats(sheetId, cfNewRanges);
|
|
56722
|
+
this.autofillDataValidations(sheetId, dvNewZones);
|
|
56648
56723
|
this.autofillZone = undefined;
|
|
56649
56724
|
this.selection.resizeAnchorZone(this.direction, this.steps);
|
|
56650
56725
|
this.lastCellSelected = {};
|
|
@@ -56653,6 +56728,95 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56653
56728
|
this.tooltip = undefined;
|
|
56654
56729
|
}
|
|
56655
56730
|
}
|
|
56731
|
+
collectBordersData(data, bordersPositions) {
|
|
56732
|
+
const key = JSON.stringify(data.border);
|
|
56733
|
+
if (!(key in bordersPositions)) {
|
|
56734
|
+
bordersPositions[key] = [];
|
|
56735
|
+
}
|
|
56736
|
+
bordersPositions[key].push(positionToZone({ col: data.col, row: data.row }));
|
|
56737
|
+
}
|
|
56738
|
+
collectConditionalFormatsData(sheetId, data, cfNewRanges) {
|
|
56739
|
+
const { originCol, originRow, col, row } = data;
|
|
56740
|
+
const cfsAtOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
56741
|
+
const xc = toXC(col, row);
|
|
56742
|
+
for (const cf of cfsAtOrigin) {
|
|
56743
|
+
if (!(cf.id in cfNewRanges)) {
|
|
56744
|
+
cfNewRanges[cf.id] = [];
|
|
56745
|
+
}
|
|
56746
|
+
cfNewRanges[cf.id].push(xc);
|
|
56747
|
+
}
|
|
56748
|
+
}
|
|
56749
|
+
collectDataValidationsData(sheetId, data, dvNewZones) {
|
|
56750
|
+
const { originCol, originRow, col, row } = data;
|
|
56751
|
+
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
56752
|
+
const dvsAtOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
56753
|
+
if (!dvsAtOrigin) {
|
|
56754
|
+
return;
|
|
56755
|
+
}
|
|
56756
|
+
if (!(dvsAtOrigin.id in dvNewZones)) {
|
|
56757
|
+
dvNewZones[dvsAtOrigin.id] = [];
|
|
56758
|
+
}
|
|
56759
|
+
dvNewZones[dvsAtOrigin.id].push(positionToZone({ col, row }));
|
|
56760
|
+
}
|
|
56761
|
+
autofillCell(sheetId, data) {
|
|
56762
|
+
this.dispatch("UPDATE_CELL", {
|
|
56763
|
+
sheetId,
|
|
56764
|
+
col: data.col,
|
|
56765
|
+
row: data.row,
|
|
56766
|
+
content: data.content || "",
|
|
56767
|
+
style: data.style || null,
|
|
56768
|
+
format: data.format || "",
|
|
56769
|
+
});
|
|
56770
|
+
// Still usefull in odoo ATM to autofill field sync
|
|
56771
|
+
this.dispatch("AUTOFILL_CELL", data);
|
|
56772
|
+
}
|
|
56773
|
+
autofillBorders(sheetId, bordersPositions) {
|
|
56774
|
+
for (const stringifiedBorder in bordersPositions) {
|
|
56775
|
+
const border = stringifiedBorder === "undefined" ? undefined : JSON.parse(stringifiedBorder);
|
|
56776
|
+
this.dispatch("SET_BORDERS_ON_TARGET", {
|
|
56777
|
+
sheetId,
|
|
56778
|
+
border,
|
|
56779
|
+
target: recomputeZones(bordersPositions[stringifiedBorder]),
|
|
56780
|
+
});
|
|
56781
|
+
}
|
|
56782
|
+
}
|
|
56783
|
+
autofillConditionalFormats(sheetId, cfNewRanges) {
|
|
56784
|
+
for (const cfId in cfNewRanges) {
|
|
56785
|
+
const changes = cfNewRanges[cfId];
|
|
56786
|
+
const cf = this.getters.getConditionalFormats(sheetId).find((cf) => cf.id === cfId);
|
|
56787
|
+
if (!cf) {
|
|
56788
|
+
continue;
|
|
56789
|
+
}
|
|
56790
|
+
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, changes.map(toZone), []);
|
|
56791
|
+
if (newCfRanges) {
|
|
56792
|
+
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
56793
|
+
cf: {
|
|
56794
|
+
id: cf.id,
|
|
56795
|
+
rule: cf.rule,
|
|
56796
|
+
stopIfTrue: cf.stopIfTrue,
|
|
56797
|
+
},
|
|
56798
|
+
ranges: newCfRanges,
|
|
56799
|
+
sheetId,
|
|
56800
|
+
});
|
|
56801
|
+
}
|
|
56802
|
+
}
|
|
56803
|
+
}
|
|
56804
|
+
autofillDataValidations(sheetId, dvNewZones) {
|
|
56805
|
+
for (const dvId in dvNewZones) {
|
|
56806
|
+
const changes = dvNewZones[dvId];
|
|
56807
|
+
const dvOrigin = this.getters.getDataValidationRule(sheetId, dvId);
|
|
56808
|
+
if (!dvOrigin) {
|
|
56809
|
+
continue;
|
|
56810
|
+
}
|
|
56811
|
+
const dvRangesXcs = dvOrigin.ranges.map((range) => range.zone);
|
|
56812
|
+
const newDvRanges = recomputeZones(dvRangesXcs.concat(changes), []);
|
|
56813
|
+
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
56814
|
+
rule: dvOrigin,
|
|
56815
|
+
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
56816
|
+
sheetId,
|
|
56817
|
+
});
|
|
56818
|
+
}
|
|
56819
|
+
}
|
|
56656
56820
|
/**
|
|
56657
56821
|
* Select a cell which becomes the last cell of the autofillZone
|
|
56658
56822
|
*/
|
|
@@ -56731,22 +56895,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56731
56895
|
/**
|
|
56732
56896
|
* Generate the next cell
|
|
56733
56897
|
*/
|
|
56734
|
-
computeNewCell(generator, col, row
|
|
56898
|
+
computeNewCell(generator, col, row) {
|
|
56735
56899
|
const { cellData, tooltip, origin } = generator.next();
|
|
56736
56900
|
const { content, style, border, format } = cellData;
|
|
56737
56901
|
this.tooltip = tooltip;
|
|
56738
|
-
|
|
56739
|
-
|
|
56740
|
-
|
|
56741
|
-
|
|
56742
|
-
|
|
56743
|
-
|
|
56744
|
-
|
|
56745
|
-
|
|
56746
|
-
|
|
56747
|
-
|
|
56748
|
-
});
|
|
56749
|
-
}
|
|
56902
|
+
return {
|
|
56903
|
+
originCol: origin.col,
|
|
56904
|
+
originRow: origin.row,
|
|
56905
|
+
col,
|
|
56906
|
+
row,
|
|
56907
|
+
content,
|
|
56908
|
+
style,
|
|
56909
|
+
border,
|
|
56910
|
+
format,
|
|
56911
|
+
};
|
|
56750
56912
|
}
|
|
56751
56913
|
/**
|
|
56752
56914
|
* Get the rule associated to the current cell
|
|
@@ -56814,8 +56976,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56814
56976
|
? position[first].value
|
|
56815
56977
|
: position[second].value;
|
|
56816
56978
|
}
|
|
56817
|
-
|
|
56818
|
-
const
|
|
56979
|
+
autofillMerge(sheetId, data) {
|
|
56980
|
+
const { originCol, originRow, col, row } = data;
|
|
56819
56981
|
const position = { sheetId, col, row };
|
|
56820
56982
|
const originPosition = { sheetId, col: originCol, row: originRow };
|
|
56821
56983
|
if (this.getters.isInMerge(position) && !this.getters.isInMerge(originPosition)) {
|
|
@@ -56842,35 +57004,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56842
57004
|
});
|
|
56843
57005
|
}
|
|
56844
57006
|
}
|
|
56845
|
-
autofillCF(originCol, originRow, col, row) {
|
|
56846
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
56847
|
-
const cfOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
56848
|
-
for (const cf of cfOrigin) {
|
|
56849
|
-
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, [positionToZone({ col, row })], []);
|
|
56850
|
-
if (newCfRanges) {
|
|
56851
|
-
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
56852
|
-
cf: deepCopy(cf),
|
|
56853
|
-
ranges: newCfRanges,
|
|
56854
|
-
sheetId,
|
|
56855
|
-
});
|
|
56856
|
-
}
|
|
56857
|
-
}
|
|
56858
|
-
}
|
|
56859
|
-
autofillDV(originCol, originRow, col, row) {
|
|
56860
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
56861
|
-
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
56862
|
-
const dvOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
56863
|
-
if (!dvOrigin) {
|
|
56864
|
-
return;
|
|
56865
|
-
}
|
|
56866
|
-
const dvRangesZones = dvOrigin.ranges.map((range) => range.zone);
|
|
56867
|
-
const newDvRanges = recomputeZones(dvRangesZones.concat(positionToZone({ col, row })), []);
|
|
56868
|
-
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
56869
|
-
rule: dvOrigin,
|
|
56870
|
-
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
56871
|
-
sheetId,
|
|
56872
|
-
});
|
|
56873
|
-
}
|
|
56874
57007
|
// ---------------------------------------------------------------------------
|
|
56875
57008
|
// Grid rendering
|
|
56876
57009
|
// ---------------------------------------------------------------------------
|
|
@@ -69242,9 +69375,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
69242
69375
|
exports.tokenize = tokenize;
|
|
69243
69376
|
|
|
69244
69377
|
|
|
69245
|
-
__info__.version = "17.4.
|
|
69246
|
-
__info__.date = "2025-04-
|
|
69247
|
-
__info__.hash = "
|
|
69378
|
+
__info__.version = "17.4.30";
|
|
69379
|
+
__info__.date = "2025-04-14T17:17:01.767Z";
|
|
69380
|
+
__info__.hash = "e4cf37d";
|
|
69248
69381
|
|
|
69249
69382
|
|
|
69250
69383
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|