@tap-payments/os-micro-frontend-shared 0.1.288 → 0.1.290
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/build/components/DateFilter/DateFilter.d.ts +16 -0
- package/build/components/DateFilter/DateFilter.js +32 -0
- package/build/components/DateFilter/index.d.ts +1 -0
- package/build/components/DateFilter/index.js +1 -0
- package/build/components/DateFilter/style.d.ts +35 -0
- package/build/components/DateFilter/style.js +100 -0
- package/build/components/VirtualTables/VirtualTable/VirtualTable.d.ts +1 -1
- package/build/components/VirtualTables/VirtualTable/VirtualTable.js +2 -2
- package/build/components/VirtualTables/components/TableFooter/TableFooter.d.ts +1 -1
- package/build/components/VirtualTables/components/TableFooter/TableFooter.js +2 -11
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/build/types/table.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CalenderMode, Timezone } from '../../types/index.js';
|
|
2
|
+
export interface DateFilterProps {
|
|
3
|
+
title?: string;
|
|
4
|
+
onConfirm: (dateRange: [Date, Date] | undefined) => void;
|
|
5
|
+
onClear: () => void;
|
|
6
|
+
dateRange?: [Date, Date];
|
|
7
|
+
onDateRangeChange: (dateRange?: [Date, Date]) => void;
|
|
8
|
+
calendarMode: CalenderMode;
|
|
9
|
+
onCalendarModeChange: (calenderMode: CalenderMode) => void;
|
|
10
|
+
timezone: Timezone | null;
|
|
11
|
+
onTimezoneChange: (timezone: Timezone) => void;
|
|
12
|
+
browserTimezone: string;
|
|
13
|
+
defaultCountryTimezone: Timezone;
|
|
14
|
+
timezoneCountriesCodes: string[];
|
|
15
|
+
}
|
|
16
|
+
export default function DateFilter({ title, dateRange, onDateRangeChange, calendarMode, onCalendarModeChange, timezone, browserTimezone, defaultCountryTimezone, onTimezoneChange, timezoneCountriesCodes, onConfirm, onClear, }: Readonly<DateFilterProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
6
|
+
import { calenderIcon, closeIcon, columnIcon, whiteFilterIcon } from '../../constants/index.js';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { Dropdown, Item, Filter, OkayButton, CancelButton, Footer, TitleStyled, FilterHeader, FilterWrapper, SelectedDate } from './style';
|
|
9
|
+
import { Icon, RangeCalender } from '../index.js';
|
|
10
|
+
import { getDefaultDateRange } from '../../utils/index.js';
|
|
11
|
+
export default function DateFilter({ title = 'Date', dateRange, onDateRangeChange, calendarMode, onCalendarModeChange, timezone, browserTimezone, defaultCountryTimezone, onTimezoneChange, timezoneCountriesCodes = [], onConfirm, onClear, }) {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
14
|
+
const open = Boolean(anchorEl);
|
|
15
|
+
const onOpen = (e) => setAnchorEl(e.currentTarget);
|
|
16
|
+
const onClose = () => setAnchorEl(null);
|
|
17
|
+
const onCancel = () => onClose();
|
|
18
|
+
const handleOkButtonClick = () => {
|
|
19
|
+
onClose();
|
|
20
|
+
onConfirm(dateRange);
|
|
21
|
+
};
|
|
22
|
+
const handleCalendarModeSwitch = useCallback((newMode) => onCalendarModeChange(newMode), [onCalendarModeChange]);
|
|
23
|
+
const getSelectedDateLabel = (dates) => {
|
|
24
|
+
if (!dates)
|
|
25
|
+
return '';
|
|
26
|
+
const [start, end] = dates;
|
|
27
|
+
const startLabel = dayjs(start).format('MMM D');
|
|
28
|
+
const endLabel = dayjs(end).format('MMM D');
|
|
29
|
+
return startLabel === endLabel ? startLabel : `${startLabel} - ${endLabel}`;
|
|
30
|
+
};
|
|
31
|
+
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: onClose }, { children: _jsxs(Box, { children: [_jsxs(Box, Object.assign({ sx: { cursor: 'pointer', display: 'flex', alignItems: 'center', gap: '4px' }, onClick: onOpen }, { children: [title, dateRange ? (_jsxs(FilterWrapper, { children: [_jsx(Box, { component: "img", src: whiteFilterIcon, alt: "filter-icon", sx: { marginInlineEnd: '2px', height: 6 }, onClick: onOpen }), _jsx(Box, { component: "img", src: closeIcon, alt: "close-icon", onClick: onClear })] })) : (_jsx(Box, { component: "img", src: columnIcon, alt: "column-icon", sx: { cursor: 'pointer', marginTop: '2px' } }))] })), _jsxs(Dropdown, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-start" }, { children: [_jsxs(Filter, { children: [_jsx(FilterHeader, { children: _jsx(TitleStyled, Object.assign({ component: "span" }, { children: t('filterBy') })) }), _jsx(Item, { children: _jsx(RangeCalender, { defaultDate: dateRange || getDefaultDateRange(0), onDateChange: onDateRangeChange, maxDateRange: 365, mode: calendarMode, onCalendarModeSwitch: handleCalendarModeSwitch, browserTimezone: browserTimezone, defaultCountryTimezone: defaultCountryTimezone, timezone: timezone, onChangeTimezone: onTimezoneChange, timezoneCountriesCodes: timezoneCountriesCodes, mainSx: { width: '100%' }, popperProps: { placement: 'right-start' }, renderCalendarButton: (isOpen, openCal) => (_jsxs(SelectedDate, Object.assign({ open: isOpen, onClick: openCal }, { children: [_jsx("span", { children: getSelectedDateLabel(dateRange) || 'Date' }), _jsx(Icon, { src: calenderIcon, alt: "selected", sx: { width: 16, height: 16 } })] }))) }, getSelectedDateLabel(dateRange)) }), dateRange && (_jsx(TitleStyled, Object.assign({ component: "span", sx: { color: '#1F88D0', padding: '4px 24px' }, onClick: () => onDateRangeChange(undefined) }, { children: "Clear" })))] }), _jsxs(Footer, { children: [_jsx(CancelButton, Object.assign({ onClick: onCancel }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ onClick: handleOkButtonClick }, { children: t('okay') }))] })] }))] }) })));
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DateFilter, type DateFilterProps } from './DateFilter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DateFilter } from './DateFilter';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Content: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
5
|
+
export declare const Label: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
7
|
+
}, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "classes" | "align" | "className" | "style" | "children" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping"> & {
|
|
8
|
+
component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
9
|
+
} & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
10
|
+
export declare const Dropdown: import("@emotion/styled").StyledComponent<Omit<import("../Menu/Menu").MenuProps, "ref"> & import("react").RefAttributes<HTMLDivElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
11
|
+
export declare const Item: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
12
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
13
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
14
|
+
export declare const Footer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
15
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
16
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
17
|
+
export declare const OkayButton: import("@emotion/styled").StyledComponent<import("../Button/Button").ButtonI & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
18
|
+
export declare const CancelButton: import("@emotion/styled").StyledComponent<import("../Button/Button").ButtonI & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
19
|
+
export declare const Filter: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
20
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
21
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
22
|
+
export declare const TitleStyled: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
23
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
24
|
+
}, "width" | "minHeight" | "height" | "bottom" | "left" | "right" | "top" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "visibility" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint" | "classes" | "align" | "className" | "style" | "children" | "gutterBottom" | "noWrap" | "paragraph" | "sx" | "variant" | "variantMapping"> & {
|
|
25
|
+
component?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
26
|
+
} & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
27
|
+
export declare const FilterHeader: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
28
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
29
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
30
|
+
export declare const SelectedDate: import("@emotion/styled").StyledComponent<import("../Button/Button").ButtonI & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
31
|
+
open: boolean;
|
|
32
|
+
}, {}, {}>;
|
|
33
|
+
export declare const FilterWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
34
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
35
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import Box from '@mui/material/Box';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import { Button, Menu, Text } from '../index.js';
|
|
4
|
+
export const Content = styled(Box)(() => ({
|
|
5
|
+
paddingBlock: '8px',
|
|
6
|
+
display: 'flex',
|
|
7
|
+
gap: '12px',
|
|
8
|
+
flexDirection: 'column',
|
|
9
|
+
}));
|
|
10
|
+
export const Label = styled(Text)(() => ({
|
|
11
|
+
fontSize: '11px',
|
|
12
|
+
}));
|
|
13
|
+
export const Dropdown = styled(Menu)(() => ({
|
|
14
|
+
marginTop: '8px',
|
|
15
|
+
marginBottom: '8px',
|
|
16
|
+
}));
|
|
17
|
+
export const Item = styled(Box)(() => ({
|
|
18
|
+
display: 'flex',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
gap: '4px',
|
|
21
|
+
width: '100%',
|
|
22
|
+
paddingInline: '16px',
|
|
23
|
+
}));
|
|
24
|
+
export const Footer = styled(Box)(({ theme }) => ({
|
|
25
|
+
padding: '8px 16px',
|
|
26
|
+
display: 'flex',
|
|
27
|
+
gap: '8px',
|
|
28
|
+
justifyContent: 'flex-end',
|
|
29
|
+
position: 'sticky',
|
|
30
|
+
bottom: 0,
|
|
31
|
+
backgroundColor: 'white',
|
|
32
|
+
zIndex: 99999,
|
|
33
|
+
borderTop: `1px solid ${theme.palette.divider}`,
|
|
34
|
+
}));
|
|
35
|
+
export const OkayButton = styled(Button)(({ theme }) => ({
|
|
36
|
+
textTransform: 'capitalize',
|
|
37
|
+
minWidth: 'auto',
|
|
38
|
+
width: 70,
|
|
39
|
+
borderRadius: '4px',
|
|
40
|
+
border: `1px solid ${theme.palette.info.dark}`,
|
|
41
|
+
backgroundColor: theme.palette.info.dark,
|
|
42
|
+
fontWeight: 700,
|
|
43
|
+
fontSize: '11px',
|
|
44
|
+
color: theme.palette.common.white,
|
|
45
|
+
'&:hover': {
|
|
46
|
+
backgroundColor: theme.palette.info.dark,
|
|
47
|
+
},
|
|
48
|
+
'&.Mui-disabled': {
|
|
49
|
+
color: '#fff !important',
|
|
50
|
+
opacity: 0.5,
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
53
|
+
export const CancelButton = styled(Button)(({ theme }) => ({
|
|
54
|
+
textTransform: 'capitalize',
|
|
55
|
+
minWidth: 'auto',
|
|
56
|
+
width: 70,
|
|
57
|
+
borderRadius: '4px',
|
|
58
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
59
|
+
backgroundColor: theme.palette.common.white,
|
|
60
|
+
fontWeight: 500,
|
|
61
|
+
fontSize: '11px',
|
|
62
|
+
color: theme.palette.text.primary,
|
|
63
|
+
'&:hover': {
|
|
64
|
+
background: 'transparent',
|
|
65
|
+
},
|
|
66
|
+
}));
|
|
67
|
+
export const Filter = styled(Box)(() => ({
|
|
68
|
+
display: 'flex',
|
|
69
|
+
flexDirection: 'column',
|
|
70
|
+
gap: '8px',
|
|
71
|
+
marginBottom: '8px',
|
|
72
|
+
}));
|
|
73
|
+
export const TitleStyled = styled(Label)(() => ({
|
|
74
|
+
fontSize: '11px',
|
|
75
|
+
fontWeight: 500,
|
|
76
|
+
color: '#8D8D94',
|
|
77
|
+
padding: '8px 16px',
|
|
78
|
+
}));
|
|
79
|
+
export const FilterHeader = styled(Box)(({ theme }) => ({
|
|
80
|
+
borderBlock: `1px solid ${theme.palette.divider}`,
|
|
81
|
+
display: 'flex',
|
|
82
|
+
justifyContent: 'space-between',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
gap: '2px',
|
|
85
|
+
width: '100%',
|
|
86
|
+
}));
|
|
87
|
+
export const SelectedDate = styled(Button, { shouldForwardProp: (props) => props !== 'open' })(({ open, theme }) => (Object.assign({ color: theme.palette.text.primary, fontSize: '11px', fontWeight: 500, padding: theme.spacing(1), borderRadius: '4px', border: '1px solid', borderColor: theme.palette.divider, background: theme.palette.common.white, textTransform: 'none', width: '100%', height: 32, justifyContent: 'space-between', gap: '4px' }, (open && { border: '1px solid', borderColor: theme.palette.info.dark, boxShadow: theme.shadows[7] }))));
|
|
88
|
+
export const FilterWrapper = styled(Box)(({ theme }) => ({
|
|
89
|
+
background: theme.palette.grey[700],
|
|
90
|
+
width: 27,
|
|
91
|
+
height: 14,
|
|
92
|
+
display: 'inline-flex',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
marginInlineStart: '4px',
|
|
95
|
+
borderRadius: '10px',
|
|
96
|
+
padding: '2px 6px',
|
|
97
|
+
img: {
|
|
98
|
+
cursor: 'pointer',
|
|
99
|
+
},
|
|
100
|
+
}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { IVirtualTable } from '../../../types/index.js';
|
|
3
|
-
declare function VirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, onStartDrag, isSheetView, isMinimized, }: Readonly<IVirtualTable>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function VirtualTable({ columns, rows, threshold, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded, tableBodyStyles, tableMode, tableTitle, onStartDrag, isSheetView, isMinimized, footerComponent, }: Readonly<IVirtualTable>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: import("react").MemoExoticComponent<typeof VirtualTable>;
|
|
5
5
|
export default _default;
|
|
@@ -34,7 +34,7 @@ const createItemData = memoize((columns, isLoading, rows, rowProps, scrollToInde
|
|
|
34
34
|
areAllRowsLoaded,
|
|
35
35
|
isSheetView,
|
|
36
36
|
}));
|
|
37
|
-
function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, onStartDrag, isSheetView = false, isMinimized, }) {
|
|
37
|
+
function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader, headerProps, rowProps, footerProps, isLoading, error, columnsSorting, onColumnSort, loadMoreItems, isFetchingNextPage, triggerDataRefetch, scrollToIndex, areAllRowsLoaded = false, tableBodyStyles, tableMode, tableTitle, onStartDrag, isSheetView = false, isMinimized, footerComponent, }) {
|
|
38
38
|
var _a;
|
|
39
39
|
const theme = useTheme();
|
|
40
40
|
const onPointerDown = (e) => {
|
|
@@ -107,6 +107,6 @@ function VirtualTable({ columns, rows, threshold = TABLE_THRESHOLD, showHeader,
|
|
|
107
107
|
// rows height + header height
|
|
108
108
|
, {
|
|
109
109
|
// rows height + header height
|
|
110
|
-
height: (itemsCount + 1) * tableRowHeight, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, "data-testid": "VirtualTable_TableLastItem" }))] }), _jsx(TableFooter, Object.assign({ "data-testid": "VirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))] }));
|
|
110
|
+
height: (itemsCount + 1) * tableRowHeight, sandboxMode: footerProps === null || footerProps === void 0 ? void 0 : footerProps.sandboxMode, "data-testid": "VirtualTable_TableLastItem" }))] }), footerProps && (_jsx(TableFooter, Object.assign({ "data-testid": "VirtualTable_TableFooter", showSeparator: true, showBackDrop: showBackDrop, onPointerDown: onPointerDown }, footerProps))), footerComponent] }));
|
|
111
111
|
}
|
|
112
112
|
export default memo(VirtualTable);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TableFooterProps } from '../../../../types/index.js';
|
|
3
|
-
declare function TableFooter({ totalCount, showBackDrop, showSeparator, sandboxMode, maximized,
|
|
3
|
+
declare function TableFooter({ totalCount, showBackDrop, showSeparator, sandboxMode, maximized, ...other }: Readonly<TableFooterProps>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: React.MemoExoticComponent<typeof TableFooter>;
|
|
5
5
|
export default _default;
|
|
@@ -15,17 +15,8 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import { formatNumber } from '../../../../utils/index.js';
|
|
16
16
|
import { StyledFooter, Label, Title, ValueWrapper, EngravingLine } from './style';
|
|
17
17
|
function TableFooter(_a) {
|
|
18
|
-
var { totalCount, showBackDrop = false, showSeparator, sandboxMode, maximized
|
|
18
|
+
var { totalCount, showBackDrop = false, showSeparator, sandboxMode, maximized } = _a, other = __rest(_a, ["totalCount", "showBackDrop", "showSeparator", "sandboxMode", "maximized"]);
|
|
19
19
|
const { t } = useTranslation();
|
|
20
|
-
|
|
21
|
-
// const max = 50000
|
|
22
|
-
// const average = 30000
|
|
23
|
-
// const sum = 100000
|
|
24
|
-
// const currency = 'SAR'
|
|
25
|
-
// const { integerAmount: minIntegerAmount, decimalAmount: minDecimalAmount } = formatAmount(min)
|
|
26
|
-
// const { integerAmount: maxIntegerAmount, decimalAmount: maxDecimalAmount } = formatAmount(max)
|
|
27
|
-
// const { integerAmount: averageIntegerAmount, decimalAmount: averageDecimalAmount } = formatAmount(average)
|
|
28
|
-
// const { integerAmount: sumIntegerAmount, decimalAmount: sumDecimalAmount } = formatAmount(sum)
|
|
29
|
-
return (_jsxs(StyledFooter, Object.assign({ component: "footer", "data-testid": "TableFooter", maximized: maximized !== null && maximized !== void 0 ? maximized : false, sandboxMode: sandboxMode, showBackDrop: showBackDrop, areTotalRowsNotFillingHeight: !!showSeparator }, other, { children: [showSeparator && _jsx(EngravingLine, {}), totalCount || totalCount === 0 ? (_jsxs(Label, Object.assign({ sx: { gap: '6px', cursor: 'text' } }, { children: [_jsx(Title, { children: t('count') }), _jsx(ValueWrapper, { children: formatNumber(totalCount || 0) })] }))) : null, children] })));
|
|
20
|
+
return (_jsxs(StyledFooter, Object.assign({ component: "footer", "data-testid": "TableFooter", maximized: maximized !== null && maximized !== void 0 ? maximized : false, sandboxMode: sandboxMode, showBackDrop: showBackDrop, areTotalRowsNotFillingHeight: !!showSeparator }, other, { children: [showSeparator && _jsx(EngravingLine, {}), totalCount || totalCount === 0 ? (_jsxs(Label, Object.assign({ sx: { gap: '6px', cursor: 'text' } }, { children: [_jsx(Title, { children: t('count') }), _jsx(ValueWrapper, { children: formatNumber(totalCount || 0) })] }))) : null] })));
|
|
30
21
|
}
|
|
31
22
|
export default React.memo(TableFooter);
|
package/build/types/table.d.ts
CHANGED
|
@@ -46,7 +46,6 @@ export interface TableFooterProps extends BoxProps {
|
|
|
46
46
|
showSeparator?: boolean;
|
|
47
47
|
sandboxMode?: boolean;
|
|
48
48
|
maximized?: boolean;
|
|
49
|
-
children?: React.ReactNode;
|
|
50
49
|
}
|
|
51
50
|
export interface TableChipProps {
|
|
52
51
|
onChipClick?: (rowIndex: number, columnIndex: number, event: React.MouseEvent, chipIndex: number, pinnedType?: 'start' | 'end') => void;
|
|
@@ -140,6 +139,7 @@ export interface IVirtualTable<R = any> {
|
|
|
140
139
|
onStartDrag?: DragControls['start'];
|
|
141
140
|
isSheetView?: boolean;
|
|
142
141
|
isMinimized?: boolean;
|
|
142
|
+
footerComponent?: React.ReactNode;
|
|
143
143
|
}
|
|
144
144
|
export type ColumnFilterValues = Record<string, boolean | string | string[] | Record<string, boolean> | Record<string, string> | {
|
|
145
145
|
phone: string;
|
package/package.json
CHANGED