I was able to group my layers in the layerlist widget as I needed it, but the problem is that now, for example, my legend widget always displays "No legends".
Running a debug, I realized that the operational layers of the map obviously are no longer in the standard object, but in the clustered one. However, I tried to modify the following lines in the legend widget, but I did not succeed.
this._jimuLayerInfos = LayerInfos.getInstanceSync(); //This line
var legendParams =
layerInfos: this._getLayerInfosParam() ////This line
For grouping the layers, finally, I used the tip contained in the link below.
Thanks for the help.