@alaarab/ogrid-vue-vuetify 2.0.5 → 2.0.6
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, computed, h, Teleport } from 'vue';
|
|
2
2
|
import { VCheckbox, VProgressCircular, VBtn } from 'vuetify/components';
|
|
3
|
-
import {
|
|
3
|
+
import { useDataGridTableSetup, getHeaderFilterConfig, getCellRenderDescriptor, resolveCellDisplayContent, resolveCellStyle, buildInlineEditorProps, buildPopoverEditorProps, getCellInteractionProps, buildHeaderRows, CHECKBOX_COLUMN_WIDTH, ROW_NUMBER_COLUMN_WIDTH, DEFAULT_MIN_COLUMN_WIDTH, } from '@alaarab/ogrid-vue';
|
|
4
4
|
import { ColumnHeaderFilter } from '../ColumnHeaderFilter';
|
|
5
5
|
import { InlineCellEditor } from './InlineCellEditor';
|
|
6
6
|
import { StatusBar } from './StatusBar';
|
|
@@ -13,36 +13,8 @@ export const DataGridTable = defineComponent({
|
|
|
13
13
|
gridProps: { type: Object, required: true },
|
|
14
14
|
},
|
|
15
15
|
setup(props) {
|
|
16
|
-
const wrapperRef = ref(null);
|
|
17
|
-
const tableContainerRef = ref(null);
|
|
18
|
-
const lastMouseShift = ref(false);
|
|
19
16
|
const propsRef = computed(() => props.gridProps);
|
|
20
|
-
const state =
|
|
21
|
-
// Column reorder — setup scope for lifecycle hooks
|
|
22
|
-
const columnOrderRef = computed(() => {
|
|
23
|
-
const p = props.gridProps;
|
|
24
|
-
if (p.columnOrder)
|
|
25
|
-
return p.columnOrder;
|
|
26
|
-
return flattenColumns(p.columns).filter(c => p.visibleColumns?.has(c.columnId) ?? true).map(c => c.columnId);
|
|
27
|
-
});
|
|
28
|
-
const onColumnOrderChangeRef = computed(() => props.gridProps.onColumnOrderChange);
|
|
29
|
-
const tableRef = ref(null);
|
|
30
|
-
const { isDragging: isReorderDragging, dropIndicatorX, handleHeaderMouseDown: handleReorderMouseDown } = useColumnReorder({
|
|
31
|
-
columnOrder: columnOrderRef,
|
|
32
|
-
onColumnOrderChange: onColumnOrderChangeRef,
|
|
33
|
-
tableRef,
|
|
34
|
-
});
|
|
35
|
-
// Virtual scrolling — setup scope for lifecycle hooks
|
|
36
|
-
const virtualScrollEnabled = computed(() => props.gridProps.virtualScroll?.enabled ?? false);
|
|
37
|
-
const totalRowsRef = computed(() => props.gridProps.items.length);
|
|
38
|
-
const rowHeight = props.gridProps.virtualScroll?.rowHeight ?? 36;
|
|
39
|
-
const overscan = props.gridProps.virtualScroll?.overscan ?? 5;
|
|
40
|
-
const { containerRef: vsContainerRef, visibleRange, totalHeight, scrollToRow } = useVirtualScroll({
|
|
41
|
-
totalRows: totalRowsRef,
|
|
42
|
-
rowHeight,
|
|
43
|
-
enabled: virtualScrollEnabled,
|
|
44
|
-
overscan,
|
|
45
|
-
});
|
|
17
|
+
const { wrapperRef, tableContainerRef, tableRef, lastMouseShift, state, columnReorder: { isDragging: isReorderDragging, dropIndicatorX, handleHeaderMouseDown: handleReorderMouseDown }, virtualScroll: { containerRef: vsContainerRef, visibleRange, totalHeight, scrollToRow }, virtualScrollEnabled, columnResize: { handleResizeStart, getColumnWidth }, } = useDataGridTableSetup({ props: propsRef });
|
|
46
18
|
return () => {
|
|
47
19
|
/**
|
|
48
20
|
* Vue Performance: Fine-grained reactivity vs React memoization
|
|
@@ -68,7 +40,7 @@ export const DataGridTable = defineComponent({
|
|
|
68
40
|
const interaction = state.interaction.value;
|
|
69
41
|
const ctxMenu = state.contextMenu.value;
|
|
70
42
|
const viewModels = state.viewModels.value;
|
|
71
|
-
const { visibleCols, hasCheckboxCol, hasRowNumbersCol, colOffset, containerWidth, minTableWidth, desiredTableWidth,
|
|
43
|
+
const { visibleCols, hasCheckboxCol, hasRowNumbersCol, colOffset, containerWidth, minTableWidth, desiredTableWidth, } = layout;
|
|
72
44
|
const currentPage = props.gridProps.currentPage ?? 1;
|
|
73
45
|
const pageSize = props.gridProps.pageSize ?? 25;
|
|
74
46
|
const rowNumberOffset = hasRowNumbersCol ? (currentPage - 1) * pageSize : 0;
|
|
@@ -91,10 +63,6 @@ export const DataGridTable = defineComponent({
|
|
|
91
63
|
const fitToContent = layoutMode === 'content';
|
|
92
64
|
const allowOverflowX = !suppressHorizontalScroll && containerWidth > 0 && (minTableWidth > containerWidth || desiredTableWidth > containerWidth);
|
|
93
65
|
const headerRows = buildHeaderRows(p.columns, p.visibleColumns);
|
|
94
|
-
const { handleResizeStart, getColumnWidth } = useColumnResize({
|
|
95
|
-
columnSizingOverrides: computed(() => columnSizingOverrides),
|
|
96
|
-
setColumnSizingOverrides,
|
|
97
|
-
});
|
|
98
66
|
const editCallbacks = { commitCellEdit, setEditingCell, setPendingEditorValue, cancelPopoverEdit };
|
|
99
67
|
const interactionHandlers = { handleCellMouseDown, setActiveCell, setEditingCell, handleCellContextMenu };
|
|
100
68
|
const handleSingleRowClick = (e) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-vue-vuetify",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "OGrid Vuetify – Vuetify-based data grid with sorting, filtering, pagination, column chooser, and CSV export.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"files": ["dist", "README.md", "LICENSE"],
|
|
23
23
|
"engines": { "node": ">=18" },
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@alaarab/ogrid-vue": "2.0.
|
|
25
|
+
"@alaarab/ogrid-vue": "2.0.6"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"vue": "^3.3.0",
|
|
@@ -32,9 +32,10 @@
|
|
|
32
32
|
"vue": "^3.5.28",
|
|
33
33
|
"vuetify": "^3.11.8",
|
|
34
34
|
"@vitejs/plugin-vue": "^6.0.4",
|
|
35
|
-
"vite": "^7.
|
|
36
|
-
"vite-plugin-dts": "^4.5.
|
|
37
|
-
"typescript": "^5.
|
|
35
|
+
"vite": "^7.3.1",
|
|
36
|
+
"vite-plugin-dts": "^4.5.4",
|
|
37
|
+
"typescript": "^5.9.3"
|
|
38
38
|
},
|
|
39
|
+
"sideEffects": false,
|
|
39
40
|
"publishConfig": { "access": "public" }
|
|
40
41
|
}
|