ywana-core8 0.0.474 → 0.0.477

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
@@ -864,7 +864,11 @@
864
864
  var Tabs = function Tabs(props) {
865
865
  var children = props.children,
866
866
  selected = props.selected,
867
- onChange = props.onChange;
867
+ onChange = props.onChange,
868
+ _props$fillLeft = props.fillLeft,
869
+ fillLeft = _props$fillLeft === void 0 ? false : _props$fillLeft,
870
+ _props$fillRight = props.fillRight,
871
+ fillRight = _props$fillRight === void 0 ? true : _props$fillRight;
868
872
  var tabs = React__default["default"].Children.map(children, function (child, index) {
869
873
  function select(id) {
870
874
  if (onChange) onChange(id || index);
@@ -877,9 +881,11 @@
877
881
  });
878
882
  return /*#__PURE__*/React__default["default"].createElement("div", {
879
883
  className: "tabs"
880
- }, tabs, /*#__PURE__*/React__default["default"].createElement("div", {
884
+ }, fillLeft ? /*#__PURE__*/React__default["default"].createElement("div", {
881
885
  className: "tab-filler"
882
- }));
886
+ }) : null, tabs, fillRight ? /*#__PURE__*/React__default["default"].createElement("div", {
887
+ className: "tab-filler"
888
+ }) : null);
883
889
  };
884
890
  /**
885
891
  * Tab
@@ -1953,7 +1959,7 @@
1953
1959
  event.preventDefault();
1954
1960
  event.stopPropagation();
1955
1961
  var token = event.target.value;
1956
- var next = tokens.concat(token);
1962
+ var next = tokens.concat(token.trim());
1957
1963
  if (onChange) onChange(id, next);
1958
1964
  setValue('');
1959
1965
  }
@@ -4687,11 +4693,13 @@
4687
4693
  name = _props$name === void 0 ? "Collection 1" : _props$name,
4688
4694
  schema = props.schema,
4689
4695
  url = props.url,
4690
- page = props.page,
4696
+ field = props.field,
4691
4697
  host = props.host,
4698
+ page = props.page,
4699
+ _props$fetching = props.fetching,
4700
+ fetching = _props$fetching === void 0 ? false : _props$fetching,
4692
4701
  groupBy = props.groupBy,
4693
4702
  editor = props.editor,
4694
- field = props.field,
4695
4703
  _props$autosave = props.autosave,
4696
4704
  autosave = _props$autosave === void 0 ? false : _props$autosave,
4697
4705
  _props$delay = props.delay,
@@ -4705,7 +4713,7 @@
4705
4713
  pageContext = _useContext[0],
4706
4714
  setPageContext = _useContext[1];
4707
4715
 
4708
- var context = CollectionContext(url, field, host, page);
4716
+ var context = CollectionContext(url, field, host, page, fetching);
4709
4717
  React.useEffect(function () {
4710
4718
  try {
4711
4719
  return Promise.resolve(context.load()).then(function () {
@@ -5027,7 +5035,7 @@
5027
5035
  */
5028
5036
 
5029
5037
 
