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, Transform,
XYPosition, XYPosition,
} from './flow' } from './flow'
import { HandleType, EdgeComponent, NodeComponent } from './components' import { HandleType, EdgeComponent, NodeComponent, NodeTypes, EdgeTypes } from './components'
import { ConnectionMode, SetConnectionId } from './connection' import { ConnectionLineType, ConnectionMode, SetConnectionId } from './connection'
import { GraphEdge } from './edge' import { GraphEdge } from './edge'
import { NodeExtent, GraphNode, TranslateExtent } from './node' 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' import { FlowHooks } from './hooks'
export interface FlowState extends Omit<FlowOptions, 'elements' | 'id'> { export interface FlowState extends Omit<FlowOptions, 'elements' | 'id'> {
@@ -25,16 +25,21 @@ export interface FlowState extends Omit<FlowOptions, 'elements' | 'id'> {
instance?: FlowInstance instance?: FlowInstance
elements: FlowElements elements: FlowElements
nodeTypes: NodeTypes
edgeTypes: EdgeTypes
d3Zoom?: D3Zoom d3Zoom?: D3Zoom
d3Selection?: D3Selection d3Selection?: D3Selection
d3ZoomHandler?: D3ZoomHandler d3ZoomHandler?: D3ZoomHandler
minZoom: number minZoom: number
maxZoom: number maxZoom: number
defaultZoom: number
translateExtent: TranslateExtent translateExtent: TranslateExtent
nodeExtent: NodeExtent nodeExtent: NodeExtent
dimensions: Dimensions dimensions: Dimensions
transform: Transform transform: Transform
onlyRenderVisibleElements: boolean
defaultPosition: [number, number]
selectedElements?: FlowElements selectedElements?: FlowElements
selectedNodesBbox?: Rect selectedNodesBbox?: Rect
@@ -42,20 +47,36 @@ export interface FlowState extends Omit<FlowOptions, 'elements' | 'id'> {
selectionActive: boolean selectionActive: boolean
userSelectionRect: SelectionRect userSelectionRect: SelectionRect
multiSelectionActive: boolean multiSelectionActive: boolean
deleteKeyCode: KeyCode
selectionKeyCode: KeyCode
multiSelectionKeyCode: KeyCode
zoomActivationKeyCode: KeyCode
connectionNodeId?: ElementId connectionNodeId?: ElementId
connectionHandleId?: ElementId connectionHandleId?: ElementId
connectionHandleType?: HandleType connectionHandleType?: HandleType
connectionPosition: XYPosition connectionPosition: XYPosition
connectionMode: ConnectionMode connectionMode: ConnectionMode
connectionLineType: ConnectionLineType
edgeUpdaterRadius: number
snapToGrid: boolean snapToGrid: boolean
snapGrid: SnapGrid snapGrid: SnapGrid
arrowHeadColor: string
edgesUpdatable: boolean edgesUpdatable: boolean
nodesDraggable: boolean nodesDraggable: boolean
nodesConnectable: boolean nodesConnectable: boolean
elementsSelectable: boolean elementsSelectable: boolean
selectNodesOnDrag: boolean
paneMoveable: boolean
zoomOnScroll: boolean
zoomOnPinch: boolean
panOnScroll: boolean
panOnScrollSpeed: number
panOnScrollMode: PanOnScrollMode
zoomOnDoubleClick: boolean
preventScrolling: boolean
isReady: 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 { DefaultNode, InputNode, OutputNode, BezierEdge, SmoothStepEdge, StepEdge, StraightEdge } from '~/components'
import { createHooks } from '~/composables' import { createHooks } from '~/composables'
@@ -52,9 +52,9 @@ export const initialState = (): FlowState => ({
panOnScrollMode: PanOnScrollMode.Free, panOnScrollMode: PanOnScrollMode.Free,
paneMoveable: true, paneMoveable: true,
edgeUpdaterRadius: 10, edgeUpdaterRadius: 10,
onlyRenderVisibleElements: undefined, onlyRenderVisibleElements: false,
defaultZoom: undefined, defaultZoom: 1,
defaultPosition: undefined, defaultPosition: [0, 0],
nodesSelectionActive: false, nodesSelectionActive: false,
selectionActive: false, selectionActive: false,
@@ -71,7 +71,7 @@ export const initialState = (): FlowState => ({
arrowHeadColor: '#b1b1b7', arrowHeadColor: '#b1b1b7',
connectionLineStyle: {}, connectionLineStyle: {},
connectionLineType: undefined, connectionLineType: ConnectionLineType.Bezier,
connectionNodeId: undefined, connectionNodeId: undefined,
connectionHandleId: undefined, connectionHandleId: undefined,
connectionHandleType: 'source', connectionHandleType: 'source',
@@ -82,15 +82,15 @@ export const initialState = (): FlowState => ({
snapToGrid: false, snapToGrid: false,
edgesUpdatable: false, edgesUpdatable: false,
nodesDraggable: true,
nodesConnectable: true, nodesConnectable: true,
nodesDraggable: true,
elementsSelectable: true, elementsSelectable: true,
selectNodesOnDrag: undefined, selectNodesOnDrag: true,
multiSelectionActive: false, multiSelectionActive: false,
deleteKeyCode: undefined, selectionKeyCode: 'Shift',
selectionKeyCode: undefined, multiSelectionKeyCode: 'Meta',
multiSelectionKeyCode: undefined, zoomActivationKeyCode: 'Meta',
zoomActivationKeyCode: undefined, deleteKeyCode: 'Backspace',
hooks: createHooks(), hooks: createHooks(),
loading: undefined, loading: undefined,