ods-component-lib 1.18.170 → 1.18.172

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
@@ -34500,11 +34500,11 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34500
34500
  filterApplied = _useState3[0],
34501
34501
  setFilterApplied = _useState3[1];
34502
34502
  var _useState4 = React.useState(0),
34503
- totalUnfilteredCount = _useState4[0],
34504
- setTotalUnfilteredCount = _useState4[1];
34503
+ setTotalUnfilteredCountState = _useState4[1];
34505
34504
  var _useState5 = React.useState(0),
34506
- totalFilteredCount = _useState5[0],
34507
- setTotalFilteredCount = _useState5[1];
34505
+ setTotalFilteredCountState = _useState5[1];
34506
+ var totalUnfilteredCount = React.useRef(0);
34507
+ var totalFilteredCount = React.useRef(0);
34508
34508
  var _useState6 = React.useState(false),
34509
34509
  updateTrigger = _useState6[0],
34510
34510
  setUpdateTrigger = _useState6[1];
@@ -34514,7 +34514,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34514
34514
  React.useEffect(function () {}, [updateTrigger, totalUnfilteredCount, totalFilteredCount, filterApplied]);
34515
34515
  var renderTotal = React.useCallback(function () {
34516
34516
  var _props$customSummary, _props$customSummary2, _props$customSummary3, _props$customSummary4;
34517
- var totalLoaded = filterApplied ? totalFilteredCount : totalUnfilteredCount;
34517
+ var totalLoaded = filterApplied ? totalFilteredCount.current : totalUnfilteredCount.current;
34518
34518
  var loadedPage = currentPage;
34519
34519
  var totalRecords = props.totalRecordCount;
34520
34520
  var totalPageCount = Math.ceil(totalRecords / currentPageSize);
@@ -34522,7 +34522,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34522
34522
  return "";
34523
34523
  }
34524
34524
  var filteredDisplayText = filterApplied ? totalLoaded + " " + ((_props$customSummary = props.customSummary) === null || _props$customSummary === void 0 ? void 0 : _props$customSummary.summaryFilteredDataLabel) + " - " : "";
34525
- var loadedDisplayText = totalUnfilteredCount + " " + ((_props$customSummary2 = props.customSummary) === null || _props$customSummary2 === void 0 ? void 0 : _props$customSummary2.summaryLoadedDataLabel) + " - ";
34525
+ var loadedDisplayText = totalUnfilteredCount.current + " " + ((_props$customSummary2 = props.customSummary) === null || _props$customSummary2 === void 0 ? void 0 : _props$customSummary2.summaryLoadedDataLabel) + " - ";
34526
34526
  var result = "" + filteredDisplayText + loadedDisplayText + totalRecords + " " + ((_props$customSummary3 = props.customSummary) === null || _props$customSummary3 === void 0 ? void 0 : _props$customSummary3.summaryTotalDataLabel);
34527
34527
  result += " - " + ((_props$customSummary4 = props.customSummary) === null || _props$customSummary4 === void 0 ? void 0 : _props$customSummary4.summaryTotalPageCountLabel) + " " + loadedPage + " / " + totalPageCount;
34528
34528
  return result;
@@ -34534,11 +34534,14 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34534
34534
  var currentTotalCount = currentPageIndex == 0 ? 50 : dataGridInstance.totalCount();
34535
34535
  var newData = dataGridInstance === null || dataGridInstance === void 0 ? void 0 : (_dataGridInstance$get = dataGridInstance.getDataSource()) === null || _dataGridInstance$get === void 0 ? void 0 : _dataGridInstance$get.items();
34536
34536
  if (filterApplied) {
34537
- setTotalFilteredCount(currentTotalCount);
34537
+ setTotalFilteredCountState(currentTotalCount);
34538
+ totalFilteredCount.current = currentTotalCount;
34538
34539
  } else {
34539
- setTotalUnfilteredCount(currentTotalCount);
34540
+ setTotalUnfilteredCountState(currentTotalCount);
34541
+ totalUnfilteredCount.current = currentTotalCount;
34540
34542
  }
34541
- if ((!filterApplied && currentPageIndex == 1 && currentTotalCount != totalUnfilteredCount || lastPageIndexRef.current !== currentPageIndex) && newData && newData.length > 0) {
34543
+ renderTotal();
34544
+ if ((!filterApplied && currentPageIndex == 1 && currentTotalCount != totalUnfilteredCount.current || lastPageIndexRef.current !== currentPageIndex) && newData && newData.length > 0) {
34542
34545
  setCurrentPage(currentPageIndex);
34543
34546
  setCurrentPageSize(dataGridInstance.pageSize());
34544
34547
  rowCount.current = currentTotalCount;
@@ -34564,7 +34567,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34564
34567
  if (active) {
34565
34568
  setTimeout(function () {
34566
34569
  dataGrid.refresh().done(function () {
34567
- setTotalFilteredCount(dataGrid.totalCount());
34570
+ totalFilteredCount.current = dataGrid.totalCount();
34568
34571
  setUpdateTrigger(function (prev) {
34569
34572
  return !prev;
34570
34573
  });
@@ -34576,6 +34579,9 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34576
34579
  props.sortingProps.onOptionChanged(e);
34577
34580
  }
34578
34581
  }, [props.dataGridRef]);
34582
+ var handleSelectionChanged = function handleSelectionChanged(event) {
34583
+ props.onSelectionChanged && props.onSelectionChanged(event);
34584
+ };
34579
34585
  var actionButtons = React.useMemo(function () {
34580
34586
  if (props.actionButtonGroup) {
34581
34587
  if (props.actionButtonGroup.length > 3 && !props.edit) {
@@ -34746,6 +34752,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34746
34752
  },
34747
34753
  onContentReady: handleContentReady,
34748
34754
  onOptionChanged: handleOptionChanged,
34755
+ onSelectionChanged: handleSelectionChanged,
34749
34756
  width: "100%",
34750
34757
  language: props.language,
34751
34758
  onToolbarPreparing: props.onToolbarPreparing,