How to use the @entando/utils.minLength function in @entando/utils

To help you get started, we’ve selected a few @entando/utils 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 entando / entando-components / plugins / entando-plugin-dashboard / app-builder / src / ui / widgets / charts / common / components / SettingsChart.js View on Github external
import {
  Row,
  Col,
  FormGroup,
  ControlLabel,
  FieldLevelHelp,
} from 'patternfly-react';

import { formattedText, required, minLength, maxLength } from '@entando/utils';
import FormattedMessage from 'ui/i18n/FormattedMessage';
import SwitchRenderer from 'ui/common/form/SwitchRenderer';

import FieldArrayDropDownMultiple from 'ui/common/FieldArrayDropDownMultiple';

const maxLength30 = maxLength(30);
const minLength3 = minLength(3);

const inputTextField = ({
  input,
  meta: { touched, error },
  label,
  append,
  disabled,
}) => (
github entando / entando-components / plugins / entando-plugin-dashboard / app-builder / src / ui / dashboard-config / common / components / DashboardConfigForm.js View on Github external
import {
  formattedText,
  required,
  minLength,
  maxLength,
  isNumber,
} from '@entando/utils';
import FormattedMessageLocal from 'ui/i18n/FormattedMessage';
import SwitchRenderer from 'ui/common/form/SwitchRenderer';
import RenderTextInput from 'ui/common/form/RenderTextInput';
import RenderSelectInput from 'ui/common/form/RenderSelectInput';
import FormLabel from 'ui/common/form/FormLabel';
import DashboardConfigDatasource from 'ui/dashboard-config/common/components/DashboardConfigDatasource';

const maxLength30 = maxLength(30);
const minLength3 = minLength(3);
const renderField = (
  name,
  labelId,
  placeholder,
  validate,
  labelSize,
  append,
) => {
  let requiredLabel = false;
  if (validate) {
    requiredLabel = !!validate.find(f => f.name === 'required');
  }
  let pholder = '';
  if (placeholder) {
    pholder = placeholder;
  } else {
github entando / app-builder / src / ui / users / common / UserForm.js View on Github external
maxLength,
  minLength,
  matchPassword,
  userFormText,
} from '@entando/utils';
import { FormattedMessage } from 'react-intl';
import RenderTextInput from 'ui/common/form/RenderTextInput';
import SwitchRenderer from 'ui/common/form/SwitchRenderer';
import RenderSelectInput from 'ui/common/form/RenderSelectInput';
import FormLabel from 'ui/common/form/FormLabel';
import FormSectionTitle from 'ui/common/form/FormSectionTitle';

const EDIT_MODE = 'edit';
const NEW_MODE = 'new';

const minLength4 = minLength(4);
const minLength8 = minLength(8);
const maxLength20 = maxLength(20);

export const renderStaticField = (field) => {
  const { input, label, name } = field;
  let fieldValue = input.value.title || input.value;
  if (!input.value) {
    fieldValue = <i>;
  }

  return (
    <div>
      <label>
        {label}
      </label>
      </div></i>
github entando / app-builder / src / ui / users / common / UserForm.js View on Github external
minLength,
  matchPassword,
  userFormText,
} from '@entando/utils';
import { FormattedMessage } from 'react-intl';
import RenderTextInput from 'ui/common/form/RenderTextInput';
import SwitchRenderer from 'ui/common/form/SwitchRenderer';
import RenderSelectInput from 'ui/common/form/RenderSelectInput';
import FormLabel from 'ui/common/form/FormLabel';
import FormSectionTitle from 'ui/common/form/FormSectionTitle';

const EDIT_MODE = 'edit';
const NEW_MODE = 'new';

const minLength4 = minLength(4);
const minLength8 = minLength(8);
const maxLength20 = maxLength(20);

export const renderStaticField = (field) =&gt; {
  const { input, label, name } = field;
  let fieldValue = input.value.title || input.value;
  if (!input.value) {
    fieldValue = <i>;
  }

  return (
    <div>
      <label>
        {label}
      </label>
      
        {fieldValue}</div></i>
github entando / entando-components / plugins / entando-plugin-dashboard / app-builder / src / ui / widgets / common / form / components / DashboardWidgetTitle.js View on Github external
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Field, FormSection } from 'redux-form';
import { Tabs, Tab, InputGroup } from 'patternfly-react';
import { formattedText, required, minLength, maxLength } from '@entando/utils';

import RenderTextInput from 'ui/common/form/RenderTextInput';
import FormLabel from 'ui/common/form/FormLabel';

const maxLength30 = maxLength(30);
const minLength3 = minLength(3);

class DashboardWidgetTitle extends Component {
  componentWillMount() {
    this.props.onWillMount();
  }

  render() {
    const tabs = this.props.languages
      .sort(a =&gt; (a.isDefault ? -1 : 1))
      .map((lang, i) =&gt; {
        const validate = [minLength3, maxLength30];
        if (lang.isDefault) {
          validate.push(required);
        }
        return (
github entando / entando-components / plugins / entando-plugin-dashboard / app-builder / src / ui / widgets / geolocalization / components / DatasourceLayer.js View on Github external
import React from 'react';
import PropTypes from 'prop-types';
import { Field, FieldArray } from 'redux-form';
import { Grid, Row, Col, InputGroup } from 'patternfly-react';
import DatasourceFormContainer from 'ui/widgets/common/form/containers/DatasourceFormContainer';
import { formattedText, minLength, maxLength } from '@entando/utils';

import RenderTextInput from 'ui/common/form/RenderTextInput';
import FormLabel from 'ui/common/form/FormLabel';
import FieldArrayDropDownMultiple from 'ui/common/FieldArrayDropDownMultiple';
import FormattedMessage from 'ui/i18n/FormattedMessage';
import IconMarker from './IconMarker';

const maxLength20 = maxLength(20);
const minLength3 = minLength(3);

const ICONS_MARKER_1 = [
  'fa-map-marker',
  'fa-map-pin',
  'fa-circle',
  'fa-exclamation-triangle',
  'fa-flag',
  'fa-star',
  'fa-street-view',
  'fa-bed',
];
const ICONS_MARKER_2 = [
  'fa-male',
  'fa-female',
  'fa-car',
  'fa-bus',