feat: add graphql support (#349)
* fix: eslint warnings * refactor: use ramda + sanctuary instead of lodash * refactor: use prettier-standard for formatting * feat: enable security * feat: add graphql * chore: remove trailing commas from linter * docs: new scripts on react and new-admin-server * feat: handle authentication on graphql * fix: perf improvement to date picker * chore: add insecure-dev script to run servers
This commit is contained in:
parent
49f434f1d1
commit
b8e0c2175b
182 changed files with 8827 additions and 4623 deletions
|
|
@ -1,13 +1,8 @@
|
|||
import React, { useState, memo } from 'react'
|
||||
import { identity, isEmpty } from 'lodash/fp'
|
||||
import { Form, Formik, FastField, useFormikContext } from 'formik'
|
||||
import React, { useState, memo } from 'react'
|
||||
|
||||
import {
|
||||
Td,
|
||||
Tr
|
||||
} from '../fake-table/Table'
|
||||
|
||||
import { Link } from '../buttons'
|
||||
import { Link } from 'src/components/buttons'
|
||||
import { Td, Tr } from 'src/components/fake-table/Table'
|
||||
|
||||
const getField = (name, component, props = {}) => (
|
||||
<FastField name={name} component={component} {...props} />
|
||||
|
|
@ -27,24 +22,42 @@ const ERow = memo(({ elements }) => {
|
|||
}
|
||||
|
||||
return (
|
||||
<Tr error={!isEmpty(errors)} errorMessage={errors && errors.toString()}>
|
||||
{elements.map(({ name, input, size, textAlign, view = identity, inputProps }, idx) => (
|
||||
<Td key={idx} size={size} textAlign={textAlign}>
|
||||
{editing ? getField(name, input, inputProps) : view(values[name])}
|
||||
</Td>
|
||||
))}
|
||||
<Tr
|
||||
error={errors && errors.length}
|
||||
errorMessage={errors && errors.toString()}>
|
||||
{elements.map(
|
||||
(
|
||||
{
|
||||
name,
|
||||
input,
|
||||
size,
|
||||
textAlign,
|
||||
view = it => it?.toString(),
|
||||
inputProps
|
||||
},
|
||||
idx
|
||||
) => (
|
||||
<Td key={idx} size={size} textAlign={textAlign}>
|
||||
{editing && getField(name, input, inputProps)}
|
||||
{!editing && view(values[name])}
|
||||
</Td>
|
||||
)
|
||||
)}
|
||||
<Td size={175}>
|
||||
{editing ? (
|
||||
<>
|
||||
<Link style={{ marginRight: '20px' }} color='secondary' onClick={innerCancel}>
|
||||
<Link
|
||||
style={{ marginRight: '20px' }}
|
||||
color="secondary"
|
||||
onClick={innerCancel}>
|
||||
Cancel
|
||||
</Link>
|
||||
<Link color='primary' onClick={innerSave}>
|
||||
<Link color="primary" onClick={innerSave}>
|
||||
Save
|
||||
</Link>
|
||||
</>
|
||||
) : (
|
||||
<Link color='primary' onClick={() => setEditing(true)}>
|
||||
<Link color="primary" onClick={() => setEditing(true)}>
|
||||
Edit
|
||||
</Link>
|
||||
)}
|
||||
|
|
@ -59,8 +72,7 @@ const ERowWithFormik = memo(({ value, validationSchema, save, elements }) => {
|
|||
enableReinitialize
|
||||
initialValues={value}
|
||||
validationSchema={validationSchema}
|
||||
onSubmit={save}
|
||||
>
|
||||
onSubmit={save}>
|
||||
<Form>
|
||||
<ERow elements={elements} />
|
||||
</Form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue