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.umd.js CHANGED
@@ -5156,7 +5156,15 @@
5156
5156
  try {
5157
5157
  var context = TableContext(url, field, host);
5158
5158
  return Promise.resolve(context.load()).then(function () {
5159
- setPageContext(context);
5159
+ function _temp2() {
5160
+ setPageContext(context);
5161
+ }
5162
+
5163
+ var _temp = function () {
5164
+ if (canQuery) return Promise.resolve(context.loadQueries()).then(function () {});
5165
+ }();
5166
+
5167
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
5160
5168
  });
5161
5169
  } catch (e) {
5162
5170
  return Promise.reject(e);
@@ -5371,13 +5379,20 @@
5371
5379
 
5372
5380
 
5373
5381
  var TableQueries = function TableQueries(props) {
5374
- var _useContext3 = React.useContext(PageContext),
5375
- pageContext = _useContext3[0];
5376
-
5377
- React.useEffect(function () {
5378
- pageContext.loadQueries();
5379
- }, []);
5380
- var queries = [1, 2, 3];
5382
+ function remove(id) {
5383
+ alert("TODO: remove query");
5384
+ }
5385
+
5386
+ var queries = [{
5387
+ name: "Query 1",
5388
+ filters: {}
5389
+ }, {
5390
+ name: "Query 2",
5391
+ filters: {}
5392
+ }, {
5393
+ name: "Query 3",
5394
+ filters: {}
5395
+ }];
5381
5396
  return /*#__PURE__*/React__default["default"].createElement(React.Fragment, null, /*#__PURE__*/React__default["default"].createElement(Header, {
5382
5397
  className: "table-queries",
5383
5398
  title: /*#__PURE__*/React__default["default"].createElement(Text, null, "Queries")
@@ -5386,7 +5401,16 @@
5386
5401
  }, queries.map(function (query) {
5387
5402
  return /*#__PURE__*/React__default["default"].createElement("div", {
5388
5403
  className: "table-queries-item"
5389
- });
5404
+ }, /*#__PURE__*/React__default["default"].createElement(Icon, {
5405
+ icon: "star"
5406
+ }), /*#__PURE__*/React__default["default"].createElement("label", null, query.name), /*#__PURE__*/React__default["default"].createElement(Icon, {
5407
+ icon: "close",
5408
+ clickable: true,
5409
+ size: "small",
5410
+ action: function action() {
5411
+ return remove();
5412
+ }
5413
+ }));
5390
5414
  })));
5391
5415
  };
