@trebco/treb 27.5.2 → 27.7.6
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.mjs +14 -14
- package/dist/treb.d.ts +17 -3
- package/package.json +3 -3
- package/treb-calculator/src/calculator.ts +15 -104
- package/treb-embed/src/embedded-spreadsheet.ts +30 -30
- package/treb-embed/style/formula-bar.scss +2 -0
- package/treb-embed/style/theme-defaults.scss +46 -15
- package/treb-grid/src/editors/editor.ts +1276 -0
- package/treb-grid/src/editors/external_editor.ts +113 -0
- package/treb-grid/src/editors/formula_bar.ts +450 -474
- package/treb-grid/src/editors/overlay_editor.ts +437 -512
- package/treb-grid/src/index.ts +1 -1
- package/treb-grid/src/layout/base_layout.ts +1 -1
- package/treb-grid/src/render/tile_renderer.ts +7 -1
- package/treb-grid/src/types/data_model.ts +130 -3
- package/treb-grid/src/types/external_editor_config.ts +47 -0
- package/treb-grid/src/types/grid.ts +91 -39
- package/treb-grid/src/types/grid_base.ts +1 -2
- package/treb-grid/src/types/scale-control.ts +1 -1
- package/treb-grid/src/util/dom_utilities.ts +58 -25
- package/treb-grid/src/editors/formula_editor_base.ts +0 -912
- package/treb-grid/src/types/external_editor.ts +0 -27
package/dist/treb.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! API v27.
|
|
1
|
+
/*! API v27.7. Copyright 2018-2023 trebco, llc. All rights reserved. LGPL: https://treb.app/license */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* add our tag to the map
|
|
@@ -316,7 +316,7 @@ export declare class EmbeddedSpreadsheet {
|
|
|
316
316
|
* to support outside tooling by highlighting a list of arguments and
|
|
317
317
|
* responding to selection.
|
|
318
318
|
*/
|
|
319
|
-
ExternalEditor(
|
|
319
|
+
ExternalEditor(config?: Partial<ExternalEditorConfig>): void;
|
|
320
320
|
|
|
321
321
|
/**
|
|
322
322
|
* Use this function to batch multiple document changes. Essentially the
|
|
@@ -1055,7 +1055,7 @@ export interface SetRangeOptions {
|
|
|
1055
1055
|
*/
|
|
1056
1056
|
r1c1?: boolean;
|
|
1057
1057
|
}
|
|
1058
|
-
export interface
|
|
1058
|
+
export interface ExternalEditorConfig {
|
|
1059
1059
|
|
|
1060
1060
|
/**
|
|
1061
1061
|
* list of dependencies to highlight. we support undefined entries in
|
|
@@ -1074,6 +1074,20 @@ export interface ExternalEditorType {
|
|
|
1074
1074
|
* practice.
|
|
1075
1075
|
*/
|
|
1076
1076
|
update: ExternalEditorCallback;
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* a list of nodes that will serve as editors. when you attach, we will do
|
|
1080
|
+
* an initial pass of context highlighting. we highlight on text changes
|
|
1081
|
+
* and insert references if you make a selection in the spreadsheet while
|
|
1082
|
+
* an editor is focused.
|
|
1083
|
+
*/
|
|
1084
|
+
nodes: HTMLElement[];
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* assume that we're editing a formula. does not require leading `=`.
|
|
1088
|
+
* defaults to `true` for historical reasons.
|
|
1089
|
+
*/
|
|
1090
|
+
assume_formula?: boolean;
|
|
1077
1091
|
}
|
|
1078
1092
|
export type DependencyList = Array<IArea | ICellAddress | undefined>;
|
|
1079
1093
|
export type ExternalEditorCallback = (selection?: string) => DependencyList | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trebco/treb",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.7.6",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"homepage": "https://treb.app",
|
|
6
6
|
"repository": {
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"@types/node": "^20.4.0",
|
|
16
16
|
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
|
17
17
|
"@typescript-eslint/parser": "^6.1.0",
|
|
18
|
-
"archiver": "^
|
|
18
|
+
"archiver": "^6.0.1",
|
|
19
19
|
"cssnano": "^6.0.0",
|
|
20
|
-
"esbuild": "^0.
|
|
20
|
+
"esbuild": "^0.19.2",
|
|
21
21
|
"eslint": "^8.19.0",
|
|
22
22
|
"fast-xml-parser": "^4.0.7",
|
|
23
23
|
"html-minifier": "^4.0.0",
|
|
@@ -180,7 +180,11 @@ export class Calculator extends Graph {
|
|
|
180
180
|
|
|
181
181
|
// FIXME: need a way to share/pass parser flags
|
|
182
182
|
|
|
183
|
-
public readonly parser: Parser = new Parser();
|
|
183
|
+
// public readonly parser: Parser = new Parser();
|
|
184
|
+
/** localized parser instance. we're sharing. */
|
|
185
|
+
protected get parser(): Parser {
|
|
186
|
+
return this.model.parser;
|
|
187
|
+
}
|
|
184
188
|
|
|
185
189
|
protected readonly library = new FunctionLibrary();
|
|
186
190
|
|
|
@@ -192,10 +196,14 @@ export class Calculator extends Graph {
|
|
|
192
196
|
// protected graph: Graph = new Graph(); // |null = null;
|
|
193
197
|
// protected status: GraphStatus = GraphStatus.OK;
|
|
194
198
|
|
|
199
|
+
/*
|
|
195
200
|
// FIXME: why is this a separate class? [actually is this a composition issue?]
|
|
196
201
|
protected expression_calculator = new ExpressionCalculator(
|
|
197
202
|
this.library,
|
|
198
203
|
this.parser);
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
protected expression_calculator: ExpressionCalculator;
|
|
199
207
|
|
|
200
208
|
/** the next calculation must do a full rebuild -- set on reset */
|
|
201
209
|
protected full_rebuild_required = false;
|
|
@@ -204,6 +212,9 @@ export class Calculator extends Graph {
|
|
|
204
212
|
|
|
205
213
|
super();
|
|
206
214
|
|
|
215
|
+
this.expression_calculator = new ExpressionCalculator(this.library, this.parser);
|
|
216
|
+
|
|
217
|
+
|
|
207
218
|
// at the moment options are only used here; in the future
|
|
208
219
|
// we may need to extend handling.
|
|
209
220
|
|
|
@@ -1380,64 +1391,6 @@ export class Calculator extends Graph {
|
|
|
1380
1391
|
return map;
|
|
1381
1392
|
}
|
|
1382
1393
|
|
|
1383
|
-
/** wrapper method ensures it always returns an Area (instance, not interface) */
|
|
1384
|
-
public ResolveArea(address: string|ICellAddress|IArea, active_sheet: Sheet): Area {
|
|
1385
|
-
const resolved = this.ResolveAddress(address, active_sheet);
|
|
1386
|
-
return IsCellAddress(resolved) ? new Area(resolved) : new Area(resolved.start, resolved.end);
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
/**
|
|
1390
|
-
* moved from embedded sheet. also modified to preserve ranges, so it
|
|
1391
|
-
* might return a range (area). if you are expecting the old behavior
|
|
1392
|
-
* you need to check (perhaps we could have a wrapper, or make it optional?)
|
|
1393
|
-
*
|
|
1394
|
-
* Q: why does this not go in grid? or model? (...)
|
|
1395
|
-
* Q: why are we not preserving absoute/relative? (...)
|
|
1396
|
-
*
|
|
1397
|
-
*/
|
|
1398
|
-
public ResolveAddress(address: string|ICellAddress|IArea, active_sheet: Sheet): ICellAddress|IArea {
|
|
1399
|
-
|
|
1400
|
-
if (typeof address === 'string') {
|
|
1401
|
-
const parse_result = this.parser.Parse(address);
|
|
1402
|
-
if (parse_result.expression && parse_result.expression.type === 'address') {
|
|
1403
|
-
this.ResolveSheetID(parse_result.expression, undefined, active_sheet);
|
|
1404
|
-
return {
|
|
1405
|
-
row: parse_result.expression.row,
|
|
1406
|
-
column: parse_result.expression.column,
|
|
1407
|
-
sheet_id: parse_result.expression.sheet_id,
|
|
1408
|
-
};
|
|
1409
|
-
}
|
|
1410
|
-
else if (parse_result.expression && parse_result.expression.type === 'range') {
|
|
1411
|
-
this.ResolveSheetID(parse_result.expression, undefined, active_sheet);
|
|
1412
|
-
return {
|
|
1413
|
-
start: {
|
|
1414
|
-
row: parse_result.expression.start.row,
|
|
1415
|
-
column: parse_result.expression.start.column,
|
|
1416
|
-
sheet_id: parse_result.expression.start.sheet_id,
|
|
1417
|
-
},
|
|
1418
|
-
end: {
|
|
1419
|
-
row: parse_result.expression.end.row,
|
|
1420
|
-
column: parse_result.expression.end.column,
|
|
1421
|
-
}
|
|
1422
|
-
};
|
|
1423
|
-
}
|
|
1424
|
-
else if (parse_result.expression && parse_result.expression.type === 'identifier') {
|
|
1425
|
-
|
|
1426
|
-
// is named range guaranteed to have a sheet ID? (I think yes...)
|
|
1427
|
-
|
|
1428
|
-
const named_range = this.model.named_ranges.Get(parse_result.expression.name);
|
|
1429
|
-
if (named_range) {
|
|
1430
|
-
return named_range;
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
return { row: 0, column: 0 }; // default for string types -- broken
|
|
1435
|
-
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
return address; // already range or address
|
|
1439
|
-
|
|
1440
|
-
}
|
|
1441
1394
|
|
|
1442
1395
|
/** moved from embedded sheet */
|
|
1443
1396
|
public Evaluate(expression: string, active_sheet?: Sheet, options: EvaluateOptions = {}) {
|
|
@@ -1487,7 +1440,7 @@ export class Calculator extends Graph {
|
|
|
1487
1440
|
}
|
|
1488
1441
|
}
|
|
1489
1442
|
|
|
1490
|
-
this.ResolveSheetID(unit, undefined, active_sheet);
|
|
1443
|
+
this.model.ResolveSheetID(unit, undefined, active_sheet);
|
|
1491
1444
|
}
|
|
1492
1445
|
return true;
|
|
1493
1446
|
});
|
|
@@ -1813,48 +1766,6 @@ export class Calculator extends Graph {
|
|
|
1813
1766
|
|
|
1814
1767
|
}
|
|
1815
1768
|
|
|
1816
|
-
/**
|
|
1817
|
-
* returns false if the sheet cannot be resolved, which probably
|
|
1818
|
-
* means the name changed (that's the case we are working on with
|
|
1819
|
-
* this fix).
|
|
1820
|
-
*/
|
|
1821
|
-
public ResolveSheetID(expr: UnitAddress|UnitRange, context?: ICellAddress, active_sheet?: Sheet): boolean {
|
|
1822
|
-
|
|
1823
|
-
const target = expr.type === 'address' ? expr : expr.start;
|
|
1824
|
-
|
|
1825
|
-
if (target.sheet_id) {
|
|
1826
|
-
return true;
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
if (target.sheet) {
|
|
1830
|
-
const sheet = this.model.sheets.Find(target.sheet);
|
|
1831
|
-
if (sheet) {
|
|
1832
|
-
target.sheet_id = sheet.id;
|
|
1833
|
-
return true;
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
/*
|
|
1837
|
-
const lc = target.sheet.toLowerCase();
|
|
1838
|
-
for (const sheet of this.model.sheets.list) {
|
|
1839
|
-
if (sheet.name.toLowerCase() === lc) {
|
|
1840
|
-
target.sheet_id = sheet.id;
|
|
1841
|
-
return true;
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
*/
|
|
1845
|
-
}
|
|
1846
|
-
else if (context?.sheet_id) {
|
|
1847
|
-
target.sheet_id = context.sheet_id;
|
|
1848
|
-
return true;
|
|
1849
|
-
}
|
|
1850
|
-
else if (active_sheet?.id) {
|
|
1851
|
-
target.sheet_id = active_sheet.id;
|
|
1852
|
-
return true;
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
return false; // the error
|
|
1856
|
-
|
|
1857
|
-
}
|
|
1858
1769
|
|
|
1859
1770
|
// --- protected -------------------------------------------------------------
|
|
1860
1771
|
|
|
@@ -1866,13 +1777,13 @@ export class Calculator extends Graph {
|
|
|
1866
1777
|
|
|
1867
1778
|
switch (expr.type) {
|
|
1868
1779
|
case 'address':
|
|
1869
|
-
if (this.ResolveSheetID(expr, context)) {
|
|
1780
|
+
if (this.model.ResolveSheetID(expr, context)) {
|
|
1870
1781
|
return new Area(expr);
|
|
1871
1782
|
}
|
|
1872
1783
|
break;
|
|
1873
1784
|
|
|
1874
1785
|
case 'range':
|
|
1875
|
-
if (this.ResolveSheetID(expr, context)) {
|
|
1786
|
+
if (this.model.ResolveSheetID(expr, context)) {
|
|
1876
1787
|
return new Area(expr.start, expr.end);
|
|
1877
1788
|
}
|
|
1878
1789
|
break;
|
|
@@ -31,7 +31,7 @@ import type {
|
|
|
31
31
|
GridSelection, CellEvent, FunctionDescriptor,
|
|
32
32
|
AnnotationViewData,
|
|
33
33
|
AnnotationType,
|
|
34
|
-
|
|
34
|
+
ExternalEditorConfig,
|
|
35
35
|
} from 'treb-grid';
|
|
36
36
|
|
|
37
37
|
import {
|
|
@@ -355,7 +355,7 @@ export class EmbeddedSpreadsheet {
|
|
|
355
355
|
|
|
356
356
|
/** localized parser instance. we're sharing. */
|
|
357
357
|
protected get parser(): Parser {
|
|
358
|
-
return this.
|
|
358
|
+
return this.model.parser;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
/** for destruction */
|
|
@@ -659,7 +659,7 @@ export class EmbeddedSpreadsheet {
|
|
|
659
659
|
// if we don't have a container. that's distinct (at the moment)
|
|
660
660
|
// from headless, which is a state that can change.
|
|
661
661
|
|
|
662
|
-
this.grid = new Grid(grid_options, this.
|
|
662
|
+
this.grid = new Grid(grid_options, this.model, undefined, !!container);
|
|
663
663
|
|
|
664
664
|
if (this.options.headless) {
|
|
665
665
|
this.grid.headless = true; // FIXME: move into grid options
|
|
@@ -1177,8 +1177,8 @@ export class EmbeddedSpreadsheet {
|
|
|
1177
1177
|
* to support outside tooling by highlighting a list of arguments and
|
|
1178
1178
|
* responding to selection.
|
|
1179
1179
|
*/
|
|
1180
|
-
public ExternalEditor(
|
|
1181
|
-
this.grid.ExternalEditor(
|
|
1180
|
+
public ExternalEditor(config?: Partial<ExternalEditorConfig>) {
|
|
1181
|
+
this.grid.ExternalEditor(config);
|
|
1182
1182
|
}
|
|
1183
1183
|
|
|
1184
1184
|
/**
|
|
@@ -1846,7 +1846,7 @@ export class EmbeddedSpreadsheet {
|
|
|
1846
1846
|
* @param reference
|
|
1847
1847
|
*/
|
|
1848
1848
|
public InsertTable(range?: RangeReference, options: InsertTableOptions = {}) {
|
|
1849
|
-
const area = range ? this.
|
|
1849
|
+
const area = range ? this.model.ResolveArea(range, this.grid.active_sheet) : this.GetSelectionReference().area;
|
|
1850
1850
|
|
|
1851
1851
|
let theme = options.theme;
|
|
1852
1852
|
if (typeof theme === 'number') {
|
|
@@ -1928,7 +1928,7 @@ export class EmbeddedSpreadsheet {
|
|
|
1928
1928
|
let target: IRectangle | Partial<Area> | undefined;
|
|
1929
1929
|
|
|
1930
1930
|
if (rect) {
|
|
1931
|
-
target = Rectangle.IsRectangle(rect) ? rect : this.
|
|
1931
|
+
target = Rectangle.IsRectangle(rect) ? rect : this.model.ResolveArea(rect, this.grid.active_sheet);
|
|
1932
1932
|
}
|
|
1933
1933
|
|
|
1934
1934
|
if (argument_separator && argument_separator !== this.parser.argument_separator) {
|
|
@@ -2273,7 +2273,7 @@ export class EmbeddedSpreadsheet {
|
|
|
2273
2273
|
|
|
2274
2274
|
// API v1 OK
|
|
2275
2275
|
|
|
2276
|
-
this.grid.MergeCells(range ? this.
|
|
2276
|
+
this.grid.MergeCells(range ? this.model.ResolveArea(range, this.grid.active_sheet) : undefined);
|
|
2277
2277
|
}
|
|
2278
2278
|
|
|
2279
2279
|
/**
|
|
@@ -2287,7 +2287,7 @@ export class EmbeddedSpreadsheet {
|
|
|
2287
2287
|
|
|
2288
2288
|
// API v1 OK
|
|
2289
2289
|
|
|
2290
|
-
this.grid.UnmergeCells(range ? this.
|
|
2290
|
+
this.grid.UnmergeCells(range ? this.model.ResolveArea(range, this.grid.active_sheet) : undefined);
|
|
2291
2291
|
}
|
|
2292
2292
|
|
|
2293
2293
|
/**
|
|
@@ -2996,7 +2996,7 @@ export class EmbeddedSpreadsheet {
|
|
|
2996
2996
|
// API v1 OK
|
|
2997
2997
|
|
|
2998
2998
|
if (typeof address === 'string') {
|
|
2999
|
-
const reference = this.
|
|
2999
|
+
const reference = this.model.ResolveAddress(address, this.grid.active_sheet);
|
|
3000
3000
|
address = IsCellAddress(reference) ? reference : reference.start;
|
|
3001
3001
|
}
|
|
3002
3002
|
|
|
@@ -3016,7 +3016,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3016
3016
|
public SetValidation(address: AddressReference, validation?: RangeReference|CellValue[], error?: boolean) {
|
|
3017
3017
|
|
|
3018
3018
|
if (typeof address === 'string') {
|
|
3019
|
-
const reference = this.
|
|
3019
|
+
const reference = this.model.ResolveAddress(address, this.grid.active_sheet);
|
|
3020
3020
|
address = IsCellAddress(reference) ? reference : reference.start;
|
|
3021
3021
|
}
|
|
3022
3022
|
|
|
@@ -3024,7 +3024,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3024
3024
|
this.grid.SetValidation(address, validation, error);
|
|
3025
3025
|
}
|
|
3026
3026
|
else {
|
|
3027
|
-
const range = this.
|
|
3027
|
+
const range = this.model.ResolveArea(validation, this.grid.active_sheet);
|
|
3028
3028
|
this.grid.SetValidation(address, range, error);
|
|
3029
3029
|
}
|
|
3030
3030
|
|
|
@@ -3034,7 +3034,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3034
3034
|
public RemoveValidation(address: AddressReference) {
|
|
3035
3035
|
|
|
3036
3036
|
if (typeof address === 'string') {
|
|
3037
|
-
const reference = this.
|
|
3037
|
+
const reference = this.model.ResolveAddress(address);
|
|
3038
3038
|
address = IsCellAddress(reference) ? reference : reference.start;
|
|
3039
3039
|
}
|
|
3040
3040
|
|
|
@@ -3045,7 +3045,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3045
3045
|
public SetValidationList(address: AddressReference, list: CellValue[]) {
|
|
3046
3046
|
|
|
3047
3047
|
if (typeof address === 'string') {
|
|
3048
|
-
const reference = this.
|
|
3048
|
+
const reference = this.model.ResolveAddress(address);
|
|
3049
3049
|
address = IsCellAddress(reference) ? reference : reference.start;
|
|
3050
3050
|
}
|
|
3051
3051
|
|
|
@@ -3056,11 +3056,11 @@ export class EmbeddedSpreadsheet {
|
|
|
3056
3056
|
public SetValidationRange(address: AddressReference, range: RangeReference) {
|
|
3057
3057
|
|
|
3058
3058
|
if (typeof address === 'string') {
|
|
3059
|
-
const reference = this.
|
|
3059
|
+
const reference = this.model.ResolveAddress(address);
|
|
3060
3060
|
address = IsCellAddress(reference) ? reference : reference.start;
|
|
3061
3061
|
}
|
|
3062
3062
|
|
|
3063
|
-
range = this.
|
|
3063
|
+
range = this.model.ResolveArea(range);
|
|
3064
3064
|
this.grid.SetValidation(address, range);
|
|
3065
3065
|
|
|
3066
3066
|
}
|
|
@@ -3364,7 +3364,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3364
3364
|
// API v1 OK
|
|
3365
3365
|
|
|
3366
3366
|
if (typeof address === 'string') {
|
|
3367
|
-
const reference = this.
|
|
3367
|
+
const reference = this.model.ResolveAddress(address, this.grid.active_sheet);
|
|
3368
3368
|
address = IsCellAddress(reference) ? reference : reference.start;
|
|
3369
3369
|
}
|
|
3370
3370
|
|
|
@@ -3404,7 +3404,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3404
3404
|
// FIXME: we're using the sheet EnsureAddress method, but that should
|
|
3405
3405
|
// move either in here or into some sort of helper class
|
|
3406
3406
|
|
|
3407
|
-
const result = this.
|
|
3407
|
+
const result = this.model.ResolveAddress(reference, this.grid.active_sheet);
|
|
3408
3408
|
|
|
3409
3409
|
if (IsCellAddress(result)) {
|
|
3410
3410
|
return result.sheet_id ? result : undefined;
|
|
@@ -3600,7 +3600,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3600
3600
|
|
|
3601
3601
|
// still for now we can take advantage of that and skip the check.
|
|
3602
3602
|
|
|
3603
|
-
this.grid.ApplyBorders2(range ? this.
|
|
3603
|
+
this.grid.ApplyBorders2(range ? this.model.ResolveArea(range, this.grid.active_sheet) : undefined, borders, {}, width);
|
|
3604
3604
|
|
|
3605
3605
|
}
|
|
3606
3606
|
|
|
@@ -3623,7 +3623,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3623
3623
|
// translate old-style alignment constants (UPDATE: moved to grid)
|
|
3624
3624
|
|
|
3625
3625
|
this.grid.ApplyStyle(
|
|
3626
|
-
range ? this.
|
|
3626
|
+
range ? this.model.ResolveArea(range, this.grid.active_sheet) : undefined, style, delta);
|
|
3627
3627
|
}
|
|
3628
3628
|
|
|
3629
3629
|
/**
|
|
@@ -3687,7 +3687,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3687
3687
|
|
|
3688
3688
|
if (typeof value === 'object') {
|
|
3689
3689
|
if (IsCellAddress(value) || IsArea(value)) {
|
|
3690
|
-
this.grid.SetName(name, this.
|
|
3690
|
+
this.grid.SetName(name, this.model.ResolveArea(value, this.grid.active_sheet));
|
|
3691
3691
|
return;
|
|
3692
3692
|
}
|
|
3693
3693
|
}
|
|
@@ -3704,7 +3704,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3704
3704
|
switch (parse_result.expression.type) {
|
|
3705
3705
|
case 'address':
|
|
3706
3706
|
case 'range':
|
|
3707
|
-
this.grid.SetName(name, this.
|
|
3707
|
+
this.grid.SetName(name, this.model.ResolveArea(parse_result.expression, this.grid.active_sheet));
|
|
3708
3708
|
return;
|
|
3709
3709
|
}
|
|
3710
3710
|
this.grid.SetName(name, undefined, value);
|
|
@@ -3730,7 +3730,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3730
3730
|
|
|
3731
3731
|
// NOTE: AC is handled internally
|
|
3732
3732
|
|
|
3733
|
-
this.grid.SetName(name, this.
|
|
3733
|
+
this.grid.SetName(name, this.model.ResolveArea(range, this.grid.active_sheet));
|
|
3734
3734
|
*/
|
|
3735
3735
|
}
|
|
3736
3736
|
|
|
@@ -3756,7 +3756,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3756
3756
|
// API v1 OK
|
|
3757
3757
|
|
|
3758
3758
|
if (typeof address === 'string') {
|
|
3759
|
-
const reference = this.
|
|
3759
|
+
const reference = this.model.ResolveAddress(address, this.grid.active_sheet);
|
|
3760
3760
|
address = IsCellAddress(reference) ? reference : reference.start;
|
|
3761
3761
|
}
|
|
3762
3762
|
|
|
@@ -3784,7 +3784,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3784
3784
|
let resolved: Area|undefined = undefined;
|
|
3785
3785
|
|
|
3786
3786
|
if (!!range) {
|
|
3787
|
-
resolved = this.
|
|
3787
|
+
resolved = this.model.ResolveArea(range, this.grid.active_sheet);
|
|
3788
3788
|
if (resolved.start.sheet_id) {
|
|
3789
3789
|
if (resolved.start.sheet_id !== this.grid.active_sheet.id) {
|
|
3790
3790
|
this.grid.ActivateSheetID(resolved.start.sheet_id);
|
|
@@ -3826,7 +3826,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3826
3826
|
}
|
|
3827
3827
|
}
|
|
3828
3828
|
|
|
3829
|
-
return this.grid.GetRange(this.
|
|
3829
|
+
return this.grid.GetRange(this.model.ResolveAddress(range, this.grid.active_sheet), options.type);
|
|
3830
3830
|
|
|
3831
3831
|
}
|
|
3832
3832
|
|
|
@@ -3855,7 +3855,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3855
3855
|
|
|
3856
3856
|
if (!range) { return undefined; }
|
|
3857
3857
|
|
|
3858
|
-
return this.grid.GetRangeStyle(this.
|
|
3858
|
+
return this.grid.GetRangeStyle(this.model.ResolveAddress(range, this.grid.active_sheet), apply_theme);
|
|
3859
3859
|
|
|
3860
3860
|
}
|
|
3861
3861
|
|
|
@@ -3884,7 +3884,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3884
3884
|
}
|
|
3885
3885
|
|
|
3886
3886
|
if (range) {
|
|
3887
|
-
const area = this.
|
|
3887
|
+
const area = this.model.ResolveArea(range, this.grid.active_sheet);
|
|
3888
3888
|
|
|
3889
3889
|
if (options.spill && Array.isArray(data)) {
|
|
3890
3890
|
const rows = data.length;
|
|
@@ -3953,7 +3953,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3953
3953
|
|
|
3954
3954
|
if (!table) {
|
|
3955
3955
|
|
|
3956
|
-
let address = this.
|
|
3956
|
+
let address = this.model.ResolveAddress(reference, this.grid.active_sheet);
|
|
3957
3957
|
|
|
3958
3958
|
if (!IsCellAddress(address)) {
|
|
3959
3959
|
address = address.start;
|
|
@@ -4703,7 +4703,7 @@ export class EmbeddedSpreadsheet {
|
|
|
4703
4703
|
|
|
4704
4704
|
this.parser.Walk(parse_result.expression, (unit) => {
|
|
4705
4705
|
if (unit.type === 'address' || unit.type === 'range') {
|
|
4706
|
-
this.
|
|
4706
|
+
this.model.ResolveSheetID(unit, undefined, this.grid.active_sheet);
|
|
4707
4707
|
}
|
|
4708
4708
|
return true;
|
|
4709
4709
|
});
|
|
@@ -31,27 +31,43 @@
|
|
|
31
31
|
$primary-selection-color: #4caaf1;
|
|
32
32
|
$primary-selection-color-unfocused: #acc0cf;
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
/*
|
|
35
35
|
$alternate-selection-color-1: rgb(251, 177, 60);
|
|
36
|
-
//$alternate-selection-color-2: rgb(87, 184, 255);
|
|
37
36
|
$alternate-selection-color-2: rgb(64, 192, 64);
|
|
38
37
|
$alternate-selection-color-3: rgb(182, 109, 13);
|
|
39
38
|
$alternate-selection-color-4: rgb(33, 118, 174);
|
|
40
39
|
$alternate-selection-color-5: rgb(254, 104, 71);
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
/ * *
|
|
43
42
|
* slightly darkening colors for text highlighting
|
|
44
43
|
* algo: convert to HSL; if L > .5, regenerate with L = .5; back to RGB (why?)
|
|
45
|
-
|
|
44
|
+
* /
|
|
46
45
|
$text-reference-color-1: rgb(250, 155, 5);
|
|
47
|
-
//$text-reference-color-2: rgb(0, 147, 255);
|
|
48
46
|
$text-reference-color-2: rgb(58, 173, 58);
|
|
49
47
|
$text-reference-color-3: rgb(182, 109, 13);
|
|
50
48
|
$text-reference-color-4: rgb(33, 118, 174);
|
|
51
49
|
$text-reference-color-5: rgb(254, 47, 1);
|
|
50
|
+
*/
|
|
52
51
|
|
|
53
52
|
.treb-main.treb-main {
|
|
54
53
|
|
|
54
|
+
--alternate-selection-color-1: rgb(251, 177, 60);
|
|
55
|
+
--alternate-selection-color-2: rgb(64, 192, 64);
|
|
56
|
+
--alternate-selection-color-3: rgb(182, 109, 13);
|
|
57
|
+
--alternate-selection-color-4: rgb(33, 118, 174);
|
|
58
|
+
--alternate-selection-color-5: rgb(254, 104, 71);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* slightly darkening colors for text highlighting
|
|
62
|
+
* algo: convert to HSL; if L > .5, regenerate with L = .5; back to RGB (why?)
|
|
63
|
+
*/
|
|
64
|
+
--text-reference-color-1: rgb(224, 138, 0);
|
|
65
|
+
--text-reference-color-2: rgb(58, 173, 58);
|
|
66
|
+
--text-reference-color-3: rgb(182, 109, 13);
|
|
67
|
+
--text-reference-color-4: rgb(33, 118, 174);
|
|
68
|
+
--text-reference-color-5: rgb(254, 47, 1);
|
|
69
|
+
|
|
70
|
+
|
|
55
71
|
/**
|
|
56
72
|
* move primary selection focus color to focus-within on the top-level
|
|
57
73
|
* node, and use a (new) unfocused selection color. name?
|
|
@@ -284,29 +300,39 @@ $text-reference-color-5: rgb(254, 47, 1);
|
|
|
284
300
|
.treb-editor-container>div,
|
|
285
301
|
.treb-overlay-editor {
|
|
286
302
|
|
|
303
|
+
[data-highlight-index="1"] { color: var(--text-reference-color-1); }
|
|
304
|
+
[data-highlight-index="2"] { color: var(--text-reference-color-2); }
|
|
305
|
+
[data-highlight-index="3"] { color: var(--text-reference-color-3); }
|
|
306
|
+
[data-highlight-index="4"] { color: var(--text-reference-color-4); }
|
|
307
|
+
[data-highlight-index="5"] { color: var(--text-reference-color-5); }
|
|
308
|
+
|
|
287
309
|
/* span:nth-of-type(1n) { */
|
|
288
310
|
span.highlight-1 {
|
|
289
|
-
color:
|
|
311
|
+
color: var(--text-reference-color-1);
|
|
290
312
|
}
|
|
291
313
|
|
|
292
314
|
/* span:nth-of-type(2n) { */
|
|
293
315
|
span.highlight-2 {
|
|
294
|
-
color: $text-reference-color-2;
|
|
316
|
+
// color: $text-reference-color-2;
|
|
317
|
+
color: var(--text-reference-color-2);
|
|
295
318
|
}
|
|
296
319
|
|
|
297
320
|
/* span:nth-of-type(3n) { */
|
|
298
321
|
span.highlight-3 {
|
|
299
|
-
color: $text-reference-color-3;
|
|
322
|
+
// color: $text-reference-color-3;
|
|
323
|
+
color: var(--text-reference-color-3);
|
|
300
324
|
}
|
|
301
325
|
|
|
302
326
|
/* span:nth-of-type(4n) { */
|
|
303
327
|
span.highlight-4 {
|
|
304
|
-
color: $text-reference-color-4;
|
|
328
|
+
// color: $text-reference-color-4;
|
|
329
|
+
color: var(--text-reference-color-4);
|
|
305
330
|
}
|
|
306
331
|
|
|
307
332
|
/* span:nth-of-type(5n) { */
|
|
308
333
|
span.highlight-5 {
|
|
309
|
-
color: $text-reference-color-5;
|
|
334
|
+
// color: $text-reference-color-5;
|
|
335
|
+
color: var(--text-reference-color-5);
|
|
310
336
|
}
|
|
311
337
|
|
|
312
338
|
}
|
|
@@ -339,23 +365,28 @@ $text-reference-color-5: rgb(254, 47, 1);
|
|
|
339
365
|
}
|
|
340
366
|
|
|
341
367
|
.alternate-selection:nth-of-type(1n) {
|
|
342
|
-
color: $alternate-selection-color-1;
|
|
368
|
+
// color: $alternate-selection-color-1;
|
|
369
|
+
color: var(--alternate-selection-color-1);
|
|
343
370
|
}
|
|
344
371
|
|
|
345
372
|
.alternate-selection:nth-of-type(2n) {
|
|
346
|
-
color: $alternate-selection-color-2;
|
|
373
|
+
// color: $alternate-selection-color-2;
|
|
374
|
+
color: var(--alternate-selection-color-2);
|
|
347
375
|
}
|
|
348
376
|
|
|
349
377
|
.alternate-selection:nth-of-type(3n) {
|
|
350
|
-
color: $alternate-selection-color-3;
|
|
378
|
+
// color: $alternate-selection-color-3;
|
|
379
|
+
color: var(--alternate-selection-color-3);
|
|
351
380
|
}
|
|
352
381
|
|
|
353
382
|
.alternate-selection:nth-of-type(4n) {
|
|
354
|
-
color: $alternate-selection-color-4;
|
|
383
|
+
// color: $alternate-selection-color-4;
|
|
384
|
+
color: var(--alternate-selection-color-4);
|
|
355
385
|
}
|
|
356
386
|
|
|
357
387
|
.alternate-selection:nth-of-type(5n) {
|
|
358
|
-
color: $alternate-selection-color-5;
|
|
388
|
+
// color: $alternate-selection-color-5;
|
|
389
|
+
color: var(--alternate-selection-color-5);
|
|
359
390
|
}
|
|
360
391
|
|
|
361
392
|
/**
|