@odoo/o-spreadsheet 16.2.14 → 16.2.17
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 +155 -95
- package/dist/o-spreadsheet.d.ts +13 -5
- package/dist/o-spreadsheet.esm.js +155 -95
- package/dist/o-spreadsheet.iife.js +155 -95
- package/dist/o-spreadsheet.iife.min.js +227 -226
- package/package.json +2 -2
|
@@ -991,13 +991,17 @@ function getAddHeaderStartIndex(position, base) {
|
|
|
991
991
|
return position === "after" ? base + 1 : base;
|
|
992
992
|
}
|
|
993
993
|
/**
|
|
994
|
-
*
|
|
994
|
+
* Compares two objects.
|
|
995
995
|
*/
|
|
996
996
|
function deepEquals(o1, o2) {
|
|
997
997
|
if (o1 === o2)
|
|
998
998
|
return true;
|
|
999
999
|
if ((o1 && !o2) || (o2 && !o1))
|
|
1000
1000
|
return false;
|
|
1001
|
+
if (typeof o1 !== typeof o2)
|
|
1002
|
+
return false;
|
|
1003
|
+
if (typeof o1 !== "object")
|
|
1004
|
+
return o1 === o2;
|
|
1001
1005
|
// Objects can have different keys if the values are undefined
|
|
1002
1006
|
const keys = new Set();
|
|
1003
1007
|
Object.keys(o1).forEach((key) => keys.add(key));
|
|
@@ -4683,6 +4687,7 @@ css /* scss */ `
|
|
|
4683
4687
|
padding: 10px;
|
|
4684
4688
|
width: ${ERROR_TOOLTIP_WIDTH}px;
|
|
4685
4689
|
box-sizing: border-box !important;
|
|
4690
|
+
overflow-wrap: break-word;
|
|
4686
4691
|
}
|
|
4687
4692
|
`;
|
|
4688
4693
|
class ErrorToolTip extends owl.Component {
|
|
@@ -4864,6 +4869,9 @@ class FilterMenu extends owl.Component {
|
|
|
4864
4869
|
});
|
|
4865
4870
|
this.state.values = this.getFilterValues(this.props.filterPosition);
|
|
4866
4871
|
}
|
|
4872
|
+
get isReadonly() {
|
|
4873
|
+
return this.env.model.getters.isReadonly();
|
|
4874
|
+
}
|
|
4867
4875
|
getFilterValues(position) {
|
|
4868
4876
|
const sheetId = this.env.model.getters.getActiveSheetId();
|
|
4869
4877
|
const filter = this.env.model.getters.getFilter({ sheetId, ...position });
|
|
@@ -7245,6 +7253,7 @@ class LineChart extends AbstractChart {
|
|
|
7245
7253
|
this.labelsAsText = definition.labelsAsText;
|
|
7246
7254
|
this.stacked = definition.stacked;
|
|
7247
7255
|
this.aggregated = definition.aggregated;
|
|
7256
|
+
this.cumulative = definition.cumulative;
|
|
7248
7257
|
}
|
|
7249
7258
|
static validateChartDefinition(validator, definition) {
|
|
7250
7259
|
return validator.checkValidations(definition, checkDataset, checkLabelRange);
|
|
@@ -7265,6 +7274,7 @@ class LineChart extends AbstractChart {
|
|
|
7265
7274
|
labelRange: context.auxiliaryRange || undefined,
|
|
7266
7275
|
stacked: false,
|
|
7267
7276
|
aggregated: false,
|
|
7277
|
+
cumulative: false,
|
|
7268
7278
|
};
|
|
7269
7279
|
}
|
|
7270
7280
|
getDefinition() {
|
|
@@ -7285,6 +7295,7 @@ class LineChart extends AbstractChart {
|
|
|
7285
7295
|
labelsAsText: this.labelsAsText,
|
|
7286
7296
|
stacked: this.stacked,
|
|
7287
7297
|
aggregated: this.aggregated,
|
|
7298
|
+
cumulative: this.cumulative,
|
|
7288
7299
|
};
|
|
7289
7300
|
}
|
|
7290
7301
|
getContextCreation() {
|
|
@@ -7488,6 +7499,16 @@ function createLineChartRuntime(chart, getters) {
|
|
|
7488
7499
|
if (chart.stacked) {
|
|
7489
7500
|
backgroundRGBA.a = LINE_FILL_TRANSPARENCY;
|
|
7490
7501
|
}
|
|
7502
|
+
if (chart.cumulative) {
|
|
7503
|
+
let accumulator = 0;
|
|
7504
|
+
data = data.map((value) => {
|
|
7505
|
+
if (!isNaN(value)) {
|
|
7506
|
+
accumulator += parseFloat(value);
|
|
7507
|
+
return accumulator;
|
|
7508
|
+
}
|
|
7509
|
+
return value;
|
|
7510
|
+
});
|
|
7511
|
+
}
|
|
7491
7512
|
const backgroundColor = rgbaToHex(backgroundRGBA);
|
|
7492
7513
|
const dataset = {
|
|
7493
7514
|
label,
|
|
@@ -8270,6 +8291,7 @@ function getSmartChartDefinition(zone, getters) {
|
|
|
8270
8291
|
labelsAsText: false,
|
|
8271
8292
|
stacked: false,
|
|
8272
8293
|
aggregated: false,
|
|
8294
|
+
cumulative: false,
|
|
8273
8295
|
labelRange: labelRangeXc,
|
|
8274
8296
|
type: "line",
|
|
8275
8297
|
dataSetsHaveTitle,
|
|
@@ -8632,6 +8654,13 @@ const REMOVE_ROWS_ACTION = (env) => {
|
|
|
8632
8654
|
elements: rows,
|
|
8633
8655
|
});
|
|
8634
8656
|
};
|
|
8657
|
+
const CAN_REMOVE_COLUMNS_ROWS = (dimension, env) => {
|
|
8658
|
+
const sheetId = env.model.getters.getActiveSheetId();
|
|
8659
|
+
const selectedElements = env.model.getters.getElementsFromSelection(dimension);
|
|
8660
|
+
const includesAllVisibleHeaders = env.model.getters.checkElementsIncludeAllVisibleHeaders(sheetId, dimension, selectedElements);
|
|
8661
|
+
const includesAllNonFrozenHeaders = env.model.getters.checkElementsIncludeAllNonFrozenHeaders(sheetId, dimension, selectedElements);
|
|
8662
|
+
return !includesAllVisibleHeaders && !includesAllNonFrozenHeaders;
|
|
8663
|
+
};
|
|
8635
8664
|
const REMOVE_COLUMNS_NAME = (env) => {
|
|
8636
8665
|
if (env.model.getters.getSelectedZones().length > 1) {
|
|
8637
8666
|
return _lt("Delete columns");
|
|
@@ -9222,11 +9251,7 @@ colMenuRegistry
|
|
|
9222
9251
|
name: REMOVE_COLUMNS_NAME,
|
|
9223
9252
|
sequence: 90,
|
|
9224
9253
|
action: REMOVE_COLUMNS_ACTION,
|
|
9225
|
-
isVisible: (env) =>
|
|
9226
|
-
const sheetId = env.model.getters.getActiveSheetId();
|
|
9227
|
-
const selectedCols = env.model.getters.getElementsFromSelection("COL");
|
|
9228
|
-
return env.model.getters.canRemoveHeaders(sheetId, "COL", selectedCols);
|
|
9229
|
-
},
|
|
9254
|
+
isVisible: (env) => CAN_REMOVE_COLUMNS_ROWS("COL", env),
|
|
9230
9255
|
})
|
|
9231
9256
|
.add("clear_column", {
|
|
9232
9257
|
name: DELETE_CONTENT_COLUMNS_NAME,
|
|
@@ -9240,7 +9265,7 @@ colMenuRegistry
|
|
|
9240
9265
|
isVisible: (env) => {
|
|
9241
9266
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
9242
9267
|
const selectedCols = env.model.getters.getElementsFromSelection("COL");
|
|
9243
|
-
return env.model.getters.
|
|
9268
|
+
return !env.model.getters.checkElementsIncludeAllVisibleHeaders(sheetId, "COL", selectedCols);
|
|
9244
9269
|
},
|
|
9245
9270
|
separator: true,
|
|
9246
9271
|
})
|
|
@@ -9314,11 +9339,7 @@ rowMenuRegistry
|
|
|
9314
9339
|
name: REMOVE_ROWS_NAME,
|
|
9315
9340
|
sequence: 70,
|
|
9316
9341
|
action: REMOVE_ROWS_ACTION,
|
|
9317
|
-
isVisible: (env) =>
|
|
9318
|
-
const sheetId = env.model.getters.getActiveSheetId();
|
|
9319
|
-
const selectedRows = env.model.getters.getElementsFromSelection("ROW");
|
|
9320
|
-
return env.model.getters.canRemoveHeaders(sheetId, "ROW", selectedRows);
|
|
9321
|
-
},
|
|
9342
|
+
isVisible: (env) => CAN_REMOVE_COLUMNS_ROWS("ROW", env),
|
|
9322
9343
|
})
|
|
9323
9344
|
.add("clear_row", {
|
|
9324
9345
|
name: DELETE_CONTENT_ROWS_NAME,
|
|
@@ -9332,7 +9353,7 @@ rowMenuRegistry
|
|
|
9332
9353
|
isVisible: (env) => {
|
|
9333
9354
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
9334
9355
|
const selectedRows = env.model.getters.getElementsFromSelection("ROW");
|
|
9335
|
-
return env.model.getters.
|
|
9356
|
+
return !env.model.getters.checkElementsIncludeAllVisibleHeaders(sheetId, "ROW", selectedRows);
|
|
9336
9357
|
},
|
|
9337
9358
|
separator: true,
|
|
9338
9359
|
})
|
|
@@ -16178,11 +16199,13 @@ topbarMenuRegistry
|
|
|
16178
16199
|
name: REMOVE_ROWS_NAME,
|
|
16179
16200
|
sequence: 80,
|
|
16180
16201
|
action: REMOVE_ROWS_ACTION,
|
|
16202
|
+
isVisible: (env) => CAN_REMOVE_COLUMNS_ROWS("ROW", env),
|
|
16181
16203
|
})
|
|
16182
16204
|
.addChild("edit_delete_column", ["edit"], {
|
|
16183
16205
|
name: REMOVE_COLUMNS_NAME,
|
|
16184
16206
|
sequence: 90,
|
|
16185
16207
|
action: REMOVE_COLUMNS_ACTION,
|
|
16208
|
+
isVisible: (env) => CAN_REMOVE_COLUMNS_ROWS("COL", env),
|
|
16186
16209
|
})
|
|
16187
16210
|
.addChild("edit_delete_cell_shift_up", ["edit"], {
|
|
16188
16211
|
name: _lt("Delete cell and shift up"),
|
|
@@ -17495,6 +17518,11 @@ class LineConfigPanel extends LineBarPieConfigPanel {
|
|
|
17495
17518
|
aggregated: ev.target.checked,
|
|
17496
17519
|
});
|
|
17497
17520
|
}
|
|
17521
|
+
onUpdateCumulative(ev) {
|
|
17522
|
+
this.props.updateChart(this.props.figureId, {
|
|
17523
|
+
cumulative: ev.target.checked,
|
|
17524
|
+
});
|
|
17525
|
+
}
|
|
17498
17526
|
}
|
|
17499
17527
|
LineConfigPanel.template = "o-spreadsheet-LineConfigPanel";
|
|
17500
17528
|
|
|
@@ -18684,9 +18712,9 @@ class FindAndReplacePanel extends owl.Component {
|
|
|
18684
18712
|
}
|
|
18685
18713
|
setup() {
|
|
18686
18714
|
this.showFormulaState = this.env.model.getters.shouldShowFormulas();
|
|
18687
|
-
this.debouncedUpdateSearch = debounce(this.updateSearch.bind(this), 200);
|
|
18688
18715
|
owl.onMounted(() => this.focusInput());
|
|
18689
18716
|
owl.onWillUnmount(() => {
|
|
18717
|
+
clearTimeout(this.debounceTimeoutId);
|
|
18690
18718
|
this.env.model.dispatch("CLEAR_SEARCH");
|
|
18691
18719
|
this.env.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.showFormulaState });
|
|
18692
18720
|
});
|
|
@@ -18731,6 +18759,13 @@ class FindAndReplacePanel extends owl.Component {
|
|
|
18731
18759
|
searchOptions: this.state.searchOptions,
|
|
18732
18760
|
});
|
|
18733
18761
|
}
|
|
18762
|
+
debouncedUpdateSearch() {
|
|
18763
|
+
clearTimeout(this.debounceTimeoutId);
|
|
18764
|
+
this.debounceTimeoutId = setTimeout(() => {
|
|
18765
|
+
this.updateSearch();
|
|
18766
|
+
this.debounceTimeoutId = undefined;
|
|
18767
|
+
}, 200);
|
|
18768
|
+
}
|
|
18734
18769
|
replace() {
|
|
18735
18770
|
this.env.model.dispatch("REPLACE_SEARCH", {
|
|
18736
18771
|
replaceWith: this.state.replaceWith,
|
|
@@ -20854,9 +20889,11 @@ function useCellHovered(env, gridRef, callback) {
|
|
|
20854
20889
|
}
|
|
20855
20890
|
}
|
|
20856
20891
|
function updateMousePosition(e) {
|
|
20857
|
-
|
|
20858
|
-
|
|
20859
|
-
|
|
20892
|
+
if (gridRef.el === e.target) {
|
|
20893
|
+
x = e.offsetX;
|
|
20894
|
+
y = e.offsetY;
|
|
20895
|
+
lastMoved = Date.now();
|
|
20896
|
+
}
|
|
20860
20897
|
}
|
|
20861
20898
|
function recompute() {
|
|
20862
20899
|
const { col, row } = getPosition();
|
|
@@ -24969,6 +25006,7 @@ function convertChartData(chartData) {
|
|
|
24969
25006
|
legendPosition: chartData.legendPosition,
|
|
24970
25007
|
stacked: chartData.stacked || false,
|
|
24971
25008
|
aggregated: false,
|
|
25009
|
+
cumulative: chartData.cumulative || false,
|
|
24972
25010
|
labelsAsText: false,
|
|
24973
25011
|
};
|
|
24974
25012
|
}
|
|
@@ -29407,7 +29445,11 @@ class HeaderSizePlugin extends CorePlugin {
|
|
|
29407
29445
|
let sizes = [...this.sizes[cmd.sheetId][cmd.dimension]];
|
|
29408
29446
|
const addIndex = getAddHeaderStartIndex(cmd.position, cmd.base);
|
|
29409
29447
|
const baseSize = sizes[cmd.base];
|
|
29410
|
-
|
|
29448
|
+
const sizesToInsert = range(0, cmd.quantity).map(() => ({
|
|
29449
|
+
manualSize: baseSize.manualSize,
|
|
29450
|
+
computedSize: lazy(baseSize.computedSize()),
|
|
29451
|
+
}));
|
|
29452
|
+
sizes.splice(addIndex, 0, ...sizesToInsert);
|
|
29411
29453
|
sizes = sizes.map((size, row) => {
|
|
29412
29454
|
if (cmd.dimension === "ROW" && row > cmd.base + cmd.quantity) {
|
|
29413
29455
|
// invalidate sizes
|
|
@@ -29623,7 +29665,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
|
|
|
29623
29665
|
if (!this.getters.tryGetSheet(cmd.sheetId)) {
|
|
29624
29666
|
return 27 /* CommandResult.InvalidSheetId */;
|
|
29625
29667
|
}
|
|
29626
|
-
if (
|
|
29668
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
29627
29669
|
return 8 /* CommandResult.NotEnoughElements */;
|
|
29628
29670
|
}
|
|
29629
29671
|
return 0 /* CommandResult.Success */;
|
|
@@ -29673,9 +29715,9 @@ class HeaderVisibilityPlugin extends CorePlugin {
|
|
|
29673
29715
|
}
|
|
29674
29716
|
return;
|
|
29675
29717
|
}
|
|
29676
|
-
|
|
29718
|
+
checkElementsIncludeAllVisibleHeaders(sheetId, dimension, elements) {
|
|
29677
29719
|
const visibleHeaders = this.getAllVisibleHeaders(sheetId, dimension);
|
|
29678
|
-
return
|
|
29720
|
+
return includesAll(elements, visibleHeaders);
|
|
29679
29721
|
}
|
|
29680
29722
|
isRowHiddenByUser(sheetId, index) {
|
|
29681
29723
|
return this.hiddenHeaders[sheetId].ROW[index];
|
|
@@ -29771,7 +29813,7 @@ class HeaderVisibilityPlugin extends CorePlugin {
|
|
|
29771
29813
|
}
|
|
29772
29814
|
}
|
|
29773
29815
|
HeaderVisibilityPlugin.getters = [
|
|
29774
|
-
"
|
|
29816
|
+
"checkElementsIncludeAllVisibleHeaders",
|
|
29775
29817
|
"getHiddenColsGroups",
|
|
29776
29818
|
"getHiddenRowsGroups",
|
|
29777
29819
|
"isRowHiddenByUser",
|
|
@@ -30808,6 +30850,9 @@ class SheetPlugin extends CorePlugin {
|
|
|
30808
30850
|
if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
30809
30851
|
return 86 /* CommandResult.InvalidHeaderIndex */;
|
|
30810
30852
|
}
|
|
30853
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
30854
|
+
return 8 /* CommandResult.NotEnoughElements */;
|
|
30855
|
+
}
|
|
30811
30856
|
else {
|
|
30812
30857
|
return 0 /* CommandResult.Success */;
|
|
30813
30858
|
}
|
|
@@ -31094,6 +31139,20 @@ class SheetPlugin extends CorePlugin {
|
|
|
31094
31139
|
}
|
|
31095
31140
|
this.history.update("sheets", sheetId, "panes", panes);
|
|
31096
31141
|
}
|
|
31142
|
+
/**
|
|
31143
|
+
* Checks if all non-frozen header indices are present in the provided elements of selected rows/columns.
|
|
31144
|
+
* This validation ensures that all rows or columns cannot be deleted when frozen panes exist.
|
|
31145
|
+
*/
|
|
31146
|
+
checkElementsIncludeAllNonFrozenHeaders(sheetId, dimension, elements) {
|
|
31147
|
+
const paneDivisions = this.getters.getPaneDivisions(sheetId);
|
|
31148
|
+
const startIndex = dimension === "ROW" ? paneDivisions.ySplit : paneDivisions.xSplit;
|
|
31149
|
+
const endIndex = this.getters.getNumberHeaders(sheetId, dimension);
|
|
31150
|
+
if (!startIndex) {
|
|
31151
|
+
return false;
|
|
31152
|
+
}
|
|
31153
|
+
const indicesToCheck = range(startIndex, endIndex);
|
|
31154
|
+
return includesAll(elements, indicesToCheck);
|
|
31155
|
+
}
|
|
31097
31156
|
// ---------------------------------------------------------------------------
|
|
31098
31157
|
// Row/Col manipulation
|
|
31099
31158
|
// ---------------------------------------------------------------------------
|
|
@@ -31622,6 +31681,7 @@ SheetPlugin.getters = [
|
|
|
31622
31681
|
"getSheetSize",
|
|
31623
31682
|
"getSheetZone",
|
|
31624
31683
|
"getPaneDivisions",
|
|
31684
|
+
"checkElementsIncludeAllNonFrozenHeaders",
|
|
31625
31685
|
];
|
|
31626
31686
|
|
|
31627
31687
|
/**
|
|
@@ -32188,6 +32248,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
32188
32248
|
// stores the computed styles in the format of computedStyles.sheetName[col][row] = Style
|
|
32189
32249
|
this.computedStyles = {};
|
|
32190
32250
|
this.computedIcons = {};
|
|
32251
|
+
this.uuidGenerator = new UuidGenerator();
|
|
32191
32252
|
/**
|
|
32192
32253
|
* Execute the predicate to know if a conditional formatting rule should be applied to a cell
|
|
32193
32254
|
*/
|
|
@@ -32540,13 +32601,20 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
32540
32601
|
this.adaptRules(origin.sheetId, cf, [xc], toRemoveRange);
|
|
32541
32602
|
}
|
|
32542
32603
|
else {
|
|
32543
|
-
this.adaptRules(target.sheetId, cf, [xc], []);
|
|
32544
32604
|
this.adaptRules(origin.sheetId, cf, [], toRemoveRange);
|
|
32605
|
+
const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
|
|
32606
|
+
this.adaptRules(target.sheetId, cfToCopyTo, [xc], []);
|
|
32545
32607
|
}
|
|
32546
32608
|
}
|
|
32547
32609
|
}
|
|
32548
32610
|
}
|
|
32549
32611
|
}
|
|
32612
|
+
getCFToCopyTo(targetSheetId, originCF) {
|
|
32613
|
+
const cfInTarget = this.getters
|
|
32614
|
+
.getConditionalFormats(targetSheetId)
|
|
32615
|
+
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
32616
|
+
return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
|
|
32617
|
+
}
|
|
32550
32618
|
}
|
|
32551
32619
|
EvaluationConditionalFormatPlugin.getters = ["getConditionalIcon", "getCellComputedStyle"];
|
|
32552
32620
|
|
|
@@ -32894,30 +32962,26 @@ class InternalViewport {
|
|
|
32894
32962
|
const { end } = this.getters.getColDimensions(sheetId, targetCol);
|
|
32895
32963
|
const maxCol = this.getters.getNumberCols(sheetId);
|
|
32896
32964
|
if (this.offsetX + this.offsetCorrectionX + this.viewportWidth < end) {
|
|
32897
|
-
|
|
32898
|
-
|
|
32899
|
-
|
|
32900
|
-
}
|
|
32901
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
32902
|
-
continue;
|
|
32903
|
-
}
|
|
32904
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).end - this.offsetCorrectionX;
|
|
32905
|
-
this.offsetScrollbarX = this.offsetX;
|
|
32906
|
-
this.adjustViewportZoneX();
|
|
32965
|
+
let finalTarget = targetCol;
|
|
32966
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol < maxCol) {
|
|
32967
|
+
finalTarget++;
|
|
32907
32968
|
}
|
|
32969
|
+
const finalTargetEnd = this.getters.getColDimensions(sheetId, finalTarget).end;
|
|
32970
|
+
const startIndex = this.searchHeaderIndex("COL", finalTargetEnd - this.viewportWidth - this.offsetCorrectionX, this.boundaries.left, true);
|
|
32971
|
+
this.offsetX =
|
|
32972
|
+
this.getters.getColDimensions(sheetId, startIndex).end - this.offsetCorrectionX;
|
|
32973
|
+
this.offsetScrollbarX = this.offsetX;
|
|
32974
|
+
this.adjustViewportZoneX();
|
|
32908
32975
|
}
|
|
32909
32976
|
else if (this.left > targetCol) {
|
|
32910
|
-
|
|
32911
|
-
|
|
32912
|
-
|
|
32913
|
-
}
|
|
32914
|
-
if (this.getters.isColHidden(sheetId, col)) {
|
|
32915
|
-
continue;
|
|
32916
|
-
}
|
|
32917
|
-
this.offsetX = this.getters.getColDimensions(sheetId, col).start - this.offsetCorrectionX;
|
|
32918
|
-
this.offsetScrollbarX = this.offsetX;
|
|
32919
|
-
this.adjustViewportZoneX();
|
|
32977
|
+
let finalTarget = targetCol;
|
|
32978
|
+
while (this.getters.isColHidden(sheetId, finalTarget) && targetCol > 0) {
|
|
32979
|
+
finalTarget--;
|
|
32920
32980
|
}
|
|
32981
|
+
this.offsetX =
|
|
32982
|
+
this.getters.getColDimensions(sheetId, finalTarget).start - this.offsetCorrectionX;
|
|
32983
|
+
this.offsetScrollbarX = this.offsetX;
|
|
32984
|
+
this.adjustViewportZoneX();
|
|
32921
32985
|
}
|
|
32922
32986
|
}
|
|
32923
32987
|
adjustPositionY(targetRow) {
|
|
@@ -32925,30 +32989,26 @@ class InternalViewport {
|
|
|
32925
32989
|
const { end } = this.getters.getRowDimensions(sheetId, targetRow);
|
|
32926
32990
|
const maxRow = this.getters.getNumberRows(sheetId);
|
|
32927
32991
|
if (this.offsetY + this.viewportHeight + this.offsetCorrectionY < end) {
|
|
32928
|
-
|
|
32929
|
-
|
|
32930
|
-
|
|
32931
|
-
}
|
|
32932
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
32933
|
-
continue;
|
|
32934
|
-
}
|
|
32935
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).end - this.offsetCorrectionY;
|
|
32936
|
-
this.offsetScrollbarY = this.offsetY;
|
|
32937
|
-
this.adjustViewportZoneY();
|
|
32992
|
+
let finalTarget = targetRow;
|
|
32993
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow < maxRow) {
|
|
32994
|
+
finalTarget++;
|
|
32938
32995
|
}
|
|
32996
|
+
const finalTargetEnd = this.getters.getRowDimensions(sheetId, finalTarget).end;
|
|
32997
|
+
const startIndex = this.searchHeaderIndex("ROW", finalTargetEnd - this.viewportHeight - this.offsetCorrectionY, this.boundaries.top, true);
|
|
32998
|
+
this.offsetY =
|
|
32999
|
+
this.getters.getRowDimensions(sheetId, startIndex).end - this.offsetCorrectionY;
|
|
33000
|
+
this.offsetScrollbarY = this.offsetY;
|
|
33001
|
+
this.adjustViewportZoneY();
|
|
32939
33002
|
}
|
|
32940
33003
|
else if (this.top > targetRow) {
|
|
32941
|
-
|
|
32942
|
-
|
|
32943
|
-
|
|
32944
|
-
}
|
|
32945
|
-
if (this.getters.isRowHidden(sheetId, row)) {
|
|
32946
|
-
continue;
|
|
32947
|
-
}
|
|
32948
|
-
this.offsetY = this.getters.getRowDimensions(sheetId, row).start - this.offsetCorrectionY;
|
|
32949
|
-
this.offsetScrollbarY = this.offsetY;
|
|
32950
|
-
this.adjustViewportZoneY();
|
|
33004
|
+
let finalTarget = targetRow;
|
|
33005
|
+
while (this.getters.isRowHidden(sheetId, finalTarget) && targetRow > 0) {
|
|
33006
|
+
finalTarget--;
|
|
32951
33007
|
}
|
|
33008
|
+
this.offsetY =
|
|
33009
|
+
this.getters.getRowDimensions(sheetId, finalTarget).start - this.offsetCorrectionY;
|
|
33010
|
+
this.offsetScrollbarY = this.offsetY;
|
|
33011
|
+
this.adjustViewportZoneY();
|
|
32952
33012
|
}
|
|
32953
33013
|
}
|
|
32954
33014
|
setViewportOffset(offsetX, offsetY) {
|
|
@@ -33068,6 +33128,9 @@ class InternalViewport {
|
|
|
33068
33128
|
const sheetId = this.sheetId;
|
|
33069
33129
|
this.left = this.searchHeaderIndex("COL", this.offsetScrollbarX, this.boundaries.left);
|
|
33070
33130
|
this.right = Math.min(this.boundaries.right, this.searchHeaderIndex("COL", this.viewportWidth, this.left));
|
|
33131
|
+
if (this.left === -1) {
|
|
33132
|
+
this.left = this.boundaries.left;
|
|
33133
|
+
}
|
|
33071
33134
|
if (this.right === -1) {
|
|
33072
33135
|
this.right = this.getters.getNumberCols(sheetId) - 1;
|
|
33073
33136
|
}
|
|
@@ -33081,6 +33144,9 @@ class InternalViewport {
|
|
|
33081
33144
|
const sheetId = this.sheetId;
|
|
33082
33145
|
this.top = this.searchHeaderIndex("ROW", this.offsetScrollbarY, this.boundaries.top);
|
|
33083
33146
|
this.bottom = Math.min(this.boundaries.bottom, this.searchHeaderIndex("ROW", this.viewportHeight, this.top));
|
|
33147
|
+
if (this.top === -1) {
|
|
33148
|
+
this.top = this.boundaries.top;
|
|
33149
|
+
}
|
|
33084
33150
|
if (this.bottom === -1) {
|
|
33085
33151
|
this.bottom = this.getters.getNumberRows(sheetId) - 1;
|
|
33086
33152
|
}
|
|
@@ -34517,14 +34583,10 @@ class FindAndReplacePlugin extends UIPlugin {
|
|
|
34517
34583
|
case "REPLACE_ALL_SEARCH":
|
|
34518
34584
|
this.replaceAll(cmd.replaceWith);
|
|
34519
34585
|
break;
|
|
34520
|
-
case "EVALUATE_CELLS":
|
|
34521
|
-
case "UPDATE_CELL":
|
|
34522
|
-
case "REMOVE_FILTER_TABLE":
|
|
34523
|
-
case "UPDATE_FILTER":
|
|
34524
|
-
this.isSearchDirty = true;
|
|
34525
|
-
break;
|
|
34526
34586
|
case "UNDO":
|
|
34527
34587
|
case "REDO":
|
|
34588
|
+
case "REMOVE_FILTER_TABLE":
|
|
34589
|
+
case "UPDATE_FILTER":
|
|
34528
34590
|
case "REMOVE_COLUMNS_ROWS":
|
|
34529
34591
|
case "HIDE_COLUMNS_ROWS":
|
|
34530
34592
|
case "UNHIDE_COLUMNS_ROWS":
|
|
@@ -37524,7 +37586,7 @@ class ClipboardCellsState extends ClipboardCellsAbstractState {
|
|
|
37524
37586
|
});
|
|
37525
37587
|
for (const filterTable of this.copiedTables) {
|
|
37526
37588
|
this.dispatch("REMOVE_FILTER_TABLE", {
|
|
37527
|
-
sheetId: this.
|
|
37589
|
+
sheetId: this.sheetId,
|
|
37528
37590
|
target: [filterTable.zone],
|
|
37529
37591
|
});
|
|
37530
37592
|
}
|
|
@@ -38002,7 +38064,7 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
38002
38064
|
allowDispatch(cmd) {
|
|
38003
38065
|
switch (cmd.type) {
|
|
38004
38066
|
case "CUT":
|
|
38005
|
-
const zones =
|
|
38067
|
+
const zones = this.getters.getSelectedZones();
|
|
38006
38068
|
const state = this.getClipboardState(zones, cmd.type);
|
|
38007
38069
|
return state.isCutAllowed(zones);
|
|
38008
38070
|
case "PASTE":
|
|
@@ -38033,7 +38095,7 @@ class ClipboardPlugin extends UIPlugin {
|
|
|
38033
38095
|
switch (cmd.type) {
|
|
38034
38096
|
case "COPY":
|
|
38035
38097
|
case "CUT":
|
|
38036
|
-
const zones =
|
|
38098
|
+
const zones = this.getters.getSelectedZones();
|
|
38037
38099
|
this.state = this.getClipboardState(zones, cmd.type);
|
|
38038
38100
|
this.status = "visible";
|
|
38039
38101
|
break;
|
|
@@ -39413,26 +39475,24 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
39413
39475
|
const isBasedBefore = cmd.base < start;
|
|
39414
39476
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
39415
39477
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
39416
|
-
|
|
39417
|
-
|
|
39418
|
-
|
|
39419
|
-
|
|
39420
|
-
|
|
39421
|
-
|
|
39422
|
-
|
|
39423
|
-
|
|
39424
|
-
|
|
39425
|
-
|
|
39426
|
-
|
|
39427
|
-
|
|
39428
|
-
|
|
39429
|
-
|
|
39430
|
-
|
|
39431
|
-
|
|
39432
|
-
|
|
39433
|
-
|
|
39434
|
-
],
|
|
39435
|
-
});
|
|
39478
|
+
const target = [
|
|
39479
|
+
{
|
|
39480
|
+
left: isCol ? start + deltaCol : 0,
|
|
39481
|
+
right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
39482
|
+
top: !isCol ? start + deltaRow : 0,
|
|
39483
|
+
bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
39484
|
+
},
|
|
39485
|
+
];
|
|
39486
|
+
const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
|
|
39487
|
+
const pasteTarget = [
|
|
39488
|
+
{
|
|
39489
|
+
left: isCol ? cmd.base : 0,
|
|
39490
|
+
right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
39491
|
+
top: !isCol ? cmd.base : 0,
|
|
39492
|
+
bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
39493
|
+
},
|
|
39494
|
+
];
|
|
39495
|
+
state.paste(pasteTarget, { selectTarget: true });
|
|
39436
39496
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
39437
39497
|
let currentIndex = cmd.base;
|
|
39438
39498
|
for (const element of toRemove) {
|
|
@@ -45400,6 +45460,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
45400
45460
|
exports.tokenize = tokenize;
|
|
45401
45461
|
|
|
45402
45462
|
|
|
45403
|
-
__info__.version = '16.2.
|
|
45404
|
-
__info__.date = '2023-
|
|
45405
|
-
__info__.hash = '
|
|
45463
|
+
__info__.version = '16.2.17';
|
|
45464
|
+
__info__.date = '2023-10-03T12:42:54.642Z';
|
|
45465
|
+
__info__.hash = '146867a';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -466,6 +466,7 @@ interface LineChartDefinition {
|
|
|
466
466
|
readonly labelsAsText: boolean;
|
|
467
467
|
readonly stacked: boolean;
|
|
468
468
|
readonly aggregated?: boolean;
|
|
469
|
+
readonly cumulative: boolean;
|
|
469
470
|
}
|
|
470
471
|
type LineChartRuntime = {
|
|
471
472
|
chartJsConfig: ChartConfiguration;
|
|
@@ -532,6 +533,7 @@ interface ExcelChartDefinition {
|
|
|
532
533
|
readonly verticalAxisPosition: VerticalAxisPosition;
|
|
533
534
|
readonly legendPosition: LegendPosition;
|
|
534
535
|
readonly stacked?: boolean;
|
|
536
|
+
readonly cumulative?: boolean;
|
|
535
537
|
}
|
|
536
538
|
interface ChartCreationContext {
|
|
537
539
|
readonly range?: string[];
|
|
@@ -1680,8 +1682,6 @@ interface CopyCommand {
|
|
|
1680
1682
|
}
|
|
1681
1683
|
interface CutCommand {
|
|
1682
1684
|
type: "CUT";
|
|
1683
|
-
/** Zones to cut. If none were given, will copy the zones in the selection*/
|
|
1684
|
-
target?: Zone[];
|
|
1685
1685
|
}
|
|
1686
1686
|
interface PasteCommand {
|
|
1687
1687
|
type: "PASTE";
|
|
@@ -3389,11 +3389,11 @@ declare class HeaderSizePlugin extends CorePlugin<HeaderSizeState> implements He
|
|
|
3389
3389
|
}
|
|
3390
3390
|
|
|
3391
3391
|
declare class HeaderVisibilityPlugin extends CorePlugin {
|
|
3392
|
-
static getters: readonly ["
|
|
3392
|
+
static getters: readonly ["checkElementsIncludeAllVisibleHeaders", "getHiddenColsGroups", "getHiddenRowsGroups", "isRowHiddenByUser", "isColHiddenByUser"];
|
|
3393
3393
|
private readonly hiddenHeaders;
|
|
3394
3394
|
allowDispatch(cmd: Command): CommandResult.Success | CommandResult.NotEnoughElements | CommandResult.InvalidSheetId | CommandResult.TooManyHiddenElements | CommandResult.InvalidHeaderIndex;
|
|
3395
3395
|
handle(cmd: Command): void;
|
|
3396
|
-
|
|
3396
|
+
checkElementsIncludeAllVisibleHeaders(sheetId: UID, dimension: Dimension, elements: HeaderIndex[]): boolean;
|
|
3397
3397
|
isRowHiddenByUser(sheetId: UID, index: HeaderIndex): boolean;
|
|
3398
3398
|
isColHiddenByUser(sheetId: UID, index: HeaderIndex): boolean;
|
|
3399
3399
|
getHiddenColsGroups(sheetId: UID): ConsecutiveIndexes[];
|
|
@@ -3516,7 +3516,7 @@ interface SheetState$1 {
|
|
|
3516
3516
|
readonly cellPosition: Record<UID, CellPosition | undefined>;
|
|
3517
3517
|
}
|
|
3518
3518
|
declare class SheetPlugin extends CorePlugin<SheetState$1> implements SheetState$1 {
|
|
3519
|
-
static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "getCell", "getCellPosition", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "isEmpty", "getSheetSize", "getSheetZone", "getPaneDivisions"];
|
|
3519
|
+
static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "getCell", "getCellPosition", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "isEmpty", "getSheetSize", "getSheetZone", "getPaneDivisions", "checkElementsIncludeAllNonFrozenHeaders"];
|
|
3520
3520
|
readonly sheetIdsMapName: Record<string, UID | undefined>;
|
|
3521
3521
|
readonly orderedSheetIds: UID[];
|
|
3522
3522
|
readonly sheets: Record<UID, Sheet | undefined>;
|
|
@@ -3558,6 +3558,11 @@ declare class SheetPlugin extends CorePlugin<SheetState$1> implements SheetState
|
|
|
3558
3558
|
getSheetZone(sheetId: UID): Zone;
|
|
3559
3559
|
getPaneDivisions(sheetId: UID): Readonly<PaneDivision>;
|
|
3560
3560
|
private setPaneDivisions;
|
|
3561
|
+
/**
|
|
3562
|
+
* Checks if all non-frozen header indices are present in the provided elements of selected rows/columns.
|
|
3563
|
+
* This validation ensures that all rows or columns cannot be deleted when frozen panes exist.
|
|
3564
|
+
*/
|
|
3565
|
+
checkElementsIncludeAllNonFrozenHeaders(sheetId: UID, dimension: Dimension, elements: HeaderIndex[]): boolean;
|
|
3561
3566
|
/**
|
|
3562
3567
|
* Check if a zone only contains empty cells
|
|
3563
3568
|
*/
|
|
@@ -3742,6 +3747,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
3742
3747
|
private isStale;
|
|
3743
3748
|
private computedStyles;
|
|
3744
3749
|
private computedIcons;
|
|
3750
|
+
private uuidGenerator;
|
|
3745
3751
|
handle(cmd: Command): void;
|
|
3746
3752
|
finalize(): void;
|
|
3747
3753
|
getCellComputedStyle(position: CellPosition): Style;
|
|
@@ -3772,6 +3778,7 @@ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
3772
3778
|
*/
|
|
3773
3779
|
private adaptRules;
|
|
3774
3780
|
private pasteCf;
|
|
3781
|
+
private getCFToCopyTo;
|
|
3775
3782
|
}
|
|
3776
3783
|
|
|
3777
3784
|
declare class FilterEvaluationPlugin extends UIPlugin {
|
|
@@ -5137,6 +5144,7 @@ declare class LineConfigPanel extends LineBarPieConfigPanel {
|
|
|
5137
5144
|
onUpdateLabelsAsText(ev: any): void;
|
|
5138
5145
|
onUpdateStacked(ev: any): void;
|
|
5139
5146
|
onUpdateAggregated(ev: any): void;
|
|
5147
|
+
onUpdateCumulative(ev: any): void;
|
|
5140
5148
|
}
|
|
5141
5149
|
|
|
5142
5150
|
interface Props$v {
|