️ This Gitlab will be shut down at 2021-12-31 23:59:59.
Students and staff can migrate to gitlab.utwente.nl.
SNT members can migrate to gitlab.snt.utwente.nl.
Contact bestuur@snt.utwente.nl for more information.

Migrate your projects today!
Export your project using the webinterface or use a script.

Commit d2279799 authored by TJHeeringa's avatar TJHeeringa

Init for Redux and update for fields

parent da53c149
......@@ -1218,9 +1218,9 @@
}
},
"@devexpress/dx-core": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/@devexpress/dx-core/-/dx-core-2.7.1.tgz",
"integrity": "sha512-Siz1cPifZMRU6k8PUYFmg583LkxZFTeOLO76AwY8xEuuwthDvQYKNzsGIHmEtLDkBfypim5UqVL+mjnN/wRSww=="
"version": "2.7.4",
"resolved": "https://registry.npmjs.org/@devexpress/dx-core/-/dx-core-2.7.4.tgz",
"integrity": "sha512-bM56UDr8L0OmTrWYjvC5KkleZrvm/493xiNAzLk1iyQY9Ghbr/viOkDATAlknOEblKWr2l7jGsYIJtzA7f6qLQ=="
},
"@devexpress/dx-grid-core": {
"version": "2.7.1",
......@@ -1234,6 +1234,13 @@
"requires": {
"@devexpress/dx-core": "2.7.1",
"prop-types": "^15.7.2"
},
"dependencies": {
"@devexpress/dx-core": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/@devexpress/dx-core/-/dx-core-2.7.1.tgz",
"integrity": "sha512-Siz1cPifZMRU6k8PUYFmg583LkxZFTeOLO76AwY8xEuuwthDvQYKNzsGIHmEtLDkBfypim5UqVL+mjnN/wRSww=="
}
}
},
"@devexpress/dx-react-grid": {
......@@ -3972,14 +3979,42 @@
}
},
"browserslist": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.14.0.tgz",
"integrity": "sha512-pUsXKAF2lVwhmtpeA3LJrZ76jXuusrNyhduuQs7CDFf9foT4Y38aQOserd2lMe5DSSrjf3fx34oHwryuvxAUgQ==",
"version": "4.16.8",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.8.tgz",
"integrity": "sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ==",
"requires": {
"caniuse-lite": "^1.0.30001111",
"electron-to-chromium": "^1.3.523",
"escalade": "^3.0.2",
"node-releases": "^1.1.60"
"caniuse-lite": "^1.0.30001251",
"colorette": "^1.3.0",
"electron-to-chromium": "^1.3.811",
"escalade": "^3.1.1",
"node-releases": "^1.1.75"
},
"dependencies": {
"caniuse-lite": {
"version": "1.0.30001251",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz",
"integrity": "sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A=="
},
"colorette": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/colorette/-/colorette-1.3.0.tgz",
"integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w=="
},
"electron-to-chromium": {
"version": "1.3.814",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.814.tgz",
"integrity": "sha512-0mH03cyjh6OzMlmjauGg0TLd87ErIJqWiYxMcOLKf5w6p0YEOl7DJAj7BDlXEFmCguY5CQaKVOiMjAMODO2XDw=="
},
"escalade": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw=="
},
"node-releases": {
"version": "1.1.75",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz",
"integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw=="
}
}
},
"bser": {
......@@ -5782,9 +5817,9 @@
"integrity": "sha1-s55/HabrCnW6nBcySzR1PEfgZU0="
},
"dns-packet": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.1.tgz",
"integrity": "sha512-0UxfQkMhYAUaZI+xrNZOz/as5KgDU0M/fQ9b6SpkyLbk3GEswDi6PADJVaYJradtRVsRIlF1zLyOodbcTCDzUg==",
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-1.3.4.tgz",
"integrity": "sha512-BQ6F4vycLXBvdrJZ6S3gZewt6rcrks9KBgM9vrhW+knGRqc8uEdT7fuCwloc7nny5xNoMJ17HGH0R/6fpo8ECA==",
"requires": {
"ip": "^1.1.0",
"safe-buffer": "^5.0.1"
......@@ -6168,11 +6203,6 @@
"ext": "^1.1.2"
}
},
"escalade": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.0.2.tgz",
"integrity": "sha512-gPYAU37hYCUhW5euPeR+Y74F7BL+IBsV93j5cvGriSaD1aG6MGsqsV1yamRdrWrb2j3aiZvb0X+UBOWpx3JWtQ=="
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
......@@ -7619,9 +7649,9 @@
}
},
"glob-parent": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
"integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"requires": {
"is-glob": "^4.0.1"
}
......@@ -7947,9 +7977,9 @@
}
},
"hosted-git-info": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg=="
"version": "2.8.9",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw=="
},
"hpack.js": {
"version": "2.1.6",
......@@ -9476,9 +9506,9 @@
}
},
"ws": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz",
"integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==",
"requires": {
"async-limiter": "~1.0.0"
}
......@@ -10457,9 +10487,9 @@
}
},
"jszip": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.5.0.tgz",
"integrity": "sha512-WRtu7TPCmYePR1nazfrtuF216cIVon/3GWOvHS9QR5bIwSbnxtdpma6un3jyGGNhHsKCSzn5Ypk+EkDRvTGiFA==",
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.7.1.tgz",
"integrity": "sha512-ghL0tz1XG9ZEmRMcEN2vt7xabrDdqHHeykgARpmZ0BiIctWxM47Vt63ZO2dnp4QYt/xJVLLy5Zv1l/xRdh2byg==",
"requires": {
"lie": "~3.3.0",
"pako": "~1.0.2",
......@@ -10687,9 +10717,9 @@
}
},
"lodash": {
"version": "4.17.20",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
"integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"lodash-es": {
"version": "4.17.15",
......@@ -10931,6 +10961,18 @@
"escape-string-regexp": "^1.0.4"
}
},
"material-ui-phone-number": {
"version": "2.2.6",
"resolved": "https://registry.npmjs.org/material-ui-phone-number/-/material-ui-phone-number-2.2.6.tgz",
"integrity": "sha512-eLGDK9wgvdj2oj+jgmctNtDFznbY7evnuX5hA5OLs5MU5rtE1N4Qs/drRJm3vFct6KOwEwYfaO6XQ+zFUKiI7Q==",
"requires": {
"clsx": "^1.0.4",
"lodash": "^4.17.14",
"prop-types": "^15.7.2",
"react": "^16.8.0",
"react-dom": "^16.8.0"
}
},
"material-ui-search-bar": {
"version": "1.0.0-beta.14",
"resolved": "https://registry.npmjs.org/material-ui-search-bar/-/material-ui-search-bar-1.0.0-beta.14.tgz",
......@@ -11086,9 +11128,9 @@
}
},
"merge-deep": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/merge-deep/-/merge-deep-3.0.2.tgz",
"integrity": "sha512-T7qC8kg4Zoti1cFd8Cr0M+qaZfOwjlPDEdZIIPPB2JZctjaPM4fX+i7HOId69tAti2fvO6X5ldfYUONDODsrkA==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/merge-deep/-/merge-deep-3.0.3.tgz",
"integrity": "sha512-qtmzAS6t6grwEkNrunqTBdn0qKwFgNWvlxUbAV8es9M7Ot1EbyApytCnvE0jALPa46ZpKDUo527kKiaWplmlFA==",
"requires": {
"arr-union": "^3.1.0",
"clone-deep": "^0.2.4",
......@@ -15644,9 +15686,9 @@
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="
},
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
},
"path-to-regexp": {
"version": "1.8.0",
......@@ -15841,9 +15883,9 @@
"integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs="
},
"postcss": {
"version": "7.0.32",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz",
"integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==",
"version": "7.0.36",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.36.tgz",
"integrity": "sha512-BebJSIUMwJHRH0HAQoxN4u1CN86glsrwsW0q7T+/m44eXOUAxSNdHRkNZPYz5vVUbg17hFgOQDE7fZk7li3pZw==",
"requires": {
"chalk": "^2.4.2",
"source-map": "^0.6.1",
......@@ -17479,9 +17521,10 @@
"integrity": "sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw=="
},
"react-form-validator-core": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/react-form-validator-core/-/react-form-validator-core-1.0.0.tgz",
"integrity": "sha512-J+itG0oD/6VikXWJlOyjpoe3QaB35iX2WeFuQ1psxyJ5KkjMncBcOjUw/lemW8dYCOC7vQTFGUjlvwkGenTgig==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/react-form-validator-core/-/react-form-validator-core-1.1.1.tgz",
"integrity": "sha512-5SG9pKrRptrhrt/dZg0bL28VvyGeuXftfhx6qwJLNdUqs2GgEnrV07BBtGpWyoBKXmO+fplD+O70DbI03CMqUQ==",
"dev": true,
"requires": {
"create-react-context": "^0.3.0",
"promise-polyfill": "8.1.0",
......@@ -17554,6 +17597,19 @@
"requires": {
"prop-types": "^15.0.0",
"react-form-validator-core": "1.0.0"
},
"dependencies": {
"react-form-validator-core": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/react-form-validator-core/-/react-form-validator-core-1.0.0.tgz",
"integrity": "sha512-J+itG0oD/6VikXWJlOyjpoe3QaB35iX2WeFuQ1psxyJ5KkjMncBcOjUw/lemW8dYCOC7vQTFGUjlvwkGenTgig==",
"requires": {
"create-react-context": "^0.3.0",
"promise-polyfill": "8.1.0",
"prop-types": "^15.0.0",
"react-lifecycles-compat": "^3.0.2"
}
}
}
},
"react-modal": {
......@@ -19520,9 +19576,9 @@
}
},
"ssri": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-7.1.0.tgz",
"integrity": "sha512-77/WrDZUWocK0mvA5NTRQyveUf+wsrIc6vyrxpS8tVvYBcX215QbafrJR3KtkpskIzoFLqqNuuYQvxaMjXJ/0g==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/ssri/-/ssri-7.1.1.tgz",
"integrity": "sha512-w+daCzXN89PseTL99MkA+fxJEcU3wfaE/ah0i0lnOlpG1CYLJ2ZjzEry68YBKfLs4JfoTShrTEsJkAZuNZ/stw==",
"requires": {
"figgy-pudding": "^3.5.1",
"minipass": "^3.1.1"
......@@ -21028,9 +21084,9 @@
}
},
"url-parse": {
"version": "1.4.7",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz",
"integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==",
"version": "1.5.3",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz",
"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==",
"requires": {
"querystringify": "^2.1.1",
"requires-port": "^1.0.0"
......@@ -21638,9 +21694,9 @@
}
},
"ws": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz",
"integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==",
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz",
"integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==",
"requires": {
"async-limiter": "~1.0.0"
}
......@@ -22061,9 +22117,9 @@
}
},
"ws": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz",
"integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==",
"version": "5.2.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.3.tgz",
"integrity": "sha512-jZArVERrMsKUatIdnLzqvcfydI85dvd/Fp1u/VOpfdDWQ4c9qWXe+VIeAbQ5FrDwciAkr+lzofXLz3Kuf26AOA==",
"requires": {
"async-limiter": "~1.0.0"
}
......
import TextField from "@material-ui/core/TextField";
import Autocomplete from "@material-ui/lab/Autocomplete";
import React from "react";
import {ValidatorComponent} from "react-form-validator-core";
class AutocompleteValidatorField extends ValidatorComponent {
renderValidatorComponent() {
/* eslint-disable no-unused-vars */
const {
error,
errorMessages,
validators,
requiredError,
helperText,
validatorListener,
withRequiredValidator,
containerProps,
label,
variant,
...rest
} = this.props;
const { isValid } = this.state;
return (
<Autocomplete
style={{ width: "100%" }}
renderInput={(params) => (
<TextField
{...params}
error={!isValid || error}
helperText={(!isValid && this.getErrorMessage()) || helperText}
label={label}
variant={variant}
inputProps={{
...params.inputProps,
autoComplete: "new-password", // disable autocomplete and autofill
}}
/>
)}
{...rest}
/>
);
}
}
const AutocompleteField = () => {
return (
<AutocompleteValidatorField
variant={"outlined"}
/>
);
};
export default AutocompleteField;
\ No newline at end of file
......@@ -24,12 +24,12 @@ const useStyles = makeStyles({
},
});
const CountryField = (props) => {
const CountryField = ({ label, ...props }) => {
const classes = useStyles();
return (
<Autocomplete
id={"country-select-demo"}
id={"country-select"}
style={{ width: "100%" }}
options={countries}
classes={{
......@@ -46,6 +46,7 @@ const CountryField = (props) => {
renderInput={(params) => (
<TextField
{...params}
label={label}
variant={"outlined"}
inputProps={{
...params.inputProps,
......
import { makeStyles, useTheme } from "@material-ui/core/styles";
import { makeStyles } from "@material-ui/core/styles";
import { KeyboardDateTimePicker } from "@material-ui/pickers";
import moment from "moment";
import PropTypes from "prop-types";
......
import { makeStyles, useTheme } from "@material-ui/core/styles";
import TextField from "@material-ui/core/TextField";
import PropTypes from "prop-types";
import React from "react";
const useStyles = makeStyles(theme => ({
textField: {
width: "100%",
},
}));
import useFieldStyles from "./fieldStyles";
const FileField = ({name, ...remaining_props}) => {
const classes = useStyles();
const textEditorProps = field => ({
variant: "outlined",
label: field[0].toUpperCase() + field.slice(1).replaceAll("_", " "),
className: classes.textField,
});
const FileField = (props) => {
const classes = useFieldStyles();
return (
<TextField
{...textEditorProps(name)}
variant={"outlined"}
className={classes.field}
InputLabelProps={{ shrink: true }}
type={"file"}
{...remaining_props}
{...props}
/>
);
};
FileField.propTypes = {
name: PropTypes.string.isRequired
};
export default FileField;
\ No newline at end of file
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
import makeStyles from "@material-ui/core/styles/makeStyles";
import useTheme from "@material-ui/core/styles/useTheme";
import PropTypes from "prop-types";
import React from "react";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
const useStyles = makeStyles(theme=>({
icon: {
......@@ -16,7 +16,11 @@ const FontAwesomeIconHolder = ({ icon, ...rest_props }) => {
const classes = useStyles(theme);
return (
<FontAwesomeIcon className={["MuiSvgIcon-root MuiSvgIcon-colorAction", classes.icon].join(" ")} icon={icon} />
<FontAwesomeIcon
className={["MuiSvgIcon-root MuiSvgIcon-colorAction", classes.icon].join(" ")}
icon={icon}
{...rest_props}
/>
);
};
......
import {makeStyles} from "@material-ui/core/styles";
import MuiPhoneInput from "material-ui-phone-number";
import React from "react";
import { ValidatorComponent } from "react-form-validator-core";
import useFieldStyles from "./fieldStyles";
const useStyles = makeStyles(theme => ({
field: {
width: "100%",
},
}));
class PhoneNumberValidatorField extends ValidatorComponent {
renderValidatorComponent() {
/* eslint-disable no-unused-vars */
const {
error,
errorMessages,
validators,
requiredError,
helperText,
validatorListener,
withRequiredValidator,
containerProps,
...rest
} = this.props;
const { isValid } = this.state;
return (
<MuiPhoneInput
{...rest}
error={!isValid || error}
helperText={(!isValid && this.getErrorMessage()) || helperText}
/>
);
}
}
const PhoneNumberField = (props) => {
const classes = useFieldStyles();
return (
<PhoneNumberValidatorField
inputClass={classes.field}
containerProps={{className: classes.field}}
defaultCountry={"nl"}
variant={"outlined"}
{...props}
/>
);
};
export default PhoneNumberField;
\ No newline at end of file
import MenuItem from "@material-ui/core/MenuItem";
import { makeStyles, useTheme } from "@material-ui/core/styles";
import PropTypes from "prop-types";
import React from "react";
import {SelectValidator} from "react-material-ui-form-validator";
const useStyles = makeStyles(theme => ({
selectField: {
width: "100%",
},
}));
import useFieldStyles from "./fieldStyles";
const SelectField = ({name, children, value, ...remaining_props}) => {
const theme = useTheme();
const classes = useStyles(theme);
const selectEditorProps = field => ({
name: field,
variant: "outlined",
label: field[0].toUpperCase() + field.slice(1).replaceAll("_", " "),
className: classes.selectField,
containerProps: {className: classes.selectField}
});
const SelectField = ({name, children, value, ...remaining_props}) => {
const classes = useFieldStyles();
return (
<SelectValidator
{...selectEditorProps(name)}
name={name}
variant={"outlined"}
label={name[0].toUpperCase() + name.slice(1).replaceAll("_", " ")}
className={classes.field}
containerProps={{className: classes.field}}
value={value === null ? "" : value}
{...remaining_props}
>
......
import { makeStyles, useTheme } from "@material-ui/core/styles";
import PropTypes from "prop-types";
import React from "react";
import {TextValidator} from "react-material-ui-form-validator";
const useStyles = makeStyles(theme => ({
textField: {
width: "100%",
},
}));
import useFieldStyles from "./fieldStyles";
const TextField = ({name, value, ...remaining_props}) => {
const classes = useStyles();
const textEditorProps = field => ({
name: field,
variant: "outlined",
label: field[0].toUpperCase() + field.slice(1).replaceAll("_", " "),
className: classes.textField,
containerProps: {className: classes.textField}
});
const classes = useFieldStyles();
return (
<TextValidator
{...textEditorProps(name)}
variant={"outlined"}
className={classes.field}
containerProps={{className: classes.field}}
name={name}
label={name[0].toUpperCase() + name.slice(1).replaceAll("_", " ")}
value={value === null ? "" : value}
{...remaining_props}
/>
......
import MenuItem from "@material-ui/core/MenuItem";
import makeStyles from "@material-ui/core/styles/makeStyles";
import useTheme from "@material-ui/core/styles/useTheme";
import { padStart } from "lodash";
import PropTypes from "prop-types";
import React from "react";