@odoo/o-spreadsheet 18.1.26 → 18.1.27
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 +104 -61
- package/dist/o-spreadsheet.d.ts +8 -8
- package/dist/o-spreadsheet.esm.js +104 -61
- package/dist/o-spreadsheet.iife.js +104 -61
- package/dist/o-spreadsheet.iife.min.js +179 -179
- 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.1.
|
|
6
|
-
* @date 2025-06-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.27
|
|
6
|
+
* @date 2025-06-23T15:04:51.792Z
|
|
7
|
+
* @hash b25bcc7
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -6817,6 +6817,63 @@
|
|
|
6817
6817
|
data: spreadsheetContent,
|
|
6818
6818
|
};
|
|
6819
6819
|
}
|
|
6820
|
+
/**
|
|
6821
|
+
* Applies each clipboard handler to paste its corresponding data into the target.
|
|
6822
|
+
*/
|
|
6823
|
+
const applyClipboardHandlersPaste = (handlers, copiedData, target, options) => {
|
|
6824
|
+
handlers.forEach(({ handlerName, handler }) => {
|
|
6825
|
+
const data = copiedData[handlerName];
|
|
6826
|
+
if (data) {
|
|
6827
|
+
handler.paste(target, data, options);
|
|
6828
|
+
}
|
|
6829
|
+
});
|
|
6830
|
+
};
|
|
6831
|
+
/**
|
|
6832
|
+
* Returns the paste target based on clipboard handlers.
|
|
6833
|
+
* Also includes the full affected zone and the list of pasted zones for selection.
|
|
6834
|
+
*/
|
|
6835
|
+
function getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options) {
|
|
6836
|
+
let zone = undefined;
|
|
6837
|
+
let selectedZones = [];
|
|
6838
|
+
let target = {
|
|
6839
|
+
sheetId,
|
|
6840
|
+
zones,
|
|
6841
|
+
};
|
|
6842
|
+
for (const { handlerName, handler } of handlers) {
|
|
6843
|
+
const handlerData = copiedData[handlerName];
|
|
6844
|
+
if (!handlerData) {
|
|
6845
|
+
continue;
|
|
6846
|
+
}
|
|
6847
|
+
const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
|
|
6848
|
+
if (currentTarget.figureId) {
|
|
6849
|
+
target.figureId = currentTarget.figureId;
|
|
6850
|
+
}
|
|
6851
|
+
for (const targetZone of currentTarget.zones) {
|
|
6852
|
+
selectedZones.push(targetZone);
|
|
6853
|
+
if (zone === undefined) {
|
|
6854
|
+
zone = targetZone;
|
|
6855
|
+
continue;
|
|
6856
|
+
}
|
|
6857
|
+
zone = union(zone, targetZone);
|
|
6858
|
+
}
|
|
6859
|
+
}
|
|
6860
|
+
return {
|
|
6861
|
+
target,
|
|
6862
|
+
zone,
|
|
6863
|
+
selectedZones,
|
|
6864
|
+
};
|
|
6865
|
+
}
|
|
6866
|
+
/**
|
|
6867
|
+
* Updates the selection after a paste operation.
|
|
6868
|
+
*/
|
|
6869
|
+
const selectPastedZone = (selection, sourceZones, pastedZones) => {
|
|
6870
|
+
const anchorCell = {
|
|
6871
|
+
col: sourceZones[0].left,
|
|
6872
|
+
row: sourceZones[0].top,
|
|
6873
|
+
};
|
|
6874
|
+
selection.getBackToDefault();
|
|
6875
|
+
selection.selectZone({ cell: anchorCell, zone: union(...pastedZones) }, { scrollIntoView: false });
|
|
6876
|
+
};
|
|
6820
6877
|
|
|
6821
6878
|
class ClipboardHandler {
|
|
6822
6879
|
getters;
|
|
@@ -46764,7 +46821,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46764
46821
|
}
|
|
46765
46822
|
getTypeFromZone(sheetId, zone) {
|
|
46766
46823
|
const cells = this.getters.getEvaluatedCellsInZone(sheetId, zone);
|
|
46767
|
-
const nonEmptyCells = cells.filter((cell) => cell.type
|
|
46824
|
+
const nonEmptyCells = cells.filter((cell) => !(cell.type === CellValueType.empty || cell.value === ""));
|
|
46768
46825
|
if (nonEmptyCells.length === 0) {
|
|
46769
46826
|
return "integer";
|
|
46770
46827
|
}
|
|
@@ -50321,15 +50378,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50321
50378
|
}
|
|
50322
50379
|
}
|
|
50323
50380
|
|
|
50381
|
+
const PAINT_FORMAT_HANDLER_KEYS = [
|
|
50382
|
+
"cell",
|
|
50383
|
+
"border",
|
|
50384
|
+
"table",
|
|
50385
|
+
"conditionalFormat",
|
|
50386
|
+
"merge",
|
|
50387
|
+
];
|
|
50324
50388
|
class PaintFormatStore extends SpreadsheetStore {
|
|
50325
50389
|
mutators = ["activate", "cancel", "pasteFormat"];
|
|
50326
50390
|
highlightStore = this.get(HighlightStore);
|
|
50327
|
-
clipboardHandlers = [
|
|
50328
|
-
new CellClipboardHandler(this.getters, this.model.dispatch),
|
|
50329
|
-
new BorderClipboardHandler(this.getters, this.model.dispatch),
|
|
50330
|
-
new TableClipboardHandler(this.getters, this.model.dispatch),
|
|
50331
|
-
new ConditionalFormatClipboardHandler(this.getters, this.model.dispatch),
|
|
50332
|
-
];
|
|
50333
50391
|
status = "inactive";
|
|
50334
50392
|
copiedData;
|
|
50335
50393
|
constructor(get) {
|
|
@@ -50360,24 +50418,38 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50360
50418
|
get isActive() {
|
|
50361
50419
|
return this.status !== "inactive";
|
|
50362
50420
|
}
|
|
50421
|
+
get clipboardHandlers() {
|
|
50422
|
+
return PAINT_FORMAT_HANDLER_KEYS.map((handlerName) => {
|
|
50423
|
+
const HandlerClass = clipboardHandlersRegistries.cellHandlers.get(handlerName);
|
|
50424
|
+
return {
|
|
50425
|
+
handlerName,
|
|
50426
|
+
handler: new HandlerClass(this.getters, this.model.dispatch),
|
|
50427
|
+
};
|
|
50428
|
+
});
|
|
50429
|
+
}
|
|
50363
50430
|
copyFormats() {
|
|
50364
50431
|
const sheetId = this.getters.getActiveSheetId();
|
|
50365
50432
|
const zones = this.getters.getSelectedZones();
|
|
50366
|
-
const copiedData = {};
|
|
50367
|
-
for (const handler of this.clipboardHandlers) {
|
|
50368
|
-
|
|
50433
|
+
const copiedData = { zones, sheetId };
|
|
50434
|
+
for (const { handlerName, handler } of this.clipboardHandlers) {
|
|
50435
|
+
const handlerResult = handler.copy(getClipboardDataPositions(sheetId, zones));
|
|
50436
|
+
if (handlerResult !== undefined) {
|
|
50437
|
+
copiedData[handlerName] = handlerResult;
|
|
50438
|
+
}
|
|
50369
50439
|
}
|
|
50370
50440
|
return copiedData;
|
|
50371
50441
|
}
|
|
50372
50442
|
paintFormat(sheetId, target) {
|
|
50373
|
-
if (this.copiedData) {
|
|
50374
|
-
|
|
50375
|
-
handler.paste({ zones: target, sheetId }, this.copiedData, {
|
|
50376
|
-
isCutOperation: false,
|
|
50377
|
-
pasteOption: "onlyFormat",
|
|
50378
|
-
});
|
|
50379
|
-
}
|
|
50443
|
+
if (!this.copiedData) {
|
|
50444
|
+
return;
|
|
50380
50445
|
}
|
|
50446
|
+
const options = {
|
|
50447
|
+
isCutOperation: false,
|
|
50448
|
+
pasteOption: "onlyFormat",
|
|
50449
|
+
};
|
|
50450
|
+
const { target: pasteTarget, selectedZones } = getPasteTargetFromHandlers(sheetId, target, this.copiedData, this.clipboardHandlers, options);
|
|
50451
|
+
applyClipboardHandlersPaste(this.clipboardHandlers, this.copiedData, pasteTarget, options);
|
|
50452
|
+
selectPastedZone(this.model.selection, target, selectedZones);
|
|
50381
50453
|
if (this.status === "oneOff") {
|
|
50382
50454
|
this.cancel();
|
|
50383
50455
|
}
|
|
@@ -55543,7 +55615,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55543
55615
|
else if (newRule.criterion.type === "isValueInList") {
|
|
55544
55616
|
newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
|
|
55545
55617
|
}
|
|
55546
|
-
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
|
|
55618
|
+
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules, newRule.id);
|
|
55547
55619
|
const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
|
|
55548
55620
|
if (ruleIndex !== -1) {
|
|
55549
55621
|
adaptedRules[ruleIndex] = newRule;
|
|
@@ -55553,9 +55625,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55553
55625
|
this.history.update("rules", sheetId, [...adaptedRules, newRule]);
|
|
55554
55626
|
}
|
|
55555
55627
|
}
|
|
55556
|
-
removeRangesFromRules(sheetId, ranges, rules) {
|
|
55628
|
+
removeRangesFromRules(sheetId, ranges, rules, editingRuleId) {
|
|
55557
55629
|
rules = deepCopy(rules);
|
|
55558
55630
|
for (const rule of rules) {
|
|
55631
|
+
if (rule.id === editingRuleId) {
|
|
55632
|
+
continue; // Skip the rule being edited to preserve its place in the list
|
|
55633
|
+
}
|
|
55559
55634
|
rule.ranges = this.getters.recomputeRanges(rule.ranges, ranges);
|
|
55560
55635
|
}
|
|
55561
55636
|
return rules.filter((rule) => rule.ranges.length > 0);
|
|
@@ -67289,49 +67364,17 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67289
67364
|
if (!copiedData) {
|
|
67290
67365
|
return;
|
|
67291
67366
|
}
|
|
67292
|
-
let zone = undefined;
|
|
67293
|
-
let selectedZones = [];
|
|
67294
67367
|
const sheetId = this.getters.getActiveSheetId();
|
|
67295
|
-
let target = {
|
|
67296
|
-
sheetId,
|
|
67297
|
-
zones,
|
|
67298
|
-
};
|
|
67299
67368
|
const handlers = this.selectClipboardHandlers(copiedData);
|
|
67300
|
-
|
|
67301
|
-
const handlerData = copiedData[handlerName];
|
|
67302
|
-
if (!handlerData) {
|
|
67303
|
-
continue;
|
|
67304
|
-
}
|
|
67305
|
-
const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
|
|
67306
|
-
if (currentTarget.figureId) {
|
|
67307
|
-
target.figureId = currentTarget.figureId;
|
|
67308
|
-
}
|
|
67309
|
-
for (const targetZone of currentTarget.zones) {
|
|
67310
|
-
selectedZones.push(targetZone);
|
|
67311
|
-
if (zone === undefined) {
|
|
67312
|
-
zone = targetZone;
|
|
67313
|
-
continue;
|
|
67314
|
-
}
|
|
67315
|
-
zone = union(zone, targetZone);
|
|
67316
|
-
}
|
|
67317
|
-
}
|
|
67369
|
+
const { target, zone, selectedZones } = getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options);
|
|
67318
67370
|
if (zone !== undefined) {
|
|
67319
|
-
this.addMissingDimensions(
|
|
67371
|
+
this.addMissingDimensions(sheetId, zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
|
|
67320
67372
|
}
|
|
67321
|
-
handlers
|
|
67322
|
-
const handlerData = copiedData[handlerName];
|
|
67323
|
-
if (handlerData) {
|
|
67324
|
-
handler.paste(target, handlerData, options);
|
|
67325
|
-
}
|
|
67326
|
-
});
|
|
67373
|
+
applyClipboardHandlersPaste(handlers, copiedData, target, options);
|
|
67327
67374
|
if (!options?.selectTarget) {
|
|
67328
67375
|
return;
|
|
67329
67376
|
}
|
|
67330
|
-
|
|
67331
|
-
const col = selection.left;
|
|
67332
|
-
const row = selection.top;
|
|
67333
|
-
this.selection.getBackToDefault();
|
|
67334
|
-
this.selection.selectZone({ cell: { col, row }, zone: union(...selectedZones) }, { scrollIntoView: false });
|
|
67377
|
+
selectPastedZone(this.selection, zones, selectedZones);
|
|
67335
67378
|
}
|
|
67336
67379
|
/**
|
|
67337
67380
|
* Add columns and/or rows to ensure that col + width and row + height are still
|
|
@@ -76573,9 +76616,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76573
76616
|
exports.tokenize = tokenize;
|
|
76574
76617
|
|
|
76575
76618
|
|
|
76576
|
-
__info__.version = "18.1.
|
|
76577
|
-
__info__.date = "2025-06-
|
|
76578
|
-
__info__.hash = "
|
|
76619
|
+
__info__.version = "18.1.27";
|
|
76620
|
+
__info__.date = "2025-06-23T15:04:51.792Z";
|
|
76621
|
+
__info__.hash = "b25bcc7";
|
|
76579
76622
|
|
|
76580
76623
|
|
|
76581
76624
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|