@guiexpert/table 1.1.93 → 1.1.96
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 +25 -0
- package/css/main.css +334 -0
- package/css/table-calc.css +7 -0
- package/css/table-classes.css +34 -0
- package/css/table-color-vars.css +78 -0
- package/css/table-fill-batch.css +58 -0
- package/css/table-pivot.css +42 -0
- package/css/table-row-drag.css +81 -0
- package/css/table-row-group.css +25 -0
- package/css/table-tree.css +9 -0
- package/index.cjs +57 -47
- package/index.d.ts +67 -0
- package/index.js +11290 -4985
- package/lib/table/action/action-id.type.d.ts +1 -1
- package/lib/table/aggregation/aggregate-internals.d.ts +30 -0
- package/lib/table/aggregation/aggregate-spec.if.d.ts +51 -0
- package/lib/table/aggregation/aggregate.d.ts +58 -0
- package/lib/table/aggregation/aggregator-name.type.d.ts +39 -0
- package/lib/table/aggregation/aggregator.if.d.ts +51 -0
- package/lib/table/aggregation/aggregators.d.ts +37 -0
- package/lib/table/aggregation/create-value-getter.d.ts +18 -0
- package/lib/table/aggregation/selection-aggregates.if.d.ts +35 -0
- package/lib/table/aggregation/value-accessor.type.d.ts +13 -0
- package/lib/table/aria/aria-texts.d.ts +11 -0
- package/lib/table/aria/aria-texts.if.d.ts +87 -0
- package/lib/table/batch-edit/batch-edit-options.d.ts +21 -0
- package/lib/table/batch-edit/batch-edit-options.if.d.ts +20 -0
- package/lib/table/batch-edit/batch-edit-service.d.ts +104 -0
- package/lib/table/batch-edit/cell-change.if.d.ts +39 -0
- package/lib/table/batch-edit/cell-value-change.if.d.ts +18 -0
- package/lib/table/batch-edit/pending-cell-changes.d.ts +104 -0
- package/lib/table/calc/column-values.d.ts +55 -0
- package/lib/table/calc/show-values-as-internals.d.ts +4 -0
- package/lib/table/calc/show-values-as.d.ts +87 -0
- package/lib/table/calc/show-values-as.type.d.ts +55 -0
- package/lib/table/calc/value-getter-context.if.d.ts +35 -0
- package/lib/table/calc/value-getter.type.d.ts +36 -0
- package/lib/table/data/common/event/ge-batch-edit-event.d.ts +46 -0
- package/lib/table/data/common/event/ge-model-change-event.d.ts +27 -1
- package/lib/table/data/common/event/ge-row-drag-event.d.ts +89 -0
- package/lib/table/data/common/row-number-column-def.d.ts +107 -0
- package/lib/table/data/common/row-number-columns.d.ts +17 -0
- package/lib/table/data/common/row-number-options.d.ts +19 -0
- package/lib/table/data/common/row-number-options.if.d.ts +44 -0
- package/lib/table/data/options/table-options.d.ts +6 -0
- package/lib/table/data/options/table-options.if.d.ts +44 -0
- package/lib/table/data/tablemodel/areamodel/abstract-area-model.d.ts +66 -0
- package/lib/table/data/tablemodel/areamodel/aggregate-footer-options.if.d.ts +73 -0
- package/lib/table/data/tablemodel/areamodel/area-model-aggregate-footer.d.ts +150 -0
- package/lib/table/data/tablemodel/areamodel/area-model-array-of-arrays.d.ts +24 -0
- package/lib/table/data/tablemodel/areamodel/area-model-cell-groups.d.ts +18 -1
- package/lib/table/data/tablemodel/areamodel/area-model-object-array.d.ts +70 -0
- package/lib/table/data/tablemodel/areamodel/area-model-pivot-footer.d.ts +47 -0
- package/lib/table/data/tablemodel/areamodel/area-model-pivot.d.ts +281 -0
- package/lib/table/data/tablemodel/areamodel/area-model-row-groups.d.ts +336 -0
- package/lib/table/data/tablemodel/areamodel/area-model-tree.d.ts +97 -0
- package/lib/table/data/tablemodel/areamodel/area-model.if.d.ts +94 -0
- package/lib/table/data/tablemodel/areamodel/derived-values-change.if.d.ts +30 -0
- package/lib/table/data/tablemodel/column/column-def.d.ts +31 -1
- package/lib/table/data/tablemodel/column/column-def.if.d.ts +86 -0
- package/lib/table/event-adapter.d.ts +7 -0
- package/lib/table/event-listener.if.d.ts +32 -0
- package/lib/table/factory/pivot-factory.d.ts +63 -0
- package/lib/table/factory/pivot-table-model-para.if.d.ts +44 -0
- package/lib/table/factory/row-group-factory.d.ts +70 -0
- package/lib/table/factory/row-group-table-model-para.if.d.ts +66 -0
- package/lib/table/factory/table-factory.d.ts +56 -1
- package/lib/table/fill/compute-fill-changes.d.ts +67 -0
- package/lib/table/fill/fill-direction.type.d.ts +7 -0
- package/lib/table/fill/fill-handle-options.d.ts +29 -0
- package/lib/table/fill/fill-handle-options.if.d.ts +35 -0
- package/lib/table/fill/fill-handle-service.d.ts +55 -0
- package/lib/table/fill/fill-series.d.ts +60 -0
- package/lib/table/fill/fill-value-context.if.d.ts +36 -0
- package/lib/table/formula/compile-formula.d.ts +86 -0
- package/lib/table/formula/evaluator.d.ts +19 -0
- package/lib/table/formula/formula-ast.if.d.ts +42 -0
- package/lib/table/formula/formula-error.d.ts +59 -0
- package/lib/table/formula/formula-options.if.d.ts +41 -0
- package/lib/table/formula/formula-values.d.ts +13 -0
- package/lib/table/formula/functions.d.ts +18 -0
- package/lib/table/formula/parser.d.ts +10 -0
- package/lib/table/formula/tokenizer.d.ts +22 -0
- package/lib/table/instanceof-workaround.d.ts +143 -6
- package/lib/table/pivot/area-model-pivot-header.d.ts +9 -0
- package/lib/table/pivot/pivot-column-def.d.ts +28 -0
- package/lib/table/pivot/pivot-column-info.if.d.ts +25 -0
- package/lib/table/pivot/pivot-config.if.d.ts +58 -0
- package/lib/table/pivot/pivot-internals.d.ts +13 -0
- package/lib/table/pivot/pivot-layout.d.ts +40 -0
- package/lib/table/pivot/pivot-result.d.ts +157 -0
- package/lib/table/pivot/pivot-table-model.d.ts +86 -0
- package/lib/table/pivot/pivot-value.type.d.ts +80 -0
- package/lib/table/render-scope.d.ts +142 -4
- package/lib/table/renderer/aggregate-cell-renderer.d.ts +27 -0
- package/lib/table/renderer/edit/input-cell-renderer.d.ts +1 -1
- package/lib/table/renderer/edit/select-cell-renderer.d.ts +1 -1
- package/lib/table/renderer/row-number-cell-renderer.d.ts +27 -0
- package/lib/table/row-drag/move-rows.d.ts +157 -0
- package/lib/table/row-drag/row-drag-options.d.ts +28 -0
- package/lib/table/row-drag/row-drag-options.if.d.ts +36 -0
- package/lib/table/row-drag/row-drag-service.d.ts +130 -0
- package/lib/table/row-drag/row-drop-target.if.d.ts +29 -0
- package/lib/table/rowgroup/group-rows-internals.d.ts +14 -0
- package/lib/table/rowgroup/group-rows-options.if.d.ts +13 -0
- package/lib/table/rowgroup/group-rows.d.ts +48 -0
- package/lib/table/rowgroup/row-group-column-def.d.ts +26 -0
- package/lib/table/rowgroup/row-group-column-options.if.d.ts +27 -0
- package/lib/table/rowgroup/row-group-detail-row.d.ts +8 -0
- package/lib/table/rowgroup/row-group-field.type.d.ts +56 -0
- package/lib/table/rowgroup/row-group-internals.d.ts +31 -0
- package/lib/table/rowgroup/row-group-layout.d.ts +13 -0
- package/lib/table/rowgroup/row-group-model-options.if.d.ts +39 -0
- package/lib/table/rowgroup/row-group.d.ts +51 -0
- package/lib/table/rowgroup/row-group.if.d.ts +48 -0
- package/lib/table/selection/selection-aggregator.d.ts +37 -0
- package/lib/table/selection/selection-service.d.ts +7 -0
- package/lib/table/service/convenience-dom.service.d.ts +5 -0
- package/lib/table/service/excel-service.d.ts +6 -0
- package/lib/table/service/excel-service.if.d.ts +35 -0
- package/lib/table/table-api.d.ts +389 -3
- package/lib/table/table-scope.d.ts +140 -0
- package/package.json +3 -2
|
@@ -7,4 +7,39 @@
|
|
|
7
7
|
export interface ExcelServiceIf {
|
|
8
8
|
/** Creates the file from `matrix` (rows of values) and hands it to the browser as download. */
|
|
9
9
|
downloadExcel(matrix: Array<Array<any>>, filename: string, author?: string): void | Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* True if the service understands cells of the form {@link ExcelFormattedValueIf} (`{ value, numberFormat }`).
|
|
12
|
+
* Only then {@link TableApi.downloadExcel} exports percentages of „Show values as“ columns with the format `0.0%`;
|
|
13
|
+
* otherwise a service gets plain numbers (since 1.1.95).
|
|
14
|
+
*/
|
|
15
|
+
readonly supportsNumberFormats?: boolean;
|
|
10
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* A cell of an Excel matrix with a number format, e.g. a share shown as percentage. Understood by
|
|
19
|
+
* {@link ExcelService} (`supportsNumberFormats`).
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* await new ExcelService().downloadExcel([["Share"], [{ value: 0.667, numberFormat: "0.0%" }]], "shares.xlsx");
|
|
23
|
+
*
|
|
24
|
+
* @since 1.1.95
|
|
25
|
+
* @category Export & clipboard
|
|
26
|
+
*/
|
|
27
|
+
export interface ExcelFormattedValueIf {
|
|
28
|
+
/** The number. */
|
|
29
|
+
value: number;
|
|
30
|
+
/** An Excel number format code, e.g. `"0.0%"`, `"#,##0.00"`. */
|
|
31
|
+
numberFormat: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* True for a cell of the form {@link ExcelFormattedValueIf}.
|
|
35
|
+
*
|
|
36
|
+
* @param {unknown} cell - a cell of an Excel matrix
|
|
37
|
+
* @returns {boolean} whether it is a number with format
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* isExcelFormattedValue({ value: 0.5, numberFormat: "0%" }); // true
|
|
41
|
+
*
|
|
42
|
+
* @since 1.1.95
|
|
43
|
+
* @category Export & clipboard
|
|
44
|
+
*/
|
|
45
|
+
export declare function isExcelFormattedValue(cell: unknown): cell is ExcelFormattedValueIf;
|
package/lib/table/table-api.d.ts
CHANGED
|
@@ -10,6 +10,18 @@ import { ShortcutActionIdMapping } from './action/shortcut-actionid-mapping.type
|
|
|
10
10
|
import { SelectionModelIf } from './selection/selection-model.if.js';
|
|
11
11
|
import { TableModelIf } from './data/tablemodel/table-model.if.js';
|
|
12
12
|
import { AreaModelIf } from './data/tablemodel/areamodel/area-model.if.js';
|
|
13
|
+
import { PivotConfigIf } from './pivot/pivot-config.if.js';
|
|
14
|
+
import { RowGroupField } from './rowgroup/row-group-field.type.js';
|
|
15
|
+
import { SelectionAggregatesIf } from './aggregation/selection-aggregates.if.js';
|
|
16
|
+
import { ShowValuesAsConfig } from './calc/show-values-as.type.js';
|
|
17
|
+
import { FormulaOptionsIf } from './formula/formula-options.if.js';
|
|
18
|
+
import { FormulaError } from './formula/formula-error.js';
|
|
19
|
+
import { RowDropTargetIf } from './row-drag/row-drop-target.if.js';
|
|
20
|
+
import { CellChangeIf, CellChangeSource } from './batch-edit/cell-change.if.js';
|
|
21
|
+
import { CellValueChangeIf } from './batch-edit/cell-value-change.if.js';
|
|
22
|
+
import { FillDirection } from './fill/fill-direction.type.js';
|
|
23
|
+
import { FillMode } from './fill/fill-series.js';
|
|
24
|
+
import { CellRange } from './data/common/cell-range.js';
|
|
13
25
|
|
|
14
26
|
/**
|
|
15
27
|
* The public API of one table – everything you do with a table after it has been created:
|
|
@@ -34,9 +46,10 @@ import { AreaModelIf } from './data/tablemodel/areamodel/area-model.if.js';
|
|
|
34
46
|
* | sort | {@link sortByColumn}, {@link sort}, {@link reSort} |
|
|
35
47
|
* | filter | {@link externalFilterChanged} (with {@link TableOptionsIf.externalFilterFunction}) |
|
|
36
48
|
* | export | {@link copyToClipboard}, {@link downloadExcel} |
|
|
37
|
-
* | change data | {@link updateCells}, {@link setRows}, {@link addRows}, {@link updateRows}, {@link removeRows} |
|
|
49
|
+
* | change data | {@link updateCells}, {@link setRows}, {@link addRows}, {@link updateRows}, {@link removeRows}, {@link applyCellChanges} |
|
|
50
|
+
* | fill, batch edit | {@link fillRange}, {@link startBatchEdit}, {@link getPendingChanges}, {@link commitBatchEdit}, {@link cancelBatchEdit} |
|
|
38
51
|
* | redraw | {@link repaint} (same row count), {@link repaintHard} (row count or heights changed) |
|
|
39
|
-
* | columns | {@link autoResizeColumns}, {@link setColumnWidth}, {@link recalcColumnWidths} |
|
|
52
|
+
* | columns | {@link autoResizeColumns}, {@link setColumnWidth}, {@link recalcColumnWidths}, {@link getColumnIndex} |
|
|
40
53
|
* | tree | {@link expandAll}, {@link collapseAll}, {@link setRowExpanded} |
|
|
41
54
|
* | state | {@link getState}, {@link applyState}, {@link resetState} (with {@link TableOptionsIf.autoRestoreOptions}) |
|
|
42
55
|
* | lifecycle | {@link destroy} |
|
|
@@ -390,6 +403,9 @@ export declare class TableApi {
|
|
|
390
403
|
* Repainting the table ensures that all visible cells, rows, and styling reflect the
|
|
391
404
|
* current state of the underlying data model and configuration settings.
|
|
392
405
|
*
|
|
406
|
+
* Since 1.1.94 it also drops cached totals ({@link AreaModelIf.invalidateDerivedValues}, e.g. of a footer from
|
|
407
|
+
* `footerAggregates`), so they are computed again from the changed rows. Scrolling never does that.
|
|
408
|
+
*
|
|
393
409
|
* @example
|
|
394
410
|
* // Update data and repaint the table
|
|
395
411
|
* const tableApi = new TableApi(tableScope);
|
|
@@ -523,7 +539,7 @@ export declare class TableApi {
|
|
|
523
539
|
* @param {ActionId} actionId - The ID of the action to trigger.
|
|
524
540
|
* @return {void}
|
|
525
541
|
*/
|
|
526
|
-
triggerAction(actionId: ActionId):
|
|
542
|
+
triggerAction(actionId: ActionId): boolean;
|
|
527
543
|
/**
|
|
528
544
|
* Retrieves the shortcut action mapping from the table's shortcut service.
|
|
529
545
|
*
|
|
@@ -805,6 +821,25 @@ export declare class TableApi {
|
|
|
805
821
|
* tableApi.downloadExcel('quarterly-data.xlsx');
|
|
806
822
|
*/
|
|
807
823
|
downloadExcel(fileName?: string, author?: string): Promise<void>;
|
|
824
|
+
/** The value of a cell for the Excel export – the shown number in a row number column (body; footer empty). */
|
|
825
|
+
private getExportValue;
|
|
826
|
+
/**
|
|
827
|
+
* The index of the column that shows a property – `-1` if there is none.
|
|
828
|
+
*
|
|
829
|
+
* Column indices count all columns, also a {@link RowNumberColumnDef} or {@link CheckboxColumnDef} in front:
|
|
830
|
+
* with row numbers (`rowNumbersVisible: true`) every data column has an index one higher. Get the index by the
|
|
831
|
+
* property instead of writing numbers into your code.
|
|
832
|
+
*
|
|
833
|
+
* @param {string} property - the property of the column definition, e.g. `"total"`
|
|
834
|
+
* @returns {number} the column index (fixed columns included) or -1
|
|
835
|
+
*
|
|
836
|
+
* @example
|
|
837
|
+
* const totalColumn = tableApi.getColumnIndex("total");
|
|
838
|
+
* tableApi.scrollToIndex(totalColumn, 0);
|
|
839
|
+
*
|
|
840
|
+
* @since 1.1.93
|
|
841
|
+
*/
|
|
842
|
+
getColumnIndex(property: string): number;
|
|
808
843
|
/**
|
|
809
844
|
* Returns the TableScope instance associated with this TableApi.
|
|
810
845
|
*
|
|
@@ -866,6 +901,28 @@ export declare class TableApi {
|
|
|
866
901
|
* });
|
|
867
902
|
*/
|
|
868
903
|
getSelectionModel(): SelectionModelIf | undefined;
|
|
904
|
+
/**
|
|
905
|
+
* Count, sum, average, minimum and maximum of the selected body cells – for a status bar like in a spreadsheet.
|
|
906
|
+
* Counted are the selected cells of the visible data columns; the numbers are the cell values of type `number`.
|
|
907
|
+
* Above {@link SelectionAggregator.maxCells} cells (default 1,000,000) nothing is computed (`capped: true`).
|
|
908
|
+
* Without a selection all values are 0 / `undefined`.
|
|
909
|
+
*
|
|
910
|
+
* @returns {SelectionAggregatesIf} `{ count, numericCount, sum, avg, min, max, capped }`
|
|
911
|
+
*
|
|
912
|
+
* @example
|
|
913
|
+
* // a status bar in plain HTML under the table
|
|
914
|
+
* const statusBar = document.querySelector<HTMLDivElement>("#status")!;
|
|
915
|
+
* const listener = new EventAdapter();
|
|
916
|
+
* listener.onSelectionChanged = () => {
|
|
917
|
+
* const a = tableApi.getSelectionAggregates();
|
|
918
|
+
* statusBar.textContent = a.capped ? "Selection too large"
|
|
919
|
+
* : a.numericCount ? `Count ${a.count} · Sum ${formatAggregateValue(a.sum)} · Average ${formatAggregateValue(a.avg)}`
|
|
920
|
+
* : "";
|
|
921
|
+
* };
|
|
922
|
+
*
|
|
923
|
+
* @since 1.1.94
|
|
924
|
+
*/
|
|
925
|
+
getSelectionAggregates(): SelectionAggregatesIf;
|
|
869
926
|
/**
|
|
870
927
|
* Automatically resizes all columns to fit their content.
|
|
871
928
|
*
|
|
@@ -1186,6 +1243,133 @@ export declare class TableApi {
|
|
|
1186
1243
|
* tableApi.setRowExpanded(0, true); // expand the first row
|
|
1187
1244
|
*/
|
|
1188
1245
|
setRowExpanded(rowIndex: number, expanded: boolean): boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* Row grouping ({@link RowGroupFactory}): groups the rows by other levels – without a new table model (a new model
|
|
1248
|
+
* would rebuild the table in every framework wrapper). Groups whose path stays keep their expanded state; filter,
|
|
1249
|
+
* sorting and checked rows stay; the columns of the grouped properties are hidden (the previously grouped ones come
|
|
1250
|
+
* back) and the header of the group column follows. An empty list shows the rows without groups.
|
|
1251
|
+
*
|
|
1252
|
+
* @param {RowGroupField[]} groupBy - the new levels, top first: property paths, functions or {@link RowGroupFieldIf}
|
|
1253
|
+
* @returns {boolean} false if the body is no row grouping
|
|
1254
|
+
*
|
|
1255
|
+
* @example
|
|
1256
|
+
* // a select with "region", "produkt", "region,produkt"
|
|
1257
|
+
* select.addEventListener("change", () => tableApi.setRowGroupBy(select.value.split(",")));
|
|
1258
|
+
*
|
|
1259
|
+
* @example
|
|
1260
|
+
* tableApi.setRowGroupBy([]); // flat again (with the total row)
|
|
1261
|
+
*
|
|
1262
|
+
* @since 1.1.94
|
|
1263
|
+
*/
|
|
1264
|
+
setRowGroupBy(groupBy: RowGroupField[]): boolean;
|
|
1265
|
+
/**
|
|
1266
|
+
* Row grouping: the current levels.
|
|
1267
|
+
*
|
|
1268
|
+
* @returns {RowGroupField[] | undefined} the levels, undefined if the body is no row grouping
|
|
1269
|
+
*
|
|
1270
|
+
* @example
|
|
1271
|
+
* const levels = tableApi.getRowGroupBy(); // ["region", "produkt"]
|
|
1272
|
+
*
|
|
1273
|
+
* @since 1.1.94
|
|
1274
|
+
*/
|
|
1275
|
+
getRowGroupBy(): RowGroupField[] | undefined;
|
|
1276
|
+
/**
|
|
1277
|
+
* Pivot table ({@link PivotFactory}): pivots again – other row fields, column fields or values, or new rows –
|
|
1278
|
+
* without a new table model (a new model would rebuild the table in every framework wrapper). The model gets new
|
|
1279
|
+
* columns, header and totals; rows whose path stays keep their expanded state, the filter stays, column widths of
|
|
1280
|
+
* columns that stay are kept, so are columns hidden with `setColumnVisible`. Sorting, selection and focus are reset
|
|
1281
|
+
* (the columns are different). An invalid configuration throws and changes nothing.
|
|
1282
|
+
*
|
|
1283
|
+
* @param {Partial<PivotConfigIf>} changes - the changed parts, e.g. `{ columnFields: ["jahr"] }`; `{}` = pivot the
|
|
1284
|
+
* current rows again (e.g. after new keys)
|
|
1285
|
+
* @param {any[]} [rows] - new source rows (default: the current ones)
|
|
1286
|
+
* @returns {boolean} false if the table model is no pivot table
|
|
1287
|
+
*
|
|
1288
|
+
* @example
|
|
1289
|
+
* // a select with the column field
|
|
1290
|
+
* select.addEventListener("change", () => tableApi.setPivotConfig({ columnFields: [select.value] }));
|
|
1291
|
+
*
|
|
1292
|
+
* @example
|
|
1293
|
+
* tableApi.setPivotConfig({ values: [{ value: "umsatz", aggregator: "avg" }] }); // averages instead of sums
|
|
1294
|
+
* tableApi.setPivotConfig({}, await loadSales()); // new data
|
|
1295
|
+
*
|
|
1296
|
+
* @since 1.1.94
|
|
1297
|
+
*/
|
|
1298
|
+
setPivotConfig(changes: Partial<PivotConfigIf>, rows?: any[]): boolean;
|
|
1299
|
+
/**
|
|
1300
|
+
* Pivot table: the current configuration.
|
|
1301
|
+
*
|
|
1302
|
+
* @returns {PivotConfigIf | undefined} a copy, undefined if the table model is no pivot table
|
|
1303
|
+
*
|
|
1304
|
+
* @example
|
|
1305
|
+
* const columnFields = tableApi.getPivotConfig()?.columnFields; // ["monat"]
|
|
1306
|
+
*
|
|
1307
|
+
* @since 1.1.94
|
|
1308
|
+
*/
|
|
1309
|
+
getPivotConfig(): PivotConfigIf | undefined;
|
|
1310
|
+
/**
|
|
1311
|
+
* The value of a column for a row object – computed for a calculated column (`valueGetter`, `formula`), otherwise
|
|
1312
|
+
* the property (path). Use it in the external filter to filter by calculated values; a `TreeRow` is unwrapped.
|
|
1313
|
+
*
|
|
1314
|
+
* @param {any} row - a row object (or the `TreeRow` a tree filter gets)
|
|
1315
|
+
* @param {string} property - the property of the column
|
|
1316
|
+
* @returns {unknown} the value (a {@link FormulaError} for a formula error)
|
|
1317
|
+
*
|
|
1318
|
+
* @example
|
|
1319
|
+
* tableOptions.externalFilterFunction = (row: Item) => Number(tableApi.getRowValue(row, "total")) > 500;
|
|
1320
|
+
* tableApi.externalFilterChanged();
|
|
1321
|
+
*
|
|
1322
|
+
* @since 1.1.95
|
|
1323
|
+
*/
|
|
1324
|
+
getRowValue(row: any, property: string): unknown;
|
|
1325
|
+
/**
|
|
1326
|
+
* „Show values as“: shows the numbers of a column differently – share of the column total, running total, rank …
|
|
1327
|
+
* (see {@link ShowValuesAs}) – or normal again (`undefined`). No new model: the table repaints.
|
|
1328
|
+
*
|
|
1329
|
+
* @param {string} property - the property of the column
|
|
1330
|
+
* @param {ShowValuesAsConfig | undefined} showValuesAs - the mode (with options) or `undefined` for the values
|
|
1331
|
+
* @returns {boolean} false if there is no such column or the mode is unknown
|
|
1332
|
+
*
|
|
1333
|
+
* @example
|
|
1334
|
+
* select.addEventListener("change", () =>
|
|
1335
|
+
* tableApi.setShowValuesAs("total", select.value ? select.value as ShowValuesAs : undefined));
|
|
1336
|
+
*
|
|
1337
|
+
* @since 1.1.95
|
|
1338
|
+
*/
|
|
1339
|
+
setShowValuesAs(property: string, showValuesAs: ShowValuesAsConfig | undefined): boolean;
|
|
1340
|
+
/**
|
|
1341
|
+
* „Show values as“ of a column.
|
|
1342
|
+
*
|
|
1343
|
+
* @param {string} property - the property of the column
|
|
1344
|
+
* @returns {ShowValuesAsConfig | undefined} the configuration, `undefined` for none
|
|
1345
|
+
*
|
|
1346
|
+
* @example
|
|
1347
|
+
* const mode = tableApi.getShowValuesAs("total"); // "percentOfColumnTotal"
|
|
1348
|
+
*
|
|
1349
|
+
* @since 1.1.95
|
|
1350
|
+
*/
|
|
1351
|
+
getShowValuesAs(property: string): ShowValuesAsConfig | undefined;
|
|
1352
|
+
/**
|
|
1353
|
+
* Sets (or replaces) the formula of a column – e.g. from an input field of your app. The formula is compiled
|
|
1354
|
+
* once; an invalid formula is set anyway (the cells show `#ERROR!` / `#NAME?`) and its error is returned, so you can
|
|
1355
|
+
* show the message next to the input. No code is ever executed (no `eval`). The table repaints; totals, sorting
|
|
1356
|
+
* and filter see the new values after `repaint`, `reSort()` resp. `externalFilterChanged()`.
|
|
1357
|
+
*
|
|
1358
|
+
* @param {string} property - the property of the column (it becomes a calculated column)
|
|
1359
|
+
* @param {string} formula - the formula, e.g. `"[price] * [quantity] * 1.19"`
|
|
1360
|
+
* @param {FormulaOptionsIf} [options] - own functions
|
|
1361
|
+
* @returns {FormulaError | undefined} the error of the formula itself, `undefined` if it is valid
|
|
1362
|
+
* (`#NAME?` also if there is no such column)
|
|
1363
|
+
*
|
|
1364
|
+
* @example
|
|
1365
|
+
* input.addEventListener("change", () => {
|
|
1366
|
+
* const error = tableApi.setColumnFormula("custom", input.value);
|
|
1367
|
+
* hint.textContent = error ? `${error.code} ${error.message}` : "";
|
|
1368
|
+
* });
|
|
1369
|
+
*
|
|
1370
|
+
* @since 1.1.95
|
|
1371
|
+
*/
|
|
1372
|
+
setColumnFormula(property: string, formula: string, options?: FormulaOptionsIf): FormulaError | undefined;
|
|
1189
1373
|
/**
|
|
1190
1374
|
* Sorts the table data using a custom comparison function.
|
|
1191
1375
|
*
|
|
@@ -1236,6 +1420,208 @@ export declare class TableApi {
|
|
|
1236
1420
|
* tableApi.sort((a: TreeRowIf<OrderNode>, b: TreeRowIf<OrderNode>) => b.data.total - a.data.total);
|
|
1237
1421
|
*/
|
|
1238
1422
|
sort(compareFn: (a: any, b: any) => number): void;
|
|
1423
|
+
/**
|
|
1424
|
+
* Moves body rows – the code way to do what row drag does (e.g. "up"/"down" buttons, the pointer alternative of
|
|
1425
|
+
* WCAG 2.5.7, or after the server confirmed an unmanaged drag). The body model must support it
|
|
1426
|
+
* ({@link AreaModelIf.moveRows}: object arrays, arrays of arrays, trees); no filter may hide rows and no column may be
|
|
1427
|
+
* sorted (asc/desc – a sorted view has no order of its own). Focus and a multi-row selection follow the rows; screen
|
|
1428
|
+
* readers hear "Row moved to position 7 of 20". No row drag events. `false` if nothing moved (also for a target
|
|
1429
|
+
* where the rows already are).
|
|
1430
|
+
*
|
|
1431
|
+
* @param {number[] | number} rowIndices - display index or indices of the rows to move
|
|
1432
|
+
* @param {RowDropTargetIf | number} target - drop target; a number = in front of that display index
|
|
1433
|
+
* (`getDisplayedRowCount()` = behind the last row)
|
|
1434
|
+
* @returns {boolean} true if the rows were moved
|
|
1435
|
+
*
|
|
1436
|
+
* @example
|
|
1437
|
+
* tableApi.moveRows(2, { rowIndex: 6, position: "after" }); // row 3 becomes row 7
|
|
1438
|
+
* tableApi.moveRows([0, 1], tableApi.getDisplayedRowCount()); // the first two rows to the end
|
|
1439
|
+
*
|
|
1440
|
+
* @example
|
|
1441
|
+
* // unmanaged drag: the server decides, then the table moves the rows
|
|
1442
|
+
* const listener = new EventAdapter();
|
|
1443
|
+
* listener.onRowDragEnd = async (evt: GeRowDragEvent) => {
|
|
1444
|
+
* if (evt.type === "end" && evt.target && (await fetch("/api/move", { method: "POST" })).ok) {
|
|
1445
|
+
* tableApi.moveRows(evt.rowIndices, evt.target);
|
|
1446
|
+
* }
|
|
1447
|
+
* };
|
|
1448
|
+
*
|
|
1449
|
+
* @since 1.1.95
|
|
1450
|
+
*/
|
|
1451
|
+
moveRows(rowIndices: number[] | number, target: RowDropTargetIf | number): boolean;
|
|
1452
|
+
/**
|
|
1453
|
+
* True while rows are dragged with the pointer (mouse, touch, pen).
|
|
1454
|
+
*
|
|
1455
|
+
* @returns {boolean} true during a row drag
|
|
1456
|
+
*
|
|
1457
|
+
* @example
|
|
1458
|
+
* if (!tableApi.isRowDragging()) {
|
|
1459
|
+
* tableApi.updateCells([], true); // e.g. live data: wait until the drag is done
|
|
1460
|
+
* }
|
|
1461
|
+
*
|
|
1462
|
+
* @since 1.1.95
|
|
1463
|
+
*/
|
|
1464
|
+
isRowDragging(): boolean;
|
|
1465
|
+
/**
|
|
1466
|
+
* Cancels a running row drag (like Escape): nothing is moved, `onRowDragEnd` gets the type `"cancel"`.
|
|
1467
|
+
*
|
|
1468
|
+
* @example
|
|
1469
|
+
* tableApi.cancelRowDrag(); // e.g. new data arrived from the server
|
|
1470
|
+
*
|
|
1471
|
+
* @since 1.1.95
|
|
1472
|
+
*/
|
|
1473
|
+
cancelRowDrag(): void;
|
|
1474
|
+
/**
|
|
1475
|
+
* Writes values into body cells like the cell editor does – the one way the table changes cells (editor, fill
|
|
1476
|
+
* handle and batch commit use it too): cells that are not editable are skipped (`editable`, calculated columns
|
|
1477
|
+
* without `valueSetter`, group and pivot rows), values run through `editInputPipe` and {@link ColumnDefIf.validate}
|
|
1478
|
+
* (invalid ones are not written), totals and calculated columns follow, and **one** `onModelChanged` reports all
|
|
1479
|
+
* cells with old and new values. In a batch edit the values are marked as pending instead.
|
|
1480
|
+
*
|
|
1481
|
+
* Paste from the clipboard and undo/redo can be built on it: a {@link CellChangeIf} has the old and the new value.
|
|
1482
|
+
*
|
|
1483
|
+
* @param {CellValueChangeIf[]} changes - display row index, column (index or property) and value per cell
|
|
1484
|
+
* @param {CellChangeSource} [source="api"] - reported in {@link GeModelChangeEvent.source}
|
|
1485
|
+
* @returns {CellChangeIf[]} the written (batch edit: newly pending) cells
|
|
1486
|
+
*
|
|
1487
|
+
* @example
|
|
1488
|
+
* tableApi.applyCellChanges([
|
|
1489
|
+
* { rowIndex: 0, column: "price", value: 9.9 },
|
|
1490
|
+
* { rowIndex: 1, column: "price", value: 12 },
|
|
1491
|
+
* ]);
|
|
1492
|
+
*
|
|
1493
|
+
* @example
|
|
1494
|
+
* // undo the last change set (from onModelChanged)
|
|
1495
|
+
* const undo = (changes: CellChangeIf[]) => tableApi.applyCellChanges(
|
|
1496
|
+
* changes.map(c => ({ rowIndex: c.rowIndex, column: c.property, value: c.oldValue })));
|
|
1497
|
+
*
|
|
1498
|
+
* @since 1.1.96
|
|
1499
|
+
*/
|
|
1500
|
+
applyCellChanges(changes: CellValueChangeIf[], source?: CellChangeSource): CellChangeIf[];
|
|
1501
|
+
/**
|
|
1502
|
+
* Fills cells next to a range – what dragging the fill handle does ({@link TableOptionsIf.fillHandle} is not
|
|
1503
|
+
* needed for this call): continues series (1, 2 → 3, 4; dates; `Item 1` → `Item 2`) or copies, writes with
|
|
1504
|
+
* {@link applyCellChanges} (one `onModelChanged`, source `"fill"`) and selects source and filled cells.
|
|
1505
|
+
*
|
|
1506
|
+
* @param {CellRange} source - the source range (body display indices)
|
|
1507
|
+
* @param {FillDirection} direction - `"down"`, `"up"`, `"right"` or `"left"`
|
|
1508
|
+
* @param {number} count - rows or columns to fill (clamped to the table)
|
|
1509
|
+
* @param {FillMode} [mode="auto"] - `"auto"`, `"alternate"` (like ⌥/Alt while dragging) or `"copy"`
|
|
1510
|
+
* @returns {number} the number of filled cells (batch edit: marked); `-1` if more than `maxCells`
|
|
1511
|
+
*
|
|
1512
|
+
* @example
|
|
1513
|
+
* // rows 0 and 1 of column 2 hold 1 and 2: rows 2…9 get 3…10
|
|
1514
|
+
* tableApi.fillRange(new CellRange(0, 2, 1, 2), "down", 8);
|
|
1515
|
+
*
|
|
1516
|
+
* @since 1.1.96
|
|
1517
|
+
*/
|
|
1518
|
+
fillRange(source: CellRange, direction: FillDirection, count: number, mode?: FillMode): number;
|
|
1519
|
+
/**
|
|
1520
|
+
* True while the fill handle is dragged.
|
|
1521
|
+
*
|
|
1522
|
+
* @returns {boolean} true during a fill
|
|
1523
|
+
*
|
|
1524
|
+
* @example
|
|
1525
|
+
* if (!tableApi.isFilling()) {
|
|
1526
|
+
* tableApi.updateCells([], true); // e.g. live data: wait until the fill is done
|
|
1527
|
+
* }
|
|
1528
|
+
*
|
|
1529
|
+
* @since 1.1.96
|
|
1530
|
+
*/
|
|
1531
|
+
isFilling(): boolean;
|
|
1532
|
+
/**
|
|
1533
|
+
* Cancels a running fill (like Escape): nothing is changed.
|
|
1534
|
+
*
|
|
1535
|
+
* @example
|
|
1536
|
+
* tableApi.cancelFill();
|
|
1537
|
+
*
|
|
1538
|
+
* @since 1.1.96
|
|
1539
|
+
*/
|
|
1540
|
+
cancelFill(): void;
|
|
1541
|
+
/**
|
|
1542
|
+
* Starts a batch edit: from now on edited and filled values are **collected** – shown in the cells (class
|
|
1543
|
+
* `ge-table-cell-pending`), but not written into your rows – until {@link commitBatchEdit} or
|
|
1544
|
+
* {@link cancelBatchEdit}. Sorting, filtering, totals, copy and Excel use the written data. For a batch edit that is
|
|
1545
|
+
* always on use {@link TableOptionsIf.batchEdit}.
|
|
1546
|
+
*
|
|
1547
|
+
* @returns {boolean} false if a batch edit is already running
|
|
1548
|
+
*
|
|
1549
|
+
* @example
|
|
1550
|
+
* editButton.onclick = () => tableApi.startBatchEdit();
|
|
1551
|
+
* saveButton.onclick = () => tableApi.commitBatchEdit();
|
|
1552
|
+
* discardButton.onclick = () => tableApi.cancelBatchEdit();
|
|
1553
|
+
*
|
|
1554
|
+
* @since 1.1.96
|
|
1555
|
+
*/
|
|
1556
|
+
startBatchEdit(): boolean;
|
|
1557
|
+
/**
|
|
1558
|
+
* True while values are collected (after {@link startBatchEdit}, or always with {@link TableOptionsIf.batchEdit}).
|
|
1559
|
+
*
|
|
1560
|
+
* @returns {boolean} whether a batch edit runs
|
|
1561
|
+
*
|
|
1562
|
+
* @example
|
|
1563
|
+
* saveButton.hidden = !tableApi.isBatchEditing();
|
|
1564
|
+
*
|
|
1565
|
+
* @since 1.1.96
|
|
1566
|
+
*/
|
|
1567
|
+
isBatchEditing(): boolean;
|
|
1568
|
+
/**
|
|
1569
|
+
* True if a batch edit has values that are not written yet.
|
|
1570
|
+
*
|
|
1571
|
+
* @returns {boolean} whether there are pending changes
|
|
1572
|
+
*
|
|
1573
|
+
* @example
|
|
1574
|
+
* window.addEventListener("beforeunload", evt => {
|
|
1575
|
+
* if (tableApi.hasPendingChanges()) evt.preventDefault(); // "Leave site? Changes may not be saved."
|
|
1576
|
+
* });
|
|
1577
|
+
*
|
|
1578
|
+
* @since 1.1.96
|
|
1579
|
+
*/
|
|
1580
|
+
hasPendingChanges(): boolean;
|
|
1581
|
+
/**
|
|
1582
|
+
* The values of a batch edit that are not written yet: row object, property, old and new value, the current display
|
|
1583
|
+
* index (`-1` while a filter hides the row) and the message of an invalid value. The changes belong to the rows, not
|
|
1584
|
+
* to their positions – sorting and filtering don't mix them up.
|
|
1585
|
+
*
|
|
1586
|
+
* @returns {CellChangeIf[]} the pending cells
|
|
1587
|
+
*
|
|
1588
|
+
* @example
|
|
1589
|
+
* saveButton.onclick = async () => {
|
|
1590
|
+
* const changes = tableApi.getPendingChanges()
|
|
1591
|
+
* .map(c => ({ id: (c.row as { id: number }).id, field: c.property, value: c.newValue }));
|
|
1592
|
+
* const response = await fetch("/api/prices", { method: "PATCH", body: JSON.stringify(changes) });
|
|
1593
|
+
* if (response.ok) tableApi.commitBatchEdit();
|
|
1594
|
+
* };
|
|
1595
|
+
*
|
|
1596
|
+
* @since 1.1.96
|
|
1597
|
+
*/
|
|
1598
|
+
getPendingChanges(): CellChangeIf[];
|
|
1599
|
+
/**
|
|
1600
|
+
* Writes the pending values of a batch edit into the rows (through `setValue`, like the editor) and ends a batch edit
|
|
1601
|
+
* started with {@link startBatchEdit}: **one** `onModelChanged` (source `"commit"`) with all cells, then
|
|
1602
|
+
* `onBatchEditChanged` with the type `"commit"`. While a value is invalid ({@link ColumnDefIf.validate}) nothing is
|
|
1603
|
+
* written and the result is `false` (unless {@link BatchEditOptionsIf.blockCommitOnInvalid} is `false`).
|
|
1604
|
+
*
|
|
1605
|
+
* @returns {boolean} true if written
|
|
1606
|
+
*
|
|
1607
|
+
* @example
|
|
1608
|
+
* if (!tableApi.commitBatchEdit()) {
|
|
1609
|
+
* alert("Please fix the marked cells first.");
|
|
1610
|
+
* }
|
|
1611
|
+
*
|
|
1612
|
+
* @since 1.1.96
|
|
1613
|
+
*/
|
|
1614
|
+
commitBatchEdit(): boolean;
|
|
1615
|
+
/**
|
|
1616
|
+
* Discards the pending values of a batch edit (the cells show the data again) and ends a batch edit started with
|
|
1617
|
+
* {@link startBatchEdit}.
|
|
1618
|
+
*
|
|
1619
|
+
* @example
|
|
1620
|
+
* discardButton.onclick = () => tableApi.cancelBatchEdit();
|
|
1621
|
+
*
|
|
1622
|
+
* @since 1.1.96
|
|
1623
|
+
*/
|
|
1624
|
+
cancelBatchEdit(): void;
|
|
1239
1625
|
/**
|
|
1240
1626
|
* Ensures that a specific row is visible in the viewport by scrolling if necessary.
|
|
1241
1627
|
* This method checks if the target row is within the currently visible range and
|
|
@@ -22,6 +22,8 @@ import { OnActionTriggeredIf } from './action/on-action-triggered.if.js';
|
|
|
22
22
|
import { ActionId } from './action/action-id.type.js';
|
|
23
23
|
import { ShortcutService } from './action/shortcut.service.js';
|
|
24
24
|
import { TreeRowIf } from './data/common/tree-row-if.js';
|
|
25
|
+
import { PivotConfigIf } from './pivot/pivot-config.if.js';
|
|
26
|
+
import { RowGroupField } from './rowgroup/row-group-field.type.js';
|
|
25
27
|
import { LicenseManager } from './license-manager.js';
|
|
26
28
|
import { SelectionModel } from './selection/selection-model.js';
|
|
27
29
|
import { CopyServiceIf } from './service/copy-service.if.js';
|
|
@@ -34,6 +36,13 @@ import { ResizeHandler } from './resize-handler.js';
|
|
|
34
36
|
import { ExcelServiceIf } from './service/excel-service.if.js';
|
|
35
37
|
import { ColumnDefIf } from './data/tablemodel/column/column-def.if.js';
|
|
36
38
|
import { LiveAnnouncer } from './aria/live-announcer.js';
|
|
39
|
+
import { FillHandleOptionsIf } from './fill/fill-handle-options.if.js';
|
|
40
|
+
import { CellChangeIf, CellChangeSource } from './batch-edit/cell-change.if.js';
|
|
41
|
+
import { CellValueChangeIf } from './batch-edit/cell-value-change.if.js';
|
|
42
|
+
import { FillDirection } from './fill/fill-direction.type.js';
|
|
43
|
+
import { FillMode } from './fill/fill-series.js';
|
|
44
|
+
import { CellRange } from './data/common/cell-range.js';
|
|
45
|
+
import { AriaTextsIf } from './aria/aria-texts.if.js';
|
|
37
46
|
|
|
38
47
|
/**
|
|
39
48
|
* Creates and runs one table in a host element – the core that every framework wrapper uses.
|
|
@@ -144,6 +153,21 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
144
153
|
* @return {boolean} - Returns true if the action was triggered successfully, false otherwise.
|
|
145
154
|
*/
|
|
146
155
|
onActionTriggered(actionId: ActionId): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* The event listener of this table (the one given to the constructor, or an empty {@link EventAdapter}).
|
|
158
|
+
*
|
|
159
|
+
* @returns {EventListenerIf} the listener
|
|
160
|
+
* @since 1.1.95
|
|
161
|
+
*/
|
|
162
|
+
getEventListener(): EventListenerIf;
|
|
163
|
+
/**
|
|
164
|
+
* Called after rows were moved in the body model (row drag, {@link TableApi.moveRows}): drops derived values
|
|
165
|
+
* (totals, „Show values as“) and forgets a sort function of `tableApi.sort(fn)` – the moved order wins.
|
|
166
|
+
* The caller repaints.
|
|
167
|
+
*
|
|
168
|
+
* @since 1.1.95
|
|
169
|
+
*/
|
|
170
|
+
afterRowsMoved(): void;
|
|
147
171
|
/**
|
|
148
172
|
* Speaks a message to screen reader users (polite live region, see {@link LiveAnnouncer}).
|
|
149
173
|
*
|
|
@@ -221,7 +245,106 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
221
245
|
* first, so the blur caused by closing does not commit the typed text ("change" event)
|
|
222
246
|
*/
|
|
223
247
|
cancelEditing(editor?: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement): void;
|
|
248
|
+
/**
|
|
249
|
+
* Writes the text of a cell editor (called by the input handler on "change"). Batch edit: the value is marked as
|
|
250
|
+
* pending instead. Uses {@link applyCellChanges} – one `onModelChanged` per edit, as before.
|
|
251
|
+
*
|
|
252
|
+
* @param {AreaIdent} areaIdent - only `"body"` is edited
|
|
253
|
+
* @param {number} rowIndex - display index
|
|
254
|
+
* @param {number} columnIndex - model index
|
|
255
|
+
* @param {string} value - the text of the editor
|
|
256
|
+
*/
|
|
224
257
|
updateModelValueAfterEdit(areaIdent: AreaIdent, rowIndex: number, columnIndex: number, value: string): void;
|
|
258
|
+
/**
|
|
259
|
+
* The one place that changes body cells (editor, fill handle, batch commit, {@link TableApi.applyCellChanges}):
|
|
260
|
+
* skips cells that are not editable (`editable`, calculated columns without `valueSetter`, group/pivot rows),
|
|
261
|
+
* applies `editInputPipe` and {@link ColumnDefIf.validate}, then writes – or, in a batch edit, marks the values as
|
|
262
|
+
* pending. Writing reports **one** `onModelChanged` with all cells; derived values (totals, calculated columns) are
|
|
263
|
+
* recomputed and the table repaints.
|
|
264
|
+
*
|
|
265
|
+
* @param {CellValueChangeIf[]} changes - cells and values (column as index or property)
|
|
266
|
+
* @param {CellChangeSource} [source="api"] - reported in the event
|
|
267
|
+
* @returns {CellChangeIf[]} the written (or, in a batch edit, newly pending) cells
|
|
268
|
+
* @since 1.1.96
|
|
269
|
+
*/
|
|
270
|
+
applyCellChanges(changes: CellValueChangeIf[], source?: CellChangeSource): CellChangeIf[];
|
|
271
|
+
/**
|
|
272
|
+
* Writes cell values directly (no batch edit) – used by {@link applyCellChanges} and the batch commit.
|
|
273
|
+
*
|
|
274
|
+
* @param {{ rowIndex: number, columnIndex: number, value: unknown }[]} cells - resolved cells (display/model indices)
|
|
275
|
+
* @param {CellChangeSource} source - reported in the event
|
|
276
|
+
* @param {{ extraChanges?: CellChangeIf[], skipValidation?: boolean }} [opts] - changes written elsewhere (reported
|
|
277
|
+
* in the same event), no validation (commit: already checked)
|
|
278
|
+
* @returns {CellChangeIf[]} the written cells (including `extraChanges`)
|
|
279
|
+
* @since 1.1.96
|
|
280
|
+
*/
|
|
281
|
+
writeCells(cells: {
|
|
282
|
+
rowIndex: number;
|
|
283
|
+
columnIndex: number;
|
|
284
|
+
value: unknown;
|
|
285
|
+
}[], source: CellChangeSource, opts?: {
|
|
286
|
+
extraChanges?: CellChangeIf[];
|
|
287
|
+
skipValidation?: boolean;
|
|
288
|
+
}): CellChangeIf[];
|
|
289
|
+
private writeCellsInternal;
|
|
290
|
+
/** Marks values as pending (batch edit): pipe, validation, then the batch edit service. */
|
|
291
|
+
private markPending;
|
|
292
|
+
/**
|
|
293
|
+
* Column property → index, range check, editable check (not for the editor: it was opened on an editable cell).
|
|
294
|
+
*/
|
|
295
|
+
private resolveCellChanges;
|
|
296
|
+
/** The value after the column's `editInputPipe` (as `setValue` will store it). */
|
|
297
|
+
private pipeCellValue;
|
|
298
|
+
/** The message of {@link ColumnDefIf.validate} – `undefined` if valid or without validator. */
|
|
299
|
+
private validateCellValue;
|
|
300
|
+
/** The row object of a body row for events: the data of a `TreeRow`, `undefined` without objects. */
|
|
301
|
+
private rowObjectOf;
|
|
302
|
+
/**
|
|
303
|
+
* The options of the fill handle, `undefined` if it is off ({@link TableOptionsIf.fillHandle}).
|
|
304
|
+
*
|
|
305
|
+
* @returns {FillHandleOptionsIf | undefined} complete options
|
|
306
|
+
* @since 1.1.96
|
|
307
|
+
*/
|
|
308
|
+
getFillHandleOptions(): FillHandleOptionsIf | undefined;
|
|
309
|
+
/**
|
|
310
|
+
* Fills cells next to a range (fill handle, Ctrl/⌘+D, {@link TableApi.fillRange}): computes the values
|
|
311
|
+
* ({@link computeFillChanges}, shown values – a batch edit's pending values count), writes them with
|
|
312
|
+
* {@link applyCellChanges} and selects source and filled cells.
|
|
313
|
+
*
|
|
314
|
+
* @param {CellRange} source - the source range (body display indices)
|
|
315
|
+
* @param {FillDirection} direction - down, up, right or left
|
|
316
|
+
* @param {number} count - rows or columns to fill (clamped to the table)
|
|
317
|
+
* @param {FillMode} [mode="auto"] - series or copy
|
|
318
|
+
* @param {CellRange} [selectAfter] - the selection afterwards (default: source and filled cells)
|
|
319
|
+
* @returns {number} the number of filled (or, in a batch edit, marked) cells; `-1` if refused (too many cells)
|
|
320
|
+
* @since 1.1.96
|
|
321
|
+
*/
|
|
322
|
+
fillRange(source: CellRange, direction: FillDirection, count: number, mode?: FillMode, selectAfter?: CellRange): number;
|
|
323
|
+
/** The last selected range, clamped to the body (`undefined` without one). */
|
|
324
|
+
getFillSourceRange(): CellRange | undefined;
|
|
325
|
+
private normalizeRange;
|
|
326
|
+
/**
|
|
327
|
+
* Ctrl/⌘+D (down) and Ctrl/⌘+R (right): the first row (column) of the selected range is copied into the rest; a
|
|
328
|
+
* range of one row (column) gets the cell above (left of) it – like a spreadsheet.
|
|
329
|
+
*
|
|
330
|
+
* @param {"down" | "right"} direction - the key
|
|
331
|
+
* @returns {boolean} true if the key was used (the browser's own action – bookmark, reload – is prevented then)
|
|
332
|
+
*/
|
|
333
|
+
private fillByKeyboard;
|
|
334
|
+
/**
|
|
335
|
+
* Sets `aria-keyshortcuts` of the host (the fill handle's keyboard alternative); removed again by {@link destroy}.
|
|
336
|
+
*
|
|
337
|
+
* @param {string | undefined} value - e.g. `"Control+D Control+R"`; `undefined` restores the value before
|
|
338
|
+
* @since 1.1.96
|
|
339
|
+
*/
|
|
340
|
+
setHostKeyShortcuts(value: string | undefined): void;
|
|
341
|
+
/**
|
|
342
|
+
* The texts of fill and batch edit with defaults (an own {@link AriaTextsIf} implementation may lack them).
|
|
343
|
+
*
|
|
344
|
+
* @returns the texts
|
|
345
|
+
* @since 1.1.96
|
|
346
|
+
*/
|
|
347
|
+
getEditTexts(): Required<Pick<AriaTextsIf, 'cellsFilled' | 'fillTooLarge' | 'pendingChanges' | 'changesCommitted' | 'changesDiscarded' | 'commitBlocked' | 'invalidValue'>>;
|
|
225
348
|
/**
|
|
226
349
|
* Retrieves the TableApi object.
|
|
227
350
|
*
|
|
@@ -329,6 +452,23 @@ export declare class TableScope extends RenderScope implements OnActionTriggered
|
|
|
329
452
|
* @returns {boolean} false if the body is no tree or the state was already set
|
|
330
453
|
*/
|
|
331
454
|
setTreeRowExpanded(row: TreeRowIf<any>, expanded: boolean): boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Groups the rows of a row grouping by other levels (see {@link TableApi.setRowGroupBy}).
|
|
457
|
+
*
|
|
458
|
+
* @param {RowGroupField[]} groupBy - the new levels, top first
|
|
459
|
+
* @returns {boolean} false if the body is no row grouping
|
|
460
|
+
*/
|
|
461
|
+
setRowGroupBy(groupBy: RowGroupField[]): boolean;
|
|
462
|
+
/**
|
|
463
|
+
* Pivots a pivot table again (see {@link TableApi.setPivotConfig}): new columns, header and totals in the same model,
|
|
464
|
+
* then the layout of the table is built again. Sorting and selection are reset (the columns are different).
|
|
465
|
+
*
|
|
466
|
+
* @param {Partial<PivotConfigIf>} changes - the changed parts of the configuration
|
|
467
|
+
* @param {unknown[]} [rows] - new source rows
|
|
468
|
+
* @returns {boolean} false if the table model is no pivot table
|
|
469
|
+
* @since 1.1.94
|
|
470
|
+
*/
|
|
471
|
+
setPivotConfig(changes: Partial<PivotConfigIf>, rows?: unknown[]): boolean;
|
|
332
472
|
/**
|
|
333
473
|
* Toggles the checkbox state of a specific row in a table.
|
|
334
474
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guiexpert/table",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.96",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dr. Marc Kronberg <info@gui.expert> (https://gui.expert)",
|
|
6
6
|
"repository": {
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
"test:watch": "vitest --project unit",
|
|
74
74
|
"test:coverage": "vitest run --coverage",
|
|
75
75
|
"test:types": "tsc -p tsconfig.spec.json --noEmit",
|
|
76
|
-
"npm-pub": "pnpm publish --no-git-checks --access public"
|
|
76
|
+
"npm-pub": "pnpm publish --no-git-checks --access public",
|
|
77
|
+
"bench": "vitest run --config bench/vitest.bench.config.ts"
|
|
77
78
|
}
|
|
78
79
|
}
|