ywana-core8 0.0.925 → 0.0.927

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.925",
3
+ "version": "0.0.927",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -50,14 +50,16 @@ const DynamicFormField = (props) => {
50
50
  function renderByFormat() {
51
51
 
52
52
  const label = required ? `${field.label} *` : field.label
53
+ const readOnly = field.readOnly || field.editable === false
54
+ const { position = "bottom" } = field
53
55
 
54
56
  switch (format) {
55
57
  case FORMATS.TEXT:
56
- return <TextArea id={id} label={label} value={value} onChange={change} outlined />
58
+ return <TextArea id={id} label={label} value={value} onChange={change} outlined readOnly={readOnly}/>
57
59
  case FORMATS.DATE:
58
- return <TextField id={id} label={label} type="date" value={value} onChange={change} outlined />
60
+ return <TextField id={id} label={label} type="date" value={value} onChange={change} outlined readOnly={readOnly}/>
59
61
  case FORMATS.TIME:
60
- return <TextField id={id} label={label} type="time" value={value} onChange={change} outlined />
62
+ return <TextField id={id} label={label} type="time" value={value} onChange={change} outlined readOnly={readOnly}/>
61
63
  case FORMATS.DATERANGE:
62
64
  return <DateRange id={id} label={label} value={value} onChange={change} />
63
65
  case FORMATS.TOKENS:
@@ -65,8 +67,8 @@ const DynamicFormField = (props) => {
65
67
  case FORMATS.COLOR:
66
68
  return <ColorField id={id} onChange={change} value={value} />
67
69
  default:
68
- return options ? <DropDown id={id} label={label} value={value} onChange={change} options={buildOptions()} outlined/> :
69
- <TextField id={id} label={label} value={value} onChange={change} outlined />
70
+ return options ? <DropDown id={id} label={label} value={value} onChange={change} options={buildOptions()} outlined readOnly={readOnly} position={position}/> :
71
+ <TextField id={id} label={label} value={value} onChange={change} outlined readOnly={readOnly} />
70
72
  }
71
73
  }
72
74
 
@@ -79,9 +81,8 @@ const DynamicFormField = (props) => {
79
81
  }
80
82
  }
81
83
 
82
- const className = `dynamic-form-field ${id}`
83
84
  return (
84
- <div className={className}>
85
+ <div className="dynamic-form-field">
85
86
  {renderByType()}
86
87
  </div>
87
88
  )
@@ -16,10 +16,10 @@ const DynamicFormTest = (props) => {
16
16
  }
17
17
 
18
18
  const schema = [
19
- { id: "id", type: "string", label: "ID" },
19
+ { id: "id", type: "string", label: "ID", editable: false },
20
20
  { id: "name", type: "string", label: "Name", filter: true, like: true },
21
21
  {
22
- id: "gender", type: "string", label: "Gender", filter: true, options: [
22
+ id: "gender", type: "string", label: "Gender", filter: true, editable: true, options: [
23
23
  { label: "Masculine", value: 1 },
24
24
  { label: "Feminine", value: 0 }
25
25
  ]
@@ -37,4 +37,10 @@ export const Switch2 = (props) => {
37
37
  <Icon icon={icon} clickable action={toggle} />
38
38
  </div>
39
39
  )
40
- }
40
+ }
41
+
42
+ const Switch2Test = () => {
43
+ return (
44
+ <Switch2 checked={true} onChange={console.log} />
45
+ )
46
+ }
@@ -177,6 +177,11 @@ input:read-only ~ label,
177
177
  overflow: auto;
178
178
  }
179
179
 
180
+ .dropdown>menu.top {
181
+ top: auto;
182
+ bottom: 3.8rem;
183
+ }
184
+
180
185
  .dropdown>menu ul {
181
186
  list-style: none;
182
187
  margin: 0;
@@ -118,7 +118,7 @@ export const TextArea = (props) => {
118
118
  export const DropDown = (props) => {
119
119
 
120
120
  const site = useContext(SiteContext)
121
- const { id, options = [], value, onChange, predictive = false, readOnly = false, verbose = true, editable = false, onBlur } = props
121
+ const { id, options = [], value, onChange, predictive = false, readOnly = false, verbose = true, editable = false, onBlur, position="bottom"} = props
122
122
  const [open, setOpen] = useState(false)
123
123
  const [label, setLabel] = useState()
124
124
 
@@ -185,7 +185,7 @@ export const DropDown = (props) => {
185
185
  <Text>{option.label}</Text>
186
186
  </li>
187
187
  ))
188
- return <menu><ul>{lis}</ul></menu>
188
+ return <menu className={position}><ul>{lis}</ul></menu>
189
189
  } else {
190
190
  return null
191
191
  }
@@ -36,7 +36,7 @@ const TextFieldTest = (prop) => {
36
36
  <br/>
37
37
  <DropDown id="b1" label="Boolean1" labelPosition="left" onChange={change} options={options2} value={form.b1} />
38
38
  <br/>
39
- <DropDown id="gender1" label="Dropdown 1" value={form.gender1} onChange={change} options={options} predictive={false}/>
39
+ <DropDown id="gender1" label="Dropdown 1" value={form.gender1} onChange={change} options={options} predictive={false} position="top"/>
40
40
  <DropDown id="gender2" label="Dropdown 2" value={form.gender2} onChange={change} options={options} predictive={true}/>
41
41
  <DropDown id="gender3" label="Dropdown 3" value={form.gender3} onChange={change} options={options} predictive={false} editable={true}/>
42
42
  <TokenField id="token1" label="Tokens" onChange={change} />