@odoo/o-spreadsheet 16.0.47 → 16.0.49
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 +47 -42
- package/dist/o-spreadsheet.d.ts +2 -1
- package/dist/o-spreadsheet.esm.js +47 -42
- package/dist/o-spreadsheet.iife.js +47 -42
- package/dist/o-spreadsheet.iife.min.js +227 -227
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +2 -2
|
@@ -3343,7 +3343,7 @@
|
|
|
3343
3343
|
* Static helper which returns a successful DispatchResult
|
|
3344
3344
|
*/
|
|
3345
3345
|
static get Success() {
|
|
3346
|
-
return
|
|
3346
|
+
return SUCCESS;
|
|
3347
3347
|
}
|
|
3348
3348
|
get isSuccessful() {
|
|
3349
3349
|
return this.reasons.length === 0;
|
|
@@ -3356,6 +3356,7 @@
|
|
|
3356
3356
|
return this.reasons.includes(reason);
|
|
3357
3357
|
}
|
|
3358
3358
|
}
|
|
3359
|
+
const SUCCESS = new DispatchResult();
|
|
3359
3360
|
exports.CommandResult = void 0;
|
|
3360
3361
|
(function (CommandResult) {
|
|
3361
3362
|
CommandResult[CommandResult["Success"] = 0] = "Success";
|
|
@@ -4083,8 +4084,8 @@
|
|
|
4083
4084
|
* Return the o-spreadsheet element position relative
|
|
4084
4085
|
* to the browser viewport.
|
|
4085
4086
|
*/
|
|
4086
|
-
function
|
|
4087
|
-
const position = owl.useState({ x: 0, y: 0 });
|
|
4087
|
+
function useSpreadsheetRect() {
|
|
4088
|
+
const position = owl.useState({ x: 0, y: 0, width: 0, height: 0 });
|
|
4088
4089
|
let spreadsheetElement = document.querySelector(".o-spreadsheet");
|
|
4089
4090
|
updatePosition();
|
|
4090
4091
|
function updatePosition() {
|
|
@@ -4092,9 +4093,11 @@
|
|
|
4092
4093
|
spreadsheetElement = document.querySelector(".o-spreadsheet");
|
|
4093
4094
|
}
|
|
4094
4095
|
if (spreadsheetElement) {
|
|
4095
|
-
const { top, left } = spreadsheetElement.getBoundingClientRect();
|
|
4096
|
+
const { top, left, width, height } = spreadsheetElement.getBoundingClientRect();
|
|
4096
4097
|
position.x = left;
|
|
4097
4098
|
position.y = top;
|
|
4099
|
+
position.width = width;
|
|
4100
|
+
position.height = height;
|
|
4098
4101
|
}
|
|
4099
4102
|
}
|
|
4100
4103
|
owl.onMounted(updatePosition);
|
|
@@ -4129,7 +4132,7 @@
|
|
|
4129
4132
|
class Popover extends owl.Component {
|
|
4130
4133
|
constructor() {
|
|
4131
4134
|
super(...arguments);
|
|
4132
|
-
this.
|
|
4135
|
+
this.spreadsheetRect = useSpreadsheetRect();
|
|
4133
4136
|
}
|
|
4134
4137
|
get maxHeight() {
|
|
4135
4138
|
return Math.max(0, this.viewportDimension.height - BOTTOMBAR_HEIGHT - SCROLLBAR_WIDTH);
|
|
@@ -4138,8 +4141,8 @@
|
|
|
4138
4141
|
// the props's position is expressed relative to the "body" element
|
|
4139
4142
|
// but we teleport the element in ".o-spreadsheet" to keep everything
|
|
4140
4143
|
// within our control and to avoid leaking into external DOM
|
|
4141
|
-
const horizontalPosition = `left:${this.horizontalPosition() - this.
|
|
4142
|
-
const verticalPosition = `top:${this.verticalPosition() - this.
|
|
4144
|
+
const horizontalPosition = `left:${this.horizontalPosition() - this.spreadsheetRect.x}`;
|
|
4145
|
+
const verticalPosition = `top:${this.verticalPosition() - this.spreadsheetRect.y}`;
|
|
4143
4146
|
const maxHeight = this.maxHeight;
|
|
4144
4147
|
const height = `max-height:${maxHeight}`;
|
|
4145
4148
|
const shadow = maxHeight !== 0 ? "box-shadow: 1px 2px 5px 2px rgb(51 51 51 / 15%);" : "";
|
|
@@ -11372,7 +11375,7 @@
|
|
|
11372
11375
|
operand = descr;
|
|
11373
11376
|
}
|
|
11374
11377
|
}
|
|
11375
|
-
if (isNumber(operand)) {
|
|
11378
|
+
if (isNumber(operand) || isDateTime(operand)) {
|
|
11376
11379
|
operand = toNumber(operand);
|
|
11377
11380
|
}
|
|
11378
11381
|
else if (operand === "TRUE" || operand === "FALSE") {
|
|
@@ -11420,7 +11423,10 @@
|
|
|
11420
11423
|
return false;
|
|
11421
11424
|
}
|
|
11422
11425
|
if (typeof operand === "number" && operator === "=") {
|
|
11423
|
-
|
|
11426
|
+
if (typeof value === "string" && (isNumber(value) || isDateTime(value))) {
|
|
11427
|
+
return toNumber(value) === operand;
|
|
11428
|
+
}
|
|
11429
|
+
return value === operand;
|
|
11424
11430
|
}
|
|
11425
11431
|
if (operator === "<>" || operator === "=") {
|
|
11426
11432
|
let result;
|
|
@@ -20429,6 +20435,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
20429
20435
|
constructor() {
|
|
20430
20436
|
super(...arguments);
|
|
20431
20437
|
this.composerRef = owl.useRef("o_composer");
|
|
20438
|
+
this.spreadsheetRect = useSpreadsheetRect();
|
|
20432
20439
|
this.contentHelper = new ContentEditableHelper(this.composerRef.el);
|
|
20433
20440
|
this.composerState = owl.useState({
|
|
20434
20441
|
positionStart: 0,
|
|
@@ -20464,24 +20471,28 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
20464
20471
|
};
|
|
20465
20472
|
}
|
|
20466
20473
|
get assistantStyle() {
|
|
20474
|
+
const composerRect = this.composerRef.el.getBoundingClientRect();
|
|
20475
|
+
const assistantStyle = {
|
|
20476
|
+
width: `${ASSISTANT_WIDTH}px`,
|
|
20477
|
+
};
|
|
20467
20478
|
if (this.props.delimitation && this.props.rect) {
|
|
20468
20479
|
const { x: cellX, y: cellY, height: cellHeight } = this.props.rect;
|
|
20469
20480
|
const remainingHeight = this.props.delimitation.height - (cellY + cellHeight);
|
|
20470
|
-
let assistantStyle = "";
|
|
20471
20481
|
if (cellY > remainingHeight) {
|
|
20472
20482
|
// render top
|
|
20473
|
-
assistantStyle
|
|
20474
|
-
|
|
20475
|
-
transform: translate(0, -100%);
|
|
20476
|
-
`;
|
|
20483
|
+
assistantStyle.top = "-8px";
|
|
20484
|
+
assistantStyle.transform = "translate(0, -100%)";
|
|
20477
20485
|
}
|
|
20478
20486
|
if (cellX + ASSISTANT_WIDTH > this.props.delimitation.width) {
|
|
20479
20487
|
// render left
|
|
20480
|
-
assistantStyle
|
|
20488
|
+
assistantStyle.right = "0px";
|
|
20481
20489
|
}
|
|
20482
|
-
return (assistantStyle
|
|
20490
|
+
return cssPropertiesToCss(assistantStyle);
|
|
20491
|
+
}
|
|
20492
|
+
if (composerRect.left + ASSISTANT_WIDTH > this.spreadsheetRect.width) {
|
|
20493
|
+
assistantStyle.right = "0px";
|
|
20483
20494
|
}
|
|
20484
|
-
return
|
|
20495
|
+
return cssPropertiesToCss(assistantStyle);
|
|
20485
20496
|
}
|
|
20486
20497
|
setup() {
|
|
20487
20498
|
owl.onMounted(() => {
|
|
@@ -21619,10 +21630,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
21619
21630
|
row: undefined,
|
|
21620
21631
|
};
|
|
21621
21632
|
const { Date } = window;
|
|
21622
|
-
let x =
|
|
21623
|
-
let y =
|
|
21633
|
+
let x = undefined;
|
|
21634
|
+
let y = undefined;
|
|
21624
21635
|
let lastMoved = 0;
|
|
21625
21636
|
function getPosition() {
|
|
21637
|
+
if (x === undefined || y === undefined) {
|
|
21638
|
+
return { col: -1, row: -1 };
|
|
21639
|
+
}
|
|
21626
21640
|
const col = env.model.getters.getColIndex(x);
|
|
21627
21641
|
const row = env.model.getters.getRowIndex(y);
|
|
21628
21642
|
return { col, row };
|
|
@@ -27462,12 +27476,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27462
27476
|
this.clearBorders(cmd.sheetId, cmd.target);
|
|
27463
27477
|
break;
|
|
27464
27478
|
case "REMOVE_COLUMNS_ROWS":
|
|
27465
|
-
|
|
27479
|
+
const elements = [...cmd.elements].sort((a, b) => b - a);
|
|
27480
|
+
for (const group of groupConsecutive(elements)) {
|
|
27466
27481
|
if (cmd.dimension === "COL") {
|
|
27467
|
-
this.shiftBordersHorizontally(cmd.sheetId,
|
|
27482
|
+
this.shiftBordersHorizontally(cmd.sheetId, group[group.length - 1] + 1, -group.length);
|
|
27468
27483
|
}
|
|
27469
27484
|
else {
|
|
27470
|
-
this.shiftBordersVertically(cmd.sheetId,
|
|
27485
|
+
this.shiftBordersVertically(cmd.sheetId, group[group.length - 1] + 1, -group.length);
|
|
27471
27486
|
}
|
|
27472
27487
|
}
|
|
27473
27488
|
break;
|
|
@@ -30964,12 +30979,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30964
30979
|
});
|
|
30965
30980
|
}
|
|
30966
30981
|
if (colIndex > deletedColumn) {
|
|
30967
|
-
this.
|
|
30968
|
-
sheetId: sheet.id,
|
|
30969
|
-
cellId: cellId,
|
|
30970
|
-
col: colIndex - 1,
|
|
30971
|
-
row: rowIndex,
|
|
30972
|
-
});
|
|
30982
|
+
this.setNewPosition(cellId, sheet.id, colIndex - 1, rowIndex);
|
|
30973
30983
|
}
|
|
30974
30984
|
}
|
|
30975
30985
|
}
|
|
@@ -30979,7 +30989,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30979
30989
|
* Move the cells after a column or rows insertion
|
|
30980
30990
|
*/
|
|
30981
30991
|
moveCellsOnAddition(sheet, addedElement, quantity, dimension) {
|
|
30982
|
-
const
|
|
30992
|
+
const updates = [];
|
|
30983
30993
|
for (let rowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
|
|
30984
30994
|
const row = sheet.rows[rowIndex];
|
|
30985
30995
|
if (dimension !== "rows" || rowIndex >= addedElement) {
|
|
@@ -30988,20 +30998,20 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
30988
30998
|
const cellId = row.cells[i];
|
|
30989
30999
|
if (cellId) {
|
|
30990
31000
|
if (dimension === "rows" || colIndex >= addedElement) {
|
|
30991
|
-
|
|
30992
|
-
type: "UPDATE_CELL_POSITION",
|
|
31001
|
+
updates.push({
|
|
30993
31002
|
sheetId: sheet.id,
|
|
30994
31003
|
cellId: cellId,
|
|
30995
31004
|
col: colIndex + (dimension === "columns" ? quantity : 0),
|
|
30996
31005
|
row: rowIndex + (dimension === "rows" ? quantity : 0),
|
|
31006
|
+
type: "UPDATE_CELL_POSITION",
|
|
30997
31007
|
});
|
|
30998
31008
|
}
|
|
30999
31009
|
}
|
|
31000
31010
|
}
|
|
31001
31011
|
}
|
|
31002
31012
|
}
|
|
31003
|
-
for (let
|
|
31004
|
-
this.
|
|
31013
|
+
for (let update of updates.reverse()) {
|
|
31014
|
+
this.updateCellPosition(update);
|
|
31005
31015
|
}
|
|
31006
31016
|
}
|
|
31007
31017
|
/**
|
|
@@ -31034,12 +31044,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31034
31044
|
const colIndex = Number(i);
|
|
31035
31045
|
const cellId = row.cells[i];
|
|
31036
31046
|
if (cellId) {
|
|
31037
|
-
this.
|
|
31038
|
-
sheetId: sheet.id,
|
|
31039
|
-
cellId: cellId,
|
|
31040
|
-
col: colIndex,
|
|
31041
|
-
row: rowIndex - numberRows,
|
|
31042
|
-
});
|
|
31047
|
+
this.setNewPosition(cellId, sheet.id, colIndex, rowIndex - numberRows);
|
|
31043
31048
|
}
|
|
31044
31049
|
}
|
|
31045
31050
|
}
|
|
@@ -43435,9 +43440,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
43435
43440
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
43436
43441
|
|
|
43437
43442
|
|
|
43438
|
-
__info__.version = '16.0.
|
|
43439
|
-
__info__.date = '2024-
|
|
43440
|
-
__info__.hash = '
|
|
43443
|
+
__info__.version = '16.0.49';
|
|
43444
|
+
__info__.date = '2024-08-02T08:18:43.387Z';
|
|
43445
|
+
__info__.hash = '97d415b';
|
|
43441
43446
|
|
|
43442
43447
|
|
|
43443
43448
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|