Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions packages/presentation/src/components/Card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { Button, IconClose, Label, MiniToggle } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import presentation from '..'
import { deviceOptionsStore as deviceInfo } from '@hcengineering/ui'
import { deviceOptionsStore as deviceInfo, resizeObserver } from '@hcengineering/ui'

export let label: IntlString
export let labelProps: any | undefined = undefined
Expand All @@ -33,7 +33,14 @@
let okProcessing = false
</script>

<form id={label} class="antiCard {$deviceInfo.isMobile ? 'mobile' : 'dialog'}" on:submit|preventDefault={() => {}}>
<form
id={label}
class="antiCard {$deviceInfo.isMobile ? 'mobile' : 'dialog'}"
on:submit|preventDefault={() => {}}
use:resizeObserver={() => {
dispatch('changeContent')
}}
>
<div class="antiCard-header">
<div class="antiCard-header__title-wrap">
{#if $$slots.header}
Expand Down
10 changes: 6 additions & 4 deletions packages/presentation/src/components/ObjectPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
IconCheck,
ListView,
showPopup,
tooltip
tooltip,
resizeObserver
} from '@hcengineering/ui'
import { afterUpdate, createEventDispatcher } from 'svelte'
import { createEventDispatcher } from 'svelte'
import presentation from '..'
import { ObjectCreate } from '../types'
import { createQuery, getClient } from '../utils'
Expand Down Expand Up @@ -158,8 +159,6 @@
return obj
}

afterUpdate(() => dispatch('changeContent'))

let selectedDiv: HTMLElement | undefined
let scrollDiv: HTMLElement | undefined
let cHeight = 0
Expand Down Expand Up @@ -198,6 +197,9 @@
class:plainContainer={!shadows}
class:width-40={width === 'large'}
on:keydown={onKeydown}
use:resizeObserver={() => {
dispatch('changeContent')
}}
>
<div class="header flex-between">
<EditBox kind={'search-style'} focusIndex={1} focus bind:value={search} {placeholder} />
Expand Down
6 changes: 2 additions & 4 deletions packages/presentation/src/components/SpacesMultiPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
import type { IntlString } from '@hcengineering/platform'
import { translate } from '@hcengineering/platform'
import { createEventDispatcher, onMount } from 'svelte'

import core, { Class, getCurrentAccount, Ref, Space } from '@hcengineering/core'
import { tooltip, CheckBox } from '@hcengineering/ui'

import { tooltip, CheckBox, resizeObserver } from '@hcengineering/ui'
import { createQuery } from '../utils'
import presentation from '..'
import SpaceInfo from './SpaceInfo.svelte'
Expand Down Expand Up @@ -91,7 +89,7 @@
})
</script>

<div class="selectPopup">
<div class="selectPopup" use:resizeObserver={() => dispatch('changeContent')}>
<div class="header">
<input bind:this={input} type="text" bind:value={searchQuery} placeholder={phTraslate} on:change />
</div>
Expand Down
7 changes: 1 addition & 6 deletions packages/presentation/src/components/UsersPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.
-->
<script lang="ts">
import { createEventDispatcher, afterUpdate } from 'svelte'
import { Contact, getFirstName, Person } from '@hcengineering/contact'
import type { Class, Doc, DocumentQuery, FindOptions, Ref } from '@hcengineering/core'
import type { Asset, IntlString } from '@hcengineering/platform'
Expand Down Expand Up @@ -51,10 +50,6 @@
}
}
: undefined

const dispatch = createEventDispatcher()

afterUpdate(() => dispatch('changeContent'))
</script>

