boolean.ts 877 B

12345678910111213141516171819202122232425262728
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type { FieldResolverModule } from '#shared/entities/object-attributes/types/resolver.ts'
  3. import FieldResolver from '../FieldResolver.ts'
  4. export class FieldResolverBoolean extends FieldResolver {
  5. fieldType = 'toggle'
  6. public fieldTypeAttributes() {
  7. const variants = this.attributeConfig.options as Record<string, string>
  8. return {
  9. value: false, // if it has default, it will be overriden after
  10. props: {
  11. variants,
  12. },
  13. // Add top margin only in multi-column mode, so the field aligns nicely with other which have visible labels.
  14. // More info in `app/frontend/apps/desktop/styles/main.css:77`.
  15. wrapperClass: '@lg/form-group:mt-6',
  16. }
  17. }
  18. }
  19. export default <FieldResolverModule>{
  20. type: 'boolean',
  21. resolver: FieldResolverBoolean,
  22. }