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.
200 lines
4.8 KiB
200 lines
4.8 KiB
4 years ago
|
<template>
|
||
|
<v-container fluid class="pa-0 ma-0" style="overflow: auto">
|
||
3 years ago
|
<splitpanes class="xc-theme nc-dashboard">
|
||
|
<pane
|
||
|
:min-size="treeViewMinSize"
|
||
|
:size="treeViewSize"
|
||
|
:max-size="treeViewMaxSize"
|
||
3 years ago
|
style="position: relative; overflow-x: hidden"
|
||
3 years ago
|
>
|
||
|
<ProjectTreeView v-show="enableTree" ref="treeview" />
|
||
3 years ago
|
<v-btn
|
||
|
x-small
|
||
|
icon
|
||
|
color="grey"
|
||
|
class="pane-toggle"
|
||
3 years ago
|
:class="{ 'pane-toggle-active': enableTree }"
|
||
3 years ago
|
@click="toggleTreeView"
|
||
|
>
|
||
|
<v-icon x-small color="rgba(127,130,139)">
|
||
3 years ago
|
{{ enableTree ? 'mdi-arrow-left' : 'mdi-arrow-right' }}
|
||
3 years ago
|
</v-icon>
|
||
3 years ago
|
</v-btn>
|
||
4 years ago
|
</pane>
|
||
3 years ago
|
<pane :size="projectTabsSize">
|
||
3 years ago
|
<ProjectTabs :key="pid" @tableCreate="tableCreate" />
|
||
4 years ago
|
</pane>
|
||
|
</splitpanes>
|
||
|
</v-container>
|
||
|
</template>
|
||
|
<script>
|
||
3 years ago
|
import { Splitpanes, Pane } from 'splitpanes';
|
||
|
import ProjectTabs from '~/components/ProjectTabs';
|
||
|
import ProjectTreeView from '@/components/ProjectTreeView';
|
||
4 years ago
|
|
||
|
export default {
|
||
|
components: {
|
||
|
ProjectTreeView,
|
||
|
ProjectTabs,
|
||
|
Splitpanes,
|
||
3 years ago
|
Pane,
|
||
4 years ago
|
},
|
||
3 years ago
|
data() {
|
||
4 years ago
|
return {
|
||
|
paneSize: 18,
|
||
3 years ago
|
mainPanelSize: 82,
|
||
3 years ago
|
enableTree: true,
|
||
|
};
|
||
3 years ago
|
},
|
||
|
computed: {
|
||
3 years ago
|
pid() {
|
||
3 years ago
|
return this.$route.params.project_id;
|
||
3 years ago
|
},
|
||
|
treeViewMinSize() {
|
||
3 years ago
|
return this.enableTree ? 10 : 1.5;
|
||
3 years ago
|
},
|
||
|
treeViewMaxSize() {
|
||
3 years ago
|
return this.enableTree ? 50 : 1.5;
|
||
3 years ago
|
},
|
||
|
treeViewSize() {
|
||
3 years ago
|
return this.enableTree ? this.paneSize : 1.5;
|
||
3 years ago
|
},
|
||
|
projectTabsSize() {
|
||
3 years ago
|
return this.enableTree ? 100 - this.paneSize : 100;
|
||
|
},
|
||
4 years ago
|
},
|
||
3 years ago
|
async created() {
|
||
4 years ago
|
this.$store.watch(
|
||
3 years ago
|
state => state.panelSize.treeView && state.panelSize.treeView.size,
|
||
3 years ago
|
newSize => {
|
||
|
this.paneSize = newSize;
|
||
|
}
|
||
|
);
|
||
4 years ago
|
},
|
||
3 years ago
|
mounted() {
|
||
4 years ago
|
if ('new' in this.$route.query) {
|
||
3 years ago
|
this.simpleAnim();
|
||
|
this.$router.replace({ query: {} });
|
||
4 years ago
|
}
|
||
|
try {
|
||
3 years ago
|
// eslint-disable-next-line no-undef
|
||
3 years ago
|
hj('stateChange', `${this.$axios.defaults.baseURL}/dashboard/#/nc/`);
|
||
|
} catch (e) {}
|
||
4 years ago
|
},
|
||
|
methods: {
|
||
3 years ago
|
tableCreate(table) {
|
||
4 years ago
|
if (this.$refs.treeview) {
|
||
3 years ago
|
this.$refs.treeview.mtdTableCreate(table);
|
||
4 years ago
|
}
|
||
|
},
|
||
3 years ago
|
simpleAnim() {
|
||
3 years ago
|
const count = 200;
|
||
3 years ago
|
const defaults = {
|
||
3 years ago
|
origin: { y: 0.7 },
|
||
|
};
|
||
4 years ago
|
|
||
3 years ago
|
function fire(particleRatio, opts) {
|
||
3 years ago
|
window.confetti(
|
||
|
Object.assign({}, defaults, opts, {
|
||
|
particleCount: Math.floor(count * particleRatio),
|
||
|
})
|
||
|
);
|
||
4 years ago
|
}
|
||
|
|
||
|
fire(0.25, {
|
||
|
spread: 26,
|
||
3 years ago
|
startVelocity: 55,
|
||
|
});
|
||
4 years ago
|
fire(0.2, {
|
||
3 years ago
|
spread: 60,
|
||
|
});
|
||
4 years ago
|
fire(0.35, {
|
||
|
spread: 100,
|
||
|
decay: 0.91,
|
||
3 years ago
|
scalar: 0.8,
|
||
|
});
|
||
4 years ago
|
fire(0.1, {
|
||
|
spread: 120,
|
||
|
startVelocity: 25,
|
||
|
decay: 0.92,
|
||
3 years ago
|
scalar: 1.2,
|
||
|
});
|
||
4 years ago
|
fire(0.1, {
|
||
|
spread: 120,
|
||
3 years ago
|
startVelocity: 45,
|
||
|
});
|
||
3 years ago
|
},
|
||
|
toggleTreeView() {
|
||
3 years ago
|
this.enableTree = !this.enableTree;
|
||
|
},
|
||
|
},
|
||
|
};
|
||
4 years ago
|
</script>
|
||
|
<style scoped>
|
||
3 years ago
|
.xc-theme {
|
||
|
height: calc(100vh - 48px);
|
||
3 years ago
|
position: relative;
|
||
|
}
|
||
|
|
||
4 years ago
|
/deep/ .splitpanes__splitter {
|
||
|
background: #7f828b33 !important;
|
||
|
border: #7f828b33 !important;
|
||
|
}
|
||
3 years ago
|
/deep/ .nc-dashboard > .splitpanes__splitter {
|
||
|
margin-top: 30px;
|
||
|
position: relative;
|
||
|
}
|
||
|
/deep/ .nc-dashboard > .splitpanes__splitter::before {
|
||
|
height: 30px;
|
||
|
content: '';
|
||
|
position: absolute;
|
||
3 years ago
|
top: -30px;
|
||
3 years ago
|
left: 0;
|
||
|
width: 100%;
|
||
|
background: var(--v-primary-base);
|
||
|
}
|
||
3 years ago
|
.pane-toggle {
|
||
|
position: absolute;
|
||
3 years ago
|
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.5, 1);
|
||
3 years ago
|
right: -8px;
|
||
3 years ago
|
top: 50%;
|
||
|
bottom: 50%;
|
||
|
z-index: 2;
|
||
|
}
|
||
|
|
||
|
.theme--light .pane-toggle {
|
||
3 years ago
|
background-color: var(--v-backgroundColor-base);
|
||
3 years ago
|
border: 2px solid rgba(0, 0, 0, 0.12);
|
||
|
}
|
||
|
|
||
|
.theme--dark .pane-toggle {
|
||
3 years ago
|
background-color: var(--v-backgroundColor-base);
|
||
3 years ago
|
}
|
||
4 years ago
|
</style>
|
||
|
<!--
|
||
|
/**
|
||
|
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
|
||
|
*
|
||
|
* @author Naveen MR <oof1lab@gmail.com>
|
||
|
* @author Pranav C Balan <pranavxc@gmail.com>
|
||
4 years ago
|
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
|
||
3 years ago
|
* @author Liel Fridman <lielft@gmail.com>
|
||
4 years ago
|
*
|
||
|
* @license GNU AGPL version 3 or any later version
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of the
|
||
|
* License, or (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Affero General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*
|
||
|
*/
|
||
|
-->
|