monkey-front-core 0.0.47 → 0.0.48

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.
@@ -1709,11 +1709,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
1709
1709
  }] } });
1710
1710
 
1711
1711
  class MonkeyEcxRequestPagedHandling {
1712
- constructor(_url, _pagedParams) {
1712
+ constructor(_url, _pagedParams, _links) {
1713
1713
  this.url = _url;
1714
1714
  this.pagedParams = _pagedParams || {
1715
- page: {}
1715
+ page: {},
1716
1716
  };
1717
+ this.links = _links;
1717
1718
  }
1718
1719
  handlePagedValuesFromApi(url = '') {
1719
1720
  if (url.search('\\?') < 0)
@@ -1721,8 +1722,11 @@ class MonkeyEcxRequestPagedHandling {
1721
1722
  const params = url.substring(url.search('\\?') + 1, url.length);
1722
1723
  url = url.substring(0, url.search('\\?'));
1723
1724
  return `${url}?${new HttpParams({
1724
- fromString: params
1725
- }).delete('size').delete('page').toString()}`;
1725
+ fromString: params,
1726
+ })
1727
+ .delete('size')
1728
+ .delete('page')
1729
+ .toString()}`;
1726
1730
  }
1727
1731
  getUrlParams(url) {
1728
1732
  const { pagedParams } = this;
@@ -1731,7 +1735,10 @@ class MonkeyEcxRequestPagedHandling {
1731
1735
  return `${!hasInitialQueryParams ? '?' : '&'}page=${number || 0}&size=${size || 20}`;
1732
1736
  }
1733
1737
  getRequestWithPagedParams() {
1734
- const { url } = this;
1738
+ const { url, links } = this;
1739
+ if (links && links.next) {
1740
+ return links.next.href;
1741
+ }
1735
1742
  const handled = this.handlePagedValuesFromApi(url);
1736
1743
  return `${handled}${this.getUrlParams(handled)}`;
1737
1744
  }
@@ -1746,6 +1753,7 @@ class MonkeyEcxCommonsService {
1746
1753
  this.__error = null;
1747
1754
  this.__handledError = null;
1748
1755
  this.__page = null;
1756
+ this.__links = null;
1749
1757
  this.__requestPaged = null;
1750
1758
  this.__onSearchChanged$ = new BehaviorSubject(null);
1751
1759
  this.__onDataChanged$ = new BehaviorSubject(null);
@@ -1838,6 +1846,9 @@ class MonkeyEcxCommonsService {
1838
1846
  return this;
1839
1847
  }
1840
1848
  nextPage() {
1849
+ if (this.__links) {
1850
+ return !!this.__links?.next;
1851
+ }
1841
1852
  if (!this.__requestPaged)
1842
1853
  return false;
1843
1854
  const { page } = this.__requestPaged;
@@ -1859,8 +1870,8 @@ class MonkeyEcxCommonsService {
1859
1870
  return _embedded ? _embedded[field] : null;
1860
1871
  }
1861
1872
  getNormalizedUrl(url) {
1862
- const { __requestPaged } = this;
1863
- return new MonkeyEcxRequestPagedHandling(url, __requestPaged || {}).getRequestWithPagedParams();
1873
+ const { __requestPaged, __links } = this;
1874
+ return new MonkeyEcxRequestPagedHandling(url, __requestPaged || {}, __links).getRequestWithPagedParams();
1864
1875
  }
1865
1876
  clear(clearData) {
1866
1877
  if (clearData) {
@@ -1868,6 +1879,7 @@ class MonkeyEcxCommonsService {
1868
1879
  this.__requestPaged = null;
1869
1880
  this.__params = null;
1870
1881
  this.__page = null;
1882
+ this.__links = null;
1871
1883
  if (this.__schedule) {
1872
1884
  const { queue } = this.__schedule;
1873
1885
  if (queue) {