ywana-core8 0.0.569 → 0.0.570
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 +10 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +10 -6
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +10 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/html/textfield.js +5 -4
- package/src/html/textfield.test.js +1 -0
- package/src/html/tokenfield.js +3 -2
package/package.json
CHANGED
package/src/html/textfield.js
CHANGED
@@ -150,12 +150,13 @@ export const DropDown = (props) => {
|
|
150
150
|
if (!readOnly) setOpen(!open)
|
151
151
|
}
|
152
152
|
|
153
|
-
function select(
|
154
|
-
const next =
|
153
|
+
function select(value) {
|
154
|
+
const next = value
|
155
155
|
const option = options.find(option => option.value === next)
|
156
156
|
setOpen(false)
|
157
157
|
const label = verbose ? option.label : ""
|
158
158
|
setLabel(label)
|
159
|
+
console.log("dd.select", value)
|
159
160
|
if (onChange) onChange(id, next)
|
160
161
|
}
|
161
162
|
|
@@ -168,8 +169,8 @@ export const DropDown = (props) => {
|
|
168
169
|
if (canShow) {
|
169
170
|
const filterActive = predictive === true && label && label.length > 0
|
170
171
|
const items = filterActive ? options.filter(option => option.label.toUpperCase().indexOf(label.toUpperCase()) >= 0) : options
|
171
|
-
const lis = items.map(option => <li key={option.value} value={option.value}><Text>{option.label}</Text></li>)
|
172
|
-
return <menu><ul
|
172
|
+
const lis = items.map(option => <li key={option.value} value={option.value} onClick={() => select(option.value)}><Text>{option.label}</Text></li>)
|
173
|
+
return <menu><ul>{lis}</ul></menu>
|
173
174
|
} else {
|
174
175
|
return null
|
175
176
|
}
|
@@ -30,6 +30,7 @@ const TextFieldTest = (prop) => {
|
|
30
30
|
<>
|
31
31
|
<DropDown id="b1" label="Boolean1" onChange={change} options={options2} value={form.b1} />
|
32
32
|
<TokenField id="token1" label="Tokens" onChange={change} />
|
33
|
+
<TokenField id="token2" label="Tokens DropDown" onChange={change} options={options} tokens={form.token2}/>
|
33
34
|
<TextField id="name" label="Name" value={form.name} onChange={change} />
|
34
35
|
<DropDown id="gender1" label="Dropdown 1" value={form.gender1} onChange={change} options={options} predictive={false}/>
|
35
36
|
<DropDown id="gender2" label="Dropdown 2" value={form.gender2} onChange={change} options={options} predictive={true}/>
|
package/src/html/tokenfield.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, {
|
1
|
+
import React, { useState } from 'react'
|
2
2
|
import { Icon } from './icon';
|
3
3
|
import { Text } from './text';
|
4
4
|
import { DropDown } from './textfield';
|
@@ -24,6 +24,7 @@ export const TokenField = ({ id, label, tokens = [], readOnly, options, onChange
|
|
24
24
|
|
25
25
|
function changeDropDown(fid, value) {
|
26
26
|
const next = Array.isArray(tokens) ? tokens.concat(value) : [value]
|
27
|
+
console.log("next", next)
|
27
28
|
if (onChange) onChange(id, next)
|
28
29
|
setValue('')
|
29
30
|
}
|
@@ -47,7 +48,7 @@ export const TokenField = ({ id, label, tokens = [], readOnly, options, onChange
|
|
47
48
|
}
|
48
49
|
|
49
50
|
const tks = Array.isArray(tokens) ? tokens : []
|
50
|
-
|
51
|
+
console.log("render", tks)
|
51
52
|
return (
|
52
53
|
<div className='tokenField'>
|
53
54
|
<label>{label}</label>
|