ywana-core8 0.0.359 → 0.0.362

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.359",
3
+ "version": "0.0.362",
4
4
  "description": "ywana-core8",
5
5
  "author": "Ernesto Roldan Garcia",
6
6
  "license": "MIT",
@@ -232,7 +232,7 @@ const EntityEditor = ({ field, value = {}, onChange }) => {
232
232
  * String Editor
233
233
  */
234
234
  export const StringEditor = ({ field, value = '', onChange, content, outlined }) => {
235
- const { id, format, label, options, editable = true, predictive = false, Editor } = field
235
+ const { id, format, label, options, editable = true, predictive = false, multivalue = false, Editor } = field
236
236
 
237
237
  function change(id, value) {
238
238
  if (onChange) onChange(id, value)
@@ -250,6 +250,8 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
250
250
  default:
251
251
  return options ? (
252
252
  <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} predictive={predictive} />
253
+ ) : multivalue ? (
254
+ <TokenField id={id} label={label} onChange={change} readOnly={!editable}/>
253
255
  ) : (
254
256
  <TextField outlined={outlined} id={id} label={label} value={value} onChange={change} readOnly={!editable} />
255
257
  )
@@ -5,7 +5,7 @@ import './ContentEditor.test.css'
5
5
 
6
6
  const schema = {
7
7
  name: { id: "name", type: TYPES.STRING, required: true, label: "Name" },
8
- field1: { id: "field1", type: TYPES.STRING, required: true, label: "field1" },
8
+ field1: { id: "field1", type: TYPES.STRING, required: true, label: "field1", multivalue: true },
9
9
  field2: { id: "field2", type: TYPES.STRING, required: true, label: "field2" },
10
10
  field3: { id: "field3", type: TYPES.STRING, required: true, label: "field3" },
11
11
  }
@@ -45,8 +45,10 @@ export const ContentViewer = (props) => {
45
45
  const FieldViewer = (props) => {
46
46
 
47
47
  const { field, value } = props
48
- const { id, type, item, label } = field
48
+ const { id, type, item, label, visible =t rue } = field
49
49
 
50
+ if (!visible) return null
51
+
50
52
  switch(type) {
51
53
  case TYPES.STRING:
52
54
  return <Property label={label} value={value} />
@@ -271,22 +271,18 @@ const TableFilters = (props) => {
271
271
  }, [schema])
272
272
 
273
273
  useEffect(() => {
274
- console.log("TableFilters onFiltersChange", filters)
275
274
  if (filters) setForm(filters)
276
275
  }, [filters])
277
276
 
278
277
  useEffect(() => {
279
- console.log("TableFilters onFormChanged", filters)
280
278
  reload()
281
279
  }, [form])
282
280
 
283
281
  async function change(next) {
284
- console.log("TableFilters.change()", next)
285
282
  setForm(next)
286
283
  }
287
284
 
288
285
  async function reload() {
289
- console.log("TableFilters.reload()", form)
290
286
  await pageContext.load(form)
291
287
  setPageContext(Object.assign({}, pageContext))
292
288
  }
@@ -6,7 +6,7 @@ import './tokenfield.css'
6
6
  /**
7
7
  * Token Field
8
8
  */
9
- export const TokenField = ({ id, label, init = [], onChange }) => {
9
+ export const TokenField = ({ id, label, init = [], readOnly, onChange }) => {
10
10
  const mounted = useRef(false)
11
11
  const [value, setValue] = useState()
12
12
  const [tokens, setTokens] = useState(init)
@@ -54,7 +54,7 @@ export const TokenField = ({ id, label, init = [], onChange }) => {
54
54
  {tokens.map((text, index) => (
55
55
  <Token text={text} onDelete={() => remove(index)} />
56
56
  ))}
57
- <input type='text' value={value} onChange={change} onKeyDown={onEnter} />
57
+ <input type='text' value={value} onChange={change} onKeyDown={onEnter} readOnly={readOnly}/>
58
58
  </div>
59
59
  )
60
60
  }