Archive filter fix (#5626)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2024-05-20 21:16:57 +05:00 committed by GitHub
parent 4fe6e5e62c
commit 69e683e060
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 8 deletions

View File

@ -169,7 +169,7 @@
<SearchEdit bind:value={search} on:change={(e) => (search = e.detail)} />
<!-- <ActionIcon icon={IconMoreH} size={'small'} /> -->
<div class="buttons-divider" />
<FilterButton _class={recruit.class.Vacancy} />
<FilterButton _class={recruit.class.Vacancy} {viewOptions} />
</div>
<div class="ac-header-full medium-gap">
<ViewletSettingButton bind:viewOptions bind:viewlet />

View File

@ -16,7 +16,7 @@
import { Class, Doc, Ref, Space } from '@hcengineering/core'
import { getClient } from '@hcengineering/presentation'
import { Button, IconFilter, eventToHTMLElement, resolvedLocationStore, showPopup } from '@hcengineering/ui'
import { Filter } from '@hcengineering/view'
import { Filter, ViewOptions } from '@hcengineering/view'
import { filterStore, getFilterKey, selectedFilterStore, setFilters } from '../../filter'
import view from '../../plugin'
import FilterTypePopup from './FilterTypePopup.svelte'
@ -25,6 +25,7 @@
export let _class: Ref<Class<Doc>> | undefined
export let space: Ref<Space> | undefined = undefined
export let viewOptions: ViewOptions | undefined = undefined
const client = getClient()
const hierarchy = client.getHierarchy()
@ -69,7 +70,8 @@
space,
target,
index: 1,
onChange
onChange,
viewOptions
},
target
)

View File

@ -16,7 +16,7 @@
import core, { AnyAttribute, ArrOf, Class, Doc, Ref, RefTo, Space, Type } from '@hcengineering/core'
import { getClient } from '@hcengineering/presentation'
import { Label, Scroller, Submenu, closePopup, closeTooltip, resizeObserver, showPopup } from '@hcengineering/ui'
import { ClassFilters, Filter, KeyFilter, KeyFilterPreset } from '@hcengineering/view'
import { ClassFilters, Filter, KeyFilter, KeyFilterPreset, ViewOptions } from '@hcengineering/view'
import { getResource } from '@hcengineering/platform'
import { createEventDispatcher } from 'svelte'
import { FilterQuery, buildFilterKey } from '../../filter'
@ -29,6 +29,7 @@
export let index: number
export let onChange: (e: Filter) => void
export let nestedFrom: KeyFilter | undefined = undefined
export let viewOptions: ViewOptions | undefined = undefined
const client = getClient()
const hierarchy = client.getHierarchy()
@ -212,7 +213,8 @@
value: [],
index
},
onChange: change
onChange: change,
viewOptions
},
target
)
@ -227,7 +229,8 @@
value: [],
index
},
onChange
onChange,
viewOptions
},
target
)

View File

@ -25,7 +25,7 @@
Loading,
resizeObserver
} from '@hcengineering/ui'
import { Filter } from '@hcengineering/view'
import { Filter, ViewOptions } from '@hcengineering/view'
import { createEventDispatcher } from 'svelte'
import { FILTER_DEBOUNCE_MS, sortFilterValues } from '../../filter'
import view from '../../plugin'
@ -35,6 +35,7 @@
export let space: Ref<Space> | undefined = undefined
export let filter: Filter
export let onChange: (e: Filter) => void
export let viewOptions: ViewOptions | undefined = undefined
filter.modes = [view.filter.FilterValueIn, view.filter.FilterValueNin]
filter.mode = filter.mode === undefined ? filter.modes[0] : filter.mode
@ -96,7 +97,13 @@
_class,
{
...resultQuery,
...(space ? { space } : isDerivedFromSpace ? { archived: false } : { space: { $in: spaces } }),
...(space
? { space }
: isDerivedFromSpace
? viewOptions === undefined || viewOptions?.hideArchived === true
? { archived: false }
: {}
: { space: { $in: spaces } }),
...(first1000 ? { [filter.key.key]: { $nin: first1000 } } : {})
},
{