ywana-core8 0.0.628 → 0.0.631

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