mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-19 23:00:13 +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()
|
const dispatch = createEventDispatcher()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form class="card-container">
|
<form class="card-container" on:submit|preventDefault={ () => {} }>
|
||||||
<div class="card-bg" />
|
<div class="card-bg" />
|
||||||
<div class="flex-between header">
|
<div class="flex-between header">
|
||||||
<div class="overflow-label label"><Label {label} /></div>
|
<div class="overflow-label label"><Label {label} /></div>
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
let modalHTML: HTMLElement
|
let modalHTML: HTMLElement
|
||||||
let modalOHTML: HTMLElement
|
let modalOHTML: HTMLElement
|
||||||
|
let componentInstance: any
|
||||||
|
|
||||||
function close(result: any) {
|
function close(result: any) {
|
||||||
console.log('popup close result', result)
|
console.log('popup close result', result)
|
||||||
@ -34,6 +35,13 @@
|
|||||||
closePopup()
|
closePopup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function escapeClose() {
|
||||||
|
if (componentInstance && componentInstance.canClose) {
|
||||||
|
if (!componentInstance.canClose()) return
|
||||||
|
}
|
||||||
|
close(undefined)
|
||||||
|
}
|
||||||
|
|
||||||
const fitPopup = (): void => {
|
const fitPopup = (): void => {
|
||||||
if (modalHTML) {
|
if (modalHTML) {
|
||||||
if (element) {
|
if (element) {
|
||||||
@ -78,9 +86,9 @@
|
|||||||
|
|
||||||
<svelte:window on:resize={fitPopup} />
|
<svelte:window on:resize={fitPopup} />
|
||||||
<div class="popup" bind:this={modalHTML} style={`z-index: ${zIndex + 1};`}>
|
<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>
|
||||||
<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">
|
<style lang="scss">
|
||||||
.popup {
|
.popup {
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
import Elon from '../../img/elon.png'
|
import Elon from '../../img/elon.png'
|
||||||
import Bond from '../../img/bond.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>
|
export let space: Ref<Space>
|
||||||
@ -48,6 +47,10 @@ import { combineName } from '@anticrm/contact';
|
|||||||
let firstName = ''
|
let firstName = ''
|
||||||
let lastName = ''
|
let lastName = ''
|
||||||
|
|
||||||
|
export function canClose(): boolean {
|
||||||
|
return firstName === '' && lastName === ''
|
||||||
|
}
|
||||||
|
|
||||||
const object: Candidate = {} as Candidate
|
const object: Candidate = {} as Candidate
|
||||||
|
|
||||||
let resume = {} as {
|
let resume = {} as {
|
||||||
|
Loading…
Reference in New Issue
Block a user