mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-07 02:07:43 +02:00
add queries to Table
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
@@ -15,19 +15,18 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import type { Bag } from '@anticrm/core'
|
||||
import type { Attachment } from '@anticrm/chunter'
|
||||
import type { Ref, Doc } from '@anticrm/core'
|
||||
import { Table } from '@anticrm/view-resources'
|
||||
|
||||
import chunter from '@anticrm/chunter'
|
||||
|
||||
export let files: Bag<Attachment>
|
||||
export let objectId: Ref<Doc>
|
||||
|
||||
</script>
|
||||
|
||||
<Table
|
||||
_class={chunter.class.Attachment}
|
||||
config={['', 'lastModified']}
|
||||
options={ {} }
|
||||
search=""
|
||||
_class={chunter.class.Attachment}
|
||||
config={['', 'lastModified']}
|
||||
options={ {} }
|
||||
query={ { attachedTo: objectId } }
|
||||
/>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
{/if} -->
|
||||
|
||||
{#if value.attachments && value.attachments > 0}
|
||||
<Tooltip label={'Attachments (' + value.attachments + ')'} component={AttachmentPopup} props={{ files: value._id }}>
|
||||
<Tooltip label={'Attachments (' + value.attachments + ')'} component={AttachmentPopup} props={{ objectId: value._id }}>
|
||||
<div class="sm-tool-icon">
|
||||
<span class="icon"><IconAttachment size="small"/></span>{value.attachments}
|
||||
</div>
|
||||
|
||||
@@ -41,5 +41,5 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
search=""
|
||||
query={ { candidate: value._id } }
|
||||
/>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
_class={chunter.class.Attachment}
|
||||
config={['', 'lastModified']}
|
||||
options={ {} }
|
||||
search=""
|
||||
query={ { attachedTo: objectId } }
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
search=""
|
||||
query={ { candidate: _id } }
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
-->
|
||||
|
||||
<script lang="ts">
|
||||
import type { Ref, Class, Doc, Space, FindOptions } from '@anticrm/core'
|
||||
import type { Ref, Class, Doc, Space, FindOptions, DocumentQuery } from '@anticrm/core'
|
||||
import { SortingOrder } from '@anticrm/core'
|
||||
import { buildModel } from '../utils'
|
||||
import { getClient } from '@anticrm/presentation'
|
||||
@@ -26,10 +26,9 @@
|
||||
import { createQuery } from '@anticrm/presentation'
|
||||
|
||||
export let _class: Ref<Class<Doc>>
|
||||
export let space: Ref<Space>
|
||||
export let query: DocumentQuery<Doc>
|
||||
export let options: FindOptions<Doc> | undefined
|
||||
export let config: string[]
|
||||
export let search: string
|
||||
|
||||
let sortKey = 'modifiedOn'
|
||||
let sortOrder = SortingOrder.Descending
|
||||
@@ -37,8 +36,8 @@
|
||||
|
||||
let objects: Doc[]
|
||||
|
||||
const query = createQuery()
|
||||
$: query.query(_class, search === '' ? (space ? { space } : {}) : { $search: search }, result => { objects = result }, { sort: { [sortKey]: sortOrder }, ...options })
|
||||
const q = createQuery()
|
||||
$: q.query(_class, query, result => { objects = result }, { sort: { [sortKey]: sortOrder }, ...options })
|
||||
|
||||
function getValue(doc: Doc, key: string): any {
|
||||
if (key.length === 0)
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
let objects: Doc[]
|
||||
|
||||
const query = createQuery()
|
||||
$: query.query(_class, search === '' ? (space ? { space } : {}) : { $search: search }, result => { objects = result }, { sort: { [sortKey]: sortOrder }, ...options })
|
||||
$: query.query(_class, search === '' ? { space } : { $search: search }, result => { objects = result }, { sort: { [sortKey]: sortOrder }, ...options })
|
||||
|
||||
function getValue(doc: Doc, key: string): any {
|
||||
if (key.length === 0)
|
||||
|
||||
Reference in New Issue
Block a user