mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
chore: list filter field
This commit is contained in:
parent
c2b8beffac
commit
2122cfb152
|
@ -7,7 +7,7 @@ const i18nPrefix = 'workflow.errorMsg'
|
|||
const nodeDefault: NodeDefault<ListFilterNodeType> = {
|
||||
defaultValue: {
|
||||
variable: [],
|
||||
orderBy: {
|
||||
order_by: {
|
||||
enabled: false,
|
||||
key: '',
|
||||
value: OrderBy.ASC,
|
||||
|
|
|
@ -60,14 +60,14 @@ const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({
|
|||
title={t(`${i18nPrefix}.orderBy`)}
|
||||
operations={
|
||||
<Switch
|
||||
defaultValue={inputs.orderBy?.enabled}
|
||||
defaultValue={inputs.order_by?.enabled}
|
||||
onChange={handleOrderByEnabledChange}
|
||||
size='md'
|
||||
disabled={readOnly}
|
||||
/>
|
||||
}
|
||||
>
|
||||
{inputs.orderBy?.enabled
|
||||
{inputs.order_by?.enabled
|
||||
? (
|
||||
<div className='flex items-center justify-between'>
|
||||
{hasSubVariable && (
|
||||
|
@ -77,12 +77,12 @@ const Panel: FC<NodePanelProps<ListFilterNodeType>> = ({
|
|||
<OptionCard
|
||||
title={t(`${i18nPrefix}.asc`)}
|
||||
onSelect={handleOrderByTypeChange(OrderBy.ASC)}
|
||||
selected={inputs.orderBy.value === OrderBy.ASC}
|
||||
selected={inputs.order_by.value === OrderBy.ASC}
|
||||
/>
|
||||
<OptionCard
|
||||
title={t(`${i18nPrefix}.desc`)}
|
||||
onSelect={handleOrderByTypeChange(OrderBy.DESC)}
|
||||
selected={inputs.orderBy.value === OrderBy.DESC}
|
||||
selected={inputs.order_by.value === OrderBy.DESC}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -10,10 +10,16 @@ export type Limit = {
|
|||
size?: number
|
||||
}
|
||||
|
||||
export type Condition = {
|
||||
key: string
|
||||
comparison_operator: string
|
||||
value: string
|
||||
}
|
||||
|
||||
export type ListFilterNodeType = CommonNodeType & {
|
||||
variable: ValueSelector
|
||||
filterBy: []
|
||||
orderBy: {
|
||||
filter_by: Condition[]
|
||||
order_by: {
|
||||
enabled: boolean
|
||||
key: ValueSelector | string
|
||||
value: OrderBy
|
||||
|
|
|
@ -62,7 +62,7 @@ const useConfig = (id: string, payload: ListFilterNodeType) => {
|
|||
|
||||
const handleOrderByEnabledChange = useCallback((enabled: boolean) => {
|
||||
const newInputs = produce(inputs, (draft) => {
|
||||
draft.orderBy.enabled = enabled
|
||||
draft.order_by.enabled = enabled
|
||||
})
|
||||
setInputs(newInputs)
|
||||
}, [inputs, setInputs])
|
||||
|
@ -70,7 +70,7 @@ const useConfig = (id: string, payload: ListFilterNodeType) => {
|
|||
const handleOrderByTypeChange = useCallback((type: OrderBy) => {
|
||||
return () => {
|
||||
const newInputs = produce(inputs, (draft) => {
|
||||
draft.orderBy.value = type
|
||||
draft.order_by.value = type
|
||||
})
|
||||
setInputs(newInputs)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user