ywana-core8 0.0.560 → 0.0.563

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.
@@ -4142,7 +4142,8 @@ var ContentEditor = function ContentEditor(_ref) {
4142
4142
  _ref$outlined = _ref.outlined,
4143
4143
  outlined = _ref$outlined === void 0 ? true : _ref$outlined,
4144
4144
  className = _ref.className,
4145
- onChange = _ref.onChange;
4145
+ onChange = _ref.onChange,
4146
+ onReload = _ref.onReload;
4146
4147
 
4147
4148
  function change(id, value) {
4148
4149
  var _Object$assign;
@@ -4151,6 +4152,10 @@ var ContentEditor = function ContentEditor(_ref) {
4151
4152
  if (onChange) onChange(nextValue);
4152
4153
  }
4153
4154
 
4155
+ function reload() {
4156
+ if (onReload) onReload();
4157
+ }
4158
+
4154
4159
  var sections = content.sections();
4155
4160
  return /*#__PURE__*/React.createElement("div", {
4156
4161
  className: "content-editor " + className
@@ -4169,6 +4174,7 @@ var ContentEditor = function ContentEditor(_ref) {
4169
4174
  key: field.id,
4170
4175
  field: field,
4171
4176
  onChange: change,
4177
+ onReload: reload,
4172
4178
  outlined: outlined,
4173
4179
  content: content
4174
4180
  });
@@ -4184,7 +4190,8 @@ var TabbedContentEditor = function TabbedContentEditor(_ref2) {
4184
4190
  filter = _ref2.filter,
4185
4191
  _ref2$grouped = _ref2.grouped,
4186
4192
  grouped = _ref2$grouped === void 0 ? false : _ref2$grouped,
4187
- onChange = _ref2.onChange;
4193
+ onChange = _ref2.onChange,
4194
+ onReload = _ref2.onReload;
4188
4195
 
4189
4196
  var _useState = useState(0),
4190
4197
  tab = _useState[0],
@@ -4246,7 +4253,8 @@ var TabbedContentEditor = function TabbedContentEditor(_ref2) {
4246
4253
  key: field.id,
4247
4254
  field: field,
4248
4255
  onChange: change,
4249
- content: content
4256
+ content: content,
4257
+ onReload: onReload
4250
4258
  });
4251
4259
  }));
4252
4260
  }) : fields.filter(function (field) {
@@ -4258,7 +4266,8 @@ var TabbedContentEditor = function TabbedContentEditor(_ref2) {
4258
4266
  key: field.id,
4259
4267
  field: field,
4260
4268
  onChange: change,
4261
- content: content
4269
+ content: content,
4270
+ onReload: onReload
4262
4271
  });
4263
4272
  }));
4264
4273
  })));
@@ -4326,7 +4335,8 @@ var TreededContentEditor = function TreededContentEditor(_ref3) {
4326
4335
  }) : null);
4327
4336
  }))), /*#__PURE__*/React.createElement("div", null, selected ? /*#__PURE__*/React.createElement(TabbedContentEditor, {
4328
4337
  content: selected.item,
4329
- onChange: change
4338
+ onChange: change,
4339
+ onReload: reload
4330
4340
  }) : "select"));
4331
4341
  };
4332
4342
  /**
@@ -4338,7 +4348,8 @@ var FieldEditor = function FieldEditor(_ref4) {
4338
4348
  onChange = _ref4.onChange,
4339
4349
  content = _ref4.content,
4340
4350
  _ref4$outlined = _ref4.outlined,
4341
- outlined = _ref4$outlined === void 0 ? false : _ref4$outlined;
4351
+ outlined = _ref4$outlined === void 0 ? false : _ref4$outlined,
4352
+ onReload = _ref4.onReload;
4342
4353
  var id = field.id,
4343
4354
  type = field.type,
4344
4355
  item = field.item,
@@ -4351,6 +4362,10 @@ var FieldEditor = function FieldEditor(_ref4) {
4351
4362
  if (onChange) onChange(id, value);
4352
4363
  }
4353
4364
 
4365
+ function reload() {
4366
+ onReload();
4367
+ }
4368
+
4354
4369
  function renderField() {
4355
4370
  var value1 = field.value || field.value === "" ? field.value : field["default"];
4356
4371
  var isHidden = CHECK['isFunction'](hidden) ? hidden(field, value1) : hidden;
@@ -4405,7 +4420,8 @@ var FieldEditor = function FieldEditor(_ref4) {
4405
4420
  }) : /*#__PURE__*/React.createElement(CollectionEditor$1, {
4406
4421
  field: field,
4407
4422
  value: value1,
4408
- onChange: change
4423
+ onChange: change,
4424
+ onReload: reload
4409
4425
  });
