useCellContent.ts 721 B

123456789101112131415161718192021222324252627
  1. // Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. import Default from '../CellContent/Default.vue'
  3. import Timestamp from '../CellContent/Timestamp.vue'
  4. import TimestampAbsolute from '../CellContent/TimestampAbsolute.vue'
  5. import type { Component } from 'vue'
  6. export const useCellContent = () => {
  7. const typeComponents: Record<string, Component> = {
  8. default: Default,
  9. timestamp: Timestamp,
  10. timestamp_absolute: TimestampAbsolute,
  11. }
  12. const getCellContentComponent = (headerType?: string) => {
  13. if (headerType && typeComponents[headerType]) {
  14. return typeComponents[headerType]
  15. }
  16. return typeComponents.default
  17. }
  18. return {
  19. getCellContentComponent,
  20. }
  21. }