@trebco/treb 29.2.0 → 29.3.2

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.
@@ -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, QuotedSheetNameRegex } from 'treb-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: key },
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 { CompositeNamed } from 'treb-data-model';
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<CompositeNamed & {local_scope?: number}> = [];
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
- CompositeNamed,
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?: CompositeNamed[],
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.UnserializeComposite(import_data.named, this.active_sheet);
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)