@trebco/treb 32.13.2 → 36.1.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/api-generator/api-generator-types.ts +3 -0
- package/api-generator/api-generator.ts +15 -1
- package/bun.lock +145 -99
- package/dist/chunk-43DLP2OX.mjs +11 -0
- package/dist/chunk-4CKS56PE.mjs +11 -0
- package/dist/chunk-75PARUQE.mjs +11 -0
- package/dist/chunk-7QD63AZS.mjs +24601 -0
- package/dist/chunk-A55ARVRD.mjs +11 -0
- package/dist/chunk-DESAKYW4.mjs +11 -0
- package/dist/chunk-EQ2R5W6P.mjs +24565 -0
- package/dist/chunk-IYJU2J6D.mjs +24601 -0
- package/dist/chunk-KSJFPGXT.mjs +11 -0
- package/dist/chunk-ORQFKLXM.mjs +24601 -0
- package/dist/chunk-SFDNNDHY.mjs +11 -0
- package/dist/chunk-T47DX5MI.mjs +11 -0
- package/dist/chunk-T6ILBVEX.mjs +11 -0
- package/dist/chunk-TPRCDYYG.mjs +11 -0
- package/dist/chunk-YAHNOOHO.mjs +11 -0
- package/dist/treb-export-worker.mjs +9 -2
- package/dist/treb-spreadsheet.mjs +7 -19
- package/dist/treb.d.ts +20 -4
- package/esbuild-composite.mjs +18 -6
- package/esbuild-utils.mjs +62 -3
- package/i18n/languages/treb-i18n-da.mjs +1 -1
- package/i18n/languages/treb-i18n-de.mjs +1 -1
- package/i18n/languages/treb-i18n-es.mjs +1 -1
- package/i18n/languages/treb-i18n-fr.mjs +1 -1
- package/i18n/languages/treb-i18n-it.mjs +1 -1
- package/i18n/languages/treb-i18n-nl.mjs +1 -1
- package/i18n/languages/treb-i18n-no.mjs +1 -1
- package/i18n/languages/treb-i18n-pl.mjs +1 -1
- package/i18n/languages/treb-i18n-pt.mjs +1 -1
- package/i18n/languages/treb-i18n-sv.mjs +1 -1
- package/ooxml-types/README.md +141 -0
- package/ooxml-types/package.json +5 -0
- package/ooxml-types/src/types/drawingml/chart.ts +327 -0
- package/ooxml-types/src/types/drawingml/index.ts +63 -0
- package/ooxml-types/src/types/drawingml/spreadsheetDrawing.ts +105 -0
- package/ooxml-types/src/types/drawingml/theme.ts +104 -0
- package/ooxml-types/src/types/index.ts +3 -0
- package/ooxml-types/src/types/package/contentTypes.ts +49 -0
- package/ooxml-types/src/types/package/docProps.ts +46 -0
- package/ooxml-types/src/types/package/index.ts +17 -0
- package/ooxml-types/src/types/package/relationships.ts +37 -0
- package/ooxml-types/src/types/spreadsheetml/columns.ts +20 -0
- package/ooxml-types/src/types/spreadsheetml/comments.ts +30 -0
- package/ooxml-types/src/types/spreadsheetml/dataFeatures.ts +261 -0
- package/ooxml-types/src/types/spreadsheetml/enums.ts +175 -0
- package/ooxml-types/src/types/spreadsheetml/index.ts +186 -0
- package/ooxml-types/src/types/spreadsheetml/metadata.ts +90 -0
- package/ooxml-types/src/types/spreadsheetml/misc.ts +35 -0
- package/ooxml-types/src/types/spreadsheetml/pageLayout.ts +83 -0
- package/ooxml-types/src/types/spreadsheetml/sharedStrings.ts +33 -0
- package/ooxml-types/src/types/spreadsheetml/sheetData.ts +70 -0
- package/ooxml-types/src/types/spreadsheetml/sheetProperties.ts +86 -0
- package/ooxml-types/src/types/spreadsheetml/sheetViews.ts +51 -0
- package/ooxml-types/src/types/spreadsheetml/sparkline.ts +46 -0
- package/ooxml-types/src/types/spreadsheetml/styles.ts +274 -0
- package/ooxml-types/src/types/spreadsheetml/table.ts +106 -0
- package/ooxml-types/src/types/spreadsheetml/util.ts +15 -0
- package/ooxml-types/src/types/spreadsheetml/workbook.ts +165 -0
- package/ooxml-types/src/types/spreadsheetml/worksheet.ts +60 -0
- package/package.json +13 -11
- 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 +1 -1
- package/treb-base-types/src/font-stack.ts +1 -1
- package/treb-base-types/src/gradient.ts +1 -1
- 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 +2 -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 +7 -1
- package/treb-base-types/src/style.ts +1 -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 +4 -1
- package/treb-base-types/src/value-type.ts +1 -1
- package/treb-base-types/src/worker-proxy.ts +294 -0
- package/treb-base-types/style/resizable.css +1 -1
- package/treb-calculator/src/calculator.ts +133 -14
- 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 +9 -1
- package/treb-calculator/src/expression-calculator.ts +1 -1
- 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 +10 -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 +2 -4
- package/treb-calculator/src/functions/fp.ts +1 -1
- package/treb-calculator/src/functions/function-utilities.ts +1 -1
- 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 +4 -1
- package/treb-calculator/src/functions/matrix-functions.ts +1 -1
- package/treb-calculator/src/functions/normal.ts +1 -1
- package/treb-calculator/src/functions/regex-functions.ts +13 -4
- package/treb-calculator/src/functions/sparkline.ts +1 -1
- package/treb-calculator/src/functions/statistics-functions.ts +1 -1
- package/treb-calculator/src/functions/students-t.ts +1 -1
- package/treb-calculator/src/functions/text-functions.ts +5 -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 +1 -1
- package/treb-charts/src/default-chart-renderer.ts +1 -1
- 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 +1 -1
- 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 +1 -1
- package/treb-data-model/src/data-validation.ts +1 -1
- package/treb-data-model/src/data_model.ts +32 -5
- 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 +1 -1
- package/treb-data-model/src/sheet_collection.ts +1 -1
- 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 +1 -1
- package/treb-embed/src/content-types.d.ts +1 -1
- package/treb-embed/src/custom-element/global.d.ts +1 -1
- package/treb-embed/src/custom-element/spreadsheet-constructor.ts +1 -1
- package/treb-embed/src/custom-element/treb-global.ts +1 -1
- package/treb-embed/src/custom-element/treb-spreadsheet-element.ts +1 -1
- package/treb-embed/src/embedded-spreadsheet.ts +342 -149
- package/treb-embed/src/index.ts +1 -1
- package/treb-embed/src/options.ts +4 -2
- package/treb-embed/src/plugin.ts +1 -1
- package/treb-embed/src/progress-dialog.ts +1 -1
- package/treb-embed/src/selection-state.ts +1 -1
- package/treb-embed/src/spinner.ts +1 -1
- package/treb-embed/src/toolbar-message.ts +6 -1
- package/treb-embed/src/types.ts +13 -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 +1 -1
- 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 +1 -1
- package/treb-embed/style/table.scss +1 -1
- package/treb-embed/style/theme-defaults.scss +1 -1
- package/treb-embed/style/toolbar.scss +1 -1
- package/treb-embed/style/tooltip.scss +1 -1
- package/treb-embed/style/treb-icons.scss +1 -1
- package/treb-embed/style/treb-spreadsheet-element.scss +1 -1
- 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/drawing/bubble-chart-template.ts +1 -1
- package/treb-export/src/drawing/chart-template-components2.ts +1 -1
- package/treb-export/src/drawing/chart.ts +1 -1
- package/treb-export/src/drawing/column-chart-template2.ts +1 -1
- package/treb-export/src/drawing/donut-chart-template2.ts +1 -1
- package/treb-export/src/drawing/drawing.ts +1 -1
- package/treb-export/src/drawing/embedded-image.ts +1 -1
- package/treb-export/src/drawing/scatter-chart-template2.ts +1 -1
- package/treb-export/src/export.ts +121 -8
- package/treb-export/src/import-export-messages.ts +61 -0
- package/treb-export/src/import.ts +318 -301
- package/treb-export/src/index.worker.ts +85 -53
- package/treb-export/src/metadata.ts +71 -3
- package/treb-export/src/ooxml.ts +47 -0
- package/treb-export/src/relationship.ts +1 -1
- package/treb-export/src/shared-strings.ts +19 -15
- package/treb-export/src/template-2.ts +1 -1
- package/treb-export/src/unescape_xml.ts +1 -1
- package/treb-export/src/workbook-sheet.ts +11 -6
- package/treb-export/src/workbook-style.ts +137 -25
- package/treb-export/src/workbook-theme.ts +20 -4
- package/treb-export/src/workbook.ts +85 -88
- package/treb-export/src/xml-test.ts +1 -1
- package/treb-export/src/xml-utils.ts +1 -1
- package/treb-export/src/zip-wrapper.ts +1 -1
- package/treb-export/tsconfig.json +2 -1
- package/treb-format/src/format.test.ts +1 -1
- package/treb-format/src/format.ts +12 -5
- package/treb-format/src/format_cache.ts +3 -3
- 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 +15 -6
- package/treb-grid/src/editors/external_editor.ts +33 -8
- package/treb-grid/src/editors/formula_bar.ts +12 -1
- package/treb-grid/src/editors/overlay_editor.ts +4 -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 +1 -1
- 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 +36 -7
- 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 +1 -1
- package/treb-grid/src/types/grid.ts +181 -40
- package/treb-grid/src/types/grid_base.ts +7 -4
- package/treb-grid/src/types/grid_command.ts +7 -1
- package/treb-grid/src/types/grid_events.ts +2 -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 +1 -1
- 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 +1 -1
- package/treb-parser/src/parser.ts +1 -1
- 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 +1 -1
- package/tsproject.json +2 -3
- package/treb-embed/src/export-worker.ts +0 -44
|
@@ -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-2026 trebco, llc.
|
|
18
18
|
* info@treb.app
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -79,7 +79,7 @@ import { GridLayout } from '../layout/grid_layout';
|
|
|
79
79
|
import { OverlayEditor } from '../editors/overlay_editor';
|
|
80
80
|
|
|
81
81
|
import { TileRenderer } from '../render/tile_renderer';
|
|
82
|
-
import type { GridEvent } from './grid_events';
|
|
82
|
+
import type { GridEvent, GridSelectionEvent } from './grid_events';
|
|
83
83
|
import { ErrorCode } from './grid_events';
|
|
84
84
|
|
|
85
85
|
import type {
|
|
@@ -278,7 +278,7 @@ export class Grid extends GridBase {
|
|
|
278
278
|
private autocomplete?: Autocomplete;
|
|
279
279
|
|
|
280
280
|
/** formula bar editor (optional) */
|
|
281
|
-
|
|
281
|
+
protected formula_bar?: FormulaBar;
|
|
282
282
|
|
|
283
283
|
private RESIZE_PIXEL_BUFFER = 5;
|
|
284
284
|
|
|
@@ -318,14 +318,14 @@ export class Grid extends GridBase {
|
|
|
318
318
|
/**
|
|
319
319
|
* the main selection for interacting with the spreadsheet
|
|
320
320
|
*/
|
|
321
|
-
|
|
321
|
+
protected readonly primary_selection: GridSelection = {
|
|
322
322
|
target: { row: 0, column: 0 },
|
|
323
323
|
area: new Area({ row: 0, column: 0 }),
|
|
324
324
|
empty: true,
|
|
325
325
|
};
|
|
326
326
|
|
|
327
327
|
/** reusing type. FIXME? we don't need a target */
|
|
328
|
-
|
|
328
|
+
protected readonly spill_selection: GridSelection = {
|
|
329
329
|
target: { row: 0, column: 0 },
|
|
330
330
|
area: new Area({ row: 0, column: 0 }),
|
|
331
331
|
empty: true,
|
|
@@ -334,7 +334,7 @@ export class Grid extends GridBase {
|
|
|
334
334
|
/**
|
|
335
335
|
* active selection when selecting arguments (while editing)
|
|
336
336
|
*/
|
|
337
|
-
|
|
337
|
+
protected readonly active_selection: GridSelection = {
|
|
338
338
|
target: { row: 0, column: 0 },
|
|
339
339
|
area: new Area({ row: 0, column: 0 }),
|
|
340
340
|
empty: true,
|
|
@@ -476,6 +476,7 @@ export class Grid extends GridBase {
|
|
|
476
476
|
let value = cell.value;
|
|
477
477
|
|
|
478
478
|
// seems like we're using a loop function unecessarily
|
|
479
|
+
|
|
479
480
|
if (r1c1 && value && cell.type === ValueType.formula) {
|
|
480
481
|
value = this.FormatR1C1(value, { row, column })[0][0];
|
|
481
482
|
}
|
|
@@ -1293,7 +1294,9 @@ export class Grid extends GridBase {
|
|
|
1293
1294
|
// should already be added, right?
|
|
1294
1295
|
|
|
1295
1296
|
for (const element of this.active_sheet.annotations) {
|
|
1296
|
-
this.
|
|
1297
|
+
if (!this.headless) {
|
|
1298
|
+
this.AddAnnotation(element, true);
|
|
1299
|
+
}
|
|
1297
1300
|
}
|
|
1298
1301
|
|
|
1299
1302
|
// handle any necessary activation tasks
|
|
@@ -2082,7 +2085,16 @@ export class Grid extends GridBase {
|
|
|
2082
2085
|
}
|
|
2083
2086
|
|
|
2084
2087
|
this.external_editor.AttachNodes(config.nodes, config.assume_formula ?? true);
|
|
2085
|
-
|
|
2088
|
+
this.external_editor.key_event_callback = (event: KeyboardEvent) => {
|
|
2089
|
+
|
|
2090
|
+
event.stopPropagation();
|
|
2091
|
+
event.preventDefault();
|
|
2092
|
+
|
|
2093
|
+
// ??
|
|
2094
|
+
this.OverlayKeyDown(event);
|
|
2095
|
+
|
|
2096
|
+
};
|
|
2097
|
+
|
|
2086
2098
|
}
|
|
2087
2099
|
else {
|
|
2088
2100
|
if (this.external_editor) {
|
|
@@ -2205,6 +2217,8 @@ export class Grid extends GridBase {
|
|
|
2205
2217
|
row: source.row + r,
|
|
2206
2218
|
column: source.column + c,
|
|
2207
2219
|
},
|
|
2220
|
+
r1c1_force_relative: true,
|
|
2221
|
+
r1c1_proper_semantics: true,
|
|
2208
2222
|
});
|
|
2209
2223
|
}
|
|
2210
2224
|
}
|
|
@@ -2836,12 +2850,14 @@ export class Grid extends GridBase {
|
|
|
2836
2850
|
// effects of clearing the formula bar and so on
|
|
2837
2851
|
|
|
2838
2852
|
if (!selecting_argument) {
|
|
2839
|
-
this.ClearSelection(this.primary_selection);
|
|
2840
2853
|
|
|
2841
2854
|
if (candidate.selection && !candidate.selection.empty) {
|
|
2842
2855
|
this.Select(this.primary_selection,
|
|
2843
2856
|
new Area(candidate.selection.area.start, candidate.selection.area.end),
|
|
2844
|
-
candidate.selection.target);
|
|
2857
|
+
candidate.selection.target, undefined, 'sheet-change');
|
|
2858
|
+
}
|
|
2859
|
+
else {
|
|
2860
|
+
this.ClearSelection(this.primary_selection, 'sheet-change');
|
|
2845
2861
|
}
|
|
2846
2862
|
|
|
2847
2863
|
}
|
|
@@ -3090,6 +3106,12 @@ export class Grid extends GridBase {
|
|
|
3090
3106
|
this.HandleAddressLabelEvent(event.text)
|
|
3091
3107
|
break;
|
|
3092
3108
|
|
|
3109
|
+
case 'toggle-reference':
|
|
3110
|
+
if (this.SelectingArgument() && !this.active_selection?.empty) {
|
|
3111
|
+
this.UpdateSelectedArgument(this.active_selection, true);
|
|
3112
|
+
}
|
|
3113
|
+
break;
|
|
3114
|
+
|
|
3093
3115
|
case 'stop-editing':
|
|
3094
3116
|
|
|
3095
3117
|
if (this.pending_reset_selection) {
|
|
@@ -3326,7 +3348,7 @@ export class Grid extends GridBase {
|
|
|
3326
3348
|
|
|
3327
3349
|
}
|
|
3328
3350
|
|
|
3329
|
-
|
|
3351
|
+
protected Repaint(force = false, full_tile = false, force_headers = false) {
|
|
3330
3352
|
|
|
3331
3353
|
if (this.headless || !this.tile_renderer) { return; }
|
|
3332
3354
|
|
|
@@ -4079,7 +4101,7 @@ export class Grid extends GridBase {
|
|
|
4079
4101
|
|
|
4080
4102
|
}
|
|
4081
4103
|
|
|
4082
|
-
|
|
4104
|
+
protected HideHoverInfo() {
|
|
4083
4105
|
|
|
4084
4106
|
this.layout.HideTitle();
|
|
4085
4107
|
this.layout.HideTooltip();
|
|
@@ -4838,9 +4860,80 @@ export class Grid extends GridBase {
|
|
|
4838
4860
|
|
|
4839
4861
|
}
|
|
4840
4862
|
|
|
4841
|
-
|
|
4863
|
+
protected CreateTypedReferences(start: ICellAddress, end?: ICellAddress) {
|
|
4864
|
+
const references: string[] = [];
|
|
4865
|
+
|
|
4866
|
+
// five cases: (1) one cell; (2) range: (3) rows; (4) columns; (5) all
|
|
4867
|
+
|
|
4868
|
+
let single = false;
|
|
4869
|
+
|
|
4870
|
+
if (end) {
|
|
4871
|
+
single = (start.row === end.row && start.column === end.column);
|
|
4872
|
+
}
|
|
4873
|
+
|
|
4874
|
+
if (start.row === Infinity) {
|
|
4875
|
+
|
|
4876
|
+
// case 3/5
|
|
4877
|
+
|
|
4878
|
+
// ...
|
|
4879
|
+
}
|
|
4880
|
+
else if (start.column === Infinity) {
|
|
4881
|
+
|
|
4882
|
+
// case 4
|
|
4883
|
+
|
|
4884
|
+
// ...
|
|
4885
|
+
}
|
|
4886
|
+
else if (!end || single) {
|
|
4842
4887
|
|
|
4843
|
-
|
|
4888
|
+
// case 1
|
|
4889
|
+
|
|
4890
|
+
start.absolute_column = false;
|
|
4891
|
+
start.absolute_row = false;
|
|
4892
|
+
references.push(Area.CellAddressToLabel(start));
|
|
4893
|
+
|
|
4894
|
+
start.absolute_column = true;
|
|
4895
|
+
start.absolute_row = true;
|
|
4896
|
+
references.push(Area.CellAddressToLabel(start));
|
|
4897
|
+
|
|
4898
|
+
start.absolute_column = true;
|
|
4899
|
+
start.absolute_row = false;
|
|
4900
|
+
references.push(Area.CellAddressToLabel(start));
|
|
4901
|
+
|
|
4902
|
+
start.absolute_column = false;
|
|
4903
|
+
start.absolute_row = true;
|
|
4904
|
+
references.push(Area.CellAddressToLabel(start));
|
|
4905
|
+
|
|
4906
|
+
}
|
|
4907
|
+
else {
|
|
4908
|
+
|
|
4909
|
+
// case 2
|
|
4910
|
+
|
|
4911
|
+
start.absolute_column = end.absolute_column = false;
|
|
4912
|
+
start.absolute_row = end.absolute_row = false;
|
|
4913
|
+
references.push(Area.CellAddressToLabel(start) + ':' + Area.CellAddressToLabel(end));
|
|
4914
|
+
|
|
4915
|
+
start.absolute_column = end.absolute_column = true;
|
|
4916
|
+
start.absolute_row = end.absolute_row = true;
|
|
4917
|
+
references.push(Area.CellAddressToLabel(start) + ':' + Area.CellAddressToLabel(end));
|
|
4918
|
+
|
|
4919
|
+
start.absolute_column = end.absolute_column = true;
|
|
4920
|
+
start.absolute_row = end.absolute_row = false;
|
|
4921
|
+
references.push(Area.CellAddressToLabel(start) + ':' + Area.CellAddressToLabel(end));
|
|
4922
|
+
|
|
4923
|
+
start.absolute_column = end.absolute_column = false;
|
|
4924
|
+
start.absolute_row = end.absolute_row = true;
|
|
4925
|
+
references.push(Area.CellAddressToLabel(start) + ':' + Area.CellAddressToLabel(end));
|
|
4926
|
+
|
|
4927
|
+
}
|
|
4928
|
+
|
|
4929
|
+
// ...other cases TODO...
|
|
4930
|
+
|
|
4931
|
+
return references;
|
|
4932
|
+
}
|
|
4933
|
+
|
|
4934
|
+
private UpdateSelectedArgument(selection: GridSelection, toggle_reference_type = false) {
|
|
4935
|
+
|
|
4936
|
+
// console.info("USA", selection, toggle_reference_type);
|
|
4844
4937
|
|
|
4845
4938
|
// if this is a single merged block, we want to insert it as the
|
|
4846
4939
|
// root cell and not the range.
|
|
@@ -4850,34 +4943,55 @@ export class Grid extends GridBase {
|
|
|
4850
4943
|
|
|
4851
4944
|
let label = this.model.named.MatchSelection(selection.area, target);
|
|
4852
4945
|
|
|
4946
|
+
// this seems like a clumsy way to do it, but for now...
|
|
4947
|
+
|
|
4948
|
+
let typed_reference_list: string[] = [];
|
|
4949
|
+
|
|
4853
4950
|
if (!label) {
|
|
4854
4951
|
|
|
4855
4952
|
label = selection.area.spreadsheet_label;
|
|
4856
4953
|
if (data.merge_area && data.merge_area.Equals(selection.area)) {
|
|
4857
4954
|
label = Area.CellAddressToLabel(data.merge_area.start);
|
|
4955
|
+
typed_reference_list = this.CreateTypedReferences({...data.merge_area.start});
|
|
4956
|
+
}
|
|
4957
|
+
else {
|
|
4958
|
+
typed_reference_list = this.CreateTypedReferences({
|
|
4959
|
+
...selection.area.start
|
|
4960
|
+
}, {
|
|
4961
|
+
...selection.area.end
|
|
4962
|
+
});
|
|
4858
4963
|
}
|
|
4859
4964
|
|
|
4860
4965
|
if (this.external_editor_config || this.active_sheet.id !== this.editing_cell.sheet_id) {
|
|
4861
|
-
|
|
4966
|
+
let name = this.active_sheet.name;
|
|
4967
|
+
if (QuotedSheetNameRegex.test(name)) {
|
|
4968
|
+
name = `'${name}'`;
|
|
4969
|
+
}
|
|
4970
|
+
label = name + `!${label}`;
|
|
4971
|
+
typed_reference_list = typed_reference_list.map(entry => name + entry);
|
|
4862
4972
|
|
|
4973
|
+
/*
|
|
4863
4974
|
if (QuotedSheetNameRegex.test(name)) {
|
|
4864
4975
|
label = `'${name}'!${label}`;
|
|
4865
4976
|
}
|
|
4866
4977
|
else {
|
|
4867
4978
|
label = `${name}!${label}`;
|
|
4868
4979
|
}
|
|
4980
|
+
*/
|
|
4869
4981
|
}
|
|
4870
4982
|
|
|
4983
|
+
// console.info(typed_reference_list);
|
|
4984
|
+
|
|
4871
4985
|
}
|
|
4872
4986
|
|
|
4873
4987
|
// the external editor should just handle normal select events
|
|
4874
4988
|
// for now, we might update that in the future.
|
|
4875
4989
|
|
|
4876
4990
|
if (this.overlay_editor?.editing && this.overlay_editor.selecting) {
|
|
4877
|
-
this.overlay_editor.InsertReference(label);
|
|
4991
|
+
this.overlay_editor.InsertReference(label, toggle_reference_type, typed_reference_list);
|
|
4878
4992
|
}
|
|
4879
4993
|
else if (this.formula_bar && this.formula_bar.selecting) {
|
|
4880
|
-
this.formula_bar.InsertReference(label);
|
|
4994
|
+
this.formula_bar.InsertReference(label, toggle_reference_type, typed_reference_list);
|
|
4881
4995
|
}
|
|
4882
4996
|
else if (this.external_editor_config) {
|
|
4883
4997
|
|
|
@@ -4911,7 +5025,7 @@ export class Grid extends GridBase {
|
|
|
4911
5025
|
*
|
|
4912
5026
|
* FIXME: why is this not an accessor?
|
|
4913
5027
|
*/
|
|
4914
|
-
|
|
5028
|
+
protected SelectingArgument(): boolean {
|
|
4915
5029
|
return (this.overlay_editor?.editing && this.overlay_editor?.selecting)
|
|
4916
5030
|
|| (this.formula_bar && this.formula_bar.selecting)
|
|
4917
5031
|
|| (!!this.external_editor_config);
|
|
@@ -5081,7 +5195,7 @@ export class Grid extends GridBase {
|
|
|
5081
5195
|
case '/':
|
|
5082
5196
|
event.stopPropagation();
|
|
5083
5197
|
event.preventDefault();
|
|
5084
|
-
this.SelectArrayOrTable();
|
|
5198
|
+
this.SelectArrayOrTable(selection);
|
|
5085
5199
|
break;
|
|
5086
5200
|
|
|
5087
5201
|
default:
|
|
@@ -5184,6 +5298,23 @@ export class Grid extends GridBase {
|
|
|
5184
5298
|
}
|
|
5185
5299
|
else {
|
|
5186
5300
|
|
|
5301
|
+
if (event.key === 'F4') {
|
|
5302
|
+
|
|
5303
|
+
// we're always intercepting f4, although we only actual handle it
|
|
5304
|
+
// if you are selecting a cell.
|
|
5305
|
+
|
|
5306
|
+
event.stopPropagation();
|
|
5307
|
+
event.preventDefault();
|
|
5308
|
+
|
|
5309
|
+
if (selecting_argument && !selection.empty) {
|
|
5310
|
+
this.UpdateSelectedArgument(selection, true);
|
|
5311
|
+
}
|
|
5312
|
+
|
|
5313
|
+
return;
|
|
5314
|
+
|
|
5315
|
+
}
|
|
5316
|
+
|
|
5317
|
+
|
|
5187
5318
|
// ignore function keys
|
|
5188
5319
|
|
|
5189
5320
|
if (/^F\d+$/.test(event.key)) {
|
|
@@ -5283,30 +5414,35 @@ export class Grid extends GridBase {
|
|
|
5283
5414
|
* select the array containing the current cell, if any. if there's no
|
|
5284
5415
|
* array, do nothing. updated to support selecting tables as well as arrays.
|
|
5285
5416
|
*/
|
|
5286
|
-
|
|
5417
|
+
protected SelectArrayOrTable(target_selection: GridSelection) {
|
|
5287
5418
|
|
|
5288
|
-
if (
|
|
5419
|
+
if (target_selection.empty) {
|
|
5289
5420
|
return;
|
|
5290
5421
|
}
|
|
5291
5422
|
|
|
5292
|
-
const cell = this.active_sheet.CellData(
|
|
5423
|
+
const cell = this.active_sheet.CellData(target_selection.target);
|
|
5293
5424
|
|
|
5294
5425
|
if (!cell || (!cell.area && !cell.table && !cell.spill)) {
|
|
5295
5426
|
return;
|
|
5296
5427
|
}
|
|
5297
5428
|
|
|
5298
5429
|
if (cell.area) {
|
|
5299
|
-
this.Select(
|
|
5430
|
+
this.Select(target_selection, cell.area, cell.area.start);
|
|
5300
5431
|
}
|
|
5301
5432
|
if (cell.spill) {
|
|
5302
|
-
this.Select(
|
|
5433
|
+
this.Select(target_selection, cell.spill, cell.spill.start);
|
|
5303
5434
|
}
|
|
5304
5435
|
if (cell.table) {
|
|
5305
5436
|
const area = new Area(cell.table.area.start, cell.table.area.end);
|
|
5306
|
-
this.Select(
|
|
5437
|
+
this.Select(target_selection, area, area.start);
|
|
5307
5438
|
}
|
|
5308
5439
|
|
|
5309
|
-
this.
|
|
5440
|
+
if (this.SelectingArgument()) {
|
|
5441
|
+
this.UpdateSelectedArgument(target_selection);
|
|
5442
|
+
}
|
|
5443
|
+
else {
|
|
5444
|
+
this.RenderSelections();
|
|
5445
|
+
}
|
|
5310
5446
|
|
|
5311
5447
|
}
|
|
5312
5448
|
|
|
@@ -5314,7 +5450,7 @@ export class Grid extends GridBase {
|
|
|
5314
5450
|
* render selections. we are wrapping this up in a method so we can
|
|
5315
5451
|
* hide the primary selection in some cases (one case).
|
|
5316
5452
|
*/
|
|
5317
|
-
|
|
5453
|
+
protected RenderSelections(rerender = true) {
|
|
5318
5454
|
|
|
5319
5455
|
const show_primary_selection = this.hide_selection ? false :
|
|
5320
5456
|
(!this.editing_state) || (this.editing_cell.sheet_id === this.active_sheet.id);
|
|
@@ -5335,7 +5471,7 @@ export class Grid extends GridBase {
|
|
|
5335
5471
|
* using ctrl+arrow. selection jumps across all populated cells in
|
|
5336
5472
|
* a given direction for a given row/column).
|
|
5337
5473
|
*/
|
|
5338
|
-
|
|
5474
|
+
protected BlockSelection(selection: GridSelection, expand_selection: boolean,
|
|
5339
5475
|
columns: number, rows: number, render = true): boolean {
|
|
5340
5476
|
|
|
5341
5477
|
// select the containing block. note that we do not handle
|
|
@@ -5503,7 +5639,7 @@ export class Grid extends GridBase {
|
|
|
5503
5639
|
* of commands. the former is the default for editor commits; the latter
|
|
5504
5640
|
* is used for paste.
|
|
5505
5641
|
*/
|
|
5506
|
-
|
|
5642
|
+
protected SetInferredType(selection: GridSelection, value: string|undefined, array = false, exec = true, apply_style?: CellStyle) {
|
|
5507
5643
|
|
|
5508
5644
|
// console.info("SIT", {apply_style});
|
|
5509
5645
|
|
|
@@ -5524,7 +5660,7 @@ export class Grid extends GridBase {
|
|
|
5524
5660
|
else if (array) {
|
|
5525
5661
|
|
|
5526
5662
|
for (const cell of this.active_sheet.cells.Iterate(selection.area, false)) {
|
|
5527
|
-
if (cell
|
|
5663
|
+
if (cell?.area) {
|
|
5528
5664
|
this.Error(ErrorCode.array);
|
|
5529
5665
|
return;
|
|
5530
5666
|
}
|
|
@@ -6289,7 +6425,7 @@ export class Grid extends GridBase {
|
|
|
6289
6425
|
/**
|
|
6290
6426
|
* if the address is outside of current extent, expand
|
|
6291
6427
|
*/
|
|
6292
|
-
|
|
6428
|
+
protected EnsureAddress(address: ICellAddress, step = 8, toll_layout = false): boolean {
|
|
6293
6429
|
|
|
6294
6430
|
let expanded = false;
|
|
6295
6431
|
|
|
@@ -6334,7 +6470,7 @@ export class Grid extends GridBase {
|
|
|
6334
6470
|
* behavior, at least for now, we'll make a parameter to disable. but it
|
|
6335
6471
|
* should probably not render.
|
|
6336
6472
|
*/
|
|
6337
|
-
|
|
6473
|
+
protected AdvanceSelection(
|
|
6338
6474
|
delta: Extent,
|
|
6339
6475
|
selection: GridSelection,
|
|
6340
6476
|
within_selection = false,
|
|
@@ -6703,8 +6839,8 @@ export class Grid extends GridBase {
|
|
|
6703
6839
|
/**
|
|
6704
6840
|
* utility method, internally calls Select with an undefined area
|
|
6705
6841
|
*/
|
|
6706
|
-
|
|
6707
|
-
this.Select(selection);
|
|
6842
|
+
protected ClearSelection(selection: GridSelection, reason?: GridSelectionEvent['reason']) {
|
|
6843
|
+
this.Select(selection, undefined, undefined, undefined, reason);
|
|
6708
6844
|
}
|
|
6709
6845
|
|
|
6710
6846
|
private HideGridSelection() {
|
|
@@ -6738,7 +6874,7 @@ export class Grid extends GridBase {
|
|
|
6738
6874
|
* cell of the selection area
|
|
6739
6875
|
* @param preserve_target preserve existing selection target
|
|
6740
6876
|
*/
|
|
6741
|
-
|
|
6877
|
+
protected Select(selection: GridSelection, area?: Area, target?: ICellAddress, preserve_target = false, reason?: GridSelectionEvent['reason']) {
|
|
6742
6878
|
|
|
6743
6879
|
if (!selection.empty) {
|
|
6744
6880
|
if (preserve_target) target = selection.target;
|
|
@@ -6826,6 +6962,7 @@ export class Grid extends GridBase {
|
|
|
6826
6962
|
this.grid_events.Publish({
|
|
6827
6963
|
type: 'selection',
|
|
6828
6964
|
selection: this.primary_selection,
|
|
6965
|
+
reason,
|
|
6829
6966
|
});
|
|
6830
6967
|
|
|
6831
6968
|
this.UpdateAddressLabel();
|
|
@@ -6846,7 +6983,7 @@ export class Grid extends GridBase {
|
|
|
6846
6983
|
/**
|
|
6847
6984
|
*
|
|
6848
6985
|
*/
|
|
6849
|
-
|
|
6986
|
+
protected UpdateFormulaBarFormula(override?: string) {
|
|
6850
6987
|
|
|
6851
6988
|
this.layout.HideDropdownCaret();
|
|
6852
6989
|
|
|
@@ -6944,7 +7081,7 @@ export class Grid extends GridBase {
|
|
|
6944
7081
|
* default will show count/sum/average of numbers, either real
|
|
6945
7082
|
* or complex.
|
|
6946
7083
|
*/
|
|
6947
|
-
|
|
7084
|
+
protected RenderStats(values: CellValue|CellValue[][]): StatsEntry[] {
|
|
6948
7085
|
|
|
6949
7086
|
// we don't handle single values
|
|
6950
7087
|
|
|
@@ -7052,7 +7189,7 @@ export class Grid extends GridBase {
|
|
|
7052
7189
|
}
|
|
7053
7190
|
}
|
|
7054
7191
|
|
|
7055
|
-
|
|
7192
|
+
protected UpdateAddressLabelArea(selection: GridSelection) {
|
|
7056
7193
|
if (!selection.empty && !selection.area.entire_sheet) {
|
|
7057
7194
|
if (selection.area.entire_column) {
|
|
7058
7195
|
this.UpdateAddressLabel(undefined, selection.area.columns + 'C');
|
|
@@ -7070,7 +7207,7 @@ export class Grid extends GridBase {
|
|
|
7070
7207
|
}
|
|
7071
7208
|
}
|
|
7072
7209
|
|
|
7073
|
-
|
|
7210
|
+
protected UpdateAddressLabel(selection = this.primary_selection, text?: string) {
|
|
7074
7211
|
|
|
7075
7212
|
if (!this.formula_bar) { return; }
|
|
7076
7213
|
|
|
@@ -7908,8 +8045,12 @@ export class Grid extends GridBase {
|
|
|
7908
8045
|
const width = Math.round((command.width || 0) / this.scale);
|
|
7909
8046
|
|
|
7910
8047
|
if (auto) {
|
|
8048
|
+
|
|
8049
|
+
// defaults to true if not provided
|
|
8050
|
+
const allow_shrinking = !(command.allow_shrinking === false);
|
|
8051
|
+
|
|
7911
8052
|
for (const entry of column) {
|
|
7912
|
-
this.AutoSizeColumn(sheet, entry,
|
|
8053
|
+
this.AutoSizeColumn(sheet, entry, allow_shrinking);
|
|
7913
8054
|
}
|
|
7914
8055
|
}
|
|
7915
8056
|
else {
|
|
@@ -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-2026 trebco, llc.
|
|
18
18
|
* info@treb.app
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -603,14 +603,17 @@ export class GridBase {
|
|
|
603
603
|
/**
|
|
604
604
|
* API method
|
|
605
605
|
*
|
|
606
|
-
* @param column column, columns, or undefined means all columns
|
|
607
|
-
* @param width target width, or undefined means auto-size
|
|
606
|
+
* @param column - column, columns, or undefined means all columns
|
|
607
|
+
* @param width - target width, or undefined means auto-size
|
|
608
|
+
* @param allow_shrinking - for auto-size, allow shrinking. defaults to true.
|
|
609
|
+
* set false to disallow shrinking.
|
|
608
610
|
*/
|
|
609
|
-
public SetColumnWidth(column?: number | number[], width?: number): void {
|
|
611
|
+
public SetColumnWidth(column?: number | number[], width?: number, allow_shrinking?: boolean): void {
|
|
610
612
|
this.ExecCommand({
|
|
611
613
|
key: CommandKey.ResizeColumns,
|
|
612
614
|
column,
|
|
613
615
|
width,
|
|
616
|
+
allow_shrinking,
|
|
614
617
|
});
|
|
615
618
|
}
|
|
616
619
|
|
|
@@ -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-2026 trebco, llc.
|
|
18
18
|
* info@treb.app
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -198,6 +198,12 @@ export interface ResizeColumnsCommand {
|
|
|
198
198
|
key: CommandKey.ResizeColumns;
|
|
199
199
|
column?: number|number[];
|
|
200
200
|
width?: number;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* for auto-resized columns, allow shrinking. defaults to true for
|
|
204
|
+
* back-compat, so you must explicitly set it to false to disable shrinking.
|
|
205
|
+
*/
|
|
206
|
+
allow_shrinking?: boolean;
|
|
201
207
|
sheet_id?: number;
|
|
202
208
|
}
|
|
203
209
|
|
|
@@ -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-2026 trebco, llc.
|
|
18
18
|
* info@treb.app
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
@@ -53,6 +53,7 @@ export interface SheetChangeEvent {
|
|
|
53
53
|
export interface GridSelectionEvent {
|
|
54
54
|
type: 'selection';
|
|
55
55
|
selection: GridSelection;
|
|
56
|
+
reason?: 'sheet-change';
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export interface GridAlternateSelectionEvent {
|
package/treb-grid/src/util/ua.ts
CHANGED
package/treb-parser/src/index.ts
CHANGED