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.modern.js
CHANGED
@@ -4690,11 +4690,13 @@ var CollectionPage = function CollectionPage(props) {
|
|
4690
4690
|
name = _props$name === void 0 ? "Collection 1" : _props$name,
|
4691
4691
|
schema = props.schema,
|
4692
4692
|
url = props.url,
|
4693
|
-
|
4693
|
+
field = props.field,
|
4694
4694
|
host = props.host,
|
4695
|
+
page = props.page,
|
4696
|
+
_props$fetching = props.fetching,
|
4697
|
+
fetching = _props$fetching === void 0 ? false : _props$fetching,
|
4695
4698
|
groupBy = props.groupBy,
|
4696
4699
|
editor = props.editor,
|
4697
|
-
field = props.field,
|
4698
4700
|
_props$autosave = props.autosave,
|
4699
4701
|
autosave = _props$autosave === void 0 ? false : _props$autosave,
|
4700
4702
|
_props$delay = props.delay,
|
@@ -4708,7 +4710,7 @@ var CollectionPage = function CollectionPage(props) {
|
|
4708
4710
|
pageContext = _useContext[0],
|
4709
4711
|
setPageContext = _useContext[1];
|
4710
4712
|
|
4711
|
-
var context = CollectionContext(url, field, host, page);
|
4713
|
+
var context = CollectionContext(url, field, host, page, fetching);
|
4712
4714
|
useEffect(function () {
|
4713
4715
|
try {
|
4714
4716
|
return Promise.resolve(context.load()).then(function () {
|
@@ -5030,7 +5032,7 @@ var CollectionEditor = function CollectionEditor(props) {
|
|
5030
5032
|
*/
|
5031
5033
|
|
5032
5034
|
|
5033
|
-
var CollectionContext = function CollectionContext(url, field, host, page) {
|
5035
|
+
var CollectionContext = function CollectionContext(url, field, host, page, fetching) {
|
5034
5036
|
var API = CollectionAPI(url, host);
|
5035
5037
|
return {
|
5036
5038
|
all: [],
|
@@ -5053,95 +5055,123 @@ var CollectionContext = function CollectionContext(url, field, host, page) {
|
|
5053
5055
|
}
|
5054
5056
|
},
|
5055
5057
|
select: function select(id) {
|
5056
|
-
|
5057
|
-
|
5058
|
-
|
5059
|
-
|
5058
|
+
try {
|
5059
|
+
var _this4 = this;
|
5060
|
+
|
5061
|
+
var _temp4 = function () {
|
5062
|
+
if (fetching) {
|
5063
|
+
return Promise.resolve(_this4.fetch(id)).then(function (result) {
|
5064
|
+
_this4.selected = result;
|
5065
|
+
});
|
5066
|
+
} else {
|
5067
|
+
var result = _this4.all.find(function (item) {
|
5068
|
+
return item.id === id;
|
5069
|
+
});
|
5070
|
+
|
5071
|
+
_this4.selected = result;
|
5072
|
+
}
|
5073
|
+
}();
|
5074
|
+
|
5075
|
+
return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
|
5076
|
+
} catch (e) {
|
5077
|
+
return Promise.reject(e);
|
5078
|
+
}
|
5079
|
+
},
|
5080
|
+
fetch: function fetch(id) {
|
5081
|
+
try {
|
5082
|
+
return Promise.resolve(_catch$2(function () {
|
5083
|
+
return Promise.resolve(API.find(id));
|
5084
|
+
}, function (error) {
|
5085
|
+
console.log(error);
|
5086
|
+
}));
|
5087
|
+
} catch (e) {
|
5088
|
+
return Promise.reject(e);
|
5089
|
+
}
|
5060
5090
|
},
|
5061
5091
|
clear: function clear() {
|
5062
5092
|
this.selected = null;
|
5063
5093
|
},
|
5064
5094
|
create: function create(form) {
|
5065
5095
|
try {
|
5066
|
-
var
|
5096
|
+
var _this6 = this;
|
5067
5097
|
|
5068
|
-
var
|
5098
|
+
var _temp6 = _catch$2(function () {
|
5069
5099
|
return Promise.resolve(API.create(form)).then(function () {
|
5070
|
-
return Promise.resolve(
|
5100
|
+
return Promise.resolve(_this6.load()).then(function () {});
|
5071
5101
|
});
|
5072
5102
|
}, function (error) {
|
5073
5103
|
console.log("CREATE ERROR", error);
|
5074
5104
|
});
|
5075
5105
|
|
5076
|
-
return Promise.resolve(
|
5106
|
+
return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0);
|
5077
5107
|
} catch (e) {
|
5078
5108
|
return Promise.reject(e);
|
5079
5109
|
}
|
5080
5110
|
},
|
5081
5111
|
update: function update(form) {
|
5082
5112
|
try {
|
5083
|
-
var
|
5113
|
+
var _this8 = this;
|
5084
5114
|
|
5085
|
-
var
|
5115
|
+
var _temp8 = _catch$2(function () {
|
5086
5116
|
return Promise.resolve(API.update(form)).then(function () {
|
5087
|
-
return Promise.resolve(
|
5117
|
+
return Promise.resolve(_this8.load()).then(function () {});
|
5088
5118
|
});
|
5089
5119
|
}, function (error) {
|
5090
5120
|
console.log(error);
|
5091
5121
|
});
|
5092
5122
|
|
5093
|
-
return Promise.resolve(
|
5123
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
|
5094
5124
|
} catch (e) {
|
5095
5125
|
return Promise.reject(e);
|
5096
5126
|
}
|
5097
5127
|
},
|
5098
5128
|
patch: function patch(id, form) {
|
5099
5129
|
try {
|
5100
|
-
var
|
5130
|
+
var _this10 = this;
|
5101
5131
|
|
5102
|
-
var
|
5132
|
+
var _temp10 = _catch$2(function () {
|
5103
5133
|
return Promise.resolve(API.patch(id, form)).then(function () {
|
5104
|
-
return Promise.resolve(
|
5134
|
+
return Promise.resolve(_this10.load()).then(function () {});
|
5105
5135
|
});
|
5106
5136
|
}, function (error) {
|
5107
5137
|
console.log(error);
|
5108
5138
|
});
|
5109
5139
|
|
5110
|
-
return Promise.resolve(
|
5140
|
+
return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(function () {}) : void 0);
|
5111
5141
|
} catch (e) {
|
5112
5142
|
return Promise.reject(e);
|
5113
5143
|
}
|
5114
5144
|
},
|
5115
5145
|
updateProperty: function updateProperty(id, propertyName, form) {
|
5116
5146
|
try {
|
5117
|
-
var
|
5147
|
+
var _this12 = this;
|
5118
5148
|
|
5119
|
-
var
|
5149
|
+
var _temp12 = _catch$2(function () {
|
5120
5150
|
return Promise.resolve(API.updateProperty(id, propertyName, form)).then(function () {
|
5121
|
-
return Promise.resolve(
|
5151
|
+
return Promise.resolve(_this12.load()).then(function () {});
|
5122
5152
|
});
|
5123
5153
|
}, function (error) {
|
5124
5154
|
console.log(error);
|
5125
5155
|
});
|
5126
5156
|
|
5127
|
-
return Promise.resolve(
|
5157
|
+
return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
|
5128
5158
|
} catch (e) {
|
5129
5159
|
return Promise.reject(e);
|
5130
5160
|
}
|
5131
5161
|
},
|
5132
5162
|
remove: function remove(id) {
|
5133
5163
|
try {
|
5134
|
-
var
|
5164
|
+
var _this14 = this;
|
5135
5165
|
|
5136
|
-
var
|
5166
|
+
var _temp14 = _catch$2(function () {
|
5137
5167
|
return Promise.resolve(API.remove(id)).then(function () {
|
5138
|
-
return Promise.resolve(
|
5168
|
+
return Promise.resolve(_this14.load()).then(function () {});
|
5139
5169
|
});
|
5140
5170
|
}, function (error) {
|
5141
5171
|
console.log(error);
|
5142
5172
|
});
|
5143
5173
|
|
5144
|
-
return Promise.resolve(
|
5174
|
+
return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
|
5145
5175
|
} catch (e) {
|
5146
5176
|
return Promise.reject(e);
|
5147
5177
|
}
|