ods-component-lib 1.13.6 → 1.13.8
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
|
@@ -9,6 +9,12 @@ import message from 'antd/es/message';
|
|
|
9
9
|
import Parser from 'html-react-parser';
|
|
10
10
|
import { DataGrid, Paging, Pager, SearchPanel, FilterRow, HeaderFilter, ColumnChooser, Position, ColumnChooserSearch, ColumnChooserSelection, Selection, Editing, Popup, Form as Form$1, Scrolling, Export, Column, RequiredRule, Button as Button$1, Toolbar, Item as Item$1 } from 'devextreme-react/data-grid';
|
|
11
11
|
import { Item } from 'devextreme-react/form';
|
|
12
|
+
import jsPDF from 'jspdf';
|
|
13
|
+
import { exportDataGrid as exportDataGrid$1 } from 'devextreme/pdf_exporter';
|
|
14
|
+
import { exportDataGrid } from 'devextreme/excel_exporter';
|
|
15
|
+
import { Workbook } from 'exceljs';
|
|
16
|
+
import { saveAs } from 'file-saver-es';
|
|
17
|
+
import moment from 'moment';
|
|
12
18
|
import { TreeList } from 'devextreme-react';
|
|
13
19
|
import { TreeView } from 'devextreme-react/tree-view';
|
|
14
20
|
|
|
@@ -1195,6 +1201,32 @@ function grid(props) {
|
|
|
1195
1201
|
className: "dx-datagrid-headers"
|
|
1196
1202
|
}, colProperties.column.caption);
|
|
1197
1203
|
};
|
|
1204
|
+
var fileName = props.exportFileName ? props.exportFileName + moment().format("YYYYMMDD") : "DatagridExportFile" + moment().format("YYYYMMDD");
|
|
1205
|
+
var onExporting = React.useCallback(function (e) {
|
|
1206
|
+
if (e.format === 'excel') {
|
|
1207
|
+
var workbook = new Workbook();
|
|
1208
|
+
exportDataGrid({
|
|
1209
|
+
component: e.component,
|
|
1210
|
+
worksheet: workbook.addWorksheet('Main sheet'),
|
|
1211
|
+
autoFilterEnabled: true
|
|
1212
|
+
}).then(function () {
|
|
1213
|
+
workbook.xlsx.writeBuffer().then(function (buffer) {
|
|
1214
|
+
saveAs(new Blob([buffer], {
|
|
1215
|
+
type: 'application/octet-stream'
|
|
1216
|
+
}), fileName + '.xlsx');
|
|
1217
|
+
});
|
|
1218
|
+
});
|
|
1219
|
+
} else {
|
|
1220
|
+
var doc = new jsPDF();
|
|
1221
|
+
exportDataGrid$1({
|
|
1222
|
+
jsPDFDocument: doc,
|
|
1223
|
+
component: e.component,
|
|
1224
|
+
indent: 5
|
|
1225
|
+
}).then(function () {
|
|
1226
|
+
doc.save(fileName + '.pdf');
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
}, []);
|
|
1198
1230
|
return React.createElement(React.Fragment, null, React.createElement("div", {
|
|
1199
1231
|
className: "odsDatagrid",
|
|
1200
1232
|
style: {
|
|
@@ -1214,7 +1246,8 @@ function grid(props) {
|
|
|
1214
1246
|
showRowLines: true,
|
|
1215
1247
|
showBorders: true,
|
|
1216
1248
|
columnAutoWidth: false,
|
|
1217
|
-
onEditCanceling: props.onEditCanceling
|
|
1249
|
+
onEditCanceling: props.onEditCanceling,
|
|
1250
|
+
onExporting: onExporting
|
|
1218
1251
|
}, React.createElement(Paging, {
|
|
1219
1252
|
enabled: true,
|
|
1220
1253
|
defaultPageSize: props.pageSize
|
|
@@ -1285,6 +1318,17 @@ function grid(props) {
|
|
|
1285
1318
|
cellRender: col.dataField === 'IsActive' || col.dataField === 'Status' ? customizeBooleanColumnRender : ""
|
|
1286
1319
|
}), col.required && React.createElement(RequiredRule, {
|
|
1287
1320
|
message: col.requiredMessage
|
|
1321
|
+
}), col.dataField === 'IsActive' && React.createElement(HeaderFilter, {
|
|
1322
|
+
dataSource: [{
|
|
1323
|
+
text: 'All',
|
|
1324
|
+
value: null
|
|
1325
|
+
}, {
|
|
1326
|
+
text: 'Active',
|
|
1327
|
+
value: true
|
|
1328
|
+
}, {
|
|
1329
|
+
text: 'Passive',
|
|
1330
|
+
value: false
|
|
1331
|
+
}]
|
|
1288
1332
|
}));
|
|
1289
1333
|
}), function () {
|
|
1290
1334
|
if (props.customPopup !== undefined) {
|