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

glideapps / glide-data-grid / 7455656024

09 Jan 2024 01:59AM CUT coverage: 92.126% (+5.7%) from 86.42%
7455656024

Pull #810

github

jassmith
Fix jitter with freeze rows. Still inefficient
Pull Request #810: 6.0.0

2722 of 3335 branches covered (0.0%)

16509 of 17920 relevant lines covered (92.13%)

3197.67 hits per line

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

78.85
/packages/core/src/internal/data-grid-overlay-editor/private/uri-overlay-editor.tsx
1
import { EditPencil } from "../../../common/utils.js";
1✔
2
import * as React from "react";
1✔
3
import { GrowingEntry } from "../../growing-entry/growing-entry.js";
1✔
4
import { UriOverlayEditorStyle } from "./uri-overlay-editor-style.js";
1✔
5
import type { SelectionRange } from "../../data-grid/data-grid-types.js";
1✔
6

1✔
7
interface Props {
1✔
8
    readonly uri: string;
1✔
9
    readonly onChange: (ev: React.ChangeEvent<HTMLTextAreaElement>) => void;
1✔
10
    readonly forceEditMode: boolean;
1✔
11
    readonly readonly: boolean;
1✔
12
    readonly preview: string;
1✔
13
    readonly validatedSelection?: SelectionRange;
1✔
14
}
1✔
15

1✔
16
const UriOverlayEditor: React.FunctionComponent<Props> = p => {
1✔
17
    const { uri, onChange, forceEditMode, readonly, validatedSelection, preview } = p;
1✔
18

1✔
19
    const [editMode, setEditMode] = React.useState<boolean>(uri === "" || forceEditMode);
1✔
20

1✔
21
    const onEditClick = React.useCallback(() => {
1✔
22
        setEditMode(true);
×
23
    }, []);
1✔
24

1✔
25
    if (editMode) {
1!
26
        return (
×
27
            <GrowingEntry
×
28
                validatedSelection={validatedSelection}
×
29
                highlight={true}
×
30
                autoFocus={true}
×
31
                value={uri}
×
32
                onChange={onChange}
×
33
            />
×
34
        );
×
35
    }
×
36

1✔
37
    return (
1✔
38
        <UriOverlayEditorStyle>
1✔
39
            <a className="gdg-link-area" href={uri} target="_blank" rel="noopener noreferrer">
1✔
40
                {preview}
1✔
41
            </a>
1✔
42
            {!readonly && (
1✔
43
                <div className="gdg-edit-icon" onClick={onEditClick}>
1✔
44
                    <EditPencil />
1✔
45
                </div>
1✔
46
            )}
1✔
47
            <textarea className="gdg-input" autoFocus={true} />
1✔
48
        </UriOverlayEditorStyle>
1✔
49
    );
1✔
50
};
1✔
51

1✔
52
export default UriOverlayEditor;
1✔
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