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 CHANGED
@@ -11022,9 +11022,11 @@ var CollectionContextProvider = function CollectionContextProvider(props) {
11022
11022
  return data
11023
11023
  }
11024
11024
  */
11025
+ setLoading(true);
11025
11026
  return Promise.resolve(_catch(function () {
11026
11027
  return Promise.resolve(API.all(filters, likes, page)).then(function (response) {
11027
- var next = field ? response[field] : response; //const data = runCustomFilters(next)
11028
+ var next = field ? response[field] : response;
11029
+ setLoading(false); //const data = runCustomFilters(next)
11028
11030
  //return data
11029
11031
 
11030
11032
  _exit2 = 1;
@@ -11032,6 +11034,7 @@ var CollectionContextProvider = function CollectionContextProvider(props) {
11032
11034
  });
11033
11035
  }, function (error) {
11034
11036
  console.log(error);
11037
+ setLoading(false);
11035
11038
  }));
11036
11039
  } catch (e) {
11037
11040
  return Promise.reject(e);
@@ -11078,6 +11081,10 @@ var CollectionContextProvider = function CollectionContextProvider(props) {
11078
11081
  selected = _useState7[0],
11079
11082
  setSelected = _useState7[1];
11080
11083
 
11084
+ var _useState8 = React.useState(false),
11085
+ loading = _useState8[0],
11086
+ setLoading = _useState8[1];
11087
+
11081
11088
  React.useEffect(function () {
11082
11089
  var mounted = true;
11083
11090
 
@@ -11093,8 +11100,8 @@ var CollectionContextProvider = function CollectionContextProvider(props) {
11093
11100
  };
11094
11101
  }, [filters]);
11095
11102
  React.useEffect(function () {
11096
- runCustomFilters();
11097
- }, [customFilters]);
11103
+ if (all.length > 0) runCustomFilters();
11104
+ }, [all, customFilters]);
11098
11105
 
11099
11106
  function clearSelection() {
11100
11107
  setSelected(null);
@@ -11110,6 +11117,7 @@ var CollectionContextProvider = function CollectionContextProvider(props) {
11110
11117
 
11111
11118
  var value = {
11112
11119
  all: all,
11120
+ loading: loading,
11113
11121
  load: load,
11114
11122
  reload: reload,
11115
11123
  selected: selected,
@@ -11406,7 +11414,8 @@ var CollectionList = function CollectionList(props) {
11406
11414
  var context = React.useContext(CollectionContext);
11407
11415
  var _context$filtered = context.filtered,
11408
11416
  filtered = _context$filtered === void 0 ? [] : _context$filtered,
11409
- selected = context.selected;
11417
+ selected = context.selected,
11418
+ loading = context.loading;
11410
11419
 
11411
11420
  var _useState = React.useState(''),
11412
11421
  search = _useState[0],
@@ -11458,7 +11467,9 @@ var CollectionList = function CollectionList(props) {
11458
11467
  }), /*#__PURE__*/React__default["default"].createElement(TextField, {
11459
11468
  onChange: changeSearch,
11460
11469
  outlined: true
11461
- })) : null);
11470
+ })) : null, loading ? /*#__PURE__*/React__default["default"].createElement("div", {
11471
+ className: "loading"
11472
+ }, /*#__PURE__*/React__default["default"].createElement(CircularProgress, null)) : null);
11462
11473
  };
11463
11474
 
11464
11475
  /**