@odoo/o-spreadsheet 18.2.18 → 18.2.19
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 +180 -180
- 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-06-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.2.19
|
|
6
|
+
* @date 2025-06-23T15:07:13.023Z
|
|
7
|
+
* @hash 430d931
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -6826,6 +6826,63 @@
|
|
|
6826
6826
|
data: spreadsheetContent,
|
|
6827
6827
|
};
|
|
6828
6828
|
}
|
|
6829
|
+
/**
|
|
6830
|
+
* Applies each clipboard handler to paste its corresponding data into the target.
|
|
6831
|
+
*/
|
|
6832
|
+
const applyClipboardHandlersPaste = (handlers, copiedData, target, options) => {
|
|
6833
|
+
handlers.forEach(({ handlerName, handler }) => {
|
|
6834
|
+
const data = copiedData[handlerName];
|
|
6835
|
+
if (data) {
|
|
6836
|
+
handler.paste(target, data, options);
|
|
6837
|
+
}
|
|
6838
|
+
});
|
|
6839
|
+
};
|
|
6840
|
+
/**
|
|
6841
|
+
* Returns the paste target based on clipboard handlers.
|
|
6842
|
+
* Also includes the full affected zone and the list of pasted zones for selection.
|
|
6843
|
+
*/
|
|
6844
|
+
function getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options) {
|
|
6845
|
+
let zone = undefined;
|
|
6846
|
+
let selectedZones = [];
|
|
6847
|
+
let target = {
|
|
6848
|
+
sheetId,
|
|
6849
|
+
zones,
|
|
6850
|
+
};
|
|
6851
|
+
for (const { handlerName, handler } of handlers) {
|
|
6852
|
+
const handlerData = copiedData[handlerName];
|
|
6853
|
+
if (!handlerData) {
|
|
6854
|
+
continue;
|
|
6855
|
+
}
|
|
6856
|
+
const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
|
|
6857
|
+
if (currentTarget.figureId) {
|
|
6858
|
+
target.figureId = currentTarget.figureId;
|
|
6859
|
+
}
|
|
6860
|
+
for (const targetZone of currentTarget.zones) {
|
|
6861
|
+
selectedZones.push(targetZone);
|
|
6862
|
+
if (zone === undefined) {
|
|
6863
|
+
zone = targetZone;
|
|
6864
|
+
continue;
|
|
6865
|
+
}
|
|
6866
|
+
zone = union(zone, targetZone);
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6869
|
+
return {
|
|
6870
|
+
target,
|
|
6871
|
+
zone,
|
|
6872
|
+
selectedZones,
|
|
6873
|
+
};
|
|
6874
|
+
}
|
|
6875
|
+
/**
|
|
6876
|
+
* Updates the selection after a paste operation.
|
|
6877
|
+
*/
|
|
6878
|
+
const selectPastedZone = (selection, sourceZones, pastedZones) => {
|
|
6879
|
+
const anchorCell = {
|
|
6880
|
+
col: sourceZones[0].left,
|
|
6881
|
+
row: sourceZones[0].top,
|
|
6882
|
+
};
|
|
6883
|
+
selection.getBackToDefault();
|
|
6884
|
+
selection.selectZone({ cell: anchorCell, zone: union(...pastedZones) }, { scrollIntoView: false });
|
|
6885
|
+
};
|
|
6829
6886
|
|
|
6830
6887
|
class ClipboardHandler {
|
|
6831
6888
|
getters;
|
|
@@ -47106,7 +47163,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47106
47163
|
}
|
|
47107
47164
|
getTypeFromZone(sheetId, zone) {
|
|
47108
47165
|
const cells = this.getters.getEvaluatedCellsInZone(sheetId, zone);
|
|
47109
|
-
const nonEmptyCells = cells.filter((cell) => cell.type
|
|
47166
|
+
const nonEmptyCells = cells.filter((cell) => !(cell.type === CellValueType.empty || cell.value === ""));
|
|
47110
47167
|
if (nonEmptyCells.length === 0) {
|
|
47111
47168
|
return "integer";
|
|
47112
47169
|
}
|
|
@@ -50656,15 +50713,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50656
50713
|
}
|
|
50657
50714
|
}
|
|
50658
50715
|
|
|
50716
|
+
const PAINT_FORMAT_HANDLER_KEYS = [
|
|
50717
|
+
"cell",
|
|
50718
|
+
"border",
|
|
50719
|
+
"table",
|
|
50720
|
+
"conditionalFormat",
|
|
50721
|
+
"merge",
|
|
50722
|
+
];
|
|
50659
50723
|
class PaintFormatStore extends SpreadsheetStore {
|
|
50660
50724
|
mutators = ["activate", "cancel", "pasteFormat"];
|
|
50661
50725
|
highlightStore = this.get(HighlightStore);
|
|
50662
|
-
clipboardHandlers = [
|
|
50663
|
-
new CellClipboardHandler(this.getters, this.model.dispatch),
|
|
50664
|
-
new BorderClipboardHandler(this.getters, this.model.dispatch),
|
|
50665
|
-
new TableClipboardHandler(this.getters, this.model.dispatch),
|
|
50666
|
-
new ConditionalFormatClipboardHandler(this.getters, this.model.dispatch),
|
|
50667
|
-
];
|
|
50668
50726
|
status = "inactive";
|
|
50669
50727
|
copiedData;
|
|
50670
50728
|
constructor(get) {
|
|
@@ -50695,24 +50753,38 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50695
50753
|
get isActive() {
|
|
50696
50754
|
return this.status !== "inactive";
|
|
50697
50755
|
}
|
|
50756
|
+
get clipboardHandlers() {
|
|
50757
|
+
return PAINT_FORMAT_HANDLER_KEYS.map((handlerName) => {
|
|
50758
|
+
const HandlerClass = clipboardHandlersRegistries.cellHandlers.get(handlerName);
|
|
50759
|
+
return {
|
|
50760
|
+
handlerName,
|
|
50761
|
+
handler: new HandlerClass(this.getters, this.model.dispatch),
|
|
50762
|
+
};
|
|
50763
|
+
});
|
|
50764
|
+
}
|
|
50698
50765
|
copyFormats() {
|
|
50699
50766
|
const sheetId = this.getters.getActiveSheetId();
|
|
50700
50767
|
const zones = this.getters.getSelectedZones();
|
|
50701
|
-
const copiedData = {};
|
|
50702
|
-
for (const handler of this.clipboardHandlers) {
|
|
50703
|
-
|
|
50768
|
+
const copiedData = { zones, sheetId };
|
|
50769
|
+
for (const { handlerName, handler } of this.clipboardHandlers) {
|
|
50770
|
+
const handlerResult = handler.copy(getClipboardDataPositions(sheetId, zones));
|
|
50771
|
+
if (handlerResult !== undefined) {
|
|
50772
|
+
copiedData[handlerName] = handlerResult;
|
|
50773
|
+
}
|
|
50704
50774
|
}
|
|
50705
50775
|
return copiedData;
|
|
50706
50776
|
}
|
|
50707
50777
|
paintFormat(sheetId, target) {
|
|
50708
|
-
if (this.copiedData) {
|
|
50709
|
-
|
|
50710
|
-
handler.paste({ zones: target, sheetId }, this.copiedData, {
|
|
50711
|
-
isCutOperation: false,
|
|
50712
|
-
pasteOption: "onlyFormat",
|
|
50713
|
-
});
|
|
50714
|
-
}
|
|
50778
|
+
if (!this.copiedData) {
|
|
50779
|
+
return;
|
|
50715
50780
|
}
|
|
50781
|
+
const options = {
|
|
50782
|
+
isCutOperation: false,
|
|
50783
|
+
pasteOption: "onlyFormat",
|
|
50784
|
+
};
|
|
50785
|
+
const { target: pasteTarget, selectedZones } = getPasteTargetFromHandlers(sheetId, target, this.copiedData, this.clipboardHandlers, options);
|
|
50786
|
+
applyClipboardHandlersPaste(this.clipboardHandlers, this.copiedData, pasteTarget, options);
|
|
50787
|
+
selectPastedZone(this.model.selection, target, selectedZones);
|
|
50716
50788
|
if (this.status === "oneOff") {
|
|
50717
50789
|
this.cancel();
|
|
50718
50790
|
}
|
|
@@ -56013,7 +56085,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56013
56085
|
else if (newRule.criterion.type === "isValueInList") {
|
|
56014
56086
|
newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
|
|
56015
56087
|
}
|
|
56016
|
-
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
|
|
56088
|
+
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules, newRule.id);
|
|
56017
56089
|
const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
|
|
56018
56090
|
if (ruleIndex !== -1) {
|
|
56019
56091
|
adaptedRules[ruleIndex] = newRule;
|
|
@@ -56023,9 +56095,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56023
56095
|
this.history.update("rules", sheetId, [...adaptedRules, newRule]);
|
|
56024
56096
|
}
|
|
56025
56097
|
}
|
|
56026
|
-
removeRangesFromRules(sheetId, ranges, rules) {
|
|
56098
|
+
removeRangesFromRules(sheetId, ranges, rules, editingRuleId) {
|
|
56027
56099
|
rules = deepCopy(rules);
|
|
56028
56100
|
for (const rule of rules) {
|
|
56101
|
+
if (rule.id === editingRuleId) {
|
|
56102
|
+
continue; // Skip the rule being edited to preserve its place in the list
|
|
56103
|
+
}
|
|
56029
56104
|
rule.ranges = this.getters.recomputeRanges(rule.ranges, ranges);
|
|
56030
56105
|
}
|
|
56031
56106
|
return rules.filter((rule) => rule.ranges.length > 0);
|
|
@@ -67783,49 +67858,17 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67783
67858
|
if (!copiedData) {
|
|
67784
67859
|
return;
|
|
67785
67860
|
}
|
|
67786
|
-
let zone = undefined;
|
|
67787
|
-
let selectedZones = [];
|
|
67788
67861
|
const sheetId = this.getters.getActiveSheetId();
|
|
67789
|
-
let target = {
|
|
67790
|
-
sheetId,
|
|
67791
|
-
zones,
|
|
67792
|
-
};
|
|
67793
67862
|
const handlers = this.selectClipboardHandlers(copiedData);
|
|
67794
|
-
|
|
67795
|
-
const handlerData = copiedData[handlerName];
|
|
67796
|
-
if (!handlerData) {
|
|
67797
|
-
continue;
|
|
67798
|
-
}
|
|
67799
|
-
const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
|
|
67800
|
-
if (currentTarget.figureId) {
|
|
67801
|
-
target.figureId = currentTarget.figureId;
|
|
67802
|
-
}
|
|
67803
|
-
for (const targetZone of currentTarget.zones) {
|
|
67804
|
-
selectedZones.push(targetZone);
|
|
67805
|
-
if (zone === undefined) {
|
|
67806
|
-
zone = targetZone;
|
|
67807
|
-
continue;
|
|
67808
|
-
}
|
|
67809
|
-
zone = union(zone, targetZone);
|
|
67810
|
-
}
|
|
67811
|
-
}
|
|
67863
|
+
const { target, zone, selectedZones } = getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options);
|
|
67812
67864
|
if (zone !== undefined) {
|
|
67813
|
-
this.addMissingDimensions(
|
|
67865
|
+
this.addMissingDimensions(sheetId, zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
|
|
67814
67866
|
}
|
|
67815
|
-
handlers
|
|
67816
|
-
const handlerData = copiedData[handlerName];
|
|
67817
|
-
if (handlerData) {
|
|
67818
|
-
handler.paste(target, handlerData, options);
|
|
67819
|
-
}
|
|
67820
|
-
});
|
|
67867
|
+
applyClipboardHandlersPaste(handlers, copiedData, target, options);
|
|
67821
67868
|
if (!options?.selectTarget) {
|
|
67822
67869
|
return;
|
|
67823
67870
|
}
|
|
67824
|
-
|
|
67825
|
-
const col = selection.left;
|
|
67826
|
-
const row = selection.top;
|
|
67827
|
-
this.selection.getBackToDefault();
|
|
67828
|
-
this.selection.selectZone({ cell: { col, row }, zone: union(...selectedZones) }, { scrollIntoView: false });
|
|
67871
|
+
selectPastedZone(this.selection, zones, selectedZones);
|
|
67829
67872
|
}
|
|
67830
67873
|
/**
|
|
67831
67874
|
* Add columns and/or rows to ensure that col + width and row + height are still
|
|
@@ -77051,9 +77094,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
77051
77094
|
exports.tokenize = tokenize;
|
|
77052
77095
|
|
|
77053
77096
|
|
|
77054
|
-
__info__.version = "18.2.
|
|
77055
|
-
__info__.date = "2025-06-
|
|
77056
|
-
__info__.hash = "
|
|
77097
|
+
__info__.version = "18.2.19";
|
|
77098
|
+
__info__.date = "2025-06-23T15:07:13.023Z";
|
|
77099
|
+
__info__.hash = "430d931";
|
|
77057
77100
|
|
|
77058
77101
|
|
|
77059
77102
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|