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

teableio / teable / 8462522206

28 Mar 2024 04:40AM UTC coverage: 21.846% (+0.008%) from 21.838%
8462522206

Pull #507

github

web-flow
Merge f0c665d42 into 3f55c76b9
Pull Request #507: feat: search api

1396 of 2499 branches covered (55.86%)

28 of 293 new or added lines in 77 files covered. (9.56%)

117 existing lines in 30 files now uncovered.

14546 of 66583 relevant lines covered (21.85%)

2.09 hits per line

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

0.0
/packages/sdk/src/components/expand-record/RecordEditor.tsx
1
import { Button } from '@teable/ui-lib';
×
2
import { useRef } from 'react';
×
3
import { useMeasure, useToggle } from 'react-use';
×
4
import type { Field, Record } from '../../model';
×
5
import { RecordEditorItem } from './RecordEditorItem';
×
6

×
7
// eslint-disable-next-line @typescript-eslint/naming-convention
×
8
const EDITOR_VERTICAL_MIN = 570;
×
9

×
10
export const RecordEditor = (props: {
×
11
  fields: Field[];
×
12
  record: Record | undefined;
×
13
  hiddenFields?: Field[];
×
14
  onChange?: (newValue: unknown, fieldId: string) => void;
×
15
  readonly?: boolean;
×
16
}) => {
×
17
  const [ref, { width }] = useMeasure<HTMLDivElement>();
×
18
  const wrapRef = useRef<HTMLDivElement>(null);
×
19
  const { fields, hiddenFields = [], record, onChange, readonly } = props;
×
20
  const vertical = width > EDITOR_VERTICAL_MIN;
×
21
  const [showHiddenFields, toggle] = useToggle(false);
×
22

×
23
  return (
×
24
    <div ref={ref} className="max-w-2xl">
×
25
      <div ref={wrapRef} className="mx-auto space-y-6">
×
26
        {fields.map((field) => (
×
27
          <RecordEditorItem
×
28
            key={field.id}
×
29
            vertical={vertical}
×
30
            field={field}
×
31
            record={record}
×
32
            onChange={onChange}
×
33
            readonly={readonly}
×
34
          />
×
35
        ))}
×
36
        {hiddenFields.length !== 0 && (
×
37
          <div className="flex items-center gap-2">
×
NEW
38
            <div className="border-top-width h-[1px] flex-1 bg-border" />
×
39
            <Button variant={'outline'} size={'xs'} onClick={toggle}>
×
40
              {showHiddenFields ? 'Hide' : 'Show'} {hiddenFields.length} hidden field
×
41
            </Button>
×
NEW
42
            <div className="border-top-width h-[1px] flex-1 bg-border" />
×
43
          </div>
×
44
        )}
×
45
        {showHiddenFields &&
×
46
          hiddenFields?.map((field) => (
×
47
            <RecordEditorItem
×
48
              key={field.id}
×
49
              vertical={vertical}
×
50
              field={field}
×
51
              record={record}
×
52
              onChange={onChange}
×
53
              readonly={readonly}
×
54
            />
×
55
          ))}
×
56
      </div>
×
57
    </div>
×
58
  );
×
59
};
×
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