TSK-1381: Show preview and Table mouse hover selection (#3098)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-04-28 01:07:37 +07:00 committed by GitHub
parent 1c0d04132a
commit cc9b6c1e3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -135,12 +135,13 @@ function ShowActions (doc: Doc | Doc[] | undefined, evt: Event): void {
showPopup(view.component.ActionsPopup, { viewContext: $contextStore[$contextStore.length - 1] }, 'top')
}
function ShowPreview (doc: Doc | undefined, evt: Event): void {
function ShowPreview (doc: Doc | Doc[] | undefined, evt: Event): void {
previewDocument.update((old) => {
if (old?._id === doc?._id) {
const d = Array.isArray(doc) ? doc[0] : doc
if (old?._id === d?._id) {
return undefined
}
return doc
return d
})
evt.preventDefault()
}

View File

@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import core, { Doc, Ref, TxRemoveDoc } from '@hcengineering/core'
import core, { Doc, Hierarchy, Ref, TxRemoveDoc } from '@hcengineering/core'
import { getResource } from '@hcengineering/platform'
import { addTxListener, getClient } from '@hcengineering/presentation'
import { AnyComponent, Component } from '@hcengineering/ui'
@ -217,7 +217,7 @@
let presenter: AnyComponent | undefined
async function updatePreviewPresenter (doc?: Doc): Promise<void> {
presenter = doc !== undefined ? await getObjectPreview(client, doc._class) : undefined
presenter = doc !== undefined ? await getObjectPreview(client, Hierarchy.mixinOrClass(doc)) : undefined
}
$: updatePreviewPresenter($previewDocument)

View File

@ -278,7 +278,7 @@
class:checking={checkedSet.has(object._id)}
class:fixed={row === selection}
class:selected={row === selection}
on:mouseenter={mouseAttractor(() => onRow(object))}
on:mouseover={mouseAttractor(() => onRow(object))}
on:focus={() => {}}
bind:this={refs[row]}
on:contextmenu|preventDefault={(ev) => {