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.
@@ -5968,7 +5968,8 @@ var CollectionPage$1 = function CollectionPage(props) {
5968
5968
  groupBy: groupBy,
5969
5969
  onSelect: onSelect,
5970
5970
  searchBy: searchBy,
5971
- itemRenderer: listItemRenderer
5971
+ itemRenderer: listItemRenderer,
5972
+ sorter: sorter
5972
5973
  })), /*#__PURE__*/React.createElement("main", {
5973
5974
  key: id,
5974
5975
  className: "collection-page " + className
@@ -6118,7 +6119,8 @@ var CollectionList$1 = function CollectionList(props) {
6118
6119
  onSelect = props.onSelect,
6119
6120
  _props$searchBy = props.searchBy,
6120
6121
  searchBy = _props$searchBy === void 0 ? [] : _props$searchBy,
6121
- itemRenderer = props.itemRenderer;
6122
+ itemRenderer = props.itemRenderer,
6123
+ sorter = props.sorter;
6122
6124
 
6123
6125
  var _useContext3 = useContext(PageContext),
6124
6126
  pageContext = _useContext3[0],
@@ -6151,8 +6153,9 @@ var CollectionList$1 = function CollectionList(props) {
6151
6153
  return items;
6152
6154
  }
6153
6155
 
6154
- var items = search();
6155
- var items2 = items.map(function (content) {
6156
+ var searched = search();
6157
+ var sorted = sorter ? sorter(searched) : searched;
6158
+ var items2 = sorted.map(function (content) {
6156
6159
  if (itemRenderer) return itemRenderer(content);
6157
6160
  return {
6158
6161
  id: content.id,
@@ -6296,7 +6299,7 @@ var CollectionTree = function CollectionTree(props) {
6296
6299
  function search() {
6297
6300
  var items = filter ? all.filter(function (item) {
6298
6301
  var result = searchBy.some(function (fieldName) {
6299
- var value = item[fieldName];
6302
+ var value = item[fieldName] ? item[fieldName].toUpperCase() : "";
6300
6303
  return value ? value.indexOf(filter.toUpperCase()) >= 0 : false;
6301
6304
  });
6302
6305
  return result;
@@ -6344,10 +6347,18 @@ var CollectionEditor$1 = function CollectionEditor(props) {
6344
6347
 
6345
6348
  var remove = function remove() {
6346
6349
  try {
6347
- return Promise.resolve(pageContext.remove(selected.id)).then(function () {
6348
- pageContext.clear();
6349
- setPageContext(Object.assign({}, pageContext));
6350
- });
6350
+ var accept = site.confirm("¿ Esta seguro ?");
6351
+
6352
+ var _temp6 = function () {
6353
+ if (accept === true) {
6354
+ return Promise.resolve(pageContext.remove(selected.id)).then(function () {
6355
+ pageContext.clear();
6356
+ setPageContext(Object.assign({}, pageContext));
6357
+ });
6358
+ }
6359
+ }();
6360
+
6361
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6351
6362
  } catch (e) {
6352
6363
  return Promise.reject(e);
6353
6364
  }
@@ -6497,7 +6508,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6497
6508
  try {
6498
6509
  var _this2 = this;
6499
6510
 
6500
- var _temp6 = _catch$5(function () {
6511
+ var _temp8 = _catch$5(function () {
6501
6512
  return Promise.resolve(API.all(null, page)).then(function (data) {
6502
6513
  _this2.all = field ? data[field] : data;
6503
6514
  });
@@ -6505,7 +6516,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6505
6516
  console.log(error);
6506
6517
  });
6507
6518
 
6508
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6519
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6509
6520
  } catch (e) {
6510
6521
  return Promise.reject(e);
6511
6522
  }
@@ -6514,7 +6525,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6514
6525
  try {
6515
6526
  var _this4 = this;
6516
6527
 
6517
- var _temp8 = function () {
6528
+ var _temp10 = function () {
6518
6529
  if (fetching) {
6519
6530
  return Promise.resolve(_this4.fetch(id)).then(function (result) {
6520
6531
  _this4.selected = result;
@@ -6528,7 +6539,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6528
6539
  }
6529
6540
  }();
6530
6541
 
6531
- return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6542
+ return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6532
6543
  } catch (e) {
6533
6544
  return Promise.reject(e);
6534
6545
  }
@@ -6562,7 +6573,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6562
6573
  try {
6563
6574
  var _this8 = this;
6564
6575
 
6565
- var _temp10 = _catch$5(function () {
6576
+ var _temp12 = _catch$5(function () {
6566
6577
  if (versioning) form.version = 1;
6567
6578
  return Promise.resolve(API.create(form)).then(function () {
6568
6579
  return Promise.resolve(_this8.load()).then(function () {});
@@ -6571,7 +6582,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6571
6582
  console.log(error);
6572
6583
  });
6573
6584
 
6574
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6585
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6575
6586
  } catch (e) {
6576
6587
  return Promise.reject(e);
6577
6588
  }
@@ -6580,7 +6591,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6580
6591
  try {
6581
6592
  var _this10 = this;
6582
6593
 
6583
- var _temp12 = _catch$5(function () {
6594
+ var _temp14 = _catch$5(function () {
6584
6595
  if (versioning) form.version = form.version ? form.version + 1 : 1;
6585
6596
  return Promise.resolve(API.update(form)).then(function () {
6586
6597
  return Promise.resolve(_this10.load()).then(function () {});
@@ -6589,7 +6600,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6589
6600
  console.log(error);
6590
6601
  });
6591
6602
 
6592
- return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6603
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6593
6604
  } catch (e) {
6594
6605
  return Promise.reject(e);
6595
6606
  }
@@ -6598,7 +6609,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6598
6609
  try {
6599
6610
  var _this12 = this;
6600
6611
 
6601
- var _temp14 = _catch$5(function () {
6612
+ var _temp16 = _catch$5(function () {
6602
6613
  if (versioning) form.version = form.version ? form.version + 1 : 1;
6603
6614
  return Promise.resolve(API.patch(id, form)).then(function () {
6604
6615
  return Promise.resolve(_this12.load()).then(function () {});
@@ -6607,7 +6618,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6607
6618
  console.log(error);
6608
6619
  });
6609
6620
 
6610
- return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6621
+ return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(function () {}) : void 0);
6611
6622
  } catch (e) {
6612
6623
  return Promise.reject(e);
6613
6624
  }
@@ -6616,7 +6627,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6616
6627
  try {
6617
6628
  var _this14 = this;
6618
6629
 
6619
- var _temp16 = _catch$5(function () {
6630
+ var _temp18 = _catch$5(function () {
6620
6631
  return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
6621
6632
  return Promise.resolve(_this14.load()).then(function () {});
6622
6633
  });
@@ -6624,7 +6635,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6624
6635
  console.log(error);
6625
6636
  });
6626
6637
 
6627
- return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(function () {}) : void 0);
6638
+ return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
6628
6639
  } catch (e) {
6629
6640
  return Promise.reject(e);
6630
6641
  }
@@ -6633,7 +6644,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6633
6644
  try {
6634
6645
  var _this16 = this;
6635
6646
 
6636
- var _temp18 = _catch$5(function () {
6647
+ var _temp20 = _catch$5(function () {
6637
6648
  return Promise.resolve(API.remove(id)).then(function () {
6638
6649
  return Promise.resolve(_this16.load()).then(function () {});
6639
6650
  });
@@ -6641,7 +6652,7 @@ var CollectionContext$1 = function CollectionContext(url, field, host, page, fet
6641
6652
  console.log(error);
6642
6653
  });
6643
6654
 
6644
- return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
6655
+ return Promise.resolve(_temp20 && _temp20.then ? _temp20.then(function () {}) : void 0);
6645
6656
  } catch (e) {
6646
6657
  return Promise.reject(e);
6647
6658
  }