ywana-core8 0.0.797 → 0.0.798
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 +37 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +37 -18
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +37 -18
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain2/CollectionContext.js +22 -4
- package/src/domain2/CollectionContext.test.js +20 -7
- package/src/domain2/CollectionList.js +2 -2
package/dist/index.umd.js
CHANGED
@@ -11009,20 +11009,20 @@
|
|
11009
11009
|
try {
|
11010
11010
|
var _exit2;
|
11011
11011
|
|
11012
|
-
|
11013
|
-
|
11014
|
-
|
11015
|
-
|
11016
|
-
|
11017
|
-
|
11018
|
-
|
11019
|
-
|
11012
|
+
/*
|
11013
|
+
const runCustomFilters = (all) => {
|
11014
|
+
const cfs = Object.values(customFilters)
|
11015
|
+
const data = cfs.length ? cfs.reduce((acc, filter) => filter(acc), all) : all;
|
11016
|
+
return data
|
11017
|
+
}
|
11018
|
+
*/
|
11020
11019
|
return Promise.resolve(_catch(function () {
|
11021
11020
|
return Promise.resolve(API.all(filters, likes, page)).then(function (response) {
|
11022
|
-
var next = field ? response[field] : response;
|
11023
|
-
|
11021
|
+
var next = field ? response[field] : response; //const data = runCustomFilters(next)
|
11022
|
+
//return data
|
11023
|
+
|
11024
11024
|
_exit2 = 1;
|
11025
|
-
return
|
11025
|
+
return next;
|
11026
11026
|
});
|
11027
11027
|
}, function (error) {
|
11028
11028
|
console.log(error);
|
@@ -11061,12 +11061,16 @@
|
|
11061
11061
|
setCustomFilters = _useState4[1];
|
11062
11062
|
|
11063
11063
|
var _useState5 = React.useState([]),
|
11064
|
-
|
11065
|
-
|
11064
|
+
filtered = _useState5[0],
|
11065
|
+
setFiltered = _useState5[1];
|
11066
|
+
|
11067
|
+
var _useState6 = React.useState([]),
|
11068
|
+
queries = _useState6[0],
|
11069
|
+
setQueries = _useState6[1];
|
11066
11070
|
|
11067
|
-
var
|
11068
|
-
selected =
|
11069
|
-
setSelected =
|
11071
|
+
var _useState7 = React.useState(null),
|
11072
|
+
selected = _useState7[0],
|
11073
|
+
setSelected = _useState7[1];
|
11070
11074
|
|
11071
11075
|
React.useEffect(function () {
|
11072
11076
|
var mounted = true;
|
@@ -11081,12 +11085,23 @@
|
|
11081
11085
|
return function () {
|
11082
11086
|
mounted = false;
|
11083
11087
|
};
|
11084
|
-
}, [filters
|
11088
|
+
}, [filters]);
|
11089
|
+
React.useEffect(function () {
|
11090
|
+
runCustomFilters();
|
11091
|
+
}, [customFilters]);
|
11085
11092
|
|
11086
11093
|
function clearSelection() {
|
11087
11094
|
setSelected(null);
|
11088
11095
|
}
|
11089
11096
|
|
11097
|
+
function runCustomFilters() {
|
11098
|
+
var cfs = Object.values(customFilters);
|
11099
|
+
var data = cfs.length ? cfs.reduce(function (acc, filter) {
|
11100
|
+
return filter(acc);
|
11101
|
+
}, all) : all;
|
11102
|
+
setFiltered(data);
|
11103
|
+
}
|
11104
|
+
|
11090
11105
|
var value = {
|
11091
11106
|
all: all,
|
11092
11107
|
load: load,
|
@@ -11098,6 +11113,8 @@
|
|
11098
11113
|
setFilters: setFilters,
|
11099
11114
|
setLikes: setLikes,
|
11100
11115
|
customFilters: customFilters,
|
11116
|
+
filtered: filtered,
|
11117
|
+
runCustomFilters: runCustomFilters,
|
11101
11118
|
addCustomFilter: addCustomFilter,
|
11102
11119
|
removeCustomFilter: removeCustomFilter,
|
11103
11120
|
queries: queries,
|
@@ -11383,6 +11400,8 @@
|
|
11383
11400
|
var context = React.useContext(CollectionContext);
|
11384
11401
|
var _context$all = context.all,
|
11385
11402
|
all = _context$all === void 0 ? [] : _context$all,
|
11403
|
+
_context$filtered = context.filtered,
|
11404
|
+
filtered = _context$filtered === void 0 ? [] : _context$filtered,
|
11386
11405
|
selected = context.selected;
|
11387
11406
|
|
11388
11407
|
var _useState = React.useState(''),
|
@@ -11397,7 +11416,7 @@
|
|
11397
11416
|
context.select(id);
|
11398
11417
|
}
|
11399
11418
|
|
11400
|
-
var searched = searchBy.length > 0 && search.length > 0 ?
|
11419
|
+
var searched = searchBy.length > 0 && search.length > 0 ? filtered.filter(function (item) {
|
11401
11420
|
var text = searchBy.map(function (field) {
|
11402
11421
|
return item[field];
|
11403
11422
|
}).join(' ').toLowerCase();
|