ywana-core8 0.0.927 → 0.0.929
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 +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +5 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +6 -3
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +6 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain2/DynamicForm.css +5 -0
- package/src/domain2/DynamicForm.js +8 -7
package/package.json
CHANGED
@@ -34,7 +34,8 @@ export const DynamicForm = (props) => {
|
|
34
34
|
const DynamicFormField = (props) => {
|
35
35
|
|
36
36
|
const { field, value, onChange } = props
|
37
|
-
const { id, type, format, options, required } = field
|
37
|
+
const { id, type, format, options, required, editable = true } = field
|
38
|
+
const readOnly = field.readOnly || editable === false
|
38
39
|
|
39
40
|
function change(id, value) {
|
40
41
|
if (onChange) onChange(id, value)
|
@@ -50,16 +51,15 @@ const DynamicFormField = (props) => {
|
|
50
51
|
function renderByFormat() {
|
51
52
|
|
52
53
|
const label = required ? `${field.label} *` : field.label
|
53
|
-
const readOnly = field.readOnly || field.editable === false
|
54
54
|
const { position = "bottom" } = field
|
55
55
|
|
56
56
|
switch (format) {
|
57
57
|
case FORMATS.TEXT:
|
58
|
-
return <TextArea id={id} label={label} value={value} onChange={change} outlined readOnly={readOnly}/>
|
58
|
+
return <TextArea id={id} label={label} value={value} onChange={change} outlined readOnly={readOnly} />
|
59
59
|
case FORMATS.DATE:
|
60
|
-
return <TextField id={id} label={label} type="date" value={value} onChange={change} outlined readOnly={readOnly}/>
|
60
|
+
return <TextField id={id} label={label} type="date" value={value} onChange={change} outlined readOnly={readOnly} />
|
61
61
|
case FORMATS.TIME:
|
62
|
-
return <TextField id={id} label={label} type="time" value={value} onChange={change} outlined readOnly={readOnly}/>
|
62
|
+
return <TextField id={id} label={label} type="time" value={value} onChange={change} outlined readOnly={readOnly} />
|
63
63
|
case FORMATS.DATERANGE:
|
64
64
|
return <DateRange id={id} label={label} value={value} onChange={change} />
|
65
65
|
case FORMATS.TOKENS:
|
@@ -67,7 +67,7 @@ const DynamicFormField = (props) => {
|
|
67
67
|
case FORMATS.COLOR:
|
68
68
|
return <ColorField id={id} onChange={change} value={value} />
|
69
69
|
default:
|
70
|
-
return options ? <DropDown id={id} label={label} value={value} onChange={change} options={buildOptions()} outlined readOnly={readOnly} position={position}/> :
|
70
|
+
return options ? <DropDown id={id} label={label} value={value} onChange={change} options={buildOptions()} outlined readOnly={readOnly} position={position} /> :
|
71
71
|
<TextField id={id} label={label} value={value} onChange={change} outlined readOnly={readOnly} />
|
72
72
|
}
|
73
73
|
}
|
@@ -81,8 +81,9 @@ const DynamicFormField = (props) => {
|
|
81
81
|
}
|
82
82
|
}
|
83
83
|
|
84
|
+
const className = `dynamic-form-field ${readOnly ? "readonly" : ""}`
|
84
85
|
return (
|
85
|
-
<div className=
|
86
|
+
<div className={className}>
|
86
87
|
{renderByType()}
|
87
88
|
</div>
|
88
89
|
)
|