@astral/ui 4.28.1 → 4.30.0
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/components/AddressAutocomplete/AddressAutocomplete.d.ts +1 -1
- package/components/AsyncAutocomplete/useLogic/useLogic.d.ts +3 -3
- package/components/Autocomplete/Autocomplete.d.ts +1 -1
- package/components/Avatar/styles.d.ts +1 -1
- package/components/CopyTypography/CopyTypography.js +2 -2
- package/components/CopyTypography/types.d.ts +8 -0
- package/components/CopyTypography/useLogic/useLogic.d.ts +332 -1
- package/components/CopyTypography/useLogic/useLogic.js +2 -1
- package/components/DataGrid/Cell/Cell.d.ts +4 -0
- package/components/DataGrid/Cell/Cell.js +7 -2
- package/components/DataGrid/Row/Row.js +1 -3
- package/components/Description/Value/styles.d.ts +332 -0
- package/components/Filename/Filename.js +2 -2
- package/components/Filename/styles.d.ts +4 -0
- package/components/Filename/styles.js +4 -1
- package/components/FormLabel/styles.d.ts +1 -1
- package/components/JsonViewer/NodeValue/styles.d.ts +331 -0
- package/components/NumberField/NumberField.d.ts +1 -1
- package/components/Tooltip/Tooltip.d.ts +1 -15
- package/components/Tooltip/Tooltip.js +3 -2
- package/components/Tooltip/types.d.ts +14 -0
- package/components/Tooltip/useLogic/index.d.ts +1 -0
- package/components/Tooltip/useLogic/index.js +1 -0
- package/components/Tooltip/useLogic/useLogic.d.ts +335 -0
- package/components/Tooltip/useLogic/useLogic.js +16 -0
- package/components/personalDataSecurity/PersonalData/PersonalData.d.ts +1 -1
- package/components/personalDataSecurity/PersonalData/PersonalData.js +2 -1
- package/hook-form/FormFilters/AllFiltersButton/AllFiltersButton.d.ts +2 -0
- package/hook-form/FormFilters/AllFiltersButton/AllFiltersButton.js +10 -0
- package/hook-form/FormFilters/AllFiltersButton/index.d.ts +1 -0
- package/hook-form/FormFilters/AllFiltersButton/index.js +1 -0
- package/hook-form/FormFilters/AllFiltersButton/styles.d.ts +19 -0
- package/hook-form/FormFilters/AllFiltersButton/styles.js +53 -0
- package/hook-form/FormFilters/AllFiltersButton/types.d.ts +8 -0
- package/hook-form/FormFilters/AllFiltersButton/types.js +1 -0
- package/hook-form/FormFilters/AllFiltersButton/useLogic/index.d.ts +1 -0
- package/hook-form/FormFilters/AllFiltersButton/useLogic/index.js +1 -0
- package/hook-form/FormFilters/AllFiltersButton/useLogic/useLogic.d.ts +6 -0
- package/hook-form/FormFilters/AllFiltersButton/useLogic/useLogic.js +33 -0
- package/hook-form/FormFilters/FormFilters.js +5 -6
- package/hook-form/FormFilters/FormFiltersDialog/useLogic/useLogic.d.ts +1 -1
- package/hook-form/FormFilters/FormFiltersDialog/useLogic/useLogic.js +4 -7
- package/hook-form/FormFilters/constants.d.ts +0 -1
- package/hook-form/FormFilters/constants.js +0 -1
- package/hook-form/FormFilters/styles.d.ts +0 -18
- package/hook-form/FormFilters/styles.js +0 -51
- package/hook-form/FormFilters/types.d.ts +7 -16
- package/hook-form/FormFilters/useLogic/useLogic.d.ts +5 -6
- package/hook-form/FormFilters/useLogic/useLogic.js +7 -95
- package/hook-form/FormFiltersSearchField/FormFiltersSearchField.js +1 -1
- package/node/components/AddressAutocomplete/AddressAutocomplete.d.ts +1 -1
- package/node/components/AsyncAutocomplete/useLogic/useLogic.d.ts +3 -3
- package/node/components/Autocomplete/Autocomplete.d.ts +1 -1
- package/node/components/Avatar/styles.d.ts +1 -1
- package/node/components/CopyTypography/CopyTypography.js +2 -2
- package/node/components/CopyTypography/types.d.ts +8 -0
- package/node/components/CopyTypography/useLogic/useLogic.d.ts +332 -1
- package/node/components/CopyTypography/useLogic/useLogic.js +2 -1
- package/node/components/DataGrid/Cell/Cell.d.ts +4 -0
- package/node/components/DataGrid/Cell/Cell.js +7 -2
- package/node/components/DataGrid/Row/Row.js +1 -3
- package/node/components/Description/Value/styles.d.ts +332 -0
- package/node/components/Filename/Filename.js +1 -1
- package/node/components/Filename/styles.d.ts +4 -0
- package/node/components/Filename/styles.js +5 -2
- package/node/components/FormLabel/styles.d.ts +1 -1
- package/node/components/JsonViewer/NodeValue/styles.d.ts +331 -0
- package/node/components/NumberField/NumberField.d.ts +1 -1
- package/node/components/Tooltip/Tooltip.d.ts +1 -15
- package/node/components/Tooltip/Tooltip.js +3 -2
- package/node/components/Tooltip/types.d.ts +14 -0
- package/node/components/Tooltip/useLogic/index.d.ts +1 -0
- package/node/components/Tooltip/useLogic/index.js +17 -0
- package/node/components/Tooltip/useLogic/useLogic.d.ts +335 -0
- package/node/components/Tooltip/useLogic/useLogic.js +20 -0
- package/node/components/personalDataSecurity/PersonalData/PersonalData.d.ts +1 -1
- package/node/components/personalDataSecurity/PersonalData/PersonalData.js +2 -1
- package/node/hook-form/FormFilters/AllFiltersButton/AllFiltersButton.d.ts +2 -0
- package/node/hook-form/FormFilters/AllFiltersButton/AllFiltersButton.js +14 -0
- package/node/hook-form/FormFilters/AllFiltersButton/index.d.ts +1 -0
- package/node/hook-form/FormFilters/AllFiltersButton/index.js +5 -0
- package/node/hook-form/FormFilters/AllFiltersButton/styles.d.ts +19 -0
- package/node/hook-form/FormFilters/AllFiltersButton/styles.js +56 -0
- package/node/hook-form/FormFilters/AllFiltersButton/types.d.ts +8 -0
- package/node/hook-form/FormFilters/AllFiltersButton/types.js +2 -0
- package/node/hook-form/FormFilters/AllFiltersButton/useLogic/index.d.ts +1 -0
- package/node/hook-form/FormFilters/AllFiltersButton/useLogic/index.js +17 -0
- package/node/hook-form/FormFilters/AllFiltersButton/useLogic/useLogic.d.ts +6 -0
- package/node/hook-form/FormFilters/AllFiltersButton/useLogic/useLogic.js +37 -0
- package/node/hook-form/FormFilters/FormFilters.js +3 -4
- package/node/hook-form/FormFilters/FormFiltersDialog/useLogic/useLogic.d.ts +1 -1
- package/node/hook-form/FormFilters/FormFiltersDialog/useLogic/useLogic.js +4 -7
- package/node/hook-form/FormFilters/constants.d.ts +0 -1
- package/node/hook-form/FormFilters/constants.js +0 -1
- package/node/hook-form/FormFilters/styles.d.ts +0 -18
- package/node/hook-form/FormFilters/styles.js +1 -52
- package/node/hook-form/FormFilters/types.d.ts +7 -16
- package/node/hook-form/FormFilters/useLogic/useLogic.d.ts +5 -6
- package/node/hook-form/FormFilters/useLogic/useLogic.js +6 -94
- package/node/hook-form/FormFiltersSearchField/FormFiltersSearchField.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createUIKitClassname } from '../../components/utils/createUIKitClassname';
|
|
2
2
|
export const formFiltersClassnames = {
|
|
3
3
|
modalFilters: createUIKitClassname('form-filters__modal-filters'),
|
|
4
|
-
pageHeaderFilters: createUIKitClassname('form-filters__page-header-filters'),
|
|
5
4
|
submitButton: createUIKitClassname('form-filters__submit-button'),
|
|
6
5
|
allFiltersButton: createUIKitClassname('form-filters__all-filters-button'),
|
|
7
6
|
showAllFiltersButtonOnDesktop: createUIKitClassname('form-filters_show-all-filters-button_desktop'),
|
|
@@ -3,30 +3,12 @@ export declare const Wrapper: import("../../components/styled").StyledComponent<
|
|
|
3
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
4
4
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
5
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
-
export declare const AllFiltersButtonWrapper: import("../../components/styled").StyledComponent<{
|
|
7
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
8
|
-
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
9
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
10
6
|
export declare const MainFiltersWrapper: import("../../components/styled").StyledComponent<{
|
|
11
7
|
theme?: import("@emotion/react").Theme | undefined;
|
|
12
8
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
13
9
|
} & {
|
|
14
10
|
columns?: string | undefined;
|
|
15
11
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
|
-
export declare const StyledBadge: import("../../components/styled").StyledComponent<Omit<import("../..").WithoutEmotionSpecific<import("@mui/material/Badge").BadgeProps>, "color"> & {
|
|
17
|
-
color: import("../../components/Badge").BadgeColor;
|
|
18
|
-
withBorder?: boolean | undefined;
|
|
19
|
-
variantColor?: import("../../components/Badge").BadgeVariantsColor | undefined;
|
|
20
|
-
} & {
|
|
21
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
22
|
-
}, {}, {}>;
|
|
23
|
-
export declare const StyledCounter: import("../../components/styled").StyledComponent<Omit<import("../..").WithoutEmotionSpecific<import("@mui/material/Badge").BadgeProps>, "content" | "color" | "children" | "variant" | "invisible" | "anchorOrigin" | "badgeContent" | "overlap" | "withBorder"> & {
|
|
24
|
-
color: import("../../components/Counter/types").CounterColor;
|
|
25
|
-
variant?: import("../../components/Counter/types").CounterVariants | undefined;
|
|
26
|
-
content?: number | undefined;
|
|
27
|
-
} & {
|
|
28
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
29
|
-
}, {}, {}>;
|
|
30
12
|
export declare const SubmitButtonWrapper: import("../../components/styled").StyledComponent<{
|
|
31
13
|
theme?: import("@emotion/react").Theme | undefined;
|
|
32
14
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { badgeClasses } from '@mui/material/Badge';
|
|
2
1
|
import { formLabelClasses } from '@mui/material/FormLabel';
|
|
3
2
|
import { inputBaseClasses } from '@mui/material/InputBase';
|
|
4
|
-
import { Badge } from '../../components/Badge';
|
|
5
|
-
import { Counter } from '../../components/Counter';
|
|
6
3
|
import { styled } from '../../components/styled';
|
|
7
4
|
import { formFiltersClassnames } from './constants';
|
|
8
5
|
export const Wrapper = styled.div `
|
|
@@ -32,41 +29,6 @@ export const Wrapper = styled.div `
|
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
31
|
`;
|
|
35
|
-
export const AllFiltersButtonWrapper = styled.div `
|
|
36
|
-
display: none;
|
|
37
|
-
|
|
38
|
-
white-space: nowrap;
|
|
39
|
-
|
|
40
|
-
&.${formFiltersClassnames.showAllFiltersButtonOnDesktop} {
|
|
41
|
-
display: flex;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
45
|
-
margin-right: 0;
|
|
46
|
-
&.${formFiltersClassnames.showAllFiltersButtonOnMobile} {
|
|
47
|
-
display: flex;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&.${formFiltersClassnames.withoutSearch} {
|
|
51
|
-
width: 100%;
|
|
52
|
-
|
|
53
|
-
.${formFiltersClassnames.allFiltersButton} {
|
|
54
|
-
width: 100%;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
&.${formFiltersClassnames.withSearch} {
|
|
59
|
-
.${formFiltersClassnames.allFiltersButton} {
|
|
60
|
-
display: unset;
|
|
61
|
-
gap: 0;
|
|
62
|
-
|
|
63
|
-
padding: 8px;
|
|
64
|
-
|
|
65
|
-
font-size: 0;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
`;
|
|
70
32
|
export const MainFiltersWrapper = styled.div `
|
|
71
33
|
display: grid;
|
|
72
34
|
grid-auto-flow: column;
|
|
@@ -79,19 +41,6 @@ export const MainFiltersWrapper = styled.div `
|
|
|
79
41
|
display: none;
|
|
80
42
|
}
|
|
81
43
|
`;
|
|
82
|
-
export const StyledBadge = styled(Badge) `
|
|
83
|
-
width: 100%;
|
|
84
|
-
.${badgeClasses.dot} {
|
|
85
|
-
${({ theme }) => theme.breakpoints.up('sm')} {
|
|
86
|
-
display: none;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
`;
|
|
90
|
-
export const StyledCounter = styled(Counter) `
|
|
91
|
-
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
92
|
-
display: none;
|
|
93
|
-
}
|
|
94
|
-
`;
|
|
95
44
|
export const SubmitButtonWrapper = styled.div `
|
|
96
45
|
white-space: nowrap;
|
|
97
46
|
|
|
@@ -1,45 +1,36 @@
|
|
|
1
1
|
import { type ObjectAsyncGuard, type ObjectGuard } from '@astral/validations';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
|
-
import { type Control } from 'react-hook-form';
|
|
3
|
+
import { type Control, type UseFormReturn } from 'react-hook-form';
|
|
4
4
|
import type { ButtonProps } from '../../components/Button';
|
|
5
5
|
type InputsProps<TFieldValues extends Record<string, unknown>> = {
|
|
6
6
|
control: Control<TFieldValues>;
|
|
7
7
|
};
|
|
8
8
|
export type FormFiltersProps<TFieldValues extends Record<string, unknown>> = {
|
|
9
|
+
form: UseFormReturn<TFieldValues>;
|
|
10
|
+
onSubmit?: (values: TFieldValues) => void;
|
|
9
11
|
/**
|
|
10
12
|
* Схема валидации из @astral/validations
|
|
11
13
|
*/
|
|
12
14
|
validationSchema?: ObjectGuard<TFieldValues> | ObjectAsyncGuard<TFieldValues>;
|
|
13
|
-
/**
|
|
14
|
-
* Значения фильтров
|
|
15
|
-
*/
|
|
16
|
-
values?: TFieldValues;
|
|
17
|
-
/**
|
|
18
|
-
* Callback вызываемый при изменении значений фильтров. Вызывается с debounce (300ms)
|
|
19
|
-
*/
|
|
20
|
-
onChange: (values: TFieldValues) => void;
|
|
21
15
|
/**
|
|
22
16
|
* Поле поиска
|
|
23
17
|
*
|
|
24
18
|
* @example
|
|
25
19
|
* ```ts
|
|
26
20
|
* <FormFilters
|
|
27
|
-
* SearchField={(
|
|
21
|
+
* SearchField={({control}) => <FormFiltersSearchField control={control} placeholder="Поиск..." />}
|
|
28
22
|
* />
|
|
29
23
|
* ```
|
|
30
24
|
*/
|
|
31
|
-
searchField?: (props: InputsProps<TFieldValues>
|
|
32
|
-
fullWidth?: boolean;
|
|
33
|
-
}) => ReactNode;
|
|
25
|
+
searchField?: (props: InputsProps<TFieldValues>) => ReactNode;
|
|
34
26
|
/**
|
|
35
27
|
* Основные фильтры
|
|
36
28
|
*
|
|
37
29
|
* @example
|
|
38
30
|
* ```ts
|
|
39
31
|
* <FormFilters
|
|
40
|
-
* MainFilters={({ control, isModal
|
|
32
|
+
* MainFilters={({ control, isModal }) =>
|
|
41
33
|
* <FormTextField
|
|
42
|
-
* {...props}
|
|
43
34
|
* control={control}
|
|
44
35
|
* name="name"
|
|
45
36
|
* label="Название"
|
|
@@ -57,7 +48,7 @@ export type FormFiltersProps<TFieldValues extends Record<string, unknown>> = {
|
|
|
57
48
|
* @example
|
|
58
49
|
* ```ts
|
|
59
50
|
* <FormFilters
|
|
60
|
-
* SecondaryFilters={({ control
|
|
51
|
+
* SecondaryFilters={({ control }) => <FormTextField control={control} name="name" label="Название" placeholder="Введите название" />}
|
|
61
52
|
* />
|
|
62
53
|
* ```
|
|
63
54
|
*/
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { type UseFormReturn } from '
|
|
1
|
+
import { type UseFormReturn } from 'react-hook-form';
|
|
2
2
|
import { type FormFiltersDialogProps } from '../FormFiltersDialog/types';
|
|
3
3
|
import { type FormFiltersProps } from '../types';
|
|
4
4
|
type UseLogicReturn<TFieldValues extends Record<string, unknown>> = {
|
|
5
|
-
|
|
5
|
+
form: UseFormReturn<TFieldValues>;
|
|
6
|
+
onSubmit?: (values: TFieldValues) => void;
|
|
6
7
|
searchField: FormFiltersProps<TFieldValues>['searchField'];
|
|
7
8
|
mainFilters: FormFiltersProps<TFieldValues>['mainFilters'];
|
|
8
9
|
submitButton: FormFiltersProps<TFieldValues>['submitButton'];
|
|
9
|
-
|
|
10
|
-
onSubmit: (submittedValues: TFieldValues) => void;
|
|
10
|
+
secondaryFilters: FormFiltersProps<TFieldValues>['secondaryFilters'];
|
|
11
11
|
onOpenModal: () => void;
|
|
12
12
|
dialogProps: FormFiltersDialogProps<TFieldValues>;
|
|
13
13
|
mainFiltersColumns?: string;
|
|
14
14
|
isLoading?: boolean;
|
|
15
|
-
allFiltersButtonClassName: string;
|
|
16
15
|
};
|
|
17
|
-
export declare const useLogic: <TFieldValues extends Record<string, unknown>>({
|
|
16
|
+
export declare const useLogic: <TFieldValues extends Record<string, unknown>>({ form, onSubmit, validationSchema, searchField, mainFilters, secondaryFilters, submitButton, mainFiltersColumns, isLoading, }: FormFiltersProps<TFieldValues>) => UseLogicReturn<TFieldValues>;
|
|
18
17
|
export {};
|
|
@@ -1,120 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { useWatch } from 'react-hook-form';
|
|
4
|
-
import { checkIsDeepEqual } from '../../../components/utils/checkIsDeepEqual';
|
|
5
|
-
import { classNames } from '../../../components/utils/classNames';
|
|
6
|
-
import { FORM_FILTERS_SEARCH_FIELD_ID } from '../../FormFiltersSearchField/constants';
|
|
7
|
-
import { useForm } from '../../useForm';
|
|
8
|
-
import { formFiltersClassnames } from '../constants';
|
|
9
|
-
import { useFirstMountAfterLoading } from './hooks';
|
|
10
|
-
export const useLogic = ({ validationSchema, values, onChange, searchField, mainFilters, secondaryFilters, submitButton, mainFiltersColumns, isLoading, }) => {
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
export const useLogic = ({ form, onSubmit, validationSchema, searchField, mainFilters, secondaryFilters, submitButton, mainFiltersColumns, isLoading, }) => {
|
|
11
3
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
12
|
-
const isFirstMount = useFirstMountAfterLoading(isLoading);
|
|
13
4
|
const onOpenModal = () => {
|
|
14
5
|
setIsModalOpen(true);
|
|
15
6
|
};
|
|
16
|
-
const headerForm = useForm({
|
|
17
|
-
validationSchema,
|
|
18
|
-
defaultValues: values,
|
|
19
|
-
});
|
|
20
|
-
const headerFormValues = useWatch({
|
|
21
|
-
control: headerForm.control,
|
|
22
|
-
});
|
|
23
|
-
// Ref для хранения debounced функции, чтобы можно было её отменить
|
|
24
|
-
const debouncedOnChangeRef = useRef(null);
|
|
25
|
-
// Ref для отслеживания внешнего reset (чтобы не вызывать onChange при внешнем reset)
|
|
26
|
-
const isExternalResetRef = useRef(false);
|
|
27
|
-
// Ref для хранения предыдущих внешних values (для сравнения)
|
|
28
|
-
const previousValuesRef = useRef(values);
|
|
29
|
-
// Отменяет предыдущий debounced вызов onChange, если он есть
|
|
30
|
-
const clearPreviousDebouncedOnChange = () => {
|
|
31
|
-
if (debouncedOnChangeRef.current) {
|
|
32
|
-
debouncedOnChangeRef.current.clear();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const hasSubmitButton = Boolean(submitButton);
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
// Если есть submitButton, не вызываем onChange при изменении значений
|
|
38
|
-
if (hasSubmitButton || isLoading || isFirstMount) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
clearPreviousDebouncedOnChange();
|
|
42
|
-
// Пропускаем onChange если это внешний reset
|
|
43
|
-
if (isExternalResetRef.current) {
|
|
44
|
-
isExternalResetRef.current = false;
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
// Создаем новый debounced вызов
|
|
48
|
-
const debouncedOnChange = debounce(() => {
|
|
49
|
-
onChange(headerFormValues);
|
|
50
|
-
}, 300);
|
|
51
|
-
debouncedOnChangeRef.current = debouncedOnChange;
|
|
52
|
-
debouncedOnChange();
|
|
53
|
-
return () => {
|
|
54
|
-
debouncedOnChange.clear();
|
|
55
|
-
};
|
|
56
|
-
}, [headerFormValues, onChange, hasSubmitButton, isLoading]);
|
|
57
|
-
const searchName = document
|
|
58
|
-
.getElementById(FORM_FILTERS_SEARCH_FIELD_ID)
|
|
59
|
-
?.getAttribute('name') || '';
|
|
60
|
-
// Исключаем поиск из счетчика фильтров
|
|
61
|
-
const counter = Object.values(headerFormValues).filter(Boolean).length -
|
|
62
|
-
(headerFormValues[searchName] ? 1 : 0);
|
|
63
|
-
const setFiltersValues = (newValues) => headerForm.reset(newValues);
|
|
64
|
-
// Функция отправки формы на SubmitButton. Приводит к вызову onChange без debounce.
|
|
65
|
-
const onSubmit = (submittedValues) => {
|
|
66
|
-
clearPreviousDebouncedOnChange();
|
|
67
|
-
onChange?.(submittedValues);
|
|
68
|
-
};
|
|
69
7
|
// Функция отправки формы на кнопку "Применить" в модальном окне
|
|
70
8
|
const onSubmitModal = (submittedValues) => {
|
|
71
|
-
|
|
72
|
-
onSubmit(submittedValues);
|
|
9
|
+
form.reset(submittedValues);
|
|
73
10
|
};
|
|
74
|
-
// Синхронизация внешних values с формой
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (isFirstMount) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
// Сравниваем значения, чтобы избежать лишних reset
|
|
80
|
-
const valuesChanged = !checkIsDeepEqual(previousValuesRef.current, values);
|
|
81
|
-
if (!valuesChanged) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
clearPreviousDebouncedOnChange();
|
|
85
|
-
isExternalResetRef.current = true;
|
|
86
|
-
previousValuesRef.current = values;
|
|
87
|
-
setFiltersValues(values);
|
|
88
|
-
}, [values, headerForm]);
|
|
89
|
-
const allFiltersButtonClassName = useMemo(() => {
|
|
90
|
-
return classNames({
|
|
91
|
-
[formFiltersClassnames.showAllFiltersButtonOnDesktop]: Boolean(secondaryFilters),
|
|
92
|
-
[formFiltersClassnames.showAllFiltersButtonOnMobile]: Boolean(mainFilters) || Boolean(secondaryFilters),
|
|
93
|
-
[formFiltersClassnames.withSearch]: Boolean(searchField),
|
|
94
|
-
[formFiltersClassnames.withoutSearch]: !searchField,
|
|
95
|
-
});
|
|
96
|
-
}, [mainFilters, secondaryFilters, searchField]);
|
|
97
11
|
const dialogProps = {
|
|
98
12
|
validationSchema,
|
|
99
|
-
|
|
13
|
+
form,
|
|
100
14
|
mainFilters,
|
|
101
15
|
secondaryFilters,
|
|
102
|
-
defaultValues: headerFormValues,
|
|
103
16
|
onSubmit: onSubmitModal,
|
|
104
17
|
isModalOpen,
|
|
105
18
|
setIsModalOpen,
|
|
106
19
|
};
|
|
107
20
|
return {
|
|
108
|
-
|
|
21
|
+
form,
|
|
22
|
+
onSubmit,
|
|
109
23
|
searchField,
|
|
110
24
|
mainFilters,
|
|
25
|
+
secondaryFilters,
|
|
111
26
|
submitButton,
|
|
112
|
-
counter,
|
|
113
|
-
onSubmit,
|
|
114
27
|
onOpenModal,
|
|
115
28
|
dialogProps,
|
|
116
29
|
mainFiltersColumns,
|
|
117
30
|
isLoading,
|
|
118
|
-
allFiltersButtonClassName,
|
|
119
31
|
};
|
|
120
32
|
};
|
|
@@ -12,6 +12,6 @@ function FormFiltersSearchFieldInner({ width, ...props }, ref) {
|
|
|
12
12
|
...props,
|
|
13
13
|
defaultValue: props.defaultValue || '',
|
|
14
14
|
});
|
|
15
|
-
return (_jsx(Wrapper, { "$width": width, children: _jsx(SearchField, { ...fieldProps, ref: ref, inputProps: { id: FORM_FILTERS_SEARCH_FIELD_ID } }) }));
|
|
15
|
+
return (_jsx(Wrapper, { "$width": width, children: _jsx(SearchField, { ...fieldProps, ref: ref, inputProps: { id: FORM_FILTERS_SEARCH_FIELD_ID }, fullWidth: true }) }));
|
|
16
16
|
}
|
|
17
17
|
export const FormFiltersSearchField = forwardRefWithGeneric(FormFiltersSearchFieldInner);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type Address } from './types';
|
|
3
|
-
export declare const AddressAutocomplete: <TOptions extends Address = Address>(props: Pick<import("../AsyncAutocomplete").AsyncAutocompleteProps<TOptions, false, false, boolean>, "defaultValue" | "className" | "id" | "role" | "ref" | "label" | "open" | "size" | "disablePortal" | "onClose" | "onOpen" | "
|
|
3
|
+
export declare const AddressAutocomplete: <TOptions extends Address = Address>(props: Pick<import("../AsyncAutocomplete").AsyncAutocompleteProps<TOptions, false, false, boolean>, "defaultValue" | "className" | "id" | "role" | "ref" | "label" | "open" | "size" | "disablePortal" | "onClose" | "onOpen" | "placeholder" | "readOnly" | "isDisabled" | "isError" | "inputRef" | "hideHelperText" | "helperText" | "loadingText" | "noOptionsText" | "renderOption" | "autoHighlight" | "getOptionDisabled" | "onInputChange" | "fetchOptions" | "fetchDelayMs" | "minSymbolsToFetch" | "isFullWidth" | "isSuccess" | "isLoading" | "isRequired"> & {
|
|
4
4
|
value?: TOptions | undefined;
|
|
5
5
|
onChange: (value: TOptions) => void;
|
|
6
6
|
freeSolo?: boolean | undefined;
|
|
@@ -307,14 +307,14 @@ export declare const useLogic: <TOptions, TMultiple extends boolean, TDisableCle
|
|
|
307
307
|
disabledItemsFocusable?: boolean | undefined;
|
|
308
308
|
disableListWrap?: boolean | undefined;
|
|
309
309
|
PopperComponent?: import("react").JSXElementConstructor<import("@mui/material").PopperProps> | undefined;
|
|
310
|
-
inputRef?: import("react").Ref<any> | undefined;
|
|
311
310
|
autoComplete?: boolean | undefined;
|
|
312
311
|
multiple?: TMultiple | undefined;
|
|
312
|
+
placeholder?: string | undefined;
|
|
313
|
+
readOnly?: boolean | undefined;
|
|
314
|
+
inputRef?: import("react").Ref<any> | undefined;
|
|
313
315
|
hideHelperText?: boolean | undefined;
|
|
314
316
|
helperText?: import("react").ReactNode;
|
|
315
317
|
inputProps?: import("@mui/material").InputBaseComponentProps | undefined;
|
|
316
|
-
placeholder?: string | undefined;
|
|
317
|
-
readOnly?: boolean | undefined;
|
|
318
318
|
ChipProps?: import("@mui/material").ChipProps<"div"> | undefined;
|
|
319
319
|
clearIcon?: import("react").ReactNode;
|
|
320
320
|
clearText?: string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type AutocompleteRenderInputParams } from './types';
|
|
3
|
-
export declare const Autocomplete: <TAutocompleteValueProps, TMultiple extends boolean, TDisableClearable extends boolean, TFreeSolo extends boolean>(props: Omit<import("..").WithoutEmotionSpecific<import("@mui/material/Autocomplete/Autocomplete").AutocompleteProps<TAutocompleteValueProps, TMultiple, TDisableClearable, TFreeSolo, "div">>, "size" | "clearText" | "closeText" | "noOptionsText" | "openText" | "renderInput"> & Pick<import("../TextField").TextFieldProps, "label" | "success" | "error" | "
|
|
3
|
+
export declare const Autocomplete: <TAutocompleteValueProps, TMultiple extends boolean, TDisableClearable extends boolean, TFreeSolo extends boolean>(props: Omit<import("..").WithoutEmotionSpecific<import("@mui/material/Autocomplete/Autocomplete").AutocompleteProps<TAutocompleteValueProps, TMultiple, TDisableClearable, TFreeSolo, "div">>, "size" | "clearText" | "closeText" | "noOptionsText" | "openText" | "renderInput"> & Pick<import("../TextField").TextFieldProps, "label" | "success" | "error" | "placeholder" | "required" | "inputRef" | "helperText" | "inputProps"> & {
|
|
4
4
|
renderInput?: ((props: Omit<import("..").WithoutEmotionSpecific<import("@mui/material").TextFieldProps>, "color" | "select" | "margin" | "variant" | "multiline" | "SelectProps"> & {
|
|
5
5
|
success?: boolean | undefined;
|
|
6
6
|
startAdornment?: import("react").ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type AvatarSize } from './types';
|
|
3
|
-
export declare const StyledAvatar: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("@mui/material/Avatar").AvatarOwnProps & import("@mui/material/Avatar").AvatarSlotsAndSlotProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "sx" | "classes" | "className" | "style" | "children" | "variant" | "slots" | "slotProps" | "alt" | "
|
|
3
|
+
export declare const StyledAvatar: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("@mui/material/Avatar").AvatarOwnProps & import("@mui/material/Avatar").AvatarSlotsAndSlotProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "sx" | "classes" | "className" | "style" | "children" | "variant" | "slots" | "slotProps" | "alt" | "sizes" | "src" | "srcSet" | "imgProps"> & {
|
|
4
4
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
5
|
} & {
|
|
6
6
|
$size?: AvatarSize | undefined;
|
|
@@ -8,11 +8,11 @@ const constants_1 = require("./constants");
|
|
|
8
8
|
const styles_1 = require("./styles");
|
|
9
9
|
const useLogic_1 = require("./useLogic");
|
|
10
10
|
const CopyTypography = (props) => {
|
|
11
|
-
const { handleMouseLeave, handleClick, tooltipTitle, isIconOnLeft, isIconOnRight, restProps, copyPosition, color, showCopyIcon, isOverflow, children, } = (0, useLogic_1.useLogic)(props);
|
|
11
|
+
const { handleMouseLeave, handleClick, tooltipTitle, isIconOnLeft, isIconOnRight, restProps, copyPosition, color, showCopyIcon, isOverflow, children, tooltipProps, } = (0, useLogic_1.useLogic)(props);
|
|
12
12
|
const renderIcon = () => ((0, jsx_runtime_1.jsx)(styles_1.StyledCopyIcon, { size: "sm", "$copyPosition": copyPosition, color: color, className: (0, classNames_1.classNames)({
|
|
13
13
|
[constants_1.copyTypographyClassnames.showIconOnHover]: showCopyIcon === 'onHover',
|
|
14
14
|
}) }));
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: tooltipTitle, disableInteractive: true, placement: "bottom", children: (0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { onMouseLeave: handleMouseLeave, onClick: handleClick, component: "div", color: color, ...restProps, children: [isIconOnLeft && renderIcon(), (0, jsx_runtime_1.jsx)(styles_1.TypographyWrapper, { className: (0, classNames_1.classNames)({
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: tooltipTitle, disableInteractive: true, placement: "bottom", ...tooltipProps, children: (0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { onMouseLeave: handleMouseLeave, onClick: handleClick, component: "div", color: color, ...restProps, children: [isIconOnLeft && renderIcon(), (0, jsx_runtime_1.jsx)(styles_1.TypographyWrapper, { className: (0, classNames_1.classNames)({
|
|
16
16
|
[constants_1.copyTypographyClassnames.overflow]: isOverflow,
|
|
17
17
|
}), children: children }), isIconOnRight && renderIcon()] }) }));
|
|
18
18
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type TooltipProps as BasicTooltipProps } from '../Tooltip';
|
|
1
2
|
import { type TypographyProps } from '../Typography';
|
|
3
|
+
type TooltipProps = Omit<BasicTooltipProps, 'ref'>;
|
|
2
4
|
export type CopyTypographyProps = TypographyProps & {
|
|
3
5
|
/**
|
|
4
6
|
* Текст, который будет скопирован. Перекрывает обычное копирование если children является строкой
|
|
@@ -20,4 +22,10 @@ export type CopyTypographyProps = TypographyProps & {
|
|
|
20
22
|
* Если `true`, включается скрытие текста под троеточие (...) при overflow
|
|
21
23
|
*/
|
|
22
24
|
isOverflow?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Пропс для кастомизации тултипа
|
|
27
|
+
* @example <CopyTypography tooltipProps={{placement: 'top-start'}} />
|
|
28
|
+
*/
|
|
29
|
+
tooltipProps?: Omit<TooltipProps, 'children' | 'title'>;
|
|
23
30
|
};
|
|
31
|
+
export {};
|