Commit 77c8261f authored by Joel's avatar Joel

chore: if not align

parent 91a2e71f
...@@ -16,6 +16,7 @@ type Props = { ...@@ -16,6 +16,7 @@ type Props = {
onChange: (value: any) => void onChange: (value: any) => void
uppercase?: boolean uppercase?: boolean
popupClassName?: string popupClassName?: string
itemClassName?: string
readonly?: boolean readonly?: boolean
showChecked?: boolean showChecked?: boolean
} }
...@@ -27,6 +28,7 @@ const TypeSelector: FC<Props> = ({ ...@@ -27,6 +28,7 @@ const TypeSelector: FC<Props> = ({
onChange, onChange,
uppercase, uppercase,
popupClassName, popupClassName,
itemClassName,
readonly, readonly,
showChecked, showChecked,
}) => { }) => {
...@@ -64,7 +66,7 @@ const TypeSelector: FC<Props> = ({ ...@@ -64,7 +66,7 @@ const TypeSelector: FC<Props> = ({
setHide() setHide()
onChange(item.value) onChange(item.value)
}} }}
className={cn(uppercase && 'uppercase', 'flex items-center h-[30px] justify-between min-w-[44px] px-3 rounded-lg cursor-pointer text-[13px] font-medium text-gray-700 hover:bg-gray-50')} className={cn(itemClassName, uppercase && 'uppercase', 'flex items-center h-[30px] justify-between min-w-[44px] px-3 rounded-lg cursor-pointer text-[13px] font-medium text-gray-700 hover:bg-gray-50')}
> >
<div>{item.label}</div> <div>{item.label}</div>
{showChecked && item.value === value && <Check className='text-primary-600 w-4 h-4' />} {showChecked && item.value === value && <Check className='text-primary-600 w-4 h-4' />}
......
...@@ -85,6 +85,7 @@ const Item: FC<ItemProps> = ({ ...@@ -85,6 +85,7 @@ const Item: FC<ItemProps> = ({
onLogicalOperatorToggle, onLogicalOperatorToggle,
}) => { }) => {
const { t } = useTranslation() const { t } = useTranslation()
const isValueReadOnly = [ComparisonOperator.empty, ComparisonOperator.notEmpty, ComparisonOperator.isNull, ComparisonOperator.isNotNull].includes(payload.comparison_operator)
const handleVarReferenceChange = useCallback((value: ValueSelector) => { const handleVarReferenceChange = useCallback((value: ValueSelector) => {
onChange({ onChange({
...@@ -140,8 +141,9 @@ const Item: FC<ItemProps> = ({ ...@@ -140,8 +141,9 @@ const Item: FC<ItemProps> = ({
<Selector <Selector
popupClassName='top-[34px]' popupClassName='top-[34px]'
itemClassName='capitalize'
trigger={ trigger={
<div className='shrink-0 whitespace-nowrap flex items-center h-8 justify-between px-2.5 rounded-lg bg-gray-100 capitalize'> <div className='shrink-0 w-[100px] whitespace-nowrap flex items-center h-8 justify-between px-2.5 rounded-lg bg-gray-100 capitalize cursor-pointer'>
<div className='text-[13px] font-normal text-gray-900'>{isComparisonOperatorNeedTranslate(payload.comparison_operator) ? t(`${i18nPrefix}.comparisonOperator.${payload.comparison_operator}`) : payload.comparison_operator}</div> <div className='text-[13px] font-normal text-gray-900'>{isComparisonOperatorNeedTranslate(payload.comparison_operator) ? t(`${i18nPrefix}.comparisonOperator.${payload.comparison_operator}`) : payload.comparison_operator}</div>
</div> </div>
} }
...@@ -157,11 +159,11 @@ const Item: FC<ItemProps> = ({ ...@@ -157,11 +159,11 @@ const Item: FC<ItemProps> = ({
/> />
<input <input
readOnly={readonly} readOnly={readonly || isValueReadOnly}
value={payload.value} value={!isValueReadOnly ? payload.value : ''}
onChange={handleValueChange} onChange={handleValueChange}
placeholder={t(`${i18nPrefix}.enterValue`)!} placeholder={!isValueReadOnly ? t(`${i18nPrefix}.enterValue`)! : ''}
className='max-w-[144px] h-8 leading-8 px-2.5 rounded-lg border-0 bg-gray-100 text-gray-900 text-[13px] placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200' className='w-[80px] h-8 leading-8 px-2.5 rounded-lg border-0 bg-gray-100 text-gray-900 text-[13px] placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200'
type='text' type='text'
/> />
......
...@@ -84,8 +84,8 @@ const translation = { ...@@ -84,8 +84,8 @@ const translation = {
'end with': 'end with', 'end with': 'end with',
'is': 'is', 'is': 'is',
'is not': 'is not', 'is not': 'is not',
'empty': 'empty', 'empty': 'is empty',
'not empty': 'not empty', 'not empty': 'is not empty',
'null': 'is null', 'null': 'is null',
'not null': 'is not null', 'not null': 'is not null',
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment