ywana-core8 0.0.799 → 0.0.801
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 +16 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +15 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +16 -5
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +16 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain2/CollectionContext.js +11 -2
- package/src/domain2/CollectionList.css +15 -0
- package/src/domain2/CollectionList.js +3 -2
package/package.json
CHANGED
@@ -21,6 +21,8 @@ export const CollectionContextProvider = (props) => {
|
|
21
21
|
const [queries, setQueries] = useState([])
|
22
22
|
const [selected, setSelected] = useState(null)
|
23
23
|
|
24
|
+
const [loading, setLoading] = useState(false)
|
25
|
+
|
24
26
|
useEffect(() => {
|
25
27
|
let mounted = true;
|
26
28
|
const callLoad = async () => {
|
@@ -34,8 +36,8 @@ export const CollectionContextProvider = (props) => {
|
|
34
36
|
}, [filters])
|
35
37
|
|
36
38
|
useEffect(() => {
|
37
|
-
runCustomFilters()
|
38
|
-
}, [customFilters])
|
39
|
+
if (all.length>0) runCustomFilters()
|
40
|
+
}, [all, customFilters])
|
39
41
|
|
40
42
|
async function load() {
|
41
43
|
|
@@ -47,14 +49,18 @@ export const CollectionContextProvider = (props) => {
|
|
47
49
|
}
|
48
50
|
*/
|
49
51
|
|
52
|
+
setLoading(true)
|
53
|
+
|
50
54
|
try {
|
51
55
|
const response = await API.all(filters, likes, page);
|
52
56
|
const next = field ? response[field] : response;
|
57
|
+
setLoading(false)
|
53
58
|
//const data = runCustomFilters(next)
|
54
59
|
//return data
|
55
60
|
return next;
|
56
61
|
} catch (error) {
|
57
62
|
console.log(error)
|
63
|
+
setLoading(false)
|
58
64
|
}
|
59
65
|
return
|
60
66
|
}
|
@@ -165,7 +171,10 @@ export const CollectionContextProvider = (props) => {
|
|
165
171
|
}
|
166
172
|
|
167
173
|
const value = {
|
174
|
+
|
175
|
+
|
168
176
|
all,
|
177
|
+
loading,
|
169
178
|
load,
|
170
179
|
reload,
|
171
180
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
.collection-list {
|
2
|
+
position: relative;
|
2
3
|
overflow: hidden;
|
3
4
|
display: flex;
|
4
5
|
flex-direction: column;
|
@@ -14,4 +15,18 @@
|
|
14
15
|
padding: .5rem;
|
15
16
|
display: flex;
|
16
17
|
align-items: center;
|
18
|
+
}
|
19
|
+
|
20
|
+
.collection-list .loading {
|
21
|
+
position: absolute;
|
22
|
+
top: 0;
|
23
|
+
left: 0;
|
24
|
+
right: 0;
|
25
|
+
bottom: 0;
|
26
|
+
background-color: rgba(255, 255, 255, .5);
|
27
|
+
display: flex;
|
28
|
+
justify-content: center;
|
29
|
+
align-items: center;
|
30
|
+
width: 100%;
|
31
|
+
height: 100%;
|
17
32
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React, { useContext, useEffect, useState } from 'react'
|
2
|
-
import { List, TextField, Icon } from '../html'
|
2
|
+
import { List, TextField, Icon, CircularProgress } from '../html'
|
3
3
|
import { CollectionContext } from './CollectionContext'
|
4
4
|
import './CollectionList.css'
|
5
5
|
|
@@ -10,7 +10,7 @@ export const CollectionList = (props) => {
|
|
10
10
|
|
11
11
|
const { itemRenderer, groupBy, groupRenderer, searchBy = [], sortBy, sortDir } = props
|
12
12
|
const context = useContext(CollectionContext)
|
13
|
-
const { all = [], filtered=[], selected, filters, customFilters } = context
|
13
|
+
const { all = [], filtered=[], selected, filters, customFilters, loading } = context
|
14
14
|
const [search, setSearch] = useState('')
|
15
15
|
|
16
16
|
function changeSearch(id, value) {
|
@@ -56,6 +56,7 @@ export const CollectionList = (props) => {
|
|
56
56
|
<TextField onChange={changeSearch} outlined />
|
57
57
|
</div>
|
58
58
|
) : null}
|
59
|
+
{ loading ? <div className="loading"><CircularProgress /></div> : null}
|
59
60
|
</div>
|
60
61
|
)
|
61
62
|
}
|