ywana-core8 0.0.668 → 0.0.669

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
@@ -5676,6 +5676,8 @@ var CollectionPage = function CollectionPage(props) {
5676
5676
  delay = _props$delay === void 0 ? 1000 : _props$delay,
5677
5677
  _props$patch = props.patch,
5678
5678
  patch = _props$patch === void 0 ? false : _props$patch,
5679
+ _props$versioning = props.versioning,
5680
+ versioning = _props$versioning === void 0 ? false : _props$versioning,
5679
5681
  groupBy = props.groupBy,
5680
5682
  levels = props.levels,
5681
5683
  sorter = props.sorter,
@@ -5683,12 +5685,12 @@ var CollectionPage = function CollectionPage(props) {
5683
5685
  editor = props.editor,
5684
5686
  footer = props.footer,
5685
5687
  children = props.children;
5688
+ var context = CollectionContext(url, field, host, page, fetching, versioning);
5686
5689
 
5687
5690
  var _useContext = React.useContext(PageContext),
5688
5691
  pageContext = _useContext[0],
5689
5692
  setPageContext = _useContext[1];
5690
5693
 
5691
- var context = CollectionContext(url, field, host, page, fetching);
5692
5694
  var all = pageContext.all;
5693
5695
  React.useEffect(function () {
5694
5696
  try {
@@ -6212,7 +6214,11 @@ var CollectionEditor = function CollectionEditor(props) {
6212
6214
  */
6213
6215
 
6214
6216
 
6215
- var CollectionContext = function CollectionContext(url, field, host, page, fetching) {
6217
+ var CollectionContext = function CollectionContext(url, field, host, page, fetching, versioning) {
6218
+ if (versioning === void 0) {
6219
+ versioning = false;
6220
+ }
6221
+
6216
6222
  var API = CollectionAPI(url, host);
6217
6223
  return {
6218
6224
  all: [],
@@ -6291,6 +6297,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6291
6297
  var _this8 = this;
6292
6298
 
6293
6299
  var _temp10 = _catch$3(function () {
6300
+ if (versioning) form.version = 1;
6294
6301
  return Promise.resolve(API.create(form)).then(function () {
6295
6302
  return Promise.resolve(_this8.load()).then(function () {});
6296
6303
  });
@@ -6308,6 +6315,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6308
6315
  var _this10 = this;
6309
6316
 
6310
6317
  var _temp12 = _catch$3(function () {
6318
+ if (versioning) form.version = form.version ? form.version + 1 : 1;
6311
6319
  return Promise.resolve(API.update(form)).then(function () {
6312
6320
  return Promise.resolve(_this10.load()).then(function () {});
6313
6321
  });
@@ -6325,6 +6333,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6325
6333
  var _this12 = this;
6326
6334
 
6327
6335
  var _temp14 = _catch$3(function () {
6336
+ if (versioning) form.version = form.version ? form.version + 1 : 1;
6328
6337
  return Promise.resolve(API.patch(id, form)).then(function () {
6329
6338
  return Promise.resolve(_this12.load()).then(function () {});
6330
6339
  });