ods-component-lib 1.20.3 → 1.20.5

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.
@@ -34074,7 +34074,8 @@ var ExportDataGridToExcel = function ExportDataGridToExcel(_ref) {
34074
34074
  getSummary = _ref.getSummary,
34075
34075
  selectedRowsOnly = _ref.selectedRowsOnly,
34076
34076
  activeText = _ref.activeText,
34077
- passiveText = _ref.passiveText;
34077
+ passiveText = _ref.passiveText,
34078
+ filterData = _ref.filterData;
34078
34079
  var workbook = new Workbook();
34079
34080
  var worksheet = workbook.addWorksheet('Main Sheet');
34080
34081
  var lastProcessedRowData = null;
@@ -34109,6 +34110,58 @@ var ExportDataGridToExcel = function ExportDataGridToExcel(_ref) {
34109
34110
  }
34110
34111
  }
34111
34112
  }).then(function () {
34113
+ if (Array.isArray(filterData) && filterData.length > 0) {
34114
+ var validFilters = filterData.filter(function (f) {
34115
+ if (f.value === undefined || f.value === null) return false;
34116
+ if (Array.isArray(f.value) && f.value.length === 0) return false;
34117
+ if (typeof f.value === "string" && f.value.trim() === "") return false;
34118
+ return true;
34119
+ });
34120
+ if (validFilters.length > 0) {
34121
+ var headerRow = worksheet.getRow(1);
34122
+ var lastColumnIndex = headerRow.cellCount;
34123
+ validFilters.forEach(function (filter, index) {
34124
+ var columnIndex = lastColumnIndex + index + 1;
34125
+ var headerCell = headerRow.getCell(columnIndex);
34126
+ headerCell.value = filter.Label;
34127
+ headerCell.font = {
34128
+ name: "Arial",
34129
+ size: 12,
34130
+ bold: true
34131
+ };
34132
+ headerCell.fill = {
34133
+ type: "pattern",
34134
+ pattern: "solid",
34135
+ fgColor: {
34136
+ argb: "FFCCCCCC"
34137
+ }
34138
+ };
34139
+ headerCell.alignment = {
34140
+ horizontal: "left"
34141
+ };
34142
+ });
34143
+ var totalRows = worksheet.rowCount;
34144
+ var _loop = function _loop() {
34145
+ var row = worksheet.getRow(rowIndex);
34146
+ validFilters.forEach(function (filter, index) {
34147
+ var columnIndex = lastColumnIndex + index + 1;
34148
+ var cell = row.getCell(columnIndex);
34149
+ var displayValue = Array.isArray(filter.value) ? filter.value.join(", ") : filter.value;
34150
+ cell.value = displayValue;
34151
+ cell.font = {
34152
+ name: "Arial",
34153
+ size: 12
34154
+ };
34155
+ cell.alignment = {
34156
+ horizontal: "left"
34157
+ };
34158
+ });
34159
+ };
34160
+ for (var rowIndex = 2; rowIndex <= totalRows; rowIndex++) {
34161
+ _loop();
34162
+ }
34163
+ }
34164
+ }
34112
34165
  var summaryResult = getSummary();
34113
34166
  var summaryText = selectedRowsOnly ? summaryResult + " - " + rowCount + " " + selectedText : summaryResult;
34114
34167
  var lastRow = worksheet.addRow([summaryText]);
@@ -34132,6 +34185,70 @@ var ExportDataGridToExcel = function ExportDataGridToExcel(_ref) {
34132
34185
  });
34133
34186
  };
34134
34187
 
34188
+ var uniqueRecords = function uniqueRecords(value, index, array) {
34189
+ return array.indexOf(value) === index;
34190
+ };
34191
+ var exportToExcel = function exportToExcel(props) {
34192
+ var workbook = new Workbook();
34193
+ var worksheet = workbook.addWorksheet('Main Sheet');
34194
+ var lastProcessedRowData = null;
34195
+ var rowCount = 0;
34196
+ exportDataGrid({
34197
+ component: props.gridComponent,
34198
+ worksheet: worksheet,
34199
+ selectedRowsOnly: props.selectedRowsOnly,
34200
+ customizeCell: function customizeCell(options) {
34201
+ var gridCell = options.gridCell,
34202
+ excelCell = options.excelCell;
34203
+ if (gridCell && excelCell) {
34204
+ if (gridCell.rowType === 'data' && lastProcessedRowData !== gridCell.data) {
34205
+ rowCount++;
34206
+ lastProcessedRowData = gridCell.data;
34207
+ }
34208
+ if ((gridCell.column.dataType === "datetime" || gridCell.column.dataField === "CreateDate" || gridCell.column.dataField === "ModifyDate") && gridCell.value) {
34209
+ excelCell.value = moment(gridCell.value).format("DD.MM.YYYY HH:mm");
34210
+ } else if (gridCell.column.dataType === "date" && gridCell.value) {
34211
+ excelCell.value = moment(gridCell.value).format("DD.MM.YYYY");
34212
+ }
34213
+ if (gridCell.rowType === 'data' && gridCell.column.dataField.toLowerCase() === "isactive") {
34214
+ excelCell.value = gridCell.value === true ? "" + props.activeText : "" + props.passiveText;
34215
+ }
34216
+ excelCell.font = {
34217
+ name: 'Arial',
34218
+ size: 12
34219
+ };
34220
+ excelCell.alignment = {
34221
+ horizontal: 'left'
34222
+ };
34223
+ }
34224
+ }
34225
+ }).then(function () {
34226
+ var summaryResult = props.getSummary();
34227
+ var summaryText = props.selectedRowsOnly ? summaryResult + " - " + rowCount + " " + props.selectedText : summaryResult;
34228
+ var lastRow = worksheet.addRow([summaryText]);
34229
+ lastRow.font = {
34230
+ name: 'Arial',
34231
+ size: 10,
34232
+ bold: true
34233
+ };
34234
+ lastRow.alignment = {
34235
+ horizontal: 'left'
34236
+ };
34237
+ workbook.xlsx.writeBuffer().then(function (buffer) {
34238
+ var now = new Date();
34239
+ var datePart = ('0' + now.getDate()).slice(-2) + "-" + ('0' + (now.getMonth() + 1)).slice(-2) + "-" + now.getFullYear();
34240
+ var timePart = ('0' + now.getHours()).slice(-2) + ":" + ('0' + now.getMinutes()).slice(-2);
34241
+ var fullFileName = props.baseFileName + "-" + datePart + "-" + timePart + ".xlsx";
34242
+ saveAs(new Blob([buffer], {
34243
+ type: 'application/octet-stream'
34244
+ }), fullFileName);
34245
+ });
34246
+ });
34247
+ };
34248
+ var isTextEmpty = function isTextEmpty(text) {
34249
+ return text === undefined || text === null || (text === null || text === void 0 ? void 0 : text.trim()) === '';
34250
+ };
34251
+
34135
34252
  var useToken = theme.useToken;
34136
34253
  var OdsBatchEditDataGrid = function OdsBatchEditDataGrid(props) {
34137
34254
  var _props$columnResizing, _props$className, _props$selection, _props$selectOptions, _props$selectOptions$, _props$selectOptions2, _props$selectOptions$2, _props$selectOptions3;
@@ -34516,23 +34633,25 @@ var OdsBatchEditDataGrid = function OdsBatchEditDataGrid(props) {
34516
34633
  }
34517
34634
  });
34518
34635
  }
