ywana-core8 0.0.713 → 0.0.715
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 +22 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +22 -10
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +22 -10
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain2/CollectionContext.js +7 -2
- package/src/domain2/CollectionFilters.js +7 -2
- package/src/domain2/CollectionList.js +1 -3
- package/src/domain2/CollectionPage.js +2 -2
- package/src/domain2/CollectionPage.test.js +1 -0
- package/src/html/list.js +9 -8
package/dist/index.modern.js
CHANGED
@@ -691,6 +691,7 @@ var GroupedList = function GroupedList(props) {
|
|
691
691
|
var _props$items2 = props.items,
|
692
692
|
items = _props$items2 === void 0 ? [] : _props$items2,
|
693
693
|
children = props.children,
|
694
|
+
selected = props.selected,
|
694
695
|
onSelect = props.onSelect,
|
695
696
|
groupBy = props.groupBy;
|
696
697
|
var groups = items.reduce(function (groups, item) {
|
@@ -722,6 +723,7 @@ var GroupedList = function GroupedList(props) {
|
|
722
723
|
return /*#__PURE__*/React.createElement(ListItem, {
|
723
724
|
key: item.id,
|
724
725
|
item: item,
|
726
|
+
selected: selected,
|
725
727
|
onSelect: onSelect
|
726
728
|
});
|
727
729
|
})));
|
@@ -734,6 +736,7 @@ var GroupedList = function GroupedList(props) {
|
|
734
736
|
|
735
737
|
var ListItem = function ListItem(_ref) {
|
736
738
|
var item = _ref.item,
|
739
|
+
selected = _ref.selected,
|
737
740
|
onSelect = _ref.onSelect;
|
738
741
|
var id = item.id,
|
739
742
|
icon = item.icon,
|
@@ -745,7 +748,9 @@ var ListItem = function ListItem(_ref) {
|
|
745
748
|
if (onSelect) onSelect(id);
|
746
749
|
}
|
747
750
|
|
751
|
+
var style = selected === id ? "selected" : "";
|
748
752
|
return /*#__PURE__*/React.createElement("li", {
|
753
|
+
className: "" + style,
|
749
754
|
onClick: select
|
750
755
|
}, icon ? /*#__PURE__*/React.createElement(Icon, {
|
751
756
|
icon: icon,
|
@@ -10001,7 +10006,7 @@ var CollectionContextProvider = function CollectionContextProvider(props) {
|
|
10001
10006
|
all = _useState[0],
|
10002
10007
|
setAll = _useState[1];
|
10003
10008
|
|
10004
|
-
var _useState2 = useState(
|
10009
|
+
var _useState2 = useState(),
|
10005
10010
|
filters = _useState2[0],
|
10006
10011
|
setFilters = _useState2[1];
|
10007
10012
|
|
@@ -10021,6 +10026,11 @@ var CollectionContextProvider = function CollectionContextProvider(props) {
|
|
10021
10026
|
selected = _useState6[0],
|
10022
10027
|
setSelected = _useState6[1];
|
10023
10028
|
|
10029
|
+
useEffect(function () {
|
10030
|
+
console.log("CONTEXT LOAD", filters, customFilters);
|
10031
|
+
load();
|
10032
|
+
}, [filters, customFilters]);
|
10033
|
+
|
10024
10034
|
function addCustomFilter(id, filter) {
|
10025
10035
|
var _extends2;
|
10026
10036
|
|
@@ -10213,7 +10223,8 @@ var DynamicFormField = function DynamicFormField(props) {
|
|
10213
10223
|
|
10214
10224
|
var CollectionFilters = function CollectionFilters(props) {
|
10215
10225
|
var schema = props.schema,
|
10216
|
-
children = props.children
|
10226
|
+
children = props.children,
|
10227
|
+
value = props.value;
|
10217
10228
|
var context = useContext(CollectionContext);
|
10218
10229
|
var filters = context.filters;
|
10219
10230
|
|
@@ -10222,6 +10233,7 @@ var CollectionFilters = function CollectionFilters(props) {
|
|
10222
10233
|
setOpen = _useState[1];
|
10223
10234
|
|
10224
10235
|
useEffect(function () {
|
10236
|
+
context.setFilters(value);
|
10225
10237
|
var likes = Object.keys(schema).filter(function (id) {
|
10226
10238
|
return schema[id].like === true;
|
10227
10239
|
});
|
@@ -10266,11 +10278,15 @@ var CollectionFilters = function CollectionFilters(props) {
|
|
10266
10278
|
onChange: change
|
10267
10279
|
})) : null);
|
10268
10280
|
};
|
10281
|
+
/**
|
10282
|
+
* Collection Filters Resume
|
10283
|
+
*/
|
10269
10284
|
|
10270
10285
|
var CollectionFiltersResume = function CollectionFiltersResume(props) {
|
10271
10286
|
var schema = props.schema;
|
10272
10287
|
var context = useContext(CollectionContext);
|
10273
10288
|
var filters = context.filters;
|
10289
|
+
if (!filters) return null;
|
10274
10290
|
var fields = Object.keys(filters);
|
10275
10291
|
if (!fields.length) return null;
|
10276
10292
|
return /*#__PURE__*/React.createElement(Fragment, null, fields.filter(function (id) {
|
@@ -10299,18 +10315,12 @@ var CollectionList = function CollectionList(props) {
|
|
10299
10315
|
searchBy = _props$searchBy === void 0 ? [] : _props$searchBy;
|
10300
10316
|
var context = useContext(CollectionContext);
|
10301
10317
|
var _context$all = context.all,
|
10302
|
-
all = _context$all === void 0 ? [] : _context$all
|
10303
|
-
filters = context.filters,
|
10304
|
-
customFilters = context.customFilters;
|
10318
|
+
all = _context$all === void 0 ? [] : _context$all;
|
10305
10319
|
|
10306
10320
|
var _useState = useState(''),
|
10307
10321
|
search = _useState[0],
|
10308
10322
|
setSearch = _useState[1];
|
10309
10323
|
|
10310
|
-
useEffect(function () {
|
10311
|
-
context.load();
|
10312
|
-
}, [filters, customFilters]);
|
10313
|
-
|
10314
10324
|
function changeSearch(id, value) {
|
10315
10325
|
setSearch(value);
|
10316
10326
|
}
|
@@ -10375,6 +10385,7 @@ var CollectionPage = function CollectionPage(props) {
|
|
10375
10385
|
actions = props.actions,
|
10376
10386
|
canFilter = props.canFilter,
|
10377
10387
|
customFilters = props.customFilters,
|
10388
|
+
filtersValue = props.filtersValue,
|
10378
10389
|
listGroupBy = props.listGroupBy,
|
10379
10390
|
listSearchBy = props.listSearchBy,
|
10380
10391
|
listItemRenderer = props.listItemRenderer,
|
@@ -10387,7 +10398,8 @@ var CollectionPage = function CollectionPage(props) {
|
|
10387
10398
|
}, /*#__PURE__*/React.createElement(Header, {
|
10388
10399
|
title: title
|
10389
10400
|
}, actions), canFilter ? /*#__PURE__*/React.createElement(CollectionFilters, {
|
10390
|
-
schema: schema
|
10401
|
+
schema: schema,
|
10402
|
+
value: filtersValue
|
10391
10403
|
}, customFilters) : null, /*#__PURE__*/React.createElement(CollectionList, {
|
10392
10404
|
itemRenderer: listItemRenderer,
|
10393
10405
|
groupBy: listGroupBy,
|