docs(changeset): Fixed spreaing of grid props

This commit is contained in:
Hein 2025-10-22 13:35:18 +02:00
parent d0911d842a
commit d7f4d0db37
2 changed files with 104 additions and 104 deletions

View File

@ -0,0 +1,5 @@
---
'@warkypublic/oranguru': patch
---
Fixed spreaing of grid props

View File

@ -121,114 +121,109 @@ export const GridlerDataGrid = () => {
}, 100); }, 100);
} }
}} }}
ref={refWrapper}
> >
{sections?.left} {sections?.left}
<div
ref={refWrapper}
style={{
flexGrow: 2,
height: '100%',
minHeight: '80px',
width: '100%',
}}
>
{width && width > 0 && height && height > 0 && (
<DataEditor
cellActivationBehavior="double-click"
//getCelrefMergedlContent={getCellContent}
columns={(renderColumns as Array<GridColumn>) ?? []}
columnSelect="none"
drawFocusRing
getCellContent={getCellContent}
getCellsForSelection={getCellsForSelection}
getRowThemeOverride={theme.getRowThemeOverride}
gridSelection={_gridSelection}
headerHeight={headerHeight ?? 32}
headerIcons={{ sort: SortSprite, sortdown: SortDownSprite, sortup: SortUpSprite }}
height={(height ?? 400) - 4}
onCellContextMenu={(cell, event) => {
event.preventDefault();
if (!refContextActivated.current) {
refContextActivated.current = true;
onContextClick('cell', event, cell[0], cell[1]);
setTimeout(() => {
refContextActivated.current = false;
}, 100);
}
}}
onCellEdited={onCellEdited}
onColumnMoved={onColumnMoved}
onColumnProposeMove={onColumnProposeMove}
onColumnResize={onColumnResize}
onGridSelectionChange={(selection) => {
let rows = CompactSelection.empty();
const currentSelection = getState('_gridSelection');
for (const r of selection.rows) {
rows = rows.hasIndex(r) ? rows : rows.add(r);
}
if (selectMode === 'row' && selection.current?.range) {
for (
let y = selection.current.range.y;
y < selection.current.range.y + selection.current.range.height;
y++
) {
rows = rows.hasIndex(y) ? rows : rows.add(y);
}
}
if ( {width && width > 0 && height && height > 0 && (
JSON.stringify(currentSelection?.columns) !== JSON.stringify(selection.columns) || <DataEditor
JSON.stringify(currentSelection?.rows) !== JSON.stringify(rows) || cellActivationBehavior="double-click"
JSON.stringify(currentSelection?.current) !== JSON.stringify(selection.current) //getCelrefMergedlContent={getCellContent}
) { columns={(renderColumns as Array<GridColumn>) ?? []}
setState('_gridSelection', { ...selection, rows }); columnSelect="none"
if (JSON.stringify(currentSelection?.rows) !== JSON.stringify(rows)) { drawFocusRing
setState('_gridSelectionRows', rows); height={(height ?? 400) - 4}
} rangeSelect="multi-rect"
} rowMarkers={{
checkboxStyle: 'square',
//console.log('Selection', selection); kind: 'both',
}} }}
onHeaderClicked={onHeaderClicked} rowSelect="multi"
onHeaderContextMenu={(col, event) => { rowSelectionMode="auto"
event.preventDefault(); spanRangeBehavior="default"
if (!refContextActivated.current) { {...glideProps}
refContextActivated.current = true; getCellContent={getCellContent}
onContextClick('header', event as any, col); getCellsForSelection={getCellsForSelection}
setTimeout(() => { getRowThemeOverride={theme.getRowThemeOverride}
refContextActivated.current = false; gridSelection={_gridSelection}
}, 100); headerHeight={headerHeight ?? 32}
} headerIcons={{ sort: SortSprite, sortdown: SortDownSprite, sortup: SortUpSprite }}
}} onCellContextMenu={(cell, event) => {
onHeaderMenuClick={onHeaderMenuClick} event.preventDefault();
onItemHovered={onItemHovered} glideProps?.onCellContextMenu?.(cell, event);
onVisibleRegionChanged={onVisibleRegionChanged} if (!refContextActivated.current) {
rangeSelect="multi-rect" refContextActivated.current = true;
ref={refMerged as React.Ref<DataEditorRef>} onContextClick('cell', event, cell[0], cell[1]);
rightElement={ setTimeout(() => {
<Group> refContextActivated.current = false;
{sections?.rightElementStart} }, 100);
<RightMenuIcon />
{sections?.rightElementEnd}
</Group>
} }
rowHeight={rowHeight ?? 22} }}
//rowMarkersCheckboxStyle='square' onCellEdited={onCellEdited}
//rowMarkersKind='both' onColumnMoved={onColumnMoved}
rowMarkers={{ onColumnProposeMove={onColumnProposeMove}
checkboxStyle: 'square', onColumnResize={onColumnResize}
kind: 'both', onGridSelectionChange={(selection) => {
}} let rows = CompactSelection.empty();
rows={total_rows ?? 0} const currentSelection = getState('_gridSelection');
rowSelect="multi" for (const r of selection.rows) {
rowSelectionMode="auto" rows = rows.hasIndex(r) ? rows : rows.add(r);
spanRangeBehavior="default" }
theme={theme.gridTheme} if (selectMode === 'row' && selection.current?.range) {
width={width ?? 200} for (
{...glideProps} let y = selection.current.range.y;
/> y < selection.current.range.y + selection.current.range.height;
)} y++
</div> ) {
rows = rows.hasIndex(y) ? rows : rows.add(y);
}
}
if (
JSON.stringify(currentSelection?.columns) !== JSON.stringify(selection.columns) ||
JSON.stringify(currentSelection?.rows) !== JSON.stringify(rows) ||
JSON.stringify(currentSelection?.current) !== JSON.stringify(selection.current)
) {
setState('_gridSelection', { ...selection, rows });
if (JSON.stringify(currentSelection?.rows) !== JSON.stringify(rows)) {
setState('_gridSelectionRows', rows);
}
}
//console.log('Selection', selection);
}}
onHeaderClicked={onHeaderClicked}
onHeaderContextMenu={(col, event) => {
event.preventDefault();
if (!refContextActivated.current) {
refContextActivated.current = true;
onContextClick('header', event as any, col);
setTimeout(() => {
refContextActivated.current = false;
}, 100);
}
}}
onHeaderMenuClick={onHeaderMenuClick}
onItemHovered={onItemHovered}
onVisibleRegionChanged={onVisibleRegionChanged}
ref={refMerged as React.Ref<DataEditorRef>}
rightElement={
<Group>
{sections?.rightElementStart}
<RightMenuIcon />
{sections?.rightElementEnd}
</Group>
}
rowHeight={rowHeight ?? 22}
//rowMarkersCheckboxStyle='square'
//rowMarkersKind='both'
rows={total_rows ?? 0}
theme={theme.gridTheme}
width={width ?? 200}
/>
)}
{/* </Portal> */} {/* </Portal> */}
<Computer /> <Computer />
{!hasLocalData && <Pager />} {!hasLocalData && <Pager />}