Git Product home page Git Product logo

bpmn-js-example-react-properties-panel's Introduction

React Properties Panel for bpmn-js

CI

This example demonstrates a custom properties panel for bpmn-js written in React.

Demo Screenshot

About

The component PropertiesView implements the properties panel.

The component is mounted via standard React utilities and receives the BPMN modeler instance as props:

ReactDOM.render(
  <PropertiesView modeler={ modeler } />,
  container
);

As part of its life-cycle hooks it hooks up with bpmn-js change and selection events to react to editor changes:

class PropertiesView extends React.Component {

  ...
  
  componentDidMount() {
  
    const {
       modeler
    } = this.props;
    
    modeler.on('selection.changed', (e) => {
      this.setElement(e.newSelection[0]);
    });

    modeler.on('element.changed', (e) => {
      this.setElement(e.element);
    });
  }

}

Rendering the component we may display element properties and apply changes:

class PropertiesView extends React.Component {
  
  ...
  
  render() {
  
    const {
      element
    } = this.state;
    
    return (
      <div>
        <fieldset>
          <label>id</label>
          <span>{ element.id }</span>
        </fieldset>

        <fieldset>
          <label>name</label>
          <input value={ element.businessObject.name || '' } onChange={ (event) => {
            this.updateName(event.target.value);
          } } />
        </fieldset>
      </div>
    );
  }
  
  updateName(newName) {
  
    const {
      element
    } = this.state;
    
    const { 
      modeler
    } = this.props;
    
    const modeling = modeler.get('modeling');
    
    modeling.updateLabel(element, newName);
  }
}

Run the Example

npm install

npm start

License

MIT

bpmn-js-example-react-properties-panel's People

Contributors

nikku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bpmn-js-example-react-properties-panel's Issues

Create basic example

It occurs that more and more users ask for custom PropertiesPanel examples. This new repository should add a further example for creating a completely custom PropertiesPanel for bpmn-js based on React.js. We can use this example as an entry point. The goal of this example should be to show how to easily create own PropertiesPanels without using the predefined one.

Tasks

Blank page when create new Item

Describe the Bug

Blank page when create new Item and hover
Screenshot from 2020-12-31 10-17-49
Screenshot from 2020-12-31 10-17-38

Steps to Reproduce

  1. Add new item/component
  2. hover the diagram
  3. all lost

Environment

  • Host (Browser/Node version), if applicable: Chrome 86
  • OS: Linux
  • Library version: 8.0.0

BPMN properties panel unable to use additionalModules properly

When add additionalModules like BpmnColorPickerModule and CreateAppendAnythingModule, got an error.

To reproduce:

  • clone the bpmn-properties-panel repo.
  • install all depencies with npm install.
  • install the two additional modules via npm and put in the code as the guides suggests.

The modules icons are present on screen:
image

But, when clicked:

image

I don't know what is this error related for.

  • Host (Browser/Node version).
  • OS: Windows 11 with Arch on WSL2.

App example is currently broken won't start

App example s broken, won't start

npm run start

Output

> [email protected] start
> webpack-dev-server --open

ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
node:internal/crypto/hash:68
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:68:19)
    at Object.createHash (node:crypto:138:10)
    at module.exports (/Users/erik/WFSandbox/bpmn-js-example-react-properties-panel/node_modules/webpack/lib/util/createHash.js:90:53)
    at NormalModule._initBuildHash (/Users/erik/WFSandbox/bpmn-js-example-react-properties-panel/node_modules/webpack/lib/NormalModule.js:401:16)
    at handleParseError (/Users/erik/WFSandbox/bpmn-js-example-react-properties-panel/node_modules/webpack/lib/NormalModule.js:449:10)
    at /Users/erik/WFSandbox/bpmn-js-example-react-properties-panel/node_modules/webpack/lib/NormalModule.js:481:5
    at /Users/erik/WFSandbox/bpmn-js-example-react-properties-panel/node_modules/webpack/lib/NormalModule.js:342:12
    at /Users/erik/WFSandbox/bpmn-js-example-react-properties-panel/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/erik/WFSandbox/bpmn-js-example-react-properties-panel/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/Users/erik/WFSandbox/bpmn-js-example-react-properties-panel/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/Users/erik/WFSandbox/bpmn-js-example-react-properties-panel/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
    at /Users/erik/WFSandbox/bpmn-js-example-react-properties-panel/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9
    at /Users/erik/WFSandbox/bpmn-js-example-react-properties-panel/node_modules/graceful-fs/graceful-fs.js:90:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Steps to Reproduce

  1. do this
  2. do that
  3. now this happens

Expected Behavior

Just try start project

npm run start

Environment

  • Node.js v20.10.0
  • OS: Darwin 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:54:10 PST 2023; root:xnu-10002.61.3~2/RELEASE_X86_64 x86_64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.