Custom table (#1734)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov
2022-05-13 13:38:54 +07:00
committed by GitHub
parent 5e7c320fb5
commit e91c5d073a
44 changed files with 716 additions and 339 deletions
@@ -15,8 +15,8 @@
<script lang="ts">
import attachment from '@anticrm/attachment'
import chunter from '@anticrm/chunter'
import contact, { EmployeeAccount } from '@anticrm/contact'
import { Class, DocumentQuery, FindOptions, getCurrentAccount, Ref } from '@anticrm/core'
import { EmployeeAccount } from '@anticrm/contact'
import { Class, DocumentQuery, getCurrentAccount, Ref } from '@anticrm/core'
import { createQuery, getClient } from '@anticrm/presentation'
import tags, { selectedTagElements, TagCategory, TagElement } from '@anticrm/tags'
import { DoneState, Task } from '@anticrm/task'
@@ -69,14 +69,6 @@
category = detail.category ?? undefined
selectedTagElements.set(Array.from(detail.elements ?? []).map((it) => it._id))
}
const taskOptions: FindOptions<Task> = {
lookup: {
attachedTo: [contact.class.Person, { _id: { channels: contact.class.Channel } }],
state: task.class.State,
assignee: contact.class.Employee,
doneState: task.class.DoneState
}
}
</script>
<div class="ac-header full">
@@ -121,7 +113,6 @@
},
'modifiedOn'
]}
options={taskOptions}
query={resultQuery}
showNotification
/>
@@ -33,21 +33,19 @@
let doneStatusesView: boolean = false
let state: Ref<State> | undefined = undefined
let selectedDoneStates: Set<Ref<DoneState>> = new Set<Ref<DoneState>>()
let resConfig = config
$: resConfig = updateConfig(config)
let query = {}
let doneStates: DoneState[] = []
let withoutDone: boolean = false
function updateConfig (): void {
function updateConfig (config: string[]): string[] {
if (state !== undefined) {
resConfig = config.filter((p) => p !== '$lookup.state')
return
return config.filter((p) => p !== '$lookup.state')
}
if (selectedDoneStates.size === 1) {
resConfig = config.filter((p) => p !== '$lookup.doneState')
return
return config.filter((p) => p !== '$lookup.doneState')
}
resConfig = config
return config
}
const doneStateQuery = createQuery()
@@ -66,7 +64,7 @@
)
async function updateQuery (search: string, selectedDoneStates: Set<Ref<DoneState>>): Promise<void> {
updateConfig()
resConfig = updateConfig(config)
const result = {} as DocumentQuery<Task>
if (search !== '') {
result.$search = search