@affino/datagrid-vue-app 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DataGrid.d.ts +9 -9
- package/dist/DataGridTableStage.vue.d.ts +112 -0
- package/dist/chunks/useDataGridAppRowModel-CcTL-h8L.js +11251 -0
- package/dist/gantt/DataGridGanttStage.vue.d.ts +21 -0
- package/dist/host/DataGridDefaultRenderer.d.ts +3 -3
- package/dist/host/DataGridRuntimeHost.d.ts +1 -1
- package/dist/index.js +1125 -4
- package/dist/internal.js +37 -14
- package/dist/overlays/DataGridAdvancedFilterPopover.vue.d.ts +62 -0
- package/dist/overlays/DataGridAggregationsPopover.vue.d.ts +62 -0
- package/dist/overlays/DataGridCellComboboxEditor.vue.d.ts +29 -0
- package/dist/overlays/DataGridColumnLayoutPopover.vue.d.ts +51 -0
- package/dist/overlays/DataGridColumnMenu.vue.d.ts +65 -0
- package/dist/overlays/DataGridFilterableCombobox.vue.d.ts +76 -0
- package/dist/stage/DataGridTableStage.vue.d.ts +115 -0
- package/dist/stage/DataGridTableStageCenterPane.vue.d.ts +121 -0
- package/dist/stage/DataGridTableStageFillActionMenu.vue.d.ts +30 -0
- package/dist/stage/DataGridTableStageHeader.vue.d.ts +84 -0
- package/dist/stage/DataGridTableStageOverlayLayer.vue.d.ts +34 -0
- package/dist/stage/DataGridTableStagePinnedPane.vue.d.ts +43 -0
- package/package.json +8 -5
- package/dist/DataGrid.js +0 -565
- package/dist/DataGridDefaultRenderer.js +0 -2
- package/dist/DataGridModuleHost.js +0 -2
- package/dist/DataGridRuntimeHost.js +0 -1
- package/dist/config/dataGridAdvancedFilter.js +0 -21
- package/dist/config/dataGridAggregations.js +0 -21
- package/dist/config/dataGridColumnLayout.js +0 -21
- package/dist/config/dataGridFormulaOptions.js +0 -137
- package/dist/config/dataGridPublicProps.js +0 -58
- package/dist/config/dataGridSavedView.js +0 -73
- package/dist/config/dataGridVirtualization.js +0 -32
- package/dist/dataGridAdvancedFilter.js +0 -1
- package/dist/dataGridAggregations.js +0 -1
- package/dist/dataGridAppContext.js +0 -1
- package/dist/dataGridCellComboboxState.d.ts +0 -10
- package/dist/dataGridCellComboboxState.js +0 -67
- package/dist/dataGridColumnLayout.js +0 -1
- package/dist/dataGridColumnMenu.d.ts +0 -9
- package/dist/dataGridColumnMenu.js +0 -21
- package/dist/dataGridEditability.js +0 -1
- package/dist/dataGridFilterableCombobox.js +0 -1
- package/dist/dataGridFormulaOptions.js +0 -1
- package/dist/dataGridGantt.d.ts +0 -3
- package/dist/dataGridGantt.js +0 -1
- package/dist/dataGridGanttDependencySelection.d.ts +0 -7
- package/dist/dataGridGanttDependencySelection.js +0 -46
- package/dist/dataGridGanttLabel.d.ts +0 -2
- package/dist/dataGridGanttLabel.js +0 -30
- package/dist/dataGridGanttSplit.d.ts +0 -20
- package/dist/dataGridGanttSplit.js +0 -31
- package/dist/dataGridGanttWheel.d.ts +0 -10
- package/dist/dataGridGanttWheel.js +0 -30
- package/dist/dataGridOverlayThemeVars.d.ts +0 -1
- package/dist/dataGridOverlayThemeVars.js +0 -32
- package/dist/dataGridPublicProps.js +0 -1
- package/dist/dataGridTableStage.types.js +0 -1
- package/dist/dataGridTableStageBody.types.js +0 -1
- package/dist/dataGridTableStageContext.js +0 -1
- package/dist/dataGridTheme.js +0 -1
- package/dist/dataGridVirtualization.js +0 -1
- package/dist/ensureDataGridAppStyles.js +0 -1
- package/dist/gantt/dataGridGantt.js +0 -1
- package/dist/gantt/dataGridGanttDependencySelection.js +0 -46
- package/dist/gantt/dataGridGanttLabel.js +0 -30
- package/dist/gantt/dataGridGanttSplit.js +0 -31
- package/dist/gantt/dataGridGanttWheel.js +0 -30
- package/dist/host/DataGridDefaultRenderer.js +0 -1847
- package/dist/host/DataGridModuleHost.js +0 -23
- package/dist/host/DataGridRuntimeHost.js +0 -174
- package/dist/overlays/dataGridCellComboboxState.js +0 -67
- package/dist/overlays/dataGridColumnMenu.js +0 -190
- package/dist/overlays/dataGridContextMenu.js +0 -218
- package/dist/overlays/dataGridFilterableCombobox.js +0 -74
- package/dist/overlays/dataGridOverlayThemeVars.js +0 -32
- package/dist/stage/dataGridTableStage.types.js +0 -1
- package/dist/stage/dataGridTableStageBody.types.js +0 -1
- package/dist/stage/dataGridTableStageContext.js +0 -88
- package/dist/stage/useDataGridTableStageBindings.js +0 -162
- package/dist/stage/useDataGridTableStageCellIo.js +0 -62
- package/dist/stage/useDataGridTableStageColumns.js +0 -124
- package/dist/stage/useDataGridTableStageFillAction.js +0 -28
- package/dist/stage/useDataGridTableStageHistory.js +0 -46
- package/dist/stage/useDataGridTableStageRowSelection.js +0 -107
- package/dist/stage/useDataGridTableStageRuntime.js +0 -526
- package/dist/stage/useDataGridTableStageScrollSync.js +0 -49
- package/dist/stage/useDataGridTableStageViewportKeyboard.js +0 -58
- package/dist/stage/useDataGridTableStageVisualSelection.js +0 -83
- package/dist/theme/dataGridTheme.js +0 -84
- package/dist/theme/ensureDataGridAppStyles.js +0 -2656
- package/dist/useDataGridAppControlledState.js +0 -390
- package/dist/useDataGridAppRowModel.js +0 -85
- package/dist/useDataGridTableStageBindings.js +0 -1
- package/dist/useDataGridTableStageCellIo.d.ts +0 -28
- package/dist/useDataGridTableStageCellIo.js +0 -62
- package/dist/useDataGridTableStageColumns.d.ts +0 -21
- package/dist/useDataGridTableStageColumns.js +0 -122
- package/dist/useDataGridTableStageFillAction.d.ts +0 -19
- package/dist/useDataGridTableStageFillAction.js +0 -28
- package/dist/useDataGridTableStageHistory.d.ts +0 -31
- package/dist/useDataGridTableStageHistory.js +0 -46
- package/dist/useDataGridTableStageRowSelection.d.ts +0 -28
- package/dist/useDataGridTableStageRowSelection.js +0 -103
- package/dist/useDataGridTableStageRuntime.js +0 -1
- package/dist/useDataGridTableStageScrollSync.d.ts +0 -17
- package/dist/useDataGridTableStageScrollSync.js +0 -49
- package/dist/useDataGridTableStageViewportKeyboard.d.ts +0 -20
- package/dist/useDataGridTableStageViewportKeyboard.js +0 -58
- package/dist/useDataGridTableStageVisualSelection.d.ts +0 -24
- package/dist/useDataGridTableStageVisualSelection.js +0 -70
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export function useDataGridTableStageViewportKeyboard(options) {
|
|
2
|
-
const isViewportOwnedKeyboardEvent = (event) => {
|
|
3
|
-
if (event.ctrlKey || event.metaKey || event.altKey) {
|
|
4
|
-
return false;
|
|
5
|
-
}
|
|
6
|
-
return (event.key.startsWith("Arrow")
|
|
7
|
-
|| event.key === "Home"
|
|
8
|
-
|| event.key === "End"
|
|
9
|
-
|| event.key === "PageUp"
|
|
10
|
-
|| event.key === "PageDown"
|
|
11
|
-
|| event.key === "Tab"
|
|
12
|
-
|| event.key === "Enter"
|
|
13
|
-
|| event.key === " "
|
|
14
|
-
|| event.key === "Spacebar"
|
|
15
|
-
|| event.key === "F2"
|
|
16
|
-
|| event.key === "Escape"
|
|
17
|
-
|| event.key.length === 1);
|
|
18
|
-
};
|
|
19
|
-
const isViewportSelectAllKeyboardEvent = (event) => {
|
|
20
|
-
return (event.ctrlKey || event.metaKey)
|
|
21
|
-
&& !event.altKey
|
|
22
|
-
&& !event.shiftKey
|
|
23
|
-
&& event.key.toLowerCase() === "a";
|
|
24
|
-
};
|
|
25
|
-
const selectAllVisibleCells = () => {
|
|
26
|
-
const lastRowIndex = options.totalRows.value - 1;
|
|
27
|
-
const lastColumnIndex = options.orderedVisibleColumns.value.length - 1;
|
|
28
|
-
if (lastRowIndex < 0 || lastColumnIndex < 0) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
options.applySelectionRange({
|
|
32
|
-
startRow: 0,
|
|
33
|
-
endRow: lastRowIndex,
|
|
34
|
-
startColumn: 0,
|
|
35
|
-
endColumn: lastColumnIndex,
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
const handleViewportKeydown = (event) => {
|
|
39
|
-
if (isViewportOwnedKeyboardEvent(event) || isViewportSelectAllKeyboardEvent(event)) {
|
|
40
|
-
event.preventDefault();
|
|
41
|
-
}
|
|
42
|
-
const activeCell = options.selectionSnapshot.value?.activeCell;
|
|
43
|
-
if (!activeCell) {
|
|
44
|
-
if (isViewportSelectAllKeyboardEvent(event)) {
|
|
45
|
-
selectAllVisibleCells();
|
|
46
|
-
}
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const row = options.runtime.getBodyRowAtIndex(activeCell.rowIndex);
|
|
50
|
-
if (!row) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
options.handleCellKeydown(event, row, activeCell.rowIndex - options.viewportRowStart.value, activeCell.colIndex);
|
|
54
|
-
};
|
|
55
|
-
return {
|
|
56
|
-
handleViewportKeydown,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
2
|
-
export function useDataGridTableStageVisualSelection(options) {
|
|
3
|
-
const selectionRange = computed(() => (options.interactionSelectionRange.value ?? options.resolveCommittedSelectionRange()));
|
|
4
|
-
const resolveVisualAnchorCell = () => {
|
|
5
|
-
const range = selectionRange.value;
|
|
6
|
-
if (range
|
|
7
|
-
&& range.startRow === range.endRow
|
|
8
|
-
&& range.startColumn === range.endColumn) {
|
|
9
|
-
return {
|
|
10
|
-
rowIndex: range.startRow,
|
|
11
|
-
columnIndex: range.startColumn,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
return options.selectionAnchorCell.value;
|
|
15
|
-
};
|
|
16
|
-
const resolveVisualSelectionRange = () => selectionRange.value;
|
|
17
|
-
const isVisualFillSelectionActive = () => {
|
|
18
|
-
return options.mode.value === "base" && options.isFillDragging.value && Boolean(options.fillPreviewRange.value);
|
|
19
|
-
};
|
|
20
|
-
const isCellWithinRange = (range, rowOffset, columnIndex) => {
|
|
21
|
-
const rowIndex = options.viewportRowStart.value + rowOffset;
|
|
22
|
-
return (rowIndex >= range.startRow
|
|
23
|
-
&& rowIndex <= range.endRow
|
|
24
|
-
&& columnIndex >= range.startColumn
|
|
25
|
-
&& columnIndex <= range.endColumn);
|
|
26
|
-
};
|
|
27
|
-
const isSelectionAnchorCell = (rowOffset, columnIndex) => {
|
|
28
|
-
const anchorCell = resolveVisualAnchorCell();
|
|
29
|
-
if (anchorCell) {
|
|
30
|
-
return anchorCell.rowIndex === options.viewportRowStart.value + rowOffset
|
|
31
|
-
&& anchorCell.columnIndex === columnIndex;
|
|
32
|
-
}
|
|
33
|
-
return options.isCommittedSelectionAnchorCell(rowOffset, columnIndex);
|
|
34
|
-
};
|
|
35
|
-
const isCellSelected = (rowOffset, columnIndex) => {
|
|
36
|
-
if (!isVisualFillSelectionActive()) {
|
|
37
|
-
return options.isCommittedCellSelected(rowOffset, columnIndex);
|
|
38
|
-
}
|
|
39
|
-
const range = resolveVisualSelectionRange();
|
|
40
|
-
return range ? isCellWithinRange(range, rowOffset, columnIndex) : false;
|
|
41
|
-
};
|
|
42
|
-
const shouldHighlightSelectedCell = (rowOffset, columnIndex) => {
|
|
43
|
-
if (!isVisualFillSelectionActive()) {
|
|
44
|
-
return options.shouldHighlightCommittedSelectedCell(rowOffset, columnIndex);
|
|
45
|
-
}
|
|
46
|
-
const range = resolveVisualSelectionRange();
|
|
47
|
-
if (!range || !isCellWithinRange(range, rowOffset, columnIndex)) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
const isSingleCell = range.startRow === range.endRow && range.startColumn === range.endColumn;
|
|
51
|
-
if (isSingleCell) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
return !isSelectionAnchorCell(rowOffset, columnIndex);
|
|
55
|
-
};
|
|
56
|
-
const isCellOnSelectionEdge = (rowOffset, columnIndex, edge) => {
|
|
57
|
-
if (!isVisualFillSelectionActive()) {
|
|
58
|
-
return options.isCommittedCellOnSelectionEdge(rowOffset, columnIndex, edge);
|
|
59
|
-
}
|
|
60
|
-
const range = resolveVisualSelectionRange();
|
|
61
|
-
if (!range || !isCellWithinRange(range, rowOffset, columnIndex)) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
const rowIndex = options.viewportRowStart.value + rowOffset;
|
|
65
|
-
switch (edge) {
|
|
66
|
-
case "top":
|
|
67
|
-
return rowIndex === range.startRow;
|
|
68
|
-
case "right":
|
|
69
|
-
return columnIndex === range.endColumn;
|
|
70
|
-
case "bottom":
|
|
71
|
-
return rowIndex === range.endRow;
|
|
72
|
-
case "left":
|
|
73
|
-
return columnIndex === range.startColumn;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
return {
|
|
77
|
-
selectionRange,
|
|
78
|
-
isSelectionAnchorCell,
|
|
79
|
-
isCellSelected,
|
|
80
|
-
shouldHighlightSelectedCell,
|
|
81
|
-
isCellOnSelectionEdge,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { applyGridTheme, defaultStyleConfig, industrialNeutralTheme, resolveGridThemeTokens, sugarTheme, } from "@affino/datagrid-theme";
|
|
2
|
-
const DATA_GRID_THEME_PRESETS = {
|
|
3
|
-
default: defaultStyleConfig,
|
|
4
|
-
"industrial-neutral": industrialNeutralTheme,
|
|
5
|
-
industrialNeutral: industrialNeutralTheme,
|
|
6
|
-
sugar: sugarTheme,
|
|
7
|
-
};
|
|
8
|
-
function mergeTokenVariants(base, override) {
|
|
9
|
-
if (!base && !override) {
|
|
10
|
-
return undefined;
|
|
11
|
-
}
|
|
12
|
-
const merged = {
|
|
13
|
-
...(base ?? {}),
|
|
14
|
-
};
|
|
15
|
-
for (const [variantKey, tokens] of Object.entries(override ?? {})) {
|
|
16
|
-
merged[variantKey] = {
|
|
17
|
-
...(merged[variantKey] ?? {}),
|
|
18
|
-
...tokens,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
return merged;
|
|
22
|
-
}
|
|
23
|
-
function mergeStyleConfigs(base, override) {
|
|
24
|
-
return {
|
|
25
|
-
...base,
|
|
26
|
-
...override,
|
|
27
|
-
grid: { ...(base.grid ?? {}), ...(override.grid ?? {}) },
|
|
28
|
-
header: { ...(base.header ?? {}), ...(override.header ?? {}) },
|
|
29
|
-
body: { ...(base.body ?? {}), ...(override.body ?? {}) },
|
|
30
|
-
group: { ...(base.group ?? {}), ...(override.group ?? {}) },
|
|
31
|
-
summary: { ...(base.summary ?? {}), ...(override.summary ?? {}) },
|
|
32
|
-
state: { ...(base.state ?? {}), ...(override.state ?? {}) },
|
|
33
|
-
tokens: { ...(base.tokens ?? {}), ...(override.tokens ?? {}) },
|
|
34
|
-
tokenVariants: mergeTokenVariants(base.tokenVariants, override.tokenVariants),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function isStyleConfig(input) {
|
|
38
|
-
if (!input || typeof input !== "object") {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
return ("tokens" in input
|
|
42
|
-
|| "tokenVariants" in input
|
|
43
|
-
|| "activeTokenVariant" in input
|
|
44
|
-
|| "defaultTokenVariant" in input
|
|
45
|
-
|| "inheritThemeFromDocument" in input
|
|
46
|
-
|| "documentDarkClass" in input
|
|
47
|
-
|| "grid" in input
|
|
48
|
-
|| "header" in input
|
|
49
|
-
|| "body" in input
|
|
50
|
-
|| "group" in input
|
|
51
|
-
|| "summary" in input
|
|
52
|
-
|| "state" in input);
|
|
53
|
-
}
|
|
54
|
-
function resolveThemeStyleConfig(theme) {
|
|
55
|
-
if (theme == null) {
|
|
56
|
-
return defaultStyleConfig;
|
|
57
|
-
}
|
|
58
|
-
if (typeof theme === "string") {
|
|
59
|
-
if (theme === "sugar") {
|
|
60
|
-
return mergeStyleConfigs(defaultStyleConfig, sugarTheme);
|
|
61
|
-
}
|
|
62
|
-
return DATA_GRID_THEME_PRESETS[theme] ?? defaultStyleConfig;
|
|
63
|
-
}
|
|
64
|
-
if (isStyleConfig(theme)) {
|
|
65
|
-
return mergeStyleConfigs(defaultStyleConfig, theme);
|
|
66
|
-
}
|
|
67
|
-
return mergeStyleConfigs(defaultStyleConfig, {
|
|
68
|
-
tokens: theme,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
export function resolveDataGridThemeTokens(theme) {
|
|
72
|
-
const styleConfig = resolveThemeStyleConfig(theme);
|
|
73
|
-
return resolveGridThemeTokens(styleConfig ?? defaultStyleConfig, {
|
|
74
|
-
document: typeof document === "undefined" ? undefined : document,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
export function applyDataGridTheme(rootElement, theme) {
|
|
78
|
-
const tokens = resolveDataGridThemeTokens(theme);
|
|
79
|
-
applyGridTheme(rootElement, tokens);
|
|
80
|
-
return tokens;
|
|
81
|
-
}
|
|
82
|
-
export function clearDataGridTheme(rootElement) {
|
|
83
|
-
applyDataGridTheme(rootElement, "default");
|
|
84
|
-
}
|