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

teableio / teable / 8536869866

03 Apr 2024 10:05AM CUT coverage: 21.234% (-0.3%) from 21.535%
8536869866

Pull #514

github

web-flow
Merge 91a25d710 into 45ee7ebb3
Pull Request #514: refactor: user and link selector

1394 of 2532 branches covered (55.06%)

27 of 1620 new or added lines in 60 files covered. (1.67%)

4 existing lines in 2 files now uncovered.

14588 of 68702 relevant lines covered (21.23%)

2.02 hits per line

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

0.0
/packages/sdk/src/components/filter/condition/OperatorSelect.tsx
1
import type { IFilterOperator } from '@teable/core';
×
2
import { getValidFilterOperators } from '@teable/core';
×
NEW
3
import { useMemo } from 'react';
×
4
import { useField } from '../../../hooks';
×
5
import { BaseSingleSelect } from '../component';
×
6
import { getFieldOperatorMapping } from '../utils';
×
7

×
8
interface IOperatorOptions {
×
9
  value: IFilterOperator;
×
10
  label: string;
×
11
}
×
12

×
13
interface IOperatorSelectProps {
×
14
  value: string | null;
×
15
  fieldId: string;
×
16
  onSelect: (value: string | null) => void;
×
17
}
×
18

×
19
function OperatorSelect(props: IOperatorSelectProps) {
×
20
  const { onSelect, fieldId, value } = props;
×
21
  const field = useField(fieldId);
×
22
  const labelMapping = useMemo(() => getFieldOperatorMapping(field?.type), [field]);
×
23
  const operatorOption = useMemo<IOperatorOptions[]>(() => {
×
24
    if (field) {
×
25
      return getValidFilterOperators(field).map((operator) => ({
×
26
        label: labelMapping[operator],
×
27
        value: operator,
×
28
      }));
×
29
    }
×
30
    return [] as IOperatorOptions[];
×
31
  }, [field, labelMapping]);
×
32
  const shouldDisabled = useMemo(() => {
×
33
    return field?.type === 'checkbox';
×
34
  }, [field]);
×
35

×
36
  return (
×
37
    <BaseSingleSelect
×
38
      value={value}
×
39
      options={operatorOption}
×
40
      popoverClassName="w-48"
×
41
      className="m-1 w-32 shrink-0 justify-between"
×
42
      onSelect={onSelect}
×
43
      disabled={shouldDisabled}
×
44
    />
×
45
  );
×
46
}
×
47

×
48
export { OperatorSelect };
×
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