import { TuplePage } from '@/services/data/query/tuple-page' ; import { Enum , EnumId } from '@/services/data/tuples/enum-types' ; import { QueryEnum } from '@/services/data/tuples/query-enum-types' ; import { QueryTuple , QueryTupleForHolder , Tuple } from '@/services/data/tuples/tuple-types' ; export enum TupleState { NONE = 'none' , CHANGED = 'changed' , SAVING = 'saving' , SAVED = 'saved' } export type HoldByTuple = { [ key in string ] ? : Array < QueryTupleForHolder > ; } ; export enum TupleEventTypes { DO_CREATE_TUPLE = 'do-create-tuple' , TUPLE_CREATED = 'tuple-created' , DO_EDIT_TUPLE = 'do-edit-tuple' , TUPLE_LOADED = 'tuple-loaded' , TUPLE_EDIT_DONE = 'tuple-edit-done' , CHANGE_TUPLE_STATE = 'change-tuple-state' , ASK_TUPLE_STATE = 'ask-tuple-state' , SAVE_TUPLE = 'save-tuple' , DO_SEARCH_TUPLE = 'do-search-tuple' , TUPLE_SEARCHED = 'tuple-searched' , ASK_ENUMS = 'ask-enums' , ASK_ENUM_DATA = 'ask-enum-data' } export interface TupleEventBus { fire ( type ) : this ; on ( type , listener ) : this ; off ( type , listener ) : this ; fire < T extends Tuple , HBT extends HoldByTuple > ( type , tuple , codes ? ) : this ; on < T extends Tuple , HBT extends HoldByTuple > ( type , listener ) : this ; off < T extends Tuple , HBT extends HoldByTuple > ( type , listener ) : this ; fire < T extends QueryTuple > ( type , tuple ) : this ; on < T extends QueryTuple > ( type , listener ) : this ; off < T extends QueryTuple > ( type , listener ) : this ; fire < T extends Tuple , HBT extends HoldByTuple > ( type , tuple , codes ? ) : this ; on < T extends Tuple , HBT extends HoldByTuple > ( type , listener ) : this ; off < T extends Tuple , HBT extends HoldByTuple > ( type , listener ) : this ; fire ( type , state ) : this ; on ( type , listener ) : this ; off ( type , listener ) : this ; fire ( type , onStateGot ) : this ; on ( type , listener ) : this ; off ( type , listener ) : this ; fire ( type ) : this ; on ( type , listener ) : this ; off ( type , listener ) : this ; fire < T extends Tuple > ( type , tuple , onSaved ) : this ; on < T extends Tuple > ( type , listener ) : this ; off < T extends Tuple > ( type , listener ) : this ; fire ( type , searchText , pageNumber ) : this ; on ( type , listener ) : this ; off ( type , listener ) : this ; fire < T extends QueryTuple > ( type , page , searchText ) : this ; on < T extends QueryTuple > ( type , listener ) : this ; off < T extends QueryTuple > ( type , listener ) : this ; fire ( type , onData ) : this ; on ( type , listener ) : this ; off ( type , listener ) : this ; fire ( type , enumId , onData ) : this ; on ( type , listener ) : this ; off ( type , listener ) : this ; }