@tap-payments/os-micro-frontend-shared 0.1.376-test.1-test.2 → 0.1.376-test.2
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/FilterDropdown/FilterDropdown.d.ts +11 -4
- package/build/components/FilterDropdown/FilterDropdown.js +18 -4
- package/build/components/FilterDropdown/style.js +1 -1
- package/build/components/MultiDatakeyDonut/MultiDatakeyDonut.d.ts +12 -0
- package/build/components/MultiDatakeyDonut/MultiDatakeyDonut.js +19 -0
- package/build/components/MultiDatakeyDonut/index.d.ts +1 -0
- package/build/components/MultiDatakeyDonut/index.js +1 -0
- package/build/components/MultiDatakeyDonut/style.d.ts +10 -0
- package/build/components/MultiDatakeyDonut/style.js +23 -0
- package/build/components/RangeCalender/RangeCalender.js +4 -2
- package/build/components/TableHeader/FiltersRow.d.ts +1 -1
- package/build/components/TableHeader/FiltersRow.js +2 -4
- package/build/components/TableHeader/TableHeader.d.ts +1 -1
- package/build/components/TableHeader/TableHeader.js +2 -2
- package/build/components/TableHeader/TableView/CustomViews.js +1 -1
- package/build/components/TableHeader/TableView/TableView.js +1 -0
- package/build/components/TableHeader/TableView/hooks/index.d.ts +0 -6
- package/build/components/TableHeader/TableView/hooks/index.js +0 -6
- package/build/components/TableHeader/TableView/index.d.ts +3 -12
- package/build/components/TableHeader/TableView/index.js +3 -13
- package/build/components/TableHeader/index.d.ts +0 -1
- package/build/components/TableHeader/type.d.ts +1 -15
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/build/constants/assets.d.ts +3 -1
- package/build/constants/assets.js +3 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.js +1 -0
- package/build/types/toggleOptions.d.ts +2 -0
- package/build/utils/date.d.ts +5 -0
- package/build/utils/date.js +37 -0
- package/package.json +1 -2
- package/build/components/TableHeader/TableView/CreateViewDialog.d.ts +0 -3
- package/build/components/TableHeader/TableView/CreateViewDialog.js +0 -91
- package/build/components/TableHeader/TableView/ViewSelector.d.ts +0 -5
- package/build/components/TableHeader/TableView/ViewSelector.js +0 -81
- package/build/components/TableHeader/TableView/ViewsDropdown.d.ts +0 -5
- package/build/components/TableHeader/TableView/ViewsDropdown.js +0 -198
- package/build/components/TableHeader/TableView/components/ColumnList.d.ts +0 -3
- package/build/components/TableHeader/TableView/components/ColumnList.js +0 -70
- package/build/components/TableHeader/TableView/components/ViewsSubmenu.d.ts +0 -3
- package/build/components/TableHeader/TableView/components/ViewsSubmenu.js +0 -71
- package/build/components/TableHeader/TableView/components/index.d.ts +0 -2
- package/build/components/TableHeader/TableView/components/index.js +0 -2
- package/build/components/TableHeader/TableView/constants.d.ts +0 -10
- package/build/components/TableHeader/TableView/constants.js +0 -10
- package/build/components/TableHeader/TableView/data.d.ts +0 -5
- package/build/components/TableHeader/TableView/data.js +0 -48
- package/build/components/TableHeader/TableView/hooks/useCreateViewDialog.d.ts +0 -22
- package/build/components/TableHeader/TableView/hooks/useCreateViewDialog.js +0 -86
- package/build/components/TableHeader/TableView/hooks/useDialogPosition.d.ts +0 -8
- package/build/components/TableHeader/TableView/hooks/useDialogPosition.js +0 -16
- package/build/components/TableHeader/TableView/hooks/useNestedSubmenu.d.ts +0 -7
- package/build/components/TableHeader/TableView/hooks/useNestedSubmenu.js +0 -34
- package/build/components/TableHeader/TableView/hooks/useOriginalColumns.d.ts +0 -6
- package/build/components/TableHeader/TableView/hooks/useOriginalColumns.js +0 -18
- package/build/components/TableHeader/TableView/hooks/useSubmenuHover.d.ts +0 -8
- package/build/components/TableHeader/TableView/hooks/useSubmenuHover.js +0 -43
- package/build/components/TableHeader/TableView/hooks/useViewSelector.d.ts +0 -50
- package/build/components/TableHeader/TableView/hooks/useViewSelector.js +0 -239
- package/build/components/TableHeader/TableView/hooks/useViewsManager.d.ts +0 -20
- package/build/components/TableHeader/TableView/hooks/useViewsManager.js +0 -96
- package/build/components/TableHeader/TableView/styles.d.ts +0 -127
- package/build/components/TableHeader/TableView/styles.js +0 -426
- package/build/components/TableHeader/TableView/types.d.ts +0 -183
- package/build/components/TableHeader/TableView/utils.d.ts +0 -121
- package/build/components/TableHeader/TableView/utils.js +0 -463
- /package/build/{components/TableHeader/TableView/types.js → types/toggleOptions.js} +0 -0
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BoxProps } from '@mui/material/Box';
|
|
3
|
+
import { SxProps } from '@mui/material';
|
|
4
|
+
interface FilterDropdownProps extends BoxProps {
|
|
4
5
|
onConfirm: () => void;
|
|
5
6
|
onCancel: () => void;
|
|
6
7
|
isOkayButDisabled?: boolean;
|
|
7
8
|
isDisabled?: boolean;
|
|
9
|
+
icon?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
menuStyle?: SxProps;
|
|
12
|
+
hideTitle?: boolean;
|
|
13
|
+
renderButton?: ReactNode;
|
|
14
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
8
15
|
}
|
|
9
|
-
export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled, children, isDisabled }: Readonly<FilterDropdownProps>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled, children, isDisabled, icon, title, menuStyle, hideTitle, renderButton, onOpenChange, ...props }: Readonly<FilterDropdownProps>): import("react/jsx-runtime").JSX.Element;
|
|
10
17
|
export {};
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useState, useEffect } from 'react';
|
|
2
14
|
import Box from '@mui/material/Box';
|
|
15
|
+
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
3
16
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { useState, useEffect } from 'react';
|
|
5
|
-
import { ClickAwayListener } from '@mui/material';
|
|
6
17
|
import { darkFilterIcon } from '../../constants/index.js';
|
|
7
18
|
import { Menu, CustomBackdrop } from '../index.js';
|
|
8
19
|
import { CancelButton, FilterButton, Footer, OkayButton, TitleStyled } from './style';
|
|
9
|
-
export default function FilterDropdown(
|
|
20
|
+
export default function FilterDropdown(_a) {
|
|
21
|
+
var { onConfirm, onCancel, isOkayButDisabled, children, isDisabled, icon, title, menuStyle, hideTitle = false, renderButton, onOpenChange } = _a, props = __rest(_a, ["onConfirm", "onCancel", "isOkayButDisabled", "children", "isDisabled", "icon", "title", "menuStyle", "hideTitle", "renderButton", "onOpenChange"]);
|
|
10
22
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
11
23
|
const open = Boolean(anchorEl);
|
|
12
24
|
const { t } = useTranslation();
|
|
@@ -32,12 +44,14 @@ export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled,
|
|
|
32
44
|
return;
|
|
33
45
|
if (!open) {
|
|
34
46
|
setAnchorEl(e.currentTarget);
|
|
47
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(true);
|
|
35
48
|
return;
|
|
36
49
|
}
|
|
37
50
|
onClose();
|
|
38
51
|
};
|
|
39
52
|
const onClose = () => {
|
|
40
53
|
setAnchorEl(null);
|
|
54
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);
|
|
41
55
|
onCancel();
|
|
42
56
|
};
|
|
43
57
|
const handleCancel = () => {
|
|
@@ -50,5 +64,5 @@ export default function FilterDropdown({ onConfirm, onCancel, isOkayButDisabled,
|
|
|
50
64
|
onConfirm();
|
|
51
65
|
onClose();
|
|
52
66
|
};
|
|
53
|
-
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: handleCancel }, { children: _jsxs(Box, { children: [_jsx(FilterButton, Object.assign({ isActive: open, onClick: onOpen, sx: Object.assign({}, (isDisabled && { pointerEvents: 'none', opacity: 0.5 })) }, { children: _jsx(Box, { component: "img", src: darkFilterIcon, alt: "filter" }) })), _jsxs(Menu, Object.assign({ anchorEl: anchorEl, open: open, sx: { marginTop: '8px', marginBottom: '8px', width: 193 }, placement: "bottom-end" }, { children: [_jsx(TitleStyled, Object.assign({ component: "span" }, { children: t('filterBy') })), children, _jsxs(Footer, { children: [_jsx(CancelButton, Object.assign({ onClick: handleCancel }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ disabled: isOkayButDisabled, onClick: handleConfirm }, { children: t('okay') }))] })] })), open && _jsx(CustomBackdrop, { onClick: onClose })] }) })));
|
|
67
|
+
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: handleCancel }, { children: _jsxs(Box, Object.assign({}, props, { children: [_jsx(FilterButton, Object.assign({ className: "filter-button", isActive: open, onClick: onOpen, sx: Object.assign({}, (isDisabled && Object.assign({ pointerEvents: 'none', opacity: 0.5 }, props.sx))) }, { children: renderButton !== null && renderButton !== void 0 ? renderButton : _jsx(Box, { component: "img", src: icon !== null && icon !== void 0 ? icon : darkFilterIcon, alt: "filter" }) })), _jsxs(Menu, Object.assign({ anchorEl: anchorEl, open: open, sx: Object.assign({ marginTop: '8px', marginBottom: '8px', width: 193 }, menuStyle), placement: "bottom-end" }, { children: [!hideTitle && _jsx(TitleStyled, Object.assign({ component: "span" }, { children: title !== null && title !== void 0 ? title : t('filterBy') })), children, _jsxs(Footer, { children: [_jsx(CancelButton, Object.assign({ onClick: handleCancel }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ disabled: isOkayButDisabled, onClick: handleConfirm }, { children: t('okay') }))] })] })), open && _jsx(CustomBackdrop, { onClick: onClose })] })) })));
|
|
54
68
|
}
|
|
@@ -2,7 +2,7 @@ import Box from '@mui/material/Box';
|
|
|
2
2
|
import { styled } from '@mui/material/styles';
|
|
3
3
|
import Button from '@mui/material/Button';
|
|
4
4
|
import { Text } from '../index.js';
|
|
5
|
-
export const FilterButton = styled(Box, { shouldForwardProp: (props) => props !== 'isActive' })(({ theme, isActive }) => (Object.assign({ borderRadius: '4px', border: `1px solid ${theme.palette.divider}`,
|
|
5
|
+
export const FilterButton = styled(Box, { shouldForwardProp: (props) => props !== 'isActive' })(({ theme, isActive }) => (Object.assign({ borderRadius: '4px', border: `1px solid ${theme.palette.divider}`, minHeight: 32, minWidth: 30, display: 'flex', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', backgroundColor: theme.palette.common.white, ':hover': {
|
|
6
6
|
opacity: 0.7,
|
|
7
7
|
} }, (isActive && {
|
|
8
8
|
boxShadow: `0px 0px 4px 0px ${theme.palette.info.dark}80`,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface DonutProps {
|
|
3
|
+
size?: number;
|
|
4
|
+
chartData: Array<{
|
|
5
|
+
name: string;
|
|
6
|
+
value: number;
|
|
7
|
+
color: string;
|
|
8
|
+
}>;
|
|
9
|
+
chartInfo?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const MultiDatakeyDonut: ({ chartData, size, chartInfo }: DonutProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { ResponsiveContainer, PieChart, Pie, Cell } from 'recharts';
|
|
4
|
+
import { DonutWrapper, CenterOverlay, Empty } from './style';
|
|
5
|
+
export const MultiDatakeyDonut = ({ chartData, size = 170, chartInfo }) => {
|
|
6
|
+
const pieSegments = useMemo(() => {
|
|
7
|
+
const total = chartData.reduce((sum, d) => sum + d.value, 0) || 1;
|
|
8
|
+
let cumulative = 0;
|
|
9
|
+
return chartData.map((d) => {
|
|
10
|
+
const start = (cumulative / total) * 360;
|
|
11
|
+
const end = ((cumulative + d.value) / total) * 360;
|
|
12
|
+
cumulative += d.value;
|
|
13
|
+
return Object.assign(Object.assign({}, d), { startAngle: start, endAngle: end });
|
|
14
|
+
});
|
|
15
|
+
}, [chartData]);
|
|
16
|
+
const isEmpty = chartData.every((d) => d.value === 0);
|
|
17
|
+
return (_jsxs(DonutWrapper, Object.assign({ sx: { width: size, height: size } }, { children: [_jsx(ResponsiveContainer, { children: _jsxs(PieChart, { children: [_jsx(Pie, { data: [{ value: 100 }], dataKey: "value", cx: "50%", cy: "50%", innerRadius: "70%", outerRadius: "100%", fill: "#E5E7EB", stroke: "none", isAnimationActive: false }), !isEmpty &&
|
|
18
|
+
pieSegments.map((segment) => (_jsx(Pie, Object.assign({ data: [segment], dataKey: "value", cx: "50%", cy: "50%", innerRadius: "70%", outerRadius: "100%", startAngle: 90 - segment.startAngle, endAngle: 90 - segment.endAngle, cornerRadius: 0, stroke: "none", isAnimationActive: true, animationDuration: 800, style: { outline: 'none' } }, { children: _jsx(Cell, { fill: segment.color, tabIndex: -1 }, segment.name) }), segment.name)))] }) }), _jsx(CenterOverlay, { children: !chartInfo ? _jsx(Empty, { children: "----" }) : chartInfo })] })));
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MultiDatakeyDonut';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MultiDatakeyDonut';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const DonutWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").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").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
5
|
+
export declare const CenterOverlay: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
8
|
+
export declare const Empty: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
9
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
10
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
export const DonutWrapper = styled(Box)(() => ({
|
|
4
|
+
width: '100%',
|
|
5
|
+
maxWidth: 500,
|
|
6
|
+
aspectRatio: '1',
|
|
7
|
+
position: 'relative',
|
|
8
|
+
}));
|
|
9
|
+
export const CenterOverlay = styled(Box)(({ theme }) => ({
|
|
10
|
+
position: 'absolute',
|
|
11
|
+
inset: 0,
|
|
12
|
+
display: 'flex',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
pointerEvents: 'none',
|
|
17
|
+
gap: theme.spacing(1),
|
|
18
|
+
}));
|
|
19
|
+
export const Empty = styled(Box)(({ theme }) => ({
|
|
20
|
+
fontSize: 17,
|
|
21
|
+
fontWeight: 700,
|
|
22
|
+
color: '#CFD0D2',
|
|
23
|
+
}));
|
|
@@ -58,8 +58,10 @@ function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalend
|
|
|
58
58
|
onChangeTimezone === null || onChangeTimezone === void 0 ? void 0 : onChangeTimezone(selectedTimezone);
|
|
59
59
|
};
|
|
60
60
|
const getSelectedDate = () => {
|
|
61
|
-
const
|
|
62
|
-
const
|
|
61
|
+
const nowYear = dayjs().year();
|
|
62
|
+
const formatDate = (date) => (date.year === nowYear ? date.format('MMM D') : date.format('MMM D YYYY'));
|
|
63
|
+
const startSelectedTime = formatDate(dates[0]);
|
|
64
|
+
const endSelectedTime = dates[1] ? formatDate(dates[1]) : formatDate(dates[0]);
|
|
63
65
|
return startSelectedTime === endSelectedTime && !noTimezone ? startSelectedTime : `${startSelectedTime} - ${endSelectedTime}`;
|
|
64
66
|
};
|
|
65
67
|
const onChange = (newDate) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { FilterRowProps } from './type';
|
|
2
|
-
export default function FiltersRow({ date, calendarMode, onDateChange, onCalendarModeSwitch, tableReportsComponent, tableFilterComponent, isReportsButtonVisible, onViewChange, onSearchChange, onToggleViewButtonClick, rightActions, leftActions, setTableViews, tableViews, resetTableViews, onToggleTextButtonClick, calendarGroupBy, onCalendarGroupChange, maxDateRange, searchPlaceholder, isAcceptance, tableMode, timezone, browserTimezone, defaultCountryTimezone, onChangeTimezone, segmentCountries,
|
|
2
|
+
export default function FiltersRow({ date, calendarMode, onDateChange, onCalendarModeSwitch, tableReportsComponent, tableFilterComponent, isReportsButtonVisible, onViewChange, onSearchChange, onToggleViewButtonClick, rightActions, leftActions, setTableViews, tableViews, resetTableViews, onToggleTextButtonClick, calendarGroupBy, onCalendarGroupChange, maxDateRange, searchPlaceholder, isAcceptance, tableMode, timezone, browserTimezone, defaultCountryTimezone, onChangeTimezone, segmentCountries, }: FilterRowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,9 +4,8 @@ import { SearchButton, StyledButton, Icon, RangeCalender } from '../index.js';
|
|
|
4
4
|
import { viewIcon } from '../../constants/index.js';
|
|
5
5
|
import FiltersRowWrapper from './FiltersRowWrapper';
|
|
6
6
|
import TableView from './TableView';
|
|
7
|
-
import { ViewSelector } from './TableView';
|
|
8
7
|
import TableModeButton from './TableModeButton';
|
|
9
|
-
export default function FiltersRow({ date, calendarMode, onDateChange, onCalendarModeSwitch, tableReportsComponent, tableFilterComponent, isReportsButtonVisible, onViewChange, onSearchChange, onToggleViewButtonClick, rightActions, leftActions, setTableViews, tableViews, resetTableViews, onToggleTextButtonClick, calendarGroupBy, onCalendarGroupChange, maxDateRange = 31, searchPlaceholder, isAcceptance, tableMode = 'default', timezone, browserTimezone, defaultCountryTimezone, onChangeTimezone, segmentCountries,
|
|
8
|
+
export default function FiltersRow({ date, calendarMode, onDateChange, onCalendarModeSwitch, tableReportsComponent, tableFilterComponent, isReportsButtonVisible, onViewChange, onSearchChange, onToggleViewButtonClick, rightActions, leftActions, setTableViews, tableViews, resetTableViews, onToggleTextButtonClick, calendarGroupBy, onCalendarGroupChange, maxDateRange = 31, searchPlaceholder, isAcceptance, tableMode = 'default', timezone, browserTimezone, defaultCountryTimezone, onChangeTimezone, segmentCountries, }) {
|
|
10
9
|
const [isViewVisible, setIsViewVisible] = useState(false);
|
|
11
10
|
const timezoneCountriesCodes = useMemo(() => segmentCountries.map(({ code }) => code), [segmentCountries]);
|
|
12
11
|
const tableModeButton = useMemo(() => _jsx(TableModeButton, { tableMode: tableMode, onToggle: onToggleTextButtonClick }), [tableMode, onToggleTextButtonClick]);
|
|
@@ -15,6 +14,5 @@ export default function FiltersRow({ date, calendarMode, onDateChange, onCalenda
|
|
|
15
14
|
if (startDate && endDate) {
|
|
16
15
|
onDateChange === null || onDateChange === void 0 ? void 0 : onDateChange([startDate, endDate]);
|
|
17
16
|
}
|
|
18
|
-
}, mode: calendarMode, onCalendarModeSwitch: onCalendarModeSwitch, maxDateRange: maxDateRange, groupBy: calendarGroupBy, onCalendarGroupChange: onCalendarGroupChange, browserTimezone: browserTimezone, defaultCountryTimezone: defaultCountryTimezone, timezone: timezone, onChangeTimezone: onChangeTimezone, timezoneCountriesCodes: timezoneCountriesCodes })), isReportsButtonVisible && tableReportsComponent, onToggleTextButtonClick && isAcceptance && tableModeButton] })), onToggleViewButtonClick && (_jsx(StyledButton, { children: _jsx(Icon, { src: viewIcon, alt: "view", sx: { width: 14, height: 14 } }) })), onViewChange &&
|
|
19
|
-
(templates ? (_jsx(ViewSelector, { onViewChange: onViewChange, onCreateCustomView: onCreateCustomView, onEditCustomView: onEditCustomView, onDeleteCustomView: onDeleteCustomView, tableMode: tableMode, templates: templates, lang: lang })) : (_jsx(TableView, { onViewChange: onViewChange, setIsViewVisible: setIsViewVisible, tableViews: tableViews, setTableViews: setTableViews, resetTableViews: resetTableViews }))), rightActions && !isViewVisible && rightActions] }));
|
|
17
|
+
}, mode: calendarMode, onCalendarModeSwitch: onCalendarModeSwitch, maxDateRange: maxDateRange, groupBy: calendarGroupBy, onCalendarGroupChange: onCalendarGroupChange, browserTimezone: browserTimezone, defaultCountryTimezone: defaultCountryTimezone, timezone: timezone, onChangeTimezone: onChangeTimezone, timezoneCountriesCodes: timezoneCountriesCodes })), isReportsButtonVisible && tableReportsComponent, onToggleTextButtonClick && isAcceptance && tableModeButton] })), onToggleViewButtonClick && (_jsx(StyledButton, { children: _jsx(Icon, { src: viewIcon, alt: "view", sx: { width: 14, height: 14 } }) })), onViewChange && (_jsx(TableView, { onViewChange: onViewChange, setIsViewVisible: setIsViewVisible, tableViews: tableViews, setTableViews: setTableViews, resetTableViews: resetTableViews })), rightActions && !isViewVisible && rightActions] }));
|
|
20
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TableHeaderProps } from './type';
|
|
2
2
|
import { type TableHeaderStatus } from '../../types/index.js';
|
|
3
|
-
export declare function TableHeader<IStatus extends TableHeaderStatus | TableHeaderStatus[] = undefined>({ date, status, availableStatuses, showMaximizedView, title, calendarMode, tableReportsComponent, tableFilterComponent, onStatusChange, onViewChange, onDateChange, onCalendarModeSwitch, filteredIds, onCancelFilteredIdsClick, isFilteredIdsShown, cardNumber, leftActions, rightActions, isReportsButtonVisible, onSearchChange, onToggleViewButtonClick, leftComponent, tableViews, setTableViews, resetTableViews, onToggleTextButtonClick, calendarGroupBy, onCalendarGroupChange, children, maxDateRange, isAcceptance, startComponent, searchPlaceholder, tableMode, timezone, browserTimezone, defaultCountryTimezone, onChangeTimezone, segmentCountries,
|
|
3
|
+
export declare function TableHeader<IStatus extends TableHeaderStatus | TableHeaderStatus[] = undefined>({ date, status, availableStatuses, showMaximizedView, title, calendarMode, tableReportsComponent, tableFilterComponent, onStatusChange, onViewChange, onDateChange, onCalendarModeSwitch, filteredIds, onCancelFilteredIdsClick, isFilteredIdsShown, cardNumber, leftActions, rightActions, isReportsButtonVisible, onSearchChange, onToggleViewButtonClick, leftComponent, tableViews, setTableViews, resetTableViews, onToggleTextButtonClick, calendarGroupBy, onCalendarGroupChange, children, maxDateRange, isAcceptance, startComponent, searchPlaceholder, tableMode, timezone, browserTimezone, defaultCountryTimezone, onChangeTimezone, segmentCountries, ...StatusBarProps }: TableHeaderProps<IStatus>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
declare const _default: typeof TableHeader;
|
|
5
5
|
export default _default;
|
|
@@ -15,8 +15,8 @@ import { FilteredIds, StatusBar, TableHeaderWrapper } from '../index.js';
|
|
|
15
15
|
import FiltersRow from './FiltersRow';
|
|
16
16
|
import { StatusButtonsContainer, TitleContainer, TableHeaderTitle, TableHeaderRow } from './style';
|
|
17
17
|
export function TableHeader(_a) {
|
|
18
|
-
var { date, status, availableStatuses, showMaximizedView, title, calendarMode, tableReportsComponent, tableFilterComponent, onStatusChange, onViewChange, onDateChange, onCalendarModeSwitch, filteredIds, onCancelFilteredIdsClick, isFilteredIdsShown, cardNumber, leftActions, rightActions, isReportsButtonVisible, onSearchChange, onToggleViewButtonClick, leftComponent, tableViews, setTableViews, resetTableViews, onToggleTextButtonClick, calendarGroupBy, onCalendarGroupChange, children, maxDateRange, isAcceptance, startComponent, searchPlaceholder, tableMode, timezone, browserTimezone, defaultCountryTimezone, onChangeTimezone, segmentCountries = []
|
|
19
|
-
const filtersRow = (_jsx(FiltersRow, { date: date, calendarMode: calendarMode, onDateChange: onDateChange, onCalendarModeSwitch: onCalendarModeSwitch, tableReportsComponent: tableReportsComponent, tableFilterComponent: tableFilterComponent, onViewChange: onViewChange, leftActions: leftActions, rightActions: rightActions, onSearchChange: onSearchChange, onToggleViewButtonClick: onToggleViewButtonClick, isReportsButtonVisible: isReportsButtonVisible, tableViews: tableViews, setTableViews: setTableViews, resetTableViews: resetTableViews, onToggleTextButtonClick: onToggleTextButtonClick, tableMode: tableMode, onCalendarGroupChange: onCalendarGroupChange, calendarGroupBy: calendarGroupBy, maxDateRange: maxDateRange, isAcceptance: isAcceptance, searchPlaceholder: searchPlaceholder, timezone: timezone, browserTimezone: browserTimezone, defaultCountryTimezone: defaultCountryTimezone, onChangeTimezone: onChangeTimezone, segmentCountries: segmentCountries
|
|
18
|
+
var { date, status, availableStatuses, showMaximizedView, title, calendarMode, tableReportsComponent, tableFilterComponent, onStatusChange, onViewChange, onDateChange, onCalendarModeSwitch, filteredIds, onCancelFilteredIdsClick, isFilteredIdsShown, cardNumber, leftActions, rightActions, isReportsButtonVisible, onSearchChange, onToggleViewButtonClick, leftComponent, tableViews, setTableViews, resetTableViews, onToggleTextButtonClick, calendarGroupBy, onCalendarGroupChange, children, maxDateRange, isAcceptance, startComponent, searchPlaceholder, tableMode, timezone, browserTimezone, defaultCountryTimezone, onChangeTimezone, segmentCountries = [] } = _a, StatusBarProps = __rest(_a, ["date", "status", "availableStatuses", "showMaximizedView", "title", "calendarMode", "tableReportsComponent", "tableFilterComponent", "onStatusChange", "onViewChange", "onDateChange", "onCalendarModeSwitch", "filteredIds", "onCancelFilteredIdsClick", "isFilteredIdsShown", "cardNumber", "leftActions", "rightActions", "isReportsButtonVisible", "onSearchChange", "onToggleViewButtonClick", "leftComponent", "tableViews", "setTableViews", "resetTableViews", "onToggleTextButtonClick", "calendarGroupBy", "onCalendarGroupChange", "children", "maxDateRange", "isAcceptance", "startComponent", "searchPlaceholder", "tableMode", "timezone", "browserTimezone", "defaultCountryTimezone", "onChangeTimezone", "segmentCountries"]);
|
|
19
|
+
const filtersRow = (_jsx(FiltersRow, { date: date, calendarMode: calendarMode, onDateChange: onDateChange, onCalendarModeSwitch: onCalendarModeSwitch, tableReportsComponent: tableReportsComponent, tableFilterComponent: tableFilterComponent, onViewChange: onViewChange, leftActions: leftActions, rightActions: rightActions, onSearchChange: onSearchChange, onToggleViewButtonClick: onToggleViewButtonClick, isReportsButtonVisible: isReportsButtonVisible, tableViews: tableViews, setTableViews: setTableViews, resetTableViews: resetTableViews, onToggleTextButtonClick: onToggleTextButtonClick, tableMode: tableMode, onCalendarGroupChange: onCalendarGroupChange, calendarGroupBy: calendarGroupBy, maxDateRange: maxDateRange, isAcceptance: isAcceptance, searchPlaceholder: searchPlaceholder, timezone: timezone, browserTimezone: browserTimezone, defaultCountryTimezone: defaultCountryTimezone, onChangeTimezone: onChangeTimezone, segmentCountries: segmentCountries }));
|
|
20
20
|
return (_jsxs(TableHeaderWrapper, { children: [showMaximizedView && (_jsxs(TitleContainer, { children: [_jsx("span", { children: !!title && _jsx(TableHeaderTitle, { children: title }) }), filtersRow] }, "TitleContainer")), _jsxs(TableHeaderRow, Object.assign({ as: "section" }, { children: [_jsxs(StatusButtonsContainer, Object.assign({ as: "aside" }, { children: [startComponent, _jsx(StatusBar, Object.assign({ status: status, availableStatuses: availableStatuses, onStatusChange: onStatusChange, isFilteredIdsShown: isFilteredIdsShown }, StatusBarProps)), leftComponent, isFilteredIdsShown && (_jsx(FilteredIds, { cardNumber: cardNumber, Ids: filteredIds, isShown: isFilteredIdsShown, onCancelClick: onCancelFilteredIdsClick }, "FilteredIds"))] })), !showMaximizedView && filtersRow] }), "FiltersWrapper"), children] }));
|
|
21
21
|
}
|
|
22
22
|
export default memo(TableHeader);
|
|
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
4
4
|
import { Reorder } from 'framer-motion';
|
|
5
5
|
import { CustomBackdrop, Menu } from '../../index.js';
|
|
6
6
|
import { downArrowIcon } from '../../../constants/index.js';
|
|
7
|
-
import { ButtonStyled, ListStyled, DropdownStyled } from './
|
|
7
|
+
import { ButtonStyled, ListStyled, DropdownStyled } from './style';
|
|
8
8
|
import { useSubMenu, useViewColumns } from './hooks';
|
|
9
9
|
import ColumnItem from './ColumnItem';
|
|
10
10
|
function CustomViews({ open, onSelect, setTableViews, tableViews, anchorEl, onClose }) {
|
|
@@ -28,6 +28,7 @@ function TableView({ onViewChange, setIsViewVisible, setTableViews, tableViews,
|
|
|
28
28
|
const onClose = () => {
|
|
29
29
|
setAnchorViewEl(null);
|
|
30
30
|
setIsViewVisible(false);
|
|
31
|
+
// to be removed
|
|
31
32
|
setSelectedViewInfo({ label: 'Default', id: 'default' });
|
|
32
33
|
};
|
|
33
34
|
const handleSelectedViewInfo = (selected) => {
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
export { useSubMenu } from './useSubMenu';
|
|
2
2
|
export { useViewColumns } from './useViewColumns';
|
|
3
3
|
export { useColumnItem } from './useColumnItem';
|
|
4
|
-
export { useViewsManager } from './useViewsManager';
|
|
5
|
-
export { useViewSelector } from './useViewSelector';
|
|
6
|
-
export { useSubmenuHover } from './useSubmenuHover';
|
|
7
|
-
export { useOriginalColumns } from './useOriginalColumns';
|
|
8
|
-
export { useNestedSubmenu } from './useNestedSubmenu';
|
|
9
|
-
export { useCreateViewDialog } from './useCreateViewDialog';
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
export { useSubMenu } from './useSubMenu';
|
|
2
2
|
export { useViewColumns } from './useViewColumns';
|
|
3
3
|
export { useColumnItem } from './useColumnItem';
|
|
4
|
-
export { useViewsManager } from './useViewsManager';
|
|
5
|
-
export { useViewSelector } from './useViewSelector';
|
|
6
|
-
export { useSubmenuHover } from './useSubmenuHover';
|
|
7
|
-
export { useOriginalColumns } from './useOriginalColumns';
|
|
8
|
-
export { useNestedSubmenu } from './useNestedSubmenu';
|
|
9
|
-
export { useCreateViewDialog } from './useCreateViewDialog';
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export { default as CustomViews } from './CustomViews';
|
|
5
|
-
export { default as ViewSelector } from './ViewSelector';
|
|
6
|
-
export { default as ViewsDropdown } from './ViewsDropdown';
|
|
7
|
-
export { default as CreateViewDialog } from './CreateViewDialog';
|
|
8
|
-
export type { ViewMenuItem, CreateCustomViewDialogProps, LayoutSection, ColumnItem, FieldItem, Template, CreateTemplatePayload, UpdateTemplatePayload, } from './types';
|
|
9
|
-
export { transformLayoutToColumns, getColumnsByMode, createCustomViewMenuItem, setViewAsDefault, transformTemplatesToViewMenuItems, convertColumnsToLayoutSection, isDateColumn, getColumnCheckState, } from './utils';
|
|
10
|
-
export { useSubmenuHover, useViewsManager, useViewSelector } from './hooks';
|
|
11
|
-
export { DIALOG_WIDTH, DIALOG_HEIGHT, MAX_CUSTOM_VIEWS, TEMPLATE_NAME_MAX_LENGTH } from './constants';
|
|
12
|
-
export { defaultViewList, advancedColumns, sheetColumns } from './data';
|
|
1
|
+
import TableView from './TableView';
|
|
2
|
+
export * from './TableView';
|
|
3
|
+
export default TableView;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export { default as CustomViews } from './CustomViews';
|
|
5
|
-
export { default as ViewSelector } from './ViewSelector';
|
|
6
|
-
export { default as ViewsDropdown } from './ViewsDropdown';
|
|
7
|
-
export { default as CreateViewDialog } from './CreateViewDialog';
|
|
8
|
-
export { transformLayoutToColumns, getColumnsByMode, createCustomViewMenuItem, setViewAsDefault, transformTemplatesToViewMenuItems, convertColumnsToLayoutSection, isDateColumn, getColumnCheckState, } from './utils';
|
|
9
|
-
export { useSubmenuHover, useViewsManager, useViewSelector } from './hooks';
|
|
10
|
-
export { DIALOG_WIDTH, DIALOG_HEIGHT, MAX_CUSTOM_VIEWS, TEMPLATE_NAME_MAX_LENGTH } from './constants';
|
|
11
|
-
// Note: defaultViewList, advancedColumns, sheetColumns are only exported for demo purposes
|
|
12
|
-
// They should not be used as defaults in production - all data should come from API
|
|
13
|
-
export { defaultViewList, advancedColumns, sheetColumns } from './data';
|
|
1
|
+
import TableView from './TableView';
|
|
2
|
+
export * from './TableView';
|
|
3
|
+
export default TableView;
|
|
@@ -2,7 +2,6 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import type { CalenderMode, TableHeaderStatus, ColumnViewProps, TableMode, Timezone, SegmentCountry } from '../../types/index.js';
|
|
3
3
|
import { AvailableStatus } from '../StatusBar/type';
|
|
4
4
|
import { PartialExcept } from '../../types/index.js';
|
|
5
|
-
import type { ViewMenuItem, LayoutSection, Template } from './TableView/types';
|
|
6
5
|
type ViewsOptions = {
|
|
7
6
|
default: {};
|
|
8
7
|
developer: {};
|
|
@@ -23,7 +22,7 @@ export interface TableHeaderProps<IStatus extends TableHeaderStatus | TableHeade
|
|
|
23
22
|
calendarMode?: CalenderMode;
|
|
24
23
|
onStatusChange?: <T extends IStatus>(status?: T) => void;
|
|
25
24
|
onSearch?: (search: string) => void;
|
|
26
|
-
onViewChange?: (
|
|
25
|
+
onViewChange?: () => void;
|
|
27
26
|
onDateChange?: (date: Date | [Date, Date]) => void;
|
|
28
27
|
tableReportsComponent?: React.ReactNode;
|
|
29
28
|
tableFilterComponent?: React.ReactNode;
|
|
@@ -45,19 +44,6 @@ export interface TableHeaderProps<IStatus extends TableHeaderStatus | TableHeade
|
|
|
45
44
|
id: string;
|
|
46
45
|
label: string;
|
|
47
46
|
}) => void;
|
|
48
|
-
onCreateCustomView?: (data: {
|
|
49
|
-
name: string;
|
|
50
|
-
selectedColumns: ColumnViewProps[];
|
|
51
|
-
layout: LayoutSection;
|
|
52
|
-
}) => Promise<void>;
|
|
53
|
-
onEditCustomView?: (viewId: string, data: {
|
|
54
|
-
name: string;
|
|
55
|
-
selectedColumns: ColumnViewProps[];
|
|
56
|
-
layout: LayoutSection;
|
|
57
|
-
}) => Promise<void>;
|
|
58
|
-
onDeleteCustomView?: (viewId: string) => Promise<void>;
|
|
59
|
-
templates?: Template[];
|
|
60
|
-
lang?: string;
|
|
61
47
|
onToggleTextButtonClick?: () => void;
|
|
62
48
|
children?: ReactNode;
|
|
63
49
|
calendarGroupBy?: string;
|
|
@@ -46,6 +46,7 @@ export declare const storedValueWalletIcon: string;
|
|
|
46
46
|
export declare const buyNowPayLaterIcon: string;
|
|
47
47
|
export declare const openBankingIcon: string;
|
|
48
48
|
export declare const visaIcon: string;
|
|
49
|
+
export declare const redArrowDownIcon: string;
|
|
49
50
|
export declare const completedIcon: string;
|
|
50
51
|
export declare const chargeBackRequestedIcon: string;
|
|
51
52
|
export declare const chargeBackIcon: string;
|
|
@@ -77,12 +78,14 @@ export declare const closeIcon: string;
|
|
|
77
78
|
export declare const dashedCheckIcon: string;
|
|
78
79
|
export declare const deactivatedIcon: string;
|
|
79
80
|
export declare const topUpIcon: string;
|
|
81
|
+
export declare const AIOverviewIcon: string;
|
|
80
82
|
export declare const deMaximizeIcon: string;
|
|
81
83
|
export declare const pendingFlag: string;
|
|
82
84
|
export declare const ibanIcon: string;
|
|
83
85
|
export declare const payoutIcon: string;
|
|
84
86
|
export declare const releasedFlag: string;
|
|
85
87
|
export declare const acceptedFlag: string;
|
|
88
|
+
export declare const clearIcon: string;
|
|
86
89
|
export declare const unCapturedIcon: string;
|
|
87
90
|
export declare const newWindowIcon: string;
|
|
88
91
|
export declare const viewAllIcon: string;
|
|
@@ -339,7 +342,6 @@ export declare const TAP3DSPROVIDERIcon: string;
|
|
|
339
342
|
export declare const greyPlusIcon: string;
|
|
340
343
|
export declare const greyMinusIcon: string;
|
|
341
344
|
export declare const noPreviewIcon: string;
|
|
342
|
-
export declare const editIcon: string;
|
|
343
345
|
export declare const viewInvoiceIcon: string;
|
|
344
346
|
export declare const checkoutStatusIcon: string;
|
|
345
347
|
export declare const checkoutStatusBlueIcon: string;
|
|
@@ -51,6 +51,7 @@ export const storedValueWalletIcon = `${lightUrl}/storedValueWallet.svg`;
|
|
|
51
51
|
export const buyNowPayLaterIcon = `${lightUrl}/buyNowPayLater.svg`;
|
|
52
52
|
export const openBankingIcon = `${lightUrl}/openBanking.svg`;
|
|
53
53
|
export const visaIcon = `${lightUrl}/visa.svg`;
|
|
54
|
+
export const redArrowDownIcon = `${lightUrl}/redArrowDownIcon.svg`;
|
|
54
55
|
export const completedIcon = `${lightUrl}/completed.svg`;
|
|
55
56
|
export const chargeBackRequestedIcon = `${lightUrl}/chargebackRequested.svg`;
|
|
56
57
|
export const chargeBackIcon = `${lightUrl}/chargeback.svg`;
|
|
@@ -82,12 +83,14 @@ export const closeIcon = `${lightUrl}/close.svg`;
|
|
|
82
83
|
export const dashedCheckIcon = `${lightUrl}/dashedCheckIcon.svg`;
|
|
83
84
|
export const deactivatedIcon = `${lightUrl}/deactivatedIcon.svg`;
|
|
84
85
|
export const topUpIcon = `${lightUrl}/topup.svg`;
|
|
86
|
+
export const AIOverviewIcon = `${lightUrl}/AIOverviewIcon.svg`;
|
|
85
87
|
export const deMaximizeIcon = `${appBaseUrl}/demaximize.svg`;
|
|
86
88
|
export const pendingFlag = `${lightUrl}/pendingFlag.svg`;
|
|
87
89
|
export const ibanIcon = `${lightUrl}/ibanIcon.svg`;
|
|
88
90
|
export const payoutIcon = `${lightUrl}/payoutIcon.svg`;
|
|
89
91
|
export const releasedFlag = `${lightUrl}/releasedFlag.svg`;
|
|
90
92
|
export const acceptedFlag = `${lightUrl}/acceptedFlag.svg`;
|
|
93
|
+
export const clearIcon = `${lightUrl}/clearIcon.svg`;
|
|
91
94
|
export const unCapturedIcon = `${lightUrl}/status/unCaptured.svg`;
|
|
92
95
|
export const newWindowIcon = `${appBaseUrl}/newWindow.svg`;
|
|
93
96
|
export const viewAllIcon = `${appBaseUrl}/viewAll.svg`;
|
|
@@ -345,7 +348,6 @@ export const TAP3DSPROVIDERIcon = `${lightUrl}/provider/TAP3DS.svg`;
|
|
|
345
348
|
export const greyPlusIcon = `${lightUrl}/greyPlusIcon.svg`;
|
|
346
349
|
export const greyMinusIcon = `${lightUrl}/greyMinusIcon.svg`;
|
|
347
350
|
export const noPreviewIcon = `${lightUrl}/noPreviewIcon.svg`;
|
|
348
|
-
export const editIcon = `${lightUrl}/other/editIcon.svg`;
|
|
349
351
|
export const viewInvoiceIcon = `${appBaseUrl}/viewInvoice.svg`;
|
|
350
352
|
export const checkoutStatusIcon = `${appBaseUrl}/checkoutStatus.svg`;
|
|
351
353
|
export const checkoutStatusBlueIcon = `${appBaseUrl}/checkStatusOutBlue.svg`;
|
package/build/types/index.d.ts
CHANGED
package/build/types/index.js
CHANGED
package/build/utils/date.d.ts
CHANGED
|
@@ -43,4 +43,9 @@ export declare function isWithinTimeAgo(timestampMs: number, amount: number, uni
|
|
|
43
43
|
export declare const formatRelativeTimeWithinHour: (timestampMs: number) => string;
|
|
44
44
|
export declare const isTodayDate: (date: string | Date) => boolean;
|
|
45
45
|
export declare const isYesterdayDate: (date: string | Date) => boolean;
|
|
46
|
+
export interface InsightDateLabelResult {
|
|
47
|
+
label: string;
|
|
48
|
+
isCustom: boolean;
|
|
49
|
+
}
|
|
50
|
+
export declare const getDateLabel: (from: Date, to: Date) => InsightDateLabelResult;
|
|
46
51
|
export {};
|
package/build/utils/date.js
CHANGED
|
@@ -245,3 +245,40 @@ export const formatRelativeTimeWithinHour = (timestampMs) => {
|
|
|
245
245
|
};
|
|
246
246
|
export const isTodayDate = (date) => dayjs(date).isToday();
|
|
247
247
|
export const isYesterdayDate = (date) => dayjs(date).isYesterday();
|
|
248
|
+
export const getDateLabel = (from, to) => {
|
|
249
|
+
const start = dayjs(from).startOf('day');
|
|
250
|
+
const end = dayjs(to).endOf('day');
|
|
251
|
+
const today = dayjs().startOf('day');
|
|
252
|
+
const currentYear = today.year();
|
|
253
|
+
const diffDays = end.diff(start, 'day') + 1;
|
|
254
|
+
// Today / Yesterday
|
|
255
|
+
if (start.isToday() && end.isToday())
|
|
256
|
+
return { label: 'Today', isCustom: false };
|
|
257
|
+
if (start.isYesterday() && end.isYesterday())
|
|
258
|
+
return { label: 'Yesterday', isCustom: false };
|
|
259
|
+
// Last 7 days
|
|
260
|
+
if (diffDays === 7 && end.isSame(today, 'day'))
|
|
261
|
+
return { label: 'Last 7 days', isCustom: false };
|
|
262
|
+
// Last 30 days (inclusive)
|
|
263
|
+
if (diffDays === 31 && end.isSame(today, 'day'))
|
|
264
|
+
return { label: 'Last 30 days', isCustom: false };
|
|
265
|
+
// Full month
|
|
266
|
+
if (start.date() === 1 && end.date() === end.daysInMonth() && start.month() === end.month()) {
|
|
267
|
+
const monthLabel = start.year() === currentYear ? start.format('MMMM') : start.format('MMMM YYYY');
|
|
268
|
+
return { label: monthLabel, isCustom: false };
|
|
269
|
+
}
|
|
270
|
+
// Same day: show Month + Day
|
|
271
|
+
if (start.isSame(end, 'day')) {
|
|
272
|
+
const label = start.format(start.year() === currentYear ? 'MMM D' : 'MMM D YYYY');
|
|
273
|
+
return { label, isCustom: false };
|
|
274
|
+
}
|
|
275
|
+
// Custom range
|
|
276
|
+
const showStartYear = start.year() !== currentYear;
|
|
277
|
+
const showEndYear = end.year() !== currentYear;
|
|
278
|
+
const startLabel = start.format(`MMM D${showStartYear ? ' YYYY' : ''}`);
|
|
279
|
+
const endLabel = end.format(`MMM D${showEndYear ? ' YYYY' : ''}`);
|
|
280
|
+
return {
|
|
281
|
+
label: `${startLabel} – ${endLabel}`,
|
|
282
|
+
isCustom: true,
|
|
283
|
+
};
|
|
284
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/os-micro-frontend-shared",
|
|
3
3
|
"description": "Shared components and utilities for Tap Payments micro frontends",
|
|
4
|
-
"version": "0.1.376-test.
|
|
4
|
+
"version": "0.1.376-test.2",
|
|
5
5
|
"testVersion": 2,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
@@ -78,7 +78,6 @@
|
|
|
78
78
|
"@emotion/styled": "^11.11.0",
|
|
79
79
|
"@hookform/resolvers": "^3.3.1",
|
|
80
80
|
"@mui/material": "^5.12.3",
|
|
81
|
-
"@tap-payments/os-micro-frontend-shared": "file:.yalc/@tap-payments/os-micro-frontend-shared",
|
|
82
81
|
"@uiw/react-json-view": "^2.0.0-alpha.16",
|
|
83
82
|
"axios": "^1.4.0",
|
|
84
83
|
"color": "^5.0.0",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { CreateCustomViewDialogProps } from './types';
|
|
2
|
-
declare function CreateViewDialog({ open, onClose, onCreate, availableColumns, defaultColumns, editingView, onDelete, tableViews, mode, }: Readonly<CreateCustomViewDialogProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
-
export default CreateViewDialog;
|