<ObjectPopup
Expand All @@ -73,7 +68,7 @@
create={_create}
on:update
on:close
on:changeContent={() => dispatch('changeContent')}
on:changeContent
>
<svelte:fragment slot="item" let:item={person}>
<div class="flex flex-grow overflow-label">
Expand Down
14 changes: 13 additions & 1 deletion packages/text-editor/src/components/StyledTextBox.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<script lang="ts">
import { IntlString } from '@hcengineering/platform'
import presentation, { MessageViewer } from '@hcengineering/presentation'
import { ActionIcon, IconCheck, IconClose, IconEdit, IconSize, Label, ShowMore } from '@hcengineering/ui'
import {
ActionIcon,
IconCheck,
IconClose,
IconEdit,
IconSize,
Label,
ShowMore,
resizeObserver
} from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import textEditorPlugin from '../plugin'
import StyledTextEditor from './StyledTextEditor.svelte'
Expand Down Expand Up @@ -78,6 +87,9 @@
textEditor?.focus()
}
}}
use:resizeObserver={() => {
dispatch('changeSize')
}}
>
{#if label}
<div class="label"><Label {label} /></div>
Expand Down
9 changes: 8 additions & 1 deletion packages/ui/src/components/ColorPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import { createEventDispatcher, onMount } from 'svelte'
import { getPlatformColor } from '../colors'
import ListView from './ListView.svelte'
import { resizeObserver } from '..'

export let placeholder: IntlString | undefined = undefined
export let placeholderParam: any | undefined = undefined
Expand Down Expand Up @@ -73,7 +74,13 @@
})
</script>

<div class="selectPopup" on:keydown={onKeydown}>
<div
class="selectPopup"
on:keydown={onKeydown}
use:resizeObserver={() => {
dispatch('changeContent')
}}
>
{#if searchable}
<div class="header">
<input bind:this={input} type="text" bind:value={search} placeholder={phTraslate} on:input={() => {}} on:change />
Expand Down
9 changes: 8 additions & 1 deletion packages/ui/src/components/DropdownLabelsPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import plugin from '../plugin'
import CheckBox from './CheckBox.svelte'
import ListView from './ListView.svelte'
import { resizeObserver } from '..'

export let placeholder: IntlString = plugin.string.SearchDots
export let items: DropdownTextItem[]
Expand Down Expand Up @@ -72,7 +73,13 @@
}
</script>

<div class="selectPopup" on:keydown={onKeydown}>
<div
class="selectPopup"
on:keydown={onKeydown}
use:resizeObserver={() => {
dispatch('changeContent')
}}
>
<div class="header">
<input
bind:this={searchInput}
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/DropdownLabelsPopupIntl.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import type { DropdownIntlItem } from '../types'
import CheckBox from './CheckBox.svelte'
import Label from './Label.svelte'
import { resizeObserver } from '..'

export let items: DropdownIntlItem[]
export let selected: DropdownIntlItem['id'] | undefined = undefined
Expand All @@ -35,7 +36,7 @@
}
</script>

<div class="selectPopup">
<div class="selectPopup" use:resizeObserver={() => dispatch('changeContent')}>
<div class="scroll">
<div class="box">
{#each items as item, i}
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/components/DropdownPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
import type { Asset, IntlString } from '@hcengineering/platform'
import { translate } from '@hcengineering/platform'
import { createEventDispatcher, onMount } from 'svelte'

import type { AnySvelteComponent, ListItem } from '../types'
import plugin from '../plugin'
import Icon from './Icon.svelte'
import ListView from './ListView.svelte'
import { resizeObserver } from '..'

export let icon: Asset | AnySvelteComponent
export let placeholder: IntlString = plugin.string.SearchDots
Expand Down Expand Up @@ -77,7 +77,7 @@
}
</script>

<div class="selectPopup" on:keydown={onKeydown}>
<div class="selectPopup" use:resizeObserver={() => dispatch('changeContent')} on:keydown={onKeydown}>
<div class="header">
<input
bind:this={searchInput}
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/DropdownRecordPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import CheckBox from './CheckBox.svelte'
import Label from './Label.svelte'
import ListView from './ListView.svelte'
import { resizeObserver } from '..'

export let items: Record<any, IntlString>
export let selected: any | undefined = undefined
Expand Down Expand Up @@ -58,7 +59,7 @@
}
</script>

<div class="selectPopup" on:keydown={onKeydown}>
<div class="selectPopup" use:resizeObserver={() => dispatch('changeContent')} on:keydown={onKeydown}>
<div class="scroll">
<div class="box">
<ListView bind:this={list} count={objects.length} bind:selection>
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/ExpandCollapse.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</script>

<div class="root" style="height: {$tweenedHeight}px">
<div bind:offsetHeight={height} class="clear-mins">
<div bind:offsetHeight={height} class="flex-no-shrink clear-mins">
<slot />
</div>
</div>
Expand All @@ -41,5 +41,6 @@
.root {
overflow: hidden;
min-height: 0;
flex-shrink: 0;
}
</style>
15 changes: 10 additions & 5 deletions packages/ui/src/components/ListView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
// limitations under the License.
-->
<script lang="ts">
import { afterUpdate, createEventDispatcher } from 'svelte'
import { createEventDispatcher } from 'svelte'
import { resizeObserver } from '..'

