56 lines
1016 B
JavaScript
56 lines
1016 B
JavaScript
/**
|
|
@license
|
|
Copyright (c) 2024 trading_peter
|
|
This program is available under Apache License Version 2.0
|
|
*/
|
|
|
|
import { html, css } from 'lit';
|
|
import { TpFlowNode } from './tp-flow-node';
|
|
|
|
class DemoNode extends TpFlowNode {
|
|
static get styles() {
|
|
return [
|
|
...super.styles,
|
|
css`
|
|
:host {
|
|
display: block;
|
|
}
|
|
`
|
|
];
|
|
}
|
|
|
|
renderNodeContent() {
|
|
return html`
|
|
<select @change="${this._handleOperationChange}">
|
|
<option value="add">Add</option>
|
|
<option value="subtract">Subtract</option>
|
|
</select>
|
|
`;
|
|
}
|
|
|
|
static get properties() {
|
|
return { };
|
|
}
|
|
|
|
constructor() {
|
|
super();
|
|
|
|
this.flowNodeType = 'MathNode';
|
|
this.inputs = [
|
|
{ name: 'value1' },
|
|
{ name: 'value2' }
|
|
];
|
|
this.outputs = [
|
|
{ name: 'result' }
|
|
];
|
|
this.data = {
|
|
operation: 'add'
|
|
};
|
|
}
|
|
|
|
_handleOperationChange(e) {
|
|
this.data.operation = e.target.value;
|
|
}
|
|
}
|
|
|
|
window.customElements.define('demo-node', DemoNode); |