Hello,
I'm currently working on creating a Disclaimer widget. The goal is to make this widget easily reusable, allowing other widgets to toggle it on/off and change its description. Essentially, I want one Disclaimer widget to be linked to multiple other widgets.
To formalize this widget, I plan to export an interface and a `setting.tsx` file. However, I've run into an issue where I can't access the interface and `setting.tsx` file from other widgets.
Is there a way to make these Disclaimer files accessible in a manner similar to how we import libraries like `jimu-ui` or `jimu-core`?
Additionally, I'm curious about how to access the functions for showing or hiding the Disclaimer widget once it's linked.
I'd greatly appreciate any guidance or suggestions on how to achieve this or any other alternatives. Thank you!
Solved! Go to Solution.
Thank you for your response. I was able to resolve this issue by using the dispatch function and making some modifications to the client files to create reusable code.
If I understand your goals correctly, you want to trigger something like a modal to appear whenever certain widgets do certain things. I would set up my Disclaimer widget to be triggered by a message action in the widget that triggers it. This would require adding a line of code to the triggering widget similar to this: MutableStoreManager.getInstance().updateStateValue('idOfDisclamerWidget', 'messageName', message) So, that may not meet your reusability requirement, but the Disclaimer widget could be triggered to do multiple things based on the message received.
Thank you for your response. I was able to resolve this issue by using the dispatch function and making some modifications to the client files to create reusable code.