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.
package/dist/index.cjs CHANGED
@@ -4150,7 +4150,8 @@ var ContentEditor = function ContentEditor(_ref) {
4150
4150
  _ref$outlined = _ref.outlined,
4151
4151
  outlined = _ref$outlined === void 0 ? true : _ref$outlined,
4152
4152
  className = _ref.className,
4153
- onChange = _ref.onChange;
4153
+ onChange = _ref.onChange,
4154
+ onReload = _ref.onReload;
4154
4155
 
4155
4156
  function change(id, value) {
4156
4157
  var _Object$assign;
@@ -4159,6 +4160,10 @@ var ContentEditor = function ContentEditor(_ref) {
4159
4160
  if (onChange) onChange(nextValue);
4160
4161
  }
4161
4162
 
4163
+ function reload() {
4164
+ if (onReload) onReload();
4165
+ }
4166
+
4162
4167
  var sections = content.sections();
4163
4168
  return /*#__PURE__*/React__default["default"].createElement("div", {
4164
4169
  className: "content-editor " + className
@@ -4177,6 +4182,7 @@ var ContentEditor = function ContentEditor(_ref) {
4177
4182
  key: field.id,
4178
4183
  field: field,
4179
4184
  onChange: change,
4185
+ onReload: reload,
4180
4186
  outlined: outlined,
4181
4187
  content: content
4182
4188
  });
@@ -4192,7 +4198,8 @@ var TabbedContentEditor = function TabbedContentEditor(_ref2) {
4192
4198
  filter = _ref2.filter,
4193
4199
  _ref2$grouped = _ref2.grouped,
4194
4200
  grouped = _ref2$grouped === void 0 ? false : _ref2$grouped,
4195
- onChange = _ref2.onChange;
4201
+ onChange = _ref2.onChange,
4202
+ onReload = _ref2.onReload;
4196
4203
 
4197
4204
  var _useState = React.useState(0),
4198
4205
  tab = _useState[0],
@@ -4254,7 +4261,8 @@ var TabbedContentEditor = function TabbedContentEditor(_ref2) {
4254
4261
  key: field.id,
4255
4262
  field: field,
4256
4263
  onChange: change,
4257
- content: content
4264
+ content: content,
4265
+ onReload: onReload
4258
4266
  });
4259
4267
  }));
4260
4268
  }) : fields.filter(function (field) {
@@ -4266,7 +4274,8 @@ var TabbedContentEditor = function TabbedContentEditor(_ref2) {
4266
4274
  key: field.id,
4267
4275
  field: field,
4268
4276
  onChange: change,
4269
- content: content
4277
+ content: content,
4278
+ onReload: onReload
4270
4279
  });
4271
4280
  }));
4272
4281
  })));
@@ -4334,7 +4343,8 @@ var TreededContentEditor = function TreededContentEditor(_ref3) {
4334
4343
  }) : null);
4335
4344
  }))), /*#__PURE__*/React__default["default"].createElement("div", null, selected ? /*#__PURE__*/React__default["default"].createElement(TabbedContentEditor, {
4336
4345
  content: selected.item,
4337
- onChange: change
4346
+ onChange: change,
4347
+ onReload: reload
4338
4348
  }) : "select"));
4339
4349
  };
4340
4350
  /**
@@ -4346,7 +4356,8 @@ var FieldEditor = function FieldEditor(_ref4) {
4346
4356
  onChange = _ref4.onChange,
4347
4357
  content = _ref4.content,
4348
4358
  _ref4$outlined = _ref4.outlined,
4349
- outlined = _ref4$outlined === void 0 ? false : _ref4$outlined;
4359
+ outlined = _ref4$outlined === void 0 ? false : _ref4$outlined,
4360
+ onReload = _ref4.onReload;
4350
4361
  var id = field.id,
4351
4362
  type = field.type,
4352
4363
  item = field.item,
@@ -4359,6 +4370,10 @@ var FieldEditor = function FieldEditor(_ref4) {
4359
4370
  if (onChange) onChange(id, value);
4360
4371
  }
4361
4372
 
4373
+ function reload() {
4374
+ onReload();
4375
+ }
4376
+
4362
4377
  function renderField() {
4363
4378
  var value1 = field.value || field.value === "" ? field.value : field["default"];
4364
4379
  var isHidden = CHECK['isFunction'](hidden) ? hidden(field, value1) : hidden;
@@ -4413,7 +4428,8 @@ var FieldEditor = function FieldEditor(_ref4) {
4413
4428
  }) : /*#__PURE__*/React__default["default"].createElement(CollectionEditor$1, {
4414
4429
  field: field,
4415
4430
  value: value1,
4416
- onChange: change
4431
+ onChange: change,
4432
+ onReload: reload
4417
4433
  });
