@odoo/o-spreadsheet 18.2.18 → 18.2.20
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 +130 -74
- package/dist/o-spreadsheet.d.ts +8 -8
- package/dist/o-spreadsheet.esm.js +130 -74
- package/dist/o-spreadsheet.iife.js +130 -74
- 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.20
|
|
6
|
+
* @date 2025-06-27T09:11:55.800Z
|
|
7
|
+
* @hash 16dfc38
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -6825,6 +6825,63 @@ function parseOSClipboardContent(content) {
|
|
|
6825
6825
|
data: spreadsheetContent,
|
|
6826
6826
|
};
|
|
6827
6827
|
}
|
|
6828
|
+
/**
|
|
6829
|
+
* Applies each clipboard handler to paste its corresponding data into the target.
|
|
6830
|
+
*/
|
|
6831
|
+
const applyClipboardHandlersPaste = (handlers, copiedData, target, options) => {
|
|
6832
|
+
handlers.forEach(({ handlerName, handler }) => {
|
|
6833
|
+
const data = copiedData[handlerName];
|
|
6834
|
+
if (data) {
|
|
6835
|
+
handler.paste(target, data, options);
|
|
6836
|
+
}
|
|
6837
|
+
});
|
|
6838
|
+
};
|
|
6839
|
+
/**
|
|
6840
|
+
* Returns the paste target based on clipboard handlers.
|
|
6841
|
+
* Also includes the full affected zone and the list of pasted zones for selection.
|
|
6842
|
+
*/
|
|
6843
|
+
function getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options) {
|
|
6844
|
+
let zone = undefined;
|
|
6845
|
+
let selectedZones = [];
|
|
6846
|
+
let target = {
|
|
6847
|
+
sheetId,
|
|
6848
|
+
zones,
|
|
6849
|
+
};
|
|
6850
|
+
for (const { handlerName, handler } of handlers) {
|
|
6851
|
+
const handlerData = copiedData[handlerName];
|
|
6852
|
+
if (!handlerData) {
|
|
6853
|
+
continue;
|
|
6854
|
+
}
|
|
6855
|
+
const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
|
|
6856
|
+
if (currentTarget.figureId) {
|
|
6857
|
+
target.figureId = currentTarget.figureId;
|
|
6858
|
+
}
|
|
6859
|
+
for (const targetZone of currentTarget.zones) {
|
|
6860
|
+
selectedZones.push(targetZone);
|
|
6861
|
+
if (zone === undefined) {
|
|
6862
|
+
zone = targetZone;
|
|
6863
|
+
continue;
|
|
6864
|
+
}
|
|
6865
|
+
zone = union(zone, targetZone);
|
|
6866
|
+
}
|
|
6867
|
+
}
|
|
6868
|
+
return {
|
|
6869
|
+
target,
|
|
6870
|
+
zone,
|
|
6871
|
+
selectedZones,
|
|
6872
|
+
};
|
|
6873
|
+
}
|
|
6874
|
+
/**
|
|
6875
|
+
* Updates the selection after a paste operation.
|
|
6876
|
+
*/
|
|
6877
|
+
const selectPastedZone = (selection, sourceZones, pastedZones) => {
|
|
6878
|
+
const anchorCell = {
|
|
6879
|
+
col: sourceZones[0].left,
|
|
6880
|
+
row: sourceZones[0].top,
|
|
6881
|
+
};
|
|
6882
|
+
selection.getBackToDefault();
|
|
6883
|
+
selection.selectZone({ cell: anchorCell, zone: union(...pastedZones) }, { scrollIntoView: false });
|
|
6884
|
+
};
|
|
6828
6885
|
|
|
6829
6886
|
class ClipboardHandler {
|
|
6830
6887
|
getters;
|
|
@@ -21141,7 +21198,7 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
21141
21198
|
}
|
|
21142
21199
|
captureSelection(zone, col, row) {
|
|
21143
21200
|
this.model.selection.capture(this, {
|
|
21144
|
-
cell: { col: col
|
|
21201
|
+
cell: { col: col ?? zone.left, row: row ?? zone.right },
|
|
21145
21202
|
zone,
|
|
21146
21203
|
}, {
|
|
21147
21204
|
handleEvent: this.handleEvent.bind(this),
|
|
@@ -43085,6 +43142,9 @@ class ConditionalFormattingPanel extends Component {
|
|
|
43085
43142
|
this.switchToList();
|
|
43086
43143
|
}
|
|
43087
43144
|
}
|
|
43145
|
+
else if (!this.editedCF) {
|
|
43146
|
+
this.switchToList();
|
|
43147
|
+
}
|
|
43088
43148
|
});
|
|
43089
43149
|
}
|
|
43090
43150
|
get conditionalFormats() {
|
|
@@ -47105,7 +47165,7 @@ class SpreadsheetPivot {
|
|
|
47105
47165
|
}
|
|
47106
47166
|
getTypeFromZone(sheetId, zone) {
|
|
47107
47167
|
const cells = this.getters.getEvaluatedCellsInZone(sheetId, zone);
|
|
47108
|
-
const nonEmptyCells = cells.filter((cell) => cell.type
|
|
47168
|
+
const nonEmptyCells = cells.filter((cell) => !(cell.type === CellValueType.empty || cell.value === ""));
|
|
47109
47169
|
if (nonEmptyCells.length === 0) {
|
|
47110
47170
|
return "integer";
|
|
47111
47171
|
}
|
|
@@ -50655,15 +50715,16 @@ class GridAddRowsFooter extends Component {
|
|
|
50655
50715
|
}
|
|
50656
50716
|
}
|
|
50657
50717
|
|
|
50718
|
+
const PAINT_FORMAT_HANDLER_KEYS = [
|
|
50719
|
+
"cell",
|
|
50720
|
+
"border",
|
|
50721
|
+
"table",
|
|
50722
|
+
"conditionalFormat",
|
|
50723
|
+
"merge",
|
|
50724
|
+
];
|
|
50658
50725
|
class PaintFormatStore extends SpreadsheetStore {
|
|
50659
50726
|
mutators = ["activate", "cancel", "pasteFormat"];
|
|
50660
50727
|
highlightStore = this.get(HighlightStore);
|
|
50661
|
-
clipboardHandlers = [
|
|
50662
|
-
new CellClipboardHandler(this.getters, this.model.dispatch),
|
|
50663
|
-
new BorderClipboardHandler(this.getters, this.model.dispatch),
|
|
50664
|
-
new TableClipboardHandler(this.getters, this.model.dispatch),
|
|
50665
|
-
new ConditionalFormatClipboardHandler(this.getters, this.model.dispatch),
|
|
50666
|
-
];
|
|
50667
50728
|
status = "inactive";
|
|
50668
50729
|
copiedData;
|
|
50669
50730
|
constructor(get) {
|
|
@@ -50694,24 +50755,38 @@ class PaintFormatStore extends SpreadsheetStore {
|
|
|
50694
50755
|
get isActive() {
|
|
50695
50756
|
return this.status !== "inactive";
|
|
50696
50757
|
}
|
|
50758
|
+
get clipboardHandlers() {
|
|
50759
|
+
return PAINT_FORMAT_HANDLER_KEYS.map((handlerName) => {
|
|
50760
|
+
const HandlerClass = clipboardHandlersRegistries.cellHandlers.get(handlerName);
|
|
50761
|
+
return {
|
|
50762
|
+
handlerName,
|
|
50763
|
+
handler: new HandlerClass(this.getters, this.model.dispatch),
|
|
50764
|
+
};
|
|
50765
|
+
});
|
|
50766
|
+
}
|
|
50697
50767
|
copyFormats() {
|
|
50698
50768
|
const sheetId = this.getters.getActiveSheetId();
|
|
50699
50769
|
const zones = this.getters.getSelectedZones();
|
|
50700
|
-
const copiedData = {};
|
|
50701
|
-
for (const handler of this.clipboardHandlers) {
|
|
50702
|
-
|
|
50770
|
+
const copiedData = { zones, sheetId };
|
|
50771
|
+
for (const { handlerName, handler } of this.clipboardHandlers) {
|
|
50772
|
+
const handlerResult = handler.copy(getClipboardDataPositions(sheetId, zones));
|
|
50773
|
+
if (handlerResult !== undefined) {
|
|
50774
|
+
copiedData[handlerName] = handlerResult;
|
|
50775
|
+
}
|
|
50703
50776
|
}
|
|
50704
50777
|
return copiedData;
|
|
50705
50778
|
}
|
|
50706
50779
|
paintFormat(sheetId, target) {
|
|
50707
|
-
if (this.copiedData) {
|
|
50708
|
-
|
|
50709
|
-
handler.paste({ zones: target, sheetId }, this.copiedData, {
|
|
50710
|
-
isCutOperation: false,
|
|
50711
|
-
pasteOption: "onlyFormat",
|
|
50712
|
-
});
|
|
50713
|
-
}
|
|
50780
|
+
if (!this.copiedData) {
|
|
50781
|
+
return;
|
|
50714
50782
|
}
|
|
50783
|
+
const options = {
|
|
50784
|
+
isCutOperation: false,
|
|
50785
|
+
pasteOption: "onlyFormat",
|
|
50786
|
+
};
|
|
50787
|
+
const { target: pasteTarget, selectedZones } = getPasteTargetFromHandlers(sheetId, target, this.copiedData, this.clipboardHandlers, options);
|
|
50788
|
+
applyClipboardHandlersPaste(this.clipboardHandlers, this.copiedData, pasteTarget, options);
|
|
50789
|
+
selectPastedZone(this.model.selection, target, selectedZones);
|
|
50715
50790
|
if (this.status === "oneOff") {
|
|
50716
50791
|
this.cancel();
|
|
50717
50792
|
}
|
|
@@ -56012,7 +56087,7 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
56012
56087
|
else if (newRule.criterion.type === "isValueInList") {
|
|
56013
56088
|
newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
|
|
56014
56089
|
}
|
|
56015
|
-
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
|
|
56090
|
+
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules, newRule.id);
|
|
56016
56091
|
const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
|
|
56017
56092
|
if (ruleIndex !== -1) {
|
|
56018
56093
|
adaptedRules[ruleIndex] = newRule;
|
|
@@ -56022,9 +56097,12 @@ class DataValidationPlugin extends CorePlugin {
|
|
|
56022
56097
|
this.history.update("rules", sheetId, [...adaptedRules, newRule]);
|
|
56023
56098
|
}
|
|
56024
56099
|
}
|
|
56025
|
-
removeRangesFromRules(sheetId, ranges, rules) {
|
|
56100
|
+
removeRangesFromRules(sheetId, ranges, rules, editingRuleId) {
|
|
56026
56101
|
rules = deepCopy(rules);
|
|
56027
56102
|
for (const rule of rules) {
|
|
56103
|
+
if (rule.id === editingRuleId) {
|
|
56104
|
+
continue; // Skip the rule being edited to preserve its place in the list
|
|
56105
|
+
}
|
|
56028
56106
|
rule.ranges = this.getters.recomputeRanges(rule.ranges, ranges);
|
|
56029
56107
|
}
|
|
56030
56108
|
return rules.filter((rule) => rule.ranges.length > 0);
|
|
@@ -67782,49 +67860,17 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
67782
67860
|
if (!copiedData) {
|
|
67783
67861
|
return;
|
|
67784
67862
|
}
|
|
67785
|
-
let zone = undefined;
|
|
67786
|
-
let selectedZones = [];
|
|
67787
67863
|
const sheetId = this.getters.getActiveSheetId();
|
|
67788
|
-
let target = {
|
|
67789
|
-
sheetId,
|
|
67790
|
-
zones,
|
|
67791
|
-
};
|
|
67792
67864
|
const handlers = this.selectClipboardHandlers(copiedData);
|
|
67793
|
-
|
|
67794
|
-
const handlerData = copiedData[handlerName];
|
|
67795
|
-
if (!handlerData) {
|
|
67796
|
-
continue;
|
|
67797
|
-
}
|
|
67798
|
-
const currentTarget = handler.getPasteTarget(sheetId, zones, handlerData, options);
|
|
67799
|
-
if (currentTarget.figureId) {
|
|
67800
|
-
target.figureId = currentTarget.figureId;
|
|
67801
|
-
}
|
|
67802
|
-
for (const targetZone of currentTarget.zones) {
|
|
67803
|
-
selectedZones.push(targetZone);
|
|
67804
|
-
if (zone === undefined) {
|
|
67805
|
-
zone = targetZone;
|
|
67806
|
-
continue;
|
|
67807
|
-
}
|
|
67808
|
-
zone = union(zone, targetZone);
|
|
67809
|
-
}
|
|
67810
|
-
}
|
|
67865
|
+
const { target, zone, selectedZones } = getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options);
|
|
67811
67866
|
if (zone !== undefined) {
|
|
67812
|
-
this.addMissingDimensions(
|
|
67867
|
+
this.addMissingDimensions(sheetId, zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
|
|
67813
67868
|
}
|
|
67814
|
-
handlers
|
|
67815
|
-
const handlerData = copiedData[handlerName];
|
|
67816
|
-
if (handlerData) {
|
|
67817
|
-
handler.paste(target, handlerData, options);
|
|
67818
|
-
}
|
|
67819
|
-
});
|
|
67869
|
+
applyClipboardHandlersPaste(handlers, copiedData, target, options);
|
|
67820
67870
|
if (!options?.selectTarget) {
|
|
67821
67871
|
return;
|
|
67822
67872
|
}
|
|
67823
|
-
|
|
67824
|
-
const col = selection.left;
|
|
67825
|
-
const row = selection.top;
|
|
67826
|
-
this.selection.getBackToDefault();
|
|
67827
|
-
this.selection.selectZone({ cell: { col, row }, zone: union(...selectedZones) }, { scrollIntoView: false });
|
|
67873
|
+
selectPastedZone(this.selection, zones, selectedZones);
|
|
67828
67874
|
}
|
|
67829
67875
|
/**
|
|
67830
67876
|
* Add columns and/or rows to ensure that col + width and row + height are still
|
|
@@ -73647,26 +73693,28 @@ class SelectionStreamProcessorImpl {
|
|
|
73647
73693
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
73648
73694
|
};
|
|
73649
73695
|
};
|
|
73650
|
-
const {
|
|
73696
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
73697
|
+
const { col: refCol, row: refRow } = refCell;
|
|
73651
73698
|
// check if we can shrink selection
|
|
73652
73699
|
let n = 0;
|
|
73653
73700
|
while (result !== null) {
|
|
73654
73701
|
n++;
|
|
73655
73702
|
if (deltaCol < 0) {
|
|
73656
73703
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
73657
|
-
result =
|
|
73704
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
73658
73705
|
}
|
|
73659
73706
|
if (deltaCol > 0) {
|
|
73660
73707
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
73661
|
-
result = left + n <=
|
|
73708
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
73662
73709
|
}
|
|
73663
73710
|
if (deltaRow < 0) {
|
|
73664
73711
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
73665
|
-
result =
|
|
73712
|
+
result =
|
|
73713
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
73666
73714
|
}
|
|
73667
73715
|
if (deltaRow > 0) {
|
|
73668
73716
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
73669
|
-
result = top + n <=
|
|
73717
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
73670
73718
|
}
|
|
73671
73719
|
result = result ? reorderZone(result) : result;
|
|
73672
73720
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -73896,18 +73944,26 @@ class SelectionStreamProcessorImpl {
|
|
|
73896
73944
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
73897
73945
|
* find a visible cell.
|
|
73898
73946
|
*/
|
|
73899
|
-
|
|
73947
|
+
getReferenceAnchor() {
|
|
73900
73948
|
const sheetId = this.getters.getActiveSheetId();
|
|
73901
73949
|
const anchor = this.anchor;
|
|
73902
73950
|
const { left, right, top, bottom } = anchor.zone;
|
|
73903
73951
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
73952
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
73953
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
73954
|
+
: anchorCol;
|
|
73955
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
73956
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
73957
|
+
: anchorRow;
|
|
73958
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
73959
|
+
left: col,
|
|
73960
|
+
right: col,
|
|
73961
|
+
top: row,
|
|
73962
|
+
bottom: row,
|
|
73963
|
+
});
|
|
73904
73964
|
return {
|
|
73905
|
-
|
|
73906
|
-
|
|
73907
|
-
: anchorCol,
|
|
73908
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
73909
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
73910
|
-
: anchorRow,
|
|
73965
|
+
cell: { col, row },
|
|
73966
|
+
zone,
|
|
73911
73967
|
};
|
|
73912
73968
|
}
|
|
73913
73969
|
deltaToTarget(position, direction, step) {
|
|
@@ -77005,6 +77061,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
|
|
|
77005
77061
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, 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 };
|
|
77006
77062
|
|
|
77007
77063
|
|
|
77008
|
-
__info__.version = "18.2.
|
|
77009
|
-
__info__.date = "2025-06-
|
|
77010
|
-
__info__.hash = "
|
|
77064
|
+
__info__.version = "18.2.20";
|
|
77065
|
+
__info__.date = "2025-06-27T09:11:55.800Z";
|
|
77066
|
+
__info__.hash = "16dfc38";
|
|
@@ -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.20
|
|
6
|
+
* @date 2025-06-27T09:11:55.800Z
|
|
7
|
+
* @hash 16dfc38
|
|
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;
|
|
@@ -21142,7 +21199,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
21142
21199
|
}
|
|
21143
21200
|
captureSelection(zone, col, row) {
|
|
21144
21201
|
this.model.selection.capture(this, {
|
|
21145
|
-
cell: { col: col
|
|
21202
|
+
cell: { col: col ?? zone.left, row: row ?? zone.right },
|
|
21146
21203
|
zone,
|
|
21147
21204
|
}, {
|
|
21148
21205
|
handleEvent: this.handleEvent.bind(this),
|
|
@@ -43086,6 +43143,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
43086
43143
|
this.switchToList();
|
|
43087
43144
|
}
|
|
43088
43145
|
}
|
|
43146
|
+
else if (!this.editedCF) {
|
|
43147
|
+
this.switchToList();
|
|
43148
|
+
}
|
|
43089
43149
|
});
|
|
43090
43150
|
}
|
|
43091
43151
|
get conditionalFormats() {
|
|
@@ -47106,7 +47166,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47106
47166
|
}
|
|
47107
47167
|
getTypeFromZone(sheetId, zone) {
|
|
47108
47168
|
const cells = this.getters.getEvaluatedCellsInZone(sheetId, zone);
|
|
47109
|
-
const nonEmptyCells = cells.filter((cell) => cell.type
|
|
47169
|
+
const nonEmptyCells = cells.filter((cell) => !(cell.type === CellValueType.empty || cell.value === ""));
|
|
47110
47170
|
if (nonEmptyCells.length === 0) {
|
|
47111
47171
|
return "integer";
|
|
47112
47172
|
}
|
|
@@ -50656,15 +50716,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50656
50716
|
}
|
|
50657
50717
|
}
|
|
50658
50718
|
|
|
50719
|
+
const PAINT_FORMAT_HANDLER_KEYS = [
|
|
50720
|
+
"cell",
|
|
50721
|
+
"border",
|
|
50722
|
+
"table",
|
|
50723
|
+
"conditionalFormat",
|
|
50724
|
+
"merge",
|
|
50725
|
+
];
|
|
50659
50726
|
class PaintFormatStore extends SpreadsheetStore {
|
|
50660
50727
|
mutators = ["activate", "cancel", "pasteFormat"];
|
|
50661
50728
|
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
50729
|
status = "inactive";
|
|
50669
50730
|
copiedData;
|
|
50670
50731
|
constructor(get) {
|
|
@@ -50695,24 +50756,38 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50695
50756
|
get isActive() {
|
|
50696
50757
|
return this.status !== "inactive";
|
|
50697
50758
|
}
|
|
50759
|
+
get clipboardHandlers() {
|
|
50760
|
+
return PAINT_FORMAT_HANDLER_KEYS.map((handlerName) => {
|
|
50761
|
+
const HandlerClass = clipboardHandlersRegistries.cellHandlers.get(handlerName);
|
|
50762
|
+
return {
|
|
50763
|
+
handlerName,
|
|
50764
|
+
handler: new HandlerClass(this.getters, this.model.dispatch),
|
|
50765
|
+
};
|
|
50766
|
+
});
|
|
50767
|
+
}
|
|
50698
50768
|
copyFormats() {
|
|
50699
50769
|
const sheetId = this.getters.getActiveSheetId();
|
|
50700
50770
|
const zones = this.getters.getSelectedZones();
|
|
50701
|
-
const copiedData = {};
|
|
50702
|
-
for (const handler of this.clipboardHandlers) {
|
|
50703
|
-
|
|
50771
|
+
const copiedData = { zones, sheetId };
|
|
50772
|
+
for (const { handlerName, handler } of this.clipboardHandlers) {
|
|
50773
|
+
const handlerResult = handler.copy(getClipboardDataPositions(sheetId, zones));
|
|
50774
|
+
if (handlerResult !== undefined) {
|
|
50775
|
+
copiedData[handlerName] = handlerResult;
|
|
50776
|
+
}
|
|
50704
50777
|
}
|
|
50705
50778
|
return copiedData;
|
|
50706
50779
|
}
|
|
50707
50780
|
paintFormat(sheetId, target) {
|
|
50708
|
-
if (this.copiedData) {
|
|
50709
|
-
|
|
50710
|
-
handler.paste({ zones: target, sheetId }, this.copiedData, {
|
|
50711
|
-
isCutOperation: false,
|
|
50712
|
-
pasteOption: "onlyFormat",
|
|
50713
|
-
});
|
|
50714
|
-
}
|
|
50781
|
+
if (!this.copiedData) {
|
|
50782
|
+
return;
|
|
50715
50783
|
}
|
|
50784
|
+
const options = {
|
|
50785
|
+
isCutOperation: false,
|
|
50786
|
+
pasteOption: "onlyFormat",
|
|
50787
|
+
};
|
|
50788
|
+
const { target: pasteTarget, selectedZones } = getPasteTargetFromHandlers(sheetId, target, this.copiedData, this.clipboardHandlers, options);
|
|
50789
|
+
applyClipboardHandlersPaste(this.clipboardHandlers, this.copiedData, pasteTarget, options);
|
|
50790
|
+
selectPastedZone(this.model.selection, target, selectedZones);
|
|
50716
50791
|
if (this.status === "oneOff") {
|
|
50717
50792
|
this.cancel();
|
|
50718
50793
|
}
|
|
@@ -56013,7 +56088,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56013
56088
|
else if (newRule.criterion.type === "isValueInList") {
|
|
56014
56089
|
newRule.criterion.values = Array.from(new Set(newRule.criterion.values));
|
|
56015
56090
|
}
|
|
56016
|
-
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules);
|
|
56091
|
+
const adaptedRules = this.removeRangesFromRules(sheetId, newRule.ranges, rules, newRule.id);
|
|
56017
56092
|
const ruleIndex = adaptedRules.findIndex((rule) => rule.id === newRule.id);
|
|
56018
56093
|
if (ruleIndex !== -1) {
|
|
56019
56094
|
adaptedRules[ruleIndex] = newRule;
|
|
@@ -56023,9 +56098,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
56023
56098
|
this.history.update("rules", sheetId, [...adaptedRules, newRule]);
|
|
56024
56099
|
}
|
|
56025
56100
|
}
|
|
56026
|
-
removeRangesFromRules(sheetId, ranges, rules) {
|
|
56101
|
+
removeRangesFromRules(sheetId, ranges, rules, editingRuleId) {
|
|
56027
56102
|
rules = deepCopy(rules);
|
|
56028
56103
|
for (const rule of rules) {
|
|
56104
|
+
if (rule.id === editingRuleId) {
|
|
56105
|
+
continue; // Skip the rule being edited to preserve its place in the list
|
|
56106
|
+
}
|
|
56029
56107
|
rule.ranges = this.getters.recomputeRanges(rule.ranges, ranges);
|
|
56030
56108
|
}
|
|
56031
56109
|
return rules.filter((rule) => rule.ranges.length > 0);
|
|
@@ -67783,49 +67861,17 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
67783
67861
|
if (!copiedData) {
|
|
67784
67862
|
return;
|
|
67785
67863
|
}
|
|
67786
|
-
let zone = undefined;
|
|
67787
|
-
let selectedZones = [];
|
|
67788
67864
|
const sheetId = this.getters.getActiveSheetId();
|
|
67789
|
-
let target = {
|
|
67790
|
-
sheetId,
|
|
67791
|
-
zones,
|
|
67792
|
-
};
|
|
67793
67865
|
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
|
-
}
|
|
67866
|
+
const { target, zone, selectedZones } = getPasteTargetFromHandlers(sheetId, zones, copiedData, handlers, options);
|
|
67812
67867
|
if (zone !== undefined) {
|
|
67813
|
-
this.addMissingDimensions(
|
|
67868
|
+
this.addMissingDimensions(sheetId, zone.right - zone.left + 1, zone.bottom - zone.top + 1, zone.left, zone.top);
|
|
67814
67869
|
}
|
|
67815
|
-
handlers
|
|
67816
|
-
const handlerData = copiedData[handlerName];
|
|
67817
|
-
if (handlerData) {
|
|
67818
|
-
handler.paste(target, handlerData, options);
|
|
67819
|
-
}
|
|
67820
|
-
});
|
|
67870
|
+
applyClipboardHandlersPaste(handlers, copiedData, target, options);
|
|
67821
67871
|
if (!options?.selectTarget) {
|
|
67822
67872
|
return;
|
|
67823
67873
|
}
|
|
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 });
|
|
67874
|
+
selectPastedZone(this.selection, zones, selectedZones);
|
|
67829
67875
|
}
|
|
67830
67876
|
/**
|
|
67831
67877
|
* Add columns and/or rows to ensure that col + width and row + height are still
|
|
@@ -73648,26 +73694,28 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
73648
73694
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
73649
73695
|
};
|
|
73650
73696
|
};
|
|
73651
|
-
const {
|
|
73697
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
73698
|
+
const { col: refCol, row: refRow } = refCell;
|
|
73652
73699
|
// check if we can shrink selection
|
|
73653
73700
|
let n = 0;
|
|
73654
73701
|
while (result !== null) {
|
|
73655
73702
|
n++;
|
|
73656
73703
|
if (deltaCol < 0) {
|
|
73657
73704
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
73658
|
-
result =
|
|
73705
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
73659
73706
|
}
|
|
73660
73707
|
if (deltaCol > 0) {
|
|
73661
73708
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
73662
|
-
result = left + n <=
|
|
73709
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
73663
73710
|
}
|
|
73664
73711
|
if (deltaRow < 0) {
|
|
73665
73712
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
73666
|
-
result =
|
|
73713
|
+
result =
|
|
73714
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
73667
73715
|
}
|
|
73668
73716
|
if (deltaRow > 0) {
|
|
73669
73717
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
73670
|
-
result = top + n <=
|
|
73718
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
73671
73719
|
}
|
|
73672
73720
|
result = result ? reorderZone(result) : result;
|
|
73673
73721
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -73897,18 +73945,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
73897
73945
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
73898
73946
|
* find a visible cell.
|
|
73899
73947
|
*/
|
|
73900
|
-
|
|
73948
|
+
getReferenceAnchor() {
|
|
73901
73949
|
const sheetId = this.getters.getActiveSheetId();
|
|
73902
73950
|
const anchor = this.anchor;
|
|
73903
73951
|
const { left, right, top, bottom } = anchor.zone;
|
|
73904
73952
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
73953
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
73954
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
73955
|
+
: anchorCol;
|
|
73956
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
73957
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
73958
|
+
: anchorRow;
|
|
73959
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
73960
|
+
left: col,
|
|
73961
|
+
right: col,
|
|
73962
|
+
top: row,
|
|
73963
|
+
bottom: row,
|
|
73964
|
+
});
|
|
73905
73965
|
return {
|
|
73906
|
-
|
|
73907
|
-
|
|
73908
|
-
: anchorCol,
|
|
73909
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
73910
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
73911
|
-
: anchorRow,
|
|
73966
|
+
cell: { col, row },
|
|
73967
|
+
zone,
|
|
73912
73968
|
};
|
|
73913
73969
|
}
|
|
73914
73970
|
deltaToTarget(position, direction, step) {
|
|
@@ -77051,9 +77107,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
77051
77107
|
exports.tokenize = tokenize;
|
|
77052
77108
|
|
|
77053
77109
|
|
|
77054
|
-
__info__.version = "18.2.
|
|
77055
|
-
__info__.date = "2025-06-
|
|
77056
|
-
__info__.hash = "
|
|
77110
|
+
__info__.version = "18.2.20";
|
|
77111
|
+
__info__.date = "2025-06-27T09:11:55.800Z";
|
|
77112
|
+
__info__.hash = "16dfc38";
|
|
77057
77113
|
|
|
77058
77114
|
|
|
77059
77115
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|