How to use the jsonforms-core.toDataPathSegments 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
const mapStateToProps = (state, ownProps) => {
  const path = compose(ownProps.path, toDataPathSegments(ownProps.uischema.scope.$ref).join('.'));
  const visible = _.has(ownProps, 'visible') ? ownProps.visible :  isVisible(ownProps, state);
  const enabled = _.has(ownProps, 'enabled') ? ownProps.enabled :  isEnabled(ownProps, state);

  return {
    rootData: getData(state),
    data: resolveData(getData(state), path),
    uischema: ownProps.uischema,
    schema: ownProps.schema,
    resolvedSchema: resolveSchema(ownProps.schema, ownProps.uischema.scope.$ref),
    path,
    visible,
    enabled
  };
};
github eclipsesource / jsonforms / packages / default / src / additional / tree-renderer.tsx View on Github external
componentWillMount() {
    const { uischema, data, resolvedSchema } = this.props;
    const controlElement = uischema as MasterDetailLayout;

    this.setState({
      dialog: {
        open: false,
        schema: undefined,
        path: undefined
      }
    });

    if (_.isArray(data)) {
      const dataPathSegments = toDataPathSegments(controlElement.scope.$ref);
      const path = _.isEmpty(dataPathSegments) ? '' : dataPathSegments.join('.');
      this.setState({
        selected: {
          schema: resolvedSchema.items,
          data: data[0],
          path: compose(path, '0')
        }
      });
    } else {
      this.setState({
        selected: {
          schema: resolvedSchema,
          data,
          path: ''
        }
      });