@odoo/o-spreadsheet 16.4.5 → 16.4.7
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 +200 -54
- package/dist/o-spreadsheet.d.ts +11 -5
- package/dist/o-spreadsheet.esm.js +200 -54
- package/dist/o-spreadsheet.iife.js +200 -54
- package/dist/o-spreadsheet.iife.min.js +257 -256
- package/package.json +1 -1
|
@@ -611,13 +611,17 @@
|
|
|
611
611
|
return position === "after" ? base + 1 : base;
|
|
612
612
|
}
|
|
613
613
|
/**
|
|
614
|
-
*
|
|
614
|
+
* Compares two objects.
|
|
615
615
|
*/
|
|
616
616
|
function deepEquals(o1, o2) {
|
|
617
617
|
if (o1 === o2)
|
|
618
618
|
return true;
|
|
619
619
|
if ((o1 && !o2) || (o2 && !o1))
|
|
620
620
|
return false;
|
|
621
|
+
if (typeof o1 !== typeof o2)
|
|
622
|
+
return false;
|
|
623
|
+
if (typeof o1 !== "object")
|
|
624
|
+
return o1 === o2;
|
|
621
625
|
// Objects can have different keys if the values are undefined
|
|
622
626
|
const keys = new Set();
|
|
623
627
|
Object.keys(o1).forEach((key) => keys.add(key));
|
|
@@ -5262,6 +5266,7 @@
|
|
|
5262
5266
|
padding: 10px;
|
|
5263
5267
|
width: ${ERROR_TOOLTIP_WIDTH}px;
|
|
5264
5268
|
box-sizing: border-box !important;
|
|
5269
|
+
overflow-wrap: break-word;
|
|
5265
5270
|
}
|
|
5266
5271
|
`;
|
|
5267
5272
|
class ErrorToolTip extends owl.Component {
|
|
@@ -15117,13 +15122,42 @@
|
|
|
15117
15122
|
}
|
|
15118
15123
|
return true;
|
|
15119
15124
|
}
|
|
15120
|
-
/**
|
|
15125
|
+
/**
|
|
15126
|
+
* Change a content string from the given locale to its canonical form (en_US locale). Don't convert date string.
|
|
15127
|
+
*
|
|
15128
|
+
* @example
|
|
15129
|
+
* canonicalizeNumberContent("=SUM(1,5; 02/12/2012)", FR_LOCALE) // "=SUM(1.5, 02/12/2012)"
|
|
15130
|
+
* canonicalizeNumberContent("125,9", FR_LOCALE) // "125.9"
|
|
15131
|
+
* canonicalizeNumberContent("02/12/2012", FR_LOCALE) // "02/12/2012"
|
|
15132
|
+
*/
|
|
15133
|
+
function canonicalizeNumberContent(content, locale) {
|
|
15134
|
+
return content.startsWith("=")
|
|
15135
|
+
? canonicalizeFormula$1(content, locale)
|
|
15136
|
+
: canonicalizeNumberLiteral(content, locale);
|
|
15137
|
+
}
|
|
15138
|
+
/**
|
|
15139
|
+
* Change a content string from the given locale to its canonical form (en_US locale). Also convert date string.
|
|
15140
|
+
* This is destructive and won't preserve the original format.
|
|
15141
|
+
*
|
|
15142
|
+
* @example
|
|
15143
|
+
* canonicalizeContent("=SUM(1,5; 5)", FR_LOCALE) // "=SUM(1.5, 5)"
|
|
15144
|
+
* canonicalizeContent("125,9", FR_LOCALE) // "125.9"
|
|
15145
|
+
* canonicalizeContent("02/12/2012", FR_LOCALE) // "12/02/2012"
|
|
15146
|
+
* canonicalizeContent("02-12-2012", FR_LOCALE) // "12/02/2012"
|
|
15147
|
+
*/
|
|
15121
15148
|
function canonicalizeContent(content, locale) {
|
|
15122
15149
|
return content.startsWith("=")
|
|
15123
15150
|
? canonicalizeFormula$1(content, locale)
|
|
15124
|
-
:
|
|
15151
|
+
: canonicalizeLiteral(content, locale);
|
|
15125
15152
|
}
|
|
15126
|
-
/**
|
|
15153
|
+
/**
|
|
15154
|
+
* Change a content string from its canonical form (en_US locale) to the given locale. Also convert date string.
|
|
15155
|
+
*
|
|
15156
|
+
* @example
|
|
15157
|
+
* localizeContent("=SUM(1.5, 5)", FR_LOCALE) // "=SUM(1,5; 5)"
|
|
15158
|
+
* localizeContent("125.9", FR_LOCALE) // "125,9"
|
|
15159
|
+
* localizeContent("12/02/2012", FR_LOCALE) // "02/12/2012"
|
|
15160
|
+
*/
|
|
15127
15161
|
function localizeContent(content, locale) {
|
|
15128
15162
|
return content.startsWith("=")
|
|
15129
15163
|
? localizeFormula(content, locale)
|
|
@@ -15158,24 +15192,75 @@
|
|
|
15158
15192
|
return localizedFormula;
|
|
15159
15193
|
}
|
|
15160
15194
|
/**
|
|
15161
|
-
*
|
|
15195
|
+
* Change a literal string from the given locale to its canonical form (en_US locale). Don't convert date string.
|
|
15196
|
+
*
|
|
15197
|
+
* @example
|
|
15198
|
+
* canonicalizeNumberLiteral("125,9", FR_LOCALE) // "125.9"
|
|
15199
|
+
* canonicalizeNumberLiteral("02/12/2012", FR_LOCALE) // "02/12/2012"
|
|
15162
15200
|
*/
|
|
15163
|
-
function
|
|
15201
|
+
function canonicalizeNumberLiteral(content, locale) {
|
|
15164
15202
|
if (locale.decimalSeparator === "." || !isNumber(content, locale)) {
|
|
15165
15203
|
return content;
|
|
15166
15204
|
}
|
|
15167
15205
|
return content.replace(locale.decimalSeparator, ".");
|
|
15168
15206
|
}
|
|
15169
|
-
|
|
15170
|
-
|
|
15171
|
-
|
|
15207
|
+
/**
|
|
15208
|
+
* Change a content string from the given locale to its canonical form (en_US locale). Also convert date string.
|
|
15209
|
+
* This is destructive and won't preserve the original format.
|
|
15210
|
+
*
|
|
15211
|
+
* @example
|
|
15212
|
+
* canonicalizeLiteral("125,9", FR_LOCALE) // "125.9"
|
|
15213
|
+
* canonicalizeLiteral("02/12/2012", FR_LOCALE) // "12/02/2012"
|
|
15214
|
+
* canonicalizeLiteral("02-12-2012", FR_LOCALE) // "12/02/2012"
|
|
15215
|
+
*/
|
|
15216
|
+
function canonicalizeLiteral(content, locale) {
|
|
15217
|
+
if (isDateTime(content, locale)) {
|
|
15218
|
+
const dateNumber = toNumber(content, locale);
|
|
15219
|
+
let format = DEFAULT_LOCALE.dateFormat;
|
|
15220
|
+
if (!Number.isInteger(dateNumber)) {
|
|
15221
|
+
format += " " + DEFAULT_LOCALE.timeFormat;
|
|
15222
|
+
}
|
|
15223
|
+
return formatValue(dateNumber, { locale: DEFAULT_LOCALE, format });
|
|
15224
|
+
}
|
|
15225
|
+
return canonicalizeNumberLiteral(content, locale);
|
|
15226
|
+
}
|
|
15227
|
+
/**
|
|
15228
|
+
* Change a literal string from its canonical form (en_US locale) to the given locale. Don't convert date string.
|
|
15229
|
+
* This is destructive and won't preserve the original format.
|
|
15230
|
+
*
|
|
15231
|
+
* @example
|
|
15232
|
+
* localizeNumberLiteral("125.9", FR_LOCALE) // "125,9"
|
|
15233
|
+
* localizeNumberLiteral("12/02/2012", FR_LOCALE) // "12/02/2012"
|
|
15234
|
+
* localizeNumberLiteral("12-02-2012", FR_LOCALE) // "12/02/2012"
|
|
15235
|
+
*/
|
|
15236
|
+
function localizeNumberLiteral(literal, locale) {
|
|
15237
|
+
if (locale.decimalSeparator === "." || !isNumber(literal, DEFAULT_LOCALE)) {
|
|
15238
|
+
return literal;
|
|
15172
15239
|
}
|
|
15173
15240
|
const decimalNumberRegex = getDecimalNumberRegex(DEFAULT_LOCALE);
|
|
15174
|
-
const localized =
|
|
15241
|
+
const localized = literal.replace(decimalNumberRegex, (match) => {
|
|
15175
15242
|
return match.replace(".", locale.decimalSeparator);
|
|
15176
15243
|
});
|
|
15177
15244
|
return localized;
|
|
15178
15245
|
}
|
|
15246
|
+
/**
|
|
15247
|
+
* Change a literal string from its canonical form (en_US locale) to the given locale. Also convert date string.
|
|
15248
|
+
*
|
|
15249
|
+
* @example
|
|
15250
|
+
* localizeLiteral("125.9", FR_LOCALE) // "125,9"
|
|
15251
|
+
* localizeLiteral("12/02/2012", FR_LOCALE) // "02/12/2012"
|
|
15252
|
+
*/
|
|
15253
|
+
function localizeLiteral(literal, locale) {
|
|
15254
|
+
if (isDateTime(literal, DEFAULT_LOCALE)) {
|
|
15255
|
+
const dateNumber = toNumber(literal, DEFAULT_LOCALE);
|
|
15256
|
+
let format = locale.dateFormat;
|
|
15257
|
+
if (!Number.isInteger(dateNumber)) {
|
|
15258
|
+
format += " " + locale.timeFormat;
|
|
15259
|
+
}
|
|
15260
|
+
return formatValue(dateNumber, { locale, format });
|
|
15261
|
+
}
|
|
15262
|
+
return localizeNumberLiteral(literal, locale);
|
|
15263
|
+
}
|
|
15179
15264
|
function canonicalizeCFRule(cf, locale) {
|
|
15180
15265
|
return changeCFRuleLocale(cf, (content) => canonicalizeContent(content, locale));
|
|
15181
15266
|
}
|
|
@@ -15532,7 +15617,9 @@
|
|
|
15532
15617
|
save() {
|
|
15533
15618
|
const { col, row } = this.props.cellPosition;
|
|
15534
15619
|
const locale = this.env.model.getters.getLocale();
|
|
15535
|
-
const label = this.link.label
|
|
15620
|
+
const label = this.link.label
|
|
15621
|
+
? canonicalizeNumberContent(this.link.label, locale)
|
|
15622
|
+
: this.link.url;
|
|
15536
15623
|
this.env.model.dispatch("UPDATE_CELL", {
|
|
15537
15624
|
col: col,
|
|
15538
15625
|
row: row,
|
|
@@ -16875,6 +16962,7 @@
|
|
|
16875
16962
|
aggregated;
|
|
16876
16963
|
type = "line";
|
|
16877
16964
|
dataSetsHaveTitle;
|
|
16965
|
+
cumulative;
|
|
16878
16966
|
constructor(definition, sheetId, getters) {
|
|
16879
16967
|
super(definition, sheetId, getters);
|
|
16880
16968
|
this.dataSets = createDataSets(this.getters, definition.dataSets, sheetId, definition.dataSetsHaveTitle);
|
|
@@ -16886,6 +16974,7 @@
|
|
|
16886
16974
|
this.stacked = definition.stacked;
|
|
16887
16975
|
this.aggregated = definition.aggregated;
|
|
16888
16976
|
this.dataSetsHaveTitle = definition.dataSetsHaveTitle;
|
|
16977
|
+
this.cumulative = definition.cumulative;
|
|
16889
16978
|
}
|
|
16890
16979
|
static validateChartDefinition(validator, definition) {
|
|
16891
16980
|
return validator.checkValidations(definition, checkDataset, checkLabelRange);
|
|
@@ -16906,6 +16995,7 @@
|
|
|
16906
16995
|
labelRange: context.auxiliaryRange || undefined,
|
|
16907
16996
|
stacked: false,
|
|
16908
16997
|
aggregated: false,
|
|
16998
|
+
cumulative: false,
|
|
16909
16999
|
};
|
|
16910
17000
|
}
|
|
16911
17001
|
getDefinition() {
|
|
@@ -16926,6 +17016,7 @@
|
|
|
16926
17016
|
labelsAsText: this.labelsAsText,
|
|
16927
17017
|
stacked: this.stacked,
|
|
16928
17018
|
aggregated: this.aggregated,
|
|
17019
|
+
cumulative: this.cumulative,
|
|
16929
17020
|
};
|
|
16930
17021
|
}
|
|
16931
17022
|
getContextCreation() {
|
|
@@ -17136,6 +17227,16 @@
|
|
|
17136
17227
|
if (chart.stacked) {
|
|
17137
17228
|
backgroundRGBA.a = LINE_FILL_TRANSPARENCY;
|
|
17138
17229
|
}
|
|
17230
|
+
if (chart.cumulative) {
|
|
17231
|
+
let accumulator = 0;
|
|
17232
|
+
data = data.map((value) => {
|
|
17233
|
+
if (!isNaN(value)) {
|
|
17234
|
+
accumulator += parseFloat(value);
|
|
17235
|
+
return accumulator;
|
|
17236
|
+
}
|
|
17237
|
+
return value;
|
|
17238
|
+
});
|
|
17239
|
+
}
|
|
17139
17240
|
const backgroundColor = rgbaToHex(backgroundRGBA);
|
|
17140
17241
|
const dataset = {
|
|
17141
17242
|
label,
|
|
@@ -18010,6 +18111,7 @@
|
|
|
18010
18111
|
labelsAsText: false,
|
|
18011
18112
|
stacked: false,
|
|
18012
18113
|
aggregated: false,
|
|
18114
|
+
cumulative: false,
|
|
18013
18115
|
labelRange: labelRangeXc,
|
|
18014
18116
|
type: "line",
|
|
18015
18117
|
dataSetsHaveTitle,
|
|
@@ -18173,6 +18275,13 @@
|
|
|
18173
18275
|
elements: rows,
|
|
18174
18276
|
});
|
|
18175
18277
|
};
|
|
18278
|
+
const CAN_REMOVE_COLUMNS_ROWS = (dimension, env) => {
|
|
18279
|
+
const sheetId = env.model.getters.getActiveSheetId();
|
|
18280
|
+
const selectedElements = env.model.getters.getElementsFromSelection(dimension);
|
|
18281
|
+
const includesAllVisibleHeaders = env.model.getters.checkElementsIncludeAllVisibleHeaders(sheetId, dimension, selectedElements);
|
|
18282
|
+
const includesAllNonFrozenHeaders = env.model.getters.checkElementsIncludeAllNonFrozenHeaders(sheetId, dimension, selectedElements);
|
|
18283
|
+
return !includesAllVisibleHeaders && !includesAllNonFrozenHeaders;
|
|
18284
|
+
};
|
|
18176
18285
|
const REMOVE_COLUMNS_NAME = (env) => {
|
|
18177
18286
|
if (env.model.getters.getSelectedZones().length > 1) {
|
|
18178
18287
|
return _lt("Delete columns");
|
|
@@ -18197,7 +18306,7 @@
|
|
|
18197
18306
|
const NOT_ALL_VISIBLE_ROWS_SELECTED = (env) => {
|
|
18198
18307
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
18199
18308
|
const selectedRows = env.model.getters.getElementsFromSelection("ROW");
|
|
18200
|
-
return env.model.getters.
|
|
18309
|
+
return !env.model.getters.checkElementsIncludeAllVisibleHeaders(sheetId, "ROW", selectedRows);
|
|
18201
18310
|
};
|
|
18202
18311
|
const REMOVE_COLUMNS_ACTION = (env) => {
|
|
18203
18312
|
let columns = [...env.model.getters.getActiveCols()];
|
|
@@ -18216,7 +18325,7 @@
|
|
|
18216
18325
|
const NOT_ALL_VISIBLE_COLS_SELECTED = (env) => {
|
|
18217
18326
|
const sheetId = env.model.getters.getActiveSheetId();
|
|
18218
18327
|
const selectedCols = env.model.getters.getElementsFromSelection("COL");
|
|
18219
|
-
return env.model.getters.
|
|
18328
|
+
return !env.model.getters.checkElementsIncludeAllVisibleHeaders(sheetId, "COL", selectedCols);
|
|
18220
18329
|
};
|
|
18221
18330
|
const INSERT_ROWS_BEFORE_ACTION = (env) => {
|
|
18222
18331
|
const activeRows = env.model.getters.getActiveRows();
|
|
@@ -18488,7 +18597,7 @@
|
|
|
18488
18597
|
const deleteRows = {
|
|
18489
18598
|
name: REMOVE_ROWS_NAME,
|
|
18490
18599
|
execute: REMOVE_ROWS_ACTION,
|
|
18491
|
-
isVisible:
|
|
18600
|
+
isVisible: (env) => CAN_REMOVE_COLUMNS_ROWS("ROW", env),
|
|
18492
18601
|
};
|
|
18493
18602
|
const deleteRow = {
|
|
18494
18603
|
...deleteRows,
|
|
@@ -18501,7 +18610,7 @@
|
|
|
18501
18610
|
const deleteCols = {
|
|
18502
18611
|
name: REMOVE_COLUMNS_NAME,
|
|
18503
18612
|
execute: REMOVE_COLUMNS_ACTION,
|
|
18504
|
-
isVisible:
|
|
18613
|
+
isVisible: (env) => CAN_REMOVE_COLUMNS_ROWS("COL", env),
|
|
18505
18614
|
};
|
|
18506
18615
|
const deleteCol = {
|
|
18507
18616
|
...deleteCols,
|
|
@@ -21476,6 +21585,11 @@
|
|
|
21476
21585
|
aggregated: ev.target.checked,
|
|
21477
21586
|
});
|
|
21478
21587
|
}
|
|
21588
|
+
onUpdateCumulative(ev) {
|
|
21589
|
+
this.props.updateChart(this.props.figureId, {
|
|
21590
|
+
cumulative: ev.target.checked,
|
|
21591
|
+
});
|
|
21592
|
+
}
|
|
21479
21593
|
}
|
|
21480
21594
|
|
|
21481
21595
|
class LineChartDesignPanel extends LineBarPieDesignPanel {
|
|
@@ -25275,9 +25389,11 @@
|
|
|
25275
25389
|
}
|
|
25276
25390
|
}
|
|
25277
25391
|
function updateMousePosition(e) {
|
|
25278
|
-
|
|
25279
|
-
|
|
25280
|
-
|
|
25392
|
+
if (gridRef.el === e.target) {
|
|
25393
|
+
x = e.offsetX;
|
|
25394
|
+
y = e.offsetY;
|
|
25395
|
+
lastMoved = Date.now();
|
|
25396
|
+
}
|
|
25281
25397
|
}
|
|
25282
25398
|
function recompute() {
|
|
25283
25399
|
const { col, row } = getPosition();
|
|
@@ -28449,6 +28565,7 @@
|
|
|
28449
28565
|
legendPosition: chartData.legendPosition,
|
|
28450
28566
|
stacked: chartData.stacked || false,
|
|
28451
28567
|
aggregated: false,
|
|
28568
|
+
cumulative: chartData.cumulative || false,
|
|
28452
28569
|
labelsAsText: false,
|
|
28453
28570
|
};
|
|
28454
28571
|
}
|
|
@@ -33109,7 +33226,7 @@
|
|
|
33109
33226
|
|
|
33110
33227
|
class HeaderVisibilityPlugin extends CorePlugin {
|
|
33111
33228
|
static getters = [
|
|
33112
|
-
"
|
|
33229
|
+
"checkElementsIncludeAllVisibleHeaders",
|
|
33113
33230
|
"getHiddenColsGroups",
|
|
33114
33231
|
"getHiddenRowsGroups",
|
|
33115
33232
|
"isRowHiddenByUser",
|
|
@@ -33143,7 +33260,7 @@
|
|
|
33143
33260
|
if (!this.getters.tryGetSheet(cmd.sheetId)) {
|
|
33144
33261
|
return 28 /* CommandResult.InvalidSheetId */;
|
|
33145
33262
|
}
|
|
33146
|
-
if (
|
|
33263
|
+
if (this.checkElementsIncludeAllVisibleHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
33147
33264
|
return 8 /* CommandResult.NotEnoughElements */;
|
|
33148
33265
|
}
|
|
33149
33266
|
return 0 /* CommandResult.Success */;
|
|
@@ -33193,9 +33310,9 @@
|
|
|
33193
33310
|
}
|
|
33194
33311
|
return;
|
|
33195
33312
|
}
|
|
33196
|
-
|
|
33313
|
+
checkElementsIncludeAllVisibleHeaders(sheetId, dimension, elements) {
|
|
33197
33314
|
const visibleHeaders = this.getAllVisibleHeaders(sheetId, dimension);
|
|
33198
|
-
return
|
|
33315
|
+
return includesAll(elements, visibleHeaders);
|
|
33199
33316
|
}
|
|
33200
33317
|
isRowHiddenByUser(sheetId, index) {
|
|
33201
33318
|
return this.hiddenHeaders[sheetId].ROW[index];
|
|
@@ -34300,6 +34417,7 @@
|
|
|
34300
34417
|
"checkZonesExistInSheet",
|
|
34301
34418
|
"getCommandZones",
|
|
34302
34419
|
"getUnboundedZone",
|
|
34420
|
+
"checkElementsIncludeAllNonFrozenHeaders",
|
|
34303
34421
|
];
|
|
34304
34422
|
sheetIdsMapName = {};
|
|
34305
34423
|
orderedSheetIds = [];
|
|
@@ -34356,6 +34474,9 @@
|
|
|
34356
34474
|
if (Math.min(...cmd.elements) < 0 || Math.max(...cmd.elements) > elements) {
|
|
34357
34475
|
return 87 /* CommandResult.InvalidHeaderIndex */;
|
|
34358
34476
|
}
|
|
34477
|
+
else if (this.checkElementsIncludeAllNonFrozenHeaders(cmd.sheetId, cmd.dimension, cmd.elements)) {
|
|
34478
|
+
return 8 /* CommandResult.NotEnoughElements */;
|
|
34479
|
+
}
|
|
34359
34480
|
else {
|
|
34360
34481
|
return 0 /* CommandResult.Success */;
|
|
34361
34482
|
}
|
|
@@ -34648,6 +34769,20 @@
|
|
|
34648
34769
|
}
|
|
34649
34770
|
this.history.update("sheets", sheetId, "panes", panes);
|
|
34650
34771
|
}
|
|
34772
|
+
/**
|
|
34773
|
+
* Checks if all non-frozen header indices are present in the provided elements of selected rows/columns.
|
|
34774
|
+
* This validation ensures that all rows or columns cannot be deleted when frozen panes exist.
|
|
34775
|
+
*/
|
|
34776
|
+
checkElementsIncludeAllNonFrozenHeaders(sheetId, dimension, elements) {
|
|
34777
|
+
const paneDivisions = this.getters.getPaneDivisions(sheetId);
|
|
34778
|
+
const startIndex = dimension === "ROW" ? paneDivisions.ySplit : paneDivisions.xSplit;
|
|
34779
|
+
const endIndex = this.getters.getNumberHeaders(sheetId, dimension);
|
|
34780
|
+
if (!startIndex) {
|
|
34781
|
+
return false;
|
|
34782
|
+
}
|
|
34783
|
+
const indicesToCheck = range(startIndex, endIndex);
|
|
34784
|
+
return includesAll(elements, indicesToCheck);
|
|
34785
|
+
}
|
|
34651
34786
|
// ---------------------------------------------------------------------------
|
|
34652
34787
|
// Row/Col manipulation
|
|
34653
34788
|
// ---------------------------------------------------------------------------
|
|
@@ -36631,8 +36766,7 @@
|
|
|
36631
36766
|
if (cell.type === CellValueType.error) {
|
|
36632
36767
|
return false;
|
|
36633
36768
|
}
|
|
36634
|
-
const
|
|
36635
|
-
const values = rule.values.map((val) => parseLiteral(val, locale));
|
|
36769
|
+
const values = rule.values.map((val) => parseLiteral(val, DEFAULT_LOCALE));
|
|
36636
36770
|
switch (rule.operator) {
|
|
36637
36771
|
case "IsEmpty":
|
|
36638
36772
|
return cell.value.toString().trim() === "";
|
|
@@ -38716,7 +38850,7 @@
|
|
|
38716
38850
|
const replaceRegex = new RegExp(this.currentSearchRegex.source, this.currentSearchRegex.flags + "g");
|
|
38717
38851
|
const toReplace = this.getSearchableString({ sheetId, col, row });
|
|
38718
38852
|
const content = toReplace.replace(replaceRegex, replaceWith);
|
|
38719
|
-
const canonicalContent =
|
|
38853
|
+
const canonicalContent = canonicalizeNumberContent(content, this.getters.getLocale());
|
|
38720
38854
|
this.dispatch("UPDATE_CELL", { sheetId, col, row, content: canonicalContent });
|
|
38721
38855
|
}
|
|
38722
38856
|
/**
|
|
@@ -40890,7 +41024,7 @@
|
|
|
40890
41024
|
sheetId,
|
|
40891
41025
|
col: col + index,
|
|
40892
41026
|
row,
|
|
40893
|
-
content:
|
|
41027
|
+
content: canonicalizeNumberContent(content, this.getters.getLocale()),
|
|
40894
41028
|
format: "",
|
|
40895
41029
|
style: mainCell?.style || null,
|
|
40896
41030
|
});
|
|
@@ -41076,6 +41210,7 @@
|
|
|
41076
41210
|
cells;
|
|
41077
41211
|
copiedTables;
|
|
41078
41212
|
zones;
|
|
41213
|
+
uuidGenerator = new UuidGenerator();
|
|
41079
41214
|
constructor(zones, operation, getters, dispatch, selection) {
|
|
41080
41215
|
super(operation, getters, dispatch, selection);
|
|
41081
41216
|
if (!zones.length) {
|
|
@@ -41537,8 +41672,9 @@
|
|
|
41537
41672
|
this.adaptCFRules(origin.sheetId, cf, [xc], toRemoveRange);
|
|
41538
41673
|
}
|
|
41539
41674
|
else {
|
|
41540
|
-
this.adaptCFRules(target.sheetId, cf, [xc], []);
|
|
41541
41675
|
this.adaptCFRules(origin.sheetId, cf, [], toRemoveRange);
|
|
41676
|
+
const cfToCopyTo = this.getCFToCopyTo(target.sheetId, cf);
|
|
41677
|
+
this.adaptCFRules(target.sheetId, cfToCopyTo, [xc], []);
|
|
41542
41678
|
}
|
|
41543
41679
|
}
|
|
41544
41680
|
}
|
|
@@ -41562,6 +41698,12 @@
|
|
|
41562
41698
|
sheetId,
|
|
41563
41699
|
});
|
|
41564
41700
|
}
|
|
41701
|
+
getCFToCopyTo(targetSheetId, originCF) {
|
|
41702
|
+
const cfInTarget = this.getters
|
|
41703
|
+
.getConditionalFormats(targetSheetId)
|
|
41704
|
+
.find((cf) => cf.stopIfTrue === originCF.stopIfTrue && deepEquals(cf.rule, originCF.rule));
|
|
41705
|
+
return cfInTarget ? cfInTarget : { ...originCF, id: this.uuidGenerator.uuidv4(), ranges: [] };
|
|
41706
|
+
}
|
|
41565
41707
|
}
|
|
41566
41708
|
|
|
41567
41709
|
/** State of the clipboard when copying/cutting figures */
|
|
@@ -41693,7 +41835,7 @@
|
|
|
41693
41835
|
function canonicalizeNumberValue(content, locale) {
|
|
41694
41836
|
return content.startsWith("=")
|
|
41695
41837
|
? canonicalizeFormula(content, locale)
|
|
41696
|
-
:
|
|
41838
|
+
: canonicalizeNumberLiteral(content, locale);
|
|
41697
41839
|
}
|
|
41698
41840
|
/** Change a formula to its canonical form (en_US locale) */
|
|
41699
41841
|
function canonicalizeFormula(formula, locale) {
|
|
@@ -41810,7 +41952,7 @@
|
|
|
41810
41952
|
allowDispatch(cmd) {
|
|
41811
41953
|
switch (cmd.type) {
|
|
41812
41954
|
case "CUT":
|
|
41813
|
-
const zones =
|
|
41955
|
+
const zones = this.getters.getSelectedZones();
|
|
41814
41956
|
const state = this.getClipboardState(zones, cmd.type);
|
|
41815
41957
|
return state.isCutAllowed(zones);
|
|
41816
41958
|
case "PASTE":
|
|
@@ -41845,7 +41987,7 @@
|
|
|
41845
41987
|
switch (cmd.type) {
|
|
41846
41988
|
case "COPY":
|
|
41847
41989
|
case "CUT":
|
|
41848
|
-
const zones =
|
|
41990
|
+
const zones = this.getters.getSelectedZones();
|
|
41849
41991
|
this.state = this.getClipboardState(zones, cmd.type);
|
|
41850
41992
|
this.status = "visible";
|
|
41851
41993
|
this.originSheetId = this.getters.getActiveSheetId();
|
|
@@ -42495,7 +42637,7 @@
|
|
|
42495
42637
|
if (content) {
|
|
42496
42638
|
const sheetId = this.getters.getActiveSheetId();
|
|
42497
42639
|
const cell = this.getters.getEvaluatedCell({ sheetId, col: this.col, row: this.row });
|
|
42498
|
-
content =
|
|
42640
|
+
content = canonicalizeNumberContent(content, this.getters.getLocale());
|
|
42499
42641
|
if (content.startsWith("=")) {
|
|
42500
42642
|
const left = this.currentTokens.filter((t) => t.type === "LEFT_PAREN").length;
|
|
42501
42643
|
const right = this.currentTokens.filter((t) => t.type === "RIGHT_PAREN").length;
|
|
@@ -43516,26 +43658,24 @@
|
|
|
43516
43658
|
const isBasedBefore = cmd.base < start;
|
|
43517
43659
|
const deltaCol = isBasedBefore && isCol ? thickness : 0;
|
|
43518
43660
|
const deltaRow = isBasedBefore && !isCol ? thickness : 0;
|
|
43519
|
-
|
|
43520
|
-
|
|
43521
|
-
|
|
43522
|
-
|
|
43523
|
-
|
|
43524
|
-
|
|
43525
|
-
|
|
43526
|
-
|
|
43527
|
-
|
|
43528
|
-
|
|
43529
|
-
|
|
43530
|
-
|
|
43531
|
-
|
|
43532
|
-
|
|
43533
|
-
|
|
43534
|
-
|
|
43535
|
-
|
|
43536
|
-
|
|
43537
|
-
],
|
|
43538
|
-
});
|
|
43661
|
+
const target = [
|
|
43662
|
+
{
|
|
43663
|
+
left: isCol ? start + deltaCol : 0,
|
|
43664
|
+
right: isCol ? end + deltaCol : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
43665
|
+
top: !isCol ? start + deltaRow : 0,
|
|
43666
|
+
bottom: !isCol ? end + deltaRow : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
43667
|
+
},
|
|
43668
|
+
];
|
|
43669
|
+
const state = new ClipboardCellsState(target, "CUT", this.getters, this.dispatch, this.selection);
|
|
43670
|
+
const pasteTarget = [
|
|
43671
|
+
{
|
|
43672
|
+
left: isCol ? cmd.base : 0,
|
|
43673
|
+
right: isCol ? cmd.base + thickness - 1 : this.getters.getNumberCols(cmd.sheetId) - 1,
|
|
43674
|
+
top: !isCol ? cmd.base : 0,
|
|
43675
|
+
bottom: !isCol ? cmd.base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
43676
|
+
},
|
|
43677
|
+
];
|
|
43678
|
+
state.paste(pasteTarget, { selectTarget: true });
|
|
43539
43679
|
const toRemove = isBasedBefore ? cmd.elements.map((el) => el + thickness) : cmd.elements;
|
|
43540
43680
|
let currentIndex = cmd.base;
|
|
43541
43681
|
for (const element of toRemove) {
|
|
@@ -43934,6 +44074,9 @@
|
|
|
43934
44074
|
const sheetId = this.sheetId;
|
|
43935
44075
|
this.left = this.searchHeaderIndex("COL", this.offsetScrollbarX, this.boundaries.left);
|
|
43936
44076
|
this.right = Math.min(this.boundaries.right, this.searchHeaderIndex("COL", this.viewportWidth, this.left));
|
|
44077
|
+
if (this.left === -1) {
|
|
44078
|
+
this.left = this.boundaries.left;
|
|
44079
|
+
}
|
|
43937
44080
|
if (this.right === -1) {
|
|
43938
44081
|
this.right = this.getters.getNumberCols(sheetId) - 1;
|
|
43939
44082
|
}
|
|
@@ -43947,6 +44090,9 @@
|
|
|
43947
44090
|
const sheetId = this.sheetId;
|
|
43948
44091
|
this.top = this.searchHeaderIndex("ROW", this.offsetScrollbarY, this.boundaries.top);
|
|
43949
44092
|
this.bottom = Math.min(this.boundaries.bottom, this.searchHeaderIndex("ROW", this.viewportHeight, this.top));
|
|
44093
|
+
if (this.top === -1) {
|
|
44094
|
+
this.top = this.boundaries.top;
|
|
44095
|
+
}
|
|
43950
44096
|
if (this.bottom === -1) {
|
|
43951
44097
|
this.bottom = this.getters.getNumberRows(sheetId) - 1;
|
|
43952
44098
|
}
|
|
@@ -50549,9 +50695,9 @@
|
|
|
50549
50695
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
50550
50696
|
|
|
50551
50697
|
|
|
50552
|
-
__info__.version = '16.4.
|
|
50553
|
-
__info__.date = '2023-
|
|
50554
|
-
__info__.hash = '
|
|
50698
|
+
__info__.version = '16.4.7';
|
|
50699
|
+
__info__.date = '2023-09-21T15:58:11.039Z';
|
|
50700
|
+
__info__.hash = 'eccdcce';
|
|
50555
50701
|
|
|
50556
50702
|
|
|
50557
50703
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|