update show empty groups (#2897)

Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
This commit is contained in:
Ruslan Bayandinov
2023-04-05 18:23:55 +06:00
committed by GitHub
parent 972e82eb32
commit 5130eb8862
7 changed files with 31 additions and 38 deletions
@@ -147,6 +147,7 @@
{docs}
{_class}
{space}
query={resultQuery}
{lookup}
loadingPropsLength={getLoadingElementsLength(loadingProps, options)}
{baseMenuClass}
@@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { CategoryType, Class, Doc, generateId, Lookup, Ref, Space } from '@hcengineering/core'
import { CategoryType, Class, Doc, DocumentQuery, generateId, Lookup, Ref, Space } from '@hcengineering/core'
import { getResource, IntlString } from '@hcengineering/platform'
import { getClient, statusStore } from '@hcengineering/presentation'
import { AnyComponent } from '@hcengineering/ui'
@@ -28,6 +28,7 @@
export let docs: Doc[]
export let _class: Ref<Class<Doc>>
export let space: Ref<Space> | undefined
export let query: DocumentQuery<Doc> | undefined
export let lookup: Lookup<Doc>
export let loadingPropsLength: number | undefined
export let baseMenuClass: Ref<Class<Doc>> | undefined
@@ -82,7 +83,7 @@
const categoryFunc = viewOption as CategoryOption
if (viewOptions[viewOption.key] ?? viewOption.defaultValue) {
const f = await getResource(categoryFunc.action)
const res = hierarchy.clone(await f(_class, space, groupByKey, update, queryId, $statusStore))
const res = hierarchy.clone(await f(_class, query, groupByKey, update, queryId, $statusStore))
if (res !== undefined) {
categories = res
return
+3 -3
View File
@@ -1,4 +1,4 @@
import core, { Class, Doc, Ref, SortingOrder, Space, StatusManager } from '@hcengineering/core'
import core, { Class, Doc, DocumentQuery, Ref, SortingOrder, StatusManager } from '@hcengineering/core'
import { getResource } from '@hcengineering/platform'
import { createQuery, getAttributePresenterClass, getClient, LiveQuery } from '@hcengineering/presentation'
import { getCurrentLocation, locationToUrl } from '@hcengineering/ui'
@@ -104,7 +104,7 @@ export function migrateViewOpttions (): void {
export async function showEmptyGroups (
_class: Ref<Class<Doc>>,
space: Ref<Space> | undefined,
query: DocumentQuery<Doc> | undefined,
key: string,
onUpdate: () => void,
queryId: Ref<Doc>,
@@ -128,7 +128,7 @@ export async function showEmptyGroups (
const mixin = hierarchy.as(attributeClass, view.mixin.AllValuesFunc)
if (mixin.func !== undefined) {
const f = await getResource(mixin.func)
const res = await f(space, onUpdate, queryId)
const res = await f(query, onUpdate, queryId)
if (res !== undefined) {
return await groupByCategory(client, _class, key, res, mgr, viewletDescriptorId)
}