ods-component-lib 1.18.18 → 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.
@@ -1,7 +1,7 @@
1
- import React, { MutableRefObject } from 'react';
1
+ import React from 'react';
2
2
  import { IDataGridOptions, IButtonProps, ISelectionProps, IEditingProps, ISummaryProps } from 'devextreme-react/data-grid';
3
3
  interface IOdsDataGridProps extends IDataGridOptions {
4
- dataGridRef: MutableRefObject<any>;
4
+ dataGridPageName: string;
5
5
  language: string;
6
6
  exportFileName: string;
7
7
  filterEnabledShow: boolean;
package/dist/index.js CHANGED
@@ -17134,6 +17134,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17134
17134
  var _useState4 = React.useState(props.columns),
17135
17135
  columns = _useState4[0],
17136
17136
  setColumns = _useState4[1];
17137
+ var gridRef = React.useRef(null);
17137
17138
  var onCancelEditEvent = new CustomEvent('cancelEdit', {
17138
17139
  bubbles: true,
17139
17140
  detail: {
@@ -17149,7 +17150,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17149
17150
  totalPageCount = 1;
17150
17151
  loadedPageCount = 1;
17151
17152
  totalRecordCount = 0;
17152
- }, [props.dataGridRef.current]);
17153
+ }, [props.dataGridPageName]);
17153
17154
  React.useEffect(function () {
17154
17155
  var _props$axiosRequest;
17155
17156
  if (props.axiosRequest !== undefined && Object.keys((_props$axiosRequest = props.axiosRequest) === null || _props$axiosRequest === void 0 ? void 0 : _props$axiosRequest.requestData).length > 0) {
@@ -17188,6 +17189,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17188
17189
  React.useEffect(function () {
17189
17190
  localization.locale(localStorage.getItem("locale"));
17190
17191
  localization.loadMessages(JSON.parse(localStorage.getItem("localTranslation")));
17192
+ if (gridRef.current) {
17193
+ gridRef.current.instance.updateDimensions();
17194
+ }
17191
17195
  }, []);
17192
17196
  var actionButtons = React.useMemo(function () {
17193
17197
  if (props.actionButtonGroup) {
@@ -17265,10 +17269,10 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17265
17269
  if (e.row !== undefined && e.parentType === 'dataRow') {
17266
17270
  if (props.isServerSide) {
17267
17271
  var disableScrolling = function disableScrolling() {
17268
- props.dataGridRef.current.instance.option('scrolling.mode', 'none');
17272
+ gridRef.current.instance.option('scrolling.mode', 'none');
17269
17273
  };
17270
17274
  var enableScrolling = function enableScrolling() {
17271
- props.dataGridRef.current.instance.option('scrolling.mode', 'virtual');
17275
+ gridRef.current.instance.option('scrolling.mode', 'virtual');
17272
17276
  };
17273
17277
  e.editorOptions.onFocusIn = disableScrolling;
17274
17278
  e.editorOptions.onFocusOut = enableScrolling;
@@ -17418,6 +17422,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17418
17422
  var height = (_scrollable$clientHei = scrollable === null || scrollable === void 0 ? void 0 : scrollable.clientHeight) != null ? _scrollable$clientHei : 0;
17419
17423
  var scrollHeight = (_scrollable$scrollHei = scrollable === null || scrollable === void 0 ? void 0 : scrollable.scrollHeight) != null ? _scrollable$scrollHei : 0;
17420
17424
  var maxHeight = Math.max(top, height, scrollHeight) - 1;
17425
+ if (scrollHeight <= height) {
17426
+ return;
17427
+ }
17421
17428
  var reachedBottom = Math.ceil(top + height) >= maxHeight;
17422
17429
  var lastScrollTop = 0;
17423
17430
  if (top < lastScrollTop) {
@@ -17447,7 +17454,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
17447
17454
  showBorders: true,
17448
17455
  columnAutoWidth: false,
17449
17456
  onEditorPreparing: onEditorPreparing,
17450
- ref: props.dataGridRef,
17457
+ ref: gridRef,
17451
17458
  onExporting: onExporting,
17452
17459
  height: props.height == undefined ? window.innerHeight - 164 : props.height,
17453
17460
  allowColumnResizing: true,