mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.4 KiB
79 lines
1.4 KiB
3 years ago
|
<template>
|
||
3 years ago
|
<div class="nc-container" :class="{ active: modal }" @click="modal = false">
|
||
3 years ago
|
<div class="nc-content elevation-3 pa-4" @click.stop>
|
||
|
<slot />
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
name: 'NcSlider',
|
||
|
props: {
|
||
3 years ago
|
value: Boolean,
|
||
3 years ago
|
},
|
||
|
computed: {
|
||
|
modal: {
|
||
|
get() {
|
||
3 years ago
|
return this.value;
|
||
3 years ago
|
},
|
||
|
set(v) {
|
||
3 years ago
|
this.$emit('input', v);
|
||
|
},
|
||
|
},
|
||
3 years ago
|
},
|
||
|
mounted() {
|
||
3 years ago
|
(document.querySelector('[data-app]') || this.$root.$el).append(this.$el);
|
||
3 years ago
|
},
|
||
|
destroyed() {
|
||
3 years ago
|
this.$el.parentNode && this.$el.parentNode.removeChild(this.$el);
|
||
3 years ago
|
},
|
||
|
created() {
|
||
3 years ago
|
document.body.addEventListener('keyup', this.onKeyup, true);
|
||
3 years ago
|
},
|
||
|
beforeDestroy() {
|
||
3 years ago
|
document.body.removeEventListener('keyup', this.onKeyup, true);
|
||
3 years ago
|
},
|
||
|
|
||
|
methods: {
|
||
|
onKeyup(e) {
|
||
|
if (e.key === 'Escape') {
|
||
3 years ago
|
this.modal = false;
|
||
3 years ago
|
}
|
||
3 years ago
|
},
|
||
|
},
|
||
|
};
|
||
3 years ago
|
</script>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
|
.nc-container {
|
||
|
position: fixed;
|
||
|
pointer-events: none;
|
||
|
width: 100vw;
|
||
|
height: 100vh;
|
||
|
z-index: 9999;
|
||
|
right: 0;
|
||
|
top: 0;
|
||
|
|
||
|
.nc-content {
|
||
|
background-color: var(--v-backgroundColorDefault-base);
|
||
|
height: 100%;
|
||
|
width: max(50%, 700px);
|
||
|
position: absolute;
|
||
|
bottom: 0;
|
||
|
top: 0;
|
||
|
right: min(-50%, -700px);
|
||
3 years ago
|
transition: 0.3s right;
|
||
3 years ago
|
overflow-y: auto;
|
||
3 years ago
|
}
|
||
|
|
||
|
&.active {
|
||
|
pointer-events: all;
|
||
|
|
||
|
& > .nc-content {
|
||
3 years ago
|
right: 0;
|
||
3 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
</style>
|