ods-component-lib 1.18.65 → 1.18.66

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
@@ -16635,6 +16635,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16635
16635
  var _useState3 = React.useState(false),
16636
16636
  loading = _useState3[0],
16637
16637
  setLoading = _useState3[1];
16638
+ var _useState4 = React.useState(false),
16639
+ contentReady = _useState4[0],
16640
+ setContentReady = _useState4[1];
16638
16641
  var onCancelEditEvent = new CustomEvent('cancelEdit', {
16639
16642
  bubbles: true,
16640
16643
  detail: {
@@ -16693,6 +16696,45 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16693
16696
  gridRef.current.instance.updateDimensions();
16694
16697
  }
16695
16698
  }, []);
16699
+ React.useEffect(function () {
16700
+ if (contentReady) checkSortingPropertyForInitilaize();
16701
+ }, [contentReady]);
16702
+ var checkSortingPropertyForInitilaize = function checkSortingPropertyForInitilaize() {
16703
+ var onOptionChanged = props.onOptionChanged;
16704
+ if (onOptionChanged) {
16705
+ var dataGridInstance = gridRef.current.instance;
16706
+ var sortingState = dataGridInstance.getVisibleColumns().map(function (column, index) {
16707
+ return {
16708
+ index: index - 1,
16709
+ dataField: column.dataField,
16710
+ sortOrder: column.sortOrder
16711
+ };
16712
+ });
16713
+ var sortedColumn = sortingState.find(function (column) {
16714
+ return column.sortOrder !== undefined;
16715
+ });
16716
+ console.log("sorted column", sortedColumn);
16717
+ if (sortedColumn) {
16718
+ if (sortedColumn.sortOrder) {
16719
+ dataGridInstance.option("columns[" + sortedColumn.index + "].sortOrder", sortedColumn.sortOrder);
16720
+ var fullName = "columns[" + sortedColumn.index + "].sortOrder";
16721
+ var gridEvent = {
16722
+ component: dataGridInstance,
16723
+ fullName: fullName,
16724
+ name: 'optionChanged',
16725
+ value: sortedColumn.sortOrder,
16726
+ previousValue: null,
16727
+ element: null
16728
+ };
16729
+ onOptionChanged(gridEvent);
16730
+ }
16731
+ }
16732
+ }
16733
+ };
16734
+ var checkRequestDataHasOnlySortingProperty = function checkRequestDataHasOnlySortingProperty(obj) {
16735
+ var keys = Object.keys(obj);
16736
+ return keys.length === 1 && keys[0] === 'Sorting';
16737
+ };
16696
16738
  var actionButtons = React.useMemo(function () {
16697
16739
  if (props.actionButtonGroup) {
16698
16740
  if (props.actionButtonGroup.length >= 2 && !props.edit) {
@@ -16718,9 +16760,10 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16718
16760
  var fetchData = React.useCallback(function () {
16719
16761
  try {
16720
16762
  if (props.axiosRequest == undefined) return Promise.resolve();
16721
- var _temp2 = function () {
16763
+ return Promise.resolve(function () {
16722
16764
  if (props.isServerSide) {
16723
16765
  var _props$axiosRequest$r;
16766
+ if (props.axiosRequest.requestData && checkRequestDataHasOnlySortingProperty(props.axiosRequest.requestData)) return;
16724
16767
  var apiUrl = props.axiosRequest.environmentUrl + "" + props.axiosRequest.apiUrl;
16725
16768
  if (((_props$axiosRequest$r = props.axiosRequest.requestData) === null || _props$axiosRequest$r === void 0 ? void 0 : _props$axiosRequest$r.PaginatedRequest) !== undefined) {
16726
16769
  props.axiosRequest.requestData.PaginatedRequest.PageNumber = loadedPageCount;
@@ -16768,8 +16811,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16768
16811
  });
16769
16812
  if (_temp && _temp.then) return _temp.then(function () {});
16770
16813
  }
16771
- }();
16772
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
16814
+ }());
16773
16815
  } catch (e) {
16774
16816
  return Promise.reject(e);
16775
16817
  }
@@ -16992,6 +17034,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
16992
17034
  var dataGridInstance = e.component;
16993
17035
  var filteredDataCount = dataGridInstance.totalCount();
16994
17036
  if (filterApplied.current && filteredDataCount > 0) setFilteredRowCount(filteredDataCount);
17037
+ if (!contentReady) setContentReady(true);
16995
17038
  };
16996
17039
  var onFilterValueChange = function onFilterValueChange(e) {
16997
17040
  if (e !== null) filterApplied.current = true;else {