Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pro:search): add
mutiSegment
field (#1574)
feat(pro:search): add visible and extends for custom field config
- Loading branch information
Showing
26 changed files
with
827 additions
and
495 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
order: 31 | ||
title: | ||
zh: 多段搜索项 | ||
en: Multi-Segment search field | ||
--- | ||
|
||
## zh | ||
|
||
通过 `'multiSegment'` 类型的searchField自定义搜索项。 | ||
|
||
## en | ||
|
||
Create multi-segment custom searchField using field with type `'multiSegment'`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<template> | ||
<IxProSearch | ||
v-model:value="searchValue" | ||
style="width: 100%" | ||
:searchFields="searchFields" | ||
:onChange="onChange" | ||
:onSearch="onSearch" | ||
overlayContainer="demo-pro-search-custom" | ||
/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import type { SearchField, SearchValue } from '@idux/pro/search' | ||
import { ref } from 'vue' | ||
const searchValue = ref<SearchValue[]>([]) | ||
const searchFields: SearchField[] = [ | ||
{ | ||
type: 'multiSegment', | ||
key: 'multi_segment_field', | ||
label: 'User', | ||
defaultValue: ['is', 'evil', 'designer'], | ||
fieldConfig: { | ||
segments: [ | ||
{ | ||
name: 'custom:operator', | ||
extends: 'select', | ||
config: { | ||
dataSource: [ | ||
{ | ||
key: 'is', | ||
label: 'is', | ||
}, | ||
{ | ||
key: 'is_not', | ||
label: 'is not', | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
name: 'segment1', | ||
extends: 'select', | ||
config: { | ||
dataSource: [ | ||
{ | ||
key: 'righteous', | ||
label: 'righteous', | ||
}, | ||
{ | ||
key: 'evil', | ||
label: 'evil', | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
name: 'segment2', | ||
extends: 'select', | ||
config: { | ||
dataSource: [ | ||
{ | ||
key: 'designer', | ||
label: 'designer', | ||
}, | ||
{ | ||
key: 'developer', | ||
label: 'developer', | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
] | ||
const onChange = (value: SearchValue[] | undefined, oldValue: SearchValue[] | undefined) => { | ||
console.log(value, oldValue) | ||
} | ||
const onSearch = () => { | ||
console.log('onSearch') | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.