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.
|
@@ -1,6 +1,7 @@
|
|
|
1
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
|
+
dataGridPageName: string;
|
|
4
5
|
language: string;
|
|
5
6
|
exportFileName: string;
|
|
6
7
|
filterEnabledShow: boolean;
|
|
@@ -18,7 +19,6 @@ interface IOdsDataGridProps extends IDataGridOptions {
|
|
|
18
19
|
isServerSide: boolean;
|
|
19
20
|
axiosRequest?: IAxiosProps;
|
|
20
21
|
customSummary?: ISummaryRowOptions;
|
|
21
|
-
onCancelEdit?: any;
|
|
22
22
|
}
|
|
23
23
|
interface ISummaryRowOptions {
|
|
24
24
|
summaryLoadedDataLabel?: string;
|
package/dist/index.js
CHANGED
|
@@ -17129,12 +17129,12 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17129
17129
|
isLoading = _useState2[0],
|
|
17130
17130
|
setIsLoading = _useState2[1];
|
|
17131
17131
|
var fileName = props.exportFileName ? props.exportFileName + moment().format("YYYYMMDD") : "DatagridExportFile" + moment().format("YYYYMMDD");
|
|
17132
|
-
var gridRef = React.useRef(null);
|
|
17133
17132
|
var _useState3 = React.useState(0),
|
|
17134
17133
|
filteredRowCount = _useState3[0];
|
|
17135
17134
|
var _useState4 = React.useState(props.columns),
|
|
17136
17135
|
columns = _useState4[0],
|
|
17137
17136
|
setColumns = _useState4[1];
|
|
17137
|
+
var gridRef = React.useRef(null);
|
|
17138
17138
|
var onCancelEditEvent = new CustomEvent('cancelEdit', {
|
|
17139
17139
|
bubbles: true,
|
|
17140
17140
|
detail: {
|
|
@@ -17146,6 +17146,11 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17146
17146
|
'Authorization': 'Bearer ' + (props.axiosRequest ? props.axiosRequest.token : ""),
|
|
17147
17147
|
"Accept-Language": props.language != "" ? props.language : 'EN'
|
|
17148
17148
|
});
|
|
17149
|
+
React.useEffect(function () {
|
|
17150
|
+
totalPageCount = 1;
|
|
17151
|
+
loadedPageCount = 1;
|
|
17152
|
+
totalRecordCount = 0;
|
|
17153
|
+
}, [props.dataGridPageName]);
|
|
17149
17154
|
React.useEffect(function () {
|
|
17150
17155
|
var _props$axiosRequest;
|
|
17151
17156
|
if (props.axiosRequest !== undefined && Object.keys((_props$axiosRequest = props.axiosRequest) === null || _props$axiosRequest === void 0 ? void 0 : _props$axiosRequest.requestData).length > 0) {
|
|
@@ -17210,11 +17215,6 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17210
17215
|
return [];
|
|
17211
17216
|
}
|
|
17212
17217
|
}, [props.actionButtonGroup]);
|
|
17213
|
-
var handleRef = function handleRef(instance) {
|
|
17214
|
-
if (instance) {
|
|
17215
|
-
gridRef.current = instance;
|
|
17216
|
-
}
|
|
17217
|
-
};
|
|
17218
17218
|
var fetchData = React.useCallback(function () {
|
|
17219
17219
|
try {
|
|
17220
17220
|
if (props.axiosRequest == undefined) return Promise.resolve();
|
|
@@ -17277,6 +17277,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17277
17277
|
e.editorOptions.onFocusIn = disableScrolling;
|
|
17278
17278
|
e.editorOptions.onFocusOut = enableScrolling;
|
|
17279
17279
|
}
|
|
17280
|
+
if (props.onEditorPreparing) {
|
|
17281
|
+
props.onEditorPreparing(e);
|
|
17282
|
+
}
|
|
17280
17283
|
}
|
|
17281
17284
|
if (e.editorOptions && e.rowType === 'data' && e.parentType === 'dataRow') {
|
|
17282
17285
|
e.editorOptions.onValueChanged = function (args) {
|
|
@@ -17375,7 +17378,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17375
17378
|
}, []);
|
|
17376
17379
|
var renderTotal = React.useCallback(function () {
|
|
17377
17380
|
var totalloaded = 0;
|
|
17378
|
-
if (data.length < 50) {
|
|
17381
|
+
if (data.length < 50 || !props.isServerSide || loadedPageCount == totalPageCount) {
|
|
17379
17382
|
totalloaded = data.length;
|
|
17380
17383
|
} else {
|
|
17381
17384
|
totalloaded = loadedPageCount * props.pageSize;
|
|
@@ -17383,6 +17386,8 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17383
17386
|
var result = "";
|
|
17384
17387
|
if (filteredRowCount > 0) {
|
|
17385
17388
|
result = "" + totalloaded + props.customSummary.summaryFilteredDataLabel + (totalRecordCount > 0 ? totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalRecordCount) + props.customSummary.summaryTotalDataLabel : " ");
|
|
17389
|
+
} else if (!props.isServerSide && totalloaded > 0) {
|
|
17390
|
+
result = totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalloaded) + props.customSummary.summaryTotalDataLabel;
|
|
17386
17391
|
} else {
|
|
17387
17392
|
result = totalRecordCount > 0 ? totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalRecordCount) + props.customSummary.summaryTotalDataLabel : "";
|
|
17388
17393
|
}
|
|
@@ -17417,6 +17422,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17417
17422
|
var height = (_scrollable$clientHei = scrollable === null || scrollable === void 0 ? void 0 : scrollable.clientHeight) != null ? _scrollable$clientHei : 0;
|
|
17418
17423
|
var scrollHeight = (_scrollable$scrollHei = scrollable === null || scrollable === void 0 ? void 0 : scrollable.scrollHeight) != null ? _scrollable$scrollHei : 0;
|
|
17419
17424
|
var maxHeight = Math.max(top, height, scrollHeight) - 1;
|
|
17425
|
+
if (scrollHeight <= height) {
|
|
17426
|
+
return;
|
|
17427
|
+
}
|
|
17420
17428
|
var reachedBottom = Math.ceil(top + height) >= maxHeight;
|
|
17421
17429
|
var lastScrollTop = 0;
|
|
17422
17430
|
if (top < lastScrollTop) {
|
|
@@ -17446,7 +17454,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17446
17454
|
showBorders: true,
|
|
17447
17455
|
columnAutoWidth: false,
|
|
17448
17456
|
onEditorPreparing: onEditorPreparing,
|
|
17449
|
-
ref:
|
|
17457
|
+
ref: gridRef,
|
|
17450
17458
|
onExporting: onExporting,
|
|
17451
17459
|
height: props.height == undefined ? window.innerHeight - 164 : props.height,
|
|
17452
17460
|
allowColumnResizing: true,
|
|
@@ -17471,7 +17479,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17471
17479
|
},
|
|
17472
17480
|
onSelectionChanged: props.onSelectionChanged,
|
|
17473
17481
|
noDataText: props.noDataText,
|
|
17474
|
-
onSaved: props.onSaved
|
|
17482
|
+
onSaved: props.onSaved,
|
|
17483
|
+
onSaving: props.onSaving,
|
|
17484
|
+
onEditCanceling: props.onEditCanceling
|
|
17475
17485
|
}, columns.map(function (col) {
|
|
17476
17486
|
return React__default.createElement(DataGrid.Column, Object.assign({
|
|
17477
17487
|
key: col.dataField
|