diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index 29ceb8ebf..3db383e37 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -239,6 +239,8 @@ drive: "ドライブ"
fileName: "ファイル名"
selectFile: "ファイルを選択"
selectFiles: "ファイルを選択"
+selectFolder: "フォルダーを選択"
+selectFolders: "フォルダーを選択"
renameFile: "ファイル名を変更"
folderName: "フォルダー名"
createFolder: "フォルダーを作成"
diff --git a/src/client/components/drive-window.vue b/src/client/components/drive-window.vue
index 64c4cee0c..d63881c0e 100644
--- a/src/client/components/drive-window.vue
+++ b/src/client/components/drive-window.vue
@@ -1,8 +1,11 @@
- { $emit('closed'); destroyDom(); }" :with-ok-button="true" :ok-button-disabled="selected.length === 0" @ok="ok()">
- {{ multiple ? $t('selectFiles') : $t('selectFile') }}({{ selected.length | number }})
+ { $emit('closed'); destroyDom(); }" :with-ok-button="true" :ok-button-disabled="(type === 'file') && (selected.length === 0)" @ok="ok()">
+
+ {{ multiple ? ((type === 'file') ? $t('selectFiles') : $t('selectFolders')) : ((type === 'file') ? $t('selectFile') : $t('selectFolder')) }}
+ ({{ selected.length | number }})
+
-
+
@@ -25,7 +28,7 @@ export default Vue.extend({
type: {
type: String,
required: false,
- default: undefined
+ default: 'file'
},
multiple: {
type: Boolean,
@@ -45,8 +48,8 @@ export default Vue.extend({
this.$refs.window.close();
},
- onChangeSelection(files) {
- this.selected = files;
+ onChangeSelection(xs) {
+ this.selected = xs;
}
}
});
diff --git a/src/client/components/drive.file.vue b/src/client/components/drive.file.vue
index 014e1a6ca..a547abf9a 100644
--- a/src/client/components/drive.file.vue
+++ b/src/client/components/drive.file.vue
@@ -42,11 +42,20 @@ import { faDownload, faLink, faICursor, faTrashAlt } from '@fortawesome/free-sol
export default Vue.extend({
i18n,
+ components: {
+ XFileThumbnail
+ },
+
props: {
file: {
type: Object,
required: true,
},
+ isSelected: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
selectMode: {
type: Boolean,
required: false,
@@ -54,10 +63,6 @@ export default Vue.extend({
}
},
- components: {
- XFileThumbnail
- },
-
data() {
return {
isDragging: false
@@ -65,12 +70,10 @@ export default Vue.extend({
},
computed: {
+ // TODO: parentへの参照を無くす
browser(): any {
return this.$parent;
},
- isSelected(): boolean {
- return this.browser.selectedFiles.some(f => f.id == this.file.id);
- },
title(): string {
return `${this.file.name}\n${this.file.type} ${Vue.filter('bytes')(this.file.size)}`;
}
@@ -79,7 +82,7 @@ export default Vue.extend({
methods: {
onClick(ev) {
if (this.selectMode) {
- this.browser.chooseFile(this.file);
+ this.$emit('chosen', this.file);
} else {
this.$root.menu({
items: [{
diff --git a/src/client/components/drive.folder.vue b/src/client/components/drive.folder.vue
index 2e861e248..b778acc77 100644
--- a/src/client/components/drive.folder.vue
+++ b/src/client/components/drive.folder.vue
@@ -21,6 +21,7 @@
{{ $t('uploadFolder') }}
+
@@ -36,6 +37,16 @@ export default Vue.extend({
folder: {
type: Object,
required: true,
+ },
+ isSelected: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
+ selectMode: {
+ type: Boolean,
+ required: false,
+ default: false,
}
},
@@ -56,7 +67,12 @@ export default Vue.extend({
return this.folder.name;
}
},
+
methods: {
+ checkboxClicked(e) {
+ this.$emit('chosen', this.folder);
+ },
+
onClick() {
this.browser.move(this.folder);
},
@@ -241,10 +257,24 @@ export default Vue.extend({
cursor: pointer;
}
- * {
+ *:not(.checkbox) {
pointer-events: none;
}
+ > .checkbox {
+ position: absolute;
+ bottom: 8px;
+ right: 8px;
+ width: 16px;
+ height: 16px;
+ background: #fff;
+ border: solid 1px #000;
+
+ &.checked {
+ background: var(--accent);
+ }
+ }
+
&[data-draghover] {
&:after {
content: "";
diff --git a/src/client/components/drive.vue b/src/client/components/drive.vue
index fddac5b9a..08c7097a8 100644
--- a/src/client/components/drive.vue
+++ b/src/client/components/drive.vue
@@ -3,9 +3,9 @@