@odoo/o-spreadsheet 18.3.9 → 18.3.10
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 +116 -69
- package/dist/o-spreadsheet.d.ts +8 -8
- package/dist/o-spreadsheet.esm.js +116 -69
- package/dist/o-spreadsheet.iife.js +116 -69
- 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.3.
|
|
6
|
-
* @date 2025-06-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.3.10
|
|
6
|
+
* @date 2025-06-23T15:05:03.747Z
|
|
7
|
+
* @hash 748e300
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -142,6 +142,7 @@
|
|
|
142
142
|
const FROZEN_PANE_BORDER_COLOR = "#DADFE8";
|
|
143
143
|
const COMPOSER_ASSISTANT_COLOR = "#9B359B";
|
|
144
144
|
const COLOR_TRANSPARENT = "#00000000";
|
|
145
|
+
const TABLE_HOVER_BACKGROUND_COLOR = "#017E8414";
|
|
145
146
|
const CHART_WATERFALL_POSITIVE_COLOR = "#4EA7F2";
|
|
146
147
|
const CHART_WATERFALL_NEGATIVE_COLOR = "#EA6175";
|
|
147
148
|
const CHART_WATERFALL_SUBTOTAL_COLOR = "#AAAAAA";
|
|
@@ -7121,6 +7122,63 @@
|
|
|
7121
7122
|
};
|
|
7122
7123
|
return osClipboardContent;
|
|
7123
7124
|
}
|
|
7125
|
+
/**
|
|
7126
|
+
* Applies each clipboard handler to paste its corresponding data into the target.
|
|
7127
|
+
*/
|
|
7128
|
+
const applyClipboardHandlersPaste = (handlers, copiedData, target, options) => {
|
|
7129
|
+
handlers.forEach(({ handlerName, handler }) => {
|
|
7130
|
+
const data = copiedData[handlerName];
|
|
7131
|
+
if (data) {
|
|
7132
|
+
handler.paste(target, data, options);
|
|
7133
|
+
}
|
|
7134
|
+
});
|
|
7135
|
+
};
|
|
7136
|
+
/**
|
|
7137
|
+
* Returns the paste target based on clipboard handlers.
|
|
7138
|
+
* Also includes the full affected zone and the list of pasted zones for selection.
|
|
7139
|
+
*/
|
|
7140
|
+
function getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options) {
|
|
7141
|
+
let zone = undefined;
|
|
7142
|
+
let selectedZones = [];
|
|
7143
|
+
let target = {
|
|
7144
|
+
sheetId,
|
|
7145
|
+
zones,
|
|
7146
|
+
};
|
|
7147
|
+
for (const { handlerName, handler } of handlers) {
|
|
7148
|
+
const handlerData = copiedData[handlerName];
|
|
7149
|
+
if (!handlerData) {
|
|
7150
|
+
continue;
|
|
7151
|
+
}
|
|
7152
|
+
const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
|
|
7153
|
+
if (currentTarget.figureId) {
|
|
7154
|
+
target.figureId = currentTarget.figureId;
|
|
7155
|
+
}
|
|
7156
|
+
for (const targetZone of currentTarget.zones) {
|
|
7157
|
+
selectedZones.push(targetZone);
|
|
7158
|
+
if (zone === undefined) {
|
|
7159
|
+
zone = targetZone;
|
|
7160
|
+
continue;
|
|
7161
|
+
}
|
|
7162
|
+
zone = union(zone, targetZone);
|
|
7163
|
+
}
|
|
7164
|
+
}
|
|
7165
|
+
return {
|
|
7166
|
+
target,
|
|
7167
|
+
zone,
|
|
7168
|
+
selectedZones,
|
|
7169
|
+
};
|
|
7170
|
+
}
|
|
7171
|
+
/**
|
|
7172
|
+
* Updates the selection after a paste operation.
|
|
7173
|
+
*/
|
|
7174
|
+
const selectPastedZone = (selection, sourceZones, pastedZones) => {
|
|
7175
|
+
const anchorCell = {
|
|
7176
|
+
col: sourceZones[0].left,
|
|
7177
|
+
row: sourceZones[0].top,
|
|
7178
|
+
};
|
|
7179
|
+
selection.getBackToDefault();
|
|
7180
|
+
selection.selectZone({ cell: anchorCell, zone: union(...pastedZones) }, { scrollIntoView: false });
|
|
7181
|
+
};
|
|
7124
7182
|
|
|
7125
7183
|
class ClipboardHandler {
|
|
7126
7184
|
getters;
|
|
@@ -49822,7 +49880,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
49822
49880
|
}
|
|
49823
49881
|
getTypeFromZone(sheetId, zone) {
|
|
49824
49882
|
const cells = this.getters.getEvaluatedCellsInZone(sheetId, zone);
|
|
49825
|
-
const nonEmptyCells = cells.filter((cell) => cell.type
|
|
49883
|
+
const nonEmptyCells = cells.filter((cell) => !(cell.type === CellValueType.empty || cell.value === ""));
|
|
49826
49884
|
if (nonEmptyCells.length === 0) {
|
|
49827
49885
|
return "integer";
|
|
49828
49886
|
}
|
|
@@ -53539,15 +53597,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53539
53597
|
}
|
|
53540
53598
|
}
|
|
53541
53599
|
|
|
53600
|
+
const PAINT_FORMAT_HANDLER_KEYS = [
|
|
53601
|
+
"cell",
|
|
53602
|
+
"border",
|
|
53603
|
+
"table",
|
|
53604
|
+
"conditionalFormat",
|
|
53605
|
+
"merge",
|
|
53606
|
+
];
|
|
53542
53607
|
class PaintFormatStore extends SpreadsheetStore {
|
|
53543
53608
|
mutators = ["activate", "cancel", "pasteFormat"];
|
|
53544
53609
|
highlightStore = this.get(HighlightStore);
|
|
53545
|
-
clipboardHandlers = [
|
|
53546
|
-
new CellClipboardHandler(this.getters, this.model.dispatch),
|
|
53547
|
-
new BorderClipboardHandler(this.getters, this.model.dispatch),
|
|
53548
|
-
new TableClipboardHandler(this.getters, this.model.dispatch),
|
|
53549
|
-
new ConditionalFormatClipboardHandler(this.getters, this.model.dispatch),
|
|
53550
|
-
];
|
|
53551
53610
|
status = "inactive";
|
|
53552
53611
|
copiedData;
|
|
53553
53612
|
constructor(get) {
|
|
@@ -53578,24 +53637,38 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53578
53637
|
get isActive() {
|
|
53579
53638
|
return this.status !== "inactive";
|
|
53580
53639
|
}
|
|
53640
|
+
get clipboardHandlers() {
|
|
53641
|
+
return PAINT_FORMAT_HANDLER_KEYS.map((handlerName) => {
|
|
53642
|
+
const HandlerClass = clipboardHandlersRegistries.cellHandlers.get(handlerName);
|
|
53643
|
+
return {
|
|
53644
|
+
handlerName,
|
|
53645
|
+
handler: new HandlerClass(this.getters, this.model.dispatch),
|
|
53646
|
+
};
|
|
53647
|
+
});
|
|
53648
|
+
}
|
|
53581
53649
|
copyFormats() {
|
|
53582
53650
|
const sheetId = this.getters.getActiveSheetId();
|
|
53583
53651
|
const zones = this.getters.getSelectedZones();
|
|
53584
|
-
const copiedData = {};
|
|
53585
|
-
for (const handler of this.clipboardHandlers) {
|
|
53586
|
-
|
|
53652
|
+
const copiedData = { zones, sheetId };
|
|
53653
|
+
for (const { handlerName, handler } of this.clipboardHandlers) {
|
|
53654
|
+
const handlerResult = handler.copy(getClipboardDataPositions(sheetId, zones), false);
|
|
53655
|
+
if (handlerResult !== undefined) {
|
|
53656
|
+
copiedData[handlerName] = handlerResult;
|
|
53657
|
+
}
|
|
53587
53658
|
}
|
|
53588
53659
|
return copiedData;
|
|
53589
53660
|
}
|
|
53590
53661
|
paintFormat(sheetId, target) {
|
|
53591
|
-
if (this.copiedData) {
|
|
53592
|
-
|
|
53593
|
-
handler.paste({ zones: target, sheetId }, this.copiedData, {
|
|
53594
|
-
isCutOperation: false,
|
|
53595
|
-
pasteOption: "onlyFormat",
|
|
53596
|
-
});
|
|
53597
|
-
}
|
|
53662
|
+
if (!this.copiedData) {
|
|
53663
|
+
return;
|
|
53598
53664
|
}
|
|
53665
|
+
const options = {
|
|
53666
|
+
isCutOperation: false,
|
|
53667
|
+
pasteOption: "onlyFormat",
|
|
53668
|
+
};
|
|
53669
|
+
const { target: pasteTarget, selectedZones } = getPasteTargetFromHandlers(sheetId, target, this.copiedData, this.clipboardHandlers, options);
|
|
53670
|
+
applyClipboardHandlersPaste(this.clipboardHandlers, this.copiedData, pasteTarget, options);
|
|
53671
|
+
selectPastedZone(this.model.selection, target, selectedZones);
|
|
53599
53672
|
if (this.status === "oneOff") {
|
|
53600
53673
|
this.cancel();
|
|
53601
53674
|
}
|
|
@@ -53642,12 +53715,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53642
53715
|
this.row = undefined;
|
|
53643
53716
|
}
|
|
53644
53717
|
computeOverlay() {
|
|
53645
|
-
if (!this.getters.isDashboard()) {
|
|
53646
|
-
return;
|
|
53647
|
-
}
|
|
53648
53718
|
this.overlayColors = new PositionMap();
|
|
53649
|
-
const col = this
|
|
53650
|
-
const row = this.row;
|
|
53719
|
+
const { col, row } = this;
|
|
53651
53720
|
if (col === undefined || row === undefined) {
|
|
53652
53721
|
return;
|
|
53653
53722
|
}
|
|
@@ -53656,9 +53725,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53656
53725
|
if (!table) {
|
|
53657
53726
|
return;
|
|
53658
53727
|
}
|
|
53659
|
-
const { left, right } = table.range.zone;
|
|
53660
|
-
|
|
53661
|
-
|
|
53728
|
+
const { left, right, top } = table.range.zone;
|
|
53729
|
+
const isTableHeader = row < top + table.config.numberOfHeaders;
|
|
53730
|
+
const doesTableRowHaveContent = range(left, right + 1).some((col) => {
|
|
53731
|
+
return (!this.getters.isColHidden(sheetId, col) &&
|
|
53732
|
+
this.getters.getEvaluatedCell({ sheetId, col, row }).formattedValue);
|
|
53733
|
+
});
|
|
53734
|
+
if (!isTableHeader && doesTableRowHaveContent) {
|
|
53735
|
+
for (let col = left; col <= right; col++) {
|
|
53736
|
+
this.overlayColors.set({ sheetId, col, row }, TABLE_HOVER_BACKGROUND_COLOR);
|
|
53737
|
+
}
|
|
53662
53738
|
}
|
|
53663
53739
|
}
|
|
53664
53740
|
}
|
|
@@ -59005,7 +59081,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59005
59081
|
else if (newRule.criterion.type === "isValueInList") {
|
|
59006
59082
|
newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
|
|
59007
59083
|
}
|
|
59008
|
-
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
|
|
59084
|
+
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules, newRule.id);
|
|
59009
59085
|
const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
|
|
59010
59086
|
if (ruleIndex !== -1) {
|
|
59011
59087
|
adaptedRules[ruleIndex] = newRule;
|
|
@@ -59015,9 +59091,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59015
59091
|
this.history.update("rules", sheetId, [...adaptedRules, newRule]);
|
|
59016
59092
|
}
|
|
59017
59093
|
}
|
|
59018
|
-
removeRangesFromRules(sheetId, ranges, rules) {
|
|
59094
|
+
removeRangesFromRules(sheetId, ranges, rules, editingRuleId) {
|
|
59019
59095
|
rules = deepCopy(rules);
|
|
59020
59096
|
for (const rule of rules) {
|
|
59097
|
+
if (rule.id === editingRuleId) {
|
|
59098
|
+
continue; // Skip the rule being edited to preserve its place in the list
|
|
59099
|
+
}
|
|
59021
59100
|
rule.ranges = this.getters.recomputeRanges(rule.ranges, ranges);
|
|
59022
59101
|
}
|
|
59023
59102
|
return rules.filter((rule) => rule.ranges.length > 0);
|
|
@@ -70845,49 +70924,17 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
70845
70924
|
if (!copiedData) {
|
|
70846
70925
|
return;
|
|
70847
70926
|
}
|
|
70848
|
-
let zone = undefined;
|
|
70849
|
-
let selectedZones = [];
|
|
70850
70927
|
const sheetId = this.getters.getActiveSheetId();
|
|
70851
|
-
let target = {
|
|
70852
|
-
sheetId,
|
|
70853
|
-
zones,
|
|
70854
|
-
};
|
|
70855
70928
|
const handlers = this.selectClipboardHandlers(copiedData);
|
|
70856
|
-
|
|
70857
|
-
const handlerData = copiedData[handlerName];
|
|
70858
|
-
if (!handlerData) {
|
|
70859
|
-
continue;
|
|
70860
|
-
}
|
|
70861
|
-
const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
|
|
70862
|
-
if (currentTarget.figureId) {
|
|
70863
|
-
target.figureId = currentTarget.figureId;
|
|
70864
|
-
}
|
|
70865
|
-
for (const targetZone of currentTarget.zones) {
|
|
70866
|
-
selectedZones.push(targetZone);
|
|
70867
|
-
if (zone === undefined) {
|
|
70868
|
-
zone = targetZone;
|
|
70869
|
-
continue;
|
|
70870
|
-
}
|
|
70871
|
-
zone = union(zone, targetZone);
|
|
70872
|
-
}
|
|
70873
|
-
}
|
|
70929
|
+
const { target, zone, selectedZones } = getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options);
|
|
70874
70930
|
if (zone !== undefined) {
|
|
70875
|
-
this.addMissingDimensions(
|
|
70931
|
+
this.addMissingDimensions(sheetId, zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
|
|
70876
70932
|
}
|
|
70877
|
-
handlers
|
|
70878
|
-
const handlerData = copiedData[handlerName];
|
|
70879
|
-
if (handlerData) {
|
|
70880
|
-
handler.paste(target, handlerData, options);
|
|
70881
|
-
}
|
|
70882
|
-
});
|
|
70933
|
+
applyClipboardHandlersPaste(handlers, copiedData, target, options);
|
|
70883
70934
|
if (!options?.selectTarget) {
|
|
70884
70935
|
return;
|
|
70885
70936
|
}
|
|
70886
|
-
|
|
70887
|
-
const col = selection.left;
|
|
70888
|
-
const row = selection.top;
|
|
70889
|
-
this.selection.getBackToDefault();
|
|
70890
|
-
this.selection.selectZone({ cell: { col, row }, zone: union(...selectedZones) }, { scrollIntoView: false });
|
|
70937
|
+
selectPastedZone(this.selection, zones, selectedZones);
|
|
70891
70938
|
}
|
|
70892
70939
|
/**
|
|
70893
70940
|
* Add columns and/or rows to ensure that col + width and row + height are still
|
|
@@ -80710,9 +80757,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
80710
80757
|
exports.tokenize = tokenize;
|
|
80711
80758
|
|
|
80712
80759
|
|
|
80713
|
-
__info__.version = "18.3.
|
|
80714
|
-
__info__.date = "2025-06-
|
|
80715
|
-
__info__.hash = "
|
|
80760
|
+
__info__.version = "18.3.10";
|
|
80761
|
+
__info__.date = "2025-06-23T15:05:03.747Z";
|
|
80762
|
+
__info__.hash = "748e300";
|
|
80716
80763
|
|
|
80717
80764
|
|
|
80718
80765
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|