@cloudron/pankow 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ButtonGroup.vue +2 -2
- package/components/MainLayout.vue +5 -1
- package/components/SplitLayout.vue +162 -0
- package/components/TopBar.vue +4 -0
- package/index.js +2 -0
- package/package.json +4 -4
- package/types/index.d.ts +1 -1
|
@@ -31,6 +31,7 @@ const props = defineProps({
|
|
|
31
31
|
.pankow-main-layout-outer {
|
|
32
32
|
width: 100%;
|
|
33
33
|
height: 100%;
|
|
34
|
+
min-width: 0;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
.pankow-main-layout-container {
|
|
@@ -39,6 +40,7 @@ const props = defineProps({
|
|
|
39
40
|
display: flex;
|
|
40
41
|
flex-direction: column;
|
|
41
42
|
flex-wrap: nowrap;
|
|
43
|
+
min-width: 0;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
.pankow-main-layout-header {
|
|
@@ -48,8 +50,10 @@ const props = defineProps({
|
|
|
48
50
|
.pankow-main-layout-body {
|
|
49
51
|
width: 100%;
|
|
50
52
|
flex-grow: 1;
|
|
51
|
-
overflow:
|
|
53
|
+
overflow-x: hidden;
|
|
54
|
+
overflow-y: auto;
|
|
52
55
|
min-height: 2em;
|
|
56
|
+
min-width: 0;
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
.pankow-main-layout-footer {
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, computed, watch, onMounted, onUnmounted, useTemplateRef } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
leftWidth: {
|
|
6
|
+
type: Number,
|
|
7
|
+
default: 50
|
|
8
|
+
},
|
|
9
|
+
minLeftWidth: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 20
|
|
12
|
+
},
|
|
13
|
+
minRightWidth: {
|
|
14
|
+
type: Number,
|
|
15
|
+
default: 20
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const emit = defineEmits(['update:leftWidth']);
|
|
20
|
+
|
|
21
|
+
const containerRef = useTemplateRef('container');
|
|
22
|
+
const isDragging = ref(false);
|
|
23
|
+
const dragStartX = ref(0);
|
|
24
|
+
const dragStartWidth = ref(0);
|
|
25
|
+
const currentLeftWidth = ref(props.leftWidth);
|
|
26
|
+
|
|
27
|
+
watch(() => props.leftWidth, (val) => {
|
|
28
|
+
if (!isDragging.value) {
|
|
29
|
+
currentLeftWidth.value = val;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
function startDrag(e) {
|
|
34
|
+
isDragging.value = true;
|
|
35
|
+
dragStartX.value = e.clientX ?? e.touches?.[0]?.clientX ?? 0;
|
|
36
|
+
dragStartWidth.value = currentLeftWidth.value;
|
|
37
|
+
document.body.style.cursor = 'col-resize';
|
|
38
|
+
document.body.style.userSelect = 'none';
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function onDrag(e) {
|
|
43
|
+
if (!isDragging.value || !containerRef.value) return;
|
|
44
|
+
const clientX = e.clientX ?? e.touches?.[0]?.clientX ?? 0;
|
|
45
|
+
const containerWidth = containerRef.value.getBoundingClientRect().width;
|
|
46
|
+
if (containerWidth === 0) return;
|
|
47
|
+
const delta = ((clientX - dragStartX.value) / containerWidth) * 100;
|
|
48
|
+
const newWidth = dragStartWidth.value + delta;
|
|
49
|
+
currentLeftWidth.value = Math.max(props.minLeftWidth, Math.min(100 - props.minRightWidth, newWidth));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function stopDrag() {
|
|
53
|
+
if (!isDragging.value) return;
|
|
54
|
+
isDragging.value = false;
|
|
55
|
+
document.body.style.cursor = '';
|
|
56
|
+
document.body.style.userSelect = '';
|
|
57
|
+
emit('update:leftWidth', Math.round(currentLeftWidth.value));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
onMounted(() => {
|
|
61
|
+
document.addEventListener('mousemove', onDrag);
|
|
62
|
+
document.addEventListener('mouseup', stopDrag);
|
|
63
|
+
document.addEventListener('touchmove', onDrag, { passive: false });
|
|
64
|
+
document.addEventListener('touchend', stopDrag);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
onUnmounted(() => {
|
|
68
|
+
document.removeEventListener('mousemove', onDrag);
|
|
69
|
+
document.removeEventListener('mouseup', stopDrag);
|
|
70
|
+
document.removeEventListener('touchmove', onDrag);
|
|
71
|
+
document.removeEventListener('touchend', stopDrag);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const leftStyle = computed(() => ({
|
|
75
|
+
flex: `0 0 ${currentLeftWidth.value}%`,
|
|
76
|
+
maxWidth: `${currentLeftWidth.value}%`
|
|
77
|
+
}));
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<template>
|
|
81
|
+
<div ref="container" class="pankow-split-layout" :class="{ 'pankow-split-layout-dragging': isDragging }">
|
|
82
|
+
<div class="pankow-split-layout-left" :style="leftStyle">
|
|
83
|
+
<slot name="left" />
|
|
84
|
+
</div>
|
|
85
|
+
<div class="pankow-split-layout-divider" @mousedown="startDrag" @touchstart.prevent="startDrag">
|
|
86
|
+
<div class="pankow-split-layout-handle"><span></span><span></span></div>
|
|
87
|
+
</div>
|
|
88
|
+
<div class="pankow-split-layout-right">
|
|
89
|
+
<slot name="right" />
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
<style>
|
|
95
|
+
.pankow-split-layout {
|
|
96
|
+
display: flex;
|
|
97
|
+
height: 100%;
|
|
98
|
+
width: 100%;
|
|
99
|
+
min-width: 0;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.pankow-split-layout-left {
|
|
104
|
+
height: 100%;
|
|
105
|
+
min-width: 0;
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.pankow-split-layout-divider {
|
|
110
|
+
width: 6px;
|
|
111
|
+
cursor: col-resize;
|
|
112
|
+
background: transparent;
|
|
113
|
+
position: relative;
|
|
114
|
+
flex-shrink: 0;
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.pankow-split-layout-divider:hover,
|
|
121
|
+
.pankow-split-layout-dragging .pankow-split-layout-divider {
|
|
122
|
+
background: var(--pankow-input-border-color);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.pankow-split-layout-handle {
|
|
126
|
+
position: absolute;
|
|
127
|
+
top: 50%;
|
|
128
|
+
left: 50%;
|
|
129
|
+
transform: translate(-50%, -50%);
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-direction: column;
|
|
132
|
+
gap: 2px;
|
|
133
|
+
opacity: 0;
|
|
134
|
+
transition: opacity 0.15s;
|
|
135
|
+
pointer-events: none;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.pankow-split-layout-divider:hover .pankow-split-layout-handle,
|
|
139
|
+
.pankow-split-layout-dragging .pankow-split-layout-handle {
|
|
140
|
+
opacity: 0.5;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.pankow-split-layout-handle span {
|
|
144
|
+
display: block;
|
|
145
|
+
width: 2px;
|
|
146
|
+
height: 16px;
|
|
147
|
+
border-radius: 1px;
|
|
148
|
+
background: var(--pankow-color-text);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.pankow-split-layout-right {
|
|
152
|
+
flex: 1;
|
|
153
|
+
height: 100%;
|
|
154
|
+
min-width: 0;
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.pankow-split-layout-dragging .pankow-split-layout-left,
|
|
159
|
+
.pankow-split-layout-dragging .pankow-split-layout-right {
|
|
160
|
+
pointer-events: none;
|
|
161
|
+
}
|
|
162
|
+
</style>
|
package/components/TopBar.vue
CHANGED
|
@@ -45,24 +45,28 @@ const props = defineProps({
|
|
|
45
45
|
display: flex;
|
|
46
46
|
justify-content: space-between;
|
|
47
47
|
padding: 5px 10px;
|
|
48
|
+
min-width: 0;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
.pankow-top-bar-left {
|
|
51
52
|
display: flex;
|
|
52
53
|
margin: auto 0px;
|
|
53
54
|
align-items: center;
|
|
55
|
+
min-width: 0;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
.pankow-top-bar-center {
|
|
57
59
|
display: flex;
|
|
58
60
|
margin: auto 0px;
|
|
59
61
|
align-items: center;
|
|
62
|
+
min-width: 0;
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
.pankow-top-bar-right {
|
|
63
66
|
display: flex;
|
|
64
67
|
margin: auto 0px;
|
|
65
68
|
align-items: center;
|
|
69
|
+
min-width: 0;
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
.pankow-top-bar-grow {
|
package/index.js
CHANGED
|
@@ -36,6 +36,7 @@ import Popover from './components/Popover.vue';
|
|
|
36
36
|
import ProgressBar from './components/ProgressBar.vue';
|
|
37
37
|
import Radiobutton from './components/Radiobutton.vue';
|
|
38
38
|
import SideBar from './components/SideBar.vue';
|
|
39
|
+
import SplitLayout from './components/SplitLayout.vue';
|
|
39
40
|
import Spinner from './components/Spinner.vue';
|
|
40
41
|
import Switch from './components/Switch.vue';
|
|
41
42
|
import TableView from './components/TableView.vue';
|
|
@@ -85,6 +86,7 @@ export {
|
|
|
85
86
|
ProgressBar,
|
|
86
87
|
Radiobutton,
|
|
87
88
|
SideBar,
|
|
89
|
+
SplitLayout,
|
|
88
90
|
Spinner,
|
|
89
91
|
Switch,
|
|
90
92
|
TableView,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudron/pankow",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.2.
|
|
4
|
+
"version": "4.2.1",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
34
34
|
"highlight.js": "^11.11.1",
|
|
35
35
|
"typescript": "^6.0.3",
|
|
36
|
-
"vite": "^8.0.
|
|
37
|
-
"vue": "^3.5.
|
|
38
|
-
"vue-router": "^5.0
|
|
36
|
+
"vite": "^8.0.16",
|
|
37
|
+
"vue": "^3.5.38",
|
|
38
|
+
"vue-router": "^5.1.0"
|
|
39
39
|
}
|
|
40
40
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ import gestures from './gestures.js';
|
|
|
3
3
|
import tooltip from './tooltip.js';
|
|
4
4
|
import fallbackImage from './fallbackImage.js';
|
|
5
5
|
import utils from './utils.js';
|
|
6
|
-
export { BottomBar, Breadcrumb, Button, ButtonGroup, ClipboardAction, ClipboardButton, Checkbox, DateTimeInput, Dialog, DirectoryView, EmailInput, FileUploader, FormGroup, InputGroup, Icon, InputDialog, LoginView, MainLayout, MaskedInput, Menu, MenuItem, SingleSelect, MultiSelect, Notification, NumberInput, OfflineBanner, PasswordInput, Popover, ProgressBar, Radiobutton, SideBar, Spinner, Switch, TableView, TabView, TagInput, TextInput, TextInputRaw, TopBar, TreeView, fetcher, gestures, tooltip, fallbackImage, utils };
|
|
6
|
+
export { BottomBar, Breadcrumb, Button, ButtonGroup, ClipboardAction, ClipboardButton, Checkbox, DateTimeInput, Dialog, DirectoryView, EmailInput, FileUploader, FormGroup, InputGroup, Icon, InputDialog, LoginView, MainLayout, MaskedInput, Menu, MenuItem, SingleSelect, MultiSelect, Notification, NumberInput, OfflineBanner, PasswordInput, Popover, ProgressBar, Radiobutton, SideBar, SplitLayout, Spinner, Switch, TableView, TabView, TagInput, TextInput, TextInputRaw, TopBar, TreeView, fetcher, gestures, tooltip, fallbackImage, utils };
|