mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
Fix popup fit (#2959)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
8d0e911f28
commit
08621c4bc1
@ -17,6 +17,14 @@
|
|||||||
import PopupInstance from './PopupInstance.svelte'
|
import PopupInstance from './PopupInstance.svelte'
|
||||||
|
|
||||||
export let contentPanel: HTMLElement
|
export let contentPanel: HTMLElement
|
||||||
|
|
||||||
|
const instances: PopupInstance[] = []
|
||||||
|
|
||||||
|
export function fitPopupInstance (): void {
|
||||||
|
instances.forEach((p) => p.fitPopupInstance())
|
||||||
|
}
|
||||||
|
|
||||||
|
$: instances.length = $modal.length
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $modal.length > 0}
|
{#if $modal.length > 0}
|
||||||
@ -25,6 +33,7 @@
|
|||||||
{#each $modal as popup, i}
|
{#each $modal as popup, i}
|
||||||
{#key popup.id}
|
{#key popup.id}
|
||||||
<PopupInstance
|
<PopupInstance
|
||||||
|
bind:this={instances[i]}
|
||||||
is={popup.is}
|
is={popup.is}
|
||||||
props={popup.props}
|
props={popup.props}
|
||||||
element={popup.element}
|
element={popup.element}
|
||||||
|
@ -115,6 +115,10 @@
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fitPopupInstance (): void {
|
||||||
|
if (modalHTML) fitPopup(modalHTML, element, contentPanel)
|
||||||
|
}
|
||||||
|
|
||||||
$: if ($deviceInfo.docWidth <= 900 && !docSize) docSize = true
|
$: if ($deviceInfo.docWidth <= 900 && !docSize) docSize = true
|
||||||
$: if ($deviceInfo.docWidth > 900 && docSize) docSize = false
|
$: if ($deviceInfo.docWidth > 900 && docSize) docSize = false
|
||||||
</script>
|
</script>
|
||||||
|
@ -96,6 +96,7 @@
|
|||||||
.then((res) => (apps = res))
|
.then((res) => (apps = res))
|
||||||
|
|
||||||
let panelInstance: PanelInstance
|
let panelInstance: PanelInstance
|
||||||
|
let popupInstance: Popup
|
||||||
|
|
||||||
let visibileNav: boolean = true
|
let visibileNav: boolean = true
|
||||||
async function toggleNav (): Promise<void> {
|
async function toggleNav (): Promise<void> {
|
||||||
@ -104,6 +105,7 @@
|
|||||||
if (currentApplication && navigatorModel && navigator) {
|
if (currentApplication && navigatorModel && navigator) {
|
||||||
await tick()
|
await tick()
|
||||||
panelInstance.fitPopupInstance()
|
panelInstance.fitPopupInstance()
|
||||||
|
popupInstance.fitPopupInstance()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -695,7 +697,7 @@
|
|||||||
<ActionContext context={{ mode: 'panel' }} />
|
<ActionContext context={{ mode: 'panel' }} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</PanelInstance>
|
</PanelInstance>
|
||||||
<Popup {contentPanel}>
|
<Popup bind:this={popupInstance} {contentPanel}>
|
||||||
<svelte:fragment slot="popup-header">
|
<svelte:fragment slot="popup-header">
|
||||||
<ActionContext context={{ mode: 'popup' }} />
|
<ActionContext context={{ mode: 'popup' }} />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
|
Loading…
Reference in New Issue
Block a user