ywana-core8 0.0.253 → 0.0.256

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
@@ -846,12 +846,12 @@
846
846
  selected = props.selected,
847
847
  onChange = props.onChange;
848
848
  var tabs = React__default["default"].Children.map(children, function (child, index) {
849
- function select() {
850
- if (onChange) onChange(index);
849
+ function select(id) {
850
+ if (onChange) onChange(id || index);
851
851
  }
852
852
 
853
853
  return React__default["default"].cloneElement(child, {
854
- selected: index === selected,
854
+ selected: index === selected || selected === child.props.id,
855
855
  onSelect: select
856
856
  });
857
857
  });
@@ -866,13 +866,14 @@
866
866
  */
867
867
 
868
868
  var Tab = function Tab(props) {
869
- var label = props.label,
869
+ var id = props.id,
870
+ label = props.label,
870
871
  selected = props.selected,
871
872
  actions = props.actions,
872
873
  onSelect = props.onSelect;
873
874
 
874
875
  function select() {
875
- if (onSelect) onSelect();
876
+ if (onSelect) onSelect(id);
876
877
  }
877
878
 
878
879
  var style = selected ? "selected" : "";
@@ -1745,7 +1746,13 @@
1745
1746
  var value = _ref7.value,
1746
1747
  format = _ref7.format,
1747
1748
  options = _ref7.options;
1748
- var option = options ? options.find(function (o) {
1749
+
1750
+ function buildOptions() {
1751
+ var opts = typeof options === 'function' ? options() : options;
1752
+ return opts;
1753
+ }
1754
+
1755
+ var option = options ? buildOptions().find(function (o) {
1749
1756
  return o.value === value;
1750
1757
  }) : null;
1751
1758
  var text = option ? option.label : value;
@@ -4133,7 +4140,8 @@
4133
4140
  _props$delay = props.delay,
4134
4141
  delay = _props$delay === void 0 ? 1000 : _props$delay,
4135
4142
  actions = props.actions,
4136
- levels = props.levels;
4143
+ levels = props.levels,
4144
+ onSelect = props.onSelect;
4137
4145
 
4138
4146
  var _useContext = React.useContext(PageContext),
4139
4147
  pageContext = _useContext[0],
@@ -4197,9 +4205,11 @@
4197
4205
  }, /*#__PURE__*/React__default["default"].createElement(Header, {
4198
4206
  title: /*#__PURE__*/React__default["default"].createElement(Text$1, null, "Lista de ", name)
4199
4207
  }), levels ? /*#__PURE__*/React__default["default"].createElement(CollectionTree, {
4200
- levels: levels
4208
+ levels: levels,
4209
+ onSelect: onSelect
4201
4210
  }) : /*#__PURE__*/React__default["default"].createElement(CollectionList, {
4202
- groupBy: groupBy
4211
+ groupBy: groupBy,
4212
+ onSelect: onSelect
4203
4213
  })), /*#__PURE__*/React__default["default"].createElement("main", {
4204
4214
  key: id,
4205
4215
  className: "collection-page"
@@ -4221,13 +4231,15 @@
4221
4231
  clear();
4222
4232
  return Promise.resolve(pageContext.select(id)).then(function () {
4223
4233
  setPageContext(Object.assign({}, pageContext));
4234
+ if (onSelect) onSelect(id);
4224
4235
  });
4225
4236
  } catch (e) {
4226
4237
  return Promise.reject(e);
4227
4238
  }
4228
4239
  };
4229
4240
 
4230
- var groupBy = props.groupBy;
4241
+ var groupBy = props.groupBy,
4242
+ onSelect = props.onSelect;
4231
4243
 
4232
4244
  var _useContext2 = React.useContext(PageContext),
4233
4245
  pageContext = _useContext2[0],
@@ -4266,13 +4278,15 @@
4266
4278
  clear();
4267
4279
  return Promise.resolve(pageContext.select(id)).then(function () {
4268
4280
  setPageContext(Object.assign({}, pageContext));
4281
+ if (onSelect) onSelect(id);
4269
4282
  });
4270
4283
  } catch (e) {
4271
4284
  return Promise.reject(e);
4272
4285
  }
4273
4286
  };
4274
4287
 
4275
- var levels = props.levels;
4288
+ var levels = props.levels,
4289
+ onSelect = props.onSelect;
4276
4290
 
4277
4291
  var _useContext3 = React.useContext(PageContext),
4278
4292
  pageContext = _useContext3[0],
@@ -4644,7 +4658,6 @@
4644
4658
  if (!content) return /*#__PURE__*/React__default["default"].createElement("div", null, "No Content...");
4645
4659
  var sections = content.sections();
4646
4660
  var value = content.value();
4647
- console.log(value);
4648
4661
  return /*#__PURE__*/React__default["default"].createElement("div", {
4649
4662
  className: "content-viewer"
4650
4663
  }, sections.map(function (section) {
@@ -4674,7 +4687,6 @@
4674
4687
  value = props.value;
4675
4688
  var type = field.type,
4676
4689
  label = field.label;
4677
- console.log('FieldViewer', field, value);
4678
4690
 
4679
4691
  switch (type) {
4680
4692
  case TYPES.STRING: