mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 04:08:19 +00:00
introduce canClose
(#256)
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
99a9feb36a
commit
56deb3a4b0
@ -37,7 +37,7 @@
|
||||
const dispatch = createEventDispatcher()
|
||||
</script>
|
||||
|
||||
<form class="card-container">
|
||||
<form class="card-container" on:submit|preventDefault={ () => {} }>
|
||||
<div class="card-bg" />
|
||||
<div class="flex-between header">
|
||||
<div class="overflow-label label"><Label {label} /></div>
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
let modalHTML: HTMLElement
|
||||
let modalOHTML: HTMLElement
|
||||
let componentInstance: any
|
||||
|
||||
function close(result: any) {
|
||||
console.log('popup close result', result)
|
||||
@ -34,6 +35,13 @@
|
||||
closePopup()
|
||||
}
|
||||
|
||||
function escapeClose() {
|
||||
if (componentInstance && componentInstance.canClose) {
|
||||
if (!componentInstance.canClose()) return
|
||||
}
|
||||
close(undefined)
|
||||
}
|
||||
|
||||
const fitPopup = (): void => {
|
||||
if (modalHTML) {
|
||||
if (element) {
|
||||
@ -78,9 +86,9 @@
|
||||
|
||||
<svelte:window on:resize={fitPopup} />
|
||||
<div class="popup" bind:this={modalHTML} style={`z-index: ${zIndex + 1};`}>
|
||||
<svelte:component this={is} {...props} on:update={fitPopup} on:close={ (ev) => close(ev.detail) } />
|
||||
<svelte:component bind:this={componentInstance} this={is} {...props} on:update={fitPopup} on:close={ (ev) => close(ev.detail) } />
|
||||
</div>
|
||||
<div bind:this={modalOHTML} class="modal-overlay" style={`z-index: ${zIndex};`} on:click={() => close(undefined)} />
|
||||
<div bind:this={modalOHTML} class="modal-overlay" style={`z-index: ${zIndex};`} on:click={() => escapeClose()} />
|
||||
|
||||
<style lang="scss">
|
||||
.popup {
|
||||
|
@ -38,8 +38,7 @@
|
||||
import Elon from '../../img/elon.png'
|
||||
import Bond from '../../img/bond.png'
|
||||
|
||||
import equals from 'deep-equal'
|
||||
import { combineName } from '@anticrm/contact';
|
||||
import { combineName } from '@anticrm/contact';
|
||||
|
||||
export let space: Ref<Space>
|
||||
|
||||
@ -48,6 +47,10 @@ import { combineName } from '@anticrm/contact';
|
||||
let firstName = ''
|
||||
let lastName = ''
|
||||
|
||||
export function canClose(): boolean {
|
||||
return firstName === '' && lastName === ''
|
||||
}
|
||||
|
||||
const object: Candidate = {} as Candidate
|
||||
|
||||
let resume = {} as {
|
||||
|
Loading…
Reference in New Issue
Block a user