Skip to content

Commit

Permalink
feat: make it available to make the "select-all" checkbox always visi…
Browse files Browse the repository at this point in the history
…ble (#22)
  • Loading branch information
vabrahamyanadobe committed Jun 14, 2023
1 parent c91add1 commit 7016f88
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions packages/core/src/data-grid/data-grid-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,17 @@ export function drawHeader(
) {
const isCheckboxHeader = c.title.startsWith(headerCellCheckboxPrefix);
const menuBounds = getHeaderMenuBounds(x, y, width, height);

let checked: boolean | BooleanIndeterminate = undefined;

if (isCheckboxHeader) {
if (c.title === headerCellCheckedMarker) checked = true;
if (c.title === headerCellUnheckedMarker) checked = false;
if (checked !== true) {
ctx.globalAlpha = hoverAmount;
}
}

if (drawHeaderCallback !== undefined) {
let passCol = c;
if (isCheckboxHeader) {
Expand Down Expand Up @@ -693,12 +704,6 @@ export function drawHeader(
}

if (isCheckboxHeader) {
let checked: boolean | BooleanIndeterminate = undefined;
if (c.title === headerCellCheckedMarker) checked = true;
if (c.title === headerCellUnheckedMarker) checked = false;
if (checked !== true) {
ctx.globalAlpha = hoverAmount;
}
drawCheckbox(ctx, theme, checked, x, y, width, height, false, undefined, undefined);
if (checked !== true) {
ctx.globalAlpha = 1;
Expand Down Expand Up @@ -1855,7 +1860,7 @@ export interface DrawGridArg {
readonly groupHeaderHeight: number;
readonly disabledRows: CompactSelection;
readonly rowHeight: number | ((index: number) => number);
readonly resizeCol: number | undefined,
readonly resizeCol: number | undefined;
readonly verticalBorder: (col: number) => boolean;
readonly isResizing: boolean;
readonly isFocused: boolean;
Expand Down Expand Up @@ -2516,15 +2521,15 @@ export function drawGrid(arg: DrawGridArg, lastArg: DrawGridArg | undefined) {

if(isResizing){
walkColumns(effectiveCols, 0, translateX, 0, totalHeaderHeight, (c, x) => {

if(c.sourceIndex === resizeCol) {
drawColumnResizeOutline(overlayCtx, x+c.width, 0, totalHeaderHeight+1, theme );
drawColumnResizeOutline(targetCtx, x+c.width, totalHeaderHeight, height, theme );
}
}
});

}

targetCtx.restore();
overlayCtx.restore();
}
Expand Down

0 comments on commit 7016f88

Please sign in to comment.