ywana-core8 0.0.531 → 0.0.532
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 +45 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +5 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +45 -26
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +45 -26
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.css +5 -0
- package/src/domain/CollectionPage.js +10 -1
package/package.json
CHANGED
@@ -20,6 +20,11 @@ menu.collection-page>main {
|
|
20
20
|
overflow:auto;
|
21
21
|
}
|
22
22
|
|
23
|
+
menu.collection-page>main>.search-box {
|
24
|
+
border-top: dotted 1px var(--divider-color);
|
25
|
+
padding: 0 1rem 1rem 1rem;
|
26
|
+
}
|
27
|
+
|
23
28
|
main.collection-page {
|
24
29
|
display: flex;
|
25
30
|
flex-direction: column;
|
@@ -169,6 +169,7 @@ export const CollectionTree = (props) => {
|
|
169
169
|
const { icon="description", levels, onSelect, sorter } = props
|
170
170
|
const [pageContext, setPageContext] = useContext(PageContext)
|
171
171
|
const { all = [] } = pageContext
|
172
|
+
const [ filter, setFilter] = useState()
|
172
173
|
|
173
174
|
function clear() {
|
174
175
|
pageContext.clear()
|
@@ -182,6 +183,10 @@ export const CollectionTree = (props) => {
|
|
182
183
|
if (onSelect) onSelect(id)
|
183
184
|
}
|
184
185
|
|
186
|
+
function search(id, value) {
|
187
|
+
setFilter(value)
|
188
|
+
}
|
189
|
+
|
185
190
|
function group(items, by) {
|
186
191
|
return items.reduce((nodes, field) => {
|
187
192
|
let node = nodes.find(n => n.name === field[by])
|
@@ -214,12 +219,16 @@ export const CollectionTree = (props) => {
|
|
214
219
|
}
|
215
220
|
|
216
221
|
const items = sorter ? sorter(all) : all
|
217
|
-
const
|
222
|
+
const items2 = filter ? items.filter(item => item.name.toUpperCase().indexOf(filter.toUpperCase())>= 0) : items
|
223
|
+
const nodes = generateNodes(levels, items2)
|
218
224
|
return (
|
219
225
|
<main>
|
220
226
|
<Tree>
|
221
227
|
{renderNodes(nodes)}
|
222
228
|
</Tree>
|
229
|
+
<div className='search-box'>
|
230
|
+
<TextField icon="search" label="Buscar" onChange={search} outlined className="search-box"/>
|
231
|
+
</div>
|
223
232
|
</main>
|
224
233
|
)
|
225
234
|
}
|