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

Demo custom form components #106

Closed
5 tasks
pinussilvestrus opened this issue Sep 15, 2023 · 13 comments
Closed
5 tasks

Demo custom form components #106

pinussilvestrus opened this issue Sep 15, 2023 · 13 comments
Assignees

Comments

@pinussilvestrus
Copy link
Contributor

pinussilvestrus commented Sep 15, 2023

What should we do?

Create an easy way to demo and test custom form components.

  • Upload form component extension into the Playground Demo, this includes
    • Rendering extension
    • Properties Panel extension
    • Custom styles
  • Deploy demo and gather feedback

Why should we do it?

Related to bpmn-io/form-js#123

@pinussilvestrus pinussilvestrus self-assigned this Sep 15, 2023
@bpmn-io-tasks bpmn-io-tasks bot added the in progress Currently worked on label Sep 15, 2023
@pinussilvestrus
Copy link
Contributor Author

pinussilvestrus commented Sep 18, 2023

A basic demo is available via https://106-custom-form-components--camunda-form-playground.netlify.app/

  • Upload extension into the environment, consists of
    • Rendering extension
    • Properties Panel extension
    • Custom styles

This example extension can be used as a reference (use bundled files in the dist folder).

Kapture 2023-09-18 at 14 04 18

This includes some "hacks" to make it work for demo purposes, as of

@nikku
Copy link
Member

nikku commented Sep 18, 2023

This is interesting! To better understand the integration

  • Core: Provides ability to customize (renderer, properties panel)
  • Playground (or "modeler"): Provides the ability to site-load extensions

Am I correct with this assumption?

@nikku
Copy link
Member

nikku commented Sep 18, 2023

Related to (and supporting) the de-duplication effort we plan to work on https://github.com/bpmn-io/internal-docs/issues/819 at the core.

@pinussilvestrus
Copy link
Contributor Author

pinussilvestrus commented Sep 18, 2023

This is interesting! To better understand the integration

  • Core: Provides ability to customize (renderer, properties panel)
  • Playground (or "modeler"): Provides the ability to site-load extensions

Am I correct with this assumption?

This is exactly how it works 👍 Note that I (mis)used the playground here to demo something fast (point 2); this is not necessarily what we are going to build. However I simply re-use existing plugin mechanism of the Desktop Modeler, as it just works 🙂

@christian-konrad wants to create an epic about further integrating custom form elements in Modelers + Tasklist. This demo is more to showcase the upcoming core features (point 1).

@pinussilvestrus
Copy link
Contributor Author

pinussilvestrus commented Sep 21, 2023

Some examples what one can build with the demo (sneak peeks from @christian-konrad)

image

image

Bildschirmaufnahme.2023-09-22.um.09.42.58.mov

@pinussilvestrus
Copy link
Contributor Author

Demo was built, this issue was achieved.

@bpmn-io-tasks bpmn-io-tasks bot removed the in progress Currently worked on label Oct 9, 2023
@jenishPaladiya-TGS
Copy link

A basic demo is available via https://106-custom-form-components--camunda-form-playground.netlify.app/

  • Upload extension into the environment, consists of

    • Rendering extension
    • Properties Panel extension
    • Custom styles

This example extension can be used as a reference (use bundled files in the dist folder).

Kapture 2023-09-18 at 14 04 18 Kapture 2023-09-18 at 14 04 18

This includes some "hacks" to make it work for demo purposes, as of

is the functionality to add custom form elements via upload js file is now available for use in 1.5.0-alpha.0 version?
because i implemented form js playground in my custom react application and there i cant found option for upload custom form elementes.

@pinussilvestrus
Copy link
Contributor Author

@jenishPaladiya-TGS Unfortunately, the upload function was only for demo purposes and won't be included in form-js or form-playground - also due to security reasons as you can basically inject anything via this upload.

@christian-konrad cc

@jenishPaladiya-TGS
Copy link

jenishPaladiya-TGS commented Nov 28, 2023

@jenishPaladiya-TGS Unfortunately, the upload function was only for demo purposes and won't be included in form-js or form-playground - also due to security reasons as you can basically inject anything via this upload.

@christian-konrad cc

Thanks for confirmation

For this 1.5.0-alpha.0 version can i able to create custom elements like (Upload files , ratings , Third party grid , signature pad).
as i'm guessing that the support for custom element is not fully completed.

@pinussilvestrus
Copy link
Contributor Author

For this 1.5.0-alpha.0 version can i able to create custom elements like (Upload files , ratings , Third party grid , signature pad).

Depending on how your custom components should work, it should be completely possible to build them with the latest version.

For more questions please head over to our forum where you will find people to assist you 👍

@pinussilvestrus
Copy link
Contributor Author

In case you have any feedback / feature request, feel free to create an issue.

@jenishPaladiya-TGS
Copy link

For this 1.5.0-alpha.0 version can i able to create custom elements like (Upload files , ratings , Third party grid , signature pad).

Depending on how your custom components should work, it should be completely possible to build them with the latest version.

For more questions please head over to our forum where you will find people to assist you 👍

okay thanks for confirmation

I have React component (e.g. AGGrid) , can we add react component with all hooks support (e.g. useState, useEffect etc) as a custom element?

I had tried to implement but getting below exception

This is a code of my component

const [rowData] = useState([
    { make: "Toyota", model: "Celica", price: 35000 },
    { make: "Ford", model: "Mondeo", price: 32000 },
    { make: "Porsche", model: "Boxter", price: 72000 }
  ]);

  const [columnDefs] = useState([
    { field: "make" },
    { field: "model" },
    { field: "price" }
  ]);

  return (
    <div className="ag-theme-alpine" style={{ height: 400, width: 600 }}>
      <AgGridReact rowData={rowData} columnDefs={columnDefs}></AgGridReact>
    </div>
  );

by this im rendering that component as a custom element

return html`
    <div
      class=${formFieldClasses(gridType, {
        errors,
        disabled,
        readonly,
      })}
    >
      <${Label}
        id=${prefixId(id, formId)}
        label=${label}
        required=${required}
      />
      <${GridComp} />
    </div>
  `;

and getting below exception

Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
    See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

if i revert the component code to this (Like simply remove UseState hook from component)

function GridComp() {
  const [rowData] = [
    { make: "Toyota", model: "Celica", price: 35000 },
    { make: "Ford", model: "Mondeo", price: 32000 },
    { make: "Porsche", model: "Boxter", price: 72000 },
  ];

  const [columnDefs] = [
    { field: "make" },
    { field: "model" },
    { field: "price" },
  ];

  return (
    <div className="ag-theme-alpine" style={{ height: 500, width: 600 }}>
      <AgGridReact rowData={rowData} columnDefs={columnDefs}></AgGridReact>
    </div>
  );
}

Then also giving exception.

Cannot add property __, object is not extensible
TypeError: Cannot add property __, object is not extensible

@pinussilvestrus
Copy link
Contributor Author

This looks like a preact duplication error to me, preact has to be included only once. Cf. to our example on how to properly deduplicate preact: https://github.com/bpmn-io/form-js-examples/blob/master/custom-components/webpack.config.js

Requoting to what I mention above

For more questions please head over to our forum where you will find people to assist you 👍

We want to keep our issues clean. Thanks for your understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants