How to use the uniforms/randomIds function in uniforms

To help you get started, we’ve selected a few uniforms 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 vazco / uniforms / packages / uniforms-bootstrap3 / __tests__ / _createContext.ts View on Github external
import randomIds from 'uniforms/randomIds';

import createSchema from './_createSchema';

const randomId = randomIds();

const createContext = (schema, context) => ({
  context: {
    uniforms: {
      error: null,
      model: {},
      name: [],
      onChange() {},
      onSubmit() {},

      ...context,

      randomId,
      schema: createSchema(schema),
      state: {
        changedMap: {},
github vazco / uniforms / packages / uniforms-material / __tests__ / _createContext.ts View on Github external
import PropTypes from 'prop-types';
import randomIds from 'uniforms/randomIds';

import createSchema from './_createSchema';

const randomId = randomIds();

const createContext = (schema, context) => ({
  context: {
    uniforms: {
      error: null,
      model: {},
      name: [],
      onChange() {},
      onSubmit() {},

      ...context,

      randomId,
      schema: createSchema(schema),
      state: {
        changedMap: {},
github vazco / uniforms / packages / uniforms / __tests__ / connectField.js View on Github external
describe('connectField', () => {
  const error = new Error();
  const onChange = jest.fn();
  const randomId = randomIds();
  const state = {
    changed: false,
    changedMap: {},
    submitting: false,
    label: true,
    disabled: false,
    placeholder: false,
    showInlineError: true
  };

  const schema = new SimpleSchemaBridge({
    getDefinition(name) {
      return {
        field: { type: Object, label: 'Field' },
        'field.subfield': { type: Number, label: 'Subfield' },
        another: { type: String, optional: true }
github vazco / uniforms / packages / uniforms / __tests__ / injectName.js View on Github external
describe('injectName', () => {
  const error = new Error();
  const onChange = () => {};
  const randomId = randomIds();
  const state = {
    changed: false,
    changedMap: {},
    submitting: false,
    label: true,
    disabled: false,
    placeholder: false,
    showInlineError: true
  };

  const schema = new SimpleSchemaBridge({
    getDefinition(name) {
      return {
        fieldA: { type: Object, label: 'FieldA' },
        'fieldA.fieldB': { type: Object, label: 'FieldB' },
        'fieldA.fieldB.fieldC': { type: String, label: 'FieldC' }
github focallocal / fl-maps / tests / unit-tests / helpers / uniformsContext.js View on Github external
import randomIds from 'uniforms/randomIds'

import createSchema from './uniformsSchema'

const randomId = randomIds()

const createContext = (schema, context) => ({
  context: {
    uniforms: {
      error: null,
      model: {},
      name: [],
      onChange () {},

      ...context,

      randomId,
      schema: createSchema(schema),
      state: {
        changedMap: {},