ods-component-lib 1.18.171 → 1.18.173

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
@@ -33604,6 +33604,9 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
33604
33604
  dataSource: props.detailData[data.key.ID]
33605
33605
  }));
33606
33606
  };
33607
+ var checkIsPropArray = function checkIsPropArray(prop) {
33608
+ return prop && Array.isArray(prop);
33609
+ };
33607
33610
  return React__default.createElement(React__default.Fragment, null, React__default.createElement(antd.Modal, {
33608
33611
  title: fastUpdateModalTitle != null ? fastUpdateModalTitle : "Fast Update",
33609
33612
  open: isFastUpdateModalOpen,
@@ -33651,7 +33654,7 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
33651
33654
  }, " ", fastUpdateModalCancelText != null ? fastUpdateModalCancelText : "Cancel")), React__default.createElement(antd.Col, null, React__default.createElement(OdsButton, {
33652
33655
  htmlType: "submit",
33653
33656
  type: "primary"
33654
- }, " ", fastUpdateModalSaveText != null ? fastUpdateModalSaveText : "Save"))))), React__default.createElement(DataGrid__default, {
33657
+ }, " ", fastUpdateModalSaveText != null ? fastUpdateModalSaveText : "Save"))))), React__default.createElement(DataGrid__default, Object.assign({
33655
33658
  keyExpr: keyExpr,
33656
33659
  dataSource: data,
33657
33660
  showBorders: true,
@@ -33669,7 +33672,10 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
33669
33672
  width: "100%",
33670
33673
  repaintChangesOnly: true,
33671
33674
  focusedRowEnabled: false,
33672
- filterSyncEnabled: true,
33675
+ filterSyncEnabled: true
33676
+ }, checkIsPropArray(props.selectedRowKeys) && {
33677
+ selectedRowKeys: props.selectedRowKeys
33678
+ }, {
33673
33679
  wordWrapEnabled: props.wordWrapEnabled ? props.wordWrapEnabled : false,
33674
33680
  columnFixing: {
33675
33681
  enabled: true
@@ -33702,7 +33708,7 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
33702
33708
  onCellPrepared: onCustomCellPrepared,
33703
33709
  onOptionChanged: props.onOptionChanged || onCustomOptionChanged,
33704
33710
  onToolbarPreparing: props.onToolbarPreparing || onToolbarPreparing
33705
- }, gridColumns.map(function (col) {
33711
+ }), gridColumns.map(function (col) {
33706
33712
  return React__default.createElement(DataGrid.Column, Object.assign({
33707
33713
  key: col.dataField
33708
33714
  }, col, {
@@ -34500,11 +34506,11 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34500
34506
  filterApplied = _useState3[0],
34501
34507
  setFilterApplied = _useState3[1];
34502
34508
  var _useState4 = React.useState(0),
34503
- totalUnfilteredCount = _useState4[0],
34504
- setTotalUnfilteredCount = _useState4[1];
34509
+ setTotalUnfilteredCountState = _useState4[1];
34505
34510
  var _useState5 = React.useState(0),
34506
- totalFilteredCount = _useState5[0],
34507
- setTotalFilteredCount = _useState5[1];
34511
+ setTotalFilteredCountState = _useState5[1];
34512
+ var totalUnfilteredCount = React.useRef(0);
34513
+ var totalFilteredCount = React.useRef(0);
34508
34514
  var _useState6 = React.useState(false),
34509
34515
  updateTrigger = _useState6[0],
34510
34516
  setUpdateTrigger = _useState6[1];
@@ -34514,7 +34520,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34514
34520
  React.useEffect(function () {}, [updateTrigger, totalUnfilteredCount, totalFilteredCount, filterApplied]);
34515
34521
  var renderTotal = React.useCallback(function () {
34516
34522
  var _props$customSummary, _props$customSummary2, _props$customSummary3, _props$customSummary4;
34517
- var totalLoaded = filterApplied ? totalFilteredCount : totalUnfilteredCount;
34523
+ var totalLoaded = filterApplied ? totalFilteredCount.current : totalUnfilteredCount.current;
34518
34524
  var loadedPage = currentPage;
34519
34525
  var totalRecords = props.totalRecordCount;
34520
34526
  var totalPageCount = Math.ceil(totalRecords / currentPageSize);
@@ -34522,7 +34528,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34522
34528
  return "";
34523
34529
  }
34524
34530
  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) + " - ";
34531
+ var loadedDisplayText = totalUnfilteredCount.current + " " + ((_props$customSummary2 = props.customSummary) === null || _props$customSummary2 === void 0 ? void 0 : _props$customSummary2.summaryLoadedDataLabel) + " - ";
34526
34532
  var result = "" + filteredDisplayText + loadedDisplayText + totalRecords + " " + ((_props$customSummary3 = props.customSummary) === null || _props$customSummary3 === void 0 ? void 0 : _props$customSummary3.summaryTotalDataLabel);
34527
34533
  result += " - " + ((_props$customSummary4 = props.customSummary) === null || _props$customSummary4 === void 0 ? void 0 : _props$customSummary4.summaryTotalPageCountLabel) + " " + loadedPage + " / " + totalPageCount;
34528
34534
  return result;
@@ -34534,11 +34540,14 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34534
34540
  var currentTotalCount = currentPageIndex == 0 ? 50 : dataGridInstance.totalCount();
34535
34541
  var newData = dataGridInstance === null || dataGridInstance === void 0 ? void 0 : (_dataGridInstance$get = dataGridInstance.getDataSource()) === null || _dataGridInstance$get === void 0 ? void 0 : _dataGridInstance$get.items();
34536
34542
  if (filterApplied) {
34537
- setTotalFilteredCount(currentTotalCount);
34543
+ setTotalFilteredCountState(currentTotalCount);
34544
+ totalFilteredCount.current = currentTotalCount;
34538
34545
  } else {
34539
- setTotalUnfilteredCount(currentTotalCount);
34546
+ setTotalUnfilteredCountState(currentTotalCount);
34547
+ totalUnfilteredCount.current = currentTotalCount;
34540
34548
  }
34541
- if ((!filterApplied && currentPageIndex == 1 && currentTotalCount != totalUnfilteredCount || lastPageIndexRef.current !== currentPageIndex) && newData && newData.length > 0) {
34549
+ renderTotal();
34550
+ if ((!filterApplied && currentPageIndex == 1 && currentTotalCount != totalUnfilteredCount.current || lastPageIndexRef.current !== currentPageIndex) && newData && newData.length > 0) {
34542
34551
  setCurrentPage(currentPageIndex);
34543
34552
  setCurrentPageSize(dataGridInstance.pageSize());
34544
34553
  rowCount.current = currentTotalCount;
@@ -34564,7 +34573,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
34564
34573
  if (active) {
34565
34574
  setTimeout(function () {
34566
34575
  dataGrid.refresh().done(function () {
34567
- setTotalFilteredCount(dataGrid.totalCount());
34576
+ totalFilteredCount.current = dataGrid.totalCount();
34568
34577
  setUpdateTrigger(function (prev) {
34569
34578
  return !prev;
34570
34579
  });