ywana-core8 0.0.420 → 0.0.423
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/dist/index.cjs +30 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +30 -19
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +30 -19
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/TablePage.js +13 -6
- package/src/html/table.js +0 -2
- package/src/html/table.test.js +6 -1
- package/src/html/textfield.js +0 -1
- package/src/html/textfield.test.js +7 -0
- package/src/html/tokenfield.js +0 -1
- package/src/widgets/upload/UploadDialog.js +2 -1
package/package.json
CHANGED
package/src/domain/TablePage.js
CHANGED
@@ -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(async () => {
|
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
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
+
|
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) {
|
package/src/html/table.test.js
CHANGED
@@ -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
|
],
|
package/src/html/textfield.js
CHANGED
@@ -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}/>
|
package/src/html/tokenfield.js
CHANGED
@@ -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()
|
@@ -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
|
}
|