@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,74 +0,0 @@
|
|
|
1
|
-
const SCORE_EXACT_LABEL = 0;
|
|
2
|
-
const SCORE_EXACT_VALUE = 1;
|
|
3
|
-
const SCORE_PREFIX_LABEL = 2;
|
|
4
|
-
const SCORE_PREFIX_VALUE = 3;
|
|
5
|
-
const SCORE_WORD_PREFIX_LABEL = 4;
|
|
6
|
-
const SCORE_WORD_PREFIX_VALUE = 5;
|
|
7
|
-
const SCORE_CONTAINS_LABEL = 6;
|
|
8
|
-
const SCORE_CONTAINS_VALUE = 7;
|
|
9
|
-
const SCORE_NO_MATCH = 100;
|
|
10
|
-
export function rankDataGridFilterableComboboxOptions(options, query) {
|
|
11
|
-
const normalizedQuery = normalizeSearchText(query);
|
|
12
|
-
if (normalizedQuery.length === 0) {
|
|
13
|
-
return [...options];
|
|
14
|
-
}
|
|
15
|
-
const ranked = options
|
|
16
|
-
.map((option, originalIndex) => ({
|
|
17
|
-
option,
|
|
18
|
-
score: resolveOptionScore(option, normalizedQuery),
|
|
19
|
-
originalIndex,
|
|
20
|
-
}))
|
|
21
|
-
.filter(entry => entry.score < SCORE_NO_MATCH);
|
|
22
|
-
ranked.sort((left, right) => {
|
|
23
|
-
if (left.score !== right.score) {
|
|
24
|
-
return left.score - right.score;
|
|
25
|
-
}
|
|
26
|
-
const leftLabelLength = left.option.label.length;
|
|
27
|
-
const rightLabelLength = right.option.label.length;
|
|
28
|
-
if (leftLabelLength !== rightLabelLength) {
|
|
29
|
-
return leftLabelLength - rightLabelLength;
|
|
30
|
-
}
|
|
31
|
-
return left.originalIndex - right.originalIndex;
|
|
32
|
-
});
|
|
33
|
-
return ranked.map(entry => entry.option);
|
|
34
|
-
}
|
|
35
|
-
function resolveOptionScore(option, normalizedQuery) {
|
|
36
|
-
const normalizedLabel = normalizeSearchText(option.label);
|
|
37
|
-
const normalizedValue = normalizeSearchText(option.value);
|
|
38
|
-
if (normalizedLabel === normalizedQuery) {
|
|
39
|
-
return SCORE_EXACT_LABEL;
|
|
40
|
-
}
|
|
41
|
-
if (normalizedValue === normalizedQuery) {
|
|
42
|
-
return SCORE_EXACT_VALUE;
|
|
43
|
-
}
|
|
44
|
-
if (normalizedLabel.startsWith(normalizedQuery)) {
|
|
45
|
-
return SCORE_PREFIX_LABEL;
|
|
46
|
-
}
|
|
47
|
-
if (normalizedValue.startsWith(normalizedQuery)) {
|
|
48
|
-
return SCORE_PREFIX_VALUE;
|
|
49
|
-
}
|
|
50
|
-
if (hasWordPrefixMatch(normalizedLabel, normalizedQuery)) {
|
|
51
|
-
return SCORE_WORD_PREFIX_LABEL;
|
|
52
|
-
}
|
|
53
|
-
if (hasWordPrefixMatch(normalizedValue, normalizedQuery)) {
|
|
54
|
-
return SCORE_WORD_PREFIX_VALUE;
|
|
55
|
-
}
|
|
56
|
-
if (normalizedLabel.includes(normalizedQuery)) {
|
|
57
|
-
return SCORE_CONTAINS_LABEL;
|
|
58
|
-
}
|
|
59
|
-
if (normalizedValue.includes(normalizedQuery)) {
|
|
60
|
-
return SCORE_CONTAINS_VALUE;
|
|
61
|
-
}
|
|
62
|
-
return SCORE_NO_MATCH;
|
|
63
|
-
}
|
|
64
|
-
function hasWordPrefixMatch(value, normalizedQuery) {
|
|
65
|
-
if (value.length === 0 || normalizedQuery.length === 0) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
return value
|
|
69
|
-
.split(/[^a-z0-9]+/i)
|
|
70
|
-
.some(token => token.length > 0 && token.startsWith(normalizedQuery));
|
|
71
|
-
}
|
|
72
|
-
function normalizeSearchText(value) {
|
|
73
|
-
return value.trim().toLocaleLowerCase();
|
|
74
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const DATA_GRID_OVERLAY_THEME_VAR_NAMES = [
|
|
2
|
-
"--datagrid-font-family",
|
|
3
|
-
"--datagrid-font-size",
|
|
4
|
-
"--datagrid-text-primary",
|
|
5
|
-
"--datagrid-text-muted",
|
|
6
|
-
"--datagrid-text-soft",
|
|
7
|
-
"--datagrid-accent-strong",
|
|
8
|
-
"--datagrid-glass-border",
|
|
9
|
-
"--datagrid-background-color",
|
|
10
|
-
"--datagrid-editor-bg",
|
|
11
|
-
"--datagrid-filter-trigger-border",
|
|
12
|
-
"--datagrid-column-menu-bg",
|
|
13
|
-
"--datagrid-column-menu-border",
|
|
14
|
-
"--datagrid-column-menu-shadow",
|
|
15
|
-
"--datagrid-column-menu-item-hover-bg",
|
|
16
|
-
"--datagrid-column-menu-muted-text",
|
|
17
|
-
"--datagrid-column-menu-focus-ring",
|
|
18
|
-
"--datagrid-column-menu-search-border",
|
|
19
|
-
"--datagrid-column-menu-search-bg",
|
|
20
|
-
"--datagrid-sort-indicator-color",
|
|
21
|
-
];
|
|
22
|
-
export function readDataGridOverlayThemeVars(rootElement) {
|
|
23
|
-
if (!rootElement || typeof window === "undefined") {
|
|
24
|
-
return {};
|
|
25
|
-
}
|
|
26
|
-
const computedStyle = window.getComputedStyle(rootElement);
|
|
27
|
-
const vars = {};
|
|
28
|
-
for (const name of DATA_GRID_OVERLAY_THEME_VAR_NAMES) {
|
|
29
|
-
vars[name] = computedStyle.getPropertyValue(name).trim();
|
|
30
|
-
}
|
|
31
|
-
return vars;
|
|
32
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,88 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { resolveDataGridCellClickAction, toggleDataGridCellValue, } from "@affino/datagrid-vue";
|
|
2
|
-
export function useDataGridTableStageCellIo(options) {
|
|
3
|
-
const readStageCell = (row, columnKey) => {
|
|
4
|
-
if (options.isRowSelectionColumnKey(columnKey)) {
|
|
5
|
-
return options.readRowSelectionCell(row);
|
|
6
|
-
}
|
|
7
|
-
return options.readCell(row, columnKey);
|
|
8
|
-
};
|
|
9
|
-
const readStageDisplayCell = (row, columnKey) => {
|
|
10
|
-
if (options.isRowSelectionColumnKey(columnKey)) {
|
|
11
|
-
return options.readRowSelectionDisplayCell(row);
|
|
12
|
-
}
|
|
13
|
-
return options.readDisplayCell(row, columnKey);
|
|
14
|
-
};
|
|
15
|
-
const handleCellClick = (row, rowOffset, column, columnIndex) => {
|
|
16
|
-
if (options.isRowSelectionColumn(column)) {
|
|
17
|
-
options.toggleRowCheckboxSelected(row);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const rowIndex = options.viewportRowStart.value + rowOffset;
|
|
21
|
-
const editable = options.isCellEditableByKey(row, rowIndex, column.key, columnIndex);
|
|
22
|
-
const clickAction = resolveDataGridCellClickAction({
|
|
23
|
-
column: column.column,
|
|
24
|
-
row: row.kind !== "group" ? row.data : undefined,
|
|
25
|
-
editable,
|
|
26
|
-
});
|
|
27
|
-
if (clickAction !== "toggle") {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (row.kind === "group" || row.rowId == null) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const beforeSnapshot = options.captureHistorySnapshot();
|
|
34
|
-
options.runtime.api.rows.applyEdits([
|
|
35
|
-
{
|
|
36
|
-
rowId: row.rowId,
|
|
37
|
-
data: {
|
|
38
|
-
[column.key]: toggleDataGridCellValue({
|
|
39
|
-
column: column.column,
|
|
40
|
-
row: row.data,
|
|
41
|
-
}),
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
]);
|
|
45
|
-
options.recordHistoryIntentTransaction({
|
|
46
|
-
intent: "edit",
|
|
47
|
-
label: `Toggle ${column.key}`,
|
|
48
|
-
affectedRange: {
|
|
49
|
-
startRow: rowIndex,
|
|
50
|
-
endRow: rowIndex,
|
|
51
|
-
startColumn: columnIndex,
|
|
52
|
-
endColumn: columnIndex,
|
|
53
|
-
},
|
|
54
|
-
}, beforeSnapshot);
|
|
55
|
-
options.syncViewport();
|
|
56
|
-
};
|
|
57
|
-
return {
|
|
58
|
-
readStageCell,
|
|
59
|
-
readStageDisplayCell,
|
|
60
|
-
handleCellClick,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
2
|
-
const DEFAULT_COLUMN_WIDTH = 140;
|
|
3
|
-
const ROW_SELECTION_COLUMN_WIDTH = 108;
|
|
4
|
-
const ROW_SELECTION_COLUMN_KEY = "__datagrid_row_selection__";
|
|
5
|
-
export function useDataGridTableStageColumns(options) {
|
|
6
|
-
const hasRowSelectionSupport = computed(() => {
|
|
7
|
-
return (options.showRowSelection?.value ?? true) && options.runtime.api.rowSelection.hasSupport();
|
|
8
|
-
});
|
|
9
|
-
const rowSelectionColumn = computed(() => {
|
|
10
|
-
if (!hasRowSelectionSupport.value) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
return {
|
|
14
|
-
key: ROW_SELECTION_COLUMN_KEY,
|
|
15
|
-
state: {
|
|
16
|
-
visible: true,
|
|
17
|
-
pin: "left",
|
|
18
|
-
width: ROW_SELECTION_COLUMN_WIDTH,
|
|
19
|
-
},
|
|
20
|
-
visible: true,
|
|
21
|
-
pin: "left",
|
|
22
|
-
width: ROW_SELECTION_COLUMN_WIDTH,
|
|
23
|
-
column: {
|
|
24
|
-
key: ROW_SELECTION_COLUMN_KEY,
|
|
25
|
-
label: "",
|
|
26
|
-
cellType: "checkbox",
|
|
27
|
-
minWidth: ROW_SELECTION_COLUMN_WIDTH,
|
|
28
|
-
maxWidth: ROW_SELECTION_COLUMN_WIDTH,
|
|
29
|
-
capabilities: {
|
|
30
|
-
editable: true,
|
|
31
|
-
sortable: false,
|
|
32
|
-
filterable: false,
|
|
33
|
-
groupable: false,
|
|
34
|
-
pivotable: false,
|
|
35
|
-
aggregatable: false,
|
|
36
|
-
},
|
|
37
|
-
presentation: {
|
|
38
|
-
align: "center",
|
|
39
|
-
headerAlign: "center",
|
|
40
|
-
},
|
|
41
|
-
meta: {
|
|
42
|
-
isSystem: true,
|
|
43
|
-
rowSelection: true,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
const isRowSelectionColumnKey = (columnKey) => columnKey === ROW_SELECTION_COLUMN_KEY;
|
|
49
|
-
const isRowSelectionColumn = (column) => isRowSelectionColumnKey(column.key);
|
|
50
|
-
const orderedVisibleColumns = computed(() => {
|
|
51
|
-
const selectionColumn = rowSelectionColumn.value;
|
|
52
|
-
const left = options.visibleColumns.value.filter((column) => column.pin === "left");
|
|
53
|
-
const center = options.visibleColumns.value.filter((column) => column.pin !== "left" && column.pin !== "right");
|
|
54
|
-
const right = options.visibleColumns.value.filter((column) => column.pin === "right");
|
|
55
|
-
return selectionColumn ? [selectionColumn, ...left, ...center, ...right] : [...left, ...center, ...right];
|
|
56
|
-
});
|
|
57
|
-
const centerColumns = computed(() => (orderedVisibleColumns.value.filter((column) => column.pin !== "left" && column.pin !== "right")));
|
|
58
|
-
const resolveColumnWidth = (column) => {
|
|
59
|
-
return column.width ?? DEFAULT_COLUMN_WIDTH;
|
|
60
|
-
};
|
|
61
|
-
const stageColumnStyle = (columnKey) => {
|
|
62
|
-
const column = orderedVisibleColumns.value.find((candidate) => candidate.key === columnKey);
|
|
63
|
-
const width = column ? resolveColumnWidth(column) : DEFAULT_COLUMN_WIDTH;
|
|
64
|
-
const px = `${width}px`;
|
|
65
|
-
return {
|
|
66
|
-
width: px,
|
|
67
|
-
minWidth: px,
|
|
68
|
-
maxWidth: px,
|
|
69
|
-
};
|
|
70
|
-
};
|
|
71
|
-
const isColumnEditable = (column) => {
|
|
72
|
-
return column.column.capabilities?.editable !== false;
|
|
73
|
-
};
|
|
74
|
-
const isCellEditable = (row, rowIndex, column) => {
|
|
75
|
-
if (isRowSelectionColumn(column)) {
|
|
76
|
-
return row.kind !== "group" && row.rowId != null;
|
|
77
|
-
}
|
|
78
|
-
if (row.kind === "group" || row.rowId == null || !isColumnEditable(column)) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
if (!options.isCellEditable) {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
return options.isCellEditable({
|
|
85
|
-
row: row.data,
|
|
86
|
-
rowId: row.rowId,
|
|
87
|
-
rowIndex,
|
|
88
|
-
column: column.column,
|
|
89
|
-
columnKey: column.key,
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
const resolveEditableColumn = (columnKey, columnIndex) => {
|
|
93
|
-
const columnAtIndex = orderedVisibleColumns.value[columnIndex];
|
|
94
|
-
if (columnAtIndex?.key === columnKey) {
|
|
95
|
-
return { column: columnAtIndex, columnIndex };
|
|
96
|
-
}
|
|
97
|
-
const resolvedColumnIndex = orderedVisibleColumns.value.findIndex((column) => column.key === columnKey);
|
|
98
|
-
if (resolvedColumnIndex < 0) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
return {
|
|
102
|
-
column: orderedVisibleColumns.value[resolvedColumnIndex],
|
|
103
|
-
columnIndex: resolvedColumnIndex,
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
const isCellEditableByKey = (row, rowIndex, columnKey, columnIndex) => {
|
|
107
|
-
const resolved = resolveEditableColumn(columnKey, columnIndex);
|
|
108
|
-
if (!resolved) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
return isCellEditable(row, rowIndex, resolved.column);
|
|
112
|
-
};
|
|
113
|
-
return {
|
|
114
|
-
orderedVisibleColumns,
|
|
115
|
-
centerColumns,
|
|
116
|
-
resolveColumnWidth,
|
|
117
|
-
stageColumnStyle,
|
|
118
|
-
isRowSelectionColumnKey,
|
|
119
|
-
isRowSelectionColumn,
|
|
120
|
-
isCellEditable,
|
|
121
|
-
isCellEditableByKey,
|
|
122
|
-
rowSelectionColumn,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { computed } from "vue";
|
|
2
|
-
export function useDataGridTableStageFillAction(options) {
|
|
3
|
-
const fillActionAnchorCell = computed(() => {
|
|
4
|
-
const session = options.lastAppliedFill.value;
|
|
5
|
-
const activeSelectionRange = options.selectionRange.value;
|
|
6
|
-
if (!session || !activeSelectionRange || options.isFillDragging.value) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
if (session.allowBehaviorToggle === false) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
if (session.previewRange.startRow !== activeSelectionRange.startRow
|
|
13
|
-
|| session.previewRange.endRow !== activeSelectionRange.endRow
|
|
14
|
-
|| session.previewRange.startColumn !== activeSelectionRange.startColumn
|
|
15
|
-
|| session.previewRange.endColumn !== activeSelectionRange.endColumn) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
rowIndex: session.previewRange.endRow,
|
|
20
|
-
columnIndex: session.previewRange.endColumn,
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
const fillActionBehavior = computed(() => options.lastAppliedFill.value?.behavior ?? null);
|
|
24
|
-
return {
|
|
25
|
-
fillActionAnchorCell,
|
|
26
|
-
fillActionBehavior,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { useDataGridAppIntentHistory } from "@affino/datagrid-vue";
|
|
2
|
-
export function useDataGridTableStageHistory(options) {
|
|
3
|
-
const internalIntentHistory = options.history
|
|
4
|
-
? null
|
|
5
|
-
: useDataGridAppIntentHistory({
|
|
6
|
-
runtime: options.runtime,
|
|
7
|
-
cloneRowData: options.cloneRowData,
|
|
8
|
-
syncViewport: options.syncViewport,
|
|
9
|
-
});
|
|
10
|
-
const captureHistorySnapshot = () => {
|
|
11
|
-
if (options.history) {
|
|
12
|
-
return options.history.captureSnapshot();
|
|
13
|
-
}
|
|
14
|
-
return internalIntentHistory?.captureRowsSnapshot() ?? null;
|
|
15
|
-
};
|
|
16
|
-
const recordHistoryIntentTransaction = (descriptor, beforeSnapshot) => {
|
|
17
|
-
if (options.history) {
|
|
18
|
-
void options.history.recordIntentTransaction(descriptor, beforeSnapshot);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
void internalIntentHistory?.recordIntentTransaction(descriptor, beforeSnapshot);
|
|
22
|
-
};
|
|
23
|
-
const canUndoHistory = () => {
|
|
24
|
-
return options.history ? options.history.canUndo() : (internalIntentHistory?.canUndo.value ?? false);
|
|
25
|
-
};
|
|
26
|
-
const canRedoHistory = () => {
|
|
27
|
-
return options.history ? options.history.canRedo() : (internalIntentHistory?.canRedo.value ?? false);
|
|
28
|
-
};
|
|
29
|
-
const runHistoryAction = (direction) => {
|
|
30
|
-
if (options.history) {
|
|
31
|
-
return options.history.runHistoryAction(direction);
|
|
32
|
-
}
|
|
33
|
-
return internalIntentHistory?.runHistoryAction(direction) ?? Promise.resolve(null);
|
|
34
|
-
};
|
|
35
|
-
const disposeIntentHistory = () => {
|
|
36
|
-
internalIntentHistory?.dispose();
|
|
37
|
-
};
|
|
38
|
-
return {
|
|
39
|
-
captureHistorySnapshot,
|
|
40
|
-
recordHistoryIntentTransaction,
|
|
41
|
-
canUndoHistory,
|
|
42
|
-
canRedoHistory,
|
|
43
|
-
runHistoryAction,
|
|
44
|
-
disposeIntentHistory,
|
|
45
|
-
};
|
|
46
|
-
}
|