ods-component-lib 1.18.137 → 1.18.138

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.js CHANGED
@@ -33416,56 +33416,59 @@ var ExportDataGridToExcel = function ExportDataGridToExcel(_ref) {
33416
33416
  baseFileName = _ref.baseFileName,
33417
33417
  selectedText = _ref.selectedText,
33418
33418
  getSummary = _ref.getSummary,
33419
- selectedRowsOnly = _ref.selectedRowsOnly,
33420
- data = _ref.data;
33419
+ selectedRowsOnly = _ref.selectedRowsOnly;
33421
33420
  var workbook = new exceljs.Workbook();
33422
33421
  var worksheet = workbook.addWorksheet('Main Sheet');
33423
- var dataSource = data;
33424
- var headers = gridComponent.option('columns').map(function (col) {
33425
- return col.dataField;
33426
- });
33427
- var q = worksheet.addRow(gridComponent.option('columns').map(function (col) {
33428
- return col.caption;
33429
- }));
33430
- q.font = {
33431
- name: 'Arial',
33432
- size: 12
33433
- };
33434
- q.alignment = {
33435
- horizontal: 'left'
33436
- };
33437
- dataSource.forEach(function (item) {
33438
- var row = [];
33439
- headers.forEach(function (header) {
33440
- var value = item[header];
33441
- if (value instanceof Date) {
33442
- var formattedDate = moment(value).format("DD.MM.YYYY HH:mm [UTC]Z");
33443
- row.push(formattedDate);
33444
- } else {
33445
- row.push(value);
33422
+ var lastProcessedRowData = null;
33423
+ var rowCount = 0;
33424
+ excel_exporter.exportDataGrid({
33425
+ component: gridComponent,
33426
+ worksheet: worksheet,
33427
+ selectedRowsOnly: selectedRowsOnly,
33428
+ customizeCell: function customizeCell(options) {
33429
+ var gridCell = options.gridCell,
33430
+ excelCell = options.excelCell;
33431
+ if (gridCell && excelCell) {
33432
+ if (gridCell.rowType === 'data' && lastProcessedRowData !== gridCell.data) {
33433
+ rowCount++;
33434
+ lastProcessedRowData = gridCell.data;
33435
+ }
33436
+ if (gridCell.column.dataType === "datetime" && gridCell.value) {
33437
+ var date = moment(gridCell.value);
33438
+ var formattedDate = date.format("DD.MM.YYYY HH:mm [UTC]Z");
33439
+ excelCell.value = formattedDate;
33440
+ } else {
33441
+ excelCell.font = {
33442
+ name: 'Arial',
33443
+ size: 12
33444
+ };
33445
+ excelCell.alignment = {
33446
+ horizontal: 'left'
33447
+ };
33448
+ }
33446
33449
  }
33450
+ }
33451
+ }).then(function () {
33452
+ var summaryResult = getSummary();
33453
+ var summaryText = selectedRowsOnly ? summaryResult + " - " + rowCount + " " + selectedText : summaryResult;
33454
+ var lastRow = worksheet.addRow([summaryText]);
33455
+ lastRow.font = {
33456
+ name: 'Arial',
33457
+ size: 10,
33458
+ bold: true
33459
+ };
33460
+ lastRow.alignment = {
33461
+ horizontal: 'left'
33462
+ };
33463
+ workbook.xlsx.writeBuffer().then(function (buffer) {
33464
+ var now = new Date();
33465
+ var datePart = ('0' + now.getDate()).slice(-2) + "-" + ('0' + (now.getMonth() + 1)).slice(-2) + "-" + now.getFullYear();
33466
+ var timePart = ('0' + now.getHours()).slice(-2) + ":" + ('0' + now.getMinutes()).slice(-2);
33467
+ var fullFileName = baseFileName + "-" + datePart + "-" + timePart + ".xlsx";
33468
+ FileSaver.saveAs(new Blob([buffer], {
33469
+ type: 'application/octet-stream'
33470
+ }), fullFileName);
33447
33471
  });
33448
- worksheet.addRow(row);
33449
- });
33450
- var summaryResult = getSummary();
33451
- var summaryText = selectedRowsOnly ? summaryResult + " - " + dataSource.length + " " + selectedText : summaryResult;
33452
- var lastRow = worksheet.addRow([summaryText]);
33453
- lastRow.font = {
33454
- name: 'Arial',
33455
- size: 10,
33456
- bold: true
33457
- };
33458
- lastRow.alignment = {
33459
- horizontal: 'left'
33460
- };
33461
- workbook.xlsx.writeBuffer().then(function (buffer) {
33462
- var now = new Date();
33463
- var datePart = ('0' + now.getDate()).slice(-2) + "-" + ('0' + (now.getMonth() + 1)).slice(-2) + "-" + now.getFullYear();
33464
- var timePart = ('0' + now.getHours()).slice(-2) + ":" + ('0' + now.getMinutes()).slice(-2);
33465
- var fullFileName = baseFileName + "-" + datePart + "-" + timePart + ".xlsx";
33466
- FileSaver.saveAs(new Blob([buffer], {
33467
- type: 'application/octet-stream'
33468
- }), fullFileName);
33469
33472
  });
33470
33473
  };
33471
33474
 
@@ -33525,7 +33528,7 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
33525
33528
  var _useState11 = React.useState(0),
33526
33529
  scrollPosition = _useState11[0],
33527
33530
  setScrollPosition = _useState11[1];
33528
- var _useState12 = React.useState(false),
33531
+ var _useState12 = React.useState(true),
33529
33532
  filteredButtonCheck = _useState12[0],
33530
33533
  setFilteredButtonCheck = _useState12[1];
33531
33534
  var _useStyles = useStyles(),
@@ -33763,8 +33766,8 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
33763
33766
  };
33764
33767
  var actionButtons = React.useMemo(function () {
33765
33768
  if (props.actionButtonGroup) {
33766
- if (props.actionButtonGroup.length >= 2 && !props.edit) {
33767
- return props.actionButtonGroup.slice(0, 2);
33769
+ if (props.actionButtonGroup.length >= 3 && !props.edit) {
33770
+ return props.actionButtonGroup.slice(0, 3);
33768
33771
  } else {
33769
33772
  return props.actionButtonGroup;
33770
33773
  }
@@ -33845,7 +33848,7 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
33845
33848
  return result;
33846
33849
  }, [data, filteredRowCount, constants.loadedPageCount, props.pageSize, constants.totalRecordCount, filterApplied.current]);
33847
33850
  function actionCellRender(cellData, props) {
33848
- var kebabMenuButtons = props.actionButtonGroup && props.actionButtonGroup.length >= 2 && !props.edit ? props.actionButtonGroup.slice(2).map(function (button) {
33851
+ var kebabMenuButtons = props.actionButtonGroup && props.actionButtonGroup.length >= 3 && !props.edit ? props.actionButtonGroup.slice(3).map(function (button) {
33849
33852
  return {
33850
33853
  icon: button.icon,
33851
33854
  onClick: function onClick(event) {
@@ -33972,7 +33975,9 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
33972
33975
  }
33973
33976
  };
33974
33977
  var onCustomCellClick = function onCustomCellClick(e) {
33975
- e.cellElement.style.backgroundColor = "transparent";
33978
+ if (e.rowType != 'header') {
33979
+ e.cellElement.style.backgroundColor = "transparent";
33980
+ }
33976
33981
  if (hasFastUpdate) {
33977
33982
  if (checkCellSelectionConstraints(e) && constants.allowedDataTypesForMultiCellEditing.some(function (item) {
33978
33983
  return item.toLocaleLowerCase() == e.column.dataType.toLocaleLowerCase();
@@ -34166,10 +34171,14 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
34166
34171
  columnResizingMode: (_props$columnResizing = props.columnResizingMode) != null ? _props$columnResizing : "widget",
34167
34172
  showRowLines: true,
34168
34173
  allowColumnReordering: true,
34174
+ scrolling: {
34175
+ useNative: true
34176
+ },
34169
34177
  remoteOperations: false,
34170
34178
  paging: {
34171
34179
  enabled: false
34172
34180
  },
34181
+ width: "100%",
34173
34182
  repaintChangesOnly: true,
34174
34183
  focusedRowEnabled: false,
34175
34184
  filterSyncEnabled: true,
@@ -34186,8 +34195,7 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
34186
34195
  baseFileName: props.exportProps.fileName,
34187
34196
  selectedText: props.exportProps.selectedText,
34188
34197
  getSummary: renderTotal,
34189
- selectedRowsOnly: e.selectedRowsOnly,
34190
- data: data
34198
+ selectedRowsOnly: e.selectedRowsOnly
34191
34199
  });
34192
34200
  },
34193
34201
  onRowClick: props.onRowClick,
@@ -34275,7 +34283,11 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
34275
34283
  showNavigationButtons: false,
34276
34284
  showInfo: false
34277
34285
  }), React__default.createElement(DataGrid.Scrolling, {
34278
- mode: "infinite"
34286
+ showScrollbar: "always",
34287
+ scrollByContent: true,
34288
+ scrollByThumb: true,
34289
+ mode: "virtual",
34290
+ rowRenderingMode: "virtual"
34279
34291
  }), React__default.createElement(DataGrid.SearchPanel, {
34280
34292
  visible: true
34281
34293
  }), React__default.createElement(DataGrid.FilterRow, {
@@ -35324,8 +35336,7 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
35324
35336
  baseFileName: props.exportProps.fileName,
35325
35337
  selectedText: props.exportProps.selectedText,
35326
35338
  getSummary: renderTotal,
35327
- selectedRowsOnly: e.selectedRowsOnly,
35328
- data: headerFilterData
35339
+ selectedRowsOnly: e.selectedRowsOnly
35329
35340
  });
35330
35341
  },
35331
35342
  onContentReady: handleContentReady,