diff --git a/plugins/view-resources/src/components/list/SortableList.svelte b/plugins/view-resources/src/components/list/SortableList.svelte index 56695ec7d4..6a8fe2556d 100644 --- a/plugins/view-resources/src/components/list/SortableList.svelte +++ b/plugins/view-resources/src/components/list/SortableList.svelte @@ -42,6 +42,9 @@ export let presenterProps: Record = {} export let direction: 'row' | 'column' = 'column' export let flipDuration = 200 + export let isAddButtonHidden = false + export let isAddButtonDisabled = false + export let itemsCount = 0 const client = getClient() const hierarchy = client.getHierarchy() @@ -60,10 +63,10 @@ let isCreating = false - async function updateModel (modelClassRef: Ref>) { + async function updateModel (modelClassRef: Ref>, props: Record) { try { isModelLoading = true - model = await getObjectPresenter(client, modelClassRef, { key: '', props: presenterProps }) + model = await getObjectPresenter(client, modelClassRef, { key: '', props }) } finally { isModelLoading = false } @@ -131,16 +134,17 @@ hoveringIndex = null } - $: updateModel(_class) + $: updateModel(_class, presenterProps) $: updateObjectFactory(_class) $: itemsQuery.query(_class, query, updateItems, { ...queryOptions, limit: Math.max(queryOptions?.limit ?? 0, 200) }) $: isLoading = isModelLoading || areItemsloading $: isSortable = hierarchy.getAllAttributes(_class).has('rank') + $: itemsCount = items?.length ?? 0
- {#if label} + {#if label || !isAddButtonHidden}
{#if label}
@@ -149,11 +153,11 @@
{/if} - {#if objectFactory} + {#if !isAddButtonHidden}