Hello,
my Problem: if i write something in the Textfield from a Task, go to another Task and back to the first, all Words i just wrote are gone.
The textfield is a extension to the standard “general-group”.
I update my general group like this:
function updateGeneralGroup(groups, element) {
const generalGroup = findGroup(groups, 'general');
if (!generalGroup) {
return;
}
const { entries } = generalGroup;
//change the name of the group
generalGroup.label = 'Allgemeine Angaben';
// (1) add version tag before executable (if existing)
const executableEntry = findIndex(entries, (entry) => entry.id === 'isExecutable');
const insertIndex = executableEntry >= 0 ? executableEntry : entries.length;
if (!is(element,( 'bpmn:Process' ))) {
entries.splice(insertIndex, 0, ...AllgemeinstartProps({ element }));
}
if (is(element, 'bpmn:Process')) {
entries.splice(insertIndex, 0, ...AllgemeinProps({ element }));
}
const updatedEntries = entries.filter(entry => entry.id !== 'id' ); // remove id entry
entries.splice(0, entries.length, ...updatedEntries);
}
My AllgemeinPropsStart look like this:
import {
getBusinessObject,
is
} from 'bpmn-js/lib/util/ModelUtil';
import { TextFieldEntry, isTextFieldEntryEdited } from '@bpmn-io/properties-panel';
import { useService } from 'bpmn-js-properties-panel';
export default function AllgemeinPropsStart(props) {
const {
element
} = props;
const businessObject = getBusinessObject(element);
return [
{
id: 'Nr',
component: Nr,
isEdited: isTextFieldEntryEdited
},
{
id: 'Verantwortlichwe',
component: Verantwortlicher,
isEdited: isTextFieldEntryEdited
}
];
}
function Nr(props) {
const { element } = props;
const translate = useService('translate'),
debounce = useService('debounceInput'),
modeling = useService('modeling');
const getValue = () => {
return element.businessObject.Nr || '';
}
const setValue = value => {
return modeling.updateProperties(element, {
Nr: value
});
}
return TextFieldEntry({
element,
id: 'Nr',
label: translate('Nr'),
getValue,
setValue,
debounce:debounce
});
}
function Verantwortlicher(props) {
const { element } = props;
const translate = useService('translate'),
debounce = useService('debounceInput'),
modeling = useService('modeling');
const getValue = () => {
return element.businessObject.Verantwortlicher || '';
}
const setValue = value => {
return modeling.updateProperties(element, {
Verantwortlicher: value
});
}
return TextFieldEntry({
element,
id: 'Verantwortlicher',
label: translate('Verantwortlicher'),
description: translate('Name'),
getValue,
setValue,
debounce
});
}
I also have a “AllgemeinProps” because i need diffrent properties for the whole process and the task. So i use “AllgemeinProps” just for “Process” and “AllgemeinPropsStart” for the rest.
thxx for helping!