- 收敛 easyflow-ui-admin 的 lint、格式和类型问题 - 修正 demo 页面与管理端前端构建失败点 - 验证 pnpm lint 与 pnpm build 均已通过
27 lines
709 B
TypeScript
27 lines
709 B
TypeScript
import { getContext } from 'svelte';
|
|
import { useNodesData, useSvelteFlow } from '@xyflow/svelte';
|
|
import type { TinyflowOptions } from '#types';
|
|
|
|
export const getCurrentNodeId = () => {
|
|
return getContext<string>('svelteflow__node_id');
|
|
};
|
|
|
|
export const getOptions = () => {
|
|
return getContext<TinyflowOptions>('tinyflow_options');
|
|
};
|
|
|
|
export const useCurrentNodeData = () => {
|
|
const currentNodeId = getCurrentNodeId();
|
|
return useNodesData<any>(currentNodeId);
|
|
};
|
|
|
|
export const useUpdateNodeData = () => {
|
|
const { updateNodeData } = useSvelteFlow();
|
|
const currentNodeId = getCurrentNodeId();
|
|
return {
|
|
updateNodeData: (data: any) => {
|
|
updateNodeData(currentNodeId, data);
|
|
},
|
|
};
|
|
};
|