Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@data-driven-forms/editor-pro

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@data-driven-forms/editor-pro

DnD editor based on EvergreenUI for React Forms

  • 0.0.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source
  • Data Driven Forms Editor Pro
  • Props

Data Driven Forms Editor Pro

Data Driven Forms Editor is editor to build complex Data Driven Forms.

Props

fields

A schema of the properties editor. You can use our predefined helper functions to create subsections. Check public/index.tsx for an example

const fields: Schema = 	{
    fields: [{
		name: 'component',
		component: 'select',
		label: 'Component',
		description: 'Component type.',
		isRequired: true,
		validate: [{ type: 'required' }],
		options: Object.keys(componentMapper).map(key => ({
			label: key.replaceAll('-', ' '),
			value: key
		}))
	}, {
		name: 'name',
		component: 'text-field',
		label: 'Name',
		description: 'Name of the field. You can use dot notation to nest variables.',
		isRequired: true,
		validate: [{ type: 'required' }]
	}]
}

componentMapper

A mapper of components you want to be able to edit.

Example

import { componentMapper } from '@data-driven-forms/mui-component-mapper';

FormTemplate

A FormTemplate to use in the preview box.

Example

import { MuiFormTemplate } from '@data-driven-forms/mui-component-mapper';

componentInitialProps

An object to set initial props for components. For example, some components required props to be initialized.

Example

const componentInitialProps: AnyObject = {
	'dual-list-select': {
		options: []
	},
	'sub-form': {
		title: 'Sub form',
		fields: []
	},
	'field-array': {
		fields: []
	},
	wizard: {
		fields: [{ name: 'step-1', fields: [] }]
	},
	tabs: {
		fields: []
	}
};

initialSchema

Initial schema to be put in the editor.

Example

const initialSchema: Schema = {
	fields: [{
		component: componentTypes.TEXT_FIELD,
		name: 'name',
		label: 'Your name',
		isRequired: true,
		validate: [{ type: validatorTypes.REQUIRED }]
	  }, {
		component: componentTypes.TEXT_FIELD,
		name: 'email',
		label: 'Email',
		isRequired: true,
		validate: [
		  { type: validatorTypes.REQUIRED },
		  {
				type: validatorTypes.PATTERN,
				pattern: '[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,}$',
				message: 'Not valid email'
		  }
		]
	  },{
		component: componentTypes.TEXT_FIELD,
		name: 'confirm-email',
		label: 'Confirm email',
		type: 'email',
		isRequired: true,
	  },{
		component: componentTypes.CHECKBOX,
		name: 'newsletters',
		label: 'I want to receive newsletter'
	  }, {
		  component: componentTypes.SUB_FORM,
		  name: 'subform1',
		  title: 'Additional info',
		  fields: [
			  {
				component: componentTypes.TEXTAREA,
				name: 'address',
				label: 'Your address',
			  }
		  ]
	  }
	]
};

Keywords

FAQs

Package last updated on 02 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc