ObjectAttributes.story.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <!-- Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import { keyBy } from 'lodash-es'
  4. import type { ObjectManagerFrontendAttribute } from '@shared/graphql/types'
  5. import ObjectAttributes from './ObjectAttributes.vue'
  6. import attributesJson from './__tests__/attributes.json'
  7. const attributes = attributesJson as ObjectManagerFrontendAttribute[]
  8. const attributesByKey = keyBy(attributes, 'name')
  9. const object = {
  10. login: 'some_object',
  11. address: 'Berlin, Street, House',
  12. vip: true,
  13. note: 'note',
  14. active: true,
  15. invisible: 'invisible',
  16. objectAttributeValues: [
  17. {
  18. attribute: attributesByKey.date_attribute,
  19. value: '2022-08-19',
  20. __typename: 'ObjectAttributeValue',
  21. },
  22. {
  23. attribute: attributesByKey.textarea_field,
  24. value: 'textarea text',
  25. },
  26. {
  27. attribute: attributesByKey.integer_field,
  28. value: 600,
  29. },
  30. {
  31. attribute: attributesByKey.date_time_field,
  32. value: '2022-08-11T05:00:00.000Z',
  33. },
  34. {
  35. attribute: attributesByKey.single_select,
  36. value: 'key1',
  37. },
  38. {
  39. attribute: attributesByKey.multi_select_field,
  40. value: ['key1', 'key2'],
  41. },
  42. {
  43. attribute: attributesByKey.single_tree_select,
  44. value: 'key1::key1_child1',
  45. },
  46. {
  47. attribute: attributesByKey.multi_tree_select,
  48. value: ['key1', 'key2', 'key2::key2_child1'],
  49. },
  50. {
  51. attribute: attributesByKey.some_url,
  52. value: 'https://url.com',
  53. },
  54. {
  55. attribute: attributesByKey.some_email,
  56. value: 'email@email.com',
  57. },
  58. {
  59. attribute: attributesByKey.phone,
  60. value: '+49 123456789',
  61. },
  62. ],
  63. }
  64. </script>
  65. <template>
  66. <Story>
  67. <ObjectAttributes :attributes="attributes" :object="object" />
  68. </Story>
  69. </template>