1
1
import { WidgetProps } from '@rjsf/core' ;
2
2
import { applyDefaultTheme , ITheme , DropdownSelect as Select , IOption , useTheme } from '@apitable/components' ;
3
- import { FieldType , Field , useFields , useField } from '@apitable/widget-sdk' ;
3
+ import { Field , useFields , useField , FieldIconMap } from '@apitable/widget-sdk' ;
4
4
import React from 'react' ;
5
- import {
6
- ColumnAttachmentFilled ,
7
- ColumnAutonumberFilled ,
8
- AccountFilled ,
9
- ColumnCheckboxFilled ,
10
- ColumnLastmodifiedtimeFilled ,
11
- ColumnTextFilled ,
12
- ColumnCreatedbyFilled ,
13
- ColumnCreatedtimeFilled ,
14
- ColumnSingleFilled ,
15
- ColumnCurrencyFilled ,
16
- ColumnEmailFilled ,
17
- ColumnFormulaFilled ,
18
- ColumnPercentFilled ,
19
- ColumnFigureFilled ,
20
- ColumnMultipleFilled ,
21
- ColumnCalendarFilled ,
22
- ColumnUrlOutlined ,
23
- ColumnLastmodifiedbyFilled ,
24
- ColumnLongtextFilled ,
25
- ColumnPhoneFilled ,
26
- ColumnLookupFilled ,
27
- ColumnRatingFilled ,
28
- CascadeOutlined ,
29
- OneWayLinkOutlined ,
30
- TwoWayLinkOutlined
31
- } from '@apitable/icons' ;
32
5
import { SELECT_OPEN_SEARCH_COUNT } from '../const' ;
33
6
import styled from 'styled-components' ;
34
7
import { Strings , t } from '../i18n' ;
35
8
36
- const FieldIconMap = {
37
- // [FieldType.DeniedField]: LockFilled,
38
- [ FieldType . Text ] : ColumnLongtextFilled , // FIXME: There is a problem with the icon naming.
39
- [ FieldType . Number ] : ColumnFigureFilled , // FIXME: There is a problem with the icon naming.
40
- [ FieldType . SingleSelect ] : ColumnSingleFilled ,
41
- [ FieldType . MultiSelect ] : ColumnMultipleFilled ,
42
- [ FieldType . DateTime ] : ColumnCalendarFilled , // FIXME: There is a problem with the icon naming.
43
- [ FieldType . Attachment ] : ColumnAttachmentFilled ,
44
- [ FieldType . OneWayLink ] : OneWayLinkOutlined ,
45
- [ FieldType . TwoWayLink ] : TwoWayLinkOutlined ,
46
- [ FieldType . MagicLink ] : TwoWayLinkOutlined , // ?
47
- [ FieldType . URL ] : ColumnUrlOutlined ,
48
- [ FieldType . Email ] : ColumnEmailFilled ,
49
- [ FieldType . Phone ] : ColumnPhoneFilled ,
50
- [ FieldType . Checkbox ] : ColumnCheckboxFilled ,
51
- [ FieldType . Rating ] : ColumnRatingFilled ,
52
- [ FieldType . Member ] : AccountFilled ,
53
- [ FieldType . MagicLookUp ] : ColumnLookupFilled ,
54
- [ FieldType . Formula ] : ColumnFormulaFilled ,
55
- [ FieldType . Currency ] : ColumnCurrencyFilled ,
56
- [ FieldType . Percent ] : ColumnPercentFilled ,
57
- [ FieldType . SingleText ] : ColumnTextFilled ,
58
- [ FieldType . AutoNumber ] : ColumnAutonumberFilled ,
59
- [ FieldType . CreatedTime ] : ColumnCreatedtimeFilled ,
60
- [ FieldType . LastModifiedTime ] : ColumnLastmodifiedtimeFilled ,
61
- [ FieldType . CreatedBy ] : ColumnCreatedbyFilled ,
62
- [ FieldType . LastModifiedBy ] : ColumnLastmodifiedbyFilled ,
63
- [ FieldType . Cascader ] : CascadeOutlined
64
- } ;
65
-
66
9
const transformOptions = ( enumOptions : { label : string , value : any } [ ] , theme : ITheme , fields : Field [ ] ) => {
67
10
const fieldMap = new Map ( fields . map ( field => [ field . id , field ] ) ) ;
68
11
return enumOptions . map ( option => {
@@ -74,7 +17,7 @@ const transformOptions = (enumOptions: { label: string, value: any }[], theme: I
74
17
if ( ! field ) {
75
18
return res ;
76
19
}
77
- const FieldIcon = FieldIconMap [ field . type ] ;
20
+ const FieldIcon = FieldIconMap [ field . type ] ?? '' ;
78
21
return {
79
22
...res ,
80
23
// disabled: field.type === FieldType.DeniedField,
0 commit comments