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.cjs CHANGED
@@ -5663,6 +5663,8 @@ var CollectionPage = function CollectionPage(props) {
5663
5663
  autosave = _props$autosave === void 0 ? false : _props$autosave,
5664
5664
  _props$delay = props.delay,
5665
5665
  delay = _props$delay === void 0 ? 1000 : _props$delay,
5666
+ _props$patch = props.patch,
5667
+ patch = _props$patch === void 0 ? false : _props$patch,
5666
5668
  groupBy = props.groupBy,
5667
5669
  levels = props.levels,
5668
5670
  sorter = props.sorter,
@@ -5781,7 +5783,8 @@ var CollectionPage = function CollectionPage(props) {
5781
5783
  delay: delay,
5782
5784
  canDelete: canDelete,
5783
5785
  canEdit: canEdit,
5784
- onReload: reloadSelection
5786
+ onReload: reloadSelection,
5787
+ patch: patch
5785
5788
  }), children ? /*#__PURE__*/React__default["default"].createElement("article", null, children) : null, /*#__PURE__*/React__default["default"].createElement("footer", null, footer)));
5786
5789
  };
5787
5790
  var CollectionFilters = function CollectionFilters(props) {
@@ -6063,9 +6066,19 @@ var CollectionTree = function CollectionTree(props) {
6063
6066
  var CollectionEditor = function CollectionEditor(props) {
6064
6067
  var save = function save() {
6065
6068
  try {
6066
- return Promise.resolve(pageContext.update(form)).then(function () {
6069
+ var _temp3 = function _temp3() {
6067
6070
  setPageContext(Object.assign({}, pageContext));
6068
- });
6071
+ };
6072
+
6073
+ var _temp4 = function () {
6074
+ if (patch) {
6075
+ return Promise.resolve(pageContext.patch(form.id, form)).then(function () {});
6076
+ } else {
6077
+ return Promise.resolve(pageContext.update(form)).then(function () {});
6078
+ }
6079
+ }();
6080
+
6081
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
6069
6082
  } catch (e) {
6070
6083
  return Promise.reject(e);
6071
6084
  }
@@ -6095,7 +6108,9 @@ var CollectionEditor = function CollectionEditor(props) {
6095
6108
  _props$delay2 = props.delay,
6096
6109
  delay = _props$delay2 === void 0 ? 1000 : _props$delay2,
6097
6110
  canDelete = props.canDelete,
6098
- onReload = props.onReload;
6111
+ onReload = props.onReload,
6112
+ _props$patch2 = props.patch,
6113
+ patch = _props$patch2 === void 0 ? false : _props$patch2;
6099
6114
  var timer = React.useRef(null);
6100
6115
 
6101
6116
  var _useState5 = React.useState(selected),
@@ -6193,7 +6208,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6193
6208
  try {
6194
6209
  var _this2 = this;
6195
6210
 
6196
- var _temp2 = _catch$3(function () {
6211
+ var _temp6 = _catch$3(function () {
6197
6212
  return Promise.resolve(API.all(null, page)).then(function (data) {
6198
6213
  _this2.all = field ? data[field] : data;
6199
6214
  });
@@ -6201,7 +6216,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6201
6216
  console.log(error);
6202
6217
  });
6203
6218
 
6204
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
6219
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6205
6220
  } catch (e) {
6206
6221
  return Promise.reject(e);
6207
6222
  }
@@ -6210,7 +6225,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6210
6225
  try {
6211
6226
  var _this4 = this;
6212
6227
 
6213
- var _temp4 = function () {
6228
+ var _temp8 = function () {
6214
6229
  if (fetching) {
6215
6230
  return Promise.resolve(_this4.fetch(id)).then(function (result) {
6216
6231
  _this4.selected = result;
@@ -6224,7 +6239,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6224
6239
  }
6225
6240
  }();
6226
6241
 
6227
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
6242
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6228
6243
  } catch (e) {
6229
6244
  return Promise.reject(e);
6230
6245
  }
@@ -6258,7 +6273,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6258
6273
  try {
6259
6274
  var _this8 = this;
6260
6275
 
6261
- var _temp6 = _catch$3(function () {
6276
+ var _temp10 = _catch$3(function () {
6262
6277
  return Promise.resolve(API.create(form)).then(function () {
6263
6278
  return Promise.resolve(_this8.load()).then(function () {});
6264
6279
  });
@@ -6266,7 +6281,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6266
6281
  console.log(error);
6267
6282
  });
6268
6283
 
6269
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6284
+ return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6270
6285
  } catch (e) {
6271
6286
  return Promise.reject(e);
6272
6287
  }
@@ -6275,7 +6290,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6275
6290
  try {
6276
6291
  var _this10 = this;
6277
6292
 
6278
- var _temp8 = _catch$3(function () {
6293
+ var _temp12 = _catch$3(function () {
6279
6294
  return Promise.resolve(API.update(form)).then(function () {
6280
6295
  return Promise.resolve(_this10.load()).then(function () {});
6281
6296
  });
@@ -6283,7 +6298,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6283
6298
  console.log(error);
6284
6299
  });
6285
6300
 
6286
- return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6301
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6287
6302
  } catch (e) {
6288
6303
  return Promise.reject(e);
6289
6304
  }
@@ -6292,7 +6307,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6292
6307
  try {
6293
6308
  var _this12 = this;
6294
6309
 
6295
- var _temp10 = _catch$3(function () {
6310
+ var _temp14 = _catch$3(function () {
6296
6311
  return Promise.resolve(API.patch(id, form)).then(function () {
6297
6312
  return Promise.resolve(_this12.load()).then(function () {});
6298
6313
  });
@@ -6300,7 +6315,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6300
6315
  console.log(error);
6301
6316
  });
6302
6317
 
6303
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6318
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6304
6319
  } catch (e) {
6305
6320
  return Promise.reject(e);
6306
6321
  }
@@ -6309,7 +6324,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6309
6324
  try {
6310
6325
  var _this14 = this;
6311
6326
 
6312
- var _temp12 = _catch$3(function () {
6327
+ var _temp16 = _catch$3(function () {
6313
6328
  return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
6314
6329
  return Promise.resolve(_this14.load()).then(function () {});
6315
6330
  });
@@ -6317,7 +6332,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6317
6332
  console.log(error);
6318
6333
  });
6319
6334
 
6320
- return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6335
+ return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(function () {}) : void 0);
6321
6336
  } catch (e) {
6322
6337
  return Promise.reject(e);
6323
6338
  }
@@ -6326,7 +6341,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6326
6341
  try {
6327
6342
  var _this16 = this;
6328
6343
 
6329
- var _temp14 = _catch$3(function () {
6344
+ var _temp18 = _catch$3(function () {
6330
6345
  return Promise.resolve(API.remove(id)).then(function () {
6331
6346
  return Promise.resolve(_this16.load()).then(function () {});
6332
6347
  });
@@ -6334,7 +6349,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6334
6349
  console.log(error);
6335
6350
  });
6336
6351
 
6337
- return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6352
+ return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
6338
6353
  } catch (e) {
6339
6354
  return Promise.reject(e);
6340
6355
  }