mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
Allow to find without done state (#1215)
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
parent
cdb303d873
commit
4e77624826
@ -16,14 +16,14 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Class, DocumentQuery, FindOptions, Ref } from '@anticrm/core'
|
import { Class, DocumentQuery, FindOptions, Ref } from '@anticrm/core'
|
||||||
import { createQuery } from '@anticrm/presentation'
|
import { createQuery } from '@anticrm/presentation'
|
||||||
import task, { DoneState, SpaceWithStates, State, Task } from '@anticrm/task'
|
import { DoneState, SpaceWithStates, State, Task } from '@anticrm/task'
|
||||||
import { ScrollBox } from '@anticrm/ui'
|
import { ScrollBox } from '@anticrm/ui'
|
||||||
import Label from '@anticrm/ui/src/components/Label.svelte'
|
import Label from '@anticrm/ui/src/components/Label.svelte'
|
||||||
import { Table } from '@anticrm/view-resources'
|
import { Table } from '@anticrm/view-resources'
|
||||||
import Lost from './icons/Lost.svelte'
|
import Lost from './icons/Lost.svelte'
|
||||||
import Won from './icons/Won.svelte'
|
import Won from './icons/Won.svelte'
|
||||||
import StatesBar from './state/StatesBar.svelte'
|
import StatesBar from './state/StatesBar.svelte'
|
||||||
import plugin from '../plugin'
|
import task from '../plugin'
|
||||||
|
|
||||||
export let _class: Ref<Class<Task>>
|
export let _class: Ref<Class<Task>>
|
||||||
export let space: Ref<SpaceWithStates>
|
export let space: Ref<SpaceWithStates>
|
||||||
@ -37,6 +37,7 @@
|
|||||||
let resConfig = config
|
let resConfig = config
|
||||||
let query = {}
|
let query = {}
|
||||||
let doneStates: DoneState[] = []
|
let doneStates: DoneState[] = []
|
||||||
|
let withoutDone: boolean = false
|
||||||
|
|
||||||
function updateConfig (): void {
|
function updateConfig (): void {
|
||||||
if (state !== undefined) {
|
if (state !== undefined) {
|
||||||
@ -73,11 +74,14 @@
|
|||||||
result.doneState = {
|
result.doneState = {
|
||||||
$in: Array.from(selectedDoneStates)
|
$in: Array.from(selectedDoneStates)
|
||||||
}
|
}
|
||||||
|
} else if (withoutDone) {
|
||||||
|
result.doneState = null
|
||||||
}
|
}
|
||||||
query = result
|
query = result
|
||||||
}
|
}
|
||||||
|
|
||||||
function doneStateClick (id: Ref<DoneState>): void {
|
function doneStateClick (id: Ref<DoneState>): void {
|
||||||
|
withoutDone = false
|
||||||
if (selectedDoneStates.has(id)) {
|
if (selectedDoneStates.has(id)) {
|
||||||
selectedDoneStates.delete(id)
|
selectedDoneStates.delete(id)
|
||||||
} else {
|
} else {
|
||||||
@ -87,6 +91,13 @@
|
|||||||
updateQuery(search, selectedDoneStates)
|
updateQuery(search, selectedDoneStates)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function noDoneClick (): void {
|
||||||
|
withoutDone = !withoutDone
|
||||||
|
selectedDoneStates.clear()
|
||||||
|
selectedDoneStates = selectedDoneStates
|
||||||
|
updateQuery(search, selectedDoneStates)
|
||||||
|
}
|
||||||
|
|
||||||
$: updateQuery(search, selectedDoneStates)
|
$: updateQuery(search, selectedDoneStates)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -98,11 +109,12 @@
|
|||||||
on:click={() => {
|
on:click={() => {
|
||||||
doneStatusesView = false
|
doneStatusesView = false
|
||||||
state = undefined
|
state = undefined
|
||||||
|
withoutDone = false
|
||||||
selectedDoneStates.clear()
|
selectedDoneStates.clear()
|
||||||
updateQuery(search, selectedDoneStates)
|
updateQuery(search, selectedDoneStates)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Label label={plugin.string.AllStates} />
|
<Label label={task.string.AllStates} />
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="button flex-center ml-3"
|
class="button flex-center ml-3"
|
||||||
@ -114,7 +126,7 @@
|
|||||||
updateQuery(search, selectedDoneStates)
|
updateQuery(search, selectedDoneStates)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Label label={plugin.string.DoneStates} />
|
<Label label={task.string.DoneStates} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-row-center caption-color states">
|
<div class="flex-row-center caption-color states">
|
||||||
@ -139,6 +151,15 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
<div
|
||||||
|
class="doneState withoutDone flex-row-center"
|
||||||
|
class:disable={!withoutDone}
|
||||||
|
on:click={() => {
|
||||||
|
noDoneClick()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Label label={task.string.NoDoneState}/>
|
||||||
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<StatesBar bind:state {space} on:change={() => updateQuery(search, selectedDoneStates)} />
|
<StatesBar bind:state {space} on:change={() => updateQuery(search, selectedDoneStates)} />
|
||||||
{/if}
|
{/if}
|
||||||
@ -192,6 +213,7 @@
|
|||||||
|
|
||||||
&.won { background-color: #60b96e; }
|
&.won { background-color: #60b96e; }
|
||||||
&.lost { background-color: #f06c63; }
|
&.lost { background-color: #f06c63; }
|
||||||
|
&.withoutDone { background-color: var(--theme-bg-focused-color); }
|
||||||
&.disable { background-color: var(--theme-button-bg-enabled); }
|
&.disable { background-color: var(--theme-button-bg-enabled); }
|
||||||
}
|
}
|
||||||
.doneState + .doneState { margin-left: .75rem; }
|
.doneState + .doneState { margin-left: .75rem; }
|
||||||
|
Loading…
Reference in New Issue
Block a user