mirror of
https://github.com/enso-org/enso.git
synced 2024-12-24 15:22:01 +03:00
text format selection bug (#10940)
* re introduce dropdown functionality * on change re draw row heights
This commit is contained in:
parent
4709076061
commit
9e5773a865
@ -631,6 +631,7 @@ onMounted(() => {
|
||||
:columnDefs="columnDefs"
|
||||
:rowData="rowData"
|
||||
:defaultColDef="defaultColDef"
|
||||
:textFormatOption="textFormatterSelected"
|
||||
@sortOrFilterUpdated="(e) => checkSortAndFilter(e)"
|
||||
/>
|
||||
</Suspense>
|
||||
|
@ -29,7 +29,8 @@ import type {
|
||||
GridApi,
|
||||
RowHeightParams,
|
||||
} from 'ag-grid-enterprise'
|
||||
import { type ComponentInstance, reactive, ref, shallowRef } from 'vue'
|
||||
import { type ComponentInstance, reactive, ref, shallowRef, watch } from 'vue'
|
||||
import { TextFormatOptions } from '../visualizations/TableVisualization.vue'
|
||||
|
||||
const DEFAULT_ROW_HEIGHT = 22
|
||||
|
||||
@ -41,6 +42,7 @@ const _props = defineProps<{
|
||||
components?: Record<string, unknown>
|
||||
singleClickEdit?: boolean
|
||||
stopEditingWhenCellsLoseFocus?: boolean
|
||||
textFormatOption?: TextFormatOptions
|
||||
}>()
|
||||
const emit = defineEmits<{
|
||||
cellEditingStarted: [event: CellEditingStartedEvent]
|
||||
@ -62,6 +64,9 @@ function onGridReady(event: GridReadyEvent) {
|
||||
}
|
||||
|
||||
function getRowHeight(params: RowHeightParams): number {
|
||||
if (_props.textFormatOption === TextFormatOptions.Off) {
|
||||
return DEFAULT_ROW_HEIGHT
|
||||
}
|
||||
const rowData = Object.values(params.data)
|
||||
const textValues = rowData.filter((r): r is string => typeof r === 'string')
|
||||
|
||||
@ -80,6 +85,14 @@ function getRowHeight(params: RowHeightParams): number {
|
||||
return (maxReturnCharsCount + 1) * DEFAULT_ROW_HEIGHT
|
||||
}
|
||||
|
||||
watch(
|
||||
() => _props.textFormatOption,
|
||||
() => {
|
||||
gridApi.value?.redrawRows()
|
||||
gridApi.value?.resetRowHeights()
|
||||
},
|
||||
)
|
||||
|
||||
function updateColumnWidths(event: FirstDataRenderedEvent | RowDataUpdatedEvent) {
|
||||
if (event.columnApi == null) {
|
||||
console.warn('AG Grid column API does not exist.')
|
||||
|
Loading…
Reference in New Issue
Block a user