@odoo/o-spreadsheet 16.4.23 → 16.4.25

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.
@@ -5232,8 +5232,10 @@ function getGroup(cell, cells, filter) {
5232
5232
  if (x === cell) {
5233
5233
  found = true;
5234
5234
  }
5235
- const cellValue = evaluateLiteral(x?.content, { locale: DEFAULT_LOCALE });
5236
- if (filter(cellValue)) {
5235
+ const cellValue = x?.isFormula
5236
+ ? undefined
5237
+ : evaluateLiteral(x?.content, { locale: DEFAULT_LOCALE });
5238
+ if (cellValue && filter(cellValue)) {
5237
5239
  group.push(cellValue);
5238
5240
  }
5239
5241
  else {
@@ -20671,7 +20673,7 @@ class SelectionInput extends owl.Component {
20671
20673
  : this.props.ranges()
20672
20674
  ? this.props.ranges().map((xc, id) => ({
20673
20675
  xc,
20674
- id,
20676
+ id: id + 1,
20675
20677
  isFocused: false,
20676
20678
  }))
20677
20679
  : [];
@@ -24784,7 +24786,11 @@ class GridComposer extends owl.Component {
24784
24786
  }
24785
24787
  }
24786
24788
  updateCellReferenceVisibility() {
24787
- if (this.isCellReferenceVisible || this.env.model.getters.getEditionMode() === "inactive") {
24789
+ if (this.env.model.getters.getEditionMode() === "inactive") {
24790
+ this.isCellReferenceVisible = false;
24791
+ return;
24792
+ }
24793
+ if (this.isCellReferenceVisible) {
24788
24794
  return;
24789
24795
  }
24790
24796
  const sheetId = this.env.model.getters.getActiveSheetId();
@@ -30912,29 +30918,12 @@ const MIGRATIONS = [
30912
30918
  from: 12,
30913
30919
  to: 12.5,
30914
30920
  applyMigration(data) {
30915
- for (let sheet of data.sheets || []) {
30916
- let knownDataFilterZones = [];
30917
- for (let filterTable of sheet.filterTables || []) {
30918
- const zone = toZone(filterTable.range);
30919
- // See commit message for the details
30920
- const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
30921
- if (intersectZoneIndex !== -1) {
30922
- knownDataFilterZones[intersectZoneIndex] = zone;
30923
- }
30924
- else {
30925
- knownDataFilterZones.push(zone);
30926
- }
30927
- }
30928
- sheet.filterTables = knownDataFilterZones.map((zone) => ({
30929
- range: zoneToXc(zone),
30930
- }));
30931
- }
30932
- return data;
30921
+ return fixOverlappingFilters(data);
30933
30922
  },
30934
30923
  },
30935
30924
  {
30936
30925
  description: "Change Border description structure",
30937
- from: 12,
30926
+ from: 12.5,
30938
30927
  to: 13,
30939
30928
  applyMigration(data) {
30940
30929
  for (const borderId in data.borders) {
@@ -30965,6 +30954,14 @@ const MIGRATIONS = [
30965
30954
  return data;
30966
30955
  },
30967
30956
  },
30957
+ {
30958
+ description: "Fix datafilter duplication (post saas-16.4)",
30959
+ from: 14,
30960
+ to: 14.5,
30961
+ applyMigration(data) {
30962
+ return fixOverlappingFilters(data);
30963
+ },
30964
+ },
30968
30965
  ];
30969
30966
  /**
30970
30967
  * This function is used to repair faulty data independently of the migration.
@@ -31122,6 +31119,26 @@ function fixChartDefinitions(data, initialMessages) {
31122
31119
  }
31123
31120
  return messages;
31124
31121
  }
31122
+ function fixOverlappingFilters(data) {
31123
+ for (let sheet of data.sheets || []) {
31124
+ let knownDataFilterZones = [];
31125
+ for (let filterTable of sheet.filterTables || []) {
31126
+ const zone = toZone(filterTable.range);
31127
+ // See commit message of https://github.com/odoo/o-spreadsheet/pull/3632 of more details
31128
+ const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
31129
+ if (intersectZoneIndex !== -1) {
31130
+ knownDataFilterZones[intersectZoneIndex] = zone;
31131
+ }
31132
+ else {
31133
+ knownDataFilterZones.push(zone);
31134
+ }
31135
+ }
31136
+ sheet.filterTables = knownDataFilterZones.map((zone) => ({
31137
+ range: zoneToXc(zone),
31138
+ }));
31139
+ }
31140
+ return data;
31141
+ }
31125
31142
  // -----------------------------------------------------------------------------
31126
31143
  // Helpers
31127
31144
  // -----------------------------------------------------------------------------
@@ -34654,7 +34671,6 @@ class SheetPlugin extends CorePlugin {
34654
34671
  "getNumberHeaders",
34655
34672
  "getGridLinesVisibility",
34656
34673
  "getNextSheetName",
34657
- "isEmpty",
34658
34674
  "getSheetSize",
34659
34675
  "getSheetZone",
34660
34676
  "getPaneDivisions",
@@ -35030,14 +35046,6 @@ class SheetPlugin extends CorePlugin {
35030
35046
  // ---------------------------------------------------------------------------
35031
35047
  // Row/Col manipulation
35032
35048
  // ---------------------------------------------------------------------------
35033
- /**
35034
- * Check if a zone only contains empty cells
35035
- */
35036
- isEmpty(sheetId, zone) {
35037
- return positions(zone)
35038
- .map(({ col, row }) => this.getCell({ sheetId, col, row }))
35039
- .every((cell) => !cell || cell.content === "");
35040
- }
35041
35049
  getCommandZones(cmd) {
35042
35050
  const zones = [];
35043
35051
  if ("zone" in cmd) {
@@ -37097,6 +37105,7 @@ class EvaluationPlugin extends UIPlugin {
37097
37105
  "getEvaluatedCell",
37098
37106
  "getEvaluatedCells",
37099
37107
  "getEvaluatedCellsInZone",
37108
+ "isEmpty",
37100
37109
  ];
37101
37110
  shouldRebuildDependenciesGraph = true;
37102
37111
  evaluator;
@@ -37195,6 +37204,14 @@ class EvaluationPlugin extends UIPlugin {
37195
37204
  getEvaluatedCellsInZone(sheetId, zone) {
37196
37205
  return positions(zone).map(({ col, row }) => this.getters.getEvaluatedCell({ sheetId, col, row }));
37197
37206
  }
37207
+ /**
37208
+ * Check if a zone only contains empty cells
37209
+ */
37210
+ isEmpty(sheetId, zone) {
37211
+ return positions(zone)
37212
+ .map(({ col, row }) => this.getEvaluatedCell({ sheetId, col, row }))
37213
+ .every((cell) => cell.type === CellValueType.empty);
37214
+ }
37198
37215
  // ---------------------------------------------------------------------------
37199
37216
  // Export
37200
37217
  // ---------------------------------------------------------------------------
@@ -41050,14 +41067,12 @@ class SelectionInputsManagerPlugin extends UIPlugin {
41050
41067
  break;
41051
41068
  case "FOCUS_RANGE":
41052
41069
  case "CHANGE_RANGE":
41053
- if (cmd.id !== this.focusedInputId) {
41054
- const input = this.inputs[cmd.id];
41055
- const range = input.ranges.find((range) => range.id === cmd.rangeId);
41056
- if (this.isRangeValid(range?.xc || "A1")) {
41057
- const sheetId = this.getters.getActiveSheetId();
41058
- const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone;
41059
- this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
41060
- }
41070
+ const input = this.inputs[cmd.id];
41071
+ const range = input.ranges.find((range) => range.id === cmd.rangeId);
41072
+ if (range) {
41073
+ const sheetId = this.getters.getActiveSheetId();
41074
+ const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone;
41075
+ this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
41061
41076
  this.focusedInputId = cmd.id;
41062
41077
  }
41063
41078
  break;
@@ -51707,6 +51722,6 @@ exports.setTranslationMethod = setTranslationMethod;
51707
51722
  exports.tokenize = tokenize;
51708
51723
 
51709
51724
 
51710
- __info__.version = '16.4.23';
51711
- __info__.date = '2024-02-16T14:23:29.521Z';
51712
- __info__.hash = 'cb5db1a';
51725
+ __info__.version = '16.4.25';
51726
+ __info__.date = '2024-03-12T07:54:10.025Z';
51727
+ __info__.hash = '182ad16';
@@ -3648,7 +3648,7 @@ interface SheetState$1 {
3648
3648
  readonly cellPosition: Record<UID, CellPosition | undefined>;
3649
3649
  }
3650
3650
  declare class SheetPlugin extends CorePlugin<SheetState$1> implements SheetState$1 {
3651
- static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "getCell", "getCellPosition", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "isEmpty", "getSheetSize", "getSheetZone", "getPaneDivisions", "checkZonesExistInSheet", "getCommandZones", "getUnboundedZone", "checkElementsIncludeAllNonFrozenHeaders"];
3651
+ static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "getCell", "getCellPosition", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "getSheetSize", "getSheetZone", "getPaneDivisions", "checkZonesExistInSheet", "getCommandZones", "getUnboundedZone", "checkElementsIncludeAllNonFrozenHeaders"];
3652
3652
  readonly sheetIdsMapName: Record<string, UID | undefined>;
3653
3653
  readonly orderedSheetIds: UID[];
3654
3654
  readonly sheets: Record<UID, Sheet | undefined>;
@@ -3696,10 +3696,6 @@ declare class SheetPlugin extends CorePlugin<SheetState$1> implements SheetState
3696
3696
  * This validation ensures that all rows or columns cannot be deleted when frozen panes exist.
3697
3697
  */
3698
3698
  checkElementsIncludeAllNonFrozenHeaders(sheetId: UID, dimension: Dimension, elements: HeaderIndex[]): boolean;
3699
- /**
3700
- * Check if a zone only contains empty cells
3701
- */
3702
- isEmpty(sheetId: UID, zone: Zone): boolean;
3703
3699
  getCommandZones(cmd: Command): Zone[];
3704
3700
  /**
3705
3701
  * Check if zones in the command are well formed and
@@ -3794,7 +3790,7 @@ declare class SheetPlugin extends CorePlugin<SheetState$1> implements SheetState
3794
3790
  }
3795
3791
 
3796
3792
  declare class EvaluationPlugin extends UIPlugin {
3797
- static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone"];
3793
+ static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "isEmpty"];
3798
3794
  private shouldRebuildDependenciesGraph;
3799
3795
  private evaluator;
3800
3796
  private positionsToUpdate;
@@ -3818,6 +3814,10 @@ declare class EvaluationPlugin extends UIPlugin {
3818
3814
  getEvaluatedCell(position: CellPosition): EvaluatedCell;
3819
3815
  getEvaluatedCells(sheetId: UID): Record<UID, EvaluatedCell>;
3820
3816
  getEvaluatedCellsInZone(sheetId: UID, zone: Zone): EvaluatedCell[];
3817
+ /**
3818
+ * Check if a zone only contains empty cells
3819
+ */
3820
+ isEmpty(sheetId: UID, zone: Zone): boolean;
3821
3821
  exportForExcel(data: ExcelWorkbookData): void;
3822
3822
  /**
3823
3823
  * Returns the corresponding formula cell of a given cell
@@ -5228,8 +5228,10 @@ function getGroup(cell, cells, filter) {
5228
5228
  if (x === cell) {
5229
5229
  found = true;
5230
5230
  }
5231
- const cellValue = evaluateLiteral(x?.content, { locale: DEFAULT_LOCALE });
5232
- if (filter(cellValue)) {
5231
+ const cellValue = x?.isFormula
5232
+ ? undefined
5233
+ : evaluateLiteral(x?.content, { locale: DEFAULT_LOCALE });
5234
+ if (cellValue && filter(cellValue)) {
5233
5235
  group.push(cellValue);
5234
5236
  }
5235
5237
  else {
@@ -20667,7 +20669,7 @@ class SelectionInput extends Component {
20667
20669
  : this.props.ranges()
20668
20670
  ? this.props.ranges().map((xc, id) => ({
20669
20671
  xc,
20670
- id,
20672
+ id: id + 1,
20671
20673
  isFocused: false,
20672
20674
  }))
20673
20675
  : [];
@@ -24780,7 +24782,11 @@ class GridComposer extends Component {
24780
24782
  }
24781
24783
  }
24782
24784
  updateCellReferenceVisibility() {
24783
- if (this.isCellReferenceVisible || this.env.model.getters.getEditionMode() === "inactive") {
24785
+ if (this.env.model.getters.getEditionMode() === "inactive") {
24786
+ this.isCellReferenceVisible = false;
24787
+ return;
24788
+ }
24789
+ if (this.isCellReferenceVisible) {
24784
24790
  return;
24785
24791
  }
24786
24792
  const sheetId = this.env.model.getters.getActiveSheetId();
@@ -30908,29 +30914,12 @@ const MIGRATIONS = [
30908
30914
  from: 12,
30909
30915
  to: 12.5,
30910
30916
  applyMigration(data) {
30911
- for (let sheet of data.sheets || []) {
30912
- let knownDataFilterZones = [];
30913
- for (let filterTable of sheet.filterTables || []) {
30914
- const zone = toZone(filterTable.range);
30915
- // See commit message for the details
30916
- const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
30917
- if (intersectZoneIndex !== -1) {
30918
- knownDataFilterZones[intersectZoneIndex] = zone;
30919
- }
30920
- else {
30921
- knownDataFilterZones.push(zone);
30922
- }
30923
- }
30924
- sheet.filterTables = knownDataFilterZones.map((zone) => ({
30925
- range: zoneToXc(zone),
30926
- }));
30927
- }
30928
- return data;
30917
+ return fixOverlappingFilters(data);
30929
30918
  },
30930
30919
  },
30931
30920
  {
30932
30921
  description: "Change Border description structure",
30933
- from: 12,
30922
+ from: 12.5,
30934
30923
  to: 13,
30935
30924
  applyMigration(data) {
30936
30925
  for (const borderId in data.borders) {
@@ -30961,6 +30950,14 @@ const MIGRATIONS = [
30961
30950
  return data;
30962
30951
  },
30963
30952
  },
30953
+ {
30954
+ description: "Fix datafilter duplication (post saas-16.4)",
30955
+ from: 14,
30956
+ to: 14.5,
30957
+ applyMigration(data) {
30958
+ return fixOverlappingFilters(data);
30959
+ },
30960
+ },
30964
30961
  ];
30965
30962
  /**
30966
30963
  * This function is used to repair faulty data independently of the migration.
@@ -31118,6 +31115,26 @@ function fixChartDefinitions(data, initialMessages) {
31118
31115
  }
31119
31116
  return messages;
31120
31117
  }
31118
+ function fixOverlappingFilters(data) {
31119
+ for (let sheet of data.sheets || []) {
31120
+ let knownDataFilterZones = [];
31121
+ for (let filterTable of sheet.filterTables || []) {
31122
+ const zone = toZone(filterTable.range);
31123
+ // See commit message of https://github.com/odoo/o-spreadsheet/pull/3632 of more details
31124
+ const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
31125
+ if (intersectZoneIndex !== -1) {
31126
+ knownDataFilterZones[intersectZoneIndex] = zone;
31127
+ }
31128
+ else {
31129
+ knownDataFilterZones.push(zone);
31130
+ }
31131
+ }
31132
+ sheet.filterTables = knownDataFilterZones.map((zone) => ({
31133
+ range: zoneToXc(zone),
31134
+ }));
31135
+ }
31136
+ return data;
31137
+ }
31121
31138
  // -----------------------------------------------------------------------------
31122
31139
  // Helpers
31123
31140
  // -----------------------------------------------------------------------------
@@ -34650,7 +34667,6 @@ class SheetPlugin extends CorePlugin {
34650
34667
  "getNumberHeaders",
34651
34668
  "getGridLinesVisibility",
34652
34669
  "getNextSheetName",
34653
- "isEmpty",
34654
34670
  "getSheetSize",
34655
34671
  "getSheetZone",
34656
34672
  "getPaneDivisions",
@@ -35026,14 +35042,6 @@ class SheetPlugin extends CorePlugin {
35026
35042
  // ---------------------------------------------------------------------------
35027
35043
  // Row/Col manipulation
35028
35044
  // ---------------------------------------------------------------------------
35029
- /**
35030
- * Check if a zone only contains empty cells
35031
- */
35032
- isEmpty(sheetId, zone) {
35033
- return positions(zone)
35034
- .map(({ col, row }) => this.getCell({ sheetId, col, row }))
35035
- .every((cell) => !cell || cell.content === "");
35036
- }
35037
35045
  getCommandZones(cmd) {
35038
35046
  const zones = [];
35039
35047
  if ("zone" in cmd) {
@@ -37093,6 +37101,7 @@ class EvaluationPlugin extends UIPlugin {
37093
37101
  "getEvaluatedCell",
37094
37102
  "getEvaluatedCells",
37095
37103
  "getEvaluatedCellsInZone",
37104
+ "isEmpty",
37096
37105
  ];
37097
37106
  shouldRebuildDependenciesGraph = true;
37098
37107
  evaluator;
@@ -37191,6 +37200,14 @@ class EvaluationPlugin extends UIPlugin {
37191
37200
  getEvaluatedCellsInZone(sheetId, zone) {
37192
37201
  return positions(zone).map(({ col, row }) => this.getters.getEvaluatedCell({ sheetId, col, row }));
37193
37202
  }
37203
+ /**
37204
+ * Check if a zone only contains empty cells
37205
+ */
37206
+ isEmpty(sheetId, zone) {
37207
+ return positions(zone)
37208
+ .map(({ col, row }) => this.getEvaluatedCell({ sheetId, col, row }))
37209
+ .every((cell) => cell.type === CellValueType.empty);
37210
+ }
37194
37211
  // ---------------------------------------------------------------------------
37195
37212
  // Export
37196
37213
  // ---------------------------------------------------------------------------
@@ -41046,14 +41063,12 @@ class SelectionInputsManagerPlugin extends UIPlugin {
41046
41063
  break;
41047
41064
  case "FOCUS_RANGE":
41048
41065
  case "CHANGE_RANGE":
41049
- if (cmd.id !== this.focusedInputId) {
41050
- const input = this.inputs[cmd.id];
41051
- const range = input.ranges.find((range) => range.id === cmd.rangeId);
41052
- if (this.isRangeValid(range?.xc || "A1")) {
41053
- const sheetId = this.getters.getActiveSheetId();
41054
- const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone;
41055
- this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
41056
- }
41066
+ const input = this.inputs[cmd.id];
41067
+ const range = input.ranges.find((range) => range.id === cmd.rangeId);
41068
+ if (range) {
41069
+ const sheetId = this.getters.getActiveSheetId();
41070
+ const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone;
41071
+ this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
41057
41072
  this.focusedInputId = cmd.id;
41058
41073
  }
41059
41074
  break;
@@ -51671,6 +51686,6 @@ const constants = {
51671
51686
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
51672
51687
 
51673
51688
 
51674
- __info__.version = '16.4.23';
51675
- __info__.date = '2024-02-16T14:23:29.521Z';
51676
- __info__.hash = 'cb5db1a';
51689
+ __info__.version = '16.4.25';
51690
+ __info__.date = '2024-03-12T07:54:10.025Z';
51691
+ __info__.hash = '182ad16';
@@ -5229,8 +5229,10 @@
5229
5229
  if (x === cell) {
5230
5230
  found = true;
5231
5231
  }
5232
- const cellValue = evaluateLiteral(x?.content, { locale: DEFAULT_LOCALE });
5233
- if (filter(cellValue)) {
5232
+ const cellValue = x?.isFormula
5233
+ ? undefined
5234
+ : evaluateLiteral(x?.content, { locale: DEFAULT_LOCALE });
5235
+ if (cellValue && filter(cellValue)) {
5234
5236
  group.push(cellValue);
5235
5237
  }
5236
5238
  else {
@@ -20668,7 +20670,7 @@
20668
20670
  : this.props.ranges()
20669
20671
  ? this.props.ranges().map((xc, id) => ({
20670
20672
  xc,
20671
- id,
20673
+ id: id + 1,
20672
20674
  isFocused: false,
20673
20675
  }))
20674
20676
  : [];
@@ -24781,7 +24783,11 @@
24781
24783
  }
24782
24784
  }
24783
24785
  updateCellReferenceVisibility() {
24784
- if (this.isCellReferenceVisible || this.env.model.getters.getEditionMode() === "inactive") {
24786
+ if (this.env.model.getters.getEditionMode() === "inactive") {
24787
+ this.isCellReferenceVisible = false;
24788
+ return;
24789
+ }
24790
+ if (this.isCellReferenceVisible) {
24785
24791
  return;
24786
24792
  }
24787
24793
  const sheetId = this.env.model.getters.getActiveSheetId();
@@ -30909,29 +30915,12 @@
30909
30915
  from: 12,
30910
30916
  to: 12.5,
30911
30917
  applyMigration(data) {
30912
- for (let sheet of data.sheets || []) {
30913
- let knownDataFilterZones = [];
30914
- for (let filterTable of sheet.filterTables || []) {
30915
- const zone = toZone(filterTable.range);
30916
- // See commit message for the details
30917
- const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
30918
- if (intersectZoneIndex !== -1) {
30919
- knownDataFilterZones[intersectZoneIndex] = zone;
30920
- }
30921
- else {
30922
- knownDataFilterZones.push(zone);
30923
- }
30924
- }
30925
- sheet.filterTables = knownDataFilterZones.map((zone) => ({
30926
- range: zoneToXc(zone),
30927
- }));
30928
- }
30929
- return data;
30918
+ return fixOverlappingFilters(data);
30930
30919
  },
30931
30920
  },
30932
30921
  {
30933
30922
  description: "Change Border description structure",
30934
- from: 12,
30923
+ from: 12.5,
30935
30924
  to: 13,
30936
30925
  applyMigration(data) {
30937
30926
  for (const borderId in data.borders) {
@@ -30962,6 +30951,14 @@
30962
30951
  return data;
30963
30952
  },
30964
30953
  },
30954
+ {
30955
+ description: "Fix datafilter duplication (post saas-16.4)",
30956
+ from: 14,
30957
+ to: 14.5,
30958
+ applyMigration(data) {
30959
+ return fixOverlappingFilters(data);
30960
+ },
30961
+ },
30965
30962
  ];
30966
30963
  /**
30967
30964
  * This function is used to repair faulty data independently of the migration.
@@ -31119,6 +31116,26 @@
31119
31116
  }
31120
31117
  return messages;
31121
31118
  }
31119
+ function fixOverlappingFilters(data) {
31120
+ for (let sheet of data.sheets || []) {
31121
+ let knownDataFilterZones = [];
31122
+ for (let filterTable of sheet.filterTables || []) {
31123
+ const zone = toZone(filterTable.range);
31124
+ // See commit message of https://github.com/odoo/o-spreadsheet/pull/3632 of more details
31125
+ const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
31126
+ if (intersectZoneIndex !== -1) {
31127
+ knownDataFilterZones[intersectZoneIndex] = zone;
31128
+ }
31129
+ else {
31130
+ knownDataFilterZones.push(zone);
31131
+ }
31132
+ }
31133
+ sheet.filterTables = knownDataFilterZones.map((zone) => ({
31134
+ range: zoneToXc(zone),
31135
+ }));
31136
+ }
31137
+ return data;
31138
+ }
31122
31139
  // -----------------------------------------------------------------------------
31123
31140
  // Helpers
31124
31141
  // -----------------------------------------------------------------------------
@@ -34651,7 +34668,6 @@
34651
34668
  "getNumberHeaders",
34652
34669
  "getGridLinesVisibility",
34653
34670
  "getNextSheetName",
34654
- "isEmpty",
34655
34671
  "getSheetSize",
34656
34672
  "getSheetZone",
34657
34673
  "getPaneDivisions",
@@ -35027,14 +35043,6 @@
35027
35043
  // ---------------------------------------------------------------------------
35028
35044
  // Row/Col manipulation
35029
35045
  // ---------------------------------------------------------------------------
35030
- /**
35031
- * Check if a zone only contains empty cells
35032
- */
35033
- isEmpty(sheetId, zone) {
35034
- return positions(zone)
35035
- .map(({ col, row }) => this.getCell({ sheetId, col, row }))
35036
- .every((cell) => !cell || cell.content === "");
35037
- }
35038
35046
  getCommandZones(cmd) {
35039
35047
  const zones = [];
35040
35048
  if ("zone" in cmd) {
@@ -37094,6 +37102,7 @@
37094
37102
  "getEvaluatedCell",
37095
37103
  "getEvaluatedCells",
37096
37104
  "getEvaluatedCellsInZone",
37105
+ "isEmpty",
37097
37106
  ];
37098
37107
  shouldRebuildDependenciesGraph = true;
37099
37108
  evaluator;
@@ -37192,6 +37201,14 @@
37192
37201
  getEvaluatedCellsInZone(sheetId, zone) {
37193
37202
  return positions(zone).map(({ col, row }) => this.getters.getEvaluatedCell({ sheetId, col, row }));
37194
37203
  }
37204
+ /**
37205
+ * Check if a zone only contains empty cells
37206
+ */
37207
+ isEmpty(sheetId, zone) {
37208
+ return positions(zone)
37209
+ .map(({ col, row }) => this.getEvaluatedCell({ sheetId, col, row }))
37210
+ .every((cell) => cell.type === CellValueType.empty);
37211
+ }
37195
37212
  // ---------------------------------------------------------------------------
37196
37213
  // Export
37197
37214
  // ---------------------------------------------------------------------------
@@ -41047,14 +41064,12 @@
41047
41064
  break;
41048
41065
  case "FOCUS_RANGE":
41049
41066
  case "CHANGE_RANGE":
41050
- if (cmd.id !== this.focusedInputId) {
41051
- const input = this.inputs[cmd.id];
41052
- const range = input.ranges.find((range) => range.id === cmd.rangeId);
41053
- if (this.isRangeValid(range?.xc || "A1")) {
41054
- const sheetId = this.getters.getActiveSheetId();
41055
- const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone;
41056
- this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
41057
- }
41067
+ const input = this.inputs[cmd.id];
41068
+ const range = input.ranges.find((range) => range.id === cmd.rangeId);
41069
+ if (range) {
41070
+ const sheetId = this.getters.getActiveSheetId();
41071
+ const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone;
41072
+ this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
41058
41073
  this.focusedInputId = cmd.id;
41059
41074
  }
41060
41075
  break;
@@ -51706,9 +51721,9 @@
51706
51721
  Object.defineProperty(exports, '__esModule', { value: true });
51707
51722
 
51708
51723
 
51709
- __info__.version = '16.4.23';
51710
- __info__.date = '2024-02-16T14:23:29.521Z';
51711
- __info__.hash = 'cb5db1a';
51724
+ __info__.version = '16.4.25';
51725
+ __info__.date = '2024-03-12T07:54:10.025Z';
51726
+ __info__.hash = '182ad16';
51712
51727
 
51713
51728
 
51714
51729
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);