@odoo/o-spreadsheet 16.3.0-alpha.8 → 16.4.0-alpha.0
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 +99 -51
- package/dist/o-spreadsheet.d.ts +27 -8
- package/dist/o-spreadsheet.esm.js +99 -51
- package/dist/o-spreadsheet.iife.js +99 -51
- package/dist/o-spreadsheet.iife.min.js +16 -5
- package/package.json +1 -1
|
@@ -4396,6 +4396,7 @@ var CommandResult;
|
|
|
4396
4396
|
CommandResult[CommandResult["EmptySplitSeparator"] = 89] = "EmptySplitSeparator";
|
|
4397
4397
|
CommandResult[CommandResult["SplitWillOverwriteContent"] = 90] = "SplitWillOverwriteContent";
|
|
4398
4398
|
CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 91] = "NoSplitSeparatorInSelection";
|
|
4399
|
+
CommandResult[CommandResult["NoActiveSheet"] = 92] = "NoActiveSheet";
|
|
4399
4400
|
})(CommandResult || (CommandResult = {}));
|
|
4400
4401
|
|
|
4401
4402
|
const borderStyles = ["thin", "medium", "thick", "dashed", "dotted"];
|
|
@@ -17545,7 +17546,7 @@ topbarMenuRegistry
|
|
|
17545
17546
|
})
|
|
17546
17547
|
.addChild("sort_range", ["data"], {
|
|
17547
17548
|
...sortRange,
|
|
17548
|
-
sequence:
|
|
17549
|
+
sequence: 10,
|
|
17549
17550
|
separator: true,
|
|
17550
17551
|
})
|
|
17551
17552
|
.addChild("sort_ascending", ["data", "sort_range"], {
|
|
@@ -17558,16 +17559,16 @@ topbarMenuRegistry
|
|
|
17558
17559
|
})
|
|
17559
17560
|
.addChild("split_to_columns", ["data"], {
|
|
17560
17561
|
...splitToColumns,
|
|
17561
|
-
sequence:
|
|
17562
|
+
sequence: 20,
|
|
17562
17563
|
separator: true,
|
|
17563
17564
|
})
|
|
17564
17565
|
.addChild("add_data_filter", ["data"], {
|
|
17565
17566
|
...addDataFilter,
|
|
17566
|
-
sequence:
|
|
17567
|
+
sequence: 30,
|
|
17567
17568
|
})
|
|
17568
17569
|
.addChild("remove_data_filter", ["data"], {
|
|
17569
17570
|
...removeDataFilter,
|
|
17570
|
-
sequence:
|
|
17571
|
+
sequence: 30,
|
|
17571
17572
|
});
|
|
17572
17573
|
|
|
17573
17574
|
class OTRegistry extends Registry {
|
|
@@ -18674,6 +18675,18 @@ ChartPanel.props = {
|
|
|
18674
18675
|
onCloseSidePanel: Function,
|
|
18675
18676
|
};
|
|
18676
18677
|
|
|
18678
|
+
css /* scss */ `
|
|
18679
|
+
.o-spreadsheet {
|
|
18680
|
+
.o-icon {
|
|
18681
|
+
.small-text {
|
|
18682
|
+
font: bold 9px sans-serif;
|
|
18683
|
+
}
|
|
18684
|
+
.heavy-text {
|
|
18685
|
+
font: bold 16px sans-serif;
|
|
18686
|
+
}
|
|
18687
|
+
}
|
|
18688
|
+
}
|
|
18689
|
+
`;
|
|
18677
18690
|
// -----------------------------------------------------------------------------
|
|
18678
18691
|
// We need here the svg of the icons that we need to convert to images for the renderer
|
|
18679
18692
|
// -----------------------------------------------------------------------------
|
|
@@ -32190,6 +32203,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
32190
32203
|
"getSheetSize",
|
|
32191
32204
|
"getSheetZone",
|
|
32192
32205
|
"getPaneDivisions",
|
|
32206
|
+
"checkZonesExistInSheet",
|
|
32207
|
+
"getCommandZones",
|
|
32193
32208
|
];
|
|
32194
32209
|
sheetIdsMapName = {};
|
|
32195
32210
|
orderedSheetIds = [];
|
|
@@ -32199,7 +32214,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
32199
32214
|
// Command Handling
|
|
32200
32215
|
// ---------------------------------------------------------------------------
|
|
32201
32216
|
allowDispatch(cmd) {
|
|
32202
|
-
const genericChecks = this.chainValidations(this.checkSheetExists, this.
|
|
32217
|
+
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
32203
32218
|
if (genericChecks !== 0 /* CommandResult.Success */) {
|
|
32204
32219
|
return genericChecks;
|
|
32205
32220
|
}
|
|
@@ -32539,6 +32554,37 @@ class SheetPlugin extends CorePlugin {
|
|
|
32539
32554
|
.map(({ col, row }) => this.getCell({ sheetId, col, row }))
|
|
32540
32555
|
.every((cell) => !cell || cell.content === "");
|
|
32541
32556
|
}
|
|
32557
|
+
getCommandZones(cmd) {
|
|
32558
|
+
const zones = [];
|
|
32559
|
+
if ("zone" in cmd) {
|
|
32560
|
+
zones.push(cmd.zone);
|
|
32561
|
+
}
|
|
32562
|
+
if ("target" in cmd) {
|
|
32563
|
+
zones.push(...cmd.target);
|
|
32564
|
+
}
|
|
32565
|
+
if ("ranges" in cmd) {
|
|
32566
|
+
zones.push(...cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone));
|
|
32567
|
+
}
|
|
32568
|
+
if ("col" in cmd && "row" in cmd) {
|
|
32569
|
+
zones.push({ top: cmd.row, left: cmd.col, bottom: cmd.row, right: cmd.col });
|
|
32570
|
+
}
|
|
32571
|
+
return zones;
|
|
32572
|
+
}
|
|
32573
|
+
/**
|
|
32574
|
+
* Check if zones in the command are well formed and
|
|
32575
|
+
* not outside the sheet.
|
|
32576
|
+
*/
|
|
32577
|
+
checkZonesExistInSheet(sheetId, zones) {
|
|
32578
|
+
if (!zones.every(isZoneValid))
|
|
32579
|
+
return 25 /* CommandResult.InvalidRange */;
|
|
32580
|
+
if (zones.length) {
|
|
32581
|
+
const sheetZone = this.getSheetZone(sheetId);
|
|
32582
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone))
|
|
32583
|
+
? 0 /* CommandResult.Success */
|
|
32584
|
+
: 18 /* CommandResult.TargetOutOfSheet */;
|
|
32585
|
+
}
|
|
32586
|
+
return 0 /* CommandResult.Success */;
|
|
32587
|
+
}
|
|
32542
32588
|
updateCellPosition(cmd) {
|
|
32543
32589
|
const { sheetId, cellId, col, row } = cmd;
|
|
32544
32590
|
if (cellId) {
|
|
@@ -32987,9 +33033,6 @@ class SheetPlugin extends CorePlugin {
|
|
|
32987
33033
|
}
|
|
32988
33034
|
return { rowNumber, colNumber };
|
|
32989
33035
|
}
|
|
32990
|
-
// ----------------------------------------------------
|
|
32991
|
-
// HIDE / SHOW
|
|
32992
|
-
// ----------------------------------------------------
|
|
32993
33036
|
/**
|
|
32994
33037
|
* Check that any "sheetId" in the command matches an existing
|
|
32995
33038
|
* sheet.
|
|
@@ -33007,27 +33050,10 @@ class SheetPlugin extends CorePlugin {
|
|
|
33007
33050
|
* Check if zones in the command are well formed and
|
|
33008
33051
|
* not outside the sheet.
|
|
33009
33052
|
*/
|
|
33010
|
-
|
|
33011
|
-
|
|
33012
|
-
|
|
33013
|
-
|
|
33014
|
-
}
|
|
33015
|
-
if ("target" in cmd && Array.isArray(cmd.target)) {
|
|
33016
|
-
zones.push(...cmd.target);
|
|
33017
|
-
}
|
|
33018
|
-
if ("ranges" in cmd && Array.isArray(cmd.ranges)) {
|
|
33019
|
-
zones.push(...cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone));
|
|
33020
|
-
}
|
|
33021
|
-
if (!zones.every(isZoneValid)) {
|
|
33022
|
-
return 25 /* CommandResult.InvalidRange */;
|
|
33023
|
-
}
|
|
33024
|
-
else if (zones.length && "sheetId" in cmd) {
|
|
33025
|
-
const sheetZone = this.getSheetZone(cmd.sheetId);
|
|
33026
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone))
|
|
33027
|
-
? 0 /* CommandResult.Success */
|
|
33028
|
-
: 18 /* CommandResult.TargetOutOfSheet */;
|
|
33029
|
-
}
|
|
33030
|
-
return 0 /* CommandResult.Success */;
|
|
33053
|
+
checkZonesAreInSheet(cmd) {
|
|
33054
|
+
if (!("sheetId" in cmd))
|
|
33055
|
+
return 0 /* CommandResult.Success */;
|
|
33056
|
+
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
33031
33057
|
}
|
|
33032
33058
|
}
|
|
33033
33059
|
|
|
@@ -33618,7 +33644,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
33618
33644
|
}
|
|
33619
33645
|
break;
|
|
33620
33646
|
case "PASTE_CONDITIONAL_FORMAT":
|
|
33621
|
-
this.pasteCf(cmd.
|
|
33647
|
+
this.pasteCf(cmd.originPosition, cmd.targetPosition, cmd.operation);
|
|
33622
33648
|
break;
|
|
33623
33649
|
}
|
|
33624
33650
|
}
|
|
@@ -38603,18 +38629,7 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
38603
38629
|
// Command Handling
|
|
38604
38630
|
// ---------------------------------------------------------------------------
|
|
38605
38631
|
allowDispatch(cmd) {
|
|
38606
|
-
|
|
38607
|
-
case "AUTORESIZE_ROWS":
|
|
38608
|
-
case "AUTORESIZE_COLUMNS":
|
|
38609
|
-
try {
|
|
38610
|
-
this.getters.getSheet(cmd.sheetId);
|
|
38611
|
-
break;
|
|
38612
|
-
}
|
|
38613
|
-
catch (error) {
|
|
38614
|
-
return 27 /* CommandResult.InvalidSheetId */;
|
|
38615
|
-
}
|
|
38616
|
-
}
|
|
38617
|
-
return 0 /* CommandResult.Success */;
|
|
38632
|
+
return this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
38618
38633
|
}
|
|
38619
38634
|
handle(cmd) {
|
|
38620
38635
|
switch (cmd.type) {
|
|
@@ -38814,6 +38829,31 @@ class SheetUIPlugin extends UIPlugin {
|
|
|
38814
38829
|
splitWord.push(wordPart);
|
|
38815
38830
|
return splitWord;
|
|
38816
38831
|
}
|
|
38832
|
+
/**
|
|
38833
|
+
* Check that any "sheetId" in the command matches an existing
|
|
38834
|
+
* sheet.
|
|
38835
|
+
*/
|
|
38836
|
+
checkSheetExists(cmd) {
|
|
38837
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === undefined) {
|
|
38838
|
+
return 27 /* CommandResult.InvalidSheetId */;
|
|
38839
|
+
}
|
|
38840
|
+
return 0 /* CommandResult.Success */;
|
|
38841
|
+
}
|
|
38842
|
+
/**
|
|
38843
|
+
* Check if zones in the command are well formed and
|
|
38844
|
+
* not outside the sheet.
|
|
38845
|
+
*/
|
|
38846
|
+
checkZonesAreInSheet(cmd) {
|
|
38847
|
+
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
38848
|
+
const zones = this.getters.getCommandZones(cmd);
|
|
38849
|
+
if (!sheetId && zones.length > 0) {
|
|
38850
|
+
return 92 /* CommandResult.NoActiveSheet */;
|
|
38851
|
+
}
|
|
38852
|
+
if (sheetId && zones.length > 0) {
|
|
38853
|
+
return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
38854
|
+
}
|
|
38855
|
+
return 0 /* CommandResult.Success */;
|
|
38856
|
+
}
|
|
38817
38857
|
}
|
|
38818
38858
|
|
|
38819
38859
|
const genericRepeatsTransforms = [
|
|
@@ -39638,8 +39678,8 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
39638
39678
|
this.pasteCell(origin, position, this.operation, clipboardOptions);
|
|
39639
39679
|
if (shouldPasteCF) {
|
|
39640
39680
|
this.dispatch("PASTE_CONDITIONAL_FORMAT", {
|
|
39641
|
-
|
|
39642
|
-
|
|
39681
|
+
originPosition: origin.position,
|
|
39682
|
+
targetPosition: position,
|
|
39643
39683
|
operation: this.operation,
|
|
39644
39684
|
});
|
|
39645
39685
|
}
|
|
@@ -40030,7 +40070,7 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
40030
40070
|
allowDispatch(cmd) {
|
|
40031
40071
|
switch (cmd.type) {
|
|
40032
40072
|
case "CUT":
|
|
40033
|
-
const zones = cmd.
|
|
40073
|
+
const zones = cmd.cutTarget || this.getters.getSelectedZones();
|
|
40034
40074
|
const state = this.getClipboardState(zones, cmd.type);
|
|
40035
40075
|
return state.isCutAllowed(zones);
|
|
40036
40076
|
case "PASTE":
|
|
@@ -40060,7 +40100,7 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
40060
40100
|
switch (cmd.type) {
|
|
40061
40101
|
case "COPY":
|
|
40062
40102
|
case "CUT":
|
|
40063
|
-
const zones = ("
|
|
40103
|
+
const zones = ("cutTarget" in cmd && cmd.cutTarget) || this.getters.getSelectedZones();
|
|
40064
40104
|
this.state = this.getClipboardState(zones, cmd.type);
|
|
40065
40105
|
this.status = "visible";
|
|
40066
40106
|
break;
|
|
@@ -41016,6 +41056,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
41016
41056
|
"isSelected",
|
|
41017
41057
|
"isSingleColSelected",
|
|
41018
41058
|
"getElementsFromSelection",
|
|
41059
|
+
"tryGetActiveSheetId",
|
|
41019
41060
|
];
|
|
41020
41061
|
gridSelection = {
|
|
41021
41062
|
anchor: {
|
|
@@ -41231,6 +41272,9 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
41231
41272
|
getActiveSheetId() {
|
|
41232
41273
|
return this.activeSheet.id;
|
|
41233
41274
|
}
|
|
41275
|
+
tryGetActiveSheetId() {
|
|
41276
|
+
return this.activeSheet?.id;
|
|
41277
|
+
}
|
|
41234
41278
|
getActiveCell() {
|
|
41235
41279
|
return this.getters.getEvaluatedCell(this.getActivePosition());
|
|
41236
41280
|
}
|
|
@@ -41477,7 +41521,7 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
41477
41521
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
41478
41522
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
41479
41523
|
this.dispatch("CUT", {
|
|
41480
|
-
|
|
41524
|
+
cutTarget: [
|
|
41481
41525
|
{
|
|
41482
41526
|
left: isCol ? start + deltaCol : 0,
|
|
41483
41527
|
right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
@@ -46971,6 +47015,7 @@ class Model extends EventBus {
|
|
|
46971
47015
|
coreGetters;
|
|
46972
47016
|
uuidGenerator;
|
|
46973
47017
|
handlers = [];
|
|
47018
|
+
uiHandlers = [];
|
|
46974
47019
|
coreHandlers = [];
|
|
46975
47020
|
constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
|
|
46976
47021
|
super();
|
|
@@ -47010,17 +47055,20 @@ class Model extends EventBus {
|
|
|
47010
47055
|
const plugin = this.setupUiPlugin(Plugin);
|
|
47011
47056
|
this.statefulUIPlugins.push(plugin);
|
|
47012
47057
|
this.handlers.push(plugin);
|
|
47058
|
+
this.uiHandlers.push(plugin);
|
|
47013
47059
|
}
|
|
47014
47060
|
for (let Plugin of coreViewsPluginRegistry.getAll()) {
|
|
47015
47061
|
const plugin = this.setupUiPlugin(Plugin);
|
|
47016
47062
|
this.coreViewsPlugins.push(plugin);
|
|
47017
47063
|
this.handlers.push(plugin);
|
|
47064
|
+
this.uiHandlers.push(plugin);
|
|
47018
47065
|
this.coreHandlers.push(plugin);
|
|
47019
47066
|
}
|
|
47020
47067
|
for (let Plugin of featurePluginRegistry.getAll()) {
|
|
47021
47068
|
const plugin = this.setupUiPlugin(Plugin);
|
|
47022
47069
|
this.featurePlugins.push(plugin);
|
|
47023
47070
|
this.handlers.push(plugin);
|
|
47071
|
+
this.uiHandlers.push(plugin);
|
|
47024
47072
|
}
|
|
47025
47073
|
this.uuidGenerator.setIsFastStrategy(false);
|
|
47026
47074
|
// starting plugins
|
|
@@ -47189,7 +47237,7 @@ class Model extends EventBus {
|
|
|
47189
47237
|
return new DispatchResult(results.flat());
|
|
47190
47238
|
}
|
|
47191
47239
|
checkDispatchAllowedLocalCommand(command) {
|
|
47192
|
-
const results = this.
|
|
47240
|
+
const results = this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
47193
47241
|
return new DispatchResult(results.flat());
|
|
47194
47242
|
}
|
|
47195
47243
|
finalize() {
|
|
@@ -47478,6 +47526,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
47478
47526
|
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
47479
47527
|
|
|
47480
47528
|
|
|
47481
|
-
__info__.version = '16.
|
|
47482
|
-
__info__.date = '2023-05-
|
|
47483
|
-
__info__.hash = '
|
|
47529
|
+
__info__.version = '16.4.0-alpha.0';
|
|
47530
|
+
__info__.date = '2023-05-17T15:49:04.448Z';
|
|
47531
|
+
__info__.hash = '3a3aab7';
|
|
@@ -4397,6 +4397,7 @@
|
|
|
4397
4397
|
CommandResult[CommandResult["EmptySplitSeparator"] = 89] = "EmptySplitSeparator";
|
|
4398
4398
|
CommandResult[CommandResult["SplitWillOverwriteContent"] = 90] = "SplitWillOverwriteContent";
|
|
4399
4399
|
CommandResult[CommandResult["NoSplitSeparatorInSelection"] = 91] = "NoSplitSeparatorInSelection";
|
|
4400
|
+
CommandResult[CommandResult["NoActiveSheet"] = 92] = "NoActiveSheet";
|
|
4400
4401
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
4401
4402
|
|
|
4402
4403
|
const borderStyles = ["thin", "medium", "thick", "dashed", "dotted"];
|
|
@@ -17546,7 +17547,7 @@
|
|
|
17546
17547
|
})
|
|
17547
17548
|
.addChild("sort_range", ["data"], {
|
|
17548
17549
|
...sortRange,
|
|
17549
|
-
sequence:
|
|
17550
|
+
sequence: 10,
|
|
17550
17551
|
separator: true,
|
|
17551
17552
|
})
|
|
17552
17553
|
.addChild("sort_ascending", ["data", "sort_range"], {
|
|
@@ -17559,16 +17560,16 @@
|
|
|
17559
17560
|
})
|
|
17560
17561
|
.addChild("split_to_columns", ["data"], {
|
|
17561
17562
|
...splitToColumns,
|
|
17562
|
-
sequence:
|
|
17563
|
+
sequence: 20,
|
|
17563
17564
|
separator: true,
|
|
17564
17565
|
})
|
|
17565
17566
|
.addChild("add_data_filter", ["data"], {
|
|
17566
17567
|
...addDataFilter,
|
|
17567
|
-
sequence:
|
|
17568
|
+
sequence: 30,
|
|
17568
17569
|
})
|
|
17569
17570
|
.addChild("remove_data_filter", ["data"], {
|
|
17570
17571
|
...removeDataFilter,
|
|
17571
|
-
sequence:
|
|
17572
|
+
sequence: 30,
|
|
17572
17573
|
});
|
|
17573
17574
|
|
|
17574
17575
|
class OTRegistry extends Registry {
|
|
@@ -18675,6 +18676,18 @@
|
|
|
18675
18676
|
onCloseSidePanel: Function,
|
|
18676
18677
|
};
|
|
18677
18678
|
|
|
18679
|
+
css /* scss */ `
|
|
18680
|
+
.o-spreadsheet {
|
|
18681
|
+
.o-icon {
|
|
18682
|
+
.small-text {
|
|
18683
|
+
font: bold 9px sans-serif;
|
|
18684
|
+
}
|
|
18685
|
+
.heavy-text {
|
|
18686
|
+
font: bold 16px sans-serif;
|
|
18687
|
+
}
|
|
18688
|
+
}
|
|
18689
|
+
}
|
|
18690
|
+
`;
|
|
18678
18691
|
// -----------------------------------------------------------------------------
|
|
18679
18692
|
// We need here the svg of the icons that we need to convert to images for the renderer
|
|
18680
18693
|
// -----------------------------------------------------------------------------
|
|
@@ -32191,6 +32204,8 @@
|
|
|
32191
32204
|
"getSheetSize",
|
|
32192
32205
|
"getSheetZone",
|
|
32193
32206
|
"getPaneDivisions",
|
|
32207
|
+
"checkZonesExistInSheet",
|
|
32208
|
+
"getCommandZones",
|
|
32194
32209
|
];
|
|
32195
32210
|
sheetIdsMapName = {};
|
|
32196
32211
|
orderedSheetIds = [];
|
|
@@ -32200,7 +32215,7 @@
|
|
|
32200
32215
|
// Command Handling
|
|
32201
32216
|
// ---------------------------------------------------------------------------
|
|
32202
32217
|
allowDispatch(cmd) {
|
|
32203
|
-
const genericChecks = this.chainValidations(this.checkSheetExists, this.
|
|
32218
|
+
const genericChecks = this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
32204
32219
|
if (genericChecks !== 0 /* CommandResult.Success */) {
|
|
32205
32220
|
return genericChecks;
|
|
32206
32221
|
}
|
|
@@ -32540,6 +32555,37 @@
|
|
|
32540
32555
|
.map(({ col, row }) => this.getCell({ sheetId, col, row }))
|
|
32541
32556
|
.every((cell) => !cell || cell.content === "");
|
|
32542
32557
|
}
|
|
32558
|
+
getCommandZones(cmd) {
|
|
32559
|
+
const zones = [];
|
|
32560
|
+
if ("zone" in cmd) {
|
|
32561
|
+
zones.push(cmd.zone);
|
|
32562
|
+
}
|
|
32563
|
+
if ("target" in cmd) {
|
|
32564
|
+
zones.push(...cmd.target);
|
|
32565
|
+
}
|
|
32566
|
+
if ("ranges" in cmd) {
|
|
32567
|
+
zones.push(...cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone));
|
|
32568
|
+
}
|
|
32569
|
+
if ("col" in cmd && "row" in cmd) {
|
|
32570
|
+
zones.push({ top: cmd.row, left: cmd.col, bottom: cmd.row, right: cmd.col });
|
|
32571
|
+
}
|
|
32572
|
+
return zones;
|
|
32573
|
+
}
|
|
32574
|
+
/**
|
|
32575
|
+
* Check if zones in the command are well formed and
|
|
32576
|
+
* not outside the sheet.
|
|
32577
|
+
*/
|
|
32578
|
+
checkZonesExistInSheet(sheetId, zones) {
|
|
32579
|
+
if (!zones.every(isZoneValid))
|
|
32580
|
+
return 25 /* CommandResult.InvalidRange */;
|
|
32581
|
+
if (zones.length) {
|
|
32582
|
+
const sheetZone = this.getSheetZone(sheetId);
|
|
32583
|
+
return zones.every((zone) => isZoneInside(zone, sheetZone))
|
|
32584
|
+
? 0 /* CommandResult.Success */
|
|
32585
|
+
: 18 /* CommandResult.TargetOutOfSheet */;
|
|
32586
|
+
}
|
|
32587
|
+
return 0 /* CommandResult.Success */;
|
|
32588
|
+
}
|
|
32543
32589
|
updateCellPosition(cmd) {
|
|
32544
32590
|
const { sheetId, cellId, col, row } = cmd;
|
|
32545
32591
|
if (cellId) {
|
|
@@ -32988,9 +33034,6 @@
|
|
|
32988
33034
|
}
|
|
32989
33035
|
return { rowNumber, colNumber };
|
|
32990
33036
|
}
|
|
32991
|
-
// ----------------------------------------------------
|
|
32992
|
-
// HIDE / SHOW
|
|
32993
|
-
// ----------------------------------------------------
|
|
32994
33037
|
/**
|
|
32995
33038
|
* Check that any "sheetId" in the command matches an existing
|
|
32996
33039
|
* sheet.
|
|
@@ -33008,27 +33051,10 @@
|
|
|
33008
33051
|
* Check if zones in the command are well formed and
|
|
33009
33052
|
* not outside the sheet.
|
|
33010
33053
|
*/
|
|
33011
|
-
|
|
33012
|
-
|
|
33013
|
-
|
|
33014
|
-
|
|
33015
|
-
}
|
|
33016
|
-
if ("target" in cmd && Array.isArray(cmd.target)) {
|
|
33017
|
-
zones.push(...cmd.target);
|
|
33018
|
-
}
|
|
33019
|
-
if ("ranges" in cmd && Array.isArray(cmd.ranges)) {
|
|
33020
|
-
zones.push(...cmd.ranges.map((rangeData) => this.getters.getRangeFromRangeData(rangeData).zone));
|
|
33021
|
-
}
|
|
33022
|
-
if (!zones.every(isZoneValid)) {
|
|
33023
|
-
return 25 /* CommandResult.InvalidRange */;
|
|
33024
|
-
}
|
|
33025
|
-
else if (zones.length && "sheetId" in cmd) {
|
|
33026
|
-
const sheetZone = this.getSheetZone(cmd.sheetId);
|
|
33027
|
-
return zones.every((zone) => isZoneInside(zone, sheetZone))
|
|
33028
|
-
? 0 /* CommandResult.Success */
|
|
33029
|
-
: 18 /* CommandResult.TargetOutOfSheet */;
|
|
33030
|
-
}
|
|
33031
|
-
return 0 /* CommandResult.Success */;
|
|
33054
|
+
checkZonesAreInSheet(cmd) {
|
|
33055
|
+
if (!("sheetId" in cmd))
|
|
33056
|
+
return 0 /* CommandResult.Success */;
|
|
33057
|
+
return this.checkZonesExistInSheet(cmd.sheetId, this.getCommandZones(cmd));
|
|
33032
33058
|
}
|
|
33033
33059
|
}
|
|
33034
33060
|
|
|
@@ -33619,7 +33645,7 @@
|
|
|
33619
33645
|
}
|
|
33620
33646
|
break;
|
|
33621
33647
|
case "PASTE_CONDITIONAL_FORMAT":
|
|
33622
|
-
this.pasteCf(cmd.
|
|
33648
|
+
this.pasteCf(cmd.originPosition, cmd.targetPosition, cmd.operation);
|
|
33623
33649
|
break;
|
|
33624
33650
|
}
|
|
33625
33651
|
}
|
|
@@ -38604,18 +38630,7 @@
|
|
|
38604
38630
|
// Command Handling
|
|
38605
38631
|
// ---------------------------------------------------------------------------
|
|
38606
38632
|
allowDispatch(cmd) {
|
|
38607
|
-
|
|
38608
|
-
case "AUTORESIZE_ROWS":
|
|
38609
|
-
case "AUTORESIZE_COLUMNS":
|
|
38610
|
-
try {
|
|
38611
|
-
this.getters.getSheet(cmd.sheetId);
|
|
38612
|
-
break;
|
|
38613
|
-
}
|
|
38614
|
-
catch (error) {
|
|
38615
|
-
return 27 /* CommandResult.InvalidSheetId */;
|
|
38616
|
-
}
|
|
38617
|
-
}
|
|
38618
|
-
return 0 /* CommandResult.Success */;
|
|
38633
|
+
return this.chainValidations(this.checkSheetExists, this.checkZonesAreInSheet)(cmd);
|
|
38619
38634
|
}
|
|
38620
38635
|
handle(cmd) {
|
|
38621
38636
|
switch (cmd.type) {
|
|
@@ -38815,6 +38830,31 @@
|
|
|
38815
38830
|
splitWord.push(wordPart);
|
|
38816
38831
|
return splitWord;
|
|
38817
38832
|
}
|
|
38833
|
+
/**
|
|
38834
|
+
* Check that any "sheetId" in the command matches an existing
|
|
38835
|
+
* sheet.
|
|
38836
|
+
*/
|
|
38837
|
+
checkSheetExists(cmd) {
|
|
38838
|
+
if ("sheetId" in cmd && this.getters.tryGetSheet(cmd.sheetId) === undefined) {
|
|
38839
|
+
return 27 /* CommandResult.InvalidSheetId */;
|
|
38840
|
+
}
|
|
38841
|
+
return 0 /* CommandResult.Success */;
|
|
38842
|
+
}
|
|
38843
|
+
/**
|
|
38844
|
+
* Check if zones in the command are well formed and
|
|
38845
|
+
* not outside the sheet.
|
|
38846
|
+
*/
|
|
38847
|
+
checkZonesAreInSheet(cmd) {
|
|
38848
|
+
const sheetId = "sheetId" in cmd ? cmd.sheetId : this.getters.tryGetActiveSheetId();
|
|
38849
|
+
const zones = this.getters.getCommandZones(cmd);
|
|
38850
|
+
if (!sheetId && zones.length > 0) {
|
|
38851
|
+
return 92 /* CommandResult.NoActiveSheet */;
|
|
38852
|
+
}
|
|
38853
|
+
if (sheetId && zones.length > 0) {
|
|
38854
|
+
return this.getters.checkZonesExistInSheet(sheetId, zones);
|
|
38855
|
+
}
|
|
38856
|
+
return 0 /* CommandResult.Success */;
|
|
38857
|
+
}
|
|
38818
38858
|
}
|
|
38819
38859
|
|
|
38820
38860
|
const genericRepeatsTransforms = [
|
|
@@ -39639,8 +39679,8 @@
|
|
|
39639
39679
|
this.pasteCell(origin, position, this.operation, clipboardOptions);
|
|
39640
39680
|
if (shouldPasteCF) {
|
|
39641
39681
|
this.dispatch("PASTE_CONDITIONAL_FORMAT", {
|
|
39642
|
-
|
|
39643
|
-
|
|
39682
|
+
originPosition: origin.position,
|
|
39683
|
+
targetPosition: position,
|
|
39644
39684
|
operation: this.operation,
|
|
39645
39685
|
});
|
|
39646
39686
|
}
|
|
@@ -40031,7 +40071,7 @@
|
|
|
40031
40071
|
allowDispatch(cmd) {
|
|
40032
40072
|
switch (cmd.type) {
|
|
40033
40073
|
case "CUT":
|
|
40034
|
-
const zones = cmd.
|
|
40074
|
+
const zones = cmd.cutTarget || this.getters.getSelectedZones();
|
|
40035
40075
|
const state = this.getClipboardState(zones, cmd.type);
|
|
40036
40076
|
return state.isCutAllowed(zones);
|
|
40037
40077
|
case "PASTE":
|
|
@@ -40061,7 +40101,7 @@
|
|
|
40061
40101
|
switch (cmd.type) {
|
|
40062
40102
|
case "COPY":
|
|
40063
40103
|
case "CUT":
|
|
40064
|
-
const zones = ("
|
|
40104
|
+
const zones = ("cutTarget" in cmd && cmd.cutTarget) || this.getters.getSelectedZones();
|
|
40065
40105
|
this.state = this.getClipboardState(zones, cmd.type);
|
|
40066
40106
|
this.status = "visible";
|
|
40067
40107
|
break;
|
|
@@ -41017,6 +41057,7 @@
|
|
|
41017
41057
|
"isSelected",
|
|
41018
41058
|
"isSingleColSelected",
|
|
41019
41059
|
"getElementsFromSelection",
|
|
41060
|
+
"tryGetActiveSheetId",
|
|
41020
41061
|
];
|
|
41021
41062
|
gridSelection = {
|
|
41022
41063
|
anchor: {
|
|
@@ -41232,6 +41273,9 @@
|
|
|
41232
41273
|
getActiveSheetId() {
|
|
41233
41274
|
return this.activeSheet.id;
|
|
41234
41275
|
}
|
|
41276
|
+
tryGetActiveSheetId() {
|
|
41277
|
+
return this.activeSheet?.id;
|
|
41278
|
+
}
|
|
41235
41279
|
getActiveCell() {
|
|
41236
41280
|
return this.getters.getEvaluatedCell(this.getActivePosition());
|
|
41237
41281
|
}
|
|
@@ -41478,7 +41522,7 @@
|
|
|
41478
41522
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
41479
41523
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
41480
41524
|
this.dispatch("CUT", {
|
|
41481
|
-
|
|
41525
|
+
cutTarget: [
|
|
41482
41526
|
{
|
|
41483
41527
|
left: isCol ? start + deltaCol : 0,
|
|
41484
41528
|
right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
@@ -46972,6 +47016,7 @@
|
|
|
46972
47016
|
coreGetters;
|
|
46973
47017
|
uuidGenerator;
|
|
46974
47018
|
handlers = [];
|
|
47019
|
+
uiHandlers = [];
|
|
46975
47020
|
coreHandlers = [];
|
|
46976
47021
|
constructor(data = {}, config = {}, stateUpdateMessages = [], uuidGenerator = new UuidGenerator(), verboseImport = true) {
|
|
46977
47022
|
super();
|
|
@@ -47011,17 +47056,20 @@
|
|
|
47011
47056
|
const plugin = this.setupUiPlugin(Plugin);
|
|
47012
47057
|
this.statefulUIPlugins.push(plugin);
|
|
47013
47058
|
this.handlers.push(plugin);
|
|
47059
|
+
this.uiHandlers.push(plugin);
|
|
47014
47060
|
}
|
|
47015
47061
|
for (let Plugin of coreViewsPluginRegistry.getAll()) {
|
|
47016
47062
|
const plugin = this.setupUiPlugin(Plugin);
|
|
47017
47063
|
this.coreViewsPlugins.push(plugin);
|
|
47018
47064
|
this.handlers.push(plugin);
|
|
47065
|
+
this.uiHandlers.push(plugin);
|
|
47019
47066
|
this.coreHandlers.push(plugin);
|
|
47020
47067
|
}
|
|
47021
47068
|
for (let Plugin of featurePluginRegistry.getAll()) {
|
|
47022
47069
|
const plugin = this.setupUiPlugin(Plugin);
|
|
47023
47070
|
this.featurePlugins.push(plugin);
|
|
47024
47071
|
this.handlers.push(plugin);
|
|
47072
|
+
this.uiHandlers.push(plugin);
|
|
47025
47073
|
}
|
|
47026
47074
|
this.uuidGenerator.setIsFastStrategy(false);
|
|
47027
47075
|
// starting plugins
|
|
@@ -47190,7 +47238,7 @@
|
|
|
47190
47238
|
return new DispatchResult(results.flat());
|
|
47191
47239
|
}
|
|
47192
47240
|
checkDispatchAllowedLocalCommand(command) {
|
|
47193
|
-
const results = this.
|
|
47241
|
+
const results = this.uiHandlers.map((handler) => handler.allowDispatch(command));
|
|
47194
47242
|
return new DispatchResult(results.flat());
|
|
47195
47243
|
}
|
|
47196
47244
|
finalize() {
|
|
@@ -47509,9 +47557,9 @@
|
|
|
47509
47557
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47510
47558
|
|
|
47511
47559
|
|
|
47512
|
-
__info__.version = '16.
|
|
47513
|
-
__info__.date = '2023-05-
|
|
47514
|
-
__info__.hash = '
|
|
47560
|
+
__info__.version = '16.4.0-alpha.0';
|
|
47561
|
+
__info__.date = '2023-05-17T15:49:04.448Z';
|
|
47562
|
+
__info__.hash = '3a3aab7';
|
|
47515
47563
|
|
|
47516
47564
|
|
|
47517
47565
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|