Skip to content

Commit

Permalink
feat: support placeholders on String and Text properties
Browse files Browse the repository at this point in the history
Closes #92

deps: update to `@bpmn-io/properties-panel@3.19.0`

deps: update to `@bpmn-io/element-templates-validator@2.1.0`
  • Loading branch information
barmac committed May 29, 2024
1 parent dfc3a83 commit 7f43875
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 32 deletions.
60 changes: 30 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
],
"license": "MIT",
"dependencies": {
"@bpmn-io/element-templates-validator": "^2.0.1",
"@bpmn-io/element-templates-validator": "^2.1.0",
"@bpmn-io/extract-process-variables": "^0.8.0",
"bpmnlint": "^10.0.0",
"classnames": "^2.3.1",
Expand All @@ -77,7 +77,7 @@
"@babel/plugin-transform-react-jsx": "^7.23.4",
"@bpmn-io/element-template-chooser": "^1.0.0",
"@bpmn-io/element-template-icon-renderer": "^0.5.2",
"@bpmn-io/properties-panel": "^3.18.2",
"@bpmn-io/properties-panel": "^3.19.0",
"@bpmn-io/variable-resolver": "^1.2.2",
"@camunda/linting": "^3.12.0",
"@rollup/plugin-alias": "^5.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function FeelProperty(props) {
editable,
label,
feel,
placeholder,
tooltip
} = property;

Expand All @@ -35,6 +36,7 @@ export function FeelProperty(props) {
id,
label,
feel,
placeholder,
description: PropertyDescription({ description }),
setValue: propertySetter(bpmnFactory, commandStack, element, property),
validate: propertyValidator(translate, property),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function FeelTextAreaProperty(props) {
editable,
label,
feel,
placeholder,
tooltip
} = property;

Expand All @@ -38,6 +39,7 @@ export function FeelTextAreaProperty(props) {
id,
label,
feel,
placeholder,
description: PropertyDescription({ description }),
setValue: propertySetter(bpmnFactory, commandStack, element, property),
validate: propertyValidator(translate, property),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function StringProperty(props) {
editable,
label,
feel,
placeholder,
tooltip
} = property;

Expand All @@ -31,6 +32,7 @@ export function StringProperty(props) {
id,
label,
feel,
placeholder,
description: PropertyDescription({ description }),
setValue: propertySetter(bpmnFactory, commandStack, element, property),
validate: propertyValidator(translate, property),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function TextAreaProperty(props) {
label,
feel,
language,
placeholder,
tooltip
} = property;

Expand All @@ -35,6 +36,7 @@ export function TextAreaProperty(props) {
id,
label,
feel,
placeholder,
monospace: !!language,
autoResize: true,
description: PropertyDescription({ description }),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" id="Definitions_00cqa19" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.23.0">
<bpmn:process id="Process_1" isExecutable="true">
<bpmn:task id="Task_1" name="Placeholder" zeebe:modelerTemplate="placeholder" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="Task_1_di" bpmnElement="Task_1">
<dc:Bounds x="160" y="80" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[
{
"$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json",
"name": "Placeholder",
"id": "placeholder",
"appliesTo": [
"bpmn:Task"
],
"properties": [
{
"binding": {
"type": "zeebe:input",
"name": "input-1-target"
},
"placeholder": "Placeholder"
},
{
"type": "Text",
"binding": {
"type": "zeebe:input",
"name": "input-2-target"
},
"placeholder": "Placeholder"
},
{
"type": "String",
"feel": "required",
"binding": {
"type": "zeebe:input",
"name": "input-1-target"
},
"placeholder": "Placeholder"
},
{
"type": "Text",
"feel": "required",
"binding": {
"type": "zeebe:input",
"name": "input-1-target"
},
"placeholder": "Placeholder"
}
]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ import groupsElementTemplates from './CustomProperties.groups.json';
import textLanguageDiagramXML from './CustomProperties.text-language.bpmn';
import textLanguageElementTemplates from './CustomProperties.text-language.json';

import placeholderDiagramXML from './CustomProperties.placeholder.bpmn';
import placeholderElementTemplates from './CustomProperties.placeholder.json';


describe('provider/cloud-element-templates - CustomProperties', function() {

Expand Down Expand Up @@ -2153,6 +2156,80 @@ describe('provider/cloud-element-templates - CustomProperties', function() {

});


describe('placeholder', function() {

beforeEach(bootstrapPropertiesPanel(placeholderDiagramXML, {
container,
debounceInput: false,
elementTemplates: placeholderElementTemplates,
moddleExtensions: {
zeebe: zeebeModdlePackage
},
modules: [
BpmnPropertiesPanel,
coreModule,
elementTemplatesModule,
modelingModule
]
}));


it('should display placeholder (String)', async function() {

// given
await expectSelected('Task_1');

// when
const entry = findEntry('custom-entry-placeholder-0', container),
input = findInput('text', entry);

// then
expect(input.placeholder).to.eql('Placeholder');
});


it('should display placeholder (Text)', async function() {

// given
await expectSelected('Task_1');

// when
const entry = findEntry('custom-entry-placeholder-1', container),
input = findTextarea(entry);

// then
expect(input.placeholder).to.eql('Placeholder');
});


it('should display placeholder (FEEL, String)', async function() {

// given
await expectSelected('Task_1');

// when
const entry = findEntry('custom-entry-placeholder-2', container),
input = domQuery('.bio-properties-panel-input', entry);

// then
expect(input.textContent).to.eql('Placeholder');
});


it('should display placeholder (FEEL, Text)', async function() {

// given
await expectSelected('Task_1');

// when
const entry = findEntry('custom-entry-placeholder-3', container),
input = domQuery('.bio-properties-panel-input', entry);

// then
expect(input.textContent).to.eql('Placeholder');
});
});
});


Expand Down

0 comments on commit 7f43875

Please sign in to comment.