ywana-core8 0.0.476 → 0.0.477
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 +58 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +58 -28
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +58 -28
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionPage.js +20 -6
package/dist/index.cjs
CHANGED
@@ -4698,11 +4698,13 @@ var CollectionPage = function CollectionPage(props) {
|
|
4698
4698
|
name = _props$name === void 0 ? "Collection 1" : _props$name,
|
4699
4699
|
schema = props.schema,
|
4700
4700
|
url = props.url,
|
4701
|
-
|
4701
|
+
field = props.field,
|
4702
4702
|
host = props.host,
|
4703
|
+
page = props.page,
|
4704
|
+
_props$fetching = props.fetching,
|
4705
|
+
fetching = _props$fetching === void 0 ? false : _props$fetching,
|
4703
4706
|
groupBy = props.groupBy,
|
4704
4707
|
editor = props.editor,
|
4705
|
-
field = props.field,
|
4706
4708
|
_props$autosave = props.autosave,
|
4707
4709
|
autosave = _props$autosave === void 0 ? false : _props$autosave,
|
4708
4710
|
_props$delay = props.delay,
|
@@ -4716,7 +4718,7 @@ var CollectionPage = function CollectionPage(props) {
|
|
4716
4718
|
pageContext = _useContext[0],
|
4717
4719
|
setPageContext = _useContext[1];
|
4718
4720
|
|
4719
|
-
var context = CollectionContext(url, field, host, page);
|
4721
|
+
var context = CollectionContext(url, field, host, page, fetching);
|
4720
4722
|
React.useEffect(function () {
|
4721
4723
|
try {
|
4722
4724
|
return Promise.resolve(context.load()).then(function () {
|
@@ -5038,7 +5040,7 @@ var CollectionEditor = function CollectionEditor(props) {
|
|
5038
5040
|
*/
|
5039
5041
|
|
5040
5042
|
|
5041
|
-
var CollectionContext = function CollectionContext(url, field, host, page) {
|
5043
|
+
var CollectionContext = function CollectionContext(url, field, host, page, fetching) {
|
5042
5044
|
var API = CollectionAPI(url, host);
|
5043
5045
|
return {
|
5044
5046
|
all: [],
|
@@ -5061,95 +5063,123 @@ var CollectionContext = function CollectionContext(url, field, host, page) {
|
|
5061
5063
|
}
|
5062
5064
|
},
|
5063
5065
|
select: function select(id) {
|
5064
|
-
|
5065
|
-
|
5066
|
-
|
5067
|
-
|
5066
|
+
try {
|
5067
|
+
var _this4 = this;
|
5068
|
+
|
5069
|
+
var _temp4 = function () {
|
5070
|
+
if (fetching) {
|
5071
|
+
return Promise.resolve(_this4.fetch(id)).then(function (result) {
|
5072
|
+
_this4.selected = result;
|
5073
|
+
});
|
5074
|
+
} else {
|
5075
|
+
var result = _this4.all.find(function (item) {
|
5076
|
+
return item.id === id;
|
5077
|
+
});
|
5078
|
+
|
5079
|
+
_this4.selected = result;
|
5080
|
+
}
|
5081
|
+
}();
|
5082
|
+
|
5083
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
|
5084
|
+
} catch (e) {
|
5085
|
+
return Promise.reject(e);
|
5086
|
+
}
|
5087
|
+
},
|
5088
|
+
fetch: function fetch(id) {
|
5089
|
+
try {
|
5090
|
+
return Promise.resolve(_catch$2(function () {
|
5091
|
+
return Promise.resolve(API.find(id));
|
5092
|
+
}, function (error) {
|
5093
|
+
console.log(error);
|
5094
|
+
}));
|
5095
|
+
} catch (e) {
|
5096
|
+
return Promise.reject(e);
|
5097
|
+
}
|
5068
5098
|
},
|
5069
5099
|
clear: function clear() {
|
5070
5100
|
this.selected = null;
|
5071
5101
|
},
|
5072
5102
|
create: function create(form) {
|
5073
5103
|
try {
|
5074
|
-
var
|
5104
|
+
var _this6 = this;
|
5075
5105
|
|
5076
|
-
var
|
5106
|
+
var _temp6 = _catch$2(function () {
|
5077
5107
|
return Promise.resolve(API.create(form)).then(function () {
|
5078
|
-
return Promise.resolve(
|
5108
|
+
return Promise.resolve(_this6.load()).then(function () {});
|
5079
5109
|
});
|
5080
5110
|
}, function (error) {
|
5081
5111
|
console.log("CREATE ERROR", error);
|
5082
5112
|
});
|
5083
5113
|
|
5084
|
-
return Promise.resolve(
|
5114
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
5085
5115
|
} catch (e) {
|
5086
5116
|
return Promise.reject(e);
|
5087
5117
|
}
|
5088
5118
|
},
|
5089
5119
|
update: function update(form) {
|
5090
5120
|
try {
|
5091
|
-
var
|
5121
|
+
var _this8 = this;
|
5092
5122
|
|
5093
|
-
var
|
5123
|
+
var _temp8 = _catch$2(function () {
|
5094
5124
|
return Promise.resolve(API.update(form)).then(function () {
|
5095
|
-
return Promise.resolve(
|
5125
|
+
return Promise.resolve(_this8.load()).then(function () {});
|
5096
5126
|
});
|
5097
5127
|
}, function (error) {
|
5098
5128
|
console.log(error);
|
5099
5129
|
});
|
5100
5130
|
|
5101
|
-
return Promise.resolve(
|
5131
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
|
5102
5132
|
} catch (e) {
|
5103
5133
|
return Promise.reject(e);
|
5104
5134
|
}
|
5105
5135
|
},
|
5106
5136
|
patch: function patch(id, form) {
|
5107
5137
|
try {
|
5108
|
-
var
|
5138
|
+
var _this10 = this;
|
5109
5139
|
|
5110
|
-
var
|
5140
|
+
var _temp10 = _catch$2(function () {
|
5111
5141
|
return Promise.resolve(API.patch(id, form)).then(function () {
|
5112
|
-
return Promise.resolve(
|
5142
|
+
return Promise.resolve(_this10.load()).then(function () {});
|
5113
5143
|
});
|
5114
5144
|
}, function (error) {
|
5115
5145
|
console.log(error);
|
5116
5146
|
});
|
5117
5147
|
|
5118
|
-
return Promise.resolve(
|
5148
|
+
return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
|
5119
5149
|
} catch (e) {
|
5120
5150
|
return Promise.reject(e);
|
5121
5151
|
}
|
5122
5152
|
},
|
5123
5153
|
updateProperty: function updateProperty(id, propertyName, form) {
|
5124
5154
|
try {
|
5125
|
-
var
|
5155
|
+
var _this12 = this;
|
5126
5156
|
|
5127
|
-
var
|
5157
|
+
var _temp12 = _catch$2(function () {
|
5128
5158
|
return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
|
5129
|
-
return Promise.resolve(
|
5159
|
+
return Promise.resolve(_this12.load()).then(function () {});
|
5130
5160
|
});
|
5131
5161
|
}, function (error) {
|
5132
5162
|
console.log(error);
|
5133
5163
|
});
|
5134
5164
|
|
5135
|
-
return Promise.resolve(
|
5165
|
+
return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
|
5136
5166
|
} catch (e) {
|
5137
5167
|
return Promise.reject(e);
|
5138
5168
|
}
|
5139
5169
|
},
|
5140
5170
|
remove: function remove(id) {
|
5141
5171
|
try {
|
5142
|
-
var
|
5172
|
+
var _this14 = this;
|
5143
5173
|
|
5144
|
-
var
|
5174
|
+
var _temp14 = _catch$2(function () {
|
5145
5175
|
return Promise.resolve(API.remove(id)).then(function () {
|
5146
|
-
return Promise.resolve(
|
5176
|
+
return Promise.resolve(_this14.load()).then(function () {});
|
5147
5177
|
});
|
5148
5178
|
}, function (error) {
|
5149
5179
|
console.log(error);
|
5150
5180
|
});
|
5151
5181
|
|
5152
|
-
return Promise.resolve(
|
5182
|
+
return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
|
5153
5183
|
} catch (e) {
|
5154
5184
|
return Promise.reject(e);
|
5155
5185
|
}
|