Duplicating the ExB Analysis widget (Developer Edition)

655
9
01-15-2024 03:00 PM
JoeRogan
New Contributor III

Hi, I am trying to make a copy of the Analysis widget that comes with v1.13 of Experience Builder Developer Edition. The workflow is as follows, and we have no issues making copies of the sample widget or the map widget using these steps.

  1. Make a copy of client\dist\widgets\arcgis\analysis to client\your-extensions\widgets
  2. Rename the new analysis folder under client\your-extensions\widgets to analysis-custom
  3. Modify client\your-extensions\widgets\analysis-custom\manifest.json so that the widget's name is analysis-custom
  4. npm start in the client folder

For other widgets after this step it will detect them and they will be available in the builder once that's started. However for the Analysis widget I'm getting 16 errors during the client's start, related to dependencies. Most of these dependencies seem to have names matching folders in this location: client\dist\arcgis-amd-packages, but not all of them.

The default Analysis widget that comes with ExB works fine, so the dependencies must be available somehow.

I've tried reaching out to Esri Canada support with this as a case but was turned away for an unsupported workflow, and they linked me to the guide on how to create a custom widget.  I'd rather not recreate the Analysis/GP widget from scratch.

0 Kudos
9 Replies
AlixVezina
Esri Regular Contributor

@JoeRogan just wanting to confirm you've followed these exact steps? 

1. copy the Analysis widget into the client>your-extensions>widgets folder

2. rename the Analysis widget, also update the manifest (I think you had this right)


Example: Create a starter widget | ArcGIS Experience Builder | ArcGIS Developers

 

0 Kudos
JoeRogan
New Contributor III

Hi @AlixVezina , thank you for the response.  

I had not tried that yet as this wasn't necessary when duplicating the map or layer list widgets for customizations.  That command does run successfully, but doesn't provide me with an update src folder for the widget where I could start my customizations.  I tried running npm run build:dev to see what happens, and it results in the same 16 missing modules errors.  

I'm adding a screenshot of what I see with the widget.tsx file open, this shows a few of the broken dependencies with red underline as well as the errors in the console at the bottom.

0 Kudos
AlixVezina
Esri Regular Contributor

Sorry @JoeRogan I had corrected my post after sharing it and it must not have come through. My main question was: how are you adding the Analysis widget as a custom widget?

I believe the steps should be to add the Analysis widget into the client > your-extensions > widgets folder and then rename it.

CCing @WeiYing1  for any specific requirements to customize the Analysis widget.

0 Kudos
JeffreyThompson2
MVP Regular Contributor

Is your name in the manifest.json "analysis-sar"? The name in the manifest.json must exactly match the folder name for the widget to compile correctly. (Your original post indicates you named it "analysis-custom".) 

GIS Developer
City of Arlington, Texas
JoeRogan
New Contributor III

Yes I have renamed both the folder and name in the manifest to analysis-sar, they match.  The widget is in my client > your-extensions folder.  I've successfully done this with other widgets, its just the Analysis widget that doesn't seem to work.  A coworker has reproduced the issues on their machine too.

0 Kudos
JoeRogan
New Contributor III

What I don't understand are how the modules are loaded for the Analysis widget in the core of ExB, the widget clearly works there.  As a test I am taking one of the first lines that doesn't work and just loading it into the super basic sample widget.  The line is:

 
import { Alert, AlertPopup, defaultMessages as jimuiDefaultMessages, Loading, Tab, Tabs } from 'jimu-ui'
 
The problem point in this line is that Module '"jimu-ui"' has no exported member 'Alert'.  So how does this module work in the default Analysis widget, but I can't use it in any custom widget?  I'm sure whatever the fix for this would be a similar fix for all 16 modules producing errors.  My clue is that they are in the arcgis-amd-packages folder.
0 Kudos
WeiYing1
Esri Contributor

Hi @JoeRogan , 

Thanks for your feedback! Unfortunately you may not copy Analysis widget like other widget. Because an Esri priviate library is referenced in the Analysis widget. So it is as expected to see errors. So far we cannot open access to this private library. So it is not support if you would like develop a custom widget coping from Analysis widget. 

If there are any features you would like to added to Analysis widget, we are happy to hear about your story and investigate the possibility to enhance the widget. 

Thanks,
Wei

AValenski
New Contributor III

That's an alarming practice from Esri. What exactly is a "Esri private library" and why is Esri preventing its paying customers from accessing the tools and functions that we've paid for? Can you provide a complete list of what widgets are considered "private Esri widgets?" 

0 Kudos
WeiYing1
Esri Contributor

Hi @AValenski 

Thanks for your question. And sorry for unclear explanation.  
The Analysis widget is not a private widget. The Analysis functionalities are open to public users for sure. However it does not allow you to directly access the code of the widget implementation.  The private library means it is a library for internal use across Esri teams to develop functionalities, where the code is not exposed to public users and I believe that is understandable. 

However in future we may expose these kind of components/library to public users to help them develop their own functionalities. But the project is not ready yet.

Thanks,
Wei

0 Kudos