@odoo/o-spreadsheet 16.2.10 → 16.2.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 +77 -49
- package/dist/o-spreadsheet.d.ts +6 -6
- package/dist/o-spreadsheet.esm.js +77 -49
- package/dist/o-spreadsheet.iife.js +77 -49
- package/dist/o-spreadsheet.iife.min.js +303 -298
- package/package.json +1 -1
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
const HEADER_BORDER_COLOR = "#C0C0C0";
|
|
107
107
|
const CELL_BORDER_COLOR = "#E2E3E3";
|
|
108
108
|
const BACKGROUND_CHART_COLOR = "#FFFFFF";
|
|
109
|
-
const
|
|
109
|
+
const DISABLED_TEXT_COLOR = "#CACACA";
|
|
110
110
|
const DEFAULT_COLOR_SCALE_MIDPOINT_COLOR = 0xb6d7a8;
|
|
111
111
|
const LINK_COLOR = "#01666b";
|
|
112
112
|
const FILTERS_COLOR = "#188038";
|
|
@@ -4101,7 +4101,6 @@
|
|
|
4101
4101
|
"SET_VIEWPORT_OFFSET",
|
|
4102
4102
|
"SELECT_SEARCH_NEXT_MATCH",
|
|
4103
4103
|
"SELECT_SEARCH_PREVIOUS_MATCH",
|
|
4104
|
-
"REFRESH_SEARCH",
|
|
4105
4104
|
"UPDATE_SEARCH",
|
|
4106
4105
|
"CLEAR_SEARCH",
|
|
4107
4106
|
"EVALUATE_CELLS",
|
|
@@ -5420,7 +5419,7 @@
|
|
|
5420
5419
|
}
|
|
5421
5420
|
}
|
|
5422
5421
|
&.disabled {
|
|
5423
|
-
color: ${
|
|
5422
|
+
color: ${DISABLED_TEXT_COLOR};
|
|
5424
5423
|
cursor: not-allowed;
|
|
5425
5424
|
}
|
|
5426
5425
|
}
|
|
@@ -18682,11 +18681,16 @@
|
|
|
18682
18681
|
}
|
|
18683
18682
|
setup() {
|
|
18684
18683
|
this.showFormulaState = this.env.model.getters.shouldShowFormulas();
|
|
18684
|
+
this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
|
|
18685
18685
|
owl.onMounted(() => this.focusInput());
|
|
18686
18686
|
owl.onWillUnmount(() => {
|
|
18687
18687
|
this.env.model.dispatch("CLEAR_SEARCH");
|
|
18688
18688
|
this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
|
|
18689
18689
|
});
|
|
18690
|
+
owl.useEffect(() => {
|
|
18691
|
+
this.state.searchOptions.searchFormulas = this.env.model.getters.shouldShowFormulas();
|
|
18692
|
+
this.searchFormulas();
|
|
18693
|
+
}, () => [this.env.model.getters.shouldShowFormulas()]);
|
|
18690
18694
|
}
|
|
18691
18695
|
onInput(ev) {
|
|
18692
18696
|
this.state.toSearch = ev.target.value;
|
|
@@ -18706,10 +18710,6 @@
|
|
|
18706
18710
|
this.replace();
|
|
18707
18711
|
}
|
|
18708
18712
|
}
|
|
18709
|
-
onFocusSidePanel() {
|
|
18710
|
-
this.state.searchOptions.searchFormulas = this.env.model.getters.shouldShowFormulas();
|
|
18711
|
-
this.env.model.dispatch("REFRESH_SEARCH");
|
|
18712
|
-
}
|
|
18713
18713
|
searchFormulas() {
|
|
18714
18714
|
this.env.model.dispatch("SET_FORMULA_VISIBILITY", {
|
|
18715
18715
|
show: this.state.searchOptions.searchFormulas,
|
|
@@ -18728,13 +18728,6 @@
|
|
|
18728
18728
|
searchOptions: this.state.searchOptions,
|
|
18729
18729
|
});
|
|
18730
18730
|
}
|
|
18731
|
-
debouncedUpdateSearch() {
|
|
18732
|
-
clearTimeout(this.debounceTimeoutId);
|
|
18733
|
-
this.debounceTimeoutId = setTimeout(() => {
|
|
18734
|
-
this.updateSearch();
|
|
18735
|
-
this.debounceTimeoutId = undefined;
|
|
18736
|
-
}, 400);
|
|
18737
|
-
}
|
|
18738
18731
|
replace() {
|
|
18739
18732
|
this.env.model.dispatch("REPLACE_SEARCH", {
|
|
18740
18733
|
replaceWith: this.state.replaceWith,
|
|
@@ -20720,6 +20713,14 @@
|
|
|
20720
20713
|
if (dirY < 0) {
|
|
20721
20714
|
this.dnd.y = dndInitialY + figure.height * fraction;
|
|
20722
20715
|
}
|
|
20716
|
+
if (this.dnd.x < 0) {
|
|
20717
|
+
this.dnd.width += this.dnd.x;
|
|
20718
|
+
this.dnd.x = 0;
|
|
20719
|
+
}
|
|
20720
|
+
if (this.dnd.y < 0) {
|
|
20721
|
+
this.dnd.height += this.dnd.y;
|
|
20722
|
+
this.dnd.y = 0;
|
|
20723
|
+
}
|
|
20723
20724
|
};
|
|
20724
20725
|
}
|
|
20725
20726
|
else {
|
|
@@ -20735,6 +20736,14 @@
|
|
|
20735
20736
|
if (dirY < 0) {
|
|
20736
20737
|
this.dnd.y = dndInitialY - deltaY;
|
|
20737
20738
|
}
|
|
20739
|
+
if (this.dnd.x < 0) {
|
|
20740
|
+
this.dnd.width += this.dnd.x;
|
|
20741
|
+
this.dnd.x = 0;
|
|
20742
|
+
}
|
|
20743
|
+
if (this.dnd.y < 0) {
|
|
20744
|
+
this.dnd.height += this.dnd.y;
|
|
20745
|
+
this.dnd.y = 0;
|
|
20746
|
+
}
|
|
20738
20747
|
};
|
|
20739
20748
|
}
|
|
20740
20749
|
const onMouseUp = (ev) => {
|
|
@@ -29348,7 +29357,7 @@
|
|
|
29348
29357
|
this.sizes = {};
|
|
29349
29358
|
}
|
|
29350
29359
|
handle(cmd) {
|
|
29351
|
-
var _a, _b
|
|
29360
|
+
var _a, _b;
|
|
29352
29361
|
switch (cmd.type) {
|
|
29353
29362
|
case "CREATE_SHEET": {
|
|
29354
29363
|
const computedSizes = this.computeSheetSizes(cmd.sheetId);
|
|
@@ -29436,7 +29445,8 @@
|
|
|
29436
29445
|
}
|
|
29437
29446
|
break;
|
|
29438
29447
|
case "UPDATE_CELL":
|
|
29439
|
-
|
|
29448
|
+
const row = (_b = (_a = this.sizes[cmd.sheetId]) === null || _a === void 0 ? void 0 : _a["ROW"]) === null || _b === void 0 ? void 0 : _b[cmd.row];
|
|
29449
|
+
if (row && !row.manualSize) {
|
|
29440
29450
|
const { sheetId, row } = cmd;
|
|
29441
29451
|
this.history.update("sizes", sheetId, "ROW", row, "computedSize", lazy(() => this.getRowTallestCellSize(sheetId, row)));
|
|
29442
29452
|
}
|
|
@@ -34486,6 +34496,7 @@
|
|
|
34486
34496
|
searchFormulas: false,
|
|
34487
34497
|
};
|
|
34488
34498
|
this.toSearch = "";
|
|
34499
|
+
this.isSearchDirty = false;
|
|
34489
34500
|
}
|
|
34490
34501
|
// ---------------------------------------------------------------------------
|
|
34491
34502
|
// Command Handling
|
|
@@ -34510,18 +34521,33 @@
|
|
|
34510
34521
|
case "REPLACE_ALL_SEARCH":
|
|
34511
34522
|
this.replaceAll(cmd.replaceWith);
|
|
34512
34523
|
break;
|
|
34524
|
+
case "EVALUATE_CELLS":
|
|
34525
|
+
case "UPDATE_CELL":
|
|
34526
|
+
case "REMOVE_FILTER_TABLE":
|
|
34527
|
+
case "UPDATE_FILTER":
|
|
34528
|
+
this.isSearchDirty = true;
|
|
34529
|
+
break;
|
|
34513
34530
|
case "UNDO":
|
|
34514
34531
|
case "REDO":
|
|
34515
34532
|
case "REMOVE_COLUMNS_ROWS":
|
|
34533
|
+
case "HIDE_COLUMNS_ROWS":
|
|
34534
|
+
case "UNHIDE_COLUMNS_ROWS":
|
|
34516
34535
|
case "ADD_COLUMNS_ROWS":
|
|
34517
|
-
|
|
34536
|
+
case "EVALUATE_CELLS":
|
|
34537
|
+
case "UPDATE_CELL":
|
|
34538
|
+
this.isSearchDirty = true;
|
|
34518
34539
|
break;
|
|
34519
34540
|
case "ACTIVATE_SHEET":
|
|
34520
|
-
case "REFRESH_SEARCH":
|
|
34521
34541
|
this.refreshSearch();
|
|
34522
34542
|
break;
|
|
34523
34543
|
}
|
|
34524
34544
|
}
|
|
34545
|
+
finalize() {
|
|
34546
|
+
if (this.isSearchDirty) {
|
|
34547
|
+
this.refreshSearch();
|
|
34548
|
+
this.isSearchDirty = false;
|
|
34549
|
+
}
|
|
34550
|
+
}
|
|
34525
34551
|
// ---------------------------------------------------------------------------
|
|
34526
34552
|
// Getters
|
|
34527
34553
|
// ---------------------------------------------------------------------------
|
|
@@ -34577,6 +34603,11 @@
|
|
|
34577
34603
|
if (this.toSearch) {
|
|
34578
34604
|
for (const cell of Object.values(cells)) {
|
|
34579
34605
|
const { col, row } = this.getters.getCellPosition(cell.id);
|
|
34606
|
+
const isColHidden = this.getters.isColHidden(sheetId, col);
|
|
34607
|
+
const isRowHidden = this.getters.isRowHidden(sheetId, row);
|
|
34608
|
+
if (isColHidden || isRowHidden) {
|
|
34609
|
+
continue;
|
|
34610
|
+
}
|
|
34580
34611
|
if (cell &&
|
|
34581
34612
|
this.currentSearchRegex &&
|
|
34582
34613
|
this.currentSearchRegex.test(this.getSearchableString({ sheetId, col, row }))) {
|
|
@@ -34636,37 +34667,31 @@
|
|
|
34636
34667
|
// ---------------------------------------------------------------------------
|
|
34637
34668
|
// Replace
|
|
34638
34669
|
// ---------------------------------------------------------------------------
|
|
34639
|
-
|
|
34640
|
-
|
|
34641
|
-
*/
|
|
34642
|
-
replace(replaceWith) {
|
|
34643
|
-
if (this.selectedMatchIndex === null || !this.currentSearchRegex) {
|
|
34670
|
+
replaceMatch(selectedMatch, replaceWith) {
|
|
34671
|
+
if (!this.currentSearchRegex) {
|
|
34644
34672
|
return;
|
|
34645
34673
|
}
|
|
34646
|
-
const matches = this.searchMatches;
|
|
34647
|
-
const selectedMatch = matches[this.selectedMatchIndex];
|
|
34648
34674
|
const sheetId = this.getters.getActiveSheetId();
|
|
34649
34675
|
const cell = this.getters.getCell({ sheetId, ...selectedMatch });
|
|
34676
|
+
const { col, row } = selectedMatch;
|
|
34650
34677
|
if ((cell === null || cell === void 0 ? void 0 : cell.isFormula) && !this.searchOptions.searchFormulas) {
|
|
34651
|
-
|
|
34678
|
+
return;
|
|
34652
34679
|
}
|
|
34653
|
-
|
|
34654
|
-
|
|
34655
|
-
|
|
34656
|
-
|
|
34657
|
-
|
|
34658
|
-
|
|
34659
|
-
|
|
34660
|
-
|
|
34661
|
-
|
|
34662
|
-
|
|
34663
|
-
|
|
34664
|
-
row: selectedMatch.row,
|
|
34665
|
-
content: newContent,
|
|
34666
|
-
});
|
|
34667
|
-
this.searchMatches.splice(this.selectedMatchIndex, 1);
|
|
34668
|
-
this.selectNextCell(Direction.current);
|
|
34680
|
+
const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
|
|
34681
|
+
const toReplace = this.getSearchableString({ sheetId, col, row });
|
|
34682
|
+
const content = toReplace.replace(replaceRegex, replaceWith);
|
|
34683
|
+
this.dispatch("UPDATE_CELL", { sheetId, col, row, content });
|
|
34684
|
+
}
|
|
34685
|
+
/**
|
|
34686
|
+
* Replace the value of the currently selected match
|
|
34687
|
+
*/
|
|
34688
|
+
replace(replaceWith) {
|
|
34689
|
+
if (this.selectedMatchIndex === null) {
|
|
34690
|
+
return;
|
|
34669
34691
|
}
|
|
34692
|
+
const selectedMatch = this.searchMatches[this.selectedMatchIndex];
|
|
34693
|
+
this.replaceMatch(selectedMatch, replaceWith);
|
|
34694
|
+
this.selectNextCell(Direction.next);
|
|
34670
34695
|
}
|
|
34671
34696
|
/**
|
|
34672
34697
|
* Apply the replace function to all the matches one time.
|
|
@@ -34674,7 +34699,7 @@
|
|
|
34674
34699
|
replaceAll(replaceWith) {
|
|
34675
34700
|
const matchCount = this.searchMatches.length;
|
|
34676
34701
|
for (let i = 0; i < matchCount; i++) {
|
|
34677
|
-
this.
|
|
34702
|
+
this.replaceMatch(this.searchMatches[i], replaceWith);
|
|
34678
34703
|
}
|
|
34679
34704
|
}
|
|
34680
34705
|
getSearchableString(position) {
|
|
@@ -37015,10 +37040,8 @@
|
|
|
37015
37040
|
}
|
|
37016
37041
|
updateCellCommands.push(newCellValues);
|
|
37017
37042
|
}
|
|
37018
|
-
for (const cmd of updateCellCommands) {
|
|
37019
|
-
this.dispatch("UPDATE_CELL", cmd);
|
|
37020
|
-
}
|
|
37021
37043
|
}
|
|
37044
|
+
updateCellCommands.forEach((cmdPayload) => this.dispatch("UPDATE_CELL", cmdPayload));
|
|
37022
37045
|
}
|
|
37023
37046
|
/**
|
|
37024
37047
|
* Return the distances between main merge cells in the zone.
|
|
@@ -40717,6 +40740,11 @@
|
|
|
40717
40740
|
.o-sidePanelButton:enabled {
|
|
40718
40741
|
cursor: pointer;
|
|
40719
40742
|
}
|
|
40743
|
+
|
|
40744
|
+
.o-sidePanelButton:disabled {
|
|
40745
|
+
color: ${DISABLED_TEXT_COLOR};
|
|
40746
|
+
}
|
|
40747
|
+
|
|
40720
40748
|
.o-sidePanelButton:last-child {
|
|
40721
40749
|
margin-right: 0px;
|
|
40722
40750
|
}
|
|
@@ -45378,9 +45406,9 @@
|
|
|
45378
45406
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
45379
45407
|
|
|
45380
45408
|
|
|
45381
|
-
__info__.version = '16.2.
|
|
45382
|
-
__info__.date = '2023-
|
|
45383
|
-
__info__.hash = '
|
|
45409
|
+
__info__.version = '16.2.12';
|
|
45410
|
+
__info__.date = '2023-08-07T09:01:10.621Z';
|
|
45411
|
+
__info__.hash = '6d1a538';
|
|
45384
45412
|
|
|
45385
45413
|
|
|
45386
45414
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|