@tap-payments/os-micro-frontend-shared 0.0.267 → 0.0.268-test.1
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/RangeCalender/RangeCalender.d.ts +3 -1
- package/build/components/RangeCalender/RangeCalender.js +2 -2
- package/build/components/RangeCalender/components/RangeDatepicker/RangeDatepicker.d.ts +1 -1
- package/build/components/RangeCalender/style.js +4 -0
- package/build/components/VirtualTable/SheetView/SheetViewTableHeader.js +9 -2
- package/build/components/VirtualTable/components/ColumnFilter/ColumnFilter.d.ts +8 -3
- package/build/components/VirtualTable/components/ColumnFilter/ColumnFilter.js +11 -14
- package/build/components/VirtualTable/style.js +1 -1
- package/package.json +2 -2
|
@@ -2,6 +2,7 @@ import { MouseEvent } from 'react';
|
|
|
2
2
|
import { PopperProps } from '@mui/material/Popper';
|
|
3
3
|
import type { CalenderMode, Timezone } from '../../types/index.js';
|
|
4
4
|
import { SxProps } from '@mui/system';
|
|
5
|
+
import { RangeDatepickerProps } from './components/RangeDatepicker/RangeDatepicker';
|
|
5
6
|
interface RangeCalendarProps {
|
|
6
7
|
defaultDate: [Date, Date];
|
|
7
8
|
onDateChange: (date: [Date, Date], timezoneOffset?: number) => void;
|
|
@@ -22,6 +23,7 @@ interface RangeCalendarProps {
|
|
|
22
23
|
renderCalendarButton?: (open: boolean, onOpenCalender: (event: MouseEvent<HTMLElement>) => void) => React.ReactNode;
|
|
23
24
|
mainSx?: SxProps;
|
|
24
25
|
popperProps?: Partial<PopperProps>;
|
|
26
|
+
rangeDatePickerProps?: Partial<RangeDatepickerProps>;
|
|
25
27
|
}
|
|
26
|
-
declare function RangeCalender({ defaultDate, onDateChange, mode, onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezoneHistory, onChangeTimezone, defaultTimezone, browserTimezone, calendarPopperSx, renderCalendarButton, mainSx, popperProps, }: RangeCalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
declare function RangeCalender({ defaultDate, onDateChange, mode, onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezoneHistory, onChangeTimezone, defaultTimezone, browserTimezone, calendarPopperSx, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, }: RangeCalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
27
29
|
export default RangeCalender;
|
|
@@ -13,7 +13,7 @@ import QuickFilters from './components/QuickFilters';
|
|
|
13
13
|
import RangeDatePicker from './components/RangeDatepicker';
|
|
14
14
|
import CustomTimezone from './components/Timezone';
|
|
15
15
|
import { ButtonsWrapper, CalenderWrapper, CancelButton, FiltersArea, Footer, Main, OkayButton, SelectedDate, TimeZone, Settings } from './style';
|
|
16
|
-
function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezoneHistory, onChangeTimezone, defaultTimezone, browserTimezone, calendarPopperSx, renderCalendarButton, mainSx, popperProps, }) {
|
|
16
|
+
function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalendarModeSwitch, numberOfMonths, noTimezone, noQuickFilter, maxDateRange, onCalendarGroupChange, groupBy, timezone, onChangeTimezoneHistory, onChangeTimezone, defaultTimezone, browserTimezone, calendarPopperSx, renderCalendarButton, mainSx, popperProps, rangeDatePickerProps, }) {
|
|
17
17
|
const [dates, setDates] = useState([new DateObject(defaultDate[0]), new DateObject(defaultDate[1])]);
|
|
18
18
|
const [values, setValues] = useState(dates);
|
|
19
19
|
const [selectedTimezone, setSelectedTimezone] = useState(timezone);
|
|
@@ -87,6 +87,6 @@ function RangeCalender({ defaultDate, onDateChange, mode = 'gregorian', onCalend
|
|
|
87
87
|
onCloseCalender();
|
|
88
88
|
} })), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-end", sx: Object.assign({ zIndex: 3 }, calendarPopperSx) }, popperProps, { children: _jsxs(CalenderWrapper, { children: [!noQuickFilter && (_jsxs(FiltersArea, { children: [_jsx(QuickFilters, { onChange: onChangeQuickFilter, isHijri: isHijri }), _jsxs(Settings, { children: [groupBy && (_jsx(GroupBy, { groupBy: selectedGroupBy, isCalenderOpen: open, onUpdate: (group) => {
|
|
89
89
|
setSelectedGroupBy(group);
|
|
90
|
-
} })), _jsx(Hijri, { isHijri: isHijri, onCalendarModeSwitch: onCalendarModeSwitch })] })] })), _jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', justifyContent: 'space-between' } }, { children: [_jsx(RangeDatePicker, { values: values, onChange: onChange, isHijri: isHijri, ref: calendarRef, numberOfMonths: numberOfMonths }), _jsx(Collapse, Object.assign({ in: isError && Boolean(maxDateRange) }, { children: _jsx(Error, { error: t('dateRangeError', { number: maxDateRange }), sx: { marginInline: '16px', marginBottom: '16px' } }) })), _jsxs(Footer, Object.assign({ sx: { borderBottomLeftRadius: '8px' } }, { children: [!noTimezone ? (_jsx(TimeZone, { children: _jsx(CustomTimezone, { onChange: setSelectedTimezone, selectedTimezone: selectedTimezone, defaultTimezone: defaultTimezone, browserTimezone: browserTimezone }, String(open)) })) : (_jsx("div", {})), _jsxs(ButtonsWrapper, { children: [_jsx(CancelButton, Object.assign({ variant: "contained", onClick: onCloseCalender }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ variant: "contained", onClick: submitDate }, { children: t('okay') }))] })] }))] }))] }) }))] })));
|
|
90
|
+
} })), _jsx(Hijri, { isHijri: isHijri, onCalendarModeSwitch: onCalendarModeSwitch })] })] })), _jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', justifyContent: 'space-between' } }, { children: [_jsx(RangeDatePicker, Object.assign({ values: values, onChange: onChange, isHijri: isHijri, ref: calendarRef, numberOfMonths: numberOfMonths }, rangeDatePickerProps)), _jsx(Collapse, Object.assign({ in: isError && Boolean(maxDateRange) }, { children: _jsx(Error, { error: t('dateRangeError', { number: maxDateRange }), sx: { marginInline: '16px', marginBottom: '16px' } }) })), _jsxs(Footer, Object.assign({ sx: { borderBottomLeftRadius: '8px' } }, { children: [!noTimezone ? (_jsx(TimeZone, { children: _jsx(CustomTimezone, { onChange: setSelectedTimezone, selectedTimezone: selectedTimezone, defaultTimezone: defaultTimezone, browserTimezone: browserTimezone }, String(open)) })) : (_jsx("div", {})), _jsxs(ButtonsWrapper, { children: [_jsx(CancelButton, Object.assign({ variant: "contained", onClick: onCloseCalender }, { children: t('cancel') })), _jsx(OkayButton, Object.assign({ variant: "contained", onClick: submitDate }, { children: t('okay') }))] })] }))] }))] }) }))] })));
|
|
91
91
|
}
|
|
92
92
|
export default RangeCalender;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CalendarProps } from 'react-multi-date-picker';
|
|
3
3
|
import { Dates } from '../../type';
|
|
4
|
-
interface RangeDatepickerProps extends Omit<CalendarProps, 'onChange'> {
|
|
4
|
+
export interface RangeDatepickerProps extends Omit<CalendarProps, 'onChange'> {
|
|
5
5
|
isAr?: boolean;
|
|
6
6
|
isHijri: boolean;
|
|
7
7
|
values: Dates;
|
|
@@ -113,6 +113,10 @@ export const CalenderWrapper = styled(Box)(({ theme }) => ({
|
|
|
113
113
|
'.rmdp-day.start.end': {
|
|
114
114
|
overflow: 'hidden',
|
|
115
115
|
},
|
|
116
|
+
'.rmdp-day.rmdp-disabled': {
|
|
117
|
+
color: '#ccc',
|
|
118
|
+
cursor: 'not-allowed',
|
|
119
|
+
},
|
|
116
120
|
}));
|
|
117
121
|
export const CancelButton = styled(Button)(({ theme }) => ({
|
|
118
122
|
textTransform: 'capitalize',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useState } from 'react';
|
|
2
|
+
import { memo, useRef, useState } from 'react';
|
|
3
3
|
import { Box, useTheme } from '@mui/material';
|
|
4
4
|
import Dropdown from '../../DropdownMenu';
|
|
5
5
|
import { columnIcon, pinIcon, sortAzIcon, sortZaIcon, unpinIcon } from '../../../constants/index.js';
|
|
@@ -9,6 +9,7 @@ import { ActionIcon, ColumnIcon, PinIconContainer, StyledHeader, StyledMUITableR
|
|
|
9
9
|
function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort, columnsSorting, pinnedColumns = [], onColumnPin, isPinnable = false, lastColumnId, selectedColumn = null, onColumnClick, }) {
|
|
10
10
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
11
11
|
const open = Boolean(anchorEl);
|
|
12
|
+
const columnFilterRef = useRef(null);
|
|
12
13
|
const theme = useTheme();
|
|
13
14
|
const handleClick = (event) => {
|
|
14
15
|
setAnchorEl(event.currentTarget);
|
|
@@ -45,7 +46,13 @@ function SheetViewTableHeader({ columns, headerProps, showBackDrop, onColumnSort
|
|
|
45
46
|
const isPinned = pinnedColumns.includes(id);
|
|
46
47
|
const isDefaultPinned = !!column.isDefaultPinned;
|
|
47
48
|
const isSelected = selectedColumn === id;
|
|
48
|
-
return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell", "data-column-id": column.id, "data-column-width": column.width, "data-column-width-used": column.width, "data-column-align": column.align, "data-column-order": column.order, "data-column-header": typeof column.header === 'string' ? column.header : 'component', "data-column-sortable": !!column.sortable, "data-column-filterable": !!column.filter, "data-column-pinned": isPinned, isFirst: isFirst, isLast: isLast, isSheetView: true, onClick: (event) =>
|
|
49
|
+
return (_jsxs(StyledCell, Object.assign({ "data-id": id, component: "div", "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell", "data-column-id": column.id, "data-column-width": column.width, "data-column-width-used": column.width, "data-column-align": column.align, "data-column-order": column.order, "data-column-header": typeof column.header === 'string' ? column.header : 'component', "data-column-sortable": !!column.sortable, "data-column-filterable": !!column.filter, "data-column-pinned": isPinned, isFirst: isFirst, isLast: isLast, isSheetView: true, onClick: (event) => {
|
|
50
|
+
var _a;
|
|
51
|
+
onColumnClick === null || onColumnClick === void 0 ? void 0 : onColumnClick(id, event);
|
|
52
|
+
if (columnFilterRef.current) {
|
|
53
|
+
(_a = columnFilterRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
54
|
+
}
|
|
55
|
+
}, sx: Object.assign({ display: 'flex', gap: theme.spacing(0.5), alignItems: 'center', justifyContent: align === 'right' ? 'flex-end' : 'flex-start', width: column.width, textAlign: align, overflow: 'unset', cursor: 'pointer', boxSizing: 'border-box', border: isSelected ? '2px solid #1F88D0' : '1px solid #F2F2F2', backgroundColor: isSelected ? '#F2F2F2' : '#FCFCFC', height: isSelected ? '100%' : 'auto', minHeight: isSelected ? '28px' : 'auto' }, headerStyle) }, { children: [typeof header === 'function' ? (header()) : (_jsx(Box, Object.assign({ "data-testid": "SheetViewTableHeader_columns_header", sx: { maxWidth: '100%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, { children: header && _jsx(HeaderText, Object.assign({ "data-testid": "SheetViewVirtualTable_TableHeader_StyledCell_header_text" }, { children: header })) }))), filter && _jsx(ColumnFilter, Object.assign({ ref: columnFilterRef }, filter)), sortable && _jsx(ColumnIcon, { onClick: sortable ? handleClick : undefined, src: columnIcon, alt: "column-icon", "data-id": id }), isPinnable && pinnable && !isDefaultPinned && !isLast && (_jsx(PinIconContainer, Object.assign({ onClick: (event) => {
|
|
49
56
|
event.stopPropagation();
|
|
50
57
|
handlePinClick(id);
|
|
51
58
|
}, title: isPinned ? 'Unpin column' : 'Pin column' }, { children: _jsx("img", { src: isPinned ? unpinIcon : pinIcon, alt: "pin-icon" }) })))] }), `${id}-${colIndex}`));
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
declare const _default: import("react").ForwardRefExoticComponent<({
|
|
3
|
+
onConfirm?: ((filterValues: import("../../../../types/index.js").ColumnFilterValues) => void) | undefined;
|
|
4
|
+
onClear: (apiKeys: string[]) => void;
|
|
5
|
+
onColumnFilterClearClick?: (() => void) | undefined;
|
|
6
|
+
data?: import("../../../../types/index.js").ColumnFilterValues | undefined;
|
|
7
|
+
isOnlyOneFilter?: boolean | undefined;
|
|
8
|
+
wrapperSx?: import("@mui/system").SxProps | undefined;
|
|
9
|
+
} & (import("../../../../types/index.js").IColumnFilterList | import("../../../../types/index.js").IColumnFilterInputs | import("../../../../types/index.js").IColumnFilterCustom)) & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
10
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo, useState } from 'react';
|
|
3
3
|
import Box from '@mui/material/Box';
|
|
4
4
|
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
5
5
|
import Popper from '@mui/material/Popper';
|
|
@@ -8,13 +8,14 @@ import Inputs from './Inputs';
|
|
|
8
8
|
import List from './List';
|
|
9
9
|
import { FilterWrapper } from './style';
|
|
10
10
|
import CustomBackdrop from '../../../CustomBackdrop';
|
|
11
|
-
function ColumnFilter(filter) {
|
|
11
|
+
function ColumnFilter(filter, ref) {
|
|
12
12
|
const [anchorEl, setAnchorEl] = useState(null);
|
|
13
13
|
const openDropdown = (event) => {
|
|
14
14
|
setAnchorEl(event.currentTarget);
|
|
15
15
|
};
|
|
16
16
|
const onCloseDropdown = () => {
|
|
17
17
|
setAnchorEl(null);
|
|
18
|
+
console.log('close');
|
|
18
19
|
};
|
|
19
20
|
const filterData = useMemo(() => { var _a; return ((_a = filter === null || filter === void 0 ? void 0 : filter.options) === null || _a === void 0 ? void 0 : _a.reduce((acc, { apiKey }) => { var _a; return (Object.assign(Object.assign({}, acc), { [apiKey]: (_a = filter === null || filter === void 0 ? void 0 : filter.data) === null || _a === void 0 ? void 0 : _a[apiKey] })); }, {})) || {}; }, [filter]);
|
|
20
21
|
const listFilterData = useMemo(() => {
|
|
@@ -23,11 +24,7 @@ function ColumnFilter(filter) {
|
|
|
23
24
|
const rawData = (_a = listFilter === null || listFilter === void 0 ? void 0 : listFilter.data) === null || _a === void 0 ? void 0 : _a[listFilter.apiKey];
|
|
24
25
|
return Array.isArray(rawData) ? rawData : [];
|
|
25
26
|
}, [filter]);
|
|
26
|
-
const showClearIcon =
|
|
27
|
-
if (typeof value === 'string' || Array.isArray(value))
|
|
28
|
-
return value.length > 0;
|
|
29
|
-
return Boolean(value);
|
|
30
|
-
}) || listFilterData.length > 0, [filterData, listFilterData]);
|
|
27
|
+
const showClearIcon = true;
|
|
31
28
|
const open = Boolean(anchorEl);
|
|
32
29
|
const filterApiKeys = useMemo(() => {
|
|
33
30
|
var _a;
|
|
@@ -50,10 +47,10 @@ function ColumnFilter(filter) {
|
|
|
50
47
|
}
|
|
51
48
|
return null;
|
|
52
49
|
}, [open, filter, anchorEl, setAnchorEl]);
|
|
53
|
-
return (_jsx(ClickAwayListener, Object.assign({ onClickAway: onCloseDropdown }, { children: _jsxs(Box, Object.assign({ component: "section", "data-testid": "ColumnFilter", sx: { position: 'relative', display: 'flex', alignItems: 'center' } }, { children: [showClearIcon ? (_jsxs(FilterWrapper, { children: [_jsx(Box, { component: "img", "data-testid": "ColumnFilter_whiteFilterIcon", src: whiteFilterIcon, alt: "filter-icon", sx: { marginInlineEnd: '2px', height: 6 }, onClick: openDropdown }), _jsx(Box, { component: "img", "data-testid": "ColumnFilter_closeIcon", src: closeIcon, alt: "close-icon", onClick: () => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
return (_jsxs(_Fragment, { children: [_jsx(ClickAwayListener, Object.assign({ onClickAway: onCloseDropdown }, { children: _jsxs(Box, Object.assign({ component: "section", "data-testid": "ColumnFilter", sx: { position: 'relative', display: 'flex', alignItems: 'center' } }, { children: [showClearIcon ? (_jsxs(FilterWrapper, { children: [_jsx(Box, { component: "img", "data-testid": "ColumnFilter_whiteFilterIcon", src: whiteFilterIcon, alt: "filter-icon", sx: { marginInlineEnd: '2px', height: 6 }, onClick: openDropdown, ref: ref }), _jsx(Box, { component: "img", "data-testid": "ColumnFilter_closeIcon", src: closeIcon, alt: "close-icon", onClick: () => {
|
|
51
|
+
filter.onClear(filterApiKeys);
|
|
52
|
+
} })] })) : (_jsx(Box, { component: "img", "data-testid": "ColumnFilter_columnIcon", src: columnIcon, alt: "column-icon", sx: { cursor: 'pointer', marginTop: '2px' }, onClick: openDropdown, ref: ref })), open && _jsx(CustomBackdrop, { onClick: onCloseDropdown, sx: { background: 'red', zIndex: 12 } })] })) })), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-start", sx: {
|
|
53
|
+
zIndex: 9999,
|
|
54
|
+
} }, { children: renderFilter }))] }));
|
|
58
55
|
}
|
|
59
|
-
export default
|
|
56
|
+
export default forwardRef(ColumnFilter);
|
|
@@ -29,7 +29,7 @@ export const StyledSolidBackground = styled(Box)(({ theme }) => ({
|
|
|
29
29
|
backgroundColor: theme.palette.background.default,
|
|
30
30
|
}));
|
|
31
31
|
export const StyledCell = styled(TableCell, {
|
|
32
|
-
shouldForwardProp: (prop) => !['isLast', 'isFirst', 'isSheetView'].includes(prop),
|
|
32
|
+
shouldForwardProp: (prop) => !['isLast', 'isFirst', 'isSheetView', 'isSelected'].includes(prop),
|
|
33
33
|
})(({ theme, isLast, isFirst, isSheetView, isSelected }) => (Object.assign(Object.assign({ paddingBlock: '0', paddingInline: '0.3875rem !important', paddingLeft: isFirst ? '0 !important' : '0.3875rem !important', paddingRight: isLast ? '0 !important' : '0.3875rem !important', color: isSheetView ? theme.palette.text.primary : theme.palette.grey[700], fontSize: isSheetView ? theme.typography.subtitle1.fontSize : theme.typography.caption.fontSize, height: '100%', fontWeight: isSheetView ? 400 : theme.typography.fontWeightRegular, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: 'flex', alignItems: 'center' }, (isSheetView && {
|
|
34
34
|
borderRight: isLast ? 'none' : `1px solid ${theme.palette.divider}`,
|
|
35
35
|
paddingInline: '8px !important',
|
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.0.
|
|
4
|
+
"version": "0.0.268-test.1",
|
|
5
5
|
"testVersion": 1,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
@@ -131,4 +131,4 @@
|
|
|
131
131
|
"publishConfig": {
|
|
132
132
|
"registry": "https://registry.npmjs.org/"
|
|
133
133
|
}
|
|
134
|
-
}
|
|
134
|
+
}
|