ywana-core8 0.0.628 → 0.0.629

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
@@ -5657,6 +5657,8 @@
5657
5657
  autosave = _props$autosave === void 0 ? false : _props$autosave,
5658
5658
  _props$delay = props.delay,
5659
5659
  delay = _props$delay === void 0 ? 1000 : _props$delay,
5660
+ _props$patch = props.patch,
5661
+ patch = _props$patch === void 0 ? false : _props$patch,
5660
5662
  groupBy = props.groupBy,
5661
5663
  levels = props.levels,
5662
5664
  sorter = props.sorter,
@@ -5775,7 +5777,8 @@
5775
5777
  delay: delay,
5776
5778
  canDelete: canDelete,
5777
5779
  canEdit: canEdit,
5778
- onReload: reloadSelection
5780
+ onReload: reloadSelection,
5781
+ patch: patch
5779
5782
  }), children ? /*#__PURE__*/React__default["default"].createElement("article", null, children) : null, /*#__PURE__*/React__default["default"].createElement("footer", null, footer)));
5780
5783
  };
5781
5784
  var CollectionFilters = function CollectionFilters(props) {
@@ -6057,9 +6060,19 @@
6057
6060
  var CollectionEditor = function CollectionEditor(props) {
6058
6061
  var save = function save() {
6059
6062
  try {
6060
- return Promise.resolve(pageContext.update(form)).then(function () {
6063
+ var _temp3 = function _temp3() {
6061
6064
  setPageContext(Object.assign({}, pageContext));
6062
- });
6065
+ };
6066
+
6067
+ var _temp4 = function () {
6068
+ if (patch) {
6069
+ return Promise.resolve(pageContext.patch(form.id, form)).then(function () {});
6070
+ } else {
6071
+ return Promise.resolve(pageContext.update(form)).then(function () {});
6072
+ }
6073
+ }();
6074
+
6075
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
6063
6076
  } catch (e) {
6064
6077
  return Promise.reject(e);
6065
6078
  }
@@ -6089,7 +6102,9 @@
6089
6102
  _props$delay2 = props.delay,
6090
6103
  delay = _props$delay2 === void 0 ? 1000 : _props$delay2,
6091
6104
  canDelete = props.canDelete,
6092
- onReload = props.onReload;
6105
+ onReload = props.onReload,
6106
+ _props$patch2 = props.patch,
6107
+ patch = _props$patch2 === void 0 ? false : _props$patch2;
6093
6108
  var timer = React.useRef(null);
6094
6109
 
6095
6110
  var _useState5 = React.useState(selected),
@@ -6187,7 +6202,7 @@
6187
6202
  try {
6188
6203
  var _this2 = this;
6189
6204
 
6190
- var _temp2 = _catch$3(function () {
6205
+ var _temp6 = _catch$3(function () {
6191
6206
  return Promise.resolve(API.all(null, page)).then(function (data) {
6192
6207
  _this2.all = field ? data[field] : data;
6193
6208
  });
@@ -6195,7 +6210,7 @@
6195
6210
  console.log(error);
6196
6211
  });
6197
6212
 
6198
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
6213
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6199
6214
  } catch (e) {
6200
6215
  return Promise.reject(e);
6201
6216
  }
@@ -6204,7 +6219,7 @@
6204
6219
  try {
6205
6220
  var _this4 = this;
6206
6221
 
6207
- var _temp4 = function () {
6222
+ var _temp8 = function () {
6208
6223
  if (fetching) {
6209
6224
  return Promise.resolve(_this4.fetch(id)).then(function (result) {
6210
6225
  _this4.selected = result;
@@ -6218,7 +6233,7 @@
6218
6233
  }
6219
6234
  }();
6220
6235
 
6221
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
6236
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6222
6237
  } catch (e) {
6223
6238
  return Promise.reject(e);
6224
6239
  }
@@ -6252,7 +6267,7 @@
6252
6267
  try {
6253
6268
  var _this8 = this;
6254
6269
 
6255
- var _temp6 = _catch$3(function () {
6270
+ var _temp10 = _catch$3(function () {
6256
6271
  return Promise.resolve(API.create(form)).then(function () {
6257
6272
  return Promise.resolve(_this8.load()).then(function () {});
6258
6273
  });
@@ -6260,7 +6275,7 @@
6260
6275
  console.log(error);
6261
6276
  });
6262
6277
 
6263
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6278
+ return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6264
6279
  } catch (e) {
6265
6280
  return Promise.reject(e);
6266
6281
  }
@@ -6269,7 +6284,7 @@
6269
6284
  try {
6270
6285
  var _this10 = this;
6271
6286
 
6272
- var _temp8 = _catch$3(function () {
6287
+ var _temp12 = _catch$3(function () {
6273
6288
  return Promise.resolve(API.update(form)).then(function () {
6274
6289
  return Promise.resolve(_this10.load()).then(function () {});
6275
6290
  });
@@ -6277,7 +6292,7 @@
6277
6292
  console.log(error);
6278
6293
  });
6279
6294
 
6280
- return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6295
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6281
6296
  } catch (e) {
6282
6297
  return Promise.reject(e);
6283
6298
  }
@@ -6286,7 +6301,7 @@
6286
6301
  try {
6287
6302
  var _this12 = this;
6288
6303
 
6289
- var _temp10 = _catch$3(function () {
6304
+ var _temp14 = _catch$3(function () {
6290
6305
  return Promise.resolve(API.patch(id, form)).then(function () {
6291
6306
  return Promise.resolve(_this12.load()).then(function () {});
6292
6307
  });
@@ -6294,7 +6309,7 @@
6294
6309
  console.log(error);
6295
6310
  });
6296
6311
 
6297
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6312
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6298
6313
  } catch (e) {
6299
6314
  return Promise.reject(e);
6300
6315
  }
@@ -6303,7 +6318,7 @@
6303
6318
  try {
6304
6319
  var _this14 = this;
6305
6320
 
6306
- var _temp12 = _catch$3(function () {
6321
+ var _temp16 = _catch$3(function () {
6307
6322
  return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
6308
6323
  return Promise.resolve(_this14.load()).then(function () {});
6309
6324
  });
@@ -6311,7 +6326,7 @@
6311
6326
  console.log(error);
6312
6327
  });
6313
6328
 
6314
- return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6329
+ return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(function () {}) : void 0);
6315
6330
  } catch (e) {
6316
6331
  return Promise.reject(e);
6317
6332
  }
@@ -6320,7 +6335,7 @@
6320
6335
  try {
6321
6336
  var _this16 = this;
6322
6337
 
6323
- var _temp14 = _catch$3(function () {
6338
+ var _temp18 = _catch$3(function () {
6324
6339
  return Promise.resolve(API.remove(id)).then(function () {
6325
6340
  return Promise.resolve(_this16.load()).then(function () {});
6326
6341
  });
@@ -6328,7 +6343,7 @@
6328
6343
  console.log(error);
6329
6344
  });
6330
6345
 
6331
- return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6346
+ return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
6332
6347
  } catch (e) {
6333
6348
  return Promise.reject(e);
6334
6349
  }