mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 11:50:56 +00:00
Auto expand Accordion (#2595)
Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
parent
0bee06e8a7
commit
472cb40dda
@ -35,6 +35,8 @@
|
||||
const attachments: AttachmentStyledBox[] = []
|
||||
const edits: TextEditor[] = []
|
||||
let hasAttachments: boolean = false
|
||||
const expanded: boolean[] = []
|
||||
items.forEach(() => expanded.push(false))
|
||||
|
||||
const flip = (index: number, ev?: MouseEvent): void => {
|
||||
ev?.stopPropagation()
|
||||
@ -54,6 +56,14 @@
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
const onScroll = (row: number, ev: Event) => {
|
||||
const target = ev.target as HTMLDivElement
|
||||
if (target && !expanded[row] && target.clientHeight < target.scrollHeight) {
|
||||
expanded[row] = true
|
||||
flip(row)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="antiAccordion">
|
||||
@ -71,7 +81,7 @@
|
||||
}}
|
||||
>
|
||||
<span class="label"><Label label={item.label} /></span>
|
||||
<div class="value">
|
||||
<div class="value" on:scroll={(ev) => onScroll(i, ev)}>
|
||||
{#if item.state === 'closed'}
|
||||
<TextEditor
|
||||
bind:content={item.content}
|
||||
|
Loading…
Reference in New Issue
Block a user