Skip to content

Commit

Permalink
Merge branch 'develop' into 'main'
Browse files Browse the repository at this point in the history
Develop

See merge request triones/npm-pkg/alkaid!3
  • Loading branch information
fengxiaotx committed Dec 9, 2023
2 parents a1e7447 + 10658b6 commit 220d616
Show file tree
Hide file tree
Showing 30 changed files with 610 additions and 231 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: github pages

on:
push:
branches:
- main # default branch
pull_request:
branches:
- main

jobs:
deploy:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- run: npm install
- run: npm run build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
# github_token: ${{ secrets.GITHUB_TOKEN }}
# 文档目录,如果是 react 模板需要修改为 docs-dist
publish_dir: ./examples/basic/build
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
.idea
*/node_modules/
*/node_modules/
.npmrc
1 change: 0 additions & 1 deletion examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.2-beta.0",
"private": true,
"dependencies": {
"@trionesdev/designable-core": "^0.0.2-beta.0",
"@craco/craco": "^7.1.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createDesigner, GlobalRegistry, KeyCode, Shortcut} from '@alkaid/core';
import {createDesigner, GlobalRegistry, KeyCode, Shortcut} from '@trionesdev/designable-core';
import {useEffect, useMemo} from 'react';
import './App.css';
import {
Expand All @@ -9,7 +9,7 @@ import {
StudioPanel, ToolbarPanel, ViewPanel,
ViewportPanel, ViewToolsWidget, Workspace,
WorkspacePanel
} from "@alkaid/react";
} from "@trionesdev/designable-react";
import {ArrayCards, ArrayTable, Field, Form, Input, NumberPicker, Password, Rate} from "@trionesdev/designable-formily-antd";
import {SettingsForm} from "@trionesdev/designable-react-settings-form";
import {transformToSchema} from "@trionesdev/designable-formily-transformer";
Expand Down
3 changes: 1 addition & 2 deletions examples/x6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.2-beta.0",
"private": true,
"dependencies": {
"@trionesdev/designable-core": "^0.0.2-beta.0",
"@ant-design/icons": "^5.2.5",
"@craco/craco": "^7.1.0",
"@testing-library/jest-dom": "^5.14.1",
Expand All @@ -27,7 +26,7 @@
"web-vitals": "^2.1.0"
},
"devDependencies": {
"@trionesdev/designable-core": "0.0.1-beta.2",
"@trionesdev/designable-core": "^0.0.2-beta.0",
"@trionesdev/designable-formily-antd": "^0.0.2-beta.0",
"@trionesdev/designable-formily-transformer": "^0.0.2-beta.0",
"@trionesdev/designable-react": "^0.0.2-beta.0",
Expand Down
96 changes: 91 additions & 5 deletions examples/x6/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {GlobalRegistry} from '@trionesdev/designable-core';
import {useEffect, useMemo} from 'react';
import './App.css';
import {FlinkSqlNode, FlowNode} from "./nodes";
import {BatchSyncNode, FlinkSqlNode, FlowNode} from "./nodes";
import {Cell, Graph} from "@antv/x6";
import {
ComponentsWidget, createFlowDesigner,
Expand All @@ -12,12 +12,34 @@ import {
ViewportPanel,
WorkspacePanel
} from "@trionesdev/designable-flow";
import {Button} from "antd";
import {FlinkSqlSelect} from "./components/FlinkSqlSelect";

function App() {
const engine = useMemo(
() =>
createFlowDesigner({
componentName:'FlowNode',
graphOptions:{
connecting: {
router: 'er',
snap: true,
allowBlank: false,
allowLoop: false,
highlight: true,
connector: {
name: 'normal',
},
connectionPoint: 'anchor',
anchor: 'center',
},
},
onDrop:(metadata, graph)=>{
graph.addNode(metadata)
},
onNodeDoubleClick:(node)=>{
console.log("node:doubleClick")
},
contextMenuService: (type, cell: Cell, graph: Graph) => {
let items = []
switch (type) {
Expand Down Expand Up @@ -50,27 +72,91 @@ function App() {
[]
)

const handleSave = () => {
console.log(engine.getGraphData())
}

const handleRender = () => {
engine.graphRender({nodes:[
{
"id": "5khhymwwcm0",
"x": 140,
"y": 83,
"shape": "FlinkSqlNode",
"label": "Flink Sql",
"icon": "TextAreaSource",
"props": {
"title": "Flink Sql"
},
"ports": [
{
"id": "dlou790rk0z",
"group": "left"
},
{
"id": "lhg4f0oikjo",
"group": "right"
}
]
},
{
"id": "6v1l4x94cax",
"x": 538,
"y": 93,
"shape": "FlinkSqlNode",
"label": "Flink Sql",
"icon": "TextAreaSource",
"props": {
"title": "Flink Sql"
},
"ports": [
{
"id": "dlou790rk0z",
"group": "left"
},
{
"id": "lhg4f0oikjo",
"group": "right"
}
]
}
],edges:[
{
"id": "0tn7qk3p1rj",
"source": {
"cell": "5khhymwwcm0",
"port": "lhg4f0oikjo"
},
"target": {
"cell": "6v1l4x94cax",
"port": "dlou790rk0z"
}
}
]})
}

useEffect(() => {
GlobalRegistry.setDesignerLanguage('zh-cn')

}, []);
return (
<>
<FlowDesigner engine={engine}>
<StudioPanel>
<StudioPanel actions={[<Button onClick={handleSave}>保存</Button>,<Button onClick={handleRender}>渲染</Button>]}>
<ResourcePanel>
<ResourceWidget title={`开发任务`} sources={[FlinkSqlNode]}></ResourceWidget>
<ResourceWidget title={`开发任务`} sources={[FlinkSqlNode,BatchSyncNode]}></ResourceWidget>
</ResourcePanel>
<WorkspacePanel>
<ViewportPanel>
{() => (<ComponentsWidget components={{
FlowNode,
FlinkSqlNode
FlinkSqlNode,
BatchSyncNode
}}/>)}
</ViewportPanel>
</WorkspacePanel>
<SettingsPanel title={`属性设置`}>
<SettingsForm></SettingsForm>
<SettingsForm components={{FlinkSqlSelect}}/>
</SettingsPanel>
</StudioPanel>
</FlowDesigner>
Expand Down
3 changes: 3 additions & 0 deletions examples/x6/src/components/FlinkSqlSelect.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const FlinkSqlSelect = () => {
return <>s</>
}
2 changes: 1 addition & 1 deletion examples/x6/src/nodes/BaseNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Space} from "antd";
import {connect} from "@formily/react";
import {Graph} from "@antv/x6";
import {FC} from "react";
import {IconWidget} from "@alkaid/flow";
import {IconWidget} from "@trionesdev/designable-flow";

type BaseNodeProps = {
data?: any,
Expand Down
82 changes: 82 additions & 0 deletions examples/x6/src/nodes/BatchSyncNode.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import {DnFC} from "@trionesdev/designable-react";
import React from "react";
import {BaseNode} from "./BaseNode";
import {createBehavior, createResource} from "@trionesdev/designable-core";
import {uid} from "@trionesdev/designable-shared";
import _ from "lodash";

export const BatchSyncNode: DnFC<React.ComponentProps<typeof BaseNode>> = _.cloneDeep(BaseNode)

BatchSyncNode.Behavior = createBehavior({
name: 'BatchSyncNode',
extends: ['FlowNode'],
selector: (node) => node.props?.['x-component'] === 'BatchSyncNode',
designerProps: {
propsSchema: {
type: 'object',
properties: {
'node-props-group': {
type: 'void',
'x-component': 'CollapseItem',
properties: {
'x-component-props': {
type: 'object',
properties: {
title: {
type: 'string',
'x-decorator': 'FormItem',
'x-component': 'Input',
}
}
}
}
}
},
},
defaultProps: {
"title": "离线同步"
},
graphNodeProps: {
type: 'BATCH_SYNC',
label: '离线同步任务',
icon: 'RadioGroupSource',
props: {
"title": "离线同步"
},
"ports": [
{
"id": uid(),
"group": "left"
},
{
"id": uid(),
"group": "right"
}
]
}
},
designerLocales: {
'zh-CN': {
"title": "离线同步",
"settings": {
"x-component-props": {
"title": "名称"
}
}
}
}
})

BatchSyncNode.Resource = createResource({
icon: 'RadioGroupSource',
"title": "离线同步任务",
elements: [
{
componentName: 'FlowNode',
props: {
type: 'object',
'x-component': 'BatchSyncNode',
},
},
],
})
28 changes: 17 additions & 11 deletions examples/x6/src/nodes/FlinkSqlNode.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {DnFC} from "@alkaid/react";
import {DnFC} from "@trionesdev/designable-react";
import {BaseNode} from "./BaseNode";
import {createBehavior, createResource} from "@alkaid/core";
import {createBehavior, createResource} from "@trionesdev/designable-core";
import React from "react";
import {uid} from "@alkaid/shared";
import {uid} from "@trionesdev/designable-shared";
import _ from "lodash";

export const FlinkSqlNode: DnFC<React.ComponentProps<typeof BaseNode>> = BaseNode
export const FlinkSqlNode: DnFC<React.ComponentProps<typeof BaseNode>> = _.cloneDeep(BaseNode)


FlinkSqlNode.Behavior = createBehavior({
Expand All @@ -26,6 +27,11 @@ FlinkSqlNode.Behavior = createBehavior({
type: 'string',
'x-decorator': 'FormItem',
'x-component': 'Input',
},
cron:{
type:'string',
'x-decorator': 'FormItem',
'x-component': 'FlinkSqlSelect',
}
}
}
Expand All @@ -37,12 +43,11 @@ FlinkSqlNode.Behavior = createBehavior({
"title": "Flink Sql"
},
graphNodeProps: {
data: {
label: 'Flink Sql',
icon: 'TextAreaSource',
props: {
"title": "Flink Sql"
}
label: 'Flink Sql',
icon: 'TextAreaSource',
type: 'FLINK_SQL',
props: {
"title": "Flink Sql"
},
"ports": [
{
Expand All @@ -61,7 +66,8 @@ FlinkSqlNode.Behavior = createBehavior({
"title": "Flink Sql",
"settings": {
"x-component-props": {
"title": "名称"
"title": "名称",
"cron":"调度"
}
}
}
Expand Down
Loading

0 comments on commit 220d616

Please sign in to comment.