update(store, types): overload flowoptions typings with non-nullables in flowstate

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-12-04 15:42:18 +01:00
parent f8cf71cfb8
commit 1a3b68373e
2 changed files with 35 additions and 14 deletions
+24 -3
View File
@@ -13,11 +13,11 @@ import {
Transform,
XYPosition,
} from './flow'
import { HandleType, EdgeComponent, NodeComponent } from './components'
import { ConnectionMode, SetConnectionId } from './connection'
import { HandleType, EdgeComponent, NodeComponent, NodeTypes, EdgeTypes } from './components'
import { ConnectionLineType, ConnectionMode, SetConnectionId } from './connection'
import { GraphEdge } from './edge'
import { NodeExtent, GraphNode, TranslateExtent } from './node'
import { D3Selection, D3Zoom, D3ZoomHandler, InitD3ZoomPayload } from './zoom'
import { D3Selection, D3Zoom, D3ZoomHandler, InitD3ZoomPayload, KeyCode, PanOnScrollMode } from './zoom'
import { FlowHooks } from './hooks'
export interface FlowState extends Omit<FlowOptions, 'elements' | 'id'> {
@@ -25,16 +25,21 @@ export interface FlowState extends Omit<FlowOptions, 'elements' | 'id'> {
instance?: FlowInstance
elements: FlowElements
nodeTypes: NodeTypes
edgeTypes: EdgeTypes
d3Zoom?: D3Zoom
d3Selection?: D3Selection
d3ZoomHandler?: D3ZoomHandler
minZoom: number
maxZoom: number
defaultZoom: number
translateExtent: TranslateExtent
nodeExtent: NodeExtent
dimensions: Dimensions
transform: Transform
onlyRenderVisibleElements: boolean
defaultPosition: [number, number]
selectedElements?: FlowElements
selectedNodesBbox?: Rect
@@ -42,20 +47,36 @@ export interface FlowState extends Omit<FlowOptions, 'elements' | 'id'> {
selectionActive: boolean
userSelectionRect: SelectionRect
multiSelectionActive: boolean
deleteKeyCode: KeyCode
selectionKeyCode: KeyCode
multiSelectionKeyCode: KeyCode
zoomActivationKeyCode: KeyCode
connectionNodeId?: ElementId
connectionHandleId?: ElementId
connectionHandleType?: HandleType
connectionPosition: XYPosition
connectionMode: ConnectionMode
connectionLineType: ConnectionLineType
edgeUpdaterRadius: number
snapToGrid: boolean
snapGrid: SnapGrid
arrowHeadColor: string
edgesUpdatable: boolean
nodesDraggable: boolean
nodesConnectable: boolean
elementsSelectable: boolean
selectNodesOnDrag: boolean
paneMoveable: boolean
zoomOnScroll: boolean
zoomOnPinch: boolean
panOnScroll: boolean
panOnScrollSpeed: number
panOnScrollMode: PanOnScrollMode
zoomOnDoubleClick: boolean
preventScrolling: boolean
isReady: boolean
+11 -11
View File
@@ -1,4 +1,4 @@
import { ConnectionMode, FlowState, PanOnScrollMode, DefaultNodeTypes, DefaultEdgeTypes } from '~/types'
import { ConnectionMode, FlowState, PanOnScrollMode, DefaultNodeTypes, DefaultEdgeTypes, ConnectionLineType } from '~/types'
import { DefaultNode, InputNode, OutputNode, BezierEdge, SmoothStepEdge, StepEdge, StraightEdge } from '~/components'
import { createHooks } from '~/composables'
@@ -52,9 +52,9 @@ export const initialState = (): FlowState => ({
panOnScrollMode: PanOnScrollMode.Free,
paneMoveable: true,
edgeUpdaterRadius: 10,
onlyRenderVisibleElements: undefined,
defaultZoom: undefined,
defaultPosition: undefined,
onlyRenderVisibleElements: false,
defaultZoom: 1,
defaultPosition: [0, 0],
nodesSelectionActive: false,
selectionActive: false,
@@ -71,7 +71,7 @@ export const initialState = (): FlowState => ({
arrowHeadColor: '#b1b1b7',
connectionLineStyle: {},
connectionLineType: undefined,
connectionLineType: ConnectionLineType.Bezier,
connectionNodeId: undefined,
connectionHandleId: undefined,
connectionHandleType: 'source',
@@ -82,15 +82,15 @@ export const initialState = (): FlowState => ({
snapToGrid: false,
edgesUpdatable: false,
nodesDraggable: true,
nodesConnectable: true,
nodesDraggable: true,
elementsSelectable: true,
selectNodesOnDrag: undefined,
selectNodesOnDrag: true,
multiSelectionActive: false,
deleteKeyCode: undefined,
selectionKeyCode: undefined,
multiSelectionKeyCode: undefined,
zoomActivationKeyCode: undefined,
selectionKeyCode: 'Shift',
multiSelectionKeyCode: 'Meta',
zoomActivationKeyCode: 'Meta',
deleteKeyCode: 'Backspace',
hooks: createHooks(),
loading: undefined,