34519
- e.toolbarOptions.items.unshift({
34520
- location: "before",
34521
- cssClass: "toolbarTitleItem",
34522
- template: function template(_, __, container) {
34523
- var wrapper = document.createElement("div");
34524
- container.appendChild(wrapper);
34525
- reactDom.render(React.createElement(React.StrictMode, null, React.createElement(OdsTitle, {
34526
- level: 5,
34527
- style: {
34528
- display: "flex",
34529
- alignItems: "center",
34530
- alignSelf: "stretch",
34531
- margin: 0
34532
- }
34533
- }, props.pageTitle)), wrapper);
34534
- }
34535
- });
34636
+ if (!isTextEmpty(props.pageTitle)) {
34637
+ e.toolbarOptions.items.unshift({
34638
+ location: "before",
34639
+ cssClass: "toolbarTitleItem",
34640
+ template: function template(_, __, container) {
34641
+ var wrapper = document.createElement("div");
34642
+ container.appendChild(wrapper);
34643
+ reactDom.render(React.createElement(React.StrictMode, null, React.createElement(OdsTitle, {
34644
+ level: 5,
34645
+ style: {
34646
+ display: "flex",
34647
+ alignItems: "center",
34648
+ alignSelf: "stretch",
34649
+ margin: 0
34650
+ }
34651
+ }, props.pageTitle)), wrapper);
34652
+ }
34653
+ });
34654
+ }
34536
34655
  };
34537
34656
  var checkIsPropArray = function checkIsPropArray(prop) {
34538
34657
  return prop && Array.isArray(prop);
@@ -35546,23 +35665,25 @@ var OdsBasicDataGrid = function OdsBasicDataGrid(props) {
35546
35665
  }
35547
35666
  });
35548
35667
  }
35549
- e.toolbarOptions.items.unshift({
35550
- location: "before",
35551
- cssClass: "toolbarTitleItem",
35552
- template: function template(_, __, container) {
35553
- var wrapper = document.createElement("div");
35554
- container.appendChild(wrapper);
35555
- reactDom.render(React.createElement(React.StrictMode, null, React.createElement(OdsTitle, {
35556
- level: 5,
35557
- style: {
35558
- display: "flex",
35559
- alignItems: "center",
35560
- alignSelf: "stretch",
35561
- margin: 0
35562
- }
35563
- }, props.pageTitle)), wrapper);
35564
- }
35565
- });
35668
+ if (!isTextEmpty(props.pageTitle)) {
35669
+ e.toolbarOptions.items.unshift({
35670
+ location: "before",
35671
+ cssClass: "toolbarTitleItem",
35672
+ template: function template(_, __, container) {
35673
+ var wrapper = document.createElement("div");
35674
+ container.appendChild(wrapper);
35675
+ reactDom.render(React.createElement(React.StrictMode, null, React.createElement(OdsTitle, {
35676
+ level: 5,
35677
+ style: {
35678
+ display: "flex",
35679
+ alignItems: "center",
35680
+ alignSelf: "stretch",
35681
+ margin: 0
35682
+ }
35683
+ }, props.pageTitle)), wrapper);
35684
+ }
35685
+ });
35686
+ }
35566
35687
  };
35567
35688
  var renderMasterDetailGrid = useCallback(function (_ref) {
35568
35689
  var _dataSource$data, _dataSource$data2;
@@ -54308,24 +54429,26 @@ var OdsMergeCellDataGrid = forwardRef(function (props, ref) {
54308
54429
  }
54309
54430
  });
54310
54431
  }
54311
- e.toolbarOptions.items.unshift({
54312
- location: "before",
54313
- cssClass: "toolbarTitleItem",
54314
- template: function template(_, __, container) {
54315
- var wrapper = document.createElement("div");
54316
- container.appendChild(wrapper);
54317
- var root = client_1(wrapper);
54318
- root.render(React.createElement(React.StrictMode, null, React.createElement(OdsTitle, {
54319
- level: 5,
54320
- style: {
54321
- display: "flex",
54322
- alignItems: "center",
54323
- alignSelf: "stretch",
54324
- margin: 0
54325
- }
54326
- }, props.pageTitle)));
54327
- }
54328
- });
54432
+ if (!isTextEmpty(props.pageTitle)) {
54433
+ e.toolbarOptions.items.unshift({
54434
+ location: "before",
54435
+ cssClass: "toolbarTitleItem",
54436
+ template: function template(_, __, container) {
54437
+ var wrapper = document.createElement("div");
54438
+ container.appendChild(wrapper);
54439
+ var root = client_1(wrapper);
54440
+ root.render(React.createElement(React.StrictMode, null, React.createElement(OdsTitle, {
54441
+ level: 5,
54442
+ style: {
54443
+ display: "flex",
54444
+ alignItems: "center",
54445
+ alignSelf: "stretch",
54446
+ margin: 0
54447
+ }
54448
+ }, props.pageTitle)));
54449
+ }
54450
+ });
54451
+ }
54329
54452
  };
54330
54453
  var handleSelectionChanged = function handleSelectionChanged(e) {
54331
54454
  var triggerEvent = true;
@@ -54374,7 +54497,7 @@ var OdsMergeCellDataGrid = forwardRef(function (props, ref) {
54374
54497
  };
54375
54498
  var handleExporting = function handleExporting(e) {
54376
54499
  if (!props.closeGridHeader) {
54377
- var _props$exportProps$ac, _props$exportProps$pa;
54500
+ var _props$exportProps$ac, _props$exportProps$pa, _props$filterData;
54378
54501
  ExportDataGridToExcel({
54379
54502
  gridComponent: e.component,
54380
54503
  baseFileName: props.exportProps.fileName,
@@ -54384,7 +54507,8 @@ var OdsMergeCellDataGrid = forwardRef(function (props, ref) {
54384
54507
  },
54385
54508
  selectedRowsOnly: e.selectedRowsOnly,
54386
54509
  activeText: (_props$exportProps$ac = props.exportProps.activeText) != null ? _props$exportProps$ac : "Active",
54387
- passiveText: (_props$exportProps$pa = props.exportProps.passiveText) != null ? _props$exportProps$pa : "Passive"
54510
+ passiveText: (_props$exportProps$pa = props.exportProps.passiveText) != null ? _props$exportProps$pa : "Passive",
54511
+ filterData: (_props$filterData = props.filterData) != null ? _props$filterData : undefined
54388
54512
  });
54389
54513
  }
54390
54514
  };
@@ -55716,23 +55840,25 @@ var _OdsRemoteDataGrid = function OdsRemoteDataGrid(props) {
55716
55840
  }
55717
55841
  });
55718
55842
  }
55719
- e.toolbarOptions.items.unshift({
55720
- location: 'before',
55721
- cssClass: 'toolbarTitleItem',
55722
- template: function template(_, __, container) {
55723
- var wrapper = document.createElement('div');
55724
- container.appendChild(wrapper);
55725
- reactDom.render(React.createElement(React.StrictMode, null, React.createElement(OdsTitle, {
55726
- level: 5,
55727
- style: {
55728
- display: "flex",
55729
- alignItems: "center",
55730
- alignSelf: "stretch",
55731
- margin: 0
55732
- }
55733
- }, props.pageTitle)), wrapper);
55734
- }
55735
- });
55843
+ if (!isTextEmpty(props.pageTitle)) {
55844
+ e.toolbarOptions.items.unshift({
55845
+ location: 'before',
55846
+ cssClass: 'toolbarTitleItem',
55847
+ template: function template(_, __, container) {
55848
+ var wrapper = document.createElement('div');
55849
+ container.appendChild(wrapper);
55850
+ reactDom.render(React.createElement(React.StrictMode, null, React.createElement(OdsTitle, {
55851
+ level: 5,
55852
+ style: {
55853
+ display: "flex",
55854
+ alignItems: "center",
55855
+ alignSelf: "stretch",
55856
+ margin: 0
55857
+ }
55858
+ }, props.pageTitle)), wrapper);
55859
+ }
55860
+ });
55861
+ }
55736
55862
  };
55737
55863
  var detailGrid = function detailGrid(_ref) {
55738
55864
  var data = _ref.data;
@@ -56333,67 +56459,6 @@ var OdsServerSideDatagrid = function OdsServerSideDatagrid(props) {
56333
56459
  }, React.createElement("p", null, renderTotal())));
56334
56460
  };
56335
56461
 