4410
4426
 
4411
4427
  default:
@@ -4716,7 +4732,8 @@ var CollectionEditor$1 = function CollectionEditor(_ref10) {
4716
4732
  var field = _ref10.field,
4717
4733
  _ref10$value = _ref10.value,
4718
4734
  value = _ref10$value === void 0 ? [] : _ref10$value,
4719
- onChange = _ref10.onChange;
4735
+ onChange = _ref10.onChange,
4736
+ onReload = _ref10.onReload;
4720
4737
  var id = field.id,
4721
4738
  item = field.item,
4722
4739
  label = field.label,
@@ -4749,6 +4766,10 @@ var CollectionEditor$1 = function CollectionEditor(_ref10) {
4749
4766
  }
4750
4767
  }
4751
4768
 
4769
+ function reload() {
4770
+ if (onReload) onReload();
4771
+ }
4772
+
4752
4773
  var columns = Object.values(item).filter(function (field) {
4753
4774
  return field.column === true;
4754
4775
  }).map(function (item) {
@@ -4790,7 +4811,8 @@ var CollectionEditor$1 = function CollectionEditor(_ref10) {
4790
4811
  canDelete: true,
4791
4812
  remove: remove
4792
4813
  }), /*#__PURE__*/React.createElement("footer", null, Feeder ? /*#__PURE__*/React.createElement(Feeder, {
4793
- onAdd: add
4814
+ onAdd: add,
4815
+ onReload: reload
4794
4816
  }) : null, Adder ? /*#__PURE__*/React.createElement(CollectionAdder, {
4795
4817
  item: item,
4796
4818
  onAdd: add
@@ -5234,6 +5256,16 @@ function _catch$2(body, recover) {
5234
5256
 
5235
5257
 
5236
5258
  var CollectionPage = function CollectionPage(props) {
5259
+ var reloadSelection = function reloadSelection() {
5260
+ try {
5261
+ return Promise.resolve(pageContext.reloadSelection()).then(function () {
5262
+ setPageContext(Object.assign({}, pageContext));
5263
+ });
5264
+ } catch (e) {
5265
+ return Promise.reject(e);
5266
+ }
5267
+ };
5268
+
5237
5269
  var reload = function reload() {
5238
5270
  try {
5239
5271
  return Promise.resolve(pageContext.load()).then(function () {
@@ -5364,7 +5396,8 @@ var CollectionPage = function CollectionPage(props) {
5364
5396
  autosave: autosave,
5365
5397
  delay: delay,
5366
5398
  canDelete: canDelete,
5367
- canEdit: canEdit
5399
+ canEdit: canEdit,
5400
+ onReload: reloadSelection
5368
5401
  }), children ? /*#__PURE__*/React.createElement("article", null, children) : null));
5369
5402
  };
5370
5403
  var CollectionFilters = function CollectionFilters(props) {
@@ -5664,7 +5697,8 @@ var CollectionEditor = function CollectionEditor(props) {
5664
5697
  autosave = _props$autosave2 === void 0 ? false : _props$autosave2,
5665
5698
  _props$delay2 = props.delay,
5666
5699
  delay = _props$delay2 === void 0 ? 1000 : _props$delay2,
5667
- canDelete = props.canDelete;
5700
+ canDelete = props.canDelete,
5701
+ onReload = props.onReload;
5668
5702
  var timer = useRef(null);
5669
5703
 
5670
5704
  var _useState4 = useState(selected),
@@ -5704,19 +5738,22 @@ var CollectionEditor = function CollectionEditor(props) {
5704
5738
  case 'TABBED':
5705
5739
  return /*#__PURE__*/React.createElement(TabbedContentEditor, _extends({}, props, {
5706
5740
  content: content,
5707
- onChange: change
5741
+ onChange: change,
5742
+ onReload: onReload
5708
5743
  }));
5709
5744
 
5710
5745
  case 'TREEDED':
5711
5746
  return /*#__PURE__*/React.createElement(TreededContentEditor, _extends({}, props, {
5712
5747
  content: content,
5713
- onChange: change
5748
+ onChange: change,
5749
+ onReload: onReload
5714
5750
  }));
5715
5751
 
5716
5752
  default:
5717
5753
  return /*#__PURE__*/React.createElement(ContentEditor, _extends({}, props, {
5718
5754
  content: content,
5719
- onChange: change
5755
+ onChange: change,
5756
+ onReload: onReload
5720
5757
  }));
5721
5758
  }
5722
5759
  }
@@ -5791,6 +5828,17 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5791
5828
  return Promise.reject(e);
5792
5829
  }
5793
5830
  },
5831
+ reloadSelection: function reloadSelection() {
5832
+ try {
5833
+ var _this6 = this;
5834
+
5835
+ return Promise.resolve(_this6.fetch(selected.id)).then(function (result) {
5836
+ _this6.selected = result;
5837
+ });
5838
+ } catch (e) {
5839
+ return Promise.reject(e);
5840
+ }
5841
+ },
5794
5842
  fetch: function fetch(id) {
5795
5843
  try {
5796
5844
  return Promise.resolve(_catch$2(function () {
@@ -5807,11 +5855,11 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5807
5855
  },
5808
5856
  create: function create(form) {
5809
5857
  try {
5810
- var _this6 = this;
5858
+ var _this8 = this;
5811
5859
 
5812
5860
  var _temp6 = _catch$2(function () {
5813
5861
  return Promise.resolve(API.create(form)).then(function () {
5814
- return Promise.resolve(_this6.load()).then(function () {});
5862
+ return Promise.resolve(_this8.load()).then(function () {});
5815
5863
  });
5816
5864
  }, function (error) {
5817
5865
  console.log(error);
@@ -5824,11 +5872,11 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5824
5872
  },
5825
5873
  update: function update(form) {
5826
5874
  try {
5827
- var _this8 = this;
5875
+ var _this10 = this;
5828
5876
 
5829
5877
  var _temp8 = _catch$2(function () {
5830
5878
  return Promise.resolve(API.update(form)).then(function () {
5831
- return Promise.resolve(_this8.load()).then(function () {});
5879
+ return Promise.resolve(_this10.load()).then(function () {});
5832
5880
  });
5833
5881
  }, function (error) {
5834
5882
  console.log(error);
@@ -5841,11 +5889,11 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5841
5889
  },
5842
5890
  patch: function patch(id, form) {
5843
5891
  try {
5844
- var _this10 = this;
5892
+ var _this12 = this;
5845
5893
 
5846
5894
  var _temp10 = _catch$2(function () {
5847
5895
  return Promise.resolve(API.patch(id, form)).then(function () {
5848
- return Promise.resolve(_this10.load()).then(function () {});
5896
+ return Promise.resolve(_this12.load()).then(function () {});
5849
5897
  });
5850
5898
  }, function (error) {
5851
5899
  console.log(error);
@@ -5858,11 +5906,11 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5858
5906
  },
5859
5907
  updateProperty: function updateProperty(id, propertyName, form) {
5860
5908
  try {
5861
- var _this12 = this;
5909
+ var _this14 = this;
5862
5910
 
5863
5911
  var _temp12 = _catch$2(function () {
5864
5912
  return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
5865
- return Promise.resolve(_this12.load()).then(function () {});
5913
+ return Promise.resolve(_this14.load()).then(function () {});
5866
5914
  });
5867
5915
  }, function (error) {
5868
5916
  console.log(error);
@@ -5875,11 +5923,11 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5875
5923
  },
5876
5924
  remove: function remove(id) {
5877
5925
  try {
5878
- var _this14 = this;
5926
+ var _this16 = this;
5879
5927
 
5880
5928
  var _temp14 = _catch$2(function () {
5881
5929
  return Promise.resolve(API.remove(id)).then(function () {
5882
- return Promise.resolve(_this14.load()).then(function () {});
5930
+ return Promise.resolve(_this16.load()).then(function () {});
5883
5931
  });
5884
5932
  }, function (error) {
5885
5933
  console.log(error);