@tap-payments/os-micro-frontend-shared 0.0.222-test.10 → 0.0.222-test.11
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.
|
@@ -3,5 +3,5 @@ interface InputsI {
|
|
|
3
3
|
onCloseDropdown: () => void;
|
|
4
4
|
filter: IColumnFilter & IColumnFilterInputs;
|
|
5
5
|
}
|
|
6
|
-
declare function Inputs({ onCloseDropdown, filter: { options, onConfirm, data, isOnlyOneFilter, onColumnFilterClearClick } }: InputsI): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function Inputs({ onCloseDropdown, filter: { options, onConfirm, data, isOnlyOneFilter, onColumnFilterClearClick, wrapperSx } }: InputsI): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default Inputs;
|
|
@@ -7,7 +7,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
7
7
|
import { grayCloseIcon, searchIcon } from '../../../../../constants/index.js';
|
|
8
8
|
import { Wrapper, Text, InputStyled, InputsWrapper, ClearButton, ClearWrapper } from './style';
|
|
9
9
|
import { CancelButton, Footer, OkayButton } from '../style';
|
|
10
|
-
function Inputs({ onCloseDropdown, filter: { options = [], onConfirm, data, isOnlyOneFilter, onColumnFilterClearClick } }) {
|
|
10
|
+
function Inputs({ onCloseDropdown, filter: { options = [], onConfirm, data, isOnlyOneFilter, onColumnFilterClearClick, wrapperSx } }) {
|
|
11
11
|
const [values, setValues] = useState({});
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
setValues((options || []).reduce((acc, { apiKey }) => { var _a; return (Object.assign(Object.assign({}, acc), { [apiKey]: (_a = data === null || data === void 0 ? void 0 : data[apiKey]) !== null && _a !== void 0 ? _a : '' })); }, {}));
|
|
@@ -39,7 +39,7 @@ function Inputs({ onCloseDropdown, filter: { options = [], onConfirm, data, isOn
|
|
|
39
39
|
const isAnyInputWithValue = Object.entries(values).some(([inputKey, val]) => { var _a; return Boolean(val) && (((_a = getFilterByApiKey(inputKey)) === null || _a === void 0 ? void 0 : _a.filterGroup) !== filterGroup || !filterGroup); });
|
|
40
40
|
return isOnlyOneFilter && !inputWithValue && isAnyInputWithValue;
|
|
41
41
|
}, [options, values, isOnlyOneFilter]);
|
|
42
|
-
return (_jsxs(Wrapper, Object.assign({ component: "article", "data-testid": "ColumnFilterInputs" }, { children: [_jsx(Text, Object.assign({ component: "header", "data-testid": "ColumnFilterInputs_title" }, { children: t('filterBy') })), _jsx(InputsWrapper, Object.assign({ "data-testid": "ColumnFilterInputs_inputs", component: "main" }, { children: options.map(({ placeholder, apiKey, isDisabled, filterGroup, render }) => (_jsx(Fragment, { children: render ? (render()) : (_jsx(InputStyled, { className: "input", "data-testid": "ColumnFilterInputs_InputStyled", name: apiKey, placeholder: placeholder, onChange: (e) => {
|
|
42
|
+
return (_jsxs(Wrapper, Object.assign({ component: "article", "data-testid": "ColumnFilterInputs" }, { children: [_jsx(Text, Object.assign({ component: "header", "data-testid": "ColumnFilterInputs_title" }, { children: t('filterBy') })), _jsx(InputsWrapper, Object.assign({ "data-testid": "ColumnFilterInputs_inputs", component: "main", sx: wrapperSx }, { children: options.map(({ placeholder, apiKey, isDisabled, filterGroup, render }) => (_jsx(Fragment, { children: render ? (render()) : (_jsx(InputStyled, { className: "input", "data-testid": "ColumnFilterInputs_InputStyled", name: apiKey, placeholder: placeholder, onChange: (e) => {
|
|
43
43
|
setValues(Object.assign(Object.assign({}, values), { [apiKey]: e.target.value }));
|
|
44
44
|
}, disabled: isDisabled || isInputDisabled(apiKey, filterGroup), value: getInputValue(apiKey), inputProps: { autoComplete: 'off', 'data-testid': 'ColumnFilterInputs_input' }, endAdornment: _jsx(Box, { component: "img", "data-testid": "ColumnFilterInputs_icon", "data-icon": isInputHasValue(apiKey) ? 'close' : 'search', src: isInputHasValue(apiKey) ? grayCloseIcon : searchIcon, alt: "search", className: "icon", sx: { cursor: isInputHasValue(apiKey) ? 'pointer' : 'default' }, onClick: () => {
|
|
45
45
|
onClickResetInput(apiKey);
|
package/build/types/table.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { TableRowProps } from '@mui/material/TableRow';
|
|
|
5
5
|
import { DragControls } from 'framer-motion';
|
|
6
6
|
import { Country } from './appConfig';
|
|
7
7
|
import { SortingOrder } from './sort';
|
|
8
|
+
import { SxProps } from '@mui/material';
|
|
8
9
|
export interface TableFilters<T> {
|
|
9
10
|
order: string;
|
|
10
11
|
dateRange: [Date, Date];
|
|
@@ -137,4 +138,5 @@ export type IColumnFilter = ({
|
|
|
137
138
|
onColumnFilterClearClick?: () => void;
|
|
138
139
|
data?: ColumnFilterValues;
|
|
139
140
|
isOnlyOneFilter?: boolean;
|
|
141
|
+
wrapperSx?: SxProps;
|
|
140
142
|
} & (IColumnFilterList | IColumnFilterInputs | IColumnFilterCustom));
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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.222-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.0.222-test.11",
|
|
5
|
+
"testVersion": 11,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|