ywana-core8 0.0.415 → 0.0.418

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.415",
3
+ "version": "0.0.418",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -236,6 +236,7 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
236
236
  const { id, format, label, options, editable = true, predictive = false, multivalue = false, Editor } = field
237
237
 
238
238
  function change(id, value) {
239
+ console.log(id,value)
239
240
  if (onChange) onChange(id, value)
240
241
  }
241
242
 
@@ -249,7 +250,8 @@ export const StringEditor = ({ field, value = '', onChange, content, outlined })
249
250
  case FORMATS.COLOR: return <ColorField id={id} onChange={change} value={value}/>
250
251
  case FORMATS.HTML: return <Editor id={id} value={value} onChange={change} content={content} />
251
252
  case FORMATS.DATE: return <TextField outlined={outlined} id={id} type="date" label={label} value={value} onChange={change} readOnly={!editable} />
252
- case FORMATS.TOKENS: return <TokenField id={id} label={label} onChange={change} readOnly={!editable} options={buildOptions()} />
253
+ case FORMATS.TOKENS:
254
+ return <TokenField id={id} label={label} onChange={change} options={buildOptions()} tokens={value} />
253
255
  default:
254
256
  return options ? (
255
257
  <DropDown outlined={outlined} id={id} label={label} value={value} onChange={change} options={buildOptions()} readOnly={!editable} predictive={predictive} />
@@ -20,7 +20,8 @@ const schema = {
20
20
  }
21
21
 
22
22
  const value = {
23
- name: "John Smith"
23
+ name: "John Smith",
24
+ field3 : ["1","2","4"]
24
25
  }
25
26
 
26
27
  const ContentEditorTest = (prop) => {
@@ -32,7 +33,6 @@ const ContentEditorTest = (prop) => {
32
33
  }
33
34
 
34
35
  const content = new Content(schema, form)
35
- console.log(form)
36
36
  return (
37
37
  <>
38
38
  <ContentEditor content={content} outlined={false} onChange={change} className="grid1"/>
@@ -273,12 +273,6 @@ const TableFilters = (props) => {
273
273
  if (fs[key].filter === false) delete fs[key]
274
274
  }
275
275
  }
276
-
277
- if (filterSchema[key].defValue) {
278
- const next = Object.assign(filters. {[key] : filterSchema[key].defValue})
279
- pageContext.changeFilters(next)
280
- }
281
-
282
276
  }
283
277
  }
284
278
  //Object.values(filterSchema).forEach(field => field.section = null)
package/src/html/table.js CHANGED
@@ -230,7 +230,6 @@ const StringCellViewer = ({ id, value, format, options }) => {
230
230
  text = new Date(text).toLocaleString( locale, { year: 'hour', month: 'minute', day: 'second' });
231
231
  break;
232
232
  }
233
- console.log(value, format)
234
233
  return (<div className="field-editor string-viewer">{text}</div>)
235
234
  }
236
235
 
@@ -7,26 +7,15 @@ import './tokenfield.css'
7
7
  /**
8
8
  * Token Field
9
9
  */
10
- export const TokenField = ({ id, label, init = [], readOnly, options, onChange }) => {
11
- const mounted = useRef(false)
10
+ export const TokenField = ({ id, label, tokens = [], readOnly, options, onChange }) => {
11
+
12
12
  const [value, setValue] = useState()
13
- const [tokens, setTokens] = useState(init)
14
13
  const [open, setOpen] = useState(false)
15
14
 
16
- useEffect(() => {
17
- if (mounted.current) {
18
- if (onChange) {
19
- if (tokens) onChange(id, tokens)
20
- }
21
- } else {
22
- mounted.current = true
23
- }
24
- }, [tokens])
25
-
26
15
  function remove(index) {
27
16
  const next = tokens.slice()
28
17
  next.splice(index, 1)
29
- setTokens(next)
18
+ if (onChange) onChange(id, next)
30
19
  }
31
20
 
32
21
  function change(event) {
@@ -34,10 +23,10 @@ export const TokenField = ({ id, label, init = [], readOnly, options, onChange }
34
23
  setValue(value)
35
24
  }
36
25
 
37
- function changeDropDown(id, value) {
26
+ function changeDropDown(fid, value) {
38
27
  const next = tokens.concat(value)
39
- setTokens(next)
40
- setValue('xxx')
28
+ if (onChange) onChange(id, next)
29
+ setValue('')
41
30
  }
42
31
 
43
32
  function onEnter(event) {
@@ -46,7 +35,7 @@ export const TokenField = ({ id, label, init = [], readOnly, options, onChange }
46
35
  event.stopPropagation()
47
36
  const token = event.target.value
48
37
  const next = tokens.concat(token)
49
- setTokens(next)
38
+ if (onChange) onChange(id, next)
50
39
  setValue('')
51
40
  }
52
41