ywana-core8 0.0.704 → 0.0.706
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 +12 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +47 -38
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +12 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain2/CollectionFilters.js +15 -6
package/package.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import React, { useContext, useEffect, useState } from 'react'
|
2
|
-
import { Icon
|
1
|
+
import React, { Fragment, useContext, useEffect, useState } from 'react'
|
2
|
+
import { Icon } from '../html'
|
3
3
|
import { CollectionContext } from './CollectionContext'
|
4
4
|
import { DynamicForm } from './DynamicForm'
|
5
5
|
import './CollectionFilters.css'
|
@@ -15,7 +15,7 @@ export const CollectionFilters = (props) => {
|
|
15
15
|
const [open, setOpen] = useState(false)
|
16
16
|
|
17
17
|
useEffect(() => {
|
18
|
-
const likes = Object.keys(schema).filter(id => schema[id].
|
18
|
+
const likes = Object.keys(schema).filter(id => schema[id].like === true)
|
19
19
|
context.setLikes(likes)
|
20
20
|
}, [schema])
|
21
21
|
|
@@ -28,6 +28,15 @@ export const CollectionFilters = (props) => {
|
|
28
28
|
}
|
29
29
|
|
30
30
|
const toggleIcon = open ? "expand_less" : "expand_more"
|
31
|
+
|
32
|
+
const schema2 = Object.keys(schema).reduce((acc, id) => {
|
33
|
+
const item = schema[id]
|
34
|
+
if (item.filter === true) {
|
35
|
+
acc[id] = item
|
36
|
+
}
|
37
|
+
return acc
|
38
|
+
}, {})
|
39
|
+
|
31
40
|
return (
|
32
41
|
<div className="collection-filters">
|
33
42
|
<header>
|
@@ -38,7 +47,7 @@ export const CollectionFilters = (props) => {
|
|
38
47
|
<Icon icon={toggleIcon} clickable action={toggle} />
|
39
48
|
</header>
|
40
49
|
{open ? <div className='dynamic-filters'>
|
41
|
-
<DynamicForm schema={
|
50
|
+
<DynamicForm schema={schema2} values={filters} onChange={change} />
|
42
51
|
</div> : null}
|
43
52
|
</div>
|
44
53
|
)
|
@@ -54,7 +63,7 @@ const CollectionFiltersResume = (props) => {
|
|
54
63
|
if (!fields.length) return null
|
55
64
|
|
56
65
|
return (
|
57
|
-
|
66
|
+
<Fragment>
|
58
67
|
{fields
|
59
68
|
.filter(id => filters[id] !== undefined && filters[id] !== null && filters[id] !== "")
|
60
69
|
.map(id => {
|
@@ -67,6 +76,6 @@ const CollectionFiltersResume = (props) => {
|
|
67
76
|
</div>
|
68
77
|
)
|
69
78
|
})}
|
70
|
-
|
79
|
+
</Fragment>
|
71
80
|
)
|
72
81
|
}
|