@trebco/treb 29.3.1 → 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.
package/dist/treb.d.ts
CHANGED
|
@@ -1596,6 +1596,13 @@ export interface SerializedMacroFunction {
|
|
|
1596
1596
|
argument_names?: string[];
|
|
1597
1597
|
description?: string;
|
|
1598
1598
|
}
|
|
1599
|
+
|
|
1600
|
+
/**
|
|
1601
|
+
* this type is no longer in use, but we retain it to parse old documents
|
|
1602
|
+
* that use it.
|
|
1603
|
+
*
|
|
1604
|
+
* @deprecated
|
|
1605
|
+
*/
|
|
1599
1606
|
export interface SerializedNamedExpression {
|
|
1600
1607
|
name: string;
|
|
1601
1608
|
expression: string;
|
package/package.json
CHANGED
|
@@ -51,7 +51,7 @@ export interface MacroFunction extends SerializedMacroFunction {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
*
|
|
55
55
|
*/
|
|
56
56
|
export class DataModel {
|
|
57
57
|
|
|
@@ -128,9 +128,7 @@ export class DataModel {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
132
|
-
* need to check if something is a range -- if so, it will just be
|
|
133
|
-
* a single address or range. in that case store it as a named range.
|
|
131
|
+
*
|
|
134
132
|
*/
|
|
135
133
|
public UnserializeNames(names: SerializedNamed[], active_sheet?: Sheet) {
|
|
136
134
|
|
|
@@ -139,6 +137,9 @@ export class DataModel {
|
|
|
139
137
|
|
|
140
138
|
//const sorted = names.map(named => {
|
|
141
139
|
for (const named of names) {
|
|
140
|
+
|
|
141
|
+
if (!named.expression) { continue; }
|
|
142
|
+
|
|
142
143
|
const parse_result = this.parser.Parse(named.expression);
|
|
143
144
|
if (parse_result.expression) {
|
|
144
145
|
|
|
@@ -190,71 +191,11 @@ export class DataModel {
|
|
|
190
191
|
|
|
191
192
|
}
|
|
192
193
|
return undefined;
|
|
193
|
-
} // ).filter((test): test is SerializedNamed => !!test);
|
|
194
|
-
|
|
195
|
-
this.parser.Restore();
|
|
196
|
-
// this.UnserializeNames(sorted, active_sheet);
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/*
|
|
201
|
-
public UnserializeNames(names: SerializedNamed[], active_sheet?: Sheet) {
|
|
202
|
-
|
|
203
|
-
for (const entry of names) {
|
|
204
|
-
|
|
205
|
-
const scope = (typeof entry.scope === 'string') ? this.sheets.ID(entry.scope) : undefined;
|
|
206
|
-
|
|
207
|
-
if (entry.expression) {
|
|
208
|
-
|
|
209
|
-
const parse_result = this.parser.Parse(entry.expression);
|
|
210
|
-
|
|
211
|
-
if (parse_result.valid && parse_result.expression) {
|
|
212
|
-
this.parser.Walk(parse_result.expression, unit => {
|
|
213
|
-
if (unit.type === 'address' || unit.type === 'range') {
|
|
214
|
-
if (unit.type === 'range') {
|
|
215
|
-
unit = unit.start;
|
|
216
|
-
}
|
|
217
|
-
if (!unit.sheet_id) {
|
|
218
|
-
if (unit.sheet) {
|
|
219
|
-
unit.sheet_id = this.sheets.ID(unit.sheet);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
if (!unit.sheet_id) {
|
|
223
|
-
unit.sheet_id = active_sheet?.id;
|
|
224
|
-
}
|
|
225
|
-
return false; // don't continue in ranges
|
|
226
|
-
}
|
|
227
|
-
return true;
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
this.named.SetNamedExpression(entry.name, parse_result.expression, scope);
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
else if (entry.area) {
|
|
236
|
-
if (entry.area.start.sheet) {
|
|
237
|
-
|
|
238
|
-
const area = new Area({
|
|
239
|
-
...entry.area.start,
|
|
240
|
-
sheet_id: this.sheets.ID(entry.area.start.sheet),
|
|
241
|
-
}, entry.area.end);
|
|
242
|
-
|
|
243
|
-
if (area.start.sheet_id) {
|
|
244
|
-
this.named.SetNamedRange(entry.name, area, scope);
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
console.warn("missing sheet ID?", entry.area.start.sheet);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
console.warn("missing sheet name?");
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
194
|
}
|
|
195
|
+
|
|
196
|
+
this.parser.Restore();
|
|
255
197
|
|
|
256
198
|
}
|
|
257
|
-
*/
|
|
258
199
|
|
|
259
200
|
/**
|
|
260
201
|
* serialize names. ranges are easy, but make sure there's a sheet name
|
|
@@ -609,6 +550,12 @@ export interface ViewModel {
|
|
|
609
550
|
view_index: number;
|
|
610
551
|
}
|
|
611
552
|
|
|
553
|
+
/**
|
|
554
|
+
* this type is no longer in use, but we retain it to parse old documents
|
|
555
|
+
* that use it.
|
|
556
|
+
*
|
|
557
|
+
* @deprecated
|
|
558
|
+
*/
|
|
612
559
|
export interface SerializedNamedExpression {
|
|
613
560
|
name: string;
|
|
614
561
|
expression: string;
|