@odoo/o-spreadsheet 15.2.13 → 15.2.15
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 +135 -77
- package/dist/o-spreadsheet.esm.js +135 -77
- package/dist/o-spreadsheet.iife.js +135 -77
- package/dist/o-spreadsheet.iife.min.js +356 -356
- package/package.json +1 -1
|
@@ -131,14 +131,72 @@ const FORMULA_REF_IDENTIFIER = "|";
|
|
|
131
131
|
// -----------------------------------------------------------------------------
|
|
132
132
|
// Date Type
|
|
133
133
|
// -----------------------------------------------------------------------------
|
|
134
|
+
/**
|
|
135
|
+
* A DateTime object that can be used to manipulate spreadsheet dates.
|
|
136
|
+
* Conceptually, a spreadsheet date is simply a number with a date format,
|
|
137
|
+
* and it is timezone-agnostic.
|
|
138
|
+
* This DateTime object consistently uses UTC time to represent a naive date and time.
|
|
139
|
+
*/
|
|
140
|
+
class DateTime {
|
|
141
|
+
constructor(year, month, day, hours = 0, minutes = 0, seconds = 0) {
|
|
142
|
+
this.jsDate = new Date(Date.UTC(year, month, day, hours, minutes, seconds, 0));
|
|
143
|
+
}
|
|
144
|
+
static fromTimestamp(timestamp) {
|
|
145
|
+
const date = new Date(timestamp);
|
|
146
|
+
return new DateTime(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
|
|
147
|
+
}
|
|
148
|
+
static now() {
|
|
149
|
+
const now = new Date();
|
|
150
|
+
return new DateTime(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
|
|
151
|
+
}
|
|
152
|
+
toString() {
|
|
153
|
+
return this.jsDate.toString();
|
|
154
|
+
}
|
|
155
|
+
getTime() {
|
|
156
|
+
return this.jsDate.getTime();
|
|
157
|
+
}
|
|
158
|
+
getFullYear() {
|
|
159
|
+
return this.jsDate.getUTCFullYear();
|
|
160
|
+
}
|
|
161
|
+
getMonth() {
|
|
162
|
+
return this.jsDate.getUTCMonth();
|
|
163
|
+
}
|
|
164
|
+
getDate() {
|
|
165
|
+
return this.jsDate.getUTCDate();
|
|
166
|
+
}
|
|
167
|
+
getDay() {
|
|
168
|
+
return this.jsDate.getUTCDay();
|
|
169
|
+
}
|
|
170
|
+
getHours() {
|
|
171
|
+
return this.jsDate.getUTCHours();
|
|
172
|
+
}
|
|
173
|
+
getMinutes() {
|
|
174
|
+
return this.jsDate.getUTCMinutes();
|
|
175
|
+
}
|
|
176
|
+
getSeconds() {
|
|
177
|
+
return this.jsDate.getUTCSeconds();
|
|
178
|
+
}
|
|
179
|
+
setDate(date) {
|
|
180
|
+
this.jsDate.setUTCDate(date);
|
|
181
|
+
}
|
|
182
|
+
setHours(hours) {
|
|
183
|
+
this.jsDate.setUTCHours(hours);
|
|
184
|
+
}
|
|
185
|
+
setMinutes(minutes) {
|
|
186
|
+
this.jsDate.setUTCMinutes(minutes);
|
|
187
|
+
}
|
|
188
|
+
setSeconds(seconds) {
|
|
189
|
+
this.jsDate.setUTCSeconds(seconds);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
134
192
|
// -----------------------------------------------------------------------------
|
|
135
193
|
// Parsing
|
|
136
194
|
// -----------------------------------------------------------------------------
|
|
137
195
|
const CURRENT_MILLENIAL = 2000; // note: don't forget to update this in 2999
|
|
138
|
-
const CURRENT_YEAR =
|
|
139
|
-
const INITIAL_1900_DAY$1 = new
|
|
140
|
-
const INITIAL_JS_DAY =
|
|
141
|
-
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY$1;
|
|
196
|
+
const CURRENT_YEAR = DateTime.now().getFullYear();
|
|
197
|
+
const INITIAL_1900_DAY$1 = new DateTime(1899, 11, 30);
|
|
198
|
+
const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
199
|
+
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY$1.getTime();
|
|
142
200
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
143
201
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
144
202
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
@@ -178,7 +236,7 @@ function parseDateTime(str) {
|
|
|
178
236
|
return {
|
|
179
237
|
value: date.value + time.value,
|
|
180
238
|
format: date.format + " " + (time.format === "hhhh:mm:ss" ? "hh:mm:ss" : time.format),
|
|
181
|
-
jsDate: new
|
|
239
|
+
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()),
|
|
182
240
|
};
|
|
183
241
|
}
|
|
184
242
|
return date || time;
|
|
@@ -195,13 +253,13 @@ function parseDate(str, dateFormat) {
|
|
|
195
253
|
const day = Number(parts[dayIndex]);
|
|
196
254
|
const leadingZero = (parts[monthIndex].length === 2 && month < 10) || (parts[dayIndex].length === 2 && day < 10);
|
|
197
255
|
const year = parts[yearIndex] ? inferYear(parts[yearIndex]) : CURRENT_YEAR;
|
|
198
|
-
const jsDate = new
|
|
256
|
+
const jsDate = new DateTime(year, month - 1, day);
|
|
199
257
|
const sep = str.match(/\/|-|\s/)[0];
|
|
200
258
|
if (jsDate.getMonth() !== month - 1 || jsDate.getDate() !== day) {
|
|
201
259
|
// invalid date
|
|
202
260
|
return null;
|
|
203
261
|
}
|
|
204
|
-
const delta = jsDate - INITIAL_1900_DAY$1;
|
|
262
|
+
const delta = jsDate.getTime() - INITIAL_1900_DAY$1.getTime();
|
|
205
263
|
let format = leadingZero ? `mm${sep}dd` : `m${sep}d`;
|
|
206
264
|
if (parts[yearIndex]) {
|
|
207
265
|
format = isMDY ? format + sep + "yyyy" : "yyyy" + sep + format;
|
|
@@ -261,7 +319,7 @@ function parseTime(str) {
|
|
|
261
319
|
if (hours >= 24) {
|
|
262
320
|
format = "hhhh:mm:ss";
|
|
263
321
|
}
|
|
264
|
-
const jsDate = new
|
|
322
|
+
const jsDate = new DateTime(1899, 11, 30, hours, minutes, seconds);
|
|
265
323
|
return {
|
|
266
324
|
value: hours / 24 + minutes / 1440 + seconds / 86400,
|
|
267
325
|
format: format,
|
|
@@ -275,7 +333,7 @@ function parseTime(str) {
|
|
|
275
333
|
// -----------------------------------------------------------------------------
|
|
276
334
|
function numberToJsDate(value) {
|
|
277
335
|
const truncValue = Math.trunc(value);
|
|
278
|
-
let date =
|
|
336
|
+
let date = DateTime.fromTimestamp(truncValue * 86400 * 1000 - DATE_JS_1900_OFFSET);
|
|
279
337
|
let time = value - truncValue;
|
|
280
338
|
time = time < 0 ? 1 + time : time;
|
|
281
339
|
const hours = Math.round(time * 24);
|
|
@@ -348,7 +406,7 @@ function formatJSTime(jsDate, format) {
|
|
|
348
406
|
.map((p) => {
|
|
349
407
|
switch (p) {
|
|
350
408
|
case "hhhh":
|
|
351
|
-
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY$1) / (60 * 60 * 1000));
|
|
409
|
+
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY$1.getTime()) / (60 * 60 * 1000));
|
|
352
410
|
return helapsedHours.toString();
|
|
353
411
|
case "hh":
|
|
354
412
|
return hours.toString().padStart(2, "0");
|
|
@@ -2867,7 +2925,7 @@ function isBoolean(str) {
|
|
|
2867
2925
|
function isDateTime(str) {
|
|
2868
2926
|
return parseDateTime(str) !== null;
|
|
2869
2927
|
}
|
|
2870
|
-
const MARKDOWN_LINK_REGEX = /^\[(
|
|
2928
|
+
const MARKDOWN_LINK_REGEX = /^\[(.+)\]\((.+)\)$/;
|
|
2871
2929
|
//link must start with http or https
|
|
2872
2930
|
//https://stackoverflow.com/a/3809435/4760614
|
|
2873
2931
|
const WEB_LINK_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
|
|
@@ -4743,7 +4801,7 @@ var database = /*#__PURE__*/Object.freeze({
|
|
|
4743
4801
|
DVARP: DVARP
|
|
4744
4802
|
});
|
|
4745
4803
|
|
|
4746
|
-
const INITIAL_1900_DAY = new
|
|
4804
|
+
const INITIAL_1900_DAY = new DateTime(1899, 11, 30);
|
|
4747
4805
|
const DEFAULT_TYPE = 1;
|
|
4748
4806
|
const DEFAULT_WEEKEND = 1;
|
|
4749
4807
|
function isLeapYear(year) {
|
|
@@ -4772,7 +4830,7 @@ const DATE = {
|
|
|
4772
4830
|
if (_year < 1900) {
|
|
4773
4831
|
_year += 1900;
|
|
4774
4832
|
}
|
|
4775
|
-
const jsDate = new
|
|
4833
|
+
const jsDate = new DateTime(_year, _month - 1, _day);
|
|
4776
4834
|
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
4777
4835
|
assert(() => delta >= 0, _lt(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`));
|
|
4778
4836
|
return Math.round(delta / 86400000);
|
|
@@ -4845,7 +4903,7 @@ const EDATE = {
|
|
|
4845
4903
|
const yStart = _startDate.getFullYear();
|
|
4846
4904
|
const mStart = _startDate.getMonth();
|
|
4847
4905
|
const dStart = _startDate.getDate();
|
|
4848
|
-
const jsDate = new
|
|
4906
|
+
const jsDate = new DateTime(yStart, mStart + _months, dStart);
|
|
4849
4907
|
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
4850
4908
|
return Math.round(delta / 86400000);
|
|
4851
4909
|
},
|
|
@@ -4867,7 +4925,7 @@ const EOMONTH = {
|
|
|
4867
4925
|
const _months = Math.trunc(toNumber(months));
|
|
4868
4926
|
const yStart = _startDate.getFullYear();
|
|
4869
4927
|
const mStart = _startDate.getMonth();
|
|
4870
|
-
const jsDate = new
|
|
4928
|
+
const jsDate = new DateTime(yStart, mStart + _months + 1, 0);
|
|
4871
4929
|
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
4872
4930
|
return Math.round(delta / 86400000);
|
|
4873
4931
|
},
|
|
@@ -4907,17 +4965,17 @@ const ISOWEEKNUM = {
|
|
|
4907
4965
|
// The first week of the year is the week that contains the first
|
|
4908
4966
|
// Thursday of the year.
|
|
4909
4967
|
let firstThursday = 1;
|
|
4910
|
-
while (new
|
|
4968
|
+
while (new DateTime(y, 0, firstThursday).getDay() !== 4) {
|
|
4911
4969
|
firstThursday += 1;
|
|
4912
4970
|
}
|
|
4913
|
-
const firstDayOfFirstWeek = new
|
|
4971
|
+
const firstDayOfFirstWeek = new DateTime(y, 0, firstThursday - 3);
|
|
4914
4972
|
// The last week of the year is the week that contains the last Thursday of
|
|
4915
4973
|
// the year.
|
|
4916
4974
|
let lastThursday = 31;
|
|
4917
|
-
while (new
|
|
4975
|
+
while (new DateTime(y, 11, lastThursday).getDay() !== 4) {
|
|
4918
4976
|
lastThursday -= 1;
|
|
4919
4977
|
}
|
|
4920
|
-
const lastDayOfLastWeek = new
|
|
4978
|
+
const lastDayOfLastWeek = new DateTime(y, 11, lastThursday + 3);
|
|
4921
4979
|
// B - If our date > lastDayOfLastWeek then it's in the weeks of the year after
|
|
4922
4980
|
// If our date < firstDayOfFirstWeek then it's in the weeks of the year before
|
|
4923
4981
|
let offsetYear;
|
|
@@ -4943,17 +5001,17 @@ const ISOWEEKNUM = {
|
|
|
4943
5001
|
case 1:
|
|
4944
5002
|
// firstDay is the 1st day of the 1st week of the year after
|
|
4945
5003
|
// firstDay = lastDayOfLastWeek + 1 Day
|
|
4946
|
-
firstDay = new
|
|
5004
|
+
firstDay = new DateTime(y, 11, lastThursday + 3 + 1);
|
|
4947
5005
|
break;
|
|
4948
5006
|
case -1:
|
|
4949
5007
|
// firstDay is the 1st day of the 1st week of the previous year.
|
|
4950
5008
|
// The first week of the previous year is the week that contains the
|
|
4951
5009
|
// first Thursday of the previous year.
|
|
4952
5010
|
let firstThursdayPreviousYear = 1;
|
|
4953
|
-
while (new
|
|
5011
|
+
while (new DateTime(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
|
|
4954
5012
|
firstThursdayPreviousYear += 1;
|
|
4955
5013
|
}
|
|
4956
|
-
firstDay = new
|
|
5014
|
+
firstDay = new DateTime(y - 1, 0, firstThursdayPreviousYear - 3);
|
|
4957
5015
|
break;
|
|
4958
5016
|
}
|
|
4959
5017
|
const dif = (_date.getTime() - firstDay.getTime()) / 86400000;
|
|
@@ -5092,8 +5150,8 @@ const NETWORKDAYS_INTL = {
|
|
|
5092
5150
|
});
|
|
5093
5151
|
}
|
|
5094
5152
|
const invertDate = _startDate.getTime() > _endDate.getTime();
|
|
5095
|
-
const stopDate =
|
|
5096
|
-
let stepDate =
|
|
5153
|
+
const stopDate = DateTime.fromTimestamp((invertDate ? _startDate : _endDate).getTime());
|
|
5154
|
+
let stepDate = DateTime.fromTimestamp((invertDate ? _endDate : _startDate).getTime());
|
|
5097
5155
|
const timeStopDate = stopDate.getTime();
|
|
5098
5156
|
let timeStepDate = stepDate.getTime();
|
|
5099
5157
|
let netWorkingDay = 0;
|
|
@@ -5117,8 +5175,7 @@ const NOW = {
|
|
|
5117
5175
|
returns: ["DATE"],
|
|
5118
5176
|
returnFormat: { specificFormat: "m/d/yyyy hh:mm:ss" },
|
|
5119
5177
|
compute: function () {
|
|
5120
|
-
let today =
|
|
5121
|
-
today.setMilliseconds(0);
|
|
5178
|
+
let today = DateTime.now();
|
|
5122
5179
|
const delta = today.getTime() - INITIAL_1900_DAY.getTime();
|
|
5123
5180
|
const time = today.getHours() / 24 + today.getMinutes() / 1440 + today.getSeconds() / 86400;
|
|
5124
5181
|
return Math.floor(delta / 86400000) + time;
|
|
@@ -5192,8 +5249,8 @@ const TODAY = {
|
|
|
5192
5249
|
returns: ["DATE"],
|
|
5193
5250
|
returnFormat: { specificFormat: "m/d/yyyy" },
|
|
5194
5251
|
compute: function () {
|
|
5195
|
-
const today =
|
|
5196
|
-
const jsDate = new
|
|
5252
|
+
const today = DateTime.now();
|
|
5253
|
+
const jsDate = new DateTime(today.getFullYear(), today.getMonth(), today.getDate());
|
|
5197
5254
|
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
5198
5255
|
return Math.round(delta / 86400000);
|
|
5199
5256
|
},
|
|
@@ -5249,10 +5306,10 @@ const WEEKNUM = {
|
|
|
5249
5306
|
}
|
|
5250
5307
|
const y = _date.getFullYear();
|
|
5251
5308
|
let dayStart = 1;
|
|
5252
|
-
let startDayOfFirstWeek = new
|
|
5309
|
+
let startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
5253
5310
|
while (startDayOfFirstWeek.getDay() !== startDayOfWeek) {
|
|
5254
5311
|
dayStart += 1;
|
|
5255
|
-
startDayOfFirstWeek = new
|
|
5312
|
+
startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
5256
5313
|
}
|
|
5257
5314
|
const dif = (_date.getTime() - startDayOfFirstWeek.getTime()) / 86400000;
|
|
5258
5315
|
if (dif < 0) {
|
|
@@ -5306,7 +5363,7 @@ const WORKDAY_INTL = {
|
|
|
5306
5363
|
timesHoliday.add(holiday.getTime());
|
|
5307
5364
|
});
|
|
5308
5365
|
}
|
|
5309
|
-
let stepDate =
|
|
5366
|
+
let stepDate = DateTime.fromTimestamp(_startDate.getTime());
|
|
5310
5367
|
let timeStepDate = stepDate.getTime();
|
|
5311
5368
|
const unitDay = Math.sign(_numDays);
|
|
5312
5369
|
let stepDay = Math.abs(_numDays);
|
|
@@ -18729,13 +18786,18 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
18729
18786
|
// Getters
|
|
18730
18787
|
// ---------------------------------------------------------------------------
|
|
18731
18788
|
evaluateFormula(formulaString, sheetId = this.getters.getActiveSheetId()) {
|
|
18732
|
-
|
|
18733
|
-
|
|
18734
|
-
|
|
18735
|
-
|
|
18736
|
-
|
|
18789
|
+
try {
|
|
18790
|
+
const compiledFormula = compile(formulaString);
|
|
18791
|
+
const params = this.getFormulaParameters(() => { });
|
|
18792
|
+
const ranges = [];
|
|
18793
|
+
for (let xc of compiledFormula.dependencies) {
|
|
18794
|
+
ranges.push(this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
18795
|
+
}
|
|
18796
|
+
return compiledFormula.execute(ranges, sheetId, ...params);
|
|
18797
|
+
}
|
|
18798
|
+
catch {
|
|
18799
|
+
return "#ERROR";
|
|
18737
18800
|
}
|
|
18738
|
-
return compiledFormula.execute(ranges, sheetId, ...params);
|
|
18739
18801
|
}
|
|
18740
18802
|
/**
|
|
18741
18803
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -19228,25 +19290,26 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
19228
19290
|
*/
|
|
19229
19291
|
this.rulePredicate = {
|
|
19230
19292
|
CellIsRule: (cell, rule) => {
|
|
19293
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19231
19294
|
if (cell && cell.evaluated.type === CellValueType.error) {
|
|
19232
19295
|
return false;
|
|
19233
19296
|
}
|
|
19234
19297
|
const values = rule.values.map(parsePrimitiveContent);
|
|
19235
19298
|
switch (rule.operator) {
|
|
19236
19299
|
case "IsEmpty":
|
|
19237
|
-
return !isDefined(cell) || cell.evaluated.value.toString().trim() === "";
|
|
19300
|
+
return !isDefined(cell) || ((_a = cell.evaluated.value) === null || _a === void 0 ? void 0 : _a.toString().trim()) === "";
|
|
19238
19301
|
case "IsNotEmpty":
|
|
19239
|
-
return isDefined(cell) && cell.evaluated.value.toString().trim() !== "";
|
|
19302
|
+
return isDefined(cell) && ((_b = cell.evaluated.value) === null || _b === void 0 ? void 0 : _b.toString().trim()) !== "";
|
|
19240
19303
|
case "BeginsWith":
|
|
19241
19304
|
if (!cell && values[0] === "") {
|
|
19242
19305
|
return false;
|
|
19243
19306
|
}
|
|
19244
|
-
return (isDefined(cell) && (cell === null ||
|
|
19307
|
+
return (isDefined(cell) && ((_c = cell.evaluated.value) === null || _c === void 0 ? void 0 : _c.toString().startsWith(values[0].toString())));
|
|
19245
19308
|
case "EndsWith":
|
|
19246
19309
|
if (!cell && values[0] === "") {
|
|
19247
19310
|
return false;
|
|
19248
19311
|
}
|
|
19249
|
-
return isDefined(cell) && cell.evaluated.value.toString().endsWith(values[0].toString());
|
|
19312
|
+
return isDefined(cell) && ((_d = cell.evaluated.value) === null || _d === void 0 ? void 0 : _d.toString().endsWith(values[0].toString()));
|
|
19250
19313
|
case "Between":
|
|
19251
19314
|
return (isDefined(cell) &&
|
|
19252
19315
|
cell.evaluated.value >= values[0] &&
|
|
@@ -19256,11 +19319,11 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
19256
19319
|
cell.evaluated.value >= values[0] &&
|
|
19257
19320
|
cell.evaluated.value <= values[1]);
|
|
19258
19321
|
case "ContainsText":
|
|
19259
|
-
return (isDefined(cell) && cell.evaluated.value.toString().indexOf(values[0].toString()) > -1);
|
|
19322
|
+
return (isDefined(cell) && ((_e = cell.evaluated.value) === null || _e === void 0 ? void 0 : _e.toString().indexOf(values[0].toString())) > -1);
|
|
19260
19323
|
case "NotContains":
|
|
19261
19324
|
return (!isDefined(cell) ||
|
|
19262
19325
|
!cell.evaluated.value ||
|
|
19263
|
-
cell.evaluated.value.toString().indexOf(values[0].toString()) == -1);
|
|
19326
|
+
((_f = cell.evaluated.value) === null || _f === void 0 ? void 0 : _f.toString().indexOf(values[0].toString())) == -1);
|
|
19264
19327
|
case "GreaterThan":
|
|
19265
19328
|
return isDefined(cell) && cell.evaluated.value > values[0];
|
|
19266
19329
|
case "GreaterThanOrEqual":
|
|
@@ -19369,39 +19432,34 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
19369
19432
|
this.computedIcons[activeSheetId] = {};
|
|
19370
19433
|
const computedStyle = this.computedStyles[activeSheetId];
|
|
19371
19434
|
for (let cf of this.getters.getConditionalFormats(activeSheetId)) {
|
|
19372
|
-
|
|
19373
|
-
|
|
19374
|
-
|
|
19375
|
-
|
|
19376
|
-
|
|
19377
|
-
|
|
19378
|
-
|
|
19379
|
-
|
|
19380
|
-
|
|
19381
|
-
|
|
19382
|
-
|
|
19383
|
-
|
|
19384
|
-
|
|
19385
|
-
|
|
19386
|
-
|
|
19387
|
-
for (let
|
|
19388
|
-
|
|
19389
|
-
|
|
19390
|
-
|
|
19391
|
-
if (
|
|
19392
|
-
|
|
19393
|
-
|
|
19394
|
-
|
|
19395
|
-
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
19396
|
-
}
|
|
19435
|
+
switch (cf.rule.type) {
|
|
19436
|
+
case "ColorScaleRule":
|
|
19437
|
+
for (let range of cf.ranges) {
|
|
19438
|
+
this.applyColorScale(range, cf.rule);
|
|
19439
|
+
}
|
|
19440
|
+
break;
|
|
19441
|
+
case "IconSetRule":
|
|
19442
|
+
for (let range of cf.ranges) {
|
|
19443
|
+
this.applyIcon(range, cf.rule);
|
|
19444
|
+
}
|
|
19445
|
+
break;
|
|
19446
|
+
default:
|
|
19447
|
+
for (let ref of cf.ranges) {
|
|
19448
|
+
const zone = toZone(ref);
|
|
19449
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
19450
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
19451
|
+
const pr = this.rulePredicate[cf.rule.type];
|
|
19452
|
+
let cell = this.getters.getCell(activeSheetId, col, row);
|
|
19453
|
+
if (pr && pr(cell, cf.rule)) {
|
|
19454
|
+
if (!computedStyle[col])
|
|
19455
|
+
computedStyle[col] = [];
|
|
19456
|
+
// we must combine all the properties of all the CF rules applied to the given cell
|
|
19457
|
+
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
19397
19458
|
}
|
|
19398
19459
|
}
|
|
19399
19460
|
}
|
|
19400
|
-
|
|
19401
|
-
|
|
19402
|
-
}
|
|
19403
|
-
catch (_) {
|
|
19404
|
-
// we don't care about the errors within the evaluation of a rule
|
|
19461
|
+
}
|
|
19462
|
+
break;
|
|
19405
19463
|
}
|
|
19406
19464
|
}
|
|
19407
19465
|
}
|
|
@@ -19420,7 +19478,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
19420
19478
|
return this.getters.evaluateFormula(`=PERCENTILE(${range},${Number(threshold.value) / 100})`);
|
|
19421
19479
|
case "formula":
|
|
19422
19480
|
const value = threshold.value && this.getters.evaluateFormula(threshold.value);
|
|
19423
|
-
return
|
|
19481
|
+
return typeof value === "number" ? value : null;
|
|
19424
19482
|
default:
|
|
19425
19483
|
return null;
|
|
19426
19484
|
}
|
|
@@ -31383,6 +31441,6 @@ exports.registries = registries;
|
|
|
31383
31441
|
exports.setTranslationMethod = setTranslationMethod;
|
|
31384
31442
|
|
|
31385
31443
|
|
|
31386
|
-
__info__.version = '15.2.
|
|
31387
|
-
__info__.date = '
|
|
31388
|
-
__info__.hash = '
|
|
31444
|
+
__info__.version = '15.2.15';
|
|
31445
|
+
__info__.date = '2024-01-17T10:22:20.395Z';
|
|
31446
|
+
__info__.hash = 'c78b15d';
|