ywana-core8 0.0.297 → 0.0.298

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
@@ -5162,7 +5162,15 @@ var TablePage = function TablePage(props) {
5162
5162
  try {
5163
5163
  var context = TableContext(url, field, host);
5164
5164
  return Promise.resolve(context.load()).then(function () {
5165
- setPageContext(context);
5165
+ function _temp2() {
5166
+ setPageContext(context);
5167
+ }
5168
+
5169
+ var _temp = function () {
5170
+ if (canQuery) return Promise.resolve(context.loadQueries()).then(function () {});
5171
+ }();
5172
+
5173
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
5166
5174
  });
5167
5175
  } catch (e) {
5168
5176
  return Promise.reject(e);
@@ -5377,13 +5385,20 @@ var TableSelector = function TableSelector(props) {
5377
5385
 
5378
5386
 
5379
5387
  var TableQueries = function TableQueries(props) {
5380
- var _useContext3 = React.useContext(PageContext),
5381
- pageContext = _useContext3[0];
5382
-
5383
- React.useEffect(function () {
5384
- pageContext.loadQueries();
5385
- }, []);
5386
- var queries = [1, 2, 3];
5388
+ function remove(id) {
5389
+ alert("TODO: remove query");
5390
+ }
5391
+
5392
+ var queries = [{
5393
+ name: "Query 1",
5394
+ filters: {}
5395
+ }, {
5396
+ name: "Query 2",
5397
+ filters: {}
5398
+ }, {
5399
+ name: "Query 3",
5400
+ filters: {}
5401
+ }];
5387
5402
  return /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement(Header, {
5388
5403
  className: "table-queries",
5389
5404
  title: /*#__PURE__*/React__default["default"].createElement(Text, null, "Queries")
@@ -5392,7 +5407,16 @@ var TableQueries = function TableQueries(props) {
5392
5407
  }, queries.map(function (query) {
5393
5408
  return /*#__PURE__*/React__default["default"].createElement("div", {
5394
5409
  className: "table-queries-item"
5395
- });
5410
+ }, /*#__PURE__*/React__default["default"].createElement(Icon, {
5411
+ icon: "star"
5412
+ }), /*#__PURE__*/React__default["default"].createElement("label", null, query.name), /*#__PURE__*/React__default["default"].createElement(Icon, {
5413
+ icon: "close",
5414
+ clickable: true,
5415
+ size: "small",
5416
+ action: function action() {
5417
+ return remove();
5418
+ }
5419
+ }));
5396
5420
  })));
5397
5421
  };
5398
5422
  /**
@@ -5412,9 +5436,9 @@ var TableFilters = function TableFilters(props) {
5412
5436
  }
5413
5437
  };
5414
5438
 
5415
- var _useContext4 = React.useContext(PageContext),
5416
- pageContext = _useContext4[0],
5417
- setPageContext = _useContext4[1];
5439
+ var _useContext3 = React.useContext(PageContext),
5440
+ pageContext = _useContext3[0],
5441
+ setPageContext = _useContext3[1];
5418
5442
 
5419
5443
  var schema = props.schema,
5420
5444
  onSave = props.onSave;
@@ -5501,7 +5525,7 @@ var TableEditor = function TableEditor(props) {
5501
5525
  var remove = function remove(id) {
5502
5526
  try {
5503
5527
  return Promise.resolve(site.confirm("Are you sure ?")).then(function (confirm) {
5504
- var _temp = function () {
5528
+ var _temp3 = function () {
5505
5529
  if (confirm) {
5506
5530
  return Promise.resolve(pageContext.remove(id)).then(function () {
5507
5531
  pageContext.clear();
@@ -5510,7 +5534,7 @@ var TableEditor = function TableEditor(props) {
5510
5534
  }
5511
5535
  }();
5512
5536
 
5513
- if (_temp && _temp.then) return _temp.then(function () {});
5537
+ if (_temp3 && _temp3.then) return _temp3.then(function () {});
5514
5538
  });
5515
5539
  } catch (e) {
5516
5540
  return Promise.reject(e);
@@ -5519,9 +5543,9 @@ var TableEditor = function TableEditor(props) {
5519
5543
 
5520
5544
  var site = React.useContext(SiteContext);
5521
5545
 
5522
- var _useContext5 = React.useContext(PageContext),
5523
- pageContext = _useContext5[0],
5524
- setPageContext = _useContext5[1];
5546
+ var _useContext4 = React.useContext(PageContext),
5547
+ pageContext = _useContext4[0],
5548
+ setPageContext = _useContext4[1];
5525
5549
 
5526
5550
  var _pageContext$all = pageContext.all,
5527
5551
  all = _pageContext$all === void 0 ? [] : _pageContext$all;
@@ -5705,7 +5729,7 @@ var TableContext = function TableContext(url, field, host) {
5705
5729
  try {
5706
5730
  var _this2 = this;
5707
5731
 
5708
- var _temp3 = _catch(function () {
5732
+ var _temp5 = _catch(function () {
5709
5733
  var filters = filter ? Object.keys(filter).reduce(function (filters, key) {
5710
5734
  var field = filter[key];
5711
5735
  if (field) filters[key] = field;
@@ -5718,7 +5742,7 @@ var TableContext = function TableContext(url, field, host) {
5718
5742
  console.log(error);
5719
5743
  });
5720
5744
 
5721
- return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
5745
+ return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(function () {}) : void 0);
5722
5746
  } catch (e) {
5723
5747
  return Promise.reject(e);
5724
5748
  }
@@ -5753,7 +5777,7 @@ var TableContext = function TableContext(url, field, host) {
5753
5777
  try {
5754
5778
  var _this5 = this;
5755
5779
 
5756
- var _temp5 = _catch(function () {
5780
+ var _temp7 = _catch(function () {
5757
5781
  return Promise.resolve(API.create(form)).then(function () {
5758
5782
  return Promise.resolve(_this5.load()).then(function () {});
5759
5783
  });
@@ -5761,7 +5785,7 @@ var TableContext = function TableContext(url, field, host) {
5761
5785
  console.log(error);
5762
5786
  });
5763
5787
 
5764
- return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(function () {}) : void 0);
5788
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
5765
5789
  } catch (e) {
5766
5790
  return Promise.reject(e);
5767
5791
  }
@@ -5770,7 +5794,7 @@ var TableContext = function TableContext(url, field, host) {
5770
5794
  try {
5771
5795
  var _this7 = this;
5772
5796
 
5773
- var _temp7 = _catch(function () {
5797
+ var _temp9 = _catch(function () {
5774
5798
  return Promise.resolve(API.update(form)).then(function () {
5775
5799
  return Promise.resolve(_this7.load()).then(function () {});
5776
5800
  });
@@ -5778,7 +5802,7 @@ var TableContext = function TableContext(url, field, host) {
5778
5802
  console.log(error);
5779
5803
  });
5780
5804
 
5781
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
5805
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
5782
5806
  } catch (e) {
5783
5807
  return Promise.reject(e);
5784
5808
  }
@@ -5787,7 +5811,7 @@ var TableContext = function TableContext(url, field, host) {
5787
5811
  try {
5788
5812
  var _this9 = this;
5789
5813
 
5790
- var _temp9 = _catch(function () {
5814
+ var _temp11 = _catch(function () {
5791
5815
  return Promise.resolve(API.remove(id)).then(function () {
5792
5816
  return Promise.resolve(_this9.load()).then(function () {});
5793
5817
  });
@@ -5795,7 +5819,7 @@ var TableContext = function TableContext(url, field, host) {
5795
5819
  console.log(error);
5796
5820
  });
5797
5821
 
5798
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
5822
+ return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
5799
5823
  } catch (e) {
5800
5824
  return Promise.reject(e);
5801
5825
  }
@@ -5807,7 +5831,7 @@ var TableContext = function TableContext(url, field, host) {
5807
5831
  try {
5808
5832
  var _this11 = this;
5809
5833
 
5810
- var _temp11 = _catch(function () {
5834
+ var _temp13 = _catch(function () {
5811
5835
  return Promise.resolve(API.queries()).then(function (_API$queries) {
5812
5836
  _this11.queries = _API$queries;
5813
5837
  });
@@ -5815,7 +5839,7 @@ var TableContext = function TableContext(url, field, host) {
5815
5839
  console.log(error);
5816
5840
  });
5817
5841
 
5818
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
5842
+ return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
5819
5843
  } catch (e) {
5820
5844
  return Promise.reject(e);
5821
5845
  }
@@ -5824,7 +5848,7 @@ var TableContext = function TableContext(url, field, host) {
5824
5848
  try {
5825
5849
  var _this13 = this;
5826
5850
 
5827
- var _temp13 = _catch(function () {
5851
+ var _temp15 = _catch(function () {
5828
5852
  return Promise.resolve(API.createQuery(query)).then(function () {
5829
5853
  _this13.loadQueries();
5830
5854
  });
@@ -5832,7 +5856,7 @@ var TableContext = function TableContext(url, field, host) {
5832
5856
  console.log(error);
5833
5857
  });
5834
5858
 
5835
- return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
5859
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
5836
5860
  } catch (e) {
5837
5861
  return Promise.reject(e);
5838
5862
  }
@@ -5841,7 +5865,7 @@ var TableContext = function TableContext(url, field, host) {
5841
5865
  try {
5842
5866
  var _this15 = this;
5843
5867
 
5844
- var _temp15 = _catch(function () {
5868
+ var _temp17 = _catch(function () {
5845
5869
  return Promise.resolve(API.removeQuery(id)).then(function () {
5846
5870
  return Promise.resolve(_this15.loadQueries()).then(function () {});
5847
5871
  });
@@ -5849,7 +5873,7 @@ var TableContext = function TableContext(url, field, host) {
5849
5873
  console.log(error);
5850
5874
  });
5851
5875
 
5852
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
5876
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
5853
5877
  } catch (e) {
5854
5878
  return Promise.reject(e);
5855
5879
  }