@odoo/o-spreadsheet 15.0.14 → 15.0.16
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 +137 -79
- package/dist/o-spreadsheet.esm.js +137 -79
- package/dist/o-spreadsheet.iife.js +137 -79
- package/dist/o-spreadsheet.iife.min.js +363 -363
- package/package.json +1 -1
|
@@ -129,14 +129,72 @@ const FORMULA_REF_IDENTIFIER = "|";
|
|
|
129
129
|
// -----------------------------------------------------------------------------
|
|
130
130
|
// Date Type
|
|
131
131
|
// -----------------------------------------------------------------------------
|
|
132
|
+
/**
|
|
133
|
+
* A DateTime object that can be used to manipulate spreadsheet dates.
|
|
134
|
+
* Conceptually, a spreadsheet date is simply a number with a date format,
|
|
135
|
+
* and it is timezone-agnostic.
|
|
136
|
+
* This DateTime object consistently uses UTC time to represent a naive date and time.
|
|
137
|
+
*/
|
|
138
|
+
class DateTime {
|
|
139
|
+
constructor(year, month, day, hours = 0, minutes = 0, seconds = 0) {
|
|
140
|
+
this.jsDate = new Date(Date.UTC(year, month, day, hours, minutes, seconds, 0));
|
|
141
|
+
}
|
|
142
|
+
static fromTimestamp(timestamp) {
|
|
143
|
+
const date = new Date(timestamp);
|
|
144
|
+
return new DateTime(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
|
|
145
|
+
}
|
|
146
|
+
static now() {
|
|
147
|
+
const now = new Date();
|
|
148
|
+
return new DateTime(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
|
|
149
|
+
}
|
|
150
|
+
toString() {
|
|
151
|
+
return this.jsDate.toString();
|
|
152
|
+
}
|
|
153
|
+
getTime() {
|
|
154
|
+
return this.jsDate.getTime();
|
|
155
|
+
}
|
|
156
|
+
getFullYear() {
|
|
157
|
+
return this.jsDate.getUTCFullYear();
|
|
158
|
+
}
|
|
159
|
+
getMonth() {
|
|
160
|
+
return this.jsDate.getUTCMonth();
|
|
161
|
+
}
|
|
162
|
+
getDate() {
|
|
163
|
+
return this.jsDate.getUTCDate();
|
|
164
|
+
}
|
|
165
|
+
getDay() {
|
|
166
|
+
return this.jsDate.getUTCDay();
|
|
167
|
+
}
|
|
168
|
+
getHours() {
|
|
169
|
+
return this.jsDate.getUTCHours();
|
|
170
|
+
}
|
|
171
|
+
getMinutes() {
|
|
172
|
+
return this.jsDate.getUTCMinutes();
|
|
173
|
+
}
|
|
174
|
+
getSeconds() {
|
|
175
|
+
return this.jsDate.getUTCSeconds();
|
|
176
|
+
}
|
|
177
|
+
setDate(date) {
|
|
178
|
+
this.jsDate.setUTCDate(date);
|
|
179
|
+
}
|
|
180
|
+
setHours(hours) {
|
|
181
|
+
this.jsDate.setUTCHours(hours);
|
|
182
|
+
}
|
|
183
|
+
setMinutes(minutes) {
|
|
184
|
+
this.jsDate.setUTCMinutes(minutes);
|
|
185
|
+
}
|
|
186
|
+
setSeconds(seconds) {
|
|
187
|
+
this.jsDate.setUTCSeconds(seconds);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
132
190
|
// -----------------------------------------------------------------------------
|
|
133
191
|
// Parsing
|
|
134
192
|
// -----------------------------------------------------------------------------
|
|
135
193
|
const CURRENT_MILLENIAL = 2000; // note: don't forget to update this in 2999
|
|
136
|
-
const CURRENT_YEAR =
|
|
137
|
-
const INITIAL_1900_DAY$1 = new
|
|
138
|
-
const INITIAL_JS_DAY =
|
|
139
|
-
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY$1;
|
|
194
|
+
const CURRENT_YEAR = DateTime.now().getFullYear();
|
|
195
|
+
const INITIAL_1900_DAY$1 = new DateTime(1899, 11, 30);
|
|
196
|
+
const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
197
|
+
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY$1.getTime();
|
|
140
198
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
141
199
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
142
200
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
@@ -176,7 +234,7 @@ function parseDateTime(str) {
|
|
|
176
234
|
return {
|
|
177
235
|
value: date.value + time.value,
|
|
178
236
|
format: date.format + " " + (time.format === "hhhh:mm:ss" ? "hh:mm:ss" : time.format),
|
|
179
|
-
jsDate: new
|
|
237
|
+
jsDate: new DateTime(date.jsDate.getFullYear() + time.jsDate.getFullYear() - 1899, date.jsDate.getMonth() + time.jsDate.getMonth() - 11, date.jsDate.getDate() + time.jsDate.getDate() - 30, date.jsDate.getHours() + time.jsDate.getHours(), date.jsDate.getMinutes() + time.jsDate.getMinutes(), date.jsDate.getSeconds() + time.jsDate.getSeconds()),
|
|
180
238
|
};
|
|
181
239
|
}
|
|
182
240
|
return date || time;
|
|
@@ -193,13 +251,13 @@ function parseDate(str, dateFormat) {
|
|
|
193
251
|
const day = Number(parts[dayIndex]);
|
|
194
252
|
const leadingZero = (parts[monthIndex].length === 2 && month < 10) || (parts[dayIndex].length === 2 && day < 10);
|
|
195
253
|
const year = parts[yearIndex] ? inferYear(parts[yearIndex]) : CURRENT_YEAR;
|
|
196
|
-
const jsDate = new
|
|
254
|
+
const jsDate = new DateTime(year, month - 1, day);
|
|
197
255
|
const sep = str.match(/\/|-|\s/)[0];
|
|
198
256
|
if (jsDate.getMonth() !== month - 1 || jsDate.getDate() !== day) {
|
|
199
257
|
// invalid date
|
|
200
258
|
return null;
|
|
201
259
|
}
|
|
202
|
-
const delta = jsDate - INITIAL_1900_DAY$1;
|
|
260
|
+
const delta = jsDate.getTime() - INITIAL_1900_DAY$1.getTime();
|
|
203
261
|
let format = leadingZero ? `mm${sep}dd` : `m${sep}d`;
|
|
204
262
|
if (parts[yearIndex]) {
|
|
205
263
|
format = isMDY ? format + sep + "yyyy" : "yyyy" + sep + format;
|
|
@@ -259,7 +317,7 @@ function parseTime(str) {
|
|
|
259
317
|
if (hours >= 24) {
|
|
260
318
|
format = "hhhh:mm:ss";
|
|
261
319
|
}
|
|
262
|
-
const jsDate = new
|
|
320
|
+
const jsDate = new DateTime(1899, 11, 30, hours, minutes, seconds);
|
|
263
321
|
return {
|
|
264
322
|
value: hours / 24 + minutes / 1440 + seconds / 86400,
|
|
265
323
|
format: format,
|
|
@@ -273,7 +331,7 @@ function parseTime(str) {
|
|
|
273
331
|
// -----------------------------------------------------------------------------
|
|
274
332
|
function numberToJsDate(value) {
|
|
275
333
|
const truncValue = Math.trunc(value);
|
|
276
|
-
let date =
|
|
334
|
+
let date = DateTime.fromTimestamp(truncValue * 86400 * 1000 - DATE_JS_1900_OFFSET);
|
|
277
335
|
let time = value - truncValue;
|
|
278
336
|
time = time < 0 ? 1 + time : time;
|
|
279
337
|
const hours = Math.round(time * 24);
|
|
@@ -346,7 +404,7 @@ function formatJSTime(jsDate, format) {
|
|
|
346
404
|
.map((p) => {
|
|
347
405
|
switch (p) {
|
|
348
406
|
case "hhhh":
|
|
349
|
-
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY$1) / (60 * 60 * 1000));
|
|
407
|
+
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY$1.getTime()) / (60 * 60 * 1000));
|
|
350
408
|
return helapsedHours.toString();
|
|
351
409
|
case "hh":
|
|
352
410
|
return hours.toString().padStart(2, "0");
|
|
@@ -2846,7 +2904,7 @@ function isBoolean(str) {
|
|
|
2846
2904
|
function isDateTime(str) {
|
|
2847
2905
|
return parseDateTime(str) !== null;
|
|
2848
2906
|
}
|
|
2849
|
-
const MARKDOWN_LINK_REGEX = /^\[(
|
|
2907
|
+
const MARKDOWN_LINK_REGEX = /^\[(.+)\]\((.+)\)$/;
|
|
2850
2908
|
//link must start with http or https
|
|
2851
2909
|
//https://stackoverflow.com/a/3809435/4760614
|
|
2852
2910
|
const WEB_LINK_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
|
|
@@ -4749,7 +4807,7 @@ var database = /*#__PURE__*/Object.freeze({
|
|
|
4749
4807
|
DVARP: DVARP
|
|
4750
4808
|
});
|
|
4751
4809
|
|
|
4752
|
-
const INITIAL_1900_DAY = new
|
|
4810
|
+
const INITIAL_1900_DAY = new DateTime(1899, 11, 30);
|
|
4753
4811
|
const DEFAULT_TYPE = 1;
|
|
4754
4812
|
const DEFAULT_WEEKEND = 1;
|
|
4755
4813
|
function isLeapYear(year) {
|
|
@@ -4778,7 +4836,7 @@ const DATE = {
|
|
|
4778
4836
|
if (_year < 1900) {
|
|
4779
4837
|
_year += 1900;
|
|
4780
4838
|
}
|
|
4781
|
-
const jsDate = new
|
|
4839
|
+
const jsDate = new DateTime(_year, _month - 1, _day);
|
|
4782
4840
|
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
4783
4841
|
assert(() => delta >= 0, _lt(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`));
|
|
4784
4842
|
return Math.round(delta / 86400000);
|
|
@@ -4851,7 +4909,7 @@ const EDATE = {
|
|
|
4851
4909
|
const yStart = _startDate.getFullYear();
|
|
4852
4910
|
const mStart = _startDate.getMonth();
|
|
4853
4911
|
const dStart = _startDate.getDate();
|
|
4854
|
-
const jsDate = new
|
|
4912
|
+
const jsDate = new DateTime(yStart, mStart + _months, dStart);
|
|
4855
4913
|
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
4856
4914
|
return Math.round(delta / 86400000);
|
|
4857
4915
|
},
|
|
@@ -4873,7 +4931,7 @@ const EOMONTH = {
|
|
|
4873
4931
|
const _months = Math.trunc(toNumber(months));
|
|
4874
4932
|
const yStart = _startDate.getFullYear();
|
|
4875
4933
|
const mStart = _startDate.getMonth();
|
|
4876
|
-
const jsDate = new
|
|
4934
|
+
const jsDate = new DateTime(yStart, mStart + _months + 1, 0);
|
|
4877
4935
|
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
4878
4936
|
return Math.round(delta / 86400000);
|
|
4879
4937
|
},
|
|
@@ -4913,17 +4971,17 @@ const ISOWEEKNUM = {
|
|
|
4913
4971
|
// The first week of the year is the week that contains the first
|
|
4914
4972
|
// Thursday of the year.
|
|
4915
4973
|
let firstThursday = 1;
|
|
4916
|
-
while (new
|
|
4974
|
+
while (new DateTime(y, 0, firstThursday).getDay() !== 4) {
|
|
4917
4975
|
firstThursday += 1;
|
|
4918
4976
|
}
|
|
4919
|
-
const firstDayOfFirstWeek = new
|
|
4977
|
+
const firstDayOfFirstWeek = new DateTime(y, 0, firstThursday - 3);
|
|
4920
4978
|
// The last week of the year is the week that contains the last Thursday of
|
|
4921
4979
|
// the year.
|
|
4922
4980
|
let lastThursday = 31;
|
|
4923
|
-
while (new
|
|
4981
|
+
while (new DateTime(y, 11, lastThursday).getDay() !== 4) {
|
|
4924
4982
|
lastThursday -= 1;
|
|
4925
4983
|
}
|
|
4926
|
-
const lastDayOfLastWeek = new
|
|
4984
|
+
const lastDayOfLastWeek = new DateTime(y, 11, lastThursday + 3);
|
|
4927
4985
|
// B - If our date > lastDayOfLastWeek then it's in the weeks of the year after
|
|
4928
4986
|
// If our date < firstDayOfFirstWeek then it's in the weeks of the year before
|
|
4929
4987
|
let offsetYear;
|
|
@@ -4949,17 +5007,17 @@ const ISOWEEKNUM = {
|
|
|
4949
5007
|
case 1:
|
|
4950
5008
|
// firstDay is the 1st day of the 1st week of the year after
|
|
4951
5009
|
// firstDay = lastDayOfLastWeek + 1 Day
|
|
4952
|
-
firstDay = new
|
|
5010
|
+
firstDay = new DateTime(y, 11, lastThursday + 3 + 1);
|
|
4953
5011
|
break;
|
|
4954
5012
|
case -1:
|
|
4955
5013
|
// firstDay is the 1st day of the 1st week of the previous year.
|
|
4956
5014
|
// The first week of the previous year is the week that contains the
|
|
4957
5015
|
// first Thursday of the previous year.
|
|
4958
5016
|
let firstThursdayPreviousYear = 1;
|
|
4959
|
-
while (new
|
|
5017
|
+
while (new DateTime(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
|
|
4960
5018
|
firstThursdayPreviousYear += 1;
|
|
4961
5019
|
}
|
|
4962
|
-
firstDay = new
|
|
5020
|
+
firstDay = new DateTime(y - 1, 0, firstThursdayPreviousYear - 3);
|
|
4963
5021
|
break;
|
|
4964
5022
|
}
|
|
4965
5023
|
const dif = (_date.getTime() - firstDay.getTime()) / 86400000;
|
|
@@ -5098,8 +5156,8 @@ const NETWORKDAYS_INTL = {
|
|
|
5098
5156
|
});
|
|
5099
5157
|
}
|
|
5100
5158
|
const invertDate = _startDate.getTime() > _endDate.getTime();
|
|
5101
|
-
const stopDate =
|
|
5102
|
-
let stepDate =
|
|
5159
|
+
const stopDate = DateTime.fromTimestamp((invertDate ? _startDate : _endDate).getTime());
|
|
5160
|
+
let stepDate = DateTime.fromTimestamp((invertDate ? _endDate : _startDate).getTime());
|
|
5103
5161
|
const timeStopDate = stopDate.getTime();
|
|
5104
5162
|
let timeStepDate = stepDate.getTime();
|
|
5105
5163
|
let netWorkingDay = 0;
|
|
@@ -5123,8 +5181,7 @@ const NOW = {
|
|
|
5123
5181
|
returns: ["DATE"],
|
|
5124
5182
|
returnFormat: { specificFormat: "m/d/yyyy hh:mm:ss" },
|
|
5125
5183
|
compute: function () {
|
|
5126
|
-
let today =
|
|
5127
|
-
today.setMilliseconds(0);
|
|
5184
|
+
let today = DateTime.now();
|
|
5128
5185
|
const delta = today.getTime() - INITIAL_1900_DAY.getTime();
|
|
5129
5186
|
const time = today.getHours() / 24 + today.getMinutes() / 1440 + today.getSeconds() / 86400;
|
|
5130
5187
|
return Math.floor(delta / 86400000) + time;
|
|
@@ -5198,8 +5255,8 @@ const TODAY = {
|
|
|
5198
5255
|
returns: ["DATE"],
|
|
5199
5256
|
returnFormat: { specificFormat: "m/d/yyyy" },
|
|
5200
5257
|
compute: function () {
|
|
5201
|
-
const today =
|
|
5202
|
-
const jsDate = new
|
|
5258
|
+
const today = DateTime.now();
|
|
5259
|
+
const jsDate = new DateTime(today.getFullYear(), today.getMonth(), today.getDate());
|
|
5203
5260
|
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
5204
5261
|
return Math.round(delta / 86400000);
|
|
5205
5262
|
},
|
|
@@ -5255,10 +5312,10 @@ const WEEKNUM = {
|
|
|
5255
5312
|
}
|
|
5256
5313
|
const y = _date.getFullYear();
|
|
5257
5314
|
let dayStart = 1;
|
|
5258
|
-
let startDayOfFirstWeek = new
|
|
5315
|
+
let startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
5259
5316
|
while (startDayOfFirstWeek.getDay() !== startDayOfWeek) {
|
|
5260
5317
|
dayStart += 1;
|
|
5261
|
-
startDayOfFirstWeek = new
|
|
5318
|
+
startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
5262
5319
|
}
|
|
5263
5320
|
const dif = (_date.getTime() - startDayOfFirstWeek.getTime()) / 86400000;
|
|
5264
5321
|
if (dif < 0) {
|
|
@@ -5312,7 +5369,7 @@ const WORKDAY_INTL = {
|
|
|
5312
5369
|
timesHoliday.add(holiday.getTime());
|
|
5313
5370
|
});
|
|
5314
5371
|
}
|
|
5315
|
-
let stepDate =
|
|
5372
|
+
let stepDate = DateTime.fromTimestamp(_startDate.getTime());
|
|
5316
5373
|
let timeStepDate = stepDate.getTime();
|
|
5317
5374
|
const unitDay = Math.sign(_numDays);
|
|
5318
5375
|
let stepDay = Math.abs(_numDays);
|
|
@@ -18673,15 +18730,20 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
18673
18730
|
// Getters
|
|
18674
18731
|
// ---------------------------------------------------------------------------
|
|
18675
18732
|
evaluateFormula(formulaString, sheetId = this.getters.getActiveSheetId()) {
|
|
18676
|
-
|
|
18677
|
-
|
|
18678
|
-
|
|
18679
|
-
|
|
18680
|
-
|
|
18681
|
-
|
|
18733
|
+
try {
|
|
18734
|
+
let formula = normalize(formulaString);
|
|
18735
|
+
const compiledFormula = compile(formula);
|
|
18736
|
+
const params = this.getFormulaParameters(() => { });
|
|
18737
|
+
const ranges = [];
|
|
18738
|
+
for (let xc of formula.dependencies.references) {
|
|
18739
|
+
ranges.push(this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
18740
|
+
}
|
|
18741
|
+
const dependencies = { ...formula.dependencies, references: ranges };
|
|
18742
|
+
return compiledFormula(dependencies, sheetId, ...params);
|
|
18743
|
+
}
|
|
18744
|
+
catch (error) {
|
|
18745
|
+
return "#ERROR";
|
|
18682
18746
|
}
|
|
18683
|
-
const dependencies = { ...formula.dependencies, references: ranges };
|
|
18684
|
-
return compiledFormula(dependencies, sheetId, ...params);
|
|
18685
18747
|
}
|
|
18686
18748
|
/**
|
|
18687
18749
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -19176,25 +19238,26 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
19176
19238
|
*/
|
|
19177
19239
|
this.rulePredicate = {
|
|
19178
19240
|
CellIsRule: (cell, rule) => {
|
|
19241
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19179
19242
|
if (cell && cell.evaluated.type === CellValueType.error) {
|
|
19180
19243
|
return false;
|
|
19181
19244
|
}
|
|
19182
19245
|
const values = rule.values.map(parsePrimitiveContent);
|
|
19183
19246
|
switch (rule.operator) {
|
|
19184
19247
|
case "IsEmpty":
|
|
19185
|
-
return !isDefined(cell) || cell.evaluated.value.toString().trim() === "";
|
|
19248
|
+
return !isDefined(cell) || ((_a = cell.evaluated.value) === null || _a === void 0 ? void 0 : _a.toString().trim()) === "";
|
|
19186
19249
|
case "IsNotEmpty":
|
|
19187
|
-
return isDefined(cell) && cell.evaluated.value.toString().trim() !== "";
|
|
19250
|
+
return isDefined(cell) && ((_b = cell.evaluated.value) === null || _b === void 0 ? void 0 : _b.toString().trim()) !== "";
|
|
19188
19251
|
case "BeginsWith":
|
|
19189
19252
|
if (!cell && values[0] === "") {
|
|
19190
19253
|
return false;
|
|
19191
19254
|
}
|
|
19192
|
-
return (isDefined(cell) && (cell === null ||
|
|
19255
|
+
return (isDefined(cell) && ((_c = cell.evaluated.value) === null || _c === void 0 ? void 0 : _c.toString().startsWith(values[0].toString())));
|
|
19193
19256
|
case "EndsWith":
|
|
19194
19257
|
if (!cell && values[0] === "") {
|
|
19195
19258
|
return false;
|
|
19196
19259
|
}
|
|
19197
|
-
return isDefined(cell) && cell.evaluated.value.toString().endsWith(values[0].toString());
|
|
19260
|
+
return isDefined(cell) && ((_d = cell.evaluated.value) === null || _d === void 0 ? void 0 : _d.toString().endsWith(values[0].toString()));
|
|
19198
19261
|
case "Between":
|
|
19199
19262
|
return (isDefined(cell) &&
|
|
19200
19263
|
cell.evaluated.value >= values[0] &&
|
|
@@ -19204,11 +19267,11 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
19204
19267
|
cell.evaluated.value >= values[0] &&
|
|
19205
19268
|
cell.evaluated.value <= values[1]);
|
|
19206
19269
|
case "ContainsText":
|
|
19207
|
-
return (isDefined(cell) && cell.evaluated.value.toString().indexOf(values[0].toString()) > -1);
|
|
19270
|
+
return (isDefined(cell) && ((_e = cell.evaluated.value) === null || _e === void 0 ? void 0 : _e.toString().indexOf(values[0].toString())) > -1);
|
|
19208
19271
|
case "NotContains":
|
|
19209
19272
|
return (!isDefined(cell) ||
|
|
19210
19273
|
!cell.evaluated.value ||
|
|
19211
|
-
cell.evaluated.value.toString().indexOf(values[0].toString()) == -1);
|
|
19274
|
+
((_f = cell.evaluated.value) === null || _f === void 0 ? void 0 : _f.toString().indexOf(values[0].toString())) == -1);
|
|
19212
19275
|
case "GreaterThan":
|
|
19213
19276
|
return isDefined(cell) && cell.evaluated.value > values[0];
|
|
19214
19277
|
case "GreaterThanOrEqual":
|
|
@@ -19317,39 +19380,34 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
19317
19380
|
this.computedIcons[activeSheetId] = {};
|
|
19318
19381
|
const computedStyle = this.computedStyles[activeSheetId];
|
|
19319
19382
|
for (let cf of this.getters.getConditionalFormats(activeSheetId)) {
|
|
19320
|
-
|
|
19321
|
-
|
|
19322
|
-
|
|
19323
|
-
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
for (let
|
|
19336
|
-
|
|
19337
|
-
|
|
19338
|
-
|
|
19339
|
-
if (
|
|
19340
|
-
|
|
19341
|
-
|
|
19342
|
-
|
|
19343
|
-
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
19344
|
-
}
|
|
19383
|
+
switch (cf.rule.type) {
|
|
19384
|
+
case "ColorScaleRule":
|
|
19385
|
+
for (let range of cf.ranges) {
|
|
19386
|
+
this.applyColorScale(range, cf.rule);
|
|
19387
|
+
}
|
|
19388
|
+
break;
|
|
19389
|
+
case "IconSetRule":
|
|
19390
|
+
for (let range of cf.ranges) {
|
|
19391
|
+
this.applyIcon(range, cf.rule);
|
|
19392
|
+
}
|
|
19393
|
+
break;
|
|
19394
|
+
default:
|
|
19395
|
+
for (let ref of cf.ranges) {
|
|
19396
|
+
const zone = toZone(ref);
|
|
19397
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
19398
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
19399
|
+
const pr = this.rulePredicate[cf.rule.type];
|
|
19400
|
+
let cell = this.getters.getCell(activeSheetId, col, row);
|
|
19401
|
+
if (pr && pr(cell, cf.rule)) {
|
|
19402
|
+
if (!computedStyle[col])
|
|
19403
|
+
computedStyle[col] = [];
|
|
19404
|
+
// we must combine all the properties of all the CF rules applied to the given cell
|
|
19405
|
+
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
19345
19406
|
}
|
|
19346
19407
|
}
|
|
19347
19408
|
}
|
|
19348
|
-
|
|
19349
|
-
|
|
19350
|
-
}
|
|
19351
|
-
catch (_) {
|
|
19352
|
-
// we don't care about the errors within the evaluation of a rule
|
|
19409
|
+
}
|
|
19410
|
+
break;
|
|
19353
19411
|
}
|
|
19354
19412
|
}
|
|
19355
19413
|
}
|
|
@@ -19368,7 +19426,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
19368
19426
|
return this.getters.evaluateFormula(`=PERCENTILE(${range},${Number(threshold.value) / 100})`);
|
|
19369
19427
|
case "formula":
|
|
19370
19428
|
const value = threshold.value && this.getters.evaluateFormula(threshold.value);
|
|
19371
|
-
return
|
|
19429
|
+
return typeof value === "number" ? value : null;
|
|
19372
19430
|
default:
|
|
19373
19431
|
return null;
|
|
19374
19432
|
}
|
|
@@ -31450,6 +31508,6 @@ exports.registries = registries;
|
|
|
31450
31508
|
exports.setTranslationMethod = setTranslationMethod;
|
|
31451
31509
|
|
|
31452
31510
|
|
|
31453
|
-
__info__.version = '15.0.
|
|
31454
|
-
__info__.date = '
|
|
31455
|
-
__info__.hash = '
|
|
31511
|
+
__info__.version = '15.0.16';
|
|
31512
|
+
__info__.date = '2024-01-17T10:23:17.942Z';
|
|
31513
|
+
__info__.hash = '3a9ce19';
|