@odoo/o-spreadsheet 16.1.20 → 16.1.24
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 +162 -85
- package/dist/o-spreadsheet.d.ts +7 -4
- package/dist/o-spreadsheet.esm.js +162 -85
- package/dist/o-spreadsheet.iife.js +162 -85
- package/dist/o-spreadsheet.iife.min.js +217 -216
- package/package.json +2 -2
|
@@ -321,7 +321,16 @@ const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
|
|
|
321
321
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
322
322
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
323
323
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
324
|
+
const CACHE = {};
|
|
324
325
|
function parseDateTime(str) {
|
|
326
|
+
if (str in CACHE) {
|
|
327
|
+
return CACHE[str];
|
|
328
|
+
}
|
|
329
|
+
const date = _parseDateTime(str);
|
|
330
|
+
CACHE[str] = date;
|
|
331
|
+
return date;
|
|
332
|
+
}
|
|
333
|
+
function _parseDateTime(str) {
|
|
325
334
|
str = str.trim();
|
|
326
335
|
let time;
|
|
327
336
|
const timeMatch = str.match(timeRegexp);
|
|
@@ -1006,13 +1015,17 @@ function getAddHeaderStartIndex(position, base) {
|
|
|
1006
1015
|
return position === "after" ? base + 1 : base;
|
|
1007
1016
|
}
|
|
1008
1017
|
/**
|
|
1009
|
-
*
|
|
1018
|
+
* Compares two objects.
|
|
1010
1019
|
*/
|
|
1011
1020
|
function deepEquals(o1, o2) {
|
|
1012
1021
|
if (o1 === o2)
|
|
1013
1022
|
return true;
|
|
1014
1023
|
if ((o1 && !o2) || (o2 && !o1))
|
|
1015
1024
|
return false;
|
|
1025
|
+
if (typeof o1 !== typeof o2)
|
|
1026
|
+
return false;
|
|
1027
|
+
if (typeof o1 !== "object")
|
|
1028
|
+
return o1 === o2;
|
|
1016
1029
|
// Objects can have different keys if the values are undefined
|
|
1017
1030
|
const keys = new Set();
|
|
1018
1031
|
Object.keys(o1).forEach((key) => keys.add(key));
|
|
@@ -2121,8 +2134,9 @@ class RangeImpl {
|
|
|
2121
2134
|
}
|
|
2122
2135
|
get zone() {
|
|
2123
2136
|
const { left, top, bottom, right } = this._zone;
|
|
2124
|
-
if (right !== undefined && bottom !== undefined)
|
|
2125
|
-
return
|
|
2137
|
+
if (right !== undefined && bottom !== undefined) {
|
|
2138
|
+
return this._zone;
|
|
2139
|
+
}
|
|
2126
2140
|
else if (bottom === undefined && right !== undefined) {
|
|
2127
2141
|
return { right, top, left, bottom: this.getSheetSize(this.sheetId).height - 1 };
|
|
2128
2142
|
}
|
|
@@ -3648,6 +3662,9 @@ exports.CommandResult = void 0;
|
|
|
3648
3662
|
CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
|
|
3649
3663
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
3650
3664
|
|
|
3665
|
+
function isMatrix(x) {
|
|
3666
|
+
return Array.isArray(x) && Array.isArray(x[0]);
|
|
3667
|
+
}
|
|
3651
3668
|
var DIRECTION;
|
|
3652
3669
|
(function (DIRECTION) {
|
|
3653
3670
|
DIRECTION["UP"] = "up";
|
|
@@ -14117,6 +14134,36 @@ const HLOOKUP = {
|
|
|
14117
14134
|
isExported: true,
|
|
14118
14135
|
};
|
|
14119
14136
|
// -----------------------------------------------------------------------------
|
|
14137
|
+
// INDEX
|
|
14138
|
+
// -----------------------------------------------------------------------------
|
|
14139
|
+
const INDEX = {
|
|
14140
|
+
description: _lt(`Returns the content of a cell, specified by row and column offset.`),
|
|
14141
|
+
args: args(`
|
|
14142
|
+
reference (any, range) ${_lt("The range of cells from which the value is returned.")}
|
|
14143
|
+
row (number) ${_lt("The index of the row to be returned from within the reference range of cells.")}
|
|
14144
|
+
column (number) ${_lt("The index of the column to be returned from within the reference range of cells.")}
|
|
14145
|
+
`),
|
|
14146
|
+
returns: ["ANY"],
|
|
14147
|
+
computeFormat: (reference, row, column) => {
|
|
14148
|
+
var _a;
|
|
14149
|
+
const _row = toNumber(row.value);
|
|
14150
|
+
const _column = toNumber(column.value);
|
|
14151
|
+
return (_a = reference[_column - 1][_row - 1]) === null || _a === void 0 ? void 0 : _a.format;
|
|
14152
|
+
},
|
|
14153
|
+
compute: function (reference, row, column) {
|
|
14154
|
+
const _reference = isMatrix(reference) ? reference : [[reference]];
|
|
14155
|
+
const _row = toNumber(row);
|
|
14156
|
+
const _column = toNumber(column);
|
|
14157
|
+
assert(() => _column >= 0 &&
|
|
14158
|
+
_column - 1 < _reference.length &&
|
|
14159
|
+
_row >= 0 &&
|
|
14160
|
+
_row - 1 < _reference[0].length, _lt("Index out of range."));
|
|
14161
|
+
assert(() => row !== 0 && column !== 0, _lt("This function can only return a single cell value, not an array. Provide valid row and column indices."));
|
|
14162
|
+
return _reference[_column - 1][_row - 1];
|
|
14163
|
+
},
|
|
14164
|
+
isExported: true,
|
|
14165
|
+
};
|
|
14166
|
+
// -----------------------------------------------------------------------------
|
|
14120
14167
|
// LOOKUP
|
|
14121
14168
|
// -----------------------------------------------------------------------------
|
|
14122
14169
|
const LOOKUP = {
|
|
@@ -14310,6 +14357,7 @@ var lookup = /*#__PURE__*/Object.freeze({
|
|
|
14310
14357
|
COLUMN: COLUMN,
|
|
14311
14358
|
COLUMNS: COLUMNS,
|
|
14312
14359
|
HLOOKUP: HLOOKUP,
|
|
14360
|
+
INDEX: INDEX,
|
|
14313
14361
|
LOOKUP: LOOKUP,
|
|
14314
14362
|
MATCH: MATCH,
|
|
14315
14363
|
ROW: ROW,
|
|
@@ -18287,6 +18335,7 @@ css /* scss */ `
|
|
|
18287
18335
|
padding: 10px;
|
|
18288
18336
|
width: ${ERROR_TOOLTIP_WIDTH}px;
|
|
18289
18337
|
box-sizing: border-box !important;
|
|
18338
|
+
overflow-wrap: break-word;
|
|
18290
18339
|
}
|
|
18291
18340
|
`;
|
|
18292
18341
|
class ErrorToolTip extends owl.Component {
|
|
@@ -18467,6 +18516,9 @@ class FilterMenu extends owl.Component {
|
|
|
18467
18516
|
});
|
|
18468
18517
|
this.state.values = this.getFilterValues(this.props.filterPosition);
|
|
18469
18518
|
}
|
|
18519
|
+
get isReadonly() {
|
|
18520
|
+
return this.env.model.getters.isReadonly();
|
|
18521
|
+
}
|
|
18470
18522
|
getFilterValues(position) {
|
|
18471
18523
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
18472
18524
|
const filter = this.env.model.getters.getFilter({ sheetId, ...position });
|
|
@@ -21729,9 +21781,9 @@ class FindAndReplacePanel extends owl.Component {
|
|
|
21729
21781
|
}
|
|
21730
21782
|
setup() {
|
|
21731
21783
|
this.showFormulaState = this.env.model.getters.shouldShowFormulas();
|
|
21732
|
-
this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
|
|
21733
21784
|
owl.onMounted(() => this.focusInput());
|
|
21734
21785
|
owl.onWillUnmount(() => {
|
|
21786
|
+
clearTimeout(this.debounceTimeoutId);
|
|
21735
21787
|
this.env.model.dispatch("CLEAR_SEARCH");
|
|
21736
21788
|
this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
|
|
21737
21789
|
});
|
|
@@ -21776,6 +21828,13 @@ class FindAndReplacePanel extends owl.Component {
|
|
|
21776
21828
|
searchOptions: this.state.searchOptions,
|
|
21777
21829
|
});
|
|
21778
21830
|
}
|
|
21831
|
+
debouncedUpdateSearch() {
|
|
21832
|
+
clearTimeout(this.debounceTimeoutId);
|
|
21833
|
+
this.debounceTimeoutId = setTimeout(() => {
|
|
21834
|
+
this.updateSearch();
|
|
21835
|
+
this.debounceTimeoutId = undefined;
|
|
21836
|
+
}, 200);
|
|
21837
|
+
}
|
|
21779
21838
|
replace() {
|
|
21780
21839
|
this.env.model.dispatch("REPLACE_SEARCH", {
|
|
21781
21840
|
replaceWith: this.state.replaceWith,
|
|
@@ -22426,9 +22485,11 @@ function useCellHovered(env, gridRef, callback) {
|
|
|
22426
22485
|
}
|
|
22427
22486
|
}
|
|
22428
22487
|
function updateMousePosition(e) {
|
|
22429
|
-
|
|
22430
|
-
|
|
22431
|
-
|
|
22488
|
+
if (gridRef.el === e.target) {
|
|
22489
|
+
x = e.offsetX;
|
|
22490
|
+
y = e.offsetY;
|
|
22491
|
+
lastMoved = Date.now();
|
|
22492
|
+
}
|
|
22432
22493
|
}
|
|
22433
22494
|
function recompute() {
|
|
22434
22495
|
const { col, row } = getPosition();
|
|
@@ -22711,7 +22772,14 @@ class AbstractResizer extends owl.Component {
|
|
|
22711
22772
|
return;
|
|
22712
22773
|
}
|
|
22713
22774
|
if (this.state.waitingForMove === true) {
|
|
22714
|
-
this.
|
|
22775
|
+
if (!this.env.model.getters.isGridSelectionActive()) {
|
|
22776
|
+
this._selectElement(index, false);
|
|
22777
|
+
}
|
|
22778
|
+
else {
|
|
22779
|
+
// FIXME: Consider reintroducing this feature for all type of selection if we find
|
|
22780
|
+
// a way to have the grid selection follow the other selections evolution
|
|
22781
|
+
this.startMovement(ev);
|
|
22782
|
+
}
|
|
22715
22783
|
return;
|
|
22716
22784
|
}
|
|
22717
22785
|
if (this.env.model.getters.getEditionMode() === "editing") {
|
|
@@ -26011,12 +26079,15 @@ function createXMLFile(doc, path, contentType) {
|
|
|
26011
26079
|
};
|
|
26012
26080
|
}
|
|
26013
26081
|
function xmlEscape(str) {
|
|
26014
|
-
return String(str)
|
|
26082
|
+
return (String(str)
|
|
26015
26083
|
.replace(/\&/g, "&")
|
|
26016
26084
|
.replace(/\</g, "<")
|
|
26017
26085
|
.replace(/\>/g, ">")
|
|
26018
26086
|
.replace(/\"/g, """)
|
|
26019
|
-
.replace(/\'/g, "'")
|
|
26087
|
+
.replace(/\'/g, "'")
|
|
26088
|
+
// Delete all ASCII control characters except for TAB (\x09), LF (\x0A) and CR (\x0D)
|
|
26089
|
+
// They are not valid at all in XML 1.0 (even escaped)
|
|
26090
|
+
.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, ""));
|
|
26020
26091
|
}
|
|
26021
26092
|
function formatAttributes(attrs) {
|
|
26022
26093
|
return new XMLString(attrs.map(([key, val]) => `${key}="${xmlEscape(val)}"`).join(" "));
|
|
@@ -28545,10 +28616,11 @@ class CellPlugin extends CorePlugin {
|
|
|
28545
28616
|
* Reconstructs the original formula string based on a normalized form and its dependencies
|
|
28546
28617
|
*/
|
|
28547
28618
|
buildFormulaContent(sheetId, cell, dependencies) {
|
|
28548
|
-
const ranges = dependencies ||
|
|
28619
|
+
const ranges = dependencies || cell.dependencies;
|
|
28620
|
+
let rangeIndex = 0;
|
|
28549
28621
|
return concat(cell.compiledFormula.tokens.map((token) => {
|
|
28550
28622
|
if (token.type === "REFERENCE") {
|
|
28551
|
-
const range = ranges
|
|
28623
|
+
const range = ranges[rangeIndex++];
|
|
28552
28624
|
return this.getters.getRangeString(range, sheetId);
|
|
28553
28625
|
}
|
|
28554
28626
|
return token.value;
|
|
@@ -32623,6 +32695,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
32623
32695
|
// stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
|
|
32624
32696
|
this.computedStyles = {};
|
|
32625
32697
|
this.computedIcons = {};
|
|
32698
|
+
this.uuidGenerator = new UuidGenerator();
|
|
32626
32699
|
/**
|
|
32627
32700
|
* Execute the predicate to know if a conditional formatting rule should be applied to a cell
|
|
32628
32701
|
*/
|
|
@@ -32950,6 +33023,10 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
32950
33023
|
}
|
|
32951
33024
|
currentRanges = currentRanges.concat(toAdd);
|
|
32952
33025
|
const newRangesXC = recomputeZones(currentRanges, toRemove);
|
|
33026
|
+
if (newRangesXC.length === 0) {
|
|
33027
|
+
this.dispatch("REMOVE_CONDITIONAL_FORMAT", { id: cf.id, sheetId });
|
|
33028
|
+
return;
|
|
33029
|
+
}
|
|
32953
33030
|
this.dispatch("ADD_CONDITIONAL_FORMAT", {
|
|
32954
33031
|
cf: {
|
|
32955
33032
|
id: cf.id,
|
|
@@ -32975,13 +33052,20 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
32975
33052
|
this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
|
|
32976
33053
|
}
|
|
32977
33054
|
else {
|
|
32978
|
-
this.adaptRules(target.sheetId, cf, [xc], []);
|
|
32979
33055
|
this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
|
|
33056
|
+
const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
|
|
33057
|
+
this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
|
|
32980
33058
|
}
|
|
32981
33059
|
}
|
|
32982
33060
|
}
|
|
32983
33061
|
}
|
|
32984
33062
|
}
|
|
33063
|
+
getCFToCopyTo(targetSheetId, originCF) {
|
|
33064
|
+
const cfInTarget = this.getters
|
|
33065
|
+
.getConditionalFormats(targetSheetId)
|
|
33066
|
+
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
33067
|
+
return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
|
|
33068
|
+
}
|
|
32985
33069
|
}
|
|
32986
33070
|
EvaluationConditionalFormatPlugin.getters = ["getConditionalIcon", "getCellComputedStyle"];
|
|
32987
33071
|
|
|
@@ -33329,30 +33413,26 @@ class InternalViewport {
|
|
|
33329
33413
|
const { end } = this.getters.getColDimensions(sheetId, targetCol);
|
|
33330
33414
|
const maxCol = this.getters.getNumberCols(sheetId);
|
|
33331
33415
|
if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
|
|
33332
|
-
|
|
33333
|
-
|
|
33334
|
-
|
|
33335
|
-
}
|
|
33336
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
33337
|
-
continue;
|
|
33338
|
-
}
|
|
33339
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
|
|
33340
|
-
this.offsetScrollbarX = this.offsetX;
|
|
33341
|
-
this.adjustViewportZoneX();
|
|
33416
|
+
let finalTarget = targetCol;
|
|
33417
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
|
|
33418
|
+
finalTarget++;
|
|
33342
33419
|
}
|
|
33420
|
+
const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
|
|
33421
|
+
const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
|
|
33422
|
+
this.offsetX =
|
|
33423
|
+
this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
|
|
33424
|
+
this.offsetScrollbarX = this.offsetX;
|
|
33425
|
+
this.adjustViewportZoneX();
|
|
33343
33426
|
}
|
|
33344
33427
|
else if (this.left > targetCol) {
|
|
33345
|
-
|
|
33346
|
-
|
|
33347
|
-
|
|
33348
|
-
}
|
|
33349
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
33350
|
-
continue;
|
|
33351
|
-
}
|
|
33352
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
|
|
33353
|
-
this.offsetScrollbarX = this.offsetX;
|
|
33354
|
-
this.adjustViewportZoneX();
|
|
33428
|
+
let finalTarget = targetCol;
|
|
33429
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
|
|
33430
|
+
finalTarget--;
|
|
33355
33431
|
}
|
|
33432
|
+
this.offsetX =
|
|
33433
|
+
this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
|
|
33434
|
+
this.offsetScrollbarX = this.offsetX;
|
|
33435
|
+
this.adjustViewportZoneX();
|
|
33356
33436
|
}
|
|
33357
33437
|
}
|
|
33358
33438
|
adjustPositionY(targetRow) {
|
|
@@ -33360,30 +33440,26 @@ class InternalViewport {
|
|
|
33360
33440
|
const { end } = this.getters.getRowDimensions(sheetId, targetRow);
|
|
33361
33441
|
const maxRow = this.getters.getNumberRows(sheetId);
|
|
33362
33442
|
if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
|
|
33363
|
-
|
|
33364
|
-
|
|
33365
|
-
|
|
33366
|
-
}
|
|
33367
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
33368
|
-
continue;
|
|
33369
|
-
}
|
|
33370
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
|
|
33371
|
-
this.offsetScrollbarY = this.offsetY;
|
|
33372
|
-
this.adjustViewportZoneY();
|
|
33443
|
+
let finalTarget = targetRow;
|
|
33444
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
|
|
33445
|
+
finalTarget++;
|
|
33373
33446
|
}
|
|
33447
|
+
const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
|
|
33448
|
+
const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
|
|
33449
|
+
this.offsetY =
|
|
33450
|
+
this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
|
|
33451
|
+
this.offsetScrollbarY = this.offsetY;
|
|
33452
|
+
this.adjustViewportZoneY();
|
|
33374
33453
|
}
|
|
33375
33454
|
else if (this.top > targetRow) {
|
|
33376
|
-
|
|
33377
|
-
|
|
33378
|
-
|
|
33379
|
-
}
|
|
33380
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
33381
|
-
continue;
|
|
33382
|
-
}
|
|
33383
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
|
|
33384
|
-
this.offsetScrollbarY = this.offsetY;
|
|
33385
|
-
this.adjustViewportZoneY();
|
|
33455
|
+
let finalTarget = targetRow;
|
|
33456
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
|
|
33457
|
+
finalTarget--;
|
|
33386
33458
|
}
|
|
33459
|
+
this.offsetY =
|
|
33460
|
+
this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
|
|
33461
|
+
this.offsetScrollbarY = this.offsetY;
|
|
33462
|
+
this.adjustViewportZoneY();
|
|
33387
33463
|
}
|
|
33388
33464
|
}
|
|
33389
33465
|
setViewportOffset(offsetX, offsetY) {
|
|
@@ -34957,14 +35033,10 @@ class FindAndReplacePlugin extends UIPlugin {
|
|
|
34957
35033
|
case "REPLACE_ALL_SEARCH":
|
|
34958
35034
|
this.replaceAll(cmd.replaceWith);
|
|
34959
35035
|
break;
|
|
34960
|
-
case "EVALUATE_CELLS":
|
|
34961
|
-
case "UPDATE_CELL":
|
|
34962
|
-
case "REMOVE_FILTER_TABLE":
|
|
34963
|
-
case "UPDATE_FILTER":
|
|
34964
|
-
this.isSearchDirty = true;
|
|
34965
|
-
break;
|
|
34966
35036
|
case "UNDO":
|
|
34967
35037
|
case "REDO":
|
|
35038
|
+
case "REMOVE_FILTER_TABLE":
|
|
35039
|
+
case "UPDATE_FILTER":
|
|
34968
35040
|
case "REMOVE_COLUMNS_ROWS":
|
|
34969
35041
|
case "HIDE_COLUMNS_ROWS":
|
|
34970
35042
|
case "UNHIDE_COLUMNS_ROWS":
|
|
@@ -37956,7 +38028,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
37956
38028
|
});
|
|
37957
38029
|
for (const filterTable of this.copiedTables) {
|
|
37958
38030
|
this.dispatch("REMOVE_FILTER_TABLE", {
|
|
37959
|
-
sheetId: this.
|
|
38031
|
+
sheetId: this.sheetId,
|
|
37960
38032
|
target: [filterTable.zone],
|
|
37961
38033
|
});
|
|
37962
38034
|
}
|
|
@@ -38434,7 +38506,7 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
38434
38506
|
allowDispatch(cmd) {
|
|
38435
38507
|
switch (cmd.type) {
|
|
38436
38508
|
case "CUT":
|
|
38437
|
-
const zones =
|
|
38509
|
+
const zones = this.getters.getSelectedZones();
|
|
38438
38510
|
const state = this.getClipboardState(zones, cmd.type);
|
|
38439
38511
|
return state.isCutAllowed(zones);
|
|
38440
38512
|
case "PASTE":
|
|
@@ -38465,7 +38537,7 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
38465
38537
|
switch (cmd.type) {
|
|
38466
38538
|
case "COPY":
|
|
38467
38539
|
case "CUT":
|
|
38468
|
-
const zones =
|
|
38540
|
+
const zones = this.getters.getSelectedZones();
|
|
38469
38541
|
this.state = this.getClipboardState(zones, cmd.type);
|
|
38470
38542
|
this.status = "visible";
|
|
38471
38543
|
break;
|
|
@@ -38896,6 +38968,9 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
38896
38968
|
// ---------------------------------------------------------------------------
|
|
38897
38969
|
// Getters
|
|
38898
38970
|
// ---------------------------------------------------------------------------
|
|
38971
|
+
isGridSelectionActive() {
|
|
38972
|
+
return this.selection.isListening(this);
|
|
38973
|
+
}
|
|
38899
38974
|
getActiveSheet() {
|
|
38900
38975
|
return this.activeSheet;
|
|
38901
38976
|
}
|
|
@@ -39126,26 +39201,24 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
39126
39201
|
const isBasedBefore = cmd.base < start;
|
|
39127
39202
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
39128
39203
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
39129
|
-
|
|
39130
|
-
|
|
39131
|
-
|
|
39132
|
-
|
|
39133
|
-
|
|
39134
|
-
|
|
39135
|
-
|
|
39136
|
-
|
|
39137
|
-
|
|
39138
|
-
|
|
39139
|
-
|
|
39140
|
-
|
|
39141
|
-
|
|
39142
|
-
|
|
39143
|
-
|
|
39144
|
-
|
|
39145
|
-
|
|
39146
|
-
|
|
39147
|
-
],
|
|
39148
|
-
});
|
|
39204
|
+
const target = [
|
|
39205
|
+
{
|
|
39206
|
+
left: isCol ? start + deltaCol : 0,
|
|
39207
|
+
right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
39208
|
+
top: !isCol ? start + deltaRow : 0,
|
|
39209
|
+
bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
39210
|
+
},
|
|
39211
|
+
];
|
|
39212
|
+
const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
|
|
39213
|
+
const pasteTarget = [
|
|
39214
|
+
{
|
|
39215
|
+
left: isCol ? cmd.base : 0,
|
|
39216
|
+
right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
39217
|
+
top: !isCol ? cmd.base : 0,
|
|
39218
|
+
bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
39219
|
+
},
|
|
39220
|
+
];
|
|
39221
|
+
state.paste(pasteTarget, { selectTarget: true });
|
|
39149
39222
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
39150
39223
|
let currentIndex = cmd.base;
|
|
39151
39224
|
for (const element of toRemove) {
|
|
@@ -39272,6 +39345,7 @@ GridSelectionPlugin.getters = [
|
|
|
39272
39345
|
"getSheetPosition",
|
|
39273
39346
|
"isSelected",
|
|
39274
39347
|
"getElementsFromSelection",
|
|
39348
|
+
"isGridSelectionActive",
|
|
39275
39349
|
];
|
|
39276
39350
|
|
|
39277
39351
|
const corePluginRegistry = new Registry()
|
|
@@ -42064,6 +42138,9 @@ class SelectionStreamProcessor {
|
|
|
42064
42138
|
anchor: { zone, cell: this.anchor.cell },
|
|
42065
42139
|
});
|
|
42066
42140
|
}
|
|
42141
|
+
isListening(owner) {
|
|
42142
|
+
return this.stream.isListening(owner);
|
|
42143
|
+
}
|
|
42067
42144
|
/**
|
|
42068
42145
|
* Process a new anchor selection event. If the new anchor is inside
|
|
42069
42146
|
* the sheet boundaries, the event is pushed to the event stream to
|
|
@@ -44350,6 +44427,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
44350
44427
|
exports.tokenize = tokenize;
|
|
44351
44428
|
|
|
44352
44429
|
|
|
44353
|
-
__info__.version = '16.1.
|
|
44354
|
-
__info__.date = '2023-
|
|
44355
|
-
__info__.hash = '
|
|
44430
|
+
__info__.version = '16.1.24';
|
|
44431
|
+
__info__.date = '2023-10-19T14:21:55.097Z';
|
|
44432
|
+
__info__.hash = '1b9e9d0';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -245,7 +245,7 @@ declare class RangeImpl implements Range {
|
|
|
245
245
|
constructor(args: ConstructorArgs, getSheetSize: (sheetId: UID) => ZoneDimension);
|
|
246
246
|
static fromRange(range: Range, getters: CoreGetters): RangeImpl;
|
|
247
247
|
get unboundedZone(): UnboundedZone;
|
|
248
|
-
get zone(): Zone
|
|
248
|
+
get zone(): Readonly<Zone>;
|
|
249
249
|
static getRangeParts(xc: string, zone: UnboundedZone): RangePart[];
|
|
250
250
|
get isFullCol(): boolean;
|
|
251
251
|
get isFullRow(): boolean;
|
|
@@ -340,6 +340,7 @@ interface SelectionProcessor {
|
|
|
340
340
|
selectAll(): DispatchResult;
|
|
341
341
|
loopSelection(): DispatchResult;
|
|
342
342
|
selectTableAroundSelection(): DispatchResult;
|
|
343
|
+
isListening(owner: unknown): boolean;
|
|
343
344
|
}
|
|
344
345
|
/**
|
|
345
346
|
* Processes all selection updates (usually from user inputs) and emits an event
|
|
@@ -412,6 +413,7 @@ declare class SelectionStreamProcessor implements SelectionProcessor, StatefulSt
|
|
|
412
413
|
* Select the entire sheet
|
|
413
414
|
*/
|
|
414
415
|
selectAll(): DispatchResult;
|
|
416
|
+
isListening(owner: unknown): boolean;
|
|
415
417
|
/**
|
|
416
418
|
* Process a new anchor selection event. If the new anchor is inside
|
|
417
419
|
* the sheet boundaries, the event is pushed to the event stream to
|
|
@@ -1800,8 +1802,6 @@ interface CopyCommand {
|
|
|
1800
1802
|
}
|
|
1801
1803
|
interface CutCommand {
|
|
1802
1804
|
type: "CUT";
|
|
1803
|
-
/** Zones to cut. If none were given, will copy the zones in the selection*/
|
|
1804
|
-
target?: Zone[];
|
|
1805
1805
|
}
|
|
1806
1806
|
interface PasteCommand {
|
|
1807
1807
|
type: "PASTE";
|
|
@@ -3854,6 +3854,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
3854
3854
|
private isStale;
|
|
3855
3855
|
private computedStyles;
|
|
3856
3856
|
private computedIcons;
|
|
3857
|
+
private uuidGenerator;
|
|
3857
3858
|
handle(cmd: Command): void;
|
|
3858
3859
|
finalize(): void;
|
|
3859
3860
|
getCellComputedStyle(position: CellPosition): Style;
|
|
@@ -3884,6 +3885,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
3884
3885
|
*/
|
|
3885
3886
|
private adaptRules;
|
|
3886
3887
|
private pasteCf;
|
|
3888
|
+
private getCFToCopyTo;
|
|
3887
3889
|
}
|
|
3888
3890
|
|
|
3889
3891
|
declare class FilterEvaluationPlugin extends UIPlugin {
|
|
@@ -4660,7 +4662,7 @@ declare class ClipboardPlugin extends UIPlugin {
|
|
|
4660
4662
|
*/
|
|
4661
4663
|
declare class GridSelectionPlugin extends UIPlugin {
|
|
4662
4664
|
static layers: LAYERS[];
|
|
4663
|
-
static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getActivePosition", "getSheetPosition", "isSelected", "getElementsFromSelection"];
|
|
4665
|
+
static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getActivePosition", "getSheetPosition", "isSelected", "getElementsFromSelection", "isGridSelectionActive"];
|
|
4664
4666
|
private gridSelection;
|
|
4665
4667
|
private selectedFigureId;
|
|
4666
4668
|
private sheetsData;
|
|
@@ -4670,6 +4672,7 @@ declare class GridSelectionPlugin extends UIPlugin {
|
|
|
4670
4672
|
allowDispatch(cmd: Command): CommandResult;
|
|
4671
4673
|
private handleEvent;
|
|
4672
4674
|
handle(cmd: Command): void;
|
|
4675
|
+
isGridSelectionActive(): boolean;
|
|
4673
4676
|
getActiveSheet(): Readonly<Sheet>;
|
|
4674
4677
|
getActiveSheetId(): UID;
|
|
4675
4678
|
getActiveCell(): EvaluatedCell;
|