2021-09-03 13:59:05 +00:00
|
|
|
<!--
|
|
|
|
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
|
|
|
// Copyright © 2021 Hardcore Engineering Inc.
|
|
|
|
//
|
|
|
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License. You may
|
|
|
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
//
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import type { IntlString } from '@anticrm/platform'
|
|
|
|
|
|
|
|
import { createEventDispatcher } from 'svelte'
|
2022-01-25 08:41:53 +00:00
|
|
|
import type { Ref, Class, Space, DocumentQuery } from '@anticrm/core'
|
2021-09-03 13:59:05 +00:00
|
|
|
|
2021-09-10 14:26:16 +00:00
|
|
|
import { Button, Label } from '@anticrm/ui'
|
2021-09-08 16:16:07 +00:00
|
|
|
import SpaceSelect from './SpaceSelect.svelte'
|
2021-12-17 12:14:34 +00:00
|
|
|
import presentation from '..'
|
2021-09-03 13:59:05 +00:00
|
|
|
|
2021-12-20 10:18:29 +00:00
|
|
|
export let spaceClass: Ref<Class<Space>> | undefined = undefined
|
2022-03-26 17:34:06 +00:00
|
|
|
export let space: Ref<Space> | undefined = undefined
|
2022-01-25 08:41:53 +00:00
|
|
|
export let spaceQuery: DocumentQuery<Space> | undefined = { archived: false }
|
2021-12-20 10:18:29 +00:00
|
|
|
export let spaceLabel: IntlString | undefined = undefined
|
|
|
|
export let spacePlaceholder: IntlString | undefined = undefined
|
2021-09-03 13:59:05 +00:00
|
|
|
export let label: IntlString
|
2022-02-16 09:02:31 +00:00
|
|
|
export let labelProps: any | undefined = undefined
|
2021-09-03 13:59:05 +00:00
|
|
|
export let okAction: () => void
|
2021-09-07 12:18:19 +00:00
|
|
|
export let canSave: boolean = false
|
2022-03-18 06:37:49 +00:00
|
|
|
export let size: 'small'| 'medium' = 'small'
|
2021-09-03 13:59:05 +00:00
|
|
|
|
2021-12-20 10:18:29 +00:00
|
|
|
export let okLabel: IntlString = presentation.string.Create
|
|
|
|
export let cancelLabel: IntlString = presentation.string.Cancel
|
|
|
|
|
2021-09-03 13:59:05 +00:00
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
</script>
|
|
|
|
|
2022-03-29 14:29:53 +00:00
|
|
|
<form class="antiCard" class:w-85={size === 'small'} class:w-165={size === 'medium'} on:submit|preventDefault={ () => {} }>
|
2022-03-02 09:03:58 +00:00
|
|
|
<div class="antiCard-header">
|
|
|
|
<div class="antiCard-header__title"><Label {label} params={labelProps ?? {}} /></div>
|
2021-10-13 08:39:26 +00:00
|
|
|
{#if $$slots.error}
|
2022-03-02 09:03:58 +00:00
|
|
|
<div class="antiCard-header__error">
|
2021-10-13 08:39:26 +00:00
|
|
|
<slot name="error" />
|
|
|
|
</div>
|
|
|
|
{/if}
|
2021-09-03 13:59:05 +00:00
|
|
|
</div>
|
2022-03-02 09:03:58 +00:00
|
|
|
<div class="antiCard-content"><slot /></div>
|
2021-12-20 10:18:29 +00:00
|
|
|
{#if spaceClass && spaceLabel && spacePlaceholder}
|
2022-03-02 09:03:58 +00:00
|
|
|
<div class="antiCard-pool">
|
|
|
|
<div class="antiCard-pool__separator" />
|
2022-01-25 08:41:53 +00:00
|
|
|
<SpaceSelect _class={spaceClass} spaceQuery={spaceQuery} label={spaceLabel} placeholder={spacePlaceholder} bind:value={space} />
|
2021-12-20 10:18:29 +00:00
|
|
|
</div>
|
|
|
|
{/if}
|
2022-03-02 09:03:58 +00:00
|
|
|
<div class="antiCard-footer">
|
2022-04-02 04:06:48 +00:00
|
|
|
<Button disabled={!canSave} label={okLabel} kind={'primary'} on:click={() => { okAction(); dispatch('close') }} />
|
|
|
|
<Button label={cancelLabel} on:click={() => { dispatch('close') }} />
|
2021-10-13 08:39:26 +00:00
|
|
|
</div>
|
2021-09-03 13:59:05 +00:00
|
|
|
</form>
|