4418
4434
 
4419
4435
  default:
@@ -4724,7 +4740,8 @@ var CollectionEditor$1 = function CollectionEditor(_ref10) {
4724
4740
  var field = _ref10.field,
4725
4741
  _ref10$value = _ref10.value,
4726
4742
  value = _ref10$value === void 0 ? [] : _ref10$value,
4727
- onChange = _ref10.onChange;
4743
+ onChange = _ref10.onChange,
4744
+ onReload = _ref10.onReload;
4728
4745
  var id = field.id,
4729
4746
  item = field.item,
4730
4747
  label = field.label,
@@ -4757,6 +4774,10 @@ var CollectionEditor$1 = function CollectionEditor(_ref10) {
4757
4774
  }
4758
4775
  }
4759
4776
 
4777
+ function reload() {
4778
+ if (onReload) onReload();
4779
+ }
4780
+
4760
4781
  var columns = Object.values(item).filter(function (field) {
4761
4782
  return field.column === true;
4762
4783
  }).map(function (item) {
@@ -4798,7 +4819,8 @@ var CollectionEditor$1 = function CollectionEditor(_ref10) {
4798
4819
  canDelete: true,
4799
4820
  remove: remove
4800
4821
  }), /*#__PURE__*/React__default["default"].createElement("footer", null, Feeder ? /*#__PURE__*/React__default["default"].createElement(Feeder, {
4801
- onAdd: add
4822
+ onAdd: add,
4823
+ onReload: reload
4802
4824
  }) : null, Adder ? /*#__PURE__*/React__default["default"].createElement(CollectionAdder, {
4803
4825
  item: item,
4804
4826
  onAdd: add
@@ -5242,6 +5264,16 @@ function _catch$2(body, recover) {
5242
5264
 
5243
5265
 
5244
5266
  var CollectionPage = function CollectionPage(props) {
5267
+ var reloadSelection = function reloadSelection() {
5268
+ try {
5269
+ return Promise.resolve(pageContext.reloadSelection()).then(function () {
5270
+ setPageContext(Object.assign({}, pageContext));
5271
+ });
5272
+ } catch (e) {
5273
+ return Promise.reject(e);
5274
+ }
5275
+ };
5276
+
5245
5277
  var reload = function reload() {
5246
5278
  try {
5247
5279
  return Promise.resolve(pageContext.load()).then(function () {
@@ -5372,7 +5404,8 @@ var CollectionPage = function CollectionPage(props) {
5372
5404
  autosave: autosave,
5373
5405
  delay: delay,
5374
5406
  canDelete: canDelete,
5375
- canEdit: canEdit
5407
+ canEdit: canEdit,
5408
+ onReload: reloadSelection
5376
5409
  }), children ? /*#__PURE__*/React__default["default"].createElement("article", null, children) : null));
5377
5410
  };
5378
5411
  var CollectionFilters = function CollectionFilters(props) {
@@ -5672,7 +5705,8 @@ var CollectionEditor = function CollectionEditor(props) {
5672
5705
  autosave = _props$autosave2 === void 0 ? false : _props$autosave2,
5673
5706
  _props$delay2 = props.delay,
5674
5707
  delay = _props$delay2 === void 0 ? 1000 : _props$delay2,
5675
- canDelete = props.canDelete;
5708
+ canDelete = props.canDelete,
5709
+ onReload = props.onReload;
5676
5710
  var timer = React.useRef(null);
5677
5711
 
5678
5712
  var _useState4 = React.useState(selected),
@@ -5712,19 +5746,22 @@ var CollectionEditor = function CollectionEditor(props) {
5712
5746
  case 'TABBED':
5713
5747
  return /*#__PURE__*/React__default["default"].createElement(TabbedContentEditor, _extends({}, props, {
5714
5748
  content: content,
5715
- onChange: change
5749
+ onChange: change,
5750
+ onReload: onReload
5716
5751
  }));
5717
5752
 
5718
5753
  case 'TREEDED':
5719
5754
  return /*#__PURE__*/React__default["default"].createElement(TreededContentEditor, _extends({}, props, {
5720
5755
  content: content,
5721
- onChange: change
5756
+ onChange: change,
5757
+ onReload: onReload
5722
5758
  }));
5723
5759
 
5724
5760
  default:
5725
5761
  return /*#__PURE__*/React__default["default"].createElement(ContentEditor, _extends({}, props, {
5726
5762
  content: content,
5727
- onChange: change
5763
+ onChange: change,
5764
+ onReload: onReload
5728
5765
  }));
5729
5766
  }
5730
5767
  }
@@ -5799,6 +5836,17 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5799
5836
  return Promise.reject(e);
5800
5837
  }
5801
5838
  },
5839
+ reloadSelection: function reloadSelection() {
5840
+ try {
5841
+ var _this6 = this;
5842
+
5843
+ return Promise.resolve(_this6.fetch(selected.id)).then(function (result) {
5844
+ _this6.selected = result;
5845
+ });
5846
+ } catch (e) {
5847
+ return Promise.reject(e);
5848
+ }
5849
+ },
5802
5850
  fetch: function fetch(id) {
5803
5851
  try {
5804
5852
  return Promise.resolve(_catch$2(function () {
@@ -5815,11 +5863,11 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5815
5863
  },
5816
5864
  create: function create(form) {
5817
5865
  try {
5818
- var _this6 = this;
5866
+ var _this8 = this;
5819
5867
 
5820
5868
  var _temp6 = _catch$2(function () {
5821
5869
  return Promise.resolve(API.create(form)).then(function () {
5822
- return Promise.resolve(_this6.load()).then(function () {});
5870
+ return Promise.resolve(_this8.load()).then(function () {});
5823
5871
  });
5824
5872
  }, function (error) {
5825
5873
  console.log(error);
@@ -5832,11 +5880,11 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5832
5880
  },
5833
5881
  update: function update(form) {
5834
5882
  try {
5835
- var _this8 = this;
5883
+ var _this10 = this;
5836
5884
 
5837
5885
  var _temp8 = _catch$2(function () {
5838
5886
  return Promise.resolve(API.update(form)).then(function () {
5839
- return Promise.resolve(_this8.load()).then(function () {});
5887
+ return Promise.resolve(_this10.load()).then(function () {});
5840
5888
  });
5841
5889
  }, function (error) {
5842
5890
  console.log(error);
@@ -5849,11 +5897,11 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5849
5897
  },
5850
5898
  patch: function patch(id, form) {
5851
5899
  try {
5852
- var _this10 = this;
5900
+ var _this12 = this;
5853
5901
 
5854
5902
  var _temp10 = _catch$2(function () {
5855
5903
  return Promise.resolve(API.patch(id, form)).then(function () {
5856
- return Promise.resolve(_this10.load()).then(function () {});
5904
+ return Promise.resolve(_this12.load()).then(function () {});
5857
5905
  });
5858
5906
  }, function (error) {
5859
5907
  console.log(error);
@@ -5866,11 +5914,11 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5866
5914
  },
5867
5915
  updateProperty: function updateProperty(id, propertyName, form) {
5868
5916
  try {
5869
- var _this12 = this;
5917
+ var _this14 = this;
5870
5918
 
5871
5919
  var _temp12 = _catch$2(function () {
5872
5920
  return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
5873
- return Promise.resolve(_this12.load()).then(function () {});
5921
+ return Promise.resolve(_this14.load()).then(function () {});
5874
5922
  });
5875
5923
  }, function (error) {
5876
5924
  console.log(error);
@@ -5883,11 +5931,11 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
5883
5931
  },
5884
5932
  remove: function remove(id) {
5885
5933
  try {
5886
- var _this14 = this;
5934
+ var _this16 = this;
5887
5935
 
5888
5936
  var _temp14 = _catch$2(function () {
5889
5937
  return Promise.resolve(API.remove(id)).then(function () {
5890
- return Promise.resolve(_this14.load()).then(function () {});
5938
+ return Promise.resolve(_this16.load()).then(function () {});
5891
5939
  });
5892
5940
  }, function (error) {
5893
5941
  console.log(error);