Created
April 22, 2020 11:45
-
-
Save pangratz/ab1588a862a33da66277cb2d7cb2a4d5 to your computer and use it in GitHub Desktop.
Revisions
-
pangratz created this gist
Apr 22, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,192 @@ // Available variables: // - Machine // - interpret // - assign // - send // - sendParent // - spawn // - raise // - actions // - XState (all XState exports) const fetchMachine = Machine({ initial: 'idle', states: { idle: { on: { LOAD_PRODUCTION_ORDERS: 'loading' } }, loading: { LOADED: 'show' }, show: { initial: 'show', states: { show: { on: { START_EDITING: 'editing', SHOW_DAY: { actions: ['showDay'] }, SHOW_TODAY: { actions: ['showToday'] }, SHOW_WEEK: { actions: ['showWeek'] }, SHOW_BEFORE: { actions: ['showPeriodBefore'] }, SHOW_AFTER: { actions: ['showPeriodAfter'] } } }, editing: { type: 'parallel', on: { STOP_EDITING: 'show' }, states: { behavior: { states: { idle: { on: { SAVE: { target: 'saving', actions: ['saveProductionOrders'] } } }, saving: { on: { SAVE_SUCCESS: 'idle', SAVE_ERROR: { target: 'error', actions: ['showError'] } } }, error: { on: { SAVE: { target: 'saving', actions: ['saveProductionOrders'] } } } } }, list: { initial: 'no_selection', states: { no_selection: { on: { SELECTION_UPDATED: [ { actions: ['setSelection'] }, { target: 'has_selection', cond: 'notEmptySelection' } ] } }, has_selection: { on: { SELECTION_UPDATED: [ { actions: ['setSelection'] }, { target: 'no_selection', cond: 'emptySelection' } ] } } } }, content: { on: { SHOW_DAY: { actions: ['showDay'] }, SHOW_TODAY: { actions: ['showToday'] }, SHOW_WEEK: { actions: ['showWeek'] }, SHOW_BEFORE: { actions: ['showPeriodBefore'] }, SHOW_AFTER: { actions: ['showPeriodAfter'] }, ADD_SELECTION_TO_PLANNING: { actions: ['addSelectionToPlanningPeriodItem'] }, MOVE_UP: { actions: ['moveProductionOrderPositionUp'] }, MOVE_DOWN: { actions: ['moveProductionOrderPositionDown'] }, REMOVE_FROM_PLANNING: { actions: ['setProductionOrderStatusToNew'] } } }, detail_modal: { initial: 'hidden', states: { hidden: { on: { SHOW_DETAIL_MODAL: { target: 'showing', actions: ['showDetailModal'] } } }, showing: { on: { HIDE_DETAIL_MODAL: { target: 'hidden', actions: ['hideDetailModal'] } } } } } } } } } } });