mirror of
https://github.com/enso-org/enso.git
synced 2024-12-25 03:43:41 +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"
|
:columnDefs="columnDefs"
|
||||||
:rowData="rowData"
|
:rowData="rowData"
|
||||||
:defaultColDef="defaultColDef"
|
:defaultColDef="defaultColDef"
|
||||||
|
:textFormatOption="textFormatterSelected"
|
||||||
@sortOrFilterUpdated="(e) => checkSortAndFilter(e)"
|
@sortOrFilterUpdated="(e) => checkSortAndFilter(e)"
|
||||||
/>
|
/>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
@ -29,7 +29,8 @@ import type {
|
|||||||
GridApi,
|
GridApi,
|
||||||
RowHeightParams,
|
RowHeightParams,
|
||||||
} from 'ag-grid-enterprise'
|
} 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
|
const DEFAULT_ROW_HEIGHT = 22
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ const _props = defineProps<{
|
|||||||
components?: Record<string, unknown>
|
components?: Record<string, unknown>
|
||||||
singleClickEdit?: boolean
|
singleClickEdit?: boolean
|
||||||
stopEditingWhenCellsLoseFocus?: boolean
|
stopEditingWhenCellsLoseFocus?: boolean
|
||||||
|
textFormatOption?: TextFormatOptions
|
||||||
}>()
|
}>()
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
cellEditingStarted: [event: CellEditingStartedEvent]
|
cellEditingStarted: [event: CellEditingStartedEvent]
|
||||||
@ -62,6 +64,9 @@ function onGridReady(event: GridReadyEvent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getRowHeight(params: RowHeightParams): number {
|
function getRowHeight(params: RowHeightParams): number {
|
||||||
|
if (_props.textFormatOption === TextFormatOptions.Off) {
|
||||||
|
return DEFAULT_ROW_HEIGHT
|
||||||
|
}
|
||||||
const rowData = Object.values(params.data)
|
const rowData = Object.values(params.data)
|
||||||
const textValues = rowData.filter((r): r is string => typeof r === 'string')
|
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
|
return (maxReturnCharsCount + 1) * DEFAULT_ROW_HEIGHT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => _props.textFormatOption,
|
||||||
|
() => {
|
||||||
|
gridApi.value?.redrawRows()
|
||||||
|
gridApi.value?.resetRowHeights()
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
function updateColumnWidths(event: FirstDataRenderedEvent | RowDataUpdatedEvent) {
|
function updateColumnWidths(event: FirstDataRenderedEvent | RowDataUpdatedEvent) {
|
||||||
if (event.columnApi == null) {
|
if (event.columnApi == null) {
|
||||||
console.warn('AG Grid column API does not exist.')
|
console.warn('AG Grid column API does not exist.')
|
||||||
|
Loading…
Reference in New Issue
Block a user