mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
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:
committed by
GitHub
parent
a93fefa92b
commit
bc48d809bc
28
src/components/fields/Email/Settings.tsx
Normal file
28
src/components/fields/Email/Settings.tsx
Normal 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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user