56336
- var uniqueRecords = function uniqueRecords(value, index, array) {
56337
- return array.indexOf(value) === index;
56338
- };
56339
- var exportToExcel = function exportToExcel(props) {
56340
- var workbook = new Workbook();
56341
- var worksheet = workbook.addWorksheet('Main Sheet');
56342
- var lastProcessedRowData = null;
56343
- var rowCount = 0;
56344
- exportDataGrid({
56345
- component: props.gridComponent,
56346
- worksheet: worksheet,
56347
- selectedRowsOnly: props.selectedRowsOnly,
56348
- customizeCell: function customizeCell(options) {
56349
- var gridCell = options.gridCell,
56350
- excelCell = options.excelCell;
56351
- if (gridCell && excelCell) {
56352
- if (gridCell.rowType === 'data' && lastProcessedRowData !== gridCell.data) {
56353
- rowCount++;
56354
- lastProcessedRowData = gridCell.data;
56355
- }
56356
- if ((gridCell.column.dataType === "datetime" || gridCell.column.dataField === "CreateDate" || gridCell.column.dataField === "ModifyDate") && gridCell.value) {
56357
- excelCell.value = moment(gridCell.value).format("DD.MM.YYYY HH:mm");
56358
- } else if (gridCell.column.dataType === "date" && gridCell.value) {
56359
- excelCell.value = moment(gridCell.value).format("DD.MM.YYYY");
56360
- }
56361
- if (gridCell.rowType === 'data' && gridCell.column.dataField.toLowerCase() === "isactive") {
56362
- excelCell.value = gridCell.value === true ? "" + props.activeText : "" + props.passiveText;
56363
- }
56364
- excelCell.font = {
56365
- name: 'Arial',
56366
- size: 12
56367
- };
56368
- excelCell.alignment = {
56369
- horizontal: 'left'
56370
- };
56371
- }
56372
- }
56373
- }).then(function () {
56374
- var summaryResult = props.getSummary();
56375
- var summaryText = props.selectedRowsOnly ? summaryResult + " - " + rowCount + " " + props.selectedText : summaryResult;
56376
- var lastRow = worksheet.addRow([summaryText]);
56377
- lastRow.font = {
56378
- name: 'Arial',
56379
- size: 10,
56380
- bold: true
56381
- };
56382
- lastRow.alignment = {
56383
- horizontal: 'left'
56384
- };
56385
- workbook.xlsx.writeBuffer().then(function (buffer) {
56386
- var now = new Date();
56387
- var datePart = ('0' + now.getDate()).slice(-2) + "-" + ('0' + (now.getMonth() + 1)).slice(-2) + "-" + now.getFullYear();
56388
- var timePart = ('0' + now.getHours()).slice(-2) + ":" + ('0' + now.getMinutes()).slice(-2);
56389
- var fullFileName = props.baseFileName + "-" + datePart + "-" + timePart + ".xlsx";
56390
- saveAs(new Blob([buffer], {
56391
- type: 'application/octet-stream'
56392
- }), fullFileName);
56393
- });
56394
- });
56395
- };
56396
-
56397
56462
  var _templateObject$A, _templateObject2$8;
56398
56463
  var useStyles$a = createStyles(function (_ref) {
56399
56464
  var css = _ref.css;
@@ -57826,7 +57891,7 @@ var OdsTransfer = function OdsTransfer(props) {
57826
57891
  calculateSortValue: column.calculateSortValue,
57827
57892
  allowHeaderFiltering: props.showFilters
57828
57893
  });
57829
- }), props.displayPageTitle && React.createElement(Toolbar, null, React.createElement(Item, {
57894
+ }), props.displayPageTitle && !isTextEmpty(props.pageTitle) && React.createElement(Toolbar, null, React.createElement(Item, {
57830
57895
  location: "before",
57831
57896
  cssClass: "toolbarTitleItem"
57832
57897
  }, React.createElement(OdsTitle, {
@@ -58089,7 +58154,7 @@ var OdsTransferV2 = function OdsTransferV2(_ref) {
58089
58154
  calculateSortValue: column.calculateSortValue,
58090
58155
  headerFilter: {}
58091
58156
  });
58092
- }), displayPageTitle && React.createElement(Toolbar, null, React.createElement(Item, {
58157
+ }), displayPageTitle && !isTextEmpty(pageTitle) && React.createElement(Toolbar, null, React.createElement(Item, {
58093
58158
  location: "before",
58094
58159
  cssClass: "toolbarTitleItem"
58095
58160
  }, React.createElement(OdsTitle, {