@odoo/o-spreadsheet 18.0.6 → 18.0.8
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 +112 -111
- package/dist/o-spreadsheet.d.ts +4 -1
- package/dist/o-spreadsheet.esm.js +112 -111
- package/dist/o-spreadsheet.iife.js +112 -111
- package/dist/o-spreadsheet.iife.min.js +345 -346
- package/dist/o_spreadsheet.xml +9 -4
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 18.0.
|
|
6
|
-
* @date 2024-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.8
|
|
6
|
+
* @date 2024-12-19T07:50:36.150Z
|
|
7
|
+
* @hash 7cf34a6
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -334,8 +334,8 @@ const LINE_FILL_TRANSPARENCY = 0.4;
|
|
|
334
334
|
const DEBOUNCE_TIME = 200;
|
|
335
335
|
const MESSAGE_VERSION = 1;
|
|
336
336
|
// Sheets
|
|
337
|
-
const
|
|
338
|
-
const
|
|
337
|
+
const FORBIDDEN_SHEETNAME_CHARS = ["'", "*", "?", "/", "\\", "[", "]"];
|
|
338
|
+
const FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX = /'|\*|\?|\/|\\|\[|\]/;
|
|
339
339
|
// Cells
|
|
340
340
|
const FORMULA_REF_IDENTIFIER = "|";
|
|
341
341
|
// Components
|
|
@@ -388,6 +388,7 @@ const DEFAULT_CURRENCY = {
|
|
|
388
388
|
//------------------------------------------------------------------------------
|
|
389
389
|
// Miscellaneous
|
|
390
390
|
//------------------------------------------------------------------------------
|
|
391
|
+
const sanitizeSheetNameRegex = new RegExp(FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX, "g");
|
|
391
392
|
/**
|
|
392
393
|
* Remove quotes from a quoted string
|
|
393
394
|
* ```js
|
|
@@ -483,6 +484,10 @@ function getCanonicalSymbolName(symbolName) {
|
|
|
483
484
|
}
|
|
484
485
|
return symbolName;
|
|
485
486
|
}
|
|
487
|
+
/** Replace the excel-excluded characters of a sheetName */
|
|
488
|
+
function sanitizeSheetName(sheetName, replacementChar = " ") {
|
|
489
|
+
return sheetName.replace(sanitizeSheetNameRegex, replacementChar);
|
|
490
|
+
}
|
|
486
491
|
function clip(val, min, max) {
|
|
487
492
|
return val < min ? min : val > max ? max : val;
|
|
488
493
|
}
|
|
@@ -782,6 +787,7 @@ function removeFalsyAttributes(obj) {
|
|
|
782
787
|
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
|
|
783
788
|
*/
|
|
784
789
|
const whiteSpaceSpecialCharacters = [
|
|
790
|
+
" ",
|
|
785
791
|
"\t",
|
|
786
792
|
"\f",
|
|
787
793
|
"\v",
|
|
@@ -796,17 +802,15 @@ const whiteSpaceSpecialCharacters = [
|
|
|
796
802
|
String.fromCharCode(parseInt("3000", 16)),
|
|
797
803
|
String.fromCharCode(parseInt("feff", 16)),
|
|
798
804
|
];
|
|
799
|
-
const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|")
|
|
805
|
+
const whiteSpaceRegexp = new RegExp(whiteSpaceSpecialCharacters.join("|"), "g");
|
|
806
|
+
const newLineRegexp = /(\r\n|\r)/g;
|
|
800
807
|
/**
|
|
801
|
-
* Replace all
|
|
802
|
-
* different newlines types by \n.
|
|
808
|
+
* Replace all different newlines characters by \n
|
|
803
809
|
*/
|
|
804
|
-
function
|
|
810
|
+
function replaceNewLines(text) {
|
|
805
811
|
if (!text)
|
|
806
812
|
return "";
|
|
807
|
-
|
|
808
|
-
return text;
|
|
809
|
-
return text.replace(whiteSpaceRegexp, (match, newLine) => (newLine ? NEWLINE : " "));
|
|
813
|
+
return text.replace(newLineRegexp, NEWLINE);
|
|
810
814
|
}
|
|
811
815
|
/**
|
|
812
816
|
* Determine if the numbers are consecutive.
|
|
@@ -6289,7 +6293,7 @@ class BorderClipboardHandler extends AbstractCellClipboardHandler {
|
|
|
6289
6293
|
const POSTFIX_UNARY_OPERATORS = ["%"];
|
|
6290
6294
|
const OPERATORS = "+,-,*,/,:,=,<>,>=,>,<=,<,^,&".split(",").concat(POSTFIX_UNARY_OPERATORS);
|
|
6291
6295
|
function tokenize(str, locale = DEFAULT_LOCALE) {
|
|
6292
|
-
str =
|
|
6296
|
+
str = replaceNewLines(str);
|
|
6293
6297
|
const chars = new TokenizingChars(str);
|
|
6294
6298
|
const result = [];
|
|
6295
6299
|
while (!chars.isOver()) {
|
|
@@ -6436,12 +6440,12 @@ function tokenizeSpace(chars) {
|
|
|
6436
6440
|
if (length) {
|
|
6437
6441
|
return { type: "SPACE", value: NEWLINE.repeat(length) };
|
|
6438
6442
|
}
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
chars.shift();
|
|
6443
|
+
let spaces = "";
|
|
6444
|
+
while (chars.current && chars.current.match(whiteSpaceRegexp)) {
|
|
6445
|
+
spaces += chars.shift();
|
|
6442
6446
|
}
|
|
6443
|
-
if (
|
|
6444
|
-
return { type: "SPACE", value:
|
|
6447
|
+
if (spaces) {
|
|
6448
|
+
return { type: "SPACE", value: spaces };
|
|
6445
6449
|
}
|
|
6446
6450
|
return null;
|
|
6447
6451
|
}
|
|
@@ -9416,34 +9420,42 @@ function interpolateData(config, values, labels, newLabels) {
|
|
|
9416
9420
|
const labelRange = labelMax - labelMin;
|
|
9417
9421
|
const normalizedLabels = labels.map((v) => (v - labelMin) / labelRange);
|
|
9418
9422
|
const normalizedNewLabels = newLabels.map((v) => (v - labelMin) / labelRange);
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9423
|
+
try {
|
|
9424
|
+
switch (config.type) {
|
|
9425
|
+
case "polynomial": {
|
|
9426
|
+
const order = config.order;
|
|
9427
|
+
if (!order) {
|
|
9428
|
+
return Array.from({ length: newLabels.length }, () => NaN);
|
|
9429
|
+
}
|
|
9430
|
+
if (order === 1) {
|
|
9431
|
+
return predictLinearValues([values], [normalizedLabels], [normalizedNewLabels], true)[0];
|
|
9432
|
+
}
|
|
9433
|
+
const coeffs = polynomialRegression(values, normalizedLabels, order, true).flat();
|
|
9434
|
+
return normalizedNewLabels.map((v) => evaluatePolynomial(coeffs, v, order));
|
|
9435
|
+
}
|
|
9436
|
+
case "exponential": {
|
|
9437
|
+
const positiveLogValues = [];
|
|
9438
|
+
const filteredLabels = [];
|
|
9439
|
+
for (let i = 0; i < values.length; i++) {
|
|
9440
|
+
if (values[i] > 0) {
|
|
9441
|
+
positiveLogValues.push(Math.log(values[i]));
|
|
9442
|
+
filteredLabels.push(normalizedLabels[i]);
|
|
9443
|
+
}
|
|
9435
9444
|
}
|
|
9445
|
+
if (!filteredLabels.length) {
|
|
9446
|
+
return Array.from({ length: newLabels.length }, () => NaN);
|
|
9447
|
+
}
|
|
9448
|
+
return expM(predictLinearValues([positiveLogValues], [filteredLabels], [normalizedNewLabels], true))[0];
|
|
9436
9449
|
}
|
|
9437
|
-
|
|
9438
|
-
return [];
|
|
9450
|
+
case "logarithmic": {
|
|
9451
|
+
return predictLinearValues([values], logM([normalizedLabels]), logM([normalizedNewLabels]), true)[0];
|
|
9439
9452
|
}
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
case "logarithmic": {
|
|
9443
|
-
return predictLinearValues([values], logM([normalizedLabels]), logM([normalizedNewLabels]), true)[0];
|
|
9453
|
+
default:
|
|
9454
|
+
return [];
|
|
9444
9455
|
}
|
|
9445
|
-
|
|
9446
|
-
|
|
9456
|
+
}
|
|
9457
|
+
catch (e) {
|
|
9458
|
+
return Array.from({ length: newLabels.length }, () => NaN);
|
|
9447
9459
|
}
|
|
9448
9460
|
}
|
|
9449
9461
|
function formatTickValue(localeFormat) {
|
|
@@ -27242,13 +27254,12 @@ migrationStepRegistry
|
|
|
27242
27254
|
versionFrom: "7",
|
|
27243
27255
|
migrate(data) {
|
|
27244
27256
|
const namesTaken = [];
|
|
27245
|
-
const globalForbiddenInExcel = new RegExp(FORBIDDEN_IN_EXCEL_REGEX, "g");
|
|
27246
27257
|
for (let sheet of data.sheets || []) {
|
|
27247
27258
|
if (!sheet.name) {
|
|
27248
27259
|
continue;
|
|
27249
27260
|
}
|
|
27250
27261
|
const oldName = sheet.name;
|
|
27251
|
-
const escapedName = oldName
|
|
27262
|
+
const escapedName = sanitizeSheetName(oldName, "_");
|
|
27252
27263
|
let i = 1;
|
|
27253
27264
|
let newName = escapedName;
|
|
27254
27265
|
while (namesTaken.includes(newName)) {
|
|
@@ -37462,7 +37473,7 @@ class ChartWithAxisDesignPanel extends owl.Component {
|
|
|
37462
37473
|
case "polynomial":
|
|
37463
37474
|
config = {
|
|
37464
37475
|
type: "polynomial",
|
|
37465
|
-
order: type === "linear" ? 1 :
|
|
37476
|
+
order: type === "linear" ? 1 : this.getMaxPolynomialDegree(),
|
|
37466
37477
|
};
|
|
37467
37478
|
break;
|
|
37468
37479
|
case "exponential":
|
|
@@ -38538,20 +38549,8 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
38538
38549
|
replaceSelectedRange(zone) {
|
|
38539
38550
|
const ref = this.getZoneReference(zone);
|
|
38540
38551
|
const currentToken = this.tokenAtCursor;
|
|
38541
|
-
|
|
38542
|
-
|
|
38543
|
-
replaceStart = currentToken.start;
|
|
38544
|
-
}
|
|
38545
|
-
else if (currentToken?.type === "RIGHT_PAREN") {
|
|
38546
|
-
// match left parenthesis
|
|
38547
|
-
const leftParenthesisIndex = this.currentTokens.findIndex((token) => token.type === "LEFT_PAREN" && token.parenIndex === currentToken.parenIndex);
|
|
38548
|
-
const functionToken = this.currentTokens[leftParenthesisIndex - 1];
|
|
38549
|
-
if (functionToken === undefined) {
|
|
38550
|
-
return;
|
|
38551
|
-
}
|
|
38552
|
-
replaceStart = functionToken.start;
|
|
38553
|
-
}
|
|
38554
|
-
this.replaceText(ref, replaceStart, this.selectionEnd);
|
|
38552
|
+
const start = currentToken?.type === "REFERENCE" ? currentToken.start : this.selectionStart;
|
|
38553
|
+
this.replaceText(ref, start, this.selectionEnd);
|
|
38555
38554
|
}
|
|
38556
38555
|
/**
|
|
38557
38556
|
* Replace the reference of the old zone by the new one.
|
|
@@ -38584,17 +38583,6 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
38584
38583
|
getZoneReference(zone) {
|
|
38585
38584
|
const inputSheetId = this.sheetId;
|
|
38586
38585
|
const sheetId = this.getters.getActiveSheetId();
|
|
38587
|
-
if (zone.top === zone.bottom && zone.left === zone.right) {
|
|
38588
|
-
const position = { sheetId, col: zone.left, row: zone.top };
|
|
38589
|
-
const pivotId = this.getters.getPivotIdFromPosition(position);
|
|
38590
|
-
const pivotCell = this.getters.getPivotCellFromPosition(position);
|
|
38591
|
-
const cell = this.getters.getCell(position);
|
|
38592
|
-
if (pivotId && pivotCell.type !== "EMPTY" && !cell?.isFormula) {
|
|
38593
|
-
const formulaPivotId = this.getters.getPivotFormulaId(pivotId);
|
|
38594
|
-
const formula = createPivotFormula(formulaPivotId, pivotCell);
|
|
38595
|
-
return localizeFormula(formula, this.getters.getLocale()).slice(1); // strip leading =
|
|
38596
|
-
}
|
|
38597
|
-
}
|
|
38598
38586
|
const range = this.getters.getRangeFromZone(sheetId, zone);
|
|
38599
38587
|
return this.getters.getSelectionRangeString(range, inputSheetId);
|
|
38600
38588
|
}
|
|
@@ -38665,35 +38653,19 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
38665
38653
|
const colorIndex = this.colorIndexByRange[rangeString];
|
|
38666
38654
|
return colors$1[colorIndex % colors$1.length];
|
|
38667
38655
|
};
|
|
38668
|
-
|
|
38669
|
-
for (const range of this.getReferencedRanges()) {
|
|
38656
|
+
return this.getReferencedRanges().map((range) => {
|
|
38670
38657
|
const rangeString = this.getters.getRangeString(range, editionSheetId);
|
|
38671
38658
|
const { numberOfRows, numberOfCols } = zoneToDimension(range.zone);
|
|
38672
38659
|
const zone = numberOfRows * numberOfCols === 1
|
|
38673
38660
|
? this.getters.expandZone(range.sheetId, range.zone)
|
|
38674
38661
|
: range.zone;
|
|
38675
|
-
|
|
38662
|
+
return {
|
|
38676
38663
|
zone,
|
|
38677
38664
|
color: rangeColor(rangeString),
|
|
38678
38665
|
sheetId: range.sheetId,
|
|
38679
38666
|
interactive: true,
|
|
38680
|
-
}
|
|
38681
|
-
}
|
|
38682
|
-
const activeSheetId = this.getters.getActiveSheetId();
|
|
38683
|
-
const selectionZone = this.model.selection.getAnchor().zone;
|
|
38684
|
-
const isSelectionHightlighted = highlights.find((highlight) => highlight.sheetId === activeSheetId && isEqual(highlight.zone, selectionZone));
|
|
38685
|
-
if (this.editionMode === "selecting" && !isSelectionHightlighted) {
|
|
38686
|
-
highlights.push({
|
|
38687
|
-
zone: selectionZone,
|
|
38688
|
-
color: "#445566",
|
|
38689
|
-
sheetId: activeSheetId,
|
|
38690
|
-
dashed: true,
|
|
38691
|
-
interactive: false,
|
|
38692
|
-
noFill: true,
|
|
38693
|
-
thinLine: true,
|
|
38694
|
-
});
|
|
38695
|
-
}
|
|
38696
|
-
return highlights;
|
|
38667
|
+
};
|
|
38668
|
+
});
|
|
38697
38669
|
}
|
|
38698
38670
|
/**
|
|
38699
38671
|
* Return ranges currently referenced in the composer
|
|
@@ -39917,6 +39889,9 @@ class ConditionalFormattingEditor extends owl.Component {
|
|
|
39917
39889
|
return [this.state.rules.dataBar.rangeValues || ""];
|
|
39918
39890
|
}
|
|
39919
39891
|
updateDataBarColor(color) {
|
|
39892
|
+
if (!isColorValid(color)) {
|
|
39893
|
+
return;
|
|
39894
|
+
}
|
|
39920
39895
|
this.state.rules.dataBar.color = Number.parseInt(color.substr(1), 16);
|
|
39921
39896
|
}
|
|
39922
39897
|
onDataBarRangeUpdate(ranges) {
|
|
@@ -45221,6 +45196,7 @@ css /* scss */ `
|
|
|
45221
45196
|
}
|
|
45222
45197
|
}
|
|
45223
45198
|
`;
|
|
45199
|
+
const DEFAULT_TABLE_STYLE_COLOR = "#3C78D8";
|
|
45224
45200
|
class TableStyleEditorPanel extends owl.Component {
|
|
45225
45201
|
static template = "o-spreadsheet-TableStyleEditorPanel";
|
|
45226
45202
|
static components = { Section, RoundColorPicker, TableStylePreview };
|
|
@@ -45239,7 +45215,7 @@ class TableStyleEditorPanel extends owl.Component {
|
|
|
45239
45215
|
: null;
|
|
45240
45216
|
return {
|
|
45241
45217
|
pickerOpened: false,
|
|
45242
|
-
primaryColor: editedStyle?.primaryColor ||
|
|
45218
|
+
primaryColor: editedStyle?.primaryColor || DEFAULT_TABLE_STYLE_COLOR,
|
|
45243
45219
|
selectedTemplateName: editedStyle?.templateName || "lightColoredText",
|
|
45244
45220
|
styleName: editedStyle?.displayName || this.env.model.getters.getNewCustomTableStyleName(),
|
|
45245
45221
|
};
|
|
@@ -45248,7 +45224,7 @@ class TableStyleEditorPanel extends owl.Component {
|
|
|
45248
45224
|
this.state.pickerOpened = !this.state.pickerOpened;
|
|
45249
45225
|
}
|
|
45250
45226
|
onColorPicked(color) {
|
|
45251
|
-
this.state.primaryColor = color;
|
|
45227
|
+
this.state.primaryColor = isColorValid(color) ? color : DEFAULT_TABLE_STYLE_COLOR;
|
|
45252
45228
|
this.state.pickerOpened = false;
|
|
45253
45229
|
}
|
|
45254
45230
|
onTemplatePicked(templateName) {
|
|
@@ -46865,6 +46841,7 @@ class FiguresContainer extends owl.Component {
|
|
|
46865
46841
|
draggedFigure: undefined,
|
|
46866
46842
|
horizontalSnap: undefined,
|
|
46867
46843
|
verticalSnap: undefined,
|
|
46844
|
+
cancelDnd: undefined,
|
|
46868
46845
|
});
|
|
46869
46846
|
setup() {
|
|
46870
46847
|
owl.onMounted(() => {
|
|
@@ -46877,12 +46854,28 @@ class FiguresContainer extends owl.Component {
|
|
|
46877
46854
|
// new rendering
|
|
46878
46855
|
this.render();
|
|
46879
46856
|
});
|
|
46857
|
+
owl.onWillUpdateProps(() => {
|
|
46858
|
+
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
46859
|
+
const draggedFigureId = this.dnd.draggedFigure?.id;
|
|
46860
|
+
if (draggedFigureId && !this.env.model.getters.getFigure(sheetId, draggedFigureId)) {
|
|
46861
|
+
if (this.dnd.cancelDnd) {
|
|
46862
|
+
this.dnd.cancelDnd();
|
|
46863
|
+
}
|
|
46864
|
+
this.dnd.draggedFigure = undefined;
|
|
46865
|
+
this.dnd.horizontalSnap = undefined;
|
|
46866
|
+
this.dnd.verticalSnap = undefined;
|
|
46867
|
+
this.dnd.cancelDnd = undefined;
|
|
46868
|
+
}
|
|
46869
|
+
});
|
|
46880
46870
|
}
|
|
46881
46871
|
getVisibleFigures() {
|
|
46882
46872
|
const visibleFigures = this.env.model.getters.getVisibleFigures();
|
|
46883
46873
|
if (this.dnd.draggedFigure &&
|
|
46884
46874
|
!visibleFigures.some((figure) => figure.id === this.dnd.draggedFigure?.id)) {
|
|
46885
|
-
|
|
46875
|
+
const draggedFigure = this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(), this.dnd.draggedFigure?.id);
|
|
46876
|
+
if (draggedFigure) {
|
|
46877
|
+
visibleFigures.push(draggedFigure);
|
|
46878
|
+
}
|
|
46886
46879
|
}
|
|
46887
46880
|
return visibleFigures;
|
|
46888
46881
|
}
|
|
@@ -47001,7 +46994,7 @@ class FiguresContainer extends owl.Component {
|
|
|
47001
46994
|
this.dnd.verticalSnap = undefined;
|
|
47002
46995
|
this.env.model.dispatch("UPDATE_FIGURE", { sheetId, id: figure.id, x, y });
|
|
47003
46996
|
};
|
|
47004
|
-
startDnd(onMouseMove, onMouseUp);
|
|
46997
|
+
this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
|
|
47005
46998
|
}
|
|
47006
46999
|
/**
|
|
47007
47000
|
* Initialize the resize of a figure with mouse movements
|
|
@@ -47049,7 +47042,7 @@ class FiguresContainer extends owl.Component {
|
|
|
47049
47042
|
this.dnd.horizontalSnap = undefined;
|
|
47050
47043
|
this.dnd.verticalSnap = undefined;
|
|
47051
47044
|
};
|
|
47052
|
-
startDnd(onMouseMove, onMouseUp);
|
|
47045
|
+
this.dnd.cancelDnd = startDnd(onMouseMove, onMouseUp);
|
|
47053
47046
|
}
|
|
47054
47047
|
getOtherFigures(figId) {
|
|
47055
47048
|
return this.getVisibleFigures().filter((f) => f.id !== figId);
|
|
@@ -51202,7 +51195,7 @@ class CellPlugin extends CorePlugin {
|
|
|
51202
51195
|
const before = this.getters.getCell({ sheetId, col, row });
|
|
51203
51196
|
const hasContent = "content" in after || "formula" in after;
|
|
51204
51197
|
// Compute the new cell properties
|
|
51205
|
-
const afterContent = hasContent ?
|
|
51198
|
+
const afterContent = hasContent ? replaceNewLines(after?.content) : before?.content || "";
|
|
51206
51199
|
let style;
|
|
51207
51200
|
if (after.style !== undefined) {
|
|
51208
51201
|
style = after.style || undefined;
|
|
@@ -54114,6 +54107,9 @@ class SheetPlugin extends CorePlugin {
|
|
|
54114
54107
|
};
|
|
54115
54108
|
}
|
|
54116
54109
|
getUnboundedZone(sheetId, zone) {
|
|
54110
|
+
if (zone.bottom === undefined || zone.right === undefined) {
|
|
54111
|
+
return zone;
|
|
54112
|
+
}
|
|
54117
54113
|
const isFullRow = zone.left === 0 && zone.right === this.getNumberCols(sheetId) - 1;
|
|
54118
54114
|
const isFullCol = zone.top === 0 && zone.bottom === this.getNumberRows(sheetId) - 1;
|
|
54119
54115
|
return {
|
|
@@ -54279,7 +54275,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
54279
54275
|
if (orderedSheetIds.find((id) => sheets[id]?.name.toLowerCase() === name && id !== cmd.sheetId)) {
|
|
54280
54276
|
return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
|
|
54281
54277
|
}
|
|
54282
|
-
if (
|
|
54278
|
+
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) {
|
|
54283
54279
|
return "ForbiddenCharactersInSheetName" /* CommandResult.ForbiddenCharactersInSheetName */;
|
|
54284
54280
|
}
|
|
54285
54281
|
return "Success" /* CommandResult.Success */;
|
|
@@ -59682,11 +59678,13 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
59682
59678
|
return EMPTY_PIVOT_CELL;
|
|
59683
59679
|
}
|
|
59684
59680
|
if (functionName === "PIVOT") {
|
|
59685
|
-
const includeTotal = args[2]
|
|
59686
|
-
const
|
|
59681
|
+
const includeTotal = toScalar(args[2]);
|
|
59682
|
+
const shouldIncludeTotal = includeTotal === undefined ? true : toBoolean(includeTotal);
|
|
59683
|
+
const includeColumnHeaders = toScalar(args[3]);
|
|
59684
|
+
const shouldIncludeColumnHeaders = includeColumnHeaders === undefined ? true : toBoolean(includeColumnHeaders);
|
|
59687
59685
|
const pivotCells = pivot
|
|
59688
59686
|
.getTableStructure()
|
|
59689
|
-
.getPivotCells(
|
|
59687
|
+
.getPivotCells(shouldIncludeTotal, shouldIncludeColumnHeaders);
|
|
59690
59688
|
const pivotCol = position.col - mainPosition.col;
|
|
59691
59689
|
const pivotRow = position.row - mainPosition.row;
|
|
59692
59690
|
return pivotCells[pivotCol][pivotRow];
|
|
@@ -61600,7 +61598,7 @@ class FormatPlugin extends UIPlugin {
|
|
|
61600
61598
|
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
61601
61599
|
const position = { sheetId, col, row };
|
|
61602
61600
|
const pivotCell = this.getters.getPivotCellFromPosition(position);
|
|
61603
|
-
if (
|
|
61601
|
+
if (this.isSpilledPivotValueFormula(position, pivotCell)) {
|
|
61604
61602
|
measurePositions.push(position);
|
|
61605
61603
|
const pivotId = this.getters.getPivotIdFromPosition(position) || "";
|
|
61606
61604
|
measuresByPivotId[pivotId] ??= new Set();
|
|
@@ -61637,6 +61635,10 @@ class FormatPlugin extends UIPlugin {
|
|
|
61637
61635
|
format,
|
|
61638
61636
|
});
|
|
61639
61637
|
}
|
|
61638
|
+
isSpilledPivotValueFormula(position, pivotCell) {
|
|
61639
|
+
const cell = this.getters.getCell(position);
|
|
61640
|
+
return pivotCell.type === "VALUE" && !cell?.isFormula;
|
|
61641
|
+
}
|
|
61640
61642
|
/**
|
|
61641
61643
|
* This function allows to adjust the quantity of decimal places after a decimal
|
|
61642
61644
|
* point on cells containing number value. It does this by changing the cells
|
|
@@ -61842,7 +61844,7 @@ class InsertPivotPlugin extends UIPlugin {
|
|
|
61842
61844
|
getPivotDuplicateSheetName(pivotName) {
|
|
61843
61845
|
let i = 1;
|
|
61844
61846
|
const names = this.getters.getSheetIds().map((id) => this.getters.getSheetName(id));
|
|
61845
|
-
const sanitizedName = pivotName
|
|
61847
|
+
const sanitizedName = sanitizeSheetName(pivotName);
|
|
61846
61848
|
let name = sanitizedName;
|
|
61847
61849
|
while (names.includes(name)) {
|
|
61848
61850
|
name = `${sanitizedName} (${i})`;
|
|
@@ -65025,6 +65027,7 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
65025
65027
|
break;
|
|
65026
65028
|
case "DELETE_SHEET":
|
|
65027
65029
|
this.cleanViewports();
|
|
65030
|
+
this.sheetsWithDirtyViewports.delete(cmd.sheetId);
|
|
65028
65031
|
break;
|
|
65029
65032
|
case "ACTIVATE_SHEET":
|
|
65030
65033
|
this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
|
|
@@ -65922,7 +65925,7 @@ function interactiveRenameSheet(env, sheetId, name, errorCallback) {
|
|
|
65922
65925
|
env.raiseError(_t("A sheet with the name %s already exists. Please select another name.", name), errorCallback);
|
|
65923
65926
|
}
|
|
65924
65927
|
else if (result.reasons.includes("ForbiddenCharactersInSheetName" /* CommandResult.ForbiddenCharactersInSheetName */)) {
|
|
65925
|
-
env.raiseError(_t("Some used characters are not allowed in a sheet name (Forbidden characters are %s).",
|
|
65928
|
+
env.raiseError(_t("Some used characters are not allowed in a sheet name (Forbidden characters are %s).", FORBIDDEN_SHEETNAME_CHARS.join(" ")), errorCallback);
|
|
65926
65929
|
}
|
|
65927
65930
|
}
|
|
65928
65931
|
|
|
@@ -67152,7 +67155,7 @@ class ActionButton extends owl.Component {
|
|
|
67152
67155
|
setup() {
|
|
67153
67156
|
owl.onWillUpdateProps((nextProps) => {
|
|
67154
67157
|
if (nextProps.action !== this.props.action) {
|
|
67155
|
-
this.actionButton = createAction(
|
|
67158
|
+
this.actionButton = createAction(nextProps.action);
|
|
67156
67159
|
}
|
|
67157
67160
|
});
|
|
67158
67161
|
}
|
|
@@ -67423,7 +67426,6 @@ css /* scss */ `
|
|
|
67423
67426
|
height: fit-content;
|
|
67424
67427
|
margin-top: -1px;
|
|
67425
67428
|
border: 1px solid;
|
|
67426
|
-
z-index: ${ComponentsImportance.TopBarComposer};
|
|
67427
67429
|
font-family: ${DEFAULT_FONT};
|
|
67428
67430
|
|
|
67429
67431
|
.o-composer:empty:not(:focus):not(.active)::before {
|
|
@@ -67481,6 +67483,7 @@ class TopBarComposer extends owl.Component {
|
|
|
67481
67483
|
}
|
|
67482
67484
|
return cssPropertiesToCss({
|
|
67483
67485
|
"border-color": SELECTION_BORDER_COLOR,
|
|
67486
|
+
"z-index": String(ComponentsImportance.TopBarComposer),
|
|
67484
67487
|
});
|
|
67485
67488
|
}
|
|
67486
67489
|
onFocus(selection) {
|
|
@@ -69331,9 +69334,6 @@ class SelectionStreamProcessorImpl {
|
|
|
69331
69334
|
getBackToDefault() {
|
|
69332
69335
|
this.stream.getBackToDefault();
|
|
69333
69336
|
}
|
|
69334
|
-
getAnchor() {
|
|
69335
|
-
return this.anchor;
|
|
69336
|
-
}
|
|
69337
69337
|
modifyAnchor(anchor, mode, options) {
|
|
69338
69338
|
const sheetId = this.getters.getActiveSheetId();
|
|
69339
69339
|
anchor = {
|
|
@@ -72421,6 +72421,7 @@ const helpers = {
|
|
|
72421
72421
|
areDomainArgsFieldsValid,
|
|
72422
72422
|
splitReference,
|
|
72423
72423
|
formatTickValue,
|
|
72424
|
+
sanitizeSheetName,
|
|
72424
72425
|
};
|
|
72425
72426
|
const links = {
|
|
72426
72427
|
isMarkdownLink,
|
|
@@ -72556,6 +72557,6 @@ exports.tokenColors = tokenColors;
|
|
|
72556
72557
|
exports.tokenize = tokenize;
|
|
72557
72558
|
|
|
72558
72559
|
|
|
72559
|
-
__info__.version = "18.0.
|
|
72560
|
-
__info__.date = "2024-
|
|
72561
|
-
__info__.hash = "
|
|
72560
|
+
__info__.version = "18.0.8";
|
|
72561
|
+
__info__.date = "2024-12-19T07:50:36.150Z";
|
|
72562
|
+
__info__.hash = "7cf34a6";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -1306,7 +1306,6 @@ type StatefulStream<Event, State> = {
|
|
|
1306
1306
|
* Allows to select cells in the grid and update the selection
|
|
1307
1307
|
*/
|
|
1308
1308
|
interface SelectionProcessor {
|
|
1309
|
-
getAnchor(): Immutable<AnchorZone>;
|
|
1310
1309
|
selectZone(anchor: AnchorZone, options?: SelectionEventOptions): DispatchResult;
|
|
1311
1310
|
selectCell(col: number, row: number): DispatchResult;
|
|
1312
1311
|
moveAnchorCell(direction: Direction$1, step: SelectionStep): DispatchResult;
|
|
@@ -5706,6 +5705,8 @@ declare function createCurrencyFormat(currency: Partial<Currency>): Format;
|
|
|
5706
5705
|
*/
|
|
5707
5706
|
declare function deepCopy<T>(obj: T): T;
|
|
5708
5707
|
declare function unquote(string: string, quoteChar?: "'" | '"'): string;
|
|
5708
|
+
/** Replace the excel-excluded characters of a sheetName */
|
|
5709
|
+
declare function sanitizeSheetName(sheetName: string, replacementChar?: string): string;
|
|
5709
5710
|
declare function isMarkdownLink(str: string): boolean;
|
|
5710
5711
|
/**
|
|
5711
5712
|
* Build a markdown link from a label and an url
|
|
@@ -8575,6 +8576,7 @@ interface DndState {
|
|
|
8575
8576
|
draggedFigure?: Figure;
|
|
8576
8577
|
horizontalSnap?: Snap<HFigureAxisType>;
|
|
8577
8578
|
verticalSnap?: Snap<VFigureAxisType>;
|
|
8579
|
+
cancelDnd: (() => void) | undefined;
|
|
8578
8580
|
}
|
|
8579
8581
|
/**
|
|
8580
8582
|
* Each figure ⭐ is positioned inside a container `div` placed and sized
|
|
@@ -12085,6 +12087,7 @@ declare const helpers: {
|
|
|
12085
12087
|
areDomainArgsFieldsValid: typeof areDomainArgsFieldsValid;
|
|
12086
12088
|
splitReference: typeof splitReference;
|
|
12087
12089
|
formatTickValue: typeof formatTickValue;
|
|
12090
|
+
sanitizeSheetName: typeof sanitizeSheetName;
|
|
12088
12091
|
};
|
|
12089
12092
|
declare const links: {
|
|
12090
12093
|
isMarkdownLink: typeof isMarkdownLink;
|