2022-05-23 08:56:15 -07:00
|
|
|
<template>
|
|
|
|
<div>
|
2022-07-20 07:24:03 -07:00
|
|
|
<div :class="$style.inputPanel" v-if="!hideInputAndOutput" :style="inputPanelStyles">
|
2022-05-23 08:56:15 -07:00
|
|
|
<slot name="input"></slot>
|
|
|
|
</div>
|
2022-07-20 07:24:03 -07:00
|
|
|
<div :class="$style.outputPanel" v-if="!hideInputAndOutput" :style="outputPanelStyles">
|
2022-05-23 08:56:15 -07:00
|
|
|
<slot name="output"></slot>
|
|
|
|
</div>
|
|
|
|
<div :class="$style.mainPanel" :style="mainPanelStyles">
|
2022-09-22 08:41:15 -07:00
|
|
|
<n8n-resize-wrapper
|
|
|
|
:isResizingEnabled="currentNodePaneType !== 'unknown'"
|
|
|
|
:width="relativeWidthToPx(mainPanelDimensions.relativeWidth)"
|
|
|
|
:minWidth="MIN_PANEL_WIDTH"
|
|
|
|
:gridSize="20"
|
2022-10-20 06:45:58 -07:00
|
|
|
@resize="onResizeDebounced"
|
2022-09-22 08:41:15 -07:00
|
|
|
@resizestart="onResizeStart"
|
|
|
|
@resizeend="onResizeEnd"
|
|
|
|
:supportedDirections="supportedResizeDirections"
|
|
|
|
>
|
|
|
|
<div :class="$style.dragButtonContainer">
|
|
|
|
<PanelDragButton
|
|
|
|
:class="{ [$style.draggable]: true, [$style.visible]: isDragging }"
|
|
|
|
:canMoveLeft="canMoveLeft"
|
|
|
|
:canMoveRight="canMoveRight"
|
|
|
|
v-if="!hideInputAndOutput && isDraggable"
|
|
|
|
@dragstart="onDragStart"
|
|
|
|
@drag="onDrag"
|
|
|
|
@dragend="onDragEnd"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div :class="{ [$style.mainPanelInner]: true, [$style.dragging]: isDragging }">
|
|
|
|
<slot name="main" />
|
|
|
|
</div>
|
|
|
|
</n8n-resize-wrapper>
|
2022-05-23 08:56:15 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2022-09-22 08:41:15 -07:00
|
|
|
import Vue, { PropType } from 'vue';
|
|
|
|
import { get } from 'lodash';
|
|
|
|
|
|
|
|
import { INodeTypeDescription } from 'n8n-workflow';
|
2022-05-23 08:56:15 -07:00
|
|
|
import PanelDragButton from './PanelDragButton.vue';
|
|
|
|
|
2022-09-22 08:41:15 -07:00
|
|
|
import {
|
|
|
|
LOCAL_STORAGE_MAIN_PANEL_RELATIVE_WIDTH,
|
|
|
|
MAIN_NODE_PANEL_WIDTH,
|
|
|
|
} from '@/constants';
|
2022-10-20 06:45:58 -07:00
|
|
|
import mixins from 'vue-typed-mixins';
|
2022-11-23 04:41:53 -08:00
|
|
|
import { debounceHelper } from '@/mixins/debounce';
|
2022-11-04 06:04:31 -07:00
|
|
|
import { mapStores } from 'pinia';
|
|
|
|
import { useNDVStore } from '@/stores/ndv';
|
2022-12-06 03:50:06 -08:00
|
|
|
import { NodePanelType } from '@/Interface';
|
2022-09-22 08:41:15 -07:00
|
|
|
|
|
|
|
|
2022-05-23 08:56:15 -07:00
|
|
|
const SIDE_MARGIN = 24;
|
2022-09-22 08:41:15 -07:00
|
|
|
const SIDE_PANELS_MARGIN = 80;
|
|
|
|
const MIN_PANEL_WIDTH = 280;
|
|
|
|
const PANEL_WIDTH = 320;
|
|
|
|
const PANEL_WIDTH_LARGE = 420;
|
|
|
|
|
|
|
|
const initialMainPanelWidth:{ [key: string]: number } = {
|
|
|
|
regular: MAIN_NODE_PANEL_WIDTH,
|
|
|
|
dragless: MAIN_NODE_PANEL_WIDTH,
|
|
|
|
unknown: MAIN_NODE_PANEL_WIDTH,
|
|
|
|
inputless: MAIN_NODE_PANEL_WIDTH,
|
|
|
|
wide: MAIN_NODE_PANEL_WIDTH * 2,
|
|
|
|
};
|
2022-05-23 08:56:15 -07:00
|
|
|
|
2022-10-20 06:45:58 -07:00
|
|
|
export default mixins(debounceHelper).extend({
|
2022-05-23 08:56:15 -07:00
|
|
|
name: 'NDVDraggablePanels',
|
|
|
|
components: {
|
|
|
|
PanelDragButton,
|
|
|
|
},
|
|
|
|
props: {
|
2022-06-20 12:39:24 -07:00
|
|
|
isDraggable: {
|
2022-05-23 08:56:15 -07:00
|
|
|
type: Boolean,
|
|
|
|
},
|
2022-07-20 07:24:03 -07:00
|
|
|
hideInputAndOutput: {
|
|
|
|
type: Boolean,
|
|
|
|
},
|
2022-06-20 12:39:24 -07:00
|
|
|
position: {
|
|
|
|
type: Number,
|
|
|
|
},
|
2022-09-22 08:41:15 -07:00
|
|
|
nodeType: {
|
|
|
|
type: Object as PropType<INodeTypeDescription>,
|
|
|
|
default: () => ({}),
|
|
|
|
},
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
2022-10-20 06:45:58 -07:00
|
|
|
data(): { windowWidth: number, isDragging: boolean, MIN_PANEL_WIDTH: number, initialized: boolean} {
|
2022-05-23 08:56:15 -07:00
|
|
|
return {
|
2022-09-22 08:41:15 -07:00
|
|
|
windowWidth: 1,
|
2022-05-23 08:56:15 -07:00
|
|
|
isDragging: false,
|
2022-09-22 08:41:15 -07:00
|
|
|
MIN_PANEL_WIDTH,
|
2022-10-20 06:45:58 -07:00
|
|
|
initialized: false,
|
2022-05-23 08:56:15 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.setTotalWidth();
|
2022-09-22 08:41:15 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
Only set(or restore) initial position if `mainPanelDimensions`
|
|
|
|
is at the default state({relativeLeft:1, relativeRight: 1, relativeWidth: 1}) to make sure we use store values if they are set
|
|
|
|
*/
|
|
|
|
if(this.mainPanelDimensions.relativeLeft === 1 && this.mainPanelDimensions.relativeRight === 1) {
|
|
|
|
this.setMainPanelWidth();
|
|
|
|
this.setPositions(this.getInitialLeftPosition(this.mainPanelDimensions.relativeWidth));
|
|
|
|
this.restorePositionData();
|
|
|
|
}
|
|
|
|
|
2022-05-23 08:56:15 -07:00
|
|
|
window.addEventListener('resize', this.setTotalWidth);
|
2022-09-22 08:41:15 -07:00
|
|
|
this.$emit('init', { position: this.mainPanelDimensions.relativeLeft });
|
2022-10-20 06:45:58 -07:00
|
|
|
setTimeout(() => {
|
|
|
|
this.initialized = true;
|
|
|
|
}, 0);
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
|
|
|
destroyed() {
|
|
|
|
window.removeEventListener('resize', this.setTotalWidth);
|
|
|
|
},
|
|
|
|
computed: {
|
2022-11-04 06:04:31 -07:00
|
|
|
...mapStores(
|
|
|
|
useNDVStore,
|
|
|
|
),
|
2022-09-22 08:41:15 -07:00
|
|
|
mainPanelDimensions(): {
|
|
|
|
relativeWidth: number,
|
|
|
|
relativeLeft: number,
|
|
|
|
relativeRight: number
|
|
|
|
} {
|
2022-12-06 03:50:06 -08:00
|
|
|
return this.ndvStore.getMainPanelDimensions(this.currentNodePaneType);
|
2022-06-20 12:39:24 -07:00
|
|
|
},
|
2022-11-04 06:04:31 -07:00
|
|
|
supportedResizeDirections(): string[] {
|
2022-09-22 08:41:15 -07:00
|
|
|
const supportedDirections = ['right'];
|
2022-05-23 08:56:15 -07:00
|
|
|
|
2022-09-22 08:41:15 -07:00
|
|
|
if(this.isDraggable) supportedDirections.push('left');
|
|
|
|
return supportedDirections;
|
|
|
|
},
|
2022-11-04 06:04:31 -07:00
|
|
|
currentNodePaneType(): string {
|
2022-09-22 08:41:15 -07:00
|
|
|
if(!this.hasInputSlot) return 'inputless';
|
|
|
|
if(!this.isDraggable) return 'dragless';
|
|
|
|
if(this.nodeType === null) return 'unknown';
|
|
|
|
return get(this, 'nodeType.parameterPane') || 'regular';
|
|
|
|
},
|
2022-11-04 06:04:31 -07:00
|
|
|
hasInputSlot(): boolean {
|
2022-09-22 08:41:15 -07:00
|
|
|
return this.$slots.input !== undefined;
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
|
|
|
inputPanelMargin(): number {
|
2022-09-22 08:41:15 -07:00
|
|
|
return this.pxToRelativeWidth(SIDE_PANELS_MARGIN);
|
|
|
|
},
|
2022-11-04 06:04:31 -07:00
|
|
|
minWindowWidth(): number {
|
2022-09-22 08:41:15 -07:00
|
|
|
return 2 * (SIDE_MARGIN + SIDE_PANELS_MARGIN) + MIN_PANEL_WIDTH;
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
|
|
|
minimumLeftPosition(): number {
|
2022-09-22 08:41:15 -07:00
|
|
|
if(this.windowWidth < this.minWindowWidth) return this.pxToRelativeWidth(1);
|
|
|
|
|
|
|
|
if(!this.hasInputSlot) return this.pxToRelativeWidth(SIDE_MARGIN);
|
|
|
|
return this.pxToRelativeWidth(SIDE_MARGIN + 20) + this.inputPanelMargin;
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
|
|
|
maximumRightPosition(): number {
|
2022-09-22 08:41:15 -07:00
|
|
|
if(this.windowWidth < this.minWindowWidth) return this.pxToRelativeWidth(1);
|
2022-05-23 08:56:15 -07:00
|
|
|
|
2022-09-22 08:41:15 -07:00
|
|
|
return this.pxToRelativeWidth(SIDE_MARGIN + 20) + this.inputPanelMargin;
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
|
|
|
canMoveLeft(): boolean {
|
2022-09-22 08:41:15 -07:00
|
|
|
return this.mainPanelDimensions.relativeLeft > this.minimumLeftPosition;
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
|
|
|
canMoveRight(): boolean {
|
2022-09-22 08:41:15 -07:00
|
|
|
return this.mainPanelDimensions.relativeRight > this.maximumRightPosition;
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
2022-09-22 08:41:15 -07:00
|
|
|
mainPanelStyles(): { left: string, right: string } {
|
2022-05-23 08:56:15 -07:00
|
|
|
return {
|
2022-09-22 08:41:15 -07:00
|
|
|
'left': `${this.relativeWidthToPx(this.mainPanelDimensions.relativeLeft)}px`,
|
|
|
|
'right': `${this.relativeWidthToPx(this.mainPanelDimensions.relativeRight)}px`,
|
2022-05-23 08:56:15 -07:00
|
|
|
};
|
|
|
|
},
|
2022-09-22 08:41:15 -07:00
|
|
|
inputPanelStyles():{ right: string } {
|
2022-05-23 08:56:15 -07:00
|
|
|
return {
|
2022-09-22 08:41:15 -07:00
|
|
|
right: `${this.relativeWidthToPx(this.calculatedPositions.inputPanelRelativeRight)}px`,
|
2022-05-23 08:56:15 -07:00
|
|
|
};
|
|
|
|
},
|
2022-09-22 08:41:15 -07:00
|
|
|
outputPanelStyles(): { left: string, transform: string} {
|
|
|
|
return {
|
|
|
|
left: `${this.relativeWidthToPx(this.calculatedPositions.outputPanelRelativeLeft)}px`,
|
|
|
|
transform: `translateX(-${this.relativeWidthToPx(this.outputPanelRelativeTranslate)}px)`,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
calculatedPositions():{ inputPanelRelativeRight: number, outputPanelRelativeLeft: number } {
|
|
|
|
const hasInput = this.$slots.input !== undefined;
|
|
|
|
const outputPanelRelativeLeft = this.mainPanelDimensions.relativeLeft + this.mainPanelDimensions.relativeWidth;
|
|
|
|
|
|
|
|
const inputPanelRelativeRight = hasInput
|
|
|
|
? 1 - outputPanelRelativeLeft + this.mainPanelDimensions.relativeWidth
|
|
|
|
: (1 - this.pxToRelativeWidth(SIDE_MARGIN));
|
|
|
|
|
2022-05-23 08:56:15 -07:00
|
|
|
return {
|
2022-09-22 08:41:15 -07:00
|
|
|
inputPanelRelativeRight,
|
|
|
|
outputPanelRelativeLeft,
|
2022-05-23 08:56:15 -07:00
|
|
|
};
|
|
|
|
},
|
2022-09-22 08:41:15 -07:00
|
|
|
outputPanelRelativeTranslate():number {
|
|
|
|
const panelMinLeft = 1 - this.pxToRelativeWidth(MIN_PANEL_WIDTH + SIDE_MARGIN);
|
|
|
|
const currentRelativeLeftDelta = this.calculatedPositions.outputPanelRelativeLeft - panelMinLeft;
|
|
|
|
return currentRelativeLeftDelta > 0 ? currentRelativeLeftDelta : 0;
|
|
|
|
},
|
2022-11-04 06:04:31 -07:00
|
|
|
hasDoubleWidth(): boolean {
|
2022-09-22 08:41:15 -07:00
|
|
|
return get(this, 'nodeType.parameterPane') === 'wide';
|
|
|
|
},
|
|
|
|
fixedPanelWidth(): number {
|
|
|
|
const multiplier = this.hasDoubleWidth ? 2 : 1;
|
|
|
|
|
|
|
|
if (this.windowWidth > 1700) {
|
|
|
|
return PANEL_WIDTH_LARGE * multiplier;
|
|
|
|
}
|
|
|
|
|
|
|
|
return PANEL_WIDTH * multiplier;
|
|
|
|
},
|
|
|
|
isBelowMinWidthMainPanel(): boolean {
|
|
|
|
const minRelativeWidth = this.pxToRelativeWidth(MIN_PANEL_WIDTH);
|
|
|
|
return this.mainPanelDimensions.relativeWidth < minRelativeWidth;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
windowWidth(windowWidth) {
|
|
|
|
const minRelativeWidth = this.pxToRelativeWidth(MIN_PANEL_WIDTH);
|
|
|
|
// Prevent the panel resizing below MIN_PANEL_WIDTH whhile maintaing position
|
|
|
|
if(this.isBelowMinWidthMainPanel) {
|
|
|
|
this.setMainPanelWidth(minRelativeWidth);
|
|
|
|
}
|
|
|
|
|
|
|
|
const isBelowMinLeft = this.minimumLeftPosition > this.mainPanelDimensions.relativeLeft;
|
|
|
|
const isMaxRight = this.maximumRightPosition > this.mainPanelDimensions.relativeRight;
|
|
|
|
|
|
|
|
// When user is resizing from non-supported view(sub ~488px) we need to refit the panels
|
|
|
|
if((windowWidth > this.minWindowWidth) && isBelowMinLeft && isMaxRight) {
|
|
|
|
this.setMainPanelWidth(minRelativeWidth);
|
|
|
|
this.setPositions(this.getInitialLeftPosition(this.mainPanelDimensions.relativeWidth));
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setPositions(this.mainPanelDimensions.relativeLeft);
|
|
|
|
},
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
|
|
|
methods: {
|
2022-09-22 08:41:15 -07:00
|
|
|
getInitialLeftPosition(width: number) {
|
|
|
|
if(this.currentNodePaneType === 'dragless') return this.pxToRelativeWidth(SIDE_MARGIN + 1 + this.fixedPanelWidth);
|
|
|
|
|
|
|
|
return this.hasInputSlot
|
|
|
|
? 0.5 - (width / 2)
|
|
|
|
: this.minimumLeftPosition;
|
|
|
|
},
|
|
|
|
setMainPanelWidth(relativeWidth?: number) {
|
|
|
|
const mainPanelRelativeWidth = relativeWidth || this.pxToRelativeWidth(initialMainPanelWidth[this.currentNodePaneType]);
|
|
|
|
|
2022-11-04 06:04:31 -07:00
|
|
|
this.ndvStore.setMainPanelDimensions({
|
2022-09-22 08:41:15 -07:00
|
|
|
panelType: this.currentNodePaneType,
|
|
|
|
dimensions: {
|
|
|
|
relativeWidth: mainPanelRelativeWidth,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
setPositions(relativeLeft: number) {
|
|
|
|
const mainPanelRelativeLeft = relativeLeft || 1 - this.calculatedPositions.inputPanelRelativeRight;
|
|
|
|
const mainPanelRelativeRight = 1 - mainPanelRelativeLeft - this.mainPanelDimensions.relativeWidth;
|
|
|
|
|
|
|
|
const isMaxRight = this.maximumRightPosition > mainPanelRelativeRight;
|
|
|
|
const isMinLeft = this.minimumLeftPosition > mainPanelRelativeLeft;
|
|
|
|
const isInputless = this.currentNodePaneType === 'inputless';
|
|
|
|
|
|
|
|
if(isMinLeft) {
|
2022-11-04 06:04:31 -07:00
|
|
|
this.ndvStore.setMainPanelDimensions({
|
2022-09-22 08:41:15 -07:00
|
|
|
panelType: this.currentNodePaneType,
|
|
|
|
dimensions: {
|
|
|
|
relativeLeft: this.minimumLeftPosition,
|
|
|
|
relativeRight: 1 - this.mainPanelDimensions.relativeWidth - this.minimumLeftPosition,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isMaxRight) {
|
2022-11-04 06:04:31 -07:00
|
|
|
this.ndvStore.setMainPanelDimensions({
|
2022-12-06 03:50:06 -08:00
|
|
|
panelType: this.currentNodePaneType,
|
2022-09-22 08:41:15 -07:00
|
|
|
dimensions: {
|
|
|
|
relativeLeft: 1 - this.mainPanelDimensions.relativeWidth - this.maximumRightPosition,
|
2022-11-04 06:04:31 -07:00
|
|
|
relativeRight: this.maximumRightPosition as number,
|
2022-09-22 08:41:15 -07:00
|
|
|
},
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-11-04 06:04:31 -07:00
|
|
|
this.ndvStore.setMainPanelDimensions({
|
2022-12-06 03:50:06 -08:00
|
|
|
panelType: this.currentNodePaneType,
|
2022-09-22 08:41:15 -07:00
|
|
|
dimensions: {
|
|
|
|
relativeLeft: isInputless ? this.minimumLeftPosition : mainPanelRelativeLeft,
|
|
|
|
relativeRight: mainPanelRelativeRight,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
pxToRelativeWidth(px: number) {
|
|
|
|
return px / this.windowWidth;
|
|
|
|
},
|
|
|
|
relativeWidthToPx(relativeWidth: number) {
|
|
|
|
return relativeWidth * this.windowWidth;
|
|
|
|
},
|
|
|
|
onResizeStart() {
|
|
|
|
this.setTotalWidth();
|
|
|
|
},
|
|
|
|
onResizeEnd() {
|
|
|
|
this.storePositionData();
|
|
|
|
},
|
2022-10-20 06:45:58 -07:00
|
|
|
onResizeDebounced(data: { direction: string, x: number, width: number}) {
|
|
|
|
if (this.initialized) {
|
|
|
|
this.callDebounced('onResize', { debounceTime: 10, trailing: true }, data);
|
|
|
|
}
|
|
|
|
},
|
2022-09-22 08:41:15 -07:00
|
|
|
onResize({ direction, x, width }: { direction: string, x: number, width: number}) {
|
|
|
|
const relativeDistance = this.pxToRelativeWidth(x);
|
|
|
|
const relativeWidth = this.pxToRelativeWidth(width);
|
|
|
|
|
|
|
|
if(direction === "left" && relativeDistance <= this.minimumLeftPosition) return;
|
|
|
|
if(direction === "right" && (1 - relativeDistance) <= this.maximumRightPosition) return;
|
|
|
|
if(width <= MIN_PANEL_WIDTH) return;
|
2022-05-23 08:56:15 -07:00
|
|
|
|
2022-09-22 08:41:15 -07:00
|
|
|
this.setMainPanelWidth(relativeWidth);
|
|
|
|
this.setPositions(direction === 'left'
|
|
|
|
? relativeDistance
|
|
|
|
: this.mainPanelDimensions.relativeLeft,
|
2022-05-23 08:56:15 -07:00
|
|
|
);
|
2022-09-22 08:41:15 -07:00
|
|
|
},
|
|
|
|
restorePositionData() {
|
|
|
|
const storedPanelWidthData = window.localStorage.getItem(`${LOCAL_STORAGE_MAIN_PANEL_RELATIVE_WIDTH}_${this.currentNodePaneType}`);
|
|
|
|
|
|
|
|
if(storedPanelWidthData) {
|
|
|
|
const parsedWidth = parseFloat(storedPanelWidthData);
|
|
|
|
this.setMainPanelWidth(parsedWidth);
|
|
|
|
const initialPosition = this.getInitialLeftPosition(parsedWidth);
|
|
|
|
|
|
|
|
this.setPositions(initialPosition);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
storePositionData() {
|
|
|
|
window.localStorage.setItem(`${LOCAL_STORAGE_MAIN_PANEL_RELATIVE_WIDTH}_${this.currentNodePaneType}`, this.mainPanelDimensions.relativeWidth.toString());
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
|
|
|
onDragStart() {
|
|
|
|
this.isDragging = true;
|
2022-09-22 08:41:15 -07:00
|
|
|
this.$emit('dragstart', { position: this.mainPanelDimensions.relativeLeft });
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
|
|
|
onDrag(e: {x: number, y: number}) {
|
2022-09-22 08:41:15 -07:00
|
|
|
const relativeLeft = this.pxToRelativeWidth(e.x) - (this.mainPanelDimensions.relativeWidth / 2);
|
|
|
|
|
|
|
|
this.setPositions(relativeLeft);
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
|
|
|
onDragEnd() {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.isDragging = false;
|
|
|
|
this.$emit('dragend', {
|
|
|
|
windowWidth: this.windowWidth,
|
2022-09-22 08:41:15 -07:00
|
|
|
position: this.mainPanelDimensions.relativeLeft,
|
2022-05-23 08:56:15 -07:00
|
|
|
});
|
|
|
|
}, 0);
|
2022-09-22 08:41:15 -07:00
|
|
|
this.storePositionData();
|
2022-05-23 08:56:15 -07:00
|
|
|
},
|
|
|
|
setTotalWidth() {
|
|
|
|
this.windowWidth = window.innerWidth;
|
|
|
|
},
|
|
|
|
close() {
|
|
|
|
this.$emit('close');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.dataPanel {
|
|
|
|
position: absolute;
|
|
|
|
height: calc(100% - 2 * var(--spacing-l));
|
|
|
|
position: absolute;
|
|
|
|
top: var(--spacing-l);
|
|
|
|
z-index: 0;
|
2022-09-22 08:41:15 -07:00
|
|
|
min-width: 280px;
|
2022-05-23 08:56:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
.inputPanel {
|
|
|
|
composes: dataPanel;
|
|
|
|
left: var(--spacing-l);
|
|
|
|
|
|
|
|
> * {
|
|
|
|
border-radius: var(--border-radius-large) 0 0 var(--border-radius-large);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.outputPanel {
|
|
|
|
composes: dataPanel;
|
|
|
|
right: var(--spacing-l);
|
|
|
|
|
|
|
|
> * {
|
|
|
|
border-radius: 0 var(--border-radius-large) var(--border-radius-large) 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.mainPanel {
|
|
|
|
position: absolute;
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
.draggable {
|
|
|
|
visibility: visible;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-22 08:41:15 -07:00
|
|
|
.mainPanelInner {
|
|
|
|
height: 100%;
|
|
|
|
border: var(--border-base);
|
|
|
|
border-radius: var(--border-radius-large);
|
|
|
|
box-shadow: 0 4px 16px rgb(50 61 85 / 10%);
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
&.dragging {
|
|
|
|
border-color: var(--color-primary);
|
|
|
|
box-shadow: 0px 6px 16px rgba(255, 74, 51, 0.15);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-23 08:56:15 -07:00
|
|
|
.draggable {
|
|
|
|
visibility: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.dragButtonContainer {
|
|
|
|
position: absolute;
|
|
|
|
top: -12px;
|
2022-09-22 08:41:15 -07:00
|
|
|
width: 100%;
|
2022-05-23 08:56:15 -07:00
|
|
|
height: 12px;
|
2022-09-22 08:41:15 -07:00
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
pointer-events: none;
|
2022-05-23 08:56:15 -07:00
|
|
|
|
2022-09-22 08:41:15 -07:00
|
|
|
.draggable {
|
|
|
|
pointer-events: all;
|
|
|
|
}
|
2022-05-23 08:56:15 -07:00
|
|
|
&:hover .draggable {
|
|
|
|
visibility: visible;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.visible {
|
|
|
|
visibility: visible;
|
|
|
|
}
|
|
|
|
</style>
|