@cloudron/pankow 4.3.6 → 4.4.0
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.
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
:show-size="showSize"
|
|
57
57
|
:show-star="showStar"
|
|
58
58
|
:show-modified="showModified"
|
|
59
|
-
:rename-handler="renameHandler"
|
|
60
59
|
:share-indicator-property="shareIndicatorProperty"
|
|
61
60
|
:file-drop-indicator-property="fileDropIndicatorProperty"
|
|
62
61
|
:select-handler="onSelectAndFocus"
|
|
@@ -76,7 +75,6 @@
|
|
|
76
75
|
:fallbackIcon="fallbackIcon"
|
|
77
76
|
:item="item"
|
|
78
77
|
:show-star="showStar"
|
|
79
|
-
:rename-handler="renameHandler"
|
|
80
78
|
:share-indicator-property="shareIndicatorProperty"
|
|
81
79
|
:file-drop-indicator-property="fileDropIndicatorProperty"
|
|
82
80
|
:select-handler="onSelectAndFocus"
|
|
@@ -262,12 +260,6 @@ const props = defineProps({
|
|
|
262
260
|
console.warn('Missing deleteHandler for DirectoryView');
|
|
263
261
|
},
|
|
264
262
|
},
|
|
265
|
-
renameHandler: {
|
|
266
|
-
type: Function,
|
|
267
|
-
default() {
|
|
268
|
-
console.warn('Missing renameHandler for DirectoryView');
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
263
|
changeOwnerHandler: {
|
|
272
264
|
type: Function,
|
|
273
265
|
default() {
|
|
@@ -340,7 +332,7 @@ const props = defineProps({
|
|
|
340
332
|
},
|
|
341
333
|
});
|
|
342
334
|
|
|
343
|
-
const emit = defineEmits(['selectionChanged', 'item-activated']);
|
|
335
|
+
const emit = defineEmits(['selectionChanged', 'item-activated', 'rename-requested']);
|
|
344
336
|
|
|
345
337
|
const gridBody = useTemplateRef('gridBody');
|
|
346
338
|
const contextMenu = useTemplateRef('contextMenu');
|
|
@@ -610,12 +602,6 @@ function onItemShare() {
|
|
|
610
602
|
props.shareHandler(focusItem.value);
|
|
611
603
|
}
|
|
612
604
|
|
|
613
|
-
function onItemRenameBegin() {
|
|
614
|
-
if (selectedCount.value !== 1) return console.warn('onItemRenameBegin should only be triggered if one item is selected');
|
|
615
|
-
|
|
616
|
-
elements[focusItem.value.id]?.onRenameBegin();
|
|
617
|
-
}
|
|
618
|
-
|
|
619
605
|
async function onChangeOwnerDialogSubmit(items, newOwnerUid) {
|
|
620
606
|
changeOwnerDialog.busy = true;
|
|
621
607
|
await props.changeOwnerHandler(items, newOwnerUid);
|
|
@@ -844,7 +830,7 @@ const contextMenuModel = ref([
|
|
|
844
830
|
id: 'rename',
|
|
845
831
|
label: props.tr('filemanager.list.menu.rename'),
|
|
846
832
|
icon: 'fa-regular fa-pen-to-square',
|
|
847
|
-
action:
|
|
833
|
+
action: () => emit('rename-requested', focusItem.value),
|
|
848
834
|
visible: () => props.showRename,
|
|
849
835
|
disabled: () => !props.editable || selectedCount.value > 1,
|
|
850
836
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div ref="rowWrapper" class="grid-item-wrapper"
|
|
3
|
-
:draggable="!rename"
|
|
4
3
|
@mouseup="onSelect($event)"
|
|
5
4
|
@drop="onDrop($event)"
|
|
6
5
|
@dragover="onDragOver($event)"
|
|
@@ -27,21 +26,10 @@
|
|
|
27
26
|
<div v-if="!visible">
|
|
28
27
|
{{ item.name }}
|
|
29
28
|
</div>
|
|
30
|
-
<div v-else-if="visible
|
|
29
|
+
<div v-else-if="visible" class="grid-item-label" :title="item.name + (item.target ? ` → ${item.target}` : '')">
|
|
31
30
|
<a v-if="item.href" class="open-action" @dblclick.stop @click="onOpen($event)" :href="item.href">{{ item.name }}</a>
|
|
32
31
|
<span v-else>{{ item.name }}</span>
|
|
33
32
|
</div>
|
|
34
|
-
<div v-else-if="visible && rename" ref="renameCell" class="grid-item-label grid-item-rename">
|
|
35
|
-
<TextInput
|
|
36
|
-
v-model="newName"
|
|
37
|
-
:disabled="renameBusy"
|
|
38
|
-
@blur="onRenameEnd"
|
|
39
|
-
@dblclick.stop
|
|
40
|
-
@keydown.enter.stop="onRenameSubmit"
|
|
41
|
-
@keydown.esc.stop="onRenameEnd"
|
|
42
|
-
@keydown.stop
|
|
43
|
-
/>
|
|
44
|
-
</div>
|
|
45
33
|
</div>
|
|
46
34
|
</div>
|
|
47
35
|
</template>
|
|
@@ -51,7 +39,6 @@
|
|
|
51
39
|
import { ref, onMounted } from 'vue';
|
|
52
40
|
|
|
53
41
|
import Icon from './Icon.vue';
|
|
54
|
-
import TextInput from './TextInput.vue';
|
|
55
42
|
|
|
56
43
|
const props = defineProps({
|
|
57
44
|
item: Object,
|
|
@@ -68,12 +55,6 @@ const props = defineProps({
|
|
|
68
55
|
default: '',
|
|
69
56
|
},
|
|
70
57
|
fallbackIcon: String,
|
|
71
|
-
renameHandler: {
|
|
72
|
-
type: Function,
|
|
73
|
-
default() {
|
|
74
|
-
console.warn('Missing renameHandler for DirectoryViewGridItem');
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
58
|
starHandler: {
|
|
78
59
|
type: Function,
|
|
79
60
|
default() {
|
|
@@ -103,12 +84,8 @@ const props = defineProps({
|
|
|
103
84
|
const emit = defineEmits(['activated', 'action-menu']);
|
|
104
85
|
|
|
105
86
|
const rowWrapper = ref(null);
|
|
106
|
-
const renameCell = ref(null);
|
|
107
87
|
|
|
108
88
|
const visible = ref(false);
|
|
109
|
-
const rename = ref(false);
|
|
110
|
-
const renameBusy = ref(false);
|
|
111
|
-
const newName = ref('');
|
|
112
89
|
const dropTargetActive = ref(false);
|
|
113
90
|
const previewRetries = ref(0);
|
|
114
91
|
|
|
@@ -128,37 +105,6 @@ function onActionMenu(event) {
|
|
|
128
105
|
emit('action-menu', props.item, event);
|
|
129
106
|
}
|
|
130
107
|
|
|
131
|
-
function onRenameBegin() {
|
|
132
|
-
rename.value = true;
|
|
133
|
-
newName.value = props.item.name;
|
|
134
|
-
|
|
135
|
-
setTimeout(() => {
|
|
136
|
-
const elem = renameCell.value?.querySelector('input.pankow-text-input');
|
|
137
|
-
if (!elem) return;
|
|
138
|
-
|
|
139
|
-
elem.focus();
|
|
140
|
-
|
|
141
|
-
if (typeof elem.selectionStart !== 'undefined') {
|
|
142
|
-
elem.selectionStart = 0;
|
|
143
|
-
elem.selectionEnd = props.item.name.lastIndexOf('.');
|
|
144
|
-
}
|
|
145
|
-
}, 0);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function onRenameEnd() {
|
|
149
|
-
rename.value = false;
|
|
150
|
-
renameBusy.value = false;
|
|
151
|
-
newName.value = '';
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
async function onRenameSubmit() {
|
|
155
|
-
if (!newName.value) return;
|
|
156
|
-
|
|
157
|
-
renameBusy.value = true;
|
|
158
|
-
await props.renameHandler(props.item, newName.value);
|
|
159
|
-
onRenameEnd();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
108
|
function onOpen(event) {
|
|
163
109
|
if (event.ctrlKey || event.metaKey) return;
|
|
164
110
|
|
|
@@ -228,7 +174,6 @@ onMounted(() => {
|
|
|
228
174
|
|
|
229
175
|
defineExpose({
|
|
230
176
|
highlight,
|
|
231
|
-
onRenameBegin,
|
|
232
177
|
get $el() {
|
|
233
178
|
return rowWrapper.value;
|
|
234
179
|
},
|
|
@@ -346,18 +291,6 @@ defineExpose({
|
|
|
346
291
|
padding: 0 2px;
|
|
347
292
|
}
|
|
348
293
|
|
|
349
|
-
.grid-item-rename {
|
|
350
|
-
overflow: hidden;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
.grid-item-rename :deep(input) {
|
|
354
|
-
width: 100%;
|
|
355
|
-
box-sizing: border-box;
|
|
356
|
-
text-align: center;
|
|
357
|
-
font-size: 0.85rem;
|
|
358
|
-
padding: 1px 4px;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
294
|
.grid-item-star {
|
|
362
295
|
position: absolute;
|
|
363
296
|
top: 4px;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div ref="rowWrapper" class="row-wrapper"
|
|
3
|
-
:draggable="!rename"
|
|
4
3
|
@mouseup="onSelect($event)"
|
|
5
4
|
@drop="onDrop($event)"
|
|
6
5
|
@dragover="onDragOver($event)"
|
|
@@ -21,22 +20,10 @@
|
|
|
21
20
|
<div v-if="!visible">
|
|
22
21
|
{{ item.name }}
|
|
23
22
|
</div>
|
|
24
|
-
<div v-else-if="visible
|
|
23
|
+
<div v-else-if="visible" class="col label">
|
|
25
24
|
<a v-show="item.href" class="open-action" @dblclick.stop @click="onOpen($event)" :href="item.href">{{ item.name }} {{ item.target ? `-> ${item.target}` : '' }}</a>
|
|
26
25
|
<span v-show="!item.href">{{ item.name }} {{ item.target ? `→ ${item.target}` : '' }}</span>
|
|
27
26
|
</div>
|
|
28
|
-
<div v-else-if="visible && rename" ref="renameCell" class="col label rename">
|
|
29
|
-
<TextInput
|
|
30
|
-
ref="renameInput"
|
|
31
|
-
v-model="newName"
|
|
32
|
-
:disabled="renameBusy"
|
|
33
|
-
@blur="onRenameEnd"
|
|
34
|
-
@dblclick.stop
|
|
35
|
-
@keydown.enter.stop="onRenameSubmit"
|
|
36
|
-
@keydown.esc.stop="onRenameEnd"
|
|
37
|
-
@keydown.stop
|
|
38
|
-
/>
|
|
39
|
-
</div>
|
|
40
27
|
|
|
41
28
|
<div v-if="visible && showStar" class="col star">
|
|
42
29
|
<Icon :icon="`${item.star ? 'fa-solid' : 'fa-regular'} fa-star`" class="star-icon" :class="{ 'star-visible': item.star }" @dblclick.stop.prevent @click.stop.prevent="onToggleStar" />
|
|
@@ -58,7 +45,6 @@ import { ref, onMounted } from 'vue';
|
|
|
58
45
|
import { prettyDate, prettyFileSize } from '../utils.js';
|
|
59
46
|
|
|
60
47
|
import Icon from './Icon.vue';
|
|
61
|
-
import TextInput from './TextInput.vue';
|
|
62
48
|
|
|
63
49
|
const props = defineProps({
|
|
64
50
|
item: Object,
|
|
@@ -87,12 +73,6 @@ const props = defineProps({
|
|
|
87
73
|
default: '',
|
|
88
74
|
},
|
|
89
75
|
fallbackIcon: String,
|
|
90
|
-
renameHandler: {
|
|
91
|
-
type: Function,
|
|
92
|
-
default() {
|
|
93
|
-
console.warn('Missing renameHandler for DirectoryViewItem');
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
76
|
starHandler: {
|
|
97
77
|
type: Function,
|
|
98
78
|
default() {
|
|
@@ -122,12 +102,8 @@ const props = defineProps({
|
|
|
122
102
|
const emit = defineEmits(['activated', 'action-menu']);
|
|
123
103
|
|
|
124
104
|
const rowWrapper = ref(null);
|
|
125
|
-
const renameCell = ref(null);
|
|
126
105
|
|
|
127
106
|
const visible = ref(false);
|
|
128
|
-
const rename = ref(false);
|
|
129
|
-
const renameBusy = ref(false);
|
|
130
|
-
const newName = ref('');
|
|
131
107
|
const dropTargetActive = ref(false);
|
|
132
108
|
const previewRetries = ref(0);
|
|
133
109
|
|
|
@@ -147,37 +123,6 @@ function onActionMenu(event) {
|
|
|
147
123
|
emit('action-menu', props.item, event);
|
|
148
124
|
}
|
|
149
125
|
|
|
150
|
-
function onRenameBegin() {
|
|
151
|
-
rename.value = true;
|
|
152
|
-
newName.value = props.item.name;
|
|
153
|
-
|
|
154
|
-
setTimeout(() => {
|
|
155
|
-
const elem = renameCell.value?.querySelector('input.pankow-text-input');
|
|
156
|
-
if (!elem) return;
|
|
157
|
-
|
|
158
|
-
elem.focus();
|
|
159
|
-
|
|
160
|
-
if (typeof elem.selectionStart !== 'undefined') {
|
|
161
|
-
elem.selectionStart = 0;
|
|
162
|
-
elem.selectionEnd = props.item.name.lastIndexOf('.');
|
|
163
|
-
}
|
|
164
|
-
}, 0);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function onRenameEnd() {
|
|
168
|
-
rename.value = false;
|
|
169
|
-
renameBusy.value = false;
|
|
170
|
-
newName.value = '';
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
async function onRenameSubmit() {
|
|
174
|
-
if (!newName.value) return;
|
|
175
|
-
|
|
176
|
-
renameBusy.value = true;
|
|
177
|
-
await props.renameHandler(props.item, newName.value);
|
|
178
|
-
onRenameEnd();
|
|
179
|
-
}
|
|
180
|
-
|
|
181
126
|
function onOpen(event) {
|
|
182
127
|
if (event.ctrlKey || event.metaKey) return;
|
|
183
128
|
|
|
@@ -247,7 +192,6 @@ onMounted(() => {
|
|
|
247
192
|
|
|
248
193
|
defineExpose({
|
|
249
194
|
highlight,
|
|
250
|
-
onRenameBegin,
|
|
251
195
|
get $el() {
|
|
252
196
|
return rowWrapper.value;
|
|
253
197
|
},
|
|
@@ -372,10 +316,6 @@ defineExpose({
|
|
|
372
316
|
display: block;
|
|
373
317
|
}
|
|
374
318
|
|
|
375
|
-
.label.rename > button {
|
|
376
|
-
display: block;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
319
|
.size {
|
|
380
320
|
width: 100px;
|
|
381
321
|
margin: auto;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudron/pankow",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.4.0",
|
|
5
5
|
"description": "Vue 3 UI component library for Cloudron apps",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@highlightjs/vue-plugin": "^2.1.0",
|
|
51
|
-
"@unhead/vue": "^3.2.
|
|
51
|
+
"@unhead/vue": "^3.2.3",
|
|
52
52
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
53
53
|
"highlight.js": "^11.11.1",
|
|
54
54
|
"typescript": "^7.0.2",
|
package/vite-plugin.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { dirname } from 'node:path';
|
|
1
|
+
import { dirname, resolve } from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
3
4
|
|
|
4
5
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
6
|
|
|
@@ -25,6 +26,15 @@ export default function pankowPlugin() {
|
|
|
25
26
|
if (Array.isArray(allow) && !allow.includes(__dirname)) {
|
|
26
27
|
allow.push(__dirname);
|
|
27
28
|
}
|
|
28
|
-
}
|
|
29
|
+
},
|
|
30
|
+
resolveId(source) {
|
|
31
|
+
if (source.includes('?worker') && source.startsWith('monaco-editor/esm/vs/')) {
|
|
32
|
+
const cleanId = source.replace(/\?worker$/, '');
|
|
33
|
+
const filePath = resolve(__dirname, 'node_modules/', cleanId + '.js');
|
|
34
|
+
if (existsSync(filePath)) {
|
|
35
|
+
return filePath + '?worker';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
29
39
|
};
|
|
30
40
|
}
|