@odoo/o-spreadsheet 18.2.6 → 18.2.7
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.2.
|
|
6
|
-
* @date 2025-04-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.2.7
|
|
6
|
+
* @date 2025-04-14T17:19:31.011Z
|
|
7
|
+
* @hash e187958
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -3574,6 +3574,7 @@
|
|
|
3574
3574
|
"CLEAR_FORMATTING",
|
|
3575
3575
|
"SET_BORDER",
|
|
3576
3576
|
"SET_ZONE_BORDERS",
|
|
3577
|
+
"SET_BORDERS_ON_TARGET",
|
|
3577
3578
|
/** CHART */
|
|
3578
3579
|
"CREATE_CHART",
|
|
3579
3580
|
"UPDATE_CHART",
|
|
@@ -6723,6 +6724,7 @@
|
|
|
6723
6724
|
}
|
|
6724
6725
|
|
|
6725
6726
|
class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
6727
|
+
queuedBordersToAdd = {};
|
|
6726
6728
|
copy(data) {
|
|
6727
6729
|
const sheetId = data.sheetId;
|
|
6728
6730
|
if (data.zones.length === 0) {
|
|
@@ -6753,6 +6755,7 @@
|
|
|
6753
6755
|
const { left, top } = zones[0];
|
|
6754
6756
|
this.pasteZone(sheetId, left, top, content.borders);
|
|
6755
6757
|
}
|
|
6758
|
+
this.executeQueuedChanges(sheetId);
|
|
6756
6759
|
}
|
|
6757
6760
|
pasteZone(sheetId, col, row, borders) {
|
|
6758
6761
|
for (const [r, rowBorders] of borders.entries()) {
|
|
@@ -6771,7 +6774,20 @@
|
|
|
6771
6774
|
...targetBorders,
|
|
6772
6775
|
...originBorders,
|
|
6773
6776
|
};
|
|
6774
|
-
|
|
6777
|
+
const borderKey = JSON.stringify(border);
|
|
6778
|
+
if (!this.queuedBordersToAdd[borderKey]) {
|
|
6779
|
+
this.queuedBordersToAdd[borderKey] = [];
|
|
6780
|
+
}
|
|
6781
|
+
this.queuedBordersToAdd[borderKey].push(positionToZone(target));
|
|
6782
|
+
}
|
|
6783
|
+
executeQueuedChanges(pasteSheetTarget) {
|
|
6784
|
+
for (const borderKey in this.queuedBordersToAdd) {
|
|
6785
|
+
const zones = this.queuedBordersToAdd[borderKey];
|
|
6786
|
+
const border = JSON.parse(borderKey);
|
|
6787
|
+
const target = recomputeZones(zones, []);
|
|
6788
|
+
this.dispatch("SET_BORDERS_ON_TARGET", { sheetId: pasteSheetTarget, target, border });
|
|
6789
|
+
}
|
|
6790
|
+
this.queuedBordersToAdd = {};
|
|
6775
6791
|
}
|
|
6776
6792
|
}
|
|
6777
6793
|
|
|
@@ -8711,12 +8727,13 @@
|
|
|
8711
8727
|
}
|
|
8712
8728
|
pasteCf(origin, target, isCutOperation) {
|
|
8713
8729
|
if (origin?.rules && origin.rules.length > 0) {
|
|
8730
|
+
const originZone = positionToZone(origin.position);
|
|
8714
8731
|
const zone = positionToZone(target);
|
|
8715
8732
|
for (const rule of origin.rules) {
|
|
8716
8733
|
const toRemoveZones = [];
|
|
8717
8734
|
if (isCutOperation) {
|
|
8718
8735
|
//remove from current rule
|
|
8719
|
-
toRemoveZones.push(
|
|
8736
|
+
toRemoveZones.push(originZone);
|
|
8720
8737
|
}
|
|
8721
8738
|
if (origin.position.sheetId === target.sheetId) {
|
|
8722
8739
|
this.adaptCFRules(origin.position.sheetId, rule, [zone], toRemoveZones);
|
|
@@ -8830,6 +8847,7 @@
|
|
|
8830
8847
|
pasteDataValidation(origin, target, isCutOperation) {
|
|
8831
8848
|
if (origin) {
|
|
8832
8849
|
const zone = positionToZone(target);
|
|
8850
|
+
const originZone = positionToZone(origin.position);
|
|
8833
8851
|
const rule = origin.rule;
|
|
8834
8852
|
if (!rule) {
|
|
8835
8853
|
const targetRule = this.getters.getValidationRuleForCell(target);
|
|
@@ -8841,7 +8859,7 @@
|
|
|
8841
8859
|
}
|
|
8842
8860
|
const toRemoveZone = [];
|
|
8843
8861
|
if (isCutOperation) {
|
|
8844
|
-
toRemoveZone.push(
|
|
8862
|
+
toRemoveZone.push(originZone);
|
|
8845
8863
|
}
|
|
8846
8864
|
if (origin.position.sheetId === target.sheetId) {
|
|
8847
8865
|
const copyToRule = this.getDataValidationRuleToCopyTo(target.sheetId, rule, false);
|
|
@@ -8901,7 +8919,7 @@
|
|
|
8901
8919
|
continue;
|
|
8902
8920
|
}
|
|
8903
8921
|
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
8904
|
-
rule: dv,
|
|
8922
|
+
rule: { id: dv.id, criterion: dv.criterion, isBlocking: dv.isBlocking },
|
|
8905
8923
|
ranges: newDvZones.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
8906
8924
|
sheetId,
|
|
8907
8925
|
});
|
|
@@ -53312,6 +53330,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53312
53330
|
case "SET_BORDER":
|
|
53313
53331
|
this.setBorder(cmd.sheetId, cmd.col, cmd.row, cmd.border);
|
|
53314
53332
|
break;
|
|
53333
|
+
case "SET_BORDERS_ON_TARGET":
|
|
53334
|
+
for (const zone of cmd.target) {
|
|
53335
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
53336
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
53337
|
+
this.setBorder(cmd.sheetId, col, row, cmd.border);
|
|
53338
|
+
}
|
|
53339
|
+
}
|
|
53340
|
+
}
|
|
53341
|
+
break;
|
|
53315
53342
|
case "SET_ZONE_BORDERS":
|
|
53316
53343
|
if (cmd.border) {
|
|
53317
53344
|
const target = cmd.target.map((zone) => this.getters.expandZone(cmd.sheetId, zone));
|
|
@@ -63074,25 +63101,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63074
63101
|
case "AUTOFILL_AUTO":
|
|
63075
63102
|
this.autofillAuto();
|
|
63076
63103
|
break;
|
|
63077
|
-
case "AUTOFILL_CELL":
|
|
63078
|
-
this.autoFillMerge(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
63079
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
63080
|
-
this.dispatch("UPDATE_CELL", {
|
|
63081
|
-
sheetId,
|
|
63082
|
-
col: cmd.col,
|
|
63083
|
-
row: cmd.row,
|
|
63084
|
-
style: cmd.style || null,
|
|
63085
|
-
content: cmd.content || "",
|
|
63086
|
-
format: cmd.format || "",
|
|
63087
|
-
});
|
|
63088
|
-
this.dispatch("SET_BORDER", {
|
|
63089
|
-
sheetId,
|
|
63090
|
-
col: cmd.col,
|
|
63091
|
-
row: cmd.row,
|
|
63092
|
-
border: cmd.border,
|
|
63093
|
-
});
|
|
63094
|
-
this.autofillCF(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
63095
|
-
this.autofillDV(cmd.originCol, cmd.originRow, cmd.col, cmd.row);
|
|
63096
63104
|
}
|
|
63097
63105
|
}
|
|
63098
63106
|
// ---------------------------------------------------------------------------
|
|
@@ -63116,6 +63124,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63116
63124
|
}
|
|
63117
63125
|
const source = this.getters.getSelectedZone();
|
|
63118
63126
|
const target = this.autofillZone;
|
|
63127
|
+
const autofillCellsData = [];
|
|
63119
63128
|
switch (this.direction) {
|
|
63120
63129
|
case "down" /* DIRECTION.DOWN */:
|
|
63121
63130
|
for (let col = source.left; col <= source.right; col++) {
|
|
@@ -63125,7 +63134,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63125
63134
|
}
|
|
63126
63135
|
const generator = this.createGenerator(xcs);
|
|
63127
63136
|
for (let row = target.top; row <= target.bottom; row++) {
|
|
63128
|
-
this.computeNewCell(generator, col, row
|
|
63137
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
63129
63138
|
}
|
|
63130
63139
|
}
|
|
63131
63140
|
break;
|
|
@@ -63137,7 +63146,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63137
63146
|
}
|
|
63138
63147
|
const generator = this.createGenerator(xcs);
|
|
63139
63148
|
for (let row = target.bottom; row >= target.top; row--) {
|
|
63140
|
-
this.computeNewCell(generator, col, row
|
|
63149
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
63141
63150
|
}
|
|
63142
63151
|
}
|
|
63143
63152
|
break;
|
|
@@ -63149,7 +63158,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63149
63158
|
}
|
|
63150
63159
|
const generator = this.createGenerator(xcs);
|
|
63151
63160
|
for (let col = target.right; col >= target.left; col--) {
|
|
63152
|
-
this.computeNewCell(generator, col, row
|
|
63161
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
63153
63162
|
}
|
|
63154
63163
|
}
|
|
63155
63164
|
break;
|
|
@@ -63161,12 +63170,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63161
63170
|
}
|
|
63162
63171
|
const generator = this.createGenerator(xcs);
|
|
63163
63172
|
for (let col = target.left; col <= target.right; col++) {
|
|
63164
|
-
this.computeNewCell(generator, col, row
|
|
63173
|
+
autofillCellsData.push(this.computeNewCell(generator, col, row));
|
|
63165
63174
|
}
|
|
63166
63175
|
}
|
|
63167
63176
|
break;
|
|
63168
63177
|
}
|
|
63169
63178
|
if (apply) {
|
|
63179
|
+
const bordersZones = {};
|
|
63180
|
+
const cfNewRanges = {};
|
|
63181
|
+
const dvNewZones = {};
|
|
63182
|
+
const sheetId = this.getters.getActiveSheetId();
|
|
63183
|
+
for (const data of autofillCellsData) {
|
|
63184
|
+
this.collectBordersData(data, bordersZones);
|
|
63185
|
+
this.autofillMerge(sheetId, data);
|
|
63186
|
+
this.autofillCell(sheetId, data);
|
|
63187
|
+
this.collectConditionalFormatsData(sheetId, data, cfNewRanges);
|
|
63188
|
+
this.collectDataValidationsData(sheetId, data, dvNewZones);
|
|
63189
|
+
}
|
|
63190
|
+
this.autofillBorders(sheetId, bordersZones);
|
|
63191
|
+
this.autofillConditionalFormats(sheetId, cfNewRanges);
|
|
63192
|
+
this.autofillDataValidations(sheetId, dvNewZones);
|
|
63170
63193
|
this.autofillZone = undefined;
|
|
63171
63194
|
this.selection.resizeAnchorZone(this.direction, this.steps);
|
|
63172
63195
|
this.lastCellSelected = {};
|
|
@@ -63175,6 +63198,95 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63175
63198
|
this.tooltip = undefined;
|
|
63176
63199
|
}
|
|
63177
63200
|
}
|
|
63201
|
+
collectBordersData(data, bordersPositions) {
|
|
63202
|
+
const key = JSON.stringify(data.border);
|
|
63203
|
+
if (!(key in bordersPositions)) {
|
|
63204
|
+
bordersPositions[key] = [];
|
|
63205
|
+
}
|
|
63206
|
+
bordersPositions[key].push(positionToZone({ col: data.col, row: data.row }));
|
|
63207
|
+
}
|
|
63208
|
+
collectConditionalFormatsData(sheetId, data, cfNewRanges) {
|
|
63209
|
+
const { originCol, originRow, col, row } = data;
|
|
63210
|
+
const cfsAtOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
63211
|
+
const xc = toXC(col, row);
|
|
63212
|
+
for (const cf of cfsAtOrigin) {
|
|
63213
|
+
if (!(cf.id in cfNewRanges)) {
|
|
63214
|
+
cfNewRanges[cf.id] = [];
|
|
63215
|
+
}
|
|
63216
|
+
cfNewRanges[cf.id].push(xc);
|
|
63217
|
+
}
|
|
63218
|
+
}
|
|
63219
|
+
collectDataValidationsData(sheetId, data, dvNewZones) {
|
|
63220
|
+
const { originCol, originRow, col, row } = data;
|
|
63221
|
+
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
63222
|
+
const dvsAtOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
63223
|
+
if (!dvsAtOrigin) {
|
|
63224
|
+
return;
|
|
63225
|
+
}
|
|
63226
|
+
if (!(dvsAtOrigin.id in dvNewZones)) {
|
|
63227
|
+
dvNewZones[dvsAtOrigin.id] = [];
|
|
63228
|
+
}
|
|
63229
|
+
dvNewZones[dvsAtOrigin.id].push(positionToZone({ col, row }));
|
|
63230
|
+
}
|
|
63231
|
+
autofillCell(sheetId, data) {
|
|
63232
|
+
this.dispatch("UPDATE_CELL", {
|
|
63233
|
+
sheetId,
|
|
63234
|
+
col: data.col,
|
|
63235
|
+
row: data.row,
|
|
63236
|
+
content: data.content || "",
|
|
63237
|
+
style: data.style || null,
|
|
63238
|
+
format: data.format || "",
|
|
63239
|
+
});
|
|
63240
|
+
// Still usefull in odoo ATM to autofill field sync
|
|
63241
|
+
this.dispatch("AUTOFILL_CELL", data);
|
|
63242
|
+
}
|
|
63243
|
+
autofillBorders(sheetId, bordersPositions) {
|
|
63244
|
+
for (const stringifiedBorder in bordersPositions) {
|
|
63245
|
+
const border = stringifiedBorder === "undefined" ? undefined : JSON.parse(stringifiedBorder);
|
|
63246
|
+
this.dispatch("SET_BORDERS_ON_TARGET", {
|
|
63247
|
+
sheetId,
|
|
63248
|
+
border,
|
|
63249
|
+
target: recomputeZones(bordersPositions[stringifiedBorder]),
|
|
63250
|
+
});
|
|
63251
|
+
}
|
|
63252
|
+
}
|
|
63253
|
+
autofillConditionalFormats(sheetId, cfNewRanges) {
|
|
63254
|
+
for (const cfId in cfNewRanges) {
|
|
63255
|
+
const changes = cfNewRanges[cfId];
|
|
63256
|
+
const cf = this.getters.getConditionalFormats(sheetId).find((cf) => cf.id === cfId);
|
|
63257
|
+
if (!cf) {
|
|
63258
|
+
continue;
|
|
63259
|
+
}
|
|
63260
|
+
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, changes.map(toZone), []);
|
|
63261
|
+
if (newCfRanges) {
|
|
63262
|
+
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
63263
|
+
cf: {
|
|
63264
|
+
id: cf.id,
|
|
63265
|
+
rule: cf.rule,
|
|
63266
|
+
stopIfTrue: cf.stopIfTrue,
|
|
63267
|
+
},
|
|
63268
|
+
ranges: newCfRanges,
|
|
63269
|
+
sheetId,
|
|
63270
|
+
});
|
|
63271
|
+
}
|
|
63272
|
+
}
|
|
63273
|
+
}
|
|
63274
|
+
autofillDataValidations(sheetId, dvNewZones) {
|
|
63275
|
+
for (const dvId in dvNewZones) {
|
|
63276
|
+
const changes = dvNewZones[dvId];
|
|
63277
|
+
const dvOrigin = this.getters.getDataValidationRule(sheetId, dvId);
|
|
63278
|
+
if (!dvOrigin) {
|
|
63279
|
+
continue;
|
|
63280
|
+
}
|
|
63281
|
+
const dvRangesXcs = dvOrigin.ranges.map((range) => range.zone);
|
|
63282
|
+
const newDvRanges = recomputeZones(dvRangesXcs.concat(changes), []);
|
|
63283
|
+
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
63284
|
+
rule: dvOrigin,
|
|
63285
|
+
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
63286
|
+
sheetId,
|
|
63287
|
+
});
|
|
63288
|
+
}
|
|
63289
|
+
}
|
|
63178
63290
|
/**
|
|
63179
63291
|
* Select a cell which becomes the last cell of the autofillZone
|
|
63180
63292
|
*/
|
|
@@ -63253,22 +63365,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63253
63365
|
/**
|
|
63254
63366
|
* Generate the next cell
|
|
63255
63367
|
*/
|
|
63256
|
-
computeNewCell(generator, col, row
|
|
63368
|
+
computeNewCell(generator, col, row) {
|
|
63257
63369
|
const { cellData, tooltip, origin } = generator.next();
|
|
63258
63370
|
const { content, style, border, format } = cellData;
|
|
63259
63371
|
this.tooltip = tooltip;
|
|
63260
|
-
|
|
63261
|
-
|
|
63262
|
-
|
|
63263
|
-
|
|
63264
|
-
|
|
63265
|
-
|
|
63266
|
-
|
|
63267
|
-
|
|
63268
|
-
|
|
63269
|
-
|
|
63270
|
-
});
|
|
63271
|
-
}
|
|
63372
|
+
return {
|
|
63373
|
+
originCol: origin.col,
|
|
63374
|
+
originRow: origin.row,
|
|
63375
|
+
col,
|
|
63376
|
+
row,
|
|
63377
|
+
content,
|
|
63378
|
+
style,
|
|
63379
|
+
border,
|
|
63380
|
+
format,
|
|
63381
|
+
};
|
|
63272
63382
|
}
|
|
63273
63383
|
/**
|
|
63274
63384
|
* Get the rule associated to the current cell
|
|
@@ -63336,8 +63446,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63336
63446
|
? position[first].value
|
|
63337
63447
|
: position[second].value;
|
|
63338
63448
|
}
|
|
63339
|
-
|
|
63340
|
-
const
|
|
63449
|
+
autofillMerge(sheetId, data) {
|
|
63450
|
+
const { originCol, originRow, col, row } = data;
|
|
63341
63451
|
const position = { sheetId, col, row };
|
|
63342
63452
|
const originPosition = { sheetId, col: originCol, row: originRow };
|
|
63343
63453
|
if (this.getters.isInMerge(position) && !this.getters.isInMerge(originPosition)) {
|
|
@@ -63364,35 +63474,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63364
63474
|
});
|
|
63365
63475
|
}
|
|
63366
63476
|
}
|
|
63367
|
-
autofillCF(originCol, originRow, col, row) {
|
|
63368
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
63369
|
-
const cfOrigin = this.getters.getRulesByCell(sheetId, originCol, originRow);
|
|
63370
|
-
for (const cf of cfOrigin) {
|
|
63371
|
-
const newCfRanges = this.getters.getAdaptedCfRanges(sheetId, cf, [positionToZone({ col, row })], []);
|
|
63372
|
-
if (newCfRanges) {
|
|
63373
|
-
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
63374
|
-
cf: deepCopy(cf),
|
|
63375
|
-
ranges: newCfRanges,
|
|
63376
|
-
sheetId,
|
|
63377
|
-
});
|
|
63378
|
-
}
|
|
63379
|
-
}
|
|
63380
|
-
}
|
|
63381
|
-
autofillDV(originCol, originRow, col, row) {
|
|
63382
|
-
const sheetId = this.getters.getActiveSheetId();
|
|
63383
|
-
const cellPosition = { sheetId, col: originCol, row: originRow };
|
|
63384
|
-
const dvOrigin = this.getters.getValidationRuleForCell(cellPosition);
|
|
63385
|
-
if (!dvOrigin) {
|
|
63386
|
-
return;
|
|
63387
|
-
}
|
|
63388
|
-
const dvRangesZones = dvOrigin.ranges.map((range) => range.zone);
|
|
63389
|
-
const newDvRanges = recomputeZones(dvRangesZones.concat(positionToZone({ col, row })), []);
|
|
63390
|
-
this.dispatch("ADD_DATA_VALIDATION_RULE", {
|
|
63391
|
-
rule: dvOrigin,
|
|
63392
|
-
ranges: newDvRanges.map((zone) => this.getters.getRangeDataFromZone(sheetId, zone)),
|
|
63393
|
-
sheetId,
|
|
63394
|
-
});
|
|
63395
|
-
}
|
|
63396
63477
|
// ---------------------------------------------------------------------------
|
|
63397
63478
|
// Grid rendering
|
|
63398
63479
|
// ---------------------------------------------------------------------------
|
|
@@ -76108,9 +76189,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76108
76189
|
exports.tokenize = tokenize;
|
|
76109
76190
|
|
|
76110
76191
|
|
|
76111
|
-
__info__.version = "18.2.
|
|
76112
|
-
__info__.date = "2025-04-
|
|
76113
|
-
__info__.hash = "
|
|
76192
|
+
__info__.version = "18.2.7";
|
|
76193
|
+
__info__.date = "2025-04-14T17:19:31.011Z";
|
|
76194
|
+
__info__.hash = "e187958";
|
|
76114
76195
|
|
|
76115
76196
|
|
|
76116
76197
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|