ywana-core8 0.0.231 → 0.0.232

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.231",
3
+ "version": "0.0.232",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -248,16 +248,22 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
248
248
  return opts
249
249
  }
250
250
 
251
+ function renderFormat(format, options) {
252
+ switch (format) {
253
+ case FORMATS.HTML: return <Editor id={id} value={value} onChange={change} content={content} />
254
+ case FORMATS.DATE: return <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} />
255
+ default:
256
+ return options ? (
257
+ <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={predictive} />
258
+ ) : (
259
+ <TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
260
+ )
261
+ }
262
+ }
263
+
251
264
  return (
252
265
  <div className='field-editor string-editor'>
253
-
254
- { format === FORMATS.HTML ? <Editor id={id} value={value} onChange={change} content={content}/> : null }
255
-
256
- {
257
- format === FORMATS.DATE ? <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} /> :
258
- options ? <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} canFilter={predictive} /> :
259
- <TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
260
- }
266
+ {renderFormat(format, options)}
261
267
  </div>
262
268
  )
263
269
  }
@@ -272,12 +278,12 @@ const NumberEditor = ({ field, value, onChange, outlined = false }) => {
272
278
  if (onChange) onChange(id, value)
273
279
  }
274
280
 
275
- const val = value || value ==="" ? value : field.default
281
+ const val = value || value === "" ? value : field.default
276
282
  const min = field.min
277
283
  const max = field.max
278
284
  const disabled = !editable
279
285
 
280
- console.log('NumberEditor: ', label, val, value )
286
+ console.log('NumberEditor: ', label, val, value)
281
287
 
282
288
  return (
283
289
  <div className='field-editor number-editor'>