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