@salesgenterp/ui-components 0.4.531 → 0.4.533

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
@@ -7762,6 +7762,7 @@ function EnhancedTable(_ref2) {
7762
7762
  var _React$useState6 = React.useState(DEFAULT_PAGE_SIZE),
7763
7763
  rowsPerPage = _React$useState6[0],
7764
7764
  setRowsPerPage = _React$useState6[1];
7765
+ var tableContainerRef = React.useRef(null);
7765
7766
  var NUMERIC_SORT_COLUMNS = ['quantity', 'standardPrice', 'subtotal'];
7766
7767
  var handleRequestSort = function handleRequestSort(event, property) {
7767
7768
  var isSameColumn = orderBy === property;
@@ -7830,6 +7831,13 @@ function EnhancedTable(_ref2) {
7830
7831
  setPage(1);
7831
7832
  }
7832
7833
  }, [totalPages, page]);
7834
+ React.useEffect(function () {
7835
+ var _tableContainerRef$cu, _tableContainerRef$cu2;
7836
+ (_tableContainerRef$cu = tableContainerRef.current) === null || _tableContainerRef$cu === void 0 ? void 0 : (_tableContainerRef$cu2 = _tableContainerRef$cu.scrollTo) === null || _tableContainerRef$cu2 === void 0 ? void 0 : _tableContainerRef$cu2.call(_tableContainerRef$cu, {
7837
+ top: 0,
7838
+ behavior: 'smooth'
7839
+ });
7840
+ }, [page, rowsPerPage]);
7833
7841
  return /*#__PURE__*/React.createElement(CartPageBox, null, loading && /*#__PURE__*/React.createElement(Loader$1, null, /*#__PURE__*/React.createElement(reactSpinners.BounceLoader, {
7834
7842
  size: 40,
7835
7843
  color: styles === null || styles === void 0 ? void 0 : (_styles$Btn = styles.Btn) === null || _styles$Btn === void 0 ? void 0 : _styles$Btn.background,
@@ -7839,6 +7847,7 @@ function EnhancedTable(_ref2) {
7839
7847
  width: '100%'
7840
7848
  }
7841
7849
  }, /*#__PURE__*/React.createElement(CartTableContainer, {
7850
+ ref: tableContainerRef,
7842
7851
  bg: styles === null || styles === void 0 ? void 0 : (_styles$scroll = styles.scroll) === null || _styles$scroll === void 0 ? void 0 : _styles$scroll.bg,
7843
7852
  color: styles === null || styles === void 0 ? void 0 : (_styles$scroll2 = styles.scroll) === null || _styles$scroll2 === void 0 ? void 0 : _styles$scroll2.color
7844
7853
  }, /*#__PURE__*/React.createElement(Table, {
@@ -10633,7 +10642,8 @@ var StaticPageList = function StaticPageList(_ref) {
10633
10642
  var _sortBy;
10634
10643
  var apiEndPoint = _ref.apiEndPoint,
10635
10644
  queryParams = _ref.queryParams,
10636
- itemLink = _ref.itemLink;
10645
+ itemLink = _ref.itemLink,
10646
+ pageData = _ref.pageData;
10637
10647
  var _useState = React.useState(false),
10638
10648
  loading = _useState[0],
10639
10649
  setLoading = _useState[1];
@@ -10643,30 +10653,37 @@ var StaticPageList = function StaticPageList(_ref) {
10643
10653
  React.useEffect(function () {
10644
10654
  (function () {
10645
10655
  try {
10646
- var _temp3 = function () {
10647
- if (apiEndPoint) {
10648
- var _temp2 = function _temp2() {
10649
- setLoading(false);
10650
- };
10651
- setLoading(true);
10652
- var _temp = _catch(function () {
10653
- return Promise.resolve(API({
10654
- apiEndPoint: apiEndPoint,
10655
- url: "/ecommerce/staticPage/list?page=0&size=9999",
10656
- queryParams: queryParams
10657
- })).then(function (response) {
10658
- setStaticPageData(response === null || response === void 0 ? void 0 : response.content);
10659
- });
10660
- }, function () {});
10661
- return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
10656
+ var _temp4 = function () {
10657
+ if (pageData) {
10658
+ setStaticPageData(pageData);
10659
+ } else {
10660
+ var _temp3 = function () {
10661
+ if (apiEndPoint) {
10662
+ var _temp2 = function _temp2() {
10663
+ setLoading(false);
10664
+ };
10665
+ setLoading(true);
10666
+ var _temp = _catch(function () {
10667
+ return Promise.resolve(API({
10668
+ apiEndPoint: apiEndPoint,
10669
+ url: "/ecommerce/staticPage/list?page=0&size=999",
10670
+ queryParams: queryParams
10671
+ })).then(function (response) {
10672
+ setStaticPageData(response === null || response === void 0 ? void 0 : response.content);
10673
+ });
10674
+ }, function () {});
10675
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
10676
+ }
10677
+ }();
10678
+ if (_temp3 && _temp3.then) return _temp3.then(function () {});
10662
10679
  }
10663
10680
  }();
10664
- return _temp3 && _temp3.then ? _temp3.then(function () {}) : void 0;
10681
+ return _temp4 && _temp4.then ? _temp4.then(function () {}) : void 0;
10665
10682
  } catch (e) {
10666
10683
  Promise.reject(e);
10667
10684
  }
10668
10685
  })();
10669
- }, []);
10686
+ }, [pageData]);
10670
10687
  return /*#__PURE__*/React__default.createElement("div", {
10671
10688
  style: {
10672
10689
  padding: '1rem'