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

teableio / teable / 8538004962

03 Apr 2024 11:36AM UTC coverage: 18.233% (-3.3%) from 21.535%
8538004962

Pull #528

github

web-flow
Merge c1a248a6f into 45ee7ebb3
Pull Request #528: feat: Kanban view

575 of 1136 branches covered (50.62%)

29 of 2908 new or added lines in 83 files covered. (1.0%)

5 existing lines in 5 files now uncovered.

6439 of 35315 relevant lines covered (18.23%)

3.94 hits per line

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

0.0
/packages/sdk/src/components/grid-enhancements/hooks/use-grid-icons.ts
1
/* eslint-disable @typescript-eslint/naming-convention */
×
2
import type { RatingIcon } from '@teable/core';
×
3
import { Check, DraggableHandle, Maximize2 } from '@teable/icons';
×
4
import { useMemo } from 'react';
×
5
import { useFieldStaticGetter } from '../../../hooks/use-field-static-getter';
×
6
import { FIELD_TYPE_ORDER, getSpriteMap } from '../../../utils';
×
NEW
7
import { RATING_ICON_MAP } from '../../cell-value';
×
8
import { RowControlType } from '../../grid/interface';
×
9

×
10
export const useGridIcons = () => {
×
11
  const getFieldStatic = useFieldStaticGetter();
×
12

×
13
  return useMemo(() => {
×
14
    const columnHeaderIcons = getSpriteMap(
×
15
      FIELD_TYPE_ORDER.reduce<
×
16
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
×
17
        { type: string; IconComponent: React.JSXElementConstructor<any> }[]
×
18
      >((pre, type) => {
×
19
        const IconComponent = getFieldStatic(type, false)?.Icon;
×
20
        const LookupIconComponent = getFieldStatic(type, true)?.Icon;
×
21
        pre.push({ type: type, IconComponent });
×
22
        if (LookupIconComponent) {
×
23
          pre.push({ type: `${type}_lookup`, IconComponent: LookupIconComponent });
×
24
        }
×
25
        return pre;
×
26
      }, [])
×
27
    );
×
28
    const rowHeaderIcons = getSpriteMap([
×
29
      {
×
30
        type: RowControlType.Drag,
×
31
        IconComponent: DraggableHandle,
×
32
      },
×
33
      {
×
34
        type: RowControlType.Expand,
×
35
        IconComponent: Maximize2,
×
36
      },
×
37
      {
×
38
        type: RowControlType.Checkbox,
×
39
        IconComponent: Check,
×
40
      },
×
41
    ]);
×
42
    const ratingIcons = getSpriteMap(
×
43
      (Object.keys(RATING_ICON_MAP) as RatingIcon[]).map((iconKey) => ({
×
44
        type: iconKey,
×
45
        IconComponent: RATING_ICON_MAP[iconKey],
×
46
      }))
×
47
    );
×
48
    return {
×
49
      ...columnHeaderIcons,
×
50
      ...rowHeaderIcons,
×
51
      ...ratingIcons,
×
52
    };
×
53
  }, [getFieldStatic]);
×
54
};
×
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