@trebco/treb 28.15.1 → 28.17.4

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.
@@ -781,6 +781,35 @@ export class Sheet {
781
781
  // assuming we're good to go...
782
782
 
783
783
  area = area.Clone();
784
+
785
+ // so this needs the address, in order to test if it's the head;
786
+ // but we know the head will always be the first one tested (correct?)
787
+
788
+ const cells = [...this.cells.Iterate(area, true)];
789
+
790
+ for (const [index, cell] of cells.entries()) {
791
+
792
+ cell.merge_area = area;
793
+ cell.render_clean = [];
794
+
795
+ if (index) {
796
+ cell.Reset();
797
+ }
798
+
799
+ }
800
+
801
+
802
+ /*
803
+ for (const {column, row, cell} of this.cells.IterateArea(area, true)) {
804
+ cell.merge_area = area;
805
+ cell.render_clean = [];
806
+
807
+ // clear data in !head
808
+ if (column !== area.start.column || row !== area.start.row) cell.Reset();
809
+ }
810
+ */
811
+
812
+ /*
784
813
  this.cells.Apply(area, (cell, c, r) => {
785
814
  cell.merge_area = area;
786
815
  cell.render_clean = [];
@@ -788,6 +817,7 @@ export class Sheet {
788
817
  // clear data in !head
789
818
  if (c !== area.start.column || r !== area.start.row) cell.Reset();
790
819
  }, true);
820
+ */
791
821
 
792
822
  }
793
823
 
@@ -798,7 +828,16 @@ export class Sheet {
798
828
 
799
829
  // let's check:
800
830
 
831
+ for (const cell of this.cells.Iterate(area, false)) {
832
+ if (!cell.merge_area || !area.Equals(cell.merge_area)) {
833
+ console.warn('area mismatch');
834
+ return;
835
+ }
836
+ }
837
+
838
+ /*
801
839
  let match = true;
840
+
802
841
  this.cells.Apply(area, (cell) => {
803
842
  match = match && !!cell.merge_area && area.Equals(cell.merge_area);
804
843
  }, false);
@@ -807,11 +846,19 @@ export class Sheet {
807
846
  console.warn('area mismatch');
808
847
  return;
809
848
  }
849
+ */
810
850
 
851
+ for (const cell of this.cells.Iterate(area, false)) {
852
+ cell.merge_area = undefined;
853
+ cell.render_clean = [];
854
+ }
855
+
856
+ /*
811
857
  this.cells.Apply(area, (cell) => {
812
858
  cell.merge_area = undefined;
813
859
  cell.render_clean = [];
814
860
  }, false);
861
+ */
815
862
 
816
863
  }
817
864
 
@@ -1091,7 +1138,13 @@ export class Sheet {
1091
1138
  * neighboring cells.
1092
1139
  */
1093
1140
  public Invalidate(area: Area): void {
1094
- this.cells.Apply(this.RealArea(area), cell => cell.render_clean = []);
1141
+
1142
+ // this.cells.Apply(this.RealArea(area), cell => cell.render_clean = []);
1143
+
1144
+ for (const cell of this.cells.Iterate(this.RealArea(area), false)) {
1145
+ cell.render_clean = [];
1146
+ }
1147
+
1095
1148
  }
1096
1149
 
1097
1150
  /**
@@ -1118,7 +1171,15 @@ export class Sheet {
1118
1171
  this.UpdateRowStyle(row, style, delta);
1119
1172
  }
1120
1173
  }
1121
- else area.Array().forEach((address) => this.UpdateCellStyle(address, style, delta));
1174
+ else {
1175
+
1176
+ // area.Array().forEach((address) => this.UpdateCellStyle(address, style, delta));
1177
+
1178
+ for (const address of area) {
1179
+ this.UpdateCellStyle(address, style, delta);
1180
+ }
1181
+
1182
+ }
1122
1183
 
1123
1184
  }
1124
1185
 
@@ -1699,10 +1760,18 @@ export class Sheet {
1699
1760
  const patched = new Area(
1700
1761
  { row: head.start.row + count, column: head.start.column },
1701
1762
  { row: head.end.row + count, column: head.end.column });
1763
+
1764
+ for (const address of patched) {
1765
+ const cell = this.cells.GetCell(address, true);
1766
+ cell.area = patched;
1767
+ }
1768
+
1769
+ /*
1702
1770
  patched.Iterate((address) => {
1703
1771
  const cell = this.cells.GetCell(address, true);
1704
1772
  cell.area = patched;
1705
1773
  });
1774
+ */
1706
1775
  }
1707
1776
 
1708
1777
  /*
@@ -1734,10 +1803,18 @@ export class Sheet {
1734
1803
  const patched = new Area(
1735
1804
  patched_start,
1736
1805
  { row: head.end.row + count, column: head.end.column });
1806
+
1807
+ for (const address of patched) {
1808
+ const cell = this.cells.GetCell(address, true);
1809
+ cell.merge_area = patched;
1810
+ }
1811
+
1812
+ /*
1737
1813
  patched.Iterate((address) => {
1738
1814
  const cell = this.cells.GetCell(address, true);
1739
1815
  cell.merge_area = patched;
1740
1816
  });
1817
+ */
1741
1818
  }
