@trebco/treb 29.2.0 → 29.3.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.
- package/dist/treb-spreadsheet-light.mjs +7 -7
- package/dist/treb-spreadsheet.mjs +15 -15
- package/dist/treb.d.ts +13 -9
- package/package.json +1 -1
- package/treb-base-types/src/area.ts +7 -0
- package/treb-calculator/src/calculator.ts +10 -8
- package/treb-calculator/src/dag/array-vertex.ts +0 -2
- package/treb-calculator/src/dag/graph.ts +88 -2
- package/treb-calculator/src/dag/spreadsheet_vertex.ts +1 -60
- package/treb-calculator/src/expression-calculator.ts +3 -1
- package/treb-calculator/src/functions/base-functions.ts +6 -1
- package/treb-data-model/src/data_model.ts +59 -20
- package/treb-data-model/src/index.ts +1 -1
- package/treb-data-model/src/named.ts +11 -32
- package/treb-data-model/src/sheet.ts +14 -6
- package/treb-export/src/export2.ts +3 -82
- package/treb-export/src/workbook2.ts +2 -2
- package/treb-grid/src/types/grid.ts +3 -3
|
@@ -54,7 +54,7 @@ import { AddRel } from './relationship';
|
|
|
54
54
|
import { type DOMContent, XMLOptions2 } from './xml-utils';
|
|
55
55
|
|
|
56
56
|
import type { UnitAddress, UnitRange, ExpressionUnit} from 'treb-parser';
|
|
57
|
-
import { Parser
|
|
57
|
+
import { Parser } from 'treb-parser';
|
|
58
58
|
|
|
59
59
|
// FIXME: move
|
|
60
60
|
import type { ChartOptions } from './drawing2/chart2';
|
|
@@ -2464,92 +2464,13 @@ export class Exporter {
|
|
|
2464
2464
|
}
|
|
2465
2465
|
}
|
|
2466
2466
|
|
|
2467
|
-
if (entry.area) {
|
|
2468
|
-
let sheet_name = '';
|
|
2469
|
-
const area = new Area(entry.area.start, entry.area.end);
|
|
2470
|
-
area.start.absolute_column = area.start.absolute_row = true;
|
|
2471
|
-
area.end.absolute_column = area.end.absolute_row = true;
|
|
2472
|
-
|
|
2473
|
-
if (entry.area.start.sheet) {
|
|
2474
|
-
sheet_name = entry.area.start.sheet;
|
|
2475
|
-
}
|
|
2476
|
-
else if (entry.area.start.sheet_id) {
|
|
2477
|
-
for (const sheet of source.sheet_data) {
|
|
2478
|
-
if (sheet.id === area.start.sheet_id) {
|
|
2479
|
-
sheet_name = sheet.name || '';
|
|
2480
|
-
break;
|
|
2481
|
-
}
|
|
2482
|
-
}
|
|
2483
|
-
}
|
|
2484
|
-
|
|
2485
|
-
if (sheet_name) {
|
|
2486
|
-
if (QuotedSheetNameRegex.test(sheet_name)) {
|
|
2487
|
-
sheet_name = `'${sheet_name}'`;
|
|
2488
|
-
}
|
|
2489
|
-
sheet_name += '!';
|
|
2490
|
-
}
|
|
2491
|
-
|
|
2492
|
-
// console.info({key, area, lx: area.spreadsheet_label, sheet_name });
|
|
2493
|
-
definedNames.definedName.push({
|
|
2494
|
-
a$: { name: entry.name, localSheetId: scope },
|
|
2495
|
-
t$: sheet_name + area.spreadsheet_label,
|
|
2496
|
-
});
|
|
2497
|
-
|
|
2498
|
-
}
|
|
2499
|
-
else if (entry.expression) {
|
|
2500
|
-
definedNames.definedName.push({
|
|
2501
|
-
a$: { name: entry.name, localSheetId: scope },
|
|
2502
|
-
t$: entry.expression,
|
|
2503
|
-
});
|
|
2504
|
-
}
|
|
2505
|
-
|
|
2506
|
-
}
|
|
2507
|
-
}
|
|
2508
|
-
|
|
2509
|
-
console.info("DB", definedNames);
|
|
2510
|
-
|
|
2511
|
-
/*
|
|
2512
|
-
if (source.named_ranges) {
|
|
2513
|
-
const keys = Object.keys(source.named_ranges);
|
|
2514
|
-
for (const key of keys) {
|
|
2515
|
-
let sheet_name = '';
|
|
2516
|
-
const area = new Area(source.named_ranges[key].start, source.named_ranges[key].end);
|
|
2517
|
-
area.start.absolute_column = area.start.absolute_row = true;
|
|
2518
|
-
area.end.absolute_column = area.end.absolute_row = true;
|
|
2519
|
-
|
|
2520
|
-
if (area.start.sheet_id) {
|
|
2521
|
-
for (const sheet of source.sheet_data) {
|
|
2522
|
-
if (sheet.id === area.start.sheet_id) {
|
|
2523
|
-
sheet_name = sheet.name || '';
|
|
2524
|
-
break;
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2529
|
-
if (sheet_name) {
|
|
2530
|
-
if (QuotedSheetNameRegex.test(sheet_name)) {
|
|
2531
|
-
sheet_name = `'${sheet_name}'`;
|
|
2532
|
-
}
|
|
2533
|
-
sheet_name += '!';
|
|
2534
|
-
}
|
|
2535
|
-
|
|
2536
|
-
// console.info({key, area, lx: area.spreadsheet_label, sheet_name });
|
|
2537
2467
|
definedNames.definedName.push({
|
|
2538
|
-
a$: { name:
|
|
2539
|
-
t$: sheet_name + area.spreadsheet_label,
|
|
2540
|
-
});
|
|
2541
|
-
|
|
2542
|
-
}
|
|
2543
|
-
}
|
|
2544
|
-
if (source.named_expressions) {
|
|
2545
|
-
for (const entry of source.named_expressions) {
|
|
2546
|
-
definedNames.definedName.push({
|
|
2547
|
-
a$: { name: entry.name },
|
|
2468
|
+
a$: { name: entry.name, localSheetId: scope },
|
|
2548
2469
|
t$: entry.expression,
|
|
2549
2470
|
});
|
|
2471
|
+
|
|
2550
2472
|
}
|
|
2551
2473
|
}
|
|
2552
|
-
*/
|
|
2553
2474
|
|
|
2554
2475
|
if (!definedNames.definedName.length) {
|
|
2555
2476
|
definedNames = undefined;
|
|
@@ -39,7 +39,7 @@ import { Sheet, VisibleState } from './workbook-sheet2';
|
|
|
39
39
|
import type { RelationshipMap } from './relationship';
|
|
40
40
|
import { ZipWrapper } from './zip-wrapper';
|
|
41
41
|
import type { CellStyle } from 'treb-base-types';
|
|
42
|
-
import type {
|
|
42
|
+
import type { SerializedNamed } from 'treb-data-model';
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
/*
|
|
@@ -155,7 +155,7 @@ export class Workbook {
|
|
|
155
155
|
/* * defined names. these can be ranges or expressions. */
|
|
156
156
|
// public defined_names: Record<string, string> = {};
|
|
157
157
|
|
|
158
|
-
public named: Array<
|
|
158
|
+
public named: Array<SerializedNamed & {local_scope?: number}> = [];
|
|
159
159
|
|
|
160
160
|
/** the workbook "rels" */
|
|
161
161
|
public rels: RelationshipMap = {};
|
|
@@ -83,7 +83,7 @@ import type { GridEvent } from './grid_events';
|
|
|
83
83
|
import { ErrorCode } from './grid_events';
|
|
84
84
|
|
|
85
85
|
import type {
|
|
86
|
-
|
|
86
|
+
SerializedNamed,
|
|
87
87
|
DataModel,
|
|
88
88
|
GridSelection,
|
|
89
89
|
LegacySerializedSheet,
|
|
@@ -890,7 +890,7 @@ export class Grid extends GridBase {
|
|
|
890
890
|
import_data: {
|
|
891
891
|
sheets: ImportedSheetData[],
|
|
892
892
|
// names?: Record<string, string|number>,
|
|
893
|
-
named?:
|
|
893
|
+
named?: SerializedNamed[],
|
|
894
894
|
active_tab?: number,
|
|
895
895
|
},
|
|
896
896
|
render = false,
|
|
@@ -972,7 +972,7 @@ export class Grid extends GridBase {
|
|
|
972
972
|
this.model.named.Reset();
|
|
973
973
|
|
|
974
974
|
if (import_data.named) {
|
|
975
|
-
this.model.
|
|
975
|
+
this.model.UnserializeNames(import_data.named, this.active_sheet);
|
|
976
976
|
}
|
|
977
977
|
|
|
978
978
|
// FIXME: do we need to rebuild autocomplete here (A: yes)
|