<commit_before>﻿import * as React from 'react'
import { TypeContext, StyleContext, StyleOptions, FormGroupStyle, FormGroupSize, IRenderButtons } from './TypeContext'
export { TypeContext, StyleContext, StyleOptions, FormGroupStyle, FormGroupSize, IRenderButtons };

import { PropertyRouteType, MemberInfo, getTypeInfo, TypeInfo, PropertyRoute, Binding, ReadonlyBinding } from './Reflection'
export { Binding, ReadonlyBinding }

import { ModifiableEntity, EntityPack, ModelState } from './Signum.Entities'
import * as Navigator from './Navigator'
import { ViewReplacer } from  './Frames/ReactVisitor'

export { PropertyRoute };

import { FormGroup, FormGroupProps, FormControlStatic, FormControlStaticProps, LineBase, LineBaseProps, tasks} from './Lines/LineBase'
export { FormGroup, FormGroupProps, FormControlStatic, FormControlStaticProps, LineBase, LineBaseProps, tasks};

import { ValueLine, ValueLineType, ValueLineProps } from './Lines/ValueLine'
export { ValueLine, ValueLineType, ValueLineProps};

import { RenderEntity } from  './Lines/RenderEntity'
export { RenderEntity };

import { EntityBase } from  './Lines/EntityBase'
export { EntityBase };

import { AutocompleteConfig, FindOptionsAutocompleteConfig, LiteAutocompleteConfig } from './Lines/AutocompleteConfig'
export { AutocompleteConfig, FindOptionsAutocompleteConfig, LiteAutocompleteConfig };

import { EntityLine } from './Lines/EntityLine'
export { EntityLine };

import { EntityCombo } from  './Lines/EntityCombo'
export { EntityCombo };


import { EntityDetail } from  './Lines/EntityDetail'
export { EntityDetail };

import { EntityListBase, EntityListBaseProps } from  './Lines/EntityListBase'
export { EntityListBase };

import { EntityList } from  './Lines/EntityList'
export { EntityList };

import { EntityRepeater } from  './Lines/EntityRepeater'
export { EntityRepeater };

import { EntityTabRepeater } from  './Lines/EntityTabRepeater'
export { EntityTabRepeater };

import { EntityStrip } from  './Lines/EntityStrip'
export { EntityStrip };

import { EntityCheckboxList } from  './Lines/EntityCheckboxList'
export { EntityCheckboxList };

import { EnumCheckboxList } from  './Lines/EnumCheckboxList'
export { EnumCheckboxList };


import { EntityTable } from './Lines/EntityTable'
export { EntityTable };

tasks.push(taskSetNiceName);
export function taskSetNiceName(lineBase: LineBase<any, any>, state: LineBaseProps) {
    if (!state.labelText &&
        state.ctx.propertyRoute &&
        state.ctx.propertyRoute.propertyRouteType == "Field") {
        state.labelText = state.ctx.propertyRoute.member!.niceName;
    }
}

tasks.push(taskSetUnit);
export function taskSetUnit(lineBase: LineBase<any, any>, state: LineBaseProps) {
    if (lineBase instanceof ValueLine) {
        const vProps = state as ValueLineProps;

        if (!vProps.unitText &&
            state.ctx.propertyRoute &&
            state.ctx.propertyRoute.propertyRouteType == "Field") {
            vProps.unitText = state.ctx.propertyRoute.member!.unit;
        }
    }
}

tasks.push(taskSetFormat);
export function taskSetFormat(lineBase: LineBase<any, any>, state: LineBaseProps) {
    if (lineBase instanceof ValueLine) {
        const vProps = state as ValueLineProps;

        if (!vProps.formatText &&
            state.ctx.propertyRoute &&
            state.ctx.propertyRoute.propertyRouteType == "Field") {
            vProps.formatText = state.ctx.propertyRoute.member!.format;
        }
    }
}

