@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
|
@@ -1007,13 +1007,17 @@
|
|
|
1007
1007
|
return position === "after" ? base + 1 : base;
|
|
1008
1008
|
}
|
|
1009
1009
|
/**
|
|
1010
|
-
*
|
|
1010
|
+
* Compares two objects.
|
|
1011
1011
|
*/
|
|
1012
1012
|
function deepEquals(o1, o2) {
|
|
1013
1013
|
if (o1 === o2)
|
|
1014
1014
|
return true;
|
|
1015
1015
|
if ((o1 && !o2) || (o2 && !o1))
|
|
1016
1016
|
return false;
|
|
1017
|
+
if (typeof o1 !== typeof o2)
|
|
1018
|
+
return false;
|
|
1019
|
+
if (typeof o1 !== "object")
|
|
1020
|
+
return o1 === o2;
|
|
1017
1021
|
// Objects can have different keys if the values are undefined
|
|
1018
1022
|
const keys = new Set();
|
|
1019
1023
|
Object.keys(o1).forEach((key) => keys.add(key));
|
|
@@ -3686,6 +3690,9 @@
|
|
|
3686
3690
|
});
|
|
3687
3691
|
this.state.values = this.getFilterValues(this.props.filterPosition);
|
|
3688
3692
|
}
|
|
3693
|
+
get isReadonly() {
|
|
3694
|
+
return this.env.model.getters.isReadonly();
|
|
3695
|
+
}
|
|
3689
3696
|
getFilterValues(position) {
|
|
3690
3697
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
3691
3698
|
const filter = this.env.model.getters.getFilter(sheetId, position.col, position.row);
|
|
@@ -10004,9 +10011,9 @@
|
|
|
10004
10011
|
}
|
|
10005
10012
|
setup() {
|
|
10006
10013
|
this.showFormulaState = this.env.model.getters.shouldShowFormulas();
|
|
10007
|
-
this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
|
|
10008
10014
|
owl.onMounted(() => this.focusInput());
|
|
10009
10015
|
owl.onWillUnmount(() => {
|
|
10016
|
+
clearTimeout(this.debounceTimeoutId);
|
|
10010
10017
|
this.env.model.dispatch("CLEAR_SEARCH");
|
|
10011
10018
|
this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
|
|
10012
10019
|
});
|
|
@@ -10049,6 +10056,13 @@
|
|
|
10049
10056
|
searchOptions: this.state.searchOptions,
|
|
10050
10057
|
});
|
|
10051
10058
|
}
|
|
10059
|
+
debouncedUpdateSearch() {
|
|
10060
|
+
clearTimeout(this.debounceTimeoutId);
|
|
10061
|
+
this.debounceTimeoutId = setTimeout(() => {
|
|
10062
|
+
this.updateSearch();
|
|
10063
|
+
this.debounceTimeoutId = undefined;
|
|
10064
|
+
}, 200);
|
|
10065
|
+
}
|
|
10052
10066
|
replace() {
|
|
10053
10067
|
this.env.model.dispatch("REPLACE_SEARCH", {
|
|
10054
10068
|
replaceWith: this.state.replaceWith,
|
|
@@ -21297,9 +21311,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
21297
21311
|
}
|
|
21298
21312
|
}
|
|
21299
21313
|
function updateMousePosition(e) {
|
|
21300
|
-
|
|
21301
|
-
|
|
21302
|
-
|
|
21314
|
+
if (gridRef.el === e.target) {
|
|
21315
|
+
x = e.offsetX;
|
|
21316
|
+
y = e.offsetY;
|
|
21317
|
+
lastMoved = Date.now();
|
|
21318
|
+
}
|
|
21303
21319
|
}
|
|
21304
21320
|
function recompute() {
|
|
21305
21321
|
const { col, row } = getPosition();
|
|
@@ -28943,7 +28959,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28943
28959
|
let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
|
|
28944
28960
|
const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
|
|
28945
28961
|
const baseSize = sizes[cmd.base];
|
|
28946
|
-
|
|
28962
|
+
const sizesToInsert = range(0, cmd.quantity).map(() => ({
|
|
28963
|
+
manualSize: baseSize.manualSize,
|
|
28964
|
+
computedSize: lazy(baseSize.computedSize()),
|
|
28965
|
+
}));
|
|
28966
|
+
sizes.splice(addIndex, 0, ...sizesToInsert);
|
|
28947
28967
|
sizes = sizes.map((size, row) => {
|
|
28948
28968
|
if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
|
|
28949
28969
|
// invalidate sizes
|
|
@@ -31644,7 +31664,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31644
31664
|
});
|
|
31645
31665
|
for (const filterTable of this.copiedTables) {
|
|
31646
31666
|
this.dispatch("REMOVE_FILTER_TABLE", {
|
|
31647
|
-
sheetId: this.
|
|
31667
|
+
sheetId: this.sheetId,
|
|
31648
31668
|
target: [filterTable.zone],
|
|
31649
31669
|
});
|
|
31650
31670
|
}
|
|
@@ -32059,7 +32079,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32059
32079
|
allowDispatch(cmd) {
|
|
32060
32080
|
switch (cmd.type) {
|
|
32061
32081
|
case "CUT":
|
|
32062
|
-
const zones =
|
|
32082
|
+
const zones = this.getters.getSelectedZones();
|
|
32063
32083
|
const state = this.getClipboardState(zones, cmd.type);
|
|
32064
32084
|
return state.isCutAllowed(zones);
|
|
32065
32085
|
case "PASTE":
|
|
@@ -32090,7 +32110,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32090
32110
|
switch (cmd.type) {
|
|
32091
32111
|
case "COPY":
|
|
32092
32112
|
case "CUT":
|
|
32093
|
-
const zones =
|
|
32113
|
+
const zones = this.getters.getSelectedZones();
|
|
32094
32114
|
this.state = this.getClipboardState(zones, cmd.type);
|
|
32095
32115
|
this.status = "visible";
|
|
32096
32116
|
break;
|
|
@@ -32708,6 +32728,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32708
32728
|
// stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
|
|
32709
32729
|
this.computedStyles = {};
|
|
32710
32730
|
this.computedIcons = {};
|
|
32731
|
+
this.uuidGenerator = new UuidGenerator();
|
|
32711
32732
|
/**
|
|
32712
32733
|
* Execute the predicate to know if a conditional formatting rule should be applied to a cell
|
|
32713
32734
|
*/
|
|
@@ -33059,8 +33080,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
33059
33080
|
this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
|
|
33060
33081
|
}
|
|
33061
33082
|
else {
|
|
33062
|
-
this.adaptRules(target.sheetId, cf, [xc], []);
|
|
33063
33083
|
this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
|
|
33084
|
+
const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
|
|
33085
|
+
this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
|
|
33064
33086
|
}
|
|
33065
33087
|
}
|
|
33066
33088
|
}
|
|
@@ -33069,6 +33091,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
33069
33091
|
isCellValueNumber(value) {
|
|
33070
33092
|
return typeof value === "number";
|
|
33071
33093
|
}
|
|
33094
|
+
getCFToCopyTo(targetSheetId, originCF) {
|
|
33095
|
+
const cfInTarget = this.getters
|
|
33096
|
+
.getConditionalFormats(targetSheetId)
|
|
33097
|
+
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
33098
|
+
return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
|
|
33099
|
+
}
|
|
33072
33100
|
}
|
|
33073
33101
|
EvaluationConditionalFormatPlugin.getters = ["getConditionalIcon", "getCellComputedStyle"];
|
|
33074
33102
|
|
|
@@ -34836,26 +34864,24 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34836
34864
|
const isBasedBefore = cmd.base < start;
|
|
34837
34865
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
34838
34866
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
34839
|
-
|
|
34840
|
-
|
|
34841
|
-
|
|
34842
|
-
|
|
34843
|
-
|
|
34844
|
-
|
|
34845
|
-
|
|
34846
|
-
|
|
34847
|
-
|
|
34848
|
-
|
|
34849
|
-
|
|
34850
|
-
|
|
34851
|
-
|
|
34852
|
-
|
|
34853
|
-
|
|
34854
|
-
|
|
34855
|
-
|
|
34856
|
-
|
|
34857
|
-
],
|
|
34858
|
-
});
|
|
34867
|
+
const target = [
|
|
34868
|
+
{
|
|
34869
|
+
left: isCol ? start + deltaCol : 0,
|
|
34870
|
+
right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
34871
|
+
top: !isCol ? start + deltaRow : 0,
|
|
34872
|
+
bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
34873
|
+
},
|
|
34874
|
+
];
|
|
34875
|
+
const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
|
|
34876
|
+
const pasteTarget = [
|
|
34877
|
+
{
|
|
34878
|
+
left: isCol ? cmd.base : 0,
|
|
34879
|
+
right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
34880
|
+
top: !isCol ? cmd.base : 0,
|
|
34881
|
+
bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
34882
|
+
},
|
|
34883
|
+
];
|
|
34884
|
+
state.paste(pasteTarget, { selectTarget: true });
|
|
34859
34885
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
34860
34886
|
let currentIndex = cmd.base;
|
|
34861
34887
|
for (const element of toRemove) {
|
|
@@ -36297,30 +36323,26 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36297
36323
|
const { end } = this.getters.getColDimensions(sheetId, targetCol);
|
|
36298
36324
|
const maxCol = this.getters.getNumberCols(sheetId);
|
|
36299
36325
|
if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
|
|
36300
|
-
|
|
36301
|
-
|
|
36302
|
-
|
|
36303
|
-
}
|
|
36304
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
36305
|
-
continue;
|
|
36306
|
-
}
|
|
36307
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
|
|
36308
|
-
this.offsetScrollbarX = this.offsetX;
|
|
36309
|
-
this.adjustViewportZoneX();
|
|
36326
|
+
let finalTarget = targetCol;
|
|
36327
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
|
|
36328
|
+
finalTarget++;
|
|
36310
36329
|
}
|
|
36330
|
+
const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
|
|
36331
|
+
const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
|
|
36332
|
+
this.offsetX =
|
|
36333
|
+
this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
|
|
36334
|
+
this.offsetScrollbarX = this.offsetX;
|
|
36335
|
+
this.adjustViewportZoneX();
|
|
36311
36336
|
}
|
|
36312
36337
|
else if (this.left > targetCol) {
|
|
36313
|
-
|
|
36314
|
-
|
|
36315
|
-
|
|
36316
|
-
}
|
|
36317
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
36318
|
-
continue;
|
|
36319
|
-
}
|
|
36320
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
|
|
36321
|
-
this.offsetScrollbarX = this.offsetX;
|
|
36322
|
-
this.adjustViewportZoneX();
|
|
36338
|
+
let finalTarget = targetCol;
|
|
36339
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
|
|
36340
|
+
finalTarget--;
|
|
36323
36341
|
}
|
|
36342
|
+
this.offsetX =
|
|
36343
|
+
this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
|
|
36344
|
+
this.offsetScrollbarX = this.offsetX;
|
|
36345
|
+
this.adjustViewportZoneX();
|
|
36324
36346
|
}
|
|
36325
36347
|
}
|
|
36326
36348
|
adjustPositionY(targetRow) {
|
|
@@ -36328,30 +36350,26 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36328
36350
|
const { end } = this.getters.getRowDimensions(sheetId, targetRow);
|
|
36329
36351
|
const maxRow = this.getters.getNumberRows(sheetId);
|
|
36330
36352
|
if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
|
|
36331
|
-
|
|
36332
|
-
|
|
36333
|
-
|
|
36334
|
-
}
|
|
36335
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
36336
|
-
continue;
|
|
36337
|
-
}
|
|
36338
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
|
|
36339
|
-
this.offsetScrollbarY = this.offsetY;
|
|
36340
|
-
this.adjustViewportZoneY();
|
|
36353
|
+
let finalTarget = targetRow;
|
|
36354
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
|
|
36355
|
+
finalTarget++;
|
|
36341
36356
|
}
|
|
36357
|
+
const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
|
|
36358
|
+
const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
|
|
36359
|
+
this.offsetY =
|
|
36360
|
+
this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
|
|
36361
|
+
this.offsetScrollbarY = this.offsetY;
|
|
36362
|
+
this.adjustViewportZoneY();
|
|
36342
36363
|
}
|
|
36343
36364
|
else if (this.top > targetRow) {
|
|
36344
|
-
|
|
36345
|
-
|
|
36346
|
-
|
|
36347
|
-
}
|
|
36348
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
36349
|
-
continue;
|
|
36350
|
-
}
|
|
36351
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
|
|
36352
|
-
this.offsetScrollbarY = this.offsetY;
|
|
36353
|
-
this.adjustViewportZoneY();
|
|
36365
|
+
let finalTarget = targetRow;
|
|
36366
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
|
|
36367
|
+
finalTarget--;
|
|
36354
36368
|
}
|
|
36369
|
+
this.offsetY =
|
|
36370
|
+
this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
|
|
36371
|
+
this.offsetScrollbarY = this.offsetY;
|
|
36372
|
+
this.adjustViewportZoneY();
|
|
36355
36373
|
}
|
|
36356
36374
|
}
|
|
36357
36375
|
setViewportOffset(offsetX, offsetY) {
|
|
@@ -42905,9 +42923,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
42905
42923
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
42906
42924
|
|
|
42907
42925
|
|
|
42908
|
-
__info__.version = '16.0.
|
|
42909
|
-
__info__.date = '2023-
|
|
42910
|
-
__info__.hash = '
|
|
42926
|
+
__info__.version = '16.0.20';
|
|
42927
|
+
__info__.date = '2023-10-03T12:43:02.601Z';
|
|
42928
|
+
__info__.hash = '3be5a75';
|
|
42911
42929
|
|
|
42912
42930
|
|
|
42913
42931
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|