v0.5.2

bytedance/flowgram.aiv0.5.2Sep 30, 2025by xiamidaxia

AI Summary

This v0.5.2 release introduces significant improvements to both fixed and free layout editors, including drag-and-drop node support for fixed layouts and custom node sorting for free layouts. The release also enhances operation handling with diff-based JSON support for node/edge CRUD operations and adds custom stack index functionality.

Key Highlights

  • Fixed layout now supports drag and drop to add nodes
  • Free layout adds custom node sorting via sortNodes option
  • Operation.fromJSON now supports diff JSON for CRUD operations without screen flickering
  • Added custom stack index support for free layout
  • JSON-schema-editor onChange fix for setState callback issues

New Features

  • Fixed layout drag/drop nodes - users can now drag and drop nodes directly into the fixed layout
  • Free layout custom sort nodes - sortNodes callback allows organizing nodes by type (e.g., separating comment nodes)
  • Free layout diff loading - ctx.operation.fromJSON supports diff JSON loading that can be undone via undo/redo
  • Operation-fromJSON supports diff JSON - performs CRUD on nodes and edges using diff data
  • FreeLayoutPluginContext now includes WorkflowOperationService for operations
  • Custom stack index support - allows custom stack ordering in the stack plugin
  • Document/node form updates and API optimization for document creation

Full Release Notes

## What's Changed
* feat(material): optimize inputs-values-type by @sanmaopep in https://github.com/bytedance/flowgram.ai/pull/886
* fix(material): json-schema-editor onChange in setState callback by @sanmaopep in https://github.com/bytedance/flowgram.ai/pull/887
* feat(document): comment node form update & document create node api optimization by @louisyoungx in https://github.com/bytedance/flowgram.ai/pull/888
* feat(core): operation-fromJSON supports diff JSON to perform CRUD on nodes and edges by @louisyoungx in https://github.com/bytedance/flowgram.ai/pull/890
* feat(free-layout-editor): add operation(WorkflowOperationService) to FreeLayoutPluginContext by @xiamidaxia in https://github.com/bytedance/flowgram.ai/pull/891
* docs: auto layout plugin by @louisyoungx in https://github.com/bytedance/flowgram.ai/pull/894
* feat(stack): support custom stack index by @louisyoungx in https://github.com/bytedance/flowgram.ai/pull/892
* docs: free stack plugin by @louisyoungx in https://github.com/bytedance/flowgram.ai/pull/895
* feat: fixed layout supports drag and drop to add nodes by @dragooncjw in https://github.com/bytedance/flowgram.ai/pull/893

## Features
- Fixed layout drag/drop nodes
![20250930111313_rec_](https://github.com/user-attachments/assets/b76468ad-cf3e-43e7-800e-0b15ead61d42)

- Free layout custom sort nodes
```typescript
import { createFreeStackPlugin } from '@flowgram.ai/free-stack-plugin';

// set to your editorProps.plugins
createFreeStackPlugin({
  sortNodes: (nodes) => {
    const commentNodes: WorkflowNodeEntity[] = [];
    const otherNodes: WorkflowNodeEntity[] = [];
    nodes.forEach((node) => {
      if (node.flowNodeType === WorkflowNodeType.Comment) {
        commentNodes.push(node);
      } else {
        otherNodes.push(node);
      }
    });
    return [...commentNodes, ...otherNodes];
  },
})
```
- Free layout `ctx.operation.fromJSON`  supports diff loading data (without screen flickering) and can be undone via undo

**Full Changelog**: https://github.com/bytedance/flowgram.ai/compare/v0.5.1...v0.5.2