Feat:Email validation regex field added along with default values (#820)

* Feat:Email validation regex field added along with default values

Signed-off-by: Raj Gaurav Maurya <rajgmsocial19@gmail.com>

* Bug:regex fixed

Signed-off-by: Raj Gaurav Maurya <rajgmsocial19@gmail.com>

* Update CONTRIBUTING.md

* ref added with button and inputfield but current not working

Signed-off-by: Raj Gaurav Maurya <rajgmsocial19@gmail.com>

* Feat: standard Regex is now being filled into the input

* Feat: Copy feature added, ref deleted, working as expected

Signed-off-by: Raj Gaurav Maurya <rajgmsocial19@gmail.com>

* Update src/components/fields/Email/Settings.tsx

* Update src/components/fields/Email/Settings.tsx

Signed-off-by: Raj Gaurav Maurya <rajgmsocial19@gmail.com>
Co-authored-by: Sidney Alcantara <sidney@sidney.me>
This commit is contained in:
Raj Gaurav Maurya
2022-11-29 17:57:45 +05:30
committed by GitHub
parent a93fefa92b
commit bc48d809bc
2 changed files with 33 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import { ISettingsProps } from "@src/components/fields/types";
import { TextField, Button } from "@mui/material";
export default function Settings({ onChange, config }: ISettingsProps) {
const copyStandardRegex = () => {
onChange("validationRegex")("^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+.[a-zA-z]{2,3}$");
}
return (
<>
<TextField
type="text"
label="Validation regex"
id="validation-regex"
value={config.validationRegex}
fullWidth
onChange={(e) => {
if (e.target.value === "") onChange("validationRegex")(null);
else onChange("validationRegex")(e.target.value);
}}
/>
<Button style={{ width: "200px", margin: "20px auto auto" }} onClick={copyStandardRegex}>
Use standard regex
</Button>
</>
);
}

View File

@@ -13,6 +13,10 @@ const SideDrawerField = lazy(
import("./SideDrawerField" /* webpackChunkName: "SideDrawerField-Email" */)
);
const Settings = lazy(
() => import("./Settings" /* webpackChunkName: "Settings-ShortText" */)
);
export const config: IFieldConfig = {
type: FieldType.email,
name: "Email",
@@ -25,6 +29,7 @@ export const config: IFieldConfig = {
contextMenuActions: BasicContextMenuActions,
TableCell: withRenderTableCell(DisplayCell, EditorCell),
SideDrawerField,
settings: Settings,
filter: {
operators: filterOperators,
},