From 6770c20e2633063d52c70dcea27a4a87294271a1 Mon Sep 17 00:00:00 2001 From: Anton Brechka Date: Mon, 11 Jul 2022 13:08:04 +0700 Subject: [PATCH] TSK-268: Supported expandable for issue list Signed-off-by: Anton Brechka --- .../src/components/issues/IssuesList.svelte | 179 +++++++++--------- 1 file changed, 94 insertions(+), 85 deletions(-) diff --git a/plugins/tracker-resources/src/components/issues/IssuesList.svelte b/plugins/tracker-resources/src/components/issues/IssuesList.svelte index 1ffec351cc6..8b53774c0a7 100644 --- a/plugins/tracker-resources/src/components/issues/IssuesList.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuesList.svelte @@ -26,6 +26,7 @@ import CreateIssue from '../CreateIssue.svelte' import notification from '@anticrm/notification' import { FixedColumn } from '@anticrm/view-resources' + import { ExpandCollapse } from '@anticrm/ui' export let _class: Ref> export let currentSpace: Ref | undefined = undefined @@ -55,6 +56,7 @@ let personPresenter: AttributeModel + $: isCollapsedMap = Object.fromEntries(categories.map((category) => [category, false])) $: combinedGroupedIssues = Object.values(groupedIssues).flat(1) $: options = { ...baseOptions, sort: { [orderBy]: issuesSortOrderMap[orderBy] } } as FindOptions $: headerComponent = groupByKey === undefined || groupByKey === 'assignee' ? null : issuesGroupEditorMap[groupByKey] @@ -134,6 +136,8 @@ ) } + const handleCollapseCategory = (category: any) => (isCollapsedMap[category] = !isCollapsedMap[category]) + const getLoadingElementsLength = (props: LoadingProps, options?: FindOptions) => { if (options?.limit && options?.limit > 0) { return Math.min(options.limit, props.length) @@ -158,7 +162,7 @@
{#each categories as category} {#if headerComponent || groupByKey === 'assignee'} -
+
handleCollapseCategory(category)}>
{#if groupByKey === 'assignee' && personPresenter}
{/if} - {#if itemModels} - {#if groupedIssues[category]} - {#each groupedIssues[category] as docObject (docObject._id)} -
x === docObject)]} - class="listGrid antiList__row row gap-2 flex-grow" - class:checking={selectedObjectIdsSet.has(docObject._id)} - class:mListGridFixed={selectedRowIndex === combinedGroupedIssues.findIndex((x) => x === docObject)} - class:mListGridSelected={selectedRowIndex === combinedGroupedIssues.findIndex((x) => x === docObject)} - on:contextmenu|preventDefault={(event) => - handleMenuOpened( - event, - docObject, - combinedGroupedIssues.findIndex((x) => x === docObject) - )} - on:focus={() => {}} - on:mouseover={() => handleRowFocused(docObject)} - > -
-
-
- { - onObjectChecked([docObject], event.detail) - }} + + {#if itemModels} + {#if groupedIssues[category]} + {#each groupedIssues[category] as docObject (docObject._id)} +
x === docObject)]} + class="listGrid antiList__row row gap-2 flex-grow" + class:checking={selectedObjectIdsSet.has(docObject._id)} + class:mListGridFixed={selectedRowIndex === combinedGroupedIssues.findIndex((x) => x === docObject)} + class:mListGridSelected={selectedRowIndex === combinedGroupedIssues.findIndex((x) => x === docObject)} + on:contextmenu|preventDefault={(event) => + handleMenuOpened( + event, + docObject, + combinedGroupedIssues.findIndex((x) => x === docObject) + )} + on:focus={() => {}} + on:mouseover={() => handleRowFocused(docObject)} + > +
+
+
+ { + onObjectChecked([docObject], event.detail) + }} + /> +
+
-
-
- {#each itemModels as attributeModel, attributeModelIndex} - {#if attributeModelIndex === 0} -
+ {#each itemModels as attributeModel, attributeModelIndex} + {#if attributeModelIndex === 0} +
+ +
+ {:else if attributeModelIndex === 1} +
+ checkWidth('issue', result)} + > + + +
+ {:else if attributeModelIndex === 3} -
- {:else if attributeModelIndex === 1} -
+ {:else if attributeModel.props?.fixed} checkWidth('issue', result)} + width={propsWidth[attributeModel.key]} + key={attributeModel.key} + justify={attributeModel.props.fixed} + on:update={(result) => checkWidth(attributeModel.key, result)} > -
- {:else if attributeModelIndex === 3} - - {:else if attributeModel.props?.fixed} - checkWidth(attributeModel.key, result)} - > - - - {:else} + {:else} +
+ +
+ {/if} + {/each} +
+ {/each} + {:else if loadingProps !== undefined} + {#each Array(getLoadingElementsLength(loadingProps, options)) as _, rowIndex} +
+
- -
- {/if} - {/each} -
- {/each} - {:else if loadingProps !== undefined} - {#each Array(getLoadingElementsLength(loadingProps, options)) as _, rowIndex} -
-
-
- -
- + +
+ +
-
- {/each} + {/each} + {/if} {/if} - {/if} + {/each}