Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/src/models/FieldMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ interface Advanced {
description: string;
validationErrorMessage: string;
options: any[];
title ?: string;
url?: string;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export interface UpdatedSettings {
/**
* The minimum size allowed.
*/
minSize?: string;
minSize?: number;

/**
* The maximum size allowed.
Expand Down Expand Up @@ -121,7 +121,7 @@ export interface UpdatedSettings {

embedObjects?: any;

default_value?: string;
default_value?: string |boolean;
options?: any[]
}

Expand Down Expand Up @@ -183,7 +183,7 @@ export interface StateType {
/**
* The minimum size allowed.
*/
minSize?: string;
minSize?: number;

/**
* The maximum size allowed.
Expand Down
117 changes: 14 additions & 103 deletions ui/src/components/AdvancePropertise/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const AdvancePropertise = (props: SchemaProps) => {
*/
const fetchContentTypes = async (searchText: string) => {
try {
const { data } = await getContentTypes(props?.projectId ?? '', 0, 10, searchText || ''); //org id will always present
const { data } = await getContentTypes(props?.projectId ?? '', 0,5000, searchText || ''); //org id will always present

setContentTypes(data?.contentTypes);
} catch (error) {
Expand Down Expand Up @@ -122,8 +122,9 @@ const AdvancePropertise = (props: SchemaProps) => {
props?.rowId,
{
...props?.value,
[field?.charAt(0)?.toUpperCase() + field?.slice(1)]: (event.target as HTMLInputElement)?.value,
validationRegex: currentToggleStates?.validationRegex || '',
[field]: (event.target as HTMLInputElement)?.value,
default_value: currentToggleStates?.default_value,
validationRegex: currentToggleStates?.validationRegex ?? '',
minChars: currentToggleStates?.minChars,
maxChars:currentToggleStates?.maxChars,
mandatory: currentToggleStates?.mandatory,
Expand All @@ -134,7 +135,10 @@ const AdvancePropertise = (props: SchemaProps) => {
embedObjects: embedObjectslabels,
minRange: currentToggleStates?.minRange,
maxRange: currentToggleStates?.maxRange,
default_value: currentToggleStates?.default_value,
minSize: currentToggleStates?.minSize,
maxSize: currentToggleStates?.maxSize,
title: currentToggleStates?.title,
url:currentToggleStates?.url
},
checkBoxChanged
);
Expand Down Expand Up @@ -186,7 +190,7 @@ const AdvancePropertise = (props: SchemaProps) => {
props?.updateFieldSettings(
props?.rowId,
{
[field?.charAt(0)?.toUpperCase() + field?.slice(1)]: value,
[field]: value,
validationRegex: currentToggleStates?.validationRegex || '',
mandatory: currentToggleStates?.mandatory,
multiple: currentToggleStates?.multiple,
Expand All @@ -200,18 +204,6 @@ const AdvancePropertise = (props: SchemaProps) => {

};

const stringToBoolean = (value:string) =>{

if(value?.toLowerCase() === 'true'){
return true
}
else{
return false;
}


}

const handleOnClick = ( index:number) =>{

setShowOptions((prev) => ({
Expand Down Expand Up @@ -337,30 +329,7 @@ const AdvancePropertise = (props: SchemaProps) => {
<ModalHeader title={`${props?.fieldtype} properties`} closeModal={props?.closeModal} className="text-capitalize" />
<ModalBody>
<div className='modal-data'>
{(props?.fieldtype === 'Single Line Textbox' || props?.fieldtype === 'Multi Line Textbox') && (
<Field>
<FieldLabel htmlFor="noOfCharacters" version="v2">
Number of Characters
</FieldLabel>
<div className='d-flex align-items-center'>
<TextInput
type="number"
value={toggleStates?.minChars}
placeholder="Min"
version="v2"
onChange={handleOnChange && ((e: React.ChangeEvent<HTMLInputElement>) => handleOnChange('minChars', e, true))}
/>
<span className='fields-group-separator'>to</span>
<TextInput
type="number"
value={toggleStates?.maxChars}
placeholder="Max"
version="v2"
onChange={handleOnChange && ((e: React.ChangeEvent<HTMLInputElement>) => handleOnChange('maxChars', e, true))}
/>
</div>
</Field>
)}


{(props?.fieldtype === 'Dropdown') &&
<>
Expand Down Expand Up @@ -470,65 +439,7 @@ const AdvancePropertise = (props: SchemaProps) => {
/>
</Field>
</>
)}

{props?.fieldtype === 'Number' && (
<Field>
<FieldLabel htmlFor="range" version="v2">
Range
</FieldLabel>
<div className='d-flex align-items-center'>
<TextInput
type="number"
value={toggleStates?.minRange}
placeholder="Min"
version="v2"
onChange={handleOnChange && ((e: React.ChangeEvent<HTMLInputElement>) => handleOnChange('minRange', e, true))}
/>
<span className='fields-group-separator'>to</span>
<TextInput
type="number"
value={toggleStates?.maxRange}
placeholder="Max"
version="v2"
onChange={handleOnChange && ((e: React.ChangeEvent<HTMLInputElement>) => handleOnChange('maxRange', e, true))}
/>
</div>
</Field>
)}

{props?.fieldtype === 'File' && (
<Field>
<FieldLabel htmlFor="fileSize" version="v2">
File Size Limit (MB)
</FieldLabel>
<Tooltip content={'min and max size (in MB) of file that the user will be allowed o upload.'} position="right">
<Icon
icon="Question"
size="small"
version="v2"
className='Help'
/>
</Tooltip>
<div className='d-flex align-items-center'>
<TextInput
type="number"
value={toggleStates?.minSize}
placeholder="Min"
version="v2"
onChange={handleOnChange && ((e: React.ChangeEvent<HTMLInputElement>) => handleOnChange('minSize', e, true))}
/>
<span className='fields-group-separator'>to</span>
<TextInput
type="number"
value={toggleStates?.maxSize}
placeholder="Max"
version="v2"
onChange={handleOnChange && ((e: React.ChangeEvent<HTMLInputElement>) => handleOnChange('maxSize', e, true))}
/>
</div>
</Field>
)}
)}

{props?.fieldtype === 'Link' && (
<>
Expand Down Expand Up @@ -582,12 +493,12 @@ const AdvancePropertise = (props: SchemaProps) => {
<div className="Radio-class">
<Radio
label={'True'}
checked={stringToBoolean(toggleStates?.default_value || '') === true}
checked={toggleStates?.default_value === true}
onChange={() => handleRadioChange('default_value',true)}>
</Radio>
<Radio
label={'False'}
checked={stringToBoolean(toggleStates?.default_value || '') === false}
checked={toggleStates?.default_value === false}
onChange={() => handleRadioChange('default_value',false)}>
</Radio>

Expand Down Expand Up @@ -642,7 +553,7 @@ const AdvancePropertise = (props: SchemaProps) => {

</>
)}
{props?.fieldtype !== 'Global' && (
{(props?.fieldtype !== 'Global' && props?.fieldtype !== 'Boolean') && (
<div className='ToggleWrap'>
<ToggleSwitch
label="Mandatory"
Expand Down
87 changes: 0 additions & 87 deletions ui/src/components/Common/FileUpload/fileupload.scss

This file was deleted.

Loading