Skip to content

Commit

Permalink
Merge pull request #5 from MoeOtaLab/feature/operator-v2
Browse files Browse the repository at this point in the history
Feature/operator v2
  • Loading branch information
everbrez committed Jan 13, 2024
2 parents 9ada3ba + e0d1391 commit 70944b2
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.port-type-container {
border-radius: 6px;
padding: 4px 8px 4px 0px;
padding: 4px 0px 4px 0px;

background-color: var(--color-bg);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function NodePorts(props: { node: Partial<Node<IMetaOperatorData>> }) {
});
}}
>
add port
add
</span>
)}
</div>
Expand Down
16 changes: 8 additions & 8 deletions packages/flow/src/Diagrams/Operators/InputOperator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export class InputOperator
hint: 'state',
},
children: [
new EndPoint({
type: 'source',
hint: 'state',
}),
// new EndPoint({
// type: 'source',
// hint: 'state',
// }),
],
}),
new EndPoint({
Expand All @@ -54,10 +54,10 @@ export class InputOperator
hint: 'event',
},
children: [
new EndPoint({
type: 'source',
hint: 'event',
}),
// new EndPoint({
// type: 'source',
// hint: 'event',
// }),
],
}),
new EndPoint({
Expand Down
21 changes: 9 additions & 12 deletions packages/flow/src/Diagrams/Operators/OutputOperator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ export class OutputOperator
});
}

create(
data?: Partial<IOutputOperatorData> | undefined,
defaultProps?: Partial<Node<IOutputOperatorData>> | undefined,
): Node<IOutputOperatorData> {
create(): Node<IOutputOperatorData> {
return super.create({
endPointOptions: {
endPointList: [
Expand All @@ -36,10 +33,10 @@ export class OutputOperator
hint: 'state',
},
children: [
new EndPoint({
type: 'target',
hint: 'state',
}),
// new EndPoint({
// type: 'target',
// hint: 'state',
// }),
],
}),

Expand All @@ -53,10 +50,10 @@ export class OutputOperator
hint: 'event',
},
children: [
new EndPoint({
type: 'target',
hint: 'event',
}),
// new EndPoint({
// type: 'target',
// hint: 'event',
// }),
],
}),
],
Expand Down
2 changes: 1 addition & 1 deletion packages/flow/src/Diagrams/Panels/ConsolePanel/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const Demo: React.FC = () => {
{outputValueIds?.map(({ port }) => {
return (
<div key={port.id}>
<Form.Item label={port.label}>
<Form.Item label={port.label || port.variableName}>
{JSON.stringify(
instance?.output?.[port.variableName || '']?.current,
)}
Expand Down
14 changes: 9 additions & 5 deletions packages/flow/src/Diagrams/Panels/LayerPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import classnames from 'classnames';
import { useDiagramsContext } from '../../State/DiagramsProvider';
import { Button, Input, Modal } from 'antd';
import { type Layer } from '../../State/Layer';
import { CustomOperator } from '../../Operators/CustomOperator';
import { getOperatorFromOperatorType } from '../../Operators';
import css from './LayerPanel.module.less';

export function LayerPanel() {
Expand Down Expand Up @@ -63,12 +63,16 @@ export function LayerPanel() {
),
onOk() {
if (name) {
const newNode = new CustomOperator({
data: { operatorName: name },
});
const customOperator =
getOperatorFromOperatorType('CustomOperator');
if (!customOperator) {
return;
}

const newNode = customOperator?.create();

// add nodes
CustomOperator.onAfterCreate({
customOperator.onAfterCreate({
node: newNode,
currentState: {
layer,
Expand Down
2 changes: 1 addition & 1 deletion packages/flow/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ESNext"
],
"allowJs": false,
"skipLibCheck": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
Expand Down

0 comments on commit 70944b2

Please sign in to comment.