Added File Sorting
This commit is contained in:
45
package-lock.json
generated
45
package-lock.json
generated
@@ -39,6 +39,7 @@
|
||||
"@vue-leaflet/vue-leaflet": "^0.10.1",
|
||||
"@vuepic/vue-datepicker": "^7.4.0",
|
||||
"@zip.js/zip.js": "^2.7.32",
|
||||
"array-sort": "^1.0.0",
|
||||
"axios": "^1.6.7",
|
||||
"base64-arraybuffer": "^1.0.2",
|
||||
"buffer": "^6.0.3",
|
||||
@@ -5398,6 +5399,29 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/array-sort": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/array-sort/-/array-sort-1.0.0.tgz",
|
||||
"integrity": "sha512-ihLeJkonmdiAsD7vpgN3CRcx2J2S0TiYW+IS/5zHBI7mKUq3ySvBdzzBfD236ubDBQFiiyG3SWCPc+msQ9KoYg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"default-compare": "^1.0.0",
|
||||
"get-value": "^2.0.6",
|
||||
"kind-of": "^5.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/array-sort/node_modules/kind-of": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
|
||||
"integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/arraybuffer.prototype.slice": {
|
||||
"version": "1.0.3",
|
||||
"dev": true,
|
||||
@@ -6780,6 +6804,27 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/default-compare": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/default-compare/-/default-compare-1.0.0.tgz",
|
||||
"integrity": "sha512-QWfXlM0EkAbqOCbD/6HjdwT19j7WCkMyiRhWilc4H9/5h/RzTF9gv5LYh1+CmDV5d1rki6KAWLtQale0xt20eQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"kind-of": "^5.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/default-compare/node_modules/kind-of": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
|
||||
"integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/define-data-property": {
|
||||
"version": "1.1.4",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
"@vue-leaflet/vue-leaflet": "^0.10.1",
|
||||
"@vuepic/vue-datepicker": "^7.4.0",
|
||||
"@zip.js/zip.js": "^2.7.32",
|
||||
"array-sort": "^1.0.0",
|
||||
"axios": "^1.6.7",
|
||||
"base64-arraybuffer": "^1.0.2",
|
||||
"buffer": "^6.0.3",
|
||||
|
||||
@@ -6,6 +6,7 @@ import {useSupabaseSelectSingle} from "~/composables/useSupabase.js";
|
||||
import DocumentDisplayModal from "~/components/DocumentDisplayModal.vue";
|
||||
import DocumentUploadModal from "~/components/DocumentUploadModal.vue";
|
||||
import dayjs from "dayjs";
|
||||
import arraySort from "array-sort";
|
||||
|
||||
definePageMeta({
|
||||
middleware: "auth"
|
||||
@@ -291,6 +292,20 @@ const renderedFileList = computed(() => {
|
||||
type: "file"
|
||||
}
|
||||
})
|
||||
console.log(currentFolders.value)
|
||||
|
||||
arraySort(files, (a,b) => {
|
||||
let aVal = a.path ? a.path.split("/")[a.path.split("/").length -1] : null
|
||||
let bVal = b.path ? b.path.split("/")[b.path.split("/").length -1] : null
|
||||
|
||||
if(aVal && bVal) {
|
||||
return aVal.localeCompare(bVal)
|
||||
} else if(!aVal && bVal) {
|
||||
return 1
|
||||
} else {
|
||||
return -1
|
||||
}
|
||||
}, {reverse: true})
|
||||
|
||||
let folders = currentFolders.value.map(i => {
|
||||
return {
|
||||
@@ -300,6 +315,15 @@ const renderedFileList = computed(() => {
|
||||
}
|
||||
})
|
||||
|
||||
arraySort(folders, "label")
|
||||
|
||||
/*folders.sort(function(a, b) {
|
||||
|
||||
// Compare the 2 dates
|
||||
if (a.name < b.name) return -1;
|
||||
if (a.name > b.name) return 1;
|
||||
return 0;
|
||||
});*/
|
||||
return [...folders,...files]
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user