@odoo/o-spreadsheet 16.0.18 → 16.0.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 +91 -73
- package/dist/o-spreadsheet.d.ts +2 -2
- package/dist/o-spreadsheet.esm.js +91 -73
- package/dist/o-spreadsheet.iife.js +91 -73
- package/dist/o-spreadsheet.iife.min.js +227 -227
- package/package.json +2 -2
|
@@ -1010,13 +1010,17 @@ function getAddHeaderStartIndex(position, base) {
|
|
|
1010
1010
|
return position === "after" ? base + 1 : base;
|
|
1011
1011
|
}
|
|
1012
1012
|
/**
|
|
1013
|
-
*
|
|
1013
|
+
* Compares two objects.
|
|
1014
1014
|
*/
|
|
1015
1015
|
function deepEquals(o1, o2) {
|
|
1016
1016
|
if (o1 === o2)
|
|
1017
1017
|
return true;
|
|
1018
1018
|
if ((o1 && !o2) || (o2 && !o1))
|
|
1019
1019
|
return false;
|
|
1020
|
+
if (typeof o1 !== typeof o2)
|
|
1021
|
+
return false;
|
|
1022
|
+
if (typeof o1 !== "object")
|
|
1023
|
+
return o1 === o2;
|
|
1020
1024
|
// Objects can have different keys if the values are undefined
|
|
1021
1025
|
const keys = new Set();
|
|
1022
1026
|
Object.keys(o1).forEach((key) => keys.add(key));
|
|
@@ -3689,6 +3693,9 @@ class FilterMenu extends owl.Component {
|
|
|
3689
3693
|
});
|
|
3690
3694
|
this.state.values = this.getFilterValues(this.props.filterPosition);
|
|
3691
3695
|
}
|
|
3696
|
+
get isReadonly() {
|
|
3697
|
+
return this.env.model.getters.isReadonly();
|
|
3698
|
+
}
|
|
3692
3699
|
getFilterValues(position) {
|
|
3693
3700
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
3694
3701
|
const filter = this.env.model.getters.getFilter(sheetId, position.col, position.row);
|
|
@@ -10007,9 +10014,9 @@ class FindAndReplacePanel extends owl.Component {
|
|
|
10007
10014
|
}
|
|
10008
10015
|
setup() {
|
|
10009
10016
|
this.showFormulaState = this.env.model.getters.shouldShowFormulas();
|
|
10010
|
-
this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
|
|
10011
10017
|
owl.onMounted(() => this.focusInput());
|
|
10012
10018
|
owl.onWillUnmount(() => {
|
|
10019
|
+
clearTimeout(this.debounceTimeoutId);
|
|
10013
10020
|
this.env.model.dispatch("CLEAR_SEARCH");
|
|
10014
10021
|
this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
|
|
10015
10022
|
});
|
|
@@ -10052,6 +10059,13 @@ class FindAndReplacePanel extends owl.Component {
|
|
|
10052
10059
|
searchOptions: this.state.searchOptions,
|
|
10053
10060
|
});
|
|
10054
10061
|
}
|
|
10062
|
+
debouncedUpdateSearch() {
|
|
10063
|
+
clearTimeout(this.debounceTimeoutId);
|
|
10064
|
+
this.debounceTimeoutId = setTimeout(() => {
|
|
10065
|
+
this.updateSearch();
|
|
10066
|
+
this.debounceTimeoutId = undefined;
|
|
10067
|
+
}, 200);
|
|
10068
|
+
}
|
|
10055
10069
|
replace() {
|
|
10056
10070
|
this.env.model.dispatch("REPLACE_SEARCH", {
|
|
10057
10071
|
replaceWith: this.state.replaceWith,
|
|
@@ -21300,9 +21314,11 @@ function useCellHovered(env, gridRef, callback) {
|
|
|
21300
21314
|
}
|
|
21301
21315
|
}
|
|
21302
21316
|
function updateMousePosition(e) {
|
|
21303
|
-
|
|
21304
|
-
|
|
21305
|
-
|
|
21317
|
+
if (gridRef.el === e.target) {
|
|
21318
|
+
x = e.offsetX;
|
|
21319
|
+
y = e.offsetY;
|
|
21320
|
+
lastMoved = Date.now();
|
|
21321
|
+
}
|
|
21306
21322
|
}
|
|
21307
21323
|
function recompute() {
|
|
21308
21324
|
const { col, row } = getPosition();
|
|
@@ -28946,7 +28962,11 @@ class HeaderSizePlugin extends CorePlugin {
|
|
|
28946
28962
|
let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
|
|
28947
28963
|
const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
|
|
28948
28964
|
const baseSize = sizes[cmd.base];
|
|
28949
|
-
|
|
28965
|
+
const sizesToInsert = range(0, cmd.quantity).map(() => ({
|
|
28966
|
+
manualSize: baseSize.manualSize,
|
|
28967
|
+
computedSize: lazy(baseSize.computedSize()),
|
|
28968
|
+
}));
|
|
28969
|
+
sizes.splice(addIndex, 0, ...sizesToInsert);
|
|
28950
28970
|
sizes = sizes.map((size, row) => {
|
|
28951
28971
|
if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
|
|
28952
28972
|
// invalidate sizes
|
|
@@ -31647,7 +31667,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
31647
31667
|
});
|
|
31648
31668
|
for (const filterTable of this.copiedTables) {
|
|
31649
31669
|
this.dispatch("REMOVE_FILTER_TABLE", {
|
|
31650
|
-
sheetId: this.
|
|
31670
|
+
sheetId: this.sheetId,
|
|
31651
31671
|
target: [filterTable.zone],
|
|
31652
31672
|
});
|
|
31653
31673
|
}
|
|
@@ -32062,7 +32082,7 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
32062
32082
|
allowDispatch(cmd) {
|
|
32063
32083
|
switch (cmd.type) {
|
|
32064
32084
|
case "CUT":
|
|
32065
|
-
const zones =
|
|
32085
|
+
const zones = this.getters.getSelectedZones();
|
|
32066
32086
|
const state = this.getClipboardState(zones, cmd.type);
|
|
32067
32087
|
return state.isCutAllowed(zones);
|
|
32068
32088
|
case "PASTE":
|
|
@@ -32093,7 +32113,7 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
32093
32113
|
switch (cmd.type) {
|
|
32094
32114
|
case "COPY":
|
|
32095
32115
|
case "CUT":
|
|
32096
|
-
const zones =
|
|
32116
|
+
const zones = this.getters.getSelectedZones();
|
|
32097
32117
|
this.state = this.getClipboardState(zones, cmd.type);
|
|
32098
32118
|
this.status = "visible";
|
|
32099
32119
|
break;
|
|
@@ -32711,6 +32731,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
32711
32731
|
// stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
|
|
32712
32732
|
this.computedStyles = {};
|
|
32713
32733
|
this.computedIcons = {};
|
|
32734
|
+
this.uuidGenerator = new UuidGenerator();
|
|
32714
32735
|
/**
|
|
32715
32736
|
* Execute the predicate to know if a conditional formatting rule should be applied to a cell
|
|
32716
32737
|
*/
|
|
@@ -33062,8 +33083,9 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
33062
33083
|
this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
|
|
33063
33084
|
}
|
|
33064
33085
|
else {
|
|
33065
|
-
this.adaptRules(target.sheetId, cf, [xc], []);
|
|
33066
33086
|
this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
|
|
33087
|
+
const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
|
|
33088
|
+
this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
|
|
33067
33089
|
}
|
|
33068
33090
|
}
|
|
33069
33091
|
}
|
|
@@ -33072,6 +33094,12 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
33072
33094
|
isCellValueNumber(value) {
|
|
33073
33095
|
return typeof value === "number";
|
|
33074
33096
|
}
|
|
33097
|
+
getCFToCopyTo(targetSheetId, originCF) {
|
|
33098
|
+
const cfInTarget = this.getters
|
|
33099
|
+
.getConditionalFormats(targetSheetId)
|
|
33100
|
+
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
33101
|
+
return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
|
|
33102
|
+
}
|
|
33075
33103
|
}
|
|
33076
33104
|
EvaluationConditionalFormatPlugin.getters = ["getConditionalIcon", "getCellComputedStyle"];
|
|
33077
33105
|
|
|
@@ -34839,26 +34867,24 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
34839
34867
|
const isBasedBefore = cmd.base < start;
|
|
34840
34868
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
34841
34869
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
34842
|
-
|
|
34843
|
-
|
|
34844
|
-
|
|
34845
|
-
|
|
34846
|
-
|
|
34847
|
-
|
|
34848
|
-
|
|
34849
|
-
|
|
34850
|
-
|
|
34851
|
-
|
|
34852
|
-
|
|
34853
|
-
|
|
34854
|
-
|
|
34855
|
-
|
|
34856
|
-
|
|
34857
|
-
|
|
34858
|
-
|
|
34859
|
-
|
|
34860
|
-
],
|
|
34861
|
-
});
|
|
34870
|
+
const target = [
|
|
34871
|
+
{
|
|
34872
|
+
left: isCol ? start + deltaCol : 0,
|
|
34873
|
+
right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
34874
|
+
top: !isCol ? start + deltaRow : 0,
|
|
34875
|
+
bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
34876
|
+
},
|
|
34877
|
+
];
|
|
34878
|
+
const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
|
|
34879
|
+
const pasteTarget = [
|
|
34880
|
+
{
|
|
34881
|
+
left: isCol ? cmd.base : 0,
|
|
34882
|
+
right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
34883
|
+
top: !isCol ? cmd.base : 0,
|
|
34884
|
+
bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
34885
|
+
},
|
|
34886
|
+
];
|
|
34887
|
+
state.paste(pasteTarget, { selectTarget: true });
|
|
34862
34888
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
34863
34889
|
let currentIndex = cmd.base;
|
|
34864
34890
|
for (const element of toRemove) {
|
|
@@ -36300,30 +36326,26 @@ class InternalViewport {
|
|
|
36300
36326
|
const { end } = this.getters.getColDimensions(sheetId, targetCol);
|
|
36301
36327
|
const maxCol = this.getters.getNumberCols(sheetId);
|
|
36302
36328
|
if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
|
|
36303
|
-
|
|
36304
|
-
|
|
36305
|
-
|
|
36306
|
-
}
|
|
36307
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
36308
|
-
continue;
|
|
36309
|
-
}
|
|
36310
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
|
|
36311
|
-
this.offsetScrollbarX = this.offsetX;
|
|
36312
|
-
this.adjustViewportZoneX();
|
|
36329
|
+
let finalTarget = targetCol;
|
|
36330
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
|
|
36331
|
+
finalTarget++;
|
|
36313
36332
|
}
|
|
36333
|
+
const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
|
|
36334
|
+
const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
|
|
36335
|
+
this.offsetX =
|
|
36336
|
+
this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
|
|
36337
|
+
this.offsetScrollbarX = this.offsetX;
|
|
36338
|
+
this.adjustViewportZoneX();
|
|
36314
36339
|
}
|
|
36315
36340
|
else if (this.left > targetCol) {
|
|
36316
|
-
|
|
36317
|
-
|
|
36318
|
-
|
|
36319
|
-
}
|
|
36320
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
36321
|
-
continue;
|
|
36322
|
-
}
|
|
36323
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
|
|
36324
|
-
this.offsetScrollbarX = this.offsetX;
|
|
36325
|
-
this.adjustViewportZoneX();
|
|
36341
|
+
let finalTarget = targetCol;
|
|
36342
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
|
|
36343
|
+
finalTarget--;
|
|
36326
36344
|
}
|
|
36345
|
+
this.offsetX =
|
|
36346
|
+
this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
|
|
36347
|
+
this.offsetScrollbarX = this.offsetX;
|
|
36348
|
+
this.adjustViewportZoneX();
|
|
36327
36349
|
}
|
|
36328
36350
|
}
|
|
36329
36351
|
adjustPositionY(targetRow) {
|
|
@@ -36331,30 +36353,26 @@ class InternalViewport {
|
|
|
36331
36353
|
const { end } = this.getters.getRowDimensions(sheetId, targetRow);
|
|
36332
36354
|
const maxRow = this.getters.getNumberRows(sheetId);
|
|
36333
36355
|
if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
|
|
36334
|
-
|
|
36335
|
-
|
|
36336
|
-
|
|
36337
|
-
}
|
|
36338
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
36339
|
-
continue;
|
|
36340
|
-
}
|
|
36341
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
|
|
36342
|
-
this.offsetScrollbarY = this.offsetY;
|
|
36343
|
-
this.adjustViewportZoneY();
|
|
36356
|
+
let finalTarget = targetRow;
|
|
36357
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
|
|
36358
|
+
finalTarget++;
|
|
36344
36359
|
}
|
|
36360
|
+
const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
|
|
36361
|
+
const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
|
|
36362
|
+
this.offsetY =
|
|
36363
|
+
this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
|
|
36364
|
+
this.offsetScrollbarY = this.offsetY;
|
|
36365
|
+
this.adjustViewportZoneY();
|
|
36345
36366
|
}
|
|
36346
36367
|
else if (this.top > targetRow) {
|
|
36347
|
-
|
|
36348
|
-
|
|
36349
|
-
|
|
36350
|
-
}
|
|
36351
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
36352
|
-
continue;
|
|
36353
|
-
}
|
|
36354
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
|
|
36355
|
-
this.offsetScrollbarY = this.offsetY;
|
|
36356
|
-
this.adjustViewportZoneY();
|
|
36368
|
+
let finalTarget = targetRow;
|
|
36369
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
|
|
36370
|
+
finalTarget--;
|
|
36357
36371
|
}
|
|
36372
|
+
this.offsetY =
|
|
36373
|
+
this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
|
|
36374
|
+
this.offsetScrollbarY = this.offsetY;
|
|
36375
|
+
this.adjustViewportZoneY();
|
|
36358
36376
|
}
|
|
36359
36377
|
}
|
|
36360
36378
|
setViewportOffset(offsetX, offsetY) {
|
|
@@ -42906,6 +42924,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
42906
42924
|
exports.tokenize = tokenize;
|
|
42907
42925
|
|
|
42908
42926
|
|
|
42909
|
-
__info__.version = '16.0.
|
|
42910
|
-
__info__.date = '2023-
|
|
42911
|
-
__info__.hash = '
|
|
42927
|
+
__info__.version = '16.0.20';
|
|
42928
|
+
__info__.date = '2023-10-03T12:43:02.601Z';
|
|
42929
|
+
__info__.hash = '3be5a75';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -1729,8 +1729,6 @@ interface CopyCommand {
|
|
|
1729
1729
|
}
|
|
1730
1730
|
interface CutCommand {
|
|
1731
1731
|
type: "CUT";
|
|
1732
|
-
/** Zones to cut. If none were given, will copy the zones in the selection*/
|
|
1733
|
-
target?: Zone[];
|
|
1734
1732
|
}
|
|
1735
1733
|
interface PasteCommand {
|
|
1736
1734
|
type: "PASTE";
|
|
@@ -3916,6 +3914,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
3916
3914
|
private isStale;
|
|
3917
3915
|
private computedStyles;
|
|
3918
3916
|
private computedIcons;
|
|
3917
|
+
private uuidGenerator;
|
|
3919
3918
|
handle(cmd: Command): void;
|
|
3920
3919
|
finalize(): void;
|
|
3921
3920
|
getCellComputedStyle(sheetId: UID, col: HeaderIndex, row: HeaderIndex): Style;
|
|
@@ -3947,6 +3946,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
3947
3946
|
private adaptRules;
|
|
3948
3947
|
private pasteCf;
|
|
3949
3948
|
private isCellValueNumber;
|
|
3949
|
+
private getCFToCopyTo;
|
|
3950
3950
|
}
|
|
3951
3951
|
|
|
3952
3952
|
declare class FilterEvaluationPlugin extends UIPlugin {
|
|
@@ -1006,13 +1006,17 @@ function getAddHeaderStartIndex(position, base) {
|
|
|
1006
1006
|
return position === "after" ? base + 1 : base;
|
|
1007
1007
|
}
|
|
1008
1008
|
/**
|
|
1009
|
-
*
|
|
1009
|
+
* Compares two objects.
|
|
1010
1010
|
*/
|
|
1011
1011
|
function deepEquals(o1, o2) {
|
|
1012
1012
|
if (o1 === o2)
|
|
1013
1013
|
return true;
|
|
1014
1014
|
if ((o1 && !o2) || (o2 && !o1))
|
|
1015
1015
|
return false;
|
|
1016
|
+
if (typeof o1 !== typeof o2)
|
|
1017
|
+
return false;
|
|
1018
|
+
if (typeof o1 !== "object")
|
|
1019
|
+
return o1 === o2;
|
|
1016
1020
|
// Objects can have different keys if the values are undefined
|
|
1017
1021
|
const keys = new Set();
|
|
1018
1022
|
Object.keys(o1).forEach((key) => keys.add(key));
|
|
@@ -3685,6 +3689,9 @@ class FilterMenu extends Component {
|
|
|
3685
3689
|
});
|
|
3686
3690
|
this.state.values = this.getFilterValues(this.props.filterPosition);
|
|
3687
3691
|
}
|
|
3692
|
+
get isReadonly() {
|
|
3693
|
+
return this.env.model.getters.isReadonly();
|
|
3694
|
+
}
|
|
3688
3695
|
getFilterValues(position) {
|
|
3689
3696
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
3690
3697
|
const filter = this.env.model.getters.getFilter(sheetId, position.col, position.row);
|
|
@@ -10003,9 +10010,9 @@ class FindAndReplacePanel extends Component {
|
|
|
10003
10010
|
}
|
|
10004
10011
|
setup() {
|
|
10005
10012
|
this.showFormulaState = this.env.model.getters.shouldShowFormulas();
|
|
10006
|
-
this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
|
|
10007
10013
|
onMounted(() => this.focusInput());
|
|
10008
10014
|
onWillUnmount(() => {
|
|
10015
|
+
clearTimeout(this.debounceTimeoutId);
|
|
10009
10016
|
this.env.model.dispatch("CLEAR_SEARCH");
|
|
10010
10017
|
this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
|
|
10011
10018
|
});
|
|
@@ -10048,6 +10055,13 @@ class FindAndReplacePanel extends Component {
|
|
|
10048
10055
|
searchOptions: this.state.searchOptions,
|
|
10049
10056
|
});
|
|
10050
10057
|
}
|
|
10058
|
+
debouncedUpdateSearch() {
|
|
10059
|
+
clearTimeout(this.debounceTimeoutId);
|
|
10060
|
+
this.debounceTimeoutId = setTimeout(() => {
|
|
10061
|
+
this.updateSearch();
|
|
10062
|
+
this.debounceTimeoutId = undefined;
|
|
10063
|
+
}, 200);
|
|
10064
|
+
}
|
|
10051
10065
|
replace() {
|
|
10052
10066
|
this.env.model.dispatch("REPLACE_SEARCH", {
|
|
10053
10067
|
replaceWith: this.state.replaceWith,
|
|
@@ -21296,9 +21310,11 @@ function useCellHovered(env, gridRef, callback) {
|
|
|
21296
21310
|
}
|
|
21297
21311
|
}
|
|
21298
21312
|
function updateMousePosition(e) {
|
|
21299
|
-
|
|
21300
|
-
|
|
21301
|
-
|
|
21313
|
+
if (gridRef.el === e.target) {
|
|
21314
|
+
x = e.offsetX;
|
|
21315
|
+
y = e.offsetY;
|
|
21316
|
+
lastMoved = Date.now();
|
|
21317
|
+
}
|
|
21302
21318
|
}
|
|
21303
21319
|
function recompute() {
|
|
21304
21320
|
const { col, row } = getPosition();
|
|
@@ -28942,7 +28958,11 @@ class HeaderSizePlugin extends CorePlugin {
|
|
|
28942
28958
|
let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
|
|
28943
28959
|
const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
|
|
28944
28960
|
const baseSize = sizes[cmd.base];
|
|
28945
|
-
|
|
28961
|
+
const sizesToInsert = range(0, cmd.quantity).map(() => ({
|
|
28962
|
+
manualSize: baseSize.manualSize,
|
|
28963
|
+
computedSize: lazy(baseSize.computedSize()),
|
|
28964
|
+
}));
|
|
28965
|
+
sizes.splice(addIndex, 0, ...sizesToInsert);
|
|
28946
28966
|
sizes = sizes.map((size, row) => {
|
|
28947
28967
|
if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
|
|
28948
28968
|
// invalidate sizes
|
|
@@ -31643,7 +31663,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
31643
31663
|
});
|
|
31644
31664
|
for (const filterTable of this.copiedTables) {
|
|
31645
31665
|
this.dispatch("REMOVE_FILTER_TABLE", {
|
|
31646
|
-
sheetId: this.
|
|
31666
|
+
sheetId: this.sheetId,
|
|
31647
31667
|
target: [filterTable.zone],
|
|
31648
31668
|
});
|
|
31649
31669
|
}
|
|
@@ -32058,7 +32078,7 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
32058
32078
|
allowDispatch(cmd) {
|
|
32059
32079
|
switch (cmd.type) {
|
|
32060
32080
|
case "CUT":
|
|
32061
|
-
const zones =
|
|
32081
|
+
const zones = this.getters.getSelectedZones();
|
|
32062
32082
|
const state = this.getClipboardState(zones, cmd.type);
|
|
32063
32083
|
return state.isCutAllowed(zones);
|
|
32064
32084
|
case "PASTE":
|
|
@@ -32089,7 +32109,7 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
32089
32109
|
switch (cmd.type) {
|
|
32090
32110
|
case "COPY":
|
|
32091
32111
|
case "CUT":
|
|
32092
|
-
const zones =
|
|
32112
|
+
const zones = this.getters.getSelectedZones();
|
|
32093
32113
|
this.state = this.getClipboardState(zones, cmd.type);
|
|
32094
32114
|
this.status = "visible";
|
|
32095
32115
|
break;
|
|
@@ -32707,6 +32727,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
32707
32727
|
// stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
|
|
32708
32728
|
this.computedStyles = {};
|
|
32709
32729
|
this.computedIcons = {};
|
|
32730
|
+
this.uuidGenerator = new UuidGenerator();
|
|
32710
32731
|
/**
|
|
32711
32732
|
* Execute the predicate to know if a conditional formatting rule should be applied to a cell
|
|
32712
32733
|
*/
|
|
@@ -33058,8 +33079,9 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
33058
33079
|
this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
|
|
33059
33080
|
}
|
|
33060
33081
|
else {
|
|
33061
|
-
this.adaptRules(target.sheetId, cf, [xc], []);
|
|
33062
33082
|
this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
|
|
33083
|
+
const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
|
|
33084
|
+
this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
|
|
33063
33085
|
}
|
|
33064
33086
|
}
|
|
33065
33087
|
}
|
|
@@ -33068,6 +33090,12 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
33068
33090
|
isCellValueNumber(value) {
|
|
33069
33091
|
return typeof value === "number";
|
|
33070
33092
|
}
|
|
33093
|
+
getCFToCopyTo(targetSheetId, originCF) {
|
|
33094
|
+
const cfInTarget = this.getters
|
|
33095
|
+
.getConditionalFormats(targetSheetId)
|
|
33096
|
+
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
33097
|
+
return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
|
|
33098
|
+
}
|
|
33071
33099
|
}
|
|
33072
33100
|
EvaluationConditionalFormatPlugin.getters = ["getConditionalIcon", "getCellComputedStyle"];
|
|
33073
33101
|
|
|
@@ -34835,26 +34863,24 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
34835
34863
|
const isBasedBefore = cmd.base < start;
|
|
34836
34864
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
34837
34865
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
34838
|
-
|
|
34839
|
-
|
|
34840
|
-
|
|
34841
|
-
|
|
34842
|
-
|
|
34843
|
-
|
|
34844
|
-
|
|
34845
|
-
|
|
34846
|
-
|
|
34847
|
-
|
|
34848
|
-
|
|
34849
|
-
|
|
34850
|
-
|
|
34851
|
-
|
|
34852
|
-
|
|
34853
|
-
|
|
34854
|
-
|
|
34855
|
-
|
|
34856
|
-
],
|
|
34857
|
-
});
|
|
34866
|
+
const target = [
|
|
34867
|
+
{
|
|
34868
|
+
left: isCol ? start + deltaCol : 0,
|
|
34869
|
+
right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
34870
|
+
top: !isCol ? start + deltaRow : 0,
|
|
34871
|
+
bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
34872
|
+
},
|
|
34873
|
+
];
|
|
34874
|
+
const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
|
|
34875
|
+
const pasteTarget = [
|
|
34876
|
+
{
|
|
34877
|
+
left: isCol ? cmd.base : 0,
|
|
34878
|
+
right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
34879
|
+
top: !isCol ? cmd.base : 0,
|
|
34880
|
+
bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
34881
|
+
},
|
|
34882
|
+
];
|
|
34883
|
+
state.paste(pasteTarget, { selectTarget: true });
|
|
34858
34884
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
34859
34885
|
let currentIndex = cmd.base;
|
|
34860
34886
|
for (const element of toRemove) {
|
|
@@ -36296,30 +36322,26 @@ class InternalViewport {
|
|
|
36296
36322
|
const { end } = this.getters.getColDimensions(sheetId, targetCol);
|
|
36297
36323
|
const maxCol = this.getters.getNumberCols(sheetId);
|
|
36298
36324
|
if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
|
|
36299
|
-
|
|
36300
|
-
|
|
36301
|
-
|
|
36302
|
-
}
|
|
36303
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
36304
|
-
continue;
|
|
36305
|
-
}
|
|
36306
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
|
|
36307
|
-
this.offsetScrollbarX = this.offsetX;
|
|
36308
|
-
this.adjustViewportZoneX();
|
|
36325
|
+
let finalTarget = targetCol;
|
|
36326
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
|
|
36327
|
+
finalTarget++;
|
|
36309
36328
|
}
|
|
36329
|
+
const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
|
|
36330
|
+
const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
|
|
36331
|
+
this.offsetX =
|
|
36332
|
+
this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
|
|
36333
|
+
this.offsetScrollbarX = this.offsetX;
|
|
36334
|
+
this.adjustViewportZoneX();
|
|
36310
36335
|
}
|
|
36311
36336
|
else if (this.left > targetCol) {
|
|
36312
|
-
|
|
36313
|
-
|
|
36314
|
-
|
|
36315
|
-
}
|
|
36316
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
36317
|
-
continue;
|
|
36318
|
-
}
|
|
36319
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
|
|
36320
|
-
this.offsetScrollbarX = this.offsetX;
|
|
36321
|
-
this.adjustViewportZoneX();
|
|
36337
|
+
let finalTarget = targetCol;
|
|
36338
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
|
|
36339
|
+
finalTarget--;
|
|
36322
36340
|
}
|
|
36341
|
+
this.offsetX =
|
|
36342
|
+
this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
|
|
36343
|
+
this.offsetScrollbarX = this.offsetX;
|
|
36344
|
+
this.adjustViewportZoneX();
|
|
36323
36345
|
}
|
|
36324
36346
|
}
|
|
36325
36347
|
adjustPositionY(targetRow) {
|
|
@@ -36327,30 +36349,26 @@ class InternalViewport {
|
|
|
36327
36349
|
const { end } = this.getters.getRowDimensions(sheetId, targetRow);
|
|
36328
36350
|
const maxRow = this.getters.getNumberRows(sheetId);
|
|
36329
36351
|
if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
|
|
36330
|
-
|
|
36331
|
-
|
|
36332
|
-
|
|
36333
|
-
}
|
|
36334
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
36335
|
-
continue;
|
|
36336
|
-
}
|
|
36337
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
|
|
36338
|
-
this.offsetScrollbarY = this.offsetY;
|
|
36339
|
-
this.adjustViewportZoneY();
|
|
36352
|
+
let finalTarget = targetRow;
|
|
36353
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
|
|
36354
|
+
finalTarget++;
|
|
36340
36355
|
}
|
|
36356
|
+
const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
|
|
36357
|
+
const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
|
|
36358
|
+
this.offsetY =
|
|
36359
|
+
this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
|
|
36360
|
+
this.offsetScrollbarY = this.offsetY;
|
|
36361
|
+
this.adjustViewportZoneY();
|
|
36341
36362
|
}
|
|
36342
36363
|
else if (this.top > targetRow) {
|
|
36343
|
-
|
|
36344
|
-
|
|
36345
|
-
|
|
36346
|
-
}
|
|
36347
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
36348
|
-
continue;
|
|
36349
|
-
}
|
|
36350
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
|
|
36351
|
-
this.offsetScrollbarY = this.offsetY;
|
|
36352
|
-
this.adjustViewportZoneY();
|
|
36364
|
+
let finalTarget = targetRow;
|
|
36365
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
|
|
36366
|
+
finalTarget--;
|
|
36353
36367
|
}
|
|
36368
|
+
this.offsetY =
|
|
36369
|
+
this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
|
|
36370
|
+
this.offsetScrollbarY = this.offsetY;
|
|
36371
|
+
this.adjustViewportZoneY();
|
|
36354
36372
|
}
|
|
36355
36373
|
}
|
|
36356
36374
|
setViewportOffset(offsetX, offsetY) {
|
|
@@ -42874,6 +42892,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
42874
42892
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
42875
42893
|
|
|
42876
42894
|
|
|
42877
|
-
__info__.version = '16.0.
|
|
42878
|
-
__info__.date = '2023-
|
|
42879
|
-
__info__.hash = '
|
|
42895
|
+
__info__.version = '16.0.20';
|
|
42896
|
+
__info__.date = '2023-10-03T12:43:02.601Z';
|
|
42897
|
+
__info__.hash = '3be5a75';
|