Filters_bind_fix (#2102)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov
2022-06-19 23:25:14 +07:00
committed by GitHub
parent 8441f0b5ab
commit d0f68cc87f
19 changed files with 62 additions and 84 deletions
@@ -17,13 +17,11 @@
import type { Asset } from '@anticrm/platform'
import { Icon } from '@anticrm/ui'
import { FilterButton } from '@anticrm/view-resources'
import type { Filter } from '@anticrm/view'
export let icon: Asset | undefined
export let label: string
export let description: string | undefined
export let _class: Ref<Class<Doc>> | undefined = undefined
export let filters: Filter[] = []
</script>
<div class="ac-header__wrap-description">
@@ -32,7 +30,7 @@
{#if icon}<div class="ac-header__icon"><Icon {icon} size={'small'} /></div>{/if}
<span class="ac-header__title">{label}</span>
</div>
{#if _class}<div class="ml-4"><FilterButton {_class} bind:filters /></div>{/if}
{#if _class}<div class="ml-4"><FilterButton {_class} /></div>{/if}
</div>
{#if description}<span class="ac-header__description">{description}</span>{/if}
</div>
@@ -39,7 +39,6 @@
import { FilterBar, FilterButton, SpacePresenter } from '@anticrm/view-resources'
import { IntlString } from '@anticrm/platform'
import { classIcon } from '../utils'
import { Filter } from '@anticrm/view'
export let _class: Ref<Class<Space>>
export let label: IntlString
@@ -55,7 +54,6 @@
const sort: SortingQuery<Space> = {
name: SortingOrder.Ascending
}
export let filters: Filter[] = []
let searchQuery: DocumentQuery<Space>
let resultQuery: DocumentQuery<Space>
@@ -135,10 +133,10 @@
{/if}
{#if withFilterButton}
<div class="ml-10 mt-4 mb-4">
<FilterButton {_class} bind:filters />
<FilterButton {_class} />
</div>
{/if}
<FilterBar {_class} query={searchQuery} bind:filters on:change={(e) => (resultQuery = e.detail)} />
<FilterBar {_class} query={searchQuery} on:change={(e) => (resultQuery = e.detail)} />
<Scroller padding={'2.5rem'}>
<div class="flex-col">
{#each spaces as space (space._id)}
@@ -18,13 +18,11 @@
import { createQuery } from '@anticrm/presentation'
import { Component, Loading } from '@anticrm/ui'
import view, { Viewlet, ViewletPreference } from '@anticrm/view'
import type { Filter } from '@anticrm/view'
export let _class: Ref<Class<Doc>>
export let space: Ref<Space>
export let search: string
export let viewlet: WithLookup<Viewlet> | undefined
export let filters: Filter[] = []
const preferenceQuery = createQuery()
let preference: ViewletPreference | undefined
@@ -58,7 +56,6 @@
options: viewlet.options,
config: preference?.config ?? viewlet.config,
viewlet,
filters,
search
}}
/>
@@ -18,7 +18,6 @@
import { IntlString } from '@anticrm/platform'
import presentation, { createQuery, getClient } from '@anticrm/presentation'
import { AnyComponent, Button, Icon, IconAdd, SearchEdit, showPanel, showPopup, Tooltip } from '@anticrm/ui'
import type { Filter } from '@anticrm/view'
import view, { Viewlet } from '@anticrm/view'
import { ViewletSettingButton } from '@anticrm/view-resources'
import { createEventDispatcher } from 'svelte'
@@ -33,7 +32,6 @@
export let viewlet: WithLookup<Viewlet> | undefined
export let viewlets: WithLookup<Viewlet>[] = []
export let _class: Ref<Class<Doc>> | undefined = undefined
export let filters: Filter[] = []
const client = getClient()
const hierarchy = client.getHierarchy()
@@ -84,7 +82,6 @@
label={space.name}
description={space.description}
{_class}
bind:filters
on:click={onSpaceEdit}
/>
{#if viewlets.length > 1}
@@ -21,7 +21,6 @@
import type { ViewConfiguration } from '@anticrm/workbench'
import SpaceContent from './SpaceContent.svelte'
import SpaceHeader from './SpaceHeader.svelte'
import type { Filter } from '@anticrm/view'
export let currentSpace: Ref<Space> | undefined
export let currentView: ViewConfiguration | undefined
@@ -33,7 +32,6 @@
let space: Space | undefined
let _class: Ref<Class<Doc>> | undefined = undefined
let header: AnyComponent | undefined
let filters: Filter[] = []
const client = getClient()
@@ -95,10 +93,9 @@
{viewlets}
{createItemDialog}
{createItemLabel}
bind:filters
bind:search
bind:viewlet
/>
{/if}
<SpaceContent space={space._id} {_class} bind:filters bind:search {viewlet} />
<SpaceContent space={space._id} {_class} bind:search {viewlet} />
{/if}
@@ -17,7 +17,7 @@
import { Asset, IntlString } from '@anticrm/platform'
import { createQuery, getClient } from '@anticrm/presentation'
import { AnyComponent, Button, Icon, IconAdd, Label, Loading, SearchEdit, showPopup } from '@anticrm/ui'
import view, { Filter, Viewlet, ViewletDescriptor, ViewletPreference } from '@anticrm/view'
import view, { Viewlet, ViewletDescriptor, ViewletPreference } from '@anticrm/view'
import { FilterButton, TableBrowser, ViewletSettingButton } from '@anticrm/view-resources'
export let _class: Ref<Class<Doc>>
@@ -29,7 +29,6 @@
export let baseQuery: DocumentQuery<Doc> = {}
let search = ''
let filters: Filter[] = []
let descr: Viewlet | undefined
$: resultQuery = updateResultQuery(search, baseQuery)
@@ -80,7 +79,7 @@
<div class="ac-header__wrap-title">
<span class="ac-header__icon"><Icon {icon} size={'small'} /></span>
<span class="ac-header__title"><Label {label} /></span>
<div class="ml-4"><FilterButton {_class} bind:filters /></div>
<div class="ml-4"><FilterButton {_class} /></div>
</div>
<SearchEdit bind:value={search} />
@@ -99,7 +98,6 @@
config={preference?.config ?? descr.config}
options={descr.options}
query={resultQuery}
bind:filters
showNotification
/>
{/if}
@@ -130,8 +130,8 @@
async function syncLoc (loc: Location): Promise<void> {
const app = loc.path.length > 1 ? (loc.path[1] as Ref<Application>) : undefined
let space = loc.path.length > 2 ? (loc.path[2] as Ref<Space>) : undefined
let special = loc.path.length > 3 ? loc.path[3] : undefined
const space = loc.path.length > 2 ? (loc.path[2] as Ref<Space>) : undefined
const special = loc.path.length > 3 ? loc.path[3] : undefined
if (currentApp !== app) {
clear(1)
@@ -144,8 +144,17 @@
const last = localStorage.getItem(`platform_last_loc_${app}`)
if (last !== null) {
const newLocation: Location = JSON.parse(last)
loc.path[2] = space = newLocation.path[2] as Ref<Space>
loc.path[3] = special = newLocation.path[3]
if (newLocation.path[2] != null) {
loc.path[2] = newLocation.path[2] as Ref<Space>
loc.path[3] = newLocation.path[3]
if (loc.path[3] == null) {
loc.path.length = 3
} else {
loc.path.length = 4
}
navigate(loc)
return
}
}
}