@trebco/treb 32.3.3 → 32.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/README.md +0 -6
- package/dist/treb-spreadsheet.mjs +10 -10
- package/package.json +2 -2
- package/treb-base-types/src/api_types.ts +1 -1
- package/treb-base-types/src/area-utils.ts +1 -1
- package/treb-base-types/src/area.ts +1 -1
- package/treb-base-types/src/basic_types.ts +1 -1
- package/treb-base-types/src/cell.ts +1 -1
- package/treb-base-types/src/cells.ts +1 -1
- package/treb-base-types/src/color.ts +1 -1
- package/treb-base-types/src/dom-utilities.ts +1 -1
- package/treb-base-types/src/evaluate-options.ts +21 -0
- package/treb-base-types/src/font-stack.ts +1 -1
- package/treb-base-types/src/gradient.ts +21 -0
- package/treb-base-types/src/import.ts +1 -1
- package/treb-base-types/src/index-standalone.ts +1 -1
- package/treb-base-types/src/index.ts +1 -1
- package/treb-base-types/src/layout.ts +1 -1
- package/treb-base-types/src/localization.ts +1 -1
- package/treb-base-types/src/rectangle.ts +1 -1
- package/treb-base-types/src/render_text.ts +1 -1
- package/treb-base-types/src/style.ts +20 -1
- package/treb-base-types/src/table.ts +1 -1
- package/treb-base-types/src/text_part.ts +1 -1
- package/treb-base-types/src/theme.ts +1 -1
- package/treb-base-types/src/union.ts +1 -1
- package/treb-base-types/src/value-type.ts +1 -1
- package/treb-base-types/style/resizable.css +1 -1
- package/treb-calculator/src/calculator.ts +5 -4
- package/treb-calculator/src/complex-math.ts +1 -1
- package/treb-calculator/src/dag/array-vertex.ts +1 -1
- package/treb-calculator/src/dag/calculation_leaf_vertex.ts +1 -1
- package/treb-calculator/src/dag/graph.ts +1 -1
- package/treb-calculator/src/dag/spreadsheet_vertex.ts +1 -1
- package/treb-calculator/src/dag/spreadsheet_vertex_base.ts +1 -1
- package/treb-calculator/src/dag/state_leaf_vertex.ts +1 -1
- package/treb-calculator/src/dag/vertex.ts +1 -1
- package/treb-calculator/src/descriptors.ts +1 -1
- package/treb-calculator/src/expression-calculator.ts +2 -2
- package/treb-calculator/src/function-error.ts +1 -1
- package/treb-calculator/src/function-library.ts +1 -1
- package/treb-calculator/src/functions/base-functions.ts +26 -4
- package/treb-calculator/src/functions/beta.ts +1 -1
- package/treb-calculator/src/functions/checkbox.ts +1 -1
- package/treb-calculator/src/functions/complex-functions.ts +1 -1
- package/treb-calculator/src/functions/date-utils.ts +1 -1
- package/treb-calculator/src/functions/finance-functions.ts +1 -1
- package/treb-calculator/src/functions/fp.ts +1 -1
- package/treb-calculator/src/functions/function-utilities.ts +21 -0
- package/treb-calculator/src/functions/gamma.ts +1 -1
- package/treb-calculator/src/functions/information-functions.ts +1 -1
- package/treb-calculator/src/functions/lambda-functions.ts +1 -1
- package/treb-calculator/src/functions/matrix-functions.ts +1 -1
- package/treb-calculator/src/functions/regex-functions.ts +1 -1
- package/treb-calculator/src/functions/sparkline.ts +1 -1
- package/treb-calculator/src/functions/statistics-functions.ts +1 -1
- package/treb-calculator/src/functions/text-functions.ts +1 -1
- package/treb-calculator/src/index.ts +1 -1
- package/treb-calculator/src/notifier-types.ts +1 -1
- package/treb-calculator/src/primitives.ts +1 -1
- package/treb-calculator/src/utilities.ts +1 -1
- package/treb-charts/src/chart-functions.ts +1 -1
- package/treb-charts/src/chart-types.ts +1 -1
- package/treb-charts/src/chart-utils.ts +1 -1
- package/treb-charts/src/chart.ts +21 -0
- package/treb-charts/src/default-chart-renderer.ts +21 -0
- package/treb-charts/src/index.ts +1 -1
- package/treb-charts/src/main.ts +1 -1
- package/treb-charts/src/quicksort.ts +1 -1
- package/treb-charts/src/rectangle.ts +1 -1
- package/treb-charts/src/renderer-type.ts +21 -0
- package/treb-charts/src/renderer.ts +1 -1
- package/treb-charts/src/util.ts +1 -1
- package/treb-charts/style/charts.scss +1 -1
- package/treb-data-model/src/annotation.ts +1 -1
- package/treb-data-model/src/conditional_format.ts +34 -2
- package/treb-data-model/src/data-validation.ts +21 -0
- package/treb-data-model/src/data_model.ts +1 -1
- package/treb-data-model/src/index.ts +1 -1
- package/treb-data-model/src/language-model.ts +1 -1
- package/treb-data-model/src/named.ts +1 -1
- package/treb-data-model/src/serialize_options.ts +1 -1
- package/treb-data-model/src/sheet.ts +43 -30
- package/treb-data-model/src/sheet_collection.ts +21 -0
- package/treb-data-model/src/sheet_selection.ts +1 -1
- package/treb-data-model/src/sheet_types.ts +1 -1
- package/treb-data-model/src/types.ts +21 -0
- package/treb-embed/src/content-types.d.ts +21 -0
- package/treb-embed/src/custom-element/global.d.ts +21 -0
- package/treb-embed/src/custom-element/spreadsheet-constructor.ts +21 -0
- package/treb-embed/src/custom-element/treb-global.ts +21 -0
- package/treb-embed/src/custom-element/treb-spreadsheet-element.ts +21 -0
- package/treb-embed/src/embedded-spreadsheet.ts +40 -1
- package/treb-embed/src/export-worker.ts +1 -1
- package/treb-embed/src/index.ts +21 -0
- package/treb-embed/src/options.ts +1 -1
- package/treb-embed/src/plugin.ts +1 -1
- package/treb-embed/src/progress-dialog.ts +1 -1
- package/treb-embed/src/selection-state.ts +21 -0
- package/treb-embed/src/spinner.ts +1 -1
- package/treb-embed/src/toolbar-message.ts +21 -0
- package/treb-embed/src/types.ts +1 -1
- package/treb-embed/style/autocomplete.scss +1 -1
- package/treb-embed/style/dark-theme.scss +1 -1
- package/treb-embed/style/defaults.scss +1 -1
- package/treb-embed/style/dialog.scss +1 -1
- package/treb-embed/style/dropdown-select.scss +1 -1
- package/treb-embed/style/font-stacks.scss +1 -1
- package/treb-embed/style/formula-bar.scss +1 -1
- package/treb-embed/style/grid.scss +1 -1
- package/treb-embed/style/layout.scss +21 -0
- package/treb-embed/style/mouse-mask.scss +1 -1
- package/treb-embed/style/note.scss +1 -1
- package/treb-embed/style/overlay-editor.scss +1 -1
- package/treb-embed/style/spinner.scss +1 -1
- package/treb-embed/style/tab-bar.scss +2 -1
- package/treb-embed/style/table.scss +1 -1
- package/treb-embed/style/theme-defaults.scss +1 -1
- package/treb-embed/style/toolbar.scss +26 -0
- package/treb-embed/style/tooltip.scss +1 -1
- package/treb-embed/style/treb-icons.scss +21 -0
- package/treb-embed/style/treb-spreadsheet-element.scss +21 -0
- package/treb-embed/style/z-index.scss +1 -1
- package/treb-export/src/address-type.ts +1 -1
- package/treb-export/src/base-template.ts +1 -1
- package/treb-export/src/column-width.ts +1 -1
- package/treb-export/src/{drawing2 → drawing}/bubble-chart-template.ts +1 -1
- package/treb-export/src/{drawing2 → drawing}/chart-template-components2.ts +1 -1
- package/treb-export/src/{drawing2/chart2.ts → drawing/chart.ts} +1 -1
- package/treb-export/src/{drawing2 → drawing}/column-chart-template2.ts +1 -1
- package/treb-export/src/{drawing2 → drawing}/donut-chart-template2.ts +1 -1
- package/treb-export/src/{drawing2/drawing2.ts → drawing/drawing.ts} +3 -3
- package/treb-export/src/{drawing2 → drawing}/embedded-image.ts +1 -1
- package/treb-export/src/{drawing2 → drawing}/scatter-chart-template2.ts +1 -1
- package/treb-export/src/export.ts +13 -13
- package/treb-export/src/import.ts +70 -8
- package/treb-export/src/index.worker.ts +1 -1
- package/treb-export/src/relationship.ts +1 -1
- package/treb-export/src/{shared-strings2.ts → shared-strings.ts} +1 -1
- package/treb-export/src/template-2.ts +1 -1
- package/treb-export/src/unescape_xml.ts +21 -0
- package/treb-export/src/{workbook-sheet2.ts → workbook-sheet.ts} +3 -3
- package/treb-export/src/{workbook-style2.ts → workbook-style.ts} +2 -2
- package/treb-export/src/{workbook-theme2.ts → workbook-theme.ts} +1 -3
- package/treb-export/src/{workbook2.ts → workbook.ts} +7 -7
- package/treb-export/src/xml-test.ts +21 -0
- package/treb-export/src/xml-utils.ts +1 -1
- package/treb-export/src/zip-wrapper.ts +21 -0
- package/treb-format/src/format.test.ts +1 -1
- package/treb-format/src/format.ts +1 -1
- package/treb-format/src/format_cache.ts +1 -1
- package/treb-format/src/format_parser.ts +1 -1
- package/treb-format/src/index.ts +1 -1
- package/treb-format/src/number_format_section.ts +1 -1
- package/treb-format/src/value_parser.ts +1 -1
- package/treb-grid/src/editors/autocomplete.ts +1 -1
- package/treb-grid/src/editors/autocomplete_matcher.ts +1 -1
- package/treb-grid/src/editors/editor.ts +1 -1
- package/treb-grid/src/editors/external_editor.ts +21 -0
- package/treb-grid/src/editors/formula_bar.ts +1 -1
- package/treb-grid/src/editors/overlay_editor.ts +1 -1
- package/treb-grid/src/index.ts +1 -1
- package/treb-grid/src/layout/base_layout.ts +1 -1
- package/treb-grid/src/layout/grid_layout.ts +1 -1
- package/treb-grid/src/layout/mock-layout.ts +21 -0
- package/treb-grid/src/render/selection-renderer.ts +1 -1
- package/treb-grid/src/render/svg_header_overlay.ts +1 -1
- package/treb-grid/src/render/svg_selection_block.ts +1 -1
- package/treb-grid/src/render/tile_renderer.ts +45 -3
- package/treb-grid/src/types/border_constants.ts +1 -1
- package/treb-grid/src/types/clipboard_data.ts +1 -1
- package/treb-grid/src/types/clipboard_data2.ts +1 -1
- package/treb-grid/src/types/drag_mask.ts +1 -1
- package/treb-grid/src/types/external_editor_config.ts +21 -0
- package/treb-grid/src/types/grid.ts +10 -10
- package/treb-grid/src/types/grid_base.ts +3 -2
- package/treb-grid/src/types/grid_command.ts +4 -1
- package/treb-grid/src/types/grid_events.ts +1 -1
- package/treb-grid/src/types/grid_options.ts +1 -1
- package/treb-grid/src/types/scale-control.ts +1 -1
- package/treb-grid/src/types/set_range_options.ts +1 -1
- package/treb-grid/src/types/tab_bar.ts +37 -8
- package/treb-grid/src/types/tile.ts +1 -1
- package/treb-grid/src/types/update_flags.ts +1 -1
- package/treb-grid/src/util/fontmetrics.ts +1 -1
- package/treb-grid/src/util/ua.ts +1 -1
- package/treb-parser/src/csv-parser.ts +1 -1
- package/treb-parser/src/index.ts +1 -1
- package/treb-parser/src/md-parser.ts +1 -1
- package/treb-parser/src/parser-types.ts +15 -1
- package/treb-parser/src/parser.ts +40 -7
- package/treb-utils/src/event_source.ts +1 -1
- package/treb-utils/src/ievent_source.ts +1 -1
- package/treb-utils/src/index.ts +1 -1
- package/treb-utils/src/measurement.ts +1 -1
- package/treb-utils/src/scale.ts +1 -1
- package/treb-utils/src/serialize_html.ts +1 -1
- package/treb-utils/src/validate_uri.ts +21 -0
|
@@ -1,3 +1,24 @@
|
|
|
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-2025 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
1
22
|
|
|
2
23
|
import type { DataModel, ViewModel } from 'treb-data-model';
|
|
3
24
|
import { BaseLayout } from './base_layout';
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* You should have received a copy of the GNU General Public License along
|
|
15
15
|
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
16
|
*
|
|
17
|
-
* Copyright 2022-
|
|
17
|
+
* Copyright 2022-2025 trebco, llc.
|
|
18
18
|
* info@treb.app
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -24,7 +24,8 @@ import type { ICellAddress,
|
|
|
24
24
|
Cell, Size,
|
|
25
25
|
CellStyle,
|
|
26
26
|
Theme,
|
|
27
|
-
HorizontalAlign
|
|
27
|
+
HorizontalAlign,
|
|
28
|
+
ExtendedCelLStyle} from 'treb-base-types';
|
|
28
29
|
import { TextPartFlag, Style, ValueType, Area, Rectangle, ResolveThemeColor, IsDefinedColor } from 'treb-base-types';
|
|
29
30
|
|
|
30
31
|
import type { Tile } from '../types/tile';
|
|
@@ -2017,6 +2018,44 @@ export class TileRenderer {
|
|
|
2017
2018
|
}
|
|
2018
2019
|
|
|
2019
2020
|
}
|
|
2021
|
+
|
|
2022
|
+
if ((style as ExtendedCelLStyle).databar && height > 7 && width > 9) { // FIXME: buffers
|
|
2023
|
+
|
|
2024
|
+
const db = (style as ExtendedCelLStyle).databar;
|
|
2025
|
+
if (db) {
|
|
2026
|
+
|
|
2027
|
+
const margin = { x: 4, y: 3}; // FIXME: parameterize, move out of this function/block
|
|
2028
|
+
context.fillStyle = ResolveThemeColor(this.theme, db.fill);
|
|
2029
|
+
|
|
2030
|
+
const bar_top = margin.y;
|
|
2031
|
+
const bar_height = height - (margin.y * 2 + 1);
|
|
2032
|
+
let bar_left = margin.x;
|
|
2033
|
+
let bar_width = 0;
|
|
2034
|
+
|
|
2035
|
+
if (db.zero > 0) {
|
|
2036
|
+
bar_left = bar_left + db.zero * (width - (margin.x * 2 + 1));
|
|
2037
|
+
if (db.value > db.zero) {
|
|
2038
|
+
bar_width = (width - (margin.x * 2 + 1)) * (db.value - db.zero);
|
|
2039
|
+
}
|
|
2040
|
+
else {
|
|
2041
|
+
|
|
2042
|
+
if (db.negative) {
|
|
2043
|
+
context.fillStyle = ResolveThemeColor(this.theme, db.negative);
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
bar_width = (width - (margin.x * 2 + 1)) * (db.zero - db.value);
|
|
2047
|
+
bar_left -= bar_width;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
else {
|
|
2051
|
+
bar_width = (width - (margin.x * 2 + 1)) * db.value;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
context.fillRect(bar_left, bar_top, bar_width, bar_height);
|
|
2055
|
+
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
}
|
|
2020
2059
|
|
|
2021
2060
|
// NOTE: we are getting fontmetrics based on the base font (so ignoring italic
|
|
2022
2061
|
// and bold variants). this should be OK because we use it for height, mostly.
|
|
@@ -2095,7 +2134,10 @@ export class TileRenderer {
|
|
|
2095
2134
|
break;
|
|
2096
2135
|
}
|
|
2097
2136
|
|
|
2098
|
-
if ((
|
|
2137
|
+
if ((style as ExtendedCelLStyle).databar?.hide_values) {
|
|
2138
|
+
// ...
|
|
2139
|
+
}
|
|
2140
|
+
else if ((cell.type === ValueType.number ||
|
|
2099
2141
|
cell.calculated_type === ValueType.number ||
|
|
2100
2142
|
cell.type === ValueType.complex ||
|
|
2101
2143
|
cell.calculated_type === ValueType.complex) && overflow) {
|
|
@@ -1,3 +1,24 @@
|
|
|
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-2025 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
1
22
|
|
|
2
23
|
import type { IArea, ICellAddress } from 'treb-base-types';
|
|
3
24
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* You should have received a copy of the GNU General Public License along
|
|
15
15
|
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
16
|
*
|
|
17
|
-
* Copyright 2022-
|
|
17
|
+
* Copyright 2022-2025 trebco, llc.
|
|
18
18
|
* info@treb.app
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -1311,7 +1311,7 @@ export class Grid extends GridBase {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
|
|
1313
1313
|
if (this.tab_bar) {
|
|
1314
|
-
this.tab_bar.Update();
|
|
1314
|
+
this.tab_bar.Update(false); // !user
|
|
1315
1315
|
}
|
|
1316
1316
|
|
|
1317
1317
|
}
|
|
@@ -1320,7 +1320,7 @@ export class Grid extends GridBase {
|
|
|
1320
1320
|
* This function is called via Shift+PageUp/PageDown. We need
|
|
1321
1321
|
* to update to account for hidden sheets, which can't be activated.
|
|
1322
1322
|
*/
|
|
1323
|
-
public NextSheet(step = 1): void {
|
|
1323
|
+
public NextSheet(step = 1, user = false): void {
|
|
1324
1324
|
|
|
1325
1325
|
if (this.model.sheets.length === 1) {
|
|
1326
1326
|
return;
|
|
@@ -1344,7 +1344,7 @@ export class Grid extends GridBase {
|
|
|
1344
1344
|
if (visible[i].sheet === this.active_sheet) {
|
|
1345
1345
|
let index = (i + step) % visible.length;
|
|
1346
1346
|
while (index < 0) { index += visible.length; }
|
|
1347
|
-
this.ActivateSheet(visible[index].index);
|
|
1347
|
+
this.ActivateSheet(visible[index].index, user);
|
|
1348
1348
|
return;
|
|
1349
1349
|
}
|
|
1350
1350
|
}
|
|
@@ -1430,7 +1430,7 @@ export class Grid extends GridBase {
|
|
|
1430
1430
|
}
|
|
1431
1431
|
|
|
1432
1432
|
if (this.tab_bar) {
|
|
1433
|
-
this.tab_bar.Update();
|
|
1433
|
+
this.tab_bar.Update(false); // !user
|
|
1434
1434
|
}
|
|
1435
1435
|
|
|
1436
1436
|
}
|
|
@@ -1453,7 +1453,7 @@ export class Grid extends GridBase {
|
|
|
1453
1453
|
*/
|
|
1454
1454
|
public UpdateTabBar(): void {
|
|
1455
1455
|
if (this.tab_bar) {
|
|
1456
|
-
this.tab_bar.Update();
|
|
1456
|
+
this.tab_bar.Update(true); // user? ...
|
|
1457
1457
|
}
|
|
1458
1458
|
}
|
|
1459
1459
|
|
|
@@ -1730,7 +1730,7 @@ export class Grid extends GridBase {
|
|
|
1730
1730
|
// this.tab_bar.Update();
|
|
1731
1731
|
//}
|
|
1732
1732
|
|
|
1733
|
-
this.tab_bar?.Update();
|
|
1733
|
+
this.tab_bar?.Update(false);
|
|
1734
1734
|
|
|
1735
1735
|
this.Repaint(true);
|
|
1736
1736
|
}
|
|
@@ -2673,7 +2673,7 @@ export class Grid extends GridBase {
|
|
|
2673
2673
|
|
|
2674
2674
|
protected RenameSheetInternal(target: Sheet, name: string) {
|
|
2675
2675
|
super.RenameSheetInternal(target, name);
|
|
2676
|
-
this.tab_bar?.Update();
|
|
2676
|
+
this.tab_bar?.Update(false);
|
|
2677
2677
|
|
|
2678
2678
|
}
|
|
2679
2679
|
|
|
@@ -2898,7 +2898,7 @@ export class Grid extends GridBase {
|
|
|
2898
2898
|
activate: this.active_sheet,
|
|
2899
2899
|
});
|
|
2900
2900
|
|
|
2901
|
-
if (this.tab_bar) { this.tab_bar.Update(); }
|
|
2901
|
+
if (this.tab_bar) { this.tab_bar.Update(!!command.user); }
|
|
2902
2902
|
|
|
2903
2903
|
this.layout.scroll_offset = this.active_sheet.scroll_offset;
|
|
2904
2904
|
|
|
@@ -5237,7 +5237,7 @@ export class Grid extends GridBase {
|
|
|
5237
5237
|
case 'PageUp':
|
|
5238
5238
|
case 'PageDown':
|
|
5239
5239
|
if (event.shiftKey) {
|
|
5240
|
-
this.NextSheet(event.key === 'PageUp' ? -1 : 1);
|
|
5240
|
+
this.NextSheet(event.key === 'PageUp' ? -1 : 1, true);
|
|
5241
5241
|
break;
|
|
5242
5242
|
}
|
|
5243
5243
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* You should have received a copy of the GNU General Public License along
|
|
15
15
|
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
16
|
*
|
|
17
|
-
* Copyright 2022-
|
|
17
|
+
* Copyright 2022-2025 trebco, llc.
|
|
18
18
|
* info@treb.app
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -254,7 +254,7 @@ export class GridBase {
|
|
|
254
254
|
* activate sheet, by name or index number
|
|
255
255
|
* @param sheet number (index into the array) or string (name)
|
|
256
256
|
*/
|
|
257
|
-
public ActivateSheet(sheet: number | string): void {
|
|
257
|
+
public ActivateSheet(sheet: number | string, user?: boolean): void {
|
|
258
258
|
|
|
259
259
|
const index = (typeof sheet === 'number') ? sheet : undefined;
|
|
260
260
|
const name = (typeof sheet === 'string') ? sheet : undefined;
|
|
@@ -263,6 +263,7 @@ export class GridBase {
|
|
|
263
263
|
key: CommandKey.ActivateSheet,
|
|
264
264
|
index,
|
|
265
265
|
name,
|
|
266
|
+
user,
|
|
266
267
|
});
|
|
267
268
|
|
|
268
269
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* You should have received a copy of the GNU General Public License along
|
|
15
15
|
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
16
|
*
|
|
17
|
-
* Copyright 2022-
|
|
17
|
+
* Copyright 2022-2025 trebco, llc.
|
|
18
18
|
* info@treb.app
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -431,6 +431,9 @@ export interface ActivateSheetCommand extends SheetSelection {
|
|
|
431
431
|
tab_bar_event?: boolean;
|
|
432
432
|
|
|
433
433
|
force?: boolean;
|
|
434
|
+
|
|
435
|
+
/** user action; use smooth scrolling */
|
|
436
|
+
user?: boolean;
|
|
434
437
|
}
|
|
435
438
|
|
|
436
439
|
/**
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* You should have received a copy of the GNU General Public License along
|
|
15
15
|
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
16
|
*
|
|
17
|
-
* Copyright 2022-
|
|
17
|
+
* Copyright 2022-2025 trebco, llc.
|
|
18
18
|
* info@treb.app
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -235,7 +235,8 @@ export class TabBar extends EventSource<TabEvent> {
|
|
|
235
235
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
public SetActive(tab: HTMLElement, active: boolean): void {
|
|
238
|
+
public SetActive(tab: HTMLElement, active: boolean, user = false): void {
|
|
239
|
+
|
|
239
240
|
if (active) {
|
|
240
241
|
// tab.classList.add('treb-selected');
|
|
241
242
|
tab.setAttribute('selected', '');
|
|
@@ -245,8 +246,33 @@ export class TabBar extends EventSource<TabEvent> {
|
|
|
245
246
|
tab.style.color = '';
|
|
246
247
|
}
|
|
247
248
|
|
|
249
|
+
// this is forcing the page to scroll if the sheet is below
|
|
250
|
+
// the fold. this is not useful behavior. at the same time,
|
|
251
|
+
// we do need this to work... we probably have to do it manually
|
|
252
|
+
// instead of using scrollIntoView. would be nice if we could
|
|
253
|
+
// toggle this on manual/auto, so user clicks would still be
|
|
254
|
+
// smooth. call that a TODO
|
|
255
|
+
|
|
248
256
|
requestAnimationFrame(() => {
|
|
249
|
-
|
|
257
|
+
if (user) {
|
|
258
|
+
tab.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest'});
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
if (tab.parentElement) {
|
|
262
|
+
const left = tab.offsetLeft;
|
|
263
|
+
const width = tab.offsetWidth;
|
|
264
|
+
const container_width = tab.parentElement.clientWidth || 0;
|
|
265
|
+
const scroll_left = tab.parentElement.scrollLeft || 0;
|
|
266
|
+
|
|
267
|
+
if (left > container_width) {
|
|
268
|
+
tab.parentElement.scrollLeft = left - width;
|
|
269
|
+
}
|
|
270
|
+
else if (scroll_left > left) {
|
|
271
|
+
tab.parentElement.scrollLeft = left;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
}
|
|
250
276
|
});
|
|
251
277
|
|
|
252
278
|
}
|
|
@@ -298,7 +324,7 @@ export class TabBar extends EventSource<TabEvent> {
|
|
|
298
324
|
case 'Escape':
|
|
299
325
|
tab.innerText = sheet.name;
|
|
300
326
|
this.Publish({ type: 'cancel' });
|
|
301
|
-
this.Update();
|
|
327
|
+
this.Update(true);
|
|
302
328
|
break;
|
|
303
329
|
|
|
304
330
|
default:
|
|
@@ -314,7 +340,7 @@ export class TabBar extends EventSource<TabEvent> {
|
|
|
314
340
|
this.Publish({ type: 'rename-sheet', name, sheet });
|
|
315
341
|
}
|
|
316
342
|
else {
|
|
317
|
-
this.Update();
|
|
343
|
+
this.Update(true);
|
|
318
344
|
}
|
|
319
345
|
});
|
|
320
346
|
|
|
@@ -350,7 +376,7 @@ export class TabBar extends EventSource<TabEvent> {
|
|
|
350
376
|
// then the classes won't change.
|
|
351
377
|
|
|
352
378
|
for (const candidate of tabs) {
|
|
353
|
-
this.SetActive(candidate, candidate === tab);
|
|
379
|
+
this.SetActive(candidate, candidate === tab, true);
|
|
354
380
|
}
|
|
355
381
|
|
|
356
382
|
this.dragging = true;
|
|
@@ -445,8 +471,11 @@ export class TabBar extends EventSource<TabEvent> {
|
|
|
445
471
|
|
|
446
472
|
/**
|
|
447
473
|
* update tabs from model.
|
|
474
|
+
*
|
|
475
|
+
* @param user - this is a user action, so use smooth scrolling
|
|
476
|
+
* when activating the tab. otherwise it's automatic so jump.
|
|
448
477
|
*/
|
|
449
|
-
public Update(): void {
|
|
478
|
+
public Update(user = false): void {
|
|
450
479
|
|
|
451
480
|
this.tab_color_cache.clear(); // we're setting tab color but it's not getting updated otherwise
|
|
452
481
|
|
|
@@ -512,7 +541,7 @@ export class TabBar extends EventSource<TabEvent> {
|
|
|
512
541
|
tab.style.order = (index * 2).toString();
|
|
513
542
|
tab.role = 'tab';
|
|
514
543
|
|
|
515
|
-
this.SetActive(tab, sheet === this.view.active_sheet);
|
|
544
|
+
this.SetActive(tab, sheet === this.view.active_sheet, user);
|
|
516
545
|
|
|
517
546
|
const mousedown = (event: MouseEvent) => this.MouseDownTab(event, tab, sheet, index, tabs);
|
|
518
547
|
|
package/treb-grid/src/util/ua.ts
CHANGED
package/treb-parser/src/index.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* You should have received a copy of the GNU General Public License along
|
|
15
15
|
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
16
|
*
|
|
17
|
-
* Copyright 2022-
|
|
17
|
+
* Copyright 2022-2025 trebco, llc.
|
|
18
18
|
* info@treb.app
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -393,6 +393,12 @@ export interface OptionalParserFlags {
|
|
|
393
393
|
*/
|
|
394
394
|
r1c1: boolean,
|
|
395
395
|
|
|
396
|
+
/**
|
|
397
|
+
* handle r1c1 properly, which is to say use absolute addressing
|
|
398
|
+
* for absolute references and relative addressing otherwise. this should
|
|
399
|
+
* be the default, but I don't want to break anything.
|
|
400
|
+
*/
|
|
401
|
+
r1c1_proper_semantics: boolean;
|
|
396
402
|
|
|
397
403
|
/* *
|
|
398
404
|
* what if we do want =1/2 to be a fraction? more importantly, if we are
|
|
@@ -448,6 +454,14 @@ export interface RenderOptions {
|
|
|
448
454
|
/** force addresses to be relative */
|
|
449
455
|
r1c1_force_relative?: boolean;
|
|
450
456
|
|
|
457
|
+
/**
|
|
458
|
+
* handle r1c1 properly, which is to say use absolute addressing
|
|
459
|
+
* for absolute references and relative addressing otherwise (assuming
|
|
460
|
+
* there's a base set). this should be the default, but I don't want
|
|
461
|
+
* to break anything.
|
|
462
|
+
*/
|
|
463
|
+
r1c1_proper_semantics?: boolean;
|
|
464
|
+
|
|
451
465
|
/** if we're just translating, don't have to render addresses */
|
|
452
466
|
pass_through_addresses?: boolean;
|
|
453
467
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* You should have received a copy of the GNU General Public License along
|
|
15
15
|
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
16
|
*
|
|
17
|
-
* Copyright 2022-
|
|
17
|
+
* Copyright 2022-2025 trebco, llc.
|
|
18
18
|
* info@treb.app
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -602,15 +602,15 @@ export class Parser {
|
|
|
602
602
|
if (options.pass_through_addresses) {
|
|
603
603
|
return unit.label;
|
|
604
604
|
}
|
|
605
|
-
return options.r1c1 ? this.R1C1Label(unit, options
|
|
605
|
+
return options.r1c1 ? this.R1C1Label(unit, options) : this.AddressLabel(unit, offset);
|
|
606
606
|
|
|
607
607
|
case 'range':
|
|
608
608
|
if (options.pass_through_addresses) {
|
|
609
609
|
return unit.label;
|
|
610
610
|
}
|
|
611
611
|
return options.r1c1 ?
|
|
612
|
-
this.R1C1Label(unit.start, options
|
|
613
|
-
this.R1C1Label(unit.end, options
|
|
612
|
+
this.R1C1Label(unit.start, options) + ':' +
|
|
613
|
+
this.R1C1Label(unit.end, options) :
|
|
614
614
|
this.AddressLabel(unit.start, offset) + ':' + this.AddressLabel(unit.end, offset);
|
|
615
615
|
|
|
616
616
|
case 'missing':
|
|
@@ -962,10 +962,14 @@ export class Parser {
|
|
|
962
962
|
*/
|
|
963
963
|
protected R1C1Label(
|
|
964
964
|
address: UnitAddress,
|
|
965
|
-
|
|
966
|
-
|
|
965
|
+
options: Partial<RenderOptions>,
|
|
966
|
+
// base?: UnitAddress,
|
|
967
|
+
// force_relative = false,
|
|
967
968
|
): string {
|
|
968
969
|
|
|
970
|
+
const force_relative = !!options.r1c1_force_relative;
|
|
971
|
+
const base = options.r1c1_base;
|
|
972
|
+
|
|
969
973
|
let label = '';
|
|
970
974
|
|
|
971
975
|
if (address.sheet) { // && (!base?.sheet || base?.sheet !== address.sheet)) {
|
|
@@ -976,7 +980,30 @@ export class Parser {
|
|
|
976
980
|
let row = '';
|
|
977
981
|
let column = '';
|
|
978
982
|
|
|
979
|
-
if (force_relative && base) {
|
|
983
|
+
if (force_relative && options.r1c1_proper_semantics && base) {
|
|
984
|
+
|
|
985
|
+
if (address.absolute_row) {
|
|
986
|
+
row = (address.row + 1).toString();
|
|
987
|
+
}
|
|
988
|
+
else {
|
|
989
|
+
const delta_row = address.row - base.row;
|
|
990
|
+
if (delta_row) {
|
|
991
|
+
row = `[${delta_row}]`;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
if (address.absolute_column) {
|
|
996
|
+
column = (address.column + 1).toString();
|
|
997
|
+
}
|
|
998
|
+
else {
|
|
999
|
+
const delta_column = address.column - base.column;
|
|
1000
|
+
if (delta_column) {
|
|
1001
|
+
column = `[${delta_column}]`;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
}
|
|
1006
|
+
else if (force_relative && base) {
|
|
980
1007
|
const delta_row = address.row - base.row;
|
|
981
1008
|
const delta_column = address.column - base.column;
|
|
982
1009
|
|
|
@@ -2527,6 +2554,9 @@ export class Parser {
|
|
|
2527
2554
|
}
|
|
2528
2555
|
else if (match[1]){ // absolute
|
|
2529
2556
|
r1c1.row = Number(match[1]) - 1; // R1C1 is 1-based
|
|
2557
|
+
if (this.flags.r1c1_proper_semantics) {
|
|
2558
|
+
r1c1.absolute_row = true;
|
|
2559
|
+
}
|
|
2530
2560
|
}
|
|
2531
2561
|
else {
|
|
2532
2562
|
r1c1.offset_row = true;
|
|
@@ -2539,6 +2569,9 @@ export class Parser {
|
|
|
2539
2569
|
}
|
|
2540
2570
|
else if (match[2]) { // absolute
|
|
2541
2571
|
r1c1.column = Number(match[2]) - 1; // R1C1 is 1-based
|
|
2572
|
+
if (this.flags.r1c1_proper_semantics) {
|
|
2573
|
+
r1c1.absolute_column = true;
|
|
2574
|
+
}
|
|
2542
2575
|
}
|
|
2543
2576
|
else {
|
|
2544
2577
|
r1c1.offset_column = true;
|