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.
@@ -1192,40 +1192,42 @@ var ContentType = /*#__PURE__*/function () {
1192
1192
  optional = field.optional;
1193
1193
  var entryData = data ? data[name] : null;
1194
1194
 
1195
- switch (type) {
1196
- case TYPES.STRING:
1197
- next[name] = entryData || field["default"];
1198
- break;
1199
-
1200
- case TYPES.NUMBER:
1201
- next[name] = entryData || field["default"];
1202
- break;
1203
-
1204
- case TYPES.BOOLEAN:
1205
- next[name] = entryData || field["default"];
1206
- break;
1207
-
1208
- case TYPES.ENTITY:
1209
- if (optional === true && !entryData) break;
1210
- var child1 = new ContentType(item);
1211
- next[name] = child1.value(entryData);
1212
- break;
1213
-
1214
- case TYPES.ARRAY:
1215
- if (item === TYPES.STRING) {
1216
- next[name] = entryData ? entryData : [];
1217
- } else {
1218
- var child2 = new ContentType(item);
1219
- next[name] = entryData ? entryData.map(function (data2) {
1220
- return child2.value(data2);
1221
- }) : [];
1222
- }
1195
+ if (outsider === true) ; else {
1196
+ switch (type) {
1197
+ case TYPES.STRING:
1198
+ next[name] = entryData || field["default"];
1199
+ break;
1200
+
1201
+ case TYPES.NUMBER:
1202
+ next[name] = entryData || field["default"];
1203
+ break;
1204
+
1205
+ case TYPES.BOOLEAN:
1206
+ next[name] = entryData || field["default"];
1207
+ break;
1208
+
1209
+ case TYPES.ENTITY:
1210
+ if (optional === true && !entryData) break;
1211
+ var child1 = new ContentType(item);
1212
+ next[name] = child1.value(entryData);
1213
+ break;
1214
+
1215
+ case TYPES.ARRAY:
1216
+ if (item === TYPES.STRING) {
1217
+ next[name] = entryData ? entryData : [];
1218
+ } else {
1219
+ var child2 = new ContentType(item);
1220
+ next[name] = entryData ? entryData.map(function (data2) {
1221
+ return child2.value(data2);
1222
+ }) : [];
1223
+ }
1223
1224
 
1224
- break;
1225
+ break;
1225
1226
 
1226
- default:
1227
- next[name] = field;
1228
- break;
1227
+ default:
1228
+ next[name] = field;
1229
+ break;
1230
+ }
1229
1231
  }
1230
1232
 
1231
1233
  return next;
@@ -4919,20 +4921,6 @@ var CollectionEditor$1 = function CollectionEditor(_ref11) {
4919
4921
  function reload() {
4920
4922
  if (onReload) onReload();
4921
4923
  }
4922
- /* const columns = Object.values(item)
4923
- .filter(field => field.column === true)
4924
- .map((item) => ({ ...item, onChange: change }))
4925
- columns.push({ id: 'actions', label: 'Actions' })
4926
- const rows = value.map((item, index) => ({
4927
- ...item,
4928
- id: index,
4929
- actions: [
4930
- <Icon icon='delete' clickable action={() => remove(index)} size="small" />
4931
- ]
4932
- }))
4933
- const table = { columns, rows }
4934
- */
4935
-
4936
4924
 
4937
4925
  return /*#__PURE__*/React.createElement("div", {
4938
4926
  className: "collection-editor"
@@ -5655,6 +5643,8 @@ var CollectionPage = function CollectionPage(props) {
5655
5643
  autosave = _props$autosave === void 0 ? false : _props$autosave,
5656
5644
  _props$delay = props.delay,
5657
5645
  delay = _props$delay === void 0 ? 1000 : _props$delay,
5646
+ _props$patch = props.patch,
5647
+ patch = _props$patch === void 0 ? false : _props$patch,
5658
5648
  groupBy = props.groupBy,
5659
5649
  levels = props.levels,
5660
5650
  sorter = props.sorter,
@@ -5773,7 +5763,8 @@ var CollectionPage = function CollectionPage(props) {
5773
5763
  delay: delay,
5774
5764
  canDelete: canDelete,
5775
5765
  canEdit: canEdit,
5776
- onReload: reloadSelection
5766
+ onReload: reloadSelection,
5767
+ patch: patch
5777
5768
  }), children ? /*#__PURE__*/React.createElement("article", null, children) : null, /*#__PURE__*/React.createElement("footer", null, footer)));
5778
5769
  };
5779
5770
  var CollectionFilters = function CollectionFilters(props) {
@@ -6055,9 +6046,19 @@ var CollectionTree = function CollectionTree(props) {
6055
6046
  var CollectionEditor = function CollectionEditor(props) {
6056
6047
  var save = function save() {
6057
6048
  try {
6058
- return Promise.resolve(pageContext.update(form)).then(function () {
6049
+ var _temp3 = function _temp3() {
6059
6050
  setPageContext(Object.assign({}, pageContext));
6060
- });
6051
+ };
6052
+
6053
+ var _temp4 = function () {
6054
+ if (patch) {
6055
+ return Promise.resolve(pageContext.patch(form.id, form)).then(function () {});
6056
+ } else {
6057
+ return Promise.resolve(pageContext.update(form)).then(function () {});
6058
+ }
6059
+ }();
6060
+
6061
+ return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(_temp3) : _temp3(_temp4));
6061
6062
  } catch (e) {
6062
6063
  return Promise.reject(e);
6063
6064
  }
@@ -6087,7 +6088,9 @@ var CollectionEditor = function CollectionEditor(props) {
6087
6088
  _props$delay2 = props.delay,
6088
6089
  delay = _props$delay2 === void 0 ? 1000 : _props$delay2,
6089
6090
  canDelete = props.canDelete,
6090
- onReload = props.onReload;
6091
+ onReload = props.onReload,
6092
+ _props$patch2 = props.patch,
6093
+ patch = _props$patch2 === void 0 ? false : _props$patch2;
6091
6094
  var timer = useRef(null);
6092
6095
 
6093
6096
  var _useState5 = useState(selected),
@@ -6185,7 +6188,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6185
6188
  try {
6186
6189
  var _this2 = this;
6187
6190
 
6188
- var _temp2 = _catch$3(function () {
6191
+ var _temp6 = _catch$3(function () {
6189
6192
  return Promise.resolve(API.all(null, page)).then(function (data) {
6190
6193
  _this2.all = field ? data[field] : data;
6191
6194
  });
@@ -6193,7 +6196,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6193
6196
  console.log(error);
6194
6197
  });
6195
6198
 
6196
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
6199
+ return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6197
6200
  } catch (e) {
6198
6201
  return Promise.reject(e);
6199
6202
  }
@@ -6202,7 +6205,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6202
6205
  try {
6203
6206
  var _this4 = this;
6204
6207
 
6205
- var _temp4 = function () {
6208
+ var _temp8 = function () {
6206
6209
  if (fetching) {
6207
6210
  return Promise.resolve(_this4.fetch(id)).then(function (result) {
6208
6211
  _this4.selected = result;
@@ -6216,7 +6219,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6216
6219
  }
6217
6220
  }();
6218
6221
 
6219
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
6222
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6220
6223
  } catch (e) {
6221
6224
  return Promise.reject(e);
6222
6225
  }
@@ -6250,7 +6253,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6250
6253
  try {
6251
6254
  var _this8 = this;
6252
6255
 
6253
- var _temp6 = _catch$3(function () {
6256
+ var _temp10 = _catch$3(function () {
6254
6257
  return Promise.resolve(API.create(form)).then(function () {
6255
6258
  return Promise.resolve(_this8.load()).then(function () {});
6256
6259
  });
@@ -6258,7 +6261,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6258
6261
  console.log(error);
6259
6262
  });
6260
6263
 
6261
- return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
6264
+ return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6262
6265
  } catch (e) {
6263
6266
  return Promise.reject(e);
6264
6267
  }
@@ -6267,7 +6270,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6267
6270
  try {
6268
6271
  var _this10 = this;
6269
6272
 
6270
- var _temp8 = _catch$3(function () {
6273
+ var _temp12 = _catch$3(function () {
6271
6274
  return Promise.resolve(API.update(form)).then(function () {
6272
6275
  return Promise.resolve(_this10.load()).then(function () {});
6273
6276
  });
@@ -6275,7 +6278,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6275
6278
  console.log(error);
6276
6279
  });
6277
6280
 
6278
- return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
6281
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6279
6282
  } catch (e) {
6280
6283
  return Promise.reject(e);
6281
6284
  }
@@ -6284,7 +6287,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6284
6287
  try {
6285
6288
  var _this12 = this;
6286
6289
 
6287
- var _temp10 = _catch$3(function () {
6290
+ var _temp14 = _catch$3(function () {
6288
6291
  return Promise.resolve(API.patch(id, form)).then(function () {
6289
6292
  return Promise.resolve(_this12.load()).then(function () {});
6290
6293
  });
@@ -6292,7 +6295,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6292
6295
  console.log(error);
6293
6296
  });
6294
6297
 
6295
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
6298
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6296
6299
  } catch (e) {
6297
6300
  return Promise.reject(e);
6298
6301
  }
@@ -6301,7 +6304,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6301
6304
  try {
6302
6305
  var _this14 = this;
6303
6306
 
6304
- var _temp12 = _catch$3(function () {
6307
+ var _temp16 = _catch$3(function () {
6305
6308
  return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
6306
6309
  return Promise.resolve(_this14.load()).then(function () {});
6307
6310
  });
@@ -6309,7 +6312,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6309
6312
  console.log(error);
6310
6313
  });
6311
6314
 
6312
- return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
6315
+ return Promise.resolve(_temp16 && _temp16.then ? _temp16.then(function () {}) : void 0);
6313
6316
  } catch (e) {
6314
6317
  return Promise.reject(e);
6315
6318
  }
@@ -6318,7 +6321,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6318
6321
  try {
6319
6322
  var _this16 = this;
6320
6323
 
6321
- var _temp14 = _catch$3(function () {
6324
+ var _temp18 = _catch$3(function () {
6322
6325
  return Promise.resolve(API.remove(id)).then(function () {
6323
6326
  return Promise.resolve(_this16.load()).then(function () {});
6324
6327
  });
@@ -6326,7 +6329,7 @@ var CollectionContext = function CollectionContext(url, field, host, page, fetch
6326
6329
  console.log(error);
6327
6330
  });
6328
6331
 
6329
- return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
6332
+ return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
6330
6333
  } catch (e) {
6331
6334
  return Promise.reject(e);
6332
6335
  }