useSharedVisualConfig.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type { FilePreviewVisualConfig } from '#shared/components/CommonFilePreview/types.ts'
  3. import type { TooltipVisualConfig } from '#shared/components/CommonTooltip/types.ts'
  4. import type { FieldFileVisualConfig } from '#shared/components/Form/fields/FieldFile/types.ts'
  5. import type { ObjectAttributesConfig } from '#shared/components/ObjectAttributes/types.ts'
  6. export interface SharedVisualConfig {
  7. objectAttributes: ObjectAttributesConfig
  8. tooltip: TooltipVisualConfig
  9. filePreview?: FilePreviewVisualConfig
  10. fieldFile?: FieldFileVisualConfig
  11. }
  12. const currentVisualConfig: SharedVisualConfig = {
  13. objectAttributes: {
  14. outer: 'div',
  15. wrapper: 'section',
  16. classes: {},
  17. },
  18. tooltip: {
  19. type: 'inline',
  20. component: () => null,
  21. },
  22. filePreview: {
  23. buttonComponent: () => null,
  24. buttonProps: {},
  25. },
  26. fieldFile: {
  27. buttonComponent: () => null,
  28. },
  29. }
  30. export const useSharedVisualConfig = () => {
  31. return currentVisualConfig
  32. }
  33. export const setupCommonVisualConfig = (config: SharedVisualConfig) => {
  34. Object.assign(currentVisualConfig, config)
  35. }