export let selection: number = 0
export let count: number
Expand Down Expand Up @@ -53,12 +54,16 @@
r?.scrollIntoView({ behavior: 'auto', block: 'nearest' })
}
}

afterUpdate(() => dispatch('changeContent'))
</script>

{#if count}
<div class="list-container flex-col flex-grow" style:overflow={'auto'}>
<div
class="list-container flex-col flex-grow"
style:overflow={'auto'}
use:resizeObserver={() => {
dispatch('changeContent')
}}
>
{#each Array(count) as _, row}
<slot name="category" item={row} />
<div
Expand All @@ -76,7 +81,7 @@

<style lang="scss">
.list-container {
border-radius: 0.25rem;
// border-radius: 0.25rem;
user-select: none;

.selection {
Expand Down
17 changes: 10 additions & 7 deletions packages/ui/src/components/Menu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.
-->
<script lang="ts">
import { afterUpdate, createEventDispatcher, onDestroy, onMount } from 'svelte'
import { createEventDispatcher, onDestroy, onMount } from 'svelte'
import { generateId, Ref, Doc } from '@hcengineering/core'
import ui from '../plugin'
import { closePopup, showPopup } from '../popups'
Expand Down Expand Up @@ -68,9 +68,6 @@
}
}

afterUpdate(() => {
dispatch('changeContent')
})
onMount(() => {
if (btns[0]) {
btns[0].focus()
Expand Down Expand Up @@ -142,7 +139,9 @@
bind:this={btns[i]}
class="ap-menuItem flex-row-center withIcon w-full"
class:hover={btns[i] === activeElement}
on:mouseover={(evt) => focusTarget(action, btns[i])}
on:mousemove={() => {
if (btns[i] !== activeElement) focusTarget(action, btns[i])
}}
on:click|preventDefault|stopPropagation={(evt) => {
if (!action.inline) dispatch('close')
action.action(ctx, evt)
Expand All @@ -158,7 +157,9 @@
bind:this={btns[i]}
class="ap-menuItem antiPopup-submenu withIconHover"
class:hover={btns[i] === activeElement}
on:mouseover={() => focusTarget(action, btns[i])}
on:mousemove={() => {
if (btns[i] !== activeElement) focusTarget(action, btns[i])
}}
on:click={() => focusTarget(action, btns[i])}
>
{#if action.icon}
Expand All @@ -172,7 +173,9 @@
bind:this={btns[i]}
class="ap-menuItem flex-row-center withIcon"
class:hover={btns[i] === activeElement}
on:mouseover={() => focusTarget(action, btns[i], action.isSubmenuRightClicking)}
on:mousemove={() => {
if (btns[i] !== activeElement) focusTarget(action, btns[i], action.isSubmenuRightClicking)
}}
on:click={(evt) => {
if (!action.inline) dispatch('close')
action.action(ctx, evt)
Expand Down
8 changes: 4 additions & 4 deletions packages/ui/src/components/PopupInstance.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.
-->
<script lang="ts">
import { afterUpdate, onMount } from 'svelte'
import { onMount } from 'svelte'
import { fitPopupElement } from '../popups'
import type { AnyComponent, AnySvelteComponent, PopupAlignment, PopupOptions } from '../types'
import { deviceOptionsStore as deviceInfo } from '..'
Expand Down Expand Up @@ -44,7 +44,8 @@
height: '',
maxWidth: '',
maxHeight: '',
minWidth: ''
minWidth: '',
minHeight: ''
},
showOverlay: false,
direction: 'bottom'
Expand Down Expand Up @@ -101,8 +102,6 @@
onMount(() => fitPopup())
$: if ($deviceInfo.docWidth <= 900 && !docSize) docSize = true
$: if ($deviceInfo.docWidth > 900 && docSize) docSize = false

afterUpdate(() => fitPopup())
</script>

<svelte:window on:resize={fitPopup} on:keydown={handleKeydown} />
Expand All @@ -121,6 +120,7 @@
style:max-width={options.props.maxWidth}
style:max-height={options.props.maxHeight}
style:min-width={options.props.minWidth}
style:min-height={options.props.minHeight}
style:transform={options.props.transform}
>
<svelte:component
Expand Down
Loading