angular icon indicating copy to clipboard operation
angular copied to clipboard

drop zone in custom component in angular-formio

Open Dheeraj-Bharti opened this issue 4 years ago • 12 comments

Hi, I want to create a drop zone in my custom component that i've registered using the angular-formio. For ex - I want to make a dropzone in the primeng-panel. Can you please let me know whether that is even feasible or not in angular-formio.

Thank you, Dheeraj

Dheeraj-Bharti avatar Sep 25 '20 05:09 Dheeraj-Bharti

Yes, this is feasible since custom components can be created using the "Angular" way described @ https://github.com/formio/angular-formio/wiki/Custom-Components-with-Angular-Elements

travist avatar Sep 28 '20 14:09 travist

I have successfully created and registered the custom component but I want to drag and drop the components inside my custom component. For that I'm unable to find anything. We can create the custom component by extending the nested component in formiojs but how to do it for custom component in angular formio that i'm not able to figure out.

Dheeraj-Bharti avatar Sep 29 '20 07:09 Dheeraj-Bharti

I am not sure how that is done with the Custom Components feature since we did not develop it, but maybe @merobal knows since he developed it?

travist avatar Sep 29 '20 20:09 travist

The custom component itself is an Angular component (in this context), so feel free to look at any dropzone implementations for Angular, and use that there.

merobal avatar Sep 30 '20 10:09 merobal

I tried cdk drag and drop but in that I'm not able to drop the components, also it won't give a nested json i mean components inside components as we gets in formio. I want to create a custom layout component as we create in formiojs by extending the Nested Component with the dropzone provided as we have in layout components.

Dheeraj-Bharti avatar Sep 30 '20 14:09 Dheeraj-Bharti

Try other d&d packages and try to compose the JSON inside the ng component and emit via the value. (Or you can use an Angular service to save data and combine during API calls.)

merobal avatar Oct 02 '20 14:10 merobal

I'm trying with ngx-dnd, but how to get the list of components to my custom components. Do you have any POC application for the same that you would like to share.

Dheeraj-Bharti avatar Oct 06 '20 07:10 Dheeraj-Bharti

what's the use-case you want to achieve?

merobal avatar Oct 06 '20 07:10 merobal

I've added primeng-tabview ( https://primefaces.org/primeng/showcase/#/tabview ) to my custom component. I want to drag and drop components inside this just like we have tabs in layout section.

Dheeraj-Bharti avatar Oct 06 '20 08:10 Dheeraj-Bharti

Any updates on this?

Dheeraj-Bharti avatar Oct 12 '20 10:10 Dheeraj-Bharti

I haven't yet discovered how you can combine both scopes. Imagine that you have an Angular component and you want to include a part of an external lib, in this case, formio>angular>formio.

This Custom Components solution is designed for form fields (form inputs) when you wish to embed Angular fields inside formio, e.g. if you want to deliver the same UI across your Angular apps but enjoy the WYSIWYG-style form builder too.

For tabs, I recommend using the built-in formio's one and apply custom css to match the design with primeng.

merobal avatar Oct 12 '20 14:10 merobal

@Dheeraj-Bharti Have you find solution to this, I too need to have drop zone for my custom component

Seonho08 avatar Jun 30 '22 02:06 Seonho08

Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!

daneformio avatar Jan 31 '24 14:01 daneformio