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