@odoo/o-spreadsheet 16.0.19 → 16.0.21
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 +111 -50
- package/dist/o-spreadsheet.d.ts +5 -2
- package/dist/o-spreadsheet.esm.js +111 -50
- package/dist/o-spreadsheet.iife.js +111 -50
- package/dist/o-spreadsheet.iife.min.js +263 -263
- package/package.json +2 -2
|
@@ -316,7 +316,16 @@
|
|
|
316
316
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
317
317
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
318
318
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
319
|
+
const CACHE = {};
|
|
319
320
|
function parseDateTime(str) {
|
|
321
|
+
if (CACHE[str]) {
|
|
322
|
+
return CACHE[str];
|
|
323
|
+
}
|
|
324
|
+
const date = _parseDateTime(str);
|
|
325
|
+
CACHE[str] = date;
|
|
326
|
+
return date;
|
|
327
|
+
}
|
|
328
|
+
function _parseDateTime(str) {
|
|
320
329
|
str = str.trim();
|
|
321
330
|
let time;
|
|
322
331
|
const timeMatch = str.match(timeRegexp);
|
|
@@ -2042,8 +2051,9 @@
|
|
|
2042
2051
|
}
|
|
2043
2052
|
get zone() {
|
|
2044
2053
|
const { left, top, bottom, right } = this._zone;
|
|
2045
|
-
if (right !== undefined && bottom !== undefined)
|
|
2046
|
-
return
|
|
2054
|
+
if (right !== undefined && bottom !== undefined) {
|
|
2055
|
+
return this._zone;
|
|
2056
|
+
}
|
|
2047
2057
|
else if (bottom === undefined && right !== undefined) {
|
|
2048
2058
|
return { right, top, left, bottom: this.getSheetSize(this.sheetId).height - 1 };
|
|
2049
2059
|
}
|
|
@@ -3294,6 +3304,9 @@
|
|
|
3294
3304
|
CommandResult[CommandResult["InvalidQuantity"] = 86] = "InvalidQuantity";
|
|
3295
3305
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
3296
3306
|
|
|
3307
|
+
function isMatrix(x) {
|
|
3308
|
+
return Array.isArray(x) && Array.isArray(x[0]);
|
|
3309
|
+
}
|
|
3297
3310
|
var DIRECTION;
|
|
3298
3311
|
(function (DIRECTION) {
|
|
3299
3312
|
DIRECTION["UP"] = "up";
|
|
@@ -3690,6 +3703,9 @@
|
|
|
3690
3703
|
});
|
|
3691
3704
|
this.state.values = this.getFilterValues(this.props.filterPosition);
|
|
3692
3705
|
}
|
|
3706
|
+
get isReadonly() {
|
|
3707
|
+
return this.env.model.getters.isReadonly();
|
|
3708
|
+
}
|
|
3693
3709
|
getFilterValues(position) {
|
|
3694
3710
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
3695
3711
|
const filter = this.env.model.getters.getFilter(sheetId, position.col, position.row);
|
|
@@ -10008,9 +10024,9 @@
|
|
|
10008
10024
|
}
|
|
10009
10025
|
setup() {
|
|
10010
10026
|
this.showFormulaState = this.env.model.getters.shouldShowFormulas();
|
|
10011
|
-
this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
|
|
10012
10027
|
owl.onMounted(() => this.focusInput());
|
|
10013
10028
|
owl.onWillUnmount(() => {
|
|
10029
|
+
clearTimeout(this.debounceTimeoutId);
|
|
10014
10030
|
this.env.model.dispatch("CLEAR_SEARCH");
|
|
10015
10031
|
this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
|
|
10016
10032
|
});
|
|
@@ -10053,6 +10069,13 @@
|
|
|
10053
10069
|
searchOptions: this.state.searchOptions,
|
|
10054
10070
|
});
|
|
10055
10071
|
}
|
|
10072
|
+
debouncedUpdateSearch() {
|
|
10073
|
+
clearTimeout(this.debounceTimeoutId);
|
|
10074
|
+
this.debounceTimeoutId = setTimeout(() => {
|
|
10075
|
+
this.updateSearch();
|
|
10076
|
+
this.debounceTimeoutId = undefined;
|
|
10077
|
+
}, 200);
|
|
10078
|
+
}
|
|
10056
10079
|
replace() {
|
|
10057
10080
|
this.env.model.dispatch("REPLACE_SEARCH", {
|
|
10058
10081
|
replaceWith: this.state.replaceWith,
|
|
@@ -17056,6 +17079,36 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
17056
17079
|
isExported: true,
|
|
17057
17080
|
};
|
|
17058
17081
|
// -----------------------------------------------------------------------------
|
|
17082
|
+
// INDEX
|
|
17083
|
+
// -----------------------------------------------------------------------------
|
|
17084
|
+
const INDEX = {
|
|
17085
|
+
description: _lt(`Returns the content of a cell, specified by row and column offset.`),
|
|
17086
|
+
args: args(`
|
|
17087
|
+
reference (any, range) ${_lt("The range of cells from which the value is returned.")}
|
|
17088
|
+
row (number) ${_lt("The index of the row to be returned from within the reference range of cells.")}
|
|
17089
|
+
column (number) ${_lt("The index of the column to be returned from within the reference range of cells.")}
|
|
17090
|
+
`),
|
|
17091
|
+
returns: ["ANY"],
|
|
17092
|
+
computeFormat: (reference, row, column) => {
|
|
17093
|
+
var _a;
|
|
17094
|
+
const _row = toNumber(row.value);
|
|
17095
|
+
const _column = toNumber(column.value);
|
|
17096
|
+
return (_a = reference[_column - 1][_row - 1]) === null || _a === void 0 ? void 0 : _a.format;
|
|
17097
|
+
},
|
|
17098
|
+
compute: function (reference, row, column) {
|
|
17099
|
+
const _reference = isMatrix(reference) ? reference : [[reference]];
|
|
17100
|
+
const _row = toNumber(row);
|
|
17101
|
+
const _column = toNumber(column);
|
|
17102
|
+
assert(() => _column >= 0 &&
|
|
17103
|
+
_column - 1 < _reference.length &&
|
|
17104
|
+
_row >= 0 &&
|
|
17105
|
+
_row - 1 < _reference[0].length, _lt("Index out of range."));
|
|
17106
|
+
assert(() => row !== 0 && column !== 0, _lt("This function can only return a single cell value, not an array. Provide valid row and column indices."));
|
|
17107
|
+
return _reference[_column - 1][_row - 1];
|
|
17108
|
+
},
|
|
17109
|
+
isExported: true,
|
|
17110
|
+
};
|
|
17111
|
+
// -----------------------------------------------------------------------------
|
|
17059
17112
|
// LOOKUP
|
|
17060
17113
|
// -----------------------------------------------------------------------------
|
|
17061
17114
|
const LOOKUP = {
|
|
@@ -17244,6 +17297,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
17244
17297
|
COLUMN: COLUMN,
|
|
17245
17298
|
COLUMNS: COLUMNS,
|
|
17246
17299
|
HLOOKUP: HLOOKUP,
|
|
17300
|
+
INDEX: INDEX,
|
|
17247
17301
|
LOOKUP: LOOKUP,
|
|
17248
17302
|
MATCH: MATCH,
|
|
17249
17303
|
ROW: ROW,
|
|
@@ -21564,7 +21618,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
21564
21618
|
return;
|
|
21565
21619
|
}
|
|
21566
21620
|
if (this.state.waitingForMove === true) {
|
|
21567
|
-
this.
|
|
21621
|
+
if (!this.env.model.getters.isGridSelectionActive()) {
|
|
21622
|
+
this._selectElement(index, false);
|
|
21623
|
+
}
|
|
21624
|
+
else {
|
|
21625
|
+
// FIXME: Consider reintroducing this feature for all type of selection if we find
|
|
21626
|
+
// a way to have the grid selection follow the other selections evolution
|
|
21627
|
+
this.startMovement(ev);
|
|
21628
|
+
}
|
|
21568
21629
|
return;
|
|
21569
21630
|
}
|
|
21570
21631
|
if (this.env.model.getters.getEditionMode() === "editing") {
|
|
@@ -27719,10 +27780,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27719
27780
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
27720
27781
|
*/
|
|
27721
27782
|
buildFormulaContent(sheetId, cell, dependencies) {
|
|
27722
|
-
const ranges = dependencies ||
|
|
27783
|
+
const ranges = dependencies || cell.dependencies;
|
|
27784
|
+
let rangeIndex = 0;
|
|
27723
27785
|
return concat(cell.compiledFormula.tokens.map((token) => {
|
|
27724
27786
|
if (token.type === "REFERENCE") {
|
|
27725
|
-
const range = ranges
|
|
27787
|
+
const range = ranges[rangeIndex++];
|
|
27726
27788
|
return this.getters.getRangeString(range, sheetId);
|
|
27727
27789
|
}
|
|
27728
27790
|
return token.value;
|
|
@@ -31654,7 +31716,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31654
31716
|
});
|
|
31655
31717
|
for (const filterTable of this.copiedTables) {
|
|
31656
31718
|
this.dispatch("REMOVE_FILTER_TABLE", {
|
|
31657
|
-
sheetId: this.
|
|
31719
|
+
sheetId: this.sheetId,
|
|
31658
31720
|
target: [filterTable.zone],
|
|
31659
31721
|
});
|
|
31660
31722
|
}
|
|
@@ -34627,6 +34689,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
34627
34689
|
// ---------------------------------------------------------------------------
|
|
34628
34690
|
// Getters
|
|
34629
34691
|
// ---------------------------------------------------------------------------
|
|
34692
|
+
isGridSelectionActive() {
|
|
34693
|
+
return this.selection.isListening(this);
|
|
34694
|
+
}
|
|
34630
34695
|
getActiveSheet() {
|
|
34631
34696
|
return this.activeSheet;
|
|
34632
34697
|
}
|
|
@@ -35003,6 +35068,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
35003
35068
|
"getSheetPosition",
|
|
35004
35069
|
"isSelected",
|
|
35005
35070
|
"getElementsFromSelection",
|
|
35071
|
+
"isGridSelectionActive",
|
|
35006
35072
|
];
|
|
35007
35073
|
|
|
35008
35074
|
const uuidGenerator = new UuidGenerator();
|
|
@@ -36313,30 +36379,26 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36313
36379
|
const { end } = this.getters.getColDimensions(sheetId, targetCol);
|
|
36314
36380
|
const maxCol = this.getters.getNumberCols(sheetId);
|
|
36315
36381
|
if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
|
|
36316
|
-
|
|
36317
|
-
|
|
36318
|
-
|
|
36319
|
-
}
|
|
36320
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
36321
|
-
continue;
|
|
36322
|
-
}
|
|
36323
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
|
|
36324
|
-
this.offsetScrollbarX = this.offsetX;
|
|
36325
|
-
this.adjustViewportZoneX();
|
|
36382
|
+
let finalTarget = targetCol;
|
|
36383
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
|
|
36384
|
+
finalTarget++;
|
|
36326
36385
|
}
|
|
36386
|
+
const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
|
|
36387
|
+
const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
|
|
36388
|
+
this.offsetX =
|
|
36389
|
+
this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
|
|
36390
|
+
this.offsetScrollbarX = this.offsetX;
|
|
36391
|
+
this.adjustViewportZoneX();
|
|
36327
36392
|
}
|
|
36328
36393
|
else if (this.left > targetCol) {
|
|
36329
|
-
|
|
36330
|
-
|
|
36331
|
-
|
|
36332
|
-
}
|
|
36333
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
36334
|
-
continue;
|
|
36335
|
-
}
|
|
36336
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
|
|
36337
|
-
this.offsetScrollbarX = this.offsetX;
|
|
36338
|
-
this.adjustViewportZoneX();
|
|
36394
|
+
let finalTarget = targetCol;
|
|
36395
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
|
|
36396
|
+
finalTarget--;
|
|
36339
36397
|
}
|
|
36398
|
+
this.offsetX =
|
|
36399
|
+
this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
|
|
36400
|
+
this.offsetScrollbarX = this.offsetX;
|
|
36401
|
+
this.adjustViewportZoneX();
|
|
36340
36402
|
}
|
|
36341
36403
|
}
|
|
36342
36404
|
adjustPositionY(targetRow) {
|
|
@@ -36344,30 +36406,26 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
36344
36406
|
const { end } = this.getters.getRowDimensions(sheetId, targetRow);
|
|
36345
36407
|
const maxRow = this.getters.getNumberRows(sheetId);
|
|
36346
36408
|
if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
|
|
36347
|
-
|
|
36348
|
-
|
|
36349
|
-
|
|
36350
|
-
}
|
|
36351
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
36352
|
-
continue;
|
|
36353
|
-
}
|
|
36354
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
|
|
36355
|
-
this.offsetScrollbarY = this.offsetY;
|
|
36356
|
-
this.adjustViewportZoneY();
|
|
36409
|
+
let finalTarget = targetRow;
|
|
36410
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
|
|
36411
|
+
finalTarget++;
|
|
36357
36412
|
}
|
|
36413
|
+
const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
|
|
36414
|
+
const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
|
|
36415
|
+
this.offsetY =
|
|
36416
|
+
this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
|
|
36417
|
+
this.offsetScrollbarY = this.offsetY;
|
|
36418
|
+
this.adjustViewportZoneY();
|
|
36358
36419
|
}
|
|
36359
36420
|
else if (this.top > targetRow) {
|
|
36360
|
-
|
|
36361
|
-
|
|
36362
|
-
|
|
36363
|
-
}
|
|
36364
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
36365
|
-
continue;
|
|
36366
|
-
}
|
|
36367
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
|
|
36368
|
-
this.offsetScrollbarY = this.offsetY;
|
|
36369
|
-
this.adjustViewportZoneY();
|
|
36421
|
+
let finalTarget = targetRow;
|
|
36422
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
|
|
36423
|
+
finalTarget--;
|
|
36370
36424
|
}
|
|
36425
|
+
this.offsetY =
|
|
36426
|
+
this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
|
|
36427
|
+
this.offsetScrollbarY = this.offsetY;
|
|
36428
|
+
this.adjustViewportZoneY();
|
|
36371
36429
|
}
|
|
36372
36430
|
}
|
|
36373
36431
|
setViewportOffset(offsetX, offsetY) {
|
|
@@ -40722,6 +40780,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
40722
40780
|
anchor: { zone, cell: this.anchor.cell },
|
|
40723
40781
|
});
|
|
40724
40782
|
}
|
|
40783
|
+
isListening(owner) {
|
|
40784
|
+
return this.stream.isListening(owner);
|
|
40785
|
+
}
|
|
40725
40786
|
/**
|
|
40726
40787
|
* Process a new anchor selection event. If the new anchor is inside
|
|
40727
40788
|
* the sheet boundaries, the event is pushed to the event stream to
|
|
@@ -42921,9 +42982,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
42921
42982
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
42922
42983
|
|
|
42923
42984
|
|
|
42924
|
-
__info__.version = '16.0.
|
|
42925
|
-
__info__.date = '2023-
|
|
42926
|
-
__info__.hash = '
|
|
42985
|
+
__info__.version = '16.0.21';
|
|
42986
|
+
__info__.date = '2023-10-10T07:26:26.680Z';
|
|
42987
|
+
__info__.hash = '5f66b12';
|
|
42927
42988
|
|
|
42928
42989
|
|
|
42929
42990
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|