introduce canClose (#256)

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-10-12 12:11:45 +02:00 committed by GitHub
parent 99a9feb36a
commit 56deb3a4b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 5 deletions

View File

@ -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>

View File

@ -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 {

View File

@ -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 {