Fixed height bug

This commit is contained in:
Hein
2025-10-15 13:12:02 +02:00
parent f058336597
commit f084cf70ae
3 changed files with 40 additions and 8 deletions

View File

@@ -64,10 +64,13 @@ export interface GridlerProps extends PropsWithChildren {
glideProps?: Partial<DataEditorProps>;
headerHeight?: number;
height?: number | string;
hideMenu?: (id: string) => void;
keyField?: string;
maxConcurrency?: number;
onChange?: (values: Array<Record<string, any>>) => void;
onMounted?: (getState: GridlerState['getState'], setState: GridlerState['setState']) => void;
onUnMounted?: () => void;
pageSize?: number;
progressiveScroll?: boolean;
RenderCell?: <TRowType extends Record<string, string>>(
@@ -92,6 +95,7 @@ export interface GridlerProps extends PropsWithChildren {
uniqueid: string;
useAPIQuery?: (index: number) => Promise<Array<Record<string, any>>>;
values?: Array<Record<string, any>>;
width?: number | string;
}
export interface GridlerState {
@@ -680,8 +684,28 @@ const { Provider, useStore: useGridlerStore } = createSyncStore<GridlerStoreStat
const menus = useMantineBetterMenus();
useEffect(() => {
const onMounted = getState('onMounted');
if (typeof onMounted === 'function') {
onMounted(getState, setState);
}
setState('mounted', true);
}, [setState]);
if (window && window.document) {
const portalElement = window.document.getElementById('portal');
if (!portalElement) {
const div = window.document.createElement('div');
div.id = 'portal';
div.setAttribute('data-gridler-portal', props.uniqueid);
window.document.body.appendChild(div);
}
}
return () => {
const onUnMounted = getState('onUnMounted');
setState('mounted', false);
if (typeof onUnMounted === 'function') {
onUnMounted();
}
};
}, [setState, getState]);
/// logic to apply the selected row.
useEffect(() => {