feat: Updating the format of the name of exported file in table component (#8885)

* Update the format of the name of exported file in table component.

* Replace : with -

* Use moment instead of date-fns

* render fix

---------

Co-authored-by: Adish M <adish.madhu@gmail.com>
Co-authored-by: Johnson Cherian <johnsonc.dev@gmail.com>
This commit is contained in:
Nakul Nagargade 2024-04-19 13:21:07 +05:30 committed by GitHub
parent a36f4ced00
commit 3d54af4264
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,6 +54,7 @@ import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
import { OverlayTriggerComponent } from './OverlayTriggerComponent';
// eslint-disable-next-line import/no-unresolved
import { diff } from 'deep-object-diff';
import moment from 'moment';
// utilityForNestedNewRow function is used to construct nested object while adding or updating new row when '.' is present in column key for adding new row
const utilityForNestedNewRow = (row) => {
@ -344,6 +345,10 @@ export function Table({
}
}
function getExportFileName() {
return `${component?.name}_${moment().format('DD-MM-YYYY_HH-mm')}`;
}
function onPageIndexChanged(page) {
onComponentOptionChanged(component, 'pageIndex', page).then(() => {
onEvent('onPageChanged', tableEvents, { component });
@ -633,6 +638,7 @@ export function Table({
pageCount: -1,
manualPagination: false,
getExportFileBlob,
getExportFileName,
disableSortBy: !enabledSort,
manualSortBy: serverSideSort,
stateReducer: (newState, action, prevState) => {