Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/gui/.dev-env
11 changes: 3 additions & 8 deletions app/gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@
"playwright:install": "playwright install chromium"
},
"dependencies": {
"@ag-grid-community/client-side-row-model": "^32.3.3",
"@ag-grid-community/core": "^32.3.3",
"@ag-grid-community/locale": "^32.3.3",
"@ag-grid-community/styles": "^32.3.3",
"@ag-grid-enterprise/core": "^32.3.3",
"@ag-grid-enterprise/range-selection": "^32.3.3",
"aws-amplify": "^6.16.0",
"@babel/parser": "^7.26.3",
"@codemirror/autocomplete": "catalog:",
Expand Down Expand Up @@ -78,8 +72,9 @@
"@vue/reactivity": "^3.5.13",
"@vueuse/core": "^13.0.0",
"@vueuse/gesture": "^2.0.0",
"ag-grid-community": "^32.3.3",
"ag-grid-enterprise": "^32.3.3",
"ag-grid-community": "^35.2.1",
"ag-grid-enterprise": "^35.2.1",
"ag-grid-vue3": "^35.2.1",
"ajv": "^8.17.1",
"amazon-cognito-identity-js": "6.3.6",
"codemirror": "^6.0.2",
Expand Down
2 changes: 0 additions & 2 deletions app/gui/src/project-view/components/AgGridTableView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,4 @@ defineOptions({ inheritAttrs: false })
</Suspense>
</template>

<style src="@ag-grid-community/styles/ag-grid.css" />
<style src="@ag-grid-community/styles/ag-theme-alpine.css" />
<style src="@/components/shared/AgGridTableView/tableViewStyle.css" />
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import { targetIsOutside } from '@/util/autoBlur'
import { ProjectPath } from '@/util/projectPath'
import type { Identifier, QualifiedName } from '@/util/qualifiedName'
import { useToast } from '@/util/toast'
import '@ag-grid-community/styles/ag-grid.css'
import '@ag-grid-community/styles/ag-theme-alpine.css'
import type {
ColDef,
ColumnMovedEvent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from '$/providers/openedProjects/widgetRegistry/editHandler'
import { type ToValue } from '$/utils/reactivity'
import { NEW_COLUMN_ID } from '@/components/GraphEditor/widgets/WidgetTableEditor/tableInputArgument'
import { type CellPosition, type StartEditingCellParams } from 'ag-grid-enterprise'
import type { GridApi } from 'ag-grid-enterprise'
import { computed, ref, type ShallowRef, toValue, watch } from 'vue'

export interface EditedCell {
Expand All @@ -19,14 +19,7 @@ export interface EditedCell {
* and react for user input received from them.
*/
export function useTableEditHandler(
gridApi: ToValue<
| {
stopEditing(cancel: boolean): void
startEditingCell(editedCell: StartEditingCellParams): void
getEditingCells(): Array<CellPosition>
}
| undefined
>,
gridApi: ToValue<GridApi | undefined>,
colDefs: ToValue<{ colId: string }[]>,
widgetHandlerConstructor: (hooks: WidgetEditHooks) => ShallowRef<WidgetEditHandler>,
) {
Expand All @@ -43,10 +36,7 @@ export function useTableEditHandler(
const editedInGrid = api.getEditingCells()[0]
if (cell == null || cell.rowIndex === 'header') {
api.stopEditing(false)
} else if (
editedInGrid?.rowIndex !== cell.rowIndex ||
editedInGrid?.column.getColId() !== cell.colKey
) {
} else if (editedInGrid?.rowIndex !== cell.rowIndex || editedInGrid?.colId !== cell.colKey) {
api.startEditingCell({ rowIndex: cell.rowIndex, colKey: cell.colKey })
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Ast } from '@/util/ast'
import { arrayEquals, findIndexOpt } from '@/util/data/array'
import { ProjectPath } from '@/util/projectPath'
import { qnLastSegment, type QualifiedName } from '@/util/qualifiedName'
import type { ColDef } from 'ag-grid-enterprise'
import type { ColDef, DefaultMenuItem } from 'ag-grid-enterprise'
import * as iter from 'enso-common/src/utilities/data/iter'
import {
Err,
Expand Down Expand Up @@ -50,8 +50,8 @@ export interface ColumnDef extends ColDef<RowData> {
colId: string
valueGetter: ({ data }: { data: RowData | undefined }) => any
valueSetter?: ({ data, newValue }: { data: RowData; newValue: string }) => boolean
mainMenuItems: (string | MenuItem<RowData>)[]
contextMenuItems: (string | MenuItem<RowData>)[]
mainMenuItems: (DefaultMenuItem | MenuItem<RowData>)[]
contextMenuItems: (DefaultMenuItem | MenuItem<RowData>)[]
rowDrag?: ({ data }: { data: RowData | undefined }) => boolean
headerComponentParams: ColumnSpecificParams
}
Expand Down
18 changes: 7 additions & 11 deletions app/gui/src/project-view/components/shared/AgGridTableView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ export type AgGridTableViewProps<TData, TValue> = {
suppressMoveWhenColumnDragging?: boolean
textFormatOption?: TextFormatOptions
processDataFromClipboard?: (params: ProcessDataFromClipboardParams<TData>) => string[][] | null
datasource?: IServerSideDatasource | boolean
datasource?: IServerSideDatasource | undefined
rowCount?: number
isServerSideModel?: boolean
gridIdHash?: string | null
getContextMenuItems?: (
params: GetContextMenuItemsParams,
) => (MenuItemDef | string)[] | GetContextMenuItems
getContextMenuItems?: GetContextMenuItems<TData> | undefined
}

/**
Expand Down Expand Up @@ -109,7 +106,6 @@ import type {
ColumnVisibleEvent,
FirstDataRenderedEvent,
GetContextMenuItems,
GetContextMenuItemsParams,
GetRowIdFunc,
GridApi,
GridReadyEvent,
Expand Down Expand Up @@ -165,7 +161,7 @@ function onGridReady(event: GridReadyEvent<TData>) {
}
}

const rowModelType = computed(() => (props.isServerSideModel ? 'serverSide' : 'clientSide'))
const rowModelType = computed(() => (props.datasource ? 'serverSide' : 'clientSide'))

const gridKeyIncrement = ref(0)
const gridKey = computed(() =>
Expand Down Expand Up @@ -366,7 +362,8 @@ function getRowHeight(params: RowHeightParams): number {
return (maxReturnCharsCount + 1) * DEFAULT_ROW_HEIGHT
}

const { AgGridVue } = await import('./AgGridTableView/AgGridVue')
const { AgGridVue } = await import('@/components/shared/AgGridTableView/agGrid')
const { themeAlpine } = await import('ag-grid-community')
</script>

<template>
Expand Down Expand Up @@ -404,7 +401,8 @@ const { AgGridVue } = await import('./AgGridTableView/AgGridVue')
:allowContextMenuWithControlKey="true"
:cacheBlockSize="rowModelType === 'clientSide' ? undefined : 1000"
:getContextMenuItems="getContextMenuItems"
:getRowHeight="rowModelType === 'clientSide' ? getRowHeight : null"
:getRowHeight="rowModelType === 'clientSide' ? getRowHeight : undefined"
:theme="themeAlpine"
@gridReady="onGridReady"
@firstDataRendered="updateColumnWidths"
@rowDataUpdated="(updateColumnWidths($event), emit('rowDataUpdated', $event))"
Expand All @@ -423,6 +421,4 @@ const { AgGridVue } = await import('./AgGridTableView/AgGridVue')
</div>
</template>

<style src="@ag-grid-community/styles/ag-grid.css" />
<style src="@ag-grid-community/styles/ag-theme-alpine.css" />
<style src="@/components/shared/AgGridTableView/tableViewStyle.css" />
Loading
Loading