ods-component-lib 1.18.16 → 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.
package/dist/index.modern.js
CHANGED
|
@@ -17124,7 +17124,6 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17124
17124
|
isLoading = _useState2[0],
|
|
17125
17125
|
setIsLoading = _useState2[1];
|
|
17126
17126
|
var fileName = props.exportFileName ? props.exportFileName + moment().format("YYYYMMDD") : "DatagridExportFile" + moment().format("YYYYMMDD");
|
|
17127
|
-
var gridRef = useRef(null);
|
|
17128
17127
|
var _useState3 = useState(0),
|
|
17129
17128
|
filteredRowCount = _useState3[0];
|
|
17130
17129
|
var _useState4 = useState(props.columns),
|
|
@@ -17141,6 +17140,11 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17141
17140
|
'Authorization': 'Bearer ' + (props.axiosRequest ? props.axiosRequest.token : ""),
|
|
17142
17141
|
"Accept-Language": props.language != "" ? props.language : 'EN'
|
|
17143
17142
|
});
|
|
17143
|
+
useEffect(function () {
|
|
17144
|
+
totalPageCount = 1;
|
|
17145
|
+
loadedPageCount = 1;
|
|
17146
|
+
totalRecordCount = 0;
|
|
17147
|
+
}, [props.dataGridRef.current]);
|
|
17144
17148
|
useEffect(function () {
|
|
17145
17149
|
var _props$axiosRequest;
|
|
17146
17150
|
if (props.axiosRequest !== undefined && Object.keys((_props$axiosRequest = props.axiosRequest) === null || _props$axiosRequest === void 0 ? void 0 : _props$axiosRequest.requestData).length > 0) {
|
|
@@ -17171,12 +17175,14 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17171
17175
|
setColumns(newColumns);
|
|
17172
17176
|
}
|
|
17173
17177
|
}, [props.columns]);
|
|
17178
|
+
useEffect(function () {
|
|
17179
|
+
if (Array.isArray(props.dataSource) && props.dataSource.length > 0) {
|
|
17180
|
+
setData(props.dataSource);
|
|
17181
|
+
}
|
|
17182
|
+
}, [props.dataSource]);
|
|
17174
17183
|
useEffect(function () {
|
|
17175
17184
|
locale(localStorage.getItem("locale"));
|
|
17176
17185
|
loadMessages(JSON.parse(localStorage.getItem("localTranslation")));
|
|
17177
|
-
if (gridRef.current) {
|
|
17178
|
-
gridRef.current.instance.updateDimensions();
|
|
17179
|
-
}
|
|
17180
17186
|
}, []);
|
|
17181
17187
|
var actionButtons = useMemo(function () {
|
|
17182
17188
|
if (props.actionButtonGroup) {
|
|
@@ -17200,11 +17206,6 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17200
17206
|
return [];
|
|
17201
17207
|
}
|
|
17202
17208
|
}, [props.actionButtonGroup]);
|
|
17203
|
-
var handleRef = function handleRef(instance) {
|
|
17204
|
-
if (instance) {
|
|
17205
|
-
gridRef.current = instance;
|
|
17206
|
-
}
|
|
17207
|
-
};
|
|
17208
17209
|
var fetchData = useCallback(function () {
|
|
17209
17210
|
try {
|
|
17210
17211
|
if (props.axiosRequest == undefined) return Promise.resolve();
|
|
@@ -17259,14 +17260,17 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17259
17260
|
if (e.row !== undefined && e.parentType === 'dataRow') {
|
|
17260
17261
|
if (props.isServerSide) {
|
|
17261
17262
|
var disableScrolling = function disableScrolling() {
|
|
17262
|
-
|
|
17263
|
+
props.dataGridRef.current.instance.option('scrolling.mode', 'none');
|
|
17263
17264
|
};
|
|
17264
17265
|
var enableScrolling = function enableScrolling() {
|
|
17265
|
-
|
|
17266
|
+
props.dataGridRef.current.instance.option('scrolling.mode', 'virtual');
|
|
17266
17267
|
};
|
|
17267
17268
|
e.editorOptions.onFocusIn = disableScrolling;
|
|
17268
17269
|
e.editorOptions.onFocusOut = enableScrolling;
|
|
17269
17270
|
}
|
|
17271
|
+
if (props.onEditorPreparing) {
|
|
17272
|
+
props.onEditorPreparing(e);
|
|
17273
|
+
}
|
|
17270
17274
|
}
|
|
17271
17275
|
if (e.editorOptions && e.rowType === 'data' && e.parentType === 'dataRow') {
|
|
17272
17276
|
e.editorOptions.onValueChanged = function (args) {
|
|
@@ -17365,7 +17369,7 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17365
17369
|
}, []);
|
|
17366
17370
|
var renderTotal = useCallback(function () {
|
|
17367
17371
|
var totalloaded = 0;
|
|
17368
|
-
if (data.length < 50) {
|
|
17372
|
+
if (data.length < 50 || !props.isServerSide || loadedPageCount == totalPageCount) {
|
|
17369
17373
|
totalloaded = data.length;
|
|
17370
17374
|
} else {
|
|
17371
17375
|
totalloaded = loadedPageCount * props.pageSize;
|
|
@@ -17373,6 +17377,8 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17373
17377
|
var result = "";
|
|
17374
17378
|
if (filteredRowCount > 0) {
|
|
17375
17379
|
result = "" + totalloaded + props.customSummary.summaryFilteredDataLabel + (totalRecordCount > 0 ? totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalRecordCount) + props.customSummary.summaryTotalDataLabel : " ");
|
|
17380
|
+
} else if (!props.isServerSide && totalloaded > 0) {
|
|
17381
|
+
result = totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalloaded) + props.customSummary.summaryTotalDataLabel;
|
|
17376
17382
|
} else {
|
|
17377
17383
|
result = totalRecordCount > 0 ? totalloaded + " " + props.customSummary.summaryLoadedDataLabel + ("- " + totalRecordCount) + props.customSummary.summaryTotalDataLabel : "";
|
|
17378
17384
|
}
|
|
@@ -17432,11 +17438,11 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17432
17438
|
}, [data.length]);
|
|
17433
17439
|
return React.createElement(React.Fragment, null, React.createElement(DataGrid$1, {
|
|
17434
17440
|
keyExpr: props.keyExpr,
|
|
17435
|
-
dataSource:
|
|
17441
|
+
dataSource: data,
|
|
17436
17442
|
showBorders: true,
|
|
17437
17443
|
columnAutoWidth: false,
|
|
17438
17444
|
onEditorPreparing: onEditorPreparing,
|
|
17439
|
-
ref:
|
|
17445
|
+
ref: props.dataGridRef,
|
|
17440
17446
|
onExporting: onExporting,
|
|
17441
17447
|
height: props.height == undefined ? window.innerHeight - 164 : props.height,
|
|
17442
17448
|
allowColumnResizing: true,
|
|
@@ -17461,7 +17467,9 @@ var OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
|
|
|
17461
17467
|
},
|
|
17462
17468
|
onSelectionChanged: props.onSelectionChanged,
|
|
17463
17469
|
noDataText: props.noDataText,
|
|
17464
|
-
onSaved: props.onSaved
|
|
17470
|
+
onSaved: props.onSaved,
|
|
17471
|
+
onSaving: props.onSaving,
|
|
17472
|
+
onEditCanceling: props.onEditCanceling
|
|
17465
17473
|
}, columns.map(function (col) {
|
|
17466
17474
|
return React.createElement(Column, Object.assign({
|
|
17467
17475
|
key: col.dataField
|