@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
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { TableModel } from '../data/tablemodel/table-model.js';
|
|
2
|
+
import { ColumnDefIf } from '../data/tablemodel/column/column-def.if.js';
|
|
3
|
+
import { DefaultRowHeightsIf } from '../data/options/default-row-heights.if.js';
|
|
4
|
+
import { GetT } from '../data/common/get-t.js';
|
|
5
|
+
import { SelectionModelIf } from '../selection/selection-model.if.js';
|
|
6
|
+
import { AreaModelCellGroups } from '../data/tablemodel/areamodel/area-model-cell-groups.js';
|
|
7
|
+
import { AreaModelPivot } from '../data/tablemodel/areamodel/area-model-pivot.js';
|
|
8
|
+
import { AreaModelPivotFooter } from '../data/tablemodel/areamodel/area-model-pivot-footer.js';
|
|
9
|
+
import { SizeIf } from '../data/common/size.if.js';
|
|
10
|
+
import { PivotConfigIf } from './pivot-config.if.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The table model of a pivot table – a {@link TableModel} (all wrappers take it) whose columns follow the pivot: a
|
|
14
|
+
* group column, one column per column key × value, subtotal and total columns, a grouped header and a total row.
|
|
15
|
+
* Created by {@link PivotFactory.createTableModel}.
|
|
16
|
+
*
|
|
17
|
+
* Pivot again at runtime – other fields, values or rows – with {@link TableApi.setPivotConfig}: the same model and the
|
|
18
|
+
* same table get new columns (no new model, so no rebuild in the framework wrappers).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const tableModel = PivotFactory.createTableModel<Sale>({
|
|
22
|
+
* rows: sales, rowFields: ["region"], columnFields: ["monat"], values: ["umsatz"]
|
|
23
|
+
* });
|
|
24
|
+
* tableModel.getPivotBody().getResult().getValue(); // 450
|
|
25
|
+
* tableModel.getPivotConfig().columnFields; // ["monat"]
|
|
26
|
+
*
|
|
27
|
+
* @typeParam T - the row type
|
|
28
|
+
* @since 1.1.94
|
|
29
|
+
* @category Pivot
|
|
30
|
+
*/
|
|
31
|
+
export declare class PivotTableModel<T = any> extends TableModel {
|
|
32
|
+
private readonly leadingColumnDefs;
|
|
33
|
+
private readonly valueWidth?;
|
|
34
|
+
/** Marker for {@link isPivotTableModel} (works across copies of the core). */
|
|
35
|
+
readonly kind = "PivotTableModel";
|
|
36
|
+
private pivotFixedRightColumnCount;
|
|
37
|
+
/**
|
|
38
|
+
* Use {@link PivotFactory.createTableModel}.
|
|
39
|
+
*
|
|
40
|
+
* @param {AreaModelCellGroups} header - the grouped header
|
|
41
|
+
* @param {AreaModelPivot<T>} body - the pivot body
|
|
42
|
+
* @param {AreaModelPivotFooter<T>} footer - the total row
|
|
43
|
+
* @param {ColumnDefIf[]} leadingColumnDefs - the columns in front of the values (row numbers, group column)
|
|
44
|
+
* @param {ColumnDefIf[]} columnDefs - all columns (leading columns, value columns, total columns)
|
|
45
|
+
* @param {number} fixedRightColumnCount - the fixed total columns on the right
|
|
46
|
+
* @param {number} fixedLeftColumnCount - fixed columns on the left (the leading columns)
|
|
47
|
+
* @param {DefaultRowHeightsIf} defaultRowHeights - row heights
|
|
48
|
+
* @param {GetT<SelectionModelIf>} getSelectionModel - selection model factory
|
|
49
|
+
* @param {SizeIf} [valueWidth] - the width of new value columns
|
|
50
|
+
*/
|
|
51
|
+
constructor(header: AreaModelCellGroups, body: AreaModelPivot<T>, footer: AreaModelPivotFooter<T>, leadingColumnDefs: ColumnDefIf[], columnDefs: ColumnDefIf[], fixedRightColumnCount: number, fixedLeftColumnCount: number, defaultRowHeights: DefaultRowHeightsIf, getSelectionModel: GetT<SelectionModelIf>, valueWidth?: SizeIf | undefined);
|
|
52
|
+
getFixedRightColumnCount(): number;
|
|
53
|
+
/**
|
|
54
|
+
* The body: cells, row groups, drill-down ({@link AreaModelPivot.getCellSourceRows}) and the {@link PivotResult}.
|
|
55
|
+
*
|
|
56
|
+
* @returns {AreaModelPivot<T>} the body model
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* const pivotBody = pivotModel.getPivotBody();
|
|
60
|
+
* pivotBody.getResult().columnLeaves.map(c => c.label); // ["Feb", "Jan"]
|
|
61
|
+
*/
|
|
62
|
+
getPivotBody(): AreaModelPivot<T>;
|
|
63
|
+
/**
|
|
64
|
+
* The current configuration.
|
|
65
|
+
*
|
|
66
|
+
* @returns {PivotConfigIf<T>} a copy
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* pivotModel.getPivotConfig().rowFields; // ["region"]
|
|
70
|
+
*/
|
|
71
|
+
getPivotConfig(): PivotConfigIf<T>;
|
|
72
|
+
/**
|
|
73
|
+
* Pivots again with a changed configuration and/or new rows: new keys, columns, header and totals in this model.
|
|
74
|
+
* Prefer {@link TableApi.setPivotConfig} – it also lays the table out again; after this method alone the table
|
|
75
|
+
* must be laid out by you.
|
|
76
|
+
*
|
|
77
|
+
* @param {Partial<PivotConfigIf<T>>} changes - the changed parts, e.g. `{ columnFields: ["jahr"] }`
|
|
78
|
+
* @param {T[]} [rows] - new source rows (default: the current ones)
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* pivotModel.setPivotConfig({ values: [{ value: "umsatz", aggregator: "avg" }] });
|
|
82
|
+
*/
|
|
83
|
+
setPivotConfig(changes: Partial<PivotConfigIf<T>>, rows?: T[]): void;
|
|
84
|
+
/** Columns and header for the current pivot of the body. */
|
|
85
|
+
private relayout;
|
|
86
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ValueAccessor } from '../aggregation/value-accessor.type.js';
|
|
2
|
+
import { AggregatorRef } from '../aggregation/aggregator-name.type.js';
|
|
3
|
+
import { AggregatorIf } from '../aggregation/aggregator.if.js';
|
|
4
|
+
import { ShowValuesAsConfig, ShowValuesAsIf } from '../calc/show-values-as.type.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One value of a pivot table in full form: where the value of a row comes from, how it is aggregated, and how its
|
|
8
|
+
* columns are named. The short form is just the {@link ValueAccessor} (`"umsatz"` = the sum of umsatz).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const revenue: PivotValueIf<Order> = { value: "total", label: "Revenue" }; // sum
|
|
12
|
+
* const orders: PivotValueIf<Order> = { value: "id", aggregator: "count", label: "Orders" };
|
|
13
|
+
* const avgPrice: PivotValueIf<Order> = {
|
|
14
|
+
* value: o => o.total / o.quantity, aggregator: "avg", label: "Avg. price",
|
|
15
|
+
* format: v => v === undefined ? "" : `${(v as number).toFixed(2)} €`
|
|
16
|
+
* };
|
|
17
|
+
*
|
|
18
|
+
* @typeParam T - the row type
|
|
19
|
+
* @since 1.1.94
|
|
20
|
+
* @category Pivot
|
|
21
|
+
*/
|
|
22
|
+
export interface PivotValueIf<T = any> {
|
|
23
|
+
/** The value of a row: a property path (`"umsatz"`, `"order.total"`) or a function. */
|
|
24
|
+
value: ValueAccessor<T>;
|
|
25
|
+
/** A built-in aggregator by name (`"sum"`, `"avg"`, `"count"` …) or an own {@link AggregatorIf}. Default `"sum"`. */
|
|
26
|
+
aggregator?: AggregatorRef;
|
|
27
|
+
/**
|
|
28
|
+
* The id of the value – part of the column properties and the name in {@link PivotResult.getValue}.
|
|
29
|
+
* Default: `"<aggregator>(<path>)"`, e.g. `"sum(umsatz)"`; for a function `"<aggregator>(value<N>)"`.
|
|
30
|
+
*/
|
|
31
|
+
name?: string;
|
|
32
|
+
/** The header of its columns (with several values). Default: the name. Text only – never HTML. */
|
|
33
|
+
label?: string;
|
|
34
|
+
/** The text of a result in a cell. Default: numbers with at most two decimals (`"1,234.5"`). Excel gets the raw value. */
|
|
35
|
+
format?: (result: unknown) => string;
|
|
36
|
+
/**
|
|
37
|
+
* „Show values as“ (since 1.1.95): `"percentOfRowTotal"` (each pivot row = 100 %), `"percentOfColumnTotal"`,
|
|
38
|
+
* `"percentOfGrandTotal"` or `"percentOfParentTotal"` (share of the parent row group). The cells then hold the
|
|
39
|
+
* fraction (Excel: number with percent format), the text is a percentage; `format` is not used. Other modes of
|
|
40
|
+
* {@link ShowValuesAs} don't apply to a pivot (the value is shown).
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* values: [{ value: "umsatz", showValuesAs: "percentOfRowTotal" }]
|
|
44
|
+
*/
|
|
45
|
+
showValuesAs?: ShowValuesAsConfig;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A value of a pivot table: a property path or function (summed) or the full form {@link PivotValueIf}.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* const values: PivotValue<Sale>[] = ["umsatz", { value: "umsatz", aggregator: "count", label: "Count" }];
|
|
52
|
+
*
|
|
53
|
+
* @typeParam T - the row type
|
|
54
|
+
* @since 1.1.94
|
|
55
|
+
* @category Pivot
|
|
56
|
+
*/
|
|
57
|
+
export type PivotValue<T = any> = ValueAccessor<T> | PivotValueIf<T>;
|
|
58
|
+
/**
|
|
59
|
+
* A value of a pivot table as the table uses it: name, label, aggregator and format resolved
|
|
60
|
+
* ({@link PivotResult.values}, {@link PivotColumnInfoIf.value}).
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* const pivotBody = pivotModel.getPivotBody();
|
|
64
|
+
* pivotBody.getResult().values.map(v => v.name); // ["sum(umsatz)"]
|
|
65
|
+
*
|
|
66
|
+
* @since 1.1.94
|
|
67
|
+
* @category Pivot
|
|
68
|
+
*/
|
|
69
|
+
export interface PivotValueInfoIf {
|
|
70
|
+
/** The id ({@link PivotValueIf.name}). */
|
|
71
|
+
readonly name: string;
|
|
72
|
+
/** The header label. */
|
|
73
|
+
readonly label: string;
|
|
74
|
+
/** The aggregator. */
|
|
75
|
+
readonly aggregator: AggregatorIf;
|
|
76
|
+
/** The format of a result, if one was given. */
|
|
77
|
+
readonly format?: (result: unknown) => string;
|
|
78
|
+
/** „Show values as“, if one was given (since 1.1.95). */
|
|
79
|
+
readonly showValuesAs?: ShowValuesAsIf;
|
|
80
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { RowDragService } from './row-drag/row-drag-service.js';
|
|
2
|
+
import { BatchEditService } from './batch-edit/batch-edit-service.js';
|
|
3
|
+
import { FillHandleService } from './fill/fill-handle-service.js';
|
|
1
4
|
import { TableOverlayChange } from './overlay/table-overlay.js';
|
|
2
5
|
import { EleScope } from './ele-scope.js';
|
|
3
6
|
import { TableModelIf } from './data/tablemodel/table-model.if.js';
|
|
@@ -8,6 +11,7 @@ import { RendererCleanupFnType } from './renderer/renderer-cleanup-fn.type.js';
|
|
|
8
11
|
import { AreaIdent } from './data/tablemodel/area-ident.type.js';
|
|
9
12
|
import { SideIdent } from './data/side-ident.type.js';
|
|
10
13
|
import { DivScope } from './data/div-scope.type.js';
|
|
14
|
+
import { DerivedValuesChangeIf } from './data/tablemodel/areamodel/derived-values-change.if.js';
|
|
11
15
|
import { AreaModelIf } from './data/tablemodel/areamodel/area-model.if.js';
|
|
12
16
|
import { ArgsAdjustColumnsToRowParentParams } from './data/common/args-adjust-columns-to-row-parent-params.js';
|
|
13
17
|
import { ArgsRenderCellDiv } from './data/common/args-render-cell-div.js';
|
|
@@ -84,7 +88,80 @@ export declare class RenderScope extends EleScope {
|
|
|
84
88
|
* first body row, see `TableScope`. `undefined`: the focus is in the body ({@link FocusModelIf}).
|
|
85
89
|
*/
|
|
86
90
|
protected headerFocus?: [number, number];
|
|
91
|
+
/**
|
|
92
|
+
* Row drag of this table (drag handles, pointer and keyboard drag) – created by {@link TableScope}.
|
|
93
|
+
* @since 1.1.95
|
|
94
|
+
*/
|
|
95
|
+
rowDragService?: RowDragService;
|
|
96
|
+
/**
|
|
97
|
+
* Batch edit of this table (pending values, shown in the cells) – created by {@link TableScope}.
|
|
98
|
+
* @since 1.1.96
|
|
99
|
+
*/
|
|
100
|
+
batchEditService?: BatchEditService;
|
|
101
|
+
/**
|
|
102
|
+
* Fill handle of this table – created by {@link TableScope}.
|
|
103
|
+
* @since 1.1.96
|
|
104
|
+
*/
|
|
105
|
+
fillHandleService?: FillHandleService;
|
|
87
106
|
constructor(hostElement: HTMLDivElement, tableModel: TableModelIf, dom: ConvenienceDomService, tableOptions: TableOptionsIf);
|
|
107
|
+
/**
|
|
108
|
+
* The DOM service of this table (all DOM access of the table goes through it).
|
|
109
|
+
*
|
|
110
|
+
* @returns {ConvenienceDomService} the service
|
|
111
|
+
* @since 1.1.95
|
|
112
|
+
*/
|
|
113
|
+
getDomService(): ConvenienceDomService;
|
|
114
|
+
/**
|
|
115
|
+
* The visible body in client (viewport) coordinates – including fixed west/east columns, without the scroll bar –
|
|
116
|
+
* and the content pixels scrolled out at its top. Row drag computes the row under the pointer with it.
|
|
117
|
+
*
|
|
118
|
+
* @returns {{ top: number, height: number, left: number, width: number, contentScrollTop: number }} the geometry
|
|
119
|
+
* @since 1.1.95
|
|
120
|
+
*/
|
|
121
|
+
getBodyViewport(): {
|
|
122
|
+
top: number;
|
|
123
|
+
height: number;
|
|
124
|
+
left: number;
|
|
125
|
+
width: number;
|
|
126
|
+
contentScrollTop: number;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* The rectangle of a body cell in host coordinates (relative to the padding box of the host) – computed from the
|
|
130
|
+
* row and column positions, also for cells that are not rendered – and the visible part of its area (`clip…`: the
|
|
131
|
+
* body between header and footer, horizontally the fixed west/east area or the scrollable center).
|
|
132
|
+
*
|
|
133
|
+
* @param {number} rowIndex - display index
|
|
134
|
+
* @param {number} columnIndex - model index
|
|
135
|
+
* @returns {{ left: number, top: number, width: number, height: number, clipLeft: number, clipRight: number, clipTop: number, clipBottom: number }} the geometry
|
|
136
|
+
* @since 1.1.96
|
|
137
|
+
*/
|
|
138
|
+
getBodyCellRectInHost(rowIndex: number, columnIndex: number): {
|
|
139
|
+
left: number;
|
|
140
|
+
top: number;
|
|
141
|
+
width: number;
|
|
142
|
+
height: number;
|
|
143
|
+
clipLeft: number;
|
|
144
|
+
clipRight: number;
|
|
145
|
+
clipTop: number;
|
|
146
|
+
clipBottom: number;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* The body cell at a point in host coordinates, clamped to the body (a point above the body = row 0, right of the
|
|
150
|
+
* columns = the last column …) – computed, not read from the DOM.
|
|
151
|
+
*
|
|
152
|
+
* @param {number} x - x relative to the host's padding box
|
|
153
|
+
* @param {number} y - y relative to the host's padding box
|
|
154
|
+
* @returns {[number, number]} row and column index, `[-1, -1]` without rows or columns
|
|
155
|
+
* @since 1.1.96
|
|
156
|
+
*/
|
|
157
|
+
getBodyCellAtHostPoint(x: number, y: number): [number, number];
|
|
158
|
+
/**
|
|
159
|
+
* Scroll bar pixels per content pixel: 1, below 1 for a capped scroll height ({@link isScrollHeightCapped}).
|
|
160
|
+
*
|
|
161
|
+
* @returns {number} the factor for `scrollTop` changes
|
|
162
|
+
* @since 1.1.95
|
|
163
|
+
*/
|
|
164
|
+
getScrollerToContentRatioY(): number;
|
|
88
165
|
isEditing(): boolean;
|
|
89
166
|
/**
|
|
90
167
|
* Resets the editor renderer by clearing its values and state.
|
|
@@ -116,6 +193,15 @@ export declare class RenderScope extends EleScope {
|
|
|
116
193
|
* @return {void}
|
|
117
194
|
*/
|
|
118
195
|
repaint(): void;
|
|
196
|
+
/**
|
|
197
|
+
* Drops cached, derived values of the area models ({@link AreaModelIf.invalidateDerivedValues}, e.g. the totals of an
|
|
198
|
+
* {@link AreaModelAggregateFooter}) – called where data may have changed (filter, sorting, editing, `updateCells`,
|
|
199
|
+
* the public `tableApi.repaint()` / `repaintHard()`), not on scrolling.
|
|
200
|
+
*
|
|
201
|
+
* @param {DerivedValuesChangeIf} [change] - the changed rows of an edit or `updateCells()` (models may recompute less)
|
|
202
|
+
* @since 1.1.94
|
|
203
|
+
*/
|
|
204
|
+
invalidateAggregates(change?: DerivedValuesChangeIf): void;
|
|
119
205
|
/**
|
|
120
206
|
* Repaints the UI by resetting the size of the wrapper div,
|
|
121
207
|
* adjusting the containers and rows, and performing additional adjustments
|
|
@@ -183,6 +269,21 @@ export declare class RenderScope extends EleScope {
|
|
|
183
269
|
* @returns {void}
|
|
184
270
|
*/
|
|
185
271
|
updateCells(events: TableCellUpdateEventIf[], repaintAll?: boolean): void;
|
|
272
|
+
/**
|
|
273
|
+
* After `updateCells()` without a repaint: draws the rendered cells of calculated and „Show values as“ columns of
|
|
274
|
+
* the body again (they depend on the changed cells, e.g. `total = price * quantity` or a share of the total).
|
|
275
|
+
*/
|
|
276
|
+
protected rerenderCalculatedCells(): void;
|
|
277
|
+
/**
|
|
278
|
+
* After `updateCells()` without a repaint: draws the rendered aggregate cells of the group rows of a row grouping
|
|
279
|
+
* again (they follow the changed rows; labels and counts don't change – a moved row repaints the whole table).
|
|
280
|
+
*/
|
|
281
|
+
protected rerenderGroupRowCells(): void;
|
|
282
|
+
/**
|
|
283
|
+
* After `updateCells()` without a repaint: draws the rendered cells of a footer with cached totals again (only if the
|
|
284
|
+
* footer implements {@link AreaModelIf.invalidateDerivedValues}, and not if the events changed the footer itself).
|
|
285
|
+
*/
|
|
286
|
+
protected rerenderDerivedFooterCells(events: TableCellUpdateEventIf[]): void;
|
|
186
287
|
/**
|
|
187
288
|
* Rerenders the content of a table cell based on the given parameters.
|
|
188
289
|
*
|
|
@@ -360,11 +461,48 @@ export declare class RenderScope extends EleScope {
|
|
|
360
461
|
*
|
|
361
462
|
* @protected
|
|
362
463
|
*
|
|
363
|
-
* @returns {
|
|
364
|
-
*
|
|
365
|
-
|
|
464
|
+
* @returns {number} The column index of the tree arrow column: the first data column (0, behind a row number
|
|
465
|
+
* column 1), one more with a visible row checkbox column.
|
|
466
|
+
*/
|
|
467
|
+
protected getTreeArrowColumnIndex(): number;
|
|
468
|
+
/**
|
|
469
|
+
* Index of the first column that is not a row number column: 1 behind a {@link RowNumberColumnDef}, otherwise 0.
|
|
470
|
+
* The checkbox of `showCheckboxWihoutExtraColumn` and the tree arrow are bound to it.
|
|
471
|
+
*
|
|
472
|
+
* @returns {number} 0 or 1
|
|
473
|
+
* @since 1.1.93
|
|
474
|
+
*/
|
|
475
|
+
getFirstDataColumnIndex(): number;
|
|
476
|
+
/** false for a row number column: it has no resize handle (its width follows the numbers). */
|
|
477
|
+
protected isColumnResizable(columnIndex: number): boolean;
|
|
478
|
+
/**
|
|
479
|
+
* The last measured text of the row number column and its width (measured again only when the text changes).
|
|
480
|
+
* `approximate`: measured with the font of the host before a number cell existed – measured again with the font of
|
|
481
|
+
* a rendered number cell in the next render pass.
|
|
482
|
+
*/
|
|
483
|
+
private rowNumberWidth?;
|
|
484
|
+
/** true while the containers are adjusted to a new row number width (no second change in that nested pass). */
|
|
485
|
+
private adjustingRowNumberWidth;
|
|
486
|
+
/** the approximate first width is measured again once (see adjustAfterScrolling). */
|
|
487
|
+
private rowNumberRemeasureScheduled;
|
|
488
|
+
/**
|
|
489
|
+
* Fits the width of a leading row number column ({@link RowNumberColumnDef}) to its largest number. Cheap on every
|
|
490
|
+
* render pass: only the text of the largest number is compared; it is measured (canvas) only when it changed.
|
|
491
|
+
*
|
|
492
|
+
* @returns {boolean} true if the width changed (the containers must be adjusted)
|
|
493
|
+
* @since 1.1.93
|
|
494
|
+
*/
|
|
495
|
+
protected adjustRowNumberColumnWidth(): boolean;
|
|
496
|
+
/** A rendered label of a number cell – its font and padding are what the numbers need. */
|
|
497
|
+
private findRowNumberLabel;
|
|
498
|
+
/**
|
|
499
|
+
* Width in px of a row number text: with the font and padding of a rendered number cell label; before the first
|
|
500
|
+
* number cell exists with the font of the host and 6 px padding on each side (then `approximate` is true).
|
|
501
|
+
* Digits are measured as "0" (tabular figures: all digits are as wide as the widest).
|
|
502
|
+
*
|
|
503
|
+
* @returns {[number, boolean]} the width and whether it is approximate
|
|
366
504
|
*/
|
|
367
|
-
protected
|
|
505
|
+
protected measureRowNumberText(text: string): [number, boolean];
|
|
368
506
|
protected addAndRenderCellDiv({ areaModel, areaIdent, sideIdent, rowIndex, index, left, width, height, top, parent, lastRowOfModel }: ArgsRenderCellDiv): [HTMLDivElement, RendererCleanupFnType | undefined];
|
|
369
507
|
/**
|
|
370
508
|
* Applies CSS classes to an HTML element.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AreaModelIf } from '../data/tablemodel/areamodel/area-model.if.js';
|
|
2
|
+
import { CellRendererIf } from './cell-render.if.js';
|
|
3
|
+
import { DomServiceIf } from '../service/dom-service.if.js';
|
|
4
|
+
import { AreaIdent } from '../data/tablemodel/area-ident.type.js';
|
|
5
|
+
import { RendererCleanupFnType } from './renderer-cleanup-fn.type.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Writes the formatted text of a cell (`areaModel.getTextValueAt`) as a text node – never as HTML – in the label
|
|
9
|
+
* structure of a normal cell (`.ge-table-label-div > .ge-table-label`). {@link AreaModelAggregateFooter} uses it for
|
|
10
|
+
* its results (`"1,234.5"` instead of the raw `1234.4999999`) and labels when the column has no footer renderer.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // an own footer model that formats in getTextValueAt and shows that text
|
|
14
|
+
* class MyFooter extends AreaModel {
|
|
15
|
+
* private readonly renderer = new AggregateCellRenderer();
|
|
16
|
+
* override getCellRenderer(_row: number, _col: number): CellRendererIf { return this.renderer; }
|
|
17
|
+
* override getTextValueAt(_row: number, _col: number): string { return "Σ 42"; }
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* @since 1.1.94
|
|
21
|
+
* @category Aggregation
|
|
22
|
+
*/
|
|
23
|
+
export declare class AggregateCellRenderer implements CellRendererIf {
|
|
24
|
+
/** Marker (works across copies of the core). */
|
|
25
|
+
readonly type = "AggregateCellRenderer";
|
|
26
|
+
render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf, _cellValue: any, domService: DomServiceIf): RendererCleanupFnType | undefined;
|
|
27
|
+
}
|
|
@@ -6,5 +6,5 @@ import { RendererCleanupFnType } from '../renderer-cleanup-fn.type.js';
|
|
|
6
6
|
|
|
7
7
|
/** @category Renderers & editing */
|
|
8
8
|
export declare class InputCellRenderer implements CellRendererIf {
|
|
9
|
-
render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf,
|
|
9
|
+
render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf, cellValue: any, domService: DomServiceIf): RendererCleanupFnType | undefined;
|
|
10
10
|
}
|
|
@@ -10,5 +10,5 @@ export declare class SelectCellRenderer implements CellRendererIf {
|
|
|
10
10
|
protected options: ValueLabelIf[];
|
|
11
11
|
constructor(options: ValueLabelIf[]);
|
|
12
12
|
static create(values: string[]): SelectCellRenderer;
|
|
13
|
-
render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf,
|
|
13
|
+
render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf, cellValue: any, domService: DomServiceIf): RendererCleanupFnType | undefined;
|
|
14
14
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AreaModelIf } from '../data/tablemodel/areamodel/area-model.if.js';
|
|
2
|
+
import { CellRendererIf } from './cell-render.if.js';
|
|
3
|
+
import { DomServiceIf } from '../service/dom-service.if.js';
|
|
4
|
+
import { AreaIdent } from '../data/tablemodel/area-ident.type.js';
|
|
5
|
+
import { RendererCleanupFnType } from './renderer-cleanup-fn.type.js';
|
|
6
|
+
import { RowNumberColumnDef } from '../data/common/row-number-column-def.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Renders the number of a body row – the body renderer of {@link RowNumberColumnDef}. The text is set as a text node
|
|
10
|
+
* (never as HTML), in the same label structure as a normal cell (`.ge-table-label-div > .ge-table-label`).
|
|
11
|
+
*
|
|
12
|
+
* The table uses it for a `RowNumberColumnDef` with every body model (also own {@link AreaModel}s without renderers).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const columnDef = new RowNumberColumnDef();
|
|
16
|
+
* const renderer = columnDef.rendererMap.body; // a RowNumberCellRenderer
|
|
17
|
+
*
|
|
18
|
+
* @since 1.1.93
|
|
19
|
+
* @category Row numbers
|
|
20
|
+
*/
|
|
21
|
+
export declare class RowNumberCellRenderer implements CellRendererIf {
|
|
22
|
+
private readonly columnDef;
|
|
23
|
+
/** Marker (works across copies of the core). */
|
|
24
|
+
readonly type = "RowNumberCellRenderer";
|
|
25
|
+
constructor(columnDef: Pick<RowNumberColumnDef, "getRowNumberText">);
|
|
26
|
+
render(cellDiv: HTMLDivElement, rowIndex: number, columnIndex: number, areaIdent: AreaIdent, areaModel: AreaModelIf, _cellValue: any, domService: DomServiceIf): RendererCleanupFnType | undefined;
|
|
27
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { RowDropTargetIf } from './row-drop-target.if.js';
|
|
2
|
+
import { TreeRowIf } from '../data/common/tree-row-if.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Sorted, unique row indices inside `0 … rowCount - 1` (the order of the dragged rows is their display order).
|
|
6
|
+
*
|
|
7
|
+
* @param {number[]} rowIndices - any indices, e.g. from a selection
|
|
8
|
+
* @param {number} rowCount - number of rows
|
|
9
|
+
* @returns {number[]} a new, ascending array
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* normalizeRowIndices([5, 2, 2, 99, -1], 10); // [2, 5]
|
|
13
|
+
*
|
|
14
|
+
* @category Row drag
|
|
15
|
+
* @since 1.1.95
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizeRowIndices(rowIndices: readonly number[], rowCount: number): number[];
|
|
18
|
+
/**
|
|
19
|
+
* The index in front of which the rows are inserted (before the move): `"after"` row 7 = in front of row 8.
|
|
20
|
+
* `"inside"` counts like `"after"` (flat lists have no children).
|
|
21
|
+
*
|
|
22
|
+
* @param {RowDropTargetIf} target - the drop target
|
|
23
|
+
* @returns {number} the insert position, 0 … rowCount
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* getInsertBeforeIndex({ rowIndex: 7, position: "after" }); // 8
|
|
27
|
+
*
|
|
28
|
+
* @category Row drag
|
|
29
|
+
* @since 1.1.95
|
|
30
|
+
*/
|
|
31
|
+
export declare function getInsertBeforeIndex(target: RowDropTargetIf): number;
|
|
32
|
+
/**
|
|
33
|
+
* The index of the first moved row after a move in a flat list: the insert position minus the moved rows in front
|
|
34
|
+
* of it. A target inside the moved rows (or right next to them) returns their current index – nothing changes.
|
|
35
|
+
*
|
|
36
|
+
* @param {number[]} rowIndices - ascending, unique row indices ({@link normalizeRowIndices})
|
|
37
|
+
* @param {RowDropTargetIf} target - the drop target
|
|
38
|
+
* @returns {number} the new index of the first moved row, -1 without rows
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // D1: row 3 (index 2) dropped between row 7 and 8 → it is row 7 (index 6) afterwards
|
|
42
|
+
* calcMoveToIndex([2], { rowIndex: 6, position: "after" }); // 6
|
|
43
|
+
*
|
|
44
|
+
* @category Row drag
|
|
45
|
+
* @since 1.1.95
|
|
46
|
+
*/
|
|
47
|
+
export declare function calcMoveToIndex(rowIndices: readonly number[], target: RowDropTargetIf): number;
|
|
48
|
+
/**
|
|
49
|
+
* Moves items of an array **in place** (like `Array.prototype.sort`): the items at `indices` keep their order and are
|
|
50
|
+
* inserted in front of `insertBefore` (an index of the array before the move, `array.length` = at the end).
|
|
51
|
+
*
|
|
52
|
+
* @param {T[]} array - the array to change
|
|
53
|
+
* @param {number[]} indices - ascending, unique indices ({@link normalizeRowIndices})
|
|
54
|
+
* @param {number} insertBefore - 0 … array.length
|
|
55
|
+
* @returns {number} the new index of the first moved item (-1 if nothing was given)
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* const list = ["a", "b", "c", "d", "e"];
|
|
59
|
+
* moveArrayItems(list, [1, 3], 5); // 3
|
|
60
|
+
* list; // ["a", "c", "e", "b", "d"]
|
|
61
|
+
*
|
|
62
|
+
* @category Row drag
|
|
63
|
+
* @since 1.1.95
|
|
64
|
+
*/
|
|
65
|
+
export declare function moveArrayItems<T>(array: T[], indices: readonly number[], insertBefore: number): number;
|
|
66
|
+
/**
|
|
67
|
+
* The dragged tree rows without the ones that travel with an ancestor (a child of a dragged node moves with it).
|
|
68
|
+
*
|
|
69
|
+
* @param {TreeRowIf<S>[]} rows - dragged rows in display order
|
|
70
|
+
* @returns {TreeRowIf<S>[]} the topmost dragged rows, same order
|
|
71
|
+
*
|
|
72
|
+
* @category Row drag
|
|
73
|
+
* @since 1.1.95
|
|
74
|
+
*/
|
|
75
|
+
export declare function getTopmostTreeRows<S>(rows: readonly TreeRowIf<S>[]): TreeRowIf<S>[];
|
|
76
|
+
/**
|
|
77
|
+
* True if the tree rows can be dropped at the target row: the target is none of the dragged rows and no descendant
|
|
78
|
+
* of them (a node cannot become its own child – no cycle).
|
|
79
|
+
*
|
|
80
|
+
* @param {TreeRowIf<S>[]} rows - dragged rows
|
|
81
|
+
* @param {TreeRowIf<S>} targetRow - the row under the drop marker
|
|
82
|
+
* @returns {boolean} false for a cycle
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* const treeModel = tableModel.getBodyModel() as AreaModelTree<OrderNode>;
|
|
86
|
+
* const node = treeModel.rows[0];
|
|
87
|
+
* canMoveTreeRows([node], node.children?.[0]); // false – into its own child
|
|
88
|
+
*
|
|
89
|
+
* @category Row drag
|
|
90
|
+
* @since 1.1.95
|
|
91
|
+
*/
|
|
92
|
+
export declare function canMoveTreeRows<S>(rows: readonly TreeRowIf<S>[], targetRow: TreeRowIf<S> | undefined): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Moves tree rows **in place**: in front of / behind `targetRow` (siblings, same parent) or `"inside"` it (last
|
|
95
|
+
* children; the target is expanded). Children travel with their parent; `parent` and `deep` are updated.
|
|
96
|
+
*
|
|
97
|
+
* @param {TreeRowIf<S>[]} roots - the top-level rows (e.g. `AreaModelTree.rows`)
|
|
98
|
+
* @param {TreeRowIf<S>[]} rows - dragged rows in display order
|
|
99
|
+
* @param {TreeRowIf<S>} targetRow - the row under the drop marker
|
|
100
|
+
* @param {"before" | "after" | "inside"} position - where to drop
|
|
101
|
+
* @returns {boolean} false if nothing was moved (cycle, no rows)
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* const treeModel = tableModel.getBodyModel() as AreaModelTree<OrderNode>;
|
|
105
|
+
* moveTreeRows(treeModel.rows, [treeModel.rows[2]], treeModel.rows[0], "inside"); // 3rd root → child of the 1st
|
|
106
|
+
* treeModel.recalcVisibleTreeRows();
|
|
107
|
+
*
|
|
108
|
+
* @category Row drag
|
|
109
|
+
* @since 1.1.95
|
|
110
|
+
*/
|
|
111
|
+
export declare function moveTreeRows<S>(roots: TreeRowIf<S>[], rows: readonly TreeRowIf<S>[], targetRow: TreeRowIf<S>, position: RowDropTargetIf["position"]): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Flat area models: true if the dragged rows can be moved – all rows are displayed (no filter hides one), the target
|
|
114
|
+
* row exists and is not `"inside"`.
|
|
115
|
+
*
|
|
116
|
+
* @param {number} displayedCount - displayed rows (`getRowCount()`)
|
|
117
|
+
* @param {number} allCount - all rows (`getUnfilteredRowCount()`)
|
|
118
|
+
* @param {number[]} rowIndices - display indices of the dragged rows
|
|
119
|
+
* @param {RowDropTargetIf} target - the drop target
|
|
120
|
+
* @returns {boolean} true if a move is possible
|
|
121
|
+
*
|
|
122
|
+
* @category Row drag
|
|
123
|
+
* @since 1.1.95
|
|
124
|
+
*/
|
|
125
|
+
export declare function canMoveFlatRows(displayedCount: number, allCount: number, rowIndices: readonly number[], target: RowDropTargetIf): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Flat area models: moves the rows in the displayed array and writes the new order back to the array of all rows –
|
|
128
|
+
* both in place. Used by `AreaModelObjectArray` and `AreaModelArrayOfArrays`.
|
|
129
|
+
*
|
|
130
|
+
* @param {T[]} displayed - displayed rows (display order)
|
|
131
|
+
* @param {T[]} all - all rows (same rows – no filter hides one)
|
|
132
|
+
* @param {number[]} rowIndices - display indices of the dragged rows
|
|
133
|
+
* @param {RowDropTargetIf} target - the drop target
|
|
134
|
+
* @returns {boolean} true if moved
|
|
135
|
+
*
|
|
136
|
+
* @category Row drag
|
|
137
|
+
* @since 1.1.95
|
|
138
|
+
*/
|
|
139
|
+
export declare function moveFlatRows<T>(displayed: T[], all: T[], rowIndices: readonly number[], target: RowDropTargetIf): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* The row at a content position (y in px from the top of all body rows): constant row heights are computed directly,
|
|
142
|
+
* variable ones by a binary search over the row tops. Positions above / below the rows give the first / last row.
|
|
143
|
+
*
|
|
144
|
+
* @param {number} contentY - y in content pixels
|
|
145
|
+
* @param {number} rowCount - number of rows (> 0)
|
|
146
|
+
* @param {(rowIndex: number) => number} getYPosByRowIndex - top of a row in content pixels (`AreaModelIf.getYPosByRowIndex`)
|
|
147
|
+
* @param {number} [constantRowHeight] - the height of every row, if they are all equal (`AreaModelIf.getConstantRowHeight`)
|
|
148
|
+
* @returns {number} the row index, 0 … rowCount - 1
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* const body = tableModel.getBodyModel();
|
|
152
|
+
* const rowIndex = findRowIndexAtY(1234, body.getRowCount(), i => body.getYPosByRowIndex(i), body.getConstantRowHeight?.());
|
|
153
|
+
*
|
|
154
|
+
* @category Row drag
|
|
155
|
+
* @since 1.1.95
|
|
156
|
+
*/
|
|
157
|
+
export declare function findRowIndexAtY(contentY: number, rowCount: number, getYPosByRowIndex: (rowIndex: number) => number, constantRowHeight?: number): number;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RowDragOptionsIf } from './row-drag-options.if.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The defaults of {@link RowDragOptionsIf}.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const options = RowDragOptions.create({ managed: false });
|
|
8
|
+
* options.autoScrollZoneInPx; // 40
|
|
9
|
+
*
|
|
10
|
+
* @category Row drag
|
|
11
|
+
* @since 1.1.95
|
|
12
|
+
*/
|
|
13
|
+
export declare class RowDragOptions implements RowDragOptionsIf {
|
|
14
|
+
managed: boolean;
|
|
15
|
+
multiRow: boolean;
|
|
16
|
+
treeDropInside: boolean;
|
|
17
|
+
dragThresholdInPx: number;
|
|
18
|
+
autoScrollZoneInPx: number;
|
|
19
|
+
autoScrollMaxSpeedInPx: number;
|
|
20
|
+
ghostText?: (rows: any[]) => string;
|
|
21
|
+
/**
|
|
22
|
+
* The defaults, overridden by the given values (`undefined` keeps the default).
|
|
23
|
+
*
|
|
24
|
+
* @param {Partial<RowDragOptionsIf>} [options] - e.g. `tableOptions.rowDragOptions`
|
|
25
|
+
* @returns {RowDragOptionsIf} complete options
|
|
26
|
+
*/
|
|
27
|
+
static create(options?: Partial<RowDragOptionsIf>): RowDragOptionsIf;
|
|
28
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options of row dragging ({@link TableOptionsIf.rowDragOptions}). Rows get a drag handle in every column with
|
|
3
|
+
* {@link ColumnDefIf.rowDrag} (or `TableFactory.createTableModel({ rows, rowDrag: true })`).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const tableOptions: TableOptionsIf = {
|
|
7
|
+
* ...new TableOptions(),
|
|
8
|
+
* rowDragOptions: { managed: false, autoScrollMaxSpeedInPx: 40 } // events only – the app moves the rows
|
|
9
|
+
* };
|
|
10
|
+
*
|
|
11
|
+
* @category Row drag
|
|
12
|
+
* @since 1.1.95
|
|
13
|
+
*/
|
|
14
|
+
export interface RowDragOptionsIf {
|
|
15
|
+
/**
|
|
16
|
+
* `true` (default): the table moves the rows itself (`AreaModelIf.moveRows`) – only while the table is neither
|
|
17
|
+
* sorted (a column with sort state asc/desc) nor filtered. `false`: the table only reports the drag
|
|
18
|
+
* (`onRowDragStart/Move/End`), the app moves the rows (e.g. after the server confirmed), always allowed.
|
|
19
|
+
*/
|
|
20
|
+
managed: boolean;
|
|
21
|
+
/** `true` (default): grabbing a selected row drags all rows with a selection (their order stays). */
|
|
22
|
+
multiRow: boolean;
|
|
23
|
+
/** `true` (default): tree – dropping on the middle of a row makes the rows its children. */
|
|
24
|
+
treeDropInside: boolean;
|
|
25
|
+
/** Distance in px the pointer has to move before a drag starts (default 4) – below it is a click on the handle. */
|
|
26
|
+
dragThresholdInPx: number;
|
|
27
|
+
/** Height in px of the zone at the top and bottom edge of the body that scrolls automatically (default 40). */
|
|
28
|
+
autoScrollZoneInPx: number;
|
|
29
|
+
/** Maximum auto-scroll speed in px per animation frame (default 24). */
|
|
30
|
+
autoScrollMaxSpeedInPx: number;
|
|
31
|
+
/**
|
|
32
|
+
* Text of the drag ghost. Default: the text of the handle cell of the first row, "(+2)" for two more rows.
|
|
33
|
+
* The text is shown as text (never as HTML).
|
|
34
|
+
*/
|
|
35
|
+
ghostText?: (rows: any[]) => string;
|
|
36
|
+
}
|