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