Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: verify properties panel works in read-only mode #1013

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

nikku
Copy link
Member

@nikku nikku commented Jan 10, 2024

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.

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
@bpmn-io-tasks bpmn-io-tasks bot added the in progress Currently worked on label Jan 10, 2024
@nikku
Copy link
Member Author

nikku commented Jan 10, 2024

@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

@nithinssabu
Copy link

@nikku If I try to dynamically attach the properties panel like this,

const propertiesPanel = modeler.get('propertiesPanel');
propertiesPanel.attachTo(propertiesContainer);

getting the following error,
image

Can you please have a look? I spent quite some time on it.

@nikku
Copy link
Member Author

nikku commented Jan 11, 2024

@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:

export function isIdValid(element, idValue, translate) {
.

The ids are wired here and we want to mock them for the read-only panel.

@nikku
Copy link
Member Author

nikku commented Jan 15, 2024

@nithinssabu For context, please share the web modeler issue you're currently working on.

@philippfromme
Copy link
Contributor

We already have styles for disabled="true" inputs, we're just not setting that attribute which we could based on the configuration.

@nithinssabu
Copy link

For context, please share the web modeler issue you're currently working on.

https://github.com/camunda/web-modeler/issues/7623

@nithinssabu
Copy link

@nikku Can I get permission to push changes to this branch?

@nithinssabu
Copy link

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?

@nithinssabu
Copy link

Currently getting the following error:

I managed to get it to work by providing the CloudElementTemplatesPropertiesProviderModule 341d403

@nithinssabu
Copy link

nithinssabu commented Jan 15, 2024

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. d8563b9

Screen.Recording.2024-01-15.at.18.50.47.mov

@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?

@nikku nikku added the ready Ready to be worked on label Mar 5, 2024 — with bpmn-io-tasks
@nikku nikku removed the in progress Currently worked on label Mar 5, 2024
@nikku nikku added the backlog Queued in backlog label Mar 14, 2024 — with bpmn-io-tasks
@nikku nikku removed the ready Ready to be worked on label Mar 14, 2024
@nikku
Copy link
Member Author

nikku commented Mar 14, 2024

Web modeler shipped without core support. Moving to backlog to track future improvement options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Queued in backlog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants