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.cjs CHANGED
@@ -869,7 +869,11 @@ var Section = function Section(props) {
869
869
  var Tabs = function Tabs(props) {
870
870
  var children = props.children,
871
871
  selected = props.selected,
872
- onChange = props.onChange;
872
+ onChange = props.onChange,
873
+ _props$fillLeft = props.fillLeft,
874
+ fillLeft = _props$fillLeft === void 0 ? false : _props$fillLeft,
875
+ _props$fillRight = props.fillRight,
876
+ fillRight = _props$fillRight === void 0 ? true : _props$fillRight;
873
877
  var tabs = React__default["default"].Children.map(children, function (child, index) {
874
878
  function select(id) {
875
879
  if (onChange) onChange(id || index);
@@ -882,9 +886,11 @@ var Tabs = function Tabs(props) {
882
886
  });
883
887
  return /*#__PURE__*/React__default["default"].createElement("div", {
884
888
  className: "tabs"
885
- }, tabs, /*#__PURE__*/React__default["default"].createElement("div", {
889
+ }, fillLeft ? /*#__PURE__*/React__default["default"].createElement("div", {
886
890
  className: "tab-filler"
887
- }));
891
+ }) : null, tabs, fillRight ? /*#__PURE__*/React__default["default"].createElement("div", {
892
+ className: "tab-filler"
893
+ }) : null);
888
894
  };
889
895
  /**
890
896
  * Tab
@@ -1958,7 +1964,7 @@ var TokenField = function TokenField(_ref) {
1958
1964
  event.preventDefault();
1959
1965
  event.stopPropagation();
1960
1966
  var token = event.target.value;
1961
- var next = tokens.concat(token);
1967
+ var next = tokens.concat(token.trim());
1962
1968
  if (onChange) onChange(id, next);
1963
1969
  setValue('');
1964
1970
  }
@@ -4692,11 +4698,13 @@ var CollectionPage = function CollectionPage(props) {
4692
4698
  name = _props$name === void 0 ? "Collection 1" : _props$name,
4693
4699
  schema = props.schema,
4694
4700
  url = props.url,
4695
- page = props.page,
4701
+ field = props.field,
4696
4702
  host = props.host,
4703
+ page = props.page,
4704
+ _props$fetching = props.fetching,
4705
+ fetching = _props$fetching === void 0 ? false : _props$fetching,
4697
4706
  groupBy = props.groupBy,
4698
4707
  editor = props.editor,
4699
- field = props.field,
4700
4708
  _props$autosave = props.autosave,
4701
4709
  autosave = _props$autosave === void 0 ? false : _props$autosave,
4702
4710
  _props$delay = props.delay,
@@ -4710,7 +4718,7 @@ var CollectionPage = function CollectionPage(props) {
4710
4718
  pageContext = _useContext[0],
4711
4719
  setPageContext = _useContext[1];
4712
4720
 
4713
- var context = CollectionContext(url, field, host, page);
4721
+ var context = CollectionContext(url, field, host, page, fetching);
4714
4722
  React.useEffect(function () {
4715
4723
  try {
4716
4724
  return Promise.resolve(context.load()).then(function () {
@@ -5032,7 +5040,7 @@ var CollectionEditor = function CollectionEditor(props) {
5032
5040
  */
5033
5041
 
5034
5042
 
5035
- var CollectionContext = function CollectionContext(url, field, host, page) {
5043
+ var CollectionContext = function CollectionContext(url, field, host, page, fetching) {
5036
5044
  var API = CollectionAPI(url, host);
5037
5045
  return {
5038
5046
  all: [],
@@ -5055,95 +5063,123 @@ var CollectionContext = function CollectionContext(url, field, host, page) {
5055
5063
  }
5056
5064
  },
5057
5065
  select: function select(id) {
5058
- var result = this.all.find(function (item) {
5059
- return item.id === id;
5060
- });
5061
- this.selected = result;
5066
+ try {
5067
+ var _this4 = this;
5068
+
5069
+ var _temp4 = function () {
5070
+ if (fetching) {
5071
+ return Promise.resolve(_this4.fetch(id)).then(function (result) {
5072
+ _this4.selected = result;
5073
+ });
5074
+ } else {
5075
+ var result = _this4.all.find(function (item) {
5076
+ return item.id === id;
5077
+ });
5078
+
5079
+ _this4.selected = result;
5080
+ }
5081
+ }();
5082
+
5083
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
5084
+ } catch (e) {
5085
+ return Promise.reject(e);
5086
+ }
5087
+ },
5088
+ fetch: function fetch(id) {
5089
+ try {
5090
+ return Promise.resolve(_catch$2(function () {
5091
+ return Promise.resolve(API.find(id));
5092
+ }, function (error) {
5093
+ console.log(error);
5094
+ }));
5095
+ } catch (e) {
5096
+ return Promise.reject(e);
5097
+ }
5062
5098
  },
5063
5099
  clear: function clear() {
5064
5100
  this.selected = null;
5065
5101
  },
5066
5102
  create: function create(form) {
5067
5103
  try {
5068
- var _this4 = this;
5104
+ var _this6 = this;
5069
5105
 
5070
- var _temp4 = _catch$2(function () {
5106
+ var _temp6 = _catch$2(function () {
5071
5107
  return Promise.resolve(API.create(form)).then(function () {
5072
- return Promise.resolve(_this4.load()).then(function () {});
5108
+ return Promise.resolve(_this6.load()).then(function () {});
5073
5109
  });
5074
5110
  }, function (error) {
5075
5111
  console.log("CREATE ERROR", error);
5076
5112
  });
5077
5113
 
5078
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
5114
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
5079
5115
  } catch (e) {
5080
5116
  return Promise.reject(e);
5081
5117
  }
5082
5118
  },
5083
5119
  update: function update(form) {
5084
5120
  try {
5085
- var _this6 = this;
5121
+ var _this8 = this;
5086
5122
 
5087
- var _temp6 = _catch$2(function () {
5123
+ var _temp8 = _catch$2(function () {
5088
5124
  return Promise.resolve(API.update(form)).then(function () {
5089
- return Promise.resolve(_this6.load()).then(function () {});
5125
+ return Promise.resolve(_this8.load()).then(function () {});
5090
5126
  });
5091
5127
  }, function (error) {
5092
5128
  console.log(error);
5093
5129
  });
5094
5130
 
5095
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
5131
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
5096
5132
  } catch (e) {
5097
5133
  return Promise.reject(e);
5098
5134
  }
5099
5135
  },
5100
5136
  patch: function patch(id, form) {
5101
5137
  try {
5102
- var _this8 = this;
5138
+ var _this10 = this;
5103
5139
 
5104
- var _temp8 = _catch$2(function () {
5140
+ var _temp10 = _catch$2(function () {
5105
5141
  return Promise.resolve(API.patch(id, form)).then(function () {
5106
- return Promise.resolve(_this8.load()).then(function () {});
5142
+ return Promise.resolve(_this10.load()).then(function () {});
5107
5143
  });
5108
5144
  }, function (error) {
5109
5145
  console.log(error);
5110
5146
  });
5111
5147
 
5112
- return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
5148
+ return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
5113
5149
  } catch (e) {
5114
5150
  return Promise.reject(e);
5115
5151
  }
5116
5152
  },
5117
5153
  updateProperty: function updateProperty(id, propertyName, form) {
5118
5154
  try {
5119
- var _this10 = this;
5155
+ var _this12 = this;
5120
5156
 
5121
- var _temp10 = _catch$2(function () {
5157
+ var _temp12 = _catch$2(function () {
5122
5158
  return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
5123
- return Promise.resolve(_this10.load()).then(function () {});
5159
+ return Promise.resolve(_this12.load()).then(function () {});
5124
5160
  });
5125
5161
  }, function (error) {
5126
5162
  console.log(error);
5127
5163
  });
5128
5164
 
5129
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
5165
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
5130
5166
  } catch (e) {
5131
5167
  return Promise.reject(e);
5132
5168
  }
5133
5169
  },
5134
5170
  remove: function remove(id) {
5135
5171
  try {
5136
- var _this12 = this;
5172
+ var _this14 = this;
5137
5173
 
5138
- var _temp12 = _catch$2(function () {
5174
+ var _temp14 = _catch$2(function () {
5139
5175
  return Promise.resolve(API.remove(id)).then(function () {
5140
- return Promise.resolve(_this12.load()).then(function () {});
5176
+ return Promise.resolve(_this14.load()).then(function () {});
5141
5177
  });
5142
5178
  }, function (error) {
5143
5179
  console.log(error);
5144
5180
  });
5145
5181
 
5146
- return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
5182
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
5147
5183
  } catch (e) {
5148
5184
  return Promise.reject(e);
5149
5185
  }
@@ -6652,7 +6688,9 @@ var TabbedTablePage = function TabbedTablePage(props) {
6652
6688
  var selected = tab ? tab.value : null;
6653
6689
  return /*#__PURE__*/React__default["default"].createElement(Tabs, {
6654
6690
  selected: selected,
6655
- onChange: changeTab
6691
+ onChange: changeTab,
6692
+ fillRight: true,
6693
+ fillLeft: false
6656
6694
  }, tabs.map(function (tab) {
6657
6695
  return /*#__PURE__*/React__default["default"].createElement(Tab, {
6658
6696
  id: tab.value,