mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-23 00:37:47 +00:00
UBER-459: remove whereSelected line in dropdowns. (#3417)
Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
parent
2f75e20e00
commit
95ffbd6d33
@ -24,7 +24,6 @@
|
|||||||
IconCheck,
|
IconCheck,
|
||||||
IconSearch,
|
IconSearch,
|
||||||
ListView,
|
ListView,
|
||||||
closeTooltip,
|
|
||||||
createFocusManager,
|
createFocusManager,
|
||||||
deviceOptionsStore,
|
deviceOptionsStore,
|
||||||
resizeObserver,
|
resizeObserver,
|
||||||
@ -142,43 +141,6 @@
|
|||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
let selectedDiv: HTMLElement | undefined
|
|
||||||
let scrollDiv: HTMLElement | undefined
|
|
||||||
let cHeight = 0
|
|
||||||
let timer: any = null
|
|
||||||
|
|
||||||
const updateLocation = (scrollDiv?: HTMLElement, selectedDiv?: HTMLElement, objects?: Doc[], selected?: Ref<Doc>) => {
|
|
||||||
const objIt = objects?.find((it) => it._id === selected)
|
|
||||||
if (objIt === undefined) {
|
|
||||||
cHeight = 0
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (scrollDiv && selectedDiv) {
|
|
||||||
const r = selectedDiv.getBoundingClientRect()
|
|
||||||
const r2 = scrollDiv.getBoundingClientRect()
|
|
||||||
if (r && r2) {
|
|
||||||
if (r.top > r2.top && r.bottom < r2.bottom) {
|
|
||||||
cHeight = 0
|
|
||||||
} else {
|
|
||||||
if (r.bottom < r2.bottom) {
|
|
||||||
cHeight = 1
|
|
||||||
} else {
|
|
||||||
cHeight = -1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!timer) {
|
|
||||||
timer = setTimeout(() => {
|
|
||||||
closeTooltip()
|
|
||||||
clearTimeout(timer)
|
|
||||||
timer = null
|
|
||||||
}, 50)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$: updateLocation(scrollDiv, selectedDiv, objects, selected)
|
|
||||||
|
|
||||||
const forbiddenDeselectItemIds = new Set(disallowDeselect)
|
const forbiddenDeselectItemIds = new Set(disallowDeselect)
|
||||||
|
|
||||||
function getGroup (doc: Doc, groupBy: any): any {
|
function getGroup (doc: Doc, groupBy: any): any {
|
||||||
@ -226,10 +188,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if cHeight === 1}
|
<div class="scroll">
|
||||||
<div class="whereSelected" />
|
|
||||||
{/if}
|
|
||||||
<div class="scroll" on:scroll={() => updateLocation(scrollDiv, selectedDiv, objects, selected)} bind:this={scrollDiv}>
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<ListView bind:this={list} count={objects.length} bind:selection>
|
<ListView bind:this={list} count={objects.length} bind:selection>
|
||||||
<svelte:fragment slot="category" let:item>
|
<svelte:fragment slot="category" let:item>
|
||||||
@ -260,7 +219,7 @@
|
|||||||
{#if (allowDeselect && selected) || multiSelect || selected}
|
{#if (allowDeselect && selected) || multiSelect || selected}
|
||||||
<div class="check" class:disabled={readonly}>
|
<div class="check" class:disabled={readonly}>
|
||||||
{#if obj._id === selected || selectedElements.has(obj._id)}
|
{#if obj._id === selected || selectedElements.has(obj._id)}
|
||||||
<div bind:this={selectedDiv} use:tooltip={{ label: titleDeselect ?? presentation.string.Deselect }}>
|
<div use:tooltip={{ label: titleDeselect ?? presentation.string.Deselect }}>
|
||||||
<Icon icon={IconCheck} size={'small'} />
|
<Icon icon={IconCheck} size={'small'} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@ -271,9 +230,6 @@
|
|||||||
</ListView>
|
</ListView>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if cHeight === -1}
|
|
||||||
<div class="whereSelected" />
|
|
||||||
{/if}
|
|
||||||
<div class="menu-space" />
|
<div class="menu-space" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -194,10 +194,6 @@
|
|||||||
&.show + .menu-group { height: auto; }
|
&.show + .menu-group { height: auto; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.whereSelected {
|
|
||||||
height: 2px;
|
|
||||||
background-color: var(--theme-caret-color);
|
|
||||||
}
|
|
||||||
.menu-space {
|
.menu-space {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
height: .5rem;
|
height: .5rem;
|
||||||
|
@ -82,35 +82,6 @@
|
|||||||
$: filteredObjects = value.filter((el) => (el.label ?? el.text ?? '').toLowerCase().includes(search.toLowerCase()))
|
$: filteredObjects = value.filter((el) => (el.label ?? el.text ?? '').toLowerCase().includes(search.toLowerCase()))
|
||||||
|
|
||||||
$: huge = size === 'medium' || size === 'large'
|
$: huge = size === 'medium' || size === 'large'
|
||||||
|
|
||||||
let selectedDiv: HTMLElement | undefined
|
|
||||||
let scrollDiv: HTMLElement | undefined
|
|
||||||
let cHeight = 0
|
|
||||||
|
|
||||||
const updateLocation = (scrollDiv?: HTMLElement, selectedDiv?: HTMLElement, objects?: ValueType[]) => {
|
|
||||||
const objIt = objects?.find((it) => it.isSelected)
|
|
||||||
if (objIt === undefined) {
|
|
||||||
cHeight = 0
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (scrollDiv && selectedDiv) {
|
|
||||||
const r = selectedDiv.getBoundingClientRect()
|
|
||||||
const r2 = scrollDiv.getBoundingClientRect()
|
|
||||||
if (r && r2) {
|
|
||||||
if (r.top > r2.top && r.bottom < r2.bottom) {
|
|
||||||
cHeight = 0
|
|
||||||
} else {
|
|
||||||
if (r.bottom < r2.bottom) {
|
|
||||||
cHeight = 1
|
|
||||||
} else {
|
|
||||||
cHeight = -1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$: updateLocation(scrollDiv, selectedDiv, filteredObjects)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<FocusHandler {manager} />
|
<FocusHandler {manager} />
|
||||||
@ -140,10 +111,7 @@
|
|||||||
{:else}
|
{:else}
|
||||||
<div class="menu-space" />
|
<div class="menu-space" />
|
||||||
{/if}
|
{/if}
|
||||||
{#if cHeight === 1}
|
<div class="scroll">
|
||||||
<div class="whereSelected" />
|
|
||||||
{/if}
|
|
||||||
<div class="scroll" on:scroll={() => updateLocation(scrollDiv, selectedDiv, filteredObjects)} bind:this={scrollDiv}>
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<ListView
|
<ListView
|
||||||
bind:this={list}
|
bind:this={list}
|
||||||
@ -174,9 +142,7 @@
|
|||||||
{#if hasSelected}
|
{#if hasSelected}
|
||||||
<div class="check">
|
<div class="check">
|
||||||
{#if item.isSelected}
|
{#if item.isSelected}
|
||||||
<div bind:this={selectedDiv}>
|
<Icon icon={IconCheck} size={'small'} />
|
||||||
<Icon icon={IconCheck} size={'small'} />
|
|
||||||
</div>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@ -202,8 +168,5 @@
|
|||||||
</ListView>
|
</ListView>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if cHeight === -1}
|
|
||||||
<div class="whereSelected" />
|
|
||||||
{/if}
|
|
||||||
<div class="menu-space" />
|
<div class="menu-space" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import contact, { Contact, Employee, EmployeeAccount, Person } from '@hcengineering/contact'
|
import contact, { Contact, Employee, EmployeeAccount, Person } from '@hcengineering/contact'
|
||||||
import { Doc, DocumentQuery, FindOptions, getCurrentAccount, Ref } from '@hcengineering/core'
|
import { DocumentQuery, FindOptions, getCurrentAccount, Ref } from '@hcengineering/core'
|
||||||
import type { Asset, IntlString } from '@hcengineering/platform'
|
import type { Asset, IntlString } from '@hcengineering/platform'
|
||||||
import {
|
import {
|
||||||
createFocusManager,
|
createFocusManager,
|
||||||
@ -144,36 +144,6 @@
|
|||||||
function toAny (obj: any): any {
|
function toAny (obj: any): any {
|
||||||
return obj
|
return obj
|
||||||
}
|
}
|
||||||
|
|
||||||
let selectedDiv: HTMLElement | undefined
|
|
||||||
let scrollDiv: HTMLElement | undefined
|
|
||||||
let cHeight = 0
|
|
||||||
|
|
||||||
const updateLocation = (scrollDiv?: HTMLElement, selectedDiv?: HTMLElement, objects?: Doc[], selected?: Ref<Doc>) => {
|
|
||||||
const objIt = objects?.find((it) => it._id === selected)
|
|
||||||
if (objIt === undefined) {
|
|
||||||
cHeight = 0
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (scrollDiv && selectedDiv) {
|
|
||||||
const r = selectedDiv.getBoundingClientRect()
|
|
||||||
const r2 = scrollDiv.getBoundingClientRect()
|
|
||||||
|
|
||||||
if (r && r2) {
|
|
||||||
if (r.top > r2.top && r.bottom < r2.bottom) {
|
|
||||||
cHeight = 0
|
|
||||||
} else {
|
|
||||||
if (r.bottom < r2.bottom) {
|
|
||||||
cHeight = 1
|
|
||||||
} else {
|
|
||||||
cHeight = -1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$: updateLocation(scrollDiv, selectedDiv, contacts, selected)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<FocusHandler {manager} />
|
<FocusHandler {manager} />
|
||||||
@ -200,14 +170,7 @@
|
|||||||
on:change
|
on:change
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{#if cHeight === 1}
|
<div class="scroll">
|
||||||
<div class="whereSelected" />
|
|
||||||
{/if}
|
|
||||||
<div
|
|
||||||
class="scroll"
|
|
||||||
on:scroll={() => updateLocation(scrollDiv, selectedDiv, contacts, selected)}
|
|
||||||
bind:this={scrollDiv}
|
|
||||||
>
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<ListView bind:this={list} count={contacts.length} bind:selection>
|
<ListView bind:this={list} count={contacts.length} bind:selection>
|
||||||
<svelte:fragment slot="category" let:item>
|
<svelte:fragment slot="category" let:item>
|
||||||
@ -244,7 +207,7 @@
|
|||||||
{#if allowDeselect && selected}
|
{#if allowDeselect && selected}
|
||||||
<div class="check">
|
<div class="check">
|
||||||
{#if obj._id === selected}
|
{#if obj._id === selected}
|
||||||
<div bind:this={selectedDiv} use:tooltip={{ label: titleDeselect ?? presentation.string.Deselect }}>
|
<div use:tooltip={{ label: titleDeselect ?? presentation.string.Deselect }}>
|
||||||
<Icon icon={IconCheck} size={'small'} />
|
<Icon icon={IconCheck} size={'small'} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
@ -255,9 +218,6 @@
|
|||||||
</ListView>
|
</ListView>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if cHeight === -1}
|
|
||||||
<div class="whereSelected" />
|
|
||||||
{/if}
|
|
||||||
<div class="menu-space" />
|
<div class="menu-space" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user