ods-component-lib 1.18.65 → 1.18.67
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.modern.js
CHANGED
|
@@ -16630,6 +16630,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
16630
16630
|
var _useState3 = useState(false),
|
|
16631
16631
|
loading = _useState3[0],
|
|
16632
16632
|
setLoading = _useState3[1];
|
|
16633
|
+
var _useState4 = useState(false),
|
|
16634
|
+
contentReady = _useState4[0],
|
|
16635
|
+
setContentReady = _useState4[1];
|
|
16633
16636
|
var onCancelEditEvent = new CustomEvent('cancelEdit', {
|
|
16634
16637
|
bubbles: true,
|
|
16635
16638
|
detail: {
|
|
@@ -16688,6 +16691,45 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
16688
16691
|
gridRef.current.instance.updateDimensions();
|
|
16689
16692
|
}
|
|
16690
16693
|
}, []);
|
|
16694
|
+
useEffect(function () {
|
|
16695
|
+
if (contentReady) checkSortingPropertyForInitilaize();
|
|
16696
|
+
}, [contentReady]);
|
|
16697
|
+
var checkSortingPropertyForInitilaize = function checkSortingPropertyForInitilaize() {
|
|
16698
|
+
var onOptionChanged = props.onOptionChanged;
|
|
16699
|
+
if (onOptionChanged) {
|
|
16700
|
+
var dataGridInstance = gridRef.current.instance;
|
|
16701
|
+
var sortingState = dataGridInstance.getVisibleColumns().map(function (column, index) {
|
|
16702
|
+
return {
|
|
16703
|
+
index: index - 1,
|
|
16704
|
+
dataField: column.dataField,
|
|
16705
|
+
sortOrder: column.sortOrder
|
|
16706
|
+
};
|
|
16707
|
+
});
|
|
16708
|
+
var sortedColumn = sortingState.find(function (column) {
|
|
16709
|
+
return column.sortOrder !== undefined;
|
|
16710
|
+
});
|
|
16711
|
+
console.log("sorted column", sortedColumn);
|
|
16712
|
+
if (sortedColumn) {
|
|
16713
|
+
if (sortedColumn.sortOrder) {
|
|
16714
|
+
dataGridInstance.option("columns[" + sortedColumn.index + "].sortOrder", sortedColumn.sortOrder);
|
|
16715
|
+
var fullName = "columns[" + sortedColumn.index + "].sortOrder";
|
|
16716
|
+
var gridEvent = {
|
|
16717
|
+
component: dataGridInstance,
|
|
16718
|
+
fullName: fullName,
|
|
16719
|
+
name: 'optionChanged',
|
|
16720
|
+
value: sortedColumn.sortOrder,
|
|
16721
|
+
previousValue: null,
|
|
16722
|
+
element: null
|
|
16723
|
+
};
|
|
16724
|
+
onOptionChanged(gridEvent);
|
|
16725
|
+
}
|
|
16726
|
+
}
|
|
16727
|
+
}
|
|
16728
|
+
};
|
|
16729
|
+
var checkRequestDataHasOnlySortingProperty = function checkRequestDataHasOnlySortingProperty(obj) {
|
|
16730
|
+
var keys = Object.keys(obj);
|
|
16731
|
+
return keys.length === 1 && keys[0] === 'Sorting';
|
|
16732
|
+
};
|
|
16691
16733
|
var actionButtons = useMemo(function () {
|
|
16692
16734
|
if (props.actionButtonGroup) {
|
|
16693
16735
|
if (props.actionButtonGroup.length >= 2 && !props.edit) {
|
|
@@ -16713,22 +16755,21 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
16713
16755
|
var fetchData = useCallback(function () {
|
|
16714
16756
|
try {
|
|
16715
16757
|
if (props.axiosRequest == undefined) return Promise.resolve();
|
|
16716
|
-
|
|
16758
|
+
return Promise.resolve(function () {
|
|
16717
16759
|
if (props.isServerSide) {
|
|
16718
16760
|
var _props$axiosRequest$r;
|
|
16761
|
+
if (props.axiosRequest.requestData && checkRequestDataHasOnlySortingProperty(props.axiosRequest.requestData)) return;
|
|
16719
16762
|
var apiUrl = props.axiosRequest.environmentUrl + "" + props.axiosRequest.apiUrl;
|
|
16720
16763
|
if (((_props$axiosRequest$r = props.axiosRequest.requestData) === null || _props$axiosRequest$r === void 0 ? void 0 : _props$axiosRequest$r.PaginatedRequest) !== undefined) {
|
|
16721
16764
|
props.axiosRequest.requestData.PaginatedRequest.PageNumber = loadedPageCount;
|
|
16722
16765
|
props.axiosRequest.requestData.PaginatedRequest.PageSize = props.pageSize;
|
|
16723
16766
|
}
|
|
16724
16767
|
if (props.axiosRequest.requestQueryString !== undefined) {
|
|
16725
|
-
|
|
16726
|
-
queryParams.maxResultCount = props.pageSize.toString();
|
|
16727
|
-
var query = props.axiosRequest.requestQueryString;
|
|
16768
|
+
props.axiosRequest.requestQueryString.maxResultCount = props.pageSize;
|
|
16728
16769
|
if (loadedPageCount > 1 && totalPageCount >= loadedPageCount) {
|
|
16729
|
-
|
|
16770
|
+
props.axiosRequest.requestQueryString.skipCount = ((loadedPageCount - 1) * props.pageSize).toString();
|
|
16730
16771
|
}
|
|
16731
|
-
query = queryString.stringify(
|
|
16772
|
+
var query = queryString.stringify(props.axiosRequest.requestQueryString);
|
|
16732
16773
|
apiUrl = apiUrl + "?" + query;
|
|
16733
16774
|
}
|
|
16734
16775
|
var requestOptions = {
|
|
@@ -16763,8 +16804,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
16763
16804
|
});
|
|
16764
16805
|
if (_temp && _temp.then) return _temp.then(function () {});
|
|
16765
16806
|
}
|
|
16766
|
-
}();
|
|
16767
|
-
return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
|
|
16807
|
+
}());
|
|
16768
16808
|
} catch (e) {
|
|
16769
16809
|
return Promise.reject(e);
|
|
16770
16810
|
}
|
|
@@ -16987,6 +17027,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
16987
17027
|
var dataGridInstance = e.component;
|
|
16988
17028
|
var filteredDataCount = dataGridInstance.totalCount();
|
|
16989
17029
|
if (filterApplied.current && filteredDataCount > 0) setFilteredRowCount(filteredDataCount);
|
|
17030
|
+
if (!contentReady) setContentReady(true);
|
|
16990
17031
|
};
|
|
16991
17032
|
var onFilterValueChange = function onFilterValueChange(e) {
|
|
16992
17033
|
if (e !== null) filterApplied.current = true;else {
|