ywana-core8 0.0.792 → 0.0.793
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +52 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +52 -40
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +52 -40
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain2/DynamicForm.js +3 -2
- package/src/domain2/DynamicForm.test.js +14 -11
package/package.json
CHANGED
@@ -2,6 +2,7 @@ import React from 'react'
|
|
2
2
|
import { CheckBox, ColorField, DateRange, DropDown, TextField, TokenField } from '../html'
|
3
3
|
import { FORMATS } from './FORMATS'
|
4
4
|
import './DynamicForm.css'
|
5
|
+
import { TYPES } from './TYPES'
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Dynamic Form
|
@@ -61,14 +62,14 @@ const DynamicFormField = (props) => {
|
|
61
62
|
case FORMATS.COLOR:
|
62
63
|
return <ColorField id={id} onChange={change} value={value} />
|
63
64
|
default:
|
64
|
-
return options ? <DropDown id={id} label={label} value={value} onChange={change} options={
|
65
|
+
return options ? <DropDown id={id} label={label} value={value} onChange={change} options={buildOptions()} outlined/> :
|
65
66
|
<TextField id={id} label={label} value={value} onChange={change} outlined />
|
66
67
|
}
|
67
68
|
}
|
68
69
|
|
69
70
|
function renderByType() {
|
70
71
|
switch (type) {
|
71
|
-
case
|
72
|
+
case TYPES.BOOLEAN:
|
72
73
|
return <CheckBox id={id} label={field.label} value={value} onChange={change} />
|
73
74
|
default:
|
74
75
|
return renderByFormat()
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React, { useState } from 'react'
|
2
2
|
import { DynamicForm } from './DynamicForm'
|
3
3
|
import { FORMATS } from './FORMATS'
|
4
|
+
import { TYPES } from './TYPES'
|
4
5
|
|
5
6
|
const DynamicFormTest = (props) => {
|
6
7
|
|
@@ -17,16 +18,18 @@ const DynamicFormTest = (props) => {
|
|
17
18
|
const schema = [
|
18
19
|
{ id: "id", type: "string", label: "ID" },
|
19
20
|
{ id: "name", type: "string", label: "Name", filter: true, like: true },
|
20
|
-
{
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
{ id: "
|
27
|
-
{ id:"
|
28
|
-
{ id: "
|
29
|
-
{ id: "
|
21
|
+
{
|
22
|
+
id: "gender", type: "string", label: "Gender", filter: true, options: [
|
23
|
+
{ label: "Masculine", value: 1 },
|
24
|
+
{ label: "Feminine", value: 0 }
|
25
|
+
]
|
26
|
+
},
|
27
|
+
{ id: "initDate", type: TYPES.STRING, label: "Init Date", format: FORMATS.DATE },
|
28
|
+
{ id: "hour", type: TYPES.STRING, label: "Hour", format: FORMATS.TIME },
|
29
|
+
{ id: "range", type: TYPES.STRING, label: "Range", format: FORMATS.DATERANGE },
|
30
|
+
{ id: "email", type: TYPES.STRING, label: "Email", format: FORMATS.EMAIL },
|
31
|
+
{ id: "color", type: TYPES.STRING, label: "Color", format: FORMATS.COLOR },
|
32
|
+
{ id: "active", type: TYPES.BOOLEAN , label: "Active", format: FORMATS.CHECKBOX },
|
30
33
|
]
|
31
34
|
|
32
35
|
const [values, setValues] = useState({})
|
@@ -39,7 +42,7 @@ const DynamicFormTest = (props) => {
|
|
39
42
|
|
40
43
|
return (
|
41
44
|
<div style={style}>
|
42
|
-
<DynamicForm schema={schema} values={values} onChange={onChange}/>
|
45
|
+
<DynamicForm schema={schema} values={values} onChange={onChange} />
|
43
46
|
</div>
|
44
47
|
|
45
48
|
)
|