5030
- var CollectionContext = function CollectionContext(url, field, host, page) {
5038
+ var CollectionContext = function CollectionContext(url, field, host, page, fetching) {
5031
5039
  var API = CollectionAPI(url, host);
5032
5040
  return {
5033
5041
  all: [],
@@ -5050,95 +5058,123 @@
5050
5058
  }
5051
5059
  },
5052
5060
  select: function select(id) {
5053
- var result = this.all.find(function (item) {
5054
- return item.id === id;
5055
- });
5056
- this.selected = result;
5061
+ try {
5062
+ var _this4 = this;
5063
+
5064
+ var _temp4 = function () {
5065
+ if (fetching) {
5066
+ return Promise.resolve(_this4.fetch(id)).then(function (result) {
5067
+ _this4.selected = result;
5068
+ });
5069
+ } else {
5070
+ var result = _this4.all.find(function (item) {
5071
+ return item.id === id;
5072
+ });
5073
+
5074
+ _this4.selected = result;
5075
+ }
5076
+ }();
5077
+
5078
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
5079
+ } catch (e) {
5080
+ return Promise.reject(e);
5081
+ }
5082
+ },
5083
+ fetch: function fetch(id) {
5084
+ try {
5085
+ return Promise.resolve(_catch$2(function () {
5086
+ return Promise.resolve(API.find(id));
5087
+ }, function (error) {
5088
+ console.log(error);
5089
+ }));
5090
+ } catch (e) {
5091
+ return Promise.reject(e);
5092
+ }
5057
5093
  },
5058
5094
  clear: function clear() {
5059
5095
  this.selected = null;
5060
5096
  },
5061
5097
  create: function create(form) {
5062
5098
  try {
5063
- var _this4 = this;
5099
+ var _this6 = this;
5064
5100
 
5065
- var _temp4 = _catch$2(function () {
5101
+ var _temp6 = _catch$2(function () {
5066
5102
  return Promise.resolve(API.create(form)).then(function () {
5067
- return Promise.resolve(_this4.load()).then(function () {});
5103
+ return Promise.resolve(_this6.load()).then(function () {});
5068
5104
  });
5069
5105
  }, function (error) {
5070
5106
  console.log("CREATE ERROR", error);
5071
5107
  });
5072
5108
 
5073
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
5109
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
5074
5110
  } catch (e) {
5075
5111
  return Promise.reject(e);
5076
5112
  }
5077
5113
  },
5078
5114
  update: function update(form) {
5079
5115
  try {
5080
- var _this6 = this;
5116
+ var _this8 = this;
5081
5117
 
5082
- var _temp6 = _catch$2(function () {
5118
+ var _temp8 = _catch$2(function () {
5083
5119
  return Promise.resolve(API.update(form)).then(function () {
5084
- return Promise.resolve(_this6.load()).then(function () {});
5120
+ return Promise.resolve(_this8.load()).then(function () {});
5085
5121
  });
5086
5122
  }, function (error) {
5087
5123
  console.log(error);
5088
5124
  });
5089
5125
 
5090
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
5126
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
5091
5127
  } catch (e) {
5092
5128
  return Promise.reject(e);
5093
5129
  }
5094
5130
  },
5095
5131
  patch: function patch(id, form) {
5096
5132
  try {
5097
- var _this8 = this;
5133
+ var _this10 = this;
5098
5134
 
5099
- var _temp8 = _catch$2(function () {
5135
+ var _temp10 = _catch$2(function () {
5100
5136
  return Promise.resolve(API.patch(id, form)).then(function () {
5101
- return Promise.resolve(_this8.load()).then(function () {});
5137
+ return Promise.resolve(_this10.load()).then(function () {});
5102
5138
  });
5103
5139
  }, function (error) {
5104
5140
  console.log(error);
5105
5141
  });
5106
5142
 
5107
- return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
5143
+ return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
5108
5144
  } catch (e) {
5109
5145
  return Promise.reject(e);
5110
5146
  }
5111
5147
  },
5112
5148
  updateProperty: function updateProperty(id, propertyName, form) {
5113
5149
  try {
5114
- var _this10 = this;
5150
+ var _this12 = this;
5115
5151
 
5116
- var _temp10 = _catch$2(function () {
5152
+ var _temp12 = _catch$2(function () {
5117
5153
  return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
5118
- return Promise.resolve(_this10.load()).then(function () {});
5154
+ return Promise.resolve(_this12.load()).then(function () {});
5119
5155
  });
5120
5156
  }, function (error) {
5121
5157
  console.log(error);
5122
5158
  });
5123
5159
 
5124
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
5160
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
5125
5161
  } catch (e) {
5126
5162
  return Promise.reject(e);
5127
5163
  }
5128
5164
  },
5129
5165
  remove: function remove(id) {
5130
5166
  try {
5131
- var _this12 = this;
5167
+ var _this14 = this;
5132
5168
 
5133
- var _temp12 = _catch$2(function () {
5169
+ var _temp14 = _catch$2(function () {
5134
5170
  return Promise.resolve(API.remove(id)).then(function () {
5135
- return Promise.resolve(_this12.load()).then(function () {});
5171
+ return Promise.resolve(_this14.load()).then(function () {});
5136
5172
  });
5137
5173
  }, function (error) {
5138
5174
  console.log(error);
5139
5175
  });
5140
5176
 
5141
- return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
5177
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
5142
5178
  } catch (e) {
5143
5179
  return Promise.reject(e);
5144
5180
  }
@@ -6647,7 +6683,9 @@
6647
6683
  var selected = tab ? tab.value : null;
6648
6684
  return /*#__PURE__*/React__default["default"].createElement(Tabs, {
6649
6685
  selected: selected,
6650
- onChange: changeTab
6686
+ onChange: changeTab,
6687
+ fillRight: true,
6688
+ fillLeft: false
6651
6689
  }, tabs.map(function (tab) {
6652
6690
  return /*#__PURE__*/React__default["default"].createElement(Tab, {
6653
6691
  id: tab.value,