mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-16 21:35:10 +00:00
[TSK-1374] Restrict "ValueFilter" searchable types (#3148)
Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@icloud.com>
This commit is contained in:
parent
30980a8556
commit
488c46e7d8
@ -13,7 +13,7 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Class, Doc, FindResult, getObjectValue, Ref, SortingOrder, Space } from '@hcengineering/core'
|
||||
import core, { Class, Doc, FindResult, getObjectValue, Ref, SortingOrder, Space } from '@hcengineering/core'
|
||||
import { translate } from '@hcengineering/platform'
|
||||
import presentation, { getClient } from '@hcengineering/presentation'
|
||||
import ui, { Button, Icon, IconCheck, Label, Loading, resizeObserver, deviceOptionsStore } from '@hcengineering/ui'
|
||||
@ -31,6 +31,12 @@
|
||||
filter.modes = [view.filter.FilterValueIn, view.filter.FilterValueNin]
|
||||
filter.mode = filter.mode === undefined ? filter.modes[0] : filter.mode
|
||||
|
||||
// TODO: remove "TypeString" from search types after
|
||||
// a separate filter for strings is implemented
|
||||
$: isSearchable = [core.class.TypeNumber, core.class.TypeString, core.class.EnumOf].includes(
|
||||
filter.key.attribute.type._class
|
||||
)
|
||||
|
||||
const client = getClient()
|
||||
const key = { key: filter.key.key }
|
||||
const promise = getPresenter(client, filter.key._class, key, key)
|
||||
@ -48,7 +54,7 @@
|
||||
values.clear()
|
||||
realValues.clear()
|
||||
const resultQuery =
|
||||
search !== ''
|
||||
isSearchable && search !== ''
|
||||
? {
|
||||
[filter.key.key]: { $like: '%' + search + '%' }
|
||||
}
|
||||
@ -124,17 +130,19 @@
|
||||
</script>
|
||||
|
||||
<div class="selectPopup" use:resizeObserver={() => dispatch('changeContent')}>
|
||||
<div class="header">
|
||||
<input
|
||||
bind:this={searchInput}
|
||||
type="text"
|
||||
bind:value={search}
|
||||
on:change={() => {
|
||||
getValues(search)
|
||||
}}
|
||||
placeholder={phTraslate}
|
||||
/>
|
||||
</div>
|
||||
{#if isSearchable}
|
||||
<div class="header">
|
||||
<input
|
||||
bind:this={searchInput}
|
||||
type="text"
|
||||
bind:value={search}
|
||||
on:change={() => {
|
||||
getValues(search)
|
||||
}}
|
||||
placeholder={phTraslate}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="scroll">
|
||||
<div class="box">
|
||||
{#await promise then attribute}
|
||||
|
Loading…
Reference in New Issue
Block a user