How to use the jsonforms-core.update function in jsonforms-core

To help you get started, we’ve selected a few jsonforms-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipsesource / jsonforms / packages / default / src / additional / tree-renderer.tsx View on Github external
<span> {
                dispatch(
                  update(
                    parentPath,
                    array =&gt; {
                      const copy = array.slice();
                      return _.filter(copy, el =&gt; !_.isEqual(el, data))
                    }
                  )
                )
              }}&gt;
                {'\u274C'}</span>
github eclipsesource / jsonforms / packages / default / src / additional / tree-renderer.tsx View on Github external
private addToRoot() {
    const { schema, dispatch, path } = this.props;

    if (isNotTuple(schema)) {
      dispatch(
        update(
          path,
          data => {
            const clone = data.slice();
            clone.push({});

            return clone;
          }
        )
      );
    }
  }
github eclipsesource / jsonforms / packages / default / src / additional / tree-renderer.tsx View on Github external
onClick={() => {
                          const newData = _.keys(prop.schema.properties).reduce(
                            (d, key) => {
                              if (prop.schema.properties[key].default) {
                                d[key] = prop.schema.properties[key].default;
                              }

                              return d;
                            },
                            {}
                          );
                          dispatch(
                            update(
                              compose(this.state.dialog.path, prop.property),
                              array => {
                                if (_.isEmpty(array)) {
                                  return [newData];
                                }
                                array.push(newData);

                                return array;
                              }
                            )
                          );
                          this.closeDialog();
                        }}
                      >
github eclipsesource / jsonforms / packages / default / src / additional / array-renderer.tsx View on Github external
const addNewItem = (dispatch, path: string) => {
  const element = {};
  dispatch(
    update(
      path,
      array => {
        if (array === undefined || array === null) {
          return [element];
        }

        const clone = _.clone(array);
        clone.push(element);

        return clone;
      }
    )
  );
};