5392
5416
  /**
@@ -5406,9 +5430,9 @@
5406
5430
  }
5407
5431
  };
5408
5432
 
5409
- var _useContext4 = React.useContext(PageContext),
5410
- pageContext = _useContext4[0],
5411
- setPageContext = _useContext4[1];
5433
+ var _useContext3 = React.useContext(PageContext),
5434
+ pageContext = _useContext3[0],
5435
+ setPageContext = _useContext3[1];
5412
5436
 
5413
5437
  var schema = props.schema,
5414
5438
  onSave = props.onSave;
@@ -5495,7 +5519,7 @@
5495
5519
  var remove = function remove(id) {
5496
5520
  try {
5497
5521
  return Promise.resolve(site.confirm("Are you sure ?")).then(function (confirm) {
5498
- var _temp = function () {
5522
+ var _temp3 = function () {
5499
5523
  if (confirm) {
5500
5524
  return Promise.resolve(pageContext.remove(id)).then(function () {
5501
5525
  pageContext.clear();
@@ -5504,7 +5528,7 @@
5504
5528
  }
5505
5529
  }();
5506
5530
 
5507
- if (_temp && _temp.then) return _temp.then(function () {});
5531
+ if (_temp3 && _temp3.then) return _temp3.then(function () {});
5508
5532
  });
5509
5533
  } catch (e) {
5510
5534
  return Promise.reject(e);
@@ -5513,9 +5537,9 @@
5513
5537
 
5514
5538
  var site = React.useContext(SiteContext);
5515
5539
 
5516
- var _useContext5 = React.useContext(PageContext),
5517
- pageContext = _useContext5[0],
5518
- setPageContext = _useContext5[1];
5540
+ var _useContext4 = React.useContext(PageContext),
5541
+ pageContext = _useContext4[0],
5542
+ setPageContext = _useContext4[1];
5519
5543
 
5520
5544
  var _pageContext$all = pageContext.all,
5521
5545
  all = _pageContext$all === void 0 ? [] : _pageContext$all;
@@ -5699,7 +5723,7 @@
5699
5723
  try {
5700
5724
  var _this2 = this;
5701
5725
 
5702
- var _temp3 = _catch(function () {
5726
+ var _temp5 = _catch(function () {
5703
5727
  var filters = filter ? Object.keys(filter).reduce(function (filters, key) {
5704
5728
  var field = filter[key];
5705
5729
  if (field) filters[key] = field;
@@ -5712,7 +5736,7 @@
5712
5736
  console.log(error);
5713
5737
  });
5714
5738
 
5715
- return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
5739
+ return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(function () {}) : void 0);
5716
5740
  } catch (e) {
5717
5741
  return Promise.reject(e);
5718
5742
  }
@@ -5747,7 +5771,7 @@
5747
5771
  try {
5748
5772
  var _this5 = this;
5749
5773
 
5750
- var _temp5 = _catch(function () {
5774
+ var _temp7 = _catch(function () {
5751
5775
  return Promise.resolve(API.create(form)).then(function () {
5752
5776
  return Promise.resolve(_this5.load()).then(function () {});
5753
5777
  });
@@ -5755,7 +5779,7 @@
5755
5779
  console.log(error);
5756
5780
  });
5757
5781
 
5758
- return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(function () {}) : void 0);
5782
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
5759
5783
  } catch (e) {
5760
5784
  return Promise.reject(e);
5761
5785
  }
@@ -5764,7 +5788,7 @@
5764
5788
  try {
5765
5789
  var _this7 = this;
5766
5790
 
5767
- var _temp7 = _catch(function () {
5791
+ var _temp9 = _catch(function () {
5768
5792
  return Promise.resolve(API.update(form)).then(function () {
5769
5793
  return Promise.resolve(_this7.load()).then(function () {});
5770
5794
  });
@@ -5772,7 +5796,7 @@
5772
5796
  console.log(error);
5773
5797
  });
5774
5798
 
5775
- return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
5799
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
5776
5800
  } catch (e) {
5777
5801
  return Promise.reject(e);
5778
5802
  }
@@ -5781,7 +5805,7 @@
5781
5805
  try {
5782
5806
  var _this9 = this;
5783
5807
 
5784
- var _temp9 = _catch(function () {
5808
+ var _temp11 = _catch(function () {
5785
5809
  return Promise.resolve(API.remove(id)).then(function () {
5786
5810
  return Promise.resolve(_this9.load()).then(function () {});
5787
5811
  });
@@ -5789,7 +5813,7 @@
5789
5813
  console.log(error);
5790
5814
  });
5791
5815
 
5792
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
5816
+ return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
5793
5817
  } catch (e) {
5794
5818
  return Promise.reject(e);
5795
5819
  }
@@ -5801,7 +5825,7 @@
5801
5825
  try {
5802
5826
  var _this11 = this;
5803
5827
 
5804
- var _temp11 = _catch(function () {
5828
+ var _temp13 = _catch(function () {
5805
5829
  return Promise.resolve(API.queries()).then(function (_API$queries) {
5806
5830
  _this11.queries = _API$queries;
5807
5831
  });
@@ -5809,7 +5833,7 @@
5809
5833
  console.log(error);
5810
5834
  });
5811
5835
 
5812
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
5836
+ return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
5813
5837
  } catch (e) {
5814
5838
  return Promise.reject(e);
5815
5839
  }
@@ -5818,7 +5842,7 @@
5818
5842
  try {
5819
5843
  var _this13 = this;
5820
5844
 
5821
- var _temp13 = _catch(function () {
5845
+ var _temp15 = _catch(function () {
5822
5846
  return Promise.resolve(API.createQuery(query)).then(function () {
5823
5847
  _this13.loadQueries();
5824
5848
  });
@@ -5826,7 +5850,7 @@
5826
5850
  console.log(error);
5827
5851
  });
5828
5852
 
5829
- return Promise.resolve(_temp13 && _temp13.then ? _temp13.then(function () {}) : void 0);
5853
+ return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
5830
5854
  } catch (e) {
5831
5855
  return Promise.reject(e);
5832
5856
  }
@@ -5835,7 +5859,7 @@
5835
5859
  try {
5836
5860
  var _this15 = this;
5837
5861
 
5838
- var _temp15 = _catch(function () {
5862
+ var _temp17 = _catch(function () {
5839
5863
  return Promise.resolve(API.removeQuery(id)).then(function () {
5840
5864
  return Promise.resolve(_this15.loadQueries()).then(function () {});
5841
5865
  });
@@ -5843,7 +5867,7 @@
5843
5867
  console.log(error);
5844
5868
  });
5845
5869
 
5846
- return Promise.resolve(_temp15 && _temp15.then ? _temp15.then(function () {}) : void 0);
5870
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
5847
5871
  } catch (e) {
5848
5872
  return Promise.reject(e);
5849
5873
  }