@trebco/treb 25.2.0 → 25.5.0
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 +2 -2
- 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/theme.ts +0 -11
- 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 +57 -14
- package/treb-embed/src/embedded-spreadsheet.ts +81 -47
- package/treb-embed/src/options.ts +11 -0
- package/treb-embed/src/progress-dialog.ts +0 -3
- package/treb-embed/src/types.ts +14 -3
- package/treb-embed/style/layout.scss +32 -29
- package/treb-embed/style/theme-defaults.scss +5 -0
- 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) {
|
|
@@ -210,6 +208,10 @@ export class SpreadsheetConstructor {
|
|
|
210
208
|
case 'data-treb':
|
|
211
209
|
continue;
|
|
212
210
|
|
|
211
|
+
// has special handling as an attribute
|
|
212
|
+
case 'inline-document':
|
|
213
|
+
continue;
|
|
214
|
+
|
|
213
215
|
// special case
|
|
214
216
|
case 'src':
|
|
215
217
|
attribute_options.document = this.root.getAttribute('src') || undefined;
|
|
@@ -257,6 +259,49 @@ export class SpreadsheetConstructor {
|
|
|
257
259
|
}
|
|
258
260
|
}
|
|
259
261
|
|
|
262
|
+
// inline-document means look in the tag contents for a script
|
|
263
|
+
// element, and use that. the script must have type "application/json",
|
|
264
|
+
// and if it has a name, the name must match the value of the
|
|
265
|
+
// inline-document attribute.
|
|
266
|
+
//
|
|
267
|
+
// so either
|
|
268
|
+
//
|
|
269
|
+
// <treb-spreadsheet inline-document>
|
|
270
|
+
// <script type="application/json">{ ... }</script>
|
|
271
|
+
// </treb-spreadsheet>
|
|
272
|
+
//
|
|
273
|
+
// or
|
|
274
|
+
//
|
|
275
|
+
// <treb-spreadsheet inline-document="xyz">
|
|
276
|
+
// <script type="application/json" name="xyz">{ ... }</script>
|
|
277
|
+
// </treb-spreadsheet>
|
|
278
|
+
|
|
279
|
+
if (this.root.hasAttribute('inline-document')) {
|
|
280
|
+
const inline_name = this.root.getAttribute('inline-document') || '';
|
|
281
|
+
for (const element of Array.from(this.root.children)) {
|
|
282
|
+
if (element instanceof HTMLScriptElement) {
|
|
283
|
+
if (element.type === 'application/json') {
|
|
284
|
+
const name = element.getAttribute('name') || '';
|
|
285
|
+
if (name === inline_name) {
|
|
286
|
+
const content = element.textContent;
|
|
287
|
+
if (content) {
|
|
288
|
+
try {
|
|
289
|
+
options.inline_document = JSON.parse(content);
|
|
290
|
+
}
|
|
291
|
+
catch (err) {
|
|
292
|
+
console.error(err);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (!options.inline_document) {
|
|
301
|
+
console.warn('inline document failed');
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
260
305
|
this.root.innerHTML = html;
|
|
261
306
|
options.container = this.root.querySelector('.treb-layout-spreadsheet') as HTMLElement;
|
|
262
307
|
|
|
@@ -268,19 +313,15 @@ export class SpreadsheetConstructor {
|
|
|
268
313
|
|
|
269
314
|
// set a local variable so we don't have to keep testing the member
|
|
270
315
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
// console.info(sheet.options);
|
|
316
|
+
this.sheet = new EmbeddedSpreadsheet(options);
|
|
274
317
|
|
|
275
|
-
this.
|
|
276
|
-
|
|
277
|
-
if (!this.root) {
|
|
278
|
-
return; // the rest is UI setup
|
|
318
|
+
if (this.root) {
|
|
319
|
+
this.CreateLayout(this.sheet, this.root);
|
|
279
320
|
}
|
|
280
321
|
|
|
281
|
-
|
|
322
|
+
}
|
|
282
323
|
|
|
283
|
-
|
|
324
|
+
public CreateLayout(sheet: EmbeddedSpreadsheet, root: HTMLElement) {
|
|
284
325
|
|
|
285
326
|
// call our internal resize method when the node is resized
|
|
286
327
|
// (primary instance will handle views)
|
|
@@ -416,7 +457,7 @@ export class SpreadsheetConstructor {
|
|
|
416
457
|
let mask: HTMLElement|undefined;
|
|
417
458
|
let resizer: HTMLElement|undefined;
|
|
418
459
|
|
|
419
|
-
const resize_handle =
|
|
460
|
+
const resize_handle = root.querySelector('.treb-layout-resize-handle') as HTMLElement;
|
|
420
461
|
|
|
421
462
|
// mouse up handler added to mask (when created)
|
|
422
463
|
const mouse_up = () => finish();
|
|
@@ -464,9 +505,11 @@ export class SpreadsheetConstructor {
|
|
|
464
505
|
event.stopPropagation();
|
|
465
506
|
event.preventDefault();
|
|
466
507
|
|
|
467
|
-
|
|
508
|
+
const resize_parent = root.querySelector('.treb-main') as HTMLElement; // was document.body
|
|
509
|
+
|
|
510
|
+
resizer = Element<HTMLDivElement>('div', resize_parent, { classes: 'treb-resize-rect' });
|
|
468
511
|
|
|
469
|
-
mask = Element<HTMLDivElement>('div',
|
|
512
|
+
mask = Element<HTMLDivElement>('div', resize_parent, {
|
|
470
513
|
classes: 'treb-resize-mask',
|
|
471
514
|
style: 'cursor: nw-resize;',
|
|
472
515
|
});
|