tasks.push(taskSetReadOnly);
export function taskSetReadOnly(lineBase: LineBase<any, any>, state: LineBaseProps) {
    if (!state.ctx.readOnly &&
        state.ctx.propertyRoute &&
        state.ctx.propertyRoute.propertyRouteType == "Field" &&
        state.ctx.propertyRoute.member!.isReadOnly) {
        state.ctx.readOnly = true;
    }
}

tasks.push(taskSetMove);
export function taskSetMove(lineBase: LineBase<any, any>, state: LineBaseProps) {
    if (lineBase instanceof EntityListBase &&
        state.ctx.propertyRoute &&
        state.ctx.propertyRoute.propertyRouteType == "Field" &&
        state.ctx.propertyRoute.member!.preserveOrder) {
        (state as EntityListBaseProps).move = true;
    }
}

export let maxValueLineSize = 100; 

tasks.push(taskSetHtmlProperties);
export function taskSetHtmlProperties(lineBase: LineBase<any, any>, state: LineBaseProps) {
    const vl = lineBase instanceof ValueLine ? lineBase as ValueLine : undefined;
    const pr = state.ctx.propertyRoute;
    const s = state as ValueLineProps;
    if (vl && pr && pr.propertyRouteType == "Field" && (s.valueLineType == ValueLineType.TextBox || s.valueLineType == ValueLineType.TextArea)) {

        var member = pr.member!;

        if (member.maxLength != undefined) {

            if (!s.valueHtmlProps)
                s.valueHtmlProps = {};

            s.valueHtmlProps.maxLength = member.maxLength;

            s.valueHtmlProps.size = maxValueLineSize == undefined ? member.maxLength : Math.min(maxValueLineSize, member.maxLength);
        }

        if (member.isMultiline)
            s.valueLineType = ValueLineType.TextArea;
    }<commit_msg>avoid maxLength on Lines.tsx<commit_after>﻿import * as React from 'react'
import { TypeContext, StyleContext, StyleOptions, FormGroupStyle, FormGroupSize, IRenderButtons } from './TypeContext'
export { TypeContext, StyleContext, StyleOptions, FormGroupStyle, FormGroupSize, IRenderButtons };

import { PropertyRouteType, MemberInfo, getTypeInfo, TypeInfo, PropertyRoute, Binding, ReadonlyBinding } from './Reflection'
export { Binding, ReadonlyBinding }

import { ModifiableEntity, EntityPack, ModelState } from './Signum.Entities'
import * as Navigator from './Navigator'
import { ViewReplacer } from  './Frames/ReactVisitor'

export { PropertyRoute };

import { FormGroup, FormGroupProps, FormControlStatic, FormControlStaticProps, LineBase, LineBaseProps, tasks} from './Lines/LineBase'
export { FormGroup, FormGroupProps, FormControlStatic, FormControlStaticProps, LineBase, LineBaseProps, tasks};

import { ValueLine, ValueLineType, ValueLineProps } from './Lines/ValueLine'
export { ValueLine, ValueLineType, ValueLineProps};

import { RenderEntity } from  './Lines/RenderEntity'
export { RenderEntity };

import { EntityBase } from  './Lines/EntityBase'
export { EntityBase };

import { AutocompleteConfig, FindOptionsAutocompleteConfig, LiteAutocompleteConfig } from './Lines/AutocompleteConfig'
export { AutocompleteConfig, FindOptionsAutocompleteConfig, LiteAutocompleteConfig };

import { EntityLine } from './Lines/EntityLine'
export { EntityLine };

import { EntityCombo } from  './Lines/EntityCombo'
export { EntityCombo };


import { EntityDetail } from  './Lines/EntityDetail'
export { EntityDetail };

import { EntityListBase, EntityListBaseProps } from  './Lines/EntityListBase'
export { EntityListBase };

import { EntityList } from  './Lines/EntityList'
export { EntityList };

import { EntityRepeater } from  './Lines/EntityRepeater'
export { EntityRepeater };

import { EntityTabRepeater } from  './Lines/EntityTabRepeater'
export { EntityTabRepeater };

import { EntityStrip } from  './Lines/EntityStrip'
export { EntityStrip };

import { EntityCheckboxList } from  './Lines/EntityCheckboxList'
export { EntityCheckboxList };

import { EnumCheckboxList } from  './Lines/EnumCheckboxList'
export { EnumCheckboxList };


import { EntityTable } from './Lines/EntityTable'
export { EntityTable };

tasks.push(taskSetNiceName);
export function taskSetNiceName(lineBase: LineBase<any, any>, state: LineBaseProps) {
    if (!state.labelText &&
        state.ctx.propertyRoute &&
        state.ctx.propertyRoute.propertyRouteType == "Field") {
        state.labelText = state.ctx.propertyRoute.member!.niceName;
    }
}

tasks.push(taskSetUnit);
export function taskSetUnit(lineBase: LineBase<any, any>, state: LineBaseProps) {
    if (lineBase instanceof ValueLine) {
        const vProps = state as ValueLineProps;

        if (!vProps.unitText &&
            state.ctx.propertyRoute &&
            state.ctx.propertyRoute.propertyRouteType == "Field") {
            vProps.unitText = state.ctx.propertyRoute.member!.unit;
        }
    }
}

tasks.push(taskSetFormat);
export function taskSetFormat(lineBase: LineBase<any, any>, state: LineBaseProps) {
    if (lineBase instanceof ValueLine) {
        const vProps = state as ValueLineProps;

        if (!vProps.formatText &&
            state.ctx.propertyRoute &&
            state.ctx.propertyRoute.propertyRouteType == "Field") {
            vProps.formatText = state.ctx.propertyRoute.member!.format;
        }
    }
}

tasks.push(taskSetReadOnly);
export function taskSetReadOnly(lineBase: LineBase<any, any>, state: LineBaseProps) {
    if (!state.ctx.readOnly &&
        state.ctx.propertyRoute &&
        state.ctx.propertyRoute.propertyRouteType == "Field" &&
        state.ctx.propertyRoute.member!.isReadOnly) {
        state.ctx.readOnly = true;
    }
}

tasks.push(taskSetMove);
export function taskSetMove(lineBase: LineBase<any, any>, state: LineBaseProps) {
    if (lineBase instanceof EntityListBase &&
        state.ctx.propertyRoute &&
        state.ctx.propertyRoute.propertyRouteType == "Field" &&
        state.ctx.propertyRoute.member!.preserveOrder) {
        (state as EntityListBaseProps).move = true;
    }
}

export let maxValueLineSize = 100; 

tasks.push(taskSetHtmlProperties);
export function taskSetHtmlProperties(lineBase: LineBase<any, any>, state: LineBaseProps) {
    const vl = lineBase instanceof ValueLine ? lineBase as ValueLine : undefined;
    const pr = state.ctx.propertyRoute;
    const s = state as ValueLineProps;
    if (vl && pr && pr.propertyRouteType == "Field" && (s.valueLineType == ValueLineType.TextBox || s.valueLineType == ValueLineType.TextArea)) {

        var member = pr.member!;

        if (member.maxLength != undefined && !s.ctx.readOnly) {

            if (!s.valueHtmlProps)
                s.valueHtmlProps = {};

            s.valueHtmlProps.maxLength = member.maxLength;

            s.valueHtmlProps.size = maxValueLineSize == undefined ? member.maxLength : Math.min(maxValueLineSize, member.maxLength);
        }

        if (member.isMultiline)
            s.valueLineType = ValueLineType.TextArea;
    }
{'fraction_non_alphanumeric': 0.1111327744199649, 'fraction_numerical': 0.0005849093390524469, 'mean_word_length': 3.9345839345839346, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1659561', 'n_tokens_mistral': 2920, 'n_tokens_neox': 2906, 'n_words': 656}