Skip to content

Commit 2ee9c72

Browse files
authored
Improve properties panel text area entries with isEdited prop (Condition Indicator) (#123)
* Improve properties panel text area entries with isEdited prop * Update user instructions group IDs in properties panel
1 parent bfe6275 commit 2ee9c72

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

app/spiffworkflow/conditions/propertiesPanel/ConditionsPropertiesProvider.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { is } from 'bpmn-js/lib/util/ModelUtil';
22
import {
3-
TextAreaEntry
3+
TextAreaEntry,
4+
isTextAreaEntryEdited
45
} from '@bpmn-io/properties-panel';
56
import { useService } from 'bpmn-js-properties-panel';
67

@@ -68,6 +69,7 @@ function conditionGroup(element, moddle, label, description, commandStack) {
6869
label,
6970
description,
7071
commandStack,
72+
isEdited: isTextAreaEntryEdited,
7173
},
7274
];
7375
}
@@ -76,14 +78,18 @@ function ConditionExpressionTextField(props) {
7678
const { element } = props;
7779
const { moddle } = props;
7880
const { label } = props;
81+
const { commandStack } = props;
7982

8083
const debounce = useService('debounceInput');
84+
8185
const getValue = () => {
8286
let conditionExpression;
8387
if (is(element, 'bpmn:SequenceFlow')) {
8488
conditionExpression = element.businessObject.conditionExpression;
8589
} else if (is(element, 'bpmn:Event')) {
86-
const eventDef = element.businessObject.eventDefinitions.find(ev => is(ev, 'bpmn:ConditionalEventDefinition'));
90+
const eventDef = element.businessObject.eventDefinitions.find((ev) =>
91+
is(ev, 'bpmn:ConditionalEventDefinition')
92+
);
8793
conditionExpression = eventDef.condition;
8894
}
8995
if (conditionExpression) {
@@ -99,16 +105,24 @@ function ConditionExpressionTextField(props) {
99105
}
100106
conditionExpressionModdleElement.body = value;
101107
if (is(element, 'bpmn:SequenceFlow')) {
102-
element.businessObject.conditionExpression = conditionExpressionModdleElement;
108+
element.businessObject.conditionExpression =
109+
conditionExpressionModdleElement;
103110
} else if (is(element, 'bpmn:Event')) {
104-
const eventDef = element.businessObject.eventDefinitions.find(ev => is(ev, 'bpmn:ConditionalEventDefinition'));
111+
const eventDef = element.businessObject.eventDefinitions.find((ev) =>
112+
is(ev, 'bpmn:ConditionalEventDefinition')
113+
);
105114
eventDef.condition = conditionExpressionModdleElement;
106115
}
116+
117+
commandStack.execute('element.updateModdleProperties', {
118+
element,
119+
moddleElement: conditionExpressionModdleElement,
120+
});
107121
};
108122

109123
return TextAreaEntry({
110124
element,
111-
id: `the-id`,
125+
id: 'condition_expression',
112126
label,
113127
getValue,
114128
setValue,

app/spiffworkflow/extensions/propertiesPanel/ExtensionsPropertiesProvider.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
ListGroup,
44
CheckboxEntry,
55
isCheckboxEntryEdited,
6+
isTextAreaEntryEdited
67
} from '@bpmn-io/properties-panel';
78
import { is, isAny } from 'bpmn-js/lib/util/ModelUtil';
89
import scriptGroup, { SCRIPT_TYPE } from './SpiffScriptGroup';
@@ -321,16 +322,18 @@ function createUserInstructionsGroup(element, translate, moddle, commandStack) {
321322
label: translate('Instructions'),
322323
entries: [
323324
{
325+
id: 'extension_spiffworkflow:InstructionsForEndUser',
324326
element,
325327
moddle,
326328
commandStack,
327329
component: SpiffExtensionTextArea,
328330
name: 'spiffworkflow:InstructionsForEndUser',
329331
label: 'Instructions',
330-
description:
331-
'Displayed above user forms or when this task is executing.',
332+
description: 'Displayed above user forms or when this task is executing.',
333+
isEdited: isTextAreaEntryEdited
332334
},
333335
{
336+
id: 'extension_spiffworkflow:InstructionsForEndUser',
334337
element,
335338
moddle,
336339
commandStack,

app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionTextArea.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export function SpiffExtensionTextArea(props) {
1212
moddle = props.moddle;
1313
const name = props.name,
1414
label = props.label,
15-
description = props.description;
15+
description = props.description,
16+
id = props.id;
1617
const debounce = useService('debounceInput');
1718

1819
const getValue = () => {
@@ -25,7 +26,7 @@ export function SpiffExtensionTextArea(props) {
2526

2627
return (
2728
<TextAreaEntry
28-
id={'extension_' + name}
29+
id={(id !== undefined) ? id : 'extension_' + name}
2930
element={element}
3031
description={description}
3132
label={label}

0 commit comments

Comments
 (0)