ods-component-lib 1.18.17 → 1.18.19

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.
@@ -17124,12 +17124,12 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17124
17124
  isLoading = _useState2[0],
17125
17125
  setIsLoading = _useState2[1];
17126
17126
  var fileName = props.exportFileName ? props.exportFileName + moment().format("YYYYMMDD") : "DatagridExportFile" + moment().format("YYYYMMDD");
17127
- var gridRef = useRef(null);
17128
17127
  var _useState3 = useState(0),
17129
17128
  filteredRowCount = _useState3[0];
17130
17129
  var _useState4 = useState(props.columns),
17131
17130
  columns = _useState4[0],
17132
17131
  setColumns = _useState4[1];
17132
+ var gridRef = useRef(null);
17133
17133
  var onCancelEditEvent = new CustomEvent('cancelEdit', {
17134
17134
  bubbles: true,
17135
17135
  detail: {
@@ -17141,6 +17141,11 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17141
17141
  'Authorization': 'Bearer ' + (props.axiosRequest ? props.axiosRequest.token : ""),
17142
17142
  "Accept-Language": props.language != "" ? props.language : 'EN'
17143
17143
  });
17144
+ useEffect(function () {
17145
+ totalPageCount = 1;
17146
+ loadedPageCount = 1;
17147
+ totalRecordCount = 0;
17148
+ }, [props.dataGridPageName]);
17144
17149
  useEffect(function () {
17145
17150
  var _props$axiosRequest;
17146
17151
  if (props.axiosRequest !== undefined && Object.keys((_props$axiosRequest = props.axiosRequest) === null || _props$axiosRequest === void 0 ? void 0 : _props$axiosRequest.requestData).length > 0) {
@@ -17205,11 +17210,6 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17205
17210
  return [];
17206
17211
  }
17207
17212
  }, [props.actionButtonGroup]);
17208
- var handleRef = function handleRef(instance) {
17209
- if (instance) {
17210
- gridRef.current = instance;
17211
- }
17212
- };
17213
17213
  var fetchData = useCallback(function () {
17214
17214
  try {
17215
17215
  if (props.axiosRequest == undefined) return Promise.resolve();
@@ -17272,6 +17272,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17272
17272
  e.editorOptions.onFocusIn = disableScrolling;
17273
17273
  e.editorOptions.onFocusOut = enableScrolling;
17274
17274
  }
17275
+ if (props.onEditorPreparing) {
17276
+ props.onEditorPreparing(e);
17277
+ }
17275
17278
  }
17276
17279
  if (e.editorOptions && e.rowType === 'data' && e.parentType === 'dataRow') {
17277
17280
  e.editorOptions.onValueChanged = function (args) {
@@ -17370,7 +17373,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17370
17373
  }, []);
17371
17374
  var renderTotal = useCallback(function () {
17372
17375
  var totalloaded = 0;
17373
- if (data.length < 50) {
17376
+ if (data.length < 50 || !props.isServerSide || loadedPageCount == totalPageCount) {
17374
17377
  totalloaded = data.length;
17375
17378
  } else {
17376
17379
  totalloaded = loadedPageCount * props.pageSize;
@@ -17378,6 +17381,8 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17378
17381
  var result = "";
17379
17382
  if (filteredRowCount > 0) {
17380
17383
  result = "" + totalloaded + props.customSummary.summaryFilteredDataLabel + (totalRecordCount > 0 ? totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalRecordCount) + props.customSummary.summaryTotalDataLabel : " ");
17384
+ } else if (!props.isServerSide && totalloaded > 0) {
17385
+ result = totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalloaded) + props.customSummary.summaryTotalDataLabel;
17381
17386
  } else {
17382
17387
  result = totalRecordCount > 0 ? totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalRecordCount) + props.customSummary.summaryTotalDataLabel : "";
17383
17388
  }
@@ -17412,6 +17417,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17412
17417
  var height = (_scrollable$clientHei = scrollable === null || scrollable === void 0 ? void 0 : scrollable.clientHeight) != null ? _scrollable$clientHei : 0;
17413
17418
  var scrollHeight = (_scrollable$scrollHei = scrollable === null || scrollable === void 0 ? void 0 : scrollable.scrollHeight) != null ? _scrollable$scrollHei : 0;
17414
17419
  var maxHeight = Math.max(top, height, scrollHeight) - 1;
17420
+ if (scrollHeight <= height) {
17421
+ return;
17422
+ }
17415
17423
  var reachedBottom = Math.ceil(top + height) >= maxHeight;
17416
17424
  var lastScrollTop = 0;
17417
17425
  if (top < lastScrollTop) {
@@ -17441,7 +17449,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17441
17449
  showBorders: true,
17442
17450
  columnAutoWidth: false,
17443
17451
  onEditorPreparing: onEditorPreparing,
17444
- ref: handleRef,
17452
+ ref: gridRef,
17445
17453
  onExporting: onExporting,
17446
17454
  height: props.height == undefined ? window.innerHeight - 164 : props.height,
17447
17455
  allowColumnResizing: true,
@@ -17466,7 +17474,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17466
17474
  },
17467
17475
  onSelectionChanged: props.onSelectionChanged,
17468
17476
  noDataText: props.noDataText,
17469
- onSaved: props.onSaved
17477
+ onSaved: props.onSaved,
17478
+ onSaving: props.onSaving,
17479
+ onEditCanceling: props.onEditCanceling
17470
17480
  }, columns.map(function (col) {
17471
17481
  return React.createElement(Column, Object.assign({
17472
17482
  key: col.dataField