@odoo/o-spreadsheet 16.2.18 → 16.2.19

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.
@@ -4307,6 +4307,9 @@ exports.CommandResult = void 0;
4307
4307
  CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
4308
4308
  })(exports.CommandResult || (exports.CommandResult = {}));
4309
4309
 
4310
+ function isMatrix(x) {
4311
+ return Array.isArray(x) && Array.isArray(x[0]);
4312
+ }
4310
4313
  var DIRECTION;
4311
4314
  (function (DIRECTION) {
4312
4315
  DIRECTION["UP"] = "up";
@@ -15173,6 +15176,36 @@ const HLOOKUP = {
15173
15176
  isExported: true,
15174
15177
  };
15175
15178
  // -----------------------------------------------------------------------------
15179
+ // INDEX
15180
+ // -----------------------------------------------------------------------------
15181
+ const INDEX = {
15182
+ description: _lt(`Returns the content of a cell, specified by row and column offset.`),
15183
+ args: [
15184
+ arg("reference (any, range)", _lt("The range of cells from which the values are returned.")),
15185
+ arg("row (number)", _lt("The index of the row to be returned from within the reference range of cells.")),
15186
+ arg("column (number)", _lt("The index of the column to be returned from within the reference range of cells.")),
15187
+ ],
15188
+ returns: ["ANY"],
15189
+ computeFormat: (reference, row, column) => {
15190
+ var _a;
15191
+ const _row = toNumber(row.value);
15192
+ const _column = toNumber(column.value);
15193
+ return (_a = reference[_column - 1][_row - 1]) === null || _a === void 0 ? void 0 : _a.format;
15194
+ },
15195
+ compute: function (reference, row, column) {
15196
+ const _reference = isMatrix(reference) ? reference : [[reference]];
15197
+ const _row = toNumber(row);
15198
+ const _column = toNumber(column);
15199
+ assert(() => _column >= 0 &&
15200
+ _column - 1 < _reference.length &&
15201
+ _row >= 0 &&
15202
+ _row - 1 < _reference[0].length, _lt("Index out of range."));
15203
+ assert(() => row !== 0 && column !== 0, _lt("This function can only return a single cell value, not an array. Provide valid row and column indices."));
15204
+ return _reference[_column - 1][_row - 1];
15205
+ },
15206
+ isExported: true,
15207
+ };
15208
+ // -----------------------------------------------------------------------------
15176
15209
  // LOOKUP
15177
15210
  // -----------------------------------------------------------------------------
15178
15211
  const LOOKUP = {
@@ -15367,6 +15400,7 @@ var lookup = /*#__PURE__*/Object.freeze({
15367
15400
  COLUMN: COLUMN,
15368
15401
  COLUMNS: COLUMNS,
15369
15402
  HLOOKUP: HLOOKUP,
15403
+ INDEX: INDEX,
15370
15404
  LOOKUP: LOOKUP,
15371
15405
  MATCH: MATCH,
15372
15406
  ROW: ROW,
@@ -25526,12 +25560,15 @@ function createXMLFile(doc, path, contentType) {
25526
25560
  };
25527
25561
  }
25528
25562
  function xmlEscape(str) {
25529
- return String(str)
25563
+ return (String(str)
25530
25564
  .replace(/\&/g, "&amp;")
25531
25565
  .replace(/\</g, "&lt;")
25532
25566
  .replace(/\>/g, "&gt;")
25533
25567
  .replace(/\"/g, "&quot;")
25534
- .replace(/\'/g, "&apos;");
25568
+ .replace(/\'/g, "&apos;")
25569
+ // Delete all ASCII control characters except for TAB (\x09), LF (\x0A) and CR (\x0D)
25570
+ // They are not valid at all in XML 1.0 (even escaped)
25571
+ .replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, ""));
25535
25572
  }
25536
25573
  function formatAttributes(attrs) {
25537
25574
  return new XMLString(attrs.map(([key, val]) => `${key}="${xmlEscape(val)}"`).join(" "));
@@ -32594,6 +32631,10 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
32594
32631
  }
32595
32632
  currentRanges = currentRanges.concat(toAdd);
32596
32633
  const newRangesXC = recomputeZones(currentRanges, toRemove);
32634
+ if (newRangesXC.length === 0) {
32635
+ this.dispatch("REMOVE_CONDITIONAL_FORMAT", { id: cf.id, sheetId });
32636
+ return;
32637
+ }
32597
32638
  this.dispatch("ADD_CONDITIONAL_FORMAT", {
32598
32639
  cf: {
32599
32640
  id: cf.id,
@@ -45485,6 +45526,6 @@ exports.setTranslationMethod = setTranslationMethod;
45485
45526
  exports.tokenize = tokenize;
45486
45527
 
45487
45528
 
45488
- __info__.version = '16.2.18';
45489
- __info__.date = '2023-10-10T07:29:40.321Z';
45490
- __info__.hash = '451fa09';
45529
+ __info__.version = '16.2.19';
45530
+ __info__.date = '2023-10-19T14:22:48.890Z';
45531
+ __info__.hash = '79980d5';
@@ -4303,6 +4303,9 @@ var CommandResult;
4303
4303
  CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
4304
4304
  })(CommandResult || (CommandResult = {}));
4305
4305
 
4306
+ function isMatrix(x) {
4307
+ return Array.isArray(x) && Array.isArray(x[0]);
4308
+ }
4306
4309
  var DIRECTION;
4307
4310
  (function (DIRECTION) {
4308
4311
  DIRECTION["UP"] = "up";
@@ -15169,6 +15172,36 @@ const HLOOKUP = {
15169
15172
  isExported: true,
15170
15173
  };
15171
15174
  // -----------------------------------------------------------------------------
15175
+ // INDEX
15176
+ // -----------------------------------------------------------------------------
15177
+ const INDEX = {
15178
+ description: _lt(`Returns the content of a cell, specified by row and column offset.`),
15179
+ args: [
15180
+ arg("reference (any, range)", _lt("The range of cells from which the values are returned.")),
15181
+ arg("row (number)", _lt("The index of the row to be returned from within the reference range of cells.")),
15182
+ arg("column (number)", _lt("The index of the column to be returned from within the reference range of cells.")),
15183
+ ],
15184
+ returns: ["ANY"],
15185
+ computeFormat: (reference, row, column) => {
15186
+ var _a;
15187
+ const _row = toNumber(row.value);
15188
+ const _column = toNumber(column.value);
15189
+ return (_a = reference[_column - 1][_row - 1]) === null || _a === void 0 ? void 0 : _a.format;
15190
+ },
15191
+ compute: function (reference, row, column) {
15192
+ const _reference = isMatrix(reference) ? reference : [[reference]];
15193
+ const _row = toNumber(row);
15194
+ const _column = toNumber(column);
15195
+ assert(() => _column >= 0 &&
15196
+ _column - 1 < _reference.length &&
15197
+ _row >= 0 &&
15198
+ _row - 1 < _reference[0].length, _lt("Index out of range."));
15199
+ assert(() => row !== 0 && column !== 0, _lt("This function can only return a single cell value, not an array. Provide valid row and column indices."));
15200
+ return _reference[_column - 1][_row - 1];
15201
+ },
15202
+ isExported: true,
15203
+ };
15204
+ // -----------------------------------------------------------------------------
15172
15205
  // LOOKUP
15173
15206
  // -----------------------------------------------------------------------------
15174
15207
  const LOOKUP = {
@@ -15363,6 +15396,7 @@ var lookup = /*#__PURE__*/Object.freeze({
15363
15396
  COLUMN: COLUMN,
15364
15397
  COLUMNS: COLUMNS,
15365
15398
  HLOOKUP: HLOOKUP,
15399
+ INDEX: INDEX,
15366
15400
  LOOKUP: LOOKUP,
15367
15401
  MATCH: MATCH,
15368
15402
  ROW: ROW,
@@ -25522,12 +25556,15 @@ function createXMLFile(doc, path, contentType) {
25522
25556
  };
25523
25557
  }
25524
25558
  function xmlEscape(str) {
25525
- return String(str)
25559
+ return (String(str)
25526
25560
  .replace(/\&/g, "&amp;")
25527
25561
  .replace(/\</g, "&lt;")
25528
25562
  .replace(/\>/g, "&gt;")
25529
25563
  .replace(/\"/g, "&quot;")
25530
- .replace(/\'/g, "&apos;");
25564
+ .replace(/\'/g, "&apos;")
25565
+ // Delete all ASCII control characters except for TAB (\x09), LF (\x0A) and CR (\x0D)
25566
+ // They are not valid at all in XML 1.0 (even escaped)
25567
+ .replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, ""));
25531
25568
  }
25532
25569
  function formatAttributes(attrs) {
25533
25570
  return new XMLString(attrs.map(([key, val]) => `${key}="${xmlEscape(val)}"`).join(" "));
@@ -32590,6 +32627,10 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
32590
32627
  }
32591
32628
  currentRanges = currentRanges.concat(toAdd);
32592
32629
  const newRangesXC = recomputeZones(currentRanges, toRemove);
32630
+ if (newRangesXC.length === 0) {
32631
+ this.dispatch("REMOVE_CONDITIONAL_FORMAT", { id: cf.id, sheetId });
32632
+ return;
32633
+ }
32593
32634
  this.dispatch("ADD_CONDITIONAL_FORMAT", {
32594
32635
  cf: {
32595
32636
  id: cf.id,
@@ -45453,6 +45494,6 @@ function addFunction(functionName, functionDescription) {
45453
45494
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
45454
45495
 
45455
45496
 
45456
- __info__.version = '16.2.18';
45457
- __info__.date = '2023-10-10T07:29:40.321Z';
45458
- __info__.hash = '451fa09';
45497
+ __info__.version = '16.2.19';
45498
+ __info__.date = '2023-10-19T14:22:48.890Z';
45499
+ __info__.hash = '79980d5';
@@ -4304,6 +4304,9 @@
4304
4304
  CommandResult[CommandResult["InvalidQuantity"] = 87] = "InvalidQuantity";
4305
4305
  })(exports.CommandResult || (exports.CommandResult = {}));
4306
4306
 
4307
+ function isMatrix(x) {
4308
+ return Array.isArray(x) && Array.isArray(x[0]);
4309
+ }
4307
4310
  var DIRECTION;
4308
4311
  (function (DIRECTION) {
4309
4312
  DIRECTION["UP"] = "up";
@@ -15170,6 +15173,36 @@
15170
15173
  isExported: true,
15171
15174
  };
15172
15175
  // -----------------------------------------------------------------------------
15176
+ // INDEX
15177
+ // -----------------------------------------------------------------------------
15178
+ const INDEX = {
15179
+ description: _lt(`Returns the content of a cell, specified by row and column offset.`),
15180
+ args: [
15181
+ arg("reference (any, range)", _lt("The range of cells from which the values are returned.")),
15182
+ arg("row (number)", _lt("The index of the row to be returned from within the reference range of cells.")),
15183
+ arg("column (number)", _lt("The index of the column to be returned from within the reference range of cells.")),
15184
+ ],
15185
+ returns: ["ANY"],
15186
+ computeFormat: (reference, row, column) => {
15187
+ var _a;
15188
+ const _row = toNumber(row.value);
15189
+ const _column = toNumber(column.value);
15190
+ return (_a = reference[_column - 1][_row - 1]) === null || _a === void 0 ? void 0 : _a.format;
15191
+ },
15192
+ compute: function (reference, row, column) {
15193
+ const _reference = isMatrix(reference) ? reference : [[reference]];
15194
+ const _row = toNumber(row);
15195
+ const _column = toNumber(column);
15196
+ assert(() => _column >= 0 &&
15197
+ _column - 1 < _reference.length &&
15198
+ _row >= 0 &&
15199
+ _row - 1 < _reference[0].length, _lt("Index out of range."));
15200
+ assert(() => row !== 0 && column !== 0, _lt("This function can only return a single cell value, not an array. Provide valid row and column indices."));
15201
+ return _reference[_column - 1][_row - 1];
15202
+ },
15203
+ isExported: true,
15204
+ };
15205
+ // -----------------------------------------------------------------------------
15173
15206
  // LOOKUP
15174
15207
  // -----------------------------------------------------------------------------
15175
15208
  const LOOKUP = {
@@ -15364,6 +15397,7 @@
15364
15397
  COLUMN: COLUMN,
15365
15398
  COLUMNS: COLUMNS,
15366
15399
  HLOOKUP: HLOOKUP,
15400
+ INDEX: INDEX,
15367
15401
  LOOKUP: LOOKUP,
15368
15402
  MATCH: MATCH,
15369
15403
  ROW: ROW,
@@ -25523,12 +25557,15 @@
25523
25557
  };
25524
25558
  }
25525
25559
  function xmlEscape(str) {
25526
- return String(str)
25560
+ return (String(str)
25527
25561
  .replace(/\&/g, "&amp;")
25528
25562
  .replace(/\</g, "&lt;")
25529
25563
  .replace(/\>/g, "&gt;")
25530
25564
  .replace(/\"/g, "&quot;")
25531
- .replace(/\'/g, "&apos;");
25565
+ .replace(/\'/g, "&apos;")
25566
+ // Delete all ASCII control characters except for TAB (\x09), LF (\x0A) and CR (\x0D)
25567
+ // They are not valid at all in XML 1.0 (even escaped)
25568
+ .replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, ""));
25532
25569
  }
25533
25570
  function formatAttributes(attrs) {
25534
25571
  return new XMLString(attrs.map(([key, val]) => `${key}="${xmlEscape(val)}"`).join(" "));
@@ -32591,6 +32628,10 @@
32591
32628
  }
32592
32629
  currentRanges = currentRanges.concat(toAdd);
32593
32630
  const newRangesXC = recomputeZones(currentRanges, toRemove);
32631
+ if (newRangesXC.length === 0) {
32632
+ this.dispatch("REMOVE_CONDITIONAL_FORMAT", { id: cf.id, sheetId });
32633
+ return;
32634
+ }
32594
32635
  this.dispatch("ADD_CONDITIONAL_FORMAT", {
32595
32636
  cf: {
32596
32637
  id: cf.id,
@@ -45484,9 +45525,9 @@
45484
45525
  Object.defineProperty(exports, '__esModule', { value: true });
45485
45526
 
45486
45527
 
45487
- __info__.version = '16.2.18';
45488
- __info__.date = '2023-10-10T07:29:40.321Z';
45489
- __info__.hash = '451fa09';
45528
+ __info__.version = '16.2.19';
45529
+ __info__.date = '2023-10-19T14:22:48.890Z';
45530
+ __info__.hash = '79980d5';
45490
45531
 
45491
45532
 
45492
45533
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);