@affino/datagrid-vue-app 0.1.1
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/LICENSE +21 -0
- package/README.md +1062 -0
- package/dist/DataGrid.d.ts +430 -0
- package/dist/DataGrid.js +565 -0
- package/dist/DataGridDefaultRenderer.d.ts +2 -0
- package/dist/DataGridDefaultRenderer.js +2 -0
- package/dist/DataGridModuleHost.d.ts +2 -0
- package/dist/DataGridModuleHost.js +2 -0
- package/dist/DataGridRuntimeHost.d.ts +1 -0
- package/dist/DataGridRuntimeHost.js +1 -0
- package/dist/config/dataGridAdvancedFilter.d.ts +9 -0
- package/dist/config/dataGridAdvancedFilter.js +21 -0
- package/dist/config/dataGridAggregations.d.ts +17 -0
- package/dist/config/dataGridAggregations.js +21 -0
- package/dist/config/dataGridColumnLayout.d.ts +9 -0
- package/dist/config/dataGridColumnLayout.js +21 -0
- package/dist/config/dataGridFormulaOptions.d.ts +25 -0
- package/dist/config/dataGridFormulaOptions.js +137 -0
- package/dist/config/dataGridPublicProps.d.ts +6 -0
- package/dist/config/dataGridPublicProps.js +58 -0
- package/dist/config/dataGridSavedView.d.ts +17 -0
- package/dist/config/dataGridSavedView.js +73 -0
- package/dist/config/dataGridVirtualization.d.ts +14 -0
- package/dist/config/dataGridVirtualization.js +32 -0
- package/dist/dataGridAdvancedFilter.d.ts +1 -0
- package/dist/dataGridAdvancedFilter.js +1 -0
- package/dist/dataGridAggregations.d.ts +1 -0
- package/dist/dataGridAggregations.js +1 -0
- package/dist/dataGridAppContext.d.ts +2 -0
- package/dist/dataGridAppContext.js +1 -0
- package/dist/dataGridCellComboboxState.d.ts +10 -0
- package/dist/dataGridCellComboboxState.js +67 -0
- package/dist/dataGridColumnLayout.d.ts +1 -0
- package/dist/dataGridColumnLayout.js +1 -0
- package/dist/dataGridColumnMenu.d.ts +9 -0
- package/dist/dataGridColumnMenu.js +21 -0
- package/dist/dataGridEditability.d.ts +9 -0
- package/dist/dataGridEditability.js +1 -0
- package/dist/dataGridFilterableCombobox.d.ts +1 -0
- package/dist/dataGridFilterableCombobox.js +1 -0
- package/dist/dataGridFormulaOptions.d.ts +1 -0
- package/dist/dataGridFormulaOptions.js +1 -0
- package/dist/dataGridGantt.d.ts +3 -0
- package/dist/dataGridGantt.js +1 -0
- package/dist/dataGridGanttDependencySelection.d.ts +7 -0
- package/dist/dataGridGanttDependencySelection.js +46 -0
- package/dist/dataGridGanttLabel.d.ts +2 -0
- package/dist/dataGridGanttLabel.js +30 -0
- package/dist/dataGridGanttSplit.d.ts +20 -0
- package/dist/dataGridGanttSplit.js +31 -0
- package/dist/dataGridGanttWheel.d.ts +10 -0
- package/dist/dataGridGanttWheel.js +30 -0
- package/dist/dataGridOverlayThemeVars.d.ts +1 -0
- package/dist/dataGridOverlayThemeVars.js +32 -0
- package/dist/dataGridPublicProps.d.ts +1 -0
- package/dist/dataGridPublicProps.js +1 -0
- package/dist/dataGridTableStage.types.d.ts +1 -0
- package/dist/dataGridTableStage.types.js +1 -0
- package/dist/dataGridTableStageBody.types.d.ts +1 -0
- package/dist/dataGridTableStageBody.types.js +1 -0
- package/dist/dataGridTableStageContext.d.ts +1 -0
- package/dist/dataGridTableStageContext.js +1 -0
- package/dist/dataGridTheme.d.ts +1 -0
- package/dist/dataGridTheme.js +1 -0
- package/dist/dataGridVirtualization.d.ts +1 -0
- package/dist/dataGridVirtualization.js +1 -0
- package/dist/ensureDataGridAppStyles.d.ts +1 -0
- package/dist/ensureDataGridAppStyles.js +1 -0
- package/dist/gantt/dataGridGantt.d.ts +3 -0
- package/dist/gantt/dataGridGantt.js +1 -0
- package/dist/gantt/dataGridGanttDependencySelection.d.ts +7 -0
- package/dist/gantt/dataGridGanttDependencySelection.js +46 -0
- package/dist/gantt/dataGridGanttLabel.d.ts +2 -0
- package/dist/gantt/dataGridGanttLabel.js +30 -0
- package/dist/gantt/dataGridGanttSplit.d.ts +20 -0
- package/dist/gantt/dataGridGanttSplit.js +31 -0
- package/dist/gantt/dataGridGanttWheel.d.ts +10 -0
- package/dist/gantt/dataGridGanttWheel.js +30 -0
- package/dist/host/DataGridDefaultRenderer.d.ts +298 -0
- package/dist/host/DataGridDefaultRenderer.js +1847 -0
- package/dist/host/DataGridModuleHost.d.ts +24 -0
- package/dist/host/DataGridModuleHost.js +23 -0
- package/dist/host/DataGridRuntimeHost.d.ts +104 -0
- package/dist/host/DataGridRuntimeHost.js +174 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +4 -0
- package/dist/internal.d.ts +21 -0
- package/dist/internal.js +14 -0
- package/dist/overlays/dataGridCellComboboxState.d.ts +10 -0
- package/dist/overlays/dataGridCellComboboxState.js +67 -0
- package/dist/overlays/dataGridColumnMenu.d.ts +47 -0
- package/dist/overlays/dataGridColumnMenu.js +190 -0
- package/dist/overlays/dataGridContextMenu.d.ts +80 -0
- package/dist/overlays/dataGridContextMenu.js +218 -0
- package/dist/overlays/dataGridFilterableCombobox.d.ts +5 -0
- package/dist/overlays/dataGridFilterableCombobox.js +74 -0
- package/dist/overlays/dataGridOverlayThemeVars.d.ts +1 -0
- package/dist/overlays/dataGridOverlayThemeVars.js +32 -0
- package/dist/stage/dataGridTableStage.types.d.ts +160 -0
- package/dist/stage/dataGridTableStage.types.js +1 -0
- package/dist/stage/dataGridTableStageBody.types.d.ts +105 -0
- package/dist/stage/dataGridTableStageBody.types.js +1 -0
- package/dist/stage/dataGridTableStageContext.d.ts +45 -0
- package/dist/stage/dataGridTableStageContext.js +88 -0
- package/dist/stage/useDataGridTableStageBindings.d.ts +11 -0
- package/dist/stage/useDataGridTableStageBindings.js +162 -0
- package/dist/stage/useDataGridTableStageCellIo.d.ts +28 -0
- package/dist/stage/useDataGridTableStageCellIo.js +62 -0
- package/dist/stage/useDataGridTableStageColumns.d.ts +22 -0
- package/dist/stage/useDataGridTableStageColumns.js +124 -0
- package/dist/stage/useDataGridTableStageFillAction.d.ts +19 -0
- package/dist/stage/useDataGridTableStageFillAction.js +28 -0
- package/dist/stage/useDataGridTableStageHistory.d.ts +31 -0
- package/dist/stage/useDataGridTableStageHistory.js +46 -0
- package/dist/stage/useDataGridTableStageRowSelection.d.ts +28 -0
- package/dist/stage/useDataGridTableStageRowSelection.js +107 -0
- package/dist/stage/useDataGridTableStageRuntime.d.ts +92 -0
- package/dist/stage/useDataGridTableStageRuntime.js +526 -0
- package/dist/stage/useDataGridTableStageScrollSync.d.ts +17 -0
- package/dist/stage/useDataGridTableStageScrollSync.js +49 -0
- package/dist/stage/useDataGridTableStageViewportKeyboard.d.ts +20 -0
- package/dist/stage/useDataGridTableStageViewportKeyboard.js +58 -0
- package/dist/stage/useDataGridTableStageVisualSelection.d.ts +24 -0
- package/dist/stage/useDataGridTableStageVisualSelection.js +83 -0
- package/dist/theme/dataGridTheme.d.ts +6 -0
- package/dist/theme/dataGridTheme.js +84 -0
- package/dist/theme/ensureDataGridAppStyles.d.ts +1 -0
- package/dist/theme/ensureDataGridAppStyles.js +2656 -0
- package/dist/useDataGridAppControlledState.d.ts +59 -0
- package/dist/useDataGridAppControlledState.js +390 -0
- package/dist/useDataGridAppRowModel.d.ts +14 -0
- package/dist/useDataGridAppRowModel.js +85 -0
- package/dist/useDataGridTableStageBindings.d.ts +1 -0
- package/dist/useDataGridTableStageBindings.js +1 -0
- package/dist/useDataGridTableStageCellIo.d.ts +28 -0
- package/dist/useDataGridTableStageCellIo.js +62 -0
- package/dist/useDataGridTableStageColumns.d.ts +21 -0
- package/dist/useDataGridTableStageColumns.js +122 -0
- package/dist/useDataGridTableStageFillAction.d.ts +19 -0
- package/dist/useDataGridTableStageFillAction.js +28 -0
- package/dist/useDataGridTableStageHistory.d.ts +31 -0
- package/dist/useDataGridTableStageHistory.js +46 -0
- package/dist/useDataGridTableStageRowSelection.d.ts +28 -0
- package/dist/useDataGridTableStageRowSelection.js +103 -0
- package/dist/useDataGridTableStageRuntime.d.ts +1 -0
- package/dist/useDataGridTableStageRuntime.js +1 -0
- package/dist/useDataGridTableStageScrollSync.d.ts +17 -0
- package/dist/useDataGridTableStageScrollSync.js +49 -0
- package/dist/useDataGridTableStageViewportKeyboard.d.ts +20 -0
- package/dist/useDataGridTableStageViewportKeyboard.js +58 -0
- package/dist/useDataGridTableStageVisualSelection.d.ts +24 -0
- package/dist/useDataGridTableStageVisualSelection.js +70 -0
- package/package.json +55 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import type { ComponentPublicInstance, CSSProperties, Ref } from "vue";
|
|
2
|
+
import type { DataGridColumnPin, DataGridColumnSnapshot, DataGridOverlayRange, DataGridRowNode } from "@affino/datagrid-vue";
|
|
3
|
+
import type { DataGridFillBehavior } from "@affino/datagrid-vue/advanced";
|
|
4
|
+
import type { DataGridColumnMenuActionOptions, DataGridColumnMenuDisabledReasons, DataGridColumnMenuItemKey, DataGridColumnMenuItemLabels } from "../overlays/dataGridColumnMenu";
|
|
5
|
+
export type DataGridTableMode = "base" | "tree" | "pivot" | "worker";
|
|
6
|
+
export type DataGridPendingEdge = "top" | "right" | "bottom" | "left";
|
|
7
|
+
export type DataGridTableRow<TRow extends Record<string, unknown>> = DataGridRowNode<TRow>;
|
|
8
|
+
export type DataGridElementRefHandler = (value: Element | ComponentPublicInstance | null) => void;
|
|
9
|
+
export type DataGridMaybeRef<T> = T | Ref<T>;
|
|
10
|
+
export type DataGridTableStageCellClass = string | readonly string[] | Readonly<Record<string, boolean>>;
|
|
11
|
+
export interface DataGridTableStageAnchorCell {
|
|
12
|
+
rowIndex: number;
|
|
13
|
+
columnIndex: number;
|
|
14
|
+
}
|
|
15
|
+
export interface DataGridTableStageLayoutSection {
|
|
16
|
+
gridContentStyle: CSSProperties;
|
|
17
|
+
mainTrackStyle: CSSProperties;
|
|
18
|
+
indexColumnStyle: CSSProperties;
|
|
19
|
+
columnStyle: (key: string) => CSSProperties;
|
|
20
|
+
}
|
|
21
|
+
export interface DataGridTableStageViewportSection {
|
|
22
|
+
topSpacerHeight: number;
|
|
23
|
+
bottomSpacerHeight: number;
|
|
24
|
+
viewportRowStart: number;
|
|
25
|
+
columnWindowStart: number;
|
|
26
|
+
leftColumnSpacerWidth: number;
|
|
27
|
+
rightColumnSpacerWidth: number;
|
|
28
|
+
headerViewportRef: DataGridElementRefHandler;
|
|
29
|
+
bodyViewportRef: DataGridElementRefHandler;
|
|
30
|
+
handleHeaderWheel: (event: WheelEvent) => void;
|
|
31
|
+
handleHeaderScroll: (event: Event) => void;
|
|
32
|
+
handleViewportScroll: (event: Event) => void;
|
|
33
|
+
handleViewportKeydown: (event: KeyboardEvent) => void;
|
|
34
|
+
}
|
|
35
|
+
export interface DataGridTableStageColumnsSection {
|
|
36
|
+
visibleColumns: readonly DataGridColumnSnapshot[];
|
|
37
|
+
renderedColumns: readonly DataGridColumnSnapshot[];
|
|
38
|
+
columnFilterTextByKey: Readonly<Record<string, string>>;
|
|
39
|
+
toggleSortForColumn: (columnKey: string, additive?: boolean) => void;
|
|
40
|
+
sortIndicator: (columnKey: string) => string;
|
|
41
|
+
setColumnFilterText: (columnKey: string, value: string) => void;
|
|
42
|
+
columnMenuEnabled?: boolean;
|
|
43
|
+
columnMenuValueFilterEnabled?: boolean;
|
|
44
|
+
columnMenuValueFilterRowLimit?: number;
|
|
45
|
+
columnMenuMaxFilterValues?: number;
|
|
46
|
+
resolveColumnMenuItems?: (columnKey: string) => readonly DataGridColumnMenuItemKey[];
|
|
47
|
+
resolveColumnMenuDisabledItems?: (columnKey: string) => readonly DataGridColumnMenuItemKey[];
|
|
48
|
+
resolveColumnMenuDisabledReasons?: (columnKey: string) => DataGridColumnMenuDisabledReasons;
|
|
49
|
+
resolveColumnMenuLabels?: (columnKey: string) => DataGridColumnMenuItemLabels;
|
|
50
|
+
resolveColumnMenuActionOptions?: (columnKey: string) => DataGridColumnMenuActionOptions;
|
|
51
|
+
isColumnFilterActive?: (columnKey: string) => boolean;
|
|
52
|
+
isColumnGrouped?: (columnKey: string) => boolean;
|
|
53
|
+
resolveColumnGroupOrder?: (columnKey: string) => number | null;
|
|
54
|
+
resolveColumnMenuSortDirection?: (columnKey: string) => "asc" | "desc" | null;
|
|
55
|
+
resolveColumnMenuSelectedTokens?: (columnKey: string) => readonly string[];
|
|
56
|
+
applyColumnMenuSort?: (columnKey: string, direction: "asc" | "desc" | null) => void;
|
|
57
|
+
applyColumnMenuPin?: (columnKey: string, pin: DataGridColumnPin) => void;
|
|
58
|
+
applyColumnMenuGroupBy?: (columnKey: string, grouped: boolean) => void;
|
|
59
|
+
applyColumnMenuFilter?: (columnKey: string, tokens: readonly string[]) => void;
|
|
60
|
+
clearColumnMenuFilter?: (columnKey: string) => void;
|
|
61
|
+
startResize: (event: MouseEvent, columnKey: string) => void;
|
|
62
|
+
handleResizeDoubleClick: (event: MouseEvent, columnKey: string) => void;
|
|
63
|
+
}
|
|
64
|
+
export interface DataGridTableStageRowsSection<TRow extends Record<string, unknown>> {
|
|
65
|
+
displayRows: readonly DataGridTableRow<TRow>[];
|
|
66
|
+
pinnedBottomRows: readonly DataGridTableRow<TRow>[];
|
|
67
|
+
sourceRows?: readonly TRow[];
|
|
68
|
+
showRowIndex?: boolean;
|
|
69
|
+
rowHover?: boolean;
|
|
70
|
+
stripedRows?: boolean;
|
|
71
|
+
rowClass: (row: DataGridTableRow<TRow>) => string;
|
|
72
|
+
isRowAutosizeProbe: (row: DataGridTableRow<TRow>, rowOffset: number) => boolean;
|
|
73
|
+
rowStyle: (row: DataGridTableRow<TRow>, rowOffset: number) => CSSProperties;
|
|
74
|
+
isRowInPendingClipboardCut?: (row: DataGridTableRow<TRow>) => boolean;
|
|
75
|
+
isRowFocused?: (row: DataGridTableRow<TRow>) => boolean;
|
|
76
|
+
isRowCheckboxSelected?: (row: DataGridTableRow<TRow>) => boolean;
|
|
77
|
+
allVisibleRowsSelected?: boolean;
|
|
78
|
+
someVisibleRowsSelected?: boolean;
|
|
79
|
+
handleRowClick?: (row: DataGridTableRow<TRow>) => void;
|
|
80
|
+
handleRowIndexClick?: (row: DataGridTableRow<TRow>, rowOffset: number, extend: boolean) => void;
|
|
81
|
+
handleRowIndexKeydown?: (event: KeyboardEvent, row: DataGridTableRow<TRow>, rowOffset: number) => void;
|
|
82
|
+
handleToggleAllVisibleRows?: () => void;
|
|
83
|
+
toggleGroupRow: (row: DataGridTableRow<TRow>) => void;
|
|
84
|
+
rowIndexLabel: (row: DataGridTableRow<TRow>, rowOffset: number) => string;
|
|
85
|
+
startRowResize: (event: MouseEvent, row: DataGridTableRow<TRow>, rowOffset: number) => void;
|
|
86
|
+
autosizeRow: (event: MouseEvent, row: DataGridTableRow<TRow>, rowOffset: number) => void;
|
|
87
|
+
}
|
|
88
|
+
export interface DataGridTableStageSelectionSection {
|
|
89
|
+
selectionRange: DataGridOverlayRange | null;
|
|
90
|
+
selectionAnchorCell?: DataGridTableStageAnchorCell | null;
|
|
91
|
+
fillPreviewRange: DataGridOverlayRange | null;
|
|
92
|
+
rangeMovePreviewRange: DataGridOverlayRange | null;
|
|
93
|
+
isFillDragging: boolean;
|
|
94
|
+
isRangeMoving: boolean;
|
|
95
|
+
fillActionAnchorCell?: DataGridTableStageAnchorCell | null;
|
|
96
|
+
fillActionBehavior?: DataGridFillBehavior | null;
|
|
97
|
+
applyFillActionBehavior: (behavior: DataGridFillBehavior) => void;
|
|
98
|
+
isFillHandleCell: (rowOffset: number, columnIndex: number) => boolean;
|
|
99
|
+
startFillHandleDrag: (event: MouseEvent) => void;
|
|
100
|
+
startFillHandleDoubleClick: (event: MouseEvent) => void;
|
|
101
|
+
}
|
|
102
|
+
export interface DataGridTableStageEditingSection<TRow extends Record<string, unknown>> {
|
|
103
|
+
editingCellValue: string;
|
|
104
|
+
editingCellInitialFilter: string;
|
|
105
|
+
editingCellOpenOnMount: boolean;
|
|
106
|
+
isEditingCell: (row: DataGridTableRow<TRow>, columnKey: string) => boolean;
|
|
107
|
+
startInlineEdit: (row: DataGridTableRow<TRow>, columnKey: string, options?: {
|
|
108
|
+
draftValue?: string;
|
|
109
|
+
openOnMount?: boolean;
|
|
110
|
+
}) => void;
|
|
111
|
+
updateEditingCellValue: (value: string) => void;
|
|
112
|
+
handleEditorKeydown: (event: KeyboardEvent) => void;
|
|
113
|
+
commitInlineEdit: (target?: "stay" | "next" | "previous") => void;
|
|
114
|
+
cancelInlineEdit: () => void;
|
|
115
|
+
}
|
|
116
|
+
export interface DataGridTableStageCellsSection<TRow extends Record<string, unknown>> {
|
|
117
|
+
cellClass?: (row: DataGridTableRow<TRow>, rowOffset: number, column: DataGridColumnSnapshot, columnIndex: number) => DataGridTableStageCellClass | null | undefined;
|
|
118
|
+
cellStyle?: (row: DataGridTableRow<TRow>, rowOffset: number, column: DataGridColumnSnapshot, columnIndex: number) => CSSProperties | null | undefined;
|
|
119
|
+
isCellSelected: (rowOffset: number, columnIndex: number) => boolean;
|
|
120
|
+
isSelectionAnchorCell: (rowOffset: number, columnIndex: number) => boolean;
|
|
121
|
+
shouldHighlightSelectedCell: (rowOffset: number, columnIndex: number) => boolean;
|
|
122
|
+
isCellOnSelectionEdge: (rowOffset: number, columnIndex: number, edge: DataGridPendingEdge) => boolean;
|
|
123
|
+
isCellInFillPreview: (rowOffset: number, columnIndex: number) => boolean;
|
|
124
|
+
isCellInPendingClipboardRange: (rowOffset: number, columnIndex: number) => boolean;
|
|
125
|
+
isCellOnPendingClipboardEdge: (rowOffset: number, columnIndex: number, edge: DataGridPendingEdge) => boolean;
|
|
126
|
+
isCellEditable: (row: DataGridTableRow<TRow>, rowOffset: number, column: DataGridColumnSnapshot, columnIndex: number) => boolean;
|
|
127
|
+
readCell: (row: DataGridTableRow<TRow>, columnKey: string) => string;
|
|
128
|
+
readDisplayCell: (row: DataGridTableRow<TRow>, columnKey: string) => string;
|
|
129
|
+
}
|
|
130
|
+
export interface DataGridTableStageInteractionSection<TRow extends Record<string, unknown>> {
|
|
131
|
+
handleCellMouseDown: (event: MouseEvent, row: DataGridTableRow<TRow>, rowOffset: number, columnIndex: number) => void;
|
|
132
|
+
handleCellClick: (row: DataGridTableRow<TRow>, rowOffset: number, column: DataGridColumnSnapshot, columnIndex: number) => void;
|
|
133
|
+
handleCellKeydown: (event: KeyboardEvent, row: DataGridTableRow<TRow>, rowOffset: number, columnIndex: number) => void;
|
|
134
|
+
}
|
|
135
|
+
export interface DataGridTableStageSectionedProps<TRow extends Record<string, unknown>> {
|
|
136
|
+
layout: DataGridTableStageLayoutSection;
|
|
137
|
+
viewport: DataGridTableStageViewportSection;
|
|
138
|
+
columns: DataGridTableStageColumnsSection;
|
|
139
|
+
rows: DataGridTableStageRowsSection<TRow>;
|
|
140
|
+
selection: DataGridTableStageSelectionSection;
|
|
141
|
+
editing: DataGridTableStageEditingSection<TRow>;
|
|
142
|
+
cells: DataGridTableStageCellsSection<TRow>;
|
|
143
|
+
interaction: DataGridTableStageInteractionSection<TRow>;
|
|
144
|
+
}
|
|
145
|
+
export interface DataGridTableStageProps<TRow extends Record<string, unknown>> extends DataGridTableStageSectionedProps<TRow> {
|
|
146
|
+
mode: DataGridTableMode;
|
|
147
|
+
rowHeightMode: "fixed" | "auto";
|
|
148
|
+
}
|
|
149
|
+
interface DataGridTableStageBindingsSource<TRow extends Record<string, unknown>> extends DataGridTableStageLayoutSection, DataGridTableStageViewportSection, DataGridTableStageColumnsSection, DataGridTableStageRowsSection<TRow>, DataGridTableStageSelectionSection, DataGridTableStageEditingSection<TRow>, DataGridTableStageCellsSection<TRow>, DataGridTableStageInteractionSection<TRow> {
|
|
150
|
+
mode: DataGridTableMode;
|
|
151
|
+
rowHeightMode: "fixed" | "auto";
|
|
152
|
+
}
|
|
153
|
+
export interface UseDataGridTableStageBindingsOptions<TRow extends Record<string, unknown>> extends Omit<{
|
|
154
|
+
[K in keyof DataGridTableStageBindingsSource<TRow>]: DataGridMaybeRef<DataGridTableStageBindingsSource<TRow>[K]>;
|
|
155
|
+
}, "editingCellValue" | "headerViewportRef" | "bodyViewportRef" | "updateEditingCellValue"> {
|
|
156
|
+
editingCellValueRef: Ref<string>;
|
|
157
|
+
headerViewportRef: Ref<HTMLElement | null>;
|
|
158
|
+
bodyViewportRef: Ref<HTMLElement | null>;
|
|
159
|
+
}
|
|
160
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { ComponentPublicInstance, CSSProperties } from "vue";
|
|
2
|
+
import type { DataGridColumnSnapshot } from "@affino/datagrid-vue";
|
|
3
|
+
import type { DataGridFilterableComboboxOption } from "../overlays/dataGridFilterableCombobox";
|
|
4
|
+
import type { DataGridTableRow } from "./dataGridTableStage.types";
|
|
5
|
+
export type DataGridTableStageBodyRow = DataGridTableRow<Record<string, unknown>>;
|
|
6
|
+
export type DataGridTableStageBodyColumn = DataGridColumnSnapshot & {
|
|
7
|
+
column: DataGridColumnSnapshot["column"] & {
|
|
8
|
+
presentation?: {
|
|
9
|
+
align?: "left" | "center" | "right";
|
|
10
|
+
headerAlign?: "left" | "center" | "right";
|
|
11
|
+
};
|
|
12
|
+
capabilities?: {
|
|
13
|
+
editable?: boolean;
|
|
14
|
+
sortable?: boolean;
|
|
15
|
+
filterable?: boolean;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type DataGridTableStageOverlaySegment = {
|
|
20
|
+
key: string;
|
|
21
|
+
style: CSSProperties;
|
|
22
|
+
};
|
|
23
|
+
export type DataGridTableStageSelectEditorOption = {
|
|
24
|
+
label: string;
|
|
25
|
+
value: string;
|
|
26
|
+
};
|
|
27
|
+
export type DataGridTableStageSelectEditorOptionsLoader = (query: string) => Promise<readonly DataGridTableStageSelectEditorOption[]>;
|
|
28
|
+
export interface DataGridTableStageBodyRenderApiBase {
|
|
29
|
+
absoluteRowIndex: (row: DataGridTableStageBodyRow, rowOffset: number) => number;
|
|
30
|
+
viewportRowOffset: (row: DataGridTableStageBodyRow, rowOffset: number) => number;
|
|
31
|
+
rowStateClasses: (row: DataGridTableStageBodyRow, rowOffset: number) => Record<string, boolean>;
|
|
32
|
+
handleRowContainerClick: (row: DataGridTableStageBodyRow) => void;
|
|
33
|
+
setHoveredRow: (row: DataGridTableStageBodyRow, rowOffset: number) => void;
|
|
34
|
+
builtInCellClasses: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn) => Record<string, boolean>;
|
|
35
|
+
cellStateClasses: (row: DataGridTableStageBodyRow, rowOffset: number, columnIndex: number) => Record<string, boolean>;
|
|
36
|
+
resolveCellCustomClass: (row: DataGridTableStageBodyRow, rowOffset: number, column: DataGridTableStageBodyColumn, columnIndex: number) => unknown;
|
|
37
|
+
columnStyle: (key: string) => CSSProperties;
|
|
38
|
+
bodyCellPresentationStyle: (column: DataGridTableStageBodyColumn) => CSSProperties;
|
|
39
|
+
bodyCellSelectionStyle: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn, rowOffset: number, columnIndex: number) => CSSProperties;
|
|
40
|
+
resolveCellCustomStyle: (row: DataGridTableStageBodyRow, rowOffset: number, column: DataGridTableStageBodyColumn, columnIndex: number) => CSSProperties;
|
|
41
|
+
columnIndexByKey: (columnKey: string) => number;
|
|
42
|
+
cellTabIndex: (rowOffset: number, columnIndex: number) => number;
|
|
43
|
+
checkboxCellRole: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn) => string | undefined;
|
|
44
|
+
checkboxCellAriaChecked: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn) => "true" | "false" | undefined;
|
|
45
|
+
handleCellMouseDown: (event: MouseEvent, row: DataGridTableStageBodyRow, rowOffset: number, columnIndex: number) => void;
|
|
46
|
+
handleBodyCellClick: (event: MouseEvent, row: DataGridTableStageBodyRow, rowOffset: number, column: DataGridTableStageBodyColumn, columnIndex: number) => void;
|
|
47
|
+
handleCellMouseMove: (event: MouseEvent, rowOffset: number, columnIndex: number) => void;
|
|
48
|
+
clearRangeMoveHandleHover: () => void;
|
|
49
|
+
handleCellKeydown: (event: KeyboardEvent, row: DataGridTableStageBodyRow, rowOffset: number, columnIndex: number) => void;
|
|
50
|
+
startInlineEditIfAllowed: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn, rowOffset: number) => void;
|
|
51
|
+
isCellEditableSafe: (row: DataGridTableStageBodyRow, rowOffset: number, column: DataGridTableStageBodyColumn, columnIndex: number) => boolean;
|
|
52
|
+
isFillHandleCellSafe: (rowOffset: number, columnIndex: number) => boolean;
|
|
53
|
+
isEditingCellSafe: (row: DataGridTableStageBodyRow, columnKey: string) => boolean;
|
|
54
|
+
handleFillHandleMouseDown: (event: MouseEvent) => void;
|
|
55
|
+
handleFillHandleDoubleClick: (event: MouseEvent) => void;
|
|
56
|
+
isSelectEditorCell: (row: DataGridTableStageBodyRow, rowOffset: number, column: DataGridTableStageBodyColumn, columnIndex: number) => boolean;
|
|
57
|
+
resolveSelectEditorValue: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn) => string;
|
|
58
|
+
resolveSelectEditorOptions: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn) => readonly DataGridTableStageSelectEditorOption[];
|
|
59
|
+
resolveSelectEditorOptionsLoader: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn) => DataGridTableStageSelectEditorOptionsLoader | undefined;
|
|
60
|
+
handleSelectEditorCommit: (value: string, target?: "stay" | "next" | "previous") => void;
|
|
61
|
+
handleSelectEditorCancel: () => void;
|
|
62
|
+
handleSelectEditorOptionsResolved: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn, options: ReadonlyArray<DataGridFilterableComboboxOption>) => void;
|
|
63
|
+
isDateEditorCell: (row: DataGridTableStageBodyRow, rowOffset: number, column: DataGridTableStageBodyColumn, columnIndex: number) => boolean;
|
|
64
|
+
resolveDateEditorInputType: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn) => "date" | "datetime-local";
|
|
65
|
+
handleDateEditorChange: (value: string, target?: "stay" | "next" | "previous") => void;
|
|
66
|
+
isTextEditorCell: (row: DataGridTableStageBodyRow, rowOffset: number, column: DataGridTableStageBodyColumn, columnIndex: number) => boolean;
|
|
67
|
+
updateEditingCellValue: (value: string) => void;
|
|
68
|
+
handleEditorKeydown: (event: KeyboardEvent) => void;
|
|
69
|
+
handleTextEditorBlur: () => void;
|
|
70
|
+
shouldRenderCheckboxCell: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn) => boolean;
|
|
71
|
+
checkboxIndicatorClass: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn) => Record<string, boolean>;
|
|
72
|
+
checkboxIndicatorMarkClass: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn) => Record<string, boolean>;
|
|
73
|
+
readResolvedDisplayCell: (row: DataGridTableStageBodyRow, column: DataGridTableStageBodyColumn) => string;
|
|
74
|
+
}
|
|
75
|
+
export interface DataGridTableStageCenterPaneRenderApi extends DataGridTableStageBodyRenderApiBase {
|
|
76
|
+
handleCenterViewportScroll: (event: Event) => void;
|
|
77
|
+
handleBodyViewportWheel: (event: WheelEvent) => void;
|
|
78
|
+
handleViewportKeydown: (event: KeyboardEvent) => void;
|
|
79
|
+
spacerStyle: (width: number) => CSSProperties;
|
|
80
|
+
}
|
|
81
|
+
export interface DataGridTableStagePinnedPaneProps {
|
|
82
|
+
side: "left" | "right";
|
|
83
|
+
width: number;
|
|
84
|
+
style: CSSProperties;
|
|
85
|
+
contentStyle: CSSProperties;
|
|
86
|
+
contentRef?: (value: Element | ComponentPublicInstance | null) => void;
|
|
87
|
+
columns: readonly DataGridTableStageBodyColumn[];
|
|
88
|
+
showIndexColumn: boolean;
|
|
89
|
+
displayRows: readonly DataGridTableStageBodyRow[];
|
|
90
|
+
topSpacerHeight?: number;
|
|
91
|
+
bottomSpacerHeight?: number;
|
|
92
|
+
selectionOverlaySegments: readonly DataGridTableStageOverlaySegment[];
|
|
93
|
+
fillPreviewOverlaySegments: readonly DataGridTableStageOverlaySegment[];
|
|
94
|
+
movePreviewOverlaySegments: readonly DataGridTableStageOverlaySegment[];
|
|
95
|
+
}
|
|
96
|
+
export interface DataGridTableStagePinnedPaneRenderApi extends DataGridTableStageBodyRenderApiBase {
|
|
97
|
+
handleLinkedViewportWheel: (event: WheelEvent) => void;
|
|
98
|
+
paneRowStyle: (row: DataGridTableStageBodyRow, rowOffset: number, paneWidth: number) => CSSProperties;
|
|
99
|
+
isFullRowSelectionSafe: (rowOffset: number) => boolean;
|
|
100
|
+
rowIndexColumnStyle: CSSProperties;
|
|
101
|
+
rowIndexCellStyle: (row: DataGridTableStageBodyRow, rowOffset: number) => CSSProperties;
|
|
102
|
+
rowIndexTabIndex: (row: DataGridTableStageBodyRow) => number;
|
|
103
|
+
handleRowIndexClickSafe: (row: DataGridTableStageBodyRow, rowOffset: number, event: MouseEvent) => void;
|
|
104
|
+
handleRowIndexKeydown: (event: KeyboardEvent, row: DataGridTableStageBodyRow, rowOffset: number) => void;
|
|
105
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type InjectionKey, type Ref } from "vue";
|
|
2
|
+
import type { DataGridTableStageProps } from "./dataGridTableStage.types";
|
|
3
|
+
export type DataGridTableStageSectionKey = "layout" | "viewport" | "columns" | "rows" | "selection" | "editing" | "cells" | "interaction";
|
|
4
|
+
export interface DataGridTableStageContext<TRow extends Record<string, unknown>> {
|
|
5
|
+
mode: Readonly<Ref<DataGridTableStageProps<TRow>["mode"]>>;
|
|
6
|
+
rowHeightMode: Readonly<Ref<DataGridTableStageProps<TRow>["rowHeightMode"]>>;
|
|
7
|
+
layout: Readonly<Ref<DataGridTableStageProps<TRow>["layout"]>>;
|
|
8
|
+
viewport: Readonly<Ref<DataGridTableStageProps<TRow>["viewport"]>>;
|
|
9
|
+
columns: Readonly<Ref<DataGridTableStageProps<TRow>["columns"]>>;
|
|
10
|
+
rows: Readonly<Ref<DataGridTableStageProps<TRow>["rows"]>>;
|
|
11
|
+
selection: Readonly<Ref<DataGridTableStageProps<TRow>["selection"]>>;
|
|
12
|
+
editing: Readonly<Ref<DataGridTableStageProps<TRow>["editing"]>>;
|
|
13
|
+
cells: Readonly<Ref<DataGridTableStageProps<TRow>["cells"]>>;
|
|
14
|
+
interaction: Readonly<Ref<DataGridTableStageProps<TRow>["interaction"]>>;
|
|
15
|
+
}
|
|
16
|
+
export interface DataGridTableStageContextSource<TRow extends Record<string, unknown>> {
|
|
17
|
+
mode: Ref<DataGridTableStageProps<TRow>["mode"]>;
|
|
18
|
+
rowHeightMode: Ref<DataGridTableStageProps<TRow>["rowHeightMode"]>;
|
|
19
|
+
layout: Ref<DataGridTableStageProps<TRow>["layout"]>;
|
|
20
|
+
viewport: Ref<DataGridTableStageProps<TRow>["viewport"]>;
|
|
21
|
+
columns: Ref<DataGridTableStageProps<TRow>["columns"]>;
|
|
22
|
+
rows: Ref<DataGridTableStageProps<TRow>["rows"]>;
|
|
23
|
+
selection: Ref<DataGridTableStageProps<TRow>["selection"]>;
|
|
24
|
+
editing: Ref<DataGridTableStageProps<TRow>["editing"]>;
|
|
25
|
+
cells: Ref<DataGridTableStageProps<TRow>["cells"]>;
|
|
26
|
+
interaction: Ref<DataGridTableStageProps<TRow>["interaction"]>;
|
|
27
|
+
}
|
|
28
|
+
export type AnyDataGridTableStageContext = DataGridTableStageContext<Record<string, unknown>>;
|
|
29
|
+
export declare const dataGridTableStageContextKey: InjectionKey<AnyDataGridTableStageContext>;
|
|
30
|
+
export declare function createDataGridTableStageContext<TRow extends Record<string, unknown>>(source: DataGridTableStageContextSource<TRow>): DataGridTableStageContext<TRow>;
|
|
31
|
+
export declare function createDataGridTableStageContextFromProps<TRow extends Record<string, unknown>>(props: DataGridTableStageProps<TRow>): DataGridTableStageContext<TRow>;
|
|
32
|
+
export declare function materializeDataGridTableStagePropsFromContext<TRow extends Record<string, unknown>>(context: DataGridTableStageContext<TRow>): DataGridTableStageProps<TRow>;
|
|
33
|
+
export declare function provideDataGridTableStageContext<TRow extends Record<string, unknown>>(context: DataGridTableStageContext<TRow>): DataGridTableStageContext<TRow>;
|
|
34
|
+
export declare function useDataGridTableStageContext<TRow extends Record<string, unknown>>(): DataGridTableStageContext<TRow>;
|
|
35
|
+
export declare function useDataGridTableStageMode<TRow extends Record<string, unknown>>(): Readonly<Ref<import("./dataGridTableStage.types").DataGridTableMode>>;
|
|
36
|
+
export declare function useDataGridTableStageRowHeightMode<TRow extends Record<string, unknown>>(): Readonly<Ref<"fixed" | "auto">>;
|
|
37
|
+
export declare function useDataGridTableStageSection<TRow extends Record<string, unknown>, TSectionKey extends DataGridTableStageSectionKey>(sectionKey: TSectionKey): DataGridTableStageContext<TRow>[TSectionKey];
|
|
38
|
+
export declare function useDataGridTableStageLayoutSection<TRow extends Record<string, unknown>>(): Readonly<Ref<import("./dataGridTableStage.types").DataGridTableStageLayoutSection>>;
|
|
39
|
+
export declare function useDataGridTableStageViewportSection<TRow extends Record<string, unknown>>(): Readonly<Ref<import("./dataGridTableStage.types").DataGridTableStageViewportSection>>;
|
|
40
|
+
export declare function useDataGridTableStageColumnsSection<TRow extends Record<string, unknown>>(): Readonly<Ref<import("./dataGridTableStage.types").DataGridTableStageColumnsSection>>;
|
|
41
|
+
export declare function useDataGridTableStageRowsSection<TRow extends Record<string, unknown>>(): Readonly<Ref<import("./dataGridTableStage.types").DataGridTableStageRowsSection<TRow>>>;
|
|
42
|
+
export declare function useDataGridTableStageSelectionSection<TRow extends Record<string, unknown>>(): Readonly<Ref<import("./dataGridTableStage.types").DataGridTableStageSelectionSection>>;
|
|
43
|
+
export declare function useDataGridTableStageEditingSection<TRow extends Record<string, unknown>>(): Readonly<Ref<import("./dataGridTableStage.types").DataGridTableStageEditingSection<TRow>>>;
|
|
44
|
+
export declare function useDataGridTableStageCellsSection<TRow extends Record<string, unknown>>(): Readonly<Ref<import("./dataGridTableStage.types").DataGridTableStageCellsSection<TRow>>>;
|
|
45
|
+
export declare function useDataGridTableStageInteractionSection<TRow extends Record<string, unknown>>(): Readonly<Ref<import("./dataGridTableStage.types").DataGridTableStageInteractionSection<TRow>>>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { inject, provide, toRef, } from "vue";
|
|
2
|
+
export const dataGridTableStageContextKey = Symbol("data-grid-table-stage-context");
|
|
3
|
+
export function createDataGridTableStageContext(source) {
|
|
4
|
+
return {
|
|
5
|
+
mode: source.mode,
|
|
6
|
+
rowHeightMode: source.rowHeightMode,
|
|
7
|
+
layout: source.layout,
|
|
8
|
+
viewport: source.viewport,
|
|
9
|
+
columns: source.columns,
|
|
10
|
+
rows: source.rows,
|
|
11
|
+
selection: source.selection,
|
|
12
|
+
editing: source.editing,
|
|
13
|
+
cells: source.cells,
|
|
14
|
+
interaction: source.interaction,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function createDataGridTableStageContextFromProps(props) {
|
|
18
|
+
return createDataGridTableStageContext({
|
|
19
|
+
mode: toRef(props, "mode"),
|
|
20
|
+
rowHeightMode: toRef(props, "rowHeightMode"),
|
|
21
|
+
layout: toRef(props, "layout"),
|
|
22
|
+
viewport: toRef(props, "viewport"),
|
|
23
|
+
columns: toRef(props, "columns"),
|
|
24
|
+
rows: toRef(props, "rows"),
|
|
25
|
+
selection: toRef(props, "selection"),
|
|
26
|
+
editing: toRef(props, "editing"),
|
|
27
|
+
cells: toRef(props, "cells"),
|
|
28
|
+
interaction: toRef(props, "interaction"),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export function materializeDataGridTableStagePropsFromContext(context) {
|
|
32
|
+
return {
|
|
33
|
+
mode: context.mode.value,
|
|
34
|
+
rowHeightMode: context.rowHeightMode.value,
|
|
35
|
+
layout: context.layout.value,
|
|
36
|
+
viewport: context.viewport.value,
|
|
37
|
+
columns: context.columns.value,
|
|
38
|
+
rows: context.rows.value,
|
|
39
|
+
selection: context.selection.value,
|
|
40
|
+
editing: context.editing.value,
|
|
41
|
+
cells: context.cells.value,
|
|
42
|
+
interaction: context.interaction.value,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function provideDataGridTableStageContext(context) {
|
|
46
|
+
provide(dataGridTableStageContextKey, context);
|
|
47
|
+
return context;
|
|
48
|
+
}
|
|
49
|
+
export function useDataGridTableStageContext() {
|
|
50
|
+
const context = inject(dataGridTableStageContextKey);
|
|
51
|
+
if (!context) {
|
|
52
|
+
throw new Error("DataGrid table stage context is not available outside of DataGridTableStage.");
|
|
53
|
+
}
|
|
54
|
+
return context;
|
|
55
|
+
}
|
|
56
|
+
export function useDataGridTableStageMode() {
|
|
57
|
+
return useDataGridTableStageContext().mode;
|
|
58
|
+
}
|
|
59
|
+
export function useDataGridTableStageRowHeightMode() {
|
|
60
|
+
return useDataGridTableStageContext().rowHeightMode;
|
|
61
|
+
}
|
|
62
|
+
export function useDataGridTableStageSection(sectionKey) {
|
|
63
|
+
return useDataGridTableStageContext()[sectionKey];
|
|
64
|
+
}
|
|
65
|
+
export function useDataGridTableStageLayoutSection() {
|
|
66
|
+
return useDataGridTableStageSection("layout");
|
|
67
|
+
}
|
|
68
|
+
export function useDataGridTableStageViewportSection() {
|
|
69
|
+
return useDataGridTableStageSection("viewport");
|
|
70
|
+
}
|
|
71
|
+
export function useDataGridTableStageColumnsSection() {
|
|
72
|
+
return useDataGridTableStageSection("columns");
|
|
73
|
+
}
|
|
74
|
+
export function useDataGridTableStageRowsSection() {
|
|
75
|
+
return useDataGridTableStageSection("rows");
|
|
76
|
+
}
|
|
77
|
+
export function useDataGridTableStageSelectionSection() {
|
|
78
|
+
return useDataGridTableStageSection("selection");
|
|
79
|
+
}
|
|
80
|
+
export function useDataGridTableStageEditingSection() {
|
|
81
|
+
return useDataGridTableStageSection("editing");
|
|
82
|
+
}
|
|
83
|
+
export function useDataGridTableStageCellsSection() {
|
|
84
|
+
return useDataGridTableStageSection("cells");
|
|
85
|
+
}
|
|
86
|
+
export function useDataGridTableStageInteractionSection() {
|
|
87
|
+
return useDataGridTableStageSection("interaction");
|
|
88
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ComputedRef } from "vue";
|
|
2
|
+
import { type DataGridTableStageContext } from "./dataGridTableStageContext";
|
|
3
|
+
import type { DataGridElementRefHandler, DataGridTableStageProps, UseDataGridTableStageBindingsOptions } from "./dataGridTableStage.types";
|
|
4
|
+
export interface UseDataGridTableStageBindingsResult<TRow extends Record<string, unknown>> {
|
|
5
|
+
tableStageProps: ComputedRef<DataGridTableStageProps<TRow>>;
|
|
6
|
+
tableStageContext: DataGridTableStageContext<TRow>;
|
|
7
|
+
captureHeaderViewportRef: DataGridElementRefHandler;
|
|
8
|
+
captureBodyViewportRef: DataGridElementRefHandler;
|
|
9
|
+
updateEditingCellValue: (value: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function useDataGridTableStageBindings<TRow extends Record<string, unknown>>(options: UseDataGridTableStageBindingsOptions<TRow>): UseDataGridTableStageBindingsResult<TRow>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { computed, unref } from "vue";
|
|
2
|
+
import { createDataGridTableStageContext } from "./dataGridTableStageContext";
|
|
3
|
+
function createElementRefHandler(target) {
|
|
4
|
+
return value => {
|
|
5
|
+
target.value = value instanceof HTMLElement ? value : null;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export function useDataGridTableStageBindings(options) {
|
|
9
|
+
const captureHeaderViewportRef = createElementRefHandler(options.headerViewportRef);
|
|
10
|
+
const captureBodyViewportRef = createElementRefHandler(options.bodyViewportRef);
|
|
11
|
+
const updateEditingCellValue = (value) => {
|
|
12
|
+
options.editingCellValueRef.value = value;
|
|
13
|
+
};
|
|
14
|
+
const layoutSection = computed(() => ({
|
|
15
|
+
gridContentStyle: unref(options.gridContentStyle),
|
|
16
|
+
mainTrackStyle: unref(options.mainTrackStyle),
|
|
17
|
+
indexColumnStyle: unref(options.indexColumnStyle),
|
|
18
|
+
columnStyle: unref(options.columnStyle),
|
|
19
|
+
}));
|
|
20
|
+
const viewportSection = computed(() => ({
|
|
21
|
+
topSpacerHeight: unref(options.topSpacerHeight),
|
|
22
|
+
bottomSpacerHeight: unref(options.bottomSpacerHeight),
|
|
23
|
+
viewportRowStart: unref(options.viewportRowStart),
|
|
24
|
+
columnWindowStart: unref(options.columnWindowStart),
|
|
25
|
+
leftColumnSpacerWidth: unref(options.leftColumnSpacerWidth),
|
|
26
|
+
rightColumnSpacerWidth: unref(options.rightColumnSpacerWidth),
|
|
27
|
+
headerViewportRef: captureHeaderViewportRef,
|
|
28
|
+
bodyViewportRef: captureBodyViewportRef,
|
|
29
|
+
handleHeaderWheel: unref(options.handleHeaderWheel),
|
|
30
|
+
handleHeaderScroll: unref(options.handleHeaderScroll),
|
|
31
|
+
handleViewportScroll: unref(options.handleViewportScroll),
|
|
32
|
+
handleViewportKeydown: unref(options.handleViewportKeydown),
|
|
33
|
+
}));
|
|
34
|
+
const columnsSection = computed(() => ({
|
|
35
|
+
visibleColumns: unref(options.visibleColumns),
|
|
36
|
+
renderedColumns: unref(options.renderedColumns),
|
|
37
|
+
columnFilterTextByKey: unref(options.columnFilterTextByKey),
|
|
38
|
+
toggleSortForColumn: unref(options.toggleSortForColumn),
|
|
39
|
+
sortIndicator: unref(options.sortIndicator),
|
|
40
|
+
setColumnFilterText: unref(options.setColumnFilterText),
|
|
41
|
+
columnMenuEnabled: unref(options.columnMenuEnabled),
|
|
42
|
+
columnMenuValueFilterEnabled: unref(options.columnMenuValueFilterEnabled),
|
|
43
|
+
columnMenuValueFilterRowLimit: unref(options.columnMenuValueFilterRowLimit),
|
|
44
|
+
columnMenuMaxFilterValues: unref(options.columnMenuMaxFilterValues),
|
|
45
|
+
resolveColumnMenuItems: unref(options.resolveColumnMenuItems),
|
|
46
|
+
resolveColumnMenuDisabledItems: unref(options.resolveColumnMenuDisabledItems),
|
|
47
|
+
resolveColumnMenuDisabledReasons: unref(options.resolveColumnMenuDisabledReasons),
|
|
48
|
+
resolveColumnMenuLabels: unref(options.resolveColumnMenuLabels),
|
|
49
|
+
resolveColumnMenuActionOptions: unref(options.resolveColumnMenuActionOptions),
|
|
50
|
+
isColumnFilterActive: unref(options.isColumnFilterActive),
|
|
51
|
+
isColumnGrouped: unref(options.isColumnGrouped),
|
|
52
|
+
resolveColumnGroupOrder: unref(options.resolveColumnGroupOrder),
|
|
53
|
+
resolveColumnMenuSortDirection: unref(options.resolveColumnMenuSortDirection),
|
|
54
|
+
resolveColumnMenuSelectedTokens: unref(options.resolveColumnMenuSelectedTokens),
|
|
55
|
+
applyColumnMenuSort: unref(options.applyColumnMenuSort),
|
|
56
|
+
applyColumnMenuPin: unref(options.applyColumnMenuPin),
|
|
57
|
+
applyColumnMenuGroupBy: unref(options.applyColumnMenuGroupBy),
|
|
58
|
+
applyColumnMenuFilter: unref(options.applyColumnMenuFilter),
|
|
59
|
+
clearColumnMenuFilter: unref(options.clearColumnMenuFilter),
|
|
60
|
+
startResize: unref(options.startResize),
|
|
61
|
+
handleResizeDoubleClick: unref(options.handleResizeDoubleClick),
|
|
62
|
+
}));
|
|
63
|
+
const rowsSection = computed(() => ({
|
|
64
|
+
displayRows: unref(options.displayRows),
|
|
65
|
+
pinnedBottomRows: unref(options.pinnedBottomRows),
|
|
66
|
+
sourceRows: unref(options.sourceRows),
|
|
67
|
+
showRowIndex: unref(options.showRowIndex),
|
|
68
|
+
rowHover: unref(options.rowHover),
|
|
69
|
+
stripedRows: unref(options.stripedRows),
|
|
70
|
+
rowClass: unref(options.rowClass),
|
|
71
|
+
isRowAutosizeProbe: unref(options.isRowAutosizeProbe),
|
|
72
|
+
rowStyle: unref(options.rowStyle),
|
|
73
|
+
isRowInPendingClipboardCut: unref(options.isRowInPendingClipboardCut),
|
|
74
|
+
isRowFocused: unref(options.isRowFocused),
|
|
75
|
+
isRowCheckboxSelected: unref(options.isRowCheckboxSelected),
|
|
76
|
+
allVisibleRowsSelected: unref(options.allVisibleRowsSelected),
|
|
77
|
+
someVisibleRowsSelected: unref(options.someVisibleRowsSelected),
|
|
78
|
+
handleRowClick: unref(options.handleRowClick),
|
|
79
|
+
handleRowIndexClick: unref(options.handleRowIndexClick),
|
|
80
|
+
handleRowIndexKeydown: unref(options.handleRowIndexKeydown),
|
|
81
|
+
handleToggleAllVisibleRows: unref(options.handleToggleAllVisibleRows),
|
|
82
|
+
toggleGroupRow: unref(options.toggleGroupRow),
|
|
83
|
+
rowIndexLabel: unref(options.rowIndexLabel),
|
|
84
|
+
startRowResize: unref(options.startRowResize),
|
|
85
|
+
autosizeRow: unref(options.autosizeRow),
|
|
86
|
+
}));
|
|
87
|
+
const selectionSection = computed(() => ({
|
|
88
|
+
selectionRange: unref(options.selectionRange),
|
|
89
|
+
selectionAnchorCell: unref(options.selectionAnchorCell),
|
|
90
|
+
fillPreviewRange: unref(options.fillPreviewRange),
|
|
91
|
+
rangeMovePreviewRange: unref(options.rangeMovePreviewRange),
|
|
92
|
+
isFillDragging: unref(options.isFillDragging),
|
|
93
|
+
isRangeMoving: unref(options.isRangeMoving),
|
|
94
|
+
fillActionAnchorCell: unref(options.fillActionAnchorCell),
|
|
95
|
+
fillActionBehavior: unref(options.fillActionBehavior),
|
|
96
|
+
applyFillActionBehavior: unref(options.applyFillActionBehavior),
|
|
97
|
+
isFillHandleCell: unref(options.isFillHandleCell),
|
|
98
|
+
startFillHandleDrag: unref(options.startFillHandleDrag),
|
|
99
|
+
startFillHandleDoubleClick: unref(options.startFillHandleDoubleClick),
|
|
100
|
+
}));
|
|
101
|
+
const editingSection = computed(() => ({
|
|
102
|
+
editingCellValue: options.editingCellValueRef.value,
|
|
103
|
+
editingCellInitialFilter: unref(options.editingCellInitialFilter),
|
|
104
|
+
editingCellOpenOnMount: unref(options.editingCellOpenOnMount),
|
|
105
|
+
isEditingCell: unref(options.isEditingCell),
|
|
106
|
+
startInlineEdit: unref(options.startInlineEdit),
|
|
107
|
+
updateEditingCellValue,
|
|
108
|
+
handleEditorKeydown: unref(options.handleEditorKeydown),
|
|
109
|
+
commitInlineEdit: unref(options.commitInlineEdit),
|
|
110
|
+
cancelInlineEdit: unref(options.cancelInlineEdit),
|
|
111
|
+
}));
|
|
112
|
+
const cellsSection = computed(() => ({
|
|
113
|
+
cellClass: unref(options.cellClass),
|
|
114
|
+
cellStyle: unref(options.cellStyle),
|
|
115
|
+
isCellSelected: unref(options.isCellSelected),
|
|
116
|
+
isSelectionAnchorCell: unref(options.isSelectionAnchorCell),
|
|
117
|
+
shouldHighlightSelectedCell: unref(options.shouldHighlightSelectedCell),
|
|
118
|
+
isCellOnSelectionEdge: unref(options.isCellOnSelectionEdge),
|
|
119
|
+
isCellInFillPreview: unref(options.isCellInFillPreview),
|
|
120
|
+
isCellInPendingClipboardRange: unref(options.isCellInPendingClipboardRange),
|
|
121
|
+
isCellOnPendingClipboardEdge: unref(options.isCellOnPendingClipboardEdge),
|
|
122
|
+
isCellEditable: unref(options.isCellEditable),
|
|
123
|
+
readCell: unref(options.readCell),
|
|
124
|
+
readDisplayCell: unref(options.readDisplayCell),
|
|
125
|
+
}));
|
|
126
|
+
const interactionSection = computed(() => ({
|
|
127
|
+
handleCellMouseDown: unref(options.handleCellMouseDown),
|
|
128
|
+
handleCellClick: unref(options.handleCellClick),
|
|
129
|
+
handleCellKeydown: unref(options.handleCellKeydown),
|
|
130
|
+
}));
|
|
131
|
+
const tableStageProps = computed(() => ({
|
|
132
|
+
mode: unref(options.mode),
|
|
133
|
+
rowHeightMode: unref(options.rowHeightMode),
|
|
134
|
+
layout: layoutSection.value,
|
|
135
|
+
viewport: viewportSection.value,
|
|
136
|
+
columns: columnsSection.value,
|
|
137
|
+
rows: rowsSection.value,
|
|
138
|
+
selection: selectionSection.value,
|
|
139
|
+
editing: editingSection.value,
|
|
140
|
+
cells: cellsSection.value,
|
|
141
|
+
interaction: interactionSection.value,
|
|
142
|
+
}));
|
|
143
|
+
const tableStageContext = createDataGridTableStageContext({
|
|
144
|
+
mode: computed(() => unref(options.mode)),
|
|
145
|
+
rowHeightMode: computed(() => unref(options.rowHeightMode)),
|
|
146
|
+
layout: layoutSection,
|
|
147
|
+
viewport: viewportSection,
|
|
148
|
+
columns: columnsSection,
|
|
149
|
+
rows: rowsSection,
|
|
150
|
+
selection: selectionSection,
|
|
151
|
+
editing: editingSection,
|
|
152
|
+
cells: cellsSection,
|
|
153
|
+
interaction: interactionSection,
|
|
154
|
+
});
|
|
155
|
+
return {
|
|
156
|
+
tableStageProps,
|
|
157
|
+
tableStageContext,
|
|
158
|
+
captureHeaderViewportRef,
|
|
159
|
+
captureBodyViewportRef,
|
|
160
|
+
updateEditingCellValue,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type DataGridColumnSnapshot } from "@affino/datagrid-vue";
|
|
2
|
+
import type { DataGridCopyRange } from "@affino/datagrid-vue/advanced";
|
|
3
|
+
import type { DataGridTableRow } from "./dataGridTableStage.types";
|
|
4
|
+
export interface UseDataGridTableStageCellIoOptions<TRow extends Record<string, unknown>> {
|
|
5
|
+
runtime: Pick<import("@affino/datagrid-vue").UseDataGridRuntimeResult<TRow>, "api">;
|
|
6
|
+
viewportRowStart: import("vue").Ref<number>;
|
|
7
|
+
isRowSelectionColumnKey: (columnKey: string) => boolean;
|
|
8
|
+
isRowSelectionColumn: (column: DataGridColumnSnapshot) => boolean;
|
|
9
|
+
isCellEditableByKey: (row: DataGridTableRow<TRow>, rowIndex: number, columnKey: string, columnIndex: number) => boolean;
|
|
10
|
+
readRowSelectionCell: (row: DataGridTableRow<TRow>) => string;
|
|
11
|
+
readRowSelectionDisplayCell: (row: DataGridTableRow<TRow>) => string;
|
|
12
|
+
readCell: (row: DataGridTableRow<TRow>, columnKey: string) => string;
|
|
13
|
+
readDisplayCell: (row: DataGridTableRow<TRow>, columnKey: string) => string;
|
|
14
|
+
toggleRowCheckboxSelected: (row: DataGridTableRow<TRow>) => void;
|
|
15
|
+
captureHistorySnapshot: () => unknown;
|
|
16
|
+
recordHistoryIntentTransaction: (descriptor: {
|
|
17
|
+
intent: string;
|
|
18
|
+
label: string;
|
|
19
|
+
affectedRange?: DataGridCopyRange | null;
|
|
20
|
+
}, beforeSnapshot: unknown) => void;
|
|
21
|
+
syncViewport: () => void;
|
|
22
|
+
}
|
|
23
|
+
export interface UseDataGridTableStageCellIoResult<TRow extends Record<string, unknown>> {
|
|
24
|
+
readStageCell: (row: DataGridTableRow<TRow>, columnKey: string) => string;
|
|
25
|
+
readStageDisplayCell: (row: DataGridTableRow<TRow>, columnKey: string) => string;
|
|
26
|
+
handleCellClick: (row: DataGridTableRow<TRow>, rowOffset: number, column: DataGridColumnSnapshot, columnIndex: number) => void;
|
|
27
|
+
}
|
|
28
|
+
export declare function useDataGridTableStageCellIo<TRow extends Record<string, unknown>>(options: UseDataGridTableStageCellIoOptions<TRow>): UseDataGridTableStageCellIoResult<TRow>;
|