logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

boolean_setting.js (758B)


  1. import Checkbox from 'src/components/checkbox/checkbox.vue'
  2. import Setting from './setting.js'
  3. export default {
  4. ...Setting,
  5. props: {
  6. ...Setting.props,
  7. indeterminateState: [String, Object]
  8. },
  9. components: {
  10. ...Setting.components,
  11. Checkbox
  12. },
  13. computed: {
  14. ...Setting.computed,
  15. isIndeterminate () {
  16. return this.visibleState === this.indeterminateState
  17. }
  18. },
  19. methods: {
  20. ...Setting.methods,
  21. getValue (e) {
  22. // Basic tri-state toggle implementation
  23. if (!!this.indeterminateState && !e && this.visibleState === true) {
  24. // If we have indeterminate state, switching from true to false first goes through indeterminate
  25. return this.indeterminateState
  26. }
  27. return e
  28. }
  29. }
  30. }