ods-component-lib 1.17.8 → 1.17.10

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.
@@ -1,4 +1,4 @@
1
- import React, { useState, useRef } from 'react';
1
+ import React, { useState, useRef, useEffect } from 'react';
2
2
  import { AutoComplete, Button, Dropdown, Calendar, Card as Card$1, Checkbox, DatePicker, Divider, Input, Form, Image, InputNumber, List, Modal, notification, Radio, Rate, Select, Spin, Switch, Tabs, Table, Tag, Timeline, TimePicker, Typography } from 'antd';
3
3
  import styled, { ThemeProvider } from 'styled-components';
4
4
  import Card from 'antd/es/card/Card';
@@ -1209,9 +1209,15 @@ var customizeBooleanColumnRender = function customizeBooleanColumnRender(e) {
1209
1209
  return e.value;
1210
1210
  };
1211
1211
  function OdsDataGrid(props) {
1212
- return grid(props);
1212
+ var dataGridRef = useRef(null);
1213
+ useEffect(function () {
1214
+ if (dataGridRef.current) {
1215
+ dataGridRef.current.instance.clearSelection();
1216
+ }
1217
+ }, []);
1218
+ return grid(props, dataGridRef);
1213
1219
  }
1214
- function grid(props) {
1220
+ function grid(props, dataGridRef) {
1215
1221
  var _ref;
1216
1222
  var headerCellRender = function headerCellRender(colProperties) {
1217
1223
  return React.createElement("th", {
@@ -1227,7 +1233,6 @@ function grid(props) {
1227
1233
  };
1228
1234
  var fileName = props.exportFileName ? props.exportFileName + moment().format("YYYYMMDD") : "DatagridExportFile" + moment().format("YYYYMMDD");
1229
1235
  var onExporting = function onExporting(e) {
1230
- debugger;
1231
1236
  if (e.format === 'xlsx') {
1232
1237
  var workbook = new Workbook();
1233
1238
  exportDataGrid({
@@ -1252,6 +1257,11 @@ function grid(props) {
1252
1257
  });
1253
1258
  }
1254
1259
  };
1260
+ var clearAllFilters = function clearAllFilters() {
1261
+ if (dataGridRef.current) {
1262
+ dataGridRef.current.instance.clearFilter();
1263
+ }
1264
+ };
1255
1265
  return React.createElement(React.Fragment, null, React.createElement("div", {
1256
1266
  className: "odsDatagrid",
1257
1267
  style: {
@@ -1273,7 +1283,8 @@ function grid(props) {
1273
1283
  columnAutoWidth: false,
1274
1284
  onEditCanceling: props.onEditCanceling,
1275
1285
  onExporting: onExporting,
1276
- height: (_ref = props.height !== undefined) != null ? _ref : props.height
1286
+ height: (_ref = props.height !== undefined) != null ? _ref : props.height,
1287
+ ref: dataGridRef
1277
1288
  }, React.createElement(Paging, {
1278
1289
  enabled: true,
1279
1290
  defaultPageSize: props.pageSize
@@ -1393,6 +1404,11 @@ function grid(props) {
1393
1404
  type: "primary",
1394
1405
  onClick: props.onAddButton
1395
1406
  }, "Add New")), React.createElement(Item$1, {
1407
+ location: "after"
1408
+ }, React.createElement(OdsButton, {
1409
+ type: "default",
1410
+ onClick: clearAllFilters
1411
+ }, "Clear Filters")), React.createElement(Item$1, {
1396
1412
  name: "searchPanel"
1397
1413
  }), React.createElement(Item$1, {
1398
1414
  name: "columnChooserButton"