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

Add Possibility to customize AppendMenuProvider #29

Closed
AmiciD opened this issue Apr 9, 2024 · 3 comments
Closed

Add Possibility to customize AppendMenuProvider #29

AmiciD opened this issue Apr 9, 2024 · 3 comments
Labels
enhancement New feature or request needs more information Requires additional information to be actionable.

Comments

@AmiciD
Copy link

AmiciD commented Apr 9, 2024

Is your feature request related to a problem? Please describe.

I have an implementation of bpmn-js version 11.1.0 with all compatible plugins for that version.

Upgrading to the new version, I found that the appendMenuProvider to modify the entries of the appendMenu is no longer exported and modifiable in this package.

Describe the solution you'd like

I would prefer an approach similar to the old one, where I could import the provider and modify its behavior.

Describe alternatives you've considered

A working workaround I found is this:

import { CreateAppendAnythingModule } from "bpmn-js-create-append-anything";

const AppendMenuProvider = CreateAppendAnythingModule.__depends__[0].appendMenuProvider[1];

Unfortunately, I haven't found anything regarding this new implementation of the appendMenuProvider; I just need to modify and filter the menu entries.

@AmiciD AmiciD added the enhancement New feature or request label Apr 9, 2024
@nikku
Copy link
Member

nikku commented Apr 16, 2024

Thanks for opening this issue. At this stage it is not easily possible to access the appendMenuProvider by sub-classing.

The general way to subclass is not to "modify providers" through sub-classing, but to provide your own customizing AppendMenuProvider:

const LOW_PRIORITY = 500;

function MyAppendMenuModifyingProvider(popupMenu, eventBus) {
  
  // register provider
  popupMenu.registerProvider('bpmn-append', this, LOW_PRIORITY);
  
  // own provider method returns middleware
  // (element) => (existingEntires) => newEntries
  
  this.getPopupMenuEntries = function(element) {
    
    return (existingEntries) => {
      // modify <existingEntries> as you wish, add, remove some
      
      return existingEntries;
    };
  };
}

Would this work for your case?

@nikku nikku added the needs more information Requires additional information to be actionable. label Apr 16, 2024
@nikku
Copy link
Member

nikku commented Apr 22, 2024

@AmiciD I'd be interested if #29 (comment) worked for you? I assume so and will close this issue as won't fix.

@nikku nikku closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
@AmiciD
Copy link
Author

AmiciD commented Apr 22, 2024

@nikku unfortunately i had no time to look for a custom implementation like the one suggested, i will try and give a feedback here asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs more information Requires additional information to be actionable.
Development

No branches or pull requests

2 participants