@trebco/treb 25.2.0 → 25.4.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/{.eslintrc.js → .eslintrc.cjs} +4 -0
- package/api-generator/api-generator.ts +25 -55
- package/dist/treb-spreadsheet.mjs +9 -9
- package/dist/treb.d.ts +1 -1
- package/esbuild-custom-element.mjs +5 -264
- package/esbuild-utils.mjs +273 -0
- package/package.json +2 -2
- package/treb-base-types/src/cell.ts +23 -22
- package/treb-base-types/src/cells.ts +55 -2
- package/treb-base-types/src/union.ts +2 -1
- package/treb-calculator/src/calculator.ts +8 -5
- package/treb-calculator/src/dag/array-vertex.ts +22 -22
- package/treb-calculator/src/dag/graph.ts +25 -23
- package/treb-calculator/src/dag/leaf_vertex.ts +23 -22
- package/treb-calculator/src/dag/spreadsheet_vertex.ts +25 -23
- package/treb-calculator/src/expression-calculator.ts +23 -22
- package/treb-calculator/src/function-error.ts +23 -22
- package/treb-calculator/src/functions/base-functions.ts +3 -2
- package/treb-calculator/src/functions/checkbox.ts +23 -22
- package/treb-calculator/src/functions/complex-functions.ts +2 -1
- package/treb-calculator/src/functions/finance-functions.ts +22 -22
- package/treb-calculator/src/functions/information-functions.ts +22 -22
- package/treb-calculator/src/functions/matrix-functions.ts +2 -1
- package/treb-calculator/src/functions/statistics-functions.ts +22 -22
- package/treb-calculator/src/functions/text-functions.ts +23 -22
- package/treb-calculator/src/primitives.ts +23 -22
- package/treb-calculator/src/utilities.ts +23 -24
- package/treb-charts/src/chart-functions.ts +22 -22
- package/treb-charts/src/chart.ts +6 -3
- package/treb-charts/src/renderer.ts +25 -23
- package/treb-charts/src/util.ts +23 -22
- package/treb-embed/modern.tsconfig.json +3 -2
- package/treb-embed/src/custom-element/spreadsheet-constructor.ts +10 -14
- package/treb-embed/src/embedded-spreadsheet.ts +53 -44
- package/treb-embed/src/progress-dialog.ts +0 -3
- package/treb-embed/src/types.ts +13 -3
- package/treb-embed/style/layout.scss +32 -29
- package/treb-export/src/drawing2/chart2.ts +2 -2
- package/treb-export/src/drawing2/drawing2.ts +6 -4
- package/treb-export/src/export-worker/export-worker.ts +22 -24
- package/treb-export/src/export-worker/index-modern.ts +2 -1
- package/treb-export/src/export2.ts +15 -8
- package/treb-export/src/import2.ts +10 -5
- package/treb-export/src/workbook-sheet2.ts +2 -1
- package/treb-format/src/format.ts +23 -22
- package/treb-format/src/format_parser.ts +23 -22
- package/treb-format/src/value_parser.ts +23 -22
- package/treb-grid/src/editors/formula_bar.ts +2 -1
- package/treb-grid/src/editors/formula_editor_base.ts +4 -2
- package/treb-grid/src/editors/overlay_editor.ts +2 -1
- package/treb-grid/src/index.ts +12 -9
- package/treb-grid/src/layout/base_layout.ts +4 -2
- package/treb-grid/src/render/selection-renderer.ts +25 -23
- package/treb-grid/src/render/tile_renderer.ts +6 -4
- package/treb-grid/src/types/annotation.ts +33 -37
- package/treb-grid/src/types/data_model.ts +30 -22
- package/treb-grid/src/types/grid.ts +55 -584
- package/treb-grid/src/types/grid_base.ts +401 -7
- package/treb-grid/src/types/grid_events.ts +3 -0
- package/treb-grid/src/types/grid_selection.ts +22 -22
- package/treb-grid/src/types/named_range.ts +22 -22
- package/treb-grid/src/types/sheet.ts +8 -7
- package/treb-grid/src/types/sheet_types.ts +11 -7
- package/treb-grid/src/types/tab_bar.ts +1 -1
- package/treb-parser/src/parser.ts +5 -4
- package/tsproject.json +3 -4
- package/tsconfig.json +0 -10
- /package/treb-embed/src/{custom-element/content-types.d.ts → content-types.d.ts} +0 -0
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of TREB.
|
|
3
|
-
*
|
|
4
|
-
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
-
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
-
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
-
* later version.
|
|
8
|
-
*
|
|
9
|
-
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
-
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
-
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
-
* details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License along
|
|
15
|
-
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
*
|
|
17
|
-
* Copyright 2022-2023 trebco, llc.
|
|
18
|
-
* info@treb.app
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2023 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
22
|
import type { FunctionMap } from '../descriptors';
|
|
23
23
|
import * as Utils from '../utilities';
|
|
24
24
|
import { ValueError, ArgumentError, NAError } from '../function-error';
|
|
25
|
-
import { Complex, UnionValue, ValueType } from 'treb-base-types';
|
|
25
|
+
import { type Complex, type UnionValue, ValueType } from 'treb-base-types';
|
|
26
26
|
import * as ComplexMath from '../complex-math';
|
|
27
27
|
|
|
28
28
|
export const Variance = (data: number[], sample = false) => {
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of TREB.
|
|
3
|
-
*
|
|
4
|
-
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
-
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
-
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
-
* later version.
|
|
8
|
-
*
|
|
9
|
-
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
-
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
-
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
-
* details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License along
|
|
15
|
-
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
*
|
|
17
|
-
* Copyright 2022-2023 trebco, llc.
|
|
18
|
-
* info@treb.app
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2023 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
22
|
import type { FunctionMap } from '../descriptors';
|
|
23
23
|
import { NumberFormatCache, ValueParser } from 'treb-format';
|
|
24
|
-
import {
|
|
24
|
+
import type { UnionValue} from 'treb-base-types';
|
|
25
|
+
import { Localization, ValueType } from 'treb-base-types';
|
|
25
26
|
import * as Utils from '../utilities';
|
|
26
27
|
import { ArgumentError, ValueError } from '../function-error';
|
|
27
28
|
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of TREB.
|
|
3
|
-
*
|
|
4
|
-
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
-
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
-
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
-
* later version.
|
|
8
|
-
*
|
|
9
|
-
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
-
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
-
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
-
* details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License along
|
|
15
|
-
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
*
|
|
17
|
-
* Copyright 2022-2023 trebco, llc.
|
|
18
|
-
* info@treb.app
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
import { Complex,
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2023 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import type { Complex, UnionValue} from 'treb-base-types';
|
|
23
|
+
import { ValueType } from 'treb-base-types';
|
|
23
24
|
import { DivideByZeroError, ValueError } from './function-error';
|
|
24
25
|
|
|
25
26
|
import * as ComplexLib from './complex-math';
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of TREB.
|
|
3
|
-
*
|
|
4
|
-
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
-
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
-
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
-
* later version.
|
|
8
|
-
*
|
|
9
|
-
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
-
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
-
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
-
* details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License along
|
|
15
|
-
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
*
|
|
17
|
-
* Copyright 2022-2023 trebco, llc.
|
|
18
|
-
* info@treb.app
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
import { ArrayUnion, UnionValue
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2023 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import type { ArrayUnion, UnionValue} from 'treb-base-types';
|
|
23
|
+
import { ValueType } from 'treb-base-types';
|
|
23
24
|
|
|
24
25
|
export const DAY_MS = 1000 * 60 * 60 * 24;
|
|
25
26
|
|
|
@@ -196,8 +197,6 @@ export const ApplyAsArray = (base: (a: any, ...rest: any[]) => UnionValue) => {
|
|
|
196
197
|
return (a: any, ...rest: any[]): UnionValue => {
|
|
197
198
|
if (Array.isArray(a)) {
|
|
198
199
|
|
|
199
|
-
console.info("AAA 71823");
|
|
200
|
-
|
|
201
200
|
return {
|
|
202
201
|
type: ValueType.array,
|
|
203
202
|
value: a.map(row => row.map((element: any) => {
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of TREB.
|
|
3
|
-
*
|
|
4
|
-
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
-
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
-
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
-
* later version.
|
|
8
|
-
*
|
|
9
|
-
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
-
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
-
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
-
* details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License along
|
|
15
|
-
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
*
|
|
17
|
-
* Copyright 2022-2023 trebco, llc.
|
|
18
|
-
* info@treb.app
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
import { UnionValue, ValueType } from 'treb-base-types';
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2023 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { type UnionValue, ValueType } from 'treb-base-types';
|
|
23
23
|
import type { FunctionMap } from 'treb-calculator/src/descriptors';
|
|
24
24
|
|
|
25
25
|
/**
|
package/treb-charts/src/chart.ts
CHANGED
|
@@ -20,11 +20,14 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import { NumberFormatCache } from 'treb-format';
|
|
23
|
-
import {
|
|
23
|
+
import type { Metrics } from './renderer';
|
|
24
|
+
import { ChartRenderer } from './renderer';
|
|
24
25
|
import { Area } from './rectangle';
|
|
25
26
|
import { Util } from './util';
|
|
26
|
-
import { BarData, CellData, ChartData, DonutSlice,
|
|
27
|
-
import {
|
|
27
|
+
import type { BarData, CellData, ChartData, DonutSlice, SeriesType, SubSeries } from './chart-types';
|
|
28
|
+
import { LegendLayout, LegendPosition, LegendStyle } from './chart-types';
|
|
29
|
+
import type { ArrayUnion, ExtendedUnion, UnionValue} from 'treb-base-types';
|
|
30
|
+
import { ValueType } from 'treb-base-types';
|
|
28
31
|
|
|
29
32
|
// require('../style/charts.scss');
|
|
30
33
|
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of TREB.
|
|
3
|
-
*
|
|
4
|
-
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
-
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
-
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
-
* later version.
|
|
8
|
-
*
|
|
9
|
-
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
-
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
-
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
-
* details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License along
|
|
15
|
-
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
*
|
|
17
|
-
* Copyright 2022-2023 trebco, llc.
|
|
18
|
-
* info@treb.app
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2023 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import type { Size, Point } from './rectangle';
|
|
23
|
+
import { Area } from './rectangle';
|
|
24
|
+
import type { DonutSlice, LegendOptions} from './chart-types';
|
|
25
|
+
import { LegendLayout, LegendPosition, LegendStyle } from './chart-types';
|
|
24
26
|
import type { RangeScale } from 'treb-utils';
|
|
25
27
|
|
|
26
28
|
const SVGNS = 'http://www.w3.org/2000/svg';
|
package/treb-charts/src/util.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of TREB.
|
|
3
|
-
*
|
|
4
|
-
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
-
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
-
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
-
* later version.
|
|
8
|
-
*
|
|
9
|
-
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
-
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
-
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
-
* details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License along
|
|
15
|
-
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
*
|
|
17
|
-
* Copyright 2022-2023 trebco, llc.
|
|
18
|
-
* info@treb.app
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
import { RangeScale
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2023 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import type { RangeScale} from 'treb-utils';
|
|
23
|
+
import { Scale } from 'treb-utils';
|
|
23
24
|
|
|
24
25
|
/* * calculated human-friendly scale for rendering axes * /
|
|
25
26
|
export interface RangeScale {
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
"../treb-format/**/*.ts",
|
|
10
10
|
"../treb-parser/**/*.ts",
|
|
11
11
|
"../treb-calculator/**/*.ts",
|
|
12
|
-
"../treb-base-types/**/*.ts"
|
|
12
|
+
"../treb-base-types/**/*.ts",
|
|
13
|
+
"../treb-export/**/*.ts",
|
|
14
|
+
"src/content-types.d.ts"
|
|
13
15
|
],
|
|
14
16
|
"exclude": [
|
|
15
17
|
"src/custom-element/global.d.ts",
|
|
16
|
-
|
|
17
18
|
"src/API/api-v1.ts",
|
|
18
19
|
"src/API/api-utils.ts",
|
|
19
20
|
"src/index-modern-mc.ts",
|
|
@@ -110,8 +110,6 @@ export class SpreadsheetConstructor {
|
|
|
110
110
|
style.textContent = css;
|
|
111
111
|
document.head.prepend(style);
|
|
112
112
|
}
|
|
113
|
-
else {
|
|
114
|
-
}
|
|
115
113
|
|
|
116
114
|
/*
|
|
117
115
|
if (!SpreadsheetConstructor.stylesheets_attached) {
|
|
@@ -268,19 +266,15 @@ export class SpreadsheetConstructor {
|
|
|
268
266
|
|
|
269
267
|
// set a local variable so we don't have to keep testing the member
|
|
270
268
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
// console.info(sheet.options);
|
|
274
|
-
|
|
275
|
-
this.sheet = sheet;
|
|
269
|
+
this.sheet = new EmbeddedSpreadsheet(options);
|
|
276
270
|
|
|
277
|
-
if (
|
|
278
|
-
|
|
271
|
+
if (this.root) {
|
|
272
|
+
this.CreateLayout(this.sheet, this.root);
|
|
279
273
|
}
|
|
280
274
|
|
|
281
|
-
|
|
275
|
+
}
|
|
282
276
|
|
|
283
|
-
|
|
277
|
+
public CreateLayout(sheet: EmbeddedSpreadsheet, root: HTMLElement) {
|
|
284
278
|
|
|
285
279
|
// call our internal resize method when the node is resized
|
|
286
280
|
// (primary instance will handle views)
|
|
@@ -416,7 +410,7 @@ export class SpreadsheetConstructor {
|
|
|
416
410
|
let mask: HTMLElement|undefined;
|
|
417
411
|
let resizer: HTMLElement|undefined;
|
|
418
412
|
|
|
419
|
-
const resize_handle =
|
|
413
|
+
const resize_handle = root.querySelector('.treb-layout-resize-handle') as HTMLElement;
|
|
420
414
|
|
|
421
415
|
// mouse up handler added to mask (when created)
|
|
422
416
|
const mouse_up = () => finish();
|
|
@@ -464,9 +458,11 @@ export class SpreadsheetConstructor {
|
|
|
464
458
|
event.stopPropagation();
|
|
465
459
|
event.preventDefault();
|
|
466
460
|
|
|
467
|
-
|
|
461
|
+
const resize_parent = root.querySelector('.treb-main') as HTMLElement; // was document.body
|
|
462
|
+
|
|
463
|
+
resizer = Element<HTMLDivElement>('div', resize_parent, { classes: 'treb-resize-rect' });
|
|
468
464
|
|
|
469
|
-
mask = Element<HTMLDivElement>('div',
|
|
465
|
+
mask = Element<HTMLDivElement>('div', resize_parent, {
|
|
470
466
|
classes: 'treb-resize-mask',
|
|
471
467
|
style: 'cursor: nw-resize;',
|
|
472
468
|
});
|
|
@@ -21,27 +21,37 @@
|
|
|
21
21
|
|
|
22
22
|
// --- imports -----------------------------------------------------------------
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
25
|
+
/// <reference path="./content-types.d.ts" />
|
|
26
|
+
|
|
27
|
+
import type {
|
|
28
|
+
GridEvent, SerializeOptions, Annotation,
|
|
26
29
|
SerializedModel, FreezePane, SerializedSheet,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
SheetChangeEvent, GridOptions,
|
|
31
|
+
GridSelection, CellEvent, FunctionDescriptor,
|
|
32
|
+
AnnotationViewData,
|
|
33
|
+
} from 'treb-grid';
|
|
34
|
+
|
|
35
|
+
import {
|
|
36
|
+
DataModel, Grid, BorderConstants, Sheet, ErrorCode, UA
|
|
30
37
|
} from 'treb-grid';
|
|
31
38
|
|
|
32
39
|
import {
|
|
33
40
|
Parser, DecimalMarkType,
|
|
34
41
|
ArgumentSeparatorType, QuotedSheetNameRegex } from 'treb-parser';
|
|
35
42
|
|
|
36
|
-
import { Calculator, EvaluateOptions, LeafVertex } from 'treb-calculator';
|
|
43
|
+
import { Calculator, type EvaluateOptions, type LeafVertex } from 'treb-calculator';
|
|
44
|
+
|
|
45
|
+
import type {
|
|
46
|
+
ICellAddress,
|
|
47
|
+
IArea, CellValue, Point,
|
|
48
|
+
Complex, ExtendedUnion, IRectangle,
|
|
49
|
+
AddressReference, RangeReference, TableSortOptions, Table, TableTheme,
|
|
50
|
+
} from 'treb-base-types';
|
|
37
51
|
|
|
38
52
|
import {
|
|
39
|
-
|
|
40
|
-
IsCellAddress,
|
|
41
|
-
Area, IArea, CellValue, Point,
|
|
42
|
-
IsFlatData, IsFlatDataArray, Rectangle, IsComplex,
|
|
43
|
-
ComplexToString, Complex, ExtendedUnion, IRectangle,
|
|
44
|
-
AddressReference, RangeReference, IsArea, TableSortOptions, Table, ThemeColorTable, TableTheme,
|
|
53
|
+
IsArea, ThemeColorTable, ComplexToString, Rectangle, IsComplex,
|
|
54
|
+
Localization, Style, ThemeColor2, IsCellAddress, Area, IsFlatData, IsFlatDataArray,
|
|
45
55
|
} from 'treb-base-types';
|
|
46
56
|
|
|
47
57
|
import { EventSource, Yield, ValidateURI } from 'treb-utils';
|
|
@@ -51,37 +61,32 @@ import { NumberFormatCache, ValueParser, NumberFormat } from 'treb-format';
|
|
|
51
61
|
|
|
52
62
|
import { Dialog, DialogType } from './progress-dialog';
|
|
53
63
|
import { Spinner } from './spinner';
|
|
54
|
-
import { EmbeddedSpreadsheetOptions, DefaultOptions, ExportOptions } from './options';
|
|
55
|
-
import { TREBDocument, SaveFileType, LoadSource, EmbeddedSheetEvent, InsertTableOptions } from './types';
|
|
64
|
+
import { type EmbeddedSpreadsheetOptions, DefaultOptions, type ExportOptions } from './options';
|
|
65
|
+
import { type TREBDocument, SaveFileType, LoadSource, type EmbeddedSheetEvent, type InsertTableOptions } from './types';
|
|
56
66
|
|
|
57
67
|
import type { LanguageModel, TranslatedFunctionDescriptor } from './language-model';
|
|
58
68
|
import type { SelectionState } from './selection-state';
|
|
59
69
|
import type { BorderToolbarMessage, ToolbarMessage } from './toolbar-message';
|
|
60
70
|
|
|
61
71
|
import { Chart, ChartFunctions } from 'treb-charts';
|
|
62
|
-
|
|
63
|
-
// --- 3d party ----------------------------------------------------------------
|
|
64
|
-
|
|
65
|
-
// import * as FileSaver from 'file-saver';
|
|
66
|
-
|
|
67
|
-
// --- style -------------------------------------------------------------------
|
|
68
|
-
|
|
69
|
-
// we moved grid style (sass) imports from grid -> here so we can better
|
|
70
|
-
// support headless/server-side grid. if we build with esbuild they'd
|
|
71
|
-
// disappear so we could move these back...
|
|
72
|
-
|
|
73
|
-
// import 'treb-grid/style/grid-layout.scss';
|
|
74
|
-
// import 'treb-grid/style/grid.scss';
|
|
75
|
-
// import '../style/embed.scss';
|
|
76
|
-
|
|
77
72
|
import type { SetRangeOptions } from 'treb-grid';
|
|
78
73
|
|
|
79
|
-
// ---
|
|
74
|
+
// --- worker ------------------------------------------------------------------
|
|
80
75
|
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
/**
|
|
77
|
+
* note the clumsy URI-like syntax. if typescript can see that the thing
|
|
78
|
+
* is a ts file, even if we have a prefix and a type defined for that
|
|
79
|
+
* prefix, it will still try to read it.
|
|
80
|
+
*
|
|
81
|
+
* this is not a great solution. I was thinking about letting ts read it.
|
|
82
|
+
* That won't impact esbuild, and it has the helpful side effect of type
|
|
83
|
+
* checking the worker when we run tsc. but it doesn't like the .ts extension.
|
|
84
|
+
* also it actually tries to import the file, which means you have to export
|
|
85
|
+
* some junk value.
|
|
86
|
+
*/
|
|
87
|
+
import export_worker_script from 'worker://../../treb-export/src/export-worker/index-modern.ts';
|
|
83
88
|
|
|
84
|
-
// ---
|
|
89
|
+
// --- types -------------------------------------------------------------------
|
|
85
90
|
|
|
86
91
|
/**
|
|
87
92
|
* options for saving files. we add the option for JSON formatting.
|
|
@@ -681,7 +686,7 @@ export class EmbeddedSpreadsheet {
|
|
|
681
686
|
// to the current view. this can lead to strange behavior depending
|
|
682
687
|
// on which window you're in. needs some thought.
|
|
683
688
|
|
|
684
|
-
this.key_listener = this.HandleKeyDown
|
|
689
|
+
this.key_listener = (event) => this.HandleKeyDown(event);
|
|
685
690
|
container.addEventListener('keydown', this.key_listener);
|
|
686
691
|
|
|
687
692
|
const toll_initial_render = !!(data || this.options.document);
|
|
@@ -867,16 +872,12 @@ export class EmbeddedSpreadsheet {
|
|
|
867
872
|
|
|
868
873
|
this.FlushUndo();
|
|
869
874
|
|
|
870
|
-
//
|
|
871
|
-
//
|
|
872
|
-
|
|
873
|
-
// if (options.freeze_rows || options.freeze_columns) {
|
|
874
|
-
// this.grid.Freeze(options.freeze_rows || 0, options.freeze_columns || 0);
|
|
875
|
-
// }
|
|
875
|
+
// why is this outside of the container test? there should be
|
|
876
|
+
// no reason to do this when headless
|
|
876
877
|
|
|
877
|
-
// if (typeof options.show_headers !== 'undefined') {
|
|
878
878
|
this.grid.ShowHeaders(this.options.headers);
|
|
879
|
-
|
|
879
|
+
|
|
880
|
+
// again, this should be gated on container
|
|
880
881
|
|
|
881
882
|
// optionally scroll grid on create (async -- why?)
|
|
882
883
|
|
|
@@ -1054,6 +1055,11 @@ export class EmbeddedSpreadsheet {
|
|
|
1054
1055
|
message: `You can't change part of an array`,
|
|
1055
1056
|
}
|
|
1056
1057
|
|
|
1058
|
+
case ErrorCode.invalid_area_for_paste:
|
|
1059
|
+
return {
|
|
1060
|
+
message: 'Invalid area for paste',
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1057
1063
|
case ErrorCode.invalid_area_for_table:
|
|
1058
1064
|
return {
|
|
1059
1065
|
message: `Invalid area for table`,
|
|
@@ -1906,12 +1912,15 @@ export class EmbeddedSpreadsheet {
|
|
|
1906
1912
|
|
|
1907
1913
|
const { x, y } = this.grid.GetScrollOffset();
|
|
1908
1914
|
const scale = this.grid.scale || 1;
|
|
1915
|
+
const auto_size = { width: 301, height: 301 };
|
|
1916
|
+
|
|
1917
|
+
// we're not sizing this very well at scale, because scale is stepped. FIXME
|
|
1909
1918
|
|
|
1910
1919
|
this.grid.CreateAnnotation({
|
|
1911
1920
|
type,
|
|
1912
1921
|
formula,
|
|
1913
1922
|
// class_name,
|
|
1914
|
-
}, undefined, undefined, target || { top: y / scale + 30, left: x / scale + 30,
|
|
1923
|
+
}, undefined, undefined, target || { top: y / scale + 30, left: x / scale + 30, ...auto_size });
|
|
1915
1924
|
|
|
1916
1925
|
}
|
|
1917
1926
|
|
|
@@ -3484,7 +3493,7 @@ export class EmbeddedSpreadsheet {
|
|
|
3484
3493
|
|
|
3485
3494
|
// still for now we can take advantage of that and skip the check.
|
|
3486
3495
|
|
|
3487
|
-
this.grid.
|
|
3496
|
+
this.grid.ApplyBorders2(range ? this.calculator.ResolveArea(range, this.grid.active_sheet) : undefined, borders, {}, width);
|
|
3488
3497
|
|
|
3489
3498
|
}
|
|
3490
3499
|
|