Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3736 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3736 Rev 3741
Línea 7... Línea 7...
7
export function FormFilePicker({
7
export function FormFilePicker({
8
  label = '',
8
  label = '',
9
  name = 'file',
9
  name = 'file',
10
  type = 'image',
10
  type = 'image',
11
  description = 'Arrastra el archivo aqui, o haga click para seleccionar',
11
  description = 'Arrastra el archivo aqui, o haga click para seleccionar',
12
  multiple = false,
-
 
13
  rules = {}
12
  rules = {}
14
}) {
13
}) {
15
  const { control } = useFormContext();
14
  const { control } = useFormContext();
Línea 16... Línea 15...
16
 
15
 
17
  return (
16
  return (
18
    <Controller
17
    <Controller
19
      control={control}
18
      control={control}
20
      name={name}
19
      name={name}
21
      rules={rules}
20
      rules={rules}
22
      render={({ field: { onChange, value } }) => (
21
      render={({ field: { onChange } }) => (
23
        <FormControl variant='standard' fullWidth>
22
        <FormControl variant='standard' fullWidth>
Línea 24... Línea 23...
24
          {label && <InputLabel shrink>{label}</InputLabel>}
23
          {label && <InputLabel shrink>{label}</InputLabel>}
25
 
24
 
26
          <FilePicker
25
          <FilePicker
27
            type={type}
-
 
28
            description={description}
26
            type={type}
29
            defaultFiles={value}
-
 
30
            onChange={(files) => {
-
 
31
              if (multiple) {
-
 
32
                onChange(files);
27
            description={description}
33
              } else {
-
 
34
                onChange(files[0]);
28
            onChange={(files) => {
35
              }
29
              onChange(files[0]);
36
            }}
30
            }}
37
          />
31
          />
38
        </FormControl>
32
        </FormControl>