ywana-core8 0.0.627 → 0.0.630

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
@@ -1200,40 +1200,42 @@ var ContentType = /*#__PURE__*/function () {
1200
1200
  optional = field.optional;
1201
1201
  var entryData = data ? data[name] : null;
1202
1202
 
1203
- switch (type) {
1204
- case TYPES.STRING:
1205
- next[name] = entryData || field["default"];
1206
- break;
1207
-
1208
- case TYPES.NUMBER:
1209
- next[name] = entryData || field["default"];
1210
- break;
1211
-
1212
- case TYPES.BOOLEAN:
1213
- next[name] = entryData || field["default"];
1214
- break;
1215
-
1216
- case TYPES.ENTITY:
1217
- if (optional === true && !entryData) break;
1218
- var child1 = new ContentType(item);
1219
- next[name] = child1.value(entryData);
1220
- break;
1221
-
1222
- case TYPES.ARRAY:
1223
- if (item === TYPES.STRING) {
1224
- next[name] = entryData ? entryData : [];
1225
- } else {
1226
- var child2 = new ContentType(item);
1227
- next[name] = entryData ? entryData.map(function (data2) {
1228
- return child2.value(data2);
1229
- }) : [];
1230
- }
1203
+ if (outsider === true) ; else {
1204
+ switch (type) {
1205
+ case TYPES.STRING:
1206
+ next[name] = entryData || field["default"];
1207
+ break;
1208
+
1209
+ case TYPES.NUMBER:
1210
+ next[name] = entryData || field["default"];
1211
+ break;
1212
+
1213
+ case TYPES.BOOLEAN:
1214
+ next[name] = entryData || field["default"];
1215
+ break;
1216
+
1217
+ case TYPES.ENTITY:
1218
+ if (optional === true && !entryData) break;
1219
+ var child1 = new ContentType(item);
1220
+ next[name] = child1.value(entryData);
1221
+ break;
1222
+
1223
+ case TYPES.ARRAY:
1224
+ if (item === TYPES.STRING) {
1225
+ next[name] = entryData ? entryData : [];
1226
+ } else {
1227
+ var child2 = new ContentType(item);
1228
+ next[name] = entryData ? entryData.map(function (data2) {
1229
+ return child2.value(data2);
1230
+ }) : [];
1231
+ }
1231
1232
 
1232
- break;
1233
+ break;
1233
1234
 
1234
- default:
1235
- next[name] = field;
1236
- break;
1235
+ default:
1236
+ next[name] = field;
1237
+ break;
1238
+ }
1237
1239
  }
1238
1240
 
1239
1241
  return next;
@@ -4927,20 +4929,6 @@ var CollectionEditor$1 = function CollectionEditor(_ref11) {
4927
4929
  function reload() {
4928
4930
  if (onReload) onReload();
4929
4931
  }
4930
- /* const columns = Object.values(item)
4931
- .filter(field => field.column === true)
4932
- .map((item) => ({ ...item, onChange: change }))
4933
- columns.push({ id: 'actions', label: 'Actions' })
4934
- const rows = value.map((item, index) => ({
4935
- ...item,
4936
- id: index,
4937
- actions: [
4938
- <Icon icon='delete' clickable action={() => remove(index)} size="small" />
4939
- ]
4940
- }))
4941
- const table = { columns, rows }
4942
- */
4943
-
4944
4932
 
4945
4933
  return /*#__PURE__*/React__default["default"].createElement("div", {
4946
4934
  className: "collection-editor"
@@ -5663,6 +5651,8 @@ var CollectionPage = function CollectionPage(props) {
5663
5651
  autosave = _props$autosave === void 0 ? false : _props$autosave,
5664
5652
  _props$delay = props.delay,
5665
5653
  delay = _props$delay === void 0 ? 1000 : _props$delay,
5654
+ _props$patch = props.patch,
5655
+ patch = _props$patch === void 0 ? false : _props$patch,
5666
5656
  groupBy = props.groupBy,
5667
5657
  levels = props.levels,
5668
5658
  sorter = props.sorter,
@@ -5781,7 +5771,8 @@ var CollectionPage = function CollectionPage(props) {
5781
5771
  delay: delay,
5782
5772
  canDelete: canDelete,
5783
5773
  canEdit: canEdit,
5784
- onReload: reloadSelection
5774
+ onReload: reloadSelection,
5775
+ patch: patch
5785
5776
  }), children ? /*#__PURE__*/React__default["default"].createElement("article", null, children) : null, /*#__PURE__*/React__default["default"].createElement("footer", null, footer)));
5786
5777
  };
5787
5778
  var CollectionFilters = function CollectionFilters(props) {
@@ -6063,9 +6054,19 @@ var CollectionTree = function CollectionTree(props) {
6063
6054
  var CollectionEditor = function CollectionEditor(props) {
6064
6055
  var save = function save() {
6065
6056
  try {
6066
- return Promise.resolve(pageContext.update(form)).then(function () {
6057
+ var _temp3 = function _temp3() {
6067
6058
  setPageContext(Object.assign({}, pageContext));
6068
- });
6059
+ };
6060
+
6061
+ var _temp4 = function () {
6062
+ if (patch) {
6063
+ return Promise.resolve(pageContext.patch(form.id, form)).then(function () {});
6064
+ } else {
6065
+ return Promise.resolve(pageContext.update(form)).then(function () {});
6066
+ }
6067
+ }();
6068
+
6069
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
6069
6070
  } catch (e) {
6070
6071
  return Promise.reject(e);
6071
6072
  }
@@ -6095,7 +6096,9 @@ var CollectionEditor = function CollectionEditor(props) {
6095
6096
  _props$delay2 = props.delay,
6096
6097
  delay = _props$delay2 === void 0 ? 1000 : _props$delay2,
6097
6098
  canDelete = props.canDelete,
6098
- onReload = props.onReload;
6099
+ onReload = props.onReload,
6100
+ _props$patch2 = props.patch,
6101
+ patch = _props$patch2 === void 0 ? false : _props$patch2;
6099
6102
  var timer = React.useRef(null);
6100
6103
 
6101
6104
  var _useState5 = React.useState(selected),
@@ -6193,7 +6196,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6193
6196
  try {
6194
6197
  var _this2 = this;
6195
6198
 
6196
- var _temp2 = _catch$3(function () {
6199
+ var _temp6 = _catch$3(function () {
6197
6200
  return Promise.resolve(API.all(null, page)).then(function (data) {
6198
6201
  _this2.all = field ? data[field] : data;
6199
6202
  });
@@ -6201,7 +6204,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6201
6204
  console.log(error);
6202
6205
  });
6203
6206
 
6204
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
6207
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6205
6208
  } catch (e) {
6206
6209
  return Promise.reject(e);
6207
6210
  }
@@ -6210,7 +6213,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6210
6213
  try {
6211
6214
  var _this4 = this;
6212
6215
 
6213
- var _temp4 = function () {
6216
+ var _temp8 = function () {
6214
6217
  if (fetching) {
6215
6218
  return Promise.resolve(_this4.fetch(id)).then(function (result) {
6216
6219
  _this4.selected = result;
@@ -6224,7 +6227,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6224
6227
  }
6225
6228
  }();
6226
6229
 
6227
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
6230
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6228
6231
  } catch (e) {
6229
6232
  return Promise.reject(e);
6230
6233
  }
@@ -6258,7 +6261,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6258
6261
  try {
6259
6262
  var _this8 = this;
6260
6263
 
6261
- var _temp6 = _catch$3(function () {
6264
+ var _temp10 = _catch$3(function () {
6262
6265
  return Promise.resolve(API.create(form)).then(function () {
6263
6266
  return Promise.resolve(_this8.load()).then(function () {});
6264
6267
  });
@@ -6266,7 +6269,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6266
6269
  console.log(error);
6267
6270
  });
6268
6271
 
6269
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6272
+ return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6270
6273
  } catch (e) {
6271
6274
  return Promise.reject(e);
6272
6275
  }
@@ -6275,7 +6278,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6275
6278
  try {
6276
6279
  var _this10 = this;
6277
6280
 
6278
- var _temp8 = _catch$3(function () {
6281
+ var _temp12 = _catch$3(function () {
6279
6282
  return Promise.resolve(API.update(form)).then(function () {
6280
6283
  return Promise.resolve(_this10.load()).then(function () {});
6281
6284
  });
@@ -6283,7 +6286,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6283
6286
  console.log(error);
6284
6287
  });
6285
6288
 
6286
- return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6289
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6287
6290
  } catch (e) {
6288
6291
  return Promise.reject(e);
6289
6292
  }
@@ -6292,7 +6295,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6292
6295
  try {
6293
6296
  var _this12 = this;
6294
6297
 
6295
- var _temp10 = _catch$3(function () {
6298
+ var _temp14 = _catch$3(function () {
6296
6299
  return Promise.resolve(API.patch(id, form)).then(function () {
6297
6300
  return Promise.resolve(_this12.load()).then(function () {});
6298
6301
  });
@@ -6300,7 +6303,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6300
6303
  console.log(error);
6301
6304
  });
6302
6305
 
6303
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6306
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6304
6307
  } catch (e) {
6305
6308
  return Promise.reject(e);
6306
6309
  }
@@ -6309,7 +6312,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6309
6312
  try {
6310
6313
  var _this14 = this;
6311
6314
 
6312
- var _temp12 = _catch$3(function () {
6315
+ var _temp16 = _catch$3(function () {
6313
6316
  return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
6314
6317
  return Promise.resolve(_this14.load()).then(function () {});
6315
6318
  });
@@ -6317,7 +6320,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6317
6320
  console.log(error);
6318
6321
  });
6319
6322
 
6320
- return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6323
+ return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(function () {}) : void 0);
6321
6324
  } catch (e) {
6322
6325
  return Promise.reject(e);
6323
6326
  }
@@ -6326,7 +6329,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6326
6329
  try {
6327
6330
  var _this16 = this;
6328
6331
 
6329
- var _temp14 = _catch$3(function () {
6332
+ var _temp18 = _catch$3(function () {
6330
6333
  return Promise.resolve(API.remove(id)).then(function () {
6331
6334
  return Promise.resolve(_this16.load()).then(function () {});
6332
6335
  });
@@ -6334,7 +6337,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6334
6337
  console.log(error);
6335
6338
  });
6336
6339
 
6337
- return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6340
+ return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
6338
6341
  } catch (e) {
6339
6342
  return Promise.reject(e);
6340
6343
  }