mirror of
https://github.com/sartography/bpmn-js-spiffworkflow.git
synced 2025-02-23 13:08:11 +00:00
43 lines
930 B
JavaScript
43 lines
930 B
JavaScript
|
import { TextFieldEntry, isTextFieldEntryEdited } from '@bpmn-io/properties-panel';
|
||
|
import { useService } from 'bpmn-js-properties-panel';
|
||
|
|
||
|
export default function(element) {
|
||
|
|
||
|
return [
|
||
|
{
|
||
|
id: 'spell',
|
||
|
element,
|
||
|
component: Spell,
|
||
|
isEdited: isTextFieldEntryEdited
|
||
|
}
|
||
|
];
|
||
|
}
|
||
|
|
||
|
function Spell(props) {
|
||
|
const { element, id } = props;
|
||
|
|
||
|
const modeling = useService('modeling');
|
||
|
const translate = useService('translate');
|
||
|
const debounce = useService('debounceInput');
|
||
|
|
||
|
const getValue = () => {
|
||
|
return element.businessObject.spell || '';
|
||
|
};
|
||
|
|
||
|
const setValue = value => {
|
||
|
return modeling.updateProperties(element, {
|
||
|
spell: value
|
||
|
});
|
||
|
};
|
||
|
|
||
|
return <TextFieldEntry
|
||
|
id={ id }
|
||
|
element={ element }
|
||
|
description={ translate('Apply a black magic spell') }
|
||
|
label={ translate('Spell') }
|
||
|
getValue={ getValue }
|
||
|
setValue={ setValue }
|
||
|
debounce={ debounce }
|
||
|
/>
|
||
|
}
|