ywana-core8 0.0.419 → 0.0.422

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.419",
3
+ "version": "0.0.422",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -236,7 +236,6 @@ 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)
240
239
  if (onChange) onChange(id, value)
241
240
  }
242
241
 
@@ -21,7 +21,6 @@ const schema = {
21
21
 
22
22
  const value = {
23
23
  name: "John Smith",
24
- field3 : ["1","2","4"]
25
24
  }
26
25
 
27
26
  const ContentEditorTest = (prop) => {
@@ -30,10 +30,17 @@ export const TablePage = (props) => {
30
30
  } = props
31
31
 
32
32
  const [pageContext, setPageContext] = useContext(PageContext)
33
+ const context = TableContext(url, field, host, urlQuery)
33
34
  const { selected } = pageContext
34
35
  const timer = useRef(null)
35
36
  const [form, setForm] = useState(selected)
36
37
 
38
+ useEffect(() => {
39
+ await context.load()
40
+ if (canQuery) await context.loadQueries(user)
41
+ setPageContext(context)
42
+ }, [])
43
+
37
44
  useEffect(() => {
38
45
  setForm(selected)
39
46
  }, [selected])
@@ -47,12 +54,10 @@ export const TablePage = (props) => {
47
54
  }
48
55
  }, [form])
49
56
 
50
- useEffect(async () => {
51
- const context = TableContext(url, field, host, urlQuery)
52
- await context.load()
53
- if (canQuery) await context.loadQueries(user)
54
- setPageContext(context)
55
- }, [])
57
+ async function reload() {
58
+ await pageContext.load()
59
+ setPageContext(Object.assign({}, pageContext))
60
+ }
56
61
 
57
62
  function add() {
58
63
  const onOK = async (form) => {
@@ -130,6 +135,8 @@ export const TablePage = (props) => {
130
135
  <Fragment>
131
136
  <Header className="table-page" title={<Text>{title}</Text>}>
132
137
  {canAdd ? <Button icon="add" label="Añadir" action={add} raised /> : null}
138
+ &nbsp;
139
+ <Button icon="refresh" label="Reload" action={reload} />
133
140
  {dev ? (
134
141
  <MenuIcon align="alignRight">
135
142
  <MenuItem label="Cargar Escenario 1" onSelect={playScenario} />
package/src/html/table.js CHANGED
@@ -146,10 +146,8 @@ const DataTableRow = (props) => {
146
146
  */
147
147
  const DataTableCell = ({ row, column, cell, editable }) => {
148
148
 
149
-
150
149
  const render = (type) => {
151
150
  const { id, disabled = false, min, max, onChange, format, options, item } = column
152
-
153
151
  if (id === "checked") {
154
152
  return <CheckBox id={id} value={cell} onChange={(id, value) => onChange(row.id, id, value)} />
155
153
  } else if (editable && onChange) {
@@ -10,6 +10,10 @@ const TableTest = (prop) => {
10
10
  ]
11
11
  )
12
12
 
13
+ function editCell(row, cell, value) {
14
+ console.log(row, cell, value)
15
+ }
16
+
13
17
  function select(row) {
14
18
  console.log('select',row)
15
19
  }
@@ -24,9 +28,10 @@ const TableTest = (prop) => {
24
28
  }
25
29
 
26
30
  const table = {
31
+ editable: true,
27
32
  columns : [
28
33
  { id: "checked", onChange: check },
29
- { id: "name", label: "Name" },
34
+ { id: "name", label: "Name", type: "String", onChange: editCell},
30
35
  { id: "thumb", label: "Thumb", type: "String", format: "IMG" },
31
36
 
32
37
  ],
@@ -124,7 +124,6 @@ export const DropDown = (props) => {
124
124
  const [label, setLabel] = useState()
125
125
 
126
126
  useEffect(() => {
127
- console.log('DD change value', label)
128
127
  if (Array.isArray(options)) {
129
128
  const option = options.find(option => option.value === value)
130
129
  const label = option ? option.label : ""
@@ -20,8 +20,15 @@ const TextFieldTest = (prop) => {
20
20
  { label: "Five", value: "5" },
21
21
  ]
22
22
 
23
+ const options2 = [
24
+ { label: "YES", value: "true" },
25
+ { label: "NO", value: "false" },
26
+ ]
27
+
28
+ console.log(form)
23
29
  return (
24
30
  <>
31
+ <DropDown id="b1" label="Boolean1" onChange={change} options={options2} value={form.b1} />
25
32
  <TokenField id="token1" label="Tokens" onChange={change} options={options}/>
26
33
  <TextField id="name" label="Name" value={form.name} onChange={change} />
27
34
  <DropDown id="gender1" label="Dropdown 1" value={form.gender1} onChange={change} options={options} predictive={false}/>
@@ -10,7 +10,6 @@ import './tokenfield.css'
10
10
  export const TokenField = ({ id, label, tokens = [], readOnly, options, onChange }) => {
11
11
 
12
12
  const [value, setValue] = useState()
13
- const [open, setOpen] = useState(false)
14
13
 
15
14
  function remove(index) {
16
15
  const next = tokens.slice()
@@ -24,7 +23,7 @@ export const TokenField = ({ id, label, tokens = [], readOnly, options, onChange
24
23
  }
25
24
 
26
25
  function changeDropDown(fid, value) {
27
- const next = tokens.concat(value)
26
+ const next = Array.isArray(tokens) ? tokens.concat(value) : [value]
28
27
  if (onChange) onChange(id, next)
29
28
  setValue('')
30
29
  }
@@ -6,7 +6,7 @@ import { SiteContext, Dialog } from '../../site';
6
6
  /**
7
7
  * Upload Dialog
8
8
  */
9
- export const UploadDialog = ({ label, target, accept, onSuccess, onComplete, onClose }) => {
9
+ export const UploadDialog = ({ label, target, accept, onSuccess, onComplete, onClose, children }) => {
10
10
 
11
11
  const site = useContext(SiteContext);
12
12
 
@@ -35,6 +35,7 @@ export const UploadDialog = ({ label, target, accept, onSuccess, onComplete, onC
35
35
  return (
36
36
  <Dialog title={title} open={true} onAction={onAction} actions={actions}>
37
37
  <Uploader label={label} accept={accept} target={target} onSuccess={success} onComplete={complete} />
38
+ {children}
38
39
  </Dialog>
39
40
  )
40
41
  }