ywana-core8 0.0.438 → 0.0.441

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.umd.js CHANGED
@@ -4684,6 +4684,7 @@
4684
4684
  name = _props$name === void 0 ? "Collection 1" : _props$name,
4685
4685
  schema = props.schema,
4686
4686
  url = props.url,
4687
+ page = props.page,
4687
4688
  host = props.host,
4688
4689
  groupBy = props.groupBy,
4689
4690
  editor = props.editor,
@@ -4701,7 +4702,7 @@
4701
4702
  pageContext = _useContext[0],
4702
4703
  setPageContext = _useContext[1];
4703
4704
 
4704
- var context = CollectionContext(url, field, host);
4705
+ var context = CollectionContext(url, field, host, page);
4705
4706
  React.useEffect(function () {
4706
4707
  try {
4707
4708
  return Promise.resolve(context.load()).then(function () {
@@ -5023,7 +5024,7 @@
5023
5024
  */
5024
5025
 
5025
5026
 
5026
- var CollectionContext = function CollectionContext(url, field, host) {
5027
+ var CollectionContext = function CollectionContext(url, field, host, page) {
5027
5028
  var API = CollectionAPI(url, host);
5028
5029
  return {
5029
5030
  all: [],
@@ -5033,7 +5034,7 @@
5033
5034
  var _this2 = this;
5034
5035
 
5035
5036
  var _temp2 = _catch$1(function () {
5036
- return Promise.resolve(API.all()).then(function (data) {
5037
+ return Promise.resolve(API.all(null, page)).then(function (data) {
5037
5038
  _this2.all = field ? data[field] : data;
5038
5039
  });
5039
5040
  }, function (error) {
@@ -5148,8 +5149,8 @@
5148
5149
  var CollectionAPI = function CollectionAPI(url, host) {
5149
5150
  var http = HTTPClient(host || window.API || process.env.REACT_APP_API, Session);
5150
5151
  return {
5151
- all: function all(filters) {
5152
- var queryParams = "?";
5152
+ all: function all(filters, page) {
5153
+ var queryParams = page ? "?page=" + page + "&" : "?";
5153
5154
 
5154
5155
  if (filters) {
5155
5156
  var filterQuery = Object.keys(filters).reduce(function (query, key) {
@@ -5170,7 +5171,7 @@
5170
5171
  queryParams = queryParams.concat(filterQuery);
5171
5172
  }
5172
5173
 
5173
- return http.GET(url);
5174
+ return http.GET(url + queryParams);
5174
5175
  },
5175
5176
  find: function find(id) {
5176
5177
  return http.GET(url + "/" + id);
@@ -5242,6 +5243,7 @@
5242
5243
  _field$visible = field.visible,
5243
5244
  visible = _field$visible === void 0 ? true : _field$visible;
5244
5245
  if (!visible) return null;
5246
+ if (optional && !value) return null;
5245
5247
 
5246
5248
  switch (type) {
5247
5249
  case TYPES.STRING: