@startinblox/core 0.19.0-beta.4 → 0.19.0-beta.6

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.js CHANGED
@@ -11322,7 +11322,7 @@ class Store {
11322
11322
  var _a;
11323
11323
  let key = id2;
11324
11324
  if (serverPagination) {
11325
- key = id2 + "#p" + serverPagination.limit + "?o" + serverPagination.offset;
11325
+ key = appendServerPaginationToIri(key, serverPagination);
11326
11326
  }
11327
11327
  if (serverSearch) {
11328
11328
  key = appendServerSearchToIri(key, serverSearch);
@@ -11432,7 +11432,7 @@ class Store {
11432
11432
  key = key + parentId;
11433
11433
  if (key === id2 && resource2["@type"] == this.getExpandedPredicate("ldp:Container", clientContext)) {
11434
11434
  if (serverPagination)
11435
- key = key + "#p" + serverPagination.limit + "?o" + serverPagination.offset;
11435
+ key = appendServerPaginationToIri(key, serverPagination);
11436
11436
  if (serverSearch)
11437
11437
  key = appendServerSearchToIri(key, serverSearch);
11438
11438
  }
@@ -11568,7 +11568,10 @@ class Store {
11568
11568
  *
11569
11569
  * @returns Resource (Proxy) if in the cache, null otherwise
11570
11570
  */
11571
- get(id2, serverSearch) {
11571
+ get(id2, serverPagination, serverSearch) {
11572
+ if (serverPagination) {
11573
+ id2 = appendServerPaginationToIri(id2, serverPagination);
11574
+ }
11572
11575
  if (serverSearch) {
11573
11576
  id2 = appendServerSearchToIri(id2, serverSearch);
11574
11577
  }
@@ -11945,9 +11948,8 @@ const ServerPaginationMixin = {
11945
11948
  this.updateNavButtons(resourceId, index, 1);
11946
11949
  await this.fetchData(this.dataSrc);
11947
11950
  },
11948
- updateNavButtons(resourceId, index, variance) {
11951
+ async updateNavButtons(resourceId, index, variance) {
11949
11952
  this.element.querySelector("[data-id='prev']").disabled = this.currentOffset[index] <= 0;
11950
- this.element.querySelector("[data-id='next']").disabled = this.currentOffset[index] * this.limit >= this.pageCount;
11951
11953
  this.element.querySelector("[data-id='current']").innerText = this.getCurrentServedPage(resourceId, variance);
11952
11954
  },
11953
11955
  getServerNavElement(div2) {
@@ -11959,6 +11961,7 @@ const ServerPaginationMixin = {
11959
11961
  },
11960
11962
  getCurrentServedPage(context2, variance) {
11961
11963
  this.currentPage[context2] = Number(this.currentPage[context2]) + variance;
11964
+ this.pageNumber = this.currentPage[context2];
11962
11965
  return this.currentPage[context2];
11963
11966
  },
11964
11967
  /**
@@ -11989,18 +11992,15 @@ const ServerPaginationMixin = {
11989
11992
  ?disabled=${currentOffset <= 0}
11990
11993
  @click=${() => this.decreaseCurrentOffset(resourceId)}
11991
11994
  >←</button>
11995
+ <span data-id="current">
11996
+ ${currentPageNumber}
11997
+ </span>
11992
11998
  <button
11993
11999
  data-id="next"
11994
12000
  ?disabled=${currentOffset >= (pageCount - 1) * this.limit}
11995
12001
  @click=${() => this.increaseCurrentOffset(resourceId)}
11996
12002
  >→</button>
11997
12003
  <span>
11998
- <span data-id="current">
11999
- ${currentPageNumber}
12000
- </span> /
12001
- <span data-id="count">
12002
- ${this.pageCount}
12003
- </span>
12004
12004
  </span>
12005
12005
  `, div2);
12006
12006
  }
@@ -12068,15 +12068,13 @@ const StoreMixin = {
12068
12068
  get resource() {
12069
12069
  var _a;
12070
12070
  let id2 = this.resourceId;
12071
- if (this.limit) {
12072
- id2 = this.resourceId + "#p" + this.limit + "?o" + this.offset;
12073
- }
12071
+ const serverPagination = formatAttributesToServerPaginationOptions(this.element.attributes);
12074
12072
  const serverSearch = mergeServerSearchOptions(
12075
12073
  formatAttributesToServerSearchOptions(this.element.attributes),
12076
12074
  (_a = this.getDynamicServerSearch) == null ? void 0 : _a.call(this)
12077
12075
  // from `filterMixin`
12078
12076
  );
12079
- return id2 ? store.get(id2, serverSearch) : null;
12077
+ return id2 ? store.get(id2, serverPagination, serverSearch) : null;
12080
12078
  },
12081
12079
  get loader() {
12082
12080
  return this.loaderId ? document.getElementById(this.loaderId) : null;