ywana-core8 0.0.744 → 0.0.746

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
@@ -5976,7 +5976,8 @@ var CollectionPage$1 = function CollectionPage(props) {
5976
5976
  groupBy: groupBy,
5977
5977
  onSelect: onSelect,
5978
5978
  searchBy: searchBy,
5979
- itemRenderer: listItemRenderer
5979
+ itemRenderer: listItemRenderer,
5980
+ sorter: sorter
5980
5981
  })), /*#__PURE__*/React__default["default"].createElement("main", {
5981
5982
  key: id,
5982
5983
  className: "collection-page " + className
@@ -6126,7 +6127,8 @@ var CollectionList$1 = function CollectionList(props) {
6126
6127
  onSelect = props.onSelect,
6127
6128
  _props$searchBy = props.searchBy,
6128
6129
  searchBy = _props$searchBy === void 0 ? [] : _props$searchBy,
6129
- itemRenderer = props.itemRenderer;
6130
+ itemRenderer = props.itemRenderer,
6131
+ sorter = props.sorter;
6130
6132
 
6131
6133
  var _useContext3 = React.useContext(PageContext),
6132
6134
  pageContext = _useContext3[0],
@@ -6159,8 +6161,9 @@ var CollectionList$1 = function CollectionList(props) {
6159
6161
  return items;
6160
6162
  }
6161
6163
 
6162
- var items = search();
6163
- var items2 = items.map(function (content) {
6164
+ var searched = search();
6165
+ var sorted = sorter ? sorter(searched) : searched;
6166
+ var items2 = sorted.map(function (content) {
6164
6167
  if (itemRenderer) return itemRenderer(content);
6165
6168
  return {
6166
6169
  id: content.id,
@@ -6304,7 +6307,7 @@ var CollectionTree = function CollectionTree(props) {
6304
6307
  function search() {
6305
6308
  var items = filter ? all.filter(function (item) {
6306
6309
  var result = searchBy.some(function (fieldName) {
6307
- var value = item[fieldName];
6310
+ var value = item[fieldName] ? item[fieldName].toUpperCase() : "";
6308
6311
  return value ? value.indexOf(filter.toUpperCase()) >= 0 : false;
6309
6312
  });
6310
6313
  return result;
@@ -6352,10 +6355,18 @@ var CollectionEditor$1 = function CollectionEditor(props) {
6352
6355
 
6353
6356
  var remove = function remove() {
6354
6357
  try {
6355
- return Promise.resolve(pageContext.remove(selected.id)).then(function () {
6356
- pageContext.clear();
6357
- setPageContext(Object.assign({}, pageContext));
6358
- });
6358
+ var accept = site.confirm("¿ Esta seguro ?");
6359
+
6360
+ var _temp6 = function () {
6361
+ if (accept === true) {
6362
+ return Promise.resolve(pageContext.remove(selected.id)).then(function () {
6363
+ pageContext.clear();
6364
+ setPageContext(Object.assign({}, pageContext));
6365
+ });
6366
+ }
6367
+ }();
6368
+
6369
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6359
6370
  } catch (e) {
6360
6371
  return Promise.reject(e);
6361
6372
  }
@@ -6505,7 +6516,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6505
6516
  try {
6506
6517
  var _this2 = this;
6507
6518
 
6508
- var _temp6 = _catch$5(function () {
6519
+ var _temp8 = _catch$5(function () {
6509
6520
  return Promise.resolve(API.all(null, page)).then(function (data) {
6510
6521
  _this2.all = field ? data[field] : data;
6511
6522
  });
@@ -6513,7 +6524,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6513
6524
  console.log(error);
6514
6525
  });
6515
6526
 
6516
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6527
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6517
6528
  } catch (e) {
6518
6529
  return Promise.reject(e);
6519
6530
  }
@@ -6522,7 +6533,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6522
6533
  try {
6523
6534
  var _this4 = this;
6524
6535
 
6525
- var _temp8 = function () {
6536
+ var _temp10 = function () {
6526
6537
  if (fetching) {
6527
6538
  return Promise.resolve(_this4.fetch(id)).then(function (result) {
6528
6539
  _this4.selected = result;
@@ -6536,7 +6547,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6536
6547
  }
6537
6548
  }();
6538
6549
 
6539
- return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6550
+ return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6540
6551
  } catch (e) {
6541
6552
  return Promise.reject(e);
6542
6553
  }
@@ -6570,7 +6581,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6570
6581
  try {
6571
6582
  var _this8 = this;
6572
6583
 
6573
- var _temp10 = _catch$5(function () {
6584
+ var _temp12 = _catch$5(function () {
6574
6585
  if (versioning) form.version = 1;
6575
6586
  return Promise.resolve(API.create(form)).then(function () {
6576
6587
  return Promise.resolve(_this8.load()).then(function () {});
@@ -6579,7 +6590,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6579
6590
  console.log(error);
6580
6591
  });
6581
6592
 
6582
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6593
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6583
6594
  } catch (e) {
6584
6595
  return Promise.reject(e);
6585
6596
  }
@@ -6588,7 +6599,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6588
6599
  try {
6589
6600
  var _this10 = this;
6590
6601
 
6591
- var _temp12 = _catch$5(function () {
6602
+ var _temp14 = _catch$5(function () {
6592
6603
  if (versioning) form.version = form.version ? form.version + 1 : 1;
6593
6604
  return Promise.resolve(API.update(form)).then(function () {
6594
6605
  return Promise.resolve(_this10.load()).then(function () {});
@@ -6597,7 +6608,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6597
6608
  console.log(error);
6598
6609
  });
6599
6610
 
6600
- return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6611
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6601
6612
  } catch (e) {
6602
6613
  return Promise.reject(e);
6603
6614
  }
@@ -6606,7 +6617,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6606
6617
  try {
6607
6618
  var _this12 = this;
6608
6619
 
6609
- var _temp14 = _catch$5(function () {
6620
+ var _temp16 = _catch$5(function () {
6610
6621
  if (versioning) form.version = form.version ? form.version + 1 : 1;
6611
6622
  return Promise.resolve(API.patch(id, form)).then(function () {
6612
6623
  return Promise.resolve(_this12.load()).then(function () {});
@@ -6615,7 +6626,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6615
6626
  console.log(error);
6616
6627
  });
6617
6628
 
6618
- return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6629
+ return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(function () {}) : void 0);
6619
6630
  } catch (e) {
6620
6631
  return Promise.reject(e);
6621
6632
  }
@@ -6624,7 +6635,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6624
6635
  try {
6625
6636
  var _this14 = this;
6626
6637
 
6627
- var _temp16 = _catch$5(function () {
6638
+ var _temp18 = _catch$5(function () {
6628
6639
  return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
6629
6640
  return Promise.resolve(_this14.load()).then(function () {});
6630
6641
  });
@@ -6632,7 +6643,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6632
6643
  console.log(error);
6633
6644
  });
6634
6645
 
6635
- return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(function () {}) : void 0);
6646
+ return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
6636
6647
  } catch (e) {
6637
6648
  return Promise.reject(e);
6638
6649
  }
@@ -6641,7 +6652,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6641
6652
  try {
6642
6653
  var _this16 = this;
6643
6654
 
6644
- var _temp18 = _catch$5(function () {
6655
+ var _temp20 = _catch$5(function () {
6645
6656
  return Promise.resolve(API.remove(id)).then(function () {
6646
6657
  return Promise.resolve(_this16.load()).then(function () {});
6647
6658
  });
@@ -6649,7 +6660,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6649
6660
  console.log(error);
6650
6661
  });
6651
6662
 
6652
- return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
6663
+ return Promise.resolve(_temp20 && _temp20.then ? _temp20.then(function () {}) : void 0);
6653
6664
  } catch (e) {
6654
6665
  return Promise.reject(e);
6655
6666
  }