2019-08-26 17:49:28 +00:00
|
|
|
<template>
|
2019-10-13 08:58:48 +00:00
|
|
|
<div
|
2024-12-10 14:27:16 +00:00
|
|
|
v-if="open || keepContent"
|
|
|
|
v-show="(keepContent && open) || !keepContent"
|
2019-10-13 08:58:48 +00:00
|
|
|
ref="modalWrapper"
|
2020-06-22 19:22:16 +00:00
|
|
|
class="modal__wrapper"
|
2022-10-31 18:35:57 +00:00
|
|
|
@click="outside($event)"
|
2019-10-13 08:58:48 +00:00
|
|
|
>
|
2021-04-08 14:30:26 +00:00
|
|
|
<div
|
|
|
|
class="modal__box"
|
|
|
|
:class="{
|
2021-07-09 08:29:08 +00:00
|
|
|
'modal__box--full-height': fullHeight,
|
2024-04-08 15:41:09 +00:00
|
|
|
'modal__box--full-max-height': !fullHeight && contentScrollable,
|
2021-04-08 14:30:26 +00:00
|
|
|
'modal__box--with-sidebar': sidebar,
|
|
|
|
'modal__box--full-screen': fullScreen,
|
2023-06-12 07:42:52 +00:00
|
|
|
'modal__box--wide': wide,
|
2021-04-20 12:44:56 +00:00
|
|
|
'modal__box--small': small,
|
2021-07-09 08:29:08 +00:00
|
|
|
'modal__box--tiny': tiny,
|
2024-03-05 13:55:20 +00:00
|
|
|
'modal__box--right': right,
|
2021-04-08 14:30:26 +00:00
|
|
|
}"
|
|
|
|
>
|
2020-06-05 12:02:21 +00:00
|
|
|
<template v-if="sidebar">
|
2021-08-04 14:24:38 +00:00
|
|
|
<div
|
|
|
|
v-if="leftSidebar"
|
|
|
|
class="modal__box-sidebar modal__box-sidebar--left"
|
|
|
|
:class="{ 'modal__box-sidebar--scrollable': leftSidebarScrollable }"
|
|
|
|
>
|
2020-06-05 12:02:21 +00:00
|
|
|
<slot name="sidebar"></slot>
|
|
|
|
</div>
|
2021-08-04 14:24:38 +00:00
|
|
|
<div
|
|
|
|
class="modal__box-content"
|
2023-09-13 19:17:48 +00:00
|
|
|
:class="{
|
|
|
|
'modal__box-content--scrollable': contentScrollable,
|
|
|
|
'modal__box-content-no-padding': !contentPadding,
|
|
|
|
}"
|
2021-08-04 14:24:38 +00:00
|
|
|
>
|
2020-06-05 12:02:21 +00:00
|
|
|
<slot name="content"></slot>
|
2023-12-05 14:47:32 +00:00
|
|
|
<div class="modal__actions">
|
|
|
|
<a
|
|
|
|
v-if="closeButton && canClose"
|
2024-11-14 12:30:42 +00:00
|
|
|
role="button"
|
|
|
|
:title="$t('action.close')"
|
2023-12-05 14:47:32 +00:00
|
|
|
class="modal__close"
|
|
|
|
@click="hide()"
|
|
|
|
>
|
|
|
|
<i class="iconoir-cancel"></i>
|
|
|
|
</a>
|
2023-07-24 14:20:51 +00:00
|
|
|
|
2023-12-05 14:47:32 +00:00
|
|
|
<a
|
|
|
|
v-if="collapsibleRightSidebar"
|
2024-07-31 13:41:49 +00:00
|
|
|
class="modal__collapse"
|
2023-12-05 14:47:32 +00:00
|
|
|
@click="collapseSidebar"
|
|
|
|
>
|
|
|
|
<i
|
|
|
|
:class="{
|
|
|
|
'iconoir-fast-arrow-right': !sidebarCollapsed,
|
|
|
|
'iconoir-fast-arrow-left': sidebarCollapsed,
|
|
|
|
}"
|
|
|
|
></i>
|
|
|
|
</a>
|
|
|
|
<slot name="actions"></slot>
|
|
|
|
</div>
|
2021-08-04 14:24:38 +00:00
|
|
|
</div>
|
2023-07-24 14:20:51 +00:00
|
|
|
|
2021-08-04 14:24:38 +00:00
|
|
|
<div
|
|
|
|
v-if="rightSidebar"
|
|
|
|
class="modal__box-sidebar modal__box-sidebar--right"
|
2023-07-24 14:20:51 +00:00
|
|
|
:class="{
|
|
|
|
'modal__box-sidebar--scrollable': rightSidebarScrollable,
|
|
|
|
'modal__box-sidebar--collapsed': sidebarCollapsed,
|
|
|
|
}"
|
2021-08-04 14:24:38 +00:00
|
|
|
>
|
2023-07-24 14:20:51 +00:00
|
|
|
<slot v-if="!sidebarCollapsed" name="sidebar"></slot>
|
2020-06-05 12:02:21 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template v-if="!sidebar">
|
|
|
|
<slot></slot>
|
2021-08-04 14:24:38 +00:00
|
|
|
<slot name="content"></slot>
|
2023-12-05 14:47:32 +00:00
|
|
|
<div class="modal__actions">
|
|
|
|
<a
|
|
|
|
v-if="closeButton && canClose"
|
|
|
|
class="modal__close"
|
|
|
|
@click="hide()"
|
|
|
|
>
|
|
|
|
<i class="iconoir-cancel"></i>
|
|
|
|
</a>
|
|
|
|
<slot name="actions"></slot>
|
|
|
|
</div>
|
2020-06-05 12:02:21 +00:00
|
|
|
</template>
|
2019-08-26 17:49:28 +00:00
|
|
|
</div>
|
2019-10-13 08:58:48 +00:00
|
|
|
</div>
|
2019-08-26 17:49:28 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-11-30 18:52:39 +00:00
|
|
|
import baseModal from '@baserow/modules/core/mixins/baseModal'
|
2019-08-26 17:49:28 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Modal',
|
2020-11-30 18:52:39 +00:00
|
|
|
mixins: [baseModal],
|
2020-06-05 12:02:21 +00:00
|
|
|
props: {
|
2021-08-04 14:24:38 +00:00
|
|
|
leftSidebar: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
|
|
|
rightSidebar: {
|
2020-06-05 12:02:21 +00:00
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
2021-04-08 14:30:26 +00:00
|
|
|
fullScreen: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
2023-06-12 07:42:52 +00:00
|
|
|
wide: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
2021-04-20 12:44:56 +00:00
|
|
|
small: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
2021-07-09 08:29:08 +00:00
|
|
|
tiny: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
2021-04-08 14:30:26 +00:00
|
|
|
closeButton: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
required: false,
|
|
|
|
},
|
2021-07-09 08:29:08 +00:00
|
|
|
fullHeight: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
2021-08-04 14:24:38 +00:00
|
|
|
leftSidebarScrollable: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
|
|
|
contentScrollable: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
2023-09-13 19:17:48 +00:00
|
|
|
contentPadding: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
required: false,
|
|
|
|
},
|
2021-08-04 14:24:38 +00:00
|
|
|
rightSidebarScrollable: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
2022-07-04 14:48:50 +00:00
|
|
|
canClose: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true,
|
|
|
|
required: false,
|
|
|
|
},
|
2023-07-24 14:20:51 +00:00
|
|
|
collapsibleRightSidebar: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
2024-03-05 13:55:20 +00:00
|
|
|
right: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
2024-12-10 14:27:16 +00:00
|
|
|
// This flag allow to keep the modal content in case you want it to be available.
|
|
|
|
// Useful if you have a form inside the modal that is a sub part of the current
|
|
|
|
// form.
|
|
|
|
keepContent: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
required: false,
|
|
|
|
},
|
2023-07-24 14:20:51 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
sidebarCollapsed: false,
|
|
|
|
}
|
2021-08-04 14:24:38 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
sidebar() {
|
|
|
|
return this.leftSidebar || this.rightSidebar
|
|
|
|
},
|
2020-06-05 12:02:21 +00:00
|
|
|
},
|
2023-07-24 14:20:51 +00:00
|
|
|
methods: {
|
|
|
|
collapseSidebar() {
|
|
|
|
this.sidebarCollapsed = !this.sidebarCollapsed
|
|
|
|
},
|
|
|
|
},
|
2019-08-26 17:49:28 +00:00
|
|
|
}
|
|
|
|
</script>
|