@odoo/o-spreadsheet 17.4.29 → 17.4.31
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 +255 -117
- package/dist/o-spreadsheet.d.ts +32 -15
- package/dist/o-spreadsheet.esm.js +255 -117
- package/dist/o-spreadsheet.iife.js +255 -117
- package/dist/o-spreadsheet.iife.min.js +347 -347
- 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.31
|
|
6
|
+
* @date 2025-04-18T16:24:47.716Z
|
|
7
|
+
* @hash 7991032
|
|
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
|
|
|
@@ -5811,6 +5827,12 @@
|
|
|
5811
5827
|
}
|
|
5812
5828
|
return null;
|
|
5813
5829
|
}
|
|
5830
|
+
/**
|
|
5831
|
+
- \p{L} is for any letter (from any language)
|
|
5832
|
+
- \p{N} is for any number
|
|
5833
|
+
- the u flag at the end is for unicode, which enables the `\p{...}` syntax
|
|
5834
|
+
*/
|
|
5835
|
+
const unicodeSymbolCharRegexp = /\p{L}|\p{N}|_|\.|!|\$/u;
|
|
5814
5836
|
const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
|
|
5815
5837
|
/**
|
|
5816
5838
|
* A "Symbol" is just basically any word-like element that can appear in a
|
|
@@ -5851,7 +5873,8 @@
|
|
|
5851
5873
|
};
|
|
5852
5874
|
}
|
|
5853
5875
|
}
|
|
5854
|
-
while (chars.current &&
|
|
5876
|
+
while (chars.current &&
|
|
5877
|
+
(SYMBOL_CHARS.has(chars.current) || chars.current.match(unicodeSymbolCharRegexp))) {
|
|
5855
5878
|
result += chars.shift();
|
|
5856
5879
|
}
|
|
5857
5880
|
if (result.length) {
|
|
@@ -6963,6 +6986,7 @@
|
|
|
6963
6986
|
|
|
6964
6987
|
class ConditionalFormatClipboardHandler extends AbstractCellClipboardHandler {
|
|
6965
6988
|
uuidGenerator = new UuidGenerator();
|
|
6989
|
+
queuedChanges = {};
|
|
6966
6990
|
copy(data) {
|
|
6967
6991
|
if (!data.zones.length) {
|
|
6968
6992
|
return;
|
|
@@ -6984,6 +7008,7 @@
|
|
|
6984
7008
|
return { cfRules };
|
|
6985
7009
|
}
|
|
6986
7010
|
paste(target, clippedContent, options) {
|
|
7011
|
+
this.queuedChanges = {};
|
|
6987
7012
|
if (options.pasteOption === "asValue") {
|
|
6988
7013
|
return;
|
|
6989
7014
|
}
|
|
@@ -6995,6 +7020,7 @@
|
|
|
6995
7020
|
else {
|
|
6996
7021
|
this.pasteFromCut(sheetId, zones, clippedContent);
|
|
6997
7022
|
}
|
|
7023
|
+
this.executeQueuedChanges();
|
|
6998
7024
|
}
|
|
6999
7025
|
pasteFromCut(sheetId, target, content) {
|
|
7000
7026
|
const selection = target[0];
|
|
@@ -7012,12 +7038,13 @@
|
|
|
7012
7038
|
}
|
|
7013
7039
|
pasteCf(origin, target, isCutOperation) {
|
|
7014
7040
|
if (origin?.rules && origin.rules.length > 0) {
|
|
7041
|
+
const originZone = positionToZone(origin.position);
|
|
7015
7042
|
const zone = positionToZone(target);
|
|
7016
7043
|
for (const rule of origin.rules) {
|
|
7017
7044
|
const toRemoveZones = [];
|
|
7018
7045
|
if (isCutOperation) {
|
|
7019
7046
|
//remove from current rule
|
|
7020
|
-
toRemoveZones.push(
|
|
7047
|
+
toRemoveZones.push(originZone);
|
|
7021
7048
|
}
|
|
7022
7049
|
if (origin.position.sheetId === target.sheetId) {
|
|
7023
7050
|
this.adaptCFRules(origin.position.sheetId, rule, [zone], toRemoveZones);
|
|
@@ -7034,36 +7061,56 @@
|
|
|
7034
7061
|
* Add or remove cells to a given conditional formatting rule.
|
|
7035
7062
|
*/
|
|
7036
7063
|
adaptCFRules(sheetId, cf, toAdd, toRemove) {
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
return;
|
|
7064
|
+
if (!this.queuedChanges[sheetId]) {
|
|
7065
|
+
this.queuedChanges[sheetId] = [];
|
|
7040
7066
|
}
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7067
|
+
const queuedChange = this.queuedChanges[sheetId].find((queued) => queued.cf.id === cf.id);
|
|
7068
|
+
if (!queuedChange) {
|
|
7069
|
+
this.queuedChanges[sheetId].push({ toAdd, toRemove, cf });
|
|
7070
|
+
}
|
|
7071
|
+
else {
|
|
7072
|
+
queuedChange.toAdd.push(...toAdd);
|
|
7073
|
+
queuedChange.toRemove.push(...toRemove);
|
|
7074
|
+
}
|
|
7075
|
+
}
|
|
7076
|
+
executeQueuedChanges() {
|
|
7077
|
+
for (const sheetId in this.queuedChanges) {
|
|
7078
|
+
for (const { toAdd, toRemove, cf } of this.queuedChanges[sheetId]) {
|
|
7079
|
+
const newRangesXc = this.getters.getAdaptedCfRanges(sheetId, cf, toAdd, toRemove);
|
|
7080
|
+
if (!newRangesXc) {
|
|
7081
|
+
continue;
|
|
7082
|
+
}
|
|
7083
|
+
if (newRangesXc.length === 0) {
|
|
7084
|
+
this.dispatch("REMOVE_CONDITIONAL_FORMAT", { id: cf.id, sheetId });
|
|
7085
|
+
continue;
|
|
7086
|
+
}
|
|
7087
|
+
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
7088
|
+
cf: {
|
|
7089
|
+
id: cf.id,
|
|
7090
|
+
rule: cf.rule,
|
|
7091
|
+
stopIfTrue: cf.stopIfTrue,
|
|
7092
|
+
},
|
|
7093
|
+
ranges: newRangesXc,
|
|
7094
|
+
sheetId,
|
|
7095
|
+
});
|
|
7096
|
+
}
|
|
7044
7097
|
}
|
|
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
7098
|
}
|
|
7055
7099
|
getCFToCopyTo(targetSheetId, originCF) {
|
|
7056
|
-
|
|
7100
|
+
let targetCF = this.getters
|
|
7057
7101
|
.getConditionalFormats(targetSheetId)
|
|
7058
7102
|
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7103
|
+
const queuedCfs = this.queuedChanges[targetSheetId];
|
|
7104
|
+
if (!targetCF && queuedCfs) {
|
|
7105
|
+
targetCF = queuedCfs.find((queued) => queued.cf.stopIfTrue === originCF.stopIfTrue && deepEquals(queued.cf.rule, originCF.rule))?.cf;
|
|
7106
|
+
}
|
|
7107
|
+
return targetCF || { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
|
|
7062
7108
|
}
|
|
7063
7109
|
}
|
|
7064
7110
|
|
|
7065
7111
|
class DataValidationClipboardHandler extends AbstractCellClipboardHandler {
|
|
7066
7112
|
uuidGenerator = new UuidGenerator();
|
|
7113
|
+
queuedChanges = {};
|
|
7067
7114
|
copy(data) {
|
|
7068
7115
|
const { rowsIndexes, columnsIndexes } = data;
|
|
7069
7116
|
const sheetId = data.sheetId;
|
|
@@ -7080,6 +7127,7 @@
|
|
|
7080
7127
|
return { dvRules };
|
|
7081
7128
|
}
|
|
7082
7129
|
paste(target, clippedContent, options) {
|
|
7130
|
+
this.queuedChanges = {};
|
|
7083
7131
|
if (options.pasteOption) {
|
|
7084
7132
|
return;
|
|
7085
7133
|
}
|
|
@@ -7091,6 +7139,7 @@
|
|
|
7091
7139
|
else {
|
|
7092
7140
|
this.pasteFromCut(sheetId, zones, clippedContent);
|
|
7093
7141
|
}
|
|
7142
|
+
this.executeQueuedChanges();
|
|
7094
7143
|
}
|
|
7095
7144
|
pasteFromCut(sheetId, target, content) {
|
|
7096
7145
|
const selection = target[0];
|
|
@@ -7109,6 +7158,7 @@
|
|
|
7109
7158
|
pasteDataValidation(origin, target, isCutOperation) {
|
|
7110
7159
|
if (origin) {
|
|
7111
7160
|
const zone = positionToZone(target);
|
|
7161
|
+
const originZone = positionToZone(origin.position);
|
|
7112
7162
|
const rule = origin.rule;
|
|
7113
7163
|
if (!rule) {
|
|
7114
7164
|
const targetRule = this.getters.getValidationRuleForCell(target);
|
|
@@ -7120,7 +7170,7 @@
|
|
|
7120
7170
|
}
|
|
7121
7171
|
const toRemoveZone = [];
|
|
7122
7172
|
if (isCutOperation) {
|
|
7123
|
-
toRemoveZone.push(
|
|
7173
|
+
toRemoveZone.push(originZone);
|
|
7124
7174
|
}
|
|
7125
7175
|
if (origin.position.sheetId === target.sheetId) {
|
|
7126
7176
|
const copyToRule = this.getDataValidationRuleToCopyTo(target.sheetId, rule, false);
|
|
@@ -7137,29 +7187,55 @@
|
|
|
7137
7187
|
}
|
|
7138
7188
|
}
|
|
7139
7189
|
getDataValidationRuleToCopyTo(targetSheetId, originRule, newId = true) {
|
|
7140
|
-
|
|
7190
|
+
let targetRule = this.getters
|
|
7141
7191
|
.getDataValidationRules(targetSheetId)
|
|
7142
7192
|
.find((rule) => deepEquals(originRule.criterion, rule.criterion) &&
|
|
7143
7193
|
originRule.isBlocking === rule.isBlocking);
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7194
|
+
const queuedRules = this.queuedChanges[targetSheetId];
|
|
7195
|
+
if (!targetRule && queuedRules) {
|
|
7196
|
+
targetRule = queuedRules.find((queued) => deepEquals(originRule.criterion, queued.rule.criterion) &&
|
|
7197
|
+
originRule.isBlocking === queued.rule.isBlocking)?.rule;
|
|
7198
|
+
}
|
|
7199
|
+
return (targetRule || {
|
|
7200
|
+
...originRule,
|
|
7201
|
+
id: newId ? this.uuidGenerator.uuidv4() : originRule.id,
|
|
7202
|
+
ranges: [],
|
|
7203
|
+
});
|
|
7147
7204
|
}
|
|
7148
7205
|
/**
|
|
7149
7206
|
* Add or remove XCs to a given data validation rule.
|
|
7150
7207
|
*/
|
|
7151
7208
|
adaptDataValidationRule(sheetId, rule, toAdd, toRemove) {
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7209
|
+
if (!this.queuedChanges[sheetId]) {
|
|
7210
|
+
this.queuedChanges[sheetId] = [];
|
|
7211
|
+
}
|
|
7212
|
+
const queuedChange = this.queuedChanges[sheetId].find((queued) => queued.rule.id === rule.id);
|
|
7213
|
+
if (!queuedChange) {
|
|
7214
|
+
this.queuedChanges[sheetId].push({ toAdd, toRemove, rule });
|
|
7215
|
+
}
|
|
7216
|
+
else {
|
|
7217
|
+
queuedChange.toAdd.push(...toAdd);
|
|
7218
|
+
queuedChange.toRemove.push(...toRemove);
|
|
7219
|
+
}
|
|
7220
|
+
}
|
|
7221
|
+
executeQueuedChanges() {
|
|
7222
|
+
for (const sheetId in this.queuedChanges) {
|
|
7223
|
+
for (const { toAdd, toRemove, rule: dv } of this.queuedChanges[sheetId]) {
|
|
7224
|
+
// Remove the zones first in case the same position is in toAdd and toRemove
|
|
7225
|
+
const dvZones = dv.ranges.map((range) => range.zone);
|
|
7226
|
+
const withRemovedZones = recomputeZones(dvZones, toRemove);
|
|
7227
|
+
const newDvZones = recomputeZones([...withRemovedZones, ...toAdd], []);
|
|
7228
|
+
if (newDvZones.length === 0) {
|
|
7229
|
+
this.dispatch("REMOVE_DATA_VALIDATION_RULE", { sheetId, id: dv.id });
|
|
7230
|
+
continue;
|
|
7231
|
+
}
|
|
7232
|
+
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
7233
|
+
rule: { id: dv.id, criterion: dv.criterion, isBlocking: dv.isBlocking },
|
|
7234
|
+
ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
7235
|
+
sheetId,
|
|
7236
|
+
});
|
|
7237
|
+
}
|
|
7157
7238
|
}
|
|
7158
|
-
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
7159
|
-
rule,
|
|
7160
|
-
ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
7161
|
-
sheetId,
|
|
7162
|
-
});
|
|
7163
7239
|
}
|
|
7164
7240
|
}
|
|
7165
7241
|
|
|
@@ -7485,7 +7561,7 @@
|
|
|
7485
7561
|
if (executed.type === "ADD_COLUMNS_ROWS") {
|
|
7486
7562
|
return expandZoneOnInsertion(zone, executed.dimension === "COL" ? "left" : "top", executed.base, executed.position, executed.quantity);
|
|
7487
7563
|
}
|
|
7488
|
-
return
|
|
7564
|
+
return zone;
|
|
7489
7565
|
}
|
|
7490
7566
|
function transformRangeData(range, executed) {
|
|
7491
7567
|
const deletedSheet = executed.type === "DELETE_SHEET" && executed.sheetId;
|
|
@@ -47562,6 +47638,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47562
47638
|
case "SET_BORDER":
|
|
47563
47639
|
this.setBorder(cmd.sheetId, cmd.col, cmd.row, cmd.border);
|
|
47564
47640
|
break;
|
|
47641
|
+
case "SET_BORDERS_ON_TARGET":
|
|
47642
|
+
for (const zone of cmd.target) {
|
|
47643
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
47644
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
47645
|
+
this.setBorder(cmd.sheetId, col, row, cmd.border);
|
|
47646
|
+
}
|
|
47647
|
+
}
|
|
47648
|
+
}
|
|
47649
|
+
break;
|
|
47565
47650
|
case "SET_ZONE_BORDERS":
|
|
47566
47651
|
if (cmd.border) {
|
|
47567
47652
|
const target = cmd.target.map((zone) => this.getters.expandZone(cmd.sheetId, zone));
|
|
@@ -49040,8 +49125,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49040
49125
|
if (replaceIndex > -1) {
|
|
49041
49126
|
currentRanges = rules[replaceIndex].ranges.map(toUnboundedZone);
|
|
49042
49127
|
}
|
|
49043
|
-
|
|
49044
|
-
|
|
49128
|
+
// Remove the zones first in case the same position is in toAdd and toRemove
|
|
49129
|
+
const withRemovedZones = recomputeZones(currentRanges, toRemove);
|
|
49130
|
+
return recomputeZones([...toAdd, ...withRemovedZones], []).map((zone) => this.getters.getRangeDataFromZone(sheetId, zone));
|
|
49045
49131
|
}
|
|
49046
49132
|
// ---------------------------------------------------------------------------
|
|
49047
49133
|
// Private
|
|
@@ -56552,25 +56638,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56552
56638
|
case "AUTOFILL_AUTO":
|
|
56553
56639
|
this.autofillAuto();
|
|
56554
56640
|
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
56641
|
}
|
|
56575
56642
|
}
|
|
56576
56643
|
// ---------------------------------------------------------------------------
|
|
@@ -56594,6 +56661,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56594
56661
|
}
|
|
56595
56662
|
const source = this.getters.getSelectedZone();
|
|
56596
56663
|
const target = this.autofillZone;
|
|
56664
|
+
const autofillCellsData = [];
|
|
56597
56665
|
switch (this.direction) {
|
|
56598
56666
|
case "down" /* DIRECTION.DOWN */:
|
|
56599
56667
|
for (let col = source.left; col <= source.right; col++) {
|
|
@@ -56603,7 +56671,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56603
56671
|
}
|
|
56604
56672
|
const generator = this.createGenerator(xcs);
|
|
56605
56673
|
for (let row = target.top; row <= target.bottom; row++) {
|
|
56606
|
-
this.computeNewCell(generator, col, row
|
|
56674
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
56607
56675
|
}
|
|
56608
56676
|
}
|
|
56609
56677
|
break;
|
|
@@ -56615,7 +56683,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56615
56683
|
}
|
|
56616
56684
|
const generator = this.createGenerator(xcs);
|
|
56617
56685
|
for (let row = target.bottom; row >= target.top; row--) {
|
|
56618
|
-
this.computeNewCell(generator, col, row
|
|
56686
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
56619
56687
|
}
|
|
56620
56688
|
}
|
|
56621
56689
|
break;
|
|
@@ -56627,7 +56695,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56627
56695
|
}
|
|
56628
56696
|
const generator = this.createGenerator(xcs);
|
|
56629
56697
|
for (let col = target.right; col >= target.left; col--) {
|
|
56630
|
-
this.computeNewCell(generator, col, row
|
|
56698
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
56631
56699
|
}
|
|
56632
56700
|
}
|
|
56633
56701
|
break;
|
|
@@ -56639,12 +56707,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56639
56707
|
}
|
|
56640
56708
|
const generator = this.createGenerator(xcs);
|
|
56641
56709
|
for (let col = target.left; col <= target.right; col++) {
|
|
56642
|
-
this.computeNewCell(generator, col, row
|
|
56710
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
56643
56711
|
}
|
|
56644
56712
|
}
|
|
56645
56713
|
break;
|
|
56646
56714
|
}
|
|
56647
56715
|
if (apply) {
|
|
56716
|
+
const bordersZones = {};
|
|
56717
|
+
const cfNewRanges = {};
|
|
56718
|
+
const dvNewZones = {};
|
|
56719
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
56720
|
+
for (const data of autofillCellsData) {
|
|
56721
|
+
this.collectBordersData(data, bordersZones);
|
|
56722
|
+
this.autofillMerge(sheetId, data);
|
|
56723
|
+
this.autofillCell(sheetId, data);
|
|
56724
|
+
this.collectConditionalFormatsData(sheetId, data, cfNewRanges);
|
|
56725
|
+
this.collectDataValidationsData(sheetId, data, dvNewZones);
|
|
56726
|
+
}
|
|
56727
|
+
this.autofillBorders(sheetId, bordersZones);
|
|
56728
|
+
this.autofillConditionalFormats(sheetId, cfNewRanges);
|
|
56729
|
+
this.autofillDataValidations(sheetId, dvNewZones);
|
|
56648
56730
|
this.autofillZone = undefined;
|
|
56649
56731
|
this.selection.resizeAnchorZone(this.direction, this.steps);
|
|
56650
56732
|
this.lastCellSelected = {};
|
|
@@ -56653,6 +56735,95 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56653
56735
|
this.tooltip = undefined;
|
|
56654
56736
|
}
|
|
56655
56737
|
}
|
|
56738
|
+
collectBordersData(data, bordersPositions) {
|
|
56739
|
+
const key = JSON.stringify(data.border);
|
|
56740
|
+
if (!(key in bordersPositions)) {
|
|
56741
|
+
bordersPositions[key] = [];
|
|
56742
|
+
}
|
|
56743
|
+
bordersPositions[key].push(positionToZone({ col: data.col, row: data.row }));
|
|
56744
|
+
}
|
|
56745
|
+
collectConditionalFormatsData(sheetId, data, cfNewRanges) {
|
|
56746
|
+
const { originCol, originRow, col, row } = data;
|
|
56747
|
+
const cfsAtOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
56748
|
+
const xc = toXC(col, row);
|
|
56749
|
+
for (const cf of cfsAtOrigin) {
|
|
56750
|
+
if (!(cf.id in cfNewRanges)) {
|
|
56751
|
+
cfNewRanges[cf.id] = [];
|
|
56752
|
+
}
|
|
56753
|
+
cfNewRanges[cf.id].push(xc);
|
|
56754
|
+
}
|
|
56755
|
+
}
|
|
56756
|
+
collectDataValidationsData(sheetId, data, dvNewZones) {
|
|
56757
|
+
const { originCol, originRow, col, row } = data;
|
|
56758
|
+
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
56759
|
+
const dvsAtOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
56760
|
+
if (!dvsAtOrigin) {
|
|
56761
|
+
return;
|
|
56762
|
+
}
|
|
56763
|
+
if (!(dvsAtOrigin.id in dvNewZones)) {
|
|
56764
|
+
dvNewZones[dvsAtOrigin.id] = [];
|
|
56765
|
+
}
|
|
56766
|
+
dvNewZones[dvsAtOrigin.id].push(positionToZone({ col, row }));
|
|
56767
|
+
}
|
|
56768
|
+
autofillCell(sheetId, data) {
|
|
56769
|
+
this.dispatch("UPDATE_CELL", {
|
|
56770
|
+
sheetId,
|
|
56771
|
+
col: data.col,
|
|
56772
|
+
row: data.row,
|
|
56773
|
+
content: data.content || "",
|
|
56774
|
+
style: data.style || null,
|
|
56775
|
+
format: data.format || "",
|
|
56776
|
+
});
|
|
56777
|
+
// Still usefull in odoo ATM to autofill field sync
|
|
56778
|
+
this.dispatch("AUTOFILL_CELL", data);
|
|
56779
|
+
}
|
|
56780
|
+
autofillBorders(sheetId, bordersPositions) {
|
|
56781
|
+
for (const stringifiedBorder in bordersPositions) {
|
|
56782
|
+
const border = stringifiedBorder === "undefined" ? undefined : JSON.parse(stringifiedBorder);
|
|
56783
|
+
this.dispatch("SET_BORDERS_ON_TARGET", {
|
|
56784
|
+
sheetId,
|
|
56785
|
+
border,
|
|
56786
|
+
target: recomputeZones(bordersPositions[stringifiedBorder]),
|
|
56787
|
+
});
|
|
56788
|
+
}
|
|
56789
|
+
}
|
|
56790
|
+
autofillConditionalFormats(sheetId, cfNewRanges) {
|
|
56791
|
+
for (const cfId in cfNewRanges) {
|
|
56792
|
+
const changes = cfNewRanges[cfId];
|
|
56793
|
+
const cf = this.getters.getConditionalFormats(sheetId).find((cf) => cf.id === cfId);
|
|
56794
|
+
if (!cf) {
|
|
56795
|
+
continue;
|
|
56796
|
+
}
|
|
56797
|
+
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, changes.map(toZone), []);
|
|
56798
|
+
if (newCfRanges) {
|
|
56799
|
+
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
56800
|
+
cf: {
|
|
56801
|
+
id: cf.id,
|
|
56802
|
+
rule: cf.rule,
|
|
56803
|
+
stopIfTrue: cf.stopIfTrue,
|
|
56804
|
+
},
|
|
56805
|
+
ranges: newCfRanges,
|
|
56806
|
+
sheetId,
|
|
56807
|
+
});
|
|
56808
|
+
}
|
|
56809
|
+
}
|
|
56810
|
+
}
|
|
56811
|
+
autofillDataValidations(sheetId, dvNewZones) {
|
|
56812
|
+
for (const dvId in dvNewZones) {
|
|
56813
|
+
const changes = dvNewZones[dvId];
|
|
56814
|
+
const dvOrigin = this.getters.getDataValidationRule(sheetId, dvId);
|
|
56815
|
+
if (!dvOrigin) {
|
|
56816
|
+
continue;
|
|
56817
|
+
}
|
|
56818
|
+
const dvRangesXcs = dvOrigin.ranges.map((range) => range.zone);
|
|
56819
|
+
const newDvRanges = recomputeZones(dvRangesXcs.concat(changes), []);
|
|
56820
|
+
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
56821
|
+
rule: dvOrigin,
|
|
56822
|
+
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
56823
|
+
sheetId,
|
|
56824
|
+
});
|
|
56825
|
+
}
|
|
56826
|
+
}
|
|
56656
56827
|
/**
|
|
56657
56828
|
* Select a cell which becomes the last cell of the autofillZone
|
|
56658
56829
|
*/
|
|
@@ -56731,22 +56902,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56731
56902
|
/**
|
|
56732
56903
|
* Generate the next cell
|
|
56733
56904
|
*/
|
|
56734
|
-
computeNewCell(generator, col, row
|
|
56905
|
+
computeNewCell(generator, col, row) {
|
|
56735
56906
|
const { cellData, tooltip, origin } = generator.next();
|
|
56736
56907
|
const { content, style, border, format } = cellData;
|
|
56737
56908
|
this.tooltip = tooltip;
|
|
56738
|
-
|
|
56739
|
-
|
|
56740
|
-
|
|
56741
|
-
|
|
56742
|
-
|
|
56743
|
-
|
|
56744
|
-
|
|
56745
|
-
|
|
56746
|
-
|
|
56747
|
-
|
|
56748
|
-
});
|
|
56749
|
-
}
|
|
56909
|
+
return {
|
|
56910
|
+
originCol: origin.col,
|
|
56911
|
+
originRow: origin.row,
|
|
56912
|
+
col,
|
|
56913
|
+
row,
|
|
56914
|
+
content,
|
|
56915
|
+
style,
|
|
56916
|
+
border,
|
|
56917
|
+
format,
|
|
56918
|
+
};
|
|
56750
56919
|
}
|
|
56751
56920
|
/**
|
|
56752
56921
|
* Get the rule associated to the current cell
|
|
@@ -56814,8 +56983,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56814
56983
|
? position[first].value
|
|
56815
56984
|
: position[second].value;
|
|
56816
56985
|
}
|
|
56817
|
-
|
|
56818
|
-
const
|
|
56986
|
+
autofillMerge(sheetId, data) {
|
|
56987
|
+
const { originCol, originRow, col, row } = data;
|
|
56819
56988
|
const position = { sheetId, col, row };
|
|
56820
56989
|
const originPosition = { sheetId, col: originCol, row: originRow };
|
|
56821
56990
|
if (this.getters.isInMerge(position) && !this.getters.isInMerge(originPosition)) {
|
|
@@ -56842,35 +57011,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56842
57011
|
});
|
|
56843
57012
|
}
|
|
56844
57013
|
}
|
|
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
57014
|
// ---------------------------------------------------------------------------
|
|
56875
57015
|
// Grid rendering
|
|
56876
57016
|
// ---------------------------------------------------------------------------
|
|
@@ -57250,10 +57390,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57250
57390
|
}
|
|
57251
57391
|
const target = [];
|
|
57252
57392
|
for (const zone1 of toTransform.target) {
|
|
57253
|
-
|
|
57254
|
-
|
|
57255
|
-
target.push({ ...zone1 });
|
|
57256
|
-
}
|
|
57393
|
+
if (executed.target.every((zone2) => !overlap(zone1, zone2))) {
|
|
57394
|
+
target.push(zone1);
|
|
57257
57395
|
}
|
|
57258
57396
|
}
|
|
57259
57397
|
if (target.length) {
|
|
@@ -69242,9 +69380,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
69242
69380
|
exports.tokenize = tokenize;
|
|
69243
69381
|
|
|
69244
69382
|
|
|
69245
|
-
__info__.version = "17.4.
|
|
69246
|
-
__info__.date = "2025-04-
|
|
69247
|
-
__info__.hash = "
|
|
69383
|
+
__info__.version = "17.4.31";
|
|
69384
|
+
__info__.date = "2025-04-18T16:24:47.716Z";
|
|
69385
|
+
__info__.hash = "7991032";
|
|
69248
69386
|
|
|
69249
69387
|
|
|
69250
69388
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|