UBERF-4632: refactor activity classes structure (#4190)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2023-12-13 22:59:11 +07:00
committed by GitHub
parent d54422d737
commit 2bf1a03907
174 changed files with 2535 additions and 2134 deletions
@@ -0,0 +1,54 @@
<!--
// Copyright © 2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import { Component } from '@hcengineering/ui'
import view, { AttributeModel } from '@hcengineering/view'
import { getClient } from '@hcengineering/presentation'
import { DocAttributeUpdates, DocUpdateMessageViewlet } from '@hcengineering/activity'
import AddedAttributesPresenter from './attributes/AddedAttributesPresenter.svelte'
import RemovedAttributesPresenter from './attributes/RemovedAttributesPresenter.svelte'
import SetAttributesPresenter from './attributes/SetAttributesPresenter.svelte'
export let viewlet: DocUpdateMessageViewlet | undefined
export let attributeUpdates: DocAttributeUpdates
export let attributeModel: AttributeModel
const client = getClient()
const hierarchy = client.getHierarchy()
$: presenter =
viewlet?.config?.[attributeModel.key]?.presenter ??
hierarchy.classHierarchyMixin(attributeUpdates.attrClass, view.mixin.ActivityAttributePresenter)?.presenter
</script>
{#if presenter}
<Component is={presenter} props={{ value: attributeUpdates }} />
{:else}
{#if attributeUpdates.added.length}
<AddedAttributesPresenter {viewlet} {attributeModel} values={attributeUpdates.added} />
{/if}
{#if attributeUpdates.removed.length}
<RemovedAttributesPresenter {viewlet} {attributeModel} values={attributeUpdates.removed} />
{/if}
{#if attributeUpdates.set.length}
<SetAttributesPresenter
{viewlet}
{attributeModel}
values={attributeUpdates.set}
prevValue={attributeUpdates.prevValue}
/>
{/if}
{/if}