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.cjs CHANGED
@@ -4689,6 +4689,7 @@ var CollectionPage = function CollectionPage(props) {
4689
4689
  name = _props$name === void 0 ? "Collection 1" : _props$name,
4690
4690
  schema = props.schema,
4691
4691
  url = props.url,
4692
+ page = props.page,
4692
4693
  host = props.host,
4693
4694
  groupBy = props.groupBy,
4694
4695
  editor = props.editor,
@@ -4706,7 +4707,7 @@ var CollectionPage = function CollectionPage(props) {
4706
4707
  pageContext = _useContext[0],
4707
4708
  setPageContext = _useContext[1];
4708
4709
 
4709
- var context = CollectionContext(url, field, host);
4710
+ var context = CollectionContext(url, field, host, page);
4710
4711
  React.useEffect(function () {
4711
4712
  try {
4712
4713
  return Promise.resolve(context.load()).then(function () {
@@ -5028,7 +5029,7 @@ var CollectionEditor = function CollectionEditor(props) {
5028
5029
  */
5029
5030
 
5030
5031
 
5031
- var CollectionContext = function CollectionContext(url, field, host) {
5032
+ var CollectionContext = function CollectionContext(url, field, host, page) {
5032
5033
  var API = CollectionAPI(url, host);
5033
5034
  return {
5034
5035
  all: [],
@@ -5038,7 +5039,7 @@ var CollectionContext = function CollectionContext(url, field, host) {
5038
5039
  var _this2 = this;
5039
5040
 
5040
5041
  var _temp2 = _catch$1(function () {
5041
- return Promise.resolve(API.all()).then(function (data) {
5042
+ return Promise.resolve(API.all(null, page)).then(function (data) {
5042
5043
  _this2.all = field ? data[field] : data;
5043
5044
  });
5044
5045
  }, function (error) {
@@ -5153,8 +5154,8 @@ var CollectionContext = function CollectionContext(url, field, host) {
5153
5154
  var CollectionAPI = function CollectionAPI(url, host) {
5154
5155
  var http = HTTPClient(host || window.API || process.env.REACT_APP_API, Session);
5155
5156
  return {
5156
- all: function all(filters) {
5157
- var queryParams = "?";
5157
+ all: function all(filters, page) {
5158
+ var queryParams = page ? "?page=" + page + "&" : "?";
5158
5159
 
5159
5160
  if (filters) {
5160
5161
  var filterQuery = Object.keys(filters).reduce(function (query, key) {
@@ -5175,7 +5176,7 @@ var CollectionAPI = function CollectionAPI(url, host) {
5175
5176
  queryParams = queryParams.concat(filterQuery);
5176
5177
  }
5177
5178
 
5178
- return http.GET(url);
5179
+ return http.GET(url + queryParams);
5179
5180
  },
5180
5181
  find: function find(id) {
5181
5182
  return http.GET(url + "/" + id);
@@ -5247,6 +5248,7 @@ var FieldViewer = function FieldViewer(props) {
5247
5248
  _field$visible = field.visible,
5248
5249
  visible = _field$visible === void 0 ? true : _field$visible;
5249
5250
  if (!visible) return null;
5251
+ if (optional && !value) return null;
5250
5252
 
5251
5253
  switch (type) {
5252
5254
  case TYPES.STRING: