refactor: add options field for enum args
This commit is contained in:
1 parent
7994e9c515
commit
a6c1f51b5d
2 files changed
+12
-5
No files matched your search
@@ -1,10 +1,16 @@
|
|||||||
import { TreeGraphData } from "@antv/g6/lib/types";
|
import { TreeGraphData } from "@antv/g6/lib/types";
|
||||||
|
|
||||||
|
export interface ArgsOptional{
|
||||||
|
name:string;
|
||||||
|
value:string|number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ArgsDefType {
|
export interface ArgsDefType {
|
||||||
name: string;
|
name: string;
|
||||||
type: string;
|
type: string;
|
||||||
desc: string;
|
desc: string;
|
||||||
default: string;
|
default: string;
|
||||||
|
options: ArgsOptional[];
|
||||||
}
|
}
|
||||||
export interface BehaviorNodeTypeModel {
|
export interface BehaviorNodeTypeModel {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -213,12 +213,13 @@ export default class NodePanel extends React.Component<NodePanelProps> {
|
|||||||
return <Switch onChange={this.handleSubmit} />;
|
return <Switch onChange={this.handleSubmit} />;
|
||||||
} else if (e.type.indexOf("lua") >= 0) {
|
} else if (e.type.indexOf("lua") >= 0) {
|
||||||
return <Input onBlur={this.handleSubmit} placeholder={"公式"} />;
|
return <Input onBlur={this.handleSubmit} placeholder={"公式"} />;
|
||||||
} else if (e.type.indexOf("enum") >= 0) {
|
} else if (e.type.indexOf("enum") >= 0 ) {
|
||||||
const list = e.type.substring(e.type.indexOf("|")+1).split(',')
|
|
||||||
return <Select style={{ width: 120 }} onChange={this.handleSubmit} >
|
return <Select style={{ width: 120 }} onChange={this.handleSubmit} >
|
||||||
{list.map((e)=>{
|
{
|
||||||
return (<Option key={e} value={e}>{e}</Option>)
|
e.options.map((e)=>{
|
||||||
})}
|
return (<Option key={e.name} value={e.value}>{e.name}</Option>)
|
||||||
|
})
|
||||||
|
}
|
||||||
</Select>;
|
</Select>;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user