monkey-front-core 0.0.132 → 0.0.135

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.
@@ -1742,12 +1742,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
1742
1742
  }] } });
1743
1743
 
1744
1744
  class MonkeyEcxRequestPagedHandling {
1745
- constructor(_url, _pagedParams, _links) {
1746
- this.url = _url;
1747
- this.pagedParams = _pagedParams || {
1745
+ constructor(url, pagedParams, links, samePage = false) {
1746
+ this.samePage = false;
1747
+ this.url = url;
1748
+ this.pagedParams = pagedParams || {
1748
1749
  page: {},
1749
1750
  };
1750
- this.links = _links;
1751
+ this.links = links;
1752
+ this.samePage = samePage;
1751
1753
  }
1752
1754
  handlePagedValuesFromApi(url = '') {
1753
1755
  if (url.search('\\?') < 0)
@@ -1768,7 +1770,10 @@ class MonkeyEcxRequestPagedHandling {
1768
1770
  return `${!hasInitialQueryParams ? '?' : '&'}page=${number || 0}&size=${size || 20}`;
1769
1771
  }
1770
1772
  getRequestWithPagedParams() {
1771
- const { url, links } = this;
1773
+ const { url, links, samePage } = this;
1774
+ if (samePage && links.self) {
1775
+ return links.self.href;
1776
+ }
1772
1777
  if (links && links.next) {
1773
1778
  return links.next.href;
1774
1779
  }
@@ -1944,9 +1949,9 @@ class MonkeyEcxCommonsService {
1944
1949
  const { _embedded } = data;
1945
1950
  return _embedded ? _embedded[field] : null;
1946
1951
  }
1947
- getNormalizedUrl(url) {
1952
+ getNormalizedUrl(url, samePage = false) {
1948
1953
  const { __requestPaged, __links } = this;
1949
- return new MonkeyEcxRequestPagedHandling(url, __requestPaged || {}, __links).getRequestWithPagedParams();
1954
+ return new MonkeyEcxRequestPagedHandling(url, __requestPaged || {}, __links, samePage).getRequestWithPagedParams();
1950
1955
  }
1951
1956
  clear(clearData) {
1952
1957
  if (clearData) {