ods-component-lib 1.18.146 → 1.18.147

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
@@ -35022,7 +35022,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35022
35022
  var renderTotal = React.useCallback(function () {
35023
35023
  var _props$customSummary, _props$customSummary2, _props$customSummary3, _props$customSummary4;
35024
35024
  var totalLoaded = filterApplied ? totalFilteredCount.current : totalUnfilteredCount.current;
35025
- var loadedPage = currentPage + 1;
35025
+ var loadedPage = currentPage;
35026
35026
  var totalRecords = props.totalRecordCount;
35027
35027
  var totalPageCount = Math.ceil(totalRecords / currentPageSize);
35028
35028
  if (totalLoaded === 0 || totalLoaded === -1) {
@@ -35033,12 +35033,12 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35033
35033
  var result = "" + filteredDisplayText + loadedDisplayText + totalRecords + " " + ((_props$customSummary3 = props.customSummary) === null || _props$customSummary3 === void 0 ? void 0 : _props$customSummary3.summaryTotalDataLabel);
35034
35034
  result += " - " + ((_props$customSummary4 = props.customSummary) === null || _props$customSummary4 === void 0 ? void 0 : _props$customSummary4.summaryTotalPageCountLabel) + " " + loadedPage + " / " + totalPageCount;
35035
35035
  return result;
35036
- }, [currentPage, currentPageSize, filterApplied, props.customSummary, props.totalRecordCount, totalUnfilteredCount]);
35036
+ }, [currentPage, currentPageSize, filterApplied, props.customSummary, props.totalRecordCount, totalUnfilteredCount, props.dataSource]);
35037
35037
  var handleContentReady = React.useCallback(function (e) {
35038
35038
  var _dataGridInstance$get;
35039
35039
  var dataGridInstance = e.component;
35040
- var currentPageIndex = dataGridInstance.pageIndex();
35041
- var currentTotalCount = dataGridInstance.totalCount();
35040
+ var currentPageIndex = dataGridInstance.pageCount();
35041
+ var currentTotalCount = currentPageIndex == 0 ? 50 : dataGridInstance.totalCount();
35042
35042
  var newData = dataGridInstance === null || dataGridInstance === void 0 ? void 0 : (_dataGridInstance$get = dataGridInstance.getDataSource()) === null || _dataGridInstance$get === void 0 ? void 0 : _dataGridInstance$get.items();
35043
35043
  if (lastPageIndexRef.current !== currentPageIndex && newData && newData.length > 0) {
35044
35044
  setHeaderFilterData(function (prevData) {
@@ -35070,6 +35070,12 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35070
35070
  setCurrentPage(currentPageIndex);
35071
35071
  setCurrentPageSize(dataGridInstance.pageSize());
35072
35072
  rowCount.current = currentTotalCount;
35073
+ setUpdateTrigger(function (prev) {
35074
+ return !prev;
35075
+ });
35076
+ lastPageIndexRef.current = currentPageIndex;
35077
+ }
35078
+ if (currentTotalCount > 0) {
35073
35079
  if (filterApplied) {
35074
35080
  totalFilteredCount.current = currentTotalCount;
35075
35081
  } else {
@@ -35078,10 +35084,6 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35078
35084
  if (!filterApplied && totalFilteredCount.current === 0) {
35079
35085
  totalFilteredCount.current = totalUnfilteredCount.current;
35080
35086
  }
35081
- setUpdateTrigger(function (prev) {
35082
- return !prev;
35083
- });
35084
- lastPageIndexRef.current = currentPageIndex;
35085
35087
  }
35086
35088
  }, [props.columns, filterApplied]);
35087
35089
  var handleOptionChanged = React.useCallback(function (e) {
@@ -35094,6 +35096,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35094
35096
  };
35095
35097
  if (e.fullName.includes("sortOrder")) {
35096
35098
  dataGrid.getScrollable().scrollTo(0);
35099
+ setHeaderFilterData([]);
35097
35100
  }
35098
35101
  if (e.fullName.includes("filterValue") || e.fullName.includes("filter") || e.fullName === "searchPanel.text") {
35099
35102
  var active = updateFilterStatus();
@@ -35343,7 +35346,8 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35343
35346
  onToolbarPreparing: props.onToolbarPreparing,
35344
35347
  ref: props.dataGridRef
35345
35348
  }), React__default.createElement(DataGrid.Scrolling, {
35346
- mode: "infinite"
35349
+ mode: "infinite",
35350
+ preloadEnabled: true
35347
35351
  }), React__default.createElement(DataGrid.Paging, {
35348
35352
  enabled: true,
35349
35353
  defaultPageSize: props.pageSize
@@ -35367,7 +35371,6 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35367
35371
  value: false
35368
35372
  }]
35369
35373
  }), React__default.createElement(DataGrid.HeaderFilter, {
35370
- allowSearch: true,
35371
35374
  dataSource: [].concat(filterOptions[col.dataField] || [])
35372
35375
  }), col.multiLevelColumns && col.multiLevelColumns.map(function (multiLevelColItem) {
35373
35376
  return React__default.createElement(DataGrid.Column, {