mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 19:44:59 +03:00
Allow filtering assignee list (#2708)
Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@xored.com>
This commit is contained in:
parent
126098d2ba
commit
99bef1d311
@ -48,6 +48,7 @@
|
|||||||
export let prevAssigned: Ref<Employee>[] | undefined = []
|
export let prevAssigned: Ref<Employee>[] | undefined = []
|
||||||
export let projectLead: Ref<Employee> | undefined = undefined
|
export let projectLead: Ref<Employee> | undefined = undefined
|
||||||
export let projectMembers: Ref<Employee>[] | undefined = []
|
export let projectMembers: Ref<Employee>[] | undefined = []
|
||||||
|
export let allowDeselect = true
|
||||||
export let titleDeselect: IntlString | undefined = undefined
|
export let titleDeselect: IntlString | undefined = undefined
|
||||||
export let readonly = false
|
export let readonly = false
|
||||||
export let kind: ButtonKind = 'no-border'
|
export let kind: ButtonKind = 'no-border'
|
||||||
@ -95,6 +96,7 @@
|
|||||||
icon,
|
icon,
|
||||||
selected: value,
|
selected: value,
|
||||||
placeholder,
|
placeholder,
|
||||||
|
allowDeselect,
|
||||||
titleDeselect
|
titleDeselect
|
||||||
},
|
},
|
||||||
!$$slots.content ? container : getEventPositionElement(ev),
|
!$$slots.content ? container : getEventPositionElement(ev),
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
export let prevAssigned: Ref<Employee>[] | undefined = []
|
export let prevAssigned: Ref<Employee>[] | undefined = []
|
||||||
export let projectLead: Ref<Employee> | undefined = undefined
|
export let projectLead: Ref<Employee> | undefined = undefined
|
||||||
export let projectMembers: Ref<Employee>[] | undefined = []
|
export let projectMembers: Ref<Employee>[] | undefined = []
|
||||||
|
export let allowDeselect = true
|
||||||
export let titleDeselect: IntlString | undefined
|
export let titleDeselect: IntlString | undefined
|
||||||
export let placeholder: IntlString = presentation.string.Search
|
export let placeholder: IntlString = presentation.string.Search
|
||||||
export let ignoreUsers: Ref<Person>[] = []
|
export let ignoreUsers: Ref<Person>[] = []
|
||||||
@ -72,7 +73,10 @@
|
|||||||
{
|
{
|
||||||
...(docQuery ?? {}),
|
...(docQuery ?? {}),
|
||||||
[searchField]: { $like: '%' + search + '%' },
|
[searchField]: { $like: '%' + search + '%' },
|
||||||
_id: { $nin: ignoreUsers }
|
_id: {
|
||||||
|
...(typeof docQuery?._id === 'object' ? docQuery._id : {}),
|
||||||
|
$nin: ignoreUsers
|
||||||
|
}
|
||||||
},
|
},
|
||||||
(result) => {
|
(result) => {
|
||||||
objects = result
|
objects = result
|
||||||
@ -117,7 +121,7 @@
|
|||||||
|
|
||||||
async function handleSelection (evt: Event | undefined, selection: number): Promise<void> {
|
async function handleSelection (evt: Event | undefined, selection: number): Promise<void> {
|
||||||
const person = contacts[selection]
|
const person = contacts[selection]
|
||||||
selected = person._id === selected ? undefined : person._id
|
selected = allowDeselect && person._id === selected ? undefined : person._id
|
||||||
dispatch('close', selected !== undefined ? person : undefined)
|
dispatch('close', selected !== undefined ? person : undefined)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +236,7 @@
|
|||||||
handleSelection(undefined, item)
|
handleSelection(undefined, item)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{#if selected}
|
{#if allowDeselect && selected}
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
{#if obj._id === selected}
|
{#if obj._id === selected}
|
||||||
<div bind:this={selectedDiv}>
|
<div bind:this={selectedDiv}>
|
||||||
|
Loading…
Reference in New Issue
Block a user