Skip to content

Commit

Permalink
✨ feat: type
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangchu committed Jan 3, 2025
1 parent 4938265 commit a109ebb
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 39 deletions.
79 changes: 40 additions & 39 deletions src/Background/demos/swim.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/**
* compact: true
*/
import { FlowView } from '@ant-design/pro-flow';
import { FlowView, SwimLaneProps, SwimlaneBackground } from '@ant-design/pro-flow';
import { createStyles } from 'antd-style';
import { memo } from 'react';
import SwimlaneBackground from '../components/SwimBg';

const useStyles = createStyles(({ css }) => ({
container: css`
Expand All @@ -20,44 +19,46 @@ const BackgroundDemo = memo(() => {
<div className={styles.container}>
<FlowView nodes={[]} edges={[]} miniMap={false} background={false}>
<SwimlaneBackground
lanes={[
{
id: '1',
label: 'Swimlane 1',
labelColor: '#FECCCB',
},
{
id: '2',
label: 'Swimlane 2',
labelColor: '#FDCDE6',
},
{
id: '3',
label: 'Swimlane 3',
labelColor: '#CEFFE7',
},
{
id: '4',
lanes={
[
{
id: '1',
label: 'Swimlane 1',
labelColor: '#FECCCB',
},
{
id: '2',
label: 'Swimlane 2',
labelColor: '#FDCDE6',
},
{
id: '3',
label: 'Swimlane 3',
labelColor: '#CEFFE7',
},
{
id: '4',

label: 'Swimlane 4',
labelColor: '#CDFECE',
},
{
id: '5',
label: 'Swimlane 5',
labelColor: '#E7FFCC',
},
{
id: '6',
label: 'Swimlane 6',
labelColor: '#CEFFE7',
},
{
id: '7',
label: 'Swimlane 7',
labelColor: '#CBE5FF',
},
]}
label: 'Swimlane 4',
labelColor: '#CDFECE',
},
{
id: '5',
label: 'Swimlane 5',
labelColor: '#E7FFCC',
},
{
id: '6',
label: 'Swimlane 6',
labelColor: '#CEFFE7',
},
{
id: '7',
label: 'Swimlane 7',
labelColor: '#CBE5FF',
},
] as SwimLaneProps[]
}
></SwimlaneBackground>
</FlowView>
</div>
Expand Down
19 changes: 19 additions & 0 deletions src/Background/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,22 @@ description:
| lines | `string` | 线 | - | - |
| dots | `string` || - | - |
| cross | `string` | 十字 | - | - |

### Swim Background Props

| 属性名 | 类型 | 描述 | 默认值 | 必选 |
| --------- | --------------------- | -------- | ------ | ---- |
| lanes | `SwimLaneProps[]` | 泳道列表 | - | - |
| className | `string` | 类名 | - | - |
| style | `React.CSSProperties` | 样式 | - | - |

### Swim Lane Props

| 属性名 | 类型 | 描述 | 默认值 | 必选 |
| --------------- | --------------------- | ---------- | ------ | ---- |
| id | `string]` | id | - | - |
| label | `string` | 标签 | - | - |
| labelColor | `string` | 标签的背景 | - | - |
| backgroundColor | `string` | 泳道的背景 | - | - |
| width | `string` | 宽度 | - | - |
| style | `React.CSSProperties` | 样式 | - | - |
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export {
getStraightPath,
} from 'reactflow';
export { default as Background } from './Background';
export { default as SwimlaneBackground } from './Background/components/SwimBg';
export { default as BasicGroupNode } from './BasicGroupNode';
export { default as BasicNode } from './BasicNode';
export { default as CanvasLoading } from './CanvasLoading';
Expand Down Expand Up @@ -44,5 +45,6 @@ export type {
NodeChange,
NodeProps,
} from 'reactflow';
export type { SwimLaneProps, SwimlaneBackgroundProps } from './Background/components/SwimBg';
export type { FlowEditorStoreProviderProps } from './FlowStoreProvider';
export type { ExtraAction } from './NodeField';

0 comments on commit a109ebb

Please sign in to comment.