ods-component-lib 1.16.0 → 1.16.3

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.
@@ -7,7 +7,7 @@ import 'react-phone-input-2/lib/style.css';
7
7
  import PhoneInput from 'react-phone-input-2';
8
8
  import message from 'antd/es/message';
9
9
  import Parser from 'html-react-parser';
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, LoadPanel } from 'devextreme-react/data-grid';
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, Summary, TotalItem, LoadPanel } from 'devextreme-react/data-grid';
11
11
  import { Item } from 'devextreme-react/form';
12
12
  import jsPDF from 'jspdf';
13
13
  import { exportDataGrid as exportDataGrid$1 } from 'devextreme/pdf_exporter';
@@ -1391,6 +1391,17 @@ function grid(props) {
1391
1391
  name: "exportButton"
1392
1392
  }), React.createElement(Item$1, {
1393
1393
  menuItemRender: renderMenuItem
1394
+ })), React.createElement(Summary, null, React.createElement(TotalItem, {
1395
+ column: "Id",
1396
+ summaryType: "count",
1397
+ displayFormat: "{0} Total Data"
1398
+ }), props.sumaryRowItems && props.sumaryRowItems.map(function (item) {
1399
+ return React.createElement(TotalItem, {
1400
+ column: item.columnName,
1401
+ summaryType: item.aggregateFn,
1402
+ valueFormat: item.valueFormat ? item.valueFormat : "",
1403
+ displayFormat: "Total: {0}"
1404
+ });
1394
1405
  })))));
1395
1406
  }
1396
1407
 
@@ -1407,6 +1418,32 @@ function grid$1(props) {
1407
1418
  className: "dx-datagrid-headers"
1408
1419
  }, colProperties.column.caption);
1409
1420
  };
1421
+ var fileName = props.exportFileName ? props.exportFileName + moment().format("YYYYMMDD") : "DatagridExportFile" + moment().format("YYYYMMDD");
1422
+ var onExporting = function onExporting(e) {
1423
+ if (e.format === 'excel') {
1424
+ var workbook = new Workbook();
1425
+ exportDataGrid({
1426
+ component: e.component,
1427
+ worksheet: workbook.addWorksheet('Main sheet'),
1428
+ autoFilterEnabled: true
1429
+ }).then(function () {
1430
+ workbook.xlsx.writeBuffer().then(function (buffer) {
1431
+ saveAs(new Blob([buffer], {
1432
+ type: 'application/octet-stream'
1433
+ }), fileName + '.xlsx');
1434
+ });
1435
+ });
1436
+ } else {
1437
+ var doc = new jsPDF();
1438
+ exportDataGrid$1({
1439
+ jsPDFDocument: doc,
1440
+ component: e.component,
1441
+ indent: 5
1442
+ }).then(function () {
1443
+ doc.save(fileName + '.pdf');
1444
+ });
1445
+ }
1446
+ };
1410
1447
  return React.createElement(React.Fragment, null, React.createElement(DataGrid, {
1411
1448
  dataSource: props.dataSource,
1412
1449
  columnAutoWidth: props.columnAutoWidth,
@@ -1416,6 +1453,7 @@ function grid$1(props) {
1416
1453
  allowColumnReordering: true,
1417
1454
  showRowLines: true,
1418
1455
  showBorders: true,
1456
+ onExporting: onExporting,
1419
1457
  width: "100%"
1420
1458
  }, React.createElement(Paging, {
1421
1459
  enabled: true,
@@ -1463,7 +1501,18 @@ function grid$1(props) {
1463
1501
  }, col, {
1464
1502
  headerCellRender: headerCellRender
1465
1503
  }), " ");
1466
- })));
1504
+ }), React.createElement(Summary, null, React.createElement(TotalItem, {
1505
+ column: "Id",
1506
+ summaryType: "count",
1507
+ displayFormat: "{0} Total Data"
1508
+ }), props.sumaryRowItems && props.sumaryRowItems.map(function (item) {
1509
+ return React.createElement(TotalItem, {
1510
+ column: item.columnName,
1511
+ summaryType: item.aggregateFn,
1512
+ valueFormat: item.valueFormat ? item.valueFormat : "",
1513
+ displayFormat: "Total: {0}"
1514
+ });
1515
+ }))));
1467
1516
  }
1468
1517
 
1469
1518
  var exportFormats$2 = ['xlsx', 'pdf'];