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
|
|
|
|
|
2022-04-13 04:25:59 +00:00
|
|
|
|
import { Button, Label, IconClose, MiniToggle } 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-04-13 04:25:59 +00:00
|
|
|
|
export let createMore: boolean | undefined = undefined
|
2021-12-20 10:18:29 +00:00
|
|
|
|
export let okLabel: IntlString = presentation.string.Create
|
|
|
|
|
|
2021-09-03 13:59:05 +00:00
|
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
|
</script>
|
|
|
|
|
|
2022-05-11 05:36:35 +00:00
|
|
|
|
<form id={label} class="antiCard dialog" on:submit|preventDefault={() => {}}>
|
2022-03-02 09:03:58 +00:00
|
|
|
|
<div class="antiCard-header">
|
2022-04-13 04:25:59 +00:00
|
|
|
|
<div class="antiCard-header__title-wrap">
|
2022-05-08 17:55:51 +00:00
|
|
|
|
{#if (spaceClass && spaceLabel && spacePlaceholder) || $$slots.space}
|
2022-04-13 04:25:59 +00:00
|
|
|
|
{#if $$slots.space}
|
|
|
|
|
<slot name="space" />
|
2022-05-08 17:55:51 +00:00
|
|
|
|
{:else if spaceClass && spaceLabel && spacePlaceholder}
|
2022-05-12 04:10:52 +00:00
|
|
|
|
<SpaceSelect focus focusIndex={-10} _class={spaceClass} {spaceQuery} label={spaceLabel} bind:value={space} />
|
2022-04-13 04:25:59 +00:00
|
|
|
|
{/if}
|
|
|
|
|
<span class="antiCard-header__divider">›</span>
|
|
|
|
|
{/if}
|
|
|
|
|
<span class="antiCard-header__title"><Label {label} params={labelProps ?? {}} /></span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="buttons-group small-gap">
|
2022-04-29 05:27:17 +00:00
|
|
|
|
<Button
|
2022-05-12 04:10:52 +00:00
|
|
|
|
focusIndex={10002}
|
2022-04-29 05:27:17 +00:00
|
|
|
|
icon={IconClose}
|
|
|
|
|
kind={'transparent'}
|
|
|
|
|
on:click={() => {
|
|
|
|
|
dispatch('close')
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2022-04-13 04:25:59 +00:00
|
|
|
|
</div>
|
2021-09-03 13:59:05 +00:00
|
|
|
|
</div>
|
2022-03-02 09:03:58 +00:00
|
|
|
|
<div class="antiCard-content"><slot /></div>
|
2022-04-13 04:25:59 +00:00
|
|
|
|
{#if (spaceClass && spaceLabel && spacePlaceholder) || $$slots.pool}
|
2022-03-02 09:03:58 +00:00
|
|
|
|
<div class="antiCard-pool">
|
2022-04-13 04:25:59 +00:00
|
|
|
|
<slot name="pool" />
|
2021-12-20 10:18:29 +00:00
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
2022-04-13 04:25:59 +00:00
|
|
|
|
<div class="antiCard-footer reverse">
|
|
|
|
|
<div class="buttons-group text-sm flex-no-shrink">
|
|
|
|
|
{#if createMore !== undefined}
|
|
|
|
|
<MiniToggle label={presentation.string.CreateMore} bind:on={createMore} />
|
|
|
|
|
{/if}
|
2022-04-29 05:27:17 +00:00
|
|
|
|
<Button
|
2022-05-12 04:10:52 +00:00
|
|
|
|
focusIndex={10001}
|
2022-04-29 05:27:17 +00:00
|
|
|
|
disabled={!canSave}
|
|
|
|
|
label={okLabel}
|
|
|
|
|
kind={'primary'}
|
|
|
|
|
on:click={() => {
|
|
|
|
|
okAction()
|
2022-05-08 17:55:51 +00:00
|
|
|
|
if (!createMore) {
|
|
|
|
|
dispatch('close')
|
|
|
|
|
}
|
2022-04-29 05:27:17 +00:00
|
|
|
|
}}
|
|
|
|
|
/>
|
2022-04-13 04:25:59 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="buttons-group small-gap text-sm">
|
|
|
|
|
<slot name="footer" />
|
|
|
|
|
{#if $$slots.error}
|
|
|
|
|
<div class="antiCard-footer__error">
|
|
|
|
|
<slot name="error" />
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
</div>
|
2021-10-13 08:39:26 +00:00
|
|
|
|
</div>
|
2021-09-03 13:59:05 +00:00
|
|
|
|
</form>
|