reparation drag and drop zip

This commit is contained in:
Alexandre_BRAVO 2024-11-21 15:04:28 +01:00
parent 8961cdb2a0
commit 091453e0e5
5 changed files with 303 additions and 300 deletions

View File

@ -940,7 +940,8 @@ __webpack_require__.r(__webpack_exports__);
current_dir: '/',
breadcrumbParts: [],
isAddFilePopupVisible: false,
newFileName: ''
newFileName: '',
isTransfering: false
};
},
async mounted() {
@ -979,6 +980,7 @@ __webpack_require__.r(__webpack_exports__);
return this.current_dir.split('/').filter(part => part);
},
async handleClickElem(file) {
if (this.isTransfering) return;
if (file.type === 'directory') {
this.current_dir = this.current_dir === '/' ? '/' + file.basename : this.current_dir + '/' + file.basename;
this.breadcrumbParts = this.getBreadcrumbParts();
@ -988,6 +990,7 @@ __webpack_require__.r(__webpack_exports__);
}
},
async handleClickBreadcrumb(index) {
if (this.isTransfering) return;
let dir = '/';
if (index >= -1) {
dir = this.generateCrumbHref(index);
@ -1016,28 +1019,64 @@ __webpack_require__.r(__webpack_exports__);
async onDrop(event) {
event.preventDefault();
try {
this.isTransfering = true;
const file = this.file;
console.log('Fichier déposé :', file);
if (!file) return;
if (file.isDirectory) {
await this.moveFilesOfFolder(file, '');
} else {
if (file.content && typeof file.content.arrayBuffer === 'function') {
file.content = await file.content.arrayBuffer();
await this.moveFileToTarget(file);
}
await this.moveFileToTarget(file, '');
}
this.isTransfering = false;
} catch (error) {
console.error('Erreur lors du drag and drop :', error);
console.error('Erreur lors du drop :', error);
this.isTransfering = false;
}
},
async moveFileToTarget(file) {
async moveFilesOfFolder(folder, parentPath) {
await this.createFolder(folder, parentPath);
for (const child of folder.children) {
if (child.isDirectory) {
await this.moveFilesOfFolder(child, parentPath + child.parentPath + '/');
} else {
if (child.content && typeof child.content.arrayBuffer === 'function') {
child.content = await child.content.arrayBuffer();
}
await this.moveFileToTarget(child, parentPath + child.parentPath + '/');
}
}
},
async moveFileToTarget(file, parentPath) {
try {
const client = (0,_nextcloud_files_dav__WEBPACK_IMPORTED_MODULE_0__.getClient)();
const path = this.root_path + this.current_dir + file.name;
// Assurez-vous que le chemin parent est correctement formaté
const fullPath = `${this.root_path}${this.current_dir}${parentPath}${file.name}`;
if (ArrayBuffer.isView(file.content)) {
file.content = Buffer.from(file.content);
}
await client.putFileContents(path, file.content);
// Évitez les chemins incorrects en utilisant `path.normalize` si disponible
await client.putFileContents(fullPath, file.content);
// Recharge les fichiers après l'opération
await this.fetchFiles();
} catch (error) {
console.error('Erreur lors du déplacement du fichier:', error);
}
},
async createFolder(folder, parentPath) {
try {
const client = (0,_nextcloud_files_dav__WEBPACK_IMPORTED_MODULE_0__.getClient)();
const fullPath = `${this.root_path}${this.current_dir}${parentPath}/${folder.name}/`;
await client.createDirectory(fullPath);
await this.fetchFiles();
} catch (error) {
console.error('Erreur lors de la création du dossier :', error);
}
}
}
});
@ -1121,7 +1160,6 @@ __webpack_require__.r(__webpack_exports__);
const zipData = await response.blob();
const zip = await jszip__WEBPACK_IMPORTED_MODULE_0___default().loadAsync(zipData);
const files = [];
const filePromises = [];
zip.forEach((relativePath, file) => {
const pathParts = relativePath.split('/').filter(Boolean);
let currentLevel = files;
@ -1137,12 +1175,14 @@ __webpack_require__.r(__webpack_exports__);
}
if (!existing) {
existing = {
name: partName,
name: pathParts[i],
isDirectory,
size: isDirectory ? 0 : file._data.uncompressedSize,
content: isDirectory ? null : '',
// Initialiser 'content' pour les fichiers
children: isDirectory ? [] : null,
//remove the name of the file from the path
parentPath: i > 0 ? pathParts[i - 1] : '',
unzip: promise
};
currentLevel.push(existing);
@ -1184,9 +1224,31 @@ __webpack_require__.r(__webpack_exports__);
this.$set(this.folderMap, file.fullPath, !currentState);
},
async onDragStart(file) {
console.log('Drag start', file);
const getFilesFromFolder = folder => {
const files = [];
if (!folder.children || folder.children.length === 0) return files;
for (let i = 0; i < folder.children.length; i++) {
const child = folder.children[i];
if (child.isDirectory) {
files.push(...getFilesFromFolder(child));
} else {
files.push(child);
}
}
return files;
};
try {
if (file.isDirectory) {
const files = getFilesFromFolder(file);
const filesToUnzip = files.map(file => file.unzip);
await Promise.all(filesToUnzip);
} else {
await file.unzip;
}
this.$emit('file-upload', file);
} catch (error) {
console.error('Erreur lors du drag start :', error);
}
}
}
});
@ -1488,7 +1550,7 @@ var render = function render() {
staticClass: "text-NcBlue w-6 h-6"
})], 1), _vm._v(" "), _c("span", {
staticClass: "ml-2 truncate cursor-pointer"
}, [_vm._v(_vm._s(file.fullPath))])])]), _vm._v(" "), _c("div", {
}, [_vm._v(_vm._s(file.name))])])]), _vm._v(" "), _c("div", {
staticClass: "w-1/6 px-4 py-2 cursor-pointer"
}, [_vm._v("-")])]) : _c("div", {
staticClass: "flex h-16 hover:bg-NcGray items-center pl-4 cursor-pointer rounded-lg border-b last:border-b-0 border-gray-300",
@ -1525,8 +1587,10 @@ var render = function render() {
transform: "matrix(.7 0 0 .7 -.43 -.388)"
}
})])])], _vm._v(" "), _c("div", {
staticClass: "w-4/6 flex items-center px-4 py-2 truncate cursor-pointer"
}, [_vm._v("\n " + _vm._s(file.fullPath) + "\n ")]), _vm._v(" "), _c("div", {
staticClass: "w-4/6 flex items-center px-4 py-2 cursor-pointer"
}, [_c("div", {
staticClass: "truncate max-sm:max-w-32 max-w-64"
}, [_vm._v(_vm._s(file.name))])]), _vm._v(" "), _c("div", {
staticClass: "w-2/6 py-2 cursor-pointer"
}, [_vm._v("\n " + _vm._s(_vm.formatFileSize(file.size)) + "\n ")])], 2)]);
}), 0)]);
@ -5884,6 +5948,18 @@ video {
width: 100%;
}
.max-w-32 {
max-width: 8rem;
}
.max-w-48 {
max-width: 12rem;
}
.max-w-64 {
max-width: 16rem;
}
.transform {
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}
@ -8419,7 +8495,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ });
/* harmony import */ var tabbable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tabbable */ "./node_modules/tabbable/dist/index.esm.js");
/*!
* focus-trap 7.6.1
* focus-trap 7.6.2
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
*/
@ -8542,20 +8618,6 @@ var delay = function delay(fn) {
return setTimeout(fn, 0);
};
// Array.find/findIndex() are not supported on IE; this replicates enough
// of Array.findIndex() for our needs
var findIndex = function findIndex(arr, fn) {
var idx = -1;
arr.every(function (value, i) {
if (fn(value)) {
idx = i;
return false; // break
}
return true; // next
});
return idx;
};
/**
* Get an option's value when it could be a plain value, or a handler that provides
* the value.
@ -8941,7 +9003,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
// REVERSE
// is the target the first tabbable node in a group?
var startOfGroupIndex = findIndex(state.tabbableGroups, function (_ref4) {
var startOfGroupIndex = state.tabbableGroups.findIndex(function (_ref4) {
var firstTabbableNode = _ref4.firstTabbableNode;
return target === firstTabbableNode;
});
@ -8970,7 +9032,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
// FORWARD
// is the target the last tabbable node in a group?
var lastOfGroupIndex = findIndex(state.tabbableGroups, function (_ref5) {
var lastOfGroupIndex = state.tabbableGroups.findIndex(function (_ref5) {
var lastTabbableNode = _ref5.lastTabbableNode;
return target === lastTabbableNode;
});
@ -39850,7 +39912,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ purify)
/* harmony export */ });
/*! @license DOMPurify 3.2.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.0/LICENSE */
/*! @license DOMPurify 3.2.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.1/LICENSE */
const {
entries,
@ -40134,7 +40196,7 @@ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedType
function createDOMPurify() {
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
const DOMPurify = root => createDOMPurify(root);
DOMPurify.version = '3.2.0';
DOMPurify.version = '3.2.1';
DOMPurify.removed = [];
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
// Not running in a browser, provide a factory function

File diff suppressed because one or more lines are too long

411
package-lock.json generated
View File

@ -1819,47 +1819,47 @@
"peer": true
},
"node_modules/@shikijs/core": {
"version": "1.23.0",
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.23.0.tgz",
"integrity": "sha512-J4Fo22oBlfRHAXec+1AEzcowv+Qdf4ZQkuP/X/UHYH9+KA9LvyFXSXyS+HxuBRFfon+u7bsmKdRBjoZlbDVRkQ==",
"version": "1.23.1",
"resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.23.1.tgz",
"integrity": "sha512-NuOVgwcHgVC6jBVH5V7iblziw6iQbWWHrj5IlZI3Fqu2yx9awH7OIQkXIcsHsUmY19ckwSgUMgrqExEyP5A0TA==",
"license": "MIT",
"peer": true,
"dependencies": {
"@shikijs/engine-javascript": "1.23.0",
"@shikijs/engine-oniguruma": "1.23.0",
"@shikijs/types": "1.23.0",
"@shikijs/engine-javascript": "1.23.1",
"@shikijs/engine-oniguruma": "1.23.1",
"@shikijs/types": "1.23.1",
"@shikijs/vscode-textmate": "^9.3.0",
"@types/hast": "^3.0.4",
"hast-util-to-html": "^9.0.3"
}
},
"node_modules/@shikijs/engine-javascript": {
"version": "1.23.0",
"resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.23.0.tgz",
"integrity": "sha512-CcrppseWShG+8Efp1iil9divltuXVdCaU4iu+CKvzTGZO5RmXyAiSx668M7VbX8+s/vt1ZKu75Vn/jWi8O3G/Q==",
"version": "1.23.1",
"resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.23.1.tgz",
"integrity": "sha512-i/LdEwT5k3FVu07SiApRFwRcSJs5QM9+tod5vYCPig1Ywi8GR30zcujbxGQFJHwYD7A5BUqagi8o5KS+LEVgBg==",
"license": "MIT",
"peer": true,
"dependencies": {
"@shikijs/types": "1.23.0",
"@shikijs/types": "1.23.1",
"@shikijs/vscode-textmate": "^9.3.0",
"oniguruma-to-es": "0.1.2"
"oniguruma-to-es": "0.4.1"
}
},
"node_modules/@shikijs/engine-oniguruma": {
"version": "1.23.0",
"resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.23.0.tgz",
"integrity": "sha512-gS8bZLqVvmZXX+E5JUMJICsBp+kx6gj79MH/UEpKHKIqnUzppgbmEn6zLa6mB5D+sHse2gFei3YYJxQe1EzZXQ==",
"version": "1.23.1",
"resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.23.1.tgz",
"integrity": "sha512-KQ+lgeJJ5m2ISbUZudLR1qHeH3MnSs2mjFg7bnencgs5jDVPeJ2NVDJ3N5ZHbcTsOIh0qIueyAJnwg7lg7kwXQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@shikijs/types": "1.23.0",
"@shikijs/types": "1.23.1",
"@shikijs/vscode-textmate": "^9.3.0"
}
},
"node_modules/@shikijs/types": {
"version": "1.23.0",
"resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.23.0.tgz",
"integrity": "sha512-HiwzsihRao+IbPk7FER/EQT/D0dEEK3n5LAtHDzL5iRT+JMblA7y9uitUnjEnHeLkKigNM+ZplrP7MuEyyc5kA==",
"version": "1.23.1",
"resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.23.1.tgz",
"integrity": "sha512-98A5hGyEhzzAgQh2dAeHKrWW4HfCMeoFER2z16p5eJ+vmPeF6lZ/elEne6/UCU551F/WqkopqRsr1l2Yu6+A0g==",
"license": "MIT",
"peer": true,
"dependencies": {
@ -3645,10 +3645,27 @@
"license": "MIT",
"peer": true
},
"node_modules/body-parser/node_modules/qs": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
"integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
"dev": true,
"license": "BSD-3-Clause",
"peer": true,
"dependencies": {
"side-channel": "^1.0.6"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/bonjour-service": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.2.1.tgz",
"integrity": "sha512-oSzCS2zV14bh2kji6vNe7vrpJYCHGvcZnlffFQ1MEoX/WOeQ/teD8SYWKR942OI3INjq8OMNJlbPK5LLLUxFDw==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.3.0.tgz",
"integrity": "sha512-3YuAUiSkWykd+2Azjgyxei8OWf8thdn8AITIog2M4UICzoqfjlqr64WIjEXZllf/W6vK1goqleSR6brGomxQqA==",
"dev": true,
"license": "MIT",
"peer": true,
@ -3777,58 +3794,6 @@
"node": ">= 0.12"
}
},
"node_modules/browserify-sign/node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"dev": true,
"license": "MIT",
"peer": true
},
"node_modules/browserify-sign/node_modules/readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"node_modules/browserify-sign/node_modules/readable-stream/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true,
"license": "MIT",
"peer": true
},
"node_modules/browserify-sign/node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/browserify-sign/node_modules/string_decoder/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true,
"license": "MIT",
"peer": true
},
"node_modules/browserify-zlib": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz",
@ -4143,9 +4108,9 @@
}
},
"node_modules/char-regex": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/char-regex/-/char-regex-2.0.1.tgz",
"integrity": "sha512-oSvEeo6ZUD7NepqAat3RqoucZ5SeqLJgOvVIwkafu6IP3V0pO38s/ypdVUmDDK6qIIHNlYHJAKX9E7R7HoKElw==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/char-regex/-/char-regex-2.0.2.tgz",
"integrity": "sha512-cbGOjAptfM2LVmWhwRFHEKTPkLwNddVmuqYZQt895yXwAsWsXObCG+YN4DGQ/JBtT4GP1a1lPPdio2z413LmTg==",
"license": "MIT",
"engines": {
"node": ">=12.20"
@ -4237,15 +4202,18 @@
}
},
"node_modules/cipher-base": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz",
"integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==",
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.5.tgz",
"integrity": "sha512-xq7ICKB4TMHUx7Tz1L9O2SGKOhYMOTR32oir45Bq28/AQTpHogKgHcoYFSdRbMtddl+ozNXfXY9jWcgYKmde0w==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"inherits": "^2.0.1",
"safe-buffer": "^5.0.1"
"inherits": "^2.0.4",
"safe-buffer": "^5.2.1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/clamp": {
@ -4631,9 +4599,9 @@
}
},
"node_modules/cross-spawn": {
"version": "7.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.5.tgz",
"integrity": "sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==",
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true,
"license": "MIT",
"dependencies": {
@ -5273,10 +5241,13 @@
}
},
"node_modules/dompurify": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.0.tgz",
"integrity": "sha512-AMdOzK44oFWqHEi0wpOqix/fUNY707OmoeFDnbi3Q5I8uOpy21ufUA5cDJPr0bosxrflOVD/H2DMSvuGKJGfmQ==",
"license": "(MPL-2.0 OR Apache-2.0)"
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.1.tgz",
"integrity": "sha512-NBHEsc0/kzRYQd+AY6HR6B/IgsqzBABrqJbpCDQII/OK6h7B7LXzweZTDsqSW2LkTRpoxf18YUP+YjGySk6B3w==",
"license": "(MPL-2.0 OR Apache-2.0)",
"optionalDependencies": {
"@types/trusted-types": "^2.0.7"
}
},
"node_modules/domutils": {
"version": "3.1.0",
@ -5310,9 +5281,9 @@
"peer": true
},
"node_modules/electron-to-chromium": {
"version": "1.5.60",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.60.tgz",
"integrity": "sha512-HcraRUkTKJ+8yA3b10i9qvhUlPBRDlKjn1XGek1zDGVfAKcvi8TsUnImGqLiEm9j6ZulxXIWWIo9BmbkbCTGgA==",
"version": "1.5.63",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.63.tgz",
"integrity": "sha512-ddeXKuY9BHo/mw145axlyWjlJ1UBt4WK3AlvkT7W2AbqfRQoacVoRUCF6wL3uIx/8wT9oLKXzI+rFqHHscByaA==",
"dev": true,
"license": "ISC",
"peer": true
@ -6563,6 +6534,23 @@
"license": "MIT",
"peer": true
},
"node_modules/express/node_modules/qs": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
"integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
"dev": true,
"license": "BSD-3-Clause",
"peer": true,
"dependencies": {
"side-channel": "^1.0.6"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/extend": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
@ -6839,9 +6827,9 @@
}
},
"node_modules/flatted": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz",
"integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==",
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz",
"integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==",
"dev": true,
"license": "ISC",
"peer": true
@ -6875,9 +6863,9 @@
}
},
"node_modules/focus-trap": {
"version": "7.6.1",
"resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.6.1.tgz",
"integrity": "sha512-nB8y4nQl8PshahLpGKZOq1sb0xrMVFSn6at7u/qOsBZTlZRzaapISGENcB6mOkoezbClZyiMwEF/dGY8AZ00rA==",
"version": "7.6.2",
"resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.6.2.tgz",
"integrity": "sha512-9FhUxK1hVju2+AiQIDJ5Dd//9R2n2RAfJ0qfhF4IHGHgcoEUTMpbTeG/zbEuwaiYXfuAH6XE0/aCyxDdRM+W5w==",
"license": "MIT",
"dependencies": {
"tabbable": "^6.2.0"
@ -7621,50 +7609,6 @@
"wbuf": "^1.1.0"
}
},
"node_modules/hpack.js/node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"dev": true,
"license": "MIT",
"peer": true
},
"node_modules/hpack.js/node_modules/readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"node_modules/hpack.js/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true,
"license": "MIT",
"peer": true
},
"node_modules/hpack.js/node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/html-entities": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.5.2.tgz",
@ -7911,9 +7855,9 @@
"license": "MIT"
},
"node_modules/immutable": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.0.2.tgz",
"integrity": "sha512-1NU7hWZDkV7hJ4PJ9dur9gTNQ4ePNPN4k9/0YhwjzykTi/+3Q5pF93YU5QoVj8BuOnhLgaY8gs0U2pj4kSYVcw==",
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.0.3.tgz",
"integrity": "sha512-P8IdPQHq3lA1xVeBRi5VPqUm5HDgKnx0Ru51wZz5mjxHr5n3RWhjIpOFU7ybkUxfB+5IToy+OLaHYDBIWsv+uw==",
"dev": true,
"license": "MIT",
"peer": true
@ -8677,12 +8621,10 @@
}
},
"node_modules/isarray": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
"integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
"dev": true,
"license": "MIT",
"peer": true
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"license": "MIT"
},
"node_modules/isexe": {
"version": "2.0.0",
@ -8883,42 +8825,6 @@
"setimmediate": "^1.0.5"
}
},
"node_modules/jszip/node_modules/isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
"license": "MIT"
},
"node_modules/jszip/node_modules/readable-stream": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"license": "MIT",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"node_modules/jszip/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"license": "MIT"
},
"node_modules/jszip/node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/keyv": {
"version": "4.5.4",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
@ -9019,18 +8925,18 @@
}
},
"node_modules/linkify-string": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/linkify-string/-/linkify-string-4.1.3.tgz",
"integrity": "sha512-6dAgx4MiTcvEX87OS5aNpAioO7cSELUXp61k7azOvMYOLSmREx0w4yM1Uf0+O3JLC08YdkUyZhAX+YkasRt/mw==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/linkify-string/-/linkify-string-4.1.4.tgz",
"integrity": "sha512-4z2UEzEi4SxnhWMzzZ8Pa8vIOwX/2U0XWxk/0UIA7lI+Dn0ZRKqTE9ildnO6Jl6K5hqVuLKTeMD8p4bdFW6P8g==",
"license": "MIT",
"peerDependencies": {
"linkifyjs": "^4.0.0"
}
},
"node_modules/linkifyjs": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/linkifyjs/-/linkifyjs-4.1.3.tgz",
"integrity": "sha512-auMesunaJ8yfkHvK4gfg1K0SaKX/6Wn9g2Aac/NwX+l5VdmFZzo/hdPGxEOETj+ryRa4/fiOPjeeKURSAJx1sg==",
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/linkifyjs/-/linkifyjs-4.1.4.tgz",
"integrity": "sha512-0/NxkHNpiJ0k9VrYCkAn9OtU1eu8xEr1tCCpDtSsVRm/SF0xAak2Gzv3QimSfgUgqLBCDlfhMbu73XvaEHUTPQ==",
"license": "MIT",
"peer": true
},
@ -10136,9 +10042,9 @@
}
},
"node_modules/micromark-util-subtokenize": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.2.tgz",
"integrity": "sha512-xKxhkB62vwHUuuxHe9Xqty3UaAsizV2YKq5OV344u3hFBbf8zIYrhYOWhAQb94MtMPkjTOzzjJ/hid9/dR5vFA==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.0.3.tgz",
"integrity": "sha512-VXJJuNxYWSoYL6AJ6OQECCFGhIU2GGHMw8tahogePBrjkG8aCCas3ibkp7RnVOSTClg2is05/R7maAhF1XyQMg==",
"funding": [
{
"type": "GitHub Sponsors",
@ -10529,6 +10435,24 @@
"webpack": ">=5"
}
},
"node_modules/node-polyfill-webpack-plugin/node_modules/readable-stream": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz",
"integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"abort-controller": "^3.0.0",
"buffer": "^6.0.3",
"events": "^3.3.0",
"process": "^0.11.10",
"string_decoder": "^1.3.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/node-releases": {
"version": "2.0.18",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz",
@ -10775,15 +10699,15 @@
}
},
"node_modules/oniguruma-to-es": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-0.1.2.tgz",
"integrity": "sha512-sBYKVJlIMB0WPO+tSu/NNB1ytSFeHyyJZ3Ayxfx3f/QUuXu0lvZk0VB4K7npmdlHSC0ldqanzh/sUSlAbgCTfw==",
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-0.4.1.tgz",
"integrity": "sha512-rNcEohFz095QKGRovP/yqPIKc+nP+Sjs4YTHMv33nMePGKrq/r2eu9Yh4646M5XluGJsUnmwoXuiXE69KDs+fQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"emoji-regex-xs": "^1.0.0",
"regex": "^4.4.0",
"regex-recursion": "^4.1.0"
"regex": "^5.0.0",
"regex-recursion": "^4.2.1"
}
},
"node_modules/open": {
@ -11734,9 +11658,9 @@
}
},
"node_modules/qs": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
"integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
"version": "6.13.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.1.tgz",
"integrity": "sha512-EJPeIn0CYrGu+hli1xilKAPXODtJ12T0sP63Ijx2/khC2JtuaN3JyNIpvmnkmaEtha9ocbG4A4cMcr+TvqvwQg==",
"dev": true,
"license": "BSD-3-Clause",
"peer": true,
@ -11930,21 +11854,33 @@
}
},
"node_modules/readable-stream": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz",
"integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==",
"dev": true,
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
"integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
"license": "MIT",
"peer": true,
"dependencies": {
"abort-controller": "^3.0.0",
"buffer": "^6.0.3",
"events": "^3.3.0",
"process": "^0.11.10",
"string_decoder": "^1.3.0"
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
"node_modules/readable-stream/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"license": "MIT"
},
"node_modules/readable-stream/node_modules/string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"license": "MIT",
"dependencies": {
"safe-buffer": "~5.1.0"
}
},
"node_modules/readdirp": {
@ -12001,11 +11937,14 @@
"license": "MIT"
},
"node_modules/regex": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/regex/-/regex-4.4.0.tgz",
"integrity": "sha512-uCUSuobNVeqUupowbdZub6ggI5/JZkYyJdDogddJr60L764oxC2pMZov1fQ3wM9bdyzUILDG+Sqx6NAKAz9rKQ==",
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/regex/-/regex-5.0.2.tgz",
"integrity": "sha512-/pczGbKIQgfTMRV0XjABvc5RzLqQmwqxLHdQao2RTXPk+pmTXB2P0IaUHYdYyk412YLwUIkaeMd5T+RzVgTqnQ==",
"license": "MIT",
"peer": true
"peer": true,
"dependencies": {
"regex-utilities": "^2.3.0"
}
},
"node_modules/regex-recursion": {
"version": "4.2.1",
@ -12488,6 +12427,14 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/safe-array-concat/node_modules/isarray": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
"integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
"dev": true,
"license": "MIT",
"peer": true
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@ -12984,16 +12931,16 @@
}
},
"node_modules/shiki": {
"version": "1.23.0",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-1.23.0.tgz",
"integrity": "sha512-xfdu9DqPkIpExH29cmiTlgo0/jBki5la1Tkfhsv+Wu5TT3APLNHslR1acxuKJOCWqVdSc+pIbs/2ozjVRGppdg==",
"version": "1.23.1",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-1.23.1.tgz",
"integrity": "sha512-8kxV9TH4pXgdKGxNOkrSMydn1Xf6It8lsle0fiqxf7a1149K1WGtdOu3Zb91T5r1JpvRPxqxU3C2XdZZXQnrig==",
"license": "MIT",
"peer": true,
"dependencies": {
"@shikijs/core": "1.23.0",
"@shikijs/engine-javascript": "1.23.0",
"@shikijs/engine-oniguruma": "1.23.0",
"@shikijs/types": "1.23.0",
"@shikijs/core": "1.23.1",
"@shikijs/engine-javascript": "1.23.1",
"@shikijs/engine-oniguruma": "1.23.1",
"@shikijs/types": "1.23.1",
"@shikijs/vscode-textmate": "^9.3.0",
"@types/hast": "^3.0.4"
}
@ -14573,9 +14520,9 @@
}
},
"node_modules/typedoc-plugin-missing-exports": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/typedoc-plugin-missing-exports/-/typedoc-plugin-missing-exports-3.0.0.tgz",
"integrity": "sha512-R7D8fYrK34mBFZSlF1EqJxfqiUSlQSmyrCiQgTQD52nNm6+kUtqwiaqaNkuJ2rA2wBgWFecUA8JzHT7x2r7ePg==",
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/typedoc-plugin-missing-exports/-/typedoc-plugin-missing-exports-3.0.2.tgz",
"integrity": "sha512-c1fS9h4MBOgf6OMN1fPHvMjWvR1f9npaGT6YA5ZWjqo28yJpoX1rtS4BonP0Nosk0RIBV/Ra6WGL6dyi1RM0fw==",
"license": "MIT",
"peerDependencies": {
"typedoc": "0.26.x"
@ -15838,9 +15785,9 @@
"peer": true
},
"node_modules/yaml": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.0.tgz",
"integrity": "sha512-a6ae//JvKDEra2kdi1qzCyrJW/WZCgFi8ydDV+eXExl95t+5R+ijnqHJbz9tmMh8FUjx3iv2fCQ4dclAQlO2UQ==",
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz",
"integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==",
"license": "ISC",
"bin": {
"yaml": "bin.mjs"

View File

@ -212,34 +212,17 @@ export default {
event.preventDefault();
try {
const moveFilesOfFolder = async (folder) => {
await this.createFolder(folder);
for (const child of folder.children) {
if (child.isDirectory) {
await moveFilesOfFolder(child);
} else {
if (child.content && typeof child.content.arrayBuffer === 'function') {
child.content = await child.content.arrayBuffer();
}
await this.moveFileToTarget(child);
}
}
};
this.isTransfering = true;
const file = this.file;
if (!file) return;
console.log('Fichier déposé :', file);
if (file.isDirectory) {
await moveFilesOfFolder(file);
await this.moveFilesOfFolder(file,'');
} else {
if (file.content && typeof file.content.arrayBuffer === 'function') {
file.content = await file.content.arrayBuffer();
}
await this.moveFileToTarget(file);
await this.moveFileToTarget(file, '');
}
this.isTransfering = false;
@ -249,12 +232,26 @@ export default {
this.isTransfering = false;
}
},
async moveFileToTarget(file) {
async moveFilesOfFolder(folder, parentPath) {
await this.createFolder(folder, parentPath);
for (const child of folder.children) {
if (child.isDirectory) {
await this.moveFilesOfFolder(child, parentPath + child.parentPath + '/');
} else {
if (child.content && typeof child.content.arrayBuffer === 'function') {
child.content = await child.content.arrayBuffer();
}
await this.moveFileToTarget(child, parentPath + child.parentPath + '/');
}
}
},
async moveFileToTarget(file, parentPath) {
try {
const client = getClient();
// Assurez-vous que le chemin parent est correctement formaté
const parentPath = file.parentPath ? `${file.parentPath}/` : '';
const fullPath = `${this.root_path}${this.current_dir}${parentPath}${file.name}`;
if (ArrayBuffer.isView(file.content)) {
@ -270,13 +267,11 @@ export default {
console.error('Erreur lors du déplacement du fichier:', error);
}
},
async createFolder(folder) {
async createFolder(folder, parentPath) {
try {
const client = getClient();
// Assurez-vous que le chemin parent est correctement formaté
const parentPath = folder.parentPath ? `${folder.parentPath}/` : '';
const fullPath = `${this.root_path}${this.current_dir}${parentPath}${folder.name}/`;
const fullPath = `${this.root_path}${this.current_dir}${parentPath}/${folder.name}/`;
await client.createDirectory(fullPath);
await this.fetchFiles();

View File

@ -163,7 +163,7 @@ export default {
content: isDirectory ? null : '', // Initialiser 'content' pour les fichiers
children: isDirectory ? [] : null,
//remove the name of the file from the path
parentPath: pathParts.slice(0, i).join('/'),
parentPath: i > 0 ? pathParts[i - 1] : '',
unzip: promise
};
currentLevel.push(existing);
@ -208,7 +208,6 @@ export default {
this.$set(this.folderMap, file.fullPath, !currentState);
},
async onDragStart(file) {
console.log('Drag start', file);
const getFilesFromFolder = (folder) => {
const files = [];