@odoo/o-spreadsheet 18.4.1 → 18.5.0-alpha.1

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.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.4.1
6
- * @date 2025-06-27T09:13:01.303Z
7
- * @hash 5cecc0e
5
+ * @version 18.5.0-alpha.1
6
+ * @date 2025-06-27T09:12:49.245Z
7
+ * @hash 756e75b
8
8
  */
9
9
 
10
10
  'use strict';
@@ -68481,9 +68481,9 @@ autofillModifiersRegistry
68481
68481
  .add("ALPHANUMERIC_INCREMENT_MODIFIER", {
68482
68482
  apply: (rule, data) => {
68483
68483
  rule.current += rule.increment;
68484
- const content = `${rule.prefix}${rule.current
68485
- .toString()
68486
- .padStart(rule.numberPostfixLength || 0, "0")}`;
68484
+ let value = Math.abs(rule.current).toString();
68485
+ value = "0".repeat(Math.max(rule.numberPostfixLength - value.length, 0)) + value;
68486
+ const content = `${rule.prefix}${value}`;
68487
68487
  return {
68488
68488
  cellData: {
68489
68489
  border: data.border,
@@ -68601,6 +68601,7 @@ const autofillRulesRegistry = new Registry();
68601
68601
  const numberPostfixRegExp = /(\d+)$/;
68602
68602
  const stringPrefixRegExp = /^(.*\D+)/;
68603
68603
  const alphaNumericValueRegExp = /^(.*\D+)(\d+)$/;
68604
+ const leadingZerosRegex = /^0*/;
68604
68605
  /**
68605
68606
  * Get the consecutive evaluated cells that can pass the filter function (e.g. certain type filter).
68606
68607
  * Return the one which contains the given cell
@@ -68732,12 +68733,18 @@ autofillRulesRegistry
68732
68733
  generateRule: (cell, cells, direction) => {
68733
68734
  const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
68734
68735
  const prefix = cell.content.match(stringPrefixRegExp)[0];
68735
- const numberPostfixLength = cell.content.length - prefix.length;
68736
68736
  const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === CellValueType.text &&
68737
- alphaNumericValueRegExp.test(evaluatedCell.value)) // get consecutive alphanumeric cells, no matter what the prefix is
68737
+ alphaNumericValueRegExp.test(evaluatedCell.value))
68738
+ // get consecutive alphanumeric cells, no matter what the prefix is
68738
68739
  .filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0])
68739
- .map((cell) => parseInt((cell.value ?? "").toString().match(numberPostfixRegExp)[0]));
68740
- let increment = calculateIncrementBasedOnGroup(group);
68740
+ .map((cell) => (cell.value ?? "").toString().match(numberPostfixRegExp)[0]);
68741
+ // find the length of number with the most leading zeros
68742
+ const mostLeadingZeros = group.reduce((candidate, current) => {
68743
+ const currentLength = current.match(leadingZerosRegex)[0].length;
68744
+ return currentLength > candidate[1] ? [current, currentLength] : candidate;
68745
+ }, [group[0], 0]);
68746
+ const numberPostfixLength = mostLeadingZeros[1] ? mostLeadingZeros[0].length : 0;
68747
+ let increment = calculateIncrementBasedOnGroup(group.map((x) => parseInt(x)));
68741
68748
  if (["up", "left"].includes(direction) && group.length === 1) {
68742
68749
  increment = -increment;
68743
68750
  }
@@ -84524,6 +84531,6 @@ exports.tokenColors = tokenColors;
84524
84531
  exports.tokenize = tokenize;
84525
84532
 
84526
84533
 
84527
- __info__.version = "18.4.1";
84528
- __info__.date = "2025-06-27T09:13:01.303Z";
84529
- __info__.hash = "5cecc0e";
84534
+ __info__.version = "18.5.0-alpha.1";
84535
+ __info__.date = "2025-06-27T09:12:49.245Z";
84536
+ __info__.hash = "756e75b";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.4.1
6
- * @date 2025-06-27T09:13:01.303Z
7
- * @hash 5cecc0e
5
+ * @version 18.5.0-alpha.1
6
+ * @date 2025-06-27T09:12:49.245Z
7
+ * @hash 756e75b
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, App, blockDom, useState, onPatched, useExternalListener, onWillUpdateProps, onWillStart, onWillPatch, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -68479,9 +68479,9 @@ autofillModifiersRegistry
68479
68479
  .add("ALPHANUMERIC_INCREMENT_MODIFIER", {
68480
68480
  apply: (rule, data) => {
68481
68481
  rule.current += rule.increment;
68482
- const content = `${rule.prefix}${rule.current
68483
- .toString()
68484
- .padStart(rule.numberPostfixLength || 0, "0")}`;
68482
+ let value = Math.abs(rule.current).toString();
68483
+ value = "0".repeat(Math.max(rule.numberPostfixLength - value.length, 0)) + value;
68484
+ const content = `${rule.prefix}${value}`;
68485
68485
  return {
68486
68486
  cellData: {
68487
68487
  border: data.border,
@@ -68599,6 +68599,7 @@ const autofillRulesRegistry = new Registry();
68599
68599
  const numberPostfixRegExp = /(\d+)$/;
68600
68600
  const stringPrefixRegExp = /^(.*\D+)/;
68601
68601
  const alphaNumericValueRegExp = /^(.*\D+)(\d+)$/;
68602
+ const leadingZerosRegex = /^0*/;
68602
68603
  /**
68603
68604
  * Get the consecutive evaluated cells that can pass the filter function (e.g. certain type filter).
68604
68605
  * Return the one which contains the given cell
@@ -68730,12 +68731,18 @@ autofillRulesRegistry
68730
68731
  generateRule: (cell, cells, direction) => {
68731
68732
  const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
68732
68733
  const prefix = cell.content.match(stringPrefixRegExp)[0];
68733
- const numberPostfixLength = cell.content.length - prefix.length;
68734
68734
  const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === CellValueType.text &&
68735
- alphaNumericValueRegExp.test(evaluatedCell.value)) // get consecutive alphanumeric cells, no matter what the prefix is
68735
+ alphaNumericValueRegExp.test(evaluatedCell.value))
68736
+ // get consecutive alphanumeric cells, no matter what the prefix is
68736
68737
  .filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0])
68737
- .map((cell) => parseInt((cell.value ?? "").toString().match(numberPostfixRegExp)[0]));
68738
- let increment = calculateIncrementBasedOnGroup(group);
68738
+ .map((cell) => (cell.value ?? "").toString().match(numberPostfixRegExp)[0]);
68739
+ // find the length of number with the most leading zeros
68740
+ const mostLeadingZeros = group.reduce((candidate, current) => {
68741
+ const currentLength = current.match(leadingZerosRegex)[0].length;
68742
+ return currentLength > candidate[1] ? [current, currentLength] : candidate;
68743
+ }, [group[0], 0]);
68744
+ const numberPostfixLength = mostLeadingZeros[1] ? mostLeadingZeros[0].length : 0;
68745
+ let increment = calculateIncrementBasedOnGroup(group.map((x) => parseInt(x)));
68739
68746
  if (["up", "left"].includes(direction) && group.length === 1) {
68740
68747
  increment = -increment;
68741
68748
  }
@@ -84474,6 +84481,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
84474
84481
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, ClientDisconnectedError, CommandResult, CorePlugin, CoreViewPlugin, DispatchResult, EvaluationError, LocalTransportService, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
84475
84482
 
84476
84483
 
84477
- __info__.version = "18.4.1";
84478
- __info__.date = "2025-06-27T09:13:01.303Z";
84479
- __info__.hash = "5cecc0e";
84484
+ __info__.version = "18.5.0-alpha.1";
84485
+ __info__.date = "2025-06-27T09:12:49.245Z";
84486
+ __info__.hash = "756e75b";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.4.1
6
- * @date 2025-06-27T09:13:01.303Z
7
- * @hash 5cecc0e
5
+ * @version 18.5.0-alpha.1
6
+ * @date 2025-06-27T09:12:49.245Z
7
+ * @hash 756e75b
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -68480,9 +68480,9 @@ stores.inject(MyMetaStore, storeInstance);
68480
68480
  .add("ALPHANUMERIC_INCREMENT_MODIFIER", {
68481
68481
  apply: (rule, data) => {
68482
68482
  rule.current += rule.increment;
68483
- const content = `${rule.prefix}${rule.current
68484
- .toString()
68485
- .padStart(rule.numberPostfixLength || 0, "0")}`;
68483
+ let value = Math.abs(rule.current).toString();
68484
+ value = "0".repeat(Math.max(rule.numberPostfixLength - value.length, 0)) + value;
68485
+ const content = `${rule.prefix}${value}`;
68486
68486
  return {
68487
68487
  cellData: {
68488
68488
  border: data.border,
@@ -68600,6 +68600,7 @@ stores.inject(MyMetaStore, storeInstance);
68600
68600
  const numberPostfixRegExp = /(\d+)$/;
68601
68601
  const stringPrefixRegExp = /^(.*\D+)/;
68602
68602
  const alphaNumericValueRegExp = /^(.*\D+)(\d+)$/;
68603
+ const leadingZerosRegex = /^0*/;
68603
68604
  /**
68604
68605
  * Get the consecutive evaluated cells that can pass the filter function (e.g. certain type filter).
68605
68606
  * Return the one which contains the given cell
@@ -68731,12 +68732,18 @@ stores.inject(MyMetaStore, storeInstance);
68731
68732
  generateRule: (cell, cells, direction) => {
68732
68733
  const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
68733
68734
  const prefix = cell.content.match(stringPrefixRegExp)[0];
68734
- const numberPostfixLength = cell.content.length - prefix.length;
68735
68735
  const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === CellValueType.text &&
68736
- alphaNumericValueRegExp.test(evaluatedCell.value)) // get consecutive alphanumeric cells, no matter what the prefix is
68736
+ alphaNumericValueRegExp.test(evaluatedCell.value))
68737
+ // get consecutive alphanumeric cells, no matter what the prefix is
68737
68738
  .filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0])
68738
- .map((cell) => parseInt((cell.value ?? "").toString().match(numberPostfixRegExp)[0]));
68739
- let increment = calculateIncrementBasedOnGroup(group);
68739
+ .map((cell) => (cell.value ?? "").toString().match(numberPostfixRegExp)[0]);
68740
+ // find the length of number with the most leading zeros
68741
+ const mostLeadingZeros = group.reduce((candidate, current) => {
68742
+ const currentLength = current.match(leadingZerosRegex)[0].length;
68743
+ return currentLength > candidate[1] ? [current, currentLength] : candidate;
68744
+ }, [group[0], 0]);
68745
+ const numberPostfixLength = mostLeadingZeros[1] ? mostLeadingZeros[0].length : 0;
68746
+ let increment = calculateIncrementBasedOnGroup(group.map((x) => parseInt(x)));
68740
68747
  if (["up", "left"].includes(direction) && group.length === 1) {
68741
68748
  increment = -increment;
68742
68749
  }
@@ -84523,9 +84530,9 @@ stores.inject(MyMetaStore, storeInstance);
84523
84530
  exports.tokenize = tokenize;
84524
84531
 
84525
84532
 
84526
- __info__.version = "18.4.1";
84527
- __info__.date = "2025-06-27T09:13:01.303Z";
84528
- __info__.hash = "5cecc0e";
84533
+ __info__.version = "18.5.0-alpha.1";
84534
+ __info__.date = "2025-06-27T09:12:49.245Z";
84535
+ __info__.hash = "756e75b";
84529
84536
 
84530
84537
 
84531
84538
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);