ods-component-lib 1.18.17 → 1.18.18
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
|
-
import React from 'react';
|
|
1
|
+
import React, { MutableRefObject } 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
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,7 +17129,6 @@ 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),
|
|
@@ -17146,6 +17145,11 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17146
17145
|
'Authorization': 'Bearer ' + (props.axiosRequest ? props.axiosRequest.token : ""),
|
|
17147
17146
|
"Accept-Language": props.language != "" ? props.language : 'EN'
|
|
17148
17147
|
});
|
|
17148
|
+
React.useEffect(function () {
|
|
17149
|
+
totalPageCount = 1;
|
|
17150
|
+
loadedPageCount = 1;
|
|
17151
|
+
totalRecordCount = 0;
|
|
17152
|
+
}, [props.dataGridRef.current]);
|
|
17149
17153
|
React.useEffect(function () {
|
|
17150
17154
|
var _props$axiosRequest;
|
|
17151
17155
|
if (props.axiosRequest !== undefined && Object.keys((_props$axiosRequest = props.axiosRequest) === null || _props$axiosRequest === void 0 ? void 0 : _props$axiosRequest.requestData).length > 0) {
|
|
@@ -17184,9 +17188,6 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17184
17188
|
React.useEffect(function () {
|
|
17185
17189
|
localization.locale(localStorage.getItem("locale"));
|
|
17186
17190
|
localization.loadMessages(JSON.parse(localStorage.getItem("localTranslation")));
|
|
17187
|
-
if (gridRef.current) {
|
|
17188
|
-
gridRef.current.instance.updateDimensions();
|
|
17189
|
-
}
|
|
17190
17191
|
}, []);
|
|
17191
17192
|
var actionButtons = React.useMemo(function () {
|
|
17192
17193
|
if (props.actionButtonGroup) {
|
|
@@ -17210,11 +17211,6 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17210
17211
|
return [];
|
|
17211
17212
|
}
|
|
17212
17213
|
}, [props.actionButtonGroup]);
|
|
17213
|
-
var handleRef = function handleRef(instance) {
|
|
17214
|
-
if (instance) {
|
|
17215
|
-
gridRef.current = instance;
|
|
17216
|
-
}
|
|
17217
|
-
};
|
|
17218
17214
|
var fetchData = React.useCallback(function () {
|
|
17219
17215
|
try {
|
|
17220
17216
|
if (props.axiosRequest == undefined) return Promise.resolve();
|
|
@@ -17269,14 +17265,17 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17269
17265
|
if (e.row !== undefined && e.parentType === 'dataRow') {
|
|
17270
17266
|
if (props.isServerSide) {
|
|
17271
17267
|
var disableScrolling = function disableScrolling() {
|
|
17272
|
-
|
|
17268
|
+
props.dataGridRef.current.instance.option('scrolling.mode', 'none');
|
|
17273
17269
|
};
|
|
17274
17270
|
var enableScrolling = function enableScrolling() {
|
|
17275
|
-
|
|
17271
|
+
props.dataGridRef.current.instance.option('scrolling.mode', 'virtual');
|
|
17276
17272
|
};
|
|
17277
17273
|
e.editorOptions.onFocusIn = disableScrolling;
|
|
17278
17274
|
e.editorOptions.onFocusOut = enableScrolling;
|
|
17279
17275
|
}
|
|
17276
|
+
if (props.onEditorPreparing) {
|
|
17277
|
+
props.onEditorPreparing(e);
|
|
17278
|
+
}
|
|
17280
17279
|
}
|
|
17281
17280
|
if (e.editorOptions && e.rowType === 'data' && e.parentType === 'dataRow') {
|
|
17282
17281
|
e.editorOptions.onValueChanged = function (args) {
|
|
@@ -17375,7 +17374,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17375
17374
|
}, []);
|
|
17376
17375
|
var renderTotal = React.useCallback(function () {
|
|
17377
17376
|
var totalloaded = 0;
|
|
17378
|
-
if (data.length < 50) {
|
|
17377
|
+
if (data.length < 50 || !props.isServerSide || loadedPageCount == totalPageCount) {
|
|
17379
17378
|
totalloaded = data.length;
|
|
17380
17379
|
} else {
|
|
17381
17380
|
totalloaded = loadedPageCount * props.pageSize;
|
|
@@ -17383,6 +17382,8 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17383
17382
|
var result = "";
|
|
17384
17383
|
if (filteredRowCount > 0) {
|
|
17385
17384
|
result = "" + totalloaded + props.customSummary.summaryFilteredDataLabel + (totalRecordCount > 0 ? totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalRecordCount) + props.customSummary.summaryTotalDataLabel : " ");
|
|
17385
|
+
} else if (!props.isServerSide && totalloaded > 0) {
|
|
17386
|
+
result = totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalloaded) + props.customSummary.summaryTotalDataLabel;
|
|
17386
17387
|
} else {
|
|
17387
17388
|
result = totalRecordCount > 0 ? totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalRecordCount) + props.customSummary.summaryTotalDataLabel : "";
|
|
17388
17389
|
}
|
|
@@ -17446,7 +17447,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17446
17447
|
showBorders: true,
|
|
17447
17448
|
columnAutoWidth: false,
|
|
17448
17449
|
onEditorPreparing: onEditorPreparing,
|
|
17449
|
-
ref:
|
|
17450
|
+
ref: props.dataGridRef,
|
|
17450
17451
|
onExporting: onExporting,
|
|
17451
17452
|
height: props.height == undefined ? window.innerHeight - 164 : props.height,
|
|
17452
17453
|
allowColumnResizing: true,
|
|
@@ -17471,7 +17472,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17471
17472
|
},
|
|
17472
17473
|
onSelectionChanged: props.onSelectionChanged,
|
|
17473
17474
|
noDataText: props.noDataText,
|
|
17474
|
-
onSaved: props.onSaved
|
|
17475
|
+
onSaved: props.onSaved,
|
|
17476
|
+
onSaving: props.onSaving,
|
|
17477
|
+
onEditCanceling: props.onEditCanceling
|
|
17475
17478
|
}, columns.map(function (col) {
|
|
17476
17479
|
return React__default.createElement(DataGrid.Column, Object.assign({
|
|
17477
17480
|
key: col.dataField
|