ywana-core8 0.0.800 → 0.0.802

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.800",
3
+ "version": "0.0.802",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -219,7 +219,7 @@ export const FieldEditor = ({ field, onChange, content, outlined = false, onRelo
219
219
  * Entity Editor
220
220
  */
221
221
  const EntityEditor = ({ field, value = {}, onChange }) => {
222
- const { id, item, label } = field
222
+ const { id, item, label, outlined=false } = field
223
223
  const content = new Content(item, value)
224
224
 
225
225
  function change(fid, value) {
@@ -258,7 +258,7 @@ const EntityEditor = ({ field, value = {}, onChange }) => {
258
258
  <section key={title}>
259
259
  {title && title.length > 0 ? <header>{title}</header> : null}
260
260
  <main>
261
- {filtered.map((field) => <FieldEditor key={field.id} field={field} onChange={change} outlined={true} content={content} />)}
261
+ {filtered.map((field) => <FieldEditor key={field.id} field={field} onChange={change} outlined={outlined} content={content} />)}
262
262
  </main>
263
263
  </section>
264
264
  ) : null
@@ -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,7 +36,6 @@ export const CollectionContextProvider = (props) => {
34
36
  }, [filters])
35
37
 
36
38
  useEffect(() => {
37
- console.log("Run custom filters", customFilters, all)
38
39
  if (all.length>0) runCustomFilters()
39
40
  }, [all, customFilters])
40
41
 
@@ -48,14 +49,18 @@ export const CollectionContextProvider = (props) => {
48
49
  }
49
50
  */
50
51
 
52
+ setLoading(true)
53
+
51
54
  try {
52
55
  const response = await API.all(filters, likes, page);
53
56
  const next = field ? response[field] : response;
57
+ setLoading(false)
54
58
  //const data = runCustomFilters(next)
55
59
  //return data
56
60
  return next;
57
61
  } catch (error) {
58
62
  console.log(error)
63
+ setLoading(false)
59
64
  }
60
65
  return
61
66
  }
@@ -166,7 +171,10 @@ export const CollectionContextProvider = (props) => {
166
171
  }
167
172
 
168
173
  const value = {
174
+
175
+
169
176
  all,
177
+ loading,
170
178
  load,
171
179
  reload,
172
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
  }