How to use the jsonforms-core.rankWith 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
registerStartupRenderer,
  resolveData,
  resolveSchema,
  toDataPathSegments,
  uiTypeIs,
  update
} from 'jsonforms-core';
import {connect} from 'react-redux';
import {SyntheticEvent} from "react";

/**
 * Default tester for a master-detail layout.
 * @type {RankedTester}
 */
export const treeMasterDetailTester: RankedTester =
  rankWith(
    2,
    and(
      uiTypeIs('MasterDetailLayout'),
      uischema => {
        const control = uischema as MasterDetailLayout;
        if (control.scope === undefined || control.scope === null) {
          return false;
        }

        return !(control.scope.$ref === undefined || control.scope.$ref === null);
      }
    ));

const isNotTuple = (schema: JsonSchema) => !Array.isArray(schema.items);

export interface TreeMasterDetailState extends ControlState {
github eclipsesource / jsonforms / packages / materialized / src / controls / materialized.textarea.control.tsx View on Github external
className={classNames.input}
          id={id}
          hidden={!visible}
          disabled={!enabled}
          autoFocus={uischema.options && uischema.options.focus}
        />
        <label data-error="{errors}">
          {label}
        </label>
      
    );
  }
}

export default registerStartupRenderer(
  rankWith(1, isMultiLineControl),
  connect(mapStateToControlProps)(MaterializedTextareaControl)
);
github eclipsesource / jsonforms / packages / materialized / src / controls / materialized.boolean.control.tsx View on Github external
id={id}
               hidden={!visible}
               disabled={!enabled}
               autoFocus={uischema.options &amp;&amp; uischema.options.focus}
        /&gt;
        <label data-error="{errors}"> this.handleChange(!this.state.value)}&gt;
          {label}
        </label>
      
    );
  }
}

export default registerStartupRenderer(
  rankWith(2, isBooleanControl),
  connect(mapStateToControlProps)(MaterializedBooleanControl)
);
github eclipsesource / jsonforms / packages / materialized / src / controls / materialized.text.control.tsx View on Github external
className={classNames.input}
               id={id}
               hidden={!visible}
               disabled={!enabled}
               autoFocus={uischema.options &amp;&amp; uischema.options.focus}
        /&gt;
        <label data-error="{errors}">
          {label}
        </label>
      
    );
  }
}

export default registerStartupRenderer(
  rankWith(2, isControl),
  connect(mapStateToControlProps)(MaterializedTextControl)
);
github eclipsesource / jsonforms / packages / materialized / src / controls / materialized.date.control.tsx View on Github external
className={classNames.input}
               id={id}
               hidden={!visible}
               disabled={!enabled}
               autoFocus={uischema.options &amp;&amp; uischema.options.focus}
        /&gt;
        <label data-error="{errors}">
          {label}
        </label>
      
    );
  }
}

export default registerStartupRenderer(
  rankWith(2, isDateControl),
  connect(mapStateToControlProps)(DateControl)
);
github eclipsesource / jsonforms / packages / materialized / src / controls / materialized.enum.control.tsx View on Github external
);
                })
            )
          }
        
        <label data-error="{errors}">
          {label}
        </label>
      
    );
  }
}

export default registerStartupRenderer(
  rankWith(2, isEnumControl),
  connect(mapStateToControlProps)(MaterializedEnumControl)
);
github eclipsesource / jsonforms / packages / default / src / additional / categorization-renderer.tsx View on Github external
path={path}
            /&gt;
          )
      )
    }
  
);

const isCategorization = (category: Category | Categorization): category is Categorization =&gt;
  category.type === 'Categorization';

/**
 * Default tester for a categorization.
 * @type {RankedTester}
 */
export const categorizationTester: RankedTester = rankWith(
        1,
        and(
            uiTypeIs('Categorization'),
            uischema =&gt; {
              const hasCategory = (element: Categorization): boolean =&gt; {
                if (_.isEmpty(element.elements)) {
                  return false;
                }

                return element.elements
                    .map(elem =&gt; isCategorization(elem) ?
                        hasCategory(elem) :
                        elem.type === 'Category'
                    )
                    .reduce((prev, curr) =&gt; prev &amp;&amp; curr, true);
              };
github eclipsesource / jsonforms / packages / materialized / src / controls / materialized.integer.control.tsx View on Github external
className={classNames.input}
               id={id}
               hidden={!visible}
               disabled={!enabled}
               autoFocus={uischema.options &amp;&amp; uischema.options.focus}
        /&gt;
        <label data-error="{errors}">
          {label}
        </label>
      
    );
  }
}

export default registerStartupRenderer(
  rankWith(2, isIntegerControl),
  connect(mapStateToControlProps)(MaterializedIntegerControl)
);
github eclipsesource / jsonforms / packages / materialized / src / controls / materialized.number.control.tsx View on Github external
className={classNames.input}
               id={id}
               hidden={!visible}
               disabled={!enabled}
               autoFocus={uischema.options &amp;&amp; uischema.options.focus}
        /&gt;
        <label data-error="{errors}">
          {label}
        </label>
      
    );
  }
}

export default registerStartupRenderer(
  rankWith(2, isNumberControl),
  connect(mapStateToControlProps)(NumberControl)
);