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
@@ -33,11 +33,6 @@
<TableBrowser
_class={core.class.Space}
config={['', '$lookup._class.label', 'modifiedOn']}
options={{
lookup: {
_class: core.class.Class
}
}}
showNotification
baseMenuClass={core.class.Space}
query={{
@@ -15,28 +15,51 @@
-->
<script lang="ts">
import type { Class, Doc, Ref, Space, WithLookup } from '@anticrm/core'
import { Component } from '@anticrm/ui'
import type { Viewlet } from '@anticrm/view'
import { createQuery } from '@anticrm/presentation'
import { Component, Loading } from '@anticrm/ui'
import view, { Viewlet, ViewletPreference } from '@anticrm/view'
export let _class: Ref<Class<Doc>>
export let space: Ref<Space>
export let search: string
export let viewlet: WithLookup<Viewlet> | undefined
const preferenceQuery = createQuery()
let preference: ViewletPreference | undefined
let loading = true
$: viewlet &&
preferenceQuery.query(
view.class.ViewletPreference,
{
attachedTo: viewlet._id
},
(res) => {
preference = res[0]
loading = false
},
{ limit: 1 }
)
</script>
{#if viewlet}
{#key space}
{#if viewlet.$lookup?.descriptor?.component}
<Component
is={viewlet.$lookup?.descriptor?.component}
props={{
_class,
space,
options: viewlet.options,
config: viewlet.config,
search
}}
/>
{#if loading}
<Loading />
{:else}
<Component
is={viewlet.$lookup?.descriptor?.component}
props={{
_class,
space,
options: viewlet.options,
config: preference?.config ?? viewlet.config,
viewlet,
search
}}
/>
{/if}
{/if}
{/key}
{/if}
@@ -17,9 +17,19 @@
import core, { WithLookup } from '@anticrm/core'
import { IntlString } from '@anticrm/platform'
import presentation, { createQuery, getClient } from '@anticrm/presentation'
import { AnyComponent, showPanel } from '@anticrm/ui'
import { Button, Icon, SearchEdit, showPopup, Tooltip, IconAdd } from '@anticrm/ui'
import {
ActionIcon,
AnyComponent,
showPanel,
Button,
Icon,
SearchEdit,
showPopup,
Tooltip,
IconAdd
} from '@anticrm/ui'
import view, { Viewlet } from '@anticrm/view'
import { ViewletSetting } from '@anticrm/view-resources'
import { createEventDispatcher } from 'svelte'
import plugin from '../plugin'
import { classIcon } from '../utils'
@@ -101,6 +111,17 @@
{/each}
</div>
{/if}
{#if viewlet}
<ActionIcon
icon={view.icon.Setting}
direction={'top'}
size={'small'}
label={view.string.CustomizeView}
action={() => {
showPopup(ViewletSetting, { viewlet })
}}
/>
{/if}
<SearchEdit
bind:value={search}
on:change={() => {