Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. const fileMachine = Machine({
  2. id: 'myform',
  3. context: {
  4. hello: 'world',
  5. },
  6. type: 'parallel',
  7. states: {
  8. YESNOCHECKBOX: {
  9. initial: 'IDLE',
  10. states: {
  11. IDLE: {
  12. on: {
  13. 'YESNOCHECKBOX.COMPLETE': 'COMPLETE',
  14. },
  15. },
  16. COMPLETE: {
  17. on: {
  18. 'YESNOCHECKBOX.CHANGE': 'COMPLETE',
  19. 'YESNOCHECKBOX.TOGGLE': 'IDLE',
  20. },
  21. },
  22. },
  23. },
  24. YESNORADIO: {
  25. initial: 'IDLE',
  26. states: {
  27. IDLE: {
  28. on: {
  29. 'YESNORADIO.COMPLETE': 'COMPLETE',
  30. },
  31. },
  32. COMPLETE: {
  33. on: {
  34. 'YESNORADIO.CHANGE': 'COMPLETE',
  35. },
  36. },
  37. },
  38. },
  39. FIRSTNAME: {
  40. initial: 'IDLE',
  41. states: {
  42. IDLE: {
  43. on: {
  44. 'FIRSTNAME.SINGLE': 'COMPLETE.SINGLE',
  45. couples: 'complete.couples',
  46. family: 'complete.family',
  47. singleParent: 'complete.singleParent',
  48. },
  49. },
  50. complete: {
  51. initial: 'single',
  52. states: {
  53. single: {
  54. on: {
  55. couples: 'couples',
  56. family: 'family',
  57. singleParent: 'singleParent',
  58. },
  59. },
  60. couples: {
  61. on: {
  62. single: 'single',
  63. family: 'family',
  64. singleParent: 'singleParent',
  65. },
  66. },
  67. family: {
  68. on: {
  69. single: 'single',
  70. couples: 'couples',
  71. singleParent: 'singleParent',
  72. },
  73. },
  74. singleParent: {
  75. on: {
  76. single: 'single',
  77. couples: 'couples',
  78. family: 'family',
  79. },
  80. },
  81. },
  82. },
  83. },
  84. },
  85. FIRSTNAME: {
  86. initial: 'IDLE',
  87. states: {
  88. IDLE: {
  89. on: {
  90. 'FIRSTNAME.FOCUS': 'EDITING',
  91. },
  92. },
  93. EDITING: {
  94. on: {
  95. 'FIRSTNAME.BLUR': 'VALIDATING',
  96. },
  97. },
  98. VALIDATING: {
  99. on: {
  100. 'FIRSTNAME.RESOLVE': 'COMPLETE',
  101. 'FIRSTNAME.REJECT': 'EDITING',
  102. },
  103. },
  104. COMPLETE: {
  105. on: {
  106. 'FIRSTNAME.FOCUS': 'EDITING',
  107. },
  108. },
  109. },
  110. },
  111. LASTNAME: {
  112. initial: 'IDLE',
  113. states: {
  114. IDLE: {
  115. on: {
  116. 'LASTNAME.FOCUS': 'EDITING',
  117. },
  118. },
  119. EDITING: {
  120. on: {
  121. 'LASTNAME.BLUR': 'VALIDATING',
  122. },
  123. },
  124. VALIDATING: {
  125. on: {
  126. 'LASTNAME.RESOLVE': 'COMPLETE',
  127. 'LASTNAME.REJECT': 'EDITING',
  128. },
  129. },
  130. COMPLETE: {
  131. on: {
  132. 'LASTNAME.FOCUS': 'EDITING',
  133. },
  134. },
  135. },
  136. },
  137. },
  138. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement