• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

glideapps / glide-data-grid / 6997418563

26 Nov 2023 06:56PM UTC coverage: 86.42% (+1.0%) from 85.416%
6997418563

push

github

web-flow
5.3.1 (#781)

* 5.3.1-alpha1

* Fix issue where data grid would not understand headers were not hovered when mouse over the rightElement

* Update prettier

* Modernize tooling

* Don't escape for commas, not needed

* Fix eslint

* 5.3.1-alpha2

* Improve naming of escape function

* Fix fuzzy drag handles, fixes #741

* Fix tests

* Resolve issue where editing would accidentally check the wrong cell for read/write.

* restore cyce  checking

* Ensure onCellClicked and renderer onClick events fire under the same conditions, fixes #690

* Fix paste eating some new lines

* 5.3.1-alpha3

* Fix clicking on scrollbars, fixes #762

* Hopefully fix source tests

* Implement cut and fix crasher in paste

* Fix cells tests

* Fix formatting issue with uri cells

* Add tests

* Overhaul copy/paste code to dramatically improve accuracy, compatibility, and remove accidentally encoding nbsp into users apps

* Fix an insane crash report

* Add a couple tests

* Increase test coverage

* Add more missing tests

* More missing tests

* Fix issue with apple numbers paste buffers

* Fix typo

* Add more tests

* More tests for image window loader

* Add distribution test

* Add support for returning bounds of entire scroll area (#788)

* Support returning bounds of entire scroll area

* Add scale to calculation

* Apply PR feedback

* Fix check

* Additional fix

* Fix docs

---------

Co-authored-by: Lukas Masuch <Lukas.Masuch@gmail.com>

3386 of 4456 branches covered (0.0%)

214 of 231 new or added lines in 29 files covered. (92.64%)

347 existing lines in 14 files now uncovered.

4022 of 4654 relevant lines covered (86.42%)

3209.78 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.91
/packages/core/src/data-editor/use-rem-adjuster.ts
1
import React from "react";
10✔
2
import { getDataEditorTheme, type Theme } from "../common/styles";
10✔
3

4
interface DataEditorDimensions {
5
    rowHeight: number | ((n: number) => number);
6
    headerHeight: number;
7
    groupHeaderHeight: number;
8
    theme: Partial<Theme> | undefined;
9
    overscrollX: number | undefined;
10
    overscrollY: number | undefined;
11
}
12

13
interface DataEditorProps {
14
    rowHeight: number | ((n: number) => number);
15
    headerHeight: number;
16
    groupHeaderHeight: number;
17
    theme?: Partial<Theme>;
18
    overscrollX?: number;
19
    overscrollY?: number;
20
    scaleToRem: boolean;
21
    remSize: number;
22
}
23

24
export function useRemAdjuster({
25
    rowHeight: rowHeightIn,
26
    headerHeight: headerHeightIn,
27
    groupHeaderHeight: groupHeaderHeightIn,
28
    theme: themeIn,
29
    overscrollX: overscrollXIn,
30
    overscrollY: overscrollYIn,
31
    scaleToRem,
32
    remSize,
33
}: DataEditorProps): DataEditorDimensions {
34
    const [rowHeight, headerHeight, groupHeaderHeight, theme, overscrollX, overscrollY] = React.useMemo(() => {
651✔
35
        if (!scaleToRem || remSize === 16)
135✔
36
            return [rowHeightIn, headerHeightIn, groupHeaderHeightIn, themeIn, overscrollXIn, overscrollYIn];
133✔
37
        const scaler = remSize / 16;
2✔
38
        const rh = rowHeightIn;
2✔
39
        const bt = getDataEditorTheme();
2✔
40
        return [
2✔
NEW
41
            typeof rh === "number" ? rh * scaler : (n: number) => Math.ceil(rh(n) * scaler),
×
42
            Math.ceil(headerHeightIn * scaler),
43
            Math.ceil(groupHeaderHeightIn * scaler),
44
            {
45
                ...themeIn,
46
                headerIconSize: (themeIn?.headerIconSize ?? bt.headerIconSize) * scaler,
12!
47
                cellHorizontalPadding: (themeIn?.cellHorizontalPadding ?? bt.cellHorizontalPadding) * scaler,
12!
48
                cellVerticalPadding: (themeIn?.cellVerticalPadding ?? bt.cellVerticalPadding) * scaler,
12!
49
            },
50
            Math.ceil((overscrollXIn ?? 0) * scaler),
6!
51
            Math.ceil((overscrollYIn ?? 0) * scaler),
6!
52
        ];
53
    }, [groupHeaderHeightIn, headerHeightIn, overscrollXIn, overscrollYIn, remSize, rowHeightIn, scaleToRem, themeIn]);
54

55
    return { rowHeight, headerHeight, groupHeaderHeight, theme, overscrollX, overscrollY };
651✔
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc