@rxflow/base 0.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/cjs/Flow.d.ts +14 -0
- package/cjs/Flow.d.ts.map +1 -0
- package/cjs/Flow.js +236 -0
- package/cjs/components/CollapseButton/index.d.ts +11 -0
- package/cjs/components/CollapseButton/index.d.ts.map +1 -0
- package/cjs/components/CollapseButton/index.js +58 -0
- package/cjs/components/CollapseButton/index.less +68 -0
- package/cjs/components/Controls/icons.d.ts +8 -0
- package/cjs/components/Controls/icons.d.ts.map +1 -0
- package/cjs/components/Controls/icons.js +85 -0
- package/cjs/components/Controls/index.d.ts +13 -0
- package/cjs/components/Controls/index.d.ts.map +1 -0
- package/cjs/components/Controls/index.js +195 -0
- package/cjs/components/DebugInfo/index.d.ts +5 -0
- package/cjs/components/DebugInfo/index.d.ts.map +1 -0
- package/cjs/components/DebugInfo/index.js +33 -0
- package/cjs/components/DebugInfo/index.less +6 -0
- package/cjs/components/EdgeText/index.d.ts +6 -0
- package/cjs/components/EdgeText/index.d.ts.map +1 -0
- package/cjs/components/EdgeText/index.js +48 -0
- package/cjs/components/Handle/index.d.ts +3 -0
- package/cjs/components/Handle/index.d.ts.map +1 -0
- package/cjs/components/Handle/index.js +24 -0
- package/cjs/components/Handle/index.module.less +9 -0
- package/cjs/components/HiddenHandle/index.css +9 -0
- package/cjs/components/HiddenHandle/index.d.ts +4 -0
- package/cjs/components/HiddenHandle/index.d.ts.map +1 -0
- package/cjs/components/HiddenHandle/index.js +23 -0
- package/cjs/components/Legend/index.d.ts +6 -0
- package/cjs/components/Legend/index.d.ts.map +1 -0
- package/cjs/components/Legend/index.js +72 -0
- package/cjs/components/Legend/index.less +41 -0
- package/cjs/components/LoadingButton.d.ts +16 -0
- package/cjs/components/LoadingButton.d.ts.map +1 -0
- package/cjs/components/LoadingButton.js +86 -0
- package/cjs/components/MarkerDefinitions/Mark.d.ts +11 -0
- package/cjs/components/MarkerDefinitions/Mark.d.ts.map +1 -0
- package/cjs/components/MarkerDefinitions/Mark.js +48 -0
- package/cjs/components/MarkerDefinitions/Symbols/Arrow.d.ts +11 -0
- package/cjs/components/MarkerDefinitions/Symbols/Arrow.d.ts.map +1 -0
- package/cjs/components/MarkerDefinitions/Symbols/Arrow.js +31 -0
- package/cjs/components/MarkerDefinitions/Symbols/ArrowClosed.d.ts +11 -0
- package/cjs/components/MarkerDefinitions/Symbols/ArrowClosed.d.ts.map +1 -0
- package/cjs/components/MarkerDefinitions/Symbols/ArrowClosed.js +32 -0
- package/cjs/components/MarkerDefinitions/index.d.ts +6 -0
- package/cjs/components/MarkerDefinitions/index.d.ts.map +1 -0
- package/cjs/components/MarkerDefinitions/index.js +45 -0
- package/cjs/components/MarkerDefinitions/styles.less +5 -0
- package/cjs/components/MarkerDefinitions/symbols.d.ts +5 -0
- package/cjs/components/MarkerDefinitions/symbols.d.ts.map +1 -0
- package/cjs/components/MarkerDefinitions/symbols.js +22 -0
- package/cjs/components/MarkerDefinitions/types.d.ts +21 -0
- package/cjs/components/NodeRenderFactory.d.ts +11 -0
- package/cjs/components/NodeRenderFactory.d.ts.map +1 -0
- package/cjs/components/NodeRenderFactory.js +26 -0
- package/cjs/components/Nodes/DefaultNode.d.ts +3 -0
- package/cjs/components/Nodes/DefaultNode.d.ts.map +1 -0
- package/cjs/components/Nodes/DefaultNode.js +30 -0
- package/cjs/components/Nodes/GroupNode.d.ts +3 -0
- package/cjs/components/Nodes/GroupNode.d.ts.map +1 -0
- package/cjs/components/Nodes/GroupNode.js +13 -0
- package/cjs/components/Nodes/InputNode.d.ts +3 -0
- package/cjs/components/Nodes/InputNode.d.ts.map +1 -0
- package/cjs/components/Nodes/InputNode.js +25 -0
- package/cjs/components/Nodes/OutputNode.d.ts +3 -0
- package/cjs/components/Nodes/OutputNode.d.ts.map +1 -0
- package/cjs/components/Nodes/OutputNode.js +25 -0
- package/cjs/components/Popover/index.d.ts +11 -0
- package/cjs/components/Popover/index.d.ts.map +1 -0
- package/cjs/components/Popover/index.js +100 -0
- package/cjs/components/Tooltip/index.d.ts +12 -0
- package/cjs/components/Tooltip/index.d.ts.map +1 -0
- package/cjs/components/Tooltip/index.js +110 -0
- package/cjs/components/index.d.ts +16 -0
- package/cjs/components/index.d.ts.map +1 -0
- package/cjs/components/index.js +100 -0
- package/cjs/constants/InnerFlowType.d.ts +12 -0
- package/cjs/constants/InnerFlowType.d.ts.map +1 -0
- package/cjs/constants/InnerFlowType.js +18 -0
- package/cjs/constants/NodeRoleType.d.ts +16 -0
- package/cjs/constants/NodeRoleType.d.ts.map +1 -0
- package/cjs/constants/NodeRoleType.js +22 -0
- package/cjs/constants/SelectionStrategy.d.ts +14 -0
- package/cjs/constants/SelectionStrategy.d.ts.map +1 -0
- package/cjs/constants/SelectionStrategy.js +20 -0
- package/cjs/edges/SmartEdge/index.d.ts +15 -0
- package/cjs/edges/SmartEdge/index.d.ts.map +1 -0
- package/cjs/edges/SmartEdge/index.js +54 -0
- package/cjs/hoc/createFlow.d.ts +14 -0
- package/cjs/hoc/createFlow.d.ts.map +1 -0
- package/cjs/hoc/createFlow.js +67 -0
- package/cjs/hoc/withFlowProvider.d.ts +11 -0
- package/cjs/hoc/withFlowProvider.d.ts.map +1 -0
- package/cjs/hoc/withFlowProvider.js +29 -0
- package/cjs/hooks/edges/useGetEdgesChangeHandlers.d.ts +11 -0
- package/cjs/hooks/edges/useGetEdgesChangeHandlers.d.ts.map +1 -0
- package/cjs/hooks/edges/useGetEdgesChangeHandlers.js +24 -0
- package/cjs/hooks/edges/useOnEdgesChange.d.ts +11 -0
- package/cjs/hooks/edges/useOnEdgesChange.d.ts.map +1 -0
- package/cjs/hooks/edges/useOnEdgesChange.js +31 -0
- package/cjs/hooks/index.d.ts +22 -0
- package/cjs/hooks/index.d.ts.map +1 -0
- package/cjs/hooks/index.js +159 -0
- package/cjs/hooks/node/useCheckUnMount.d.ts +2 -0
- package/cjs/hooks/node/useCheckUnMount.d.ts.map +1 -0
- package/cjs/hooks/node/useCheckUnMount.js +27 -0
- package/cjs/hooks/node/useInitialized.d.ts +2 -0
- package/cjs/hooks/node/useInitialized.d.ts.map +1 -0
- package/cjs/hooks/node/useInitialized.js +20 -0
- package/cjs/hooks/node/useNodeDragging.d.ts +2 -0
- package/cjs/hooks/node/useNodeDragging.d.ts.map +1 -0
- package/cjs/hooks/node/useNodeDragging.js +20 -0
- package/cjs/hooks/node/useNodeInitialize.d.ts +2 -0
- package/cjs/hooks/node/useNodeInitialize.d.ts.map +1 -0
- package/cjs/hooks/node/useNodeInitialize.js +23 -0
- package/cjs/hooks/node/useNodeTypeMap.d.ts +11 -0
- package/cjs/hooks/node/useNodeTypeMap.d.ts.map +1 -0
- package/cjs/hooks/node/useNodeTypeMap.js +20 -0
- package/cjs/hooks/node/useNodes.d.ts +10 -0
- package/cjs/hooks/node/useNodes.d.ts.map +1 -0
- package/cjs/hooks/node/useNodes.js +12 -0
- package/cjs/hooks/node/useSetNodeDragging.d.ts +2 -0
- package/cjs/hooks/node/useSetNodeDragging.d.ts.map +1 -0
- package/cjs/hooks/node/useSetNodeDragging.js +26 -0
- package/cjs/hooks/props/useGetProps.d.ts +6 -0
- package/cjs/hooks/props/useGetProps.d.ts.map +1 -0
- package/cjs/hooks/props/useGetProps.js +29 -0
- package/cjs/hooks/props/useProps.d.ts +2 -0
- package/cjs/hooks/props/useProps.d.ts.map +1 -0
- package/cjs/hooks/props/useProps.js +20 -0
- package/cjs/hooks/props/usePropsSelector.d.ts +13 -0
- package/cjs/hooks/props/usePropsSelector.d.ts.map +1 -0
- package/cjs/hooks/props/usePropsSelector.js +37 -0
- package/cjs/hooks/render/useForceUpdate.d.ts +2 -0
- package/cjs/hooks/render/useForceUpdate.d.ts.map +1 -0
- package/cjs/hooks/render/useForceUpdate.js +28 -0
- package/cjs/hooks/render/useForceUpdateTimes.d.ts +2 -0
- package/cjs/hooks/render/useForceUpdateTimes.d.ts.map +1 -0
- package/cjs/hooks/render/useForceUpdateTimes.js +20 -0
- package/cjs/hooks/state/useGetState.d.ts +11 -0
- package/cjs/hooks/state/useGetState.d.ts.map +1 -0
- package/cjs/hooks/state/useGetState.js +27 -0
- package/cjs/hooks/state/useSelector.d.ts +13 -0
- package/cjs/hooks/state/useSelector.d.ts.map +1 -0
- package/cjs/hooks/state/useSelector.js +28 -0
- package/cjs/hooks/state/useSetState.d.ts +11 -0
- package/cjs/hooks/state/useSetState.d.ts.map +1 -0
- package/cjs/hooks/state/useSetState.js +27 -0
- package/cjs/hooks/useFlowId.d.ts +6 -0
- package/cjs/hooks/useFlowId.d.ts.map +1 -0
- package/cjs/hooks/useFlowId.js +24 -0
- package/cjs/hooks/useListenRender.d.ts +2 -0
- package/cjs/hooks/useListenRender.d.ts.map +1 -0
- package/cjs/hooks/useListenRender.js +48 -0
- package/cjs/hooks/useNodeTypes.d.ts +14 -0
- package/cjs/hooks/useNodeTypes.d.ts.map +1 -0
- package/cjs/hooks/useNodeTypes.js +54 -0
- package/cjs/hooks/useTheme.d.ts +9 -0
- package/cjs/hooks/useTheme.d.ts.map +1 -0
- package/cjs/hooks/useTheme.js +25 -0
- package/cjs/hooks/useThemeVars.d.ts +15 -0
- package/cjs/hooks/useThemeVars.d.ts.map +1 -0
- package/cjs/hooks/useThemeVars.js +37 -0
- package/cjs/index.d.ts +28 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +180 -0
- package/cjs/index.less +7 -0
- package/cjs/index.module.less +10 -0
- package/cjs/plugins/export/index.d.ts +18 -0
- package/cjs/plugins/export/index.d.ts.map +1 -0
- package/cjs/plugins/export/index.js +52 -0
- package/cjs/plugins/scrollbar/hooks/useScrollerOptions.d.ts +11 -0
- package/cjs/plugins/scrollbar/hooks/useScrollerOptions.d.ts.map +1 -0
- package/cjs/plugins/scrollbar/hooks/useScrollerOptions.js +46 -0
- package/cjs/plugins/scrollbar/index.d.ts +5 -0
- package/cjs/plugins/scrollbar/index.d.ts.map +1 -0
- package/cjs/plugins/scrollbar/index.js +215 -0
- package/cjs/plugins/scrollbar/index.less +10 -0
- package/cjs/plugins/scrollbar/types.d.ts +24 -0
- package/cjs/plugins/scrollbar/types.d.ts.map +1 -0
- package/cjs/plugins/scrollbar/types.js +5 -0
- package/cjs/providers/FlowProvider.d.ts +27 -0
- package/cjs/providers/FlowProvider.d.ts.map +1 -0
- package/cjs/providers/FlowProvider.js +91 -0
- package/cjs/store/PropsStore.d.ts +16 -0
- package/cjs/store/PropsStore.d.ts.map +1 -0
- package/cjs/store/PropsStore.js +75 -0
- package/cjs/types.d.ts +223 -0
- package/cjs/types.d.ts.map +1 -0
- package/cjs/types.js +5 -0
- package/cjs/utils/dimension.d.ts +20 -0
- package/cjs/utils/dimension.d.ts.map +1 -0
- package/cjs/utils/dimension.js +96 -0
- package/cjs/utils/getPopupContainer.d.ts +10 -0
- package/cjs/utils/getPopupContainer.d.ts.map +1 -0
- package/cjs/utils/getPopupContainer.js +19 -0
- package/cjs/utils/getThemeWithDefaultValue.d.ts +10 -0
- package/cjs/utils/getThemeWithDefaultValue.d.ts.map +1 -0
- package/cjs/utils/getThemeWithDefaultValue.js +23 -0
- package/cjs/utils/hasDimensionsChange.d.ts +10 -0
- package/cjs/utils/hasDimensionsChange.d.ts.map +1 -0
- package/cjs/utils/hasDimensionsChange.js +23 -0
- package/cjs/utils/layouts/base.d.ts +16 -0
- package/cjs/utils/layouts/base.d.ts.map +1 -0
- package/cjs/utils/layouts/base.js +27 -0
- package/cjs/utils/layouts/mindmap.d.ts +7 -0
- package/cjs/utils/layouts/mindmap.d.ts.map +1 -0
- package/cjs/utils/layouts/mindmap.js +133 -0
- package/cjs/utils/measureText.d.ts +21 -0
- package/cjs/utils/measureText.d.ts.map +1 -0
- package/cjs/utils/measureText.js +76 -0
- package/cjs/utils/parse.d.ts +11 -0
- package/cjs/utils/parse.d.ts.map +1 -0
- package/cjs/utils/parse.js +29 -0
- package/cjs/utils/preCreateInnerNode.d.ts +11 -0
- package/cjs/utils/preCreateInnerNode.d.ts.map +1 -0
- package/cjs/utils/preCreateInnerNode.js +44 -0
- package/cjs/utils/uuid.d.ts +10 -0
- package/cjs/utils/uuid.d.ts.map +1 -0
- package/cjs/utils/uuid.js +16 -0
- package/esm/Flow.d.ts +14 -0
- package/esm/Flow.d.ts.map +1 -0
- package/esm/Flow.js +251 -0
- package/esm/components/CollapseButton/index.d.ts +11 -0
- package/esm/components/CollapseButton/index.d.ts.map +1 -0
- package/esm/components/CollapseButton/index.js +59 -0
- package/esm/components/CollapseButton/index.less +68 -0
- package/esm/components/Controls/icons.d.ts +8 -0
- package/esm/components/Controls/icons.d.ts.map +1 -0
- package/esm/components/Controls/icons.js +75 -0
- package/esm/components/Controls/index.d.ts +13 -0
- package/esm/components/Controls/index.d.ts.map +1 -0
- package/esm/components/Controls/index.js +201 -0
- package/esm/components/DebugInfo/index.d.ts +5 -0
- package/esm/components/DebugInfo/index.d.ts.map +1 -0
- package/esm/components/DebugInfo/index.js +23 -0
- package/esm/components/DebugInfo/index.less +6 -0
- package/esm/components/EdgeText/index.d.ts +6 -0
- package/esm/components/EdgeText/index.d.ts.map +1 -0
- package/esm/components/EdgeText/index.js +52 -0
- package/esm/components/Handle/index.d.ts +3 -0
- package/esm/components/Handle/index.d.ts.map +1 -0
- package/esm/components/Handle/index.js +21 -0
- package/esm/components/Handle/index.module.less +9 -0
- package/esm/components/HiddenHandle/index.css +9 -0
- package/esm/components/HiddenHandle/index.d.ts +4 -0
- package/esm/components/HiddenHandle/index.d.ts.map +1 -0
- package/esm/components/HiddenHandle/index.js +21 -0
- package/esm/components/Legend/index.d.ts +6 -0
- package/esm/components/Legend/index.d.ts.map +1 -0
- package/esm/components/Legend/index.js +68 -0
- package/esm/components/Legend/index.less +41 -0
- package/esm/components/LoadingButton.d.ts +16 -0
- package/esm/components/LoadingButton.d.ts.map +1 -0
- package/esm/components/LoadingButton.js +112 -0
- package/esm/components/MarkerDefinitions/Mark.d.ts +11 -0
- package/esm/components/MarkerDefinitions/Mark.d.ts.map +1 -0
- package/esm/components/MarkerDefinitions/Mark.js +44 -0
- package/esm/components/MarkerDefinitions/Symbols/Arrow.d.ts +11 -0
- package/esm/components/MarkerDefinitions/Symbols/Arrow.d.ts.map +1 -0
- package/esm/components/MarkerDefinitions/Symbols/Arrow.js +25 -0
- package/esm/components/MarkerDefinitions/Symbols/ArrowClosed.d.ts +11 -0
- package/esm/components/MarkerDefinitions/Symbols/ArrowClosed.d.ts.map +1 -0
- package/esm/components/MarkerDefinitions/Symbols/ArrowClosed.js +26 -0
- package/esm/components/MarkerDefinitions/index.d.ts +6 -0
- package/esm/components/MarkerDefinitions/index.d.ts.map +1 -0
- package/esm/components/MarkerDefinitions/index.js +37 -0
- package/esm/components/MarkerDefinitions/styles.less +5 -0
- package/esm/components/MarkerDefinitions/symbols.d.ts +5 -0
- package/esm/components/MarkerDefinitions/symbols.d.ts.map +1 -0
- package/esm/components/MarkerDefinitions/symbols.js +16 -0
- package/esm/components/MarkerDefinitions/types.d.ts +21 -0
- package/esm/components/NodeRenderFactory.d.ts +11 -0
- package/esm/components/NodeRenderFactory.d.ts.map +1 -0
- package/esm/components/NodeRenderFactory.js +23 -0
- package/esm/components/Nodes/DefaultNode.d.ts +3 -0
- package/esm/components/Nodes/DefaultNode.d.ts.map +1 -0
- package/esm/components/Nodes/DefaultNode.js +27 -0
- package/esm/components/Nodes/GroupNode.d.ts +3 -0
- package/esm/components/Nodes/GroupNode.d.ts.map +1 -0
- package/esm/components/Nodes/GroupNode.js +6 -0
- package/esm/components/Nodes/InputNode.d.ts +3 -0
- package/esm/components/Nodes/InputNode.d.ts.map +1 -0
- package/esm/components/Nodes/InputNode.js +21 -0
- package/esm/components/Nodes/OutputNode.d.ts +3 -0
- package/esm/components/Nodes/OutputNode.d.ts.map +1 -0
- package/esm/components/Nodes/OutputNode.js +21 -0
- package/esm/components/Popover/index.d.ts +11 -0
- package/esm/components/Popover/index.d.ts.map +1 -0
- package/esm/components/Popover/index.js +109 -0
- package/esm/components/Tooltip/index.d.ts +12 -0
- package/esm/components/Tooltip/index.d.ts.map +1 -0
- package/esm/components/Tooltip/index.js +121 -0
- package/esm/components/index.d.ts +16 -0
- package/esm/components/index.d.ts.map +1 -0
- package/esm/components/index.js +15 -0
- package/esm/constants/InnerFlowType.d.ts +12 -0
- package/esm/constants/InnerFlowType.d.ts.map +1 -0
- package/esm/constants/InnerFlowType.js +13 -0
- package/esm/constants/NodeRoleType.d.ts +16 -0
- package/esm/constants/NodeRoleType.d.ts.map +1 -0
- package/esm/constants/NodeRoleType.js +16 -0
- package/esm/constants/SelectionStrategy.d.ts +14 -0
- package/esm/constants/SelectionStrategy.d.ts.map +1 -0
- package/esm/constants/SelectionStrategy.js +15 -0
- package/esm/edges/SmartEdge/index.d.ts +15 -0
- package/esm/edges/SmartEdge/index.d.ts.map +1 -0
- package/esm/edges/SmartEdge/index.js +45 -0
- package/esm/hoc/createFlow.d.ts +14 -0
- package/esm/hoc/createFlow.d.ts.map +1 -0
- package/esm/hoc/createFlow.js +66 -0
- package/esm/hoc/withFlowProvider.d.ts +11 -0
- package/esm/hoc/withFlowProvider.d.ts.map +1 -0
- package/esm/hoc/withFlowProvider.js +24 -0
- package/esm/hooks/edges/useGetEdgesChangeHandlers.d.ts +11 -0
- package/esm/hooks/edges/useGetEdgesChangeHandlers.d.ts.map +1 -0
- package/esm/hooks/edges/useGetEdgesChangeHandlers.js +17 -0
- package/esm/hooks/edges/useOnEdgesChange.d.ts +11 -0
- package/esm/hooks/edges/useOnEdgesChange.d.ts.map +1 -0
- package/esm/hooks/edges/useOnEdgesChange.js +24 -0
- package/esm/hooks/index.d.ts +22 -0
- package/esm/hooks/index.d.ts.map +1 -0
- package/esm/hooks/index.js +22 -0
- package/esm/hooks/node/useCheckUnMount.d.ts +2 -0
- package/esm/hooks/node/useCheckUnMount.d.ts.map +1 -0
- package/esm/hooks/node/useCheckUnMount.js +18 -0
- package/esm/hooks/node/useInitialized.d.ts +2 -0
- package/esm/hooks/node/useInitialized.d.ts.map +1 -0
- package/esm/hooks/node/useInitialized.js +12 -0
- package/esm/hooks/node/useNodeDragging.d.ts +2 -0
- package/esm/hooks/node/useNodeDragging.d.ts.map +1 -0
- package/esm/hooks/node/useNodeDragging.js +14 -0
- package/esm/hooks/node/useNodeInitialize.d.ts +2 -0
- package/esm/hooks/node/useNodeInitialize.d.ts.map +1 -0
- package/esm/hooks/node/useNodeInitialize.js +15 -0
- package/esm/hooks/node/useNodeTypeMap.d.ts +11 -0
- package/esm/hooks/node/useNodeTypeMap.d.ts.map +1 -0
- package/esm/hooks/node/useNodeTypeMap.js +14 -0
- package/esm/hooks/node/useNodes.d.ts +10 -0
- package/esm/hooks/node/useNodes.d.ts.map +1 -0
- package/esm/hooks/node/useNodes.js +9 -0
- package/esm/hooks/node/useSetNodeDragging.d.ts +2 -0
- package/esm/hooks/node/useSetNodeDragging.d.ts.map +1 -0
- package/esm/hooks/node/useSetNodeDragging.js +18 -0
- package/esm/hooks/props/useGetProps.d.ts +6 -0
- package/esm/hooks/props/useGetProps.d.ts.map +1 -0
- package/esm/hooks/props/useGetProps.js +21 -0
- package/esm/hooks/props/useProps.d.ts +2 -0
- package/esm/hooks/props/useProps.d.ts.map +1 -0
- package/esm/hooks/props/useProps.js +14 -0
- package/esm/hooks/props/usePropsSelector.d.ts +13 -0
- package/esm/hooks/props/usePropsSelector.d.ts.map +1 -0
- package/esm/hooks/props/usePropsSelector.js +31 -0
- package/esm/hooks/render/useForceUpdate.d.ts +2 -0
- package/esm/hooks/render/useForceUpdate.d.ts.map +1 -0
- package/esm/hooks/render/useForceUpdate.js +20 -0
- package/esm/hooks/render/useForceUpdateTimes.d.ts +2 -0
- package/esm/hooks/render/useForceUpdateTimes.d.ts.map +1 -0
- package/esm/hooks/render/useForceUpdateTimes.js +14 -0
- package/esm/hooks/state/useGetState.d.ts +11 -0
- package/esm/hooks/state/useGetState.d.ts.map +1 -0
- package/esm/hooks/state/useGetState.js +20 -0
- package/esm/hooks/state/useSelector.d.ts +13 -0
- package/esm/hooks/state/useSelector.d.ts.map +1 -0
- package/esm/hooks/state/useSelector.js +21 -0
- package/esm/hooks/state/useSetState.d.ts +11 -0
- package/esm/hooks/state/useSetState.d.ts.map +1 -0
- package/esm/hooks/state/useSetState.js +20 -0
- package/esm/hooks/useFlowId.d.ts +6 -0
- package/esm/hooks/useFlowId.d.ts.map +1 -0
- package/esm/hooks/useFlowId.js +19 -0
- package/esm/hooks/useListenRender.d.ts +2 -0
- package/esm/hooks/useListenRender.d.ts.map +1 -0
- package/esm/hooks/useListenRender.js +39 -0
- package/esm/hooks/useNodeTypes.d.ts +14 -0
- package/esm/hooks/useNodeTypes.d.ts.map +1 -0
- package/esm/hooks/useNodeTypes.js +46 -0
- package/esm/hooks/useTheme.d.ts +9 -0
- package/esm/hooks/useTheme.d.ts.map +1 -0
- package/esm/hooks/useTheme.js +19 -0
- package/esm/hooks/useThemeVars.d.ts +15 -0
- package/esm/hooks/useThemeVars.d.ts.map +1 -0
- package/esm/hooks/useThemeVars.js +26 -0
- package/esm/index.d.ts +28 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +27 -0
- package/esm/index.less +7 -0
- package/esm/index.module.less +10 -0
- package/esm/plugins/export/index.d.ts +18 -0
- package/esm/plugins/export/index.d.ts.map +1 -0
- package/esm/plugins/export/index.js +71 -0
- package/esm/plugins/scrollbar/hooks/useScrollerOptions.d.ts +11 -0
- package/esm/plugins/scrollbar/hooks/useScrollerOptions.d.ts.map +1 -0
- package/esm/plugins/scrollbar/hooks/useScrollerOptions.js +38 -0
- package/esm/plugins/scrollbar/index.d.ts +5 -0
- package/esm/plugins/scrollbar/index.d.ts.map +1 -0
- package/esm/plugins/scrollbar/index.js +198 -0
- package/esm/plugins/scrollbar/index.less +10 -0
- package/esm/plugins/scrollbar/types.d.ts +24 -0
- package/esm/plugins/scrollbar/types.d.ts.map +1 -0
- package/esm/plugins/scrollbar/types.js +1 -0
- package/esm/providers/FlowProvider.d.ts +27 -0
- package/esm/providers/FlowProvider.d.ts.map +1 -0
- package/esm/providers/FlowProvider.js +90 -0
- package/esm/store/PropsStore.d.ts +16 -0
- package/esm/store/PropsStore.d.ts.map +1 -0
- package/esm/store/PropsStore.js +67 -0
- package/esm/types.d.ts +223 -0
- package/esm/types.d.ts.map +1 -0
- package/esm/types.js +1 -0
- package/esm/utils/dimension.d.ts +20 -0
- package/esm/utils/dimension.d.ts.map +1 -0
- package/esm/utils/dimension.js +89 -0
- package/esm/utils/getPopupContainer.d.ts +10 -0
- package/esm/utils/getPopupContainer.d.ts.map +1 -0
- package/esm/utils/getPopupContainer.js +12 -0
- package/esm/utils/getThemeWithDefaultValue.d.ts +10 -0
- package/esm/utils/getThemeWithDefaultValue.d.ts.map +1 -0
- package/esm/utils/getThemeWithDefaultValue.js +22 -0
- package/esm/utils/hasDimensionsChange.d.ts +10 -0
- package/esm/utils/hasDimensionsChange.d.ts.map +1 -0
- package/esm/utils/hasDimensionsChange.js +28 -0
- package/esm/utils/layouts/base.d.ts +16 -0
- package/esm/utils/layouts/base.d.ts.map +1 -0
- package/esm/utils/layouts/base.js +19 -0
- package/esm/utils/layouts/mindmap.d.ts +7 -0
- package/esm/utils/layouts/mindmap.d.ts.map +1 -0
- package/esm/utils/layouts/mindmap.js +131 -0
- package/esm/utils/measureText.d.ts +21 -0
- package/esm/utils/measureText.d.ts.map +1 -0
- package/esm/utils/measureText.js +69 -0
- package/esm/utils/parse.d.ts +11 -0
- package/esm/utils/parse.d.ts.map +1 -0
- package/esm/utils/parse.js +26 -0
- package/esm/utils/preCreateInnerNode.d.ts +11 -0
- package/esm/utils/preCreateInnerNode.d.ts.map +1 -0
- package/esm/utils/preCreateInnerNode.js +42 -0
- package/esm/utils/uuid.d.ts +10 -0
- package/esm/utils/uuid.d.ts.map +1 -0
- package/esm/utils/uuid.js +10 -0
- package/package.json +82 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlowProvider.d.ts","sourceRoot":"","sources":["FlowProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAErD,OAAO,KAAmC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAS,aAAa,EAAC,MAAM,SAAS,CAAC;AAE9C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAG9C,eAAO,MAAM,WAAW;;EAET,CAAC;AA+BhB,eAAO,MAAM,YAAY;cAIX,MAAM,SAAS;;4TAY3B,CAAA;AAGF;;;GAGG;AACH,eAAO,MAAM,WAAW,wBAA2B,aAAa,SAAS,aAAa,CAAC,CAAC,KAAK,CAAC,MAO7F,CAAA;AAED,eAAO,MAAM,WAAW,qKAOvB,CAAA;AAED,eAAO,MAAM,WAAW,2BAOvB,CAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
/**
|
|
8
|
+
* @author: yanxianliang
|
|
9
|
+
* @date: 2025-10-16 17:28
|
|
10
|
+
* @modified:2025/10/16 17:28 by yanxianliang
|
|
11
|
+
* @desc: 全局状态管理器
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { ReactFlowProvider } from "@xyflow/react";
|
|
17
|
+
import React, { memo, useContext, useState } from "react";
|
|
18
|
+
import { create } from "zustand";
|
|
19
|
+
import { devtools } from "zustand/middleware";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
// Context 外部提供,支持inner hooks
|
|
22
|
+
export var FlowContext = /*#__PURE__*/React.createContext(null);
|
|
23
|
+
var FlowProviderWrapper = function FlowProviderWrapper(_ref) {
|
|
24
|
+
var children = _ref.children;
|
|
25
|
+
var _useState = useState(function () {
|
|
26
|
+
return create(devtools(function (set) {
|
|
27
|
+
return {
|
|
28
|
+
onEdgesChangeHandlers: [],
|
|
29
|
+
// onChange 列表
|
|
30
|
+
forceRenderTimes: 0,
|
|
31
|
+
initialNodeIdSet: new Set(),
|
|
32
|
+
nodeTypeMap: new Map(),
|
|
33
|
+
smartEdges: {},
|
|
34
|
+
edgeStore: {}
|
|
35
|
+
};
|
|
36
|
+
}, {
|
|
37
|
+
name: "flow",
|
|
38
|
+
enabled: process.env.NODE_ENV === 'development'
|
|
39
|
+
}));
|
|
40
|
+
}),
|
|
41
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
42
|
+
useStore = _useState2[0];
|
|
43
|
+
return /*#__PURE__*/_jsx(FlowContext.Provider, {
|
|
44
|
+
value: {
|
|
45
|
+
useStore: useStore
|
|
46
|
+
},
|
|
47
|
+
children: children
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
export var FlowProvider = /*#__PURE__*/memo(function (_ref2) {
|
|
51
|
+
var children = _ref2.children;
|
|
52
|
+
var hasWrapped = useContext(FlowContext);
|
|
53
|
+
if (hasWrapped) {
|
|
54
|
+
return children;
|
|
55
|
+
}
|
|
56
|
+
return /*#__PURE__*/_jsx(ReactFlowProvider, {
|
|
57
|
+
children: /*#__PURE__*/_jsx(FlowProviderWrapper, {
|
|
58
|
+
children: children
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* hooks 创建
|
|
65
|
+
* selector 创建
|
|
66
|
+
*/
|
|
67
|
+
export var useSelector = function useSelector(selector) {
|
|
68
|
+
var context = useContext(FlowContext);
|
|
69
|
+
if (!context) {
|
|
70
|
+
console.error("Missing provider for context:", FlowContext);
|
|
71
|
+
throw new Error("Missing provider for context");
|
|
72
|
+
}
|
|
73
|
+
return context.useStore(selector);
|
|
74
|
+
};
|
|
75
|
+
export var useSetState = function useSetState() {
|
|
76
|
+
var context = useContext(FlowContext);
|
|
77
|
+
if (!context) {
|
|
78
|
+
console.error("Missing provider for context:", FlowContext);
|
|
79
|
+
throw new Error("Missing provider for context");
|
|
80
|
+
}
|
|
81
|
+
return context.useStore.setState;
|
|
82
|
+
};
|
|
83
|
+
export var useGetState = function useGetState() {
|
|
84
|
+
var context = useContext(FlowContext);
|
|
85
|
+
if (!context) {
|
|
86
|
+
console.error("Missing provider for context:", FlowContext);
|
|
87
|
+
throw new Error("Missing provider for context");
|
|
88
|
+
}
|
|
89
|
+
return context.useStore.getState;
|
|
90
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author: yanxianliang
|
|
3
|
+
* @date: 2025-10-16 19:35
|
|
4
|
+
* @modified:2025/10/16 19:35 by yanxianliang
|
|
5
|
+
* @desc: Props 存储
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
8
|
+
*/
|
|
9
|
+
import { IBaseFlowProps } from "../types";
|
|
10
|
+
import { Edge, Node } from "@xyflow/react";
|
|
11
|
+
import { ReactNode } from "react";
|
|
12
|
+
export declare const PropsStore: <NodeType extends Node = Node, EdgeType extends Edge = Edge>({ props, children }: {
|
|
13
|
+
props: IBaseFlowProps<NodeType, EdgeType>;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=PropsStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropsStore.d.ts","sourceRoot":"","sources":["PropsStore.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAC,cAAc,EAAkB,MAAM,UAAU,CAAC;AAEzD,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAEzC,OAAc,EAAC,SAAS,EAA6B,MAAM,OAAO,CAAC;AAKnE,eAAO,MAAM,UAAU;WAQZ,eAAe,QAAQ,EAAE,QAAQ,CAAC;cAC/B,SAAS;6CAoDtB,CAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author: yanxianliang
|
|
3
|
+
* @date: 2025-10-16 19:35
|
|
4
|
+
* @modified:2025/10/16 19:35 by yanxianliang
|
|
5
|
+
* @desc: Props 存储
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { NodeRoleType } from "../constants/NodeRoleType";
|
|
11
|
+
import { useDeepCompareEffect } from 'ahooks';
|
|
12
|
+
import React, { useEffect, useMemo, useRef } from "react";
|
|
13
|
+
import { v4 as uuid } from "uuid";
|
|
14
|
+
import { useGetState } from "./..";
|
|
15
|
+
import { useSetState } from "./..";
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
export var PropsStore = function PropsStore(_ref) {
|
|
20
|
+
var props = _ref.props,
|
|
21
|
+
children = _ref.children;
|
|
22
|
+
var setState = useSetState();
|
|
23
|
+
var getState = useGetState();
|
|
24
|
+
var defaultId = useMemo(function () {
|
|
25
|
+
return uuid();
|
|
26
|
+
}, []);
|
|
27
|
+
var nodeTypes = props.nodeTypes;
|
|
28
|
+
var styleContentRef = useRef([]);
|
|
29
|
+
|
|
30
|
+
// TODO 怎么支持内置的 nodeTypes???
|
|
31
|
+
var nodeTypeMap = useMemo(function () {
|
|
32
|
+
var map = new Map();
|
|
33
|
+
styleContentRef.current = [];
|
|
34
|
+
if (nodeTypes) {
|
|
35
|
+
for (var i = 0; i < nodeTypes.length; i++) {
|
|
36
|
+
var _definition$allowCont;
|
|
37
|
+
var definition = nodeTypes[i];
|
|
38
|
+
map.set(definition.type, definition);
|
|
39
|
+
// TODO 子工作流需要禁用内容区域的拖拽
|
|
40
|
+
if (definition.nodeRoleType === NodeRoleType.SubFlow && ((_definition$allowCont = definition.allowContentSelection) !== null && _definition$allowCont !== void 0 ? _definition$allowCont : true)) {
|
|
41
|
+
// 子工作流,需要固定样式
|
|
42
|
+
var type = definition.type;
|
|
43
|
+
styleContentRef.current.push(".react-flow__node-".concat(type, " {pointer-events: none!important;}"));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return map;
|
|
48
|
+
}, [nodeTypes]);
|
|
49
|
+
useDeepCompareEffect(function () {
|
|
50
|
+
setState({
|
|
51
|
+
props: props,
|
|
52
|
+
id: props.id || defaultId,
|
|
53
|
+
nodeTypeMap: nodeTypeMap
|
|
54
|
+
});
|
|
55
|
+
}, [props]);
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
// nodes 变化,需要重新进行初始化,清除当前初始化记录
|
|
58
|
+
getState().initialNodeIdSet.clear();
|
|
59
|
+
}, [props.nodes]);
|
|
60
|
+
|
|
61
|
+
// 样式需要注入
|
|
62
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
63
|
+
children: [/*#__PURE__*/_jsx("style", {
|
|
64
|
+
children: styleContentRef.current.join('')
|
|
65
|
+
}), children]
|
|
66
|
+
});
|
|
67
|
+
};
|
package/esm/types.d.ts
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author: yanxianliang
|
|
3
|
+
* @date: 2025-07-02 09:30
|
|
4
|
+
* @desc: BaseFlow 类型文件定义
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
7
|
+
*/
|
|
8
|
+
import { Edge, MarkerType, Node, PanelPosition, ReactFlowState, NodeProps, OnEdgesChange, ReactFlowProps } from "@xyflow/react";
|
|
9
|
+
import { NodeHandleBounds } from "@xyflow/system";
|
|
10
|
+
import React, { ComponentType } from "react";
|
|
11
|
+
import { MarkDefinition } from "./components/MarkerDefinitions/types";
|
|
12
|
+
import { ScrollbarPluginOptions } from "./plugins/scrollbar/types";
|
|
13
|
+
export type NodeTypeComponent<DataType extends Record<string, unknown> = Record<string, unknown>> = ComponentType<NodeProps<Node<DataType>>> & {
|
|
14
|
+
measureHandles?: (data: Node<DataType>) => NodeHandleBounds;
|
|
15
|
+
defaultSize?: {
|
|
16
|
+
width: number | ((node: Node<DataType>, theme: BaseThemeConfig) => number);
|
|
17
|
+
height: number | ((data: Node<DataType>, theme: BaseThemeConfig) => number);
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export interface BaseThemeConfig {
|
|
21
|
+
/**
|
|
22
|
+
* @description 字体大小配置
|
|
23
|
+
* @default 14
|
|
24
|
+
*/
|
|
25
|
+
fontSize?: number;
|
|
26
|
+
/**
|
|
27
|
+
* @description 字体家族配置
|
|
28
|
+
* @default "Arial, helvetica, sans-serif"
|
|
29
|
+
*/
|
|
30
|
+
fontFamily?: string;
|
|
31
|
+
/**
|
|
32
|
+
* @description 主题色
|
|
33
|
+
* @default "#5F95FF"
|
|
34
|
+
*/
|
|
35
|
+
primaryColor?: string;
|
|
36
|
+
/**
|
|
37
|
+
* @description 折叠按钮形状
|
|
38
|
+
* @default 'rect'
|
|
39
|
+
*/
|
|
40
|
+
collapseButtonShape?: 'rect' | 'circle';
|
|
41
|
+
/**
|
|
42
|
+
* 展开时自动隐藏关联节点数量
|
|
43
|
+
*/
|
|
44
|
+
autoHideCountWhenExpanded?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* @desc 是否显示依赖数量
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
showCount?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export type LayoutConfig<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
|
52
|
+
nodeTypes: Record<string, NodeTypeComponent>;
|
|
53
|
+
originNodes: NodeType[];
|
|
54
|
+
originEdges: EdgeType[];
|
|
55
|
+
theme: BaseThemeConfig;
|
|
56
|
+
onlyRenderVisibleElements: boolean;
|
|
57
|
+
store: ReactFlowState<NodeType, EdgeType>;
|
|
58
|
+
state: BaseStateType;
|
|
59
|
+
flowProps: IBaseFlowProps<NodeType, EdgeType>;
|
|
60
|
+
};
|
|
61
|
+
export type LayoutFunction<NodeType extends Node = Node, EdgeType extends Edge = Edge> = (config: LayoutConfig<NodeType, EdgeType>) => ({
|
|
62
|
+
nodes: NodeType[];
|
|
63
|
+
edges: EdgeType[];
|
|
64
|
+
});
|
|
65
|
+
export type MindMapLayoutConfig = {
|
|
66
|
+
hGap?: number;
|
|
67
|
+
vGap?: number;
|
|
68
|
+
markerType?: MarkerType;
|
|
69
|
+
};
|
|
70
|
+
export interface INodeDefinition<DataType extends Record<string, unknown> = Record<string, unknown>> {
|
|
71
|
+
type: string;
|
|
72
|
+
hideInLegend?: boolean;
|
|
73
|
+
hideInSider?: boolean;
|
|
74
|
+
group?: string;
|
|
75
|
+
order?: number;
|
|
76
|
+
label?: string;
|
|
77
|
+
icon?: React.ReactNode;
|
|
78
|
+
color?: string;
|
|
79
|
+
deletable?: boolean;
|
|
80
|
+
component: NodeTypeComponent<DataType>;
|
|
81
|
+
_component?: NodeTypeComponent<DataType>;
|
|
82
|
+
measureHandles?: (data: Node<DataType>) => NodeHandleBounds;
|
|
83
|
+
defaultSize?: {
|
|
84
|
+
width: number | ((node: Node<DataType>, theme: BaseThemeConfig) => number);
|
|
85
|
+
height: number | ((data: Node<DataType>, theme: BaseThemeConfig) => number);
|
|
86
|
+
};
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
}
|
|
89
|
+
export interface IBaseFlowProps<NodeType extends Node = Node, EdgeType extends Edge = Edge> extends Omit<ReactFlowProps<NodeType, EdgeType>, 'nodeTypes' | 'width' | 'height'> {
|
|
90
|
+
/**
|
|
91
|
+
* @description graph 宽度
|
|
92
|
+
*/
|
|
93
|
+
width?: string | number;
|
|
94
|
+
/**
|
|
95
|
+
* @description graph 高度
|
|
96
|
+
*/
|
|
97
|
+
height?: string | number;
|
|
98
|
+
/**
|
|
99
|
+
* @description 背景颜色
|
|
100
|
+
*/
|
|
101
|
+
background?: string;
|
|
102
|
+
/**
|
|
103
|
+
* @description 主题配置
|
|
104
|
+
*/
|
|
105
|
+
theme?: BaseThemeConfig;
|
|
106
|
+
nodeTypes?: Array<INodeDefinition<NodeType['data']>>;
|
|
107
|
+
/**
|
|
108
|
+
* @description 是否显示控制器
|
|
109
|
+
* @default true
|
|
110
|
+
*/
|
|
111
|
+
showControls?: boolean;
|
|
112
|
+
controlsPosition?: PanelPosition;
|
|
113
|
+
controlsOrientation?: 'horizontal' | 'vertical';
|
|
114
|
+
customControls?: React.ReactNode;
|
|
115
|
+
showMiniMap?: boolean;
|
|
116
|
+
getMiniMapNodeColor?: (node: Node) => string;
|
|
117
|
+
showFullscreen?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* @description 是否显示布局优化操作
|
|
120
|
+
*/
|
|
121
|
+
showForceLayout?: boolean;
|
|
122
|
+
showInteractive?: boolean;
|
|
123
|
+
showFitView?: boolean;
|
|
124
|
+
showZoom?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* @description 是否显示图例
|
|
127
|
+
* @default false
|
|
128
|
+
*/
|
|
129
|
+
showLegend?: boolean | {
|
|
130
|
+
/**
|
|
131
|
+
* 是否显示所有的图例,false时只显示当前显示节点的图例
|
|
132
|
+
* @default true
|
|
133
|
+
*/
|
|
134
|
+
showAll?: boolean;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* @description 是否自动居中
|
|
138
|
+
* @default false
|
|
139
|
+
*/
|
|
140
|
+
autoCenter?: boolean;
|
|
141
|
+
rootStyle?: React.CSSProperties;
|
|
142
|
+
layout?: LayoutFunction<NodeType, EdgeType>;
|
|
143
|
+
/**
|
|
144
|
+
* @description 是否强制布局
|
|
145
|
+
* @default !!layout
|
|
146
|
+
*/
|
|
147
|
+
forceLayout?: boolean;
|
|
148
|
+
markers?: MarkDefinition[];
|
|
149
|
+
plugins?: {
|
|
150
|
+
scroller?: false | ScrollbarPluginOptions;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* @description 是否开启 service worker 模式,当为数字时,检测当前的节点数量,节点数量大于配置阈值时启用 serviceWorker模式,否则直接在 js中执行;当为true时强制使用 service worker 执行计算逻辑。false时默认关闭
|
|
154
|
+
* @default false
|
|
155
|
+
*/
|
|
156
|
+
readOnly?: boolean;
|
|
157
|
+
onZoomIn?: () => void;
|
|
158
|
+
/** Called in addition the default zoom behavior when the zoom out button is clicked. */
|
|
159
|
+
onZoomOut?: () => void;
|
|
160
|
+
/**
|
|
161
|
+
* Called when the fit view button is clicked. When this is not provided, the viewport will be
|
|
162
|
+
* adjusted so that all nodes are visible.
|
|
163
|
+
*/
|
|
164
|
+
onFitView?: () => void;
|
|
165
|
+
/** Called when the interactive (lock) button is clicked. */
|
|
166
|
+
onInteractiveChange?: (interactiveStatus: boolean) => void;
|
|
167
|
+
/**
|
|
168
|
+
* @description nodes 节点变化/初始化渲染回调
|
|
169
|
+
*/
|
|
170
|
+
onRender?: (nodes: NodeType[], edges: EdgeType[], timing: number) => void;
|
|
171
|
+
omitProps?: string[];
|
|
172
|
+
/**
|
|
173
|
+
* 强制执行 fitView 逻辑,当 nodes 变化时自动触发 forceFitView
|
|
174
|
+
*/
|
|
175
|
+
forceFitView?: boolean;
|
|
176
|
+
}
|
|
177
|
+
export type CollapseButtonProps = {
|
|
178
|
+
position?: 'left' | 'right';
|
|
179
|
+
loading?: boolean;
|
|
180
|
+
collapsed?: boolean;
|
|
181
|
+
count: number;
|
|
182
|
+
onCollapse?: (collapsed: boolean) => void;
|
|
183
|
+
direction?: 'vertical' | 'horizontal';
|
|
184
|
+
displayCount?: boolean;
|
|
185
|
+
autoHideCountWhenExpanded?: boolean;
|
|
186
|
+
};
|
|
187
|
+
export interface TreeNode {
|
|
188
|
+
id: string;
|
|
189
|
+
type: string;
|
|
190
|
+
collapsed?: boolean;
|
|
191
|
+
childCount?: number;
|
|
192
|
+
children?: Array<TreeNode>;
|
|
193
|
+
}
|
|
194
|
+
export interface BaseNodeData {
|
|
195
|
+
id: string;
|
|
196
|
+
type: string;
|
|
197
|
+
}
|
|
198
|
+
export type NodeRenderProps = NodeProps & {
|
|
199
|
+
data: any;
|
|
200
|
+
type: any;
|
|
201
|
+
};
|
|
202
|
+
export type PopupTriggerEventType = {
|
|
203
|
+
onMouseEnter?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
204
|
+
onMouseLeave?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
205
|
+
onPointerEnter?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
206
|
+
onPointerLeave?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
207
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
208
|
+
};
|
|
209
|
+
export type BaseStateType = {
|
|
210
|
+
id: string;
|
|
211
|
+
props: Record<string, any>;
|
|
212
|
+
onEdgesChangeHandlers: OnEdgesChange<any>[];
|
|
213
|
+
isNodeDragging: boolean;
|
|
214
|
+
forceRenderTimes: number;
|
|
215
|
+
initialNodeIdSet: Set<string>;
|
|
216
|
+
nodeTypeMap: Map<string, INodeDefinition>;
|
|
217
|
+
smartEdges: Record<string, boolean>;
|
|
218
|
+
edgeStore: Record<string, any>;
|
|
219
|
+
};
|
|
220
|
+
export type ExtractState<S> = S extends {
|
|
221
|
+
getState: () => infer T;
|
|
222
|
+
} ? T : never;
|
|
223
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAC9H,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAC,sBAAsB,EAAC,MAAM,2BAA2B,CAAC;AAEjE,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAC9F,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG;IAC3C,cAAc,CAAC,EAAE,CAAC,IAAI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E,MAAM,CAAC;IACzB,gBAAgB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC1C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC,CAAA;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS;IACtC,QAAQ,EAAE,MAAM,MAAM,CAAC,CAAC;CACzB,GAAG,CAAC,GAAG,KAAK,CAAC"}
|
package/esm/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseThemeConfig, NodeTypeComponent } from "../types";
|
|
2
|
+
import { InternalNode, Node } from '@xyflow/react';
|
|
3
|
+
import { NodeLookup } from "@xyflow/system";
|
|
4
|
+
/**
|
|
5
|
+
* 计算节点的宽度
|
|
6
|
+
* @param node
|
|
7
|
+
* @param nodeTypes
|
|
8
|
+
* @param theme
|
|
9
|
+
* @param nodeLookup
|
|
10
|
+
*/
|
|
11
|
+
export declare function getNodeWidth(node: Node, nodeTypes?: Record<string, NodeTypeComponent>, theme?: BaseThemeConfig, nodeLookup?: NodeLookup<InternalNode>): number;
|
|
12
|
+
/**
|
|
13
|
+
* 计算节点的高度
|
|
14
|
+
* @param node
|
|
15
|
+
* @param nodeTypes
|
|
16
|
+
* @param theme
|
|
17
|
+
* @param nodeLookup
|
|
18
|
+
*/
|
|
19
|
+
export declare function getNodeHeight(node: Node, nodeTypes?: Record<string, NodeTypeComponent>, theme?: BaseThemeConfig, nodeLookup?: NodeLookup<InternalNode>): number;
|
|
20
|
+
//# sourceMappingURL=dimension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dimension.d.ts","sourceRoot":"","sources":["dimension.ts"],"names":[],"mappings":"AAQA,OAAO,EAAe,eAAe,EAAE,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAC,YAAY,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAG1C;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,IAAI,EACV,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAC7C,KAAK,CAAC,EAAE,eAAe,EACvB,UAAU,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,UAkCtC;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,EACV,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAC7C,KAAK,CAAC,EAAE,eAAe,EACvB,UAAU,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,UAkCtC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @author: yanxianliang
|
|
3
|
+
* @date: 2025-05-17 22:24
|
|
4
|
+
* @desc: dimension 计算 utils
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 计算节点的宽度
|
|
11
|
+
* @param node
|
|
12
|
+
* @param nodeTypes
|
|
13
|
+
* @param theme
|
|
14
|
+
* @param nodeLookup
|
|
15
|
+
*/
|
|
16
|
+
export function getNodeWidth(node, nodeTypes, theme, nodeLookup) {
|
|
17
|
+
// 优先级,lookup > node measured 配置>size>calc
|
|
18
|
+
if (nodeLookup && nodeLookup.has(node.id)) {
|
|
19
|
+
var _lookup$measured;
|
|
20
|
+
var lookup = nodeLookup.get(node.id);
|
|
21
|
+
if (typeof (lookup === null || lookup === void 0 || (_lookup$measured = lookup.measured) === null || _lookup$measured === void 0 ? void 0 : _lookup$measured.width) === 'number') {
|
|
22
|
+
var _lookup$measured2;
|
|
23
|
+
return lookup === null || lookup === void 0 || (_lookup$measured2 = lookup.measured) === null || _lookup$measured2 === void 0 ? void 0 : _lookup$measured2.width; // 实际的高度
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
var type = node.type,
|
|
27
|
+
measured = node.measured,
|
|
28
|
+
width = node.width;
|
|
29
|
+
if (typeof (measured === null || measured === void 0 ? void 0 : measured.width) === 'number') {
|
|
30
|
+
return measured.width;
|
|
31
|
+
}
|
|
32
|
+
if (typeof width === 'number') {
|
|
33
|
+
return width;
|
|
34
|
+
}
|
|
35
|
+
if (!type || !(nodeTypes !== null && nodeTypes !== void 0 && nodeTypes[type]) || !(nodeTypes !== null && nodeTypes !== void 0 && nodeTypes[type].defaultSize)) {
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
var ctr = nodeTypes[type];
|
|
39
|
+
var defaults = ctr.defaultSize;
|
|
40
|
+
if (defaults.width) {
|
|
41
|
+
if (typeof defaults.width === 'number') {
|
|
42
|
+
return defaults.width;
|
|
43
|
+
}
|
|
44
|
+
return defaults.width(node, theme);
|
|
45
|
+
} else {
|
|
46
|
+
return 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 计算节点的高度
|
|
52
|
+
* @param node
|
|
53
|
+
* @param nodeTypes
|
|
54
|
+
* @param theme
|
|
55
|
+
* @param nodeLookup
|
|
56
|
+
*/
|
|
57
|
+
export function getNodeHeight(node, nodeTypes, theme, nodeLookup) {
|
|
58
|
+
// 优先级,lookup > node measured 配置>size>calc
|
|
59
|
+
if (nodeLookup && nodeLookup.has(node.id)) {
|
|
60
|
+
var _lookup$measured3;
|
|
61
|
+
var lookup = nodeLookup.get(node.id);
|
|
62
|
+
if (typeof (lookup === null || lookup === void 0 || (_lookup$measured3 = lookup.measured) === null || _lookup$measured3 === void 0 ? void 0 : _lookup$measured3.height) === 'number') {
|
|
63
|
+
var _lookup$measured4;
|
|
64
|
+
return lookup === null || lookup === void 0 || (_lookup$measured4 = lookup.measured) === null || _lookup$measured4 === void 0 ? void 0 : _lookup$measured4.height; // 实际的高度
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
var type = node.type,
|
|
68
|
+
measured = node.measured,
|
|
69
|
+
height = node.height;
|
|
70
|
+
if (typeof (measured === null || measured === void 0 ? void 0 : measured.height) === 'number') {
|
|
71
|
+
return measured.height;
|
|
72
|
+
}
|
|
73
|
+
if (typeof height === 'number') {
|
|
74
|
+
return height;
|
|
75
|
+
}
|
|
76
|
+
if (!type || !(nodeTypes !== null && nodeTypes !== void 0 && nodeTypes[type]) || !(nodeTypes !== null && nodeTypes !== void 0 && nodeTypes[type].defaultSize)) {
|
|
77
|
+
return 1;
|
|
78
|
+
}
|
|
79
|
+
var ctr = nodeTypes[type];
|
|
80
|
+
var defaults = ctr === null || ctr === void 0 ? void 0 : ctr.defaultSize;
|
|
81
|
+
if (defaults.height) {
|
|
82
|
+
if (typeof defaults.height === 'number') {
|
|
83
|
+
return defaults.height;
|
|
84
|
+
}
|
|
85
|
+
return defaults.height(node, theme);
|
|
86
|
+
} else {
|
|
87
|
+
return 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author: yanxianliang
|
|
3
|
+
* @date: 2025-09-10 15:28
|
|
4
|
+
* @modified:2025/9/10 15:28 by yanxianliang
|
|
5
|
+
* @desc: popupContainer 处理
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getPopupContainer: () => HTMLElement;
|
|
10
|
+
//# sourceMappingURL=getPopupContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPopupContainer.d.ts","sourceRoot":"","sources":["getPopupContainer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,iBAAiB,mBAE7B,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author: yanxianliang
|
|
3
|
+
* @date: 2025-09-10 15:28
|
|
4
|
+
* @modified:2025/9/10 15:28 by yanxianliang
|
|
5
|
+
* @desc: popupContainer 处理
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export var getPopupContainer = function getPopupContainer() {
|
|
11
|
+
return document.fullscreenElement || document.body;
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseThemeConfig } from "../types";
|
|
2
|
+
export declare const getThemeWithDefaultValue: <ThemeConfig extends BaseThemeConfig>(theme?: ThemeConfig) => {
|
|
3
|
+
fontSize: number;
|
|
4
|
+
fontFamily: string;
|
|
5
|
+
primaryColor: string;
|
|
6
|
+
collapseButtonShape?: "rect" | "circle" | undefined;
|
|
7
|
+
autoHideCountWhenExpanded?: boolean | undefined;
|
|
8
|
+
showCount?: boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=getThemeWithDefaultValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getThemeWithDefaultValue.d.ts","sourceRoot":"","sources":["getThemeWithDefaultValue.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAEzC,eAAO,MAAM,wBAAwB,gDAAiD,WAAW;;;;;;;CAOhG,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
/*
|
|
8
|
+
* @author: yanxianliang
|
|
9
|
+
* @date: 2025-05-17 16:12
|
|
10
|
+
* @desc: 默认主题获取函数
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export var getThemeWithDefaultValue = function getThemeWithDefaultValue(theme) {
|
|
16
|
+
var _theme$fontSize, _theme$fontFamily, _theme$primaryColor;
|
|
17
|
+
return _objectSpread(_objectSpread({}, theme), {}, {
|
|
18
|
+
fontSize: (_theme$fontSize = theme === null || theme === void 0 ? void 0 : theme.fontSize) !== null && _theme$fontSize !== void 0 ? _theme$fontSize : 14,
|
|
19
|
+
fontFamily: (_theme$fontFamily = theme === null || theme === void 0 ? void 0 : theme.fontFamily) !== null && _theme$fontFamily !== void 0 ? _theme$fontFamily : 'Arial, helvetica, sans-serif',
|
|
20
|
+
primaryColor: (_theme$primaryColor = theme === null || theme === void 0 ? void 0 : theme.primaryColor) !== null && _theme$primaryColor !== void 0 ? _theme$primaryColor : '#5F95FF'
|
|
21
|
+
});
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author: yanxianliang
|
|
3
|
+
* @date: 2025-07-08 10:22
|
|
4
|
+
* @desc: 有dimensions change事件
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
7
|
+
*/
|
|
8
|
+
import { NodeChange, Node } from "@xyflow/react";
|
|
9
|
+
export declare const hasDimensionsChange: <NodeType extends Node>(changes: NodeChange<NodeType>[]) => boolean;
|
|
10
|
+
//# sourceMappingURL=hasDimensionsChange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasDimensionsChange.d.ts","sourceRoot":"","sources":["hasDimensionsChange.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,eAAe,CAAC;AAE/C,eAAO,MAAM,mBAAmB,mCAAoC,WAAW,QAAQ,CAAC,EAAE,YAOzF,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
3
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
4
|
+
/**
|
|
5
|
+
* @author: yanxianliang
|
|
6
|
+
* @date: 2025-07-08 10:22
|
|
7
|
+
* @desc: 有dimensions change事件
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2025 by yanxianliang, All Rights Reserved.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export var hasDimensionsChange = function hasDimensionsChange(changes) {
|
|
13
|
+
var _iterator = _createForOfIteratorHelper(changes),
|
|
14
|
+
_step;
|
|
15
|
+
try {
|
|
16
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
17
|
+
var change = _step.value;
|
|
18
|
+
if (change.type === 'dimensions') {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
} catch (err) {
|
|
23
|
+
_iterator.e(err);
|
|
24
|
+
} finally {
|
|
25
|
+
_iterator.f();
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
};
|