bpmn-js-properties-panel
bpmn-js-properties-panel copied to clipboard
test: verify properties panel works in read-only mode
Context: https://github.com/camunda/web-modeler/issues/7623.
What is left is three issues:
- Custom styling (marking fields as disabled)
- Disabling form element focus (may need to be solved in properties panel)
- Hiding (+) buttons
For the readonly properties panel case I could imagine to build dedicated support into the core:
const modelerWithReadonlyPropertiesPanel = new BpmnModeler({
propertiesPanel: {
readonly: true
}
});
This would do the following:
- mark inputs and checkboxes as readonly
- do not show add markers for sections
...and would in the process solve the issue of editing and focus on the HTML level.
@nithinssabu the results of our exploration.
Try it out via
git clone [email protected]:bpmn-io/bpmn-js-properties-panel.git
cd bpmn-js-properties-panel
npm install
npm run dev
@nikku If I try to dynamically attach the properties panel like this,
const propertiesPanel = modeler.get('propertiesPanel');
propertiesPanel.attachTo(propertiesContainer);
getting the following error,
Can you please have a look? I spent quite some time on it.
@nithinssabu We touched upon that issue yesterday already. It can also be reproduced in this test case. We currently rely on a "modeling ammended" $model
to verify if IDs are valid: https://github.com/bpmn-io/bpmn-js-properties-panel/blob/14597b8ad83fce849da70bbece3f3b0d0c4c762f/src/provider/bpmn/utils/ValidationUtil.js#L18.
The ids
are wired here and we want to mock them for the read-only panel.
@nithinssabu For context, please share the web modeler issue you're currently working on.
We already have styles for disabled="true"
inputs, we're just not setting that attribute which we could based on the configuration.
For context, please share the web modeler issue you're currently working on.
https://github.com/camunda/web-modeler/issues/7623
@nikku Can I get permission to push changes to this branch?
For my use case, I also need to get linting to work in the read-only mode. Currently getting the following error:
Error: No provider for "elementTemplates"! (Resolving: elementTemplates -> elementTemplates -> elementTemplates)
at error (index.esm.js:136:1)
at Object.get (index.esm.js:122:1)
at NavigatedViewer.get (index.esm.js:176:1)
at createModeler (BpmnPropertiesPanelRenderer.readonly.spec.js:142:35)
at async Context.eval (BpmnPropertiesPanelRenderer.readonly.spec.js:177:20)
I pushed a commit reproducing this in the current test case. Can you please help me workaround this problem?
Currently getting the following error:
I managed to get it to work by providing the CloudElementTemplatesPropertiesProviderModule
https://github.com/bpmn-io/bpmn-js-properties-panel/pull/1013/commits/341d403372d287bd8a0db913532950d0024f636f ✅
What is left is three issues:
- Custom styling (marking fields as disabled)
- Disabling form element focus (may need to be solved in properties panel)
- Hiding (+) buttons
I was able to solve these using CSS and for the keyboard focus, using Javascript to set the readonly
attribute on the input elements. Also, used MutationObserver
to set this when the panel is re-drawn. https://github.com/bpmn-io/bpmn-js-properties-panel/pull/1013/commits/d8563b99ddb6ca0fc97880b2a8683b1336525815
https://github.com/bpmn-io/bpmn-js-properties-panel/assets/5987816/bbbf57f8-725f-4cfe-9d52-72e8a76e8a6b
@philippfromme I used readonly
attribute instead of disabled
because with disabled
, it was not possible to tab through the elements. The user may want to focus the inputs and may be copy the value?
Web modeler shipped without core support. Moving to backlog
to track future improvement options.