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.cjs
CHANGED
@@ -699,6 +699,7 @@ var GroupedList = function GroupedList(props) {
|
|
699
699
|
var _props$items2 = props.items,
|
700
700
|
items = _props$items2 === void 0 ? [] : _props$items2,
|
701
701
|
children = props.children,
|
702
|
+
selected = props.selected,
|
702
703
|
onSelect = props.onSelect,
|
703
704
|
groupBy = props.groupBy;
|
704
705
|
var groups = items.reduce(function (groups, item) {
|
@@ -730,6 +731,7 @@ var GroupedList = function GroupedList(props) {
|
|
730
731
|
return /*#__PURE__*/React__default["default"].createElement(ListItem, {
|
731
732
|
key: item.id,
|
732
733
|
item: item,
|
734
|
+
selected: selected,
|
733
735
|
onSelect: onSelect
|
734
736
|
});
|
735
737
|
})));
|
@@ -742,6 +744,7 @@ var GroupedList = function GroupedList(props) {
|
|
742
744
|
|
743
745
|
var ListItem = function ListItem(_ref) {
|
744
746
|
var item = _ref.item,
|
747
|
+
selected = _ref.selected,
|
745
748
|
onSelect = _ref.onSelect;
|
746
749
|
var id = item.id,
|
747
750
|
icon = item.icon,
|
@@ -753,7 +756,9 @@ var ListItem = function ListItem(_ref) {
|
|
753
756
|
if (onSelect) onSelect(id);
|
754
757
|
}
|
755
758
|
|
759
|
+
var style = selected === id ? "selected" : "";
|
756
760
|
return /*#__PURE__*/React__default["default"].createElement("li", {
|
761
|
+
className: "" + style,
|
757
762
|
onClick: select
|
758
763
|
}, icon ? /*#__PURE__*/React__default["default"].createElement(Icon, {
|
759
764
|
icon: icon,
|
@@ -10009,7 +10014,7 @@ var CollectionContextProvider = function CollectionContextProvider(props) {
|
|
10009
10014
|
all = _useState[0],
|
10010
10015
|
setAll = _useState[1];
|
10011
10016
|
|
10012
|
-
var _useState2 = React.useState(
|
10017
|
+
var _useState2 = React.useState(),
|
10013
10018
|
filters = _useState2[0],
|
10014
10019
|
setFilters = _useState2[1];
|
10015
10020
|
|
@@ -10029,6 +10034,11 @@ var CollectionContextProvider = function CollectionContextProvider(props) {
|
|
10029
10034
|
selected = _useState6[0],
|
10030
10035
|
setSelected = _useState6[1];
|
10031
10036
|
|
10037
|
+
React.useEffect(function () {
|
10038
|
+
console.log("CONTEXT LOAD", filters, customFilters);
|
10039
|
+
load();
|
10040
|
+
}, [filters, customFilters]);
|
10041
|
+
|
10032
10042
|
function addCustomFilter(id, filter) {
|
10033
10043
|
var _extends2;
|
10034
10044
|
|
@@ -10221,7 +10231,8 @@ var DynamicFormField = function DynamicFormField(props) {
|
|
10221
10231
|
|
10222
10232
|
var CollectionFilters = function CollectionFilters(props) {
|
10223
10233
|
var schema = props.schema,
|
10224
|
-
children = props.children
|
10234
|
+
children = props.children,
|
10235
|
+
value = props.value;
|
10225
10236
|
var context = React.useContext(CollectionContext);
|
10226
10237
|
var filters = context.filters;
|
10227
10238
|
|
@@ -10230,6 +10241,7 @@ var CollectionFilters = function CollectionFilters(props) {
|
|
10230
10241
|
setOpen = _useState[1];
|
10231
10242
|
|
10232
10243
|
React.useEffect(function () {
|
10244
|
+
context.setFilters(value);
|
10233
10245
|
var likes = Object.keys(schema).filter(function (id) {
|
10234
10246
|
return schema[id].like === true;
|
10235
10247
|
});
|
@@ -10274,11 +10286,15 @@ var CollectionFilters = function CollectionFilters(props) {
|
|
10274
10286
|
onChange: change
|
10275
10287
|
})) : null);
|
10276
10288
|
};
|
10289
|
+
/**
|
10290
|
+
* Collection Filters Resume
|
10291
|
+
*/
|
10277
10292
|
|
10278
10293
|
var CollectionFiltersResume = function CollectionFiltersResume(props) {
|
10279
10294
|
var schema = props.schema;
|
10280
10295
|
var context = React.useContext(CollectionContext);
|
10281
10296
|
var filters = context.filters;
|
10297
|
+
if (!filters) return null;
|
10282
10298
|
var fields = Object.keys(filters);
|
10283
10299
|
if (!fields.length) return null;
|
10284
10300
|
return /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, fields.filter(function (id) {
|
@@ -10307,18 +10323,12 @@ var CollectionList = function CollectionList(props) {
|
|
10307
10323
|
searchBy = _props$searchBy === void 0 ? [] : _props$searchBy;
|
10308
10324
|
var context = React.useContext(CollectionContext);
|
10309
10325
|
var _context$all = context.all,
|
10310
|
-
all = _context$all === void 0 ? [] : _context$all
|
10311
|
-
filters = context.filters,
|
10312
|
-
customFilters = context.customFilters;
|
10326
|
+
all = _context$all === void 0 ? [] : _context$all;
|
10313
10327
|
|
10314
10328
|
var _useState = React.useState(''),
|
10315
10329
|
search = _useState[0],
|
10316
10330
|
setSearch = _useState[1];
|
10317
10331
|
|
10318
|
-
React.useEffect(function () {
|
10319
|
-
context.load();
|
10320
|
-
}, [filters, customFilters]);
|
10321
|
-
|
10322
10332
|
function changeSearch(id, value) {
|
10323
10333
|
setSearch(value);
|
10324
10334
|
}
|
@@ -10383,6 +10393,7 @@ var CollectionPage = function CollectionPage(props) {
|
|
10383
10393
|
actions = props.actions,
|
10384
10394
|
canFilter = props.canFilter,
|
10385
10395
|
customFilters = props.customFilters,
|
10396
|
+
filtersValue = props.filtersValue,
|
10386
10397
|
listGroupBy = props.listGroupBy,
|
10387
10398
|
listSearchBy = props.listSearchBy,
|
10388
10399
|
listItemRenderer = props.listItemRenderer,
|
@@ -10395,7 +10406,8 @@ var CollectionPage = function CollectionPage(props) {
|
|
10395
10406
|
}, /*#__PURE__*/React__default["default"].createElement(Header, {
|
10396
10407
|
title: title
|
10397
10408
|
}, actions), canFilter ? /*#__PURE__*/React__default["default"].createElement(CollectionFilters, {
|
10398
|
-
schema: schema
|
10409
|
+
schema: schema,
|
10410
|
+
value: filtersValue
|
10399
10411
|
}, customFilters) : null, /*#__PURE__*/React__default["default"].createElement(CollectionList, {
|
10400
10412
|
itemRenderer: listItemRenderer,
|
10401
10413
|
groupBy: listGroupBy,
|