@odoo/o-spreadsheet 16.4.23 → 16.4.24

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.
@@ -20671,7 +20671,7 @@ class SelectionInput extends owl.Component {
20671
20671
  : this.props.ranges()
20672
20672
  ? this.props.ranges().map((xc, id) => ({
20673
20673
  xc,
20674
- id,
20674
+ id: id + 1,
20675
20675
  isFocused: false,
20676
20676
  }))
20677
20677
  : [];
@@ -30912,29 +30912,12 @@ const MIGRATIONS = [
30912
30912
  from: 12,
30913
30913
  to: 12.5,
30914
30914
  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;
30915
+ return fixOverlappingFilters(data);
30933
30916
  },
30934
30917
  },
30935
30918
  {
30936
30919
  description: "Change Border description structure",
30937
- from: 12,
30920
+ from: 12.5,
30938
30921
  to: 13,
30939
30922
  applyMigration(data) {
30940
30923
  for (const borderId in data.borders) {
@@ -30965,6 +30948,14 @@ const MIGRATIONS = [
30965
30948
  return data;
30966
30949
  },
30967
30950
  },
30951
+ {
30952
+ description: "Fix datafilter duplication (post saas-16.4)",
30953
+ from: 14,
30954
+ to: 14.5,
30955
+ applyMigration(data) {
30956
+ return fixOverlappingFilters(data);
30957
+ },
30958
+ },
30968
30959
  ];
30969
30960
  /**
30970
30961
  * This function is used to repair faulty data independently of the migration.
@@ -31122,6 +31113,26 @@ function fixChartDefinitions(data, initialMessages) {
31122
31113
  }
31123
31114
  return messages;
31124
31115
  }
31116
+ function fixOverlappingFilters(data) {
31117
+ for (let sheet of data.sheets || []) {
31118
+ let knownDataFilterZones = [];
31119
+ for (let filterTable of sheet.filterTables || []) {
31120
+ const zone = toZone(filterTable.range);
31121
+ // See commit message of https://github.com/odoo/o-spreadsheet/pull/3632 of more details
31122
+ const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
31123
+ if (intersectZoneIndex !== -1) {
31124
+ knownDataFilterZones[intersectZoneIndex] = zone;
31125
+ }
31126
+ else {
31127
+ knownDataFilterZones.push(zone);
31128
+ }
31129
+ }
31130
+ sheet.filterTables = knownDataFilterZones.map((zone) => ({
31131
+ range: zoneToXc(zone),
31132
+ }));
31133
+ }
31134
+ return data;
31135
+ }
31125
31136
  // -----------------------------------------------------------------------------
31126
31137
  // Helpers
31127
31138
  // -----------------------------------------------------------------------------
@@ -41050,14 +41061,12 @@ class SelectionInputsManagerPlugin extends UIPlugin {
41050
41061
  break;
41051
41062
  case "FOCUS_RANGE":
41052
41063
  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
- }
41064
+ const input = this.inputs[cmd.id];
41065
+ const range = input.ranges.find((range) => range.id === cmd.rangeId);
41066
+ if (range) {
41067
+ const sheetId = this.getters.getActiveSheetId();
41068
+ const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone;
41069
+ this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
41061
41070
  this.focusedInputId = cmd.id;
41062
41071
  }
41063
41072
  break;
@@ -51707,6 +51716,6 @@ exports.setTranslationMethod = setTranslationMethod;
51707
51716
  exports.tokenize = tokenize;
51708
51717
 
51709
51718
 
51710
- __info__.version = '16.4.23';
51711
- __info__.date = '2024-02-16T14:23:29.521Z';
51712
- __info__.hash = 'cb5db1a';
51719
+ __info__.version = '16.4.24';
51720
+ __info__.date = '2024-02-28T12:27:32.683Z';
51721
+ __info__.hash = '90c74d1';
@@ -20667,7 +20667,7 @@ class SelectionInput extends Component {
20667
20667
  : this.props.ranges()
20668
20668
  ? this.props.ranges().map((xc, id) => ({
20669
20669
  xc,
20670
- id,
20670
+ id: id + 1,
20671
20671
  isFocused: false,
20672
20672
  }))
20673
20673
  : [];
@@ -30908,29 +30908,12 @@ const MIGRATIONS = [
30908
30908
  from: 12,
30909
30909
  to: 12.5,
30910
30910
  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;
30911
+ return fixOverlappingFilters(data);
30929
30912
  },
30930
30913
  },
30931
30914
  {
30932
30915
  description: "Change Border description structure",
30933
- from: 12,
30916
+ from: 12.5,
30934
30917
  to: 13,
30935
30918
  applyMigration(data) {
30936
30919
  for (const borderId in data.borders) {
@@ -30961,6 +30944,14 @@ const MIGRATIONS = [
30961
30944
  return data;
30962
30945
  },
30963
30946
  },
30947
+ {
30948
+ description: "Fix datafilter duplication (post saas-16.4)",
30949
+ from: 14,
30950
+ to: 14.5,
30951
+ applyMigration(data) {
30952
+ return fixOverlappingFilters(data);
30953
+ },
30954
+ },
30964
30955
  ];
30965
30956
  /**
30966
30957
  * This function is used to repair faulty data independently of the migration.
@@ -31118,6 +31109,26 @@ function fixChartDefinitions(data, initialMessages) {
31118
31109
  }
31119
31110
  return messages;
31120
31111
  }
31112
+ function fixOverlappingFilters(data) {
31113
+ for (let sheet of data.sheets || []) {
31114
+ let knownDataFilterZones = [];
31115
+ for (let filterTable of sheet.filterTables || []) {
31116
+ const zone = toZone(filterTable.range);
31117
+ // See commit message of https://github.com/odoo/o-spreadsheet/pull/3632 of more details
31118
+ const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
31119
+ if (intersectZoneIndex !== -1) {
31120
+ knownDataFilterZones[intersectZoneIndex] = zone;
31121
+ }
31122
+ else {
31123
+ knownDataFilterZones.push(zone);
31124
+ }
31125
+ }
31126
+ sheet.filterTables = knownDataFilterZones.map((zone) => ({
31127
+ range: zoneToXc(zone),
31128
+ }));
31129
+ }
31130
+ return data;
31131
+ }
31121
31132
  // -----------------------------------------------------------------------------
31122
31133
  // Helpers
31123
31134
  // -----------------------------------------------------------------------------
@@ -41046,14 +41057,12 @@ class SelectionInputsManagerPlugin extends UIPlugin {
41046
41057
  break;
41047
41058
  case "FOCUS_RANGE":
41048
41059
  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
- }
41060
+ const input = this.inputs[cmd.id];
41061
+ const range = input.ranges.find((range) => range.id === cmd.rangeId);
41062
+ if (range) {
41063
+ const sheetId = this.getters.getActiveSheetId();
41064
+ const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone;
41065
+ this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
41057
41066
  this.focusedInputId = cmd.id;
41058
41067
  }
41059
41068
  break;
@@ -51671,6 +51680,6 @@ const constants = {
51671
51680
  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
51681
 
51673
51682
 
51674
- __info__.version = '16.4.23';
51675
- __info__.date = '2024-02-16T14:23:29.521Z';
51676
- __info__.hash = 'cb5db1a';
51683
+ __info__.version = '16.4.24';
51684
+ __info__.date = '2024-02-28T12:27:32.683Z';
51685
+ __info__.hash = '90c74d1';
@@ -20668,7 +20668,7 @@
20668
20668
  : this.props.ranges()
20669
20669
  ? this.props.ranges().map((xc, id) => ({
20670
20670
  xc,
20671
- id,
20671
+ id: id + 1,
20672
20672
  isFocused: false,
20673
20673
  }))
20674
20674
  : [];
@@ -30909,29 +30909,12 @@
30909
30909
  from: 12,
30910
30910
  to: 12.5,
30911
30911
  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;
30912
+ return fixOverlappingFilters(data);
30930
30913
  },
30931
30914
  },
30932
30915
  {
30933
30916
  description: "Change Border description structure",
30934
- from: 12,
30917
+ from: 12.5,
30935
30918
  to: 13,
30936
30919
  applyMigration(data) {
30937
30920
  for (const borderId in data.borders) {
@@ -30962,6 +30945,14 @@
30962
30945
  return data;
30963
30946
  },
30964
30947
  },
30948
+ {
30949
+ description: "Fix datafilter duplication (post saas-16.4)",
30950
+ from: 14,
30951
+ to: 14.5,
30952
+ applyMigration(data) {
30953
+ return fixOverlappingFilters(data);
30954
+ },
30955
+ },
30965
30956
  ];
30966
30957
  /**
30967
30958
  * This function is used to repair faulty data independently of the migration.
@@ -31119,6 +31110,26 @@
31119
31110
  }
31120
31111
  return messages;
31121
31112
  }
31113
+ function fixOverlappingFilters(data) {
31114
+ for (let sheet of data.sheets || []) {
31115
+ let knownDataFilterZones = [];
31116
+ for (let filterTable of sheet.filterTables || []) {
31117
+ const zone = toZone(filterTable.range);
31118
+ // See commit message of https://github.com/odoo/o-spreadsheet/pull/3632 of more details
31119
+ const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
31120
+ if (intersectZoneIndex !== -1) {
31121
+ knownDataFilterZones[intersectZoneIndex] = zone;
31122
+ }
31123
+ else {
31124
+ knownDataFilterZones.push(zone);
31125
+ }
31126
+ }
31127
+ sheet.filterTables = knownDataFilterZones.map((zone) => ({
31128
+ range: zoneToXc(zone),
31129
+ }));
31130
+ }
31131
+ return data;
31132
+ }
31122
31133
  // -----------------------------------------------------------------------------
31123
31134
  // Helpers
31124
31135
  // -----------------------------------------------------------------------------
@@ -41047,14 +41058,12 @@
41047
41058
  break;
41048
41059
  case "FOCUS_RANGE":
41049
41060
  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
- }
41061
+ const input = this.inputs[cmd.id];
41062
+ const range = input.ranges.find((range) => range.id === cmd.rangeId);
41063
+ if (range) {
41064
+ const sheetId = this.getters.getActiveSheetId();
41065
+ const zone = this.getters.getRangeFromSheetXC(sheetId, range?.xc || "A1").zone;
41066
+ this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
41058
41067
  this.focusedInputId = cmd.id;
41059
41068
  }
41060
41069
  break;
@@ -51706,9 +51715,9 @@
51706
51715
  Object.defineProperty(exports, '__esModule', { value: true });
51707
51716
 
51708
51717
 
51709
- __info__.version = '16.4.23';
51710
- __info__.date = '2024-02-16T14:23:29.521Z';
51711
- __info__.hash = 'cb5db1a';
51718
+ __info__.version = '16.4.24';
51719
+ __info__.date = '2024-02-28T12:27:32.683Z';
51720
+ __info__.hash = '90c74d1';
51712
51721
 
51713
51722
 
51714
51723
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);