@odoo/o-spreadsheet 16.3.10 → 16.3.12
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 +94 -80
- package/dist/o-spreadsheet.d.ts +2 -2
- package/dist/o-spreadsheet.esm.js +94 -80
- package/dist/o-spreadsheet.iife.js +94 -80
- package/dist/o-spreadsheet.iife.min.js +255 -254
- package/package.json +2 -2
|
@@ -1031,13 +1031,17 @@
|
|
|
1031
1031
|
return position === "after" ? base + 1 : base;
|
|
1032
1032
|
}
|
|
1033
1033
|
/**
|
|
1034
|
-
*
|
|
1034
|
+
* Compares two objects.
|
|
1035
1035
|
*/
|
|
1036
1036
|
function deepEquals(o1, o2) {
|
|
1037
1037
|
if (o1 === o2)
|
|
1038
1038
|
return true;
|
|
1039
1039
|
if ((o1 && !o2) || (o2 && !o1))
|
|
1040
1040
|
return false;
|
|
1041
|
+
if (typeof o1 !== typeof o2)
|
|
1042
|
+
return false;
|
|
1043
|
+
if (typeof o1 !== "object")
|
|
1044
|
+
return o1 === o2;
|
|
1041
1045
|
// Objects can have different keys if the values are undefined
|
|
1042
1046
|
const keys = new Set();
|
|
1043
1047
|
Object.keys(o1).forEach((key) => keys.add(key));
|
|
@@ -4803,6 +4807,7 @@
|
|
|
4803
4807
|
padding: 10px;
|
|
4804
4808
|
width: ${ERROR_TOOLTIP_WIDTH}px;
|
|
4805
4809
|
box-sizing: border-box !important;
|
|
4810
|
+
overflow-wrap: break-word;
|
|
4806
4811
|
}
|
|
4807
4812
|
`;
|
|
4808
4813
|
class ErrorToolTip extends owl.Component {
|
|
@@ -4982,6 +4987,9 @@
|
|
|
4982
4987
|
});
|
|
4983
4988
|
this.state.values = this.getFilterValues(this.props.filterPosition);
|
|
4984
4989
|
}
|
|
4990
|
+
get isReadonly() {
|
|
4991
|
+
return this.env.model.getters.isReadonly();
|
|
4992
|
+
}
|
|
4985
4993
|
getFilterValues(position) {
|
|
4986
4994
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
4987
4995
|
const filter = this.env.model.getters.getFilter({ sheetId, ...position });
|
|
@@ -19670,7 +19678,6 @@
|
|
|
19670
19678
|
state = owl.useState(this.initialState());
|
|
19671
19679
|
debounceTimeoutId;
|
|
19672
19680
|
showFormulaState = false;
|
|
19673
|
-
debouncedUpdateSearch;
|
|
19674
19681
|
findAndReplaceRef = owl.useRef("findAndReplace");
|
|
19675
19682
|
get hasSearchResult() {
|
|
19676
19683
|
return this.env.model.getters.getCurrentSelectedMatchIndex() !== null;
|
|
@@ -19680,9 +19687,9 @@
|
|
|
19680
19687
|
}
|
|
19681
19688
|
setup() {
|
|
19682
19689
|
this.showFormulaState = this.env.model.getters.shouldShowFormulas();
|
|
19683
|
-
this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
|
|
19684
19690
|
owl.onMounted(() => this.focusInput());
|
|
19685
19691
|
owl.onWillUnmount(() => {
|
|
19692
|
+
clearTimeout(this.debounceTimeoutId);
|
|
19686
19693
|
this.env.model.dispatch("CLEAR_SEARCH");
|
|
19687
19694
|
this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
|
|
19688
19695
|
});
|
|
@@ -19727,6 +19734,13 @@
|
|
|
19727
19734
|
searchOptions: this.state.searchOptions,
|
|
19728
19735
|
});
|
|
19729
19736
|
}
|
|
19737
|
+
debouncedUpdateSearch() {
|
|
19738
|
+
clearTimeout(this.debounceTimeoutId);
|
|
19739
|
+
this.debounceTimeoutId = setTimeout(() => {
|
|
19740
|
+
this.updateSearch();
|
|
19741
|
+
this.debounceTimeoutId = undefined;
|
|
19742
|
+
}, 200);
|
|
19743
|
+
}
|
|
19730
19744
|
replace() {
|
|
19731
19745
|
this.env.model.dispatch("REPLACE_SEARCH", {
|
|
19732
19746
|
replaceWith: this.state.replaceWith,
|
|
@@ -22218,9 +22232,11 @@
|
|
|
22218
22232
|
}
|
|
22219
22233
|
}
|
|
22220
22234
|
function updateMousePosition(e) {
|
|
22221
|
-
|
|
22222
|
-
|
|
22223
|
-
|
|
22235
|
+
if (gridRef.el === e.target) {
|
|
22236
|
+
x = e.offsetX;
|
|
22237
|
+
y = e.offsetY;
|
|
22238
|
+
lastMoved = Date.now();
|
|
22239
|
+
}
|
|
22224
22240
|
}
|
|
22225
22241
|
function recompute() {
|
|
22226
22242
|
const { col, row } = getPosition();
|
|
@@ -30931,7 +30947,11 @@
|
|
|
30931
30947
|
let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
|
|
30932
30948
|
const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
|
|
30933
30949
|
const baseSize = sizes[cmd.base];
|
|
30934
|
-
|
|
30950
|
+
const sizesToInsert = range(0, cmd.quantity).map(() => ({
|
|
30951
|
+
manualSize: baseSize.manualSize,
|
|
30952
|
+
computedSize: lazy(baseSize.computedSize()),
|
|
30953
|
+
}));
|
|
30954
|
+
sizes.splice(addIndex, 0, ...sizesToInsert);
|
|
30935
30955
|
sizes = sizes.map((size, row) => {
|
|
30936
30956
|
if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
|
|
30937
30957
|
// invalidate sizes
|
|
@@ -33720,6 +33740,7 @@
|
|
|
33720
33740
|
// stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
|
|
33721
33741
|
computedStyles = {};
|
|
33722
33742
|
computedIcons = {};
|
|
33743
|
+
uuidGenerator = new UuidGenerator();
|
|
33723
33744
|
// ---------------------------------------------------------------------------
|
|
33724
33745
|
// Command Handling
|
|
33725
33746
|
// ---------------------------------------------------------------------------
|
|
@@ -34067,13 +34088,20 @@
|
|
|
34067
34088
|
this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
|
|
34068
34089
|
}
|
|
34069
34090
|
else {
|
|
34070
|
-
this.adaptRules(target.sheetId, cf, [xc], []);
|
|
34071
34091
|
this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
|
|
34092
|
+
const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
|
|
34093
|
+
this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
|
|
34072
34094
|
}
|
|
34073
34095
|
}
|
|
34074
34096
|
}
|
|
34075
34097
|
}
|
|
34076
34098
|
}
|
|
34099
|
+
getCFToCopyTo(targetSheetId, originCF) {
|
|
34100
|
+
const cfInTarget = this.getters
|
|
34101
|
+
.getConditionalFormats(targetSheetId)
|
|
34102
|
+
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
34103
|
+
return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
|
|
34104
|
+
}
|
|
34077
34105
|
}
|
|
34078
34106
|
|
|
34079
34107
|
class FilterEvaluationPlugin extends UIPlugin {
|
|
@@ -34432,30 +34460,26 @@
|
|
|
34432
34460
|
const { end } = this.getters.getColDimensions(sheetId, targetCol);
|
|
34433
34461
|
const maxCol = this.getters.getNumberCols(sheetId);
|
|
34434
34462
|
if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
|
|
34435
|
-
|
|
34436
|
-
|
|
34437
|
-
|
|
34438
|
-
}
|
|
34439
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
34440
|
-
continue;
|
|
34441
|
-
}
|
|
34442
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
|
|
34443
|
-
this.offsetScrollbarX = this.offsetX;
|
|
34444
|
-
this.adjustViewportZoneX();
|
|
34463
|
+
let finalTarget = targetCol;
|
|
34464
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
|
|
34465
|
+
finalTarget++;
|
|
34445
34466
|
}
|
|
34467
|
+
const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
|
|
34468
|
+
const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
|
|
34469
|
+
this.offsetX =
|
|
34470
|
+
this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
|
|
34471
|
+
this.offsetScrollbarX = this.offsetX;
|
|
34472
|
+
this.adjustViewportZoneX();
|
|
34446
34473
|
}
|
|
34447
34474
|
else if (this.left > targetCol) {
|
|
34448
|
-
|
|
34449
|
-
|
|
34450
|
-
|
|
34451
|
-
}
|
|
34452
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
34453
|
-
continue;
|
|
34454
|
-
}
|
|
34455
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
|
|
34456
|
-
this.offsetScrollbarX = this.offsetX;
|
|
34457
|
-
this.adjustViewportZoneX();
|
|
34475
|
+
let finalTarget = targetCol;
|
|
34476
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
|
|
34477
|
+
finalTarget--;
|
|
34458
34478
|
}
|
|
34479
|
+
this.offsetX =
|
|
34480
|
+
this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
|
|
34481
|
+
this.offsetScrollbarX = this.offsetX;
|
|
34482
|
+
this.adjustViewportZoneX();
|
|
34459
34483
|
}
|
|
34460
34484
|
}
|
|
34461
34485
|
adjustPositionY(targetRow) {
|
|
@@ -34463,30 +34487,26 @@
|
|
|
34463
34487
|
const { end } = this.getters.getRowDimensions(sheetId, targetRow);
|
|
34464
34488
|
const maxRow = this.getters.getNumberRows(sheetId);
|
|
34465
34489
|
if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
|
|
34466
|
-
|
|
34467
|
-
|
|
34468
|
-
|
|
34469
|
-
}
|
|
34470
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
34471
|
-
continue;
|
|
34472
|
-
}
|
|
34473
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
|
|
34474
|
-
this.offsetScrollbarY = this.offsetY;
|
|
34475
|
-
this.adjustViewportZoneY();
|
|
34490
|
+
let finalTarget = targetRow;
|
|
34491
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
|
|
34492
|
+
finalTarget++;
|
|
34476
34493
|
}
|
|
34494
|
+
const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
|
|
34495
|
+
const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
|
|
34496
|
+
this.offsetY =
|
|
34497
|
+
this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
|
|
34498
|
+
this.offsetScrollbarY = this.offsetY;
|
|
34499
|
+
this.adjustViewportZoneY();
|
|
34477
34500
|
}
|
|
34478
34501
|
else if (this.top > targetRow) {
|
|
34479
|
-
|
|
34480
|
-
|
|
34481
|
-
|
|
34482
|
-
}
|
|
34483
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
34484
|
-
continue;
|
|
34485
|
-
}
|
|
34486
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
|
|
34487
|
-
this.offsetScrollbarY = this.offsetY;
|
|
34488
|
-
this.adjustViewportZoneY();
|
|
34502
|
+
let finalTarget = targetRow;
|
|
34503
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
|
|
34504
|
+
finalTarget--;
|
|
34489
34505
|
}
|
|
34506
|
+
this.offsetY =
|
|
34507
|
+
this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
|
|
34508
|
+
this.offsetScrollbarY = this.offsetY;
|
|
34509
|
+
this.adjustViewportZoneY();
|
|
34490
34510
|
}
|
|
34491
34511
|
}
|
|
34492
34512
|
setViewportOffset(offsetX, offsetY) {
|
|
@@ -36962,14 +36982,10 @@
|
|
|
36962
36982
|
case "REPLACE_ALL_SEARCH":
|
|
36963
36983
|
this.replaceAll(cmd.replaceWith);
|
|
36964
36984
|
break;
|
|
36965
|
-
case "EVALUATE_CELLS":
|
|
36966
|
-
case "UPDATE_CELL":
|
|
36967
|
-
case "REMOVE_FILTER_TABLE":
|
|
36968
|
-
case "UPDATE_FILTER":
|
|
36969
|
-
this.isSearchDirty = true;
|
|
36970
|
-
break;
|
|
36971
36985
|
case "UNDO":
|
|
36972
36986
|
case "REDO":
|
|
36987
|
+
case "REMOVE_FILTER_TABLE":
|
|
36988
|
+
case "UPDATE_FILTER":
|
|
36973
36989
|
case "REMOVE_COLUMNS_ROWS":
|
|
36974
36990
|
case "HIDE_COLUMNS_ROWS":
|
|
36975
36991
|
case "UNHIDE_COLUMNS_ROWS":
|
|
@@ -39688,7 +39704,7 @@
|
|
|
39688
39704
|
});
|
|
39689
39705
|
for (const filterTable of this.copiedTables) {
|
|
39690
39706
|
this.dispatch("REMOVE_FILTER_TABLE", {
|
|
39691
|
-
sheetId: this.
|
|
39707
|
+
sheetId: this.sheetId,
|
|
39692
39708
|
target: [filterTable.zone],
|
|
39693
39709
|
});
|
|
39694
39710
|
}
|
|
@@ -40191,7 +40207,7 @@
|
|
|
40191
40207
|
allowDispatch(cmd) {
|
|
40192
40208
|
switch (cmd.type) {
|
|
40193
40209
|
case "CUT":
|
|
40194
|
-
const zones =
|
|
40210
|
+
const zones = this.getters.getSelectedZones();
|
|
40195
40211
|
const state = this.getClipboardState(zones, cmd.type);
|
|
40196
40212
|
return state.isCutAllowed(zones);
|
|
40197
40213
|
case "PASTE":
|
|
@@ -40221,7 +40237,7 @@
|
|
|
40221
40237
|
switch (cmd.type) {
|
|
40222
40238
|
case "COPY":
|
|
40223
40239
|
case "CUT":
|
|
40224
|
-
const zones =
|
|
40240
|
+
const zones = this.getters.getSelectedZones();
|
|
40225
40241
|
this.state = this.getClipboardState(zones, cmd.type);
|
|
40226
40242
|
this.status = "visible";
|
|
40227
40243
|
break;
|
|
@@ -41641,26 +41657,24 @@
|
|
|
41641
41657
|
const isBasedBefore = cmd.base < start;
|
|
41642
41658
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
41643
41659
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
41644
|
-
|
|
41645
|
-
|
|
41646
|
-
|
|
41647
|
-
|
|
41648
|
-
|
|
41649
|
-
|
|
41650
|
-
|
|
41651
|
-
|
|
41652
|
-
|
|
41653
|
-
|
|
41654
|
-
|
|
41655
|
-
|
|
41656
|
-
|
|
41657
|
-
|
|
41658
|
-
|
|
41659
|
-
|
|
41660
|
-
|
|
41661
|
-
|
|
41662
|
-
],
|
|
41663
|
-
});
|
|
41660
|
+
const target = [
|
|
41661
|
+
{
|
|
41662
|
+
left: isCol ? start + deltaCol : 0,
|
|
41663
|
+
right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
41664
|
+
top: !isCol ? start + deltaRow : 0,
|
|
41665
|
+
bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
41666
|
+
},
|
|
41667
|
+
];
|
|
41668
|
+
const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
|
|
41669
|
+
const pasteTarget = [
|
|
41670
|
+
{
|
|
41671
|
+
left: isCol ? cmd.base : 0,
|
|
41672
|
+
right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
41673
|
+
top: !isCol ? cmd.base : 0,
|
|
41674
|
+
bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
41675
|
+
},
|
|
41676
|
+
];
|
|
41677
|
+
state.paste(pasteTarget, { selectTarget: true });
|
|
41664
41678
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
41665
41679
|
let currentIndex = cmd.base;
|
|
41666
41680
|
for (const element of toRemove) {
|
|
@@ -47706,9 +47720,9 @@
|
|
|
47706
47720
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47707
47721
|
|
|
47708
47722
|
|
|
47709
|
-
__info__.version = '16.3.
|
|
47710
|
-
__info__.date = '2023-
|
|
47711
|
-
__info__.hash = '
|
|
47723
|
+
__info__.version = '16.3.12';
|
|
47724
|
+
__info__.date = '2023-10-03T12:43:02.230Z';
|
|
47725
|
+
__info__.hash = '70a91d9';
|
|
47712
47726
|
|
|
47713
47727
|
|
|
47714
47728
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|