Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-06-02 17:13:52 +07:00 committed by GitHub
parent 227b29d7bc
commit d97f72234b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 40 deletions

View File

@ -453,14 +453,6 @@
? 'visible'
: 'hidden'
let scrollY: number = 0
let safariScrollJumpfix: boolean = true
export const enableSafariScrollJumpFix = (enable: boolean): void => {
if (enable) {
scrollY = divScroll?.scrollTop ?? 0
}
safariScrollJumpfix = enable
}
</script>
<svelte:window on:resize={_resize} />
@ -484,25 +476,24 @@
}}
class="scroll relative flex-shrink"
style:overflow-x={horizontal ? 'auto' : 'hidden'}
on:scroll={() => {
on:scroll={(evt) => {
if ($tooltipstore.label !== undefined) closeTooltip()
const newPos = divScroll?.scrollTop ?? 0
// TODO: Workaround: https://front.hc.engineering/workbench/platform/tracker/TSK-760
// In Safari scroll could jump on click, with no particular reason.
if (safariScrollJumpfix) {
const newPos = divScroll?.scrollTop ?? 0
if (
!scrolling &&
!isScrolling &&
scrollY !== 0 &&
Math.abs(newPos - scrollY) > 100 &&
divScroll !== undefined &&
isSafari()
) {
divScroll.scrollTop = scrollY
}
scrollY = divScroll?.scrollTop ?? 0
if (
!scrolling &&
!isScrolling &&
scrollY !== 0 &&
Math.abs(newPos - scrollY) > 100 &&
divScroll !== undefined &&
isSafari()
) {
divScroll.scrollTop = scrollY
}
scrollY = divScroll?.scrollTop ?? 0
}}
>
<div

View File

@ -20,12 +20,12 @@
import ui, {
addNotification,
deviceOptionsStore,
EditWithIcon,
Icon,
IconCheck,
IconSearch,
Loading,
resizeObserver,
EditWithIcon,
IconSearch
resizeObserver
} from '@hcengineering/ui'
import { Filter } from '@hcengineering/view'
import { FILTER_DEBOUNCE_MS, FilterRemovedNotification, sortFilterValues } from '@hcengineering/view-resources'
@ -84,8 +84,7 @@
}
if (values.length !== targets.size) {
const oldSize = filter.value.length
const set = new Set(values.map((p) => p?._id))
filter.value = filter.value.filter((p) => set.has(p))
filter.value = filter.value.filter((p) => targets.has(p))
const removed = oldSize - (filter.value.length ?? 0)
if (removed > 0) {
onChange(filter)

View File

@ -88,7 +88,7 @@
"BeforeDate": "До даты",
"AfterDate": "После даты",
"BetweenDates": "Между датами",
"Public": "Публичныйы",
"Public": "Публичный",
"Hide": "Спрятать",
"SaveAs": "Сохранить как",
"And": "и",

View File

@ -148,7 +148,6 @@
on:select-prev={(evt) => {
select(-2, evt.detail)
}}
on:collapsed
/>
</div>

View File

@ -319,7 +319,6 @@
index: e.detail.index + getInitIndex(categories, i)
})
}}
on:collapsed
{flatHeaders}
{disableHeader}
{props}

View File

@ -390,7 +390,6 @@
$focusStore = { provider: $focusStore.provider }
}
}
dispatch('collapsed', { div })
}
localStorage.setItem(categoryCollapseKey, collapsed ? 'true' : 'false')
}}
@ -461,6 +460,11 @@
</div>
<style lang="scss">
.expandCollapse {
overflow: hidden;
transition: height 0.3s ease-out;
height: auto;
}
.zero-container {
border-radius: 0.25rem;

View File

@ -198,6 +198,7 @@
<style lang="scss">
.categoryHeader {
position: relative;
position: sticky;
top: 0;
padding: 0 2.5rem 0 0.75rem;

View File

@ -22,7 +22,6 @@
export let props: Record<string, any> = {}
let list: List
let scroll: Scroller
const listProvider = new ListSelectionProvider((offset: 1 | -1 | 0, of?: Doc, dir?: SelectDirection) => {
if (dir === 'vertical') {
@ -44,7 +43,6 @@
<div class="w-full h-full py-4 clear-mins">
<Scroller
bind:this={scroll}
fade={{ multipler: { top: 2.75 * viewOptions.groupBy.length, bottom: 0 } }}
padding={'0 1rem'}
noFade
@ -71,13 +69,8 @@
on:check={(event) => {
listProvider.updateSelection(event.detail.docs, event.detail.value)
}}
on:content={(event) => {
listProvider.update(event.detail)
}}
on:collapsed={(event) => {
scroll.enableSafariScrollJumpFix(false)
event.detail.div.scrollIntoView(true)
scroll.enableSafariScrollJumpFix(true)
on:content={(evt) => {
listProvider.update(evt.detail)
}}
/>
</Scroller>