feat(frontend): Ag Grid compactness (#3052)

* feat(frontend): add support for compactness

* feat(frontend): add support for compactness

* feat(frontend): cleanup

* feat(frontend): rowHeight onMount

* feat(frontend): move rowHeights definition
This commit is contained in:
Faton Ramadani
2024-01-24 11:10:10 +01:00
committed by GitHub
parent ddfde994ee
commit 622f3264c9
2 changed files with 20 additions and 0 deletions
@@ -30,6 +30,12 @@
const { app, worldStore, selectedComponent, componentControl, darkMode } =
getContext<AppViewerContext>('AppViewerContext')
const rowHeights = {
normal: 40,
compact: 30,
comfortable: 50
}
let css = initCss($app.css?.aggridcomponent, customCss)
let result: any[] | undefined = undefined
@@ -154,6 +160,9 @@
editable: resolvedConfig?.allEditable,
onCellValueChanged
},
rowHeight: resolvedConfig.compactness
? rowHeights[resolvedConfig.compactness]
: rowHeights['normal'],
rowSelection: resolvedConfig?.multipleSelectable ? 'multiple' : 'single',
rowMultiSelectWithClick: resolvedConfig?.multipleSelectable
? resolvedConfig.rowMultiselectWithClick
@@ -229,6 +238,7 @@
onSelectionChanged(api)
}
}
function updateOptions() {
try {
api?.updateGridOptions({
@@ -248,6 +258,9 @@
rowMultiSelectWithClick: resolvedConfig?.multipleSelectable
? resolvedConfig.rowMultiselectWithClick
: undefined,
rowHeight: resolvedConfig.compactness
? rowHeights[resolvedConfig.compactness]
: rowHeights['normal'],
...(resolvedConfig?.extraConfig ?? {})
})
} catch (e) {
@@ -639,6 +639,13 @@ const aggridcomponentconst = {
fieldType: 'object',
value: {},
tooltip: 'any configuration that can be passed to ag-grid top level'
},
compactness: {
type: 'static',
fieldType: 'select',
value: 'normal',
selectOptions: ['normal', 'compact', 'comfortable'],
tooltip: 'Change the row height'
}
},
componentInput: {