aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/composables/useFileListHeaders.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src/composables/useFileListHeaders.ts')
-rw-r--r--apps/files/src/composables/useFileListHeaders.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/files/src/composables/useFileListHeaders.ts b/apps/files/src/composables/useFileListHeaders.ts
new file mode 100644
index 00000000000..b57bcbb1432
--- /dev/null
+++ b/apps/files/src/composables/useFileListHeaders.ts
@@ -0,0 +1,19 @@
+/*!
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+import type { Header } from '@nextcloud/files'
+import type { ComputedRef } from 'vue'
+
+import { getFileListHeaders } from '@nextcloud/files'
+import { computed, ref } from 'vue'
+
+/**
+ * Get the registered and sorted file list headers.
+ */
+export function useFileListHeaders(): ComputedRef<Header[]> {
+ const headers = ref(getFileListHeaders())
+ const sorted = computed(() => [...headers.value].sort((a, b) => a.order - b.order) as Header[])
+
+ return sorted
+}