@trebco/treb 25.0.1 → 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-config.json +1 -1
- package/api-generator/api-generator.ts +25 -55
- package/dist/treb-spreadsheet.mjs +14 -0
- package/{build → dist}/treb.d.ts +1 -1
- package/esbuild-custom-element.mjs +17 -265
- package/esbuild-utils.mjs +273 -0
- package/package.json +5 -4
- 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/markup/toolbar.html +2 -2
- package/treb-embed/modern.tsconfig.json +3 -2
- package/treb-embed/src/custom-element/spreadsheet-constructor.ts +17 -14
- package/treb-embed/src/embedded-spreadsheet.ts +100 -69
- package/treb-embed/src/progress-dialog.ts +0 -3
- package/treb-embed/src/types.ts +13 -3
- package/treb-embed/style/dialog.scss +2 -0
- package/treb-embed/style/layout.scss +43 -40
- package/treb-embed/style/toolbar.scss +38 -38
- package/treb-embed/style/treb-icons.scss +53 -43
- 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 +4 -5
- package/util/list-css-vars.sh +8 -11
- package/build/treb-spreadsheet.mjs +0 -14
- package/esbuild.js +0 -305
- 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 {
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<div separator></div>
|
|
7
7
|
<button data-command="import-file">Open file...</button>
|
|
8
8
|
<button data-command="save-json">Save JSON</button>
|
|
9
|
-
<div separator></div>
|
|
10
|
-
<button data-command="export-xlsx">Export XLSX</button>
|
|
9
|
+
<div separator xlsx-support></div>
|
|
10
|
+
<button data-command="export-xlsx" xlsx-support>Export XLSX</button>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -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) {
|
|
@@ -262,21 +260,21 @@ export class SpreadsheetConstructor {
|
|
|
262
260
|
|
|
263
261
|
}
|
|
264
262
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
263
|
+
if (!process.env.XLSX_SUPPORT) {
|
|
264
|
+
options.export = false; // remove export button from sidebar
|
|
265
|
+
}
|
|
268
266
|
|
|
269
|
-
//
|
|
267
|
+
// set a local variable so we don't have to keep testing the member
|
|
270
268
|
|
|
271
|
-
this.sheet =
|
|
269
|
+
this.sheet = new EmbeddedSpreadsheet(options);
|
|
272
270
|
|
|
273
|
-
if (
|
|
274
|
-
|
|
271
|
+
if (this.root) {
|
|
272
|
+
this.CreateLayout(this.sheet, this.root);
|
|
275
273
|
}
|
|
276
274
|
|
|
277
|
-
|
|
275
|
+
}
|
|
278
276
|
|
|
279
|
-
|
|
277
|
+
public CreateLayout(sheet: EmbeddedSpreadsheet, root: HTMLElement) {
|
|
280
278
|
|
|
281
279
|
// call our internal resize method when the node is resized
|
|
282
280
|
// (primary instance will handle views)
|
|
@@ -412,7 +410,7 @@ export class SpreadsheetConstructor {
|
|
|
412
410
|
let mask: HTMLElement|undefined;
|
|
413
411
|
let resizer: HTMLElement|undefined;
|
|
414
412
|
|
|
415
|
-
const resize_handle =
|
|
413
|
+
const resize_handle = root.querySelector('.treb-layout-resize-handle') as HTMLElement;
|
|
416
414
|
|
|
417
415
|
// mouse up handler added to mask (when created)
|
|
418
416
|
const mouse_up = () => finish();
|
|
@@ -460,9 +458,11 @@ export class SpreadsheetConstructor {
|
|
|
460
458
|
event.stopPropagation();
|
|
461
459
|
event.preventDefault();
|
|
462
460
|
|
|
463
|
-
|
|
461
|
+
const resize_parent = root.querySelector('.treb-main') as HTMLElement; // was document.body
|
|
464
462
|
|
|
465
|
-
|
|
463
|
+
resizer = Element<HTMLDivElement>('div', resize_parent, { classes: 'treb-resize-rect' });
|
|
464
|
+
|
|
465
|
+
mask = Element<HTMLDivElement>('div', resize_parent, {
|
|
466
466
|
classes: 'treb-resize-mask',
|
|
467
467
|
style: 'cursor: nw-resize;',
|
|
468
468
|
});
|
|
@@ -806,6 +806,9 @@ export class SpreadsheetConstructor {
|
|
|
806
806
|
if (!sheet.options.toolbar_recalculate_button) {
|
|
807
807
|
remove.push(toolbar.querySelector('[recalculate-button]'));
|
|
808
808
|
}
|
|
809
|
+
if (!process.env.XLSX_SUPPORT) {
|
|
810
|
+
remove.push(...Array.from(toolbar.querySelectorAll('[xlsx-support]')));
|
|
811
|
+
}
|
|
809
812
|
|
|
810
813
|
for (const element of remove) {
|
|
811
814
|
if (element) {
|