-
-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·85 lines (80 loc) · 2.42 KB
/
index.js
File metadata and controls
executable file
·85 lines (80 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import React from 'react';
import { Select, Option, TextInput, GridItem } from '@strapi/design-system';
import { useIntl } from 'react-intl';
const operators = [
'$not',
'$eq',
'$eqi',
'$ne',
'$in',
'$notIn',
'$lt',
'$lte',
'$gt',
'$gte',
'$between',
'$contains',
'$notContains',
'$containsi',
'$notContainsi',
'$startsWith',
'$endsWith',
'$null',
'$notNull',
];
const SelectConditional = (props) => {
const { formatMessage } = useIntl();
const {
contentType,
disabled,
onConditionChange,
onOperatorChange,
onValueChange,
condition,
conditionOperator,
conditionValue,
} = props;
return (
<>
<GridItem col={4}>
<Select
name="select"
label={formatMessage({ id: 'sitemap.Settings.Field.SelectConditional.Label', defaultMessage: 'Attribute' })}
hint={formatMessage({ id: 'sitemap.Settings.Field.SelectConditional.Description', defaultMessage: 'Select an attribute' })}
disabled={disabled}
onChange={(condition) => onConditionChange(condition)}
value={condition}
>
{contentType && contentType.attributes.map((attribute) => {
return <Option value={attribute} key={attribute}>{attribute}</Option>;
})}
</Select>
</GridItem>
<GridItem col={2}>
<Select
name="select"
label={formatMessage({ id: 'sitemap.Settings.Field.SelectOperator.Label', defaultMessage: 'Operator' })}
hint={formatMessage({ id: 'sitemap.Settings.Field.SelectOperator.Description', defaultMessage: 'Select an operator' })}
disabled={disabled}
onChange={(operator) => onOperatorChange(operator)}
value={conditionOperator}
>
{operators.map((operator) => {
return <Option value={operator} key={operator}>{operator}</Option>;
})}
</Select>
</GridItem>
<GridItem col={6}>
<TextInput
disabled={disabled}
label={formatMessage({ id: 'sitemap.Settings.Field.SelectConditionValue.Label', defaultMessage: 'Value' })}
name="conditionValue"
hint={formatMessage({ id: 'sitemap.Settings.Field.SelectConditionValue.Description', defaultMessage: '"Text", true, 2, etc' })}
onChange={(e) => onValueChange(e.target.value)}
value={conditionValue}
/>
</GridItem>
</>
);
};
export default SelectConditional;