1742
1819
 
1743
1820
  // row styles
@@ -1853,10 +1930,18 @@ export class Sheet {
1853
1930
  const patched = new Area(
1854
1931
  { row: head.start.row, column: head.start.column + count },
1855
1932
  { row: head.end.row, column: head.end.column + count });
1933
+
1934
+ for (const address of patched) {
1935
+ const cell = this.cells.GetCell(address, true);
1936
+ cell.area = patched;
1937
+ }
1938
+
1939
+ /*
1856
1940
  patched.Iterate((address) => {
1857
1941
  const cell = this.cells.GetCell(address, true);
1858
1942
  cell.area = patched;
1859
1943
  });
1944
+ */
1860
1945
  }
1861
1946
 
1862
1947
  for (const key of Object.keys(merge_heads)) {
@@ -1866,10 +1951,19 @@ export class Sheet {
1866
1951
  const patched = new Area(
1867
1952
  patched_start,
1868
1953
  { row: head.end.row, column: head.end.column + count });
1954
+
1955
+ for (const address of patched) {
1956
+ const cell = this.cells.GetCell(address, true);
1957
+ cell.merge_area = patched;
1958
+ }
1959
+
1960
+ /*
1869
1961
  patched.Iterate((address) => {
1870
1962
  const cell = this.cells.GetCell(address, true);
1871
1963
  cell.merge_area = patched;
1872
1964
  });
1965
+ */
1966
+
1873
1967
  }
1874
1968
 
1875
1969
  // column styles
@@ -1925,8 +2019,12 @@ export class Sheet {
1925
2019
 
1926
2020
  // assuming it's ok, :
1927
2021
 
1928
- area = this.RealArea(area);
1929
- this.cells.Apply(area, (cell) => cell.Reset());
2022
+ // area = this.RealArea(area);
2023
+ // this.cells.Apply(area, (cell) => cell.Reset());
2024
+
2025
+ for (const cell of this.cells.Iterate(this.RealArea(area), false)) {
2026
+ cell.Reset();
2027
+ }
1930
2028
 
1931
2029
  }
1932
2030
 
@@ -1957,7 +2055,13 @@ export class Sheet {
1957
2055
  */
1958
2056
  public SetArrayValue(area: Area, value: CellValue): void {
1959
2057
  area = this.RealArea(area);
1960
- this.cells.Apply(area, (element) => element.SetArray(area), true);
2058
+
2059
+ // this.cells.Apply(area, (element) => element.SetArray(area), true);
2060
+
2061
+ for (const cell of this.cells.Iterate(area, true)) {
2062
+ cell.SetArray(area);
2063
+ }
2064
+
1961
2065
  const cell = this.cells.GetCell(area.start, true);
1962
2066
  cell.SetArrayHead(area, value);
1963
2067
  }
@@ -2048,6 +2152,15 @@ export class Sheet {
2048
2152
 
2049
2153
  }
2050
2154
 
2155
+ /** specialization */
2156
+ public GetCellStyle(area: ICellAddress, apply_theme?: boolean): CellStyle;
2157
+
2158
+ /** specialization */
2159
+ public GetCellStyle(area: IArea, apply_theme?: boolean): CellStyle[][];
2160
+
2161
+ /** extra specialization */
2162
+ public GetCellStyle<K extends ICellAddress|IArea>(area: K, apply_theme?: boolean): CellStyle|CellStyle[][];
2163
+
2051
2164
  /**
2052
2165
  * this is a new GetCellStyle function, used for external access
2053
2166
  * to style (for API access). there was an old GetCellStyle function
@@ -2970,7 +3083,10 @@ export class Sheet {
2970
3083
 
2971
3084
  // FIXME: ROW PATTERN
2972
3085
 
2973
- this.cells.Apply(this.RealArea(Area.FromRow(row)), (cell) => cell.FlushStyle());
3086
+ // this.cells.Apply(this.RealArea(Area.FromRow(row)), (cell) => cell.FlushStyle());
3087
+ for (const cell of this.cells.Iterate(this.RealArea(Area.FromRow(row)))) {
3088
+ cell.FlushStyle();
3089
+ }
2974
3090
 
2975
3091
  }
2976
3092
 
@@ -3019,7 +3135,11 @@ export class Sheet {
3019
3135
  }
3020
3136
  }
3021
3137
 
3022
- this.cells.Apply(this.RealArea(Area.FromColumn(column)), (cell) => cell.FlushStyle());
3138
+ // this.cells.Apply(this.RealArea(Area.FromColumn(column)), (cell) => cell.FlushStyle());
3139
+
3140
+ for (const cell of this.cells.Iterate(this.RealArea(Area.FromColumn(column)))) {
3141
+ cell.FlushStyle();
3142
+ }
3023
3143
 
3024
3144
  // FIXME: ROW PATTERN
3025
3145