How to use @amalto/helpers - 10 common examples

To help you get started, we’ve selected a few @amalto/helpers 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 amalto / platform6-ui-components / components / file-input / components / FileWrapper.tsx View on Github external
{/* this div matches the number of cell of the previous table-row, it allows proper alignment of borders */}
                <div>&nbsp;</div>
            
        ) : null

        return (
            <li>
                {progressDisplay}
                <div>
                    <span data-original-title="{createdMessageText}" data-toggle="tooltip">{this.props.fileName}</span>
                    <span>{formatFileSize( this.props.fileSize )}</span>
                </div>
                {deleteBtn}
                {successIcon}
                {errorMessage}
            </li>
        )

    }
github amalto / platform6-ui-components / components / validated-input / index.tsx View on Github external
private validateField = ( value: string, props: ValidatedInput.Props ) => {
        const emptyButMandatory = !isNotEmpty(value) && !!props.mandatory
        const noMatchRegex = props.regex ? !props.regex.test( value ) : false
        const invalid = props.validate ? !props.validate( value ) : false

        if ( !props.disabled ) {
            this.setState( {
                invalidInput: emptyButMandatory || noMatchRegex || invalid
            }, () => {
                props.handleFieldChange( value, props.name, this.state.invalidInput )
            } )
        }
    }
github amalto / platform6-ui-components / components / multi-select-input / index.tsx View on Github external
private renderMultiSelectInput = ( field: WrappedFieldProps ) =&gt; {
        const { label, options, disabled, help, containerClass, inputClass, collapseErrorSpace, fieldLineHeight } = this.props

        const { input, meta } = field

        const extendedStyle: React.CSSProperties = this.getExtendedStyle( fieldLineHeight, input.value )

        const selectValue: string[] = isNotEmpty( input.value ) ? ( input.value as string ).split( ',' ) : []

        let choices = options.map( ( choice, idx ) =&gt; {

            let option = choice.label.trim()

            return (
                <li> v.trim() === option ) !== -1 } )}&gt;
                    <a href="#"> this.selectOption( e, field, selectValue, option )}&gt;
                        {option}
                    </a>
                </li>
            )
        } )

        return (
github amalto / platform6-ui-components / components / services-helpers / index.tsx View on Github external
constructor( appKey: string, serviceName: string, permissions: string[], locale: string ) {
        this._serviceName = serviceName
        this._appKey = appKey
        this._permissions = permissions
        this._locale = locale

        this._wordings = compileWordings( MULTILANGUAGE_WORDINGS, locale )
    }
github amalto / platform6-ui-components / components / key-value-editor / index.tsx View on Github external
constructor( props: KeyValueEditor.Props ) {
        super( props )
        this.state = {
            wordings: compileWordings( MULTILANGUAGE_WORDINGS, props.locale )
        }
    }
github amalto / platform6-ui-components / components / service-helpers / utils.ts View on Github external
export function validateName( value: string, id: Id, items: ServiceItemFacades, locale: string ): string {
    const wordings: { [id: string]: string } = compileWordings( MULTILANGUAGE_WORDINGS, locale )

    if ( !value || !value.trim() ) return wordings.fieldRequired

    if ( value !== id.name && !isIdUnique( items, { name: value, appKey: id.appKey } ) )
        return wordings.nameAlreadyExist

    if ( value.includes( '.' ) ) return wordings.nameNoDot
}
github amalto / platform6-ui-components / components / language-wrapper / index.tsx View on Github external
constructor( props: LanguageWrapper.Props ) {
        super( props )
        this.state = {
            addOpen: false,
            wordings: compileWordings( MULTILANGUAGE_WORDINGS, props.locale )
        }
    }
github amalto / platform6-ui-components / components / paging-controls / index.tsx View on Github external
constructor( props: PagingControls.Props ) {
        super( props )
        this.state = {
            wordings: compileWordings( MULTILANGUAGE_WORDINGS, props.locale )
        }
        this.goToPageInput = undefined
    }
github amalto / platform6-ui-components / components / tree / index.tsx View on Github external
constructor( props: Tree.Props ) {
        super( props )
        this.state = {
            treeInstance: null,
            selectedNode: null,
            formOpened: null,
            editedNode: null,
            maxTreeHeight: 0,
            wordings: compileWordings( MULTILANGUAGE_WORDINGS, props.locale )
        }
    }
github amalto / platform6-ui-components / components / custom-form-dialog / components / FormInput.tsx View on Github external
constructor( props: FormInput.Props ) {
        super( props )
        this.state = {
            wordings: compileWordings( MULTILANGUAGE_WORDINGS, props.locale )
        }
    }