@trebco/treb 28.15.0 → 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.
- package/api-generator/api-generator.ts +5 -1
- package/dist/treb-spreadsheet-light.mjs +10 -10
- package/dist/treb-spreadsheet.mjs +15 -15
- package/dist/treb.d.ts +6 -1
- package/package.json +1 -1
- package/treb-base-types/src/area.ts +80 -1
- package/treb-base-types/src/cells.ts +187 -41
- package/treb-calculator/src/calculator.ts +13 -1
- package/treb-calculator/src/functions/base-functions.ts +71 -0
- package/treb-calculator/src/utilities.ts +37 -24
- package/treb-embed/markup/toolbar.html +5 -0
- package/treb-embed/src/custom-element/spreadsheet-constructor.ts +5 -2
- package/treb-embed/src/embedded-spreadsheet.ts +46 -19
- package/treb-embed/src/options.ts +5 -0
- package/treb-embed/src/toolbar-message.ts +5 -0
- package/treb-embed/style/toolbar.scss +3 -0
- package/treb-embed/style/treb-icons.scss +6 -0
- package/treb-export/src/import2.ts +5 -16
- package/treb-export/src/workbook-style2.ts +15 -27
- package/treb-grid/src/render/tile_renderer.ts +37 -13
- package/treb-grid/src/types/grid.ts +49 -3
- package/treb-grid/src/types/grid_base.ts +156 -8
- package/treb-grid/src/types/grid_command.ts +8 -0
- package/treb-grid/src/types/sheet.ts +127 -7
|
@@ -841,33 +841,49 @@ export class GridBase {
|
|
|
841
841
|
|
|
842
842
|
let valid = true;
|
|
843
843
|
|
|
844
|
-
sheet.cells.
|
|
844
|
+
for (const cell of sheet.cells.Iterate(area)) {
|
|
845
|
+
|
|
845
846
|
if (cell.style?.locked) {
|
|
846
847
|
console.info('invalid: locked cells');
|
|
847
|
-
|
|
848
|
+
return false;
|
|
848
849
|
}
|
|
849
850
|
if (cell.merge_area) {
|
|
850
851
|
if (!area.Contains(cell.merge_area.start) || !area.Contains(cell.merge_area.end)) {
|
|
851
852
|
console.info('invalid: merge area');
|
|
852
|
-
|
|
853
|
+
return false;
|
|
853
854
|
}
|
|
854
855
|
}
|
|
855
856
|
if (cell.area) {
|
|
856
857
|
if (!area.Contains(cell.area.start) || !area.Contains(cell.area.end)) {
|
|
857
858
|
console.info('invalid: array');
|
|
859
|
+
return false;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/*
|
|
866
|
+
sheet.cells.Apply2(area, cell => {
|
|
867
|
+
if (cell.style?.locked) {
|
|
868
|
+
console.info('invalid: locked cells');
|
|
869
|
+
valid = false;
|
|
870
|
+
}
|
|
871
|
+
if (cell.merge_area) {
|
|
872
|
+
if (!area.Contains(cell.merge_area.start) || !area.Contains(cell.merge_area.end)) {
|
|
873
|
+
console.info('invalid: merge area');
|
|
858
874
|
valid = false;
|
|
859
875
|
}
|
|
860
876
|
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
console.info('invalid: table');
|
|
877
|
+
if (cell.area) {
|
|
878
|
+
if (!area.Contains(cell.area.start) || !area.Contains(cell.area.end)) {
|
|
879
|
+
console.info('invalid: array');
|
|
865
880
|
valid = false;
|
|
866
881
|
}
|
|
867
882
|
}
|
|
868
|
-
|
|
883
|
+
|
|
869
884
|
return valid;
|
|
870
885
|
});
|
|
886
|
+
*/
|
|
871
887
|
|
|
872
888
|
if (!valid) {
|
|
873
889
|
return false;
|
|
@@ -1406,6 +1422,46 @@ export class GridBase {
|
|
|
1406
1422
|
// duh, no we don't. if the cell is in the table it will have
|
|
1407
1423
|
// a reference.
|
|
1408
1424
|
|
|
1425
|
+
for (const cell of sheet.cells.Iterate()) {
|
|
1426
|
+
|
|
1427
|
+
if (cell.ValueIsFormula()) {
|
|
1428
|
+
let updated_formula = false;
|
|
1429
|
+
const parse_result = this.parser.Parse(cell.value);
|
|
1430
|
+
if (parse_result.expression) {
|
|
1431
|
+
|
|
1432
|
+
this.parser.Walk(parse_result.expression, (unit) => {
|
|
1433
|
+
if (unit.type === 'structured-reference') {
|
|
1434
|
+
|
|
1435
|
+
if (unit.table.toLowerCase() === table_name ||
|
|
1436
|
+
(!unit.table && cell.table === table)) {
|
|
1437
|
+
|
|
1438
|
+
// we may need to rewrite...
|
|
1439
|
+
for (const [key, value] of update.entries()) {
|
|
1440
|
+
if (unit.column.toLowerCase() === key) {
|
|
1441
|
+
|
|
1442
|
+
// ok we need to update
|
|
1443
|
+
unit.column = value;
|
|
1444
|
+
updated_formula = true;
|
|
1445
|
+
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
return true;
|
|
1452
|
+
});
|
|
1453
|
+
if (updated_formula) {
|
|
1454
|
+
console.info('updating value');
|
|
1455
|
+
cell.value = '=' + this.parser.Render(parse_result.expression, {
|
|
1456
|
+
missing: '',
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
/*
|
|
1409
1465
|
sheet.cells.IterateAll(cell => {
|
|
1410
1466
|
if (cell.ValueIsFormula()) {
|
|
1411
1467
|
let updated_formula = false;
|
|
@@ -1442,6 +1498,7 @@ export class GridBase {
|
|
|
1442
1498
|
}
|
|
1443
1499
|
}
|
|
1444
1500
|
});
|
|
1501
|
+
*/
|
|
1445
1502
|
|
|
1446
1503
|
}
|
|
1447
1504
|
}
|
|
@@ -1843,6 +1900,7 @@ export class GridBase {
|
|
|
1843
1900
|
case CommandKey.Clear:
|
|
1844
1901
|
case CommandKey.SetNote:
|
|
1845
1902
|
case CommandKey.SetLink:
|
|
1903
|
+
case CommandKey.Indent:
|
|
1846
1904
|
case CommandKey.UpdateBorders:
|
|
1847
1905
|
case CommandKey.MergeCells:
|
|
1848
1906
|
case CommandKey.UnmergeCells:
|
|
@@ -2135,6 +2193,17 @@ export class GridBase {
|
|
|
2135
2193
|
for (const sheet of sheets) {
|
|
2136
2194
|
|
|
2137
2195
|
// cells
|
|
2196
|
+
for (const cell of sheet.cells.Iterate()) {
|
|
2197
|
+
if (cell.ValueIsFormula()) {
|
|
2198
|
+
const updated = this.PatchExpressionSheetName(cell.value||'', old_name, name);
|
|
2199
|
+
if (updated) {
|
|
2200
|
+
cell.value = updated;
|
|
2201
|
+
changes++;
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
/*
|
|
2138
2207
|
sheet.cells.IterateAll((cell: Cell) => {
|
|
2139
2208
|
if (cell.ValueIsFormula()) {
|
|
2140
2209
|
const updated = this.PatchExpressionSheetName(cell.value||'', old_name, name);
|
|
@@ -2144,6 +2213,7 @@ export class GridBase {
|
|
|
2144
2213
|
}
|
|
2145
2214
|
}
|
|
2146
2215
|
});
|
|
2216
|
+
*/
|
|
2147
2217
|
|
|
2148
2218
|
// conditionals
|
|
2149
2219
|
if (sheet.conditional_formats?.length) {
|
|
@@ -2448,12 +2518,21 @@ export class GridBase {
|
|
|
2448
2518
|
let error = false;
|
|
2449
2519
|
area = sheet.RealArea(area); // collapse
|
|
2450
2520
|
|
|
2521
|
+
for (const cell of sheet.cells.Iterate(area)) {
|
|
2522
|
+
if (cell.area && !area.ContainsArea(cell.area)) {
|
|
2523
|
+
this.Error(ErrorCode.array);
|
|
2524
|
+
return;
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
/*
|
|
2451
2529
|
sheet.cells.Apply(area, (cell) => {
|
|
2452
2530
|
if (cell.area && !area.ContainsArea(cell.area)) {
|
|
2453
2531
|
// throw new Error('can\'t change part of an array');
|
|
2454
2532
|
error = true;
|
|
2455
2533
|
}
|
|
2456
2534
|
});
|
|
2535
|
+
*/
|
|
2457
2536
|
|
|
2458
2537
|
// if the area completely encloses a table, delete the table
|
|
2459
2538
|
const table_keys = this.model.tables.keys();
|
|
@@ -2870,6 +2949,18 @@ export class GridBase {
|
|
|
2870
2949
|
for (const sheet of this.model.sheets.list) {
|
|
2871
2950
|
const is_target = sheet === target_sheet;
|
|
2872
2951
|
|
|
2952
|
+
for (const cell of sheet.cells.Iterate()) {
|
|
2953
|
+
if (cell.ValueIsFormula()) {
|
|
2954
|
+
const modified = this.PatchFormulasInternal(cell.value || '',
|
|
2955
|
+
command.before_row, command.count, 0, 0,
|
|
2956
|
+
target_sheet_name, is_target);
|
|
2957
|
+
if (modified) {
|
|
2958
|
+
cell.value = modified;
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
/*
|
|
2873
2964
|
sheet.cells.IterateAll((cell: Cell) => {
|
|
2874
2965
|
if (cell.ValueIsFormula()) {
|
|
2875
2966
|
const modified = this.PatchFormulasInternal(cell.value || '',
|
|
@@ -2880,6 +2971,7 @@ export class GridBase {
|
|
|
2880
2971
|
}
|
|
2881
2972
|
}
|
|
2882
2973
|
});
|
|
2974
|
+
*/
|
|
2883
2975
|
|
|
2884
2976
|
for (const annotation of sheet.annotations) {
|
|
2885
2977
|
if (annotation.data.formula) {
|
|
@@ -3216,6 +3308,18 @@ export class GridBase {
|
|
|
3216
3308
|
for (const sheet of this.model.sheets.list) {
|
|
3217
3309
|
const is_target = sheet === target_sheet;
|
|
3218
3310
|
|
|
3311
|
+
for (const cell of sheet.cells.Iterate()) {
|
|
3312
|
+
if (cell.ValueIsFormula()) {
|
|
3313
|
+
const modified = this.PatchFormulasInternal(cell.value || '', 0, 0,
|
|
3314
|
+
command.before_column, command.count,
|
|
3315
|
+
target_sheet_name, is_target);
|
|
3316
|
+
if (modified) {
|
|
3317
|
+
cell.value = modified;
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
}
|
|
3321
|
+
|
|
3322
|
+
/*
|
|
3219
3323
|
sheet.cells.IterateAll((cell: Cell) => {
|
|
3220
3324
|
if (cell.ValueIsFormula()) {
|
|
3221
3325
|
const modified = this.PatchFormulasInternal(cell.value || '', 0, 0,
|
|
@@ -3226,6 +3330,7 @@ export class GridBase {
|
|
|
3226
3330
|
}
|
|
3227
3331
|
}
|
|
3228
3332
|
});
|
|
3333
|
+
*/
|
|
3229
3334
|
|
|
3230
3335
|
for (const annotation of sheet.annotations) {
|
|
3231
3336
|
if (annotation.data.formula) {
|
|
@@ -3760,6 +3865,15 @@ export class GridBase {
|
|
|
3760
3865
|
const list: Record<string, Area> = {};
|
|
3761
3866
|
const area = new Area(command.area.start, command.area.end);
|
|
3762
3867
|
|
|
3868
|
+
for (const cell of sheet.cells.Iterate(area, false)) {
|
|
3869
|
+
if (cell.merge_area) {
|
|
3870
|
+
const label = Area.CellAddressToLabel(cell.merge_area.start) + ':'
|
|
3871
|
+
+ Area.CellAddressToLabel(cell.merge_area.end);
|
|
3872
|
+
list[label] = cell.merge_area;
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3875
|
+
|
|
3876
|
+
/*
|
|
3763
3877
|
sheet.cells.Apply(area, (cell: Cell) => {
|
|
3764
3878
|
if (cell.merge_area) {
|
|
3765
3879
|
const label = Area.CellAddressToLabel(cell.merge_area.start) + ':'
|
|
@@ -3767,6 +3881,7 @@ export class GridBase {
|
|
|
3767
3881
|
list[label] = cell.merge_area;
|
|
3768
3882
|
}
|
|
3769
3883
|
}, false);
|
|
3884
|
+
*/
|
|
3770
3885
|
|
|
3771
3886
|
const keys = Object.keys(list);
|
|
3772
3887
|
|
|
@@ -3795,6 +3910,39 @@ export class GridBase {
|
|
|
3795
3910
|
}
|
|
3796
3911
|
break;
|
|
3797
3912
|
|
|
3913
|
+
case CommandKey.Indent:
|
|
3914
|
+
{
|
|
3915
|
+
let area: Area|undefined;
|
|
3916
|
+
const sheet = this.FindSheet(command.area);
|
|
3917
|
+
|
|
3918
|
+
if (IsCellAddress(command.area)) {
|
|
3919
|
+
area = new Area(command.area);
|
|
3920
|
+
const style = sheet.GetCellStyle(command.area, true);
|
|
3921
|
+
sheet.UpdateCellStyle(command.area, {
|
|
3922
|
+
indent: Math.max(0, (style.indent || 0) + command.delta),
|
|
3923
|
+
}, true);
|
|
3924
|
+
}
|
|
3925
|
+
else {
|
|
3926
|
+
area = new Area(command.area.start, command.area.end);
|
|
3927
|
+
for (const address of area) {
|
|
3928
|
+
const style = sheet.GetCellStyle(address, true);
|
|
3929
|
+
sheet.UpdateCellStyle(address, {
|
|
3930
|
+
indent: Math.max(0, (style.indent || 0) + command.delta),
|
|
3931
|
+
}, true);
|
|
3932
|
+
};
|
|
3933
|
+
}
|
|
3934
|
+
|
|
3935
|
+
if (sheet === this.active_sheet) {
|
|
3936
|
+
flags.style_area = Area.Join(area, flags.style_area);
|
|
3937
|
+
flags.render_area = Area.Join(area, flags.render_area);
|
|
3938
|
+
}
|
|
3939
|
+
else {
|
|
3940
|
+
flags.style_event = true;
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3943
|
+
}
|
|
3944
|
+
break;
|
|
3945
|
+
|
|
3798
3946
|
case CommandKey.UpdateStyle:
|
|
3799
3947
|
{
|
|
3800
3948
|
// COEDITING: handles sheet ID properly
|
|
@@ -52,6 +52,7 @@ export enum CommandKey {
|
|
|
52
52
|
SetRange,
|
|
53
53
|
UpdateStyle,
|
|
54
54
|
UpdateBorders,
|
|
55
|
+
Indent,
|
|
55
56
|
MergeCells,
|
|
56
57
|
UnmergeCells,
|
|
57
58
|
Clear,
|
|
@@ -278,6 +279,12 @@ export interface UpdateBordersCommand {
|
|
|
278
279
|
width?: number;
|
|
279
280
|
}
|
|
280
281
|
|
|
282
|
+
export interface IndentCommand {
|
|
283
|
+
key: CommandKey.Indent,
|
|
284
|
+
area: IArea,
|
|
285
|
+
delta: number,
|
|
286
|
+
}
|
|
287
|
+
|
|
281
288
|
/** update style in area. area can be cell(s), sheet, row(s), column(s) */
|
|
282
289
|
export interface UpdateStyleCommand {
|
|
283
290
|
key: CommandKey.UpdateStyle;
|
|
@@ -465,6 +472,7 @@ export type Command =
|
|
|
465
472
|
| ResetCommand
|
|
466
473
|
| SelectCommand
|
|
467
474
|
| FreezeCommand
|
|
475
|
+
| IndentCommand
|
|
468
476
|
| SetNoteCommand
|
|
469
477
|
| SetLinkCommand
|
|
470
478
|
| SetNameCommand
|
|
@@ -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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|