Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fields: [{
component: componentTypes.TEXT_FIELD,
name: 'regexp-pattern',
label: 'Regepx',
helperText: 'Value must be equal to Foo',
validate: [{
type: validatorTypes.PATTERN_VALIDATOR,
pattern: /^Foo$/,
}],
}, {
component: componentTypes.TEXT_FIELD,
name: 'string-pattern',
label: 'String pattern',
helperText: 'Value must be equal to Foo',
validate: [{
type: validatorTypes.PATTERN_VALIDATOR,
pattern: '^Foo$',
}],
}],
};
const PatternValidators = () => (
<div>
</div>
);
import React from 'react';
import FormRenderer, { componentTypes, validatorTypes } from '@data-driven-forms/react-form-renderer';
import { layoutMapper, formFieldsMapper } from '@data-driven-forms/pf4-component-mapper';
const schema = {
title: 'Start typing',
fields: [{
component: componentTypes.TEXT_FIELD,
name: 'regexp-pattern',
label: 'Regepx',
helperText: 'Value must be equal to Foo',
validate: [{
type: validatorTypes.PATTERN_VALIDATOR,
pattern: /^Foo$/,
}],
}, {
component: componentTypes.TEXT_FIELD,
name: 'string-pattern',
label: 'String pattern',
helperText: 'Value must be equal to Foo',
validate: [{
type: validatorTypes.PATTERN_VALIDATOR,
pattern: '^Foo$',
}],
}],
};
const PatternValidators = () => (
<div></div>
component: components.TEXT_FIELD,
},
{
name: 'text_box_6',
label: 'Text Box unvisible',
title: 'Text Box unvisible',
isVisible: false,
component: components.TEXT_FIELD,
},
{
name: 'text_box_7',
label: 'Text Box with validator',
title: 'Text Box with validator',
validate: [
{
type: validators.PATTERN_VALIDATOR,
pattern: '[0-9]',
},
],
component: components.TEXT_FIELD,
},
{
name: 'text_box_8',
label: 'Text Box integer value',
title: 'Text Box integer value',
dataType: 'integer',
component: components.TEXT_FIELD,
type: 'number',
},
{
name: 'text_box_9',
label: 'Text Box string value',
component: components.TEXT_FIELD,
},
{
name: 'text_box_6',
label: 'Text Box unvisible',
title: 'Text Box unvisible',
isVisible: false,
component: components.TEXT_FIELD,
},
{
name: 'text_box_7',
label: 'Text Box with validator',
title: 'Text Box with validator',
validate: [
{
type: validators.PATTERN_VALIDATOR,
pattern: '[0-9]',
},
],
component: components.TEXT_FIELD,
},
{
name: 'text_box_8',
label: 'Text Box integer value',
title: 'Text Box integer value',
dataType: 'integer',
component: components.TEXT_FIELD,
type: 'number',
},
{
name: 'text_box_9',
label: 'Text Box string value',
component: components.TEXT_FIELD,
},
{
name: 'text_box_6',
label: 'Text Box unvisible',
title: 'Text Box unvisible',
isVisible: false,
component: components.TEXT_FIELD,
},
{
name: 'text_box_7',
label: 'Text Box with validator',
title: 'Text Box with validator',
validate: [
{
type: validators.PATTERN_VALIDATOR,
pattern: '[0-9]',
},
],
component: components.TEXT_FIELD,
},
{
name: 'text_box_8',
label: 'Text Box integer value',
title: 'Text Box integer value',
dataType: 'integer',
component: components.TEXT_FIELD,
type: 'number',
},
{
name: 'text_box_9',
label: 'Text Box string value',
component: components.TEXT_FIELD,
},
{
name: 'text_box_6',
label: 'Text Box unvisible',
title: 'Text Box unvisible',
isVisible: false,
component: components.TEXT_FIELD,
},
{
name: 'text_box_7',
label: 'Text Box with validator',
title: 'Text Box with validator',
validate: [
{
type: validators.PATTERN_VALIDATOR,
pattern: '[0-9]',
},
],
component: components.TEXT_FIELD,
},
{
name: 'text_box_8',
label: 'Text Box integer value',
title: 'Text Box integer value',
dataType: 'integer',
component: components.TEXT_FIELD,
type: 'number',
},
{
name: 'text_box_9',
label: 'Text Box string value',
component: components.TEXT_FIELD,
},
{
name: 'text_box_6',
label: 'Text Box unvisible',
title: 'Text Box unvisible',
isVisible: false,
component: components.TEXT_FIELD,
},
{
name: 'text_box_7',
label: 'Text Box with validator',
title: 'Text Box with validator',
validate: [
{
type: validators.PATTERN_VALIDATOR,
pattern: '^[0-9]+$',
},
],
component: components.TEXT_FIELD,
},
{
name: 'text_box_8',
label: 'Text Box integer value',
title: 'Text Box integer value',
dataType: 'integer',
component: components.TEXT_FIELD,
type: 'number',
},
{
name: 'text_box_9',
label: 'Text Box string value',